Bug 959792 - Accomidate content that doesn't support apz scroll or zoom in widget hit testing. Fixes an issue with selection in the navbar while viewing about pages. r=mbrubeck

This commit is contained in:
Jim Mathies 2014-01-15 15:31:54 -06:00
parent 930fa4f5d2
commit cb8a9f5e7a
2 changed files with 13 additions and 10 deletions

View File

@ -254,7 +254,7 @@ MetroInput::InputPrecisionLevel MetroInput::sCurrentInputLevel =
MetroInput::MetroInput(MetroWidget* aWidget,
UI::Core::ICoreWindow* aWindow)
: mWidget(aWidget),
mChromeHitTestCacheForTouch(false),
mNonApzTargetForTouch(false),
mWindow(aWindow)
{
LogFunction();
@ -1318,9 +1318,9 @@ MetroInput::DeliverNextQueuedTouchEvent()
/*
* We go through states here and make different decisions in each:
*
* 1) Hit test chrome on first touchstart
* If chrome is the target simplify event delivery from that point
* on by directing all input to chrome, bypassing the apz.
* 1) Hit test for apz on first touchstart
* If non-apzc content/chrome is the target simplify event delivery from
* that point on by directing all input to chrome, bypassing the apz.
* 2) Process first touchstart and touchmove events
* If touch behavior value associated with the TouchStart's touches doesn't
* allow zooming or panning we explicitly set mContentConsumingTouch to true.
@ -1347,19 +1347,22 @@ MetroInput::DeliverNextQueuedTouchEvent()
AutoDeleteEvent wrap(event);
// Test for chrome vs. content target. To do this we only use the first touch
// Test for non-apz vs. apz target. To do this we only use the first touch
// point since that will be the input batch target. Cache this for touch events
// since HitTestChrome has to send a dom event.
if (mCancelable && event->message == NS_TOUCH_START) {
nsRefPtr<Touch> touch = event->touches[0];
LayoutDeviceIntPoint pt = LayoutDeviceIntPoint::FromUntyped(touch->mRefPoint);
// This is currently a general contained rect hit test, it may produce a false
// positive for overlay chrome elements. Also, some content pages won't support
// apzc, so this may be false for content as well.
bool apzIntersect = mWidget->ApzHitTest(mozilla::ScreenIntPoint(pt.x, pt.y));
mChromeHitTestCacheForTouch = (apzIntersect && HitTestChrome(pt));
mNonApzTargetForTouch = (!apzIntersect || HitTestChrome(pt));
}
// If this event is destined for chrome, deliver it directly there bypassing
// If this event is destined for dom, deliver it directly there bypassing
// the apz.
if (mChromeHitTestCacheForTouch) {
if (mNonApzTargetForTouch) {
DUMP_TOUCH_IDS("DOM(1)", event);
mWidget->DispatchEvent(event, status);
if (mCancelable) {

View File

@ -169,8 +169,8 @@ private:
void RegisterInputEvents();
void UnregisterInputEvents();
// Hit testing for chrome content
bool mChromeHitTestCacheForTouch;
// Hit testing for apz content
bool mNonApzTargetForTouch;
bool HitTestChrome(const LayoutDeviceIntPoint& pt);
// Event processing helpers. See function definitions for more info.