Bug 938626, be more consistent when handling pref changes in PresContext, r=tn

--HG--
extra : rebase_source : a88316df079f54fd17dc9350b0590f60f8fe4f32
This commit is contained in:
Olli Pettay 2013-11-17 22:49:52 +02:00
Родитель 1b0e7b4249
Коммит 16085ef473
1 изменённых файлов: 10 добавлений и 3 удалений

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

@ -143,7 +143,8 @@ nsPresContext::IsDOMPaintEventPending()
int
nsPresContext::PrefChangedCallback(const char* aPrefName, void* instance_data)
{
nsPresContext* presContext = (nsPresContext*)instance_data;
nsRefPtr<nsPresContext> presContext =
static_cast<nsPresContext*>(instance_data);
NS_ASSERTION(nullptr != presContext, "bad instance data");
if (nullptr != presContext) {
@ -806,7 +807,9 @@ nsPresContext::AppUnitsPerDevPixelChanged()
{
InvalidateThebesLayers();
mDeviceContext->FlushFontCache();
if (mDeviceContext) {
mDeviceContext->FlushFontCache();
}
if (HasCachedStyleData()) {
// All cached style data must be recomputed.
@ -824,10 +827,14 @@ nsPresContext::PreferenceChanged(const char* aPrefName)
prefName.EqualsLiteral("layout.css.devPixelsPerPx")) {
int32_t oldAppUnitsPerDevPixel = AppUnitsPerDevPixel();
if (mDeviceContext->CheckDPIChange() && mShell) {
nsCOMPtr<nsIPresShell> shell = mShell;
// Re-fetch the view manager's window dimensions in case there's a deferred
// resize which hasn't affected our mVisibleArea yet
nscoord oldWidthAppUnits, oldHeightAppUnits;
nsViewManager* vm = mShell->GetViewManager();
nsRefPtr<nsViewManager> vm = shell->GetViewManager();
if (!vm) {
return;
}
vm->GetWindowDimensions(&oldWidthAppUnits, &oldHeightAppUnits);
float oldWidthDevPixels = oldWidthAppUnits/oldAppUnitsPerDevPixel;
float oldHeightDevPixels = oldHeightAppUnits/oldAppUnitsPerDevPixel;