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 1539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1596 DoublePoint newScrollPosition = clampScrollPosition(scrollPoint); | 1597 DoublePoint newScrollPosition = clampScrollPosition(scrollPoint); |
1597 if (newScrollPosition == scrollPositionDouble()) | 1598 if (newScrollPosition == scrollPositionDouble()) |
1598 return; | 1599 return; |
1599 | 1600 |
1600 if (scrollBehavior == ScrollBehaviorAuto) | 1601 if (scrollBehavior == ScrollBehaviorAuto) |
1601 scrollBehavior = scrollBehaviorStyle(); | 1602 scrollBehavior = scrollBehaviorStyle(); |
1602 | 1603 |
1603 ScrollableArea::setScrollPosition(newScrollPosition, scrollType, scrollBehav ior); | 1604 ScrollableArea::setScrollPosition(newScrollPosition, scrollType, scrollBehav ior); |
1604 } | 1605 } |
1605 | 1606 |
1607 void FrameView::setScrollAndScaleEmulator(const RefPtr<ScrollAndScaleEmulator>& emulator) | |
1608 { | |
1609 m_scrollAndScaleEmulator = emulator; | |
1610 setScrollPosition(scrollPosition(), ProgrammaticScroll, ScrollBehaviorInstan t); | |
1611 } | |
1612 | |
1606 void FrameView::didUpdateElasticOverscroll() | 1613 void FrameView::didUpdateElasticOverscroll() |
1607 { | 1614 { |
1608 Page* page = frame().page(); | 1615 Page* page = frame().page(); |
1609 if (!page) | 1616 if (!page) |
1610 return; | 1617 return; |
1611 FloatSize elasticOverscroll = page->chromeClient().elasticOverscroll(); | 1618 FloatSize elasticOverscroll = page->chromeClient().elasticOverscroll(); |
1612 if (m_horizontalScrollbar) { | 1619 if (m_horizontalScrollbar) { |
1613 float delta = elasticOverscroll.width() - m_horizontalScrollbar->elastic Overscroll(); | 1620 float delta = elasticOverscroll.width() - m_horizontalScrollbar->elastic Overscroll(); |
1614 if (delta != 0) { | 1621 if (delta != 0) { |
1615 m_horizontalScrollbar->setElasticOverscroll(elasticOverscroll.width( )); | 1622 m_horizontalScrollbar->setElasticOverscroll(elasticOverscroll.width( )); |
(...skipping 1549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3165 ScrollableArea::didAddScrollbar(scrollbar, orientation); | 3172 ScrollableArea::didAddScrollbar(scrollbar, orientation); |
3166 } | 3173 } |
3167 | 3174 |
3168 void FrameView::setTopControlsViewportAdjustment(float adjustment) | 3175 void FrameView::setTopControlsViewportAdjustment(float adjustment) |
3169 { | 3176 { |
3170 m_topControlsViewportAdjustment = adjustment; | 3177 m_topControlsViewportAdjustment = adjustment; |
3171 } | 3178 } |
3172 | 3179 |
3173 IntPoint FrameView::maximumScrollPosition() const | 3180 IntPoint FrameView::maximumScrollPosition() const |
3174 { | 3181 { |
3182 IntPoint minimum = calculateMinimumScrollPosition(); | |
3183 IntPoint maximum = calculateMaximumScrollPosition().expandedTo(minimum); | |
3184 | |
3185 if (m_scrollAndScaleEmulator) | |
3186 return m_scrollAndScaleEmulator->applyFramePositionOverride(maximum).shr unkTo(maximum).expandedTo(minimum); | |
3187 | |
3188 return maximum; | |
3189 } | |
3190 | |
3191 IntPoint FrameView::calculateMaximumScrollPosition() const | |
3192 { | |
3175 // Make the same calculation as in CC's LayerImpl::MaxScrollOffset() | 3193 // 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. | 3194 // FIXME: We probably shouldn't be storing the bounds in a float. crbug.com/ 422331. |
3177 IntSize visibleSize = visibleContentSize(ExcludeScrollbars) + topControlsSiz e(); | 3195 IntSize visibleSize = visibleContentSize(ExcludeScrollbars) + topControlsSiz e(); |
3178 IntSize contentBounds = contentsSize(); | 3196 IntSize contentBounds = contentsSize(); |
3179 IntPoint maximumPosition = -scrollOrigin() + (contentBounds - visibleSize); | 3197 IntPoint maximumPosition = -scrollOrigin() + (contentBounds - visibleSize); |
3180 return maximumPosition.expandedTo(minimumScrollPosition()); | 3198 return maximumPosition; |
3181 } | 3199 } |
3182 | 3200 |
3183 void FrameView::addChild(Widget* child) | 3201 void FrameView::addChild(Widget* child) |
3184 { | 3202 { |
3185 ASSERT(child != this && !child->parent()); | 3203 ASSERT(child != this && !child->parent()); |
3186 child->setParent(this); | 3204 child->setParent(this); |
3187 m_children.add(child); | 3205 m_children.add(child); |
3188 } | 3206 } |
3189 | 3207 |
3190 void FrameView::setHasHorizontalScrollbar(bool hasBar) | 3208 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)); | 3307 return IntRect(flooredIntPoint(m_scrollPosition), visibleContentSize(scrollb arInclusion)); |
3290 } | 3308 } |
3291 | 3309 |
3292 IntSize FrameView::contentsSize() const | 3310 IntSize FrameView::contentsSize() const |
3293 { | 3311 { |
3294 return m_contentsSize; | 3312 return m_contentsSize; |
3295 } | 3313 } |
3296 | 3314 |
3297 IntPoint FrameView::minimumScrollPosition() const | 3315 IntPoint FrameView::minimumScrollPosition() const |
3298 { | 3316 { |
3317 IntPoint minimum = calculateMinimumScrollPosition(); | |
3318 | |
3319 if (m_scrollAndScaleEmulator) { | |
3320 IntPoint maximum = calculateMaximumScrollPosition().expandedTo(minimum); | |
bokan
2016/07/04 22:44:09
Move this outside this if and remove braces (make
Eric Seckler
2016/07/05 16:46:51
Done.
| |
3321 return m_scrollAndScaleEmulator->applyFramePositionOverride(minimum).shr unkTo(maximum).expandedTo(minimum); | |
3322 } | |
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 |