WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
ASSIGNED
193616
Web Inspector: Make completion popover faster by removing setInterval
https://bugs.webkit.org/show_bug.cgi?id=193616
Summary
Web Inspector: Make completion popover faster by removing setInterval
Nikita Vasilyev
Reported
2019-01-19 18:09:08 PST
CompletionSuggestionsView.prototype.hideWhenElementMoves calls getBoundingClientRect() every 0.2 seconds. getBoundingClientRect isn't terribly expensive: console.time("getBoundingClientRect"); let clientRect = element.getBoundingClientRect(); console.timeEnd("getBoundingClientRect"); It was between 0.02ms and 0.07ms when adding a new property to <body> on webkit.org. If it's possible, we should use IntersectionObserver instead.
Attachments
Add attachment
proposed patch, testcase, etc.
Nikita Vasilyev
Comment 1
2019-04-05 18:39:56 PDT
Unfortunately, I don't see how IntersectionObserver can be helpful here. "The Intersection Observer API provides a way to asynchronously observe changes in the intersection of a target element with an ancestor element" - because one element has to be an ancestor of another, I don't see how it to make it work here. --- There're libraries in the wild to detect resize events without timeouts. Perhaps it's worth investigating what they do.
http://marcj.github.io/css-element-queries/
Radar WebKit Bug Importer
Comment 2
2019-04-05 18:45:21 PDT
<
rdar://problem/49664005
>
Nikita Vasilyev
Comment 3
2019-04-05 19:00:49 PDT
The following cases need to be handled: 1. One of the parent elements scrolled. Solution: listen "scroll" on every parent. 2. One of the parent elements resized. Solution: use ResizeObserver on every parent. 3. One of the parent elements resized becomes invisible or gets detached from DOM. This happens when tab or sidebar panel changed. Solution: Mutation Observers? This is quite a lot of events and observers. I'm not sure it's worth it.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug