merge fx-team to mozilla-central

This commit is contained in:
Carsten "Tomcat" Book 2014-01-09 12:59:42 +01:00
commit ddd2b2ace7
6 changed files with 128 additions and 37 deletions

View File

@ -0,0 +1,51 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
// from MouseEvents.h
const leftButtonFlag = 1;
const rightButtonFlag = 2;
gTests.push({
desc: "Test native mouse events",
run: function () {
let tab = yield addTab("about:mozilla");
// Mousemove.
let waitForMove = waitForEvent(document, "mousemove");
synthesizeNativeMouseMove(tab.browser, 1, 1);
synthesizeNativeMouseMove(tab.browser, 100, 100);
let mousemove = yield waitForMove;
is(mousemove.cancelable, false, "mousemove is not cancelable");
is(mousemove.buttons, 0, "no buttons are down");
// Left button down.
let waitForDown1 = waitForEvent(document, "mousedown");
synthesizeNativeMouseLDown(tab.browser, 100, 100);
let mousedown1 = yield waitForDown1;
is(mousedown1.cancelable, true, "mousedown is cancelable");
is(mousedown1.buttons, leftButtonFlag, "left button is down");
// Right button down.
let waitForDown2 = waitForEvent(document, "mousedown");
synthesizeNativeMouseRDown(tab.browser, 100, 100);
let mousedown2 = yield waitForDown2;
is(mousedown2.buttons, leftButtonFlag | rightButtonFlag, "both buttons are down");
// Left button up.
let waitForUp1 = waitForEvent(document, "mouseup");
synthesizeNativeMouseLUp(tab.browser, 100, 100);
let mouseup1 = yield waitForUp1;
is(mouseup1.buttons, rightButtonFlag, "right button is down");
// Right button up.
let waitForUp2 = waitForEvent(document, "mouseup");
synthesizeNativeMouseRUp(tab.browser, 100, 100);
let mouseup2 = yield waitForUp2;
is(mouseup2.buttons, 0, "no buttons are down");
Browser.closeTab(tab, { forceClose: true });
}
});
let test = runTests;

View File

@ -50,7 +50,7 @@ gTests.push({
notifyPrecise();
yield precisePromise;
todo(!isElementVisible(tabStrip._scrollButtonUp), "Bug 952297 - left scrollbutton is hidden in precise mode");
ok(!isElementVisible(tabStrip._scrollButtonUp), "Bug 952297 - left scrollbutton is hidden in precise mode");
ok(!isElementVisible(tabStrip._scrollButtonDown), "right scrollbutton is hidden in precise mode");
},
tearDown: tearDown
@ -98,17 +98,20 @@ gTests.push({
yield addTab("about:mozilla");
}
let tabs = Elements.tabList.strip.querySelectorAll("documenttab");
// select the first tab
Elements.tabs.selectedTab = tabs[0];
ok(isElementVisible(Elements.tabList.strip._scrollButtonDown), "right scrollbutton should be visible when tabList has overflow");
todo(!isElementVisible(Elements.tabList.strip._scrollButtonUp), "Bug 952297 - left scrollbutton should not visible when 1st tab is selected and tablist has overflow");
ok(isElementVisible(Elements.tabList.strip._scrollButtonUp), "left scrollbutton should be visible in precise mode");
ok(isElementVisible(Elements.tabList.strip._scrollButtonDown), "right scrollbutton should be visible in precise mode");
// select the first tab
Browser.selectedTab = Browser.tabs[0];
yield waitForMs(1000); // XXX maximum duration of arrowscrollbox _scrollAnim
ok(Elements.tabList.strip._scrollButtonUp.disabled, "left scrollbutton should be disabled when 1st tab is selected and tablist has overflow");
ok(!Elements.tabList.strip._scrollButtonDown.disabled, "right scrollbutton should be enabled when 1st tab is selected and tablist has overflow");
// select the last tab
Elements.tabs.selectedTab = tabs[tabs.length-1];
ok(isElementVisible(Elements.tabList.strip._scrollButtonUp), "left scrollbutton should be visible when tablist has overflow and last tab is selected");
todo(!isElementVisible(Elements.tabList.strip._scrollButtonDown), "Bug 952297 - right scrollbutton should not visible when last tab is selected and tablist has overflow");
Browser.selectedTab = Browser.tabs[Browser.tabs.length - 1];
yield waitForMs(1000); // XXX maximum duration of arrowscrollbox _scrollAnim
ok(!Elements.tabList.strip._scrollButtonUp.disabled, "left scrollbutton should be enabled when 1st tab is selected and tablist has overflow");
ok(Elements.tabList.strip._scrollButtonDown.disabled, "right scrollbutton should be disabled when last tab is selected and tablist has overflow");
}
});

View File

@ -32,6 +32,7 @@ support-files =
res/blankpage2.html
res/blankpage3.html
[browser_apzc_basic.js]
[browser_bookmarks.js]
[browser_canonizeURL.js]
[browser_circular_progress_indicator.js]
@ -45,6 +46,8 @@ support-files =
[browser_history.js]
[browser_inputsource.js]
[browser_link_click.js]
[browser_menu_hoverstate.js]
[browser_mouse_events.js]
[browser_onscreen_keyboard.js]
[browser_prefs_ui.js]
[browser_prompt.js]
@ -58,8 +61,6 @@ support-files =
[browser_urlbar.js]
[browser_urlbar_highlightURLs.js]
[browser_urlbar_trimURLs.js]
[browser_apzc_basic.js]
[browser_menu_hoverstate.js]
# These tests have known failures in debug builds
[browser_selection_basic.js]

View File

@ -46,18 +46,14 @@
overflow: auto;
}
#tabs[input="precise"] > .tabs-scrollbox > .scrollbutton-up {
visibility: visible !important;
}
#tabs[input="imprecise"] > .tabs-scrollbox > .scrollbutton-up {
.tabs-scrollbox > .scrollbutton-up[collapsed],
.tabs-scrollbox > .scrollbutton-down[collapsed],
#tabs[input="imprecise"] > .tabs-scrollbox > .scrollbutton-up,
#tabs[input="imprecise"] > .tabs-scrollbox > .scrollbutton-down {
visibility: hidden !important;
pointer-events: none;
}
#tabs[input="imprecise"] > .tabs-scrollbox > .scrollbutton-down {
visibility: collapse !important;
}
#tabs > .tabs-scrollbox > .scrollbutton-up {
list-style-image: url("images/tab-arrows.png") !important;
-moz-image-region: rect(15px 58px 63px 14px) !important;

View File

@ -200,6 +200,11 @@ ModifierKeyState::InitMouseEvent(WidgetInputEvent& aMouseEvent) const
aMouseEvent.eventStructType == NS_SIMPLE_GESTURE_EVENT,
"called with non-mouse event");
if (XRE_GetWindowsEnvironment() == WindowsEnvironmentType_Metro) {
// Buttons for immersive mode are handled in MetroInput.
return;
}
WidgetMouseEventBase& mouseEvent = *aMouseEvent.AsMouseEventBase();
mouseEvent.buttons = 0;
if (::GetKeyState(VK_LBUTTON) < 0) {

View File

@ -160,6 +160,37 @@ namespace {
}
}
int16_t
ButtonsForPointerPoint(UI::Input::IPointerPoint* aPoint) {
WRL::ComPtr<UI::Input::IPointerPointProperties> props;
aPoint->get_Properties(props.GetAddressOf());
int16_t buttons = 0;
boolean buttonPressed;
props->get_IsLeftButtonPressed(&buttonPressed);
if (buttonPressed) {
buttons |= WidgetMouseEvent::eLeftButtonFlag;
}
props->get_IsMiddleButtonPressed(&buttonPressed);
if (buttonPressed) {
buttons |= WidgetMouseEvent::eMiddleButtonFlag;
}
props->get_IsRightButtonPressed(&buttonPressed);
if (buttonPressed) {
buttons |= WidgetMouseEvent::eRightButtonFlag;
}
props->get_IsXButton1Pressed(&buttonPressed);
if (buttonPressed) {
buttons |= WidgetMouseEvent::e4thButtonFlag;
}
props->get_IsXButton2Pressed(&buttonPressed);
if (buttonPressed) {
buttons |= WidgetMouseEvent::e5thButtonFlag;
}
return buttons;
}
/**
* This function is for use with mTouches.Enumerate. It will
* append each element it encounters to the {@link nsTArray}
@ -408,40 +439,43 @@ MetroInput::OnPointerNonTouch(UI::Input::IPointerPoint* aPoint) {
aPoint->get_Properties(props.GetAddressOf());
props->get_PointerUpdateKind(&pointerUpdateKind);
WidgetMouseEvent* event =
new WidgetMouseEvent(true, NS_MOUSE_MOVE, mWidget.Get(),
WidgetMouseEvent::eReal,
WidgetMouseEvent::eNormal);
uint32_t message = NS_MOUSE_MOVE;
int16_t button = 0;
switch (pointerUpdateKind) {
case UI::Input::PointerUpdateKind::PointerUpdateKind_LeftButtonPressed:
// We don't bother setting mouseEvent.button because it is already
// set to WidgetMouseEvent::buttonType::eLeftButton whose value is 0.
event->message = NS_MOUSE_BUTTON_DOWN;
button = WidgetMouseEvent::buttonType::eLeftButton;
message = NS_MOUSE_BUTTON_DOWN;
break;
case UI::Input::PointerUpdateKind::PointerUpdateKind_MiddleButtonPressed:
event->button = WidgetMouseEvent::buttonType::eMiddleButton;
event->message = NS_MOUSE_BUTTON_DOWN;
button = WidgetMouseEvent::buttonType::eMiddleButton;
message = NS_MOUSE_BUTTON_DOWN;
break;
case UI::Input::PointerUpdateKind::PointerUpdateKind_RightButtonPressed:
event->button = WidgetMouseEvent::buttonType::eRightButton;
event->message = NS_MOUSE_BUTTON_DOWN;
button = WidgetMouseEvent::buttonType::eRightButton;
message = NS_MOUSE_BUTTON_DOWN;
break;
case UI::Input::PointerUpdateKind::PointerUpdateKind_LeftButtonReleased:
// We don't bother setting mouseEvent.button because it is already
// set to WidgetMouseEvent::buttonType::eLeftButton whose value is 0.
event->message = NS_MOUSE_BUTTON_UP;
button = WidgetMouseEvent::buttonType::eLeftButton;
message = NS_MOUSE_BUTTON_UP;
break;
case UI::Input::PointerUpdateKind::PointerUpdateKind_MiddleButtonReleased:
event->button = WidgetMouseEvent::buttonType::eMiddleButton;
event->message = NS_MOUSE_BUTTON_UP;
button = WidgetMouseEvent::buttonType::eMiddleButton;
message = NS_MOUSE_BUTTON_UP;
break;
case UI::Input::PointerUpdateKind::PointerUpdateKind_RightButtonReleased:
event->button = WidgetMouseEvent::buttonType::eRightButton;
event->message = NS_MOUSE_BUTTON_UP;
button = WidgetMouseEvent::buttonType::eRightButton;
message = NS_MOUSE_BUTTON_UP;
break;
}
UpdateInputLevel(LEVEL_PRECISE);
WidgetMouseEvent* event =
new WidgetMouseEvent(true, message, mWidget.Get(),
WidgetMouseEvent::eReal,
WidgetMouseEvent::eNormal);
event->button = button;
InitGeckoMouseEventFromPointerPoint(event, aPoint);
DispatchAsyncEventIgnoreStatus(event);
}
@ -746,6 +780,7 @@ MetroInput::InitGeckoMouseEventFromPointerPoint(
aEvent->clickCount = 2;
}
aEvent->pressure = pressure;
aEvent->buttons = ButtonsForPointerPoint(aPointerPoint);
MozInputSourceFromDeviceType(deviceType, aEvent->inputSource);
}