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 3004 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3978 listStyleID = i->id; | 3978 listStyleID = i->id; |
3979 else | 3979 else |
3980 return nullptr; | 3980 return nullptr; |
3981 | 3981 |
3982 listStyle = cssValuePool().createIdentifierValue(listStyleID); | 3982 listStyle = cssValuePool().createIdentifierValue(listStyleID); |
3983 } | 3983 } |
3984 | 3984 |
3985 return CSSCounterValue::create(identifier.release(), listStyle.release(), se
parator.release()); | 3985 return CSSCounterValue::create(identifier.release(), listStyle.release(), se
parator.release()); |
3986 } | 3986 } |
3987 | 3987 |
3988 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> CSSPropertyParser::parseClipShape() | 3988 PassRefPtrWillBeRawPtr<CSSQuadValue> CSSPropertyParser::parseClipShape() |
3989 { | 3989 { |
3990 CSSParserValue* value = m_valueList->current(); | 3990 CSSParserValue* value = m_valueList->current(); |
3991 CSSParserValueList* args = value->function->args.get(); | 3991 CSSParserValueList* args = value->function->args.get(); |
3992 | 3992 |
3993 if (value->function->id != CSSValueRect || !args) | 3993 if (value->function->id != CSSValueRect || !args) |
3994 return nullptr; | 3994 return nullptr; |
3995 | 3995 |
3996 // rect(t, r, b, l) || rect(t r b l) | 3996 // rect(t, r, b, l) || rect(t r b l) |
3997 if (args->size() != 4 && args->size() != 7) | 3997 if (args->size() != 4 && args->size() != 7) |
3998 return nullptr; | 3998 return nullptr; |
3999 RefPtrWillBeRawPtr<Rect> rect = Rect::create(); | |
4000 int i = 0; | 3999 int i = 0; |
4001 CSSParserValue* a = args->current(); | 4000 CSSParserValue* a = args->current(); |
| 4001 |
| 4002 RefPtrWillBeRawPtr<CSSPrimitiveValue> top = nullptr; |
| 4003 RefPtrWillBeRawPtr<CSSPrimitiveValue> right = nullptr; |
| 4004 RefPtrWillBeRawPtr<CSSPrimitiveValue> bottom = nullptr; |
| 4005 RefPtrWillBeRawPtr<CSSPrimitiveValue> left = nullptr; |
4002 while (a) { | 4006 while (a) { |
4003 if (a->id != CSSValueAuto && !validUnit(a, FLength | FUnitlessQuirk)) | 4007 if (a->id != CSSValueAuto && !validUnit(a, FLength | FUnitlessQuirk)) |
4004 return nullptr; | 4008 return nullptr; |
4005 RefPtrWillBeRawPtr<CSSPrimitiveValue> length = a->id == CSSValueAuto ? | 4009 RefPtrWillBeRawPtr<CSSPrimitiveValue> length = a->id == CSSValueAuto ? |
4006 cssValuePool().createIdentifierValue(CSSValueAuto) : | 4010 cssValuePool().createIdentifierValue(CSSValueAuto) : |
4007 createPrimitiveNumericValue(a); | 4011 createPrimitiveNumericValue(a); |
4008 if (i == 0) | 4012 if (i == 0) |
4009 rect->setTop(length); | 4013 top = length; |
4010 else if (i == 1) | 4014 else if (i == 1) |
4011 rect->setRight(length); | 4015 right = length; |
4012 else if (i == 2) | 4016 else if (i == 2) |
4013 rect->setBottom(length); | 4017 bottom = length; |
4014 else | 4018 else |
4015 rect->setLeft(length); | 4019 left = length; |
4016 a = args->next(); | 4020 a = args->next(); |
4017 if (a && args->size() == 7) { | 4021 if (a && args->size() == 7) { |
4018 if (!consumeComma(args)) | 4022 if (!consumeComma(args)) |
4019 return nullptr; | 4023 return nullptr; |
4020 a = args->current(); | 4024 a = args->current(); |
4021 } | 4025 } |
4022 i++; | 4026 i++; |
4023 } | 4027 } |
4024 m_valueList->next(); | 4028 m_valueList->next(); |
4025 return cssValuePool().createValue(rect.release()); | 4029 return CSSQuadValue::createRect(top, right, bottom, left); |
4026 } | 4030 } |
4027 | 4031 |
4028 static void completeBorderRadii(RefPtrWillBeRawPtr<CSSPrimitiveValue> radii[4]) | 4032 static void completeBorderRadii(RefPtrWillBeRawPtr<CSSPrimitiveValue> radii[4]) |
4029 { | 4033 { |
4030 if (radii[3]) | 4034 if (radii[3]) |
4031 return; | 4035 return; |
4032 if (!radii[2]) { | 4036 if (!radii[2]) { |
4033 if (!radii[1]) | 4037 if (!radii[1]) |
4034 radii[1] = radii[0]; | 4038 radii[1] = radii[0]; |
4035 radii[2] = radii[0]; | 4039 radii[2] = radii[0]; |
(...skipping 1459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5495 if (!m_borderWidth && !m_allowWidth) { | 5499 if (!m_borderWidth && !m_allowWidth) { |
5496 m_allowForwardSlashOperator = true; | 5500 m_allowForwardSlashOperator = true; |
5497 m_allowWidth = true; | 5501 m_allowWidth = true; |
5498 m_requireOutset = false; | 5502 m_requireOutset = false; |
5499 } else { | 5503 } else { |
5500 m_allowForwardSlashOperator = false; | 5504 m_allowForwardSlashOperator = false; |
5501 m_requireOutset = true; | 5505 m_requireOutset = true; |
5502 m_allowWidth = false; | 5506 m_allowWidth = false; |
5503 } | 5507 } |
5504 } | 5508 } |
5505 void commitBorderWidth(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> width) | 5509 void commitBorderWidth(PassRefPtrWillBeRawPtr<CSSQuadValue> width) |
5506 { | 5510 { |
5507 m_borderWidth = width; | 5511 m_borderWidth = width; |
5508 m_canAdvance = true; | 5512 m_canAdvance = true; |
5509 m_allowCommit = true; | 5513 m_allowCommit = true; |
5510 m_allowForwardSlashOperator = true; | 5514 m_allowForwardSlashOperator = true; |
5511 m_allowImageSlice = false; | 5515 m_allowImageSlice = false; |
5512 m_allowWidth = false; | 5516 m_allowWidth = false; |
5513 m_requireOutset = false; | 5517 m_requireOutset = false; |
5514 m_allowImage = !m_image; | 5518 m_allowImage = !m_image; |
5515 m_allowRepeat = !m_repeat; | 5519 m_allowRepeat = !m_repeat; |
5516 } | 5520 } |
5517 void commitBorderOutset(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> outset) | 5521 void commitBorderOutset(PassRefPtrWillBeRawPtr<CSSQuadValue> outset) |
5518 { | 5522 { |
5519 m_outset = outset; | 5523 m_outset = outset; |
5520 m_canAdvance = true; | 5524 m_canAdvance = true; |
5521 m_allowCommit = true; | 5525 m_allowCommit = true; |
5522 m_allowImageSlice = false; | 5526 m_allowImageSlice = false; |
5523 m_allowForwardSlashOperator = false; | 5527 m_allowForwardSlashOperator = false; |
5524 m_allowWidth = false; | 5528 m_allowWidth = false; |
5525 m_requireOutset = false; | 5529 m_requireOutset = false; |
5526 m_allowImage = !m_image; | 5530 m_allowImage = !m_image; |
5527 m_allowRepeat = !m_repeat; | 5531 m_allowRepeat = !m_repeat; |
(...skipping 22 matching lines...) Expand all Loading... |
5550 bool m_allowImage; | 5554 bool m_allowImage; |
5551 bool m_allowImageSlice; | 5555 bool m_allowImageSlice; |
5552 bool m_allowRepeat; | 5556 bool m_allowRepeat; |
5553 bool m_allowForwardSlashOperator; | 5557 bool m_allowForwardSlashOperator; |
5554 | 5558 |
5555 bool m_allowWidth; | 5559 bool m_allowWidth; |
5556 bool m_requireOutset; | 5560 bool m_requireOutset; |
5557 | 5561 |
5558 RefPtrWillBeMember<CSSValue> m_image; | 5562 RefPtrWillBeMember<CSSValue> m_image; |
5559 RefPtrWillBeMember<CSSBorderImageSliceValue> m_imageSlice; | 5563 RefPtrWillBeMember<CSSBorderImageSliceValue> m_imageSlice; |
5560 RefPtrWillBeMember<CSSPrimitiveValue> m_borderWidth; | 5564 RefPtrWillBeMember<CSSQuadValue> m_borderWidth; |
5561 RefPtrWillBeMember<CSSPrimitiveValue> m_outset; | 5565 RefPtrWillBeMember<CSSQuadValue> m_outset; |
5562 | 5566 |
5563 RefPtrWillBeMember<CSSValue> m_repeat; | 5567 RefPtrWillBeMember<CSSValue> m_repeat; |
5564 }; | 5568 }; |
5565 | 5569 |
5566 bool CSSPropertyParser::buildBorderImageParseContext(CSSPropertyID propId, Borde
rImageParseContext& context) | 5570 bool CSSPropertyParser::buildBorderImageParseContext(CSSPropertyID propId, Borde
rImageParseContext& context) |
5567 { | 5571 { |
5568 CSSPropertyParser::ShorthandScope scope(this, propId); | 5572 CSSPropertyParser::ShorthandScope scope(this, propId); |
5569 while (CSSParserValue* val = m_valueList->current()) { | 5573 while (CSSParserValue* val = m_valueList->current()) { |
5570 context.setCanAdvance(false); | 5574 context.setCanAdvance(false); |
5571 | 5575 |
(...skipping 25 matching lines...) Expand all Loading... |
5597 context.commitImageSlice(imageSlice.release()); | 5601 context.commitImageSlice(imageSlice.release()); |
5598 } | 5602 } |
5599 | 5603 |
5600 if (!context.canAdvance() && context.allowRepeat()) { | 5604 if (!context.canAdvance() && context.allowRepeat()) { |
5601 RefPtrWillBeRawPtr<CSSValue> repeat = nullptr; | 5605 RefPtrWillBeRawPtr<CSSValue> repeat = nullptr; |
5602 if (parseBorderImageRepeat(repeat)) | 5606 if (parseBorderImageRepeat(repeat)) |
5603 context.commitRepeat(repeat.release()); | 5607 context.commitRepeat(repeat.release()); |
5604 } | 5608 } |
5605 | 5609 |
5606 if (!context.canAdvance() && context.allowWidth()) { | 5610 if (!context.canAdvance() && context.allowWidth()) { |
5607 RefPtrWillBeRawPtr<CSSPrimitiveValue> borderWidth = nullptr; | 5611 RefPtrWillBeRawPtr<CSSQuadValue> borderWidth = nullptr; |
5608 if (parseBorderImageWidth(borderWidth)) | 5612 if (parseBorderImageWidth(borderWidth)) |
5609 context.commitBorderWidth(borderWidth.release()); | 5613 context.commitBorderWidth(borderWidth.release()); |
5610 } | 5614 } |
5611 | 5615 |
5612 if (!context.canAdvance() && context.requireOutset()) { | 5616 if (!context.canAdvance() && context.requireOutset()) { |
5613 RefPtrWillBeRawPtr<CSSPrimitiveValue> borderOutset = nullptr; | 5617 RefPtrWillBeRawPtr<CSSQuadValue> borderOutset = nullptr; |
5614 if (parseBorderImageOutset(borderOutset)) | 5618 if (parseBorderImageOutset(borderOutset)) |
5615 context.commitBorderOutset(borderOutset.release()); | 5619 context.commitBorderOutset(borderOutset.release()); |
5616 } | 5620 } |
5617 | 5621 |
5618 if (!context.canAdvance()) | 5622 if (!context.canAdvance()) |
5619 return false; | 5623 return false; |
5620 | 5624 |
5621 m_valueList->next(); | 5625 m_valueList->next(); |
5622 } | 5626 } |
5623 | 5627 |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5748 m_bottom = m_top; | 5752 m_bottom = m_top; |
5749 m_left = m_top; | 5753 m_left = m_top; |
5750 } | 5754 } |
5751 if (!m_bottom) { | 5755 if (!m_bottom) { |
5752 m_bottom = m_top; | 5756 m_bottom = m_top; |
5753 m_left = m_right; | 5757 m_left = m_right; |
5754 } | 5758 } |
5755 if (!m_left) | 5759 if (!m_left) |
5756 m_left = m_right; | 5760 m_left = m_right; |
5757 | 5761 |
5758 // Now build a rect value to hold all four of our primitive values. | 5762 return CSSBorderImageSliceValue::create(CSSQuadValue::createQuad(m_top,
m_right, m_bottom, m_left), m_fill); |
5759 RefPtrWillBeRawPtr<Quad> quad = Quad::create(); | |
5760 quad->setTop(m_top); | |
5761 quad->setRight(m_right); | |
5762 quad->setBottom(m_bottom); | |
5763 quad->setLeft(m_left); | |
5764 | |
5765 // Make our new border image value now. | |
5766 return CSSBorderImageSliceValue::create(cssValuePool().createValue(quad.
release()), m_fill); | |
5767 } | 5763 } |
5768 | 5764 |
5769 private: | 5765 private: |
5770 bool m_allowNumber; | 5766 bool m_allowNumber; |
5771 bool m_allowFill; | 5767 bool m_allowFill; |
5772 bool m_allowFinalCommit; | 5768 bool m_allowFinalCommit; |
5773 | 5769 |
5774 RefPtrWillBeMember<CSSPrimitiveValue> m_top; | 5770 RefPtrWillBeMember<CSSPrimitiveValue> m_top; |
5775 RefPtrWillBeMember<CSSPrimitiveValue> m_right; | 5771 RefPtrWillBeMember<CSSPrimitiveValue> m_right; |
5776 RefPtrWillBeMember<CSSPrimitiveValue> m_bottom; | 5772 RefPtrWillBeMember<CSSPrimitiveValue> m_bottom; |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5838 ASSERT(!m_left); | 5834 ASSERT(!m_left); |
5839 m_left = val; | 5835 m_left = val; |
5840 } | 5836 } |
5841 | 5837 |
5842 m_allowNumber = !m_left; | 5838 m_allowNumber = !m_left; |
5843 m_allowFinalCommit = true; | 5839 m_allowFinalCommit = true; |
5844 } | 5840 } |
5845 | 5841 |
5846 void setTop(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> val) { m_top = val; } | 5842 void setTop(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> val) { m_top = val; } |
5847 | 5843 |
5848 PassRefPtrWillBeRawPtr<CSSPrimitiveValue> commitBorderImageQuad() | 5844 PassRefPtrWillBeRawPtr<CSSQuadValue> commitBorderImageQuad() |
5849 { | 5845 { |
5850 // We need to clone and repeat values for any omissions. | 5846 // We need to clone and repeat values for any omissions. |
5851 ASSERT(m_top); | 5847 ASSERT(m_top); |
5852 if (!m_right) { | 5848 if (!m_right) { |
5853 m_right = m_top; | 5849 m_right = m_top; |
5854 m_bottom = m_top; | 5850 m_bottom = m_top; |
5855 m_left = m_top; | 5851 m_left = m_top; |
5856 } | 5852 } |
5857 if (!m_bottom) { | 5853 if (!m_bottom) { |
5858 m_bottom = m_top; | 5854 m_bottom = m_top; |
5859 m_left = m_right; | 5855 m_left = m_right; |
5860 } | 5856 } |
5861 if (!m_left) | 5857 if (!m_left) |
5862 m_left = m_right; | 5858 m_left = m_right; |
5863 | 5859 |
5864 // Now build a quad value to hold all four of our primitive values. | 5860 return CSSQuadValue::createQuad(m_top, m_right, m_bottom, m_left); |
5865 RefPtrWillBeRawPtr<Quad> quad = Quad::create(); | |
5866 quad->setTop(m_top); | |
5867 quad->setRight(m_right); | |
5868 quad->setBottom(m_bottom); | |
5869 quad->setLeft(m_left); | |
5870 | |
5871 // Make our new value now. | |
5872 return cssValuePool().createValue(quad.release()); | |
5873 } | 5861 } |
5874 | 5862 |
5875 private: | 5863 private: |
5876 bool m_allowNumber; | 5864 bool m_allowNumber; |
5877 bool m_allowFinalCommit; | 5865 bool m_allowFinalCommit; |
5878 | 5866 |
5879 RefPtrWillBeMember<CSSPrimitiveValue> m_top; | 5867 RefPtrWillBeMember<CSSPrimitiveValue> m_top; |
5880 RefPtrWillBeMember<CSSPrimitiveValue> m_right; | 5868 RefPtrWillBeMember<CSSPrimitiveValue> m_right; |
5881 RefPtrWillBeMember<CSSPrimitiveValue> m_bottom; | 5869 RefPtrWillBeMember<CSSPrimitiveValue> m_bottom; |
5882 RefPtrWillBeMember<CSSPrimitiveValue> m_left; | 5870 RefPtrWillBeMember<CSSPrimitiveValue> m_left; |
5883 }; | 5871 }; |
5884 | 5872 |
5885 bool CSSPropertyParser::parseBorderImageQuad(Units validUnits, RefPtrWillBeRawPt
r<CSSPrimitiveValue>& result) | 5873 bool CSSPropertyParser::parseBorderImageQuad(Units validUnits, RefPtrWillBeRawPt
r<CSSQuadValue>& result) |
5886 { | 5874 { |
5887 BorderImageQuadParseContext context; | 5875 BorderImageQuadParseContext context; |
5888 for (CSSParserValue* val = m_valueList->current(); val; val = m_valueList->n
ext()) { | 5876 for (CSSParserValue* val = m_valueList->current(); val; val = m_valueList->n
ext()) { |
5889 if (context.allowNumber() && (validUnit(val, validUnits, HTMLStandardMod
e) || val->id == CSSValueAuto)) { | 5877 if (context.allowNumber() && (validUnit(val, validUnits, HTMLStandardMod
e) || val->id == CSSValueAuto)) { |
5890 if (val->id == CSSValueAuto) | 5878 if (val->id == CSSValueAuto) |
5891 context.commitNumber(cssValuePool().createIdentifierValue(val->i
d)); | 5879 context.commitNumber(cssValuePool().createIdentifierValue(val->i
d)); |
5892 else | 5880 else |
5893 context.commitNumber(createPrimitiveNumericValue(val)); | 5881 context.commitNumber(createPrimitiveNumericValue(val)); |
5894 } else if (!inShorthand()) { | 5882 } else if (!inShorthand()) { |
5895 // If we're not parsing a shorthand then we are invalid. | 5883 // If we're not parsing a shorthand then we are invalid. |
5896 return false; | 5884 return false; |
5897 } else { | 5885 } else { |
5898 if (context.allowFinalCommit()) | 5886 if (context.allowFinalCommit()) |
5899 m_valueList->previous(); // The shorthand loop will advance back
to this point. | 5887 m_valueList->previous(); // The shorthand loop will advance back
to this point. |
5900 break; | 5888 break; |
5901 } | 5889 } |
5902 } | 5890 } |
5903 | 5891 |
5904 if (context.allowFinalCommit()) { | 5892 if (context.allowFinalCommit()) { |
5905 // Need to fully commit as a single value. | 5893 // Need to fully commit as a single value. |
5906 result = context.commitBorderImageQuad(); | 5894 result = context.commitBorderImageQuad(); |
5907 return true; | 5895 return true; |
5908 } | 5896 } |
5909 return false; | 5897 return false; |
5910 } | 5898 } |
5911 | 5899 |
5912 bool CSSPropertyParser::parseBorderImageWidth(RefPtrWillBeRawPtr<CSSPrimitiveVal
ue>& result) | 5900 bool CSSPropertyParser::parseBorderImageWidth(RefPtrWillBeRawPtr<CSSQuadValue>&
result) |
5913 { | 5901 { |
5914 return parseBorderImageQuad(FLength | FNumber | FNonNeg | FPercent, result); | 5902 return parseBorderImageQuad(FLength | FNumber | FNonNeg | FPercent, result); |
5915 } | 5903 } |
5916 | 5904 |
5917 bool CSSPropertyParser::parseBorderImageOutset(RefPtrWillBeRawPtr<CSSPrimitiveVa
lue>& result) | 5905 bool CSSPropertyParser::parseBorderImageOutset(RefPtrWillBeRawPtr<CSSQuadValue>&
result) |
5918 { | 5906 { |
5919 return parseBorderImageQuad(FLength | FNumber | FNonNeg, result); | 5907 return parseBorderImageQuad(FLength | FNumber | FNonNeg, result); |
5920 } | 5908 } |
5921 | 5909 |
5922 bool CSSPropertyParser::parseBorderRadius(CSSPropertyID unresolvedProperty, bool
important) | 5910 bool CSSPropertyParser::parseBorderRadius(CSSPropertyID unresolvedProperty, bool
important) |
5923 { | 5911 { |
5924 unsigned num = m_valueList->size(); | 5912 unsigned num = m_valueList->size(); |
5925 if (num > 9) | 5913 if (num > 9) |
5926 return false; | 5914 return false; |
5927 | 5915 |
(...skipping 2181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8109 } | 8097 } |
8110 } | 8098 } |
8111 | 8099 |
8112 if (!list->length()) | 8100 if (!list->length()) |
8113 return nullptr; | 8101 return nullptr; |
8114 | 8102 |
8115 return list.release(); | 8103 return list.release(); |
8116 } | 8104 } |
8117 | 8105 |
8118 } // namespace blink | 8106 } // namespace blink |
OLD | NEW |