Changeset 128644 in webkit


Ignore:
Timestamp:
Sep 14, 2012 1:01:36 PM (12 years ago)
Author:
eae@chromium.org
Message:

https://bugs.webkit.org/show_bug.cgi?id=96226
REGRESSION (r128006): Three spatial navigation tests are failing

Reviewed by Ryosuke Niwa.

Source/WebCore:

Fix spatial navigation regression by reverting parts of r128006.
Specifically the change to remove the overridden boundingBox
method in ContainerNode.

  • dom/ContainerNode.cpp:

(WebCore::ContainerNode::getUpperLeftCorner):
(WebCore):
(WebCore::ContainerNode::getLowerRightCorner):
(WebCore::ContainerNode::boundingBox):

  • dom/ContainerNode.h:

(ContainerNode):

LayoutTests:

Remove spatial navigation tests from Skipped list.

  • platform/mac/Skipped:
Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r128642 r128644  
     12012-09-14  Emil A Eklund  <eae@chromium.org>
     2
     3        https://bugs.webkit.org/show_bug.cgi?id=96226
     4        REGRESSION (r128006): Three spatial navigation tests are failing
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        Remove spatial navigation tests from Skipped list.
     9
     10        * platform/mac/Skipped:
     11
    1122012-09-14  James Robinson  <jamesr@chromium.org>
    213
  • trunk/LayoutTests/platform/mac/Skipped

    r128532 r128644  
    10111011svg/custom/use-instanceRoot-as-event-target.xhtml
    10121012
    1013 # https://bugs.webkit.org/show_bug.cgi?id=96226
    1014 # REGRESSION (r128006): Three spatial navigation tests are failing
    1015 fast/spatial-navigation/snav-container-white-space.html
    1016 fast/spatial-navigation/snav-div-overflow-scrol-hidden.html
    1017 fast/spatial-navigation/snav-imagemap-overlapped-areas.html
    1018 
    10191013# Assorted failures that need investigation
    10201014
  • trunk/Source/WebCore/ChangeLog

    r128642 r128644  
     12012-09-14  Emil A Eklund  <eae@chromium.org>
     2
     3        https://bugs.webkit.org/show_bug.cgi?id=96226
     4        REGRESSION (r128006): Three spatial navigation tests are failing
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        Fix spatial navigation regression by reverting parts of r128006.
     9        Specifically the change to remove the overridden boundingBox
     10        method in ContainerNode.
     11
     12        * dom/ContainerNode.cpp:
     13        (WebCore::ContainerNode::getUpperLeftCorner):
     14        (WebCore):
     15        (WebCore::ContainerNode::getLowerRightCorner):
     16        (WebCore::ContainerNode::boundingBox):
     17        * dom/ContainerNode.h:
     18        (ContainerNode):
     19
    1202012-09-14  James Robinson  <jamesr@chromium.org>
    221
  • trunk/Source/WebCore/dom/ContainerNode.cpp

    r128559 r128644  
    727727}
    728728
     729bool ContainerNode::getUpperLeftCorner(FloatPoint& point) const
     730{
     731    if (!renderer())
     732        return false;
     733    // What is this code really trying to do?
     734    RenderObject* o = renderer();
     735    RenderObject* p = o;
     736
     737    if (!o->isInline() || o->isReplaced()) {
     738        point = o->localToAbsolute(FloatPoint(), false, true);
     739        return true;
     740    }
     741
     742    // find the next text/image child, to get a position
     743    while (o) {
     744        p = o;
     745        if (o->firstChild())
     746            o = o->firstChild();
     747        else if (o->nextSibling())
     748            o = o->nextSibling();
     749        else {
     750            RenderObject* next = 0;
     751            while (!next && o->parent()) {
     752                o = o->parent();
     753                next = o->nextSibling();
     754            }
     755            o = next;
     756
     757            if (!o)
     758                break;
     759        }
     760        ASSERT(o);
     761
     762        if (!o->isInline() || o->isReplaced()) {
     763            point = o->localToAbsolute(FloatPoint(), false, true);
     764            return true;
     765        }
     766
     767        if (p->node() && p->node() == this && o->isText() && !o->isBR() && !toRenderText(o)->firstTextBox()) {
     768            // do nothing - skip unrendered whitespace that is a child or next sibling of the anchor
     769        } else if ((o->isText() && !o->isBR()) || o->isReplaced()) {
     770            point = FloatPoint();
     771            if (o->isText() && toRenderText(o)->firstTextBox()) {
     772                point.move(toRenderText(o)->linesBoundingBox().x(), toRenderText(o)->firstTextBox()->root()->lineTop());
     773            } else if (o->isBox()) {
     774                RenderBox* box = toRenderBox(o);
     775                point.moveBy(box->location());
     776            }
     777            point = o->container()->localToAbsolute(point, false, true);
     778            return true;
     779        }
     780    }
     781   
     782    // If the target doesn't have any children or siblings that could be used to calculate the scroll position, we must be
     783    // at the end of the document. Scroll to the bottom. FIXME: who said anything about scrolling?
     784    if (!o && document()->view()) {
     785        point = FloatPoint(0, document()->view()->contentsHeight());
     786        return true;
     787    }
     788    return false;
     789}
     790
     791bool ContainerNode::getLowerRightCorner(FloatPoint& point) const
     792{
     793    if (!renderer())
     794        return false;
     795
     796    RenderObject* o = renderer();
     797    if (!o->isInline() || o->isReplaced()) {
     798        RenderBox* box = toRenderBox(o);
     799        point = o->localToAbsolute(LayoutPoint(box->size()), false, true);
     800        return true;
     801    }
     802
     803    // find the last text/image child, to get a position
     804    while (o) {
     805        if (o->lastChild())
     806            o = o->lastChild();
     807        else if (o->previousSibling())
     808            o = o->previousSibling();
     809        else {
     810            RenderObject* prev = 0;
     811            while (!prev) {
     812                o = o->parent();
     813                if (!o)
     814                    return false;
     815                prev = o->previousSibling();
     816            }
     817            o = prev;
     818        }
     819        ASSERT(o);
     820        if (o->isText() || o->isReplaced()) {
     821            point = FloatPoint();
     822            if (o->isText()) {
     823                RenderText* text = toRenderText(o);
     824                IntRect linesBox = text->linesBoundingBox();
     825                if (!linesBox.maxX() && !linesBox.maxY())
     826                    continue;
     827                point.moveBy(linesBox.maxXMaxYCorner());
     828            } else {
     829                RenderBox* box = toRenderBox(o);
     830                point.moveBy(box->frameRect().maxXMaxYCorner());
     831            }
     832            point = o->container()->localToAbsolute(point, false, true);
     833            return true;
     834        }
     835    }
     836    return true;
     837}
     838
     839LayoutRect ContainerNode::boundingBox() const
     840{
     841    FloatPoint upperLeft, lowerRight;
     842    bool foundUpperLeft = getUpperLeftCorner(upperLeft);
     843    bool foundLowerRight = getLowerRightCorner(lowerRight);
     844   
     845    // If we've found one corner, but not the other,
     846    // then we should just return a point at the corner that we did find.
     847    if (foundUpperLeft != foundLowerRight) {
     848        if (foundUpperLeft)
     849            lowerRight = upperLeft;
     850        else
     851            upperLeft = lowerRight;
     852    }
     853
     854    return enclosingLayoutRect(FloatRect(upperLeft, lowerRight.expandedTo(upperLeft) - upperLeft));
     855}
     856
    729857void ContainerNode::setFocus(bool received)
    730858{
  • trunk/Source/WebCore/dom/ContainerNode.h

    r128006 r128644  
    7676    virtual void attach() OVERRIDE;
    7777    virtual void detach() OVERRIDE;
     78    virtual LayoutRect boundingBox() const OVERRIDE;
    7879    virtual void setFocus(bool = true) OVERRIDE;
    7980    virtual void setActive(bool active = true, bool pause = false) OVERRIDE;
     
    131132
    132133    static void dispatchPostAttachCallbacks();
     134
     135    bool getUpperLeftCorner(FloatPoint&) const;
     136    bool getLowerRightCorner(FloatPoint&) const;
    133137
    134138    Node* m_firstChild;
Note: See TracChangeset for help on using the changeset viewer.