Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1016)

Side by Side Diff: Source/core/page/SpatialNavigation.cpp

Issue 1010203002: Avoid computing navigation data for nodes in the wrong navigation direction (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies) 2 * Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies)
3 * Copyright (C) 2009 Antonio Gomes <tonikitoo@webkit.org> 3 * Copyright (C) 2009 Antonio Gomes <tonikitoo@webkit.org>
4 * 4 *
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after
498 return false; 498 return false;
499 499
500 if (firstCandidate.visibleNode->layoutObject()->containingBlock() != secondC andidate.visibleNode->layoutObject()->containingBlock()) 500 if (firstCandidate.visibleNode->layoutObject()->containingBlock() != secondC andidate.visibleNode->layoutObject()->containingBlock())
501 return false; 501 return false;
502 502
503 return true; 503 return true;
504 } 504 }
505 505
506 void distanceDataForNode(WebFocusType type, const FocusCandidate& current, Focus Candidate& candidate) 506 void distanceDataForNode(WebFocusType type, const FocusCandidate& current, Focus Candidate& candidate)
507 { 507 {
508 if (!isRectInDirection(type, current.rect, candidate.rect))
509 return;
510
508 if (areElementsOnSameLine(current, candidate)) { 511 if (areElementsOnSameLine(current, candidate)) {
509 if ((type == WebFocusTypeUp && current.rect.y() > candidate.rect.y()) || (type == WebFocusTypeDown && candidate.rect.y() > current.rect.y())) { 512 if ((type == WebFocusTypeUp && current.rect.y() > candidate.rect.y()) || (type == WebFocusTypeDown && candidate.rect.y() > current.rect.y())) {
510 candidate.distance = 0; 513 candidate.distance = 0;
511 return; 514 return;
512 } 515 }
513 } 516 }
514 517
515 LayoutRect nodeRect = candidate.rect; 518 LayoutRect nodeRect = candidate.rect;
516 LayoutRect currentRect = current.rect; 519 LayoutRect currentRect = current.rect;
517 deflateIfOverlapped(currentRect, nodeRect); 520 deflateIfOverlapped(currentRect, nodeRect);
518 521
519 if (!isRectInDirection(type, currentRect, nodeRect))
520 return;
521
522 LayoutPoint exitPoint; 522 LayoutPoint exitPoint;
523 LayoutPoint entryPoint; 523 LayoutPoint entryPoint;
524 entryAndExitPointsForDirection(type, currentRect, nodeRect, exitPoint, entry Point); 524 entryAndExitPointsForDirection(type, currentRect, nodeRect, exitPoint, entry Point);
525 525
526 LayoutUnit xAxis = (exitPoint.x() - entryPoint.x()).abs(); 526 LayoutUnit xAxis = (exitPoint.x() - entryPoint.x()).abs();
527 LayoutUnit yAxis = (exitPoint.y() - entryPoint.y()).abs(); 527 LayoutUnit yAxis = (exitPoint.y() - entryPoint.y()).abs();
528 528
529 LayoutUnit navigationAxisDistance; 529 LayoutUnit navigationAxisDistance;
530 LayoutUnit weightedOrthogonalAxisDistance; 530 LayoutUnit weightedOrthogonalAxisDistance;
531 531
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
622 LayoutRect rect = virtualRectForDirection(type, rectToAbsoluteCoordinates(ar ea.document().frame(), area.computeRect(area.imageElement()->layoutObject())), 1 ); 622 LayoutRect rect = virtualRectForDirection(type, rectToAbsoluteCoordinates(ar ea.document().frame(), area.computeRect(area.imageElement()->layoutObject())), 1 );
623 return rect; 623 return rect;
624 } 624 }
625 625
626 HTMLFrameOwnerElement* frameOwnerElement(FocusCandidate& candidate) 626 HTMLFrameOwnerElement* frameOwnerElement(FocusCandidate& candidate)
627 { 627 {
628 return candidate.isFrameOwnerElement() ? toHTMLFrameOwnerElement(candidate.v isibleNode) : nullptr; 628 return candidate.isFrameOwnerElement() ? toHTMLFrameOwnerElement(candidate.v isibleNode) : nullptr;
629 }; 629 };
630 630
631 } // namespace blink 631 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698