Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(15)

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutTableCell.cpp

Issue 1656743002: Removing more implicit LayoutUnit construction (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix additional test Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1997 Martin Jones (mjones@kde.org) 2 * Copyright (C) 1997 Martin Jones (mjones@kde.org)
3 * (C) 1997 Torben Weis (weis@kde.org) 3 * (C) 1997 Torben Weis (weis@kde.org)
4 * (C) 1998 Waldo Bastian (bastian@kde.org) 4 * (C) 1998 Waldo Bastian (bastian@kde.org)
5 * (C) 1999 Lars Knoll (knoll@kde.org) 5 * (C) 1999 Lars Knoll (knoll@kde.org)
6 * (C) 1999 Antti Koivisto (koivisto@kde.org) 6 * (C) 1999 Antti Koivisto (koivisto@kde.org)
7 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. 7 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 if (node() && style()->autoWrap()) { 147 if (node() && style()->autoWrap()) {
148 // See if nowrap was set. 148 // See if nowrap was set.
149 Length w = styleOrColLogicalWidth(); 149 Length w = styleOrColLogicalWidth();
150 const AtomicString& nowrap = toElement(node())->getAttribute(nowrapAttr) ; 150 const AtomicString& nowrap = toElement(node())->getAttribute(nowrapAttr) ;
151 if (!nowrap.isNull() && w.isFixed()) { 151 if (!nowrap.isNull() && w.isFixed()) {
152 // Nowrap is set, but we didn't actually use it because of the 152 // Nowrap is set, but we didn't actually use it because of the
153 // fixed width set on the cell. Even so, it is a WinIE/Moz trait 153 // fixed width set on the cell. Even so, it is a WinIE/Moz trait
154 // to make the minwidth of the cell into the fixed width. They do t his 154 // to make the minwidth of the cell into the fixed width. They do t his
155 // even in strict mode, so do not make this a quirk. Affected the t op 155 // even in strict mode, so do not make this a quirk. Affected the t op
156 // of hiptop.com. 156 // of hiptop.com.
157 m_minPreferredLogicalWidth = std::max<LayoutUnit>(w.value(), m_minPr eferredLogicalWidth); 157 m_minPreferredLogicalWidth = std::max(LayoutUnit(w.value()), m_minPr eferredLogicalWidth);
158 } 158 }
159 } 159 }
160 } 160 }
161 161
162 void LayoutTableCell::addLayerHitTestRects(LayerHitTestRects& layerRects, const PaintLayer* currentLayer, const LayoutPoint& layerOffset, const LayoutRect& cont ainerRect) const 162 void LayoutTableCell::addLayerHitTestRects(LayerHitTestRects& layerRects, const PaintLayer* currentLayer, const LayoutPoint& layerOffset, const LayoutRect& cont ainerRect) const
163 { 163 {
164 LayoutPoint adjustedLayerOffset = layerOffset; 164 LayoutPoint adjustedLayerOffset = layerOffset;
165 // LayoutTableCell's location includes the offset of it's containing LayoutT ableRow, so 165 // LayoutTableCell's location includes the offset of it's containing LayoutT ableRow, so
166 // we need to subtract that again here (as for LayoutTableCell::offsetFromCo ntainer. 166 // we need to subtract that again here (as for LayoutTableCell::offsetFromCo ntainer.
167 if (parent()) 167 if (parent())
168 adjustedLayerOffset -= parentBox()->locationOffset(); 168 adjustedLayerOffset -= parentBox()->locationOffset();
169 LayoutBox::addLayerHitTestRects(layerRects, currentLayer, adjustedLayerOffse t, containerRect); 169 LayoutBox::addLayerHitTestRects(layerRects, currentLayer, adjustedLayerOffse t, containerRect);
170 } 170 }
171 171
172 void LayoutTableCell::computeIntrinsicPadding(int rowHeight, SubtreeLayoutScope& layouter) 172 void LayoutTableCell::computeIntrinsicPadding(int rowHeight, SubtreeLayoutScope& layouter)
173 { 173 {
174 int oldIntrinsicPaddingBefore = intrinsicPaddingBefore(); 174 int oldIntrinsicPaddingBefore = intrinsicPaddingBefore();
175 int oldIntrinsicPaddingAfter = intrinsicPaddingAfter(); 175 int oldIntrinsicPaddingAfter = intrinsicPaddingAfter();
176 int logicalHeightWithoutIntrinsicPadding = pixelSnappedLogicalHeight() - old IntrinsicPaddingBefore - oldIntrinsicPaddingAfter; 176 int logicalHeightWithoutIntrinsicPadding = pixelSnappedLogicalHeight() - old IntrinsicPaddingBefore - oldIntrinsicPaddingAfter;
177 177
178 int intrinsicPaddingBefore = 0; 178 int intrinsicPaddingBefore = 0;
179 switch (style()->verticalAlign()) { 179 switch (style()->verticalAlign()) {
180 case SUB: 180 case SUB:
181 case SUPER: 181 case SUPER:
182 case TEXT_TOP: 182 case TEXT_TOP:
183 case TEXT_BOTTOM: 183 case TEXT_BOTTOM:
184 case LENGTH: 184 case LENGTH:
185 case BASELINE: { 185 case BASELINE: {
186 LayoutUnit baseline = cellBaselinePosition(); 186 int baseline = cellBaselinePosition();
187 if (baseline > borderBefore() + paddingBefore()) 187 if (baseline > borderBefore() + paddingBefore())
188 intrinsicPaddingBefore = section()->rowBaseline(rowIndex()) - (basel ine - oldIntrinsicPaddingBefore); 188 intrinsicPaddingBefore = section()->rowBaseline(rowIndex()) - (basel ine - oldIntrinsicPaddingBefore);
189 break; 189 break;
190 } 190 }
191 case TOP: 191 case TOP:
192 break; 192 break;
193 case MIDDLE: 193 case MIDDLE:
194 intrinsicPaddingBefore = (rowHeight - logicalHeightWithoutIntrinsicPaddi ng) / 2; 194 intrinsicPaddingBefore = (rowHeight - logicalHeightWithoutIntrinsicPaddi ng) / 2;
195 break; 195 break;
196 case BOTTOM: 196 case BOTTOM:
(...skipping 772 matching lines...) Expand 10 before | Expand all | Expand 10 after
969 TableCellPainter(*this).paintMask(paintInfo, paintOffset); 969 TableCellPainter(*this).paintMask(paintInfo, paintOffset);
970 } 970 }
971 971
972 bool LayoutTableCell::boxShadowShouldBeAppliedToBackground(BackgroundBleedAvoida nce, const InlineFlowBox*) const 972 bool LayoutTableCell::boxShadowShouldBeAppliedToBackground(BackgroundBleedAvoida nce, const InlineFlowBox*) const
973 { 973 {
974 return false; 974 return false;
975 } 975 }
976 976
977 void LayoutTableCell::scrollbarsChanged(bool horizontalScrollbarChanged, bool ve rticalScrollbarChanged) 977 void LayoutTableCell::scrollbarsChanged(bool horizontalScrollbarChanged, bool ve rticalScrollbarChanged)
978 { 978 {
979 LayoutUnit scrollbarHeight = scrollbarLogicalHeight(); 979 int scrollbarHeight = scrollbarLogicalHeight();
980 if (!scrollbarHeight) 980 if (!scrollbarHeight)
981 return; // Not sure if we should be doing something when a scrollbar goe s away or not. 981 return; // Not sure if we should be doing something when a scrollbar goe s away or not.
982 982
983 // We only care if the scrollbar that affects our intrinsic padding has been added. 983 // We only care if the scrollbar that affects our intrinsic padding has been added.
984 if ((isHorizontalWritingMode() && !horizontalScrollbarChanged) 984 if ((isHorizontalWritingMode() && !horizontalScrollbarChanged)
985 || (!isHorizontalWritingMode() && !verticalScrollbarChanged)) 985 || (!isHorizontalWritingMode() && !verticalScrollbarChanged))
986 return; 986 return;
987 987
988 // Shrink our intrinsic padding as much as possible to accommodate the scrol lbar. 988 // Shrink our intrinsic padding as much as possible to accommodate the scrol lbar.
989 if (style()->verticalAlign() == MIDDLE) { 989 if (style()->verticalAlign() == MIDDLE) {
(...skipping 27 matching lines...) Expand all
1017 bool LayoutTableCell::backgroundIsKnownToBeOpaqueInRect(const LayoutRect& localR ect) const 1017 bool LayoutTableCell::backgroundIsKnownToBeOpaqueInRect(const LayoutRect& localR ect) const
1018 { 1018 {
1019 // If this object has layer, the area of collapsed borders should be transpa rent 1019 // If this object has layer, the area of collapsed borders should be transpa rent
1020 // to expose the collapsed borders painted on the underlying layer. 1020 // to expose the collapsed borders painted on the underlying layer.
1021 if (hasLayer() && table()->collapseBorders()) 1021 if (hasLayer() && table()->collapseBorders())
1022 return false; 1022 return false;
1023 return LayoutBlockFlow::backgroundIsKnownToBeOpaqueInRect(localRect); 1023 return LayoutBlockFlow::backgroundIsKnownToBeOpaqueInRect(localRect);
1024 } 1024 }
1025 1025
1026 } // namespace blink 1026 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutTable.cpp ('k') | third_party/WebKit/Source/core/layout/LayoutText.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698