Bug 1419221 - Generate target pseudo element before calling getUnanimatedComputedStyle for the pseudo element. r?birtles draft
authorHiroyuki Ikezoe <hikezoe@mozilla.com>
Tue, 21 Nov 2017 13:51:53 +0900
changeset 701051 1d177f46ed3bab2a6abbeb18c964b2ea1d74e089
parent 701050 25d280ca2022fb645f2a6a212cf634741183bcd7
child 701052 1779722f4f788d7dc466df70b77a20ac00104d7b
child 701140 aa9ba5615f8030af3474becabb0cd89694a07f77
push id90050
push userhikezoe@mozilla.com
push dateTue, 21 Nov 2017 06:28:07 +0000
reviewersbirtles
bugs1419221, 1387931, 1418867
milestone59.0a1
Bug 1419221 - Generate target pseudo element before calling getUnanimatedComputedStyle for the pseudo element. r?birtles Before this patch, 'content: ""' was applied to the ::before element after calling getUnanimatedComputedStyle() with '::before' argument so the function was called for inexistent pseudo element. Gecko generates ::before and ::after element even if the content property for the element is none (bug 1387931), so Gecko is not affected by this patch at all. Whereas Stylo has returned the parent style as the pseudo style for the inexistent pseudo, it will be fixed by bug 1418867 and a test case will be added in that bug since SimpleTest does not have todo for doesThrow(). MozReview-Commit-ID: 7uJcCrtu9ke
dom/base/test/file_domwindowutils_animation.html
--- a/dom/base/test/file_domwindowutils_animation.html
+++ b/dom/base/test/file_domwindowutils_animation.html
@@ -80,19 +80,20 @@ function test_getUnanimatedComputedStyle
         }
         checkUnanimatedComputedStyle(property, initialStyle, null,
                                      expectedInitialStyle,
                                      expectedDuringTransitionStyle,
                                      cssTransition, "CSS Transitions");
       }
 
       addStyle([cssAnimationStyle,
-                ".pseudo::before { animation: cssanimation 1s; content: ''}"]);
+                ".pseudo::before { content: '' }",
+                ".animation::before { animation: cssanimation 1s }"]);
       const pseudoAnimation = target => {
-        target.classList.add("pseudo");
+        target.classList.add("animation");
         return target.getAnimations({ subtree: true })[0];
       }
       checkUnanimatedComputedStyle(property, initialStyle, "::before",
                                    expectedInitialStyle, expectedInitialStyle,
                                    pseudoAnimation, "Animation at pseudo");
       deleteStyle();
     });
   });
@@ -126,16 +127,19 @@ function checkUnanimatedComputedStyle(pr
                                       expectedDuringAnimation,
                                       animate, animationType) {
   const div = document.createElement("div");
   document.body.appendChild(div);
 
   if (initialStyle) {
     div.style[property] = initialStyle;
   }
+  if (pseudoType) {
+    div.classList.add("pseudo");
+  }
 
   is(utils.getUnanimatedComputedStyle(div, pseudoType, property),
      expectedBeforeAnimation,
      `'${ property }' property with '${ initialStyle }' style `
      + `should be '${ expectedBeforeAnimation }' `
      + `before animating by ${ animationType }`);
 
   const animation = animate(div);