Changeset 62537 in webkit
- Timestamp:
- Jul 6, 2010 1:16:50 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r62534 r62537 1 2010-07-06 Eric Seidel <eric@webkit.org> 2 3 Reviewed by Adam Barth. 4 5 Implement bookmarking for HTML5 Adoption Agency algorithm 6 https://bugs.webkit.org/show_bug.cgi?id=41659 7 8 Added 3 new adoption tests because the suite didn't 9 cover all the bookmarking cases. 10 11 * html5lib/runner-expected-html5.txt: 12 - Fixes tests! 13 * html5lib/resources/adoption01.dat 14 1 15 2010-07-06 Nikolas Zimmermann <nzimmermann@rim.com> 2 16 -
trunk/LayoutTests/html5lib/resources/adoption01.dat
r62468 r62537 83 83 | "3" 84 84 | <table> 85 86 #data 87 <b><b><a><p></a> 88 #errors 89 #document 90 | <html> 91 | <head> 92 | <body> 93 | <b> 94 | <b> 95 | <a> 96 | <p> 97 | <a> 98 99 #data 100 <b><a><b><p></a> 101 #errors 102 #document 103 | <html> 104 | <head> 105 | <body> 106 | <b> 107 | <a> 108 | <b> 109 | <b> 110 | <p> 111 | <a> 112 113 #data 114 <a><b><b><p></a> 115 #errors 116 #document 117 | <html> 118 | <head> 119 | <body> 120 | <a> 121 | <b> 122 | <b> 123 | <b> 124 | <b> 125 | <p> 126 | <a> -
trunk/LayoutTests/html5lib/runner-expected-html5.txt
r62533 r62537 14 14 33 15 15 50 16 5117 16 56 18 6019 6120 7221 7322 7423 7524 7625 17 78 26 18 79 … … 299 291 | "--> EOF" 300 292 301 Test 51 of 113 in resources/tests1.dat failed. Input:302 <b><p></b>TEST303 Got:304 | <html>305 | <head>306 | <body>307 | <b>308 | <p>309 | <b>310 | "TEST"311 Expected:312 | <html>313 | <head>314 | <body>315 | <b>316 | <p>317 | <b>318 | "TEST"319 320 293 Test 56 of 113 in resources/tests1.dat failed. Input: 321 294 <font><p>hello<b>cruel</font>world … … 329 302 | "hello" 330 303 | <b> 331 | "cruelworld" 304 | "cruel" 305 | "world" 332 306 Expected: 333 307 | <html> … … 342 316 | <b> 343 317 | "world" 344 345 Test 60 of 113 in resources/tests1.dat failed. Input:346 <b>A<cite>B<div>C</b>D347 Got:348 | <html>349 | <head>350 | <body>351 | <b>352 | "A"353 | <cite>354 | "B"355 | <div>356 | <b>357 | "CD"358 Expected:359 | <html>360 | <head>361 | <body>362 | <b>363 | "A"364 | <cite>365 | "B"366 | <div>367 | <b>368 | "C"369 | "D"370 371 Test 61 of 113 in resources/tests1.dat failed. Input:372 <cite><b><cite><i><cite><i><cite><i><div>X</b>TEST373 Got:374 | <html>375 | <head>376 | <body>377 | <cite>378 | <b>379 | <cite>380 | <i>381 | <cite>382 | <i>383 | <cite>384 | <i>385 | <i>386 | <i>387 | <i>388 | <div>389 | <b>390 | "XTEST"391 Expected:392 | <html>393 | <head>394 | <body>395 | <cite>396 | <b>397 | <cite>398 | <i>399 | <cite>400 | <i>401 | <cite>402 | <i>403 | <i>404 | <i>405 | <i>406 | <div>407 | <b>408 | "X"409 | "TEST"410 411 Test 72 of 113 in resources/tests1.dat failed. Input:412 <DIV> abc <B> def <I> ghi <P> jkl </B> mno413 Got:414 | <html>415 | <head>416 | <body>417 | <div>418 | " abc "419 | <b>420 | " def "421 | <i>422 | " ghi "423 | <i>424 | <p>425 | <b>426 | " jkl mno"427 Expected:428 | <html>429 | <head>430 | <body>431 | <div>432 | " abc "433 | <b>434 | " def "435 | <i>436 | " ghi "437 | <i>438 | <p>439 | <b>440 | " jkl "441 | " mno"442 443 Test 73 of 113 in resources/tests1.dat failed. Input:444 <DIV> abc <B> def <I> ghi <P> jkl </B> mno </I>445 Got:446 | <html>447 | <head>448 | <body>449 | <div>450 | " abc "451 | <b>452 | " def "453 | <i>454 | " ghi "455 | <i>456 | <p>457 | <i>458 | <b>459 | " jkl mno "460 Expected:461 | <html>462 | <head>463 | <body>464 | <div>465 | " abc "466 | <b>467 | " def "468 | <i>469 | " ghi "470 | <i>471 | <p>472 | <i>473 | <b>474 | " jkl "475 | " mno "476 477 Test 74 of 113 in resources/tests1.dat failed. Input:478 <DIV> abc <B> def <I> ghi <P> jkl </B> mno </I> pqr479 Got:480 | <html>481 | <head>482 | <body>483 | <div>484 | " abc "485 | <b>486 | " def "487 | <i>488 | " ghi "489 | <i>490 | <p>491 | <i>492 | <b>493 | " jkl mno pqr"494 Expected:495 | <html>496 | <head>497 | <body>498 | <div>499 | " abc "500 | <b>501 | " def "502 | <i>503 | " ghi "504 | <i>505 | <p>506 | <i>507 | <b>508 | " jkl "509 | " mno "510 | " pqr"511 512 Test 75 of 113 in resources/tests1.dat failed. Input:513 <DIV> abc <B> def <I> ghi <P> jkl </B> mno </I> pqr </P>514 Got:515 | <html>516 | <head>517 | <body>518 | <div>519 | " abc "520 | <b>521 | " def "522 | <i>523 | " ghi "524 | <i>525 | <p>526 | <i>527 | <b>528 | " jkl mno pqr "529 Expected:530 | <html>531 | <head>532 | <body>533 | <div>534 | " abc "535 | <b>536 | " def "537 | <i>538 | " ghi "539 | <i>540 | <p>541 | <i>542 | <b>543 | " jkl "544 | " mno "545 | " pqr "546 547 Test 76 of 113 in resources/tests1.dat failed. Input:548 <DIV> abc <B> def <I> ghi <P> jkl </B> mno </I> pqr </P> stu549 Got:550 | <html>551 | <head>552 | <body>553 | <div>554 | " abc "555 | <b>556 | " def "557 | <i>558 | " ghi "559 | <i>560 | <p>561 | <i>562 | <b>563 | " jkl mno pqr "564 | " stu"565 Expected:566 | <html>567 | <head>568 | <body>569 | <div>570 | " abc "571 | <b>572 | " def "573 | <i>574 | " ghi "575 | <i>576 | <p>577 | <i>578 | <b>579 | " jkl "580 | " mno "581 | " pqr "582 | " stu"583 318 584 319 Test 78 of 113 in resources/tests1.dat failed. Input: … … 2162 1897 6 2163 1898 7 2164 82165 92166 1899 2167 1900 Test 1 of 9 in resources/tests8.dat failed. Input: … … 2304 2037 | "x" 2305 2038 | <table> 2306 2307 Test 8 of 9 in resources/tests8.dat failed. Input:2308 <b>a<div></div><div></b>y2309 Got:2310 | <html>2311 | <head>2312 | <body>2313 | <b>2314 | "a"2315 | <div>2316 | <div>2317 | <b>2318 | "y"2319 Expected:2320 | <html>2321 | <head>2322 | <body>2323 | <b>2324 | "a"2325 | <div>2326 | <div>2327 | <b>2328 | "y"2329 2330 Test 9 of 9 in resources/tests8.dat failed. Input:2331 <a><div><p></a>2332 Got:2333 | <html>2334 | <head>2335 | <body>2336 | <a>2337 | <div>2338 | <a>2339 | <p>2340 Expected:2341 | <html>2342 | <head>2343 | <body>2344 | <a>2345 | <div>2346 | <a>2347 | <p>2348 | <a>2349 2039 resources/tests9.dat: 2350 2040 1 … … 4745 4435 4746 4436 resources/adoption01.dat: 4747 24748 4437 3 4749 4438 4 … … 4751 4440 6 4752 4441 4753 Test 2 of 6 in resources/adoption01.dat failed. Input: 4754 <a>1<p>2</a>3</p> 4755 Got: 4756 | <html> 4757 | <head> 4758 | <body> 4759 | <a> 4760 | "1" 4761 | <p> 4762 | <a> 4763 | "23" 4764 Expected: 4765 | <html> 4766 | <head> 4767 | <body> 4768 | <a> 4769 | "1" 4770 | <p> 4771 | <a> 4772 | "2" 4773 | "3" 4774 4775 Test 3 of 6 in resources/adoption01.dat failed. Input: 4442 Test 3 of 9 in resources/adoption01.dat failed. Input: 4776 4443 <a>1<button>2</a>3</button> 4777 4444 Got: … … 4793 4460 | "3" 4794 4461 4795 Test 4 of 6in resources/adoption01.dat failed. Input:4462 Test 4 of 9 in resources/adoption01.dat failed. Input: 4796 4463 <a>1<b>2</a>3</b> 4797 4464 Got: … … 4815 4482 | "3" 4816 4483 4817 Test 5 of 6in resources/adoption01.dat failed. Input:4484 Test 5 of 9 in resources/adoption01.dat failed. Input: 4818 4485 <a>1<div>2<div>3</a>4</div>5</div> 4819 4486 Got: … … 4826 4493 | <a> 4827 4494 | "2" 4828 | <div> 4829 | "34" 4495 | <div> 4496 | <a> 4497 | "3" 4498 | "4" 4830 4499 | "5" 4831 4500 Expected: … … 4844 4513 | "5" 4845 4514 4846 Test 6 of 6in resources/adoption01.dat failed. Input:4515 Test 6 of 9 in resources/adoption01.dat failed. Input: 4847 4516 <table><a>1<p>2</a>3</p> 4848 4517 Got: … … 4852 4521 | <p> 4853 4522 | <a> 4854 | "23" 4523 | "2" 4524 | "3" 4855 4525 | <table> 4856 4526 | <a> -
trunk/WebCore/ChangeLog
r62536 r62537 1 2010-07-06 Eric Seidel <eric@webkit.org> 2 3 Reviewed by Adam Barth. 4 5 Implement bookmarking for HTML5 Adoption Agency algorithm 6 https://bugs.webkit.org/show_bug.cgi?id=41659 7 8 Was easier than I expected it to be. 9 Fixes a bunch of html5lib/runner.html tests. 10 11 * html/HTMLFormattingElementList.cpp: 12 (WebCore::HTMLFormattingElementList::bookmarkFor): 13 (WebCore::HTMLFormattingElementList::insertAt): 14 * html/HTMLFormattingElementList.h: 15 (WebCore::HTMLFormattingElementList::Bookmark::Bookmark): 16 (WebCore::HTMLFormattingElementList::Bookmark::moveToAfter): 17 (WebCore::HTMLFormattingElementList::Bookmark::elementBefore): 18 (WebCore::HTMLFormattingElementList::Bookmark::elementAfter): 19 * html/HTMLTreeBuilder.cpp: 20 (WebCore::HTMLTreeBuilder::callTheAdoptionAgency): 21 1 22 2010-07-06 Adam Barth <abarth@webkit.org> 2 23 -
trunk/WebCore/html/HTMLFormattingElementList.cpp
r62469 r62537 110 110 } 111 111 112 HTMLFormattingElementList::Bookmark HTMLFormattingElementList::bookmarkFor(Element* element) 113 { 114 size_t index = m_entries.find(element); 115 ASSERT(index != notFound); 116 Element* elementBefore = (index > 1) ? m_entries[index - 1].element() : 0; 117 Element* elementAfter = (index < m_entries.size() - 1) ? m_entries[index + 1].element() : 0; 118 return Bookmark(elementBefore, elementAfter); 119 } 120 121 void HTMLFormattingElementList::insertAt(Element* element, const Bookmark& bookmark) 122 { 123 size_t beforeIndex = notFound; 124 if (bookmark.elementBefore()) { 125 beforeIndex = m_entries.find(bookmark.elementBefore()); 126 ASSERT(beforeIndex != notFound); 127 } 128 size_t afterIndex = notFound; 129 if (bookmark.elementAfter()) { 130 afterIndex = m_entries.find(bookmark.elementAfter()); 131 ASSERT(afterIndex != notFound); 132 } 133 134 if (!bookmark.elementBefore()) { 135 if (bookmark.elementAfter()) 136 ASSERT(!afterIndex); 137 m_entries.prepend(element); 138 } else { 139 if (bookmark.elementAfter()) { 140 // Bookmarks are not general purpose. They're only for the Adoption 141 // Agency. Assume the bookmarked element was already removed. 142 ASSERT(beforeIndex + 1 == afterIndex); 143 } 144 m_entries.insert(beforeIndex + 1, element); 145 } 146 } 147 112 148 void HTMLFormattingElementList::append(Element* element) 113 149 { -
trunk/WebCore/html/HTMLFormattingElementList.h
r62469 r62537 65 65 }; 66 66 67 class Bookmark { 68 public: 69 Bookmark(Element* before, Element* after) 70 : m_before(before) 71 , m_after(after) 72 { 73 } 74 75 void moveToAfter(Element* before) 76 { 77 m_before = before; 78 m_after = 0; 79 } 80 81 Element* elementBefore() const { return m_before; } 82 Element* elementAfter() const { return m_after; } 83 84 private: 85 Element* m_before; 86 Element* m_after; 87 }; 88 67 89 bool isEmpty() const { return !size(); } 68 90 size_t size() const { return m_entries.size(); } … … 74 96 void append(Element*); 75 97 void remove(Element*); 98 99 Bookmark bookmarkFor(Element*); 100 void insertAt(Element*, const Bookmark&); 76 101 77 102 void appendMarker(); -
trunk/WebCore/html/HTMLTreeBuilder.cpp
r62536 r62537 1177 1177 Element* commonAncestor = formattingElementRecord->next()->element(); 1178 1178 // 5. 1179 notImplemented(); // bookmark?1179 HTMLFormattingElementList::Bookmark bookmark = m_activeFormattingElements.bookmarkFor(formattingElement); 1180 1180 // 6. 1181 1181 HTMLElementStack::ElementRecord* node = furthestBlock; … … 1196 1196 if (node == formattingElementRecord) 1197 1197 break; 1198 // 6.41199 if (lastNode == furthestBlock)1200 notImplemented(); // move bookmark.1201 1198 // 6.5 1202 1199 // FIXME: We're supposed to save the original token in the entry. … … 1208 1205 nodeEntry->replaceElement(newElement.get()); 1209 1206 node->replaceElement(newElement.release()); 1207 // 6.4 -- Intentionally out of order to handle the case where node 1208 // was replaced in 6.5. 1209 // http://www.w3.org/Bugs/Public/show_bug.cgi?id=10096 1210 if (lastNode == furthestBlock) 1211 bookmark.moveToAfter(node->element()); 1210 1212 // 6.6 1211 1213 // Use appendChild instead of parserAddChild to handle possible reparenting. … … 1237 1239 // 11 1238 1240 m_activeFormattingElements.remove(formattingElement); 1239 notImplemented(); // insert new element at bookmark1241 m_activeFormattingElements.insertAt(newElement.get(), bookmark); 1240 1242 // 12 1241 1243 m_openElements.remove(formattingElement);
Note: See TracChangeset
for help on using the changeset viewer.