зеркало из https://github.com/mozilla/gecko-dev.git
Bug 654369 - Part 7: Remove OOM checks from nsTextFrameThebes r=bz
--HG-- extra : rebase_source : 2cb5ce4d3f3a6d8d0e3a50c40303f8c1c098dbdf
This commit is contained in:
Родитель
ea484247b0
Коммит
1166c130bf
|
@ -183,11 +183,7 @@ nsLayoutStatics::Initialize()
|
|||
|
||||
nsCSSRendering::Init();
|
||||
|
||||
rv = nsTextFrameTextRunCache::Init();
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_ERROR("Could not initialize textframe textrun cache");
|
||||
return rv;
|
||||
}
|
||||
nsTextFrameTextRunCache::Init();
|
||||
|
||||
rv = nsHTMLDNSPrefetch::Initialize();
|
||||
if (NS_FAILED(rv)) {
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
*/
|
||||
class nsTextFrameTextRunCache {
|
||||
public:
|
||||
static nsresult Init();
|
||||
static void Init();
|
||||
static void Shutdown();
|
||||
};
|
||||
|
||||
|
|
|
@ -592,10 +592,9 @@ MakeTextRun(const PRUint8 *aText, PRUint32 aLength,
|
|||
return textRun.forget();
|
||||
}
|
||||
|
||||
nsresult
|
||||
void
|
||||
nsTextFrameTextRunCache::Init() {
|
||||
gTextRuns = new FrameTextRunCache();
|
||||
return gTextRuns ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -3037,8 +3036,8 @@ public:
|
|||
|
||||
NS_DECL_NSITIMERCALLBACK
|
||||
|
||||
static nsresult AddBlinkFrame(nsPresContext* aPresContext, nsIFrame* aFrame);
|
||||
static nsresult RemoveBlinkFrame(nsIFrame* aFrame);
|
||||
static void AddBlinkFrame(nsPresContext* aPresContext, nsIFrame* aFrame);
|
||||
static void RemoveBlinkFrame(nsIFrame* aFrame);
|
||||
|
||||
static PRBool GetBlinkIsOff() { return sState == 3; }
|
||||
|
||||
|
@ -3162,33 +3161,28 @@ NS_IMETHODIMP nsBlinkTimer::Notify(nsITimer *timer)
|
|||
|
||||
|
||||
// static
|
||||
nsresult nsBlinkTimer::AddBlinkFrame(nsPresContext* aPresContext, nsIFrame* aFrame)
|
||||
void nsBlinkTimer::AddBlinkFrame(nsPresContext* aPresContext, nsIFrame* aFrame)
|
||||
{
|
||||
if (!sTextBlinker)
|
||||
{
|
||||
sTextBlinker = new nsBlinkTimer;
|
||||
if (!sTextBlinker) return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
NS_ADDREF(sTextBlinker);
|
||||
|
||||
sTextBlinker->AddFrame(aPresContext, aFrame);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
// static
|
||||
nsresult nsBlinkTimer::RemoveBlinkFrame(nsIFrame* aFrame)
|
||||
void nsBlinkTimer::RemoveBlinkFrame(nsIFrame* aFrame)
|
||||
{
|
||||
NS_ASSERTION(sTextBlinker, "Should have blink timer here");
|
||||
|
||||
nsBlinkTimer* blinkTimer = sTextBlinker; // copy so we can call NS_RELEASE on it
|
||||
if (!blinkTimer) return NS_OK;
|
||||
|
||||
blinkTimer->RemoveFrame(aFrame);
|
||||
NS_RELEASE(blinkTimer);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -7146,14 +7140,12 @@ nsTextFrame::ReflowText(nsLineLayout& aLineLayout, nscoord aAvailableWidth,
|
|||
mContentOffset + contentLength <= contentNewLineOffset)) {
|
||||
if (!cachedNewlineOffset) {
|
||||
cachedNewlineOffset = new NewlineProperty;
|
||||
if (cachedNewlineOffset) {
|
||||
if (NS_FAILED(mContent->SetProperty(nsGkAtoms::newline, cachedNewlineOffset,
|
||||
NewlineProperty::Destroy))) {
|
||||
delete cachedNewlineOffset;
|
||||
cachedNewlineOffset = nsnull;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (cachedNewlineOffset) {
|
||||
cachedNewlineOffset->mStartOffset = offset;
|
||||
cachedNewlineOffset->mNewlineOffset = contentNewLineOffset;
|
||||
|
|
Загрузка…
Ссылка в новой задаче