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

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: Allow text as child of the LayoutView, since it can happen with display: contents Created 4 years 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 8a394b442085bdb71681852e61ec9f615ff941ec..867498598b3cef8188274719b1e733b8a82dd6bd 100644
--- a/third_party/WebKit/Source/core/dom/Document.cpp
+++ b/third_party/WebKit/Source/core/dom/Document.cpp
@@ -1730,9 +1730,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();
}
@@ -2244,9 +2245,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