Commit a096d56e authored by Anders Hartvoll Ruud's avatar Anders Hartvoll Ruud Committed by Commit Bot

Remove Style[Non]InheritedVariables::needs_resolution_

Before StyleCascade, we used to store CSSVariableData objects in need
of var()-resolution on ComputedStyle, and the resolve those
CSSVariableData objects "in place". There was also a performance
optimization which utilized flags which told us whether or not there
was any CSSVariableData object in need of resolution somewhere in
Style[Non]InheritedVariables.

The flags can now be removed, since all CSSVariableData objects are
now resolved in StyleCascade _before_ storage on ComputedStyle.

Change-Id: Ia176691bb02f6da4e3eb322b4984acf707654e4f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2372143Reviewed-by: default avatarXiaocheng Hu <xiaochengh@chromium.org>
Commit-Queue: Anders Hartvoll Ruud <andruud@chromium.org>
Cr-Commit-Position: refs/heads/master@{#801121}
parent 7f2f1978
...@@ -13,11 +13,10 @@ bool StyleInheritedVariables::operator==( ...@@ -13,11 +13,10 @@ bool StyleInheritedVariables::operator==(
return DataEquivalent(root_, other.root_) && variables_ == other.variables_; return DataEquivalent(root_, other.root_) && variables_ == other.variables_;
} }
StyleInheritedVariables::StyleInheritedVariables() StyleInheritedVariables::StyleInheritedVariables() : root_(nullptr) {}
: root_(nullptr), needs_resolution_(false) {}
StyleInheritedVariables::StyleInheritedVariables(StyleInheritedVariables& other) StyleInheritedVariables::StyleInheritedVariables(
: needs_resolution_(other.needs_resolution_) { StyleInheritedVariables& other) {
if (!other.root_) { if (!other.root_) {
root_ = &other; root_ = &other;
} else { } else {
......
...@@ -33,14 +33,12 @@ class CORE_EXPORT StyleInheritedVariables ...@@ -33,14 +33,12 @@ class CORE_EXPORT StyleInheritedVariables
} }
void SetData(const AtomicString& name, scoped_refptr<CSSVariableData> value) { void SetData(const AtomicString& name, scoped_refptr<CSSVariableData> value) {
needs_resolution_ = DCHECK(!value || !value->NeedsVariableResolution());
needs_resolution_ || (value && value->NeedsVariableResolution());
variables_.SetData(name, std::move(value)); variables_.SetData(name, std::move(value));
} }
StyleVariables::OptionalData GetData(const AtomicString&) const; StyleVariables::OptionalData GetData(const AtomicString&) const;
void SetValue(const AtomicString& name, const CSSValue* value) { void SetValue(const AtomicString& name, const CSSValue* value) {
needs_resolution_ = true;
variables_.SetValue(name, value); variables_.SetValue(name, value);
} }
StyleVariables::OptionalValue GetValue(const AtomicString&) const; StyleVariables::OptionalValue GetValue(const AtomicString&) const;
...@@ -53,16 +51,12 @@ class CORE_EXPORT StyleInheritedVariables ...@@ -53,16 +51,12 @@ class CORE_EXPORT StyleInheritedVariables
const StyleVariables::DataMap& Data() const { return variables_.Data(); } const StyleVariables::DataMap& Data() const { return variables_.Data(); }
const StyleVariables::ValueMap& Values() const { return variables_.Values(); } const StyleVariables::ValueMap& Values() const { return variables_.Values(); }
bool NeedsResolution() const { return needs_resolution_; }
void ClearNeedsResolution() { needs_resolution_ = false; }
private: private:
StyleInheritedVariables(); StyleInheritedVariables();
StyleInheritedVariables(StyleInheritedVariables& other); StyleInheritedVariables(StyleInheritedVariables& other);
StyleVariables variables_; StyleVariables variables_;
scoped_refptr<StyleInheritedVariables> root_; scoped_refptr<StyleInheritedVariables> root_;
bool needs_resolution_;
}; };
} // namespace blink } // namespace blink
......
...@@ -37,8 +37,7 @@ class CORE_EXPORT StyleNonInheritedVariables { ...@@ -37,8 +37,7 @@ class CORE_EXPORT StyleNonInheritedVariables {
} }
void SetData(const AtomicString& name, scoped_refptr<CSSVariableData> value) { void SetData(const AtomicString& name, scoped_refptr<CSSVariableData> value) {
needs_resolution_ = DCHECK(!value || !value->NeedsVariableResolution());
needs_resolution_ || (value && value->NeedsVariableResolution());
variables_.SetData(name, std::move(value)); variables_.SetData(name, std::move(value));
} }
StyleVariables::OptionalData GetData(const AtomicString& name) const { StyleVariables::OptionalData GetData(const AtomicString& name) const {
...@@ -46,7 +45,6 @@ class CORE_EXPORT StyleNonInheritedVariables { ...@@ -46,7 +45,6 @@ class CORE_EXPORT StyleNonInheritedVariables {
} }
void SetValue(const AtomicString& name, const CSSValue* value) { void SetValue(const AtomicString& name, const CSSValue* value) {
needs_resolution_ = true;
variables_.SetValue(name, value); variables_.SetValue(name, value);
} }
StyleVariables::OptionalValue GetValue(const AtomicString& name) const { StyleVariables::OptionalValue GetValue(const AtomicString& name) const {
...@@ -60,12 +58,8 @@ class CORE_EXPORT StyleNonInheritedVariables { ...@@ -60,12 +58,8 @@ class CORE_EXPORT StyleNonInheritedVariables {
const StyleVariables::DataMap& Data() const { return variables_.Data(); } const StyleVariables::DataMap& Data() const { return variables_.Data(); }
const StyleVariables::ValueMap& Values() const { return variables_.Values(); } const StyleVariables::ValueMap& Values() const { return variables_.Values(); }
bool NeedsResolution() const { return needs_resolution_; }
void ClearNeedsResolution() { needs_resolution_ = false; }
private: private:
StyleVariables variables_; StyleVariables variables_;
bool needs_resolution_ = false;
}; };
} // namespace blink } // namespace blink
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment