mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 970404 - don't let users affect document colors for chrome images, r=bz
This commit is contained in:
parent
d666458d4d
commit
4bc134f524
@ -68,6 +68,8 @@
|
||||
#include "nsBidiUtils.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
|
||||
#include "URL.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
using namespace mozilla::layers;
|
||||
@ -696,16 +698,28 @@ nsPresContext::GetDocumentColorPreferences()
|
||||
|
||||
int32_t useAccessibilityTheme = 0;
|
||||
bool usePrefColors = true;
|
||||
nsCOMPtr<nsIDocShellTreeItem> docShell(mContainer);
|
||||
if (docShell) {
|
||||
if (nsIDocShellTreeItem::typeChrome == docShell->ItemType()) {
|
||||
usePrefColors = false;
|
||||
} else {
|
||||
useAccessibilityTheme =
|
||||
LookAndFeel::GetInt(LookAndFeel::eIntID_UseAccessibilityTheme, 0);
|
||||
usePrefColors = !useAccessibilityTheme;
|
||||
}
|
||||
bool isChromeDocShell = false;
|
||||
|
||||
nsIDocument* doc = mDocument->GetDisplayDocument();
|
||||
if (doc && doc->GetDocShell()) {
|
||||
isChromeDocShell = nsIDocShellTreeItem::typeChrome ==
|
||||
doc->GetDocShell()->ItemType();
|
||||
} else {
|
||||
nsCOMPtr<nsIDocShellTreeItem> docShell(mContainer);
|
||||
if (docShell) {
|
||||
isChromeDocShell = nsIDocShellTreeItem::typeChrome == docShell->ItemType();
|
||||
}
|
||||
}
|
||||
|
||||
mIsChromeOriginImage = mDocument->IsBeingUsedAsImage() &&
|
||||
IsChromeURI(mDocument->GetDocumentURI());
|
||||
|
||||
if (isChromeDocShell || mIsChromeOriginImage) {
|
||||
usePrefColors = false;
|
||||
} else {
|
||||
useAccessibilityTheme =
|
||||
LookAndFeel::GetInt(LookAndFeel::eIntID_UseAccessibilityTheme, 0);
|
||||
usePrefColors = !useAccessibilityTheme;
|
||||
}
|
||||
if (usePrefColors) {
|
||||
usePrefColors =
|
||||
|
@ -828,6 +828,7 @@ public:
|
||||
|
||||
// Is this presentation in a chrome docshell?
|
||||
bool IsChrome() const { return mIsChrome; }
|
||||
bool IsChromeOriginImage() const { return mIsChromeOriginImage; }
|
||||
void UpdateIsChrome();
|
||||
|
||||
// Public API for native theme code to get style internals.
|
||||
@ -835,7 +836,7 @@ public:
|
||||
|
||||
// Is it OK to let the page specify colors and backgrounds?
|
||||
bool UseDocumentColors() const {
|
||||
return GetCachedBoolPref(kPresContext_UseDocumentColors) || IsChrome();
|
||||
return GetCachedBoolPref(kPresContext_UseDocumentColors) || IsChrome() || IsChromeOriginImage();
|
||||
}
|
||||
|
||||
// Explicitly enable and disable paint flashing.
|
||||
@ -1318,6 +1319,7 @@ protected:
|
||||
unsigned mFireAfterPaintEvents : 1;
|
||||
|
||||
unsigned mIsChrome : 1;
|
||||
unsigned mIsChromeOriginImage : 1;
|
||||
|
||||
// Should we paint flash in this context? Do not use this variable directly.
|
||||
// Use GetPaintFlashing() method instead.
|
||||
|
Loading…
Reference in New Issue
Block a user