| 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 591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 602 result.append(left.value()->cssText()); | 602 result.append(left.value()->cssText()); |
| 603 } | 603 } |
| 604 return result.toString(); | 604 return result.toString(); |
| 605 } | 605 } |
| 606 | 606 |
| 607 String StylePropertySerializer::getLayeredShorthandValue(const StylePropertyShor
thand& shorthand) const | 607 String StylePropertySerializer::getLayeredShorthandValue(const StylePropertyShor
thand& shorthand) const |
| 608 { | 608 { |
| 609 const unsigned size = shorthand.length(); | 609 const unsigned size = shorthand.length(); |
| 610 | 610 |
| 611 // Begin by collecting the properties into a vector. | 611 // Begin by collecting the properties into a vector. |
| 612 WillBeHeapVector<const CSSValue*> values(size); | 612 WillBeHeapVector<RawPtrWillBeMember<const CSSValue>> values(size); |
| 613 // If the below loop succeeds, there should always be at minimum 1 layer. | 613 // If the below loop succeeds, there should always be at minimum 1 layer. |
| 614 size_t numLayers = 1U; | 614 size_t numLayers = 1U; |
| 615 | 615 |
| 616 for (size_t i = 0; i < size; i++) { | 616 for (size_t i = 0; i < size; i++) { |
| 617 values[i] = m_propertySet.getPropertyCSSValue(shorthand.properties()[i])
; | 617 values[i] = m_propertySet.getPropertyCSSValue(shorthand.properties()[i])
; |
| 618 // A shorthand is not available if getPropertyCSSValue didn't resolve to
anything. | 618 // A shorthand is not available if getPropertyCSSValue didn't resolve to
anything. |
| 619 if (!values[i]) | 619 if (!values[i]) |
| 620 return String(); | 620 return String(); |
| 621 if (values[i]->isBaseValueList()) { | 621 if (values[i]->isBaseValueList()) { |
| 622 const CSSValueList* valueList = toCSSValueList(values[i]); | 622 const CSSValueList* valueList = toCSSValueList(values[i]); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 655 // No point proceeding if there's not a value to look at. | 655 // No point proceeding if there's not a value to look at. |
| 656 if (!value) | 656 if (!value) |
| 657 continue; | 657 continue; |
| 658 | 658 |
| 659 // Special case for background-repeat. | 659 // Special case for background-repeat. |
| 660 if ((propertyIndex < size - 1 && m_propertySet.isPropertyImplicit(pr
operty)) | 660 if ((propertyIndex < size - 1 && m_propertySet.isPropertyImplicit(pr
operty)) |
| 661 && (property == CSSPropertyBackgroundRepeatX || property == CSSP
ropertyWebkitMaskRepeatX)) { | 661 && (property == CSSPropertyBackgroundRepeatX || property == CSSP
ropertyWebkitMaskRepeatX)) { |
| 662 ASSERT(shorthand.properties()[propertyIndex + 1] == CSSPropertyB
ackgroundRepeatY | 662 ASSERT(shorthand.properties()[propertyIndex + 1] == CSSPropertyB
ackgroundRepeatY |
| 663 || shorthand.properties()[propertyIndex + 1] == CSSPropertyW
ebkitMaskRepeatY); | 663 || shorthand.properties()[propertyIndex + 1] == CSSPropertyW
ebkitMaskRepeatY); |
| 664 const CSSValue* yValue = values[propertyIndex + 1]->isValueList(
) ? | 664 const CSSValue* yValue = values[propertyIndex + 1]->isValueList(
) ? |
| 665 toCSSValueList(values[propertyIndex + 1])->item(layer) : val
ues[propertyIndex + 1]; | 665 toCSSValueList(values[propertyIndex + 1])->item(layer) : val
ues[propertyIndex + 1].get(); |
| 666 | 666 |
| 667 | 667 |
| 668 // FIXME: At some point we need to fix this code to avoid return
ing an invalid shorthand, | 668 // FIXME: At some point we need to fix this code to avoid return
ing an invalid shorthand, |
| 669 // since some longhand combinations are not serializable into a
single shorthand. | 669 // since some longhand combinations are not serializable into a
single shorthand. |
| 670 if (!value->isPrimitiveValue() || !yValue->isPrimitiveValue()) | 670 if (!value->isPrimitiveValue() || !yValue->isPrimitiveValue()) |
| 671 continue; | 671 continue; |
| 672 | 672 |
| 673 CSSValueID xId = toCSSPrimitiveValue(value)->getValueID(); | 673 CSSValueID xId = toCSSPrimitiveValue(value)->getValueID(); |
| 674 CSSValueID yId = toCSSPrimitiveValue(yValue)->getValueID(); | 674 CSSValueID yId = toCSSPrimitiveValue(yValue)->getValueID(); |
| 675 // Maybe advance propertyIndex to look at the next CSSValue in t
he list for the checks below. | 675 // Maybe advance propertyIndex to look at the next CSSValue in t
he list for the checks below. |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 971 isInitialValue = false; | 971 isInitialValue = false; |
| 972 if (!value->isInheritedValue()) | 972 if (!value->isInheritedValue()) |
| 973 isInheritedValue = false; | 973 isInheritedValue = false; |
| 974 if (isImportant != m_propertySet.propertyIsImportant(shorthand.propertie
s()[i])) | 974 if (isImportant != m_propertySet.propertyIsImportant(shorthand.propertie
s()[i])) |
| 975 return false; | 975 return false; |
| 976 } | 976 } |
| 977 return isInitialValue || isInheritedValue; | 977 return isInitialValue || isInheritedValue; |
| 978 } | 978 } |
| 979 | 979 |
| 980 } | 980 } |
| OLD | NEW |