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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 , m_prohibitsScrolling(false) | 49 , m_prohibitsScrolling(false) |
50 , m_canBlitOnScroll(true) | 50 , m_canBlitOnScroll(true) |
51 , m_scrollbarsAvoidingResizer(0) | 51 , m_scrollbarsAvoidingResizer(0) |
52 , m_scrollbarsSuppressed(false) | 52 , m_scrollbarsSuppressed(false) |
53 , m_inUpdateScrollbars(false) | 53 , m_inUpdateScrollbars(false) |
54 , m_updateScrollbarsPass(0) | 54 , m_updateScrollbarsPass(0) |
55 , m_drawPanScrollIcon(false) | 55 , m_drawPanScrollIcon(false) |
56 , m_useFixedLayout(false) | 56 , m_useFixedLayout(false) |
57 , m_paintsEntireContents(false) | 57 , m_paintsEntireContents(false) |
58 , m_clipsRepaints(true) | 58 , m_clipsRepaints(true) |
59 , m_delegatesScrolling(false) | |
60 { | 59 { |
61 platformInit(); | 60 platformInit(); |
62 } | 61 } |
63 | 62 |
64 ScrollView::~ScrollView() | 63 ScrollView::~ScrollView() |
65 { | 64 { |
66 platformDestroy(); | 65 platformDestroy(); |
67 } | 66 } |
68 | 67 |
69 void ScrollView::addChild(PassRefPtr<Widget> prpChild) | 68 void ScrollView::addChild(PassRefPtr<Widget> prpChild) |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 void ScrollView::setPaintsEntireContents(bool paintsEntireContents) | 187 void ScrollView::setPaintsEntireContents(bool paintsEntireContents) |
189 { | 188 { |
190 m_paintsEntireContents = paintsEntireContents; | 189 m_paintsEntireContents = paintsEntireContents; |
191 } | 190 } |
192 | 191 |
193 void ScrollView::setClipsRepaints(bool clipsRepaints) | 192 void ScrollView::setClipsRepaints(bool clipsRepaints) |
194 { | 193 { |
195 m_clipsRepaints = clipsRepaints; | 194 m_clipsRepaints = clipsRepaints; |
196 } | 195 } |
197 | 196 |
198 void ScrollView::setDelegatesScrolling(bool delegatesScrolling) | |
199 { | |
200 if (m_delegatesScrolling == delegatesScrolling) | |
201 return; | |
202 | |
203 m_delegatesScrolling = delegatesScrolling; | |
204 delegatesScrollingDidChange(); | |
205 } | |
206 | |
207 IntSize ScrollView::unscaledVisibleContentSize(VisibleContentRectIncludesScrollb
ars scrollbarInclusion) const | 197 IntSize ScrollView::unscaledVisibleContentSize(VisibleContentRectIncludesScrollb
ars scrollbarInclusion) const |
208 { | 198 { |
209 if (!m_fixedVisibleContentRect.isEmpty()) | 199 if (!m_fixedVisibleContentRect.isEmpty()) |
210 return m_fixedVisibleContentRect.size(); | 200 return m_fixedVisibleContentRect.size(); |
211 | 201 |
212 int verticalScrollbarWidth = 0; | 202 int verticalScrollbarWidth = 0; |
213 int horizontalScrollbarHeight = 0; | 203 int horizontalScrollbarHeight = 0; |
214 | 204 |
215 if (scrollbarInclusion == ExcludeScrollbars) { | 205 if (scrollbarInclusion == ExcludeScrollbars) { |
216 if (Scrollbar* verticalBar = verticalScrollbar()) | 206 if (Scrollbar* verticalBar = verticalScrollbar()) |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 void ScrollView::scrollTo(const IntSize& newOffset) | 329 void ScrollView::scrollTo(const IntSize& newOffset) |
340 { | 330 { |
341 IntSize scrollDelta = newOffset - m_scrollOffset; | 331 IntSize scrollDelta = newOffset - m_scrollOffset; |
342 if (scrollDelta == IntSize()) | 332 if (scrollDelta == IntSize()) |
343 return; | 333 return; |
344 m_scrollOffset = newOffset; | 334 m_scrollOffset = newOffset; |
345 | 335 |
346 if (scrollbarsSuppressed()) | 336 if (scrollbarsSuppressed()) |
347 return; | 337 return; |
348 | 338 |
349 #if USE(TILED_BACKING_STORE) | |
350 if (delegatesScrolling()) { | |
351 hostWindow()->delegatedScrollRequested(IntPoint(newOffset)); | |
352 return; | |
353 } | |
354 #endif | |
355 repaintFixedElementsAfterScrolling(); | 339 repaintFixedElementsAfterScrolling(); |
356 scrollContents(scrollDelta); | 340 scrollContents(scrollDelta); |
357 updateFixedElementsAfterScrolling(); | 341 updateFixedElementsAfterScrolling(); |
358 } | 342 } |
359 | 343 |
360 int ScrollView::scrollPosition(Scrollbar* scrollbar) const | 344 int ScrollView::scrollPosition(Scrollbar* scrollbar) const |
361 { | 345 { |
362 if (scrollbar->orientation() == HorizontalScrollbar) | 346 if (scrollbar->orientation() == HorizontalScrollbar) |
363 return scrollPosition().x() + scrollOrigin().x(); | 347 return scrollPosition().x() + scrollOrigin().x(); |
364 if (scrollbar->orientation() == VerticalScrollbar) | 348 if (scrollbar->orientation() == VerticalScrollbar) |
365 return scrollPosition().y() + scrollOrigin().y(); | 349 return scrollPosition().y() + scrollOrigin().y(); |
366 return 0; | 350 return 0; |
367 } | 351 } |
368 | 352 |
369 void ScrollView::setScrollPosition(const IntPoint& scrollPoint) | 353 void ScrollView::setScrollPosition(const IntPoint& scrollPoint) |
370 { | 354 { |
371 if (prohibitsScrolling()) | 355 if (prohibitsScrolling()) |
372 return; | 356 return; |
373 | 357 |
374 #if USE(TILED_BACKING_STORE) | |
375 if (delegatesScrolling()) { | |
376 hostWindow()->delegatedScrollRequested(scrollPoint); | |
377 return; | |
378 } | |
379 #endif | |
380 | |
381 IntPoint newScrollPosition = adjustScrollPositionWithinRange(scrollPoint); | 358 IntPoint newScrollPosition = adjustScrollPositionWithinRange(scrollPoint); |
382 | 359 |
383 if (newScrollPosition == scrollPosition()) | 360 if (newScrollPosition == scrollPosition()) |
384 return; | 361 return; |
385 | 362 |
386 updateScrollbars(IntSize(newScrollPosition.x(), newScrollPosition.y())); | 363 updateScrollbars(IntSize(newScrollPosition.x(), newScrollPosition.y())); |
387 } | 364 } |
388 | 365 |
389 bool ScrollView::logicalScroll(ScrollLogicalDirection direction, ScrollGranulari
ty granularity) | 366 bool ScrollView::logicalScroll(ScrollLogicalDirection direction, ScrollGranulari
ty granularity) |
390 { | 367 { |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
677 | 654 |
678 IntRect ScrollView::contentsToRootView(const IntRect& contentsRect) const | 655 IntRect ScrollView::contentsToRootView(const IntRect& contentsRect) const |
679 { | 656 { |
680 IntRect viewRect = contentsRect; | 657 IntRect viewRect = contentsRect; |
681 viewRect.move(-scrollOffset()); | 658 viewRect.move(-scrollOffset()); |
682 return convertToRootView(viewRect); | 659 return convertToRootView(viewRect); |
683 } | 660 } |
684 | 661 |
685 IntPoint ScrollView::windowToContents(const IntPoint& windowPoint) const | 662 IntPoint ScrollView::windowToContents(const IntPoint& windowPoint) const |
686 { | 663 { |
687 if (delegatesScrolling()) | |
688 return convertFromContainingWindow(windowPoint); | |
689 | |
690 IntPoint viewPoint = convertFromContainingWindow(windowPoint); | 664 IntPoint viewPoint = convertFromContainingWindow(windowPoint); |
691 IntSize offsetInDocument = scrollOffset() - IntSize(0, headerHeight()); | 665 IntSize offsetInDocument = scrollOffset() - IntSize(0, headerHeight()); |
692 return viewPoint + offsetInDocument; | 666 return viewPoint + offsetInDocument; |
693 } | 667 } |
694 | 668 |
695 IntPoint ScrollView::contentsToWindow(const IntPoint& contentsPoint) const | 669 IntPoint ScrollView::contentsToWindow(const IntPoint& contentsPoint) const |
696 { | 670 { |
697 if (delegatesScrolling()) | |
698 return convertToContainingWindow(contentsPoint); | |
699 | |
700 IntSize offsetInDocument = scrollOffset() + IntSize(0, headerHeight()); | 671 IntSize offsetInDocument = scrollOffset() + IntSize(0, headerHeight()); |
701 IntPoint viewPoint = contentsPoint - offsetInDocument; | 672 IntPoint viewPoint = contentsPoint - offsetInDocument; |
702 return convertToContainingWindow(viewPoint); | 673 return convertToContainingWindow(viewPoint); |
703 } | 674 } |
704 | 675 |
705 IntRect ScrollView::windowToContents(const IntRect& windowRect) const | 676 IntRect ScrollView::windowToContents(const IntRect& windowRect) const |
706 { | 677 { |
707 if (delegatesScrolling()) | |
708 return convertFromContainingWindow(windowRect); | |
709 | |
710 IntRect viewRect = convertFromContainingWindow(windowRect); | 678 IntRect viewRect = convertFromContainingWindow(windowRect); |
711 IntSize offsetInDocument = scrollOffset() - IntSize(0, headerHeight()); | 679 IntSize offsetInDocument = scrollOffset() - IntSize(0, headerHeight()); |
712 viewRect.move(offsetInDocument); | 680 viewRect.move(offsetInDocument); |
713 return viewRect; | 681 return viewRect; |
714 } | 682 } |
715 | 683 |
716 IntRect ScrollView::contentsToWindow(const IntRect& contentsRect) const | 684 IntRect ScrollView::contentsToWindow(const IntRect& contentsRect) const |
717 { | 685 { |
718 if (delegatesScrolling()) | |
719 return convertToContainingWindow(contentsRect); | |
720 | |
721 IntRect viewRect = contentsRect; | 686 IntRect viewRect = contentsRect; |
722 viewRect.move(-scrollOffset() + IntSize(0, headerHeight())); | 687 viewRect.move(-scrollOffset() + IntSize(0, headerHeight())); |
723 return convertToContainingWindow(viewRect); | 688 return convertToContainingWindow(viewRect); |
724 } | 689 } |
725 | 690 |
726 IntRect ScrollView::contentsToScreen(const IntRect& rect) const | 691 IntRect ScrollView::contentsToScreen(const IntRect& rect) const |
727 { | 692 { |
728 if (!hostWindow()) | 693 if (!hostWindow()) |
729 return IntRect(); | 694 return IntRect(); |
730 return hostWindow()->rootViewToScreen(contentsToRootView(rect)); | 695 return hostWindow()->rootViewToScreen(contentsToRootView(rect)); |
(...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1316 } | 1281 } |
1317 | 1282 |
1318 bool ScrollView::platformIsOffscreen() const | 1283 bool ScrollView::platformIsOffscreen() const |
1319 { | 1284 { |
1320 return false; | 1285 return false; |
1321 } | 1286 } |
1322 | 1287 |
1323 #endif | 1288 #endif |
1324 | 1289 |
1325 } | 1290 } |
OLD | NEW |