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 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 #include "core/editing/VisibleUnits.h" | 45 #include "core/editing/VisibleUnits.h" |
46 #include "core/frame/LocalFrame.h" | 46 #include "core/frame/LocalFrame.h" |
47 #include "core/html/HTMLBRElement.h" | 47 #include "core/html/HTMLBRElement.h" |
48 #include "core/html/HTMLDivElement.h" | 48 #include "core/html/HTMLDivElement.h" |
49 #include "core/html/HTMLLIElement.h" | 49 #include "core/html/HTMLLIElement.h" |
50 #include "core/html/HTMLOListElement.h" | 50 #include "core/html/HTMLOListElement.h" |
51 #include "core/html/HTMLParagraphElement.h" | 51 #include "core/html/HTMLParagraphElement.h" |
52 #include "core/html/HTMLTableCellElement.h" | 52 #include "core/html/HTMLTableCellElement.h" |
53 #include "core/html/HTMLUListElement.h" | 53 #include "core/html/HTMLUListElement.h" |
54 #include "core/rendering/RenderObject.h" | 54 #include "core/rendering/RenderObject.h" |
| 55 #include "core/rendering/RenderTableCell.h" |
55 #include "wtf/Assertions.h" | 56 #include "wtf/Assertions.h" |
56 #include "wtf/StdLibExtras.h" | 57 #include "wtf/StdLibExtras.h" |
57 #include "wtf/text/StringBuilder.h" | 58 #include "wtf/text/StringBuilder.h" |
58 | 59 |
59 using namespace std; | 60 using namespace std; |
60 | 61 |
61 namespace WebCore { | 62 namespace WebCore { |
62 | 63 |
63 using namespace HTMLNames; | 64 using namespace HTMLNames; |
64 | 65 |
(...skipping 698 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
763 RenderObject* renderer = node->renderer(); | 764 RenderObject* renderer = node->renderer(); |
764 if (renderer->isBR()) { | 765 if (renderer->isBR()) { |
765 renderer = renderer->parent(); | 766 renderer = renderer->parent(); |
766 if (!renderer) | 767 if (!renderer) |
767 return false; | 768 return false; |
768 } | 769 } |
769 if (!renderer->isTableCell()) | 770 if (!renderer->isTableCell()) |
770 return false; | 771 return false; |
771 | 772 |
772 // Check that the table cell contains no child renderers except for perhaps
a single <br>. | 773 // Check that the table cell contains no child renderers except for perhaps
a single <br>. |
773 RenderObject* childRenderer = renderer->firstChild(); | 774 RenderObject* childRenderer = toRenderTableCell(renderer)->firstChild(); |
774 if (!childRenderer) | 775 if (!childRenderer) |
775 return true; | 776 return true; |
776 if (!childRenderer->isBR()) | 777 if (!childRenderer->isBR()) |
777 return false; | 778 return false; |
778 return !childRenderer->nextSibling(); | 779 return !childRenderer->nextSibling(); |
779 } | 780 } |
780 | 781 |
781 PassRefPtr<HTMLElement> createDefaultParagraphElement(Document& document) | 782 PassRefPtr<HTMLElement> createDefaultParagraphElement(Document& document) |
782 { | 783 { |
783 switch (document.frame()->editor().defaultParagraphSeparator()) { | 784 switch (document.frame()->editor().defaultParagraphSeparator()) { |
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1112 // if the selection starts just before a paragraph break, skip over it | 1113 // if the selection starts just before a paragraph break, skip over it |
1113 if (isEndOfParagraph(visiblePosition)) | 1114 if (isEndOfParagraph(visiblePosition)) |
1114 return visiblePosition.next().deepEquivalent().downstream(); | 1115 return visiblePosition.next().deepEquivalent().downstream(); |
1115 | 1116 |
1116 // otherwise, make sure to be at the start of the first selected node, | 1117 // otherwise, make sure to be at the start of the first selected node, |
1117 // instead of possibly at the end of the last node before the selection | 1118 // instead of possibly at the end of the last node before the selection |
1118 return visiblePosition.deepEquivalent().downstream(); | 1119 return visiblePosition.deepEquivalent().downstream(); |
1119 } | 1120 } |
1120 | 1121 |
1121 } // namespace WebCore | 1122 } // namespace WebCore |
OLD | NEW |