| 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 : m_horizontalScrollbarMode(ScrollbarAuto) | 42 : m_horizontalScrollbarMode(ScrollbarAuto) |
| 43 , m_verticalScrollbarMode(ScrollbarAuto) | 43 , m_verticalScrollbarMode(ScrollbarAuto) |
| 44 , m_horizontalScrollbarLock(false) | 44 , m_horizontalScrollbarLock(false) |
| 45 , m_verticalScrollbarLock(false) | 45 , m_verticalScrollbarLock(false) |
| 46 , m_canBlitOnScroll(true) | 46 , m_canBlitOnScroll(true) |
| 47 , m_scrollbarsAvoidingResizer(0) | 47 , m_scrollbarsAvoidingResizer(0) |
| 48 , m_scrollbarsSuppressed(false) | 48 , m_scrollbarsSuppressed(false) |
| 49 , m_inUpdateScrollbars(false) | 49 , m_inUpdateScrollbars(false) |
| 50 , m_updateScrollbarsPass(0) | 50 , m_updateScrollbarsPass(0) |
| 51 , m_drawPanScrollIcon(false) | 51 , m_drawPanScrollIcon(false) |
| 52 , m_useFixedLayout(false) | |
| 53 , m_paintsEntireContents(false) | 52 , m_paintsEntireContents(false) |
| 54 , m_clipsRepaints(true) | 53 , m_clipsRepaints(true) |
| 55 { | 54 { |
| 56 } | 55 } |
| 57 | 56 |
| 58 ScrollView::~ScrollView() | 57 ScrollView::~ScrollView() |
| 59 { | 58 { |
| 60 } | 59 } |
| 61 | 60 |
| 62 void ScrollView::addChild(PassRefPtr<Widget> prpChild) | 61 void ScrollView::addChild(PassRefPtr<Widget> prpChild) |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 m_paintsEntireContents = paintsEntireContents; | 180 m_paintsEntireContents = paintsEntireContents; |
| 182 } | 181 } |
| 183 | 182 |
| 184 void ScrollView::setClipsRepaints(bool clipsRepaints) | 183 void ScrollView::setClipsRepaints(bool clipsRepaints) |
| 185 { | 184 { |
| 186 m_clipsRepaints = clipsRepaints; | 185 m_clipsRepaints = clipsRepaints; |
| 187 } | 186 } |
| 188 | 187 |
| 189 IntSize ScrollView::unscaledVisibleContentSize(VisibleContentRectIncludesScrollb
ars scrollbarInclusion) const | 188 IntSize ScrollView::unscaledVisibleContentSize(VisibleContentRectIncludesScrollb
ars scrollbarInclusion) const |
| 190 { | 189 { |
| 190 return scrollbarInclusion == ExcludeScrollbars ? excludeScrollbars(frameRect
().size()) : frameRect().size(); |
| 191 } |
| 192 |
| 193 IntSize ScrollView::excludeScrollbars(const IntSize& size) const |
| 194 { |
| 191 int verticalScrollbarWidth = 0; | 195 int verticalScrollbarWidth = 0; |
| 192 int horizontalScrollbarHeight = 0; | 196 int horizontalScrollbarHeight = 0; |
| 193 | 197 |
| 194 if (scrollbarInclusion == ExcludeScrollbars) { | 198 if (Scrollbar* verticalBar = verticalScrollbar()) |
| 195 if (Scrollbar* verticalBar = verticalScrollbar()) | 199 verticalScrollbarWidth = !verticalBar->isOverlayScrollbar() ? verticalBa
r->width() : 0; |
| 196 verticalScrollbarWidth = !verticalBar->isOverlayScrollbar() ? vertic
alBar->width() : 0; | 200 if (Scrollbar* horizontalBar = horizontalScrollbar()) |
| 197 if (Scrollbar* horizontalBar = horizontalScrollbar()) | 201 horizontalScrollbarHeight = !horizontalBar->isOverlayScrollbar() ? horiz
ontalBar->height() : 0; |
| 198 horizontalScrollbarHeight = !horizontalBar->isOverlayScrollbar() ? h
orizontalBar->height() : 0; | |
| 199 } | |
| 200 | 202 |
| 201 return IntSize(max(0, width() - verticalScrollbarWidth), | 203 return IntSize(max(0, size.width() - verticalScrollbarWidth), |
| 202 max(0, height() - horizontalScrollbarHeight)); | 204 max(0, size.height() - horizontalScrollbarHeight)); |
| 205 |
| 203 } | 206 } |
| 204 | 207 |
| 205 IntRect ScrollView::visibleContentRect(VisibleContentRectIncludesScrollbars scol
lbarInclusion) const | 208 IntRect ScrollView::visibleContentRect(VisibleContentRectIncludesScrollbars scol
lbarInclusion) const |
| 206 { | 209 { |
| 207 FloatSize visibleContentSize = unscaledVisibleContentSize(scollbarInclusion)
; | 210 FloatSize visibleContentSize = unscaledVisibleContentSize(scollbarInclusion)
; |
| 208 visibleContentSize.scale(1 / visibleContentScaleFactor()); | 211 visibleContentSize.scale(1 / visibleContentScaleFactor()); |
| 209 return IntRect(IntPoint(m_scrollOffset), expandedIntSize(visibleContentSize)
); | 212 return IntRect(IntPoint(m_scrollOffset), expandedIntSize(visibleContentSize)
); |
| 210 } | 213 } |
| 211 | 214 |
| 212 IntSize ScrollView::layoutSize(VisibleContentRectIncludesScrollbars scrollbarInc
lusion) const | |
| 213 { | |
| 214 return m_fixedLayoutSize.isEmpty() || !m_useFixedLayout ? unscaledVisibleCon
tentSize(scrollbarInclusion) : m_fixedLayoutSize; | |
| 215 } | |
| 216 | |
| 217 IntSize ScrollView::fixedLayoutSize() const | |
| 218 { | |
| 219 return m_fixedLayoutSize; | |
| 220 } | |
| 221 | |
| 222 void ScrollView::setFixedLayoutSize(const IntSize& newSize) | |
| 223 { | |
| 224 if (fixedLayoutSize() == newSize) | |
| 225 return; | |
| 226 m_fixedLayoutSize = newSize; | |
| 227 updateScrollbars(scrollOffset()); | |
| 228 if (m_useFixedLayout) | |
| 229 contentsResized(); | |
| 230 } | |
| 231 | |
| 232 bool ScrollView::useFixedLayout() const | |
| 233 { | |
| 234 return m_useFixedLayout; | |
| 235 } | |
| 236 | |
| 237 void ScrollView::setUseFixedLayout(bool enable) | |
| 238 { | |
| 239 if (useFixedLayout() == enable) | |
| 240 return; | |
| 241 m_useFixedLayout = enable; | |
| 242 updateScrollbars(scrollOffset()); | |
| 243 contentsResized(); | |
| 244 } | |
| 245 | |
| 246 IntSize ScrollView::contentsSize() const | 215 IntSize ScrollView::contentsSize() const |
| 247 { | 216 { |
| 248 return m_contentsSize; | 217 return m_contentsSize; |
| 249 } | 218 } |
| 250 | 219 |
| 251 void ScrollView::setContentsSize(const IntSize& newSize) | 220 void ScrollView::setContentsSize(const IntSize& newSize) |
| 252 { | 221 { |
| 253 if (contentsSize() == newSize) | 222 if (contentsSize() == newSize) |
| 254 return; | 223 return; |
| 255 m_contentsSize = newSize; | 224 m_contentsSize = newSize; |
| (...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 736 | 705 |
| 737 if (newRect == oldRect) | 706 if (newRect == oldRect) |
| 738 return; | 707 return; |
| 739 | 708 |
| 740 Widget::setFrameRect(newRect); | 709 Widget::setFrameRect(newRect); |
| 741 | 710 |
| 742 frameRectsChanged(); | 711 frameRectsChanged(); |
| 743 | 712 |
| 744 updateScrollbars(scrollOffset()); | 713 updateScrollbars(scrollOffset()); |
| 745 | 714 |
| 746 if (!m_useFixedLayout && oldRect.size() != newRect.size()) | 715 if (oldRect.size() != newRect.size()) |
| 747 contentsResized(); | 716 contentsResized(); |
| 748 } | 717 } |
| 749 | 718 |
| 750 void ScrollView::frameRectsChanged() | 719 void ScrollView::frameRectsChanged() |
| 751 { | 720 { |
| 752 HashSet<RefPtr<Widget> >::const_iterator end = m_children.end(); | 721 HashSet<RefPtr<Widget> >::const_iterator end = m_children.end(); |
| 753 for (HashSet<RefPtr<Widget> >::const_iterator current = m_children.begin();
current != end; ++current) | 722 for (HashSet<RefPtr<Widget> >::const_iterator current = m_children.begin();
current != end; ++current) |
| 754 (*current)->frameRectsChanged(); | 723 (*current)->frameRectsChanged(); |
| 755 } | 724 } |
| 756 | 725 |
| (...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1187 int ScrollView::pageStep(ScrollbarOrientation orientation) const | 1156 int ScrollView::pageStep(ScrollbarOrientation orientation) const |
| 1188 { | 1157 { |
| 1189 int length = (orientation == HorizontalScrollbar) ? visibleWidth() : visible
Height(); | 1158 int length = (orientation == HorizontalScrollbar) ? visibleWidth() : visible
Height(); |
| 1190 int minPageStep = static_cast<float>(length) * minFractionToStepWhenPaging()
; | 1159 int minPageStep = static_cast<float>(length) * minFractionToStepWhenPaging()
; |
| 1191 int pageStep = std::max(minPageStep, length - maxOverlapBetweenPages()); | 1160 int pageStep = std::max(minPageStep, length - maxOverlapBetweenPages()); |
| 1192 | 1161 |
| 1193 return std::max(pageStep, 1); | 1162 return std::max(pageStep, 1); |
| 1194 } | 1163 } |
| 1195 | 1164 |
| 1196 } // namespace WebCore | 1165 } // namespace WebCore |
| OLD | NEW |