| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org> | 2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org> |
| 3 * 1999 Lars Knoll <knoll@kde.org> | 3 * 1999 Lars Knoll <knoll@kde.org> |
| 4 * 1999 Antti Koivisto <koivisto@kde.org> | 4 * 1999 Antti Koivisto <koivisto@kde.org> |
| 5 * 2000 Dirk Mueller <mueller@kde.org> | 5 * 2000 Dirk Mueller <mueller@kde.org> |
| 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. |
| 7 * (C) 2006 Graham Dennis (graham.dennis@gmail.com) | 7 * (C) 2006 Graham Dennis (graham.dennis@gmail.com) |
| 8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) | 8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) |
| 9 * Copyright (C) 2009 Google Inc. All rights reserved. | 9 * Copyright (C) 2009 Google Inc. All rights reserved. |
| 10 * | 10 * |
| (...skipping 721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 732 if (layout_view_item.IsNull()) | 732 if (layout_view_item.IsNull()) |
| 733 return; | 733 return; |
| 734 | 734 |
| 735 ASSERT(frame_->View() == this); | 735 ASSERT(frame_->View() == this); |
| 736 | 736 |
| 737 const IntRect rect = layout_view_item.DocumentRect(); | 737 const IntRect rect = layout_view_item.DocumentRect(); |
| 738 const IntSize& size = rect.size(); | 738 const IntSize& size = rect.size(); |
| 739 | 739 |
| 740 const IntPoint origin(-rect.X(), -rect.Y()); | 740 const IntPoint origin(-rect.X(), -rect.Y()); |
| 741 if (ScrollOrigin() != origin) { | 741 if (ScrollOrigin() != origin) { |
| 742 ScrollableArea::SetScrollOrigin(origin); | 742 SetScrollOrigin(origin); |
| 743 // setContentSize (below) also calls updateScrollbars so we can avoid | 743 // setContentSize (below) also calls updateScrollbars so we can avoid |
| 744 // updating scrollbars twice by skipping the call here when the content | 744 // updating scrollbars twice by skipping the call here when the content |
| 745 // size does not change. | 745 // size does not change. |
| 746 if (!frame_->GetDocument()->Printing() && size == ContentsSize()) | 746 if (!frame_->GetDocument()->Printing() && size == ContentsSize()) |
| 747 UpdateScrollbars(); | 747 UpdateScrollbars(); |
| 748 } | 748 } |
| 749 | 749 |
| 750 SetContentsSize(size); | 750 SetContentsSize(size); |
| 751 } | 751 } |
| 752 | 752 |
| (...skipping 3587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4340 FrameRectsChanged(); | 4340 FrameRectsChanged(); |
| 4341 PositionScrollbarLayers(); | 4341 PositionScrollbarLayers(); |
| 4342 UpdateScrollCorner(); | 4342 UpdateScrollCorner(); |
| 4343 } | 4343 } |
| 4344 | 4344 |
| 4345 AdjustScrollOffsetFromUpdateScrollbars(); | 4345 AdjustScrollOffsetFromUpdateScrollbars(); |
| 4346 } | 4346 } |
| 4347 | 4347 |
| 4348 void FrameView::AdjustScrollOffsetFromUpdateScrollbars() { | 4348 void FrameView::AdjustScrollOffsetFromUpdateScrollbars() { |
| 4349 ScrollOffset clamped = ClampScrollOffset(GetScrollOffset()); | 4349 ScrollOffset clamped = ClampScrollOffset(GetScrollOffset()); |
| 4350 if (clamped != GetScrollOffset() || ScrollOriginChanged()) { | 4350 if (clamped != GetScrollOffset() || ScrollOriginChanged()) |
| 4351 ScrollableArea::SetScrollOffset(clamped, kClampingScroll); | 4351 SetScrollOffset(clamped, kClampingScroll); |
| 4352 ResetScrollOriginChanged(); | |
| 4353 } | |
| 4354 } | 4352 } |
| 4355 | 4353 |
| 4356 void FrameView::ScrollContentsIfNeeded() { | 4354 void FrameView::ScrollContentsIfNeeded() { |
| 4357 if (pending_scroll_delta_.IsZero()) | 4355 if (pending_scroll_delta_.IsZero()) |
| 4358 return; | 4356 return; |
| 4359 ScrollOffset scroll_delta = pending_scroll_delta_; | 4357 ScrollOffset scroll_delta = pending_scroll_delta_; |
| 4360 pending_scroll_delta_ = ScrollOffset(); | 4358 pending_scroll_delta_ = ScrollOffset(); |
| 4361 // FIXME: Change scrollContents() to take DoubleSize. crbug.com/414283. | 4359 // FIXME: Change scrollContents() to take DoubleSize. crbug.com/414283. |
| 4362 ScrollContents(FlooredIntSize(scroll_delta)); | 4360 ScrollContents(FlooredIntSize(scroll_delta)); |
| 4363 } | 4361 } |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4526 graphics_layer->SetNeedsDisplay(); | 4524 graphics_layer->SetNeedsDisplay(); |
| 4527 graphics_layer->SetSize(FloatSize(corner_rect.size())); | 4525 graphics_layer->SetSize(FloatSize(corner_rect.size())); |
| 4528 } | 4526 } |
| 4529 | 4527 |
| 4530 void FrameView::PositionScrollbarLayers() { | 4528 void FrameView::PositionScrollbarLayers() { |
| 4531 PositionScrollbarLayer(LayerForHorizontalScrollbar(), HorizontalScrollbar()); | 4529 PositionScrollbarLayer(LayerForHorizontalScrollbar(), HorizontalScrollbar()); |
| 4532 PositionScrollbarLayer(LayerForVerticalScrollbar(), VerticalScrollbar()); | 4530 PositionScrollbarLayer(LayerForVerticalScrollbar(), VerticalScrollbar()); |
| 4533 PositionScrollCornerLayer(LayerForScrollCorner(), ScrollCornerRect()); | 4531 PositionScrollCornerLayer(LayerForScrollCorner(), ScrollCornerRect()); |
| 4534 } | 4532 } |
| 4535 | 4533 |
| 4534 bool FrameView::UpdateAfterCompositingChange() { |
| 4535 if (ScrollOriginChanged()) { |
| 4536 // If the scroll origin changed, we need to update the layer position on |
| 4537 // the compositor since the offset itself might not have changed. |
| 4538 LayoutViewItem layout_view_item = this->GetLayoutViewItem(); |
| 4539 if (!layout_view_item.IsNull() && layout_view_item.UsesCompositing()) |
| 4540 layout_view_item.Compositor()->FrameViewDidScroll(); |
| 4541 ResetScrollOriginChanged(); |
| 4542 } |
| 4543 return false; |
| 4544 } |
| 4545 |
| 4536 bool FrameView::UserInputScrollable(ScrollbarOrientation orientation) const { | 4546 bool FrameView::UserInputScrollable(ScrollbarOrientation orientation) const { |
| 4537 Document* document = GetFrame().GetDocument(); | 4547 Document* document = GetFrame().GetDocument(); |
| 4538 Element* fullscreen_element = Fullscreen::FullscreenElementFrom(*document); | 4548 Element* fullscreen_element = Fullscreen::FullscreenElementFrom(*document); |
| 4539 if (fullscreen_element && fullscreen_element != document->documentElement()) | 4549 if (fullscreen_element && fullscreen_element != document->documentElement()) |
| 4540 return false; | 4550 return false; |
| 4541 | 4551 |
| 4542 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) | 4552 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) |
| 4543 return false; | 4553 return false; |
| 4544 | 4554 |
| 4545 ScrollbarMode mode = (orientation == kHorizontalScrollbar) | 4555 ScrollbarMode mode = (orientation == kHorizontalScrollbar) |
| (...skipping 791 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5337 void FrameView::SetAnimationHost( | 5347 void FrameView::SetAnimationHost( |
| 5338 std::unique_ptr<CompositorAnimationHost> host) { | 5348 std::unique_ptr<CompositorAnimationHost> host) { |
| 5339 animation_host_ = std::move(host); | 5349 animation_host_ = std::move(host); |
| 5340 } | 5350 } |
| 5341 | 5351 |
| 5342 LayoutUnit FrameView::CaretWidth() const { | 5352 LayoutUnit FrameView::CaretWidth() const { |
| 5343 return LayoutUnit(GetHostWindow()->WindowToViewportScalar(1)); | 5353 return LayoutUnit(GetHostWindow()->WindowToViewportScalar(1)); |
| 5344 } | 5354 } |
| 5345 | 5355 |
| 5346 } // namespace blink | 5356 } // namespace blink |
| OLD | NEW |