Commit b7dd4ea7 authored by Fredrik Söderqvist's avatar Fredrik Söderqvist Committed by Commit Bot

Return const SVGViewSpec* from SVGViewSpec::Create*

The returned object shouldn't be mutable (and cannot be mutated).

Change-Id: I2213472fe99fb64acc95bf8e3e45307bc895b0ab
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2517727
Commit-Queue: Stephen Chenney <schenney@chromium.org>
Auto-Submit: Fredrik Söderquist <fs@opera.com>
Reviewed-by: default avatarStephen Chenney <schenney@chromium.org>
Cr-Commit-Position: refs/heads/master@{#824103}
parent 6c56fd8a
......@@ -689,7 +689,7 @@ void SVGSVGElement::SetViewSpec(const SVGViewSpec* view_spec) {
void SVGSVGElement::SetupInitialView(const String& fragment_identifier,
Element* anchor_node) {
if (fragment_identifier.StartsWith("svgView(")) {
SVGViewSpec* view_spec =
const SVGViewSpec* view_spec =
SVGViewSpec::CreateFromFragment(fragment_identifier);
if (view_spec) {
UseCounter::Count(GetDocument(),
......@@ -704,7 +704,7 @@ void SVGSVGElement::SetupInitialView(const String& fragment_identifier,
// displayed in the SVG viewport. Any view specification attributes included
// on the given 'view' element override the corresponding view specification
// attributes on the root 'svg' element.
SVGViewSpec* view_spec =
const SVGViewSpec* view_spec =
SVGViewSpec::CreateForViewElement(*svg_view_element);
UseCounter::Count(GetDocument(),
WebFeature::kSVGSVGElementFragmentSVGViewElement);
......
......@@ -40,14 +40,15 @@ void SVGViewSpec::Trace(Visitor* visitor) const {
visitor->Trace(transform_);
}
SVGViewSpec* SVGViewSpec::CreateFromFragment(const String& fragment) {
const SVGViewSpec* SVGViewSpec::CreateFromFragment(const String& fragment) {
SVGViewSpec* view_spec = MakeGarbageCollected<SVGViewSpec>();
if (!view_spec->ParseViewSpec(fragment))
return nullptr;
return view_spec;
}
SVGViewSpec* SVGViewSpec::CreateForViewElement(const SVGViewElement& view) {
const SVGViewSpec* SVGViewSpec::CreateForViewElement(
const SVGViewElement& view) {
SVGViewSpec* view_spec = MakeGarbageCollected<SVGViewSpec>();
if (view.viewBox()->CurrentValue()->IsValid())
view_spec->view_box_ = view.viewBox()->CurrentValue()->Clone();
......
......@@ -32,8 +32,8 @@ class SVGViewElement;
class SVGViewSpec final : public GarbageCollected<SVGViewSpec> {
public:
static SVGViewSpec* CreateFromFragment(const String&);
static SVGViewSpec* CreateForViewElement(const SVGViewElement&);
static const SVGViewSpec* CreateFromFragment(const String&);
static const SVGViewSpec* CreateForViewElement(const SVGViewElement&);
SVGViewSpec();
......
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