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

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

Issue 503583002: Fixed Inconsistent behaviour of custom-scrollbar (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: addressed review comments Created 6 years, 1 month 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/frame/FrameView.h ('k') | Source/core/rendering/RenderScrollbar.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/frame/FrameView.cpp
diff --git a/Source/core/frame/FrameView.cpp b/Source/core/frame/FrameView.cpp
index 0de05a9afddf16597794d73fd931bbfc17820627..beb1677547861812d27a329ad8e993734f830f02 100644
--- a/Source/core/frame/FrameView.cpp
+++ b/Source/core/frame/FrameView.cpp
@@ -1698,7 +1698,7 @@ void FrameView::contentsResized()
setNeedsLayout();
}
-void FrameView::scrollbarExistenceDidChange()
+void FrameView::scrollbarNeedsLayout()
{
// We check to make sure the view is attached to a frame() as this method can
// be triggered before the view is attached by LocalFrame::createView(...) setting
@@ -3310,6 +3310,8 @@ void FrameView::updateScrollbarGeometry()
if (!m_scrollbarsSuppressed && oldRect != m_horizontalScrollbar->frameRect())
m_horizontalScrollbar->invalidate();
+ oldRect = m_horizontalScrollbar->frameRect();
+
if (m_scrollbarsSuppressed)
m_horizontalScrollbar->setSuppressInvalidation(true);
m_horizontalScrollbar->setEnabled(contentsWidth() > clientWidth);
@@ -3317,6 +3319,17 @@ void FrameView::updateScrollbarGeometry()
m_horizontalScrollbar->offsetDidChange();
if (m_scrollbarsSuppressed)
m_horizontalScrollbar->setSuppressInvalidation(false);
+
+ if (!m_scrollbarsSuppressed && oldRect != m_horizontalScrollbar->frameRect() && m_horizontalScrollbar->isCustomScrollbar()) {
+ IntRect hBarRect((shouldPlaceVerticalScrollbarOnLeft() && m_verticalScrollbar) ? m_verticalScrollbar->width() : 0,
+ height() - m_horizontalScrollbar->height(),
+ width() - (m_verticalScrollbar ? m_verticalScrollbar->width() : 0),
+ m_horizontalScrollbar->height());
+ m_horizontalScrollbar->setFrameRect(adjustScrollbarRectForResizer(hBarRect, m_horizontalScrollbar.get()));
+ if (oldRect.height() != m_horizontalScrollbar->frameRect().height())
+ scrollbarNeedsLayout();
+ m_horizontalScrollbar->invalidate();
+ }
}
if (m_verticalScrollbar) {
@@ -3330,6 +3343,8 @@ void FrameView::updateScrollbarGeometry()
if (!m_scrollbarsSuppressed && oldRect != m_verticalScrollbar->frameRect())
m_verticalScrollbar->invalidate();
+ oldRect = m_verticalScrollbar->frameRect();
+
if (m_scrollbarsSuppressed)
m_verticalScrollbar->setSuppressInvalidation(true);
m_verticalScrollbar->setEnabled(contentsHeight() > clientHeight);
@@ -3337,6 +3352,17 @@ void FrameView::updateScrollbarGeometry()
m_verticalScrollbar->offsetDidChange();
if (m_scrollbarsSuppressed)
m_verticalScrollbar->setSuppressInvalidation(false);
+
+ if (!m_scrollbarsSuppressed && oldRect != m_verticalScrollbar->frameRect() && m_verticalScrollbar->isCustomScrollbar()) {
+ IntRect vBarRect(shouldPlaceVerticalScrollbarOnLeft() ? 0 : (width() - m_verticalScrollbar->width()),
+ 0,
+ m_verticalScrollbar->width(),
+ height() - (m_horizontalScrollbar ? m_horizontalScrollbar->height() : 0));
+ m_verticalScrollbar->setFrameRect(adjustScrollbarRectForResizer(vBarRect, m_verticalScrollbar.get()));
+ if (oldRect.width() != m_verticalScrollbar->frameRect().width())
+ scrollbarNeedsLayout();
+ m_verticalScrollbar->invalidate();
+ }
}
}
@@ -3379,7 +3405,7 @@ bool FrameView::adjustScrollbarExistence(ComputeScrollbarExistenceOption option)
// first. (This will be the common case, e.g., when the page changes due to window resizing for example).
// This layout will not re-enter updateScrollbars and does not count towards our max layout pass total.
if (!m_scrollbarsSuppressed)
- scrollbarExistenceDidChange();
+ scrollbarNeedsLayout();
bool hasHorizontalScrollbar = m_horizontalScrollbar;
bool hasVerticalScrollbar = m_verticalScrollbar;
@@ -3400,7 +3426,7 @@ bool FrameView::adjustScrollbarExistence(ComputeScrollbarExistenceOption option)
if (!useOverlayScrollbars())
contentsResized();
- scrollbarExistenceDidChange();
+ scrollbarNeedsLayout();
return true;
}
« no previous file with comments | « Source/core/frame/FrameView.h ('k') | Source/core/rendering/RenderScrollbar.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698