Don't trigger re-layout when 'stroke' changes

Layout only checks for existence of 'stroke', using it to determine
whether stroke bounds should be computed or not.

Bug: 435097
Change-Id: I1b25d4da7f2d5215beadaa4f1941c5d9c8243500
Reviewed-on: https://chromium-review.googlesource.com/c/1491254
Reviewed-by: Philip Rogers <pdr@chromium.org>
Commit-Queue: Fredrik Söderquist <fs@opera.com>
Cr-Commit-Position: refs/heads/master@{#636010}
diff --git a/third_party/blink/renderer/core/style/svg_computed_style.cc b/third_party/blink/renderer/core/style/svg_computed_style.cc
index e91ce74..1884c0c 100644
--- a/third_party/blink/renderer/core/style/svg_computed_style.cc
+++ b/third_party/blink/renderer/core/style/svg_computed_style.cc
@@ -171,9 +171,11 @@
   // need to be recalculated.
   if (stroke.Get() != other->stroke.Get()) {
     if (stroke->width != other->stroke->width ||
-        stroke->paint != other->stroke->paint ||
-        stroke->miter_limit != other->stroke->miter_limit ||
-        stroke->visited_link_paint != other->stroke->visited_link_paint)
+        stroke->miter_limit != other->stroke->miter_limit)
+      return true;
+    // If the stroke is toggled from/to 'none' we need to relayout, because the
+    // stroke shape will have changed.
+    if (stroke->paint.IsNone() != other->stroke->paint.IsNone())
       return true;
     // If the dash array is toggled from/to 'none' we need to relayout, because
     // some shapes will decide on which codepath to use based on the presence
@@ -192,7 +194,9 @@
 bool SVGComputedStyle::DiffNeedsPaintInvalidation(
     const SVGComputedStyle* other) const {
   if (stroke.Get() != other->stroke.Get()) {
-    if (stroke->opacity != other->stroke->opacity)
+    if (stroke->paint != other->stroke->paint ||
+        stroke->opacity != other->stroke->opacity ||
+        stroke->visited_link_paint != other->stroke->visited_link_paint)
       return true;
     // Changes to the dash effect only require a repaint because we don't
     // include it when computing (approximating) the stroke boundaries during