[Webkit-unassigned] [Bug 147868] Selects should scale when rendering while zoomed

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Aug 11 11:54:01 PDT 2015


--- Comment #5 from Wenson Hsieh <wenson_hsieh at apple.com> ---
Comment on attachment 258715
  --> https://bugs.webkit.org/attachment.cgi?id=258715

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

>> Source/WebCore/ChangeLog:3
>> +        Selects should scale when rendering while zoomed.
> Nit: Please remove the period at the end of this line so as to match the title of the Bugzilla bug.

Oops -- nice catch!

>> Source/WebCore/rendering/RenderThemeMac.mm:951
>> +    float deviceScaleFactor = renderer.document().page() ? renderer.document().page()->deviceScaleFactor() : 1.0f;
> Can you elaborate on a case where this function is called and renderer.document().page() returns nullptr? I mean both the old code and new code assume renderer.document().page() is non-null after drawing the cell (well, the new code actually never calls renderer.document().page()->focusController().setFocusedElementNeedsRepaint() after drawing the cell per my remark below).
> 1.0f => 1.0 (by <http://www.webkit.org/coding/coding-style.html#float-suffixes> since it is unnecessary to explicitly force floating point given the context).

Good point. We assume the page is non-null here, so I'm just being unnecessarily cautious. I'll take out these null checks.

>> Source/WebCore/rendering/RenderThemeMac.mm:954
>> +    if (ThemeMac::drawCellOrFocusRingWithViewIntoContext(popupButton, paintInfo.context, inflatedRect, view, true, shouldDrawFocusRing, shouldUseImageBuffer, deviceScaleFactor) && shouldDrawFocusRing)
> I do not understand the purpose of the conjunct shouldDrawButtonCell. I mean, the condition of this if-statement will always evaluate to false because drawCellFocusRing(), called by ThemeMac::drawCellOrFocusRingWithViewIntoContext(), is hardcoded to return false (why?). Regardless, it should ThemeMac::drawCellOrFocusRingWithViewIntoContext() that tells the caller whether to the repaint
> On another note, it is unclear from looking at this line what is the purpose of the fifth argument to drawCellOrFocusRingWithViewIntoContext() without looking at its prototype. I suggest we define a local variable called shouldDrawButtonCell defined to be true and pass this variable as the fifth argument.

Even though the if statement will always return false in this situation, when we implement animated focus rings in the future, we'll be able to just tweak drawCellOrFocusRingWithViewIntoContext to return true if a repaint is required, and this code should handle animations correctly. We had the same situation in the old button rendering code from before I started the refactoring, so I decided to maintain this behavior.

>> Source/WebCore/rendering/RenderThemeMac.mm:955
>> +        renderer.document().page()->focusController().setFocusedElementNeedsRepaint();
> We repeatedly make use of the value of renderer.document().page(). Although the compiler is likely smart enough, I suggest that we cache the return value of renderer.document().page() in a local variable and make us of this local variable.

Good point. Will do.

You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.webkit.org/pipermail/webkit-unassigned/attachments/20150811/06fe6e5c/attachment.html>

More information about the webkit-unassigned mailing list