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 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 dy = -pixelsPerLineStep; | 214 dy = -pixelsPerLineStep; |
215 break; | 215 break; |
216 case WebFocusTypeDown: | 216 case WebFocusTypeDown: |
217 dy = pixelsPerLineStep; | 217 dy = pixelsPerLineStep; |
218 break; | 218 break; |
219 default: | 219 default: |
220 ASSERT_NOT_REACHED(); | 220 ASSERT_NOT_REACHED(); |
221 return false; | 221 return false; |
222 } | 222 } |
223 | 223 |
224 frame->view()->scrollBy(IntSize(dx, dy), UserScroll); | 224 frame->view()->scrollBy(ScrollOffset(dx, dy), UserScroll); |
225 return true; | 225 return true; |
226 } | 226 } |
227 return false; | 227 return false; |
228 } | 228 } |
229 | 229 |
230 bool scrollInDirection(Node* container, WebFocusType type) { | 230 bool scrollInDirection(Node* container, WebFocusType type) { |
231 ASSERT(container); | 231 ASSERT(container); |
232 if (container->isDocumentNode()) | 232 if (container->isDocumentNode()) |
233 return scrollInDirection(toDocument(container)->frame(), type); | 233 return scrollInDirection(toDocument(container)->frame(), type); |
234 | 234 |
(...skipping 24 matching lines...) Expand all Loading... |
259 ASSERT(container->layoutBox()->scrollHeight() - | 259 ASSERT(container->layoutBox()->scrollHeight() - |
260 (container->layoutBox()->scrollTop() + | 260 (container->layoutBox()->scrollTop() + |
261 container->layoutBox()->clientHeight())); | 261 container->layoutBox()->clientHeight())); |
262 dy = pixelsPerLineStep; | 262 dy = pixelsPerLineStep; |
263 break; | 263 break; |
264 default: | 264 default: |
265 ASSERT_NOT_REACHED(); | 265 ASSERT_NOT_REACHED(); |
266 return false; | 266 return false; |
267 } | 267 } |
268 | 268 |
269 container->layoutBox()->scrollByRecursively(IntSize(dx, dy)); | 269 container->layoutBox()->scrollByRecursively(ScrollOffset(dx, dy)); |
270 return true; | 270 return true; |
271 } | 271 } |
272 | 272 |
273 return false; | 273 return false; |
274 } | 274 } |
275 | 275 |
276 static void deflateIfOverlapped(LayoutRect& a, LayoutRect& b) { | 276 static void deflateIfOverlapped(LayoutRect& a, LayoutRect& b) { |
277 if (!a.intersects(b) || a.contains(b) || b.contains(a)) | 277 if (!a.intersects(b) || a.contains(b) || b.contains(a)) |
278 return; | 278 return; |
279 | 279 |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 ScrollbarMode verticalMode; | 360 ScrollbarMode verticalMode; |
361 ScrollbarMode horizontalMode; | 361 ScrollbarMode horizontalMode; |
362 frame->view()->calculateScrollbarModes(horizontalMode, verticalMode); | 362 frame->view()->calculateScrollbarModes(horizontalMode, verticalMode); |
363 if ((type == WebFocusTypeLeft || type == WebFocusTypeRight) && | 363 if ((type == WebFocusTypeLeft || type == WebFocusTypeRight) && |
364 ScrollbarAlwaysOff == horizontalMode) | 364 ScrollbarAlwaysOff == horizontalMode) |
365 return false; | 365 return false; |
366 if ((type == WebFocusTypeUp || type == WebFocusTypeDown) && | 366 if ((type == WebFocusTypeUp || type == WebFocusTypeDown) && |
367 ScrollbarAlwaysOff == verticalMode) | 367 ScrollbarAlwaysOff == verticalMode) |
368 return false; | 368 return false; |
369 LayoutSize size(frame->view()->contentsSize()); | 369 LayoutSize size(frame->view()->contentsSize()); |
370 LayoutSize offset(frame->view()->scrollOffset()); | 370 LayoutSize offset(frame->view()->scrollOffsetInt()); |
371 LayoutRect rect(frame->view()->visibleContentRect(IncludeScrollbars)); | 371 LayoutRect rect(frame->view()->visibleContentRect(IncludeScrollbars)); |
372 | 372 |
373 switch (type) { | 373 switch (type) { |
374 case WebFocusTypeLeft: | 374 case WebFocusTypeLeft: |
375 return offset.width() > 0; | 375 return offset.width() > 0; |
376 case WebFocusTypeUp: | 376 case WebFocusTypeUp: |
377 return offset.height() > 0; | 377 return offset.height() > 0; |
378 case WebFocusTypeRight: | 378 case WebFocusTypeRight: |
379 return rect.width() + offset.width() < size.width(); | 379 return rect.width() + offset.width() < size.width(); |
380 case WebFocusTypeDown: | 380 case WebFocusTypeDown: |
(...skipping 11 matching lines...) Expand all Loading... |
392 if (!frame->isLocalFrame()) | 392 if (!frame->isLocalFrame()) |
393 continue; | 393 continue; |
394 // FIXME: Spatial navigation is broken for OOPI. | 394 // FIXME: Spatial navigation is broken for OOPI. |
395 Element* element = frame->deprecatedLocalOwner(); | 395 Element* element = frame->deprecatedLocalOwner(); |
396 if (element) { | 396 if (element) { |
397 do { | 397 do { |
398 rect.move(element->offsetLeft(), element->offsetTop()); | 398 rect.move(element->offsetLeft(), element->offsetTop()); |
399 LayoutObject* layoutObject = element->layoutObject(); | 399 LayoutObject* layoutObject = element->layoutObject(); |
400 element = layoutObject ? layoutObject->offsetParent() : nullptr; | 400 element = layoutObject ? layoutObject->offsetParent() : nullptr; |
401 } while (element); | 401 } while (element); |
402 rect.move((-toLocalFrame(frame)->view()->scrollOffset())); | 402 rect.move((-toLocalFrame(frame)->view()->scrollOffsetInt())); |
403 } | 403 } |
404 } | 404 } |
405 return rect; | 405 return rect; |
406 } | 406 } |
407 | 407 |
408 LayoutRect nodeRectInAbsoluteCoordinates(Node* node, bool ignoreBorder) { | 408 LayoutRect nodeRectInAbsoluteCoordinates(Node* node, bool ignoreBorder) { |
409 ASSERT(node && node->layoutObject() && | 409 ASSERT(node && node->layoutObject() && |
410 !node->document().view()->needsLayout()); | 410 !node->document().view()->needsLayout()); |
411 | 411 |
412 if (node->isDocumentNode()) | 412 if (node->isDocumentNode()) |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
681 return rect; | 681 return rect; |
682 } | 682 } |
683 | 683 |
684 HTMLFrameOwnerElement* frameOwnerElement(FocusCandidate& candidate) { | 684 HTMLFrameOwnerElement* frameOwnerElement(FocusCandidate& candidate) { |
685 return candidate.isFrameOwnerElement() | 685 return candidate.isFrameOwnerElement() |
686 ? toHTMLFrameOwnerElement(candidate.visibleNode) | 686 ? toHTMLFrameOwnerElement(candidate.visibleNode) |
687 : nullptr; | 687 : nullptr; |
688 }; | 688 }; |
689 | 689 |
690 } // namespace blink | 690 } // namespace blink |
OLD | NEW |