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) { |