| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |