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

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

Issue 2450093005: Support display: contents for elements, first-line and first-letter pseudos. (Closed)
Patch Set: Support display: contents for elements, first-line and first-letter pseudos. Created 3 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 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 13c590feef862ddb9edb151d758d49a7525602e5..747af367a88b09a83d793ba07648b7431d0440c4 100644
--- a/third_party/WebKit/Source/core/dom/Document.cpp
+++ b/third_party/WebKit/Source/core/dom/Document.cpp
@@ -1753,9 +1753,10 @@ void Document::inheritHtmlAndBodyElementStyles(StyleRecalcChange change) {
bodyStyle = body->mutableComputedStyle();
if (didRecalcDocumentElement)
body->clearAnimationStyleChange();
- if (!bodyStyle || body->needsStyleRecalc() || didRecalcDocumentElement)
+ if (!bodyStyle || body->needsStyleRecalc() || didRecalcDocumentElement) {
bodyStyle = ensureStyleResolver().styleForElement(
- body, documentElementStyle.get());
+ body, documentElementStyle.get(), documentElementStyle.get());
+ }
rootWritingMode = bodyStyle->getWritingMode();
rootDirection = bodyStyle->direction();
}
@@ -2267,9 +2268,18 @@ PassRefPtr<ComputedStyle> Document::styleForElementIgnoringPendingStylesheets(
StyleEngine::IgnoringPendingStylesheet ignoring(styleEngine());
if (!element->canParticipateInFlatTree())
return ensureStyleResolver().styleForElement(element, nullptr);
+
ContainerNode* parent = LayoutTreeBuilderTraversal::parent(*element);
- return ensureStyleResolver().styleForElement(
- element, parent ? parent->ensureComputedStyle() : nullptr);
+ const ComputedStyle* parentStyle =
+ parent ? parent->ensureComputedStyle() : nullptr;
+
+ ContainerNode* layoutParent =
+ parent ? LayoutTreeBuilderTraversal::layoutParent(*element) : nullptr;
+ const ComputedStyle* layoutParentStyle =
+ layoutParent ? layoutParent->ensureComputedStyle() : parentStyle;
+
+ return ensureStyleResolver().styleForElement(element, parentStyle,
+ layoutParentStyle);
}
PassRefPtr<ComputedStyle> Document::styleForPage(int pageIndex) {

Powered by Google App Engine
This is Rietveld 408576698