diff --git a/core/modules/image/image.post_update.php b/core/modules/image/image.post_update.php
new file mode 100644
index 0000000..04d8c4b
--- /dev/null
+++ b/core/modules/image/image.post_update.php
@@ -0,0 +1,22 @@
+<?php
+
+/**
+ * @file
+ * Post-update functions for Image.
+ */
+
+use Drupal\Core\Entity\Entity\EntityViewDisplay;
+use Drupal\Core\Entity\Entity\EntityFormDisplay;
+
+/**
+ * Saves the image style dependencies into form and view display entities.
+ */
+function image_post_update_image_style_dependencies() {
+  // Merge view and form displays. Use array_values() to avoid key collisions.
+  $displays = array_merge(array_values(EntityViewDisplay::loadMultiple()), array_values(EntityFormDisplay::loadMultiple()));
+  /** @var \Drupal\Core\Entity\Display\EntityDisplayInterface[] $displays */
+  foreach ($displays as $display) {
+    // Re-save each config entity to add missed dependencies.
+    $display->save();
+  }
+}
diff --git a/core/modules/image/src/Entity/ImageStyle.php b/core/modules/image/src/Entity/ImageStyle.php
index f3d0207..85f4ceb 100644
--- a/core/modules/image/src/Entity/ImageStyle.php
+++ b/core/modules/image/src/Entity/ImageStyle.php
@@ -36,6 +36,7 @@
  *       "flush" = "Drupal\image\Form\ImageStyleFlushForm"
  *     },
  *     "list_builder" = "Drupal\image\ImageStyleListBuilder",
+ *     "storage" = "Drupal\image\ImageStyleStorage",
  *   },
  *   admin_permission = "administer image styles",
  *   config_prefix = "style",
@@ -59,13 +60,6 @@
 class ImageStyle extends ConfigEntityBase implements ImageStyleInterface, EntityWithPluginCollectionInterface {
 
   /**
-   * The name of the image style to use as replacement upon delete.
-   *
-   * @var string
-   */
-  protected $replacementID;
-
-  /**
    * The name of the image style.
    *
    * @var string
@@ -128,17 +122,13 @@ public function postSave(EntityStorageInterface $storage, $update = TRUE) {
   public static function postDelete(EntityStorageInterface $storage, array $entities) {
     parent::postDelete($storage, $entities);
 
+    /** @var \Drupal\image\ImageStyleInterface[] $entities */
     foreach ($entities as $style) {
       // Flush cached media for the deleted style.
       $style->flush();
-      // Check whether field settings need to be updated.
-      // In case no replacement style was specified, all image fields that are
-      // using the deleted style are left in a broken state.
-      if (!$style->isSyncing() && $new_id = $style->getReplacementID()) {
-        // The deleted ID is still set as originalID.
-        $style->setName($new_id);
-        static::replaceImageStyle($style);
-      }
+      // Clear the replacement ID, if one has been previously stored.
+      /** @var \Drupal\image\ImageStyleStorageInterface $storage */
+      $storage->clearReplacementId($style->id());
     }
   }
 
@@ -380,7 +370,9 @@ public function addImageEffect(array $configuration) {
    * {@inheritdoc}
    */
   public function getReplacementID() {
-    return $this->get('replacementID');
+    /** @var \Drupal\image\ImageStyleStorageInterface $storage */
+    $storage = $this->entityTypeManager()->getStorage($this->getEntityTypeId());
+    return $storage->getReplacementId($this->id());
   }
 
   /**
diff --git a/core/modules/image/src/Form/ImageStyleDeleteForm.php b/core/modules/image/src/Form/ImageStyleDeleteForm.php
index 5c45d94..1e1830e 100644
--- a/core/modules/image/src/Form/ImageStyleDeleteForm.php
+++ b/core/modules/image/src/Form/ImageStyleDeleteForm.php
@@ -7,6 +7,8 @@
 
 namespace Drupal\image\Form;
 
+use Drupal\Core\Entity\Entity\EntityFormDisplay;
+use Drupal\Core\Entity\Entity\EntityViewDisplay;
 use Drupal\Core\Entity\EntityDeleteForm;
 use Drupal\Core\Form\FormStateInterface;
 
@@ -18,27 +20,36 @@ class ImageStyleDeleteForm extends EntityDeleteForm {
   /**
    * {@inheritdoc}
    */
-  public function getQuestion() {
-    return $this->t('Optionally select a style before deleting %style', array('%style' => $this->entity->label()));
-  }
-  /**
-   * {@inheritdoc}
-   */
   public function getDescription() {
-    return $this->t('If this style is in use on the site, you may select another style to replace it. All images that have been generated for this style will be permanently deleted.');
+    return $this->t('All images that have been generated for this style will be permanently deleted.');
   }
 
   /**
    * {@inheritdoc}
    */
   public function form(array $form, FormStateInterface $form_state) {
-    $replacement_styles = array_diff_key(image_style_options(), array($this->entity->id() => ''));
-    $form['replacement'] = array(
-      '#title' => $this->t('Replacement style'),
-      '#type' => 'select',
-      '#options' => $replacement_styles,
-      '#empty_option' => $this->t('No replacement, just delete'),
-    );
+    // If there are components relying on this image style show a warning
+    // message and if case, the image style replacement select.
+    if ($this->hasAffectedComponents()) {
+      $replacement_styles = array_diff_key(image_style_options(), [$this->entity->id() => '']);
+
+      // If there are non-empty options in the list, allow the user to
+      // optionally pick up a replacement.
+      if (count($replacement_styles) > 1) {
+        $form['replacement'] = [
+          '#type' => 'select',
+          '#title' => $this->t('Replacement style'),
+          '#description' => $this->t("The %style image style you are about to delete is used in existing field formatters and widgets. You may select another image style to replace it. If no replacement style is selected, the corresponding field formatters will be disabled and might need manual reconfiguration.", ['%style' => $this->entity->label()]),
+          '#options' => $replacement_styles,
+          '#empty_option' => $this->t('- No replacement -'),
+        ];
+      }
+      else {
+        $form['warning'] = [
+          '#markup' => $this->t("The %style image style you are about to delete is used in existing field formatters and widgets. Those formatters will be disabled and might need manual reconfiguration.", ['%style' => $this->entity->label()]),
+        ];
+      }
+    }
 
     return parent::form($form, $form_state);
   }
@@ -47,9 +58,43 @@ public function form(array $form, FormStateInterface $form_state) {
    * {@inheritdoc}
    */
   public function submitForm(array &$form, FormStateInterface $form_state) {
-    $this->entity->set('replacementID', $form_state->getValue('replacement'));
-
+    // Save a selected replacement in the image style storage. It will be used
+    // later, in the same request, when resolving dependencies.
+    if ($replacement = $form_state->getValue('replacement')) {
+      /** @var \Drupal\image\ImageStyleStorageInterface $storage */
+      $storage = $this->entityTypeManager->getStorage($this->entity->getEntityTypeId());
+      $storage->setReplacementId($this->entity->id(), $replacement);
+    }
     parent::submitForm($form, $form_state);
   }
 
+  /**
+   * Checks if there are components using the image style being deleted.
+   *
+   * @return bool
+   *   TRUE if at least one component is using the image style, FALSE otherwise.
+   */
+  protected function hasAffectedComponents() {
+    // Merge view and form displays. Use array_values() to avoid key collisions.
+    $displays = array_merge(array_values(EntityViewDisplay::loadMultiple()), array_values(EntityFormDisplay::loadMultiple()));
+    /** @var \Drupal\Core\Entity\Display\EntityDisplayInterface $display */
+    foreach ($displays as $display) {
+      $dependencies = $display->getDependencies() + ['config' => []];
+      // If this image style is not a dependency of the whole display, do not
+      // descend into components because component dependencies are part of
+      // display dependencies.
+      if (in_array($this->entity->getConfigDependencyName(), $dependencies['config'])) {
+        foreach ($display->getComponents() as $name => $options) {
+          if ($renderer = $display->getRenderer($name)) {
+            $plugin_dependencies = $renderer->calculateDependencies() + ['config' => []];
+            if (in_array($this->entity->getConfigDependencyName(), $plugin_dependencies['config'])) {
+              return TRUE;
+            }
+          }
+        }
+      }
+    }
+    return FALSE;
+  }
+
 }
diff --git a/core/modules/image/src/ImageStyleInterface.php b/core/modules/image/src/ImageStyleInterface.php
index 9507291..1571278 100644
--- a/core/modules/image/src/ImageStyleInterface.php
+++ b/core/modules/image/src/ImageStyleInterface.php
@@ -17,8 +17,14 @@
   /**
    * Returns the replacement ID.
    *
-   * @return string
-   *   The name of the image style to use as replacement upon delete.
+   * @return string|null
+   *   The replacement image style ID or NULL if no replacement has been
+   *   selected.
+   *
+   * @deprecated in Drupal 8.0.x, will be removed in Drupal 9.0.x. Use
+   *   \Drupal\image\ImageStyleStorageInterface::getReplacementId() instead.
+   *
+   * @see \Drupal\image\ImageStyleStorageInterface::getReplacementId()
    */
   public function getReplacementID();
 
diff --git a/core/modules/image/src/ImageStyleStorage.php b/core/modules/image/src/ImageStyleStorage.php
new file mode 100644
index 0000000..143bde8
--- /dev/null
+++ b/core/modules/image/src/ImageStyleStorage.php
@@ -0,0 +1,48 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\image\ImageStyleStorage.
+ */
+
+namespace Drupal\image;
+
+use Drupal\Core\Config\Entity\ConfigEntityStorage;
+
+class ImageStyleStorage extends ConfigEntityStorage implements ImageStyleStorageInterface {
+
+  /**
+   * Image style replacement memory storage.
+   *
+   * This value is not stored in the backend. It's used during the deletion of
+   * an image style to save the replacement image style in the same request. The
+   * value is used later, when resolving dependencies.
+   *
+   * @var string[]
+   *
+   * @see \Drupal\image\Form\ImageStyleDeleteForm::submitForm()
+   */
+  protected $replacement = [];
+
+  /**
+   * {@inheritdoc}
+   */
+  public function setReplacementId($name, $replacement) {
+    $this->replacement[$name] = $replacement;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function getReplacementId($name) {
+    return isset($this->replacement[$name]) ? $this->replacement[$name] : NULL;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function clearReplacementId($name) {
+    unset($this->replacement[$name]);
+  }
+
+}
diff --git a/core/modules/image/src/ImageStyleStorageInterface.php b/core/modules/image/src/ImageStyleStorageInterface.php
new file mode 100644
index 0000000..acfdcbf
--- /dev/null
+++ b/core/modules/image/src/ImageStyleStorageInterface.php
@@ -0,0 +1,54 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\image\ImageStyleStorageInterface.
+ */
+
+namespace Drupal\image;
+
+interface ImageStyleStorageInterface {
+
+  /**
+   * Stores a replacement ID for an image style being deleted.
+   *
+   * The method stores a replacement style to be used by the configuration
+   * dependency system when a image style is deleted. The replacement style is
+   * replacing the deleted style in other configuration entities that are
+   * depending on the image style being deleted.
+   *
+   * @param string $name
+   *   The ID of the image style to be deleted.
+   * @param string $replacement
+   *   The ID of the image style used as replacement.
+   */
+  public function setReplacementId($name, $replacement);
+
+  /**
+   * Retrieves the replacement ID of a deleted image style.
+   *
+   * The method is retrieving the value stored by ::setReplacementId().
+   *
+   * @param string $name
+   *   The ID of the image style to be replaced.
+   *
+   * @return string|null
+   *   The ID of the image style used as replacement, if there's any, or NULL.
+   *
+   * @see \Drupal\image\ImageStyleStorageInterface::setReplacementId().
+   */
+  public function getReplacementId($name);
+
+  /**
+   * Clears a replacement ID from the storage.
+   *
+   * The method clears the value previously stored with ::setReplacementId().
+   *
+   * @param string $name
+   *   The ID of the image style to be replaced.
+   *
+   * @see \Drupal\image\ImageStyleStorageInterface::setReplacementId().
+   */
+  public function clearReplacementId($name);
+
+}
diff --git a/core/modules/image/src/Plugin/Field/FieldFormatter/ImageFormatter.php b/core/modules/image/src/Plugin/Field/FieldFormatter/ImageFormatter.php
index 5720415..2df32cf 100644
--- a/core/modules/image/src/Plugin/Field/FieldFormatter/ImageFormatter.php
+++ b/core/modules/image/src/Plugin/Field/FieldFormatter/ImageFormatter.php
@@ -14,6 +14,7 @@
 use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
 use Drupal\Core\Session\AccountInterface;
 use Drupal\Core\Url;
+use Drupal\image\Entity\ImageStyle;
 use Symfony\Component\DependencyInjection\ContainerInterface;
 use Drupal\Core\Form\FormStateInterface;
 use Drupal\Core\Cache\Cache;
@@ -41,7 +42,7 @@ class ImageFormatter extends ImageFormatterBase implements ContainerFactoryPlugi
   /**
    * The image style entity storage.
    *
-   * @var \Drupal\Core\Entity\EntityStorageInterface
+   * @var \Drupal\image\ImageStyleStorageInterface
    */
   protected $imageStyleStorage;
 
@@ -226,4 +227,41 @@ public function viewElements(FieldItemListInterface $items, $langcode) {
     return $elements;
   }
 
+  /**
+   * {@inheritdoc}
+   */
+  public function calculateDependencies() {
+    $dependencies = parent::calculateDependencies();
+    $style_id = $this->getSetting('image_style');
+    /** @var \Drupal\image\ImageStyleInterface $style */
+    if ($style_id && $style = ImageStyle::load($style_id)) {
+      // If this formatter uses a valid image style to display the image, add
+      // the image style configuration entity as dependency of this formatter.
+      $dependencies[$style->getConfigDependencyKey()][] = $style->getConfigDependencyName();
+    }
+    return $dependencies;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function onDependencyRemoval(array $dependencies) {
+    $changed = parent::onDependencyRemoval($dependencies);
+    $style_id = $this->getSetting('image_style');
+    /** @var \Drupal\image\ImageStyleInterface $style */
+    if ($style_id && $style = ImageStyle::load($style_id)) {
+      if (!empty($dependencies[$style->getConfigDependencyKey()][$style->getConfigDependencyName()])) {
+        $replacement_id = $this->imageStyleStorage->getReplacementId($style_id);
+        // If a valid replacement has been provided in the storage, replace the
+        // image style with the replacement and signal that the formatter plugin
+        // settings were updated.
+        if ($replacement_id && ImageStyle::load($replacement_id)) {
+          $this->setSetting('image_style', $replacement_id);
+          $changed = TRUE;
+        }
+      }
+    }
+    return $changed;
+  }
+
 }
diff --git a/core/modules/image/src/Plugin/Field/FieldWidget/ImageWidget.php b/core/modules/image/src/Plugin/Field/FieldWidget/ImageWidget.php
index 82092e6..10ebfb5 100644
--- a/core/modules/image/src/Plugin/Field/FieldWidget/ImageWidget.php
+++ b/core/modules/image/src/Plugin/Field/FieldWidget/ImageWidget.php
@@ -12,6 +12,7 @@
 use Drupal\Core\Form\FormStateInterface;
 use Drupal\file\Entity\File;
 use Drupal\file\Plugin\Field\FieldWidget\FileWidget;
+use Drupal\image\Entity\ImageStyle;
 
 /**
  * Plugin implementation of the 'image_image' widget.
@@ -273,4 +274,49 @@ public static function validateRequiredFields($element, FormStateInterface $form
     }
   }
 
+  /**
+   * {@inheritdoc}
+   */
+  public function calculateDependencies() {
+    $dependencies = parent::calculateDependencies();
+    $style_id = $this->getSetting('preview_image_style');
+    /** @var \Drupal\image\ImageStyleInterface $style */
+    if ($style_id && $style = ImageStyle::load($style_id)) {
+      // If this widget uses a valid image style to display the preview of the
+      // uploaded image, add that image style configuration entity as dependency
+      // of this widget.
+      $dependencies[$style->getConfigDependencyKey()][] = $style->getConfigDependencyName();
+    }
+    return $dependencies;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function onDependencyRemoval(array $dependencies) {
+    $changed = parent::onDependencyRemoval($dependencies);
+    $style_id = $this->getSetting('preview_image_style');
+    /** @var \Drupal\image\ImageStyleInterface $style */
+    if ($style_id && $style = ImageStyle::load($style_id)) {
+      if (!empty($dependencies[$style->getConfigDependencyKey()][$style->getConfigDependencyName()])) {
+        /** @var \Drupal\image\ImageStyleStorageInterface $storage */
+        $storage = \Drupal::entityManager()->getStorage($style->getEntityTypeId());
+        $replacement_id = $storage->getReplacementId($style_id);
+        // If a valid replacement has been provided in the storage, replace the
+        // preview image style with the replacement.
+        if ($replacement_id && ImageStyle::load($replacement_id)) {
+          $this->setSetting('preview_image_style', $replacement_id);
+        }
+        // If there's no replacement or the replacement is invalid, disable the
+        // image preview.
+        else {
+          $this->setSetting('preview_image_style', '');
+        }
+        // Signal that the formatter plugin settings were updated.
+        $changed = TRUE;
+      }
+    }
+    return $changed;
+  }
+
 }
diff --git a/core/modules/image/src/Tests/ImageAdminStylesTest.php b/core/modules/image/src/Tests/ImageAdminStylesTest.php
index ed3854f..da3080b 100644
--- a/core/modules/image/src/Tests/ImageAdminStylesTest.php
+++ b/core/modules/image/src/Tests/ImageAdminStylesTest.php
@@ -8,6 +8,7 @@
 namespace Drupal\image\Tests;
 
 use Drupal\Component\Utility\SafeMarkup;
+use Drupal\Core\Entity\Entity\EntityViewDisplay;
 use Drupal\image\Entity\ImageStyle;
 use Drupal\image\ImageStyleInterface;
 use Drupal\node\Entity\Node;
@@ -446,6 +447,11 @@ function testConfigImport() {
     // Copy config to sync, and delete the image style.
     $sync = $this->container->get('config.storage.sync');
     $active = $this->container->get('config.storage');
+    // Remove the image field from the display, to avoid a dependency error
+    // during import.
+    EntityViewDisplay::load('node.article.default')
+      ->removeComponent($field_name)
+      ->save();
     $this->copyConfig($active, $sync);
     $sync->delete('image.style.' . $style_name);
     $this->configImporter()->import();
diff --git a/core/modules/image/src/Tests/ImageFieldTestBase.php b/core/modules/image/src/Tests/ImageFieldTestBase.php
index 271b969..9984a76 100644
--- a/core/modules/image/src/Tests/ImageFieldTestBase.php
+++ b/core/modules/image/src/Tests/ImageFieldTestBase.php
@@ -66,9 +66,11 @@ protected function setUp() {
    * @param array $field_settings
    *   A list of instance settings that will be added to the instance defaults.
    * @param array $widget_settings
-   *   A list of widget settings that will be added to the widget defaults.
+   *   Widget settings to be added to the widget defaults.
+   * @param array $formatter_settings
+   *   Formatter settings to be added to the formatter defaults.
    */
-  function createImageField($name, $type_name, $storage_settings = array(), $field_settings = array(), $widget_settings = array()) {
+  function createImageField($name, $type_name, $storage_settings = array(), $field_settings = array(), $widget_settings = array(), $formatter_settings = array()) {
     entity_create('field_storage_config', array(
       'field_name' => $name,
       'entity_type' => 'node',
@@ -95,7 +97,10 @@ function createImageField($name, $type_name, $storage_settings = array(), $field
       ->save();
 
     entity_get_display('node', $type_name, 'default')
-      ->setComponent($name)
+      ->setComponent($name, array(
+        'type' => 'image',
+        'settings' => $formatter_settings,
+      ))
       ->save();
 
     return $field_config;
diff --git a/core/modules/image/src/Tests/ImageStyleDeleteTest.php b/core/modules/image/src/Tests/ImageStyleDeleteTest.php
new file mode 100644
index 0000000..f359d83
--- /dev/null
+++ b/core/modules/image/src/Tests/ImageStyleDeleteTest.php
@@ -0,0 +1,129 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\image\Tests\ImageStyleDeleteTest.
+ */
+
+namespace Drupal\image\Tests;
+
+use Drupal\Core\Entity\Entity\EntityFormDisplay;
+use Drupal\Core\Entity\Entity\EntityViewDisplay;
+use Drupal\image\Entity\ImageStyle;
+
+/**
+ * Tests image style deletion using the UI.
+ *
+ * @group image
+ */
+class ImageStyleDeleteTest extends ImageFieldTestBase {
+
+  /**
+   * Image styles.
+   *
+   * @var \Drupal\image\ImageStyleInterface
+   */
+  protected $style1, $style2, $style3;
+
+  /**
+   * {@inheritdoc}
+   */
+  protected function setUp() {
+    parent::setUp();
+
+    /** @var \Drupal\image\ImageStyleInterface $style */
+    foreach (ImageStyle::loadMultiple() as $style) {
+      // Remove all existing image styles.
+      $style->delete();
+    }
+
+    $this->style1 = ImageStyle::create(['name' => 'style1', 'label' => 'Style 1']);
+    $this->style1->save();
+    $this->style2 = ImageStyle::create(['name' => 'style2', 'label' => 'Style 2']);
+    $this->style2->save();
+    $this->style3 = ImageStyle::create(['name' => 'style3', 'label' => 'Style 3']);
+    $this->style3->save();
+
+    $this->createImageField('image1', 'page', [], [], ['preview_image_style' => 'style1'], ['image_style' => 'style1']);
+    $this->createImageField('image2', 'article', [], [], ['preview_image_style' => 'style2']);
+  }
+
+  /**
+   * Tests image style deletion.
+   */
+  public function testDelete() {
+    // This image style is not involved in any formatter or widget.
+    $this->drupalGet('admin/config/media/image-styles/manage/style3/delete');
+    // Checks that the 'replacement' select element isn't displayed.
+    $this->assertNoFieldByName('replacement');
+    // Checks that messages telling about components relying on this image style
+    // is not found.
+    $this->assertNoRaw((string) t("The %style image style you are about to delete is used in existing field formatters and widgets. You may select another image style to replace it. If no replacement style is selected, the corresponding field formatters will be disabled and might need manual reconfiguration.", ['%style' => 'Style 3']));
+    $this->assertNoRaw((string) t("The %style image style you are about to delete is used in existing field formatters and widgets. Those formatters will be disabled and might need manual reconfiguration.", ['%style' => 'Style 3']));
+    // Check that the style cache flush text is displayed.
+    $this->assertText((string) t('All images that have been generated for this style will be permanently deleted.'));
+
+    // This image style is involved in 'image1' field widget and formatter.
+    $this->drupalGet('admin/config/media/image-styles/manage/style1/delete');
+    // Checks that the 'replacement' select element is displayed.
+    $this->assertFieldByName('replacement');
+    // Checks that the message telling about components relying on this image
+    // style is found.
+    $this->assertRaw((string) t("The %style image style you are about to delete is used in existing field formatters and widgets. You may select another image style to replace it. If no replacement style is selected, the corresponding field formatters will be disabled and might need manual reconfiguration.", ['%style' => 'Style 1']));
+    // Check that the style cache flush text is displayed.
+    $this->assertText((string) t('All images that have been generated for this style will be permanently deleted.'));
+
+    // Delete 'style1' image style.
+    $this->drupalPostForm(NULL, ['replacement' => 'style2'], (string) t('Delete'));
+
+    /** @var \Drupal\Core\Entity\Display\EntityViewDisplayInterface $view_display */
+    $view_display = EntityViewDisplay::load('node.page.default');
+    // Checks that the formatter setting is replaced.
+    if ($this->assertNotNull($component = $view_display->getComponent('image1'))) {
+      $this->assertIdentical($component['settings']['image_style'], 'style2');
+    }
+    /** @var \Drupal\Core\Entity\Display\EntityFormDisplayInterface $form_display */
+    $form_display = EntityFormDisplay::load('node.page.default');
+    // Check that the widget setting is replaced.
+    if ($this->assertNotNull($component = $form_display->getComponent('image1'))) {
+      $this->assertIdentical($component['settings']['preview_image_style'], 'style2');
+    }
+
+    // This image style is involved in 'image1' and 'image2' components.
+    $this->drupalGet('admin/config/media/image-styles/manage/style2/delete');
+    // Checks that the 'replacement' select element is displayed.
+    $this->assertFieldByName('replacement');
+    // Checks that the message telling about components relying on this image
+    // style is found.
+    $this->assertRaw((string) t("The %style image style you are about to delete is used in existing field formatters and widgets. You may select another image style to replace it. If no replacement style is selected, the corresponding field formatters will be disabled and might need manual reconfiguration.", ['%style' => 'Style 2']));
+    // Check that the style cache flush text is displayed.
+    $this->assertText((string) t('All images that have been generated for this style will be permanently deleted.'));
+
+    // Delete 'style3' and reload the page. No replacement candidates left.
+    $this->style3->delete();
+    $this->drupalGet('admin/config/media/image-styles/manage/style2/delete');
+    // Replacement select not found.
+    $this->assertNoFieldByName('replacement');
+    // Message telling about components relying on this image style found.
+    $this->assertRaw((string) t("The %style image style you are about to delete is used in existing field formatters and widgets. Those formatters will be disabled and might need manual reconfiguration.", ['%style' => 'Style 2']));
+    // The style cache flush text is there.
+    $this->assertText((string) t('All images that have been generated for this style will be permanently deleted.'));
+
+    // Delete 'style2' style.
+    $this->drupalPostForm(NULL, [], (string) t('Delete'));
+
+    $view_display = EntityViewDisplay::load('node.page.default');
+    // Checks that the formatter setting is disabled.
+    $this->assertNull($view_display->getComponent('image1'));
+    $this->assertNotNull($view_display->get('hidden')['image1']);
+    // Checks that widget setting is preserved with the image preview disabled.
+    $form_display = EntityFormDisplay::load('node.page.default');
+    $this->assertNotNull($widget = $form_display->getComponent('image1'));
+    $this->assertIdentical($widget['settings']['preview_image_style'], '');
+    // Checks that widget setting is preserved with the image preview disabled.
+    $form_display = EntityFormDisplay::load('node.article.default');
+    $this->assertNotNull($widget = $form_display->getComponent('image2'));
+    $this->assertIdentical($widget['settings']['preview_image_style'], '');
+  }
+
+}
diff --git a/core/modules/image/src/Tests/Update/ImageUpdateTest.php b/core/modules/image/src/Tests/Update/ImageUpdateTest.php
new file mode 100644
index 0000000..f37ca8f
--- /dev/null
+++ b/core/modules/image/src/Tests/Update/ImageUpdateTest.php
@@ -0,0 +1,59 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\image\Tests\Update\ImageUpdateTest.
+ */
+
+namespace Drupal\image\Tests\Update;
+
+use Drupal\system\Tests\Update\UpdatePathTestBase;
+
+/**
+ * Tests Image update path.
+ *
+ * @group image
+ */
+class ImageUpdateTest extends UpdatePathTestBase {
+
+  /**
+   * {@inheritdoc}
+   */
+  protected function setDatabaseDumpFiles() {
+    $this->databaseDumpFiles = [
+      __DIR__ . '/../../../../system/tests/fixtures/update/drupal-8-rc1.bare.standard.php.gz',
+    ];
+  }
+
+  /**
+   * Tests image_post_update_image_style_dependencies().
+   *
+   * @see image_post_update_image_style_dependencies()
+   */
+  public function testPostUpdateImageStylesDependencies() {
+    $view = 'core.entity_view_display.node.article.default';
+    $form = 'core.entity_form_display.node.article.default';
+
+    // Check that view display 'node.article.default' doesn't depend on image
+    // style 'image.style.large'.
+    $dependencies = $this->config($view)->get('dependencies.config');
+    $this->assertFalse(in_array('image.style.large', $dependencies));
+    // Check that form display 'node.article.default' doesn't depend on image
+    // style 'image.style.thumbnail'.
+    $dependencies = $this->config($form)->get('dependencies.config');
+    $this->assertFalse(in_array('image.style.thumbnail', $dependencies));
+
+    // Run updates.
+    $this->runUpdates();
+
+    // Check that view display 'node.article.default' depend on image style
+    // 'image.style.large'.
+    $dependencies = $this->config($view)->get('dependencies.config');
+    $this->assertTrue(in_array('image.style.large', $dependencies));
+    // Check that form display 'node.article.default' depend on image style
+    // 'image.style.thumbnail'.
+    $dependencies = $this->config($view)->get('dependencies.config');
+    $this->assertTrue(in_array('image.style.large', $dependencies));
+  }
+
+}
diff --git a/core/modules/image/tests/src/Kernel/ImageStyleIntegrationTest.php b/core/modules/image/tests/src/Kernel/ImageStyleIntegrationTest.php
new file mode 100644
index 0000000..304718f
--- /dev/null
+++ b/core/modules/image/tests/src/Kernel/ImageStyleIntegrationTest.php
@@ -0,0 +1,117 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\Tests\image\Kernel\ImageStyleIntegrationTest.
+ */
+
+namespace Drupal\Tests\image\Kernel;
+
+use Drupal\Core\Entity\Entity\EntityFormDisplay;
+use Drupal\Core\Entity\Entity\EntityViewDisplay;
+use Drupal\field\Entity\FieldConfig;
+use Drupal\field\Entity\FieldStorageConfig;
+use Drupal\image\Entity\ImageStyle;
+use Drupal\KernelTests\KernelTestBase;
+use Drupal\node\Entity\NodeType;
+
+/**
+ * Tests the integration of ImageStyle with the core.
+ *
+ * @group image
+ */
+class ImageStyleIntegrationTest extends KernelTestBase {
+
+  /**
+   * {@inheritdoc}
+   */
+  public static $modules = ['image', 'file', 'field', 'system', 'user', 'node'];
+
+  /**
+   * Tests the dependency between ImageStyle and entity display components.
+   */
+  public function testEntityDisplayDependency() {
+    // Create two image styles.
+    /** @var \Drupal\image\ImageStyleInterface $style */
+    $style = ImageStyle::create(['name' => 'main_style']);
+    $style->save();
+    /** @var \Drupal\image\ImageStyleInterface $replacement */
+    $replacement = ImageStyle::create(['name' => 'replacement_style']);
+    $replacement->save();
+
+    // Create a node-type, named 'note'.
+    $node_type = NodeType::create(['type' => 'note']);
+    $node_type->save();
+
+    // Create an image field and attach it to the 'note' node-type.
+    FieldStorageConfig::create([
+      'entity_type' => 'node',
+      'field_name' => 'sticker',
+      'type' => 'image',
+    ])->save();
+    FieldConfig::create([
+      'entity_type' => 'node',
+      'field_name' => 'sticker',
+      'bundle' => 'note',
+    ])->save();
+
+    // Create the default entity view display and set the 'sticker' field to use
+    // the 'main_style' images style in formatter.
+    /** @var \Drupal\Core\Entity\Display\EntityViewDisplayInterface $view_display */
+    $view_display = EntityViewDisplay::create([
+      'targetEntityType' => 'node',
+      'bundle' => 'note',
+      'mode' => 'default',
+      'status' => TRUE,
+    ])->setComponent('sticker', ['settings' => ['image_style' => 'main_style']]);
+    $view_display->save();
+
+    // Create the default entity form display and set the 'sticker' field to use
+    // the 'main_style' images style in the widget.
+    /** @var \Drupal\Core\Entity\Display\EntityFormDisplayInterface $form_display */
+    $form_display = EntityFormDisplay::create([
+      'targetEntityType' => 'node',
+      'bundle' => 'note',
+      'mode' => 'default',
+      'status' => TRUE,
+    ])->setComponent('sticker', ['settings' => ['preview_image_style' => 'main_style']]);
+    $form_display->save();
+
+    // Check that the entity displays exists before dependency removal.
+    $this->assertNotNull(EntityViewDisplay::load($view_display->id()));
+    $this->assertNotNull(EntityFormDisplay::load($form_display->id()));
+
+    // Delete the 'main_style' image style. Before that, emulate the UI process
+    // of selecting a replacement style by setting the replacement image style
+    // ID in the image style storage.
+    /** @var \Drupal\image\ImageStyleStorageInterface $storage */
+    $storage = $this->container->get('entity.manager')->getStorage($style->getEntityTypeId());
+    $storage->setReplacementId('main_style', 'replacement_style');
+    $style->delete();
+
+    // Check that the entity displays exists after dependency removal.
+    $this->assertNotNull($view_display = EntityViewDisplay::load($view_display->id()));
+    $this->assertNotNull($form_display = EntityFormDisplay::load($form_display->id()));
+    // Check that the 'sticker' formatter component exists in both displays.
+    $this->assertNotNull($formatter = $view_display->getComponent('sticker'));
+    $this->assertNotNull($widget = $form_display->getComponent('sticker'));
+    // Check that both displays are using now 'replacement_style' for images.
+    $this->assertSame('replacement_style', $formatter['settings']['image_style']);
+    $this->assertSame('replacement_style', $widget['settings']['preview_image_style']);
+
+    // Delete the 'replacement_style' without setting a replacement image style.
+    $replacement->delete();
+
+    // The entity view and form displays exists after dependency removal.
+    $this->assertNotNull($view_display = EntityViewDisplay::load($view_display->id()));
+    $this->assertNotNull($form_display = EntityFormDisplay::load($form_display->id()));
+    // The 'sticker' formatter component should be hidden in view display.
+    $this->assertNull($view_display->getComponent('sticker'));
+    $this->assertTrue($view_display->get('hidden')['sticker']);
+    // The 'sticker' widget component should be active in form displays, but the
+    // image preview should be disabled.
+    $this->assertNotNull($widget = $form_display->getComponent('sticker'));
+    $this->assertSame('', $widget['settings']['preview_image_style']);
+  }
+
+}
diff --git a/core/profiles/standard/config/install/core.entity_form_display.node.article.default.yml b/core/profiles/standard/config/install/core.entity_form_display.node.article.default.yml
index 189737c..79156b2 100644
--- a/core/profiles/standard/config/install/core.entity_form_display.node.article.default.yml
+++ b/core/profiles/standard/config/install/core.entity_form_display.node.article.default.yml
@@ -6,6 +6,7 @@ dependencies:
     - field.field.node.article.comment
     - field.field.node.article.field_image
     - field.field.node.article.field_tags
+    - image.style.thumbnail
     - node.type.article
   module:
     - comment
diff --git a/core/profiles/standard/config/install/core.entity_form_display.user.user.default.yml b/core/profiles/standard/config/install/core.entity_form_display.user.user.default.yml
index 107d363..466b6e0 100644
--- a/core/profiles/standard/config/install/core.entity_form_display.user.user.default.yml
+++ b/core/profiles/standard/config/install/core.entity_form_display.user.user.default.yml
@@ -3,6 +3,7 @@ status: true
 dependencies:
   config:
     - field.field.user.user.user_picture
+    - image.style.thumbnail
   module:
     - image
     - user
diff --git a/core/profiles/standard/config/install/core.entity_view_display.node.article.default.yml b/core/profiles/standard/config/install/core.entity_view_display.node.article.default.yml
index e0d3782..f880cfd 100644
--- a/core/profiles/standard/config/install/core.entity_view_display.node.article.default.yml
+++ b/core/profiles/standard/config/install/core.entity_view_display.node.article.default.yml
@@ -6,6 +6,7 @@ dependencies:
     - field.field.node.article.comment
     - field.field.node.article.field_image
     - field.field.node.article.field_tags
+    - image.style.large
     - node.type.article
   module:
     - comment
diff --git a/core/profiles/standard/config/install/core.entity_view_display.node.article.teaser.yml b/core/profiles/standard/config/install/core.entity_view_display.node.article.teaser.yml
index 1cf18dc..43ee079 100644
--- a/core/profiles/standard/config/install/core.entity_view_display.node.article.teaser.yml
+++ b/core/profiles/standard/config/install/core.entity_view_display.node.article.teaser.yml
@@ -7,6 +7,7 @@ dependencies:
     - field.field.node.article.comment
     - field.field.node.article.field_image
     - field.field.node.article.field_tags
+    - image.style.medium
     - node.type.article
   module:
     - image
diff --git a/core/profiles/standard/config/install/core.entity_view_display.user.user.compact.yml b/core/profiles/standard/config/install/core.entity_view_display.user.user.compact.yml
index 9c74439..4c13792 100644
--- a/core/profiles/standard/config/install/core.entity_view_display.user.user.compact.yml
+++ b/core/profiles/standard/config/install/core.entity_view_display.user.user.compact.yml
@@ -4,6 +4,7 @@ dependencies:
   config:
     - core.entity_view_mode.user.compact
     - field.field.user.user.user_picture
+    - image.style.thumbnail
   module:
     - image
     - user
diff --git a/core/profiles/standard/config/install/core.entity_view_display.user.user.default.yml b/core/profiles/standard/config/install/core.entity_view_display.user.user.default.yml
index 807fefe..9e4621d 100644
--- a/core/profiles/standard/config/install/core.entity_view_display.user.user.default.yml
+++ b/core/profiles/standard/config/install/core.entity_view_display.user.user.default.yml
@@ -3,6 +3,7 @@ status: true
 dependencies:
   config:
     - field.field.user.user.user_picture
+    - image.style.thumbnail
   module:
     - image
     - user
