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

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: Rebase master 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 1822 matching lines...) Expand 10 before | Expand all | Expand 10 after
1983 shorthandScope = adoptPtr(new ShorthandScope(this, propId)); 1983 shorthandScope = adoptPtr(new ShorthandScope(this, propId));
1984 } 1984 }
1985 addProperty(propId1, val1.release(), important); 1985 addProperty(propId1, val1.release(), important);
1986 if (val2) 1986 if (val2)
1987 addProperty(propId2, val2.release(), important); 1987 addProperty(propId2, val2.release(), important);
1988 result = true; 1988 result = true;
1989 } 1989 }
1990 m_implicitShorthand = false; 1990 m_implicitShorthand = false;
1991 return result; 1991 return result;
1992 } 1992 }
1993 case CSSPropertyObjectPosition:
1994 return RuntimeEnabledFeatures::objectFitPositionEnabled() && parseObject Position(important);
1993 case CSSPropertyListStyleImage: // <uri> | none | inherit 1995 case CSSPropertyListStyleImage: // <uri> | none | inherit
1994 case CSSPropertyBorderImageSource: 1996 case CSSPropertyBorderImageSource:
1995 case CSSPropertyWebkitMaskBoxImageSource: 1997 case CSSPropertyWebkitMaskBoxImageSource:
1996 if (id == CSSValueNone) { 1998 if (id == CSSValueNone) {
1997 parsedValue = cssValuePool().createIdentifierValue(CSSValueNone); 1999 parsedValue = cssValuePool().createIdentifierValue(CSSValueNone);
1998 m_valueList->next(); 2000 m_valueList->next();
1999 } else if (value->unit == CSSPrimitiveValue::CSS_URI) { 2001 } else if (value->unit == CSSPrimitiveValue::CSS_URI) {
2000 parsedValue = CSSImageValue::create(completeURL(value->string)); 2002 parsedValue = CSSImageValue::create(completeURL(value->string));
2001 m_valueList->next(); 2003 m_valueList->next();
2002 } else if (isGeneratedImageValue(value)) { 2004 } else if (isGeneratedImageValue(value)) {
(...skipping 4606 matching lines...) Expand 10 before | Expand all | Expand 10 after
6609 flexShrink = 1; 6611 flexShrink = 1;
6610 if (!flexBasis) 6612 if (!flexBasis)
6611 flexBasis = cssValuePool().createValue(0, CSSPrimitiveValue::CSS_PX); 6613 flexBasis = cssValuePool().createValue(0, CSSPrimitiveValue::CSS_PX);
6612 6614
6613 addProperty(CSSPropertyFlexGrow, cssValuePool().createValue(clampToFloat(fle xGrow), CSSPrimitiveValue::CSS_NUMBER), important); 6615 addProperty(CSSPropertyFlexGrow, cssValuePool().createValue(clampToFloat(fle xGrow), CSSPrimitiveValue::CSS_NUMBER), important);
6614 addProperty(CSSPropertyFlexShrink, cssValuePool().createValue(clampToFloat(f lexShrink), CSSPrimitiveValue::CSS_NUMBER), important); 6616 addProperty(CSSPropertyFlexShrink, cssValuePool().createValue(clampToFloat(f lexShrink), CSSPrimitiveValue::CSS_NUMBER), important);
6615 addProperty(CSSPropertyFlexBasis, flexBasis, important); 6617 addProperty(CSSPropertyFlexBasis, flexBasis, important);
6616 return true; 6618 return true;
6617 } 6619 }
6618 6620
6621 bool CSSParser::parseObjectPosition(bool important)
6622 {
6623 RefPtr<CSSValue> xValue;
6624 RefPtr<CSSValue> yValue;
6625 parseFillPosition(m_valueList.get(), xValue, yValue);
6626 if (!xValue || !yValue)
6627 return false;
6628 addProperty(
6629 CSSPropertyObjectPosition,
6630 createPrimitiveValuePair(toCSSPrimitiveValue(xValue.get()), toCSSPrimiti veValue(yValue.get()), Pair::KeepIdenticalValues),
6631 important);
6632 return true;
6633 }
6634
6619 struct BorderImageParseContext { 6635 struct BorderImageParseContext {
6620 BorderImageParseContext() 6636 BorderImageParseContext()
6621 : m_canAdvance(false) 6637 : m_canAdvance(false)
6622 , m_allowCommit(true) 6638 , m_allowCommit(true)
6623 , m_allowImage(true) 6639 , m_allowImage(true)
6624 , m_allowImageSlice(true) 6640 , m_allowImageSlice(true)
6625 , m_allowRepeat(true) 6641 , m_allowRepeat(true)
6626 , m_allowForwardSlashOperator(false) 6642 , m_allowForwardSlashOperator(false)
6627 , m_requireWidth(false) 6643 , m_requireWidth(false)
6628 , m_requireOutset(false) 6644 , m_requireOutset(false)
(...skipping 5362 matching lines...) Expand 10 before | Expand all | Expand 10 after
11991 { 12007 {
11992 // The tokenizer checks for the construct of an+b. 12008 // The tokenizer checks for the construct of an+b.
11993 // However, since the {ident} rule precedes the {nth} rule, some of those 12009 // However, since the {ident} rule precedes the {nth} rule, some of those
11994 // tokens are identified as string literal. Furthermore we need to accept 12010 // tokens are identified as string literal. Furthermore we need to accept
11995 // "odd" and "even" which does not match to an+b. 12011 // "odd" and "even" which does not match to an+b.
11996 return equalIgnoringCase(token, "odd") || equalIgnoringCase(token, "even") 12012 return equalIgnoringCase(token, "odd") || equalIgnoringCase(token, "even")
11997 || equalIgnoringCase(token, "n") || equalIgnoringCase(token, "-n"); 12013 || equalIgnoringCase(token, "n") || equalIgnoringCase(token, "-n");
11998 } 12014 }
11999 12015
12000 } 12016 }
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