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

Side by Side Diff: third_party/WebKit/Source/core/input/EventHandler.cpp

Issue 1895323002: Viewport apply scroll should be on the document element not scrollingElement. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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) 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 615 matching lines...) Expand 10 before | Expand all | Expand 10 after
626 controller->stopAutoscroll(); 626 controller->stopAutoscroll();
627 } 627 }
628 628
629 ScrollResult EventHandler::scrollBox(LayoutBox* box, 629 ScrollResult EventHandler::scrollBox(LayoutBox* box,
630 ScrollGranularity granularity, const FloatSize& delta, 630 ScrollGranularity granularity, const FloatSize& delta,
631 const FloatPoint& position, const FloatSize& velocity, 631 const FloatPoint& position, const FloatSize& velocity,
632 bool* wasRootScroller) 632 bool* wasRootScroller)
633 { 633 {
634 ASSERT(box); 634 ASSERT(box);
635 Node* node = box->node(); 635 Node* node = box->node();
636 Document* document = m_frame->document();
637 Element* scrollingElement = document->scrollingElement();
638
639 bool isRootFrame = !document->ownerElement();
640
641 // TODO(bokan): If the ViewportScrollCallback is installed on the body, we
642 // can still hit the HTML element for scrolling in which case it'll bubble
643 // up to the document node and try to scroll the LayoutView directly. Make
644 // sure we never scroll the LayoutView like this by manually resetting the
645 // scroll to happen on the scrolling element. This can also happen in
646 // QuirksMode when the body is scrollable and scrollingElement == nullptr.
647 if (node && node->isDocumentNode() && isRootFrame) {
648 node = scrollingElement
649 ? scrollingElement
650 : document->documentElement();
651 }
652 636
653 // If there's no ApplyScroll callback on the element, scroll as usuall in 637 // If there's no ApplyScroll callback on the element, scroll as usuall in
654 // the non-scroll-customization case. 638 // the non-scroll-customization case.
655 if (!node || !node->isElementNode() || !toElement(node)->getApplyScroll()) { 639 if (!node || !node->isElementNode() || !toElement(node)->getApplyScroll()) {
656 ASSERT(!isRootFrame
657 || node != scrollingElement
658 || (!scrollingElement && node != document->documentElement()));
659 *wasRootScroller = false; 640 *wasRootScroller = false;
660 return box->scroll(granularity, delta); 641 return box->scroll(granularity, delta);
661 } 642 }
662 643
663 ASSERT(isRootFrame); 644 // Viewport actions should only happen when scrolling an element in the
645 // main frame.
646 ASSERT(m_frame->isMainFrame());
664 647
665 // If there is an ApplyScroll callback, its because we placed one on the 648 // If there is an ApplyScroll callback, its because we placed one on the
666 // root scroller to control top controls and overscroll. Invoke a scroll 649 // root scroller to control top controls and overscroll. Invoke a scroll
667 // using parts of the scroll customization framework on just this element. 650 // using parts of the scroll customization framework on just this element.
668 computeScrollChainForSingleNode(*node, m_currentScrollChain); 651 computeScrollChainForSingleNode(*node, m_currentScrollChain);
669 652
670 OwnPtr<ScrollStateData> scrollStateData = adoptPtr(new ScrollStateData()); 653 OwnPtr<ScrollStateData> scrollStateData = adoptPtr(new ScrollStateData());
671 scrollStateData->delta_x = delta.width(); 654 scrollStateData->delta_x = delta.width();
672 scrollStateData->delta_y = delta.height(); 655 scrollStateData->delta_y = delta.height();
673 scrollStateData->position_x = position.x(); 656 scrollStateData->position_x = position.x();
(...skipping 3475 matching lines...) Expand 10 before | Expand all | Expand 10 after
4149 PlatformEvent::Modifiers EventHandler::accessKeyModifiers() 4132 PlatformEvent::Modifiers EventHandler::accessKeyModifiers()
4150 { 4133 {
4151 #if OS(MACOSX) 4134 #if OS(MACOSX)
4152 return static_cast<PlatformEvent::Modifiers>(PlatformEvent::CtrlKey | Platfo rmEvent::AltKey); 4135 return static_cast<PlatformEvent::Modifiers>(PlatformEvent::CtrlKey | Platfo rmEvent::AltKey);
4153 #else 4136 #else
4154 return PlatformEvent::AltKey; 4137 return PlatformEvent::AltKey;
4155 #endif 4138 #endif
4156 } 4139 }
4157 4140
4158 } // namespace blink 4141 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698