forked from mirrors/gecko-dev
Bug 546530. Bound search for previous cluster start. r=smontagu
--HG-- extra : rebase_source : 5b7bca2777b5cfc5495fc9d339eaf0fbe1ff9a64
This commit is contained in:
parent
7f57711ea0
commit
ddd804576e
1 changed files with 11 additions and 10 deletions
|
|
@ -2344,10 +2344,10 @@ PropertyProvider::ComputeJustifiableCharacters(PRInt32 aOffset, PRInt32 aLength)
|
|||
/**
|
||||
* Finds the offset of the first character of the cluster containing aPos
|
||||
*/
|
||||
static void FindClusterStart(gfxTextRun* aTextRun,
|
||||
static void FindClusterStart(gfxTextRun* aTextRun, PRInt32 aOriginalStart,
|
||||
gfxSkipCharsIterator* aPos)
|
||||
{
|
||||
while (aPos->GetOriginalOffset() > 0) {
|
||||
while (aPos->GetOriginalOffset() > aOriginalStart) {
|
||||
if (aPos->IsOriginalCharSkipped() ||
|
||||
aTextRun->IsClusterStart(aPos->GetSkippedOffset())) {
|
||||
break;
|
||||
|
|
@ -2464,13 +2464,14 @@ PropertyProvider::GetSpacingInternal(PRUint32 aStart, PRUint32 aLength,
|
|||
while (run.NextRun()) {
|
||||
PRInt32 i;
|
||||
gfxSkipCharsIterator iter = run.GetPos();
|
||||
PRInt32 runOriginalOffset = run.GetOriginalOffset();
|
||||
for (i = 0; i < run.GetRunLength(); ++i) {
|
||||
PRInt32 originalOffset = run.GetOriginalOffset() + i;
|
||||
if (IsJustifiableCharacter(mFrag, originalOffset, isCJK)) {
|
||||
iter.SetOriginalOffset(originalOffset);
|
||||
FindClusterStart(mTextRun, &iter);
|
||||
PRInt32 iterOriginalOffset = runOriginalOffset + i;
|
||||
if (IsJustifiableCharacter(mFrag, iterOriginalOffset, isCJK)) {
|
||||
iter.SetOriginalOffset(iterOriginalOffset);
|
||||
FindClusterStart(mTextRun, runOriginalOffset, &iter);
|
||||
PRUint32 clusterFirstChar = iter.GetSkippedOffset();
|
||||
FindClusterEnd(mTextRun, run.GetOriginalOffset() + run.GetRunLength(), &iter);
|
||||
FindClusterEnd(mTextRun, runOriginalOffset + run.GetRunLength(), &iter);
|
||||
PRUint32 clusterLastChar = iter.GetSkippedOffset();
|
||||
// Only apply justification to characters before justificationEnd
|
||||
if (clusterFirstChar >= justificationStart.GetSkippedOffset() &&
|
||||
|
|
@ -5065,7 +5066,7 @@ nsTextFrame::SetSelectedRange(PRUint32 aStart,
|
|||
PRBool anySelected = PR_FALSE;
|
||||
|
||||
nsTextFrame* f = this;
|
||||
while (f && f->GetContentEnd() <= aStart) {
|
||||
while (f && f->GetContentEnd() <= PRInt32(aStart)) {
|
||||
if (f->GetStateBits() & NS_FRAME_SELECTED_CONTENT) {
|
||||
anySelected = PR_TRUE;
|
||||
}
|
||||
|
|
@ -5073,7 +5074,7 @@ nsTextFrame::SetSelectedRange(PRUint32 aStart,
|
|||
}
|
||||
|
||||
nsPresContext* presContext = PresContext();
|
||||
while (f && f->GetContentOffset() < aEnd) {
|
||||
while (f && f->GetContentOffset() < PRInt32(aEnd)) {
|
||||
if (aSelected) {
|
||||
f->AddStateBits(NS_FRAME_SELECTED_CONTENT);
|
||||
anySelected = PR_TRUE;
|
||||
|
|
@ -5168,7 +5169,7 @@ nsTextFrame::GetPointFromOffset(PRInt32 inOffset,
|
|||
!iter.IsOriginalCharSkipped() &&
|
||||
!mTextRun->IsClusterStart(iter.GetSkippedOffset())) {
|
||||
NS_WARNING("GetPointFromOffset called for non-cluster boundary");
|
||||
FindClusterStart(mTextRun, &iter);
|
||||
FindClusterStart(mTextRun, trimmedOffset, &iter);
|
||||
}
|
||||
|
||||
gfxFloat advanceWidth =
|
||||
|
|
|
|||
Loading…
Reference in a new issue