зеркало из https://github.com/mozilla/gecko-dev.git
Bug 960889 - Monocles moving when swiping up/down through gmail email draft. r=jimm
This commit is contained in:
Родитель
1400aea7fe
Коммит
07a162728d
|
@ -300,12 +300,18 @@ var SelectionHandler = {
|
|||
* Called any time SelectionHelperUI would like us to
|
||||
* recalculate the selection bounds.
|
||||
*/
|
||||
_onSelectionUpdate: function _onSelectionUpdate() {
|
||||
_onSelectionUpdate: function _onSelectionUpdate(aMsg) {
|
||||
if (!this._contentWindow) {
|
||||
this._onFail("_onSelectionUpdate was called without proper view set up");
|
||||
return;
|
||||
}
|
||||
|
||||
if (aMsg && aMsg.isInitiatedByAPZC) {
|
||||
let {offset: offset} = Content.getCurrentWindowAndOffset(
|
||||
this._targetCoordinates.x, this._targetCoordinates.y);
|
||||
this._contentOffset = offset;
|
||||
}
|
||||
|
||||
// Update the position of our selection monocles
|
||||
this._updateSelectionUI("update", true, true);
|
||||
},
|
||||
|
@ -387,6 +393,7 @@ var SelectionHandler = {
|
|||
this._contentOffset = null;
|
||||
this._domWinUtils = null;
|
||||
this._targetIsEditable = false;
|
||||
this._targetCoordinates = null;
|
||||
sendSyncMessage("Content:HandlerShutdown", {});
|
||||
},
|
||||
|
||||
|
@ -409,6 +416,11 @@ var SelectionHandler = {
|
|||
this._contentOffset = offset;
|
||||
this._domWinUtils = utils;
|
||||
this._targetIsEditable = Util.isEditable(this._targetElement);
|
||||
this._targetCoordinates = {
|
||||
x: aX,
|
||||
y: aY
|
||||
};
|
||||
|
||||
return true;
|
||||
},
|
||||
|
||||
|
@ -533,7 +545,7 @@ var SelectionHandler = {
|
|||
break;
|
||||
|
||||
case "Browser:SelectionUpdate":
|
||||
this._onSelectionUpdate();
|
||||
this._onSelectionUpdate(json);
|
||||
break;
|
||||
|
||||
case "Browser:RepositionInfoRequest":
|
||||
|
|
|
@ -361,7 +361,9 @@ var SelectionHelperUI = {
|
|||
// clears the selection.
|
||||
if (this.isActive && this.layerMode == kContentLayer) {
|
||||
this._showAfterUpdate = true;
|
||||
this._sendAsyncMessage("Browser:SelectionUpdate", {});
|
||||
this._sendAsyncMessage("Browser:SelectionUpdate", {
|
||||
isInitiatedByAPZC: true
|
||||
});
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<style>
|
||||
body {
|
||||
padding: 40px;
|
||||
}
|
||||
|
||||
.scrollable-container {
|
||||
border: 1px solid blue;
|
||||
overflow: auto;
|
||||
max-height: 100px;
|
||||
width: 200px;
|
||||
}
|
||||
|
||||
.internal-frame {
|
||||
display:block;
|
||||
padding: 0px;
|
||||
width: 150px;
|
||||
visibility: visible;
|
||||
height: 150px;
|
||||
border: 1px solid red;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="scrollable-container">
|
||||
<iframe id="frame1" src="res/documentindesignmode.html" tabindex="1" frameborder="0"
|
||||
class="internal-frame">
|
||||
</iframe>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,79 @@
|
|||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=2 et sw=2 tw=80: */
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
"use strict";
|
||||
|
||||
let gWindow = null;
|
||||
var gFrame = null;
|
||||
|
||||
function setUpAndTearDown() {
|
||||
emptyClipboard();
|
||||
|
||||
if (gWindow) {
|
||||
clearSelection(gWindow);
|
||||
}
|
||||
|
||||
if (gFrame) {
|
||||
clearSelection(gFrame);
|
||||
}
|
||||
|
||||
yield waitForCondition(function () {
|
||||
return !SelectionHelperUI.isSelectionUIVisible;
|
||||
});
|
||||
|
||||
InputSourceHelper.isPrecise = false;
|
||||
InputSourceHelper.fireUpdate();
|
||||
}
|
||||
|
||||
gTests.push({
|
||||
desc: "Selection monocles for frame content that is located inside " +
|
||||
"scrollable container.",
|
||||
setUp: setUpAndTearDown,
|
||||
tearDown: setUpAndTearDown,
|
||||
run: function test() {
|
||||
let urlToLoad = chromeRoot +
|
||||
"browser_selection_frame_in_scrollable_container.html";
|
||||
info(urlToLoad);
|
||||
yield addTab(urlToLoad);
|
||||
|
||||
ContextUI.dismiss();
|
||||
yield waitForCondition(() => !ContextUI.navbarVisible);
|
||||
|
||||
gWindow = Browser.selectedTab.browser.contentWindow;
|
||||
gFrame = gWindow.document.getElementById("frame1");
|
||||
|
||||
// Select some content inside frame.
|
||||
let promise = waitForEvent(document, "popupshown");
|
||||
sendContextMenuClickToWindow(gFrame.contentWindow, 10, 10);
|
||||
yield promise;
|
||||
|
||||
let selectMenuItem = document.getElementById("context-select");
|
||||
promise = waitForEvent(document, "popuphidden");
|
||||
sendElementTap(gWindow, selectMenuItem);
|
||||
yield promise;
|
||||
yield waitForCondition(()=>SelectionHelperUI.isSelectionUIVisible);
|
||||
|
||||
// Scroll frame inside scrollable container.
|
||||
let initialYPos = SelectionHelperUI.endMark.yPos;
|
||||
let touchDrag = new TouchDragAndHold();
|
||||
touchDrag.useNativeEvents = true;
|
||||
yield touchDrag.start(gWindow, 100, 90, 100, 50);
|
||||
touchDrag.end();
|
||||
|
||||
yield waitForCondition(() => !SelectionHelperUI.hasActiveDrag);
|
||||
yield SelectionHelperUI.pingSelectionHandler();
|
||||
|
||||
yield waitForCondition(()=>SelectionHelperUI.isSelectionUIVisible);
|
||||
|
||||
ok(initialYPos - SelectionHelperUI.endMark.yPos > 10,
|
||||
"Selection monocles followed scrolled content.");
|
||||
}
|
||||
});
|
||||
|
||||
function test() {
|
||||
// We need this until bug 859742 is fully resolved.
|
||||
setDevPixelEqualToPx();
|
||||
runTests();
|
||||
}
|
|
@ -16,6 +16,7 @@ support-files =
|
|||
browser_selection_contenteditable.html
|
||||
browser_selection_frame_content.html
|
||||
browser_selection_frame_inputs.html
|
||||
browser_selection_frame_in_scrollable_container.html
|
||||
browser_selection_frame_textarea.html
|
||||
browser_selection_inputs.html
|
||||
browser_selection_textarea.html
|
||||
|
@ -33,6 +34,7 @@ support-files =
|
|||
res/blankpage1.html
|
||||
res/blankpage2.html
|
||||
res/blankpage3.html
|
||||
res/documentindesignmode.html
|
||||
|
||||
[browser_apzc_basic.js]
|
||||
[browser_bookmarks.js]
|
||||
|
@ -74,6 +76,8 @@ skip-if = debug
|
|||
skip-if = debug
|
||||
[browser_selection_frame_content.js]
|
||||
skip-if = debug
|
||||
[browser_selection_frame_in_scrollable_container.js]
|
||||
skip-if = debug
|
||||
[browser_selection_inputs.js]
|
||||
skip-if = debug
|
||||
[browser_selection_frame_textarea.js]
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<style>
|
||||
body {
|
||||
border: none;
|
||||
background: none repeat scroll 0% 0% transparent;
|
||||
margin: 0;
|
||||
min-width: 0px;
|
||||
min-height: 100px;
|
||||
width: 100px;
|
||||
height: 100%;
|
||||
direction: ltr;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.test-div {
|
||||
font-size: 22px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body role="textbox" hidefocus="true">
|
||||
<div class="test-div div1">1</div>
|
||||
<div class="test-div div2">2</div>
|
||||
<div class="test-div div3">3</div>
|
||||
<div class="test-div div4">4</div>
|
||||
<div class="test-div div5">5</div>
|
||||
</body>
|
||||
<script type="text/javascript">
|
||||
document.designMode = "on";
|
||||
</script>
|
||||
</html>
|
Загрузка…
Ссылка в новой задаче