| 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 761 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 772 if (subFrame->isLocalFrame()) | 772 if (subFrame->isLocalFrame()) |
| 773 shouldHandleScrollGestureOnMainThreadRegion.unite(computeShouldHandl
eScrollGestureOnMainThreadRegion(toLocalFrame(subFrame), offset)); | 773 shouldHandleScrollGestureOnMainThreadRegion.unite(computeShouldHandl
eScrollGestureOnMainThreadRegion(toLocalFrame(subFrame), offset)); |
| 774 } | 774 } |
| 775 | 775 |
| 776 return shouldHandleScrollGestureOnMainThreadRegion; | 776 return shouldHandleScrollGestureOnMainThreadRegion; |
| 777 } | 777 } |
| 778 | 778 |
| 779 static void accumulateDocumentTouchEventTargetRects(LayerHitTestRects& rects, co
nst Document* document) | 779 static void accumulateDocumentTouchEventTargetRects(LayerHitTestRects& rects, co
nst Document* document) |
| 780 { | 780 { |
| 781 ASSERT(document); | 781 ASSERT(document); |
| 782 if (!document->touchEventTargets()) | 782 const EventTargetSet* targets = document->frameHost()->eventHandlerRegistry(
).eventHandlerTargets(EventHandlerRegistry::TouchEvent); |
| 783 if (!targets) |
| 783 return; | 784 return; |
| 784 | 785 |
| 785 const TouchEventTargetSet* targets = document->touchEventTargets(); | 786 // If there's a handler on the window, document, html or body element (fairl
y common in practice), |
| 786 | |
| 787 // If there's a handler on the document, html or body element (fairly common
in practice), | |
| 788 // then we can quickly mark the entire document and skip looking at any othe
r handlers. | 787 // then we can quickly mark the entire document and skip looking at any othe
r handlers. |
| 789 // Note that technically a handler on the body doesn't cover the whole docum
ent, but it's | 788 // Note that technically a handler on the body doesn't cover the whole docum
ent, but it's |
| 790 // reasonable to be conservative and report the whole document anyway. | 789 // reasonable to be conservative and report the whole document anyway. |
| 791 // | 790 // |
| 792 // Fullscreen HTML5 video when OverlayFullscreenVideo is enabled is implemen
ted by replacing the | 791 // Fullscreen HTML5 video when OverlayFullscreenVideo is enabled is implemen
ted by replacing the |
| 793 // root cc::layer with the video layer so doing this optimization causes the
compositor to think | 792 // root cc::layer with the video layer so doing this optimization causes the
compositor to think |
| 794 // that there are no handlers, therefore skip it. | 793 // that there are no handlers, therefore skip it. |
| 795 if (!document->renderView()->compositor()->inOverlayFullscreenVideo()) { | 794 if (!document->renderView()->compositor()->inOverlayFullscreenVideo()) { |
| 796 for (TouchEventTargetSet::const_iterator iter = targets->begin(); iter !
= targets->end(); ++iter) { | 795 for (EventTargetSet::const_iterator iter = targets->begin(); iter != tar
gets->end(); ++iter) { |
| 797 Node* target = iter->key; | 796 EventTarget* target = iter->key; |
| 798 if (target == document || target == document->documentElement() || t
arget == document->body()) { | 797 Node* node = target->toNode(); |
| 798 if (target->toDOMWindow() || node == document || node == document->d
ocumentElement() || node == document->body()) { |
| 799 if (RenderView* rendererView = document->renderView()) { | 799 if (RenderView* rendererView = document->renderView()) { |
| 800 rendererView->computeLayerHitTestRects(rects); | 800 rendererView->computeLayerHitTestRects(rects); |
| 801 } | 801 } |
| 802 return; | 802 return; |
| 803 } | 803 } |
| 804 } | 804 } |
| 805 } | 805 } |
| 806 | 806 |
| 807 for (TouchEventTargetSet::const_iterator iter = targets->begin(); iter != ta
rgets->end(); ++iter) { | 807 for (EventTargetSet::const_iterator iter = targets->begin(); iter != targets
->end(); ++iter) { |
| 808 const Node* target = iter->key; | 808 EventTarget* target = iter->key; |
| 809 if (!target->inDocument()) | 809 Node* node = target->toNode(); |
| 810 if (!node || !node->inDocument()) |
| 810 continue; | 811 continue; |
| 811 | 812 |
| 812 if (target->isDocumentNode() && target != document) { | 813 if (node->isDocumentNode() && node != document) { |
| 813 accumulateDocumentTouchEventTargetRects(rects, toDocument(target)); | 814 accumulateDocumentTouchEventTargetRects(rects, toDocument(node)); |
| 814 } else if (RenderObject* renderer = target->renderer()) { | 815 } else if (RenderObject* renderer = node->renderer()) { |
| 815 // If the set also contains one of our ancestor nodes then processin
g | 816 // If the set also contains one of our ancestor nodes then processin
g |
| 816 // this node would be redundant. | 817 // this node would be redundant. |
| 817 bool hasTouchEventTargetAncestor = false; | 818 bool hasTouchEventTargetAncestor = false; |
| 818 for (Node* ancestor = target->parentNode(); ancestor && !hasTouchEve
ntTargetAncestor; ancestor = ancestor->parentNode()) { | 819 for (Node* ancestor = node->parentNode(); ancestor && !hasTouchEvent
TargetAncestor; ancestor = ancestor->parentNode()) { |
| 819 if (targets->contains(ancestor)) | 820 if (targets->contains(ancestor)) |
| 820 hasTouchEventTargetAncestor = true; | 821 hasTouchEventTargetAncestor = true; |
| 821 } | 822 } |
| 822 if (!hasTouchEventTargetAncestor) { | 823 if (!hasTouchEventTargetAncestor) { |
| 823 // Walk up the tree to the outermost non-composited scrollable l
ayer. | 824 // Walk up the tree to the outermost non-composited scrollable l
ayer. |
| 824 RenderLayer* enclosingNonCompositedScrollLayer = 0; | 825 RenderLayer* enclosingNonCompositedScrollLayer = 0; |
| 825 for (RenderLayer* parent = renderer->enclosingLayer(); parent &&
parent->compositingState() == NotComposited; parent = parent->parent()) { | 826 for (RenderLayer* parent = renderer->enclosingLayer(); parent &&
parent->compositingState() == NotComposited; parent = parent->parent()) { |
| 826 if (parent->scrollsOverflow()) | 827 if (parent->scrollsOverflow()) |
| 827 enclosingNonCompositedScrollLayer = parent; | 828 enclosingNonCompositedScrollLayer = parent; |
| 828 } | 829 } |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 982 bool frameIsScrollable = frameView && frameView->isScrollable(); | 983 bool frameIsScrollable = frameView && frameView->isScrollable(); |
| 983 if (frameIsScrollable != m_wasFrameScrollable) | 984 if (frameIsScrollable != m_wasFrameScrollable) |
| 984 return true; | 985 return true; |
| 985 | 986 |
| 986 if (WebLayer* scrollLayer = frameView ? toWebLayer(frameView->layerForScroll
ing()) : 0) | 987 if (WebLayer* scrollLayer = frameView ? toWebLayer(frameView->layerForScroll
ing()) : 0) |
| 987 return blink::WebSize(frameView->contentsSize()) != scrollLayer->bounds(
); | 988 return blink::WebSize(frameView->contentsSize()) != scrollLayer->bounds(
); |
| 988 return false; | 989 return false; |
| 989 } | 990 } |
| 990 | 991 |
| 991 } // namespace WebCore | 992 } // namespace WebCore |
| OLD | NEW |