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

Side by Side Diff: third_party/WebKit/Source/core/dom/Node.cpp

Issue 2289213002: Implement Middle Click Autoscroll on all platforms not just Windows (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge branch 'master' of https://chromium.googlesource.com/chromium/src into panscroll Created 4 years, 3 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) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved. 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved.
6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 2054 matching lines...) Expand 10 before | Expand all | Expand 10 after
2065 if (dispatchDOMActivateEvent(detail, event) != DispatchEventResult::NotC anceled) 2065 if (dispatchDOMActivateEvent(detail, event) != DispatchEventResult::NotC anceled)
2066 event->setDefaultHandled(); 2066 event->setDefaultHandled();
2067 } else if (eventType == EventTypeNames::contextmenu) { 2067 } else if (eventType == EventTypeNames::contextmenu) {
2068 if (Page* page = document().page()) 2068 if (Page* page = document().page())
2069 page->contextMenuController().handleContextMenuEvent(event); 2069 page->contextMenuController().handleContextMenuEvent(event);
2070 } else if (eventType == EventTypeNames::textInput) { 2070 } else if (eventType == EventTypeNames::textInput) {
2071 if (event->hasInterface(EventNames::TextEvent)) { 2071 if (event->hasInterface(EventNames::TextEvent)) {
2072 if (LocalFrame* frame = document().frame()) 2072 if (LocalFrame* frame = document().frame())
2073 frame->eventHandler().defaultTextInputEventHandler(toTextEvent(e vent)); 2073 frame->eventHandler().defaultTextInputEventHandler(toTextEvent(e vent));
2074 } 2074 }
2075 #if OS(WIN) 2075 } else if (RuntimeEnabledFeatures::middleClickAutoscrollEnabled()
2076 } else if (eventType == EventTypeNames::mousedown && event->isMouseEvent()) { 2076 && eventType == EventTypeNames::mousedown
2077 && event->isMouseEvent()) {
2077 MouseEvent* mouseEvent = toMouseEvent(event); 2078 MouseEvent* mouseEvent = toMouseEvent(event);
2078 if (mouseEvent->button() == static_cast<short>(WebPointerProperties::But ton::Middle)) { 2079 if (mouseEvent->button() == static_cast<short>(WebPointerProperties::But ton::Middle)) {
2079 if (enclosingLinkEventParentOrSelf()) 2080 if (enclosingLinkEventParentOrSelf())
2080 return; 2081 return;
2081 2082
2082 // Avoid that canBeScrolledAndHasScrollableArea changes layout tree 2083 // Avoid that canBeScrolledAndHasScrollableArea changes layout tree
2083 // structure. 2084 // structure.
2084 // FIXME: We should avoid synchronous layout if possible. We can 2085 // FIXME: We should avoid synchronous layout if possible. We can
2085 // remove this synchronous layout if we avoid synchronous layout in 2086 // remove this synchronous layout if we avoid synchronous layout in
2086 // LayoutTextControlSingleLine::scrollHeight 2087 // LayoutTextControlSingleLine::scrollHeight
2087 document().updateStyleAndLayoutIgnorePendingStylesheets(); 2088 document().updateStyleAndLayoutIgnorePendingStylesheets();
2088 LayoutObject* layoutObject = this->layoutObject(); 2089 LayoutObject* layoutObject = this->layoutObject();
2089 while (layoutObject && (!layoutObject->isBox() || !toLayoutBox(layou tObject)->canBeScrolledAndHasScrollableArea())) 2090 while (layoutObject && (!layoutObject->isBox() || !toLayoutBox(layou tObject)->canBeScrolledAndHasScrollableArea()))
2090 layoutObject = layoutObject->parent(); 2091 layoutObject = layoutObject->parent();
2091 2092
2092 if (layoutObject) { 2093 if (layoutObject) {
2093 if (LocalFrame* frame = document().frame()) 2094 if (LocalFrame* frame = document().frame())
2094 frame->eventHandler().startPanScrolling(layoutObject); 2095 frame->eventHandler().startMiddleClickAutoscroll(layoutObjec t);
2095 } 2096 }
2096 } 2097 }
2097 #endif
2098 } else if (event->type() == EventTypeNames::webkitEditableContentChanged) { 2098 } else if (event->type() == EventTypeNames::webkitEditableContentChanged) {
2099 // TODO(chongz): Remove after shipped. 2099 // TODO(chongz): Remove after shipped.
2100 // New InputEvent are dispatched in Editor::appliedEditing, etc. 2100 // New InputEvent are dispatched in Editor::appliedEditing, etc.
2101 if (!RuntimeEnabledFeatures::inputEventEnabled()) 2101 if (!RuntimeEnabledFeatures::inputEventEnabled())
2102 dispatchInputEvent(); 2102 dispatchInputEvent();
2103 } 2103 }
2104 } 2104 }
2105 2105
2106 void Node::willCallDefaultEventHandler(const Event&) 2106 void Node::willCallDefaultEventHandler(const Event&)
2107 { 2107 {
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
2411 if (node) { 2411 if (node) {
2412 std::stringstream stream; 2412 std::stringstream stream;
2413 node->printNodePathTo(stream); 2413 node->printNodePathTo(stream);
2414 LOG(INFO) << stream.str(); 2414 LOG(INFO) << stream.str();
2415 } else { 2415 } else {
2416 LOG(INFO) << "Cannot showNodePath for <null>"; 2416 LOG(INFO) << "Cannot showNodePath for <null>";
2417 } 2417 }
2418 } 2418 }
2419 2419
2420 #endif 2420 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/ManualTests/panScroll.html ('k') | third_party/WebKit/Source/core/frame/UseCounter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698