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

Unified 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, 2 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/layout/LayoutBox.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutBox.cpp b/third_party/WebKit/Source/core/layout/LayoutBox.cpp
index 515cacad14698660e7c442b3bbd0d9c8a45405f9..309a961cfdeb756a4821fe34e31ee6ad0c4ebaab 100644
--- a/third_party/WebKit/Source/core/layout/LayoutBox.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutBox.cpp
@@ -1042,6 +1042,12 @@ LayoutBox* LayoutBox::findAutoscrollable(LayoutObject* layoutObject) {
while (
layoutObject &&
!(layoutObject->isBox() && toLayoutBox(layoutObject)->canAutoscroll())) {
+ // Do not start autoscroll when the node is inside a fixed-position element.
+ if (layoutObject->isBox() && toLayoutBox(layoutObject)->hasLayer() &&
+ toLayoutBox(layoutObject)->layer()->scrollsWithViewport()) {
+ return nullptr;
+ }
+
if (!layoutObject->parent() &&
layoutObject->node() == layoutObject->document() &&
layoutObject->document().localOwner())
@@ -1050,7 +1056,8 @@ LayoutBox* LayoutBox::findAutoscrollable(LayoutObject* layoutObject) {
layoutObject = layoutObject->parent();
}
- return layoutObject && layoutObject->isBox() ? toLayoutBox(layoutObject) : 0;
+ return layoutObject && layoutObject->isBox() ? toLayoutBox(layoutObject)
+ : nullptr;
}
static inline int adjustedScrollDelta(int beginningDelta) {
« 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