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 760 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
771 | 771 |
772 const FrameTree& tree = frame->tree(); | 772 const FrameTree& tree = frame->tree(); |
773 for (Frame* subFrame = tree.firstChild(); subFrame; subFrame = subFrame->tre e().nextSibling()) { | 773 for (Frame* subFrame = tree.firstChild(); subFrame; subFrame = subFrame->tre e().nextSibling()) { |
774 if (subFrame->isLocalFrame()) | 774 if (subFrame->isLocalFrame()) |
775 shouldHandleScrollGestureOnMainThreadRegion.unite(computeShouldHandl eScrollGestureOnMainThreadRegion(toLocalFrame(subFrame), offset)); | 775 shouldHandleScrollGestureOnMainThreadRegion.unite(computeShouldHandl eScrollGestureOnMainThreadRegion(toLocalFrame(subFrame), offset)); |
776 } | 776 } |
777 | 777 |
778 return shouldHandleScrollGestureOnMainThreadRegion; | 778 return shouldHandleScrollGestureOnMainThreadRegion; |
779 } | 779 } |
780 | 780 |
781 static void accumulateDocumentTouchEventTargetRects(LayerHitTestRects& rects, co nst Document* document) | 781 static void accumulateDocumentTouchEventTargetRects(LayerHitTestRects& rects, Do cument* document) |
782 { | 782 { |
783 ASSERT(document); | 783 ASSERT(document); |
784 if (!document->touchEventTargets()) | 784 if (!document->touchEventTargets()) |
785 return; | 785 return; |
786 | 786 |
787 const TouchEventTargetSet* targets = document->touchEventTargets(); | 787 const TouchEventTargetSet* targets = document->touchEventTargets(); |
788 | 788 |
789 // If there's a handler on the document, html or body element (fairly common in practice), | 789 // If there's a handler on the document, html or body element (fairly common in practice), |
790 // then we can quickly mark the entire document and skip looking at any othe r handlers. | 790 // then we can quickly mark the entire document and skip looking at any othe r handlers. |
791 // Note that technically a handler on the body doesn't cover the whole docum ent, but it's | 791 // Note that technically a handler on the body doesn't cover the whole docum ent, but it's |
792 // reasonable to be conservative and report the whole document anyway. | 792 // reasonable to be conservative and report the whole document anyway. |
793 for (TouchEventTargetSet::const_iterator iter = targets->begin(); iter != ta rgets->end(); ++iter) { | 793 // |
794 // Fullscreen HTML5 video on Android is implemented by replacing the root cc :layer with the | |
795 // video layer so doing this optimization causes the compositor to think tha t there are no | |
796 // handlers when in full screen therefore skip it. | |
797 bool inFullscreenOnAndroid = RuntimeEnabledFeatures::overlayFullscreenVideoE nabled() && RenderLayerCompositor::findFullscreenVideoRenderer(*document); | |
abarth-chromium
2014/06/07 09:06:03
It's inefficient to call findFullscreenVideoRender
| |
798 for (TouchEventTargetSet::const_iterator iter = targets->begin(); !inFullscr eenOnAndroid && iter != targets->end(); ++iter) { | |
794 Node* target = iter->key; | 799 Node* target = iter->key; |
795 if (target == document || target == document->documentElement() || targe t == document->body()) { | 800 if (target == document || target == document->documentElement() || targe t == document->body()) { |
796 if (RenderView* rendererView = document->renderView()) { | 801 if (RenderView* rendererView = document->renderView()) { |
797 rendererView->computeLayerHitTestRects(rects); | 802 rendererView->computeLayerHitTestRects(rects); |
798 } | 803 } |
799 return; | 804 return; |
800 } | 805 } |
801 } | 806 } |
802 | 807 |
803 for (TouchEventTargetSet::const_iterator iter = targets->begin(); iter != ta rgets->end(); ++iter) { | 808 for (TouchEventTargetSet::const_iterator iter = targets->begin(); iter != ta rgets->end(); ++iter) { |
804 const Node* target = iter->key; | 809 Node* target = iter->key; |
805 if (!target->inDocument()) | 810 if (!target->inDocument()) |
806 continue; | 811 continue; |
807 | 812 |
808 if (target->isDocumentNode()) { | 813 if (target->isDocumentNode() && target != document) { |
809 ASSERT(target != document); | |
810 accumulateDocumentTouchEventTargetRects(rects, toDocument(target)); | 814 accumulateDocumentTouchEventTargetRects(rects, toDocument(target)); |
811 } else if (RenderObject* renderer = target->renderer()) { | 815 } else if (RenderObject* renderer = target->renderer()) { |
812 // 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 |
813 // this node would be redundant. | 817 // this node would be redundant. |
814 bool hasTouchEventTargetAncestor = false; | 818 bool hasTouchEventTargetAncestor = false; |
815 for (Node* ancestor = target->parentNode(); ancestor && !hasTouchEve ntTargetAncestor; ancestor = ancestor->parentNode()) { | 819 for (Node* ancestor = target->parentNode(); ancestor && !hasTouchEve ntTargetAncestor; ancestor = ancestor->parentNode()) { |
816 if (targets->contains(ancestor)) | 820 if (targets->contains(ancestor)) |
817 hasTouchEventTargetAncestor = true; | 821 hasTouchEventTargetAncestor = true; |
818 } | 822 } |
819 if (!hasTouchEventTargetAncestor) { | 823 if (!hasTouchEventTargetAncestor) { |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
977 bool frameIsScrollable = frameView && frameView->isScrollable(); | 981 bool frameIsScrollable = frameView && frameView->isScrollable(); |
978 if (frameIsScrollable != m_wasFrameScrollable) | 982 if (frameIsScrollable != m_wasFrameScrollable) |
979 return true; | 983 return true; |
980 | 984 |
981 if (WebLayer* scrollLayer = frameView ? toWebLayer(frameView->layerForScroll ing()) : 0) | 985 if (WebLayer* scrollLayer = frameView ? toWebLayer(frameView->layerForScroll ing()) : 0) |
982 return blink::WebSize(frameView->contentsSize()) != scrollLayer->bounds( ); | 986 return blink::WebSize(frameView->contentsSize()) != scrollLayer->bounds( ); |
983 return false; | 987 return false; |
984 } | 988 } |
985 | 989 |
986 } // namespace WebCore | 990 } // namespace WebCore |
OLD | NEW |