Changeset 67252 in webkit


Ignore:
Timestamp:
Sep 10, 2010 5:47:30 PM (14 years ago)
Author:
commit-queue@webkit.org
Message:

2010-09-10 Cosmin Truta <ctruta@chromium.org>

Reviewed by Nikolas Zimmermann.

getBoundingClientRect Broken for SVG Elements
https://bugs.webkit.org/show_bug.cgi?id=42815

Added tests for getBoundingClientRect applied to SVG elements.

  • svg/custom/getBoundingClientRect.xhtml: Added
  • svg/custom/getBoundingClientRect-expected.txt: Added

2010-09-10 Cosmin Truta <ctruta@chromium.org>

Reviewed by Nikolas Zimmermann.

getBoundingClientRect Broken for SVG Elements
https://bugs.webkit.org/show_bug.cgi?id=42815

Use getBBox to retrieve the bounding rectangle for SVG elements.

Test: svg/dom/getBoundingClientRect.xhtml

  • dom/Element.cpp: (Element::getBoundingClientRect):
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r67249 r67252  
     12010-09-10  Cosmin Truta  <ctruta@chromium.org>
     2
     3        Reviewed by Nikolas Zimmermann.
     4
     5        getBoundingClientRect Broken for SVG Elements
     6        https://bugs.webkit.org/show_bug.cgi?id=42815
     7
     8        Added tests for getBoundingClientRect applied to SVG elements.
     9
     10        * svg/custom/getBoundingClientRect.xhtml: Added
     11        * svg/custom/getBoundingClientRect-expected.txt: Added
     12
    1132010-09-10  Jian Li  <jianli@chromium.org>
    214
  • trunk/WebCore/ChangeLog

    r67251 r67252  
     12010-09-10  Cosmin Truta  <ctruta@chromium.org>
     2
     3        Reviewed by Nikolas Zimmermann.
     4
     5        getBoundingClientRect Broken for SVG Elements
     6        https://bugs.webkit.org/show_bug.cgi?id=42815
     7
     8        Use getBBox to retrieve the bounding rectangle for SVG elements.
     9
     10        Test: svg/dom/getBoundingClientRect.xhtml
     11
     12        * dom/Element.cpp:
     13        (Element::getBoundingClientRect):
     14
    1152010-09-09  Jer Noble  <jer.noble@apple.com>
    216
  • trunk/WebCore/dom/Element.cpp

    r67238 r67252  
    5151#include "RenderView.h"
    5252#include "RenderWidget.h"
     53#include "SVGStyledLocatableElement.h"
    5354#include "Settings.h"
    5455#include "TextIterator.h"
     
    477478{
    478479    document()->updateLayoutIgnorePendingStylesheets();
    479     RenderBoxModelObject* renderBoxModelObject = this->renderBoxModelObject();
    480     if (!renderBoxModelObject)
    481         return ClientRect::create();
    482480
    483481    Vector<FloatQuad> quads;
    484     renderBoxModelObject->absoluteQuads(quads);
     482    if (isSVGElement()) {
     483        // Get the bounding rectangle from the SVG model.
     484        const SVGElement* svgElement = static_cast<const SVGElement*>(this);
     485        if (svgElement->isStyledLocatable()) {
     486            if (renderer()) {
     487                const FloatRect& localRect = static_cast<const SVGStyledLocatableElement*>(svgElement)->getBBox();
     488                quads.append(renderer()->localToAbsoluteQuad(localRect));
     489            }
     490        }
     491    } else {
     492        // Get the bounding rectangle from the box model.
     493        if (renderBoxModelObject())
     494            renderBoxModelObject()->absoluteQuads(quads);
     495    }
    485496
    486497    if (quads.isEmpty())
     
    496507    }
    497508
    498     adjustIntRectForAbsoluteZoom(result, renderBoxModelObject);
     509    if (renderBoxModelObject())
     510        adjustIntRectForAbsoluteZoom(result, renderBoxModelObject());
    499511
    500512    return ClientRect::create(result);
Note: See TracChangeset for help on using the changeset viewer.