Bug 556432 - Dragging a content selection shows non-selectable text in the drag feedback. r=roc

This commit is contained in:
Mats Palmgren 2010-07-12 22:24:33 +02:00
Родитель b3c186b794
Коммит f2337649aa
4 изменённых файлов: 24 добавлений и 12 удалений

Просмотреть файл

@ -75,7 +75,7 @@ nsDisplayListBuilder::nsDisplayListBuilder(nsIFrame* aReferenceFrame,
mBuildCaret(aBuildCaret),
mEventDelivery(aIsForEvents),
mIsAtRootOfPseudoStackingContext(PR_FALSE),
mPaintAllFrames(PR_FALSE),
mSelectedFramesOnly(PR_FALSE),
mAccurateVisibleRegions(PR_FALSE),
mInTransform(PR_FALSE),
mSyncDecodeImages(PR_FALSE),

Просмотреть файл

@ -235,11 +235,14 @@ public:
*/
nsIFrame* GetIgnoreScrollFrame() { return mIgnoreScrollFrame; }
/**
* Calling this setter makes us ignore all dirty rects and include all
* descendant frames in the display list, wherever they may be positioned.
* Calling this setter makes us:
* 1. include all positioned descendant frames in the display list,
* wherever they may be positioned (even outside the dirty rects).
* 2. exclude all leaf frames that does not have the NS_FRAME_SELECTED_CONTENT
* bit.
*/
void SetPaintAllFrames() { mPaintAllFrames = PR_TRUE; }
PRBool GetPaintAllFrames() { return mPaintAllFrames; }
void SetSelectedFramesOnly() { mSelectedFramesOnly = PR_TRUE; }
PRBool GetSelectedFramesOnly() { return mSelectedFramesOnly; }
/**
* Calling this setter makes us compute accurate visible regions at the cost
* of performance if regions get very complex.
@ -426,7 +429,7 @@ private:
PRPackedBool mEventDelivery;
PRPackedBool mIsBackgroundOnly;
PRPackedBool mIsAtRootOfPseudoStackingContext;
PRPackedBool mPaintAllFrames;
PRPackedBool mSelectedFramesOnly;
PRPackedBool mAccurateVisibleRegions;
// True when we're building a display list that's directly or indirectly
// under an nsDisplayTransform

Просмотреть файл

@ -1023,7 +1023,8 @@ protected:
// create a RangePaintInfo for the range aRange containing the
// display list needed to paint the range to a surface
RangePaintInfo* CreateRangePaintInfo(nsIDOMRange* aRange,
nsRect& aSurfaceRect);
nsRect& aSurfaceRect,
PRBool aForPrimarySelection);
/*
* Paint the items to a new surface and return it.
@ -5458,7 +5459,8 @@ static PRBool gDumpRangePaintList = PR_FALSE;
RangePaintInfo*
PresShell::CreateRangePaintInfo(nsIDOMRange* aRange,
nsRect& aSurfaceRect)
nsRect& aSurfaceRect,
PRBool aForPrimarySelection)
{
NS_TIME_FUNCTION_WITH_DOCURL;
@ -5507,7 +5509,9 @@ PresShell::CreateRangePaintInfo(nsIDOMRange* aRange,
nsRect ancestorRect = ancestorFrame->GetOverflowRect();
// get a display list containing the range
info->mBuilder.SetPaintAllFrames();
if (aForPrimarySelection) {
info->mBuilder.SetSelectedFramesOnly();
}
info->mBuilder.EnterPresShell(ancestorFrame, ancestorRect);
ancestorFrame->BuildDisplayListForStackingContext(&info->mBuilder,
ancestorRect, &info->mList);
@ -5685,7 +5689,7 @@ PresShell::RenderNode(nsIDOMNode* aNode,
if (NS_FAILED(range->SelectNode(aNode)))
return nsnull;
RangePaintInfo* info = CreateRangePaintInfo(range, area);
RangePaintInfo* info = CreateRangePaintInfo(range, area, PR_FALSE);
if (info && !rangeItems.AppendElement(info)) {
delete info;
return nsnull;
@ -5733,7 +5737,7 @@ PresShell::RenderSelection(nsISelection* aSelection,
nsCOMPtr<nsIDOMRange> range;
aSelection->GetRangeAt(r, getter_AddRefs(range));
RangePaintInfo* info = CreateRangePaintInfo(range, area);
RangePaintInfo* info = CreateRangePaintInfo(range, area, PR_TRUE);
if (info && !rangeItems.AppendElement(info)) {
delete info;
return nsnull;

Просмотреть файл

@ -1467,9 +1467,14 @@ nsIFrame::BuildDisplayListForChild(nsDisplayListBuilder* aBuilder,
dirty.Empty();
}
pseudoStackingContext = PR_TRUE;
} else if (aBuilder->GetSelectedFramesOnly() &&
aChild->IsLeaf() &&
!(aChild->GetStateBits() & NS_FRAME_SELECTED_CONTENT)) {
return NS_OK;
}
if (aBuilder->GetPaintAllFrames()) {
if (aBuilder->GetSelectedFramesOnly() &&
(aChild->GetStateBits() & NS_FRAME_OUT_OF_FLOW)) {
dirty = aChild->GetOverflowRect();
} else if (!(aChild->GetStateBits() & NS_FRAME_FORCE_DISPLAY_LIST_DESCEND_INTO)) {
// No need to descend into aChild to catch placeholders for visible