Bug 145393 - Subpixel rendering: Pixel crack in text selection of simple text in <textarea>.
Summary: Subpixel rendering: Pixel crack in text selection of simple text in <textarea>.
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: zalan
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2015-05-26 15:40 PDT by zalan
Modified: 2015-05-29 08:23 PDT (History)
4 users (show)

See Also:


Attachments
Patch (5.50 KB, patch)
2015-05-26 16:18 PDT, zalan
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews102 for mac-mavericks (595.42 KB, application/zip)
2015-05-26 16:40 PDT, Build Bot
no flags Details
Patch (6.25 KB, patch)
2015-05-26 18:59 PDT, zalan
no flags Details | Formatted Diff | Diff
Patch (6.18 KB, patch)
2015-05-26 19:00 PDT, zalan
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description zalan 2015-05-26 15:40:42 PDT
1. Open <https://bugs.webkit.org/enter_bug.cgi?product=WebKit>
2. Paste "Inspector doesn't do this. I have been aware of this " (with trailing space) into Desc.
3. Select the "this " at the end.

Notice the pixel crack between 'this' and ' '
Comment 1 zalan 2015-05-26 15:40:58 PDT
rdar://problem/19918941
Comment 2 zalan 2015-05-26 16:18:42 PDT
Created attachment 253755 [details]
Patch
Comment 3 Build Bot 2015-05-26 16:40:47 PDT
Comment on attachment 253755 [details]
Patch

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

New failing tests:
platform/mac/editing/input/caret-primary-bidi.html
Comment 4 Build Bot 2015-05-26 16:40:51 PDT
Created attachment 253758 [details]
Archive of layout-test-results from ews102 for mac-mavericks

The attached test failures were seen while running run-webkit-tests on the mac-ews.
Bot: ews102  Port: mac-mavericks  Platform: Mac OS X 10.9.5
Comment 5 zalan 2015-05-26 18:59:25 PDT
Created attachment 253767 [details]
Patch
Comment 6 zalan 2015-05-26 19:00:55 PDT
Created attachment 253768 [details]
Patch
Comment 7 Darin Adler 2015-05-27 12:16:37 PDT
Comment on attachment 253768 [details]
Patch

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

> Source/WebCore/ChangeLog:11
> +        Float to LayoutUnit conversion is lossy. To ensure that selection
> +        painting always lines up (snaps) properly, the calculated width needs to
> +        be adjusted by ceiling the float to the next LayoutUnit value.

What’s the default? To round instead of doing a ceil?

I find this change really mysterious. When would we need to do this? Why do we have a default conversion from float to LayoutUnit if it’s not always the right thing to do?
Comment 8 zalan 2015-05-28 16:26:24 PDT
Comment on attachment 253768 [details]
Patch

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

>> Source/WebCore/ChangeLog:11
>> +        be adjusted by ceiling the float to the next LayoutUnit value.
> 
> What’s the default? To round instead of doing a ceil?
> 
> I find this change really mysterious. When would we need to do this? Why do we have a default conversion from float to LayoutUnit if it’s not always the right thing to do?

The default behavior is explicit floor through integer arithmetics. LayoutUnit has int m_value which in case of LayoutUnit(float floatValue) becomes m_value = floatValue * 64.
I assume the reason why we ended up with truncation was because of the potential performance impact (calling ceil() vs. integer arithmetics back then) and expect a few cases, truncated values just worked fine (we are talking about 1/64 of a pixel).
::fromFloatCeil() was introduced at the very beginning of the subpixel project when WebCore became LayoutUnit aware to compensate for the lossyness in cases where we have to ensure that the converted value is never smaller than the original (container sizing for example to prevent the content from getting wrapped). This is mainly the case for inline content as text measuring is float based and while transferring (width)values to block level, we have to make sure that the float -> LayoutUnit() conversion does not result in smaller container than its content's size.
Comment 9 WebKit Commit Bot 2015-05-28 17:15:43 PDT
Comment on attachment 253768 [details]
Patch

Clearing flags on attachment: 253768

Committed r184970: <http://trac.webkit.org/changeset/184970>
Comment 10 WebKit Commit Bot 2015-05-28 17:15:55 PDT
All reviewed patches have been landed.  Closing bug.
Comment 11 Alexey Proskuryakov 2015-05-28 19:47:22 PDT
This test fails on Windows, Gtk and Efl. Could you please update the results?
Comment 12 zalan 2015-05-29 08:23:19 PDT
(In reply to comment #11)
> This test fails on Windows, Gtk and Efl. Could you please update the results?
Thanks for the headsup.
https://trac.webkit.org/changeset/184986