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

Unified Diff: third_party/WebKit/Source/core/dom/NodeComputedStyle.h

Issue 2119263002: [DO NOT LAND: Dummy CL] Storage of ComputedStyle separate from LayoutObject. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 5 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/Source/core/dom/Node.cpp ('k') | third_party/WebKit/Source/core/dom/NodeRareData.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/dom/NodeComputedStyle.h
diff --git a/third_party/WebKit/Source/core/dom/NodeComputedStyle.h b/third_party/WebKit/Source/core/dom/NodeComputedStyle.h
index 78872cdcf125b3139e08a8e7752e6eda40cfea34..a5a9f39ea3c6d12e0662013b8a89dd45807f95d0 100644
--- a/third_party/WebKit/Source/core/dom/NodeComputedStyle.h
+++ b/third_party/WebKit/Source/core/dom/NodeComputedStyle.h
@@ -25,8 +25,10 @@
#ifndef NodeComputedStyle_h
#define NodeComputedStyle_h
+#include "core/dom/ElementRareData.h"
#include "core/dom/LayoutTreeBuilderTraversal.h"
#include "core/dom/Node.h"
+#include "core/dom/NodeRareData.h"
#include "core/dom/shadow/InsertionPoint.h"
#include "core/html/HTMLOptGroupElement.h"
#include "core/layout/LayoutObject.h"
@@ -41,14 +43,19 @@ inline const ComputedStyle* Node::computedStyle() const
inline ComputedStyle* Node::mutableComputedStyle() const
{
- if (LayoutObject* layoutObject = this->layoutObject())
- return layoutObject->mutableStyle();
+ if (hasLayoutObject())
+ return layoutObject()->mutableStyle();
// <option> and <optgroup> can be styled even if they don't get layout objects,
// so they store their style internally and return it through nonLayoutObjectComputedStyle().
// We check here explicitly to avoid the virtual call in the common case.
if (isHTMLOptGroupElement(*this) || isHTMLOptionElement(this))
return nonLayoutObjectComputedStyle();
- return 0;
+ if (hasRareData()) {
+ NodeRareData* rareData = this->rareData();
+ DCHECK(rareData->isElementRareData());
+ return static_cast<ElementRareData*>(rareData)->computedStyle();
+ }
+ return m_data.m_computedStyle;
}
inline const ComputedStyle* Node::parentComputedStyle() const
« no previous file with comments | « third_party/WebKit/Source/core/dom/Node.cpp ('k') | third_party/WebKit/Source/core/dom/NodeRareData.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698