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 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
538 } | 538 } |
539 | 539 |
540 char prefix = '\0'; | 540 char prefix = '\0'; |
541 switch (propertyID) { | 541 switch (propertyID) { |
542 case CSSPropertyFontStyle: | 542 case CSSPropertyFontStyle: |
543 break; // No prefix. | 543 break; // No prefix. |
544 case CSSPropertyFontFamily: | 544 case CSSPropertyFontFamily: |
545 case CSSPropertyFontStretch: | 545 case CSSPropertyFontStretch: |
546 case CSSPropertyFontVariantCaps: | 546 case CSSPropertyFontVariantCaps: |
547 case CSSPropertyFontVariantLigatures: | 547 case CSSPropertyFontVariantLigatures: |
| 548 case CSSPropertyFontVariantNumeric: |
548 case CSSPropertyFontWeight: | 549 case CSSPropertyFontWeight: |
549 prefix = ' '; | 550 prefix = ' '; |
550 break; | 551 break; |
551 case CSSPropertyLineHeight: | 552 case CSSPropertyLineHeight: |
552 prefix = '/'; | 553 prefix = '/'; |
553 break; | 554 break; |
554 default: | 555 default: |
555 ASSERT_NOT_REACHED(); | 556 ASSERT_NOT_REACHED(); |
556 } | 557 } |
557 | 558 |
(...skipping 17 matching lines...) Expand all Loading... |
575 | 576 |
576 String StylePropertySerializer::fontValue() const | 577 String StylePropertySerializer::fontValue() const |
577 { | 578 { |
578 if (!isPropertyShorthandAvailable(fontShorthand()) && !shorthandHasOnlyIniti
alOrInheritedValue(fontShorthand())) | 579 if (!isPropertyShorthandAvailable(fontShorthand()) && !shorthandHasOnlyIniti
alOrInheritedValue(fontShorthand())) |
579 return emptyString(); | 580 return emptyString(); |
580 | 581 |
581 int fontSizePropertyIndex = m_propertySet.findPropertyIndex(CSSPropertyFontS
ize); | 582 int fontSizePropertyIndex = m_propertySet.findPropertyIndex(CSSPropertyFontS
ize); |
582 int fontFamilyPropertyIndex = m_propertySet.findPropertyIndex(CSSPropertyFon
tFamily); | 583 int fontFamilyPropertyIndex = m_propertySet.findPropertyIndex(CSSPropertyFon
tFamily); |
583 int fontVariantCapsPropertyIndex = m_propertySet.findPropertyIndex(CSSProper
tyFontVariantCaps); | 584 int fontVariantCapsPropertyIndex = m_propertySet.findPropertyIndex(CSSProper
tyFontVariantCaps); |
584 int fontVariantLigaturesPropertyIndex = m_propertySet.findPropertyIndex(CSSP
ropertyFontVariantLigatures); | 585 int fontVariantLigaturesPropertyIndex = m_propertySet.findPropertyIndex(CSSP
ropertyFontVariantLigatures); |
| 586 int fontVariantNumericPropertyIndex = m_propertySet.findPropertyIndex(CSSPro
pertyFontVariantNumeric); |
585 DCHECK_NE(fontSizePropertyIndex, -1); | 587 DCHECK_NE(fontSizePropertyIndex, -1); |
586 DCHECK_NE(fontFamilyPropertyIndex, -1); | 588 DCHECK_NE(fontFamilyPropertyIndex, -1); |
587 DCHECK_NE(fontVariantCapsPropertyIndex, -1); | 589 DCHECK_NE(fontVariantCapsPropertyIndex, -1); |
588 DCHECK_NE(fontVariantLigaturesPropertyIndex, -1); | 590 DCHECK_NE(fontVariantLigaturesPropertyIndex, -1); |
| 591 DCHECK_NE(fontVariantNumericPropertyIndex, -1); |
589 | 592 |
590 PropertyValueForSerializer fontSizeProperty = m_propertySet.propertyAt(fontS
izePropertyIndex); | 593 PropertyValueForSerializer fontSizeProperty = m_propertySet.propertyAt(fontS
izePropertyIndex); |
591 PropertyValueForSerializer fontFamilyProperty = m_propertySet.propertyAt(fon
tFamilyPropertyIndex); | 594 PropertyValueForSerializer fontFamilyProperty = m_propertySet.propertyAt(fon
tFamilyPropertyIndex); |
592 PropertyValueForSerializer fontVariantCapsProperty = m_propertySet.propertyA
t(fontVariantCapsPropertyIndex); | 595 PropertyValueForSerializer fontVariantCapsProperty = m_propertySet.propertyA
t(fontVariantCapsPropertyIndex); |
593 PropertyValueForSerializer fontVariantLigaturesProperty = m_propertySet.prop
ertyAt(fontVariantLigaturesPropertyIndex); | 596 PropertyValueForSerializer fontVariantLigaturesProperty = m_propertySet.prop
ertyAt(fontVariantLigaturesPropertyIndex); |
| 597 PropertyValueForSerializer fontVariantNumericProperty = m_propertySet.proper
tyAt(fontVariantNumericPropertyIndex); |
594 | 598 |
595 // Check that non-initial font-variant subproperties are not conflicting wit
h this serialization. | 599 // Check that non-initial font-variant subproperties are not conflicting wit
h this serialization. |
596 const CSSValue* ligaturesValue = fontVariantLigaturesProperty.value(); | 600 const CSSValue* ligaturesValue = fontVariantLigaturesProperty.value(); |
| 601 const CSSValue* numericValue = fontVariantNumericProperty.value(); |
597 if ((ligaturesValue->isPrimitiveValue() | 602 if ((ligaturesValue->isPrimitiveValue() |
598 && toCSSPrimitiveValue(ligaturesValue)->getValueID() != CSSValueNormal) | 603 && toCSSPrimitiveValue(ligaturesValue)->getValueID() != CSSValueNormal) |
599 || ligaturesValue->isValueList()) | 604 || ligaturesValue->isValueList() |
| 605 || (numericValue->isPrimitiveValue() |
| 606 && toCSSPrimitiveValue(numericValue)->getValueID() != CSSValueNormal) |
| 607 || numericValue->isValueList()) |
600 return emptyString(); | 608 return emptyString(); |
601 | 609 |
602 String commonValue = fontSizeProperty.value()->cssText(); | 610 String commonValue = fontSizeProperty.value()->cssText(); |
603 StringBuilder result; | 611 StringBuilder result; |
604 appendFontLonghandValueIfNotNormal(CSSPropertyFontStyle, result, commonValue
); | 612 appendFontLonghandValueIfNotNormal(CSSPropertyFontStyle, result, commonValue
); |
605 | 613 |
606 const CSSValue* val = fontVariantCapsProperty.value(); | 614 const CSSValue* val = fontVariantCapsProperty.value(); |
607 if (val->isPrimitiveValue() | 615 if (val->isPrimitiveValue() |
608 && (toCSSPrimitiveValue(val)->getValueID() != CSSValueSmallCaps | 616 && (toCSSPrimitiveValue(val)->getValueID() != CSSValueSmallCaps |
609 && toCSSPrimitiveValue(val)->getValueID() != CSSValueNormal)) | 617 && toCSSPrimitiveValue(val)->getValueID() != CSSValueNormal)) |
(...skipping 23 matching lines...) Expand all Loading... |
633 } | 641 } |
634 | 642 |
635 StringBuilder result; | 643 StringBuilder result; |
636 | 644 |
637 // TODO(drott): Decide how we want to return ligature values in shorthands,
reduced to "none" or | 645 // TODO(drott): Decide how we want to return ligature values in shorthands,
reduced to "none" or |
638 // spelled out, filed as W3C bug: | 646 // spelled out, filed as W3C bug: |
639 // https://www.w3.org/Bugs/Public/show_bug.cgi?id=29594 | 647 // https://www.w3.org/Bugs/Public/show_bug.cgi?id=29594 |
640 String dummyCommonValue; | 648 String dummyCommonValue; |
641 appendFontLonghandValueIfNotNormal(CSSPropertyFontVariantLigatures, result,
dummyCommonValue); | 649 appendFontLonghandValueIfNotNormal(CSSPropertyFontVariantLigatures, result,
dummyCommonValue); |
642 appendFontLonghandValueIfNotNormal(CSSPropertyFontVariantCaps, result, dummy
CommonValue); | 650 appendFontLonghandValueIfNotNormal(CSSPropertyFontVariantCaps, result, dummy
CommonValue); |
| 651 appendFontLonghandValueIfNotNormal(CSSPropertyFontVariantNumeric, result, du
mmyCommonValue); |
643 | 652 |
644 if (result.isEmpty()) { | 653 if (result.isEmpty()) { |
645 return "normal"; | 654 return "normal"; |
646 } | 655 } |
647 | 656 |
648 return result.toString(); | 657 return result.toString(); |
649 } | 658 } |
650 | 659 |
651 String StylePropertySerializer::get4Values(const StylePropertyShorthand& shortha
nd) const | 660 String StylePropertySerializer::get4Values(const StylePropertyShorthand& shortha
nd) const |
652 { | 661 { |
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1071 isInitialValue = false; | 1080 isInitialValue = false; |
1072 if (!value->isInheritedValue()) | 1081 if (!value->isInheritedValue()) |
1073 isInheritedValue = false; | 1082 isInheritedValue = false; |
1074 if (isImportant != m_propertySet.propertyIsImportant(shorthand.propertie
s()[i])) | 1083 if (isImportant != m_propertySet.propertyIsImportant(shorthand.propertie
s()[i])) |
1075 return false; | 1084 return false; |
1076 } | 1085 } |
1077 return isInitialValue || isInheritedValue; | 1086 return isInitialValue || isInheritedValue; |
1078 } | 1087 } |
1079 | 1088 |
1080 } // namespace blink | 1089 } // namespace blink |
OLD | NEW |