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

Side by Side 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: Invalidate ,adjust custom scrollbar on thickness change 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org> 2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
3 * 1999 Lars Knoll <knoll@kde.org> 3 * 1999 Lars Knoll <knoll@kde.org>
4 * 1999 Antti Koivisto <koivisto@kde.org> 4 * 1999 Antti Koivisto <koivisto@kde.org>
5 * 2000 Dirk Mueller <mueller@kde.org> 5 * 2000 Dirk Mueller <mueller@kde.org>
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
7 * (C) 2006 Graham Dennis (graham.dennis@gmail.com) 7 * (C) 2006 Graham Dennis (graham.dennis@gmail.com)
8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) 8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com)
9 * Copyright (C) 2009 Google Inc. All rights reserved. 9 * Copyright (C) 2009 Google Inc. All rights reserved.
10 * 10 *
(...skipping 3281 matching lines...) Expand 10 before | Expand all | Expand 10 after
3292 int clientWidth = visibleWidth(); 3292 int clientWidth = visibleWidth();
3293 IntRect oldRect(m_horizontalScrollbar->frameRect()); 3293 IntRect oldRect(m_horizontalScrollbar->frameRect());
3294 IntRect hBarRect((shouldPlaceVerticalScrollbarOnLeft() && m_verticalScro llbar) ? m_verticalScrollbar->width() : 0, 3294 IntRect hBarRect((shouldPlaceVerticalScrollbarOnLeft() && m_verticalScro llbar) ? m_verticalScrollbar->width() : 0,
3295 height() - m_horizontalScrollbar->height(), 3295 height() - m_horizontalScrollbar->height(),
3296 width() - (m_verticalScrollbar ? m_verticalScrollbar->width() : 0), 3296 width() - (m_verticalScrollbar ? m_verticalScrollbar->width() : 0),
3297 m_horizontalScrollbar->height()); 3297 m_horizontalScrollbar->height());
3298 m_horizontalScrollbar->setFrameRect(adjustScrollbarRectForResizer(hBarRe ct, m_horizontalScrollbar.get())); 3298 m_horizontalScrollbar->setFrameRect(adjustScrollbarRectForResizer(hBarRe ct, m_horizontalScrollbar.get()));
3299 if (!m_scrollbarsSuppressed && oldRect != m_horizontalScrollbar->frameRe ct()) 3299 if (!m_scrollbarsSuppressed && oldRect != m_horizontalScrollbar->frameRe ct())
3300 m_horizontalScrollbar->invalidate(); 3300 m_horizontalScrollbar->invalidate();
3301 3301
3302 oldRect = m_horizontalScrollbar->frameRect();
3303
3302 if (m_scrollbarsSuppressed) 3304 if (m_scrollbarsSuppressed)
3303 m_horizontalScrollbar->setSuppressInvalidation(true); 3305 m_horizontalScrollbar->setSuppressInvalidation(true);
3304 m_horizontalScrollbar->setEnabled(contentsWidth() > clientWidth); 3306 m_horizontalScrollbar->setEnabled(contentsWidth() > clientWidth);
3305 m_horizontalScrollbar->setProportion(clientWidth, contentsWidth()); 3307 m_horizontalScrollbar->setProportion(clientWidth, contentsWidth());
3306 m_horizontalScrollbar->offsetDidChange(); 3308 m_horizontalScrollbar->offsetDidChange();
3307 if (m_scrollbarsSuppressed) 3309 if (m_scrollbarsSuppressed)
3308 m_horizontalScrollbar->setSuppressInvalidation(false); 3310 m_horizontalScrollbar->setSuppressInvalidation(false);
3311
3312 if (!m_scrollbarsSuppressed && oldRect != m_horizontalScrollbar->frameRe ct() && m_horizontalScrollbar->isCustomScrollbar()) {
3313 IntRect hBarRect((shouldPlaceVerticalScrollbarOnLeft() && m_vertical Scrollbar) ? m_verticalScrollbar->width() : 0,
3314 height() - m_horizontalScrollbar->height(),
3315 width() - (m_verticalScrollbar ? m_verticalScrollbar->width() : 0),
3316 m_horizontalScrollbar->height());
3317 m_horizontalScrollbar->setFrameRect(adjustScrollbarRectForResizer(hB arRect, m_horizontalScrollbar.get()));
3318 if (oldRect.height() != m_horizontalScrollbar->frameRect().height())
3319 scrollbarExistenceDidChange();
esprehn 2014/10/29 06:43:50 What behavior are you trying to trigger here? The
MuVen 2014/10/29 09:39:59 Upon zooming in, customScrollbar style scales by s
3320 m_horizontalScrollbar->invalidate();
3321 }
3309 } 3322 }
3310 3323
3311 if (m_verticalScrollbar) { 3324 if (m_verticalScrollbar) {
3312 int clientHeight = visibleHeight(); 3325 int clientHeight = visibleHeight();
3313 IntRect oldRect(m_verticalScrollbar->frameRect()); 3326 IntRect oldRect(m_verticalScrollbar->frameRect());
3314 IntRect vBarRect(shouldPlaceVerticalScrollbarOnLeft() ? 0 : (width() - m _verticalScrollbar->width()), 3327 IntRect vBarRect(shouldPlaceVerticalScrollbarOnLeft() ? 0 : (width() - m _verticalScrollbar->width()),
3315 0, 3328 0,
3316 m_verticalScrollbar->width(), 3329 m_verticalScrollbar->width(),
3317 height() - (m_horizontalScrollbar ? m_horizontalScrollbar->height() : 0)); 3330 height() - (m_horizontalScrollbar ? m_horizontalScrollbar->height() : 0));
3318 m_verticalScrollbar->setFrameRect(adjustScrollbarRectForResizer(vBarRect , m_verticalScrollbar.get())); 3331 m_verticalScrollbar->setFrameRect(adjustScrollbarRectForResizer(vBarRect , m_verticalScrollbar.get()));
3319 if (!m_scrollbarsSuppressed && oldRect != m_verticalScrollbar->frameRect ()) 3332 if (!m_scrollbarsSuppressed && oldRect != m_verticalScrollbar->frameRect ())
3320 m_verticalScrollbar->invalidate(); 3333 m_verticalScrollbar->invalidate();
3321 3334
3335 oldRect = m_verticalScrollbar->frameRect();
3336
3322 if (m_scrollbarsSuppressed) 3337 if (m_scrollbarsSuppressed)
3323 m_verticalScrollbar->setSuppressInvalidation(true); 3338 m_verticalScrollbar->setSuppressInvalidation(true);
3324 m_verticalScrollbar->setEnabled(contentsHeight() > clientHeight); 3339 m_verticalScrollbar->setEnabled(contentsHeight() > clientHeight);
3325 m_verticalScrollbar->setProportion(clientHeight, contentsHeight()); 3340 m_verticalScrollbar->setProportion(clientHeight, contentsHeight());
3326 m_verticalScrollbar->offsetDidChange(); 3341 m_verticalScrollbar->offsetDidChange();
3327 if (m_scrollbarsSuppressed) 3342 if (m_scrollbarsSuppressed)
3328 m_verticalScrollbar->setSuppressInvalidation(false); 3343 m_verticalScrollbar->setSuppressInvalidation(false);
3344
3345 if (!m_scrollbarsSuppressed && oldRect != m_verticalScrollbar->frameRect () && m_verticalScrollbar->isCustomScrollbar()) {
3346 IntRect vBarRect(shouldPlaceVerticalScrollbarOnLeft() ? 0 : (width() - m_verticalScrollbar->width()),
3347 0,
3348 m_verticalScrollbar->width(),
3349 height() - (m_horizontalScrollbar ? m_horizontalScrollbar->heigh t() : 0));
3350 m_verticalScrollbar->setFrameRect(adjustScrollbarRectForResizer(vBar Rect, m_verticalScrollbar.get()));
3351 if (oldRect.width() != m_verticalScrollbar->frameRect().width())
3352 scrollbarExistenceDidChange();
3353 m_verticalScrollbar->invalidate();
3354 }
rwlbuis 2014/10/28 14:59:03 I see a repeated code pattern, meaning a shared fu
3329 } 3355 }
3330 } 3356 }
3331 3357
3332 IntRect FrameView::adjustScrollbarRectForResizer(const IntRect& rect, Scrollbar* scrollbar) 3358 IntRect FrameView::adjustScrollbarRectForResizer(const IntRect& rect, Scrollbar* scrollbar)
3333 { 3359 {
3334 // Get our window resizer rect and see if we overlap. Adjust to avoid the ov erlap 3360 // Get our window resizer rect and see if we overlap. Adjust to avoid the ov erlap
3335 // if necessary. 3361 // if necessary.
3336 IntRect adjustedRect(rect); 3362 IntRect adjustedRect(rect);
3337 bool overlapsResizer = false; 3363 bool overlapsResizer = false;
3338 if (!rect.isEmpty() && !windowResizerRect().isEmpty()) { 3364 if (!rect.isEmpty() && !windowResizerRect().isEmpty()) {
(...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after
3918 return; 3944 return;
3919 3945
3920 ScrollableArea::setScrollOrigin(origin); 3946 ScrollableArea::setScrollOrigin(origin);
3921 3947
3922 // Update if the scroll origin changes, since our position will be different if the content size did not change. 3948 // Update if the scroll origin changes, since our position will be different if the content size did not change.
3923 if (updatePositionAtAll && updatePositionSynchronously) 3949 if (updatePositionAtAll && updatePositionSynchronously)
3924 updateScrollbars(scrollOffsetDouble()); 3950 updateScrollbars(scrollOffsetDouble());
3925 } 3951 }
3926 3952
3927 } // namespace blink 3953 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698