Changeset 20469 in webkit


Ignore:
Timestamp:
Mar 24, 2007 5:27:34 AM (17 years ago)
Author:
zimmermann
Message:

Reviewed by Oliver.

Fix all known RenderSVGImage problems.

Fixes: http://bugs.webkit.org/show_bug.cgi?id=12126 (RenderSVGImage seems to suffer from integer overflow)
Fixes: http://bugs.webkit.org/show_bug.cgi?id=12442 (raster images disappearing during script execution (SVG))
Fixes: http://bugs.webkit.org/show_bug.cgi?id=12572 (WebKit does not properly invalidate image region after image load)

Added test: svg/custom/scrolling-embedded-svg-file-image-repaint-problem.html

Location:
trunk
Files:
4 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r20459 r20469  
     12007-03-24  Nikolas Zimmermann  <zimmermann@kde.org>
     2
     3        Reviewed by Oliver.
     4
     5        Add new layout test checking that SVG images repaint properly when embedded in HTML files.
     6
     7        * svg/custom/scrolling-embedded-svg-file-image-repaint-problem-expected.checksum: Added.
     8        * svg/custom/scrolling-embedded-svg-file-image-repaint-problem-expected.png: Added.
     9        * svg/custom/scrolling-embedded-svg-file-image-repaint-problem-expected.txt: Added.
     10        * svg/custom/scrolling-embedded-svg-file-image-repaint-problem.html: Added.
     11
    1122007-03-23  Mitz Pettel  <mitz@webkit.org>
    213
  • trunk/WebCore/ChangeLog

    r20468 r20469  
     12007-03-23  Nikolas Zimmermann  <zimmermann@kde.org>
     2
     3        Reviewed by Oliver.
     4
     5        Fix all known RenderSVGImage problems.
     6
     7        Fixes: http://bugs.webkit.org/show_bug.cgi?id=12126 (RenderSVGImage seems to suffer from integer overflow)
     8        Fixes: http://bugs.webkit.org/show_bug.cgi?id=12442 (raster images disappearing during script execution (SVG))
     9        Fixes: http://bugs.webkit.org/show_bug.cgi?id=12572 (WebKit does not properly invalidate image region after image load)
     10
     11        Added test: svg/custom/scrolling-embedded-svg-file-image-repaint-problem.html
     12
     13        In RenderSVGImage::paint, do not call shouldPaint() as this will never work properly for SVG renderers, as shouldPaint
     14        doesn't take into account any special SVG transformation (localTransform/absoluteTransform). Just remove the call.
     15
     16        Fix hit detection on RenderSVGImage - it didn't work properly at all. No idea why I didn't notice before.
     17        Thanks Andreas Neumann once again for writing excellent bug reports and pointing me to them :-)
     18
     19        The carto.net navigation tools work as expected now, and also the "dock like" image effect example.
     20
     21        * rendering/RenderSVGImage.cpp:
     22        (WebCore::RenderSVGImage::paint):
     23        (WebCore::RenderSVGImage::nodeAtPoint):
     24
    1252007-03-24  Mitz Pettel  <mitz@webkit.org>
    226
  • trunk/WebCore/rendering/RenderSVGImage.cpp

    r19997 r20469  
    180180    pi.rect = absoluteTransform().inverse().mapRect(pi.rect);
    181181
    182     int x = 0, y = 0;
    183     if (shouldPaint(pi, x, y)) {
    184         SVGImageElement* imageElt = static_cast<SVGImageElement*>(node());
    185 
    186         if (imageElt->preserveAspectRatio()->align() == SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_NONE)
    187             RenderImage::paint(pi, 0, 0);
    188         else {
    189             FloatRect destRect(m_x, m_y, contentWidth(), contentHeight());
    190             FloatRect srcRect(0, 0, image()->width(), image()->height());
    191             adjustRectsForAspectRatio(destRect, srcRect, imageElt->preserveAspectRatio());
    192             paintInfo.context->drawImage(image(), destRect, srcRect);
    193         }
    194     }
     182    SVGImageElement* imageElt = static_cast<SVGImageElement*>(node());
     183
     184    FloatRect destRect(m_x, m_y, contentWidth(), contentHeight());
     185    FloatRect srcRect(0, 0, image()->width(), image()->height());
     186
     187    if (imageElt->preserveAspectRatio()->align() != SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_NONE)
     188        adjustRectsForAspectRatio(destRect, srcRect, imageElt->preserveAspectRatio());
     189
     190    paintInfo.context->drawImage(image(), destRect, srcRect);
    195191
    196192#if ENABLE(SVG_EXPERIMENTAL_FEATURES)
     
    207203bool RenderSVGImage::nodeAtPoint(const HitTestRequest& request, HitTestResult& result, int _x, int _y, int _tx, int _ty, HitTestAction hitTestAction)
    208204{
     205    // We only draw in the forground phase, so we only hit-test then.
     206    if (hitTestAction != HitTestForeground)
     207        return false;
     208
    209209    PointerEventsHitRules hitRules(PointerEventsHitRules::SVG_IMAGE_HITTESTING, style()->svgStyle()->pointerEvents());
    210210   
    211211    bool isVisible = (style()->visibility() == VISIBLE);
    212212    if (isVisible || !hitRules.requireVisible) {
    213         AffineTransform totalTransform = absoluteTransform();
    214         totalTransform *= translationForAttributes();
    215213        double localX, localY;
    216         totalTransform.inverse().map(_x + _tx, _y + _ty, &localX, &localY);
    217         if (hitRules.canHitFill)
    218             return RenderImage::nodeAtPoint(request, result, (int)localX, (int)localY, 0, 0, hitTestAction);
     214        absoluteTransform().inverse().map(_x, _y, &localX, &localY);
     215        translationForAttributes().inverse().map(localX, localY, &localX, &localY);
     216
     217        if (hitRules.canHitFill) {
     218            if (IntRect(0, 0, m_width, m_height).contains(localX, localY)) {
     219                updateHitTestResult(result, IntPoint(_x, _y));
     220                return true;
     221            }
     222        }
    219223    }
     224
    220225    return false;
    221226}
Note: See TracChangeset for help on using the changeset viewer.