WebKit Bugzilla
Attachment 346441 Details for
Bug 188294
: [LFC][Floating] Add FloatingState::bottom() to enable content height computation for formatting roots.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-188294-20180802184920.patch (text/plain), 4.48 KB, created by
zalan
on 2018-08-02 18:49:21 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
zalan
Created:
2018-08-02 18:49:21 PDT
Size:
4.48 KB
patch
obsolete
>Subversion Revision: 234524 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 363bbaeaeb2a0f682f0e4feda2e12d37a542b78a..19bfb8a0c3c7273c8de9120f38a407b11b66d477 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,22 @@ >+2018-08-02 Zalan Bujtas <zalan@apple.com> >+ >+ [LFC][Floating] Add FloatingState::bottom() to enable content height computation for formatting roots. >+ https://bugs.webkit.org/show_bug.cgi?id=188294 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ "10.6.7 'Auto' heights for block formatting context roots >+ ... >+ In addition, if the element has any floating descendants whose bottom margin edge is below the element's bottom content edge, >+ then the height is increased to include those edges. Only floats that participate in this block formatting context are taken into >+ account, e.g., floats inside absolutely positioned descendants or other floats are not..." >+ >+ * layout/FloatingState.cpp: >+ (WebCore::Layout::FloatingState::bottom const): >+ * layout/FloatingState.h: >+ * layout/FormattingContextGeometry.cpp: >+ (WebCore::Layout::contentHeightForFormattingContextRoot): >+ > 2018-08-02 Zalan Bujtas <zalan@apple.com> > > [LFC][Floating] Remove redundant LayoutContext member variable. >diff --git a/Source/WebCore/layout/FloatingState.cpp b/Source/WebCore/layout/FloatingState.cpp >index 2cca39e20901d83fe992c8789697f4e019715a6a..be0ddd0f99410c90de440c56a59b65c78975f3d4 100644 >--- a/Source/WebCore/layout/FloatingState.cpp >+++ b/Source/WebCore/layout/FloatingState.cpp >@@ -90,6 +90,29 @@ void FloatingState::append(const Box& layoutBox) > m_floats.append({ layoutBox, *this }); > } > >+std::optional<LayoutUnit> FloatingState::bottom(const Box& formattingContextRoot) const >+{ >+ if (m_floats.isEmpty()) >+ return { }; >+ >+ // TODO: Currently this is only called once for each formatting context root with floats per layout. >+ // Cache the value if we end up calling it more frequently (and update it at append/remove). >+ std::optional<LayoutUnit> bottom; >+ for (auto& floatItem : m_floats) { >+ // Ignore floats from other formatting contexts when the floating state is inherited. >+ if (&formattingContextRoot != &floatItem.layoutBox().formattingContextRoot()) >+ continue; >+ >+ auto floatsBottom = floatItem.displayBox().rectWithMargin().bottom(); >+ if (bottom) { >+ bottom = std::max(*bottom, floatsBottom); >+ continue; >+ } >+ bottom = floatsBottom; >+ } >+ return bottom; >+} >+ > } > } > #endif >diff --git a/Source/WebCore/layout/FloatingState.h b/Source/WebCore/layout/FloatingState.h >index cfb2e0060ea3ee02e8fdb45f9aecb65344e34f46..62cf25d9e3ac9886662d42adc6ddef1861060be6 100644 >--- a/Source/WebCore/layout/FloatingState.h >+++ b/Source/WebCore/layout/FloatingState.h >@@ -51,6 +51,7 @@ public: > void remove(const Box& layoutBox); > > bool isEmpty() const { return m_floats.isEmpty(); } >+ std::optional<LayoutUnit> bottom(const Box& formattingContextRoot) const; > > class FloatItem { > public: >diff --git a/Source/WebCore/layout/FormattingContextGeometry.cpp b/Source/WebCore/layout/FormattingContextGeometry.cpp >index fbffe73cd78938a450abd67d32adee907cc44d69..7313388f2291e7e713efccd96922fa5bf40b7d77 100644 >--- a/Source/WebCore/layout/FormattingContextGeometry.cpp >+++ b/Source/WebCore/layout/FormattingContextGeometry.cpp >@@ -24,7 +24,9 @@ > */ > > #include "config.h" >+#include "FloatingState.h" > #include "FormattingContext.h" >+#include "FormattingState.h" > > #if ENABLE(LAYOUT_FORMATTING_CONTEXT) > >@@ -53,10 +55,12 @@ static LayoutUnit contentHeightForFormattingContextRoot(LayoutContext& layoutCon > > auto* firstDisplayBox = layoutContext.displayBoxForLayoutBox(*formattingRootContainer.firstInFlowChild()); > auto* lastDisplayBox = layoutContext.displayBoxForLayoutBox(*formattingRootContainer.lastInFlowChild()); >+ auto floatsBottom = layoutContext.establishedFormattingState(layoutBox).floatingState().bottom(layoutBox); > > auto top = firstDisplayBox->marginBox().top(); > auto bottom = lastDisplayBox->marginBox().bottom(); >- // FIXME: add floating support. >+ if (floatsBottom) >+ bottom = std::max(*floatsBottom, bottom); > auto computedHeight = bottom - top; > LOG_WITH_STREAM(FormattingContextLayout, stream << "[Height] -> content height for formatting context root -> height(" << computedHeight << "px) layoutBox("<< &layoutBox << ")"); > return computedHeight;
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:
simon.fraser
:
review+
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 188294
: 346441