mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-08 12:22:34 +00:00
Added FindTextRunsFor method
This commit is contained in:
parent
1dc537c5f9
commit
084fde0160
@ -23,6 +23,15 @@
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsIFontMetrics.h"
|
||||
|
||||
nsTextRun::nsTextRun()
|
||||
{
|
||||
mNext = nsnull;
|
||||
}
|
||||
|
||||
nsTextRun::~nsTextRun()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
nsTextRun::List(FILE* out, PRInt32 aIndent)
|
||||
{
|
||||
@ -99,6 +108,32 @@ nsLineLayout::AddText(nsIFrame* aTextFrame)
|
||||
return NS_OK;/* XXX */
|
||||
}
|
||||
|
||||
nsTextRun*
|
||||
nsLineLayout::FindTextRunFor(nsIFrame* aFrame)
|
||||
{
|
||||
// Only the first-in-flows are present in the text run list so
|
||||
// backup from the argument frame to its first-in-flow.
|
||||
for (;;) {
|
||||
nsIFrame* prevInFlow;
|
||||
aFrame->GetPrevInFlow(prevInFlow);
|
||||
if (nsnull == prevInFlow) {
|
||||
break;
|
||||
}
|
||||
aFrame = prevInFlow;
|
||||
}
|
||||
|
||||
// Now look for the frame in each run
|
||||
nsTextRun* run = mReflowTextRuns;
|
||||
while (nsnull != run) {
|
||||
PRInt32 ix = run->mArray.IndexOf(aFrame);
|
||||
if (ix >= 0) {
|
||||
return run;
|
||||
}
|
||||
run = run->mNext;
|
||||
}
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
nsIFrame*
|
||||
nsLineLayout::FindNextText(nsIFrame* aFrame)
|
||||
{
|
||||
|
@ -23,6 +23,15 @@
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsIFontMetrics.h"
|
||||
|
||||
nsTextRun::nsTextRun()
|
||||
{
|
||||
mNext = nsnull;
|
||||
}
|
||||
|
||||
nsTextRun::~nsTextRun()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
nsTextRun::List(FILE* out, PRInt32 aIndent)
|
||||
{
|
||||
@ -99,6 +108,32 @@ nsLineLayout::AddText(nsIFrame* aTextFrame)
|
||||
return NS_OK;/* XXX */
|
||||
}
|
||||
|
||||
nsTextRun*
|
||||
nsLineLayout::FindTextRunFor(nsIFrame* aFrame)
|
||||
{
|
||||
// Only the first-in-flows are present in the text run list so
|
||||
// backup from the argument frame to its first-in-flow.
|
||||
for (;;) {
|
||||
nsIFrame* prevInFlow;
|
||||
aFrame->GetPrevInFlow(prevInFlow);
|
||||
if (nsnull == prevInFlow) {
|
||||
break;
|
||||
}
|
||||
aFrame = prevInFlow;
|
||||
}
|
||||
|
||||
// Now look for the frame in each run
|
||||
nsTextRun* run = mReflowTextRuns;
|
||||
while (nsnull != run) {
|
||||
PRInt32 ix = run->mArray.IndexOf(aFrame);
|
||||
if (ix >= 0) {
|
||||
return run;
|
||||
}
|
||||
run = run->mNext;
|
||||
}
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
nsIFrame*
|
||||
nsLineLayout::FindNextText(nsIFrame* aFrame)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user