[LFC] Adapt to the new const WeakPtr<>
authorzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 6 Sep 2018 13:40:56 +0000 (13:40 +0000)
committerzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 6 Sep 2018 13:40:56 +0000 (13:40 +0000)
https://bugs.webkit.org/show_bug.cgi?id=189334

Reviewed by Antti Koivisto.

* layout/FormattingContext.cpp:
(WebCore::Layout::FormattingContext::FormattingContext):
* layout/FormattingContext.h:
* layout/LayoutContext.cpp:
(WebCore::Layout::LayoutContext::initializeRoot):
* layout/LayoutContext.h:
* layout/floats/FloatAvoider.cpp:
(WebCore::Layout::FloatAvoider::FloatAvoider):
* layout/floats/FloatAvoider.h:
* layout/floats/FloatingState.cpp:
(WebCore::Layout::FloatingState::FloatItem::FloatItem):
(WebCore::Layout::FloatingState::FloatingState):
* layout/floats/FloatingState.h:
* layout/layouttree/LayoutContainer.cpp:
(WebCore::Layout::Container::addOutOfFlowDescendant):
* layout/layouttree/LayoutContainer.h:
(WebCore::Layout::Container::outOfFlowDescendants const):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@235735 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/layout/FormattingContext.cpp
Source/WebCore/layout/FormattingContext.h
Source/WebCore/layout/LayoutContext.cpp
Source/WebCore/layout/LayoutContext.h
Source/WebCore/layout/floats/FloatAvoider.cpp
Source/WebCore/layout/floats/FloatAvoider.h
Source/WebCore/layout/floats/FloatingState.cpp
Source/WebCore/layout/floats/FloatingState.h
Source/WebCore/layout/layouttree/LayoutContainer.cpp
Source/WebCore/layout/layouttree/LayoutContainer.h

index bc3b188..6b1b3fb 100644 (file)
@@ -1,3 +1,28 @@
+2018-09-05  Zalan Bujtas  <zalan@apple.com>
+
+        [LFC] Adapt to the new const WeakPtr<>
+        https://bugs.webkit.org/show_bug.cgi?id=189334
+
+        Reviewed by Antti Koivisto.
+
+        * layout/FormattingContext.cpp:
+        (WebCore::Layout::FormattingContext::FormattingContext):
+        * layout/FormattingContext.h:
+        * layout/LayoutContext.cpp:
+        (WebCore::Layout::LayoutContext::initializeRoot):
+        * layout/LayoutContext.h:
+        * layout/floats/FloatAvoider.cpp:
+        (WebCore::Layout::FloatAvoider::FloatAvoider):
+        * layout/floats/FloatAvoider.h:
+        * layout/floats/FloatingState.cpp:
+        (WebCore::Layout::FloatingState::FloatItem::FloatItem):
+        (WebCore::Layout::FloatingState::FloatingState):
+        * layout/floats/FloatingState.h:
+        * layout/layouttree/LayoutContainer.cpp:
+        (WebCore::Layout::Container::addOutOfFlowDescendant):
+        * layout/layouttree/LayoutContainer.h:
+        (WebCore::Layout::Container::outOfFlowDescendants const):
+
 2018-09-06  Xabier Rodriguez Calvar  <calvaris@igalia.com>
 
         [GStreamer] Extra ASSERTs at MainThreadNotifier
index 32c2d06..9529b31 100644 (file)
@@ -43,7 +43,7 @@ namespace Layout {
 WTF_MAKE_ISO_ALLOCATED_IMPL(FormattingContext);
 
 FormattingContext::FormattingContext(const Box& formattingContextRoot)
-    : m_root(makeWeakPtr(const_cast<Box&>(formattingContextRoot)))
+    : m_root(makeWeakPtr(formattingContextRoot))
 {
 }
 
index e85bf2f..0292830 100644 (file)
@@ -122,7 +122,7 @@ private:
     void computeOutOfFlowVerticalGeometry(const LayoutContext&, const Box&) const;
     void computeOutOfFlowHorizontalGeometry(LayoutContext&, const Box&) const;
 
-    WeakPtr<Box> m_root;
+    WeakPtr<const Box> m_root;
 };
 
 }
index fe6785e..33d103d 100644 (file)
@@ -53,7 +53,7 @@ void LayoutContext::initializeRoot(const Container& root, const LayoutSize& cont
 {
     ASSERT(root.establishesFormattingContext());
 
-    m_root = makeWeakPtr(const_cast<Container&>(root));
+    m_root = makeWeakPtr(root);
     auto& displayBox = displayBoxForLayoutBox(root);
 
     // FIXME: m_root could very well be a formatting context root with ancestors and resolvable border and padding (as opposed to the topmost root)
index cadf61f..e6f8f3b 100644 (file)
@@ -90,7 +90,7 @@ public:
 private:
     void layoutFormattingContextSubtree(const Box&);
 
-    WeakPtr<Container> m_root;
+    WeakPtr<const Container> m_root;
     HashSet<const Container*> m_formattingContextRootListForLayout;
     HashMap<const Box*, std::unique_ptr<FormattingState>> m_formattingStates;
     mutable HashMap<const Box*, std::unique_ptr<Display::Box>> m_layoutToDisplayBox;
index f07f40b..4d32e9e 100644 (file)
@@ -39,7 +39,7 @@ namespace Layout {
 WTF_MAKE_ISO_ALLOCATED_IMPL(FloatAvoider);
 
 FloatAvoider::FloatAvoider(const Box& layoutBox, const FloatingState& floatingState, const LayoutContext& layoutContext)
-    : m_layoutBox(makeWeakPtr(const_cast<Box&>(layoutBox)))
+    : m_layoutBox(makeWeakPtr(layoutBox))
     , m_floatingState(floatingState)
     , m_absoluteDisplayBox(FormattingContext::mapBoxToAncestor(layoutContext, layoutBox, downcast<Container>(floatingState.root())))
     , m_containingBlockAbsoluteDisplayBox(FormattingContext::mapBoxToAncestor(layoutContext, *layoutBox.containingBlock(), downcast<Container>(floatingState.root())))
index dcfb173..a58eea2 100644 (file)
@@ -82,7 +82,7 @@ protected:
     const Display::Box& displayBox() const { return m_absoluteDisplayBox; }
 
 private:
-    WeakPtr<Box> m_layoutBox;
+    WeakPtr<const Box> m_layoutBox;
     const FloatingState& m_floatingState;
     Display::Box m_absoluteDisplayBox;
     Display::Box m_containingBlockAbsoluteDisplayBox;
index 5b17cfb..fd2ee79 100644 (file)
@@ -40,14 +40,14 @@ namespace Layout {
 WTF_MAKE_ISO_ALLOCATED_IMPL(FloatingState);
 
 FloatingState::FloatItem::FloatItem(const Box& layoutBox, const FloatingState& floatingState)
-    : m_layoutBox(makeWeakPtr(const_cast<Box&>(layoutBox)))
+    : m_layoutBox(makeWeakPtr(layoutBox))
     , m_absoluteDisplayBox(FormattingContext::mapBoxToAncestor(floatingState.layoutContext(), layoutBox, downcast<Container>(floatingState.root())))
 {
 }
 
 FloatingState::FloatingState(LayoutContext& layoutContext, const Box& formattingContextRoot)
     : m_layoutContext(layoutContext)
-    , m_formattingContextRoot(makeWeakPtr(const_cast<Box&>(formattingContextRoot)))
+    , m_formattingContextRoot(makeWeakPtr(formattingContextRoot))
 {
 }
 
index 6eb8de4..7f32c56 100644 (file)
@@ -71,7 +71,7 @@ public:
         PositionInContextRoot bottom() const { return m_absoluteDisplayBox.bottom(); }
 
     private:
-        WeakPtr<Box> m_layoutBox;
+        WeakPtr<const Box> m_layoutBox;
         Display::Box m_absoluteDisplayBox;
     };
     using FloatList = Vector<FloatItem>;
@@ -87,7 +87,7 @@ private:
     std::optional<LayoutUnit> bottom(const Box& formattingContextRoot, Clear) const;
 
     LayoutContext& m_layoutContext;
-    WeakPtr<Box> m_formattingContextRoot;
+    WeakPtr<const Box> m_formattingContextRoot;
     FloatList m_floats;
 };
 
index b973a99..252fc8e 100644 (file)
@@ -96,7 +96,7 @@ void Container::addOutOfFlowDescendant(const Box& outOfFlowBox)
     // Since we layout the out-of-flow boxes at the end of the formatting context layout,
     // it's okay to store them at the formatting context root level -as opposed to the containing block level.
     ASSERT(establishesFormattingContext());
-    m_outOfFlowDescendants.append(makeWeakPtr(const_cast<Box&>(outOfFlowBox)));
+    m_outOfFlowDescendants.append(makeWeakPtr(outOfFlowBox));
 }
 
 }
index 000bd4c..d6ce22b 100644 (file)
@@ -53,7 +53,7 @@ public:
     bool hasInFlowChild() const { return firstInFlowChild(); }
     bool hasInFlowOrFloatingChild() const { return firstInFlowOrFloatingChild(); }
 
-    const Vector<WeakPtr<Box>>& outOfFlowDescendants() const { return m_outOfFlowDescendants; }
+    const Vector<WeakPtr<const Box>>& outOfFlowDescendants() const { return m_outOfFlowDescendants; }
 
 protected:
     Container(std::optional<ElementAttributes>, RenderStyle&&, BaseTypeFlags);
@@ -65,7 +65,7 @@ private:
 
     Box* m_firstChild { nullptr };
     Box* m_lastChild { nullptr };
-    Vector<WeakPtr<Box>> m_outOfFlowDescendants;
+    Vector<WeakPtr<const Box>> m_outOfFlowDescendants;
 };
 
 }