Commit c19ab0d4 authored by Henrique Ferreiro's avatar Henrique Ferreiro Committed by Commit Bot

Move WebNativeScrollBehavior out of public/platform

blink::WebNativeScrollBehavior is only used in
//third_party/blink/renderer/core. Move it to
//third_party/blink/renderer/core/page/scrolling/scroll_state_callback.h
as blink::NativeScrollBehavior.

Bug: 919392
Change-Id: I8dac59f7b1a778508ee7c1dbed5abdf15f0e371a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1886677
Commit-Queue: Henrique Ferreiro <hferreiro@igalia.com>
Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Cr-Commit-Position: refs/heads/master@{#711242}
parent 721bb6cc
......@@ -274,7 +274,6 @@ source_set("blink_headers") {
"platform/web_mixed_content_context_type.h",
"platform/web_mouse_event.h",
"platform/web_mouse_wheel_event.h",
"platform/web_native_scroll_behavior.h",
"platform/web_navigation_body_loader.h",
"platform/web_network_state_notifier.h",
"platform/web_platform_event_listener.h",
......
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef THIRD_PARTY_BLINK_PUBLIC_PLATFORM_WEB_NATIVE_SCROLL_BEHAVIOR_H_
#define THIRD_PARTY_BLINK_PUBLIC_PLATFORM_WEB_NATIVE_SCROLL_BEHAVIOR_H_
namespace blink {
enum class WebNativeScrollBehavior {
kDisableNativeScroll,
kPerformBeforeNativeScroll,
kPerformAfterNativeScroll,
};
} // namespace blink
#endif // THIRD_PARTY_BLINK_PUBLIC_PLATFORM_WEB_NATIVE_SCROLL_BEHAVIOR_H_
......@@ -26,6 +26,8 @@
#include "third_party/blink/renderer/core/dom/node.h"
#include <algorithm>
#include "third_party/blink/renderer/bindings/core/v8/node_or_string_or_trusted_script.h"
#include "third_party/blink/renderer/bindings/core/v8/string_or_trusted_script.h"
#include "third_party/blink/renderer/core/accessibility/ax_object_cache.h"
......@@ -616,13 +618,13 @@ void Node::CallDistributeScroll(ScrollState& scroll_state) {
return;
}
if (callback->NativeScrollBehavior() !=
WebNativeScrollBehavior::kPerformAfterNativeScroll)
NativeScrollBehavior::kPerformAfterNativeScroll)
callback->Invoke(&scroll_state);
if (callback->NativeScrollBehavior() !=
WebNativeScrollBehavior::kDisableNativeScroll)
NativeScrollBehavior::kDisableNativeScroll)
NativeDistributeScroll(scroll_state);
if (callback->NativeScrollBehavior() ==
WebNativeScrollBehavior::kPerformAfterNativeScroll)
NativeScrollBehavior::kPerformAfterNativeScroll)
callback->Invoke(&scroll_state);
}
......@@ -662,13 +664,13 @@ void Node::CallApplyScroll(ScrollState& scroll_state) {
return;
}
if (callback->NativeScrollBehavior() !=
WebNativeScrollBehavior::kPerformAfterNativeScroll)
NativeScrollBehavior::kPerformAfterNativeScroll)
callback->Invoke(&scroll_state);
if (callback->NativeScrollBehavior() !=
WebNativeScrollBehavior::kDisableNativeScroll)
NativeScrollBehavior::kDisableNativeScroll)
NativeApplyScroll(scroll_state);
if (callback->NativeScrollBehavior() ==
WebNativeScrollBehavior::kPerformAfterNativeScroll)
NativeScrollBehavior::kPerformAfterNativeScroll)
callback->Invoke(&scroll_state);
}
......
......@@ -17,21 +17,21 @@ void ScrollStateCallbackV8Impl::Invoke(ScrollState* scroll_state) {
callback_->InvokeAndReportException(nullptr, scroll_state);
}
WebNativeScrollBehavior ScrollStateCallbackV8Impl::ParseNativeScrollBehavior(
NativeScrollBehavior ScrollStateCallbackV8Impl::ParseNativeScrollBehavior(
const String& native_scroll_behavior) {
static const char kDisable[] = "disable-native-scroll";
static const char kBefore[] = "perform-before-native-scroll";
static const char kAfter[] = "perform-after-native-scroll";
if (native_scroll_behavior == kDisable)
return WebNativeScrollBehavior::kDisableNativeScroll;
return NativeScrollBehavior::kDisableNativeScroll;
if (native_scroll_behavior == kBefore)
return WebNativeScrollBehavior::kPerformBeforeNativeScroll;
return NativeScrollBehavior::kPerformBeforeNativeScroll;
if (native_scroll_behavior == kAfter)
return WebNativeScrollBehavior::kPerformAfterNativeScroll;
return NativeScrollBehavior::kPerformAfterNativeScroll;
NOTREACHED();
return WebNativeScrollBehavior::kDisableNativeScroll;
return NativeScrollBehavior::kDisableNativeScroll;
}
} // namespace blink
......@@ -5,7 +5,6 @@
#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_PAGE_SCROLLING_SCROLL_STATE_CALLBACK_H_
#define THIRD_PARTY_BLINK_RENDERER_CORE_PAGE_SCROLLING_SCROLL_STATE_CALLBACK_H_
#include "third_party/blink/public/platform/web_native_scroll_behavior.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_scroll_state_callback.h"
#include "third_party/blink/renderer/platform/heap/handle.h"
......@@ -13,6 +12,12 @@ namespace blink {
class ScrollState;
enum class NativeScrollBehavior {
kDisableNativeScroll,
kPerformBeforeNativeScroll,
kPerformAfterNativeScroll,
};
class ScrollStateCallback : public GarbageCollected<ScrollStateCallback> {
public:
virtual ~ScrollStateCallback() = default;
......@@ -21,18 +26,18 @@ class ScrollStateCallback : public GarbageCollected<ScrollStateCallback> {
virtual void Invoke(ScrollState*) = 0;
WebNativeScrollBehavior NativeScrollBehavior() const {
NativeScrollBehavior NativeScrollBehavior() const {
return native_scroll_behavior_;
}
protected:
explicit ScrollStateCallback(
WebNativeScrollBehavior native_scroll_behavior =
WebNativeScrollBehavior::kDisableNativeScroll)
enum NativeScrollBehavior native_scroll_behavior =
NativeScrollBehavior::kDisableNativeScroll)
: native_scroll_behavior_(native_scroll_behavior) {}
private:
const WebNativeScrollBehavior native_scroll_behavior_;
const enum NativeScrollBehavior native_scroll_behavior_;
};
class ScrollStateCallbackV8Impl : public ScrollStateCallback {
......@@ -47,7 +52,7 @@ class ScrollStateCallbackV8Impl : public ScrollStateCallback {
explicit ScrollStateCallbackV8Impl(
V8ScrollStateCallback* callback,
WebNativeScrollBehavior native_scroll_behavior)
enum NativeScrollBehavior native_scroll_behavior)
: ScrollStateCallback(native_scroll_behavior), callback_(callback) {}
~ScrollStateCallbackV8Impl() override = default;
......@@ -56,7 +61,7 @@ class ScrollStateCallbackV8Impl : public ScrollStateCallback {
void Invoke(ScrollState*) override;
private:
static WebNativeScrollBehavior ParseNativeScrollBehavior(
static enum NativeScrollBehavior ParseNativeScrollBehavior(
const String& native_scroll_behavior);
Member<V8ScrollStateCallback> callback_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment