| 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 25 matching lines...) Expand all Loading... |
| 36 DEFINE_STATIC_LOCAL(String, initial, ("initial")); | 36 DEFINE_STATIC_LOCAL(String, initial, ("initial")); |
| 37 DEFINE_STATIC_LOCAL(String, inherit, ("inherit")); | 37 DEFINE_STATIC_LOCAL(String, inherit, ("inherit")); |
| 38 return value.length() == 7 && (value == initial || value == inherit); | 38 return value.length() == 7 && (value == initial || value == inherit); |
| 39 } | 39 } |
| 40 | 40 |
| 41 StylePropertySerializer::StylePropertySerializer(const StylePropertySet& propert
ies) | 41 StylePropertySerializer::StylePropertySerializer(const StylePropertySet& propert
ies) |
| 42 : m_propertySet(properties) | 42 : m_propertySet(properties) |
| 43 { | 43 { |
| 44 } | 44 } |
| 45 | 45 |
| 46 String StylePropertySerializer::getPropertyText(CSSPropertyID propertyID, const
String& value, bool isImportant, bool isNotFirstDecl) const | 46 String StylePropertySerializer::getPropertyText(CSSPropertyID propertyID, const
String& value, bool isNotFirstDecl) const |
| 47 { | 47 { |
| 48 StringBuilder result; | 48 StringBuilder result; |
| 49 if (isNotFirstDecl) | 49 if (isNotFirstDecl) |
| 50 result.append(' '); | 50 result.append(' '); |
| 51 result.append(getPropertyName(propertyID)); | 51 result.append(getPropertyName(propertyID)); |
| 52 result.appendLiteral(": "); | 52 result.appendLiteral(": "); |
| 53 result.append(value); | 53 result.append(value); |
| 54 if (isImportant) | |
| 55 result.appendLiteral(" !important"); | |
| 56 result.append(';'); | 54 result.append(';'); |
| 57 return result.toString(); | 55 return result.toString(); |
| 58 } | 56 } |
| 59 | 57 |
| 60 String StylePropertySerializer::asText() const | 58 String StylePropertySerializer::asText() const |
| 61 { | 59 { |
| 62 StringBuilder result; | 60 StringBuilder result; |
| 63 | 61 |
| 64 BitArray<numCSSProperties> shorthandPropertyUsed; | 62 BitArray<numCSSProperties> shorthandPropertyUsed; |
| 65 BitArray<numCSSProperties> shorthandPropertyAppeared; | 63 BitArray<numCSSProperties> shorthandPropertyAppeared; |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 if (shorthandPropertyID) { | 213 if (shorthandPropertyID) { |
| 216 propertyID = shorthandPropertyID; | 214 propertyID = shorthandPropertyID; |
| 217 shorthandPropertyUsed.set(shortPropertyIndex); | 215 shorthandPropertyUsed.set(shortPropertyIndex); |
| 218 } | 216 } |
| 219 } else | 217 } else |
| 220 value = property.value()->cssText(); | 218 value = property.value()->cssText(); |
| 221 | 219 |
| 222 if (value == "initial" && !CSSPropertyMetadata::isInheritedProperty(prop
ertyID)) | 220 if (value == "initial" && !CSSPropertyMetadata::isInheritedProperty(prop
ertyID)) |
| 223 continue; | 221 continue; |
| 224 | 222 |
| 225 result.append(getPropertyText(propertyID, value, property.isImportant(),
numDecls++)); | 223 result.append(getPropertyText(propertyID, value, numDecls++)); |
| 226 } | 224 } |
| 227 | 225 |
| 228 if (shorthandPropertyAppeared.get(CSSPropertyBackground - firstCSSProperty)) | 226 if (shorthandPropertyAppeared.get(CSSPropertyBackground - firstCSSProperty)) |
| 229 appendBackgroundPropertyAsText(result, numDecls); | 227 appendBackgroundPropertyAsText(result, numDecls); |
| 230 | 228 |
| 231 ASSERT(!numDecls ^ !result.isEmpty()); | 229 ASSERT(!numDecls ^ !result.isEmpty()); |
| 232 return result.toString(); | 230 return result.toString(); |
| 233 } | 231 } |
| 234 | 232 |
| 235 String StylePropertySerializer::getPropertyValue(CSSPropertyID propertyID) const | 233 String StylePropertySerializer::getPropertyValue(CSSPropertyID propertyID) const |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 407 if (top.isInherited() && right.isInherited() && bottom.isInherited() && left
.isInherited()) | 405 if (top.isInherited() && right.isInherited() && bottom.isInherited() && left
.isInherited()) |
| 408 return getValueName(CSSValueInherit); | 406 return getValueName(CSSValueInherit); |
| 409 | 407 |
| 410 if (top.value()->isInitialValue() || right.value()->isInitialValue() || bott
om.value()->isInitialValue() || left.value()->isInitialValue()) { | 408 if (top.value()->isInitialValue() || right.value()->isInitialValue() || bott
om.value()->isInitialValue() || left.value()->isInitialValue()) { |
| 411 if (top.value()->isInitialValue() && right.value()->isInitialValue() &&
bottom.value()->isInitialValue() && left.value()->isInitialValue() && !top.isImp
licit()) { | 409 if (top.value()->isInitialValue() && right.value()->isInitialValue() &&
bottom.value()->isInitialValue() && left.value()->isInitialValue() && !top.isImp
licit()) { |
| 412 // All components are "initial" and "top" is not implicit. | 410 // All components are "initial" and "top" is not implicit. |
| 413 return getValueName(CSSValueInitial); | 411 return getValueName(CSSValueInitial); |
| 414 } | 412 } |
| 415 return String(); | 413 return String(); |
| 416 } | 414 } |
| 417 if (top.isImportant() != right.isImportant() || right.isImportant() != botto
m.isImportant() || bottom.isImportant() != left.isImportant()) | |
| 418 return String(); | |
| 419 | 415 |
| 420 bool showLeft = !right.value()->equals(*left.value()); | 416 bool showLeft = !right.value()->equals(*left.value()); |
| 421 bool showBottom = !top.value()->equals(*bottom.value()) || showLeft; | 417 bool showBottom = !top.value()->equals(*bottom.value()) || showLeft; |
| 422 bool showRight = !top.value()->equals(*right.value()) || showBottom; | 418 bool showRight = !top.value()->equals(*right.value()) || showBottom; |
| 423 | 419 |
| 424 StringBuilder result; | 420 StringBuilder result; |
| 425 result.append(top.value()->cssText()); | 421 result.append(top.value()->cssText()); |
| 426 if (showRight) { | 422 if (showRight) { |
| 427 result.append(' '); | 423 result.append(' '); |
| 428 result.append(right.value()->cssText()); | 424 result.append(right.value()->cssText()); |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 615 return commonValue; | 611 return commonValue; |
| 616 if (result.isEmpty()) | 612 if (result.isEmpty()) |
| 617 return String(); | 613 return String(); |
| 618 return result.toString(); | 614 return result.toString(); |
| 619 } | 615 } |
| 620 | 616 |
| 621 // only returns a non-null value if all properties have the same, non-null value | 617 // only returns a non-null value if all properties have the same, non-null value |
| 622 String StylePropertySerializer::getCommonValue(const StylePropertyShorthand& sho
rthand) const | 618 String StylePropertySerializer::getCommonValue(const StylePropertyShorthand& sho
rthand) const |
| 623 { | 619 { |
| 624 String res; | 620 String res; |
| 625 bool lastPropertyWasImportant = false; | |
| 626 for (unsigned i = 0; i < shorthand.length(); ++i) { | 621 for (unsigned i = 0; i < shorthand.length(); ++i) { |
| 627 RefPtr<CSSValue> value = m_propertySet.getPropertyCSSValue(shorthand.pro
perties()[i]); | 622 RefPtr<CSSValue> value = m_propertySet.getPropertyCSSValue(shorthand.pro
perties()[i]); |
| 628 // FIXME: CSSInitialValue::cssText should generate the right value. | 623 // FIXME: CSSInitialValue::cssText should generate the right value. |
| 629 if (!value) | 624 if (!value) |
| 630 return String(); | 625 return String(); |
| 631 String text = value->cssText(); | 626 String text = value->cssText(); |
| 632 if (text.isNull()) | 627 if (text.isNull()) |
| 633 return String(); | 628 return String(); |
| 634 if (res.isNull()) | 629 if (res.isNull()) |
| 635 res = text; | 630 res = text; |
| 636 else if (res != text) | 631 else if (res != text) |
| 637 return String(); | 632 return String(); |
| 638 | |
| 639 bool currentPropertyIsImportant = m_propertySet.propertyIsImportant(shor
thand.properties()[i]); | |
| 640 if (i && lastPropertyWasImportant != currentPropertyIsImportant) | |
| 641 return String(); | |
| 642 lastPropertyWasImportant = currentPropertyIsImportant; | |
| 643 } | 633 } |
| 644 return res; | 634 return res; |
| 645 } | 635 } |
| 646 | 636 |
| 647 String StylePropertySerializer::borderPropertyValue(CommonValueMode valueMode) c
onst | 637 String StylePropertySerializer::borderPropertyValue(CommonValueMode valueMode) c
onst |
| 648 { | 638 { |
| 649 const StylePropertyShorthand properties[3] = { borderWidthShorthand(), borde
rStyleShorthand(), borderColorShorthand() }; | 639 const StylePropertyShorthand properties[3] = { borderWidthShorthand(), borde
rStyleShorthand(), borderColorShorthand() }; |
| 650 String commonValue; | 640 String commonValue; |
| 651 StringBuilder result; | 641 StringBuilder result; |
| 652 for (size_t i = 0; i < WTF_ARRAY_LENGTH(properties); ++i) { | 642 for (size_t i = 0; i < WTF_ARRAY_LENGTH(properties); ++i) { |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 692 builder.append(repeatY.cssText()); | 682 builder.append(repeatY.cssText()); |
| 693 } | 683 } |
| 694 } | 684 } |
| 695 | 685 |
| 696 String StylePropertySerializer::backgroundRepeatPropertyValue() const | 686 String StylePropertySerializer::backgroundRepeatPropertyValue() const |
| 697 { | 687 { |
| 698 RefPtr<CSSValue> repeatX = m_propertySet.getPropertyCSSValue(CSSPropertyBack
groundRepeatX); | 688 RefPtr<CSSValue> repeatX = m_propertySet.getPropertyCSSValue(CSSPropertyBack
groundRepeatX); |
| 699 RefPtr<CSSValue> repeatY = m_propertySet.getPropertyCSSValue(CSSPropertyBack
groundRepeatY); | 689 RefPtr<CSSValue> repeatY = m_propertySet.getPropertyCSSValue(CSSPropertyBack
groundRepeatY); |
| 700 if (!repeatX || !repeatY) | 690 if (!repeatX || !repeatY) |
| 701 return String(); | 691 return String(); |
| 702 if (m_propertySet.propertyIsImportant(CSSPropertyBackgroundRepeatX) != m_pro
pertySet.propertyIsImportant(CSSPropertyBackgroundRepeatY)) | |
| 703 return String(); | |
| 704 if (repeatX->cssValueType() == repeatY->cssValueType() | 692 if (repeatX->cssValueType() == repeatY->cssValueType() |
| 705 && (repeatX->cssValueType() == CSSValue::CSS_INITIAL || repeatX->cssValu
eType() == CSSValue::CSS_INHERIT)) { | 693 && (repeatX->cssValueType() == CSSValue::CSS_INITIAL || repeatX->cssValu
eType() == CSSValue::CSS_INHERIT)) { |
| 706 return repeatX->cssText(); | 694 return repeatX->cssText(); |
| 707 } | 695 } |
| 708 | 696 |
| 709 RefPtr<CSSValueList> repeatXList; | 697 RefPtr<CSSValueList> repeatXList; |
| 710 if (repeatX->cssValueType() == CSSValue::CSS_PRIMITIVE_VALUE) { | 698 if (repeatX->cssValueType() == CSSValue::CSS_PRIMITIVE_VALUE) { |
| 711 repeatXList = CSSValueList::createCommaSeparated(); | 699 repeatXList = CSSValueList::createCommaSeparated(); |
| 712 repeatXList->append(repeatX); | 700 repeatXList->append(repeatX); |
| 713 } else if (repeatX->cssValueType() == CSSValue::CSS_VALUE_LIST) { | 701 } else if (repeatX->cssValueType() == CSSValue::CSS_VALUE_LIST) { |
| (...skipping 21 matching lines...) Expand all Loading... |
| 735 *repeatXList->item(i % repeatXList->length()), | 723 *repeatXList->item(i % repeatXList->length()), |
| 736 *repeatYList->item(i % repeatYList->length())); | 724 *repeatYList->item(i % repeatYList->length())); |
| 737 } | 725 } |
| 738 return builder.toString(); | 726 return builder.toString(); |
| 739 } | 727 } |
| 740 | 728 |
| 741 void StylePropertySerializer::appendBackgroundPropertyAsText(StringBuilder& resu
lt, unsigned& numDecls) const | 729 void StylePropertySerializer::appendBackgroundPropertyAsText(StringBuilder& resu
lt, unsigned& numDecls) const |
| 742 { | 730 { |
| 743 if (isPropertyShorthandAvailable(backgroundShorthand())) { | 731 if (isPropertyShorthandAvailable(backgroundShorthand())) { |
| 744 String backgroundValue = getPropertyValue(CSSPropertyBackground); | 732 String backgroundValue = getPropertyValue(CSSPropertyBackground); |
| 745 bool isImportant = m_propertySet.propertyIsImportant(CSSPropertyBackgrou
ndImage); | 733 result.append(getPropertyText(CSSPropertyBackground, backgroundValue, nu
mDecls++)); |
| 746 result.append(getPropertyText(CSSPropertyBackground, backgroundValue, is
Important, numDecls++)); | |
| 747 return; | 734 return; |
| 748 } | 735 } |
| 749 if (shorthandHasOnlyInitialOrInheritedValue(backgroundShorthand())) { | 736 if (shorthandHasOnlyInitialOrInheritedValue(backgroundShorthand())) { |
| 750 RefPtr<CSSValue> value = m_propertySet.getPropertyCSSValue(CSSPropertyBa
ckgroundImage); | 737 RefPtr<CSSValue> value = m_propertySet.getPropertyCSSValue(CSSPropertyBa
ckgroundImage); |
| 751 bool isImportant = m_propertySet.propertyIsImportant(CSSPropertyBackgrou
ndImage); | 738 result.append(getPropertyText(CSSPropertyBackground, value->cssText(), n
umDecls++)); |
| 752 result.append(getPropertyText(CSSPropertyBackground, value->cssText(), i
sImportant, numDecls++)); | |
| 753 return; | 739 return; |
| 754 } | 740 } |
| 755 | 741 |
| 756 // backgroundShorthandProperty without layered shorhand properties | 742 // backgroundShorthandProperty without layered shorhand properties |
| 757 const CSSPropertyID backgroundPropertyIds[] = { | 743 const CSSPropertyID backgroundPropertyIds[] = { |
| 758 CSSPropertyBackgroundImage, | 744 CSSPropertyBackgroundImage, |
| 759 CSSPropertyBackgroundAttachment, | 745 CSSPropertyBackgroundAttachment, |
| 760 CSSPropertyBackgroundColor, | 746 CSSPropertyBackgroundColor, |
| 761 CSSPropertyBackgroundSize, | 747 CSSPropertyBackgroundSize, |
| 762 CSSPropertyBackgroundOrigin, | 748 CSSPropertyBackgroundOrigin, |
| 763 CSSPropertyBackgroundClip | 749 CSSPropertyBackgroundClip |
| 764 }; | 750 }; |
| 765 | 751 |
| 766 for (unsigned i = 0; i < WTF_ARRAY_LENGTH(backgroundPropertyIds); ++i) { | 752 for (unsigned i = 0; i < WTF_ARRAY_LENGTH(backgroundPropertyIds); ++i) { |
| 767 CSSPropertyID propertyID = backgroundPropertyIds[i]; | 753 CSSPropertyID propertyID = backgroundPropertyIds[i]; |
| 768 RefPtr<CSSValue> value = m_propertySet.getPropertyCSSValue(propertyID); | 754 RefPtr<CSSValue> value = m_propertySet.getPropertyCSSValue(propertyID); |
| 769 if (!value) | 755 if (!value) |
| 770 continue; | 756 continue; |
| 771 result.append(getPropertyText(propertyID, value->cssText(), m_propertySe
t.propertyIsImportant(propertyID), numDecls++)); | 757 result.append(getPropertyText(propertyID, value->cssText(), numDecls++))
; |
| 772 } | 758 } |
| 773 | 759 |
| 774 // FIXME: This is a not-so-nice way to turn x/y positions into single backgr
ound-position in output. | 760 // FIXME: This is a not-so-nice way to turn x/y positions into single backgr
ound-position in output. |
| 775 // It is required because background-position-x/y are non-standard propertie
s and WebKit generated output | 761 // It is required because background-position-x/y are non-standard propertie
s and WebKit generated output |
| 776 // would not work in Firefox (<rdar://problem/5143183>) | 762 // would not work in Firefox (<rdar://problem/5143183>) |
| 777 // It would be a better solution if background-position was CSS_PAIR. | 763 // It would be a better solution if background-position was CSS_PAIR. |
| 778 if (shorthandHasOnlyInitialOrInheritedValue(backgroundPositionShorthand()))
{ | 764 if (shorthandHasOnlyInitialOrInheritedValue(backgroundPositionShorthand()))
{ |
| 779 RefPtr<CSSValue> value = m_propertySet.getPropertyCSSValue(CSSPropertyBa
ckgroundPositionX); | 765 RefPtr<CSSValue> value = m_propertySet.getPropertyCSSValue(CSSPropertyBa
ckgroundPositionX); |
| 780 bool isImportant = m_propertySet.propertyIsImportant(CSSPropertyBackgrou
ndPositionX); | 766 result.append(getPropertyText(CSSPropertyBackgroundPosition, value->cssT
ext(), numDecls++)); |
| 781 result.append(getPropertyText(CSSPropertyBackgroundPosition, value->cssT
ext(), isImportant, numDecls++)); | |
| 782 } else if (isPropertyShorthandAvailable(backgroundPositionShorthand())) { | 767 } else if (isPropertyShorthandAvailable(backgroundPositionShorthand())) { |
| 783 String positionValue = m_propertySet.getPropertyValue(CSSPropertyBackgro
undPosition); | 768 String positionValue = m_propertySet.getPropertyValue(CSSPropertyBackgro
undPosition); |
| 784 bool isImportant = m_propertySet.propertyIsImportant(CSSPropertyBackgrou
ndPositionX); | |
| 785 if (!positionValue.isNull()) | 769 if (!positionValue.isNull()) |
| 786 result.append(getPropertyText(CSSPropertyBackgroundPosition, positio
nValue, isImportant, numDecls++)); | 770 result.append(getPropertyText(CSSPropertyBackgroundPosition, positio
nValue, numDecls++)); |
| 787 } else { | 771 } else { |
| 788 // should check background-position-x or background-position-y. | 772 // should check background-position-x or background-position-y. |
| 789 if (RefPtr<CSSValue> value = m_propertySet.getPropertyCSSValue(CSSProper
tyBackgroundPositionX)) { | 773 if (RefPtr<CSSValue> value = m_propertySet.getPropertyCSSValue(CSSProper
tyBackgroundPositionX)) { |
| 790 if (!value->isImplicitInitialValue()) { | 774 if (!value->isImplicitInitialValue()) { |
| 791 bool isImportant = m_propertySet.propertyIsImportant(CSSProperty
BackgroundPositionX); | 775 result.append(getPropertyText(CSSPropertyBackgroundPositionX, va
lue->cssText(), numDecls++)); |
| 792 result.append(getPropertyText(CSSPropertyBackgroundPositionX, va
lue->cssText(), isImportant, numDecls++)); | |
| 793 } | 776 } |
| 794 } | 777 } |
| 795 if (RefPtr<CSSValue> value = m_propertySet.getPropertyCSSValue(CSSProper
tyBackgroundPositionY)) { | 778 if (RefPtr<CSSValue> value = m_propertySet.getPropertyCSSValue(CSSProper
tyBackgroundPositionY)) { |
| 796 if (!value->isImplicitInitialValue()) { | 779 if (!value->isImplicitInitialValue()) { |
| 797 bool isImportant = m_propertySet.propertyIsImportant(CSSProperty
BackgroundPositionY); | 780 result.append(getPropertyText(CSSPropertyBackgroundPositionY, va
lue->cssText(), numDecls++)); |
| 798 result.append(getPropertyText(CSSPropertyBackgroundPositionY, va
lue->cssText(), isImportant, numDecls++)); | |
| 799 } | 781 } |
| 800 } | 782 } |
| 801 } | 783 } |
| 802 | 784 |
| 803 String repeatValue = m_propertySet.getPropertyValue(CSSPropertyBackgroundRep
eat); | 785 String repeatValue = m_propertySet.getPropertyValue(CSSPropertyBackgroundRep
eat); |
| 804 if (!repeatValue.isNull()) | 786 if (!repeatValue.isNull()) |
| 805 result.append(getPropertyText(CSSPropertyBackgroundRepeat, repeatValue,
m_propertySet.propertyIsImportant(CSSPropertyBackgroundRepeatX), numDecls++)); | 787 result.append(getPropertyText(CSSPropertyBackgroundRepeat, repeatValue,
numDecls++)); |
| 806 } | 788 } |
| 807 | 789 |
| 808 bool StylePropertySerializer::isPropertyShorthandAvailable(const StylePropertySh
orthand& shorthand) const | 790 bool StylePropertySerializer::isPropertyShorthandAvailable(const StylePropertySh
orthand& shorthand) const |
| 809 { | 791 { |
| 810 ASSERT(shorthand.length() > 0); | 792 ASSERT(shorthand.length() > 0); |
| 811 | 793 |
| 812 bool isImportant = m_propertySet.propertyIsImportant(shorthand.properties()[
0]); | |
| 813 for (unsigned i = 0; i < shorthand.length(); ++i) { | 794 for (unsigned i = 0; i < shorthand.length(); ++i) { |
| 814 RefPtr<CSSValue> value = m_propertySet.getPropertyCSSValue(shorthand.pro
perties()[i]); | 795 RefPtr<CSSValue> value = m_propertySet.getPropertyCSSValue(shorthand.pro
perties()[i]); |
| 815 if (!value || (value->isInitialValue() && !value->isImplicitInitialValue
()) || value->isInheritedValue()) | 796 if (!value || (value->isInitialValue() && !value->isImplicitInitialValue
()) || value->isInheritedValue()) |
| 816 return false; | 797 return false; |
| 817 if (isImportant != m_propertySet.propertyIsImportant(shorthand.propertie
s()[i])) | |
| 818 return false; | |
| 819 } | 798 } |
| 820 return true; | 799 return true; |
| 821 } | 800 } |
| 822 | 801 |
| 823 bool StylePropertySerializer::shorthandHasOnlyInitialOrInheritedValue(const Styl
ePropertyShorthand& shorthand) const | 802 bool StylePropertySerializer::shorthandHasOnlyInitialOrInheritedValue(const Styl
ePropertyShorthand& shorthand) const |
| 824 { | 803 { |
| 825 ASSERT(shorthand.length() > 0); | 804 ASSERT(shorthand.length() > 0); |
| 826 bool isImportant = m_propertySet.propertyIsImportant(shorthand.properties()[
0]); | |
| 827 bool isInitialValue = true; | 805 bool isInitialValue = true; |
| 828 bool isInheritedValue = true; | 806 bool isInheritedValue = true; |
| 829 for (unsigned i = 0; i < shorthand.length(); ++i) { | 807 for (unsigned i = 0; i < shorthand.length(); ++i) { |
| 830 RefPtr<CSSValue> value = m_propertySet.getPropertyCSSValue(shorthand.pro
perties()[i]); | 808 RefPtr<CSSValue> value = m_propertySet.getPropertyCSSValue(shorthand.pro
perties()[i]); |
| 831 if (!value) | 809 if (!value) |
| 832 return false; | 810 return false; |
| 833 if (!value->isInitialValue()) | 811 if (!value->isInitialValue()) |
| 834 isInitialValue = false; | 812 isInitialValue = false; |
| 835 if (!value->isInheritedValue()) | 813 if (!value->isInheritedValue()) |
| 836 isInheritedValue = false; | 814 isInheritedValue = false; |
| 837 if (isImportant != m_propertySet.propertyIsImportant(shorthand.propertie
s()[i])) | |
| 838 return false; | |
| 839 } | 815 } |
| 840 return isInitialValue || isInheritedValue; | 816 return isInitialValue || isInheritedValue; |
| 841 } | 817 } |
| 842 | 818 |
| 843 } | 819 } |
| OLD | NEW |