Commit 54e75eb8 authored by Fredrik Söderqvist's avatar Fredrik Söderqvist Committed by Chromium LUCI CQ

Move SVGResources::SupportsMarkers to layout_svg_path.cc

LayoutSVGPath is now the only user of this function. Currently the set
of elements that should have markers applied equals the set of elements
that create/use LayoutSVGPath, so just DCHECK() this in the constructor
(as future-proofing) and drop the actual check.

Change-Id: Icb3b8aab1dd1b569e16bb14dfade43232d442ca0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2595378Reviewed-by: default avatarStephen Chenney <schenney@chromium.org>
Commit-Queue: Fredrik Söderquist <fs@opera.com>
Cr-Commit-Position: refs/heads/master@{#837983}
parent f28e9465
...@@ -33,9 +33,22 @@ ...@@ -33,9 +33,22 @@
namespace blink { namespace blink {
namespace {
bool SupportsMarkers(const SVGGeometryElement& element) {
return element.HasTagName(svg_names::kLineTag) ||
element.HasTagName(svg_names::kPathTag) ||
element.HasTagName(svg_names::kPolygonTag) ||
element.HasTagName(svg_names::kPolylineTag);
}
} // namespace
LayoutSVGPath::LayoutSVGPath(SVGGeometryElement* node) LayoutSVGPath::LayoutSVGPath(SVGGeometryElement* node)
// <line> elements have no joins and thus needn't care about miters. // <line> elements have no joins and thus needn't care about miters.
: LayoutSVGShape(node, IsA<SVGLineElement>(node) ? kNoMiters : kComplex) {} : LayoutSVGShape(node, IsA<SVGLineElement>(node) ? kNoMiters : kComplex) {
DCHECK(SupportsMarkers(*node));
}
LayoutSVGPath::~LayoutSVGPath() = default; LayoutSVGPath::~LayoutSVGPath() = default;
...@@ -70,8 +83,7 @@ void LayoutSVGPath::UpdateMarkers() { ...@@ -70,8 +83,7 @@ void LayoutSVGPath::UpdateMarkers() {
marker_positions_.clear(); marker_positions_.clear();
const SVGComputedStyle& svg_style = StyleRef().SvgStyle(); const SVGComputedStyle& svg_style = StyleRef().SvgStyle();
if (!svg_style.HasMarkers() || if (!svg_style.HasMarkers())
!SVGResources::SupportsMarkers(*To<SVGGraphicsElement>(GetElement())))
return; return;
SVGElementResourceClient* client = SVGResources::GetClient(*this); SVGElementResourceClient* client = SVGResources::GetClient(*this);
if (!client) if (!client)
......
...@@ -30,7 +30,6 @@ ...@@ -30,7 +30,6 @@
#include "third_party/blink/renderer/core/svg/graphics/filters/svg_filter_builder.h" #include "third_party/blink/renderer/core/svg/graphics/filters/svg_filter_builder.h"
#include "third_party/blink/renderer/core/svg/svg_filter_primitive_standard_attributes.h" #include "third_party/blink/renderer/core/svg/svg_filter_primitive_standard_attributes.h"
#include "third_party/blink/renderer/core/svg/svg_resource.h" #include "third_party/blink/renderer/core/svg/svg_resource.h"
#include "third_party/blink/renderer/core/svg_names.h"
#include "third_party/blink/renderer/platform/graphics/filters/filter.h" #include "third_party/blink/renderer/platform/graphics/filters/filter.h"
#include "third_party/blink/renderer/platform/graphics/filters/filter_effect.h" #include "third_party/blink/renderer/platform/graphics/filters/filter_effect.h"
#include "third_party/blink/renderer/platform/graphics/filters/paint_filter_builder.h" #include "third_party/blink/renderer/platform/graphics/filters/paint_filter_builder.h"
...@@ -63,17 +62,6 @@ FloatRect SVGResources::ReferenceBoxForEffects( ...@@ -63,17 +62,6 @@ FloatRect SVGResources::ReferenceBoxForEffects(
return obb_layout_object->ObjectBoundingBox(); return obb_layout_object->ObjectBoundingBox();
} }
bool SVGResources::SupportsMarkers(const SVGElement& element) {
DEFINE_STATIC_LOCAL(HashSet<AtomicString>, tag_list,
({
svg_names::kLineTag.LocalName(),
svg_names::kPathTag.LocalName(),
svg_names::kPolygonTag.LocalName(),
svg_names::kPolylineTag.LocalName(),
}));
return tag_list.Contains(element.localName());
}
void SVGResources::UpdateClipPathFilterMask(SVGElement& element, void SVGResources::UpdateClipPathFilterMask(SVGElement& element,
const ComputedStyle* old_style, const ComputedStyle* old_style,
const ComputedStyle& style) { const ComputedStyle& style) {
......
...@@ -54,8 +54,6 @@ class SVGResources { ...@@ -54,8 +54,6 @@ class SVGResources {
const ComputedStyle* old_style, const ComputedStyle* old_style,
const ComputedStyle&); const ComputedStyle&);
static void ClearMarkers(SVGElement&, const ComputedStyle*); static void ClearMarkers(SVGElement&, const ComputedStyle*);
static bool SupportsMarkers(const SVGElement&);
}; };
class SVGElementResourceClient final class SVGElementResourceClient final
......
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