void HTMLTextAreaElement::updateFocusAppearance(bool restorePreviousSelection) { if (!restorePreviousSelection) setSelectionRange(0, 0); else restoreCachedSelection(); if (document().frame()) document().frame()->selection().revealSelection(); }
void HTMLTextAreaElement::updateFocusAppearance(bool restorePreviousSelection) { if (!restorePreviousSelection || !hasCachedSelection()) { // If this is the first focus, set a caret at the beginning of the text. // This matches some browsers' behavior; see bug 11746 Comment #15. // http://bugs.webkit.org/show_bug.cgi?id=11746#c15 setSelectionRange(0, 0); } else restoreCachedSelection(); if (document()->frame()) document()->frame()->selection()->revealSelection(); }
void HTMLTextAreaElement::updateFocusAppearance( SelectionBehaviorOnFocus selectionBehavior) { switch (selectionBehavior) { case SelectionBehaviorOnFocus::Reset: // Fallthrough. case SelectionBehaviorOnFocus::Restore: restoreCachedSelection(); break; case SelectionBehaviorOnFocus::None: return; } if (document().frame()) document().frame()->selection().revealSelection(); }
void HTMLTextAreaElement::updateFocusAppearance(bool restorePreviousSelection) { ASSERT(renderer()); ASSERT(!document()->childNeedsAndNotInStyleRecalc()); if (!restorePreviousSelection || !hasCachedSelection()) { #if ENABLE(ON_FIRST_TEXTAREA_FOCUS_SELECT_ALL) // Devices with trackballs or d-pads may focus on a textarea in route // to another focusable node. By selecting all text, the next movement // can more readily be interpreted as moving to the next node. select(); #else // If this is the first focus, set a caret at the beginning of the text. // This matches some browsers' behavior; see bug 11746 Comment #15. // http://bugs.webkit.org/show_bug.cgi?id=11746#c15 setSelectionRange(0, 0); #endif } else restoreCachedSelection(); if (document()->frame()) document()->frame()->selection()->revealSelection(); }