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

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

Issue 2069713002: Make all gesture scrolls use customization path internally (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Gesture scrolls are now on scroll customization path Created 4 years, 6 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 Peter Kelly (pmk@post.com) 4 * (C) 2001 Peter Kelly (pmk@post.com)
5 * (C) 2001 Dirk Mueller (mueller@kde.org) 5 * (C) 2001 Dirk Mueller (mueller@kde.org)
6 * (C) 2007 David Smith (catfish.man@gmail.com) 6 * (C) 2007 David Smith (catfish.man@gmail.com)
7 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc. All rights reserved. 7 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc. All rights reserved.
8 * (C) 2007 Eric Seidel (eric@webkit.org) 8 * (C) 2007 Eric Seidel (eric@webkit.org)
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 520 matching lines...) Expand 10 before | Expand all | Expand 10 after
531 if (callback->nativeScrollBehavior() != WebNativeScrollBehavior::PerformAfte rNativeScroll) 531 if (callback->nativeScrollBehavior() != WebNativeScrollBehavior::PerformAfte rNativeScroll)
532 callback->handleEvent(&scrollState); 532 callback->handleEvent(&scrollState);
533 if (callback->nativeScrollBehavior() != WebNativeScrollBehavior::DisableNati veScroll) 533 if (callback->nativeScrollBehavior() != WebNativeScrollBehavior::DisableNati veScroll)
534 nativeDistributeScroll(scrollState); 534 nativeDistributeScroll(scrollState);
535 if (callback->nativeScrollBehavior() == WebNativeScrollBehavior::PerformAfte rNativeScroll) 535 if (callback->nativeScrollBehavior() == WebNativeScrollBehavior::PerformAfte rNativeScroll)
536 callback->handleEvent(&scrollState); 536 callback->handleEvent(&scrollState);
537 }; 537 };
538 538
539 void Element::nativeApplyScroll(ScrollState& scrollState) 539 void Element::nativeApplyScroll(ScrollState& scrollState)
540 { 540 {
541 DCHECK(RuntimeEnabledFeatures::scrollCustomizationEnabled());
542
543 // All elements in the scroll chain should be boxes. 541 // All elements in the scroll chain should be boxes.
544 DCHECK(!layoutObject() || layoutObject()->isBox()); 542 DCHECK(!layoutObject() || layoutObject()->isBox());
545 543
546 if (scrollState.fullyConsumed()) 544 if (scrollState.fullyConsumed())
547 return; 545 return;
548 546
549 FloatSize delta(scrollState.deltaX(), scrollState.deltaY()); 547 FloatSize delta(scrollState.deltaX(), scrollState.deltaY());
550 548
551 if (delta.isZero()) 549 if (delta.isZero())
552 return; 550 return;
553 551
554 // TODO(esprehn): This should use updateStyleAndLayoutIgnorePendingStyleshee tsForNode. 552 // TODO(esprehn): This should use updateStyleAndLayoutIgnorePendingStyleshee tsForNode.
555 document().updateStyleAndLayoutIgnorePendingStylesheets(); 553 document().updateStyleAndLayoutIgnorePendingStylesheets();
556 554
557 LayoutBox* boxToScroll = nullptr; 555 LayoutBox* boxToScroll = nullptr;
558 556
559 // Handle the scrollingElement separately, as it should scroll the viewport. 557 // We should only ever scroll the effective root scroller this way when the
560 if (this == document().scrollingElement()) 558 // page removes the default applyScroll (ViewportScrollCallback).
559 if (document().effectiveRootScroller() == this)
tdresser 2016/06/23 14:34:29 Nit: we don't normally use yoda style conditionals
bokan 2016/06/23 16:12:30 Hah, never heard yoda conditionals before :) Woul
tdresser 2016/06/23 16:16:51 Hmmm, I was thinking about it the other way, but I
561 boxToScroll = document().layoutView(); 560 boxToScroll = document().layoutView();
562 else if (layoutObject()) 561 else if (layoutObject())
563 boxToScroll = toLayoutBox(layoutObject()); 562 boxToScroll = toLayoutBox(layoutObject());
564 563
565 if (!boxToScroll) 564 if (!boxToScroll)
566 return; 565 return;
567 566
568 ScrollResult result = 567 ScrollResult result =
569 LayoutBoxItem(boxToScroll).enclosingBox().scroll( 568 LayoutBoxItem(boxToScroll).enclosingBox().scroll(
570 ScrollByPrecisePixel, 569 ScrollGranularity(static_cast<int>(scrollState.deltaGranularity())),
571 delta); 570 delta);
572 571
573 if (!result.didScroll()) 572 if (!result.didScroll())
574 return; 573 return;
575 574
576 // FIXME: Native scrollers should only consume the scroll they 575 // FIXME: Native scrollers should only consume the scroll they
577 // apply. See crbug.com/457765. 576 // apply. See crbug.com/457765.
578 scrollState.consumeDeltaNative(delta.width(), delta.height()); 577 scrollState.consumeDeltaNative(delta.width(), delta.height());
579 578
580 // We need to setCurrentNativeScrollingElement in both the 579 // We need to setCurrentNativeScrollingElement in both the
(...skipping 3136 matching lines...) Expand 10 before | Expand all | Expand 10 after
3717 3716
3718 DEFINE_TRACE_WRAPPERS(Element) 3717 DEFINE_TRACE_WRAPPERS(Element)
3719 { 3718 {
3720 if (hasRareData()) { 3719 if (hasRareData()) {
3721 visitor->traceWrappers(elementRareData()); 3720 visitor->traceWrappers(elementRareData());
3722 } 3721 }
3723 ContainerNode::traceWrappers(visitor); 3722 ContainerNode::traceWrappers(visitor);
3724 } 3723 }
3725 3724
3726 } // namespace blink 3725 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698