mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-15 06:15:43 +00:00
Bug 987605. Call MaybeReflowForInflationScreenWidthChange on SetScrollPositionClampingScrollPortSize instead of SetDisplayPortForElement. r=dbaron
The scroll position clamping scroll port size is more closely related to the screen size then the display port.
This commit is contained in:
parent
db38b1cee4
commit
44b5860385
@ -322,49 +322,6 @@ nsDOMWindowUtils::GetViewportInfo(uint32_t aDisplayWidth,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
static void
|
||||
MaybeReflowForInflationScreenWidthChange(nsPresContext *aPresContext)
|
||||
{
|
||||
if (aPresContext) {
|
||||
nsIPresShell* presShell = aPresContext->GetPresShell();
|
||||
bool fontInflationWasEnabled = presShell->FontSizeInflationEnabled();
|
||||
presShell->NotifyFontSizeInflationEnabledIsDirty();
|
||||
bool changed = false;
|
||||
if (presShell && presShell->FontSizeInflationEnabled() &&
|
||||
presShell->FontSizeInflationMinTwips() != 0) {
|
||||
aPresContext->ScreenWidthInchesForFontInflation(&changed);
|
||||
}
|
||||
|
||||
changed = changed ||
|
||||
(fontInflationWasEnabled != presShell->FontSizeInflationEnabled());
|
||||
if (changed) {
|
||||
nsCOMPtr<nsIDocShell> docShell = aPresContext->GetDocShell();
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMWindowUtils::SetDisplayPortForElement(float aXPx, float aYPx,
|
||||
float aWidthPx, float aHeightPx,
|
||||
@ -414,14 +371,6 @@ nsDOMWindowUtils::SetDisplayPortForElement(float aXPx, float aYPx,
|
||||
// We are setting a root displayport for a document.
|
||||
// The pres shell needs a special flag set.
|
||||
presShell->SetIgnoreViewportScrolling(true);
|
||||
|
||||
// When the "font.size.inflation.minTwips" preference is set, the
|
||||
// layout depends on the size of the screen. Since when the size
|
||||
// of the screen changes, the root displayport also changes, we
|
||||
// hook in the needed updates here rather than adding a
|
||||
// separate notification just for this change.
|
||||
nsPresContext* presContext = GetPresContext();
|
||||
MaybeReflowForInflationScreenWidthChange(presContext);
|
||||
}
|
||||
|
||||
nsIFrame* rootFrame = presShell->FrameManager()->GetRootFrame();
|
||||
@ -3361,6 +3310,49 @@ nsDOMWindowUtils::GetPlugins(JSContext* cx, JS::MutableHandle<JS::Value> aPlugin
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
static void
|
||||
MaybeReflowForInflationScreenWidthChange(nsPresContext *aPresContext)
|
||||
{
|
||||
if (aPresContext) {
|
||||
nsIPresShell* presShell = aPresContext->GetPresShell();
|
||||
bool fontInflationWasEnabled = presShell->FontSizeInflationEnabled();
|
||||
presShell->NotifyFontSizeInflationEnabledIsDirty();
|
||||
bool changed = false;
|
||||
if (presShell && presShell->FontSizeInflationEnabled() &&
|
||||
presShell->FontSizeInflationMinTwips() != 0) {
|
||||
aPresContext->ScreenWidthInchesForFontInflation(&changed);
|
||||
}
|
||||
|
||||
changed = changed ||
|
||||
(fontInflationWasEnabled != presShell->FontSizeInflationEnabled());
|
||||
if (changed) {
|
||||
nsCOMPtr<nsIDocShell> docShell = aPresContext->GetDocShell();
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMWindowUtils::SetScrollPositionClampingScrollPortSize(float aWidth, float aHeight)
|
||||
{
|
||||
@ -3381,6 +3373,14 @@ nsDOMWindowUtils::SetScrollPositionClampingScrollPortSize(float aWidth, float aH
|
||||
nsPresContext::CSSPixelsToAppUnits(aWidth),
|
||||
nsPresContext::CSSPixelsToAppUnits(aHeight));
|
||||
|
||||
// When the "font.size.inflation.minTwips" preference is set, the
|
||||
// layout depends on the size of the screen. Since when the size
|
||||
// of the screen changes, the scroll position clamping scroll port
|
||||
// size also changes, we hook in the needed updates here rather
|
||||
// than adding a separate notification just for this change.
|
||||
nsPresContext* presContext = GetPresContext();
|
||||
MaybeReflowForInflationScreenWidthChange(presContext);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user