Bug 826602 - Rename nsHTMLCanvasElement to mozilla::dom::HTMLCanvasElement; r=bzbarsky

--HG--
rename : content/html/content/public/nsHTMLCanvasElement.h => content/html/content/public/HTMLCanvasElement.h
rename : content/html/content/src/nsHTMLCanvasElement.cpp => content/html/content/src/HTMLCanvasElement.cpp
This commit is contained in:
Ehsan Akhgari 2013-01-04 00:16:14 -05:00
parent ec9544d919
commit faeec71701
22 changed files with 213 additions and 197 deletions

View File

@ -24,7 +24,7 @@ struct _cairo_surface;
/*
* This interface contains methods that are needed outside of the content/layout
* modules, specifically widget. It should eventually go away when we support
* libxul builds, and nsHTMLCanvasElement be used directly.
* libxul builds, and HTMLCanvasElement be used directly.
*
* Code internal to content/layout should /never/ use this interface; if the
* same functionality is needed in both places, two separate methods should be

View File

@ -9,7 +9,7 @@
#include "nsISupports.h"
#include "nsIInputStream.h"
#include "nsIDocShell.h"
#include "nsHTMLCanvasElement.h"
#include "mozilla/dom/HTMLCanvasElement.h"
#include "gfxPattern.h"
#include "mozilla/RefPtr.h"
@ -46,11 +46,11 @@ public:
RenderFlagPremultAlpha = 0x1
};
void SetCanvasElement(nsHTMLCanvasElement* aParentCanvas)
void SetCanvasElement(mozilla::dom::HTMLCanvasElement* aParentCanvas)
{
mCanvasElement = aParentCanvas;
}
nsHTMLCanvasElement* GetParentObject() const
mozilla::dom::HTMLCanvasElement* GetParentObject() const
{
return mCanvasElement;
}
@ -125,7 +125,7 @@ public:
NS_IMETHOD SetIsIPC(bool isIPC) = 0;
protected:
nsRefPtr<nsHTMLCanvasElement> mCanvasElement;
nsRefPtr<mozilla::dom::HTMLCanvasElement> mCanvasElement;
};
namespace mozilla {

View File

@ -11,7 +11,7 @@
#include "gfxPoint.h"
#include "mozilla/dom/Element.h"
#include "nsTHashtable.h"
#include "nsHTMLCanvasElement.h"
#include "mozilla/dom/HTMLCanvasElement.h"
#include "nsContentUtils.h"
namespace mozilla {
@ -19,10 +19,10 @@ namespace mozilla {
using namespace dom;
struct ImageCacheKey {
ImageCacheKey(Element* aImage, nsHTMLCanvasElement* aCanvas)
ImageCacheKey(Element* aImage, HTMLCanvasElement* aCanvas)
: mImage(aImage), mCanvas(aCanvas) {}
Element* mImage;
nsHTMLCanvasElement* mCanvas;
HTMLCanvasElement* mCanvas;
};
struct ImageCacheEntryData {
@ -45,7 +45,7 @@ struct ImageCacheEntryData {
// Key
nsRefPtr<Element> mImage;
nsIImageLoadingContent* mILC;
nsRefPtr<nsHTMLCanvasElement> mCanvas;
nsRefPtr<HTMLCanvasElement> mCanvas;
// Value
nsCOMPtr<imgIRequest> mRequest;
nsRefPtr<gfxASurface> mSurface;
@ -113,7 +113,7 @@ public:
void
CanvasImageCache::NotifyDrawImage(Element* aImage,
nsHTMLCanvasElement* aCanvas,
HTMLCanvasElement* aCanvas,
imgIRequest* aRequest,
gfxASurface* aSurface,
const gfxIntSize& aSize)
@ -144,7 +144,7 @@ CanvasImageCache::NotifyDrawImage(Element* aImage,
gfxASurface*
CanvasImageCache::Lookup(Element* aImage,
nsHTMLCanvasElement* aCanvas,
HTMLCanvasElement* aCanvas,
gfxIntSize* aSize)
{
if (!gImageCache)

View File

@ -9,9 +9,9 @@
namespace mozilla {
namespace dom {
class Element;
class HTMLCanvasElement;
} // namespace dom
} // namespace mozilla
class nsHTMLCanvasElement;
class imgIRequest;
class gfxASurface;
@ -27,7 +27,7 @@ public:
* in aSurface, and the image size is in aSize.
*/
static void NotifyDrawImage(dom::Element* aImage,
nsHTMLCanvasElement* aCanvas,
dom::HTMLCanvasElement* aCanvas,
imgIRequest* aRequest,
gfxASurface* aSurface,
const gfxIntSize& aSize);
@ -39,7 +39,7 @@ public:
* data, and the image size will be returned in aSize.
*/
static gfxASurface* Lookup(dom::Element* aImage,
nsHTMLCanvasElement* aCanvas,
dom::HTMLCanvasElement* aCanvas,
gfxIntSize* aSize);
};

View File

@ -16,7 +16,7 @@
#include "nsContentUtils.h"
#include "nsIDocument.h"
#include "nsHTMLCanvasElement.h"
#include "mozilla/dom/HTMLCanvasElement.h"
#include "nsSVGEffects.h"
#include "nsPresContext.h"
#include "nsIPresShell.h"
@ -621,7 +621,7 @@ CanvasRenderingContext2D::Reset()
}
static void
WarnAboutUnexpectedStyle(nsHTMLCanvasElement* canvasElement)
WarnAboutUnexpectedStyle(HTMLCanvasElement* canvasElement)
{
nsContentUtils::ReportToConsole(
nsIScriptError::warningFlag,
@ -1400,7 +1400,7 @@ CanvasRenderingContext2D::CreatePattern(const HTMLImageOrCanvasOrVideoElement& e
Element* htmlElement;
if (element.IsHTMLCanvasElement()) {
nsHTMLCanvasElement* canvas = element.GetAsHTMLCanvasElement();
HTMLCanvasElement* canvas = element.GetAsHTMLCanvasElement();
htmlElement = canvas;
nsIntSize size = canvas->GetSize();
@ -2913,7 +2913,7 @@ CanvasRenderingContext2D::DrawImage(const HTMLImageOrCanvasOrVideoElement& image
EnsureTarget();
if (image.IsHTMLCanvasElement()) {
nsHTMLCanvasElement* canvas = image.GetAsHTMLCanvasElement();
HTMLCanvasElement* canvas = image.GetAsHTMLCanvasElement();
element = canvas;
nsIntSize size = canvas->GetSize();
if (size.width == 0 || size.height == 0) {

View File

@ -10,7 +10,7 @@
#include "nsICanvasRenderingContextInternal.h"
#include "mozilla/RefPtr.h"
#include "nsColor.h"
#include "nsHTMLCanvasElement.h"
#include "mozilla/dom/HTMLCanvasElement.h"
#include "nsHTMLVideoElement.h"
#include "CanvasUtils.h"
#include "gfxFont.h"
@ -141,7 +141,7 @@ public:
virtual JSObject* WrapObject(JSContext *cx, JSObject *scope,
bool *triedToWrap);
nsHTMLCanvasElement* GetCanvas() const
HTMLCanvasElement* GetCanvas() const
{
// corresponds to changes to the old bindings made in bug 745025
return mCanvasElement->GetOriginalCanvas();

View File

@ -14,7 +14,7 @@
#include "nsIDOMCanvasRenderingContext2D.h"
#include "nsICanvasRenderingContextInternal.h"
#include "nsIHTMLCollection.h"
#include "nsHTMLCanvasElement.h"
#include "mozilla/dom/HTMLCanvasElement.h"
#include "nsIPrincipal.h"
#include "nsGfxCIID.h"
@ -30,7 +30,7 @@ namespace mozilla {
namespace CanvasUtils {
void
DoDrawImageSecurityCheck(nsHTMLCanvasElement *aCanvasElement,
DoDrawImageSecurityCheck(dom::HTMLCanvasElement *aCanvasElement,
nsIPrincipal *aPrincipal,
bool forceWriteOnly,
bool CORSUsed)

View File

@ -10,7 +10,6 @@
#include "mozilla/CheckedInt.h"
class nsHTMLCanvasElement;
class nsIPrincipal;
namespace mozilla {
@ -19,6 +18,10 @@ namespace gfx {
class Matrix;
}
namespace dom {
class HTMLCanvasElement;
}
namespace CanvasUtils {
@ -39,7 +42,7 @@ inline bool CheckSaneSubrectSize(int32_t x, int32_t y, int32_t w, int32_t h,
// Flag aCanvasElement as write-only if drawing an image with aPrincipal
// onto it would make it such.
void DoDrawImageSecurityCheck(nsHTMLCanvasElement *aCanvasElement,
void DoDrawImageSecurityCheck(dom::HTMLCanvasElement *aCanvasElement,
nsIPrincipal *aPrincipal,
bool forceWriteOnly,
bool CORSUsed);

View File

@ -802,7 +802,7 @@ namespace mozilla {
class WebGLContextUserData : public LayerUserData {
public:
WebGLContextUserData(nsHTMLCanvasElement *aContent)
WebGLContextUserData(HTMLCanvasElement *aContent)
: mContent(aContent) {}
/** DidTransactionCallback gets called by the Layers code everytime the WebGL canvas gets composite,
@ -811,7 +811,7 @@ public:
static void DidTransactionCallback(void* aData)
{
WebGLContextUserData *userdata = static_cast<WebGLContextUserData*>(aData);
nsHTMLCanvasElement *canvas = userdata->mContent;
HTMLCanvasElement *canvas = userdata->mContent;
WebGLContext *context = static_cast<WebGLContext*>(canvas->GetContextAtIndex(0));
context->mBackbufferClearingStatus = BackbufferClearingStatus::NotClearedSinceLastPresented;
@ -821,7 +821,7 @@ public:
}
private:
nsRefPtr<nsHTMLCanvasElement> mContent;
nsRefPtr<HTMLCanvasElement> mContent;
};
} // end namespace mozilla

View File

@ -28,7 +28,7 @@
#include "nsIDOMWebGLRenderingContext.h"
#include "nsICanvasRenderingContextInternal.h"
#include "nsHTMLCanvasElement.h"
#include "mozilla/dom/HTMLCanvasElement.h"
#include "nsIDOMHTMLElement.h"
#include "nsIMemoryReporter.h"
#include "nsIJSNativeInitializer.h"
@ -332,7 +332,7 @@ public:
}
// WebIDL WebGLRenderingContext API
nsHTMLCanvasElement* GetCanvas() const {
dom::HTMLCanvasElement* GetCanvas() const {
return mCanvasElement;
}
WebGLsizei DrawingBufferWidth() const {

View File

@ -3,8 +3,8 @@
/* 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/. */
#if !defined(nsHTMLCanvasElement_h__)
#define nsHTMLCanvasElement_h__
#if !defined(mozilla_dom_HTMLCanvasElement_h)
#define mozilla_dom_HTMLCanvasElement_h
#include "nsIDOMHTMLCanvasElement.h"
#include "nsGenericHTMLElement.h"
@ -18,7 +18,6 @@
class nsICanvasRenderingContextInternal;
class nsIDOMFile;
class nsHTMLCanvasPrintState;
class nsITimerCallback;
class nsIPropertyBag;
@ -33,20 +32,22 @@ namespace gfx {
struct Rect;
}
}
namespace dom {
class nsHTMLCanvasElement : public nsGenericHTMLElement,
class HTMLCanvasPrintState;
class HTMLCanvasElement MOZ_FINAL : public nsGenericHTMLElement,
public nsICanvasElementExternal,
public nsIDOMHTMLCanvasElement
{
typedef mozilla::layers::CanvasLayer CanvasLayer;
typedef mozilla::layers::LayerManager LayerManager;
typedef layers::CanvasLayer CanvasLayer;
typedef layers::LayerManager LayerManager;
public:
nsHTMLCanvasElement(already_AddRefed<nsINodeInfo> aNodeInfo);
virtual ~nsHTMLCanvasElement();
HTMLCanvasElement(already_AddRefed<nsINodeInfo> aNodeInfo);
virtual ~HTMLCanvasElement();
NS_IMPL_FROMCONTENT_HTML_WITH_TAG(nsHTMLCanvasElement, canvas)
NS_IMPL_FROMCONTENT_HTML_WITH_TAG(HTMLCanvasElement, canvas)
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
@ -64,7 +65,7 @@ public:
NS_DECL_NSIDOMHTMLCANVASELEMENT
// CC
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsHTMLCanvasElement,
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(HTMLCanvasElement,
nsGenericHTMLElement)
/**
@ -173,10 +174,10 @@ protected:
void CallPrintCallback();
nsString mCurrentContextId;
nsRefPtr<nsHTMLCanvasElement> mOriginalCanvas;
nsRefPtr<HTMLCanvasElement> mOriginalCanvas;
nsCOMPtr<nsIPrintCallback> mPrintCallback;
nsCOMPtr<nsICanvasRenderingContextInternal> mCurrentContext;
nsCOMPtr<nsHTMLCanvasPrintState> mPrintState;
nsCOMPtr<HTMLCanvasPrintState> mPrintState;
public:
// Record whether this canvas should be write-only or not.
@ -193,13 +194,16 @@ public:
void ResetPrintCallback();
nsHTMLCanvasElement* GetOriginalCanvas();
HTMLCanvasElement* GetOriginalCanvas();
};
inline nsISupports*
GetISupports(nsHTMLCanvasElement* p)
GetISupports(HTMLCanvasElement* p)
{
return static_cast<mozilla::dom::Element*>(p);
return static_cast<Element*>(p);
}
#endif /* nsHTMLCanvasElement_h__ */
} // namespace dom
} // namespace mozilla
#endif /* mozilla_dom_HTMLCanvasElement_h */

View File

@ -31,10 +31,15 @@ EXPORTS = \
nsITextControlElement.h \
nsFormSubmission.h \
nsHTMLAudioElement.h \
nsHTMLCanvasElement.h \
nsHTMLMediaElement.h \
nsHTMLVideoElement.h \
nsIHTMLCollection.h \
$(NULL)
EXPORTS_NAMESPACES = mozilla/dom
EXPORTS_mozilla/dom = \
HTMLCanvasElement.h \
$(NULL)
include $(topsrcdir)/config/rules.mk

View File

@ -3,7 +3,7 @@
* 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 "nsHTMLCanvasElement.h"
#include "mozilla/dom/HTMLCanvasElement.h"
#include "nsAttrValueInlines.h"
#include "mozilla/Base64.h"
@ -36,10 +36,15 @@
#define DEFAULT_CANVAS_WIDTH 300
#define DEFAULT_CANVAS_HEIGHT 150
using namespace mozilla;
using namespace mozilla::dom;
using namespace mozilla::layers;
nsGenericHTMLElement*
NS_NewHTMLCanvasElement(already_AddRefed<nsINodeInfo> aNodeInfo,
mozilla::dom::FromParser aFromParser)
{
return new mozilla::dom::HTMLCanvasElement(aNodeInfo);
}
namespace {
typedef mozilla::dom::HTMLImageElementOrHTMLCanvasElementOrHTMLVideoElement
@ -69,10 +74,13 @@ private:
} // anonymous namespace
class nsHTMLCanvasPrintState : public nsIDOMMozCanvasPrintState
namespace mozilla {
namespace dom {
class HTMLCanvasPrintState : public nsIDOMMozCanvasPrintState
{
public:
nsHTMLCanvasPrintState(nsHTMLCanvasElement* aCanvas,
HTMLCanvasPrintState(HTMLCanvasElement* aCanvas,
nsICanvasRenderingContextInternal* aContext,
nsITimerCallback* aCallback)
: mIsDone(false), mPendingNotify(false), mCanvas(aCanvas),
@ -94,8 +102,8 @@ public:
if (mCanvas) {
mCanvas->InvalidateCanvas();
}
nsRefPtr<nsRunnableMethod<nsHTMLCanvasPrintState> > doneEvent =
NS_NewRunnableMethod(this, &nsHTMLCanvasPrintState::NotifyDone);
nsRefPtr<nsRunnableMethod<HTMLCanvasPrintState> > doneEvent =
NS_NewRunnableMethod(this, &HTMLCanvasPrintState::NotifyDone);
if (NS_SUCCEEDED(NS_DispatchToCurrentThread(doneEvent))) {
mPendingNotify = true;
}
@ -116,64 +124,55 @@ public:
// CC
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_CLASS(nsHTMLCanvasPrintState)
NS_DECL_CYCLE_COLLECTION_CLASS(HTMLCanvasPrintState)
private:
virtual ~nsHTMLCanvasPrintState()
virtual ~HTMLCanvasPrintState()
{
}
bool mPendingNotify;
protected:
nsRefPtr<nsHTMLCanvasElement> mCanvas;
nsRefPtr<HTMLCanvasElement> mCanvas;
nsCOMPtr<nsICanvasRenderingContextInternal> mContext;
nsCOMPtr<nsITimerCallback> mCallback;
};
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsHTMLCanvasPrintState)
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsHTMLCanvasPrintState)
NS_IMPL_CYCLE_COLLECTING_ADDREF(HTMLCanvasPrintState)
NS_IMPL_CYCLE_COLLECTING_RELEASE(HTMLCanvasPrintState)
DOMCI_DATA(MozCanvasPrintState, nsHTMLCanvasPrintState)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsHTMLCanvasPrintState)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(HTMLCanvasPrintState)
NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_INTERFACE_MAP_ENTRY(nsIDOMMozCanvasPrintState)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(MozCanvasPrintState)
NS_INTERFACE_MAP_END
NS_IMPL_CYCLE_COLLECTION_CLASS(nsHTMLCanvasPrintState)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsHTMLCanvasPrintState)
NS_IMPL_CYCLE_COLLECTION_CLASS(HTMLCanvasPrintState)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(HTMLCanvasPrintState)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mCanvas)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mContext)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mCallback)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsHTMLCanvasPrintState)
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(HTMLCanvasPrintState)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mCanvas)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mContext)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mCallback)
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
// ---------------------------------------------------------------------------
nsGenericHTMLElement*
NS_NewHTMLCanvasElement(already_AddRefed<nsINodeInfo> aNodeInfo,
FromParser aFromParser)
{
return new nsHTMLCanvasElement(aNodeInfo);
}
nsHTMLCanvasElement::nsHTMLCanvasElement(already_AddRefed<nsINodeInfo> aNodeInfo)
HTMLCanvasElement::HTMLCanvasElement(already_AddRefed<nsINodeInfo> aNodeInfo)
: nsGenericHTMLElement(aNodeInfo),
mWriteOnly(false)
{
}
nsHTMLCanvasElement::~nsHTMLCanvasElement()
HTMLCanvasElement::~HTMLCanvasElement()
{
ResetPrintCallback();
}
NS_IMPL_CYCLE_COLLECTION_CLASS(nsHTMLCanvasElement)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsHTMLCanvasElement,
NS_IMPL_CYCLE_COLLECTION_CLASS(HTMLCanvasElement)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(HTMLCanvasElement,
nsGenericHTMLElement)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mCurrentContext)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mPrintCallback)
@ -181,7 +180,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsHTMLCanvasElement,
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mOriginalCanvas)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(nsHTMLCanvasElement,
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(HTMLCanvasElement,
nsGenericHTMLElement)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mCurrentContext)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mPrintCallback)
@ -189,23 +188,21 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(nsHTMLCanvasElement,
NS_IMPL_CYCLE_COLLECTION_UNLINK(mOriginalCanvas)
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_IMPL_ADDREF_INHERITED(nsHTMLCanvasElement, Element)
NS_IMPL_RELEASE_INHERITED(nsHTMLCanvasElement, Element)
NS_IMPL_ADDREF_INHERITED(HTMLCanvasElement, Element)
NS_IMPL_RELEASE_INHERITED(HTMLCanvasElement, Element)
DOMCI_NODE_DATA(HTMLCanvasElement, nsHTMLCanvasElement)
NS_INTERFACE_TABLE_HEAD_CYCLE_COLLECTION_INHERITED(nsHTMLCanvasElement)
NS_HTML_CONTENT_INTERFACE_TABLE2(nsHTMLCanvasElement,
NS_INTERFACE_TABLE_HEAD_CYCLE_COLLECTION_INHERITED(HTMLCanvasElement)
NS_HTML_CONTENT_INTERFACE_TABLE2(HTMLCanvasElement,
nsIDOMHTMLCanvasElement,
nsICanvasElementExternal)
NS_HTML_CONTENT_INTERFACE_TABLE_TO_MAP_SEGUE(nsHTMLCanvasElement,
NS_HTML_CONTENT_INTERFACE_TABLE_TO_MAP_SEGUE(HTMLCanvasElement,
nsGenericHTMLElement)
NS_HTML_CONTENT_INTERFACE_TABLE_TAIL_CLASSINFO(HTMLCanvasElement)
NS_IMPL_ELEMENT_CLONE(nsHTMLCanvasElement)
NS_IMPL_ELEMENT_CLONE(HTMLCanvasElement)
nsIntSize
nsHTMLCanvasElement::GetWidthHeight()
HTMLCanvasElement::GetWidthHeight()
{
nsIntSize size(DEFAULT_CANVAS_WIDTH, DEFAULT_CANVAS_HEIGHT);
const nsAttrValue* value;
@ -225,12 +222,12 @@ nsHTMLCanvasElement::GetWidthHeight()
return size;
}
NS_IMPL_UINT_ATTR_DEFAULT_VALUE(nsHTMLCanvasElement, Width, width, DEFAULT_CANVAS_WIDTH)
NS_IMPL_UINT_ATTR_DEFAULT_VALUE(nsHTMLCanvasElement, Height, height, DEFAULT_CANVAS_HEIGHT)
NS_IMPL_BOOL_ATTR(nsHTMLCanvasElement, MozOpaque, moz_opaque)
NS_IMPL_UINT_ATTR_DEFAULT_VALUE(HTMLCanvasElement, Width, width, DEFAULT_CANVAS_WIDTH)
NS_IMPL_UINT_ATTR_DEFAULT_VALUE(HTMLCanvasElement, Height, height, DEFAULT_CANVAS_HEIGHT)
NS_IMPL_BOOL_ATTR(HTMLCanvasElement, MozOpaque, moz_opaque)
nsresult
nsHTMLCanvasElement::SetAttr(int32_t aNameSpaceID, nsIAtom* aName,
HTMLCanvasElement::SetAttr(int32_t aNameSpaceID, nsIAtom* aName,
nsIAtom* aPrefix, const nsAString& aValue,
bool aNotify)
{
@ -247,7 +244,7 @@ nsHTMLCanvasElement::SetAttr(int32_t aNameSpaceID, nsIAtom* aName,
}
void
nsHTMLCanvasElement::HandlePrintCallback(nsPresContext::nsPresContextType aType)
HTMLCanvasElement::HandlePrintCallback(nsPresContext::nsPresContextType aType)
{
// Only call the print callback here if 1) we're in a print testing mode or
// print preview mode, 2) the canvas has a print callback and 3) the callback
@ -263,7 +260,7 @@ nsHTMLCanvasElement::HandlePrintCallback(nsPresContext::nsPresContextType aType)
}
nsresult
nsHTMLCanvasElement::DispatchPrintCallback(nsITimerCallback* aCallback)
HTMLCanvasElement::DispatchPrintCallback(nsITimerCallback* aCallback)
{
// For print reftests the context may not be initialized yet, so get a context
// so mCurrentContext is set.
@ -274,15 +271,15 @@ nsHTMLCanvasElement::DispatchPrintCallback(nsITimerCallback* aCallback)
getter_AddRefs(context));
NS_ENSURE_SUCCESS(rv, rv);
}
mPrintState = new nsHTMLCanvasPrintState(this, mCurrentContext, aCallback);
mPrintState = new HTMLCanvasPrintState(this, mCurrentContext, aCallback);
nsRefPtr<nsRunnableMethod<nsHTMLCanvasElement> > renderEvent =
NS_NewRunnableMethod(this, &nsHTMLCanvasElement::CallPrintCallback);
nsRefPtr<nsRunnableMethod<HTMLCanvasElement> > renderEvent =
NS_NewRunnableMethod(this, &HTMLCanvasElement::CallPrintCallback);
return NS_DispatchToCurrentThread(renderEvent);
}
void
nsHTMLCanvasElement::CallPrintCallback()
HTMLCanvasElement::CallPrintCallback()
{
nsCOMPtr<nsIPrintCallback> printCallback;
GetMozPrintCallback(getter_AddRefs(printCallback));
@ -290,7 +287,7 @@ nsHTMLCanvasElement::CallPrintCallback()
}
void
nsHTMLCanvasElement::ResetPrintCallback()
HTMLCanvasElement::ResetPrintCallback()
{
if (mPrintState) {
mPrintState = nullptr;
@ -298,7 +295,7 @@ nsHTMLCanvasElement::ResetPrintCallback()
}
bool
nsHTMLCanvasElement::IsPrintCallbackDone()
HTMLCanvasElement::IsPrintCallbackDone()
{
if (mPrintState == nullptr) {
return true;
@ -307,20 +304,20 @@ nsHTMLCanvasElement::IsPrintCallbackDone()
return mPrintState->mIsDone;
}
nsHTMLCanvasElement*
nsHTMLCanvasElement::GetOriginalCanvas()
HTMLCanvasElement*
HTMLCanvasElement::GetOriginalCanvas()
{
return mOriginalCanvas ? mOriginalCanvas.get() : this;
}
nsresult
nsHTMLCanvasElement::CopyInnerTo(Element* aDest)
HTMLCanvasElement::CopyInnerTo(Element* aDest)
{
nsresult rv = nsGenericHTMLElement::CopyInnerTo(aDest);
NS_ENSURE_SUCCESS(rv, rv);
if (aDest->OwnerDoc()->IsStaticDocument()) {
nsHTMLCanvasElement* dest = static_cast<nsHTMLCanvasElement*>(aDest);
nsHTMLCanvasElement* self = const_cast<nsHTMLCanvasElement*>(this);
HTMLCanvasElement* dest = static_cast<HTMLCanvasElement*>(aDest);
HTMLCanvasElement* self = const_cast<HTMLCanvasElement*>(this);
dest->mOriginalCanvas = self;
nsCOMPtr<nsISupports> cxt;
@ -340,7 +337,7 @@ nsHTMLCanvasElement::CopyInnerTo(Element* aDest)
}
nsChangeHint
nsHTMLCanvasElement::GetAttributeChangeHint(const nsIAtom* aAttribute,
HTMLCanvasElement::GetAttributeChangeHint(const nsIAtom* aAttribute,
int32_t aModType) const
{
nsChangeHint retval =
@ -357,7 +354,7 @@ nsHTMLCanvasElement::GetAttributeChangeHint(const nsIAtom* aAttribute,
}
bool
nsHTMLCanvasElement::ParseAttribute(int32_t aNamespaceID,
HTMLCanvasElement::ParseAttribute(int32_t aNamespaceID,
nsIAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult)
@ -372,10 +369,10 @@ nsHTMLCanvasElement::ParseAttribute(int32_t aNamespaceID,
}
// nsHTMLCanvasElement::toDataURL
// HTMLCanvasElement::toDataURL
NS_IMETHODIMP
nsHTMLCanvasElement::ToDataURL(const nsAString& aType, nsIVariant* aParams,
HTMLCanvasElement::ToDataURL(const nsAString& aType, nsIVariant* aParams,
uint8_t optional_argc, nsAString& aDataURL)
{
// do a trust check if this is a write-only canvas
@ -386,10 +383,10 @@ nsHTMLCanvasElement::ToDataURL(const nsAString& aType, nsIVariant* aParams,
return ToDataURLImpl(aType, aParams, aDataURL);
}
// nsHTMLCanvasElement::mozFetchAsStream
// HTMLCanvasElement::mozFetchAsStream
NS_IMETHODIMP
nsHTMLCanvasElement::MozFetchAsStream(nsIInputStreamCallback *aCallback,
HTMLCanvasElement::MozFetchAsStream(nsIInputStreamCallback *aCallback,
const nsAString& aType)
{
if (!nsContentUtils::IsCallerChrome())
@ -417,14 +414,14 @@ nsHTMLCanvasElement::MozFetchAsStream(nsIInputStreamCallback *aCallback,
}
NS_IMETHODIMP
nsHTMLCanvasElement::SetMozPrintCallback(nsIPrintCallback *aCallback)
HTMLCanvasElement::SetMozPrintCallback(nsIPrintCallback *aCallback)
{
mPrintCallback = aCallback;
return NS_OK;
}
NS_IMETHODIMP
nsHTMLCanvasElement::GetMozPrintCallback(nsIPrintCallback** aCallback)
HTMLCanvasElement::GetMozPrintCallback(nsIPrintCallback** aCallback)
{
if (mOriginalCanvas) {
mOriginalCanvas->GetMozPrintCallback(aCallback);
@ -435,7 +432,7 @@ nsHTMLCanvasElement::GetMozPrintCallback(nsIPrintCallback** aCallback)
}
nsresult
nsHTMLCanvasElement::ExtractData(const nsAString& aType,
HTMLCanvasElement::ExtractData(const nsAString& aType,
const nsAString& aOptions,
nsIInputStream** aStream,
bool& aFellBackToPNG)
@ -500,7 +497,7 @@ nsHTMLCanvasElement::ExtractData(const nsAString& aType,
}
nsresult
nsHTMLCanvasElement::ToDataURLImpl(const nsAString& aMimeType,
HTMLCanvasElement::ToDataURLImpl(const nsAString& aMimeType,
nsIVariant* aEncoderOptions,
nsAString& aDataURL)
{
@ -585,7 +582,7 @@ nsHTMLCanvasElement::ToDataURLImpl(const nsAString& aMimeType,
// XXXkhuey the encoding should be off the main thread, but we're lazy.
NS_IMETHODIMP
nsHTMLCanvasElement::ToBlob(nsIFileCallback* aCallback,
HTMLCanvasElement::ToBlob(nsIFileCallback* aCallback,
const nsAString& aType,
nsIVariant* aParams,
uint8_t optional_argc)
@ -638,7 +635,7 @@ nsHTMLCanvasElement::ToBlob(nsIFileCallback* aCallback,
}
NS_IMETHODIMP
nsHTMLCanvasElement::MozGetAsFile(const nsAString& aName,
HTMLCanvasElement::MozGetAsFile(const nsAString& aName,
const nsAString& aType,
uint8_t optional_argc,
nsIDOMFile** aResult)
@ -653,7 +650,7 @@ nsHTMLCanvasElement::MozGetAsFile(const nsAString& aName,
}
nsresult
nsHTMLCanvasElement::MozGetAsFileImpl(const nsAString& aName,
HTMLCanvasElement::MozGetAsFileImpl(const nsAString& aName,
const nsAString& aType,
nsIDOMFile** aResult)
{
@ -692,7 +689,7 @@ nsHTMLCanvasElement::MozGetAsFileImpl(const nsAString& aName,
}
nsresult
nsHTMLCanvasElement::GetContextHelper(const nsAString& aContextId,
HTMLCanvasElement::GetContextHelper(const nsAString& aContextId,
nsICanvasRenderingContextInternal **aContext)
{
NS_ENSURE_ARG(aContext);
@ -744,7 +741,7 @@ nsHTMLCanvasElement::GetContextHelper(const nsAString& aContextId,
}
NS_IMETHODIMP
nsHTMLCanvasElement::GetContext(const nsAString& aContextId,
HTMLCanvasElement::GetContext(const nsAString& aContextId,
const JS::Value& aContextOptions,
nsISupports **aContext)
{
@ -831,7 +828,7 @@ nsHTMLCanvasElement::GetContext(const nsAString& aContextId,
}
NS_IMETHODIMP
nsHTMLCanvasElement::MozGetIPCContext(const nsAString& aContextId,
HTMLCanvasElement::MozGetIPCContext(const nsAString& aContextId,
nsISupports **aContext)
{
if(!nsContentUtils::IsCallerChrome()) {
@ -866,7 +863,7 @@ nsHTMLCanvasElement::MozGetIPCContext(const nsAString& aContextId,
}
nsresult
nsHTMLCanvasElement::UpdateContext(nsIPropertyBag *aNewContextOptions)
HTMLCanvasElement::UpdateContext(nsIPropertyBag *aNewContextOptions)
{
if (!mCurrentContext)
return NS_OK;
@ -898,25 +895,25 @@ nsHTMLCanvasElement::UpdateContext(nsIPropertyBag *aNewContextOptions)
}
nsIntSize
nsHTMLCanvasElement::GetSize()
HTMLCanvasElement::GetSize()
{
return GetWidthHeight();
}
bool
nsHTMLCanvasElement::IsWriteOnly()
HTMLCanvasElement::IsWriteOnly()
{
return mWriteOnly;
}
void
nsHTMLCanvasElement::SetWriteOnly()
HTMLCanvasElement::SetWriteOnly()
{
mWriteOnly = true;
}
void
nsHTMLCanvasElement::InvalidateCanvasContent(const gfx::Rect* damageRect)
HTMLCanvasElement::InvalidateCanvasContent(const gfx::Rect* damageRect)
{
// We don't need to flush anything here; if there's no frame or if
// we plan to reframe we don't need to invalidate it anyway.
@ -962,7 +959,7 @@ nsHTMLCanvasElement::InvalidateCanvasContent(const gfx::Rect* damageRect)
}
void
nsHTMLCanvasElement::InvalidateCanvas()
HTMLCanvasElement::InvalidateCanvas()
{
// We don't need to flush anything here; if there's no frame or if
// we plan to reframe we don't need to invalidate it anyway.
@ -974,7 +971,7 @@ nsHTMLCanvasElement::InvalidateCanvas()
}
int32_t
nsHTMLCanvasElement::CountContexts()
HTMLCanvasElement::CountContexts()
{
if (mCurrentContext)
return 1;
@ -983,7 +980,7 @@ nsHTMLCanvasElement::CountContexts()
}
nsICanvasRenderingContextInternal *
nsHTMLCanvasElement::GetContextAtIndex(int32_t index)
HTMLCanvasElement::GetContextAtIndex(int32_t index)
{
if (mCurrentContext && index == 0)
return mCurrentContext;
@ -992,13 +989,13 @@ nsHTMLCanvasElement::GetContextAtIndex(int32_t index)
}
bool
nsHTMLCanvasElement::GetIsOpaque()
HTMLCanvasElement::GetIsOpaque()
{
return HasAttr(kNameSpaceID_None, nsGkAtoms::moz_opaque);
}
already_AddRefed<CanvasLayer>
nsHTMLCanvasElement::GetCanvasLayer(nsDisplayListBuilder* aBuilder,
HTMLCanvasElement::GetCanvasLayer(nsDisplayListBuilder* aBuilder,
CanvasLayer *aOldLayer,
LayerManager *aManager)
{
@ -1009,13 +1006,13 @@ nsHTMLCanvasElement::GetCanvasLayer(nsDisplayListBuilder* aBuilder,
}
bool
nsHTMLCanvasElement::ShouldForceInactiveLayer(LayerManager *aManager)
HTMLCanvasElement::ShouldForceInactiveLayer(LayerManager *aManager)
{
return !mCurrentContext || mCurrentContext->ShouldForceInactiveLayer(aManager);
}
void
nsHTMLCanvasElement::MarkContextClean()
HTMLCanvasElement::MarkContextClean()
{
if (!mCurrentContext)
return;
@ -1024,13 +1021,13 @@ nsHTMLCanvasElement::MarkContextClean()
}
NS_IMETHODIMP_(nsIntSize)
nsHTMLCanvasElement::GetSizeExternal()
HTMLCanvasElement::GetSizeExternal()
{
return GetWidthHeight();
}
NS_IMETHODIMP
nsHTMLCanvasElement::RenderContextsExternal(gfxContext *aContext, gfxPattern::GraphicsFilter aFilter, uint32_t aFlags)
HTMLCanvasElement::RenderContextsExternal(gfxContext *aContext, gfxPattern::GraphicsFilter aFilter, uint32_t aFlags)
{
if (!mCurrentContext)
return NS_OK;
@ -1038,3 +1035,8 @@ nsHTMLCanvasElement::RenderContextsExternal(gfxContext *aContext, gfxPattern::Gr
return mCurrentContext->Render(aContext, aFilter, aFlags);
}
} // namespace dom
} // namespace mozilla
DOMCI_NODE_DATA(HTMLCanvasElement, mozilla::dom::HTMLCanvasElement)
DOMCI_DATA(MozCanvasPrintState, mozilla::dom::HTMLCanvasPrintState)

View File

@ -55,7 +55,7 @@ CPPSRCS = \
nsHTMLBRElement.cpp \
HTMLBodyElement.cpp \
nsHTMLButtonElement.cpp \
nsHTMLCanvasElement.cpp \
HTMLCanvasElement.cpp \
HTMLDataListElement.cpp \
HTMLDivElement.cpp \
nsHTMLFieldSetElement.cpp \

View File

@ -1025,7 +1025,6 @@ def addExternalHTMLElement(element):
addExternalIface(element, nativeType=nativeElement,
headerFile=nativeElement + '.h')
addExternalHTMLElement('HTMLCanvasElement')
addExternalHTMLElement('HTMLFormElement')
addExternalHTMLElement('HTMLMenuElement')
addExternalHTMLElement('HTMLOptionElement')
@ -1044,6 +1043,7 @@ addExternalIface('DOMStringList')
addExternalIface('File')
addExternalIface('HitRegionOptions', nativeType='nsISupports')
addExternalIface('HTMLHeadElement', nativeType='mozilla::dom::Element')
addExternalIface('HTMLCanvasElement', nativeType='mozilla::dom::HTMLCanvasElement')
addExternalIface('imgINotificationObserver', nativeType='imgINotificationObserver')
addExternalIface('imgIRequest', nativeType='imgIRequest', notflattened=True)
addExternalIface('LockedFile')

View File

@ -7,7 +7,7 @@
#include "nsDOMClassInfoID.h"
#include "nsGenericHTMLElement.h"
#include "nsHTMLCanvasElement.h"
#include "mozilla/dom/HTMLCanvasElement.h"
#include "nsHTMLFormElement.h"
#include "mozilla/dom/HTMLImageElement.h"
#include "nsHTMLOptionElement.h"
@ -168,7 +168,7 @@ xpc_qsUnwrapArg<_clazz>(JSContext *cx, jsval v, _clazz **ppArg, \
return rv; \
}
DEFINE_UNWRAP_CAST_HTML(canvas, nsHTMLCanvasElement)
DEFINE_UNWRAP_CAST_HTML(canvas, mozilla::dom::HTMLCanvasElement)
DEFINE_UNWRAP_CAST_HTML(form, nsHTMLFormElement)
DEFINE_UNWRAP_CAST_HTML(img, mozilla::dom::HTMLImageElement)
DEFINE_UNWRAP_CAST_HTML(optgroup, nsHTMLOptGroupElement)

View File

@ -49,7 +49,7 @@
#include "gfxTypes.h"
#include "gfxUserFontSet.h"
#include "nsTArray.h"
#include "nsHTMLCanvasElement.h"
#include "mozilla/dom/HTMLCanvasElement.h"
#include "nsICanvasRenderingContextInternal.h"
#include "gfxPlatform.h"
#include "nsClientRect.h"
@ -4520,7 +4520,7 @@ nsLayoutUtils::SurfaceFromElement(HTMLImageElement *aElement,
}
nsLayoutUtils::SurfaceFromElementResult
nsLayoutUtils::SurfaceFromElement(nsHTMLCanvasElement* aElement,
nsLayoutUtils::SurfaceFromElement(HTMLCanvasElement* aElement,
uint32_t aSurfaceFlags)
{
SurfaceFromElementResult result;
@ -4559,7 +4559,7 @@ nsLayoutUtils::SurfaceFromElement(nsHTMLCanvasElement* aElement,
nsRefPtr<gfxContext> ctx = new gfxContext(surf);
// XXX shouldn't use the external interface, but maybe we can layerify this
uint32_t flags = premultAlpha ? nsHTMLCanvasElement::RenderFlagPremultAlpha : 0;
uint32_t flags = premultAlpha ? HTMLCanvasElement::RenderFlagPremultAlpha : 0;
rv = aElement->RenderContextsExternal(ctx, gfxPattern::FILTER_NEAREST, flags);
if (NS_FAILED(rv))
return result;
@ -4636,8 +4636,8 @@ nsLayoutUtils::SurfaceFromElement(dom::Element* aElement,
uint32_t aSurfaceFlags)
{
// If it's a <canvas>, we may be able to just grab its internal surface
if (nsHTMLCanvasElement* canvas =
nsHTMLCanvasElement::FromContentOrNull(aElement)) {
if (HTMLCanvasElement* canvas =
HTMLCanvasElement::FromContentOrNull(aElement)) {
return SurfaceFromElement(canvas, aSurfaceFlags);
}

View File

@ -18,7 +18,6 @@ class nsDisplayItem;
class nsFontMetrics;
class nsClientRectList;
class nsFontFaceList;
class nsHTMLCanvasElement;
class nsHTMLVideoElement;
class nsIImageLoadingContent;
@ -47,6 +46,7 @@ namespace mozilla {
namespace dom {
class Element;
class HTMLImageElement;
class HTMLCanvasElement;
} // namespace dom
} // namespace mozilla
@ -1476,7 +1476,7 @@ public:
// for HTMLImageElement.
static SurfaceFromElementResult SurfaceFromElement(mozilla::dom::HTMLImageElement *aElement,
uint32_t aSurfaceFlags = 0);
static SurfaceFromElementResult SurfaceFromElement(nsHTMLCanvasElement *aElement,
static SurfaceFromElementResult SurfaceFromElement(mozilla::dom::HTMLCanvasElement *aElement,
uint32_t aSurfaceFlags = 0);
static SurfaceFromElementResult SurfaceFromElement(nsHTMLVideoElement *aElement,
uint32_t aSurfaceFlags = 0);

View File

@ -11,7 +11,7 @@
#include "nsGkAtoms.h"
#include "nsHTMLCanvasFrame.h"
#include "nsHTMLCanvasElement.h"
#include "mozilla/dom/HTMLCanvasElement.h"
#include "nsDisplayList.h"
#include "nsLayoutUtils.h"
#include "Layers.h"
@ -21,6 +21,7 @@
#include "gfxContext.h"
using namespace mozilla;
using namespace mozilla::dom;
using namespace mozilla::layers;
class nsDisplayCanvas : public nsDisplayItem {
@ -42,8 +43,8 @@ public:
bool* aSnap) {
*aSnap = false;
nsIFrame* f = GetUnderlyingFrame();
nsHTMLCanvasElement *canvas =
nsHTMLCanvasElement::FromContent(f->GetContent());
HTMLCanvasElement *canvas =
HTMLCanvasElement::FromContent(f->GetContent());
nsRegion result;
if (canvas->GetIsOpaque()) {
result = GetBounds(aBuilder, aSnap);
@ -68,7 +69,7 @@ public:
LayerManager* aManager,
const FrameLayerBuilder::ContainerParameters& aParameters)
{
if (nsHTMLCanvasElement::FromContent(mFrame->GetContent())->ShouldForceInactiveLayer(aManager))
if (HTMLCanvasElement::FromContent(mFrame->GetContent())->ShouldForceInactiveLayer(aManager))
return LAYER_INACTIVE;
// If compositing is cheap, just do that
@ -111,8 +112,8 @@ nsIntSize
nsHTMLCanvasFrame::GetCanvasSize()
{
nsIntSize size(0,0);
nsHTMLCanvasElement *canvas =
nsHTMLCanvasElement::FromContentOrNull(GetContent());
HTMLCanvasElement *canvas =
HTMLCanvasElement::FromContentOrNull(GetContent());
if (canvas) {
size = canvas->GetSize();
} else {
@ -245,7 +246,7 @@ nsHTMLCanvasFrame::BuildLayer(nsDisplayListBuilder* aBuilder,
const ContainerParameters& aContainerParameters)
{
nsRect area = GetContentRect() - GetPosition() + aItem->ToReferenceFrame();
nsHTMLCanvasElement* element = static_cast<nsHTMLCanvasElement*>(GetContent());
HTMLCanvasElement* element = static_cast<HTMLCanvasElement*>(GetContent());
nsIntSize canvasSize = GetCanvasSize();
nsPresContext* presContext = PresContext();

View File

@ -20,7 +20,7 @@
#include "nsDisplayList.h"
#include "mozilla/Preferences.h"
#include "nsHTMLCanvasFrame.h"
#include "nsHTMLCanvasElement.h"
#include "mozilla/dom/HTMLCanvasElement.h"
#include "nsICanvasRenderingContextInternal.h"
// DateTime Includes
@ -34,6 +34,7 @@
#include "nsIServiceManager.h"
using namespace mozilla;
using namespace mozilla::dom;
static const char sPrintOptionsContractID[] = "@mozilla.org/gfx/printsettings-service;1";
@ -482,7 +483,7 @@ nsSimplePageSequenceFrame::StartPrint(nsPresContext* aPresContext,
}
void
GetPrintCanvasElementsInFrame(nsIFrame* aFrame, nsTArray<nsRefPtr<nsHTMLCanvasElement> >* aArr)
GetPrintCanvasElementsInFrame(nsIFrame* aFrame, nsTArray<nsRefPtr<HTMLCanvasElement> >* aArr)
{
if (!aFrame) {
return;
@ -499,8 +500,8 @@ GetPrintCanvasElementsInFrame(nsIFrame* aFrame, nsTArray<nsRefPtr<nsHTMLCanvasEl
// If there is a canvasFrame, try to get actual canvas element.
if (canvasFrame) {
nsHTMLCanvasElement* canvas =
nsHTMLCanvasElement::FromContentOrNull(canvasFrame->GetContent());
HTMLCanvasElement* canvas =
HTMLCanvasElement::FromContentOrNull(canvasFrame->GetContent());
nsCOMPtr<nsIPrintCallback> printCallback;
if (canvas &&
NS_SUCCEEDED(canvas->GetMozPrintCallback(getter_AddRefs(printCallback))) &&
@ -519,8 +520,8 @@ GetPrintCanvasElementsInFrame(nsIFrame* aFrame, nsTArray<nsRefPtr<nsHTMLCanvasEl
}
}
// The current child is not a nsHTMLCanvasFrame OR it is but there is
// no nsHTMLCanvasElement on it. Check if children of `child` might
// contain a nsHTMLCanvasElement.
// no HTMLCanvasElement on it. Check if children of `child` might
// contain a HTMLCanvasElement.
GetPrintCanvasElementsInFrame(child, aArr);
}
}
@ -590,7 +591,7 @@ nsSimplePageSequenceFrame::PrePrintNextPage(nsITimerCallback* aCallback, bool* a
DetermineWhetherToPrintPage();
// Nothing to do if the current page doesn't get printed OR rendering to
// preview. For preview, the `CallPrintCallback` is called from within the
// nsHTMLCanvasElement::HandlePrintCallback.
// HTMLCanvasElement::HandlePrintCallback.
if (!mPrintThisPage || !PresContext()->IsRootPaginatedDocument()) {
*aDone = true;
return NS_OK;
@ -623,7 +624,7 @@ nsSimplePageSequenceFrame::PrePrintNextPage(nsITimerCallback* aCallback, bool* a
NS_ENSURE_TRUE(renderingSurface, NS_ERROR_OUT_OF_MEMORY);
for (int32_t i = mCurrentCanvasList.Length() - 1; i >= 0 ; i--) {
nsHTMLCanvasElement* canvas = mCurrentCanvasList[i];
HTMLCanvasElement* canvas = mCurrentCanvasList[i];
nsIntSize size = canvas->GetSize();
nsRefPtr<gfxASurface> printSurface = renderingSurface->
@ -650,7 +651,7 @@ nsSimplePageSequenceFrame::PrePrintNextPage(nsITimerCallback* aCallback, bool* a
}
uint32_t doneCounter = 0;
for (int32_t i = mCurrentCanvasList.Length() - 1; i >= 0 ; i--) {
nsHTMLCanvasElement* canvas = mCurrentCanvasList[i];
HTMLCanvasElement* canvas = mCurrentCanvasList[i];
if (canvas->IsPrintCallbackDone()) {
doneCounter++;
@ -666,7 +667,7 @@ NS_IMETHODIMP
nsSimplePageSequenceFrame::ResetPrintCanvasList()
{
for (int32_t i = mCurrentCanvasList.Length() - 1; i >= 0 ; i--) {
nsHTMLCanvasElement* canvas = mCurrentCanvasList[i];
HTMLCanvasElement* canvas = mCurrentCanvasList[i];
canvas->ResetPrintCallback();
}

View File

@ -11,7 +11,7 @@
#include "nsIPrintSettings.h"
#include "nsIPrintOptions.h"
#include "nsIDateTimeFormat.h"
#include "nsHTMLCanvasElement.h"
#include "mozilla/dom/HTMLCanvasElement.h"
//-----------------------------------------------
// This class maintains all the data that
@ -135,7 +135,7 @@ protected:
int32_t mFromPageNum;
int32_t mToPageNum;
nsTArray<int32_t> mPageRanges;
nsTArray<nsRefPtr<nsHTMLCanvasElement> > mCurrentCanvasList;
nsTArray<nsRefPtr<mozilla::dom::HTMLCanvasElement> > mCurrentCanvasList;
// Selection Printing Info
nscoord mSelectionHeight;

View File

@ -14,7 +14,7 @@
#include "nsFrameList.h"
#include "mozilla/Attributes.h"
#include "nsIWebProgress.h"
#include "nsHTMLCanvasElement.h"
#include "mozilla/dom/HTMLCanvasElement.h"
#include "nsIWebProgressListener.h"
#include "nsWeakReference.h"