Bug 1224013 part 3 - Render text-emphasis outside ruby. r=jfkthame
This commit is contained in:
@@ -52,6 +52,7 @@
|
||||
#include "nsExpirationTracker.h"
|
||||
#include "nsUnicodeProperties.h"
|
||||
#include "nsStyleUtil.h"
|
||||
#include "nsRubyBaseContainerFrame.h"
|
||||
|
||||
#include "nsTextFragment.h"
|
||||
#include "nsGkAtoms.h"
|
||||
@@ -5155,6 +5156,19 @@ GenerateTextRunForEmphasisMarks(nsTextFrame* aFrame, nsFontMetrics* aFontMetrics
|
||||
ctx, appUnitsPerDevUnit, flags, nullptr);
|
||||
}
|
||||
|
||||
static nsRubyBaseContainerFrame*
|
||||
FindRubyBaseContainerAncestor(nsTextFrame* aFrame)
|
||||
{
|
||||
for (nsIFrame* frame = aFrame->GetParent();
|
||||
frame && frame->IsFrameOfType(nsIFrame::eLineParticipant);
|
||||
frame = frame->GetParent()) {
|
||||
if (frame->GetType() == nsGkAtoms::rubyBaseContainerFrame) {
|
||||
return static_cast<nsRubyBaseContainerFrame*>(frame);
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsRect
|
||||
nsTextFrame::UpdateTextEmphasis(WritingMode aWM, PropertyProvider& aProvider)
|
||||
{
|
||||
@@ -5188,14 +5202,18 @@ nsTextFrame::UpdateTextEmphasis(WritingMode aWM, PropertyProvider& aProvider)
|
||||
nscoord absOffset = (side == eLogicalSideBStart) != aWM.IsLineInverted() ?
|
||||
baseFontMetrics->MaxAscent() + fm->MaxDescent() :
|
||||
baseFontMetrics->MaxDescent() + fm->MaxAscent();
|
||||
// XXX emphasis marks should be drawn outside ruby, see bug 1224013.
|
||||
nscoord startLeading = 0;
|
||||
nscoord endLeading = 0;
|
||||
if (nsRubyBaseContainerFrame* rbc = FindRubyBaseContainerAncestor(this)) {
|
||||
rbc->GetBlockLeadings(&startLeading, &endLeading);
|
||||
}
|
||||
if (side == eLogicalSideBStart) {
|
||||
info->baselineOffset = -absOffset;
|
||||
overflowRect.BStart(aWM) = -overflowRect.BSize(aWM);
|
||||
info->baselineOffset = -absOffset - startLeading;
|
||||
overflowRect.BStart(aWM) = -overflowRect.BSize(aWM) - startLeading;
|
||||
} else {
|
||||
MOZ_ASSERT(side == eLogicalSideBEnd);
|
||||
info->baselineOffset = absOffset;
|
||||
overflowRect.BStart(aWM) = frameSize.BSize(aWM);
|
||||
info->baselineOffset = absOffset + endLeading;
|
||||
overflowRect.BStart(aWM) = frameSize.BSize(aWM) + endLeading;
|
||||
}
|
||||
|
||||
Properties().Set(EmphasisMarkProperty(), info);
|
||||
|
||||
Reference in New Issue
Block a user