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

Side by Side Diff: third_party/WebKit/Source/core/dom/LayoutTreeBuilderTraversalTest.cpp

Issue 2715353002: Fix LayoutTreeBuilderTraversal limit checks when recursing. (Closed)
Patch Set: Created 3 years, 9 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
« no previous file with comments | « third_party/WebKit/Source/core/dom/LayoutTreeBuilderTraversal.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/dom/LayoutTreeBuilderTraversal.h" 5 #include "core/dom/LayoutTreeBuilderTraversal.h"
6 6
7 #include "core/dom/Document.h" 7 #include "core/dom/Document.h"
8 #include "core/dom/Element.h" 8 #include "core/dom/Element.h"
9 #include "core/dom/Node.h" 9 #include "core/dom/Node.h"
10 #include "core/dom/NodeComputedStyle.h" 10 #include "core/dom/NodeComputedStyle.h"
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 LayoutTreeBuilderTraversal::nextSiblingLayoutObject(*inner)); 129 LayoutTreeBuilderTraversal::nextSiblingLayoutObject(*inner));
130 EXPECT_EQ(inner->layoutObject(), 130 EXPECT_EQ(inner->layoutObject(),
131 LayoutTreeBuilderTraversal::previousSiblingLayoutObject(*sibling)); 131 LayoutTreeBuilderTraversal::previousSiblingLayoutObject(*sibling));
132 132
133 EXPECT_EQ(last->layoutObject(), 133 EXPECT_EQ(last->layoutObject(),
134 LayoutTreeBuilderTraversal::nextSiblingLayoutObject(*sibling)); 134 LayoutTreeBuilderTraversal::nextSiblingLayoutObject(*sibling));
135 EXPECT_EQ(sibling->layoutObject(), 135 EXPECT_EQ(sibling->layoutObject(),
136 LayoutTreeBuilderTraversal::previousSiblingLayoutObject(*last)); 136 LayoutTreeBuilderTraversal::previousSiblingLayoutObject(*last));
137 } 137 }
138 138
139 TEST_F(LayoutTreeBuilderTraversalTest, limits) {
140 const char* const html =
141 "<div></div>"
142 "<div style='display: contents'></div>"
143 "<div style='display: contents'>"
144 "<div style='display: contents'>"
145 "</div>"
146 "</div>"
147 "<div id='shouldNotBeFound'></div>";
148
149 setupSampleHTML(html);
150
151 Element* first = document().querySelector("div");
152
153 EXPECT_TRUE(first->layoutObject());
154 LayoutObject* nextSibling =
155 LayoutTreeBuilderTraversal::nextSiblingLayoutObject(*first, 2);
156 EXPECT_FALSE(nextSibling); // Should not overrecurse
157 }
158
139 } // namespace blink 159 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/LayoutTreeBuilderTraversal.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698