Chromium Code Reviews| 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 11 matching lines...) Expand all Loading... | |
| 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 24 */ | 24 */ |
| 25 | 25 |
| 26 #include "core/editing/FrameCaret.h" | 26 #include "core/editing/FrameCaret.h" |
| 27 | 27 |
| 28 #include "core/editing/EditingUtilities.h" | 28 #include "core/editing/EditingUtilities.h" |
| 29 #include "core/editing/Editor.h" | 29 #include "core/editing/Editor.h" |
| 30 #include "core/editing/SelectionEditor.h" | 30 #include "core/editing/SelectionEditor.h" |
| 31 #include "core/editing/commands/CompositeEditCommand.h" | 31 #include "core/editing/commands/CompositeEditCommand.h" |
| 32 #include "core/frame/FrameView.h" | |
| 32 #include "core/frame/LocalFrame.h" | 33 #include "core/frame/LocalFrame.h" |
| 33 #include "core/frame/Settings.h" | 34 #include "core/frame/Settings.h" |
| 34 #include "core/html/TextControlElement.h" | 35 #include "core/html/TextControlElement.h" |
| 35 #include "core/layout/LayoutTheme.h" | 36 #include "core/layout/LayoutTheme.h" |
| 36 #include "core/layout/api/LayoutViewItem.h" | 37 #include "core/layout/api/LayoutPartItem.h" |
| 37 #include "core/page/Page.h" | 38 #include "core/page/Page.h" |
| 38 #include "core/paint/PaintLayer.h" | 39 #include "core/paint/PaintLayer.h" |
| 39 #include "public/platform/WebTraceLocation.h" | 40 #include "public/platform/WebTraceLocation.h" |
| 40 | 41 |
| 41 namespace blink { | 42 namespace blink { |
| 42 | 43 |
| 43 FrameCaret::FrameCaret(LocalFrame* frame, | 44 FrameCaret::FrameCaret(LocalFrame* frame, |
| 44 const SelectionEditor& selectionEditor) | 45 const SelectionEditor& selectionEditor) |
| 45 : m_selectionEditor(&selectionEditor), | 46 : m_selectionEditor(&selectionEditor), |
| 46 m_frame(frame), | 47 m_frame(frame), |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 135 updateAppearance(); | 136 updateAppearance(); |
| 136 } | 137 } |
| 137 | 138 |
| 138 void FrameCaret::setCaretRectNeedsUpdate() { | 139 void FrameCaret::setCaretRectNeedsUpdate() { |
| 139 if (m_caretRectDirty) | 140 if (m_caretRectDirty) |
| 140 return; | 141 return; |
| 141 m_caretRectDirty = true; | 142 m_caretRectDirty = true; |
| 142 | 143 |
| 143 if (Page* page = m_frame->page()) | 144 if (Page* page = m_frame->page()) |
| 144 page->animator().scheduleVisualUpdate(m_frame->localFrameRoot()); | 145 page->animator().scheduleVisualUpdate(m_frame->localFrameRoot()); |
| 146 | |
| 147 // Ensure the frame will be checked for paint invalidation during | |
|
pdr.
2016/12/22 01:08:18
Without spinvalidation, how are carets marked as n
Xianzhu
2016/12/22 01:31:52
Without spinvalidation, we always walk all of the
| |
| 148 // PrePaintTreeWalk. | |
| 149 if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) { | |
| 150 if (auto layoutItem = m_frame->ownerLayoutItem()) | |
|
pdr.
2016/12/22 01:08:18
I think with LayoutItem you need to check !layoutI
Xianzhu
2016/12/22 01:31:52
The above is equivalent to "if (auto* layoutObject
| |
| 151 layoutItem.setMayNeedPaintInvalidation(); | |
| 152 } | |
| 145 } | 153 } |
| 146 | 154 |
| 147 bool FrameCaret::caretPositionIsValidForDocument( | 155 bool FrameCaret::caretPositionIsValidForDocument( |
| 148 const Document& document) const { | 156 const Document& document) const { |
| 149 if (!isActive()) | 157 if (!isActive()) |
| 150 return true; | 158 return true; |
| 151 | 159 |
| 152 return caretPosition().document() == document && !caretPosition().isOrphan(); | 160 return caretPosition().document() == document && !caretPosition().isOrphan(); |
| 153 } | 161 } |
| 154 | 162 |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 290 | 298 |
| 291 void FrameCaret::caretBlinkTimerFired(TimerBase*) { | 299 void FrameCaret::caretBlinkTimerFired(TimerBase*) { |
| 292 DCHECK_EQ(m_caretVisibility, CaretVisibility::Visible); | 300 DCHECK_EQ(m_caretVisibility, CaretVisibility::Visible); |
| 293 if (isCaretBlinkingSuspended() && m_shouldPaintCaret) | 301 if (isCaretBlinkingSuspended() && m_shouldPaintCaret) |
| 294 return; | 302 return; |
| 295 m_shouldPaintCaret = !m_shouldPaintCaret; | 303 m_shouldPaintCaret = !m_shouldPaintCaret; |
| 296 setCaretRectNeedsUpdate(); | 304 setCaretRectNeedsUpdate(); |
| 297 } | 305 } |
| 298 | 306 |
| 299 } // namespace blink | 307 } // namespace blink |
| OLD | NEW |