Fixed SetEnableRendering() in nsDocumentViewer.cpp
Initialized mEnableRendering in constructors of nsDocumentViewer.cpp and nsPlugin.cpp to a default value of PR_TRU Do EnableRefresh only if mEnableRendering is set to true in nsHTMLContentSink.cpp,nsXMLContentSink.cpp, nsXMLContentSink.h git-svn-id: svn://10.0.0.236/trunk@31441 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -165,6 +165,8 @@ NS_NewDocumentViewer(nsIDocumentViewer** aResult)
|
||||
DocumentViewerImpl::DocumentViewerImpl()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
mEnableRendering = PR_TRUE;
|
||||
|
||||
}
|
||||
|
||||
DocumentViewerImpl::DocumentViewerImpl(nsIPresContext* aPresContext)
|
||||
@@ -590,6 +592,11 @@ DocumentViewerImpl::SetEnableRendering(PRBool aOn)
|
||||
if (mViewManager) {
|
||||
if (aOn) {
|
||||
mViewManager->EnableRefresh();
|
||||
nsIView* view;
|
||||
mViewManager->GetRootView(view); // views are not refCounted
|
||||
if (view) {
|
||||
mViewManager->UpdateView(view,nsnull,NS_VMREFRESH_IMMEDIATE);
|
||||
}
|
||||
}
|
||||
else {
|
||||
mViewManager->DisableRefresh();
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsIViewManager.h"
|
||||
#include "nsIContentViewer.h"
|
||||
#include "nsHTMLTokens.h"
|
||||
#include "nsHTMLEntities.h"
|
||||
#include "nsCRT.h"
|
||||
@@ -244,6 +245,8 @@ public:
|
||||
void ProcessBaseHref(const nsString& aBaseHref);
|
||||
void ProcessBaseTarget(const nsString& aBaseTarget);
|
||||
|
||||
nsresult RefreshIfEnabled(nsIViewManager* vm);
|
||||
|
||||
// Routines for tags that require special handling
|
||||
nsresult ProcessATag(const nsIParserNode& aNode, nsIHTMLContent* aContent);
|
||||
nsresult ProcessAREATag(const nsIParserNode& aNode);
|
||||
@@ -2015,7 +2018,7 @@ HTMLContentSink::StartLayout()
|
||||
nsCOMPtr<nsIViewManager> vm;
|
||||
shell->GetViewManager(getter_AddRefs(vm));
|
||||
if (vm) {
|
||||
vm->EnableRefresh();
|
||||
RefreshIfEnabled(vm);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2178,6 +2181,24 @@ HTMLContentSink::ProcessBaseHref(const nsString& aBaseHref)
|
||||
}
|
||||
}
|
||||
|
||||
nsresult
|
||||
HTMLContentSink::RefreshIfEnabled(nsIViewManager* vm)
|
||||
{
|
||||
if (vm) {
|
||||
nsIContentViewer* contentViewer = nsnull;
|
||||
nsresult rv = mWebShell->GetContentViewer(&contentViewer);
|
||||
if (NS_SUCCEEDED(rv) && (contentViewer != nsnull)) {
|
||||
PRBool enabled;
|
||||
contentViewer->GetEnableRendering(&enabled);
|
||||
if (enabled) {
|
||||
vm->EnableRefresh();
|
||||
}
|
||||
NS_RELEASE(contentViewer);
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
HTMLContentSink::ProcessBaseTarget(const nsString& aBaseTarget)
|
||||
{
|
||||
|
||||
@@ -48,6 +48,7 @@
|
||||
#include "nsIScriptContextOwner.h"
|
||||
#include "nsINameSpace.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsIContentViewer.h"
|
||||
#include "prtime.h"
|
||||
#include "prlog.h"
|
||||
#include "prmem.h"
|
||||
@@ -1528,7 +1529,7 @@ nsXMLContentSink::StartLayout()
|
||||
nsCOMPtr<nsIViewManager> vm;
|
||||
shell->GetViewManager(getter_AddRefs(vm));
|
||||
if (vm) {
|
||||
vm->EnableRefresh();
|
||||
RefreshIfEnabled(vm);
|
||||
}
|
||||
|
||||
NS_RELEASE(shell);
|
||||
@@ -1776,3 +1777,21 @@ nsXMLContentSink::ProcessStartSCRIPTTag(const nsIParserNode& aNode)
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsXMLContentSink::RefreshIfEnabled(nsIViewManager* vm)
|
||||
{
|
||||
if (vm) {
|
||||
nsIContentViewer* contentViewer = nsnull;
|
||||
nsresult rv = mWebShell->GetContentViewer(&contentViewer);
|
||||
if (NS_SUCCEEDED(rv) && (contentViewer != nsnull)) {
|
||||
PRBool enabled;
|
||||
contentViewer->GetEnableRendering(&enabled);
|
||||
if (enabled) {
|
||||
vm->EnableRefresh();
|
||||
}
|
||||
NS_RELEASE(contentViewer);
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -116,6 +116,8 @@ protected:
|
||||
nsresult ProcessEndSCRIPTTag(const nsIParserNode& aNode);
|
||||
nsresult ProcessStartSCRIPTTag(const nsIParserNode& aNode);
|
||||
|
||||
nsresult RefreshIfEnabled(nsIViewManager* vm);
|
||||
|
||||
#ifdef XSL
|
||||
nsresult CreateStyleSheetURL(nsIURL** aUrl, const nsAutoString& aHref);
|
||||
nsresult LoadXSLStyleSheet(const nsIURL* aUrl);
|
||||
|
||||
@@ -165,6 +165,8 @@ NS_NewDocumentViewer(nsIDocumentViewer** aResult)
|
||||
DocumentViewerImpl::DocumentViewerImpl()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
mEnableRendering = PR_TRUE;
|
||||
|
||||
}
|
||||
|
||||
DocumentViewerImpl::DocumentViewerImpl(nsIPresContext* aPresContext)
|
||||
@@ -590,6 +592,11 @@ DocumentViewerImpl::SetEnableRendering(PRBool aOn)
|
||||
if (mViewManager) {
|
||||
if (aOn) {
|
||||
mViewManager->EnableRefresh();
|
||||
nsIView* view;
|
||||
mViewManager->GetRootView(view); // views are not refCounted
|
||||
if (view) {
|
||||
mViewManager->UpdateView(view,nsnull,NS_VMREFRESH_IMMEDIATE);
|
||||
}
|
||||
}
|
||||
else {
|
||||
mViewManager->DisableRefresh();
|
||||
|
||||
@@ -165,6 +165,8 @@ NS_NewDocumentViewer(nsIDocumentViewer** aResult)
|
||||
DocumentViewerImpl::DocumentViewerImpl()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
mEnableRendering = PR_TRUE;
|
||||
|
||||
}
|
||||
|
||||
DocumentViewerImpl::DocumentViewerImpl(nsIPresContext* aPresContext)
|
||||
@@ -590,6 +592,11 @@ DocumentViewerImpl::SetEnableRendering(PRBool aOn)
|
||||
if (mViewManager) {
|
||||
if (aOn) {
|
||||
mViewManager->EnableRefresh();
|
||||
nsIView* view;
|
||||
mViewManager->GetRootView(view); // views are not refCounted
|
||||
if (view) {
|
||||
mViewManager->UpdateView(view,nsnull,NS_VMREFRESH_IMMEDIATE);
|
||||
}
|
||||
}
|
||||
else {
|
||||
mViewManager->DisableRefresh();
|
||||
|
||||
@@ -186,6 +186,7 @@ PluginViewerImpl::PluginViewerImpl(const char* aCommand,
|
||||
NS_INIT_REFCNT();
|
||||
nsIStreamListener* it = new PluginListener(this);
|
||||
*aDocListener = it;
|
||||
mEnableRendering = PR_TRUE;
|
||||
}
|
||||
|
||||
// ISupports implementation...
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsIViewManager.h"
|
||||
#include "nsIContentViewer.h"
|
||||
#include "nsHTMLTokens.h"
|
||||
#include "nsHTMLEntities.h"
|
||||
#include "nsCRT.h"
|
||||
@@ -244,6 +245,8 @@ public:
|
||||
void ProcessBaseHref(const nsString& aBaseHref);
|
||||
void ProcessBaseTarget(const nsString& aBaseTarget);
|
||||
|
||||
nsresult RefreshIfEnabled(nsIViewManager* vm);
|
||||
|
||||
// Routines for tags that require special handling
|
||||
nsresult ProcessATag(const nsIParserNode& aNode, nsIHTMLContent* aContent);
|
||||
nsresult ProcessAREATag(const nsIParserNode& aNode);
|
||||
@@ -2015,7 +2018,7 @@ HTMLContentSink::StartLayout()
|
||||
nsCOMPtr<nsIViewManager> vm;
|
||||
shell->GetViewManager(getter_AddRefs(vm));
|
||||
if (vm) {
|
||||
vm->EnableRefresh();
|
||||
RefreshIfEnabled(vm);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2178,6 +2181,24 @@ HTMLContentSink::ProcessBaseHref(const nsString& aBaseHref)
|
||||
}
|
||||
}
|
||||
|
||||
nsresult
|
||||
HTMLContentSink::RefreshIfEnabled(nsIViewManager* vm)
|
||||
{
|
||||
if (vm) {
|
||||
nsIContentViewer* contentViewer = nsnull;
|
||||
nsresult rv = mWebShell->GetContentViewer(&contentViewer);
|
||||
if (NS_SUCCEEDED(rv) && (contentViewer != nsnull)) {
|
||||
PRBool enabled;
|
||||
contentViewer->GetEnableRendering(&enabled);
|
||||
if (enabled) {
|
||||
vm->EnableRefresh();
|
||||
}
|
||||
NS_RELEASE(contentViewer);
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
HTMLContentSink::ProcessBaseTarget(const nsString& aBaseTarget)
|
||||
{
|
||||
|
||||
@@ -48,6 +48,7 @@
|
||||
#include "nsIScriptContextOwner.h"
|
||||
#include "nsINameSpace.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsIContentViewer.h"
|
||||
#include "prtime.h"
|
||||
#include "prlog.h"
|
||||
#include "prmem.h"
|
||||
@@ -1528,7 +1529,7 @@ nsXMLContentSink::StartLayout()
|
||||
nsCOMPtr<nsIViewManager> vm;
|
||||
shell->GetViewManager(getter_AddRefs(vm));
|
||||
if (vm) {
|
||||
vm->EnableRefresh();
|
||||
RefreshIfEnabled(vm);
|
||||
}
|
||||
|
||||
NS_RELEASE(shell);
|
||||
@@ -1776,3 +1777,21 @@ nsXMLContentSink::ProcessStartSCRIPTTag(const nsIParserNode& aNode)
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsXMLContentSink::RefreshIfEnabled(nsIViewManager* vm)
|
||||
{
|
||||
if (vm) {
|
||||
nsIContentViewer* contentViewer = nsnull;
|
||||
nsresult rv = mWebShell->GetContentViewer(&contentViewer);
|
||||
if (NS_SUCCEEDED(rv) && (contentViewer != nsnull)) {
|
||||
PRBool enabled;
|
||||
contentViewer->GetEnableRendering(&enabled);
|
||||
if (enabled) {
|
||||
vm->EnableRefresh();
|
||||
}
|
||||
NS_RELEASE(contentViewer);
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -116,6 +116,8 @@ protected:
|
||||
nsresult ProcessEndSCRIPTTag(const nsIParserNode& aNode);
|
||||
nsresult ProcessStartSCRIPTTag(const nsIParserNode& aNode);
|
||||
|
||||
nsresult RefreshIfEnabled(nsIViewManager* vm);
|
||||
|
||||
#ifdef XSL
|
||||
nsresult CreateStyleSheetURL(nsIURL** aUrl, const nsAutoString& aHref);
|
||||
nsresult LoadXSLStyleSheet(const nsIURL* aUrl);
|
||||
|
||||
@@ -186,6 +186,7 @@ PluginViewerImpl::PluginViewerImpl(const char* aCommand,
|
||||
NS_INIT_REFCNT();
|
||||
nsIStreamListener* it = new PluginListener(this);
|
||||
*aDocListener = it;
|
||||
mEnableRendering = PR_TRUE;
|
||||
}
|
||||
|
||||
// ISupports implementation...
|
||||
|
||||
@@ -186,6 +186,7 @@ PluginViewerImpl::PluginViewerImpl(const char* aCommand,
|
||||
NS_INIT_REFCNT();
|
||||
nsIStreamListener* it = new PluginListener(this);
|
||||
*aDocListener = it;
|
||||
mEnableRendering = PR_TRUE;
|
||||
}
|
||||
|
||||
// ISupports implementation...
|
||||
|
||||
Reference in New Issue
Block a user