Changeset 120119 in webkit
- Timestamp:
- Jun 12, 2012 2:08:18 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 8 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r120118 r120119 1 2012-06-12 Igor Oliveira <igor.o@sisa.samsung.com> 2 3 Apply animations and transitions for first-letter element 4 https://bugs.webkit.org/show_bug.cgi?id=85253 5 6 Reviewed by Simon Fraser. 7 8 * animations/first-letter-animation-expected.txt: Added. 9 * animations/first-letter-animation.html: Added. 10 * animations/first-letter-play-state-expected.txt: Added. 11 * animations/first-letter-play-state.html: Added. 12 * transitions/first-letter-color-transition-expected.txt: Added. 13 * transitions/first-letter-color-transition.html: Added. 14 * transitions/first-letter-transition-expected.txt: Added. 15 * transitions/first-letter-transition.html: Added. 16 1 17 2012-06-12 Kent Tamura <tkent@chromium.org> 2 18 -
trunk/Source/WebCore/ChangeLog
r120118 r120119 1 2012-06-12 Igor Oliveira <igor.o@sisa.samsung.com> 2 3 Apply animations and transitions for first-letter element 4 https://bugs.webkit.org/show_bug.cgi?id=85253 5 6 Add animations and transitions support for the first-letter 7 pseudo element. 8 Instead of calling RenderOject::node() in the animations code, 9 now we need to call RenderObject::styledGeneratingNode() because 10 pseudo elements does not have a Node associated with the 11 RenderObject. 12 13 Initial patch by Simon Fraser 14 15 Reviewed by Simon Fraser. 16 17 Tests: animations/first-letter-animation.html 18 animations/first-letter-play-state.html 19 transitions/first-letter-color-transition.html 20 transitions/first-letter-transition.html 21 22 * page/animation/AnimationBase.cpp: 23 (WebCore::AnimationBase::updateStateMachine): 24 * page/animation/AnimationController.cpp: 25 (WebCore::AnimationControllerPrivate::updateAnimations): 26 (WebCore::AnimationControllerPrivate::pauseAnimationAtTime): 27 (WebCore::AnimationControllerPrivate::pauseTransitionAtTime): 28 (WebCore::AnimationController::cancelAnimations): 29 (WebCore::AnimationController::updateAnimations): 30 * page/animation/ImplicitAnimation.cpp: 31 (WebCore::ImplicitAnimation::pauseAnimation): 32 (WebCore::ImplicitAnimation::sendTransitionEvent): 33 * page/animation/KeyframeAnimation.cpp: 34 (WebCore::KeyframeAnimation::KeyframeAnimation): 35 (WebCore::KeyframeAnimation::pauseAnimation): 36 (WebCore::KeyframeAnimation::endAnimation): 37 (WebCore::KeyframeAnimation::sendAnimationEvent): 38 * rendering/RenderBlock.cpp: 39 (WebCore::RenderBlock::updateFirstLetterStyle): 40 (WebCore::RenderBlock::createFirstLetterRenderer): 41 * rendering/RenderInline.cpp: 42 (WebCore::RenderInline::clippedOverflowRectForRepaint): 43 * rendering/RenderObject.cpp: 44 (WebCore::RenderObject::setAnimatableStyle): 45 (WebCore::RenderObject::styledGeneratingNode): 46 (WebCore): 47 * rendering/RenderObject.h: 48 (RenderObject): 49 1 50 2012-06-12 Kent Tamura <tkent@chromium.org> 2 51 -
trunk/Source/WebCore/page/animation/AnimationBase.cpp
r115581 r120119 192 192 // Trigger a render so we can start the animation 193 193 if (m_object) 194 m_compAnim->animationController()->addNodeChangeToDispatch(m_object-> node());194 m_compAnim->animationController()->addNodeChangeToDispatch(m_object->styledGeneratingNode()); 195 195 } else { 196 196 ASSERT(!paused()); … … 253 253 // Dispatch updateStyleIfNeeded so we can start the animation 254 254 if (m_object) 255 m_compAnim->animationController()->addNodeChangeToDispatch(m_object-> node());255 m_compAnim->animationController()->addNodeChangeToDispatch(m_object->styledGeneratingNode()); 256 256 } else { 257 257 // We are pausing while waiting for a start response. Cancel the animation and wait. When … … 299 299 300 300 // Fire off another style change so we can set the final value 301 m_compAnim->animationController()->addNodeChangeToDispatch(m_object-> node());301 m_compAnim->animationController()->addNodeChangeToDispatch(m_object->styledGeneratingNode()); 302 302 } 303 303 } else { -
trunk/Source/WebCore/page/animation/AnimationController.cpp
r118052 r120119 101 101 if (!timeToNextService) { 102 102 if (callSetChanged == CallSetChanged) { 103 Node* node = it->first-> node();103 Node* node = it->first->styledGeneratingNode(); 104 104 ASSERT(!node || (node->document() && !node->document()->inPageCache())); 105 105 node->setNeedsStyleRecalc(SyntheticStyleChange); … … 329 329 330 330 if (compAnim->pauseAnimationAtTime(name, t)) { 331 renderer-> node()->setNeedsStyleRecalc(SyntheticStyleChange);331 renderer->styledGeneratingNode()->setNeedsStyleRecalc(SyntheticStyleChange); 332 332 startUpdateStyleIfNeededDispatcher(); 333 333 return true; … … 347 347 348 348 if (compAnim->pauseTransitionAtTime(cssPropertyID(property), t)) { 349 renderer-> node()->setNeedsStyleRecalc(SyntheticStyleChange);349 renderer->styledGeneratingNode()->setNeedsStyleRecalc(SyntheticStyleChange); 350 350 startUpdateStyleIfNeededDispatcher(); 351 351 return true; … … 509 509 510 510 if (m_data->clear(renderer)) { 511 Node* node = renderer-> node();511 Node* node = renderer->styledGeneratingNode(); 512 512 ASSERT(!node || (node->document() && !node->document()->inPageCache())); 513 513 node->setNeedsStyleRecalc(SyntheticStyleChange); … … 534 534 // have changed, we reset the animation. We then do a blend to get new values and we return 535 535 // a new style. 536 ASSERT(renderer->node()); // FIXME: We do not animate generated content yet.537 536 538 537 RefPtr<CompositeAnimation> rendererAnimations = m_data->accessCompositeAnimation(renderer); -
trunk/Source/WebCore/page/animation/ImplicitAnimation.cpp
r115581 r120119 130 130 // Restore the original (unanimated) style 131 131 if (!paused()) 132 setNeedsStyleRecalc(m_object-> node());132 setNeedsStyleRecalc(m_object->styledGeneratingNode()); 133 133 } 134 134 … … 166 166 // Dispatch the event 167 167 RefPtr<Element> element = 0; 168 if (m_object-> node() && m_object->node()->isElementNode())169 element = static_cast<Element*>(m_object-> node());168 if (m_object->styledGeneratingNode() && m_object->styledGeneratingNode()->isElementNode()) 169 element = static_cast<Element*>(m_object->styledGeneratingNode()); 170 170 171 171 ASSERT(!element || (element->document() && !element->document()->inPageCache())); -
trunk/Source/WebCore/page/animation/KeyframeAnimation.cpp
r115581 r120119 52 52 { 53 53 // Get the keyframe RenderStyles 54 if (m_object && m_object-> node() && m_object->node()->isElementNode())55 m_object->document()->styleResolver()->keyframeStylesForAnimation(static_cast<Element*>(m_object-> node()), unanimatedStyle, m_keyframes);54 if (m_object && m_object->styledGeneratingNode() && m_object->styledGeneratingNode()->isElementNode()) 55 m_object->document()->styleResolver()->keyframeStylesForAnimation(static_cast<Element*>(m_object->styledGeneratingNode()), unanimatedStyle, m_keyframes); 56 56 57 57 // Update the m_transformFunctionListValid flag based on whether the function lists in the keyframes match. … … 256 256 // Restore the original (unanimated) style 257 257 if (!paused()) 258 setNeedsStyleRecalc(m_object-> node());258 setNeedsStyleRecalc(m_object->styledGeneratingNode()); 259 259 } 260 260 … … 270 270 // Restore the original (unanimated) style 271 271 if (!paused()) 272 setNeedsStyleRecalc(m_object-> node());272 setNeedsStyleRecalc(m_object->styledGeneratingNode()); 273 273 } 274 274 … … 315 315 // Dispatch the event 316 316 RefPtr<Element> element; 317 if (m_object-> node() && m_object->node()->isElementNode())318 element = static_cast<Element*>(m_object-> node());317 if (m_object->styledGeneratingNode() && m_object->styledGeneratingNode()->isElementNode()) 318 element = static_cast<Element*>(m_object->styledGeneratingNode()); 319 319 320 320 ASSERT(!element || (element->document() && !element->document()->inPageCache())); -
trunk/Source/WebCore/rendering/RenderBlock.cpp
r119893 r120119 6052 6052 firstLetter = newFirstLetter; 6053 6053 firstLetterContainer->addChild(firstLetter, nextSibling); 6054 } else 6055 firstLetter->setStyle(pseudoStyle); 6054 } 6055 6056 firstLetter->setAnimatableStyle(pseudoStyle); 6056 6057 6057 6058 for (RenderObject* genChild = firstLetter->firstChild(); genChild; genChild = genChild->nextSibling()) { 6058 6059 if (genChild->isText()) 6059 genChild->setStyle( pseudoStyle);6060 genChild->setStyle(firstLetter->style()); 6060 6061 } 6061 6062 } … … 6070 6071 else 6071 6072 firstLetter = new (renderArena()) RenderBlock(document()); 6072 firstLetter->setStyle(pseudoStyle); 6073 6074 RefPtr<RenderStyle> temporaryStyle = RenderStyle::create(); 6075 temporaryStyle->inheritFrom(firstLetterBlock->style()); 6076 firstLetter->setStyle(temporaryStyle); 6073 6077 firstLetterContainer->addChild(firstLetter, currentChild); 6078 6079 firstLetter->setAnimatableStyle(pseudoStyle); 6074 6080 6075 6081 RenderText* textObj = toRenderText(currentChild); … … 6119 6125 RenderTextFragment* letter = 6120 6126 new (renderArena()) RenderTextFragment(remainingText->node() ? remainingText->node() : remainingText->document(), oldText.get(), 0, length); 6121 letter->setStyle( pseudoStyle);6127 letter->setStyle(firstLetter->style()); 6122 6128 firstLetter->addChild(letter); 6123 6129 -
trunk/Source/WebCore/rendering/RenderInline.cpp
r119884 r120119 954 954 LayoutRect RenderInline::clippedOverflowRectForRepaint(RenderBoxModelObject* repaintContainer) const 955 955 { 956 // Only run-ins a re allowed in here during layout.957 ASSERT(!view() || !view()->layoutStateEnabled() || isRunIn() );956 // Only run-ins and first-letter elements are allowed in here during layout. 957 ASSERT(!view() || !view()->layoutStateEnabled() || isRunIn() || style()->styleType() == FIRST_LETTER); 958 958 959 959 if (!firstLineBoxIncludingCulling() && !continuation()) -
trunk/Source/WebCore/rendering/RenderObject.cpp
r119914 r120119 2135 2135 } 2136 2136 2137 Node* RenderObject::styledGeneratingNode() const 2138 { 2139 Node* node = generatingNode(); 2140 if (node) 2141 return node; 2142 2143 for (RenderObject* object = parent(); object; object = object->parent()) { 2144 if (Node* node = object->generatingNode()) 2145 return node; 2146 } 2147 2148 ASSERT_NOT_REACHED(); 2149 return 0; 2150 } 2151 2137 2152 RenderObject* RenderObject::rendererForRootBackground() 2138 2153 { -
trunk/Source/WebCore/rendering/RenderObject.h
r119765 r120119 564 564 Node* node() const { return isAnonymous() ? 0 : m_node; } 565 565 566 // Returns the styled node that caused the generation of this renderer. 567 // This is the same as node() except for renderers of :before and :after 566 // This is the same as node() except for renderers of :before. :after and first-letter 568 567 // pseudo elements for which their parent node is returned. 569 568 Node* generatingNode() const { return m_node == document() ? 0 : m_node; } 569 570 // Returns the styled node that caused the generation of this renderer. 571 // This is the same as node() except for anonymous renderers, for which 572 // it returns the node whose style caused the generation of this renderer. 573 // FIXME: merge with generatingNode() 574 Node* styledGeneratingNode() const; 575 570 576 void setNode(Node* node) { m_node = node; } 571 577 … … 649 655 650 656 // Called to update a style that is allowed to trigger animations. 651 // FIXME: Right now this will typically be called only when updating happens from the DOM on explicit elements.652 // We don't yet handle generated content animation such as first-letter or before/after (we'll worry about this later).653 657 void setAnimatableStyle(PassRefPtr<RenderStyle>); 654 658
Note: See TracChangeset
for help on using the changeset viewer.