Bug 76197 Unscrollable scrollbars should look disabled r=varga sr=roc

This commit is contained in:
neil%parkwaycc.co.uk 2004-09-22 06:33:36 +00:00
Родитель a0ba186ae0
Коммит cba803d313
8 изменённых файлов: 77 добавлений и 6 удалений

Просмотреть файл

@ -71,6 +71,7 @@
#include "nsGUIEvent.h"
#include "nsContentCreatorFunctions.h"
#include "nsISupportsPrimitives.h"
#include "nsIPresShell.h"
#ifdef ACCESSIBILITY
#include "nsIAccessibilityService.h"
#endif
@ -2009,6 +2010,7 @@ nsGfxScrollFrameInner::Layout(nsBoxLayoutState& aState)
scrollable->SetLineHeight(fontHeight);
if (mVScrollbarBox) {
SetScrollbarEnabled(mVScrollbarBox, maxY);
SetAttribute(mVScrollbarBox, nsXULAtoms::maxpos, maxY);
SetAttribute(mVScrollbarBox, nsXULAtoms::pageincrement, nscoord(scrollAreaRect.height - fontHeight));
SetAttribute(mVScrollbarBox, nsXULAtoms::increment, fontHeight);
@ -2023,6 +2025,7 @@ nsGfxScrollFrameInner::Layout(nsBoxLayoutState& aState)
}
if (mHScrollbarBox) {
SetScrollbarEnabled(mHScrollbarBox, maxX);
SetAttribute(mHScrollbarBox, nsXULAtoms::maxpos, maxX);
SetAttribute(mHScrollbarBox, nsXULAtoms::pageincrement, nscoord(float(scrollAreaRect.width)*0.8));
SetAttribute(mHScrollbarBox, nsXULAtoms::increment, 10*mOnePixel);
@ -2107,6 +2110,20 @@ nsGfxScrollFrameInner::ScrollbarChanged(nsPresContext* aPresContext, nscoord aX,
// printf("scrolling to: %d, %d\n", aX, aY);
}
void
nsGfxScrollFrameInner::SetScrollbarEnabled(nsIBox* aBox, nscoord aMaxPos, PRBool aReflow)
{
nsIFrame* frame;
aBox->GetFrame(&frame);
mOuter->GetPresContext()->PresShell()->PostAttributeChange(
frame->GetContent(),
kNameSpaceID_None,
nsHTMLAtoms::disabled,
NS_LITERAL_STRING("true"),
aReflow,
aMaxPos ? eChangeType_Remove : eChangeType_Set);
}
/**
* Returns whether it actually needed to change the attribute
*/

Просмотреть файл

@ -80,6 +80,7 @@ public:
// This gets called when the 'curpos' attribute on one of the scrollbars changes
void CurPosAttributeChanged(nsIContent* aChild, PRInt32 aModType);
void SetScrollbarEnabled(nsIBox* aBox, nscoord aMaxPos, PRBool aReflow=PR_TRUE);
PRBool SetAttribute(nsIBox* aBox, nsIAtom* aAtom, nscoord aSize, PRBool aReflow=PR_TRUE);
PRInt32 GetIntegerAttribute(nsIBox* aFrame, nsIAtom* atom, PRInt32 defaultValue);

Просмотреть файл

@ -71,6 +71,7 @@
#include "nsGUIEvent.h"
#include "nsContentCreatorFunctions.h"
#include "nsISupportsPrimitives.h"
#include "nsIPresShell.h"
#ifdef ACCESSIBILITY
#include "nsIAccessibilityService.h"
#endif
@ -2009,6 +2010,7 @@ nsGfxScrollFrameInner::Layout(nsBoxLayoutState& aState)
scrollable->SetLineHeight(fontHeight);
if (mVScrollbarBox) {
SetScrollbarEnabled(mVScrollbarBox, maxY);
SetAttribute(mVScrollbarBox, nsXULAtoms::maxpos, maxY);
SetAttribute(mVScrollbarBox, nsXULAtoms::pageincrement, nscoord(scrollAreaRect.height - fontHeight));
SetAttribute(mVScrollbarBox, nsXULAtoms::increment, fontHeight);
@ -2023,6 +2025,7 @@ nsGfxScrollFrameInner::Layout(nsBoxLayoutState& aState)
}
if (mHScrollbarBox) {
SetScrollbarEnabled(mHScrollbarBox, maxX);
SetAttribute(mHScrollbarBox, nsXULAtoms::maxpos, maxX);
SetAttribute(mHScrollbarBox, nsXULAtoms::pageincrement, nscoord(float(scrollAreaRect.width)*0.8));
SetAttribute(mHScrollbarBox, nsXULAtoms::increment, 10*mOnePixel);
@ -2107,6 +2110,20 @@ nsGfxScrollFrameInner::ScrollbarChanged(nsPresContext* aPresContext, nscoord aX,
// printf("scrolling to: %d, %d\n", aX, aY);
}
void
nsGfxScrollFrameInner::SetScrollbarEnabled(nsIBox* aBox, nscoord aMaxPos, PRBool aReflow)
{
nsIFrame* frame;
aBox->GetFrame(&frame);
mOuter->GetPresContext()->PresShell()->PostAttributeChange(
frame->GetContent(),
kNameSpaceID_None,
nsHTMLAtoms::disabled,
NS_LITERAL_STRING("true"),
aReflow,
aMaxPos ? eChangeType_Remove : eChangeType_Set);
}
/**
* Returns whether it actually needed to change the attribute
*/

Просмотреть файл

@ -80,6 +80,7 @@ public:
// This gets called when the 'curpos' attribute on one of the scrollbars changes
void CurPosAttributeChanged(nsIContent* aChild, PRInt32 aModType);
void SetScrollbarEnabled(nsIBox* aBox, nscoord aMaxPos, PRBool aReflow=PR_TRUE);
PRBool SetAttribute(nsIBox* aBox, nsIAtom* aAtom, nscoord aSize, PRBool aReflow=PR_TRUE);
PRInt32 GetIntegerAttribute(nsIBox* aFrame, nsIAtom* atom, PRInt32 defaultValue);

Просмотреть файл

@ -120,11 +120,19 @@ scrollbarbutton[type="increment"] {
background-image: url("chrome://global/skin/arrow/arrow-rit.gif")
}
scrollbarbutton[type="increment"][disabled="true"] {
background-image: url("chrome://global/skin/arrow/arrow-rit-dis.gif")
}
scrollbar[orient="vertical"] > scrollbarbutton[type="increment"] {
-moz-appearance: scrollbarbutton-down;
background-image: url("chrome://global/skin/arrow/arrow-dn.gif")
}
scrollbar[orient="vertical"] > scrollbarbutton[type="increment"][disabled="true"] {
background-image: url("chrome://global/skin/arrow/arrow-dn-dis.gif")
}
/* ..... decrement .... */
scrollbarbutton[type="decrement"] {
@ -132,11 +140,19 @@ scrollbarbutton[type="decrement"] {
background-image: url("chrome://global/skin/arrow/arrow-lft.gif")
}
scrollbarbutton[type="decrement"][disabled="true"] {
background-image: url("chrome://global/skin/arrow/arrow-lft-dis.gif")
}
scrollbar[orient="vertical"] > scrollbarbutton[type="decrement"] {
-moz-appearance: scrollbarbutton-up;
background-image: url("chrome://global/skin/arrow/arrow-up.gif")
}
scrollbar[orient="vertical"] > scrollbarbutton[type="decrement"][disabled="true"] {
background-image: url("chrome://global/skin/arrow/arrow-up-dis.gif")
}
/* :::::::::::::::::::::::::::::::::::::::::::::::::::::::: */
/* ::::::::::::::::::::: MEDIA PRINT :::::::::::::::::::::: */
/* :::::::::::::::::::::::::::::::::::::::::::::::::::::::: */
@ -210,11 +226,19 @@ scrollbar[orient="vertical"] > scrollbarbutton[type="decrement"] {
background-image: url("chrome://global/skin/arrow/arrow-rit.gif")
}
html|div scrollbarbutton[type="increment"][disabled="true"] {
background-image: url("chrome://global/skin/arrow/arrow-rit-dis.gif")
}
html|div scrollbar[orient="vertical"] > scrollbarbutton[type="increment"] {
-moz-appearance: scrollbarbutton-down;
background-image: url("chrome://global/skin/arrow/arrow-dn.gif")
}
html|div scrollbar[orient="vertical"] > scrollbarbutton[type="increment"][disabled="true"] {
background-image: url("chrome://global/skin/arrow/arrow-dn-dis.gif")
}
/* ..... decrement .... */
html|div scrollbarbutton[type="decrement"] {
@ -222,9 +246,17 @@ scrollbar[orient="vertical"] > scrollbarbutton[type="decrement"] {
background-image: url("chrome://global/skin/arrow/arrow-lft.gif")
}
html|div scrollbarbutton[type="decrement"][disabled="true"] {
background-image: url("chrome://global/skin/arrow/arrow-lft-dis.gif")
}
html|div scrollbar[orient="vertical"] > scrollbarbutton[type="decrement"] {
-moz-appearance: scrollbarbutton-up;
background-image: url("chrome://global/skin/arrow/arrow-up.gif")
}
html|div scrollbar[orient="vertical"] > scrollbarbutton[type="decrement"][disabled="true"] {
background-image: url("chrome://global/skin/arrow/arrow-up-dis.gif")
}
}

Просмотреть файл

@ -111,6 +111,7 @@ scrollbar[orient="horizontal"] > scrollbarbutton {
height: 11px;
}
scrollbarbutton[disabled="true"],
scrollbarbutton:hover:active {
border-left-width: 2px;
border-right-width: 2px;

Просмотреть файл

@ -100,6 +100,7 @@ scrollbarbutton {
height: 15px;
}
scrollbarbutton[disabled="true"],
scrollbarbutton:hover:active {
border-left-width: 2px;
border-right-width: 2px;
@ -194,6 +195,7 @@ scrollbar[orient="vertical"] > scrollbarbutton[type="decrement"] {
height: 15px;
}
html|div scrollbarbutton[disabled="true"],
html|div scrollbarbutton:hover:active {
border-left-width: 2px;
border-right-width: 2px;

Просмотреть файл

@ -23,14 +23,14 @@
<binding id="scrollbar" extends="chrome://global/content/bindings/scrollbar.xml#scrollbar-base">
<content>
<xul:scrollbarbutton sbattr="scrollbar-up-top" type="decrement" xbl:inherits="sborient=orient"/>
<xul:scrollbarbutton sbattr="scrollbar-down-top" type="increment" hidden="true" xbl:inherits="sborient=orient"/>
<xul:slider flex="1" xbl:inherits="curpos,maxpos,pageincrement,increment,orient,sborient=orient">
<xul:thumb sbattr="scrollbar-thumb" xbl:inherits="orient,sborient=orient"
<xul:scrollbarbutton sbattr="scrollbar-up-top" type="decrement" xbl:inherits="disabled,sborient=orient"/>
<xul:scrollbarbutton sbattr="scrollbar-down-top" type="increment" hidden="true" xbl:inherits="disabled,sborient=orient"/>
<xul:slider flex="1" xbl:inherits="disabled,curpos,maxpos,pageincrement,increment,orient,sborient=orient">
<xul:thumb sbattr="scrollbar-thumb" xbl:inherits="orient,sborient=orient,collapsed=disabled"
align="center" pack="center" flex="1"/>
</xul:slider>
<xul:scrollbarbutton sbattr="scrollbar-up-bottom" type="decrement" hidden="true" xbl:inherits="sborient=orient"/>
<xul:scrollbarbutton sbattr="scrollbar-down-bottom" type="increment" xbl:inherits="sborient=orient"/>
<xul:scrollbarbutton sbattr="scrollbar-up-bottom" type="decrement" hidden="true" xbl:inherits="disabled,sborient=orient"/>
<xul:scrollbarbutton sbattr="scrollbar-down-bottom" type="increment" xbl:inherits="disabled,sborient=orient"/>
</content>
<implementation>