Bug 113985 - Kerned text blocks that are only spaces get word-spacing double-counted
Summary: Kerned text blocks that are only spaces get word-spacing double-counted
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Text (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Vicki Pfau
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-04-04 18:09 PDT by Vicki Pfau
Modified: 2022-10-26 04:06 PDT (History)
12 users (show)

See Also:


Attachments
Repro (841 bytes, text/html)
2013-04-04 18:09 PDT, Vicki Pfau
no flags Details
Patch (3.96 KB, patch)
2013-04-04 19:07 PDT, Vicki Pfau
ggaren: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Vicki Pfau 2013-04-04 18:09:16 PDT
Created attachment 196563 [details]
Repro

When an inline text block contains only whitespace, the word-spacing around the whitespace will get double-counted in some cases. A repro is attached.
Comment 1 Vicki Pfau 2013-04-04 19:07:01 PDT
Created attachment 196566 [details]
Patch
Comment 2 Geoffrey Garen 2013-04-10 08:34:00 PDT
I tried to review this, but I didn't know why wordMeasurement.startOffset was an appropriate test for ruling out a word that was only a single space character. Perhaps this would be obvious to a text expert. Otherwise, you should probably explain it in your ChangeLog.
Comment 3 Vicki Pfau 2013-04-10 12:38:47 PDT
(In reply to comment #2)
> I tried to review this, but I didn't know why wordMeasurement.startOffset was an appropriate test for ruling out a word that was only a single space character. Perhaps this would be obvious to a text expert. Otherwise, you should probably explain it in your ChangeLog.

Since we determine in that conditional that the wordLength is 1, if the start of the word is 0 and the character is a space, we can guarantee that the space is the only thing in that text run. Although you're right that that isn't obvious, and I should perhaps leave a comment.
Comment 4 Geoffrey Garen 2013-04-10 17:13:19 PDT
Comment on attachment 196566 [details]
Patch

OK, I get it.

r=me
Comment 5 Ahmad Saleem 2022-10-26 04:05:40 PDT
It seems this r+ patch didn't landed while checking on Webkit GitHub with bug ID and this is current line of code, which this patch was trying to modify:

https://github.com/WebKit/WebKit/blob/89d57a6f366a8abe5d012e38f160f81388b46429/Source/WebCore/rendering/LegacyLineLayout.cpp#L506

Test Case from Patch - https://jsfiddle.net/u0rc1z2t/show