зеркало из https://github.com/mozilla/pjs.git
Bug 703133: Flush layout data asynchronously on charset changes. r=bz
This commit is contained in:
Родитель
d72756ae01
Коммит
e940423e6c
|
@ -119,6 +119,31 @@
|
|||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
|
||||
namespace {
|
||||
|
||||
class CharSetChangingRunnable : public nsRunnable
|
||||
{
|
||||
public:
|
||||
CharSetChangingRunnable(nsPresContext* aPresContext,
|
||||
const nsCString& aCharSet)
|
||||
: mPresContext(aPresContext),
|
||||
mCharSet(aCharSet)
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMETHOD Run()
|
||||
{
|
||||
mPresContext->DoChangeCharSet(mCharSet);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
private:
|
||||
nsRefPtr<nsPresContext> mPresContext;
|
||||
nsCString mCharSet;
|
||||
};
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
static nscolor
|
||||
MakeColorPref(const nsString& aColor)
|
||||
{
|
||||
|
@ -1072,7 +1097,15 @@ nsPresContext::DestroyImageLoaders()
|
|||
}
|
||||
|
||||
void
|
||||
nsPresContext::UpdateCharSet(const nsAFlatCString& aCharSet)
|
||||
nsPresContext::DoChangeCharSet(const nsCString& aCharSet)
|
||||
{
|
||||
UpdateCharSet(aCharSet);
|
||||
mDeviceContext->FlushFontCache();
|
||||
RebuildAllStyleData(NS_STYLE_HINT_REFLOW);
|
||||
}
|
||||
|
||||
void
|
||||
nsPresContext::UpdateCharSet(const nsCString& aCharSet)
|
||||
{
|
||||
if (mLangService) {
|
||||
NS_IF_RELEASE(mLanguage);
|
||||
|
@ -1112,10 +1145,9 @@ nsPresContext::Observe(nsISupports* aSubject,
|
|||
const PRUnichar* aData)
|
||||
{
|
||||
if (!nsCRT::strcmp(aTopic, "charset")) {
|
||||
UpdateCharSet(NS_LossyConvertUTF16toASCII(aData));
|
||||
mDeviceContext->FlushFontCache();
|
||||
RebuildAllStyleData(NS_STYLE_HINT_REFLOW);
|
||||
return NS_OK;
|
||||
nsRefPtr<CharSetChangingRunnable> runnable =
|
||||
new CharSetChangingRunnable(this, NS_LossyConvertUTF16toASCII(aData));
|
||||
return NS_DispatchToCurrentThread(runnable);
|
||||
}
|
||||
|
||||
NS_WARNING("unrecognized topic in nsPresContext::Observe");
|
||||
|
|
|
@ -1009,8 +1009,12 @@ protected:
|
|||
NS_HIDDEN_(void) GetUserPreferences();
|
||||
NS_HIDDEN_(void) GetFontPreferences();
|
||||
|
||||
NS_HIDDEN_(void) UpdateCharSet(const nsAFlatCString& aCharSet);
|
||||
NS_HIDDEN_(void) UpdateCharSet(const nsCString& aCharSet);
|
||||
|
||||
public:
|
||||
void DoChangeCharSet(const nsCString& aCharSet);
|
||||
|
||||
protected:
|
||||
void InvalidateThebesLayers();
|
||||
void AppUnitsPerDevPixelChanged();
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче