Changeset 17143 in webkit
- Timestamp:
- Oct 19, 2006 4:21:35 PM (18 years ago)
- Location:
- trunk
- Files:
-
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r17141 r17143 1 2006-10-19 Justin Garcia <justin.garcia@apple.com> 2 3 Reviewed by levi 4 5 <rdar://problem/4447885> 6 API: WebView should have a method something like incrementLeftMarginBy: or indentBy: 7 8 Changed blockquotes in these tests to blockquote class="webkit-indent-blockquote". 9 * editing/execCommand/indent-empty-root-expected.txt: 10 * editing/execCommand/indent-selection-expected.checksum: 11 * editing/execCommand/indent-selection-expected.png: 12 * editing/execCommand/indent-selection-expected.txt: 13 * editing/execCommand/indent-selection.html: 14 * editing/execCommand/nsresponder-indent-expected.txt: 15 * editing/execCommand/nsresponder-outdent.html: 16 * editing/execCommand/outdent-selection-expected.checksum: 17 * editing/execCommand/outdent-selection-expected.png: 18 * editing/execCommand/outdent-selection-expected.txt: 19 20 Ditto. Added a FIXME: 21 * editing/execCommand/outdent-selection.html: 22 1 23 2006-10-19 Geoffrey Garen <ggaren@apple.com> 2 24 -
trunk/LayoutTests/editing/execCommand/indent-empty-root-expected.txt
r16563 r17143 9 9 layer at (0,0) size 800x600 10 10 RenderBlock {HTML} at (0,0) size 800x600 11 RenderBody {BODY} at (8,8) size 784x5 7611 RenderBody {BODY} at (8,8) size 784x584 12 12 RenderBlock {P} at (0,0) size 784x18 13 13 RenderText {#text} at (0,0) size 291x18 14 14 text run at (0,0) width 291: "This tests Indent in an empty editable element." 15 15 RenderBlock {DIV} at (0,34) size 784x18 16 RenderBlock {BLOCKQUOTE} at (40,0) size 7 04x1816 RenderBlock {BLOCKQUOTE} at (40,0) size 744x18 17 17 RenderBR {BR} at (0,0) size 0x18 18 18 caret: position 0 of child 0 {BR} of child 0 {BLOCKQUOTE} of child 3 {DIV} of child 0 {BODY} of child 0 {HTML} of document -
trunk/LayoutTests/editing/execCommand/indent-selection-expected.checksum
r15088 r17143 1 d1074841553c7b04760fab12d8da6e9e 1 12218d2cbdfa11ec4035fb2b5556506c -
trunk/LayoutTests/editing/execCommand/indent-selection-expected.txt
r16237 r17143 11 11 layer at (0,0) size 800x600 12 12 RenderBlock {HTML} at (0,0) size 800x600 13 RenderBody {BODY} at (8,8) size 784x5 7613 RenderBody {BODY} at (8,8) size 784x584 14 14 RenderBlock {DIV} at (0,0) size 784x18 15 15 RenderText {#text} at (0,0) size 362x18 … … 17 17 RenderBlock (anonymous) at (0,18) size 784x18 18 18 RenderBR {BR} at (0,0) size 0x18 19 RenderBlock {DIV} at (0, 52) size 784x24420 RenderBlock {BLOCKQUOTE} at (40,0) size 7 04x7021 RenderBlock (anonymous) at (0,0) size 7 04x3619 RenderBlock {DIV} at (0,36) size 784x194 20 RenderBlock {BLOCKQUOTE} at (40,0) size 744x54 21 RenderBlock (anonymous) at (0,0) size 744x36 22 22 RenderInline {SPAN} at (0,0) size 42x18 23 23 RenderText {#text} at (0,0) size 42x18 … … 26 26 RenderText {#text} at (0,18) size 83x18 27 27 text run at (0,18) width 83: "more Lorem!" 28 RenderBlock {BLOCKQUOTE} at (40, 52) size 624x1828 RenderBlock {BLOCKQUOTE} at (40,36) size 704x18 29 29 RenderText {#text} at (0,0) size 38x18 30 30 text run at (0,0) width 38: "ipsum" 31 RenderBlock (anonymous) at (0, 86) size 784x032 RenderBlock {BLOCKQUOTE} at (40, 86) size 704x5433 RenderBlock {UL} at (0,0) size 7 04x5434 RenderBlock {UL} at (40,0) size 664x5435 RenderListItem {LI} at (40,0) size 6 24x1831 RenderBlock (anonymous) at (0,54) size 784x0 32 RenderBlock {BLOCKQUOTE} at (40,70) size 744x54 33 RenderBlock {UL} at (0,0) size 744x54 34 RenderBlock {UL} at (40,0) size 704x54 35 RenderListItem {LI} at (40,0) size 664x18 36 36 RenderListMarker at (-17,0) size 7x18 37 37 RenderText {#text} at (0,0) size 25x18 38 38 text run at (0,0) width 25: "Foo" 39 RenderListItem {LI} at (40,18) size 6 24x1839 RenderListItem {LI} at (40,18) size 664x18 40 40 RenderListMarker at (-17,0) size 7x18 41 41 RenderText {#text} at (0,0) size 23x18 42 42 text run at (0,0) width 23: "Bar" 43 RenderListItem {LI} at (40,36) size 6 24x1843 RenderListItem {LI} at (40,36) size 664x18 44 44 RenderListMarker at (-17,0) size 7x18 45 45 RenderText {#text} at (0,0) size 25x18 46 46 text run at (0,0) width 25: "Baz" 47 RenderBlock {BLOCKQUOTE} at (40,1 56) size 704x8848 RenderBlock {BLOCKQUOTE} at (40,0) size 624x1847 RenderBlock {BLOCKQUOTE} at (40,140) size 744x54 48 RenderBlock {BLOCKQUOTE} at (40,0) size 704x18 49 49 RenderText {#text} at (0,0) size 37x18 50 50 text run at (0,0) width 37: "Dolor" 51 RenderBlock (anonymous) at (0,34) size 704x54 52 RenderBR {BR} at (0,0) size 0x18 53 RenderText {#text} at (0,18) size 34x18 54 text run at (0,18) width 34: "Sum!" 55 RenderBR {BR} at (34,32) size 0x0 51 RenderBlock (anonymous) at (0,18) size 744x36 52 RenderText {#text} at (0,0) size 34x18 53 text run at (0,0) width 34: "Sum!" 54 RenderBR {BR} at (34,14) size 0x0 56 55 RenderInline {SPAN} at (0,0) size 38x18 57 RenderText {#text} at (0, 36) size 38x1858 text run at (0, 36) width 38: "Thing"59 RenderBlock (anonymous) at (0, 260) size 784x060 selection start: position 0 of child 0 {#text} of child 4{SPAN} of child 3 {BLOCKQUOTE} of child 4 {DIV} of child 0 {BODY} of child 0 {HTML} of document61 selection end: position 5 of child 0 {#text} of child 4{SPAN} of child 3 {BLOCKQUOTE} of child 4 {DIV} of child 0 {BODY} of child 0 {HTML} of document56 RenderText {#text} at (0,18) size 38x18 57 text run at (0,18) width 38: "Thing" 58 RenderBlock (anonymous) at (0,194) size 784x0 59 selection start: position 0 of child 0 {#text} of child 3 {SPAN} of child 3 {BLOCKQUOTE} of child 4 {DIV} of child 0 {BODY} of child 0 {HTML} of document 60 selection end: position 5 of child 0 {#text} of child 3 {SPAN} of child 3 {BLOCKQUOTE} of child 4 {DIV} of child 0 {BODY} of child 0 {HTML} of document -
trunk/LayoutTests/editing/execCommand/indent-selection.html
r15088 r17143 6 6 <span id="item1">Lorem</span><br> 7 7 more Lorem! 8 <blockquote >8 <blockquote class="webkit-indent-blockquote"> 9 9 ipsum<br> 10 10 -
trunk/LayoutTests/editing/execCommand/nsresponder-indent-expected.txt
r17074 r17143 10 10 layer at (0,0) size 800x600 11 11 RenderBlock {HTML} at (0,0) size 800x600 12 RenderBody {BODY} at (8,8) size 784x5 7612 RenderBody {BODY} at (8,8) size 784x584 13 13 RenderBlock {P} at (0,0) size 784x18 14 14 RenderText {#text} at (0,0) size 534x18 … … 16 16 text run at (281,0) width 253: "You should see an indented 'foo' below." 17 17 RenderBlock {DIV} at (0,34) size 784x18 18 RenderBlock {BLOCKQUOTE} at (40,0) size 7 04x1818 RenderBlock {BLOCKQUOTE} at (40,0) size 744x18 19 19 RenderText {#text} at (0,0) size 21x18 20 20 text run at (0,0) width 21: "foo" 21 RenderBlock (anonymous) at (0, 34) size 784x021 RenderBlock (anonymous) at (0,18) size 784x0 22 22 caret: position 0 of child 0 {#text} of child 0 {BLOCKQUOTE} of child 2 {DIV} of child 0 {BODY} of child 0 {HTML} of document -
trunk/LayoutTests/editing/execCommand/nsresponder-outdent.html
r17074 r17143 1 1 <p>This tests the outdent: method. You should see an undented 'foo' below.</p> 2 <div id="div" contenteditable="true"><blockquote >foo</blockquote></div>2 <div id="div" contenteditable="true"><blockquote class="webkit-indent-blockquote">foo</blockquote></div> 3 3 4 4 <script> -
trunk/LayoutTests/editing/execCommand/outdent-selection-expected.checksum
r16237 r17143 1 858f881fc35b5ac91198064d4e2d6d10 1 44aa97836396ad27d8434b00ac1dfdea -
trunk/LayoutTests/editing/execCommand/outdent-selection-expected.txt
r15088 r17143 10 10 RenderBlock {HTML} at (0,0) size 800x600 11 11 RenderBody {BODY} at (8,8) size 784x584 12 RenderBlock {DIV} at (0,0) size 784x18 13 RenderText {#text} at (0,0) size 374x18 14 text run at (0,0) width 374: "This test uses the execCommand to Outdent the text below." 15 RenderBlock (anonymous) at (0,18) size 784x18 12 RenderBlock {DIV} at (0,0) size 784x36 13 RenderText {#text} at (0,0) size 378x18 14 text run at (0,0) width 378: "This test uses the execCommand to Outdent the text below. " 15 RenderInline {B} at (0,0) size 749x36 16 RenderText {#text} at (378,0) size 749x36 17 text run at (378,0) width 371: "This demonstrates a bug: the content in the blockquote" 18 text run at (0,18) width 279: "that's not in a list is pulled out of position." 19 RenderBlock (anonymous) at (0,36) size 784x18 16 20 RenderBR {BR} at (0,0) size 0x18 17 RenderBlock {DIV} at (0, 36) size 784x21021 RenderBlock {DIV} at (0,54) size 784x194 18 22 RenderBlock (anonymous) at (0,0) size 784x54 19 23 RenderInline {SPAN} at (0,0) size 42x18 … … 29 33 text run at (0,36) width 37: "Dolor" 30 34 RenderBR {BR} at (37,50) size 0x0 31 RenderBlock {BLOCKQUOTE} at (40, 70) size 704x5432 RenderBlock (anonymous) at (0,0) size 7 04x5435 RenderBlock {BLOCKQUOTE} at (40,54) size 744x54 36 RenderBlock (anonymous) at (0,0) size 744x54 33 37 RenderText {#text} at (0,0) size 25x18 34 38 text run at (0,0) width 25: "Foo" … … 40 44 text run at (0,36) width 25: "Baz" 41 45 RenderBR {BR} at (25,50) size 0x0 42 RenderBlock {UL} at (0,70) size 7 04x043 RenderBlock (anonymous) at (0,70) size 7 04x044 RenderBlock (anonymous) at (0,1 40) size 784x1846 RenderBlock {UL} at (0,70) size 744x0 47 RenderBlock (anonymous) at (0,70) size 744x0 48 RenderBlock (anonymous) at (0,124) size 784x18 45 49 RenderText {#text} at (0,0) size 82x18 46 50 text run at (0,0) width 82: "Dinner time?" 47 51 RenderBR {BR} at (82,14) size 0x0 48 RenderBlock {UL} at (0,1 74) size 784x049 RenderBlock (anonymous) at (0,1 74) size 784x3652 RenderBlock {UL} at (0,158) size 784x0 53 RenderBlock (anonymous) at (0,158) size 784x36 50 54 RenderText {#text} at (0,0) size 34x18 51 55 text run at (0,0) width 34: "Sum!" -
trunk/LayoutTests/editing/execCommand/outdent-selection.html
r15088 r17143 1 <div id="description"> 2 This test uses the execCommand to Outdent the text below. 3 </div> 1 <div id="description">This test uses the execCommand to Outdent the text below. <b>This demonstrates a bug: the content in the blockquote that's not in a list is pulled out of position.</b></div> 4 2 <br> 5 3 <div contenteditable="true"> 6 4 <span id="item1">Lorem</span><br> 7 5 more Lorem! 8 <blockquote >6 <blockquote class="webkit-indent-blockquote"> 9 7 ipsum<br> 10 8 -
trunk/WebCore/ChangeLog
r17140 r17143 1 2006-10-19 Justin Garcia <justin.garcia@apple.com> 2 3 Reviewed by levi 4 5 <rdar://problem/4447885> 6 API: WebView should have a method something like incrementLeftMarginBy: or indentBy: 7 8 Fixed indent/outdent to only increment the left margin, to match other browsers. 9 Used blockquote class="webkit-indent-blockquote" to do this. Mail can now 10 implement indent/outdent by customizing the appearance of these blockquotes, 11 instead of using a new API. 12 13 * css/html4.css: Added margin: 0 0 0 40px for webkit-indent-blockquotes. 14 * editing/IndentOutdentCommand.cpp: 15 (WebCore::indentBlockquoteString): Added. 16 (WebCore::createIndentBlockquoteElement): Added. 17 (WebCore::isIndentBlockquote): Added. 18 (WebCore::isListOrBlockquote): Added. 19 (WebCore::IndentOutdentCommand::IndentOutdentCommand): 20 (WebCore::IndentOutdentCommand::prepareBlockquoteLevelForInsertion): Fixed 21 a bug in the code that added an extra br if the placeholder collapsed upon insertion. 22 Used the new indentBlockquote checks and enclosing element getters. 23 (WebCore::IndentOutdentCommand::indentRegion): Ditto. 24 (WebCore::IndentOutdentCommand::outdentParagraph): Ditto. Cleaned up the 25 logic to pull the selection out of a list a bit. 26 * editing/htmlediting.cpp: 27 (WebCore::enclosingNodeOfType): Added this generic enclosing element getter. 28 * editing/htmlediting.h: 29 1 30 2006-10-19 Timothy Hatcher <timothy@apple.com> 2 31 -
trunk/WebCore/css/html4.css
r16718 r17143 571 571 } 572 572 573 blockquote.webkit-indent-blockquote { 574 margin: 0 0 0 40px; 575 } 576 577 573 578 /* noscript is handled internally, as it depends on settings */ -
trunk/WebCore/editing/IndentOutdentCommand.cpp
r16563 r17143 41 41 using namespace HTMLNames; 42 42 43 static String indentBlockquoteString() 44 { 45 static String string = "webkit-indent-blockquote"; 46 return string; 47 } 48 49 static PassRefPtr<Element> createIndentBlockquoteElement(Document* document) 50 { 51 RefPtr<Element> indentBlockquoteElement = createElement(document, "blockquote"); 52 indentBlockquoteElement->setAttribute(classAttr, indentBlockquoteString()); 53 return indentBlockquoteElement.release(); 54 } 55 56 static bool isIndentBlockquote(Node* node) 57 { 58 if (!node || !node->hasTagName(blockquoteTag) || !node->isElementNode()) 59 return false; 60 61 Element* elem = static_cast<Element*>(node); 62 return elem->getAttribute(classAttr) == indentBlockquoteString(); 63 } 64 65 static bool isListOrIndentBlockquote(Node* node) 66 { 67 return node && (node->hasTagName(ulTag) || node->hasTagName(olTag) || isIndentBlockquote(node)); 68 } 69 43 70 IndentOutdentCommand::IndentOutdentCommand(Document* document, EIndentType typeOfAction, int marginInPixels) 44 71 : CompositeEditCommand(document), m_typeOfAction(typeOfAction), m_marginInPixels(marginInPixels) 45 72 {} 46 73 47 static Node* enclosingListOrBlockquote(Node* node)48 {49 if (!node)50 return 0;51 Node* root = (node->inDocument()) ? node->rootEditableElement() : highestAncestor(node);52 ASSERT(root);53 for (Node* n = node->parentNode(); n && (n == root || n->isDescendantOf(root)); n = n->parentNode())54 if (n->hasTagName(ulTag) || n->hasTagName(olTag) || n->hasTagName(blockquoteTag))55 return n;56 57 return 0;58 }59 60 74 // This function is a workaround for moveParagraph's tendency to strip blockquotes. It updates lastBlockquote to point to the 61 75 // correct level for the current paragraph, and returns a pointer to a placeholder br where the insertion should be performed. … … 65 79 int lastBlockquoteLevel = 0; 66 80 Node* node = currentParagraph.deepEquivalent().node(); 67 while ((node = enclosingNode WithTag(node, blockquoteTag)))81 while ((node = enclosingNodeOfType(node, &isIndentBlockquote))) 68 82 currentBlockquoteLevel++; 69 83 node = *lastBlockquote; 70 while ((node = enclosingNode WithTag(node, blockquoteTag)))84 while ((node = enclosingNodeOfType(node, &isIndentBlockquote))) 71 85 lastBlockquoteLevel++; 72 86 while (currentBlockquoteLevel > lastBlockquoteLevel) { 73 RefPtr<Node> newBlockquote = create Element(document(), "blockquote");87 RefPtr<Node> newBlockquote = createIndentBlockquoteElement(document()); 74 88 appendNode(newBlockquote.get(), *lastBlockquote); 75 89 *lastBlockquote = newBlockquote.get(); … … 77 91 } 78 92 while (currentBlockquoteLevel < lastBlockquoteLevel) { 79 *lastBlockquote = enclosingNode WithTag(*lastBlockquote, blockquoteTag);93 *lastBlockquote = enclosingNodeOfType(*lastBlockquote, &isIndentBlockquote); 80 94 lastBlockquoteLevel--; 81 95 } 82 96 RefPtr<Node> placeholder = createBreakElement(document()); 83 if ((*lastBlockquote)->firstChild() && !(*lastBlockquote)->lastChild()->hasTagName(brTag)) {84 RefPtr<Node> collapsedPlaceholder = createBreakElement(document());85 appendNode(collapsedPlaceholder.get(), (*lastBlockquote));86 }87 97 appendNode(placeholder.get(), *lastBlockquote); 98 // Add another br before the placeholder if it collapsed. 99 VisiblePosition visiblePos(Position(placeholder.get(), 0)); 100 if (!isStartOfParagraph(visiblePos)) 101 insertNodeBefore(createBreakElement(document()).get(), placeholder.get()); 88 102 return placeholder.get(); 89 103 } … … 117 131 Node* startNode = startOfSelection.deepEquivalent().downstream().node(); 118 132 if (startNode == startNode->rootEditableElement()) { 119 RefPtr<Node> blockquote = create Element(document(), "blockquote");133 RefPtr<Node> blockquote = createIndentBlockquoteElement(document()); 120 134 insertNodeAt(blockquote.get(), startNode, 0); 121 135 RefPtr<Node> placeholder = createBreakElement(document()); … … 159 173 // Create a new blockquote and insert it as a child of the root editable element. We accomplish 160 174 // this by splitting all parents of the current paragraph up to that point. 161 RefPtr<Node> blockquote = create Element(document(), "blockquote");175 RefPtr<Node> blockquote = createIndentBlockquoteElement(document()); 162 176 Node* startNode = startOfParagraph(endOfCurrentParagraph).deepEquivalent().node(); 163 177 Node* startOfNewBlock = splitTreeToNode(startNode, startNode->rootEditableElement()); … … 176 190 VisiblePosition visibleEndOfParagraph = endOfParagraph(visibleStartOfParagraph); 177 191 178 Node* enclosingNode = enclosing ListOrBlockquote(visibleStartOfParagraph.deepEquivalent().node());192 Node* enclosingNode = enclosingNodeOfType(visibleStartOfParagraph.deepEquivalent().node(), &isListOrIndentBlockquote); 179 193 if (!enclosingNode) 180 194 return; 181 195 182 // Handle the list case 183 bool inList = false; 184 InsertListCommand::Type typeOfList; 196 // Use InsertListCommand to remove the selection from the list 185 197 if (enclosingNode->hasTagName(olTag)) { 186 inList = true;187 typeOfList = InsertListCommand::OrderedList;198 applyCommandToComposite(new InsertListCommand(document(), InsertListCommand::OrderedList, "")); 199 return; 188 200 } else if (enclosingNode->hasTagName(ulTag)) { 189 inList = true; 190 typeOfList = InsertListCommand::UnorderedList; 191 } 192 if (inList) { 193 // Use InsertListCommand to remove the selection from the list 194 applyCommandToComposite(new InsertListCommand(document(), typeOfList, "")); 195 return; 196 } 201 applyCommandToComposite(new InsertListCommand(document(), InsertListCommand::UnorderedList, "")); 202 return; 203 } 204 197 205 // The selection is inside a blockquote 198 206 VisiblePosition positionInEnclosingBlock = VisiblePosition(Position(enclosingNode, 0)); -
trunk/WebCore/editing/htmlediting.cpp
r16538 r17143 550 550 } 551 551 552 Node* enclosingNodeOfType(Node* node, bool (*nodeIsOfType)(Node*)) 553 { 554 if (!node) 555 return 0; 556 557 Node* root = highestEditableRoot(Position(node, 0)); 558 if (!root) 559 root = highestAncestor(node); 560 561 for (Node* n = node->parentNode(); n && (n == root || n->isDescendantOf(root)); n = n->parentNode()) 562 if ((*nodeIsOfType)(n)) 563 return n; 564 565 return 0; 566 } 567 552 568 Node* enclosingTableCell(Node* node) 553 569 { -
trunk/WebCore/editing/htmlediting.h
r16026 r17143 104 104 105 105 Node* enclosingNodeWithTag(Node*, const QualifiedName&); 106 Node* enclosingNodeOfType(Node*, bool (*nodeIsOfType)(Node*)); 106 107 Node* enclosingTableCell(Node*); 107 108 Node* enclosingEmptyListItem(const VisiblePosition&);
Note: See TracChangeset
for help on using the changeset viewer.