summaryrefslogtreecommitdiff
path: root/src/3rdparty/webkit/WebCore/page
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2010-05-07 10:22:23 +0200
committerSimon Hausmann <simon.hausmann@nokia.com>2010-05-07 10:22:23 +0200
commit2ea7f415dbc26cc505fe04f6f6a6ce7766d19608 (patch)
tree7243c1e0f755dea2d1ff17427df8681f55274818 /src/3rdparty/webkit/WebCore/page
parent91b2bd620bf10ddd9de65f2c3ac7781e591844d4 (diff)
downloadqt4-tools-2ea7f415dbc26cc505fe04f6f6a6ce7766d19608.tar.gz
Updated WebKit to 07b60cf799680fcfb7785ee88e14f8030a5dbfa2
Bugzilla fixes integrated in this commit: || <https://webkit.org/b/37445> || [Qt] Regression: Google calendar edit event details gets stuck on loading || || <https://webkit.org/b/38439> || [Qt] QT_MOBILE_THEME compile time flag || || <https://webkit.org/b/37803> || Spatial Navigation: adapt the logic of {deep}findFocusableNodeInDirection to do traversal starting from Node* not Document* || || <https://webkit.org/b/36755> || [Qt] REGRESSION: Loading of external CSS and JS files over network fails in some cases || || <https://webkit.org/b/36533> || [Qt] Compilation error on Qt for Embedded Linux built with -qconfig small || || <https://webkit.org/b/38585> || Spatial Navigation: add a layout test which runs with Frame Flattening ON ||
Diffstat (limited to 'src/3rdparty/webkit/WebCore/page')
-rw-r--r--src/3rdparty/webkit/WebCore/page/FocusController.cpp74
-rw-r--r--src/3rdparty/webkit/WebCore/page/FocusController.h5
2 files changed, 53 insertions, 26 deletions
diff --git a/src/3rdparty/webkit/WebCore/page/FocusController.cpp b/src/3rdparty/webkit/WebCore/page/FocusController.cpp
index fdd117b19b..6c2a956fc6 100644
--- a/src/3rdparty/webkit/WebCore/page/FocusController.cpp
+++ b/src/3rdparty/webkit/WebCore/page/FocusController.cpp
@@ -304,7 +304,7 @@ bool FocusController::advanceFocusDirectionally(FocusDirection direction, Keyboa
frame = frame->tree()->top();
FocusCandidate focusCandidate;
- findFocusableNodeInDirection(frame->document(), focusedNode, direction, event, focusCandidate);
+ findFocusableNodeInDirection(frame->document()->firstChild(), focusedNode, direction, event, focusCandidate);
Node* node = focusCandidate.node;
if (!node || !node->isElementNode()) {
@@ -391,20 +391,23 @@ static void updateFocusCandidateIfCloser(Node* focusedNode, const FocusCandidate
}
}
-void FocusController::findFocusableNodeInDirection(Document* document, Node* focusedNode,
+void FocusController::findFocusableNodeInDirection(Node* outer, Node* focusedNode,
FocusDirection direction, KeyboardEvent* event,
FocusCandidate& closestFocusCandidate,
const FocusCandidate& candidateParent)
{
- ASSERT(document);
- ASSERT(candidateParent.isNull() || static_cast<HTMLFrameOwnerElement*>(candidateParent.node));
+ ASSERT(outer);
+ ASSERT(candidateParent.isNull()
+ || candidateParent.node->hasTagName(frameTag)
+ || candidateParent.node->hasTagName(iframeTag));
// Walk all the child nodes and update closestFocusCandidate if we find a nearer node.
- for (Node* candidate = document->firstChild(); candidate; candidate = candidate->traverseNextNode()) {
+ Node* candidate = outer;
+ while (candidate) {
// Inner documents case.
if (candidate->isFrameOwnerElement())
- deepFindFocusableNodeInDirection(focusedNode, candidate, direction, event, closestFocusCandidate);
+ deepFindFocusableNodeInDirection(candidate, focusedNode, direction, event, closestFocusCandidate);
else if (candidate != focusedNode && candidate->isKeyboardFocusable(event)) {
FocusCandidate currentFocusCandidate(candidate);
@@ -412,8 +415,10 @@ void FocusController::findFocusableNodeInDirection(Document* document, Node* foc
distanceDataForNode(direction, focusedNode, currentFocusCandidate);
// Bail out if distance is maximum.
- if (currentFocusCandidate.distance == maxDistance())
+ if (currentFocusCandidate.distance == maxDistance()) {
+ candidate = candidate->traverseNextNode(outer->parent());
continue;
+ }
// If candidateParent is not null, it means that we are in a recursive call
// from deepFineFocusableNodeInDirection (i.e. processing an element in an iframe),
@@ -425,33 +430,54 @@ void FocusController::findFocusableNodeInDirection(Document* document, Node* foc
updateFocusCandidateIfCloser(focusedNode, currentFocusCandidate, closestFocusCandidate);
}
+
+ candidate = candidate->traverseNextNode(outer->parent());
}
}
-void FocusController::deepFindFocusableNodeInDirection(Node* focusedNode, Node* candidate,
+void FocusController::deepFindFocusableNodeInDirection(Node* container, Node* focusedNode,
FocusDirection direction, KeyboardEvent* event,
FocusCandidate& closestFocusCandidate)
{
- HTMLFrameOwnerElement* owner = static_cast<HTMLFrameOwnerElement*>(candidate);
- if (!owner->contentFrame())
+ ASSERT(container->hasTagName(frameTag) || container->hasTagName(iframeTag));
+
+ // Track if focusedNode is a descendant of the current container node being processed.
+ bool descendantOfContainer = false;
+ Node* firstChild = 0;
+
+ // Iframe or Frame.
+ if (container->hasTagName(frameTag) || container->hasTagName(iframeTag)) {
+
+ HTMLFrameOwnerElement* owner = static_cast<HTMLFrameOwnerElement*>(container);
+ if (!owner->contentFrame())
+ return;
+
+ Document* innerDocument = owner->contentFrame()->document();
+ if (!innerDocument)
+ return;
+
+ descendantOfContainer = innerDocument == focusedNode->document();
+ firstChild = innerDocument->firstChild();
+
+ }
+
+ if (descendantOfContainer) {
+ findFocusableNodeInDirection(firstChild, focusedNode, direction, event, closestFocusCandidate);
return;
+ }
- Document* innerDocument = owner->contentFrame()->document();
- if (!innerDocument)
+ // Check if the current container element itself is a good candidate
+ // to move focus to. If it is, then we traverse its inner nodes.
+ FocusCandidate candidateParent = FocusCandidate(container);
+ distanceDataForNode(direction, focusedNode, candidateParent);
+
+ // Bail out if distance is maximum.
+ if (candidateParent.distance == maxDistance())
return;
- if (innerDocument == focusedNode->document())
- findFocusableNodeInDirection(innerDocument, focusedNode, direction, event, closestFocusCandidate);
- else {
- // Check if the current {i}frame element itself is a good candidate
- // to move focus to. If it is, then we traverse its inner nodes.
- FocusCandidate candidateParent = FocusCandidate(candidate);
- distanceDataForNode(direction, focusedNode, candidateParent);
-
- // FIXME: Consider alignment?
- if (candidateParent.distance < closestFocusCandidate.distance)
- findFocusableNodeInDirection(innerDocument, focusedNode, direction, event, closestFocusCandidate, candidateParent);
- }
+ // FIXME: Consider alignment?
+ if (candidateParent.distance < closestFocusCandidate.distance)
+ findFocusableNodeInDirection(firstChild, focusedNode, direction, event, closestFocusCandidate, candidateParent);
}
static bool relinquishesEditingFocus(Node *node)
diff --git a/src/3rdparty/webkit/WebCore/page/FocusController.h b/src/3rdparty/webkit/WebCore/page/FocusController.h
index dfa3780018..441083337e 100644
--- a/src/3rdparty/webkit/WebCore/page/FocusController.h
+++ b/src/3rdparty/webkit/WebCore/page/FocusController.h
@@ -63,9 +63,10 @@ private:
bool advanceFocusDirectionally(FocusDirection, KeyboardEvent*);
bool advanceFocusInDocumentOrder(FocusDirection, KeyboardEvent*, bool initialFocus);
- void findFocusableNodeInDirection(Document*, Node*, FocusDirection, KeyboardEvent*, FocusCandidate& closestFocusCandidate,
+ void findFocusableNodeInDirection(Node* outter, Node*, FocusDirection, KeyboardEvent*,
+ FocusCandidate& closestFocusCandidate,
const FocusCandidate& parentCandidate = FocusCandidate());
- void deepFindFocusableNodeInDirection(Node*, Node*, FocusDirection, KeyboardEvent*, FocusCandidate&);
+ void deepFindFocusableNodeInDirection(Node* container, Node* focused, FocusDirection, KeyboardEvent*, FocusCandidate&);
Page* m_page;
RefPtr<Frame> m_focusedFrame;