Bug 1367765 - Do not set the 'active' content state flag on scrollbar thumbs in ActiveElementManager. r=rhunt draft
authorBotond Ballo <botond@mozilla.com>
Wed, 06 Sep 2017 18:49:31 -0400
changeset 663397 e89fe4eefe615d3f65d2471ff59aa9d51d9ae5e2
parent 663396 94ac60bc8b38dad3d8abaa39b5a94de88ec0f6b0
child 663398 96f83e6b312dabd3c5573d73c1ce3f01e53055e5
push id79426
push userbballo@mozilla.com
push dateTue, 12 Sep 2017 23:39:18 +0000
reviewersrhunt
bugs1367765
milestone57.0a1
Bug 1367765 - Do not set the 'active' content state flag on scrollbar thumbs in ActiveElementManager. r=rhunt Unlike regular content, scrollbar thumbs use a different mechanism for triggering their 'active' style, and no one will clear this flag if ActiveElementManager sets it. MozReview-Commit-ID: AfloVYRkvQA
gfx/layers/apz/util/ActiveElementManager.cpp
--- a/gfx/layers/apz/util/ActiveElementManager.cpp
+++ b/gfx/layers/apz/util/ActiveElementManager.cpp
@@ -119,17 +119,22 @@ ActiveElementManager::HandleTouchEndEven
 {
   AEM_LOG("Touch end event, aWasClick: %d\n", aWasClick);
 
   // If the touch was a click, make mTarget :active right away.
   // nsEventStateManager will reset the active element when processing
   // the mouse-down event generated by the click.
   CancelTask();
   if (aWasClick) {
-    SetActive(mTarget);
+    // Scrollbar thumbs use a different mechanism for their active
+    // highlight (the "active" attribute), so don't set the active state
+    // on them because nothing will clear it.
+    if (!(mTarget && mTarget->IsXULElement(nsGkAtoms::thumb))) {
+      SetActive(mTarget);
+    }
   } else {
     // We might reach here if mCanBePan was false on touch-start and
     // so we set the element active right away. Now it turns out the
     // action was not a click so we need to reset the active element.
     ResetActive();
   }
 
   ResetTouchBlockState();