mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 855183 - Reflow SVG text sooner on full page zoom. r=longsonr
This commit is contained in:
parent
24e98ae4ef
commit
feacf22d88
@ -2824,14 +2824,20 @@ NS_IMETHODIMP
|
||||
GlyphMetricsUpdater::Run()
|
||||
{
|
||||
if (mFrame) {
|
||||
mFrame->mPositioningDirty = true;
|
||||
nsSVGUtils::InvalidateBounds(mFrame, false);
|
||||
nsSVGUtils::ScheduleReflowSVG(mFrame);
|
||||
mFrame->mGlyphMetricsUpdater = nullptr;
|
||||
Run(mFrame);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
GlyphMetricsUpdater::Run(nsSVGTextFrame2* aFrame)
|
||||
{
|
||||
aFrame->mPositioningDirty = true;
|
||||
nsSVGUtils::InvalidateBounds(aFrame, false);
|
||||
nsSVGUtils::ScheduleReflowSVG(aFrame);
|
||||
aFrame->mGlyphMetricsUpdater = nullptr;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
@ -4645,25 +4651,34 @@ nsSVGTextFrame2::ShouldRenderAsPath(nsRenderingContext* aContext,
|
||||
}
|
||||
|
||||
void
|
||||
nsSVGTextFrame2::NotifyGlyphMetricsChange()
|
||||
nsSVGTextFrame2::NotifyGlyphMetricsChange(uint32_t aFlags)
|
||||
{
|
||||
// We need to perform the operations in GlyphMetricsUpdater in a
|
||||
// script runner since we can get called just after a DOM mutation,
|
||||
// before frames have been reconstructed, and UpdateGlyphPositioning
|
||||
// will be called with out-of-date frames. This occurs when the
|
||||
// <text> element is being filtered, as the InvalidateBounds()
|
||||
// call needs to call in to GetBBoxContribution() to determine the
|
||||
// filtered region, and that needs to iterate over the text frames.
|
||||
// We would flush frame construction, but that needs to be done
|
||||
// inside a script runner.
|
||||
//
|
||||
// Much of the time, this will perform the GlyphMetricsUpdater
|
||||
// operations immediately.
|
||||
if (mGlyphMetricsUpdater) {
|
||||
NS_ASSERTION(!aFlags || aFlags == ePositioningDirtyDueToMutation,
|
||||
"unexpected aFlags value");
|
||||
|
||||
if (aFlags == ePositioningDirtyDueToMutation) {
|
||||
// We need to perform the operations in GlyphMetricsUpdater in a
|
||||
// script runner since we can get called just after a DOM mutation,
|
||||
// before frames have been reconstructed, and UpdateGlyphPositioning
|
||||
// will be called with out-of-date frames. This occurs when the
|
||||
// <text> element is being filtered, as the InvalidateBounds()
|
||||
// call needs to call in to GetBBoxContribution() to determine the
|
||||
// filtered region, and that needs to iterate over the text frames.
|
||||
// We would flush frame construction, but that needs to be done
|
||||
// inside a script runner.
|
||||
//
|
||||
// Much of the time, this will perform the GlyphMetricsUpdater
|
||||
// operations immediately.
|
||||
if (mGlyphMetricsUpdater) {
|
||||
return;
|
||||
}
|
||||
mGlyphMetricsUpdater = new GlyphMetricsUpdater(this);
|
||||
nsContentUtils::AddScriptRunner(mGlyphMetricsUpdater.get());
|
||||
return;
|
||||
}
|
||||
mGlyphMetricsUpdater = new GlyphMetricsUpdater(this);
|
||||
nsContentUtils::AddScriptRunner(mGlyphMetricsUpdater.get());
|
||||
|
||||
// Otherwise, we perform the glyph metrics update immediately.
|
||||
GlyphMetricsUpdater::Run(this);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -127,6 +127,7 @@ class GlyphMetricsUpdater : public nsRunnable {
|
||||
public:
|
||||
NS_DECL_NSIRUNNABLE
|
||||
GlyphMetricsUpdater(nsSVGTextFrame2* aFrame) : mFrame(aFrame) { }
|
||||
static void Run(nsSVGTextFrame2* aFrame);
|
||||
void Revoke() { mFrame = nullptr; }
|
||||
private:
|
||||
nsSVGTextFrame2* mFrame;
|
||||
@ -274,9 +275,16 @@ public:
|
||||
|
||||
/**
|
||||
* Schedules mPositions to be recomputed and the covered region to be
|
||||
* updated.
|
||||
* updated. The aFlags argument can take the ePositioningDirtyDueToMutation
|
||||
* value to indicate that glyph metrics need to be recomputed due to
|
||||
* a DOM mutation in the <text> element on one of its descendants.
|
||||
*/
|
||||
void NotifyGlyphMetricsChange();
|
||||
void NotifyGlyphMetricsChange(uint32_t aFlags = 0);
|
||||
|
||||
/**
|
||||
* Enum for NotifyGlyphMetricsChange's aFlags argument.
|
||||
*/
|
||||
enum { ePositioningDirtyDueToMutation = 1 };
|
||||
|
||||
/**
|
||||
* Updates the mFontSizeScaleFactor value by looking at the range of
|
||||
|
Loading…
Reference in New Issue
Block a user