зеркало из https://github.com/mozilla/pjs.git
Bug 446663. Make sure that if the user is typing in a text input its text input listener will get the events (so that undo/redo work and oninput is fired).
This commit is contained in:
Родитель
ecde0a5feb
Коммит
310e6f6c08
|
@ -135,6 +135,15 @@ static const PRInt32 DEFAULT_UNDO_CAP = 1000;
|
|||
static nsINativeKeyBindings *sNativeInputBindings = nsnull;
|
||||
static nsINativeKeyBindings *sNativeTextAreaBindings = nsnull;
|
||||
|
||||
static PRBool
|
||||
IsFocusedContent(nsPresContext* aPresContext, nsIContent* aContent)
|
||||
{
|
||||
nsCOMPtr<nsIContent> focusedContent;
|
||||
aPresContext->EventStateManager()->
|
||||
GetFocusedContent(getter_AddRefs(focusedContent));
|
||||
return focusedContent == aContent;
|
||||
}
|
||||
|
||||
static void
|
||||
PlatformToDOMLineBreaks(nsString &aString)
|
||||
{
|
||||
|
@ -1387,8 +1396,15 @@ nsTextControlFrame::CalcIntrinsicSize(nsIRenderingContext* aRenderingContext,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
void nsTextControlFrame::PostCreateFrames() {
|
||||
void
|
||||
nsTextControlFrame::PostCreateFrames()
|
||||
{
|
||||
InitEditor();
|
||||
// Notify the text listener we have focus and setup the caret etc (bug 446663).
|
||||
if (IsFocusedContent(PresContext(), GetContent())) {
|
||||
mTextListener->Focus(nsnull);
|
||||
SetFocus(PR_TRUE, PR_FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
nsIFrame*
|
||||
|
@ -1871,15 +1887,6 @@ nsTextControlFrame::IsLeaf() const
|
|||
return PR_TRUE;
|
||||
}
|
||||
|
||||
static PRBool
|
||||
IsFocusedContent(nsPresContext* aPresContext, nsIContent* aContent)
|
||||
{
|
||||
nsCOMPtr<nsIContent> focusedContent;
|
||||
aPresContext->EventStateManager()->
|
||||
GetFocusedContent(getter_AddRefs(focusedContent));
|
||||
return focusedContent == aContent;
|
||||
}
|
||||
|
||||
//IMPLEMENTING NS_IFORMCONTROLFRAME
|
||||
void nsTextControlFrame::SetFocus(PRBool aOn, PRBool aRepaint)
|
||||
{
|
||||
|
|
|
@ -47,6 +47,7 @@ include $(topsrcdir)/config/rules.mk
|
|||
_TEST_FILES = test_bug345267.html \
|
||||
test_bug402198.html \
|
||||
test_bug411236.html \
|
||||
test_bug446663.html \
|
||||
$(NULL)
|
||||
|
||||
libs:: $(_TEST_FILES)
|
||||
|
|
Загрузка…
Ссылка в новой задаче