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

Unified Diff: Source/core/platform/Scrollbar.cpp

Issue 26936002: Remove Widget's dependency upon its own inheritor aka ScrollView. This was nasty from an OO design… (Closed) Base URL: https://chromium.googlesource.com/chromium/blink@master
Patch Set: Clean up by using helper functions where appropriate Created 7 years, 2 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: Source/core/platform/Scrollbar.cpp
diff --git a/Source/core/platform/Scrollbar.cpp b/Source/core/platform/Scrollbar.cpp
index 66962b6119a66d17cead9810a663a6bc2d6f9328..bea5ce3b385b1a7509228e907bf9f53c476195df 100644
--- a/Source/core/platform/Scrollbar.cpp
+++ b/Source/core/platform/Scrollbar.cpp
@@ -101,6 +101,22 @@ Scrollbar::~Scrollbar()
m_theme->unregisterScrollbar(this);
}
+void Scrollbar::removeFromParent()
+{
+ if (parent())
+ toScrollView(parent())->removeChild(this);
+}
+
+ScrollView* Scrollbar::parentScrollView() const
+{
+ return toScrollView(parent());
+}
+
+ScrollView* Scrollbar::rootScrollView() const
+{
+ return toScrollView(root());
+}
+
ScrollbarOverlayStyle Scrollbar::scrollbarOverlayStyle() const
{
return m_scrollableArea ? m_scrollableArea->scrollbarOverlayStyle() : ScrollbarOverlayStyleDefault;
@@ -480,7 +496,7 @@ void Scrollbar::setFrameRect(const IntRect& rect)
// if necessary.
IntRect adjustedRect(rect);
bool overlapsResizer = false;
- ScrollView* view = parent();
+ ScrollView* view = parentScrollView();
if (view && !rect.isEmpty() && !view->windowResizerRect().isEmpty()) {
IntRect resizerRect = view->convertFromContainingWindow(view->windowResizerRect());
if (rect.intersects(resizerRect)) {
@@ -510,8 +526,8 @@ void Scrollbar::setFrameRect(const IntRect& rect)
void Scrollbar::setParent(ScrollView* parentView)
{
- if (!parentView && m_overlapsResizer && parent())
- parent()->adjustScrollbarsAvoidingResizerCount(-1);
+ if (!parentView && m_overlapsResizer && parentScrollView())
+ parentScrollView()->adjustScrollbarsAvoidingResizerCount(-1);
Widget::setParent(parentView);
}
@@ -544,10 +560,10 @@ bool Scrollbar::isWindowActive() const
AXObjectCache* Scrollbar::existingAXObjectCache() const
{
- if (!parent())
+ if (!parentScrollView())
return 0;
- return parent()->axObjectCache();
+ return parentScrollView()->axObjectCache();
}
void Scrollbar::invalidateRect(const IntRect& rect)

Powered by Google App Engine
This is Rietveld 408576698