Remove dead code for EFillSizeType::kSizeNone

This enumeration value is only used during style resolution, and thus
there should be no need to handle it elsewhere.

This allows cleaning up the ShouldFullyInvalidateFillLayersOn*Change
helpers as well, removing the only users of

StyleImage: :UsesImageContainerSize() and in turn also
Image: :UsesContainerSize(), so removing those as well.
Change-Id: I6400ca9acf98359712891fc74e1a232a2cfbc208
Reviewed-on: https://chromium-review.googlesource.com/c/1486354
Reviewed-by: Stephen Chenney <schenney@chromium.org>
Commit-Queue: Fredrik Söderquist <fs@opera.com>
Cr-Commit-Position: refs/heads/master@{#635137}
diff --git a/third_party/blink/renderer/core/css/css_primitive_value_mappings.h b/third_party/blink/renderer/core/css/css_primitive_value_mappings.h
index b6ce435..37338a6 100644
--- a/third_party/blink/renderer/core/css/css_primitive_value_mappings.h
+++ b/third_party/blink/renderer/core/css/css_primitive_value_mappings.h
@@ -842,8 +842,6 @@
       value_id_ = CSSValueCover;
       break;
     case EFillSizeType::kSizeNone:
-      value_id_ = CSSValueNone;
-      break;
     case EFillSizeType::kSizeLength:
     default:
       NOTREACHED();
diff --git a/third_party/blink/renderer/core/paint/background_image_geometry.cc b/third_party/blink/renderer/core/paint/background_image_geometry.cc
index 581c54c..26b5005 100644
--- a/third_party/blink/renderer/core/paint/background_image_geometry.cc
+++ b/third_party/blink/renderer/core/paint/background_image_geometry.cc
@@ -810,19 +810,6 @@
       tile_size_.ClampNegativeToZero();
       return;
     }
-    case EFillSizeType::kSizeNone: {
-      // If both values are 'auto' then the intrinsic width and/or height of the
-      // image should be used, if any.
-      if (!image_intrinsic_size.IsEmpty()) {
-        tile_size_ = image_intrinsic_size;
-        return;
-      }
-
-      // If the image has neither an intrinsic width nor an intrinsic height,
-      // its size is determined as for 'contain'.
-      type = EFillSizeType::kContain;
-      FALLTHROUGH;
-    }
     case EFillSizeType::kContain:
     case EFillSizeType::kCover: {
       // Always use the snapped positioning area size for this computation,
@@ -871,6 +858,9 @@
       }
       return;
     }
+    case EFillSizeType::kSizeNone:
+      // This value should only be used while resolving style.
+      NOTREACHED();
   }
 
   NOTREACHED();
diff --git a/third_party/blink/renderer/core/paint/box_paint_invalidator.cc b/third_party/blink/renderer/core/paint/box_paint_invalidator.cc
index af885a2f..a6c791c 100644
--- a/third_party/blink/renderer/core/paint/box_paint_invalidator.cc
+++ b/third_party/blink/renderer/core/paint/box_paint_invalidator.cc
@@ -51,16 +51,15 @@
       size_type == EFillSizeType::kCover)
     return true;
 
-  if (size_type == EFillSizeType::kSizeLength) {
-    // TODO(alancutter): Make this work correctly for calc lengths.
-    if (layer.SizeLength().Width().IsPercentOrCalc() &&
-        !layer.SizeLength().Width().IsZero())
-      return true;
-    if (img->IsGeneratedImage() && layer.SizeLength().Width().IsAuto())
-      return true;
-  } else if (img->UsesImageContainerSize()) {
+  DCHECK_EQ(size_type, EFillSizeType::kSizeLength);
+
+  // TODO(alancutter): Make this work correctly for calc lengths.
+  const Length& width = layer.SizeLength().Width();
+  if (width.IsPercentOrCalc() && !width.IsZero())
     return true;
-  }
+
+  if (width.IsAuto() && img->IsGeneratedImage())
+    return true;
 
   return false;
 }
@@ -94,16 +93,15 @@
       size_type == EFillSizeType::kCover)
     return true;
 
-  if (size_type == EFillSizeType::kSizeLength) {
-    // TODO(alancutter): Make this work correctly for calc lengths.
-    if (layer.SizeLength().Height().IsPercentOrCalc() &&
-        !layer.SizeLength().Height().IsZero())
-      return true;
-    if (img->IsGeneratedImage() && layer.SizeLength().Height().IsAuto())
-      return true;
-  } else if (img->UsesImageContainerSize()) {
+  DCHECK_EQ(size_type, EFillSizeType::kSizeLength);
+
+  // TODO(alancutter): Make this work correctly for calc lengths.
+  const Length& height = layer.SizeLength().Height();
+  if (height.IsPercentOrCalc() && !height.IsZero())
     return true;
-  }
+
+  if (height.IsAuto() && img->IsGeneratedImage())
+    return true;
 
   return false;
 }
diff --git a/third_party/blink/renderer/core/style/style_fetched_image.cc b/third_party/blink/renderer/core/style/style_fetched_image.cc
index 1c450e9..b9b97c3e 100644
--- a/third_party/blink/renderer/core/style/style_fetched_image.cc
+++ b/third_party/blink/renderer/core/style/style_fetched_image.cc
@@ -115,10 +115,6 @@
   return image_->GetImage()->HasRelativeSize();
 }
 
-bool StyleFetchedImage::UsesImageContainerSize() const {
-  return image_->GetImage()->UsesContainerSize();
-}
-
 void StyleFetchedImage::AddClient(ImageResourceObserver* observer) {
   image_->AddObserver(observer);
 }
diff --git a/third_party/blink/renderer/core/style/style_fetched_image.h b/third_party/blink/renderer/core/style/style_fetched_image.h
index ccdf41f..2e62c82 100644
--- a/third_party/blink/renderer/core/style/style_fetched_image.h
+++ b/third_party/blink/renderer/core/style/style_fetched_image.h
@@ -64,7 +64,6 @@
                       float multiplier,
                       const LayoutSize& default_object_size) const override;
   bool ImageHasRelativeSize() const override;
-  bool UsesImageContainerSize() const override;
   void AddClient(ImageResourceObserver*) override;
   void RemoveClient(ImageResourceObserver*) override;
   void ImageNotifyFinished(ImageResourceContent*) override;
diff --git a/third_party/blink/renderer/core/style/style_fetched_image_set.cc b/third_party/blink/renderer/core/style/style_fetched_image_set.cc
index 933cc71..b66408e 100644
--- a/third_party/blink/renderer/core/style/style_fetched_image_set.cc
+++ b/third_party/blink/renderer/core/style/style_fetched_image_set.cc
@@ -114,10 +114,6 @@
   return best_fit_image_->GetImage()->HasRelativeSize();
 }
 
-bool StyleFetchedImageSet::UsesImageContainerSize() const {
-  return best_fit_image_->GetImage()->UsesContainerSize();
-}
-
 void StyleFetchedImageSet::AddClient(ImageResourceObserver* observer) {
   best_fit_image_->AddObserver(observer);
 }
diff --git a/third_party/blink/renderer/core/style/style_fetched_image_set.h b/third_party/blink/renderer/core/style/style_fetched_image_set.h
index d032039..5c179e6 100644
--- a/third_party/blink/renderer/core/style/style_fetched_image_set.h
+++ b/third_party/blink/renderer/core/style/style_fetched_image_set.h
@@ -75,7 +75,6 @@
                       float multiplier,
                       const LayoutSize& default_object_size) const override;
   bool ImageHasRelativeSize() const override;
-  bool UsesImageContainerSize() const override;
   void AddClient(ImageResourceObserver*) override;
   void RemoveClient(ImageResourceObserver*) override;
   scoped_refptr<Image> GetImage(const ImageResourceObserver&,
diff --git a/third_party/blink/renderer/core/style/style_generated_image.h b/third_party/blink/renderer/core/style/style_generated_image.h
index f1046f2..0126e08 100644
--- a/third_party/blink/renderer/core/style/style_generated_image.h
+++ b/third_party/blink/renderer/core/style/style_generated_image.h
@@ -53,7 +53,6 @@
                       float multiplier,
                       const LayoutSize& default_object_size) const override;
   bool ImageHasRelativeSize() const override { return !fixed_size_; }
-  bool UsesImageContainerSize() const override { return !fixed_size_; }
   void AddClient(ImageResourceObserver*) override;
   void RemoveClient(ImageResourceObserver*) override;
   // The |target_size| is the desired image size
diff --git a/third_party/blink/renderer/core/style/style_image.h b/third_party/blink/renderer/core/style/style_image.h
index 33bd386..cb6c0b6 100644
--- a/third_party/blink/renderer/core/style/style_image.h
+++ b/third_party/blink/renderer/core/style/style_image.h
@@ -92,10 +92,6 @@
   // The <image> does not have any intrinsic dimensions.
   virtual bool ImageHasRelativeSize() const = 0;
 
-  // The <image> may depend on dimensions from the context the image is used in
-  // (the "container".)
-  virtual bool UsesImageContainerSize() const = 0;
-
   virtual void AddClient(ImageResourceObserver*) = 0;
   virtual void RemoveClient(ImageResourceObserver*) = 0;
 
diff --git a/third_party/blink/renderer/core/style/style_pending_image.h b/third_party/blink/renderer/core/style/style_pending_image.h
index c779060..733a56b0 100644
--- a/third_party/blink/renderer/core/style/style_pending_image.h
+++ b/third_party/blink/renderer/core/style/style_pending_image.h
@@ -83,7 +83,6 @@
     return FloatSize();
   }
   bool ImageHasRelativeSize() const override { return false; }
-  bool UsesImageContainerSize() const override { return false; }
   void AddClient(ImageResourceObserver*) override {}
   void RemoveClient(ImageResourceObserver*) override {}
   scoped_refptr<Image> GetImage(const ImageResourceObserver&,
diff --git a/third_party/blink/renderer/core/svg/graphics/svg_image.h b/third_party/blink/renderer/core/svg/graphics/svg_image.h
index f9caf52..67bf415 100644
--- a/third_party/blink/renderer/core/svg/graphics/svg_image.h
+++ b/third_party/blink/renderer/core/svg/graphics/svg_image.h
@@ -141,7 +141,6 @@
   String FilenameExtension() const override;
 
   IntSize ContainerSize() const;
-  bool UsesContainerSize() const override { return true; }
 
   SizeAvailability DataChanged(bool all_data_received) override;
 
diff --git a/third_party/blink/renderer/core/svg/graphics/svg_image_for_container.h b/third_party/blink/renderer/core/svg/graphics/svg_image_for_container.h
index bf81d1c3..220c397 100644
--- a/third_party/blink/renderer/core/svg/graphics/svg_image_for_container.h
+++ b/third_party/blink/renderer/core/svg/graphics/svg_image_for_container.h
@@ -71,9 +71,6 @@
 
   IntSize Size() const override;
 
-  bool UsesContainerSize() const override {
-    return image_->UsesContainerSize();
-  }
   bool HasRelativeSize() const override { return image_->HasRelativeSize(); }
 
   bool ApplyShader(cc::PaintFlags&, const SkMatrix& local_matrix) override;
diff --git a/third_party/blink/renderer/platform/graphics/crossfade_generated_image.h b/third_party/blink/renderer/platform/graphics/crossfade_generated_image.h
index 53bad76..878a1b3 100644
--- a/third_party/blink/renderer/platform/graphics/crossfade_generated_image.h
+++ b/third_party/blink/renderer/platform/graphics/crossfade_generated_image.h
@@ -47,7 +47,6 @@
                                     percentage, crossfade_size, size));
   }
 
-  bool UsesContainerSize() const override { return false; }
   bool HasRelativeSize() const override { return false; }
 
   IntSize Size() const override { return FlooredIntSize(crossfade_size_); }
diff --git a/third_party/blink/renderer/platform/graphics/generated_image.h b/third_party/blink/renderer/platform/graphics/generated_image.h
index 905b930..7650e462 100644
--- a/third_party/blink/renderer/platform/graphics/generated_image.h
+++ b/third_party/blink/renderer/platform/graphics/generated_image.h
@@ -36,7 +36,6 @@
  public:
   bool CurrentFrameHasSingleSecurityOrigin() const override { return true; }
 
-  bool UsesContainerSize() const override { return true; }
   bool HasRelativeSize() const override { return true; }
 
   IntSize Size() const override { return RoundedIntSize(size_); }
diff --git a/third_party/blink/renderer/platform/graphics/image.h b/third_party/blink/renderer/platform/graphics/image.h
index eb96eac..e9c635b 100644
--- a/third_party/blink/renderer/platform/graphics/image.h
+++ b/third_party/blink/renderer/platform/graphics/image.h
@@ -106,7 +106,6 @@
   static Image* NullImage();
   bool IsNull() const { return Size().IsEmpty(); }
 
-  virtual bool UsesContainerSize() const { return false; }
   virtual bool HasRelativeSize() const { return false; }
 
   virtual IntSize Size() const = 0;