Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: fdb9aa79b9b44ebdf93d3f0932752aa63a59a326
      
https://github.com/WebKit/WebKit/commit/fdb9aa79b9b44ebdf93d3f0932752aa63a59a326
  Author: Qianlang Chen <[email protected]>
  Date:   2025-04-25 (Fri, 25 Apr 2025)

  Changed paths:
    M Source/WebInspectorUI/UserInterface/Base/Main.js
    M Source/WebKit/UIProcess/Inspector/mac/WebInspectorUIProxyMac.mm

  Log Message:
  -----------
  Web Inspector: Resizing a docked Web Inspector does not follow the cursor 
smoothly
rdar://148762897
https://bugs.webkit.org/show_bug.cgi?id=292042

Reviewed by Devin Rousso.

This is a combination of two issues:

1. If the WKInspectorWKWebView has safeAreaInsets set and therefore
   _obscuredContentInsets configured, adjusting its dimensions does not
   take that into account. Assuming there is a left inset configured
   to be X and the new docked inspector width requested by the frontend
   is W, the frontend is not aware of the extra X pixels needed when
   rendering the WKInspectorWKWebView (because the frontend lives inside
   that web view), which then needs to be (W + X) pixels wide instead.

2. The setAttachedWindowHeight/Width commands in the backend take an
   `unsigned int` as the new dimension's type, but the frontend computes
   in floating point (JavaScript's Number), which always gets rounded
   down when the new dimension gets passed in and coerced to an int.
   This makes the new view just slightly smaller than required over
   the course of dragging.

* Source/WebKit/UIProcess/Inspector/mac/WebInspectorUIProxyMac.mm:
(WebKit::WebInspectorUIProxy::platformSetAttachedWindowHeight):
(WebKit::WebInspectorUIProxy::platformSetAttachedWindowWidth):
   - Fix issue #1.

* Source/WebInspectorUI/UserInterface/Base/Main.js:
   - Fix issue #2.
   - Adding the rounding on resulting dimension alone was sufficient to
     fix the "always-shrinking" bug. However, resizing still didn't feel
     completely smooth; the inspector wouldn't shrink by itself, but
     it still felt like having some lag following the moving cursor.
     I took a simpler approach to compute the delta, where we use the
     original dimension as the standard instead of the last frame,
     which turns out to be extremely smooth and exactly what we wanted.

Tested the fix manually on various inspector zoom factors from 60% to
240%, combined with or without an _obscuredContentInsets applied on the
WKInspectorWKWebView.

Canonical link: https://commits.webkit.org/294123@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to