Changeset 53168 in webkit


Ignore:
Timestamp:
Jan 12, 2010 3:39:16 PM (14 years ago)
Author:
bweinstein@apple.com
Message:

Safari shows an unneeded horizontal scrollbar on many websites.
Fixes <rdar://6321041> and <http://webkit.org/b/33555>.

Reviewed by Dave Hyatt.

WebCore:

If a div has no children, and its height or width are 0, we can ignore
it in our calculation of lowest, rightmost, and leftmost positions. This
calculation was causing horizontal scrollbars to be drawn when they weren't needed.

Test: fast/block/positioning/absolute-positioning-no-scrollbar.html

  • rendering/RenderBlock.cpp:

(WebCore::RenderBlock::lowestPosition): Added check for no children and width or height 0.
(WebCore::RenderBlock::rightmostPosition): Ditto.
(WebCore::RenderBlock::leftmostPosition): Ditto.

LayoutTests:

Added a test that shows no scrollbar in the case where a div has no children
and either a width or height of 0. Also updated results for a few tests which
this patch causes progressions for.

  • fast/block/positioning/absolute-positioning-no-scrollbar-expected.txt: Added.
  • fast/block/positioning/absolute-positioning-no-scrollbar.html: Added.
  • fast/block/positioning/fixed-positioning-scrollbar-bug.html:
  • platform/mac/fast/backgrounds/repeat/negative-offset-repeat-transformed-expected.txt:
  • platform/mac/fast/block/positioning/fixed-positioning-scrollbar-bug-expected.txt:
Location:
trunk
Files:
2 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r53166 r53168  
     12010-01-12  Brian Weinstein  <bweinstein@apple.com>
     2
     3        Reviewed by Dave Hyatt.
     4
     5        Safari shows an unneeded horizontal scrollbar on many websites.
     6        Fixes <rdar://6321041> and <http://webkit.org/b/33555>.
     7       
     8        Added a test that shows no scrollbar in the case where a div has no children
     9        and either a width or height of 0. Also updated results for a few tests which
     10        this patch causes progressions for.
     11
     12        * fast/block/positioning/absolute-positioning-no-scrollbar-expected.txt: Added.
     13        * fast/block/positioning/absolute-positioning-no-scrollbar.html: Added.
     14        * fast/block/positioning/fixed-positioning-scrollbar-bug.html:
     15        * platform/mac/fast/backgrounds/repeat/negative-offset-repeat-transformed-expected.txt:
     16        * platform/mac/fast/block/positioning/fixed-positioning-scrollbar-bug-expected.txt:
     17
    1182010-01-12  Beth Dakin  <bdakin@apple.com>
    219
  • trunk/LayoutTests/fast/block/positioning/fixed-positioning-scrollbar-bug.html

    r42334 r53168  
    88        document.body.offsetTop;    // Force layout now.
    99    </script>
    10     <div style="height: 2000px; position: absolute;">
     10    <div style="height: 2000px; width: 1px; position: absolute;">
    1111    </div>
    1212    <div style="position: fixed; bottom: 0; height: 100px; width: 100px; background: purple;"></div>
  • trunk/LayoutTests/platform/mac/fast/backgrounds/repeat/negative-offset-repeat-transformed-expected.txt

    r30635 r53168  
    1 layer at (0,0) size 785x5502
     1layer at (0,0) size 785x1020
    22  RenderView at (0,0) size 785x600
    33layer at (0,0) size 785x1020
  • trunk/LayoutTests/platform/mac/fast/block/positioning/fixed-positioning-scrollbar-bug-expected.txt

    r42334 r53168  
    1313      RenderText {#text} at (0,0) size 0x0
    1414      RenderText {#text} at (0,0) size 0x0
     15layer at (8,26) size 1x2000
     16  RenderBlock (positioned) {DIV} at (8,26) size 1x2000
    1517layer at (8,500) size 100x100
    1618  RenderBlock (positioned) {DIV} at (8,500) size 100x100 [bgcolor=#800080]
  • trunk/WebCore/ChangeLog

    r53167 r53168  
     12010-01-12  Brian Weinstein  <bweinstein@apple.com>
     2
     3        Reviewed by Dave Hyatt.
     4
     5        Safari shows an unneeded horizontal scrollbar on many websites.
     6        Fixes <rdar://6321041> and <http://webkit.org/b/33555>.
     7       
     8        If a div has no children, and its height or width are 0, we can ignore
     9        it in our calculation of lowest, rightmost, and leftmost positions. This
     10        calculation was causing horizontal scrollbars to be drawn when they weren't needed.
     11
     12        Test: fast/block/positioning/absolute-positioning-no-scrollbar.html
     13
     14        * rendering/RenderBlock.cpp:
     15        (WebCore::RenderBlock::lowestPosition): Added check for no children and width or height 0.
     16        (WebCore::RenderBlock::rightmostPosition): Ditto.
     17        (WebCore::RenderBlock::leftmostPosition): Ditto.
     18
    1192010-01-12  Alexander Pavlov  <apavlov@chromium.org>
    220
  • trunk/WebCore/rendering/RenderBlock.cpp

    r52838 r53168  
    26372637    if (!includeOverflowInterior && (hasOverflowClip() || hasControlClip()))
    26382638        return bottom;
     2639
     2640    if (!firstChild() && (!width() || !height()))
     2641        return bottom;
    26392642   
    26402643    if (!hasColumns()) {
     
    27292732        return right;
    27302733
     2734    if (!firstChild() && (!width() || !height()))
     2735        return right;
     2736
    27312737    if (!hasColumns()) {
    27322738        // FIXME: Come up with a way to use the layer tree to avoid visiting all the kids.
     
    28212827   
    28222828    if (!includeOverflowInterior && (hasOverflowClip() || hasControlClip()))
     2829        return left;
     2830
     2831    if (!firstChild() && (!width() || !height()))
    28232832        return left;
    28242833
Note: See TracChangeset for help on using the changeset viewer.