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 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
688 const CSSValue* anchor = | 700 const CSSValue* anchor = |
689 property_set_.GetPropertyCSSValue(CSSPropertyOffsetAnchor); | 701 property_set_.GetPropertyCSSValue(CSSPropertyOffsetAnchor); |
690 if (!anchor->IsInitialValue()) { | 702 if (!anchor->IsInitialValue()) { |
691 result.Append(" / "); | 703 result.Append(" / "); |
692 result.Append(anchor->CssText()); | 704 result.Append(anchor->CssText()); |
693 } | 705 } |
694 } | 706 } |
695 return result.ToString(); | 707 return result.ToString(); |
696 } | 708 } |
697 | 709 |
| 710 String StylePropertySerializer::Get2Values( |
| 711 const StylePropertyShorthand& shorthand) const { |
| 712 // Assume the properties are in the usual order start, end. |
| 713 int start_value_index = |
| 714 property_set_.FindPropertyIndex(shorthand.properties()[0]); |
| 715 int end_value_index = |
| 716 property_set_.FindPropertyIndex(shorthand.properties()[1]); |
| 717 |
| 718 if (start_value_index == -1 || end_value_index == -1) |
| 719 return String(); |
| 720 |
| 721 PropertyValueForSerializer start = |
| 722 property_set_.PropertyAt(start_value_index); |
| 723 PropertyValueForSerializer end = property_set_.PropertyAt(end_value_index); |
| 724 |
| 725 bool show_end = !DataEquivalent(start.Value(), end.Value()); |
| 726 |
| 727 StringBuilder result; |
| 728 result.Append(start.Value()->CssText()); |
| 729 if (show_end) { |
| 730 result.Append(' '); |
| 731 result.Append(end.Value()->CssText()); |
| 732 } |
| 733 return result.ToString(); |
| 734 } |
| 735 |
698 String StylePropertySerializer::Get4Values( | 736 String StylePropertySerializer::Get4Values( |
699 const StylePropertyShorthand& shorthand) const { | 737 const StylePropertyShorthand& shorthand) const { |
700 // Assume the properties are in the usual order top, right, bottom, left. | 738 // Assume the properties are in the usual order top, right, bottom, left. |
701 int top_value_index = | 739 int top_value_index = |
702 property_set_.FindPropertyIndex(shorthand.properties()[0]); | 740 property_set_.FindPropertyIndex(shorthand.properties()[0]); |
703 int right_value_index = | 741 int right_value_index = |
704 property_set_.FindPropertyIndex(shorthand.properties()[1]); | 742 property_set_.FindPropertyIndex(shorthand.properties()[1]); |
705 int bottom_value_index = | 743 int bottom_value_index = |
706 property_set_.FindPropertyIndex(shorthand.properties()[2]); | 744 property_set_.FindPropertyIndex(shorthand.properties()[2]); |
707 int left_value_index = | 745 int left_value_index = |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
995 : repeat_x; | 1033 : repeat_x; |
996 const CSSValue& y_value = | 1034 const CSSValue& y_value = |
997 repeat_y_list ? repeat_y_list->Item(i % repeat_y_list->length()) | 1035 repeat_y_list ? repeat_y_list->Item(i % repeat_y_list->length()) |
998 : repeat_y; | 1036 : repeat_y; |
999 AppendBackgroundRepeatValue(builder, x_value, y_value); | 1037 AppendBackgroundRepeatValue(builder, x_value, y_value); |
1000 } | 1038 } |
1001 return builder.ToString(); | 1039 return builder.ToString(); |
1002 } | 1040 } |
1003 | 1041 |
1004 } // namespace blink | 1042 } // namespace blink |
OLD | NEW |