Back out patch for bug 161109 that implemented a pref for disabling marquee. b=161109 r=hixie a=asa

This commit is contained in:
dbaron@fas.harvard.edu
2002-10-30 14:31:32 +00:00
parent 439f771331
commit f9d8824f57
3 changed files with 0 additions and 343 deletions

View File

@@ -61,13 +61,8 @@
#include "nsIStyleSet.h" #include "nsIStyleSet.h"
#include "nsISizeOfHandler.h" #include "nsISizeOfHandler.h"
#include "nsIPrefService.h"
#include "nsIPrefBranch.h"
#include "nsIPrefBranchInternal.h"
#include "nsIObserver.h"
static NS_DEFINE_CID(kCSSFrameConstructorCID, NS_CSSFRAMECONSTRUCTOR_CID); static NS_DEFINE_CID(kCSSFrameConstructorCID, NS_CSSFRAMECONSTRUCTOR_CID);
static NS_DEFINE_CID(kPrefServiceCID, NS_PREFSERVICE_CID);
class HTMLColorRule : public nsIStyleRule { class HTMLColorRule : public nsIStyleRule {
public: public:
@@ -274,89 +269,6 @@ void HTMLDocumentColorRule::SizeOf(nsISizeOfHandler *aSizeOfHandler, PRUint32 &a
} }
#endif #endif
class MarqueeDisableRule : public nsIStyleRule {
public:
MarqueeDisableRule(nsIHTMLStyleSheet* aSheet);
virtual ~MarqueeDisableRule();
NS_DECL_ISUPPORTS
NS_IMETHOD GetStyleSheet(nsIStyleSheet*& aSheet) const;
// The new mapping function.
NS_IMETHOD MapRuleInfoInto(nsRuleData* aRuleData);
#ifdef DEBUG
NS_IMETHOD List(FILE* out = stdout, PRInt32 aIndent = 0) const;
virtual void SizeOf(nsISizeOfHandler *aSizeOfHandler, PRUint32 &aSize);
#endif
nsIHTMLStyleSheet* mSheet;
};
MarqueeDisableRule::MarqueeDisableRule(nsIHTMLStyleSheet* aSheet)
: mSheet(aSheet)
{
NS_INIT_ISUPPORTS();
}
MarqueeDisableRule::~MarqueeDisableRule()
{
}
NS_IMPL_ISUPPORTS1(MarqueeDisableRule, nsIStyleRule)
NS_IMETHODIMP
MarqueeDisableRule::GetStyleSheet(nsIStyleSheet*& aSheet) const
{
NS_IF_ADDREF(mSheet);
aSheet = mSheet;
return NS_OK;
}
NS_IMETHODIMP
MarqueeDisableRule::MapRuleInfoInto(nsRuleData* aRuleData)
{
if (aRuleData->mSID == eStyleStruct_Display) {
if (aRuleData->mDisplayData->mDisplay.GetUnit() == eCSSUnit_Null)
aRuleData->mDisplayData->mBinding = nsCSSValue(eCSSUnit_None);
}
return NS_OK;
}
#ifdef DEBUG
NS_IMETHODIMP
MarqueeDisableRule::List(FILE* out, PRInt32 aIndent) const
{
return NS_OK;
}
void MarqueeDisableRule::SizeOf(nsISizeOfHandler *aSizeOfHandler, PRUint32 &aSize)
{
NS_ASSERTION(aSizeOfHandler != nsnull, "SizeOf handler cannot be null");
// first get the unique items collection
UNIQUE_STYLE_ITEMS(uniqueItems);
if(! uniqueItems->AddItem((void*)this) ){
// object has already been accounted for
return;
}
// get or create a tag for this instance
nsCOMPtr<nsIAtom> tag = do_GetAtom("MarqueeDisableRule");
// get the size of an empty instance and add to the sizeof handler
aSize = sizeof(*this);
aSizeOfHandler->AddSize(tag,aSize);
if(mSheet){
PRUint32 localSize=0;
mSheet->SizeOf(aSizeOfHandler, localSize);
}
}
#endif
class GenericTableRule: public nsIStyleRule { class GenericTableRule: public nsIStyleRule {
public: public:
GenericTableRule(nsIHTMLStyleSheet* aSheet); GenericTableRule(nsIHTMLStyleSheet* aSheet);
@@ -893,7 +805,6 @@ protected:
HTMLColorRule* mVisitedRule; HTMLColorRule* mVisitedRule;
HTMLColorRule* mActiveRule; HTMLColorRule* mActiveRule;
HTMLDocumentColorRule* mDocumentColorRule; HTMLDocumentColorRule* mDocumentColorRule;
MarqueeDisableRule* mMarqueeDisableRule;
TableTbodyRule* mTableTbodyRule; TableTbodyRule* mTableTbodyRule;
TableRowRule* mTableRowRule; TableRowRule* mTableRowRule;
TableColgroupRule* mTableColgroupRule; TableColgroupRule* mTableColgroupRule;
@@ -905,49 +816,6 @@ protected:
PLDHashTable mMappedAttrTable; PLDHashTable mMappedAttrTable;
}; };
static PRBool gEnableMarquee = PR_FALSE;
static PRBool gHaveMarqueePref = PR_FALSE;
static const char kMarqueePrefBranch[] = "browser.display.";
static const char kMarqueePrefName[] = "enable_marquee";
class MarqueePrefObserver : public nsIObserver
{
public:
MarqueePrefObserver();
virtual ~MarqueePrefObserver();
NS_DECL_ISUPPORTS
NS_DECL_NSIOBSERVER
};
MarqueePrefObserver::MarqueePrefObserver()
{
NS_INIT_ISUPPORTS();
NS_ASSERTION(gHaveMarqueePref == PR_TRUE, "oops");
}
MarqueePrefObserver::~MarqueePrefObserver()
{
gHaveMarqueePref = PR_FALSE;
}
NS_IMPL_ISUPPORTS1(MarqueePrefObserver, nsIObserver)
NS_IMETHODIMP
MarqueePrefObserver::Observe(nsISupports *aSubject, const char *aTopic,
const PRUnichar *aData)
{
NS_ASSERTION(nsDependentString(aData) ==
NS_ConvertASCIItoUCS2(kMarqueePrefName),
"wrong pref");
nsCOMPtr<nsIPrefBranch> branch = do_QueryInterface(aSubject);
branch->GetBoolPref(kMarqueePrefName, &gEnableMarquee);
return NS_OK;
}
// -----------------------------------------------------------
HTMLStyleSheetImpl::HTMLStyleSheetImpl(void) HTMLStyleSheetImpl::HTMLStyleSheetImpl(void)
: nsIHTMLStyleSheet(), : nsIHTMLStyleSheet(),
@@ -966,28 +834,6 @@ HTMLStyleSheetImpl::HTMLStyleSheetImpl(void)
nsresult nsresult
HTMLStyleSheetImpl::Init() HTMLStyleSheetImpl::Init()
{ {
if (!gHaveMarqueePref) {
// Set |gHaveMarqueePref| now, so we don't recheck if something fails.
gHaveMarqueePref = PR_TRUE;
nsresult rv;
nsCOMPtr<nsIPrefService> prefService = do_GetService(kPrefServiceCID, &rv);
if (NS_SUCCEEDED(rv)) {
nsCOMPtr<nsIPrefBranch> branch;
rv = prefService->GetBranch(kMarqueePrefBranch, getter_AddRefs(branch));
if (NS_SUCCEEDED(rv) && branch) {
branch->GetBoolPref(kMarqueePrefName, &gEnableMarquee);
nsCOMPtr<nsIPrefBranchInternal> branchInternal
= do_QueryInterface(branch);
if (branchInternal) {
nsCOMPtr<nsIObserver> observer = new MarqueePrefObserver();
if (observer) {
branchInternal->AddObserver(kMarqueePrefName, observer, PR_FALSE);
}
}
}
}
}
mTableTbodyRule = new TableTbodyRule(this); mTableTbodyRule = new TableTbodyRule(this);
if (!mTableTbodyRule) if (!mTableTbodyRule)
return NS_ERROR_OUT_OF_MEMORY; return NS_ERROR_OUT_OF_MEMORY;
@@ -1013,15 +859,6 @@ HTMLStyleSheetImpl::Init()
return NS_ERROR_OUT_OF_MEMORY; return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(mTableTHRule); NS_ADDREF(mTableTHRule);
if (gEnableMarquee) {
mMarqueeDisableRule = nsnull;
} else {
mMarqueeDisableRule = new MarqueeDisableRule(this);
if (!mMarqueeDisableRule)
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(mMarqueeDisableRule);
}
mDocumentColorRule = new HTMLDocumentColorRule(this); mDocumentColorRule = new HTMLDocumentColorRule(this);
if (!mDocumentColorRule) if (!mDocumentColorRule)
return NS_ERROR_OUT_OF_MEMORY; return NS_ERROR_OUT_OF_MEMORY;
@@ -1069,10 +906,6 @@ HTMLStyleSheetImpl::~HTMLStyleSheetImpl()
mTableTHRule->mSheet = nsnull; mTableTHRule->mSheet = nsnull;
NS_RELEASE(mTableTHRule); NS_RELEASE(mTableTHRule);
} }
if (nsnull != mMarqueeDisableRule) {
mMarqueeDisableRule->mSheet = nsnull;
NS_RELEASE(mMarqueeDisableRule);
}
if (mMappedAttrTable.ops) if (mMappedAttrTable.ops)
PL_DHashTableFinish(&mMappedAttrTable); PL_DHashTableFinish(&mMappedAttrTable);
} }
@@ -1184,10 +1017,6 @@ HTMLStyleSheetImpl::RulesMatching(ElementRuleProcessorData* aData,
if (aData->mCompatMode == eCompatibility_NavQuirks) if (aData->mCompatMode == eCompatibility_NavQuirks)
ruleWalker->Forward(mDocumentColorRule); ruleWalker->Forward(mDocumentColorRule);
} }
else if (tag == nsHTMLAtoms::marquee) {
if (mMarqueeDisableRule)
ruleWalker->Forward(mMarqueeDisableRule);
}
} // end html element } // end html element
// just get the style rules from the content // just get the style rules from the content

View File

@@ -61,13 +61,8 @@
#include "nsIStyleSet.h" #include "nsIStyleSet.h"
#include "nsISizeOfHandler.h" #include "nsISizeOfHandler.h"
#include "nsIPrefService.h"
#include "nsIPrefBranch.h"
#include "nsIPrefBranchInternal.h"
#include "nsIObserver.h"
static NS_DEFINE_CID(kCSSFrameConstructorCID, NS_CSSFRAMECONSTRUCTOR_CID); static NS_DEFINE_CID(kCSSFrameConstructorCID, NS_CSSFRAMECONSTRUCTOR_CID);
static NS_DEFINE_CID(kPrefServiceCID, NS_PREFSERVICE_CID);
class HTMLColorRule : public nsIStyleRule { class HTMLColorRule : public nsIStyleRule {
public: public:
@@ -274,89 +269,6 @@ void HTMLDocumentColorRule::SizeOf(nsISizeOfHandler *aSizeOfHandler, PRUint32 &a
} }
#endif #endif
class MarqueeDisableRule : public nsIStyleRule {
public:
MarqueeDisableRule(nsIHTMLStyleSheet* aSheet);
virtual ~MarqueeDisableRule();
NS_DECL_ISUPPORTS
NS_IMETHOD GetStyleSheet(nsIStyleSheet*& aSheet) const;
// The new mapping function.
NS_IMETHOD MapRuleInfoInto(nsRuleData* aRuleData);
#ifdef DEBUG
NS_IMETHOD List(FILE* out = stdout, PRInt32 aIndent = 0) const;
virtual void SizeOf(nsISizeOfHandler *aSizeOfHandler, PRUint32 &aSize);
#endif
nsIHTMLStyleSheet* mSheet;
};
MarqueeDisableRule::MarqueeDisableRule(nsIHTMLStyleSheet* aSheet)
: mSheet(aSheet)
{
NS_INIT_ISUPPORTS();
}
MarqueeDisableRule::~MarqueeDisableRule()
{
}
NS_IMPL_ISUPPORTS1(MarqueeDisableRule, nsIStyleRule)
NS_IMETHODIMP
MarqueeDisableRule::GetStyleSheet(nsIStyleSheet*& aSheet) const
{
NS_IF_ADDREF(mSheet);
aSheet = mSheet;
return NS_OK;
}
NS_IMETHODIMP
MarqueeDisableRule::MapRuleInfoInto(nsRuleData* aRuleData)
{
if (aRuleData->mSID == eStyleStruct_Display) {
if (aRuleData->mDisplayData->mDisplay.GetUnit() == eCSSUnit_Null)
aRuleData->mDisplayData->mBinding = nsCSSValue(eCSSUnit_None);
}
return NS_OK;
}
#ifdef DEBUG
NS_IMETHODIMP
MarqueeDisableRule::List(FILE* out, PRInt32 aIndent) const
{
return NS_OK;
}
void MarqueeDisableRule::SizeOf(nsISizeOfHandler *aSizeOfHandler, PRUint32 &aSize)
{
NS_ASSERTION(aSizeOfHandler != nsnull, "SizeOf handler cannot be null");
// first get the unique items collection
UNIQUE_STYLE_ITEMS(uniqueItems);
if(! uniqueItems->AddItem((void*)this) ){
// object has already been accounted for
return;
}
// get or create a tag for this instance
nsCOMPtr<nsIAtom> tag = do_GetAtom("MarqueeDisableRule");
// get the size of an empty instance and add to the sizeof handler
aSize = sizeof(*this);
aSizeOfHandler->AddSize(tag,aSize);
if(mSheet){
PRUint32 localSize=0;
mSheet->SizeOf(aSizeOfHandler, localSize);
}
}
#endif
class GenericTableRule: public nsIStyleRule { class GenericTableRule: public nsIStyleRule {
public: public:
GenericTableRule(nsIHTMLStyleSheet* aSheet); GenericTableRule(nsIHTMLStyleSheet* aSheet);
@@ -893,7 +805,6 @@ protected:
HTMLColorRule* mVisitedRule; HTMLColorRule* mVisitedRule;
HTMLColorRule* mActiveRule; HTMLColorRule* mActiveRule;
HTMLDocumentColorRule* mDocumentColorRule; HTMLDocumentColorRule* mDocumentColorRule;
MarqueeDisableRule* mMarqueeDisableRule;
TableTbodyRule* mTableTbodyRule; TableTbodyRule* mTableTbodyRule;
TableRowRule* mTableRowRule; TableRowRule* mTableRowRule;
TableColgroupRule* mTableColgroupRule; TableColgroupRule* mTableColgroupRule;
@@ -905,49 +816,6 @@ protected:
PLDHashTable mMappedAttrTable; PLDHashTable mMappedAttrTable;
}; };
static PRBool gEnableMarquee = PR_FALSE;
static PRBool gHaveMarqueePref = PR_FALSE;
static const char kMarqueePrefBranch[] = "browser.display.";
static const char kMarqueePrefName[] = "enable_marquee";
class MarqueePrefObserver : public nsIObserver
{
public:
MarqueePrefObserver();
virtual ~MarqueePrefObserver();
NS_DECL_ISUPPORTS
NS_DECL_NSIOBSERVER
};
MarqueePrefObserver::MarqueePrefObserver()
{
NS_INIT_ISUPPORTS();
NS_ASSERTION(gHaveMarqueePref == PR_TRUE, "oops");
}
MarqueePrefObserver::~MarqueePrefObserver()
{
gHaveMarqueePref = PR_FALSE;
}
NS_IMPL_ISUPPORTS1(MarqueePrefObserver, nsIObserver)
NS_IMETHODIMP
MarqueePrefObserver::Observe(nsISupports *aSubject, const char *aTopic,
const PRUnichar *aData)
{
NS_ASSERTION(nsDependentString(aData) ==
NS_ConvertASCIItoUCS2(kMarqueePrefName),
"wrong pref");
nsCOMPtr<nsIPrefBranch> branch = do_QueryInterface(aSubject);
branch->GetBoolPref(kMarqueePrefName, &gEnableMarquee);
return NS_OK;
}
// -----------------------------------------------------------
HTMLStyleSheetImpl::HTMLStyleSheetImpl(void) HTMLStyleSheetImpl::HTMLStyleSheetImpl(void)
: nsIHTMLStyleSheet(), : nsIHTMLStyleSheet(),
@@ -966,28 +834,6 @@ HTMLStyleSheetImpl::HTMLStyleSheetImpl(void)
nsresult nsresult
HTMLStyleSheetImpl::Init() HTMLStyleSheetImpl::Init()
{ {
if (!gHaveMarqueePref) {
// Set |gHaveMarqueePref| now, so we don't recheck if something fails.
gHaveMarqueePref = PR_TRUE;
nsresult rv;
nsCOMPtr<nsIPrefService> prefService = do_GetService(kPrefServiceCID, &rv);
if (NS_SUCCEEDED(rv)) {
nsCOMPtr<nsIPrefBranch> branch;
rv = prefService->GetBranch(kMarqueePrefBranch, getter_AddRefs(branch));
if (NS_SUCCEEDED(rv) && branch) {
branch->GetBoolPref(kMarqueePrefName, &gEnableMarquee);
nsCOMPtr<nsIPrefBranchInternal> branchInternal
= do_QueryInterface(branch);
if (branchInternal) {
nsCOMPtr<nsIObserver> observer = new MarqueePrefObserver();
if (observer) {
branchInternal->AddObserver(kMarqueePrefName, observer, PR_FALSE);
}
}
}
}
}
mTableTbodyRule = new TableTbodyRule(this); mTableTbodyRule = new TableTbodyRule(this);
if (!mTableTbodyRule) if (!mTableTbodyRule)
return NS_ERROR_OUT_OF_MEMORY; return NS_ERROR_OUT_OF_MEMORY;
@@ -1013,15 +859,6 @@ HTMLStyleSheetImpl::Init()
return NS_ERROR_OUT_OF_MEMORY; return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(mTableTHRule); NS_ADDREF(mTableTHRule);
if (gEnableMarquee) {
mMarqueeDisableRule = nsnull;
} else {
mMarqueeDisableRule = new MarqueeDisableRule(this);
if (!mMarqueeDisableRule)
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(mMarqueeDisableRule);
}
mDocumentColorRule = new HTMLDocumentColorRule(this); mDocumentColorRule = new HTMLDocumentColorRule(this);
if (!mDocumentColorRule) if (!mDocumentColorRule)
return NS_ERROR_OUT_OF_MEMORY; return NS_ERROR_OUT_OF_MEMORY;
@@ -1069,10 +906,6 @@ HTMLStyleSheetImpl::~HTMLStyleSheetImpl()
mTableTHRule->mSheet = nsnull; mTableTHRule->mSheet = nsnull;
NS_RELEASE(mTableTHRule); NS_RELEASE(mTableTHRule);
} }
if (nsnull != mMarqueeDisableRule) {
mMarqueeDisableRule->mSheet = nsnull;
NS_RELEASE(mMarqueeDisableRule);
}
if (mMappedAttrTable.ops) if (mMappedAttrTable.ops)
PL_DHashTableFinish(&mMappedAttrTable); PL_DHashTableFinish(&mMappedAttrTable);
} }
@@ -1184,10 +1017,6 @@ HTMLStyleSheetImpl::RulesMatching(ElementRuleProcessorData* aData,
if (aData->mCompatMode == eCompatibility_NavQuirks) if (aData->mCompatMode == eCompatibility_NavQuirks)
ruleWalker->Forward(mDocumentColorRule); ruleWalker->Forward(mDocumentColorRule);
} }
else if (tag == nsHTMLAtoms::marquee) {
if (mMarqueeDisableRule)
ruleWalker->Forward(mMarqueeDisableRule);
}
} // end html element } // end html element
// just get the style rules from the content // just get the style rules from the content

View File

@@ -89,7 +89,6 @@ pref("browser.display.force_inline_alttext", false); // true = force ALT text fo
// 2 = add extra leading both internal leading and external leading are zero // 2 = add extra leading both internal leading and external leading are zero
pref("browser.display.normal_lineheight_calc_control", 2); pref("browser.display.normal_lineheight_calc_control", 2);
pref("browser.display.show_image_placeholders", true); // true = show image placeholders while image is loaded and when image is broken pref("browser.display.show_image_placeholders", true); // true = show image placeholders while image is loaded and when image is broken
pref("browser.display.enable_marquee", false);
pref("browser.anchor_color", "#0000EE"); pref("browser.anchor_color", "#0000EE");
pref("browser.visited_color", "#551A8B"); pref("browser.visited_color", "#551A8B");
pref("browser.underline_anchors", true); pref("browser.underline_anchors", true);