WebKit Bugzilla
Attachment 338828 Details for
Bug 185016
: [LFC] Add support for is<> and downcast<>
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-185016-20180425165641.patch (text/plain), 9.26 KB, created by
zalan
on 2018-04-25 16:56:41 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
zalan
Created:
2018-04-25 16:56:41 PDT
Size:
9.26 KB
patch
obsolete
>Subversion Revision: 231028 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 7a6d28b8cc1ea407daaf981ef340836edb6f1d07..545bff5d07a7c854e4562fc02ef466a4772a368f 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,30 @@ >+2018-04-25 Zalan Bujtas <zalan@apple.com> >+ >+ [LFC] Add support for is<> and downcast<> >+ https://bugs.webkit.org/show_bug.cgi?id=185016 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * layout/layouttree/LayoutBlockContainer.cpp: >+ (WebCore::Layout::BlockContainer::BlockContainer): >+ * layout/layouttree/LayoutBlockContainer.h: >+ * layout/layouttree/LayoutBox.cpp: >+ (WebCore::Layout::Box::Box): >+ * layout/layouttree/LayoutBox.h: >+ (WebCore::Layout::Box::isContainer const): >+ (WebCore::Layout::Box::isBlockContainer const): >+ (WebCore::Layout::Box::isInlineBox const): >+ (WebCore::Layout::Box::isInlineContainer const): >+ * layout/layouttree/LayoutContainer.cpp: >+ (WebCore::Layout::Container::Container): >+ * layout/layouttree/LayoutContainer.h: >+ * layout/layouttree/LayoutInlineBox.cpp: >+ (WebCore::Layout::InlineBox::InlineBox): >+ * layout/layouttree/LayoutInlineBox.h: >+ * layout/layouttree/LayoutInlineContainer.cpp: >+ (WebCore::Layout::InlineContainer::InlineContainer): >+ * layout/layouttree/LayoutInlineContainer.h: >+ > 2018-04-25 Zalan Bujtas <zalan@apple.com> > > [LFC] Implement LayoutContexet::layout() and its dependencies. >diff --git a/Source/WebCore/layout/layouttree/LayoutBlockContainer.cpp b/Source/WebCore/layout/layouttree/LayoutBlockContainer.cpp >index d847cd449bd0b9a9a6b6d0aeb17c528c1df72399..7f43b3782e493dbf6f3cbefa5ccfd2aeee82c197 100644 >--- a/Source/WebCore/layout/layouttree/LayoutBlockContainer.cpp >+++ b/Source/WebCore/layout/layouttree/LayoutBlockContainer.cpp >@@ -36,8 +36,8 @@ namespace Layout { > > WTF_MAKE_ISO_ALLOCATED_IMPL(BlockContainer); > >-BlockContainer::BlockContainer(RenderStyle&& style) >- : Container(WTFMove(style)) >+BlockContainer::BlockContainer(RenderStyle&& style, BaseTypeFlags baseTypeFlags) >+ : Container(WTFMove(style), baseTypeFlags | BlockContainerFlag) > { > } > >diff --git a/Source/WebCore/layout/layouttree/LayoutBlockContainer.h b/Source/WebCore/layout/layouttree/LayoutBlockContainer.h >index 43e9fae9cbcb777f1ef4b3c088f137f3c0bf9a80..98c41a3d769f504cc7b54e601d77dfad3d2cbc95 100644 >--- a/Source/WebCore/layout/layouttree/LayoutBlockContainer.h >+++ b/Source/WebCore/layout/layouttree/LayoutBlockContainer.h >@@ -39,11 +39,14 @@ namespace Layout { > class BlockContainer : public Container { > WTF_MAKE_ISO_ALLOCATED(BlockContainer); > public: >- BlockContainer(RenderStyle&&); >+ BlockContainer(RenderStyle&&, BaseTypeFlags); > > bool establishesInlineFormattingContext() const final; > }; > > } > } >+ >+SPECIALIZE_TYPE_TRAITS_LAYOUT_BOX(BlockContainer, isBlockContainer()) >+ > #endif >diff --git a/Source/WebCore/layout/layouttree/LayoutBox.cpp b/Source/WebCore/layout/layouttree/LayoutBox.cpp >index 7663675dec79117105f918523a19744ec3f3d721..a34241a5700b9a8ed928bc1639c9cb413f734918 100644 >--- a/Source/WebCore/layout/layouttree/LayoutBox.cpp >+++ b/Source/WebCore/layout/layouttree/LayoutBox.cpp >@@ -36,8 +36,9 @@ namespace Layout { > > WTF_MAKE_ISO_ALLOCATED_IMPL(Box); > >-Box::Box(RenderStyle&& style) >+Box::Box(RenderStyle&& style, BaseTypeFlags baseTypeFlags) > : m_style(WTFMove(style)) >+ , m_baseTypeFlags(baseTypeFlags) > { > } > >diff --git a/Source/WebCore/layout/layouttree/LayoutBox.h b/Source/WebCore/layout/layouttree/LayoutBox.h >index 2324fc8cf89dea692c1a7b560f79ae7aa1764abd..1acd90db569d2ad60974debeec2d3ef36a137486 100644 >--- a/Source/WebCore/layout/layouttree/LayoutBox.h >+++ b/Source/WebCore/layout/layouttree/LayoutBox.h >@@ -42,8 +42,9 @@ class Box { > WTF_MAKE_ISO_ALLOCATED(Box); > public: > friend class TreeBuilder; >+ typedef unsigned BaseTypeFlags; > >- Box(RenderStyle&&); >+ Box(RenderStyle&&, BaseTypeFlags); > virtual ~Box(); > > bool establishesFormattingContext() const; >@@ -81,9 +82,21 @@ public: > const Box* previousInFlowSibling() const; > const Box* previousInFlowOrFloatingSibling() const; > >+ bool isContainer() const { return m_baseTypeFlags & ContainerFlag; } >+ bool isBlockContainer() const { return m_baseTypeFlags & BlockContainerFlag; } >+ bool isInlineBox() const { return m_baseTypeFlags & InlineBoxFlag; } >+ bool isInlineContainer() const { return m_baseTypeFlags & InlineContainerFlag; } >+ > auto& weakPtrFactory() const { return m_weakFactory; } > > protected: >+ enum BaseTypeFlag { >+ ContainerFlag = 1 << 0, >+ BlockContainerFlag = 1 << 1, >+ InlineBoxFlag = 1 << 2, >+ InlineContainerFlag = 1 << 3 >+ }; >+ > bool isOverflowVisible() const; > > private: >@@ -100,8 +113,16 @@ private: > Box* m_nextSibling { nullptr }; > > bool m_isAnonymous { false }; >+ >+ unsigned m_baseTypeFlags : 3; > }; > > } > } >+ >+#define SPECIALIZE_TYPE_TRAITS_LAYOUT_BOX(ToValueTypeName, predicate) \ >+SPECIALIZE_TYPE_TRAITS_BEGIN(WebCore::Layout::ToValueTypeName) \ >+ static bool isType(const WebCore::Layout::Box& box) { return box.predicate; } \ >+SPECIALIZE_TYPE_TRAITS_END() >+ > #endif >diff --git a/Source/WebCore/layout/layouttree/LayoutContainer.cpp b/Source/WebCore/layout/layouttree/LayoutContainer.cpp >index 76067dca65ed5ae210fa6b22e963842c91b071e3..5363da3996aadf55d6ab606cddccfae49f69615c 100644 >--- a/Source/WebCore/layout/layouttree/LayoutContainer.cpp >+++ b/Source/WebCore/layout/layouttree/LayoutContainer.cpp >@@ -36,8 +36,8 @@ namespace Layout { > > WTF_MAKE_ISO_ALLOCATED_IMPL(Container); > >-Container::Container(RenderStyle&& style) >- : Box(WTFMove(style)) >+Container::Container(RenderStyle&& style, BaseTypeFlags baseTypeFlags) >+ : Box(WTFMove(style), baseTypeFlags | ContainerFlag) > { > } > >diff --git a/Source/WebCore/layout/layouttree/LayoutContainer.h b/Source/WebCore/layout/layouttree/LayoutContainer.h >index bb9df4a5e30ce707a58675eae065c818d8ba3b88..dacd6b4e70bb172e80642a1346e56bfdeb710597 100644 >--- a/Source/WebCore/layout/layouttree/LayoutContainer.h >+++ b/Source/WebCore/layout/layouttree/LayoutContainer.h >@@ -42,7 +42,7 @@ class Container : public Box { > public: > friend class TreeBuilder; > >- Container(RenderStyle&&); >+ Container(RenderStyle&&, BaseTypeFlags); > > const Box* firstChild() const { return m_firstChild; } > const Box* firstInFlowChild() const; >@@ -69,4 +69,7 @@ private: > > } > } >+ >+SPECIALIZE_TYPE_TRAITS_LAYOUT_BOX(Container, isContainer()) >+ > #endif >diff --git a/Source/WebCore/layout/layouttree/LayoutInlineBox.cpp b/Source/WebCore/layout/layouttree/LayoutInlineBox.cpp >index 37550b51f7f4eafd6c74855d05fc29e40e433560..8e5390badffd942348e81bba384cf3dd51b3e788 100644 >--- a/Source/WebCore/layout/layouttree/LayoutInlineBox.cpp >+++ b/Source/WebCore/layout/layouttree/LayoutInlineBox.cpp >@@ -25,3 +25,23 @@ > > #include "config.h" > #include "LayoutInlineBox.h" >+ >+#if ENABLE(LAYOUT_FORMATTING_CONTEXT) >+ >+#include "RenderStyle.h" >+#include <wtf/IsoMallocInlines.h> >+ >+namespace WebCore { >+namespace Layout { >+ >+WTF_MAKE_ISO_ALLOCATED_IMPL(InlineBox); >+ >+InlineBox::InlineBox(RenderStyle&& style, BaseTypeFlags baseTypeFlags) >+ : Box(WTFMove(style), baseTypeFlags | InlineBoxFlag) >+{ >+} >+ >+} >+} >+ >+#endif >diff --git a/Source/WebCore/layout/layouttree/LayoutInlineBox.h b/Source/WebCore/layout/layouttree/LayoutInlineBox.h >index 888dcfa80cceee56fe55b6f4b54f8b94061155d5..d06d096824e898ed30ad8e281dc6711bc1cc59e9 100644 >--- a/Source/WebCore/layout/layouttree/LayoutInlineBox.h >+++ b/Source/WebCore/layout/layouttree/LayoutInlineBox.h >@@ -39,9 +39,12 @@ namespace Layout { > class InlineBox : public Box { > WTF_MAKE_ISO_ALLOCATED(InlineBox); > public: >- InlineBox(RenderStyle&&); >+ InlineBox(RenderStyle&&, BaseTypeFlags); > }; > > } > } >+ >+SPECIALIZE_TYPE_TRAITS_LAYOUT_BOX(InlineBox, isInlineBox()) >+ > #endif >diff --git a/Source/WebCore/layout/layouttree/LayoutInlineContainer.cpp b/Source/WebCore/layout/layouttree/LayoutInlineContainer.cpp >index 5c7f624818adc271d3351c03a31b9f0a644fdbcd..47151dbd722e30ed62bf0d65351f9d31ed9e4308 100644 >--- a/Source/WebCore/layout/layouttree/LayoutInlineContainer.cpp >+++ b/Source/WebCore/layout/layouttree/LayoutInlineContainer.cpp >@@ -25,3 +25,23 @@ > > #include "config.h" > #include "LayoutInlineContainer.h" >+ >+#if ENABLE(LAYOUT_FORMATTING_CONTEXT) >+ >+#include "RenderStyle.h" >+#include <wtf/IsoMallocInlines.h> >+ >+namespace WebCore { >+namespace Layout { >+ >+WTF_MAKE_ISO_ALLOCATED_IMPL(InlineContainer); >+ >+InlineContainer::InlineContainer(RenderStyle&& style, BaseTypeFlags baseTypeFlags) >+ : Container(WTFMove(style), baseTypeFlags | InlineContainerFlag) >+{ >+} >+ >+} >+} >+ >+#endif >diff --git a/Source/WebCore/layout/layouttree/LayoutInlineContainer.h b/Source/WebCore/layout/layouttree/LayoutInlineContainer.h >index e0ab052020b645d32001468b2f193e2a5402736d..a93a690778687f2bd5b59bf85b2517b44508c964 100644 >--- a/Source/WebCore/layout/layouttree/LayoutInlineContainer.h >+++ b/Source/WebCore/layout/layouttree/LayoutInlineContainer.h >@@ -39,9 +39,12 @@ namespace Layout { > class InlineContainer : public Container { > WTF_MAKE_ISO_ALLOCATED(InlineContainer); > public: >- InlineContainer(RenderStyle&&); >+ InlineContainer(RenderStyle&&, BaseTypeFlags); > }; > > } > } >+ >+SPECIALIZE_TYPE_TRAITS_LAYOUT_BOX(InlineContainer, isInlineContainer()) >+ > #endif
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 185016
: 338828