Title: [249879] trunk/Source/WebCore
- Revision
- 249879
- Author
- za...@apple.com
- Date
- 2019-09-14 11:52:02 -0700 (Sat, 14 Sep 2019)
Log Message
[LFC] FormattingContext::Geometry::inFlowPositionedPositionOffset should not read containing block's width
https://bugs.webkit.org/show_bug.cgi?id=201797
<rdar://problem/55366244>
Reviewed by Antti Koivisto.
This is in preparation for using constraint values instead of querying the display tree for containing block geometry information.
See webkit.org/b/201795
* layout/FormattingContext.h:
* layout/FormattingContextGeometry.cpp:
(WebCore::Layout::FormattingContext::Geometry::inFlowPositionedPositionOffset const):
* layout/blockformatting/BlockFormattingContext.cpp:
(WebCore::Layout::BlockFormattingContext::placeInFlowPositionedChildren):
* layout/inlineformatting/InlineFormattingContextLineLayout.cpp:
(WebCore::Layout::InlineFormattingContext::InlineLayout::createDisplayRuns const):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (249878 => 249879)
--- trunk/Source/WebCore/ChangeLog 2019-09-14 18:05:58 UTC (rev 249878)
+++ trunk/Source/WebCore/ChangeLog 2019-09-14 18:52:02 UTC (rev 249879)
@@ -1,5 +1,24 @@
2019-09-14 Zalan Bujtas <za...@apple.com>
+ [LFC] FormattingContext::Geometry::inFlowPositionedPositionOffset should not read containing block's width
+ https://bugs.webkit.org/show_bug.cgi?id=201797
+ <rdar://problem/55366244>
+
+ Reviewed by Antti Koivisto.
+
+ This is in preparation for using constraint values instead of querying the display tree for containing block geometry information.
+ See webkit.org/b/201795
+
+ * layout/FormattingContext.h:
+ * layout/FormattingContextGeometry.cpp:
+ (WebCore::Layout::FormattingContext::Geometry::inFlowPositionedPositionOffset const):
+ * layout/blockformatting/BlockFormattingContext.cpp:
+ (WebCore::Layout::BlockFormattingContext::placeInFlowPositionedChildren):
+ * layout/inlineformatting/InlineFormattingContextLineLayout.cpp:
+ (WebCore::Layout::InlineFormattingContext::InlineLayout::createDisplayRuns const):
+
+2019-09-14 Zalan Bujtas <za...@apple.com>
+
[LFC] FormattingContext::Geometry::inlineReplacedHeightAndMargin should not read containing block's width
https://bugs.webkit.org/show_bug.cgi?id=201796
<rdar://problem/55366109>
Modified: trunk/Source/WebCore/layout/FormattingContext.h (249878 => 249879)
--- trunk/Source/WebCore/layout/FormattingContext.h 2019-09-14 18:05:58 UTC (rev 249878)
+++ trunk/Source/WebCore/layout/FormattingContext.h 2019-09-14 18:52:02 UTC (rev 249879)
@@ -104,7 +104,7 @@
HeightAndMargin inlineReplacedHeightAndMargin(const Box&, UsedHorizontalValues, UsedVerticalValues) const;
WidthAndMargin inlineReplacedWidthAndMargin(const Box&, UsedHorizontalValues) const;
- LayoutSize inFlowPositionedPositionOffset(const Box&) const;
+ LayoutSize inFlowPositionedPositionOffset(const Box&, UsedHorizontalValues) const;
HeightAndMargin complicatedCases(const Box&, UsedHorizontalValues, UsedVerticalValues) const;
LayoutUnit shrinkToFitWidth(const Box&, UsedHorizontalValues);
Modified: trunk/Source/WebCore/layout/FormattingContextGeometry.cpp (249878 => 249879)
--- trunk/Source/WebCore/layout/FormattingContextGeometry.cpp 2019-09-14 18:05:58 UTC (rev 249878)
+++ trunk/Source/WebCore/layout/FormattingContextGeometry.cpp 2019-09-14 18:52:02 UTC (rev 249879)
@@ -966,9 +966,10 @@
return { *width, { usedMarginStart(), usedMarginEnd() }, computedHorizontalMargin };
}
-LayoutSize FormattingContext::Geometry::inFlowPositionedPositionOffset(const Box& layoutBox) const
+LayoutSize FormattingContext::Geometry::inFlowPositionedPositionOffset(const Box& layoutBox, UsedHorizontalValues usedHorizontalValues) const
{
ASSERT(layoutBox.isInFlowPositioned());
+ ASSERT(usedHorizontalValues.containingBlockWidth);
// 9.4.3 Relative positioning
//
@@ -981,7 +982,7 @@
auto& style = layoutBox.style();
auto& containingBlock = *layoutBox.containingBlock();
- auto containingBlockWidth = formattingContext().geometryForBox(containingBlock).contentBoxWidth();
+ auto containingBlockWidth = *usedHorizontalValues.containingBlockWidth;
auto top = computedValueIfNotAuto(style.logicalTop(), containingBlockWidth);
auto bottom = computedValueIfNotAuto(style.logicalBottom(), containingBlockWidth);
Modified: trunk/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp (249878 => 249879)
--- trunk/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp 2019-09-14 18:05:58 UTC (rev 249878)
+++ trunk/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp 2019-09-14 18:52:02 UTC (rev 249879)
@@ -193,7 +193,8 @@
continue;
auto computeInFlowPositionedPosition = [&] {
- auto positionOffset = geometry().inFlowPositionedPositionOffset(childBox);
+ auto usedHorizontalValues = UsedHorizontalValues { geometryForBox(*childBox.containingBlock()).contentBoxWidth() };
+ auto positionOffset = geometry().inFlowPositionedPositionOffset(childBox, usedHorizontalValues);
auto& displayBox = formattingState().displayBox(childBox);
auto topLeft = displayBox.topLeft();
Modified: trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContextLineLayout.cpp (249878 => 249879)
--- trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContextLineLayout.cpp 2019-09-14 18:05:58 UTC (rev 249878)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContextLineLayout.cpp 2019-09-14 18:52:02 UTC (rev 249879)
@@ -408,7 +408,7 @@
if (lineRun->isBox()) {
auto topLeft = logicalRect.topLeft();
if (layoutBox.isInFlowPositioned())
- topLeft += geometry.inFlowPositionedPositionOffset(layoutBox);
+ topLeft += geometry.inFlowPositionedPositionOffset(layoutBox, UsedHorizontalValues { formattingContext.geometryForBox(*layoutBox.containingBlock()).contentBoxWidth() });
displayBox.setTopLeft(topLeft);
lineBoxRect.expandHorizontally(logicalRect.width());
formattingState.addInlineRun(makeUnique<Display::Run>(logicalRect));
@@ -425,7 +425,7 @@
// Inline level container end (</span>)
if (lineRun->isContainerEnd()) {
if (layoutBox.isInFlowPositioned()) {
- auto inflowOffset = geometry.inFlowPositionedPositionOffset(layoutBox);
+ auto inflowOffset = geometry.inFlowPositionedPositionOffset(layoutBox, UsedHorizontalValues { formattingContext.geometryForBox(*layoutBox.containingBlock()).contentBoxWidth() });
displayBox.moveHorizontally(inflowOffset.width());
displayBox.moveVertically(inflowOffset.height());
}
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes