Bug 934811 - Ensure that no scrollbars are displayed for touch input. r=jimm,tn

This commit is contained in:
Stephen Pohl 2013-12-03 13:21:09 -05:00
Родитель 30fe6804b0
Коммит 39d5592298
8 изменённых файлов: 52 добавлений и 5 удалений

Просмотреть файл

@ -157,6 +157,12 @@ public:
* Should we insert a dropmarker inside of combobox button?
*/
virtual bool ThemeNeedsComboboxDropmarker()=0;
/**
* Should we hide scrollbars?
*/
virtual bool ShouldHideScrollbars()
{ return false; }
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsITheme, NS_ITHEME_IID)

Просмотреть файл

@ -2095,6 +2095,12 @@ ScrollFrameHelper::AppendScrollPartsTo(nsDisplayListBuilder* aBuilder,
bool& aCreateLayer,
bool aPositioned)
{
nsITheme* theme = mOuter->PresContext()->GetTheme();
if (theme &&
theme->ShouldHideScrollbars()) {
return;
}
bool overlayScrollbars =
LookAndFeel::GetInt(LookAndFeel::eIntID_UseOverlayScrollbars) != 0;

Просмотреть файл

@ -35,6 +35,9 @@
#include "nsIThread.h"
#include "MainThreadUtils.h"
#include "gfxColor.h"
#ifdef MOZ_METRO
#include "winrt/MetroInput.h"
#endif // MOZ_METRO
#ifdef NS_ENABLE_TSF
#include <textstor.h>
@ -1177,6 +1180,17 @@ WinUtils::SetupKeyModifiersSequence(nsTArray<KeyPair>* aArray,
}
}
/* static */
bool
WinUtils::ShouldHideScrollbars()
{
#ifdef MOZ_METRO
if (XRE_GetWindowsEnvironment() == WindowsEnvironmentType_Metro) {
return widget::winrt::MetroInput::IsInputModeImprecise();
}
#endif // MOZ_METRO
return false;
}
} // namespace widget
} // namespace mozilla

Просмотреть файл

@ -319,6 +319,8 @@ public:
static void Initialize();
static bool ShouldHideScrollbars();
private:
typedef HRESULT (WINAPI * SHCreateItemFromParsingNamePtr)(PCWSTR pszPath,
IBindCtx *pbc,

Просмотреть файл

@ -24,6 +24,7 @@
#include "nsWindow.h"
#include "nsIComboboxControlFrame.h"
#include "prinrval.h"
#include "WinUtils.h"
#include "gfxPlatform.h"
#include "gfxContext.h"
@ -37,6 +38,7 @@
#include <algorithm>
using mozilla::IsVistaOrLater;
using namespace mozilla::widget;
#ifdef PR_LOGGING
extern PRLogModuleInfo* gWindowsLog;
@ -2603,6 +2605,12 @@ nsNativeThemeWin::WidgetAppearanceDependsOnWindowFocus(uint8_t aWidgetType)
}
}
bool
nsNativeThemeWin::ShouldHideScrollbars()
{
return WinUtils::ShouldHideScrollbars();
}
nsITheme::Transparency
nsNativeThemeWin::GetWidgetTransparency(nsIFrame* aFrame, uint8_t aWidgetType)
{

Просмотреть файл

@ -69,6 +69,8 @@ public:
virtual bool WidgetAppearanceDependsOnWindowFocus(uint8_t aWidgetType) MOZ_OVERRIDE;
virtual bool ShouldHideScrollbars() MOZ_OVERRIDE;
nsNativeThemeWin();
virtual ~nsNativeThemeWin();

Просмотреть файл

@ -207,11 +207,13 @@ namespace mozilla {
namespace widget {
namespace winrt {
MetroInput::InputPrecisionLevel MetroInput::sCurrentInputLevel =
MetroInput::InputPrecisionLevel::LEVEL_IMPRECISE;
MetroInput::MetroInput(MetroWidget* aWidget,
UI::Core::ICoreWindow* aWindow)
: mWidget(aWidget),
mChromeHitTestCacheForTouch(false),
mCurrentInputLevel(LEVEL_IMPRECISE),
mWindow(aWindow)
{
LogFunction();
@ -244,6 +246,11 @@ MetroInput::~MetroInput()
UnregisterInputEvents();
}
/* static */
bool MetroInput::IsInputModeImprecise()
{
return sCurrentInputLevel == LEVEL_IMPRECISE;
}
/**
* Tracks the current input level (precise/imprecise) and fires an observer
@ -256,9 +263,9 @@ MetroInput::UpdateInputLevel(InputPrecisionLevel aInputLevel)
if (aInputLevel == LEVEL_PRECISE && mTouches.Count() > 0) {
return;
}
if (mCurrentInputLevel != aInputLevel) {
mCurrentInputLevel = aInputLevel;
MetroUtils::FireObserver(mCurrentInputLevel == LEVEL_PRECISE ?
if (sCurrentInputLevel != aInputLevel) {
sCurrentInputLevel = aInputLevel;
MetroUtils::FireObserver(sCurrentInputLevel == LEVEL_PRECISE ?
"metro_precise_input" : "metro_imprecise_input");
}
}

Просмотреть файл

@ -145,6 +145,8 @@ public:
void HandleTap(const Point& aPoint, unsigned int aTapCount);
void HandleLongTap(const Point& aPoint);
static bool IsInputModeImprecise();
private:
Microsoft::WRL::ComPtr<ICoreWindow> mWindow;
Microsoft::WRL::ComPtr<MetroWidget> mWidget;
@ -157,7 +159,7 @@ private:
LEVEL_PRECISE,
LEVEL_IMPRECISE
};
InputPrecisionLevel mCurrentInputLevel;
static InputPrecisionLevel sCurrentInputLevel;
void UpdateInputLevel(InputPrecisionLevel aInputLevel);
// Initialization/Uninitialization helpers