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 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 | 237 |
238 if (canScrollInDirection(container, type)) { | 238 if (canScrollInDirection(container, type)) { |
239 int dx = 0; | 239 int dx = 0; |
240 int dy = 0; | 240 int dy = 0; |
241 // TODO(leviw): Why are these values truncated (toInt) instead of rounding? | 241 // TODO(leviw): Why are these values truncated (toInt) instead of rounding? |
242 FrameView* frameView = container->document().view(); | 242 FrameView* frameView = container->document().view(); |
243 int pixelsPerLineStep = ScrollableArea::pixelsPerLineStep( | 243 int pixelsPerLineStep = ScrollableArea::pixelsPerLineStep( |
244 frameView ? frameView->getHostWindow() : nullptr); | 244 frameView ? frameView->getHostWindow() : nullptr); |
245 switch (type) { | 245 switch (type) { |
246 case WebFocusTypeLeft: | 246 case WebFocusTypeLeft: |
247 dx = -std::min(pixelsPerLineStep, | 247 dx = -pixelsPerLineStep; |
248 container->layoutBox()->scrollLeft().toInt()); | |
249 break; | 248 break; |
250 case WebFocusTypeRight: | 249 case WebFocusTypeRight: |
251 ASSERT(container->layoutBox()->scrollWidth() > | 250 ASSERT(container->layoutBox()->scrollWidth() > |
252 (container->layoutBox()->scrollLeft() + | 251 (container->layoutBox()->scrollLeft() + |
253 container->layoutBox()->clientWidth())); | 252 container->layoutBox()->clientWidth())); |
254 dx = std::min(pixelsPerLineStep, | 253 dx = pixelsPerLineStep; |
255 (container->layoutBox()->scrollWidth() - | |
256 (container->layoutBox()->scrollLeft() + | |
257 container->layoutBox()->clientWidth())) | |
258 .toInt()); | |
259 break; | 254 break; |
260 case WebFocusTypeUp: | 255 case WebFocusTypeUp: |
261 dy = -std::min(pixelsPerLineStep, | 256 dy = -pixelsPerLineStep; |
262 container->layoutBox()->scrollTop().toInt()); | |
263 break; | 257 break; |
264 case WebFocusTypeDown: | 258 case WebFocusTypeDown: |
265 ASSERT(container->layoutBox()->scrollHeight() - | 259 ASSERT(container->layoutBox()->scrollHeight() - |
266 (container->layoutBox()->scrollTop() + | 260 (container->layoutBox()->scrollTop() + |
267 container->layoutBox()->clientHeight())); | 261 container->layoutBox()->clientHeight())); |
268 dy = std::min(pixelsPerLineStep, | 262 dy = pixelsPerLineStep; |
269 (container->layoutBox()->scrollHeight() - | |
270 (container->layoutBox()->scrollTop() + | |
271 container->layoutBox()->clientHeight())) | |
272 .toInt()); | |
273 break; | 263 break; |
274 default: | 264 default: |
275 ASSERT_NOT_REACHED(); | 265 ASSERT_NOT_REACHED(); |
276 return false; | 266 return false; |
277 } | 267 } |
278 | 268 |
279 container->layoutBox()->scrollByRecursively(IntSize(dx, dy)); | 269 container->layoutBox()->scrollByRecursively(IntSize(dx, dy)); |
280 return true; | 270 return true; |
281 } | 271 } |
282 | 272 |
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
690 return rect; | 680 return rect; |
691 } | 681 } |
692 | 682 |
693 HTMLFrameOwnerElement* frameOwnerElement(FocusCandidate& candidate) { | 683 HTMLFrameOwnerElement* frameOwnerElement(FocusCandidate& candidate) { |
694 return candidate.isFrameOwnerElement() | 684 return candidate.isFrameOwnerElement() |
695 ? toHTMLFrameOwnerElement(candidate.visibleNode) | 685 ? toHTMLFrameOwnerElement(candidate.visibleNode) |
696 : nullptr; | 686 : nullptr; |
697 }; | 687 }; |
698 | 688 |
699 } // namespace blink | 689 } // namespace blink |
OLD | NEW |