OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2005, 2006, 2007, 2008 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 #include "core/editing/TextIterator.h" | 59 #include "core/editing/TextIterator.h" |
60 #include "core/editing/VisibleUnits.h" | 60 #include "core/editing/VisibleUnits.h" |
61 #include "core/editing/WrapContentsInDummySpanCommand.h" | 61 #include "core/editing/WrapContentsInDummySpanCommand.h" |
62 #include "core/editing/htmlediting.h" | 62 #include "core/editing/htmlediting.h" |
63 #include "core/editing/markup.h" | 63 #include "core/editing/markup.h" |
64 #include "core/events/ScopedEventQueue.h" | 64 #include "core/events/ScopedEventQueue.h" |
65 #include "core/frame/LocalFrame.h" | 65 #include "core/frame/LocalFrame.h" |
66 #include "core/html/HTMLBRElement.h" | 66 #include "core/html/HTMLBRElement.h" |
67 #include "core/html/HTMLDivElement.h" | 67 #include "core/html/HTMLDivElement.h" |
68 #include "core/html/HTMLElement.h" | 68 #include "core/html/HTMLElement.h" |
| 69 #include "core/html/HTMLLIElement.h" |
69 #include "core/html/HTMLQuoteElement.h" | 70 #include "core/html/HTMLQuoteElement.h" |
70 #include "core/html/HTMLSpanElement.h" | 71 #include "core/html/HTMLSpanElement.h" |
71 #include "core/rendering/InlineTextBox.h" | 72 #include "core/rendering/InlineTextBox.h" |
72 #include "core/rendering/RenderBlock.h" | 73 #include "core/rendering/RenderBlock.h" |
73 #include "core/rendering/RenderListItem.h" | 74 #include "core/rendering/RenderListItem.h" |
74 #include "core/rendering/RenderText.h" | 75 #include "core/rendering/RenderText.h" |
75 | 76 |
76 namespace blink { | 77 namespace blink { |
77 | 78 |
78 using namespace HTMLNames; | 79 using namespace HTMLNames; |
(...skipping 1218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1297 style->mergeTypingStyle(&document()); | 1298 style->mergeTypingStyle(&document()); |
1298 | 1299 |
1299 RefPtrWillBeRawPtr<ContainerNode> listNode = emptyListItem->parentNode(); | 1300 RefPtrWillBeRawPtr<ContainerNode> listNode = emptyListItem->parentNode(); |
1300 // FIXME: Can't we do something better when the immediate parent wasn't a li
st node? | 1301 // FIXME: Can't we do something better when the immediate parent wasn't a li
st node? |
1301 if (!listNode | 1302 if (!listNode |
1302 || (!isHTMLUListElement(*listNode) && !isHTMLOListElement(*listNode)) | 1303 || (!isHTMLUListElement(*listNode) && !isHTMLOListElement(*listNode)) |
1303 || !listNode->hasEditableStyle() | 1304 || !listNode->hasEditableStyle() |
1304 || listNode == emptyListItem->rootEditableElement()) | 1305 || listNode == emptyListItem->rootEditableElement()) |
1305 return false; | 1306 return false; |
1306 | 1307 |
1307 RefPtrWillBeRawPtr<Element> newBlock = nullptr; | 1308 RefPtrWillBeRawPtr<HTMLElement> newBlock = nullptr; |
1308 if (ContainerNode* blockEnclosingList = listNode->parentNode()) { | 1309 if (ContainerNode* blockEnclosingList = listNode->parentNode()) { |
1309 if (isHTMLLIElement(*blockEnclosingList)) { // listNode is inside anothe
r list item | 1310 if (isHTMLLIElement(*blockEnclosingList)) { // listNode is inside anothe
r list item |
1310 if (visiblePositionAfterNode(*blockEnclosingList) == visiblePosition
AfterNode(*listNode)) { | 1311 if (visiblePositionAfterNode(*blockEnclosingList) == visiblePosition
AfterNode(*listNode)) { |
1311 // If listNode appears at the end of the outer list item, then m
ove listNode outside of this list item | 1312 // If listNode appears at the end of the outer list item, then m
ove listNode outside of this list item |
1312 // e.g. <ul><li>hello <ul><li><br></li></ul> </li></ul> should b
ecome <ul><li>hello</li> <ul><li><br></li></ul> </ul> after this section | 1313 // e.g. <ul><li>hello <ul><li><br></li></ul> </li></ul> should b
ecome <ul><li>hello</li> <ul><li><br></li></ul> </ul> after this section |
1313 // If listNode does NOT appear at the end, then we should consid
er it as a regular paragraph. | 1314 // If listNode does NOT appear at the end, then we should consid
er it as a regular paragraph. |
1314 // e.g. <ul><li> <ul><li><br></li></ul> hello</li></ul> should b
ecome <ul><li> <div><br></div> hello</li></ul> at the end | 1315 // e.g. <ul><li> <ul><li><br></li></ul> hello</li></ul> should b
ecome <ul><li> <div><br></div> hello</li></ul> at the end |
1315 splitElement(toElement(blockEnclosingList), listNode); | 1316 splitElement(toElement(blockEnclosingList), listNode); |
1316 removeNodePreservingChildren(listNode->parentNode()); | 1317 removeNodePreservingChildren(listNode->parentNode()); |
1317 newBlock = createListItemElement(document()); | 1318 newBlock = createListItemElement(document()); |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1498 } | 1499 } |
1499 | 1500 |
1500 void CompositeEditCommand::trace(Visitor* visitor) | 1501 void CompositeEditCommand::trace(Visitor* visitor) |
1501 { | 1502 { |
1502 visitor->trace(m_commands); | 1503 visitor->trace(m_commands); |
1503 visitor->trace(m_composition); | 1504 visitor->trace(m_composition); |
1504 EditCommand::trace(visitor); | 1505 EditCommand::trace(visitor); |
1505 } | 1506 } |
1506 | 1507 |
1507 } // namespace blink | 1508 } // namespace blink |
OLD | NEW |