OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights | 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights |
3 * reserved. | 3 * reserved. |
4 * | 4 * |
5 * Portions are Copyright (C) 1998 Netscape Communications Corporation. | 5 * Portions are Copyright (C) 1998 Netscape Communications Corporation. |
6 * | 6 * |
7 * Other contributors: | 7 * Other contributors: |
8 * Robert O'Callahan <roc+@cs.cmu.edu> | 8 * Robert O'Callahan <roc+@cs.cmu.edu> |
9 * David Baron <dbaron@fas.harvard.edu> | 9 * David Baron <dbaron@fas.harvard.edu> |
10 * Christian Biesinger <cbiesinger@gmail.com> | 10 * Christian Biesinger <cbiesinger@gmail.com> |
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
349 if (!view) | 349 if (!view) |
350 return parent_point; | 350 return parent_point; |
351 | 351 |
352 IntPoint point = view->GetFrameView()->ConvertToLayoutItem( | 352 IntPoint point = view->GetFrameView()->ConvertToLayoutItem( |
353 LayoutBoxItem(&Box()), parent_point); | 353 LayoutBoxItem(&Box()), parent_point); |
354 | 354 |
355 point.Move(-ScrollbarOffset(scrollbar)); | 355 point.Move(-ScrollbarOffset(scrollbar)); |
356 return point; | 356 return point; |
357 } | 357 } |
358 | 358 |
| 359 IntPoint PaintLayerScrollableArea::ConvertFromRootFrame( |
| 360 const IntPoint& point_in_root_frame) const { |
| 361 LayoutView* view = Box().View(); |
| 362 if (!view) |
| 363 return point_in_root_frame; |
| 364 |
| 365 return view->GetFrameView()->ConvertFromRootFrame(point_in_root_frame); |
| 366 } |
| 367 |
359 int PaintLayerScrollableArea::ScrollSize( | 368 int PaintLayerScrollableArea::ScrollSize( |
360 ScrollbarOrientation orientation) const { | 369 ScrollbarOrientation orientation) const { |
361 IntSize scroll_dimensions = | 370 IntSize scroll_dimensions = |
362 MaximumScrollOffsetInt() - MinimumScrollOffsetInt(); | 371 MaximumScrollOffsetInt() - MinimumScrollOffsetInt(); |
363 return (orientation == kHorizontalScrollbar) ? scroll_dimensions.Width() | 372 return (orientation == kHorizontalScrollbar) ? scroll_dimensions.Width() |
364 : scroll_dimensions.Height(); | 373 : scroll_dimensions.Height(); |
365 } | 374 } |
366 | 375 |
367 void PaintLayerScrollableArea::UpdateScrollOffset( | 376 void PaintLayerScrollableArea::UpdateScrollOffset( |
368 const ScrollOffset& new_offset, | 377 const ScrollOffset& new_offset, |
(...skipping 1666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2035 } else { | 2044 } else { |
2036 ScrollbarControlSize scrollbar_size = kRegularScrollbar; | 2045 ScrollbarControlSize scrollbar_size = kRegularScrollbar; |
2037 if (style_source.StyleRef().HasAppearance()) { | 2046 if (style_source.StyleRef().HasAppearance()) { |
2038 scrollbar_size = LayoutTheme::GetTheme().ScrollbarControlSizeForPart( | 2047 scrollbar_size = LayoutTheme::GetTheme().ScrollbarControlSizeForPart( |
2039 style_source.StyleRef().Appearance()); | 2048 style_source.StyleRef().Appearance()); |
2040 } | 2049 } |
2041 scrollbar = Scrollbar::Create( | 2050 scrollbar = Scrollbar::Create( |
2042 ScrollableArea(), orientation, scrollbar_size, | 2051 ScrollableArea(), orientation, scrollbar_size, |
2043 &ScrollableArea()->Box().GetFrame()->GetPage()->GetChromeClient()); | 2052 &ScrollableArea()->Box().GetFrame()->GetPage()->GetChromeClient()); |
2044 } | 2053 } |
2045 ScrollableArea()->Box().GetDocument().View()->AddScrollbar(scrollbar); | 2054 ScrollableArea()->Box().GetDocument().View()->AddPaintScrollbar(scrollbar); |
2046 return scrollbar; | 2055 return scrollbar; |
2047 } | 2056 } |
2048 | 2057 |
2049 void PaintLayerScrollableArea::ScrollbarManager::DestroyScrollbar( | 2058 void PaintLayerScrollableArea::ScrollbarManager::DestroyScrollbar( |
2050 ScrollbarOrientation orientation) { | 2059 ScrollbarOrientation orientation) { |
2051 Member<Scrollbar>& scrollbar = | 2060 Member<Scrollbar>& scrollbar = |
2052 orientation == kHorizontalScrollbar ? h_bar_ : v_bar_; | 2061 orientation == kHorizontalScrollbar ? h_bar_ : v_bar_; |
2053 DCHECK(orientation == kHorizontalScrollbar ? !h_bar_is_attached_ | 2062 DCHECK(orientation == kHorizontalScrollbar ? !h_bar_is_attached_ |
2054 : !v_bar_is_attached_); | 2063 : !v_bar_is_attached_); |
2055 if (!scrollbar) | 2064 if (!scrollbar) |
2056 return; | 2065 return; |
2057 | 2066 |
2058 ScrollableArea()->SetScrollbarNeedsPaintInvalidation(orientation); | 2067 ScrollableArea()->SetScrollbarNeedsPaintInvalidation(orientation); |
2059 if (orientation == kHorizontalScrollbar) | 2068 if (orientation == kHorizontalScrollbar) |
2060 ScrollableArea()->rebuild_horizontal_scrollbar_layer_ = true; | 2069 ScrollableArea()->rebuild_horizontal_scrollbar_layer_ = true; |
2061 else | 2070 else |
2062 ScrollableArea()->rebuild_vertical_scrollbar_layer_ = true; | 2071 ScrollableArea()->rebuild_vertical_scrollbar_layer_ = true; |
2063 | 2072 |
2064 if (!scrollbar->IsCustomScrollbar()) | 2073 if (!scrollbar->IsCustomScrollbar()) |
2065 ScrollableArea()->WillRemoveScrollbar(*scrollbar, orientation); | 2074 ScrollableArea()->WillRemoveScrollbar(*scrollbar, orientation); |
2066 | 2075 |
2067 ScrollableArea()->Box().GetDocument().View()->RemoveScrollbar(scrollbar); | 2076 ScrollableArea()->Box().GetDocument().View()->RemovePaintScrollbar(scrollbar); |
2068 scrollbar->DisconnectFromScrollableArea(); | 2077 scrollbar->DisconnectFromScrollableArea(); |
2069 scrollbar = nullptr; | 2078 scrollbar = nullptr; |
2070 } | 2079 } |
2071 | 2080 |
2072 uint64_t PaintLayerScrollableArea::Id() const { | 2081 uint64_t PaintLayerScrollableArea::Id() const { |
2073 return DOMNodeIds::IdForNode(Box().GetNode()); | 2082 return DOMNodeIds::IdForNode(Box().GetNode()); |
2074 } | 2083 } |
2075 | 2084 |
2076 int PaintLayerScrollableArea::PreventRelayoutScope::count_ = 0; | 2085 int PaintLayerScrollableArea::PreventRelayoutScope::count_ = 0; |
2077 SubtreeLayoutScope* | 2086 SubtreeLayoutScope* |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2175 | 2184 |
2176 void PaintLayerScrollableArea::DelayScrollOffsetClampScope:: | 2185 void PaintLayerScrollableArea::DelayScrollOffsetClampScope:: |
2177 ClampScrollableAreas() { | 2186 ClampScrollableAreas() { |
2178 for (auto& scrollable_area : *needs_clamp_) | 2187 for (auto& scrollable_area : *needs_clamp_) |
2179 scrollable_area->ClampScrollOffsetAfterOverflowChange(); | 2188 scrollable_area->ClampScrollOffsetAfterOverflowChange(); |
2180 delete needs_clamp_; | 2189 delete needs_clamp_; |
2181 needs_clamp_ = nullptr; | 2190 needs_clamp_ = nullptr; |
2182 } | 2191 } |
2183 | 2192 |
2184 } // namespace blink | 2193 } // namespace blink |
OLD | NEW |