Commit cddf003a authored by eric@webkit.org's avatar eric@webkit.org

Reviewed by Simon Fraser.

        Remove unneeded (broken) code from SVG renderers
        https://bugs.webkit.org/show_bug.cgi?id=25214

        Mostly due to my historical confusions about the render tree
        and some methods not being removed after classes were split.

        RenderSVGRoot is an RenderBox and should just use all the
        standard RenderBox methods for inspector and repaint rects.

        RenderSVGContainer is *not* a RenderBox (any more) and thus
        doesn't need lineHeight or width/height or calcBounds.

        RenderSVGViewportContainer had some broken code which tried
        to see if the click was inside the container at all, but it
        was using width/height metrics based off of the containing
        block (from calcWidth) which is wrong (since its real
        width/height are from its containing viewport not containing block).

        * rendering/RenderSVGContainer.cpp:
        (WebCore::RenderSVGContainer::RenderSVGContainer):
        (WebCore::RenderSVGContainer::layout):
        * rendering/RenderSVGContainer.h:
        * rendering/RenderSVGRoot.cpp:
        * rendering/RenderSVGRoot.h:
        * rendering/RenderSVGViewportContainer.cpp:
        (WebCore::RenderSVGViewportContainer::layout):
        (WebCore::RenderSVGViewportContainer::nodeAtPoint):

git-svn-id: svn://svn.chromium.org/blink/trunk@42554 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 4a292de8
2009-04-15 Eric Seidel <eric@webkit.org>
Reviewed by Simon Fraser.
Remove unneeded (broken) code from SVG renderers
https://bugs.webkit.org/show_bug.cgi?id=25214
Mostly due to my historical confusions about the render tree
and some methods not being removed after classes were split.
RenderSVGRoot is an RenderBox and should just use all the
standard RenderBox methods for inspector and repaint rects.
RenderSVGContainer is *not* a RenderBox (any more) and thus
doesn't need lineHeight or width/height or calcBounds.
RenderSVGViewportContainer had some broken code which tried
to see if the click was inside the container at all, but it
was using width/height metrics based off of the containing
block (from calcWidth) which is wrong (since its real
width/height are from its containing viewport not containing block).
* rendering/RenderSVGContainer.cpp:
(WebCore::RenderSVGContainer::RenderSVGContainer):
(WebCore::RenderSVGContainer::layout):
* rendering/RenderSVGContainer.h:
* rendering/RenderSVGRoot.cpp:
* rendering/RenderSVGRoot.h:
* rendering/RenderSVGViewportContainer.cpp:
(WebCore::RenderSVGViewportContainer::layout):
(WebCore::RenderSVGViewportContainer::nodeAtPoint):
2009-04-15 Eric Seidel <eric@webkit.org>
Reviewed by Simon Fraser and Sam Weinig.
......@@ -2,8 +2,7 @@
Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005, 2007, 2008 Rob Buis <buis@kde.org>
2007 Eric Seidel <eric@webkit.org>
This file is part of the KDE project
Copyright (C) 2009 Google, Inc. All rights reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
......@@ -39,8 +38,6 @@ namespace WebCore {
RenderSVGContainer::RenderSVGContainer(SVGStyledElement* node)
: RenderObject(node)
, m_width(0)
, m_height(0)
, m_drawsContents(true)
{
}
......@@ -64,16 +61,6 @@ TransformationMatrix RenderSVGContainer::localTransform() const
return m_localTransform;
}
int RenderSVGContainer::lineHeight(bool, bool) const
{
return height();
}
int RenderSVGContainer::baselinePosition(bool, bool) const
{
return height();
}
bool RenderSVGContainer::calculateLocalTransform()
{
// subclasses can override this to add transform support
......@@ -104,7 +91,7 @@ void RenderSVGContainer::layout()
ASSERT(!child->needsLayout());
}
calcBounds();
m_absoluteBounds = absoluteClippedOverflowRect();
repainter.repaintAfterLayout();
......@@ -112,36 +99,6 @@ void RenderSVGContainer::layout()
setNeedsLayout(false);
}
int RenderSVGContainer::calcReplacedWidth() const
{
switch (style()->width().type()) {
case Fixed:
return max(0, style()->width().value());
case Percent:
{
const int cw = containingBlock()->availableWidth();
return cw > 0 ? max(0, style()->width().calcMinValue(cw)) : 0;
}
default:
return 0;
}
}
int RenderSVGContainer::calcReplacedHeight() const
{
switch (style()->height().type()) {
case Fixed:
return max(0, style()->height().value());
case Percent:
{
RenderBlock* cb = containingBlock();
return style()->height().calcValue(cb->availableHeight());
}
default:
return 0;
}
}
void RenderSVGContainer::applyContentTransforms(PaintInfo& paintInfo)
{
if (!localTransform().isIdentity())
......@@ -153,13 +110,6 @@ void RenderSVGContainer::applyAdditionalTransforms(PaintInfo&)
// no-op
}
void RenderSVGContainer::calcBounds()
{
m_width = calcReplacedWidth();
m_height = calcReplacedHeight();
m_absoluteBounds = absoluteClippedOverflowRect();
}
bool RenderSVGContainer::selfWillPaint() const
{
#if ENABLE(SVG_FILTERS)
......
/*
Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005, 2007 Rob Buis <buis@kde.org>
This file is part of the KDE project
Copyright (C) 2009 Google, Inc. All rights reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
......@@ -42,9 +41,6 @@ public:
const RenderObjectChildList* children() const { return &m_children; }
RenderObjectChildList* children() { return &m_children; }
int width() const { return m_width; }
int height() const { return m_height; }
// Some containers do not want it's children
// to be drawn, because they may be 'referenced'
// Example: <marker> children in SVG
......@@ -55,8 +51,6 @@ public:
virtual const char* renderName() const { return "RenderSVGContainer"; }
virtual bool requiresLayer() const { return false; }
virtual int lineHeight(bool b, bool isRootLineBox = false) const;
virtual int baselinePosition(bool b, bool isRootLineBox = false) const;
virtual void layout();
virtual void paint(PaintInfo&, int parentX, int parentY);
......@@ -78,18 +72,10 @@ protected:
virtual void applyContentTransforms(PaintInfo&);
virtual void applyAdditionalTransforms(PaintInfo&);
void calcBounds();
virtual IntRect outlineBoundsForRepaint(RenderBoxModelObject* /*repaintContainer*/) const;
private:
int calcReplacedWidth() const;
int calcReplacedHeight() const;
RenderObjectChildList m_children;
int m_width;
int m_height;
bool selfWillPaint() const;
......
......@@ -219,40 +219,6 @@ void RenderSVGRoot::calcViewport()
svg->relativeHeightValue() : height.value(svg));
}
IntRect RenderSVGRoot::clippedOverflowRectForRepaint(RenderBoxModelObject* repaintContainer)
{
IntRect repaintRect;
for (RenderObject* current = firstChild(); current != 0; current = current->nextSibling())
repaintRect.unite(current->clippedOverflowRectForRepaint(repaintContainer));
#if ENABLE(SVG_FILTERS)
// Filters can expand the bounding box
SVGResourceFilter* filter = getFilterById(document(), style()->svgStyle()->filter());
if (filter)
repaintRect.unite(enclosingIntRect(filter->filterBBoxForItemBBox(repaintRect)));
#endif
return repaintRect;
}
void RenderSVGRoot::addFocusRingRects(GraphicsContext* graphicsContext, int, int)
{
graphicsContext->addFocusRingRect(m_absoluteBounds);
}
void RenderSVGRoot::absoluteRects(Vector<IntRect>& rects, int, int)
{
for (RenderObject* current = firstChild(); current != 0; current = current->nextSibling())
current->absoluteRects(rects, 0, 0);
}
void RenderSVGRoot::absoluteQuads(Vector<FloatQuad>& quads, bool)
{
for (RenderObject* current = firstChild(); current != 0; current = current->nextSibling())
current->absoluteQuads(quads);
}
TransformationMatrix RenderSVGRoot::absoluteTransform() const
{
TransformationMatrix ctm = RenderBox::absoluteTransform();
......
/*
Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
2004, 2005, 2007 Rob Buis <buis@kde.org>
This file is part of the KDE project
Copyright (C) 2009 Google, Inc. All rights reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
......@@ -51,11 +50,6 @@ public:
virtual void layout();
virtual void paint(PaintInfo&, int parentX, int parentY);
virtual IntRect clippedOverflowRectForRepaint(RenderBoxModelObject* repaintContainer);
virtual void absoluteRects(Vector<IntRect>& rects, int tx, int ty);
virtual void absoluteQuads(Vector<FloatQuad>&, bool topLevel = true);
virtual void addFocusRingRects(GraphicsContext*, int tx, int ty);
virtual TransformationMatrix absoluteTransform() const;
......
......@@ -55,7 +55,7 @@ void RenderSVGViewportContainer::layout()
// FIXME: using m_absoluteBounds breaks if containerForRepaint() is not the root
LayoutRepainter repainter(*this, checkForRepaintDuringLayout() && selfNeedsLayout(), &m_absoluteBounds);
calcBounds();
m_absoluteBounds = absoluteClippedOverflowRect();
for (RenderObject* child = firstChild(); child; child = child->nextSibling()) {
if (selfNeedsLayout())
......@@ -153,8 +153,9 @@ bool RenderSVGViewportContainer::nodeAtPoint(const HitTestRequest& request, HitT
if (!viewport().isEmpty()
&& style()->overflowX() == OHIDDEN
&& style()->overflowY() == OHIDDEN) {
// Check if we need to do anything at all.
IntRect overflowBox = IntRect(0, 0, width(), height());
// Check to see if the region is outside of our viewport (and thus can't hit our kids)
// FIXME: This code seems needlessly complicated (and thus likely wrong)
IntRect overflowBox = IntRect(0, 0, viewport().width(), viewport().height());
overflowBox.move(_tx, _ty);
TransformationMatrix ctm = RenderObject::absoluteTransform();
ctm.translate(viewport().x(), viewport().y());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment