| Index: Source/core/editing/FrameSelection.cpp
|
| diff --git a/Source/core/editing/FrameSelection.cpp b/Source/core/editing/FrameSelection.cpp
|
| index 126cf31b027d91093ffe0a4c0c60c848d0ee21ed..a9d192643d288b53c8f7e791dd723f8af0a8249e 100644
|
| --- a/Source/core/editing/FrameSelection.cpp
|
| +++ b/Source/core/editing/FrameSelection.cpp
|
| @@ -272,11 +272,9 @@ void FrameSelection::setSelection(const VisibleSelection& newSelection, SetSelec
|
| setFocusedNodeIfNeeded();
|
|
|
| if (!(options & DoNotUpdateAppearance)) {
|
| - m_frame->document()->updateLayoutIgnorePendingStylesheets();
|
| -
|
| // Hits in compositing/overflow/do-not-paint-outline-into-composited-scrolling-contents.html
|
| DisableCompositingQueryAsserts disabler;
|
| - updateAppearance();
|
| + updateAppearance(ResetCaretBlink);
|
| }
|
|
|
| // Always clear the x position used for vertical arrow navigation.
|
| @@ -1230,18 +1228,18 @@ static bool isTextFormControl(const VisibleSelection& selection)
|
| return enclosingTextFormControl(selection.start());
|
| }
|
|
|
| -LayoutRect FrameSelection::localCaretRect()
|
| +void FrameSelection::updateLocalCaretRect()
|
| {
|
| if (shouldUpdateCaretRect()) {
|
| - if (!isNonOrphanedCaret(m_selection))
|
| + if (!isNonOrphanedCaret(m_selection)) {
|
| clearCaretRect();
|
| - else if (isTextFormControl(m_selection))
|
| + } else if (isTextFormControl(m_selection)) {
|
| + m_frame->document()->updateLayoutIgnorePendingStylesheets();
|
| m_absCaretBoundsDirty |= updateCaretRect(m_frame->document(), PositionWithAffinity(m_selection.start().isCandidate() ? m_selection.start() : Position(), m_selection.affinity()));
|
| - else
|
| + } else {
|
| m_absCaretBoundsDirty |= updateCaretRect(m_frame->document(), VisiblePosition(m_selection.start(), m_selection.affinity()));
|
| + }
|
| }
|
| -
|
| - return localCaretRectWithoutUpdate();
|
| }
|
|
|
| IntRect FrameSelection::absoluteCaretBounds()
|
| @@ -1259,7 +1257,8 @@ bool FrameSelection::recomputeCaretRect()
|
| return false;
|
|
|
| LayoutRect oldRect = localCaretRectWithoutUpdate();
|
| - LayoutRect newRect = localCaretRect();
|
| + updateLocalCaretRect();
|
| + LayoutRect newRect = localCaretRectWithoutUpdate();
|
| if (oldRect == newRect && !m_absCaretBoundsDirty)
|
| return false;
|
|
|
| @@ -1540,7 +1539,7 @@ inline static bool shouldStopBlinkingDueToTypingCommand(LocalFrame* frame)
|
| return frame->editor().lastEditCommand() && frame->editor().lastEditCommand()->shouldStopCaretBlinking();
|
| }
|
|
|
| -void FrameSelection::updateAppearance()
|
| +void FrameSelection::updateAppearance(UpdateAppearanceOption option)
|
| {
|
| // Paint a block cursor instead of a caret in overtype mode unless the caret is at the end of a line (in this case
|
| // the FrameSelection will paint a blinking caret as usual).
|
| @@ -1550,12 +1549,11 @@ void FrameSelection::updateAppearance()
|
| m_caretPaint = forwardPosition.isNull();
|
| }
|
|
|
| - bool caretRectChangedOrCleared = recomputeCaretRect();
|
| bool shouldBlink = shouldBlinkCaret() && forwardPosition.isNull();
|
|
|
| // If the caret moved, stop the blink timer so we can restart with a
|
| // black caret in the new location.
|
| - if (caretRectChangedOrCleared || !shouldBlink || shouldStopBlinkingDueToTypingCommand(m_frame)) {
|
| + if (option == ResetCaretBlink || !shouldBlink || shouldStopBlinkingDueToTypingCommand(m_frame)) {
|
| m_caretBlinkTimer.stop();
|
| if (!shouldBlink && m_caretPaint) {
|
| m_caretPaint = false;
|
| @@ -1581,7 +1579,11 @@ void FrameSelection::updateAppearance()
|
|
|
| // Construct a new VisibleSolution, since m_selection is not necessarily valid, and the following steps
|
| // assume a valid selection. See <https://bugs.webkit.org/show_bug.cgi?id=69563> and <rdar://problem/10232866>.
|
| - VisibleSelection selection(m_selection.visibleStart(), forwardPosition.isNotNull() ? forwardPosition : m_selection.visibleEnd());
|
| + VisibleSelection selection;
|
| + if (isTextFormControl(m_selection))
|
| + selection.setWithoutValidation(m_selection.start(), forwardPosition.isNotNull() ? forwardPosition.deepEquivalent() : m_selection.end());
|
| + else
|
| + selection = VisibleSelection(m_selection.visibleStart(), forwardPosition.isNotNull() ? forwardPosition : m_selection.visibleEnd());
|
|
|
| if (!selection.isRange()) {
|
| view->clearSelection();
|
| @@ -1657,8 +1659,6 @@ void FrameSelection::caretBlinkTimerFired(Timer<FrameSelection>*)
|
|
|
| void FrameSelection::notifyRendererOfSelectionChange(EUserTriggered userTriggered)
|
| {
|
| - m_frame->document()->updateRenderTreeIfNeeded();
|
| -
|
| if (HTMLTextFormControlElement* textControl = enclosingTextFormControl(start()))
|
| textControl->selectionChanged(userTriggered == UserTriggered);
|
| }
|
|
|