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 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
495 // can safely be omitted. | 495 // can safely be omitted. |
496 for (size_t i = 0; i < numLayers; i++) { | 496 for (size_t i = 0; i < numLayers; i++) { |
497 StringBuilder layerResult; | 497 StringBuilder layerResult; |
498 bool useRepeatXShorthand = false; | 498 bool useRepeatXShorthand = false; |
499 bool useRepeatYShorthand = false; | 499 bool useRepeatYShorthand = false; |
500 bool useSingleWordShorthand = false; | 500 bool useSingleWordShorthand = false; |
501 bool foundPositionYCSSProperty = false; | 501 bool foundPositionYCSSProperty = false; |
502 for (unsigned j = 0; j < size; j++) { | 502 for (unsigned j = 0; j < size; j++) { |
503 RefPtrWillBeRawPtr<CSSValue> value = nullptr; | 503 RefPtrWillBeRawPtr<CSSValue> value = nullptr; |
504 if (values[j]) { | 504 if (values[j]) { |
505 if (values[j]->isBaseValueList()) | 505 if (values[j]->isBaseValueList()) { |
506 value = toCSSValueList(values[j].get())->item(i); | 506 value = toCSSValueList(values[j].get())->itemWithBoundsCheck
(i); |
507 else { | 507 } else { |
508 value = values[j]; | 508 value = values[j]; |
509 | 509 |
510 // Color only belongs in the last layer. | 510 // Color only belongs in the last layer. |
511 if (shorthand.properties()[j] == CSSPropertyBackgroundColor)
{ | 511 if (shorthand.properties()[j] == CSSPropertyBackgroundColor)
{ |
512 if (i != numLayers - 1) | 512 if (i != numLayers - 1) |
513 value = nullptr; | 513 value = nullptr; |
514 } else if (i) { | 514 } else if (i) { |
515 // Other singletons only belong in the first layer. | 515 // Other singletons only belong in the first layer. |
516 value = nullptr; | 516 value = nullptr; |
517 } | 517 } |
518 } | 518 } |
519 } | 519 } |
520 | 520 |
521 // We need to report background-repeat as it was written in the CSS.
If the property is implicit, | 521 // We need to report background-repeat as it was written in the CSS.
If the property is implicit, |
522 // then it was written with only one value. Here we figure out which
value that was so we can | 522 // then it was written with only one value. Here we figure out which
value that was so we can |
523 // report back correctly. | 523 // report back correctly. |
524 if ((shorthand.properties()[j] == CSSPropertyBackgroundRepeatX && m_
propertySet.isPropertyImplicit(shorthand.properties()[j])) | 524 if ((shorthand.properties()[j] == CSSPropertyBackgroundRepeatX && m_
propertySet.isPropertyImplicit(shorthand.properties()[j])) |
525 || (shorthand.properties()[j] == CSSPropertyWebkitMaskRepeatX &&
m_propertySet.isPropertyImplicit(shorthand.properties()[j]))) { | 525 || (shorthand.properties()[j] == CSSPropertyWebkitMaskRepeatX &&
m_propertySet.isPropertyImplicit(shorthand.properties()[j]))) { |
526 | 526 |
527 // BUG 49055: make sure the value was not reset in the layer che
ck just above. | 527 // BUG 49055: make sure the value was not reset in the layer che
ck just above. |
528 if ((j < size - 1 && shorthand.properties()[j + 1] == CSSPropert
yBackgroundRepeatY && value) | 528 if ((j < size - 1 && shorthand.properties()[j + 1] == CSSPropert
yBackgroundRepeatY && value) |
529 || (j < size - 1 && shorthand.properties()[j + 1] == CSSProp
ertyWebkitMaskRepeatY && value)) { | 529 || (j < size - 1 && shorthand.properties()[j + 1] == CSSProp
ertyWebkitMaskRepeatY && value)) { |
530 RefPtrWillBeRawPtr<CSSValue> yValue = nullptr; | 530 RefPtrWillBeRawPtr<CSSValue> yValue = nullptr; |
531 RefPtrWillBeRawPtr<CSSValue> nextValue = values[j + 1]; | 531 RefPtrWillBeRawPtr<CSSValue> nextValue = values[j + 1]; |
532 if (nextValue->isValueList()) | 532 if (nextValue->isValueList()) |
533 yValue = toCSSValueList(nextValue.get())->itemWithoutBou
ndsCheck(i); | 533 yValue = toCSSValueList(nextValue.get())->item(i); |
534 else | 534 else |
535 yValue = nextValue; | 535 yValue = nextValue; |
536 | 536 |
537 // background-repeat-x(y) or mask-repeat-x(y) may be like th
is : "initial, repeat". We can omit the implicit initial values | 537 // background-repeat-x(y) or mask-repeat-x(y) may be like th
is : "initial, repeat". We can omit the implicit initial values |
538 // before starting to compare their values. | 538 // before starting to compare their values. |
539 if (value->isImplicitInitialValue() || yValue->isImplicitIni
tialValue()) | 539 if (value->isImplicitInitialValue() || yValue->isImplicitIni
tialValue()) |
540 continue; | 540 continue; |
541 | 541 |
542 // FIXME: At some point we need to fix this code to avoid re
turning an invalid shorthand, | 542 // FIXME: At some point we need to fix this code to avoid re
turning an invalid shorthand, |
543 // since some longhand combinations are not serializable int
o a single shorthand. | 543 // since some longhand combinations are not serializable int
o a single shorthand. |
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
863 isInitialValue = false; | 863 isInitialValue = false; |
864 if (!value->isInheritedValue()) | 864 if (!value->isInheritedValue()) |
865 isInheritedValue = false; | 865 isInheritedValue = false; |
866 if (isImportant != m_propertySet.propertyIsImportant(shorthand.propertie
s()[i])) | 866 if (isImportant != m_propertySet.propertyIsImportant(shorthand.propertie
s()[i])) |
867 return false; | 867 return false; |
868 } | 868 } |
869 return isInitialValue || isInheritedValue; | 869 return isInitialValue || isInheritedValue; |
870 } | 870 } |
871 | 871 |
872 } | 872 } |
OLD | NEW |