Commit 013af3f0 authored by yosin's avatar yosin Committed by Commit bot

Get rid of a redundant parameter ResetCaretBlinkOption from FrameSelection::updateAppearance()

This patch gets rid of rid of a redundant parameter |ResetCaretBlinkOption| from
|FrameSelection::updateAppearance()| with introducing |stopCaretBlinkTimer()|
by calling |stopCaretBlinkTimer()| at call site which calls |updateAppearance()|
with |ResetCaretBlink| to simplify source code for improving readability.

This patch is a follow-up patch of http://crrev.com/1629213002, which simplifies
code path in |updateAppearance()|.

BUG=n/a
TEST=n/a; no behavior changes

Review URL: https://codereview.chromium.org/1632673004

Cr-Commit-Position: refs/heads/master@{#371472}
parent 7413d683
......@@ -331,7 +331,8 @@ void FrameSelection::setSelectionAlgorithm(const VisibleSelectionTemplate<Strate
if (!(options & DoNotUpdateAppearance)) {
// Hits in compositing/overflow/do-not-paint-outline-into-composited-scrolling-contents.html
DisableCompositingQueryAsserts disabler;
updateAppearance(ResetCaretBlink);
stopCaretBlinkTimer();
updateAppearance();
}
// Always clear the x position used for vertical arrow navigation.
......@@ -980,7 +981,7 @@ void FrameSelection::commitAppearanceIfNeeded(LayoutView& layoutView)
return m_pendingSelection->commit(layoutView);
}
void FrameSelection::updateAppearance(ResetCaretBlinkOption option)
void FrameSelection::updateAppearance()
{
// 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).
......@@ -990,12 +991,8 @@ void FrameSelection::updateAppearance(ResetCaretBlinkOption option)
// If the caret moved, stop the blink timer so we can restart with a
// black caret in the new location.
if (option == ResetCaretBlink || !shouldBlink || shouldStopBlinkingDueToTypingCommand(m_frame)) {
m_caretBlinkTimer.stop();
m_shouldPaintCaret = false;
setCaretRectNeedsUpdate();
}
if (!shouldBlink || shouldStopBlinkingDueToTypingCommand(m_frame))
stopCaretBlinkTimer();
// Start blinking with a black caret. Be sure not to restart if we're
// already blinking in the right location.
......@@ -1052,6 +1049,13 @@ void FrameSelection::caretBlinkTimerFired(Timer<FrameSelection>*)
setCaretRectNeedsUpdate();
}
void FrameSelection::stopCaretBlinkTimer()
{
m_caretBlinkTimer.stop();
m_shouldPaintCaret = false;
setCaretRectNeedsUpdate();
}
void FrameSelection::notifyLayoutObjectOfSelectionChange(EUserTriggered userTriggered)
{
if (HTMLTextFormControlElement* textControl = enclosingTextFormControl(start()))
......
......@@ -91,11 +91,6 @@ public:
return static_cast<EUserTriggered>(options & UserTriggered);
}
enum ResetCaretBlinkOption {
None,
ResetCaretBlink
};
LocalFrame* frame() const { return m_frame; }
Element* rootEditableElement() const { return selection().rootEditableElement(); }
Element* rootEditableElementOrDocumentElement() const;
......@@ -186,7 +181,7 @@ public:
bool isAppearanceDirty() const;
void commitAppearanceIfNeeded(LayoutView&);
void updateAppearance(ResetCaretBlinkOption = None);
void updateAppearance();
void setCaretVisible(bool caretIsVisible) { setCaretVisibility(caretIsVisible ? Visible : Hidden); }
bool isCaretBoundsDirty() const { return m_caretRectDirty; }
void setCaretRectNeedsUpdate();
......@@ -281,6 +276,7 @@ private:
void focusedOrActiveStateChanged();
void caretBlinkTimerFired(Timer<FrameSelection>*);
void stopCaretBlinkTimer();
void setUseSecureKeyboardEntry(bool);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment