Use pre-resolved resource in SVGPatternElement::ReferencedElement

SVGPatternElement::BuildPendingResource() resolves a resource reference
for 'href' on the <pattern> element using the TreeScope-based "resource
store". SVGPatternElement::ReferencedElement() (re-)resolves the same
reference on its own. Because of this inconsistency we could end up
having a reference to a LayoutObject in the associated SVGResources
object, but not have hooked up a client reference for the (originating)
<pattern> element.

Use the SVGResource to resolve the target element in ReferencedElement()
too so that there's only one source of truth.

Bug: 949015
Change-Id: I001c4f9260bdc4599843cd53833b749fd320daa5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1550426
Reviewed-by: Stephen Chenney <schenney@chromium.org>
Commit-Queue: Fredrik Söderquist <fs@opera.com>
Cr-Commit-Position: refs/heads/master@{#647295}
2 files changed