Bug 996319: Drop always-null arg from nsTextFrame.cpp's static helper-function "GetReferenceRenderingContext". r=jdaggett
authorDaniel Holbert <dholbert@cs.stanford.edu>
Mon, 14 Apr 2014 17:45:39 -0700
changeset 178432 e3756b512314e0295a9fb357e92b4e8b4e580fef
parent 178431 79296b6a6026b01c4e3efec3a31bb5007b30b0cb
child 178433 81dd41a77b43be1bac65203c9021d199fe1739dc
push id26586
push usercbook@mozilla.com
push dateTue, 15 Apr 2014 13:08:13 +0000
treeherdermozilla-central@56da72c95d48 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjdaggett
bugs996319
milestone31.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 996319: Drop always-null arg from nsTextFrame.cpp's static helper-function "GetReferenceRenderingContext". r=jdaggett
layout/generic/nsTextFrame.cpp
--- a/layout/generic/nsTextFrame.cpp
+++ b/layout/generic/nsTextFrame.cpp
@@ -1769,38 +1769,36 @@ GetFontGroupForFrame(nsIFrame* aFrame, f
   // XXX this is a bit bogus, we're releasing 'metrics' so the
   // returned font-group might actually be torn down, although because
   // of the way the device context caches font metrics, this seems to
   // not actually happen. But we should fix this.
   return metrics->GetThebesFontGroup();
 }
 
 static already_AddRefed<gfxContext>
-GetReferenceRenderingContext(nsTextFrame* aTextFrame, nsRenderingContext* aRC)
-{
-  nsRefPtr<nsRenderingContext> tmp = aRC;
-  if (!tmp) {
-    tmp = aTextFrame->PresContext()->PresShell()->GetReferenceRenderingContext();
-    if (!tmp)
-      return nullptr;
-  }
+GetReferenceRenderingContext(nsTextFrame* aTextFrame)
+{
+  nsRefPtr<nsRenderingContext> tmp =
+    aTextFrame->PresContext()->PresShell()->GetReferenceRenderingContext();
+  if (!tmp)
+    return nullptr;
 
   nsRefPtr<gfxContext> ctx = tmp->ThebesContext();
   return ctx.forget();
 }
 
 /**
  * The returned textrun must be deleted when no longer needed.
  */
 static gfxTextRun*
 GetHyphenTextRun(gfxTextRun* aTextRun, gfxContext* aContext, nsTextFrame* aTextFrame)
 {
   nsRefPtr<gfxContext> ctx = aContext;
   if (!ctx) {
-    ctx = GetReferenceRenderingContext(aTextFrame, nullptr);
+    ctx = GetReferenceRenderingContext(aTextFrame);
   }
   if (!ctx)
     return nullptr;
 
   return aTextRun->GetFontGroup()->
     MakeHyphenTextRun(ctx, aTextRun->GetAppUnitsPerDevUnit());
 }
 
@@ -2553,17 +2551,17 @@ nsTextFrame::EnsureTextRun(TextRunType a
   gfxTextRun *textRun = GetTextRun(aWhichTextRun);
   if (textRun && (!aLine || !(*aLine)->GetInvalidateTextRuns())) {
     if (textRun->GetExpirationState()->IsTracked()) {
       gTextRuns->MarkUsed(textRun);
     }
   } else {
     nsRefPtr<gfxContext> ctx = aReferenceContext;
     if (!ctx) {
-      ctx = GetReferenceRenderingContext(this, nullptr);
+      ctx = GetReferenceRenderingContext(this);
     }
     if (ctx) {
       BuildTextRuns(ctx, this, aLineContainer, aLine, aWhichTextRun);
     }
     textRun = GetTextRun(aWhichTextRun);
     if (!textRun) {
       // A text run was not constructed for this frame. This is bad. The caller
       // will check mTextRun.
@@ -2835,17 +2833,17 @@ public:
   virtual gfxFloat GetHyphenWidth();
   virtual void GetHyphenationBreaks(uint32_t aStart, uint32_t aLength,
                                     bool* aBreakBefore);
   virtual int8_t GetHyphensOption() {
     return mTextStyle->mHyphens;
   }
 
   virtual already_AddRefed<gfxContext> GetContext() {
-    return GetReferenceRenderingContext(GetFrame(), nullptr);
+    return GetReferenceRenderingContext(GetFrame());
   }
 
   virtual uint32_t GetAppUnitsPerDevUnit() {
     return mTextRun->GetAppUnitsPerDevUnit();
   }
 
   void GetSpacingInternal(uint32_t aStart, uint32_t aLength, Spacing* aSpacing,
                           bool aIgnoreTabs);