From 6f4d9821e695302bd1258d835dd93459a26e2026 Mon Sep 17 00:00:00 2001 From: "roc+%cs.cmu.edu" Date: Wed, 9 Apr 2003 11:17:42 +0000 Subject: [PATCH] Bug 201299. Make lazy scrollbars more selective to avoid XUL tree and listbox problems. r+sr=bzbarsky git-svn-id: svn://10.0.0.236/trunk@140907 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/content/shared/public/nsXULAtomList.h | 1 + mozilla/layout/generic/nsGfxScrollFrame.cpp | 13 +++++++++++++ mozilla/layout/html/base/src/nsGfxScrollFrame.cpp | 13 +++++++++++++ mozilla/xpfe/global/resources/content/xul.css | 7 +++++-- 4 files changed, 32 insertions(+), 2 deletions(-) diff --git a/mozilla/content/shared/public/nsXULAtomList.h b/mozilla/content/shared/public/nsXULAtomList.h index e99bff267d6..b841d61ba20 100644 --- a/mozilla/content/shared/public/nsXULAtomList.h +++ b/mozilla/content/shared/public/nsXULAtomList.h @@ -175,6 +175,7 @@ XUL_ATOM(increment, "increment") XUL_ATOM(pageincrement, "pageincrement") XUL_ATOM(thumb, "thumb") XUL_ATOM(toggled, "toggled") +XUL_ATOM(lazy, "lazy") XUL_ATOM(grippy, "grippy") XUL_ATOM(splitter, "splitter") XUL_ATOM(collapse, "collapse") diff --git a/mozilla/layout/generic/nsGfxScrollFrame.cpp b/mozilla/layout/generic/nsGfxScrollFrame.cpp index a81063083c1..e205166501b 100644 --- a/mozilla/layout/generic/nsGfxScrollFrame.cpp +++ b/mozilla/layout/generic/nsGfxScrollFrame.cpp @@ -419,6 +419,11 @@ nsGfxScrollFrame::CreateAnonymousContent(nsIPresContext* aPresContext, } } + // Add the "lazy" attribute if the content is non-XUL (and therefore + // we can be sure no mediator is involved). Style rules in xul.css + // make sure that "lazy" scrollbars are XBL-bound only when needed. + PRBool lazyScrollbar = !mContent->IsContentOfType(nsIContent::eXUL); + // create horzontal scrollbar nsresult rv; nsCOMPtr elementFactory = @@ -444,6 +449,10 @@ nsGfxScrollFrame::CreateAnonymousContent(nsIPresContext* aPresContext, content->SetAttr(kNameSpaceID_None, nsXULAtoms::collapsed, NS_LITERAL_STRING("true"), PR_FALSE); + if (lazyScrollbar) + content->SetAttr(kNameSpaceID_None, nsXULAtoms::lazy, + NS_LITERAL_STRING("true"), PR_FALSE); + aAnonymousChildren.AppendElement(content); // create vertical scrollbar @@ -455,6 +464,10 @@ nsGfxScrollFrame::CreateAnonymousContent(nsIPresContext* aPresContext, content->SetAttr(kNameSpaceID_None, nsXULAtoms::collapsed, NS_LITERAL_STRING("true"), PR_FALSE); + if (lazyScrollbar) + content->SetAttr(kNameSpaceID_None, nsXULAtoms::lazy, + NS_LITERAL_STRING("true"), PR_FALSE); + aAnonymousChildren.AppendElement(content); // XXX For GFX never have scrollbars diff --git a/mozilla/layout/html/base/src/nsGfxScrollFrame.cpp b/mozilla/layout/html/base/src/nsGfxScrollFrame.cpp index a81063083c1..e205166501b 100644 --- a/mozilla/layout/html/base/src/nsGfxScrollFrame.cpp +++ b/mozilla/layout/html/base/src/nsGfxScrollFrame.cpp @@ -419,6 +419,11 @@ nsGfxScrollFrame::CreateAnonymousContent(nsIPresContext* aPresContext, } } + // Add the "lazy" attribute if the content is non-XUL (and therefore + // we can be sure no mediator is involved). Style rules in xul.css + // make sure that "lazy" scrollbars are XBL-bound only when needed. + PRBool lazyScrollbar = !mContent->IsContentOfType(nsIContent::eXUL); + // create horzontal scrollbar nsresult rv; nsCOMPtr elementFactory = @@ -444,6 +449,10 @@ nsGfxScrollFrame::CreateAnonymousContent(nsIPresContext* aPresContext, content->SetAttr(kNameSpaceID_None, nsXULAtoms::collapsed, NS_LITERAL_STRING("true"), PR_FALSE); + if (lazyScrollbar) + content->SetAttr(kNameSpaceID_None, nsXULAtoms::lazy, + NS_LITERAL_STRING("true"), PR_FALSE); + aAnonymousChildren.AppendElement(content); // create vertical scrollbar @@ -455,6 +464,10 @@ nsGfxScrollFrame::CreateAnonymousContent(nsIPresContext* aPresContext, content->SetAttr(kNameSpaceID_None, nsXULAtoms::collapsed, NS_LITERAL_STRING("true"), PR_FALSE); + if (lazyScrollbar) + content->SetAttr(kNameSpaceID_None, nsXULAtoms::lazy, + NS_LITERAL_STRING("true"), PR_FALSE); + aAnonymousChildren.AppendElement(content); // XXX For GFX never have scrollbars diff --git a/mozilla/xpfe/global/resources/content/xul.css b/mozilla/xpfe/global/resources/content/xul.css index d2516692c00..2e108e75d97 100644 --- a/mozilla/xpfe/global/resources/content/xul.css +++ b/mozilla/xpfe/global/resources/content/xul.css @@ -723,8 +723,11 @@ scrollbar { direction: ltr; } -scrollbar[collapsed="true"], -scrollbar[moz-collapsed="true"] { +/* Scrollbars which have been marked 'lazy' are unbound while + collapsed; this saves anonymous content creation for scrollbars + which are not visible */ +scrollbar[lazy="true"][collapsed="true"], +scrollbar[lazy="true"][moz-collapsed="true"] { -moz-binding: none; }