Bug 947588. Part 2: Add gfxTextRunFactory::TEXT_HIDE_CONTROL_CHARACTERS to guard usage of IsInvalidControlChar. r=jfkthame
authorRobert O'Callahan <robert@ocallahan.org>
Wed, 05 Feb 2014 23:08:58 +1300
changeset 184961 fdd9c1c630490942dd8cafa3f889acbcb2da2d2e
parent 184960 cb4a327786ae23ae187648557ad6f541fbf0ad3c
child 184962 02b9260c2b9dc7f0da6690545561f1609b806d99
push id3503
push userraliiev@mozilla.com
push dateMon, 28 Apr 2014 18:51:11 +0000
treeherdermozilla-beta@c95ac01e332e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjfkthame
bugs947588
milestone30.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 947588. Part 2: Add gfxTextRunFactory::TEXT_HIDE_CONTROL_CHARACTERS to guard usage of IsInvalidControlChar. r=jfkthame
gfx/thebes/gfxFont.cpp
gfx/thebes/gfxFont.h
--- a/gfx/thebes/gfxFont.cpp
+++ b/gfx/thebes/gfxFont.cpp
@@ -3477,17 +3477,18 @@ gfxFont::ShapeTextWithoutWordCache(gfxCo
 
         // fragment was terminated by an invalid char: skip it,
         // unless it's a control char that we want to show as a hexbox,
         // but record where TAB or NEWLINE occur
         if (ch == '\t') {
             aTextRun->SetIsTab(aOffset + i);
         } else if (ch == '\n') {
             aTextRun->SetIsNewline(aOffset + i);
-        } else if (IsInvalidControlChar(ch)) {
+        } else if (IsInvalidControlChar(ch) &&
+            !(aTextRun->GetFlags() & gfxTextRunFactory::TEXT_HIDE_CONTROL_CHARACTERS)) {
             aTextRun->SetMissingGlyph(aOffset + i, ch, this);
         }
         fragStart = i + 1;
     }
 
     NS_WARN_IF_FALSE(ok, "failed to shape text - expect garbled text");
     return ok;
 }
@@ -3647,17 +3648,18 @@ gfxFont::SplitAndInitTextRun(gfxContext 
 
         // word was terminated by an invalid char: skip it,
         // unless it's a control char that we want to show as a hexbox,
         // but record where TAB or NEWLINE occur
         if (ch == '\t') {
             aTextRun->SetIsTab(aRunStart + i);
         } else if (ch == '\n') {
             aTextRun->SetIsNewline(aRunStart + i);
-        } else if (IsInvalidControlChar(ch)) {
+        } else if (IsInvalidControlChar(ch) &&
+            !(aTextRun->GetFlags() & gfxTextRunFactory::TEXT_HIDE_CONTROL_CHARACTERS)) {
             aTextRun->SetMissingGlyph(aRunStart + i, ch, this);
         }
 
         hash = 0;
         wordStart = i + 1;
         wordIs8Bit = true;
     }
 
--- a/gfx/thebes/gfxFont.h
+++ b/gfx/thebes/gfxFont.h
@@ -1132,16 +1132,21 @@ public:
         /**
          * For internal use by the memory reporter when accounting for
          * storage used by textruns.
          * Because the reporter may visit each textrun multiple times while
          * walking the frame trees and textrun cache, it needs to mark
          * textruns that have been seen so as to avoid multiple-accounting.
          */
         TEXT_RUN_SIZE_ACCOUNTED      = 0x0200,
+        /**
+         * When set, the textrun should discard control characters instead of
+         * turning them into hexboxes.
+         */
+        TEXT_HIDE_CONTROL_CHARACTERS = 0x0400,
 
         /**
          * nsTextFrameThebes sets these, but they're defined here rather than
          * in nsTextFrameUtils.h because ShapedWord creation/caching also needs
          * to check the _INCOMING flag
          */
         TEXT_TRAILING_ARABICCHAR = 0x20000000,
         /**