Changeset 138632 in webkit


Ignore:
Timestamp:
Jan 2, 2013 12:31:44 PM (11 years ago)
Author:
esprehn@chromium.org
Message:

Transitions and animations do not apply to CSS ::before and ::after pseudo-elements
https://bugs.webkit.org/show_bug.cgi?id=92591

Reviewed by Eric Seidel.

.:

Expose Element::pseudoElement for Internals.

  • Source/autotools/symbols.filter:

Source/WebCore:

The new DOM based :before and :after pseudo elements support animations
and transitions already, but I had disabled support so we could turn them
on in a separate step. This patch just removes the checks and adds tests.

This also adds two methods to internals to allow pausing animations and
transitions on pseudo elements at predictable locations so the tests
are not flaky.

Tests: fast/css-generated-content/pseudo-animation.html

fast/css-generated-content/pseudo-transition.html

  • WebCore.exp.in:
  • page/animation/AnimationController.cpp:

(WebCore::AnimationController::updateAnimations):

  • testing/Internals.cpp:

(WebCore::Internals::pauseAnimationAtTimeOnPseudoElement):
(WebCore::Internals::pauseTransitionAtTimeOnPseudoElement):

  • testing/Internals.h:

(Internals):

  • testing/Internals.idl:

LayoutTests:

Add tests that check if animations and transitions play for pseudo
:before and :after pseudo elements.

  • fast/css-generated-content/pseudo-animation-expected.txt: Added.
  • fast/css-generated-content/pseudo-animation.html: Added.
  • fast/css-generated-content/pseudo-transition-expected.txt: Added.
  • fast/css-generated-content/pseudo-transition.html: Added.
Location:
trunk
Files:
4 added
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/ChangeLog

    r138605 r138632  
     12013-01-02  Elliott Sprehn  <esprehn@chromium.org>
     2
     3        Transitions and animations do not apply to CSS ::before and ::after pseudo-elements
     4        https://bugs.webkit.org/show_bug.cgi?id=92591
     5
     6        Reviewed by Eric Seidel.
     7
     8        Expose Element::pseudoElement for Internals.
     9
     10        * Source/autotools/symbols.filter:
     11
    1122013-01-01  KwangYong Choi  <ky0.choi@samsung.com>
    213
  • trunk/LayoutTests/ChangeLog

    r138631 r138632  
     12013-01-02  Elliott Sprehn  <esprehn@chromium.org>
     2
     3        Transitions and animations do not apply to CSS ::before and ::after pseudo-elements
     4        https://bugs.webkit.org/show_bug.cgi?id=92591
     5
     6        Reviewed by Eric Seidel.
     7
     8        Add tests that check if animations and transitions play for pseudo
     9        :before and :after pseudo elements.
     10
     11        * fast/css-generated-content/pseudo-animation-expected.txt: Added.
     12        * fast/css-generated-content/pseudo-animation.html: Added.
     13        * fast/css-generated-content/pseudo-transition-expected.txt: Added.
     14        * fast/css-generated-content/pseudo-transition.html: Added.
     15
    1162013-01-02  Chris Rogers  <crogers@google.com>
    217
  • trunk/Source/WebCore/ChangeLog

    r138631 r138632  
     12013-01-02  Elliott Sprehn  <esprehn@chromium.org>
     2
     3        Transitions and animations do not apply to CSS ::before and ::after pseudo-elements
     4        https://bugs.webkit.org/show_bug.cgi?id=92591
     5
     6        Reviewed by Eric Seidel.
     7
     8        The new DOM based :before and :after pseudo elements support animations
     9        and transitions already, but I had disabled support so we could turn them
     10        on in a separate step. This patch just removes the checks and adds tests.
     11
     12        This also adds two methods to internals to allow pausing animations and
     13        transitions on pseudo elements at predictable locations so the tests
     14        are not flaky.
     15
     16        Tests: fast/css-generated-content/pseudo-animation.html
     17               fast/css-generated-content/pseudo-transition.html
     18
     19        * WebCore.exp.in:
     20        * page/animation/AnimationController.cpp:
     21        (WebCore::AnimationController::updateAnimations):
     22        * testing/Internals.cpp:
     23        (WebCore::Internals::pauseAnimationAtTimeOnPseudoElement):
     24        (WebCore::Internals::pauseTransitionAtTimeOnPseudoElement):
     25        * testing/Internals.h:
     26        (Internals):
     27        * testing/Internals.idl:
     28
    1292013-01-02  Chris Rogers  <crogers@google.com>
    230
  • trunk/Source/WebCore/WebCore.exp.in

    r138553 r138632  
    893893__ZN7WebCore7Element9innerTextEv
    894894__ZN7WebCore7Element9setPseudoERKN3WTF12AtomicStringE
     895__ZNK7WebCore7Element13pseudoElementENS_8PseudoIdE
    895896__ZN7WebCore7IntRect5scaleEf
    896897__ZN7WebCore7IntRect5uniteERKS0_
  • trunk/Source/WebCore/page/animation/AnimationController.cpp

    r137243 r138632  
    511511        return newStyle;
    512512
    513     // FIXME: We do not animate generated content yet.
    514     if (renderer->isPseudoElement())
    515         return newStyle;
    516 
    517513    RenderStyle* oldStyle = renderer->style();
    518514
     
    528524    // have changed, we reset the animation.  We then do a blend to get new values and we return
    529525    // a new style.
    530     ASSERT(renderer->node() && !renderer->isPseudoElement()); // FIXME: We do not animate generated content yet.
     526
     527    // We don't support anonymous pseudo elements like :first-line or :first-letter.
     528    ASSERT(renderer->node());
    531529
    532530    RefPtr<CompositeAnimation> rendererAnimations = m_data->accessCompositeAnimation(renderer);
  • trunk/Source/WebCore/testing/Internals.cpp

    r137939 r138632  
    6969#include "Page.h"
    7070#include "PrintContext.h"
     71#include "PseudoElement.h"
    7172#include "Range.h"
    7273#include "RenderObject.h"
     
    386387    ASSERT_NOT_REACHED();
    387388    return false;
     389}
     390
     391bool Internals::pauseAnimationAtTimeOnPseudoElement(const String& animationName, double pauseTime, Element* element, const String& pseudoId, ExceptionCode& ec)
     392{
     393    if (!element || pauseTime < 0) {
     394        ec = INVALID_ACCESS_ERR;
     395        return false;
     396    }
     397
     398    if (pseudoId != "before" && pseudoId != "after") {
     399        ec = INVALID_ACCESS_ERR;
     400        return false;
     401    }
     402
     403    PseudoElement* pseudoElement = element->pseudoElement(pseudoId == "before" ? BEFORE : AFTER);
     404    if (!pseudoElement) {
     405        ec = INVALID_ACCESS_ERR;
     406        return false;
     407    }
     408
     409    return frame()->animation()->pauseAnimationAtTime(pseudoElement->renderer(), animationName, pauseTime);
     410}
     411
     412bool Internals::pauseTransitionAtTimeOnPseudoElement(const String& property, double pauseTime, Element* element, const String& pseudoId, ExceptionCode& ec)
     413{
     414    if (!element || pauseTime < 0) {
     415        ec = INVALID_ACCESS_ERR;
     416        return false;
     417    }
     418
     419    if (pseudoId != "before" && pseudoId != "after") {
     420        ec = INVALID_ACCESS_ERR;
     421        return false;
     422    }
     423
     424    PseudoElement* pseudoElement = element->pseudoElement(pseudoId == "before" ? BEFORE : AFTER);
     425    if (!pseudoElement) {
     426        ec = INVALID_ACCESS_ERR;
     427        return false;
     428    }
     429
     430    return frame()->animation()->pauseTransitionAtTime(pseudoElement->renderer(), property, pauseTime);
    388431}
    389432
  • trunk/Source/WebCore/testing/Internals.h

    r137939 r138632  
    9595    void setShadowPseudoId(Element*, const String&, ExceptionCode&);
    9696
     97    bool pauseAnimationAtTimeOnPseudoElement(const String& animationName, double pauseTime, Element*, const String& pseudoId, ExceptionCode&);
     98    bool pauseTransitionAtTimeOnPseudoElement(const String& property, double pauseTime, Element*, const String& pseudoId, ExceptionCode&);
     99
    97100    PassRefPtr<Element> createContentElement(Document*, ExceptionCode&);
    98101    bool isValidContentSelect(Element* insertionPoint, ExceptionCode&);
  • trunk/Source/WebCore/testing/Internals.idl

    r137939 r138632  
    6666    boolean hasSelectorForPseudoClassInShadow(in Element host, in DOMString pseudoClass) raises (DOMException);
    6767
     68    boolean pauseAnimationAtTimeOnPseudoElement(in DOMString animationName, in double pauseTime, in Element element, in DOMString pseudoId) raises (DOMException);
     69    boolean pauseTransitionAtTimeOnPseudoElement(in DOMString property, in double pauseTime, in Element element, in DOMString pseudoId) raises (DOMException);
     70
    6871    Node nextSiblingByWalker(in Node node) raises(DOMException);
    6972    Node firstChildByWalker(in Node node) raises(DOMException);
  • trunk/Source/autotools/symbols.filter

    r138404 r138632  
    125125_ZN7WebCore7Element20removeShadowRootListEv;
    126126_ZN7WebCore7Element9setPseudoERKN3WTF12AtomicStringE;
     127_ZNK7WebCore7Element13pseudoElementENS_8PseudoIdE;
    127128_ZN7WebCore7jsArrayEPN3JSC9ExecStateEPNS_17JSDOMGlobalObjectEN3WTF10PassRefPtrINS_13DOMStringListEEE;
    128129_ZN7WebCore7toRangeEN3JSC7JSValueE;
     
    158159_ZN7WebCore19AnimationController17suspendAnimationsEv;
    159160_ZN7WebCore19AnimationController16resumeAnimationsEv;
     161_ZN7WebCore19AnimationController20pauseAnimationAtTimeEPNS_12RenderObjectERKN3WTF6StringEd;
     162_ZN7WebCore19AnimationController21pauseTransitionAtTimeEPNS_12RenderObjectERKN3WTF6StringEd;
    160163_ZN7WebCore19InspectorController18setProfilerEnabledEb;
    161164_ZN7WebCore19InspectorController15profilerEnabledEv;
Note: See TracChangeset for help on using the changeset viewer.