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

Side by Side Diff: Source/core/css/CSSParser-in.cpp

Issue 24077007: Add support for the object-position CSS property. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase master again Created 7 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/CSSParser.h ('k') | Source/core/css/CSSProperties.in » ('j') | 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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 { 138 {
139 for (unsigned i = 0; i < length; ++i) { 139 for (unsigned i = 0; i < length; ++i) {
140 if (!prefix[i]) 140 if (!prefix[i])
141 return true; 141 return true;
142 if (string[i] != prefix[i]) 142 if (string[i] != prefix[i])
143 return false; 143 return false;
144 } 144 }
145 return false; 145 return false;
146 } 146 }
147 147
148 static PassRefPtr<CSSPrimitiveValue> createPrimitiveValuePair(PassRefPtr<CSSPrim itiveValue> first, PassRefPtr<CSSPrimitiveValue> second) 148 static PassRefPtr<CSSPrimitiveValue> createPrimitiveValuePair(PassRefPtr<CSSPrim itiveValue> first, PassRefPtr<CSSPrimitiveValue> second, Pair::IdenticalValuesPo licy identicalValuesPolicy = Pair::DropIdenticalValues)
149 { 149 {
150 return cssValuePool().createValue(Pair::create(first, second)); 150 return cssValuePool().createValue(Pair::create(first, second, identicalValue sPolicy));
151 } 151 }
152 152
153 class AnimationParseContext { 153 class AnimationParseContext {
154 public: 154 public:
155 AnimationParseContext() 155 AnimationParseContext()
156 : m_animationPropertyKeywordAllowed(true) 156 : m_animationPropertyKeywordAllowed(true)
157 , m_firstAnimationCommitted(false) 157 , m_firstAnimationCommitted(false)
158 , m_hasSeenAnimationPropertyKeyword(false) 158 , m_hasSeenAnimationPropertyKeyword(false)
159 { 159 {
160 } 160 }
(...skipping 1837 matching lines...) Expand 10 before | Expand all | Expand 10 after
1998 shorthandScope = adoptPtr(new ShorthandScope(this, propId)); 1998 shorthandScope = adoptPtr(new ShorthandScope(this, propId));
1999 } 1999 }
2000 addProperty(propId1, val1.release(), important); 2000 addProperty(propId1, val1.release(), important);
2001 if (val2) 2001 if (val2)
2002 addProperty(propId2, val2.release(), important); 2002 addProperty(propId2, val2.release(), important);
2003 result = true; 2003 result = true;
2004 } 2004 }
2005 m_implicitShorthand = false; 2005 m_implicitShorthand = false;
2006 return result; 2006 return result;
2007 } 2007 }
2008 case CSSPropertyObjectPosition:
2009 return RuntimeEnabledFeatures::objectFitPositionEnabled() && parseObject Position(important);
2008 case CSSPropertyListStyleImage: // <uri> | none | inherit 2010 case CSSPropertyListStyleImage: // <uri> | none | inherit
2009 case CSSPropertyBorderImageSource: 2011 case CSSPropertyBorderImageSource:
2010 case CSSPropertyWebkitMaskBoxImageSource: 2012 case CSSPropertyWebkitMaskBoxImageSource:
2011 if (id == CSSValueNone) { 2013 if (id == CSSValueNone) {
2012 parsedValue = cssValuePool().createIdentifierValue(CSSValueNone); 2014 parsedValue = cssValuePool().createIdentifierValue(CSSValueNone);
2013 m_valueList->next(); 2015 m_valueList->next();
2014 } else if (value->unit == CSSPrimitiveValue::CSS_URI) { 2016 } else if (value->unit == CSSPrimitiveValue::CSS_URI) {
2015 parsedValue = CSSImageValue::create(completeURL(value->string)); 2017 parsedValue = CSSImageValue::create(completeURL(value->string));
2016 m_valueList->next(); 2018 m_valueList->next();
2017 } else if (isGeneratedImageValue(value)) { 2019 } else if (isGeneratedImageValue(value)) {
(...skipping 4606 matching lines...) Expand 10 before | Expand all | Expand 10 after
6624 flexShrink = 1; 6626 flexShrink = 1;
6625 if (!flexBasis) 6627 if (!flexBasis)
6626 flexBasis = cssValuePool().createValue(0, CSSPrimitiveValue::CSS_PX); 6628 flexBasis = cssValuePool().createValue(0, CSSPrimitiveValue::CSS_PX);
6627 6629
6628 addProperty(CSSPropertyFlexGrow, cssValuePool().createValue(clampToFloat(fle xGrow), CSSPrimitiveValue::CSS_NUMBER), important); 6630 addProperty(CSSPropertyFlexGrow, cssValuePool().createValue(clampToFloat(fle xGrow), CSSPrimitiveValue::CSS_NUMBER), important);
6629 addProperty(CSSPropertyFlexShrink, cssValuePool().createValue(clampToFloat(f lexShrink), CSSPrimitiveValue::CSS_NUMBER), important); 6631 addProperty(CSSPropertyFlexShrink, cssValuePool().createValue(clampToFloat(f lexShrink), CSSPrimitiveValue::CSS_NUMBER), important);
6630 addProperty(CSSPropertyFlexBasis, flexBasis, important); 6632 addProperty(CSSPropertyFlexBasis, flexBasis, important);
6631 return true; 6633 return true;
6632 } 6634 }
6633 6635
6636 bool CSSParser::parseObjectPosition(bool important)
6637 {
6638 RefPtr<CSSValue> xValue;
6639 RefPtr<CSSValue> yValue;
6640 parseFillPosition(m_valueList.get(), xValue, yValue);
6641 if (!xValue || !yValue)
6642 return false;
6643 addProperty(
6644 CSSPropertyObjectPosition,
6645 createPrimitiveValuePair(toCSSPrimitiveValue(xValue.get()), toCSSPrimiti veValue(yValue.get()), Pair::KeepIdenticalValues),
6646 important);
6647 return true;
6648 }
6649
6634 struct BorderImageParseContext { 6650 struct BorderImageParseContext {
6635 BorderImageParseContext() 6651 BorderImageParseContext()
6636 : m_canAdvance(false) 6652 : m_canAdvance(false)
6637 , m_allowCommit(true) 6653 , m_allowCommit(true)
6638 , m_allowImage(true) 6654 , m_allowImage(true)
6639 , m_allowImageSlice(true) 6655 , m_allowImageSlice(true)
6640 , m_allowRepeat(true) 6656 , m_allowRepeat(true)
6641 , m_allowForwardSlashOperator(false) 6657 , m_allowForwardSlashOperator(false)
6642 , m_requireWidth(false) 6658 , m_requireWidth(false)
6643 , m_requireOutset(false) 6659 , m_requireOutset(false)
(...skipping 5362 matching lines...) Expand 10 before | Expand all | Expand 10 after
12006 { 12022 {
12007 // The tokenizer checks for the construct of an+b. 12023 // The tokenizer checks for the construct of an+b.
12008 // However, since the {ident} rule precedes the {nth} rule, some of those 12024 // However, since the {ident} rule precedes the {nth} rule, some of those
12009 // tokens are identified as string literal. Furthermore we need to accept 12025 // tokens are identified as string literal. Furthermore we need to accept
12010 // "odd" and "even" which does not match to an+b. 12026 // "odd" and "even" which does not match to an+b.
12011 return equalIgnoringCase(token, "odd") || equalIgnoringCase(token, "even") 12027 return equalIgnoringCase(token, "odd") || equalIgnoringCase(token, "even")
12012 || equalIgnoringCase(token, "n") || equalIgnoringCase(token, "-n"); 12028 || equalIgnoringCase(token, "n") || equalIgnoringCase(token, "-n");
12013 } 12029 }
12014 12030
12015 } 12031 }
OLDNEW
« no previous file with comments | « Source/core/css/CSSParser.h ('k') | Source/core/css/CSSProperties.in » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698