Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(160)

Side by Side Diff: third_party/WebKit/Source/core/editing/FrameSelection.cpp

Issue 1632673004: Get rid of a redundant parameter ResetCaretBlinkOption from FrameSelection::updateAppearance() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 2016-01-26T14:38:54 Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/core/editing/FrameSelection.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2008, 2009, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2008, 2009, 2010 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 324
325 m_selectionEditor->setVisibleSelection(s, options); 325 m_selectionEditor->setVisibleSelection(s, options);
326 setCaretRectNeedsUpdate(); 326 setCaretRectNeedsUpdate();
327 327
328 if (!s.isNone() && !(options & DoNotSetFocus)) 328 if (!s.isNone() && !(options & DoNotSetFocus))
329 setFocusedNodeIfNeeded(); 329 setFocusedNodeIfNeeded();
330 330
331 if (!(options & DoNotUpdateAppearance)) { 331 if (!(options & DoNotUpdateAppearance)) {
332 // Hits in compositing/overflow/do-not-paint-outline-into-composited-scr olling-contents.html 332 // Hits in compositing/overflow/do-not-paint-outline-into-composited-scr olling-contents.html
333 DisableCompositingQueryAsserts disabler; 333 DisableCompositingQueryAsserts disabler;
334 updateAppearance(ResetCaretBlink); 334 stopCaretBlinkTimer();
335 updateAppearance();
335 } 336 }
336 337
337 // Always clear the x position used for vertical arrow navigation. 338 // Always clear the x position used for vertical arrow navigation.
338 // It will be restored by the vertical arrow navigation code if necessary. 339 // It will be restored by the vertical arrow navigation code if necessary.
339 m_selectionEditor->resetXPosForVerticalArrowNavigation(); 340 m_selectionEditor->resetXPosForVerticalArrowNavigation();
340 RefPtrWillBeRawPtr<LocalFrame> protector(m_frame.get()); 341 RefPtrWillBeRawPtr<LocalFrame> protector(m_frame.get());
341 // This may dispatch a synchronous focus-related events. 342 // This may dispatch a synchronous focus-related events.
342 selectFrameElementInParentIfFullySelected(); 343 selectFrameElementInParentIfFullySelected();
343 notifyLayoutObjectOfSelectionChange(userTriggered); 344 notifyLayoutObjectOfSelectionChange(userTriggered);
344 // If the selections are same in the DOM tree but not in the composed tree, 345 // If the selections are same in the DOM tree but not in the composed tree,
(...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after
973 bool FrameSelection::isAppearanceDirty() const 974 bool FrameSelection::isAppearanceDirty() const
974 { 975 {
975 return m_pendingSelection->hasPendingSelection(); 976 return m_pendingSelection->hasPendingSelection();
976 } 977 }
977 978
978 void FrameSelection::commitAppearanceIfNeeded(LayoutView& layoutView) 979 void FrameSelection::commitAppearanceIfNeeded(LayoutView& layoutView)
979 { 980 {
980 return m_pendingSelection->commit(layoutView); 981 return m_pendingSelection->commit(layoutView);
981 } 982 }
982 983
983 void FrameSelection::updateAppearance(ResetCaretBlinkOption option) 984 void FrameSelection::updateAppearance()
984 { 985 {
985 // Paint a block cursor instead of a caret in overtype mode unless the caret is at the end of a line (in this case 986 // Paint a block cursor instead of a caret in overtype mode unless the caret is at the end of a line (in this case
986 // the FrameSelection will paint a blinking caret as usual). 987 // the FrameSelection will paint a blinking caret as usual).
987 bool paintBlockCursor = m_shouldShowBlockCursor && selection().isCaret() && !isLogicalEndOfLine(selection().visibleEnd()); 988 bool paintBlockCursor = m_shouldShowBlockCursor && selection().isCaret() && !isLogicalEndOfLine(selection().visibleEnd());
988 989
989 bool shouldBlink = !paintBlockCursor && shouldBlinkCaret(); 990 bool shouldBlink = !paintBlockCursor && shouldBlinkCaret();
990 991
991 // If the caret moved, stop the blink timer so we can restart with a 992 // If the caret moved, stop the blink timer so we can restart with a
992 // black caret in the new location. 993 // black caret in the new location.
993 if (option == ResetCaretBlink || !shouldBlink || shouldStopBlinkingDueToTypi ngCommand(m_frame)) { 994 if (!shouldBlink || shouldStopBlinkingDueToTypingCommand(m_frame))
994 m_caretBlinkTimer.stop(); 995 stopCaretBlinkTimer();
995
996 m_shouldPaintCaret = false;
997 setCaretRectNeedsUpdate();
998 }
999 996
1000 // Start blinking with a black caret. Be sure not to restart if we're 997 // Start blinking with a black caret. Be sure not to restart if we're
1001 // already blinking in the right location. 998 // already blinking in the right location.
1002 if (shouldBlink && !m_caretBlinkTimer.isActive()) { 999 if (shouldBlink && !m_caretBlinkTimer.isActive()) {
1003 if (double blinkInterval = LayoutTheme::theme().caretBlinkInterval()) 1000 if (double blinkInterval = LayoutTheme::theme().caretBlinkInterval())
1004 m_caretBlinkTimer.startRepeating(blinkInterval, BLINK_FROM_HERE); 1001 m_caretBlinkTimer.startRepeating(blinkInterval, BLINK_FROM_HERE);
1005 1002
1006 m_shouldPaintCaret = true; 1003 m_shouldPaintCaret = true;
1007 setCaretRectNeedsUpdate(); 1004 setCaretRectNeedsUpdate();
1008 } 1005 }
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
1045 void FrameSelection::caretBlinkTimerFired(Timer<FrameSelection>*) 1042 void FrameSelection::caretBlinkTimerFired(Timer<FrameSelection>*)
1046 { 1043 {
1047 ASSERT(caretIsVisible()); 1044 ASSERT(caretIsVisible());
1048 ASSERT(isCaret()); 1045 ASSERT(isCaret());
1049 if (isCaretBlinkingSuspended() && m_shouldPaintCaret) 1046 if (isCaretBlinkingSuspended() && m_shouldPaintCaret)
1050 return; 1047 return;
1051 m_shouldPaintCaret = !m_shouldPaintCaret; 1048 m_shouldPaintCaret = !m_shouldPaintCaret;
1052 setCaretRectNeedsUpdate(); 1049 setCaretRectNeedsUpdate();
1053 } 1050 }
1054 1051
1052 void FrameSelection::stopCaretBlinkTimer()
1053 {
1054 m_caretBlinkTimer.stop();
1055 m_shouldPaintCaret = false;
1056 setCaretRectNeedsUpdate();
1057 }
1058
1055 void FrameSelection::notifyLayoutObjectOfSelectionChange(EUserTriggered userTrig gered) 1059 void FrameSelection::notifyLayoutObjectOfSelectionChange(EUserTriggered userTrig gered)
1056 { 1060 {
1057 if (HTMLTextFormControlElement* textControl = enclosingTextFormControl(start ())) 1061 if (HTMLTextFormControlElement* textControl = enclosingTextFormControl(start ()))
1058 textControl->selectionChanged(userTriggered == UserTriggered); 1062 textControl->selectionChanged(userTriggered == UserTriggered);
1059 } 1063 }
1060 1064
1061 // Helper function that tells whether a particular node is an element that has a n entire 1065 // Helper function that tells whether a particular node is an element that has a n entire
1062 // LocalFrame and FrameView, a <frame>, <iframe>, or <object>. 1066 // LocalFrame and FrameView, a <frame>, <iframe>, or <object>.
1063 static bool isFrameElement(const Node* n) 1067 static bool isFrameElement(const Node* n)
1064 { 1068 {
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
1407 1411
1408 void showTree(const blink::FrameSelection* sel) 1412 void showTree(const blink::FrameSelection* sel)
1409 { 1413 {
1410 if (sel) 1414 if (sel)
1411 sel->showTreeForThis(); 1415 sel->showTreeForThis();
1412 else 1416 else
1413 fprintf(stderr, "Cannot showTree for (nil) FrameSelection.\n"); 1417 fprintf(stderr, "Cannot showTree for (nil) FrameSelection.\n");
1414 } 1418 }
1415 1419
1416 #endif 1420 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/editing/FrameSelection.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698