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

Side by Side Diff: third_party/WebKit/Source/web/tests/WebDocumentTest.cpp

Issue 1644543002: Moved element style recalc count and stats to StyleEngine. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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/testing/Internals.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 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 "public/web/WebDocument.h" 5 #include "public/web/WebDocument.h"
6 6
7 #include "core/CSSPropertyNames.h" 7 #include "core/CSSPropertyNames.h"
8 #include "core/HTMLNames.h" 8 #include "core/HTMLNames.h"
9 #include "core/dom/NodeComputedStyle.h" 9 #include "core/dom/NodeComputedStyle.h"
10 #include "core/dom/StyleEngine.h" 10 #include "core/dom/StyleEngine.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 return m_webViewHelper.webView()->mainFrame()->document(); 60 return m_webViewHelper.webView()->mainFrame()->document();
61 } 61 }
62 62
63 TEST_F(WebDocumentTest, InsertStyleSheet) 63 TEST_F(WebDocumentTest, InsertStyleSheet)
64 { 64 {
65 loadURL("about:blank"); 65 loadURL("about:blank");
66 66
67 WebDocument webDoc = topWebDocument(); 67 WebDocument webDoc = topWebDocument();
68 Document* coreDoc = topDocument(); 68 Document* coreDoc = topDocument();
69 69
70 unsigned startCount = coreDoc->styleEngine().styleForElementCount();
71
70 webDoc.insertStyleSheet("body { color: green }"); 72 webDoc.insertStyleSheet("body { color: green }");
71 73
72 // Check insertStyleSheet did not cause a synchronous style recalc. 74 // Check insertStyleSheet did not cause a synchronous style recalc.
73 unsigned accessCount = coreDoc->styleEngine().resolverAccessCount(); 75 unsigned elementCount = coreDoc->styleEngine().styleForElementCount() - star tCount;
74 ASSERT_EQ(0U, accessCount); 76 ASSERT_EQ(0U, elementCount);
75 77
76 HTMLElement* bodyElement = coreDoc->body(); 78 HTMLElement* bodyElement = coreDoc->body();
77 ASSERT(bodyElement); 79 ASSERT(bodyElement);
78 80
79 const ComputedStyle& styleBeforeInsertion = bodyElement->computedStyleRef(); 81 const ComputedStyle& styleBeforeInsertion = bodyElement->computedStyleRef();
80 82
81 // Inserted stylesheet not yet applied. 83 // Inserted stylesheet not yet applied.
82 ASSERT_EQ(Color(0, 0, 0), styleBeforeInsertion.visitedDependentColor(CSSProp ertyColor)); 84 ASSERT_EQ(Color(0, 0, 0), styleBeforeInsertion.visitedDependentColor(CSSProp ertyColor));
83 85
84 // Apply inserted stylesheet. 86 // Apply inserted stylesheet.
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 load(nestedOriginAInOriginB); 320 load(nestedOriginAInOriginB);
319 321
320 SchemeRegistry::registerURLSchemeAsFirstPartyWhenTopLevel("http"); 322 SchemeRegistry::registerURLSchemeAsFirstPartyWhenTopLevel("http");
321 323
322 ASSERT_EQ(toOriginA(nestedOriginAInOriginB), topDocument()->firstPartyForCoo kies()); 324 ASSERT_EQ(toOriginA(nestedOriginAInOriginB), topDocument()->firstPartyForCoo kies());
323 ASSERT_EQ(toOriginA(nestedOriginAInOriginB), nestedDocument()->firstPartyFor Cookies()); 325 ASSERT_EQ(toOriginA(nestedOriginAInOriginB), nestedDocument()->firstPartyFor Cookies());
324 ASSERT_EQ(toOriginA(nestedOriginAInOriginB), nestedNestedDocument()->firstPa rtyForCookies()); 326 ASSERT_EQ(toOriginA(nestedOriginAInOriginB), nestedNestedDocument()->firstPa rtyForCookies());
325 } 327 }
326 328
327 } // namespace blink 329 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/testing/Internals.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698