Exemple #1
0
bool SVGLayoutSupport::screenScaleFactorChanged(const LayoutObject* ancestor)
{
    for (; ancestor; ancestor = ancestor->parent()) {
        if (ancestor->isSVGRoot())
            return toLayoutSVGRoot(ancestor)->didScreenScaleFactorChange();
        if (ancestor->isSVGTransformableContainer())
            return toLayoutSVGTransformableContainer(ancestor)->didScreenScaleFactorChange();
        if (ancestor->isSVGViewportContainer())
            return toLayoutSVGViewportContainer(ancestor)->didScreenScaleFactorChange();
    }
    ASSERT_NOT_REACHED();
    return false;
}
FloatRect SVGUseElement::getBBox()
{
    document().updateLayoutIgnorePendingStylesheets();

    if (!layoutObject())
        return FloatRect();

    LayoutSVGTransformableContainer& transformableContainer = toLayoutSVGTransformableContainer(*layoutObject());
    // Don't apply the additional translation if the oBB is invalid.
    if (!transformableContainer.isObjectBoundingBoxValid())
        return FloatRect();

    // TODO(fs): Preferably this would just use objectBoundingBox() (and hence
    // don't need to override SVGGraphicsElement::getBBox at all) and be
    // correct without additional work. That will not work out ATM without
    // additional quirks. The problem stems from including the additional
    // translation directly on the LayoutObject corresponding to the
    // SVGUseElement.
    FloatRect bbox = transformableContainer.objectBoundingBox();
    bbox.move(transformableContainer.additionalTranslation());
    return bbox;
}