Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(13)

Side by Side Diff: trunk/Source/core/page/scrolling/ScrollingCoordinator.cpp

Issue 391483002: Revert 177812 "Migrate touch events to EventHandlerRegistry" (Closed) Base URL: svn://svn.chromium.org/blink/
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « trunk/Source/core/page/EventHandler.cpp ('k') | trunk/Source/core/rendering/RenderObject.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 740 matching lines...) Expand 10 before | Expand all | Expand 10 after
751 if (subFrame->isLocalFrame()) 751 if (subFrame->isLocalFrame())
752 shouldHandleScrollGestureOnMainThreadRegion.unite(computeShouldHandl eScrollGestureOnMainThreadRegion(toLocalFrame(subFrame), offset)); 752 shouldHandleScrollGestureOnMainThreadRegion.unite(computeShouldHandl eScrollGestureOnMainThreadRegion(toLocalFrame(subFrame), offset));
753 } 753 }
754 754
755 return shouldHandleScrollGestureOnMainThreadRegion; 755 return shouldHandleScrollGestureOnMainThreadRegion;
756 } 756 }
757 757
758 static void accumulateDocumentTouchEventTargetRects(LayerHitTestRects& rects, co nst Document* document) 758 static void accumulateDocumentTouchEventTargetRects(LayerHitTestRects& rects, co nst Document* document)
759 { 759 {
760 ASSERT(document); 760 ASSERT(document);
761 const EventTargetSet* targets = document->frameHost()->eventHandlerRegistry( ).eventHandlerTargets(EventHandlerRegistry::TouchEvent); 761 if (!document->touchEventTargets())
762 if (!targets)
763 return; 762 return;
764 763
765 // If there's a handler on the window, document, html or body element (fairl y common in practice), 764 const TouchEventTargetSet* targets = document->touchEventTargets();
765
766 // If there's a handler on the document, html or body element (fairly common in practice),
766 // then we can quickly mark the entire document and skip looking at any othe r handlers. 767 // then we can quickly mark the entire document and skip looking at any othe r handlers.
767 // Note that technically a handler on the body doesn't cover the whole docum ent, but it's 768 // Note that technically a handler on the body doesn't cover the whole docum ent, but it's
768 // reasonable to be conservative and report the whole document anyway. 769 // reasonable to be conservative and report the whole document anyway.
769 // 770 //
770 // Fullscreen HTML5 video when OverlayFullscreenVideo is enabled is implemen ted by replacing the 771 // Fullscreen HTML5 video when OverlayFullscreenVideo is enabled is implemen ted by replacing the
771 // root cc::layer with the video layer so doing this optimization causes the compositor to think 772 // root cc::layer with the video layer so doing this optimization causes the compositor to think
772 // that there are no handlers, therefore skip it. 773 // that there are no handlers, therefore skip it.
773 if (!document->renderView()->compositor()->inOverlayFullscreenVideo()) { 774 if (!document->renderView()->compositor()->inOverlayFullscreenVideo()) {
774 for (EventTargetSet::const_iterator iter = targets->begin(); iter != tar gets->end(); ++iter) { 775 for (TouchEventTargetSet::const_iterator iter = targets->begin(); iter ! = targets->end(); ++iter) {
775 EventTarget* target = iter->key; 776 Node* target = iter->key;
776 Node* node = target->toNode(); 777 if (target == document || target == document->documentElement() || t arget == document->body()) {
777 if (target->toDOMWindow() || node == document || node == document->d ocumentElement() || node == document->body()) {
778 if (RenderView* rendererView = document->renderView()) { 778 if (RenderView* rendererView = document->renderView()) {
779 rendererView->computeLayerHitTestRects(rects); 779 rendererView->computeLayerHitTestRects(rects);
780 } 780 }
781 return; 781 return;
782 } 782 }
783 } 783 }
784 } 784 }
785 785
786 for (EventTargetSet::const_iterator iter = targets->begin(); iter != targets ->end(); ++iter) { 786 for (TouchEventTargetSet::const_iterator iter = targets->begin(); iter != ta rgets->end(); ++iter) {
787 EventTarget* target = iter->key; 787 const Node* target = iter->key;
788 Node* node = target->toNode(); 788 if (!target->inDocument())
789 if (!node || !node->inDocument())
790 continue; 789 continue;
791 790
792 if (node->isDocumentNode() && node != document) { 791 if (target->isDocumentNode() && target != document) {
793 accumulateDocumentTouchEventTargetRects(rects, toDocument(node)); 792 accumulateDocumentTouchEventTargetRects(rects, toDocument(target));
794 } else if (RenderObject* renderer = node->renderer()) { 793 } else if (RenderObject* renderer = target->renderer()) {
795 // If the set also contains one of our ancestor nodes then processin g 794 // If the set also contains one of our ancestor nodes then processin g
796 // this node would be redundant. 795 // this node would be redundant.
797 bool hasTouchEventTargetAncestor = false; 796 bool hasTouchEventTargetAncestor = false;
798 for (Node* ancestor = node->parentNode(); ancestor && !hasTouchEvent TargetAncestor; ancestor = ancestor->parentNode()) { 797 for (Node* ancestor = target->parentNode(); ancestor && !hasTouchEve ntTargetAncestor; ancestor = ancestor->parentNode()) {
799 if (targets->contains(ancestor)) 798 if (targets->contains(ancestor))
800 hasTouchEventTargetAncestor = true; 799 hasTouchEventTargetAncestor = true;
801 } 800 }
802 if (!hasTouchEventTargetAncestor) { 801 if (!hasTouchEventTargetAncestor) {
803 // Walk up the tree to the outermost non-composited scrollable l ayer. 802 // Walk up the tree to the outermost non-composited scrollable l ayer.
804 RenderLayer* enclosingNonCompositedScrollLayer = 0; 803 RenderLayer* enclosingNonCompositedScrollLayer = 0;
805 for (RenderLayer* parent = renderer->enclosingLayer(); parent && parent->compositingState() == NotComposited; parent = parent->parent()) { 804 for (RenderLayer* parent = renderer->enclosingLayer(); parent && parent->compositingState() == NotComposited; parent = parent->parent()) {
806 if (parent->scrollsOverflow()) 805 if (parent->scrollsOverflow())
807 enclosingNonCompositedScrollLayer = parent; 806 enclosingNonCompositedScrollLayer = parent;
808 } 807 }
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
962 bool frameIsScrollable = frameView && frameView->isScrollable(); 961 bool frameIsScrollable = frameView && frameView->isScrollable();
963 if (frameIsScrollable != m_wasFrameScrollable) 962 if (frameIsScrollable != m_wasFrameScrollable)
964 return true; 963 return true;
965 964
966 if (WebLayer* scrollLayer = frameView ? toWebLayer(frameView->layerForScroll ing()) : 0) 965 if (WebLayer* scrollLayer = frameView ? toWebLayer(frameView->layerForScroll ing()) : 0)
967 return blink::WebSize(frameView->contentsSize()) != scrollLayer->bounds( ); 966 return blink::WebSize(frameView->contentsSize()) != scrollLayer->bounds( );
968 return false; 967 return false;
969 } 968 }
970 969
971 } // namespace WebCore 970 } // namespace WebCore
OLDNEW
« no previous file with comments | « trunk/Source/core/page/EventHandler.cpp ('k') | trunk/Source/core/rendering/RenderObject.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698