Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "core/css/PropertyRegistration.h" | 5 #include "core/css/PropertyRegistration.h" |
| 6 | 6 |
| 7 #include "core/animation/CSSInterpolationTypesMap.h" | 7 #include "core/animation/CSSInterpolationTypesMap.h" |
| 8 #include "core/css/CSSStyleSheet.h" | 8 #include "core/css/CSSStyleSheet.h" |
| 9 #include "core/css/CSSSyntaxDescriptor.h" | 9 #include "core/css/CSSSyntaxDescriptor.h" |
| 10 #include "core/css/CSSValueList.h" | 10 #include "core/css/CSSValueList.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 56 ->NeedsVariableResolution(); | 56 ->NeedsVariableResolution(); |
| 57 | 57 |
| 58 if (value.IsValueList()) { | 58 if (value.IsValueList()) { |
| 59 for (const CSSValue* inner_value : ToCSSValueList(value)) { | 59 for (const CSSValue* inner_value : ToCSSValueList(value)) { |
| 60 if (!ComputationallyIndependent(*inner_value)) | 60 if (!ComputationallyIndependent(*inner_value)) |
| 61 return false; | 61 return false; |
| 62 } | 62 } |
| 63 return true; | 63 return true; |
| 64 } | 64 } |
| 65 | 65 |
| 66 if (value.IsFunctionValue()) { | |
|
meade_UTC10
2017/06/28 07:20:03
CSSFunctionValue inherits from CSSValueList, and f
Hwanseung Lee
2017/06/28 23:37:31
it is working well without these lines.
i removed
| |
| 67 for (const CSSValue* inner_value : ToCSSFunctionValue(value)) { | |
| 68 if (!ComputationallyIndependent(*inner_value)) { | |
| 69 return false; | |
| 70 } | |
| 71 } | |
| 72 return true; | |
| 73 } | |
| 74 | |
| 66 if (value.IsPrimitiveValue()) { | 75 if (value.IsPrimitiveValue()) { |
| 67 const CSSPrimitiveValue& primitive_value = ToCSSPrimitiveValue(value); | 76 const CSSPrimitiveValue& primitive_value = ToCSSPrimitiveValue(value); |
| 68 if (!primitive_value.IsLength() && | 77 if (!primitive_value.IsLength() && |
| 69 !primitive_value.IsCalculatedPercentageWithLength()) | 78 !primitive_value.IsCalculatedPercentageWithLength()) |
| 70 return true; | 79 return true; |
| 71 | 80 |
| 72 CSSPrimitiveValue::CSSLengthArray length_array; | 81 CSSPrimitiveValue::CSSLengthArray length_array; |
| 73 primitive_value.AccumulateLengthArray(length_array); | 82 primitive_value.AccumulateLengthArray(length_array); |
| 74 for (size_t i = 0; i < length_array.values.size(); i++) { | 83 for (size_t i = 0; i < length_array.values.size(); i++) { |
| 75 if (length_array.type_flags.Get(i) && | 84 if (length_array.type_flags.Get(i) && |
| 76 i != CSSPrimitiveValue::kUnitTypePixels && | 85 i != CSSPrimitiveValue::kUnitTypePixels && |
| 77 i != CSSPrimitiveValue::kUnitTypePercentage) | 86 i != CSSPrimitiveValue::kUnitTypePercentage) |
| 78 return false; | 87 return false; |
| 79 } | 88 } |
| 80 return true; | 89 return true; |
| 81 } | 90 } |
| 82 | 91 |
| 83 // TODO(timloh): Images and transform-function values can also contain | 92 // TODO(timloh): Images values can also contain lengths. |
| 84 // lengths. | |
| 85 | 93 |
| 86 return true; | 94 return true; |
| 87 } | 95 } |
| 88 | 96 |
| 89 void PropertyRegistration::registerProperty( | 97 void PropertyRegistration::registerProperty( |
| 90 ExecutionContext* execution_context, | 98 ExecutionContext* execution_context, |
| 91 const PropertyDescriptor& descriptor, | 99 const PropertyDescriptor& descriptor, |
| 92 ExceptionState& exception_state) { | 100 ExceptionState& exception_state) { |
| 93 // Bindings code ensures these are set. | 101 // Bindings code ensures these are set. |
| 94 DCHECK(descriptor.hasName()); | 102 DCHECK(descriptor.hasName()); |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 161 std::move(css_interpolation_types)); | 169 std::move(css_interpolation_types)); |
| 162 } | 170 } |
| 163 | 171 |
| 164 // TODO(timloh): Invalidate only elements with this custom property set | 172 // TODO(timloh): Invalidate only elements with this custom property set |
| 165 document->SetNeedsStyleRecalc(kSubtreeStyleChange, | 173 document->SetNeedsStyleRecalc(kSubtreeStyleChange, |
| 166 StyleChangeReasonForTracing::Create( | 174 StyleChangeReasonForTracing::Create( |
| 167 StyleChangeReason::kPropertyRegistration)); | 175 StyleChangeReason::kPropertyRegistration)); |
| 168 } | 176 } |
| 169 | 177 |
| 170 } // namespace blink | 178 } // namespace blink |
| OLD | NEW |