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

Unified Diff: Source/core/dom/Element.cpp

Issue 1239993005: Revert of Expose scroll customization for touch to JS (behind REF). (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 5 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 | « Source/core/dom/Element.h ('k') | Source/core/dom/Element.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/Element.cpp
diff --git a/Source/core/dom/Element.cpp b/Source/core/dom/Element.cpp
index f635b5d48fe2260f689530a8f06435e86abaa3c7..9b72286ae6c846cfcce1055b957dd715018fe121 100644
--- a/Source/core/dom/Element.cpp
+++ b/Source/core/dom/Element.cpp
@@ -112,9 +112,7 @@
#include "core/page/Page.h"
#include "core/page/PointerLockController.h"
#include "core/page/SpatialNavigation.h"
-#include "core/page/scrolling/ScrollCustomizationCallbacks.h"
#include "core/page/scrolling/ScrollState.h"
-#include "core/page/scrolling/ScrollStateCallback.h"
#include "core/paint/DeprecatedPaintLayer.h"
#include "core/svg/SVGDocumentExtensions.h"
#include "core/svg/SVGElement.h"
@@ -130,25 +128,6 @@
namespace blink {
-namespace {
-
-// We need to retain the scroll customization callbacks until the element
-// they're associated with is destroyed. It would be simplest if the callbacks
-// could be stored in ElementRareData, but we can't afford the space
-// increase. Instead, keep the scroll customization callbacks here. The other
-// option would be to store these callbacks on the FrameHost or document, but
-// that necessitates a bunch more logic for transferring the callbacks between
-// FrameHosts when elements are moved around.
-ScrollCustomizationCallbacks& scrollCustomizationCallbacks()
-{
- ASSERT(RuntimeEnabledFeatures::scrollCustomizationEnabled());
- DEFINE_STATIC_LOCAL(Persistent<ScrollCustomizationCallbacks>,
- scrollCustomizationCallbacks, (new ScrollCustomizationCallbacks()));
- return *scrollCustomizationCallbacks;
-}
-
-} // namespace
-
using namespace HTMLNames;
using namespace XMLNames;
@@ -175,9 +154,6 @@
if (isCustomElement())
CustomElement::wasDestroyed(this);
-
- if (RuntimeEnabledFeatures::scrollCustomizationEnabled())
- scrollCustomizationCallbacks().removeCallbacksForElement(this);
// With Oilpan, either the Element has been removed from the Document
// or the Document is dead as well. If the Element has been removed from
@@ -494,19 +470,7 @@
layoutObject()->scrollRectToVisible(bounds, ScrollAlignment::alignToEdgeIfNeeded, ScrollAlignment::alignToEdgeIfNeeded);
}
-void Element::setDistributeScroll(ScrollStateCallback* scrollStateCallback, String nativeScrollBehavior)
-{
- scrollStateCallback->setNativeScrollBehavior(ScrollStateCallback::toNativeScrollBehavior(nativeScrollBehavior));
- scrollCustomizationCallbacks().setDistributeScroll(this, scrollStateCallback);
-}
-
-void Element::setApplyScroll(ScrollStateCallback* scrollStateCallback, String nativeScrollBehavior)
-{
- scrollStateCallback->setNativeScrollBehavior(ScrollStateCallback::toNativeScrollBehavior(nativeScrollBehavior));
- scrollCustomizationCallbacks().setApplyScroll(this, scrollStateCallback);
-}
-
-void Element::nativeDistributeScroll(ScrollState& scrollState)
+void Element::distributeScroll(ScrollState& scrollState)
{
ASSERT(RuntimeEnabledFeatures::scrollCustomizationEnabled());
if (scrollState.fullyConsumed())
@@ -526,27 +490,13 @@
const double deltaX = scrollState.deltaX();
const double deltaY = scrollState.deltaY();
- callApplyScroll(scrollState);
+ applyScroll(scrollState);
if (deltaX != scrollState.deltaX() || deltaY != scrollState.deltaY())
scrollState.setCurrentNativeScrollingElement(this);
}
-void Element::callDistributeScroll(ScrollState& scrollState)
-{
- ScrollStateCallback* callback = scrollCustomizationCallbacks().getDistributeScroll(this);
- if (!callback) {
- nativeDistributeScroll(scrollState);
- } else {
- if (callback->nativeScrollBehavior() == NativeScrollBehavior::PerformAfterNativeScroll)
- nativeDistributeScroll(scrollState);
- callback->handleEvent(&scrollState);
- if (callback->nativeScrollBehavior() == NativeScrollBehavior::PerformBeforeNativeScroll)
- nativeDistributeScroll(scrollState);
- }
-};
-
-void Element::nativeApplyScroll(ScrollState& scrollState)
+void Element::applyScroll(ScrollState& scrollState)
{
ASSERT(RuntimeEnabledFeatures::scrollCustomizationEnabled());
if (scrollState.fullyConsumed())
@@ -556,11 +506,8 @@
const double deltaY = scrollState.deltaY();
bool scrolled = false;
- if (deltaY || deltaX)
- document().updateLayoutIgnorePendingStylesheets();
-
- // Handle the scrollingElement separately, as it scrolls the viewport.
- if (this == document().scrollingElement()) {
+ // Handle the documentElement separately, as it scrolls the FrameView.
+ if (this == document().documentElement()) {
FloatSize delta(deltaX, deltaY);
if (document().frame()->applyScrollDelta(delta, scrollState.isBeginning()).didScroll()) {
scrolled = true;
@@ -593,20 +540,6 @@
scrollState.setCurrentNativeScrollingElement(this);
if (scrollState.fromUserInput())
document().frame()->view()->setWasScrolledByUser(true);
-};
-
-void Element::callApplyScroll(ScrollState& scrollState)
-{
- ScrollStateCallback* callback = scrollCustomizationCallbacks().getApplyScroll(this);
- if (!callback) {
- nativeApplyScroll(scrollState);
- } else {
- if (callback->nativeScrollBehavior() == NativeScrollBehavior::PerformAfterNativeScroll)
- nativeApplyScroll(scrollState);
- callback->handleEvent(&scrollState);
- if (callback->nativeScrollBehavior() == NativeScrollBehavior::PerformBeforeNativeScroll)
- nativeApplyScroll(scrollState);
- }
};
static float localZoomForLayoutObject(LayoutObject& layoutObject)
« no previous file with comments | « Source/core/dom/Element.h ('k') | Source/core/dom/Element.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698