| 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 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 502 String horizontalValueCSSText = horizontalValue->cssText(); | 502 String horizontalValueCSSText = horizontalValue->cssText(); |
| 503 String verticalValueCSSText = verticalValue->cssText(); | 503 String verticalValueCSSText = verticalValue->cssText(); |
| 504 if (horizontalValueCSSText == verticalValueCSSText) | 504 if (horizontalValueCSSText == verticalValueCSSText) |
| 505 return horizontalValueCSSText; | 505 return horizontalValueCSSText; |
| 506 return horizontalValueCSSText + ' ' + verticalValueCSSText; | 506 return horizontalValueCSSText + ' ' + verticalValueCSSText; |
| 507 } | 507 } |
| 508 | 508 |
| 509 void StylePropertySerializer::appendFontLonghandValueIfNotNormal(CSSPropertyID p
ropertyID, StringBuilder& result, String& commonValue) const | 509 void StylePropertySerializer::appendFontLonghandValueIfNotNormal(CSSPropertyID p
ropertyID, StringBuilder& result, String& commonValue) const |
| 510 { | 510 { |
| 511 int foundPropertyIndex = m_propertySet.findPropertyIndex(propertyID); | 511 int foundPropertyIndex = m_propertySet.findPropertyIndex(propertyID); |
| 512 if (foundPropertyIndex == -1) | 512 ASSERT(foundPropertyIndex != -1); |
| 513 return; | |
| 514 | 513 |
| 515 const CSSValue* val = m_propertySet.propertyAt(foundPropertyIndex).value(); | 514 const CSSValue* val = m_propertySet.propertyAt(foundPropertyIndex).value(); |
| 516 if (val->isPrimitiveValue() && toCSSPrimitiveValue(val)->getValueID() == CSS
ValueNormal) { | 515 if (val->isPrimitiveValue() && toCSSPrimitiveValue(val)->getValueID() == CSS
ValueNormal) { |
| 517 commonValue = String(); | 516 commonValue = String(); |
| 518 return; | 517 return; |
| 519 } | 518 } |
| 520 | 519 |
| 521 char prefix = '\0'; | 520 char prefix = '\0'; |
| 522 switch (propertyID) { | 521 switch (propertyID) { |
| 523 case CSSPropertyFontStyle: | 522 case CSSPropertyFontStyle: |
| (...skipping 14 matching lines...) Expand all Loading... |
| 538 if (prefix && !result.isEmpty()) | 537 if (prefix && !result.isEmpty()) |
| 539 result.append(prefix); | 538 result.append(prefix); |
| 540 String value = m_propertySet.propertyAt(foundPropertyIndex).value()->cssText
(); | 539 String value = m_propertySet.propertyAt(foundPropertyIndex).value()->cssText
(); |
| 541 result.append(value); | 540 result.append(value); |
| 542 if (!commonValue.isNull() && commonValue != value) | 541 if (!commonValue.isNull() && commonValue != value) |
| 543 commonValue = String(); | 542 commonValue = String(); |
| 544 } | 543 } |
| 545 | 544 |
| 546 String StylePropertySerializer::fontValue() const | 545 String StylePropertySerializer::fontValue() const |
| 547 { | 546 { |
| 547 if (!isPropertyShorthandAvailable(fontShorthand()) && !shorthandHasOnlyIniti
alOrInheritedValue(fontShorthand())) |
| 548 return emptyString(); |
| 549 |
| 548 int fontSizePropertyIndex = m_propertySet.findPropertyIndex(CSSPropertyFontS
ize); | 550 int fontSizePropertyIndex = m_propertySet.findPropertyIndex(CSSPropertyFontS
ize); |
| 549 int fontFamilyPropertyIndex = m_propertySet.findPropertyIndex(CSSPropertyFon
tFamily); | 551 int fontFamilyPropertyIndex = m_propertySet.findPropertyIndex(CSSPropertyFon
tFamily); |
| 550 if (fontSizePropertyIndex == -1 || fontFamilyPropertyIndex == -1) | 552 ASSERT(fontSizePropertyIndex != -1 && fontFamilyPropertyIndex != -1); |
| 551 return emptyString(); | |
| 552 | 553 |
| 553 PropertyValueForSerializer fontSizeProperty = m_propertySet.propertyAt(fontS
izePropertyIndex); | 554 PropertyValueForSerializer fontSizeProperty = m_propertySet.propertyAt(fontS
izePropertyIndex); |
| 554 PropertyValueForSerializer fontFamilyProperty = m_propertySet.propertyAt(fon
tFamilyPropertyIndex); | 555 PropertyValueForSerializer fontFamilyProperty = m_propertySet.propertyAt(fon
tFamilyPropertyIndex); |
| 555 | 556 |
| 556 String commonValue = fontSizeProperty.value()->cssText(); | 557 String commonValue = fontSizeProperty.value()->cssText(); |
| 557 StringBuilder result; | 558 StringBuilder result; |
| 558 appendFontLonghandValueIfNotNormal(CSSPropertyFontStyle, result, commonValue
); | 559 appendFontLonghandValueIfNotNormal(CSSPropertyFontStyle, result, commonValue
); |
| 559 appendFontLonghandValueIfNotNormal(CSSPropertyFontVariant, result, commonVal
ue); | 560 appendFontLonghandValueIfNotNormal(CSSPropertyFontVariant, result, commonVal
ue); |
| 560 appendFontLonghandValueIfNotNormal(CSSPropertyFontWeight, result, commonValu
e); | 561 appendFontLonghandValueIfNotNormal(CSSPropertyFontWeight, result, commonValu
e); |
| 561 appendFontLonghandValueIfNotNormal(CSSPropertyFontStretch, result, commonVal
ue); | 562 appendFontLonghandValueIfNotNormal(CSSPropertyFontStretch, result, commonVal
ue); |
| (...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 991 isInitialValue = false; | 992 isInitialValue = false; |
| 992 if (!value->isInheritedValue()) | 993 if (!value->isInheritedValue()) |
| 993 isInheritedValue = false; | 994 isInheritedValue = false; |
| 994 if (isImportant != m_propertySet.propertyIsImportant(shorthand.propertie
s()[i])) | 995 if (isImportant != m_propertySet.propertyIsImportant(shorthand.propertie
s()[i])) |
| 995 return false; | 996 return false; |
| 996 } | 997 } |
| 997 return isInitialValue || isInheritedValue; | 998 return isInitialValue || isInheritedValue; |
| 998 } | 999 } |
| 999 | 1000 |
| 1000 } | 1001 } |
| OLD | NEW |