Commit 1e9aa110 authored by Abhijeet Kandalkar's avatar Abhijeet Kandalkar Committed by Commit Bot

Use new downcast helper for blink::SVGPatternElement

This CL has goal to use To<SVGPatternElement> and
DynamicTo<SVGPatternElement> as new downcast helper

Bug: 891908
Change-Id: Ibcc937ce3e849c5132d7e412246eb32268e16f87
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1936614Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Commit-Queue: Abhijeet | Igalia <abhijeet@igalia.com>
Cr-Commit-Position: refs/heads/master@{#720118}
parent 698a81d2
...@@ -145,7 +145,7 @@ SVGPaintServer LayoutSVGResourcePattern::PreparePaintServer( ...@@ -145,7 +145,7 @@ SVGPaintServer LayoutSVGResourcePattern::PreparePaintServer(
// no side-effects though. // no side-effects though.
if (should_collect_pattern_attributes_) { if (should_collect_pattern_attributes_) {
attributes_wrapper_->Set(PatternAttributes()); attributes_wrapper_->Set(PatternAttributes());
SVGPatternElement* pattern_element = ToSVGPatternElement(GetElement()); auto* pattern_element = To<SVGPatternElement>(GetElement());
pattern_element->CollectPatternAttributes(MutableAttributes()); pattern_element->CollectPatternAttributes(MutableAttributes());
should_collect_pattern_attributes_ = false; should_collect_pattern_attributes_ = false;
} }
......
...@@ -593,7 +593,7 @@ void WriteSVGResourceContainer(WTF::TextStream& ts, ...@@ -593,7 +593,7 @@ void WriteSVGResourceContainer(WTF::TextStream& ts,
// patterns using xlink:href, we need to build the full inheritance chain, // patterns using xlink:href, we need to build the full inheritance chain,
// aka. collectPatternProperties() // aka. collectPatternProperties()
PatternAttributes attributes; PatternAttributes attributes;
ToSVGPatternElement(pattern->GetElement()) To<SVGPatternElement>(pattern->GetElement())
->CollectPatternAttributes(attributes); ->CollectPatternAttributes(attributes);
WriteNameValuePair(ts, "patternUnits", attributes.PatternUnits()); WriteNameValuePair(ts, "patternUnits", attributes.PatternUnits());
......
...@@ -232,7 +232,7 @@ std::unique_ptr<SVGResources> SVGResources::BuildResources( ...@@ -232,7 +232,7 @@ std::unique_ptr<SVGResources> SVGResources::BuildResources(
} }
} }
if (auto* pattern = ToSVGPatternElementOrNull(element)) { if (auto* pattern = DynamicTo<SVGPatternElement>(element)) {
const SVGPatternElement* directly_referenced_pattern = const SVGPatternElement* directly_referenced_pattern =
pattern->ReferencedElement(); pattern->ReferencedElement();
if (directly_referenced_pattern) { if (directly_referenced_pattern) {
......
...@@ -250,7 +250,8 @@ static void SetPatternAttributes(const SVGPatternElement& element, ...@@ -250,7 +250,8 @@ static void SetPatternAttributes(const SVGPatternElement& element,
} }
const SVGPatternElement* SVGPatternElement::ReferencedElement() const { const SVGPatternElement* SVGPatternElement::ReferencedElement() const {
return ToSVGPatternElementOrNull(resource_ ? resource_->Target() : nullptr); return DynamicTo<SVGPatternElement>(resource_ ? resource_->Target()
: nullptr);
} }
void SVGPatternElement::CollectPatternAttributes( void SVGPatternElement::CollectPatternAttributes(
......
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