Title: [272463] trunk/Source/WebCore
- Revision
- 272463
- Author
- [email protected]
- Date
- 2021-02-06 10:01:26 -0800 (Sat, 06 Feb 2021)
Log Message
[LFC][IFC] Continuation pre and post block inline boxes should not have both the start and end decorations of the original inline box
https://bugs.webkit.org/show_bug.cgi?id=221502
Reviewed by Antti Koivisto.
The generated inline boxes inside the pre/post block containers of a continuation "inherit" all the original styles e.g.
<span style="margin-left: 10px"><div></div></span>
We turn this into a continuation by constructing a set of pre and a post block containers.
(pre)Block container (anonymous)
Inline container (<span>)
Block container (<div></div>)
(post)Block container (anonymous)
Inline container (</span>)
Now the border box of the inline container inside the post block container should not have a 1px margin offset. Only the inline container in the pre block should "inherit" the left margin from the original <span>.
Legacy line layout solves this issue by calling hasInlineDirectionBordersPaddingOrMargin() during layout to decide which side of the decorations to apply,
but these inline boxes should not have those start/end values the first place.
(see fast/inline/inline-with-empty-inline-continuations.html)
* layout/integration/LayoutIntegrationBoxTree.cpp:
(WebCore::LayoutIntegration::BoxTree::buildTree):
* layout/integration/LayoutIntegrationLineLayout.cpp:
(WebCore::LayoutIntegration::LineLayout::updateInlineBoxDimensions):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (272462 => 272463)
--- trunk/Source/WebCore/ChangeLog 2021-02-06 16:01:56 UTC (rev 272462)
+++ trunk/Source/WebCore/ChangeLog 2021-02-06 18:01:26 UTC (rev 272463)
@@ -1,5 +1,34 @@
2021-02-06 Zalan Bujtas <[email protected]>
+ [LFC][IFC] Continuation pre and post block inline boxes should not have both the start and end decorations of the original inline box
+ https://bugs.webkit.org/show_bug.cgi?id=221502
+
+ Reviewed by Antti Koivisto.
+
+ The generated inline boxes inside the pre/post block containers of a continuation "inherit" all the original styles e.g.
+
+ <span style="margin-left: 10px"><div></div></span>
+
+ We turn this into a continuation by constructing a set of pre and a post block containers.
+
+ (pre)Block container (anonymous)
+ Inline container (<span>)
+ Block container (<div></div>)
+ (post)Block container (anonymous)
+ Inline container (</span>)
+
+ Now the border box of the inline container inside the post block container should not have a 1px margin offset. Only the inline container in the pre block should "inherit" the left margin from the original <span>.
+ Legacy line layout solves this issue by calling hasInlineDirectionBordersPaddingOrMargin() during layout to decide which side of the decorations to apply,
+ but these inline boxes should not have those start/end values the first place.
+ (see fast/inline/inline-with-empty-inline-continuations.html)
+
+ * layout/integration/LayoutIntegrationBoxTree.cpp:
+ (WebCore::LayoutIntegration::BoxTree::buildTree):
+ * layout/integration/LayoutIntegrationLineLayout.cpp:
+ (WebCore::LayoutIntegration::LineLayout::updateInlineBoxDimensions):
+
+2021-02-06 Zalan Bujtas <[email protected]>
+
[LFC][IFC][Quirk] Keep the root inline box baseline anchored at 0
https://bugs.webkit.org/show_bug.cgi?id=221517
Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationBoxTree.cpp (272462 => 272463)
--- trunk/Source/WebCore/layout/integration/LayoutIntegrationBoxTree.cpp 2021-02-06 16:01:56 UTC (rev 272462)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationBoxTree.cpp 2021-02-06 18:01:26 UTC (rev 272463)
@@ -83,8 +83,25 @@
if (is<RenderBlock>(childRenderer))
return makeUnique<Layout::ReplacedBox>(Layout::Box::ElementAttributes { Layout::Box::ElementType::GenericElement }, WTFMove(style));
- if (is<RenderInline>(childRenderer))
+ if (is<RenderInline>(childRenderer)) {
+ if (childRenderer.parent()->isAnonymousBlock()) {
+ // This looks like continuation renderer.
+ auto& renderInline = downcast<RenderInline>(childRenderer);
+ auto shouldNotRetainBorderPaddingAndMarginStart = renderInline.isContinuation();
+ auto shouldNotRetainBorderPaddingAndMarginEnd = !renderInline.isContinuation() && renderInline.inlineContinuation();
+ if (shouldNotRetainBorderPaddingAndMarginStart) {
+ style.setMarginStart(RenderStyle::initialMargin());
+ style.resetBorderLeft();
+ style.setPaddingLeft(RenderStyle::initialPadding());
+ }
+ if (shouldNotRetainBorderPaddingAndMarginEnd) {
+ style.setMarginEnd(RenderStyle::initialMargin());
+ style.resetBorderRight();
+ style.setPaddingRight(RenderStyle::initialPadding());
+ }
+ }
return makeUnique<Layout::ContainerBox>(Layout::Box::ElementAttributes { Layout::Box::ElementType::GenericElement }, WTFMove(style));
+ }
ASSERT_NOT_REACHED();
return nullptr;
Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp (272462 => 272463)
--- trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp 2021-02-06 16:01:56 UTC (rev 272462)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp 2021-02-06 18:01:26 UTC (rev 272463)
@@ -173,9 +173,17 @@
{
auto& boxGeometry = m_layoutState.ensureGeometryForBox(m_boxTree.layoutBoxForRenderer(renderInline));
- boxGeometry.setBorder({ { renderInline.borderLeft(), renderInline.borderRight() }, { renderInline.borderTop(), renderInline.borderBottom() } });
- boxGeometry.setPadding(Layout::Edges { { renderInline.paddingLeft(), renderInline.paddingRight() }, { renderInline.paddingTop(), renderInline.paddingBottom() } });
- boxGeometry.setHorizontalMargin({ renderInline.marginLeft(), renderInline.marginRight() });
+ // Check if this renderer is part of a continuation and adjust horizontal margin/border/padding accordingly.
+ auto shouldNotRetainBorderPaddingAndMarginStart = renderInline.parent()->isAnonymousBlock() && renderInline.isContinuation();
+ auto shouldNotRetainBorderPaddingAndMarginEnd = renderInline.parent()->isAnonymousBlock() && !renderInline.isContinuation() && renderInline.inlineContinuation();
+
+ auto horizontalMargin = Layout::BoxGeometry::HorizontalMargin { shouldNotRetainBorderPaddingAndMarginStart ? 0_lu : renderInline.marginLeft(), shouldNotRetainBorderPaddingAndMarginEnd ? 0_lu : renderInline.marginRight() };
+ auto horizontalBorder = Layout::HorizontalEdges { shouldNotRetainBorderPaddingAndMarginStart ? 0_lu : renderInline.borderLeft(), shouldNotRetainBorderPaddingAndMarginEnd ? 0_lu : renderInline.borderRight() };
+ auto horizontalPadding = Layout::HorizontalEdges { shouldNotRetainBorderPaddingAndMarginStart ? 0_lu : renderInline.paddingLeft(), shouldNotRetainBorderPaddingAndMarginEnd ? 0_lu : renderInline.paddingRight() };
+
+ boxGeometry.setPadding(Layout::Edges { horizontalPadding, { renderInline.paddingTop(), renderInline.paddingBottom() } });
+ boxGeometry.setBorder({ horizontalBorder, { renderInline.borderTop(), renderInline.borderBottom() } });
+ boxGeometry.setHorizontalMargin(horizontalMargin);
boxGeometry.setVerticalMargin({ });
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes