зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1284888 part 2: Make TextOverflow::WillProcessLines() return a UniquePtr, for stronger lifetime guarantees. r=jfkthame
MozReview-Commit-ID: 7KVsFlxuL9p --HG-- extra : rebase_source : 13ee634d9a310236f70c30afa0d3c5a798a00194
This commit is contained in:
Родитель
09b0fe59f0
Коммит
fc581a5454
|
@ -335,7 +335,7 @@ TextOverflow::TextOverflow(nsDisplayListBuilder* aBuilder,
|
|||
// has overflow on that side.
|
||||
}
|
||||
|
||||
/* static */ TextOverflow*
|
||||
/* static */ UniquePtr<TextOverflow>
|
||||
TextOverflow::WillProcessLines(nsDisplayListBuilder* aBuilder,
|
||||
nsIFrame* aBlockFrame)
|
||||
{
|
||||
|
@ -350,7 +350,7 @@ TextOverflow::WillProcessLines(nsDisplayListBuilder* aBuilder,
|
|||
// If the APZ is actively scrolling this, don't bother with markers.
|
||||
return nullptr;
|
||||
}
|
||||
return new TextOverflow(aBuilder, aBlockFrame);
|
||||
return MakeUnique<TextOverflow>(aBuilder, aBlockFrame);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include "nsTHashtable.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/Likely.h"
|
||||
#include "mozilla/UniquePtr.h"
|
||||
#include "mozilla/WritingModes.h"
|
||||
#include <algorithm>
|
||||
|
||||
|
@ -32,8 +33,18 @@ class MOZ_HEAP_CLASS TextOverflow final {
|
|||
* Allocate an object for text-overflow processing.
|
||||
* @return nullptr if no processing is necessary. The caller owns the object.
|
||||
*/
|
||||
static TextOverflow* WillProcessLines(nsDisplayListBuilder* aBuilder,
|
||||
nsIFrame* aBlockFrame);
|
||||
static UniquePtr<TextOverflow>
|
||||
WillProcessLines(nsDisplayListBuilder* aBuilder,
|
||||
nsIFrame* aBlockFrame);
|
||||
|
||||
/**
|
||||
* Constructor, which client code SHOULD NOT use directly. Instead, clients
|
||||
* should call WillProcessLines(), which is basically the factory function
|
||||
* for TextOverflow instances.
|
||||
*/
|
||||
TextOverflow(nsDisplayListBuilder* aBuilder,
|
||||
nsIFrame* aBlockFrame);
|
||||
|
||||
/**
|
||||
* Analyze the display lists for text overflow and what kind of item is at
|
||||
* the content edges. Add display items for text-overflow markers as needed
|
||||
|
@ -59,9 +70,6 @@ class MOZ_HEAP_CLASS TextOverflow final {
|
|||
typedef nsTHashtable<nsPtrHashKey<nsIFrame>> FrameHashtable;
|
||||
|
||||
private:
|
||||
TextOverflow(nsDisplayListBuilder* aBuilder,
|
||||
nsIFrame* aBlockFrame);
|
||||
|
||||
typedef mozilla::WritingMode WritingMode;
|
||||
typedef mozilla::LogicalRect LogicalRect;
|
||||
|
||||
|
|
|
@ -6756,8 +6756,8 @@ nsBlockFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|||
aBuilder->MarkFramesForDisplayList(this, mFloats, aDirtyRect);
|
||||
|
||||
// Prepare for text-overflow processing.
|
||||
UniquePtr<TextOverflow> textOverflow(
|
||||
TextOverflow::WillProcessLines(aBuilder, this));
|
||||
UniquePtr<TextOverflow> textOverflow =
|
||||
TextOverflow::WillProcessLines(aBuilder, this);
|
||||
|
||||
// We'll collect our lines' display items here, & then append this to aLists.
|
||||
nsDisplayListCollection linesDisplayListCollection;
|
||||
|
|
Загрузка…
Ссылка в новой задаче