OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2011 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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 , m_shouldScrollOnMainThreadDirty(false) | 91 , m_shouldScrollOnMainThreadDirty(false) |
92 , m_wasFrameScrollable(false) | 92 , m_wasFrameScrollable(false) |
93 , m_lastMainThreadScrollingReasons(0) | 93 , m_lastMainThreadScrollingReasons(0) |
94 { | 94 { |
95 } | 95 } |
96 | 96 |
97 ScrollingCoordinator::~ScrollingCoordinator() | 97 ScrollingCoordinator::~ScrollingCoordinator() |
98 { | 98 { |
99 } | 99 } |
100 | 100 |
101 bool ScrollingCoordinator::touchHitTestingEnabled() const | |
102 { | |
103 if (!m_page->mainFrame()->isLocalFrame()) | |
104 return false; | |
105 RenderView* contentRenderer = m_page->deprecatedLocalMainFrame()->contentRen
derer(); | |
106 Settings* settings = m_page->mainFrame()->settings(); | |
107 return RuntimeEnabledFeatures::touchEnabled() && settings->compositorTouchHi
tTesting() && contentRenderer && contentRenderer->usesCompositing(); | |
108 } | |
109 | |
110 void ScrollingCoordinator::setShouldHandleScrollGestureOnMainThreadRegion(const
Region& region) | 101 void ScrollingCoordinator::setShouldHandleScrollGestureOnMainThreadRegion(const
Region& region) |
111 { | 102 { |
112 if (!m_page->mainFrame()->isLocalFrame()) | 103 if (!m_page->mainFrame()->isLocalFrame()) |
113 return; | 104 return; |
114 if (WebLayer* scrollLayer = toWebLayer(m_page->deprecatedLocalMainFrame()->v
iew()->layerForScrolling())) { | 105 if (WebLayer* scrollLayer = toWebLayer(m_page->deprecatedLocalMainFrame()->v
iew()->layerForScrolling())) { |
115 Vector<IntRect> rects = region.rects(); | 106 Vector<IntRect> rects = region.rects(); |
116 WebVector<WebRect> webRects(rects.size()); | 107 WebVector<WebRect> webRects(rects.size()); |
117 for (size_t i = 0; i < rects.size(); ++i) | 108 for (size_t i = 0; i < rects.size(); ++i) |
118 webRects[i] = rects[i]; | 109 webRects[i] = rects[i]; |
119 scrollLayer->setNonFastScrollableRegion(webRects); | 110 scrollLayer->setNonFastScrollableRegion(webRects); |
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
519 geometryMap.pushMappingsToAncestor(rootLayer, 0); | 510 geometryMap.pushMappingsToAncestor(rootLayer, 0); |
520 LayerFrameMap layerChildFrameMap; | 511 LayerFrameMap layerChildFrameMap; |
521 makeLayerChildFrameMap(mainFrame, &layerChildFrameMap); | 512 makeLayerChildFrameMap(mainFrame, &layerChildFrameMap); |
522 projectRectsToGraphicsLayerSpaceRecursive(rootLayer, layerRects, graphicsRec
ts, geometryMap, layersWithRects, layerChildFrameMap); | 513 projectRectsToGraphicsLayerSpaceRecursive(rootLayer, layerRects, graphicsRec
ts, geometryMap, layersWithRects, layerChildFrameMap); |
523 } | 514 } |
524 | 515 |
525 void ScrollingCoordinator::updateTouchEventTargetRectsIfNeeded() | 516 void ScrollingCoordinator::updateTouchEventTargetRectsIfNeeded() |
526 { | 517 { |
527 TRACE_EVENT0("input", "ScrollingCoordinator::updateTouchEventTargetRectsIfNe
eded"); | 518 TRACE_EVENT0("input", "ScrollingCoordinator::updateTouchEventTargetRectsIfNe
eded"); |
528 | 519 |
529 if (!touchHitTestingEnabled()) | 520 if (!RuntimeEnabledFeatures::touchEnabled()) |
530 return; | 521 return; |
531 | 522 |
532 LayerHitTestRects touchEventTargetRects; | 523 LayerHitTestRects touchEventTargetRects; |
533 computeTouchEventTargetRects(touchEventTargetRects); | 524 computeTouchEventTargetRects(touchEventTargetRects); |
534 setTouchEventTargetRects(touchEventTargetRects); | 525 setTouchEventTargetRects(touchEventTargetRects); |
535 } | 526 } |
536 | 527 |
537 void ScrollingCoordinator::reset() | 528 void ScrollingCoordinator::reset() |
538 { | 529 { |
539 for (ScrollbarMap::iterator it = m_horizontalScrollbars.begin(); it != m_hor
izontalScrollbars.end(); ++it) | 530 for (ScrollbarMap::iterator it = m_horizontalScrollbars.begin(); it != m_hor
izontalScrollbars.end(); ++it) |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
583 const GraphicsLayer* graphicsLayer = iter->key; | 574 const GraphicsLayer* graphicsLayer = iter->key; |
584 WebVector<WebRect> webRects(iter->value.size()); | 575 WebVector<WebRect> webRects(iter->value.size()); |
585 for (size_t i = 0; i < iter->value.size(); ++i) | 576 for (size_t i = 0; i < iter->value.size(); ++i) |
586 webRects[i] = enclosingIntRect(iter->value[i]); | 577 webRects[i] = enclosingIntRect(iter->value[i]); |
587 graphicsLayer->platformLayer()->setTouchEventHandlerRegion(webRects); | 578 graphicsLayer->platformLayer()->setTouchEventHandlerRegion(webRects); |
588 } | 579 } |
589 } | 580 } |
590 | 581 |
591 void ScrollingCoordinator::touchEventTargetRectsDidChange() | 582 void ScrollingCoordinator::touchEventTargetRectsDidChange() |
592 { | 583 { |
593 if (!touchHitTestingEnabled()) | 584 if (!RuntimeEnabledFeatures::touchEnabled()) |
594 return; | 585 return; |
595 | 586 |
596 // Wait until after layout to update. | 587 // Wait until after layout to update. |
597 if (!m_page->deprecatedLocalMainFrame()->view() || m_page->deprecatedLocalMa
inFrame()->view()->needsLayout()) | 588 if (!m_page->deprecatedLocalMainFrame()->view() || m_page->deprecatedLocalMa
inFrame()->view()->needsLayout()) |
598 return; | 589 return; |
599 | 590 |
600 // FIXME: scheduleAnimation() is just a method of forcing the compositor to
realize that it | 591 // FIXME: scheduleAnimation() is just a method of forcing the compositor to
realize that it |
601 // needs to commit here. We should expose a cleaner API for this. | 592 // needs to commit here. We should expose a cleaner API for this. |
602 RenderView* renderView = m_page->deprecatedLocalMainFrame()->contentRenderer
(); | 593 RenderView* renderView = m_page->deprecatedLocalMainFrame()->contentRenderer
(); |
603 if (renderView && renderView->compositor() && renderView->compositor()->stal
eInCompositingMode()) | 594 if (renderView && renderView->compositor() && renderView->compositor()->stal
eInCompositingMode()) |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
815 renderer->computeLayerHitTestRects(rects); | 806 renderer->computeLayerHitTestRects(rects); |
816 } | 807 } |
817 } | 808 } |
818 } | 809 } |
819 | 810 |
820 } | 811 } |
821 | 812 |
822 void ScrollingCoordinator::computeTouchEventTargetRects(LayerHitTestRects& rects
) | 813 void ScrollingCoordinator::computeTouchEventTargetRects(LayerHitTestRects& rects
) |
823 { | 814 { |
824 TRACE_EVENT0("input", "ScrollingCoordinator::computeTouchEventTargetRects"); | 815 TRACE_EVENT0("input", "ScrollingCoordinator::computeTouchEventTargetRects"); |
825 ASSERT(touchHitTestingEnabled()); | 816 ASSERT(RuntimeEnabledFeatures::touchEnabled()); |
826 | 817 |
827 Document* document = m_page->deprecatedLocalMainFrame()->document(); | 818 Document* document = m_page->deprecatedLocalMainFrame()->document(); |
828 if (!document || !document->view()) | 819 if (!document || !document->view()) |
829 return; | 820 return; |
830 | 821 |
831 accumulateDocumentTouchEventTargetRects(rects, document); | 822 accumulateDocumentTouchEventTargetRects(rects, document); |
832 } | 823 } |
833 | 824 |
834 void ScrollingCoordinator::frameViewHasSlowRepaintObjectsDidChange(FrameView* fr
ameView) | 825 void ScrollingCoordinator::frameViewHasSlowRepaintObjectsDidChange(FrameView* fr
ameView) |
835 { | 826 { |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
959 bool frameIsScrollable = frameView && frameView->isScrollable(); | 950 bool frameIsScrollable = frameView && frameView->isScrollable(); |
960 if (frameIsScrollable != m_wasFrameScrollable) | 951 if (frameIsScrollable != m_wasFrameScrollable) |
961 return true; | 952 return true; |
962 | 953 |
963 if (WebLayer* scrollLayer = frameView ? toWebLayer(frameView->layerForScroll
ing()) : 0) | 954 if (WebLayer* scrollLayer = frameView ? toWebLayer(frameView->layerForScroll
ing()) : 0) |
964 return blink::WebSize(frameView->contentsSize()) != scrollLayer->bounds(
); | 955 return blink::WebSize(frameView->contentsSize()) != scrollLayer->bounds(
); |
965 return false; | 956 return false; |
966 } | 957 } |
967 | 958 |
968 } // namespace WebCore | 959 } // namespace WebCore |
OLD | NEW |