mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 03:15:11 +00:00
Bug 1406224 - Remove nsIDOMHTMLImageElement; r=bz
MozReview-Commit-ID: GCATWRt6qMo --HG-- extra : rebase_source : 29854f1374c6ad318da0b5b68be23507667c3be4
This commit is contained in:
parent
400434c402
commit
1cc8b01353
@ -17,7 +17,6 @@
|
||||
#include "nsIImageLoadingContent.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIDOMHTMLImageElement.h"
|
||||
#include "nsIPersistentProperties2.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsIURI.h"
|
||||
|
@ -23,7 +23,7 @@
|
||||
#include "nsIProcess.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsComponentManagerUtils.h"
|
||||
#include "nsIDOMHTMLImageElement.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsIImageLoadingContent.h"
|
||||
#include "imgIRequest.h"
|
||||
#include "imgIContainer.h"
|
||||
|
@ -5,7 +5,6 @@
|
||||
|
||||
#include "nsDirectoryServiceDefs.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsIDOMHTMLImageElement.h"
|
||||
#include "nsIImageLoadingContent.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIContent.h"
|
||||
|
@ -11,8 +11,8 @@
|
||||
#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"
|
||||
@ -579,30 +579,29 @@ nsWindowsShellService::SetDesktopBackground(nsIDOMElement* aElement,
|
||||
int32_t aPosition,
|
||||
const nsACString& aImageName)
|
||||
{
|
||||
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;
|
||||
|
||||
// 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));
|
||||
if (!container)
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
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;
|
||||
|
||||
nsCOMPtr<imgIContainer> container;
|
||||
rv = request->GetImage(getter_AddRefs(container));
|
||||
if (!container)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
// get the file name from localized strings
|
||||
nsCOMPtr<nsIStringBundleService>
|
||||
|
@ -12,7 +12,6 @@
|
||||
#include "nsIDOMHTMLDocument.h"
|
||||
#include "nsIDOMHTMLElement.h"
|
||||
#include "nsIDOMHTMLHtmlElement.h"
|
||||
#include "nsIDOMHTMLImageElement.h"
|
||||
#include "nsIDOMWindow.h"
|
||||
#include "nsICSSDeclaration.h"
|
||||
#include "nsIDOMCSSValue.h"
|
||||
|
@ -865,7 +865,7 @@ BrowserElementChild.prototype = {
|
||||
if (elem instanceof Ci.nsIImageLoadingContent && elem.currentURI) {
|
||||
return {uri: elem.currentURI.spec, documentURI: documentURI};
|
||||
}
|
||||
if (elem instanceof Ci.nsIDOMHTMLImageElement) {
|
||||
if (ChromeUtils.getClassName(elem) === "HTMLImageElement") {
|
||||
return {uri: elem.src, documentURI: documentURI};
|
||||
}
|
||||
if (elem instanceof Ci.nsIDOMHTMLMediaElement) {
|
||||
|
@ -138,7 +138,6 @@ NS_IMPL_CYCLE_COLLECTION_INHERITED(HTMLImageElement,
|
||||
|
||||
NS_IMPL_ISUPPORTS_CYCLE_COLLECTION_INHERITED(HTMLImageElement,
|
||||
nsGenericHTMLElement,
|
||||
nsIDOMHTMLImageElement,
|
||||
nsIImageLoadingContent,
|
||||
imgIOnloadBlocker,
|
||||
imgINotificationObserver)
|
||||
@ -756,6 +755,13 @@ HTMLImageElement::Image(const GlobalObject& aGlobal,
|
||||
return img.forget();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
HTMLImageElement::GetNaturalHeight(uint32_t* aNaturalHeight)
|
||||
{
|
||||
*aNaturalHeight = NaturalHeight();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
HTMLImageElement::NaturalHeight()
|
||||
{
|
||||
@ -777,9 +783,9 @@ HTMLImageElement::NaturalHeight()
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
HTMLImageElement::GetNaturalHeight(uint32_t* aNaturalHeight)
|
||||
HTMLImageElement::GetNaturalWidth(uint32_t* aNaturalWidth)
|
||||
{
|
||||
*aNaturalHeight = NaturalHeight();
|
||||
*aNaturalWidth = NaturalWidth();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -803,13 +809,6 @@ HTMLImageElement::NaturalWidth()
|
||||
return width;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
HTMLImageElement::GetNaturalWidth(uint32_t* aNaturalWidth)
|
||||
{
|
||||
*aNaturalWidth = NaturalWidth();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
HTMLImageElement::CopyInnerTo(Element* aDest, bool aPreallocateChildren)
|
||||
{
|
||||
|
@ -10,7 +10,6 @@
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "nsGenericHTMLElement.h"
|
||||
#include "nsImageLoadingContent.h"
|
||||
#include "nsIDOMHTMLImageElement.h"
|
||||
#include "imgRequestProxy.h"
|
||||
#include "Units.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
@ -23,8 +22,7 @@ class ImageLoadTask;
|
||||
|
||||
class ResponsiveImageSelector;
|
||||
class HTMLImageElement final : public nsGenericHTMLElement,
|
||||
public nsImageLoadingContent,
|
||||
public nsIDOMHTMLImageElement
|
||||
public nsImageLoadingContent
|
||||
{
|
||||
friend class HTMLSourceElement;
|
||||
friend class HTMLPictureElement;
|
||||
@ -52,9 +50,6 @@ public:
|
||||
// EventTarget
|
||||
virtual void AsyncEventRunning(AsyncEventDispatcher* aEvent) override;
|
||||
|
||||
// nsIDOMHTMLImageElement
|
||||
NS_DECL_NSIDOMHTMLIMAGEELEMENT
|
||||
|
||||
NS_IMPL_FROMCONTENT_HTML_WITH_TAG(HTMLImageElement, img)
|
||||
|
||||
// override from nsImageLoadingContent
|
||||
@ -90,6 +85,11 @@ public:
|
||||
|
||||
void MaybeLoadImage(bool aAlwaysForceLoad);
|
||||
|
||||
// Overrides for nsImageLoadingContent's GetNaturalHeight/Width, since we
|
||||
// handle responsive scaling in the element's version of these methods.
|
||||
NS_IMETHOD GetNaturalHeight(uint32_t* aNaturalHeight) override;
|
||||
NS_IMETHOD GetNaturalWidth(uint32_t* aNaturalWidth) override;
|
||||
|
||||
bool IsMap()
|
||||
{
|
||||
return GetBoolAttr(nsGkAtoms::ismap);
|
||||
@ -395,8 +395,6 @@ protected:
|
||||
|
||||
// Override for nsImageLoadingContent.
|
||||
nsIContent* AsContent() override { return this; }
|
||||
NS_IMETHOD GetNaturalWidth(uint32_t* aNaturalWidth) override;
|
||||
NS_IMETHOD GetNaturalHeight(uint32_t* aNaturalHeight) override;
|
||||
|
||||
// This is a weak reference that this element and the HTMLFormElement
|
||||
// cooperate in maintaining.
|
||||
|
@ -13,7 +13,6 @@
|
||||
#include "nsDocShell.h"
|
||||
#include "nsIDocumentInlines.h"
|
||||
#include "nsDOMTokenList.h"
|
||||
#include "nsIDOMHTMLImageElement.h"
|
||||
#include "nsIDOMEvent.h"
|
||||
#include "nsIDOMKeyEvent.h"
|
||||
#include "nsIDOMMouseEvent.h"
|
||||
|
@ -14,7 +14,6 @@ XPIDL_SOURCES += [
|
||||
'nsIDOMHTMLElement.idl',
|
||||
'nsIDOMHTMLFormElement.idl',
|
||||
'nsIDOMHTMLHtmlElement.idl',
|
||||
'nsIDOMHTMLImageElement.idl',
|
||||
'nsIDOMHTMLInputElement.idl',
|
||||
'nsIDOMHTMLMediaElement.idl',
|
||||
'nsIDOMHTMLMenuItemElement.idl',
|
||||
|
@ -1,22 +0,0 @@
|
||||
/* -*- Mode: IDL; 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 "nsIDOMHTMLElement.idl"
|
||||
|
||||
/**
|
||||
* The nsIDOMHTMLImageElement interface is the interface to a [X]HTML
|
||||
* img element.
|
||||
*
|
||||
* This interface is trying to follow the DOM Level 2 HTML specification:
|
||||
* http://www.w3.org/TR/DOM-Level-2-HTML/
|
||||
*
|
||||
* with changes from the work-in-progress WHATWG HTML specification:
|
||||
* http://www.whatwg.org/specs/web-apps/current-work/
|
||||
*/
|
||||
|
||||
[uuid(ec18e71c-4f5c-4cc3-aa36-5273168644dc)]
|
||||
interface nsIDOMHTMLImageElement : nsISupports
|
||||
{
|
||||
};
|
@ -26,7 +26,6 @@
|
||||
#include "nsIDOMHTMLBaseElement.h"
|
||||
#include "nsIDOMHTMLCollection.h"
|
||||
#include "nsIDOMHTMLDocument.h"
|
||||
#include "nsIDOMHTMLImageElement.h"
|
||||
#include "nsIDOMHTMLInputElement.h"
|
||||
#include "nsIDOMHTMLMediaElement.h"
|
||||
#include "nsIDOMHTMLOptionElement.h"
|
||||
@ -483,8 +482,7 @@ ResourceReader::OnWalkDOMNode(nsIDOMNode* aNode)
|
||||
}
|
||||
|
||||
// Test the node to see if it's an image, frame, iframe, css, js
|
||||
nsCOMPtr<nsIDOMHTMLImageElement> nodeAsImage = do_QueryInterface(aNode);
|
||||
if (nodeAsImage) {
|
||||
if (content->IsHTMLElement(nsGkAtoms::img)) {
|
||||
return OnWalkAttribute(aNode, "src");
|
||||
}
|
||||
|
||||
@ -987,8 +985,7 @@ PersistNodeFixup::FixupNode(nsIDOMNode *aNodeIn,
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMHTMLImageElement> nodeAsImage = do_QueryInterface(aNodeIn);
|
||||
if (nodeAsImage) {
|
||||
if (content->IsHTMLElement(nsGkAtoms::img)) {
|
||||
rv = GetNodeToFixup(aNodeIn, aNodeOut);
|
||||
if (NS_SUCCEEDED(rv) && *aNodeOut) {
|
||||
// Disable image loads
|
||||
|
@ -39,7 +39,6 @@
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIDOMDocumentFragment.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsIDOMHTMLImageElement.h"
|
||||
#include "nsIDOMHTMLInputElement.h"
|
||||
#include "nsIDOMHTMLScriptElement.h"
|
||||
#include "nsIDOMNode.h"
|
||||
|
@ -64,7 +64,6 @@
|
||||
#include "mozilla/ReflowInput.h"
|
||||
#include "nsIImageLoadingContent.h"
|
||||
#include "nsCopySupport.h"
|
||||
#include "nsIDOMHTMLImageElement.h"
|
||||
#ifdef MOZ_XUL
|
||||
#include "nsIXULDocument.h"
|
||||
#include "nsXULPopupManager.h"
|
||||
|
@ -7467,7 +7467,7 @@ nsLayoutUtils::SurfaceFromElement(nsIImageLoadingContent* aElement,
|
||||
result.mHasSize = status & imgIRequest::STATUS_SIZE_AVAILABLE;
|
||||
if ((status & imgIRequest::STATUS_LOAD_COMPLETE) == 0) {
|
||||
// Spec says to use GetComplete, but that only works on
|
||||
// nsIDOMHTMLImageElement, and we support all sorts of other stuff
|
||||
// HTMLImageElement, and we support all sorts of other stuff
|
||||
// here. Do this for now pending spec clarification.
|
||||
result.mIsStillLoading = (status & imgIRequest::STATUS_ERROR) == 0;
|
||||
return result;
|
||||
|
@ -13,7 +13,6 @@
|
||||
|
||||
#include "mozilla/dom/HTMLVideoElement.h"
|
||||
#include "mozilla/layers/WebRenderLayerManager.h"
|
||||
#include "nsIDOMHTMLImageElement.h"
|
||||
#include "nsDisplayList.h"
|
||||
#include "nsGenericHTMLElement.h"
|
||||
#include "nsPresContext.h"
|
||||
|
@ -101,7 +101,6 @@ static const char kPrintingPromptService[] = "@mozilla.org/embedcomp/printingpro
|
||||
#include "nsILayoutHistoryState.h"
|
||||
#include "nsFrameManager.h"
|
||||
#include "mozilla/ReflowInput.h"
|
||||
#include "nsIDOMHTMLImageElement.h"
|
||||
#include "nsIContentViewerContainer.h"
|
||||
#include "nsIContentViewer.h"
|
||||
#include "nsIDocumentViewerPrint.h"
|
||||
|
@ -31,7 +31,6 @@
|
||||
#include "nsILoadGroup.h"
|
||||
#include "nsContainerFrame.h"
|
||||
#include "nsCSSRendering.h"
|
||||
#include "nsIDOMHTMLImageElement.h"
|
||||
#include "nsNameSpaceManager.h"
|
||||
#include "nsTextFragment.h"
|
||||
#include "nsTransform2D.h"
|
||||
|
@ -2528,7 +2528,7 @@ var NativeWindow = {
|
||||
|
||||
imageLocationCopyableContext: {
|
||||
matches: function imageLinkCopyableContextMatches(aElement) {
|
||||
if (aElement instanceof Ci.nsIDOMHTMLImageElement) {
|
||||
if (ChromeUtils.getClassName(aElement) === "HTMLImageElement") {
|
||||
// The image is blocked by Tap-to-load Images
|
||||
if (aElement.hasAttribute("data-ctv-src") && !aElement.hasAttribute("data-ctv-show")) {
|
||||
return false;
|
||||
@ -2540,7 +2540,7 @@ var NativeWindow = {
|
||||
|
||||
imageSaveableContext: {
|
||||
matches: function imageSaveableContextMatches(aElement) {
|
||||
if (aElement instanceof Ci.nsIDOMHTMLImageElement) {
|
||||
if (ChromeUtils.getClassName(aElement) === "HTMLImageElement") {
|
||||
// The image is blocked by Tap-to-load Images
|
||||
if (aElement.hasAttribute("data-ctv-src") && !aElement.hasAttribute("data-ctv-show")) {
|
||||
return false;
|
||||
@ -2558,7 +2558,7 @@ var NativeWindow = {
|
||||
imageShareableContext: {
|
||||
matches: aElement => {
|
||||
let imgSrc = '';
|
||||
if (aElement instanceof Ci.nsIDOMHTMLImageElement) {
|
||||
if (ChromeUtils.getClassName(aElement) === "HTMLImageElement") {
|
||||
imgSrc = aElement.src;
|
||||
} else if (aElement instanceof Ci.nsIImageLoadingContent &&
|
||||
aElement.currentURI &&
|
||||
@ -2588,7 +2588,8 @@ var NativeWindow = {
|
||||
|
||||
imageBlockingPolicyContext: {
|
||||
matches: function imageBlockingPolicyContextMatches(aElement) {
|
||||
if (aElement instanceof Ci.nsIDOMHTMLImageElement && aElement.getAttribute("data-ctv-src")) {
|
||||
if (ChromeUtils.getClassName(aElement) === "HTMLImageElement" &&
|
||||
aElement.getAttribute("data-ctv-src")) {
|
||||
// Only show the menuitem if we are blocking the image
|
||||
if (aElement.getAttribute("data-ctv-show") == "true") {
|
||||
return false;
|
||||
|
@ -52,7 +52,7 @@ ImageBlockingPolicy.prototype = {
|
||||
return Ci.nsIContentPolicy.ACCEPT;
|
||||
}
|
||||
|
||||
if (node instanceof Ci.nsIDOMHTMLImageElement) {
|
||||
if (ChromeUtils.getClassName(node) === "HTMLImageElement") {
|
||||
// Accept if the user has asked to view the image
|
||||
if (node.getAttribute("data-ctv-show") == "true") {
|
||||
sendImageSizeTelemetry(node.getAttribute("data-ctv-src"));
|
||||
|
@ -579,7 +579,7 @@ void
|
||||
nsHtml5TreeOperation::SetFormElement(nsIContent* aNode, nsIContent* aParent)
|
||||
{
|
||||
nsCOMPtr<nsIFormControl> formControl(do_QueryInterface(aNode));
|
||||
nsCOMPtr<nsIDOMHTMLImageElement> domImageElement = do_QueryInterface(aNode);
|
||||
RefPtr<dom::HTMLImageElement> domImageElement = dom::HTMLImageElement::FromContentOrNull(aNode);
|
||||
// NS_ASSERTION(formControl, "Form-associated element did not implement nsIFormControl.");
|
||||
// TODO: uncomment the above line when <keygen> (bug 101019) is supported by Gecko
|
||||
nsCOMPtr<nsIDOMHTMLFormElement> formElement(do_QueryInterface(aParent));
|
||||
@ -589,10 +589,7 @@ nsHtml5TreeOperation::SetFormElement(nsIContent* aNode, nsIContent* aParent)
|
||||
!aNode->HasAttr(kNameSpaceID_None, nsGkAtoms::form)) {
|
||||
formControl->SetForm(formElement);
|
||||
} else if (domImageElement) {
|
||||
RefPtr<dom::HTMLImageElement> imageElement =
|
||||
static_cast<dom::HTMLImageElement*>(domImageElement.get());
|
||||
MOZ_ASSERT(imageElement);
|
||||
imageElement->SetForm(formElement);
|
||||
domImageElement->SetForm(formElement);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -51,7 +51,6 @@
|
||||
#include "nsIDOMHTMLElement.h"
|
||||
#include "nsIDOMHTMLFormElement.h"
|
||||
#include "nsIDOMHTMLHtmlElement.h"
|
||||
#include "nsIDOMHTMLImageElement.h"
|
||||
#include "nsIDOMHTMLInputElement.h"
|
||||
#include "nsIDOMHTMLMediaElement.h"
|
||||
#include "nsIDOMHTMLMenuItemElement.h"
|
||||
@ -157,7 +156,6 @@
|
||||
#include "mozilla/dom/HTMLFormElementBinding.h"
|
||||
#include "mozilla/dom/HTMLFrameSetElementBinding.h"
|
||||
#include "mozilla/dom/HTMLHtmlElementBinding.h"
|
||||
#include "mozilla/dom/HTMLImageElementBinding.h"
|
||||
#include "mozilla/dom/HTMLInputElementBinding.h"
|
||||
#include "mozilla/dom/HTMLMediaElementBinding.h"
|
||||
#include "mozilla/dom/HTMLMenuItemElementBinding.h"
|
||||
@ -316,7 +314,6 @@ const ComponentsInterfaceShimEntry kComponentsInterfaceShimMap[] =
|
||||
DEFINE_SHIM(HTMLElement),
|
||||
DEFINE_SHIM(HTMLFormElement),
|
||||
DEFINE_SHIM(HTMLHtmlElement),
|
||||
DEFINE_SHIM(HTMLImageElement),
|
||||
DEFINE_SHIM(HTMLInputElement),
|
||||
DEFINE_SHIM(HTMLMediaElement),
|
||||
DEFINE_SHIM(HTMLMenuItemElement),
|
||||
|
Loading…
Reference in New Issue
Block a user