Changeset 87779 in webkit


Ignore:
Timestamp:
Jun 1, 2011 12:30:10 AM (13 years ago)
Author:
Nikolas Zimmermann
Message:

2011-06-01 Nikolas Zimmermann <nzimmermann@rim.com>

Reviewed by Rob Buis.

SVG fails all 3 of Hixie's CSS intrinsic sizing tests
https://bugs.webkit.org/show_bug.cgi?id=15473

Hixies CSS intrinsic sizing tests cover percentage sizes specified on the target SVG document as width/height attributes
and using width: auto / height: auto on the <object> that hosts the SVG document. Take percentage sizes of the outermost
SVGs width/height attributes into account when determining the intrinsic size of the <object>.

Added several other testcases demonstrating several scenarios. All tests work exactly the same in WebKit and Firefox now.
The *on-target-svg-absolute.xhtml tests look equal to WebKit/FF but Opera fails them, likely a relict of the different
interpretation of the intrinsic size of a SVG document in SVG Tiny 1.2.

  • platform/mac/svg/custom/object-sizing-height-50p-on-target-svg-absolute-expected.png: Added.
  • platform/mac/svg/custom/object-sizing-height-50p-on-target-svg-absolute-expected.txt: Added.
  • platform/mac/svg/custom/object-sizing-height-50p-on-target-svg-expected.png: Added.
  • platform/mac/svg/custom/object-sizing-height-50p-on-target-svg-expected.txt: Added.
  • platform/mac/svg/custom/object-sizing-width-50p-height-50p-on-target-svg-absolute-expected.png: Added.
  • platform/mac/svg/custom/object-sizing-width-50p-height-50p-on-target-svg-absolute-expected.txt: Added.
  • platform/mac/svg/custom/object-sizing-width-50p-height-50p-on-target-svg-expected.png: Added.
  • platform/mac/svg/custom/object-sizing-width-50p-height-50p-on-target-svg-expected.txt: Added.
  • platform/mac/svg/custom/object-sizing-width-50p-height-75p-on-target-svg-absolute-expected.png: Added.
  • platform/mac/svg/custom/object-sizing-width-50p-height-75p-on-target-svg-absolute-expected.txt: Added.
  • platform/mac/svg/custom/object-sizing-width-50p-height-75p-on-target-svg-expected.png: Added.
  • platform/mac/svg/custom/object-sizing-width-50p-height-75p-on-target-svg-expected.txt: Added.
  • platform/mac/svg/custom/object-sizing-width-50p-on-target-svg-absolute-expected.png: Added.
  • platform/mac/svg/custom/object-sizing-width-50p-on-target-svg-absolute-expected.txt: Added.
  • platform/mac/svg/custom/object-sizing-width-50p-on-target-svg-expected.png: Added.
  • platform/mac/svg/custom/object-sizing-width-50p-on-target-svg-expected.txt: Added.
  • platform/mac/svg/custom/object-sizing-width-75p-height-50p-on-target-svg-absolute-expected.png: Added.
  • platform/mac/svg/custom/object-sizing-width-75p-height-50p-on-target-svg-absolute-expected.txt: Added.
  • platform/mac/svg/custom/object-sizing-width-75p-height-50p-on-target-svg-expected.png: Added.
  • platform/mac/svg/custom/object-sizing-width-75p-height-50p-on-target-svg-expected.txt: Added.
  • platform/mac/svg/hixie/intrinsic: Added.
  • platform/mac/svg/hixie/intrinsic/001-expected.png: Added.
  • platform/mac/svg/hixie/intrinsic/001-expected.txt: Added.
  • platform/mac/svg/hixie/intrinsic/002-expected.png: Added.
  • platform/mac/svg/hixie/intrinsic/002-expected.txt: Added.
  • platform/mac/svg/hixie/intrinsic/003-expected.png: Added.
  • platform/mac/svg/hixie/intrinsic/003-expected.txt: Added.
  • svg/custom/object-sizing-height-50p-on-target-svg-absolute.xhtml: Added.
  • svg/custom/object-sizing-height-50p-on-target-svg.xhtml: Added.
  • svg/custom/object-sizing-width-50p-height-50p-on-target-svg-absolute.xhtml: Added.
  • svg/custom/object-sizing-width-50p-height-50p-on-target-svg.xhtml: Added.
  • svg/custom/object-sizing-width-50p-height-75p-on-target-svg-absolute.xhtml: Added.
  • svg/custom/object-sizing-width-50p-height-75p-on-target-svg.xhtml: Added.
  • svg/custom/object-sizing-width-50p-on-target-svg-absolute.xhtml: Added.
  • svg/custom/object-sizing-width-50p-on-target-svg.xhtml: Added.
  • svg/custom/object-sizing-width-75p-height-50p-on-target-svg-absolute.xhtml: Added.
  • svg/custom/object-sizing-width-75p-height-50p-on-target-svg.xhtml: Added.
  • svg/custom/resources/object-sizing-height-50p.svg: Added.
  • svg/custom/resources/object-sizing-width-50p-height-50p.svg: Added.
  • svg/custom/resources/object-sizing-width-50p-height-75p.svg: Added.
  • svg/custom/resources/object-sizing-width-50p.svg: Added.
  • svg/custom/resources/object-sizing-width-75p-height-50p.svg: Added.
  • svg/hixie/intrinsic: Added.
  • svg/hixie/intrinsic/001.html: Added.
  • svg/hixie/intrinsic/002.html: Added.
  • svg/hixie/intrinsic/003.html: Added.
  • svg/hixie/intrinsic/resources: Added.
  • svg/hixie/intrinsic/resources/001.svg: Added.
  • svg/hixie/intrinsic/resources/002.svg: Added.
  • svg/hixie/intrinsic/resources/003.svg: Added.
  • svg/hixie/intrinsic/resources/test-bl: Added.
  • svg/hixie/intrinsic/resources/test-br: Added.
  • svg/hixie/intrinsic/resources/test-tl: Added.
  • svg/hixie/intrinsic/resources/test-tr: Added.

2011-06-01 Nikolas Zimmermann <nzimmermann@rim.com>

Reviewed by Rob Buis.

SVG fails all 3 of Hixie's CSS intrinsic sizing tests
https://bugs.webkit.org/show_bug.cgi?id=15473

Hixies CSS intrinsic sizing tests cover percentage sizes specified on the target SVG document as width/height attributes
and using width: auto / height: auto on the <object> that hosts the SVG document. Take percentage sizes of the outermost
SVGs width/height attributes into account when determining the intrinsic size of the <object>.

Added several other testcases demonstrating several scenarios. All tests work exactly the same in WebKit and Firefox now.
The *on-target-svg-absolute.xhtml tests look equal to WebKit/FF but Opera fails them, likely a relict of the different
interpretation of the intrinsic size of a SVG document in SVG Tiny 1.2.

Tests: svg/custom/object-sizing-height-50p-on-target-svg-absolute.xhtml

svg/custom/object-sizing-height-50p-on-target-svg.xhtml
svg/custom/object-sizing-width-50p-height-50p-on-target-svg-absolute.xhtml
svg/custom/object-sizing-width-50p-height-50p-on-target-svg.xhtml
svg/custom/object-sizing-width-50p-height-75p-on-target-svg-absolute.xhtml
svg/custom/object-sizing-width-50p-height-75p-on-target-svg.xhtml
svg/custom/object-sizing-width-50p-on-target-svg-absolute.xhtml
svg/custom/object-sizing-width-50p-on-target-svg.xhtml
svg/custom/object-sizing-width-75p-height-50p-on-target-svg-absolute.xhtml
svg/custom/object-sizing-width-75p-height-50p-on-target-svg.xhtml
svg/hixie/intrinsic/001.html
svg/hixie/intrinsic/002.html
svg/hixie/intrinsic/003.html

  • rendering/RenderPart.cpp: (WebCore::RenderPart::computeReplacedLogicalWidth): (WebCore::RenderPart::computeReplacedLogicalHeight):
  • rendering/svg/RenderSVGRoot.cpp: (WebCore::RenderSVGRoot::computeIntrinsicRatio):
  • rendering/svg/RenderSVGRoot.h:
Location:
trunk
Files:
54 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r87778 r87779  
     12011-06-01  Nikolas Zimmermann  <nzimmermann@rim.com>
     2
     3        Reviewed by Rob Buis.
     4
     5        SVG fails all 3 of Hixie's CSS intrinsic sizing tests
     6        https://bugs.webkit.org/show_bug.cgi?id=15473
     7
     8        Hixies CSS intrinsic sizing tests cover percentage sizes specified on the target SVG document as width/height attributes
     9        and using width: auto / height: auto on the <object> that hosts the SVG document. Take percentage sizes of the outermost
     10        SVGs width/height attributes into account when determining the intrinsic size of the <object>.
     11
     12        Added several other testcases demonstrating several scenarios. All tests work exactly the same in WebKit and Firefox now.
     13        The *on-target-svg-absolute.xhtml tests look equal to WebKit/FF but Opera fails them, likely a relict of the different
     14        interpretation of the intrinsic size of a SVG document in SVG Tiny 1.2.
     15
     16        * platform/mac/svg/custom/object-sizing-height-50p-on-target-svg-absolute-expected.png: Added.
     17        * platform/mac/svg/custom/object-sizing-height-50p-on-target-svg-absolute-expected.txt: Added.
     18        * platform/mac/svg/custom/object-sizing-height-50p-on-target-svg-expected.png: Added.
     19        * platform/mac/svg/custom/object-sizing-height-50p-on-target-svg-expected.txt: Added.
     20        * platform/mac/svg/custom/object-sizing-width-50p-height-50p-on-target-svg-absolute-expected.png: Added.
     21        * platform/mac/svg/custom/object-sizing-width-50p-height-50p-on-target-svg-absolute-expected.txt: Added.
     22        * platform/mac/svg/custom/object-sizing-width-50p-height-50p-on-target-svg-expected.png: Added.
     23        * platform/mac/svg/custom/object-sizing-width-50p-height-50p-on-target-svg-expected.txt: Added.
     24        * platform/mac/svg/custom/object-sizing-width-50p-height-75p-on-target-svg-absolute-expected.png: Added.
     25        * platform/mac/svg/custom/object-sizing-width-50p-height-75p-on-target-svg-absolute-expected.txt: Added.
     26        * platform/mac/svg/custom/object-sizing-width-50p-height-75p-on-target-svg-expected.png: Added.
     27        * platform/mac/svg/custom/object-sizing-width-50p-height-75p-on-target-svg-expected.txt: Added.
     28        * platform/mac/svg/custom/object-sizing-width-50p-on-target-svg-absolute-expected.png: Added.
     29        * platform/mac/svg/custom/object-sizing-width-50p-on-target-svg-absolute-expected.txt: Added.
     30        * platform/mac/svg/custom/object-sizing-width-50p-on-target-svg-expected.png: Added.
     31        * platform/mac/svg/custom/object-sizing-width-50p-on-target-svg-expected.txt: Added.
     32        * platform/mac/svg/custom/object-sizing-width-75p-height-50p-on-target-svg-absolute-expected.png: Added.
     33        * platform/mac/svg/custom/object-sizing-width-75p-height-50p-on-target-svg-absolute-expected.txt: Added.
     34        * platform/mac/svg/custom/object-sizing-width-75p-height-50p-on-target-svg-expected.png: Added.
     35        * platform/mac/svg/custom/object-sizing-width-75p-height-50p-on-target-svg-expected.txt: Added.
     36        * platform/mac/svg/hixie/intrinsic: Added.
     37        * platform/mac/svg/hixie/intrinsic/001-expected.png: Added.
     38        * platform/mac/svg/hixie/intrinsic/001-expected.txt: Added.
     39        * platform/mac/svg/hixie/intrinsic/002-expected.png: Added.
     40        * platform/mac/svg/hixie/intrinsic/002-expected.txt: Added.
     41        * platform/mac/svg/hixie/intrinsic/003-expected.png: Added.
     42        * platform/mac/svg/hixie/intrinsic/003-expected.txt: Added.
     43        * svg/custom/object-sizing-height-50p-on-target-svg-absolute.xhtml: Added.
     44        * svg/custom/object-sizing-height-50p-on-target-svg.xhtml: Added.
     45        * svg/custom/object-sizing-width-50p-height-50p-on-target-svg-absolute.xhtml: Added.
     46        * svg/custom/object-sizing-width-50p-height-50p-on-target-svg.xhtml: Added.
     47        * svg/custom/object-sizing-width-50p-height-75p-on-target-svg-absolute.xhtml: Added.
     48        * svg/custom/object-sizing-width-50p-height-75p-on-target-svg.xhtml: Added.
     49        * svg/custom/object-sizing-width-50p-on-target-svg-absolute.xhtml: Added.
     50        * svg/custom/object-sizing-width-50p-on-target-svg.xhtml: Added.
     51        * svg/custom/object-sizing-width-75p-height-50p-on-target-svg-absolute.xhtml: Added.
     52        * svg/custom/object-sizing-width-75p-height-50p-on-target-svg.xhtml: Added.
     53        * svg/custom/resources/object-sizing-height-50p.svg: Added.
     54        * svg/custom/resources/object-sizing-width-50p-height-50p.svg: Added.
     55        * svg/custom/resources/object-sizing-width-50p-height-75p.svg: Added.
     56        * svg/custom/resources/object-sizing-width-50p.svg: Added.
     57        * svg/custom/resources/object-sizing-width-75p-height-50p.svg: Added.
     58        * svg/hixie/intrinsic: Added.
     59        * svg/hixie/intrinsic/001.html: Added.
     60        * svg/hixie/intrinsic/002.html: Added.
     61        * svg/hixie/intrinsic/003.html: Added.
     62        * svg/hixie/intrinsic/resources: Added.
     63        * svg/hixie/intrinsic/resources/001.svg: Added.
     64        * svg/hixie/intrinsic/resources/002.svg: Added.
     65        * svg/hixie/intrinsic/resources/003.svg: Added.
     66        * svg/hixie/intrinsic/resources/test-bl: Added.
     67        * svg/hixie/intrinsic/resources/test-br: Added.
     68        * svg/hixie/intrinsic/resources/test-tl: Added.
     69        * svg/hixie/intrinsic/resources/test-tr: Added.
     70
    1712011-06-01  Annie Sullivan  <sullivan@chromium.org>
    272
  • trunk/Source/WebCore/ChangeLog

    r87776 r87779  
     12011-06-01  Nikolas Zimmermann  <nzimmermann@rim.com>
     2
     3        Reviewed by Rob Buis.
     4
     5        SVG fails all 3 of Hixie's CSS intrinsic sizing tests
     6        https://bugs.webkit.org/show_bug.cgi?id=15473
     7
     8        Hixies CSS intrinsic sizing tests cover percentage sizes specified on the target SVG document as width/height attributes
     9        and using width: auto / height: auto on the <object> that hosts the SVG document. Take percentage sizes of the outermost
     10        SVGs width/height attributes into account when determining the intrinsic size of the <object>.
     11
     12        Added several other testcases demonstrating several scenarios. All tests work exactly the same in WebKit and Firefox now.
     13        The *on-target-svg-absolute.xhtml tests look equal to WebKit/FF but Opera fails them, likely a relict of the different
     14        interpretation of the intrinsic size of a SVG document in SVG Tiny 1.2.
     15
     16        Tests: svg/custom/object-sizing-height-50p-on-target-svg-absolute.xhtml
     17               svg/custom/object-sizing-height-50p-on-target-svg.xhtml
     18               svg/custom/object-sizing-width-50p-height-50p-on-target-svg-absolute.xhtml
     19               svg/custom/object-sizing-width-50p-height-50p-on-target-svg.xhtml
     20               svg/custom/object-sizing-width-50p-height-75p-on-target-svg-absolute.xhtml
     21               svg/custom/object-sizing-width-50p-height-75p-on-target-svg.xhtml
     22               svg/custom/object-sizing-width-50p-on-target-svg-absolute.xhtml
     23               svg/custom/object-sizing-width-50p-on-target-svg.xhtml
     24               svg/custom/object-sizing-width-75p-height-50p-on-target-svg-absolute.xhtml
     25               svg/custom/object-sizing-width-75p-height-50p-on-target-svg.xhtml
     26               svg/hixie/intrinsic/001.html
     27               svg/hixie/intrinsic/002.html
     28               svg/hixie/intrinsic/003.html
     29
     30        * rendering/RenderPart.cpp:
     31        (WebCore::RenderPart::computeReplacedLogicalWidth):
     32        (WebCore::RenderPart::computeReplacedLogicalHeight):
     33        * rendering/svg/RenderSVGRoot.cpp:
     34        (WebCore::RenderSVGRoot::computeIntrinsicRatio):
     35        * rendering/svg/RenderSVGRoot.h:
     36
    1372011-05-31  Tonis Tiigi  <tonistiigi@gmail.com>
    238
     
    387423        (WebCore::XMLDocumentParser::insertErrorMessageBlock):
    388424
    389 >>>>>>> .r87747
    3904252011-05-31  Andreas Kling  <kling@webkit.org>
    391426
     
    632667        Include '+' in the list of valid characters.
    633668
     669>>>>>>> .r87778
    6346702011-05-30  Andrey Petrov  <andrey.petrov@gmail.com>
    635671
  • trunk/Source/WebCore/rendering/RenderPart.cpp

    r87526 r87779  
    140140
    141141    // 10.3.2 Inline, replaced elements: http://www.w3.org/TR/CSS21/visudet.html#inline-replaced-width
     142    bool isPercentageIntrinsicSize = false;
     143    FloatSize intrinsicRatio;
     144    contentRenderer->computeIntrinsicRatioInformation(intrinsicRatio, isPercentageIntrinsicSize);
     145
    142146    if (style()->width().isAuto()) {
    143147        bool heightIsAuto = style()->height().isAuto();
     
    149153   
    150154        bool hasIntrinsicHeight = contentRenderStyle->height().isFixed();
    151         FloatSize intrinsicRatio = contentRenderer->computeIntrinsicRatio();
    152155        if (!intrinsicRatio.isEmpty()) {
    153156            // If 'height' and 'width' both have computed values of 'auto' and the element has no intrinsic width, but does have an intrinsic height and intrinsic ratio;
     
    164167            // FIXME: Don't ignore padding/margin/border here.
    165168            RenderBlock* containingBlock = this->containingBlock();
    166             if (heightIsAuto && !hasIntrinsicWidth && !hasIntrinsicHeight && containingBlock)
     169            if (heightIsAuto && !hasIntrinsicWidth && !hasIntrinsicHeight && containingBlock) {
     170                if (isPercentageIntrinsicSize)
     171                    return static_cast<int>(ceilf(containingBlock->width() * intrinsicRatio.width() / 100));
    167172                return containingBlock->width();
     173            }
    168174        }
    169175
     
    187193
    188194    // 10.6.2 Inline, replaced elements: http://www.w3.org/TR/CSS21/visudet.html#inline-replaced-height
     195    bool isPercentageIntrinsicSize = false;
     196    FloatSize intrinsicRatio;
     197    contentRenderer->computeIntrinsicRatioInformation(intrinsicRatio, isPercentageIntrinsicSize);
     198
    189199    if (style()->height().isAuto()) {
    190200        bool widthIsAuto = style()->width().isAuto();
     
    197207        // Otherwise, if 'height' has a computed value of 'auto', and the element has an intrinsic ratio then the used value of 'height' is:
    198208        // (used width) / (intrinsic ratio)
    199         FloatSize intrinsicRatio = contentRenderer->computeIntrinsicRatio();
    200         if (!intrinsicRatio.isEmpty()) {
     209        if (!intrinsicRatio.isEmpty() && !isPercentageIntrinsicSize) {
    201210            int logicalWidth = computeReplacedLogicalWidthUsing(widthIsAuto ? contentRenderStyle->logicalWidth() : style()->logicalWidth());
    202211            return static_cast<int>(ceilf(logicalWidth * intrinsicRatio.height() / intrinsicRatio.width()));
  • trunk/Source/WebCore/rendering/svg/RenderSVGRoot.cpp

    r87526 r87779  
    6363}
    6464
    65 FloatSize RenderSVGRoot::computeIntrinsicRatio() const
     65void RenderSVGRoot::computeIntrinsicRatioInformation(FloatSize& intrinsicRatio, bool& isPercentageIntrinsicSize) const
    6666{
    6767    // Spec: http://dev.w3.org/SVG/profiles/1.1F2/publish/coords.html#IntrinsicSizing
     
    7575    // (in, mm, cm, pt, pc, px, em, ex) or in user units, then the aspect ratio is calculated from the
    7676    // ‘width’ and ‘height’ attributes after resolving both values to user units.
    77     if (style()->width().isFixed() && style()->height().isFixed())
    78         return FloatSize(width(), height());
     77    isPercentageIntrinsicSize = false;
     78    if (style()->width().isFixed() && style()->height().isFixed()) {
     79        intrinsicRatio = FloatSize(width(), height());
     80        return;
     81    }
    7982
    8083    // If either/both of the ‘width’ and ‘height’ of the rootmost ‘svg’ element are in percentage units (or omitted),
     
    8285    // document fragment. If the ‘viewBox’ is not correctly specified, or set to 'none', the intrinsic aspect ratio
    8386    // cannot be calculated and is considered unspecified.
    84     return static_cast<SVGSVGElement*>(node())->currentViewBoxRect().size();
     87    intrinsicRatio = static_cast<SVGSVGElement*>(node())->currentViewBoxRect().size();
     88
     89    // Compatibility with authors expectations and Firefox/Opera: when percentage units are used, take them into
     90    // account for certain cases of the intrinsic width/height calculation in RenderPart::computeReplacedLogicalWidth/Height.
     91    if (intrinsicRatio.isEmpty() && style()->width().isPercent() && style()->height().isPercent()) {
     92        isPercentageIntrinsicSize = true;
     93        intrinsicRatio = FloatSize(style()->width().percent(), style()->height().percent());
     94    }
    8595}
    8696
  • trunk/Source/WebCore/rendering/svg/RenderSVGRoot.h

    r87526 r87779  
    4040    virtual ~RenderSVGRoot();
    4141
    42     FloatSize computeIntrinsicRatio() const;
     42    void computeIntrinsicRatioInformation(FloatSize& intrinsicRatio, bool& isPercentageIntrinsicSize) const;
    4343    const RenderObjectChildList* children() const { return &m_children; }
    4444    RenderObjectChildList* children() { return &m_children; }
Note: See TracChangeset for help on using the changeset viewer.