| 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 14 matching lines...) Expand all Loading... |
| 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 | 34 |
| 35 using namespace std; | |
| 36 | |
| 37 namespace blink { | 35 namespace blink { |
| 38 | 36 |
| 39 ScrollView::ScrollView() | 37 ScrollView::ScrollView() |
| 40 : m_horizontalScrollbarMode(ScrollbarAuto) | 38 : m_horizontalScrollbarMode(ScrollbarAuto) |
| 41 , m_verticalScrollbarMode(ScrollbarAuto) | 39 , m_verticalScrollbarMode(ScrollbarAuto) |
| 42 , m_horizontalScrollbarLock(false) | 40 , m_horizontalScrollbarLock(false) |
| 43 , m_verticalScrollbarLock(false) | 41 , m_verticalScrollbarLock(false) |
| 44 , m_scrollbarsAvoidingResizer(0) | 42 , m_scrollbarsAvoidingResizer(0) |
| 45 , m_scrollbarsSuppressed(false) | 43 , m_scrollbarsSuppressed(false) |
| 46 , m_inUpdateScrollbars(false) | 44 , m_inUpdateScrollbars(false) |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 IntSize ScrollView::excludeScrollbars(const IntSize& size) const | 178 IntSize ScrollView::excludeScrollbars(const IntSize& size) const |
| 181 { | 179 { |
| 182 int verticalScrollbarWidth = 0; | 180 int verticalScrollbarWidth = 0; |
| 183 int horizontalScrollbarHeight = 0; | 181 int horizontalScrollbarHeight = 0; |
| 184 | 182 |
| 185 if (Scrollbar* verticalBar = verticalScrollbar()) | 183 if (Scrollbar* verticalBar = verticalScrollbar()) |
| 186 verticalScrollbarWidth = !verticalBar->isOverlayScrollbar() ? verticalBa
r->width() : 0; | 184 verticalScrollbarWidth = !verticalBar->isOverlayScrollbar() ? verticalBa
r->width() : 0; |
| 187 if (Scrollbar* horizontalBar = horizontalScrollbar()) | 185 if (Scrollbar* horizontalBar = horizontalScrollbar()) |
| 188 horizontalScrollbarHeight = !horizontalBar->isOverlayScrollbar() ? horiz
ontalBar->height() : 0; | 186 horizontalScrollbarHeight = !horizontalBar->isOverlayScrollbar() ? horiz
ontalBar->height() : 0; |
| 189 | 187 |
| 190 return IntSize(max(0, size.width() - verticalScrollbarWidth), | 188 return IntSize(std::max(0, size.width() - verticalScrollbarWidth), |
| 191 max(0, size.height() - horizontalScrollbarHeight)); | 189 std::max(0, size.height() - horizontalScrollbarHeight)); |
| 192 | 190 |
| 193 } | 191 } |
| 194 | 192 |
| 195 IntRect ScrollView::visibleContentRect(IncludeScrollbarsInRect scollbarInclusion
) const | 193 IntRect ScrollView::visibleContentRect(IncludeScrollbarsInRect scollbarInclusion
) const |
| 196 { | 194 { |
| 197 FloatSize visibleContentSize = unscaledVisibleContentSize(scollbarInclusion)
; | 195 FloatSize visibleContentSize = unscaledVisibleContentSize(scollbarInclusion)
; |
| 198 visibleContentSize.scale(1 / visibleContentScaleFactor()); | 196 visibleContentSize.scale(1 / visibleContentScaleFactor()); |
| 199 return IntRect(IntPoint(m_scrollOffset), expandedIntSize(visibleContentSize)
); | 197 return IntRect(IntPoint(m_scrollOffset), expandedIntSize(visibleContentSize)
); |
| 200 } | 198 } |
| 201 | 199 |
| (...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 536 if (!window) | 534 if (!window) |
| 537 return; | 535 return; |
| 538 | 536 |
| 539 IntRect clipRect = windowClipRect(); | 537 IntRect clipRect = windowClipRect(); |
| 540 IntRect updateRect = clipRect; | 538 IntRect updateRect = clipRect; |
| 541 updateRect.intersect(rectToCopyOnScroll()); | 539 updateRect.intersect(rectToCopyOnScroll()); |
| 542 | 540 |
| 543 if (m_drawPanScrollIcon) { | 541 if (m_drawPanScrollIcon) { |
| 544 // FIXME: the pan icon is broken when accelerated compositing is on, sin
ce it will draw under the compositing layers. | 542 // FIXME: the pan icon is broken when accelerated compositing is on, sin
ce it will draw under the compositing layers. |
| 545 // https://bugs.webkit.org/show_bug.cgi?id=47837 | 543 // https://bugs.webkit.org/show_bug.cgi?id=47837 |
| 546 int panIconDirtySquareSizeLength = 2 * (panIconSizeLength + max(abs(scro
llDelta.width()), abs(scrollDelta.height()))); // We only want to repaint what's
necessary | 544 int panIconDirtySquareSizeLength = 2 * (panIconSizeLength + std::max(abs
(scrollDelta.width()), abs(scrollDelta.height()))); // We only want to repaint w
hat's necessary |
| 547 IntPoint panIconDirtySquareLocation = IntPoint(m_panScrollIconPoint.x()
- (panIconDirtySquareSizeLength / 2), m_panScrollIconPoint.y() - (panIconDirtySq
uareSizeLength / 2)); | 545 IntPoint panIconDirtySquareLocation = IntPoint(m_panScrollIconPoint.x()
- (panIconDirtySquareSizeLength / 2), m_panScrollIconPoint.y() - (panIconDirtySq
uareSizeLength / 2)); |
| 548 IntRect panScrollIconDirtyRect = IntRect(panIconDirtySquareLocation, Int
Size(panIconDirtySquareSizeLength, panIconDirtySquareSizeLength)); | 546 IntRect panScrollIconDirtyRect = IntRect(panIconDirtySquareLocation, Int
Size(panIconDirtySquareSizeLength, panIconDirtySquareSizeLength)); |
| 549 panScrollIconDirtyRect.intersect(clipRect); | 547 panScrollIconDirtyRect.intersect(clipRect); |
| 550 window->invalidateContentsAndRootView(panScrollIconDirtyRect); | 548 window->invalidateContentsAndRootView(panScrollIconDirtyRect); |
| 551 } | 549 } |
| 552 | 550 |
| 553 if (!scrollContentsFastPath(-scrollDelta)) | 551 if (!scrollContentsFastPath(-scrollDelta)) |
| 554 scrollContentsSlowPath(updateRect); | 552 scrollContentsSlowPath(updateRect); |
| 555 | 553 |
| 556 // Invalidate the overhang areas if they are visible. | 554 // Invalidate the overhang areas if they are visible. |
| (...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1114 return; | 1112 return; |
| 1115 | 1113 |
| 1116 ScrollableArea::setScrollOrigin(origin); | 1114 ScrollableArea::setScrollOrigin(origin); |
| 1117 | 1115 |
| 1118 // Update if the scroll origin changes, since our position will be different
if the content size did not change. | 1116 // Update if the scroll origin changes, since our position will be different
if the content size did not change. |
| 1119 if (updatePositionAtAll && updatePositionSynchronously) | 1117 if (updatePositionAtAll && updatePositionSynchronously) |
| 1120 updateScrollbars(scrollOffset()); | 1118 updateScrollbars(scrollOffset()); |
| 1121 } | 1119 } |
| 1122 | 1120 |
| 1123 } // namespace blink | 1121 } // namespace blink |
| OLD | NEW |