Bug 90104

Summary: Allow non-borders to be adjusted to less than 1 when zoomed out
Product: WebKit Reporter: Emil A Eklund <eae>
Component: Layout and RenderingAssignee: Emil A Eklund <eae>
Status: RESOLVED FIXED    
Severity: Normal CC: abarth, cmarcelo, dglazkov, eric, hyatt, macpherson, menard, webkit.review.bot, zimmermann
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Archive of layout-test-results from ec2-cq-02
none
Archive of layout-test-results from ec2-cr-linux-01
none
Patch for landing none

Description Emil A Eklund 2012-06-27 15:26:28 PDT
Due to how margins are handled for floats the width might be off by one when zoomed out. This causes problems for certain sites that use floats and hard coded widths. Most notably the New York Times website, www.nyt.com

Downstream chromium bug: http://code.google.com/p/chromium/issues/detail?id=133942
Comment 1 Emil A Eklund 2012-06-28 11:31:40 PDT
The problem seems to be that the margin never shrinks below 1 causing the width including the margin to extend past the container for zoom levels below 100%.
Comment 2 Emil A Eklund 2012-06-28 12:04:29 PDT
(In reply to comment #1)
> The problem seems to be that the margin never shrinks below 1 causing the width including the margin to extend past the container for zoom levels below 100%.

...and that logic is in CSSPrimitiveValue::computeLengthDouble:

    // Any original result that was >= 1 should not be allowed to fall below 1.  This keeps border lines from
    // vanishing.
    double zoomedResult = result * multiplier;
    if (zoomedResult < 1.0 && result >= 1.0)
        return 1.0;

This should probably only kick in for borders (which are represented as integers).
Comment 3 Emil A Eklund 2012-06-28 13:47:00 PDT
Created attachment 150003 [details]
Patch
Comment 4 Emil A Eklund 2012-06-28 14:07:22 PDT
CC:ing hyatt who added the check in http://trac.webkit.org/changeset/31219 back in the dark ages of 2008.
Comment 5 Eric Seidel (no email) 2012-06-28 14:21:27 PDT
Comment on attachment 150003 [details]
Patch

Makes sense to me.
Comment 6 WebKit Review Bot 2012-06-28 17:19:38 PDT
Comment on attachment 150003 [details]
Patch

Rejecting attachment 150003 [details] from commit-queue.

New failing tests:
svg/zoom/page/zoom-img-preserveAspectRatio-support-1.html
fast/transforms/bounding-rect-zoom.html
svg/zoom/page/zoom-replaced-intrinsic-ratio-001.htm
fast/reflections/reflection-with-zoom.html
Full output: http://queues.webkit.org/results/13109213
Comment 7 WebKit Review Bot 2012-06-28 17:19:44 PDT
Created attachment 150046 [details]
Archive of layout-test-results from ec2-cq-02

The attached test failures were seen while running run-webkit-tests on the commit-queue.
Bot: ec2-cq-02  Port: <class 'webkitpy.common.config.ports.ChromiumXVFBPort'>  Platform: Linux-2.6.35-28-virtual-x86_64-with-Ubuntu-10.10-maverick
Comment 8 WebKit Review Bot 2012-06-28 23:20:00 PDT
Comment on attachment 150003 [details]
Patch

Attachment 150003 [details] did not pass chromium-ews (chromium-xvfb):
Output: http://queues.webkit.org/results/13107333

New failing tests:
svg/zoom/page/zoom-img-preserveAspectRatio-support-1.html
fast/transforms/bounding-rect-zoom.html
svg/zoom/page/zoom-replaced-intrinsic-ratio-001.htm
fast/reflections/reflection-with-zoom.html
Comment 9 WebKit Review Bot 2012-06-28 23:20:05 PDT
Created attachment 150088 [details]
Archive of layout-test-results from ec2-cr-linux-01

The attached test failures were seen while running run-webkit-tests on the chromium-ews.
Bot: ec2-cr-linux-01  Port: <class 'webkitpy.common.config.ports.ChromiumXVFBPort'>  Platform: Linux-2.6.35-28-virtual-x86_64-with-Ubuntu-10.10-maverick
Comment 10 Emil A Eklund 2012-06-29 16:19:58 PDT
Created attachment 150269 [details]
Patch for landing
Comment 11 Emil A Eklund 2012-06-29 16:26:22 PDT
Committed r121599: <http://trac.webkit.org/changeset/121599>
Comment 12 Luke Macpherson 2012-07-01 19:04:28 PDT
Comment on attachment 150269 [details]
Patch for landing

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

> Source/WebCore/css/StyleBuilder.cpp:611
> +                length = zoomedLength;

It's worth noting that ApplyPropertyComputeLength is used by lots of CSS properties, not just borders, so you may want to reduce the number of cases where this is applied even further.