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 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 borderFallbackShorthandProperty = CSSPropertyBorderStyle; | 271 borderFallbackShorthandProperty = CSSPropertyBorderStyle; |
272 case CSSPropertyBorderTopColor: | 272 case CSSPropertyBorderTopColor: |
273 case CSSPropertyBorderRightColor: | 273 case CSSPropertyBorderRightColor: |
274 case CSSPropertyBorderBottomColor: | 274 case CSSPropertyBorderBottomColor: |
275 case CSSPropertyBorderLeftColor: | 275 case CSSPropertyBorderLeftColor: |
276 if (!borderFallbackShorthandProperty) | 276 if (!borderFallbackShorthandProperty) |
277 borderFallbackShorthandProperty = CSSPropertyBorderColor; | 277 borderFallbackShorthandProperty = CSSPropertyBorderColor; |
278 | 278 |
279 // FIXME: Deal with cases where only some of border-(top|right|botto
m|left) are specified. | 279 // FIXME: Deal with cases where only some of border-(top|right|botto
m|left) are specified. |
280 if (!shorthandPropertyAppeared.test(CSSPropertyBorder - firstCSSProp
erty)) { | 280 if (!shorthandPropertyAppeared.test(CSSPropertyBorder - firstCSSProp
erty)) { |
281 value = borderPropertyValue(ReturnNullOnUncommonValues); | 281 value = borderPropertyValue(); |
282 if (value.isNull()) | 282 if (value.isNull()) |
283 shorthandPropertyAppeared.set(CSSPropertyBorder - firstCSSPr
operty); | 283 shorthandPropertyAppeared.set(CSSPropertyBorder - firstCSSPr
operty); |
284 else | 284 else |
285 shorthandPropertyID = CSSPropertyBorder; | 285 shorthandPropertyID = CSSPropertyBorder; |
286 } else if (shorthandPropertyUsed.test(CSSPropertyBorder - firstCSSPr
operty)) { | 286 } else if (shorthandPropertyUsed.test(CSSPropertyBorder - firstCSSPr
operty)) { |
287 shorthandPropertyID = CSSPropertyBorder; | 287 shorthandPropertyID = CSSPropertyBorder; |
288 } | 288 } |
289 if (!shorthandPropertyID) | 289 if (!shorthandPropertyID) |
290 shorthandPropertyID = borderFallbackShorthandProperty; | 290 shorthandPropertyID = borderFallbackShorthandProperty; |
291 break; | 291 break; |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
428 return getLayeredShorthandValue(animationShorthand()); | 428 return getLayeredShorthandValue(animationShorthand()); |
429 case CSSPropertyBorderSpacing: | 429 case CSSPropertyBorderSpacing: |
430 return borderSpacingValue(borderSpacingShorthand()); | 430 return borderSpacingValue(borderSpacingShorthand()); |
431 case CSSPropertyBackgroundPosition: | 431 case CSSPropertyBackgroundPosition: |
432 return getLayeredShorthandValue(backgroundPositionShorthand()); | 432 return getLayeredShorthandValue(backgroundPositionShorthand()); |
433 case CSSPropertyBackgroundRepeat: | 433 case CSSPropertyBackgroundRepeat: |
434 return backgroundRepeatPropertyValue(); | 434 return backgroundRepeatPropertyValue(); |
435 case CSSPropertyBackground: | 435 case CSSPropertyBackground: |
436 return getLayeredShorthandValue(backgroundShorthand()); | 436 return getLayeredShorthandValue(backgroundShorthand()); |
437 case CSSPropertyBorder: | 437 case CSSPropertyBorder: |
438 return borderPropertyValue(OmitUncommonValues); | 438 return borderPropertyValue(); |
439 case CSSPropertyBorderTop: | 439 case CSSPropertyBorderTop: |
440 return getShorthandValue(borderTopShorthand()); | 440 return getShorthandValue(borderTopShorthand()); |
441 case CSSPropertyBorderRight: | 441 case CSSPropertyBorderRight: |
442 return getShorthandValue(borderRightShorthand()); | 442 return getShorthandValue(borderRightShorthand()); |
443 case CSSPropertyBorderBottom: | 443 case CSSPropertyBorderBottom: |
444 return getShorthandValue(borderBottomShorthand()); | 444 return getShorthandValue(borderBottomShorthand()); |
445 case CSSPropertyBorderLeft: | 445 case CSSPropertyBorderLeft: |
446 return getShorthandValue(borderLeftShorthand()); | 446 return getShorthandValue(borderLeftShorthand()); |
447 case CSSPropertyOutline: | 447 case CSSPropertyOutline: |
448 return getShorthandValue(outlineShorthand()); | 448 return getShorthandValue(outlineShorthand()); |
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
886 return String(); | 886 return String(); |
887 | 887 |
888 bool currentPropertyIsImportant = m_propertySet.propertyIsImportant(shor
thand.properties()[i]); | 888 bool currentPropertyIsImportant = m_propertySet.propertyIsImportant(shor
thand.properties()[i]); |
889 if (i && lastPropertyWasImportant != currentPropertyIsImportant) | 889 if (i && lastPropertyWasImportant != currentPropertyIsImportant) |
890 return String(); | 890 return String(); |
891 lastPropertyWasImportant = currentPropertyIsImportant; | 891 lastPropertyWasImportant = currentPropertyIsImportant; |
892 } | 892 } |
893 return res; | 893 return res; |
894 } | 894 } |
895 | 895 |
896 String StylePropertySerializer::borderPropertyValue(CommonValueMode valueMode) c
onst | 896 String StylePropertySerializer::borderPropertyValue() const |
897 { | 897 { |
898 const StylePropertyShorthand properties[3] = { borderWidthShorthand(), borde
rStyleShorthand(), borderColorShorthand() }; | 898 const StylePropertyShorthand properties[3] = { borderWidthShorthand(), borde
rStyleShorthand(), borderColorShorthand() }; |
899 String commonValue; | 899 String commonValue; |
900 StringBuilder result; | 900 StringBuilder result; |
901 for (size_t i = 0; i < WTF_ARRAY_LENGTH(properties); ++i) { | 901 for (size_t i = 0; i < WTF_ARRAY_LENGTH(properties); ++i) { |
902 String value = getCommonValue(properties[i]); | 902 String value = getCommonValue(properties[i]); |
903 if (value.isNull()) { | 903 if (value.isNull()) |
904 if (valueMode == ReturnNullOnUncommonValues) | 904 return String(); |
905 return String(); | |
906 ASSERT(valueMode == OmitUncommonValues); | |
907 continue; | |
908 } | |
909 if (!i) | 905 if (!i) |
910 commonValue = value; | 906 commonValue = value; |
911 else if (!commonValue.isNull() && commonValue != value) | 907 else if (!commonValue.isNull() && commonValue != value) |
912 commonValue = String(); | 908 commonValue = String(); |
913 if (value == "initial") | 909 if (value == "initial") |
914 continue; | 910 continue; |
915 if (!result.isEmpty()) | 911 if (!result.isEmpty()) |
916 result.append(' '); | 912 result.append(' '); |
917 result.append(value); | 913 result.append(value); |
918 } | 914 } |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1080 isInitialValue = false; | 1076 isInitialValue = false; |
1081 if (!value->isInheritedValue()) | 1077 if (!value->isInheritedValue()) |
1082 isInheritedValue = false; | 1078 isInheritedValue = false; |
1083 if (isImportant != m_propertySet.propertyIsImportant(shorthand.propertie
s()[i])) | 1079 if (isImportant != m_propertySet.propertyIsImportant(shorthand.propertie
s()[i])) |
1084 return false; | 1080 return false; |
1085 } | 1081 } |
1086 return isInitialValue || isInheritedValue; | 1082 return isInitialValue || isInheritedValue; |
1087 } | 1083 } |
1088 | 1084 |
1089 } // namespace blink | 1085 } // namespace blink |
OLD | NEW |