Bug 681867. text-overflow only needs to affect the scrolling behavior of the block container with text-overflow. r=mats

This commit is contained in:
Robert O'Callahan 2011-10-21 14:41:36 +13:00
Родитель fe35be1d9c
Коммит 2db71e8621
5 изменённых файлов: 13 добавлений и 29 удалений

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

@ -51,6 +51,7 @@
#include "nsRect.h"
#include "nsRenderingContext.h"
#include "nsTextFrame.h"
#include "nsGfxScrollFrame.h"
namespace mozilla {
namespace css {
@ -278,6 +279,8 @@ TextOverflow::WillProcessLines(nsDisplayListBuilder* aBuilder,
textOverflow->mCanHaveHorizontalScrollbar =
scroll->GetScrollbarStyles().mHorizontal != NS_STYLE_OVERFLOW_HIDDEN;
textOverflow->mContentArea.MoveBy(scroll->GetScrollPosition());
nsIFrame* scrollFrame = do_QueryFrame(scroll);
scrollFrame->AddStateBits(NS_SCROLLFRAME_INVALIDATE_CONTENTS_ON_SCROLL);
}
PRUint8 direction = aBlockFrame->GetStyleVisibility()->mDirection;
textOverflow->mBlockIsRTL = direction == NS_STYLE_DIRECTION_RTL;
@ -290,23 +293,6 @@ TextOverflow::WillProcessLines(nsDisplayListBuilder* aBuilder,
return textOverflow.forget();
}
void
TextOverflow::DidProcessLines()
{
nsIScrollableFrame* scroll = nsLayoutUtils::GetScrollableFrameFor(mBlock);
if (scroll) {
// Create a dummy item covering the entire area, it doesn't paint
// but reports true for IsVaryingRelativeToMovingFrame().
nsIFrame* scrollFrame = do_QueryFrame(scroll);
nsDisplayItem* marker = new (mBuilder)
nsDisplayForcePaintOnScroll(mBuilder, scrollFrame);
if (marker) {
mMarkerList->AppendNewToBottom(marker);
mBlock->PresContext()->SetHasFixedBackgroundFrame();
}
}
}
void
TextOverflow::ExamineFrameSubtree(nsIFrame* aFrame,
const nsRect& aContentArea,

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

@ -52,7 +52,6 @@ namespace css {
* Usage:
* 1. allocate an object using WillProcessLines
* 2. then call ProcessLine for each line you are building display lists for
* 3. finally call DidProcessLines
*/
class TextOverflow {
public:
@ -70,12 +69,6 @@ class TextOverflow {
*/
void ProcessLine(const nsDisplayListSet& aLists, nsLineBox* aLine);
/**
* Do final processing, currently just adds a dummy item for scroll frames
* to make IsVaryingRelativeToMovingFrame() true for the entire area.
*/
void DidProcessLines();
/**
* @return true if aBlockFrame needs analysis for text overflow.
*/

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

@ -6247,11 +6247,6 @@ nsBlockFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
}
}
// Finalize text-overflow processing.
if (textOverflow) {
textOverflow->DidProcessLines();
}
if (NS_SUCCEEDED(rv) && (nsnull != mBullet) && HaveOutsideBullet()) {
// Display outside bullets manually
rv = BuildDisplayListForChild(aBuilder, mBullet, aDirtyRect, aLists);

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

@ -1619,6 +1619,9 @@ static void AdjustViews(nsIFrame* aFrame)
static bool
CanScrollWithBlitting(nsIFrame* aFrame)
{
if (aFrame->GetStateBits() & NS_SCROLLFRAME_INVALIDATE_CONTENTS_ON_SCROLL)
return false;
for (nsIFrame* f = aFrame; f;
f = nsLayoutUtils::GetCrossDocParentFrame(f)) {
if (nsSVGIntegrationUtils::UsingEffectsForFrame(f) ||
@ -1732,6 +1735,7 @@ void nsGfxScrollFrameInner::ScrollVisual()
// to be consistent with the frame hierarchy.
PRUint32 flags = nsIFrame::INVALIDATE_REASON_SCROLL_REPAINT;
bool canScrollWithBlitting = CanScrollWithBlitting(mOuter);
mOuter->RemoveStateBits(NS_SCROLLFRAME_INVALIDATE_CONTENTS_ON_SCROLL);
if (IsScrollingActive()) {
if (!canScrollWithBlitting) {
MarkInactive();

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

@ -64,6 +64,12 @@ class nsIScrollFrameInternal;
class nsPresState;
struct ScrollReflowState;
// When set, the next scroll operation on the scrollframe will invalidate its
// entire contents. Useful for text-overflow.
// This bit is cleared after each time the scrollframe is scrolled. Whoever
// needs to set it should set it again on each paint.
#define NS_SCROLLFRAME_INVALIDATE_CONTENTS_ON_SCROLL NS_FRAME_STATE_BIT(20)
class nsGfxScrollFrameInner : public nsIReflowCallback {
public:
class AsyncScroll;