Commit 2ea06e9a authored by Zhuoyu Qian's avatar Zhuoyu Qian Committed by Commit Bot

Make StylePropertyMap::SetProperty take a const CSSValue& instead of ptr

Made StylePropertyMap::setProperty take a const CSSValue& instead of a
const CSSValue*. This is more semantically correct and safe since
StylePropertyMaps cannot store nullptrs, and is also an attempt to fix
a strange performance issue caused from introducing const CSSValue*s.

BUG=526586
R=sashab@chromium.org
Signed-off-by: default avatarZhuoyu Qian <zhuoyu.qian@samsung.com>
Change-Id: I30f612d69ee944e9df9d591fd6585512aea7d0ac
Reviewed-on: https://chromium-review.googlesource.com/835907Reviewed-by: default avatarSasha Morrissey <sashab@chromium.org>
Cr-Commit-Position: refs/heads/master@{#526443}
parent 120666fe
......@@ -21,8 +21,8 @@ const CSSValue* InlineStylePropertyMap::GetCustomProperty(
}
void InlineStylePropertyMap::SetProperty(CSSPropertyID property_id,
const CSSValue* value) {
owner_element_->SetInlineStyleProperty(property_id, *value);
const CSSValue& value) {
owner_element_->SetInlineStyleProperty(property_id, value);
}
void InlineStylePropertyMap::RemoveProperty(CSSPropertyID property_id) {
......
......@@ -25,7 +25,7 @@ class CORE_EXPORT InlineStylePropertyMap final : public StylePropertyMap {
const CSSValue* GetProperty(CSSPropertyID) override;
const CSSValue* GetCustomProperty(AtomicString) override;
void ForEachProperty(const IterationCallback&) override;
void SetProperty(CSSPropertyID, const CSSValue*) override;
void SetProperty(CSSPropertyID, const CSSValue&) override;
void RemoveProperty(CSSPropertyID) override;
void RemoveCustomProperty(const AtomicString&);
......
......@@ -122,7 +122,7 @@ void StylePropertyMap::set(const ExecutionContext* execution_context,
return;
}
SetProperty(property_id, result);
SetProperty(property_id, *result);
}
void StylePropertyMap::append(const ExecutionContext* execution_context,
......@@ -165,7 +165,7 @@ void StylePropertyMap::append(const ExecutionContext* execution_context,
current_value->Append(*value);
}
SetProperty(property_id, current_value);
SetProperty(property_id, *current_value);
}
void StylePropertyMap::remove(const String& property_name,
......
......@@ -34,7 +34,7 @@ class CORE_EXPORT StylePropertyMap : public StylePropertyMapReadonly {
ExceptionState&);
protected:
virtual void SetProperty(CSSPropertyID, const CSSValue*) = 0;
virtual void SetProperty(CSSPropertyID, const CSSValue&) = 0;
virtual void RemoveProperty(CSSPropertyID) = 0;
virtual void RemoveCustomProperty(const AtomicString&) = 0;
......
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