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

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

Issue 2455163002: Prevent AutoscrollForSelection when selecting text in a fixed-position element. (Closed)
Patch Set: 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
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/events/autoscroll-disabled-in-fix.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1024 matching lines...) Expand 10 before | Expand all | Expand 10 after
1035 else if (windowAutoscrollPoint.y() > windowBox.maxY() - autoscrollBeltSize) 1035 else if (windowAutoscrollPoint.y() > windowBox.maxY() - autoscrollBeltSize)
1036 windowAutoscrollPoint.move(0, autoscrollBeltSize); 1036 windowAutoscrollPoint.move(0, autoscrollBeltSize);
1037 1037
1038 return windowAutoscrollPoint - pointInRootFrame; 1038 return windowAutoscrollPoint - pointInRootFrame;
1039 } 1039 }
1040 1040
1041 LayoutBox* LayoutBox::findAutoscrollable(LayoutObject* layoutObject) { 1041 LayoutBox* LayoutBox::findAutoscrollable(LayoutObject* layoutObject) {
1042 while ( 1042 while (
1043 layoutObject && 1043 layoutObject &&
1044 !(layoutObject->isBox() && toLayoutBox(layoutObject)->canAutoscroll())) { 1044 !(layoutObject->isBox() && toLayoutBox(layoutObject)->canAutoscroll())) {
1045 // Do not start autoscroll when the node is inside a fixed-position element.
1046 if (layoutObject->isBox() && toLayoutBox(layoutObject)->hasLayer() &&
1047 toLayoutBox(layoutObject)->layer()->scrollsWithViewport()) {
1048 return nullptr;
1049 }
1050
1045 if (!layoutObject->parent() && 1051 if (!layoutObject->parent() &&
1046 layoutObject->node() == layoutObject->document() && 1052 layoutObject->node() == layoutObject->document() &&
1047 layoutObject->document().localOwner()) 1053 layoutObject->document().localOwner())
1048 layoutObject = layoutObject->document().localOwner()->layoutObject(); 1054 layoutObject = layoutObject->document().localOwner()->layoutObject();
1049 else 1055 else
1050 layoutObject = layoutObject->parent(); 1056 layoutObject = layoutObject->parent();
1051 } 1057 }
1052 1058
1053 return layoutObject && layoutObject->isBox() ? toLayoutBox(layoutObject) : 0; 1059 return layoutObject && layoutObject->isBox() ? toLayoutBox(layoutObject)
1060 : nullptr;
1054 } 1061 }
1055 1062
1056 static inline int adjustedScrollDelta(int beginningDelta) { 1063 static inline int adjustedScrollDelta(int beginningDelta) {
1057 // This implemention matches Firefox's. 1064 // This implemention matches Firefox's.
1058 // http://mxr.mozilla.org/firefox/source/toolkit/content/widgets/browser.xml#8 56. 1065 // http://mxr.mozilla.org/firefox/source/toolkit/content/widgets/browser.xml#8 56.
1059 const int speedReducer = 12; 1066 const int speedReducer = 12;
1060 1067
1061 int adjustedDelta = beginningDelta / speedReducer; 1068 int adjustedDelta = beginningDelta / speedReducer;
1062 if (adjustedDelta > 1) 1069 if (adjustedDelta > 1)
1063 adjustedDelta = static_cast<int>(adjustedDelta * 1070 adjustedDelta = static_cast<int>(adjustedDelta *
(...skipping 4568 matching lines...) Expand 10 before | Expand all | Expand 10 after
5632 LayoutRect rect = frameRect(); 5639 LayoutRect rect = frameRect();
5633 5640
5634 LayoutBlock* block = containingBlock(); 5641 LayoutBlock* block = containingBlock();
5635 if (block) 5642 if (block)
5636 block->adjustChildDebugRect(rect); 5643 block->adjustChildDebugRect(rect);
5637 5644
5638 return rect; 5645 return rect;
5639 } 5646 }
5640 5647
5641 } // namespace blink 5648 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/events/autoscroll-disabled-in-fix.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698