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 8dd0107b17f40243126d5ebf82ac2ec8a0e5a7b0..e6a7d991a73f4c8e709ff21058ddbeb4fa94a2a1 100644 |
--- a/third_party/WebKit/Source/core/dom/Document.cpp |
+++ b/third_party/WebKit/Source/core/dom/Document.cpp |
@@ -1743,9 +1743,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(); |
} |
@@ -2257,9 +2258,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) { |