| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 3 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 4 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) | 4 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) |
| 5 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) | 5 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) |
| 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc.
All rights reserved. | 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc.
All rights reserved. |
| 7 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> | 7 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> |
| 8 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> | 8 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> |
| 9 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) | 9 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) |
| 10 * Copyright (c) 2011, Code Aurora Forum. All rights reserved. | 10 * Copyright (c) 2011, Code Aurora Forum. All rights reserved. |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 #include "config.h" | 39 #include "config.h" |
| 40 | 40 |
| 41 #include "core/CSSPropertyNames.h" | 41 #include "core/CSSPropertyNames.h" |
| 42 #include "core/CSSValueKeywords.h" | 42 #include "core/CSSValueKeywords.h" |
| 43 #include "core/StyleBuilderFunctions.h" | 43 #include "core/StyleBuilderFunctions.h" |
| 44 #include "core/StylePropertyShorthand.h" | 44 #include "core/StylePropertyShorthand.h" |
| 45 #include "core/css/BasicShapeFunctions.h" | 45 #include "core/css/BasicShapeFunctions.h" |
| 46 #include "core/css/CSSBasicShapeValues.h" | 46 #include "core/css/CSSBasicShapeValues.h" |
| 47 #include "core/css/CSSCounterValue.h" | 47 #include "core/css/CSSCounterValue.h" |
| 48 #include "core/css/CSSCursorImageValue.h" | 48 #include "core/css/CSSCursorImageValue.h" |
| 49 #include "core/css/CSSCustomPropertyDeclaration.h" | |
| 50 #include "core/css/CSSFunctionValue.h" | 49 #include "core/css/CSSFunctionValue.h" |
| 51 #include "core/css/CSSGradientValue.h" | 50 #include "core/css/CSSGradientValue.h" |
| 52 #include "core/css/CSSGridTemplateAreasValue.h" | 51 #include "core/css/CSSGridTemplateAreasValue.h" |
| 53 #include "core/css/CSSHelper.h" | 52 #include "core/css/CSSHelper.h" |
| 54 #include "core/css/CSSImageSetValue.h" | 53 #include "core/css/CSSImageSetValue.h" |
| 55 #include "core/css/CSSPathValue.h" | 54 #include "core/css/CSSPathValue.h" |
| 56 #include "core/css/CSSPrimitiveValueMappings.h" | 55 #include "core/css/CSSPrimitiveValueMappings.h" |
| 57 #include "core/css/CSSPropertyMetadata.h" | 56 #include "core/css/CSSPropertyMetadata.h" |
| 58 #include "core/css/CSSURIValue.h" | 57 #include "core/css/CSSURIValue.h" |
| 59 #include "core/css/CSSValuePair.h" | 58 #include "core/css/CSSValuePair.h" |
| 60 #include "core/css/CSSVariableReferenceValue.h" | |
| 61 #include "core/css/StylePropertySet.h" | 59 #include "core/css/StylePropertySet.h" |
| 62 #include "core/css/StyleRule.h" | 60 #include "core/css/StyleRule.h" |
| 63 #include "core/css/resolver/CSSVariableResolver.h" | |
| 64 #include "core/css/resolver/ElementStyleResources.h" | 61 #include "core/css/resolver/ElementStyleResources.h" |
| 65 #include "core/css/resolver/FilterOperationResolver.h" | 62 #include "core/css/resolver/FilterOperationResolver.h" |
| 66 #include "core/css/resolver/FontBuilder.h" | 63 #include "core/css/resolver/FontBuilder.h" |
| 67 #include "core/css/resolver/StyleBuilder.h" | 64 #include "core/css/resolver/StyleBuilder.h" |
| 68 #include "core/css/resolver/TransformBuilder.h" | 65 #include "core/css/resolver/TransformBuilder.h" |
| 69 #include "core/frame/LocalFrame.h" | 66 #include "core/frame/LocalFrame.h" |
| 70 #include "core/frame/Settings.h" | 67 #include "core/frame/Settings.h" |
| 71 #include "core/style/CounterContent.h" | 68 #include "core/style/CounterContent.h" |
| 72 #include "core/style/ComputedStyle.h" | 69 #include "core/style/ComputedStyle.h" |
| 73 #include "core/style/ComputedStyleConstants.h" | 70 #include "core/style/ComputedStyleConstants.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 104 return true; | 101 return true; |
| 105 default: | 102 default: |
| 106 return false; | 103 return false; |
| 107 } | 104 } |
| 108 } | 105 } |
| 109 | 106 |
| 110 } // namespace | 107 } // namespace |
| 111 | 108 |
| 112 void StyleBuilder::applyProperty(CSSPropertyID id, StyleResolverState& state, CS
SValue* value) | 109 void StyleBuilder::applyProperty(CSSPropertyID id, StyleResolverState& state, CS
SValue* value) |
| 113 { | 110 { |
| 114 if (RuntimeEnabledFeatures::cssVariablesEnabled() && id != CSSPropertyVariab
le && value->isVariableReferenceValue()) { | |
| 115 CSSVariableResolver::resolveAndApplyVariableReferences(state, id, *toCSS
VariableReferenceValue(value)); | |
| 116 return; | |
| 117 } | |
| 118 | |
| 119 ASSERT_WITH_MESSAGE(!isShorthandProperty(id), "Shorthand property id = %d wa
sn't expanded at parsing time", id); | 111 ASSERT_WITH_MESSAGE(!isShorthandProperty(id), "Shorthand property id = %d wa
sn't expanded at parsing time", id); |
| 120 | 112 |
| 121 bool isInherit = state.parentNode() && value->isInheritedValue(); | 113 bool isInherit = state.parentNode() && value->isInheritedValue(); |
| 122 bool isInitial = value->isInitialValue() || (!state.parentNode() && value->i
sInheritedValue()); | 114 bool isInitial = value->isInitialValue() || (!state.parentNode() && value->i
sInheritedValue()); |
| 123 | 115 |
| 124 ASSERT(!isInherit || !isInitial); // isInherit -> !isInitial && isInitial ->
!isInherit | 116 ASSERT(!isInherit || !isInitial); // isInherit -> !isInitial && isInitial ->
!isInherit |
| 125 ASSERT(!isInherit || (state.parentNode() && state.parentStyle())); // isInhe
rit -> (state.parentNode() && state.parentStyle()) | 117 ASSERT(!isInherit || (state.parentNode() && state.parentStyle())); // isInhe
rit -> (state.parentNode() && state.parentStyle()) |
| 126 | 118 |
| 127 if (!state.applyPropertyToRegularStyle() && (!state.applyPropertyToVisitedLi
nkStyle() || !isValidVisitedLinkProperty(id))) { | 119 if (!state.applyPropertyToRegularStyle() && (!state.applyPropertyToVisitedLi
nkStyle() || !isValidVisitedLinkProperty(id))) { |
| 128 // Limit the properties that can be applied to only the ones honored by
:visited. | 120 // Limit the properties that can be applied to only the ones honored by
:visited. |
| (...skipping 685 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 814 void StyleBuilderFunctions::applyValueCSSPropertyTextOrientation(StyleResolverSt
ate& state, CSSValue* value) | 806 void StyleBuilderFunctions::applyValueCSSPropertyTextOrientation(StyleResolverSt
ate& state, CSSValue* value) |
| 815 { | 807 { |
| 816 state.setTextOrientation(toCSSPrimitiveValue(value)->convertTo<TextOrientati
on>()); | 808 state.setTextOrientation(toCSSPrimitiveValue(value)->convertTo<TextOrientati
on>()); |
| 817 } | 809 } |
| 818 | 810 |
| 819 void StyleBuilderFunctions::applyValueCSSPropertyWebkitTextOrientation(StyleReso
lverState& state, CSSValue* value) | 811 void StyleBuilderFunctions::applyValueCSSPropertyWebkitTextOrientation(StyleReso
lverState& state, CSSValue* value) |
| 820 { | 812 { |
| 821 state.setTextOrientation(toCSSPrimitiveValue(value)->convertTo<TextOrientati
on>()); | 813 state.setTextOrientation(toCSSPrimitiveValue(value)->convertTo<TextOrientati
on>()); |
| 822 } | 814 } |
| 823 | 815 |
| 824 void StyleBuilderFunctions::applyValueCSSPropertyVariable(StyleResolverState& st
ate, CSSValue* value) | |
| 825 { | |
| 826 CSSCustomPropertyDeclaration* declaration = toCSSCustomPropertyDeclaration(v
alue); | |
| 827 switch (declaration->id()) { | |
| 828 case CSSValueInitial: | |
| 829 state.style()->removeVariable(declaration->name()); | |
| 830 break; | |
| 831 | |
| 832 case CSSValueUnset: | |
| 833 case CSSValueInherit: { | |
| 834 state.style()->removeVariable(declaration->name()); | |
| 835 StyleVariableData* parentVariables = state.parentStyle()->variables(); | |
| 836 if (!parentVariables) | |
| 837 return; | |
| 838 CSSVariableData* value = parentVariables->getVariable(declaration->name(
)); | |
| 839 if (!value) | |
| 840 return; | |
| 841 state.style()->setVariable(declaration->name(), value); | |
| 842 break; | |
| 843 } | |
| 844 case CSSValueInternalVariableValue: | |
| 845 state.style()->setVariable(declaration->name(), declaration->value()); | |
| 846 break; | |
| 847 default: | |
| 848 ASSERT_NOT_REACHED(); | |
| 849 } | |
| 850 } | |
| 851 | |
| 852 void StyleBuilderFunctions::applyInheritCSSPropertyBaselineShift(StyleResolverSt
ate& state) | 816 void StyleBuilderFunctions::applyInheritCSSPropertyBaselineShift(StyleResolverSt
ate& state) |
| 853 { | 817 { |
| 854 const SVGComputedStyle& parentSvgStyle = state.parentStyle()->svgStyle(); | 818 const SVGComputedStyle& parentSvgStyle = state.parentStyle()->svgStyle(); |
| 855 EBaselineShift baselineShift = parentSvgStyle.baselineShift(); | 819 EBaselineShift baselineShift = parentSvgStyle.baselineShift(); |
| 856 SVGComputedStyle& svgStyle = state.style()->accessSVGStyle(); | 820 SVGComputedStyle& svgStyle = state.style()->accessSVGStyle(); |
| 857 svgStyle.setBaselineShift(baselineShift); | 821 svgStyle.setBaselineShift(baselineShift); |
| 858 if (baselineShift == BS_LENGTH) | 822 if (baselineShift == BS_LENGTH) |
| 859 svgStyle.setBaselineShiftValue(parentSvgStyle.baselineShiftValue()); | 823 svgStyle.setBaselineShiftValue(parentSvgStyle.baselineShiftValue()); |
| 860 } | 824 } |
| 861 | 825 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 878 return; | 842 return; |
| 879 case CSSValueSuper: | 843 case CSSValueSuper: |
| 880 svgStyle.setBaselineShift(BS_SUPER); | 844 svgStyle.setBaselineShift(BS_SUPER); |
| 881 return; | 845 return; |
| 882 default: | 846 default: |
| 883 ASSERT_NOT_REACHED(); | 847 ASSERT_NOT_REACHED(); |
| 884 } | 848 } |
| 885 } | 849 } |
| 886 | 850 |
| 887 } // namespace blink | 851 } // namespace blink |
| OLD | NEW |