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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 { | 65 { |
66 platformDestroy(); | 66 platformDestroy(); |
67 } | 67 } |
68 | 68 |
69 void ScrollView::addChild(PassRefPtr<Widget> prpChild) | 69 void ScrollView::addChild(PassRefPtr<Widget> prpChild) |
70 { | 70 { |
71 Widget* child = prpChild.get(); | 71 Widget* child = prpChild.get(); |
72 ASSERT(child != this && !child->parent()); | 72 ASSERT(child != this && !child->parent()); |
73 child->setParent(this); | 73 child->setParent(this); |
74 m_children.add(prpChild); | 74 m_children.add(prpChild); |
75 if (child->platformWidget()) | |
76 platformAddChild(child); | |
77 } | 75 } |
78 | 76 |
79 void ScrollView::removeChild(Widget* child) | 77 void ScrollView::removeChild(Widget* child) |
80 { | 78 { |
81 ASSERT(child->parent() == this); | 79 ASSERT(child->parent() == this); |
82 child->setParent(0); | 80 child->setParent(0); |
83 m_children.remove(child); | 81 m_children.remove(child); |
84 if (child->platformWidget()) | |
85 platformRemoveChild(child); | |
86 } | 82 } |
87 | 83 |
88 void ScrollView::setHasHorizontalScrollbar(bool hasBar) | 84 void ScrollView::setHasHorizontalScrollbar(bool hasBar) |
89 { | 85 { |
90 ASSERT(!hasBar || !avoidScrollbarCreation()); | 86 ASSERT(!hasBar || !avoidScrollbarCreation()); |
91 if (hasBar && !m_horizontalScrollbar) { | 87 if (hasBar && !m_horizontalScrollbar) { |
92 m_horizontalScrollbar = createScrollbar(HorizontalScrollbar); | 88 m_horizontalScrollbar = createScrollbar(HorizontalScrollbar); |
93 addChild(m_horizontalScrollbar.get()); | 89 addChild(m_horizontalScrollbar.get()); |
94 didAddHorizontalScrollbar(m_horizontalScrollbar.get()); | 90 didAddHorizontalScrollbar(m_horizontalScrollbar.get()); |
95 m_horizontalScrollbar->styleChanged(); | 91 m_horizontalScrollbar->styleChanged(); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 | 140 |
145 if (horizontalLock) | 141 if (horizontalLock) |
146 setHorizontalScrollbarLock(); | 142 setHorizontalScrollbarLock(); |
147 | 143 |
148 if (verticalLock) | 144 if (verticalLock) |
149 setVerticalScrollbarLock(); | 145 setVerticalScrollbarLock(); |
150 | 146 |
151 if (!needsUpdate) | 147 if (!needsUpdate) |
152 return; | 148 return; |
153 | 149 |
154 if (platformWidget()) | 150 updateScrollbars(scrollOffset()); |
155 platformSetScrollbarModes(); | |
156 else | |
157 updateScrollbars(scrollOffset()); | |
158 } | 151 } |
159 #endif | 152 #endif |
160 | 153 |
161 void ScrollView::scrollbarModes(ScrollbarMode& horizontalMode, ScrollbarMode& ve
rticalMode) const | 154 void ScrollView::scrollbarModes(ScrollbarMode& horizontalMode, ScrollbarMode& ve
rticalMode) const |
162 { | 155 { |
163 if (platformWidget()) { | |
164 platformScrollbarModes(horizontalMode, verticalMode); | |
165 return; | |
166 } | |
167 horizontalMode = m_horizontalScrollbarMode; | 156 horizontalMode = m_horizontalScrollbarMode; |
168 verticalMode = m_verticalScrollbarMode; | 157 verticalMode = m_verticalScrollbarMode; |
169 } | 158 } |
170 | 159 |
171 void ScrollView::setCanHaveScrollbars(bool canScroll) | 160 void ScrollView::setCanHaveScrollbars(bool canScroll) |
172 { | 161 { |
173 ScrollbarMode newHorizontalMode; | 162 ScrollbarMode newHorizontalMode; |
174 ScrollbarMode newVerticalMode; | 163 ScrollbarMode newVerticalMode; |
175 | 164 |
176 scrollbarModes(newHorizontalMode, newVerticalMode); | 165 scrollbarModes(newHorizontalMode, newVerticalMode); |
177 | 166 |
178 if (canScroll && newVerticalMode == ScrollbarAlwaysOff) | 167 if (canScroll && newVerticalMode == ScrollbarAlwaysOff) |
179 newVerticalMode = ScrollbarAuto; | 168 newVerticalMode = ScrollbarAuto; |
180 else if (!canScroll) | 169 else if (!canScroll) |
181 newVerticalMode = ScrollbarAlwaysOff; | 170 newVerticalMode = ScrollbarAlwaysOff; |
182 | 171 |
183 if (canScroll && newHorizontalMode == ScrollbarAlwaysOff) | 172 if (canScroll && newHorizontalMode == ScrollbarAlwaysOff) |
184 newHorizontalMode = ScrollbarAuto; | 173 newHorizontalMode = ScrollbarAuto; |
185 else if (!canScroll) | 174 else if (!canScroll) |
186 newHorizontalMode = ScrollbarAlwaysOff; | 175 newHorizontalMode = ScrollbarAlwaysOff; |
187 | 176 |
188 setScrollbarModes(newHorizontalMode, newVerticalMode); | 177 setScrollbarModes(newHorizontalMode, newVerticalMode); |
189 } | 178 } |
190 | 179 |
191 void ScrollView::setCanBlitOnScroll(bool b) | 180 void ScrollView::setCanBlitOnScroll(bool b) |
192 { | 181 { |
193 if (platformWidget()) { | |
194 platformSetCanBlitOnScroll(b); | |
195 return; | |
196 } | |
197 | |
198 m_canBlitOnScroll = b; | 182 m_canBlitOnScroll = b; |
199 } | 183 } |
200 | 184 |
201 bool ScrollView::canBlitOnScroll() const | 185 bool ScrollView::canBlitOnScroll() const |
202 { | 186 { |
203 if (platformWidget()) | |
204 return platformCanBlitOnScroll(); | |
205 | |
206 return m_canBlitOnScroll; | 187 return m_canBlitOnScroll; |
207 } | 188 } |
208 | 189 |
209 void ScrollView::setPaintsEntireContents(bool paintsEntireContents) | 190 void ScrollView::setPaintsEntireContents(bool paintsEntireContents) |
210 { | 191 { |
211 m_paintsEntireContents = paintsEntireContents; | 192 m_paintsEntireContents = paintsEntireContents; |
212 } | 193 } |
213 | 194 |
214 void ScrollView::setClipsRepaints(bool clipsRepaints) | 195 void ScrollView::setClipsRepaints(bool clipsRepaints) |
215 { | 196 { |
216 m_clipsRepaints = clipsRepaints; | 197 m_clipsRepaints = clipsRepaints; |
217 } | 198 } |
218 | 199 |
219 void ScrollView::setDelegatesScrolling(bool delegatesScrolling) | 200 void ScrollView::setDelegatesScrolling(bool delegatesScrolling) |
220 { | 201 { |
221 if (m_delegatesScrolling == delegatesScrolling) | 202 if (m_delegatesScrolling == delegatesScrolling) |
222 return; | 203 return; |
223 | 204 |
224 m_delegatesScrolling = delegatesScrolling; | 205 m_delegatesScrolling = delegatesScrolling; |
225 delegatesScrollingDidChange(); | 206 delegatesScrollingDidChange(); |
226 } | 207 } |
227 | 208 |
228 IntSize ScrollView::unscaledVisibleContentSize(VisibleContentRectIncludesScrollb
ars scrollbarInclusion) const | 209 IntSize ScrollView::unscaledVisibleContentSize(VisibleContentRectIncludesScrollb
ars scrollbarInclusion) const |
229 { | 210 { |
230 if (platformWidget()) | |
231 return platformVisibleContentRect(scrollbarInclusion == IncludeScrollbar
s).size(); | |
232 | |
233 if (!m_fixedVisibleContentRect.isEmpty()) | 211 if (!m_fixedVisibleContentRect.isEmpty()) |
234 return m_fixedVisibleContentRect.size(); | 212 return m_fixedVisibleContentRect.size(); |
235 | 213 |
236 int verticalScrollbarWidth = 0; | 214 int verticalScrollbarWidth = 0; |
237 int horizontalScrollbarHeight = 0; | 215 int horizontalScrollbarHeight = 0; |
238 | 216 |
239 if (scrollbarInclusion == ExcludeScrollbars) { | 217 if (scrollbarInclusion == ExcludeScrollbars) { |
240 if (Scrollbar* verticalBar = verticalScrollbar()) | 218 if (Scrollbar* verticalBar = verticalScrollbar()) |
241 verticalScrollbarWidth = !verticalBar->isOverlayScrollbar() ? vertic
alBar->width() : 0; | 219 verticalScrollbarWidth = !verticalBar->isOverlayScrollbar() ? vertic
alBar->width() : 0; |
242 if (Scrollbar* horizontalBar = horizontalScrollbar()) | 220 if (Scrollbar* horizontalBar = horizontalScrollbar()) |
243 horizontalScrollbarHeight = !horizontalBar->isOverlayScrollbar() ? h
orizontalBar->height() : 0; | 221 horizontalScrollbarHeight = !horizontalBar->isOverlayScrollbar() ? h
orizontalBar->height() : 0; |
244 } | 222 } |
245 | 223 |
246 return IntSize(max(0, width() - verticalScrollbarWidth), | 224 return IntSize(max(0, width() - verticalScrollbarWidth), |
247 max(0, height() - horizontalScrollbarHeight)); | 225 max(0, height() - horizontalScrollbarHeight)); |
248 } | 226 } |
249 | 227 |
250 #if !PLATFORM(GTK) | 228 #if !PLATFORM(GTK) |
251 IntRect ScrollView::visibleContentRect(VisibleContentRectIncludesScrollbars scol
lbarInclusion) const | 229 IntRect ScrollView::visibleContentRect(VisibleContentRectIncludesScrollbars scol
lbarInclusion) const |
252 { | 230 { |
253 if (platformWidget()) | |
254 return platformVisibleContentRect(scollbarInclusion == IncludeScrollbars
); | |
255 | |
256 if (!m_fixedVisibleContentRect.isEmpty()) | 231 if (!m_fixedVisibleContentRect.isEmpty()) |
257 return m_fixedVisibleContentRect; | 232 return m_fixedVisibleContentRect; |
258 | 233 |
259 FloatSize visibleContentSize = unscaledVisibleContentSize(scollbarInclusion)
; | 234 FloatSize visibleContentSize = unscaledVisibleContentSize(scollbarInclusion)
; |
260 visibleContentSize.scale(1 / visibleContentScaleFactor()); | 235 visibleContentSize.scale(1 / visibleContentScaleFactor()); |
261 return IntRect(IntPoint(m_scrollOffset), expandedIntSize(visibleContentSize)
); | 236 return IntRect(IntPoint(m_scrollOffset), expandedIntSize(visibleContentSize)
); |
262 } | 237 } |
263 #endif | 238 #endif |
264 | 239 |
265 IntSize ScrollView::layoutSize() const | 240 IntSize ScrollView::layoutSize() const |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 IntSize ScrollView::contentsSize() const | 274 IntSize ScrollView::contentsSize() const |
300 { | 275 { |
301 return m_contentsSize; | 276 return m_contentsSize; |
302 } | 277 } |
303 | 278 |
304 void ScrollView::setContentsSize(const IntSize& newSize) | 279 void ScrollView::setContentsSize(const IntSize& newSize) |
305 { | 280 { |
306 if (contentsSize() == newSize) | 281 if (contentsSize() == newSize) |
307 return; | 282 return; |
308 m_contentsSize = newSize; | 283 m_contentsSize = newSize; |
309 if (platformWidget()) | 284 updateScrollbars(scrollOffset()); |
310 platformSetContentsSize(); | |
311 else | |
312 updateScrollbars(scrollOffset()); | |
313 updateOverhangAreas(); | 285 updateOverhangAreas(); |
314 } | 286 } |
315 | 287 |
316 IntPoint ScrollView::maximumScrollPosition() const | 288 IntPoint ScrollView::maximumScrollPosition() const |
317 { | 289 { |
318 IntPoint maximumOffset(contentsWidth() - visibleWidth() - scrollOrigin().x()
, totalContentsSize().height() - visibleHeight() - scrollOrigin().y()); | 290 IntPoint maximumOffset(contentsWidth() - visibleWidth() - scrollOrigin().x()
, totalContentsSize().height() - visibleHeight() - scrollOrigin().y()); |
319 maximumOffset.clampNegativeToZero(); | 291 maximumOffset.clampNegativeToZero(); |
320 return maximumOffset; | 292 return maximumOffset; |
321 } | 293 } |
322 | 294 |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
396 if (scrollbar->orientation() == VerticalScrollbar) | 368 if (scrollbar->orientation() == VerticalScrollbar) |
397 return scrollPosition().y() + scrollOrigin().y(); | 369 return scrollPosition().y() + scrollOrigin().y(); |
398 return 0; | 370 return 0; |
399 } | 371 } |
400 | 372 |
401 void ScrollView::setScrollPosition(const IntPoint& scrollPoint) | 373 void ScrollView::setScrollPosition(const IntPoint& scrollPoint) |
402 { | 374 { |
403 if (prohibitsScrolling()) | 375 if (prohibitsScrolling()) |
404 return; | 376 return; |
405 | 377 |
406 if (platformWidget()) { | |
407 platformSetScrollPosition(scrollPoint); | |
408 return; | |
409 } | |
410 | |
411 #if USE(TILED_BACKING_STORE) | 378 #if USE(TILED_BACKING_STORE) |
412 if (delegatesScrolling()) { | 379 if (delegatesScrolling()) { |
413 hostWindow()->delegatedScrollRequested(scrollPoint); | 380 hostWindow()->delegatedScrollRequested(scrollPoint); |
414 return; | 381 return; |
415 } | 382 } |
416 #endif | 383 #endif |
417 | 384 |
418 IntPoint newScrollPosition = adjustScrollPositionWithinRange(scrollPoint); | 385 IntPoint newScrollPosition = adjustScrollPositionWithinRange(scrollPoint); |
419 | 386 |
420 if (newScrollPosition == scrollPosition()) | 387 if (newScrollPosition == scrollPosition()) |
421 return; | 388 return; |
422 | 389 |
423 updateScrollbars(IntSize(newScrollPosition.x(), newScrollPosition.y())); | 390 updateScrollbars(IntSize(newScrollPosition.x(), newScrollPosition.y())); |
424 } | 391 } |
425 | 392 |
426 bool ScrollView::scroll(ScrollDirection direction, ScrollGranularity granularity
) | |
427 { | |
428 if (platformWidget()) | |
429 return platformScroll(direction, granularity); | |
430 | |
431 return ScrollableArea::scroll(direction, granularity); | |
432 } | |
433 | |
434 bool ScrollView::logicalScroll(ScrollLogicalDirection direction, ScrollGranulari
ty granularity) | 393 bool ScrollView::logicalScroll(ScrollLogicalDirection direction, ScrollGranulari
ty granularity) |
435 { | 394 { |
436 return scroll(logicalToPhysical(direction, isVerticalDocument(), isFlippedDo
cument()), granularity); | 395 return scroll(logicalToPhysical(direction, isVerticalDocument(), isFlippedDo
cument()), granularity); |
437 } | 396 } |
438 | 397 |
439 IntSize ScrollView::overhangAmount() const | 398 IntSize ScrollView::overhangAmount() const |
440 { | 399 { |
441 IntSize stretch; | 400 IntSize stretch; |
442 | 401 |
443 int physicalScrollY = scrollPosition().y() + scrollOrigin().y(); | 402 int physicalScrollY = scrollPosition().y() + scrollOrigin().y(); |
444 if (physicalScrollY < 0) | 403 if (physicalScrollY < 0) |
445 stretch.setHeight(physicalScrollY); | 404 stretch.setHeight(physicalScrollY); |
446 else if (totalContentsSize().height() && physicalScrollY > totalContentsSize
().height() - visibleHeight()) | 405 else if (totalContentsSize().height() && physicalScrollY > totalContentsSize
().height() - visibleHeight()) |
447 stretch.setHeight(physicalScrollY - (totalContentsSize().height() - visi
bleHeight())); | 406 stretch.setHeight(physicalScrollY - (totalContentsSize().height() - visi
bleHeight())); |
448 | 407 |
449 int physicalScrollX = scrollPosition().x() + scrollOrigin().x(); | 408 int physicalScrollX = scrollPosition().x() + scrollOrigin().x(); |
450 if (physicalScrollX < 0) | 409 if (physicalScrollX < 0) |
451 stretch.setWidth(physicalScrollX); | 410 stretch.setWidth(physicalScrollX); |
452 else if (contentsWidth() && physicalScrollX > contentsWidth() - visibleWidth
()) | 411 else if (contentsWidth() && physicalScrollX > contentsWidth() - visibleWidth
()) |
453 stretch.setWidth(physicalScrollX - (contentsWidth() - visibleWidth())); | 412 stretch.setWidth(physicalScrollX - (contentsWidth() - visibleWidth())); |
454 | 413 |
455 return stretch; | 414 return stretch; |
456 } | 415 } |
457 | 416 |
458 void ScrollView::windowResizerRectChanged() | 417 void ScrollView::windowResizerRectChanged() |
459 { | 418 { |
460 if (platformWidget()) | |
461 return; | |
462 | |
463 updateScrollbars(scrollOffset()); | 419 updateScrollbars(scrollOffset()); |
464 } | 420 } |
465 | 421 |
466 static const unsigned cMaxUpdateScrollbarsPass = 2; | 422 static const unsigned cMaxUpdateScrollbarsPass = 2; |
467 | 423 |
468 void ScrollView::updateScrollbars(const IntSize& desiredOffset) | 424 void ScrollView::updateScrollbars(const IntSize& desiredOffset) |
469 { | 425 { |
470 if (m_inUpdateScrollbars || prohibitsScrolling() || platformWidget()) | 426 if (m_inUpdateScrollbars || prohibitsScrolling()) |
471 return; | 427 return; |
472 | 428 |
473 // If we came in here with the view already needing a layout, then go ahead
and do that | 429 // If we came in here with the view already needing a layout, then go ahead
and do that |
474 // first. (This will be the common case, e.g., when the page changes due to
window resizing for example). | 430 // first. (This will be the common case, e.g., when the page changes due to
window resizing for example). |
475 // This layout will not re-enter updateScrollbars and does not count towards
our max layout pass total. | 431 // This layout will not re-enter updateScrollbars and does not count towards
our max layout pass total. |
476 if (!m_scrollbarsSuppressed) { | 432 if (!m_scrollbarsSuppressed) { |
477 m_inUpdateScrollbars = true; | 433 m_inUpdateScrollbars = true; |
478 visibleContentsResized(); | 434 visibleContentsResized(); |
479 m_inUpdateScrollbars = false; | 435 m_inUpdateScrollbars = false; |
480 } | 436 } |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
766 if (delegatesScrolling()) | 722 if (delegatesScrolling()) |
767 return convertToContainingWindow(contentsRect); | 723 return convertToContainingWindow(contentsRect); |
768 | 724 |
769 IntRect viewRect = contentsRect; | 725 IntRect viewRect = contentsRect; |
770 viewRect.move(-scrollOffset() + IntSize(0, headerHeight())); | 726 viewRect.move(-scrollOffset() + IntSize(0, headerHeight())); |
771 return convertToContainingWindow(viewRect); | 727 return convertToContainingWindow(viewRect); |
772 } | 728 } |
773 | 729 |
774 IntRect ScrollView::contentsToScreen(const IntRect& rect) const | 730 IntRect ScrollView::contentsToScreen(const IntRect& rect) const |
775 { | 731 { |
776 if (platformWidget()) | |
777 return platformContentsToScreen(rect); | |
778 if (!hostWindow()) | 732 if (!hostWindow()) |
779 return IntRect(); | 733 return IntRect(); |
780 return hostWindow()->rootViewToScreen(contentsToRootView(rect)); | 734 return hostWindow()->rootViewToScreen(contentsToRootView(rect)); |
781 } | 735 } |
782 | 736 |
783 IntPoint ScrollView::screenToContents(const IntPoint& point) const | 737 IntPoint ScrollView::screenToContents(const IntPoint& point) const |
784 { | 738 { |
785 if (platformWidget()) | |
786 return platformScreenToContents(point); | |
787 if (!hostWindow()) | 739 if (!hostWindow()) |
788 return IntPoint(); | 740 return IntPoint(); |
789 return rootViewToContents(hostWindow()->screenToRootView(point)); | 741 return rootViewToContents(hostWindow()->screenToRootView(point)); |
790 } | 742 } |
791 | 743 |
792 bool ScrollView::containsScrollbarsAvoidingResizer() const | 744 bool ScrollView::containsScrollbarsAvoidingResizer() const |
793 { | 745 { |
794 return !m_scrollbarsAvoidingResizer; | 746 return !m_scrollbarsAvoidingResizer; |
795 } | 747 } |
796 | 748 |
(...skipping 27 matching lines...) Expand all Loading... |
824 parent()->adjustScrollbarsAvoidingResizerCount(m_scrollbarsAvoidingResiz
er); | 776 parent()->adjustScrollbarsAvoidingResizerCount(m_scrollbarsAvoidingResiz
er); |
825 } | 777 } |
826 | 778 |
827 void ScrollView::setScrollbarsSuppressed(bool suppressed, bool repaintOnUnsuppre
ss) | 779 void ScrollView::setScrollbarsSuppressed(bool suppressed, bool repaintOnUnsuppre
ss) |
828 { | 780 { |
829 if (suppressed == m_scrollbarsSuppressed) | 781 if (suppressed == m_scrollbarsSuppressed) |
830 return; | 782 return; |
831 | 783 |
832 m_scrollbarsSuppressed = suppressed; | 784 m_scrollbarsSuppressed = suppressed; |
833 | 785 |
834 if (platformWidget()) | 786 if (repaintOnUnsuppress && !suppressed) { |
835 platformSetScrollbarsSuppressed(repaintOnUnsuppress); | |
836 else if (repaintOnUnsuppress && !suppressed) { | |
837 if (m_horizontalScrollbar) | 787 if (m_horizontalScrollbar) |
838 m_horizontalScrollbar->invalidate(); | 788 m_horizontalScrollbar->invalidate(); |
839 if (m_verticalScrollbar) | 789 if (m_verticalScrollbar) |
840 m_verticalScrollbar->invalidate(); | 790 m_verticalScrollbar->invalidate(); |
841 | 791 |
842 // Invalidate the scroll corner too on unsuppress. | 792 // Invalidate the scroll corner too on unsuppress. |
843 invalidateRect(scrollCornerRect()); | 793 invalidateRect(scrollCornerRect()); |
844 } | 794 } |
845 } | 795 } |
846 | 796 |
847 Scrollbar* ScrollView::scrollbarAtPoint(const IntPoint& windowPoint) | 797 Scrollbar* ScrollView::scrollbarAtPoint(const IntPoint& windowPoint) |
848 { | 798 { |
849 if (platformWidget()) | |
850 return 0; | |
851 | |
852 IntPoint viewPoint = convertFromContainingWindow(windowPoint); | 799 IntPoint viewPoint = convertFromContainingWindow(windowPoint); |
853 if (m_horizontalScrollbar && m_horizontalScrollbar->shouldParticipateInHitTe
sting() && m_horizontalScrollbar->frameRect().contains(viewPoint)) | 800 if (m_horizontalScrollbar && m_horizontalScrollbar->shouldParticipateInHitTe
sting() && m_horizontalScrollbar->frameRect().contains(viewPoint)) |
854 return m_horizontalScrollbar.get(); | 801 return m_horizontalScrollbar.get(); |
855 if (m_verticalScrollbar && m_verticalScrollbar->shouldParticipateInHitTestin
g() && m_verticalScrollbar->frameRect().contains(viewPoint)) | 802 if (m_verticalScrollbar && m_verticalScrollbar->shouldParticipateInHitTestin
g() && m_verticalScrollbar->frameRect().contains(viewPoint)) |
856 return m_verticalScrollbar.get(); | 803 return m_verticalScrollbar.get(); |
857 return 0; | 804 return 0; |
858 } | 805 } |
859 | 806 |
860 void ScrollView::setScrollbarOverlayStyle(ScrollbarOverlayStyle overlayStyle) | 807 void ScrollView::setScrollbarOverlayStyle(ScrollbarOverlayStyle overlayStyle) |
861 { | 808 { |
(...skipping 13 matching lines...) Expand all Loading... |
875 frameRectsChanged(); | 822 frameRectsChanged(); |
876 | 823 |
877 updateScrollbars(scrollOffset()); | 824 updateScrollbars(scrollOffset()); |
878 | 825 |
879 if (!m_useFixedLayout && oldRect.size() != newRect.size()) | 826 if (!m_useFixedLayout && oldRect.size() != newRect.size()) |
880 contentsResized(); | 827 contentsResized(); |
881 } | 828 } |
882 | 829 |
883 void ScrollView::frameRectsChanged() | 830 void ScrollView::frameRectsChanged() |
884 { | 831 { |
885 if (platformWidget()) | |
886 return; | |
887 | |
888 HashSet<RefPtr<Widget> >::const_iterator end = m_children.end(); | 832 HashSet<RefPtr<Widget> >::const_iterator end = m_children.end(); |
889 for (HashSet<RefPtr<Widget> >::const_iterator current = m_children.begin();
current != end; ++current) | 833 for (HashSet<RefPtr<Widget> >::const_iterator current = m_children.begin();
current != end; ++current) |
890 (*current)->frameRectsChanged(); | 834 (*current)->frameRectsChanged(); |
891 } | 835 } |
892 | 836 |
893 void ScrollView::clipRectChanged() | 837 void ScrollView::clipRectChanged() |
894 { | 838 { |
895 HashSet<RefPtr<Widget> >::const_iterator end = m_children.end(); | 839 HashSet<RefPtr<Widget> >::const_iterator end = m_children.end(); |
896 for (HashSet<RefPtr<Widget> >::const_iterator current = m_children.begin();
current != end; ++current) | 840 for (HashSet<RefPtr<Widget> >::const_iterator current = m_children.begin();
current != end; ++current) |
897 (*current)->clipRectChanged(); | 841 (*current)->clipRectChanged(); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
943 } | 887 } |
944 | 888 |
945 void ScrollView::repaintContentRectangle(const IntRect& rect) | 889 void ScrollView::repaintContentRectangle(const IntRect& rect) |
946 { | 890 { |
947 IntRect paintRect = rect; | 891 IntRect paintRect = rect; |
948 if (clipsRepaints() && !paintsEntireContents()) | 892 if (clipsRepaints() && !paintsEntireContents()) |
949 paintRect.intersect(visibleContentRect()); | 893 paintRect.intersect(visibleContentRect()); |
950 if (paintRect.isEmpty()) | 894 if (paintRect.isEmpty()) |
951 return; | 895 return; |
952 | 896 |
953 if (platformWidget()) { | |
954 notifyPageThatContentAreaWillPaint(); | |
955 platformRepaintContentRectangle(paintRect); | |
956 return; | |
957 } | |
958 | |
959 if (hostWindow()) | 897 if (hostWindow()) |
960 hostWindow()->invalidateContentsAndRootView(contentsToWindow(paintRect))
; | 898 hostWindow()->invalidateContentsAndRootView(contentsToWindow(paintRect))
; |
961 } | 899 } |
962 | 900 |
963 IntRect ScrollView::scrollCornerRect() const | 901 IntRect ScrollView::scrollCornerRect() const |
964 { | 902 { |
965 IntRect cornerRect; | 903 IntRect cornerRect; |
966 | 904 |
967 if (hasOverlayScrollbars()) | 905 if (hasOverlayScrollbars()) |
968 return cornerRect; | 906 return cornerRect; |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1044 { | 982 { |
1045 static Image* panScrollIcon = Image::loadPlatformResource("panIcon").leakRef
(); | 983 static Image* panScrollIcon = Image::loadPlatformResource("panIcon").leakRef
(); |
1046 IntPoint iconGCPoint = m_panScrollIconPoint; | 984 IntPoint iconGCPoint = m_panScrollIconPoint; |
1047 if (parent()) | 985 if (parent()) |
1048 iconGCPoint = parent()->windowToContents(iconGCPoint); | 986 iconGCPoint = parent()->windowToContents(iconGCPoint); |
1049 context->drawImage(panScrollIcon, ColorSpaceDeviceRGB, iconGCPoint); | 987 context->drawImage(panScrollIcon, ColorSpaceDeviceRGB, iconGCPoint); |
1050 } | 988 } |
1051 | 989 |
1052 void ScrollView::paint(GraphicsContext* context, const IntRect& rect) | 990 void ScrollView::paint(GraphicsContext* context, const IntRect& rect) |
1053 { | 991 { |
1054 if (platformWidget()) { | |
1055 Widget::paint(context, rect); | |
1056 return; | |
1057 } | |
1058 | |
1059 if (context->paintingDisabled() && !context->updatingControlTints()) | 992 if (context->paintingDisabled() && !context->updatingControlTints()) |
1060 return; | 993 return; |
1061 | 994 |
1062 notifyPageThatContentAreaWillPaint(); | 995 notifyPageThatContentAreaWillPaint(); |
1063 | 996 |
1064 IntRect documentDirtyRect = rect; | 997 IntRect documentDirtyRect = rect; |
1065 if (!paintsEntireContents()) { | 998 if (!paintsEntireContents()) { |
1066 IntRect visibleAreaWithoutScrollbars(location(), visibleContentRect().si
ze()); | 999 IntRect visibleAreaWithoutScrollbars(location(), visibleContentRect().si
ze()); |
1067 documentDirtyRect.intersect(visibleAreaWithoutScrollbars); | 1000 documentDirtyRect.intersect(visibleAreaWithoutScrollbars); |
1068 } | 1001 } |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1284 (*it)->setParentVisible(false); | 1217 (*it)->setParentVisible(false); |
1285 } | 1218 } |
1286 setSelfVisible(false); | 1219 setSelfVisible(false); |
1287 } | 1220 } |
1288 | 1221 |
1289 Widget::hide(); | 1222 Widget::hide(); |
1290 } | 1223 } |
1291 | 1224 |
1292 bool ScrollView::isOffscreen() const | 1225 bool ScrollView::isOffscreen() const |
1293 { | 1226 { |
1294 if (platformWidget()) | 1227 return !isVisible(); |
1295 return platformIsOffscreen(); | |
1296 | |
1297 if (!isVisible()) | |
1298 return true; | |
1299 | |
1300 // FIXME: Add a HostWindow::isOffscreen method here. Since only Mac impleme
nts this method | |
1301 // currently, we can add the method when the other platforms decide to imple
ment this concept. | |
1302 return false; | |
1303 } | 1228 } |
1304 | 1229 |
1305 | 1230 |
1306 void ScrollView::addPanScrollIcon(const IntPoint& iconPosition) | 1231 void ScrollView::addPanScrollIcon(const IntPoint& iconPosition) |
1307 { | 1232 { |
1308 if (!hostWindow()) | 1233 if (!hostWindow()) |
1309 return; | 1234 return; |
1310 m_drawPanScrollIcon = true; | 1235 m_drawPanScrollIcon = true; |
1311 m_panScrollIconPoint = IntPoint(iconPosition.x() - panIconSizeLength / 2 , i
conPosition.y() - panIconSizeLength / 2) ; | 1236 m_panScrollIconPoint = IntPoint(iconPosition.x() - panIconSizeLength / 2 , i
conPosition.y() - panIconSizeLength / 2) ; |
1312 hostWindow()->invalidateContentsAndRootView(IntRect(m_panScrollIconPoint, In
tSize(panIconSizeLength, panIconSizeLength))); | 1237 hostWindow()->invalidateContentsAndRootView(IntRect(m_panScrollIconPoint, In
tSize(panIconSizeLength, panIconSizeLength))); |
1313 } | 1238 } |
1314 | 1239 |
1315 void ScrollView::removePanScrollIcon() | 1240 void ScrollView::removePanScrollIcon() |
1316 { | 1241 { |
1317 if (!hostWindow()) | 1242 if (!hostWindow()) |
1318 return; | 1243 return; |
1319 m_drawPanScrollIcon = false; | 1244 m_drawPanScrollIcon = false; |
1320 hostWindow()->invalidateContentsAndRootView(IntRect(m_panScrollIconPoint, In
tSize(panIconSizeLength, panIconSizeLength))); | 1245 hostWindow()->invalidateContentsAndRootView(IntRect(m_panScrollIconPoint, In
tSize(panIconSizeLength, panIconSizeLength))); |
1321 } | 1246 } |
1322 | 1247 |
1323 void ScrollView::setScrollOrigin(const IntPoint& origin, bool updatePositionAtAl
l, bool updatePositionSynchronously) | 1248 void ScrollView::setScrollOrigin(const IntPoint& origin, bool updatePositionAtAl
l, bool updatePositionSynchronously) |
1324 { | 1249 { |
1325 if (scrollOrigin() == origin) | 1250 if (scrollOrigin() == origin) |
1326 return; | 1251 return; |
1327 | 1252 |
1328 ScrollableArea::setScrollOrigin(origin); | 1253 ScrollableArea::setScrollOrigin(origin); |
1329 | 1254 |
1330 if (platformWidget()) { | |
1331 platformSetScrollOrigin(origin, updatePositionAtAll, updatePositionSynch
ronously); | |
1332 return; | |
1333 } | |
1334 | |
1335 // Update if the scroll origin changes, since our position will be different
if the content size did not change. | 1255 // Update if the scroll origin changes, since our position will be different
if the content size did not change. |
1336 if (updatePositionAtAll && updatePositionSynchronously) | 1256 if (updatePositionAtAll && updatePositionSynchronously) |
1337 updateScrollbars(scrollOffset()); | 1257 updateScrollbars(scrollOffset()); |
1338 } | 1258 } |
1339 | 1259 |
1340 #if !PLATFORM(WX) && !PLATFORM(EFL) | 1260 #if !PLATFORM(WX) && !PLATFORM(EFL) |
1341 | 1261 |
1342 void ScrollView::platformInit() | 1262 void ScrollView::platformInit() |
1343 { | 1263 { |
1344 } | 1264 } |
1345 | 1265 |
1346 void ScrollView::platformDestroy() | 1266 void ScrollView::platformDestroy() |
1347 { | 1267 { |
1348 } | 1268 } |
1349 | 1269 |
1350 #endif | 1270 #endif |
1351 | 1271 |
1352 #if !PLATFORM(WX) && !PLATFORM(QT) && !PLATFORM(MAC) | |
1353 | |
1354 void ScrollView::platformAddChild(Widget*) | |
1355 { | |
1356 } | |
1357 | |
1358 void ScrollView::platformRemoveChild(Widget*) | |
1359 { | |
1360 } | |
1361 | |
1362 #endif | |
1363 | |
1364 #if !PLATFORM(MAC) | 1272 #if !PLATFORM(MAC) |
1365 | 1273 |
1366 void ScrollView::platformSetScrollbarsSuppressed(bool) | 1274 void ScrollView::platformSetScrollbarsSuppressed(bool) |
1367 { | 1275 { |
1368 } | 1276 } |
1369 | 1277 |
1370 void ScrollView::platformSetScrollOrigin(const IntPoint&, bool, bool) | 1278 void ScrollView::platformSetScrollOrigin(const IntPoint&, bool, bool) |
1371 { | 1279 { |
1372 } | 1280 } |
1373 | 1281 |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1431 } | 1339 } |
1432 | 1340 |
1433 bool ScrollView::platformIsOffscreen() const | 1341 bool ScrollView::platformIsOffscreen() const |
1434 { | 1342 { |
1435 return false; | 1343 return false; |
1436 } | 1344 } |
1437 | 1345 |
1438 #endif | 1346 #endif |
1439 | 1347 |
1440 } | 1348 } |
OLD | NEW |