IntRect RenderSVGInlineText::computeAbsoluteRectForRange(int startPos, int endPos) { IntRect rect; RenderBlock* cb = containingBlock(); if (!cb || !cb->container()) return rect; RenderSVGRoot* root = findSVGRootObject(parent()); if (!root) return rect; for (InlineTextBox* box = firstTextBox(); box; box = box->nextTextBox()) rect.unite(box->selectionRect(0, 0, startPos, endPos)); // Mimic RenderBox::computeAbsoluteRepaintRect() functionality. But only the subset needed for SVG and respecting SVG transformations. int x, y; cb->container()->absolutePosition(x, y); // Remove HTML parent translation offsets here! These need to be retrieved from the RenderSVGRoot object. // But do take the containingBlocks's container position into account, ie. SVG text in scrollable <div>. AffineTransform htmlParentCtm = root->RenderContainer::absoluteTransform(); FloatRect fixedRect(narrowPrecisionToFloat(rect.x() + x - xPos() - htmlParentCtm.e()), narrowPrecisionToFloat(rect.y() + y - yPos() - htmlParentCtm.f()), rect.width(), rect.height()); return enclosingIntRect(absoluteTransform().mapRect(fixedRect)); }
FloatQuad RenderSVGInlineText::computeRepaintQuadForRange(RenderBoxModelObject* repaintContainer, int startPos, int endPos) { RenderBlock* cb = containingBlock(); if (!cb || !cb->container()) return FloatQuad(); RenderSVGRoot* root = findSVGRootObject(parent()); if (!root) return FloatQuad(); IntRect rect; for (InlineTextBox* box = firstTextBox(); box; box = box->nextTextBox()) rect.unite(box->selectionRect(0, 0, startPos, endPos)); return localToContainerQuad(FloatQuad(rect), repaintContainer); }