| 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 return isRichlyEditablePosition(m_position.position()); | 65 return isRichlyEditablePosition(m_position.position()); |
| 66 } | 66 } |
| 67 | 67 |
| 68 void DragCaret::setCaretPosition(const PositionWithAffinity& position) { | 68 void DragCaret::setCaretPosition(const PositionWithAffinity& position) { |
| 69 m_position = createVisiblePosition(position).toPositionWithAffinity(); | 69 m_position = createVisiblePosition(position).toPositionWithAffinity(); |
| 70 Document* document = nullptr; | 70 Document* document = nullptr; |
| 71 if (Node* node = m_position.anchorNode()) { | 71 if (Node* node = m_position.anchorNode()) { |
| 72 document = &node->document(); | 72 document = &node->document(); |
| 73 setContext(document); | 73 setContext(document); |
| 74 } | 74 } |
| 75 if (!m_position.isNull()) { | |
| 76 DCHECK(!m_position.isOrphan()); | |
| 77 document->updateStyleAndLayoutTree(); | |
| 78 } | |
| 79 } | 75 } |
| 80 | 76 |
| 81 void DragCaret::nodeChildrenWillBeRemoved(ContainerNode& container) { | 77 void DragCaret::nodeChildrenWillBeRemoved(ContainerNode& container) { |
| 82 if (!hasCaret() || !container.inActiveDocument()) | 78 if (!hasCaret() || !container.inActiveDocument()) |
| 83 return; | 79 return; |
| 84 Node* const anchorNode = m_position.position().anchorNode(); | 80 Node* const anchorNode = m_position.position().anchorNode(); |
| 85 if (!anchorNode || anchorNode == container) | 81 if (!anchorNode || anchorNode == container) |
| 86 return; | 82 return; |
| 87 if (!container.isShadowIncludingInclusiveAncestorOf(anchorNode)) | 83 if (!container.isShadowIncludingInclusiveAncestorOf(anchorNode)) |
| 88 return; | 84 return; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 114 void DragCaret::paintDragCaret(const LocalFrame* frame, | 110 void DragCaret::paintDragCaret(const LocalFrame* frame, |
| 115 GraphicsContext& context, | 111 GraphicsContext& context, |
| 116 const LayoutPoint& paintOffset) const { | 112 const LayoutPoint& paintOffset) const { |
| 117 if (m_position.anchorNode()->document().frame() != frame) | 113 if (m_position.anchorNode()->document().frame() != frame) |
| 118 return; | 114 return; |
| 119 m_displayItemClient->paintCaret(context, paintOffset, | 115 m_displayItemClient->paintCaret(context, paintOffset, |
| 120 DisplayItem::kDragCaret); | 116 DisplayItem::kDragCaret); |
| 121 } | 117 } |
| 122 | 118 |
| 123 } // namespace blink | 119 } // namespace blink |
| OLD | NEW |