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

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 Created 6 years, 3 months 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 5626 matching lines...) Expand 10 before | Expand all | Expand 10 after
5637 class BorderImageParseContext { 5637 class BorderImageParseContext {
5638 STACK_ALLOCATED(); 5638 STACK_ALLOCATED();
5639 public: 5639 public:
5640 BorderImageParseContext() 5640 BorderImageParseContext()
5641 : m_canAdvance(false) 5641 : m_canAdvance(false)
5642 , m_allowCommit(true) 5642 , m_allowCommit(true)
5643 , m_allowImage(true) 5643 , m_allowImage(true)
5644 , m_allowImageSlice(true) 5644 , m_allowImageSlice(true)
5645 , m_allowRepeat(true) 5645 , m_allowRepeat(true)
5646 , m_allowForwardSlashOperator(false) 5646 , m_allowForwardSlashOperator(false)
5647 , m_requireWidth(false) 5647 , m_allowWidth(false)
5648 , m_requireOutset(false) 5648 , m_requireOutset(false)
5649 {} 5649 {}
5650 5650
5651 bool canAdvance() const { return m_canAdvance; } 5651 bool canAdvance() const { return m_canAdvance; }
5652 void setCanAdvance(bool canAdvance) { m_canAdvance = canAdvance; } 5652 void setCanAdvance(bool canAdvance) { m_canAdvance = canAdvance; }
5653 5653
5654 bool allowCommit() const { return m_allowCommit; } 5654 bool allowCommit() const { return m_allowCommit; }
5655 bool allowImage() const { return m_allowImage; } 5655 bool allowImage() const { return m_allowImage; }
5656 bool allowImageSlice() const { return m_allowImageSlice; } 5656 bool allowImageSlice() const { return m_allowImageSlice; }
5657 bool allowRepeat() const { return m_allowRepeat; } 5657 bool allowRepeat() const { return m_allowRepeat; }
5658 bool allowForwardSlashOperator() const { return m_allowForwardSlashOperator; } 5658 bool allowForwardSlashOperator() const { return m_allowForwardSlashOperator; }
5659 5659
5660 bool requireWidth() const { return m_requireWidth; } 5660 bool allowWidth() const { return m_allowWidth; }
5661 bool requireOutset() const { return m_requireOutset; } 5661 bool requireOutset() const { return m_requireOutset; }
5662 5662
5663 void commitImage(PassRefPtrWillBeRawPtr<CSSValue> image) 5663 void commitImage(PassRefPtrWillBeRawPtr<CSSValue> image)
5664 { 5664 {
5665 m_image = image; 5665 m_image = image;
5666 m_canAdvance = true; 5666 m_canAdvance = true;
5667 m_allowCommit = true; 5667 m_allowCommit = true;
5668 m_allowImage = m_allowForwardSlashOperator = m_requireWidth = m_requireO utset = false; 5668 m_allowImage = m_allowForwardSlashOperator = m_allowWidth = m_requireOut set = false;
5669 m_allowImageSlice = !m_imageSlice; 5669 m_allowImageSlice = !m_imageSlice;
5670 m_allowRepeat = !m_repeat; 5670 m_allowRepeat = !m_repeat;
5671 } 5671 }
5672 void commitImageSlice(PassRefPtrWillBeRawPtr<CSSBorderImageSliceValue> slice ) 5672 void commitImageSlice(PassRefPtrWillBeRawPtr<CSSBorderImageSliceValue> slice )
5673 { 5673 {
5674 m_imageSlice = slice; 5674 m_imageSlice = slice;
5675 m_canAdvance = true; 5675 m_canAdvance = true;
5676 m_allowCommit = m_allowForwardSlashOperator = true; 5676 m_allowCommit = m_allowForwardSlashOperator = true;
5677 m_allowImageSlice = m_requireWidth = m_requireOutset = false; 5677 m_allowImageSlice = m_allowWidth = m_requireOutset = false;
5678 m_allowImage = !m_image; 5678 m_allowImage = !m_image;
5679 m_allowRepeat = !m_repeat; 5679 m_allowRepeat = !m_repeat;
5680 } 5680 }
5681 void commitForwardSlashOperator() 5681 void commitForwardSlashOperator()
5682 { 5682 {
5683 m_canAdvance = true; 5683 m_canAdvance = true;
5684 m_allowCommit = m_allowImage = m_allowImageSlice = m_allowRepeat = m_all owForwardSlashOperator = false; 5684 m_allowCommit = m_allowImage = m_allowImageSlice = m_allowRepeat = false ;
5685 if (!m_borderWidth) { 5685 if (!m_borderWidth && !m_allowWidth) {
5686 m_requireWidth = true; 5686 m_allowForwardSlashOperator = true;
5687 m_allowWidth = true;
5687 m_requireOutset = false; 5688 m_requireOutset = false;
5688 } else { 5689 } else {
5690 m_allowForwardSlashOperator = false;
5689 m_requireOutset = true; 5691 m_requireOutset = true;
5690 m_requireWidth = false; 5692 m_allowWidth = false;
5691 } 5693 }
5692 } 5694 }
5693 void commitBorderWidth(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> width) 5695 void commitBorderWidth(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> width)
5694 { 5696 {
5695 m_borderWidth = width; 5697 m_borderWidth = width;
5696 m_canAdvance = true; 5698 m_canAdvance = true;
5697 m_allowCommit = m_allowForwardSlashOperator = true; 5699 m_allowCommit = m_allowForwardSlashOperator = true;
5698 m_allowImageSlice = m_requireWidth = m_requireOutset = false; 5700 m_allowImageSlice = m_allowWidth = m_requireOutset = false;
5699 m_allowImage = !m_image; 5701 m_allowImage = !m_image;
5700 m_allowRepeat = !m_repeat; 5702 m_allowRepeat = !m_repeat;
5701 } 5703 }
5702 void commitBorderOutset(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> outset) 5704 void commitBorderOutset(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> outset)
5703 { 5705 {
5704 m_outset = outset; 5706 m_outset = outset;
5705 m_canAdvance = true; 5707 m_canAdvance = true;
5706 m_allowCommit = true; 5708 m_allowCommit = true;
5707 m_allowImageSlice = m_allowForwardSlashOperator = m_requireWidth = m_req uireOutset = false; 5709 m_allowImageSlice = m_allowForwardSlashOperator = m_allowWidth = m_requi reOutset = false;
5708 m_allowImage = !m_image; 5710 m_allowImage = !m_image;
5709 m_allowRepeat = !m_repeat; 5711 m_allowRepeat = !m_repeat;
5710 } 5712 }
5711 void commitRepeat(PassRefPtrWillBeRawPtr<CSSValue> repeat) 5713 void commitRepeat(PassRefPtrWillBeRawPtr<CSSValue> repeat)
5712 { 5714 {
5713 m_repeat = repeat; 5715 m_repeat = repeat;
5714 m_canAdvance = true; 5716 m_canAdvance = true;
5715 m_allowCommit = true; 5717 m_allowCommit = true;
5716 m_allowRepeat = m_allowForwardSlashOperator = m_requireWidth = m_require Outset = false; 5718 m_allowRepeat = m_allowForwardSlashOperator = m_allowWidth = m_requireOu tset = false;
esprehn 2014/11/20 22:54:06 One assignment per line.
je_julie(Not used) 2014/11/21 08:36:38 Done.
5717 m_allowImageSlice = !m_imageSlice; 5719 m_allowImageSlice = !m_imageSlice;
5718 m_allowImage = !m_image; 5720 m_allowImage = !m_image;
5719 } 5721 }
5720 5722
5721 PassRefPtrWillBeRawPtr<CSSValue> commitCSSValue() 5723 PassRefPtrWillBeRawPtr<CSSValue> commitCSSValue()
5722 { 5724 {
5723 return createBorderImageValue(m_image, m_imageSlice.get(), m_borderWidth .get(), m_outset.get(), m_repeat.get()); 5725 return createBorderImageValue(m_image, m_imageSlice.get(), m_borderWidth .get(), m_outset.get(), m_repeat.get());
5724 } 5726 }
5725 5727
5726 void commitMaskBoxImage(CSSPropertyParser* parser, bool important) 5728 void commitMaskBoxImage(CSSPropertyParser* parser, bool important)
(...skipping 25 matching lines...) Expand all
5752 static bool buildFromParser(CSSPropertyParser&, CSSPropertyID, BorderImagePa rseContext&); 5754 static bool buildFromParser(CSSPropertyParser&, CSSPropertyID, BorderImagePa rseContext&);
5753 5755
5754 bool m_canAdvance; 5756 bool m_canAdvance;
5755 5757
5756 bool m_allowCommit; 5758 bool m_allowCommit;
5757 bool m_allowImage; 5759 bool m_allowImage;
5758 bool m_allowImageSlice; 5760 bool m_allowImageSlice;
5759 bool m_allowRepeat; 5761 bool m_allowRepeat;
5760 bool m_allowForwardSlashOperator; 5762 bool m_allowForwardSlashOperator;
5761 5763
5762 bool m_requireWidth; 5764 bool m_allowWidth;
5763 bool m_requireOutset; 5765 bool m_requireOutset;
5764 5766
5765 RefPtrWillBeMember<CSSValue> m_image; 5767 RefPtrWillBeMember<CSSValue> m_image;
5766 RefPtrWillBeMember<CSSBorderImageSliceValue> m_imageSlice; 5768 RefPtrWillBeMember<CSSBorderImageSliceValue> m_imageSlice;
5767 RefPtrWillBeMember<CSSPrimitiveValue> m_borderWidth; 5769 RefPtrWillBeMember<CSSPrimitiveValue> m_borderWidth;
5768 RefPtrWillBeMember<CSSPrimitiveValue> m_outset; 5770 RefPtrWillBeMember<CSSPrimitiveValue> m_outset;
5769 5771
5770 RefPtrWillBeMember<CSSValue> m_repeat; 5772 RefPtrWillBeMember<CSSValue> m_repeat;
5771 }; 5773 };
5772 5774
(...skipping 30 matching lines...) Expand all
5803 if (parser.parseBorderImageSlice(propId, imageSlice)) 5805 if (parser.parseBorderImageSlice(propId, imageSlice))
5804 context.commitImageSlice(imageSlice.release()); 5806 context.commitImageSlice(imageSlice.release());
5805 } 5807 }
5806 5808
5807 if (!context.canAdvance() && context.allowRepeat()) { 5809 if (!context.canAdvance() && context.allowRepeat()) {
5808 RefPtrWillBeRawPtr<CSSValue> repeat = nullptr; 5810 RefPtrWillBeRawPtr<CSSValue> repeat = nullptr;
5809 if (parser.parseBorderImageRepeat(repeat)) 5811 if (parser.parseBorderImageRepeat(repeat))
5810 context.commitRepeat(repeat.release()); 5812 context.commitRepeat(repeat.release());
5811 } 5813 }
5812 5814
5813 if (!context.canAdvance() && context.requireWidth()) { 5815 if (!context.canAdvance() && context.allowWidth()) {
5814 RefPtrWillBeRawPtr<CSSPrimitiveValue> borderWidth = nullptr; 5816 RefPtrWillBeRawPtr<CSSPrimitiveValue> borderWidth = nullptr;
5815 if (parser.parseBorderImageWidth(borderWidth)) 5817 if (parser.parseBorderImageWidth(borderWidth))
5816 context.commitBorderWidth(borderWidth.release()); 5818 context.commitBorderWidth(borderWidth.release());
5817 } 5819 }
5818 5820
5819 if (!context.canAdvance() && context.requireOutset()) { 5821 if (!context.canAdvance() && context.requireOutset()) {
5820 RefPtrWillBeRawPtr<CSSPrimitiveValue> borderOutset = nullptr; 5822 RefPtrWillBeRawPtr<CSSPrimitiveValue> borderOutset = nullptr;
5821 if (parser.parseBorderImageOutset(borderOutset)) 5823 if (parser.parseBorderImageOutset(borderOutset))
5822 context.commitBorderOutset(borderOutset.release()); 5824 context.commitBorderOutset(borderOutset.release());
5823 } 5825 }
(...skipping 2401 matching lines...) Expand 10 before | Expand all | Expand 10 after
8225 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueFill)); 8227 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueFill));
8226 if (!seenStroke) 8228 if (!seenStroke)
8227 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueStroke) ); 8229 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueStroke) );
8228 if (!seenMarkers) 8230 if (!seenMarkers)
8229 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueMarkers )); 8231 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueMarkers ));
8230 8232
8231 return parsedValues.release(); 8233 return parsedValues.release();
8232 } 8234 }
8233 8235
8234 } // namespace blink 8236 } // 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