[webkit-changes] [WebKit/WebKit] a073a3: Adjust logic for positioning the filename label in...

Aditya Keerthi noreply at github.com
Mon Oct 2 15:17:25 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: a073a3d3be8b14e515b4dd28bfb1d5e22da963bb
      https://github.com/WebKit/WebKit/commit/a073a3d3be8b14e515b4dd28bfb1d5e22da963bb
  Author: Aditya Keerthi <akeerthi at apple.com>
  Date:   2023-10-02 (Mon, 02 Oct 2023)

  Changed paths:
    M Source/WebCore/rendering/RenderButton.cpp
    M Source/WebCore/rendering/RenderButton.h
    M Source/WebCore/rendering/RenderFileUploadControl.cpp

  Log Message:
  -----------
  Adjust logic for positioning the filename label in RenderFileUploadControl to use the font ascent
https://bugs.webkit.org/show_bug.cgi?id=262494
rdar://116356078

Reviewed by Alan Baradlay.

In preparation for vertical writing mode support for `RenderFileUploadControl`,
adjust the way that the filename label is positioned to use the font ascent
rather than the `baselinePosition` of the associated button.

This change is necessary since, the baseline position returns the center baseline
in vertical writing mode, making it impossible to line up the filename label
with the button text. Instead, the font ascent can be used similar to its use
to draw the button text using `TextBoxPainter`.

For now, there is no behavior change as only horizontal writing mode is supported.

* Source/WebCore/rendering/RenderButton.cpp:
* Source/WebCore/rendering/RenderButton.h:
* Source/WebCore/rendering/RenderFileUploadControl.cpp:
(WebCore::RenderFileUploadControl::paintControl):

Obtain the visual rect of the first textbox in the file upload button, move
it to the desired painting position, and adjust its position using the ascent
to ensure the text is painted at the correct location.

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




More information about the webkit-changes mailing list