Title: [292323] branches/safari-613-branch
Revision
292323
Author
[email protected]
Date
2022-04-04 14:54:49 -0700 (Mon, 04 Apr 2022)

Log Message

Cherry-pick r288669. rdar://91259284

    Avoid setting and clearing :active state when dispatching synthetic click events when possible
    https://bugs.webkit.org/show_bug.cgi?id=235672
    <rdar://problem/88095418>

    Reviewed by Simon Fraser.

    Source/WebCore:

    Simulated click events are dispatched with two options:

    whether to send associated events mouseover, mouseup, mousedown
    whether to repaint the target element with its pressed look
    We currently always set the element's :active state just after when we'd
    send the mousedown event, and clear it just after that.

    When we dispatch a simulated click event with neither of the above
    options set, there's no way to observe the temporary :active state on
    the element. We can skip it in that case.

    We need to continue clearing clearing the :active state regardless,
    because some callers have already set :active and are relying on
    simulateClick to clear it.

    This patch is a 0.3-0.4% improvement on Speedometer 2.

    dom/SimulatedClick.cpp:
    (WebCore::simulateClick):

    LayoutTests:

    platform/gtk/inspector/timeline/line-column-expected.txt:

Modified Paths

Diff

Modified: branches/safari-613-branch/LayoutTests/platform/gtk/inspector/timeline/line-column-expected.txt (292322 => 292323)


--- branches/safari-613-branch/LayoutTests/platform/gtk/inspector/timeline/line-column-expected.txt	2022-04-04 21:54:46 UTC (rev 292322)
+++ branches/safari-613-branch/LayoutTests/platform/gtk/inspector/timeline/line-column-expected.txt	2022-04-04 21:54:49 UTC (rev 292323)
@@ -8,50 +8,7 @@
 PASS: Capturing started.
 {
   "startTime": "<filtered>",
-  "stackTrace": [
-    {
-      "functionName": "click",
-      "url": "[native code]",
-      "scriptId": "<filtered>",
-      "lineNumber": 0,
-      "columnNumber": 0
-    },
-    {
-      "functionName": "willCallFunctionTest",
-      "url": "timeline/line-column.html",
-      "scriptId": "<filtered>",
-      "lineNumber": 26,
-      "columnNumber": 44
-    },
-    {
-      "functionName": "global code",
-      "url": "",
-      "scriptId": "<filtered>",
-      "lineNumber": 1,
-      "columnNumber": 21
-    },
-    {
-      "functionName": "evaluateWithScopeExtension",
-      "url": "[native code]",
-      "scriptId": "<filtered>",
-      "lineNumber": 0,
-      "columnNumber": 0
-    },
-    {
-      "functionName": "",
-      "url": "",
-      "scriptId": "<filtered>",
-      "lineNumber": 142,
-      "columnNumber": 97
-    }
-  ],
-  "data": {},
   "frameId": "<filtered>",
-  "type": "ScheduleStyleRecalculation"
-}
-{
-  "startTime": "<filtered>",
-  "frameId": "<filtered>",
   "data": {
     "type": "click",
     "defaultPrevented": false

Modified: branches/safari-613-branch/Source/WebCore/dom/SimulatedClick.cpp (292322 => 292323)


--- branches/safari-613-branch/Source/WebCore/dom/SimulatedClick.cpp	2022-04-04 21:54:46 UTC (rev 292322)
+++ branches/safari-613-branch/Source/WebCore/dom/SimulatedClick.cpp	2022-04-04 21:54:49 UTC (rev 292323)
@@ -95,7 +95,8 @@
 
     if (mouseEventOptions != SendNoEvents)
         simulateMouseEvent(eventNames().mousedownEvent, element, underlyingEvent, creationOptions);
-    element.setActive(true, visualOptions == ShowPressedLook);
+    if (mouseEventOptions != SendNoEvents || visualOptions == ShowPressedLook)
+        element.setActive(true, true);
     if (mouseEventOptions != SendNoEvents)
         simulateMouseEvent(eventNames().mouseupEvent, element, underlyingEvent, creationOptions);
     element.setActive(false);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to