Backed out 3 changesets (bug 1677263, bug 1679460, bug 1679461) for test_focus.xhtml failures CLOSED TREE
Backed out changeset 03db12dabc63 (bug 1677263) Backed out changeset 75de13448090 (bug 1679460) Backed out changeset 4f4fd8e7ce93 (bug 1679461)
This commit is contained in:
@@ -132,14 +132,37 @@ nsresult HTMLTextAreaElement::Clone(dom::NodeInfo* aNodeInfo,
|
||||
// nsIContent
|
||||
|
||||
void HTMLTextAreaElement::Select() {
|
||||
if (FocusState() != eUnfocusable) {
|
||||
if (RefPtr<nsFocusManager> fm = nsFocusManager::GetFocusManager()) {
|
||||
fm->SetFocus(this, nsIFocusManager::FLAG_NOSCROLL);
|
||||
}
|
||||
// XXX Bug? We have to give the input focus before contents can be
|
||||
// selected
|
||||
|
||||
FocusTristate state = FocusState();
|
||||
if (state == eUnfocusable) {
|
||||
return;
|
||||
}
|
||||
|
||||
SetSelectionRange(0, UINT32_MAX, mozilla::dom::Optional<nsAString>(),
|
||||
IgnoredErrorResult());
|
||||
nsFocusManager* fm = nsFocusManager::GetFocusManager();
|
||||
|
||||
RefPtr<nsPresContext> presContext = GetPresContext(eForComposedDoc);
|
||||
if (state == eInactiveWindow) {
|
||||
if (fm) fm->SetFocus(this, nsIFocusManager::FLAG_NOSCROLL);
|
||||
SelectAll(presContext);
|
||||
return;
|
||||
}
|
||||
|
||||
WidgetGUIEvent event(true, eFormSelect, nullptr);
|
||||
// XXXbz HTMLInputElement guards against this reentering; shouldn't we?
|
||||
EventDispatcher::Dispatch(static_cast<nsIContent*>(this), presContext,
|
||||
&event);
|
||||
|
||||
if (fm) {
|
||||
fm->SetFocus(this, nsIFocusManager::FLAG_NOSCROLL);
|
||||
|
||||
// ensure that the element is actually focused
|
||||
if (this == fm->GetFocusedElement()) {
|
||||
// Now Select all the text!
|
||||
SelectAll(presContext);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
||||
Reference in New Issue
Block a user