Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / core / css / StylePropertySet.cpp
index 5a5e11c..6a333f6 100644 (file)
 #include "StylePropertyShorthand.h"
 #include "core/css/parser/BisonCSSParser.h"
 #include "core/css/CSSValuePool.h"
-#include "core/css/CSSVariableValue.h"
 #include "core/css/RuntimeCSSEnabled.h"
 #include "core/css/StylePropertySerializer.h"
 #include "core/css/StyleSheetContents.h"
-#include "core/css/VariablesIterator.h"
 #include "core/frame/UseCounter.h"
 #include "wtf/text/StringBuilder.h"
 
@@ -117,11 +115,6 @@ String StylePropertySet::getPropertyValue(CSSPropertyID propertyID) const
     return StylePropertySerializer(*this).getPropertyValue(propertyID);
 }
 
-PassRefPtr<CSSVariablesIterator> MutableStylePropertySet::variablesIterator()
-{
-    return VariablesIterator::create(this);
-}
-
 PassRefPtr<CSSValue> StylePropertySet::getPropertyCSSValue(CSSPropertyID propertyID) const
 {
     int foundPropertyIndex = findPropertyIndex(propertyID);
@@ -130,26 +123,6 @@ PassRefPtr<CSSValue> StylePropertySet::getPropertyCSSValue(CSSPropertyID propert
     return propertyAt(foundPropertyIndex).value();
 }
 
-unsigned StylePropertySet::variableCount() const
-{
-    ASSERT(RuntimeEnabledFeatures::cssVariablesEnabled());
-    unsigned count = 0;
-    for (unsigned i = 0; i < propertyCount(); ++i) {
-        if (propertyAt(i).id() == CSSPropertyVariable)
-            count++;
-    }
-    return count;
-}
-
-String StylePropertySet::variableValue(const AtomicString& name) const
-{
-    ASSERT(RuntimeEnabledFeatures::cssVariablesEnabled());
-    size_t index = findVariableIndex(name);
-    if (index == kNotFound)
-        return String();
-    return toCSSVariableValue(propertyAt(index).value())->value();
-}
-
 bool MutableStylePropertySet::removeShorthandProperty(CSSPropertyID propertyID)
 {
     StylePropertyShorthand shorthand = shorthandForProperty(propertyID);
@@ -286,28 +259,6 @@ unsigned getIndexInShorthandVectorForPrefixingVariant(const CSSProperty& propert
     return indexOfShorthandForLonghand(prefixedShorthand, shorthands);
 }
 
-bool MutableStylePropertySet::setVariableValue(const AtomicString& name, const String& value, bool important)
-{
-    ASSERT(RuntimeEnabledFeatures::cssVariablesEnabled());
-    if (value.isEmpty())
-        return removeVariable(name);
-
-    size_t index = findVariableIndex(name);
-    if (index != kNotFound) {
-        const CSSValue* cssValue = m_propertyVector.at(index).value();
-        if (toCSSVariableValue(cssValue)->value() == value)
-            return false;
-    }
-
-    CSSProperty property(CSSPropertyVariable, CSSVariableValue::create(name, value), important);
-    if (index == kNotFound) {
-        m_propertyVector.append(property);
-        return true;
-    }
-    m_propertyVector.at(index) = property;
-    return false;
-}
-
 void MutableStylePropertySet::appendPrefixingVariantProperty(const CSSProperty& property)
 {
     m_propertyVector.append(property);
@@ -342,13 +293,13 @@ void MutableStylePropertySet::parseDeclaration(const String& styleDeclaration, S
 {
     m_propertyVector.clear();
 
-    CSSParserContext context(cssParserMode());
+    CSSParserContext context(cssParserMode(), UseCounter::getFrom(contextStyleSheet));
     if (contextStyleSheet) {
         context = contextStyleSheet->parserContext();
         context.setMode(cssParserMode());
     }
 
-    BisonCSSParser parser(context, UseCounter::getFrom(contextStyleSheet));
+    BisonCSSParser parser(context);
     parser.parseDeclaration(this, styleDeclaration, 0, contextStyleSheet);
 }
 
@@ -412,9 +363,6 @@ static const CSSPropertyID staticBlockProperties[] = {
     CSSPropertyPageBreakAfter,
     CSSPropertyPageBreakBefore,
     CSSPropertyPageBreakInside,
-    CSSPropertyWebkitRegionBreakAfter,
-    CSSPropertyWebkitRegionBreakBefore,
-    CSSPropertyWebkitRegionBreakInside,
     CSSPropertyTextAlign,
     CSSPropertyTextAlignLast,
     CSSPropertyTextIndent,
@@ -489,17 +437,6 @@ int StylePropertySet::findPropertyIndex(CSSPropertyID propertyID) const
     return -1;
 }
 
-size_t StylePropertySet::findVariableIndex(const AtomicString& name) const
-{
-    ASSERT(RuntimeEnabledFeatures::cssVariablesEnabled());
-    for (int i = propertyCount() - 1; i >= 0; --i) {
-        const PropertyReference& property = propertyAt(i);
-        if (property.id() == CSSPropertyVariable && toCSSVariableValue(property.value())->name() == name)
-            return i;
-    }
-    return kNotFound;
-}
-
 CSSProperty* MutableStylePropertySet::findCSSPropertyWithID(CSSPropertyID propertyID)
 {
     int foundPropertyIndex = findPropertyIndex(propertyID);
@@ -544,23 +481,6 @@ void MutableStylePropertySet::removeEquivalentProperties(const CSSStyleDeclarati
         removeProperty(propertiesToRemove[i]);
 }
 
-bool MutableStylePropertySet::removeVariable(const AtomicString& name)
-{
-    ASSERT(RuntimeEnabledFeatures::cssVariablesEnabled());
-    size_t index = findVariableIndex(name);
-    if (index == kNotFound)
-        return false;
-    m_propertyVector.remove(index);
-    return true;
-}
-
-bool MutableStylePropertySet::clearVariables()
-{
-    ASSERT(RuntimeEnabledFeatures::cssVariablesEnabled());
-    CSSPropertyID variablesId = CSSPropertyVariable;
-    return removePropertiesInSet(&variablesId, 1);
-}
-
 PassRefPtr<MutableStylePropertySet> StylePropertySet::mutableCopy() const
 {
     return adoptRef(new MutableStylePropertySet(*this));
@@ -622,11 +542,6 @@ PassRefPtr<MutableStylePropertySet> MutableStylePropertySet::create(const CSSPro
 
 String StylePropertySet::PropertyReference::cssName() const
 {
-    if (id() == CSSPropertyVariable) {
-        if (!propertyValue()->isVariableValue())
-            return emptyString(); // Should not happen, but if it does, avoid a bad cast.
-        return "var-" + toCSSVariableValue(propertyValue())->name();
-    }
     return getPropertyNameString(id());
 }