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

Side by Side Diff: LayoutTests/editing/selection/script-tests/click-outside-editable-div.js

Issue 15508003: Revert "Don't force layout for mouse event hit tests" (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 7 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
OLDNEW
1 description("Ensure that clicking in the margins around editable divs does not g rant focus.") 1 description("Ensure that clicking in the margins around editable divs does not g rant focus.")
2 2
3 document.body.style.margin = "20px"; 3 document.body.style.margin = "20px";
4 4
5 var outerDiv = document.createElement("div"); 5 var outerDiv = document.createElement("div");
6 outerDiv.style.cssText = "width: 100px; padding: 100px; background-color: blue;" ; 6 outerDiv.style.cssText = "width: 100px; padding: 100px; background-color: blue;" ;
7 var innerDiv = document.createElement("div"); 7 var innerDiv = document.createElement("div");
8 innerDiv.style.cssText = "height: 100px; border: 1px solid pink; background-colo r: green;"; 8 innerDiv.style.cssText = "height: 100px; border: 1px solid pink; background-colo r: green;";
9 innerDiv.contentEditable = true; 9 innerDiv.contentEditable = true;
10 outerDiv.appendChild(innerDiv); 10 outerDiv.appendChild(innerDiv);
11 document.body.insertBefore(outerDiv, document.body.firstChild); 11 document.body.insertBefore(outerDiv, document.body.firstChild);
12 12
13 // Mouse events only work after an initial layout
14 document.body.offsetLeft;
15
16 var lastClickCausedFocus = false; 13 var lastClickCausedFocus = false;
17 document.documentElement.addEventListener("mouseup", function(e) { 14 document.documentElement.addEventListener("mouseup", function(e) {
18 var lastClick = e || window.event; 15 var lastClick = e || window.event;
19 if (lastClickCausedFocus) { 16 if (lastClickCausedFocus) {
20 testFailed("Click @ " + lastClick.clientX + ", " + lastClick.clientY + " caused innerdiv to focus!"); 17 testFailed("Click @ " + lastClick.clientX + ", " + lastClick.clientY + " caused innerdiv to focus!");
21 } else { 18 } else {
22 testPassed("Click @ " + lastClick.clientX + ", " + lastClick.clientY + " did not cause focus."); 19 testPassed("Click @ " + lastClick.clientX + ", " + lastClick.clientY + " did not cause focus.");
23 } 20 }
24 innerDiv.blur(); 21 innerDiv.blur();
25 lastClickCausedFocus = false; 22 lastClickCausedFocus = false;
(...skipping 17 matching lines...) Expand all
43 40
44 clickAt(70, 270); 41 clickAt(70, 270);
45 clickAt(170, 270); 42 clickAt(170, 270);
46 clickAt(270, 270); 43 clickAt(270, 270);
47 } else { 44 } else {
48 debug("To test, cick above and to the left of the blue box, then above it, t hen to the left " + 45 debug("To test, cick above and to the left of the blue box, then above it, t hen to the left " +
49 "of it and finally, click in all 8 regions around the green div."); 46 "of it and finally, click in all 8 regions around the green div.");
50 } 47 }
51 48
52 var successfullyParsed = true; 49 var successfullyParsed = true;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698