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. | 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. |
7 * All rights reserved. | 7 * All rights reserved. |
8 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> | 8 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> |
9 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> | 9 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> |
10 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. | 10 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 default: | 106 default: |
107 return false; | 107 return false; |
108 } | 108 } |
109 } | 109 } |
110 | 110 |
111 } // namespace | 111 } // namespace |
112 | 112 |
113 void StyleBuilder::applyProperty(CSSPropertyID id, | 113 void StyleBuilder::applyProperty(CSSPropertyID id, |
114 StyleResolverState& state, | 114 StyleResolverState& state, |
115 const CSSValue& value) { | 115 const CSSValue& value) { |
116 if (id != CSSPropertyVariable && (value.isVariableReferenceValue() || | 116 if (id != CSSPropertyVariable && |
117 value.isPendingSubstitutionValue())) { | 117 (value.isVariableReferenceValue() || |
| 118 value.isPendingSubstitutionValue())) { |
118 bool omitAnimationTainted = CSSAnimations::isAnimationAffectingProperty(id); | 119 bool omitAnimationTainted = CSSAnimations::isAnimationAffectingProperty(id); |
119 const CSSValue* resolvedValue = | 120 const CSSValue* resolvedValue = |
120 CSSVariableResolver::resolveVariableReferences(state, id, value, | 121 CSSVariableResolver::resolveVariableReferences(state, id, value, |
121 omitAnimationTainted); | 122 omitAnimationTainted); |
122 applyProperty(id, state, *resolvedValue); | 123 applyProperty(id, state, *resolvedValue); |
123 | 124 |
124 if (!state.style()->hasVariableReferenceFromNonInheritedProperty() && | 125 if (!state.style()->hasVariableReferenceFromNonInheritedProperty() && |
125 !CSSPropertyMetadata::isInheritedProperty(id)) | 126 !CSSPropertyMetadata::isInheritedProperty(id)) |
126 state.style()->setHasVariableReferenceFromNonInheritedProperty(); | 127 state.style()->setHasVariableReferenceFromNonInheritedProperty(); |
127 return; | 128 return; |
128 } | 129 } |
129 | 130 |
130 DCHECK(!isShorthandProperty(id)) << "Shorthand property id = " << id | 131 DCHECK(!isShorthandProperty(id)) |
131 << " wasn't expanded at parsing time"; | 132 << "Shorthand property id = " << id << " wasn't expanded at parsing time"; |
132 | 133 |
133 bool isInherit = state.parentNode() && value.isInheritedValue(); | 134 bool isInherit = state.parentNode() && value.isInheritedValue(); |
134 bool isInitial = value.isInitialValue() || | 135 bool isInitial = value.isInitialValue() || |
135 (!state.parentNode() && value.isInheritedValue()); | 136 (!state.parentNode() && value.isInheritedValue()); |
136 | 137 |
137 // isInherit => !isInitial && isInitial => !isInherit | 138 // isInherit => !isInitial && isInitial => !isInherit |
138 DCHECK(!isInherit || !isInitial); | 139 DCHECK(!isInherit || !isInitial); |
139 // isInherit => (state.parentNode() && state.parentStyle()) | 140 // isInherit => (state.parentNode() && state.parentStyle()) |
140 DCHECK(!isInherit || (state.parentNode() && state.parentStyle())); | 141 DCHECK(!isInherit || (state.parentNode() && state.parentStyle())); |
141 | 142 |
(...skipping 789 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
931 | 932 |
932 state.style()->removeVariable(name, isInheritedProperty); | 933 state.style()->removeVariable(name, isInheritedProperty); |
933 if (initial) { | 934 if (initial) { |
934 return; | 935 return; |
935 } | 936 } |
936 | 937 |
937 DCHECK(inherit); | 938 DCHECK(inherit); |
938 CSSVariableData* parentValue = | 939 CSSVariableData* parentValue = |
939 state.parentStyle()->getVariable(name, isInheritedProperty); | 940 state.parentStyle()->getVariable(name, isInheritedProperty); |
940 const CSSValue* parentCSSValue = | 941 const CSSValue* parentCSSValue = |
941 registration && parentValue | 942 registration && parentValue ? state.parentStyle()->getRegisteredVariable( |
942 ? state.parentStyle()->getRegisteredVariable(name, | 943 name, isInheritedProperty) |
943 isInheritedProperty) | 944 : nullptr; |
944 : nullptr; | |
945 | 945 |
946 if (!isInheritedProperty) { | 946 if (!isInheritedProperty) { |
947 DCHECK(registration); | 947 DCHECK(registration); |
948 if (parentValue) { | 948 if (parentValue) { |
949 state.style()->setResolvedNonInheritedVariable(name, parentValue, | 949 state.style()->setResolvedNonInheritedVariable(name, parentValue, |
950 parentCSSValue); | 950 parentCSSValue); |
951 } | 951 } |
952 return; | 952 return; |
953 } | 953 } |
954 | 954 |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1029 state.style()->setCaretColor( | 1029 state.style()->setCaretColor( |
1030 StyleBuilderConverter::convertStyleAutoColor(state, value)); | 1030 StyleBuilderConverter::convertStyleAutoColor(state, value)); |
1031 } | 1031 } |
1032 if (state.applyPropertyToVisitedLinkStyle()) { | 1032 if (state.applyPropertyToVisitedLinkStyle()) { |
1033 state.style()->setVisitedLinkCaretColor( | 1033 state.style()->setVisitedLinkCaretColor( |
1034 StyleBuilderConverter::convertStyleAutoColor(state, value, true)); | 1034 StyleBuilderConverter::convertStyleAutoColor(state, value, true)); |
1035 } | 1035 } |
1036 } | 1036 } |
1037 | 1037 |
1038 } // namespace blink | 1038 } // namespace blink |
OLD | NEW |