зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1217939 - part 1 - remove nsContentUtils::GetViewportInfo; r=smaug
All it was doing was forwarding to the provided document, which is an unnecessary layer of indirection.
This commit is contained in:
Родитель
31f926488b
Коммит
4331d7171e
|
@ -5356,14 +5356,6 @@ static void ProcessViewportToken(nsIDocument *aDocument,
|
|||
#define IS_SEPARATOR(c) ((c == '=') || (c == ',') || (c == ';') || \
|
||||
(c == '\t') || (c == '\n') || (c == '\r'))
|
||||
|
||||
/* static */
|
||||
nsViewportInfo
|
||||
nsContentUtils::GetViewportInfo(nsIDocument *aDocument,
|
||||
const ScreenIntSize& aDisplaySize)
|
||||
{
|
||||
return aDocument->GetViewportInfo(aDisplaySize);
|
||||
}
|
||||
|
||||
/* static */
|
||||
nsresult
|
||||
nsContentUtils::ProcessViewportInfo(nsIDocument *aDocument,
|
||||
|
|
|
@ -1672,24 +1672,6 @@ public:
|
|||
*/
|
||||
static void RunInMetastableState(already_AddRefed<nsIRunnable> aRunnable);
|
||||
|
||||
/**
|
||||
* Retrieve information about the viewport as a data structure.
|
||||
* This will return information in the viewport META data section
|
||||
* of the document. This can be used in lieu of ProcessViewportInfo(),
|
||||
* which places the viewport information in the document header instead
|
||||
* of returning it directly.
|
||||
*
|
||||
* @param aDisplayWidth width of the on-screen display area for this
|
||||
* document, in device pixels.
|
||||
* @param aDisplayHeight height of the on-screen display area for this
|
||||
* document, in device pixels.
|
||||
*
|
||||
* NOTE: If the site is optimized for mobile (via the doctype), this
|
||||
* will return viewport information that specifies default information.
|
||||
*/
|
||||
static nsViewportInfo GetViewportInfo(nsIDocument* aDocument,
|
||||
const mozilla::ScreenIntSize& aDisplaySize);
|
||||
|
||||
// Call EnterMicroTask when you're entering JS execution.
|
||||
// Usually the best way to do this is to use nsAutoMicroTask.
|
||||
static void EnterMicroTask();
|
||||
|
|
|
@ -298,7 +298,7 @@ nsDOMWindowUtils::GetViewportInfo(uint32_t aDisplayWidth,
|
|||
nsIDocument* doc = GetDocument();
|
||||
NS_ENSURE_STATE(doc);
|
||||
|
||||
nsViewportInfo info = nsContentUtils::GetViewportInfo(doc, ScreenIntSize(aDisplayWidth, aDisplayHeight));
|
||||
nsViewportInfo info = doc->GetViewportInfo(ScreenIntSize(aDisplayWidth, aDisplayHeight));
|
||||
*aDefaultZoom = info.GetDefaultZoom().scale;
|
||||
*aAllowZoom = info.IsZoomAllowed();
|
||||
*aMinZoom = info.GetMinZoom().scale;
|
||||
|
|
|
@ -732,6 +732,19 @@ public:
|
|||
*/
|
||||
Element* GetRootElement() const;
|
||||
|
||||
/**
|
||||
* Retrieve information about the viewport as a data structure.
|
||||
* This will return information in the viewport META data section
|
||||
* of the document. This can be used in lieu of ProcessViewportInfo(),
|
||||
* which places the viewport information in the document header instead
|
||||
* of returning it directly.
|
||||
*
|
||||
* @param aDisplaySize size of the on-screen display area for this
|
||||
* document, in device pixels.
|
||||
*
|
||||
* NOTE: If the site is optimized for mobile (via the doctype), this
|
||||
* will return viewport information that specifies default information.
|
||||
*/
|
||||
virtual nsViewportInfo GetViewportInfo(const mozilla::ScreenIntSize& aDisplaySize) = 0;
|
||||
|
||||
/**
|
||||
|
|
|
@ -19,7 +19,7 @@ static const mozilla::CSSIntSize kViewportMaxSize(10000, 10000);
|
|||
|
||||
/**
|
||||
* Information retrieved from the <meta name="viewport"> tag. See
|
||||
* nsContentUtils::GetViewportInfo for more information on this functionality.
|
||||
* nsIDocument::GetViewportInfo for more information on this functionality.
|
||||
*/
|
||||
class MOZ_STACK_CLASS nsViewportInfo
|
||||
{
|
||||
|
@ -70,7 +70,7 @@ class MOZ_STACK_CLASS nsViewportInfo
|
|||
|
||||
/**
|
||||
* Constrain the viewport calculations from the
|
||||
* nsContentUtils::GetViewportInfo() function in order to always return
|
||||
* nsIDocument::GetViewportInfo() function in order to always return
|
||||
* sane minimum/maximum values.
|
||||
*/
|
||||
void ConstrainViewportValues();
|
||||
|
|
|
@ -267,8 +267,7 @@ MobileViewportManager::RefreshViewportSize(bool aForceAdjustResolution)
|
|||
|
||||
ScreenIntSize displaySize = ViewAs<ScreenPixel>(
|
||||
mDisplaySize, PixelCastJustification::LayoutDeviceIsScreenForBounds);
|
||||
nsViewportInfo viewportInfo = nsContentUtils::GetViewportInfo(
|
||||
mDocument, displaySize);
|
||||
nsViewportInfo viewportInfo = mDocument->GetViewportInfo(displaySize);
|
||||
|
||||
CSSSize viewport = viewportInfo.GetSize();
|
||||
MVM_LOG("%p: Computed CSS viewport %s\n", this, Stringify(viewport).c_str());
|
||||
|
|
|
@ -197,8 +197,7 @@ ZoomConstraintsClient::RefreshZoomConstraints()
|
|||
return;
|
||||
}
|
||||
|
||||
nsViewportInfo viewportInfo = nsContentUtils::GetViewportInfo(
|
||||
mDocument,
|
||||
nsViewportInfo viewportInfo = mDocument->GetViewportInfo(
|
||||
ViewAs<ScreenPixel>(screenSize, PixelCastJustification::LayoutDeviceIsScreenForBounds));
|
||||
|
||||
mozilla::layers::ZoomConstraints zoomConstraints =
|
||||
|
|
|
@ -10860,7 +10860,7 @@ nsIPresShell::RecomputeFontSizeInflationEnabled()
|
|||
screen->GetRect(&screenLeft, &screenTop, &screenWidth, &screenHeight);
|
||||
|
||||
nsViewportInfo vInf =
|
||||
nsContentUtils::GetViewportInfo(GetDocument(), ScreenIntSize(screenWidth, screenHeight));
|
||||
GetDocument()->GetViewportInfo(ScreenIntSize(screenWidth, screenHeight));
|
||||
|
||||
if (vInf.GetDefaultZoom() >= CSSToScreenScale(1.0f) || vInf.IsAutoSizeEnabled()) {
|
||||
mFontSizeInflationEnabled = false;
|
||||
|
|
Загрузка…
Ссылка в новой задаче