Changeset 91242 in webkit


Ignore:
Timestamp:
Jul 19, 2011 1:12:46 AM (13 years ago)
Author:
Nikolas Zimmermann
Message:

2011-07-19 Nikolas Zimmermann <nzimmermann@rim.com>

REGRESSION (r88913): Preview in Safari's snippet editor has a fixed height instead of filling the entire pane
https://bugs.webkit.org/show_bug.cgi?id=64059

REGRESSION (r88913): <object> has wrong computed height
https://bugs.webkit.org/show_bug.cgi?id=62769

Reviewed by Rob Buis.

Add new layout test in fast/css covering both bugs.
Update svg/zoom/page results (this is a progression, but the test itself remains broken, see comment inline).

  • fast/css/replaced-element-implicit-size.html: Added.
  • platform/mac/fast/css/replaced-element-implicit-size-expected.png: Added.
  • platform/mac/fast/css/replaced-element-implicit-size-expected.txt: Added.
  • platform/mac/svg/zoom/page/zoom-svg-through-object-with-text-expected.png:
  • platform/mac/svg/zoom/page/zoom-svg-through-object-with-text-expected.txt:

2011-07-19 Nikolas Zimmermann <nzimmermann@rim.com>

REGRESSION (r88913): Preview in Safari's snippet editor has a fixed height instead of filling the entire pane
https://bugs.webkit.org/show_bug.cgi?id=64059

REGRESSION (r88913): <object> has wrong computed height
https://bugs.webkit.org/show_bug.cgi?id=62769

Reviewed by Rob Buis.

Fix misinterpretation of CSS 2.1 - "10.5 Content height: the 'height' property".
It says "If the height of the containing block is not specified explicitelz (i.e. it depends on the
content height), and this element is not absolutely positioned, the value computes to 'auto'".

Checking whether the containing block height depends on the content height is not equal to checking
whether the height property is set on the containing block, there are other ways to implicitly specify
the height by setting top & bottom. Fix that by checking whether the containing block has a height
property or top & bottom set.

While I was at it, make computeReplacedLogicalWidth/Height a bit more explicit to make it easier to compare
the code with the spec quoatations - this doesn't change the functionality only the readability.


Test: fast/css/replaced-element-implicit-size.html

  • rendering/RenderReplaced.cpp: (WebCore::RenderReplaced::computeReplacedLogicalWidth): Cleanup comment, make code more explicit. (WebCore::RenderReplaced::logicalHeightIsAuto): Add helper method used by computeReplacedLogicalHeight. (WebCore::RenderReplaced::computeReplacedLogicalHeight): Fix height=auto detection.
  • rendering/RenderReplaced.h:
Location:
trunk
Files:
3 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r91238 r91242  
     12011-07-19  Nikolas Zimmermann  <nzimmermann@rim.com>
     2
     3        REGRESSION (r88913): Preview in Safari's snippet editor has a fixed height instead of filling the entire pane
     4        https://bugs.webkit.org/show_bug.cgi?id=64059
     5
     6        REGRESSION (r88913): <object> has wrong computed height
     7        https://bugs.webkit.org/show_bug.cgi?id=62769
     8
     9        Reviewed by Rob Buis.
     10
     11        Add new layout test in fast/css covering both bugs.
     12        Update svg/zoom/page results (this is a progression, but the test itself remains broken, see comment inline).
     13
     14        * fast/css/replaced-element-implicit-size.html: Added.
     15        * platform/mac/fast/css/replaced-element-implicit-size-expected.png: Added.
     16        * platform/mac/fast/css/replaced-element-implicit-size-expected.txt: Added.
     17        * platform/mac/svg/zoom/page/zoom-svg-through-object-with-text-expected.png:
     18        * platform/mac/svg/zoom/page/zoom-svg-through-object-with-text-expected.txt:
     19
    1202011-07-18  Ryosuke Niwa  <rniwa@webkit.org>
    221
  • trunk/LayoutTests/platform/mac/svg/zoom/page/zoom-svg-through-object-with-text-expected.txt

    r87526 r91242  
    88          RenderView at (0,0) size 59x13
    99        layer at (0,0) size 59x13
    10           RenderSVGRoot {svg} at (0,0) size 59x13
    11             RenderSVGPath {rect} at (0,0) size 59x13 [fill={[type=SOLID] [color=#008000]}] [x=0.00] [y=0.00] [width=59.00] [height=13.00]
    12             RenderSVGPath {circle} at (25,2) size 9x9 [fill={[type=SOLID] [color=#0000FF]}] [cx=29.50] [cy=6.50] [r=4.27]
    13             RenderSVGText {text} at (5,2) size 29x18 contains 1 chunk(s)
    14               RenderSVGInlineText {#text} at (0,0) size 29x18
    15                 chunk 1 text run 1 at (5.00,16.00) startOffset 0 endOffset 4 width 29.00: "Text"
     10          RenderSVGRoot {svg} at (0,0) size 49x13
     11            RenderSVGPath {rect} at (0,0) size 49x12 [fill={[type=SOLID] [color=#008000]}] [x=0.00] [y=0.00] [width=59.00] [height=13.00]
     12            RenderSVGPath {circle} at (20,1) size 9x9 [fill={[type=SOLID] [color=#0000FF]}] [cx=29.50] [cy=6.50] [r=4.27]
     13            RenderSVGText {text} at (5,1) size 31x19 contains 1 chunk(s)
     14              RenderSVGInlineText {#text} at (0,0) size 31x19
     15                chunk 1 text run 1 at (5.00,16.00) startOffset 0 endOffset 4 width 30.24: "Text"
    1616      RenderText {#text} at (0,0) size 0x0
    1717      RenderText {#text} at (0,0) size 0x0
  • trunk/Source/WebCore/ChangeLog

    r91237 r91242  
     12011-07-19  Nikolas Zimmermann  <nzimmermann@rim.com>
     2
     3        REGRESSION (r88913): Preview in Safari's snippet editor has a fixed height instead of filling the entire pane
     4        https://bugs.webkit.org/show_bug.cgi?id=64059
     5
     6        REGRESSION (r88913): <object> has wrong computed height
     7        https://bugs.webkit.org/show_bug.cgi?id=62769
     8
     9        Reviewed by Rob Buis.
     10
     11        Fix misinterpretation of CSS 2.1 - "10.5 Content height: the 'height' property".
     12        It says "If the height of the containing block is not specified explicitelz (i.e. it depends on the
     13        content height), and this element is not absolutely positioned, the value computes to 'auto'".
     14
     15        Checking whether the containing block height depends on the content height is not equal to checking
     16        whether the height property is set on the containing block, there are other ways to implicitly specify
     17        the height by setting top & bottom. Fix that by checking whether the containing block has a height
     18        property or top & bottom set.
     19
     20        While I was at it, make computeReplacedLogicalWidth/Height a bit more explicit to make it easier to compare
     21        the code with the spec quoatations - this doesn't change the functionality only the readability.
     22       
     23        Test: fast/css/replaced-element-implicit-size.html
     24
     25        * rendering/RenderReplaced.cpp:
     26        (WebCore::RenderReplaced::computeReplacedLogicalWidth): Cleanup comment, make code more explicit.
     27        (WebCore::RenderReplaced::logicalHeightIsAuto): Add helper method used by computeReplacedLogicalHeight.
     28        (WebCore::RenderReplaced::computeReplacedLogicalHeight): Fix height=auto detection.
     29        * rendering/RenderReplaced.h:
     30
    1312011-07-18  Ryosuke Niwa  <rniwa@webkit.org>
    232
  • trunk/Source/WebCore/rendering/RenderReplaced.cpp

    r90833 r91242  
    298298        if (hasIntrinsicWidth)
    299299            return computeIntrinsicLogicalWidth(contentRenderer, includeMaxWidth);
    300     }
    301 
    302     // Otherwise, if 'width' has a computed value of 'auto', but none of the conditions above are met, then the used value of 'width' becomes 300px. If 300px is too
    303     // wide to fit the device, UAs should use the width of the largest rectangle that has a 2:1 ratio and fits the device instead.
     300
     301        // Otherwise, if 'width' has a computed value of 'auto', but none of the conditions above are met, then the used value of 'width' becomes 300px. If 300px is too
     302        // wide to fit the device, UAs should use the width of the largest rectangle that has a 2:1 ratio and fits the device instead.
     303        return computeReplacedLogicalWidthRespectingMinMaxWidth(cDefaultWidth, includeMaxWidth);
     304    }
     305
    304306    return computeReplacedLogicalWidthRespectingMinMaxWidth(intrinsicLogicalWidth(), includeMaxWidth);
    305307}
    306308
     309bool RenderReplaced::logicalHeightIsAuto() const
     310{
     311    Length logicalHeightLength = style()->logicalHeight();
     312    if (logicalHeightLength.isAuto())
     313        return true;
     314   
     315    // For percentage heights: The percentage is calculated with respect to the height of the generated box's
     316    // containing block. If the height of the containing block is not specified explicitly (i.e., it depends
     317    // on content height), and this element is not absolutely positioned, the value computes to 'auto'.
     318    if (!logicalHeightLength.isPercent() || isPositioned() || document()->inQuirksMode())
     319        return false;
     320
     321    for (RenderBlock* cb = containingBlock(); !cb->isRenderView(); cb = cb->containingBlock()) {
     322        if (cb->isTableCell() || (!cb->style()->logicalHeight().isAuto() || (!cb->style()->top().isAuto() && !cb->style()->bottom().isAuto())))
     323            return false;
     324    }
     325
     326    return true;
     327}
     328
    307329LayoutUnit RenderReplaced::computeReplacedLogicalHeight() const
    308330{
    309331    // 10.5 Content height: the 'height' property: http://www.w3.org/TR/CSS21/visudet.html#propdef-height
    310     // If the height of the containing block is not specified explicitly (i.e., it depends on
    311     // content height), and this element is not absolutely positioned, the value computes to 'auto'.
    312     bool heightIsAuto = style()->logicalHeight().isAuto();
    313     if (!document()->inQuirksMode() && !isPositioned() && style()->logicalHeight().isPercent()) {
    314         if (RenderObject* containingBlock = this->containingBlock()) {
    315             while (containingBlock->isAnonymous())
    316                 containingBlock = containingBlock->containingBlock();
    317             heightIsAuto = !containingBlock->style()->logicalHeight().isSpecified();
    318         }
    319     }
    320 
     332    bool heightIsAuto = logicalHeightIsAuto();
    321333    if (style()->logicalHeight().isSpecified() && !heightIsAuto)
    322334        return computeReplacedLogicalHeightRespectingMinMaxHeight(computeReplacedLogicalHeightUsing(style()->logicalHeight()));
     
    351363        if (hasIntrinsicHeight)
    352364            return computeIntrinsicLogicalHeight(contentRenderer);
    353     }
    354 
    355     // Otherwise, if 'height' has a computed value of 'auto', but none of the conditions above are met, then the used value of 'height' must be set to the height
    356     // of the largest rectangle that has a 2:1 ratio, has a height not greater than 150px, and has a width not greater than the device width.
     365
     366        // Otherwise, if 'height' has a computed value of 'auto', but none of the conditions above are met, then the used value of 'height' must be set to the height
     367        // of the largest rectangle that has a 2:1 ratio, has a height not greater than 150px, and has a width not greater than the device width.
     368        return computeReplacedLogicalHeightRespectingMinMaxHeight(cDefaultHeight);
     369    }
     370
    357371    return computeReplacedLogicalHeightRespectingMinMaxHeight(intrinsicLogicalHeight());
    358372}
  • trunk/Source/WebCore/rendering/RenderReplaced.h

    r90675 r91242  
    6363    int computeIntrinsicLogicalWidth(RenderBox* contentRenderer, bool includeMaxWidth) const;
    6464    int computeIntrinsicLogicalHeight(RenderBox* contentRenderer) const;
     65    bool logicalHeightIsAuto() const;
    6566
    6667    virtual const char* renderName() const { return "RenderReplaced"; }
Note: See TracChangeset for help on using the changeset viewer.