зеркало из https://github.com/mozilla/gecko-dev.git
Bug 839956 - Size and position text decorations on SVG text correctly when a font size scale factor is in effect. r=roc
This commit is contained in:
Родитель
72d66f20d9
Коммит
cdb0009c50
|
@ -26,6 +26,7 @@
|
|||
#include "nsStyleContext.h"
|
||||
#include "nsStyleStruct.h"
|
||||
#include "nsStyleStructInlines.h"
|
||||
#include "nsSVGTextFrame2.h"
|
||||
#include "nsCoord.h"
|
||||
#include "nsRenderingContext.h"
|
||||
#include "nsIPresShell.h"
|
||||
|
@ -4830,6 +4831,21 @@ nsTextFrame::GetTextDecorations(
|
|||
}
|
||||
}
|
||||
|
||||
static float
|
||||
GetInflationForTextDecorations(nsIFrame* aFrame, nscoord aInflationMinFontSize)
|
||||
{
|
||||
if (aFrame->IsSVGText()) {
|
||||
const nsIFrame* container = aFrame;
|
||||
while (container->GetType() != nsGkAtoms::svgTextFrame2) {
|
||||
container = container->GetParent();
|
||||
}
|
||||
NS_ASSERTION(container, "expected to find an ancestor nsSVGTextFrame2");
|
||||
return
|
||||
static_cast<const nsSVGTextFrame2*>(container)->GetFontSizeScaleFactor();
|
||||
}
|
||||
return nsLayoutUtils::FontSizeInflationInner(aFrame, aInflationMinFontSize);
|
||||
}
|
||||
|
||||
void
|
||||
nsTextFrame::UnionAdditionalOverflow(nsPresContext* aPresContext,
|
||||
const nsHTMLReflowState& aBlockReflowState,
|
||||
|
@ -4909,8 +4925,8 @@ nsTextFrame::UnionAdditionalOverflow(nsPresContext* aPresContext,
|
|||
decorationStyle = NS_STYLE_TEXT_DECORATION_STYLE_SOLID;
|
||||
}
|
||||
|
||||
float inflation = nsLayoutUtils::FontSizeInflationInner(dec.mFrame,
|
||||
inflationMinFontSize);
|
||||
float inflation =
|
||||
GetInflationForTextDecorations(dec.mFrame, inflationMinFontSize);
|
||||
const gfxFont::Metrics metrics =
|
||||
GetFirstFontMetrics(GetFontGroupForFrame(dec.mFrame, inflation));
|
||||
|
||||
|
@ -4934,8 +4950,8 @@ nsTextFrame::UnionAdditionalOverflow(nsPresContext* aPresContext,
|
|||
decorationStyle = NS_STYLE_TEXT_DECORATION_STYLE_SOLID;
|
||||
}
|
||||
|
||||
float inflation = nsLayoutUtils::FontSizeInflationInner(dec.mFrame,
|
||||
inflationMinFontSize);
|
||||
float inflation =
|
||||
GetInflationForTextDecorations(dec.mFrame, inflationMinFontSize);
|
||||
const gfxFont::Metrics metrics =
|
||||
GetFirstFontMetrics(GetFontGroupForFrame(dec.mFrame, inflation));
|
||||
|
||||
|
@ -4959,8 +4975,8 @@ nsTextFrame::UnionAdditionalOverflow(nsPresContext* aPresContext,
|
|||
decorationStyle = NS_STYLE_TEXT_DECORATION_STYLE_SOLID;
|
||||
}
|
||||
|
||||
float inflation = nsLayoutUtils::FontSizeInflationInner(dec.mFrame,
|
||||
inflationMinFontSize);
|
||||
float inflation =
|
||||
GetInflationForTextDecorations(dec.mFrame, inflationMinFontSize);
|
||||
const gfxFont::Metrics metrics =
|
||||
GetFirstFontMetrics(GetFontGroupForFrame(dec.mFrame, inflation));
|
||||
|
||||
|
@ -6050,8 +6066,8 @@ nsTextFrame::DrawTextRunAndDecorations(
|
|||
continue;
|
||||
}
|
||||
|
||||
float inflation = nsLayoutUtils::FontSizeInflationInner(dec.mFrame,
|
||||
inflationMinFontSize);
|
||||
float inflation =
|
||||
GetInflationForTextDecorations(dec.mFrame, inflationMinFontSize);
|
||||
const gfxFont::Metrics metrics =
|
||||
GetFirstFontMetrics(GetFontGroupForFrame(dec.mFrame, inflation));
|
||||
|
||||
|
@ -6070,8 +6086,8 @@ nsTextFrame::DrawTextRunAndDecorations(
|
|||
continue;
|
||||
}
|
||||
|
||||
float inflation = nsLayoutUtils::FontSizeInflationInner(dec.mFrame,
|
||||
inflationMinFontSize);
|
||||
float inflation =
|
||||
GetInflationForTextDecorations(dec.mFrame, inflationMinFontSize);
|
||||
const gfxFont::Metrics metrics =
|
||||
GetFirstFontMetrics(GetFontGroupForFrame(dec.mFrame, inflation));
|
||||
|
||||
|
@ -6096,8 +6112,8 @@ nsTextFrame::DrawTextRunAndDecorations(
|
|||
continue;
|
||||
}
|
||||
|
||||
float inflation = nsLayoutUtils::FontSizeInflationInner(dec.mFrame,
|
||||
inflationMinFontSize);
|
||||
float inflation =
|
||||
GetInflationForTextDecorations(dec.mFrame, inflationMinFontSize);
|
||||
const gfxFont::Metrics metrics =
|
||||
GetFirstFontMetrics(GetFontGroupForFrame(dec.mFrame, inflation));
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@ default-preferences pref(svg.text.css-frames.enabled,true)
|
|||
== simple.svg simple-ref.html
|
||||
== simple-2.svg simple.svg
|
||||
== simple-underline.svg simple-underline-ref.html
|
||||
== simple-underline-scaled.svg simple-underline-scaled-ref.svg
|
||||
== simple-anchor-end-bidi.svg simple-anchor-end-bidi-ref.html
|
||||
== simple-anchor-end-rtl.svg simple-anchor-end-rtl-ref.html
|
||||
== simple-anchor-end.svg simple-anchor-end-ref.html
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg">
|
||||
<text x="20" y="100" style="font: 64px sans-serif; text-decoration: underline">Hello</text>
|
||||
</svg>
|
После Ширина: | Высота: | Размер: 142 B |
|
@ -0,0 +1,3 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg">
|
||||
<text x="10" y="50" style="font: 32px sans-serif; text-decoration: underline" transform="scale(2)">Hello</text>
|
||||
</svg>
|
После Ширина: | Высота: | Размер: 162 B |
Загрузка…
Ссылка в новой задаче