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

Unified Diff: third_party/WebKit/Source/core/dom/Document.cpp

Issue 2266353004: Make Document::styleForElementIgnoringPendingStyleSheets() be aware of a flat tree structure (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update the test Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/dom/Document.cpp
diff --git a/third_party/WebKit/Source/core/dom/Document.cpp b/third_party/WebKit/Source/core/dom/Document.cpp
index f8d81f74113d91ab2d04a58971a36c4c6f6bf22a..aced0508376b5041f43a6e4feea9be65fbfd17bb 100644
--- a/third_party/WebKit/Source/core/dom/Document.cpp
+++ b/third_party/WebKit/Source/core/dom/Document.cpp
@@ -1992,7 +1992,11 @@ PassRefPtr<ComputedStyle> Document::styleForElementIgnoringPendingStylesheets(El
{
DCHECK_EQ(element->document(), this);
StyleEngine::IgnoringPendingStylesheet ignoring(styleEngine());
- return ensureStyleResolver().styleForElement(element, element->parentNode() ? element->parentNode()->ensureComputedStyle() : 0);
+ if (!element->canParticipateInFlatTree())
+ return ensureStyleResolver().styleForElement(element, nullptr);
+ ContainerNode* parent = LayoutTreeBuilderTraversal::parent(*element);
+ return ensureStyleResolver().styleForElement(element, parent ? parent->ensureComputedStyle() : nullptr);
+
}
PassRefPtr<ComputedStyle> Document::styleForPage(int pageIndex)

Powered by Google App Engine
This is Rietveld 408576698