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

Side by Side Diff: Source/core/css/CSSComputedStyleDeclaration.cpp

Issue 167603002: Implement 'will-change' parsing (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 10 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004 Zack Rusin <zack@kde.org> 2 * Copyright (C) 2004 Zack Rusin <zack@kde.org>
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved. 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved.
4 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> 4 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org>
5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> 5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com>
6 * Copyright (C) 2011 Sencha, Inc. All rights reserved. 6 * Copyright (C) 2011 Sencha, Inc. All rights reserved.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public 9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 CSSPropertyTransitionDelay, 198 CSSPropertyTransitionDelay,
199 CSSPropertyTransitionDuration, 199 CSSPropertyTransitionDuration,
200 CSSPropertyTransitionProperty, 200 CSSPropertyTransitionProperty,
201 CSSPropertyTransitionTimingFunction, 201 CSSPropertyTransitionTimingFunction,
202 CSSPropertyUnicodeBidi, 202 CSSPropertyUnicodeBidi,
203 CSSPropertyVerticalAlign, 203 CSSPropertyVerticalAlign,
204 CSSPropertyVisibility, 204 CSSPropertyVisibility,
205 CSSPropertyWhiteSpace, 205 CSSPropertyWhiteSpace,
206 CSSPropertyWidows, 206 CSSPropertyWidows,
207 CSSPropertyWidth, 207 CSSPropertyWidth,
208 CSSPropertyWillChange,
208 CSSPropertyWordBreak, 209 CSSPropertyWordBreak,
209 CSSPropertyWordSpacing, 210 CSSPropertyWordSpacing,
210 CSSPropertyWordWrap, 211 CSSPropertyWordWrap,
211 CSSPropertyZIndex, 212 CSSPropertyZIndex,
212 CSSPropertyZoom, 213 CSSPropertyZoom,
213 214
214 CSSPropertyWebkitAnimationDelay, 215 CSSPropertyWebkitAnimationDelay,
215 CSSPropertyWebkitAnimationDirection, 216 CSSPropertyWebkitAnimationDirection,
216 CSSPropertyWebkitAnimationDuration, 217 CSSPropertyWebkitAnimationDuration,
217 CSSPropertyWebkitAnimationFillMode, 218 CSSPropertyWebkitAnimationFillMode,
(...skipping 858 matching lines...) Expand 10 before | Expand all | Expand 10 after
1076 case CSSAnimationData::AnimationDirectionReverse: 1077 case CSSAnimationData::AnimationDirectionReverse:
1077 return cssValuePool().createIdentifierValue(CSSValueReverse); 1078 return cssValuePool().createIdentifierValue(CSSValueReverse);
1078 case CSSAnimationData::AnimationDirectionAlternateReverse: 1079 case CSSAnimationData::AnimationDirectionAlternateReverse:
1079 return cssValuePool().createIdentifierValue(CSSValueAlternateReverse); 1080 return cssValuePool().createIdentifierValue(CSSValueAlternateReverse);
1080 default: 1081 default:
1081 ASSERT_NOT_REACHED(); 1082 ASSERT_NOT_REACHED();
1082 return 0; 1083 return 0;
1083 } 1084 }
1084 } 1085 }
1085 1086
1087 static PassRefPtr<CSSValue> valueForWillChange(const Vector<CSSPropertyID>& will ChangeProperties, bool willChangeContents, bool willChangeScrollPosition)
1088 {
1089 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createCommaSeparated() ;
1090 if (willChangeContents)
1091 list->append(cssValuePool().createIdentifierValue(CSSValueContents));
1092 if (willChangeScrollPosition)
1093 list->append(cssValuePool().createIdentifierValue(CSSValueScrollPosition ));
1094 for (size_t i = 0; i < willChangeProperties.size(); ++i)
1095 list->append(cssValuePool().createIdentifierValue(willChangeProperties[i ]));
1096 if (!list->length())
1097 list->append(cssValuePool().createIdentifierValue(CSSValueAuto));
1098 return list.release();
1099 }
1100
1086 static PassRefPtr<CSSValue> createLineBoxContainValue(unsigned lineBoxContain) 1101 static PassRefPtr<CSSValue> createLineBoxContainValue(unsigned lineBoxContain)
1087 { 1102 {
1088 if (!lineBoxContain) 1103 if (!lineBoxContain)
1089 return cssValuePool().createIdentifierValue(CSSValueNone); 1104 return cssValuePool().createIdentifierValue(CSSValueNone);
1090 return CSSLineBoxContainValue::create(lineBoxContain); 1105 return CSSLineBoxContainValue::create(lineBoxContain);
1091 } 1106 }
1092 1107
1093 CSSComputedStyleDeclaration::CSSComputedStyleDeclaration(PassRefPtr<Node> n, boo l allowVisitedStyle, const String& pseudoElementName) 1108 CSSComputedStyleDeclaration::CSSComputedStyleDeclaration(PassRefPtr<Node> n, boo l allowVisitedStyle, const String& pseudoElementName)
1094 : m_node(n) 1109 : m_node(n)
1095 , m_allowVisitedStyle(allowVisitedStyle) 1110 , m_allowVisitedStyle(allowVisitedStyle)
(...skipping 1150 matching lines...) Expand 10 before | Expand all | Expand 10 after
2246 return cssValuePool().createValue(style->widows(), CSSPrimitiveValue ::CSS_NUMBER); 2261 return cssValuePool().createValue(style->widows(), CSSPrimitiveValue ::CSS_NUMBER);
2247 case CSSPropertyWidth: 2262 case CSSPropertyWidth:
2248 if (renderer) { 2263 if (renderer) {
2249 // According to http://www.w3.org/TR/CSS2/visudet.html#the-width -property, 2264 // According to http://www.w3.org/TR/CSS2/visudet.html#the-width -property,
2250 // the "width" property does not apply for non-replaced inline e lements. 2265 // the "width" property does not apply for non-replaced inline e lements.
2251 if (!renderer->isReplaced() && renderer->isInline()) 2266 if (!renderer->isReplaced() && renderer->isInline())
2252 return cssValuePool().createIdentifierValue(CSSValueAuto); 2267 return cssValuePool().createIdentifierValue(CSSValueAuto);
2253 return zoomAdjustedPixelValue(sizingBox(renderer).width(), *styl e); 2268 return zoomAdjustedPixelValue(sizingBox(renderer).width(), *styl e);
2254 } 2269 }
2255 return zoomAdjustedPixelValueForLength(style->width(), *style); 2270 return zoomAdjustedPixelValueForLength(style->width(), *style);
2271 case CSSPropertyWillChange:
2272 return valueForWillChange(style->willChangeProperties(), style->will ChangeContents(), style->willChangeScrollPosition());
2256 case CSSPropertyWordBreak: 2273 case CSSPropertyWordBreak:
2257 return cssValuePool().createValue(style->wordBreak()); 2274 return cssValuePool().createValue(style->wordBreak());
2258 case CSSPropertyWordSpacing: 2275 case CSSPropertyWordSpacing:
2259 return zoomAdjustedPixelValue(style->wordSpacing(), *style); 2276 return zoomAdjustedPixelValue(style->wordSpacing(), *style);
2260 case CSSPropertyWordWrap: 2277 case CSSPropertyWordWrap:
2261 return cssValuePool().createValue(style->overflowWrap()); 2278 return cssValuePool().createValue(style->overflowWrap());
2262 case CSSPropertyWebkitLineBreak: 2279 case CSSPropertyWebkitLineBreak:
2263 return cssValuePool().createValue(style->lineBreak()); 2280 return cssValuePool().createValue(style->lineBreak());
2264 case CSSPropertyResize: 2281 case CSSPropertyResize:
2265 return cssValuePool().createValue(style->resize()); 2282 return cssValuePool().createValue(style->resize());
(...skipping 752 matching lines...) Expand 10 before | Expand all | Expand 10 after
3018 static const CSSPropertyID propertiesAfterSlashSeperator[3] = { CSSPropertyB ackgroundSize, CSSPropertyBackgroundOrigin, 3035 static const CSSPropertyID propertiesAfterSlashSeperator[3] = { CSSPropertyB ackgroundSize, CSSPropertyBackgroundOrigin,
3019 CSSPropertyB ackgroundClip }; 3036 CSSPropertyB ackgroundClip };
3020 3037
3021 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSlashSeparated() ; 3038 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSlashSeparated() ;
3022 list->append(valuesForShorthandProperty(StylePropertyShorthand(CSSPropertyBa ckground, propertiesBeforeSlashSeperator, WTF_ARRAY_LENGTH(propertiesBeforeSlash Seperator)))); 3039 list->append(valuesForShorthandProperty(StylePropertyShorthand(CSSPropertyBa ckground, propertiesBeforeSlashSeperator, WTF_ARRAY_LENGTH(propertiesBeforeSlash Seperator))));
3023 list->append(valuesForShorthandProperty(StylePropertyShorthand(CSSPropertyBa ckground, propertiesAfterSlashSeperator, WTF_ARRAY_LENGTH(propertiesAfterSlashSe perator)))); 3040 list->append(valuesForShorthandProperty(StylePropertyShorthand(CSSPropertyBa ckground, propertiesAfterSlashSeperator, WTF_ARRAY_LENGTH(propertiesAfterSlashSe perator))));
3024 return list.release(); 3041 return list.release();
3025 } 3042 }
3026 3043
3027 } // namespace WebCore 3044 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698