nsUXThemeData uses win32k APIs in content process
Categories
(Core :: Widget: Win32, enhancement, P1)
Tracking
()
People
(Reporter: Alex_Gaynor, Assigned: cmartin)
References
(Blocks 1 open bug)
Details
(Whiteboard: [gfx-noted])
Attachments
(9 files, 2 obsolete files)
(deleted),
application/octet-stream
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
text/x-phabricator-request
|
Details | |
(deleted),
application/octet-stream
|
Details |
Updated•7 years ago
|
Updated•6 years ago
|
Comment 1•6 years ago
|
||
We should be able to remote all of this over to the main process.
Comment 2•6 years ago
|
||
If fact, we may not need to initialize this module. Depends on who's calling into it. Layout might rely on this, and the theme module might as well. Once we get rid of theme, this might go away on its own.
Updated•6 years ago
|
Updated•6 years ago
|
Updated•6 years ago
|
Updated•6 years ago
|
Assignee | ||
Comment 3•5 years ago
|
||
I'm attaching a recent Win32k log from my machine. Can see that this still has calls to dwmapi!DwmIsCompositionEnabled
in it.
Updated•5 years ago
|
Assignee | ||
Comment 4•5 years ago
|
||
Currently, There are multiple places that call the Win32 APIs for DWM status.
Once Win32k lockdown is enabled, this API will be unavailable and will need
to be remoted. This new function will be made to work in both parent and
content processes, and therefore all DWM queries must be directed to it.
Also, some minor cleanup because... Why not?
Assignee | ||
Comment 5•5 years ago
|
||
The only caveat here is that gfxVars are not atomic, but multiple threads can
query DWM status. To solve this, changes to the var are mirrored into an atomic
and that is read instead.
DWM status changes are indicated by Windows via a window message. We use that
window message to cause the update to propagate
Depends on D73742
Updated•5 years ago
|
Assignee | ||
Updated•5 years ago
|
Comment 7•5 years ago
|
||
bugherder |
Assignee | ||
Comment 8•4 years ago
|
||
To enable Win32k lockdown, calls involving native theme will need to be
removed.
Currently these calls are scattered around several files. This class creates
a proxy for the Win32 calls. Whitelisting this class in awcw32ks makes it much
easier to track Win32k removal with themes removed.
As an added benefit, once non-native theming is done it will be easy to verify
by asserting that this class is never created in Content.
Assignee | ||
Comment 9•4 years ago
|
||
Currently, a SystemParametersInfo(SPI_GETFLATMENU) happens very very early
during the XUL DLL startup. This is unnecessary, as this value is not used
until way later.
For Win32k lockdown, we will need to remote this call, so ContentChild must
be available.
By loading this value lazily, we ensure IPC will be available and also get to
remove a Win32 call from the Firefox startup time.
Assignee | ||
Comment 11•4 years ago
|
||
There are a number of system parameters that return simple floats and bools
and are just different forms of system parameter query.
This introduces a new singleton and IPDL calls to send these values from parent
to content processes and cache them in content.
I started with these 2 variables because their values don't go stale. In a
later changeset, I will add more logic to invalidate cached values that go
stale, such as for the SPI_GETFLATMENU metric.
Assignee | ||
Comment 12•4 years ago
|
||
This is not meant to actually be checked in, but it demonstrates how to remote
a theme drawing call using this centralized theme change.
The vertical scrollbar for the main window uses this API, so the fact that it
works shows that it works and is possible.
Depends on D75946
Comment 13•4 years ago
|
||
Updated•4 years ago
|
Comment 14•4 years ago
|
||
bugherder |
Comment 15•4 years ago
|
||
Comment 16•4 years ago
|
||
bugherder |
Comment 17•4 years ago
|
||
Comment 18•4 years ago
|
||
Failure log: https://treeherder.mozilla.org/logviewer.html#?job_id=306421086&repo=autoland
Backout link: https://hg.mozilla.org/integration/autoland/rev/323418a0d68fb43e033a82addb3475724217c0bc
[task 2020-06-15T22:50:57.615Z] 22:50:57 WARNING - /builds/worker/checkouts/gecko/widget/windows/TaskbarTabPreview.h:39:16: warning: 'DetachFromNSWindow' overrides a member function but is not marked 'override' [-Winconsistent-missing-override]
[task 2020-06-15T22:50:57.615Z] 22:50:57 INFO - virtual void DetachFromNSWindow();
[task 2020-06-15T22:50:57.615Z] 22:50:57 INFO - ^
[task 2020-06-15T22:50:57.615Z] 22:50:57 INFO - /builds/worker/checkouts/gecko/widget/windows/TaskbarPreview.h:50:16: note: overridden virtual function is here
[task 2020-06-15T22:50:57.615Z] 22:50:57 INFO - virtual void DetachFromNSWindow();
[task 2020-06-15T22:50:57.615Z] 22:50:57 INFO - ^
[task 2020-06-15T22:50:57.615Z] 22:50:57 INFO - In file included from Unified_cpp_widget_windows1.cpp:56:
[task 2020-06-15T22:50:57.615Z] 22:50:57 ERROR - /builds/worker/checkouts/gecko/widget/windows/WinThemeData.cpp:74:38: error: cannot initialize a parameter of type 'RECT *' (aka 'tagRECT *') with an lvalue of type 'LPCRECT' (aka 'const tagRECT *')
[task 2020-06-15T22:50:57.615Z] 22:50:57 INFO - aDrawRect, aMargins));
[task 2020-06-15T22:50:57.615Z] 22:50:57 INFO - ^~~~~~~~~
[task 2020-06-15T22:50:57.615Z] 22:50:57 INFO - /builds/worker/fetches/clang/bin/../x86_64-w64-mingw32/include/winerror.h:2224:34: note: expanded from macro 'SUCCEEDED'
[task 2020-06-15T22:50:57.615Z] 22:50:57 INFO - #define SUCCEEDED(hr) ((HRESULT)(hr) >= 0)
[task 2020-06-15T22:50:57.615Z] 22:50:57 INFO - ^~
[task 2020-06-15T22:50:57.615Z] 22:50:57 INFO - /builds/worker/fetches/clang/bin/../x86_64-w64-mingw32/include/uxtheme.h:326:91: note: passing argument to parameter 'prc' here
[task 2020-06-15T22:50:57.615Z] 22:50:57 INFO - THEMEAPI GetThemeMargins(HTHEME hTheme,HDC hdc,int iPartId,int iStateId,int iPropId,RECT *prc,MARGINS *pMargins);
[task 2020-06-15T22:50:57.615Z] 22:50:57 INFO - ^
[task 2020-06-15T22:50:57.615Z] 22:50:57 INFO - In file included from Unified_cpp_widget_windows1.cpp:56:
[task 2020-06-15T22:50:57.615Z] 22:50:57 ERROR - /builds/worker/checkouts/gecko/widget/windows/WinThemeData.cpp:82:39: error: cannot initialize a parameter of type 'RECT *' (aka 'tagRECT *') with an lvalue of type 'LPCRECT' (aka 'const tagRECT *')
[task 2020-06-15T22:50:57.615Z] 22:50:57 INFO - aDrawRect, aSizeType, aPartSize));
[task 2020-06-15T22:50:57.615Z] 22:50:57 INFO - ^~~~~~~~~
[task 2020-06-15T22:50:57.615Z] 22:50:57 INFO - /builds/worker/fetches/clang/bin/../x86_64-w64-mingw32/include/winerror.h:2224:34: note: expanded from macro 'SUCCEEDED'
[task 2020-06-15T22:50:57.615Z] 22:50:57 INFO - #define SUCCEEDED(hr) ((HRESULT)(hr) >= 0)
Failure log: https://treeherder.mozilla.org/logviewer.html#?job_id=306431229&repo=autoland
Assignee | ||
Comment 19•4 years ago
|
||
It appears that MinGW's header files have the wrong "const-ness" for these functions (they expect a RECT*
argument instead of a const RECT*
argument)
I'm going to have to use const_cast<T>
to appease MinGW. Unfortunate...
Assignee | ||
Comment 20•4 years ago
|
||
SPI_GETFLATMENU uses the newly-added WinContentSystemParameters and adds
the ability to update theme-related variables when they change.
Assignee | ||
Comment 21•4 years ago
|
||
This Win32 API will need to be remoted for Win32k lockdown. As it falls under
the <uxtheme.h> system header, I believe it makes the most sense to centralize
it as "nsUXThemeData::IsAppThemed()", and then turn that into a remoted API.
Depends on D80071
Assignee | ||
Comment 22•4 years ago
|
||
Depends on D80564
Comment 23•4 years ago
|
||
Updated•4 years ago
|
Comment 24•4 years ago
|
||
bugherder |
Comment 25•4 years ago
|
||
Comment 26•4 years ago
|
||
bugherder |
Assignee | ||
Comment 27•4 years ago
|
||
Assignee | ||
Comment 28•4 years ago
|
||
Closing ticket as updated run of awcw32ks tool shows that the only nsUXThemeData calls still making Win32k calls are the ones blocked on non-native themeing, which is out-of-scope for this bug.
Updated•4 years ago
|
Updated•2 years ago
|
Description
•