Bug 1406227 - Replace nsIDOMHTMLImageElement with HTMLImageElement in SeaMonkey. r=IanN
authorFrank-Rainer Grahl <frgrahl@gmx.net>
Tue, 17 Oct 2017 17:28:05 +0200
changeset 29199 41fe121d8350e1a3c77e21f74ad04d8c8866b028
parent 29198 71125f4141761ac3dcaf518728b0b16333807ae5
child 29200 33116721c2ada9f3c8a80704c1b168aa49d5dc6d
push id2068
push userclokep@gmail.com
push dateMon, 13 Nov 2017 19:02:14 +0000
treeherdercomm-beta@9c7e7ce8672b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersIanN
bugs1406227, 1406224
Bug 1406227 - Replace nsIDOMHTMLImageElement with HTMLImageElement in SeaMonkey. r=IanN Port Bug 1406224 [Remove nsIDOMHTMLImageElement].
editor/ui/composer/content/editor.js
suite/shell/src/nsGNOMEShellService.cpp
suite/shell/src/nsMacShellService.cpp
suite/shell/src/nsWindowsShellService.cpp
--- a/editor/ui/composer/content/editor.js
+++ b/editor/ui/composer/content/editor.js
@@ -3164,17 +3164,17 @@ function FillInHTMLTooltipEditor(tooltip
         if (tooltipText && /\S/.test(tooltipText)) {
           tooltip.setAttribute("label", tooltipText);
           return true;
         }
       }
     }
   } else {
     for (node = document.tooltipNode; node; node = node.parentNode) {
-      if (node instanceof Components.interfaces.nsIDOMHTMLImageElement ||
+      if (ChromeUtils.getClassName(node) === "HTMLImageElement") ||
           node instanceof Components.interfaces.nsIDOMHTMLInputElement)
         tooltipText = node.getAttribute("src");
       else if (node instanceof Components.interfaces.nsIDOMHTMLAnchorElement)
         tooltipText = node.getAttribute("href") || node.name;
       if (tooltipText) {
         tooltip.setAttribute("label", tooltipText);
         return true;
       }
--- a/suite/shell/src/nsGNOMEShellService.cpp
+++ b/suite/shell/src/nsGNOMEShellService.cpp
@@ -17,17 +17,17 @@
 #include "nsIGConfService.h"
 #include "nsIGIOService.h"
 #include "nsIGSettingsService.h"
 #include "nsIStringBundle.h"
 #include "nsIOutputStream.h"
 #include "nsIProcess.h"
 #include "nsServiceManagerUtils.h"
 #include "nsComponentManagerUtils.h"
-#include "nsIDOMHTMLImageElement.h"
+#include "nsIDOMElement.h"
 #include "nsIImageLoadingContent.h"
 #include "imgIRequest.h"
 #include "imgIContainer.h"
 #include "mozilla/Sprintf.h"
 #include "nsIImageToPixbuf.h"
 #include "nsXULAppAPI.h"
 
 #include <glib.h>
--- a/suite/shell/src/nsMacShellService.cpp
+++ b/suite/shell/src/nsMacShellService.cpp
@@ -1,16 +1,15 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsDirectoryServiceDefs.h"
 #include "nsIDOMElement.h"
-#include "nsIDOMHTMLImageElement.h"
 #include "nsIImageLoadingContent.h"
 #include "nsIDocument.h"
 #include "nsIContent.h"
 #include "nsILocalFileMac.h"
 #include "nsIObserverService.h"
 #include "nsIPrefService.h"
 #include "nsIServiceManager.h"
 #include "nsIStringBundle.h"
--- a/suite/shell/src/nsWindowsShellService.cpp
+++ b/suite/shell/src/nsWindowsShellService.cpp
@@ -4,18 +4,18 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsWindowsShellService.h"
 
 #include "imgIContainer.h"
 #include "imgIRequest.h"
 #include "mozilla/gfx/2D.h"
 #include "mozilla/RefPtr.h"
+#include "nsIContent.h"
 #include "nsIDOMElement.h"
-#include "nsIDOMHTMLImageElement.h"
 #include "nsIImageLoadingContent.h"
 #include "nsIOutputStream.h"
 #include "nsIPrefService.h"
 #include "nsIPrefLocalizedString.h"
 #include "nsIServiceManager.h"
 #include "nsIStringBundle.h"
 #include "nsNetUtil.h"
 #include "nsServiceManagerUtils.h"
@@ -736,40 +736,37 @@ WriteBitmap(nsIFile* aFile, imgIContaine
 
   return rv;
 }
 
 NS_IMETHODIMP
 nsWindowsShellService::SetDesktopBackground(nsIDOMElement* aElement,
                                             int32_t aPosition)
 {
-  nsresult rv;
-
-  nsCOMPtr<imgIContainer> container;
-
-  nsCOMPtr<nsIDOMHTMLImageElement> imgElement(do_QueryInterface(aElement));
-  if (!imgElement) {
+  nsCOMPtr<nsIContent> content(do_QueryInterface(aElement));
+  if (!content || !content->IsHTMLElement(nsGkAtoms::img)) {
     // XXX write background loading stuff!
     return NS_ERROR_NOT_AVAILABLE;
   }
-  else {
-    nsCOMPtr<nsIImageLoadingContent> imageContent =
-      do_QueryInterface(aElement, &rv);
-    if (!imageContent)
-      return rv;
+
+  nsresult rv;
+  nsCOMPtr<nsIImageLoadingContent> imageContent =
+    do_QueryInterface(aElement, &rv);
+  if (!imageContent)
+    return rv;
 
-    // get the image container
-    nsCOMPtr<imgIRequest> request;
-    rv = imageContent->GetRequest(nsIImageLoadingContent::CURRENT_REQUEST,
-                                  getter_AddRefs(request));
-    if (!request)
-      return rv;
-    rv = request->GetImage(getter_AddRefs(container));
-  }
+  // get the image container
+  nsCOMPtr<imgIRequest> request;
+  rv = imageContent->GetRequest(nsIImageLoadingContent::CURRENT_REQUEST,
+                                getter_AddRefs(request));
+  if (!request)
+    return rv;
 
+  nsCOMPtr<imgIContainer> container;
+  rv = request->GetImage(getter_AddRefs(container));
   if (!container)
     return NS_ERROR_FAILURE;
 
   // get the file name from localized strings
   nsCOMPtr<nsIStringBundleService> bundleService =
     mozilla::services::GetStringBundleService();
   NS_ENSURE_TRUE(bundleService, NS_ERROR_UNEXPECTED);