In the test page below, the node "llinker0" cannot be focused. ============================================== <html> <body> <a href="#">This is an element</a><br> <div> <a href="#" name="llinker0" id=llinker0> <img src="images/btn.gif" height="42" width="76" alt="llinker0" border="0"/> </a> </div> <div> <a href="#">This is an element</a><br> </div> <a href="#">This is an element</a><br> <a href="#" name="llinker1" id=llinker1> <img src="images/btn.gif" height="42" width="76" alt="llinker1" border="0"/> </a><br> <a href="#">This is an element</a><br> </body> </html> ==============================================
I traced the code, and found that Node::getRect() can return correct rect, however ContainerNode::getRect() cannot. And here is a workaround: svn diff WebCore/page/SpatialNavigation.cpp Index: WebCore/page/SpatialNavigation.cpp =================================================================== --- WebCore/page/SpatialNavigation.cpp (revision 70438) +++ WebCore/page/SpatialNavigation.cpp (working copy) @@ -105,7 +105,8 @@ { ASSERT(render && render->node()); - IntRect rect = render->node()->getRect(); + //IntRect rect = render->node()->getRect(); + IntRect rect = render->absoluteBoundingBoxRect(); // In cases when the |render|'s associated node is in a scrollable inner // document, we only consider its scrollOffset if it is not offscreen.
This test is still failing, even with the patch at https://bugs.webkit.org/show_bug.cgi?id=49382. I am going to look at this failure.
If you remove all the white spaces after the image, getRect() does return the image size correctly. The problem starts at ContainerNode::getLowerRightCorner(). It gets confused by the empty white space, with size 0, and thinks that there is no content at all.
I can reproduce this problem with this code: <html> <body> <a href="#">This is an element</a><br> <div> <a href="#"><img src="images/btn.gif" height="42" width="76"/> </a> </div> <a href="#">This is an element</a> </body> </html> If I remove the space between the image and the closing anchor, the problem goes away, and getRect() on the anchor element reports the correct size. Dave, would you have some ideas about what is going on? thanks!
Created attachment 73779 [details] Patch ContainerNode::getLowerRightCorner() assumes that the lowest right corner of its last child is its own lowest right corner. If that child is an empty text node after an image, it does not have size and position information, so we should go to the previous child.
Comment on attachment 73779 [details] Patch r=me
Comment on attachment 73779 [details] Patch Clearing flags on attachment: 73779 Committed r71956: <http://trac.webkit.org/changeset/71956>
All reviewed patches have been landed. Closing bug.
http://trac.webkit.org/changeset/71956 might have broken Leopard Intel Release (Tests) The following tests are not passing: svg/dom/SVGScriptElement/script-load-and-error-events.svg
(In reply to comment #9) > http://trac.webkit.org/changeset/71956 might have broken Leopard Intel Release (Tests) > The following tests are not passing: > svg/dom/SVGScriptElement/script-load-and-error-events.svg All tests on Leopard Intel Release are passing after http://trac.webkit.org/changeset/71956, so I guess it was a false alarm.
(In reply to comment #10) > (In reply to comment #9) > > http://trac.webkit.org/changeset/71956 might have broken Leopard Intel Release (Tests) > > The following tests are not passing: > > svg/dom/SVGScriptElement/script-load-and-error-events.svg > > All tests on Leopard Intel Release are passing after http://trac.webkit.org/changeset/71956, so I guess it was a false alarm. I meant http://trac.webkit.org/changeset/71958 :-)
Re-opened by mistake. Sorry.