Bug 690187 - Make the edge analysis report back if text or atomic inline-level content is visible between the marker edges. r=roc
This commit is contained in:
@@ -286,7 +286,8 @@ TextOverflow::ExamineFrameSubtree(nsIFrame* aFrame,
|
|||||||
const nsRect& aContentArea,
|
const nsRect& aContentArea,
|
||||||
const nsRect& aInsideMarkersArea,
|
const nsRect& aInsideMarkersArea,
|
||||||
FrameHashtable* aFramesToHide,
|
FrameHashtable* aFramesToHide,
|
||||||
AlignmentEdges* aAlignmentEdges)
|
AlignmentEdges* aAlignmentEdges,
|
||||||
|
bool* aFoundVisibleTextOrAtomic)
|
||||||
{
|
{
|
||||||
const nsIAtom* frameType = aFrame->GetType();
|
const nsIAtom* frameType = aFrame->GetType();
|
||||||
if (frameType == nsGkAtoms::brFrame ||
|
if (frameType == nsGkAtoms::brFrame ||
|
||||||
@@ -310,7 +311,8 @@ TextOverflow::ExamineFrameSubtree(nsIFrame* aFrame,
|
|||||||
aFramesToHide->PutEntry(aFrame);
|
aFramesToHide->PutEntry(aFrame);
|
||||||
} else if (isAtomic || frameType == nsGkAtoms::textFrame) {
|
} else if (isAtomic || frameType == nsGkAtoms::textFrame) {
|
||||||
AnalyzeMarkerEdges(aFrame, frameType, aInsideMarkersArea,
|
AnalyzeMarkerEdges(aFrame, frameType, aInsideMarkersArea,
|
||||||
aFramesToHide, aAlignmentEdges);
|
aFramesToHide, aAlignmentEdges,
|
||||||
|
aFoundVisibleTextOrAtomic);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (isAtomic) {
|
if (isAtomic) {
|
||||||
@@ -320,7 +322,8 @@ TextOverflow::ExamineFrameSubtree(nsIFrame* aFrame,
|
|||||||
nsIFrame* child = aFrame->GetFirstPrincipalChild();
|
nsIFrame* child = aFrame->GetFirstPrincipalChild();
|
||||||
while (child) {
|
while (child) {
|
||||||
ExamineFrameSubtree(child, aContentArea, aInsideMarkersArea,
|
ExamineFrameSubtree(child, aContentArea, aInsideMarkersArea,
|
||||||
aFramesToHide, aAlignmentEdges);
|
aFramesToHide, aAlignmentEdges,
|
||||||
|
aFoundVisibleTextOrAtomic);
|
||||||
child = child->GetNextSibling();
|
child = child->GetNextSibling();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -330,7 +333,8 @@ TextOverflow::AnalyzeMarkerEdges(nsIFrame* aFrame,
|
|||||||
const nsIAtom* aFrameType,
|
const nsIAtom* aFrameType,
|
||||||
const nsRect& aInsideMarkersArea,
|
const nsRect& aInsideMarkersArea,
|
||||||
FrameHashtable* aFramesToHide,
|
FrameHashtable* aFramesToHide,
|
||||||
AlignmentEdges* aAlignmentEdges)
|
AlignmentEdges* aAlignmentEdges,
|
||||||
|
bool* aFoundVisibleTextOrAtomic)
|
||||||
{
|
{
|
||||||
nsRect borderRect(aFrame->GetOffsetTo(mBlock), aFrame->GetSize());
|
nsRect borderRect(aFrame->GetOffsetTo(mBlock), aFrame->GetSize());
|
||||||
nscoord leftOverlap =
|
nscoord leftOverlap =
|
||||||
@@ -368,11 +372,14 @@ TextOverflow::AnalyzeMarkerEdges(nsIFrame* aFrame,
|
|||||||
snappedRect.width -= snappedRight;
|
snappedRect.width -= snappedRight;
|
||||||
}
|
}
|
||||||
aAlignmentEdges->Accumulate(snappedRect);
|
aAlignmentEdges->Accumulate(snappedRect);
|
||||||
|
*aFoundVisibleTextOrAtomic = true;
|
||||||
}
|
}
|
||||||
} else if (IsAtomicElement(aFrame, aFrameType)) {
|
} else if (IsAtomicElement(aFrame, aFrameType)) {
|
||||||
if ((insideLeftEdge && mLeft.mActive) ||
|
if ((leftOverlap > 0 && insideLeftEdge && mLeft.mActive) ||
|
||||||
(insideRightEdge && mRight.mActive)) {
|
(rightOverlap > 0 && insideRightEdge && mRight.mActive)) {
|
||||||
aFramesToHide->PutEntry(aFrame);
|
aFramesToHide->PutEntry(aFrame);
|
||||||
|
} else {
|
||||||
|
*aFoundVisibleTextOrAtomic = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (!insideLeftEdge || !insideRightEdge) {
|
} else if (!insideLeftEdge || !insideRightEdge) {
|
||||||
@@ -383,6 +390,7 @@ TextOverflow::AnalyzeMarkerEdges(nsIFrame* aFrame,
|
|||||||
} else {
|
} else {
|
||||||
// frame is inside
|
// frame is inside
|
||||||
aAlignmentEdges->Accumulate(borderRect);
|
aAlignmentEdges->Accumulate(borderRect);
|
||||||
|
*aFoundVisibleTextOrAtomic = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -465,11 +473,13 @@ TextOverflow::ExamineLineFrames(nsLineBox* aLine,
|
|||||||
|
|
||||||
// Analyze the frames on aLine for the overflow situation at the content
|
// Analyze the frames on aLine for the overflow situation at the content
|
||||||
// edges and at the edges of the area between the markers.
|
// edges and at the edges of the area between the markers.
|
||||||
|
bool foundVisibleTextOrAtomic = false;
|
||||||
PRInt32 n = aLine->GetChildCount();
|
PRInt32 n = aLine->GetChildCount();
|
||||||
nsIFrame* child = aLine->mFirstChild;
|
nsIFrame* child = aLine->mFirstChild;
|
||||||
for (; n-- > 0; child = child->GetNextSibling()) {
|
for (; n-- > 0; child = child->GetNextSibling()) {
|
||||||
ExamineFrameSubtree(child, contentArea, insideMarkersArea,
|
ExamineFrameSubtree(child, contentArea, insideMarkersArea,
|
||||||
aFramesToHide, aAlignmentEdges);
|
aFramesToHide, aAlignmentEdges,
|
||||||
|
&foundVisibleTextOrAtomic);
|
||||||
}
|
}
|
||||||
if (guessLeft == mLeft.IsNeeded() && guessRight == mRight.IsNeeded()) {
|
if (guessLeft == mLeft.IsNeeded() && guessRight == mRight.IsNeeded()) {
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -120,12 +120,15 @@ class TextOverflow {
|
|||||||
* @param aFramesToHide frames that should have their display items removed
|
* @param aFramesToHide frames that should have their display items removed
|
||||||
* @param aAlignmentEdges the outermost edges of all text and atomic
|
* @param aAlignmentEdges the outermost edges of all text and atomic
|
||||||
* inline-level frames that are inside the area between the markers
|
* inline-level frames that are inside the area between the markers
|
||||||
|
* @param aFoundVisibleTextOrAtomic is set to true if a text or atomic
|
||||||
|
* inline-level frame is visible between the marker edges
|
||||||
*/
|
*/
|
||||||
void ExamineFrameSubtree(nsIFrame* aFrame,
|
void ExamineFrameSubtree(nsIFrame* aFrame,
|
||||||
const nsRect& aContentArea,
|
const nsRect& aContentArea,
|
||||||
const nsRect& aInsideMarkersArea,
|
const nsRect& aInsideMarkersArea,
|
||||||
FrameHashtable* aFramesToHide,
|
FrameHashtable* aFramesToHide,
|
||||||
AlignmentEdges* aAlignmentEdges);
|
AlignmentEdges* aAlignmentEdges,
|
||||||
|
bool* aFoundVisibleTextOrAtomic);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ExamineFrameSubtree calls this to analyze a frame against the hypothetical
|
* ExamineFrameSubtree calls this to analyze a frame against the hypothetical
|
||||||
@@ -141,12 +144,15 @@ class TextOverflow {
|
|||||||
* @param aAlignmentEdges the outermost edges of all text and atomic
|
* @param aAlignmentEdges the outermost edges of all text and atomic
|
||||||
* inline-level frames that are inside the area between the markers
|
* inline-level frames that are inside the area between the markers
|
||||||
* inside aInsideMarkersArea
|
* inside aInsideMarkersArea
|
||||||
|
* @param aFoundVisibleTextOrAtomic is set to true if a text or atomic
|
||||||
|
* inline-level frame is visible between the marker edges
|
||||||
*/
|
*/
|
||||||
void AnalyzeMarkerEdges(nsIFrame* aFrame,
|
void AnalyzeMarkerEdges(nsIFrame* aFrame,
|
||||||
const nsIAtom* aFrameType,
|
const nsIAtom* aFrameType,
|
||||||
const nsRect& aInsideMarkersArea,
|
const nsRect& aInsideMarkersArea,
|
||||||
FrameHashtable* aFramesToHide,
|
FrameHashtable* aFramesToHide,
|
||||||
AlignmentEdges* aAlignmentEdges);
|
AlignmentEdges* aAlignmentEdges,
|
||||||
|
bool* aFoundVisibleTextOrAtomic);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clip or remove items given the final marker edges. ("clip" here just means
|
* Clip or remove items given the final marker edges. ("clip" here just means
|
||||||
|
|||||||
Reference in New Issue
Block a user