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

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: Fix for clang compile error 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
« no previous file with comments | « Source/core/platform/Scrollbar.h ('k') | Source/core/platform/Widget.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/platform/Scrollbar.cpp
diff --git a/Source/core/platform/Scrollbar.cpp b/Source/core/platform/Scrollbar.cpp
index 66962b6119a66d17cead9810a663a6bc2d6f9328..6a4f5113a8fffcf08d63d77fe9160577414c0d12 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)) {
@@ -508,10 +524,10 @@ void Scrollbar::setFrameRect(const IntRect& rect)
Widget::setFrameRect(adjustedRect);
}
-void Scrollbar::setParent(ScrollView* parentView)
+void Scrollbar::setParent(Widget* 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)
« no previous file with comments | « Source/core/platform/Scrollbar.h ('k') | Source/core/platform/Widget.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698