| Index: third_party/WebKit/Source/core/editing/DragCaret.cpp
|
| diff --git a/third_party/WebKit/Source/core/editing/DragCaret.cpp b/third_party/WebKit/Source/core/editing/DragCaret.cpp
|
| index dbf4fe9903d277d033d41ec5c7fc9e4676450490..6d67d951b25fa4ddcd3e7af1adf744837edb208c 100644
|
| --- a/third_party/WebKit/Source/core/editing/DragCaret.cpp
|
| +++ b/third_party/WebKit/Source/core/editing/DragCaret.cpp
|
| @@ -40,43 +40,31 @@ DragCaret* DragCaret::create() {
|
| return new DragCaret;
|
| }
|
|
|
| +LayoutBlock* DragCaret::caretLayoutBlock() const {
|
| + LayoutBlock* block =
|
| + CaretDisplayItemClient::caretLayoutObject(m_position.anchorNode());
|
| + if (!block)
|
| + return nullptr;
|
| + if (!rootEditableElementOf(m_position.position()))
|
| + return nullptr;
|
| + return block;
|
| +}
|
| +
|
| bool DragCaret::hasCaretIn(const LayoutBlock& layoutBlock) const {
|
| - Node* node = m_position.anchorNode();
|
| - if (!node)
|
| - return false;
|
| - if (layoutBlock != CaretDisplayItemClient::caretLayoutObject(node))
|
| - return false;
|
| - return rootEditableElementOf(m_position.position());
|
| + return layoutBlock == this->caretLayoutBlock();
|
| }
|
|
|
| bool DragCaret::isContentRichlyEditable() const {
|
| return isRichlyEditablePosition(m_position.position());
|
| }
|
|
|
| -void DragCaret::invalidateCaretRect(Node* node,
|
| - const LayoutRect& caretLocalRect) {
|
| - // TODO(editing-dev): The use of updateStyleAndLayout
|
| - // needs to be audited. See http://crbug.com/590369 for more details.
|
| - // In the long term we should use idle time spell checker to prevent
|
| - // synchronous layout caused by spell checking (see crbug.com/517298).
|
| - node->document().updateStyleAndLayoutTree();
|
| - if (!hasEditableStyle(*node))
|
| - return;
|
| - m_caretBase->invalidateLocalCaretRect(node, caretLocalRect);
|
| -}
|
| -
|
| void DragCaret::setCaretPosition(const PositionWithAffinity& position) {
|
| - // for querying Layer::compositingState()
|
| - // This code is probably correct, since it doesn't occur in a stack that
|
| - // involves updating compositing state.
|
| - DisableCompositingQueryAsserts disabler;
|
| + if (LayoutBlock* block = caretLayoutBlock())
|
| + block->setMayNeedPaintInvalidation();
|
|
|
| - if (Node* node = m_position.anchorNode())
|
| - invalidateCaretRect(node, m_caretLocalRect);
|
| m_position = createVisiblePosition(position).toPositionWithAffinity();
|
| Document* document = nullptr;
|
| if (Node* node = m_position.anchorNode()) {
|
| - invalidateCaretRect(node, m_caretLocalRect);
|
| document = &node->document();
|
| setContext(document);
|
| }
|
| @@ -87,6 +75,9 @@ void DragCaret::setCaretPosition(const PositionWithAffinity& position) {
|
| document->updateStyleAndLayoutTree();
|
| m_caretLocalRect = CaretDisplayItemClient::computeCaretRect(m_position);
|
| }
|
| +
|
| + if (LayoutBlock* block = caretLayoutBlock())
|
| + block->setMayNeedPaintInvalidation();
|
| }
|
|
|
| void DragCaret::nodeChildrenWillBeRemoved(ContainerNode& container) {
|
|
|