Index: third_party/WebKit/Source/core/editing/FrameSelection.cpp |
diff --git a/third_party/WebKit/Source/core/editing/FrameSelection.cpp b/third_party/WebKit/Source/core/editing/FrameSelection.cpp |
index f7678ec27d5ddde784996d432d3b4ee071b2e0c4..4c51ee413b5a1f23d3ee17a757823103d00d65b9 100644 |
--- a/third_party/WebKit/Source/core/editing/FrameSelection.cpp |
+++ b/third_party/WebKit/Source/core/editing/FrameSelection.cpp |
@@ -105,9 +105,12 @@ FrameSelection::FrameSelection(LocalFrame& frame) |
FrameSelection::~FrameSelection() {} |
-const DisplayItemClient& FrameSelection::caretDisplayItemClientForTesting() |
- const { |
- return m_frameCaret->displayItemClient(); |
+void FrameSelection::setCaretVisualRect(const LayoutRect& r) { |
+ m_frameCaret->setVisualRect(r); |
+} |
+ |
+const DisplayItemClient& FrameSelection::getCaretDisplayItemClient() const { |
yosin_UTC9
2017/01/31 20:12:58
I guess this renaming to help grate reformatting =
|
+ return m_frameCaret->getDisplayItemClient(); |
} |
const Document& FrameSelection::document() const { |
@@ -224,7 +227,7 @@ void FrameSelection::setSelectionAlgorithm( |
m_handleVisibility = handleVisibility; |
m_selectionEditor->setVisibleSelection(s, options); |
- m_frameCaret->setCaretRectNeedsUpdate(); |
+ setCaretMayNeedPaintInvalidation(); |
if (!s.isNone() && !(options & DoNotSetFocus)) { |
setFocusedNodeIfNeeded(); |
@@ -386,7 +389,7 @@ void FrameSelection::nodeChildrenWillBeRemoved(ContainerNode& container) { |
m_selectionEditor->setWithoutValidation(newStart, newEnd); |
else |
m_selectionEditor->setWithoutValidation(newEnd, newStart); |
- m_frameCaret->setCaretRectNeedsUpdate(); |
+ setCaretMayNeedPaintInvalidation(); |
if (document().isRunningExecCommand()) |
return; |
TypingCommand::closeTyping(m_frame); |
@@ -466,7 +469,7 @@ void FrameSelection::respondToNodeModification(Node& node, |
if (clearDOMTreeSelection) |
setSelection(SelectionInDOMTree(), DoNotSetFocus); |
- m_frameCaret->setCaretRectNeedsUpdate(); |
+ setCaretMayNeedPaintInvalidation(); |
// TODO(yosin): We should move to call |TypingCommand::closeTyping()| to |
// |Editor| class. |
@@ -677,7 +680,7 @@ bool FrameSelection::modify(EAlteration alter, |
if (userTriggered == UserTriggered) |
m_granularity = CharacterGranularity; |
- m_frameCaret->setCaretRectNeedsUpdate(); |
+ setCaretMayNeedPaintInvalidation(); |
return true; |
} |
@@ -727,26 +730,24 @@ void FrameSelection::contextDestroyed(Document* document) { |
m_selectionEditor->documentDetached(*document); |
} |
-bool FrameSelection::hasCaretIn(const LayoutBlock& layoubBlock) const { |
+bool FrameSelection::hasCaretIn(const LayoutBlock& layoutBlock) const { |
DCHECK(selection().isValidFor(document())); |
- if (!isCaret()) |
- return false; |
- return CaretDisplayItemClient::caretLayoutObject( |
- selection().start().anchorNode()) == layoubBlock && |
- hasEditableStyle(); |
+ return caretLayoutBlock() == layoutBlock; |
} |
-IntRect FrameSelection::absoluteCaretBounds() { |
- DCHECK(selection().isValidFor(*m_frame->document())); |
- return m_frameCaret->absoluteCaretBounds(); |
+LayoutBlock* FrameSelection::caretLayoutBlock() const { |
+ if (!isCaret() || !hasEditableStyle()) |
+ return nullptr; |
+ return m_frameCaret->caretLayoutBlock(); |
} |
-void FrameSelection::invalidateCaretRect(bool forceInvalidation) { |
- m_frameCaret->invalidateCaretRect(forceInvalidation); |
+LayoutRect FrameSelection::caretLocalRect() const { |
+ return m_frameCaret->caretLocalRect(); |
} |
-void FrameSelection::dataWillChange(const CharacterData& node) { |
- m_frameCaret->dataWillChange(node); |
+IntRect FrameSelection::absoluteCaretBounds() { |
+ DCHECK(selection().isValidFor(*m_frame->document())); |
+ return m_frameCaret->absoluteCaretBounds(); |
} |
void FrameSelection::paintCaret(GraphicsContext& context, |
@@ -1051,7 +1052,7 @@ void FrameSelection::commitAppearanceIfNeeded(LayoutView& layoutView) { |
} |
void FrameSelection::didLayout() { |
- setCaretRectNeedsUpdate(); |
+ setCaretMayNeedPaintInvalidation(); |
updateAppearance(); |
} |
@@ -1404,12 +1405,12 @@ bool FrameSelection::shouldPaintCaretForTesting() const { |
return m_frameCaret->shouldPaintCaretForTesting(); |
} |
-bool FrameSelection::isPreviousCaretDirtyForTesting() const { |
- return m_frameCaret->isPreviousCaretDirtyForTesting(); |
+void FrameSelection::setCaretMayNeedPaintInvalidation() { |
+ m_frameCaret->setMayNeedPaintInvalidation(); |
} |
-void FrameSelection::setCaretRectNeedsUpdate() { |
- m_frameCaret->setCaretRectNeedsUpdate(); |
+void FrameSelection::setCaretNeedsPaintInvalidation() { |
+ m_frameCaret->setNeedsPaintInvalidation(); |
} |
void FrameSelection::setCaretBlinkingSuspended(bool suspended) { |