mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-29 07:42:04 +00:00
Bug 276431 Patch 4c: Add convenience method nsIDocument::IsResourceDocument, for code shared between external resource docs & svg-as-image helper docs. r=roc sr=jst a=blocking
This commit is contained in:
parent
1add754c83
commit
7bbef02e3f
@ -119,8 +119,8 @@ class Element;
|
||||
|
||||
|
||||
#define NS_IDOCUMENT_IID \
|
||||
{ 0xe1779840, 0x1ae4, 0x479d, \
|
||||
{ 0x8a, 0xa1, 0x40, 0x4f, 0x6e, 0x20, 0x1a, 0x0a } }
|
||||
{ 0x73d79167, 0xacba, 0x46eb, \
|
||||
{ 0xad, 0x45, 0xa3, 0x4b, 0x92, 0xf6, 0x01, 0x5b } }
|
||||
|
||||
// Flag for AddStyleSheet().
|
||||
#define NS_STYLESHEET_FROM_CATALOG (1 << 0)
|
||||
@ -1156,6 +1156,11 @@ public:
|
||||
mIsBeingUsedAsImage = PR_TRUE;
|
||||
}
|
||||
|
||||
PRBool IsResourceDoc() const {
|
||||
return IsBeingUsedAsImage() || // Are we a helper-doc for an SVG image?
|
||||
!!mDisplayDocument; // Are we an external resource doc?
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the document for which this document is an external resource. This
|
||||
* will be null if this document is not an external resource. Otherwise,
|
||||
|
@ -2309,15 +2309,12 @@ DocumentViewerImpl::MakeWindow(const nsSize& aSize, nsIView* aContainerView)
|
||||
if (!view)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
PRBool isExternalResource = !!mDocument->GetDisplayDocument();
|
||||
|
||||
// Create a widget if we were given a parent widget or don't have a
|
||||
// container view that we can hook up to without a widget.
|
||||
// Don't create widgets for...
|
||||
// - external resource documents, since they're not displayed.
|
||||
// - documents being used as images, since they'll be painted into
|
||||
// someone else's widget when they're displayed.
|
||||
if (!mDocument->IsBeingUsedAsImage() && !isExternalResource &&
|
||||
// Don't create widgets for ResourceDocs (external resources & svg images),
|
||||
// because when they're displayed, they're painted into *another* document's
|
||||
// widget.
|
||||
if (!mDocument->IsResourceDoc() &&
|
||||
(mParentWidget || !aContainerView)) {
|
||||
// pass in a native widget to be the parent widget ONLY if the view hierarchy will stand alone.
|
||||
// otherwise the view will find its own parent widget and "do the right thing" to
|
||||
|
Loading…
Reference in New Issue
Block a user