| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/CSSPropertyEquality.h" | 5 #include "core/css/CSSPropertyEquality.h" |
| 6 | 6 |
| 7 #include "core/animation/PropertyHandle.h" |
| 7 #include "core/css/CSSValue.h" | 8 #include "core/css/CSSValue.h" |
| 8 #include "core/style/ComputedStyle.h" | 9 #include "core/style/ComputedStyle.h" |
| 9 #include "core/style/DataEquivalency.h" | 10 #include "core/style/DataEquivalency.h" |
| 10 #include "core/style/ShadowList.h" | 11 #include "core/style/ShadowList.h" |
| 11 | 12 |
| 12 // TODO(ikilpatrick): generate this file. | 13 // TODO(ikilpatrick): generate this file. |
| 13 | 14 |
| 14 namespace blink { | 15 namespace blink { |
| 15 | 16 |
| 16 namespace { | 17 namespace { |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 a_layer = a_layer->Next(); | 49 a_layer = a_layer->Next(); |
| 49 b_layer = b_layer->Next(); | 50 b_layer = b_layer->Next(); |
| 50 } | 51 } |
| 51 | 52 |
| 52 // FIXME: Shouldn't this be return !aLayer && !bLayer; ? | 53 // FIXME: Shouldn't this be return !aLayer && !bLayer; ? |
| 53 return true; | 54 return true; |
| 54 } | 55 } |
| 55 | 56 |
| 56 } // namespace | 57 } // namespace |
| 57 | 58 |
| 58 bool CSSPropertyEquality::PropertiesEqual(CSSPropertyID prop, | 59 bool CSSPropertyEquality::PropertiesEqual(const PropertyHandle& property, |
| 59 const ComputedStyle& a, | 60 const ComputedStyle& a, |
| 60 const ComputedStyle& b) { | 61 const ComputedStyle& b) { |
| 61 switch (prop) { | 62 if (property.IsCSSCustomProperty()) { |
| 63 const AtomicString& name = property.CustomPropertyName(); |
| 64 return DataEquivalent(a.GetRegisteredVariable(name), |
| 65 b.GetRegisteredVariable(name)); |
| 66 } |
| 67 switch (property.CssProperty()) { |
| 62 case CSSPropertyBackgroundColor: | 68 case CSSPropertyBackgroundColor: |
| 63 return a.BackgroundColor() == b.BackgroundColor() && | 69 return a.BackgroundColor() == b.BackgroundColor() && |
| 64 a.VisitedLinkBackgroundColor() == b.VisitedLinkBackgroundColor(); | 70 a.VisitedLinkBackgroundColor() == b.VisitedLinkBackgroundColor(); |
| 65 case CSSPropertyBackgroundImage: | 71 case CSSPropertyBackgroundImage: |
| 66 return FillLayersEqual<CSSPropertyBackgroundImage>(a.BackgroundLayers(), | 72 return FillLayersEqual<CSSPropertyBackgroundImage>(a.BackgroundLayers(), |
| 67 b.BackgroundLayers()); | 73 b.BackgroundLayers()); |
| 68 case CSSPropertyBackgroundPositionX: | 74 case CSSPropertyBackgroundPositionX: |
| 69 return FillLayersEqual<CSSPropertyBackgroundPositionX>( | 75 return FillLayersEqual<CSSPropertyBackgroundPositionX>( |
| 70 a.BackgroundLayers(), b.BackgroundLayers()); | 76 a.BackgroundLayers(), b.BackgroundLayers()); |
| 71 case CSSPropertyBackgroundPositionY: | 77 case CSSPropertyBackgroundPositionY: |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 371 return a.SvgStyle().Ry() == b.SvgStyle().Ry(); | 377 return a.SvgStyle().Ry() == b.SvgStyle().Ry(); |
| 372 case CSSPropertyZIndex: | 378 case CSSPropertyZIndex: |
| 373 return a.HasAutoZIndex() == b.HasAutoZIndex() && | 379 return a.HasAutoZIndex() == b.HasAutoZIndex() && |
| 374 (a.HasAutoZIndex() || a.ZIndex() == b.ZIndex()); | 380 (a.HasAutoZIndex() || a.ZIndex() == b.ZIndex()); |
| 375 default: | 381 default: |
| 376 NOTREACHED(); | 382 NOTREACHED(); |
| 377 return true; | 383 return true; |
| 378 } | 384 } |
| 379 } | 385 } |
| 380 | 386 |
| 381 bool CSSPropertyEquality::RegisteredCustomPropertiesEqual( | |
| 382 const AtomicString& property_name, | |
| 383 const ComputedStyle& a, | |
| 384 const ComputedStyle& b) { | |
| 385 return DataEquivalent(a.GetRegisteredVariable(property_name), | |
| 386 b.GetRegisteredVariable(property_name)); | |
| 387 } | |
| 388 | |
| 389 } // namespace blink | 387 } // namespace blink |
| OLD | NEW |