[Webkit-unassigned] [Bug 220773] [Cocoa] Web Inspector: Console search box is broken, advancing to next result instead pastes from system find pasteboard

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Jan 25 12:57:14 PST 2021


https://bugs.webkit.org/show_bug.cgi?id=220773

--- Comment #7 from Devin Rousso <drousso at apple.com> ---
Comment on attachment 418313
  --> https://bugs.webkit.org/attachment.cgi?id=418313
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=418313&action=review

>>>> Source/WebInspectorUI/UserInterface/Views/LogContentView.js:64
>>>>          this._findBanner = new WI.FindBanner(this, "console-find-banner", fixed);
>>> 
>>> Instead of modifying `showing` to have all this other logic and modification sites, can we instead save `fixed` and use it inside `set targetElement` like so
>>> ```
>>> -        this._targetElement.classList.remove(WI.FindBanner.ShowingFindBannerStyleClassName);
>>> +        this._targetElement.classList.toggle(WI.FindBanner.ShowingFindBannerStyleClassName, this._fixed);
>>> ```
>> 
>> It can work, but it still relies on checking style classes to determine the component's state.
>> 
>>  The `fixed` is not straightforward in what it implies. Rename to `alwaysShowing`?
>> 
>> Also, we'd need to update either the element checked in the `showing` getter from this.element to this._targetElement (and change the class name) 
>> 
>> 
>> ```
>>     get showing()
>>     {
>> -        return this.element.classList.contains(WI.FindBanner.ShowingStyleClassName);
>> +        return this._targetElement.classList.contains(WI.FindBanner.ShowingFindBannerStyleClassName);
>>     }
>> ```
>> 
>> Or toggle the appropriate class on the other element in the `targetElement` setter.
>> 
>> 
>> ```
>> if (this._targetElement)
>>             this._targetElement.classList.add(WI.FindBanner.SupportsFindBannerStyleClassName);
>> 
>> +   this.element.classList.toggle(WI.FindBanner.ShowingStyleClassName, this._fixed);
>> ```
>> 
>> Any preference?
> 
> It can work, but it still relies on checking style classes to determine the component's state.
> 
>  The `fixed` is not straightforward in what it implies. Rename to `alwaysShowing`?
> 
> Also, we'd need to update either the element checked in the `showing` getter from this.element to this._targetElement (and change the class name) 
> 
> 
> ```
>     get showing()
>     {
> -        return this.element.classList.contains(WI.FindBanner.ShowingStyleClassName);
> +        return this._targetElement.classList.contains(WI.FindBanner.ShowingFindBannerStyleClassName);
>     }
> ```
> 
> Or toggle the appropriate class on the other element in the `targetElement` setter.
> 
> 
> ```
> if (this._targetElement)
>             this._targetElement.classList.add(WI.FindBanner.SupportsFindBannerStyleClassName);
> 
> +   this.element.classList.toggle(WI.FindBanner.ShowingStyleClassName, this._fixed);
> ```
> 
> Any preference?

Oh oops sorry copypasted the wrong code ��.  Yeah it should use `this.element` and `WI.FindBanner.ShowingStyleClassName` (but still in `set targetElement()`).  Also, you'd probably want to prevent `WI.FindBanner.ShowingStyleClassName` from being removed in `hide()` if `this._alwaysShowing`.

Renaming to `alwaysShowing` sounds fine.  

I agree that keeping state in the DOM is not ideal, but I personally prefer keeping patches small and focused so as to make scanning `git log` more useful and make rollouts less problematic.  As such, I'd rather fix the issue as described in this bug and then have a separate bug to "move `WI.FindBanner` state out of the DOM".

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20210125/20fd47a6/attachment-0001.htm>


More information about the webkit-unassigned mailing list