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 5647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5658 class BorderImageParseContext { | 5658 class BorderImageParseContext { |
5659 STACK_ALLOCATED(); | 5659 STACK_ALLOCATED(); |
5660 public: | 5660 public: |
5661 BorderImageParseContext() | 5661 BorderImageParseContext() |
5662 : m_canAdvance(false) | 5662 : m_canAdvance(false) |
5663 , m_allowCommit(true) | 5663 , m_allowCommit(true) |
5664 , m_allowImage(true) | 5664 , m_allowImage(true) |
5665 , m_allowImageSlice(true) | 5665 , m_allowImageSlice(true) |
5666 , m_allowRepeat(true) | 5666 , m_allowRepeat(true) |
5667 , m_allowForwardSlashOperator(false) | 5667 , m_allowForwardSlashOperator(false) |
5668 , m_requireWidth(false) | 5668 , m_allowWidth(false) |
5669 , m_requireOutset(false) | 5669 , m_requireOutset(false) |
5670 {} | 5670 {} |
5671 | 5671 |
5672 bool canAdvance() const { return m_canAdvance; } | 5672 bool canAdvance() const { return m_canAdvance; } |
5673 void setCanAdvance(bool canAdvance) { m_canAdvance = canAdvance; } | 5673 void setCanAdvance(bool canAdvance) { m_canAdvance = canAdvance; } |
5674 | 5674 |
5675 bool allowCommit() const { return m_allowCommit; } | 5675 bool allowCommit() const { return m_allowCommit; } |
5676 bool allowImage() const { return m_allowImage; } | 5676 bool allowImage() const { return m_allowImage; } |
5677 bool allowImageSlice() const { return m_allowImageSlice; } | 5677 bool allowImageSlice() const { return m_allowImageSlice; } |
5678 bool allowRepeat() const { return m_allowRepeat; } | 5678 bool allowRepeat() const { return m_allowRepeat; } |
5679 bool allowForwardSlashOperator() const { return m_allowForwardSlashOperator;
} | 5679 bool allowForwardSlashOperator() const { return m_allowForwardSlashOperator;
} |
5680 | 5680 |
5681 bool requireWidth() const { return m_requireWidth; } | 5681 bool allowWidth() const { return m_allowWidth; } |
5682 bool requireOutset() const { return m_requireOutset; } | 5682 bool requireOutset() const { return m_requireOutset; } |
5683 | 5683 |
5684 void commitImage(PassRefPtrWillBeRawPtr<CSSValue> image) | 5684 void commitImage(PassRefPtrWillBeRawPtr<CSSValue> image) |
5685 { | 5685 { |
5686 m_image = image; | 5686 m_image = image; |
5687 m_canAdvance = true; | 5687 m_canAdvance = true; |
5688 m_allowCommit = true; | 5688 m_allowCommit = true; |
5689 m_allowImage = m_allowForwardSlashOperator = m_requireWidth = m_requireO
utset = false; | 5689 m_allowImage = false; |
| 5690 m_allowForwardSlashOperator = false; |
| 5691 m_allowWidth = false; |
| 5692 m_requireOutset = false; |
5690 m_allowImageSlice = !m_imageSlice; | 5693 m_allowImageSlice = !m_imageSlice; |
5691 m_allowRepeat = !m_repeat; | 5694 m_allowRepeat = !m_repeat; |
5692 } | 5695 } |
5693 void commitImageSlice(PassRefPtrWillBeRawPtr<CSSBorderImageSliceValue> slice
) | 5696 void commitImageSlice(PassRefPtrWillBeRawPtr<CSSBorderImageSliceValue> slice
) |
5694 { | 5697 { |
5695 m_imageSlice = slice; | 5698 m_imageSlice = slice; |
5696 m_canAdvance = true; | 5699 m_canAdvance = true; |
5697 m_allowCommit = m_allowForwardSlashOperator = true; | 5700 m_allowCommit = true; |
5698 m_allowImageSlice = m_requireWidth = m_requireOutset = false; | 5701 m_allowForwardSlashOperator = true; |
| 5702 m_allowImageSlice = false; |
| 5703 m_allowWidth = false; |
| 5704 m_requireOutset = false; |
5699 m_allowImage = !m_image; | 5705 m_allowImage = !m_image; |
5700 m_allowRepeat = !m_repeat; | 5706 m_allowRepeat = !m_repeat; |
5701 } | 5707 } |
5702 void commitForwardSlashOperator() | 5708 void commitForwardSlashOperator() |
5703 { | 5709 { |
5704 m_canAdvance = true; | 5710 m_canAdvance = true; |
5705 m_allowCommit = m_allowImage = m_allowImageSlice = m_allowRepeat = m_all
owForwardSlashOperator = false; | 5711 m_allowCommit = false; |
5706 if (!m_borderWidth) { | 5712 m_allowImage = false; |
5707 m_requireWidth = true; | 5713 m_allowImageSlice = false; |
| 5714 m_allowRepeat = false; |
| 5715 if (!m_borderWidth && !m_allowWidth) { |
| 5716 m_allowForwardSlashOperator = true; |
| 5717 m_allowWidth = true; |
5708 m_requireOutset = false; | 5718 m_requireOutset = false; |
5709 } else { | 5719 } else { |
| 5720 m_allowForwardSlashOperator = false; |
5710 m_requireOutset = true; | 5721 m_requireOutset = true; |
5711 m_requireWidth = false; | 5722 m_allowWidth = false; |
5712 } | 5723 } |
5713 } | 5724 } |
5714 void commitBorderWidth(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> width) | 5725 void commitBorderWidth(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> width) |
5715 { | 5726 { |
5716 m_borderWidth = width; | 5727 m_borderWidth = width; |
5717 m_canAdvance = true; | 5728 m_canAdvance = true; |
5718 m_allowCommit = m_allowForwardSlashOperator = true; | 5729 m_allowCommit = true; |
5719 m_allowImageSlice = m_requireWidth = m_requireOutset = false; | 5730 m_allowForwardSlashOperator = true; |
| 5731 m_allowImageSlice = false; |
| 5732 m_allowWidth = false; |
| 5733 m_requireOutset = false; |
5720 m_allowImage = !m_image; | 5734 m_allowImage = !m_image; |
5721 m_allowRepeat = !m_repeat; | 5735 m_allowRepeat = !m_repeat; |
5722 } | 5736 } |
5723 void commitBorderOutset(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> outset) | 5737 void commitBorderOutset(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> outset) |
5724 { | 5738 { |
5725 m_outset = outset; | 5739 m_outset = outset; |
5726 m_canAdvance = true; | 5740 m_canAdvance = true; |
5727 m_allowCommit = true; | 5741 m_allowCommit = true; |
5728 m_allowImageSlice = m_allowForwardSlashOperator = m_requireWidth = m_req
uireOutset = false; | 5742 m_allowImageSlice = false; |
| 5743 m_allowForwardSlashOperator = false; |
| 5744 m_allowWidth = false; |
| 5745 m_requireOutset = false; |
5729 m_allowImage = !m_image; | 5746 m_allowImage = !m_image; |
5730 m_allowRepeat = !m_repeat; | 5747 m_allowRepeat = !m_repeat; |
5731 } | 5748 } |
5732 void commitRepeat(PassRefPtrWillBeRawPtr<CSSValue> repeat) | 5749 void commitRepeat(PassRefPtrWillBeRawPtr<CSSValue> repeat) |
5733 { | 5750 { |
5734 m_repeat = repeat; | 5751 m_repeat = repeat; |
5735 m_canAdvance = true; | 5752 m_canAdvance = true; |
5736 m_allowCommit = true; | 5753 m_allowCommit = true; |
5737 m_allowRepeat = m_allowForwardSlashOperator = m_requireWidth = m_require
Outset = false; | 5754 m_allowRepeat = false; |
| 5755 m_allowForwardSlashOperator = false; |
| 5756 m_allowWidth = false; |
| 5757 m_requireOutset = false; |
5738 m_allowImageSlice = !m_imageSlice; | 5758 m_allowImageSlice = !m_imageSlice; |
5739 m_allowImage = !m_image; | 5759 m_allowImage = !m_image; |
5740 } | 5760 } |
5741 | 5761 |
5742 PassRefPtrWillBeRawPtr<CSSValue> commitCSSValue() | 5762 PassRefPtrWillBeRawPtr<CSSValue> commitCSSValue() |
5743 { | 5763 { |
5744 return createBorderImageValue(m_image, m_imageSlice.get(), m_borderWidth
.get(), m_outset.get(), m_repeat.get()); | 5764 return createBorderImageValue(m_image, m_imageSlice.get(), m_borderWidth
.get(), m_outset.get(), m_repeat.get()); |
5745 } | 5765 } |
5746 | 5766 |
5747 void commitMaskBoxImage(CSSPropertyParser* parser, bool important) | 5767 void commitMaskBoxImage(CSSPropertyParser* parser, bool important) |
(...skipping 25 matching lines...) Expand all Loading... |
5773 static bool buildFromParser(CSSPropertyParser&, CSSPropertyID, BorderImagePa
rseContext&); | 5793 static bool buildFromParser(CSSPropertyParser&, CSSPropertyID, BorderImagePa
rseContext&); |
5774 | 5794 |
5775 bool m_canAdvance; | 5795 bool m_canAdvance; |
5776 | 5796 |
5777 bool m_allowCommit; | 5797 bool m_allowCommit; |
5778 bool m_allowImage; | 5798 bool m_allowImage; |
5779 bool m_allowImageSlice; | 5799 bool m_allowImageSlice; |
5780 bool m_allowRepeat; | 5800 bool m_allowRepeat; |
5781 bool m_allowForwardSlashOperator; | 5801 bool m_allowForwardSlashOperator; |
5782 | 5802 |
5783 bool m_requireWidth; | 5803 bool m_allowWidth; |
5784 bool m_requireOutset; | 5804 bool m_requireOutset; |
5785 | 5805 |
5786 RefPtrWillBeMember<CSSValue> m_image; | 5806 RefPtrWillBeMember<CSSValue> m_image; |
5787 RefPtrWillBeMember<CSSBorderImageSliceValue> m_imageSlice; | 5807 RefPtrWillBeMember<CSSBorderImageSliceValue> m_imageSlice; |
5788 RefPtrWillBeMember<CSSPrimitiveValue> m_borderWidth; | 5808 RefPtrWillBeMember<CSSPrimitiveValue> m_borderWidth; |
5789 RefPtrWillBeMember<CSSPrimitiveValue> m_outset; | 5809 RefPtrWillBeMember<CSSPrimitiveValue> m_outset; |
5790 | 5810 |
5791 RefPtrWillBeMember<CSSValue> m_repeat; | 5811 RefPtrWillBeMember<CSSValue> m_repeat; |
5792 }; | 5812 }; |
5793 | 5813 |
(...skipping 30 matching lines...) Expand all Loading... |
5824 if (parser.parseBorderImageSlice(propId, imageSlice)) | 5844 if (parser.parseBorderImageSlice(propId, imageSlice)) |
5825 context.commitImageSlice(imageSlice.release()); | 5845 context.commitImageSlice(imageSlice.release()); |
5826 } | 5846 } |
5827 | 5847 |
5828 if (!context.canAdvance() && context.allowRepeat()) { | 5848 if (!context.canAdvance() && context.allowRepeat()) { |
5829 RefPtrWillBeRawPtr<CSSValue> repeat = nullptr; | 5849 RefPtrWillBeRawPtr<CSSValue> repeat = nullptr; |
5830 if (parser.parseBorderImageRepeat(repeat)) | 5850 if (parser.parseBorderImageRepeat(repeat)) |
5831 context.commitRepeat(repeat.release()); | 5851 context.commitRepeat(repeat.release()); |
5832 } | 5852 } |
5833 | 5853 |
5834 if (!context.canAdvance() && context.requireWidth()) { | 5854 if (!context.canAdvance() && context.allowWidth()) { |
5835 RefPtrWillBeRawPtr<CSSPrimitiveValue> borderWidth = nullptr; | 5855 RefPtrWillBeRawPtr<CSSPrimitiveValue> borderWidth = nullptr; |
5836 if (parser.parseBorderImageWidth(borderWidth)) | 5856 if (parser.parseBorderImageWidth(borderWidth)) |
5837 context.commitBorderWidth(borderWidth.release()); | 5857 context.commitBorderWidth(borderWidth.release()); |
5838 } | 5858 } |
5839 | 5859 |
5840 if (!context.canAdvance() && context.requireOutset()) { | 5860 if (!context.canAdvance() && context.requireOutset()) { |
5841 RefPtrWillBeRawPtr<CSSPrimitiveValue> borderOutset = nullptr; | 5861 RefPtrWillBeRawPtr<CSSPrimitiveValue> borderOutset = nullptr; |
5842 if (parser.parseBorderImageOutset(borderOutset)) | 5862 if (parser.parseBorderImageOutset(borderOutset)) |
5843 context.commitBorderOutset(borderOutset.release()); | 5863 context.commitBorderOutset(borderOutset.release()); |
5844 } | 5864 } |
(...skipping 2616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8461 return nullptr; | 8481 return nullptr; |
8462 a = args->next(); | 8482 a = args->next(); |
8463 | 8483 |
8464 argNumber++; | 8484 argNumber++; |
8465 } | 8485 } |
8466 | 8486 |
8467 return transformValue.release(); | 8487 return transformValue.release(); |
8468 } | 8488 } |
8469 | 8489 |
8470 } // namespace blink | 8490 } // namespace blink |
OLD | NEW |