Commit ecec3d18 authored by Stefan Zager's avatar Stefan Zager Committed by Commit Bot

[RootLayerScrolls] Get rid of ScrollbarManager super-class

ScrollbarManager is now PLSA-specific.

BUG=823365
R=skobes@chromium.org,pdr@chromium.org

Cq-Include-Trybots: luci.chromium.try:linux_layout_tests_slimming_paint_v2;master.tryserver.blink:linux_trusty_blink_rel
Change-Id: Ia872266afb330836c10f6e36dce3e756a5895734
Reviewed-on: https://chromium-review.googlesource.com/1110881Reviewed-by: default avatarSteve Kobes <skobes@chromium.org>
Reviewed-by: default avatarPhilip Rogers <pdr@chromium.org>
Commit-Queue: Stefan Zager <szager@chromium.org>
Cr-Commit-Position: refs/heads/master@{#569442}
parent 9dd345d0
...@@ -201,8 +201,6 @@ blink_core_sources("paint") { ...@@ -201,8 +201,6 @@ blink_core_sources("paint") {
"scroll_recorder.h", "scroll_recorder.h",
"scrollable_area_painter.cc", "scrollable_area_painter.cc",
"scrollable_area_painter.h", "scrollable_area_painter.h",
"scrollbar_manager.cc",
"scrollbar_manager.h",
"scrollbar_painter.cc", "scrollbar_painter.cc",
"scrollbar_painter.h", "scrollbar_painter.h",
"selection_painting_utils.cc", "selection_painting_utils.cc",
......
...@@ -2334,20 +2334,6 @@ void PaintLayerScrollableArea::GetTickmarks(Vector<IntRect>& tickmarks) const { ...@@ -2334,20 +2334,6 @@ void PaintLayerScrollableArea::GetTickmarks(Vector<IntRect>& tickmarks) const {
tickmarks = ToLayoutView(GetLayoutBox())->GetTickmarks(); tickmarks = ToLayoutView(GetLayoutBox())->GetTickmarks();
} }
PaintLayerScrollableArea*
PaintLayerScrollableArea::ScrollbarManager::ScrollableArea() {
return ToPaintLayerScrollableArea(scrollable_area_.Get());
}
void PaintLayerScrollableArea::ScrollbarManager::DestroyDetachedScrollbars() {
DCHECK(!h_bar_is_attached_ || h_bar_);
DCHECK(!v_bar_is_attached_ || v_bar_);
if (h_bar_ && !h_bar_is_attached_)
DestroyScrollbar(kHorizontalScrollbar);
if (v_bar_ && !v_bar_is_attached_)
DestroyScrollbar(kVerticalScrollbar);
}
void PaintLayerScrollableArea::ScrollbarManager::SetHasHorizontalScrollbar( void PaintLayerScrollableArea::ScrollbarManager::SetHasHorizontalScrollbar(
bool has_scrollbar) { bool has_scrollbar) {
if (has_scrollbar) { if (has_scrollbar) {
...@@ -2444,6 +2430,28 @@ void PaintLayerScrollableArea::ScrollbarManager::DestroyScrollbar( ...@@ -2444,6 +2430,28 @@ void PaintLayerScrollableArea::ScrollbarManager::DestroyScrollbar(
scrollbar = nullptr; scrollbar = nullptr;
} }
void PaintLayerScrollableArea::ScrollbarManager::DestroyDetachedScrollbars() {
DCHECK(!h_bar_is_attached_ || h_bar_);
DCHECK(!v_bar_is_attached_ || v_bar_);
if (h_bar_ && !h_bar_is_attached_)
DestroyScrollbar(kHorizontalScrollbar);
if (v_bar_ && !v_bar_is_attached_)
DestroyScrollbar(kVerticalScrollbar);
}
void PaintLayerScrollableArea::ScrollbarManager::Dispose() {
h_bar_is_attached_ = v_bar_is_attached_ = 0;
DestroyScrollbar(kHorizontalScrollbar);
DestroyScrollbar(kVerticalScrollbar);
}
void PaintLayerScrollableArea::ScrollbarManager::Trace(
blink::Visitor* visitor) {
visitor->Trace(scrollable_area_);
visitor->Trace(h_bar_);
visitor->Trace(v_bar_);
}
uint64_t PaintLayerScrollableArea::Id() const { uint64_t PaintLayerScrollableArea::Id() const {
return DOMNodeIds::IdForNode(GetLayoutBox()->GetNode()); return DOMNodeIds::IdForNode(GetLayoutBox()->GetNode());
} }
......
...@@ -51,7 +51,6 @@ ...@@ -51,7 +51,6 @@
#include "third_party/blink/renderer/core/page/scrolling/sticky_position_scrolling_constraints.h" #include "third_party/blink/renderer/core/page/scrolling/sticky_position_scrolling_constraints.h"
#include "third_party/blink/renderer/core/paint/paint_invalidation_capable_scrollable_area.h" #include "third_party/blink/renderer/core/paint/paint_invalidation_capable_scrollable_area.h"
#include "third_party/blink/renderer/core/paint/paint_layer_fragment.h" #include "third_party/blink/renderer/core/paint/paint_layer_fragment.h"
#include "third_party/blink/renderer/core/paint/scrollbar_manager.h"
#include "third_party/blink/renderer/platform/heap/handle.h" #include "third_party/blink/renderer/platform/heap/handle.h"
#include "third_party/blink/renderer/platform/scroll/scroll_types.h" #include "third_party/blink/renderer/platform/scroll/scroll_types.h"
...@@ -120,7 +119,7 @@ class CORE_EXPORT PaintLayerScrollableArea final ...@@ -120,7 +119,7 @@ class CORE_EXPORT PaintLayerScrollableArea final
friend class Internals; friend class Internals;
private: private:
class ScrollbarManager : public blink::ScrollbarManager { class ScrollbarManager {
DISALLOW_NEW(); DISALLOW_NEW();
// Helper class to manage the life cycle of Scrollbar objects. Some layout // Helper class to manage the life cycle of Scrollbar objects. Some layout
...@@ -136,19 +135,43 @@ class CORE_EXPORT PaintLayerScrollableArea final ...@@ -136,19 +135,43 @@ class CORE_EXPORT PaintLayerScrollableArea final
// previously "deleted" scrollbar will be restored, rather than constructing // previously "deleted" scrollbar will be restored, rather than constructing
// a new one. // a new one.
public: public:
ScrollbarManager(PaintLayerScrollableArea& scroller) ScrollbarManager(PaintLayerScrollableArea& scrollable_area)
: blink::ScrollbarManager(scroller) {} : scrollable_area_(scrollable_area),
h_bar_is_attached_(0),
v_bar_is_attached_(0) {}
void SetHasHorizontalScrollbar(bool has_scrollbar) override; PaintLayerScrollableArea* ScrollableArea() const {
void SetHasVerticalScrollbar(bool has_scrollbar) override; return scrollable_area_.Get();
}
Scrollbar* HorizontalScrollbar() const {
return h_bar_is_attached_ ? h_bar_.Get() : nullptr;
}
Scrollbar* VerticalScrollbar() const {
return v_bar_is_attached_ ? v_bar_.Get() : nullptr;
}
bool HasHorizontalScrollbar() const { return HorizontalScrollbar(); }
bool HasVerticalScrollbar() const { return VerticalScrollbar(); }
void SetHasHorizontalScrollbar(bool has_scrollbar);
void SetHasVerticalScrollbar(bool has_scrollbar);
Scrollbar* CreateScrollbar(ScrollbarOrientation);
void DestroyDetachedScrollbars(); void DestroyDetachedScrollbars();
Scrollbar* CreateScrollbar(ScrollbarOrientation) override; void Dispose();
void Trace(blink::Visitor*);
private:
void DestroyScrollbar(ScrollbarOrientation);
Member<PaintLayerScrollableArea> scrollable_area_;
protected: // The scrollbars associated with scrollable_area_. Both can nullptr.
void DestroyScrollbar(ScrollbarOrientation) override; Member<Scrollbar> h_bar_;
Member<Scrollbar> v_bar_;
PaintLayerScrollableArea* ScrollableArea(); unsigned h_bar_is_attached_ : 1;
unsigned v_bar_is_attached_ : 1;
}; };
public: public:
......
// Copyright 2016 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.
#include "third_party/blink/renderer/core/paint/scrollbar_manager.h"
namespace blink {
ScrollbarManager::ScrollbarManager(ScrollableArea& scrollable_area)
: scrollable_area_(&scrollable_area),
h_bar_is_attached_(0),
v_bar_is_attached_(0) {}
void ScrollbarManager::Trace(blink::Visitor* visitor) {
visitor->Trace(scrollable_area_);
visitor->Trace(h_bar_);
visitor->Trace(v_bar_);
}
void ScrollbarManager::Dispose() {
h_bar_is_attached_ = v_bar_is_attached_ = 0;
DestroyScrollbar(kHorizontalScrollbar);
DestroyScrollbar(kVerticalScrollbar);
}
} // namespace blink
// Copyright 2016 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_RENDERER_CORE_PAINT_SCROLLBAR_MANAGER_H_
#define THIRD_PARTY_BLINK_RENDERER_CORE_PAINT_SCROLLBAR_MANAGER_H_
#include "third_party/blink/renderer/core/core_export.h"
#include "third_party/blink/renderer/platform/scroll/scrollable_area.h"
namespace blink {
class CORE_EXPORT ScrollbarManager {
DISALLOW_NEW();
// Helper class to manage the life cycle of Scrollbar objects.
public:
ScrollbarManager(ScrollableArea&);
void Dispose();
Scrollbar* HorizontalScrollbar() const {
return h_bar_is_attached_ ? h_bar_.Get() : nullptr;
}
Scrollbar* VerticalScrollbar() const {
return v_bar_is_attached_ ? v_bar_.Get() : nullptr;
}
bool HasHorizontalScrollbar() const { return HorizontalScrollbar(); }
bool HasVerticalScrollbar() const { return VerticalScrollbar(); }
// These functions are used to create/destroy scrollbars.
virtual void SetHasHorizontalScrollbar(bool has_scrollbar) = 0;
virtual void SetHasVerticalScrollbar(bool has_scrollbar) = 0;
virtual void Trace(blink::Visitor*);
protected:
// TODO(ymalik): This can be made non-virtual since there's a lot of
// common code in subclasses.
virtual Scrollbar* CreateScrollbar(ScrollbarOrientation) = 0;
virtual void DestroyScrollbar(ScrollbarOrientation) = 0;
protected:
Member<ScrollableArea> scrollable_area_;
// The scrollbars associated with m_scrollableArea. Both can nullptr.
Member<Scrollbar> h_bar_;
Member<Scrollbar> v_bar_;
unsigned h_bar_is_attached_ : 1;
unsigned v_bar_is_attached_ : 1;
};
} // namespace blink
#endif // THIRD_PARTY_BLINK_RENDERER_CORE_PAINT_SCROLLBAR_MANAGER_H_
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