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 5682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5693 class BorderImageParseContext { | 5693 class BorderImageParseContext { |
5694 STACK_ALLOCATED(); | 5694 STACK_ALLOCATED(); |
5695 public: | 5695 public: |
5696 BorderImageParseContext() | 5696 BorderImageParseContext() |
5697 : m_canAdvance(false) | 5697 : m_canAdvance(false) |
5698 , m_allowCommit(true) | 5698 , m_allowCommit(true) |
5699 , m_allowImage(true) | 5699 , m_allowImage(true) |
5700 , m_allowImageSlice(true) | 5700 , m_allowImageSlice(true) |
5701 , m_allowRepeat(true) | 5701 , m_allowRepeat(true) |
5702 , m_allowForwardSlashOperator(false) | 5702 , m_allowForwardSlashOperator(false) |
5703 , m_requireWidth(false) | 5703 , m_allowWidth(false) |
5704 , m_requireOutset(false) | 5704 , m_requireOutset(false) |
5705 {} | 5705 {} |
5706 | 5706 |
5707 bool canAdvance() const { return m_canAdvance; } | 5707 bool canAdvance() const { return m_canAdvance; } |
5708 void setCanAdvance(bool canAdvance) { m_canAdvance = canAdvance; } | 5708 void setCanAdvance(bool canAdvance) { m_canAdvance = canAdvance; } |
5709 | 5709 |
5710 bool allowCommit() const { return m_allowCommit; } | 5710 bool allowCommit() const { return m_allowCommit; } |
5711 bool allowImage() const { return m_allowImage; } | 5711 bool allowImage() const { return m_allowImage; } |
5712 bool allowImageSlice() const { return m_allowImageSlice; } | 5712 bool allowImageSlice() const { return m_allowImageSlice; } |
5713 bool allowRepeat() const { return m_allowRepeat; } | 5713 bool allowRepeat() const { return m_allowRepeat; } |
5714 bool allowForwardSlashOperator() const { return m_allowForwardSlashOperator;
} | 5714 bool allowForwardSlashOperator() const { return m_allowForwardSlashOperator;
} |
5715 | 5715 |
5716 bool requireWidth() const { return m_requireWidth; } | 5716 bool allowWidth() const { return m_allowWidth; } |
5717 bool requireOutset() const { return m_requireOutset; } | 5717 bool requireOutset() const { return m_requireOutset; } |
5718 | 5718 |
5719 void commitImage(PassRefPtrWillBeRawPtr<CSSValue> image) | 5719 void commitImage(PassRefPtrWillBeRawPtr<CSSValue> image) |
5720 { | 5720 { |
5721 m_image = image; | 5721 m_image = image; |
5722 m_canAdvance = true; | 5722 m_canAdvance = true; |
5723 m_allowCommit = true; | 5723 m_allowCommit = true; |
5724 m_allowImage = m_allowForwardSlashOperator = m_requireWidth = m_requireO
utset = false; | 5724 m_allowImage = m_allowForwardSlashOperator = m_allowWidth = m_requireOut
set = false; |
5725 m_allowImageSlice = !m_imageSlice; | 5725 m_allowImageSlice = !m_imageSlice; |
5726 m_allowRepeat = !m_repeat; | 5726 m_allowRepeat = !m_repeat; |
5727 } | 5727 } |
5728 void commitImageSlice(PassRefPtrWillBeRawPtr<CSSBorderImageSliceValue> slice
) | 5728 void commitImageSlice(PassRefPtrWillBeRawPtr<CSSBorderImageSliceValue> slice
) |
5729 { | 5729 { |
5730 m_imageSlice = slice; | 5730 m_imageSlice = slice; |
5731 m_canAdvance = true; | 5731 m_canAdvance = true; |
5732 m_allowCommit = m_allowForwardSlashOperator = true; | 5732 m_allowCommit = m_allowForwardSlashOperator = true; |
5733 m_allowImageSlice = m_requireWidth = m_requireOutset = false; | 5733 m_allowImageSlice = m_allowWidth = m_requireOutset = false; |
5734 m_allowImage = !m_image; | 5734 m_allowImage = !m_image; |
5735 m_allowRepeat = !m_repeat; | 5735 m_allowRepeat = !m_repeat; |
5736 } | 5736 } |
5737 void commitForwardSlashOperator() | 5737 void commitForwardSlashOperator() |
5738 { | 5738 { |
5739 m_canAdvance = true; | 5739 m_canAdvance = true; |
5740 m_allowCommit = m_allowImage = m_allowImageSlice = m_allowRepeat = m_all
owForwardSlashOperator = false; | 5740 m_allowCommit = m_allowImage = m_allowImageSlice = m_allowRepeat = false
; |
5741 if (!m_borderWidth) { | 5741 if (!m_borderWidth && !m_allowWidth) { |
5742 m_requireWidth = true; | 5742 m_allowForwardSlashOperator = true; |
| 5743 m_allowWidth = true; |
5743 m_requireOutset = false; | 5744 m_requireOutset = false; |
5744 } else { | 5745 } else { |
| 5746 m_allowForwardSlashOperator = false; |
5745 m_requireOutset = true; | 5747 m_requireOutset = true; |
5746 m_requireWidth = false; | 5748 m_allowWidth = false; |
5747 } | 5749 } |
5748 } | 5750 } |
5749 void commitBorderWidth(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> width) | 5751 void commitBorderWidth(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> width) |
5750 { | 5752 { |
5751 m_borderWidth = width; | 5753 m_borderWidth = width; |
5752 m_canAdvance = true; | 5754 m_canAdvance = true; |
5753 m_allowCommit = m_allowForwardSlashOperator = true; | 5755 m_allowCommit = m_allowForwardSlashOperator = true; |
5754 m_allowImageSlice = m_requireWidth = m_requireOutset = false; | 5756 m_allowImageSlice = m_allowWidth = m_requireOutset = false; |
5755 m_allowImage = !m_image; | 5757 m_allowImage = !m_image; |
5756 m_allowRepeat = !m_repeat; | 5758 m_allowRepeat = !m_repeat; |
5757 } | 5759 } |
5758 void commitBorderOutset(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> outset) | 5760 void commitBorderOutset(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> outset) |
5759 { | 5761 { |
5760 m_outset = outset; | 5762 m_outset = outset; |
5761 m_canAdvance = true; | 5763 m_canAdvance = true; |
5762 m_allowCommit = true; | 5764 m_allowCommit = true; |
5763 m_allowImageSlice = m_allowForwardSlashOperator = m_requireWidth = m_req
uireOutset = false; | 5765 m_allowImageSlice = m_allowForwardSlashOperator = m_allowWidth = m_requi
reOutset = false; |
5764 m_allowImage = !m_image; | 5766 m_allowImage = !m_image; |
5765 m_allowRepeat = !m_repeat; | 5767 m_allowRepeat = !m_repeat; |
5766 } | 5768 } |
5767 void commitRepeat(PassRefPtrWillBeRawPtr<CSSValue> repeat) | 5769 void commitRepeat(PassRefPtrWillBeRawPtr<CSSValue> repeat) |
5768 { | 5770 { |
5769 m_repeat = repeat; | 5771 m_repeat = repeat; |
5770 m_canAdvance = true; | 5772 m_canAdvance = true; |
5771 m_allowCommit = true; | 5773 m_allowCommit = true; |
5772 m_allowRepeat = m_allowForwardSlashOperator = m_requireWidth = m_require
Outset = false; | 5774 m_allowRepeat = m_allowForwardSlashOperator = m_allowWidth = m_requireOu
tset = false; |
5773 m_allowImageSlice = !m_imageSlice; | 5775 m_allowImageSlice = !m_imageSlice; |
5774 m_allowImage = !m_image; | 5776 m_allowImage = !m_image; |
5775 } | 5777 } |
5776 | 5778 |
5777 PassRefPtrWillBeRawPtr<CSSValue> commitCSSValue() | 5779 PassRefPtrWillBeRawPtr<CSSValue> commitCSSValue() |
5778 { | 5780 { |
5779 return createBorderImageValue(m_image, m_imageSlice.get(), m_borderWidth
.get(), m_outset.get(), m_repeat.get()); | 5781 return createBorderImageValue(m_image, m_imageSlice.get(), m_borderWidth
.get(), m_outset.get(), m_repeat.get()); |
5780 } | 5782 } |
5781 | 5783 |
5782 void commitMaskBoxImage(CSSPropertyParser* parser, bool important) | 5784 void commitMaskBoxImage(CSSPropertyParser* parser, bool important) |
(...skipping 25 matching lines...) Expand all Loading... |
5808 static bool buildFromParser(CSSPropertyParser&, CSSPropertyID, BorderImagePa
rseContext&); | 5810 static bool buildFromParser(CSSPropertyParser&, CSSPropertyID, BorderImagePa
rseContext&); |
5809 | 5811 |
5810 bool m_canAdvance; | 5812 bool m_canAdvance; |
5811 | 5813 |
5812 bool m_allowCommit; | 5814 bool m_allowCommit; |
5813 bool m_allowImage; | 5815 bool m_allowImage; |
5814 bool m_allowImageSlice; | 5816 bool m_allowImageSlice; |
5815 bool m_allowRepeat; | 5817 bool m_allowRepeat; |
5816 bool m_allowForwardSlashOperator; | 5818 bool m_allowForwardSlashOperator; |
5817 | 5819 |
5818 bool m_requireWidth; | 5820 bool m_allowWidth; |
5819 bool m_requireOutset; | 5821 bool m_requireOutset; |
5820 | 5822 |
5821 RefPtrWillBeMember<CSSValue> m_image; | 5823 RefPtrWillBeMember<CSSValue> m_image; |
5822 RefPtrWillBeMember<CSSBorderImageSliceValue> m_imageSlice; | 5824 RefPtrWillBeMember<CSSBorderImageSliceValue> m_imageSlice; |
5823 RefPtrWillBeMember<CSSPrimitiveValue> m_borderWidth; | 5825 RefPtrWillBeMember<CSSPrimitiveValue> m_borderWidth; |
5824 RefPtrWillBeMember<CSSPrimitiveValue> m_outset; | 5826 RefPtrWillBeMember<CSSPrimitiveValue> m_outset; |
5825 | 5827 |
5826 RefPtrWillBeMember<CSSValue> m_repeat; | 5828 RefPtrWillBeMember<CSSValue> m_repeat; |
5827 }; | 5829 }; |
5828 | 5830 |
(...skipping 30 matching lines...) Expand all Loading... |
5859 if (parser.parseBorderImageSlice(propId, imageSlice)) | 5861 if (parser.parseBorderImageSlice(propId, imageSlice)) |
5860 context.commitImageSlice(imageSlice.release()); | 5862 context.commitImageSlice(imageSlice.release()); |
5861 } | 5863 } |
5862 | 5864 |
5863 if (!context.canAdvance() && context.allowRepeat()) { | 5865 if (!context.canAdvance() && context.allowRepeat()) { |
5864 RefPtrWillBeRawPtr<CSSValue> repeat = nullptr; | 5866 RefPtrWillBeRawPtr<CSSValue> repeat = nullptr; |
5865 if (parser.parseBorderImageRepeat(repeat)) | 5867 if (parser.parseBorderImageRepeat(repeat)) |
5866 context.commitRepeat(repeat.release()); | 5868 context.commitRepeat(repeat.release()); |
5867 } | 5869 } |
5868 | 5870 |
5869 if (!context.canAdvance() && context.requireWidth()) { | 5871 if (!context.canAdvance() && context.allowWidth()) { |
5870 RefPtrWillBeRawPtr<CSSPrimitiveValue> borderWidth = nullptr; | 5872 RefPtrWillBeRawPtr<CSSPrimitiveValue> borderWidth = nullptr; |
5871 if (parser.parseBorderImageWidth(borderWidth)) | 5873 if (parser.parseBorderImageWidth(borderWidth)) |
5872 context.commitBorderWidth(borderWidth.release()); | 5874 context.commitBorderWidth(borderWidth.release()); |
5873 } | 5875 } |
5874 | 5876 |
5875 if (!context.canAdvance() && context.requireOutset()) { | 5877 if (!context.canAdvance() && context.requireOutset()) { |
5876 RefPtrWillBeRawPtr<CSSPrimitiveValue> borderOutset = nullptr; | 5878 RefPtrWillBeRawPtr<CSSPrimitiveValue> borderOutset = nullptr; |
5877 if (parser.parseBorderImageOutset(borderOutset)) | 5879 if (parser.parseBorderImageOutset(borderOutset)) |
5878 context.commitBorderOutset(borderOutset.release()); | 5880 context.commitBorderOutset(borderOutset.release()); |
5879 } | 5881 } |
(...skipping 2428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8308 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueFill)); | 8310 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueFill)); |
8309 if (!seenStroke) | 8311 if (!seenStroke) |
8310 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueStroke)
); | 8312 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueStroke)
); |
8311 if (!seenMarkers) | 8313 if (!seenMarkers) |
8312 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueMarkers
)); | 8314 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueMarkers
)); |
8313 | 8315 |
8314 return parsedValues.release(); | 8316 return parsedValues.release(); |
8315 } | 8317 } |
8316 | 8318 |
8317 } // namespace blink | 8319 } // namespace blink |
OLD | NEW |