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

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
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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 117
118 // Return true if rect |a| is on the right of |b|. False otherwise. 118 // Return true if rect |a| is on the right of |b|. False otherwise.
119 // For overlapping rects, |a| is considered to be on the right of |b| 119 // For overlapping rects, |a| is considered to be on the right of |b|
120 // if both edges of |a| are on the right of the respective ones of |b| 120 // if both edges of |a| are on the right of the respective ones of |b|
121 static inline bool rightOf(const LayoutRect& a, const LayoutRect& b) 121 static inline bool rightOf(const LayoutRect& a, const LayoutRect& b)
122 { 122 {
123 return a.x() >= b.maxX() 123 return a.x() >= b.maxX()
124 || (a.x() >= b.x() && a.maxX() > b.maxX() && a.y() < b.maxY() && a.maxY( ) > b.y()); 124 || (a.x() >= b.x() && a.maxX() > b.maxX() && a.y() < b.maxY() && a.maxY( ) > b.y());
125 } 125 }
126 126
127 static bool isRectInDirection(WebFocusType type, const LayoutRect& curRect, cons t LayoutRect& targetRect) 127 bool isRectInDirection(WebFocusType type, const LayoutRect& curRect, const Layou tRect& targetRect)
128 { 128 {
129 switch (type) { 129 switch (type) {
130 case WebFocusTypeLeft: 130 case WebFocusTypeLeft:
131 return rightOf(curRect, targetRect); 131 return rightOf(curRect, targetRect);
132 case WebFocusTypeRight: 132 case WebFocusTypeRight:
133 return rightOf(targetRect, curRect); 133 return rightOf(targetRect, curRect);
134 case WebFocusTypeUp: 134 case WebFocusTypeUp:
135 return below(curRect, targetRect); 135 return below(curRect, targetRect);
136 case WebFocusTypeDown: 136 case WebFocusTypeDown:
137 return below(targetRect, curRect); 137 return below(targetRect, curRect);
(...skipping 484 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
« Source/core/page/FocusController.cpp ('K') | « Source/core/page/SpatialNavigation.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698