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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
198 | 199 |
199 DEFINE_TRACE(FrameView) | 200 DEFINE_TRACE(FrameView) |
200 { | 201 { |
201 visitor->trace(m_frame); | 202 visitor->trace(m_frame); |
202 visitor->trace(m_fragmentAnchor); | 203 visitor->trace(m_fragmentAnchor); |
203 visitor->trace(m_scrollableAreas); | 204 visitor->trace(m_scrollableAreas); |
204 visitor->trace(m_animatingScrollableAreas); | 205 visitor->trace(m_animatingScrollableAreas); |
205 visitor->trace(m_autoSizeInfo); | 206 visitor->trace(m_autoSizeInfo); |
206 visitor->trace(m_horizontalScrollbar); | 207 visitor->trace(m_horizontalScrollbar); |
207 visitor->trace(m_verticalScrollbar); | 208 visitor->trace(m_verticalScrollbar); |
209 visitor->trace(m_scrollAndScaleEmulator); | |
208 visitor->trace(m_children); | 210 visitor->trace(m_children); |
209 visitor->trace(m_viewportScrollableArea); | 211 visitor->trace(m_viewportScrollableArea); |
210 visitor->trace(m_scrollAnchor); | 212 visitor->trace(m_scrollAnchor); |
211 Widget::trace(visitor); | 213 Widget::trace(visitor); |
212 ScrollableArea::trace(visitor); | 214 ScrollableArea::trace(visitor); |
213 } | 215 } |
214 | 216 |
215 void FrameView::reset() | 217 void FrameView::reset() |
216 { | 218 { |
217 m_hasPendingLayout = false; | 219 m_hasPendingLayout = false; |
(...skipping 1376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1594 DoublePoint newScrollPosition = clampScrollPosition(scrollPoint); | 1596 DoublePoint newScrollPosition = clampScrollPosition(scrollPoint); |
1595 if (newScrollPosition == scrollPositionDouble()) | 1597 if (newScrollPosition == scrollPositionDouble()) |
1596 return; | 1598 return; |
1597 | 1599 |
1598 if (scrollBehavior == ScrollBehaviorAuto) | 1600 if (scrollBehavior == ScrollBehaviorAuto) |
1599 scrollBehavior = scrollBehaviorStyle(); | 1601 scrollBehavior = scrollBehaviorStyle(); |
1600 | 1602 |
1601 ScrollableArea::setScrollPosition(newScrollPosition, scrollType, scrollBehav ior); | 1603 ScrollableArea::setScrollPosition(newScrollPosition, scrollType, scrollBehav ior); |
1602 } | 1604 } |
1603 | 1605 |
1606 void FrameView::setScrollAndScaleEmulator(ScrollAndScaleEmulator* emulator) | |
1607 { | |
1608 m_scrollAndScaleEmulator = emulator; | |
1609 setScrollPosition(scrollPosition(), ProgrammaticScroll, ScrollBehaviorInstan t); | |
1610 } | |
1611 | |
1604 void FrameView::didUpdateElasticOverscroll() | 1612 void FrameView::didUpdateElasticOverscroll() |
1605 { | 1613 { |
1606 Page* page = frame().page(); | 1614 Page* page = frame().page(); |
1607 if (!page) | 1615 if (!page) |
1608 return; | 1616 return; |
1609 FloatSize elasticOverscroll = page->chromeClient().elasticOverscroll(); | 1617 FloatSize elasticOverscroll = page->chromeClient().elasticOverscroll(); |
1610 if (m_horizontalScrollbar) { | 1618 if (m_horizontalScrollbar) { |
1611 float delta = elasticOverscroll.width() - m_horizontalScrollbar->elastic Overscroll(); | 1619 float delta = elasticOverscroll.width() - m_horizontalScrollbar->elastic Overscroll(); |
1612 if (delta != 0) { | 1620 if (delta != 0) { |
1613 m_horizontalScrollbar->setElasticOverscroll(elasticOverscroll.width( )); | 1621 m_horizontalScrollbar->setElasticOverscroll(elasticOverscroll.width( )); |
(...skipping 1586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3200 ScrollableArea::didAddScrollbar(scrollbar, orientation); | 3208 ScrollableArea::didAddScrollbar(scrollbar, orientation); |
3201 } | 3209 } |
3202 | 3210 |
3203 void FrameView::setTopControlsViewportAdjustment(float adjustment) | 3211 void FrameView::setTopControlsViewportAdjustment(float adjustment) |
3204 { | 3212 { |
3205 m_topControlsViewportAdjustment = adjustment; | 3213 m_topControlsViewportAdjustment = adjustment; |
3206 } | 3214 } |
3207 | 3215 |
3208 IntPoint FrameView::maximumScrollPosition() const | 3216 IntPoint FrameView::maximumScrollPosition() const |
3209 { | 3217 { |
3218 IntPoint minimum = calculateMinimumScrollPosition(); | |
3219 IntPoint maximum = calculateMaximumScrollPosition().expandedTo(minimum); | |
3220 | |
3221 if (m_scrollAndScaleEmulator) | |
3222 return m_scrollAndScaleEmulator->applyFramePositionOverride(maximum).shr unkTo(maximum).expandedTo(minimum); | |
dgozman
2016/07/21 20:54:08
Is this web-observable? E.g. what this snippet wil
Eric Seckler
2016/07/22 14:44:48
For the layout viewport (frame), the change of scr
| |
3223 | |
3224 return maximum; | |
3225 } | |
3226 | |
3227 IntPoint FrameView::calculateMaximumScrollPosition() const | |
3228 { | |
3210 // Make the same calculation as in CC's LayerImpl::MaxScrollOffset() | 3229 // Make the same calculation as in CC's LayerImpl::MaxScrollOffset() |
3211 // FIXME: We probably shouldn't be storing the bounds in a float. crbug.com/ 422331. | 3230 // FIXME: We probably shouldn't be storing the bounds in a float. crbug.com/ 422331. |
3212 IntSize visibleSize = visibleContentSize(ExcludeScrollbars) + topControlsSiz e(); | 3231 IntSize visibleSize = visibleContentSize(ExcludeScrollbars) + topControlsSiz e(); |
3213 IntSize contentBounds = contentsSize(); | 3232 IntSize contentBounds = contentsSize(); |
3214 IntPoint maximumPosition = -scrollOrigin() + (contentBounds - visibleSize); | 3233 IntPoint maximumPosition = -scrollOrigin() + (contentBounds - visibleSize); |
3215 return maximumPosition.expandedTo(minimumScrollPosition()); | 3234 return maximumPosition; |
3216 } | 3235 } |
3217 | 3236 |
3218 void FrameView::addChild(Widget* child) | 3237 void FrameView::addChild(Widget* child) |
3219 { | 3238 { |
3220 ASSERT(child != this && !child->parent()); | 3239 ASSERT(child != this && !child->parent()); |
3221 child->setParent(this); | 3240 child->setParent(this); |
3222 m_children.add(child); | 3241 m_children.add(child); |
3223 } | 3242 } |
3224 | 3243 |
3225 void FrameView::setHasHorizontalScrollbar(bool hasBar) | 3244 void FrameView::setHasHorizontalScrollbar(bool hasBar) |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3324 return IntRect(flooredIntPoint(m_scrollPosition), visibleContentSize(scrollb arInclusion)); | 3343 return IntRect(flooredIntPoint(m_scrollPosition), visibleContentSize(scrollb arInclusion)); |
3325 } | 3344 } |
3326 | 3345 |
3327 IntSize FrameView::contentsSize() const | 3346 IntSize FrameView::contentsSize() const |
3328 { | 3347 { |
3329 return m_contentsSize; | 3348 return m_contentsSize; |
3330 } | 3349 } |
3331 | 3350 |
3332 IntPoint FrameView::minimumScrollPosition() const | 3351 IntPoint FrameView::minimumScrollPosition() const |
3333 { | 3352 { |
3353 IntPoint minimum = calculateMinimumScrollPosition(); | |
3354 IntPoint maximum = calculateMaximumScrollPosition().expandedTo(minimum); | |
3355 | |
3356 if (m_scrollAndScaleEmulator) | |
3357 return m_scrollAndScaleEmulator->applyFramePositionOverride(minimum).shr unkTo(maximum).expandedTo(minimum); | |
3358 | |
3359 return minimum; | |
3360 } | |
3361 | |
3362 IntPoint FrameView::calculateMinimumScrollPosition() const | |
3363 { | |
3334 return IntPoint(-scrollOrigin().x(), -scrollOrigin().y()); | 3364 return IntPoint(-scrollOrigin().x(), -scrollOrigin().y()); |
3335 } | 3365 } |
3336 | 3366 |
3337 void FrameView::adjustScrollbarOpacity() | 3367 void FrameView::adjustScrollbarOpacity() |
3338 { | 3368 { |
3339 if (m_horizontalScrollbar && layerForHorizontalScrollbar()) { | 3369 if (m_horizontalScrollbar && layerForHorizontalScrollbar()) { |
3340 bool isOpaqueScrollbar = !m_horizontalScrollbar->isOverlayScrollbar(); | 3370 bool isOpaqueScrollbar = !m_horizontalScrollbar->isOverlayScrollbar(); |
3341 layerForHorizontalScrollbar()->setContentsOpaque(isOpaqueScrollbar); | 3371 layerForHorizontalScrollbar()->setContentsOpaque(isOpaqueScrollbar); |
3342 } | 3372 } |
3343 if (m_verticalScrollbar && layerForVerticalScrollbar()) { | 3373 if (m_verticalScrollbar && layerForVerticalScrollbar()) { |
(...skipping 942 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4286 } | 4316 } |
4287 | 4317 |
4288 bool FrameView::canThrottleRendering() const | 4318 bool FrameView::canThrottleRendering() const |
4289 { | 4319 { |
4290 if (!RuntimeEnabledFeatures::renderingPipelineThrottlingEnabled()) | 4320 if (!RuntimeEnabledFeatures::renderingPipelineThrottlingEnabled()) |
4291 return false; | 4321 return false; |
4292 return m_subtreeThrottled || (m_hiddenForThrottling && m_crossOriginForThrot tling); | 4322 return m_subtreeThrottled || (m_hiddenForThrottling && m_crossOriginForThrot tling); |
4293 } | 4323 } |
4294 | 4324 |
4295 } // namespace blink | 4325 } // namespace blink |
OLD | NEW |