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 5838 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5849 m_canAdvance = true; | 5849 m_canAdvance = true; |
5850 m_allowCommit = m_allowForwardSlashOperator = true; | 5850 m_allowCommit = m_allowForwardSlashOperator = true; |
5851 m_allowImageSlice = m_requireWidth = m_requireOutset = false; | 5851 m_allowImageSlice = m_requireWidth = m_requireOutset = false; |
5852 m_allowImage = !m_image; | 5852 m_allowImage = !m_image; |
5853 m_allowRepeat = !m_repeat; | 5853 m_allowRepeat = !m_repeat; |
5854 } | 5854 } |
5855 void commitForwardSlashOperator() | 5855 void commitForwardSlashOperator() |
5856 { | 5856 { |
5857 m_canAdvance = true; | 5857 m_canAdvance = true; |
5858 m_allowCommit = m_allowImage = m_allowImageSlice = m_allowRepeat = m_all
owForwardSlashOperator = false; | 5858 m_allowCommit = m_allowImage = m_allowImageSlice = m_allowRepeat = m_all
owForwardSlashOperator = false; |
5859 if (!m_borderSlice) { | 5859 if (!m_borderWidth) { |
5860 m_requireWidth = true; | 5860 m_requireWidth = true; |
5861 m_requireOutset = false; | 5861 m_requireOutset = false; |
5862 } else { | 5862 } else { |
5863 m_requireOutset = true; | 5863 m_requireOutset = true; |
5864 m_requireWidth = false; | 5864 m_requireWidth = false; |
5865 } | 5865 } |
5866 } | 5866 } |
5867 void commitBorderWidth(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> slice) | 5867 void commitBorderWidth(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> width) |
5868 { | 5868 { |
5869 m_borderSlice = slice; | 5869 m_borderWidth = width; |
5870 m_canAdvance = true; | 5870 m_canAdvance = true; |
5871 m_allowCommit = m_allowForwardSlashOperator = true; | 5871 m_allowCommit = m_allowForwardSlashOperator = true; |
5872 m_allowImageSlice = m_requireWidth = m_requireOutset = false; | 5872 m_allowImageSlice = m_requireWidth = m_requireOutset = false; |
5873 m_allowImage = !m_image; | 5873 m_allowImage = !m_image; |
5874 m_allowRepeat = !m_repeat; | 5874 m_allowRepeat = !m_repeat; |
5875 } | 5875 } |
5876 void commitBorderOutset(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> outset) | 5876 void commitBorderOutset(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> outset) |
5877 { | 5877 { |
5878 m_outset = outset; | 5878 m_outset = outset; |
5879 m_canAdvance = true; | 5879 m_canAdvance = true; |
5880 m_allowCommit = true; | 5880 m_allowCommit = true; |
5881 m_allowImageSlice = m_allowForwardSlashOperator = m_requireWidth = m_req
uireOutset = false; | 5881 m_allowImageSlice = m_allowForwardSlashOperator = m_requireWidth = m_req
uireOutset = false; |
5882 m_allowImage = !m_image; | 5882 m_allowImage = !m_image; |
5883 m_allowRepeat = !m_repeat; | 5883 m_allowRepeat = !m_repeat; |
5884 } | 5884 } |
5885 void commitRepeat(PassRefPtrWillBeRawPtr<CSSValue> repeat) | 5885 void commitRepeat(PassRefPtrWillBeRawPtr<CSSValue> repeat) |
5886 { | 5886 { |
5887 m_repeat = repeat; | 5887 m_repeat = repeat; |
5888 m_canAdvance = true; | 5888 m_canAdvance = true; |
5889 m_allowCommit = true; | 5889 m_allowCommit = true; |
5890 m_allowRepeat = m_allowForwardSlashOperator = m_requireWidth = m_require
Outset = false; | 5890 m_allowRepeat = m_allowForwardSlashOperator = m_requireWidth = m_require
Outset = false; |
5891 m_allowImageSlice = !m_imageSlice; | 5891 m_allowImageSlice = !m_imageSlice; |
5892 m_allowImage = !m_image; | 5892 m_allowImage = !m_image; |
5893 } | 5893 } |
5894 | 5894 |
5895 PassRefPtrWillBeRawPtr<CSSValue> commitCSSValue() | 5895 PassRefPtrWillBeRawPtr<CSSValue> commitCSSValue() |
5896 { | 5896 { |
5897 return createBorderImageValue(m_image, m_imageSlice.get(), m_borderSlice
.get(), m_outset.get(), m_repeat.get()); | 5897 return createBorderImageValue(m_image, m_imageSlice.get(), m_borderWidth
.get(), m_outset.get(), m_repeat.get()); |
5898 } | 5898 } |
5899 | 5899 |
5900 void commitMaskBoxImage(CSSPropertyParser* parser, bool important) | 5900 void commitMaskBoxImage(CSSPropertyParser* parser, bool important) |
5901 { | 5901 { |
5902 commitBorderImageProperty(CSSPropertyWebkitMaskBoxImageSource, parser, m
_image, important); | 5902 commitBorderImageProperty(CSSPropertyWebkitMaskBoxImageSource, parser, m
_image, important); |
5903 commitBorderImageProperty(CSSPropertyWebkitMaskBoxImageSlice, parser, m_
imageSlice.get(), important); | 5903 commitBorderImageProperty(CSSPropertyWebkitMaskBoxImageSlice, parser, m_
imageSlice.get(), important); |
5904 commitBorderImageProperty(CSSPropertyWebkitMaskBoxImageWidth, parser, m_
borderSlice.get(), important); | 5904 commitBorderImageProperty(CSSPropertyWebkitMaskBoxImageWidth, parser, m_
borderWidth.get(), important); |
5905 commitBorderImageProperty(CSSPropertyWebkitMaskBoxImageOutset, parser, m
_outset.get(), important); | 5905 commitBorderImageProperty(CSSPropertyWebkitMaskBoxImageOutset, parser, m
_outset.get(), important); |
5906 commitBorderImageProperty(CSSPropertyWebkitMaskBoxImageRepeat, parser, m
_repeat.get(), important); | 5906 commitBorderImageProperty(CSSPropertyWebkitMaskBoxImageRepeat, parser, m
_repeat.get(), important); |
5907 } | 5907 } |
5908 | 5908 |
5909 void commitBorderImage(CSSPropertyParser* parser, bool important) | 5909 void commitBorderImage(CSSPropertyParser* parser, bool important) |
5910 { | 5910 { |
5911 commitBorderImageProperty(CSSPropertyBorderImageSource, parser, m_image,
important); | 5911 commitBorderImageProperty(CSSPropertyBorderImageSource, parser, m_image,
important); |
5912 commitBorderImageProperty(CSSPropertyBorderImageSlice, parser, m_imageSl
ice.get(), important); | 5912 commitBorderImageProperty(CSSPropertyBorderImageSlice, parser, m_imageSl
ice.get(), important); |
5913 commitBorderImageProperty(CSSPropertyBorderImageWidth, parser, m_borderS
lice.get(), important); | 5913 commitBorderImageProperty(CSSPropertyBorderImageWidth, parser, m_borderW
idth.get(), important); |
5914 commitBorderImageProperty(CSSPropertyBorderImageOutset, parser, m_outset
.get(), important); | 5914 commitBorderImageProperty(CSSPropertyBorderImageOutset, parser, m_outset
.get(), important); |
5915 commitBorderImageProperty(CSSPropertyBorderImageRepeat, parser, m_repeat
, important); | 5915 commitBorderImageProperty(CSSPropertyBorderImageRepeat, parser, m_repeat
, important); |
5916 } | 5916 } |
5917 | 5917 |
5918 void commitBorderImageProperty(CSSPropertyID propId, CSSPropertyParser* pars
er, PassRefPtrWillBeRawPtr<CSSValue> value, bool important) | 5918 void commitBorderImageProperty(CSSPropertyID propId, CSSPropertyParser* pars
er, PassRefPtrWillBeRawPtr<CSSValue> value, bool important) |
5919 { | 5919 { |
5920 if (value) | 5920 if (value) |
5921 parser->addProperty(propId, value, important); | 5921 parser->addProperty(propId, value, important); |
5922 else | 5922 else |
5923 parser->addProperty(propId, cssValuePool().createImplicitInitialValu
e(), important, true); | 5923 parser->addProperty(propId, cssValuePool().createImplicitInitialValu
e(), important, true); |
5924 } | 5924 } |
5925 | 5925 |
5926 static bool buildFromParser(CSSPropertyParser&, CSSPropertyID, BorderImagePa
rseContext&); | 5926 static bool buildFromParser(CSSPropertyParser&, CSSPropertyID, BorderImagePa
rseContext&); |
5927 | 5927 |
5928 bool m_canAdvance; | 5928 bool m_canAdvance; |
5929 | 5929 |
5930 bool m_allowCommit; | 5930 bool m_allowCommit; |
5931 bool m_allowImage; | 5931 bool m_allowImage; |
5932 bool m_allowImageSlice; | 5932 bool m_allowImageSlice; |
5933 bool m_allowRepeat; | 5933 bool m_allowRepeat; |
5934 bool m_allowForwardSlashOperator; | 5934 bool m_allowForwardSlashOperator; |
5935 | 5935 |
5936 bool m_requireWidth; | 5936 bool m_requireWidth; |
5937 bool m_requireOutset; | 5937 bool m_requireOutset; |
5938 | 5938 |
5939 RefPtrWillBeMember<CSSValue> m_image; | 5939 RefPtrWillBeMember<CSSValue> m_image; |
5940 RefPtrWillBeMember<CSSBorderImageSliceValue> m_imageSlice; | 5940 RefPtrWillBeMember<CSSBorderImageSliceValue> m_imageSlice; |
5941 RefPtrWillBeMember<CSSPrimitiveValue> m_borderSlice; | 5941 RefPtrWillBeMember<CSSPrimitiveValue> m_borderWidth; |
5942 RefPtrWillBeMember<CSSPrimitiveValue> m_outset; | 5942 RefPtrWillBeMember<CSSPrimitiveValue> m_outset; |
5943 | 5943 |
5944 RefPtrWillBeMember<CSSValue> m_repeat; | 5944 RefPtrWillBeMember<CSSValue> m_repeat; |
5945 }; | 5945 }; |
5946 | 5946 |
5947 bool BorderImageParseContext::buildFromParser(CSSPropertyParser& parser, CSSProp
ertyID propId, BorderImageParseContext& context) | 5947 bool BorderImageParseContext::buildFromParser(CSSPropertyParser& parser, CSSProp
ertyID propId, BorderImageParseContext& context) |
5948 { | 5948 { |
5949 CSSPropertyParser::ShorthandScope scope(&parser, propId); | 5949 CSSPropertyParser::ShorthandScope scope(&parser, propId); |
5950 while (CSSParserValue* val = parser.m_valueList->current()) { | 5950 while (CSSParserValue* val = parser.m_valueList->current()) { |
5951 context.setCanAdvance(false); | 5951 context.setCanAdvance(false); |
(...skipping 26 matching lines...) Expand all Loading... |
5978 context.commitImageSlice(imageSlice.release()); | 5978 context.commitImageSlice(imageSlice.release()); |
5979 } | 5979 } |
5980 | 5980 |
5981 if (!context.canAdvance() && context.allowRepeat()) { | 5981 if (!context.canAdvance() && context.allowRepeat()) { |
5982 RefPtrWillBeRawPtr<CSSValue> repeat = nullptr; | 5982 RefPtrWillBeRawPtr<CSSValue> repeat = nullptr; |
5983 if (parser.parseBorderImageRepeat(repeat)) | 5983 if (parser.parseBorderImageRepeat(repeat)) |
5984 context.commitRepeat(repeat.release()); | 5984 context.commitRepeat(repeat.release()); |
5985 } | 5985 } |
5986 | 5986 |
5987 if (!context.canAdvance() && context.requireWidth()) { | 5987 if (!context.canAdvance() && context.requireWidth()) { |
5988 RefPtrWillBeRawPtr<CSSPrimitiveValue> borderSlice = nullptr; | 5988 RefPtrWillBeRawPtr<CSSPrimitiveValue> borderWidth = nullptr; |
5989 if (parser.parseBorderImageWidth(borderSlice)) | 5989 if (parser.parseBorderImageWidth(borderWidth)) |
5990 context.commitBorderWidth(borderSlice.release()); | 5990 context.commitBorderWidth(borderWidth.release()); |
5991 } | 5991 } |
5992 | 5992 |
5993 if (!context.canAdvance() && context.requireOutset()) { | 5993 if (!context.canAdvance() && context.requireOutset()) { |
5994 RefPtrWillBeRawPtr<CSSPrimitiveValue> borderOutset = nullptr; | 5994 RefPtrWillBeRawPtr<CSSPrimitiveValue> borderOutset = nullptr; |
5995 if (parser.parseBorderImageOutset(borderOutset)) | 5995 if (parser.parseBorderImageOutset(borderOutset)) |
5996 context.commitBorderOutset(borderOutset.release()); | 5996 context.commitBorderOutset(borderOutset.release()); |
5997 } | 5997 } |
5998 | 5998 |
5999 if (!context.canAdvance()) | 5999 if (!context.canAdvance()) |
6000 return false; | 6000 return false; |
(...skipping 2535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8536 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueFill)); | 8536 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueFill)); |
8537 if (!seenStroke) | 8537 if (!seenStroke) |
8538 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueStroke)
); | 8538 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueStroke)
); |
8539 if (!seenMarkers) | 8539 if (!seenMarkers) |
8540 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueMarkers
)); | 8540 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueMarkers
)); |
8541 | 8541 |
8542 return parsedValues.release(); | 8542 return parsedValues.release(); |
8543 } | 8543 } |
8544 | 8544 |
8545 } // namespace blink | 8545 } // namespace blink |
OLD | NEW |