[LFC] Remove unused LayoutAncestorIterator class
authorzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 23 Mar 2020 15:25:39 +0000 (15:25 +0000)
committerzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 23 Mar 2020 15:25:39 +0000 (15:25 +0000)
https://bugs.webkit.org/show_bug.cgi?id=209401
<rdar://problem/60743144>

Reviewed by Sam Weinig.

* WebCore.xcodeproj/project.pbxproj:
* layout/blockformatting/BlockFormattingContextGeometry.cpp:
* layout/displaytree/DisplayPainter.cpp:
* layout/layouttree/LayoutAncestorIterator.h: Removed.
* layout/layouttree/LayoutChildIterator.h:
(WebCore::Layout::LayoutChildIteratorAdapter<T>::last const): Deleted.
* layout/layouttree/LayoutIterator.h:
(WebCore::Layout::LayoutBoxTraversal::nextSkippingChildren): Deleted.
(WebCore::Layout::Traversal::lastChild): Deleted.
(WebCore::Layout::Traversal::previousSibling): Deleted.
(WebCore::Layout::Traversal::findAncestorOfType): Deleted.
(WebCore::Layout::LayoutIterator<T>::traversePreviousSibling): Deleted.
(WebCore::Layout::LayoutIterator<T>::traverseAncestor): Deleted.
* layout/layouttree/LayoutTreeBuilder.cpp:

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

Source/WebCore/ChangeLog
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp
Source/WebCore/layout/displaytree/DisplayPainter.cpp
Source/WebCore/layout/layouttree/LayoutAncestorIterator.h [deleted file]
Source/WebCore/layout/layouttree/LayoutChildIterator.h
Source/WebCore/layout/layouttree/LayoutIterator.h
Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp

index 31d4ad5..3d60041 100644 (file)
@@ -1,3 +1,26 @@
+2020-03-23  Zalan Bujtas  <zalan@apple.com>
+
+        [LFC] Remove unused LayoutAncestorIterator class
+        https://bugs.webkit.org/show_bug.cgi?id=209401
+        <rdar://problem/60743144>
+
+        Reviewed by Sam Weinig.
+
+        * WebCore.xcodeproj/project.pbxproj:
+        * layout/blockformatting/BlockFormattingContextGeometry.cpp:
+        * layout/displaytree/DisplayPainter.cpp:
+        * layout/layouttree/LayoutAncestorIterator.h: Removed.
+        * layout/layouttree/LayoutChildIterator.h:
+        (WebCore::Layout::LayoutChildIteratorAdapter<T>::last const): Deleted.
+        * layout/layouttree/LayoutIterator.h:
+        (WebCore::Layout::LayoutBoxTraversal::nextSkippingChildren): Deleted.
+        (WebCore::Layout::Traversal::lastChild): Deleted.
+        (WebCore::Layout::Traversal::previousSibling): Deleted.
+        (WebCore::Layout::Traversal::findAncestorOfType): Deleted.
+        (WebCore::Layout::LayoutIterator<T>::traversePreviousSibling): Deleted.
+        (WebCore::Layout::LayoutIterator<T>::traverseAncestor): Deleted.
+        * layout/layouttree/LayoutTreeBuilder.cpp:
+
 2020-03-23  Antoine Quint  <graouts@apple.com>
 
         [Web Animations] Refactor cancelDeclarativeAnimationsForElement and willDestroyRendererForElement on AnimationTimeline
index 4894de5..f5e2f69 100644 (file)
                11310CF420BA4A3D0065A8D0 /* LayoutIterator.h in Headers */ = {isa = PBXBuildFile; fileRef = 11100FC72092764C0081AA6C /* LayoutIterator.h */; settings = {ATTRIBUTES = (Private, ); }; };
                11310CF520BA4A4C0065A8D0 /* LayoutDescendantIterator.h in Headers */ = {isa = PBXBuildFile; fileRef = 11B042FB20B0E21400828A6B /* LayoutDescendantIterator.h */; settings = {ATTRIBUTES = (Private, ); }; };
                11310CF620BA4A560065A8D0 /* LayoutChildIterator.h in Headers */ = {isa = PBXBuildFile; fileRef = 11100FC920927CBC0081AA6C /* LayoutChildIterator.h */; settings = {ATTRIBUTES = (Private, ); }; };
-               11310CF720BA4A620065A8D0 /* LayoutAncestorIterator.h in Headers */ = {isa = PBXBuildFile; fileRef = 11100FCA2092868D0081AA6C /* LayoutAncestorIterator.h */; settings = {ATTRIBUTES = (Private, ); }; };
                113409DA203E038000C66915 /* RenderTreeBuilderContinuation.h in Headers */ = {isa = PBXBuildFile; fileRef = 113409D8203E038000C66915 /* RenderTreeBuilderContinuation.h */; };
                113D0B521F9FDD2B00F611BB /* FrameViewLayoutContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 113D0B501F9FDD2B00F611BB /* FrameViewLayoutContext.h */; settings = {ATTRIBUTES = (Private, ); }; };
                115CFA6A208AF7D0001E6991 /* FormattingContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 115CFA68208AF7D0001E6991 /* FormattingContext.h */; settings = {ATTRIBUTES = (Private, ); }; };
                1100FC6E1FDB3C4D00DD961B /* TrailingFloatsRootInlineBox.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = TrailingFloatsRootInlineBox.cpp; sourceTree = "<group>"; };
                11100FC72092764C0081AA6C /* LayoutIterator.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LayoutIterator.h; sourceTree = "<group>"; };
                11100FC920927CBC0081AA6C /* LayoutChildIterator.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LayoutChildIterator.h; sourceTree = "<group>"; };
-               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 /* LayoutReplacedBox.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LayoutReplacedBox.h; sourceTree = "<group>"; };
                115CFA90208B9441001E6991 /* layouttree */ = {
                        isa = PBXGroup;
                        children = (
-                               11100FCA2092868D0081AA6C /* LayoutAncestorIterator.h */,
                                115CFA96208B952B001E6991 /* LayoutBox.cpp */,
                                115CFA95208B952B001E6991 /* LayoutBox.h */,
                                11100FC920927CBC0081AA6C /* LayoutChildIterator.h */,
                                0FEC120C22BF2CD2004E9D35 /* LayerAncestorClippingStack.h in Headers */,
                                580371641A66F1D300BAF519 /* LayerFragment.h in Headers */,
                                7AA3A6A0194B59B6001CBD24 /* LayerPool.h in Headers */,
-                               11310CF720BA4A620065A8D0 /* LayoutAncestorIterator.h in Headers */,
                                115CFA97208B952B001E6991 /* LayoutBox.h in Headers */,
                                11310CF620BA4A560065A8D0 /* LayoutChildIterator.h in Headers */,
                                1199FA46208E35A3002358CC /* LayoutContainerBox.h in Headers */,
index 03d40cc..ca068dc 100644 (file)
@@ -32,7 +32,6 @@
 #include "DisplayBox.h"
 #include "FormattingContext.h"
 #include "InlineFormattingState.h"
-#include "LayoutChildIterator.h"
 #include "LayoutContext.h"
 #include "LayoutReplacedBox.h"
 #include "Logging.h"
index e443021..51b0e5b 100644 (file)
@@ -36,7 +36,6 @@
 #include "InlineTextItem.h"
 #include "IntRect.h"
 #include "LayoutContainerBox.h"
-#include "LayoutDescendantIterator.h"
 #include "LayoutState.h"
 #include "RenderStyle.h"
 #include "TextRun.h"
diff --git a/Source/WebCore/layout/layouttree/LayoutAncestorIterator.h b/Source/WebCore/layout/layouttree/LayoutAncestorIterator.h
deleted file mode 100644 (file)
index 9bdd275..0000000
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Copyright (C) 2018 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#pragma once
-
-#include "LayoutIterator.h"
-
-#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
-
-namespace WebCore {
-namespace Layout {
-
-template <typename T>
-class LayoutAncestorIterator : public LayoutIterator<T> {
-public:
-    LayoutAncestorIterator();
-    explicit LayoutAncestorIterator(const T* current);
-    LayoutAncestorIterator& operator++();
-};
-
-template <typename T>
-class LayoutAncestorIteratorAdapter {
-public:
-    LayoutAncestorIteratorAdapter(const T* first);
-    LayoutAncestorIterator<T> begin() const;
-    LayoutAncestorIterator<T> end() const;
-    const T* first() const;
-
-private:
-    const T* m_first;
-};
-
-template <typename T> LayoutAncestorIteratorAdapter<T> ancestorsOfType(const Box&);
-template <typename T> LayoutAncestorIteratorAdapter<T> lineageOfType(const Box&);
-
-// LayoutAncestorIterator
-
-template <typename T>
-inline LayoutAncestorIterator<T>::LayoutAncestorIterator()
-    : LayoutIterator<T>(nullptr)
-{
-}
-
-template <typename T>
-inline LayoutAncestorIterator<T>::LayoutAncestorIterator(const T* current)
-    : LayoutIterator<T>(nullptr, current)
-{
-}
-
-template <typename T>
-inline LayoutAncestorIterator<T>& LayoutAncestorIterator<T>::operator++()
-{
-    return static_cast<LayoutAncestorIterator<T>&>(LayoutIterator<T>::traverseAncestor());
-}
-
-// LayoutAncestorIteratorAdapter
-
-template <typename T>
-inline LayoutAncestorIteratorAdapter<T>::LayoutAncestorIteratorAdapter(const T* first)
-    : m_first(first)
-{
-}
-
-template <typename T>
-inline LayoutAncestorIterator<T> LayoutAncestorIteratorAdapter<T>::begin() const
-{
-    return LayoutAncestorIterator<T>(m_first);
-}
-
-template <typename T>
-inline LayoutAncestorIterator<T> LayoutAncestorIteratorAdapter<T>::end() const
-{
-    return LayoutAncestorIterator<T>();
-}
-
-template <typename T>
-inline const T* LayoutAncestorIteratorAdapter<T>::first() const
-{
-    return m_first;
-}
-
-// Standalone functions
-
-template <typename T>
-inline LayoutAncestorIteratorAdapter<T> ancestorsOfType(const Box& descendant)
-{
-    const T* first = Traversal::findAncestorOfType<const T>(descendant);
-    return LayoutAncestorIteratorAdapter<T>(first);
-}
-
-template <typename T>
-inline LayoutAncestorIteratorAdapter<T> lineageOfType(const Box& first)
-{
-    if (isLayoutBoxOfType<T>(first))
-        return LayoutAncestorIteratorAdapter<T>(static_cast<const T*>(&first));
-    return ancestorsOfType<T>(first);
-}
-
-}
-}
-#endif
index 7d6e4cf..ca6d9bb 100644 (file)
@@ -102,12 +102,6 @@ inline const T* LayoutChildIteratorAdapter<T>::first() const
 }
 
 template <typename T>
-inline const T* LayoutChildIteratorAdapter<T>::last() const
-{
-    return Traversal::lastChild<T>(m_parent);
-}
-
-template <typename T>
 inline LayoutChildIteratorAdapter<T> childrenOfType(const ContainerBox& parent)
 {
     return LayoutChildIteratorAdapter<T>(parent);
index d1bd98b..cb0fcf4 100644 (file)
@@ -44,8 +44,6 @@ public:
 
     LayoutIterator& traverseNext();
     LayoutIterator& traverseNextSibling();
-    LayoutIterator& traversePreviousSibling();
-    LayoutIterator& traverseAncestor();
 
 private:
     const ContainerBox* m_root;
@@ -97,17 +95,6 @@ inline const Box* next(const U& current, const ContainerBox* stayWithin)
     return nextAncestorSibling(current, stayWithin);
 }
 
-inline const Box* nextSkippingChildren(Box& current, const ContainerBox* stayWithin)
-{
-    if (&current == stayWithin)
-        return nullptr;
-
-    if (auto* sibling = current.nextSibling())
-        return sibling;
-
-    return nextAncestorSibling(current, stayWithin);
-}
-
 }
 // Traversal helpers
 namespace Traversal {
@@ -121,15 +108,6 @@ inline const T* firstChild(U& current)
     return static_cast<const T*>(object);
 }
 
-template <typename T, typename U>
-inline const T* lastChild(U& current)
-{
-    auto* object = current.lastChild();
-    while (object && !isLayoutBoxOfType<T>(*object))
-        object = object->previousSibling();
-    return static_cast<const T*>(object);
-}
-
 template <typename T>
 inline const T* nextSibling(const T& current)
 {
@@ -140,25 +118,6 @@ inline const T* nextSibling(const T& current)
 }
 
 template <typename T, typename U>
-inline const T* previousSibling(const T& current)
-{
-    auto* object = current.previousSibling();
-    while (object && !isLayoutBoxOfType<T>(*object))
-        object = object->previousSibling();
-    return static_cast<const T*>(object);
-}
-
-template <typename T, typename U>
-inline const T* findAncestorOfType(const T& current)
-{
-    for (auto* ancestor = current.parent(); ancestor; ancestor = ancestor->parent()) {
-        if (isLayoutBoxOfType<T>(*ancestor))
-            return static_cast<const T*>(ancestor);
-    }
-    return nullptr;
-}
-
-template <typename T, typename U>
 inline const T* firstWithin(const U& stayWithin)
 {
     auto* descendant = LayoutBoxTraversal::firstChild(stayWithin);
@@ -211,23 +170,6 @@ inline LayoutIterator<T>& LayoutIterator<T>::traverseNext()
 }
 
 template <typename T>
-inline LayoutIterator<T>& LayoutIterator<T>::traversePreviousSibling()
-{
-    ASSERT(m_current);
-    m_current = Traversal::previousSibling<T>(*m_current);
-    return *this;
-}
-
-template <typename T>
-inline LayoutIterator<T>& LayoutIterator<T>::traverseAncestor()
-{
-    ASSERT(m_current);
-    ASSERT(m_current != m_root);
-    m_current = Traversal::findAncestorOfType<T>(*m_current);
-    return *this;
-}
-
-template <typename T>
 inline const T& LayoutIterator<T>::operator*() const
 {
     ASSERT(m_current);
@@ -256,7 +198,6 @@ inline bool LayoutIterator<T>::operator!=(const LayoutIterator& other) const
 
 }
 }
-#include "LayoutAncestorIterator.h"
 #include "LayoutChildIterator.h"
 
 #endif
index 5245bc4..fabe957 100644 (file)
@@ -41,7 +41,6 @@
 #include "LayoutChildIterator.h"
 #include "LayoutContainerBox.h"
 #include "LayoutContext.h"
-#include "LayoutDescendantIterator.h"
 #include "LayoutInitialContainingBlock.h"
 #include "LayoutInlineTextBox.h"
 #include "LayoutLineBreakBox.h"