WebKit Bugzilla
Attachment 340552 Details for
Bug 185711
: [LFC] Move replaced logic from Layout::Box to Layout::Replaced class
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-185711-20180516204624.patch (text/plain), 11.34 KB, created by
zalan
on 2018-05-16 20:46:24 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
zalan
Created:
2018-05-16 20:46:24 PDT
Size:
11.34 KB
patch
obsolete
>Subversion Revision: 231854 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 051b6bc788a0e126cf71a04de8d7841aafbd5ba9..f2701cd0f80e23428a778d7ae922cd20574fedc2 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,31 @@ >+2018-05-16 Zalan Bujtas <zalan@apple.com> >+ >+ [LFC] Move replaced logic from Layout::Box to Layout::Replaced class >+ https://bugs.webkit.org/show_bug.cgi?id=185711 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * Sources.txt: >+ * WebCore.xcodeproj/project.pbxproj: >+ * layout/FormattingContext.cpp: >+ (WebCore::Layout::FormattingContext::computeOutOfFlowWidth const): >+ (WebCore::Layout::FormattingContext::computeFloatingWidth const): >+ (WebCore::Layout::FormattingContext::computeOutOfFlowHeight const): >+ (WebCore::Layout::FormattingContext::computeInFlowReplacedWidth const): >+ * layout/blockformatting/BlockFormattingContext.cpp: >+ (WebCore::Layout::BlockFormattingContext::computeInFlowWidth const): >+ (WebCore::Layout::BlockFormattingContext::computeInFlowHeight const): >+ * layout/layouttree/LayoutBox.cpp: >+ (WebCore::Layout::Box::isReplaced const): Deleted. >+ (WebCore::Layout::Box::hasIntrinsicWidth const): Deleted. >+ (WebCore::Layout::Box::hasIntrinsicHeight const): Deleted. >+ (WebCore::Layout::Box::hasIntrinsicRatio const): Deleted. >+ (WebCore::Layout::Box::intrinsicWidth const): Deleted. >+ (WebCore::Layout::Box::intrinsicHeight const): Deleted. >+ (WebCore::Layout::Box::intrinsicRatio const): Deleted. >+ * layout/layouttree/LayoutBox.h: >+ (WebCore::Layout::Box::replaced const): >+ > 2018-05-14 Yusuke Suzuki <utatane.tea@gmail.com> > > [Win] Use C++17 in MSVC >diff --git a/Source/WebCore/Sources.txt b/Source/WebCore/Sources.txt >index 9c938a546af57218ee7479cc0d36b4266449f1b0..db31065e2fe7a26c0831194f33ebc67b8d326a7b 100644 >--- a/Source/WebCore/Sources.txt >+++ b/Source/WebCore/Sources.txt >@@ -1231,6 +1231,7 @@ layout/layouttree/LayoutBox.cpp > layout/layouttree/LayoutContainer.cpp > layout/layouttree/LayoutInlineBox.cpp > layout/layouttree/LayoutInlineContainer.cpp >+layout/layouttree/LayoutReplaced.cpp > layout/layouttree/LayoutTreeBuilder.cpp > > loader/ContentFilter.cpp >diff --git a/Source/WebCore/WebCore.xcodeproj/project.pbxproj b/Source/WebCore/WebCore.xcodeproj/project.pbxproj >index 534b470daee7145414a0119e885a3bd0a71fdfa9..7065759e5709f6386d240f454bb9d5173de3c3f3 100644 >--- a/Source/WebCore/WebCore.xcodeproj/project.pbxproj >+++ b/Source/WebCore/WebCore.xcodeproj/project.pbxproj >@@ -5727,6 +5727,8 @@ > 11100FCA2092868D0081AA6C /* LayoutAncestorIterator.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LayoutAncestorIterator.h; sourceTree = "<group>"; }; > 11100FD5209514DE0081AA6C /* LayoutTreeBuilder.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = LayoutTreeBuilder.cpp; sourceTree = "<group>"; }; > 11100FD7209514DF0081AA6C /* LayoutTreeBuilder.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LayoutTreeBuilder.h; sourceTree = "<group>"; }; >+ 111C615620AD1AE1005B82FA /* LayoutReplaced.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LayoutReplaced.h; sourceTree = "<group>"; }; >+ 111C615720AD1AE1005B82FA /* LayoutReplaced.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = LayoutReplaced.cpp; sourceTree = "<group>"; }; > 1123AFD9209ABB2000736ACC /* BlockInvalidation.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BlockInvalidation.h; sourceTree = "<group>"; }; > 1123AFDA209ABB2000736ACC /* BlockInvalidation.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = BlockInvalidation.cpp; sourceTree = "<group>"; }; > 1123AFDC209ABBBA00736ACC /* InlineInvalidation.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = InlineInvalidation.h; sourceTree = "<group>"; }; >@@ -15700,6 +15702,8 @@ > 1199FA4E208E3899002358CC /* LayoutInlineContainer.cpp */, > 1199FA4D208E3899002358CC /* LayoutInlineContainer.h */, > 11100FC72092764C0081AA6C /* LayoutIterator.h */, >+ 111C615720AD1AE1005B82FA /* LayoutReplaced.cpp */, >+ 111C615620AD1AE1005B82FA /* LayoutReplaced.h */, > 11100FD5209514DE0081AA6C /* LayoutTreeBuilder.cpp */, > 11100FD7209514DF0081AA6C /* LayoutTreeBuilder.h */, > ); >diff --git a/Source/WebCore/layout/FormattingContext.cpp b/Source/WebCore/layout/FormattingContext.cpp >index 8df9dff435225825983cd906239a56db6181fd1d..bb32f7d25aa60e6b9101855930dada20734a911a 100644 >--- a/Source/WebCore/layout/FormattingContext.cpp >+++ b/Source/WebCore/layout/FormattingContext.cpp >@@ -80,7 +80,7 @@ void FormattingContext::computeHeight(LayoutContext& layoutContext, const Box& l > > void FormattingContext::computeOutOfFlowWidth(LayoutContext& layoutContext, const Box& layoutBox, Display::Box& displayBox) const > { >- if (!layoutBox.isReplaced()) { >+ if (!layoutBox.replaced()) { > computeOutOfFlowNonReplacedWidth(layoutContext, layoutBox, displayBox); > return; > } >@@ -89,7 +89,7 @@ void FormattingContext::computeOutOfFlowWidth(LayoutContext& layoutContext, cons > > void FormattingContext::computeFloatingWidth(LayoutContext& layoutContext, const Box& layoutBox, Display::Box& displayBox) const > { >- if (!layoutBox.isReplaced()) { >+ if (!layoutBox.replaced()) { > ASSERT_NOT_REACHED(); > return; > } >@@ -98,7 +98,7 @@ void FormattingContext::computeFloatingWidth(LayoutContext& layoutContext, const > > void FormattingContext::computeOutOfFlowHeight(LayoutContext& layoutContext, const Box& layoutBox, Display::Box& displayBox) const > { >- if (!layoutBox.isReplaced()) { >+ if (!layoutBox.replaced()) { > computeOutOfFlowNonReplacedHeight(layoutContext, layoutBox, displayBox); > return; > } >@@ -234,21 +234,23 @@ void FormattingContext::computeInFlowReplacedWidth(LayoutContext&, const Box& la > auto height = style.logicalHeight(); > > LayoutUnit computedWidthValue; >+ auto replaced = layoutBox.replaced(); >+ ASSERT(replaced); > >- if (width.isAuto() && height.isAuto() && layoutBox.hasIntrinsicWidth()) { >+ if (width.isAuto() && height.isAuto() && replaced->hasIntrinsicWidth()) { > // #1 >- computedWidthValue = layoutBox.intrinsicWidth(); >- } else if (width.isAuto() && (height.isCalculated() || layoutBox.hasIntrinsicHeight()) && layoutBox.hasIntrinsicRatio()) { >+ computedWidthValue = replaced->intrinsicWidth(); >+ } else if (width.isAuto() && (height.isCalculated() || replaced->hasIntrinsicHeight()) && replaced->hasIntrinsicRatio()) { > // #2 >- auto usedHeight = height.isCalculated() ? LayoutUnit(height.value()) : layoutBox.intrinsicHeight(); >- computedWidthValue = usedHeight * layoutBox.intrinsicRatio(); >- } else if (width.isAuto() && height.isAuto() && layoutBox.hasIntrinsicRatio()) { >+ auto usedHeight = height.isCalculated() ? LayoutUnit(height.value()) : replaced->intrinsicHeight(); >+ computedWidthValue = usedHeight * replaced->intrinsicRatio(); >+ } else if (width.isAuto() && height.isAuto() && replaced->hasIntrinsicRatio()) { > // #3 > // FIXME: undefined but surely doable. > ASSERT_NOT_REACHED(); >- } else if (width.isAuto() && layoutBox.hasIntrinsicWidth()) { >+ } else if (width.isAuto() && replaced->hasIntrinsicWidth()) { > // #4 >- computedWidthValue = layoutBox.intrinsicWidth(); >+ computedWidthValue = replaced->intrinsicWidth(); > } else { > // #5 > computedWidthValue = 300; >diff --git a/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp b/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp >index e78b592a8a180d1e6672a132f326d3dbeba449f0..c579b65970edfd127edfd8cc7ec151f847769603 100644 >--- a/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp >+++ b/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp >@@ -145,7 +145,7 @@ void BlockFormattingContext::computeStaticPosition(LayoutContext& layoutContext, > > void BlockFormattingContext::computeInFlowWidth(LayoutContext& layoutContext, const Box& layoutBox, Display::Box& displayBox) const > { >- if (!layoutBox.isReplaced()) { >+ if (!layoutBox.replaced()) { > computeInFlowNonReplacedWidth(layoutContext, layoutBox, displayBox); > return; > } >@@ -183,7 +183,7 @@ void BlockFormattingContext::computeInFlowNonReplacedWidth(LayoutContext& layout > > void BlockFormattingContext::computeInFlowHeight(LayoutContext& layoutContext, const Box& layoutBox, Display::Box& displayBox) const > { >- if (!layoutBox.isReplaced()) { >+ if (!layoutBox.replaced()) { > computeInFlowNonReplacedHeight(layoutContext, layoutBox, displayBox); > return; > } >diff --git a/Source/WebCore/layout/layouttree/LayoutBox.cpp b/Source/WebCore/layout/layouttree/LayoutBox.cpp >index 940f908a903a08f238f685454c499ee2da213517..44797af8ec71a028e68baee13d31282f54f0f65a 100644 >--- a/Source/WebCore/layout/layouttree/LayoutBox.cpp >+++ b/Source/WebCore/layout/layouttree/LayoutBox.cpp >@@ -179,12 +179,6 @@ bool Box::isInitialContainingBlock() const > return !parent(); > } > >-bool Box::isReplaced() const >-{ >- // HTMLAudioElement || HTMLCanvasElement || HTMLEmbedElement || HTMLIFrameElement || HTMLImageElement || HTMLInputElement || HTMLObjectElement || HTMLVideoElement >- return false; >-} >- > const Box* Box::nextInFlowSibling() const > { > if (auto* nextSibling = this->nextSibling()) { >@@ -230,39 +224,6 @@ bool Box::isOverflowVisible() const > return m_style.overflowX() == OVISIBLE || m_style.overflowY() == OVISIBLE; > } > >-bool Box::hasIntrinsicWidth() const >-{ >- return false; >-} >- >-bool Box::hasIntrinsicHeight() const >-{ >- return false; >-} >- >-bool Box::hasIntrinsicRatio() const >-{ >- return false; >-} >- >-LayoutUnit Box::intrinsicWidth() const >-{ >- ASSERT(hasIntrinsicWidth()); >- return { }; >-} >- >-LayoutUnit Box::intrinsicHeight() const >-{ >- ASSERT(hasIntrinsicHeight()); >- return { }; >-} >- >-LayoutUnit Box::intrinsicRatio() const >-{ >- ASSERT(hasIntrinsicRatio()); >- return { }; >-} >- > } > } > >diff --git a/Source/WebCore/layout/layouttree/LayoutBox.h b/Source/WebCore/layout/layouttree/LayoutBox.h >index 70437c99b635e3024c7e726613701e25292584c5..10f60abffe0ea31ea71a410b4e2ff9f250493288 100644 >--- a/Source/WebCore/layout/layouttree/LayoutBox.h >+++ b/Source/WebCore/layout/layouttree/LayoutBox.h >@@ -27,6 +27,7 @@ > > #if ENABLE(LAYOUT_FORMATTING_CONTEXT) > >+#include "LayoutReplaced.h" > #include "RenderStyle.h" > #include <wtf/IsoMalloc.h> > #include <wtf/WeakPtr.h> >@@ -90,14 +91,7 @@ public: > const RenderStyle& style() const { return m_style; } > auto& weakPtrFactory() const { return m_weakFactory; } > >- bool isReplaced() const; >- // FIXME: find out how to not pollute the Box interface >- bool hasIntrinsicWidth() const; >- bool hasIntrinsicHeight() const; >- bool hasIntrinsicRatio() const; >- LayoutUnit intrinsicWidth() const; >- LayoutUnit intrinsicHeight() const; >- LayoutUnit intrinsicRatio() const; >+ std::optional<const Replaced> replaced() const { return m_replaced; } > > protected: > enum BaseTypeFlag { >@@ -123,6 +117,8 @@ private: > Box* m_previousSibling { nullptr }; > Box* m_nextSibling { nullptr }; > >+ std::optional<const Replaced> m_replaced; >+ > unsigned m_baseTypeFlags : 4; > unsigned m_isAnonymous : 1; >
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 185711
:
340552
|
340553