OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2003 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 2003 Lars Knoll (knoll@kde.org) |
3 * Copyright (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) | 3 * Copyright (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) |
4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc.
All rights reserved. | 4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc.
All rights reserved. |
5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> | 5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> |
6 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> | 6 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> |
7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) | 7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) |
8 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved. | 8 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved. |
9 * Copyright (C) 2012 Intel Corporation. All rights reserved. | 9 * Copyright (C) 2012 Intel Corporation. All rights reserved. |
10 * | 10 * |
(...skipping 28 matching lines...) Expand all Loading... |
39 #include "core/css/CSSFontFeatureValue.h" | 39 #include "core/css/CSSFontFeatureValue.h" |
40 #include "core/css/CSSFunctionValue.h" | 40 #include "core/css/CSSFunctionValue.h" |
41 #include "core/css/CSSGridLineNamesValue.h" | 41 #include "core/css/CSSGridLineNamesValue.h" |
42 #include "core/css/CSSImageSetValue.h" | 42 #include "core/css/CSSImageSetValue.h" |
43 #include "core/css/CSSImageValue.h" | 43 #include "core/css/CSSImageValue.h" |
44 #include "core/css/CSSLineBoxContainValue.h" | 44 #include "core/css/CSSLineBoxContainValue.h" |
45 #include "core/css/CSSPathValue.h" | 45 #include "core/css/CSSPathValue.h" |
46 #include "core/css/CSSPrimitiveValueMappings.h" | 46 #include "core/css/CSSPrimitiveValueMappings.h" |
47 #include "core/css/CSSProperty.h" | 47 #include "core/css/CSSProperty.h" |
48 #include "core/css/CSSPropertyMetadata.h" | 48 #include "core/css/CSSPropertyMetadata.h" |
| 49 #include "core/css/CSSQuadValue.h" |
49 #include "core/css/CSSReflectValue.h" | 50 #include "core/css/CSSReflectValue.h" |
50 #include "core/css/CSSSVGDocumentValue.h" | 51 #include "core/css/CSSSVGDocumentValue.h" |
51 #include "core/css/CSSShadowValue.h" | 52 #include "core/css/CSSShadowValue.h" |
52 #include "core/css/CSSTimingFunctionValue.h" | 53 #include "core/css/CSSTimingFunctionValue.h" |
53 #include "core/css/CSSUnicodeRangeValue.h" | 54 #include "core/css/CSSUnicodeRangeValue.h" |
54 #include "core/css/CSSValuePool.h" | 55 #include "core/css/CSSValuePool.h" |
55 #include "core/css/HashTools.h" | 56 #include "core/css/HashTools.h" |
56 #include "core/css/Pair.h" | 57 #include "core/css/Pair.h" |
57 #include "core/css/Rect.h" | |
58 #include "core/css/parser/CSSParserFastPaths.h" | 58 #include "core/css/parser/CSSParserFastPaths.h" |
59 #include "core/css/parser/CSSParserValues.h" | 59 #include "core/css/parser/CSSParserValues.h" |
60 #include "core/frame/UseCounter.h" | 60 #include "core/frame/UseCounter.h" |
61 #include "core/layout/LayoutTheme.h" | 61 #include "core/layout/LayoutTheme.h" |
62 #include "core/style/GridCoordinate.h" | 62 #include "core/style/GridCoordinate.h" |
63 #include "core/svg/SVGPathUtilities.h" | 63 #include "core/svg/SVGPathUtilities.h" |
64 #include "platform/RuntimeEnabledFeatures.h" | 64 #include "platform/RuntimeEnabledFeatures.h" |
65 | 65 |
66 namespace blink { | 66 namespace blink { |
67 | 67 |
(...skipping 858 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
926 case CSSPropertyWebkitBorderImage: { | 926 case CSSPropertyWebkitBorderImage: { |
927 if (RefPtrWillBeRawPtr<CSSValue> result = parseBorderImage(propId)) { | 927 if (RefPtrWillBeRawPtr<CSSValue> result = parseBorderImage(propId)) { |
928 addProperty(propId, result, important); | 928 addProperty(propId, result, important); |
929 return true; | 929 return true; |
930 } | 930 } |
931 return false; | 931 return false; |
932 } | 932 } |
933 | 933 |
934 case CSSPropertyBorderImageOutset: | 934 case CSSPropertyBorderImageOutset: |
935 case CSSPropertyWebkitMaskBoxImageOutset: { | 935 case CSSPropertyWebkitMaskBoxImageOutset: { |
936 RefPtrWillBeRawPtr<CSSPrimitiveValue> result = nullptr; | 936 RefPtrWillBeRawPtr<CSSQuadValue> result = nullptr; |
937 if (parseBorderImageOutset(result)) { | 937 if (parseBorderImageOutset(result)) { |
938 addProperty(propId, result, important); | 938 addProperty(propId, result, important); |
939 return true; | 939 return true; |
940 } | 940 } |
941 break; | 941 break; |
942 } | 942 } |
943 case CSSPropertyBorderImageRepeat: | 943 case CSSPropertyBorderImageRepeat: |
944 case CSSPropertyWebkitMaskBoxImageRepeat: { | 944 case CSSPropertyWebkitMaskBoxImageRepeat: { |
945 RefPtrWillBeRawPtr<CSSValue> result = nullptr; | 945 RefPtrWillBeRawPtr<CSSValue> result = nullptr; |
946 if (parseBorderImageRepeat(result)) { | 946 if (parseBorderImageRepeat(result)) { |
947 addProperty(propId, result, important); | 947 addProperty(propId, result, important); |
948 return true; | 948 return true; |
949 } | 949 } |
950 break; | 950 break; |
951 } | 951 } |
952 case CSSPropertyBorderImageSlice: | 952 case CSSPropertyBorderImageSlice: |
953 case CSSPropertyWebkitMaskBoxImageSlice: { | 953 case CSSPropertyWebkitMaskBoxImageSlice: { |
954 RefPtrWillBeRawPtr<CSSBorderImageSliceValue> result = nullptr; | 954 RefPtrWillBeRawPtr<CSSBorderImageSliceValue> result = nullptr; |
955 if (parseBorderImageSlice(propId, result)) { | 955 if (parseBorderImageSlice(propId, result)) { |
956 addProperty(propId, result, important); | 956 addProperty(propId, result, important); |
957 return true; | 957 return true; |
958 } | 958 } |
959 break; | 959 break; |
960 } | 960 } |
961 case CSSPropertyBorderImageWidth: | 961 case CSSPropertyBorderImageWidth: |
962 case CSSPropertyWebkitMaskBoxImageWidth: { | 962 case CSSPropertyWebkitMaskBoxImageWidth: { |
963 RefPtrWillBeRawPtr<CSSPrimitiveValue> result = nullptr; | 963 RefPtrWillBeRawPtr<CSSQuadValue> result = nullptr; |
964 if (parseBorderImageWidth(result)) { | 964 if (parseBorderImageWidth(result)) { |
965 addProperty(propId, result, important); | 965 addProperty(propId, result, important); |
966 return true; | 966 return true; |
967 } | 967 } |
968 break; | 968 break; |
969 } | 969 } |
970 case CSSPropertyBorderTopRightRadius: | 970 case CSSPropertyBorderTopRightRadius: |
971 case CSSPropertyBorderTopLeftRadius: | 971 case CSSPropertyBorderTopLeftRadius: |
972 case CSSPropertyBorderBottomLeftRadius: | 972 case CSSPropertyBorderBottomLeftRadius: |
973 case CSSPropertyBorderBottomRightRadius: { | 973 case CSSPropertyBorderBottomRightRadius: { |
(...skipping 2999 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3973 listStyleID = i->id; | 3973 listStyleID = i->id; |
3974 else | 3974 else |
3975 return nullptr; | 3975 return nullptr; |
3976 | 3976 |
3977 listStyle = cssValuePool().createIdentifierValue(listStyleID); | 3977 listStyle = cssValuePool().createIdentifierValue(listStyleID); |
3978 } | 3978 } |
3979 | 3979 |
3980 return CSSCounterValue::create(identifier.release(), listStyle.release(), se
parator.release()); | 3980 return CSSCounterValue::create(identifier.release(), listStyle.release(), se
parator.release()); |
3981 } | 3981 } |
3982 | 3982 |
3983 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> CSSPropertyParser::parseClipShape() | 3983 PassRefPtrWillBeRawPtr<CSSQuadValue> CSSPropertyParser::parseClipShape() |
3984 { | 3984 { |
3985 CSSParserValue* value = m_valueList->current(); | 3985 CSSParserValue* value = m_valueList->current(); |
3986 CSSParserValueList* args = value->function->args.get(); | 3986 CSSParserValueList* args = value->function->args.get(); |
3987 | 3987 |
3988 if (value->function->id != CSSValueRect || !args) | 3988 if (value->function->id != CSSValueRect || !args) |
3989 return nullptr; | 3989 return nullptr; |
3990 | 3990 |
3991 // rect(t, r, b, l) || rect(t r b l) | 3991 // rect(t, r, b, l) || rect(t r b l) |
3992 if (args->size() != 4 && args->size() != 7) | 3992 if (args->size() != 4 && args->size() != 7) |
3993 return nullptr; | 3993 return nullptr; |
3994 RefPtrWillBeRawPtr<Rect> rect = Rect::create(); | |
3995 int i = 0; | 3994 int i = 0; |
3996 CSSParserValue* a = args->current(); | 3995 CSSParserValue* a = args->current(); |
| 3996 |
| 3997 RefPtrWillBeRawPtr<CSSPrimitiveValue> top = nullptr; |
| 3998 RefPtrWillBeRawPtr<CSSPrimitiveValue> right = nullptr; |
| 3999 RefPtrWillBeRawPtr<CSSPrimitiveValue> bottom = nullptr; |
| 4000 RefPtrWillBeRawPtr<CSSPrimitiveValue> left = nullptr; |
3997 while (a) { | 4001 while (a) { |
3998 if (a->id != CSSValueAuto && !validUnit(a, FLength | FUnitlessQuirk)) | 4002 if (a->id != CSSValueAuto && !validUnit(a, FLength | FUnitlessQuirk)) |
3999 return nullptr; | 4003 return nullptr; |
4000 RefPtrWillBeRawPtr<CSSPrimitiveValue> length = a->id == CSSValueAuto ? | 4004 RefPtrWillBeRawPtr<CSSPrimitiveValue> length = a->id == CSSValueAuto ? |
4001 cssValuePool().createIdentifierValue(CSSValueAuto) : | 4005 cssValuePool().createIdentifierValue(CSSValueAuto) : |
4002 createPrimitiveNumericValue(a); | 4006 createPrimitiveNumericValue(a); |
4003 if (i == 0) | 4007 if (i == 0) |
4004 rect->setTop(length); | 4008 top = length; |
4005 else if (i == 1) | 4009 else if (i == 1) |
4006 rect->setRight(length); | 4010 right = length; |
4007 else if (i == 2) | 4011 else if (i == 2) |
4008 rect->setBottom(length); | 4012 bottom = length; |
4009 else | 4013 else |
4010 rect->setLeft(length); | 4014 left = length; |
4011 a = args->next(); | 4015 a = args->next(); |
4012 if (a && args->size() == 7) { | 4016 if (a && args->size() == 7) { |
4013 if (!consumeComma(args)) | 4017 if (!consumeComma(args)) |
4014 return nullptr; | 4018 return nullptr; |
4015 a = args->current(); | 4019 a = args->current(); |
4016 } | 4020 } |
4017 i++; | 4021 i++; |
4018 } | 4022 } |
4019 m_valueList->next(); | 4023 m_valueList->next(); |
4020 return cssValuePool().createValue(rect.release()); | 4024 return CSSQuadValue::create(top.release(), right.release(), bottom.release()
, left.release(), CSSQuadValue::SerializeAsRect); |
4021 } | 4025 } |
4022 | 4026 |
4023 static void completeBorderRadii(RefPtrWillBeRawPtr<CSSPrimitiveValue> radii[4]) | 4027 static void completeBorderRadii(RefPtrWillBeRawPtr<CSSPrimitiveValue> radii[4]) |
4024 { | 4028 { |
4025 if (radii[3]) | 4029 if (radii[3]) |
4026 return; | 4030 return; |
4027 if (!radii[2]) { | 4031 if (!radii[2]) { |
4028 if (!radii[1]) | 4032 if (!radii[1]) |
4029 radii[1] = radii[0]; | 4033 radii[1] = radii[0]; |
4030 radii[2] = radii[0]; | 4034 radii[2] = radii[0]; |
(...skipping 1459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5490 if (!m_borderWidth && !m_allowWidth) { | 5494 if (!m_borderWidth && !m_allowWidth) { |
5491 m_allowForwardSlashOperator = true; | 5495 m_allowForwardSlashOperator = true; |
5492 m_allowWidth = true; | 5496 m_allowWidth = true; |
5493 m_requireOutset = false; | 5497 m_requireOutset = false; |
5494 } else { | 5498 } else { |
5495 m_allowForwardSlashOperator = false; | 5499 m_allowForwardSlashOperator = false; |
5496 m_requireOutset = true; | 5500 m_requireOutset = true; |
5497 m_allowWidth = false; | 5501 m_allowWidth = false; |
5498 } | 5502 } |
5499 } | 5503 } |
5500 void commitBorderWidth(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> width) | 5504 void commitBorderWidth(PassRefPtrWillBeRawPtr<CSSQuadValue> width) |
5501 { | 5505 { |
5502 m_borderWidth = width; | 5506 m_borderWidth = width; |
5503 m_canAdvance = true; | 5507 m_canAdvance = true; |
5504 m_allowCommit = true; | 5508 m_allowCommit = true; |
5505 m_allowForwardSlashOperator = true; | 5509 m_allowForwardSlashOperator = true; |
5506 m_allowImageSlice = false; | 5510 m_allowImageSlice = false; |
5507 m_allowWidth = false; | 5511 m_allowWidth = false; |
5508 m_requireOutset = false; | 5512 m_requireOutset = false; |
5509 m_allowImage = !m_image; | 5513 m_allowImage = !m_image; |
5510 m_allowRepeat = !m_repeat; | 5514 m_allowRepeat = !m_repeat; |
5511 } | 5515 } |
5512 void commitBorderOutset(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> outset) | 5516 void commitBorderOutset(PassRefPtrWillBeRawPtr<CSSQuadValue> outset) |
5513 { | 5517 { |
5514 m_outset = outset; | 5518 m_outset = outset; |
5515 m_canAdvance = true; | 5519 m_canAdvance = true; |
5516 m_allowCommit = true; | 5520 m_allowCommit = true; |
5517 m_allowImageSlice = false; | 5521 m_allowImageSlice = false; |
5518 m_allowForwardSlashOperator = false; | 5522 m_allowForwardSlashOperator = false; |
5519 m_allowWidth = false; | 5523 m_allowWidth = false; |
5520 m_requireOutset = false; | 5524 m_requireOutset = false; |
5521 m_allowImage = !m_image; | 5525 m_allowImage = !m_image; |
5522 m_allowRepeat = !m_repeat; | 5526 m_allowRepeat = !m_repeat; |
(...skipping 22 matching lines...) Expand all Loading... |
5545 bool m_allowImage; | 5549 bool m_allowImage; |
5546 bool m_allowImageSlice; | 5550 bool m_allowImageSlice; |
5547 bool m_allowRepeat; | 5551 bool m_allowRepeat; |
5548 bool m_allowForwardSlashOperator; | 5552 bool m_allowForwardSlashOperator; |
5549 | 5553 |
5550 bool m_allowWidth; | 5554 bool m_allowWidth; |
5551 bool m_requireOutset; | 5555 bool m_requireOutset; |
5552 | 5556 |
5553 RefPtrWillBeMember<CSSValue> m_image; | 5557 RefPtrWillBeMember<CSSValue> m_image; |
5554 RefPtrWillBeMember<CSSBorderImageSliceValue> m_imageSlice; | 5558 RefPtrWillBeMember<CSSBorderImageSliceValue> m_imageSlice; |
5555 RefPtrWillBeMember<CSSPrimitiveValue> m_borderWidth; | 5559 RefPtrWillBeMember<CSSQuadValue> m_borderWidth; |
5556 RefPtrWillBeMember<CSSPrimitiveValue> m_outset; | 5560 RefPtrWillBeMember<CSSQuadValue> m_outset; |
5557 | 5561 |
5558 RefPtrWillBeMember<CSSValue> m_repeat; | 5562 RefPtrWillBeMember<CSSValue> m_repeat; |
5559 }; | 5563 }; |
5560 | 5564 |
5561 bool CSSPropertyParser::buildBorderImageParseContext(CSSPropertyID propId, Borde
rImageParseContext& context) | 5565 bool CSSPropertyParser::buildBorderImageParseContext(CSSPropertyID propId, Borde
rImageParseContext& context) |
5562 { | 5566 { |
5563 CSSPropertyParser::ShorthandScope scope(this, propId); | 5567 CSSPropertyParser::ShorthandScope scope(this, propId); |
5564 while (CSSParserValue* val = m_valueList->current()) { | 5568 while (CSSParserValue* val = m_valueList->current()) { |
5565 context.setCanAdvance(false); | 5569 context.setCanAdvance(false); |
5566 | 5570 |
(...skipping 25 matching lines...) Expand all Loading... |
5592 context.commitImageSlice(imageSlice.release()); | 5596 context.commitImageSlice(imageSlice.release()); |
5593 } | 5597 } |
5594 | 5598 |
5595 if (!context.canAdvance() && context.allowRepeat()) { | 5599 if (!context.canAdvance() && context.allowRepeat()) { |
5596 RefPtrWillBeRawPtr<CSSValue> repeat = nullptr; | 5600 RefPtrWillBeRawPtr<CSSValue> repeat = nullptr; |
5597 if (parseBorderImageRepeat(repeat)) | 5601 if (parseBorderImageRepeat(repeat)) |
5598 context.commitRepeat(repeat.release()); | 5602 context.commitRepeat(repeat.release()); |
5599 } | 5603 } |
5600 | 5604 |
5601 if (!context.canAdvance() && context.allowWidth()) { | 5605 if (!context.canAdvance() && context.allowWidth()) { |
5602 RefPtrWillBeRawPtr<CSSPrimitiveValue> borderWidth = nullptr; | 5606 RefPtrWillBeRawPtr<CSSQuadValue> borderWidth = nullptr; |
5603 if (parseBorderImageWidth(borderWidth)) | 5607 if (parseBorderImageWidth(borderWidth)) |
5604 context.commitBorderWidth(borderWidth.release()); | 5608 context.commitBorderWidth(borderWidth.release()); |
5605 } | 5609 } |
5606 | 5610 |
5607 if (!context.canAdvance() && context.requireOutset()) { | 5611 if (!context.canAdvance() && context.requireOutset()) { |
5608 RefPtrWillBeRawPtr<CSSPrimitiveValue> borderOutset = nullptr; | 5612 RefPtrWillBeRawPtr<CSSQuadValue> borderOutset = nullptr; |
5609 if (parseBorderImageOutset(borderOutset)) | 5613 if (parseBorderImageOutset(borderOutset)) |
5610 context.commitBorderOutset(borderOutset.release()); | 5614 context.commitBorderOutset(borderOutset.release()); |
5611 } | 5615 } |
5612 | 5616 |
5613 if (!context.canAdvance()) | 5617 if (!context.canAdvance()) |
5614 return false; | 5618 return false; |
5615 | 5619 |
5616 m_valueList->next(); | 5620 m_valueList->next(); |
5617 } | 5621 } |
5618 | 5622 |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5743 m_bottom = m_top; | 5747 m_bottom = m_top; |
5744 m_left = m_top; | 5748 m_left = m_top; |
5745 } | 5749 } |
5746 if (!m_bottom) { | 5750 if (!m_bottom) { |
5747 m_bottom = m_top; | 5751 m_bottom = m_top; |
5748 m_left = m_right; | 5752 m_left = m_right; |
5749 } | 5753 } |
5750 if (!m_left) | 5754 if (!m_left) |
5751 m_left = m_right; | 5755 m_left = m_right; |
5752 | 5756 |
5753 // Now build a rect value to hold all four of our primitive values. | 5757 return CSSBorderImageSliceValue::create(CSSQuadValue::create(m_top.relea
se(), m_right.release(), m_bottom.release(), m_left.release(), CSSQuadValue::Ser
ializeAsQuad), m_fill); |
5754 RefPtrWillBeRawPtr<Quad> quad = Quad::create(); | |
5755 quad->setTop(m_top); | |
5756 quad->setRight(m_right); | |
5757 quad->setBottom(m_bottom); | |
5758 quad->setLeft(m_left); | |
5759 | |
5760 // Make our new border image value now. | |
5761 return CSSBorderImageSliceValue::create(cssValuePool().createValue(quad.
release()), m_fill); | |
5762 } | 5758 } |
5763 | 5759 |
5764 private: | 5760 private: |
5765 bool m_allowNumber; | 5761 bool m_allowNumber; |
5766 bool m_allowFill; | 5762 bool m_allowFill; |
5767 bool m_allowFinalCommit; | 5763 bool m_allowFinalCommit; |
5768 | 5764 |
5769 RefPtrWillBeMember<CSSPrimitiveValue> m_top; | 5765 RefPtrWillBeMember<CSSPrimitiveValue> m_top; |
5770 RefPtrWillBeMember<CSSPrimitiveValue> m_right; | 5766 RefPtrWillBeMember<CSSPrimitiveValue> m_right; |
5771 RefPtrWillBeMember<CSSPrimitiveValue> m_bottom; | 5767 RefPtrWillBeMember<CSSPrimitiveValue> m_bottom; |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5833 ASSERT(!m_left); | 5829 ASSERT(!m_left); |
5834 m_left = val; | 5830 m_left = val; |
5835 } | 5831 } |
5836 | 5832 |
5837 m_allowNumber = !m_left; | 5833 m_allowNumber = !m_left; |
5838 m_allowFinalCommit = true; | 5834 m_allowFinalCommit = true; |
5839 } | 5835 } |
5840 | 5836 |
5841 void setTop(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> val) { m_top = val; } | 5837 void setTop(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> val) { m_top = val; } |
5842 | 5838 |
5843 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> commitBorderImageQuad() | 5839 PassRefPtrWillBeRawPtr<CSSQuadValue> commitBorderImageQuad() |
5844 { | 5840 { |
5845 // We need to clone and repeat values for any omissions. | 5841 // We need to clone and repeat values for any omissions. |
5846 ASSERT(m_top); | 5842 ASSERT(m_top); |
5847 if (!m_right) { | 5843 if (!m_right) { |
5848 m_right = m_top; | 5844 m_right = m_top; |
5849 m_bottom = m_top; | 5845 m_bottom = m_top; |
5850 m_left = m_top; | 5846 m_left = m_top; |
5851 } | 5847 } |
5852 if (!m_bottom) { | 5848 if (!m_bottom) { |
5853 m_bottom = m_top; | 5849 m_bottom = m_top; |
5854 m_left = m_right; | 5850 m_left = m_right; |
5855 } | 5851 } |
5856 if (!m_left) | 5852 if (!m_left) |
5857 m_left = m_right; | 5853 m_left = m_right; |
5858 | 5854 |
5859 // Now build a quad value to hold all four of our primitive values. | 5855 return CSSQuadValue::create(m_top.release(), m_right.release(), m_bottom
.release(), m_left.release(), CSSQuadValue::SerializeAsQuad); |
5860 RefPtrWillBeRawPtr<Quad> quad = Quad::create(); | |
5861 quad->setTop(m_top); | |
5862 quad->setRight(m_right); | |
5863 quad->setBottom(m_bottom); | |
5864 quad->setLeft(m_left); | |
5865 | |
5866 // Make our new value now. | |
5867 return cssValuePool().createValue(quad.release()); | |
5868 } | 5856 } |
5869 | 5857 |
5870 private: | 5858 private: |
5871 bool m_allowNumber; | 5859 bool m_allowNumber; |
5872 bool m_allowFinalCommit; | 5860 bool m_allowFinalCommit; |
5873 | 5861 |
5874 RefPtrWillBeMember<CSSPrimitiveValue> m_top; | 5862 RefPtrWillBeMember<CSSPrimitiveValue> m_top; |
5875 RefPtrWillBeMember<CSSPrimitiveValue> m_right; | 5863 RefPtrWillBeMember<CSSPrimitiveValue> m_right; |
5876 RefPtrWillBeMember<CSSPrimitiveValue> m_bottom; | 5864 RefPtrWillBeMember<CSSPrimitiveValue> m_bottom; |
5877 RefPtrWillBeMember<CSSPrimitiveValue> m_left; | 5865 RefPtrWillBeMember<CSSPrimitiveValue> m_left; |
5878 }; | 5866 }; |
5879 | 5867 |
5880 bool CSSPropertyParser::parseBorderImageQuad(Units validUnits, RefPtrWillBeRawPt
r<CSSPrimitiveValue>& result) | 5868 bool CSSPropertyParser::parseBorderImageQuad(Units validUnits, RefPtrWillBeRawPt
r<CSSQuadValue>& result) |
5881 { | 5869 { |
5882 BorderImageQuadParseContext context; | 5870 BorderImageQuadParseContext context; |
5883 for (CSSParserValue* val = m_valueList->current(); val; val = m_valueList->n
ext()) { | 5871 for (CSSParserValue* val = m_valueList->current(); val; val = m_valueList->n
ext()) { |
5884 if (context.allowNumber() && (validUnit(val, validUnits, HTMLStandardMod
e) || val->id == CSSValueAuto)) { | 5872 if (context.allowNumber() && (validUnit(val, validUnits, HTMLStandardMod
e) || val->id == CSSValueAuto)) { |
5885 if (val->id == CSSValueAuto) | 5873 if (val->id == CSSValueAuto) |
5886 context.commitNumber(cssValuePool().createIdentifierValue(val->i
d)); | 5874 context.commitNumber(cssValuePool().createIdentifierValue(val->i
d)); |
5887 else | 5875 else |
5888 context.commitNumber(createPrimitiveNumericValue(val)); | 5876 context.commitNumber(createPrimitiveNumericValue(val)); |
5889 } else if (!inShorthand()) { | 5877 } else if (!inShorthand()) { |
5890 // If we're not parsing a shorthand then we are invalid. | 5878 // If we're not parsing a shorthand then we are invalid. |
5891 return false; | 5879 return false; |
5892 } else { | 5880 } else { |
5893 if (context.allowFinalCommit()) | 5881 if (context.allowFinalCommit()) |
5894 m_valueList->previous(); // The shorthand loop will advance back
to this point. | 5882 m_valueList->previous(); // The shorthand loop will advance back
to this point. |
5895 break; | 5883 break; |
5896 } | 5884 } |
5897 } | 5885 } |
5898 | 5886 |
5899 if (context.allowFinalCommit()) { | 5887 if (context.allowFinalCommit()) { |
5900 // Need to fully commit as a single value. | 5888 // Need to fully commit as a single value. |
5901 result = context.commitBorderImageQuad(); | 5889 result = context.commitBorderImageQuad(); |
5902 return true; | 5890 return true; |
5903 } | 5891 } |
5904 return false; | 5892 return false; |
5905 } | 5893 } |
5906 | 5894 |
5907 bool CSSPropertyParser::parseBorderImageWidth(RefPtrWillBeRawPtr<CSSPrimitiveVal
ue>& result) | 5895 bool CSSPropertyParser::parseBorderImageWidth(RefPtrWillBeRawPtr<CSSQuadValue>&
result) |
5908 { | 5896 { |
5909 return parseBorderImageQuad(FLength | FNumber | FNonNeg | FPercent, result); | 5897 return parseBorderImageQuad(FLength | FNumber | FNonNeg | FPercent, result); |
5910 } | 5898 } |
5911 | 5899 |
5912 bool CSSPropertyParser::parseBorderImageOutset(RefPtrWillBeRawPtr<CSSPrimitiveVa
lue>& result) | 5900 bool CSSPropertyParser::parseBorderImageOutset(RefPtrWillBeRawPtr<CSSQuadValue>&
result) |
5913 { | 5901 { |
5914 return parseBorderImageQuad(FLength | FNumber | FNonNeg, result); | 5902 return parseBorderImageQuad(FLength | FNumber | FNonNeg, result); |
5915 } | 5903 } |
5916 | 5904 |
5917 bool CSSPropertyParser::parseBorderRadius(CSSPropertyID unresolvedProperty, bool
important) | 5905 bool CSSPropertyParser::parseBorderRadius(CSSPropertyID unresolvedProperty, bool
important) |
5918 { | 5906 { |
5919 unsigned num = m_valueList->size(); | 5907 unsigned num = m_valueList->size(); |
5920 if (num > 9) | 5908 if (num > 9) |
5921 return false; | 5909 return false; |
5922 | 5910 |
(...skipping 2181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8104 } | 8092 } |
8105 } | 8093 } |
8106 | 8094 |
8107 if (!list->length()) | 8095 if (!list->length()) |
8108 return nullptr; | 8096 return nullptr; |
8109 | 8097 |
8110 return list.release(); | 8098 return list.release(); |
8111 } | 8099 } |
8112 | 8100 |
8113 } // namespace blink | 8101 } // namespace blink |
OLD | NEW |