Bug 1157951 patch 2 - Make nsCharClipDisplayItem aware of vertical writing modes. r=roc

This commit is contained in:
Jonathan Kew 2015-04-29 08:18:53 +01:00
parent d5046e2945
commit 7aa0db553c
2 changed files with 14 additions and 5 deletions

View File

@ -3625,9 +3625,17 @@ public:
nscoord aVisIStartEdge, nscoord aVisIEndEdge) {
nsRect r = aItem.Frame()->GetScrollableOverflowRect() +
aItem.ToReferenceFrame();
mVisIStart = aVisIStartEdge > 0 ? r.x + aVisIStartEdge : nscoord_MIN;
mVisIEnd = aVisIEndEdge > 0
? std::max(r.XMost() - aVisIEndEdge, mVisIStart) : nscoord_MAX;
if (aItem.Frame()->GetWritingMode().IsVertical()) {
mVisIStart = aVisIStartEdge > 0 ? r.y + aVisIStartEdge : nscoord_MIN;
mVisIEnd =
aVisIEndEdge > 0 ? std::max(r.YMost() - aVisIEndEdge, mVisIStart)
: nscoord_MAX;
} else {
mVisIStart = aVisIStartEdge > 0 ? r.x + aVisIStartEdge : nscoord_MIN;
mVisIEnd =
aVisIEndEdge > 0 ? std::max(r.XMost() - aVisIEndEdge, mVisIStart)
: nscoord_MAX;
}
}
void Intersect(nscoord* aVisIStart, nscoord* aVisISize) const {
nscoord end = *aVisIStart + *aVisISize;

View File

@ -6311,8 +6311,9 @@ nsTextFrame::DrawTextRunAndDecorations(
const nsSize frameSize = GetSize();
nscoord measure = verticalRun ? frameSize.height : frameSize.width;
// XXX todo: probably should have a vertical version of this...
if (!verticalRun) {
if (verticalRun) {
aClipEdges.Intersect(&y, &measure);
} else {
aClipEdges.Intersect(&x, &measure);
}