Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2006 Apple Computer, Inc. All rights reserved. | 2 * Copyright (C) 2004, 2006 Apple Computer, Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 38 | 38 |
| 39 class CullRect; | 39 class CullRect; |
| 40 class GraphicsContext; | 40 class GraphicsContext; |
| 41 class IntRect; | 41 class IntRect; |
| 42 class PlatformChromeClient; | 42 class PlatformChromeClient; |
| 43 class ScrollableArea; | 43 class ScrollableArea; |
| 44 class ScrollbarTheme; | 44 class ScrollbarTheme; |
| 45 class WebGestureEvent; | 45 class WebGestureEvent; |
| 46 class WebMouseEvent; | 46 class WebMouseEvent; |
| 47 | 47 |
| 48 class PLATFORM_EXPORT Scrollbar : public FrameViewBase, | 48 class PLATFORM_EXPORT Scrollbar : public GarbageCollectedFinalized<Scrollbar>, |
| 49 public ScrollbarThemeClient, | 49 public ScrollbarThemeClient, |
| 50 public DisplayItemClient { | 50 public DisplayItemClient { |
| 51 public: | 51 public: |
| 52 static Scrollbar* Create(ScrollableArea* scrollable_area, | 52 static Scrollbar* Create(ScrollableArea* scrollable_area, |
| 53 ScrollbarOrientation orientation, | 53 ScrollbarOrientation orientation, |
| 54 ScrollbarControlSize size, | 54 ScrollbarControlSize size, |
| 55 PlatformChromeClient* chrome_client) { | 55 PlatformChromeClient* chrome_client) { |
| 56 return new Scrollbar(scrollable_area, orientation, size, chrome_client); | 56 return new Scrollbar(scrollable_area, orientation, size, chrome_client); |
| 57 } | 57 } |
| 58 | 58 |
| 59 // Theme object ownership remains with the caller and it must outlive the | 59 // Theme object ownership remains with the caller and it must outlive the |
| 60 // scrollbar. | 60 // scrollbar. |
| 61 static Scrollbar* CreateForTesting(ScrollableArea* scrollable_area, | 61 static Scrollbar* CreateForTesting(ScrollableArea* scrollable_area, |
| 62 ScrollbarOrientation orientation, | 62 ScrollbarOrientation orientation, |
| 63 ScrollbarControlSize size, | 63 ScrollbarControlSize size, |
| 64 ScrollbarTheme* theme) { | 64 ScrollbarTheme* theme) { |
| 65 return new Scrollbar(scrollable_area, orientation, size, nullptr, theme); | 65 return new Scrollbar(scrollable_area, orientation, size, nullptr, theme); |
| 66 } | 66 } |
| 67 | 67 |
| 68 ~Scrollbar() override; | 68 ~Scrollbar() override; |
| 69 | 69 |
| 70 // ScrollbarThemeClient implementation. | 70 // ScrollbarThemeClient implementation. |
| 71 int X() const override { return FrameViewBase::X(); } | 71 int X() const override { return frame_rect_.X(); } |
| 72 int Y() const override { return FrameViewBase::Y(); } | 72 int Y() const override { return frame_rect_.Y(); } |
| 73 int Width() const override { return FrameViewBase::Width(); } | 73 int Width() const override { return frame_rect_.Width(); } |
| 74 int Height() const override { return FrameViewBase::Height(); } | 74 int Height() const override { return frame_rect_.Height(); } |
| 75 IntSize Size() const override { return FrameViewBase::Size(); } | 75 IntSize Size() const override { return frame_rect_.Size(); } |
| 76 IntPoint Location() const override { return FrameViewBase::Location(); } | 76 IntPoint Location() const override { return frame_rect_.Location(); } |
| 77 | 77 |
| 78 FrameViewBase* Parent() const override { return FrameViewBase::Parent(); } | 78 virtual void SetParent(FrameViewBase* parent) { parent_ = parent; } |
|
szager1
2017/04/21 08:37:52
Why virtual?
joelhockey
2017/04/21 09:56:10
LayoutScrollbar overrides to call a private Update
| |
| 79 FrameViewBase* Root() const override { return FrameViewBase::Root(); } | 79 FrameViewBase* Parent() const { return parent_; } |
| 80 | 80 |
| 81 void SetFrameRect(const IntRect&) override; | 81 void SetFrameRect(const IntRect&); |
|
szager1
2017/04/21 08:37:52
Shouldn't this still be an override?
joelhockey
2017/04/21 09:56:10
Yes, thanks. It is still overriding ScrollbarThem
| |
| 82 IntRect FrameRect() const override { return FrameViewBase::FrameRect(); } | 82 IntRect FrameRect() const override { return frame_rect_; } |
| 83 | 83 |
| 84 ScrollbarOverlayColorTheme GetScrollbarOverlayColorTheme() const override; | 84 ScrollbarOverlayColorTheme GetScrollbarOverlayColorTheme() const override; |
| 85 void GetTickmarks(Vector<IntRect>&) const override; | 85 void GetTickmarks(Vector<IntRect>&) const override; |
| 86 bool IsScrollableAreaActive() const override; | 86 bool IsScrollableAreaActive() const override; |
| 87 | 87 |
| 88 IntPoint ConvertFromRootFrame( | 88 IntPoint ConvertFromRootFrame( |
| 89 const IntPoint& point_in_root_frame) const override; | 89 const IntPoint& point_in_root_frame) const override; |
| 90 | 90 |
| 91 bool IsCustomScrollbar() const override { return false; } | 91 bool IsCustomScrollbar() const override { return false; } |
| 92 ScrollbarOrientation Orientation() const override { return orientation_; } | 92 ScrollbarOrientation Orientation() const override { return orientation_; } |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 149 void MouseExited(); | 149 void MouseExited(); |
| 150 | 150 |
| 151 // Used by some platform scrollbars to know when they've been released from | 151 // Used by some platform scrollbars to know when they've been released from |
| 152 // capture. | 152 // capture. |
| 153 void MouseUp(const WebMouseEvent&); | 153 void MouseUp(const WebMouseEvent&); |
| 154 void MouseDown(const WebMouseEvent&); | 154 void MouseDown(const WebMouseEvent&); |
| 155 | 155 |
| 156 ScrollbarTheme& GetTheme() const { return theme_; } | 156 ScrollbarTheme& GetTheme() const { return theme_; } |
| 157 | 157 |
| 158 IntRect ConvertToContainingFrameViewBase(const IntRect&) const; | 158 IntRect ConvertToContainingFrameViewBase(const IntRect&) const; |
| 159 IntPoint ConvertFromContainingFrameViewBase(const IntPoint&) const override; | 159 IntPoint ConvertFromContainingFrameViewBase(const IntPoint&) const; |
| 160 | 160 |
| 161 void MoveThumb(int pos, bool dragging_document = false); | 161 void MoveThumb(int pos, bool dragging_document = false); |
| 162 | 162 |
| 163 float ElasticOverscroll() const override { return elastic_overscroll_; } | 163 float ElasticOverscroll() const override { return elastic_overscroll_; } |
| 164 void SetElasticOverscroll(float elastic_overscroll) override { | 164 void SetElasticOverscroll(float elastic_overscroll) override { |
| 165 elastic_overscroll_ = elastic_overscroll; | 165 elastic_overscroll_ = elastic_overscroll; |
| 166 } | 166 } |
| 167 | 167 |
| 168 // Use setNeedsPaintInvalidation to cause the scrollbar (or parts thereof) | 168 // Use setNeedsPaintInvalidation to cause the scrollbar (or parts thereof) |
| 169 // to repaint. | 169 // to repaint. |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 232 bool dragging_document_; | 232 bool dragging_document_; |
| 233 int document_drag_pos_; | 233 int document_drag_pos_; |
| 234 | 234 |
| 235 bool enabled_; | 235 bool enabled_; |
| 236 | 236 |
| 237 TaskRunnerTimer<Scrollbar> scroll_timer_; | 237 TaskRunnerTimer<Scrollbar> scroll_timer_; |
| 238 | 238 |
| 239 float elastic_overscroll_; | 239 float elastic_overscroll_; |
| 240 | 240 |
| 241 private: | 241 private: |
| 242 bool IsScrollbar() const override { return true; } | |
| 243 | |
| 244 void Invalidate() override { SetNeedsPaintInvalidation(kAllParts); } | 242 void Invalidate() override { SetNeedsPaintInvalidation(kAllParts); } |
| 245 void InvalidateRect(const IntRect&) override { | 243 void InvalidateRect(const IntRect&) override { |
| 246 SetNeedsPaintInvalidation(kAllParts); | 244 SetNeedsPaintInvalidation(kAllParts); |
| 247 } | 245 } |
| 248 | 246 |
| 249 float ScrollableAreaCurrentPos() const; | 247 float ScrollableAreaCurrentPos() const; |
| 250 float ScrollableAreaTargetPos() const; | 248 float ScrollableAreaTargetPos() const; |
| 251 bool ThumbWillBeUnderMouse() const; | 249 bool ThumbWillBeUnderMouse() const; |
| 252 | 250 |
| 253 int theme_scrollbar_thickness_; | 251 int theme_scrollbar_thickness_; |
| 254 bool track_needs_repaint_; | 252 bool track_needs_repaint_; |
| 255 bool thumb_needs_repaint_; | 253 bool thumb_needs_repaint_; |
| 256 LayoutRect visual_rect_; | 254 LayoutRect visual_rect_; |
| 255 Member<FrameViewBase> parent_; | |
|
haraken
2017/04/21 08:42:03
I think this can be Member<FrameView>. I think the
joelhockey
2017/04/21 09:56:10
I wish! That would have made my work easier ;-)
N
| |
| 256 IntRect frame_rect_; | |
| 257 }; | 257 }; |
| 258 | 258 |
| 259 DEFINE_TYPE_CASTS(Scrollbar, | |
| 260 FrameViewBase, | |
| 261 frameViewBase, | |
| 262 frameViewBase->IsScrollbar(), | |
| 263 frameViewBase.IsScrollbar()); | |
| 264 | |
| 265 } // namespace blink | 259 } // namespace blink |
| 266 | 260 |
| 267 #endif // Scrollbar_h | 261 #endif // Scrollbar_h |
| OLD | NEW |