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

Unified Diff: Source/core/css/StylePropertySet.cpp

Issue 1249553002: CSSValue Immediates: Add move operators to CSSPrimitiveValue (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@cssvalue_patch_3_tagged_ptrs_with_copy_ops_mv_operators_ref_primvalue
Patch Set: Rebase Created 5 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 | « Source/core/css/StylePropertySet.h ('k') | Source/core/css/parser/CSSParser.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/css/StylePropertySet.cpp
diff --git a/Source/core/css/StylePropertySet.cpp b/Source/core/css/StylePropertySet.cpp
index 11b599a6d725e5e4179937ff7c6b341ce750636b..0039118da28a809b8905ab7cc4c9ec171f7f62bb 100644
--- a/Source/core/css/StylePropertySet.cpp
+++ b/Source/core/css/StylePropertySet.cpp
@@ -137,19 +137,19 @@ MutableStylePropertySet::MutableStylePropertySet(const StylePropertySet& other)
String StylePropertySet::getPropertyValue(CSSPropertyID propertyID) const
{
- NullableCSSValue value = getPropertyCSSValue(propertyID);
+ const NullableCSSValue& value = getPropertyCSSValue(propertyID);
if (value)
return value->cssText();
return StylePropertySerializer(*this).getPropertyValue(propertyID);
}
-NullableCSSValue StylePropertySet::getPropertyCSSValue(CSSPropertyID propertyID) const
+const NullableCSSValue StylePropertySet::getPropertyCSSValue(CSSPropertyID propertyID) const
{
int foundPropertyIndex = findPropertyIndex(propertyID);
if (foundPropertyIndex == -1)
return nullptr;
- return propertyAt(foundPropertyIndex).value();
+ return *reinterpret_cast<const NullableCSSValue*>(&propertyAt(foundPropertyIndex).value());
}
DEFINE_TRACE(StylePropertySet)
@@ -250,6 +250,11 @@ bool MutableStylePropertySet::setProperty(CSSPropertyID unresolvedProperty, cons
return CSSParser::parseValue(this, unresolvedProperty, value, important, cssParserMode(), contextStyleSheet);
}
+void MutableStylePropertySet::setProperty(CSSPropertyID propertyID, const CSSPrimitiveValue& prpValue, bool important)
+{
+ setProperty(propertyID, *reinterpret_cast<const CSSValue*>(&prpValue), important);
+}
+
void MutableStylePropertySet::setProperty(CSSPropertyID propertyID, const CSSValue& prpValue, bool important)
{
StylePropertyShorthand shorthand = shorthandForProperty(propertyID);
@@ -434,7 +439,7 @@ PassRefPtrWillBeRawPtr<MutableStylePropertySet> StylePropertySet::copyProperties
WillBeHeapVector<CSSProperty, 256> list;
list.reserveInitialCapacity(properties.size());
for (unsigned i = 0; i < properties.size(); ++i) {
- NullableCSSValue value = getPropertyCSSValue(properties[i]);
+ const NullableCSSValue& value = getPropertyCSSValue(properties[i]);
if (value)
list.append(CSSProperty(properties[i], *value, false));
}
« no previous file with comments | « Source/core/css/StylePropertySet.h ('k') | Source/core/css/parser/CSSParser.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698