Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(59)

Side by Side Diff: Source/core/css/parser/CSSPropertyParser.cpp

Issue 471893002: Support consecutive slash operators for border-image value (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Update TC with shouldBeEqualToString Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/core/css/parser/CSSGrammar.y ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 = false;
5725 m_allowForwardSlashOperator = false;
5726 m_allowWidth = false;
5727 m_requireOutset = false;
5725 m_allowImageSlice = !m_imageSlice; 5728 m_allowImageSlice = !m_imageSlice;
5726 m_allowRepeat = !m_repeat; 5729 m_allowRepeat = !m_repeat;
5727 } 5730 }
5728 void commitImageSlice(PassRefPtrWillBeRawPtr<CSSBorderImageSliceValue> slice ) 5731 void commitImageSlice(PassRefPtrWillBeRawPtr<CSSBorderImageSliceValue> slice )
5729 { 5732 {
5730 m_imageSlice = slice; 5733 m_imageSlice = slice;
5731 m_canAdvance = true; 5734 m_canAdvance = true;
5732 m_allowCommit = m_allowForwardSlashOperator = true; 5735 m_allowCommit = true;
5733 m_allowImageSlice = m_requireWidth = m_requireOutset = false; 5736 m_allowForwardSlashOperator = true;
5737 m_allowImageSlice = false;
5738 m_allowWidth = false;
5739 m_requireOutset = false;
5734 m_allowImage = !m_image; 5740 m_allowImage = !m_image;
5735 m_allowRepeat = !m_repeat; 5741 m_allowRepeat = !m_repeat;
5736 } 5742 }
5737 void commitForwardSlashOperator() 5743 void commitForwardSlashOperator()
5738 { 5744 {
5739 m_canAdvance = true; 5745 m_canAdvance = true;
5740 m_allowCommit = m_allowImage = m_allowImageSlice = m_allowRepeat = m_all owForwardSlashOperator = false; 5746 m_allowCommit = false;
5741 if (!m_borderWidth) { 5747 m_allowImage = false;
5742 m_requireWidth = true; 5748 m_allowImageSlice = false;
5749 m_allowRepeat = false;
5750 if (!m_borderWidth && !m_allowWidth) {
5751 m_allowForwardSlashOperator = true;
5752 m_allowWidth = true;
5743 m_requireOutset = false; 5753 m_requireOutset = false;
5744 } else { 5754 } else {
5755 m_allowForwardSlashOperator = false;
5745 m_requireOutset = true; 5756 m_requireOutset = true;
5746 m_requireWidth = false; 5757 m_allowWidth = false;
5747 } 5758 }
5748 } 5759 }
5749 void commitBorderWidth(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> width) 5760 void commitBorderWidth(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> width)
5750 { 5761 {
5751 m_borderWidth = width; 5762 m_borderWidth = width;
5752 m_canAdvance = true; 5763 m_canAdvance = true;
5753 m_allowCommit = m_allowForwardSlashOperator = true; 5764 m_allowCommit = true;
5754 m_allowImageSlice = m_requireWidth = m_requireOutset = false; 5765 m_allowForwardSlashOperator = true;
5766 m_allowImageSlice = false;
5767 m_allowWidth = false;
5768 m_requireOutset = false;
5755 m_allowImage = !m_image; 5769 m_allowImage = !m_image;
5756 m_allowRepeat = !m_repeat; 5770 m_allowRepeat = !m_repeat;
5757 } 5771 }
5758 void commitBorderOutset(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> outset) 5772 void commitBorderOutset(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> outset)
5759 { 5773 {
5760 m_outset = outset; 5774 m_outset = outset;
5761 m_canAdvance = true; 5775 m_canAdvance = true;
5762 m_allowCommit = true; 5776 m_allowCommit = true;
5763 m_allowImageSlice = m_allowForwardSlashOperator = m_requireWidth = m_req uireOutset = false; 5777 m_allowImageSlice = false;
5778 m_allowForwardSlashOperator = false;
5779 m_allowWidth = false;
5780 m_requireOutset = false;
5764 m_allowImage = !m_image; 5781 m_allowImage = !m_image;
5765 m_allowRepeat = !m_repeat; 5782 m_allowRepeat = !m_repeat;
5766 } 5783 }
5767 void commitRepeat(PassRefPtrWillBeRawPtr<CSSValue> repeat) 5784 void commitRepeat(PassRefPtrWillBeRawPtr<CSSValue> repeat)
5768 { 5785 {
5769 m_repeat = repeat; 5786 m_repeat = repeat;
5770 m_canAdvance = true; 5787 m_canAdvance = true;
5771 m_allowCommit = true; 5788 m_allowCommit = true;
5772 m_allowRepeat = m_allowForwardSlashOperator = m_requireWidth = m_require Outset = false; 5789 m_allowRepeat = false;
5790 m_allowForwardSlashOperator = false;
5791 m_allowWidth = false;
5792 m_requireOutset = false;
5773 m_allowImageSlice = !m_imageSlice; 5793 m_allowImageSlice = !m_imageSlice;
5774 m_allowImage = !m_image; 5794 m_allowImage = !m_image;
5775 } 5795 }
5776 5796
5777 PassRefPtrWillBeRawPtr<CSSValue> commitCSSValue() 5797 PassRefPtrWillBeRawPtr<CSSValue> commitCSSValue()
5778 { 5798 {
5779 return createBorderImageValue(m_image, m_imageSlice.get(), m_borderWidth .get(), m_outset.get(), m_repeat.get()); 5799 return createBorderImageValue(m_image, m_imageSlice.get(), m_borderWidth .get(), m_outset.get(), m_repeat.get());
5780 } 5800 }
5781 5801
5782 void commitMaskBoxImage(CSSPropertyParser* parser, bool important) 5802 void commitMaskBoxImage(CSSPropertyParser* parser, bool important)
(...skipping 25 matching lines...) Expand all
5808 static bool buildFromParser(CSSPropertyParser&, CSSPropertyID, BorderImagePa rseContext&); 5828 static bool buildFromParser(CSSPropertyParser&, CSSPropertyID, BorderImagePa rseContext&);
5809 5829
5810 bool m_canAdvance; 5830 bool m_canAdvance;
5811 5831
5812 bool m_allowCommit; 5832 bool m_allowCommit;
5813 bool m_allowImage; 5833 bool m_allowImage;
5814 bool m_allowImageSlice; 5834 bool m_allowImageSlice;
5815 bool m_allowRepeat; 5835 bool m_allowRepeat;
5816 bool m_allowForwardSlashOperator; 5836 bool m_allowForwardSlashOperator;
5817 5837
5818 bool m_requireWidth; 5838 bool m_allowWidth;
5819 bool m_requireOutset; 5839 bool m_requireOutset;
5820 5840
5821 RefPtrWillBeMember<CSSValue> m_image; 5841 RefPtrWillBeMember<CSSValue> m_image;
5822 RefPtrWillBeMember<CSSBorderImageSliceValue> m_imageSlice; 5842 RefPtrWillBeMember<CSSBorderImageSliceValue> m_imageSlice;
5823 RefPtrWillBeMember<CSSPrimitiveValue> m_borderWidth; 5843 RefPtrWillBeMember<CSSPrimitiveValue> m_borderWidth;
5824 RefPtrWillBeMember<CSSPrimitiveValue> m_outset; 5844 RefPtrWillBeMember<CSSPrimitiveValue> m_outset;
5825 5845
5826 RefPtrWillBeMember<CSSValue> m_repeat; 5846 RefPtrWillBeMember<CSSValue> m_repeat;
5827 }; 5847 };
5828 5848
(...skipping 30 matching lines...) Expand all
5859 if (parser.parseBorderImageSlice(propId, imageSlice)) 5879 if (parser.parseBorderImageSlice(propId, imageSlice))
5860 context.commitImageSlice(imageSlice.release()); 5880 context.commitImageSlice(imageSlice.release());
5861 } 5881 }
5862 5882
5863 if (!context.canAdvance() && context.allowRepeat()) { 5883 if (!context.canAdvance() && context.allowRepeat()) {
5864 RefPtrWillBeRawPtr<CSSValue> repeat = nullptr; 5884 RefPtrWillBeRawPtr<CSSValue> repeat = nullptr;
5865 if (parser.parseBorderImageRepeat(repeat)) 5885 if (parser.parseBorderImageRepeat(repeat))
5866 context.commitRepeat(repeat.release()); 5886 context.commitRepeat(repeat.release());
5867 } 5887 }
5868 5888
5869 if (!context.canAdvance() && context.requireWidth()) { 5889 if (!context.canAdvance() && context.allowWidth()) {
5870 RefPtrWillBeRawPtr<CSSPrimitiveValue> borderWidth = nullptr; 5890 RefPtrWillBeRawPtr<CSSPrimitiveValue> borderWidth = nullptr;
5871 if (parser.parseBorderImageWidth(borderWidth)) 5891 if (parser.parseBorderImageWidth(borderWidth))
5872 context.commitBorderWidth(borderWidth.release()); 5892 context.commitBorderWidth(borderWidth.release());
5873 } 5893 }
5874 5894
5875 if (!context.canAdvance() && context.requireOutset()) { 5895 if (!context.canAdvance() && context.requireOutset()) {
5876 RefPtrWillBeRawPtr<CSSPrimitiveValue> borderOutset = nullptr; 5896 RefPtrWillBeRawPtr<CSSPrimitiveValue> borderOutset = nullptr;
5877 if (parser.parseBorderImageOutset(borderOutset)) 5897 if (parser.parseBorderImageOutset(borderOutset))
5878 context.commitBorderOutset(borderOutset.release()); 5898 context.commitBorderOutset(borderOutset.release());
5879 } 5899 }
(...skipping 2670 matching lines...) Expand 10 before | Expand all | Expand 10 after
8550 } 8570 }
8551 } 8571 }
8552 8572
8553 if (!list->length()) 8573 if (!list->length())
8554 return nullptr; 8574 return nullptr;
8555 8575
8556 return list.release(); 8576 return list.release();
8557 } 8577 }
8558 8578
8559 } // namespace blink 8579 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/css/parser/CSSGrammar.y ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698