Back out text input changes from bug 72747.

This commit is contained in:
dbaron%dbaron.org 2004-09-04 03:17:18 +00:00
Родитель e5dd72b047
Коммит 4db1f75805
10 изменённых файлов: 102 добавлений и 20 удалений

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

@ -105,6 +105,15 @@ public:
NS_IMETHOD GetScrollableView(nsPresContext* aContext, nsIScrollableView** aResult)=0;
/**
* Set information about whether the vertical and horizontal scrollbars
* are currently visible
*/
NS_IMETHOD SetScrollbarVisibility(nsPresContext* aPresContext,
PRBool aVerticalVisible,
PRBool aHorizontalVisible) = 0;
NS_IMETHOD GetScrollbarBox(PRBool aVertical, nsIBox** aResult) = 0;
NS_IMETHOD CurPosAttributeChanged(nsPresContext* aPresContext,

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

@ -2996,6 +2996,16 @@ nsTextControlFrame::SetInitialChildList(nsPresContext* aPresContext,
// than descending from the root frame of the frame hierarchy.
first->AddStateBits(NS_FRAME_REFLOW_ROOT);
//we must turn off scrollbars for singleline text controls
if (IsSingleLineTextControl())
{
nsIScrollableFrame *scrollableFrame = nsnull;
if (first)
first->QueryInterface(NS_GET_IID(nsIScrollableFrame), (void **) &scrollableFrame);
if (scrollableFrame)
scrollableFrame->SetScrollbarVisibility(aPresContext,PR_FALSE,PR_FALSE);
}
//register keylistener
nsCOMPtr<nsIDOMEventReceiver> erP;
if (NS_SUCCEEDED(mContent->QueryInterface(NS_GET_IID(nsIDOMEventReceiver), getter_AddRefs(erP))) && erP)

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

@ -64,6 +64,7 @@
#include "nsIScrollbarFrame.h"
#include "nsIScrollbarMediator.h"
#include "nsITextControlFrame.h"
#include "nsIDOMHTMLTextAreaElement.h"
#include "nsNodeInfoManager.h"
#include "nsIURI.h"
#include "nsGUIEvent.h"
@ -1136,6 +1137,8 @@ nsGfxScrollFrameInner::nsGfxScrollFrameInner(nsBoxFrame* aOuter)
mOuter(aOuter),
mMaxElementWidth(0),
mLastDir(-1),
mNeverHasVerticalScrollbar(PR_FALSE),
mNeverHasHorizontalScrollbar(PR_FALSE),
mHasVerticalScrollbar(PR_FALSE),
mHasHorizontalScrollbar(PR_FALSE),
mFirstPass(PR_FALSE),
@ -1262,9 +1265,7 @@ nsGfxScrollFrameInner::CreateAnonymousContent(nsISupportsArray& aAnonymousChildr
// allow scrollbars if this is the child of the viewport, because
// we must be the scrollbars for the print preview window
if (!parent || parent->GetType() != nsLayoutAtoms::viewportFrame) {
// If we just return early here, we'll never create content or
// frames an |mHScrollbarBox| and |mVScrollbarBox| will always be
// null.
mNeverHasVerticalScrollbar = mNeverHasHorizontalScrollbar = PR_TRUE;
return;
}
}
@ -1279,6 +1280,17 @@ nsGfxScrollFrameInner::CreateAnonymousContent(nsISupportsArray& aAnonymousChildr
// Nothing to do.
return;
// The anonymous <div> used by <inputs> never gets scrollbars.
nsCOMPtr<nsITextControlFrame> textFrame(do_QueryInterface(parent));
if (textFrame) {
// Make sure we are not a text area.
nsCOMPtr<nsIDOMHTMLTextAreaElement> textAreaElement(do_QueryInterface(parent->GetContent()));
if (!textAreaElement) {
mNeverHasVerticalScrollbar = mNeverHasHorizontalScrollbar = PR_TRUE;
return;
}
}
nsNodeInfoManager *nodeInfoManager =
presContext->GetDocument()->NodeInfoManager();
nsCOMPtr<nsINodeInfo> nodeInfo;
@ -1549,7 +1561,7 @@ PRBool
nsGfxScrollFrameInner::AddRemoveScrollbar(nsBoxLayoutState& aState, nsRect& aScrollAreaSize, PRBool aOnTop, PRBool aHorizontal, PRBool aAdd)
{
if (aHorizontal) {
if (!mHScrollbarBox)
if (mNeverHasHorizontalScrollbar || !mHScrollbarBox)
return PR_FALSE;
nsSize hSize;
@ -1566,7 +1578,7 @@ nsGfxScrollFrameInner::AddRemoveScrollbar(nsBoxLayoutState& aState, nsRect& aScr
return fit;
} else {
if (!mVScrollbarBox)
if (mNeverHasVerticalScrollbar || !mVScrollbarBox)
return PR_FALSE;
nsSize vSize;

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

@ -143,6 +143,9 @@ public:
// value that indicates "not set")
PRInt16 mLastDir;
PRPackedBool mNeverHasVerticalScrollbar;
PRPackedBool mNeverHasHorizontalScrollbar;
PRPackedBool mHasVerticalScrollbar;
PRPackedBool mHasHorizontalScrollbar;
PRPackedBool mFirstPass;
@ -241,6 +244,10 @@ public:
NS_IMETHOD GetScrollPosition(nsPresContext* aContext, nscoord &aX, nscoord& aY) const;
NS_IMETHOD ScrollTo(nsPresContext* aContext, nscoord aX, nscoord aY, PRUint32 aFlags);
NS_IMETHOD SetScrollbarVisibility(nsPresContext* aPresContext,
PRBool aVerticalVisible,
PRBool aHorizontalVisible);
NS_IMETHOD GetScrollbarBox(PRBool aVertical, nsIBox** aResult);
NS_IMETHOD CurPosAttributeChanged(nsPresContext* aPresContext,
@ -370,6 +377,10 @@ public:
NS_IMETHOD GetScrollPosition(nsPresContext* aContext, nscoord &aX, nscoord& aY) const;
NS_IMETHOD ScrollTo(nsPresContext* aContext, nscoord aX, nscoord aY, PRUint32 aFlags);
NS_IMETHOD SetScrollbarVisibility(nsPresContext* aPresContext,
PRBool aVerticalVisible,
PRBool aHorizontalVisible);
NS_IMETHOD GetScrollbarBox(PRBool aVertical, nsIBox** aResult);
NS_IMETHOD CurPosAttributeChanged(nsPresContext* aPresContext,

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

@ -105,6 +105,15 @@ public:
NS_IMETHOD GetScrollableView(nsPresContext* aContext, nsIScrollableView** aResult)=0;
/**
* Set information about whether the vertical and horizontal scrollbars
* are currently visible
*/
NS_IMETHOD SetScrollbarVisibility(nsPresContext* aPresContext,
PRBool aVerticalVisible,
PRBool aHorizontalVisible) = 0;
NS_IMETHOD GetScrollbarBox(PRBool aVertical, nsIBox** aResult) = 0;
NS_IMETHOD CurPosAttributeChanged(nsPresContext* aPresContext,

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

@ -64,6 +64,7 @@
#include "nsIScrollbarFrame.h"
#include "nsIScrollbarMediator.h"
#include "nsITextControlFrame.h"
#include "nsIDOMHTMLTextAreaElement.h"
#include "nsNodeInfoManager.h"
#include "nsIURI.h"
#include "nsGUIEvent.h"
@ -1136,6 +1137,8 @@ nsGfxScrollFrameInner::nsGfxScrollFrameInner(nsBoxFrame* aOuter)
mOuter(aOuter),
mMaxElementWidth(0),
mLastDir(-1),
mNeverHasVerticalScrollbar(PR_FALSE),
mNeverHasHorizontalScrollbar(PR_FALSE),
mHasVerticalScrollbar(PR_FALSE),
mHasHorizontalScrollbar(PR_FALSE),
mFirstPass(PR_FALSE),
@ -1262,9 +1265,7 @@ nsGfxScrollFrameInner::CreateAnonymousContent(nsISupportsArray& aAnonymousChildr
// allow scrollbars if this is the child of the viewport, because
// we must be the scrollbars for the print preview window
if (!parent || parent->GetType() != nsLayoutAtoms::viewportFrame) {
// If we just return early here, we'll never create content or
// frames an |mHScrollbarBox| and |mVScrollbarBox| will always be
// null.
mNeverHasVerticalScrollbar = mNeverHasHorizontalScrollbar = PR_TRUE;
return;
}
}
@ -1279,6 +1280,17 @@ nsGfxScrollFrameInner::CreateAnonymousContent(nsISupportsArray& aAnonymousChildr
// Nothing to do.
return;
// The anonymous <div> used by <inputs> never gets scrollbars.
nsCOMPtr<nsITextControlFrame> textFrame(do_QueryInterface(parent));
if (textFrame) {
// Make sure we are not a text area.
nsCOMPtr<nsIDOMHTMLTextAreaElement> textAreaElement(do_QueryInterface(parent->GetContent()));
if (!textAreaElement) {
mNeverHasVerticalScrollbar = mNeverHasHorizontalScrollbar = PR_TRUE;
return;
}
}
nsNodeInfoManager *nodeInfoManager =
presContext->GetDocument()->NodeInfoManager();
nsCOMPtr<nsINodeInfo> nodeInfo;
@ -1549,7 +1561,7 @@ PRBool
nsGfxScrollFrameInner::AddRemoveScrollbar(nsBoxLayoutState& aState, nsRect& aScrollAreaSize, PRBool aOnTop, PRBool aHorizontal, PRBool aAdd)
{
if (aHorizontal) {
if (!mHScrollbarBox)
if (mNeverHasHorizontalScrollbar || !mHScrollbarBox)
return PR_FALSE;
nsSize hSize;
@ -1566,7 +1578,7 @@ nsGfxScrollFrameInner::AddRemoveScrollbar(nsBoxLayoutState& aState, nsRect& aScr
return fit;
} else {
if (!mVScrollbarBox)
if (mNeverHasVerticalScrollbar || !mVScrollbarBox)
return PR_FALSE;
nsSize vSize;

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

@ -143,6 +143,9 @@ public:
// value that indicates "not set")
PRInt16 mLastDir;
PRPackedBool mNeverHasVerticalScrollbar;
PRPackedBool mNeverHasHorizontalScrollbar;
PRPackedBool mHasVerticalScrollbar;
PRPackedBool mHasHorizontalScrollbar;
PRPackedBool mFirstPass;
@ -241,6 +244,10 @@ public:
NS_IMETHOD GetScrollPosition(nsPresContext* aContext, nscoord &aX, nscoord& aY) const;
NS_IMETHOD ScrollTo(nsPresContext* aContext, nscoord aX, nscoord aY, PRUint32 aFlags);
NS_IMETHOD SetScrollbarVisibility(nsPresContext* aPresContext,
PRBool aVerticalVisible,
PRBool aHorizontalVisible);
NS_IMETHOD GetScrollbarBox(PRBool aVertical, nsIBox** aResult);
NS_IMETHOD CurPosAttributeChanged(nsPresContext* aPresContext,
@ -370,6 +377,10 @@ public:
NS_IMETHOD GetScrollPosition(nsPresContext* aContext, nscoord &aX, nscoord& aY) const;
NS_IMETHOD ScrollTo(nsPresContext* aContext, nscoord aX, nscoord aY, PRUint32 aFlags);
NS_IMETHOD SetScrollbarVisibility(nsPresContext* aPresContext,
PRBool aVerticalVisible,
PRBool aHorizontalVisible);
NS_IMETHOD GetScrollbarBox(PRBool aVertical, nsIBox** aResult);
NS_IMETHOD CurPosAttributeChanged(nsPresContext* aPresContext,

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

@ -98,6 +98,10 @@ input {
text-indent: 0;
}
input > .anonymous-div {
white-space : nowrap;
}
textarea {
margin: 1px 0 1px 0;
border: 2px inset ThreeDFace;
@ -132,11 +136,6 @@ input > .anonymous-div {
text-decoration: inherit;
}
input > .anonymous-div {
white-space : nowrap;
overflow: hidden ! important;
}
select {
margin: 0;
border-color: ThreeDFace;

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

@ -2996,6 +2996,16 @@ nsTextControlFrame::SetInitialChildList(nsPresContext* aPresContext,
// than descending from the root frame of the frame hierarchy.
first->AddStateBits(NS_FRAME_REFLOW_ROOT);
//we must turn off scrollbars for singleline text controls
if (IsSingleLineTextControl())
{
nsIScrollableFrame *scrollableFrame = nsnull;
if (first)
first->QueryInterface(NS_GET_IID(nsIScrollableFrame), (void **) &scrollableFrame);
if (scrollableFrame)
scrollableFrame->SetScrollbarVisibility(aPresContext,PR_FALSE,PR_FALSE);
}
//register keylistener
nsCOMPtr<nsIDOMEventReceiver> erP;
if (NS_SUCCEEDED(mContent->QueryInterface(NS_GET_IID(nsIDOMEventReceiver), getter_AddRefs(erP))) && erP)

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

@ -98,6 +98,10 @@ input {
text-indent: 0;
}
input > .anonymous-div {
white-space : nowrap;
}
textarea {
margin: 1px 0 1px 0;
border: 2px inset ThreeDFace;
@ -132,11 +136,6 @@ input > .anonymous-div {
text-decoration: inherit;
}
input > .anonymous-div {
white-space : nowrap;
overflow: hidden ! important;
}
select {
margin: 0;
border-color: ThreeDFace;