| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2005, 2006 Apple Computer, Inc. All rights reserved. | 2 * Copyright (C) 2005, 2006 Apple Computer, 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 26 matching lines...) Expand all Loading... |
| 37 #include "core/html/HTMLBRElement.h" | 37 #include "core/html/HTMLBRElement.h" |
| 38 #include "core/html/HTMLElement.h" | 38 #include "core/html/HTMLElement.h" |
| 39 #include "core/html/TextControlElement.h" | 39 #include "core/html/TextControlElement.h" |
| 40 #include "core/layout/LayoutObject.h" | 40 #include "core/layout/LayoutObject.h" |
| 41 #include "core/layout/LayoutText.h" | 41 #include "core/layout/LayoutText.h" |
| 42 | 42 |
| 43 namespace blink { | 43 namespace blink { |
| 44 | 44 |
| 45 using namespace HTMLNames; | 45 using namespace HTMLNames; |
| 46 | 46 |
| 47 InsertLineBreakCommand::InsertLineBreakCommand(Document& document) | 47 InsertLineBreakCommand::InsertLineBreakCommand(Document& document, |
| 48 : CompositeEditCommand(document) {} | 48 CommandSource source) |
| 49 : CompositeEditCommand(document, source) {} |
| 49 | 50 |
| 50 bool InsertLineBreakCommand::preservesTypingStyle() const { | 51 bool InsertLineBreakCommand::preservesTypingStyle() const { |
| 51 return true; | 52 return true; |
| 52 } | 53 } |
| 53 | 54 |
| 54 // Whether we should insert a break element or a '\n'. | 55 // Whether we should insert a break element or a '\n'. |
| 55 bool InsertLineBreakCommand::shouldUseBreakElement( | 56 bool InsertLineBreakCommand::shouldUseBreakElement( |
| 56 const Position& insertionPos) { | 57 const Position& insertionPos) { |
| 57 // An editing position like [input, 0] actually refers to the position before | 58 // An editing position like [input, 0] actually refers to the position before |
| 58 // the input element, and in that case we need to check the input element's | 59 // the input element, and in that case we need to check the input element's |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 // block. | 224 // block. |
| 224 setEndingSelection(SelectionInDOMTree::Builder() | 225 setEndingSelection(SelectionInDOMTree::Builder() |
| 225 .collapse(endingSelection().end()) | 226 .collapse(endingSelection().end()) |
| 226 .build()); | 227 .build()); |
| 227 } | 228 } |
| 228 | 229 |
| 229 rebalanceWhitespace(); | 230 rebalanceWhitespace(); |
| 230 } | 231 } |
| 231 | 232 |
| 232 } // namespace blink | 233 } // namespace blink |
| OLD | NEW |