| OLD | NEW |
| 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 return PositionWithAffinity(); | 70 return PositionWithAffinity(); |
| 71 return PositionWithAffinity(selection.start(), selection.affinity()); | 71 return PositionWithAffinity(selection.start(), selection.affinity()); |
| 72 } | 72 } |
| 73 | 73 |
| 74 inline static bool shouldStopBlinkingDueToTypingCommand(LocalFrame* frame) { | 74 inline static bool shouldStopBlinkingDueToTypingCommand(LocalFrame* frame) { |
| 75 return frame->editor().lastEditCommand() && | 75 return frame->editor().lastEditCommand() && |
| 76 frame->editor().lastEditCommand()->shouldStopCaretBlinking(); | 76 frame->editor().lastEditCommand()->shouldStopCaretBlinking(); |
| 77 } | 77 } |
| 78 | 78 |
| 79 void FrameCaret::updateAppearance() { | 79 void FrameCaret::updateAppearance() { |
| 80 // Paint a block cursor instead of a caret in overtype mode unless the caret i
s at the end of a line (in this case | 80 // Paint a block cursor instead of a caret in overtype mode unless the caret |
| 81 // the FrameSelection will paint a blinking caret as usual). | 81 // is at the end of a line (in this case the FrameSelection will paint a |
| 82 // blinking caret as usual). |
| 82 bool paintBlockCursor = | 83 bool paintBlockCursor = |
| 83 m_shouldShowBlockCursor && isActive() && | 84 m_shouldShowBlockCursor && isActive() && |
| 84 !isLogicalEndOfLine(createVisiblePositionDeprecated(caretPosition())); | 85 !isLogicalEndOfLine(createVisiblePositionDeprecated(caretPosition())); |
| 85 | 86 |
| 86 bool shouldBlink = !paintBlockCursor && shouldBlinkCaret(); | 87 bool shouldBlink = !paintBlockCursor && shouldBlinkCaret(); |
| 87 | 88 |
| 88 // If the caret moved, stop the blink timer so we can restart with a | 89 // If the caret moved, stop the blink timer so we can restart with a |
| 89 // black caret in the new location. | 90 // black caret in the new location. |
| 90 if (!shouldBlink || shouldStopBlinkingDueToTypingCommand(m_frame)) | 91 if (!shouldBlink || shouldStopBlinkingDueToTypingCommand(m_frame)) |
| 91 stopCaretBlinkTimer(); | 92 stopCaretBlinkTimer(); |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 | 267 |
| 267 void FrameCaret::caretBlinkTimerFired(TimerBase*) { | 268 void FrameCaret::caretBlinkTimerFired(TimerBase*) { |
| 268 DCHECK_EQ(m_caretVisibility, CaretVisibility::Visible); | 269 DCHECK_EQ(m_caretVisibility, CaretVisibility::Visible); |
| 269 if (isCaretBlinkingSuspended() && m_shouldPaintCaret) | 270 if (isCaretBlinkingSuspended() && m_shouldPaintCaret) |
| 270 return; | 271 return; |
| 271 m_shouldPaintCaret = !m_shouldPaintCaret; | 272 m_shouldPaintCaret = !m_shouldPaintCaret; |
| 272 setCaretRectNeedsUpdate(); | 273 setCaretRectNeedsUpdate(); |
| 273 } | 274 } |
| 274 | 275 |
| 275 } // nemaspace blink | 276 } // nemaspace blink |
| OLD | NEW |