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

Side by Side Diff: Source/core/page/EventHandler.cpp

Issue 1147283002: Add ScrollDirectionPhysical enum in Scroll types. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 7 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 924 matching lines...) Expand 10 before | Expand all | Expand 10 after
935 node = m_frame->document()->focusedElement(); 935 node = m_frame->document()->focusedElement();
936 936
937 if (!node) 937 if (!node)
938 node = m_mousePressNode.get(); 938 node = m_mousePressNode.get();
939 939
940 if (!node || !node->layoutObject()) 940 if (!node || !node->layoutObject())
941 return false; 941 return false;
942 942
943 LayoutBox* curBox = node->layoutObject()->enclosingBox(); 943 LayoutBox* curBox = node->layoutObject()->enclosingBox();
944 while (curBox && !curBox->isLayoutView()) { 944 while (curBox && !curBox->isLayoutView()) {
945 ScrollDirection physicalDirection = toPhysicalDirection( 945 ScrollDirectionPhysical physicalDirection = toPhysicalDirection(
946 direction, curBox->isHorizontalWritingMode(), curBox->style()->isFli ppedBlocksWritingMode()); 946 direction, curBox->isHorizontalWritingMode(), curBox->style()->isFli ppedBlocksWritingMode());
947 947
948 // If we're at the stopNode, we should try to scroll it but we shouldn't bubble past it 948 // If we're at the stopNode, we should try to scroll it but we shouldn't bubble past it
949 bool shouldStopBubbling = stopNode && *stopNode && curBox->node() == *st opNode; 949 bool shouldStopBubbling = stopNode && *stopNode && curBox->node() == *st opNode;
950 bool didScroll = curBox->scroll(physicalDirection, granularity, delta); 950 bool didScroll = curBox->scroll(physicalDirection, granularity, delta);
951 951
952 if (didScroll && stopNode) 952 if (didScroll && stopNode)
953 *stopNode = curBox->node(); 953 *stopNode = curBox->node();
954 954
955 if (didScroll || shouldStopBubbling) { 955 if (didScroll || shouldStopBubbling) {
(...skipping 21 matching lines...) Expand all
977 bool EventHandler::bubblingScroll(ScrollDirection direction, ScrollGranularity g ranularity, Node* startingNode) 977 bool EventHandler::bubblingScroll(ScrollDirection direction, ScrollGranularity g ranularity, Node* startingNode)
978 { 978 {
979 // The layout needs to be up to date to determine if we can scroll. We may b e 979 // The layout needs to be up to date to determine if we can scroll. We may b e
980 // here because of an onLoad event, in which case the final layout hasn't be en performed yet. 980 // here because of an onLoad event, in which case the final layout hasn't be en performed yet.
981 m_frame->document()->updateLayoutIgnorePendingStylesheets(); 981 m_frame->document()->updateLayoutIgnorePendingStylesheets();
982 // FIXME: enable scroll customization in this case. See crbug.com/410974. 982 // FIXME: enable scroll customization in this case. See crbug.com/410974.
983 if (scroll(direction, granularity, startingNode)) 983 if (scroll(direction, granularity, startingNode))
984 return true; 984 return true;
985 LocalFrame* frame = m_frame; 985 LocalFrame* frame = m_frame;
986 FrameView* view = frame->view(); 986 FrameView* view = frame->view();
987 if (view && view->scrollableArea()->scroll(direction, granularity)) { 987 ScrollDirectionPhysical physicalDirection =
988 toPhysicalDirection(direction, view->isVerticalDocument(), view->isFlipp edDocument());
989 if (view && view->scrollableArea()->scroll(physicalDirection, granularity)) {
988 setFrameWasScrolledByUser(); 990 setFrameWasScrolledByUser();
989 return true; 991 return true;
990 } 992 }
991 Frame* parentFrame = frame->tree().parent(); 993 Frame* parentFrame = frame->tree().parent();
992 if (!parentFrame || !parentFrame->isLocalFrame()) 994 if (!parentFrame || !parentFrame->isLocalFrame())
993 return false; 995 return false;
994 // FIXME: Broken for OOPI. 996 // FIXME: Broken for OOPI.
995 return toLocalFrame(parentFrame)->eventHandler().bubblingScroll(direction, g ranularity, m_frame->deprecatedLocalOwner()); 997 return toLocalFrame(parentFrame)->eventHandler().bubblingScroll(direction, g ranularity, m_frame->deprecatedLocalOwner());
996 } 998 }
997 999
(...skipping 2645 matching lines...) Expand 10 before | Expand all | Expand 10 after
3643 // FIXME: enable scroll customization in this case. See crbug.com/410974. 3645 // FIXME: enable scroll customization in this case. See crbug.com/410974.
3644 if (scroll(direction, ScrollByPage)) { 3646 if (scroll(direction, ScrollByPage)) {
3645 event->setDefaultHandled(); 3647 event->setDefaultHandled();
3646 return; 3648 return;
3647 } 3649 }
3648 3650
3649 FrameView* view = m_frame->view(); 3651 FrameView* view = m_frame->view();
3650 if (!view) 3652 if (!view)
3651 return; 3653 return;
3652 3654
3653 ScrollDirection physicalDirection = 3655 ScrollDirectionPhysical physicalDirection =
3654 toPhysicalDirection(direction, view->isVerticalDocument(), view->isFlipp edDocument()); 3656 toPhysicalDirection(direction, view->isVerticalDocument(), view->isFlipp edDocument());
3655 3657
3656 if (view->scrollableArea()->scroll(physicalDirection, ScrollByPage)) 3658 if (view->scrollableArea()->scroll(physicalDirection, ScrollByPage))
3657 event->setDefaultHandled(); 3659 event->setDefaultHandled();
3658 } 3660 }
3659 3661
3660 void EventHandler::defaultBackspaceEventHandler(KeyboardEvent* event) 3662 void EventHandler::defaultBackspaceEventHandler(KeyboardEvent* event)
3661 { 3663 {
3662 ASSERT(event->type() == EventTypeNames::keydown); 3664 ASSERT(event->type() == EventTypeNames::keydown);
3663 3665
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after
4169 unsigned EventHandler::accessKeyModifiers() 4171 unsigned EventHandler::accessKeyModifiers()
4170 { 4172 {
4171 #if OS(MACOSX) 4173 #if OS(MACOSX)
4172 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; 4174 return PlatformEvent::CtrlKey | PlatformEvent::AltKey;
4173 #else 4175 #else
4174 return PlatformEvent::AltKey; 4176 return PlatformEvent::AltKey;
4175 #endif 4177 #endif
4176 } 4178 }
4177 4179
4178 } // namespace blink 4180 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698