Changeset 61933 in webkit
- Timestamp:
- Jun 25, 2010 7:01:29 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 5 added
- 4 deleted
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r61932 r61933 1 2010-06-25 Dean Jackson <dino@apple.com> 2 3 Reviewed by Simon Fraser. 4 5 https://bugs.webkit.org/show_bug.cgi?id=41188 6 Animations should not require 0% and 100% keyframes 7 8 * animations/keyframes-from-missing-expected.txt: Removed. 9 * animations/keyframes-from-missing.html: Removed. 10 * animations/keyframes-to-missing-expected.txt: Removed. 11 * animations/keyframes-to-missing.html: Removed. 12 * animations/missing-from-to-transforms-expected.txt: Added. 13 * animations/missing-from-to-transforms.html: Added. 14 * animations/missing-from-to-expected.txt: Added. 15 * animations/missing-from-to.html: Added. 16 1 17 2010-06-25 Csaba Osztrogonác <ossy@webkit.org> 2 18 -
trunk/WebCore/ChangeLog
r61925 r61933 1 2010-06-25 Dean Jackson <dino@apple.com> 2 3 Reviewed by Simon Fraser. 4 5 https://bugs.webkit.org/show_bug.cgi?id=41188 6 Animations should not require 0% and 100% keyframes 7 8 When we are generating the animation lists in CSSStyleSelector, 9 rather than bail if we notice that "from" or "to" are missing, we 10 now generate synthetic keyframes for those cases. 11 12 Tests: animations/missing-from-to-transforms.html 13 animations/missing-from-to.html 14 WebCore/manual-tests/animation-with-transition.html 15 16 * css/CSSStyleSelector.cpp: 17 (WebCore::CSSStyleSelector::styleForKeyframe): 18 Moved individual keyframe generation into a new function. 19 (WebCore::CSSStyleSelector::keyframeStylesForAnimation): 20 Call the new function above for regular keyframes, and 21 also check for missing keyframes and generate them if 22 necessary. 23 * css/CSSStyleSelector.h: 24 1 25 2010-06-25 Adam Barth <abarth@webkit.org> 2 26 -
trunk/WebCore/css/CSSStyleSelector.cpp
r61670 r61933 1374 1374 } 1375 1375 1376 PassRefPtr<RenderStyle> CSSStyleSelector::styleForKeyframe(const RenderStyle* elementStyle, const WebKitCSSKeyframeRule* keyframeRule, KeyframeList& list) 1377 { 1378 if (keyframeRule->style()) 1379 addMatchedDeclaration(keyframeRule->style()); 1380 1381 ASSERT(!m_style); 1382 1383 // Create the style 1384 m_style = RenderStyle::clone(elementStyle); 1385 1386 m_lineHeightValue = 0; 1387 1388 // We don't need to bother with !important. Since there is only ever one 1389 // decl, there's nothing to override. So just add the first properties. 1390 if (keyframeRule->style()) 1391 applyDeclarations<true>(false, 0, m_matchedDecls.size() - 1); 1392 1393 // If our font got dirtied, go ahead and update it now. 1394 if (m_fontDirty) 1395 updateFont(); 1396 1397 // Line-height is set when we are sure we decided on the font-size 1398 if (m_lineHeightValue) 1399 applyProperty(CSSPropertyLineHeight, m_lineHeightValue); 1400 1401 // Now do rest of the properties. 1402 if (keyframeRule->style()) 1403 applyDeclarations<false>(false, 0, m_matchedDecls.size() - 1); 1404 1405 // If our font got dirtied by one of the non-essential font props, 1406 // go ahead and update it a second time. 1407 if (m_fontDirty) 1408 updateFont(); 1409 1410 // Add all the animating properties to the list 1411 if (keyframeRule->style()) { 1412 CSSMutableStyleDeclaration::const_iterator end = keyframeRule->style()->end(); 1413 for (CSSMutableStyleDeclaration::const_iterator it = keyframeRule->style()->begin(); it != end; ++it) { 1414 int property = (*it).id(); 1415 // Timing-function within keyframes is special, because it is not animated; it just 1416 // describes the timing function between this keyframe and the next. 1417 if (property != CSSPropertyWebkitAnimationTimingFunction) 1418 list.addProperty(property); 1419 } 1420 } 1421 1422 return m_style.release(); 1423 } 1424 1376 1425 void CSSStyleSelector::keyframeStylesForAnimation(Element* e, const RenderStyle* elementStyle, KeyframeList& list) 1377 1426 { … … 1388 1437 1389 1438 const WebKitCSSKeyframesRule* rule = m_keyframesRuleMap.find(list.animationName().impl()).get()->second.get(); 1439 RefPtr<RenderStyle> keyframeStyle; 1390 1440 1391 1441 // Construct and populate the style for each keyframe … … 1395 1445 initForStyleResolve(e); 1396 1446 1397 const WebKitCSSKeyframeRule* kf = rule->item(i); 1398 addMatchedDeclaration(kf->style()); 1399 1400 ASSERT(!m_style); 1401 1402 // Create the style 1403 m_style = RenderStyle::clone(elementStyle); 1447 const WebKitCSSKeyframeRule* keyframeRule = rule->item(i); 1404 1448 1405 m_lineHeightValue = 0; 1406 1407 // We don't need to bother with !important. Since there is only ever one 1408 // decl, there's nothing to override. So just add the first properties. 1409 applyDeclarations<true>(false, 0, m_matchedDecls.size() - 1); 1410 1411 // If our font got dirtied, go ahead and update it now. 1412 if (m_fontDirty) 1413 updateFont(); 1414 1415 // Line-height is set when we are sure we decided on the font-size 1416 if (m_lineHeightValue) 1417 applyProperty(CSSPropertyLineHeight, m_lineHeightValue); 1418 1419 // Now do rest of the properties. 1420 applyDeclarations<false>(false, 0, m_matchedDecls.size() - 1); 1421 1422 // If our font got dirtied by one of the non-essential font props, 1423 // go ahead and update it a second time. 1424 if (m_fontDirty) 1425 updateFont(); 1426 1427 // Add all the animating properties to the list 1428 CSSMutableStyleDeclaration::const_iterator end = kf->style()->end(); 1429 for (CSSMutableStyleDeclaration::const_iterator it = kf->style()->begin(); it != end; ++it) { 1430 int property = (*it).id(); 1431 // Timing-function within keyframes is special, because it is not animated; it just 1432 // describes the timing function between this keyframe and the next. 1433 if (property != CSSPropertyWebkitAnimationTimingFunction) 1434 list.addProperty(property); 1435 } 1436 1449 keyframeStyle = styleForKeyframe(elementStyle, keyframeRule, list); 1450 1437 1451 // Add this keyframe style to all the indicated key times 1438 1452 Vector<float> keys; 1439 k f->getKeys(keys);1453 keyframeRule->getKeys(keys); 1440 1454 for (size_t keyIndex = 0; keyIndex < keys.size(); ++keyIndex) { 1441 1455 float key = keys[keyIndex]; 1442 list.insert(key, m_style); 1443 } 1444 m_style = 0; 1445 } 1446 1447 // Make sure there is a 0% and a 100% keyframe 1448 float first = -1; 1449 float last = -1; 1450 if (list.size() >= 2) { 1451 first = list.beginKeyframes()->key(); 1452 last = (list.endKeyframes()-1)->key(); 1453 } 1454 if (first != 0 || last != 1) 1455 list.clear(); 1456 list.insert(key, keyframeStyle.get()); 1457 } 1458 keyframeStyle.release(); 1459 } 1460 1461 // If the 0% keyframe is missing, create it (but only if there is at least one other keyframe) 1462 int initialListSize = list.size(); 1463 if (initialListSize > 0 && list.beginKeyframes()->key() != 0) { 1464 RefPtr<WebKitCSSKeyframeRule> keyframe = WebKitCSSKeyframeRule::create(); 1465 keyframe->setKeyText("0%"); 1466 keyframeStyle = styleForKeyframe(elementStyle, keyframe.get(), list); 1467 list.insert(0, keyframeStyle.release()); 1468 } 1469 1470 // If the 100% keyframe is missing, create it (but only if there is at least one other keyframe) 1471 if (initialListSize > 0 && (list.endKeyframes() - 1)->key() != 1) { 1472 RefPtr<WebKitCSSKeyframeRule> keyframe = WebKitCSSKeyframeRule::create(); 1473 keyframe->setKeyText("100%"); 1474 keyframeStyle = styleForKeyframe(elementStyle, keyframe.get(), list); 1475 list.insert(1, keyframeStyle.release()); 1476 } 1456 1477 } 1457 1478 -
trunk/WebCore/css/CSSStyleSelector.h
r61670 r61933 65 65 class StyleSheetList; 66 66 class StyledElement; 67 class WebKitCSSKeyframeRule; 67 68 class WebKitCSSKeyframesRule; 68 69 … … 111 112 112 113 RenderStyle* style() const { return m_style.get(); } 114 115 PassRefPtr<RenderStyle> styleForKeyframe(const RenderStyle*, const WebKitCSSKeyframeRule*, KeyframeList&); 113 116 114 117 public:
Note: See TracChangeset
for help on using the changeset viewer.