Bug 1146754 - Show selection highlighting for trailing space. r=mats

This commit is contained in:
Jonathan Kew 2015-04-01 14:45:16 +01:00
Родитель 4e246efbb9
Коммит 0aaa1c57da
3 изменённых файлов: 14 добавлений и 5 удалений

Просмотреть файл

@ -929,8 +929,15 @@ gfxTextRun::BreakAndMeasureText(uint32_t aStart, uint32_t aMaxLength,
}
if (aMetrics) {
*aMetrics = MeasureText(aStart, charsFit - trimmableChars,
*aMetrics = MeasureText(aStart, charsFit,
aBoundingBoxType, aRefContext, aProvider);
if (trimmableChars) {
Metrics trimMetrics =
MeasureText(aStart + charsFit - trimmableChars,
trimmableChars, aBoundingBoxType,
aRefContext, aProvider);
aMetrics->mAdvanceWidth -= trimMetrics.mAdvanceWidth;
}
}
if (aTrimWhitespace) {
*aTrimWhitespace = trimmableAdvance;

Просмотреть файл

@ -6122,8 +6122,9 @@ nsTextFrame::PaintText(nsRenderingContext* aRenderingContext, nsPoint aPt,
return;
PropertyProvider provider(this, iter, nsTextFrame::eInflated);
// Trim trailing whitespace
provider.InitializeForDisplay(true);
// Trim trailing whitespace, unless we're painting a selection highlight,
// which should include trailing spaces if present (bug 1146754).
provider.InitializeForDisplay(!IsSelected());
gfxContext* ctx = aRenderingContext->ThebesContext();
const bool rtl = mTextRun->IsRightToLeft();
@ -8696,7 +8697,8 @@ nsTextFrame::RecomputeOverflow(nsIFrame* aBlockFrame)
return result;
PropertyProvider provider(this, iter, nsTextFrame::eInflated);
provider.InitializeForDisplay(true);
// Don't trim trailing space, in case we need to paint it as selected.
provider.InitializeForDisplay(false);
gfxTextRun::Metrics textMetrics =
mTextRun->MeasureText(provider.GetStart().GetSkippedOffset(),

Просмотреть файл

@ -34,4 +34,4 @@ random-if(Android||B2G||Mulet) fails-if(cocoaWidget) needs-focus == themed-widge
== splitText-normalize.html splitText-normalize-ref.html
== modify-range.html modify-range-ref.html
== dom-mutations.html dom-mutations-ref.html
fails == trailing-space-1.html trailing-space-1-ref.html # bug 1146754
== trailing-space-1.html trailing-space-1-ref.html