Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 564790
Collapse All | Expand All

(-)a/cc/input/input_handler.h (-4 / +3 lines)
Lines 84-90 Link Here
84
    // This must be the last entry.
84
    // This must be the last entry.
85
    ScrollStatusCount
85
    ScrollStatusCount
86
  };
86
  };
87
  enum ScrollInputType { GESTURE, WHEEL, NON_BUBBLING_GESTURE };
87
  enum ScrollInputType { GESTURE, WHEEL, ANIMATED_WHEEL, NON_BUBBLING_GESTURE };
88
88
89
  // Binds a client to this handler to receive notifications. Only one client
89
  // Binds a client to this handler to receive notifications. Only one client
90
  // can be bound to an InputHandler. The client must live at least until the
90
  // can be bound to an InputHandler. The client must live at least until the
Lines 151-159 Link Here
151
  // Request another callback to InputHandlerClient::Animate().
151
  // Request another callback to InputHandlerClient::Animate().
152
  virtual void SetNeedsAnimateInput() = 0;
152
  virtual void SetNeedsAnimateInput() = 0;
153
153
154
  // If there is a scroll active, this reports whether the scroll is on the
154
  // Returns true if there is an active scroll on the inner viewport layer.
155
  // root layer, or on some other sublayer.
155
  virtual bool IsCurrentlyScrollingInnerViewport() const = 0;
156
  virtual bool IsCurrentlyScrollingRoot() const = 0;
157
156
158
  // Whether the layer under |viewport_point| is the currently scrolling layer.
157
  // Whether the layer under |viewport_point| is the currently scrolling layer.
159
  virtual bool IsCurrentlyScrollingLayerAt(const gfx::Point& viewport_point,
158
  virtual bool IsCurrentlyScrollingLayerAt(const gfx::Point& viewport_point,
(-)a/cc/layers/layer_impl.cc (-1 / +2 lines)
Lines 526-532 Link Here
526
    return InputHandler::SCROLL_ON_MAIN_THREAD;
526
    return InputHandler::SCROLL_ON_MAIN_THREAD;
527
  }
527
  }
528
528
529
  if (type == InputHandler::WHEEL && have_wheel_event_handlers() &&
529
  if ((type == InputHandler::WHEEL || type == InputHandler::ANIMATED_WHEEL) &&
530
      have_wheel_event_handlers() &&
530
      effective_block_mode & SCROLL_BLOCKS_ON_WHEEL_EVENT) {
531
      effective_block_mode & SCROLL_BLOCKS_ON_WHEEL_EVENT) {
531
    TRACE_EVENT0("cc", "LayerImpl::tryScroll: Failed WheelEventHandlers");
532
    TRACE_EVENT0("cc", "LayerImpl::tryScroll: Failed WheelEventHandlers");
532
    return InputHandler::SCROLL_ON_MAIN_THREAD;
533
    return InputHandler::SCROLL_ON_MAIN_THREAD;
(-)a/cc/trees/layer_tree_host_impl.cc (-12 / +21 lines)
Lines 407-414 Link Here
407
  if (input_handler_client_) {
407
  if (input_handler_client_) {
408
    // This animates fling scrolls. But on Android WebView root flings are
408
    // This animates fling scrolls. But on Android WebView root flings are
409
    // controlled by the application, so the compositor does not animate them.
409
    // controlled by the application, so the compositor does not animate them.
410
    bool ignore_fling =
410
    bool ignore_fling = settings_.ignore_root_layer_flings &&
411
        settings_.ignore_root_layer_flings && IsCurrentlyScrollingRoot();
411
                        IsCurrentlyScrollingInnerViewport();
412
    if (!ignore_fling)
412
    if (!ignore_fling)
413
      input_handler_client_->Animate(monotonic_time);
413
      input_handler_client_->Animate(monotonic_time);
414
  }
414
  }
Lines 476-487 Link Here
476
}
476
}
477
477
478
void LayerTreeHostImpl::SetNeedsAnimateInput() {
478
void LayerTreeHostImpl::SetNeedsAnimateInput() {
479
  DCHECK_IMPLIES(IsCurrentlyScrollingRoot(),
479
  DCHECK_IMPLIES(IsCurrentlyScrollingInnerViewport(),
480
                 !settings_.ignore_root_layer_flings);
480
                 !settings_.ignore_root_layer_flings);
481
  SetNeedsAnimate();
481
  SetNeedsAnimate();
482
}
482
}
483
483
484
bool LayerTreeHostImpl::IsCurrentlyScrollingRoot() const {
484
bool LayerTreeHostImpl::IsCurrentlyScrollingInnerViewport() const {
485
  LayerImpl* scrolling_layer = CurrentlyScrollingLayer();
485
  LayerImpl* scrolling_layer = CurrentlyScrollingLayer();
486
  if (!scrolling_layer)
486
  if (!scrolling_layer)
487
    return false;
487
    return false;
Lines 1885-1891 Link Here
1885
  // On Android WebView root flings are controlled by the application,
1885
  // On Android WebView root flings are controlled by the application,
1886
  // so the compositor does not animate them and can't tell if they
1886
  // so the compositor does not animate them and can't tell if they
1887
  // are actually animating. So assume there are none.
1887
  // are actually animating. So assume there are none.
1888
  if (settings_.ignore_root_layer_flings && IsCurrentlyScrollingRoot())
1888
  if (settings_.ignore_root_layer_flings && IsCurrentlyScrollingInnerViewport())
1889
    return false;
1889
    return false;
1890
  return did_lock_scrolling_layer_;
1890
  return did_lock_scrolling_layer_;
1891
}
1891
}
Lines 2414-2419 Link Here
2414
  if (potentially_scrolling_layer_impl == OuterViewportScrollLayer())
2414
  if (potentially_scrolling_layer_impl == OuterViewportScrollLayer())
2415
    potentially_scrolling_layer_impl = InnerViewportScrollLayer();
2415
    potentially_scrolling_layer_impl = InnerViewportScrollLayer();
2416
2416
2417
  // Animated wheel scrolls need to scroll the outer viewport layer, and do not
2418
  // go through Viewport::ScrollBy which would normally handle the distribution.
2419
  // NOTE: This will need refactoring if we want smooth scrolling on Android.
2420
  if (type == ANIMATED_WHEEL &&
2421
      potentially_scrolling_layer_impl == InnerViewportScrollLayer()) {
2422
    potentially_scrolling_layer_impl = OuterViewportScrollLayer();
2423
  }
2424
2417
  return potentially_scrolling_layer_impl;
2425
  return potentially_scrolling_layer_impl;
2418
}
2426
}
2419
2427
Lines 2437-2443 Link Here
2437
  top_controls_manager_->ScrollBegin();
2445
  top_controls_manager_->ScrollBegin();
2438
2446
2439
  active_tree_->SetCurrentlyScrollingLayer(scrolling_layer_impl);
2447
  active_tree_->SetCurrentlyScrollingLayer(scrolling_layer_impl);
2440
  wheel_scrolling_ = (type == WHEEL);
2448
  wheel_scrolling_ = (type == WHEEL || type == ANIMATED_WHEEL);
2441
  client_->RenewTreePriority();
2449
  client_->RenewTreePriority();
2442
  UMA_HISTOGRAM_BOOLEAN("TryScroll.SlowScroll", false);
2450
  UMA_HISTOGRAM_BOOLEAN("TryScroll.SlowScroll", false);
2443
  return SCROLL_STARTED;
2451
  return SCROLL_STARTED;
Lines 2495-2510 Link Here
2495
               ? SCROLL_STARTED
2503
               ? SCROLL_STARTED
2496
               : SCROLL_IGNORED;
2504
               : SCROLL_IGNORED;
2497
  }
2505
  }
2498
  // ScrollAnimated is only used for wheel scrolls. We use the same bubbling
2506
  // ScrollAnimated is used for animated wheel scrolls. We find the first layer
2499
  // behavior as ScrollBy to determine which layer to animate, but we do not
2507
  // that can scroll and set up an animation of its scroll offset. Note that
2500
  // do the Android-specific things in ScrollBy like showing top controls.
2508
  // this does not currently go through the scroll customization and viewport
2501
  InputHandler::ScrollStatus scroll_status = ScrollBegin(viewport_point, WHEEL);
2509
  // machinery that ScrollBy uses for non-animated wheel scrolls.
2510
  InputHandler::ScrollStatus scroll_status =
2511
      ScrollBegin(viewport_point, ANIMATED_WHEEL);
2502
  if (scroll_status == SCROLL_STARTED) {
2512
  if (scroll_status == SCROLL_STARTED) {
2503
    gfx::Vector2dF pending_delta = scroll_delta;
2513
    gfx::Vector2dF pending_delta = scroll_delta;
2504
    for (LayerImpl* layer_impl = CurrentlyScrollingLayer(); layer_impl;
2514
    for (LayerImpl* layer_impl = CurrentlyScrollingLayer(); layer_impl;
2505
         layer_impl = NextLayerInScrollOrder(layer_impl)) {
2515
         layer_impl = NextLayerInScrollOrder(layer_impl)) {
2506
      // The inner viewport layer represents the viewport.
2516
      if (!layer_impl->scrollable())
2507
      if (!layer_impl->scrollable() || layer_impl == OuterViewportScrollLayer())
2508
        continue;
2517
        continue;
2509
2518
2510
      gfx::ScrollOffset current_offset = layer_impl->CurrentScrollOffset();
2519
      gfx::ScrollOffset current_offset = layer_impl->CurrentScrollOffset();
(-)a/cc/trees/layer_tree_host_impl.h (-1 / +1 lines)
Lines 187-193 Link Here
187
                               float page_scale,
187
                               float page_scale,
188
                               base::TimeDelta duration);
188
                               base::TimeDelta duration);
189
  void SetNeedsAnimateInput() override;
189
  void SetNeedsAnimateInput() override;
190
  bool IsCurrentlyScrollingRoot() const override;
190
  bool IsCurrentlyScrollingInnerViewport() const override;
191
  bool IsCurrentlyScrollingLayerAt(
191
  bool IsCurrentlyScrollingLayerAt(
192
      const gfx::Point& viewport_point,
192
      const gfx::Point& viewport_point,
193
      InputHandler::ScrollInputType type) const override;
193
      InputHandler::ScrollInputType type) const override;
(-)a/cc/trees/layer_tree_host_impl_unittest.cc (+6 lines)
Lines 8247-8252 Link Here
8247
8247
8248
TEST_F(LayerTreeHostImplTest, ScrollAnimated) {
8248
TEST_F(LayerTreeHostImplTest, ScrollAnimated) {
8249
  SetupScrollAndContentsLayers(gfx::Size(100, 200));
8249
  SetupScrollAndContentsLayers(gfx::Size(100, 200));
8250
8251
  // Shrink the outer viewport clip layer so that the outer viewport can scroll.
8252
  host_impl_->OuterViewportScrollLayer()->parent()->SetBounds(
8253
      gfx::Size(50, 100));
8254
8250
  DrawFrame();
8255
  DrawFrame();
8251
8256
8252
  base::TimeTicks start_time =
8257
  base::TimeTicks start_time =
Lines 8259-8264 Link Here
8259
            host_impl_->ScrollAnimated(gfx::Point(), gfx::Vector2d(0, 50)));
8264
            host_impl_->ScrollAnimated(gfx::Point(), gfx::Vector2d(0, 50)));
8260
8265
8261
  LayerImpl* scrolling_layer = host_impl_->CurrentlyScrollingLayer();
8266
  LayerImpl* scrolling_layer = host_impl_->CurrentlyScrollingLayer();
8267
  EXPECT_EQ(host_impl_->OuterViewportScrollLayer(), scrolling_layer);
8262
8268
8263
  begin_frame_args.frame_time = start_time;
8269
  begin_frame_args.frame_time = start_time;
8264
  host_impl_->WillBeginImplFrame(begin_frame_args);
8270
  host_impl_->WillBeginImplFrame(begin_frame_args);
(-)a/cc/trees/layer_tree_impl.cc (-2 lines)
Lines 365-372 Link Here
365
}
365
}
366
366
367
void LayerTreeImpl::SetCurrentlyScrollingLayer(LayerImpl* layer) {
367
void LayerTreeImpl::SetCurrentlyScrollingLayer(LayerImpl* layer) {
368
  DCHECK_IMPLIES(layer, layer != OuterViewportScrollLayer());
369
370
  int new_id = layer ? layer->id() : Layer::INVALID_ID;
368
  int new_id = layer ? layer->id() : Layer::INVALID_ID;
371
  if (currently_scrolling_layer_id_ == new_id)
369
  if (currently_scrolling_layer_id_ == new_id)
372
    return;
370
    return;
(-)a/content/renderer/input/input_handler_proxy.cc (-2 / +3 lines)
Lines 756-762 Link Here
756
void InputHandlerProxy::Animate(base::TimeTicks time) {
756
void InputHandlerProxy::Animate(base::TimeTicks time) {
757
  // If using synchronous animate, then only expect Animate attempts started by
757
  // If using synchronous animate, then only expect Animate attempts started by
758
  // the synchronous system. Don't let the InputHandler try to Animate also.
758
  // the synchronous system. Don't let the InputHandler try to Animate also.
759
  DCHECK_IMPLIES(input_handler_->IsCurrentlyScrollingRoot(),
759
  DCHECK_IMPLIES(input_handler_->IsCurrentlyScrollingInnerViewport(),
760
                 allow_root_animate_);
760
                 allow_root_animate_);
761
761
762
  if (scroll_elasticity_controller_)
762
  if (scroll_elasticity_controller_)
Lines 938-944 Link Here
938
  // When a SynchronousInputHandler is present, root flings should go through
938
  // When a SynchronousInputHandler is present, root flings should go through
939
  // it to allow it to control when or if the root fling is animated. Non-root
939
  // it to allow it to control when or if the root fling is animated. Non-root
940
  // flings always go through the normal InputHandler.
940
  // flings always go through the normal InputHandler.
941
  if (synchronous_input_handler_ && input_handler_->IsCurrentlyScrollingRoot())
941
  if (synchronous_input_handler_ &&
942
      input_handler_->IsCurrentlyScrollingInnerViewport())
942
    synchronous_input_handler_->SetNeedsSynchronousAnimateInput();
943
    synchronous_input_handler_->SetNeedsSynchronousAnimateInput();
943
  else
944
  else
944
    input_handler_->SetNeedsAnimateInput();
945
    input_handler_->SetNeedsAnimateInput();
(-)a/content/renderer/input/input_handler_proxy_unittest.cc (-1 / +3 lines)
Lines 138-144 Link Here
138
  MOCK_METHOD1(SetSynchronousInputHandlerRootScrollOffset,
138
  MOCK_METHOD1(SetSynchronousInputHandlerRootScrollOffset,
139
               void(const gfx::ScrollOffset& root_offset));
139
               void(const gfx::ScrollOffset& root_offset));
140
140
141
  bool IsCurrentlyScrollingRoot() const override { return is_scrolling_root_; }
141
  bool IsCurrentlyScrollingInnerViewport() const override {
142
    return is_scrolling_root_;
143
  }
142
  void set_is_scrolling_root(bool is) { is_scrolling_root_ = is; }
144
  void set_is_scrolling_root(bool is) { is_scrolling_root_ = is; }
143
145
144
 private:
146
 private:

Return to bug 564790