Commit 715eedd0 authored by Fredrik Söderquist's avatar Fredrik Söderquist Committed by Commit Bot

Move common AddOutlineRects implementations to LayoutSVGModelObject

All of the (direct) subclasses of LayoutSVGModelObject (LayoutSVGImage,
LayoutSVGShape and LayoutSVGContainer) have the same implementation of
this method, so we can push it up to the common base class.

Change-Id: Ief6d4502917c87505ddab436a3c005597615c49b
Reviewed-on: https://chromium-review.googlesource.com/1104344Reviewed-by: default avatarXianzhu Wang <wangxianzhu@chromium.org>
Commit-Queue: Fredrik Söderquist <fs@opera.com>
Cr-Commit-Position: refs/heads/master@{#568072}
parent 08784a11
......@@ -167,13 +167,6 @@ void LayoutSVGContainer::Paint(const PaintInfo& paint_info,
SVGContainerPainter(*this).Paint(paint_info);
}
void LayoutSVGContainer::AddOutlineRects(
Vector<LayoutRect>& rects,
const LayoutPoint&,
IncludeBlockVisualOverflowOrNot) const {
rects.push_back(LayoutRect(VisualRectInLocalSVGCoordinates()));
}
void LayoutSVGContainer::UpdateCachedBoundaries() {
SVGLayoutSupport::ComputeContainerBoundingBoxes(
this, object_bounding_box_, object_bounding_box_valid_,
......
......@@ -79,9 +79,6 @@ class LayoutSVGContainer : public LayoutSVGModelObject {
void AddChild(LayoutObject* child,
LayoutObject* before_child = nullptr) final;
void RemoveChild(LayoutObject*) final;
void AddOutlineRects(Vector<LayoutRect>&,
const LayoutPoint& additional_offset,
IncludeBlockVisualOverflowOrNot) const final;
FloatRect StrokeBoundingBox() const final { return stroke_bounding_box_; }
......
......@@ -196,12 +196,4 @@ void LayoutSVGImage::ImageChanged(WrappedImagePtr,
SetShouldDoFullPaintInvalidation(PaintInvalidationReason::kImage);
}
void LayoutSVGImage::AddOutlineRects(Vector<LayoutRect>& rects,
const LayoutPoint&,
IncludeBlockVisualOverflowOrNot) const {
// this is called from paint() after the localTransform has already been
// applied
rects.push_back(LayoutRect(VisualRectInLocalSVGCoordinates()));
}
} // namespace blink
......@@ -58,10 +58,6 @@ class LayoutSVGImage final : public LayoutSVGModelObject {
private:
FloatRect StrokeBoundingBox() const override { return object_bounding_box_; }
void AddOutlineRects(Vector<LayoutRect>&,
const LayoutPoint& additional_offset,
IncludeBlockVisualOverflowOrNot) const override;
void ImageChanged(WrappedImagePtr,
CanDeferInvalidation,
const IntRect* = nullptr) override;
......
......@@ -87,6 +87,15 @@ void LayoutSVGModelObject::AbsoluteQuads(Vector<FloatQuad>& quads,
quads.push_back(LocalToAbsoluteQuad(StrokeBoundingBox(), mode));
}
// This method is called from inside PaintOutline(), and since we call
// PaintOutline() while transformed to our coord system, return local coords.
void LayoutSVGModelObject::AddOutlineRects(
Vector<LayoutRect>& rects,
const LayoutPoint&,
IncludeBlockVisualOverflowOrNot) const {
rects.push_back(LayoutRect(VisualRectInLocalSVGCoordinates()));
}
FloatRect LayoutSVGModelObject::LocalBoundingBoxRectForAccessibility() const {
return StrokeBoundingBox();
}
......
......@@ -100,6 +100,9 @@ class LayoutSVGModelObject : public LayoutObject {
const HitTestLocation& location_in_container,
const LayoutPoint& accumulated_offset,
HitTestAction) final;
void AddOutlineRects(Vector<LayoutRect>&,
const LayoutPoint& additional_offset,
IncludeBlockVisualOverflowOrNot) const final;
protected:
FloatRect local_visual_rect_;
......
......@@ -347,14 +347,6 @@ void LayoutSVGShape::Paint(const PaintInfo& paint_info,
SVGShapePainter(*this).Paint(paint_info);
}
// This method is called from inside paintOutline() since we call paintOutline()
// while transformed to our coord system, return local coords
void LayoutSVGShape::AddOutlineRects(Vector<LayoutRect>& rects,
const LayoutPoint&,
IncludeBlockVisualOverflowOrNot) const {
rects.push_back(LayoutRect(VisualRectInLocalSVGCoordinates()));
}
bool LayoutSVGShape::NodeAtFloatPoint(HitTestResult& result,
const FloatPoint& point_in_parent,
HitTestAction hit_test_action) {
......
......@@ -156,9 +156,6 @@ class LayoutSVGShape : public LayoutSVGModelObject {
}
void UpdateLayout() final;
void Paint(const PaintInfo&, const LayoutPoint&) const final;
void AddOutlineRects(Vector<LayoutRect>&,
const LayoutPoint& additional_offset,
IncludeBlockVisualOverflowOrNot) const final;
bool NodeAtFloatPoint(HitTestResult&,
const FloatPoint& point_in_parent,
......
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