Bug 990907 - Don't add text-overflow markers while being actively scrolled by APZ. r=mstange,tn

This commit is contained in:
Kartikaya Gupta 2015-02-25 09:33:00 -05:00
parent 59242188d5
commit 6a08695dcd
3 changed files with 24 additions and 3 deletions

View File

@ -293,6 +293,11 @@ TextOverflow::WillProcessLines(nsDisplayListBuilder* aBuilder,
if (!CanHaveTextOverflow(aBuilder, aBlockFrame)) {
return nullptr;
}
nsIScrollableFrame* scrollableFrame = nsLayoutUtils::GetScrollableFrameFor(aBlockFrame);
if (scrollableFrame && scrollableFrame->IsTransformingByAPZ()) {
// If the APZ is actively scrolling this, don't bother with markers.
return nullptr;
}
nsAutoPtr<TextOverflow> textOverflow(new TextOverflow);
textOverflow->Init(aBuilder, aBlockFrame);
return textOverflow.forget();
@ -665,15 +670,21 @@ TextOverflow::PruneDisplayListContents(nsDisplayList* aList,
aList->AppendToTop(&saved);
}
/* static */ bool
TextOverflow::HasClippedOverflow(nsIFrame* aBlockFrame)
{
const nsStyleTextReset* style = aBlockFrame->StyleTextReset();
return style->mTextOverflow.mLeft.mType == NS_STYLE_TEXT_OVERFLOW_CLIP &&
style->mTextOverflow.mRight.mType == NS_STYLE_TEXT_OVERFLOW_CLIP;
}
/* static */ bool
TextOverflow::CanHaveTextOverflow(nsDisplayListBuilder* aBuilder,
nsIFrame* aBlockFrame)
{
const nsStyleTextReset* style = aBlockFrame->StyleTextReset();
// Nothing to do for text-overflow:clip or if 'overflow-x:visible' or if
// we're just building items for event processing or image visibility.
if ((style->mTextOverflow.mLeft.mType == NS_STYLE_TEXT_OVERFLOW_CLIP &&
style->mTextOverflow.mRight.mType == NS_STYLE_TEXT_OVERFLOW_CLIP) ||
if (HasClippedOverflow(aBlockFrame) ||
IsHorizontalOverflowVisible(aBlockFrame) ||
aBuilder->IsForEventDelivery() || aBuilder->IsForImageVisibility()) {
return false;

View File

@ -46,6 +46,10 @@ class TextOverflow {
*/
nsDisplayList& GetMarkers() { return mMarkerList; }
/**
* @return true if aBlockFrmae has text-overflow:clip on both sides.
*/
static bool HasClippedOverflow(nsIFrame* aBlockFrame);
/**
* @return true if aBlockFrame needs analysis for text overflow.
*/

View File

@ -20,6 +20,7 @@
#include "nsBoxLayoutState.h"
#include "nsQueryFrame.h"
#include "nsExpirationTracker.h"
#include "TextOverflow.h"
class nsPresContext;
class nsIPresShell;
@ -326,6 +327,11 @@ public:
void SetTransformingByAPZ(bool aTransforming) {
mTransformingByAPZ = aTransforming;
if (!mozilla::css::TextOverflow::HasClippedOverflow(mOuter)) {
// If the block has some text-overflow stuff we should kick off a paint
// because we have special behaviour for it when APZ scrolling is active.
mOuter->SchedulePaint();
}
}
bool IsTransformingByAPZ() const {
return mTransformingByAPZ;