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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutBox.cpp

Issue 2484563003: Determine the layoutobject of middleClickAutoscroll by the scroll direction. (Closed)
Patch Set: Rename Created 4 years, 1 month 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) 2005 Allan Sandfeld Jensen (kde@carewolf.com) 4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com)
5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com)
6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc.
7 * All rights reserved. 7 * All rights reserved.
8 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. 8 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved.
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 1065 matching lines...) Expand 10 before | Expand all | Expand 10 after
1076 previousMousePosition = lastKnownMousePosition; 1076 previousMousePosition = lastKnownMousePosition;
1077 1077
1078 IntSize delta = lastKnownMousePosition - sourcePoint; 1078 IntSize delta = lastKnownMousePosition - sourcePoint;
1079 1079
1080 // at the center we let the space for the icon. 1080 // at the center we let the space for the icon.
1081 if (abs(delta.width()) <= AutoscrollController::noMiddleClickAutoscrollRadius) 1081 if (abs(delta.width()) <= AutoscrollController::noMiddleClickAutoscrollRadius)
1082 delta.setWidth(0); 1082 delta.setWidth(0);
1083 if (abs(delta.height()) <= 1083 if (abs(delta.height()) <=
1084 AutoscrollController::noMiddleClickAutoscrollRadius) 1084 AutoscrollController::noMiddleClickAutoscrollRadius)
1085 delta.setHeight(0); 1085 delta.setHeight(0);
1086 scroll(ScrollByPixel, FloatSize(adjustedScrollDelta(delta))); 1086 ScrollResult result =
1087 scroll(ScrollByPixel, FloatSize(adjustedScrollDelta(delta)));
1088 AutoscrollController& autoscrollController =
1089 frame->page()->autoscrollController();
1090
1091 if (!delta.isZero() && !result.didScroll()) {
bokan 2016/11/09 15:34:10 We should put all this logic inside AutoscrollCont
1092 LayoutObject* layoutObject = this;
1093 if (node() && node()->isDocumentNode()) {
1094 Element* owner = toDocument(layoutObject->node())->localOwner();
1095 layoutObject = owner ? owner->layoutObject() : nullptr;
1096 } else {
1097 layoutObject = parent();
1098 }
1099 while (layoutObject &&
1100 (!layoutObject->isBox() ||
1101 !toLayoutBox(layoutObject)->canBeScrolledAndHasScrollableArea())) {
1102 if (layoutObject->node() && layoutObject->node()->isDocumentNode()) {
bokan 2016/11/09 15:34:10 This will just pick the next scroller up in the hi
1103 Element* owner = toDocument(layoutObject->node())->localOwner();
1104 layoutObject = owner ? owner->layoutObject() : nullptr;
1105 } else {
1106 layoutObject = layoutObject->parent();
1107 }
1108 }
1109 if (autoscrollController.setMiddleClickAutoscrollLayoutObject(
1110 toLayoutBox(layoutObject))) {
1111 toLayoutBox(layoutObject)->middleClickAutoscroll(sourcePoint);
1112 }
1113 } else if (result.didScroll()) {
1114 autoscrollController.setMiddleClickAutoscrolled(true);
1115 }
1087 } 1116 }
1088 1117
1089 void LayoutBox::scrollByRecursively(const ScrollOffset& delta) { 1118 void LayoutBox::scrollByRecursively(const ScrollOffset& delta) {
1090 if (delta.isZero()) 1119 if (delta.isZero())
1091 return; 1120 return;
1092 1121
1093 bool restrictedByLineClamp = false; 1122 bool restrictedByLineClamp = false;
1094 if (parent()) 1123 if (parent())
1095 restrictedByLineClamp = !parent()->style()->lineClamp().isNone(); 1124 restrictedByLineClamp = !parent()->style()->lineClamp().isNone();
1096 1125
(...skipping 4541 matching lines...) Expand 10 before | Expand all | Expand 10 after
5638 LayoutRect rect = frameRect(); 5667 LayoutRect rect = frameRect();
5639 5668
5640 LayoutBlock* block = containingBlock(); 5669 LayoutBlock* block = containingBlock();
5641 if (block) 5670 if (block)
5642 block->adjustChildDebugRect(rect); 5671 block->adjustChildDebugRect(rect);
5643 5672
5644 return rect; 5673 return rect;
5645 } 5674 }
5646 5675
5647 } // namespace blink 5676 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698