Bug 141120 - Negative text-indent with Unicode characters result in positive width
Summary: Negative text-indent with Unicode characters result in positive width
Status: RESOLVED DUPLICATE of bug 271113
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Myles C. Maxfield
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-01-31 10:37 PST by Simon Fraser (smfr)
Modified: 2024-03-17 05:47 PDT (History)
11 users (show)

See Also:


Attachments
Reduction (137 bytes, text/html)
2015-01-31 17:31 PST, Myles C. Maxfield
no flags Details
Better reduction (327 bytes, text/html)
2015-01-31 19:24 PST, Myles C. Maxfield
no flags Details
Prospective patch (4.86 KB, patch)
2015-02-01 08:29 PST, Myles C. Maxfield
buildbot: commit-queue-
Details | Formatted Diff | Diff
Archive of layout-test-results from ews105 for mac-mavericks-wk2 (766.10 KB, application/zip)
2015-02-01 09:10 PST, Build Bot
no flags Details
Archive of layout-test-results from ews101 for mac-mavericks (622.65 KB, application/zip)
2015-02-01 09:15 PST, Build Bot
no flags Details
Safari vs Other Browsers (229.67 KB, image/png)
2023-10-26 16:20 PDT, Ahmad Saleem
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Simon Fraser (smfr) 2015-01-31 10:37:17 PST
Reported against chrome here:
https://code.google.com/p/chromium/issues/detail?id=385904

Testcase
http://jsfiddle.net/boggydigital/WJxx8/
Comment 1 Myles C. Maxfield 2015-01-31 17:19:06 PST
<h1>&#x00c3;&#x00a5;&#x00e2;&#x20ac;&#x00a6;&#x00c2;&#x00ac;&#x00c3;&#x00a5;&#x00c2;&#x008f;&#x00c2;&#x00b8;&#x00c3;&#x00a4;&#x00c2;&#x00bf;&#x00c2;&#x00a1;&#x00c3;&#x00a6;&#x00c2;&#x0081;&#x00c2;&#x00af</h1>test
Comment 2 Myles C. Maxfield 2015-01-31 17:26:04 PST
layer at (0,0) size 800x600
  RenderView at (0,0) size 800x600
layer at (0,0) size 800x88
  RenderBlock {HTML} at (0,0) size 800x88
    RenderBody {BODY} at (8,8) size 784x18
      RenderBlock (floating) {H1} at (0,21) size 176x38
        RenderText {#text} at (-9999,0) size 423x37
          text run at (-9999,0) width 423: "\x{C3}\x{A5}\x{E2}\x{20AC}\x{A6}\x{C2}\x{AC}\x{C3}\x{A5}\x{C2}\x{8F}\x{C2}\x{B8}\x{C3}\x{A4}\x{C2}\x{BF}\x{C2}\x{A1}\x{C3}\x{A6}\x{C2}\x{81}\x{C2}\x{AF}"
      RenderText {#text} at (175,0) size 24x18
        text run at (175,0) width 24: "test"
Comment 3 Myles C. Maxfield 2015-01-31 17:31:11 PST
Created attachment 245810 [details]
Reduction
Comment 4 Myles C. Maxfield 2015-01-31 17:32:00 PST
The "test" is getting moved over by the width of the text before it. However, the text before it is being drawn way offscreen.
Comment 5 Myles C. Maxfield 2015-01-31 18:14:13 PST
RenderBlockFlow::logicalLeftFloatOffsetForLine() is returning different answers.
Comment 6 Myles C. Maxfield 2015-01-31 18:47:27 PST
The difference between &#xc3;&#xa5;aaaaaaaaaaaa and aaaaaaaaaaaaaa is that the first one is breakable. The minimum and maximum preferred logical widths are being updated accordingly.
Comment 7 Myles C. Maxfield 2015-01-31 19:24:05 PST
Created attachment 245813 [details]
Better reduction
Comment 8 Myles C. Maxfield 2015-01-31 19:28:10 PST
The span's apparent width (meaning: not counting the text-indent) is coming from the minimum preferred width of the text inside the span. That minimum preferred width comes from the width of the longest word, which in this case, is fairly long. In particular, it is longer than the length of the entire text plus the (negative of the) text-indent.

I believe this is working as intended. Hyatt: What do you think?
Comment 9 Myles C. Maxfield 2015-01-31 19:31:37 PST
Hrm, that doesn't explain why behavior is different if the entire float is non-breakable.
Comment 10 Myles C. Maxfield 2015-01-31 19:53:36 PST
RenderBlockFlow::computeInlinePreferredLogicalWidths() looks like it's the culprit:

if (!addedTextIndent || hasRemainingNegativeTextIndent) {
Comment 11 Myles C. Maxfield 2015-01-31 20:00:55 PST
Just below that:
if (!hasBreakableChar)
Comment 12 Myles C. Maxfield 2015-02-01 08:29:23 PST
Created attachment 245827 [details]
Prospective patch

I haven't read as much as I should of RenderText::trimmedPrefWidths() to really understand this patch, but I figured I would post it so others could take a look.
Comment 13 Build Bot 2015-02-01 09:10:22 PST
Comment on attachment 245827 [details]
Prospective patch

Attachment 245827 [details] did not pass mac-wk2-ews (mac-wk2):
Output: http://webkit-queues.appspot.com/results/5568271243804672

New failing tests:
fast/text/floating-negative-text-indent-breakable.html
Comment 14 Build Bot 2015-02-01 09:10:27 PST
Created attachment 245829 [details]
Archive of layout-test-results from ews105 for mac-mavericks-wk2

The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: ews105  Port: mac-mavericks-wk2  Platform: Mac OS X 10.9.5
Comment 15 Build Bot 2015-02-01 09:15:28 PST
Comment on attachment 245827 [details]
Prospective patch

Attachment 245827 [details] did not pass mac-ews (mac):
Output: http://webkit-queues.appspot.com/results/6742300285730816

New failing tests:
fast/text/floating-negative-text-indent-breakable.html
Comment 16 Build Bot 2015-02-01 09:15:32 PST
Created attachment 245830 [details]
Archive of layout-test-results from ews101 for mac-mavericks

The attached test failures were seen while running run-webkit-tests on the mac-ews.
Bot: ews101  Port: mac-mavericks  Platform: Mac OS X 10.9.5
Comment 17 Ahmad Saleem 2023-10-26 16:20:06 PDT
Created attachment 468363 [details]
Safari vs Other Browsers

Using 'better reduction', this is still reproducible as can be seen from attached screenshot.
Comment 18 Ahmad Saleem 2024-03-16 22:27:51 PDT
@Alan - it seems to be fixed on WebKit ToT (276246@main) while reproducible on STP90.

Recent Progressions with intrinsic width work?
Comment 19 zalan 2024-03-17 05:44:25 PDT
(In reply to Ahmad Saleem from comment #18)
> @Alan - it seems to be fixed on WebKit ToT (276246@main) while reproducible
> on STP90.
> 
> Recent Progressions with intrinsic width work?
Good catch! This is exactly what 276246@main would address.
Comment 20 zalan 2024-03-17 05:47:26 PDT
forward duping to bug 271113

*** This bug has been marked as a duplicate of bug 271113 ***