OLD | NEW |
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 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 return true; | 241 return true; |
242 } | 242 } |
243 } | 243 } |
244 | 244 |
245 // Return true if rect |a| is below |b|. False otherwise. | 245 // Return true if rect |a| is below |b|. False otherwise. |
246 // For overlapping rects, |a| is considered to be below |b| | 246 // For overlapping rects, |a| is considered to be below |b| |
247 // if both edges of |a| are below the respective ones of |b| | 247 // if both edges of |a| are below the respective ones of |b| |
248 static inline bool below(const LayoutRect& a, const LayoutRect& b) | 248 static inline bool below(const LayoutRect& a, const LayoutRect& b) |
249 { | 249 { |
250 return a.y() >= b.maxY() | 250 return a.y() >= b.maxY() |
251 || (a.y() >= b.y() && a.maxY() > b.maxY()); | 251 || (a.y() >= b.y() && a.maxY() > b.maxY() && a.x() < b.maxX() && a.maxX(
) > b.x()); |
252 } | 252 } |
253 | 253 |
254 // Return true if rect |a| is on the right of |b|. False otherwise. | 254 // Return true if rect |a| is on the right of |b|. False otherwise. |
255 // For overlapping rects, |a| is considered to be on the right of |b| | 255 // For overlapping rects, |a| is considered to be on the right of |b| |
256 // if both edges of |a| are on the right of the respective ones of |b| | 256 // if both edges of |a| are on the right of the respective ones of |b| |
257 static inline bool rightOf(const LayoutRect& a, const LayoutRect& b) | 257 static inline bool rightOf(const LayoutRect& a, const LayoutRect& b) |
258 { | 258 { |
259 return a.x() >= b.maxX() | 259 return a.x() >= b.maxX() |
260 || (a.x() >= b.x() && a.maxX() > b.maxX()); | 260 || (a.x() >= b.x() && a.maxX() > b.maxX() && a.y() < b.maxY() && a.maxY(
) > b.y()); |
261 } | 261 } |
262 | 262 |
263 static bool isRectInDirection(FocusType type, const LayoutRect& curRect, const L
ayoutRect& targetRect) | 263 static bool isRectInDirection(FocusType type, const LayoutRect& curRect, const L
ayoutRect& targetRect) |
264 { | 264 { |
265 switch (type) { | 265 switch (type) { |
266 case FocusTypeLeft: | 266 case FocusTypeLeft: |
267 return rightOf(curRect, targetRect); | 267 return rightOf(curRect, targetRect); |
268 case FocusTypeRight: | 268 case FocusTypeRight: |
269 return rightOf(targetRect, curRect); | 269 return rightOf(targetRect, curRect); |
270 case FocusTypeUp: | 270 case FocusTypeUp: |
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
747 LayoutRect rect = virtualRectForDirection(type, rectToAbsoluteCoordinates(ar
ea.document().frame(), area.computeRect(area.imageElement()->renderer())), 1); | 747 LayoutRect rect = virtualRectForDirection(type, rectToAbsoluteCoordinates(ar
ea.document().frame(), area.computeRect(area.imageElement()->renderer())), 1); |
748 return rect; | 748 return rect; |
749 } | 749 } |
750 | 750 |
751 HTMLFrameOwnerElement* frameOwnerElement(FocusCandidate& candidate) | 751 HTMLFrameOwnerElement* frameOwnerElement(FocusCandidate& candidate) |
752 { | 752 { |
753 return candidate.isFrameOwnerElement() ? toHTMLFrameOwnerElement(candidate.v
isibleNode) : nullptr; | 753 return candidate.isFrameOwnerElement() ? toHTMLFrameOwnerElement(candidate.v
isibleNode) : nullptr; |
754 }; | 754 }; |
755 | 755 |
756 } // namespace blink | 756 } // namespace blink |
OLD | NEW |