Changeset 147350 in webkit
- Timestamp:
- Apr 1, 2013 12:49:18 PM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r147348 r147350 1 2013-04-01 Emil A Eklund <eae@chromium.org> 2 3 Move remaining marquee applying code to StyleBuilder 4 https://bugs.webkit.org/show_bug.cgi?id=113298 5 6 Reviewed by Allan Sandfeld Jensen. 7 8 Move applying logic for CSSPropertyWebkitMarqueeIncrement, 9 CSSPropertyWebkitMarqueeRepetition and CSSPropertyWebkitMarqueeSpeed 10 from StyleResolver::applyProperty. 11 12 No new tests, no change in functionality. 13 14 * css/StyleBuilder.cpp: 15 (ApplyPropertyMarqueeIncrement): 16 (WebCore::ApplyPropertyMarqueeIncrement::applyValue): 17 (WebCore::ApplyPropertyMarqueeIncrement::createHandler): 18 (WebCore): 19 (ApplyPropertyMarqueeRepetition): 20 (WebCore::ApplyPropertyMarqueeRepetition::applyValue): 21 (WebCore::ApplyPropertyMarqueeRepetition::createHandler): 22 (ApplyPropertyMarqueeSpeed): 23 (WebCore::ApplyPropertyMarqueeSpeed::applyValue): 24 (WebCore::ApplyPropertyMarqueeSpeed::createHandler): 25 (WebCore::StyleBuilder::StyleBuilder): 26 * css/StyleResolver.cpp: 27 (WebCore::StyleResolver::applyProperty): 28 Move marquee applying logic from StyleResolver to StyleBuilder. 29 30 * rendering/style/RenderStyle.h: 31 Change setMarqueeIncrement to pass Length by value instead of const 32 reference. This is consistent with other length setters and works with 33 the ApplyPropertyLength template. 34 1 35 2013-04-01 Philip Rogers <pdr@google.com> 2 36 -
trunk/Source/WebCore/css/StyleBuilder.cpp
r146408 r147350 1260 1260 { 1261 1261 PropertyHandler handler = ApplyPropertyDefaultBase<ETextDecoration, &RenderStyle::textDecoration, ETextDecoration, &RenderStyle::setTextDecoration, ETextDecoration, &RenderStyle::initialTextDecoration>::createHandler(); 1262 return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue); 1263 } 1264 }; 1265 1266 class ApplyPropertyMarqueeIncrement { 1267 public: 1268 static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value) 1269 { 1270 if (!value->isPrimitiveValue()) 1271 return; 1272 1273 CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value); 1274 if (primitiveValue->getIdent()) { 1275 switch (primitiveValue->getIdent()) { 1276 case CSSValueSmall: 1277 styleResolver->style()->setMarqueeIncrement(Length(1, Fixed)); // 1px. 1278 break; 1279 case CSSValueNormal: 1280 styleResolver->style()->setMarqueeIncrement(Length(6, Fixed)); // 6px. The WinIE default. 1281 break; 1282 case CSSValueLarge: 1283 styleResolver->style()->setMarqueeIncrement(Length(36, Fixed)); // 36px. 1284 break; 1285 } 1286 } else { 1287 Length marqueeLength = styleResolver->convertToIntLength(primitiveValue, styleResolver->style(), styleResolver->rootElementStyle()); 1288 if (!marqueeLength.isUndefined()) 1289 styleResolver->style()->setMarqueeIncrement(marqueeLength); 1290 } 1291 } 1292 static PropertyHandler createHandler() 1293 { 1294 PropertyHandler handler = ApplyPropertyLength<&RenderStyle::marqueeIncrement, &RenderStyle::setMarqueeIncrement, &RenderStyle::initialMarqueeIncrement>::createHandler(); 1295 return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue); 1296 } 1297 }; 1298 1299 class ApplyPropertyMarqueeRepetition { 1300 public: 1301 static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value) 1302 { 1303 if (!value->isPrimitiveValue()) 1304 return; 1305 1306 CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value); 1307 if (primitiveValue->getIdent() == CSSValueInfinite) 1308 styleResolver->style()->setMarqueeLoopCount(-1); // -1 means repeat forever. 1309 else if (primitiveValue->isNumber()) 1310 styleResolver->style()->setMarqueeLoopCount(primitiveValue->getIntValue()); 1311 } 1312 static PropertyHandler createHandler() 1313 { 1314 PropertyHandler handler = ApplyPropertyDefault<int, &RenderStyle::marqueeLoopCount, int, &RenderStyle::setMarqueeLoopCount, int, &RenderStyle::initialMarqueeLoopCount>::createHandler(); 1315 return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue); 1316 } 1317 }; 1318 1319 class ApplyPropertyMarqueeSpeed { 1320 public: 1321 static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value) 1322 { 1323 if (!value->isPrimitiveValue()) 1324 return; 1325 1326 CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value); 1327 if (int ident = primitiveValue->getIdent()) { 1328 switch (ident) { 1329 case CSSValueSlow: 1330 styleResolver->style()->setMarqueeSpeed(500); // 500 msec. 1331 break; 1332 case CSSValueNormal: 1333 styleResolver->style()->setMarqueeSpeed(85); // 85msec. The WinIE default. 1334 break; 1335 case CSSValueFast: 1336 styleResolver->style()->setMarqueeSpeed(10); // 10msec. Super fast. 1337 break; 1338 } 1339 } else if (primitiveValue->isTime()) 1340 styleResolver->style()->setMarqueeSpeed(primitiveValue->computeTime<int, CSSPrimitiveValue::Milliseconds>()); 1341 else if (primitiveValue->isNumber()) // For scrollamount support. 1342 styleResolver->style()->setMarqueeSpeed(primitiveValue->getIntValue()); 1343 } 1344 static PropertyHandler createHandler() 1345 { 1346 PropertyHandler handler = ApplyPropertyDefault<int, &RenderStyle::marqueeSpeed, int, &RenderStyle::setMarqueeSpeed, int, &RenderStyle::initialMarqueeSpeed>::createHandler(); 1262 1347 return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue); 1263 1348 } … … 2193 2278 setPropertyHandler(CSSPropertyWebkitMarginTopCollapse, CSSPropertyWebkitMarginBeforeCollapse); 2194 2279 setPropertyHandler(CSSPropertyWebkitMarqueeDirection, ApplyPropertyDefault<EMarqueeDirection, &RenderStyle::marqueeDirection, EMarqueeDirection, &RenderStyle::setMarqueeDirection, EMarqueeDirection, &RenderStyle::initialMarqueeDirection>::createHandler()); 2280 setPropertyHandler(CSSPropertyWebkitMarqueeIncrement, ApplyPropertyMarqueeIncrement::createHandler()); 2281 setPropertyHandler(CSSPropertyWebkitMarqueeRepetition, ApplyPropertyMarqueeRepetition::createHandler()); 2282 setPropertyHandler(CSSPropertyWebkitMarqueeSpeed, ApplyPropertyMarqueeSpeed::createHandler()); 2195 2283 setPropertyHandler(CSSPropertyWebkitMarqueeStyle, ApplyPropertyDefault<EMarqueeBehavior, &RenderStyle::marqueeBehavior, EMarqueeBehavior, &RenderStyle::setMarqueeBehavior, EMarqueeBehavior, &RenderStyle::initialMarqueeBehavior>::createHandler()); 2196 2284 setPropertyHandler(CSSPropertyWebkitMaskBoxImage, ApplyPropertyBorderImage<BorderMask, CSSPropertyWebkitMaskBoxImage, &RenderStyle::maskBoxImage, &RenderStyle::setMaskBoxImage>::createHandler()); -
trunk/Source/WebCore/css/StyleResolver.cpp
r147135 r147350 2562 2562 case CSSPropertyUnicodeRange: // Only used in @font-face rules. 2563 2563 return; 2564 case CSSPropertyWebkitMarqueeRepetition: {2565 HANDLE_INHERIT_AND_INITIAL(marqueeLoopCount, MarqueeLoopCount)2566 if (!primitiveValue)2567 return;2568 if (primitiveValue->getIdent() == CSSValueInfinite)2569 state.style()->setMarqueeLoopCount(-1); // -1 means repeat forever.2570 else if (primitiveValue->isNumber())2571 state.style()->setMarqueeLoopCount(primitiveValue->getIntValue());2572 return;2573 }2574 case CSSPropertyWebkitMarqueeSpeed: {2575 HANDLE_INHERIT_AND_INITIAL(marqueeSpeed, MarqueeSpeed)2576 if (!primitiveValue)2577 return;2578 if (int ident = primitiveValue->getIdent()) {2579 switch (ident) {2580 case CSSValueSlow:2581 state.style()->setMarqueeSpeed(500); // 500 msec.2582 break;2583 case CSSValueNormal:2584 state.style()->setMarqueeSpeed(85); // 85msec. The WinIE default.2585 break;2586 case CSSValueFast:2587 state.style()->setMarqueeSpeed(10); // 10msec. Super fast.2588 break;2589 }2590 } else if (primitiveValue->isTime())2591 state.style()->setMarqueeSpeed(primitiveValue->computeTime<int, CSSPrimitiveValue::Milliseconds>());2592 else if (primitiveValue->isNumber()) // For scrollamount support.2593 state.style()->setMarqueeSpeed(primitiveValue->getIntValue());2594 return;2595 }2596 case CSSPropertyWebkitMarqueeIncrement: {2597 HANDLE_INHERIT_AND_INITIAL(marqueeIncrement, MarqueeIncrement)2598 if (!primitiveValue)2599 return;2600 if (primitiveValue->getIdent()) {2601 switch (primitiveValue->getIdent()) {2602 case CSSValueSmall:2603 state.style()->setMarqueeIncrement(Length(1, Fixed)); // 1px.2604 break;2605 case CSSValueNormal:2606 state.style()->setMarqueeIncrement(Length(6, Fixed)); // 6px. The WinIE default.2607 break;2608 case CSSValueLarge:2609 state.style()->setMarqueeIncrement(Length(36, Fixed)); // 36px.2610 break;2611 }2612 } else {2613 Length marqueeLength = convertToIntLength(primitiveValue, state.style(), state.rootElementStyle());2614 if (!marqueeLength.isUndefined())2615 state.style()->setMarqueeIncrement(marqueeLength);2616 }2617 return;2618 }2619 2564 case CSSPropertyWebkitLocale: { 2620 2565 HANDLE_INHERIT_AND_INITIAL(locale, Locale); … … 3136 3081 case CSSPropertyWebkitLineSnap: 3137 3082 case CSSPropertyWebkitMarqueeDirection: 3083 case CSSPropertyWebkitMarqueeIncrement: 3084 case CSSPropertyWebkitMarqueeRepetition: 3085 case CSSPropertyWebkitMarqueeSpeed: 3138 3086 case CSSPropertyWebkitMarqueeStyle: 3139 3087 case CSSPropertyWebkitMaskBoxImage: -
trunk/Source/WebCore/rendering/style/RenderStyle.h
r147261 r147350 1306 1306 void setGridItemAfter(const GridPosition& afterPosition) { SET_VAR(rareNonInheritedData.access()->m_gridItem, m_gridAfter, afterPosition); } 1307 1307 1308 void setMarqueeIncrement( const Length&f) { SET_VAR(rareNonInheritedData.access()->m_marquee, increment, f); }1308 void setMarqueeIncrement(Length f) { SET_VAR(rareNonInheritedData.access()->m_marquee, increment, f); } 1309 1309 void setMarqueeSpeed(int f) { SET_VAR(rareNonInheritedData.access()->m_marquee, speed, f); } 1310 1310 void setMarqueeDirection(EMarqueeDirection d) { SET_VAR(rareNonInheritedData.access()->m_marquee, direction, d); }
Note: See TracChangeset
for help on using the changeset viewer.