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

Side by Side Diff: third_party/WebKit/Source/web/tests/FrameThrottlingTest.cpp

Issue 2127163002: Limit PassiveDocumentEventListeners to touch and make it experimental (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "bindings/core/v8/ScriptController.h" 5 #include "bindings/core/v8/ScriptController.h"
6 #include "core/dom/Document.h" 6 #include "core/dom/Document.h"
7 #include "core/dom/Element.h" 7 #include "core/dom/Element.h"
8 #include "core/frame/FrameView.h" 8 #include "core/frame/FrameView.h"
9 #include "core/frame/LocalFrame.h" 9 #include "core/frame/LocalFrame.h"
10 #include "core/html/HTMLIFrameElement.h" 10 #include "core/html/HTMLIFrameElement.h"
(...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after
626 626
627 // Create a frame which is throttled and has two different types of 627 // Create a frame which is throttled and has two different types of
628 // top-level touchstart handlers. 628 // top-level touchstart handlers.
629 SimRequest mainResource("https://example.com/", "text/html"); 629 SimRequest mainResource("https://example.com/", "text/html");
630 SimRequest frameResource("https://example.com/iframe.html", "text/html"); 630 SimRequest frameResource("https://example.com/iframe.html", "text/html");
631 631
632 loadURL("https://example.com/"); 632 loadURL("https://example.com/");
633 mainResource.complete("<iframe id=frame sandbox=allow-scripts src=iframe.htm l></iframe>"); 633 mainResource.complete("<iframe id=frame sandbox=allow-scripts src=iframe.htm l></iframe>");
634 frameResource.complete( 634 frameResource.complete(
635 "<script>" 635 "<script>"
636 "window.addEventListener('touchstart', function(){});" 636 "window.addEventListener('touchstart', function(){}, {passive: false});"
637 "document.addEventListener('touchstart', function(){});" 637 "document.addEventListener('touchstart', function(){}, {passive: false}) ;"
638 "</script>"); 638 "</script>");
639 auto* frameElement = toHTMLIFrameElement(document().getElementById("frame")) ; 639 auto* frameElement = toHTMLIFrameElement(document().getElementById("frame")) ;
640 frameElement->setAttribute(styleAttr, "transform: translateY(480px)"); 640 frameElement->setAttribute(styleAttr, "transform: translateY(480px)");
641 compositeFrame(); // Throttle the frame. 641 compositeFrame(); // Throttle the frame.
642 compositeFrame(); // Update touch handler regions. 642 compositeFrame(); // Update touch handler regions.
643 643
644 // The touch handlers in the throttled frame should have been ignored. 644 // The touch handlers in the throttled frame should have been ignored.
645 EXPECT_EQ(0u, touchHandlerRegionSize()); 645 EXPECT_EQ(0u, touchHandlerRegionSize());
646 646
647 // Unthrottling the frame makes the touch handlers active again. Note that 647 // Unthrottling the frame makes the touch handlers active again. Note that
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
845 localFrame->script().executeScriptInMainWorld( 845 localFrame->script().executeScriptInMainWorld(
846 "window.requestAnimationFrame(function() {\n" 846 "window.requestAnimationFrame(function() {\n"
847 " var throttledFrame = window.parent.frames.first;\n" 847 " var throttledFrame = window.parent.frames.first;\n"
848 " throttledFrame.document.documentElement.style = 'margin: 50px';\n" 848 " throttledFrame.document.documentElement.style = 'margin: 50px';\n"
849 " throttledFrame.document.querySelector('#d').getBoundingClientRect();\ n" 849 " throttledFrame.document.querySelector('#d').getBoundingClientRect();\ n"
850 "});\n"); 850 "});\n");
851 compositeFrame(); 851 compositeFrame();
852 } 852 }
853 853
854 } // namespace blink 854 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698