Commit 4abf20ad authored by eric@webkit.org's avatar eric@webkit.org

Reviewed by George Staikos.

        Move absoluteRects and absoluteQuads into RenderSVGInline and remove absoluteTransform() usage
        https://bugs.webkit.org/show_bug.cgi?id=25532

        * rendering/RenderSVGInline.cpp:
        (WebCore::RenderSVGInline::absoluteRects):
        (WebCore::RenderSVGInline::absoluteQuads):
        * rendering/RenderSVGInline.h:
        * rendering/RenderSVGTSpan.cpp:
        * rendering/RenderSVGTSpan.h:
        * rendering/RenderSVGTextPath.cpp:
        * rendering/RenderSVGTextPath.h:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@43179 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent f8a95c3c
2009-05-03 Eric Seidel <eric@webkit.org>
Reviewed by George Staikos.
Move absoluteRects and absoluteQuads into RenderSVGInline and remove absoluteTransform() usage
https://bugs.webkit.org/show_bug.cgi?id=25532
* rendering/RenderSVGInline.cpp:
(WebCore::RenderSVGInline::absoluteRects):
(WebCore::RenderSVGInline::absoluteQuads):
* rendering/RenderSVGInline.h:
* rendering/RenderSVGTSpan.cpp:
* rendering/RenderSVGTSpan.h:
* rendering/RenderSVGTextPath.cpp:
* rendering/RenderSVGTextPath.h:
2009-05-03 Eric Seidel <eric@webkit.org>
Reviewed by George Staikos.
......@@ -26,8 +26,11 @@
#if ENABLE(SVG)
#include "RenderSVGInline.h"
#include "FloatQuad.h"
#include "RenderBlock.h"
#include "SVGInlineFlowBox.h"
#include <wtf/UnusedParam.h>
#include "SVGInlineTextBox.h"
#include "SVGRootInlineBox.h"
namespace WebCore {
......@@ -43,6 +46,44 @@ InlineFlowBox* RenderSVGInline::createFlowBox()
return box;
}
void RenderSVGInline::absoluteRects(Vector<IntRect>& rects, int, int)
{
InlineRunBox* firstBox = firstLineBox();
SVGRootInlineBox* rootBox = firstBox ? static_cast<SVGInlineTextBox*>(firstBox)->svgRootInlineBox() : 0;
RenderBox* object = rootBox ? rootBox->block() : 0;
if (!object)
return;
int xRef = object->x();
int yRef = object->y();
for (InlineRunBox* curr = firstBox; curr; curr = curr->nextLineBox()) {
FloatRect rect(xRef + curr->x(), yRef + curr->y(), curr->width(), curr->height());
rects.append(enclosingIntRect(localToAbsoluteQuad(rect).boundingBox()));
}
}
void RenderSVGInline::absoluteQuads(Vector<FloatQuad>& quads)
{
InlineRunBox* firstBox = firstLineBox();
SVGRootInlineBox* rootBox = firstBox ? static_cast<SVGInlineTextBox*>(firstBox)->svgRootInlineBox() : 0;
RenderBox* object = rootBox ? rootBox->block() : 0;
if (!object)
return;
int xRef = object->x();
int yRef = object->y();
for (InlineRunBox* curr = firstBox; curr; curr = curr->nextLineBox()) {
FloatRect rect(xRef + curr->x(), yRef + curr->y(), curr->width(), curr->height());
quads.append(localToAbsoluteQuad(rect));
}
}
}
#endif // ENABLE(SVG)
......@@ -34,6 +34,10 @@ public:
RenderSVGInline(Node*);
virtual const char* renderName() const { return "RenderSVGInline"; }
virtual bool requiresLayer() const { return false; }
// These are shared between RenderSVGTSpan and RenderSVGTextPath
virtual void absoluteRects(Vector<IntRect>& rects, int tx, int ty);
virtual void absoluteQuads(Vector<FloatQuad>&);
private:
virtual InlineFlowBox* createFlowBox();
......
......@@ -26,11 +26,6 @@
#if ENABLE(SVG)
#include "RenderSVGTSpan.h"
#include "FloatQuad.h"
#include "RenderBlock.h"
#include "SVGInlineTextBox.h"
#include "SVGRootInlineBox.h"
namespace WebCore {
RenderSVGTSpan::RenderSVGTSpan(Node* n)
......@@ -38,46 +33,6 @@ RenderSVGTSpan::RenderSVGTSpan(Node* n)
{
}
void RenderSVGTSpan::absoluteRects(Vector<IntRect>& rects, int, int)
{
InlineRunBox* firstBox = firstLineBox();
SVGRootInlineBox* rootBox = firstBox ? static_cast<SVGInlineTextBox*>(firstBox)->svgRootInlineBox() : 0;
RenderBox* object = rootBox ? rootBox->block() : 0;
if (!object)
return;
int xRef = object->x();
int yRef = object->y();
for (InlineRunBox* curr = firstBox; curr; curr = curr->nextLineBox()) {
FloatRect rect(xRef + curr->x(), yRef + curr->y(), curr->width(), curr->height());
// FIXME: broken with CSS transforms
rects.append(enclosingIntRect(absoluteTransform().mapRect(rect)));
}
}
void RenderSVGTSpan::absoluteQuads(Vector<FloatQuad>& quads)
{
InlineRunBox* firstBox = firstLineBox();
SVGRootInlineBox* rootBox = firstBox ? static_cast<SVGInlineTextBox*>(firstBox)->svgRootInlineBox() : 0;
RenderBox* object = rootBox ? rootBox->block() : 0;
if (!object)
return;
int xRef = object->x();
int yRef = object->y();
for (InlineRunBox* curr = firstBox; curr; curr = curr->nextLineBox()) {
FloatRect rect(xRef + curr->x(), yRef + curr->y(), curr->width(), curr->height());
// FIXME: broken with CSS transforms
quads.append(absoluteTransform().mapRect(rect));
}
}
}
#endif // ENABLE(SVG)
......@@ -31,8 +31,6 @@ class RenderSVGTSpan : public RenderSVGInline {
public:
RenderSVGTSpan(Node*);
virtual const char* renderName() const { return "RenderSVGTSpan"; }
virtual void absoluteRects(Vector<IntRect>& rects, int tx, int ty);
virtual void absoluteQuads(Vector<FloatQuad>&);
// FIXME: These are incorrect, but have always behaved this way.
// These empty implementations prevent us from hitting RenderObject ASSERTS.
......
......@@ -78,46 +78,6 @@ bool RenderSVGTextPath::stretchMethod() const
return static_cast<SVGTextPathElement*>(node())->method() == SVG_TEXTPATH_METHODTYPE_STRETCH;
}
void RenderSVGTextPath::absoluteRects(Vector<IntRect>& rects, int, int)
{
InlineRunBox* firstBox = firstLineBox();
SVGRootInlineBox* rootBox = firstBox ? static_cast<SVGInlineTextBox*>(firstBox)->svgRootInlineBox() : 0;
RenderBlock* object = rootBox ? rootBox->block() : 0;
if (!object)
return;
int xRef = object->x();
int yRef = object->y();
for (InlineRunBox* curr = firstBox; curr; curr = curr->nextLineBox()) {
FloatRect rect(xRef + curr->x(), yRef + curr->y(), curr->width(), curr->height());
// FIXME: broken with CSS transforms
rects.append(enclosingIntRect(absoluteTransform().mapRect(rect)));
}
}
void RenderSVGTextPath::absoluteQuads(Vector<FloatQuad>& quads)
{
InlineRunBox* firstBox = firstLineBox();
SVGRootInlineBox* rootBox = firstBox ? static_cast<SVGInlineTextBox*>(firstBox)->svgRootInlineBox() : 0;
RenderBlock* object = rootBox ? rootBox->block() : 0;
if (!object)
return;
int xRef = object->x();
int yRef = object->y();
for (InlineRunBox* curr = firstBox; curr; curr = curr->nextLineBox()) {
FloatRect rect(xRef + curr->x(), yRef + curr->y(), curr->width(), curr->height());
// FIXME: broken with CSS transforms
quads.append(absoluteTransform().mapRect(rect));
}
}
}
#endif // ENABLE(SVG)
......@@ -38,8 +38,6 @@ namespace WebCore {
bool stretchMethod() const;
virtual const char* renderName() const { return "RenderSVGTextPath"; }
virtual void absoluteRects(Vector<IntRect>& rects, int tx, int ty);
virtual void absoluteQuads(Vector<FloatQuad>&);
private:
float m_startOffset;
......
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