Backed out 2 changesets (bug 862763) for bustage. a=backout

Backed out changeset 433c7839607d (bug 862763)
Backed out changeset b00d3311db25 (bug 862763)
This commit is contained in:
Ryan VanderMeulen 2013-05-16 21:48:33 -04:00
Родитель 0f1553463e
Коммит 3735ad15c9
5 изменённых файлов: 81 добавлений и 175 удалений

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

@ -294,36 +294,31 @@ MaybeReflowForInflationScreenWidthChange(nsPresContext *aPresContext)
{
if (aPresContext) {
nsIPresShell* presShell = aPresContext->GetPresShell();
bool fontInflationWasEnabled = presShell->FontSizeInflationEnabled();
presShell->NotifyFontSizeInflationEnabledIsDirty();
bool changed = false;
if (presShell && presShell->FontSizeInflationEnabled() &&
if (presShell && nsLayoutUtils::FontSizeInflationEnabled(aPresContext) &&
presShell->FontSizeInflationMinTwips() != 0) {
bool changed;
aPresContext->ScreenWidthInchesForFontInflation(&changed);
}
changed = changed ||
(fontInflationWasEnabled != presShell->FontSizeInflationEnabled());
if (changed) {
nsCOMPtr<nsISupports> container = aPresContext->GetContainer();
nsCOMPtr<nsIDocShell> docShell = do_QueryInterface(container);
if (docShell) {
nsCOMPtr<nsIContentViewer> cv;
docShell->GetContentViewer(getter_AddRefs(cv));
nsCOMPtr<nsIMarkupDocumentViewer> mudv = do_QueryInterface(cv);
if (mudv) {
nsTArray<nsCOMPtr<nsIMarkupDocumentViewer> > array;
mudv->AppendSubtree(array);
for (uint32_t i = 0, iEnd = array.Length(); i < iEnd; ++i) {
nsCOMPtr<nsIPresShell> shell;
nsCOMPtr<nsIContentViewer> cv = do_QueryInterface(array[i]);
cv->GetPresShell(getter_AddRefs(shell));
if (shell) {
nsIFrame *rootFrame = shell->GetRootFrame();
if (rootFrame) {
shell->FrameNeedsReflow(rootFrame,
nsIPresShell::eStyleChange,
NS_FRAME_IS_DIRTY);
if (changed) {
nsCOMPtr<nsISupports> container = aPresContext->GetContainer();
nsCOMPtr<nsIDocShell> docShell = do_QueryInterface(container);
if (docShell) {
nsCOMPtr<nsIContentViewer> cv;
docShell->GetContentViewer(getter_AddRefs(cv));
nsCOMPtr<nsIMarkupDocumentViewer> mudv = do_QueryInterface(cv);
if (mudv) {
nsTArray<nsCOMPtr<nsIMarkupDocumentViewer> > array;
mudv->AppendSubtree(array);
for (uint32_t i = 0, iEnd = array.Length(); i < iEnd; ++i) {
nsCOMPtr<nsIPresShell> shell;
nsCOMPtr<nsIContentViewer> cv = do_QueryInterface(array[i]);
cv->GetPresShell(getter_AddRefs(shell));
if (shell) {
nsIFrame *rootFrame = shell->GetRootFrame();
if (rootFrame) {
shell->FrameNeedsReflow(rootFrame,
nsIPresShell::eStyleChange,
NS_FRAME_IS_DIRTY);
}
}
}
}

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

@ -1306,25 +1306,6 @@ public:
return mFontSizeInflationDisabledInMasterProcess;
}
/**
* Determine if font size inflation is enabled. This value is cached until
* it becomes dirty.
*
* @returns true, if font size inflation is enabled; false otherwise.
*/
bool FontSizeInflationEnabled();
/**
* Notify the pres shell that an event occurred making the current value of
* mFontSizeInflationEnabled invalid. This will schedule a recomputation of
* whether font size inflation is enabled on the next call to
* FontSizeInflationEnabled().
*/
void NotifyFontSizeInflationEnabledIsDirty()
{
mFontSizeInflationEnabledIsDirty = true;
}
virtual void AddInvalidateHiddenPresShellObserver(nsRefreshDriver *aDriver) = 0;
void InvalidatePresShellIfHidden();
@ -1341,14 +1322,6 @@ protected:
mozFlushType aFlushType);
bool RemoveRefreshObserverInternal(nsARefreshObserver* aObserver,
mozFlushType aFlushType);
/**
* Do computations necessary to determine if font size inflation is enabled.
* This value is cached after computation, as the computation is somewhat
* expensive.
*/
void RecomputeFontSizeInflationEnabled();
public:
bool AddRefreshObserver(nsARefreshObserver* aObserver,
mozFlushType aFlushType) {
@ -1487,10 +1460,6 @@ protected:
uint32_t mFontSizeInflationLineThreshold;
bool mFontSizeInflationForceEnabled;
bool mFontSizeInflationDisabledInMasterProcess;
bool mFontSizeInflationEnabled;
// Dirty bit indicating that mFontSizeInflationEnabled needs to be recomputed.
bool mFontSizeInflationEnabledIsDirty;
// The maximum width of a line box. Text on a single line that exceeds this
// width will be wrapped. A value of 0 indicates that no limit is enforced.

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

@ -5171,9 +5171,64 @@ nsLayoutUtils::FontSizeInflationEnabled(nsPresContext *aPresContext)
{
nsIPresShell* presShell = aPresContext->GetPresShell();
if (!presShell) {
if (!presShell ||
(presShell->FontSizeInflationEmPerLine() == 0 &&
presShell->FontSizeInflationMinTwips() == 0) ||
aPresContext->IsChrome()) {
return false;
}
// Force-enabling font inflation always trumps the heuristics here.
if (!presShell->FontSizeInflationForceEnabled()) {
if (TabChild* tab = GetTabChildFrom(presShell)) {
// We're in a child process. Cancel inflation if we're not
// async-pan zoomed.
if (!tab->IsAsyncPanZoomEnabled()) {
return false;
}
} else if (XRE_GetProcessType() == GeckoProcessType_Default) {
// We're in the master process. Cancel inflation if it's been
// explicitly disabled.
if (presShell->FontSizeInflationDisabledInMasterProcess()) {
return false;
}
}
}
return presShell->FontSizeInflationEnabled();
// XXXjwir3:
// See bug 706918, comment 23 for more information on this particular section
// of the code. We're using "screen size" in place of the size of the content
// area, because on mobile, these are close or equal. This will work for our
// purposes (bug 706198), but it will need to be changed in the future to be
// more correct when we bring the rest of the viewport code into platform.
// We actually want the size of the content area, in the event that we don't
// have any metadata about the width and/or height. On mobile, the screen size
// and the size of the content area are very close, or the same value.
// In XUL fennec, the content area is the size of the <browser> widget, but
// in native fennec, the content area is the size of the Gecko LayerView
// object.
// TODO:
// Once bug 716575 has been resolved, this code should be changed so that it
// does the right thing on all platforms.
nsresult rv;
nsCOMPtr<nsIScreenManager> screenMgr =
do_GetService("@mozilla.org/gfx/screenmanager;1", &rv);
NS_ENSURE_SUCCESS(rv, false);
nsCOMPtr<nsIScreen> screen;
screenMgr->GetPrimaryScreen(getter_AddRefs(screen));
if (screen) {
int32_t screenLeft, screenTop, screenWidth, screenHeight;
screen->GetRect(&screenLeft, &screenTop, &screenWidth, &screenHeight);
ViewportInfo vInf =
nsContentUtils::GetViewportInfo(aPresContext->PresShell()->GetDocument(),
screenWidth, screenHeight);
if (vInf.defaultZoom >= 1.0 || vInf.autoSize) {
return false;
}
}
return true;
}

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

@ -87,7 +87,6 @@
#include "nsIBaseWindow.h"
#include "nsError.h"
#include "nsLayoutUtils.h"
#include "nsViewportInfo.h"
#include "nsCSSRendering.h"
// for |#ifdef DEBUG| code
#include "prenv.h"
@ -4076,12 +4075,6 @@ PresShell::ContentAppended(nsIDocument *aDocument,
mFrameConstructor->RestyleForAppend(aContainer->AsElement(), aFirstNewContent);
mFrameConstructor->ContentAppended(aContainer, aFirstNewContent, true);
if (static_cast<nsINode*>(aContainer) == static_cast<nsINode*>(aDocument) &&
aFirstNewContent->NodeType() == nsIDOMNode::DOCUMENT_TYPE_NODE) {
NotifyFontSizeInflationEnabledIsDirty();
}
VERIFY_STYLE_TREE;
}
@ -4107,13 +4100,6 @@ PresShell::ContentInserted(nsIDocument* aDocument,
mFrameConstructor->RestyleForInsertOrChange(aContainer->AsElement(), aChild);
mFrameConstructor->ContentInserted(aContainer, aChild, nullptr, true);
if (((!aContainer && aDocument) ||
(static_cast<nsINode*>(aContainer) == static_cast<nsINode*>(aDocument))) &&
aChild->NodeType() == nsIDOMNode::DOCUMENT_TYPE_NODE) {
NotifyFontSizeInflationEnabledIsDirty();
}
VERIFY_STYLE_TREE;
}
@ -4134,12 +4120,6 @@ PresShell::ContentRemoved(nsIDocument *aDocument,
// Notify the ESM that the content has been removed, so that
// it can clean up any state related to the content.
// XXX_jwir3: There is no null check for aDocument necessary, since, even
// though by nsIMutationObserver, aDocument could be null, the
// precondition check that mDocument == aDocument ensures that
// aDocument will not be null (since mDocument can't be null unless
// we're still intializing).
mPresContext->EventStateManager()->ContentRemoved(aDocument, aChild);
nsAutoCauseReflowNotifier crNotifier(this);
@ -4164,13 +4144,6 @@ PresShell::ContentRemoved(nsIDocument *aDocument,
nsCSSFrameConstructor::REMOVE_CONTENT,
&didReconstruct);
if (((aContainer &&
static_cast<nsINode*>(aContainer) == static_cast<nsINode*>(aDocument)) ||
aDocument) && aChild->NodeType() == nsIDOMNode::DOCUMENT_TYPE_NODE) {
NotifyFontSizeInflationEnabledIsDirty();
}
VERIFY_STYLE_TREE;
}
@ -9293,91 +9266,6 @@ PresShell::SetupFontInflation()
mFontSizeInflationLineThreshold = nsLayoutUtils::FontSizeInflationLineThreshold();
mFontSizeInflationForceEnabled = nsLayoutUtils::FontSizeInflationForceEnabled();
mFontSizeInflationDisabledInMasterProcess = nsLayoutUtils::FontSizeInflationDisabledInMasterProcess();
NotifyFontSizeInflationEnabledIsDirty();
}
void
nsIPresShell::RecomputeFontSizeInflationEnabled()
{
mFontSizeInflationEnabledIsDirty = false;
MOZ_ASSERT(mPresContext, "our pres context should not be null");
if ((FontSizeInflationEmPerLine() == 0 &&
FontSizeInflationMinTwips() == 0) || mPresContext->IsChrome()) {
mFontSizeInflationEnabled = false;
return;
}
// Force-enabling font inflation always trumps the heuristics here.
if (!FontSizeInflationForceEnabled()) {
if (TabChild* tab = GetTabChildFrom(this)) {
// We're in a child process. Cancel inflation if we're not
// async-pan zoomed.
if (!tab->IsAsyncPanZoomEnabled()) {
mFontSizeInflationEnabled = false;
return;
}
} else if (XRE_GetProcessType() == GeckoProcessType_Default) {
// We're in the master process. Cancel inflation if it's been
// explicitly disabled.
if (FontSizeInflationDisabledInMasterProcess()) {
mFontSizeInflationEnabled = false;
return;
}
}
}
// XXXjwir3:
// See bug 706918, comment 23 for more information on this particular section
// of the code. We're using "screen size" in place of the size of the content
// area, because on mobile, these are close or equal. This will work for our
// purposes (bug 706198), but it will need to be changed in the future to be
// more correct when we bring the rest of the viewport code into platform.
// We actually want the size of the content area, in the event that we don't
// have any metadata about the width and/or height. On mobile, the screen size
// and the size of the content area are very close, or the same value.
// In XUL fennec, the content area is the size of the <browser> widget, but
// in native fennec, the content area is the size of the Gecko LayerView
// object.
// TODO:
// Once bug 716575 has been resolved, this code should be changed so that it
// does the right thing on all platforms.
nsresult rv;
nsCOMPtr<nsIScreenManager> screenMgr =
do_GetService("@mozilla.org/gfx/screenmanager;1", &rv);
if (!NS_SUCCEEDED(rv)) {
mFontSizeInflationEnabled = false;
return;
}
nsCOMPtr<nsIScreen> screen;
screenMgr->GetPrimaryScreen(getter_AddRefs(screen));
if (screen) {
int32_t screenLeft, screenTop, screenWidth, screenHeight;
screen->GetRect(&screenLeft, &screenTop, &screenWidth, &screenHeight);
nsViewportInfo vInf =
nsContentUtils::GetViewportInfo(GetDocument(), screenWidth, screenHeight);
if (vInf.GetDefaultZoom() >= 1.0 || vInf.IsAutoSizeEnabled()) {
mFontSizeInflationEnabled = false;
return;
}
}
mFontSizeInflationEnabled = true;
}
bool
nsIPresShell::FontSizeInflationEnabled()
{
if (mFontSizeInflationEnabledIsDirty) {
RecomputeFontSizeInflationEnabled();
}
return mFontSizeInflationEnabled;
}
void

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

@ -385,8 +385,7 @@ protected:
void DoScrollContentIntoView();
/**
* Initialize cached font inflation preference values and do an initial
* computation to determine if font inflation is enabled.
* Initialize cached font inflation preference values.
*
* @see nsLayoutUtils::sFontSizeInflationEmPerLine
* @see nsLayoutUtils::sFontSizeInflationMinTwips