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

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: Remove white spaces Created 6 years, 4 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
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 5797 matching lines...) Expand 10 before | Expand all | Expand 10 after
5808 class BorderImageParseContext { 5808 class BorderImageParseContext {
5809 STACK_ALLOCATED(); 5809 STACK_ALLOCATED();
5810 public: 5810 public:
5811 BorderImageParseContext() 5811 BorderImageParseContext()
5812 : m_canAdvance(false) 5812 : m_canAdvance(false)
5813 , m_allowCommit(true) 5813 , m_allowCommit(true)
5814 , m_allowImage(true) 5814 , m_allowImage(true)
5815 , m_allowImageSlice(true) 5815 , m_allowImageSlice(true)
5816 , m_allowRepeat(true) 5816 , m_allowRepeat(true)
5817 , m_allowForwardSlashOperator(false) 5817 , m_allowForwardSlashOperator(false)
5818 , m_requireWidth(false) 5818 , m_allowWidth(false)
rwlbuis 2014/08/21 15:54:25 Renaming this variable makes the review much harde
je_julie(Not used) 2014/08/22 00:31:39 From the spec,http://www.w3.org/TR/css3-background
5819 , m_requireOutset(false) 5819 , m_requireOutset(false)
5820 {} 5820 {}
5821 5821
5822 bool canAdvance() const { return m_canAdvance; } 5822 bool canAdvance() const { return m_canAdvance; }
5823 void setCanAdvance(bool canAdvance) { m_canAdvance = canAdvance; } 5823 void setCanAdvance(bool canAdvance) { m_canAdvance = canAdvance; }
5824 5824
5825 bool allowCommit() const { return m_allowCommit; } 5825 bool allowCommit() const { return m_allowCommit; }
5826 bool allowImage() const { return m_allowImage; } 5826 bool allowImage() const { return m_allowImage; }
5827 bool allowImageSlice() const { return m_allowImageSlice; } 5827 bool allowImageSlice() const { return m_allowImageSlice; }
5828 bool allowRepeat() const { return m_allowRepeat; } 5828 bool allowRepeat() const { return m_allowRepeat; }
5829 bool allowForwardSlashOperator() const { return m_allowForwardSlashOperator; } 5829 bool allowForwardSlashOperator() const { return m_allowForwardSlashOperator; }
5830 bool allowWidth() const { return m_allowWidth; }
5830 5831
5831 bool requireWidth() const { return m_requireWidth; }
5832 bool requireOutset() const { return m_requireOutset; } 5832 bool requireOutset() const { return m_requireOutset; }
5833 5833
5834 void commitImage(PassRefPtrWillBeRawPtr<CSSValue> image) 5834 void commitImage(PassRefPtrWillBeRawPtr<CSSValue> image)
5835 { 5835 {
5836 m_image = image; 5836 m_image = image;
5837 m_canAdvance = true; 5837 m_canAdvance = true;
5838 m_allowCommit = true; 5838 m_allowCommit = true;
5839 m_allowImage = m_allowForwardSlashOperator = m_requireWidth = m_requireO utset = false; 5839 m_allowImage = m_allowForwardSlashOperator = m_allowWidth = m_requireOut set = false;
5840 m_allowImageSlice = !m_imageSlice; 5840 m_allowImageSlice = !m_imageSlice;
5841 m_allowRepeat = !m_repeat; 5841 m_allowRepeat = !m_repeat;
5842 } 5842 }
5843 void commitImageSlice(PassRefPtrWillBeRawPtr<CSSBorderImageSliceValue> slice ) 5843 void commitImageSlice(PassRefPtrWillBeRawPtr<CSSBorderImageSliceValue> slice )
5844 { 5844 {
5845 m_imageSlice = slice; 5845 m_imageSlice = slice;
5846 m_canAdvance = true; 5846 m_canAdvance = true;
5847 m_allowCommit = m_allowForwardSlashOperator = true; 5847 m_allowCommit = m_allowForwardSlashOperator = true;
5848 m_allowImageSlice = m_requireWidth = m_requireOutset = false; 5848 m_allowImageSlice = m_allowWidth = m_requireOutset = false;
5849 m_allowImage = !m_image; 5849 m_allowImage = !m_image;
5850 m_allowRepeat = !m_repeat; 5850 m_allowRepeat = !m_repeat;
5851 } 5851 }
5852 void commitForwardSlashOperator() 5852 void commitForwardSlashOperator()
5853 { 5853 {
5854 m_canAdvance = true; 5854 m_canAdvance = true;
5855 m_allowCommit = m_allowImage = m_allowImageSlice = m_allowRepeat = m_all owForwardSlashOperator = false; 5855 m_allowCommit = m_allowImage = m_allowImageSlice = m_allowRepeat = false ;
5856 if (!m_borderWidth) { 5856 if (!m_borderWidth && !m_allowWidth) {
5857 m_requireWidth = true; 5857 m_allowForwardSlashOperator = true;
5858 m_allowWidth = true;
5858 m_requireOutset = false; 5859 m_requireOutset = false;
5859 } else { 5860 } else {
5861 m_allowForwardSlashOperator = false;
5860 m_requireOutset = true; 5862 m_requireOutset = true;
5861 m_requireWidth = false; 5863 m_allowWidth = false;
5862 } 5864 }
5863 } 5865 }
5864 void commitBorderWidth(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> width) 5866 void commitBorderWidth(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> width)
5865 { 5867 {
5866 m_borderWidth = width; 5868 m_borderWidth = width;
5867 m_canAdvance = true; 5869 m_canAdvance = true;
5868 m_allowCommit = m_allowForwardSlashOperator = true; 5870 m_allowCommit = m_allowForwardSlashOperator = true;
5869 m_allowImageSlice = m_requireWidth = m_requireOutset = false; 5871 m_allowImageSlice = m_allowWidth = m_requireOutset = false;
5870 m_allowImage = !m_image; 5872 m_allowImage = !m_image;
5871 m_allowRepeat = !m_repeat; 5873 m_allowRepeat = !m_repeat;
5872 } 5874 }
5873 void commitBorderOutset(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> outset) 5875 void commitBorderOutset(PassRefPtrWillBeRawPtr<CSSPrimitiveValue> outset)
5874 { 5876 {
5875 m_outset = outset; 5877 m_outset = outset;
5876 m_canAdvance = true; 5878 m_canAdvance = true;
5877 m_allowCommit = true; 5879 m_allowCommit = true;
5878 m_allowImageSlice = m_allowForwardSlashOperator = m_requireWidth = m_req uireOutset = false; 5880 m_allowImageSlice = m_allowForwardSlashOperator = m_allowWidth = m_requi reOutset = false;
5879 m_allowImage = !m_image; 5881 m_allowImage = !m_image;
5880 m_allowRepeat = !m_repeat; 5882 m_allowRepeat = !m_repeat;
5881 } 5883 }
5882 void commitRepeat(PassRefPtrWillBeRawPtr<CSSValue> repeat) 5884 void commitRepeat(PassRefPtrWillBeRawPtr<CSSValue> repeat)
5883 { 5885 {
5884 m_repeat = repeat; 5886 m_repeat = repeat;
5885 m_canAdvance = true; 5887 m_canAdvance = true;
5886 m_allowCommit = true; 5888 m_allowCommit = true;
5887 m_allowRepeat = m_allowForwardSlashOperator = m_requireWidth = m_require Outset = false; 5889 m_allowRepeat = m_allowForwardSlashOperator = m_allowWidth = m_requireOu tset = false;
5888 m_allowImageSlice = !m_imageSlice; 5890 m_allowImageSlice = !m_imageSlice;
5889 m_allowImage = !m_image; 5891 m_allowImage = !m_image;
5890 } 5892 }
5891 5893
5892 PassRefPtrWillBeRawPtr<CSSValue> commitCSSValue() 5894 PassRefPtrWillBeRawPtr<CSSValue> commitCSSValue()
5893 { 5895 {
5894 return createBorderImageValue(m_image, m_imageSlice.get(), m_borderWidth .get(), m_outset.get(), m_repeat.get()); 5896 return createBorderImageValue(m_image, m_imageSlice.get(), m_borderWidth .get(), m_outset.get(), m_repeat.get());
5895 } 5897 }
5896 5898
5897 void commitMaskBoxImage(CSSPropertyParser* parser, bool important) 5899 void commitMaskBoxImage(CSSPropertyParser* parser, bool important)
(...skipping 25 matching lines...) Expand all
5923 static bool buildFromParser(CSSPropertyParser&, CSSPropertyID, BorderImagePa rseContext&); 5925 static bool buildFromParser(CSSPropertyParser&, CSSPropertyID, BorderImagePa rseContext&);
5924 5926
5925 bool m_canAdvance; 5927 bool m_canAdvance;
5926 5928
5927 bool m_allowCommit; 5929 bool m_allowCommit;
5928 bool m_allowImage; 5930 bool m_allowImage;
5929 bool m_allowImageSlice; 5931 bool m_allowImageSlice;
5930 bool m_allowRepeat; 5932 bool m_allowRepeat;
5931 bool m_allowForwardSlashOperator; 5933 bool m_allowForwardSlashOperator;
5932 5934
5933 bool m_requireWidth; 5935 bool m_allowWidth;
5934 bool m_requireOutset; 5936 bool m_requireOutset;
5935 5937
5936 RefPtrWillBeMember<CSSValue> m_image; 5938 RefPtrWillBeMember<CSSValue> m_image;
5937 RefPtrWillBeMember<CSSBorderImageSliceValue> m_imageSlice; 5939 RefPtrWillBeMember<CSSBorderImageSliceValue> m_imageSlice;
5938 RefPtrWillBeMember<CSSPrimitiveValue> m_borderWidth; 5940 RefPtrWillBeMember<CSSPrimitiveValue> m_borderWidth;
5939 RefPtrWillBeMember<CSSPrimitiveValue> m_outset; 5941 RefPtrWillBeMember<CSSPrimitiveValue> m_outset;
5940 5942
5941 RefPtrWillBeMember<CSSValue> m_repeat; 5943 RefPtrWillBeMember<CSSValue> m_repeat;
5942 }; 5944 };
5943 5945
(...skipping 30 matching lines...) Expand all
5974 if (parser.parseBorderImageSlice(propId, imageSlice)) 5976 if (parser.parseBorderImageSlice(propId, imageSlice))
5975 context.commitImageSlice(imageSlice.release()); 5977 context.commitImageSlice(imageSlice.release());
5976 } 5978 }
5977 5979
5978 if (!context.canAdvance() && context.allowRepeat()) { 5980 if (!context.canAdvance() && context.allowRepeat()) {
5979 RefPtrWillBeRawPtr<CSSValue> repeat = nullptr; 5981 RefPtrWillBeRawPtr<CSSValue> repeat = nullptr;
5980 if (parser.parseBorderImageRepeat(repeat)) 5982 if (parser.parseBorderImageRepeat(repeat))
5981 context.commitRepeat(repeat.release()); 5983 context.commitRepeat(repeat.release());
5982 } 5984 }
5983 5985
5984 if (!context.canAdvance() && context.requireWidth()) { 5986 if (!context.canAdvance() && context.allowWidth()) {
5985 RefPtrWillBeRawPtr<CSSPrimitiveValue> borderWidth = nullptr; 5987 RefPtrWillBeRawPtr<CSSPrimitiveValue> borderWidth = nullptr;
5986 if (parser.parseBorderImageWidth(borderWidth)) 5988 if (parser.parseBorderImageWidth(borderWidth))
5987 context.commitBorderWidth(borderWidth.release()); 5989 context.commitBorderWidth(borderWidth.release());
5988 } 5990 }
5989 5991
5990 if (!context.canAdvance() && context.requireOutset()) { 5992 if (!context.canAdvance() && context.requireOutset()) {
5991 RefPtrWillBeRawPtr<CSSPrimitiveValue> borderOutset = nullptr; 5993 RefPtrWillBeRawPtr<CSSPrimitiveValue> borderOutset = nullptr;
5992 if (parser.parseBorderImageOutset(borderOutset)) 5994 if (parser.parseBorderImageOutset(borderOutset))
5993 context.commitBorderOutset(borderOutset.release()); 5995 context.commitBorderOutset(borderOutset.release());
5994 } 5996 }
(...skipping 2433 matching lines...) Expand 10 before | Expand all | Expand 10 after
8428 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueFill)); 8430 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueFill));
8429 if (!seenStroke) 8431 if (!seenStroke)
8430 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueStroke) ); 8432 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueStroke) );
8431 if (!seenMarkers) 8433 if (!seenMarkers)
8432 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueMarkers )); 8434 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueMarkers ));
8433 8435
8434 return parsedValues.release(); 8436 return parsedValues.release();
8435 } 8437 }
8436 8438
8437 } // namespace blink 8439 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698