| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2004, 2005, 2006, 2007 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 |
| 11 * documentation and/or other materials provided with the distribution. | 11 * documentation and/or other materials provided with the distribution. |
| 12 * | 12 * |
| 13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY | 13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY |
| 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
| 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR | 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR |
| 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
| 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
| 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
| 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 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/EditingUtilities.h" | 26 #include "core/editing/EditingUtilities.h" |
| 27 | 27 |
| 28 #include "core/HTMLElementFactory.h" | 28 #include "core/HTMLElementFactory.h" |
| 29 #include "core/HTMLNames.h" | 29 #include "core/HTMLNames.h" |
| 30 #include "core/InputTypeNames.h" |
| 30 #include "core/clipboard/DataObject.h" | 31 #include "core/clipboard/DataObject.h" |
| 31 #include "core/dom/Document.h" | 32 #include "core/dom/Document.h" |
| 32 #include "core/dom/ElementTraversal.h" | 33 #include "core/dom/ElementTraversal.h" |
| 33 #include "core/dom/NodeComputedStyle.h" | 34 #include "core/dom/NodeComputedStyle.h" |
| 34 #include "core/dom/Range.h" | 35 #include "core/dom/Range.h" |
| 35 #include "core/dom/Text.h" | 36 #include "core/dom/Text.h" |
| 36 #include "core/dom/shadow/ShadowRoot.h" | 37 #include "core/dom/shadow/ShadowRoot.h" |
| 37 #include "core/editing/EditingStrategy.h" | 38 #include "core/editing/EditingStrategy.h" |
| 38 #include "core/editing/Editor.h" | 39 #include "core/editing/Editor.h" |
| 39 #include "core/editing/PlainTextRange.h" | 40 #include "core/editing/PlainTextRange.h" |
| 40 #include "core/editing/PositionIterator.h" | 41 #include "core/editing/PositionIterator.h" |
| 41 #include "core/editing/VisiblePosition.h" | 42 #include "core/editing/VisiblePosition.h" |
| 42 #include "core/editing/VisibleSelection.h" | 43 #include "core/editing/VisibleSelection.h" |
| 43 #include "core/editing/VisibleUnits.h" | 44 #include "core/editing/VisibleUnits.h" |
| 44 #include "core/editing/iterators/TextIterator.h" | 45 #include "core/editing/iterators/TextIterator.h" |
| 45 #include "core/editing/serializers/HTMLInterchange.h" | 46 #include "core/editing/serializers/HTMLInterchange.h" |
| 46 #include "core/editing/state_machines/BackspaceStateMachine.h" | 47 #include "core/editing/state_machines/BackspaceStateMachine.h" |
| 47 #include "core/editing/state_machines/BackwardGraphemeBoundaryStateMachine.h" | 48 #include "core/editing/state_machines/BackwardGraphemeBoundaryStateMachine.h" |
| 48 #include "core/editing/state_machines/ForwardGraphemeBoundaryStateMachine.h" | 49 #include "core/editing/state_machines/ForwardGraphemeBoundaryStateMachine.h" |
| 49 #include "core/frame/FrameView.h" | 50 #include "core/frame/FrameView.h" |
| 50 #include "core/frame/LocalFrame.h" | 51 #include "core/frame/LocalFrame.h" |
| 51 #include "core/frame/UseCounter.h" | 52 #include "core/frame/UseCounter.h" |
| 52 #include "core/html/HTMLBRElement.h" | 53 #include "core/html/HTMLBRElement.h" |
| 53 #include "core/html/HTMLDivElement.h" | 54 #include "core/html/HTMLDivElement.h" |
| 55 #include "core/html/HTMLInputElement.h" |
| 54 #include "core/html/HTMLLIElement.h" | 56 #include "core/html/HTMLLIElement.h" |
| 55 #include "core/html/HTMLParagraphElement.h" | 57 #include "core/html/HTMLParagraphElement.h" |
| 56 #include "core/html/HTMLSpanElement.h" | 58 #include "core/html/HTMLSpanElement.h" |
| 57 #include "core/html/HTMLTableCellElement.h" | 59 #include "core/html/HTMLTableCellElement.h" |
| 58 #include "core/html/HTMLUListElement.h" | 60 #include "core/html/HTMLUListElement.h" |
| 59 #include "core/layout/LayoutObject.h" | 61 #include "core/layout/LayoutObject.h" |
| 60 #include "core/layout/LayoutTableCell.h" | 62 #include "core/layout/LayoutTableCell.h" |
| 61 #include "platform/clipboard/ClipboardMimeTypes.h" | 63 #include "platform/clipboard/ClipboardMimeTypes.h" |
| 62 #include "wtf/Assertions.h" | 64 #include "wtf/Assertions.h" |
| 63 #include "wtf/StdLibExtras.h" | 65 #include "wtf/StdLibExtras.h" |
| (...skipping 2002 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2066 // if the selection starts just before a paragraph break, skip over it | 2068 // if the selection starts just before a paragraph break, skip over it |
| 2067 if (isEndOfParagraph(visiblePosition)) | 2069 if (isEndOfParagraph(visiblePosition)) |
| 2068 return mostForwardCaretPosition( | 2070 return mostForwardCaretPosition( |
| 2069 nextPositionOf(visiblePosition).deepEquivalent()); | 2071 nextPositionOf(visiblePosition).deepEquivalent()); |
| 2070 | 2072 |
| 2071 // otherwise, make sure to be at the start of the first selected node, | 2073 // otherwise, make sure to be at the start of the first selected node, |
| 2072 // instead of possibly at the end of the last node before the selection | 2074 // instead of possibly at the end of the last node before the selection |
| 2073 return mostForwardCaretPosition(visiblePosition.deepEquivalent()); | 2075 return mostForwardCaretPosition(visiblePosition.deepEquivalent()); |
| 2074 } | 2076 } |
| 2075 | 2077 |
| 2078 bool isInPasswordField(const Position& position) { |
| 2079 TextControlElement* textControl = enclosingTextControl(position); |
| 2080 return isHTMLInputElement(textControl) && |
| 2081 toHTMLInputElement(textControl)->type() == InputTypeNames::password; |
| 2082 } |
| 2083 |
| 2076 bool isTextSecurityNode(const Node* node) { | 2084 bool isTextSecurityNode(const Node* node) { |
| 2077 return node && node->layoutObject() && | 2085 return node && node->layoutObject() && |
| 2078 node->layoutObject()->style()->textSecurity() != TSNONE; | 2086 node->layoutObject()->style()->textSecurity() != TSNONE; |
| 2079 } | 2087 } |
| 2080 | 2088 |
| 2081 const StaticRangeVector* targetRangesForInputEvent(const Node& node) { | 2089 const StaticRangeVector* targetRangesForInputEvent(const Node& node) { |
| 2082 if (!hasRichlyEditableStyle(node)) | 2090 if (!hasRichlyEditableStyle(node)) |
| 2083 return nullptr; | 2091 return nullptr; |
| 2084 Range* range = createRange( | 2092 Range* range = createRange( |
| 2085 firstEphemeralRangeOf(node.document() | 2093 firstEphemeralRangeOf(node.document() |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2171 return InputType::DeleteWordBackward; | 2179 return InputType::DeleteWordBackward; |
| 2172 if (granularity == LineBoundary) | 2180 if (granularity == LineBoundary) |
| 2173 return InputType::DeleteLineBackward; | 2181 return InputType::DeleteLineBackward; |
| 2174 return InputType::DeleteContentBackward; | 2182 return InputType::DeleteContentBackward; |
| 2175 default: | 2183 default: |
| 2176 return InputType::None; | 2184 return InputType::None; |
| 2177 } | 2185 } |
| 2178 } | 2186 } |
| 2179 | 2187 |
| 2180 } // namespace blink | 2188 } // namespace blink |
| OLD | NEW |