WebKit Bugzilla
Attachment 340394 Details for
Bug 185641
: [LFC] Implement width computation for non-replaced block level inflow elements.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-185641-20180514213348.patch (text/plain), 7.63 KB, created by
zalan
on 2018-05-14 21:33:49 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
zalan
Created:
2018-05-14 21:33:49 PDT
Size:
7.63 KB
patch
obsolete
>Subversion Revision: 231785 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 81d9fdac01a4a201adcbc985efa1e7dda3f6ba5d..5f77f0fdcab3498e0ada2464227f1f8863af7e37 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,22 @@ >+2018-05-14 Zalan Bujtas <zalan@apple.com> >+ >+ [LFC] Implement width computation for non-replaced block level inflow elements. >+ https://bugs.webkit.org/show_bug.cgi?id=185641 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Block level inflow elements participate in block formatting context. >+ >+ * layout/FormattingContext.cpp: >+ (WebCore::Layout::FormattingContext::computeWidth const): >+ * layout/FormattingContext.h: >+ * layout/blockformatting/BlockFormattingContext.cpp: >+ (WebCore::Layout::BlockFormattingContext::computeInFlowWidth const): >+ * layout/blockformatting/BlockFormattingContext.h: >+ * layout/inlineformatting/InlineFormattingContext.cpp: >+ (WebCore::Layout::InlineFormattingContext::computeInFlowWidth const): >+ * layout/inlineformatting/InlineFormattingContext.h: >+ > 2018-05-14 Wenson Hsieh <wenson_hsieh@apple.com> > > Unreviewed, fix the iOS build after r231779 >diff --git a/Source/WebCore/layout/FormattingContext.cpp b/Source/WebCore/layout/FormattingContext.cpp >index fe1069a18c7b3ba77cd973f98c0103ffb86e3829..094959823f1a8fa1e9b64694cea096b180db079a 100644 >--- a/Source/WebCore/layout/FormattingContext.cpp >+++ b/Source/WebCore/layout/FormattingContext.cpp >@@ -66,7 +66,7 @@ void FormattingContext::computeWidth(LayoutContext& layoutContext, const Box& la > return computeOutOfFlowWidth(layoutContext, layoutBox, displayBox); > if (layoutBox.isFloatingPositioned()) > return computeFloatingWidth(layoutBox, displayBox); >- return computeInFlowWidth(layoutBox, displayBox); >+ return computeInFlowWidth(layoutContext, layoutBox, displayBox); > } > > void FormattingContext::computeHeight(LayoutContext& layoutContext, const Box& layoutBox, Display::Box& displayBox) const >diff --git a/Source/WebCore/layout/FormattingContext.h b/Source/WebCore/layout/FormattingContext.h >index 42faedaff77735f46a663c6953419278f4b1ed14..2424b1a1d12f6f78afd937a959ae23fd4f707d6f 100644 >--- a/Source/WebCore/layout/FormattingContext.h >+++ b/Source/WebCore/layout/FormattingContext.h >@@ -73,7 +73,7 @@ protected: > > virtual void computeOutOfFlowWidth(LayoutContext&, const Box&, Display::Box&) const; > virtual void computeFloatingWidth(const Box&, Display::Box&) const; >- virtual void computeInFlowWidth(const Box&, Display::Box&) const = 0; >+ virtual void computeInFlowWidth(LayoutContext&, const Box&, Display::Box&) const = 0; > > virtual void computeOutOfFlowHeight(LayoutContext&, const Box&, Display::Box&) const; > virtual void computeFloatingHeight(const Box&, Display::Box&) const; >diff --git a/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp b/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp >index 05421361b1ce0586550a896dafcfc15b1aa4b724..4c3f41b5c49c17c3c73583151365580fa1869745 100644 >--- a/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp >+++ b/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp >@@ -143,8 +143,42 @@ void BlockFormattingContext::computeStaticPosition(LayoutContext& layoutContext, > displayBox.setTopLeft(topLeft); > } > >-void BlockFormattingContext::computeInFlowWidth(const Box&, Display::Box&) const >+void BlockFormattingContext::computeInFlowWidth(LayoutContext& layoutContext, const Box& layoutBox, Display::Box& displayBox) const > { >+ if (!layoutBox.isReplaced()) { >+ computeInFlowNonReplacedWidth(layoutContext, layoutBox, displayBox); >+ return; >+ } >+ ASSERT_NOT_REACHED(); >+} >+ >+void BlockFormattingContext::computeInFlowNonReplacedWidth(LayoutContext& layoutContext, const Box& layoutBox, Display::Box& displayBox) const >+{ >+ // 10.3.3 Block-level, non-replaced elements in normal flow >+ // The following constraints must hold among the used values of the other properties: >+ // 'margin-left' + 'border-left-width' + 'padding-left' + 'width' + 'padding-right' + 'border-right-width' + 'margin-right' = width of containing block >+ >+ // If 'width' is set to 'auto', any other 'auto' values become '0' and 'width' follows from the resulting equality. >+ auto& style = layoutBox.style(); >+ auto containingBlockWidth = layoutContext.displayBoxForLayoutBox(*layoutBox.containingBlock())->width(); >+ >+ LayoutUnit computedWidthValue; >+ auto width = style.logicalWidth(); >+ if (width.isAuto()) { >+ auto marginLeft = displayBox.marginLeft(); >+ auto marginRight = displayBox.marginRight(); >+ >+ auto paddingLeft = displayBox.paddingLeft(); >+ auto paddingRight = displayBox.paddingRight(); >+ >+ auto borderLeft = displayBox.borderLeft(); >+ auto borderRight = displayBox.borderRight(); >+ >+ computedWidthValue = containingBlockWidth - (marginLeft + borderLeft + paddingLeft + paddingRight + borderRight + marginRight); >+ } else >+ computedWidthValue = valueForLength(width, containingBlockWidth); >+ >+ displayBox.setWidth(computedWidthValue); > } > > void BlockFormattingContext::computeInFlowHeight(LayoutContext& layoutContext, const Box& layoutBox, Display::Box& displayBox) const >diff --git a/Source/WebCore/layout/blockformatting/BlockFormattingContext.h b/Source/WebCore/layout/blockformatting/BlockFormattingContext.h >index e2ac84a027af5b24fec28981dfdf7c158f3d1739..0419f6b394fea92f58c718dce5fe818ed856178c 100644 >--- a/Source/WebCore/layout/blockformatting/BlockFormattingContext.h >+++ b/Source/WebCore/layout/blockformatting/BlockFormattingContext.h >@@ -51,7 +51,10 @@ public: > > private: > void computeStaticPosition(LayoutContext&, const Box&, Display::Box&) const override; >- void computeInFlowWidth(const Box&, Display::Box&) const override; >+ >+ void computeInFlowWidth(LayoutContext&, const Box&, Display::Box&) const override; >+ void computeInFlowNonReplacedWidth(LayoutContext&, const Box&, Display::Box&) const; >+ > void computeInFlowHeight(LayoutContext&, const Box&, Display::Box&) const override; > void computeInFlowNonReplacedHeight(LayoutContext&, const Box&, Display::Box&) const; > >diff --git a/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp b/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp >index bb8a390c126df098761da0240b3c3197e5366e2a..b7ab20322ec7484a446b38f804b656f943684af6 100644 >--- a/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp >+++ b/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp >@@ -66,7 +66,7 @@ Ref<FloatingState> InlineFormattingContext::createOrFindFloatingState(LayoutCont > return formattingState.floatingState(); > } > >-void InlineFormattingContext::computeInFlowWidth(const Box&, Display::Box&) const >+void InlineFormattingContext::computeInFlowWidth(LayoutContext&, const Box&, Display::Box&) const > { > } > >diff --git a/Source/WebCore/layout/inlineformatting/InlineFormattingContext.h b/Source/WebCore/layout/inlineformatting/InlineFormattingContext.h >index 4437bd8ce02508133451ec416534586cf0162ca8..1f5a8ecb37e2229690b696d1f74a29f0f63bc1d2 100644 >--- a/Source/WebCore/layout/inlineformatting/InlineFormattingContext.h >+++ b/Source/WebCore/layout/inlineformatting/InlineFormattingContext.h >@@ -48,7 +48,7 @@ public: > Ref<FloatingState> createOrFindFloatingState(LayoutContext&) const override; > > private: >- void computeInFlowWidth(const Box&, Display::Box&) const override; >+ void computeInFlowWidth(LayoutContext&, const Box&, Display::Box&) const override; > void computeInFlowHeight(LayoutContext&, const Box&, Display::Box&) const override; > > };
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
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 185641
: 340394