|
Lines 315-321
void HTMLTextFormControlElement::setSele
Source/WebCore/html/HTMLTextFormControlElement.cpp_sec1
|
| 315 |
} |
315 |
} |
| 316 |
|
316 |
|
| 317 |
if (Frame* frame = document().frame()) |
317 |
if (Frame* frame = document().frame()) |
| 318 |
frame->selection().moveTo(startPosition, endPosition, direction != SelectionHasNoDirection, !hasFocus); |
318 |
frame->selection().moveWithoutValidationTo(startPosition, endPosition, direction != SelectionHasNoDirection, !hasFocus); |
| 319 |
} |
319 |
} |
| 320 |
|
320 |
|
| 321 |
int HTMLTextFormControlElement::indexForVisiblePosition(const VisiblePosition& position) const |
321 |
int HTMLTextFormControlElement::indexForVisiblePosition(const VisiblePosition& position) const |
|
Lines 480-492
void HTMLTextFormControlElement::selecti
Source/WebCore/html/HTMLTextFormControlElement.cpp_sec2
|
| 480 |
// selectionStart() or selectionEnd() will return cached selection when this node doesn't have focus |
480 |
// selectionStart() or selectionEnd() will return cached selection when this node doesn't have focus |
| 481 |
cacheSelection(computeSelectionStart(), computeSelectionEnd(), computeSelectionDirection()); |
481 |
cacheSelection(computeSelectionStart(), computeSelectionEnd(), computeSelectionDirection()); |
| 482 |
|
482 |
|
| 483 |
if (!shouldFireSelectEvent) |
483 |
if (shouldFireSelectEvent && m_cachedSelectionStart != m_cachedSelectionEnd) |
| 484 |
return; |
484 |
dispatchEvent(Event::create(eventNames().selectEvent, true, false)); |
| 485 |
|
|
|
| 486 |
if (Frame* frame = document().frame()) { |
| 487 |
if (frame->selection().isRange()) |
| 488 |
dispatchEvent(Event::create(eventNames().selectEvent, true, false)); |
| 489 |
} |
| 490 |
} |
485 |
} |
| 491 |
|
486 |
|
| 492 |
void HTMLTextFormControlElement::parseAttribute(const QualifiedName& name, const AtomicString& value) |
487 |
void HTMLTextFormControlElement::parseAttribute(const QualifiedName& name, const AtomicString& value) |
|
Lines 556-574
String HTMLTextFormControlElement::inner
Source/WebCore/html/HTMLTextFormControlElement.cpp_sec3
|
| 556 |
static Position positionForIndex(TextControlInnerTextElement* innerText, unsigned index) |
551 |
static Position positionForIndex(TextControlInnerTextElement* innerText, unsigned index) |
| 557 |
{ |
552 |
{ |
| 558 |
unsigned remainingCharactersToMoveForward = index; |
553 |
unsigned remainingCharactersToMoveForward = index; |
|
|
554 |
Node* lastBrOrText = innerText; |
| 559 |
for (Node* node = innerText; node; node = NodeTraversal::next(node, innerText)) { |
555 |
for (Node* node = innerText; node; node = NodeTraversal::next(node, innerText)) { |
| 560 |
if (node->hasTagName(brTag)) { |
556 |
if (node->hasTagName(brTag)) { |
| 561 |
if (!remainingCharactersToMoveForward) |
557 |
if (!remainingCharactersToMoveForward) |
| 562 |
return positionBeforeNode(node); |
558 |
return positionBeforeNode(node); |
| 563 |
remainingCharactersToMoveForward--; |
559 |
remainingCharactersToMoveForward--; |
|
|
560 |
lastBrOrText = node; |
| 564 |
} else if (node->isTextNode()) { |
561 |
} else if (node->isTextNode()) { |
| 565 |
Text& text = toText(*node); |
562 |
Text& text = toText(*node); |
| 566 |
if (remainingCharactersToMoveForward < text.length()) |
563 |
if (remainingCharactersToMoveForward < text.length()) |
| 567 |
return Position(&text, remainingCharactersToMoveForward); |
564 |
return Position(&text, remainingCharactersToMoveForward); |
| 568 |
remainingCharactersToMoveForward -= text.length(); |
565 |
remainingCharactersToMoveForward -= text.length(); |
|
|
566 |
lastBrOrText = node; |
| 569 |
} |
567 |
} |
| 570 |
} |
568 |
} |
| 571 |
return lastPositionInNode(innerText); |
569 |
return lastPositionInOrAfterNode(lastBrOrText); |
| 572 |
} |
570 |
} |
| 573 |
|
571 |
|
| 574 |
unsigned HTMLTextFormControlElement::indexForPosition(const Position& passedPosition) const |
572 |
unsigned HTMLTextFormControlElement::indexForPosition(const Position& passedPosition) const |