mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-08 10:44:56 +00:00
Bug 46693. Check to see if we CanContinueTextRun() while walking over the frames to FindNextText(). This revives the logic that I nuked when fixing 19051, and keeps you from trying to walk over <br> or other frames to erroneously continue a text run. r=akkana.
This commit is contained in:
parent
940be572c5
commit
4896ee6d33
@ -915,6 +915,19 @@ public:
|
||||
|
||||
// XXX Maybe these three should be a separate interface?
|
||||
|
||||
/**
|
||||
* Helper method used by block reflow to identify runs of text so
|
||||
* that proper word-breaking can be done.
|
||||
*
|
||||
* @param aContinueTextRun A frame should set aContinueTextRun to
|
||||
* PR_TRUE if we can continue a "text run" through the frame. A
|
||||
* text run is text that should be treated contiguously for line
|
||||
* and word breaking.
|
||||
*
|
||||
* @return The return value is irrelevant.
|
||||
*/
|
||||
NS_IMETHOD CanContinueTextRun(PRBool& aContinueTextRun) const = 0;
|
||||
|
||||
// Justification helper method used to distribute extra space in a
|
||||
// line to leaf frames. aUsedSpace is filled in with the amount of
|
||||
// space actually used.
|
||||
|
@ -53,6 +53,8 @@ public:
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
nsReflowStatus& aStatus);
|
||||
|
||||
NS_IMETHOD CanContinueTextRun(PRBool& aContinueTextRun) const;
|
||||
|
||||
NS_IMETHOD SetSelected(nsIPresContext* aPresContext, nsIDOMRange *aRange,PRBool aSelected, nsSpread aSpread);
|
||||
|
||||
//override of nsFrame method
|
||||
@ -307,6 +309,14 @@ nsFirstLetterFrame::Reflow(nsIPresContext* aPresContext,
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFirstLetterFrame::CanContinueTextRun(PRBool& aContinueTextRun) const
|
||||
{
|
||||
// We can continue a text run through a first-letter frame.
|
||||
aContinueTextRun = PR_TRUE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
nsFirstLetterFrame::DrainOverflowFrames(nsIPresContext* aPresContext)
|
||||
{
|
||||
|
@ -1665,6 +1665,15 @@ nsFrame::DidReflow(nsIPresContext* aPresContext,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrame::CanContinueTextRun(PRBool& aContinueTextRun) const
|
||||
{
|
||||
// By default, a frame will *not* allow a text run to be continued
|
||||
// through it.
|
||||
aContinueTextRun = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrame::Reflow(nsIPresContext* aPresContext,
|
||||
nsHTMLReflowMetrics& aDesiredSize,
|
||||
|
@ -279,6 +279,7 @@ public:
|
||||
nsReflowStatus& aStatus);
|
||||
NS_IMETHOD DidReflow(nsIPresContext* aPresContext,
|
||||
nsDidReflowStatus aStatus);
|
||||
NS_IMETHOD CanContinueTextRun(PRBool& aContinueTextRun) const;
|
||||
NS_IMETHOD AdjustFrameSize(nscoord aExtraSpace, nscoord& aUsedSpace);
|
||||
NS_IMETHOD TrimTrailingWhiteSpace(nsIPresContext* aPresContext,
|
||||
nsIRenderingContext& aRC,
|
||||
|
@ -915,6 +915,19 @@ public:
|
||||
|
||||
// XXX Maybe these three should be a separate interface?
|
||||
|
||||
/**
|
||||
* Helper method used by block reflow to identify runs of text so
|
||||
* that proper word-breaking can be done.
|
||||
*
|
||||
* @param aContinueTextRun A frame should set aContinueTextRun to
|
||||
* PR_TRUE if we can continue a "text run" through the frame. A
|
||||
* text run is text that should be treated contiguously for line
|
||||
* and word breaking.
|
||||
*
|
||||
* @return The return value is irrelevant.
|
||||
*/
|
||||
NS_IMETHOD CanContinueTextRun(PRBool& aContinueTextRun) const = 0;
|
||||
|
||||
// Justification helper method used to distribute extra space in a
|
||||
// line to leaf frames. aUsedSpace is filled in with the amount of
|
||||
// space actually used.
|
||||
|
@ -328,6 +328,14 @@ nsInlineFrame::Reflow(nsIPresContext* aPresContext,
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsInlineFrame::CanContinueTextRun(PRBool& aContinueTextRun) const
|
||||
{
|
||||
// We can continue a text run through an inline frame
|
||||
aContinueTextRun = PR_TRUE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsInlineFrame::ReflowDirtyChild(nsIPresShell* aPresShell, nsIFrame* aChild)
|
||||
{
|
||||
|
@ -79,6 +79,8 @@ public:
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
nsReflowStatus& aStatus);
|
||||
|
||||
NS_IMETHOD CanContinueTextRun(PRBool& aContinueTextRun) const;
|
||||
|
||||
static nsIID kInlineFrameCID;
|
||||
|
||||
// Take all of the frames away from this frame. The caller is
|
||||
|
@ -2824,6 +2824,12 @@ nsLineLayout::FindNextText(nsIPresContext* aPresContext, nsIFrame* aFrame)
|
||||
continue;
|
||||
}
|
||||
|
||||
// If this is a frame that'll break a word, then bail.
|
||||
PRBool canContinue;
|
||||
next->CanContinueTextRun(canContinue);
|
||||
if (! canContinue)
|
||||
break;
|
||||
|
||||
// We know top's parent is good, but next's might not be. So let's
|
||||
// set it to be sure.
|
||||
nsIFrame* parent;
|
||||
|
@ -434,6 +434,7 @@ public:
|
||||
nsHTMLReflowMetrics& aMetrics,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
nsReflowStatus& aStatus);
|
||||
NS_IMETHOD CanContinueTextRun(PRBool& aContinueTextRun) const;
|
||||
NS_IMETHOD AdjustFrameSize(nscoord aExtraSpace, nscoord& aUsedSpace);
|
||||
NS_IMETHOD TrimTrailingWhiteSpace(nsIPresContext* aPresContext,
|
||||
nsIRenderingContext& aRC,
|
||||
@ -4364,6 +4365,14 @@ nsTextFrame::Reflow(nsIPresContext* aPresContext,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsTextFrame::CanContinueTextRun(PRBool& aContinueTextRun) const
|
||||
{
|
||||
// We can continue a text run through a text frame
|
||||
aContinueTextRun = PR_TRUE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsTextFrame::AdjustFrameSize(nscoord aExtraSpace, nscoord& aUsedSpace)
|
||||
{
|
||||
|
@ -53,6 +53,8 @@ public:
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
nsReflowStatus& aStatus);
|
||||
|
||||
NS_IMETHOD CanContinueTextRun(PRBool& aContinueTextRun) const;
|
||||
|
||||
NS_IMETHOD SetSelected(nsIPresContext* aPresContext, nsIDOMRange *aRange,PRBool aSelected, nsSpread aSpread);
|
||||
|
||||
//override of nsFrame method
|
||||
@ -307,6 +309,14 @@ nsFirstLetterFrame::Reflow(nsIPresContext* aPresContext,
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFirstLetterFrame::CanContinueTextRun(PRBool& aContinueTextRun) const
|
||||
{
|
||||
// We can continue a text run through a first-letter frame.
|
||||
aContinueTextRun = PR_TRUE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
nsFirstLetterFrame::DrainOverflowFrames(nsIPresContext* aPresContext)
|
||||
{
|
||||
|
@ -1665,6 +1665,15 @@ nsFrame::DidReflow(nsIPresContext* aPresContext,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrame::CanContinueTextRun(PRBool& aContinueTextRun) const
|
||||
{
|
||||
// By default, a frame will *not* allow a text run to be continued
|
||||
// through it.
|
||||
aContinueTextRun = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrame::Reflow(nsIPresContext* aPresContext,
|
||||
nsHTMLReflowMetrics& aDesiredSize,
|
||||
|
@ -279,6 +279,7 @@ public:
|
||||
nsReflowStatus& aStatus);
|
||||
NS_IMETHOD DidReflow(nsIPresContext* aPresContext,
|
||||
nsDidReflowStatus aStatus);
|
||||
NS_IMETHOD CanContinueTextRun(PRBool& aContinueTextRun) const;
|
||||
NS_IMETHOD AdjustFrameSize(nscoord aExtraSpace, nscoord& aUsedSpace);
|
||||
NS_IMETHOD TrimTrailingWhiteSpace(nsIPresContext* aPresContext,
|
||||
nsIRenderingContext& aRC,
|
||||
|
@ -328,6 +328,14 @@ nsInlineFrame::Reflow(nsIPresContext* aPresContext,
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsInlineFrame::CanContinueTextRun(PRBool& aContinueTextRun) const
|
||||
{
|
||||
// We can continue a text run through an inline frame
|
||||
aContinueTextRun = PR_TRUE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsInlineFrame::ReflowDirtyChild(nsIPresShell* aPresShell, nsIFrame* aChild)
|
||||
{
|
||||
|
@ -79,6 +79,8 @@ public:
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
nsReflowStatus& aStatus);
|
||||
|
||||
NS_IMETHOD CanContinueTextRun(PRBool& aContinueTextRun) const;
|
||||
|
||||
static nsIID kInlineFrameCID;
|
||||
|
||||
// Take all of the frames away from this frame. The caller is
|
||||
|
@ -2824,6 +2824,12 @@ nsLineLayout::FindNextText(nsIPresContext* aPresContext, nsIFrame* aFrame)
|
||||
continue;
|
||||
}
|
||||
|
||||
// If this is a frame that'll break a word, then bail.
|
||||
PRBool canContinue;
|
||||
next->CanContinueTextRun(canContinue);
|
||||
if (! canContinue)
|
||||
break;
|
||||
|
||||
// We know top's parent is good, but next's might not be. So let's
|
||||
// set it to be sure.
|
||||
nsIFrame* parent;
|
||||
|
@ -434,6 +434,7 @@ public:
|
||||
nsHTMLReflowMetrics& aMetrics,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
nsReflowStatus& aStatus);
|
||||
NS_IMETHOD CanContinueTextRun(PRBool& aContinueTextRun) const;
|
||||
NS_IMETHOD AdjustFrameSize(nscoord aExtraSpace, nscoord& aUsedSpace);
|
||||
NS_IMETHOD TrimTrailingWhiteSpace(nsIPresContext* aPresContext,
|
||||
nsIRenderingContext& aRC,
|
||||
@ -4364,6 +4365,14 @@ nsTextFrame::Reflow(nsIPresContext* aPresContext,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsTextFrame::CanContinueTextRun(PRBool& aContinueTextRun) const
|
||||
{
|
||||
// We can continue a text run through a text frame
|
||||
aContinueTextRun = PR_TRUE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsTextFrame::AdjustFrameSize(nscoord aExtraSpace, nscoord& aUsedSpace)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user