Bug 158818

Summary: <attachment> elements jump around a lot around when subtitle text changes slightly
Product: WebKit Reporter: Tim Horton <thorton>
Component: New BugsAssignee: Tim Horton <thorton>
Status: RESOLVED FIXED    
Severity: Normal CC: andersca, commit-queue, enrica, esprehn+autocc, glenn, kondapallykalyan, simon.fraser
Priority: P2    
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
simon.fraser: review+, buildbot: commit-queue-
Archive of layout-test-results from ews122 for ios-simulator-wk2 none

Description Tim Horton 2016-06-15 16:22:49 PDT
<attachment> elements jump around a lot around when subtitle text changes slightly
Comment 1 Tim Horton 2016-06-15 16:24:50 PDT
Created attachment 281402 [details]
Patch
Comment 2 Tim Horton 2016-06-15 16:25:15 PDT
<rdar://problem/24450270>
Comment 3 Simon Fraser (smfr) 2016-06-15 16:34:48 PDT
Comment on attachment 281402 [details]
Patch

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

> Source/WebCore/rendering/RenderThemeMac.mm:2603
> +    context.translate(FloatSize((paintRect.width() - attachmentIconBackgroundSize) / 2, 0));

You probably want to round down to avoid putting drawing on half-pixel boundaries. Or pixel snap.
Comment 4 Build Bot 2016-06-15 17:30:34 PDT
Comment on attachment 281402 [details]
Patch

Attachment 281402 [details] did not pass ios-sim-ews (ios-simulator-wk2):
Output: http://webkit-queues.webkit.org/results/1509668

New failing tests:
fast/attachment/attachment-subtitle-resize.html
Comment 5 Build Bot 2016-06-15 17:30:37 PDT
Created attachment 281412 [details]
Archive of layout-test-results from ews122 for ios-simulator-wk2

The attached test failures were seen while running run-webkit-tests on the ios-sim-ews.
Bot: ews122  Port: ios-simulator-wk2  Platform: Mac OS X 10.11.4
Comment 6 Darin Adler 2016-06-15 18:02:59 PDT
Comment on attachment 281402 [details]
Patch

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

> Source/WebCore/rendering/RenderAttachment.h:54
> +    LayoutUnit m_minimumIntrinsicWidth;

Does anything ever need to reset this to zero?
Comment 7 Tim Horton 2016-06-15 18:11:33 PDT
(In reply to comment #6)
> Comment on attachment 281402 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=281402&action=review
> 
> > Source/WebCore/rendering/RenderAttachment.h:54
> > +    LayoutUnit m_minimumIntrinsicWidth;
> 
> Does anything ever need to reset this to zero?

I haven't yet come up with a good way to know that it's OK to shrink, so for now any particular attachment will always only grow. Given the currently limited use case of <attachment> this is likely OK, but if we want it to be more generally useful we'll probably have to come up with something (reset it on a deferrable timer? just give up on intrinsic sizing and give it a fixed width? something smarter?).
Comment 8 Tim Horton 2016-06-15 18:14:20 PDT
http://trac.webkit.org/changeset/202117