Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 24 */ | 24 */ |
| 25 | 25 |
| 26 #include "config.h" | 26 #include "config.h" |
| 27 #include "platform/scroll/ScrollView.h" | 27 #include "platform/scroll/ScrollView.h" |
| 28 | 28 |
| 29 #include "platform/graphics/GraphicsContextStateSaver.h" | 29 #include "platform/graphics/GraphicsContextStateSaver.h" |
| 30 #include "platform/graphics/GraphicsLayer.h" | 30 #include "platform/graphics/GraphicsLayer.h" |
| 31 #include "platform/HostWindow.h" | 31 #include "platform/HostWindow.h" |
| 32 #include "platform/scroll/ScrollbarTheme.h" | 32 #include "platform/scroll/ScrollbarTheme.h" |
| 33 #include "wtf/StdLibExtras.h" | 33 #include "wtf/StdLibExtras.h" |
| 34 #include "wtf/TemporaryChange.h" | |
| 35 | 34 |
| 36 using namespace std; | 35 using namespace std; |
| 37 | 36 |
| 38 namespace WebCore { | 37 namespace WebCore { |
| 39 | 38 |
| 39 ScrollView::InUpdateScrollbarsScope::InUpdateScrollbarsScope(ScrollView* view) | |
|
ojan
2014/06/11 03:04:53
Nit: This constructor doesn't really do any work.
trchen
2014/06/11 05:04:13
SGTM. I was hesitating.
| |
| 40 : m_scope(view->m_inUpdateScrollbars, true) | |
| 41 { | |
| 42 } | |
| 43 | |
| 40 ScrollView::ScrollView() | 44 ScrollView::ScrollView() |
| 41 : m_horizontalScrollbarMode(ScrollbarAuto) | 45 : m_horizontalScrollbarMode(ScrollbarAuto) |
| 42 , m_verticalScrollbarMode(ScrollbarAuto) | 46 , m_verticalScrollbarMode(ScrollbarAuto) |
| 43 , m_horizontalScrollbarLock(false) | 47 , m_horizontalScrollbarLock(false) |
| 44 , m_verticalScrollbarLock(false) | 48 , m_verticalScrollbarLock(false) |
| 45 , m_scrollbarsAvoidingResizer(0) | 49 , m_scrollbarsAvoidingResizer(0) |
| 46 , m_scrollbarsSuppressed(false) | 50 , m_scrollbarsSuppressed(false) |
| 47 , m_inUpdateScrollbars(false) | 51 , m_inUpdateScrollbars(false) |
| 48 , m_drawPanScrollIcon(false) | 52 , m_drawPanScrollIcon(false) |
| 49 , m_paintsEntireContents(false) | 53 , m_paintsEntireContents(false) |
| (...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 451 if (!useOverlayScrollbars()) | 455 if (!useOverlayScrollbars()) |
| 452 contentsResized(); | 456 contentsResized(); |
| 453 scrollbarExistenceDidChange(); | 457 scrollbarExistenceDidChange(); |
| 454 return true; | 458 return true; |
| 455 } | 459 } |
| 456 | 460 |
| 457 void ScrollView::updateScrollbars(const IntSize& desiredOffset) | 461 void ScrollView::updateScrollbars(const IntSize& desiredOffset) |
| 458 { | 462 { |
| 459 if (m_inUpdateScrollbars) | 463 if (m_inUpdateScrollbars) |
| 460 return; | 464 return; |
| 461 TemporaryChange<bool> inUpdateScrollbarsChange(m_inUpdateScrollbars, true); | 465 InUpdateScrollbarsScope inUpdateScrollbarsScope(this); |
| 462 | 466 |
| 463 IntSize oldVisibleSize = visibleSize(); | 467 IntSize oldVisibleSize = visibleSize(); |
| 464 | 468 |
| 465 bool scrollbarExistenceChanged = false; | 469 bool scrollbarExistenceChanged = false; |
| 466 int maxUpdateScrollbarsPass = useOverlayScrollbars() || m_scrollbarsSuppress ed ? 1 : 3; | 470 int maxUpdateScrollbarsPass = useOverlayScrollbars() || m_scrollbarsSuppress ed ? 1 : 3; |
| 467 for (int updateScrollbarsPass = 0; updateScrollbarsPass < maxUpdateScrollbar sPass; updateScrollbarsPass++) { | 471 for (int updateScrollbarsPass = 0; updateScrollbarsPass < maxUpdateScrollbar sPass; updateScrollbarsPass++) { |
| 468 if (!adjustScrollbarExistence(updateScrollbarsPass ? Incremental : First Pass)) | 472 if (!adjustScrollbarExistence(updateScrollbarsPass ? Incremental : First Pass)) |
| 469 break; | 473 break; |
| 470 scrollbarExistenceChanged = true; | 474 scrollbarExistenceChanged = true; |
| 471 } | 475 } |
| (...skipping 646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1118 return; | 1122 return; |
| 1119 | 1123 |
| 1120 ScrollableArea::setScrollOrigin(origin); | 1124 ScrollableArea::setScrollOrigin(origin); |
| 1121 | 1125 |
| 1122 // Update if the scroll origin changes, since our position will be different if the content size did not change. | 1126 // Update if the scroll origin changes, since our position will be different if the content size did not change. |
| 1123 if (updatePositionAtAll && updatePositionSynchronously) | 1127 if (updatePositionAtAll && updatePositionSynchronously) |
| 1124 updateScrollbars(scrollOffset()); | 1128 updateScrollbars(scrollOffset()); |
| 1125 } | 1129 } |
| 1126 | 1130 |
| 1127 } // namespace WebCore | 1131 } // namespace WebCore |
| OLD | NEW |