COMMIT_MESSAGE (2/2)

 12010-12-13 Antonio Gomes <agomes@rim.com>
 2
 3 Reviewed by NOBODY (OOPS!).
 4
 5 Spatial Navigation: code clean up (part IV)
 6 https://bugs.webkit.org/show_bug.cgi?id=50666
 7
 8 Avoid calling canScrollInDirection more than necessary.
 9
 10 No new tests needed.
 11
 12 * page/FocusController.cpp:
 13 (WebCore::FocusController::advanceFocusDirectionallyInContainer): Moved the call to canScrollInDirection()
 14 to within the scrollInDirection().
 15 * page/SpatialNavigation.cpp: Removed the assertion to canScrollingDirection function.
 16 (WebCore::scrollInDirection):

WebCore/ChangeLog

22
33 Reviewed by NOBODY (OOPS!).
44
 5 Spatial Navigation: code clean up (part IV)
 6 https://bugs.webkit.org/show_bug.cgi?id=50666
 7
 8 Avoid calling canScrollInDirection more than necessary.
 9
 10 No new tests needed.
 11
 12 * page/FocusController.cpp:
 13 (WebCore::FocusController::advanceFocusDirectionallyInContainer): Moved the call to canScrollInDirection()
 14 to within the scrollInDirection().
 15 * page/SpatialNavigation.cpp: Removed the assertion to canScrollingDirection function.
 16 (WebCore::scrollInDirection):
 17
 182010-12-13 Antonio Gomes <agomes@rim.com>
 19
 20 Reviewed by NOBODY (OOPS!).
 21
522 Spatial Navigation: code clean up (part III)
623 https://bugs.webkit.org/show_bug.cgi?id=50666
724

WebCore/page/FocusController.cpp

@@bool FocusController::advanceFocusDirectionallyInContainer(Node* container, cons
500500 findFocusCandidateInContainer(container, newStartingRect, direction, event, focusCandidate);
501501
502502 if (focusCandidate.isNull()) {
503  if (canScrollInDirection(direction, container)) {
504  // Nothing to focus, scroll if possible.
505  scrollInDirection(container, direction);
506  return true;
507  }
508  // Return false will cause a re-try, skipping this container.
509  return false;
 503 // Nothing to focus, scroll if possible.
 504 // NOTE: If no scrolling is performed (i.e. scrollInDirection returns false), the
 505 // spatial navigation algorithm to continue, skipping this container.
 506 return scrollInDirection(container, direction);
510507 }
511508
512509 if (HTMLFrameOwnerElement* frameElement = toFrameOwnerElement(focusCandidate)) {

WebCore/page/SpatialNavigation.cpp

@@bool hasOffscreenRect(Node* node, FocusDirection direction)
334334
335335bool scrollInDirection(Frame* frame, FocusDirection direction)
336336{
337  ASSERT(frame && canScrollInDirection(direction, frame->document()));
 337 ASSERT(frame);
338338
339339 if (frame && canScrollInDirection(direction, frame->document())) {
340340 int dx = 0;

@@bool scrollInDirection(Frame* frame, FocusDirection direction)
365365
366366bool scrollInDirection(Node* container, FocusDirection direction)
367367{
 368 ASSERT(container);
368369 if (container->isDocumentNode())
369370 return scrollInDirection(static_cast<Document*>(container)->frame(), direction);
370371
371372 if (!container->renderBox())
372373 return false;
373374
374  if (container && canScrollInDirection(direction, container)) {
 375 if (canScrollInDirection(direction, container)) {
375376 int dx = 0;
376377 int dy = 0;
377378 switch (direction) {

@@bool scrollInDirection(Node* container, FocusDirection direction)
397398 container->renderBox()->enclosingLayer()->scrollByRecursively(dx, dy);
398399 return true;
399400 }
 401
400402 return false;
401403}
402404