| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv
ed. | 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv
ed. |
| 3 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) | 3 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) |
| 4 * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies) | 4 * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies) |
| 5 * | 5 * |
| 6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
| 7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
| 8 * are met: | 8 * are met: |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 624 controller->stopAutoscroll(); | 624 controller->stopAutoscroll(); |
| 625 } | 625 } |
| 626 | 626 |
| 627 ScrollResult EventHandler::scrollBox(LayoutBox* box, | 627 ScrollResult EventHandler::scrollBox(LayoutBox* box, |
| 628 ScrollGranularity granularity, const FloatSize& delta, | 628 ScrollGranularity granularity, const FloatSize& delta, |
| 629 const FloatPoint& position, const FloatSize& velocity, | 629 const FloatPoint& position, const FloatSize& velocity, |
| 630 bool* wasRootScroller) | 630 bool* wasRootScroller) |
| 631 { | 631 { |
| 632 ASSERT(box); | 632 ASSERT(box); |
| 633 Node* node = box->node(); | 633 Node* node = box->node(); |
| 634 Document* document = m_frame->document(); | |
| 635 Element* scrollingElement = document->scrollingElement(); | |
| 636 | |
| 637 bool isRootFrame = !document->ownerElement(); | |
| 638 | |
| 639 // TODO(bokan): If the ViewportScrollCallback is installed on the body, we | |
| 640 // can still hit the HTML element for scrolling in which case it'll bubble | |
| 641 // up to the document node and try to scroll the LayoutView directly. Make | |
| 642 // sure we never scroll the LayoutView like this by manually resetting the | |
| 643 // scroll to happen on the scrolling element. This can also happen in | |
| 644 // QuirksMode when the body is scrollable and scrollingElement == nullptr. | |
| 645 if (node && node->isDocumentNode() && isRootFrame) { | |
| 646 node = scrollingElement | |
| 647 ? scrollingElement | |
| 648 : document->documentElement(); | |
| 649 } | |
| 650 | 634 |
| 651 // If there's no ApplyScroll callback on the element, scroll as usuall in | 635 // If there's no ApplyScroll callback on the element, scroll as usuall in |
| 652 // the non-scroll-customization case. | 636 // the non-scroll-customization case. |
| 653 if (!node || !node->isElementNode() || !toElement(node)->getApplyScroll()) { | 637 if (!node || !node->isElementNode() || !toElement(node)->getApplyScroll()) { |
| 654 ASSERT(!isRootFrame | |
| 655 || node != scrollingElement | |
| 656 || (!scrollingElement && node != document->documentElement())); | |
| 657 *wasRootScroller = false; | 638 *wasRootScroller = false; |
| 658 return box->scroll(granularity, delta); | 639 return box->scroll(granularity, delta); |
| 659 } | 640 } |
| 660 | 641 |
| 661 ASSERT(isRootFrame); | 642 // Viewport actions should only happen when scrolling an element in the |
| 643 // main frame. |
| 644 ASSERT(m_frame->isMainFrame()); |
| 662 | 645 |
| 663 // If there is an ApplyScroll callback, its because we placed one on the | 646 // If there is an ApplyScroll callback, its because we placed one on the |
| 664 // root scroller to control top controls and overscroll. Invoke a scroll | 647 // root scroller to control top controls and overscroll. Invoke a scroll |
| 665 // using parts of the scroll customization framework on just this element. | 648 // using parts of the scroll customization framework on just this element. |
| 666 computeScrollChainForSingleNode(*node, m_currentScrollChain); | 649 computeScrollChainForSingleNode(*node, m_currentScrollChain); |
| 667 | 650 |
| 668 OwnPtr<ScrollStateData> scrollStateData = adoptPtr(new ScrollStateData()); | 651 OwnPtr<ScrollStateData> scrollStateData = adoptPtr(new ScrollStateData()); |
| 669 scrollStateData->delta_x = delta.width(); | 652 scrollStateData->delta_x = delta.width(); |
| 670 scrollStateData->delta_y = delta.height(); | 653 scrollStateData->delta_y = delta.height(); |
| 671 scrollStateData->position_x = position.x(); | 654 scrollStateData->position_x = position.x(); |
| (...skipping 3449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4121 PlatformEvent::Modifiers EventHandler::accessKeyModifiers() | 4104 PlatformEvent::Modifiers EventHandler::accessKeyModifiers() |
| 4122 { | 4105 { |
| 4123 #if OS(MACOSX) | 4106 #if OS(MACOSX) |
| 4124 return static_cast<PlatformEvent::Modifiers>(PlatformEvent::CtrlKey | Platfo
rmEvent::AltKey); | 4107 return static_cast<PlatformEvent::Modifiers>(PlatformEvent::CtrlKey | Platfo
rmEvent::AltKey); |
| 4125 #else | 4108 #else |
| 4126 return PlatformEvent::AltKey; | 4109 return PlatformEvent::AltKey; |
| 4127 #endif | 4110 #endif |
| 4128 } | 4111 } |
| 4129 | 4112 |
| 4130 } // namespace blink | 4113 } // namespace blink |
| OLD | NEW |