WebKit Bugzilla
Attachment 346143 Details for
Bug 188188
: [LFC] Add FormattingContext::mapToAncestor geometry mapping function
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
Patch.txt (text/plain), 4.17 KB, created by
zalan
on 2018-07-30 21:33:28 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
zalan
Created:
2018-07-30 21:33:28 PDT
Size:
4.17 KB
patch
obsolete
>diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 3a6490c92cd..e5ed0b425ed 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,17 @@ >+2018-07-30 Zalan Bujtas <zalan@apple.com> >+ >+ [LFC] Add FormattingContext::mapToAncestor geometry mapping function >+ https://bugs.webkit.org/show_bug.cgi?id=188188 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * layout/FormattingContext.cpp: >+ (WebCore::Layout::FormattingContext::mapToAncestor): >+ * layout/FormattingContext.h: >+ * layout/displaytree/DisplayBox.cpp: >+ (WebCore::Display::Box::clone const): >+ * layout/displaytree/DisplayBox.h: >+ > 2018-07-29 Zalan Bujtas <zalan@apple.com> > > [LFC][Floating] Add basic left/right floating positioning. >diff --git a/Source/WebCore/layout/FormattingContext.cpp b/Source/WebCore/layout/FormattingContext.cpp >index f9604ead705..c36ba7c6503 100644 >--- a/Source/WebCore/layout/FormattingContext.cpp >+++ b/Source/WebCore/layout/FormattingContext.cpp >@@ -142,6 +142,26 @@ void FormattingContext::layoutOutOfFlowDescendants(LayoutContext& layoutContext, > LOG_WITH_STREAM(FormattingContextLayout, stream << "End: layout out-of-flow descendants -> context: " << &layoutContext << " root: " << &root()); > } > >+Display::Box FormattingContext::mapToAncestor(const LayoutContext& layoutContext, const Box& layoutBox, const Container& ancestor) >+{ >+ auto* displayBox = layoutContext.displayBoxForLayoutBox(layoutBox); >+ ASSERT(displayBox); >+ auto topLeft = displayBox->topLeft(); >+ >+ auto* containingBlock = layoutBox.containingBlock(); >+ for (; containingBlock && containingBlock != &ancestor; containingBlock = containingBlock->containingBlock()) >+ topLeft.moveBy(layoutContext.displayBoxForLayoutBox(*containingBlock)->topLeft()); >+ >+ if (!containingBlock) { >+ ASSERT_NOT_REACHED(); >+ return displayBox->clone(); >+ } >+ >+ auto mappedDisplayBox = displayBox->clone(); >+ mappedDisplayBox.setTopLeft(topLeft); >+ return mappedDisplayBox; >+} >+ > #ifndef NDEBUG > void FormattingContext::validateGeometryConstraintsAfterLayout(const LayoutContext& layoutContext) const > { >diff --git a/Source/WebCore/layout/FormattingContext.h b/Source/WebCore/layout/FormattingContext.h >index 3b5b855331f..ce201cff64d 100644 >--- a/Source/WebCore/layout/FormattingContext.h >+++ b/Source/WebCore/layout/FormattingContext.h >@@ -59,6 +59,8 @@ public: > }; > virtual InstrinsicWidthConstraints instrinsicWidthConstraints(LayoutContext&, const Box&) const = 0; > >+ static Display::Box mapToAncestor(const LayoutContext&, const Box&, const Container& ancestor); >+ > protected: > struct LayoutPair { > const Box& layoutBox; >diff --git a/Source/WebCore/layout/displaytree/DisplayBox.cpp b/Source/WebCore/layout/displaytree/DisplayBox.cpp >index 74c09d4b2c4..3de06821c10 100644 >--- a/Source/WebCore/layout/displaytree/DisplayBox.cpp >+++ b/Source/WebCore/layout/displaytree/DisplayBox.cpp >@@ -115,6 +115,22 @@ Box::Rect Box::contentBox() const > return contentBox; > } > >+Box Box::clone() const >+{ >+ Box box; >+ box.m_style = m_style; >+ >+ box.m_topLeft = m_topLeft; >+ box.m_contentWidth = m_contentWidth; >+ box.m_contentHeight = m_contentHeight; >+ box.m_verticalNonCollapsedMargin = m_verticalNonCollapsedMargin; >+ box.m_margin = m_margin; >+ box.m_border = m_border; >+ box.m_padding = m_padding; >+ >+ return box; >+} >+ > } > } > >diff --git a/Source/WebCore/layout/displaytree/DisplayBox.h b/Source/WebCore/layout/displaytree/DisplayBox.h >index 59cc771a48b..30c75c10441 100644 >--- a/Source/WebCore/layout/displaytree/DisplayBox.h >+++ b/Source/WebCore/layout/displaytree/DisplayBox.h >@@ -158,10 +158,14 @@ public: > Rect paddingBox() const; > Rect contentBox() const; > >+ Box clone() const; >+ > private: >+ Box() = default; > Box(const RenderStyle&); > > struct Style { >+ Style() = default; > Style(const RenderStyle&); > > BoxSizing boxSizing { BoxSizing::ContentBox }; >@@ -199,7 +203,7 @@ private: > void setHasValidContentWidth() { m_hasValidContentWidth = true; } > #endif > >- const Style m_style; >+ Style m_style; > > LayoutPoint m_topLeft; > LayoutUnit m_contentWidth;
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 188188
:
346142
|
346143
|
346251
|
346277