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

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

Issue 16415007: Cleanup usage of CSSPropertyID and CSSValueID inside Blink. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 6 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
« no previous file with comments | « Source/core/css/Counter.h ('k') | Source/core/css/MediaQueryEvaluator.cpp » ('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) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 if (value->isPrimitiveValue()) 146 if (value->isPrimitiveValue())
147 setValue(styleResolver->style(), *toCSSPrimitiveValue(value)); 147 setValue(styleResolver->style(), *toCSSPrimitiveValue(value));
148 } 148 }
149 static PropertyHandler createHandler() 149 static PropertyHandler createHandler()
150 { 150 {
151 PropertyHandler handler = ApplyPropertyDefaultBase<GetterType, getterFun ction, SetterType, setterFunction, InitialType, initialFunction>::createHandler( ); 151 PropertyHandler handler = ApplyPropertyDefaultBase<GetterType, getterFun ction, SetterType, setterFunction, InitialType, initialFunction>::createHandler( );
152 return PropertyHandler(handler.inheritFunction(), handler.initialFunctio n(), &applyValue); 152 return PropertyHandler(handler.inheritFunction(), handler.initialFunctio n(), &applyValue);
153 } 153 }
154 }; 154 };
155 155
156 template <typename NumberType, NumberType (RenderStyle::*getterFunction)() const , void (RenderStyle::*setterFunction)(NumberType), NumberType (*initialFunction) (), int idMapsToMinusOne = CSSValueAuto> 156 template <typename NumberType, NumberType (RenderStyle::*getterFunction)() const , void (RenderStyle::*setterFunction)(NumberType), NumberType (*initialFunction) (), CSSValueID idMapsToMinusOne = CSSValueAuto>
157 class ApplyPropertyNumber { 157 class ApplyPropertyNumber {
158 public: 158 public:
159 static void setValue(RenderStyle* style, NumberType value) { (style->*setter Function)(value); } 159 static void setValue(RenderStyle* style, NumberType value) { (style->*setter Function)(value); }
160 static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue * value) 160 static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue * value)
161 { 161 {
162 if (!value->isPrimitiveValue()) 162 if (!value->isPrimitiveValue())
163 return; 163 return;
164 164
165 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); 165 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
166 if (primitiveValue->getIdent() == idMapsToMinusOne) 166 if (primitiveValue->getValueID() == idMapsToMinusOne)
167 setValue(styleResolver->style(), -1); 167 setValue(styleResolver->style(), -1);
168 else 168 else
169 setValue(styleResolver->style(), primitiveValue->getValue<NumberType >(CSSPrimitiveValue::CSS_NUMBER)); 169 setValue(styleResolver->style(), primitiveValue->getValue<NumberType >(CSSPrimitiveValue::CSS_NUMBER));
170 } 170 }
171 static PropertyHandler createHandler() 171 static PropertyHandler createHandler()
172 { 172 {
173 PropertyHandler handler = ApplyPropertyDefaultBase<NumberType, getterFun ction, NumberType, setterFunction, NumberType, initialFunction>::createHandler() ; 173 PropertyHandler handler = ApplyPropertyDefaultBase<NumberType, getterFun ction, NumberType, setterFunction, NumberType, initialFunction>::createHandler() ;
174 return PropertyHandler(handler.inheritFunction(), handler.initialFunctio n(), &applyValue); 174 return PropertyHandler(handler.inheritFunction(), handler.initialFunctio n(), &applyValue);
175 } 175 }
176 }; 176 };
177 177
178 template <StyleImage* (RenderStyle::*getterFunction)() const, void (RenderStyle: :*setterFunction)(PassRefPtr<StyleImage>), StyleImage* (*initialFunction)(), CSS PropertyID property> 178 template <StyleImage* (RenderStyle::*getterFunction)() const, void (RenderStyle: :*setterFunction)(PassRefPtr<StyleImage>), StyleImage* (*initialFunction)(), CSS PropertyID property>
179 class ApplyPropertyStyleImage { 179 class ApplyPropertyStyleImage {
180 public: 180 public:
181 static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue * value) { (styleResolver->style()->*setterFunction)(styleResolver->styleImage(p roperty, value)); } 181 static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue * value) { (styleResolver->style()->*setterFunction)(styleResolver->styleImage(p roperty, value)); }
182 static PropertyHandler createHandler() 182 static PropertyHandler createHandler()
183 { 183 {
184 PropertyHandler handler = ApplyPropertyDefaultBase<StyleImage*, getterFu nction, PassRefPtr<StyleImage>, setterFunction, StyleImage*, initialFunction>::c reateHandler(); 184 PropertyHandler handler = ApplyPropertyDefaultBase<StyleImage*, getterFu nction, PassRefPtr<StyleImage>, setterFunction, StyleImage*, initialFunction>::c reateHandler();
185 return PropertyHandler(handler.inheritFunction(), handler.initialFunctio n(), &applyValue); 185 return PropertyHandler(handler.inheritFunction(), handler.initialFunctio n(), &applyValue);
186 } 186 }
187 }; 187 };
188 188
189 enum AutoValueType {Number = 0, ComputeLength}; 189 enum AutoValueType {Number = 0, ComputeLength};
190 template <typename T, T (RenderStyle::*getterFunction)() const, void (RenderStyl e::*setterFunction)(T), bool (RenderStyle::*hasAutoFunction)() const, void (Rend erStyle::*setAutoFunction)(), AutoValueType valueType = Number, int autoIdentity = CSSValueAuto> 190 template <typename T, T (RenderStyle::*getterFunction)() const, void (RenderStyl e::*setterFunction)(T), bool (RenderStyle::*hasAutoFunction)() const, void (Rend erStyle::*setAutoFunction)(), AutoValueType valueType = Number, CSSValueID autoI dentity = CSSValueAuto>
191 class ApplyPropertyAuto { 191 class ApplyPropertyAuto {
192 public: 192 public:
193 static void setValue(RenderStyle* style, T value) { (style->*setterFunction) (value); } 193 static void setValue(RenderStyle* style, T value) { (style->*setterFunction) (value); }
194 static T value(RenderStyle* style) { return (style->*getterFunction)(); } 194 static T value(RenderStyle* style) { return (style->*getterFunction)(); }
195 static bool hasAuto(RenderStyle* style) { return (style->*hasAutoFunction)() ; } 195 static bool hasAuto(RenderStyle* style) { return (style->*hasAutoFunction)() ; }
196 static void setAuto(RenderStyle* style) { (style->*setAutoFunction)(); } 196 static void setAuto(RenderStyle* style) { (style->*setAutoFunction)(); }
197 197
198 static void applyInheritValue(CSSPropertyID, StyleResolver* styleResolver) 198 static void applyInheritValue(CSSPropertyID, StyleResolver* styleResolver)
199 { 199 {
200 if (hasAuto(styleResolver->parentStyle())) 200 if (hasAuto(styleResolver->parentStyle()))
201 setAuto(styleResolver->style()); 201 setAuto(styleResolver->style());
202 else 202 else
203 setValue(styleResolver->style(), value(styleResolver->parentStyle()) ); 203 setValue(styleResolver->style(), value(styleResolver->parentStyle()) );
204 } 204 }
205 205
206 static void applyInitialValue(CSSPropertyID, StyleResolver* styleResolver) { setAuto(styleResolver->style()); } 206 static void applyInitialValue(CSSPropertyID, StyleResolver* styleResolver) { setAuto(styleResolver->style()); }
207 207
208 static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue * value) 208 static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue * value)
209 { 209 {
210 if (!value->isPrimitiveValue()) 210 if (!value->isPrimitiveValue())
211 return; 211 return;
212 212
213 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); 213 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
214 if (primitiveValue->getIdent() == autoIdentity) 214 if (primitiveValue->getValueID() == autoIdentity)
215 setAuto(styleResolver->style()); 215 setAuto(styleResolver->style());
216 else if (valueType == Number) 216 else if (valueType == Number)
217 setValue(styleResolver->style(), *primitiveValue); 217 setValue(styleResolver->style(), *primitiveValue);
218 else if (valueType == ComputeLength) 218 else if (valueType == ComputeLength)
219 setValue(styleResolver->style(), primitiveValue->computeLength<T>(st yleResolver->style(), styleResolver->rootElementStyle(), styleResolver->style()- >effectiveZoom())); 219 setValue(styleResolver->style(), primitiveValue->computeLength<T>(st yleResolver->style(), styleResolver->rootElementStyle(), styleResolver->style()- >effectiveZoom()));
220 } 220 }
221 221
222 static PropertyHandler createHandler() { return PropertyHandler(&applyInheri tValue, &applyInitialValue, &applyValue); } 222 static PropertyHandler createHandler() { return PropertyHandler(&applyInheri tValue, &applyInitialValue, &applyValue); }
223 }; 223 };
224 224
(...skipping 26 matching lines...) Expand all
251 251
252 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); 252 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
253 253
254 if (Rect* rect = primitiveValue->getRectValue()) { 254 if (Rect* rect = primitiveValue->getRectValue()) {
255 Length top = convertToLength(styleResolver, rect->top()); 255 Length top = convertToLength(styleResolver, rect->top());
256 Length right = convertToLength(styleResolver, rect->right()); 256 Length right = convertToLength(styleResolver, rect->right());
257 Length bottom = convertToLength(styleResolver, rect->bottom()); 257 Length bottom = convertToLength(styleResolver, rect->bottom());
258 Length left = convertToLength(styleResolver, rect->left()); 258 Length left = convertToLength(styleResolver, rect->left());
259 styleResolver->style()->setClip(top, right, bottom, left); 259 styleResolver->style()->setClip(top, right, bottom, left);
260 styleResolver->style()->setHasClip(true); 260 styleResolver->style()->setHasClip(true);
261 } else if (primitiveValue->getIdent() == CSSValueAuto) { 261 } else if (primitiveValue->getValueID() == CSSValueAuto) {
262 styleResolver->style()->setClip(Length(), Length(), Length(), Length ()); 262 styleResolver->style()->setClip(Length(), Length(), Length(), Length ());
263 styleResolver->style()->setHasClip(false); 263 styleResolver->style()->setHasClip(false);
264 } 264 }
265 } 265 }
266 266
267 static PropertyHandler createHandler() { return PropertyHandler(&applyInheri tValue, &applyInitialValue, &applyValue); } 267 static PropertyHandler createHandler() { return PropertyHandler(&applyInheri tValue, &applyInitialValue, &applyValue); }
268 }; 268 };
269 269
270 enum ColorInherit {NoInheritFromParent = 0, InheritFromParent}; 270 enum ColorInherit {NoInheritFromParent = 0, InheritFromParent};
271 Color defaultInitialColor(); 271 Color defaultInitialColor();
(...skipping 17 matching lines...) Expand all
289 { 289 {
290 applyColorValue(styleResolver, initialFunction()); 290 applyColorValue(styleResolver, initialFunction());
291 } 291 }
292 292
293 static void applyValue(CSSPropertyID propertyID, StyleResolver* styleResolve r, CSSValue* value) 293 static void applyValue(CSSPropertyID propertyID, StyleResolver* styleResolve r, CSSValue* value)
294 { 294 {
295 if (!value->isPrimitiveValue()) 295 if (!value->isPrimitiveValue())
296 return; 296 return;
297 297
298 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); 298 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
299 if (inheritColorFromParent && primitiveValue->getIdent() == CSSValueCurr entcolor) 299 if (inheritColorFromParent && primitiveValue->getValueID() == CSSValueCu rrentcolor)
300 applyInheritValue(propertyID, styleResolver); 300 applyInheritValue(propertyID, styleResolver);
301 else { 301 else {
302 if (styleResolver->applyPropertyToRegularStyle()) 302 if (styleResolver->applyPropertyToRegularStyle())
303 (styleResolver->style()->*setterFunction)(styleResolver->colorFr omPrimitiveValue(primitiveValue)); 303 (styleResolver->style()->*setterFunction)(styleResolver->colorFr omPrimitiveValue(primitiveValue));
304 if (styleResolver->applyPropertyToVisitedLinkStyle()) 304 if (styleResolver->applyPropertyToVisitedLinkStyle())
305 (styleResolver->style()->*visitedLinkSetterFunction)(styleResolv er->colorFromPrimitiveValue(primitiveValue, /* forVisitedLink */ true)); 305 (styleResolver->style()->*visitedLinkSetterFunction)(styleResolv er->colorFromPrimitiveValue(primitiveValue, /* forVisitedLink */ true));
306 } 306 }
307 } 307 }
308 308
309 static void applyColorValue(StyleResolver* styleResolver, const Color& color ) 309 static void applyColorValue(StyleResolver* styleResolver, const Color& color )
(...skipping 28 matching lines...) Expand all
338 enum StringIdentBehavior { NothingMapsToNull = 0, MapNoneToNull, MapAutoToNull } ; 338 enum StringIdentBehavior { NothingMapsToNull = 0, MapNoneToNull, MapAutoToNull } ;
339 template <StringIdentBehavior identBehavior, const AtomicString& (RenderStyle::* getterFunction)() const, void (RenderStyle::*setterFunction)(const AtomicString& ), const AtomicString& (*initialFunction)()> 339 template <StringIdentBehavior identBehavior, const AtomicString& (RenderStyle::* getterFunction)() const, void (RenderStyle::*setterFunction)(const AtomicString& ), const AtomicString& (*initialFunction)()>
340 class ApplyPropertyString { 340 class ApplyPropertyString {
341 public: 341 public:
342 static void setValue(RenderStyle* style, const AtomicString& value) { (style ->*setterFunction)(value); } 342 static void setValue(RenderStyle* style, const AtomicString& value) { (style ->*setterFunction)(value); }
343 static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue * value) 343 static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue * value)
344 { 344 {
345 if (!value->isPrimitiveValue()) 345 if (!value->isPrimitiveValue())
346 return; 346 return;
347 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); 347 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
348 if ((identBehavior == MapNoneToNull && primitiveValue->getIdent() == CSS ValueNone) 348 if ((identBehavior == MapNoneToNull && primitiveValue->getValueID() == C SSValueNone)
349 || (identBehavior == MapAutoToNull && primitiveValue->getIdent() == CSSValueAuto)) 349 || (identBehavior == MapAutoToNull && primitiveValue->getValueID() = = CSSValueAuto))
350 setValue(styleResolver->style(), nullAtom); 350 setValue(styleResolver->style(), nullAtom);
351 else 351 else
352 setValue(styleResolver->style(), primitiveValue->getStringValue()); 352 setValue(styleResolver->style(), primitiveValue->getStringValue());
353 } 353 }
354 static PropertyHandler createHandler() 354 static PropertyHandler createHandler()
355 { 355 {
356 PropertyHandler handler = ApplyPropertyDefaultBase<const AtomicString&, getterFunction, const AtomicString&, setterFunction, const AtomicString&, initia lFunction>::createHandler(); 356 PropertyHandler handler = ApplyPropertyDefaultBase<const AtomicString&, getterFunction, const AtomicString&, setterFunction, const AtomicString&, initia lFunction>::createHandler();
357 return PropertyHandler(handler.inheritFunction(), handler.initialFunctio n(), &applyValue); 357 return PropertyHandler(handler.inheritFunction(), handler.initialFunctio n(), &applyValue);
358 } 358 }
359 }; 359 };
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 public: 511 public:
512 static void setValue(RenderStyle* style, T value) { (style->*setterFunction) (value); } 512 static void setValue(RenderStyle* style, T value) { (style->*setterFunction) (value); }
513 static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue * value) 513 static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue * value)
514 { 514 {
515 // note: CSSPropertyLetter/WordSpacing right now sets to zero if it's no t a primitive value for some reason... 515 // note: CSSPropertyLetter/WordSpacing right now sets to zero if it's no t a primitive value for some reason...
516 if (!value->isPrimitiveValue()) 516 if (!value->isPrimitiveValue())
517 return; 517 return;
518 518
519 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); 519 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
520 520
521 int ident = primitiveValue->getIdent(); 521 CSSValueID valueID = primitiveValue->getValueID();
522 T length; 522 T length;
523 if (normalEnabled && ident == CSSValueNormal) { 523 if (normalEnabled && valueID == CSSValueNormal) {
524 length = 0; 524 length = 0;
525 } else if (thicknessEnabled && ident == CSSValueThin) { 525 } else if (thicknessEnabled && valueID == CSSValueThin) {
526 length = 1; 526 length = 1;
527 } else if (thicknessEnabled && ident == CSSValueMedium) { 527 } else if (thicknessEnabled && valueID == CSSValueMedium) {
528 length = 3; 528 length = 3;
529 } else if (thicknessEnabled && ident == CSSValueThick) { 529 } else if (thicknessEnabled && valueID == CSSValueThick) {
530 length = 5; 530 length = 5;
531 } else if (ident == CSSValueInvalid) { 531 } else if (valueID == CSSValueInvalid) {
532 float zoom = (svgZoomEnabled && styleResolver->useSVGZoomRules()) ? 1.0f : styleResolver->style()->effectiveZoom(); 532 float zoom = (svgZoomEnabled && styleResolver->useSVGZoomRules()) ? 1.0f : styleResolver->style()->effectiveZoom();
533 533
534 // Any original result that was >= 1 should not be allowed to fall b elow 1. 534 // Any original result that was >= 1 should not be allowed to fall b elow 1.
535 // This keeps border lines from vanishing. 535 // This keeps border lines from vanishing.
536 length = primitiveValue->computeLength<T>(styleResolver->style(), st yleResolver->rootElementStyle(), zoom); 536 length = primitiveValue->computeLength<T>(styleResolver->style(), st yleResolver->rootElementStyle(), zoom);
537 if (zoom < 1.0f && length < 1.0) { 537 if (zoom < 1.0f && length < 1.0) {
538 T originalLength = primitiveValue->computeLength<T>(styleResolve r->style(), styleResolver->rootElementStyle(), 1.0); 538 T originalLength = primitiveValue->computeLength<T>(styleResolve r->style(), styleResolver->rootElementStyle(), 1.0);
539 if (originalLength >= 1.0) 539 if (originalLength >= 1.0)
540 length = 1.0; 540 length = 1.0;
541 } 541 }
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
630 for (CSSValueListIterator i = value; i.hasMore(); i.advance()) { 630 for (CSSValueListIterator i = value; i.hasMore(); i.advance()) {
631 CSSValue* item = i.value(); 631 CSSValue* item = i.value();
632 if (!item->isPrimitiveValue()) 632 if (!item->isPrimitiveValue())
633 continue; 633 continue;
634 CSSPrimitiveValue* contentValue = toCSSPrimitiveValue(item); 634 CSSPrimitiveValue* contentValue = toCSSPrimitiveValue(item);
635 AtomicString face; 635 AtomicString face;
636 Settings* settings = styleResolver->document()->settings(); 636 Settings* settings = styleResolver->document()->settings();
637 if (contentValue->isString()) 637 if (contentValue->isString())
638 face = contentValue->getStringValue(); 638 face = contentValue->getStringValue();
639 else if (settings) { 639 else if (settings) {
640 switch (contentValue->getIdent()) { 640 switch (contentValue->getValueID()) {
641 case CSSValueWebkitBody: 641 case CSSValueWebkitBody:
642 face = settings->standardFontFamily(); 642 face = settings->standardFontFamily();
643 break; 643 break;
644 case CSSValueSerif: 644 case CSSValueSerif:
645 face = serifFamily; 645 face = serifFamily;
646 fontDescription.setGenericFamily(FontDescription::SerifFamil y); 646 fontDescription.setGenericFamily(FontDescription::SerifFamil y);
647 break; 647 break;
648 case CSSValueSansSerif: 648 case CSSValueSansSerif:
649 face = sansSerifFamily; 649 face = sansSerifFamily;
650 fontDescription.setGenericFamily(FontDescription::SansSerifF amily); 650 fontDescription.setGenericFamily(FontDescription::SansSerifF amily);
651 break; 651 break;
652 case CSSValueCursive: 652 case CSSValueCursive:
653 face = cursiveFamily; 653 face = cursiveFamily;
654 fontDescription.setGenericFamily(FontDescription::CursiveFam ily); 654 fontDescription.setGenericFamily(FontDescription::CursiveFam ily);
655 break; 655 break;
656 case CSSValueFantasy: 656 case CSSValueFantasy:
657 face = fantasyFamily; 657 face = fantasyFamily;
658 fontDescription.setGenericFamily(FontDescription::FantasyFam ily); 658 fontDescription.setGenericFamily(FontDescription::FantasyFam ily);
659 break; 659 break;
660 case CSSValueMonospace: 660 case CSSValueMonospace:
661 face = monospaceFamily; 661 face = monospaceFamily;
662 fontDescription.setGenericFamily(FontDescription::MonospaceF amily); 662 fontDescription.setGenericFamily(FontDescription::MonospaceF amily);
663 break; 663 break;
664 case CSSValueWebkitPictograph: 664 case CSSValueWebkitPictograph:
665 face = pictographFamily; 665 face = pictographFamily;
666 fontDescription.setGenericFamily(FontDescription::Pictograph Family); 666 fontDescription.setGenericFamily(FontDescription::Pictograph Family);
667 break; 667 break;
668 default:
669 break;
668 } 670 }
669 } 671 }
670 672
671 if (!face.isEmpty()) { 673 if (!face.isEmpty()) {
672 if (!currFamily) { 674 if (!currFamily) {
673 // Filling in the first family. 675 // Filling in the first family.
674 firstFamily.setFamily(face); 676 firstFamily.setFamily(face);
675 firstFamily.appendFamily(0); // Remove any inherited family- fallback list. 677 firstFamily.appendFamily(0); // Remove any inherited family- fallback list.
676 currFamily = &firstFamily; 678 currFamily = &firstFamily;
677 fontDescription.setIsSpecifiedFont(fontDescription.genericFa mily() == FontDescription::NoFamily); 679 fontDescription.setIsSpecifiedFont(fontDescription.genericFa mily() == FontDescription::NoFamily);
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
756 fontDescription.setKeywordSize(0); 758 fontDescription.setKeywordSize(0);
757 float parentSize = 0; 759 float parentSize = 0;
758 bool parentIsAbsoluteSize = false; 760 bool parentIsAbsoluteSize = false;
759 float size = 0; 761 float size = 0;
760 762
761 if (styleResolver->parentStyle()) { 763 if (styleResolver->parentStyle()) {
762 parentSize = styleResolver->parentStyle()->fontDescription().specifi edSize(); 764 parentSize = styleResolver->parentStyle()->fontDescription().specifi edSize();
763 parentIsAbsoluteSize = styleResolver->parentStyle()->fontDescription ().isAbsoluteSize(); 765 parentIsAbsoluteSize = styleResolver->parentStyle()->fontDescription ().isAbsoluteSize();
764 } 766 }
765 767
766 if (int ident = primitiveValue->getIdent()) { 768 if (CSSValueID valueID = primitiveValue->getValueID()) {
767 // Keywords are being used. 769 // Keywords are being used.
768 switch (ident) { 770 switch (valueID) {
769 case CSSValueXxSmall: 771 case CSSValueXxSmall:
770 case CSSValueXSmall: 772 case CSSValueXSmall:
771 case CSSValueSmall: 773 case CSSValueSmall:
772 case CSSValueMedium: 774 case CSSValueMedium:
773 case CSSValueLarge: 775 case CSSValueLarge:
774 case CSSValueXLarge: 776 case CSSValueXLarge:
775 case CSSValueXxLarge: 777 case CSSValueXxLarge:
776 case CSSValueWebkitXxxLarge: 778 case CSSValueWebkitXxxLarge:
777 size = FontSize::fontSizeForKeyword(styleResolver->document(), i dent, fontDescription.useFixedDefaultSize()); 779 size = FontSize::fontSizeForKeyword(styleResolver->document(), v alueID, fontDescription.useFixedDefaultSize());
778 fontDescription.setKeywordSize(ident - CSSValueXxSmall + 1); 780 fontDescription.setKeywordSize(valueID - CSSValueXxSmall + 1);
779 break; 781 break;
780 case CSSValueLarger: 782 case CSSValueLarger:
781 size = largerFontSize(parentSize); 783 size = largerFontSize(parentSize);
782 break; 784 break;
783 case CSSValueSmaller: 785 case CSSValueSmaller:
784 size = smallerFontSize(parentSize); 786 size = smallerFontSize(parentSize);
785 break; 787 break;
786 default: 788 default:
787 return; 789 return;
788 } 790 }
789 791
790 fontDescription.setIsAbsoluteSize(parentIsAbsoluteSize && (ident == CSSValueLarger || ident == CSSValueSmaller)); 792 fontDescription.setIsAbsoluteSize(parentIsAbsoluteSize && (valueID = = CSSValueLarger || valueID == CSSValueSmaller));
791 } else { 793 } else {
792 fontDescription.setIsAbsoluteSize(parentIsAbsoluteSize 794 fontDescription.setIsAbsoluteSize(parentIsAbsoluteSize
793 || !(primitiveValue->isPercentage( ) || primitiveValue->isFontRelativeLength())); 795 || !(primitiveValue->isPercentage( ) || primitiveValue->isFontRelativeLength()));
794 if (primitiveValue->isLength()) 796 if (primitiveValue->isLength())
795 size = primitiveValue->computeLength<float>(styleResolver->paren tStyle(), styleResolver->rootElementStyle(), 1.0, true); 797 size = primitiveValue->computeLength<float>(styleResolver->paren tStyle(), styleResolver->rootElementStyle(), 1.0, true);
796 else if (primitiveValue->isPercentage()) 798 else if (primitiveValue->isPercentage())
797 size = (primitiveValue->getFloatValue() * parentSize) / 100.0f; 799 size = (primitiveValue->getFloatValue() * parentSize) / 100.0f;
798 else if (primitiveValue->isCalculatedPercentageWithLength()) 800 else if (primitiveValue->isCalculatedPercentageWithLength())
799 size = primitiveValue->cssCalcValue()->toCalcValue(styleResolver ->parentStyle(), styleResolver->rootElementStyle())->evaluate(parentSize); 801 size = primitiveValue->cssCalcValue()->toCalcValue(styleResolver ->parentStyle(), styleResolver->rootElementStyle())->evaluate(parentSize);
800 else if (primitiveValue->isViewportPercentageLength()) 802 else if (primitiveValue->isViewportPercentageLength())
(...skipping 18 matching lines...) Expand all
819 }; 821 };
820 822
821 class ApplyPropertyFontWeight { 823 class ApplyPropertyFontWeight {
822 public: 824 public:
823 static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue * value) 825 static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue * value)
824 { 826 {
825 if (!value->isPrimitiveValue()) 827 if (!value->isPrimitiveValue())
826 return; 828 return;
827 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); 829 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
828 FontDescription fontDescription = styleResolver->fontDescription(); 830 FontDescription fontDescription = styleResolver->fontDescription();
829 switch (primitiveValue->getIdent()) { 831 switch (primitiveValue->getValueID()) {
830 case CSSValueInvalid: 832 case CSSValueInvalid:
831 ASSERT_NOT_REACHED(); 833 ASSERT_NOT_REACHED();
832 break; 834 break;
833 case CSSValueBolder: 835 case CSSValueBolder:
834 fontDescription.setWeight(fontDescription.bolderWeight()); 836 fontDescription.setWeight(fontDescription.bolderWeight());
835 break; 837 break;
836 case CSSValueLighter: 838 case CSSValueLighter:
837 fontDescription.setWeight(fontDescription.lighterWeight()); 839 fontDescription.setWeight(fontDescription.lighterWeight());
838 break; 840 break;
839 default: 841 default:
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
879 FontDescription::LigaturesState discretionaryLigaturesState = FontDescri ption::NormalLigaturesState; 881 FontDescription::LigaturesState discretionaryLigaturesState = FontDescri ption::NormalLigaturesState;
880 FontDescription::LigaturesState historicalLigaturesState = FontDescripti on::NormalLigaturesState; 882 FontDescription::LigaturesState historicalLigaturesState = FontDescripti on::NormalLigaturesState;
881 883
882 if (value->isValueList()) { 884 if (value->isValueList()) {
883 CSSValueList* valueList = toCSSValueList(value); 885 CSSValueList* valueList = toCSSValueList(value);
884 for (size_t i = 0; i < valueList->length(); ++i) { 886 for (size_t i = 0; i < valueList->length(); ++i) {
885 CSSValue* item = valueList->itemWithoutBoundsCheck(i); 887 CSSValue* item = valueList->itemWithoutBoundsCheck(i);
886 ASSERT(item->isPrimitiveValue()); 888 ASSERT(item->isPrimitiveValue());
887 if (item->isPrimitiveValue()) { 889 if (item->isPrimitiveValue()) {
888 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(item ); 890 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(item );
889 switch (primitiveValue->getIdent()) { 891 switch (primitiveValue->getValueID()) {
890 case CSSValueNoCommonLigatures: 892 case CSSValueNoCommonLigatures:
891 commonLigaturesState = FontDescription::DisabledLigature sState; 893 commonLigaturesState = FontDescription::DisabledLigature sState;
892 break; 894 break;
893 case CSSValueCommonLigatures: 895 case CSSValueCommonLigatures:
894 commonLigaturesState = FontDescription::EnabledLigatures State; 896 commonLigaturesState = FontDescription::EnabledLigatures State;
895 break; 897 break;
896 case CSSValueNoDiscretionaryLigatures: 898 case CSSValueNoDiscretionaryLigatures:
897 discretionaryLigaturesState = FontDescription::DisabledL igaturesState; 899 discretionaryLigaturesState = FontDescription::DisabledL igaturesState;
898 break; 900 break;
899 case CSSValueDiscretionaryLigatures: 901 case CSSValueDiscretionaryLigatures:
900 discretionaryLigaturesState = FontDescription::EnabledLi gaturesState; 902 discretionaryLigaturesState = FontDescription::EnabledLi gaturesState;
901 break; 903 break;
902 case CSSValueNoHistoricalLigatures: 904 case CSSValueNoHistoricalLigatures:
903 historicalLigaturesState = FontDescription::DisabledLiga turesState; 905 historicalLigaturesState = FontDescription::DisabledLiga turesState;
904 break; 906 break;
905 case CSSValueHistoricalLigatures: 907 case CSSValueHistoricalLigatures:
906 historicalLigaturesState = FontDescription::EnabledLigat uresState; 908 historicalLigaturesState = FontDescription::EnabledLigat uresState;
907 break; 909 break;
908 default: 910 default:
909 ASSERT_NOT_REACHED(); 911 ASSERT_NOT_REACHED();
910 break; 912 break;
911 } 913 }
912 } 914 }
913 } 915 }
914 } 916 }
915 #if !ASSERT_DISABLED 917 #if !ASSERT_DISABLED
916 else { 918 else {
917 ASSERT_WITH_SECURITY_IMPLICATION(value->isPrimitiveValue()); 919 ASSERT_WITH_SECURITY_IMPLICATION(value->isPrimitiveValue());
918 ASSERT(toCSSPrimitiveValue(value)->getIdent() == CSSValueNormal); 920 ASSERT(toCSSPrimitiveValue(value)->getValueID() == CSSValueNormal);
919 } 921 }
920 #endif 922 #endif
921 923
922 FontDescription fontDescription = styleResolver->fontDescription(); 924 FontDescription fontDescription = styleResolver->fontDescription();
923 fontDescription.setCommonLigaturesState(commonLigaturesState); 925 fontDescription.setCommonLigaturesState(commonLigaturesState);
924 fontDescription.setDiscretionaryLigaturesState(discretionaryLigaturesSta te); 926 fontDescription.setDiscretionaryLigaturesState(discretionaryLigaturesSta te);
925 fontDescription.setHistoricalLigaturesState(historicalLigaturesState); 927 fontDescription.setHistoricalLigaturesState(historicalLigaturesState);
926 styleResolver->setFontDescription(fontDescription); 928 styleResolver->setFontDescription(fontDescription);
927 } 929 }
928 930
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
1103 styleResolver->style()->setCursor(CURSOR_AUTO); 1105 styleResolver->style()->setCursor(CURSOR_AUTO);
1104 for (int i = 0; i < len; i++) { 1106 for (int i = 0; i < len; i++) {
1105 CSSValue* item = list->itemWithoutBoundsCheck(i); 1107 CSSValue* item = list->itemWithoutBoundsCheck(i);
1106 if (item->isCursorImageValue()) { 1108 if (item->isCursorImageValue()) {
1107 CSSCursorImageValue* image = static_cast<CSSCursorImageValue *>(item); 1109 CSSCursorImageValue* image = static_cast<CSSCursorImageValue *>(item);
1108 if (image->updateIfSVGCursorIsUsed(styleResolver->element()) ) // Elements with SVG cursors are not allowed to share style. 1110 if (image->updateIfSVGCursorIsUsed(styleResolver->element()) ) // Elements with SVG cursors are not allowed to share style.
1109 styleResolver->style()->setUnique(); 1111 styleResolver->style()->setUnique();
1110 styleResolver->style()->addCursor(styleResolver->styleImage( CSSPropertyCursor, image), image->hotSpot()); 1112 styleResolver->style()->addCursor(styleResolver->styleImage( CSSPropertyCursor, image), image->hotSpot());
1111 } else if (item->isPrimitiveValue()) { 1113 } else if (item->isPrimitiveValue()) {
1112 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(item ); 1114 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(item );
1113 if (primitiveValue->isIdent()) 1115 if (primitiveValue->isValueID())
1114 styleResolver->style()->setCursor(*primitiveValue); 1116 styleResolver->style()->setCursor(*primitiveValue);
1115 } 1117 }
1116 } 1118 }
1117 } else if (value->isPrimitiveValue()) { 1119 } else if (value->isPrimitiveValue()) {
1118 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); 1120 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
1119 if (primitiveValue->isIdent() && styleResolver->style()->cursor() != ECursor(*primitiveValue)) 1121 if (primitiveValue->isValueID() && styleResolver->style()->cursor() != ECursor(*primitiveValue))
1120 styleResolver->style()->setCursor(*primitiveValue); 1122 styleResolver->style()->setCursor(*primitiveValue);
1121 } 1123 }
1122 } 1124 }
1123 1125
1124 static PropertyHandler createHandler() { return PropertyHandler(&applyInheri tValue, &applyInitialValue, &applyValue); } 1126 static PropertyHandler createHandler() { return PropertyHandler(&applyInheri tValue, &applyInitialValue, &applyValue); }
1125 }; 1127 };
1126 1128
1127 class ApplyPropertyTextAlign { 1129 class ApplyPropertyTextAlign {
1128 public: 1130 public:
1129 static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue * value) 1131 static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue * value)
1130 { 1132 {
1131 if (!value->isPrimitiveValue()) 1133 if (!value->isPrimitiveValue())
1132 return; 1134 return;
1133 1135
1134 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); 1136 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
1135 1137
1136 if (primitiveValue->getIdent() != CSSValueWebkitMatchParent) 1138 if (primitiveValue->getValueID() != CSSValueWebkitMatchParent)
1137 styleResolver->style()->setTextAlign(*primitiveValue); 1139 styleResolver->style()->setTextAlign(*primitiveValue);
1138 else if (styleResolver->parentStyle()->textAlign() == TASTART) 1140 else if (styleResolver->parentStyle()->textAlign() == TASTART)
1139 styleResolver->style()->setTextAlign(styleResolver->parentStyle()->i sLeftToRightDirection() ? LEFT : RIGHT); 1141 styleResolver->style()->setTextAlign(styleResolver->parentStyle()->i sLeftToRightDirection() ? LEFT : RIGHT);
1140 else if (styleResolver->parentStyle()->textAlign() == TAEND) 1142 else if (styleResolver->parentStyle()->textAlign() == TAEND)
1141 styleResolver->style()->setTextAlign(styleResolver->parentStyle()->i sLeftToRightDirection() ? RIGHT : LEFT); 1143 styleResolver->style()->setTextAlign(styleResolver->parentStyle()->i sLeftToRightDirection() ? RIGHT : LEFT);
1142 else 1144 else
1143 styleResolver->style()->setTextAlign(styleResolver->parentStyle()->t extAlign()); 1145 styleResolver->style()->setTextAlign(styleResolver->parentStyle()->t extAlign());
1144 } 1146 }
1145 static PropertyHandler createHandler() 1147 static PropertyHandler createHandler()
1146 { 1148 {
(...skipping 21 matching lines...) Expand all
1168 }; 1170 };
1169 1171
1170 class ApplyPropertyMarqueeSpeed { 1172 class ApplyPropertyMarqueeSpeed {
1171 public: 1173 public:
1172 static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue * value) 1174 static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue * value)
1173 { 1175 {
1174 if (!value->isPrimitiveValue()) 1176 if (!value->isPrimitiveValue())
1175 return; 1177 return;
1176 1178
1177 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); 1179 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
1178 if (int ident = primitiveValue->getIdent()) { 1180 if (CSSValueID valueID = primitiveValue->getValueID()) {
1179 switch (ident) { 1181 switch (valueID) {
1180 case CSSValueSlow: 1182 case CSSValueSlow:
1181 styleResolver->style()->setMarqueeSpeed(500); // 500 msec. 1183 styleResolver->style()->setMarqueeSpeed(500); // 500 msec.
1182 break; 1184 break;
1183 case CSSValueNormal: 1185 case CSSValueNormal:
1184 styleResolver->style()->setMarqueeSpeed(85); // 85msec. The WinI E default. 1186 styleResolver->style()->setMarqueeSpeed(85); // 85msec. The WinI E default.
1185 break; 1187 break;
1186 case CSSValueFast: 1188 case CSSValueFast:
1187 styleResolver->style()->setMarqueeSpeed(10); // 10msec. Super fa st. 1189 styleResolver->style()->setMarqueeSpeed(10); // 10msec. Super fa st.
1188 break; 1190 break;
1191 default:
1192 break;
1189 } 1193 }
1190 } else if (primitiveValue->isTime()) 1194 } else if (primitiveValue->isTime())
1191 styleResolver->style()->setMarqueeSpeed(primitiveValue->computeTime< int, CSSPrimitiveValue::Milliseconds>()); 1195 styleResolver->style()->setMarqueeSpeed(primitiveValue->computeTime< int, CSSPrimitiveValue::Milliseconds>());
1192 else if (primitiveValue->isNumber()) // For scrollamount support. 1196 else if (primitiveValue->isNumber()) // For scrollamount support.
1193 styleResolver->style()->setMarqueeSpeed(primitiveValue->getIntValue( )); 1197 styleResolver->style()->setMarqueeSpeed(primitiveValue->getIntValue( ));
1194 } 1198 }
1195 static PropertyHandler createHandler() 1199 static PropertyHandler createHandler()
1196 { 1200 {
1197 PropertyHandler handler = ApplyPropertyDefault<int, &RenderStyle::marque eSpeed, int, &RenderStyle::setMarqueeSpeed, int, &RenderStyle::initialMarqueeSpe ed>::createHandler(); 1201 PropertyHandler handler = ApplyPropertyDefault<int, &RenderStyle::marque eSpeed, int, &RenderStyle::setMarqueeSpeed, int, &RenderStyle::initialMarqueeSpe ed>::createHandler();
1198 return PropertyHandler(handler.inheritFunction(), handler.initialFunctio n(), &applyValue); 1202 return PropertyHandler(handler.inheritFunction(), handler.initialFunctio n(), &applyValue);
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
1230 class ApplyPropertyLineHeight { 1234 class ApplyPropertyLineHeight {
1231 public: 1235 public:
1232 static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue * value) 1236 static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue * value)
1233 { 1237 {
1234 if (!value->isPrimitiveValue()) 1238 if (!value->isPrimitiveValue())
1235 return; 1239 return;
1236 1240
1237 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); 1241 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
1238 Length lineHeight; 1242 Length lineHeight;
1239 1243
1240 if (primitiveValue->getIdent() == CSSValueNormal) 1244 if (primitiveValue->getValueID() == CSSValueNormal)
1241 lineHeight = RenderStyle::initialLineHeight(); 1245 lineHeight = RenderStyle::initialLineHeight();
1242 else if (primitiveValue->isLength()) { 1246 else if (primitiveValue->isLength()) {
1243 double multiplier = styleResolver->style()->effectiveZoom(); 1247 double multiplier = styleResolver->style()->effectiveZoom();
1244 if (Frame* frame = styleResolver->document()->frame()) 1248 if (Frame* frame = styleResolver->document()->frame())
1245 multiplier *= frame->textZoomFactor(); 1249 multiplier *= frame->textZoomFactor();
1246 lineHeight = primitiveValue->computeLength<Length>(styleResolver->st yle(), styleResolver->rootElementStyle(), multiplier); 1250 lineHeight = primitiveValue->computeLength<Length>(styleResolver->st yle(), styleResolver->rootElementStyle(), multiplier);
1247 } else if (primitiveValue->isPercentage()) { 1251 } else if (primitiveValue->isPercentage()) {
1248 // FIXME: percentage should not be restricted to an integer here. 1252 // FIXME: percentage should not be restricted to an integer here.
1249 lineHeight = Length((styleResolver->style()->fontSize() * primitiveV alue->getIntValue()) / 100, Fixed); 1253 lineHeight = Length((styleResolver->style()->fontSize() * primitiveV alue->getIntValue()) / 100, Fixed);
1250 } else if (primitiveValue->isNumber()) { 1254 } else if (primitiveValue->isNumber()) {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
1282 DEFINE_STATIC_LOCAL(Length, letterWidth, (inchLength(8.5))); 1286 DEFINE_STATIC_LOCAL(Length, letterWidth, (inchLength(8.5)));
1283 DEFINE_STATIC_LOCAL(Length, letterHeight, (inchLength(11))); 1287 DEFINE_STATIC_LOCAL(Length, letterHeight, (inchLength(11)));
1284 DEFINE_STATIC_LOCAL(Length, legalWidth, (inchLength(8.5))); 1288 DEFINE_STATIC_LOCAL(Length, legalWidth, (inchLength(8.5)));
1285 DEFINE_STATIC_LOCAL(Length, legalHeight, (inchLength(14))); 1289 DEFINE_STATIC_LOCAL(Length, legalHeight, (inchLength(14)));
1286 DEFINE_STATIC_LOCAL(Length, ledgerWidth, (inchLength(11))); 1290 DEFINE_STATIC_LOCAL(Length, ledgerWidth, (inchLength(11)));
1287 DEFINE_STATIC_LOCAL(Length, ledgerHeight, (inchLength(17))); 1291 DEFINE_STATIC_LOCAL(Length, ledgerHeight, (inchLength(17)));
1288 1292
1289 if (!pageSizeName) 1293 if (!pageSizeName)
1290 return false; 1294 return false;
1291 1295
1292 switch (pageSizeName->getIdent()) { 1296 switch (pageSizeName->getValueID()) {
1293 case CSSValueA5: 1297 case CSSValueA5:
1294 width = a5Width; 1298 width = a5Width;
1295 height = a5Height; 1299 height = a5Height;
1296 break; 1300 break;
1297 case CSSValueA4: 1301 case CSSValueA4:
1298 width = a4Width; 1302 width = a4Width;
1299 height = a4Height; 1303 height = a4Height;
1300 break; 1304 break;
1301 case CSSValueA3: 1305 case CSSValueA3:
1302 width = a3Width; 1306 width = a3Width;
(...skipping 17 matching lines...) Expand all
1320 break; 1324 break;
1321 case CSSValueLedger: 1325 case CSSValueLedger:
1322 width = ledgerWidth; 1326 width = ledgerWidth;
1323 height = ledgerHeight; 1327 height = ledgerHeight;
1324 break; 1328 break;
1325 default: 1329 default:
1326 return false; 1330 return false;
1327 } 1331 }
1328 1332
1329 if (pageOrientation) { 1333 if (pageOrientation) {
1330 switch (pageOrientation->getIdent()) { 1334 switch (pageOrientation->getValueID()) {
1331 case CSSValueLandscape: 1335 case CSSValueLandscape:
1332 std::swap(width, height); 1336 std::swap(width, height);
1333 break; 1337 break;
1334 case CSSValuePortrait: 1338 case CSSValuePortrait:
1335 // Nothing to do. 1339 // Nothing to do.
1336 break; 1340 break;
1337 default: 1341 default:
1338 return false; 1342 return false;
1339 } 1343 }
1340 } 1344 }
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
1375 case 1: { 1379 case 1: {
1376 // <length> | auto | <page-size> | [ portrait | landscape] 1380 // <length> | auto | <page-size> | [ portrait | landscape]
1377 if (!inspector.first()->isPrimitiveValue()) 1381 if (!inspector.first()->isPrimitiveValue())
1378 return; 1382 return;
1379 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(inspector.fi rst()); 1383 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(inspector.fi rst());
1380 if (primitiveValue->isLength()) { 1384 if (primitiveValue->isLength()) {
1381 // <length> 1385 // <length>
1382 pageSizeType = PAGE_SIZE_RESOLVED; 1386 pageSizeType = PAGE_SIZE_RESOLVED;
1383 width = height = primitiveValue->computeLength<Length>(styleReso lver->style(), styleResolver->rootElementStyle()); 1387 width = height = primitiveValue->computeLength<Length>(styleReso lver->style(), styleResolver->rootElementStyle());
1384 } else { 1388 } else {
1385 switch (primitiveValue->getIdent()) { 1389 switch (primitiveValue->getValueID()) {
1386 case 0: 1390 case 0:
1387 return; 1391 return;
1388 case CSSValueAuto: 1392 case CSSValueAuto:
1389 pageSizeType = PAGE_SIZE_AUTO; 1393 pageSizeType = PAGE_SIZE_AUTO;
1390 break; 1394 break;
1391 case CSSValuePortrait: 1395 case CSSValuePortrait:
1392 pageSizeType = PAGE_SIZE_AUTO_PORTRAIT; 1396 pageSizeType = PAGE_SIZE_AUTO_PORTRAIT;
1393 break; 1397 break;
1394 case CSSValueLandscape: 1398 case CSSValueLandscape:
1395 pageSizeType = PAGE_SIZE_AUTO_LANDSCAPE; 1399 pageSizeType = PAGE_SIZE_AUTO_LANDSCAPE;
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
1434 CSSValueList* list = toCSSValueList(value); 1438 CSSValueList* list = toCSSValueList(value);
1435 ASSERT(list->length() == 2); 1439 ASSERT(list->length() == 2);
1436 if (list->length() != 2) 1440 if (list->length() != 2)
1437 return; 1441 return;
1438 for (unsigned i = 0; i < 2; ++i) { 1442 for (unsigned i = 0; i < 2; ++i) {
1439 CSSValue* item = list->itemWithoutBoundsCheck(i); 1443 CSSValue* item = list->itemWithoutBoundsCheck(i);
1440 if (!item->isPrimitiveValue()) 1444 if (!item->isPrimitiveValue())
1441 continue; 1445 continue;
1442 1446
1443 CSSPrimitiveValue* value = toCSSPrimitiveValue(item); 1447 CSSPrimitiveValue* value = toCSSPrimitiveValue(item);
1444 if (value->getIdent() == CSSValueFilled || value->getIdent() == CSSValueOpen) 1448 if (value->getValueID() == CSSValueFilled || value->getValueID() == CSSValueOpen)
1445 styleResolver->style()->setTextEmphasisFill(*value); 1449 styleResolver->style()->setTextEmphasisFill(*value);
1446 else 1450 else
1447 styleResolver->style()->setTextEmphasisMark(*value); 1451 styleResolver->style()->setTextEmphasisMark(*value);
1448 } 1452 }
1449 styleResolver->style()->setTextEmphasisCustomMark(nullAtom); 1453 styleResolver->style()->setTextEmphasisCustomMark(nullAtom);
1450 return; 1454 return;
1451 } 1455 }
1452 1456
1453 if (!value->isPrimitiveValue()) 1457 if (!value->isPrimitiveValue())
1454 return; 1458 return;
1455 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); 1459 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
1456 1460
1457 if (primitiveValue->isString()) { 1461 if (primitiveValue->isString()) {
1458 styleResolver->style()->setTextEmphasisFill(TextEmphasisFillFilled); 1462 styleResolver->style()->setTextEmphasisFill(TextEmphasisFillFilled);
1459 styleResolver->style()->setTextEmphasisMark(TextEmphasisMarkCustom); 1463 styleResolver->style()->setTextEmphasisMark(TextEmphasisMarkCustom);
1460 styleResolver->style()->setTextEmphasisCustomMark(primitiveValue->ge tStringValue()); 1464 styleResolver->style()->setTextEmphasisCustomMark(primitiveValue->ge tStringValue());
1461 return; 1465 return;
1462 } 1466 }
1463 1467
1464 styleResolver->style()->setTextEmphasisCustomMark(nullAtom); 1468 styleResolver->style()->setTextEmphasisCustomMark(nullAtom);
1465 1469
1466 if (primitiveValue->getIdent() == CSSValueFilled || primitiveValue->getI dent() == CSSValueOpen) { 1470 if (primitiveValue->getValueID() == CSSValueFilled || primitiveValue->ge tValueID() == CSSValueOpen) {
1467 styleResolver->style()->setTextEmphasisFill(*primitiveValue); 1471 styleResolver->style()->setTextEmphasisFill(*primitiveValue);
1468 styleResolver->style()->setTextEmphasisMark(TextEmphasisMarkAuto); 1472 styleResolver->style()->setTextEmphasisMark(TextEmphasisMarkAuto);
1469 } else { 1473 } else {
1470 styleResolver->style()->setTextEmphasisFill(TextEmphasisFillFilled); 1474 styleResolver->style()->setTextEmphasisFill(TextEmphasisFillFilled);
1471 styleResolver->style()->setTextEmphasisMark(*primitiveValue); 1475 styleResolver->style()->setTextEmphasisMark(*primitiveValue);
1472 } 1476 }
1473 } 1477 }
1474 1478
1475 static PropertyHandler createHandler() { return PropertyHandler(&applyInheri tValue, &applyInitialValue, &applyValue); } 1479 static PropertyHandler createHandler() { return PropertyHandler(&applyInheri tValue, &applyInitialValue, &applyValue); }
1476 }; 1480 };
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
1577 class ApplyPropertyResize { 1581 class ApplyPropertyResize {
1578 public: 1582 public:
1579 static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue * value) 1583 static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue * value)
1580 { 1584 {
1581 if (!value->isPrimitiveValue()) 1585 if (!value->isPrimitiveValue())
1582 return; 1586 return;
1583 1587
1584 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); 1588 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
1585 1589
1586 EResize r = RESIZE_NONE; 1590 EResize r = RESIZE_NONE;
1587 switch (primitiveValue->getIdent()) { 1591 switch (primitiveValue->getValueID()) {
1588 case 0: 1592 case 0:
1589 return; 1593 return;
1590 case CSSValueAuto: 1594 case CSSValueAuto:
1591 if (Settings* settings = styleResolver->document()->settings()) 1595 if (Settings* settings = styleResolver->document()->settings())
1592 r = settings->textAreasAreResizable() ? RESIZE_BOTH : RESIZE_NON E; 1596 r = settings->textAreasAreResizable() ? RESIZE_BOTH : RESIZE_NON E;
1593 break; 1597 break;
1594 default: 1598 default:
1595 r = *primitiveValue; 1599 r = *primitiveValue;
1596 } 1600 }
1597 styleResolver->style()->setResize(r); 1601 styleResolver->style()->setResize(r);
1598 } 1602 }
1599 1603
1600 static PropertyHandler createHandler() 1604 static PropertyHandler createHandler()
1601 { 1605 {
1602 PropertyHandler handler = ApplyPropertyDefaultBase<EResize, &RenderStyle ::resize, EResize, &RenderStyle::setResize, EResize, &RenderStyle::initialResize >::createHandler(); 1606 PropertyHandler handler = ApplyPropertyDefaultBase<EResize, &RenderStyle ::resize, EResize, &RenderStyle::setResize, EResize, &RenderStyle::initialResize >::createHandler();
1603 return PropertyHandler(handler.inheritFunction(), handler.initialFunctio n(), &applyValue); 1607 return PropertyHandler(handler.inheritFunction(), handler.initialFunctio n(), &applyValue);
1604 } 1608 }
1605 }; 1609 };
1606 1610
1607 class ApplyPropertyVerticalAlign { 1611 class ApplyPropertyVerticalAlign {
1608 public: 1612 public:
1609 static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue * value) 1613 static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue * value)
1610 { 1614 {
1611 if (!value->isPrimitiveValue()) 1615 if (!value->isPrimitiveValue())
1612 return; 1616 return;
1613 1617
1614 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); 1618 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
1615 1619
1616 if (primitiveValue->getIdent()) 1620 if (primitiveValue->getValueID())
1617 return styleResolver->style()->setVerticalAlign(*primitiveValue); 1621 return styleResolver->style()->setVerticalAlign(*primitiveValue);
1618 1622
1619 styleResolver->style()->setVerticalAlignLength(primitiveValue->convertTo Length<FixedIntegerConversion | PercentConversion | CalculatedConversion | Viewp ortPercentageConversion>(styleResolver->style(), styleResolver->rootElementStyle (), styleResolver->style()->effectiveZoom())); 1623 styleResolver->style()->setVerticalAlignLength(primitiveValue->convertTo Length<FixedIntegerConversion | PercentConversion | CalculatedConversion | Viewp ortPercentageConversion>(styleResolver->style(), styleResolver->rootElementStyle (), styleResolver->style()->effectiveZoom()));
1620 } 1624 }
1621 1625
1622 static PropertyHandler createHandler() 1626 static PropertyHandler createHandler()
1623 { 1627 {
1624 PropertyHandler handler = ApplyPropertyDefaultBase<EVerticalAlign, &Rend erStyle::verticalAlign, EVerticalAlign, &RenderStyle::setVerticalAlign, EVertica lAlign, &RenderStyle::initialVerticalAlign>::createHandler(); 1628 PropertyHandler handler = ApplyPropertyDefaultBase<EVerticalAlign, &Rend erStyle::verticalAlign, EVerticalAlign, &RenderStyle::setVerticalAlign, EVertica lAlign, &RenderStyle::initialVerticalAlign>::createHandler();
1625 return PropertyHandler(handler.inheritFunction(), handler.initialFunctio n(), &applyValue); 1629 return PropertyHandler(handler.inheritFunction(), handler.initialFunctio n(), &applyValue);
1626 } 1630 }
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
1704 }; 1708 };
1705 1709
1706 template <ClipPathOperation* (RenderStyle::*getterFunction)() const, void (Rende rStyle::*setterFunction)(PassRefPtr<ClipPathOperation>), ClipPathOperation* (*in itialFunction)()> 1710 template <ClipPathOperation* (RenderStyle::*getterFunction)() const, void (Rende rStyle::*setterFunction)(PassRefPtr<ClipPathOperation>), ClipPathOperation* (*in itialFunction)()>
1707 class ApplyPropertyClipPath { 1711 class ApplyPropertyClipPath {
1708 public: 1712 public:
1709 static void setValue(RenderStyle* style, PassRefPtr<ClipPathOperation> value ) { (style->*setterFunction)(value); } 1713 static void setValue(RenderStyle* style, PassRefPtr<ClipPathOperation> value ) { (style->*setterFunction)(value); }
1710 static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue * value) 1714 static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue * value)
1711 { 1715 {
1712 if (value->isPrimitiveValue()) { 1716 if (value->isPrimitiveValue()) {
1713 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); 1717 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
1714 if (primitiveValue->getIdent() == CSSValueNone) 1718 if (primitiveValue->getValueID() == CSSValueNone)
1715 setValue(styleResolver->style(), 0); 1719 setValue(styleResolver->style(), 0);
1716 else if (primitiveValue->isShape()) { 1720 else if (primitiveValue->isShape()) {
1717 setValue(styleResolver->style(), ShapeClipPathOperation::create( basicShapeForValue(styleResolver, primitiveValue->getShapeValue()))); 1721 setValue(styleResolver->style(), ShapeClipPathOperation::create( basicShapeForValue(styleResolver, primitiveValue->getShapeValue())));
1718 } else if (primitiveValue->primitiveType() == CSSPrimitiveValue::CSS _URI) { 1722 } else if (primitiveValue->primitiveType() == CSSPrimitiveValue::CSS _URI) {
1719 String cssURLValue = primitiveValue->getStringValue(); 1723 String cssURLValue = primitiveValue->getStringValue();
1720 KURL url = styleResolver->document()->completeURL(cssURLValue); 1724 KURL url = styleResolver->document()->completeURL(cssURLValue);
1721 // FIXME: It doesn't work with forward or external SVG reference s (see https://bugs.webkit.org/show_bug.cgi?id=90405) 1725 // FIXME: It doesn't work with forward or external SVG reference s (see https://bugs.webkit.org/show_bug.cgi?id=90405)
1722 setValue(styleResolver->style(), ReferenceClipPathOperation::cre ate(cssURLValue, url.fragmentIdentifier())); 1726 setValue(styleResolver->style(), ReferenceClipPathOperation::cre ate(cssURLValue, url.fragmentIdentifier()));
1723 } 1727 }
1724 } 1728 }
1725 } 1729 }
1726 static PropertyHandler createHandler() 1730 static PropertyHandler createHandler()
1727 { 1731 {
1728 PropertyHandler handler = ApplyPropertyDefaultBase<ClipPathOperation*, g etterFunction, PassRefPtr<ClipPathOperation>, setterFunction, ClipPathOperation* , initialFunction>::createHandler(); 1732 PropertyHandler handler = ApplyPropertyDefaultBase<ClipPathOperation*, g etterFunction, PassRefPtr<ClipPathOperation>, setterFunction, ClipPathOperation* , initialFunction>::createHandler();
1729 return PropertyHandler(handler.inheritFunction(), handler.initialFunctio n(), &applyValue); 1733 return PropertyHandler(handler.inheritFunction(), handler.initialFunctio n(), &applyValue);
1730 } 1734 }
1731 }; 1735 };
1732 1736
1733 template <ExclusionShapeValue* (RenderStyle::*getterFunction)() const, void (Ren derStyle::*setterFunction)(PassRefPtr<ExclusionShapeValue>), ExclusionShapeValue * (*initialFunction)()> 1737 template <ExclusionShapeValue* (RenderStyle::*getterFunction)() const, void (Ren derStyle::*setterFunction)(PassRefPtr<ExclusionShapeValue>), ExclusionShapeValue * (*initialFunction)()>
1734 class ApplyPropertyExclusionShape { 1738 class ApplyPropertyExclusionShape {
1735 public: 1739 public:
1736 static void setValue(RenderStyle* style, PassRefPtr<ExclusionShapeValue> val ue) { (style->*setterFunction)(value); } 1740 static void setValue(RenderStyle* style, PassRefPtr<ExclusionShapeValue> val ue) { (style->*setterFunction)(value); }
1737 static void applyValue(CSSPropertyID property, StyleResolver* styleResolver, CSSValue* value) 1741 static void applyValue(CSSPropertyID property, StyleResolver* styleResolver, CSSValue* value)
1738 { 1742 {
1739 if (value->isPrimitiveValue()) { 1743 if (value->isPrimitiveValue()) {
1740 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); 1744 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
1741 if (primitiveValue->getIdent() == CSSValueAuto) 1745 if (primitiveValue->getValueID() == CSSValueAuto)
1742 setValue(styleResolver->style(), 0); 1746 setValue(styleResolver->style(), 0);
1743 // FIXME Bug 102571: Layout for the value 'outside-shape' is not yet implemented 1747 // FIXME Bug 102571: Layout for the value 'outside-shape' is not yet implemented
1744 else if (primitiveValue->getIdent() == CSSValueOutsideShape) 1748 else if (primitiveValue->getValueID() == CSSValueOutsideShape)
1745 setValue(styleResolver->style(), ExclusionShapeValue::createOuts ideValue()); 1749 setValue(styleResolver->style(), ExclusionShapeValue::createOuts ideValue());
1746 else if (primitiveValue->isShape()) { 1750 else if (primitiveValue->isShape()) {
1747 RefPtr<ExclusionShapeValue> shape = ExclusionShapeValue::createS hapeValue(basicShapeForValue(styleResolver, primitiveValue->getShapeValue())); 1751 RefPtr<ExclusionShapeValue> shape = ExclusionShapeValue::createS hapeValue(basicShapeForValue(styleResolver, primitiveValue->getShapeValue()));
1748 setValue(styleResolver->style(), shape.release()); 1752 setValue(styleResolver->style(), shape.release());
1749 } 1753 }
1750 } else if (value->isImageValue()) { 1754 } else if (value->isImageValue()) {
1751 RefPtr<ExclusionShapeValue> shape = ExclusionShapeValue::createImage Value(styleResolver->styleImage(property, value)); 1755 RefPtr<ExclusionShapeValue> shape = ExclusionShapeValue::createImage Value(styleResolver->styleImage(property, value));
1752 setValue(styleResolver->style(), shape.release()); 1756 setValue(styleResolver->style(), shape.release());
1753 } 1757 }
1754 } 1758 }
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
1789 CSSValueList* valueList = toCSSValueList(value); 1793 CSSValueList* valueList = toCSSValueList(value);
1790 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(valueList->itemW ithoutBoundsCheck(0)); 1794 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(valueList->itemW ithoutBoundsCheck(0));
1791 Length lengthOrPercentageValue = primitiveValue->convertToLength<FixedIn tegerConversion | PercentConversion | CalculatedConversion | ViewportPercentageC onversion>(styleResolver->style(), styleResolver->rootElementStyle(), styleResol ver->style()->effectiveZoom()); 1795 Length lengthOrPercentageValue = primitiveValue->convertToLength<FixedIn tegerConversion | PercentConversion | CalculatedConversion | ViewportPercentageC onversion>(styleResolver->style(), styleResolver->rootElementStyle(), styleResol ver->style()->effectiveZoom());
1792 ASSERT(!lengthOrPercentageValue.isUndefined()); 1796 ASSERT(!lengthOrPercentageValue.isUndefined());
1793 styleResolver->style()->setTextIndent(lengthOrPercentageValue); 1797 styleResolver->style()->setTextIndent(lengthOrPercentageValue);
1794 1798
1795 #if ENABLE(CSS3_TEXT) 1799 #if ENABLE(CSS3_TEXT)
1796 ASSERT(valueList->length() <= 2); 1800 ASSERT(valueList->length() <= 2);
1797 CSSPrimitiveValue* eachLineValue = toCSSPrimitiveValue(valueList->item(1 )); 1801 CSSPrimitiveValue* eachLineValue = toCSSPrimitiveValue(valueList->item(1 ));
1798 if (eachLineValue) { 1802 if (eachLineValue) {
1799 ASSERT(eachLineValue->getIdent() == CSSValueWebkitEachLine); 1803 ASSERT(eachLineValue->getValueID() == CSSValueWebkitEachLine);
1800 styleResolver->style()->setTextIndentLine(TextIndentEachLine); 1804 styleResolver->style()->setTextIndentLine(TextIndentEachLine);
1801 } else 1805 } else
1802 styleResolver->style()->setTextIndentLine(TextIndentFirstLine); 1806 styleResolver->style()->setTextIndentLine(TextIndentFirstLine);
1803 #endif 1807 #endif
1804 } 1808 }
1805 1809
1806 static PropertyHandler createHandler() 1810 static PropertyHandler createHandler()
1807 { 1811 {
1808 return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyVal ue); 1812 return PropertyHandler(&applyInheritValue, &applyInitialValue, &applyVal ue);
1809 } 1813 }
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
1938 setPropertyHandler(CSSPropertyWebkitClipPath, ApplyPropertyClipPath<&RenderS tyle::clipPath, &RenderStyle::setClipPath, &RenderStyle::initialClipPath>::creat eHandler()); 1942 setPropertyHandler(CSSPropertyWebkitClipPath, ApplyPropertyClipPath<&RenderS tyle::clipPath, &RenderStyle::setClipPath, &RenderStyle::initialClipPath>::creat eHandler());
1939 setPropertyHandler(CSSPropertyWebkitShapeInside, ApplyPropertyExclusionShape <&RenderStyle::shapeInside, &RenderStyle::setShapeInside, &RenderStyle::initialS hapeInside>::createHandler()); 1943 setPropertyHandler(CSSPropertyWebkitShapeInside, ApplyPropertyExclusionShape <&RenderStyle::shapeInside, &RenderStyle::setShapeInside, &RenderStyle::initialS hapeInside>::createHandler());
1940 setPropertyHandler(CSSPropertyWebkitShapeOutside, ApplyPropertyExclusionShap e<&RenderStyle::shapeOutside, &RenderStyle::setShapeOutside, &RenderStyle::initi alShapeOutside>::createHandler()); 1944 setPropertyHandler(CSSPropertyWebkitShapeOutside, ApplyPropertyExclusionShap e<&RenderStyle::shapeOutside, &RenderStyle::setShapeOutside, &RenderStyle::initi alShapeOutside>::createHandler());
1941 setPropertyHandler(CSSPropertyWidows, ApplyPropertyAuto<short, &RenderStyle: :widows, &RenderStyle::setWidows, &RenderStyle::hasAutoWidows, &RenderStyle::set HasAutoWidows>::createHandler()); 1945 setPropertyHandler(CSSPropertyWidows, ApplyPropertyAuto<short, &RenderStyle: :widows, &RenderStyle::setWidows, &RenderStyle::hasAutoWidows, &RenderStyle::set HasAutoWidows>::createHandler());
1942 setPropertyHandler(CSSPropertyWordSpacing, ApplyPropertyComputeLength<int, & RenderStyle::wordSpacing, &RenderStyle::setWordSpacing, &RenderStyle::initialLet terWordSpacing, NormalEnabled, ThicknessDisabled, SVGZoomEnabled>::createHandler ()); 1946 setPropertyHandler(CSSPropertyWordSpacing, ApplyPropertyComputeLength<int, & RenderStyle::wordSpacing, &RenderStyle::setWordSpacing, &RenderStyle::initialLet terWordSpacing, NormalEnabled, ThicknessDisabled, SVGZoomEnabled>::createHandler ());
1943 setPropertyHandler(CSSPropertyZIndex, ApplyPropertyAuto<int, &RenderStyle::z Index, &RenderStyle::setZIndex, &RenderStyle::hasAutoZIndex, &RenderStyle::setHa sAutoZIndex>::createHandler()); 1947 setPropertyHandler(CSSPropertyZIndex, ApplyPropertyAuto<int, &RenderStyle::z Index, &RenderStyle::setZIndex, &RenderStyle::hasAutoZIndex, &RenderStyle::setHa sAutoZIndex>::createHandler());
1944 } 1948 }
1945 1949
1946 1950
1947 } 1951 }
OLDNEW
« no previous file with comments | « Source/core/css/Counter.h ('k') | Source/core/css/MediaQueryEvaluator.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698