Lines Matching refs:element
73 void SelectElement::selectAll(SelectElementData& data, Element* element) in selectAll() argument
76 if (!element->renderer() || !data.multiple()) in selectAll()
80 saveLastSelection(data, element); in selectAll()
83 setActiveSelectionAnchorIndex(data, element, nextSelectableListIndex(data, element, -1)); in selectAll()
84 setActiveSelectionEndIndex(data, previousSelectableListIndex(data, element, -1)); in selectAll()
86 updateListBoxSelection(data, element, false); in selectAll()
87 listBoxOnChange(data, element); in selectAll()
90 void SelectElement::saveLastSelection(SelectElementData& data, Element* element) in saveLastSelection() argument
93 data.setLastOnChangeIndex(selectedIndex(data, element)); in saveLastSelection()
100 const Vector<Element*>& items = data.listItems(element); in saveLastSelection()
107 int SelectElement::nextSelectableListIndex(SelectElementData& data, Element* element, int startInde… in nextSelectableListIndex() argument
109 const Vector<Element*>& items = data.listItems(element); in nextSelectableListIndex()
118 int SelectElement::previousSelectableListIndex(SelectElementData& data, Element* element, int start… in previousSelectableListIndex() argument
120 const Vector<Element*>& items = data.listItems(element); in previousSelectableListIndex()
131 void SelectElement::setActiveSelectionAnchorIndex(SelectElementData& data, Element* element, int in… in setActiveSelectionAnchorIndex() argument
139 const Vector<Element*>& items = data.listItems(element); in setActiveSelectionAnchorIndex()
151 void SelectElement::updateListBoxSelection(SelectElementData& data, Element* element, bool deselect… in updateListBoxSelection() argument
153 ASSERT(element->renderer() && element->renderer()->isListBox()); in updateListBoxSelection()
160 const Vector<Element*>& items = data.listItems(element); in updateListBoxSelection()
174 scrollToSelection(data, element); in updateListBoxSelection()
177 void SelectElement::listBoxOnChange(SelectElementData& data, Element* element) in listBoxOnChange() argument
182 const Vector<Element*>& items = data.listItems(element); in listBoxOnChange()
186 element->dispatchFormControlChangeEvent(); in listBoxOnChange()
201 element->dispatchFormControlChangeEvent(); in listBoxOnChange()
204 void SelectElement::menuListOnChange(SelectElementData& data, Element* element) in menuListOnChange() argument
208 int selected = selectedIndex(data, element); in menuListOnChange()
212 element->dispatchFormControlChangeEvent(); in menuListOnChange()
216 void SelectElement::scrollToSelection(SelectElementData& data, Element* element) in scrollToSelection() argument
221 if (RenderObject* renderer = element->renderer()) in scrollToSelection()
225 void SelectElement::setOptionsChangedOnRenderer(SelectElementData& data, Element* element) in setOptionsChangedOnRenderer() argument
227 if (RenderObject* renderer = element->renderer()) { in setOptionsChangedOnRenderer()
235 void SelectElement::setRecalcListItems(SelectElementData& data, Element* element) in setRecalcListItems() argument
239 setOptionsChangedOnRenderer(data, element); in setRecalcListItems()
240 element->setNeedsStyleRecalc(); in setRecalcListItems()
243 void SelectElement::recalcListItems(SelectElementData& data, const Element* element, bool updateSel… in recalcListItems() argument
251 for (Node* currentNode = element->firstChild(); currentNode;) { in recalcListItems()
253 currentNode = currentNode->traverseNextSibling(element); in recalcListItems()
293 currentNode = currentNode->traverseNextSibling(element); in recalcListItems()
297 int SelectElement::selectedIndex(const SelectElementData& data, const Element* element) in selectedIndex() argument
302 const Vector<Element*>& items = data.listItems(element); in selectedIndex()
314 void SelectElement::setSelectedIndex(SelectElementData& data, Element* element, int optionIndex, bo… in setSelectedIndex() argument
316 const Vector<Element*>& items = data.listItems(element); in setSelectedIndex()
317 int listIndex = optionToListIndex(data, element, optionIndex); in setSelectedIndex()
325 setActiveSelectionAnchorIndex(data, element, listIndex); in setSelectedIndex()
332 deselectItems(data, element, excludeElement); in setSelectedIndex()
335 if (RenderObject* renderer = element->renderer()) in setSelectedIndex()
338 scrollToSelection(data, element); in setSelectedIndex()
344 menuListOnChange(data, element); in setSelectedIndex()
345 RenderObject* renderer = element->renderer(); in setSelectedIndex()
354 if (Frame* frame = element->document()->frame()) in setSelectedIndex()
355 frame->page()->chrome()->client()->formStateDidChange(element); in setSelectedIndex()
358 int SelectElement::optionToListIndex(const SelectElementData& data, const Element* element, int opt… in optionToListIndex() argument
360 const Vector<Element*>& items = data.listItems(element); in optionToListIndex()
377 int SelectElement::listToOptionIndex(const SelectElementData& data, const Element* element, int lis… in listToOptionIndex() argument
379 const Vector<Element*>& items = data.listItems(element); in listToOptionIndex()
392 void SelectElement::dispatchFocusEvent(SelectElementData& data, Element* element) in dispatchFocusEvent() argument
396 saveLastSelection(data, element); in dispatchFocusEvent()
399 void SelectElement::dispatchBlurEvent(SelectElementData& data, Element* element) in dispatchBlurEvent() argument
404 menuListOnChange(data, element); in dispatchBlurEvent()
407 void SelectElement::deselectItems(SelectElementData& data, Element* element, Element* excludeElemen… in deselectItems() argument
409 const Vector<Element*>& items = data.listItems(element); in deselectItems()
419 bool SelectElement::saveFormControlState(const SelectElementData& data, const Element* element, Str… in saveFormControlState() argument
421 const Vector<Element*>& items = data.listItems(element); in saveFormControlState()
436 void SelectElement::restoreFormControlState(SelectElementData& data, Element* element, const String… in restoreFormControlState() argument
438 recalcListItems(data, element); in restoreFormControlState()
440 const Vector<Element*>& items = data.listItems(element); in restoreFormControlState()
448 setOptionsChangedOnRenderer(data, element); in restoreFormControlState()
451 void SelectElement::parseMultipleAttribute(SelectElementData& data, Element* element, MappedAttribu… in parseMultipleAttribute() argument
455 if (oldUsesMenuList != data.usesMenuList() && element->attached()) { in parseMultipleAttribute()
456 element->detach(); in parseMultipleAttribute()
457 element->attach(); in parseMultipleAttribute()
461 bool SelectElement::appendFormData(SelectElementData& data, Element* element, FormDataList& list) in appendFormData() argument
463 const AtomicString& name = element->formControlName(); in appendFormData()
468 const Vector<Element*>& items = data.listItems(element); in appendFormData()
496 void SelectElement::reset(SelectElementData& data, Element* element) in reset() argument
501 const Vector<Element*>& items = data.listItems(element); in reset()
522 setOptionsChangedOnRenderer(data, element); in reset()
523 element->setNeedsStyleRecalc(); in reset()
549 void SelectElement::menuListDefaultEventHandler(SelectElementData& data, Element* element, Event* e… in menuListDefaultEventHandler() argument
556 if (!element->renderer() || !event->isKeyboardEvent()) in menuListDefaultEventHandler()
564 element->focus(); in menuListDefaultEventHandler()
567 saveLastSelection(data, element); in menuListDefaultEventHandler()
568 if (RenderMenuList* menuList = toRenderMenuList(element->renderer())) in menuListDefaultEventHandler()
573 const Vector<Element*>& listItems = data.listItems(element); in menuListDefaultEventHandler()
575 int listIndex = optionToListIndex(data, element, selectedIndex(data, element)); in menuListDefaultEventHandler()
597 setSelectedIndex(data, element, listToOptionIndex(data, element, listIndex)); in menuListDefaultEventHandler()
606 if (!element->renderer() || !event->isKeyboardEvent()) in menuListDefaultEventHandler()
614 element->focus(); in menuListDefaultEventHandler()
617 saveLastSelection(data, element); in menuListDefaultEventHandler()
618 if (RenderMenuList* menuList = toRenderMenuList(element->renderer())) in menuListDefaultEventHandler()
624 element->focus(); in menuListDefaultEventHandler()
627 saveLastSelection(data, element); in menuListDefaultEventHandler()
628 if (RenderMenuList* menuList = toRenderMenuList(element->renderer())) in menuListDefaultEventHandler()
632 menuListOnChange(data, element); in menuListDefaultEventHandler()
638 int listIndex = optionToListIndex(data, element, selectedIndex(data, element)); in menuListDefaultEventHandler()
641 … setSelectedIndex(data, element, listToOptionIndex(data, element, listIndex), true, true); in menuListDefaultEventHandler()
650 element->focus(); in menuListDefaultEventHandler()
651 if (element->renderer() && element->renderer()->isMenuList()) { in menuListDefaultEventHandler()
652 if (RenderMenuList* menuList = toRenderMenuList(element->renderer())) { in menuListDefaultEventHandler()
658 saveLastSelection(data, element); in menuListDefaultEventHandler()
667 void SelectElement::listBoxDefaultEventHandler(SelectElementData& data, Element* element, Event* ev… in listBoxDefaultEventHandler() argument
669 const Vector<Element*>& listItems = data.listItems(element); in listBoxDefaultEventHandler()
672 element->focus(); in listBoxDefaultEventHandler()
676 …IntPoint localOffset = roundedIntPoint(element->renderer()->absoluteToLocal(mouseEvent->absoluteLo… in listBoxDefaultEventHandler()
677 …int listIndex = toRenderListBox(element->renderer())->listIndexAtOffset(localOffset.x(), localOffs… in listBoxDefaultEventHandler()
680 saveLastSelection(data, element); in listBoxDefaultEventHandler()
708 deselectItems(data, element, clickedElement); in listBoxDefaultEventHandler()
712 setActiveSelectionAnchorIndex(data, element, selectedIndex(data, element)); in listBoxDefaultEventHandler()
721 setActiveSelectionAnchorIndex(data, element, listIndex); in listBoxDefaultEventHandler()
724 updateListBoxSelection(data, element, !multiSelect); in listBoxDefaultEventHandler()
726 if (Frame* frame = element->document()->frame()) in listBoxDefaultEventHandler()
731 …t*>(event)->button() == LeftButton && element->document()->frame()->eventHandler()->autoscrollRend… in listBoxDefaultEventHandler()
733 listBoxOnChange(data, element); in listBoxDefaultEventHandler()
743 … endIndex = nextSelectableListIndex(data, element, lastSelectedListIndex(data, element)); in listBoxDefaultEventHandler()
745 …Index = previousSelectableListIndex(data, element, optionToListIndex(data, element, selectedIndex(… in listBoxDefaultEventHandler()
749 endIndex = nextSelectableListIndex(data, element, data.activeSelectionEndIndex()); in listBoxDefaultEventHandler()
751 … endIndex = previousSelectableListIndex(data, element, data.activeSelectionEndIndex()); in listBoxDefaultEventHandler()
756 saveLastSelection(data, element); in listBoxDefaultEventHandler()
766 deselectItems(data, element); in listBoxDefaultEventHandler()
767 setActiveSelectionAnchorIndex(data, element, data.activeSelectionEndIndex()); in listBoxDefaultEventHandler()
770 toRenderListBox(element->renderer())->scrollToRevealElementAtListIndex(endIndex); in listBoxDefaultEventHandler()
771 updateListBoxSelection(data, element, deselectOthers); in listBoxDefaultEventHandler()
772 listBoxOnChange(data, element); in listBoxDefaultEventHandler()
789 void SelectElement::defaultEventHandler(SelectElementData& data, Element* element, Event* event, HT… in defaultEventHandler() argument
791 if (!element->renderer()) in defaultEventHandler()
795 menuListDefaultEventHandler(data, element, event, htmlForm); in defaultEventHandler()
797 listBoxDefaultEventHandler(data, element, event, htmlForm); in defaultEventHandler()
805 typeAheadFind(data, element, keyboardEvent); in defaultEventHandler()
812 int SelectElement::lastSelectedListIndex(const SelectElementData& data, const Element* element) in lastSelectedListIndex() argument
817 const Vector<Element*>& items = data.listItems(element); in lastSelectedListIndex()
843 void SelectElement::typeAheadFind(SelectElementData& data, Element* element, KeyboardEvent* event) in typeAheadFind() argument
872 const Vector<Element*>& items = data.listItems(element); in typeAheadFind()
877 int selected = selectedIndex(data, element); in typeAheadFind()
878 …int index = (optionToListIndex(data, element, selected >= 0 ? selected : 0) + searchStartOffset) %… in typeAheadFind()
894 setSelectedIndex(data, element, listToOptionIndex(data, element, index)); in typeAheadFind()
896 listBoxOnChange(data, element); in typeAheadFind()
898 setOptionsChangedOnRenderer(data, element); in typeAheadFind()
899 element->setNeedsStyleRecalc(); in typeAheadFind()
905 void SelectElement::insertedIntoTree(SelectElementData& data, Element* element) in insertedIntoTree() argument
909 recalcListItems(data, element, true); in insertedIntoTree()
912 void SelectElement::accessKeySetSelectedIndex(SelectElementData& data, Element* element, int index) in accessKeySetSelectedIndex() argument
915 if (!element->focused()) in accessKeySetSelectedIndex()
916 element->accessKeyAction(false); in accessKeySetSelectedIndex()
919 const Vector<Element*>& items = data.listItems(element); in accessKeySetSelectedIndex()
920 int listIndex = optionToListIndex(data, element, index); in accessKeySetSelectedIndex()
925 setSelectedIndex(data, element, index, false, true); in accessKeySetSelectedIndex()
928 listBoxOnChange(data, element); in accessKeySetSelectedIndex()
929 scrollToSelection(data, element); in accessKeySetSelectedIndex()
932 unsigned SelectElement::optionCount(const SelectElementData& data, const Element* element) in optionCount() argument
936 const Vector<Element*>& items = data.listItems(element); in optionCount()
959 void SelectElementData::checkListItems(const Element* element) const in checkListItems()
963 SelectElement::recalcListItems(*const_cast<SelectElementData*>(this), element, false); in checkListItems()
966 UNUSED_PARAM(element); in checkListItems()
970 Vector<Element*>& SelectElementData::listItems(const Element* element) in listItems() argument
973 SelectElement::recalcListItems(*this, element); in listItems()
975 checkListItems(element); in listItems()
980 const Vector<Element*>& SelectElementData::listItems(const Element* element) const in listItems()
983 SelectElement::recalcListItems(*const_cast<SelectElementData*>(this), element); in listItems()
985 checkListItems(element); in listItems()
990 SelectElement* toSelectElement(Element* element) in toSelectElement() argument
992 if (element->isHTMLElement()) { in toSelectElement()
993 if (element->hasTagName(HTMLNames::selectTag)) in toSelectElement()
994 return static_cast<HTMLSelectElement*>(element); in toSelectElement()
995 if (element->hasTagName(HTMLNames::keygenTag)) in toSelectElement()
996 return static_cast<HTMLKeygenElement*>(element); in toSelectElement()
1000 if (element->isWMLElement() && element->hasTagName(WMLNames::selectTag)) in toSelectElement()
1001 return static_cast<WMLSelectElement*>(element); in toSelectElement()