OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2005 Apple Computer, Inc. All rights reserved. | 2 * Copyright (C) 2005 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 18 matching lines...) Expand all Loading... |
29 #include "HTMLNames.h" | 29 #include "HTMLNames.h" |
30 #include "core/dom/Document.h" | 30 #include "core/dom/Document.h" |
31 #include "core/dom/Element.h" | 31 #include "core/dom/Element.h" |
32 #include "core/dom/NodeTraversal.h" | 32 #include "core/dom/NodeTraversal.h" |
33 #include "core/dom/Text.h" | 33 #include "core/dom/Text.h" |
34 #include "core/editing/EditingBoundary.h" | 34 #include "core/editing/EditingBoundary.h" |
35 #include "core/editing/Editor.h" | 35 #include "core/editing/Editor.h" |
36 #include "core/editing/VisibleUnits.h" | 36 #include "core/editing/VisibleUnits.h" |
37 #include "core/editing/htmlediting.h" | 37 #include "core/editing/htmlediting.h" |
38 #include "core/html/HTMLInputElement.h" | 38 #include "core/html/HTMLInputElement.h" |
| 39 #include "core/html/HTMLTableElement.h" |
39 #include "core/page/Frame.h" | 40 #include "core/page/Frame.h" |
40 #include "core/rendering/RenderTableCell.h" | 41 #include "core/rendering/RenderTableCell.h" |
41 | 42 |
42 namespace WebCore { | 43 namespace WebCore { |
43 | 44 |
44 using namespace HTMLNames; | 45 using namespace HTMLNames; |
45 | 46 |
46 static bool isTableRow(const Node* node) | 47 static bool isTableRow(const Node* node) |
47 { | 48 { |
48 return node && node->hasTagName(trTag); | 49 return node && node->hasTagName(trTag); |
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
436 { | 437 { |
437 if (m_upstreamStart.isNull()) | 438 if (m_upstreamStart.isNull()) |
438 return; | 439 return; |
439 | 440 |
440 int startOffset = m_upstreamStart.deprecatedEditingOffset(); | 441 int startOffset = m_upstreamStart.deprecatedEditingOffset(); |
441 Node* startNode = m_upstreamStart.deprecatedNode(); | 442 Node* startNode = m_upstreamStart.deprecatedNode(); |
442 | 443 |
443 makeStylingElementsDirectChildrenOfEditableRootToPreventStyleLoss(); | 444 makeStylingElementsDirectChildrenOfEditableRootToPreventStyleLoss(); |
444 | 445 |
445 // Never remove the start block unless it's a table, in which case we won't
merge content in. | 446 // Never remove the start block unless it's a table, in which case we won't
merge content in. |
446 if (startNode == m_startBlock && startOffset == 0 && canHaveChildrenForEditi
ng(startNode) && !startNode->hasTagName(tableTag)) { | 447 if (startNode->isSameNode(m_startBlock.get()) && !startOffset && canHaveChil
drenForEditing(startNode) && !isHTMLTableElement(startNode)) { |
447 startOffset = 0; | 448 startOffset = 0; |
448 startNode = NodeTraversal::next(startNode); | 449 startNode = NodeTraversal::next(startNode); |
449 if (!startNode) | 450 if (!startNode) |
450 return; | 451 return; |
451 } | 452 } |
452 | 453 |
453 if (startOffset >= caretMaxOffset(startNode) && startNode->isTextNode()) { | 454 if (startOffset >= caretMaxOffset(startNode) && startNode->isTextNode()) { |
454 Text* text = toText(startNode); | 455 Text* text = toText(startNode); |
455 if (text->length() > (unsigned)caretMaxOffset(startNode)) | 456 if (text->length() > (unsigned)caretMaxOffset(startNode)) |
456 deleteTextFromNode(text, caretMaxOffset(startNode), text->length() -
caretMaxOffset(startNode)); | 457 deleteTextFromNode(text, caretMaxOffset(startNode), text->length() -
caretMaxOffset(startNode)); |
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
827 | 828 |
828 // Normally deletion doesn't preserve the typing style that was present before i
t. For example, | 829 // Normally deletion doesn't preserve the typing style that was present before i
t. For example, |
829 // type a character, Bold, then delete the character and start typing. The Bold
typing style shouldn't | 830 // type a character, Bold, then delete the character and start typing. The Bold
typing style shouldn't |
830 // stick around. Deletion should preserve a typing style that *it* sets, howeve
r. | 831 // stick around. Deletion should preserve a typing style that *it* sets, howeve
r. |
831 bool DeleteSelectionCommand::preservesTypingStyle() const | 832 bool DeleteSelectionCommand::preservesTypingStyle() const |
832 { | 833 { |
833 return m_typingStyle; | 834 return m_typingStyle; |
834 } | 835 } |
835 | 836 |
836 } // namespace WebCore | 837 } // namespace WebCore |
OLD | NEW |