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

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

Issue 2880263002: Clear document scope dirtiness in import StyleEngine. (Closed)
Patch Set: Created 3 years, 7 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/StyleEngine.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 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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/Document.h" 5 #include "core/dom/Document.h"
6 #include "core/html/HTMLLinkElement.h" 6 #include "core/html/HTMLLinkElement.h"
7 #include "testing/gtest/include/gtest/gtest.h" 7 #include "testing/gtest/include/gtest/gtest.h"
8 #include "web/tests/sim/SimRequest.h" 8 #include "web/tests/sim/SimRequest.h"
9 #include "web/tests/sim/SimTest.h" 9 #include "web/tests/sim/SimTest.h"
10 10
11 namespace blink { 11 namespace blink {
12 12
13 class HTMLImportSheetsTest : public SimTest { 13 class HTMLImportSheetsTest : public SimTest {
14 protected: 14 protected:
15 HTMLImportSheetsTest() { WebView().Resize(WebSize(640, 480)); } 15 HTMLImportSheetsTest() { WebView().Resize(WebSize(640, 480)); }
16 }; 16 };
17 17
18 TEST_F(HTMLImportSheetsTest, NeedsActiveStyleUpdate) { 18 TEST_F(HTMLImportSheetsTest, NeedsActiveStyleUpdate) {
19 SimRequest main_resource("https://example.com/", "text/html"); 19 SimRequest main_resource("https://example.com/", "text/html");
20 SimRequest import_resource("https://example.com/import.html", "text/html"); 20 SimRequest import_resource("https://example.com/import.html", "text/html");
21 21
22 LoadURL("https://example.com/"); 22 LoadURL("https://example.com/");
23 main_resource.Complete("<link id=link rel=import href=import.html>"); 23 main_resource.Complete("<link id=link rel=import href=import.html>");
24 import_resource.Complete("<style>div{}</style>"); 24 import_resource.Complete("<style>div{}</style>");
25 25
26 EXPECT_TRUE(GetDocument().GetStyleEngine().NeedsActiveStyleUpdate()); 26 EXPECT_TRUE(GetDocument().GetStyleEngine().NeedsActiveStyleUpdate());
27 Document* import_doc =
28 toHTMLLinkElement(GetDocument().getElementById("link"))->import();
29 ASSERT_TRUE(import_doc);
30 EXPECT_TRUE(import_doc->GetStyleEngine().NeedsActiveStyleUpdate());
31
32 GetDocument().GetStyleEngine().UpdateActiveStyle();
33
34 EXPECT_FALSE(GetDocument().GetStyleEngine().NeedsActiveStyleUpdate());
35 EXPECT_FALSE(import_doc->GetStyleEngine().NeedsActiveStyleUpdate());
27 } 36 }
28 37
29 } // namespace blink 38 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/StyleEngine.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698