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

Unified Diff: third_party/WebKit/Source/core/css/CSSComputedStyleDeclaration.cpp

Issue 1945623002: Make sure computed style is up-to-date for custom properties. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/css/variables/computed-style.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/css/CSSComputedStyleDeclaration.cpp
diff --git a/third_party/WebKit/Source/core/css/CSSComputedStyleDeclaration.cpp b/third_party/WebKit/Source/core/css/CSSComputedStyleDeclaration.cpp
index f45c33fef7fa1a013d9bb50431952d430906d19c..bc79235b870023303b411d5f9d57272e20d0d0a8 100644
--- a/third_party/WebKit/Source/core/css/CSSComputedStyleDeclaration.cpp
+++ b/third_party/WebKit/Source/core/css/CSSComputedStyleDeclaration.cpp
@@ -514,6 +514,12 @@ Node* CSSComputedStyleDeclaration::styledNode() const
CSSValue* CSSComputedStyleDeclaration::getPropertyCSSValue(AtomicString customPropertyName) const
{
+ Node* styledNode = this->styledNode();
+ if (!styledNode)
+ return nullptr;
+
+ styledNode->document().updateLayoutTreeForNode(styledNode);
+
const ComputedStyle* style = computeComputedStyle();
if (!style)
return nullptr;
@@ -533,19 +539,16 @@ CSSValue* CSSComputedStyleDeclaration::getPropertyCSSValue(CSSPropertyID propert
Node* styledNode = this->styledNode();
if (!styledNode)
return nullptr;
- LayoutObject* layoutObject = styledNode->layoutObject();
- const ComputedStyle* style;
Document& document = styledNode->document();
-
document.updateLayoutTreeForNode(styledNode);
// The style recalc could have caused the styled node to be discarded or replaced
// if it was a PseudoElement so we need to update it.
styledNode = this->styledNode();
- layoutObject = styledNode->layoutObject();
+ LayoutObject* layoutObject = styledNode->layoutObject();
- style = computeComputedStyle();
+ const ComputedStyle* style = computeComputedStyle();
bool forceFullLayout = isLayoutDependent(propertyID, style, layoutObject)
|| styledNode->isInShadowTree()
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/css/variables/computed-style.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698