Changeset 268666 in webkit
- Timestamp:
- Oct 19, 2020 2:40:15 AM (4 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 4 deleted
- 19 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r268665 r268666 1 2020-10-13 Sergio Villar Senin <svillar@igalia.com> 2 3 Sanitize the usage of override sizes 4 https://bugs.webkit.org/show_bug.cgi?id=217479 5 6 Reviewed by Manuel Rego Casasnovas. 7 8 The percentage-size-subitems-001.html is passing now after making the overrides work properly. 9 10 Apart from that the override sanitization allowed us to remove platform specific expectations for the border-fit-2.html 11 test even for the GTK port which is working fine now. 12 13 * TestExpectations: Removed a test that passes now. 14 * css3/flexbox/flex-flow-auto-margins-no-available-space-assert.html: Fine tuned expectations. 15 * fast/borders/border-fit-2-expected.txt: Renamed from LayoutTests/platform/ios/fast/borders/border-fit-2-expected.txt. 16 * platform/gtk/TestExpectations: Removed two tests that pass now. 17 * platform/gtk/fast/borders/border-fit-2-expected.txt: Removed. 18 * platform/gtk/fast/borders/border-fit-expected.txt: Added. 19 * platform/mac/fast/borders/border-fit-2-expected.txt: Removed. 20 * platform/wincairo/fast/borders/border-fit-2-expected.txt: Removed. 21 * platform/wpe/fast/borders/border-fit-2-expected.txt: Removed. 22 1 23 2020-10-19 Martin Robinson <mrobinson@igalia.com> 2 24 -
trunk/LayoutTests/TestExpectations
r268615 r268666 3883 3883 webkit.org/b/212046 imported/w3c/web-platform-tests/css/css-flexbox/percentage-heights-007.html [ ImageOnlyFailure ] 3884 3884 webkit.org/b/212046 imported/w3c/web-platform-tests/css/css-flexbox/percentage-heights-014.html [ ImageOnlyFailure ] 3885 webkit.org/b/212046 imported/w3c/web-platform-tests/css/css-flexbox/percentage-size-subitems-001.html [ ImageOnlyFailure ]3886 3885 webkit.org/b/212046 imported/w3c/web-platform-tests/css/css-flexbox/scrollbars-auto.html [ ImageOnlyFailure ] 3887 3886 webkit.org/b/212046 imported/w3c/web-platform-tests/css/css-flexbox/scrollbars.html [ ImageOnlyFailure ] -
trunk/LayoutTests/css3/flexbox/flex-flow-auto-margins-no-available-space-assert.html
r213149 r268666 11 11 </style> 12 12 <script src="../../resources/check-layout.js"></script> 13 <abbr data-expected-height=302102 68>13 <abbr data-expected-height=30210272> 14 14 <input></input> 15 15 </abbr> -
trunk/LayoutTests/fast/borders/border-fit-2-expected.txt
-
Property
svn:eol-style
set to
LF
-
Property
svn:eol-style
set to
-
trunk/LayoutTests/platform/gtk/TestExpectations
r268611 r268666 2719 2719 webkit.org/b/109469 [ Debug ] fast/events/mouse-cursor-image-set.html [ Crash ] 2720 2720 2721 webkit.org/b/111606 fast/borders/border-fit.html [ Failure ]2722 webkit.org/b/111606 fast/borders/border-fit-2.html [ Failure ]2723 2724 2721 webkit.org/b/99893 svg/animations/mozilla/animateMotion-mpath-targetChange-1.svg [ ImageOnlyFailure Pass ] 2725 2722 -
trunk/Source/WebCore/ChangeLog
r268665 r268666 1 2020-10-13 Sergio Villar Senin <svillar@igalia.com> 2 3 Sanitize the usage of override sizes 4 https://bugs.webkit.org/show_bug.cgi?id=217479 5 6 Reviewed by Manuel Rego Casasnovas. 7 8 RenderBox had two values, overrideContentLogicalWidth and overrideContentLogicalHeight which were used by a variety of 9 layout systems (like tables, grid or flex) in different ways. Although names clearly stated that they were content sizes 10 the reality is that they were used as either border box sizes, content box sizes, or even content box + scrollbar sizes. 11 12 This patch addresses a comment in RenderBox which was precisely advocating for turning overrideContentLogicalXXX back into 13 overrideLogicalXXX. Most of the changes of this CL are just renames because the code has specific branches to handle specific 14 situations so it didn't actually matter which kind of size we were actually storing. However there are some tricky replacements 15 as in the case of flex, grid and tables that required careful modifications. It's critical for these layout systems to know 16 which size we're storing in the overrides because that would determine whether or not we need to add/substract things like borders, 17 paddings or scrollbar sizes to use them. 18 19 Note that apart from renaming the overrideContentLogicalXXX to overrideLogicalXXX we're "adding" overrideContentLogicalXXX to the 20 RenderBox interface, so it gives the impression that we are not renaming it. However the new implementation is quite different, they 21 retrieve the content box sizes from the override (border box) sizes we store. 22 23 As a nice side effect a new test is passing now after these changes. 24 25 * rendering/ComplexLineLayout.cpp: 26 (WebCore::ComplexLineLayout::updateRubyForJustifiedText): Renames. 27 * rendering/GridTrackSizingAlgorithm.cpp: 28 (WebCore::GridTrackSizingAlgorithmStrategy::logicalHeightForChild const): Renames. 29 * rendering/RenderBlock.cpp: 30 (WebCore::RenderBlock::computeChildPreferredLogicalWidths const): Renames. 31 (WebCore::RenderBlock::availableLogicalHeightForPercentageComputation const): Ditto. 32 * rendering/RenderBlockFlow.cpp: 33 (WebCore::RenderBlockFlow::fitBorderToLinesIfNeeded): Renames + store the border box width instead of the content box's. 34 * rendering/RenderBox.cpp: 35 (WebCore::RenderBox::hasOverrideLogicalHeight const): Renamed. 36 (WebCore::RenderBox::hasOverrideLogicalWidth const): Ditto. 37 (WebCore::RenderBox::setOverrideLogicalHeight): Ditto. 38 (WebCore::RenderBox::setOverrideLogicalWidth): Ditto. 39 (WebCore::RenderBox::clearOverrideLogicalHeight): Ditto. 40 (WebCore::RenderBox::clearOverrideLogicalWidth): Ditto. 41 (WebCore::RenderBox::clearOverrideContentSize): Ditto. 42 (WebCore::RenderBox::overrideLogicalWidth const): Ditto. 43 (WebCore::RenderBox::overrideLogicalHeight const): Ditto. 44 (WebCore::RenderBox::perpendicularContainingBlockLogicalHeight const): Renames. 45 (WebCore::RenderBox::computeLogicalWidthInFragment const): Renames + return the stored override border box width directly. 46 (WebCore::RenderBox::cacheIntrinsicContentLogicalHeightForFlexItem const): Renames. 47 (WebCore::RenderBox::computeLogicalHeight const): Renames. Apart from that moved some code around so all branches work with 48 border box sizes instead of mixing them with content box sizes. 49 (WebCore::RenderBox::computePercentageLogicalHeight const): Return the content box size after removing computed paddings and 50 borders from the stored override size. 51 (WebCore::RenderBox::computeReplacedLogicalHeightUsing const): Renames + compute the borderbox size from the stored 52 override size. 53 (WebCore::RenderBox::availableLogicalHeightUsing const): Return the content box size after removing computed paddings and 54 borders from the stored override size. 55 (WebCore::RenderBox::hasOverrideContentLogicalHeight const): Deleted. 56 (WebCore::RenderBox::hasOverrideContentLogicalWidth const): Deleted. 57 (WebCore::RenderBox::setOverrideContentLogicalHeight): Deleted. 58 (WebCore::RenderBox::setOverrideContentLogicalWidth): Deleted. 59 (WebCore::RenderBox::clearOverrideContentLogicalHeight): Deleted. 60 (WebCore::RenderBox::clearOverrideContentLogicalWidth): Deleted. 61 (WebCore::RenderBox::overrideContentLogicalWidth const): Deleted. 62 (WebCore::RenderBox::overrideContentLogicalHeight const): Deleted. 63 * rendering/RenderBox.h: 64 (WebCore::RenderBox::overrideContentLogicalWidth const): "New" method. It existed before but it was renamed to overrideLogicalWidth. 65 We're adding a completely different implementation for this one. 66 (WebCore::RenderBox::overrideContentLogicalHeight const): Ditto. 67 * rendering/RenderDeprecatedFlexibleBox.cpp: 68 (WebCore::widthForChild): New method to retrieve the border box width. 69 (WebCore::heightForChild): New method to retrieve the border box height. 70 (WebCore::contentWidthForChild): Use widthForChild() which handles overrides. 71 (WebCore::contentHeightForChild): Use heightForChild() which handles overrides. 72 (WebCore::RenderDeprecatedFlexibleBox::layoutHorizontalBox): Ditto. 73 (WebCore::RenderDeprecatedFlexibleBox::layoutVerticalBox): Ditto. 74 (WebCore::RenderDeprecatedFlexibleBox::applyLineClamp): Do not substract border and padding before setting the override because 75 we now store the border box height not the content box height. 76 * rendering/RenderFlexibleBox.cpp: 77 (WebCore::RenderFlexibleBox::childIntrinsicLogicalWidth const): Renames. 78 (WebCore::RenderFlexibleBox::crossSizeForPercentageResolution): Return the content box size (does not include scrollbar). 79 (WebCore::RenderFlexibleBox::mainSizeForPercentageResolution): Ditto. 80 (WebCore::RenderFlexibleBox::setOverrideMainAxisContentSizeForChild): Add border and padding before setting the override. 81 (WebCore::RenderFlexibleBox::applyStretchAlignmentToChild): Do not substract border and padding before setting the override as we are 82 storing border box sizes. 83 * rendering/RenderGrid.cpp: 84 (WebCore::RenderGrid::layoutBlock): Renames. 85 (WebCore::RenderGrid::applyStretchAlignmentToChildIfNeeded): Renames + do not substract border and padding before setting the override 86 as we are storing border box sizes. 87 * rendering/RenderRubyBase.cpp: 88 (WebCore::RenderRubyBase::adjustInlineDirectionLineBounds const): Renames. 89 * rendering/RenderTable.cpp: 90 (WebCore::RenderTable::updateLogicalWidth): Renames. 91 * rendering/RenderTableCell.cpp: 92 (WebCore::RenderTableCell::setOverrideLogicalHeightFromRowHeight): Renames + do not substract border and padding before setting the override 93 as we are storing border box sizes. 94 (WebCore::RenderTableCell::setOverrideContentLogicalHeightFromRowHeight): Deleted. 95 * rendering/RenderTableCell.h: Renames. 96 * rendering/RenderTableSection.cpp: 97 (WebCore::RenderTableSection::calcRowLogicalHeight): Renames. 98 (WebCore::RenderTableSection::relayoutCellIfFlexed): Ditto. 99 1 100 2020-10-19 Martin Robinson <mrobinson@igalia.com> 2 101 -
trunk/Source/WebCore/rendering/ComplexLineLayout.cpp
r267565 r268666 591 591 } 592 592 593 ASSERT(!rubyRun.hasOverride ContentLogicalWidth());593 ASSERT(!rubyRun.hasOverrideLogicalWidth()); 594 594 float newBaseWidth = rubyRun.logicalWidth() + totalExpansion + m_flow.marginStartForChild(rubyRun) + m_flow.marginEndForChild(rubyRun); 595 595 float newRubyRunWidth = rubyRun.logicalWidth() + totalExpansion; 596 596 rubyBase.setInitialOffset((newRubyRunWidth - newBaseWidth) / 2); 597 rubyRun.setOverride ContentLogicalWidth(LayoutUnit(newRubyRunWidth));597 rubyRun.setOverrideLogicalWidth(LayoutUnit(newRubyRunWidth)); 598 598 rubyRun.setNeedsLayout(MarkOnlyThis); 599 599 rootBox.markDirty(); … … 603 603 } 604 604 rubyRun.layoutBlock(true); 605 rubyRun.clearOverride ContentLogicalWidth();605 rubyRun.clearOverrideLogicalWidth(); 606 606 r.box()->setExpansion(newRubyRunWidth - r.box()->logicalWidth()); 607 607 -
trunk/Source/WebCore/rendering/GridTrackSizingAlgorithm.cpp
r267503 r268666 764 764 // We need to clear the stretched height to properly compute logical height during layout. 765 765 if (child.needsLayout()) 766 child.clearOverride ContentLogicalHeight();766 child.clearOverrideLogicalHeight(); 767 767 768 768 child.layoutIfNeeded(); -
trunk/Source/WebCore/rendering/RenderBlock.cpp
r266691 r268666 2426 2426 auto& box = downcast<RenderBox>(child); 2427 2427 if (box.isFlexItem()) { 2428 if (box.hasOverride ContentLogicalHeight())2429 overrideHeight = Optional<LayoutUnit>(box.override ContentLogicalHeight());2430 if (box.hasOverride ContentLogicalWidth())2431 overrideWidth = Optional<LayoutUnit>(box.override ContentLogicalWidth());2428 if (box.hasOverrideLogicalHeight()) 2429 overrideHeight = Optional<LayoutUnit>(box.overrideLogicalHeight()); 2430 if (box.hasOverrideLogicalWidth()) 2431 overrideWidth = Optional<LayoutUnit>(box.overrideLogicalWidth()); 2432 2432 box.clearOverrideContentSize(); 2433 2433 } … … 2440 2440 auto& box = downcast<RenderBox>(child); 2441 2441 if (overrideHeight) 2442 box.setOverride ContentLogicalHeight(overrideHeight.value());2442 box.setOverrideLogicalHeight(overrideHeight.value()); 2443 2443 if (overrideWidth) 2444 box.setOverride ContentLogicalWidth(overrideWidth.value());2444 box.setOverrideLogicalWidth(overrideWidth.value()); 2445 2445 } 2446 2446 … … 3220 3220 if (stretchedFlexHeight) 3221 3221 availableHeight = stretchedFlexHeight; 3222 else if (isGridItem() && hasOverride ContentLogicalHeight())3223 availableHeight = override ContentLogicalHeight();3222 else if (isGridItem() && hasOverrideLogicalHeight()) 3223 availableHeight = overrideLogicalHeight(); 3224 3224 else if (styleToUse.logicalHeight().isFixed()) { 3225 3225 LayoutUnit contentBoxHeight = adjustContentBoxLogicalHeightForBoxSizing((LayoutUnit)styleToUse.logicalHeight().value()); -
trunk/Source/WebCore/rendering/RenderBlockFlow.cpp
r268598 r268666 3046 3046 void RenderBlockFlow::fitBorderToLinesIfNeeded() 3047 3047 { 3048 if (style().borderFit() == BorderFit::Border || hasOverride ContentLogicalWidth())3048 if (style().borderFit() == BorderFit::Border || hasOverrideLogicalWidth()) 3049 3049 return; 3050 3050 … … 3064 3064 if (newContentWidth == oldWidth) 3065 3065 return; 3066 3067 setOverride ContentLogicalWidth(newContentWidth);3066 3067 setOverrideLogicalWidth(newContentWidth + borderAndPaddingLogicalWidth()); 3068 3068 layoutBlock(false); 3069 clearOverride ContentLogicalWidth();3069 clearOverrideLogicalWidth(); 3070 3070 } 3071 3071 -
trunk/Source/WebCore/rendering/RenderBox.cpp
r266803 r268666 93 93 using namespace HTMLNames; 94 94 95 // Used by flexible boxes when flexing this element and by table cells.96 95 typedef WTF::HashMap<const RenderBox*, LayoutUnit> OverrideSizeMap; 97 static OverrideSizeMap* gOverrideContentLogicalHeightMap = nullptr; 98 static OverrideSizeMap* gOverrideContentLogicalWidthMap = nullptr; 99 100 // Used by grid elements to properly size their grid items. 96 static OverrideSizeMap* gOverrideLogicalHeightMap = nullptr; 97 static OverrideSizeMap* gOverrideLogicalWidthMap = nullptr; 98 101 99 // FIXME: We should store these based on physical direction. 102 100 typedef WTF::HashMap<const RenderBox*, Optional<LayoutUnit>> OverrideOptionalSizeMap; … … 1083 1081 } 1084 1082 1085 bool RenderBox::hasOverride ContentLogicalHeight() const1086 { 1087 return gOverride ContentLogicalHeightMap && gOverrideContentLogicalHeightMap->contains(this);1088 } 1089 1090 bool RenderBox::hasOverride ContentLogicalWidth() const1091 { 1092 return gOverride ContentLogicalWidthMap && gOverrideContentLogicalWidthMap->contains(this);1093 } 1094 1095 void RenderBox::setOverride ContentLogicalHeight(LayoutUnit height)1096 { 1097 if (!gOverride ContentLogicalHeightMap)1098 gOverride ContentLogicalHeightMap = new OverrideSizeMap();1099 gOverride ContentLogicalHeightMap->set(this, height);1100 } 1101 1102 void RenderBox::setOverride ContentLogicalWidth(LayoutUnit width)1103 { 1104 if (!gOverride ContentLogicalWidthMap)1105 gOverride ContentLogicalWidthMap = new OverrideSizeMap();1106 gOverride ContentLogicalWidthMap->set(this, width);1107 } 1108 1109 void RenderBox::clearOverride ContentLogicalHeight()1110 { 1111 if (gOverride ContentLogicalHeightMap)1112 gOverride ContentLogicalHeightMap->remove(this);1113 } 1114 1115 void RenderBox::clearOverride ContentLogicalWidth()1116 { 1117 if (gOverride ContentLogicalWidthMap)1118 gOverride ContentLogicalWidthMap->remove(this);1083 bool RenderBox::hasOverrideLogicalHeight() const 1084 { 1085 return gOverrideLogicalHeightMap && gOverrideLogicalHeightMap->contains(this); 1086 } 1087 1088 bool RenderBox::hasOverrideLogicalWidth() const 1089 { 1090 return gOverrideLogicalWidthMap && gOverrideLogicalWidthMap->contains(this); 1091 } 1092 1093 void RenderBox::setOverrideLogicalHeight(LayoutUnit height) 1094 { 1095 if (!gOverrideLogicalHeightMap) 1096 gOverrideLogicalHeightMap = new OverrideSizeMap(); 1097 gOverrideLogicalHeightMap->set(this, height); 1098 } 1099 1100 void RenderBox::setOverrideLogicalWidth(LayoutUnit width) 1101 { 1102 if (!gOverrideLogicalWidthMap) 1103 gOverrideLogicalWidthMap = new OverrideSizeMap(); 1104 gOverrideLogicalWidthMap->set(this, width); 1105 } 1106 1107 void RenderBox::clearOverrideLogicalHeight() 1108 { 1109 if (gOverrideLogicalHeightMap) 1110 gOverrideLogicalHeightMap->remove(this); 1111 } 1112 1113 void RenderBox::clearOverrideLogicalWidth() 1114 { 1115 if (gOverrideLogicalWidthMap) 1116 gOverrideLogicalWidthMap->remove(this); 1119 1117 } 1120 1118 1121 1119 void RenderBox::clearOverrideContentSize() 1122 1120 { 1123 clearOverride ContentLogicalHeight();1124 clearOverride ContentLogicalWidth();1125 } 1126 1127 LayoutUnit RenderBox::override ContentLogicalWidth() const1128 { 1129 ASSERT(hasOverride ContentLogicalWidth());1130 return gOverride ContentLogicalWidthMap->get(this);1131 } 1132 1133 LayoutUnit RenderBox::override ContentLogicalHeight() const1134 { 1135 ASSERT(hasOverride ContentLogicalHeight());1136 return gOverride ContentLogicalHeightMap->get(this);1121 clearOverrideLogicalHeight(); 1122 clearOverrideLogicalWidth(); 1123 } 1124 1125 LayoutUnit RenderBox::overrideLogicalWidth() const 1126 { 1127 ASSERT(hasOverrideLogicalWidth()); 1128 return gOverrideLogicalWidthMap->get(this); 1129 } 1130 1131 LayoutUnit RenderBox::overrideLogicalHeight() const 1132 { 1133 ASSERT(hasOverrideLogicalHeight()); 1134 return gOverrideLogicalHeightMap->get(this); 1137 1135 } 1138 1136 … … 2027 2025 2028 2026 RenderBlock* cb = containingBlock(); 2029 if (cb->hasOverride ContentLogicalHeight())2027 if (cb->hasOverrideLogicalHeight()) 2030 2028 return cb->overrideContentLogicalHeight(); 2031 2029 … … 2434 2432 // FIXME: Account for block-flow in flexible boxes. 2435 2433 // https://bugs.webkit.org/show_bug.cgi?id=46418 2436 if (hasOverride ContentLogicalWidth() && (isRubyRun() || style().borderFit() == BorderFit::Lines || (parent()->isFlexibleBoxIncludingDeprecated()))) {2437 computedValues.m_extent = override ContentLogicalWidth() + borderAndPaddingLogicalWidth();2434 if (hasOverrideLogicalWidth() && (isRubyRun() || style().borderFit() == BorderFit::Lines || (parent()->isFlexibleBoxIncludingDeprecated()))) { 2435 computedValues.m_extent = overrideLogicalWidth(); 2438 2436 return; 2439 2437 } … … 2777 2775 void RenderBox::cacheIntrinsicContentLogicalHeightForFlexItem(LayoutUnit height) const 2778 2776 { 2779 // FIXME: it should be enough with checking hasOverride ContentLogicalHeight() as this logic could be shared2777 // FIXME: it should be enough with checking hasOverrideLogicalHeight() as this logic could be shared 2780 2778 // by any layout system using overrides like grid or flex. However this causes a never ending sequence of calls 2781 2779 // between layoutBlock() <-> relayoutToAvoidWidows(). 2782 if (isFloatingOrOutOfFlowPositioned() || !parent() || !parent()->isFlexibleBox() || hasOverride ContentLogicalHeight())2780 if (isFloatingOrOutOfFlowPositioned() || !parent() || !parent()->isFlexibleBox() || hasOverrideLogicalHeight()) 2783 2781 return; 2784 2782 downcast<RenderFlexibleBox>(parent())->setCachedChildIntrinsicContentLogicalHeight(*this, height); … … 2841 2839 // FIXME: Account for block-flow in flexible boxes. 2842 2840 // https://bugs.webkit.org/show_bug.cgi?id=46418 2843 if (hasOverride ContentLogicalHeight() && (parent()->isFlexibleBoxIncludingDeprecated() || parent()->isRenderGrid())) {2844 h = Length(override ContentLogicalHeight(), Fixed);2841 if (hasOverrideLogicalHeight() && (parent()->isFlexibleBoxIncludingDeprecated() || parent()->isRenderGrid())) { 2842 h = Length(overrideLogicalHeight(), Fixed); 2845 2843 } else if (treatAsReplaced) 2846 h = Length(computeReplacedLogicalHeight() , Fixed);2844 h = Length(computeReplacedLogicalHeight() + borderAndPaddingLogicalHeight(), Fixed); 2847 2845 else { 2848 2846 h = style().logicalHeight(); … … 2855 2853 if (h.isAuto() && is<RenderDeprecatedFlexibleBox>(*parent()) && parent()->style().boxOrient() == BoxOrient::Horizontal 2856 2854 && downcast<RenderDeprecatedFlexibleBox>(*parent()).isStretchingChildren()) { 2857 h = Length(parentBox()->contentLogicalHeight() - marginBefore() - marginAfter() - borderAndPaddingLogicalHeight(), Fixed);2855 h = Length(parentBox()->contentLogicalHeight() - marginBefore() - marginAfter(), Fixed); 2858 2856 checkMinMaxHeight = false; 2859 2857 } … … 2865 2863 heightResult = constrainLogicalHeightByMinMax(heightResult, intrinsicHeight); 2866 2864 } else { 2867 // The only times we don't check min/max height are when a fixed length has2868 // been given as an override. Just use that. The value has already been adjusted2869 // for box-sizing.2870 2865 ASSERT(h.isFixed()); 2871 heightResult = h.value() + borderAndPaddingLogicalHeight();2866 heightResult = h.value(); 2872 2867 } 2873 2868 … … 3036 3031 // don't care if the cell specified a height or not. We just always make ourselves 3037 3032 // be a percentage of the cell's current content height. 3038 if (!cb->hasOverride ContentLogicalHeight())3033 if (!cb->hasOverrideLogicalHeight()) 3039 3034 return tableCellShouldHaveZeroInitialSize(*cb, *this, scrollsOverflowY()) ? Optional<LayoutUnit>(0) : WTF::nullopt; 3040 3035 3041 availableHeight = cb->override ContentLogicalHeight();3036 availableHeight = cb->overrideLogicalHeight() - cb->computedCSSPaddingBefore() - cb->computedCSSPaddingAfter() - cb->borderBefore() - cb->borderAfter(); 3042 3037 } 3043 3038 } else … … 3049 3044 LayoutUnit result = valueForLength(height, availableHeight.value() - rootMarginBorderPaddingHeight + (isTable() && isOutOfFlowPositioned() ? cb->paddingBefore() + cb->paddingAfter() : 0_lu)); 3050 3045 3051 // |override ContentLogicalHeight| is the maximum height made available by the3046 // |overrideLogicalHeight| is the maximum height made available by the 3052 3047 // cell to its percent height children when we decide they can determine the 3053 3048 // height of the cell. If the percent height child is box-sizing:content-box 3054 3049 // then we must subtract the border and padding from the cell's 3055 // |availableHeight| (given by |override ContentLogicalHeight|) to arrive3050 // |availableHeight| (given by |overrideLogicalHeight|) to arrive 3056 3051 // at the child's computed height. 3057 bool subtractBorderAndPadding = isTable() || (is<RenderTableCell>(*cb) && !skippedAutoHeightContainingBlock && cb->hasOverride ContentLogicalHeight());3052 bool subtractBorderAndPadding = isTable() || (is<RenderTableCell>(*cb) && !skippedAutoHeightContainingBlock && cb->hasOverrideLogicalHeight()); 3058 3053 if (subtractBorderAndPadding) { 3059 3054 result -= borderAndPaddingLogicalHeight(); … … 3194 3189 if (block->isFlexItem()) 3195 3190 stretchedHeight = downcast<RenderFlexibleBox>(block->parent())->childLogicalHeightForPercentageResolution(*block); 3196 else if (block->isGridItem() && block->hasOverride ContentLogicalHeight())3197 stretchedHeight = block->override ContentLogicalHeight();3191 else if (block->isGridItem() && block->hasOverrideLogicalHeight()) 3192 stretchedHeight = block->overrideLogicalHeight() - block->borderAndPaddingLogicalHeight(); 3198 3193 } 3199 3194 … … 3260 3255 // height, and then when we lay out again we'll use the calculation below. 3261 3256 if (isTableCell() && (h.isAuto() || h.isPercentOrCalculated())) { 3262 if (hasOverride ContentLogicalHeight())3263 return override ContentLogicalHeight();3257 if (hasOverrideLogicalHeight()) 3258 return overrideLogicalHeight() - computedCSSPaddingBefore() - computedCSSPaddingAfter() - borderBefore() - borderAfter(); 3264 3259 return logicalHeight() - borderAndPaddingLogicalHeight(); 3265 3260 } -
trunk/Source/WebCore/rendering/RenderBox.h
r261775 r268666 308 308 LayoutUnit maxPreferredLogicalWidth() const override; 309 309 310 // FIXME: We should rename these back to overrideLogicalHeight/Width and have them store 311 // the border-box height/width like the regular height/width accessors on RenderBox. 312 // Right now, these are different than contentHeight/contentWidth because they still 313 // include the scrollbar height/width. 314 LayoutUnit overrideContentLogicalWidth() const; 315 LayoutUnit overrideContentLogicalHeight() const; 316 bool hasOverrideContentLogicalHeight() const; 317 bool hasOverrideContentLogicalWidth() const; 318 void setOverrideContentLogicalHeight(LayoutUnit); 319 void setOverrideContentLogicalWidth(LayoutUnit); 310 LayoutUnit overrideLogicalWidth() const; 311 LayoutUnit overrideLogicalHeight() const; 312 bool hasOverrideLogicalHeight() const; 313 bool hasOverrideLogicalWidth() const; 314 void setOverrideLogicalHeight(LayoutUnit); 315 void setOverrideLogicalWidth(LayoutUnit); 320 316 void clearOverrideContentSize(); 321 void clearOverrideContentLogicalHeight(); 322 void clearOverrideContentLogicalWidth(); 317 void clearOverrideLogicalHeight(); 318 void clearOverrideLogicalWidth(); 319 320 LayoutUnit overrideContentLogicalWidth() const { return overrideLogicalWidth() - borderAndPaddingLogicalWidth() - scrollbarLogicalWidth(); } 321 LayoutUnit overrideContentLogicalHeight() const { return overrideLogicalHeight() - borderAndPaddingLogicalHeight() - scrollbarLogicalHeight(); } 323 322 324 323 Optional<LayoutUnit> overrideContainingBlockContentWidth() const override; -
trunk/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp
r262892 r268666 152 152 } 153 153 154 static LayoutUnit widthForChild(RenderBox* child) 155 { 156 if (child->hasOverrideLogicalWidth()) 157 return child->overrideLogicalWidth(); 158 return child->logicalWidth(); 159 } 160 161 static LayoutUnit heightForChild(RenderBox* child) 162 { 163 if (child->hasOverrideLogicalHeight()) 164 return child->overrideLogicalHeight(); 165 return child->logicalHeight(); 166 } 167 154 168 static LayoutUnit contentWidthForChild(RenderBox* child) 155 169 { 156 if (child->hasOverrideContentLogicalWidth()) 157 return child->overrideContentLogicalWidth(); 158 return child->logicalWidth() - child->borderAndPaddingLogicalWidth(); 170 return std::max<LayoutUnit>(0, widthForChild(child) - child->borderAndPaddingLogicalWidth()); 159 171 } 160 172 161 173 static LayoutUnit contentHeightForChild(RenderBox* child) 162 174 { 163 if (child->hasOverrideContentLogicalHeight()) 164 return child->overrideContentLogicalHeight(); 165 return child->logicalHeight() - child->borderAndPaddingLogicalHeight(); 175 return std::max<LayoutUnit>(0, heightForChild(child) - child->borderAndPaddingLogicalHeight()); 166 176 } 167 177 … … 586 596 LayoutUnit spaceAdd = LayoutUnit(spaceAvailableThisPass * (child->style().boxFlex() / totalFlex)); 587 597 if (spaceAdd) { 588 child->setOverride ContentLogicalWidth(contentWidthForChild(child) + spaceAdd);598 child->setOverrideLogicalWidth(widthForChild(child) + spaceAdd); 589 599 flexingChildren = true; 590 600 relayoutChildren = true; … … 603 613 for (RenderBox* child = iterator.first(); child && groupRemainingSpace; child = iterator.next()) { 604 614 if (allowedChildFlex(child, expanding, i)) { 605 child->setOverride ContentLogicalWidth(contentWidthForChild(child) + spaceAdd);615 child->setOverrideLogicalWidth(widthForChild(child) + spaceAdd); 606 616 flexingChildren = true; 607 617 relayoutChildren = true; … … 843 853 LayoutUnit spaceAdd { spaceAvailableThisPass * (child->style().boxFlex() / totalFlex) }; 844 854 if (spaceAdd) { 845 child->setOverride ContentLogicalHeight(contentHeightForChild(child) + spaceAdd);855 child->setOverrideLogicalHeight(heightForChild(child) + spaceAdd); 846 856 flexingChildren = true; 847 857 relayoutChildren = true; … … 860 870 for (RenderBox* child = iterator.first(); child && groupRemainingSpace; child = iterator.next()) { 861 871 if (allowedChildFlex(child, expanding, i)) { 862 child->setOverride ContentLogicalHeight(contentHeightForChild(child) + spaceAdd);872 child->setOverrideLogicalHeight(heightForChild(child) + spaceAdd); 863 873 flexingChildren = true; 864 874 relayoutChildren = true; … … 975 985 976 986 child->setChildNeedsLayout(MarkOnlyThis); 977 child->setOverride ContentLogicalHeight(newHeight - child->verticalBorderAndPaddingExtent());987 child->setOverrideLogicalHeight(newHeight); 978 988 child->layoutIfNeeded(); 979 989 -
trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp
r267829 r268666 481 481 482 482 // Temporarily clear potential overrides to compute the logical width otherwise it'll return the override size. 483 bool childHasOverrideWidth = child.hasOverride ContentLogicalWidth();484 auto overrideWidth = childHasOverrideWidth ? child.override ContentLogicalWidth() : -1_lu;483 bool childHasOverrideWidth = child.hasOverrideLogicalWidth(); 484 auto overrideWidth = childHasOverrideWidth ? child.overrideLogicalWidth() : -1_lu; 485 485 if (childHasOverrideWidth) 486 const_cast<RenderBox*>(&child)->clearOverride ContentLogicalWidth();486 const_cast<RenderBox*>(&child)->clearOverrideLogicalWidth(); 487 487 LogicalExtentComputedValues values; 488 488 child.computeLogicalWidthInFragment(values); 489 489 if (childHasOverrideWidth) 490 const_cast<RenderBox*>(&child)->setOverride ContentLogicalWidth(overrideWidth);490 const_cast<RenderBox*>(&child)->setOverrideLogicalWidth(overrideWidth); 491 491 return values.m_extent; 492 492 } … … 1170 1170 1171 1171 // Here we implement https://drafts.csswg.org/css-flexbox/#algo-stretch 1172 if (child.hasOverride ContentLogicalHeight())1173 return child.overrideContentLogicalHeight() - child.scrollbarLogicalHeight();1174 1172 if (child.hasOverrideLogicalHeight()) 1173 return child.overrideContentLogicalHeight(); 1174 1175 1175 // We don't currently implement the optimization from 1176 1176 // https://drafts.csswg.org/css-flexbox/#definite-sizes case 1. While that … … 1191 1191 return WTF::nullopt; 1192 1192 1193 return child.hasOverride ContentLogicalHeight() ? Optional<LayoutUnit>(child.overrideContentLogicalHeight() - child.scrollbarLogicalHeight()) : WTF::nullopt;1193 return child.hasOverrideLogicalHeight() ? Optional<LayoutUnit>(child.overrideContentLogicalHeight()) : WTF::nullopt; 1194 1194 } 1195 1195 … … 1425 1425 { 1426 1426 if (hasOrthogonalFlow(child)) 1427 child.setOverride ContentLogicalHeight(childPreferredSize);1427 child.setOverrideLogicalHeight(childPreferredSize + child.borderAndPaddingLogicalHeight()); 1428 1428 else 1429 child.setOverride ContentLogicalWidth(childPreferredSize);1429 child.setOverrideLogicalWidth(childPreferredSize + child.borderAndPaddingLogicalWidth()); 1430 1430 } 1431 1431 … … 1884 1884 childNeedsRelayout = true; 1885 1885 } 1886 if (childNeedsRelayout || !child.hasOverride ContentLogicalHeight())1887 child.setOverride ContentLogicalHeight(desiredLogicalHeight - child.borderAndPaddingLogicalHeight());1886 if (childNeedsRelayout || !child.hasOverrideLogicalHeight()) 1887 child.setOverrideLogicalHeight(desiredLogicalHeight); 1888 1888 if (childNeedsRelayout) { 1889 1889 SetForScope<bool> resetChildLogicalHeight(m_shouldResetChildLogicalHeightBeforeLayout, true); … … 1906 1906 1907 1907 if (childWidth != child.logicalWidth()) { 1908 child.setOverride ContentLogicalWidth(childWidth - child.borderAndPaddingLogicalWidth());1908 child.setOverrideLogicalWidth(childWidth); 1909 1909 child.setChildNeedsLayout(MarkOnlyThis); 1910 1910 child.layoutIfNeeded(); -
trunk/Source/WebCore/rendering/RenderGrid.cpp
r266173 r268666 194 194 // FIXME: We should use RenderBlock::hasDefiniteLogicalHeight() but it does not work for positioned stuff. 195 195 // FIXME: Consider caching the hasDefiniteLogicalHeight value throughout the layout. 196 bool hasDefiniteLogicalHeight = hasOverride ContentLogicalHeight() || computeContentLogicalHeight(MainOrPreferredSize, style().logicalHeight(), WTF::nullopt);196 bool hasDefiniteLogicalHeight = hasOverrideLogicalHeight() || computeContentLogicalHeight(MainOrPreferredSize, style().logicalHeight(), WTF::nullopt); 197 197 198 198 m_hasAnyOrthogonalItem = false; … … 203 203 // clear any override height set previously, so it doesn't interfere in current layout 204 204 // execution. Grid never uses the override width, that's why we don't need to clear it. 205 child->clearOverride ContentLogicalHeight();205 child->clearOverrideLogicalHeight(); 206 206 207 207 // We may need to repeat the track sizing in case of any grid item was orthogonal. … … 1130 1130 // We clear height override values because we will decide now whether it's allowed or 1131 1131 // not, evaluating the conditions which might have changed since the old values were set. 1132 child.clearOverride ContentLogicalHeight();1132 child.clearOverrideLogicalHeight(); 1133 1133 1134 1134 GridTrackSizingDirection childBlockDirection = GridLayoutFunctions::flowAwareDirectionForChild(*this, child, ForRows); … … 1138 1138 LayoutUnit stretchedLogicalHeight = availableAlignmentSpaceForChildBeforeStretching(GridLayoutFunctions::overrideContainingBlockContentSizeForChild(child, childBlockDirection).value(), child); 1139 1139 LayoutUnit desiredLogicalHeight = child.constrainLogicalHeightByMinMax(stretchedLogicalHeight, -1_lu); 1140 child.setOverride ContentLogicalHeight(desiredLogicalHeight - child.borderAndPaddingLogicalHeight());1140 child.setOverrideLogicalHeight(desiredLogicalHeight); 1141 1141 if (desiredLogicalHeight != child.logicalHeight()) { 1142 1142 // FIXME: Can avoid laying out here in some cases. See https://webkit.org/b/87905. -
trunk/Source/WebCore/rendering/RenderRubyBase.cpp
r248517 r268666 68 68 void RenderRubyBase::adjustInlineDirectionLineBounds(int expansionOpportunityCount, float& logicalLeft, float& logicalWidth) const 69 69 { 70 if (rubyRun()->hasOverride ContentLogicalWidth() && firstRootBox() && !firstRootBox()->nextRootBox()) {70 if (rubyRun()->hasOverrideLogicalWidth() && firstRootBox() && !firstRootBox()->nextRootBox()) { 71 71 logicalLeft += m_initialOffset; 72 72 logicalWidth -= 2 * m_initialOffset; … … 74 74 } 75 75 76 LayoutUnit maxPreferredLogicalWidth = rubyRun() && rubyRun()->hasOverride ContentLogicalWidth() ? rubyRun()->overrideContentLogicalWidth() : this->maxPreferredLogicalWidth();76 LayoutUnit maxPreferredLogicalWidth = rubyRun() && rubyRun()->hasOverrideLogicalWidth() ? rubyRun()->overrideLogicalWidth() : this->maxPreferredLogicalWidth(); 77 77 if (maxPreferredLogicalWidth >= logicalWidth) 78 78 return; -
trunk/Source/WebCore/rendering/RenderTable.cpp
r265746 r268666 283 283 // Our parent might have set an override content logical width on us, so we must respect it. This 284 284 // is how flexbox containers flex or stretch us. 285 if (hasOverride ContentLogicalWidth())286 setLogicalWidth(std::max(logicalWidth(), override ContentLogicalWidth()));285 if (hasOverrideLogicalWidth()) 286 setLogicalWidth(std::max(logicalWidth(), overrideLogicalWidth())); 287 287 288 288 // Ensure we aren't bigger than our max-width style. -
trunk/Source/WebCore/rendering/RenderTableCell.cpp
r266691 r268666 331 331 } 332 332 333 void RenderTableCell::setOverride ContentLogicalHeightFromRowHeight(LayoutUnit rowHeight)333 void RenderTableCell::setOverrideLogicalHeightFromRowHeight(LayoutUnit rowHeight) 334 334 { 335 335 clearIntrinsicPadding(); 336 setOverride ContentLogicalHeight(std::max<LayoutUnit>(0, rowHeight - borderAndPaddingLogicalHeight()));336 setOverrideLogicalHeight(rowHeight); 337 337 } 338 338 -
trunk/Source/WebCore/rendering/RenderTableCell.h
r260415 r268666 103 103 LayoutUnit paddingAfter() const override; 104 104 105 void setOverride ContentLogicalHeightFromRowHeight(LayoutUnit);105 void setOverrideLogicalHeightFromRowHeight(LayoutUnit); 106 106 107 107 void scrollbarsChanged(bool horizontalScrollbarChanged, bool verticalScrollbarChanged) override; -
trunk/Source/WebCore/rendering/RenderTableSection.cpp
r259575 r268666 284 284 unsigned cellStartRow = cell->rowIndex(); 285 285 286 if (cell->hasOverride ContentLogicalHeight()) {286 if (cell->hasOverrideLogicalHeight()) { 287 287 cell->clearIntrinsicPadding(); 288 288 cell->clearOverrideContentSize(); … … 523 523 // height, which becomes irrelevant once the cell has 524 524 // been resized based off its percentage. 525 cell.setOverride ContentLogicalHeightFromRowHeight(rowHeight);525 cell.setOverrideLogicalHeightFromRowHeight(rowHeight); 526 526 cell.layoutIfNeeded(); 527 527
Note: See TracChangeset
for help on using the changeset viewer.