| 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 |
| 40 ScrollView::ScrollView() | 39 ScrollView::ScrollView() |
| 41 : m_horizontalScrollbarMode(ScrollbarAuto) | 40 : m_horizontalScrollbarMode(ScrollbarAuto) |
| 42 , m_verticalScrollbarMode(ScrollbarAuto) | 41 , m_verticalScrollbarMode(ScrollbarAuto) |
| 43 , m_horizontalScrollbarLock(false) | 42 , m_horizontalScrollbarLock(false) |
| 44 , m_verticalScrollbarLock(false) | 43 , m_verticalScrollbarLock(false) |
| (...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 451 if (!useOverlayScrollbars()) | 450 if (!useOverlayScrollbars()) |
| 452 contentsResized(); | 451 contentsResized(); |
| 453 scrollbarExistenceDidChange(); | 452 scrollbarExistenceDidChange(); |
| 454 return true; | 453 return true; |
| 455 } | 454 } |
| 456 | 455 |
| 457 void ScrollView::updateScrollbars(const IntSize& desiredOffset) | 456 void ScrollView::updateScrollbars(const IntSize& desiredOffset) |
| 458 { | 457 { |
| 459 if (m_inUpdateScrollbars) | 458 if (m_inUpdateScrollbars) |
| 460 return; | 459 return; |
| 461 TemporaryChange<bool> inUpdateScrollbarsChange(m_inUpdateScrollbars, true); | 460 InUpdateScrollbarsScope inUpdateScrollbarsScope(this); |
| 462 | 461 |
| 463 IntSize oldVisibleSize = visibleSize(); | 462 IntSize oldVisibleSize = visibleSize(); |
| 464 | 463 |
| 465 bool scrollbarExistenceChanged = false; | 464 bool scrollbarExistenceChanged = false; |
| 466 int maxUpdateScrollbarsPass = useOverlayScrollbars() || m_scrollbarsSuppress
ed ? 1 : 3; | 465 int maxUpdateScrollbarsPass = useOverlayScrollbars() || m_scrollbarsSuppress
ed ? 1 : 3; |
| 467 for (int updateScrollbarsPass = 0; updateScrollbarsPass < maxUpdateScrollbar
sPass; updateScrollbarsPass++) { | 466 for (int updateScrollbarsPass = 0; updateScrollbarsPass < maxUpdateScrollbar
sPass; updateScrollbarsPass++) { |
| 468 if (!adjustScrollbarExistence(updateScrollbarsPass ? Incremental : First
Pass)) | 467 if (!adjustScrollbarExistence(updateScrollbarsPass ? Incremental : First
Pass)) |
| 469 break; | 468 break; |
| 470 scrollbarExistenceChanged = true; | 469 scrollbarExistenceChanged = true; |
| 471 } | 470 } |
| (...skipping 646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1118 return; | 1117 return; |
| 1119 | 1118 |
| 1120 ScrollableArea::setScrollOrigin(origin); | 1119 ScrollableArea::setScrollOrigin(origin); |
| 1121 | 1120 |
| 1122 // Update if the scroll origin changes, since our position will be different
if the content size did not change. | 1121 // Update if the scroll origin changes, since our position will be different
if the content size did not change. |
| 1123 if (updatePositionAtAll && updatePositionSynchronously) | 1122 if (updatePositionAtAll && updatePositionSynchronously) |
| 1124 updateScrollbars(scrollOffset()); | 1123 updateScrollbars(scrollOffset()); |
| 1125 } | 1124 } |
| 1126 | 1125 |
| 1127 } // namespace WebCore | 1126 } // namespace WebCore |
| OLD | NEW |