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

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

Issue 1647313003: Continue converting to explicit LayoutUnit constructors (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@explicitContstructors
Patch Set: Add TODO 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 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 LayoutAnalyzer::Scope analyzer(*this); 231 LayoutAnalyzer::Scope analyzer(*this);
232 232
233 int oldCellBaseline = cellBaselinePosition(); 233 int oldCellBaseline = cellBaselinePosition();
234 layoutBlock(cellWidthChanged()); 234 layoutBlock(cellWidthChanged());
235 235
236 // If we have replaced content, the intrinsic height of our content may have changed since the last time we laid out. If that's the case the intrinsic paddi ng we used 236 // If we have replaced content, the intrinsic height of our content may have changed since the last time we laid out. If that's the case the intrinsic paddi ng we used
237 // for layout (the padding required to push the contents of the cell down to the row's baseline) is included in our new height and baseline and makes both 237 // for layout (the padding required to push the contents of the cell down to the row's baseline) is included in our new height and baseline and makes both
238 // of them wrong. So if our content's intrinsic height has changed push the new content up into the intrinsic padding and relayout so that the rest of 238 // of them wrong. So if our content's intrinsic height has changed push the new content up into the intrinsic padding and relayout so that the rest of
239 // table and row layout can use the correct baseline and height for this cel l. 239 // table and row layout can use the correct baseline and height for this cel l.
240 if (isBaselineAligned() && section()->rowBaseline(rowIndex()) && cellBaselin ePosition() > section()->rowBaseline(rowIndex())) { 240 if (isBaselineAligned() && section()->rowBaseline(rowIndex()) && cellBaselin ePosition() > section()->rowBaseline(rowIndex())) {
241 int newIntrinsicPaddingBefore = std::max<LayoutUnit>(0, intrinsicPadding Before() - std::max<LayoutUnit>(0, cellBaselinePosition() - oldCellBaseline)); 241 int newIntrinsicPaddingBefore = (intrinsicPaddingBefore() - (cellBaselin ePosition() - oldCellBaseline).clampNegativeToZero()).clampNegativeToZero();
242 setIntrinsicPaddingBefore(newIntrinsicPaddingBefore); 242 setIntrinsicPaddingBefore(newIntrinsicPaddingBefore);
243 SubtreeLayoutScope layouter(*this); 243 SubtreeLayoutScope layouter(*this);
244 layouter.setNeedsLayout(this, LayoutInvalidationReason::TableChanged); 244 layouter.setNeedsLayout(this, LayoutInvalidationReason::TableChanged);
245 layoutBlock(cellWidthChanged()); 245 layoutBlock(cellWidthChanged());
246 } 246 }
247 247
248 // FIXME: This value isn't the intrinsic content logical height, but we need 248 // FIXME: This value isn't the intrinsic content logical height, but we need
249 // to update the value as its used by flexbox layout. crbug.com/367324 249 // to update the value as its used by flexbox layout. crbug.com/367324
250 setIntrinsicContentLogicalHeight(contentLogicalHeight()); 250 setIntrinsicContentLogicalHeight(contentLogicalHeight());
251 251
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 } 290 }
291 291
292 LayoutUnit LayoutTableCell::paddingAfter() const 292 LayoutUnit LayoutTableCell::paddingAfter() const
293 { 293 {
294 return static_cast<int>(computedCSSPaddingAfter()) + intrinsicPaddingAfter() ; 294 return static_cast<int>(computedCSSPaddingAfter()) + intrinsicPaddingAfter() ;
295 } 295 }
296 296
297 void LayoutTableCell::setOverrideLogicalContentHeightFromRowHeight(LayoutUnit ro wHeight) 297 void LayoutTableCell::setOverrideLogicalContentHeightFromRowHeight(LayoutUnit ro wHeight)
298 { 298 {
299 clearIntrinsicPadding(); 299 clearIntrinsicPadding();
300 setOverrideLogicalContentHeight(std::max<LayoutUnit>(0, rowHeight - borderAn dPaddingLogicalHeight())); 300 setOverrideLogicalContentHeight((rowHeight - borderAndPaddingLogicalHeight() ).clampNegativeToZero());
301 } 301 }
302 302
303 LayoutSize LayoutTableCell::offsetFromContainer(const LayoutObject* o, const Lay outPoint& point, bool* offsetDependsOnPoint) const 303 LayoutSize LayoutTableCell::offsetFromContainer(const LayoutObject* o, const Lay outPoint& point, bool* offsetDependsOnPoint) const
304 { 304 {
305 ASSERT(o == container()); 305 ASSERT(o == container());
306 306
307 LayoutSize offset = LayoutBlockFlow::offsetFromContainer(o, point, offsetDep endsOnPoint); 307 LayoutSize offset = LayoutBlockFlow::offsetFromContainer(o, point, offsetDep endsOnPoint);
308 if (parent()) 308 if (parent())
309 offset -= parentBox()->locationOffset(); 309 offset -= parentBox()->locationOffset();
310 310
(...skipping 702 matching lines...) Expand 10 before | Expand all | Expand 10 after
1013 bool LayoutTableCell::backgroundIsKnownToBeOpaqueInRect(const LayoutRect& localR ect) const 1013 bool LayoutTableCell::backgroundIsKnownToBeOpaqueInRect(const LayoutRect& localR ect) const
1014 { 1014 {
1015 // If this object has layer, the area of collapsed borders should be transpa rent 1015 // If this object has layer, the area of collapsed borders should be transpa rent
1016 // to expose the collapsed borders painted on the underlying layer. 1016 // to expose the collapsed borders painted on the underlying layer.
1017 if (hasLayer() && table()->collapseBorders()) 1017 if (hasLayer() && table()->collapseBorders())
1018 return false; 1018 return false;
1019 return LayoutBlockFlow::backgroundIsKnownToBeOpaqueInRect(localRect); 1019 return LayoutBlockFlow::backgroundIsKnownToBeOpaqueInRect(localRect);
1020 } 1020 }
1021 1021
1022 } // namespace blink 1022 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutTable.cpp ('k') | third_party/WebKit/Source/core/layout/OverflowModelTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698