[PDF Ink Signatures] Add layout to WebFormControlElement::GetTextInfo() [chromium/src : main]

0 views
Skip to first unread message

Ian Kilpatrick (Gerrit)

unread,
Mar 5, 2026, 5:47:52 PM (yesterday) Mar 5
to April Kallmeyer, AyeAye, chromium...@chromium.org, blink-re...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org
Attention needed from April Kallmeyer

Ian Kilpatrick added 1 comment

File third_party/blink/renderer/core/html/forms/html_text_area_element.cc
Line 932, Patchset 3 (Latest): result[i].location.set_width(run_advance - line_advance);
Ian Kilpatrick . unresolved

what are you trying to do with the rectangle for this?

There are lots of different rectangles here, do you want the ink-bounds (bounds of what gets painted), (layout-bounds, close to cursor position), etc.

Open in Gerrit

Related details

Attention is currently required from:
  • April Kallmeyer
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Id589065601b04d2f30470d2a00a4f58621679df8
Gerrit-Change-Number: 7632866
Gerrit-PatchSet: 3
Gerrit-Owner: April Kallmeyer <a...@chromium.org>
Gerrit-CC: Ian Kilpatrick <ikilp...@chromium.org>
Gerrit-Attention: April Kallmeyer <a...@chromium.org>
Gerrit-Comment-Date: Thu, 05 Mar 2026 22:47:45 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

April Kallmeyer (Gerrit)

unread,
3:08 PM (8 hours ago) 3:08 PM
to Ian Kilpatrick, AyeAye, chromium...@chromium.org, blink-re...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org
Attention needed from Ian Kilpatrick

April Kallmeyer added 1 comment

File third_party/blink/renderer/core/html/forms/html_text_area_element.cc
Line 932, Patchset 3: result[i].location.set_width(run_advance - line_advance);
Ian Kilpatrick . unresolved

what are you trying to do with the rectangle for this?

There are lots of different rectangles here, do you want the ink-bounds (bounds of what gets painted), (layout-bounds, close to cursor position), etc.

April Kallmeyer

I want the boundaries of the run of text represented by the glyphs vector relative to the origin of the <textarea> in CSS pixels (converted from physical pixels), so that I can place the glyphs in the exact same position as blink does in the PDF.

This bit of the code contains a bug. I didn't fix it yet, but I think I confused myself about the callback adding multiple rows to the results vector and multiple text fragment items in the same line. The code worked as-is when I manually checked strings that change fonts on the same line, but broke in some test cases that manually added text fragments of the same font instead of setting the value. I have just uploaded some broken tests to show you what I mean.

Is there a way to get a rect directly without using the glyph advance data? In my previous CL this wasn't an issue because I wasn't dealing with any sub-line runs of text.

Open in Gerrit

Related details

Attention is currently required from:
  • Ian Kilpatrick
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Id589065601b04d2f30470d2a00a4f58621679df8
Gerrit-Change-Number: 7632866
Gerrit-PatchSet: 3
Gerrit-Owner: April Kallmeyer <a...@chromium.org>
Gerrit-CC: Ian Kilpatrick <ikilp...@chromium.org>
Gerrit-Attention: Ian Kilpatrick <ikilp...@chromium.org>
Gerrit-Comment-Date: Fri, 06 Mar 2026 20:08:44 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Ian Kilpatrick <ikilp...@chromium.org>
satisfied_requirement
unsatisfied_requirement
open
diffy

Ian Kilpatrick (Gerrit)

unread,
4:24 PM (7 hours ago) 4:24 PM
to April Kallmeyer, AyeAye, chromium...@chromium.org, blink-re...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org
Attention needed from April Kallmeyer

Ian Kilpatrick added 1 comment

File third_party/blink/renderer/core/html/forms/html_text_area_element.cc
Line 932, Patchset 3: result[i].location.set_width(run_advance - line_advance);
Ian Kilpatrick . unresolved

what are you trying to do with the rectangle for this?

There are lots of different rectangles here, do you want the ink-bounds (bounds of what gets painted), (layout-bounds, close to cursor position), etc.

April Kallmeyer

I want the boundaries of the run of text represented by the glyphs vector relative to the origin of the <textarea> in CSS pixels (converted from physical pixels), so that I can place the glyphs in the exact same position as blink does in the PDF.

This bit of the code contains a bug. I didn't fix it yet, but I think I confused myself about the callback adding multiple rows to the results vector and multiple text fragment items in the same line. The code worked as-is when I manually checked strings that change fonts on the same line, but broke in some test cases that manually added text fragments of the same font instead of setting the value. I have just uploaded some broken tests to show you what I mean.

Is there a way to get a rect directly without using the glyph advance data? In my previous CL this wasn't an issue because I wasn't dealing with any sub-line runs of text.

Ian Kilpatrick

I want the boundaries of the run of text represented by the glyphs vector relative to the origin of the <textarea> in CSS pixels (converted from physical pixels), so that I can place the glyphs in the exact same position as blink does in the PDF.

Ok so you likely don't need this much complexity.

I believe you want to do something similar to:
https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/platform/fonts/shaping/shape_result_bloberizer.cc;l=298-299;bpv=1;bpt=1?q=is_horizontal%20bloberizer&ss=chromium

in the callback.

Additionally you need to add to create a context object to hold the result and current offset, e.g.

```
struct {
gfx::VectorF offset;
zoom_factor; ?
std::vector<> result;
};
```

rather than just passing in the result.

The offset for the current item can be accessed via:
`rect = cursor.CurrentItem()->RectInContainerFragment();`

Then convert it to the offset you need (e.g. do you support vertical writing-modes and RTL?).

Is there a way to get a rect directly without using the glyph advance data? In my previous CL this wasn't an issue because I wasn't dealing with any sub-line runs of text.

Why do you need the rect instead of just an offset. If you are just placing glyphs then the offset should be all that you need.

You need to use the glyph advance data to do this correctly.

Open in Gerrit

Related details

Attention is currently required from:
  • April Kallmeyer
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Id589065601b04d2f30470d2a00a4f58621679df8
Gerrit-Change-Number: 7632866
Gerrit-PatchSet: 4
Gerrit-Owner: April Kallmeyer <a...@chromium.org>
Gerrit-CC: Ian Kilpatrick <ikilp...@chromium.org>
Gerrit-Attention: April Kallmeyer <a...@chromium.org>
Gerrit-Comment-Date: Fri, 06 Mar 2026 21:24:20 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: April Kallmeyer <a...@chromium.org>
Comment-In-Reply-To: Ian Kilpatrick <ikilp...@chromium.org>
satisfied_requirement
unsatisfied_requirement
open
diffy

April Kallmeyer (Gerrit)

unread,
5:01 PM (6 hours ago) 5:01 PM
to Ian Kilpatrick, AyeAye, chromium...@chromium.org, blink-re...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org
Attention needed from Ian Kilpatrick

April Kallmeyer added 1 comment

File third_party/blink/renderer/core/html/forms/html_text_area_element.cc
April Kallmeyer

I need the rectangles because when doing the coordinate transformations to place the line of text in the PDF there are axis flips and the PDF text objects refer to text by the bottom left corner while blink uses the top left corner. So I need the width and height to change the origin point.

I think I still need to use the advance info for the rectangle width because RectInContainerFragment() gives me the full width of the FragmentItem even when that FragmentItem contains multiple fonts, which I need to split into separate TextInfos because in the PDF there can only be one font per text object.

Each line of the text area (pdf text objects don't support wrapping) and each run of text with a different font needs a rectangle (a TextInfo actually).

Within the TextInfo rect I do need the offset and advance data to position the glyphs.

There are some complications with text direction when the PDF is rotated but it's currently not clear to me if I need to handle that in the callback like in your link. In general yes we're aiming to support international text.

I really appreciate your patience helping with this.

Open in Gerrit

Related details

Attention is currently required from:
  • Ian Kilpatrick
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Id589065601b04d2f30470d2a00a4f58621679df8
Gerrit-Change-Number: 7632866
Gerrit-PatchSet: 4
Gerrit-Owner: April Kallmeyer <a...@chromium.org>
Gerrit-CC: Ian Kilpatrick <ikilp...@chromium.org>
Gerrit-Attention: Ian Kilpatrick <ikilp...@chromium.org>
Gerrit-Comment-Date: Fri, 06 Mar 2026 22:01:48 +0000
satisfied_requirement
unsatisfied_requirement
open
diffy
Reply all
Reply to author
Forward
0 new messages