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

Side by Side Diff: Source/core/css/AffectedByFocusTest.cpp

Issue 1225583004: Revert of Add a FrameView lifecycle method that just updates layout, style and compositing. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | Source/core/css/DragUpdateTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "config.h" 5 #include "config.h"
6 6
7 #include "core/HTMLNames.h" 7 #include "core/HTMLNames.h"
8 #include "core/dom/Element.h" 8 #include "core/dom/Element.h"
9 #include "core/dom/ElementTraversal.h" 9 #include "core/dom/ElementTraversal.h"
10 #include "core/dom/NodeComputedStyle.h" 10 #include "core/dom/NodeComputedStyle.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 void AffectedByFocusTest::SetUp() 44 void AffectedByFocusTest::SetUp()
45 { 45 {
46 m_dummyPageHolder = DummyPageHolder::create(IntSize(800, 600)); 46 m_dummyPageHolder = DummyPageHolder::create(IntSize(800, 600));
47 m_document = toHTMLDocument(&m_dummyPageHolder->document()); 47 m_document = toHTMLDocument(&m_dummyPageHolder->document());
48 ASSERT(m_document); 48 ASSERT(m_document);
49 } 49 }
50 50
51 void AffectedByFocusTest::setHtmlInnerHTML(const char* htmlContent) 51 void AffectedByFocusTest::setHtmlInnerHTML(const char* htmlContent)
52 { 52 {
53 document().documentElement()->setInnerHTML(String::fromUTF8(htmlContent), AS SERT_NO_EXCEPTION); 53 document().documentElement()->setInnerHTML(String::fromUTF8(htmlContent), AS SERT_NO_EXCEPTION);
54 document().view()->updateAllLifecyclePhases(); 54 document().view()->updateLayoutAndStyleForPainting();
55 } 55 }
56 56
57 void AffectedByFocusTest::checkElements(ElementResult expected[], unsigned expec tedCount) const 57 void AffectedByFocusTest::checkElements(ElementResult expected[], unsigned expec tedCount) const
58 { 58 {
59 unsigned i = 0; 59 unsigned i = 0;
60 HTMLElement* element = document().body(); 60 HTMLElement* element = document().body();
61 61
62 for (; element && i < expectedCount; element = Traversal<HTMLElement>::next( *element), ++i) { 62 for (; element && i < expectedCount; element = Traversal<HTMLElement>::next( *element), ++i) {
63 ASSERT_TRUE(element->hasTagName(expected[i].tag)); 63 ASSERT_TRUE(element->hasTagName(expected[i].tag));
64 ASSERT(element->computedStyle()); 64 ASSERT(element->computedStyle());
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 "<div></div>" 199 "<div></div>"
200 "<div></div>" 200 "<div></div>"
201 "<div></div>" 201 "<div></div>"
202 "<div></div>" 202 "<div></div>"
203 "<div></div>" 203 "<div></div>"
204 "<div></div>" 204 "<div></div>"
205 "<div></div>" 205 "<div></div>"
206 "<div></div>" 206 "<div></div>"
207 "</div>"); 207 "</div>");
208 208
209 document().view()->updateAllLifecyclePhases(); 209 document().view()->updateLayoutAndStyleForPainting();
210 210
211 unsigned startCount = document().styleEngine().resolverAccessCount(); 211 unsigned startCount = document().styleEngine().resolverAccessCount();
212 212
213 document().getElementById("d")->focus(); 213 document().getElementById("d")->focus();
214 document().view()->updateAllLifecyclePhases(); 214 document().view()->updateLayoutAndStyleForPainting();
215 215
216 unsigned accessCount = document().styleEngine().resolverAccessCount() - star tCount; 216 unsigned accessCount = document().styleEngine().resolverAccessCount() - star tCount;
217 217
218 ASSERT_EQ(1U, accessCount); 218 ASSERT_EQ(1U, accessCount);
219 } 219 }
220 220
221 TEST_F(AffectedByFocusTest, ChildrenOrSiblingsAffectedByFocusUpdate) 221 TEST_F(AffectedByFocusTest, ChildrenOrSiblingsAffectedByFocusUpdate)
222 { 222 {
223 // Check that when focussing the outer div in the document below, you get a 223 // Check that when focussing the outer div in the document below, you get a
224 // style recalc for the whole subtree. 224 // style recalc for the whole subtree.
225 225
226 setHtmlInnerHTML("<style>:focus div { border: 1px solid lime; }</style>" 226 setHtmlInnerHTML("<style>:focus div { border: 1px solid lime; }</style>"
227 "<div id=d tabIndex=1>" 227 "<div id=d tabIndex=1>"
228 "<div></div>" 228 "<div></div>"
229 "<div></div>" 229 "<div></div>"
230 "<div></div>" 230 "<div></div>"
231 "<div></div>" 231 "<div></div>"
232 "<div></div>" 232 "<div></div>"
233 "<div></div>" 233 "<div></div>"
234 "<div></div>" 234 "<div></div>"
235 "<div></div>" 235 "<div></div>"
236 "<div></div>" 236 "<div></div>"
237 "<div></div>" 237 "<div></div>"
238 "</div>"); 238 "</div>");
239 239
240 document().view()->updateAllLifecyclePhases(); 240 document().view()->updateLayoutAndStyleForPainting();
241 241
242 unsigned startCount = document().styleEngine().resolverAccessCount(); 242 unsigned startCount = document().styleEngine().resolverAccessCount();
243 243
244 document().getElementById("d")->focus(); 244 document().getElementById("d")->focus();
245 document().view()->updateAllLifecyclePhases(); 245 document().view()->updateLayoutAndStyleForPainting();
246 246
247 unsigned accessCount = document().styleEngine().resolverAccessCount() - star tCount; 247 unsigned accessCount = document().styleEngine().resolverAccessCount() - star tCount;
248 248
249 ASSERT_EQ(11U, accessCount); 249 ASSERT_EQ(11U, accessCount);
250 } 250 }
251 251
252 TEST_F(AffectedByFocusTest, InvalidationSetFocusUpdate) 252 TEST_F(AffectedByFocusTest, InvalidationSetFocusUpdate)
253 { 253 {
254 // Check that when focussing the outer div in the document below, you get a 254 // Check that when focussing the outer div in the document below, you get a
255 // style recalc for the outer div and the class=a div only. 255 // style recalc for the outer div and the class=a div only.
256 256
257 setHtmlInnerHTML("<style>:focus .a { border: 1px solid lime; }</style>" 257 setHtmlInnerHTML("<style>:focus .a { border: 1px solid lime; }</style>"
258 "<div id=d tabIndex=1>" 258 "<div id=d tabIndex=1>"
259 "<div></div>" 259 "<div></div>"
260 "<div></div>" 260 "<div></div>"
261 "<div></div>" 261 "<div></div>"
262 "<div></div>" 262 "<div></div>"
263 "<div></div>" 263 "<div></div>"
264 "<div></div>" 264 "<div></div>"
265 "<div></div>" 265 "<div></div>"
266 "<div></div>" 266 "<div></div>"
267 "<div></div>" 267 "<div></div>"
268 "<div class='a'></div>" 268 "<div class='a'></div>"
269 "</div>"); 269 "</div>");
270 270
271 document().view()->updateAllLifecyclePhases(); 271 document().view()->updateLayoutAndStyleForPainting();
272 272
273 unsigned startCount = document().styleEngine().resolverAccessCount(); 273 unsigned startCount = document().styleEngine().resolverAccessCount();
274 274
275 document().getElementById("d")->focus(); 275 document().getElementById("d")->focus();
276 document().view()->updateAllLifecyclePhases(); 276 document().view()->updateLayoutAndStyleForPainting();
277 277
278 unsigned accessCount = document().styleEngine().resolverAccessCount() - star tCount; 278 unsigned accessCount = document().styleEngine().resolverAccessCount() - star tCount;
279 279
280 ASSERT_EQ(2U, accessCount); 280 ASSERT_EQ(2U, accessCount);
281 } 281 }
282 282
283 TEST_F(AffectedByFocusTest, NoInvalidationSetFocusUpdate) 283 TEST_F(AffectedByFocusTest, NoInvalidationSetFocusUpdate)
284 { 284 {
285 // Check that when focussing the outer div in the document below, you get a 285 // Check that when focussing the outer div in the document below, you get a
286 // style recalc for the outer div only. The invalidation set for :focus will 286 // style recalc for the outer div only. The invalidation set for :focus will
287 // include 'a', but the id=d div should be affectedByFocus, not childrenOrSi blingsAffectedByFocus. 287 // include 'a', but the id=d div should be affectedByFocus, not childrenOrSi blingsAffectedByFocus.
288 288
289 setHtmlInnerHTML("<style>#nomatch:focus .a { border: 1px solid lime; }</styl e>" 289 setHtmlInnerHTML("<style>#nomatch:focus .a { border: 1px solid lime; }</styl e>"
290 "<div id=d tabIndex=1>" 290 "<div id=d tabIndex=1>"
291 "<div></div>" 291 "<div></div>"
292 "<div></div>" 292 "<div></div>"
293 "<div></div>" 293 "<div></div>"
294 "<div></div>" 294 "<div></div>"
295 "<div></div>" 295 "<div></div>"
296 "<div></div>" 296 "<div></div>"
297 "<div></div>" 297 "<div></div>"
298 "<div></div>" 298 "<div></div>"
299 "<div></div>" 299 "<div></div>"
300 "<div class='a'></div>" 300 "<div class='a'></div>"
301 "</div>"); 301 "</div>");
302 302
303 document().view()->updateAllLifecyclePhases(); 303 document().view()->updateLayoutAndStyleForPainting();
304 304
305 unsigned startCount = document().styleEngine().resolverAccessCount(); 305 unsigned startCount = document().styleEngine().resolverAccessCount();
306 306
307 document().getElementById("d")->focus(); 307 document().getElementById("d")->focus();
308 document().view()->updateAllLifecyclePhases(); 308 document().view()->updateLayoutAndStyleForPainting();
309 309
310 unsigned accessCount = document().styleEngine().resolverAccessCount() - star tCount; 310 unsigned accessCount = document().styleEngine().resolverAccessCount() - star tCount;
311 311
312 ASSERT_EQ(1U, accessCount); 312 ASSERT_EQ(1U, accessCount);
313 } 313 }
314 314
315 } // namespace blink 315 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | Source/core/css/DragUpdateTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698