Changeset 61250 in webkit


Ignore:
Timestamp:
Jun 16, 2010 4:46:51 AM (14 years ago)
Author:
tonikitoo@webkit.org
Message:

2010-05-20 Antonio Gomes <tonikitoo@webkit.org>

Reviewed by Kenneth Christiansen.

Spatial Navigation: using offset{Left,Top} is not enough to get the proper inner frames position
https://bugs.webkit.org/show_bug.cgi?id=39439

As pointed out by Darin Adler in https://bugs.webkit.org/show_bug.cgi?id=18662#c20,
"It's not correct to use the offsetLeft and offsetTop of the frame owner element's renderer because
that's just the distance from the offsetParent, not the absolute position".

Patch fixes that behavior by now considering the offsetTop and offsetLeft the offsetParent recursively,
starting from the HtmlFrameOwnerElement. Previously, only calling offsetTop and offsetLeft works
because all tests were done in html samples where the {i}frame element was a directly a child of the body,
e.g. <html>...<body><iframe src=xxx>....<body></html>.

WebCore:
Test: fast/events/spatial-navigation/snav-iframe-recursive-offset-parent.html

  • page/SpatialNavigation.cpp: (WebCore::renderRectRelativeToRootDocument):

LayoutTests:

  • fast/events/spatial-navigation/snav-iframe-recursive-offset-parent-expected.txt: Added.
  • fast/events/spatial-navigation/snav-iframe-recursive-offset-parent.html: Added.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r61248 r61250  
     12010-06-16  Antonio Gomes  <tonikitoo@webkit.org>
     2
     3        Reviewed by Kenneth Christiansen.
     4
     5        Spatial Navigation: using offset{Left,Top} is not enough to get the proper inner frames position
     6        https://bugs.webkit.org/show_bug.cgi?id=39439
     7
     8        * fast/events/spatial-navigation/snav-iframe-recursive-offset-parent-expected.txt: Added.
     9        * fast/events/spatial-navigation/snav-iframe-recursive-offset-parent.html: Added.
     10
    1112010-06-16  Eric Seidel  <eric@webkit.org>
    212
  • trunk/WebCore/ChangeLog

    r61249 r61250  
     12010-06-16  Antonio Gomes  <tonikitoo@webkit.org>
     2
     3        Reviewed by Kenneth Christiansen.
     4
     5        Spatial Navigation: using offset{Left,Top} is not enough to get the proper inner frames position
     6        https://bugs.webkit.org/show_bug.cgi?id=39439
     7
     8        As pointed out by Darin Adler in https://bugs.webkit.org/show_bug.cgi?id=18662#c20,
     9        "It's not correct to use the offsetLeft and offsetTop of the frame owner element's renderer because
     10        that's just the distance from the offsetParent, not the absolute position".
     11
     12        Patch fixes that behavior by now considering the offsetTop and offsetLeft the offsetParent recursively,
     13        starting from the HtmlFrameOwnerElement. Previously, only calling offsetTop and offsetLeft works
     14        because all tests were done in htmls where the {i}frame element was a directly a child of the body,
     15        e.g. <html>...<body><iframe src=xxx>....<body></html>.
     16
     17        Test: fast/events/spatial-navigation/snav-iframe-recursive-offset-parent.html
     18
     19        * page/SpatialNavigation.cpp:
     20        (WebCore::renderRectRelativeToRootDocument):
     21
    1222010-06-16  Dan Bernstein  <mitz@apple.com>
    223
  • trunk/WebCore/page/SpatialNavigation.cpp

    r61134 r61250  
    126126    // Handle nested frames.
    127127    for (Frame* frame = render->document()->frame(); frame; frame = frame->tree()->parent()) {
    128         if (HTMLFrameOwnerElement* ownerElement = frame->ownerElement())
    129             rect.move(ownerElement->offsetLeft(), ownerElement->offsetTop());
     128        if (Element* element = static_cast<Element*>(frame->ownerElement())) {
     129            do {
     130                rect.move(element->offsetLeft(), element->offsetTop());
     131            } while ((element = element->offsetParent()));
     132        }
    130133    }
    131134
Note: See TracChangeset for help on using the changeset viewer.