OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org> | 2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org> |
3 * 1999 Lars Knoll <knoll@kde.org> | 3 * 1999 Lars Knoll <knoll@kde.org> |
4 * 1999 Antti Koivisto <koivisto@kde.org> | 4 * 1999 Antti Koivisto <koivisto@kde.org> |
5 * 2000 Dirk Mueller <mueller@kde.org> | 5 * 2000 Dirk Mueller <mueller@kde.org> |
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. |
7 * (C) 2006 Graham Dennis (graham.dennis@gmail.com) | 7 * (C) 2006 Graham Dennis (graham.dennis@gmail.com) |
8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) | 8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) |
9 * Copyright (C) 2009 Google Inc. All rights reserved. | 9 * Copyright (C) 2009 Google Inc. All rights reserved. |
10 * | 10 * |
(...skipping 26 matching lines...) Expand all Loading... |
37 #include "core/editing/EditingUtilities.h" | 37 #include "core/editing/EditingUtilities.h" |
38 #include "core/editing/FrameSelection.h" | 38 #include "core/editing/FrameSelection.h" |
39 #include "core/editing/RenderedPosition.h" | 39 #include "core/editing/RenderedPosition.h" |
40 #include "core/editing/markers/DocumentMarkerController.h" | 40 #include "core/editing/markers/DocumentMarkerController.h" |
41 #include "core/fetch/ResourceFetcher.h" | 41 #include "core/fetch/ResourceFetcher.h" |
42 #include "core/frame/EventHandlerRegistry.h" | 42 #include "core/frame/EventHandlerRegistry.h" |
43 #include "core/frame/FrameHost.h" | 43 #include "core/frame/FrameHost.h" |
44 #include "core/frame/LocalFrame.h" | 44 #include "core/frame/LocalFrame.h" |
45 #include "core/frame/Location.h" | 45 #include "core/frame/Location.h" |
46 #include "core/frame/PageScaleConstraintsSet.h" | 46 #include "core/frame/PageScaleConstraintsSet.h" |
| 47 #include "core/frame/ScrollAndScaleEmulator.h" |
47 #include "core/frame/Settings.h" | 48 #include "core/frame/Settings.h" |
48 #include "core/frame/TopControls.h" | 49 #include "core/frame/TopControls.h" |
49 #include "core/frame/VisualViewport.h" | 50 #include "core/frame/VisualViewport.h" |
50 #include "core/html/HTMLFrameElement.h" | 51 #include "core/html/HTMLFrameElement.h" |
51 #include "core/html/HTMLPlugInElement.h" | 52 #include "core/html/HTMLPlugInElement.h" |
52 #include "core/html/HTMLTextFormControlElement.h" | 53 #include "core/html/HTMLTextFormControlElement.h" |
53 #include "core/html/parser/TextResourceDecoder.h" | 54 #include "core/html/parser/TextResourceDecoder.h" |
54 #include "core/input/EventHandler.h" | 55 #include "core/input/EventHandler.h" |
55 #include "core/inspector/InspectorInstrumentation.h" | 56 #include "core/inspector/InspectorInstrumentation.h" |
56 #include "core/inspector/InspectorTraceEvents.h" | 57 #include "core/inspector/InspectorTraceEvents.h" |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 | 198 |
198 DEFINE_TRACE(FrameView) | 199 DEFINE_TRACE(FrameView) |
199 { | 200 { |
200 visitor->trace(m_frame); | 201 visitor->trace(m_frame); |
201 visitor->trace(m_fragmentAnchor); | 202 visitor->trace(m_fragmentAnchor); |
202 visitor->trace(m_scrollableAreas); | 203 visitor->trace(m_scrollableAreas); |
203 visitor->trace(m_animatingScrollableAreas); | 204 visitor->trace(m_animatingScrollableAreas); |
204 visitor->trace(m_autoSizeInfo); | 205 visitor->trace(m_autoSizeInfo); |
205 visitor->trace(m_horizontalScrollbar); | 206 visitor->trace(m_horizontalScrollbar); |
206 visitor->trace(m_verticalScrollbar); | 207 visitor->trace(m_verticalScrollbar); |
| 208 visitor->trace(m_scrollAndScaleEmulator); |
207 visitor->trace(m_children); | 209 visitor->trace(m_children); |
208 visitor->trace(m_viewportScrollableArea); | 210 visitor->trace(m_viewportScrollableArea); |
209 visitor->trace(m_scrollAnchor); | 211 visitor->trace(m_scrollAnchor); |
210 Widget::trace(visitor); | 212 Widget::trace(visitor); |
211 ScrollableArea::trace(visitor); | 213 ScrollableArea::trace(visitor); |
212 } | 214 } |
213 | 215 |
214 void FrameView::reset() | 216 void FrameView::reset() |
215 { | 217 { |
216 m_hasPendingLayout = false; | 218 m_hasPendingLayout = false; |
(...skipping 1379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1596 DoublePoint newScrollPosition = clampScrollPosition(scrollPoint); | 1598 DoublePoint newScrollPosition = clampScrollPosition(scrollPoint); |
1597 if (newScrollPosition == scrollPositionDouble()) | 1599 if (newScrollPosition == scrollPositionDouble()) |
1598 return; | 1600 return; |
1599 | 1601 |
1600 if (scrollBehavior == ScrollBehaviorAuto) | 1602 if (scrollBehavior == ScrollBehaviorAuto) |
1601 scrollBehavior = scrollBehaviorStyle(); | 1603 scrollBehavior = scrollBehaviorStyle(); |
1602 | 1604 |
1603 ScrollableArea::setScrollPosition(newScrollPosition, scrollType, scrollBehav
ior); | 1605 ScrollableArea::setScrollPosition(newScrollPosition, scrollType, scrollBehav
ior); |
1604 } | 1606 } |
1605 | 1607 |
| 1608 void FrameView::setScrollAndScaleEmulator(ScrollAndScaleEmulator* emulator) |
| 1609 { |
| 1610 m_scrollAndScaleEmulator = emulator; |
| 1611 setScrollPosition(scrollPosition(), ProgrammaticScroll, ScrollBehaviorInstan
t); |
| 1612 } |
| 1613 |
1606 void FrameView::didUpdateElasticOverscroll() | 1614 void FrameView::didUpdateElasticOverscroll() |
1607 { | 1615 { |
1608 Page* page = frame().page(); | 1616 Page* page = frame().page(); |
1609 if (!page) | 1617 if (!page) |
1610 return; | 1618 return; |
1611 FloatSize elasticOverscroll = page->chromeClient().elasticOverscroll(); | 1619 FloatSize elasticOverscroll = page->chromeClient().elasticOverscroll(); |
1612 if (m_horizontalScrollbar) { | 1620 if (m_horizontalScrollbar) { |
1613 float delta = elasticOverscroll.width() - m_horizontalScrollbar->elastic
Overscroll(); | 1621 float delta = elasticOverscroll.width() - m_horizontalScrollbar->elastic
Overscroll(); |
1614 if (delta != 0) { | 1622 if (delta != 0) { |
1615 m_horizontalScrollbar->setElasticOverscroll(elasticOverscroll.width(
)); | 1623 m_horizontalScrollbar->setElasticOverscroll(elasticOverscroll.width(
)); |
(...skipping 1549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3165 ScrollableArea::didAddScrollbar(scrollbar, orientation); | 3173 ScrollableArea::didAddScrollbar(scrollbar, orientation); |
3166 } | 3174 } |
3167 | 3175 |
3168 void FrameView::setTopControlsViewportAdjustment(float adjustment) | 3176 void FrameView::setTopControlsViewportAdjustment(float adjustment) |
3169 { | 3177 { |
3170 m_topControlsViewportAdjustment = adjustment; | 3178 m_topControlsViewportAdjustment = adjustment; |
3171 } | 3179 } |
3172 | 3180 |
3173 IntPoint FrameView::maximumScrollPosition() const | 3181 IntPoint FrameView::maximumScrollPosition() const |
3174 { | 3182 { |
| 3183 IntPoint minimum = calculateMinimumScrollPosition(); |
| 3184 IntPoint maximum = calculateMaximumScrollPosition().expandedTo(minimum); |
| 3185 |
| 3186 if (m_scrollAndScaleEmulator) |
| 3187 return m_scrollAndScaleEmulator->applyFramePositionOverride(maximum).shr
unkTo(maximum).expandedTo(minimum); |
| 3188 |
| 3189 return maximum; |
| 3190 } |
| 3191 |
| 3192 IntPoint FrameView::calculateMaximumScrollPosition() const |
| 3193 { |
3175 // Make the same calculation as in CC's LayerImpl::MaxScrollOffset() | 3194 // Make the same calculation as in CC's LayerImpl::MaxScrollOffset() |
3176 // FIXME: We probably shouldn't be storing the bounds in a float. crbug.com/
422331. | 3195 // FIXME: We probably shouldn't be storing the bounds in a float. crbug.com/
422331. |
3177 IntSize visibleSize = visibleContentSize(ExcludeScrollbars) + topControlsSiz
e(); | 3196 IntSize visibleSize = visibleContentSize(ExcludeScrollbars) + topControlsSiz
e(); |
3178 IntSize contentBounds = contentsSize(); | 3197 IntSize contentBounds = contentsSize(); |
3179 IntPoint maximumPosition = -scrollOrigin() + (contentBounds - visibleSize); | 3198 IntPoint maximumPosition = -scrollOrigin() + (contentBounds - visibleSize); |
3180 return maximumPosition.expandedTo(minimumScrollPosition()); | 3199 return maximumPosition; |
3181 } | 3200 } |
3182 | 3201 |
3183 void FrameView::addChild(Widget* child) | 3202 void FrameView::addChild(Widget* child) |
3184 { | 3203 { |
3185 ASSERT(child != this && !child->parent()); | 3204 ASSERT(child != this && !child->parent()); |
3186 child->setParent(this); | 3205 child->setParent(this); |
3187 m_children.add(child); | 3206 m_children.add(child); |
3188 } | 3207 } |
3189 | 3208 |
3190 void FrameView::setHasHorizontalScrollbar(bool hasBar) | 3209 void FrameView::setHasHorizontalScrollbar(bool hasBar) |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3289 return IntRect(flooredIntPoint(m_scrollPosition), visibleContentSize(scrollb
arInclusion)); | 3308 return IntRect(flooredIntPoint(m_scrollPosition), visibleContentSize(scrollb
arInclusion)); |
3290 } | 3309 } |
3291 | 3310 |
3292 IntSize FrameView::contentsSize() const | 3311 IntSize FrameView::contentsSize() const |
3293 { | 3312 { |
3294 return m_contentsSize; | 3313 return m_contentsSize; |
3295 } | 3314 } |
3296 | 3315 |
3297 IntPoint FrameView::minimumScrollPosition() const | 3316 IntPoint FrameView::minimumScrollPosition() const |
3298 { | 3317 { |
| 3318 IntPoint minimum = calculateMinimumScrollPosition(); |
| 3319 IntPoint maximum = calculateMaximumScrollPosition().expandedTo(minimum); |
| 3320 |
| 3321 if (m_scrollAndScaleEmulator) |
| 3322 return m_scrollAndScaleEmulator->applyFramePositionOverride(minimum).shr
unkTo(maximum).expandedTo(minimum); |
| 3323 |
| 3324 return minimum; |
| 3325 } |
| 3326 |
| 3327 IntPoint FrameView::calculateMinimumScrollPosition() const |
| 3328 { |
3299 return IntPoint(-scrollOrigin().x(), -scrollOrigin().y()); | 3329 return IntPoint(-scrollOrigin().x(), -scrollOrigin().y()); |
3300 } | 3330 } |
3301 | 3331 |
3302 void FrameView::adjustScrollbarOpacity() | 3332 void FrameView::adjustScrollbarOpacity() |
3303 { | 3333 { |
3304 if (m_horizontalScrollbar && layerForHorizontalScrollbar()) { | 3334 if (m_horizontalScrollbar && layerForHorizontalScrollbar()) { |
3305 bool isOpaqueScrollbar = !m_horizontalScrollbar->isOverlayScrollbar(); | 3335 bool isOpaqueScrollbar = !m_horizontalScrollbar->isOverlayScrollbar(); |
3306 layerForHorizontalScrollbar()->setContentsOpaque(isOpaqueScrollbar); | 3336 layerForHorizontalScrollbar()->setContentsOpaque(isOpaqueScrollbar); |
3307 } | 3337 } |
3308 if (m_verticalScrollbar && layerForVerticalScrollbar()) { | 3338 if (m_verticalScrollbar && layerForVerticalScrollbar()) { |
(...skipping 930 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4239 return m_subtreeThrottled || (m_hiddenForThrottling && m_crossOriginForThrot
tling); | 4269 return m_subtreeThrottled || (m_hiddenForThrottling && m_crossOriginForThrot
tling); |
4240 } | 4270 } |
4241 | 4271 |
4242 LayoutBox& FrameView::boxForScrollControlPaintInvalidation() const | 4272 LayoutBox& FrameView::boxForScrollControlPaintInvalidation() const |
4243 { | 4273 { |
4244 ASSERT(!layoutViewItem().isNull()); | 4274 ASSERT(!layoutViewItem().isNull()); |
4245 return *layoutView(); | 4275 return *layoutView(); |
4246 } | 4276 } |
4247 | 4277 |
4248 } // namespace blink | 4278 } // namespace blink |
OLD | NEW |