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 | 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All |
4 * rights reserved. | 4 * rights reserved. |
5 * Copyright (C) 2011 Research In Motion Limited. All rights reserved. | 5 * Copyright (C) 2011 Research In Motion Limited. All rights reserved. |
6 * Copyright (C) 2013 Intel Corporation. All rights reserved. | 6 * Copyright (C) 2013 Intel Corporation. All rights reserved. |
7 * | 7 * |
8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
(...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
499 case CSSPropertyWebkitTextStroke: | 499 case CSSPropertyWebkitTextStroke: |
500 return GetShorthandValue(webkitTextStrokeShorthand()); | 500 return GetShorthandValue(webkitTextStrokeShorthand()); |
501 case CSSPropertyMarker: { | 501 case CSSPropertyMarker: { |
502 if (const CSSValue* value = | 502 if (const CSSValue* value = |
503 property_set_.GetPropertyCSSValue(CSSPropertyMarkerStart)) | 503 property_set_.GetPropertyCSSValue(CSSPropertyMarkerStart)) |
504 return value->CssText(); | 504 return value->CssText(); |
505 return String(); | 505 return String(); |
506 } | 506 } |
507 case CSSPropertyBorderRadius: | 507 case CSSPropertyBorderRadius: |
508 return Get4Values(borderRadiusShorthand()); | 508 return Get4Values(borderRadiusShorthand()); |
| 509 case CSSPropertyScrollPadding: |
| 510 return Get4Values(scrollPaddingShorthand()); |
| 511 case CSSPropertyScrollPaddingBlock: |
| 512 return Get2Values(scrollPaddingBlockShorthand()); |
| 513 case CSSPropertyScrollPaddingInline: |
| 514 return Get2Values(scrollPaddingInlineShorthand()); |
| 515 case CSSPropertyScrollSnapMargin: |
| 516 return Get4Values(scrollSnapMarginShorthand()); |
| 517 case CSSPropertyScrollSnapMarginBlock: |
| 518 return Get2Values(scrollSnapMarginBlockShorthand()); |
| 519 case CSSPropertyScrollSnapMarginInline: |
| 520 return Get2Values(scrollSnapMarginInlineShorthand()); |
509 default: | 521 default: |
510 return String(); | 522 return String(); |
511 } | 523 } |
512 } | 524 } |
513 | 525 |
514 String StylePropertySerializer::BorderSpacingValue( | 526 String StylePropertySerializer::BorderSpacingValue( |
515 const StylePropertyShorthand& shorthand) const { | 527 const StylePropertyShorthand& shorthand) const { |
516 const CSSValue* horizontal_value = | 528 const CSSValue* horizontal_value = |
517 property_set_.GetPropertyCSSValue(shorthand.properties()[0]); | 529 property_set_.GetPropertyCSSValue(shorthand.properties()[0]); |
518 const CSSValue* vertical_value = | 530 const CSSValue* vertical_value = |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
646 AppendFontLonghandValueIfNotNormal(CSSPropertyFontVariantCaps, result); | 658 AppendFontLonghandValueIfNotNormal(CSSPropertyFontVariantCaps, result); |
647 AppendFontLonghandValueIfNotNormal(CSSPropertyFontVariantNumeric, result); | 659 AppendFontLonghandValueIfNotNormal(CSSPropertyFontVariantNumeric, result); |
648 | 660 |
649 if (result.IsEmpty()) { | 661 if (result.IsEmpty()) { |
650 return "normal"; | 662 return "normal"; |
651 } | 663 } |
652 | 664 |
653 return result.ToString(); | 665 return result.ToString(); |
654 } | 666 } |
655 | 667 |
| 668 String StylePropertySerializer::Get2Values( |
| 669 const StylePropertyShorthand& shorthand) const { |
| 670 // Assume the properties are in the usual order start, end. |
| 671 int start_value_index = |
| 672 property_set_.FindPropertyIndex(shorthand.properties()[0]); |
| 673 int end_value_index = |
| 674 property_set_.FindPropertyIndex(shorthand.properties()[1]); |
| 675 |
| 676 if (start_value_index == -1 || end_value_index == -1) |
| 677 return String(); |
| 678 |
| 679 PropertyValueForSerializer start = |
| 680 property_set_.PropertyAt(start_value_index); |
| 681 PropertyValueForSerializer end = property_set_.PropertyAt(end_value_index); |
| 682 |
| 683 bool show_end = !DataEquivalent(start.Value(), end.Value()); |
| 684 |
| 685 StringBuilder result; |
| 686 result.Append(start.Value()->CssText()); |
| 687 if (show_end) { |
| 688 result.Append(' '); |
| 689 result.Append(end.Value()->CssText()); |
| 690 } |
| 691 return result.ToString(); |
| 692 } |
| 693 |
656 String StylePropertySerializer::Get4Values( | 694 String StylePropertySerializer::Get4Values( |
657 const StylePropertyShorthand& shorthand) const { | 695 const StylePropertyShorthand& shorthand) const { |
658 // Assume the properties are in the usual order top, right, bottom, left. | 696 // Assume the properties are in the usual order top, right, bottom, left. |
659 int top_value_index = | 697 int top_value_index = |
660 property_set_.FindPropertyIndex(shorthand.properties()[0]); | 698 property_set_.FindPropertyIndex(shorthand.properties()[0]); |
661 int right_value_index = | 699 int right_value_index = |
662 property_set_.FindPropertyIndex(shorthand.properties()[1]); | 700 property_set_.FindPropertyIndex(shorthand.properties()[1]); |
663 int bottom_value_index = | 701 int bottom_value_index = |
664 property_set_.FindPropertyIndex(shorthand.properties()[2]); | 702 property_set_.FindPropertyIndex(shorthand.properties()[2]); |
665 int left_value_index = | 703 int left_value_index = |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
953 : repeat_x; | 991 : repeat_x; |
954 const CSSValue& y_value = | 992 const CSSValue& y_value = |
955 repeat_y_list ? repeat_y_list->Item(i % repeat_y_list->length()) | 993 repeat_y_list ? repeat_y_list->Item(i % repeat_y_list->length()) |
956 : repeat_y; | 994 : repeat_y; |
957 AppendBackgroundRepeatValue(builder, x_value, y_value); | 995 AppendBackgroundRepeatValue(builder, x_value, y_value); |
958 } | 996 } |
959 return builder.ToString(); | 997 return builder.ToString(); |
960 } | 998 } |
961 | 999 |
962 } // namespace blink | 1000 } // namespace blink |
OLD | NEW |