зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset 3b956ceaaf8b (bug 1369815)
This commit is contained in:
Родитель
6d278c7bee
Коммит
c5721643b5
|
@ -842,7 +842,6 @@ nsDocShell::nsDocShell()
|
|||
, mDefaultLoadFlags(nsIRequest::LOAD_NORMAL)
|
||||
, mFrameType(FRAME_TYPE_REGULAR)
|
||||
, mPrivateBrowsingId(0)
|
||||
, mDisplayMode(nsIDocShell::DISPLAY_MODE_BROWSER)
|
||||
, mForcedCharset(nullptr)
|
||||
, mParentCharset(nullptr)
|
||||
, mParentCharsetSource(0)
|
||||
|
@ -15089,33 +15088,3 @@ nsIDocShell::SetHTMLEditor(HTMLEditor* aHTMLEditor)
|
|||
nsDocShell* docShell = static_cast<nsDocShell*>(this);
|
||||
return docShell->SetHTMLEditorInternal(aHTMLEditor);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocShell::GetDisplayMode(uint32_t* aDisplayMode)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aDisplayMode);
|
||||
*aDisplayMode = mDisplayMode;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocShell::SetDisplayMode(uint32_t aDisplayMode)
|
||||
{
|
||||
if (!(aDisplayMode == nsIDocShell::DISPLAY_MODE_BROWSER ||
|
||||
aDisplayMode == nsIDocShell::DISPLAY_MODE_STANDALONE ||
|
||||
aDisplayMode == nsIDocShell::DISPLAY_MODE_FULLSCREEN ||
|
||||
aDisplayMode == nsIDocShell::DISPLAY_MODE_MINIMAL_UI)) {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
if (aDisplayMode != mDisplayMode) {
|
||||
mDisplayMode = aDisplayMode;
|
||||
|
||||
nsPresContext* presContext;
|
||||
if (NS_SUCCEEDED(GetPresContext(&presContext))) {
|
||||
presContext->MediaFeatureValuesChangedAllDocuments(nsRestyleHint(0));
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -1054,18 +1054,6 @@ protected:
|
|||
|
||||
nsString mInterceptedDocumentId;
|
||||
|
||||
// This represents the CSS display-mode we are currently using.
|
||||
// It can be any of the following values from nsIDocShell.idl:
|
||||
//
|
||||
// DISPLAY_MODE_BROWSER = 0
|
||||
// DISPLAY_MODE_MINIMAL_UI = 1
|
||||
// DISPLAY_MODE_STANDALONE = 2
|
||||
// DISPLAY_MODE_FULLSCREEN = 3
|
||||
//
|
||||
// This is mostly used for media queries. The integer values above
|
||||
// match those used in nsStyleConsts.h
|
||||
uint32_t mDisplayMode;
|
||||
|
||||
private:
|
||||
const Encoding* mForcedCharset;
|
||||
const Encoding* mParentCharset;
|
||||
|
|
|
@ -1164,19 +1164,4 @@ interface nsIDocShell : nsIDocShellTreeItem
|
|||
mozilla::HTMLEditor* GetHTMLEditor();
|
||||
nsresult SetHTMLEditor(mozilla::HTMLEditor* aHTMLEditor);
|
||||
%}
|
||||
|
||||
/**
|
||||
* Allowed CSS display modes. This needs to be kept in
|
||||
* sync with similar values in nsStyleConsts.h
|
||||
*/
|
||||
const unsigned long DISPLAY_MODE_BROWSER = 0;
|
||||
const unsigned long DISPLAY_MODE_MINIMAL_UI = 1;
|
||||
const unsigned long DISPLAY_MODE_STANDALONE = 2;
|
||||
const unsigned long DISPLAY_MODE_FULLSCREEN = 3;
|
||||
|
||||
/**
|
||||
* Display mode for this docshell. Defaults to DISPLAY_MODE_BROWSER.
|
||||
* Media queries only look at the value in the parent docshell.
|
||||
*/
|
||||
attribute unsigned long displayMode;
|
||||
};
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
#include "nsCSSRuleProcessor.h"
|
||||
#include "nsDeviceContext.h"
|
||||
#include "nsIBaseWindow.h"
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIWidget.h"
|
||||
#include "nsContentUtils.h"
|
||||
|
@ -305,44 +304,33 @@ GetDisplayMode(nsPresContext* aPresContext, const nsMediaFeature*,
|
|||
nsCSSValue& aResult)
|
||||
{
|
||||
nsCOMPtr<nsISupports> container;
|
||||
RefPtr<nsIDocShell> docShell;
|
||||
|
||||
if (!aPresContext) {
|
||||
aResult.SetIntValue(NS_STYLE_DISPLAY_MODE_BROWSER, eCSSUnit_Enumerated);
|
||||
return;
|
||||
}
|
||||
|
||||
if (aPresContext) {
|
||||
// Calling GetRootPresContext() can be slow, so make sure to call it
|
||||
// just once.
|
||||
nsRootPresContext* root = aPresContext->GetRootPresContext();
|
||||
if (root && root->Document()) {
|
||||
container = root->Document()->GetContainer();
|
||||
docShell = root->GetDocShell();
|
||||
}
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIBaseWindow> baseWindow = do_QueryInterface(container);
|
||||
if (baseWindow) {
|
||||
nsCOMPtr<nsIWidget> mainWidget;
|
||||
baseWindow->GetMainWidget(getter_AddRefs(mainWidget));
|
||||
nsSizeMode mode = mainWidget ? mainWidget->SizeMode() : nsSizeMode_Normal;
|
||||
|
||||
if (mode == nsSizeMode_Fullscreen) {
|
||||
aResult.SetIntValue(NS_STYLE_DISPLAY_MODE_FULLSCREEN, eCSSUnit_Enumerated);
|
||||
return;
|
||||
}
|
||||
if (!baseWindow) {
|
||||
aResult.SetIntValue(NS_STYLE_DISPLAY_MODE_BROWSER, eCSSUnit_Enumerated);
|
||||
return;
|
||||
}
|
||||
|
||||
static_assert(nsIDocShell::DISPLAY_MODE_BROWSER == NS_STYLE_DISPLAY_MODE_BROWSER &&
|
||||
nsIDocShell::DISPLAY_MODE_MINIMAL_UI == NS_STYLE_DISPLAY_MODE_MINIMAL_UI &&
|
||||
nsIDocShell::DISPLAY_MODE_STANDALONE == NS_STYLE_DISPLAY_MODE_STANDALONE &&
|
||||
nsIDocShell::DISPLAY_MODE_FULLSCREEN == NS_STYLE_DISPLAY_MODE_FULLSCREEN,
|
||||
"nsIDocShell display modes must mach nsStyleConsts.h");
|
||||
|
||||
uint32_t displayMode = NS_STYLE_DISPLAY_MODE_BROWSER;
|
||||
if (docShell) {
|
||||
docShell->GetDisplayMode(&displayMode);
|
||||
nsCOMPtr<nsIWidget> mainWidget;
|
||||
baseWindow->GetMainWidget(getter_AddRefs(mainWidget));
|
||||
int32_t displayMode;
|
||||
nsSizeMode mode = mainWidget ? mainWidget->SizeMode() : nsSizeMode_Normal;
|
||||
// Background tabs are always in 'browser' mode for now.
|
||||
// If new modes are supported, please ensure not cause the regression in
|
||||
// Bug 1259641.
|
||||
switch (mode) {
|
||||
case nsSizeMode_Fullscreen:
|
||||
displayMode = NS_STYLE_DISPLAY_MODE_FULLSCREEN;
|
||||
break;
|
||||
default:
|
||||
displayMode = NS_STYLE_DISPLAY_MODE_BROWSER;
|
||||
break;
|
||||
}
|
||||
|
||||
aResult.SetIntValue(displayMode, eCSSUnit_Enumerated);
|
||||
|
|
Загрузка…
Ссылка в новой задаче