| 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 729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 740 if (subFrame->isLocalFrame()) | 740 if (subFrame->isLocalFrame()) |
| 741 shouldHandleScrollGestureOnMainThreadRegion.unite(computeShouldHandl
eScrollGestureOnMainThreadRegion(toLocalFrame(subFrame), offset)); | 741 shouldHandleScrollGestureOnMainThreadRegion.unite(computeShouldHandl
eScrollGestureOnMainThreadRegion(toLocalFrame(subFrame), offset)); |
| 742 } | 742 } |
| 743 | 743 |
| 744 return shouldHandleScrollGestureOnMainThreadRegion; | 744 return shouldHandleScrollGestureOnMainThreadRegion; |
| 745 } | 745 } |
| 746 | 746 |
| 747 static void accumulateDocumentTouchEventTargetRects(LayerHitTestRects& rects, co
nst Document* document) | 747 static void accumulateDocumentTouchEventTargetRects(LayerHitTestRects& rects, co
nst Document* document) |
| 748 { | 748 { |
| 749 ASSERT(document); | 749 ASSERT(document); |
| 750 if (!document->touchEventTargets()) | 750 const EventTargetSet* targets = document->frameHost()->eventHandlerRegistry(
).eventHandlerTargets(EventHandlerRegistry::TouchEvent); |
| 751 if (!targets) |
| 751 return; | 752 return; |
| 752 | 753 |
| 753 const TouchEventTargetSet* targets = document->touchEventTargets(); | 754 // If there's a handler on the window, document, html or body element (fairl
y common in practice), |
| 754 | |
| 755 // If there's a handler on the document, html or body element (fairly common
in practice), | |
| 756 // then we can quickly mark the entire document and skip looking at any othe
r handlers. | 755 // then we can quickly mark the entire document and skip looking at any othe
r handlers. |
| 757 // Note that technically a handler on the body doesn't cover the whole docum
ent, but it's | 756 // Note that technically a handler on the body doesn't cover the whole docum
ent, but it's |
| 758 // reasonable to be conservative and report the whole document anyway. | 757 // reasonable to be conservative and report the whole document anyway. |
| 759 // | 758 // |
| 760 // Fullscreen HTML5 video when OverlayFullscreenVideo is enabled is implemen
ted by replacing the | 759 // Fullscreen HTML5 video when OverlayFullscreenVideo is enabled is implemen
ted by replacing the |
| 761 // root cc::layer with the video layer so doing this optimization causes the
compositor to think | 760 // root cc::layer with the video layer so doing this optimization causes the
compositor to think |
| 762 // that there are no handlers, therefore skip it. | 761 // that there are no handlers, therefore skip it. |
| 763 if (!document->renderView()->compositor()->inOverlayFullscreenVideo()) { | 762 if (!document->renderView()->compositor()->inOverlayFullscreenVideo()) { |
| 764 for (TouchEventTargetSet::const_iterator iter = targets->begin(); iter !
= targets->end(); ++iter) { | 763 for (EventTargetSet::const_iterator iter = targets->begin(); iter != tar
gets->end(); ++iter) { |
| 765 Node* target = iter->key; | 764 EventTarget* target = iter->key; |
| 766 if (target == document || target == document->documentElement() || t
arget == document->body()) { | 765 Node* node = target->toNode(); |
| 766 if (target->toDOMWindow() || node == document || node == document->d
ocumentElement() || node == document->body()) { |
| 767 if (RenderView* rendererView = document->renderView()) { | 767 if (RenderView* rendererView = document->renderView()) { |
| 768 rendererView->computeLayerHitTestRects(rects); | 768 rendererView->computeLayerHitTestRects(rects); |
| 769 } | 769 } |
| 770 return; | 770 return; |
| 771 } | 771 } |
| 772 } | 772 } |
| 773 } | 773 } |
| 774 | 774 |
| 775 for (TouchEventTargetSet::const_iterator iter = targets->begin(); iter != ta
rgets->end(); ++iter) { | 775 for (EventTargetSet::const_iterator iter = targets->begin(); iter != targets
->end(); ++iter) { |
| 776 const Node* target = iter->key; | 776 EventTarget* target = iter->key; |
| 777 if (!target->inDocument()) | 777 Node* node = target->toNode(); |
| 778 if (!node || !node->inDocument()) |
| 778 continue; | 779 continue; |
| 779 | 780 |
| 780 if (target->isDocumentNode() && target != document) { | 781 if (node->isDocumentNode() && node != document) { |
| 781 accumulateDocumentTouchEventTargetRects(rects, toDocument(target)); | 782 accumulateDocumentTouchEventTargetRects(rects, toDocument(node)); |
| 782 } else if (RenderObject* renderer = target->renderer()) { | 783 } else if (RenderObject* renderer = node->renderer()) { |
| 783 // If the set also contains one of our ancestor nodes then processin
g | 784 // If the set also contains one of our ancestor nodes then processin
g |
| 784 // this node would be redundant. | 785 // this node would be redundant. |
| 785 bool hasTouchEventTargetAncestor = false; | 786 bool hasTouchEventTargetAncestor = false; |
| 786 for (Node* ancestor = target->parentNode(); ancestor && !hasTouchEve
ntTargetAncestor; ancestor = ancestor->parentNode()) { | 787 for (Node* ancestor = node->parentNode(); ancestor && !hasTouchEvent
TargetAncestor; ancestor = ancestor->parentNode()) { |
| 787 if (targets->contains(ancestor)) | 788 if (targets->contains(ancestor)) |
| 788 hasTouchEventTargetAncestor = true; | 789 hasTouchEventTargetAncestor = true; |
| 789 } | 790 } |
| 790 if (!hasTouchEventTargetAncestor) { | 791 if (!hasTouchEventTargetAncestor) { |
| 791 // Walk up the tree to the outermost non-composited scrollable l
ayer. | 792 // Walk up the tree to the outermost non-composited scrollable l
ayer. |
| 792 RenderLayer* enclosingNonCompositedScrollLayer = 0; | 793 RenderLayer* enclosingNonCompositedScrollLayer = 0; |
| 793 for (RenderLayer* parent = renderer->enclosingLayer(); parent &&
parent->compositingState() == NotComposited; parent = parent->parent()) { | 794 for (RenderLayer* parent = renderer->enclosingLayer(); parent &&
parent->compositingState() == NotComposited; parent = parent->parent()) { |
| 794 if (parent->scrollsOverflow()) | 795 if (parent->scrollsOverflow()) |
| 795 enclosingNonCompositedScrollLayer = parent; | 796 enclosingNonCompositedScrollLayer = parent; |
| 796 } | 797 } |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 946 bool frameIsScrollable = frameView && frameView->isScrollable(); | 947 bool frameIsScrollable = frameView && frameView->isScrollable(); |
| 947 if (frameIsScrollable != m_wasFrameScrollable) | 948 if (frameIsScrollable != m_wasFrameScrollable) |
| 948 return true; | 949 return true; |
| 949 | 950 |
| 950 if (WebLayer* scrollLayer = frameView ? toWebLayer(frameView->layerForScroll
ing()) : 0) | 951 if (WebLayer* scrollLayer = frameView ? toWebLayer(frameView->layerForScroll
ing()) : 0) |
| 951 return blink::WebSize(frameView->contentsSize()) != scrollLayer->bounds(
); | 952 return blink::WebSize(frameView->contentsSize()) != scrollLayer->bounds(
); |
| 952 return false; | 953 return false; |
| 953 } | 954 } |
| 954 | 955 |
| 955 } // namespace blink | 956 } // namespace blink |
| OLD | NEW |