| 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 | 74 |
| 75 inline static bool shouldStopBlinkingDueToTypingCommand(LocalFrame* frame) | 75 inline static bool shouldStopBlinkingDueToTypingCommand(LocalFrame* frame) |
| 76 { | 76 { |
| 77 return frame->editor().lastEditCommand() && frame->editor().lastEditCommand(
)->shouldStopCaretBlinking(); | 77 return frame->editor().lastEditCommand() && frame->editor().lastEditCommand(
)->shouldStopCaretBlinking(); |
| 78 } | 78 } |
| 79 | 79 |
| 80 void FrameCaret::updateAppearance() | 80 void FrameCaret::updateAppearance() |
| 81 { | 81 { |
| 82 // Paint a block cursor instead of a caret in overtype mode unless the caret
is at the end of a line (in this case | 82 // Paint a block cursor instead of a caret in overtype mode unless the caret
is at the end of a line (in this case |
| 83 // the FrameSelection will paint a blinking caret as usual). | 83 // the FrameSelection will paint a blinking caret as usual). |
| 84 bool paintBlockCursor = m_shouldShowBlockCursor && isActive() && !isLogicalE
ndOfLine(createVisiblePosition(caretPosition())); | 84 bool paintBlockCursor = m_shouldShowBlockCursor && isActive() && !isLogicalE
ndOfLine(createVisiblePositionDeprecated(caretPosition())); |
| 85 | 85 |
| 86 bool shouldBlink = !paintBlockCursor && shouldBlinkCaret(); | 86 bool shouldBlink = !paintBlockCursor && shouldBlinkCaret(); |
| 87 | 87 |
| 88 // If the caret moved, stop the blink timer so we can restart with a | 88 // If the caret moved, stop the blink timer so we can restart with a |
| 89 // black caret in the new location. | 89 // black caret in the new location. |
| 90 if (!shouldBlink || shouldStopBlinkingDueToTypingCommand(m_frame)) | 90 if (!shouldBlink || shouldStopBlinkingDueToTypingCommand(m_frame)) |
| 91 stopCaretBlinkTimer(); | 91 stopCaretBlinkTimer(); |
| 92 | 92 |
| 93 // Start blinking with a black caret. Be sure not to restart if we're | 93 // Start blinking with a black caret. Be sure not to restart if we're |
| 94 // already blinking in the right location. | 94 // already blinking in the right location. |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 DCHECK(!m_frame->document()->needsLayoutTreeUpdate()); | 189 DCHECK(!m_frame->document()->needsLayoutTreeUpdate()); |
| 190 DocumentLifecycle::DisallowTransitionScope disallowTransition(m_frame->docum
ent()->lifecycle()); | 190 DocumentLifecycle::DisallowTransitionScope disallowTransition(m_frame->docum
ent()->lifecycle()); |
| 191 | 191 |
| 192 if (!isActive()) { | 192 if (!isActive()) { |
| 193 clearCaretRect(); | 193 clearCaretRect(); |
| 194 } else { | 194 } else { |
| 195 if (enclosingTextFormControl(caretPosition().position())) { | 195 if (enclosingTextFormControl(caretPosition().position())) { |
| 196 if (isVisuallyEquivalentCandidate(caretPosition().position())) | 196 if (isVisuallyEquivalentCandidate(caretPosition().position())) |
| 197 updateCaretRect(caretPosition()); | 197 updateCaretRect(caretPosition()); |
| 198 else | 198 else |
| 199 updateCaretRect(createVisiblePosition(caretPosition())); | 199 updateCaretRect(createVisiblePositionDeprecated(caretPosition())
); |
| 200 } else { | 200 } else { |
| 201 updateCaretRect(createVisiblePosition(caretPosition())); | 201 updateCaretRect(createVisiblePositionDeprecated(caretPosition())); |
| 202 } | 202 } |
| 203 } | 203 } |
| 204 return absoluteBoundsForLocalRect(caretPosition().position().anchorNode(), l
ocalCaretRectWithoutUpdate()); | 204 return absoluteBoundsForLocalRect(caretPosition().position().anchorNode(), l
ocalCaretRectWithoutUpdate()); |
| 205 } | 205 } |
| 206 | 206 |
| 207 void FrameCaret::setShouldShowBlockCursor(bool shouldShowBlockCursor) | 207 void FrameCaret::setShouldShowBlockCursor(bool shouldShowBlockCursor) |
| 208 { | 208 { |
| 209 m_shouldShowBlockCursor = shouldShowBlockCursor; | 209 m_shouldShowBlockCursor = shouldShowBlockCursor; |
| 210 | 210 |
| 211 m_frame->document()->updateStyleAndLayoutIgnorePendingStylesheets(); | 211 m_frame->document()->updateStyleAndLayoutIgnorePendingStylesheets(); |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 void FrameCaret::caretBlinkTimerFired(TimerBase*) | 274 void FrameCaret::caretBlinkTimerFired(TimerBase*) |
| 275 { | 275 { |
| 276 DCHECK_EQ(m_caretVisibility, CaretVisibility::Visible); | 276 DCHECK_EQ(m_caretVisibility, CaretVisibility::Visible); |
| 277 if (isCaretBlinkingSuspended() && m_shouldPaintCaret) | 277 if (isCaretBlinkingSuspended() && m_shouldPaintCaret) |
| 278 return; | 278 return; |
| 279 m_shouldPaintCaret = !m_shouldPaintCaret; | 279 m_shouldPaintCaret = !m_shouldPaintCaret; |
| 280 setCaretRectNeedsUpdate(); | 280 setCaretRectNeedsUpdate(); |
| 281 } | 281 } |
| 282 | 282 |
| 283 } // nemaspace blink | 283 } // nemaspace blink |
| OLD | NEW |