| OLD | NEW |
| 1 /* | 1 /* |
| 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org) | 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org) |
| 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All r
ights reserved. | 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All r
ights reserved. |
| 4 * Copyright (C) 2011 Research In Motion Limited. All rights reserved. | 4 * Copyright (C) 2011 Research In Motion Limited. All rights reserved. |
| 5 * Copyright (C) 2013 Intel Corporation. All rights reserved. | 5 * Copyright (C) 2013 Intel Corporation. All rights reserved. |
| 6 * | 6 * |
| 7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
| 8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
| 9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
| 10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
| (...skipping 641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 652 bool hasCommonValue = true; | 652 bool hasCommonValue = true; |
| 653 const CSSValue* commonValue = nullptr; | 653 const CSSValue* commonValue = nullptr; |
| 654 | 654 |
| 655 // Now stitch the properties together. Implicit initial values are flagged a
s such and | 655 // Now stitch the properties together. Implicit initial values are flagged a
s such and |
| 656 // can safely be omitted. | 656 // can safely be omitted. |
| 657 for (size_t layer = 0; layer < numLayers; layer++) { | 657 for (size_t layer = 0; layer < numLayers; layer++) { |
| 658 StringBuilder layerResult; | 658 StringBuilder layerResult; |
| 659 bool useRepeatXShorthand = false; | 659 bool useRepeatXShorthand = false; |
| 660 bool useRepeatYShorthand = false; | 660 bool useRepeatYShorthand = false; |
| 661 bool useSingleWordShorthand = false; | 661 bool useSingleWordShorthand = false; |
| 662 bool foundPositionXCSSProperty = false; |
| 662 bool foundPositionYCSSProperty = false; | 663 bool foundPositionYCSSProperty = false; |
| 663 | 664 |
| 664 for (unsigned propertyIndex = 0; propertyIndex < size; propertyIndex++)
{ | 665 for (unsigned propertyIndex = 0; propertyIndex < size; propertyIndex++)
{ |
| 665 const CSSValue* value = nullptr; | 666 const CSSValue* value = nullptr; |
| 666 CSSPropertyID property = shorthand.properties()[propertyIndex]; | 667 CSSPropertyID property = shorthand.properties()[propertyIndex]; |
| 667 | 668 |
| 668 // Get a CSSValue for this property and layer. | 669 // Get a CSSValue for this property and layer. |
| 669 if (values[propertyIndex]->isBaseValueList()) { | 670 if (values[propertyIndex]->isBaseValueList()) { |
| 670 // Might return 0 if there is not an item for this layer for thi
s property. | 671 // Might return 0 if there is not an item for this layer for thi
s property. |
| 671 value = toCSSValueList(values[propertyIndex])->itemWithBoundsChe
ck(layer); | 672 value = toCSSValueList(values[propertyIndex])->itemWithBoundsChe
ck(layer); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 702 useRepeatXShorthand = true; | 703 useRepeatXShorthand = true; |
| 703 property = shorthand.properties()[++propertyIndex]; | 704 property = shorthand.properties()[++propertyIndex]; |
| 704 } else if (xId == CSSValueNoRepeat && yId == CSSValueRepeat) { | 705 } else if (xId == CSSValueNoRepeat && yId == CSSValueRepeat) { |
| 705 useRepeatYShorthand = true; | 706 useRepeatYShorthand = true; |
| 706 property = shorthand.properties()[++propertyIndex]; | 707 property = shorthand.properties()[++propertyIndex]; |
| 707 } | 708 } |
| 708 } | 709 } |
| 709 | 710 |
| 710 if (!(value->isInitialValue() && toCSSInitialValue(value)->isImplici
t())) { | 711 if (!(value->isInitialValue() && toCSSInitialValue(value)->isImplici
t())) { |
| 711 if (property == CSSPropertyBackgroundSize || property == CSSProp
ertyWebkitMaskSize) { | 712 if (property == CSSPropertyBackgroundSize || property == CSSProp
ertyWebkitMaskSize) { |
| 712 if (foundPositionYCSSProperty) | 713 if (foundPositionYCSSProperty || foundPositionXCSSProperty) |
| 713 layerResult.appendLiteral(" / "); | 714 layerResult.appendLiteral(" / "); |
| 714 else | 715 else |
| 715 continue; | 716 layerResult.appendLiteral(" 0% 0% / "); |
| 716 } else if (!layerResult.isEmpty()) { | 717 } else if (!layerResult.isEmpty()) { |
| 717 // Do this second to avoid ending up with an extra space in
the output if we hit the continue above. | 718 // Do this second to avoid ending up with an extra space in
the output if we hit the continue above. |
| 718 layerResult.append(' '); | 719 layerResult.append(' '); |
| 719 } | 720 } |
| 720 | 721 |
| 721 if (useRepeatXShorthand) { | 722 if (useRepeatXShorthand) { |
| 722 useRepeatXShorthand = false; | 723 useRepeatXShorthand = false; |
| 723 layerResult.append(getValueName(CSSValueRepeatX)); | 724 layerResult.append(getValueName(CSSValueRepeatX)); |
| 724 } else if (useRepeatYShorthand) { | 725 } else if (useRepeatYShorthand) { |
| 725 useRepeatYShorthand = false; | 726 useRepeatYShorthand = false; |
| 726 layerResult.append(getValueName(CSSValueRepeatY)); | 727 layerResult.append(getValueName(CSSValueRepeatY)); |
| 727 } else { | 728 } else { |
| 728 if (useSingleWordShorthand) | 729 if (useSingleWordShorthand) |
| 729 useSingleWordShorthand = false; | 730 useSingleWordShorthand = false; |
| 730 layerResult.append(value->cssText()); | 731 layerResult.append(value->cssText()); |
| 731 } | 732 } |
| 733 if (property == CSSPropertyBackgroundPositionX || property == CS
SPropertyWebkitMaskPositionX) |
| 734 foundPositionXCSSProperty = true; |
| 732 if (property == CSSPropertyBackgroundPositionY || property == CS
SPropertyWebkitMaskPositionY) { | 735 if (property == CSSPropertyBackgroundPositionY || property == CS
SPropertyWebkitMaskPositionY) { |
| 733 foundPositionYCSSProperty = true; | 736 foundPositionYCSSProperty = true; |
| 734 // background-position is a special case. If only the first
offset is specified, | 737 // background-position is a special case. If only the first
offset is specified, |
| 735 // the second one defaults to "center", not the same value. | 738 // the second one defaults to "center", not the same value. |
| 736 if (hasCommonValue && !value->isInitialValue() && !value->is
InheritedValue()) | 739 if (hasCommonValue && !value->isInitialValue() && !value->is
InheritedValue()) |
| 737 hasCommonValue = false; | 740 hasCommonValue = false; |
| 738 } | 741 } |
| 739 } | 742 } |
| 740 | 743 |
| 741 if (hasCommonValue && !commonValue) | 744 if (hasCommonValue && !commonValue) |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 993 isInitialValue = false; | 996 isInitialValue = false; |
| 994 if (!value->isInheritedValue()) | 997 if (!value->isInheritedValue()) |
| 995 isInheritedValue = false; | 998 isInheritedValue = false; |
| 996 if (isImportant != m_propertySet.propertyIsImportant(shorthand.propertie
s()[i])) | 999 if (isImportant != m_propertySet.propertyIsImportant(shorthand.propertie
s()[i])) |
| 997 return false; | 1000 return false; |
| 998 } | 1001 } |
| 999 return isInitialValue || isInheritedValue; | 1002 return isInitialValue || isInheritedValue; |
| 1000 } | 1003 } |
| 1001 | 1004 |
| 1002 } // namespace blink | 1005 } // namespace blink |
| OLD | NEW |