| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2005, 2006, 2007 Apple, Inc. All rights reserved. | 2 * Copyright (C) 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 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 #include "core/frame/LocalFrame.h" | 32 #include "core/frame/LocalFrame.h" |
| 33 #include "core/layout/LayoutText.h" | 33 #include "core/layout/LayoutText.h" |
| 34 | 34 |
| 35 namespace blink { | 35 namespace blink { |
| 36 | 36 |
| 37 EditCommand::EditCommand(Document& document) | 37 EditCommand::EditCommand(Document& document) |
| 38 : m_document(&document), m_parent(nullptr) { | 38 : m_document(&document), m_parent(nullptr) { |
| 39 DCHECK(m_document); | 39 DCHECK(m_document); |
| 40 DCHECK(m_document->frame()); | 40 DCHECK(m_document->frame()); |
| 41 setStartingSelection(m_document->frame()->selection().selection()); | 41 setStartingSelection(m_document->frame()->selection().selection()); |
| 42 setEndingSelection(m_startingSelection); | 42 setEndingVisibleSelection(m_startingSelection); |
| 43 } | 43 } |
| 44 | 44 |
| 45 EditCommand::~EditCommand() {} | 45 EditCommand::~EditCommand() {} |
| 46 | 46 |
| 47 InputEvent::InputType EditCommand::inputType() const { | 47 InputEvent::InputType EditCommand::inputType() const { |
| 48 return InputEvent::InputType::None; | 48 return InputEvent::InputType::None; |
| 49 } | 49 } |
| 50 | 50 |
| 51 String EditCommand::textDataForInputEvent() const { | 51 String EditCommand::textDataForInputEvent() const { |
| 52 return nullAtom; | 52 return nullAtom; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 72 } | 72 } |
| 73 | 73 |
| 74 // TODO(yosin): We will make |SelectionInDOMTree| version of | 74 // TODO(yosin): We will make |SelectionInDOMTree| version of |
| 75 // |setEndingSelection()| as primary function instead of wrapper, once | 75 // |setEndingSelection()| as primary function instead of wrapper, once |
| 76 // |EditCommand| holds other than |VisibleSelection|. | 76 // |EditCommand| holds other than |VisibleSelection|. |
| 77 void EditCommand::setEndingSelection(const SelectionInDOMTree& selection) { | 77 void EditCommand::setEndingSelection(const SelectionInDOMTree& selection) { |
| 78 // TODO(editing-dev): The use of | 78 // TODO(editing-dev): The use of |
| 79 // updateStyleAndLayoutIgnorePendingStylesheets | 79 // updateStyleAndLayoutIgnorePendingStylesheets |
| 80 // needs to be audited. See http://crbug.com/590369 for more details. | 80 // needs to be audited. See http://crbug.com/590369 for more details. |
| 81 document().updateStyleAndLayoutIgnorePendingStylesheets(); | 81 document().updateStyleAndLayoutIgnorePendingStylesheets(); |
| 82 setEndingSelection(createVisibleSelection(selection)); | 82 setEndingVisibleSelection(createVisibleSelection(selection)); |
| 83 } | 83 } |
| 84 | 84 |
| 85 // TODO(yosin): We will make |SelectionInDOMTree| version of | 85 // TODO(yosin): We will make |SelectionInDOMTree| version of |
| 86 // |setEndingSelection()| as primary function instead of wrapper. | 86 // |setEndingSelection()| as primary function instead of wrapper. |
| 87 void EditCommand::setEndingSelection(const VisibleSelection& selection) { | 87 void EditCommand::setEndingVisibleSelection(const VisibleSelection& selection) { |
| 88 for (EditCommand* command = this; command; command = command->m_parent) { | 88 for (EditCommand* command = this; command; command = command->m_parent) { |
| 89 if (EditCommandComposition* composition = compositionIfPossible(command)) { | 89 if (EditCommandComposition* composition = compositionIfPossible(command)) { |
| 90 DCHECK(command->isTopLevelCommand()); | 90 DCHECK(command->isTopLevelCommand()); |
| 91 composition->setEndingSelection(selection); | 91 composition->setEndingSelection(selection); |
| 92 } | 92 } |
| 93 command->m_endingSelection = selection; | 93 command->m_endingSelection = selection; |
| 94 } | 94 } |
| 95 } | 95 } |
| 96 | 96 |
| 97 bool EditCommand::isRenderedCharacter(const Position& position) { | 97 bool EditCommand::isRenderedCharacter(const Position& position) { |
| (...skipping 28 matching lines...) Expand all Loading... |
| 126 } | 126 } |
| 127 | 127 |
| 128 DEFINE_TRACE(EditCommand) { | 128 DEFINE_TRACE(EditCommand) { |
| 129 visitor->trace(m_document); | 129 visitor->trace(m_document); |
| 130 visitor->trace(m_startingSelection); | 130 visitor->trace(m_startingSelection); |
| 131 visitor->trace(m_endingSelection); | 131 visitor->trace(m_endingSelection); |
| 132 visitor->trace(m_parent); | 132 visitor->trace(m_parent); |
| 133 } | 133 } |
| 134 | 134 |
| 135 } // namespace blink | 135 } // namespace blink |
| OLD | NEW |