Chromium Code Reviews| 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 684 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 695 continue; | 695 continue; |
| 696 if (!result.isEmpty()) | 696 if (!result.isEmpty()) |
| 697 result.append(' '); | 697 result.append(' '); |
| 698 result.append(value); | 698 result.append(value); |
| 699 } | 699 } |
| 700 if (isInitialOrInherit(commonValue)) | 700 if (isInitialOrInherit(commonValue)) |
| 701 return commonValue; | 701 return commonValue; |
| 702 return result.isEmpty() ? String() : result.toString(); | 702 return result.isEmpty() ? String() : result.toString(); |
| 703 } | 703 } |
| 704 | 704 |
| 705 static void buildSingleBackgroundRepeatValue(StringBuilder& builder, const CSSVa lue& repeatXValue, const CSSValue& repeatYValue) | 705 static void appendBackgroundRepeatValue(StringBuilder& builder, const CSSValue& repeatXCSSValue, const CSSValue& repeatYCSSValue) |
| 706 { | 706 { |
| 707 CSSValueID repeatXValueId = toCSSPrimitiveValue(repeatXValue).getValueID(); | 707 // FIXME: Ensure initial values do not appear in CSS_VALUE_LISTS. |
|
rune
2014/05/31 22:36:01
Shouldn't this be fixed instead?
This seems to be
alancutter (OOO until 2018)
2014/06/01 03:57:37
That was my initial approach but the change was ge
rune
2014/06/02 06:54:50
I cannot access the issue for this CL in bugs.chro
| |
| 708 CSSValueID repeatYValueId = toCSSPrimitiveValue(repeatYValue).getValueID(); | 708 DEFINE_STATIC_REF_WILL_BE_PERSISTENT(CSSPrimitiveValue, initialRepeatValue, CSSPrimitiveValue::create(CSSValueRepeat)); |
| 709 const CSSPrimitiveValue& repeatX = repeatXCSSValue.isInitialValue() ? *initi alRepeatValue : toCSSPrimitiveValue(repeatXCSSValue); | |
| 710 const CSSPrimitiveValue& repeatY = repeatYCSSValue.isInitialValue() ? *initi alRepeatValue : toCSSPrimitiveValue(repeatYCSSValue); | |
| 711 CSSValueID repeatXValueId = repeatX.getValueID(); | |
| 712 CSSValueID repeatYValueId = repeatY.getValueID(); | |
| 709 if (repeatXValueId == repeatYValueId) { | 713 if (repeatXValueId == repeatYValueId) { |
| 710 builder.append(repeatXValue.cssText()); | 714 builder.append(repeatX.cssText()); |
| 711 } else if (repeatXValueId == CSSValueNoRepeat && repeatYValueId == CSSValueR epeat) { | 715 } else if (repeatXValueId == CSSValueNoRepeat && repeatYValueId == CSSValueR epeat) { |
| 712 builder.append("repeat-y"); | 716 builder.append("repeat-y"); |
| 713 } else if (repeatXValueId == CSSValueRepeat && repeatYValueId == CSSValueNoR epeat) { | 717 } else if (repeatXValueId == CSSValueRepeat && repeatYValueId == CSSValueNoR epeat) { |
| 714 builder.append("repeat-x"); | 718 builder.append("repeat-x"); |
| 715 } else { | 719 } else { |
| 716 builder.append(repeatXValue.cssText()); | 720 builder.append(repeatX.cssText()); |
| 717 builder.append(" "); | 721 builder.append(" "); |
| 718 builder.append(repeatYValue.cssText()); | 722 builder.append(repeatY.cssText()); |
| 719 } | 723 } |
| 720 } | 724 } |
| 721 | 725 |
| 722 String StylePropertySerializer::backgroundRepeatPropertyValue() const | 726 String StylePropertySerializer::backgroundRepeatPropertyValue() const |
| 723 { | 727 { |
| 724 RefPtrWillBeRawPtr<CSSValue> repeatX = m_propertySet.getPropertyCSSValue(CSS PropertyBackgroundRepeatX); | 728 RefPtrWillBeRawPtr<CSSValue> repeatX = m_propertySet.getPropertyCSSValue(CSS PropertyBackgroundRepeatX); |
| 725 RefPtrWillBeRawPtr<CSSValue> repeatY = m_propertySet.getPropertyCSSValue(CSS PropertyBackgroundRepeatY); | 729 RefPtrWillBeRawPtr<CSSValue> repeatY = m_propertySet.getPropertyCSSValue(CSS PropertyBackgroundRepeatY); |
| 726 if (!repeatX || !repeatY) | 730 if (!repeatX || !repeatY) |
| 727 return String(); | 731 return String(); |
| 728 if (m_propertySet.propertyIsImportant(CSSPropertyBackgroundRepeatX) != m_pro pertySet.propertyIsImportant(CSSPropertyBackgroundRepeatY)) | 732 if (m_propertySet.propertyIsImportant(CSSPropertyBackgroundRepeatX) != m_pro pertySet.propertyIsImportant(CSSPropertyBackgroundRepeatY)) |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 750 repeatYList = toCSSValueList(repeatY.get()); | 754 repeatYList = toCSSValueList(repeatY.get()); |
| 751 } else { | 755 } else { |
| 752 return String(); | 756 return String(); |
| 753 } | 757 } |
| 754 | 758 |
| 755 size_t shorthandLength = lowestCommonMultiple(repeatXList->length(), repeatY List->length()); | 759 size_t shorthandLength = lowestCommonMultiple(repeatXList->length(), repeatY List->length()); |
| 756 StringBuilder builder; | 760 StringBuilder builder; |
| 757 for (size_t i = 0; i < shorthandLength; ++i) { | 761 for (size_t i = 0; i < shorthandLength; ++i) { |
| 758 if (i) | 762 if (i) |
| 759 builder.append(", "); | 763 builder.append(", "); |
| 760 buildSingleBackgroundRepeatValue(builder, | 764 appendBackgroundRepeatValue(builder, |
| 761 *repeatXList->item(i % repeatXList->length()), | 765 *repeatXList->item(i % repeatXList->length()), |
| 762 *repeatYList->item(i % repeatYList->length())); | 766 *repeatYList->item(i % repeatYList->length())); |
| 763 } | 767 } |
| 764 return builder.toString(); | 768 return builder.toString(); |
| 765 } | 769 } |
| 766 | 770 |
| 767 void StylePropertySerializer::appendBackgroundPropertyAsText(StringBuilder& resu lt, unsigned& numDecls) const | 771 void StylePropertySerializer::appendBackgroundPropertyAsText(StringBuilder& resu lt, unsigned& numDecls) const |
| 768 { | 772 { |
| 769 if (isPropertyShorthandAvailable(backgroundShorthand())) { | 773 if (isPropertyShorthandAvailable(backgroundShorthand())) { |
| 770 String backgroundValue = getPropertyValue(CSSPropertyBackground); | 774 String backgroundValue = getPropertyValue(CSSPropertyBackground); |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 860 isInitialValue = false; | 864 isInitialValue = false; |
| 861 if (!value->isInheritedValue()) | 865 if (!value->isInheritedValue()) |
| 862 isInheritedValue = false; | 866 isInheritedValue = false; |
| 863 if (isImportant != m_propertySet.propertyIsImportant(shorthand.propertie s()[i])) | 867 if (isImportant != m_propertySet.propertyIsImportant(shorthand.propertie s()[i])) |
| 864 return false; | 868 return false; |
| 865 } | 869 } |
| 866 return isInitialValue || isInheritedValue; | 870 return isInitialValue || isInheritedValue; |
| 867 } | 871 } |
| 868 | 872 |
| 869 } | 873 } |
| OLD | NEW |