Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(662)

Unified Diff: third_party/WebKit/Source/core/frame/FrameView.cpp

Issue 2836813002: Move ScrollbarManager from core to platform and use as Scrollbar parent (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/frame/FrameView.cpp
diff --git a/third_party/WebKit/Source/core/frame/FrameView.cpp b/third_party/WebKit/Source/core/frame/FrameView.cpp
index 2cfd1d97e78a89a94c185f8208f98788d830eb23..cec8902c899bd0a6420250d83ba0b395333cb2b4 100644
--- a/third_party/WebKit/Source/core/frame/FrameView.cpp
+++ b/third_party/WebKit/Source/core/frame/FrameView.cpp
@@ -206,7 +206,6 @@ FrameView::FrameView(LocalFrame& frame)
current_update_lifecycle_phases_target_state_(
DocumentLifecycle::kUninitialized),
scroll_anchor_(this),
- scrollbar_manager_(*this),
needs_scrollbars_update_(false),
suppress_adjust_view_size_(false),
allows_layout_invalidation_after_layout_clean_(true),
@@ -246,7 +245,6 @@ DEFINE_TRACE(FrameView) {
visitor->Trace(visibility_observer_);
visitor->Trace(scroll_anchor_);
visitor->Trace(anchoring_adjustment_queue_);
- visitor->Trace(scrollbar_manager_);
visitor->Trace(print_context_);
FrameViewBase::Trace(visitor);
ScrollableArea::Trace(visitor);
@@ -401,7 +399,7 @@ void FrameView::DetachScrollbars() {
// However, for Oilpan, we still need to remove the native scrollbars before
// we lose the connection to the ChromeClient, so we just unconditionally
// detach any scrollbars now.
- scrollbar_manager_.Dispose();
+ ScrollbarManager::Dispose();
if (scroll_corner_) {
scroll_corner_->Destroy();
@@ -409,8 +407,7 @@ void FrameView::DetachScrollbars() {
}
}
-void FrameView::ScrollbarManager::SetHasHorizontalScrollbar(
- bool has_scrollbar) {
+void FrameView::SetHasHorizontalScrollbar(bool has_scrollbar) {
if (has_scrollbar == HasHorizontalScrollbar())
return;
@@ -429,7 +426,7 @@ void FrameView::ScrollbarManager::SetHasHorizontalScrollbar(
scrollable_area_->SetScrollCornerNeedsPaintInvalidation();
}
-void FrameView::ScrollbarManager::SetHasVerticalScrollbar(bool has_scrollbar) {
+void FrameView::SetHasVerticalScrollbar(bool has_scrollbar) {
if (has_scrollbar == HasVerticalScrollbar())
return;
@@ -448,8 +445,7 @@ void FrameView::ScrollbarManager::SetHasVerticalScrollbar(bool has_scrollbar) {
scrollable_area_->SetScrollCornerNeedsPaintInvalidation();
}
-Scrollbar* FrameView::ScrollbarManager::CreateScrollbar(
- ScrollbarOrientation orientation) {
+Scrollbar* FrameView::CreateScrollbar(ScrollbarOrientation orientation) {
Element* custom_scrollbar_element = nullptr;
LayoutBox* box = scrollable_area_->GetLayoutBox();
if (box->GetDocument().View()->ShouldUseCustomScrollbars(
@@ -464,8 +460,7 @@ Scrollbar* FrameView::ScrollbarManager::CreateScrollbar(
&box->GetFrame()->GetPage()->GetChromeClient());
}
-void FrameView::ScrollbarManager::DestroyScrollbar(
- ScrollbarOrientation orientation) {
+void FrameView::DestroyScrollbar(ScrollbarOrientation orientation) {
Member<Scrollbar>& scrollbar =
orientation == kHorizontalScrollbar ? h_bar_ : v_bar_;
DCHECK(orientation == kHorizontalScrollbar ? !h_bar_is_attached_
@@ -498,8 +493,8 @@ void FrameView::RecalculateCustomScrollbarStyle() {
}
void FrameView::InvalidateAllCustomScrollbarsOnActiveChanged() {
- bool uses_window_inactive_selector =
- frame_->GetDocument()->GetStyleEngine().UsesWindowInactiveSelector();
+ if (!frame_->GetDocument()->GetStyleEngine().UsesWindowInactiveSelector())
+ return;
const ChildrenSet* view_children = Children();
for (const Member<FrameViewBase>& child : *view_children) {
@@ -511,12 +506,10 @@ void FrameView::InvalidateAllCustomScrollbarsOnActiveChanged() {
}
for (const Member<Scrollbar>& scrollbar : *Scrollbars()) {
- if (uses_window_inactive_selector && scrollbar->IsCustomScrollbar())
- scrollbar->StyleChanged();
+ scrollbar->StyleChanged();
}
- if (uses_window_inactive_selector)
- RecalculateCustomScrollbarStyle();
+ RecalculateCustomScrollbarStyle();
}
void FrameView::Clear() {
@@ -700,10 +693,6 @@ bool FrameView::ShouldUseCustomScrollbars(
return false;
}
-Scrollbar* FrameView::CreateScrollbar(ScrollbarOrientation orientation) {
- return scrollbar_manager_.CreateScrollbar(orientation);
-}
-
void FrameView::SetContentsSize(const IntSize& size) {
if (size == ContentsSize())
return;
@@ -2900,9 +2889,8 @@ void FrameView::VisualViewportScrollbarsChanged() {
bool should_have_vertical_scrollbar = false;
ComputeScrollbarExistence(should_have_horizontal_scrollbar,
should_have_vertical_scrollbar, ContentsSize());
- scrollbar_manager_.SetHasHorizontalScrollbar(
- should_have_horizontal_scrollbar);
- scrollbar_manager_.SetHasVerticalScrollbar(should_have_vertical_scrollbar);
+ SetHasHorizontalScrollbar(should_have_horizontal_scrollbar);
+ SetHasVerticalScrollbar(should_have_vertical_scrollbar);
if (has_horizontal_scrollbar != should_have_horizontal_scrollbar ||
has_vertical_scrollbar != should_have_vertical_scrollbar) {
@@ -4278,8 +4266,8 @@ bool FrameView::AdjustScrollbarExistence(
if (!scrollbar_existence_changed)
return false;
- scrollbar_manager_.SetHasHorizontalScrollbar(new_has_horizontal_scrollbar);
- scrollbar_manager_.SetHasVerticalScrollbar(new_has_vertical_scrollbar);
+ SetHasHorizontalScrollbar(new_has_horizontal_scrollbar);
+ SetHasVerticalScrollbar(new_has_vertical_scrollbar);
if (scrollbars_suppressed_)
return true;
@@ -4341,8 +4329,8 @@ void FrameView::UpdateScrollbars() {
// Avoid drawing two sets of scrollbars when visual viewport is enabled.
if (VisualViewportSuppliesScrollbars()) {
- scrollbar_manager_.SetHasHorizontalScrollbar(false);
- scrollbar_manager_.SetHasVerticalScrollbar(false);
+ SetHasHorizontalScrollbar(false);
+ SetHasVerticalScrollbar(false);
AdjustScrollOffsetFromUpdateScrollbars();
return;
}
@@ -4354,8 +4342,8 @@ void FrameView::UpdateScrollbars() {
bool scrollbar_existence_changed = false;
if (NeedsScrollbarReconstruction()) {
- scrollbar_manager_.SetHasHorizontalScrollbar(false);
- scrollbar_manager_.SetHasVerticalScrollbar(false);
+ SetHasHorizontalScrollbar(false);
+ SetHasVerticalScrollbar(false);
scrollbar_existence_changed = true;
}
« no previous file with comments | « third_party/WebKit/Source/core/frame/FrameView.h ('k') | third_party/WebKit/Source/core/frame/RootFrameViewport.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698