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

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

Issue 119533003: Clear mutable inline style when it is empty. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fixed typo. Created 7 years 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/VariablesIterator.h ('k') | Source/core/dom/Element.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/css/VariablesIterator.cpp
diff --git a/Source/core/css/VariablesIterator.cpp b/Source/core/css/VariablesIterator.cpp
index 9b229f77532aa23a268b6bd4496925df9a835d59..33beb035a60e78fb897b1a18d1f1865591aa8edf 100644
--- a/Source/core/css/VariablesIterator.cpp
+++ b/Source/core/css/VariablesIterator.cpp
@@ -23,12 +23,13 @@
#include "RuntimeEnabledFeatures.h"
#include "core/css/CSSVariableValue.h"
#include "core/css/StylePropertySet.h"
+#include "core/dom/Element.h"
namespace WebCore {
-PassRefPtr<VariablesIterator> VariablesIterator::create(MutableStylePropertySet* propertySet)
+void AbstractVariablesIterator::initRemainingNames(
+ const StylePropertySet* propertySet)
{
- ASSERT(RuntimeEnabledFeatures::cssVariablesEnabled());
const size_t propertyCount = propertySet->propertyCount();
size_t variableCount = 0;
Vector<AtomicString> remainingNames(propertyCount);
@@ -37,12 +38,22 @@ PassRefPtr<VariablesIterator> VariablesIterator::create(MutableStylePropertySet*
if (property.id() == CSSPropertyVariable)
remainingNames[variableCount++] = toCSSVariableValue(property.value())->name();
}
+ // FIXME: Make use of the Vector move constructor when rvalues are supported on all platforms.
remainingNames.shrink(variableCount);
- RefPtr<VariablesIterator> iterator = adoptRef(new VariablesIterator(propertySet));
- // FIXME: Make use of the Vector move constructor when rvalues are supported on all platforms.
- iterator->takeRemainingNames(remainingNames);
- return iterator.release();
+ takeRemainingNames(remainingNames);
+}
+
+VariablesIterator::VariablesIterator(MutableStylePropertySet* propertySet) :
+ m_propertySet(propertySet)
+{
+ ASSERT(RuntimeEnabledFeatures::cssVariablesEnabled());
+ initRemainingNames(propertySet);
+}
+
+PassRefPtr<VariablesIterator> VariablesIterator::create(MutableStylePropertySet* propertySet)
+{
+ return adoptRef(new VariablesIterator(propertySet));
}
String AbstractVariablesIterator::value() const
« no previous file with comments | « Source/core/css/VariablesIterator.h ('k') | Source/core/dom/Element.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698