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
|
* 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)
|
gfxSkipCharsIterator* aPos)
|
||||||
{
|
{
|
||||||
while (aPos->GetOriginalOffset() > 0) {
|
while (aPos->GetOriginalOffset() > aOriginalStart) {
|
||||||
if (aPos->IsOriginalCharSkipped() ||
|
if (aPos->IsOriginalCharSkipped() ||
|
||||||
aTextRun->IsClusterStart(aPos->GetSkippedOffset())) {
|
aTextRun->IsClusterStart(aPos->GetSkippedOffset())) {
|
||||||
break;
|
break;
|
||||||
|
|
@ -2464,13 +2464,14 @@ PropertyProvider::GetSpacingInternal(PRUint32 aStart, PRUint32 aLength,
|
||||||
while (run.NextRun()) {
|
while (run.NextRun()) {
|
||||||
PRInt32 i;
|
PRInt32 i;
|
||||||
gfxSkipCharsIterator iter = run.GetPos();
|
gfxSkipCharsIterator iter = run.GetPos();
|
||||||
|
PRInt32 runOriginalOffset = run.GetOriginalOffset();
|
||||||
for (i = 0; i < run.GetRunLength(); ++i) {
|
for (i = 0; i < run.GetRunLength(); ++i) {
|
||||||
PRInt32 originalOffset = run.GetOriginalOffset() + i;
|
PRInt32 iterOriginalOffset = runOriginalOffset + i;
|
||||||
if (IsJustifiableCharacter(mFrag, originalOffset, isCJK)) {
|
if (IsJustifiableCharacter(mFrag, iterOriginalOffset, isCJK)) {
|
||||||
iter.SetOriginalOffset(originalOffset);
|
iter.SetOriginalOffset(iterOriginalOffset);
|
||||||
FindClusterStart(mTextRun, &iter);
|
FindClusterStart(mTextRun, runOriginalOffset, &iter);
|
||||||
PRUint32 clusterFirstChar = iter.GetSkippedOffset();
|
PRUint32 clusterFirstChar = iter.GetSkippedOffset();
|
||||||
FindClusterEnd(mTextRun, run.GetOriginalOffset() + run.GetRunLength(), &iter);
|
FindClusterEnd(mTextRun, runOriginalOffset + run.GetRunLength(), &iter);
|
||||||
PRUint32 clusterLastChar = iter.GetSkippedOffset();
|
PRUint32 clusterLastChar = iter.GetSkippedOffset();
|
||||||
// Only apply justification to characters before justificationEnd
|
// Only apply justification to characters before justificationEnd
|
||||||
if (clusterFirstChar >= justificationStart.GetSkippedOffset() &&
|
if (clusterFirstChar >= justificationStart.GetSkippedOffset() &&
|
||||||
|
|
@ -5065,7 +5066,7 @@ nsTextFrame::SetSelectedRange(PRUint32 aStart,
|
||||||
PRBool anySelected = PR_FALSE;
|
PRBool anySelected = PR_FALSE;
|
||||||
|
|
||||||
nsTextFrame* f = this;
|
nsTextFrame* f = this;
|
||||||
while (f && f->GetContentEnd() <= aStart) {
|
while (f && f->GetContentEnd() <= PRInt32(aStart)) {
|
||||||
if (f->GetStateBits() & NS_FRAME_SELECTED_CONTENT) {
|
if (f->GetStateBits() & NS_FRAME_SELECTED_CONTENT) {
|
||||||
anySelected = PR_TRUE;
|
anySelected = PR_TRUE;
|
||||||
}
|
}
|
||||||
|
|
@ -5073,7 +5074,7 @@ nsTextFrame::SetSelectedRange(PRUint32 aStart,
|
||||||
}
|
}
|
||||||
|
|
||||||
nsPresContext* presContext = PresContext();
|
nsPresContext* presContext = PresContext();
|
||||||
while (f && f->GetContentOffset() < aEnd) {
|
while (f && f->GetContentOffset() < PRInt32(aEnd)) {
|
||||||
if (aSelected) {
|
if (aSelected) {
|
||||||
f->AddStateBits(NS_FRAME_SELECTED_CONTENT);
|
f->AddStateBits(NS_FRAME_SELECTED_CONTENT);
|
||||||
anySelected = PR_TRUE;
|
anySelected = PR_TRUE;
|
||||||
|
|
@ -5168,7 +5169,7 @@ nsTextFrame::GetPointFromOffset(PRInt32 inOffset,
|
||||||
!iter.IsOriginalCharSkipped() &&
|
!iter.IsOriginalCharSkipped() &&
|
||||||
!mTextRun->IsClusterStart(iter.GetSkippedOffset())) {
|
!mTextRun->IsClusterStart(iter.GetSkippedOffset())) {
|
||||||
NS_WARNING("GetPointFromOffset called for non-cluster boundary");
|
NS_WARNING("GetPointFromOffset called for non-cluster boundary");
|
||||||
FindClusterStart(mTextRun, &iter);
|
FindClusterStart(mTextRun, trimmedOffset, &iter);
|
||||||
}
|
}
|
||||||
|
|
||||||
gfxFloat advanceWidth =
|
gfxFloat advanceWidth =
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue