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

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

Issue 22839023: Add support for the object-position CSS property. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 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
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 1805 matching lines...) Expand 10 before | Expand all | Expand 10 after
1966 shorthandScope = adoptPtr(new ShorthandScope(this, propId)); 1966 shorthandScope = adoptPtr(new ShorthandScope(this, propId));
1967 } 1967 }
1968 addProperty(propId1, val1.release(), important); 1968 addProperty(propId1, val1.release(), important);
1969 if (val2) 1969 if (val2)
1970 addProperty(propId2, val2.release(), important); 1970 addProperty(propId2, val2.release(), important);
1971 result = true; 1971 result = true;
1972 } 1972 }
1973 m_implicitShorthand = false; 1973 m_implicitShorthand = false;
1974 return result; 1974 return result;
1975 } 1975 }
1976 case CSSPropertyObjectPosition:
1977 return RuntimeEnabledFeatures::objectFitPositionEnabled() && parseObject Position(important);
1976 case CSSPropertyListStyleImage: // <uri> | none | inherit 1978 case CSSPropertyListStyleImage: // <uri> | none | inherit
1977 case CSSPropertyBorderImageSource: 1979 case CSSPropertyBorderImageSource:
1978 case CSSPropertyWebkitMaskBoxImageSource: 1980 case CSSPropertyWebkitMaskBoxImageSource:
1979 if (id == CSSValueNone) { 1981 if (id == CSSValueNone) {
1980 parsedValue = cssValuePool().createIdentifierValue(CSSValueNone); 1982 parsedValue = cssValuePool().createIdentifierValue(CSSValueNone);
1981 m_valueList->next(); 1983 m_valueList->next();
1982 } else if (value->unit == CSSPrimitiveValue::CSS_URI) { 1984 } else if (value->unit == CSSPrimitiveValue::CSS_URI) {
1983 parsedValue = CSSImageValue::create(completeURL(value->string)); 1985 parsedValue = CSSImageValue::create(completeURL(value->string));
1984 m_valueList->next(); 1986 m_valueList->next();
1985 } else if (isGeneratedImageValue(value)) { 1987 } else if (isGeneratedImageValue(value)) {
(...skipping 4595 matching lines...) Expand 10 before | Expand all | Expand 10 after
6581 flexShrink = 1; 6583 flexShrink = 1;
6582 if (!flexBasis) 6584 if (!flexBasis)
6583 flexBasis = cssValuePool().createValue(0, CSSPrimitiveValue::CSS_PX); 6585 flexBasis = cssValuePool().createValue(0, CSSPrimitiveValue::CSS_PX);
6584 6586
6585 addProperty(CSSPropertyFlexGrow, cssValuePool().createValue(clampToFloat(fle xGrow), CSSPrimitiveValue::CSS_NUMBER), important); 6587 addProperty(CSSPropertyFlexGrow, cssValuePool().createValue(clampToFloat(fle xGrow), CSSPrimitiveValue::CSS_NUMBER), important);
6586 addProperty(CSSPropertyFlexShrink, cssValuePool().createValue(clampToFloat(f lexShrink), CSSPrimitiveValue::CSS_NUMBER), important); 6588 addProperty(CSSPropertyFlexShrink, cssValuePool().createValue(clampToFloat(f lexShrink), CSSPrimitiveValue::CSS_NUMBER), important);
6587 addProperty(CSSPropertyFlexBasis, flexBasis, important); 6589 addProperty(CSSPropertyFlexBasis, flexBasis, important);
6588 return true; 6590 return true;
6589 } 6591 }
6590 6592
6593 bool CSSParser::parseObjectPosition(bool important)
6594 {
6595 RefPtr<CSSValue> xValue;
6596 RefPtr<CSSValue> yValue;
6597 parseFillPosition(m_valueList.get(), xValue, yValue);
6598 if (!xValue || !yValue)
6599 return false;
6600 addProperty(
6601 CSSPropertyObjectPosition,
6602 createPrimitiveValuePair(toCSSPrimitiveValue(xValue.get()), toCSSPrimiti veValue(yValue.get()), Pair::KeepIdenticalValues),
6603 important);
6604 return true;
6605 }
6606
6591 struct BorderImageParseContext { 6607 struct BorderImageParseContext {
6592 BorderImageParseContext() 6608 BorderImageParseContext()
6593 : m_canAdvance(false) 6609 : m_canAdvance(false)
6594 , m_allowCommit(true) 6610 , m_allowCommit(true)
6595 , m_allowImage(true) 6611 , m_allowImage(true)
6596 , m_allowImageSlice(true) 6612 , m_allowImageSlice(true)
6597 , m_allowRepeat(true) 6613 , m_allowRepeat(true)
6598 , m_allowForwardSlashOperator(false) 6614 , m_allowForwardSlashOperator(false)
6599 , m_requireWidth(false) 6615 , m_requireWidth(false)
6600 , m_requireOutset(false) 6616 , m_requireOutset(false)
(...skipping 5370 matching lines...) Expand 10 before | Expand all | Expand 10 after
11971 { 11987 {
11972 // The tokenizer checks for the construct of an+b. 11988 // The tokenizer checks for the construct of an+b.
11973 // However, since the {ident} rule precedes the {nth} rule, some of those 11989 // However, since the {ident} rule precedes the {nth} rule, some of those
11974 // tokens are identified as string literal. Furthermore we need to accept 11990 // tokens are identified as string literal. Furthermore we need to accept
11975 // "odd" and "even" which does not match to an+b. 11991 // "odd" and "even" which does not match to an+b.
11976 return equalIgnoringCase(token, "odd") || equalIgnoringCase(token, "even") 11992 return equalIgnoringCase(token, "odd") || equalIgnoringCase(token, "even")
11977 || equalIgnoringCase(token, "n") || equalIgnoringCase(token, "-n"); 11993 || equalIgnoringCase(token, "n") || equalIgnoringCase(token, "-n");
11978 } 11994 }
11979 11995
11980 } 11996 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698