Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / core / css / resolver / StyleBuilderCustom.cpp
index 105bd34..fc398e9 100644 (file)
 #include "core/css/CSSHelper.h"
 #include "core/css/CSSImageSetValue.h"
 #include "core/css/CSSLineBoxContainValue.h"
-#include "core/css/parser/BisonCSSParser.h"
 #include "core/css/CSSPrimitiveValueMappings.h"
 #include "core/css/CSSPropertyMetadata.h"
 #include "core/css/Counter.h"
 #include "core/css/Pair.h"
-#include "core/css/Rect.h"
 #include "core/css/StylePropertySet.h"
 #include "core/css/StyleRule.h"
 #include "core/css/resolver/ElementStyleResources.h"
@@ -121,55 +119,12 @@ void StyleBuilder::applyProperty(CSSPropertyID id, StyleResolverState& state, CS
         return;
     }
 
-    CSSPrimitiveValue* primitiveValue = value->isPrimitiveValue() ? toCSSPrimitiveValue(value) : 0;
-    if (primitiveValue && primitiveValue->getValueID() == CSSValueCurrentcolor)
-        state.style()->setHasCurrentColor();
-
     if (isInherit && !state.parentStyle()->hasExplicitlyInheritedProperties() && !CSSPropertyMetadata::isInheritedProperty(id))
         state.parentStyle()->setHasExplicitlyInheritedProperties();
 
     StyleBuilder::applyProperty(id, state, value, isInitial, isInherit);
 }
 
-static Length clipConvertToLength(StyleResolverState& state, CSSPrimitiveValue* value)
-{
-    return value->convertToLength<FixedConversion | PercentConversion | AutoConversion>(state.cssToLengthConversionData());
-}
-
-void StyleBuilderFunctions::applyInitialCSSPropertyClip(StyleResolverState& state)
-{
-    state.style()->setClip(Length(), Length(), Length(), Length());
-    state.style()->setHasClip(false);
-}
-
-void StyleBuilderFunctions::applyInheritCSSPropertyClip(StyleResolverState& state)
-{
-    RenderStyle* parentStyle = state.parentStyle();
-    if (!parentStyle->hasClip())
-        return applyInitialCSSPropertyClip(state);
-    state.style()->setClip(parentStyle->clipTop(), parentStyle->clipRight(), parentStyle->clipBottom(), parentStyle->clipLeft());
-    state.style()->setHasClip(true);
-}
-
-void StyleBuilderFunctions::applyValueCSSPropertyClip(StyleResolverState& state, CSSValue* value)
-{
-    CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
-
-    if (primitiveValue->getValueID() == CSSValueAuto) {
-        state.style()->setClip(Length(), Length(), Length(), Length());
-        state.style()->setHasClip(false);
-        return;
-    }
-
-    Rect* rect = primitiveValue->getRectValue();
-    Length top = clipConvertToLength(state, rect->top());
-    Length right = clipConvertToLength(state, rect->right());
-    Length bottom = clipConvertToLength(state, rect->bottom());
-    Length left = clipConvertToLength(state, rect->left());
-    state.style()->setClip(top, right, bottom, left);
-    state.style()->setHasClip(true);
-}
-
 void StyleBuilderFunctions::applyInitialCSSPropertyColor(StyleResolverState& state)
 {
     Color color = RenderStyle::initialColor();
@@ -292,21 +247,6 @@ void StyleBuilderFunctions::applyValueCSSPropertyFontFamily(StyleResolverState&
     state.fontBuilder().setFontFamilyValue(value);
 }
 
-void StyleBuilderFunctions::applyInitialCSSPropertyFontSize(StyleResolverState& state)
-{
-    state.fontBuilder().setFontSizeInitial();
-}
-
-void StyleBuilderFunctions::applyInheritCSSPropertyFontSize(StyleResolverState& state)
-{
-    state.fontBuilder().setFontSizeInherit(state.parentFontDescription());
-}
-
-void StyleBuilderFunctions::applyValueCSSPropertyFontSize(StyleResolverState& state, CSSValue* value)
-{
-    state.fontBuilder().setFontSizeValue(value, state.parentStyle(), state.rootElementStyle());
-}
-
 void StyleBuilderFunctions::applyValueCSSPropertyGlyphOrientationVertical(StyleResolverState& state, CSSValue* value)
 {
     if (value->isPrimitiveValue() && toCSSPrimitiveValue(value)->getValueID() == CSSValueAuto)
@@ -872,25 +812,6 @@ void StyleBuilderFunctions::applyValueCSSPropertyWebkitFilter(StyleResolverState
         state.style()->setFilter(operations);
 }
 
-// FIXME: We should use the same system for this as the rest of the pseudo-shorthands (e.g. background-position)
-void StyleBuilderFunctions::applyInitialCSSPropertyWebkitPerspectiveOrigin(StyleResolverState& state)
-{
-    applyInitialCSSPropertyWebkitPerspectiveOriginX(state);
-    applyInitialCSSPropertyWebkitPerspectiveOriginY(state);
-}
-
-void StyleBuilderFunctions::applyInheritCSSPropertyWebkitPerspectiveOrigin(StyleResolverState& state)
-{
-    applyInheritCSSPropertyWebkitPerspectiveOriginX(state);
-    applyInheritCSSPropertyWebkitPerspectiveOriginY(state);
-}
-
-void StyleBuilderFunctions::applyValueCSSPropertyWebkitPerspectiveOrigin(StyleResolverState&, CSSValue* value)
-{
-    // This is expanded in the parser
-    ASSERT_NOT_REACHED();
-}
-
 void StyleBuilderFunctions::applyInitialCSSPropertyWebkitTextEmphasisStyle(StyleResolverState& state)
 {
     state.style()->setTextEmphasisFill(RenderStyle::initialTextEmphasisFill());
@@ -1178,20 +1099,6 @@ void StyleBuilderFunctions::applyValueCSSPropertyPerspective(StyleResolverState&
         state.style()->setPerspective(perspectiveValue);
 }
 
-void StyleBuilderFunctions::applyInitialCSSPropertyInternalCallback(StyleResolverState& state)
-{
-}
-
-void StyleBuilderFunctions::applyInheritCSSPropertyInternalCallback(StyleResolverState& state)
-{
-}
-
-void StyleBuilderFunctions::applyValueCSSPropertyInternalCallback(StyleResolverState& state, CSSValue* value)
-{
-    if (value->isPrimitiveValue() && toCSSPrimitiveValue(value)->getValueID() == CSSValueInternalPresence)
-        state.style()->addCallbackSelector(state.currentRule()->selectorList().selectorsText());
-}
-
 void StyleBuilderFunctions::applyValueCSSPropertyWebkitWritingMode(StyleResolverState& state, CSSValue* value)
 {
     if (value->isPrimitiveValue())
@@ -1220,28 +1127,25 @@ void StyleBuilderFunctions::applyInheritCSSPropertyBaselineShift(StyleResolverSt
 
 void StyleBuilderFunctions::applyValueCSSPropertyBaselineShift(StyleResolverState& state, CSSValue* value)
 {
-    if (!value->isPrimitiveValue())
-        return;
-
     SVGRenderStyle& svgStyle = state.style()->accessSVGStyle();
     CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
-    if (primitiveValue->getValueID()) {
-        switch (primitiveValue->getValueID()) {
-        case CSSValueBaseline:
-            svgStyle.setBaselineShift(BS_BASELINE);
-            break;
-        case CSSValueSub:
-            svgStyle.setBaselineShift(BS_SUB);
-            break;
-        case CSSValueSuper:
-            svgStyle.setBaselineShift(BS_SUPER);
-            break;
-        default:
-            break;
-        }
-    } else {
+    if (!primitiveValue->isValueID()) {
         svgStyle.setBaselineShift(BS_LENGTH);
         svgStyle.setBaselineShiftValue(SVGLength::fromCSSPrimitiveValue(primitiveValue));
+        return;
+    }
+    switch (primitiveValue->getValueID()) {
+    case CSSValueBaseline:
+        svgStyle.setBaselineShift(BS_BASELINE);
+        return;
+    case CSSValueSub:
+        svgStyle.setBaselineShift(BS_SUB);
+        return;
+    case CSSValueSuper:
+        svgStyle.setBaselineShift(BS_SUPER);
+        return;
+    default:
+        ASSERT_NOT_REACHED();
     }
 }