Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(44)

Side by Side Diff: third_party/WebKit/Source/core/editing/iterators/FullyClippedStateStack.cpp

Issue 2397033002: Reflow comments in //third_party/WebKit/Source/core/editing/iterators (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/editing/iterators/FullyClippedStateStack.h" 5 #include "core/editing/iterators/FullyClippedStateStack.h"
6 6
7 #include "core/dom/ContainerNode.h" 7 #include "core/dom/ContainerNode.h"
8 #include "core/dom/Node.h" 8 #include "core/dom/Node.h"
9 #include "core/editing/EditingUtilities.h" 9 #include "core/editing/EditingUtilities.h"
10 #include "core/layout/LayoutBox.h" 10 #include "core/layout/LayoutBox.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 FullyClippedStateStackAlgorithm<Strategy>::FullyClippedStateStackAlgorithm() {} 44 FullyClippedStateStackAlgorithm<Strategy>::FullyClippedStateStackAlgorithm() {}
45 45
46 template <typename Strategy> 46 template <typename Strategy>
47 FullyClippedStateStackAlgorithm<Strategy>::~FullyClippedStateStackAlgorithm() {} 47 FullyClippedStateStackAlgorithm<Strategy>::~FullyClippedStateStackAlgorithm() {}
48 48
49 template <typename Strategy> 49 template <typename Strategy>
50 void FullyClippedStateStackAlgorithm<Strategy>::pushFullyClippedState( 50 void FullyClippedStateStackAlgorithm<Strategy>::pushFullyClippedState(
51 Node* node) { 51 Node* node) {
52 DCHECK_EQ(size(), depthCrossingShadowBoundaries<Strategy>(*node)); 52 DCHECK_EQ(size(), depthCrossingShadowBoundaries<Strategy>(*node));
53 53
54 // FIXME: m_fullyClippedStack was added in response to <https://bugs.webkit.or g/show_bug.cgi?id=26364> 54 // FIXME: m_fullyClippedStack was added in response to
55 // ("Search can find text that's hidden by overflow:hidden"), but the logic he re will not work correctly if 55 // <https://bugs.webkit.org/show_bug.cgi?id=26364> ("Search can find text
56 // a shadow tree redistributes nodes. m_fullyClippedStack relies on the assump tion that DOM node hierarchy matches 56 // that's hidden by overflow:hidden"), but the logic here will not work
57 // the layout tree, which is not necessarily true if there happens to be shado w DOM distribution or other mechanics 57 // correctly if a shadow tree redistributes nodes. m_fullyClippedStack relies
58 // that shuffle around the layout objects regardless of node tree hierarchy (l ike CSS flexbox). 58 // on the assumption that DOM node hierarchy matches the layout tree, which is
59 // not necessarily true if there happens to be shadow DOM distribution or
60 // other mechanics that shuffle around the layout objects regardless of node
61 // tree hierarchy (like CSS flexbox).
59 // 62 //
60 // A more appropriate way to handle this situation is to detect overflow:hidde n blocks by using only layout 63 // A more appropriate way to handle this situation is to detect
61 // primitives, not with DOM primitives. 64 // overflow:hidden blocks by using only layout primitives, not with DOM
65 // primitives.
62 66
63 // Push true if this node full clips its contents, or if a parent already has fully 67 // Push true if this node full clips its contents, or if a parent already has
68 // fully
64 // clipped and this is not a node that ignores its container's clip. 69 // clipped and this is not a node that ignores its container's clip.
65 push(fullyClipsContents(node) || (top() && !ignoresContainerClip(node))); 70 push(fullyClipsContents(node) || (top() && !ignoresContainerClip(node)));
66 } 71 }
67 72
68 template <typename Strategy> 73 template <typename Strategy>
69 void FullyClippedStateStackAlgorithm<Strategy>::setUpFullyClippedStack( 74 void FullyClippedStateStackAlgorithm<Strategy>::setUpFullyClippedStack(
70 Node* node) { 75 Node* node) {
71 // Put the nodes in a vector so we can iterate in reverse order. 76 // Put the nodes in a vector so we can iterate in reverse order.
72 HeapVector<Member<ContainerNode>, 100> ancestry; 77 HeapVector<Member<ContainerNode>, 100> ancestry;
73 for (ContainerNode* parent = parentCrossingShadowBoundaries<Strategy>(*node); 78 for (ContainerNode* parent = parentCrossingShadowBoundaries<Strategy>(*node);
74 parent; parent = parentCrossingShadowBoundaries<Strategy>(*parent)) 79 parent; parent = parentCrossingShadowBoundaries<Strategy>(*parent))
75 ancestry.append(parent); 80 ancestry.append(parent);
76 81
77 // Call pushFullyClippedState on each node starting with the earliest ancestor . 82 // Call pushFullyClippedState on each node starting with the earliest
83 // ancestor.
78 size_t ancestrySize = ancestry.size(); 84 size_t ancestrySize = ancestry.size();
79 for (size_t i = 0; i < ancestrySize; ++i) 85 for (size_t i = 0; i < ancestrySize; ++i)
80 pushFullyClippedState(ancestry[ancestrySize - i - 1]); 86 pushFullyClippedState(ancestry[ancestrySize - i - 1]);
81 pushFullyClippedState(node); 87 pushFullyClippedState(node);
82 88
83 DCHECK_EQ(size(), 1 + depthCrossingShadowBoundaries<Strategy>(*node)); 89 DCHECK_EQ(size(), 1 + depthCrossingShadowBoundaries<Strategy>(*node));
84 } 90 }
85 91
86 template class CORE_TEMPLATE_EXPORT 92 template class CORE_TEMPLATE_EXPORT
87 FullyClippedStateStackAlgorithm<EditingStrategy>; 93 FullyClippedStateStackAlgorithm<EditingStrategy>;
88 template class CORE_TEMPLATE_EXPORT 94 template class CORE_TEMPLATE_EXPORT
89 FullyClippedStateStackAlgorithm<EditingInFlatTreeStrategy>; 95 FullyClippedStateStackAlgorithm<EditingInFlatTreeStrategy>;
90 96
91 } // namespace blink 97 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698