WebKit Bugzilla
Attachment 342033 Details for
Bug 186337
: [LFC] Add margin computation for floating, replaced elements.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-186337-20180605220946.patch (text/plain), 5.28 KB, created by
zalan
on 2018-06-05 22:09:47 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
zalan
Created:
2018-06-05 22:09:47 PDT
Size:
5.28 KB
patch
obsolete
>Subversion Revision: 232536 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index aa2f11dcd57355b4188b752ac9eb7ae2895e28ea..53e7f42d0aebc4481bff6af6d37a76b2bf4312bd 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,17 @@ >+2018-06-05 Zalan Bujtas <zalan@apple.com> >+ >+ [LFC] Add margin computation for floating, replaced elements. >+ https://bugs.webkit.org/show_bug.cgi?id=186337 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ If 'margin-left' or 'margin-right' are computed as 'auto', their used value is '0'. >+ >+ * layout/FormattingContext.h: >+ * layout/FormattingContextGeometry.cpp: >+ (WebCore::Layout::FormattingContext::Geometry::floatingReplacedWidthAndMargin): >+ (WebCore::Layout::FormattingContext::Geometry::inlineReplacedWidthAndMargin): >+ > 2018-06-05 Per Arne Vollan <pvollan@apple.com> > > Move OpenGL display mask to screen data struct. >diff --git a/Source/WebCore/layout/FormattingContext.h b/Source/WebCore/layout/FormattingContext.h >index 9d40016e8ac89d9b86a43dcdc632d1cda4841580..297fe733b95825c96d086527f6863e91198ee900 100644 >--- a/Source/WebCore/layout/FormattingContext.h >+++ b/Source/WebCore/layout/FormattingContext.h >@@ -95,7 +95,8 @@ protected: > static LayoutPoint outOfFlowPosition(LayoutContext&, const Box&); > > static LayoutUnit inlineReplacedHeight(LayoutContext&, const Box&); >- static WidthAndMargin inlineReplacedWidthAndMargin(LayoutContext&, const Box&); >+ static WidthAndMargin inlineReplacedWidthAndMargin(LayoutContext&, const Box&, std::optional<LayoutUnit> precomputedMarginLeft = std::nullopt, >+ std::optional<LayoutUnit> precomputedMarginRight = std::nullopt); > > static Display::Box::Edges computedBorder(LayoutContext&, const Box&); > static std::optional<Display::Box::Edges> computedPadding(LayoutContext&, const Box&); >diff --git a/Source/WebCore/layout/FormattingContextGeometry.cpp b/Source/WebCore/layout/FormattingContextGeometry.cpp >index 4839cda938dbf39595cb8bcd9509f6e8658a42be..35b6cc70c48f82a27716783b4184f0cc3b40d3cf 100644 >--- a/Source/WebCore/layout/FormattingContextGeometry.cpp >+++ b/Source/WebCore/layout/FormattingContextGeometry.cpp >@@ -240,8 +240,18 @@ FormattingContext::Geometry::WidthAndMargin FormattingContext::Geometry::floatin > ASSERT(layoutBox.isFloatingPositioned() && layoutBox.replaced()); > // 10.3.6 Floating, replaced elements > // >- // The used value of 'width' is determined as for inline replaced elements. >- return inlineReplacedWidthAndMargin(layoutContext, layoutBox); >+ // 1. If 'margin-left' or 'margin-right' are computed as 'auto', their used value is '0'. >+ // 2. The used value of 'width' is determined as for inline replaced elements. >+ auto& style = layoutBox.style(); >+ std::optional<LayoutUnit> computedMarginLeftValue; >+ std::optional<LayoutUnit> computedMarginRightValue; >+ >+ if (style.marginLeft().isAuto()) >+ computedMarginLeftValue = LayoutUnit { 0 }; >+ if (style.marginRight().isAuto()) >+ computedMarginRightValue = LayoutUnit { 0 }; >+ >+ return inlineReplacedWidthAndMargin(layoutContext, layoutBox, computedMarginLeftValue, computedMarginRightValue); > } > > static LayoutPoint outOfFlowNonReplacedPosition(LayoutContext& layoutContext, const Box& layoutBox) >@@ -519,7 +529,8 @@ LayoutUnit FormattingContext::Geometry::inlineReplacedHeight(LayoutContext&, con > return computedHeightValue; > } > >-FormattingContext::Geometry::WidthAndMargin FormattingContext::Geometry::inlineReplacedWidthAndMargin(LayoutContext& layoutContext, const Box& layoutBox) >+FormattingContext::Geometry::WidthAndMargin FormattingContext::Geometry::inlineReplacedWidthAndMargin(LayoutContext& layoutContext, const Box& layoutBox, >+ std::optional<LayoutUnit> precomputedMarginLeft, std::optional<LayoutUnit> precomputedMarginRight) > { > ASSERT((layoutBox.isOutOfFlowPositioned() || layoutBox.isFloatingPositioned() || layoutBox.isInFlow()) && layoutBox.replaced()); > // 10.3.2 Inline, replaced elements >@@ -546,12 +557,20 @@ FormattingContext::Geometry::WidthAndMargin FormattingContext::Geometry::inlineR > LayoutUnit computedMarginRightValue; > > { >- auto marginLeft = style.marginLeft(); >- auto marginRight = style.marginRight(); > auto containingBlockWidth = layoutContext.displayBoxForLayoutBox(*layoutBox.containingBlock())->width(); >+ if (precomputedMarginLeft) >+ computedMarginLeftValue = precomputedMarginLeft.value(); >+ else { >+ auto marginLeft = style.marginLeft(); >+ computedMarginLeftValue = marginLeft.isAuto() ? LayoutUnit { 0 } : valueForLength(marginLeft, containingBlockWidth); >+ } > >- computedMarginLeftValue = marginLeft.isAuto() ? LayoutUnit(0) : valueForLength(marginLeft, containingBlockWidth); >- computedMarginRightValue = marginRight.isAuto() ? LayoutUnit(0) : valueForLength(marginRight, containingBlockWidth); >+ if (precomputedMarginRight) >+ computedMarginRightValue = precomputedMarginRight.value(); >+ else { >+ auto marginRight = style.marginRight(); >+ computedMarginRightValue = marginRight.isAuto() ? LayoutUnit { 0 }: valueForLength(marginRight, containingBlockWidth); >+ } > } > > auto width = style.logicalWidth();
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
koivisto
:
review+
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 186337
: 342033