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

Pass oBB to SVGLayoutSupport::AdjustVisualRectWithResources

Most callsites have easy (even trivial) access to the object bounding
box (oBB), so just pass it as a parameter.

Change-Id: I2ec67dbea178356a3130bcef27204875143cf26c
Reviewed-on: https://chromium-review.googlesource.com/1245444Reviewed-by: default avatarStephen Chenney <schenney@chromium.org>
Commit-Queue: Fredrik Söderquist <fs@opera.com>
Cr-Commit-Position: refs/heads/master@{#594300}
parent 142e86c4
......@@ -142,7 +142,8 @@ void LayoutSVGImage::UpdateLayout() {
if (needs_boundaries_update_) {
local_visual_rect_ = object_bounding_box_;
SVGLayoutSupport::AdjustVisualRectWithResources(*this, local_visual_rect_);
SVGLayoutSupport::AdjustVisualRectWithResources(*this, object_bounding_box_,
local_visual_rect_);
needs_boundaries_update_ = false;
update_parent_boundaries = true;
}
......
......@@ -277,7 +277,8 @@ void LayoutSVGShape::UpdateLayout() {
needs_shape_update_ = false;
local_visual_rect_ = StrokeBoundingBox();
SVGLayoutSupport::AdjustVisualRectWithResources(*this, local_visual_rect_);
SVGLayoutSupport::AdjustVisualRectWithResources(*this, ObjectBoundingBox(),
local_visual_rect_);
needs_boundaries_update_ = false;
update_parent_boundaries = true;
......
......@@ -391,7 +391,8 @@ FloatRect LayoutSVGText::StrokeBoundingBox() const {
FloatRect LayoutSVGText::VisualRectInLocalSVGCoordinates() const {
FloatRect visual_rect = StrokeBoundingBox();
SVGLayoutSupport::AdjustVisualRectWithResources(*this, visual_rect);
SVGLayoutSupport::AdjustVisualRectWithResources(*this, ObjectBoundingBox(),
visual_rect);
if (const ShadowList* text_shadow = StyleRef().TextShadow())
text_shadow->AdjustRectForShadow(visual_rect);
......
......@@ -262,7 +262,8 @@ void SVGLayoutSupport::ComputeContainerBoundingBoxes(
}
local_visual_rect = stroke_bounding_box;
AdjustVisualRectWithResources(*container, local_visual_rect);
AdjustVisualRectWithResources(*container, object_bounding_box,
local_visual_rect);
}
const LayoutSVGRoot* SVGLayoutSupport::FindTreeRootObject(
......@@ -386,26 +387,21 @@ bool SVGLayoutSupport::IsOverflowHidden(const ComputedStyle& style) {
void SVGLayoutSupport::AdjustVisualRectWithResources(
const LayoutObject& layout_object,
const FloatRect& object_bounding_box,
FloatRect& visual_rect) {
SVGResources* resources =
SVGResourcesCache::CachedResourcesForLayoutObject(layout_object);
if (!resources)
return;
if (LayoutSVGResourceFilter* filter = resources->Filter()) {
visual_rect =
filter->ResourceBoundingBox(layout_object.ObjectBoundingBox());
}
if (LayoutSVGResourceFilter* filter = resources->Filter())
visual_rect = filter->ResourceBoundingBox(object_bounding_box);
if (LayoutSVGResourceClipper* clipper = resources->Clipper()) {
visual_rect.Intersect(
clipper->ResourceBoundingBox(layout_object.ObjectBoundingBox()));
}
if (LayoutSVGResourceClipper* clipper = resources->Clipper())
visual_rect.Intersect(clipper->ResourceBoundingBox(object_bounding_box));
if (LayoutSVGResourceMasker* masker = resources->Masker()) {
visual_rect.Intersect(
masker->ResourceBoundingBox(layout_object.ObjectBoundingBox()));
}
if (LayoutSVGResourceMasker* masker = resources->Masker())
visual_rect.Intersect(masker->ResourceBoundingBox(object_bounding_box));
}
bool SVGLayoutSupport::HasFilterResource(const LayoutObject& object) {
......
......@@ -65,7 +65,10 @@ class CORE_EXPORT SVGLayoutSupport {
// Adjusts the visualRect in combination with filter, clipper and masker
// in local coordinates.
static void AdjustVisualRectWithResources(const LayoutObject&, FloatRect&);
static void AdjustVisualRectWithResources(
const LayoutObject&,
const FloatRect& object_bounding_box,
FloatRect&);
// Determine if the LayoutObject references a filter resource object.
static bool HasFilterResource(const LayoutObject&);
......
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