Restructure cycle checking in SVGUseElement

Hoist call to ResolveTargetElement() out of HasCycleUseReferencing(),
leaving the latter only checking for cycles.
Drop the InUseShadowTree() check from BuildShadowAndInstanceTree since
its single caller checks it already.
Use ToSVGElementOrNull to simplify the code a bit.

Bug: 397525
Cq-Include-Trybots: luci.chromium.try:linux_layout_tests_slimming_paint_v2;master.tryserver.blink:linux_trusty_blink_rel
Change-Id: Idb6cbd9e155d6217db77ef97299e77fa57cd0d8d
Reviewed-on: https://chromium-review.googlesource.com/c/1257918
Reviewed-by: Philip Rogers <pdr@chromium.org>
Commit-Queue: Fredrik Söderquist <fs@opera.com>
Cr-Commit-Position: refs/heads/master@{#596202}
2 files changed