Title: [231013] trunk/Source/WebCore
- Revision
- 231013
- Author
- [email protected]
- Date
- 2018-04-25 13:09:37 -0700 (Wed, 25 Apr 2018)
Log Message
[LFC] Implement Layout::Container functions.
https://bugs.webkit.org/show_bug.cgi?id=184988
Reviewed by Antti Koivisto.
* layout/layouttree/LayoutContainer.cpp:
(WebCore::Layout::Container::Container):
(WebCore::Layout::Container::firstInFlowChild const):
(WebCore::Layout::Container::firstInFlowOrFloatingChild const):
(WebCore::Layout::Container::lastInFlowChild const):
(WebCore::Layout::Container::lastInFlowOrFloatingChild const):
(WebCore::Layout::Container::setFirstChild):
(WebCore::Layout::Container::setLastChild):
(WebCore::Layout::Container::setOutOfFlowDescendants):
* layout/layouttree/LayoutContainer.h:
(WebCore::Layout::Container::firstChild const):
(WebCore::Layout::Container::lastChild const):
(WebCore::Layout::Container::hasChild const):
(WebCore::Layout::Container::hasInFlowChild const):
(WebCore::Layout::Container::hasInFlowOrFloatingChild const):
(WebCore::Layout::Container::outOfFlowDescendants):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (231012 => 231013)
--- trunk/Source/WebCore/ChangeLog 2018-04-25 19:58:53 UTC (rev 231012)
+++ trunk/Source/WebCore/ChangeLog 2018-04-25 20:09:37 UTC (rev 231013)
@@ -1,3 +1,27 @@
+2018-04-25 Zalan Bujtas <[email protected]>
+
+ [LFC] Implement Layout::Container functions.
+ https://bugs.webkit.org/show_bug.cgi?id=184988
+
+ Reviewed by Antti Koivisto.
+
+ * layout/layouttree/LayoutContainer.cpp:
+ (WebCore::Layout::Container::Container):
+ (WebCore::Layout::Container::firstInFlowChild const):
+ (WebCore::Layout::Container::firstInFlowOrFloatingChild const):
+ (WebCore::Layout::Container::lastInFlowChild const):
+ (WebCore::Layout::Container::lastInFlowOrFloatingChild const):
+ (WebCore::Layout::Container::setFirstChild):
+ (WebCore::Layout::Container::setLastChild):
+ (WebCore::Layout::Container::setOutOfFlowDescendants):
+ * layout/layouttree/LayoutContainer.h:
+ (WebCore::Layout::Container::firstChild const):
+ (WebCore::Layout::Container::lastChild const):
+ (WebCore::Layout::Container::hasChild const):
+ (WebCore::Layout::Container::hasInFlowChild const):
+ (WebCore::Layout::Container::hasInFlowOrFloatingChild const):
+ (WebCore::Layout::Container::outOfFlowDescendants):
+
2018-04-25 Brent Fulgham <[email protected]>
Don't Block First Party Cookies on Redirects
Modified: trunk/Source/WebCore/layout/layouttree/LayoutContainer.cpp (231012 => 231013)
--- trunk/Source/WebCore/layout/layouttree/LayoutContainer.cpp 2018-04-25 19:58:53 UTC (rev 231012)
+++ trunk/Source/WebCore/layout/layouttree/LayoutContainer.cpp 2018-04-25 20:09:37 UTC (rev 231013)
@@ -25,3 +25,77 @@
#include "config.h"
#include "LayoutContainer.h"
+
+#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
+
+#include "RenderStyle.h"
+#include <wtf/IsoMallocInlines.h>
+
+namespace WebCore {
+namespace Layout {
+
+WTF_MAKE_ISO_ALLOCATED_IMPL(Container);
+
+Container::Container(RenderStyle&& style)
+ : Box(WTFMove(style))
+{
+}
+
+const Box* Container::firstInFlowChild() const
+{
+ if (auto* firstChild = this->firstChild()) {
+ if (firstChild->isInFlow())
+ return firstChild;
+ return firstChild->nextInFlowSibling();
+ }
+ return nullptr;
+}
+
+const Box* Container::firstInFlowOrFloatingChild() const
+{
+ if (auto* firstChild = this->firstChild()) {
+ if (firstChild->isInFlow() || firstChild->isFloatingPositioned())
+ return firstChild;
+ return firstChild->nextInFlowOrFloatingSibling();
+ }
+ return nullptr;
+}
+
+const Box* Container::lastInFlowChild() const
+{
+ if (auto* lastChild = this->lastChild()) {
+ if (lastChild->isInFlow())
+ return lastChild;
+ return lastChild->previousInFlowSibling();
+ }
+ return nullptr;
+}
+
+const Box* Container::lastInFlowOrFloatingChild() const
+{
+ if (auto* lastChild = this->lastChild()) {
+ if (lastChild->isInFlow() || lastChild->isFloatingPositioned())
+ return lastChild;
+ return lastChild->previousInFlowOrFloatingSibling();
+ }
+ return nullptr;
+}
+
+void Container::setFirstChild(Box& childBox)
+{
+ m_firstChild = &childBox;
+}
+
+void Container::setLastChild(Box& childBox)
+{
+ m_lastChild = &childBox;
+}
+
+void Container::setOutOfFlowDescendants(Vector<WeakPtr<Box>>&& descendantList)
+{
+ m_outOfFlowDescendants = WTFMove(descendantList);
+}
+
+}
+}
+#endif
Modified: trunk/Source/WebCore/layout/layouttree/LayoutContainer.h (231012 => 231013)
--- trunk/Source/WebCore/layout/layouttree/LayoutContainer.h 2018-04-25 19:58:53 UTC (rev 231012)
+++ trunk/Source/WebCore/layout/layouttree/LayoutContainer.h 2018-04-25 20:09:37 UTC (rev 231013)
@@ -29,6 +29,7 @@
#include "LayoutBox.h"
#include <wtf/IsoMalloc.h>
+#include <wtf/WeakPtr.h>
namespace WebCore {
@@ -39,23 +40,31 @@
class Container : public Box {
WTF_MAKE_ISO_ALLOCATED(Container);
public:
+ friend class TreeBuilder;
+
Container(RenderStyle&&);
- void setFirstChild(Layout::Box&);
- void setLastChild(Layout::Box&);
+ const Box* firstChild() const { return m_firstChild; }
+ const Box* firstInFlowChild() const;
+ const Box* firstInFlowOrFloatingChild() const;
+ const Box* lastChild() const { return m_lastChild; }
+ const Box* lastInFlowChild() const;
+ const Box* lastInFlowOrFloatingChild() const;
- Box* firstChild() const;
- Box* firstInFlowChild() const;
- Box* firstInFlowOrFloatingChild() const;
- Box* lastChild() const;
- Box* lastInFlowChild() const;
- Box* lastInFlowOrFloatingChild() const;
+ bool hasChild() const { return firstChild(); }
+ bool hasInFlowChild() const { return firstInFlowChild(); }
+ bool hasInFlowOrFloatingChild() const { return firstInFlowOrFloatingChild(); }
- bool hasChild() const;
- bool hasInFlowChild() const;
- bool hasInFlowOrFloatingChild() const;
+ const Vector<WeakPtr<Box>>& outOfFlowDescendants() { return m_outOfFlowDescendants; }
- Vector<Box&> outOfFlowDescendants() const;
+private:
+ void setFirstChild(Box&);
+ void setLastChild(Box&);
+ void setOutOfFlowDescendants(Vector<WeakPtr<Box>>&&);
+
+ Box* m_firstChild { nullptr };
+ Box* m_lastChild { nullptr };
+ Vector<WeakPtr<Box>> m_outOfFlowDescendants;
};
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes