Test subpx cleanup. try: -b do -p linux64 -u all[linux64-qr] -t none
authorGlenn Watson <github@intuitionlibrary.com>
Wed, 01 Nov 2017 10:45:44 +1000
changeset 1338600 6c5a4afbe09261fa8ec2a3876c04cdc13063806c
parent 1338533 ee21e5f7f1c1726e0ed2697eb45df54cdceedd36
child 1587324 fb7b4f7ad6c6f506566811bab6fbdcaf5080aee5
push id232148
push usergwatson@mozilla.com
push dateWed, 01 Nov 2017 00:46:19 +0000
treeherdertry@6c5a4afbe092 [default view] [failures only]
milestone58.0a1
Test subpx cleanup. try: -b do -p linux64 -u all[linux64-qr] -t none
gfx/webrender/src/gamma_lut.rs
gfx/webrender/src/platform/macos/font.rs
gfx/webrender/src/platform/unix/font.rs
gfx/webrender/src/platform/windows/font.rs
gfx/webrender/src/prim_store.rs
gfx/webrender/src/tiling.rs
--- a/gfx/webrender/src/gamma_lut.rs
+++ b/gfx/webrender/src/gamma_lut.rs
@@ -290,92 +290,51 @@ impl GammaLut {
             tables: [[0; 256]; 1 << LUM_BITS],
         };
 
         table.generate_tables(contrast, paint_gamma, device_gamma);
 
         table
     }
 
-    // Skia normally preblends based on what the text color is.
-    // If we can't do that, use Skia default colors.
-    pub fn preblend_default_colors_bgra(&self, pixels: &mut [u8], width: usize, height: usize) {
-        let preblend_color = ColorU::new(0x7f, 0x80, 0x7f, 0xff);
-        self.preblend_bgra(pixels, width, height, preblend_color);
-    }
+    // Assumes pixels are in BGRA format. Assumes pixel values are in linear space already.
+    pub fn preblend(&self, pixels: &mut [u8], color: ColorU) {
+        let table_r = self.get_table(color.r);
+        let table_g = self.get_table(color.g);
+        let table_b = self.get_table(color.b);
 
-    fn replace_pixels_bgra(&self, pixels: &mut [u8], width: usize, height: usize,
-                           table_r: &[u8; 256], table_g: &[u8; 256], table_b: &[u8; 256]) {
-         for y in 0..height {
-            let current_height = y * width * 4;
-
-            for pixel in pixels[current_height..current_height + (width * 4)].chunks_mut(4) {
-                pixel[0] = table_b[pixel[0] as usize];
-                pixel[1] = table_g[pixel[1] as usize];
-                pixel[2] = table_r[pixel[2] as usize];
-                // Don't touch alpha
-            }
+        for pixel in pixels.chunks_mut(4) {
+            pixel[0] = table_b[pixel[0] as usize];
+            pixel[1] = table_g[pixel[1] as usize];
+            pixel[2] = table_r[pixel[2] as usize];
+            // Use green channel as a cheap grayscale approximation that won't disturb preblending.
+            pixel[3] = pixel[1];
         }
     }
 
-    // Mostly used by windows and GlyphRunAnalysis::GetAlphaTexture
-    fn replace_pixels_rgb(&self, pixels: &mut [u8], width: usize, height: usize,
-                          table_r: &[u8; 256], table_g: &[u8; 256], table_b: &[u8; 256]) {
-         for y in 0..height {
-            let current_height = y * width * 3;
-
-            for pixel in pixels[current_height..current_height + (width * 3)].chunks_mut(3) {
-                pixel[0] = table_r[pixel[0] as usize];
-                pixel[1] = table_g[pixel[1] as usize];
-                pixel[2] = table_b[pixel[2] as usize];
-            }
+    #[cfg(target_os="macos")]
+    pub fn coregraphics_convert_to_linear(&self, pixels: &mut [u8]) {
+        for pixel in pixels.chunks_mut(4) {
+            pixel[0] = self.cg_inverse_gamma[pixel[0] as usize];
+            pixel[1] = self.cg_inverse_gamma[pixel[1] as usize];
+            pixel[2] = self.cg_inverse_gamma[pixel[2] as usize];
         }
     }
 
     // Assumes pixels are in BGRA format. Assumes pixel values are in linear space already.
-    pub fn preblend_bgra(&self, pixels: &mut [u8], width: usize, height: usize, color: ColorU) {
-        let table_r = self.get_table(color.r);
-        let table_g = self.get_table(color.g);
-        let table_b = self.get_table(color.b);
-
-        self.replace_pixels_bgra(pixels, width, height, table_r, table_g, table_b);
-    }
-
-    // Assumes pixels are in RGB format. Assumes pixel values are in linear space already. NOTE:
-    // there is no alpha here.
-    pub fn preblend_rgb(&self, pixels: &mut [u8], width: usize, height: usize, color: ColorU) {
-        let table_r = self.get_table(color.r);
-        let table_g = self.get_table(color.g);
-        let table_b = self.get_table(color.b);
-
-        self.replace_pixels_rgb(pixels, width, height, table_r, table_g, table_b);
-    }
-
-    #[cfg(target_os="macos")]
-    pub fn coregraphics_convert_to_linear_bgra(&self, pixels: &mut [u8], width: usize, height: usize) {
-        self.replace_pixels_bgra(pixels, width, height,
-                                 &self.cg_inverse_gamma,
-                                 &self.cg_inverse_gamma,
-                                 &self.cg_inverse_gamma);
-    }
-
-    // Assumes pixels are in BGRA format. Assumes pixel values are in linear space already.
-    pub fn preblend_grayscale_bgra(&self, pixels: &mut [u8], width: usize, height: usize, color: ColorU) {
+    pub fn preblend_grayscale(&self, pixels: &mut [u8], color: ColorU) {
         let table_g = self.get_table(color.g);
 
-         for y in 0..height {
-            let current_height = y * width * 4;
-
-            for pixel in pixels[current_height..current_height + (width * 4)].chunks_mut(4) {
-                let luminance = compute_luminance(pixel[2], pixel[1], pixel[0]);
-                pixel[0] = table_g[luminance as usize];
-                pixel[1] = table_g[luminance as usize];
-                pixel[2] = table_g[luminance as usize];
-                pixel[3] = table_g[luminance as usize];
-            }
+        for pixel in pixels.chunks_mut(4) {
+            let luminance = compute_luminance(pixel[2], pixel[1], pixel[0]);
+            let alpha = table_g[luminance as usize];
+            pixel[0] = alpha;
+            pixel[1] = alpha;
+            pixel[2] = alpha;
+            pixel[3] = alpha;
         }
     }
 
 } // end impl GammaLut
 
 #[cfg(test)]
 mod tests {
     use std::cmp;
--- a/gfx/webrender/src/platform/macos/font.rs
+++ b/gfx/webrender/src/platform/macos/font.rs
@@ -366,30 +366,26 @@ impl FontContext {
                 }
             })
     }
 
     // Assumes the pixels here are linear values from CG
     fn gamma_correct_pixels(
         &self,
         pixels: &mut Vec<u8>,
-        width: usize,
-        height: usize,
         render_mode: FontRenderMode,
         color: ColorU,
     ) {
         // Then convert back to gamma corrected values.
         match render_mode {
             FontRenderMode::Alpha => {
-                self.gamma_lut
-                    .preblend_grayscale_bgra(pixels, width, height, color);
+                self.gamma_lut.preblend_grayscale(pixels, color);
             }
             FontRenderMode::Subpixel => {
-                self.gamma_lut
-                    .preblend_bgra(pixels, width, height, color);
+                self.gamma_lut.preblend(pixels, color);
             }
             _ => {} // Again, give mono untouched since only the alpha matters.
         }
     }
 
     #[allow(dead_code)]
     fn print_glyph_data(&mut self, data: &[u8], width: usize, height: usize) {
         // Rust doesn't have step_by support on stable :(
@@ -590,55 +586,46 @@ impl FontContext {
             // allowed to write to the alpha channel, because we're done calling
             // CG functions now.
 
             if smooth {
                 // Convert to linear space for subpixel AA.
                 // We explicitly do not do this for grayscale AA ("Alpha without
                 // smoothing" or Mono) because those rendering modes are not
                 // gamma-aware in CoreGraphics.
-                self.gamma_lut.coregraphics_convert_to_linear_bgra(
+                self.gamma_lut.coregraphics_convert_to_linear(
                     &mut rasterized_pixels,
-                    metrics.rasterized_width as usize,
-                    metrics.rasterized_height as usize,
                 );
             }
 
-            for i in 0 .. metrics.rasterized_height {
-                let current_height = (i * metrics.rasterized_width * 4) as usize;
-                let end_row = current_height + (metrics.rasterized_width as usize * 4);
-
-                for pixel in rasterized_pixels[current_height .. end_row].chunks_mut(4) {
-                    if invert {
-                        pixel[0] = 255 - pixel[0];
-                        pixel[1] = 255 - pixel[1];
-                        pixel[2] = 255 - pixel[2];
-                    }
+            for pixel in rasterized_pixels.chunks_mut(4) {
+                if invert {
+                    pixel[0] = 255 - pixel[0];
+                    pixel[1] = 255 - pixel[1];
+                    pixel[2] = 255 - pixel[2];
+                }
 
-                    // Set alpha to the value of the green channel. For grayscale
-                    // text, all three channels have the same value anyway.
-                    // For subpixel text, the mask's alpha only makes a difference
-                    // when computing the destination alpha on destination pixels
-                    // that are not completely opaque. Picking an alpha value
-                    // that's somehow based on the mask at least ensures that text
-                    // blending doesn't modify the destination alpha on pixels where
-                    // the mask is entirely zero.
-                    pixel[3] = pixel[1];
-                } // end row
-            } // end height
+                // Set alpha to the value of the green channel. For grayscale
+                // text, all three channels have the same value anyway.
+                // For subpixel text, the mask's alpha only makes a difference
+                // when computing the destination alpha on destination pixels
+                // that are not completely opaque. Picking an alpha value
+                // that's somehow based on the mask at least ensures that text
+                // blending doesn't modify the destination alpha on pixels where
+                // the mask is entirely zero.
+                pixel[3] = pixel[1];
+            }
 
             if smooth {
                 // Convert back from linear space into device space, and perform
                 // some "preblending" based on the text color.
                 // In Alpha + smoothing mode, this will also convert subpixel AA
                 // into grayscale AA.
                 self.gamma_correct_pixels(
                     &mut rasterized_pixels,
-                    metrics.rasterized_width as usize,
-                    metrics.rasterized_height as usize,
                     font.render_mode,
                     font.color,
                 );
             }
         }
 
         Some(RasterizedGlyph {
             left: metrics.rasterized_left as f32,
--- a/gfx/webrender/src/platform/unix/font.rs
+++ b/gfx/webrender/src/platform/unix/font.rs
@@ -549,67 +549,57 @@ impl FontContext {
                         final_buffer[dest + 1] = alpha;
                         final_buffer[dest + 2] = alpha;
                         final_buffer[dest + 3] = alpha;
                         src = unsafe { src.offset(1) };
                         dest += 4;
                     }
                 }
                 FT_Pixel_Mode::FT_PIXEL_MODE_LCD => {
-                    if subpixel_bgr {
-                        while dest < row_end {
-                            final_buffer[dest + 0] = unsafe { *src };
-                            final_buffer[dest + 1] = unsafe { *src.offset(1) };
-                            final_buffer[dest + 2] = unsafe { *src.offset(2) };
-                            final_buffer[dest + 3] = 0xff;
-                            src = unsafe { src.offset(3) };
-                            dest += 4;
+                    while dest < row_end {
+                        let (mut r, g, mut b) = unsafe { (*src, *src.offset(1), *src.offset(2)) };
+                        if subpixel_bgr {
+                            mem::swap(&mut r, &mut b);
                         }
-                    } else {
-                        while dest < row_end {
-                            final_buffer[dest + 2] = unsafe { *src };
-                            final_buffer[dest + 1] = unsafe { *src.offset(1) };
-                            final_buffer[dest + 0] = unsafe { *src.offset(2) };
-                            final_buffer[dest + 3] = 0xff;
-                            src = unsafe { src.offset(3) };
-                            dest += 4;
-                        }
+                        final_buffer[dest + 0] = b;
+                        final_buffer[dest + 1] = g;
+                        final_buffer[dest + 2] = r;
+                        // Use green as a cheap grayscale approximation.
+                        final_buffer[dest + 3] = g;
+                        src = unsafe { src.offset(3) };
+                        dest += 4;
                     }
                 }
                 FT_Pixel_Mode::FT_PIXEL_MODE_LCD_V => {
-                    if subpixel_bgr {
-                        while dest < row_end {
-                            final_buffer[dest + 0] = unsafe { *src };
-                            final_buffer[dest + 1] = unsafe { *src.offset(bitmap.pitch as isize) };
-                            final_buffer[dest + 2] = unsafe { *src.offset((2 * bitmap.pitch) as isize) };
-                            final_buffer[dest + 3] = 0xff;
-                            src = unsafe { src.offset(1) };
-                            dest += 4;
+                    while dest < row_end {
+                        let (mut r, g, mut b) =
+                            unsafe { (*src, *src.offset(bitmap.pitch as isize), *src.offset((2 * bitmap.pitch) as isize)) };
+                        if subpixel_bgr {
+                            mem::swap(&mut r, &mut b);
                         }
-                    } else {
-                        while dest < row_end {
-                            final_buffer[dest + 2] = unsafe { *src };
-                            final_buffer[dest + 1] = unsafe { *src.offset(bitmap.pitch as isize) };
-                            final_buffer[dest + 0] = unsafe { *src.offset((2 * bitmap.pitch) as isize) };
-                            final_buffer[dest + 3] = 0xff;
-                            src = unsafe { src.offset(1) };
-                            dest += 4;
-                        }
+                        final_buffer[dest + 0] = b;
+                        final_buffer[dest + 1] = g;
+                        final_buffer[dest + 2] = r;
+                        // Use green as a cheap grayscale approximation.
+                        final_buffer[dest + 3] = g;
+                        src = unsafe { src.offset(1) };
+                        dest += 4;
                     }
                     src_row = unsafe { src_row.offset((2 * bitmap.pitch) as isize) };
                 }
                 FT_Pixel_Mode::FT_PIXEL_MODE_BGRA => {
                     // The source is premultiplied BGRA data.
                     let dest_slice = &mut final_buffer[dest .. row_end];
                     let src_slice = unsafe { slice::from_raw_parts(src, dest_slice.len()) };
                     dest_slice.copy_from_slice(src_slice);
                 }
                 _ => panic!("Unsupported {:?}", pixel_mode),
             }
             src_row = unsafe { src_row.offset(bitmap.pitch as isize) };
+            dest = row_end;
         }
 
         Some(RasterizedGlyph {
             left: ((dimensions.left + left) as f32 * scale).round(),
             top: ((dimensions.top + top - actual_height) as f32 * scale).round(),
             width: actual_width as u32,
             height: actual_height as u32,
             scale,
--- a/gfx/webrender/src/platform/windows/font.rs
+++ b/gfx/webrender/src/platform/windows/font.rs
@@ -248,56 +248,56 @@ impl FontContext {
                     top: -bounds.top,
                     width,
                     height,
                     advance: advance,
                 }
             })
     }
 
-    // DWRITE gives us values in RGB. WR doesn't really touch it after. Note, CG returns in BGR
-    // TODO: Decide whether all fonts should return RGB or BGR
-    fn convert_to_rgba(&self, pixels: &[u8], render_mode: FontRenderMode) -> Vec<u8> {
+    // DWrite ClearType gives us values in RGB, but WR expects BGRA.
+    fn convert_to_bgra(&self, pixels: &[u8], render_mode: FontRenderMode) -> Vec<u8> {
         match render_mode {
             FontRenderMode::Bitmap => {
                 unreachable!("TODO: bitmap fonts");
             }
             FontRenderMode::Mono => {
-                let mut rgba_pixels: Vec<u8> = vec![0; pixels.len() * 4];
+                let mut bgra_pixels: Vec<u8> = vec![0; pixels.len() * 4];
                 for i in 0 .. pixels.len() {
-                    rgba_pixels[i * 4 + 0] = pixels[i];
-                    rgba_pixels[i * 4 + 1] = pixels[i];
-                    rgba_pixels[i * 4 + 2] = pixels[i];
-                    rgba_pixels[i * 4 + 3] = pixels[i];
+                    let alpha = pixels[i];
+                    bgra_pixels[i * 4 + 0] = alpha;
+                    bgra_pixels[i * 4 + 1] = alpha;
+                    bgra_pixels[i * 4 + 2] = alpha;
+                    bgra_pixels[i * 4 + 3] = alpha;
                 }
-                rgba_pixels
+                bgra_pixels
             }
             FontRenderMode::Alpha => {
                 let length = pixels.len() / 3;
-                let mut rgba_pixels: Vec<u8> = vec![0; length * 4];
+                let mut bgra_pixels: Vec<u8> = vec![0; length * 4];
                 for i in 0 .. length {
                     // Only take the G channel, as its closest to D2D
                     let alpha = pixels[i * 3 + 1] as u8;
-                    rgba_pixels[i * 4 + 0] = alpha;
-                    rgba_pixels[i * 4 + 1] = alpha;
-                    rgba_pixels[i * 4 + 2] = alpha;
-                    rgba_pixels[i * 4 + 3] = alpha;
+                    bgra_pixels[i * 4 + 0] = alpha;
+                    bgra_pixels[i * 4 + 1] = alpha;
+                    bgra_pixels[i * 4 + 2] = alpha;
+                    bgra_pixels[i * 4 + 3] = alpha;
                 }
-                rgba_pixels
+                bgra_pixels
             }
             FontRenderMode::Subpixel => {
                 let length = pixels.len() / 3;
-                let mut rgba_pixels: Vec<u8> = vec![0; length * 4];
+                let mut bgra_pixels: Vec<u8> = vec![0; length * 4];
                 for i in 0 .. length {
-                    rgba_pixels[i * 4 + 0] = pixels[i * 3 + 0];
-                    rgba_pixels[i * 4 + 1] = pixels[i * 3 + 1];
-                    rgba_pixels[i * 4 + 2] = pixels[i * 3 + 2];
-                    rgba_pixels[i * 4 + 3] = 0xff;
+                    bgra_pixels[i * 4 + 0] = pixels[i * 3 + 0];
+                    bgra_pixels[i * 4 + 1] = pixels[i * 3 + 1];
+                    bgra_pixels[i * 4 + 2] = pixels[i * 3 + 2];
+                    bgra_pixels[i * 4 + 3] = 0xff;
                 }
-                rgba_pixels
+                bgra_pixels
             }
         }
     }
 
     pub fn is_bitmap_font(&mut self, _font: &FontInstance) -> bool {
         // TODO(gw): Support bitmap fonts in DWrite.
         false
     }
@@ -323,53 +323,47 @@ impl FontContext {
         &mut self,
         font: &FontInstance,
         key: &GlyphKey,
     ) -> Option<RasterizedGlyph> {
         let analysis = self.create_glyph_analysis(font, key);
         let texture_type = dwrite_texture_type(font.render_mode);
 
         let bounds = analysis.get_alpha_texture_bounds(texture_type);
-        let width = (bounds.right - bounds.left) as usize;
-        let height = (bounds.bottom - bounds.top) as usize;
+        let width = (bounds.right - bounds.left) as u32;
+        let height = (bounds.bottom - bounds.top) as u32;
 
         // Alpha texture bounds can sometimes return an empty rect
         // Such as for spaces
         if width == 0 || height == 0 {
             return None;
         }
 
-        let mut pixels = analysis.create_alpha_texture(texture_type, bounds);
+        let pixels = analysis.create_alpha_texture(texture_type, bounds);
+        let mut bgra_pixels = self.convert_to_bgra(&pixels, font.render_mode);
 
         match font.render_mode {
             FontRenderMode::Mono | FontRenderMode::Bitmap => {}
             FontRenderMode::Alpha | FontRenderMode::Subpixel => {
                 let lut_correction = match font.platform_options {
                     Some(option) => if option.force_gdi_rendering {
                         &self.gdi_gamma_lut
                     } else {
                         &self.gamma_lut
                     },
                     None => &self.gamma_lut,
                 };
 
-                lut_correction.preblend_rgb(
-                    &mut pixels,
-                    width,
-                    height,
-                    font.color,
-                );
+                lut_correction.preblend(&mut bgra_pixels, font.color);
             }
         }
 
-        let rgba_pixels = self.convert_to_rgba(&mut pixels, font.render_mode);
-
         Some(RasterizedGlyph {
             left: bounds.left as f32,
             top: -bounds.top as f32,
-            width: width as u32,
-            height: height as u32,
+            width,
+            height,
             scale: 1.0,
             format: GlyphFormat::from(font.render_mode),
-            bytes: rgba_pixels,
+            bytes: bgra_pixels,
         })
     }
 }
--- a/gfx/webrender/src/prim_store.rs
+++ b/gfx/webrender/src/prim_store.rs
@@ -1,14 +1,14 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 use api::{BorderRadius, BuiltDisplayList, ColorF, ComplexClipRegion, DeviceIntRect};
-use api::{DevicePoint, ExtendMode, FontInstance, FontRenderMode, GlyphInstance, GlyphKey};
+use api::{DevicePoint, ExtendMode, FontInstance, GlyphInstance, GlyphKey};
 use api::{GradientStop, ImageKey, ImageRendering, ItemRange, ItemTag, LayerPoint, LayerRect};
 use api::{ClipMode, LayerSize, LayerVector2D, LineOrientation, LineStyle};
 use api::{TileOffset, YuvColorSpace, YuvFormat};
 use border::BorderCornerInstance;
 use clip::{ClipSourcesHandle, ClipStore, Geometry};
 use frame_builder::PrimitiveContext;
 use gpu_cache::{GpuBlockData, GpuCache, GpuCacheAddress, GpuCacheHandle, GpuDataRequest,
                 ToGpuBlocks};
@@ -549,49 +549,32 @@ pub struct TextRunPrimitiveCpu {
     pub font: FontInstance,
     pub offset: LayerVector2D,
     pub glyph_range: ItemRange<GlyphInstance>,
     pub glyph_count: usize,
     pub glyph_keys: Vec<GlyphKey>,
     pub glyph_gpu_blocks: Vec<GpuBlockData>,
 }
 
-#[derive(Debug, Copy, Clone, Eq, PartialEq)]
-pub enum TextRunMode {
-    Normal,
-    Shadow,
-}
 
 impl TextRunPrimitiveCpu {
-    pub fn get_font(&self,
-                    run_mode: TextRunMode,
-                    device_pixel_ratio: f32,
-    ) -> FontInstance {
+    pub fn get_font(&self, device_pixel_ratio: f32) -> FontInstance {
         let mut font = self.font.clone();
-        match run_mode {
-            TextRunMode::Normal => {}
-            TextRunMode::Shadow => {
-                // Shadows never use subpixel AA, but need to respect the alpha/mono flag
-                // for reftests.
-                font.render_mode = font.render_mode.limit_by(FontRenderMode::Alpha);
-            }
-        };
         font.size = font.size.scale_by(device_pixel_ratio);
         font
     }
 
     fn prepare_for_render(
         &mut self,
         resource_cache: &mut ResourceCache,
         device_pixel_ratio: f32,
         display_list: &BuiltDisplayList,
-        run_mode: TextRunMode,
         gpu_cache: &mut GpuCache,
     ) {
-        let font = self.get_font(run_mode, device_pixel_ratio);
+        let font = self.get_font(device_pixel_ratio);
 
         // Cache the glyph positions, if not in the cache already.
         // TODO(gw): In the future, remove `glyph_instances`
         //           completely, and just reference the glyphs
         //           directly from the display list.
         if self.glyph_keys.is_empty() {
             let subpx_dir = font.subpx_dir.limit_by(font.render_mode);
             let src_glyphs = display_list.get(self.glyph_range);
@@ -1092,17 +1075,16 @@ impl PrimitiveStore {
 
     fn prepare_prim_for_render_inner(
         &mut self,
         prim_index: PrimitiveIndex,
         prim_context: &PrimitiveContext,
         resource_cache: &mut ResourceCache,
         gpu_cache: &mut GpuCache,
         render_tasks: &mut RenderTaskTree,
-        text_run_mode: TextRunMode,
     ) {
         let metadata = &mut self.cpu_metadata[prim_index.0];
         match metadata.prim_kind {
             PrimitiveKind::Rectangle | PrimitiveKind::Border | PrimitiveKind::Line => {}
             PrimitiveKind::Picture => {
                 self.cpu_pictures[metadata.cpu_prim_index.0]
                     .prepare_for_render(
                         prim_index,
@@ -1111,17 +1093,16 @@ impl PrimitiveStore {
                     );
             }
             PrimitiveKind::TextRun => {
                 let text = &mut self.cpu_text_runs[metadata.cpu_prim_index.0];
                 text.prepare_for_render(
                     resource_cache,
                     prim_context.device_pixel_ratio,
                     prim_context.display_list,
-                    text_run_mode,
                     gpu_cache,
                 );
             }
             PrimitiveKind::Image => {
                 let image_cpu = &mut self.cpu_images[metadata.cpu_prim_index.0];
 
                 resource_cache.request_image(
                     image_cpu.image_key,
@@ -1352,17 +1333,16 @@ impl PrimitiveStore {
                 let sub_prim_index = PrimitiveIndex(run.prim_index.0 + i);
 
                 self.prepare_prim_for_render_inner(
                     sub_prim_index,
                     prim_context,
                     resource_cache,
                     gpu_cache,
                     render_tasks,
-                    TextRunMode::Shadow,
                 );
             }
         }
 
         if !self.update_clip_task(
             prim_index,
             prim_context,
             geometry.device_rect,
@@ -1375,17 +1355,16 @@ impl PrimitiveStore {
         }
 
         self.prepare_prim_for_render_inner(
             prim_index,
             prim_context,
             resource_cache,
             gpu_cache,
             render_tasks,
-            TextRunMode::Normal,
         );
 
         Some(geometry)
     }
 }
 
 
 //Test for one clip region contains another
--- a/gfx/webrender/src/tiling.rs
+++ b/gfx/webrender/src/tiling.rs
@@ -15,17 +15,17 @@ use glyph_rasterizer::GlyphFormat;
 use gpu_cache::{GpuCache, GpuCacheAddress, GpuCacheHandle, GpuCacheUpdateList};
 use gpu_types::{BlurDirection, BlurInstance, BrushInstance, BrushImageKind, ClipMaskInstance};
 use gpu_types::{CompositePrimitiveInstance, PrimitiveInstance, SimplePrimitiveInstance};
 use gpu_types::{BRUSH_FLAG_USES_PICTURE};
 use internal_types::{FastHashMap, SourceTexture};
 use internal_types::BatchTextures;
 use picture::PictureKind;
 use prim_store::{PrimitiveIndex, PrimitiveKind, PrimitiveMetadata, PrimitiveStore};
-use prim_store::{BrushMaskKind, BrushKind, DeferredResolve, RectangleContent, TextRunMode};
+use prim_store::{BrushMaskKind, BrushKind, DeferredResolve, RectangleContent};
 use profiler::FrameProfileCounters;
 use render_task::{AlphaRenderItem, ClipWorkItem, MaskGeometryKind, MaskSegment};
 use render_task::{RenderTaskAddress, RenderTaskId, RenderTaskKey, RenderTaskKind};
 use render_task::{BlurTask, ClearMode, RenderTaskLocation, RenderTaskTree};
 use renderer::BlendMode;
 use renderer::ImageBufferKind;
 use resource_cache::{GlyphFetchResult, ResourceCache};
 use std::{cmp, usize, f32, i32};
@@ -556,17 +556,17 @@ impl AlphaRenderItem {
                         );
                         let batch = batch_list.get_suitable_batch(key, item_bounding_rect);
                         batch.push(base_instance.build(uv_address.as_int(gpu_cache), 0, 0));
                     }
                     PrimitiveKind::TextRun => {
                         let text_cpu =
                             &ctx.prim_store.cpu_text_runs[prim_metadata.cpu_prim_index.0];
 
-                        let font = text_cpu.get_font(TextRunMode::Normal, ctx.device_pixel_ratio);
+                        let font = text_cpu.get_font(ctx.device_pixel_ratio);
 
                         ctx.resource_cache.fetch_glyphs(
                             font,
                             &text_cpu.glyph_keys,
                             glyph_fetch_buffer,
                             gpu_cache,
                             |texture_id, glyph_format, glyphs| {
                                 debug_assert_ne!(texture_id, SourceTexture::Invalid);
@@ -1231,17 +1231,17 @@ impl RenderTarget for ColorRenderTarget 
                                     PrimitiveKind::TextRun => {
                                         // Add instances that reference the text run GPU location. Also supply
                                         // the parent shadow prim address as a user data field, allowing
                                         // the shader to fetch the shadow parameters.
                                         let text = &ctx.prim_store.cpu_text_runs
                                             [sub_metadata.cpu_prim_index.0];
                                         let text_run_cache_prims = &mut self.text_run_cache_prims;
 
-                                        let font = text.get_font(TextRunMode::Shadow, ctx.device_pixel_ratio);
+                                        let font = text.get_font(ctx.device_pixel_ratio);
 
                                         ctx.resource_cache.fetch_glyphs(
                                             font,
                                             &text.glyph_keys,
                                             &mut self.glyph_fetch_buffer,
                                             gpu_cache,
                                             |texture_id, _glyph_format, glyphs| {
                                                 let batch = text_run_cache_prims