Bug 1073103 - Rename ThebesLayer to PaintedLayer. r=roc
authorMarkus Stange <mstange@themasta.com>
Fri, 26 Sep 2014 13:06:08 -0400
changeset 222950 0e92508994019308a549b841ee0ec32321f93e72
parent 222949 4f90b7fb1918462222c557100342cdd627e2f3f3
child 222951 0edd9d046fd1f3de02a839122c188599a8e36328
push id7107
push userraliiev@mozilla.com
push dateMon, 13 Oct 2014 17:43:31 +0000
treeherdermozilla-aurora@b4b34e0acc75 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs1073103
milestone35.0a1
Bug 1073103 - Rename ThebesLayer to PaintedLayer. r=roc
dom/interfaces/base/nsIDOMWindowUtils.idl
embedding/browser/nsWebBrowser.cpp
gfx/layers/CompositorTypes.h
gfx/layers/ImageLayers.cpp
gfx/layers/ImageTypes.h
gfx/layers/LayerMetricsWrapper.h
gfx/layers/Layers.cpp
gfx/layers/Layers.h
gfx/layers/ReadbackLayer.h
gfx/layers/ReadbackProcessor.cpp
gfx/layers/ReadbackProcessor.h
gfx/layers/RotatedBuffer.cpp
gfx/layers/RotatedBuffer.h
gfx/layers/basic/BasicContainerLayer.cpp
gfx/layers/basic/BasicContainerLayer.h
gfx/layers/basic/BasicImplData.h
gfx/layers/basic/BasicLayerManager.cpp
gfx/layers/basic/BasicLayers.h
gfx/layers/basic/BasicPaintedLayer.cpp
gfx/layers/basic/BasicPaintedLayer.h
gfx/layers/basic/BasicThebesLayer.cpp
gfx/layers/basic/BasicThebesLayer.h
gfx/layers/client/ClientContainerLayer.h
gfx/layers/client/ClientLayerManager.cpp
gfx/layers/client/ClientLayerManager.h
gfx/layers/client/ClientPaintedLayer.cpp
gfx/layers/client/ClientPaintedLayer.h
gfx/layers/client/ClientThebesLayer.cpp
gfx/layers/client/ClientThebesLayer.h
gfx/layers/client/ClientTiledPaintedLayer.cpp
gfx/layers/client/ClientTiledPaintedLayer.h
gfx/layers/client/ClientTiledThebesLayer.cpp
gfx/layers/client/ClientTiledThebesLayer.h
gfx/layers/client/ContentClient.cpp
gfx/layers/client/ContentClient.h
gfx/layers/client/TiledContentClient.cpp
gfx/layers/client/TiledContentClient.h
gfx/layers/composite/ContainerLayerComposite.cpp
gfx/layers/composite/ImageLayerComposite.cpp
gfx/layers/composite/LayerManagerComposite.cpp
gfx/layers/composite/LayerManagerComposite.h
gfx/layers/composite/PaintedLayerComposite.cpp
gfx/layers/composite/PaintedLayerComposite.h
gfx/layers/composite/ThebesLayerComposite.cpp
gfx/layers/composite/ThebesLayerComposite.h
gfx/layers/composite/TiledContentHost.cpp
gfx/layers/d3d10/ColorLayerD3D10.h
gfx/layers/d3d10/ContainerLayerD3D10.cpp
gfx/layers/d3d10/LayerManagerD3D10.cpp
gfx/layers/d3d10/LayerManagerD3D10.h
gfx/layers/d3d10/PaintedLayerD3D10.cpp
gfx/layers/d3d10/PaintedLayerD3D10.h
gfx/layers/d3d10/ReadbackManagerD3D10.cpp
gfx/layers/d3d10/ReadbackManagerD3D10.h
gfx/layers/d3d10/ThebesLayerD3D10.cpp
gfx/layers/d3d10/ThebesLayerD3D10.h
gfx/layers/d3d11/ReadbackManagerD3D11.cpp
gfx/layers/d3d9/ContainerLayerD3D9.cpp
gfx/layers/d3d9/DeviceManagerD3D9.cpp
gfx/layers/d3d9/ImageLayerD3D9.cpp
gfx/layers/d3d9/LayerManagerD3D9.cpp
gfx/layers/d3d9/LayerManagerD3D9.h
gfx/layers/d3d9/PaintedLayerD3D9.cpp
gfx/layers/d3d9/PaintedLayerD3D9.h
gfx/layers/d3d9/ThebesLayerD3D9.cpp
gfx/layers/d3d9/ThebesLayerD3D9.h
gfx/layers/ipc/CompositableTransactionParent.cpp
gfx/layers/ipc/LayerTransactionParent.cpp
gfx/layers/ipc/LayersMessages.ipdlh
gfx/layers/ipc/ShadowLayerParent.cpp
gfx/layers/ipc/ShadowLayerParent.h
gfx/layers/ipc/ShadowLayers.cpp
gfx/layers/ipc/ShadowLayers.h
gfx/layers/moz.build
gfx/layers/protobuf/LayerScopePacket.pb.cc
gfx/layers/protobuf/LayerScopePacket.pb.h
gfx/layers/protobuf/LayerScopePacket.proto
gfx/tests/gtest/TestAsyncPanZoomController.cpp
gfx/tests/gtest/TestLayers.cpp
image/test/mochitest/test_animation2.html
layout/base/FrameLayerBuilder.cpp
layout/base/FrameLayerBuilder.h
layout/base/nsDisplayList.cpp
layout/base/nsDisplayList.h
layout/base/nsIPresShell.h
layout/base/nsLayoutUtils.h
layout/base/nsPresContext.cpp
layout/base/nsPresContext.h
layout/generic/nsFrameStateBits.h
layout/generic/nsGfxScrollFrame.cpp
layout/generic/nsPluginFrame.cpp
layout/reftests/border-radius/reftest.list
layout/svg/nsSVGIntegrationUtils.cpp
widget/gonk/HwcComposer2D.cpp
--- a/dom/interfaces/base/nsIDOMWindowUtils.idl
+++ b/dom/interfaces/base/nsIDOMWindowUtils.idl
@@ -1458,17 +1458,17 @@ interface nsIDOMWindowUtils : nsISupport
   boolean leafLayersPartitionWindow();
 
   /**
    * true if the (current inner) window may have event listeners for touch events.
    */
   readonly attribute boolean mayHaveTouchEventListeners;
  
   /**
-   * Check if any ThebesLayer painting has been done for this element,
+   * Check if any PaintedLayer painting has been done for this element,
    * clears the painted flags if they have.
    */
   boolean checkAndClearPaintedState(in nsIDOMElement aElement);
 
   /**
    * Get internal id of the stored blob, file or file handle.
    */
   [implicit_jscontext] long long getFileId(in jsval aFile);
--- a/embedding/browser/nsWebBrowser.cpp
+++ b/embedding/browser/nsWebBrowser.cpp
@@ -1632,17 +1632,17 @@ NS_IMETHODIMP nsWebBrowser::EnsureDocShe
    NS_ENSURE_TRUE(mDocShellTreeOwner, NS_ERROR_OUT_OF_MEMORY);
 
    NS_ADDREF(mDocShellTreeOwner);
    mDocShellTreeOwner->WebBrowser(this);
    
    return NS_OK;
 }
 
-static void DrawThebesLayer(ThebesLayer* aLayer,
+static void DrawPaintedLayer(PaintedLayer* aLayer,
                             gfxContext* aContext,
                             const nsIntRegion& aRegionToDraw,
                             DrawRegionClip aClip,
                             const nsIntRegion& aRegionToInvalidate,
                             void* aCallbackData)
 {
   nscolor* color = static_cast<nscolor*>(aCallbackData);
   aContext->NewPath();
@@ -1677,24 +1677,24 @@ void nsWebBrowser::WindowLowered(nsIWidg
 }
 
 bool nsWebBrowser::PaintWindow(nsIWidget* aWidget, nsIntRegion aRegion)
 {
   LayerManager* layerManager = aWidget->GetLayerManager();
   NS_ASSERTION(layerManager, "Must be in paint event");
 
   layerManager->BeginTransaction();
-  nsRefPtr<ThebesLayer> root = layerManager->CreateThebesLayer();
+  nsRefPtr<PaintedLayer> root = layerManager->CreatePaintedLayer();
   if (root) {
     nsIntRect dirtyRect = aRegion.GetBounds();
     root->SetVisibleRegion(dirtyRect);
     layerManager->SetRoot(root);
   }
 
-  layerManager->EndTransaction(DrawThebesLayer, &mBackgroundColor);
+  layerManager->EndTransaction(DrawPaintedLayer, &mBackgroundColor);
   return true;
 }
 
 NS_IMETHODIMP nsWebBrowser::GetPrimaryContentWindow(nsIDOMWindow** aDOMWindow)
 {
   *aDOMWindow = 0;
 
   nsCOMPtr<nsIDocShellTreeItem> item;
--- a/gfx/layers/CompositorTypes.h
+++ b/gfx/layers/CompositorTypes.h
@@ -157,26 +157,26 @@ MOZ_END_ENUM_CLASS(EffectTypes)
  * How the Compositable should manage textures.
  */
 MOZ_BEGIN_ENUM_CLASS(CompositableType, uint8_t)
   BUFFER_UNKNOWN,
   // the deprecated compositable types
   BUFFER_IMAGE_SINGLE,    // image/canvas with a single texture, single buffered
   BUFFER_IMAGE_BUFFERED,  // canvas, double buffered
   BUFFER_BRIDGE,          // image bridge protocol
-  BUFFER_CONTENT_INC,     // thebes layer interface, only sends incremental
+  BUFFER_CONTENT_INC,     // painted layer interface, only sends incremental
                           // updates to a texture on the compositor side.
   // somewhere in the middle
-  BUFFER_TILED,           // tiled thebes layer
+  BUFFER_TILED,           // tiled painted layer
   BUFFER_SIMPLE_TILED,
   // the new compositable types
   IMAGE,     // image with single buffering
   IMAGE_OVERLAY, // image without buffer
-  CONTENT_SINGLE,  // thebes layer interface, single buffering
-  CONTENT_DOUBLE,  // thebes layer interface, double buffering
+  CONTENT_SINGLE,  // painted layer interface, single buffering
+  CONTENT_DOUBLE,  // painted layer interface, double buffering
   BUFFER_COUNT
 MOZ_END_ENUM_CLASS(CompositableType)
 
 /**
  * How the texture host is used for composition,
  */
 MOZ_BEGIN_ENUM_CLASS(DeprecatedTextureHostFlags, uint8_t)
   DEFAULT = 0,       // The default texture host for the given SurfaceDescriptor
--- a/gfx/layers/ImageLayers.cpp
+++ b/gfx/layers/ImageLayers.cpp
@@ -39,18 +39,18 @@ void ImageLayer::ComputeEffectiveTransfo
       NS_ASSERTION(mScaleMode == ScaleMode::STRETCH,
                    "No other scalemodes than stretch and none supported yet.");
       local.Scale(mScaleToSize.width / sourceRect.width,
                   mScaleToSize.height / sourceRect.height, 1.0);
     }
   }
   // Snap our local transform first, and snap the inherited transform as well.
   // This makes our snapping equivalent to what would happen if our content
-  // was drawn into a ThebesLayer (gfxContext would snap using the local
-  // transform, then we'd snap again when compositing the ThebesLayer).
+  // was drawn into a PaintedLayer (gfxContext would snap using the local
+  // transform, then we'd snap again when compositing the PaintedLayer).
   mEffectiveTransform =
       SnapTransform(local, sourceRect, nullptr) *
       SnapTransformTranslation(aTransformToSurface, nullptr);
   ComputeEffectiveTransformForMaskLayer(aTransformToSurface);
 }
 
 }
 }
--- a/gfx/layers/ImageTypes.h
+++ b/gfx/layers/ImageTypes.h
@@ -31,17 +31,17 @@ MOZ_BEGIN_ENUM_CLASS(ImageFormat)
    * Currently only used on Android.
    */
   SHARED_RGB,
 
   /**
    * The CAIRO_SURFACE format creates a CairoImage. All backends should
    * support this format, because video rendering sometimes requires it.
    *
-   * This format is useful even though a ThebesLayer could be used.
+   * This format is useful even though a PaintedLayer could be used.
    * It makes it easy to render a cairo surface when another Image format
    * could be used. It can also avoid copying the surface data in some
    * cases.
    *
    * Images in CAIRO_SURFACE format should only be created and
    * manipulated on the main thread, since the underlying cairo surface
    * is main-thread-only.
    */
--- a/gfx/layers/LayerMetricsWrapper.h
+++ b/gfx/layers/LayerMetricsWrapper.h
@@ -72,17 +72,17 @@ namespace layers {
  *             +---+         +---+
  *             | E |         | F |
  *             +---+         +---+
  *
  * In this layer tree, the layer C has been expanded into a stack of container
  * layers C1...Cn, where C1 has FrameMetrics FM1 and Cn has FrameMetrics Fn.
  * Although in this example C (in the first layer tree) and C0 (in the second
  * layer tree) are both ContainerLayers (because they have children), they
- * do not have to be. They may just be ThebesLayers or ColorLayers, for example,
+ * do not have to be. They may just be PaintedLayers or ColorLayers, for example,
  * which do not have any children. However, the type of C will always be the
  * same as the type of C0.
  *
  * The LayerMetricsWrapper class allows client code to treat the first layer
  * tree as though it were the second. That is, instead of client code having
  * to iterate through the FrameMetrics objects directly, it can use a
  * LayerMetricsWrapper to encapsulate that aspect of the layer tree and just
  * walk the tree as if it were a stack of ContainerLayers.
--- a/gfx/layers/Layers.cpp
+++ b/gfx/layers/Layers.cpp
@@ -1146,21 +1146,21 @@ ContainerLayer::HasOpaqueAncestorLayer(L
       return true;
   }
   return false;
 }
 
 void
 ContainerLayer::DidRemoveChild(Layer* aLayer)
 {
-  ThebesLayer* tl = aLayer->AsThebesLayer();
+  PaintedLayer* tl = aLayer->AsPaintedLayer();
   if (tl && tl->UsedForReadback()) {
     for (Layer* l = mFirstChild; l; l = l->GetNextSibling()) {
       if (l->GetType() == TYPE_READBACK) {
-        static_cast<ReadbackLayer*>(l)->NotifyThebesLayerRemoved(tl);
+        static_cast<ReadbackLayer*>(l)->NotifyPaintedLayerRemoved(tl);
       }
     }
   }
   if (aLayer->GetType() == TYPE_READBACK) {
     static_cast<ReadbackLayer*>(aLayer)->NotifyRemoved();
   }
 }
 
@@ -1615,32 +1615,32 @@ Layer::DumpPacket(layerscope::LayersPack
   }
   // Mask layer
   if (mMaskLayer) {
     layer->set_mask(reinterpret_cast<uint64_t>(mMaskLayer.get()));
   }
 }
 
 void
-ThebesLayer::PrintInfo(std::stringstream& aStream, const char* aPrefix)
+PaintedLayer::PrintInfo(std::stringstream& aStream, const char* aPrefix)
 {
   Layer::PrintInfo(aStream, aPrefix);
   if (!mValidRegion.IsEmpty()) {
     AppendToString(aStream, mValidRegion, " [valid=", "]");
   }
 }
 
 void
-ThebesLayer::DumpPacket(layerscope::LayersPacket* aPacket, const void* aParent)
+PaintedLayer::DumpPacket(layerscope::LayersPacket* aPacket, const void* aParent)
 {
   Layer::DumpPacket(aPacket, aParent);
   // get this layer data
   using namespace layerscope;
   LayersPacket::Layer* layer = aPacket->mutable_layer(aPacket->layer_size()-1);
-  layer->set_type(LayersPacket::Layer::ThebesLayer);
+  layer->set_type(LayersPacket::Layer::PaintedLayer);
   if (!mValidRegion.IsEmpty()) {
     DumpRegion(layer->mutable_valid(), mValidRegion);
   }
 }
 
 void
 ContainerLayer::PrintInfo(std::stringstream& aStream, const char* aPrefix)
 {
--- a/gfx/layers/Layers.h
+++ b/gfx/layers/Layers.h
@@ -74,17 +74,17 @@ namespace layers {
 
 class Animation;
 class AnimationData;
 class AsyncPanZoomController;
 class ClientLayerManager;
 class CommonLayerAttributes;
 class Layer;
 class LayerMetricsWrapper;
-class ThebesLayer;
+class PaintedLayer;
 class ContainerLayer;
 class ImageLayer;
 class ColorLayer;
 class ImageContainer;
 class CanvasLayer;
 class ReadbackLayer;
 class ReadbackProcessor;
 class RefLayer;
@@ -154,18 +154,18 @@ static void LayerManagerUserDataDestroy(
  * rendered. Transactions cannot be nested
  *
  * Each transaction has two phases:
  * 1) Construction: layers are created, inserted, removed and have
  * properties set on them in this phase.
  * BeginTransaction and BeginTransactionWithTarget start a transaction in
  * the Construction phase. When the client has finished constructing the layer
  * tree, it should call EndConstruction() to enter the drawing phase.
- * 2) Drawing: ThebesLayers are rendered into in this phase, in tree
- * order. When the client has finished drawing into the ThebesLayers, it should
+ * 2) Drawing: PaintedLayers are rendered into in this phase, in tree
+ * order. When the client has finished drawing into the PaintedLayers, it should
  * call EndTransaction to complete the transaction.
  *
  * All layer API calls happen on the main thread.
  *
  * Layers are refcounted. The layer manager holds a reference to the
  * root layer, and each container layer holds a reference to its children.
  */
 class LayerManager {
@@ -230,75 +230,75 @@ public:
    * the given target context. The rendering will be complete when
    * EndTransaction returns.
    */
   virtual void BeginTransactionWithTarget(gfxContext* aTarget) = 0;
 
   enum EndTransactionFlags {
     END_DEFAULT = 0,
     END_NO_IMMEDIATE_REDRAW = 1 << 0,  // Do not perform the drawing phase
-    END_NO_COMPOSITE = 1 << 1, // Do not composite after drawing thebes layer contents.
+    END_NO_COMPOSITE = 1 << 1, // Do not composite after drawing painted layer contents.
     END_NO_REMOTE_COMPOSITE = 1 << 2 // Do not schedule a composition with a remote Compositor, if one exists.
   };
 
   FrameLayerBuilder* GetLayerBuilder() {
     return reinterpret_cast<FrameLayerBuilder*>(GetUserData(&gLayerManagerLayerBuilder));
   }
 
   /**
    * Attempts to end an "empty transaction". There must have been no
    * changes to the layer tree since the BeginTransaction().
-   * It's possible for this to fail; ThebesLayers may need to be updated
+   * It's possible for this to fail; PaintedLayers may need to be updated
    * due to VRAM data being lost, for example. In such cases this method
    * returns false, and the caller must proceed with a normal layer tree
    * update and EndTransaction.
    */
   virtual bool EndEmptyTransaction(EndTransactionFlags aFlags = END_DEFAULT) = 0;
 
   /**
-   * Function called to draw the contents of each ThebesLayer.
+   * Function called to draw the contents of each PaintedLayer.
    * aRegionToDraw contains the region that needs to be drawn.
    * This would normally be a subregion of the visible region.
    * The callee must draw all of aRegionToDraw. Drawing outside
    * aRegionToDraw will be clipped out or ignored.
    * The callee must draw all of aRegionToDraw.
-   * This region is relative to 0,0 in the ThebesLayer.
+   * This region is relative to 0,0 in the PaintedLayer.
    *
    * aRegionToInvalidate contains a region whose contents have been
    * changed by the layer manager and which must therefore be invalidated.
    * For example, this could be non-empty if a retained layer internally
    * switches from RGBA to RGB or back ... we might want to repaint it to
    * consistently use subpixel-AA or not.
-   * This region is relative to 0,0 in the ThebesLayer.
+   * This region is relative to 0,0 in the PaintedLayer.
    * aRegionToInvalidate may contain areas that are outside
    * aRegionToDraw; the callee must ensure that these areas are repainted
    * in the current layer manager transaction or in a later layer
    * manager transaction.
    *
    * aContext must not be used after the call has returned.
    * We guarantee that buffered contents in the visible
    * region are valid once drawing is complete.
    *
-   * The origin of aContext is 0,0 in the ThebesLayer.
+   * The origin of aContext is 0,0 in the PaintedLayer.
    */
-  typedef void (* DrawThebesLayerCallback)(ThebesLayer* aLayer,
+  typedef void (* DrawPaintedLayerCallback)(PaintedLayer* aLayer,
                                            gfxContext* aContext,
                                            const nsIntRegion& aRegionToDraw,
                                            DrawRegionClip aClip,
                                            const nsIntRegion& aRegionToInvalidate,
                                            void* aCallbackData);
 
   /**
    * Finish the construction phase of the transaction, perform the
    * drawing phase, and end the transaction.
-   * During the drawing phase, all ThebesLayers in the tree are
+   * During the drawing phase, all PaintedLayers in the tree are
    * drawn in tree order, exactly once each, except for those layers
    * where it is known that the visible region is empty.
    */
-  virtual void EndTransaction(DrawThebesLayerCallback aCallback,
+  virtual void EndTransaction(DrawPaintedLayerCallback aCallback,
                               void* aCallbackData,
                               EndTransactionFlags aFlags = END_DEFAULT) = 0;
 
   /**
    * Schedule a composition with the remote Compositor, if one exists
    * for this LayerManager. Useful in conjunction with the END_NO_REMOTE_COMPOSITE
    * flag to EndTransaction.
    */
@@ -374,39 +374,39 @@ public:
 
   /**
    * Hints that can be used during Thebes layer creation to influence the type
    * or properties of the layer created.
    *
    * NONE: No hint.
    * SCROLLABLE: This layer may represent scrollable content.
    */
-  enum ThebesLayerCreationHint {
+  enum PaintedLayerCreationHint {
     NONE, SCROLLABLE
   };
 
   /**
-   * Returns true if aLayer is optimized for the given ThebesLayerCreationHint.
+   * Returns true if aLayer is optimized for the given PaintedLayerCreationHint.
    */
-  virtual bool IsOptimizedFor(ThebesLayer* aLayer,
-                              ThebesLayerCreationHint aCreationHint)
+  virtual bool IsOptimizedFor(PaintedLayer* aLayer,
+                              PaintedLayerCreationHint aCreationHint)
   { return true; }
 
   /**
    * CONSTRUCTION PHASE ONLY
-   * Create a ThebesLayer for this manager's layer tree.
+   * Create a PaintedLayer for this manager's layer tree.
    */
-  virtual already_AddRefed<ThebesLayer> CreateThebesLayer() = 0;
+  virtual already_AddRefed<PaintedLayer> CreatePaintedLayer() = 0;
   /**
    * CONSTRUCTION PHASE ONLY
-   * Create a ThebesLayer for this manager's layer tree, with a creation hint
+   * Create a PaintedLayer for this manager's layer tree, with a creation hint
    * parameter to help optimise the type of layer created.
    */
-  virtual already_AddRefed<ThebesLayer> CreateThebesLayerWithHint(ThebesLayerCreationHint) {
-    return CreateThebesLayer();
+  virtual already_AddRefed<PaintedLayer> CreatePaintedLayerWithHint(PaintedLayerCreationHint) {
+    return CreatePaintedLayer();
   }
   /**
    * CONSTRUCTION PHASE ONLY
    * Create a ContainerLayer for this manager's layer tree.
    */
   virtual already_AddRefed<ContainerLayer> CreateContainerLayer() = 0;
   /**
    * CONSTRUCTION PHASE ONLY
@@ -786,17 +786,17 @@ public:
      * Disable subpixel AA for this layer. This is used if the display isn't suited
      * for subpixel AA like hidpi or rotated content.
      */
     CONTENT_DISABLE_SUBPIXEL_AA = 0x20
   };
   /**
    * CONSTRUCTION PHASE ONLY
    * This lets layout make some promises about what will be drawn into the
-   * visible region of the ThebesLayer. This enables internal quality
+   * visible region of the PaintedLayer. This enables internal quality
    * and performance optimizations.
    */
   void SetContentFlags(uint32_t aFlags)
   {
     NS_ASSERTION((aFlags & (CONTENT_OPAQUE | CONTENT_COMPONENT_ALPHA)) !=
                  (CONTENT_OPAQUE | CONTENT_COMPONENT_ALPHA),
                  "Can't be opaque and require component alpha");
     if (mContentFlags != aFlags) {
@@ -1319,19 +1319,19 @@ public:
    *
    * XXX: this interface is essentially LayerManager::Destroy, but at
    * Layer granularity.  It might be beneficial to unify them.
    */
   virtual void Disconnect() {}
 
   /**
    * Dynamic downcast to a Thebes layer. Returns null if this is not
-   * a ThebesLayer.
+   * a PaintedLayer.
    */
-  virtual ThebesLayer* AsThebesLayer() { return nullptr; }
+  virtual PaintedLayer* AsPaintedLayer() { return nullptr; }
 
   /**
    * Dynamic cast to a ContainerLayer. Returns null if this is not
    * a ContainerLayer.
    */
   virtual ContainerLayer* AsContainerLayer() { return nullptr; }
   virtual const ContainerLayer* AsContainerLayer() const { return nullptr; }
 
@@ -1651,56 +1651,56 @@ protected:
   uint64_t mAnimationGeneration;
 #ifdef MOZ_DUMP_PAINTING
   nsTArray<nsCString> mExtraDumpInfo;
 #endif
 };
 
 /**
  * A Layer which we can draw into using Thebes. It is a conceptually
- * infinite surface, but each ThebesLayer has an associated "valid region"
- * of contents that it is currently storing, which is finite. ThebesLayer
+ * infinite surface, but each PaintedLayer has an associated "valid region"
+ * of contents that it is currently storing, which is finite. PaintedLayer
  * implementations can store content between paints.
  *
- * ThebesLayers are rendered into during the drawing phase of a transaction.
+ * PaintedLayers are rendered into during the drawing phase of a transaction.
  *
- * Currently the contents of a ThebesLayer are in the device output color
+ * Currently the contents of a PaintedLayer are in the device output color
  * space.
  */
-class ThebesLayer : public Layer {
+class PaintedLayer : public Layer {
 public:
   /**
    * CONSTRUCTION PHASE ONLY
    * Tell this layer that the content in some region has changed and
    * will need to be repainted. This area is removed from the valid
    * region.
    */
   virtual void InvalidateRegion(const nsIntRegion& aRegion) = 0;
   /**
    * CONSTRUCTION PHASE ONLY
    * Set whether ComputeEffectiveTransforms should compute the
    * "residual translation" --- the translation that should be applied *before*
-   * mEffectiveTransform to get the ideal transform for this ThebesLayer.
+   * mEffectiveTransform to get the ideal transform for this PaintedLayer.
    * When this is true, ComputeEffectiveTransforms will compute the residual
    * and ensure that the layer is invalidated whenever the residual changes.
    * When it's false, a change in the residual will not trigger invalidation
    * and GetResidualTranslation will return 0,0.
    * So when the residual is to be ignored, set this to false for better
    * performance.
    */
   void SetAllowResidualTranslation(bool aAllow) { mAllowResidualTranslation = aAllow; }
 
   /**
    * Can be used anytime
    */
   const nsIntRegion& GetValidRegion() const { return mValidRegion; }
 
-  virtual ThebesLayer* AsThebesLayer() { return this; }
+  virtual PaintedLayer* AsPaintedLayer() { return this; }
 
-  MOZ_LAYER_DECL_NAME("ThebesLayer", TYPE_THEBES)
+  MOZ_LAYER_DECL_NAME("PaintedLayer", TYPE_THEBES)
 
   virtual void ComputeEffectiveTransforms(const gfx::Matrix4x4& aTransformToSurface)
   {
     gfx::Matrix4x4 idealTransform = GetLocalTransform() * aTransformToSurface;
     gfx::Matrix residual;
     mEffectiveTransform = SnapTransformTranslation(idealTransform,
         mAllowResidualTranslation ? &residual : nullptr);
     // The residual can only be a translation because SnapTransformTranslation
@@ -1712,33 +1712,33 @@ public:
       NS_ASSERTION(-0.5 <= mResidualTranslation.x && mResidualTranslation.x < 0.5 &&
                    -0.5 <= mResidualTranslation.y && mResidualTranslation.y < 0.5,
                    "Residual translation out of range");
       mValidRegion.SetEmpty();
     }
     ComputeEffectiveTransformForMaskLayer(aTransformToSurface);
   }
 
-  LayerManager::ThebesLayerCreationHint GetCreationHint() const { return mCreationHint; }
+  LayerManager::PaintedLayerCreationHint GetCreationHint() const { return mCreationHint; }
 
   bool UsedForReadback() { return mUsedForReadback; }
   void SetUsedForReadback(bool aUsed) { mUsedForReadback = aUsed; }
   /**
    * Returns the residual translation. Apply this translation when drawing
-   * into the ThebesLayer so that when mEffectiveTransform is applied afterwards
+   * into the PaintedLayer so that when mEffectiveTransform is applied afterwards
    * by layer compositing, the results exactly match the "ideal transform"
    * (the product of the transform of this layer and its ancestors).
    * Returns 0,0 unless SetAllowResidualTranslation(true) has been called.
    * The residual translation components are always in the range [-0.5, 0.5).
    */
   gfxPoint GetResidualTranslation() const { return mResidualTranslation; }
 
 protected:
-  ThebesLayer(LayerManager* aManager, void* aImplData,
-              LayerManager::ThebesLayerCreationHint aCreationHint = LayerManager::NONE)
+  PaintedLayer(LayerManager* aManager, void* aImplData,
+              LayerManager::PaintedLayerCreationHint aCreationHint = LayerManager::NONE)
     : Layer(aManager, aImplData)
     , mValidRegion()
     , mCreationHint(aCreationHint)
     , mUsedForReadback(false)
     , mAllowResidualTranslation(false)
   {
     mContentFlags = 0; // Clear NO_TEXT, NO_TEXT_OVER_TRANSPARENT
   }
@@ -1752,19 +1752,19 @@ protected:
    * mResidualTranslation is the translation that should be applied *before*
    * mEffectiveTransform to get the ideal transform.
    */
   gfxPoint mResidualTranslation;
   nsIntRegion mValidRegion;
   /**
    * The creation hint that was used when constructing this layer.
    */
-  const LayerManager::ThebesLayerCreationHint mCreationHint;
+  const LayerManager::PaintedLayerCreationHint mCreationHint;
   /**
-   * Set when this ThebesLayer is participating in readback, i.e. some
+   * Set when this PaintedLayer is participating in readback, i.e. some
    * ReadbackLayer (may) be getting its background from this layer.
    */
   bool mUsedForReadback;
   /**
    * True when
    */
   bool mAllowResidualTranslation;
 };
@@ -2122,18 +2122,18 @@ public:
   GraphicsFilter GetFilter() const { return mFilter; }
 
   MOZ_LAYER_DECL_NAME("CanvasLayer", TYPE_CANVAS)
 
   virtual void ComputeEffectiveTransforms(const gfx::Matrix4x4& aTransformToSurface)
   {
     // Snap our local transform first, and snap the inherited transform as well.
     // This makes our snapping equivalent to what would happen if our content
-    // was drawn into a ThebesLayer (gfxContext would snap using the local
-    // transform, then we'd snap again when compositing the ThebesLayer).
+    // was drawn into a PaintedLayer (gfxContext would snap using the local
+    // transform, then we'd snap again when compositing the PaintedLayer).
     mEffectiveTransform =
         SnapTransform(GetLocalTransform(), gfxRect(0, 0, mBounds.width, mBounds.height),
                       nullptr)*
         SnapTransformTranslation(aTransformToSurface, nullptr);
     ComputeEffectiveTransformForMaskLayer(aTransformToSurface);
   }
 
 protected:
--- a/gfx/layers/ReadbackLayer.h
+++ b/gfx/layers/ReadbackLayer.h
@@ -86,18 +86,18 @@ public:
 class ReadbackLayer : public Layer {
 public:
   MOZ_LAYER_DECL_NAME("ReadbackLayer", TYPE_READBACK)
 
   virtual void ComputeEffectiveTransforms(const gfx::Matrix4x4& aTransformToSurface)
   {
     // Snap our local transform first, and snap the inherited transform as well.
     // This makes our snapping equivalent to what would happen if our content
-    // was drawn into a ThebesLayer (gfxContext would snap using the local
-    // transform, then we'd snap again when compositing the ThebesLayer).
+    // was drawn into a PaintedLayer (gfxContext would snap using the local
+    // transform, then we'd snap again when compositing the PaintedLayer).
     mEffectiveTransform =
         SnapTransform(GetLocalTransform(), gfxRect(0, 0, mSize.width, mSize.height),
                       nullptr)*
         SnapTransformTranslation(aTransformToSurface, nullptr);
   }
 
   /**
    * CONSTRUCTION PHASE ONLY
@@ -135,17 +135,17 @@ public:
     return mBackgroundLayer || mBackgroundColor.a == 1.0;
   }
 
   void NotifyRemoved() {
     SetUnknown();
     mSink = nullptr;
   }
 
-  void NotifyThebesLayerRemoved(ThebesLayer* aLayer)
+  void NotifyPaintedLayerRemoved(PaintedLayer* aLayer)
   {
     if (mBackgroundLayer == aLayer) {
       mBackgroundLayer = nullptr;
     }
   }
 
   const nsIntPoint& GetBackgroundLayerOffset() { return mBackgroundLayerOffset; }
 
@@ -177,24 +177,24 @@ protected:
   virtual void PrintInfo(std::stringstream& aStream, const char* aPrefix);
 
   virtual void DumpPacket(layerscope::LayersPacket* aPacket, const void* aParent);
 
   uint64_t mSequenceCounter;
   nsAutoPtr<ReadbackSink> mSink;
   nsIntSize mSize;
 
-  // This can refer to any (earlier) sibling ThebesLayer. That ThebesLayer
-  // must have mUsedForReadback set on it. If the ThebesLayer is removed
-  // for the container, this will be set to null by NotifyThebesLayerRemoved.
-  // This ThebesLayer contains the contents which have previously been reported
-  // to mSink. The ThebesLayer had only an integer translation transform,
+  // This can refer to any (earlier) sibling PaintedLayer. That PaintedLayer
+  // must have mUsedForReadback set on it. If the PaintedLayer is removed
+  // for the container, this will be set to null by NotifyPaintedLayerRemoved.
+  // This PaintedLayer contains the contents which have previously been reported
+  // to mSink. The PaintedLayer had only an integer translation transform,
   // and it covered the entire readback area. This layer also had only an
   // integer translation transform.
-  ThebesLayer* mBackgroundLayer;
+  PaintedLayer* mBackgroundLayer;
   // When mBackgroundLayer is non-null, this is the offset to add to
   // convert from the coordinates of mBackgroundLayer to the coordinates
   // of this layer.
   nsIntPoint   mBackgroundLayerOffset;
   // When mBackgroundColor is opaque, this is the color of the ColorLayer
   // that contained the contents we reported to mSink, which covered the
   // entire readback area.
   gfxRGBA      mBackgroundColor;
--- a/gfx/layers/ReadbackProcessor.cpp
+++ b/gfx/layers/ReadbackProcessor.cpp
@@ -1,16 +1,16 @@
 /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  * 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/. */
 
 #include "ReadbackProcessor.h"
 #include <sys/types.h>                  // for int32_t
-#include "Layers.h"                     // for Layer, ThebesLayer, etc
+#include "Layers.h"                     // for Layer, PaintedLayer, etc
 #include "ReadbackLayer.h"              // for ReadbackLayer, ReadbackSink
 #include "gfxColor.h"                   // for gfxRGBA
 #include "gfxContext.h"                 // for gfxContext
 #include "gfxRect.h"                    // for gfxRect
 #include "mozilla/gfx/BasePoint.h"      // for BasePoint
 #include "mozilla/gfx/BaseRect.h"       // for BaseRect
 #include "nsAutoPtr.h"                  // for nsRefPtr, nsAutoPtr
 #include "nsDebug.h"                    // for NS_ASSERTION
@@ -114,43 +114,43 @@ ReadbackProcessor::BuildUpdatesForLayer(
         ctx->SetColor(aLayer->mBackgroundColor);
         nsIntSize size = aLayer->GetSize();
         ctx->Rectangle(gfxRect(0, 0, size.width, size.height));
         ctx->Fill();
         aLayer->mSink->EndUpdate(ctx, aLayer->GetRect());
       }
     }
   } else {
-    NS_ASSERTION(newBackground->AsThebesLayer(), "Must be ThebesLayer");
-    ThebesLayer* thebesLayer = static_cast<ThebesLayer*>(newBackground);
-    // updateRect is relative to the ThebesLayer
+    NS_ASSERTION(newBackground->AsPaintedLayer(), "Must be PaintedLayer");
+    PaintedLayer* paintedLayer = static_cast<PaintedLayer*>(newBackground);
+    // updateRect is relative to the PaintedLayer
     nsIntRect updateRect = aLayer->GetRect() - offset;
-    if (thebesLayer != aLayer->mBackgroundLayer ||
+    if (paintedLayer != aLayer->mBackgroundLayer ||
         offset != aLayer->mBackgroundLayerOffset) {
-      aLayer->mBackgroundLayer = thebesLayer;
+      aLayer->mBackgroundLayer = paintedLayer;
       aLayer->mBackgroundLayerOffset = offset;
       aLayer->mBackgroundColor = gfxRGBA(0,0,0,0);
-      thebesLayer->SetUsedForReadback(true);
+      paintedLayer->SetUsedForReadback(true);
     } else {
       nsIntRegion invalid;
-      invalid.Sub(updateRect, thebesLayer->GetValidRegion());
+      invalid.Sub(updateRect, paintedLayer->GetValidRegion());
       updateRect = invalid.GetBounds();
     }
 
     Update update = { aLayer, updateRect, aLayer->AllocateSequenceNumber() };
     mAllUpdates.AppendElement(update);
   }
 }
 
 void
-ReadbackProcessor::GetThebesLayerUpdates(ThebesLayer* aLayer,
+ReadbackProcessor::GetPaintedLayerUpdates(PaintedLayer* aLayer,
                                          nsTArray<Update>* aUpdates,
                                          nsIntRegion* aUpdateRegion)
 {
-  // All ThebesLayers used for readback are in mAllUpdates (some possibly
+  // All PaintedLayers used for readback are in mAllUpdates (some possibly
   // with an empty update rect).
   aLayer->SetUsedForReadback(false);
   if (aUpdateRegion) {
     aUpdateRegion->SetEmpty();
   }
   for (uint32_t i = mAllUpdates.Length(); i > 0; --i) {
     const Update& update = mAllUpdates[i - 1];
     if (update.mLayer->mBackgroundLayer == aLayer) {
--- a/gfx/layers/ReadbackProcessor.h
+++ b/gfx/layers/ReadbackProcessor.h
@@ -12,63 +12,63 @@
  
 class nsIntRegion;
 
 namespace mozilla {
 namespace layers {
 
 class ContainerLayer;
 class ReadbackLayer;
-class ThebesLayer;
+class PaintedLayer;
 
 class ReadbackProcessor {
 public:
   /**
    * Called by the container before processing any child layers. Call this
    * if any child layer might have changed in any way (other than content-only
-   * changes to layers other than ColorLayers and ThebesLayers).
+   * changes to layers other than ColorLayers and PaintedLayers).
    *
    * This method recomputes the relationship between ReadbackLayers and
    * sibling layers, and dispatches changes to ReadbackLayers. Except that
-   * if a ThebesLayer needs its contents sent to some ReadbackLayer, we'll
-   * just record that internally and later the ThebesLayer should call
-   * GetThebesLayerUpdates when it paints, to find out which rectangle needs
+   * if a PaintedLayer needs its contents sent to some ReadbackLayer, we'll
+   * just record that internally and later the PaintedLayer should call
+   * GetPaintedLayerUpdates when it paints, to find out which rectangle needs
    * to be sent, and the ReadbackLayer it needs to be sent to.
    */
   void BuildUpdates(ContainerLayer* aContainer);
 
   struct Update {
     /**
-     * The layer a ThebesLayer should send its contents to.
+     * The layer a PaintedLayer should send its contents to.
      */
     ReadbackLayer* mLayer;
     /**
-     * The rectangle of content that it should send, in the ThebesLayer's
-     * coordinate system. This rectangle is guaranteed to be in the ThebesLayer's
+     * The rectangle of content that it should send, in the PaintedLayer's
+     * coordinate system. This rectangle is guaranteed to be in the PaintedLayer's
      * visible region. Translate it to mLayer's coordinate system
      * by adding mLayer->GetBackgroundLayerOffset().
      */
     nsIntRect      mUpdateRect;
     /**
      * The sequence counter value to use when calling DoUpdate
      */
     uint64_t       mSequenceCounter;
   };
   /**
    * Appends any ReadbackLayers that need to be updated, and the rects that
-   * need to be updated, to aUpdates. Only need to call this for ThebesLayers
+   * need to be updated, to aUpdates. Only need to call this for PaintedLayers
    * that have been marked UsedForReadback().
    * Each Update's mLayer's mBackgroundLayer will have been set to aLayer.
-   * If a ThebesLayer doesn't call GetThebesLayerUpdates, then all the
-   * ReadbackLayers that needed data from that ThebesLayer will be marked
+   * If a PaintedLayer doesn't call GetPaintedLayerUpdates, then all the
+   * ReadbackLayers that needed data from that PaintedLayer will be marked
    * as having unknown backgrounds.
    * @param aUpdateRegion if non-null, this region is set to the union
    * of the mUpdateRects.
    */
-  void GetThebesLayerUpdates(ThebesLayer* aLayer,
+  void GetPaintedLayerUpdates(PaintedLayer* aLayer,
                              nsTArray<Update>* aUpdates,
                              nsIntRegion* aUpdateRegion = nullptr);
 
   ~ReadbackProcessor();
 
 protected:
   void BuildUpdatesForLayer(ReadbackLayer* aLayer);
 
--- a/gfx/layers/RotatedBuffer.cpp
+++ b/gfx/layers/RotatedBuffer.cpp
@@ -5,17 +5,17 @@
 
 #include "RotatedBuffer.h"
 #include <sys/types.h>                  // for int32_t
 #include <algorithm>                    // for max
 #include "BasicImplData.h"              // for BasicImplData
 #include "BasicLayersImpl.h"            // for ToData
 #include "BufferUnrotate.h"             // for BufferUnrotate
 #include "GeckoProfiler.h"              // for PROFILER_LABEL
-#include "Layers.h"                     // for ThebesLayer, Layer, etc
+#include "Layers.h"                     // for PaintedLayer, Layer, etc
 #include "gfxPlatform.h"                // for gfxPlatform
 #include "gfxPrefs.h"                   // for gfxPrefs
 #include "gfxUtils.h"                   // for gfxUtils
 #include "mozilla/ArrayUtils.h"         // for ArrayLength
 #include "mozilla/gfx/BasePoint.h"      // for BasePoint
 #include "mozilla/gfx/BaseRect.h"       // for BaseRect
 #include "mozilla/gfx/BaseSize.h"       // for BaseSize
 #include "mozilla/gfx/Matrix.h"         // for Matrix
@@ -198,17 +198,17 @@ RotatedContentBuffer::IsClippingCheap(Dr
 {
   // Assume clipping is cheap if the draw target just has an integer
   // translation, and the visible region is simple.
   return !aTarget->GetTransform().HasNonIntegerTranslation() &&
          aRegion.GetNumRects() <= 1;
 }
 
 void
-RotatedContentBuffer::DrawTo(ThebesLayer* aLayer,
+RotatedContentBuffer::DrawTo(PaintedLayer* aLayer,
                              DrawTarget* aTarget,
                              float aOpacity,
                              CompositionOp aOp,
                              SourceSurface* aMask,
                              const Matrix* aMaskTransform)
 {
   if (!EnsureBuffer()) {
     return;
@@ -423,17 +423,17 @@ RotatedContentBuffer::FlushBuffers()
     mDTBuffer->Flush();
   }
   if (mDTBufferOnWhite) {
     mDTBufferOnWhite->Flush();
   }
 }
 
 RotatedContentBuffer::PaintState
-RotatedContentBuffer::BeginPaint(ThebesLayer* aLayer,
+RotatedContentBuffer::BeginPaint(PaintedLayer* aLayer,
                                  uint32_t aFlags)
 {
   PaintState result;
   // We need to disable rotation if we're going to be resampled when
   // drawing, because we might sample across the rotation boundary.
   bool canHaveRotation = gfxPlatform::BufferRotationEnabled() &&
                          !(aFlags & (PAINT_WILL_RESAMPLE | PAINT_NO_ROTATION));
 
--- a/gfx/layers/RotatedBuffer.h
+++ b/gfx/layers/RotatedBuffer.h
@@ -26,17 +26,17 @@ struct nsIntSize;
 namespace mozilla {
 namespace gfx {
 class Matrix;
 }
 
 namespace layers {
 
 class TextureClient;
-class ThebesLayer;
+class PaintedLayer;
 
 /**
  * This is a cairo/Thebes surface, but with a literal twist. Scrolling
  * causes the layer's visible region to move. We want to keep
  * reusing the same surface if the region size hasn't changed, but we don't
  * want to keep moving the contents of the surface around in memory. So
  * we use a trick.
  * Consider just the vertical case, and suppose the buffer is H pixels
@@ -110,17 +110,17 @@ protected:
    */
   void DrawBufferQuadrant(gfx::DrawTarget* aTarget, XSide aXSide, YSide aYSide,
                           ContextSource aSource,
                           float aOpacity,
                           gfx::CompositionOp aOperator,
                           gfx::SourceSurface* aMask,
                           const gfx::Matrix* aMaskTransform) const;
 
-  /** The area of the ThebesLayer that is covered by the buffer as a whole */
+  /** The area of the PaintedLayer that is covered by the buffer as a whole */
   nsIntRect             mBufferRect;
   /**
    * The x and y rotation of the buffer. Conceptually the buffer
    * has its origin translated to mBufferRect.TopLeft() - mBufferRotation,
    * is tiled to fill the plane, and the result is clipped to mBufferRect.
    * So the pixel at mBufferRotation within the buffer is what gets painted at
    * mBufferRect.TopLeft().
    * This is "rotation" in the sense of rotating items in a linear buffer,
@@ -164,29 +164,29 @@ protected:
   // The draw target loaned by BorrowDrawTargetForQuadrantUpdate. It should not
   // be used, we just keep a reference to ensure it is kept alive and so we can
   // correctly restore state when it is returned.
   RefPtr<gfx::DrawTarget> mLoanedDrawTarget;
   gfx::Matrix mLoanedTransform;
 };
 
 /**
- * This class encapsulates the buffer used to retain ThebesLayer contents,
+ * This class encapsulates the buffer used to retain PaintedLayer contents,
  * i.e., the contents of the layer's GetVisibleRegion().
  */
 class RotatedContentBuffer : public RotatedBuffer
                            , public BorrowDrawTarget
 {
 public:
   typedef gfxContentType ContentType;
 
   /**
    * Controls the size of the backing buffer of this.
    * - SizedToVisibleBounds: the backing buffer is exactly the same
-   *   size as the bounds of ThebesLayer's visible region
+   *   size as the bounds of PaintedLayer's visible region
    * - ContainsVisibleBounds: the backing buffer is large enough to
    *   fit visible bounds.  May be larger.
    */
   enum BufferSizePolicy {
     SizedToVisibleBounds,
     ContainsVisibleBounds
   };
 
@@ -262,17 +262,17 @@ public:
    * make the entire buffer contents valid (since we don't want to sample
    * invalid pixels outside the visible region, if the visible region doesn't
    * fill the buffer bounds).
    * PAINT_CAN_DRAW_ROTATED can be passed if the caller supports drawing
    * rotated content that crosses the physical buffer boundary. The caller
    * will need to call BorrowDrawTargetForPainting multiple times to achieve
    * this.
    */
-  PaintState BeginPaint(ThebesLayer* aLayer,
+  PaintState BeginPaint(PaintedLayer* aLayer,
                         uint32_t aFlags);
 
   struct DrawIterator {
     friend class RotatedContentBuffer;
     friend class ContentClientIncremental;
     DrawIterator()
       : mCount(0)
     {}
@@ -328,17 +328,17 @@ public:
 
   virtual TemporaryRef<gfx::SourceSurface> GetSourceSurface(ContextSource aSource) const;
 
   /**
    * Complete the drawing operation. The region to draw must have been
    * drawn before this is called. The contents of the buffer are drawn
    * to aTarget.
    */
-  void DrawTo(ThebesLayer* aLayer,
+  void DrawTo(PaintedLayer* aLayer,
               gfx::DrawTarget* aTarget,
               float aOpacity,
               gfx::CompositionOp aOp,
               gfx::SourceSurface* aMask,
               const gfx::Matrix* aMaskTransform);
 
 protected:
   // new texture client versions
--- a/gfx/layers/basic/BasicContainerLayer.cpp
+++ b/gfx/layers/basic/BasicContainerLayer.cpp
@@ -110,17 +110,17 @@ BasicContainerLayer::ChildrenPartitionVi
       return false;
     covered.Or(covered, childRegion);
   }
 
   return covered.Contains(rect);
 }
 
 void
-BasicContainerLayer::Validate(LayerManager::DrawThebesLayerCallback aCallback,
+BasicContainerLayer::Validate(LayerManager::DrawPaintedLayerCallback aCallback,
                               void* aCallbackData,
                               ReadbackProcessor* aReadback)
 {
   ReadbackProcessor readback;
   if (BasicManager()->IsRetained()) {
     readback.BuildUpdates(this);
   }
   for (Layer* l = mFirstChild; l; l = l->GetNextSibling()) {
--- a/gfx/layers/basic/BasicContainerLayer.h
+++ b/gfx/layers/basic/BasicContainerLayer.h
@@ -79,17 +79,17 @@ public:
    * circumstances.
    */
   bool ChildrenPartitionVisibleRegion(const nsIntRect& aInRect);
 
   void ForceIntermediateSurface() { mUseIntermediateSurface = true; }
 
   void SetSupportsComponentAlphaChildren(bool aSupports) { mSupportsComponentAlphaChildren = aSupports; }
 
-  virtual void Validate(LayerManager::DrawThebesLayerCallback aCallback,
+  virtual void Validate(LayerManager::DrawPaintedLayerCallback aCallback,
                         void* aCallbackData,
                         ReadbackProcessor* aReadback) MOZ_OVERRIDE;
 
   /**
    * We don't really have a hard restriction for max layer size, but we pick
    * 4096 to avoid excessive memory usage.
    */
   virtual int32_t GetMaxLayerSize() MOZ_OVERRIDE { return 4096; }
--- a/gfx/layers/basic/BasicImplData.h
+++ b/gfx/layers/basic/BasicImplData.h
@@ -26,19 +26,19 @@ class SurfaceDescriptor;
  * The class hierarchy for Basic layers is like this:
  *                                 BasicImplData
  * Layer                            |   |   |
  *  |                               |   |   |
  *  +-> ContainerLayer              |   |   |
  *  |    |                          |   |   |
  *  |    +-> BasicContainerLayer <--+   |   |
  *  |                                   |   |
- *  +-> ThebesLayer                     |   |
+ *  +-> PaintedLayer                     |   |
  *  |    |                              |   |
- *  |    +-> BasicThebesLayer <---------+   |
+ *  |    +-> BasicPaintedLayer <---------+   |
  *  |                                       |
  *  +-> ImageLayer                          |
  *       |                                  |
  *       +-> BasicImageLayer <--------------+
  */
 class BasicImplData {
 public:
   BasicImplData() : mHidden(false),
@@ -59,27 +59,27 @@ public:
    * set up to account for all the properties of the layer (transform,
    * opacity, etc).
    */
   virtual void Paint(gfx::DrawTarget* aDT,
                      const gfx::Point& aDeviceOffset,
                      Layer* aMaskLayer) {}
 
   /**
-   * Like Paint() but called for ThebesLayers with the additional parameters
+   * Like Paint() but called for PaintedLayers with the additional parameters
    * they need.
    * If mClipToVisibleRegion is set, then the layer must clip to its
    * effective visible region (snapped or unsnapped, it doesn't matter).
    */
   virtual void PaintThebes(gfxContext* aContext,
                            Layer* aMasklayer,
-                           LayerManager::DrawThebesLayerCallback aCallback,
+                           LayerManager::DrawPaintedLayerCallback aCallback,
                            void* aCallbackData) {}
 
-  virtual void Validate(LayerManager::DrawThebesLayerCallback aCallback,
+  virtual void Validate(LayerManager::DrawPaintedLayerCallback aCallback,
                         void* aCallbackData,
                         ReadbackProcessor* aReadback) {}
 
   /**
    * Layers will get this call when their layer manager is destroyed, this
    * indicates they should clear resources they don't really need after their
    * LayerManager ceases to exist.
    */
--- a/gfx/layers/basic/BasicLayerManager.cpp
+++ b/gfx/layers/basic/BasicLayerManager.cpp
@@ -121,17 +121,17 @@ ToInsideIntRect(const gfxRect& aRect)
 // A context helper for BasicLayerManager::PaintLayer() that holds all the
 // painting context together in a data structure so it can be easily passed
 // around. It also uses ensures that the Transform and Opaque rect are restored
 // to their former state on destruction.
 
 class PaintLayerContext {
 public:
   PaintLayerContext(gfxContext* aTarget, Layer* aLayer,
-                    LayerManager::DrawThebesLayerCallback aCallback,
+                    LayerManager::DrawPaintedLayerCallback aCallback,
                     void* aCallbackData)
    : mTarget(aTarget)
    , mTargetMatrixSR(aTarget)
    , mLayer(aLayer)
    , mCallback(aCallback)
    , mCallbackData(aCallbackData)
    , mPushedOpaqueRect(false)
   {}
@@ -191,17 +191,17 @@ public:
   // painting is complete the opaque rect qill be clear.
   void ClearOpaqueRect() {
     mTarget->GetDrawTarget()->SetOpaqueRect(IntRect());
   }
 
   gfxContext* mTarget;
   gfxContextMatrixAutoSaveRestore mTargetMatrixSR;
   Layer* mLayer;
-  LayerManager::DrawThebesLayerCallback mCallback;
+  LayerManager::DrawPaintedLayerCallback mCallback;
   void* mCallbackData;
   Matrix mTransform;
   bool mPushedOpaqueRect;
 };
 
 BasicLayerManager::BasicLayerManager(nsIWidget* aWidget)
   : mPhase(PHASE_NONE)
   , mWidget(aWidget)
@@ -440,17 +440,17 @@ ApplyDoubleBuffering(Layer* aLayer, cons
         ToData(child)->SetClipToVisibleRegion(true);
         ApplyDoubleBuffering(child, newVisibleRect);
       }
     }
   }
 }
 
 void
-BasicLayerManager::EndTransaction(DrawThebesLayerCallback aCallback,
+BasicLayerManager::EndTransaction(DrawPaintedLayerCallback aCallback,
                                   void* aCallbackData,
                                   EndTransactionFlags aFlags)
 {
   mInTransaction = false;
 
   EndTransactionInternal(aCallback, aCallbackData, aFlags);
 }
 
@@ -459,17 +459,17 @@ BasicLayerManager::AbortTransaction()
 {
   NS_ASSERTION(InConstruction(), "Should be in construction phase");
   mPhase = PHASE_NONE;
   mUsingDefaultTarget = false;
   mInTransaction = false;
 }
 
 bool
-BasicLayerManager::EndTransactionInternal(DrawThebesLayerCallback aCallback,
+BasicLayerManager::EndTransactionInternal(DrawPaintedLayerCallback aCallback,
                                           void* aCallbackData,
                                           EndTransactionFlags aFlags)
 {
   PROFILER_LABEL("BasicLayerManager", "EndTransactionInternal",
     js::ProfileEntry::Category::GRAPHICS);
 
 #ifdef MOZ_LAYERS_HAVE_LOG
   MOZ_LAYERS_LOG(("  ----- (beginning paint)"));
@@ -722,17 +722,17 @@ void
 BasicLayerManager::PaintSelfOrChildren(PaintLayerContext& aPaintContext,
                                        gfxContext* aGroupTarget)
 {
   BasicImplData* data = ToData(aPaintContext.mLayer);
 
   /* Only paint ourself, or our children - This optimization relies on this! */
   Layer* child = aPaintContext.mLayer->GetFirstChild();
   if (!child) {
-    if (aPaintContext.mLayer->AsThebesLayer()) {
+    if (aPaintContext.mLayer->AsPaintedLayer()) {
       data->PaintThebes(aGroupTarget, aPaintContext.mLayer->GetMaskLayer(),
           aPaintContext.mCallback, aPaintContext.mCallbackData);
     } else {
       data->Paint(aGroupTarget->GetDrawTarget(),
                   aGroupTarget->GetDeviceOffset(),
                   aPaintContext.mLayer->GetMaskLayer());
     }
   } else {
@@ -773,17 +773,17 @@ BasicLayerManager::FlushGroup(PaintLayer
     PaintWithMask(aPaintContext.mTarget, aPaintContext.mLayer->GetEffectiveOpacity(),
                   aPaintContext.mLayer->GetMaskLayer());
   }
 }
 
 void
 BasicLayerManager::PaintLayer(gfxContext* aTarget,
                               Layer* aLayer,
-                              DrawThebesLayerCallback aCallback,
+                              DrawPaintedLayerCallback aCallback,
                               void* aCallbackData)
 {
   PROFILER_LABEL("BasicLayerManager", "PaintLayer",
     js::ProfileEntry::Category::GRAPHICS);
 
   PaintLayerContext paintLayerContext(aTarget, aLayer, aCallback, aCallbackData);
 
   // Don't attempt to paint layers with a singular transform, cairo will
@@ -797,17 +797,17 @@ BasicLayerManager::PaintLayer(gfxContext
   const nsIntRect* clipRect = aLayer->GetEffectiveClipRect();
   // aLayer might not be a container layer, but if so we take care not to use
   // the container variable
   BasicContainerLayer* container = static_cast<BasicContainerLayer*>(aLayer);
   bool needsGroup = aLayer->GetFirstChild() &&
                     container->UseIntermediateSurface();
   BasicImplData* data = ToData(aLayer);
   bool needsClipToVisibleRegion =
-    data->GetClipToVisibleRegion() && !aLayer->AsThebesLayer();
+    data->GetClipToVisibleRegion() && !aLayer->AsPaintedLayer();
   NS_ASSERTION(needsGroup || !aLayer->GetFirstChild() ||
                container->GetOperator() == CompositionOp::OP_OVER,
                "non-OVER operator should have forced UseIntermediateSurface");
   NS_ASSERTION(!aLayer->GetFirstChild() || !aLayer->GetMaskLayer() ||
                container->UseIntermediateSurface(),
                "ContainerLayer with mask layer should force UseIntermediateSurface");
 
   gfxContextAutoSaveRestore contextSR;
--- a/gfx/layers/basic/BasicLayers.h
+++ b/gfx/layers/basic/BasicLayers.h
@@ -32,42 +32,42 @@ class ImageLayer;
 class PaintLayerContext;
 class ReadbackLayer;
 class ReadbackProcessor;
 
 /**
  * This is a cairo/Thebes-only, main-thread-only implementation of layers.
  * 
  * In each transaction, the client sets up the layer tree and then during
- * the drawing phase, each ThebesLayer is painted directly into the target
+ * the drawing phase, each PaintedLayer is painted directly into the target
  * context (with appropriate clipping and Push/PopGroups performed
  * between layers).
  */
 class BasicLayerManager MOZ_FINAL :
     public LayerManager
 {
 public:
   enum BasicLayerManagerType {
     BLM_WIDGET,
     BLM_OFFSCREEN,
     BLM_INACTIVE
   };
   /**
    * Construct a BasicLayerManager which will have no default
    * target context. SetDefaultTarget or BeginTransactionWithTarget
-   * must be called for any rendering to happen. ThebesLayers will not
+   * must be called for any rendering to happen. PaintedLayers will not
    * be retained.
    */
   explicit BasicLayerManager(BasicLayerManagerType aType);
   /**
    * Construct a BasicLayerManager which will have no default
    * target context. SetDefaultTarget or BeginTransactionWithTarget
-   * must be called for any rendering to happen. ThebesLayers will be
+   * must be called for any rendering to happen. PaintedLayers will be
    * retained; that is, we will try to retain the visible contents of
-   * ThebesLayers as cairo surfaces. We create ThebesLayer buffers by
+   * PaintedLayers as cairo surfaces. We create PaintedLayer buffers by
    * creating similar surfaces to the default target context, or to
    * aWidget's GetThebesSurface if there is no default target context, or
    * to the passed-in context if there is no widget and no default
    * target context.
    * 
    * This does not keep a strong reference to the widget, so the caller
    * must ensure that the widget outlives the layer manager or call
    * ClearWidget before the widget dies.
@@ -97,26 +97,26 @@ public:
   void ClearRetainerWidget() { mWidget = nullptr; }
 
   virtual bool IsWidgetLayerManager() { return mWidget != nullptr; }
   virtual bool IsInactiveLayerManager() { return mType == BLM_INACTIVE; }
 
   virtual void BeginTransaction();
   virtual void BeginTransactionWithTarget(gfxContext* aTarget);
   virtual bool EndEmptyTransaction(EndTransactionFlags aFlags = END_DEFAULT);
-  virtual void EndTransaction(DrawThebesLayerCallback aCallback,
+  virtual void EndTransaction(DrawPaintedLayerCallback aCallback,
                               void* aCallbackData,
                               EndTransactionFlags aFlags = END_DEFAULT);
   virtual bool ShouldAvoidComponentAlphaLayers() { return IsWidgetLayerManager(); }
 
   void AbortTransaction();
 
   virtual void SetRoot(Layer* aLayer);
 
-  virtual already_AddRefed<ThebesLayer> CreateThebesLayer();
+  virtual already_AddRefed<PaintedLayer> CreatePaintedLayer();
   virtual already_AddRefed<ContainerLayer> CreateContainerLayer();
   virtual already_AddRefed<ImageLayer> CreateImageLayer();
   virtual already_AddRefed<CanvasLayer> CreateCanvasLayer();
   virtual already_AddRefed<ColorLayer> CreateColorLayer();
   virtual already_AddRefed<ReadbackLayer> CreateReadbackLayer();
   virtual ImageFactory *GetImageFactory();
 
   virtual LayersBackend GetBackendType() { return LayersBackend::LAYERS_BASIC; }
@@ -164,29 +164,29 @@ protected:
 
   // Paint the group onto the underlying target. This is used by PaintLayer to
   // flush the group to the underlying target.
   void FlushGroup(PaintLayerContext& aPaintContext, bool aNeedsClipToVisibleRegion);
 
   // Paints aLayer to mTarget.
   void PaintLayer(gfxContext* aTarget,
                   Layer* aLayer,
-                  DrawThebesLayerCallback aCallback,
+                  DrawPaintedLayerCallback aCallback,
                   void* aCallbackData);
 
   // Clear the contents of a layer
   void ClearLayer(Layer* aLayer);
 
-  bool EndTransactionInternal(DrawThebesLayerCallback aCallback,
+  bool EndTransactionInternal(DrawPaintedLayerCallback aCallback,
                               void* aCallbackData,
                               EndTransactionFlags aFlags = END_DEFAULT);
 
   void FlashWidgetUpdateArea(gfxContext* aContext);
 
-  // Widget whose surface should be used as the basis for ThebesLayer
+  // Widget whose surface should be used as the basis for PaintedLayer
   // buffers.
   nsIWidget* mWidget;
   // The default context for BeginTransaction.
   nsRefPtr<gfxContext> mDefaultTarget;
   // The context to draw into.
   nsRefPtr<gfxContext> mTarget;
   // Image factory we use.
   nsRefPtr<ImageFactory> mFactory;
rename from gfx/layers/basic/BasicThebesLayer.cpp
rename to gfx/layers/basic/BasicPaintedLayer.cpp
--- a/gfx/layers/basic/BasicThebesLayer.cpp
+++ b/gfx/layers/basic/BasicPaintedLayer.cpp
@@ -1,14 +1,14 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  * 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/. */
 
-#include "BasicThebesLayer.h"
+#include "BasicPaintedLayer.h"
 #include <stdint.h>                     // for uint32_t
 #include "GeckoProfiler.h"              // for PROFILER_LABEL
 #include "ReadbackLayer.h"              // for ReadbackLayer, ReadbackSink
 #include "ReadbackProcessor.h"          // for ReadbackProcessor::Update, etc
 #include "RenderTrace.h"                // for RenderTraceInvalidateEnd, etc
 #include "BasicLayersImpl.h"            // for AutoMaskData, etc
 #include "gfxContext.h"                 // for gfxContext, etc
 #include "gfxRect.h"                    // for gfxRect
@@ -40,22 +40,22 @@ IntersectWithClip(const nsIntRegion& aRe
   clip.RoundOut();
   nsIntRect r(clip.X(), clip.Y(), clip.Width(), clip.Height());
   nsIntRegion result;
   result.And(aRegion, r);
   return result;
 }
 
 void
-BasicThebesLayer::PaintThebes(gfxContext* aContext,
+BasicPaintedLayer::PaintThebes(gfxContext* aContext,
                               Layer* aMaskLayer,
-                              LayerManager::DrawThebesLayerCallback aCallback,
+                              LayerManager::DrawPaintedLayerCallback aCallback,
                               void* aCallbackData)
 {
-  PROFILER_LABEL("BasicThebesLayer", "PaintThebes",
+  PROFILER_LABEL("BasicPaintedLayer", "PaintThebes",
     js::ProfileEntry::Category::GRAPHICS);
 
   NS_ASSERTION(BasicManager()->InDrawing(),
                "Can only draw in drawing phase");
 
   float opacity = GetEffectiveOpacity();
   CompositionOp effectiveOperator = GetEffectiveOperator(this);
 
@@ -127,33 +127,33 @@ BasicThebesLayer::PaintThebes(gfxContext
   if (!IsHidden() && !clipExtents.IsEmpty()) {
     mContentClient->DrawTo(this, aContext->GetDrawTarget(), opacity,
                            effectiveOperator,
                            maskSurface, &maskTransform);
   }
 }
 
 void
-BasicThebesLayer::Validate(LayerManager::DrawThebesLayerCallback aCallback,
+BasicPaintedLayer::Validate(LayerManager::DrawPaintedLayerCallback aCallback,
                            void* aCallbackData,
                            ReadbackProcessor* aReadback)
 {
   if (!mContentClient) {
     // This client will have a null Forwarder, which means it will not have
     // a ContentHost on the other side.
     mContentClient = new ContentClientBasic();
   }
 
   if (!BasicManager()->IsRetained()) {
     return;
   }
 
   nsTArray<ReadbackProcessor::Update> readbackUpdates;
   if (aReadback && UsedForReadback()) {
-    aReadback->GetThebesLayerUpdates(this, &readbackUpdates);
+    aReadback->GetPaintedLayerUpdates(this, &readbackUpdates);
   }
 
   uint32_t flags = 0;
 #ifndef MOZ_WIDGET_ANDROID
   if (BasicManager()->CompositorMightResample()) {
     flags |= RotatedContentBuffer::PAINT_WILL_RESAMPLE;
   }
   if (!(flags & RotatedContentBuffer::PAINT_WILL_RESAMPLE)) {
@@ -213,18 +213,18 @@ BasicThebesLayer::Validate(LayerManager:
       mContentClient->DrawTo(this, ctx->GetDrawTarget(), 1.0,
                              CompositionOpForOp(ctx->CurrentOperator()),
                              nullptr, nullptr);
       update.mLayer->GetSink()->EndUpdate(ctx, update.mUpdateRect + offset);
     }
   }
 }
 
-already_AddRefed<ThebesLayer>
-BasicLayerManager::CreateThebesLayer()
+already_AddRefed<PaintedLayer>
+BasicLayerManager::CreatePaintedLayer()
 {
   NS_ASSERTION(InConstruction(), "Only allowed in construction phase");
-  nsRefPtr<ThebesLayer> layer = new BasicThebesLayer(this);
+  nsRefPtr<PaintedLayer> layer = new BasicPaintedLayer(this);
   return layer.forget();
 }
 
 }
 }
rename from gfx/layers/basic/BasicThebesLayer.h
rename to gfx/layers/basic/BasicPaintedLayer.h
--- a/gfx/layers/basic/BasicThebesLayer.h
+++ b/gfx/layers/basic/BasicPaintedLayer.h
@@ -1,17 +1,17 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  * 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/. */
 
-#ifndef GFX_BASICTHEBESLAYER_H
-#define GFX_BASICTHEBESLAYER_H
+#ifndef GFX_BASICPAINTEDLAYER_H
+#define GFX_BASICPAINTEDLAYER_H
 
-#include "Layers.h"                     // for ThebesLayer, LayerManager, etc
+#include "Layers.h"                     // for PaintedLayer, LayerManager, etc
 #include "RotatedBuffer.h"              // for RotatedContentBuffer, etc
 #include "BasicImplData.h"              // for BasicImplData
 #include "BasicLayers.h"                // for BasicLayerManager
 #include "gfxPoint.h"                   // for gfxPoint
 #include "mozilla/RefPtr.h"             // for RefPtr
 #include "mozilla/gfx/BasePoint.h"      // for BasePoint
 #include "mozilla/layers/ContentClient.h"  // for ContentClientBasic
 #include "mozilla/mozalloc.h"           // for operator delete
@@ -20,57 +20,57 @@
 #include "nsRegion.h"                   // for nsIntRegion
 class gfxContext;
 
 namespace mozilla {
 namespace layers {
 
 class ReadbackProcessor;
 
-class BasicThebesLayer : public ThebesLayer, public BasicImplData {
+class BasicPaintedLayer : public PaintedLayer, public BasicImplData {
 public:
   typedef RotatedContentBuffer::PaintState PaintState;
   typedef RotatedContentBuffer::ContentType ContentType;
 
-  explicit BasicThebesLayer(BasicLayerManager* aLayerManager) :
-    ThebesLayer(aLayerManager,
+  explicit BasicPaintedLayer(BasicLayerManager* aLayerManager) :
+    PaintedLayer(aLayerManager,
                 static_cast<BasicImplData*>(MOZ_THIS_IN_INITIALIZER_LIST())),
     mContentClient(nullptr)
   {
-    MOZ_COUNT_CTOR(BasicThebesLayer);
+    MOZ_COUNT_CTOR(BasicPaintedLayer);
   }
 
 protected:
-  virtual ~BasicThebesLayer()
+  virtual ~BasicPaintedLayer()
   {
-    MOZ_COUNT_DTOR(BasicThebesLayer);
+    MOZ_COUNT_DTOR(BasicPaintedLayer);
   }
 
 public:
   virtual void SetVisibleRegion(const nsIntRegion& aRegion)
   {
     NS_ASSERTION(BasicManager()->InConstruction(),
                  "Can only set properties in construction phase");
-    ThebesLayer::SetVisibleRegion(aRegion);
+    PaintedLayer::SetVisibleRegion(aRegion);
   }
   virtual void InvalidateRegion(const nsIntRegion& aRegion)
   {
     NS_ASSERTION(BasicManager()->InConstruction(),
                  "Can only set properties in construction phase");
     mInvalidRegion.Or(mInvalidRegion, aRegion);
     mInvalidRegion.SimplifyOutward(20);
     mValidRegion.Sub(mValidRegion, mInvalidRegion);
   }
 
   virtual void PaintThebes(gfxContext* aContext,
                            Layer* aMaskLayer,
-                           LayerManager::DrawThebesLayerCallback aCallback,
+                           LayerManager::DrawPaintedLayerCallback aCallback,
                            void* aCallbackData);
 
-  virtual void Validate(LayerManager::DrawThebesLayerCallback aCallback,
+  virtual void Validate(LayerManager::DrawPaintedLayerCallback aCallback,
                         void* aCallbackData,
                         ReadbackProcessor* aReadback) MOZ_OVERRIDE;
 
   virtual void ClearCachedResources()
   {
     if (mContentClient) {
       mContentClient->Clear();
     }
@@ -85,33 +85,33 @@ public:
       mEffectiveTransform = GetLocalTransform() * aTransformToSurface;
       if (gfxPoint(0,0) != mResidualTranslation) {
         mResidualTranslation = gfxPoint(0,0);
         mValidRegion.SetEmpty();
       }
       ComputeEffectiveTransformForMaskLayer(aTransformToSurface);
       return;
     }
-    ThebesLayer::ComputeEffectiveTransforms(aTransformToSurface);
+    PaintedLayer::ComputeEffectiveTransforms(aTransformToSurface);
   }
 
   BasicLayerManager* BasicManager()
   {
     return static_cast<BasicLayerManager*>(mManager);
   }
 
 protected:
   virtual void
   PaintBuffer(gfxContext* aContext,
               const nsIntRegion& aRegionToDraw,
               const nsIntRegion& aExtendedRegionToDraw,
               const nsIntRegion& aRegionToInvalidate,
               bool aDidSelfCopy,
               DrawRegionClip aClip,
-              LayerManager::DrawThebesLayerCallback aCallback,
+              LayerManager::DrawPaintedLayerCallback aCallback,
               void* aCallbackData)
   {
     if (!aCallback) {
       BasicManager()->SetTransactionIncomplete();
       return;
     }
     aCallback(this, aContext, aExtendedRegionToDraw, aClip,
               aRegionToInvalidate, aCallbackData);
--- a/gfx/layers/client/ClientContainerLayer.h
+++ b/gfx/layers/client/ClientContainerLayer.h
@@ -11,17 +11,17 @@
 #include "Layers.h"                     // for Layer, ContainerLayer, etc
 #include "gfxPrefs.h"                   // for gfxPrefs
 #include "nsDebug.h"                    // for NS_ASSERTION
 #include "nsISupportsImpl.h"            // for MOZ_COUNT_CTOR, etc
 #include "nsISupportsUtils.h"           // for NS_ADDREF, NS_RELEASE
 #include "nsRegion.h"                   // for nsIntRegion
 #include "nsTArray.h"                   // for nsAutoTArray
 #include "ReadbackProcessor.h"
-#include "ClientThebesLayer.h"
+#include "ClientPaintedLayer.h"
 
 namespace mozilla {
 namespace layers {
 
 class ShadowableLayer;
 
 class ClientContainerLayer : public ContainerLayer,
                              public ClientLayer
--- a/gfx/layers/client/ClientLayerManager.cpp
+++ b/gfx/layers/client/ClientLayerManager.cpp
@@ -198,17 +198,17 @@ ClientLayerManager::BeginTransactionWith
     hal::GetCurrentScreenConfiguration(&currentConfig);
     orientation = currentConfig.orientation();
   }
   nsIntRect targetBounds = mWidget->GetNaturalBounds();
   targetBounds.x = targetBounds.y = 0;
   mForwarder->BeginTransaction(targetBounds, mTargetRotation, orientation);
 
   // If we're drawing on behalf of a context with async pan/zoom
-  // enabled, then the entire buffer of thebes layers might be
+  // enabled, then the entire buffer of painted layers might be
   // composited (including resampling) asynchronously before we get
   // a chance to repaint, so we have to ensure that it's all valid
   // and not rotated.
   if (mWidget) {
     if (dom::TabChild* window = mWidget->GetOwningTabChild()) {
       mCompositorMightResample = window->IsAsyncPanZoomEnabled();
     }
   }
@@ -228,17 +228,17 @@ ClientLayerManager::BeginTransactionWith
 
 void
 ClientLayerManager::BeginTransaction()
 {
   BeginTransactionWithTarget(nullptr);
 }
 
 bool
-ClientLayerManager::EndTransactionInternal(DrawThebesLayerCallback aCallback,
+ClientLayerManager::EndTransactionInternal(DrawPaintedLayerCallback aCallback,
                                            void* aCallbackData,
                                            EndTransactionFlags)
 {
   PROFILER_LABEL("ClientLayerManager", "EndTransactionInternal",
     js::ProfileEntry::Category::GRAPHICS);
 
 #ifdef MOZ_LAYERS_HAVE_LOG
   MOZ_LAYERS_LOG(("  ----- (beginning paint)"));
@@ -252,45 +252,45 @@ ClientLayerManager::EndTransactionIntern
   ClientLayer* root = ClientLayer::ToClientLayer(GetRoot());
 
   mTransactionIncomplete = false;
       
   // Apply pending tree updates before recomputing effective
   // properties.
   GetRoot()->ApplyPendingUpdatesToSubtree();
     
-  mThebesLayerCallback = aCallback;
-  mThebesLayerCallbackData = aCallbackData;
+  mPaintedLayerCallback = aCallback;
+  mPaintedLayerCallbackData = aCallbackData;
 
   GetRoot()->ComputeEffectiveTransforms(Matrix4x4());
 
   root->RenderLayer();
   if (!mRepeatTransaction && !GetRoot()->GetInvalidRegion().IsEmpty()) {
     GetRoot()->Mutated();
   }
   
-  mThebesLayerCallback = nullptr;
-  mThebesLayerCallbackData = nullptr;
+  mPaintedLayerCallback = nullptr;
+  mPaintedLayerCallbackData = nullptr;
 
   // Go back to the construction phase if the transaction isn't complete.
   // Layout will update the layer tree and call EndTransaction().
   mPhase = mTransactionIncomplete ? PHASE_CONSTRUCTION : PHASE_NONE;
 
   NS_ASSERTION(!aCallback || !mTransactionIncomplete,
                "If callback is not null, transaction must be complete");
 
   if (gfxPlatform::GetPlatform()->DidRenderingDeviceReset()) {
     FrameLayerBuilder::InvalidateAllLayers(this);
   }
 
   return !mTransactionIncomplete;
 }
 
 void
-ClientLayerManager::EndTransaction(DrawThebesLayerCallback aCallback,
+ClientLayerManager::EndTransaction(DrawPaintedLayerCallback aCallback,
                                    void* aCallbackData,
                                    EndTransactionFlags aFlags)
 {
   if (mWidget) {
     mWidget->PrepareWindowEffects();
   }
   EndTransactionInternal(aCallback, aCallbackData, aFlags);
   ForwardTransaction(!(aFlags & END_NO_REMOTE_COMPOSITE));
--- a/gfx/layers/client/ClientLayerManager.h
+++ b/gfx/layers/client/ClientLayerManager.h
@@ -27,17 +27,17 @@
 #include "nscore.h"                     // for nsAString
 #include "mozilla/layers/TransactionIdAllocator.h"
 
 class nsIWidget;
 
 namespace mozilla {
 namespace layers {
 
-class ClientThebesLayer;
+class ClientPaintedLayer;
 class CompositorChild;
 class ImageLayer;
 class PLayerChild;
 class TextureClientPool;
 
 class ClientLayerManager MOZ_FINAL : public LayerManager
 {
   typedef nsTArray<nsRefPtr<Layer> > LayerRefArray;
@@ -66,36 +66,36 @@ public:
   }
 
   virtual int32_t GetMaxTextureSize() const;
 
   virtual void SetDefaultTargetConfiguration(BufferMode aDoubleBuffering, ScreenRotation aRotation);
   virtual void BeginTransactionWithTarget(gfxContext* aTarget);
   virtual void BeginTransaction();
   virtual bool EndEmptyTransaction(EndTransactionFlags aFlags = END_DEFAULT);
-  virtual void EndTransaction(DrawThebesLayerCallback aCallback,
+  virtual void EndTransaction(DrawPaintedLayerCallback aCallback,
                               void* aCallbackData,
                               EndTransactionFlags aFlags = END_DEFAULT);
 
   virtual LayersBackend GetBackendType() { return LayersBackend::LAYERS_CLIENT; }
   virtual LayersBackend GetCompositorBackendType() MOZ_OVERRIDE
   {
     return AsShadowForwarder()->GetCompositorBackendType();
   }
   virtual void GetBackendName(nsAString& name);
   virtual const char* Name() const { return "Client"; }
 
   virtual void SetRoot(Layer* aLayer);
 
   virtual void Mutated(Layer* aLayer);
 
-  virtual bool IsOptimizedFor(ThebesLayer* aLayer, ThebesLayerCreationHint aHint);
+  virtual bool IsOptimizedFor(PaintedLayer* aLayer, PaintedLayerCreationHint aHint);
 
-  virtual already_AddRefed<ThebesLayer> CreateThebesLayer();
-  virtual already_AddRefed<ThebesLayer> CreateThebesLayerWithHint(ThebesLayerCreationHint aHint);
+  virtual already_AddRefed<PaintedLayer> CreatePaintedLayer();
+  virtual already_AddRefed<PaintedLayer> CreatePaintedLayerWithHint(PaintedLayerCreationHint aHint);
   virtual already_AddRefed<ContainerLayer> CreateContainerLayer();
   virtual already_AddRefed<ImageLayer> CreateImageLayer();
   virtual already_AddRefed<CanvasLayer> CreateCanvasLayer();
   virtual already_AddRefed<ReadbackLayer> CreateReadbackLayer();
   virtual already_AddRefed<ColorLayer> CreateColorLayer();
   virtual already_AddRefed<RefLayer> CreateRefLayer();
 
   TextureFactoryIdentifier GetTextureFactoryIdentifier()
@@ -143,21 +143,21 @@ public:
   void SetTransactionIncomplete() { mTransactionIncomplete = true; }
 
   bool HasShadowTarget() { return !!mShadowTarget; }
 
   void SetShadowTarget(gfxContext* aTarget) { mShadowTarget = aTarget; }
 
   bool CompositorMightResample() { return mCompositorMightResample; } 
   
-  DrawThebesLayerCallback GetThebesLayerCallback() const
-  { return mThebesLayerCallback; }
+  DrawPaintedLayerCallback GetPaintedLayerCallback() const
+  { return mPaintedLayerCallback; }
 
-  void* GetThebesLayerCallbackData() const
-  { return mThebesLayerCallbackData; }
+  void* GetPaintedLayerCallbackData() const
+  { return mPaintedLayerCallbackData; }
 
   CompositorChild* GetRemoteRenderer();
 
   CompositorChild* GetCompositorChild();
 
   // Disable component alpha layers with the software compositor.
   virtual bool ShouldAvoidComponentAlphaLayers() { return !IsCompositingCheap(); }
 
@@ -279,28 +279,28 @@ private:
   /**
    * Take a snapshot of the parent context, and copy
    * it into mShadowTarget.
    */
   void MakeSnapshotIfRequired();
 
   void ClearLayer(Layer* aLayer);
 
-  bool EndTransactionInternal(DrawThebesLayerCallback aCallback,
+  bool EndTransactionInternal(DrawPaintedLayerCallback aCallback,
                               void* aCallbackData,
                               EndTransactionFlags);
 
   LayerRefArray mKeepAlive;
 
   nsIWidget* mWidget;
   
   /* Thebes layer callbacks; valid at the end of a transaciton,
    * while rendering */
-  DrawThebesLayerCallback mThebesLayerCallback;
-  void *mThebesLayerCallbackData;
+  DrawPaintedLayerCallback mPaintedLayerCallback;
+  void *mPaintedLayerCallbackData;
 
   // When we're doing a transaction in order to draw to a non-default
   // target, the layers transaction is only performed in order to send
   // a PLayers:Update.  We save the original non-default target to
   // mShadowTarget, and then perform the transaction using
   // mDummyTarget as the render target.  After the transaction ends,
   // we send a message to our remote side to capture the actual pixels
   // being drawn to the default target, and then copy those pixels
@@ -364,17 +364,17 @@ public:
     mShadow = nullptr;
   }
 
   virtual void ClearCachedResources() { }
 
   virtual void RenderLayer() = 0;
   virtual void RenderLayerWithReadback(ReadbackProcessor *aReadback) { RenderLayer(); }
 
-  virtual ClientThebesLayer* AsThebes() { return nullptr; }
+  virtual ClientPaintedLayer* AsThebes() { return nullptr; }
 
   static inline ClientLayer *
   ToClientLayer(Layer* aLayer)
   {
     return static_cast<ClientLayer*>(aLayer->ImplData());
   }
 };
 
rename from gfx/layers/client/ClientThebesLayer.cpp
rename to gfx/layers/client/ClientPaintedLayer.cpp
--- a/gfx/layers/client/ClientThebesLayer.cpp
+++ b/gfx/layers/client/ClientPaintedLayer.cpp
@@ -1,15 +1,15 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  * 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/. */
 
-#include "ClientThebesLayer.h"
-#include "ClientTiledThebesLayer.h"     // for ClientTiledThebesLayer
+#include "ClientPaintedLayer.h"
+#include "ClientTiledPaintedLayer.h"     // for ClientTiledPaintedLayer
 #include <stdint.h>                     // for uint32_t
 #include "GeckoProfiler.h"              // for PROFILER_LABEL
 #include "client/ClientLayerManager.h"  // for ClientLayerManager, etc
 #include "gfxContext.h"                 // for gfxContext
 #include "gfxRect.h"                    // for gfxRect
 #include "gfxPrefs.h"                   // for gfxPrefs
 #include "mozilla/Assertions.h"         // for MOZ_ASSERT, etc
 #include "mozilla/gfx/2D.h"             // for DrawTarget
@@ -26,19 +26,19 @@
 #include "ReadbackProcessor.h"
 
 namespace mozilla {
 namespace layers {
 
 using namespace mozilla::gfx;
 
 void
-ClientThebesLayer::PaintThebes()
+ClientPaintedLayer::PaintThebes()
 {
-  PROFILER_LABEL("ClientThebesLayer", "PaintThebes",
+  PROFILER_LABEL("ClientPaintedLayer", "PaintThebes",
     js::ProfileEntry::Category::GRAPHICS);
 
   NS_ASSERTION(ClientManager()->InDrawing(),
                "Can only draw in drawing phase");
   
   uint32_t flags = RotatedContentBuffer::PAINT_CAN_DRAW_ROTATED;
 #ifndef MOZ_WIDGET_ANDROID
   if (ClientManager()->CompositorMightResample()) {
@@ -49,17 +49,17 @@ ClientThebesLayer::PaintThebes()
       flags |= RotatedContentBuffer::PAINT_WILL_RESAMPLE;
     }
   }
 #endif
   PaintState state =
     mContentClient->BeginPaintBuffer(this, flags);
   mValidRegion.Sub(mValidRegion, state.mRegionToInvalidate);
 
-  if (!state.mRegionToDraw.IsEmpty() && !ClientManager()->GetThebesLayerCallback()) {
+  if (!state.mRegionToDraw.IsEmpty() && !ClientManager()->GetPaintedLayerCallback()) {
     ClientManager()->SetTransactionIncomplete();
     return;
   }
 
   // The area that became invalid and is visible needs to be repainted
   // (this could be the whole visible area if our buffer switched
   // from RGB to RGBA, because we might need to repaint with
   // subpixel AA)
@@ -68,22 +68,22 @@ ClientThebesLayer::PaintThebes()
 
   bool didUpdate = false;
   RotatedContentBuffer::DrawIterator iter;
   while (DrawTarget* target = mContentClient->BorrowDrawTargetForPainting(state, &iter)) {
     SetAntialiasingFlags(this, target);
 
     nsRefPtr<gfxContext> ctx = gfxContext::ContextForDrawTarget(target);
 
-    ClientManager()->GetThebesLayerCallback()(this,
+    ClientManager()->GetPaintedLayerCallback()(this,
                                               ctx,
                                               iter.mDrawRegion,
                                               state.mClip,
                                               state.mRegionToInvalidate,
-                                              ClientManager()->GetThebesLayerCallbackData());
+                                              ClientManager()->GetPaintedLayerCallbackData());
 
     ctx = nullptr;
     mContentClient->ReturnDrawTargetToBuffer(target);
     didUpdate = true;
   }
 
   if (didUpdate) {
     Mutated();
@@ -99,17 +99,17 @@ ClientThebesLayer::PaintThebes()
     ClientManager()->Hold(this);
     contentClientRemote->Updated(state.mRegionToDraw,
                                  mVisibleRegion,
                                  state.mDidSelfCopy);
   }
 }
 
 void
-ClientThebesLayer::RenderLayerWithReadback(ReadbackProcessor *aReadback)
+ClientPaintedLayer::RenderLayerWithReadback(ReadbackProcessor *aReadback)
 {
   if (GetMaskLayer()) {
     ToClientLayer(GetMaskLayer())->RenderLayer();
   }
   
   if (!mContentClient) {
     mContentClient = ContentClient::CreateContentClient(ClientManager()->AsShadowForwarder());
     if (!mContentClient) {
@@ -118,64 +118,64 @@ ClientThebesLayer::RenderLayerWithReadba
     mContentClient->Connect();
     ClientManager()->AsShadowForwarder()->Attach(mContentClient, this);
     MOZ_ASSERT(mContentClient->GetForwarder());
   }
 
   nsTArray<ReadbackProcessor::Update> readbackUpdates;
   nsIntRegion readbackRegion;
   if (aReadback && UsedForReadback()) {
-    aReadback->GetThebesLayerUpdates(this, &readbackUpdates);
+    aReadback->GetPaintedLayerUpdates(this, &readbackUpdates);
   }
 
   IntPoint origin(mVisibleRegion.GetBounds().x, mVisibleRegion.GetBounds().y);
   mContentClient->BeginPaint();
   PaintThebes();
   mContentClient->EndPaint(&readbackUpdates);
 }
 
 bool
-ClientLayerManager::IsOptimizedFor(ThebesLayer* aLayer, ThebesLayerCreationHint aHint)
+ClientLayerManager::IsOptimizedFor(PaintedLayer* aLayer, PaintedLayerCreationHint aHint)
 {
 #ifdef MOZ_B2G
   // The only creation hint is whether the layer is scrollable or not, and this
   // is only respected on B2G, where it's used to determine whether to use
   // tiled layers or not.
   // There are pretty nasty performance consequences for not using tiles on
   // large, scrollable layers, so we want the layer to be recreated in this
   // situation.
   return aHint == aLayer->GetCreationHint();
 #else
   return LayerManager::IsOptimizedFor(aLayer, aHint);
 #endif
 }
 
-already_AddRefed<ThebesLayer>
-ClientLayerManager::CreateThebesLayer()
+already_AddRefed<PaintedLayer>
+ClientLayerManager::CreatePaintedLayer()
 {
-  return CreateThebesLayerWithHint(NONE);
+  return CreatePaintedLayerWithHint(NONE);
 }
 
-already_AddRefed<ThebesLayer>
-ClientLayerManager::CreateThebesLayerWithHint(ThebesLayerCreationHint aHint)
+already_AddRefed<PaintedLayer>
+ClientLayerManager::CreatePaintedLayerWithHint(PaintedLayerCreationHint aHint)
 {
   NS_ASSERTION(InConstruction(), "Only allowed in construction phase");
   if (
 #ifdef MOZ_B2G
       aHint == SCROLLABLE &&
 #endif
       gfxPlatform::GetPlatform()->UseTiling() &&
       (AsShadowForwarder()->GetCompositorBackendType() == LayersBackend::LAYERS_OPENGL ||
        AsShadowForwarder()->GetCompositorBackendType() == LayersBackend::LAYERS_D3D9 ||
        AsShadowForwarder()->GetCompositorBackendType() == LayersBackend::LAYERS_D3D11)) {
-    nsRefPtr<ClientTiledThebesLayer> layer = new ClientTiledThebesLayer(this, aHint);
+    nsRefPtr<ClientTiledPaintedLayer> layer = new ClientTiledPaintedLayer(this, aHint);
     CREATE_SHADOW(Thebes);
     return layer.forget();
   } else {
-    nsRefPtr<ClientThebesLayer> layer = new ClientThebesLayer(this, aHint);
+    nsRefPtr<ClientPaintedLayer> layer = new ClientPaintedLayer(this, aHint);
     CREATE_SHADOW(Thebes);
     return layer.forget();
   }
 }
 
 
 }
 }
rename from gfx/layers/client/ClientThebesLayer.h
rename to gfx/layers/client/ClientPaintedLayer.h
--- a/gfx/layers/client/ClientThebesLayer.h
+++ b/gfx/layers/client/ClientPaintedLayer.h
@@ -1,69 +1,69 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  * 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/. */
 
-#ifndef GFX_CLIENTTHEBESLAYER_H
-#define GFX_CLIENTTHEBESLAYER_H
+#ifndef GFX_CLIENTPAINTEDLAYER_H
+#define GFX_CLIENTPAINTEDLAYER_H
 
 #include "ClientLayerManager.h"         // for ClientLayerManager, etc
-#include "Layers.h"                     // for ThebesLayer, etc
+#include "Layers.h"                     // for PaintedLayer, etc
 #include "RotatedBuffer.h"              // for RotatedContentBuffer, etc
 #include "mozilla/Attributes.h"         // for MOZ_OVERRIDE
 #include "mozilla/RefPtr.h"             // for RefPtr
 #include "mozilla/layers/ContentClient.h"  // for ContentClient
 #include "mozilla/mozalloc.h"           // for operator delete
 #include "nsDebug.h"                    // for NS_ASSERTION
 #include "nsISupportsImpl.h"            // for MOZ_COUNT_CTOR, etc
 #include "nsRegion.h"                   // for nsIntRegion
-#include "mozilla/layers/PLayerTransaction.h" // for ThebesLayerAttributes
+#include "mozilla/layers/PLayerTransaction.h" // for PaintedLayerAttributes
 
 class gfxContext;
 
 namespace mozilla {
 namespace layers {
 
 class CompositableClient;
 class ShadowableLayer;
 class SpecificLayerAttributes;
 
-class ClientThebesLayer : public ThebesLayer,
+class ClientPaintedLayer : public PaintedLayer,
                           public ClientLayer {
 public:
   typedef RotatedContentBuffer::PaintState PaintState;
   typedef RotatedContentBuffer::ContentType ContentType;
 
-  explicit ClientThebesLayer(ClientLayerManager* aLayerManager,
-                             LayerManager::ThebesLayerCreationHint aCreationHint = LayerManager::NONE) :
-    ThebesLayer(aLayerManager,
+  explicit ClientPaintedLayer(ClientLayerManager* aLayerManager,
+                             LayerManager::PaintedLayerCreationHint aCreationHint = LayerManager::NONE) :
+    PaintedLayer(aLayerManager,
                 static_cast<ClientLayer*>(MOZ_THIS_IN_INITIALIZER_LIST()),
                 aCreationHint),
     mContentClient(nullptr)
   {
-    MOZ_COUNT_CTOR(ClientThebesLayer);
+    MOZ_COUNT_CTOR(ClientPaintedLayer);
   }
 
 protected:
-  virtual ~ClientThebesLayer()
+  virtual ~ClientPaintedLayer()
   {
     if (mContentClient) {
       mContentClient->OnDetach();
       mContentClient = nullptr;
     }
-    MOZ_COUNT_DTOR(ClientThebesLayer);
+    MOZ_COUNT_DTOR(ClientPaintedLayer);
   }
 
 public:
   virtual void SetVisibleRegion(const nsIntRegion& aRegion)
   {
     NS_ASSERTION(ClientManager()->InConstruction(),
                  "Can only set properties in construction phase");
-    ThebesLayer::SetVisibleRegion(aRegion);
+    PaintedLayer::SetVisibleRegion(aRegion);
   }
   virtual void InvalidateRegion(const nsIntRegion& aRegion)
   {
     NS_ASSERTION(ClientManager()->InConstruction(),
                  "Can only set properties in construction phase");
     mInvalidRegion.Or(mInvalidRegion, aRegion);
     mInvalidRegion.SimplifyOutward(20);
     mValidRegion.Sub(mValidRegion, mInvalidRegion);
@@ -79,17 +79,17 @@ public:
       mContentClient->Clear();
     }
     mValidRegion.SetEmpty();
     DestroyBackBuffer();
   }
   
   virtual void FillSpecificAttributes(SpecificLayerAttributes& aAttrs)
   {
-    aAttrs = ThebesLayerAttributes(GetValidRegion());
+    aAttrs = PaintedLayerAttributes(GetValidRegion());
   }
   
   ClientLayerManager* ClientManager()
   {
     return static_cast<ClientLayerManager*>(mManager);
   }
   
   virtual Layer* AsLayer() { return this; }
rename from gfx/layers/client/ClientTiledThebesLayer.cpp
rename to gfx/layers/client/ClientTiledPaintedLayer.cpp
--- a/gfx/layers/client/ClientTiledThebesLayer.cpp
+++ b/gfx/layers/client/ClientTiledPaintedLayer.cpp
@@ -1,13 +1,13 @@
 /* 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/. */
 
-#include "ClientTiledThebesLayer.h"
+#include "ClientTiledPaintedLayer.h"
 #include "FrameMetrics.h"               // for FrameMetrics
 #include "Units.h"                      // for ScreenIntRect, CSSPoint, etc
 #include "UnitTransforms.h"             // for TransformTo
 #include "ClientLayerManager.h"         // for ClientLayerManager, etc
 #include "gfxPlatform.h"                // for gfxPlatform
 #include "gfxPrefs.h"                   // for gfxPrefs
 #include "gfxRect.h"                    // for gfxRect
 #include "mozilla/Assertions.h"         // for MOZ_ASSERT, etc
@@ -19,47 +19,47 @@
 #include "nsISupportsImpl.h"            // for MOZ_COUNT_CTOR, etc
 #include "nsRect.h"                     // for nsIntRect
 #include "LayersLogging.h"
 
 namespace mozilla {
 namespace layers {
 
 
-ClientTiledThebesLayer::ClientTiledThebesLayer(ClientLayerManager* const aManager,
-                                               ClientLayerManager::ThebesLayerCreationHint aCreationHint)
-  : ThebesLayer(aManager,
+ClientTiledPaintedLayer::ClientTiledPaintedLayer(ClientLayerManager* const aManager,
+                                               ClientLayerManager::PaintedLayerCreationHint aCreationHint)
+  : PaintedLayer(aManager,
                 static_cast<ClientLayer*>(MOZ_THIS_IN_INITIALIZER_LIST()),
                 aCreationHint)
   , mContentClient()
 {
-  MOZ_COUNT_CTOR(ClientTiledThebesLayer);
+  MOZ_COUNT_CTOR(ClientTiledPaintedLayer);
   mPaintData.mLastScrollOffset = ParentLayerPoint(0, 0);
   mPaintData.mFirstPaint = true;
 }
 
-ClientTiledThebesLayer::~ClientTiledThebesLayer()
+ClientTiledPaintedLayer::~ClientTiledPaintedLayer()
 {
-  MOZ_COUNT_DTOR(ClientTiledThebesLayer);
+  MOZ_COUNT_DTOR(ClientTiledPaintedLayer);
 }
 
 void
-ClientTiledThebesLayer::ClearCachedResources()
+ClientTiledPaintedLayer::ClearCachedResources()
 {
   if (mContentClient) {
     mContentClient->ClearCachedResources();
   }
   mValidRegion.SetEmpty();
   mContentClient = nullptr;
 }
 
 void
-ClientTiledThebesLayer::FillSpecificAttributes(SpecificLayerAttributes& aAttrs)
+ClientTiledPaintedLayer::FillSpecificAttributes(SpecificLayerAttributes& aAttrs)
 {
-  aAttrs = ThebesLayerAttributes(GetValidRegion());
+  aAttrs = PaintedLayerAttributes(GetValidRegion());
 }
 
 static LayerRect
 ApplyParentLayerToLayerTransform(const gfx::Matrix4x4& aTransform, const ParentLayerRect& aParentLayerRect)
 {
   return TransformTo<LayerPixel>(aTransform, aParentLayerRect);
 }
 
@@ -76,17 +76,17 @@ GetTransformToAncestorsParentLayer(Layer
     // because it will get applied by the APZ in the compositor as well
     const FrameMetrics& metrics = iter.Metrics();
     transform = transform * gfx::Matrix4x4().Scale(metrics.mResolution.scale, metrics.mResolution.scale, 1.f);
   }
   return transform;
 }
 
 void
-ClientTiledThebesLayer::GetAncestorLayers(LayerMetricsWrapper* aOutScrollAncestor,
+ClientTiledPaintedLayer::GetAncestorLayers(LayerMetricsWrapper* aOutScrollAncestor,
                                           LayerMetricsWrapper* aOutDisplayPortAncestor)
 {
   LayerMetricsWrapper scrollAncestor;
   LayerMetricsWrapper displayPortAncestor;
   for (LayerMetricsWrapper ancestor(this, LayerMetricsWrapper::StartAt::BOTTOM); ancestor; ancestor = ancestor.GetParent()) {
     const FrameMetrics& metrics = ancestor.Metrics();
     if (!scrollAncestor && metrics.GetScrollId() != FrameMetrics::NULL_SCROLL_ID) {
       scrollAncestor = ancestor;
@@ -102,17 +102,17 @@ ClientTiledThebesLayer::GetAncestorLayer
     *aOutScrollAncestor = scrollAncestor;
   }
   if (aOutDisplayPortAncestor) {
     *aOutDisplayPortAncestor = displayPortAncestor;
   }
 }
 
 void
-ClientTiledThebesLayer::BeginPaint()
+ClientTiledPaintedLayer::BeginPaint()
 {
   mPaintData.mLowPrecisionPaintCount = 0;
   mPaintData.mPaintFinished = false;
   mPaintData.mCompositionBounds.SetEmpty();
   mPaintData.mCriticalDisplayPort.SetEmpty();
 
   if (!GetBaseTransform().Is2D()) {
     // Give up if there is a complex CSS transform on the layer. We might
@@ -179,36 +179,36 @@ ClientTiledThebesLayer::BeginPaint()
   TILING_LOG("TILING %p: Composition bounds %s\n", this, Stringify(mPaintData.mCompositionBounds).c_str());
 
   // Calculate the scroll offset since the last transaction
   mPaintData.mScrollOffset = displayportMetrics.GetScrollOffset() * displayportMetrics.GetZoomToParent();
   TILING_LOG("TILING %p: Scroll offset %s\n", this, Stringify(mPaintData.mScrollOffset).c_str());
 }
 
 bool
-ClientTiledThebesLayer::UseFastPath()
+ClientTiledPaintedLayer::UseFastPath()
 {
   LayerMetricsWrapper scrollAncestor;
   GetAncestorLayers(&scrollAncestor, nullptr);
   if (!scrollAncestor) {
     return true;
   }
   const FrameMetrics& parentMetrics = scrollAncestor.Metrics();
 
   bool multipleTransactionsNeeded = gfxPrefs::UseProgressiveTilePainting()
                                  || gfxPrefs::UseLowPrecisionBuffer()
                                  || !parentMetrics.mCriticalDisplayPort.IsEmpty();
   bool isFixed = GetIsFixedPosition() || GetParent()->GetIsFixedPosition();
   return !multipleTransactionsNeeded || isFixed || parentMetrics.mDisplayPort.IsEmpty();
 }
 
 bool
-ClientTiledThebesLayer::RenderHighPrecision(nsIntRegion& aInvalidRegion,
+ClientTiledPaintedLayer::RenderHighPrecision(nsIntRegion& aInvalidRegion,
                                             const nsIntRegion& aVisibleRegion,
-                                            LayerManager::DrawThebesLayerCallback aCallback,
+                                            LayerManager::DrawPaintedLayerCallback aCallback,
                                             void* aCallbackData)
 {
   // If we have no high-precision stuff to draw, or we have started drawing low-precision
   // already, then we shouldn't do anything there.
   if (aInvalidRegion.IsEmpty() || mPaintData.mLowPrecisionPaintCount != 0) {
     return false;
   }
 
@@ -243,19 +243,19 @@ ClientTiledThebesLayer::RenderHighPrecis
   TILING_LOG("TILING %p: Non-progressive paint new valid region %s\n", this, Stringify(mValidRegion).c_str());
 
   mContentClient->mTiledBuffer.SetFrameResolution(mPaintData.mResolution);
   mContentClient->mTiledBuffer.PaintThebes(mValidRegion, aInvalidRegion, aCallback, aCallbackData);
   return true;
 }
 
 bool
-ClientTiledThebesLayer::RenderLowPrecision(nsIntRegion& aInvalidRegion,
+ClientTiledPaintedLayer::RenderLowPrecision(nsIntRegion& aInvalidRegion,
                                            const nsIntRegion& aVisibleRegion,
-                                           LayerManager::DrawThebesLayerCallback aCallback,
+                                           LayerManager::DrawPaintedLayerCallback aCallback,
                                            void* aCallbackData)
 {
   // Render the low precision buffer, if the visible region is larger than the
   // critical display port.
   if (!nsIntRegion(LayerIntRect::ToUntyped(mPaintData.mCriticalDisplayPort)).Contains(aVisibleRegion)) {
     nsIntRegion oldValidRegion = mContentClient->mLowPrecisionTiledBuffer.GetValidRegion();
     oldValidRegion.And(oldValidRegion, aVisibleRegion);
 
@@ -305,30 +305,30 @@ ClientTiledThebesLayer::RenderLowPrecisi
     // region of the low precision buffer. This allows the shadow buffer's valid
     // region to be updated and the associated resources to be freed.
     return true;
   }
   return false;
 }
 
 void
-ClientTiledThebesLayer::EndPaint()
+ClientTiledPaintedLayer::EndPaint()
 {
   mPaintData.mLastScrollOffset = mPaintData.mScrollOffset;
   mPaintData.mPaintFinished = true;
   mPaintData.mFirstPaint = false;
   TILING_LOG("TILING %p: Paint finished\n", this);
 }
 
 void
-ClientTiledThebesLayer::RenderLayer()
+ClientTiledPaintedLayer::RenderLayer()
 {
-  LayerManager::DrawThebesLayerCallback callback =
-    ClientManager()->GetThebesLayerCallback();
-  void *data = ClientManager()->GetThebesLayerCallbackData();
+  LayerManager::DrawPaintedLayerCallback callback =
+    ClientManager()->GetPaintedLayerCallback();
+  void *data = ClientManager()->GetPaintedLayerCallbackData();
   if (!callback) {
     ClientManager()->SetTransactionIncomplete();
     return;
   }
 
   if (!mContentClient) {
     mContentClient = new TiledContentClient(this, ClientManager());
 
rename from gfx/layers/client/ClientTiledThebesLayer.h
rename to gfx/layers/client/ClientTiledPaintedLayer.h
--- a/gfx/layers/client/ClientTiledThebesLayer.h
+++ b/gfx/layers/client/ClientTiledPaintedLayer.h
@@ -1,60 +1,60 @@
 /* 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/. */
 
-#ifndef GFX_CLIENTTILEDTHEBESLAYER_H
-#define GFX_CLIENTTILEDTHEBESLAYER_H
+#ifndef GFX_CLIENTTILEDPAINTEDLAYER_H
+#define GFX_CLIENTTILEDPAINTEDLAYER_H
 
 #include "ClientLayerManager.h"         // for ClientLayer, etc
-#include "Layers.h"                     // for ThebesLayer, etc
+#include "Layers.h"                     // for PaintedLayer, etc
 #include "mozilla/RefPtr.h"             // for RefPtr
 #include "mozilla/layers/TiledContentClient.h"
 #include "nsDebug.h"                    // for NS_RUNTIMEABORT
 #include "nsRegion.h"                   // for nsIntRegion
 
 class gfxContext;
 
 namespace mozilla {
 namespace layers {
 
 class ShadowableLayer;
 class SpecificLayerAttributes;
 
 /**
- * An implementation of ThebesLayer that ONLY supports remote
- * composition that is backed by tiles. This thebes layer implementation
+ * An implementation of PaintedLayer that ONLY supports remote
+ * composition that is backed by tiles. This painted layer implementation
  * is better suited to mobile hardware to work around slow implementation
  * of glTexImage2D (for OGL compositors), and restrait memory bandwidth.
  *
  * Tiled Thebes layers use a different protocol compared with other
  * layers. A copy of the tiled buffer is made and sent to the compositing
  * thread via the layers protocol. Tiles are uploaded by the buffers
  * asynchonously without using IPC, that means they are not safe for cross-
  * process use (bug 747811). Each tile has a TextureHost/Client pair but
  * they communicate directly rather than using the Texture protocol.
  *
  * There is no ContentClient for tiled layers. There is a ContentHost, however.
  */
-class ClientTiledThebesLayer : public ThebesLayer,
+class ClientTiledPaintedLayer : public PaintedLayer,
                                public ClientLayer
 {
-  typedef ThebesLayer Base;
+  typedef PaintedLayer Base;
 
 public:
-  explicit ClientTiledThebesLayer(ClientLayerManager* const aManager,
-                                  ClientLayerManager::ThebesLayerCreationHint aCreationHint = LayerManager::NONE);
+  explicit ClientTiledPaintedLayer(ClientLayerManager* const aManager,
+                                  ClientLayerManager::PaintedLayerCreationHint aCreationHint = LayerManager::NONE);
 
 protected:
-  ~ClientTiledThebesLayer();
+  ~ClientTiledPaintedLayer();
 
 public:
-  // Override name to distinguish it from ClientThebesLayer in layer dumps
-  virtual const char* Name() const { return "TiledThebesLayer"; }
+  // Override name to distinguish it from ClientPaintedLayer in layer dumps
+  virtual const char* Name() const { return "TiledPaintedLayer"; }
 
   // Thebes Layer
   virtual Layer* AsLayer() { return this; }
   virtual void InvalidateRegion(const nsIntRegion& aRegion) {
     mInvalidRegion.Or(mInvalidRegion, aRegion);
     mValidRegion.Sub(mValidRegion, aRegion);
     mLowPrecisionValidRegion.Sub(mLowPrecisionValidRegion, aRegion);
   }
@@ -99,26 +99,26 @@ private:
   bool UseFastPath();
 
   /**
    * Helper function to do the high-precision paint.
    * This function returns true if it updated the paint buffer.
    */
   bool RenderHighPrecision(nsIntRegion& aInvalidRegion,
                            const nsIntRegion& aVisibleRegion,
-                           LayerManager::DrawThebesLayerCallback aCallback,
+                           LayerManager::DrawPaintedLayerCallback aCallback,
                            void* aCallbackData);
 
   /**
    * Helper function to do the low-precision paint.
    * This function returns true if it updated the paint buffer.
    */
   bool RenderLowPrecision(nsIntRegion& aInvalidRegion,
                           const nsIntRegion& aVisibleRegion,
-                          LayerManager::DrawThebesLayerCallback aCallback,
+                          LayerManager::DrawPaintedLayerCallback aCallback,
                           void* aCallbackData);
 
   /**
    * This causes the paint to be marked as finished, and updates any data
    * necessary to persist until the next paint.
    */
   void EndPaint();
 
--- a/gfx/layers/client/ContentClient.cpp
+++ b/gfx/layers/client/ContentClient.cpp
@@ -671,17 +671,17 @@ ContentClientIncremental::NotifyBufferCr
 
   mForwarder->CreatedIncrementalBuffer(this,
                                         mTextureInfo,
                                         mBufferRect);
 
 }
 
 RotatedContentBuffer::PaintState
-ContentClientIncremental::BeginPaintBuffer(ThebesLayer* aLayer,
+ContentClientIncremental::BeginPaintBuffer(PaintedLayer* aLayer,
                                            uint32_t aFlags)
 {
   mTextureInfo.mDeprecatedTextureHostFlags = DeprecatedTextureHostFlags::DEFAULT;
   PaintState result;
   // We need to disable rotation if we're going to be resampled when
   // drawing, because we might sample across the rotation boundary.
   bool canHaveRotation =  !(aFlags & RotatedContentBuffer::PAINT_WILL_RESAMPLE);
 
--- a/gfx/layers/client/ContentClient.h
+++ b/gfx/layers/client/ContentClient.h
@@ -33,30 +33,30 @@ class gfxContext;
 namespace mozilla {
 namespace gfx {
 class DrawTarget;
 }
 
 namespace layers {
 
 class BasicLayerManager;
-class ThebesLayer;
+class PaintedLayer;
 
 /**
  * A compositable client for Thebes layers. These are different to Image/Canvas
  * clients due to sending a valid region across IPC and because we do a lot more
  * optimisation work, encapsualted in RotatedContentBuffers.
  *
  * We use content clients for OMTC and non-OMTC, basic rendering so that
- * BasicThebesLayer has only one interface to deal with. We support single and
+ * BasicPaintedLayer has only one interface to deal with. We support single and
  * double buffered flavours. For tiled layers, we do not use a ContentClient
  * although we do have a ContentHost, and we do use texture clients and texture
  * hosts.
  *
- * The interface presented by ContentClient is used by the BasicThebesLayer
+ * The interface presented by ContentClient is used by the BasicPaintedLayer
  * methods - PaintThebes, which is the same for MT and OMTC, and PaintBuffer
  * which is different (the OMTC one does a little more). The 'buffer' in the
  * names of a lot of these method is actually the TextureClient. But, 'buffer'
  * for the RotatedContentBuffer (as in SetBuffer) means a gfxSurface. See the
  * comments for SetBuffer and SetBufferProvider in RotatedContentBuffer. To keep
  * these mapped buffers alive, we store a pointer in mOldTextures if the
  * RotatedContentBuffer's surface is not the one from our texture client, once we
  * are done painting we unmap the surface/texture client and don't need to keep
@@ -86,17 +86,17 @@ public:
   explicit ContentClient(CompositableForwarder* aForwarder)
   : CompositableClient(aForwarder)
   {}
   virtual ~ContentClient()
   {}
 
 
   virtual void Clear() = 0;
-  virtual RotatedContentBuffer::PaintState BeginPaintBuffer(ThebesLayer* aLayer,
+  virtual RotatedContentBuffer::PaintState BeginPaintBuffer(PaintedLayer* aLayer,
                                                             uint32_t aFlags) = 0;
   virtual gfx::DrawTarget* BorrowDrawTargetForPainting(RotatedContentBuffer::PaintState& aPaintState,
                                                        RotatedContentBuffer::DrawIterator* aIter = nullptr) = 0;
   virtual void ReturnDrawTargetToBuffer(gfx::DrawTarget*& aReturned) = 0;
 
   // Called as part of the layers transation reply. Conveys data about our
   // buffer(s) from the compositor. If appropriate we should swap references
   // to our buffers.
@@ -128,32 +128,32 @@ class ContentClientBasic MOZ_FINAL : pub
 {
 public:
   ContentClientBasic();
 
   typedef RotatedContentBuffer::PaintState PaintState;
   typedef RotatedContentBuffer::ContentType ContentType;
 
   virtual void Clear() { RotatedContentBuffer::Clear(); }
-  virtual PaintState BeginPaintBuffer(ThebesLayer* aLayer,
+  virtual PaintState BeginPaintBuffer(PaintedLayer* aLayer,
                                       uint32_t aFlags) MOZ_OVERRIDE
   {
     return RotatedContentBuffer::BeginPaint(aLayer, aFlags);
   }
   virtual gfx::DrawTarget* BorrowDrawTargetForPainting(PaintState& aPaintState,
                                                        RotatedContentBuffer::DrawIterator* aIter = nullptr) MOZ_OVERRIDE
   {
     return RotatedContentBuffer::BorrowDrawTargetForPainting(aPaintState, aIter);
   }
   virtual void ReturnDrawTargetToBuffer(gfx::DrawTarget*& aReturned) MOZ_OVERRIDE
   {
     BorrowDrawTarget::ReturnDrawTarget(aReturned);
   }
 
-  void DrawTo(ThebesLayer* aLayer,
+  void DrawTo(PaintedLayer* aLayer,
               gfx::DrawTarget* aTarget,
               float aOpacity,
               gfx::CompositionOp aOp,
               gfx::SourceSurface* aMask,
               const gfx::Matrix* aMaskTransform)
   {
     RotatedContentBuffer::DrawTo(aLayer, aTarget, aOpacity, aOp,
                                  aMask, aMaskTransform);
@@ -203,17 +203,17 @@ public:
 
   virtual void Clear()
   {
     RotatedContentBuffer::Clear();
     mTextureClient = nullptr;
     mTextureClientOnWhite = nullptr;
   }
 
-  virtual PaintState BeginPaintBuffer(ThebesLayer* aLayer,
+  virtual PaintState BeginPaintBuffer(PaintedLayer* aLayer,
                                       uint32_t aFlags) MOZ_OVERRIDE
   {
     return RotatedContentBuffer::BeginPaint(aLayer, aFlags);
   }
   virtual gfx::DrawTarget* BorrowDrawTargetForPainting(PaintState& aPaintState,
                                                        RotatedContentBuffer::DrawIterator* aIter = nullptr) MOZ_OVERRIDE
   {
     return RotatedContentBuffer::BorrowDrawTargetForPainting(aPaintState, aIter);
@@ -413,17 +413,17 @@ public:
 
   virtual void Clear()
   {
     mBufferRect.SetEmpty();
     mHasBuffer = false;
     mHasBufferOnWhite = false;
   }
 
-  virtual PaintState BeginPaintBuffer(ThebesLayer* aLayer,
+  virtual PaintState BeginPaintBuffer(PaintedLayer* aLayer,
                                       uint32_t aFlags) MOZ_OVERRIDE;
   virtual gfx::DrawTarget* BorrowDrawTargetForPainting(PaintState& aPaintState,
                                                        RotatedContentBuffer::DrawIterator* aIter = nullptr) MOZ_OVERRIDE;
   virtual void ReturnDrawTargetToBuffer(gfx::DrawTarget*& aReturned) MOZ_OVERRIDE
   {
     BorrowDrawTarget::ReturnDrawTarget(aReturned);
   }
 
--- a/gfx/layers/client/TiledContentClient.cpp
+++ b/gfx/layers/client/TiledContentClient.cpp
@@ -1,17 +1,17 @@
 /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  * 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/. */
 
 #include "mozilla/layers/TiledContentClient.h"
 #include <math.h>                       // for ceil, ceilf, floor
 #include <algorithm>
-#include "ClientTiledThebesLayer.h"     // for ClientTiledThebesLayer
+#include "ClientTiledPaintedLayer.h"     // for ClientTiledPaintedLayer
 #include "GeckoProfiler.h"              // for PROFILER_LABEL
 #include "ClientLayerManager.h"         // for ClientLayerManager
 #include "CompositorChild.h"            // for CompositorChild
 #include "gfxContext.h"                 // for gfxContext, etc
 #include "gfxPlatform.h"                // for gfxPlatform
 #include "gfxPrefs.h"                   // for gfxPrefs
 #include "gfxRect.h"                    // for gfxRect
 #include "mozilla/MathAlgorithms.h"     // for Abs
@@ -84,25 +84,25 @@ static void DrawDebugOverlay(mozilla::gf
 
 namespace mozilla {
 
 using namespace gfx;
 
 namespace layers {
 
 
-TiledContentClient::TiledContentClient(ClientTiledThebesLayer* aThebesLayer,
+TiledContentClient::TiledContentClient(ClientTiledPaintedLayer* aPaintedLayer,
                                        ClientLayerManager* aManager)
   : CompositableClient(aManager->AsShadowForwarder())
 {
   MOZ_COUNT_CTOR(TiledContentClient);
 
-  mTiledBuffer = ClientTiledLayerBuffer(aThebesLayer, this, aManager,
+  mTiledBuffer = ClientTiledLayerBuffer(aPaintedLayer, this, aManager,
                                         &mSharedFrameMetricsHelper);
-  mLowPrecisionTiledBuffer = ClientTiledLayerBuffer(aThebesLayer, this, aManager,
+  mLowPrecisionTiledBuffer = ClientTiledLayerBuffer(aPaintedLayer, this, aManager,
                                                     &mSharedFrameMetricsHelper);
 
   mLowPrecisionTiledBuffer.SetResolution(gfxPrefs::LowPrecisionResolution());
 }
 
 void
 TiledContentClient::ClearCachedResources()
 {
@@ -281,21 +281,21 @@ SharedFrameMetricsHelper::AboutToChecker
     TILING_LOG("TILING: About to checkerboard; painted %s\n", Stringify(painted).c_str());
     TILING_LOG("TILING: About to checkerboard; compositor %s\n", Stringify(aCompositorMetrics).c_str());
     TILING_LOG("TILING: About to checkerboard; showing %s\n", Stringify(showing).c_str());
     return true;
   }
   return false;
 }
 
-ClientTiledLayerBuffer::ClientTiledLayerBuffer(ClientTiledThebesLayer* aThebesLayer,
+ClientTiledLayerBuffer::ClientTiledLayerBuffer(ClientTiledPaintedLayer* aPaintedLayer,
                                                CompositableClient* aCompositableClient,
                                                ClientLayerManager* aManager,
                                                SharedFrameMetricsHelper* aHelper)
-  : mThebesLayer(aThebesLayer)
+  : mPaintedLayer(aPaintedLayer)
   , mCompositableClient(aCompositableClient)
   , mManager(aManager)
   , mLastPaintContentType(gfxContentType::COLOR)
   , mLastPaintSurfaceMode(SurfaceMode::SURFACE_OPAQUE)
   , mSharedFrameMetricsHelper(aHelper)
 {
 }
 
@@ -308,34 +308,34 @@ ClientTiledLayerBuffer::HasFormatChanged
          mode != mLastPaintSurfaceMode;
 }
 
 
 gfxContentType
 ClientTiledLayerBuffer::GetContentType(SurfaceMode* aMode) const
 {
   gfxContentType content =
-    mThebesLayer->CanUseOpaqueSurface() ? gfxContentType::COLOR :
+    mPaintedLayer->CanUseOpaqueSurface() ? gfxContentType::COLOR :
                                           gfxContentType::COLOR_ALPHA;
-  SurfaceMode mode = mThebesLayer->GetSurfaceMode();
+  SurfaceMode mode = mPaintedLayer->GetSurfaceMode();
 
   if (mode == SurfaceMode::SURFACE_COMPONENT_ALPHA) {
 #if defined(MOZ_GFX_OPTIMIZE_MOBILE) || defined(MOZ_WIDGET_GONK)
      mode = SurfaceMode::SURFACE_SINGLE_CHANNEL_ALPHA;
   }
 #else
-      if (!mThebesLayer->GetParent() ||
-          !mThebesLayer->GetParent()->SupportsComponentAlphaChildren() ||
+      if (!mPaintedLayer->GetParent() ||
+          !mPaintedLayer->GetParent()->SupportsComponentAlphaChildren() ||
           !gfxPrefs::TiledDrawTargetEnabled()) {
         mode = SurfaceMode::SURFACE_SINGLE_CHANNEL_ALPHA;
       } else {
         content = gfxContentType::COLOR;
       }
   } else if (mode == SurfaceMode::SURFACE_OPAQUE) {
-    if (mThebesLayer->MayResample()) {
+    if (mPaintedLayer->MayResample()) {
       mode = SurfaceMode::SURFACE_SINGLE_CHANNEL_ALPHA;
       content = gfxContentType::COLOR_ALPHA;
     }
   }
 #endif
 
   if (aMode) {
     *aMode = mode;
@@ -882,21 +882,21 @@ ClientTiledLayerBuffer::GetSurfaceDescri
   return SurfaceDescriptorTiles(mValidRegion, mPaintedRegion,
                                 tiles, mRetainedWidth, mRetainedHeight,
                                 mResolution, mFrameResolution.scale);
 }
 
 void
 ClientTiledLayerBuffer::PaintThebes(const nsIntRegion& aNewValidRegion,
                                    const nsIntRegion& aPaintRegion,
-                                   LayerManager::DrawThebesLayerCallback aCallback,
+                                   LayerManager::DrawPaintedLayerCallback aCallback,
                                    void* aCallbackData)
 {
-  TILING_LOG("TILING %p: PaintThebes painting region %s\n", mThebesLayer, Stringify(aPaintRegion).c_str());
-  TILING_LOG("TILING %p: PaintThebes new valid region %s\n", mThebesLayer, Stringify(aNewValidRegion).c_str());
+  TILING_LOG("TILING %p: PaintThebes painting region %s\n", mPaintedLayer, Stringify(aPaintRegion).c_str());
+  TILING_LOG("TILING %p: PaintThebes new valid region %s\n", mPaintedLayer, Stringify(aNewValidRegion).c_str());
 
   mCallback = aCallback;
   mCallbackData = aCallbackData;
 
 #ifdef GFX_TILEDLAYER_PREF_WARNINGS
   long start = PR_IntervalNow();
 #endif
 
@@ -950,17 +950,17 @@ ClientTiledLayerBuffer::PaintThebes(cons
     if (PR_IntervalNow() - start > 3) {
       printf_stderr("Slow alloc %i\n", PR_IntervalNow() - start);
     }
     start = PR_IntervalNow();
 #endif
     PROFILER_LABEL("ClientTiledLayerBuffer", "PaintThebesSingleBufferDraw",
       js::ProfileEntry::Category::GRAPHICS);
 
-    mCallback(mThebesLayer, ctxt, aPaintRegion, DrawRegionClip::CLIP_NONE, nsIntRegion(), mCallbackData);
+    mCallback(mPaintedLayer, ctxt, aPaintRegion, DrawRegionClip::CLIP_NONE, nsIntRegion(), mCallbackData);
   }
 
 #ifdef GFX_TILEDLAYER_PREF_WARNINGS
   if (PR_IntervalNow() - start > 30) {
     const nsIntRect bounds = aPaintRegion.GetBounds();
     printf_stderr("Time to draw %i: %i, %i, %i, %i\n", PR_IntervalNow() - start, bounds.x, bounds.y, bounds.width, bounds.height);
     if (aPaintRegion.IsComplex()) {
       printf_stderr("Complex region\n");
@@ -1063,17 +1063,17 @@ ClientTiledLayerBuffer::PostValidate(con
     tileset.mTileCount = mMoz2DTiles.size();
     RefPtr<DrawTarget> drawTarget = gfx::Factory::CreateTiledDrawTarget(tileset);
     drawTarget->SetTransform(Matrix());
 
     RefPtr<gfxContext> ctx = new gfxContext(drawTarget);
     ctx->SetMatrix(
       ctx->CurrentMatrix().Scale(mResolution, mResolution));
 
-    mCallback(mThebesLayer, ctx, aPaintRegion, DrawRegionClip::DRAW, nsIntRegion(), mCallbackData);
+    mCallback(mPaintedLayer, ctx, aPaintRegion, DrawRegionClip::DRAW, nsIntRegion(), mCallbackData);
     mMoz2DTiles.clear();
   }
 }
 
 void
 ClientTiledLayerBuffer::UnlockTile(TileClient aTile)
 {
   // We locked the back buffer, and flipped so we now need to unlock the front
@@ -1318,17 +1318,17 @@ ClientTiledLayerBuffer::ValidateTile(Til
     }
 
     ctxt->NewPath();
     ctxt->Clip(gfxRect(bounds.x, bounds.y, bounds.width, bounds.height));
     ctxt->SetMatrix(
       ctxt->CurrentMatrix().Translate(-unscaledTileOrigin.x,
                                       -unscaledTileOrigin.y).
                             Scale(mResolution, mResolution));
-    mCallback(mThebesLayer, ctxt,
+    mCallback(mPaintedLayer, ctxt,
               tileRegion.GetBounds(),
               DrawRegionClip::CLIP_NONE,
               nsIntRegion(), mCallbackData);
 
   }
 
 #ifdef GFX_TILEDLAYER_DEBUG_OVERLAY
   DrawDebugOverlay(drawTarget, aTileOrigin.x * mResolution,
@@ -1374,17 +1374,17 @@ ClientTiledLayerBuffer::ValidateTile(Til
 /**
  * This function takes the transform stored in aTransformToCompBounds
  * (which was generated in GetTransformToAncestorsParentLayer), and
  * modifies it with the ViewTransform from the compositor side so that
  * it reflects what the compositor is actually rendering. This operation
  * basically replaces the nontransient async transform that was injected
  * in GetTransformToAncestorsParentLayer with the complete async transform.
  * This function then returns the scroll ancestor's composition bounds,
- * transformed into the thebes layer's LayerPixel coordinates, accounting
+ * transformed into the painted layer's LayerPixel coordinates, accounting
  * for the compositor state.
  */
 static LayerRect
 GetCompositorSideCompositionBounds(const LayerMetricsWrapper& aScrollAncestor,
                                    const Matrix4x4& aTransformToCompBounds,
                                    const ViewTransform& aAPZTransform)
 {
   Matrix4x4 nonTransientAPZUntransform = Matrix4x4().Scale(
@@ -1427,20 +1427,20 @@ ClientTiledLayerBuffer::ComputeProgressi
   // assumption is that the contents is less important, so visual coherency
   // is lower priority than speed.
   bool drawingLowPrecision = IsLowPrecision();
 
   // Find out if we have any non-stale content to update.
   nsIntRegion staleRegion;
   staleRegion.And(aInvalidRegion, aOldValidRegion);
 
-  TILING_LOG("TILING %p: Progressive update stale region %s\n", mThebesLayer, Stringify(staleRegion).c_str());
+  TILING_LOG("TILING %p: Progressive update stale region %s\n", mPaintedLayer, Stringify(staleRegion).c_str());
 
   LayerMetricsWrapper scrollAncestor;
-  mThebesLayer->GetAncestorLayers(&scrollAncestor, nullptr);
+  mPaintedLayer->GetAncestorLayers(&scrollAncestor, nullptr);
 
   // Find out the current view transform to determine which tiles to draw
   // first, and see if we should just abort this paint. Aborting is usually
   // caused by there being an incoming, more relevant paint.
   ViewTransform viewTransform;
 #if defined(MOZ_WIDGET_ANDROID) && !defined(MOZ_ANDROID_APZ)
   FrameMetrics contentMetrics = scrollAncestor.Metrics();
   bool abortPaint = false;
@@ -1462,17 +1462,17 @@ ClientTiledLayerBuffer::ComputeProgressi
     mSharedFrameMetricsHelper->UpdateFromCompositorFrameMetrics(
       scrollAncestor,
       !staleRegion.Contains(aInvalidRegion),
       drawingLowPrecision,
       viewTransform);
 #endif
 
   TILING_LOG("TILING %p: Progressive update view transform %s zoom %f abort %d\n",
-      mThebesLayer, ToString(viewTransform.mTranslation).c_str(), viewTransform.mScale.scale, abortPaint);
+      mPaintedLayer, ToString(viewTransform.mTranslation).c_str(), viewTransform.mScale.scale, abortPaint);
 
   if (abortPaint) {
     // We ignore if front-end wants to abort if this is the first,
     // non-low-precision paint, as in that situation, we're about to override
     // front-end's page/viewport metrics.
     if (!aPaintData->mFirstPaint || drawingLowPrecision) {
       PROFILER_LABEL("ClientTiledLayerBuffer", "ComputeProgressiveUpdateRegion",
         js::ProfileEntry::Category::GRAPHICS);
@@ -1482,17 +1482,17 @@ ClientTiledLayerBuffer::ComputeProgressi
     }
   }
 
   LayerRect transformedCompositionBounds =
     GetCompositorSideCompositionBounds(scrollAncestor,
                                        aPaintData->mTransformToCompBounds,
                                        viewTransform);
 
-  TILING_LOG("TILING %p: Progressive update transformed compositor bounds %s\n", mThebesLayer, Stringify(transformedCompositionBounds).c_str());
+  TILING_LOG("TILING %p: Progressive update transformed compositor bounds %s\n", mPaintedLayer, Stringify(transformedCompositionBounds).c_str());
 
   // Compute a "coherent update rect" that we should paint all at once in a
   // single transaction. This is to avoid rendering glitches on animated
   // page content, and when layers change size/shape.
   // On Fennec uploads are more expensive because we're not using gralloc, so
   // we use a coherent update rect that is intersected with the screen at the
   // time of issuing the draw command. This will paint faster but also potentially
   // make the progressive paint more visible to the user while scrolling.
@@ -1501,40 +1501,40 @@ ClientTiledLayerBuffer::ComputeProgressi
   nsIntRect coherentUpdateRect(LayerIntRect::ToUntyped(RoundedOut(
 #ifdef MOZ_WIDGET_ANDROID
     transformedCompositionBounds.Intersect(aPaintData->mCompositionBounds)
 #else
     transformedCompositionBounds
 #endif
   )));
 
-  TILING_LOG("TILING %p: Progressive update final coherency rect %s\n", mThebesLayer, Stringify(coherentUpdateRect).c_str());
+  TILING_LOG("TILING %p: Progressive update final coherency rect %s\n", mPaintedLayer, Stringify(coherentUpdateRect).c_str());
 
   aRegionToPaint.And(aInvalidRegion, coherentUpdateRect);
   aRegionToPaint.Or(aRegionToPaint, staleRegion);
   bool drawingStale = !aRegionToPaint.IsEmpty();
   if (!drawingStale) {
     aRegionToPaint = aInvalidRegion;
   }
 
   // Prioritise tiles that are currently visible on the screen.
   bool paintingVisible = false;
   if (aRegionToPaint.Intersects(coherentUpdateRect)) {
     aRegionToPaint.And(aRegionToPaint, coherentUpdateRect);
     paintingVisible = true;
   }
 
-  TILING_LOG("TILING %p: Progressive update final paint region %s\n", mThebesLayer, Stringify(aRegionToPaint).c_str());
+  TILING_LOG("TILING %p: Progressive update final paint region %s\n", mPaintedLayer, Stringify(aRegionToPaint).c_str());
 
   // Paint area that's visible and overlaps previously valid content to avoid
   // visible glitches in animated elements, such as gifs.
   bool paintInSingleTransaction = paintingVisible && (drawingStale || aPaintData->mFirstPaint);
 
   TILING_LOG("TILING %p: paintingVisible %d drawingStale %d firstPaint %d singleTransaction %d\n",
-    mThebesLayer, paintingVisible, drawingStale, aPaintData->mFirstPaint, paintInSingleTransaction);
+    mPaintedLayer, paintingVisible, drawingStale, aPaintData->mFirstPaint, paintInSingleTransaction);
 
   // The following code decides what order to draw tiles in, based on the
   // current scroll direction of the primary scrollable layer.
   NS_ASSERTION(!aRegionToPaint.IsEmpty(), "Unexpectedly empty paint region!");
   nsIntRect paintBounds = aRegionToPaint.GetBounds();
 
   int startX, incX, startY, incY;
   gfx::IntSize scaledTileSize = GetScaledTileSize();
@@ -1594,36 +1594,36 @@ ClientTiledLayerBuffer::ComputeProgressi
   return false;
 }
 
 bool
 ClientTiledLayerBuffer::ProgressiveUpdate(nsIntRegion& aValidRegion,
                                          nsIntRegion& aInvalidRegion,
                                          const nsIntRegion& aOldValidRegion,
                                          BasicTiledLayerPaintData* aPaintData,
-                                         LayerManager::DrawThebesLayerCallback aCallback,
+                                         LayerManager::DrawPaintedLayerCallback aCallback,
                                          void* aCallbackData)
 {
-  TILING_LOG("TILING %p: Progressive update valid region %s\n", mThebesLayer, Stringify(aValidRegion).c_str());
-  TILING_LOG("TILING %p: Progressive update invalid region %s\n", mThebesLayer, Stringify(aInvalidRegion).c_str());
-  TILING_LOG("TILING %p: Progressive update old valid region %s\n", mThebesLayer, Stringify(aOldValidRegion).c_str());
+  TILING_LOG("TILING %p: Progressive update valid region %s\n", mPaintedLayer, Stringify(aValidRegion).c_str());
+  TILING_LOG("TILING %p: Progressive update invalid region %s\n", mPaintedLayer, Stringify(aInvalidRegion).c_str());
+  TILING_LOG("TILING %p: Progressive update old valid region %s\n", mPaintedLayer, Stringify(aOldValidRegion).c_str());
 
   bool repeat = false;
   bool isBufferChanged = false;
   do {
     // Compute the region that should be updated. Repeat as many times as
     // is required.
     nsIntRegion regionToPaint;
     repeat = ComputeProgressiveUpdateRegion(aInvalidRegion,
                                             aOldValidRegion,
                                             regionToPaint,
                                             aPaintData,
                                             repeat);
 
-    TILING_LOG("TILING %p: Progressive update computed paint region %s repeat %d\n", mThebesLayer, Stringify(regionToPaint).c_str(), repeat);
+    TILING_LOG("TILING %p: Progressive update computed paint region %s repeat %d\n", mPaintedLayer, Stringify(regionToPaint).c_str(), repeat);
 
     // There's no further work to be done.
     if (regionToPaint.IsEmpty()) {
       break;
     }
 
     isBufferChanged = true;
 
@@ -1636,18 +1636,18 @@ ClientTiledLayerBuffer::ProgressiveUpdat
     nsIntRegion validOrStale;
     validOrStale.Or(aValidRegion, aOldValidRegion);
 
     // Paint the computed region and subtract it from the invalid region.
     PaintThebes(validOrStale, regionToPaint, aCallback, aCallbackData);
     aInvalidRegion.Sub(aInvalidRegion, regionToPaint);
   } while (repeat);
 
-  TILING_LOG("TILING %p: Progressive update final valid region %s buffer changed %d\n", mThebesLayer, Stringify(aValidRegion).c_str(), isBufferChanged);
-  TILING_LOG("TILING %p: Progressive update final invalid region %s\n", mThebesLayer, Stringify(aInvalidRegion).c_str());
+  TILING_LOG("TILING %p: Progressive update final valid region %s buffer changed %d\n", mPaintedLayer, Stringify(aValidRegion).c_str(), isBufferChanged);
+  TILING_LOG("TILING %p: Progressive update final invalid region %s\n", mPaintedLayer, Stringify(aInvalidRegion).c_str());
 
   // Return false if nothing has been drawn, or give what has been drawn
   // to the shadow layer to upload.
   return isBufferChanged;
 }
 
 }
 }
--- a/gfx/layers/client/TiledContentClient.h
+++ b/gfx/layers/client/TiledContentClient.h
@@ -36,17 +36,17 @@
 #include "gfxReusableSurfaceWrapper.h"
 #include "pratom.h"                     // For PR_ATOMIC_INCREMENT/DECREMENT
 #include "gfxPrefs.h"
 
 namespace mozilla {
 namespace layers {
 
 class BasicTileDescriptor;
-class ClientTiledThebesLayer;
+class ClientTiledPaintedLayer;
 class ClientLayerManager;
 
 
 // A class to help implement copy-on-write semantics for shared tiles.
 class gfxSharedReadLock {
 protected:
   virtual ~gfxSharedReadLock() {}
 
@@ -383,32 +383,32 @@ private:
  * gfxPrefs::PerTileDrawing().
  */
 class ClientTiledLayerBuffer
   : public TiledLayerBuffer<ClientTiledLayerBuffer, TileClient>
 {
   friend class TiledLayerBuffer<ClientTiledLayerBuffer, TileClient>;
 
 public:
-  ClientTiledLayerBuffer(ClientTiledThebesLayer* aThebesLayer,
+  ClientTiledLayerBuffer(ClientTiledPaintedLayer* aPaintedLayer,
                          CompositableClient* aCompositableClient,
                          ClientLayerManager* aManager,
                          SharedFrameMetricsHelper* aHelper);
   ClientTiledLayerBuffer()
-    : mThebesLayer(nullptr)
+    : mPaintedLayer(nullptr)
     , mCompositableClient(nullptr)
     , mManager(nullptr)
     , mLastPaintContentType(gfxContentType::COLOR)
     , mLastPaintSurfaceMode(SurfaceMode::SURFACE_OPAQUE)
     , mSharedFrameMetricsHelper(nullptr)
   {}
 
   void PaintThebes(const nsIntRegion& aNewValidRegion,
                    const nsIntRegion& aPaintRegion,
-                   LayerManager::DrawThebesLayerCallback aCallback,
+                   LayerManager::DrawPaintedLayerCallback aCallback,
                    void* aCallbackData);
 
   void ReadUnlock();
 
   void ReadLock();
 
   void Release();
 
@@ -423,17 +423,17 @@ public:
   /**
    * Performs a progressive update of a given tiled buffer.
    * See ComputeProgressiveUpdateRegion below for parameter documentation.
    */
   bool ProgressiveUpdate(nsIntRegion& aValidRegion,
                          nsIntRegion& aInvalidRegion,
                          const nsIntRegion& aOldValidRegion,
                          BasicTiledLayerPaintData* aPaintData,
-                         LayerManager::DrawThebesLayerCallback aCallback,
+                         LayerManager::DrawPaintedLayerCallback aCallback,
                          void* aCallbackData);
 
   SurfaceDescriptorTiles GetSurfaceDescriptorTiles();
 
 protected:
   TileClient ValidateTile(TileClient aTile,
                           const nsIntPoint& aTileRect,
                           const nsIntRegion& dirtyRect);
@@ -451,20 +451,20 @@ protected:
   void ReleaseTile(TileClient aTile) { aTile.Release(); }
 
   void SwapTiles(TileClient& aTileA, TileClient& aTileB) { std::swap(aTileA, aTileB); }
 
   TileClient GetPlaceholderTile() const { return TileClient(); }
 
 private:
   gfxContentType GetContentType(SurfaceMode* aMode = nullptr) const;
-  ClientTiledThebesLayer* mThebesLayer;
+  ClientTiledPaintedLayer* mPaintedLayer;
   CompositableClient* mCompositableClient;
   ClientLayerManager* mManager;
-  LayerManager::DrawThebesLayerCallback mCallback;
+  LayerManager::DrawPaintedLayerCallback mCallback;
   void* mCallbackData;
   CSSToParentLayerScale mFrameResolution;
   gfxContentType mLastPaintContentType;
   SurfaceMode mLastPaintSurfaceMode;
 
   // The region that will be made valid during Update(). Once Update() is
   // completed then this is identical to mValidRegion.
   nsIntRegion mNewValidRegion;
@@ -499,21 +499,21 @@ private:
                                       bool aIsRepeated);
 };
 
 class TiledContentClient : public CompositableClient
 {
   // XXX: for now the layer which owns us interacts directly with our buffers.
   // We should have a content client for each tiled buffer which manages its
   // own valid region, resolution, etc. Then we could have a much cleaner
-  // interface and tidy up BasicTiledThebesLayer::PaintThebes (bug 862547).
-  friend class ClientTiledThebesLayer;
+  // interface and tidy up BasicTiledPaintedLayer::PaintThebes (bug 862547).
+  friend class ClientTiledPaintedLayer;
 
 public:
-  TiledContentClient(ClientTiledThebesLayer* aThebesLayer,
+  TiledContentClient(ClientTiledPaintedLayer* aPaintedLayer,
                      ClientLayerManager* aManager);
 
 protected:
   ~TiledContentClient()
   {
     MOZ_COUNT_DTOR(TiledContentClient);
 
     mTiledBuffer.Release();
--- a/gfx/layers/composite/ContainerLayerComposite.cpp
+++ b/gfx/layers/composite/ContainerLayerComposite.cpp
@@ -292,17 +292,17 @@ RenderLayers(ContainerT* aContainer,
     LayerComposite* layerToRender = preparedData.mLayer;
     const RenderTargetIntRect& clipRect = preparedData.mClipRect;
     Layer* layer = layerToRender->GetLayer();
 
     gfxRGBA color;
     if (LayerHasCheckerboardingAPZC(layer, &color)) {
       // Ideally we would want to intersect the checkerboard region from the APZ with the layer bounds
       // and only fill in that area. However the layer bounds takes into account the base translation
-      // for the thebes layer whereas the checkerboard region does not. One does not simply
+      // for the painted layer whereas the checkerboard region does not. One does not simply
       // intersect areas in different coordinate spaces. So we do this a little more permissively
       // and only fill in the background when we know there is checkerboard, which in theory
       // should only occur transiently.
       nsIntRect layerBounds = layer->GetLayerBounds();
       EffectChain effectChain(layer);
       effectChain.mPrimaryEffect = new EffectSolidColor(ToColor(color));
       aManager->GetCompositor()->DrawQuad(gfx::Rect(layerBounds.x, layerBounds.y, layerBounds.width, layerBounds.height),
                                           gfx::Rect(clipRect.ToUnknownRect()),
--- a/gfx/layers/composite/ImageLayerComposite.cpp
+++ b/gfx/layers/composite/ImageLayerComposite.cpp
@@ -130,18 +130,18 @@ ImageLayerComposite::ComputeEffectiveTra
       NS_ASSERTION(mScaleMode == ScaleMode::STRETCH,
                    "No other scalemodes than stretch and none supported yet.");
       local.Scale(mScaleToSize.width / sourceRect.width,
                   mScaleToSize.height / sourceRect.height, 1.0);
     }
   }
   // Snap our local transform first, and snap the inherited transform as well.
   // This makes our snapping equivalent to what would happen if our content
-  // was drawn into a ThebesLayer (gfxContext would snap using the local
-  // transform, then we'd snap again when compositing the ThebesLayer).
+  // was drawn into a PaintedLayer (gfxContext would snap using the local
+  // transform, then we'd snap again when compositing the PaintedLayer).
   mEffectiveTransform =
       SnapTransform(local, sourceRect, nullptr) *
       SnapTransformTranslation(aTransformToSurface, nullptr);
   ComputeEffectiveTransformForMaskLayer(aTransformToSurface);
 }
 
 CompositableHost*
 ImageLayerComposite::GetCompositableHost()
--- a/gfx/layers/composite/LayerManagerComposite.cpp
+++ b/gfx/layers/composite/LayerManagerComposite.cpp
@@ -13,17 +13,17 @@
 #include "ContainerLayerComposite.h"    // for ContainerLayerComposite, etc
 #include "FPSCounter.h"                 // for FPSState, FPSCounter
 #include "FrameMetrics.h"               // for FrameMetrics
 #include "GeckoProfiler.h"              // for profiler_set_frame_number, etc
 #include "ImageLayerComposite.h"        // for ImageLayerComposite
 #include "Layers.h"                     // for Layer, ContainerLayer, etc
 #include "LayerScope.h"                 // for LayerScope Tool
 #include "protobuf/LayerScopePacket.pb.h" // for protobuf (LayerScope)
-#include "ThebesLayerComposite.h"       // for ThebesLayerComposite
+#include "PaintedLayerComposite.h"      // for PaintedLayerComposite
 #include "TiledLayerBuffer.h"           // for TiledLayerComposer
 #include "Units.h"                      // for ScreenIntRect
 #include "gfx2DGlue.h"                  // for ToMatrix4x4
 #include "gfxPrefs.h"                   // for gfxPrefs
 #ifdef XP_MACOSX
 #include "gfxPlatformMac.h"
 #endif
 #include "gfxRect.h"                    // for gfxRect
@@ -207,17 +207,17 @@ LayerManagerComposite::EndEmptyTransacti
     return false;
   }
 
   EndTransaction(nullptr, nullptr);
   return true;
 }
 
 void
-LayerManagerComposite::EndTransaction(DrawThebesLayerCallback aCallback,
+LayerManagerComposite::EndTransaction(DrawPaintedLayerCallback aCallback,
                                       void* aCallbackData,
                                       EndTransactionFlags aFlags)
 {
   NS_ASSERTION(mInTransaction, "Didn't call BeginTransaction?");
   NS_ASSERTION(!aCallback && !aCallbackData, "Not expecting callbacks here");
   mInTransaction = false;
 
   if (!mIsCompositorReady) {
@@ -275,18 +275,18 @@ LayerManagerComposite::EndTransaction(Dr
 
 TemporaryRef<DrawTarget>
 LayerManagerComposite::CreateOptimalMaskDrawTarget(const IntSize &aSize)
 {
   NS_RUNTIMEABORT("Should only be called on the drawing side");
   return nullptr;
 }
 
-already_AddRefed<ThebesLayer>
-LayerManagerComposite::CreateThebesLayer()
+already_AddRefed<PaintedLayer>
+LayerManagerComposite::CreatePaintedLayer()
 {
   NS_RUNTIMEABORT("Should only be called on the drawing side");
   return nullptr;
 }
 
 already_AddRefed<ContainerLayer>
 LayerManagerComposite::CreateContainerLayer()
 {
@@ -752,25 +752,25 @@ LayerManagerComposite::ComputeRenderInte
     }
     for (Layer* child = aLayer->GetFirstChild(); child;
          child = child->GetNextSibling()) {
       ComputeRenderIntegrityInternal(child, aScreenRegion, aLowPrecisionScreenRegion, transform);
     }
     return;
   }
 
-  // Only thebes layers can be incomplete
-  ThebesLayer* thebesLayer = aLayer->AsThebesLayer();
-  if (!thebesLayer) {
+  // Only painted layers can be incomplete
+  PaintedLayer* paintedLayer = aLayer->AsPaintedLayer();
+  if (!paintedLayer) {
     return;
   }
 
   // See if there's any incomplete rendering
   nsIntRegion incompleteRegion = aLayer->GetEffectiveVisibleRegion();
-  incompleteRegion.Sub(incompleteRegion, thebesLayer->GetValidRegion());
+  incompleteRegion.Sub(incompleteRegion, paintedLayer->GetValidRegion());
 
   if (!incompleteRegion.IsEmpty()) {
     // Calculate the transform to get between screen and layer space
     Matrix4x4 transformToScreen = aLayer->GetEffectiveTransform();
     transformToScreen = aTransform * transformToScreen;
 
     SubtractTransformedRegion(aScreenRegion, incompleteRegion, transformToScreen);
 
@@ -917,24 +917,24 @@ LayerManagerComposite::ComputeRenderInte
 
     return ((highPrecisionIntegrity * highPrecisionMultiplier) +
             (lowPrecisionIntegrity * lowPrecisionMultiplier)) / 2;
   }
 
   return 1.f;
 }
 
-already_AddRefed<ThebesLayerComposite>
-LayerManagerComposite::CreateThebesLayerComposite()
+already_AddRefed<PaintedLayerComposite>
+LayerManagerComposite::CreatePaintedLayerComposite()
 {
   if (mDestroyed) {
     NS_WARNING("Call on destroyed layer manager");
     return nullptr;
   }
-  return nsRefPtr<ThebesLayerComposite>(new ThebesLayerComposite(this)).forget();
+  return nsRefPtr<PaintedLayerComposite>(new PaintedLayerComposite(this)).forget();
 }
 
 already_AddRefed<ContainerLayerComposite>
 LayerManagerComposite::CreateContainerLayerComposite()
 {
   if (mDestroyed) {
     NS_WARNING("Call on destroyed layer manager");
     return nullptr;
--- a/gfx/layers/composite/LayerManagerComposite.h
+++ b/gfx/layers/composite/LayerManagerComposite.h
@@ -56,17 +56,17 @@ class CompositableHost;
 class Compositor;
 class ContainerLayerComposite;
 struct EffectChain;
 class ImageLayer;
 class ImageLayerComposite;
 class LayerComposite;
 class RefLayerComposite;
 class SurfaceDescriptor;
-class ThebesLayerComposite;
+class PaintedLayerComposite;
 class TiledLayerComposer;
 class TextRenderer;
 class CompositingRenderTarget;
 struct FPSState;
 
 static const int kVisualWarningTrigger = 200; // ms
 static const int kVisualWarningMax = 1000; // ms
 static const int kVisualWarningDuration = 150; // ms
@@ -115,39 +115,39 @@ public:
   virtual void BeginTransaction() MOZ_OVERRIDE;
   virtual void BeginTransactionWithTarget(gfxContext* aTarget) MOZ_OVERRIDE
   {
     MOZ_CRASH("Use BeginTransactionWithDrawTarget");
   }
   void BeginTransactionWithDrawTarget(gfx::DrawTarget* aTarget, const nsIntRect& aRect);
 
   virtual bool EndEmptyTransaction(EndTransactionFlags aFlags = END_DEFAULT) MOZ_OVERRIDE;
-  virtual void EndTransaction(DrawThebesLayerCallback aCallback,
+  virtual void EndTransaction(DrawPaintedLayerCallback aCallback,
                               void* aCallbackData,
                               EndTransactionFlags aFlags = END_DEFAULT) MOZ_OVERRIDE;
 
   virtual void SetRoot(Layer* aLayer) MOZ_OVERRIDE { mRoot = aLayer; }
 
   // XXX[nrc]: never called, we should move this logic to ClientLayerManager
   // (bug 946926).
   virtual bool CanUseCanvasLayerForSize(const gfx::IntSize &aSize) MOZ_OVERRIDE;
 
   virtual int32_t GetMaxTextureSize() const MOZ_OVERRIDE
   {
     MOZ_CRASH("Call on compositor, not LayerManagerComposite");
   }
 
   virtual void ClearCachedResources(Layer* aSubtree = nullptr) MOZ_OVERRIDE;
 
-  virtual already_AddRefed<ThebesLayer> CreateThebesLayer() MOZ_OVERRIDE;
+  virtual already_AddRefed<PaintedLayer> CreatePaintedLayer() MOZ_OVERRIDE;
   virtual already_AddRefed<ContainerLayer> CreateContainerLayer() MOZ_OVERRIDE;
   virtual already_AddRefed<ImageLayer> CreateImageLayer() MOZ_OVERRIDE;
   virtual already_AddRefed<ColorLayer> CreateColorLayer() MOZ_OVERRIDE;
   virtual already_AddRefed<CanvasLayer> CreateCanvasLayer() MOZ_OVERRIDE;
-  already_AddRefed<ThebesLayerComposite> CreateThebesLayerComposite();
+  already_AddRefed<PaintedLayerComposite> CreatePaintedLayerComposite();
   already_AddRefed<ContainerLayerComposite> CreateContainerLayerComposite();
   already_AddRefed<ImageLayerComposite> CreateImageLayerComposite();
   already_AddRefed<ColorLayerComposite> CreateColorLayerComposite();
   already_AddRefed<CanvasLayerComposite> CreateCanvasLayerComposite();
   already_AddRefed<RefLayerComposite> CreateRefLayerComposite();
 
   virtual LayersBackend GetBackendType() MOZ_OVERRIDE
   {
rename from gfx/layers/composite/ThebesLayerComposite.cpp
rename to gfx/layers/composite/PaintedLayerComposite.cpp
--- a/gfx/layers/composite/ThebesLayerComposite.cpp
+++ b/gfx/layers/composite/PaintedLayerComposite.cpp
@@ -1,14 +1,14 @@
 /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* 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/. */
 
-#include "ThebesLayerComposite.h"
+#include "PaintedLayerComposite.h"
 #include "CompositableHost.h"           // for TiledLayerProperties, etc
 #include "FrameMetrics.h"               // for FrameMetrics
 #include "Units.h"                      // for CSSRect, LayerPixel, etc
 #include "gfx2DGlue.h"                  // for ToMatrix4x4
 #include "gfxUtils.h"                   // for gfxUtils, etc
 #include "mozilla/Assertions.h"         // for MOZ_ASSERT, etc
 #include "mozilla/gfx/Matrix.h"         // for Matrix4x4
 #include "mozilla/gfx/Point.h"          // for Point
@@ -29,93 +29,93 @@
 #include "TextRenderer.h"
 #include "GeckoProfiler.h"
 
 namespace mozilla {
 namespace layers {
 
 class TiledLayerComposer;
 
-ThebesLayerComposite::ThebesLayerComposite(LayerManagerComposite *aManager)
-  : ThebesLayer(aManager, nullptr)
+PaintedLayerComposite::PaintedLayerComposite(LayerManagerComposite *aManager)
+  : PaintedLayer(aManager, nullptr)
   , LayerComposite(aManager)
   , mBuffer(nullptr)
 {
-  MOZ_COUNT_CTOR(ThebesLayerComposite);
+  MOZ_COUNT_CTOR(PaintedLayerComposite);
   mImplData = static_cast<LayerComposite*>(this);
 }
 
-ThebesLayerComposite::~ThebesLayerComposite()
+PaintedLayerComposite::~PaintedLayerComposite()
 {
-  MOZ_COUNT_DTOR(ThebesLayerComposite);
+  MOZ_COUNT_DTOR(PaintedLayerComposite);
   CleanupResources();
 }
 
 bool
-ThebesLayerComposite::SetCompositableHost(CompositableHost* aHost)
+PaintedLayerComposite::SetCompositableHost(CompositableHost* aHost)
 {
   switch (aHost->GetType()) {
     case CompositableType::BUFFER_CONTENT_INC:
     case CompositableType::BUFFER_TILED:
     case CompositableType::CONTENT_SINGLE:
     case CompositableType::CONTENT_DOUBLE:
       mBuffer = static_cast<ContentHost*>(aHost);
       return true;
     default:
       return false;
   }
 }
 
 void
-ThebesLayerComposite::Disconnect()
+PaintedLayerComposite::Disconnect()
 {
   Destroy();
 }
 
 void
-ThebesLayerComposite::Destroy()
+PaintedLayerComposite::Destroy()
 {
   if (!mDestroyed) {
     CleanupResources();
     mDestroyed = true;
   }
 }
 
 Layer*
-ThebesLayerComposite::GetLayer()
+PaintedLayerComposite::GetLayer()
 {
   return this;
 }
 
 TiledLayerComposer*
-ThebesLayerComposite::GetTiledLayerComposer()
+PaintedLayerComposite::GetTiledLayerComposer()
 {
   if (!mBuffer) {
     return nullptr;
   }
   MOZ_ASSERT(mBuffer->IsAttached());
   return mBuffer->AsTiledLayerComposer();
 }
 
 LayerRenderState
-ThebesLayerComposite::GetRenderState()
+PaintedLayerComposite::GetRenderState()
 {
   if (!mBuffer || !mBuffer->IsAttached() || mDestroyed) {
     return LayerRenderState();
   }
   return mBuffer->GetRenderState();
 }
 
 void
-ThebesLayerComposite::RenderLayer(const nsIntRect& aClipRect)
+PaintedLayerComposite::RenderLayer(const nsIntRect& aClipRect)
 {
   if (!mBuffer || !mBuffer->IsAttached()) {
     return;
   }
-  PROFILER_LABEL("ThebesLayerComposite", "RenderLayer",
+  PROFILER_LABEL("PaintedLayerComposite", "RenderLayer",
     js::ProfileEntry::Category::GRAPHICS);
 
   MOZ_ASSERT(mBuffer->GetCompositor() == mCompositeManager->GetCompositor() &&
              mBuffer->GetLayer() == this,
              "buffer is corrupted");
 
   const nsIntRegion& visibleRegion = GetEffectiveVisibleRegion();
   gfx::Rect clipRect(aClipRect.x, aClipRect.y, aClipRect.width, aClipRect.height);
@@ -142,45 +142,45 @@ ThebesLayerComposite::RenderLayer(const 
                      clipRect,
                      &visibleRegion);
   mBuffer->BumpFlashCounter();
 
   mCompositeManager->GetCompositor()->MakeCurrent();
 }
 
 CompositableHost*
-ThebesLayerComposite::GetCompositableHost()
+PaintedLayerComposite::GetCompositableHost()
 {
   if (mBuffer && mBuffer->IsAttached()) {
     return mBuffer.get();
   }
 
   return nullptr;
 }
 
 void
-ThebesLayerComposite::CleanupResources()
+PaintedLayerComposite::CleanupResources()
 {
   if (mBuffer) {
     mBuffer->Detach(this);
   }
   mBuffer = nullptr;
 }
 
 void
-ThebesLayerComposite::GenEffectChain(EffectChain& aEffect)
+PaintedLayerComposite::GenEffectChain(EffectChain& aEffect)
 {
   aEffect.mLayerRef = this;
   aEffect.mPrimaryEffect = mBuffer->GenEffect(GetEffectFilter());
 }
 
 void
-ThebesLayerComposite::PrintInfo(std::stringstream& aStream, const char* aPrefix)
+PaintedLayerComposite::PrintInfo(std::stringstream& aStream, const char* aPrefix)
 {
-  ThebesLayer::PrintInfo(aStream, aPrefix);
+  PaintedLayer::PrintInfo(aStream, aPrefix);
   if (mBuffer && mBuffer->IsAttached()) {
     aStream << "\n";
     nsAutoCString pfx(aPrefix);
     pfx += "  ";
     mBuffer->PrintInfo(aStream, pfx.get());
   }
 }
 
rename from gfx/layers/composite/ThebesLayerComposite.h
rename to gfx/layers/composite/PaintedLayerComposite.h
--- a/gfx/layers/composite/ThebesLayerComposite.h
+++ b/gfx/layers/composite/PaintedLayerComposite.h
@@ -1,15 +1,15 @@
 /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* 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/. */
 
-#ifndef GFX_ThebesLayerComposite_H
-#define GFX_ThebesLayerComposite_H
+#ifndef GFX_PaintedLayerComposite_H
+#define GFX_PaintedLayerComposite_H
 
 #include "Layers.h"                     // for Layer (ptr only), etc
 #include "gfxRect.h"                    // for gfxRect
 #include "mozilla/Attributes.h"         // for MOZ_OVERRIDE
 #include "mozilla/RefPtr.h"             // for RefPtr
 #include "mozilla/layers/LayerManagerComposite.h"  // for LayerComposite, etc
 #include "mozilla/layers/LayersTypes.h"  // for LayerRenderState, etc
 #include "nsDebug.h"                    // for NS_RUNTIMEABORT
@@ -20,32 +20,32 @@ struct nsIntPoint;
 struct nsIntRect;
 
 
 namespace mozilla {
 namespace layers {
 
 /**
  * Thebes layers use ContentHosts for their compsositable host.
- * By using different ContentHosts, ThebesLayerComposite support tiled and
+ * By using different ContentHosts, PaintedLayerComposite support tiled and
  * non-tiled Thebes layers and single or double buffering.
  */
 
 class CompositableHost;
 class ContentHost;
 class TiledLayerComposer;
 
-class ThebesLayerComposite : public ThebesLayer,
+class PaintedLayerComposite : public PaintedLayer,
                              public LayerComposite
 {
 public:
-  explicit ThebesLayerComposite(LayerManagerComposite *aManager);
+  explicit PaintedLayerComposite(LayerManagerComposite *aManager);
 
 protected:
-  virtual ~ThebesLayerComposite();
+  virtual ~PaintedLayerComposite();
 
 public:
   virtual void Disconnect() MOZ_OVERRIDE;
 
   virtual LayerRenderState GetRenderState() MOZ_OVERRIDE;
 
   CompositableHost* GetCompositableHost() MOZ_OVERRIDE;
 
@@ -62,34 +62,34 @@ public:
   virtual void GenEffectChain(EffectChain& aEffect) MOZ_OVERRIDE;
 
   virtual bool SetCompositableHost(CompositableHost* aHost) MOZ_OVERRIDE;
 
   virtual LayerComposite* AsLayerComposite() MOZ_OVERRIDE { return this; }
 
   virtual void InvalidateRegion(const nsIntRegion& aRegion)
   {
-    NS_RUNTIMEABORT("ThebesLayerComposites can't fill invalidated regions");
+    NS_RUNTIMEABORT("PaintedLayerComposites can't fill invalidated regions");
   }
 
   void SetValidRegion(const nsIntRegion& aRegion)
   {
     MOZ_LAYERS_LOG_IF_SHADOWABLE(this, ("Layer::Mutated(%p) ValidRegion", this));
     mValidRegion = aRegion;
     Mutated();
   }
 
-  MOZ_LAYER_DECL_NAME("ThebesLayerComposite", TYPE_THEBES)
+  MOZ_LAYER_DECL_NAME("PaintedLayerComposite", TYPE_THEBES)
 
 protected:
 
   virtual void PrintInfo(std::stringstream& aStream, const char* aPrefix) MOZ_OVERRIDE;
 
 private:
   gfx::Filter GetEffectFilter() { return gfx::Filter::LINEAR; }
 
 private:
   RefPtr<ContentHost> mBuffer;
 };
 
 } /* layers */
 } /* mozilla */
-#endif /* GFX_ThebesLayerComposite_H */
+#endif /* GFX_PaintedLayerComposite_H */
--- a/gfx/layers/composite/TiledContentHost.cpp
+++ b/gfx/layers/composite/TiledContentHost.cpp
@@ -1,15 +1,15 @@
 /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* 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/. */
 
 #include "TiledContentHost.h"
-#include "ThebesLayerComposite.h"       // for ThebesLayerComposite
+#include "PaintedLayerComposite.h"      // for PaintedLayerComposite
 #include "mozilla/gfx/BaseSize.h"       // for BaseSize
 #include "mozilla/gfx/Matrix.h"         // for Matrix4x4
 #include "mozilla/layers/Compositor.h"  // for Compositor
 #include "mozilla/layers/Effects.h"     // for TexturedEffect, Effect, etc
 #include "mozilla/layers/LayerMetricsWrapper.h" // for LayerMetricsWrapper
 #include "mozilla/layers/TextureHostOGL.h"  // for TextureHostOGL
 #include "nsAString.h"
 #include "nsDebug.h"                    // for NS_WARNING
--- a/gfx/layers/d3d10/ColorLayerD3D10.h
+++ b/gfx/layers/d3d10/ColorLayerD3D10.h
@@ -19,9 +19,9 @@ public:
 
   /* LayerD3D10 implementation */
   virtual Layer* GetLayer();
   virtual void RenderLayer();
 };
 
 } /* layers */
 } /* mozilla */
-#endif /* GFX_THEBESLAYERD3D10_H */
+#endif /* GFX_PAINTEDLAYERD3D10_H */
--- a/gfx/layers/d3d10/ContainerLayerD3D10.cpp
+++ b/gfx/layers/d3d10/ContainerLayerD3D10.cpp
@@ -1,16 +1,16 @@
 /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  * 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/. */
 
 #include "ContainerLayerD3D10.h"
 
-#include "ThebesLayerD3D10.h"
+#include "PaintedLayerD3D10.h"
 #include "ReadbackProcessor.h"
 
 using namespace mozilla::gfx;
 
 namespace mozilla {
 namespace layers {
 
 ContainerLayerD3D10::ContainerLayerD3D10(LayerManagerD3D10 *aManager)
@@ -251,17 +251,17 @@ ContainerLayerD3D10::Validate()
   }
 
   ReadbackProcessor readback;
   readback.BuildUpdates(this);
 
   Layer *layer = GetFirstChild();
   while (layer) {
     if (layer->GetType() == TYPE_THEBES) {
-      static_cast<ThebesLayerD3D10*>(layer)->Validate(&readback);
+      static_cast<PaintedLayerD3D10*>(layer)->Validate(&readback);
     } else {
       static_cast<LayerD3D10*>(layer->ImplData())->Validate();
     }
     layer = layer->GetNextSibling();
   }
 }
 
 } /* layers */
--- a/gfx/layers/d3d10/LayerManagerD3D10.cpp
+++ b/gfx/layers/d3d10/LayerManagerD3D10.cpp
@@ -10,17 +10,17 @@
 #include "gfxWindowsPlatform.h"
 #include "gfx2DGlue.h"
 #include "gfxD2DSurface.h"
 #include "gfxFailure.h"
 #include "cairo-win32.h"
 #include "dxgi.h"
 
 #include "ContainerLayerD3D10.h"
-#include "ThebesLayerD3D10.h"
+#include "PaintedLayerD3D10.h"
 #include "ColorLayerD3D10.h"
 #include "CanvasLayerD3D10.h"
 #include "ReadbackLayerD3D10.h"
 #include "ImageLayerD3D10.h"
 #include "mozilla/layers/PLayerChild.h"
 #include "mozilla/WidgetUtils.h"
 
 #include "../d3d9/Nv3DVUtils.h"
@@ -349,17 +349,17 @@ LayerManagerD3D10::EndEmptyTransaction(E
   if (!mRoot)
     return false;
 
   EndTransaction(nullptr, nullptr, aFlags);
   return true;
 }
 
 void
-LayerManagerD3D10::EndTransaction(DrawThebesLayerCallback aCallback,
+LayerManagerD3D10::EndTransaction(DrawPaintedLayerCallback aCallback,
                                   void* aCallbackData,
                                   EndTransactionFlags aFlags)
 {
   mInTransaction = false;
 
   if (mRoot && !(aFlags & END_NO_IMMEDIATE_REDRAW)) {
     mCurrentCallbackInfo.Callback = aCallback;
     mCurrentCallbackInfo.CallbackData = aCallbackData;
@@ -387,20 +387,20 @@ LayerManagerD3D10::EndTransaction(DrawTh
 #ifdef MOZ_LAYERS_HAVE_LOG
   Log();
   MOZ_LAYERS_LOG(("]----- EndTransaction"));
 #endif
 
   mTarget = nullptr;
 }
 
-already_AddRefed<ThebesLayer>
-LayerManagerD3D10::CreateThebesLayer()
+already_AddRefed<PaintedLayer>
+LayerManagerD3D10::CreatePaintedLayer()
 {
-  nsRefPtr<ThebesLayer> layer = new ThebesLayerD3D10(this);
+  nsRefPtr<PaintedLayer> layer = new PaintedLayerD3D10(this);
   return layer.forget();
 }
 
 already_AddRefed<ContainerLayer>
 LayerManagerD3D10::CreateContainerLayer()
 {
   nsRefPtr<ContainerLayer> layer = new ContainerLayerD3D10(this);
   return layer.forget();
--- a/gfx/layers/d3d10/LayerManagerD3D10.h
+++ b/gfx/layers/d3d10/LayerManagerD3D10.h
@@ -76,21 +76,21 @@ public:
 
   virtual void BeginTransaction();
 
   virtual void BeginTransactionWithTarget(gfxContext* aTarget);
 
   virtual bool EndEmptyTransaction(EndTransactionFlags aFlags = END_DEFAULT);
 
   struct CallbackInfo {
-    DrawThebesLayerCallback Callback;
+    DrawPaintedLayerCallback Callback;
     void *CallbackData;
   };
 
-  virtual void EndTransaction(DrawThebesLayerCallback aCallback,
+  virtual void EndTransaction(DrawPaintedLayerCallback aCallback,
                               void* aCallbackData,
                               EndTransactionFlags aFlags = END_DEFAULT);
 
   const CallbackInfo &GetCallbackInfo() { return mCurrentCallbackInfo; }
 
   // D3D10 guarantees textures can be at least this size
   enum {
     MAX_TEXTURE_SIZE = 8192
@@ -100,17 +100,17 @@ public:
     return aSize <= gfx::IntSize(MAX_TEXTURE_SIZE, MAX_TEXTURE_SIZE);
   }
 
   virtual int32_t GetMaxTextureSize() const
   {
     return MAX_TEXTURE_SIZE;
   }
 
-  virtual already_AddRefed<ThebesLayer> CreateThebesLayer();
+  virtual already_AddRefed<PaintedLayer> CreatePaintedLayer();
   virtual already_AddRefed<ContainerLayer> CreateContainerLayer();
   virtual already_AddRefed<ImageLayer> CreateImageLayer();
   virtual already_AddRefed<ColorLayer> CreateColorLayer();
   virtual already_AddRefed<CanvasLayer> CreateCanvasLayer();
   virtual already_AddRefed<ReadbackLayer> CreateReadbackLayer();
 
   virtual TemporaryRef<DrawTarget>
     CreateOptimalDrawTarget(const IntSize &aSize,
rename from gfx/layers/d3d10/ThebesLayerD3D10.cpp
rename to gfx/layers/d3d10/PaintedLayerD3D10.cpp
--- a/gfx/layers/d3d10/ThebesLayerD3D10.cpp
+++ b/gfx/layers/d3d10/PaintedLayerD3D10.cpp
@@ -4,17 +4,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "mozilla/layers/PLayerTransaction.h"
 
 // This must occur *after* layers/PLayerTransaction.h to avoid
 // typedefs conflicts.
 #include "mozilla/ArrayUtils.h"
 
-#include "ThebesLayerD3D10.h"
+#include "PaintedLayerD3D10.h"
 #include "gfxPlatform.h"
 
 #include "gfxWindowsPlatform.h"
 #ifdef CAIRO_HAS_D2D_SURFACE
 #include "gfxD2DSurface.h"
 #endif
 
 #include "../d3d9/Nv3DVUtils.h"
@@ -26,37 +26,37 @@
 #include "mozilla/Preferences.h"
 #include "mozilla/gfx/2D.h"
 
 namespace mozilla {
 namespace layers {
 
 using namespace mozilla::gfx;
 
-ThebesLayerD3D10::ThebesLayerD3D10(LayerManagerD3D10 *aManager)
-  : ThebesLayer(aManager, nullptr)
+PaintedLayerD3D10::PaintedLayerD3D10(LayerManagerD3D10 *aManager)
+  : PaintedLayer(aManager, nullptr)
   , LayerD3D10(aManager)
   , mCurrentSurfaceMode(SurfaceMode::SURFACE_OPAQUE)
 {
   mImplData = static_cast<LayerD3D10*>(this);
 }
 
-ThebesLayerD3D10::~ThebesLayerD3D10()
+PaintedLayerD3D10::~PaintedLayerD3D10()
 {
 }
 
 void
-ThebesLayerD3D10::InvalidateRegion(const nsIntRegion &aRegion)
+PaintedLayerD3D10::InvalidateRegion(const nsIntRegion &aRegion)
 {
   mInvalidRegion.Or(mInvalidRegion, aRegion);
   mInvalidRegion.SimplifyOutward(20);
   mValidRegion.Sub(mValidRegion, mInvalidRegion);
 }
 
-void ThebesLayerD3D10::CopyRegion(ID3D10Texture2D* aSrc, const nsIntPoint &aSrcOffset,
+void PaintedLayerD3D10::CopyRegion(ID3D10Texture2D* aSrc, const nsIntPoint &aSrcOffset,
                                   ID3D10Texture2D* aDest, const nsIntPoint &aDestOffset,
                                   const nsIntRegion &aCopyRegion, nsIntRegion* aValidRegion)
 {
   nsIntRegion retainedRegion;
   nsIntRegionRectIterator iter(aCopyRegion);
   const nsIntRect *r;
   while ((r = iter.Next())) {
     // Calculate the retained rectangle's position on the old and the new
@@ -79,17 +79,17 @@ void ThebesLayerD3D10::CopyRegion(ID3D10
     retainedRegion.Or(retainedRegion, *r);
   }
 
   // Areas which were valid and were retained are still valid
   aValidRegion->And(*aValidRegion, retainedRegion);  
 }
 
 void
-ThebesLayerD3D10::RenderLayer()
+PaintedLayerD3D10::RenderLayer()
 {
   if (!mTexture) {
     return;
   }
 
   SetEffectTransformAndOpacity();
 
   ID3D10EffectTechnique *technique;
@@ -140,17 +140,17 @@ ThebesLayerD3D10::RenderLayer()
   }
 
   // Set back to default.
   effect()->GetVariableByName("vTextureCoords")->AsVector()->
     SetFloatVector(ShaderConstantRectD3D10(0, 0, 1.0f, 1.0f));
 }
 
 void
-ThebesLayerD3D10::Validate(ReadbackProcessor *aReadback)
+PaintedLayerD3D10::Validate(ReadbackProcessor *aReadback)
 {
   if (mVisibleRegion.IsEmpty()) {
     return;
   }
 
   if (FAILED(gfxWindowsPlatform::GetPlatform()->GetD3D10Device()->GetDeviceRemovedReason())) {
     // Device removed, this will be discovered on the next rendering pass.
     // Do no validate.
@@ -184,17 +184,17 @@ ThebesLayerD3D10::Validate(ReadbackProce
   }
   mCurrentSurfaceMode = mode;
 
   VerifyContentType(mode);
 
   nsTArray<ReadbackProcessor::Update> readbackUpdates;
   nsIntRegion readbackRegion;
   if (aReadback && UsedForReadback()) {
-    aReadback->GetThebesLayerUpdates(this, &readbackUpdates, &readbackRegion);
+    aReadback->GetPaintedLayerUpdates(this, &readbackUpdates, &readbackRegion);
   }
 
   if (mTexture) {
     if (!mTextureRect.IsEqualInterior(newTextureRect)) {
       nsRefPtr<ID3D10Texture2D> oldTexture = mTexture;
       mTexture = nullptr;
       nsRefPtr<ID3D10Texture2D> oldTextureOnWhite = mTextureOnWhite;
       mTextureOnWhite = nullptr;
@@ -238,32 +238,32 @@ ThebesLayerD3D10::Validate(ReadbackProce
   }
 
   nsIntRegion drawRegion;
   drawRegion.Sub(neededRegion, mValidRegion);
 
   if (!drawRegion.IsEmpty()) {
     LayerManagerD3D10::CallbackInfo cbInfo = mD3DManager->GetCallbackInfo();
     if (!cbInfo.Callback) {
-      NS_ERROR("D3D10 should never need to update ThebesLayers in an empty transaction");
+      NS_ERROR("D3D10 should never need to update PaintedLayers in an empty transaction");
       return;
     }
 
     DrawRegion(drawRegion, mode);
 
     if (readbackUpdates.Length() > 0) {
       CD3D10_TEXTURE2D_DESC desc(DXGI_FORMAT_B8G8R8A8_UNORM,
                                  newTextureRect.width, newTextureRect.height,
                                  1, 1, 0, D3D10_USAGE_STAGING,
                                  D3D10_CPU_ACCESS_READ);
 
       nsRefPtr<ID3D10Texture2D> readbackTexture;
       HRESULT hr = device()->CreateTexture2D(&desc, nullptr, getter_AddRefs(readbackTexture));
       if (FAILED(hr)) {
-        LayerManagerD3D10::ReportFailure(NS_LITERAL_CSTRING("ThebesLayerD3D10::Validate(): Failed to create texture"),
+        LayerManagerD3D10::ReportFailure(NS_LITERAL_CSTRING("PaintedLayerD3D10::Validate(): Failed to create texture"),
                                          hr);
         return;
       }
 
       device()->CopyResource(readbackTexture, mTexture);
 
       for (uint32_t i = 0; i < readbackUpdates.Length(); i++) {
         mD3DManager->readbackManager()->PostTask(readbackTexture,
@@ -272,56 +272,56 @@ ThebesLayerD3D10::Validate(ReadbackProce
       }
     }
 
     mValidRegion = neededRegion;
   }
 }
 
 void
-ThebesLayerD3D10::LayerManagerDestroyed()
+PaintedLayerD3D10::LayerManagerDestroyed()
 {
   mD3DManager = nullptr;
 }
 
 Layer*
-ThebesLayerD3D10::GetLayer()
+PaintedLayerD3D10::GetLayer()
 {
   return this;
 }
 
 void
-ThebesLayerD3D10::VerifyContentType(SurfaceMode aMode)
+PaintedLayerD3D10::VerifyContentType(SurfaceMode aMode)
 {
   if (mDrawTarget) {
     SurfaceFormat format = aMode != SurfaceMode::SURFACE_SINGLE_CHANNEL_ALPHA ?
       SurfaceFormat::B8G8R8X8 : SurfaceFormat::B8G8R8A8;
 
     if (format != mDrawTarget->GetFormat()) {
       mDrawTarget = Factory::CreateDrawTargetForD3D10Texture(mTexture, format);
 
       if (!mDrawTarget) {
-        NS_WARNING("Failed to create drawtarget for ThebesLayerD3D10.");
+        NS_WARNING("Failed to create drawtarget for PaintedLayerD3D10.");
         return;
       }
 
       mValidRegion.SetEmpty();
     }
   }    
 
   if (aMode != SurfaceMode::SURFACE_COMPONENT_ALPHA && mTextureOnWhite) {
     // If we've transitioned away from component alpha, we can delete those resources.
     mSRViewOnWhite = nullptr;
     mTextureOnWhite = nullptr;
     mValidRegion.SetEmpty();
   }
 }
 
 void
-ThebesLayerD3D10::FillTexturesBlackWhite(const nsIntRegion& aRegion, const nsIntPoint& aOffset)
+PaintedLayerD3D10::FillTexturesBlackWhite(const nsIntRegion& aRegion, const nsIntPoint& aOffset)
 {
   if (mTexture && mTextureOnWhite) {
     // It would be more optimal to draw the actual geometry, but more code
     // and probably not worth the win here as this will often be a single
     // rect.
     nsRefPtr<ID3D10RenderTargetView> oldRT;
     device()->OMGetRenderTargets(1, getter_AddRefs(oldRT), nullptr);
 
@@ -375,17 +375,17 @@ ThebesLayerD3D10::FillTexturesBlackWhite
     views[0] = oldRT;
     device()->OMSetRenderTargets(1, views, nullptr);
     mD3DManager->SetViewport(oldVP);
     device()->RSSetScissorRects(1, &oldScissor);
   }
 }
 
 void
-ThebesLayerD3D10::DrawRegion(nsIntRegion &aRegion, SurfaceMode aMode)
+PaintedLayerD3D10::DrawRegion(nsIntRegion &aRegion, SurfaceMode aMode)
 {
   nsIntRect visibleRect = mVisibleRegion.GetBounds();
 
   if (!mDrawTarget) {
     return;
   }
 
   aRegion.SimplifyOutwardByArea(100 * 100);
@@ -408,72 +408,72 @@ ThebesLayerD3D10::DrawRegion(nsIntRegion
 
   mDrawTarget->SetPermitSubpixelAA(!(mContentFlags & CONTENT_COMPONENT_ALPHA));
 
   LayerManagerD3D10::CallbackInfo cbInfo = mD3DManager->GetCallbackInfo();
   cbInfo.Callback(this, context, aRegion, DrawRegionClip::DRAW, nsIntRegion(), cbInfo.CallbackData);
 }
 
 void
-ThebesLayerD3D10::CreateNewTextures(const gfx::IntSize &aSize, SurfaceMode aMode)
+PaintedLayerD3D10::CreateNewTextures(const gfx::IntSize &aSize, SurfaceMode aMode)
 {
   if (aSize.width == 0 || aSize.height == 0) {
     // Nothing to do.
     return;
   }
 
   CD3D10_TEXTURE2D_DESC desc(DXGI_FORMAT_B8G8R8A8_UNORM, aSize.width, aSize.height, 1, 1);
   desc.BindFlags = D3D10_BIND_RENDER_TARGET | D3D10_BIND_SHADER_RESOURCE;
   desc.MiscFlags = D3D10_RESOURCE_MISC_GDI_COMPATIBLE;
   HRESULT hr;
 
   if (!mTexture) {
     hr = device()->CreateTexture2D(&desc, nullptr, getter_AddRefs(mTexture));
 
     if (FAILED(hr)) {
-      NS_WARNING("Failed to create new texture for ThebesLayerD3D10!");
+      NS_WARNING("Failed to create new texture for PaintedLayerD3D10!");
       return;
     }
 
     hr = device()->CreateShaderResourceView(mTexture, nullptr, getter_AddRefs(mSRView));
 
     if (FAILED(hr)) {
-      NS_WARNING("Failed to create shader resource view for ThebesLayerD3D10.");
+      NS_WARNING("Failed to create shader resource view for PaintedLayerD3D10.");
     }
 
     mDrawTarget = nullptr;
   }
 
   if (aMode == SurfaceMode::SURFACE_COMPONENT_ALPHA && !mTextureOnWhite) {
     hr = device()->CreateTexture2D(&desc, nullptr, getter_AddRefs(mTextureOnWhite));
 
     if (FAILED(hr)) {
-      NS_WARNING("Failed to create new texture for ThebesLayerD3D10!");
+      NS_WARNING("Failed to create new texture for PaintedLayerD3D10!");
       return;
     }
 
     hr = device()->CreateShaderResourceView(mTextureOnWhite, nullptr, getter_AddRefs(mSRViewOnWhite));
 
     if (FAILED(hr)) {
-      NS_WARNING("Failed to create shader resource view for ThebesLayerD3D10.");
+      NS_WARNING("Failed to create shader resource view for PaintedLayerD3D10.");
     }
 
     mDrawTarget = nullptr;
   }
 
   if (!mDrawTarget) {
     if (aMode == SurfaceMode::SURFACE_COMPONENT_ALPHA) {
       mDrawTarget = Factory::CreateDualDrawTargetForD3D10Textures(mTexture, mTextureOnWhite, SurfaceFormat::B8G8R8X8);
     } else {
       mDrawTarget = Factory::CreateDrawTargetForD3D10Texture(mTexture, aMode != SurfaceMode::SURFACE_SINGLE_CHANNEL_ALPHA ?
         SurfaceFormat::B8G8R8X8 : SurfaceFormat::B8G8R8A8);
     }
 
     if (!mDrawTarget) {
-      NS_WARNING("Failed to create DrawTarget for ThebesLayerD3D10.");
+      NS_WARNING("Failed to create DrawTarget for PaintedLayerD3D10.");
       mDrawTarget = nullptr;
       return;
     }
   }
 }
 
 } /* namespace layers */
 } /* namespace mozilla */
rename from gfx/layers/d3d10/ThebesLayerD3D10.h
rename to gfx/layers/d3d10/PaintedLayerD3D10.h
--- a/gfx/layers/d3d10/ThebesLayerD3D10.h
+++ b/gfx/layers/d3d10/PaintedLayerD3D10.h
@@ -1,31 +1,31 @@
 /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  * 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/. */
 
-#ifndef GFX_THEBESLAYERD3D10_H
-#define GFX_THEBESLAYERD3D10_H
+#ifndef GFX_PAINTEDLAYERD3D10_H
+#define GFX_PAINTEDLAYERD3D10_H
 
 #include "LayerManagerD3D10.h"
 
 namespace mozilla {
 namespace layers {
 
-class ThebesLayerD3D10 : public ThebesLayer,
+class PaintedLayerD3D10 : public PaintedLayer,
                          public LayerD3D10
 {
 public:
-  ThebesLayerD3D10(LayerManagerD3D10 *aManager);
-  virtual ~ThebesLayerD3D10();
+  PaintedLayerD3D10(LayerManagerD3D10 *aManager);
+  virtual ~PaintedLayerD3D10();
 
   void Validate(ReadbackProcessor *aReadback);
 
-  /* ThebesLayer implementation */
+  /* PaintedLayer implementation */
   void InvalidateRegion(const nsIntRegion& aRegion);
 
   /* LayerD3D10 implementation */
   virtual Layer* GetLayer();
   virtual void RenderLayer();
   virtual void Validate() { Validate(nullptr); }
   virtual void LayerManagerDestroyed();
 
@@ -65,9 +65,9 @@ private:
   /* Copy a texture region */
   void CopyRegion(ID3D10Texture2D* aSrc, const nsIntPoint &aSrcOffset,
                   ID3D10Texture2D* aDest, const nsIntPoint &aDestOffset,
                   const nsIntRegion &aCopyRegion, nsIntRegion* aValidRegion);
 };
 
 } /* layers */
 } /* mozilla */
-#endif /* GFX_THEBESLAYERD3D10_H */
+#endif /* GFX_PAINTEDLAYERD3D10_H */
--- a/gfx/layers/d3d10/ReadbackManagerD3D10.cpp
+++ b/gfx/layers/d3d10/ReadbackManagerD3D10.cpp
@@ -15,24 +15,24 @@
 namespace mozilla {
 namespace layers {
 
 // Structure that contains the information required to execute a readback task,
 // the only member accessed off the main thread here is mReadbackTexture. Since
 // mLayer may be released only on the main thread this object should always be
 // destroyed on the main thread!
 struct ReadbackTask {
-  // The texture that we copied the contents of the thebeslayer to.
+  // The texture that we copied the contents of the paintedlayer to.
   nsRefPtr<ID3D10Texture2D> mReadbackTexture;
   // This exists purely to keep the ReadbackLayer alive for the lifetime of
   // mUpdate. Note that this addref and release should occur -solely- on the
   // main thread.
   nsRefPtr<ReadbackLayer> mLayer;
   ReadbackProcessor::Update mUpdate;
-  // The origin in ThebesLayer coordinates of mReadbackTexture.
+  // The origin in PaintedLayer coordinates of mReadbackTexture.
   gfxPoint mOrigin;
   // mLayer->GetBackgroundOffset() when the task is created.  We have
   // to save this in the ReadbackTask because it might change before
   // the update is delivered to the readback sink.
   nsIntPoint mBackgroundOffset;
 };
 
 // This class is created and dispatched from the Readback thread but it must be
@@ -59,17 +59,17 @@ public:
     mTask->mReadbackTexture->GetDesc(&desc);
 
     D3D10_MAPPED_TEXTURE2D mappedTex;
     // We know this map will immediately succeed, as we've already mapped this
     // copied data on our task thread.
     HRESULT hr = mTask->mReadbackTexture->Map(0, D3D10_MAP_READ, 0, &mappedTex);
 
     if (FAILED(hr)) {
-      // If this fails we're never going to get our ThebesLayer content.
+      // If this fails we're never going to get our PaintedLayer content.
       update->mLayer->GetSink()->SetUnknown(update->mSequenceCounter);
       return NS_OK;
     }
 
     nsRefPtr<gfxImageSurface> sourceSurface =
       new gfxImageSurface((unsigned char*)mappedTex.pData,
                           gfxIntSize(desc.Width, desc.Height),
                           mappedTex.RowPitch,
--- a/gfx/layers/d3d10/ReadbackManagerD3D10.h
+++ b/gfx/layers/d3d10/ReadbackManagerD3D10.h
@@ -29,17 +29,17 @@ public:
   /**
    * Tell the readback manager to post a readback task.
    *
    * @param aTexture D3D10_USAGE_STAGING texture that will contain the data that
    *                 was readback.
    * @param aUpdate  ReadbackProcessor::Update object. This is a void pointer
    *                 since we cannot forward declare a nested class, and do not
    *                 export ReadbackProcessor.h
-   * @param aOrigin  Origin of the aTexture surface in the ThebesLayer
+   * @param aOrigin  Origin of the aTexture surface in the PaintedLayer
    *                 coordinate system.
    */
   void PostTask(ID3D10Texture2D *aTexture, void *aUpdate, const gfxPoint &aOrigin);
 
   virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid,
                                                    void **ppvObject);
   virtual ULONG STDMETHODCALLTYPE AddRef(void);
   virtual ULONG STDMETHODCALLTYPE Release(void);
--- a/gfx/layers/d3d11/ReadbackManagerD3D11.cpp
+++ b/gfx/layers/d3d11/ReadbackManagerD3D11.cpp
@@ -18,17 +18,17 @@ using namespace gfx;
 
 namespace layers {
 
 // Structure that contains the information required to execute a readback task,
 // the only member accessed off the main thread here is mReadbackTexture. Since
 // mSink may be released only on the main thread this object should always be
 // destroyed on the main thread!
 struct ReadbackTask {
-  // The texture that we copied the contents of the thebeslayer to.
+  // The texture that we copied the contents of the paintedlayer to.
   nsRefPtr<ID3D10Texture2D> mReadbackTexture;
   // The sink that we're trying to read back to.
   RefPtr<TextureReadbackSink> mSink;
 };
 
 // This class is created and dispatched from the Readback thread but it must be
 // destroyed by the main thread.
 class ReadbackResultWriterD3D11 MOZ_FINAL : public nsIRunnable
--- a/gfx/layers/d3d9/ContainerLayerD3D9.cpp
+++ b/gfx/layers/d3d9/ContainerLayerD3D9.cpp
@@ -1,16 +1,16 @@
 /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  * 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/. */
 
 #include "ContainerLayerD3D9.h"
 
-#include "ThebesLayerD3D9.h"
+#include "PaintedLayerD3D9.h"
 #include "ReadbackProcessor.h"
 
 using namespace mozilla::gfx;
 
 namespace mozilla {
 namespace layers {
 
 ContainerLayerD3D9::ContainerLayerD3D9(LayerManagerD3D9 *aManager)
@@ -169,17 +169,17 @@ ContainerLayerD3D9::RenderLayer()
     RECT d3drect;
     d3drect.left = scissorRect.x;
     d3drect.top = scissorRect.y;
     d3drect.right = scissorRect.x + scissorRect.width;
     d3drect.bottom = scissorRect.y + scissorRect.height;
     device()->SetScissorRect(&d3drect);
 
     if (layerToRender->GetLayer()->GetType() == TYPE_THEBES) {
-      static_cast<ThebesLayerD3D9*>(layerToRender)->RenderThebesLayer(&readback);
+      static_cast<PaintedLayerD3D9*>(layerToRender)->RenderPaintedLayer(&readback);
     } else {
       layerToRender->RenderLayer();
     }
   }
     
   if (useIntermediate && !mD3DManager->CompositingDisabled()) {
     device()->SetRenderTarget(0, previousRenderTarget);
     device()->SetVertexShaderConstantF(CBvRenderTargetOffset, previousRenderTargetOffset, 1);
--- a/gfx/layers/d3d9/DeviceManagerD3D9.cpp
+++ b/gfx/layers/d3d9/DeviceManagerD3D9.cpp
@@ -1,16 +1,16 @@
 /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  * 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/. */
 
 #include "DeviceManagerD3D9.h"
 #include "LayerManagerD3D9Shaders.h"
-#include "ThebesLayerD3D9.h"
+#include "PaintedLayerD3D9.h"
 #include "nsIServiceManager.h"
 #include "nsIConsoleService.h"
 #include "nsPrintfCString.h"
 #include "Nv3DVUtils.h"
 #include "plstr.h"
 #include <algorithm>
 #include "gfx2DGlue.h"
 #include "gfxPlatform.h"
--- a/gfx/layers/d3d9/ImageLayerD3D9.cpp
+++ b/gfx/layers/d3d9/ImageLayerD3D9.cpp
@@ -5,17 +5,17 @@
 
 #include "mozilla/gfx/2D.h"
 #include "mozilla/gfx/Point.h"
 #include "mozilla/RefPtr.h"
 #include "mozilla/layers/PLayerTransaction.h"
 #include "gfxSharedImageSurface.h"
 
 #include "ImageLayerD3D9.h"
-#include "ThebesLayerD3D9.h"
+#include "PaintedLayerD3D9.h"
 #include "gfxPlatform.h"
 #include "gfx2DGlue.h"
 #include "yuv_convert.h"
 #include "nsIServiceManager.h"
 #include "nsIConsoleService.h"
 #include "Nv3DVUtils.h"
 #include "D3D9SurfaceImage.h"
 
--- a/gfx/layers/d3d9/LayerManagerD3D9.cpp
+++ b/gfx/layers/d3d9/LayerManagerD3D9.cpp
@@ -1,16 +1,16 @@
 /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  * 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/. */
 
 #include "LayerManagerD3D9.h"
 
-#include "ThebesLayerD3D9.h"
+#include "PaintedLayerD3D9.h"
 #include "ContainerLayerD3D9.h"
 #include "ImageLayerD3D9.h"
 #include "ColorLayerD3D9.h"
 #include "CanvasLayerD3D9.h"
 #include "ReadbackLayerD3D9.h"
 #include "gfxWindowsPlatform.h"
 #include "nsIGfxInfo.h"
 #include "nsServiceManagerUtils.h"
@@ -123,17 +123,17 @@ LayerManagerD3D9::EndEmptyTransaction(En
   if (!mRoot || mDeviceResetCount != mDeviceManager->GetDeviceResetCount())
     return false;
 
   EndTransaction(nullptr, nullptr, aFlags);
   return true;
 }
 
 void
-LayerManagerD3D9::EndTransaction(DrawThebesLayerCallback aCallback,
+LayerManagerD3D9::EndTransaction(DrawPaintedLayerCallback aCallback,
                                  void* aCallbackData,
                                  EndTransactionFlags aFlags)
 {
   mInTransaction = false;
 
   mDeviceResetCount = mDeviceManager->GetDeviceResetCount();
 
   if (mRoot && !(aFlags & END_NO_IMMEDIATE_REDRAW)) {
@@ -162,20 +162,20 @@ LayerManagerD3D9::EndTransaction(DrawThe
 }
 
 void
 LayerManagerD3D9::SetRoot(Layer *aLayer)
 {
   mRoot = aLayer;
 }
 
-already_AddRefed<ThebesLayer>
-LayerManagerD3D9::CreateThebesLayer()
+already_AddRefed<PaintedLayer>
+LayerManagerD3D9::CreatePaintedLayer()
 {
-  nsRefPtr<ThebesLayer> layer = new ThebesLayerD3D9(this);
+  nsRefPtr<PaintedLayer> layer = new PaintedLayerD3D9(this);
   return layer.forget();
 }
 
 already_AddRefed<ContainerLayer>
 LayerManagerD3D9::CreateContainerLayer()
 {
   nsRefPtr<ContainerLayer> layer = new ContainerLayerD3D9(this);
   return layer.forget();
--- a/gfx/layers/d3d9/LayerManagerD3D9.h
+++ b/gfx/layers/d3d9/LayerManagerD3D9.h
@@ -15,17 +15,17 @@
 #include "nsIWidget.h"
 
 #include "DeviceManagerD3D9.h"
 
 namespace mozilla {
 namespace layers {
 
 class LayerD3D9;
-class ThebesLayerD3D9;
+class PaintedLayerD3D9;
 
 /*
  * This is the LayerManager used for Direct3D 9. For now this will render on
  * the main thread.
  */
 class LayerManagerD3D9 : public LayerManager {
 public:
   LayerManagerD3D9(nsIWidget *aWidget);
@@ -61,21 +61,21 @@ public:
 
   virtual void BeginTransactionWithTarget(gfxContext* aTarget);
 
   void EndConstruction();
 
   virtual bool EndEmptyTransaction(EndTransactionFlags aFlags = END_DEFAULT);
 
   struct CallbackInfo {
-    DrawThebesLayerCallback Callback;
+    DrawPaintedLayerCallback Callback;
     void *CallbackData;
   };
 
-  virtual void EndTransaction(DrawThebesLayerCallback aCallback,
+  virtual void EndTransaction(DrawPaintedLayerCallback aCallback,
                               void* aCallbackData,
                               EndTransactionFlags aFlags = END_DEFAULT);
 
   const CallbackInfo &GetCallbackInfo() { return mCurrentCallbackInfo; }
 
   void SetRoot(Layer* aLayer);
 
   virtual bool CanUseCanvasLayerForSize(const gfx::IntSize &aSize)
@@ -86,17 +86,17 @@ public:
     return aSize <= gfx::IntSize(maxSize, maxSize);
   }
 
   virtual int32_t GetMaxTextureSize() const
   {
     return mDeviceManager->GetMaxTextureSize();
   }
 
-  virtual already_AddRefed<ThebesLayer> CreateThebesLayer();
+  virtual already_AddRefed<PaintedLayer> CreatePaintedLayer();
 
   virtual already_AddRefed<ContainerLayer> CreateContainerLayer();
 
   virtual already_AddRefed<ImageLayer> CreateImageLayer();
 
   virtual already_AddRefed<ColorLayer> CreateColorLayer();
 
   virtual already_AddRefed<CanvasLayer> CreateCanvasLayer();
rename from gfx/layers/d3d9/ThebesLayerD3D9.cpp
rename to gfx/layers/d3d9/PaintedLayerD3D9.cpp
--- a/gfx/layers/d3d9/ThebesLayerD3D9.cpp
+++ b/gfx/layers/d3d9/PaintedLayerD3D9.cpp
@@ -4,63 +4,63 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "mozilla/layers/PLayerTransaction.h"
 
 // This must occur *after* layers/PLayerTransaction.h to avoid
 // typedefs conflicts.
 #include "mozilla/ArrayUtils.h"
 
-#include "ThebesLayerD3D9.h"
+#include "PaintedLayerD3D9.h"
 #include "gfxPlatform.h"
 
 #include "gfxWindowsPlatform.h"
 #include "gfxTeeSurface.h"
 #include "gfxUtils.h"
 #include "ReadbackProcessor.h"
 #include "ReadbackLayer.h"
 #include "mozilla/gfx/2D.h"
 
 namespace mozilla {
 namespace layers {
 
 using namespace gfx;
 
-ThebesLayerD3D9::ThebesLayerD3D9(LayerManagerD3D9 *aManager)
-  : ThebesLayer(aManager, nullptr)
+PaintedLayerD3D9::PaintedLayerD3D9(LayerManagerD3D9 *aManager)
+  : PaintedLayer(aManager, nullptr)
   , LayerD3D9(aManager)
 {
   mImplData = static_cast<LayerD3D9*>(this);
   aManager->deviceManager()->mLayersWithResources.AppendElement(this);
 }
 
-ThebesLayerD3D9::~ThebesLayerD3D9()
+PaintedLayerD3D9::~PaintedLayerD3D9()
 {
   if (mD3DManager) {
     mD3DManager->deviceManager()->mLayersWithResources.RemoveElement(this);
   }
 }
 
 /**
  * Retention threshold - amount of pixels intersection required to enable
  * layer content retention. This is a guesstimate. Profiling could be done to
  * figure out the optimal threshold.
  */
 #define RETENTION_THRESHOLD 16384
 
 void
-ThebesLayerD3D9::InvalidateRegion(const nsIntRegion &aRegion)
+PaintedLayerD3D9::InvalidateRegion(const nsIntRegion &aRegion)
 {
   mInvalidRegion.Or(mInvalidRegion, aRegion);
   mInvalidRegion.SimplifyOutward(20);
   mValidRegion.Sub(mValidRegion, mInvalidRegion);
 }
 
 void
-ThebesLayerD3D9::CopyRegion(IDirect3DTexture9* aSrc, const nsIntPoint &aSrcOffset,
+PaintedLayerD3D9::CopyRegion(IDirect3DTexture9* aSrc, const nsIntPoint &aSrcOffset,
                             IDirect3DTexture9* aDest, const nsIntPoint &aDestOffset,
                             const nsIntRegion &aCopyRegion, nsIntRegion* aValidRegion)
 {
   nsRefPtr<IDirect3DSurface9> srcSurface, dstSurface;
   aSrc->GetSurfaceLevel(0, getter_AddRefs(srcSurface));
   aDest->GetSurfaceLevel(0, getter_AddRefs(dstSurface));
 
   nsIntRegion retainedRegion;
@@ -92,17 +92,17 @@ ThebesLayerD3D9::CopyRegion(IDirect3DTex
     }
   }
 
   // Areas which were valid and were retained are still valid
   aValidRegion->And(*aValidRegion, retainedRegion);
 }
 
 void
-ThebesLayerD3D9::UpdateTextures(SurfaceMode aMode)
+PaintedLayerD3D9::UpdateTextures(SurfaceMode aMode)
 {
   nsIntRect visibleRect = mVisibleRegion.GetBounds();
 
   if (HaveTextures(aMode)) {
     if (!mTextureRect.IsEqualInterior(visibleRect)) {
       nsRefPtr<IDirect3DTexture9> oldTexture = mTexture;
       nsRefPtr<IDirect3DTexture9> oldTextureOnWhite = mTextureOnWhite;
 
@@ -136,17 +136,17 @@ ThebesLayerD3D9::UpdateTextures(SurfaceM
     CreateNewTextures(gfx::IntSize(visibleRect.width, visibleRect.height), aMode);
     mTextureRect = visibleRect;
     
     NS_ASSERTION(mValidRegion.IsEmpty(), "Someone forgot to empty the region");
   }
 }
 
 void
-ThebesLayerD3D9::RenderRegion(const nsIntRegion& aRegion)
+PaintedLayerD3D9::RenderRegion(const nsIntRegion& aRegion)
 {
   nsIntRegionRectIterator iter(aRegion);
 
   const nsIntRect *iterRect;
   while ((iterRect = iter.Next())) {
     device()->SetVertexShaderConstantF(CBvLayerQuad,
                                        ShaderConstantRect(iterRect->x,
                                                           iterRect->y,
@@ -161,17 +161,17 @@ ThebesLayerD3D9::RenderRegion(const nsIn
         (float)iterRect->width / (float)mTextureRect.width,
         (float)iterRect->height / (float)mTextureRect.height), 1);
 
     device()->DrawPrimitive(D3DPT_TRIANGLESTRIP, 0, 2);
   }
 }
 
 void
-ThebesLayerD3D9::RenderThebesLayer(ReadbackProcessor* aReadback)
+PaintedLayerD3D9::RenderPaintedLayer(ReadbackProcessor* aReadback)
 {
   if (mVisibleRegion.IsEmpty()) {
     return;
   }
 
   nsIntRect newTextureRect = mVisibleRegion.GetBounds();
 
   SurfaceMode mode = GetSurfaceMode();
@@ -203,33 +203,33 @@ ThebesLayerD3D9::RenderThebesLayer(Readb
   if (!HaveTextures(mode)) {
     NS_WARNING("Texture creation failed");
     return;
   }
 
   nsTArray<ReadbackProcessor::Update> readbackUpdates;
   nsIntRegion readbackRegion;
   if (aReadback && UsedForReadback()) {
-    aReadback->GetThebesLayerUpdates(this, &readbackUpdates, &readbackRegion);
+    aReadback->GetPaintedLayerUpdates(this, &readbackUpdates, &readbackRegion);
   }
 
-  // Because updates to D3D9 ThebesLayers are rendered with the CPU, we don't
+  // Because updates to D3D9 PaintedLayers are rendered with the CPU, we don't
   // have to do readback from D3D9 surfaces. Instead we make sure that any area
   // needed for readback is included in the drawRegion we ask layout to render.
   // Then the readback areas we need can be copied out of the temporary
   // destinationSurface in DrawRegion.
   nsIntRegion drawRegion;
   drawRegion.Sub(neededRegion, mValidRegion);
   drawRegion.Or(drawRegion, readbackRegion);
   // NS_ASSERTION(mVisibleRegion.Contains(region), "Bad readback region!");
 
   if (!drawRegion.IsEmpty()) {
     LayerManagerD3D9::CallbackInfo cbInfo = mD3DManager->GetCallbackInfo();
     if (!cbInfo.Callback) {
-      NS_ERROR("D3D9 should never need to update ThebesLayers in an empty transaction");
+      NS_ERROR("D3D9 should never need to update PaintedLayers in an empty transaction");
       return;
     }
 
     DrawRegion(drawRegion, mode, readbackUpdates);
 
     mValidRegion = neededRegion;
   }
 
@@ -267,44 +267,44 @@ ThebesLayerD3D9::RenderThebesLayer(Readb
 
   // Set back to default.
   device()->SetVertexShaderConstantF(CBvTextureCoords,
                                      ShaderConstantRect(0, 0, 1.0f, 1.0f),
                                      1);
 }
 
 void
-ThebesLayerD3D9::CleanResources()
+PaintedLayerD3D9::CleanResources()
 {
   mTexture = nullptr;
   mTextureOnWhite = nullptr;
   mValidRegion.SetEmpty();
 }
 
 void
-ThebesLayerD3D9::LayerManagerDestroyed()
+PaintedLayerD3D9::LayerManagerDestroyed()
 {
   mD3DManager->deviceManager()->mLayersWithResources.RemoveElement(this);
   mD3DManager = nullptr;
 }
 
 Layer*
-ThebesLayerD3D9::GetLayer()
+PaintedLayerD3D9::GetLayer()
 {
   return this;
 }
 
 bool
-ThebesLayerD3D9::IsEmpty()
+PaintedLayerD3D9::IsEmpty()
 {
   return !mTexture;
 }
 
 void
-ThebesLayerD3D9::VerifyContentType(SurfaceMode aMode)
+PaintedLayerD3D9::VerifyContentType(SurfaceMode aMode)
 {
   if (!mTexture)
     return;
 
   D3DSURFACE_DESC desc;
   mTexture->GetLevelDesc(0, &desc);
 
   switch (aMode) {
@@ -475,17 +475,17 @@ FillSurface(gfxASurface* aSurface, const
   const nsIntRect* r;
   while ((r = iter.Next()) != nullptr) {
     nsIntRect rect = *r + aOffset;
     gfxUtils::ClearThebesSurface(aSurface, &rect, aColor);
   }
 }
 
 void
-ThebesLayerD3D9::DrawRegion(nsIntRegion &aRegion, SurfaceMode aMode,
+PaintedLayerD3D9::DrawRegion(nsIntRegion &aRegion, SurfaceMode aMode,
                             const nsTArray<ReadbackProcessor::Update>& aReadbackUpdates)
 {
   nsIntRect visibleRect = mVisibleRegion.GetBounds();
 
   nsRefPtr<gfxASurface> destinationSurface;
   nsIntRect bounds = aRegion.GetBounds();
   nsRefPtr<IDirect3DTexture9> tmpTexture;
   OpaqueRenderer opaqueRenderer(aRegion);
@@ -614,43 +614,43 @@ ThebesLayerD3D9::DrawRegion(nsIntRegion 
       point.x = iterRect->x - visibleRect.x;
       point.y = iterRect->y - visibleRect.y;
       device()->UpdateSurface(srcSurface, &rect, dstSurface, &point);
     }
   }
 }
 
 void
-ThebesLayerD3D9::CreateNewTextures(const gfx::IntSize &aSize,
+PaintedLayerD3D9::CreateNewTextures(const gfx::IntSize &aSize,
                                   SurfaceMode aMode)
 {
   if (aSize.width == 0 || aSize.height == 0) {
     // Nothing to do.
     return;
   }
 
   mTexture = nullptr;
   mTextureOnWhite = nullptr;
   HRESULT hr = device()->CreateTexture(aSize.width, aSize.height, 1,
                                        D3DUSAGE_RENDERTARGET,
                                        aMode != SurfaceMode::SURFACE_SINGLE_CHANNEL_ALPHA ? D3DFMT_X8R8G8B8 : D3DFMT_A8R8G8B8,
                                        D3DPOOL_DEFAULT, getter_AddRefs(mTexture), nullptr);
   if (FAILED(hr)) {
-    ReportFailure(NS_LITERAL_CSTRING("ThebesLayerD3D9::CreateNewTextures(): Failed to create texture"),
+    ReportFailure(NS_LITERAL_CSTRING("PaintedLayerD3D9::CreateNewTextures(): Failed to create texture"),
                   hr);
     return;
   }
 
   if (aMode == SurfaceMode::SURFACE_COMPONENT_ALPHA) {
     hr = device()->CreateTexture(aSize.width, aSize.height, 1,
                                  D3DUSAGE_RENDERTARGET,
                                  D3DFMT_X8R8G8B8,
                                  D3DPOOL_DEFAULT, getter_AddRefs(mTextureOnWhite), nullptr);
     if (FAILED(hr)) {
-      ReportFailure(NS_LITERAL_CSTRING("ThebesLayerD3D9::CreateNewTextures(): Failed to create texture (2)"),
+      ReportFailure(NS_LITERAL_CSTRING("PaintedLayerD3D9::CreateNewTextures(): Failed to create texture (2)"),
                     hr);
       return;
     }
   }
 }
 
 } /* namespace layers */
 } /* namespace mozilla */
rename from gfx/layers/d3d9/ThebesLayerD3D9.h
rename to gfx/layers/d3d9/PaintedLayerD3D9.h
--- a/gfx/layers/d3d9/ThebesLayerD3D9.h
+++ b/gfx/layers/d3d9/PaintedLayerD3D9.h
@@ -1,43 +1,43 @@
 /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  * 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/. */
 
-#ifndef GFX_THEBESLAYERD3D9_H
-#define GFX_THEBESLAYERD3D9_H
+#ifndef GFX_PAINTEDLAYERD3D9_H
+#define GFX_PAINTEDLAYERD3D9_H
 
 #include "Layers.h"
 #include "LayerManagerD3D9.h"
 #include "ReadbackProcessor.h"
 
 namespace mozilla {
 namespace layers {
 
 class ReadbackProcessor;
 
-class ThebesLayerD3D9 : public ThebesLayer,
+class PaintedLayerD3D9 : public PaintedLayer,
                         public LayerD3D9
 {
 public:
-  ThebesLayerD3D9(LayerManagerD3D9 *aManager);
-  virtual ~ThebesLayerD3D9();
+  PaintedLayerD3D9(LayerManagerD3D9 *aManager);
+  virtual ~PaintedLayerD3D9();
 
-  /* ThebesLayer implementation */
+  /* PaintedLayer implementation */
   void InvalidateRegion(const nsIntRegion& aRegion);
 
   /* LayerD3D9 implementation */
   Layer* GetLayer();
   virtual bool IsEmpty();
-  virtual void RenderLayer() { RenderThebesLayer(nullptr); }
+  virtual void RenderLayer() { RenderPaintedLayer(nullptr); }
   virtual void CleanResources();
   virtual void LayerManagerDestroyed();
 
-  void RenderThebesLayer(ReadbackProcessor* aReadback);
+  void RenderPaintedLayer(ReadbackProcessor* aReadback);
 
 private:
   /*
    * D3D9 texture
    */
   nsRefPtr<IDirect3DTexture9> mTexture;
   /*
    * D3D9 texture for render-on-white when doing component alpha
@@ -76,9 +76,9 @@ private:
 
   void CopyRegion(IDirect3DTexture9* aSrc, const nsIntPoint &aSrcOffset,
                   IDirect3DTexture9* aDest, const nsIntPoint &aDestOffset,
                   const nsIntRegion &aCopyRegion, nsIntRegion* aValidRegion);
 };
 
 } /* layers */
 } /* mozilla */
-#endif /* GFX_THEBESLAYERD3D9_H */
+#endif /* GFX_PAINTEDLAYERD3D9_H */
--- a/gfx/layers/ipc/CompositableTransactionParent.cpp
+++ b/gfx/layers/ipc/CompositableTransactionParent.cpp
@@ -18,17 +18,17 @@
 #include "mozilla/layers/ContentHost.h"  // for ContentHostBase
 #include "mozilla/layers/ImageBridgeParent.h" // for ImageBridgeParent
 #include "mozilla/layers/SharedBufferManagerParent.h"
 #include "mozilla/layers/LayerManagerComposite.h"
 #include "mozilla/layers/LayersSurfaces.h"  // for SurfaceDescriptor
 #include "mozilla/layers/LayersTypes.h"  // for MOZ_LAYERS_LOG
 #include "mozilla/layers/TextureHost.h"  // for TextureHost
 #include "mozilla/layers/TextureHostOGL.h"  // for TextureHostOGL
-#include "mozilla/layers/ThebesLayerComposite.h"
+#include "mozilla/layers/PaintedLayerComposite.h"
 #include "mozilla/mozalloc.h"           // for operator delete
 #include "mozilla/unused.h"
 #include "nsDebug.h"                    // for NS_WARNING, NS_ASSERTION
 #include "nsRegion.h"                   // for nsIntRegion
 
 namespace mozilla {
 namespace layers {
 
@@ -83,25 +83,25 @@ CompositableParentManager::ReceiveCompos
                                                 op.textureInfo(),
                                                 op.bufferRect());
       if (!success) {
         return false;
       }
       break;
     }
     case CompositableOperation::TOpPaintTextureRegion: {
-      MOZ_LAYERS_LOG(("[ParentSide] Paint ThebesLayer"));
+      MOZ_LAYERS_LOG(("[ParentSide] Paint PaintedLayer"));
 
       const OpPaintTextureRegion& op = aEdit.get_OpPaintTextureRegion();
       CompositableHost* compositable = AsCompositable(op);
       Layer* layer = compositable->GetLayer();
       if (!layer || layer->GetType() != Layer::TYPE_THEBES) {
         return false;
       }
-      ThebesLayerComposite* thebes = static_cast<ThebesLayerComposite*>(layer);
+      PaintedLayerComposite* thebes = static_cast<PaintedLayerComposite*>(layer);
 
       const ThebesBufferData& bufferData = op.bufferData();
 
       RenderTraceInvalidateStart(thebes, "FF00FF", op.updatedRegion().GetBounds());
 
       nsIntRegion frontUpdatedRegion;
       if (!compositable->UpdateThebes(bufferData,
                                       op.updatedRegion(),
@@ -112,17 +112,17 @@ CompositableParentManager::ReceiveCompos
       }
       replyv.push_back(
         OpContentBufferSwap(op.compositableParent(), nullptr, frontUpdatedRegion));
 
       RenderTraceInvalidateEnd(thebes, "FF00FF");
       break;
     }
     case CompositableOperation::TOpPaintTextureIncremental: {
-      MOZ_LAYERS_LOG(("[ParentSide] Paint ThebesLayer"));
+      MOZ_LAYERS_LOG(("[ParentSide] Paint PaintedLayer"));
 
       const OpPaintTextureIncremental& op = aEdit.get_OpPaintTextureIncremental();
 
       CompositableHost* compositable = AsCompositable(op);
 
       SurfaceDescriptor desc = op.image();
 
       compositable->UpdateIncremental(op.textureId(),
--- a/gfx/layers/ipc/LayerTransactionParent.cpp
+++ b/gfx/layers/ipc/LayerTransactionParent.cpp
@@ -21,17 +21,17 @@
 #include "mozilla/layers/ImageLayerComposite.h"
 #include "mozilla/layers/LayerManagerComposite.h"
 #include "mozilla/layers/LayersMessages.h"  // for EditReply, etc
 #include "mozilla/layers/LayersSurfaces.h"  // for PGrallocBufferParent
 #include "mozilla/layers/LayersTypes.h"  // for MOZ_LAYERS_LOG
 #include "mozilla/layers/PCompositableParent.h"
 #include "mozilla/layers/PLayerParent.h"  // for PLayerParent
 #include "mozilla/layers/TextureHostOGL.h"  // for TextureHostOGL
-#include "mozilla/layers/ThebesLayerComposite.h"
+#include "mozilla/layers/PaintedLayerComposite.h"
 #include "mozilla/mozalloc.h"           // for operator delete, etc
 #include "mozilla/unused.h"
 #include "nsCoord.h"                    // for NSAppUnitsToFloatPixels
 #include "nsDebug.h"                    // for NS_RUNTIMEABORT
 #include "nsDeviceContext.h"            // for AppUnitsPerCSSPixel
 #include "nsISupportsImpl.h"            // for Layer::Release, etc
 #include "nsLayoutUtils.h"              // for nsLayoutUtils
 #include "nsMathUtils.h"                // for NS_round
@@ -229,22 +229,22 @@ LayerTransactionParent::RecvUpdate(const
     layer_manager()->BeginTransaction();
   }
 
   for (EditArray::index_type i = 0; i < cset.Length(); ++i) {
     const Edit& edit = cset[i];
 
     switch (edit.type()) {
     // Create* ops
-    case Edit::TOpCreateThebesLayer: {
-      MOZ_LAYERS_LOG(("[ParentSide] CreateThebesLayer"));
+    case Edit::TOpCreatePaintedLayer: {
+      MOZ_LAYERS_LOG(("[ParentSide] CreatePaintedLayer"));
 
-      nsRefPtr<ThebesLayerComposite> layer =
-        layer_manager()->CreateThebesLayerComposite();
-      AsLayerComposite(edit.get_OpCreateThebesLayer())->Bind(layer);
+      nsRefPtr<PaintedLayerComposite> layer =
+        layer_manager()->CreatePaintedLayerComposite();
+      AsLayerComposite(edit.get_OpCreatePaintedLayer())->Bind(layer);
       break;
     }
     case Edit::TOpCreateContainerLayer: {
       MOZ_LAYERS_LOG(("[ParentSide] CreateContainerLayer"));
 
       nsRefPtr<ContainerLayer> layer = layer_manager()->CreateContainerLayerComposite();
       AsLayerComposite(edit.get_OpCreateContainerLayer())->Bind(layer);
       break;
@@ -324,27 +324,27 @@ LayerTransactionParent::RecvUpdate(const
       layer->SetFrameMetrics(common.metrics());
 
       typedef SpecificLayerAttributes Specific;
       const SpecificLayerAttributes& specific = attrs.specific();
       switch (specific.type()) {
       case Specific::Tnull_t:
         break;
 
-      case Specific::TThebesLayerAttributes: {
-        MOZ_LAYERS_LOG(("[ParentSide]   thebes layer"));
+      case Specific::TPaintedLayerAttributes: {
+        MOZ_LAYERS_LOG(("[ParentSide]   painted layer"));
 
-        ThebesLayerComposite* thebesLayer = layerParent->AsThebesLayerComposite();
-        if (!thebesLayer) {
+        PaintedLayerComposite* paintedLayer = layerParent->AsPaintedLayerComposite();
+        if (!paintedLayer) {
           return false;
         }
-        const ThebesLayerAttributes& attrs =
-          specific.get_ThebesLayerAttributes();
+        const PaintedLayerAttributes& attrs =
+          specific.get_PaintedLayerAttributes();
 
-        thebesLayer->SetValidRegion(attrs.validRegion());
+        paintedLayer->SetValidRegion(attrs.validRegion());
 
         break;
       }
       case Specific::TContainerLayerAttributes: {
         MOZ_LAYERS_LOG(("[ParentSide]   container layer"));
 
         ContainerLayerComposite* containerLayer = layerParent->AsContainerLayerComposite();
         if (!containerLayer) {
--- a/gfx/layers/ipc/LayersMessages.ipdlh
+++ b/gfx/layers/ipc/LayersMessages.ipdlh
@@ -49,17 +49,17 @@ namespace layers {
 struct TargetConfig {
   nsIntRect naturalBounds;
   ScreenRotation rotation;
   ScreenOrientation orientation;
   nsIntRegion clearRegion;
 };
 
 // Create a shadow layer for |layer|
-struct OpCreateThebesLayer     { PLayer layer; };
+struct OpCreatePaintedLayer     { PLayer layer; };
 struct OpCreateContainerLayer  { PLayer layer; };
 struct OpCreateImageLayer      { PLayer layer; };
 struct OpCreateColorLayer      { PLayer layer; };
 struct OpCreateCanvasLayer     { PLayer layer; };
 struct OpCreateRefLayer        { PLayer layer; };
 
 struct OpAttachCompositable {
   PLayer layer;
@@ -214,33 +214,33 @@ struct CommonLayerAttributes {
   nullable PLayer maskLayer;
   // Animated colors will only honored for ColorLayers.
   Animation[] animations;
   nsIntRegion invalidRegion;
   FrameMetrics[] metrics;
   string contentDescription;
 };
 
-struct ThebesLayerAttributes {
+struct PaintedLayerAttributes {
   nsIntRegion validRegion;
 };
 struct ContainerLayerAttributes {
   float preXScale;
   float preYScale;
   float inheritedXScale;
   float inheritedYScale;
 };
 struct ColorLayerAttributes     { LayerColor color; nsIntRect bounds; };
 struct CanvasLayerAttributes    { GraphicsFilterType filter; nsIntRect bounds; };
 struct RefLayerAttributes       { int64_t id; };
 struct ImageLayerAttributes     { GraphicsFilterType filter; IntSize scaleToSize; ScaleMode scaleMode; };
 
 union SpecificLayerAttributes {
   null_t;
-  ThebesLayerAttributes;
+  PaintedLayerAttributes;
   ContainerLayerAttributes;
   ColorLayerAttributes;
   CanvasLayerAttributes;
   RefLayerAttributes;
   ImageLayerAttributes;
 };
 
 struct LayerAttributes {
@@ -425,17 +425,17 @@ union CompositableOperation {
   OpUpdateTexture;
   OpUseTexture;
   OpUseComponentAlphaTextures;
   OpUseOverlaySource;
 };
 
 // A unit of a changeset; a set of these comprise a changeset
 union Edit {
-  OpCreateThebesLayer;
+  OpCreatePaintedLayer;
   OpCreateContainerLayer;
   OpCreateImageLayer;
   OpCreateColorLayer;
   OpCreateCanvasLayer;
   OpCreateRefLayer;
 
   OpSetLayerAttributes;
   OpSetDiagnosticTypes;
--- a/gfx/layers/ipc/ShadowLayerParent.cpp
+++ b/gfx/layers/ipc/ShadowLayerParent.cpp
@@ -5,17 +5,17 @@
  * 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/. */
 
 #include "ShadowLayerParent.h"
 #include "Layers.h"                     // for Layer, ContainerLayer
 #include "nsDebug.h"                    // for NS_RUNTIMEABORT
 #include "nsISupportsImpl.h"            // for Layer::AddRef, etc
 
-#include "mozilla/layers/ThebesLayerComposite.h"
+#include "mozilla/layers/PaintedLayerComposite.h"
 #include "mozilla/layers/CanvasLayerComposite.h"
 #include "mozilla/layers/ColorLayerComposite.h"
 #include "mozilla/layers/ImageLayerComposite.h"
 #include "mozilla/layers/ContainerLayerComposite.h"
 
 namespace mozilla {
 namespace layers {
 
@@ -80,21 +80,21 @@ ShadowLayerParent::AsImageLayerComposite
 RefLayerComposite*
 ShadowLayerParent::AsRefLayerComposite() const
 {
   return mLayer && mLayer->GetType() == Layer::TYPE_REF
          ? static_cast<RefLayerComposite*>(mLayer.get())
          : nullptr;
 }
 
-ThebesLayerComposite*
-ShadowLayerParent::AsThebesLayerComposite() const
+PaintedLayerComposite*
+ShadowLayerParent::AsPaintedLayerComposite() const
 {
   return mLayer && mLayer->GetType() == Layer::TYPE_THEBES
-         ? static_cast<ThebesLayerComposite*>(mLayer.get())
+         ? static_cast<PaintedLayerComposite*>(mLayer.get())
          : nullptr;
 }
 
 void
 ShadowLayerParent::ActorDestroy(ActorDestroyReason why)
 {
   switch (why) {
   case AncestorDeletion:
--- a/gfx/layers/ipc/ShadowLayerParent.h
+++ b/gfx/layers/ipc/ShadowLayerParent.h
@@ -20,17 +20,17 @@ class ContainerLayer;
 class Layer;
 class LayerManager;
 
 class CanvasLayerComposite;
 class ColorLayerComposite;
 class ContainerLayerComposite;
 class ImageLayerComposite;
 class RefLayerComposite;
-class ThebesLayerComposite;
+class PaintedLayerComposite;
 
 class ShadowLayerParent : public PLayerParent
 {
 public:
   ShadowLayerParent();
 
   virtual ~ShadowLayerParent();
 
@@ -39,17 +39,17 @@ public:
 
   Layer* AsLayer() const { return mLayer; }
 
   ContainerLayerComposite* AsContainerLayerComposite() const;
   CanvasLayerComposite* AsCanvasLayerComposite() const;
   ColorLayerComposite* AsColorLayerComposite() const;
   ImageLayerComposite* AsImageLayerComposite() const;
   RefLayerComposite* AsRefLayerComposite() const;
-  ThebesLayerComposite* AsThebesLayerComposite() const;
+  PaintedLayerComposite* AsPaintedLayerComposite() const;
 
 private:
   virtual void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE;
 
   nsRefPtr<Layer> mLayer;
 };
 
 } // namespace layers
--- a/gfx/layers/ipc/ShadowLayers.cpp
+++ b/gfx/layers/ipc/ShadowLayers.cpp
@@ -200,19 +200,19 @@ Shadow(ShadowableLayer* aLayer)
 template<typename OpCreateT>
 static void
 CreatedLayer(Transaction* aTxn, ShadowableLayer* aLayer)
 {
   aTxn->AddEdit(OpCreateT(nullptr, Shadow(aLayer)));
 }
 
 void
-ShadowLayerForwarder::CreatedThebesLayer(ShadowableLayer* aThebes)
+ShadowLayerForwarder::CreatedPaintedLayer(ShadowableLayer* aThebes)
 {
-  CreatedLayer<OpCreateThebesLayer>(mTxn, aThebes);
+  CreatedLayer<OpCreatePaintedLayer>(mTxn, aThebes);
 }
 void
 ShadowLayerForwarder::CreatedContainerLayer(ShadowableLayer* aContainer)
 {
   CreatedLayer<OpCreateContainerLayer>(mTxn, aContainer);
 }
 void
 ShadowLayerForwarder::CreatedImageLayer(ShadowableLayer* aImage)
--- a/gfx/layers/ipc/ShadowLayers.h
+++ b/gfx/layers/ipc/ShadowLayers.h
@@ -45,17 +45,17 @@ class PLayerChild;
 class PLayerTransactionChild;
 class PLayerTransactionParent;
 class LayerTransactionChild;
 class RefLayerComposite;
 class ShadowableLayer;
 class ShmemTextureClient;
 class SurfaceDescriptor;
 class TextureClient;
-class ThebesLayerComposite;
+class PaintedLayerComposite;
 class ThebesBuffer;
 class ThebesBufferData;
 class TiledLayerComposer;
 class Transaction;
 
 
 /**
  * We want to share layer trees across thread contexts and address
@@ -184,17 +184,17 @@ public:
    * interface in Layers.h.
    */
 
   /**
    * Notify the shadow manager that a new, "real" layer has been
    * created, and a corresponding shadow layer should be created in
    * the compositing process.
    */
-  void CreatedThebesLayer(ShadowableLayer* aThebes);
+  void CreatedPaintedLayer(ShadowableLayer* aThebes);
   void CreatedContainerLayer(ShadowableLayer* aContainer);
   void CreatedImageLayer(ShadowableLayer* aImage);
   void CreatedColorLayer(ShadowableLayer* aColor);
   void CreatedCanvasLayer(ShadowableLayer* aCanvas);
   void CreatedRefLayer(ShadowableLayer* aRef);
 
   /**
    * At least one attribute of |aMutant| has changed, and |aMutant|
--- a/gfx/layers/moz.build
+++ b/gfx/layers/moz.build
@@ -4,22 +4,22 @@
 # 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/.
 
 EXPORTS += [
     'basic/BasicCanvasLayer.h',
     'basic/BasicImplData.h',
     'basic/BasicLayers.h',
     'basic/BasicLayersImpl.h',
-    'basic/BasicThebesLayer.h',
+    'basic/BasicPaintedLayer.h',
     'client/ClientCanvasLayer.h',
     'client/ClientContainerLayer.h',
     'client/ClientLayerManager.h',
-    'client/ClientThebesLayer.h',
-    'client/ClientTiledThebesLayer.h',
+    'client/ClientPaintedLayer.h',
+    'client/ClientTiledPaintedLayer.h',
     'composite/CompositableHost.h',
     'composite/ImageHost.h',
     'CopyableCanvasLayer.h',
     'D3D9SurfaceImage.h',
     'FrameMetrics.h',
     'GLImages.h',
     'GrallocImages.h',
     'ImageContainer.h',
@@ -60,18 +60,18 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'wind
             'd3d9/TextureD3D9.h',
         ]
         UNIFIED_SOURCES += [
             'd3d9/CanvasLayerD3D9.cpp',
             'd3d9/ColorLayerD3D9.cpp',
             'd3d9/ContainerLayerD3D9.cpp',
             'd3d9/ImageLayerD3D9.cpp',
             'd3d9/LayerManagerD3D9.cpp',
+            'd3d9/PaintedLayerD3D9.cpp',
             'd3d9/TextureD3D9.cpp',
-            'd3d9/ThebesLayerD3D9.cpp',
         ]
         SOURCES += [
             'd3d9/CompositorD3D9.cpp',
             'd3d9/DeviceManagerD3D9.cpp',
             'd3d9/Nv3DVUtils.cpp',
         ]
     if CONFIG['MOZ_ENABLE_D3D10_LAYER']:
         EXPORTS += [
@@ -85,18 +85,18 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'wind
             'ipc/ShadowLayerUtilsD3D10.h',
         ]
         UNIFIED_SOURCES += [
             'd3d10/CanvasLayerD3D10.cpp',
             'd3d10/ColorLayerD3D10.cpp',
             'd3d10/ContainerLayerD3D10.cpp',
             'd3d10/ImageLayerD3D10.cpp',
             'd3d10/LayerManagerD3D10.cpp',
+            'd3d10/PaintedLayerD3D10.cpp',
             'd3d10/ReadbackManagerD3D10.cpp',
-            'd3d10/ThebesLayerD3D10.cpp',
             'd3d11/TextureD3D11.cpp',
             'ipc/ShadowLayerUtilsD3D10.cpp',
         ]
         SOURCES += [
             'd3d11/CompositorD3D11.cpp',
             'd3d11/ReadbackManagerD3D11.cpp',
         ]         
         if CONFIG['MOZ_ENABLE_DIRECT2D1_1']:
@@ -134,18 +134,18 @@ EXPORTS.mozilla.layers += [
     'composite/AsyncCompositionManager.h',
     'composite/CanvasLayerComposite.h',
     'composite/ColorLayerComposite.h',
     'composite/ContainerLayerComposite.h',
     'composite/ContentHost.h',
     'composite/ImageHost.h',
     'composite/ImageLayerComposite.h',
     'composite/LayerManagerComposite.h',
+    'composite/PaintedLayerComposite.h',
     'composite/TextureHost.h',
-    'composite/ThebesLayerComposite.h',
     'Compositor.h',
     'CompositorTypes.h',
     'D3D9SurfaceImage.h',
     'Effects.h',
     'ImageDataSerializer.h',
     'ipc/AsyncTransactionTracker.h',
     'ipc/CompositableForwarder.h',
     'ipc/CompositableTransactionParent.h',
@@ -251,27 +251,27 @@ UNIFIED_SOURCES += [
     'AxisPhysicsMSDModel.cpp',
     'basic/BasicCanvasLayer.cpp',
     'basic/BasicColorLayer.cpp',
     'basic/BasicCompositor.cpp',
     'basic/BasicContainerLayer.cpp',
     'basic/BasicImages.cpp',
     'basic/BasicLayerManager.cpp',
     'basic/BasicLayersImpl.cpp',
-    'basic/BasicThebesLayer.cpp',
+    'basic/BasicPaintedLayer.cpp',
     'basic/TextureHostBasic.cpp',
     'BufferUnrotate.cpp',
     'client/CanvasClient.cpp',
     'client/ClientCanvasLayer.cpp',
     'client/ClientColorLayer.cpp',
     'client/ClientContainerLayer.cpp',
     'client/ClientImageLayer.cpp',
     'client/ClientLayerManager.cpp',
-    'client/ClientThebesLayer.cpp',
-    'client/ClientTiledThebesLayer.cpp',
+    'client/ClientPaintedLayer.cpp',
+    'client/ClientTiledPaintedLayer.cpp',
     'client/CompositableClient.cpp',
     'client/ContentClient.cpp',
     'client/ImageClient.cpp',
     'client/TextureClient.cpp',
     'client/TextureClientPool.cpp',
     'client/TiledContentClient.cpp',
     'composite/AsyncCompositionManager.cpp',
     'composite/CanvasLayerComposite.cpp',
@@ -280,17 +280,17 @@ UNIFIED_SOURCES += [
     'composite/ContainerLayerComposite.cpp',
     'composite/ContentHost.cpp',
     'composite/FPSCounter.cpp',
     'composite/ImageHost.cpp',
     'composite/ImageLayerComposite.cpp',
     'composite/LayerManagerComposite.cpp',
     'composite/TextRenderer.cpp',
     'composite/TextureHost.cpp',
-    'composite/ThebesLayerComposite.cpp',
+    'composite/PaintedLayerComposite.cpp',
     'composite/TiledContentHost.cpp',
     'Compositor.cpp',
     'CopyableCanvasLayer.cpp',
     'Effects.cpp',
     'ImageDataSerializer.cpp',
     'ImageLayers.cpp',
     'ipc/AsyncTransactionTracker.cpp',
     'ipc/CompositableTransactionParent.cpp',
--- a/gfx/layers/protobuf/LayerScopePacket.pb.cc
+++ b/gfx/layers/protobuf/LayerScopePacket.pb.cc
@@ -958,17 +958,17 @@ bool LayersPacket_Layer_LayerType_IsVali
       return false;
   }
 }
 
 #ifndef _MSC_VER
 const LayersPacket_Layer_LayerType LayersPacket_Layer::UnknownLayer;
 const LayersPacket_Layer_LayerType LayersPacket_Layer::LayerManager;
 const LayersPacket_Layer_LayerType LayersPacket_Layer::ContainerLayer;
-const LayersPacket_Layer_LayerType LayersPacket_Layer::ThebesLayer;
+const LayersPacket_Layer_LayerType LayersPacket_Layer::PaintedLayer;
 const LayersPacket_Layer_LayerType LayersPacket_Layer::CanvasLayer;
 const LayersPacket_Layer_LayerType LayersPacket_Layer::ImageLayer;
 const LayersPacket_Layer_LayerType LayersPacket_Layer::ColorLayer;
 const LayersPacket_Layer_LayerType LayersPacket_Layer::RefLayer;
 const LayersPacket_Layer_LayerType LayersPacket_Layer::ReadbackLayer;
 const LayersPacket_Layer_LayerType LayersPacket_Layer::LayerType_MIN;
 const LayersPacket_Layer_LayerType LayersPacket_Layer::LayerType_MAX;
 const int LayersPacket_Layer::LayerType_ARRAYSIZE;
--- a/gfx/layers/protobuf/LayerScopePacket.pb.h
+++ b/gfx/layers/protobuf/LayerScopePacket.pb.h
@@ -44,17 +44,17 @@ class LayersPacket_Layer_Region;
 class LayersPacket_Layer_Matrix;
 class LayersPacket_Layer_Shadow;
 class Packet;
 
 enum LayersPacket_Layer_LayerType {
   LayersPacket_Layer_LayerType_UnknownLayer = 0,
   LayersPacket_Layer_LayerType_LayerManager = 1,
   LayersPacket_Layer_LayerType_ContainerLayer = 2,
-  LayersPacket_Layer_LayerType_ThebesLayer = 3,
+  LayersPacket_Layer_LayerType_PaintedLayer = 3,
   LayersPacket_Layer_LayerType_CanvasLayer = 4,
   LayersPacket_Layer_LayerType_ImageLayer = 5,
   LayersPacket_Layer_LayerType_ColorLayer = 6,
   LayersPacket_Layer_LayerType_RefLayer = 7,
   LayersPacket_Layer_LayerType_ReadbackLayer = 8
 };
 bool LayersPacket_Layer_LayerType_IsValid(int value);
 const LayersPacket_Layer_LayerType LayersPacket_Layer_LayerType_LayerType_MIN = LayersPacket_Layer_LayerType_UnknownLayer;
@@ -899,17 +899,17 @@ class LayersPacket_Layer : public ::goog
   typedef LayersPacket_Layer_Region Region;
   typedef LayersPacket_Layer_Matrix Matrix;
   typedef LayersPacket_Layer_Shadow Shadow;
   
   typedef LayersPacket_Layer_LayerType LayerType;
   static const LayerType UnknownLayer = LayersPacket_Layer_LayerType_UnknownLayer;
   static const LayerType LayerManager = LayersPacket_Layer_LayerType_LayerManager;
   static const LayerType ContainerLayer = LayersPacket_Layer_LayerType_ContainerLayer;
-  static const LayerType ThebesLayer = LayersPacket_Layer_LayerType_ThebesLayer;
+  static const LayerType PaintedLayer = LayersPacket_Layer_LayerType_PaintedLayer;
   static const LayerType CanvasLayer = LayersPacket_Layer_LayerType_CanvasLayer;
   static const LayerType ImageLayer = LayersPacket_Layer_LayerType_ImageLayer;
   static const LayerType ColorLayer = LayersPacket_Layer_LayerType_ColorLayer;
   static const LayerType RefLayer = LayersPacket_Layer_LayerType_RefLayer;
   static const LayerType ReadbackLayer = LayersPacket_Layer_LayerType_ReadbackLayer;
   static inline bool LayerType_IsValid(int value) {
     return LayersPacket_Layer_LayerType_IsValid(value);
   }
--- a/gfx/layers/protobuf/LayerScopePacket.proto
+++ b/gfx/layers/protobuf/LayerScopePacket.proto
@@ -26,17 +26,17 @@ message TexturePacket {
 }
 
 message LayersPacket {
   message Layer {
     enum LayerType {
       UnknownLayer = 0;
       LayerManager = 1;
       ContainerLayer = 2;
-      ThebesLayer = 3;
+      PaintedLayer = 3;
       CanvasLayer = 4;
       ImageLayer = 5;
       ColorLayer = 6;
       RefLayer = 7;
       ReadbackLayer = 8;
     }
     enum ScrollingDirect {
       VERTICAL = 1;
--- a/gfx/tests/gtest/TestAsyncPanZoomController.cpp
+++ b/gfx/tests/gtest/TestAsyncPanZoomController.cpp
@@ -1807,17 +1807,17 @@ TEST_F(APZHitTestingTester, HitTesting2)
   EXPECT_EQ(apzcroot, hit.get());
   // transformToApzc doesn't unapply the root's own async transform
   EXPECT_EQ(Point(25, 25), transformToApzc * Point(25, 25));
   // transformToGecko unapplies the full async transform of -100 pixels, and then
   // reapplies the "D" transform of -50 leading to an overall adjustment of +50
   EXPECT_EQ(Point(25, 75), transformToGecko * Point(25, 25));
 }
 
-TEST_F(APZCTreeManagerTester, ScrollableThebesLayers) {
+TEST_F(APZCTreeManagerTester, ScrollablePaintedLayers) {
   CreateSimpleMultiLayerTree();
   ScopedLayerTreeRegistration registration(0, root, mcc);
 
   // both layers have the same scrollId
   SetScrollableFrameMetrics(layers[1], FrameMetrics::START_SCROLL_ID);
   SetScrollableFrameMetrics(layers[2], FrameMetrics::START_SCROLL_ID);
   manager->UpdatePanZoomControllerTree(nullptr, root, false, 0, 0);
 
--- a/gfx/tests/gtest/TestLayers.cpp
+++ b/gfx/tests/gtest/TestLayers.cpp
@@ -23,21 +23,21 @@ public:
   virtual void GetBackendName(nsAString& aName) {}
   virtual LayersBackend GetBackendType() { return LayersBackend::LAYERS_BASIC; }
   virtual void BeginTransaction() {}
   virtual already_AddRefed<ImageLayer> CreateImageLayer() { return nullptr; }
   virtual void SetRoot(Layer* aLayer) {}
   virtual already_AddRefed<ColorLayer> CreateColorLayer() { return nullptr; }
   virtual void BeginTransactionWithTarget(gfxContext* aTarget) {}
   virtual already_AddRefed<CanvasLayer> CreateCanvasLayer() { return nullptr; }
-  virtual void EndTransaction(DrawThebesLayerCallback aCallback,
+  virtual void EndTransaction(DrawPaintedLayerCallback aCallback,
                               void* aCallbackData,
                               EndTransactionFlags aFlags = END_DEFAULT) {}
   virtual int32_t GetMaxTextureSize() const { return 0; }
-  virtual already_AddRefed<ThebesLayer> CreateThebesLayer() { return nullptr; }
+  virtual already_AddRefed<PaintedLayer> CreatePaintedLayer() { return nullptr; }
 };
 
 class TestContainerLayer: public ContainerLayer {
 public:
   explicit TestContainerLayer(LayerManager* aManager)
     : ContainerLayer(aManager, nullptr)
   {}
 
@@ -49,24 +49,24 @@ public:
     return TYPE_CONTAINER;
   }
 
   virtual void ComputeEffectiveTransforms(const Matrix4x4& aTransformToSurface) {
     DefaultComputeEffectiveTransforms(aTransformToSurface);
   }
 };
 
-class TestThebesLayer: public ThebesLayer {
+class TestPaintedLayer: public PaintedLayer {
 public:
-  explicit TestThebesLayer(LayerManager* aManager)
-    : ThebesLayer(aManager, nullptr)
+  explicit TestPaintedLayer(LayerManager* aManager)
+    : PaintedLayer(aManager, nullptr)
   {}
 
   virtual const char* Name() const {
-    return "TestThebesLayer";
+    return "TestPaintedLayer";
   }
 
   virtual LayerType GetType() const {
     return TYPE_THEBES;
   }
 
   virtual void InvalidateRegion(const nsIntRegion& aRegion) {
     MOZ_CRASH();
@@ -102,17 +102,17 @@ TEST(Layers, Transform) {
   Matrix4x4 identity;
   ASSERT_EQ(true, identity.IsIdentity());
 
   ASSERT_EQ(identity, layer.GetTransform());
 }
 
 TEST(Layers, Type) {
   TestContainerLayer layer(nullptr);
-  ASSERT_EQ(nullptr, layer.AsThebesLayer());
+  ASSERT_EQ(nullptr, layer.AsPaintedLayer());
   ASSERT_EQ(nullptr, layer.AsRefLayer());
   ASSERT_EQ(nullptr, layer.AsColorLayer());
 }
 
 TEST(Layers, UserData) {
   TestContainerLayer* layerPtr = new TestContainerLayer(nullptr);
   TestContainerLayer& layer = *layerPtr;
 
@@ -150,17 +150,17 @@ TEST(Layers, UserData) {
 }
 
 static
 already_AddRefed<Layer> CreateLayer(char aLayerType, LayerManager* aManager) {
   nsRefPtr<Layer> layer = nullptr;
   if (aLayerType == 'c') {
     layer = new TestContainerLayer(aManager);
   } else if (aLayerType == 't') {
-    layer = new TestThebesLayer(aManager);
+    layer = new TestPaintedLayer(aManager);
   }
   return layer.forget();
 }
 
 already_AddRefed<Layer> CreateLayerTree(
     const char* aLayerTreeDescription,
     nsIntRegion* aVisibleRegions,
     const Matrix4x4* aTransforms,
@@ -237,18 +237,18 @@ TEST(Layers, LayerTree) {
   nsRefPtr<LayerManager> lm;
   nsRefPtr<Layer> root = CreateLayerTree(layerTreeSyntax, layerVisibleRegion, transforms, lm, layers);
 
   // B2G g++ doesn't like ASSERT_NE with nullptr directly. It thinks it's
   // an int.
   Layer* nullLayer = nullptr;
   ASSERT_NE(nullLayer, layers[0]->AsContainerLayer());
   ASSERT_NE(nullLayer, layers[1]->AsContainerLayer());
-  ASSERT_NE(nullLayer, layers[2]->AsThebesLayer());
-  ASSERT_NE(nullLayer, layers[3]->AsThebesLayer());
+  ASSERT_NE(nullLayer, layers[2]->AsPaintedLayer());
+  ASSERT_NE(nullLayer, layers[3]->AsPaintedLayer());
 }
 
 static void ValidateTreePointers(Layer* aLayer) {
   if (aLayer->GetNextSibling()) {
     ASSERT_EQ(aLayer, aLayer->GetNextSibling()->GetPrevSibling());
   } else if (aLayer->GetParent()) {
     ASSERT_EQ(aLayer, aLayer->GetParent()->GetLastChild());
   }
--- a/image/test/mochitest/test_animation2.html
+++ b/image/test/mochitest/test_animation2.html
@@ -15,17 +15,17 @@ https://bugzilla.mozilla.org/show_bug.cg
 <body>
 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=705580">
 Mozilla Bug 705580: Test animated GIFs that are converted to ImageLayers
 </a>
 <p id="display"></p>
 
 <div id="content">
   <!--
-  Use an opacity of almost-1 to force a ContainerLayer with opacity, and the img as the sole item in the ThebesLayer. It should then
+  Use an opacity of almost-1 to force a ContainerLayer with opacity, and the img as the sole item in the PaintedLayer. It should then
   be promoted to an ImageLayer.
   -->
   <div id="referenceDiv" style="height: 40px; width: 40px;
                                 display: none; background: #2aff00;"></div>
   <div id="animatedImage" style="opacity: 0.9999;">
     <img id="animatedGif" src="animated-gif.gif" style="display: none;">
       <div id="text-descr"></div>
   </div>
--- a/layout/base/FrameLayerBuilder.cpp
+++ b/layout/base/FrameLayerBuilder.cpp
@@ -125,17 +125,17 @@ FrameLayerBuilder::DisplayItemData::Begi
 {
   mLayer = aLayer;
   mOptLayer = nullptr;
   mInactiveManager = nullptr;
   mLayerState = aState;
   mContainerLayerGeneration = aContainerLayerGeneration;
   mUsed = true;
 
-  if (aLayer->AsThebesLayer()) {
+  if (aLayer->AsPaintedLayer()) {
     mItem = aItem;
   }
 
   if (!aItem) {
     return;
   }
 
   // We avoid adding or removing element unnecessarily
@@ -236,44 +236,44 @@ static inline MaskLayerImageCache* GetMa
   if (!gMaskLayerImageCache) {
     gMaskLayerImageCache = new MaskLayerImageCache();
   }
 
   return gMaskLayerImageCache;
 }
 
 /**
- * We keep a stack of these to represent the ThebesLayers that are
+ * We keep a stack of these to represent the PaintedLayers that are
  * currently available to have display items added to.
  * We use a stack here because as much as possible we want to
- * assign display items to existing ThebesLayers, and to the lowest
- * ThebesLayer in z-order. This reduces the number of layers and
+ * assign display items to existing PaintedLayers, and to the lowest
+ * PaintedLayer in z-order. This reduces the number of layers and
  * makes it more likely a display item will be rendered to an opaque
  * layer, giving us the best chance of getting subpixel AA.
  */
-class ThebesLayerData {
+class PaintedLayerData {
 public:
-  ThebesLayerData() :
+  PaintedLayerData() :
     mAnimatedGeometryRoot(nullptr),
     mFixedPosFrameForLayerData(nullptr),
     mReferenceFrame(nullptr),
     mLayer(nullptr),
     mIsSolidColorInVisibleRegion(false),
     mSingleItemFixedToViewport(false),
     mNeedComponentAlpha(false),
     mForceTransparentSurface(false),
     mHideAllLayersBelow(false),
     mOpaqueForAnimatedGeometryRootParent(false),
     mImage(nullptr),
     mCommonClipCount(-1),
     mNewChildLayersIndex(-1),
     mAllDrawingAbove(false)
   {}
   /**
-   * Record that an item has been added to the ThebesLayer, so we
+   * Record that an item has been added to the PaintedLayer, so we
    * need to update our regions.
    * @param aVisibleRect the area of the item that's visible
    * @param aDrawRect the area of the item that would be drawn if it
    * was completely visible
    * @param aOpaqueRect if non-null, the area of the item that's opaque.
    * We pass in a separate opaque rect because the opaque rect can be
    * bigger than the visible rect, and we want to have the biggest
    * opaque rect that we can.
@@ -285,17 +285,17 @@ public:
                   const nsIntRegion& aClippedOpaqueRegion,
                   const nsIntRect& aVisibleRect,
                   const nsIntRect& aDrawRect,
                   const DisplayItemClip& aClip);
   const nsIFrame* GetAnimatedGeometryRoot() { return mAnimatedGeometryRoot; }
 
   /**
    * Add aHitRegion, aMaybeHitRegion, and aDispatchToContentHitRegion to the
-   * hit regions for this ThebesLayer.
+   * hit regions for this PaintedLayer.
    */
   void AccumulateEventRegions(const nsRegion& aHitRegion,
                               const nsRegion& aMaybeHitRegion,
                               const nsRegion& aDispatchToContentHitRegion)
   {
     mHitRegion.Or(mHitRegion, aHitRegion);
     mMaybeHitRegion.Or(mMaybeHitRegion, aMaybeHitRegion);
     mDispatchToContentHitRegion.Or(mDispatchToContentHitRegion, aDispatchToContentHitRegion);
@@ -319,17 +319,17 @@ public:
   void AddVisibleAboveRegion(const nsIntRegion& aAbove)
   {
     if (!mAllDrawingAbove) {
       mVisibleAboveRegion.Or(mVisibleAboveRegion, aAbove);
       mVisibleAboveRegion.SimplifyOutward(8);
     }
   }
 
-  void CopyAboveRegion(ThebesLayerData* aOther)
+  void CopyAboveRegion(PaintedLayerData* aOther)
   {
     if (aOther->mAllDrawingAbove || mAllDrawingAbove) {
       SetAllDrawingAbove();
     } else {
       mVisibleAboveRegion.Or(mVisibleAboveRegion, aOther->mVisibleAboveRegion);
       mVisibleAboveRegion.Or(mVisibleAboveRegion, aOther->mVisibleRegion);
       mVisibleAboveRegion.SimplifyOutward(8);
       mDrawAboveRegion.Or(mDrawAboveRegion, aOther->mDrawAboveRegion);
@@ -401,41 +401,41 @@ public:
    */
   nsIntRegion  mDrawRegion;
   /**
    * The region of visible content in the layer that is opaque.
    * Same coordinate system as mVisibleRegion.
    */
   nsIntRegion  mOpaqueRegion;
   /**
-   * The definitely-hit region for this ThebesLayer.
+   * The definitely-hit region for this PaintedLayer.
    */
   nsRegion  mHitRegion;
   /**
-   * The maybe-hit region for this ThebesLayer.
+   * The maybe-hit region for this PaintedLayer.
    */
   nsRegion  mMaybeHitRegion;
   /**
-   * The dispatch-to-content hit region for this ThebesLayer.
+   * The dispatch-to-content hit region for this PaintedLayer.
    */
   nsRegion  mDispatchToContentHitRegion;
   /**
    * The "active scrolled root" for all content in the layer. Must
-   * be non-null; all content in a ThebesLayer must have the same
+   * be non-null; all content in a PaintedLayer must have the same
    * active scrolled root.
    */
   const nsIFrame* mAnimatedGeometryRoot;
   /**
    * If non-null, the frame from which we'll extract "fixed positioning"
    * metadata for this layer. This can be a position:fixed frame or a viewport
    * frame; the latter case is used for background-attachment:fixed content.
    */
   const nsIFrame* mFixedPosFrameForLayerData;
   const nsIFrame* mReferenceFrame;
-  ThebesLayer* mLayer;
+  PaintedLayer* mLayer;
   /**
    * If mIsSolidColorInVisibleRegion is true, this is the color of the visible
    * region.
    */
   nscolor      mSolidColor;
   /**
    * True if every pixel in mVisibleRegion will have color mSolidColor.
    */
@@ -453,24 +453,24 @@ public:
   /**
    * Set if the layer should be treated as transparent, even if its entire
    * area is covered by opaque display items. For example, this needs to
    * be set if something is going to "punch holes" in the layer by clearing
    * part of its surface.
    */
   bool mForceTransparentSurface;
   /**
-   * Set if all layers below this ThebesLayer should be hidden.
+   * Set if all layers below this PaintedLayer should be hidden.
    */
   bool mHideAllLayersBelow;
   /**
    * Set if the opaque region for this layer can be applied to the parent
    * animated geometry root of this layer's animated geometry root.
-   * We set this when a ThebesLayer's animated geometry root is a scrollframe
-   * and the ThebesLayer completely fills the displayport of the scrollframe.
+   * We set this when a PaintedLayer's animated geometry root is a scrollframe
+   * and the PaintedLayer completely fills the displayport of the scrollframe.
    */
   bool mOpaqueForAnimatedGeometryRootParent;
 
   /**
    * Stores the pointer to the nsDisplayImage if we want to
    * convert this to an ImageLayer.
    */
   nsDisplayImageContainer* mImage;
@@ -504,28 +504,28 @@ public:
   /**
    * The union of all the bounds of the display items in this layer.
    */
   nsIntRegion mBounds;
 
 private:
   /**
    * The region of visible content above the layer and below the
-   * next ThebesLayerData currently in the stack, if any. Note that not
-   * all ThebesLayers for the container are in the ThebesLayerData stack.
+   * next PaintedLayerData currently in the stack, if any. Note that not
+   * all PaintedLayers for the container are in the PaintedLayerData stack.
    * Same coordinate system as mVisibleRegion.
    * This is a conservative approximation: it contains the true region.
    */
   nsIntRegion  mVisibleAboveRegion;
   /**
    * The region containing the bounds of all display items (regardless
-   * of visibility) in the layer and below the next ThebesLayerData
+   * of visibility) in the layer and below the next PaintedLayerData
    * currently in the stack, if any.
-   * Note that not all ThebesLayers for the container are in the
-   * ThebesLayerData stack.
+   * Note that not all PaintedLayers for the container are in the
+   * PaintedLayerData stack.
    * Same coordinate system as mVisibleRegion.
    */
   nsIntRegion  mDrawAboveRegion;
   /**
    * True if mDrawAboveRegion and mVisibleAboveRegion should be treated
    * as infinite, and all display items should be considered 'above' this layer.
    */
   bool mAllDrawingAbove;
@@ -536,17 +536,17 @@ struct NewLayerEntry {
   NewLayerEntry()
     : mAnimatedGeometryRoot(nullptr)
     , mFixedPosFrameForLayerData(nullptr)
     , mLayerContentsVisibleRect(0, 0, -1, -1)
     , mHideAllLayersBelow(false)
     , mOpaqueForAnimatedGeometryRootParent(false)
     , mPropagateComponentAlphaFlattening(true)
   {}
-  // mLayer is null if the previous entry is for a ThebesLayer that hasn't
+  // mLayer is null if the previous entry is for a PaintedLayer that hasn't
   // been optimized to some other form (yet).
   nsRefPtr<Layer> mLayer;
   const nsIFrame* mAnimatedGeometryRoot;
   const nsIFrame* mFixedPosFrameForLayerData;
   // If non-null, this FrameMetrics is set to the be the first FrameMetrics
   // on the layer.
   UniquePtr<FrameMetrics> mBaseFrameMetrics;
   // The following are only used for retained layers (for occlusion
@@ -589,17 +589,17 @@ public:
                  const ContainerLayerParameters& aParameters,
                  bool aFlattenToSingleLayer) :
     mBuilder(aBuilder), mManager(aManager),
     mLayerBuilder(aLayerBuilder),
     mContainerFrame(aContainerFrame),
     mContainerLayer(aContainerLayer),
     mContainerBounds(aContainerBounds),
     mParameters(aParameters),
-    mNextFreeRecycledThebesLayer(0),
+    mNextFreeRecycledPaintedLayer(0),
     mFlattenToSingleLayer(aFlattenToSingleLayer)
   {
     nsPresContext* presContext = aContainerFrame->PresContext();
     mAppUnitsPerDevPixel = presContext->AppUnitsPerDevPixel();
     mContainerReferenceFrame =
       const_cast<nsIFrame*>(aContainerItem ? aContainerItem->ReferenceFrameForChildren() :
                                              mBuilder->FindReferenceFrameFor(mContainerFrame));
     mContainerAnimatedGeometryRoot = aContainerItem
@@ -618,18 +618,18 @@ public:
   }
 
   /**
    * This is the method that actually walks a display list and builds
    * the child layers.
    */
   void ProcessDisplayItems(nsDisplayList* aList);
   /**
-   * This finalizes all the open ThebesLayers by popping every element off
-   * mThebesLayerDataStack, then sets the children of the container layer
+   * This finalizes all the open PaintedLayers by popping every element off
+   * mPaintedLayerDataStack, then sets the children of the container layer
    * to be all the layers in mNewChildLayers in that order and removes any
    * layers as children of the container that aren't in mNewChildLayers.
    * @param aTextContentFlags if any child layer has CONTENT_COMPONENT_ALPHA,
    * set *aTextContentFlags to CONTENT_COMPONENT_ALPHA
    */
   void Finish(uint32_t *aTextContentFlags, LayerManagerData* aData,
               const nsIntRect& aContainerPixelBounds,
               nsDisplayList* aChildItems, bool& aHasComponentAlphaChildren);
@@ -689,63 +689,63 @@ public:
    * aLayerContentsVisibleRect, if non-null, is in the layer's own
    * coordinate system.
    */
   void SetOuterVisibleRegionForLayer(Layer* aLayer,
                                      const nsIntRegion& aOuterVisibleRegion,
                                      const nsIntRect* aLayerContentsVisibleRect = nullptr) const;
 
 protected:
-  friend class ThebesLayerData;
+  friend class PaintedLayerData;
 
   /**
-   * Grab the next recyclable ThebesLayer, or create one if there are no
-   * more recyclable ThebesLayers. Does any necessary invalidation of
-   * a recycled ThebesLayer, and sets up the transform on the ThebesLayer
+   * Grab the next recyclable PaintedLayer, or create one if there are no
+   * more recyclable PaintedLayers. Does any necessary invalidation of
+   * a recycled PaintedLayer, and sets up the transform on the PaintedLayer
    * to account for scrolling.
    */
-  already_AddRefed<ThebesLayer> CreateOrRecycleThebesLayer(const nsIFrame* aAnimatedGeometryRoot,
+  already_AddRefed<PaintedLayer> CreateOrRecyclePaintedLayer(const nsIFrame* aAnimatedGeometryRoot,
                                                            const nsIFrame *aReferenceFrame,
                                                            const nsPoint& aTopLeft);
   /**
    * Grab the next recyclable ColorLayer, or create one if there are no
    * more recyclable ColorLayers.
    */
-  already_AddRefed<ColorLayer> CreateOrRecycleColorLayer(ThebesLayer* aThebes);
+  already_AddRefed<ColorLayer> CreateOrRecycleColorLayer(PaintedLayer* aThebes);
   /**
    * Grab the next recyclable ImageLayer, or create one if there are no
    * more recyclable ImageLayers.
    */
-  already_AddRefed<ImageLayer> CreateOrRecycleImageLayer(ThebesLayer* aThebes);
+  already_AddRefed<ImageLayer> CreateOrRecycleImageLayer(PaintedLayer* aThebes);
   /**
    * Grab a recyclable ImageLayer for use as a mask layer for aLayer (that is a
    * mask layer which has been used for aLayer before), or create one if such
    * a layer doesn't exist.
    */
   already_AddRefed<ImageLayer> CreateOrRecycleMaskImageLayerFor(Layer* aLayer);
   /**
-   * Grabs all ThebesLayers and ColorLayers from the ContainerLayer and makes them
+   * Grabs all PaintedLayers and ColorLayers from the ContainerLayer and makes them
    * available for recycling.
    */
   void CollectOldLayers();
   /**
-   * If aItem used to belong to a ThebesLayer, invalidates the area of
-   * aItem in that layer. If aNewLayer is a ThebesLayer, invalidates the area of
+   * If aItem used to belong to a PaintedLayer, invalidates the area of
+   * aItem in that layer. If aNewLayer is a PaintedLayer, invalidates the area of
    * aItem in that layer.
    */
   void InvalidateForLayerChange(nsDisplayItem* aItem,
-                                ThebesLayer* aNewLayer);
+                                PaintedLayer* aNewLayer);
 
   /**
-   * Try to determine whether the ThebesLayer at aThebesLayerIndex
+   * Try to determine whether the PaintedLayer at aPaintedLayerIndex
    * has a single opaque color behind it, over the entire bounds of its visible
    * region.
    * If successful, return that color, otherwise return NS_RGBA(0,0,0,0).
    */
-  nscolor FindOpaqueBackgroundColorFor(int32_t aThebesLayerIndex);
+  nscolor FindOpaqueBackgroundColorFor(int32_t aPaintedLayerIndex);
   /**
    * Find the fixed-pos frame, if any, containing (or equal to)
    * aAnimatedGeometryRoot. Only return a fixed-pos frame if its viewport
    * has a displayport. Updates *aVisibleRegion to be the intersection of
    * aDrawRegion and the displayport, and updates *aIsSolidColorInVisibleRegion
    * (if non-null) to false if the visible region grows.
    * aDisplayItemFixedToViewport is true if the layer contains a single display
    * item which returned true for ShouldFixToViewport.
@@ -798,60 +798,60 @@ protected:
                                 const nsIFrame* aAnimatedGeometryRoot,
                                 const nsIFrame* aFixedPosFrame,
                                 const DisplayItemClip& aClip,
                                 nsDisplayList* aList,
                                 bool* aHideAllLayersBelow,
                                 bool* aOpaqueForAnimatedGeometryRootParent);
 
   /**
-   * Indicate that we are done adding items to the ThebesLayer at the top of
-   * mThebesLayerDataStack. Set the final visible region and opaque-content
+   * Indicate that we are done adding items to the PaintedLayer at the top of
+   * mPaintedLayerDataStack. Set the final visible region and opaque-content
    * flag, and pop it off the stack.
    */
-  void PopThebesLayerData();
+  void PopPaintedLayerData();
   /**
-   * Find the ThebesLayer to which we should assign the next display item.
-   * We scan the ThebesLayerData stack to find the topmost ThebesLayer
+   * Find the PaintedLayer to which we should assign the next display item.
+   * We scan the PaintedLayerData stack to find the topmost PaintedLayer
    * that is compatible with the display item (i.e., has the same
    * active scrolled root), and that has no content from other layers above
    * it and intersecting the aVisibleRect.
-   * Returns the layer, and also updates the ThebesLayerData. Will
-   * push a new ThebesLayerData onto the stack if no suitable existing
-   * layer is found. If we choose a ThebesLayer that's already on the
-   * ThebesLayerData stack, later elements on the stack will be popped off.
+   * Returns the layer, and also updates the PaintedLayerData. Will
+   * push a new PaintedLayerData onto the stack if no suitable existing
+   * layer is found. If we choose a PaintedLayer that's already on the
+   * PaintedLayerData stack, later elements on the stack will be popped off.
    * @param aVisibleRect the area of the next display item that's visible
    * @param aAnimatedGeometryRoot the active scrolled root for the next
    * display item
    * @param aOpaqueRect if non-null, a region of the display item that is opaque
    * @param aSolidColor if non-null, indicates that every pixel in aVisibleRect
    * will be painted with aSolidColor by the item
    * @param aShouldFixToViewport if true, aAnimatedGeometryRoot is the viewport
    * and we will be adding fixed-pos metadata for this layer because the
    * display item returned true from ShouldFixToViewport.
    */
-  ThebesLayerData* FindThebesLayerFor(nsDisplayItem* aItem,
+  PaintedLayerData* FindPaintedLayerFor(nsDisplayItem* aItem,
                                       const nsIntRect& aVisibleRect,
                                       const nsIFrame* aAnimatedGeometryRoot,
                                       const nsPoint& aTopLeft,
                                       bool aShouldFixToViewport);
-  ThebesLayerData* GetTopThebesLayerData()
+  PaintedLayerData* GetTopPaintedLayerData()
   {
-    return mThebesLayerDataStack.IsEmpty() ? nullptr
-        : mThebesLayerDataStack[mThebesLayerDataStack.Length() - 1].get();
+    return mPaintedLayerDataStack.IsEmpty() ? nullptr
+        : mPaintedLayerDataStack[mPaintedLayerDataStack.Length() - 1].get();
   }
 
   /* Build a mask layer to represent the clipping region. Will return null if
    * there is no clipping specified or a mask layer cannot be built.
    * Builds an ImageLayer for the appropriate backend; the mask is relative to
    * aLayer's visible region.
    * aLayer is the layer to be clipped.
    * aLayerVisibleRegion is the region that will be set as aLayer's visible region,
    * relative to the container reference frame
-   * aRoundedRectClipCount is used when building mask layers for ThebesLayers,
+   * aRoundedRectClipCount is used when building mask layers for PaintedLayers,
    * SetupMaskLayer will build a mask layer for only the first
    * aRoundedRectClipCount rounded rects in aClip
    */
   void SetupMaskLayer(Layer *aLayer, const DisplayItemClip& aClip,
                       const nsIntRegion& aLayerVisibleRegion,
                       uint32_t aRoundedRectClipCount = UINT32_MAX);
 
   bool ChooseAnimatedGeometryRoot(const nsDisplayList& aList,
@@ -864,36 +864,36 @@ protected:
   nsIFrame*                        mContainerReferenceFrame;
   const nsIFrame*                  mContainerAnimatedGeometryRoot;
   const nsIFrame*                  mContainerFixedPosFrame;
   ContainerLayer*                  mContainerLayer;
   nsRect                           mContainerBounds;
   DebugOnly<nsRect>                mAccumulatedChildBounds;
   ContainerLayerParameters         mParameters;
   /**
-   * The region of ThebesLayers that should be invalidated every time
+   * The region of PaintedLayers that should be invalidated every time
    * we recycle one.
    */
   nsIntRegion                      mInvalidThebesContent;
-  nsAutoTArray<nsAutoPtr<ThebesLayerData>,1>  mThebesLayerDataStack;
+  nsAutoTArray<nsAutoPtr<PaintedLayerData>,1>  mPaintedLayerDataStack;
   /**
    * We collect the list of children in here. During ProcessDisplayItems,
    * the layers in this array either have mContainerLayer as their parent,
    * or no parent.
-   * ThebesLayers have two entries in this array: the second one is used only if
-   * the ThebesLayer is optimized away to a ColorLayer or ImageLayer.
-   * It's essential that this array is only appended to, since ThebesLayerData
-   * records the index of its ThebesLayer in this array.
+   * PaintedLayers have two entries in this array: the second one is used only if
+   * the PaintedLayer is optimized away to a ColorLayer or ImageLayer.
+   * It's essential that this array is only appended to, since PaintedLayerData
+   * records the index of its PaintedLayer in this array.
    */
   typedef nsAutoTArray<NewLayerEntry,1> AutoLayersArray;
   AutoLayersArray                  mNewChildLayers;
-  nsTArray<nsRefPtr<ThebesLayer> > mRecycledThebesLayers;
+  nsTArray<nsRefPtr<PaintedLayer> > mRecycledPaintedLayers;
   nsDataHashtable<nsPtrHashKey<Layer>, nsRefPtr<ImageLayer> >
     mRecycledMaskImageLayers;
-  uint32_t                         mNextFreeRecycledThebesLayer;
+  uint32_t                         mNextFreeRecycledPaintedLayer;
   nscoord                          mAppUnitsPerDevPixel;
   bool                             mSnappingEnabled;
   bool                             mFlattenToSingleLayer;
 };
 
 class ThebesDisplayItemLayerUserData : public LayerUserData
 {
 public:
@@ -924,31 +924,31 @@ public:
   float mXScale, mYScale;
 
   /**
    * The appunits per dev pixel for the items in this layer.
    */
   nscoord mAppUnitsPerDevPixel;
 
   /**
-   * The offset from the ThebesLayer's 0,0 to the
+   * The offset from the PaintedLayer's 0,0 to the
    * reference frame. This isn't necessarily the same as the transform
-   * set on the ThebesLayer since we might also be applying an extra
+   * set on the PaintedLayer since we might also be applying an extra
    * offset specified by the parent ContainerLayer/
    */
   nsIntPoint mTranslation;
 
   /**
-   * We try to make 0,0 of the ThebesLayer be the top-left of the
+   * We try to make 0,0 of the PaintedLayer be the top-left of the
    * border-box of the "active scrolled root" frame (i.e. the nearest ancestor
    * frame for the display items that is being actively scrolled). But
-   * we force the ThebesLayer transform to be an integer translation, and we may
-   * have a resolution scale, so we have to snap the ThebesLayer transform, so
+   * we force the PaintedLayer transform to be an integer translation, and we may
+   * have a resolution scale, so we have to snap the PaintedLayer transform, so
    * 0,0 may not be exactly the top-left of the active scrolled root. Here we
-   * store the coordinates in ThebesLayer space of the top-left of the
+   * store the coordinates in PaintedLayer space of the top-left of the
    * active scrolled root.
    */
   gfxPoint mAnimatedGeometryRootPosition;
 
   nsIntRegion mRegionToInvalidate;
 
   // The offset between the active scrolled root of this layer
   // and the root of the container for the previous and current
@@ -989,20 +989,20 @@ struct MaskLayerUserData : public LayerU
   float mScaleX, mScaleY;
   // The ContainerLayerParameters offset which is applied to the mask's transform.
   nsIntPoint mOffset;
   int32_t mAppUnitsPerDevPixel;
 };
 
 /**
  * The address of gThebesDisplayItemLayerUserData is used as the user
- * data key for ThebesLayers created by FrameLayerBuilder.
- * It identifies ThebesLayers used to draw non-layer content, which are
+ * data key for PaintedLayers created by FrameLayerBuilder.
+ * It identifies PaintedLayers used to draw non-layer content, which are
  * therefore eligible for recycling. We want display items to be able to
- * create their own dedicated ThebesLayers in BuildLayer, if necessary,
+ * create their own dedicated PaintedLayers in BuildLayer, if necessary,
  * and we wouldn't want to accidentally recycle those.
  * The user data is a ThebesDisplayItemLayerUserData.
  */
 uint8_t gThebesDisplayItemLayerUserData;
 /**
  * The address of gColorLayerUserData is used as the user
  * data key for ColorLayers created by FrameLayerBuilder.
  * The user data is null.
@@ -1048,24 +1048,24 @@ FrameLayerBuilder::Shutdown()
   if (gMaskLayerImageCache) {
     delete gMaskLayerImageCache;
     gMaskLayerImageCache = nullptr;
   }
 }
 
 void
 FrameLayerBuilder::Init(nsDisplayListBuilder* aBuilder, LayerManager* aManager,
-                        ThebesLayerData* aLayerData)
+                        PaintedLayerData* aLayerData)
 {
   mDisplayListBuilder = aBuilder;
   mRootPresContext = aBuilder->RootReferenceFrame()->PresContext()->GetRootPresContext();
   if (mRootPresContext) {
     mInitialDOMGeneration = mRootPresContext->GetDOMGeneration();
   }
-  mContainingThebesLayer = aLayerData;
+  mContainingPaintedLayer = aLayerData;
   aManager->SetUserData(&gLayerManagerLayerBuilder, this);
 }
 
 void
 FrameLayerBuilder::FlashPaint(gfxContext *aContext)
 {
   float r = float(rand()) / RAND_MAX;
   float g = float(rand()) / RAND_MAX;
@@ -1119,56 +1119,56 @@ AppendToString(nsACString& s, const nsIn
 }
 
 /**
  * Invalidate aRegion in aLayer. aLayer is in the coordinate system
  * *after* aTranslation has been applied, so we need to
  * apply the inverse of that transform before calling InvalidateRegion.
  */
 static void
-InvalidatePostTransformRegion(ThebesLayer* aLayer, const nsIntRegion& aRegion,
+InvalidatePostTransformRegion(PaintedLayer* aLayer, const nsIntRegion& aRegion,
                               const nsIntPoint& aTranslation)
 {
   // Convert the region from the coordinates of the container layer
   // (relative to the snapped top-left of the display list reference frame)
-  // to the ThebesLayer's own coordinates
+  // to the PaintedLayer's own coordinates
   nsIntRegion rgn = aRegion;
   rgn.MoveBy(-aTranslation);
   aLayer->InvalidateRegion(rgn);
 #ifdef MOZ_DUMP_PAINTING
   if (nsLayoutUtils::InvalidationDebuggingIsEnabled()) {
     nsAutoCString str;
     AppendToString(str, rgn);
     printf_stderr("Invalidating layer %p: %s\n", aLayer, str.get());
   }
 #endif
 }
 
 static void
-InvalidatePostTransformRegion(ThebesLayer* aLayer, const nsRect& aRect,
+InvalidatePostTransformRegion(PaintedLayer* aLayer, const nsRect& aRect,
                               const DisplayItemClip& aClip,
                               const nsIntPoint& aTranslation)
 {
   ThebesDisplayItemLayerUserData* data =
       static_cast<ThebesDisplayItemLayerUserData*>(aLayer->GetUserData(&gThebesDisplayItemLayerUserData));
 
   nsRect rect = aClip.ApplyNonRoundedIntersection(aRect);
 
   nsIntRect pixelRect = rect.ScaleToOutsidePixels(data->mXScale, data->mYScale, data->mAppUnitsPerDevPixel);
   InvalidatePostTransformRegion(aLayer, pixelRect, aTranslation);
 }
 
 
 static nsIntPoint
-GetTranslationForThebesLayer(ThebesLayer* aLayer)
+GetTranslationForPaintedLayer(PaintedLayer* aLayer)
 {
   ThebesDisplayItemLayerUserData* data =
     static_cast<ThebesDisplayItemLayerUserData*>
       (aLayer->GetUserData(&gThebesDisplayItemLayerUserData));
-  NS_ASSERTION(data, "Must be a tracked thebes layer!");
+  NS_ASSERTION(data, "Must be a tracked painted layer!");
 
   return data->mTranslation;
 }
 
 /**
  * Some frames can have multiple, nested, retaining layer managers
  * associated with them (normal manager, inactive managers, SVG effects).
  * In these cases we store the 'outermost' LayerManager data property
@@ -1208,24 +1208,24 @@ FrameLayerBuilder::RemoveFrameFromLayerM
     printf_stderr("Removing frame %p - dumping display data\n", aFrame);
     rootData->Dump();
   }
 #endif
 
   for (uint32_t i = 0; i < array->Length(); ++i) {
     DisplayItemData* data = array->ElementAt(i);
 
-    ThebesLayer* t = data->mLayer->AsThebesLayer();
+    PaintedLayer* t = data->mLayer->AsPaintedLayer();
     if (t) {
       ThebesDisplayItemLayerUserData* thebesData =
           static_cast<ThebesDisplayItemLayerUserData*>(t->GetUserData(&gThebesDisplayItemLayerUserData));
       if (thebesData) {
         nsRegion old = data->mGeometry->ComputeInvalidationRegion();
         nsIntRegion rgn = old.ScaleToOutsidePixels(thebesData->mXScale, thebesData->mYScale, thebesData->mAppUnitsPerDevPixel);
-        rgn.MoveBy(-GetTranslationForThebesLayer(t));
+        rgn.MoveBy(-GetTranslationForPaintedLayer(t));
         thebesData->mRegionToInvalidate.Or(thebesData->mRegionToInvalidate, rgn);
         thebesData->mRegionToInvalidate.SimplifyOutward(8);
       }
     }
 
     data->mParent->mDisplayItems.RemoveEntry(data);
   }
 
@@ -1286,17 +1286,17 @@ FrameLayerBuilder::WillEndTransaction()
 FrameLayerBuilder::ProcessRemovedDisplayItems(nsRefPtrHashKey<DisplayItemData>* aEntry,
                                               void* aUserArg)
 {
   DisplayItemData* data = aEntry->GetKey();
   FrameLayerBuilder* layerBuilder = static_cast<FrameLayerBuilder*>(aUserArg);
   if (!data->mUsed) {
     // This item was visible, but isn't anymore.
 
-    ThebesLayer* t = data->mLayer->AsThebesLayer();
+    PaintedLayer* t = data->mLayer->AsPaintedLayer();
     if (t && data->mGeometry) {
 #ifdef MOZ_DUMP_PAINTING
       if (nsLayoutUtils::InvalidationDebuggingIsEnabled()) {
         printf_stderr("Invalidating unused display item (%i) belonging to frame %p from layer %p\n", data->mDisplayItemKey, data->mFrameList[0], t);
       }
 #endif
       InvalidatePostTransformRegion(t,
                                     data->mGeometry->ComputeInvalidationRegion(),
@@ -1483,58 +1483,58 @@ FrameLayerBuilder::GetDebugOldLayerFor(n
     if (data->mDisplayItemKey == aDisplayItemKey) {
       return data->mLayer;
     }
   }
   return nullptr;
 }
 
 already_AddRefed<ColorLayer>
-ContainerState::CreateOrRecycleColorLayer(ThebesLayer *aThebes)
+ContainerState::CreateOrRecycleColorLayer(PaintedLayer *aThebes)
 {
   ThebesDisplayItemLayerUserData* data =
       static_cast<ThebesDisplayItemLayerUserData*>(aThebes->GetUserData(&gThebesDisplayItemLayerUserData));
   nsRefPtr<ColorLayer> layer = data->mColorLayer;
   if (layer) {
     layer->SetMaskLayer(nullptr);
     layer->ClearExtraDumpInfo();
   } else {
     // Create a new layer
     layer = mManager->CreateColorLayer();
     if (!layer)
       return nullptr;
     // Mark this layer as being used for Thebes-painting display items
     data->mColorLayer = layer;
     layer->SetUserData(&gColorLayerUserData, nullptr);
 
-    // Remove other layer types we might have stored for this ThebesLayer
+    // Remove other layer types we might have stored for this PaintedLayer
     data->mImageLayer = nullptr;
   }
   return layer.forget();
 }
 
 already_AddRefed<ImageLayer>
-ContainerState::CreateOrRecycleImageLayer(ThebesLayer *aThebes)
+ContainerState::CreateOrRecycleImageLayer(PaintedLayer *aThebes)
 {
   ThebesDisplayItemLayerUserData* data =
       static_cast<ThebesDisplayItemLayerUserData*>(aThebes->GetUserData(&gThebesDisplayItemLayerUserData));
   nsRefPtr<ImageLayer> layer = data->mImageLayer;
   if (layer) {
     layer->SetMaskLayer(nullptr);
     layer->ClearExtraDumpInfo();
   } else {
     // Create a new layer
     layer = mManager->CreateImageLayer();
     if (!layer)
       return nullptr;
     // Mark this layer as being used for Thebes-painting display items
     data->mImageLayer = layer;
     layer->SetUserData(&gImageLayerUserData, nullptr);
 
-    // Remove other layer types we might have stored for this ThebesLayer
+    // Remove other layer types we might have stored for this PaintedLayer
     data->mColorLayer = nullptr;
   }
   return layer.forget();
 }
 
 already_AddRefed<ImageLayer>
 ContainerState::CreateOrRecycleMaskImageLayerFor(Layer* aLayer)
 {
@@ -1588,90 +1588,90 @@ ResetScrollPositionForLayerPixelAlignmen
 {
   nsIScrollableFrame* sf = nsLayoutUtils::GetScrollableFrameFor(aAnimatedGeometryRoot);
   if (sf) {
     sf->ResetScrollPositionForLayerPixelAlignment();
   }
 }
 
 static void
-InvalidateEntireThebesLayer(ThebesLayer* aLayer, const nsIFrame* aAnimatedGeometryRoot)
+InvalidateEntirePaintedLayer(PaintedLayer* aLayer, const nsIFrame* aAnimatedGeometryRoot)
 {
 #ifdef MOZ_DUMP_PAINTING
   if (nsLayoutUtils::InvalidationDebuggingIsEnabled()) {
     printf_stderr("Invalidating entire layer %p\n", aLayer);
   }
 #endif
   nsIntRect invalidate = aLayer->GetValidRegion().GetBounds();
   aLayer->InvalidateRegion(invalidate);
   aLayer->SetInvalidRectToVisibleRegion();
   ResetScrollPositionForLayerPixelAlignment(aAnimatedGeometryRoot);
 }
 
-already_AddRefed<ThebesLayer>
-ContainerState::CreateOrRecycleThebesLayer(const nsIFrame* aAnimatedGeometryRoot,
+already_AddRefed<PaintedLayer>
+ContainerState::CreateOrRecyclePaintedLayer(const nsIFrame* aAnimatedGeometryRoot,
                                            const nsIFrame* aReferenceFrame,
                                            const nsPoint& aTopLeft)
 {
-  // We need a new thebes layer
-  nsRefPtr<ThebesLayer> layer;
+  // We need a new painted layer
+  nsRefPtr<PaintedLayer> layer;
   ThebesDisplayItemLayerUserData* data;
   bool layerRecycled = false;
 #ifndef MOZ_WIDGET_ANDROID
   bool didResetScrollPositionForLayerPixelAlignment = false;
 #endif
 
   // Check whether the layer will be scrollable. This is used as a hint to
   // influence whether tiled layers are used or not.
-  LayerManager::ThebesLayerCreationHint creationHint = LayerManager::NONE;
+  LayerManager::PaintedLayerCreationHint creationHint = LayerManager::NONE;
   if (mParameters.mInLowPrecisionDisplayPort ) {
     creationHint = LayerManager::SCROLLABLE;
   }
   nsIFrame* animatedGeometryRootParent = aAnimatedGeometryRoot->GetParent();
   if (animatedGeometryRootParent &&
       animatedGeometryRootParent->GetType() == nsGkAtoms::scrollFrame) {
     creationHint = LayerManager::SCROLLABLE;
   }
 
-  if (mNextFreeRecycledThebesLayer < mRecycledThebesLayers.Length()) {
+  if (mNextFreeRecycledPaintedLayer < mRecycledPaintedLayers.Length()) {
     // Try to recycle a layer
-    layer = mRecycledThebesLayers[mNextFreeRecycledThebesLayer];
-    ++mNextFreeRecycledThebesLayer;
+    layer = mRecycledPaintedLayers[mNextFreeRecycledPaintedLayer];
+    ++mNextFreeRecycledPaintedLayer;
 
     // Check if the layer hint has changed and whether or not the layer should
     // be recreated because of it.
-    if (mManager->IsOptimizedFor(layer->AsThebesLayer(), creationHint)) {
+    if (mManager->IsOptimizedFor(layer->AsPaintedLayer(), creationHint)) {
       layerRecycled = true;
 
       // Clear clip rect and mask layer so we don't accidentally stay clipped.
       // We will reapply any necessary clipping.
       layer->SetMaskLayer(nullptr);
       layer->ClearExtraDumpInfo();
 
       data = static_cast<ThebesDisplayItemLayerUserData*>
           (layer->GetUserData(&gThebesDisplayItemLayerUserData));
-      NS_ASSERTION(data, "Recycled ThebesLayers must have user data");
-
-      // This gets called on recycled ThebesLayers that are going to be in the
+      NS_ASSERTION(data, "Recycled PaintedLayers must have user data");
+
+      // This gets called on recycled PaintedLayers that are going to be in the
       // final layer tree, so it's a convenient time to invalidate the
-      // content that changed where we don't know what ThebesLayer it belonged
+      // content that changed where we don't know what PaintedLayer it belonged
       // to, or if we need to invalidate the entire layer, we can do that.
-      // This needs to be done before we update the ThebesLayer to its new
+      // This needs to be done before we update the PaintedLayer to its new
       // transform. See nsGfxScrollFrame::InvalidateInternal, where
       // we ensure that mInvalidThebesContent is updated according to the
       // scroll position as of the most recent paint.
       if (!FuzzyEqual(data->mXScale, mParameters.mXScale, 0.00001f) ||
           !FuzzyEqual(data->mYScale, mParameters.mYScale, 0.00001f) ||
           data->mAppUnitsPerDevPixel != mAppUnitsPerDevPixel) {
 #ifdef MOZ_DUMP_PAINTING
       if (nsLayoutUtils::InvalidationDebuggingIsEnabled()) {
         printf_stderr("Recycled layer %p changed scale\n", layer.get());
       }
 #endif
-        InvalidateEntireThebesLayer(layer, aAnimatedGeometryRoot);
+        InvalidateEntirePaintedLayer(layer, aAnimatedGeometryRoot);
 #ifndef MOZ_WIDGET_ANDROID
         didResetScrollPositionForLayerPixelAlignment = true;
 #endif
       }
       if (!data->mRegionToInvalidate.IsEmpty()) {
 #ifdef MOZ_DUMP_PAINTING
         if (nsLayoutUtils::InvalidationDebuggingIsEnabled()) {
           printf_stderr("Invalidating deleted frame content from layer %p\n", layer.get());
@@ -1684,24 +1684,24 @@ ContainerState::CreateOrRecycleThebesLay
           AppendToString(str, data->mRegionToInvalidate);
           printf_stderr("Invalidating layer %p: %s\n", layer.get(), str.get());
         }
 #endif
         data->mRegionToInvalidate.SetEmpty();
       }
 
       // We do not need to Invalidate these areas in the widget because we
-      // assume the caller of InvalidateThebesLayerContents has ensured
+      // assume the caller of InvalidatePaintedLayerContents has ensured
       // the area is invalidated in the widget.
     }
   }
 
   if (!layerRecycled) {
-    // Create a new thebes layer
-    layer = mManager->CreateThebesLayerWithHint(creationHint);
+    // Create a new painted layer
+    layer = mManager->CreatePaintedLayerWithHint(creationHint);
     if (!layer)
       return nullptr;
     // Mark this layer as being used for Thebes-painting display items
     data = new ThebesDisplayItemLayerUserData();
     layer->SetUserData(&gThebesDisplayItemLayerUserData, data);
     ResetScrollPositionForLayerPixelAlignment(aAnimatedGeometryRoot);
 #ifndef MOZ_WIDGET_ANDROID
     didResetScrollPositionForLayerPixelAlignment = true;
@@ -1737,17 +1737,17 @@ ContainerState::CreateOrRecycleThebesLay
   // Calculate exact position of the top-left of the active scrolled root.
   // This might not be 0,0 due to the snapping in ScaleToNearestPixels.
   gfxPoint animatedGeometryRootTopLeft = scaledOffset - ThebesPoint(matrix.GetTranslation()) + mParameters.mOffset;
   // If it has changed, then we need to invalidate the entire layer since the
   // pixels in the layer buffer have the content at a (subpixel) offset
   // from what we need.
   if (!animatedGeometryRootTopLeft.WithinEpsilonOf(data->mAnimatedGeometryRootPosition, SUBPIXEL_OFFSET_EPSILON)) {
     data->mAnimatedGeometryRootPosition = animatedGeometryRootTopLeft;
-    InvalidateEntireThebesLayer(layer, aAnimatedGeometryRoot);
+    InvalidateEntirePaintedLayer(layer, aAnimatedGeometryRoot);
   } else if (didResetScrollPositionForLayerPixelAlignment) {
     data->mAnimatedGeometryRootPosition = animatedGeometryRootTopLeft;
   }
 #endif
 
   return layer.forget();
 }
 
@@ -1824,21 +1824,21 @@ ContainerState::SetOuterVisibleRegionFor
                                               const nsIntRect* aLayerContentsVisibleRect) const
 {
   nsIntRegion visRegion = aOuterVisibleRegion;
   visRegion.MoveBy(mParameters.mOffset);
   SetOuterVisibleRegion(aLayer, &visRegion, aLayerContentsVisibleRect);
 }
 
 nscolor
-ContainerState::FindOpaqueBackgroundColorFor(int32_t aThebesLayerIndex)
+ContainerState::FindOpaqueBackgroundColorFor(int32_t aPaintedLayerIndex)
 {
-  ThebesLayerData* target = mThebesLayerDataStack[aThebesLayerIndex];
-  for (int32_t i = aThebesLayerIndex - 1; i >= 0; --i) {
-    ThebesLayerData* candidate = mThebesLayerDataStack[i];
+  PaintedLayerData* target = mPaintedLayerDataStack[aPaintedLayerIndex];
+  for (int32_t i = aPaintedLayerIndex - 1; i >= 0; --i) {
+    PaintedLayerData* candidate = mPaintedLayerDataStack[i];
     if (candidate->IntersectsVisibleAboveRegion(target->mVisibleRegion)) {
       // Some non-Thebes content between target and candidate; this is
       // hopeless
       break;
     }
 
     nsIntRegion intersection;
     intersection.And(candidate->mVisibleRegion, target->mVisibleRegion);
@@ -1848,18 +1848,18 @@ ContainerState::FindOpaqueBackgroundColo
     }
 
     // The candidate intersects our target. If any layer has a solid-color
     // area behind our target, this must be it. Scan its display items.
     nsIntRect deviceRect = target->mVisibleRegion.GetBounds();
     nsRect appUnitRect = deviceRect.ToAppUnits(mAppUnitsPerDevPixel);
     appUnitRect.ScaleInverseRoundOut(mParameters.mXScale, mParameters.mYScale);
 
-    FrameLayerBuilder::ThebesLayerItemsEntry* entry =
-      mLayerBuilder->GetThebesLayerItemsEntry(candidate->mLayer);
+    FrameLayerBuilder::PaintedLayerItemsEntry* entry =
+      mLayerBuilder->GetPaintedLayerItemsEntry(candidate->mLayer);
     NS_ASSERTION(entry, "Must know about this layer!");
     for (int32_t j = entry->mItems.Length() - 1; j >= 0; --j) {
       nsDisplayItem* item = entry->mItems[j].mItem;
       bool snap;
       nsRect bounds = item->GetBounds(mBuilder, &snap);
       if (snap && mSnappingEnabled) {
         nsIntRect snappedBounds = ScaleToNearestPixels(bounds);
         if (!snappedBounds.Intersects(deviceRect))
@@ -1896,33 +1896,33 @@ ContainerState::FindOpaqueBackgroundColo
       break;
     }
     break;
   }
   return NS_RGBA(0,0,0,0);
 }
 
 void
-ThebesLayerData::UpdateCommonClipCount(
+PaintedLayerData::UpdateCommonClipCount(
     const DisplayItemClip& aCurrentClip)
 {
   if (!mLayer->Manager()->IsWidgetLayerManager()) {
     return;
   }
 
   if (mCommonClipCount >= 0) {
     mCommonClipCount = mItemClip.GetCommonRoundedRectCount(aCurrentClip, mCommonClipCount);
   } else {
     // first item in the layer
     mCommonClipCount = aCurrentClip.GetRoundedRectCount();
   }
 }
 
 already_AddRefed<ImageContainer>
-ThebesLayerData::CanOptimizeImageLayer(nsDisplayListBuilder* aBuilder)
+PaintedLayerData::CanOptimizeImageLayer(nsDisplayListBuilder* aBuilder)
 {
   if (!mImage) {
     return nullptr;
   }
 
   return mImage->GetContainer(mLayer->Manager(), aBuilder);
 }
 
@@ -2037,33 +2037,33 @@ ContainerState::SetFixedPositionLayerDat
   // The anchorRect top-left is always the viewport top-left.
   anchorRect.MoveTo(viewportFrame->GetOffsetToCrossDoc(mContainerReferenceFrame));
 
   nsLayoutUtils::SetFixedPositionLayerData(aLayer,
       viewportFrame, anchorRect, aFixedPosFrame, presContext, mParameters);
 }
 
 static bool
-CanOptimizeAwayThebesLayer(ThebesLayerData* aData,
+CanOptimizeAwayPaintedLayer(PaintedLayerData* aData,
                            FrameLayerBuilder* aLayerBuilder)
 {
   if (!aLayerBuilder->IsBuildingRetainedLayers()) {
     return false;
   }
 
-  // If there's no thebes layer with valid content in it that we can reuse,
+  // If there's no painted layer with valid content in it that we can reuse,
   // always create a color or image layer (and potentially throw away an
-  // existing completely invalid thebes layer).
+  // existing completely invalid painted layer).
   if (aData->mLayer->GetValidRegion().IsEmpty()) {
     return true;
   }
 
-  // There is an existing thebes layer we can reuse. Throwing it away can make
+  // There is an existing painted layer we can reuse. Throwing it away can make
   // compositing cheaper (see bug 946952), but it might cause us to re-allocate
-  // the thebes layer frequently due to an animation. So we only discard it if
+  // the painted layer frequently due to an animation. So we only discard it if
   // we're in tree compression mode, which is triggered at a low frequency.
   return aLayerBuilder->CheckInLayerTreeCompressionMode();
 }
 
 #ifdef DEBUG
 static int32_t FindIndexOfLayerIn(nsTArray<NewLayerEntry>& aArray,
                                   Layer* aLayer)
 {
@@ -2072,39 +2072,39 @@ static int32_t FindIndexOfLayerIn(nsTArr
       return i;
     }
   }
   return -1;
 }
 #endif
 
 void
-ContainerState::PopThebesLayerData()
+ContainerState::PopPaintedLayerData()
 {
-  NS_ASSERTION(!mThebesLayerDataStack.IsEmpty(), "Can't pop");
-
-  int32_t lastIndex = mThebesLayerDataStack.Length() - 1;
-  ThebesLayerData* data = mThebesLayerDataStack[lastIndex];
+  NS_ASSERTION(!mPaintedLayerDataStack.IsEmpty(), "Can't pop");
+
+  int32_t lastIndex = mPaintedLayerDataStack.Length() - 1;
+  PaintedLayerData* data = mPaintedLayerDataStack[lastIndex];
 
   AdjustLayerDataForFixedPositioning(data->mFixedPosFrameForLayerData,
                                      data->mDrawRegion,
                                      &data->mVisibleRegion,
                                      &data->mIsSolidColorInVisibleRegion);
 
   NewLayerEntry* newLayerEntry = &mNewChildLayers[data->mNewChildLayersIndex];
   nsRefPtr<Layer> layer;
   nsRefPtr<ImageContainer> imageContainer = data->CanOptimizeImageLayer(mBuilder);
 
   FLB_LOG_THEBES_DECISION(data, "Selecting layer for tld=%p\n", data);
   FLB_LOG_THEBES_DECISION(data, "  Solid=%i, hasImage=%i, canOptimizeAwayThebes=%i\n",
           data->mIsSolidColorInVisibleRegion, !!imageContainer,
-          CanOptimizeAwayThebesLayer(data, mLayerBuilder));
+          CanOptimizeAwayPaintedLayer(data, mLayerBuilder));
 
   if ((data->mIsSolidColorInVisibleRegion || imageContainer) &&
-      CanOptimizeAwayThebesLayer(data, mLayerBuilder)) {
+      CanOptimizeAwayPaintedLayer(data, mLayerBuilder)) {
     NS_ASSERTION(!(data->mIsSolidColorInVisibleRegion && imageContainer),
                  "Can't be a solid color as well as an image!");
     if (imageContainer) {
       nsRefPtr<ImageLayer> imageLayer = CreateOrRecycleImageLayer(data->mLayer);
       imageLayer->SetContainer(imageContainer);
       data->mImage->ConfigureLayer(imageLayer, mParameters.mOffset);
       imageLayer->SetPostScale(mParameters.mXScale,
                                mParameters.mYScale);
@@ -2123,17 +2123,17 @@ ContainerState::PopThebesLayerData()
       nsRefPtr<ColorLayer> colorLayer = CreateOrRecycleColorLayer(data->mLayer);
       colorLayer->SetColor(data->mSolidColor);
 
       // Copy transform
       colorLayer->SetBaseTransform(data->mLayer->GetBaseTransform());
       colorLayer->SetPostScale(data->mLayer->GetPostXScale(), data->mLayer->GetPostYScale());
 
       nsIntRect visibleRect = data->mVisibleRegion.GetBounds();
-      visibleRect.MoveBy(-GetTranslationForThebesLayer(data->mLayer));
+      visibleRect.MoveBy(-GetTranslationForPaintedLayer(data->mLayer));
       colorLayer->SetBounds(visibleRect);
 
       layer = colorLayer;
       FLB_LOG_THEBES_DECISION(data, "  Selected color layer=%p\n", layer.get());
     }
 
     NS_ASSERTION(FindIndexOfLayerIn(mNewChildLayers, layer) < 0,
                  "Layer already in list???");
@@ -2141,68 +2141,68 @@ ContainerState::PopThebesLayerData()
                  "Thebes layer at wrong index");
     // Store optimized layer in reserved slot
     newLayerEntry = &mNewChildLayers[data->mNewChildLayersIndex + 1];
     NS_ASSERTION(!newLayerEntry->mLayer, "Slot already occupied?");
     newLayerEntry->mLayer = layer;
     newLayerEntry->mAnimatedGeometryRoot = data->mAnimatedGeometryRoot;
     newLayerEntry->mFixedPosFrameForLayerData = data->mFixedPosFrameForLayerData;
 
-    // Hide the ThebesLayer. We leave it in the layer tree so that we
+    // Hide the PaintedLayer. We leave it in the layer tree so that we
     // can find and recycle it later.
     nsIntRect emptyRect;
     data->mLayer->SetClipRect(&emptyRect);
     data->mLayer->SetVisibleRegion(nsIntRegion());
     data->mLayer->InvalidateRegion(data->mLayer->GetValidRegion().GetBounds());
     data->mLayer->SetEventRegions(EventRegions());
   } else {
     layer = data->mLayer;
     imageContainer = nullptr;
     layer->SetClipRect(nullptr);
-    FLB_LOG_THEBES_DECISION(data, "  Selected thebes layer=%p\n", layer.get());
+    FLB_LOG_THEBES_DECISION(data, "  Selected painted layer=%p\n", layer.get());
   }
 
   if (mLayerBuilder->IsBuildingRetainedLayers()) {
     newLayerEntry->mVisibleRegion = data->mVisibleRegion;
     newLayerEntry->mOpaqueRegion = data->mOpaqueRegion;
     newLayerEntry->mHideAllLayersBelow = data->mHideAllLayersBelow;
     newLayerEntry->mOpaqueForAnimatedGeometryRootParent = data->mOpaqueForAnimatedGeometryRootParent;
   } else {
     SetOuterVisibleRegionForLayer(layer, data->mVisibleRegion);
   }
 
   nsIntRect layerBounds = data->mBounds.GetBounds();
-  layerBounds.MoveBy(-GetTranslationForThebesLayer(data->mLayer));
+  layerBounds.MoveBy(-GetTranslationForPaintedLayer(data->mLayer));
   layer->SetLayerBounds(layerBounds);
 
 #ifdef MOZ_DUMP_PAINTING
   layer->AddExtraDumpInfo(nsCString(data->mLog));
 #endif
 
   nsIntRegion transparentRegion;
   transparentRegion.Sub(data->mVisibleRegion, data->mOpaqueRegion);
   bool isOpaque = transparentRegion.IsEmpty();
-  // For translucent ThebesLayers, try to find an opaque background
+  // For translucent PaintedLayers, try to find an opaque background
   // color that covers the entire area beneath it so we can pull that
   // color into this layer to make it opaque.
   if (layer == data->mLayer) {
     nscolor backgroundColor = NS_RGBA(0,0,0,0);
     if (!isOpaque) {
       backgroundColor = FindOpaqueBackgroundColorFor(lastIndex);
       if (NS_GET_A(backgroundColor) == 255) {
         isOpaque = true;
       }
     }
 
     // Store the background color
     ThebesDisplayItemLayerUserData* userData =
       GetThebesDisplayItemLayerUserData(data->mLayer);
     NS_ASSERTION(userData, "where did our user data go?");
     if (userData->mForcedBackgroundColor != backgroundColor) {
-      // Invalidate the entire target ThebesLayer since we're changing
+      // Invalidate the entire target PaintedLayer since we're changing
       // the background color
 #ifdef MOZ_DUMP_PAINTING
       if (nsLayoutUtils::InvalidationDebuggingIsEnabled()) {
         printf_stderr("Forced background color has changed from #%08X to #%08X on layer %p\n",
                       userData->mForcedBackgroundColor, backgroundColor, data->mLayer);
         nsAutoCString str;
         AppendToString(str, data->mLayer->GetValidRegion());
         printf_stderr("Invalidating layer %p: %s\n", data->mLayer, str.get());
@@ -2213,18 +2213,18 @@ ContainerState::PopThebesLayerData()
     userData->mForcedBackgroundColor = backgroundColor;
 
     // use a mask layer for rounded rect clipping.
     // data->mCommonClipCount may be -1 if we haven't put any actual
     // drawable items in this layer (i.e. it's only catching events).
     int32_t commonClipCount = std::max(0, data->mCommonClipCount);
     SetupMaskLayer(layer, data->mItemClip, data->mVisibleRegion, commonClipCount);
     // copy commonClipCount to the entry
-    FrameLayerBuilder::ThebesLayerItemsEntry* entry = mLayerBuilder->
-      GetThebesLayerItemsEntry(static_cast<ThebesLayer*>(layer.get()));
+    FrameLayerBuilder::PaintedLayerItemsEntry* entry = mLayerBuilder->
+      GetPaintedLayerItemsEntry(static_cast<PaintedLayer*>(layer.get()));
     entry->mCommonClipCount = commonClipCount;
   } else {
     // mask layer for image and color layers
     SetupMaskLayer(layer, data->mItemClip, data->mVisibleRegion);
   }
 
   uint32_t flags = 0;
   nsIWidget* widget = mContainerReferenceFrame->PresContext()->GetRootWidget();
@@ -2237,76 +2237,76 @@ ContainerState::PopThebesLayerData()
     flags |= Layer::CONTENT_OPAQUE;
   } else if (data->mNeedComponentAlpha && !hidpi) {
     flags |= Layer::CONTENT_COMPONENT_ALPHA;
   }
   layer->SetContentFlags(flags);
 
   SetFixedPositionLayerData(layer, data->mFixedPosFrameForLayerData);
 
-  ThebesLayerData* containingThebesLayerData =
-     mLayerBuilder->GetContainingThebesLayerData();
-  if (containingThebesLayerData) {
+  PaintedLayerData* containingPaintedLayerData =
+     mLayerBuilder->GetContainingPaintedLayerData();
+  if (containingPaintedLayerData) {
     if (!data->mDispatchToContentHitRegion.GetBounds().IsEmpty()) {
       nsRect rect = nsLayoutUtils::TransformFrameRectToAncestor(
         mContainerReferenceFrame,
         data->mDispatchToContentHitRegion.GetBounds(),
-        containingThebesLayerData->mReferenceFrame);
-      containingThebesLayerData->mDispatchToContentHitRegion.Or(
-        containingThebesLayerData->mDispatchToContentHitRegion, rect);
+        containingPaintedLayerData->mReferenceFrame);
+      containingPaintedLayerData->mDispatchToContentHitRegion.Or(
+        containingPaintedLayerData->mDispatchToContentHitRegion, rect);
     }
     if (!data->mMaybeHitRegion.GetBounds().IsEmpty()) {
       nsRect rect = nsLayoutUtils::TransformFrameRectToAncestor(
         mContainerReferenceFrame,
         data->mMaybeHitRegion.GetBounds(),
-        containingThebesLayerData->mReferenceFrame);
-      containingThebesLayerData->mMaybeHitRegion.Or(
-        containingThebesLayerData->mMaybeHitRegion, rect);
+        containingPaintedLayerData->mReferenceFrame);
+      containingPaintedLayerData->mMaybeHitRegion.Or(
+        containingPaintedLayerData->mMaybeHitRegion, rect);
     }
     if (!data->mHitRegion.GetBounds().IsEmpty()) {
       // Our definitely-hit region must go to the maybe-hit-region since
       // this function is an approximation.
       Matrix4x4 matrix = nsLayoutUtils::GetTransformToAncestor(
-        mContainerReferenceFrame, containingThebesLayerData->mReferenceFrame);
+        mContainerReferenceFrame, containingPaintedLayerData->mReferenceFrame);
       Matrix matrix2D;
       bool isPrecise = matrix.Is2D(&matrix2D) && !matrix2D.HasNonAxisAlignedTransform();
       nsRect rect = nsLayoutUtils::TransformFrameRectToAncestor(
         mContainerReferenceFrame,
         data->mHitRegion.GetBounds(),
-        containingThebesLayerData->mReferenceFrame);
-      nsRegion* dest = isPrecise ? &containingThebesLayerData->mHitRegion
-                                 : &containingThebesLayerData->mMaybeHitRegion;
+        containingPaintedLayerData->mReferenceFrame);
+      nsRegion* dest = isPrecise ? &containingPaintedLayerData->mHitRegion
+                                 : &containingPaintedLayerData->mMaybeHitRegion;
       dest->Or(*dest, rect);
     }
   } else {
     EventRegions regions;
     regions.mHitRegion = ScaleRegionToOutsidePixels(data->mHitRegion);
     // Points whose hit-region status we're not sure about need to be dispatched
     // to the content thread.
     nsIntRegion maybeHitRegion = ScaleRegionToOutsidePixels(data->mMaybeHitRegion);
     regions.mDispatchToContentHitRegion.Sub(maybeHitRegion, regions.mHitRegion);
     regions.mDispatchToContentHitRegion.Or(regions.mDispatchToContentHitRegion,
                                            ScaleRegionToOutsidePixels(data->mDispatchToContentHitRegion));
 
-    nsIntPoint translation = -GetTranslationForThebesLayer(data->mLayer);
+    nsIntPoint translation = -GetTranslationForPaintedLayer(data->mLayer);
     regions.mHitRegion.MoveBy(translation);
     regions.mDispatchToContentHitRegion.MoveBy(translation);
 
     layer->SetEventRegions(regions);
   }
 
   if (lastIndex > 0) {
-    // Since we're going to pop off the last ThebesLayerData, the
+    // Since we're going to pop off the last PaintedLayerData, the
     // mVisibleAboveRegion of the second-to-last item will need to include
     // the regions of the last item.
-    ThebesLayerData* nextData = mThebesLayerDataStack[lastIndex - 1];
+    PaintedLayerData* nextData = mPaintedLayerDataStack[lastIndex - 1];
     nextData->CopyAboveRegion(data);
   }
 
-  mThebesLayerDataStack.RemoveElementAt(lastIndex);
+  mPaintedLayerDataStack.RemoveElementAt(lastIndex);
 }
 
 static bool
 IsItemAreaInWindowOpaqueRegion(nsDisplayListBuilder* aBuilder,
                                nsDisplayItem* aItem,
                                const nsRect& aComponentAlphaBounds)
 {
   if (!aItem->Frame()->PresContext()->IsChrome()) {
@@ -2319,17 +2319,17 @@ IsItemAreaInWindowOpaqueRegion(nsDisplay
     // going to assume it might have landed over a transparent part of
     // the window.
     return false;
   }
   return aBuilder->GetWindowOpaqueRegion().Contains(aComponentAlphaBounds);
 }
 
 void
-ThebesLayerData::Accumulate(ContainerState* aState,
+PaintedLayerData::Accumulate(ContainerState* aState,
                             nsDisplayItem* aItem,
                             const nsIntRegion& aClippedOpaqueRegion,
                             const nsIntRect& aVisibleRect,
                             const nsIntRect& aDrawRect,
                             const DisplayItemClip& aClip)
 {
   FLB_LOG_THEBES_DECISION(this, "Accumulating dp=%s(%p), f=%p against tld=%p\n", aItem->Name(), aItem, aItem->Frame(), this);
 
@@ -2337,27 +2337,27 @@ ThebesLayerData::Accumulate(ContainerSta
   nsRect itemBounds = aItem->GetBounds(aState->mBuilder, &snap);
   mBounds.OrWith(aState->ScaleToOutsidePixels(itemBounds, snap));
 
   if (aState->mBuilder->NeedToForceTransparentSurfaceForItem(aItem)) {
     mForceTransparentSurface = true;
   }
   if (aState->mParameters.mDisableSubpixelAntialiasingInDescendants) {
     // Disable component alpha.
-    // Note that the transform (if any) on the ThebesLayer is always an integer translation so
+    // Note that the transform (if any) on the PaintedLayer is always an integer translation so
     // we don't have to factor that in here.
     aItem->DisableComponentAlpha();
   }
 
   bool clipMatches = mItemClip == aClip;
   mItemClip = aClip;
 
   if (!mIsSolidColorInVisibleRegion && mOpaqueRegion.Contains(aDrawRect) &&
       mVisibleRegion.Contains(aVisibleRect) && !mImage) {
-    // A very common case! Most pages have a ThebesLayer with the page
+    // A very common case! Most pages have a PaintedLayer with the page
     // background (opaque) visible and most or all of the page content over the
     // top of that background.
     // The rest of this method won't do anything. mVisibleRegion, mOpaqueRegion
     // and mDrawRegion don't need updating. mVisibleRegion contains aVisibleRect
     // already, mOpaqueRegion contains aDrawRect and therefore whatever
     // the opaque region of the item is. mDrawRegion must contain mOpaqueRegion
     // and therefore aDrawRect.
     NS_ASSERTION(mDrawRegion.Contains(aDrawRect), "Draw region not covered");
@@ -2451,33 +2451,33 @@ ThebesLayerData::Accumulate(ContainerSta
         } else {
           aItem->DisableComponentAlpha();
         }
       }
     }
   }
 }
 
-ThebesLayerData*
-ContainerState::FindThebesLayerFor(nsDisplayItem* aItem,
+PaintedLayerData*
+ContainerState::FindPaintedLayerFor(nsDisplayItem* aItem,
                                    const nsIntRect& aVisibleRect,
                                    const nsIFrame* aAnimatedGeometryRoot,
                                    const nsPoint& aTopLeft,
                                    bool aShouldFixToViewport)
 {
   int32_t i;
   int32_t lowestUsableLayerWithScrolledRoot = -1;
   int32_t topmostLayerWithScrolledRoot = -1;
-  for (i = mThebesLayerDataStack.Length() - 1; i >= 0; --i) {
+  for (i = mPaintedLayerDataStack.Length() - 1; i >= 0; --i) {
     // Don't let should-fix-to-viewport items share a layer with any other items.
     if (aShouldFixToViewport) {
       ++i;
       break;
     }
-    ThebesLayerData* data = mThebesLayerDataStack[i];
+    PaintedLayerData* data = mPaintedLayerDataStack[i];
     // Give up if there is content drawn above (in z-order) this layer that
     // intersects aItem's visible region; aItem must be placed in a
     // layer above this layer.
     if (data->DrawAboveRegionIntersects(aVisibleRect)) {
       ++i;
       break;
     }
     // If the animated scrolled roots are the same and we can share this layer
@@ -2493,61 +2493,61 @@ ContainerState::FindThebesLayerFor(nsDis
     // lower layer will be usable. Do the same if the layer is subject to
     // async transforms, since we don't know where it will really be drawn.
     if (data->DrawRegionIntersects(aVisibleRect))
       break;
   }
   if (topmostLayerWithScrolledRoot < 0) {
     --i;
     for (; i >= 0; --i) {
-      ThebesLayerData* data = mThebesLayerDataStack[i];
+      PaintedLayerData* data = mPaintedLayerDataStack[i];
       if (data->mAnimatedGeometryRoot == aAnimatedGeometryRoot) {
         topmostLayerWithScrolledRoot = i;
         break;
       }
     }
   }
 
   if (topmostLayerWithScrolledRoot >= 0) {
-    while (uint32_t(topmostLayerWithScrolledRoot + 1) < mThebesLayerDataStack.Length()) {
-      PopThebesLayerData();
+    while (uint32_t(topmostLayerWithScrolledRoot + 1) < mPaintedLayerDataStack.Length()) {
+      PopPaintedLayerData();
     }
   }
 
-  ThebesLayerData* thebesLayerData = nullptr;
+  PaintedLayerData* paintedLayerData = nullptr;
   if (lowestUsableLayerWithScrolledRoot < 0) {
-    nsRefPtr<ThebesLayer> layer =
-      CreateOrRecycleThebesLayer(aAnimatedGeometryRoot, aItem->ReferenceFrame(), aTopLeft);
-
-    thebesLayerData = new ThebesLayerData();
-    mThebesLayerDataStack.AppendElement(thebesLayerData);
-    thebesLayerData->mLayer = layer;
-    thebesLayerData->mAnimatedGeometryRoot = aAnimatedGeometryRoot;
-    thebesLayerData->mFixedPosFrameForLayerData =
+    nsRefPtr<PaintedLayer> layer =
+      CreateOrRecyclePaintedLayer(aAnimatedGeometryRoot, aItem->ReferenceFrame(), aTopLeft);
+
+    paintedLayerData = new PaintedLayerData();
+    mPaintedLayerDataStack.AppendElement(paintedLayerData);
+    paintedLayerData->mLayer = layer;
+    paintedLayerData->mAnimatedGeometryRoot = aAnimatedGeometryRoot;
+    paintedLayerData->mFixedPosFrameForLayerData =
       FindFixedPosFrameForLayerData(aAnimatedGeometryRoot, aShouldFixToViewport);
-    thebesLayerData->mReferenceFrame = aItem->ReferenceFrame();
-    thebesLayerData->mSingleItemFixedToViewport = aShouldFixToViewport;
+    paintedLayerData->mReferenceFrame = aItem->ReferenceFrame();
+    paintedLayerData->mSingleItemFixedToViewport = aShouldFixToViewport;
 
     NS_ASSERTION(FindIndexOfLayerIn(mNewChildLayers, layer) < 0,
                  "Layer already in list???");
-    thebesLayerData->mNewChildLayersIndex = mNewChildLayers.Length();
+    paintedLayerData->mNewChildLayersIndex = mNewChildLayers.Length();
     NewLayerEntry* newLayerEntry = mNewChildLayers.AppendElement();
     newLayerEntry->mLayer = layer.forget();
     newLayerEntry->mAnimatedGeometryRoot = aAnimatedGeometryRoot;
-    newLayerEntry->mFixedPosFrameForLayerData = thebesLayerData->mFixedPosFrameForLayerData;
+    newLayerEntry->mFixedPosFrameForLayerData = paintedLayerData->mFixedPosFrameForLayerData;
     // newLayerEntry->mOpaqueRegion is filled in later from
-    // thebesLayerData->mOpaqueRegion, if necessary.
+    // paintedLayerData->mOpaqueRegion, if necessary.
 
     // Allocate another entry for this layer's optimization to ColorLayer/ImageLayer
     mNewChildLayers.AppendElement();
   } else {
-    thebesLayerData = mThebesLayerDataStack[lowestUsableLayerWithScrolledRoot];
+    paintedLayerData = mPaintedLayerDataStack[lowestUsableLayerWithScrolledRoot];
   }
 
-  return thebesLayerData;
+  return paintedLayerData;
 }
 
 #ifdef MOZ_DUMP_PAINTING
 static void
 DumpPaintedImage(nsDisplayItem* aItem, SourceSurface* aSurface)
 {
   nsCString string(aItem->Name());
   string.Append('-');
@@ -2560,17 +2560,17 @@ DumpPaintedImage(nsDisplayItem* aItem, S
 
 static void
 PaintInactiveLayer(nsDisplayListBuilder* aBuilder,
                    LayerManager* aManager,
                    nsDisplayItem* aItem,
                    gfxContext* aContext,
                    nsRenderingContext* aCtx)
 {
-  // This item has an inactive layer. Render it to a ThebesLayer
+  // This item has an inactive layer. Render it to a PaintedLayer
   // using a temporary BasicLayerManager.
   BasicLayerManager* basic = static_cast<BasicLayerManager*>(aManager);
   nsRefPtr<gfxContext> context = aContext;
 #ifdef MOZ_DUMP_PAINTING
   int32_t appUnitsPerDevPixel = AppUnitsPerDevPixel(aItem);
   nsIntRect itemVisibleRect =
     aItem->GetVisibleRect().ToOutsidePixels(appUnitsPerDevPixel);
 
@@ -2588,17 +2588,17 @@ PaintInactiveLayer(nsDisplayListBuilder*
   basic->SetTarget(context);
 
   if (aItem->GetType() == nsDisplayItem::TYPE_SVG_EFFECTS) {
     static_cast<nsDisplaySVGEffects*>(aItem)->PaintAsLayer(aBuilder, aCtx, basic);
     if (basic->InTransaction()) {
       basic->AbortTransaction();
     }
   } else {
-    basic->EndTransaction(FrameLayerBuilder::DrawThebesLayer, aBuilder);
+    basic->EndTransaction(FrameLayerBuilder::DrawPaintedLayer, aBuilder);
   }
   FrameLayerBuilder *builder = static_cast<FrameLayerBuilder*>(basic->GetUserData(&gLayerManagerLayerBuilder));
   if (builder) {
     builder->DidEndTransaction();
   }
 
   basic->SetTarget(nullptr);
 
@@ -2622,17 +2622,17 @@ PaintInactiveLayer(nsDisplayListBuilder*
  * when we are flattening layers.
  */
 bool
 ContainerState::ChooseAnimatedGeometryRoot(const nsDisplayList& aList,
                                            const nsIFrame **aAnimatedGeometryRoot)
 {
   for (nsDisplayItem* item = aList.GetBottom(); item; item = item->GetAbove()) {
     LayerState layerState = item->GetLayerState(mBuilder, mManager, mParameters);
-    // Don't use an item that won't be part of any ThebesLayers to pick the
+    // Don't use an item that won't be part of any PaintedLayers to pick the
     // active scrolled root.
     if (layerState == LAYER_ACTIVE_FORCE) {
       continue;
     }
 
     // Try using the actual active scrolled root of the backmost item, as that
     // should result in the least invalidation when scrolling.
     *aAnimatedGeometryRoot =
@@ -2718,25 +2718,25 @@ ContainerState::ComputeOpaqueRect(nsDisp
     }
   }
   return opaquePixels;
 }
 
 /*
  * Iterate through the non-clip items in aList and its descendants.
  * For each item we compute the effective clip rect. Each item is assigned
- * to a layer. We invalidate the areas in ThebesLayers where an item
- * has moved from one ThebesLayer to another. Also,
- * aState->mInvalidThebesContent is invalidated in every ThebesLayer.
+ * to a layer. We invalidate the areas in PaintedLayers where an item
+ * has moved from one PaintedLayer to another. Also,
+ * aState->mInvalidThebesContent is invalidated in every PaintedLayer.
  * We set the clip rect for items that generated their own layer, and
  * create a mask layer to do any rounded rect clipping.
- * (ThebesLayers don't need a clip rect on the layer, we clip the items
+ * (PaintedLayers don't need a clip rect on the layer, we clip the items
  * individually when we draw them.)
  * We set the visible rect for all layers, although the actual setting
- * of visible rects for some ThebesLayers is deferred until the calling
+ * of visible rects for some PaintedLayers is deferred until the calling
  * of ContainerState::Finish.
  */
 void
 ContainerState::ProcessDisplayItems(nsDisplayList* aList)
 {
   PROFILER_LABEL("ContainerState", "ProcessDisplayItems",
     js::ProfileEntry::Category::GRAPHICS);
 
@@ -2830,17 +2830,17 @@ ContainerState::ProcessDisplayItems(nsDi
     if (mFlattenToSingleLayer) {
       forceInactive = true;
       animatedGeometryRoot = lastAnimatedGeometryRoot;
     } else {
       forceInactive = false;
       if (mManager->IsWidgetLayerManager()) {
         animatedGeometryRoot = nsLayoutUtils::GetAnimatedGeometryRootFor(item, mBuilder, mManager);
       } else {
-        // For inactive layer subtrees, splitting content into ThebesLayers
+        // For inactive layer subtrees, splitting content into PaintedLayers
         // based on animated geometry roots is pointless. It's more efficient
         // to build the minimum number of layers.
         animatedGeometryRoot = mContainerAnimatedGeometryRoot;
       }
       if (animatedGeometryRoot != lastAnimatedGeometryRoot) {
         lastAnimatedGeometryRoot = animatedGeometryRoot;
         topLeft = animatedGeometryRoot->GetOffsetToCrossDoc(mContainerReferenceFrame);
       }
@@ -2862,25 +2862,25 @@ ContainerState::ProcessDisplayItems(nsDi
       layerCount++;
 
       // LAYER_ACTIVE_EMPTY means the layer is created just for its metadata.
       // We should never see an empty layer with any visible content!
       NS_ASSERTION(layerState != LAYER_ACTIVE_EMPTY ||
                    itemVisibleRect.IsEmpty(),
                    "State is LAYER_ACTIVE_EMPTY but visible rect is not.");
 
-      // As long as the new layer isn't going to be a ThebesLayer,
+      // As long as the new layer isn't going to be a PaintedLayer,
       // InvalidateForLayerChange doesn't need the new layer pointer.
       // We also need to check the old data now, because BuildLayer
       // can overwrite it.
       InvalidateForLayerChange(item, nullptr);
 
       // If the item would have its own layer but is invisible, just hide it.
       // Note that items without their own layers can't be skipped this
-      // way, since their ThebesLayer may decide it wants to draw them
+      // way, since their PaintedLayer may decide it wants to draw them
       // into its buffer even if they're currently covered.
       if (itemVisibleRect.IsEmpty() &&
           !item->ShouldBuildLayerEvenIfInvisible(mBuilder)) {
         continue;
       }
 
       // Just use its layer.
       // Set layerContentsVisibleRect.width/height to -1 to indicate we
@@ -2888,17 +2888,17 @@ ContainerState::ProcessDisplayItems(nsDi
       // item->BuildLayer, this will be set to a proper rect.
       nsIntRect layerContentsVisibleRect(0, 0, -1, -1);
       mParameters.mLayerContentsVisibleRect = &layerContentsVisibleRect;
       nsRefPtr<Layer> ownLayer = item->BuildLayer(mBuilder, mManager, mParameters);
       if (!ownLayer) {
         continue;
       }
 
-      NS_ASSERTION(!ownLayer->AsThebesLayer(),
+      NS_ASSERTION(!ownLayer->AsPaintedLayer(),
                    "Should never have created a dedicated Thebes layer!");
 
       const nsIFrame* fixedPosFrame =
         FindFixedPosFrameForLayerData(animatedGeometryRoot, shouldFixToViewport);
       if (fixedPosFrame) {
         nsIntRegion visibleRegion(itemVisibleRect);
         AdjustLayerDataForFixedPositioning(fixedPosFrame,
                                            nsIntRegion(itemDrawRect), &visibleRegion);
@@ -2926,17 +2926,17 @@ ContainerState::ProcessDisplayItems(nsDi
                    itemClip.GetRoundedRectCount() == 0,
                    "If we have rounded rects, we must have a clip rect");
       // It has its own layer. Update that layer's clip and visible rects.
       if (itemClip.HasClip()) {
         ownLayer->SetClipRect(&clipRect);
       } else {
         ownLayer->SetClipRect(nullptr);
       }
-      ThebesLayerData* data = GetTopThebesLayerData();
+      PaintedLayerData* data = GetTopPaintedLayerData();
       if (data) {
         // Prerendered transform items can be updated without layer building
         // (async animations or an empty transaction), so we need to put items
         // that the transform item can potentially move under into a layer
         // above this item.
         if (prerenderedTransform) {
           if (!itemClip.HasClip()) {
             // The transform item can move anywhere, treat all other content
@@ -2950,17 +2950,17 @@ ContainerState::ProcessDisplayItems(nsDi
             data->AddDrawAboveRegion(clipRect);
           }
         } else {
           data->AddVisibleAboveRegion(itemVisibleRect);
 
           // Add the entire bounds rect to the mDrawAboveRegion.
           // The visible region may be excluding opaque content above the
           // item, and we need to ensure that that content is not placed
-          // in a ThebesLayer below the item!
+          // in a PaintedLayer below the item!
           data->AddDrawAboveRegion(itemDrawRect);
         }
       }
 
       // rounded rectangle clipping using mask layers
       // (must be done after visible rect is set on layer)
       if (itemClip.IsRectClippedByRoundedCorner(itemContent)) {
         SetupMaskLayer(ownLayer, itemClip, itemVisibleRect);
@@ -3012,72 +3012,72 @@ ContainerState::ProcessDisplayItems(nsDi
                  itemType == nsDisplayItem::TYPE_ZOOM ||
                  itemType == nsDisplayItem::TYPE_RESOLUTION) {
         newLayerEntry->mBaseFrameMetrics =
           static_cast<nsDisplaySubDocument*>(item)->ComputeFrameMetrics(ownLayer, mParameters);
       }
 
       /**
        * No need to allocate geometry for items that aren't
-       * part of a ThebesLayer.
+       * part of a PaintedLayer.
        */
       mLayerBuilder->AddLayerDisplayItem(ownLayer, item,
                                          layerState,
                                          topLeft, nullptr);
     } else {
-      ThebesLayerData* thebesLayerData =
-        FindThebesLayerFor(item, itemVisibleRect, animatedGeometryRoot, topLeft,
+      PaintedLayerData* paintedLayerData =
+        FindPaintedLayerFor(item, itemVisibleRect, animatedGeometryRoot, topLeft,
                            shouldFixToViewport);
 
       if (itemType == nsDisplayItem::TYPE_LAYER_EVENT_REGIONS) {
         nsDisplayLayerEventRegions* eventRegions =
             static_cast<nsDisplayLayerEventRegions*>(item);
-        thebesLayerData->AccumulateEventRegions(eventRegions->HitRegion(),
+        paintedLayerData->AccumulateEventRegions(eventRegions->HitRegion(),
                                                 eventRegions->MaybeHitRegion(),
                                                 eventRegions->DispatchToContentHitRegion());
       } else {
         // check to see if the new item has rounded rect clips in common with
         // other items in the layer
-        thebesLayerData->UpdateCommonClipCount(itemClip);
-
-        InvalidateForLayerChange(item, thebesLayerData->mLayer);
-
-        mLayerBuilder->AddThebesDisplayItem(thebesLayerData, item, itemClip, itemVisibleRect,
+        paintedLayerData->UpdateCommonClipCount(itemClip);
+
+        InvalidateForLayerChange(item, paintedLayerData->mLayer);
+
+        mLayerBuilder->AddThebesDisplayItem(paintedLayerData, item, itemClip, itemVisibleRect,
                                             *this, layerState, topLeft);
         nsIntRegion opaquePixels = ComputeOpaqueRect(item,
-            animatedGeometryRoot, thebesLayerData->mFixedPosFrameForLayerData,
+            animatedGeometryRoot, paintedLayerData->mFixedPosFrameForLayerData,
             itemClip, aList,
-            &thebesLayerData->mHideAllLayersBelow,
-            &thebesLayerData->mOpaqueForAnimatedGeometryRootParent);
-        thebesLayerData->Accumulate(this, item, opaquePixels,
+            &paintedLayerData->mHideAllLayersBelow,
+            &paintedLayerData->mOpaqueForAnimatedGeometryRootParent);
+        paintedLayerData->Accumulate(this, item, opaquePixels,
             itemVisibleRect, itemDrawRect, itemClip);
       }
     }
 
     if (itemSameCoordinateSystemChildren &&
         itemSameCoordinateSystemChildren->NeedsTransparentSurface()) {
       aList->SetNeedsTransparentSurface();
     }
   }
 
   aList->AppendToTop(&savedItems);
 }
 
 void
-ContainerState::InvalidateForLayerChange(nsDisplayItem* aItem, ThebesLayer* aNewLayer)
+ContainerState::InvalidateForLayerChange(nsDisplayItem* aItem, PaintedLayer* aNewLayer)
 {
   NS_ASSERTION(aItem->GetPerFrameKey(),
                "Display items that render using Thebes must have a key");
   nsDisplayItemGeometry* oldGeometry = nullptr;
   DisplayItemClip* oldClip = nullptr;
   Layer* oldLayer = mLayerBuilder->GetOldLayerFor(aItem, &oldGeometry, &oldClip);
   if (aNewLayer != oldLayer && oldLayer) {
     // The item has changed layers.
     // Invalidate the old bounds in the old layer and new bounds in the new layer.
-    ThebesLayer* t = oldLayer->AsThebesLayer();
+    PaintedLayer* t = oldLayer->AsPaintedLayer();
     if (t && oldGeometry) {
       // Note that whenever the layer's scale changes, we invalidate the whole thing,
       // so it doesn't matter whether we are using the old scale at last paint
       // or a new scale here
 #ifdef MOZ_DUMP_PAINTING
       if (nsLayoutUtils::InvalidationDebuggingIsEnabled()) {
         printf_stderr("Display item type %s(%p) changed layers %p to %p!\n", aItem->Name(), aItem->Frame(), t, aNewLayer);
       }
@@ -3093,23 +3093,23 @@ ContainerState::InvalidateForLayerChange
     aItem->NotifyRenderingChanged();
   }
 }
 
 void
 FrameLayerBuilder::ComputeGeometryChangeForItem(DisplayItemData* aData)
 {
   nsDisplayItem *item = aData->mItem;
-  ThebesLayer* thebesLayer = aData->mLayer->AsThebesLayer();
-  if (!item || !thebesLayer) {
+  PaintedLayer* paintedLayer = aData->mLayer->AsPaintedLayer();
+  if (!item || !paintedLayer) {
     aData->EndUpdate();
     return;
   }
 
-  ThebesLayerItemsEntry* entry = mThebesLayerItems.GetEntry(thebesLayer);
+  PaintedLayerItemsEntry* entry = mPaintedLayerItems.GetEntry(paintedLayer);
 
   nsAutoPtr<nsDisplayItemGeometry> geometry(item->AllocateGeometry(mDisplayListBuilder));
 
   ThebesDisplayItemLayerUserData* layerData =
     static_cast<ThebesDisplayItemLayerUserData*>(aData->mLayer->GetUserData(&gThebesDisplayItemLayerUserData));
   nsPoint shift = layerData->mAnimatedGeometryRootOrigin - layerData->mLastAnimatedGeometryRootOrigin;
 
   const DisplayItemClip& clip = item->GetClip();
@@ -3185,34 +3185,34 @@ FrameLayerBuilder::ComputeGeometryChange
       }
     }
 #endif
   }
   if (!combined.IsEmpty()) {
     if (notifyRenderingChanged) {
       item->NotifyRenderingChanged();
     }
-    InvalidatePostTransformRegion(thebesLayer,
+    InvalidatePostTransformRegion(paintedLayer,
         combined.ScaleToOutsidePixels(layerData->mXScale, layerData->mYScale, layerData->mAppUnitsPerDevPixel),
         layerData->mTranslation);
   }
 
   aData->EndUpdate(geometry);
 }
 
 void
-FrameLayerBuilder::AddThebesDisplayItem(ThebesLayerData* aLayerData,
+FrameLayerBuilder::AddThebesDisplayItem(PaintedLayerData* aLayerData,
                                         nsDisplayItem* aItem,
                                         const DisplayItemClip& aClip,
                                         const nsIntRect& aItemVisibleRect,
                                         const ContainerState& aContainerState,
                                         LayerState aLayerState,
                                         const nsPoint& aTopLeft)
 {
-  ThebesLayer* layer = aLayerData->mLayer;
+  PaintedLayer* layer = aLayerData->mLayer;
   ThebesDisplayItemLayerUserData* thebesData =
     static_cast<ThebesDisplayItemLayerUserData*>
       (layer->GetUserData(&gThebesDisplayItemLayerUserData));
   nsRefPtr<BasicLayerManager> tempManager;
   nsIntRect intClip;
   bool hasClip = false;
   if (aLayerState != LAYER_NONE) {
     DisplayItemData *data = GetDisplayItemDataForManager(aItem, layer->Manager());
@@ -3235,17 +3235,17 @@ FrameLayerBuilder::AddThebesDisplayItem(
       intClip = clip.GetBounds().ScaleToOutsidePixels(thebesData->mXScale,
                                                       thebesData->mYScale,
                                                       thebesData->mAppUnitsPerDevPixel);
     }
   }
 
   AddLayerDisplayItem(layer, aItem, aLayerState, aTopLeft, tempManager);
 
-  ThebesLayerItemsEntry* entry = mThebesLayerItems.PutEntry(layer);
+  PaintedLayerItemsEntry* entry = mPaintedLayerItems.PutEntry(layer);
   if (entry) {
     entry->mContainerLayerFrame = aContainerState.GetContainerFrame();
     if (entry->mContainerLayerGeneration == 0) {
       entry->mContainerLayerGeneration = mContainerLayerGeneration;
     }
     if (tempManager) {
       FrameLayerBuilder* layerBuilder = new FrameLayerBuilder();
       layerBuilder->Init(mDisplayListBuilder, tempManager, aLayerData);
@@ -3284,17 +3284,17 @@ FrameLayerBuilder::AddThebesDisplayItem(
 #endif
         layerBuilder->StoreDataForFrame(aItem, tmpLayer, LAYER_ACTIVE);
       }
 
       tempManager->SetRoot(tmpLayer);
       layerBuilder->WillEndTransaction();
       tempManager->AbortTransaction();
 
-      nsIntPoint offset = GetLastPaintOffset(layer) - GetTranslationForThebesLayer(layer);
+      nsIntPoint offset = GetLastPaintOffset(layer) - GetTranslationForPaintedLayer(layer);
       props->MoveBy(-offset);
       nsIntRegion invalid = props->ComputeDifferences(tmpLayer, nullptr);
       if (aLayerState == LAYER_SVG_EFFECTS) {
         invalid = nsSVGIntegrationUtils::AdjustInvalidAreaForSVGEffects(aItem->Frame(),
                                                                         aItem->ToReferenceFrame(),
                                                                         invalid);
       }
       if (!invalid.IsEmpty()) {
@@ -3305,17 +3305,17 @@ FrameLayerBuilder::AddThebesDisplayItem(
 #endif
         invalid.ScaleRoundOut(thebesData->mXScale, thebesData->mYScale);
 
         if (hasClip) {
           invalid.And(invalid, intClip);
         }
 
         InvalidatePostTransformRegion(layer, invalid,
-                                      GetTranslationForThebesLayer(layer));
+                                      GetTranslationForPaintedLayer(layer));
       }
     }
     ClippedDisplayItem* cdi =
       entry->mItems.AppendElement(ClippedDisplayItem(aItem,
                                                      mContainerLayerGeneration));
     cdi->mInactiveLayerManager = tempManager;
   }
 }
@@ -3384,38 +3384,38 @@ FrameLayerBuilder::AddLayerDisplayItem(L
   if (aLayer->Manager() != mRetainingManager)
     return;
 
   DisplayItemData *data = StoreDataForFrame(aItem, aLayer, aLayerState);
   data->mInactiveManager = aManager;
 }
 
 nsIntPoint
-FrameLayerBuilder::GetLastPaintOffset(ThebesLayer* aLayer)
+FrameLayerBuilder::GetLastPaintOffset(PaintedLayer* aLayer)
 {
-  ThebesLayerItemsEntry* entry = mThebesLayerItems.PutEntry(aLayer);
+  PaintedLayerItemsEntry* entry = mPaintedLayerItems.PutEntry(aLayer);
   if (entry) {
     if (entry->mContainerLayerGeneration == 0) {
       entry->mContainerLayerGeneration = mContainerLayerGeneration;
     }
     if (entry->mHasExplicitLastPaintOffset)
       return entry->mLastPaintOffset;
   }
-  return GetTranslationForThebesLayer(aLayer);
+  return GetTranslationForPaintedLayer(aLayer);
 }
 
 void
-FrameLayerBuilder::SavePreviousDataForLayer(ThebesLayer* aLayer, uint32_t aClipCount)
+FrameLayerBuilder::SavePreviousDataForLayer(PaintedLayer* aLayer, uint32_t aClipCount)
 {
-  ThebesLayerItemsEntry* entry = mThebesLayerItems.PutEntry(aLayer);
+  PaintedLayerItemsEntry* entry = mPaintedLayerItems.PutEntry(aLayer);
   if (entry) {
     if (entry->mContainerLayerGeneration == 0) {
       entry->mContainerLayerGeneration = mContainerLayerGeneration;
     }
-    entry->mLastPaintOffset = GetTranslationForThebesLayer(aLayer);
+    entry->mLastPaintOffset = GetTranslationForPaintedLayer(aLayer);
     entry->mHasExplicitLastPaintOffset = true;
     entry->mLastCommonClipCount = aClipCount;
   }
 }
 
 bool
 FrameLayerBuilder::CheckInLayerTreeCompressionMode()
 {
@@ -3433,18 +3433,18 @@ FrameLayerBuilder::CheckInLayerTreeCompr
 void
 ContainerState::CollectOldLayers()
 {
   for (Layer* layer = mContainerLayer->GetFirstChild(); layer;
        layer = layer->GetNextSibling()) {
     NS_ASSERTION(!layer->HasUserData(&gMaskLayerUserData),
                  "Mask layer in layer tree; could not be recycled.");
     if (layer->HasUserData(&gThebesDisplayItemLayerUserData)) {
-      NS_ASSERTION(layer->AsThebesLayer(), "Wrong layer type");
-      mRecycledThebesLayers.AppendElement(static_cast<ThebesLayer*>(layer));
+      NS_ASSERTION(layer->AsPaintedLayer(), "Wrong layer type");
+      mRecycledPaintedLayers.AppendElement(static_cast<PaintedLayer*>(layer));
     }
 
     if (Layer* maskLayer = layer->GetMaskLayer()) {
       NS_ASSERTION(maskLayer->GetType() == Layer::TYPE_IMAGE,
                    "Could not recycle mask layer, unsupported layer type.");
       mRecycledMaskImageLayers.Put(layer, static_cast<ImageLayer*>(maskLayer));
     }
   }
@@ -3519,17 +3519,17 @@ ContainerState::SetupScrollingMetadata(N
       nsIntRect pixClip = ScaleToNearestPixels(clipRect);
       if (layerClip) {
         tmpClipRect.IntersectRect(pixClip, *layerClip);
       } else {
         tmpClipRect = pixClip;
       }
       layerClip = &tmpClipRect;
       // XXX this could cause IPC churn due to cliprects being updated
-      // twice during layer building --- for non-ThebesLayers that have
+      // twice during layer building --- for non-PaintedLayers that have
       // both CSS and scroll clipping.
     }
   }
   aEntry->mLayer->SetClipRect(layerClip);
   // Watch out for FrameMetrics copies in profiles
   aEntry->mLayer->SetFrameMetrics(metricsArray);
 }
 
@@ -3614,18 +3614,18 @@ ContainerState::PostprocessRetainedLayer
   }
 }
 
 void
 ContainerState::Finish(uint32_t* aTextContentFlags, LayerManagerData* aData,
                        const nsIntRect& aContainerPixelBounds,
                        nsDisplayList* aChildItems, bool& aHasComponentAlphaChildren)
 {
-  while (!mThebesLayerDataStack.IsEmpty()) {
-    PopThebesLayerData();
+  while (!mPaintedLayerDataStack.IsEmpty()) {
+    PopPaintedLayerData();
   }
 
   NS_ASSERTION(mContainerBounds.IsEqualInterior(mAccumulatedChildBounds),
                "Bounds computation mismatch");
 
   if (mLayerBuilder->IsBuildingRetainedLayers()) {
     nsIntRegion containerOpaqueRegion;
     PostprocessRetainedLayers(&containerOpaqueRegion);
@@ -3856,17 +3856,17 @@ FrameLayerBuilder::RestoreDisplayItemDat
   if (data->mUsed && data->mContainerLayerGeneration >= *generation) {
     return PL_DHASH_REMOVE;
   }
 
   return PL_DHASH_NEXT;
 }
 
 /* static */ PLDHashOperator
-FrameLayerBuilder::RestoreThebesLayerItemEntries(ThebesLayerItemsEntry* aEntry, void* aUserArg)
+FrameLayerBuilder::RestorePaintedLayerItemEntries(PaintedLayerItemsEntry* aEntry, void* aUserArg)
 {
   uint32_t *generation = static_cast<uint32_t*>(aUserArg);
 
   if (aEntry->mContainerLayerGeneration >= *generation) {
     // We can just remove these items rather than attempting to revert them
     // because we're going to want to invalidate everything when transitioning
     // to component alpha flattening.
     return PL_DHASH_REMOVE;
@@ -3917,18 +3917,18 @@ FrameLayerBuilder::BuildContainerLayerFo
       if (data) {
         oldLayer = data->mLayer;
       }
     }
 
     if (oldLayer) {
       NS_ASSERTION(oldLayer->Manager() == aManager, "Wrong manager");
       if (oldLayer->HasUserData(&gThebesDisplayItemLayerUserData)) {
-        // The old layer for this item is actually our ThebesLayer
-        // because we rendered its layer into that ThebesLayer. So we
+        // The old layer for this item is actually our PaintedLayer
+        // because we rendered its layer into that PaintedLayer. So we
         // don't actually have a retained container layer.
       } else {
         NS_ASSERTION(oldLayer->GetType() == Layer::TYPE_CONTAINER,
                      "Wrong layer type");
         containerLayer = static_cast<ContainerLayer*>(oldLayer);
         containerLayer->SetMaskLayer(nullptr);
       }
     }
@@ -3944,17 +3944,17 @@ FrameLayerBuilder::BuildContainerLayerFo
   if (state == LAYER_INACTIVE &&
       nsDisplayItem::ForceActiveLayers()) {
     state = LAYER_ACTIVE;
   }
 
   if (aContainerItem && state == LAYER_ACTIVE_EMPTY) {
     // Empty layers only have metadata and should never have display items. We
     // early exit because later, invalidation will walk up the frame tree to
-    // determine which thebes layer gets invalidated. Since an empty layer
+    // determine which painted layer gets invalidated. Since an empty layer
     // should never have anything to paint, it should never be invalidated.
     NS_ASSERTION(aChildren->IsEmpty(), "Should have no children");
     return containerLayer.forget();
   }
 
   ContainerLayerParameters scaleParameters;
   nsRect bounds = aChildren->GetBounds(aBuilder);
   nsRect childrenVisible =
@@ -3965,17 +3965,17 @@ FrameLayerBuilder::BuildContainerLayerFo
                                   aTransform, aParameters,
                                   containerLayer, state, scaleParameters)) {
     return nullptr;
   }
 
   uint32_t oldGeneration = mContainerLayerGeneration;
   mContainerLayerGeneration = ++mMaxContainerLayerGeneration;
 
-  nsRefPtr<RefCountedRegion> thebesLayerInvalidRegion = nullptr;
+  nsRefPtr<RefCountedRegion> paintedLayerInvalidRegion = nullptr;
   if (mRetainingManager) {
     if (aContainerItem) {
       StoreDataForFrame(aContainerItem, containerLayer, LAYER_ACTIVE);
     } else {
       StoreDataForFrame(aContainerFrame, containerDisplayItemKey, containerLayer, LAYER_ACTIVE);
     }
   }
 
@@ -4012,17 +4012,17 @@ FrameLayerBuilder::BuildContainerLayerFo
         !flattenToSingleLayer) {
       // Since we don't want any component alpha layers on BasicLayers, we repeat
       // the layer building process with this explicitely forced off.
       // We restore the previous FrameLayerBuilder state since the first set
       // of layer building will have changed it.
       flattenToSingleLayer = true;
       data->mDisplayItems.EnumerateEntries(RestoreDisplayItemData,
                                            &mContainerLayerGeneration);
-      mThebesLayerItems.EnumerateEntries(RestoreThebesLayerItemEntries,
+      mPaintedLayerItems.EnumerateEntries(RestorePaintedLayerItemEntries,
                                          &mContainerLayerGeneration);
       aContainerFrame->AddStateBits(NS_FRAME_NO_COMPONENT_ALPHA);
       continue;
     }
     break;
   }
 
   // CONTENT_COMPONENT_ALPHA is propogated up to the nearest CONTENT_OPAQUE
@@ -4144,17 +4144,17 @@ PredictScaleForContent(nsIFrame* aFrame,
   Matrix transform2d;
   if (transform.CanDraw2D(&transform2d)) {
      return ThebesMatrix(transform2d).ScaleFactors(true);
   }
   return gfxSize(1.0, 1.0);
 }
 
 gfxSize
-FrameLayerBuilder::GetThebesLayerScaleForFrame(nsIFrame* aFrame)
+FrameLayerBuilder::GetPaintedLayerScaleForFrame(nsIFrame* aFrame)
 {
   MOZ_ASSERT(aFrame, "need a frame");
   nsIFrame* last = nullptr;
   for (nsIFrame* f = aFrame; f; f = nsLayoutUtils::GetCrossDocParentFrame(f)) {
     last = f;
 
     if (nsLayoutUtils::IsPopup(f)) {
       // Don't examine ancestors of a popup. It won't make sense to check
@@ -4240,17 +4240,17 @@ FrameLayerBuilder::RecomputeVisibilityFo
                  NSIntPixelsToAppUnits(aOffset.y, aAppUnitsPerDevPixel));
   visible.ScaleInverseRoundOut(aXScale, aYScale);
 
   for (i = aItems.Length(); i > 0; --i) {
     ClippedDisplayItem* cdi = &aItems[i - 1];
     const DisplayItemClip& clip = cdi->mItem->GetClip();
 
     NS_ASSERTION(AppUnitsPerDevPixel(cdi->mItem) == aAppUnitsPerDevPixel,
-                 "a thebes layer should contain items only at the same zoom");
+                 "a painted layer should contain items only at the same zoom");
 
     NS_ABORT_IF_FALSE(clip.HasClip() ||
                       clip.GetRoundedRectCount() == 0,
                       "If we have rounded rects, we must have a clip rect");
 
     if (!clip.IsRectAffectedByClip(visible.GetBounds())) {
       cdi->mItem->RecomputeVisibility(aBuilder, &visible);
       continue;
@@ -4387,62 +4387,62 @@ static void DrawForcedBackgroundColor(gf
     aContext->SetColor(gfxRGBA(aBackgroundColor));
     aContext->Fill();
   }
 }
 
 /*
  * A note on residual transforms:
  *
- * In a transformed subtree we sometimes apply the ThebesLayer's
- * "residual transform" when drawing content into the ThebesLayer.
+ * In a transformed subtree we sometimes apply the PaintedLayer's
+ * "residual transform" when drawing content into the PaintedLayer.
  * This is a translation by components in the range [-0.5,0.5) provided
  * by the layer system; applying the residual transform followed by the
  * transforms used by layer compositing ensures that the subpixel alignment
- * of the content of the ThebesLayer exactly matches what it would be if
+ * of the content of the PaintedLayer exactly matches what it would be if
  * we used cairo/Thebes to draw directly to the screen without going through
  * retained layer buffers.
  *
- * The visible and valid regions of the ThebesLayer are computed without
+ * The visible and valid regions of the PaintedLayer are computed without
  * knowing the residual transform (because we don't know what the residual
  * transform is going to be until we've built the layer tree!). So we have to
  * consider whether content painted in the range [x, xmost) might be painted
  * outside the visible region we computed for that content. The visible region
  * would be [floor(x), ceil(xmost)). The content would be rendered at
  * [x + r, xmost + r), where -0.5 <= r < 0.5. So some half-rendered pixels could
  * indeed fall outside the computed visible region, which is not a big deal;
  * similar issues already arise when we snap cliprects to nearest pixels.
  * Note that if the rendering of the content is snapped to nearest pixels ---
  * which it often is --- then the content is actually rendered at
  * [snap(x + r), snap(xmost + r)). It turns out that floor(x) <= snap(x + r)
  * and ceil(xmost) >= snap(xmost + r), so the rendering of snapped content
  * always falls within the visible region we computed.
  */
 
 /* static */ void
-FrameLayerBuilder::DrawThebesLayer(ThebesLayer* aLayer,
+FrameLayerBuilder::DrawPaintedLayer(PaintedLayer* aLayer,
                                    gfxContext* aContext,
                                    const nsIntRegion& aRegionToDraw,
                                    DrawRegionClip aClip,
                                    const nsIntRegion& aRegionToInvalidate,
                                    void* aCallbackData)
 {
-  PROFILER_LABEL("FrameLayerBuilder", "DrawThebesLayer",
+  PROFILER_LABEL("FrameLayerBuilder", "DrawPaintedLayer",
     js::ProfileEntry::Category::GRAPHICS);
 
   nsDisplayListBuilder* builder = static_cast<nsDisplayListBuilder*>
     (aCallbackData);
 
   FrameLayerBuilder *layerBuilder = aLayer->Manager()->GetLayerBuilder();
   NS_ASSERTION(layerBuilder, "Unexpectedly null layer builder!");
 
   if (layerBuilder->CheckDOMModified())
     return;
 
-  ThebesLayerItemsEntry* entry = layerBuilder->mThebesLayerItems.GetEntry(aLayer);
+  PaintedLayerItemsEntry* entry = layerBuilder->mPaintedLayerItems.GetEntry(aLayer);
   NS_ASSERTION(entry, "We shouldn't be drawing into a layer with no items!");
   if (!entry->mContainerLayerFrame) {
     return;
   }
 
 
   ThebesDisplayItemLayerUserData* userData =
     static_cast<ThebesDisplayItemLayerUserData*>
@@ -4457,25 +4457,25 @@ FrameLayerBuilder::DrawThebesLayer(Thebe
     } else if (aClip == DrawRegionClip::DRAW) {
       gfxUtils::ClipToRegion(aContext, aRegionToDraw);
     }
 
     DrawForcedBackgroundColor(aContext, aLayer, userData->mForcedBackgroundColor);
   }
 
   // make the origin of the context coincide with the origin of the
-  // ThebesLayer
+  // PaintedLayer
   gfxContextMatrixAutoSaveRestore saveMatrix(aContext);
-  nsIntPoint offset = GetTranslationForThebesLayer(aLayer);
+  nsIntPoint offset = GetTranslationForPaintedLayer(aLayer);
   nsPresContext* presContext = entry->mContainerLayerFrame->PresContext();
 
-  if (!layerBuilder->GetContainingThebesLayerData()) {
-    // Recompute visibility of items in our ThebesLayer. Note that this
+  if (!layerBuilder->GetContainingPaintedLayerData()) {
+    // Recompute visibility of items in our PaintedLayer. Note that this
     // recomputes visibility for all descendants of our display items too,
-    // so there's no need to do this for the items in inactive ThebesLayers.
+    // so there's no need to do this for the items in inactive PaintedLayers.
     int32_t appUnitsPerDevPixel = presContext->AppUnitsPerDevPixel();
     RecomputeVisibilityForItems(entry->mItems, builder, aRegionToDraw,
                                 offset, appUnitsPerDevPixel,
                                 userData->mXScale, userData->mYScale);
   }
 
   nsRefPtr<nsRenderingContext> rc = new nsRenderingContext();
   rc->Init(presContext->DeviceContext(), aContext);
@@ -4593,17 +4593,17 @@ ContainerState::SetupMaskLayer(Layer *aL
                                uint32_t aRoundedRectClipCount)
 {
   // if the number of clips we are going to mask has decreased, then aLayer might have
   // cached graphics which assume the existence of a soon-to-be non-existent mask layer
   // in that case, invalidate the whole layer.
   ThebesDisplayItemLayerUserData* thebesData = GetThebesDisplayItemLayerUserData(aLayer);
   if (thebesData &&
       aRoundedRectClipCount < thebesData->mMaskClipCount) {
-    ThebesLayer* thebes = aLayer->AsThebesLayer();
+    PaintedLayer* thebes = aLayer->AsPaintedLayer();
     thebes->InvalidateRegion(thebes->GetValidRegion().GetBounds());
   }
 
   // don't build an unnecessary mask
   nsIntRect layerBounds = aLayerVisibleRegion.GetBounds();
   if (aClip.GetRoundedRectCount() == 0 ||
       aRoundedRectClipCount == 0 ||
       layerBounds.IsEmpty()) {
--- a/layout/base/FrameLayerBuilder.h
+++ b/layout/base/FrameLayerBuilder.h
@@ -22,26 +22,26 @@ class nsDisplayItem;
 class gfxContext;
 class nsDisplayItemGeometry;
 
 namespace mozilla {
 namespace layers {
 class ContainerLayer;
 class LayerManager;
 class BasicLayerManager;
-class ThebesLayer;
+class PaintedLayer;
 }
 
 namespace gfx {
 class Matrix4x4;
 }
 
 class FrameLayerBuilder;
 class LayerManagerData;
-class ThebesLayerData;
+class PaintedLayerData;
 class ContainerState;
 
 class RefCountedRegion {
 private:
   ~RefCountedRegion() {}
 public:
   NS_INLINE_DECL_REFCOUNTING(RefCountedRegion)
 
@@ -94,24 +94,24 @@ struct ContainerLayerParameters {
    */
   nsIntPoint mOffset;
 
   bool mInTransformedSubtree;
   bool mInActiveTransformedSubtree;
   bool mDisableSubpixelAntialiasingInDescendants;
   bool mInLowPrecisionDisplayPort;
   /**
-   * When this is false, ThebesLayer coordinates are drawn to with an integer
+   * When this is false, PaintedLayer coordinates are drawn to with an integer
    * translation and the scale in mXScale/mYScale.
    */
   bool AllowResidualTranslation()
   {
     // If we're in a transformed subtree, but no ancestor transform is actively
     // changing, we'll use the residual translation when drawing into the
-    // ThebesLayer to ensure that snapping exactly matches the ideal transform.
+    // PaintedLayer to ensure that snapping exactly matches the ideal transform.
     return mInTransformedSubtree && !mInActiveTransformedSubtree;
   }
 };
 
 /**
  * The FrameLayerBuilder is responsible for converting display lists 
  * into layer trees. Every LayerManager needs a unique FrameLayerBuilder
  * to build layers.
@@ -119,46 +119,46 @@ struct ContainerLayerParameters {
  * The most important API in this class is BuildContainerLayerFor. This
  * method takes a display list as input and constructs a ContainerLayer
  * with child layers that render the contents of the display list. It
  * records the relationship between frames and layers.
  * 
  * That data enables us to retain layer trees. When constructing a
  * ContainerLayer, we first check to see if there's an existing
  * ContainerLayer for the same frame that can be recycled. If we recycle
- * it, we also try to reuse its existing ThebesLayer children to render
+ * it, we also try to reuse its existing PaintedLayer children to render
  * the display items without layers of their own. The idea is that by
  * recycling layers deterministically, we can ensure that when nothing
  * changes in a display list, we will reuse the existing layers without
  * changes.
  * 
  * We expose a GetLeafLayerFor method that can be called by display items
  * that make their own layers (e.g. canvas and video); this method
  * locates the last layer used to render the display item, if any, and
  * return it as a candidate for recycling.
  * 
- * FrameLayerBuilder sets up ThebesLayers so that 0,0 in the Thebes layer
+ * FrameLayerBuilder sets up PaintedLayers so that 0,0 in the Thebes layer
  * corresponds to the (pixel-snapped) top-left of the aAnimatedGeometryRoot.
  * It sets up ContainerLayers so that 0,0 in the container layer
  * corresponds to the snapped top-left of the display item reference frame.
  *
  * When we construct a container layer, we know the transform that will be
  * applied to the layer. If the transform scales the content, we can get
  * better results when intermediate buffers are used by pushing some scale
- * from the container's transform down to the children. For ThebesLayer
+ * from the container's transform down to the children. For PaintedLayer
  * children, the scaling can be achieved by changing the size of the layer
  * and drawing into it with increased or decreased resolution. By convention,
  * integer types (nsIntPoint/nsIntSize/nsIntRect/nsIntRegion) are all in layer
  * coordinates, post-scaling, whereas appunit types are all pre-scaling.
  */
 class FrameLayerBuilder : public layers::LayerUserData {
 public:
   typedef layers::ContainerLayer ContainerLayer;
   typedef layers::Layer Layer;
-  typedef layers::ThebesLayer ThebesLayer;
+  typedef layers::PaintedLayer PaintedLayer;
   typedef layers::ImageLayer ImageLayer;
   typedef layers::LayerManager LayerManager;
   typedef layers::BasicLayerManager BasicLayerManager;
   typedef layers::EventRegions EventRegions;
 
   FrameLayerBuilder() :
     mRetainingManager(nullptr),
     mDetectedDOMModification(false),
@@ -172,17 +172,17 @@ public:
   ~FrameLayerBuilder()
   {
     MOZ_COUNT_DTOR(FrameLayerBuilder);
   }
 
   static void Shutdown();
 
   void Init(nsDisplayListBuilder* aBuilder, LayerManager* aManager,
-            ThebesLayerData* aLayerData = nullptr);
+            PaintedLayerData* aLayerData = nullptr);
 
   /**
    * Call this to notify that we have just started a transaction on the
    * retained layer manager aManager.
    */
   void DidBeginRetainedLayerTransaction(LayerManager* aManager);
 
   /**
@@ -203,17 +203,17 @@ public:
    * list, either reusing an existing one or creating a new one. It
    * sets the container layer children to layers which together render
    * the contents of the display list. It reuses existing layers from
    * the retained layer manager if possible.
    * aContainer may be null, in which case we construct a root layer.
    * This gets called by display list code. It calls BuildLayer on the
    * items in the display list, making items with their own layers
    * children of the new container, and assigning all other items to
-   * ThebesLayer children created and managed by the FrameLayerBuilder.
+   * PaintedLayer children created and managed by the FrameLayerBuilder.
    * Returns a layer with clip rect cleared; it is the
    * caller's responsibility to add any clip rect. The visible region
    * is set based on what's in the layer.
    * The container layer is transformed by aTransform (if non-null), and
    * the result is transformed by the scale factors in aContainerParameters.
    * aChildren is modified due to display item merging and flattening.
    * The visible region of the returned layer is set only if aContainerItem
    * is null.
@@ -256,17 +256,17 @@ public:
   static Layer* GetDedicatedLayer(nsIFrame* aFrame, uint32_t aDisplayItemKey);
 
   /**
    * This callback must be provided to EndTransaction. The callback data
    * must be the nsDisplayListBuilder containing this FrameLayerBuilder.
    * This function can be called multiple times in a row to draw
    * different regions.
    */
-  static void DrawThebesLayer(ThebesLayer* aLayer,
+  static void DrawPaintedLayer(PaintedLayer* aLayer,
                               gfxContext* aContext,
                               const nsIntRegion& aRegionToDraw,
                               mozilla::layers::DrawRegionClip aClip,
                               const nsIntRegion& aRegionToInvalidate,
                               void* aCallbackData);
 
 #ifdef MOZ_DUMP_PAINTING
   /**
@@ -293,23 +293,23 @@ public:
    */
   void AddLayerDisplayItem(Layer* aLayer,
                            nsDisplayItem* aItem,
                            LayerState aLayerState,
                            const nsPoint& aTopLeft,
                            BasicLayerManager* aManager);
 
   /**
-   * Record aItem as a display item that is rendered by the ThebesLayer
+   * Record aItem as a display item that is rendered by the PaintedLayer
    * aLayer, with aClipRect, where aContainerLayerFrame is the frame
    * for the container layer this ThebesItem belongs to.
    * aItem must have an underlying frame.
    * @param aTopLeft offset from active scrolled root to reference frame
    */
-  void AddThebesDisplayItem(ThebesLayerData* aLayer,
+  void AddThebesDisplayItem(PaintedLayerData* aLayer,
                             nsDisplayItem* aItem,
                             const DisplayItemClip& aClip,
                             const nsIntRect& aItemVisibleRect,
                             const ContainerState& aContainerState,
                             LayerState aLayerState,
                             const nsPoint& aTopLeft);
 
   /**
@@ -350,37 +350,37 @@ public:
 
   static void IterateRetainedDataFor(nsIFrame* aFrame, DisplayItemDataCallback aCallback);
 
   /**
    * Save transform that was in aLayer when we last painted, and the position
    * of the active scrolled root frame. It must be an integer
    * translation.
    */
-  void SavePreviousDataForLayer(ThebesLayer* aLayer, uint32_t aClipCount);
+  void SavePreviousDataForLayer(PaintedLayer* aLayer, uint32_t aClipCount);
   /**
    * Get the translation transform that was in aLayer when we last painted. It's either
    * the transform saved by SaveLastPaintTransform, or else the transform
    * that's currently in the layer (which must be an integer translation).
    */
-  nsIntPoint GetLastPaintOffset(ThebesLayer* aLayer);
+  nsIntPoint GetLastPaintOffset(PaintedLayer* aLayer);
 
   /**
    * Return the resolution at which we expect to render aFrame's contents,
    * assuming they are being painted to retained layers. This takes into account
    * the resolution the contents of the ContainerLayer containing aFrame are
    * being rendered at, as well as any currently-inactive transforms between
    * aFrame and that container layer.
    */
-  static gfxSize GetThebesLayerScaleForFrame(nsIFrame* aFrame);
+  static gfxSize GetPaintedLayerScaleForFrame(nsIFrame* aFrame);
 
   /**
    * Stores a Layer as the dedicated layer in the DisplayItemData for a given frame/key pair.
    *
-   * Used when we optimize a ThebesLayer into an ImageLayer and want to retroactively update the 
+   * Used when we optimize a PaintedLayer into an ImageLayer and want to retroactively update the 
    * DisplayItemData so we can retrieve the layer from within layout.
    */
   void StoreOptimizedLayerForFrame(nsDisplayItem* aItem, Layer* aLayer);
   
   NS_DECLARE_FRAME_PROPERTY_WITH_FRAME_IN_DTOR(LayerManagerDataProperty,
                                                RemoveFrameFromLayerManager)
 
   /**
@@ -441,17 +441,17 @@ public:
     void BeginUpdate(Layer* aLayer, LayerState aState,
                      uint32_t aContainerLayerGeneration, nsDisplayItem* aItem = nullptr);
 
     /**
      * Completes the update of this, and removes any references to data that won't live
      * longer than the transaction.
      *
      * Updates the geometry, frame list and clip.
-     * For items within a ThebesLayer, a geometry object must be specifed to retain
+     * For items within a PaintedLayer, a geometry object must be specifed to retain
      * until the next transaction.
      *
      */
     void EndUpdate(nsAutoPtr<nsDisplayItemGeometry> aGeometry);
     void EndUpdate();
 
     LayerManagerData* mParent;
     nsRefPtr<Layer> mLayer;
@@ -484,17 +484,17 @@ protected:
   friend class LayerManagerData;
 
   static void RemoveFrameFromLayerManager(nsIFrame* aFrame, void* aPropertyValue);
 
   /**
    * Given a frame and a display item key that uniquely identifies a
    * display item for the frame, find the layer that was last used to
    * render that display item. Returns null if there is no such layer.
-   * This could be a dedicated layer for the display item, or a ThebesLayer
+   * This could be a dedicated layer for the display item, or a PaintedLayer
    * that renders many display items.
    */
   DisplayItemData* GetOldLayerForFrame(nsIFrame* aFrame, uint32_t aDisplayItemKey);
 
   /**
    * Stores DisplayItemData associated with aFrame, stores the data in
    * mNewDisplayItemData.
    */
@@ -529,22 +529,22 @@ protected:
   static DisplayItemData* GetDisplayItemDataForManager(nsIFrame* aFrame, 
                                                        uint32_t aDisplayItemKey, 
                                                        LayerManagerData* aData);
 
   static PLDHashOperator DumpDisplayItemDataForFrame(nsRefPtrHashKey<DisplayItemData>* aEntry,
                                                      void* aClosure);
   /**
    * We store one of these for each display item associated with a
-   * ThebesLayer, in a hashtable that maps each ThebesLayer to an array
-   * of ClippedDisplayItems. (ThebesLayerItemsEntry is the hash entry
+   * PaintedLayer, in a hashtable that maps each PaintedLayer to an array
+   * of ClippedDisplayItems. (PaintedLayerItemsEntry is the hash entry
    * for that hashtable.)
    * These are only stored during the paint process, so that the
-   * DrawThebesLayer callback can figure out which items to draw for the
-   * ThebesLayer.
+   * DrawPaintedLayer callback can figure out which items to draw for the
+   * PaintedLayer.
    */
   struct ClippedDisplayItem {
     ClippedDisplayItem(nsDisplayItem* aItem, uint32_t aGeneration)
       : mItem(aItem), mContainerLayerGeneration(aGeneration)
     {
     }
 
     ~ClippedDisplayItem();
@@ -580,67 +580,67 @@ protected:
                   float aXScale, float aYScale,
                   int32_t aCommonClipCount);
 
   /**
    * We accumulate ClippedDisplayItem elements in a hashtable during
    * the paint process. This is the hashentry for that hashtable.
    */
 public:
-  class ThebesLayerItemsEntry : public nsPtrHashKey<ThebesLayer> {
+  class PaintedLayerItemsEntry : public nsPtrHashKey<PaintedLayer> {
   public:
-    explicit ThebesLayerItemsEntry(const ThebesLayer *key)
-      : nsPtrHashKey<ThebesLayer>(key)
+    explicit PaintedLayerItemsEntry(const PaintedLayer *key)
+      : nsPtrHashKey<PaintedLayer>(key)
       , mContainerLayerFrame(nullptr)
       , mLastCommonClipCount(0)
       , mContainerLayerGeneration(0)
       , mHasExplicitLastPaintOffset(false)
       , mCommonClipCount(0)
     {}
-    ThebesLayerItemsEntry(const ThebesLayerItemsEntry &toCopy) :
-      nsPtrHashKey<ThebesLayer>(toCopy.mKey), mItems(toCopy.mItems)
+    PaintedLayerItemsEntry(const PaintedLayerItemsEntry &toCopy) :
+      nsPtrHashKey<PaintedLayer>(toCopy.mKey), mItems(toCopy.mItems)
     {
       NS_ERROR("Should never be called, since we ALLOW_MEMMOVE");
     }
 
     nsTArray<ClippedDisplayItem> mItems;
     nsIFrame* mContainerLayerFrame;
-    // The translation set on this ThebesLayer before we started updating the
+    // The translation set on this PaintedLayer before we started updating the
     // layer tree.
     nsIntPoint mLastPaintOffset;
     uint32_t mLastCommonClipCount;
 
     uint32_t mContainerLayerGeneration;
     bool mHasExplicitLastPaintOffset;
     /**
       * The first mCommonClipCount rounded rectangle clips are identical for
-      * all items in the layer. Computed in ThebesLayerData.
+      * all items in the layer. Computed in PaintedLayerData.
       */
     uint32_t mCommonClipCount;
 
     enum { ALLOW_MEMMOVE = true };
   };
 
   /**
-   * Get the ThebesLayerItemsEntry object associated with aLayer in this
+   * Get the PaintedLayerItemsEntry object associated with aLayer in this
    * FrameLayerBuilder
    */
-  ThebesLayerItemsEntry* GetThebesLayerItemsEntry(ThebesLayer* aLayer)
+  PaintedLayerItemsEntry* GetPaintedLayerItemsEntry(PaintedLayer* aLayer)
   {
-    return mThebesLayerItems.GetEntry(aLayer);
+    return mPaintedLayerItems.GetEntry(aLayer);
   }
 
-  ThebesLayerData* GetContainingThebesLayerData()
+  PaintedLayerData* GetContainingPaintedLayerData()
   {
-    return mContainingThebesLayer;
+    return mContainingPaintedLayer;
   }
 
   bool IsBuildingRetainedLayers()
   {
-    return !mContainingThebesLayer && mRetainingManager;
+    return !mContainingPaintedLayer && mRetainingManager;
   }
 
   /**
    * Attempt to build the most compressed layer tree possible, even if it means
    * throwing away existing retained buffers.
    */
   void SetLayerTreeCompressionMode() { mInLayerTreeCompressionMode = true; }
   bool CheckInLayerTreeCompressionMode();
@@ -652,17 +652,17 @@ protected:
                                                     bool aRemoveThebesItems,
                                                     bool aRemoveOwnerData);
 
   static PLDHashOperator ProcessRemovedDisplayItems(nsRefPtrHashKey<DisplayItemData>* aEntry,
                                                     void* aUserArg);
   static PLDHashOperator RestoreDisplayItemData(nsRefPtrHashKey<DisplayItemData>* aEntry,
                                                 void *aUserArg);
 
-  static PLDHashOperator RestoreThebesLayerItemEntries(ThebesLayerItemsEntry* aEntry,
+  static PLDHashOperator RestorePaintedLayerItemEntries(PaintedLayerItemsEntry* aEntry,
                                                        void *aUserArg);
 
   /**
    * Returns true if the DOM has been modified since we started painting,
    * in which case we should bail out and not paint anymore. This should
    * never happen, but plugins can trigger it in some cases.
    */
   bool CheckDOMModified();
@@ -677,26 +677,26 @@ protected:
    */
   nsRefPtr<nsRootPresContext>         mRootPresContext;
 
   /**
    * The display list builder being used.
    */
   nsDisplayListBuilder*               mDisplayListBuilder;
   /**
-   * A map from ThebesLayers to the list of display items (plus
+   * A map from PaintedLayers to the list of display items (plus
    * clipping data) to be rendered in the layer.
    */
-  nsTHashtable<ThebesLayerItemsEntry> mThebesLayerItems;
+  nsTHashtable<PaintedLayerItemsEntry> mPaintedLayerItems;
 
   /**
    * When building layers for an inactive layer, this is where the
    * inactive layer will be placed.
    */
-  ThebesLayerData*                    mContainingThebesLayer;
+  PaintedLayerData*                    mContainingPaintedLayer;
 
   /**
    * Saved generation counter so we can detect DOM changes.
    */
   uint32_t                            mInitialDOMGeneration;
   /**
    * Set to true if we have detected and reported DOM modification during
    * the current paint.
--- a/layout/base/nsDisplayList.cpp
+++ b/layout/base/nsDisplayList.cpp
@@ -1232,17 +1232,17 @@ void nsDisplayList::PaintRoot(nsDisplayL
   PROFILER_LABEL("nsDisplayList", "PaintRoot",
     js::ProfileEntry::Category::GRAPHICS);
   PaintForFrame(aBuilder, aCtx, aBuilder->RootReferenceFrame(), aFlags);
 }
 
 /**
  * We paint by executing a layer manager transaction, constructing a
  * single layer representing the display list, and then making it the
- * root of the layer manager, drawing into the ThebesLayers.
+ * root of the layer manager, drawing into the PaintedLayers.
  */
 void nsDisplayList::PaintForFrame(nsDisplayListBuilder* aBuilder,
                                   nsRenderingContext* aCtx,
                                   nsIFrame* aForFrame,
                                   uint32_t aFlags) {
   nsRefPtr<LayerManager> layerManager;
   bool widgetTransaction = false;
   bool allowRetaining = false;
@@ -1380,17 +1380,17 @@ void nsDisplayList::PaintForFrame(nsDisp
     // we don't need to worry about END_NO_COMPOSITE.
     if (aBuilder->WillComputePluginGeometry()) {
       flags = LayerManager::END_NO_REMOTE_COMPOSITE;
     }
   }
 
   MaybeSetupTransactionIdAllocator(layerManager, view);
 
-  layerManager->EndTransaction(FrameLayerBuilder::DrawThebesLayer,
+  layerManager->EndTransaction(FrameLayerBuilder::DrawPaintedLayer,
                                aBuilder, flags);
   aBuilder->SetIsCompositingCheap(temp);
   layerBuilder->DidEndTransaction();
 
   nsIntRegion invalid;
   if (props) {
     invalid = props->ComputeDifferences(root, computeInvalidFunc);
   } else if (widgetTransaction) {
@@ -3217,17 +3217,17 @@ bool nsDisplayWrapList::IsUniform(nsDisp
 
 void nsDisplayWrapList::Paint(nsDisplayListBuilder* aBuilder,
                               nsRenderingContext* aCtx) {
   NS_ERROR("nsDisplayWrapList should have been flattened away for painting");
 }
 
 /**
  * Returns true if all descendant display items can be placed in the same
- * ThebesLayer --- GetLayerState returns LAYER_INACTIVE or LAYER_NONE,
+ * PaintedLayer --- GetLayerState returns LAYER_INACTIVE or LAYER_NONE,
  * and they all have the expected animated geometry root.
  */
 static LayerState
 RequiredLayerStateForChildren(nsDisplayListBuilder* aBuilder,
                               LayerManager* aManager,
                               const ContainerLayerParameters& aParameters,
                               const nsDisplayList& aList,
                               nsIFrame* aExpectedAnimatedGeometryRootForChildren)
--- a/layout/base/nsDisplayList.h
+++ b/layout/base/nsDisplayList.h
@@ -1091,24 +1091,24 @@ public:
 
   /**
    * @return LAYER_NONE if BuildLayer will return null. In this case
    * there is no layer for the item, and Paint should be called instead
    * to paint the content using Thebes.
    * Return LAYER_INACTIVE if there is a layer --- BuildLayer will
    * not return null (unless there's an error) --- but the layer contents
    * are not changing frequently. In this case it makes sense to composite
-   * the layer into a ThebesLayer with other content, so we don't have to
+   * the layer into a PaintedLayer with other content, so we don't have to
    * recomposite it every time we paint.
    * Note: GetLayerState is only allowed to return LAYER_INACTIVE if all
    * descendant display items returned LAYER_INACTIVE or LAYER_NONE. Also,
    * all descendant display item frames must have an active scrolled root
    * that's either the same as this item's frame's active scrolled root, or
    * a descendant of this item's frame. This ensures that the entire
-   * set of display items can be collapsed onto a single ThebesLayer.
+   * set of display items can be collapsed onto a single PaintedLayer.
    * Return LAYER_ACTIVE if the layer is active, that is, its contents are
    * changing frequently. In this case it makes sense to keep the layer
    * as a separate buffer in VRAM and composite it into the destination
    * every time we paint.
    *
    * Users of GetLayerState should check ForceActiveLayers() and if it returns
    * true, change a returned value of LAYER_INACTIVE to LAYER_ACTIVE.
    */
@@ -1126,17 +1126,17 @@ public:
    * Actually paint this item to some rendering context.
    * Content outside mVisibleRect need not be painted.
    * aCtx must be set up as for nsDisplayList::Paint.
    */
   virtual void Paint(nsDisplayListBuilder* aBuilder, nsRenderingContext* aCtx) {}
 
 #ifdef MOZ_DUMP_PAINTING
   /**
-   * Mark this display item as being painted via FrameLayerBuilder::DrawThebesLayer.
+   * Mark this display item as being painted via FrameLayerBuilder::DrawPaintedLayer.
    */
   bool Painted() { return mPainted; }
 
   /**
    * Check if this display item has been painted.
    */
   void SetPainted() { mPainted = true; }
 #endif
@@ -1373,17 +1373,17 @@ protected:
  * the items while they do the downward traversal, so overall they're still
  * linear time. We have optimized for efficient AppendToTop() of both
  * items and lists, with minimal codesize. AppendToBottom() is efficient too.
  */
 class nsDisplayList {
 public:
   typedef mozilla::layers::Layer Layer;
   typedef mozilla::layers::LayerManager LayerManager;
-  typedef mozilla::layers::ThebesLayer ThebesLayer;
+  typedef mozilla::layers::PaintedLayer PaintedLayer;
 
   /**
    * Create an empty list.
    */
   nsDisplayList()
     : mIsOpaque(false)
     , mForceTransparentSurface(false)
   {
@@ -1533,17 +1533,17 @@ public:
    * painting and also display items that maintain child lists.
    * This is also a good place to put ComputeVisibility-related logic
    * that must be applied to every display item. In particular, this
    * sets mVisibleRect on each display item.
    * This sets mIsOpaque if the entire visible area of this list has
    * been removed from aVisibleRegion when we return.
    * This does not remove any items from the list, so we can recompute
    * visiblity with different regions later (see
-   * FrameLayerBuilder::DrawThebesLayer).
+   * FrameLayerBuilder::DrawPaintedLayer).
    * This method needs to be idempotent.
    * 
    * @param aVisibleRegion the area that is visible, relative to the
    * reference frame; on return, this contains the area visible under the list.
    * I.e., opaque contents of this list are subtracted from aVisibleRegion.
    * @param aListVisibleBounds must be equal to the bounds of the intersection
    * of aVisibleRegion and GetBounds() for this list.
    * @param aDisplayPortFrame If the item for which this list corresponds is
@@ -2490,24 +2490,24 @@ public:
 
 /**
  * A display item that tracks event-sensitive regions which will be set
  * on the ContainerLayer that eventually contains this item.
  *
  * One of these is created for each stacking context and pseudo-stacking-context.
  * It accumulates regions for event targets contributed by the border-boxes of
  * frames in its (pseudo) stacking context. A nsDisplayLayerEventRegions
- * eventually contributes its regions to the ThebesLayer it is placed in by
+ * eventually contributes its regions to the PaintedLayer it is placed in by
  * FrameLayerBuilder. (We don't create a display item for every frame that
  * could be an event target (i.e. almost all frames), because that would be
  * high overhead.)
  *
- * We always make leaf layers other than ThebesLayers transparent to events.
+ * We always make leaf layers other than PaintedLayers transparent to events.
  * For example, an event targeting a canvas or video will actually target the
- * background of that element, which is logically in the ThebesLayer behind the
+ * background of that element, which is logically in the PaintedLayer behind the
  * CanvasFrame or ImageFrame. We only need to create a
  * nsDisplayLayerEventRegions when an element's background could be in front
  * of a lower z-order element with its own layer.
  */
 class nsDisplayLayerEventRegions MOZ_FINAL : public nsDisplayItem {
 public:
   nsDisplayLayerEventRegions(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame)
     : nsDisplayItem(aBuilder, aFrame)
--- a/layout/base/nsIPresShell.h
+++ b/layout/base/nsIPresShell.h
@@ -1375,18 +1375,18 @@ public:
   /**
    * Dispatch a mouse move event based on the most recent mouse position if
    * this PresShell is visible. This is used when the contents of the page
    * moved (aFromScroll is false) or scrolled (aFromScroll is true).
    */
   virtual void SynthesizeMouseMove(bool aFromScroll) = 0;
 
   enum PaintFlags {
-    /* Update the layer tree and paint ThebesLayers. If this is not specified,
-     * we may still have to do it if the layer tree lost ThebesLayer contents
+    /* Update the layer tree and paint PaintedLayers. If this is not specified,
+     * we may still have to do it if the layer tree lost PaintedLayer contents
      * we need for compositing. */
     PAINT_LAYERS = 0x01,
     /* Composite layers to the window. */
     PAINT_COMPOSITE = 0x02,
   };
   virtual void Paint(nsView* aViewToPaint, const nsRegion& aDirtyRegion,
                      uint32_t aFlags) = 0;
   virtual nsresult HandleEvent(nsIFrame* aFrame,
--- a/layout/base/nsLayoutUtils.h
+++ b/layout/base/nsLayoutUtils.h
@@ -486,17 +486,17 @@ public:
   static void SetScrollbarThumbLayerization(nsIFrame* aThumbFrame, bool aLayerize);
 
   /**
    * Finds the nearest ancestor frame to aItem that is considered to have (or
    * will have) "animated geometry". For example the scrolled frames of
    * scrollframes which are actively being scrolled fall into this category.
    * Frames with certain CSS properties that are being animated (e.g.
    * 'left'/'top' etc) are also placed in this category.
-   * Frames with different active geometry roots are in different ThebesLayers,
+   * Frames with different active geometry roots are in different PaintedLayers,
    * so that we can animate the geometry root by changing its transform (either
    * on the main thread or in the compositor).
    * The animated geometry root is required to be a descendant (or equal to)
    * aItem's ReferenceFrame(), which means that we will fall back to
    * returning aItem->ReferenceFrame() when we can't find another animated
    * geometry root.
    */
   static nsIFrame* GetAnimatedGeometryRootFor(nsDisplayItem* aItem,
--- a/layout/base/nsPresContext.cpp
+++ b/layout/base/nsPresContext.cpp
@@ -819,33 +819,33 @@ nsPresContext::GetUserPreferences()
 
   // We don't need to force reflow: either we are initializing a new
   // prescontext or we are being called from UpdateAfterPreferencesChanged()
   // which triggers a reflow anyway.
   SetBidi(bidiOptions, false);
 }
 
 void
-nsPresContext::InvalidateThebesLayers()
+nsPresContext::InvalidatePaintedLayers()
 {
   if (!mShell)
     return;
   nsIFrame* rootFrame = mShell->FrameManager()->GetRootFrame();
   if (rootFrame) {
     // FrameLayerBuilder caches invalidation-related values that depend on the
-    // appunits-per-dev-pixel ratio, so ensure that all ThebesLayer drawing
+    // appunits-per-dev-pixel ratio, so ensure that all PaintedLayer drawing
     // is completely flushed.
     rootFrame->InvalidateFrameSubtree();
   }
 }
 
 void
 nsPresContext::AppUnitsPerDevPixelChanged()
 {
-  InvalidateThebesLayers();
+  InvalidatePaintedLayers();
 
   if (mDeviceContext) {
     mDeviceContext->FlushFontCache();
   }
 
   if (HasCachedStyleData()) {
     // All cached style data must be recomputed.
     MediaFeatureValuesChanged(eAlwaysRebuildStyle, NS_STYLE_HINT_REFLOW);
@@ -932,17 +932,17 @@ nsPresContext::UpdateAfterPreferencesCha
   // Initialize our state from the user preferences
   GetUserPreferences();
 
   // update the presShell: tell it to set the preference style rules up
   if (mShell) {
     mShell->SetPreferenceStyleRules(true);
   }
 
-  InvalidateThebesLayers();
+  InvalidatePaintedLayers();
   mDeviceContext->FlushFontCache();
 
   nsChangeHint hint = nsChangeHint(0);
 
   if (mPrefChangePendingNeedsReflow) {
     NS_UpdateHint(hint, NS_STYLE_HINT_REFLOW);
   }
 
--- a/layout/base/nsPresContext.h
+++ b/layout/base/nsPresContext.h
@@ -1156,17 +1156,17 @@ public:
   // Controls for whether debug information about restyling in this
   // document should be output.
   bool RestyleLoggingEnabled() const { return mRestyleLoggingEnabled; }
   void StartRestyleLogging() { mRestyleLoggingEnabled = true; }
   void StopRestyleLogging() { mRestyleLoggingEnabled = false; }
 #endif
 
 protected:
-  void InvalidateThebesLayers();
+  void InvalidatePaintedLayers();
   void AppUnitsPerDevPixelChanged();
 
   void HandleRebuildUserFontSet() {
     mPostedFlushUserFontSet = false;
     FlushUserFontSet();
   }
 
   void HandleRebuildCounterStyles() {
--- a/layout/generic/nsFrameStateBits.h
+++ b/layout/generic/nsFrameStateBits.h
@@ -179,17 +179,17 @@ FRAME_STATE_BIT(Generic, 33, NS_FRAME_DR
 // at the next paint via display list construction.
 // Only meaningful for display roots, so we don't really need a global state
 // bit; we could free up this bit with a little extra complexity.
 FRAME_STATE_BIT(Generic, 36, NS_FRAME_UPDATE_LAYER_TREE)
 
 // Frame can accept absolutely positioned children.
 FRAME_STATE_BIT(Generic, 37, NS_FRAME_HAS_ABSPOS_CHILDREN)
 
-// A display item for this frame has been painted as part of a ThebesLayer.
+// A display item for this frame has been painted as part of a PaintedLayer.
 FRAME_STATE_BIT(Generic, 38, NS_FRAME_PAINTED_THEBES)
 
 // Frame is or is a descendant of something with a fixed height, unless that
 // ancestor is a body or html element, and has no closer ancestor that is
 // overflow:auto or overflow:scroll.
 FRAME_STATE_BIT(Generic, 39, NS_FRAME_IN_CONSTRAINED_HEIGHT)
 
 // This is only set during painting
--- a/layout/generic/nsGfxScrollFrame.cpp
+++ b/layout/generic/nsGfxScrollFrame.cpp
@@ -2268,17 +2268,17 @@ ClampAndAlignWithPixels(nscoord aDesired
 
   nscoord desired = clamped(aDesired, destLower, destUpper);
 
   double currentLayerVal = (aRes*aCurrent)/aAppUnitsPerPixel;
   double desiredLayerVal = (aRes*desired)/aAppUnitsPerPixel;
   double delta = desiredLayerVal - currentLayerVal;
   double nearestLayerVal = NS_round(delta) + currentLayerVal;
 
-  // Convert back from ThebesLayer space to appunits relative to the top-left
+  // Convert back from PaintedLayer space to appunits relative to the top-left
   // of the scrolled frame.
   nscoord aligned =
     NSToCoordRoundWithClamp(nearestLayerVal*aAppUnitsPerPixel/aRes);
 
   // Use a bound if it is within the allowed range and closer to desired than
   // the nearest pixel-aligned value.
   if (aBoundUpper == destUpper &&
       static_cast<decltype(Abs(desired))>(aBoundUpper - desired) <
@@ -2363,25 +2363,25 @@ ScrollFrameHelper::ScrollToImpl(nsPoint 
     // non-null, so that we can use nullness to distinguish if the frame was scrolled
     // at all. Default it to some generic placeholder.
     aOrigin = nsGkAtoms::other;
   }
 
   nsPresContext* presContext = mOuter->PresContext();
   nscoord appUnitsPerDevPixel = presContext->AppUnitsPerDevPixel();
   // 'scale' is our estimate of the scale factor that will be applied
-  // when rendering the scrolled content to its own ThebesLayer.
-  gfxSize scale = FrameLayerBuilder::GetThebesLayerScaleForFrame(mScrolledFrame);
+  // when rendering the scrolled content to its own PaintedLayer.
+  gfxSize scale = FrameLayerBuilder::GetPaintedLayerScaleForFrame(mScrolledFrame);
   nsPoint curPos = GetScrollPosition();
   nsPoint alignWithPos = mScrollPosForLayerPixelAlignment == nsPoint(-1,-1)
       ? curPos : mScrollPosForLayerPixelAlignment;
   // Try to align aPt with curPos so they have an integer number of layer
   // pixels between them. This gives us the best chance of scrolling without
   // having to invalidate due to changes in subpixel rendering.
-  // Note that when we actually draw into a ThebesLayer, the coordinates
+  // Note that when we actually draw into a PaintedLayer, the coordinates
   // that get mapped onto the layer buffer pixels are from the display list,
   // which are relative to the display root frame's top-left increasing down,
   // whereas here our coordinates are scroll positions which increase upward
   // and are relative to the scrollport top-left. This difference doesn't actually
   // matter since all we are about is that there be an integer number of
   // layer pixels between pt and curPos.
   nsPoint pt =
     ClampAndAlignWithLayerPixels(aPt,
--- a/layout/generic/nsPluginFrame.cpp
+++ b/layout/generic/nsPluginFrame.cpp
@@ -1022,17 +1022,17 @@ nsDisplayPlugin::GetOpaqueRegion(nsDispl
     if (widget) {
       // Be conservative and treat plugins with widgets as not opaque,
       // because that's simple and we might need the content under the widget
       // if the widget is unexpectedly clipped away. (As can happen when
       // chrome content over a plugin forces us to clip out the plugin for
       // security reasons.)
       // We shouldn't be repainting the content under plugins much anyway
       // since there generally shouldn't be anything to invalidate or paint
-      // in ThebesLayers there.
+      // in PaintedLayers there.
   	  return result;
     }
   }
 
   if (f->IsOpaque()) {
     nsRect bounds = GetBounds(aBuilder, aSnap);
     if (aBuilder->IsForPluginGeometry() ||
         (f->GetPaintedRect(this) + ToReferenceFrame()).Contains(bounds)) {
--- a/layout/reftests/border-radius/reftest.list
+++ b/layout/reftests/border-radius/reftest.list
@@ -44,17 +44,17 @@ fuzzy-if(Android&&AndroidVersion<15,9,73
 fuzzy-if(true,1,20) fuzzy-if(cocoaWidget,1,180) fuzzy-if(Android&&browserIsRemote,7,169) fuzzy-if(Android&&!browserIsRemote,140,237) == clipping-4-canvas.html clipping-4-ref.html # bug 732535
 fuzzy-if(Android,5,54) fuzzy-if(/^Windows\x20NT\x206\.2/.test(http.oscpu),1,10) == clipping-4-image.html clipping-4-ref.html
 fuzzy-if(/^Windows\x20NT\x206\.2/.test(http.oscpu),1,10) == clipping-4-overflow-hidden.html clipping-4-ref.html
 == clipping-5-canvas.html clipping-5-refc.html
 fuzzy-if(/^Windows\x20NT\x206\.2/.test(http.oscpu),1,5) == clipping-5-image.html clipping-5-refi.html
 fuzzy-if(/^Windows\x20NT\x206\.2/.test(http.oscpu),1,5) == clipping-5-overflow-hidden.html clipping-5-ref.html
 fuzzy-if(/^Windows\x20NT\x206\.2/.test(http.oscpu),1,5) fuzzy-if(Android,5,21) == clipping-5-refi.html clipping-5-ref.html
 fuzzy-if(true,1,7) fuzzy-if(cocoaWidget,1,99) fuzzy-if(Android&&browserIsRemote,7,89) fuzzy-if(Android&&!browserIsRemote,99,115) == clipping-5-refc.html clipping-5-ref.html # bug 732535
-fuzzy-if(winWidget,105,71) fuzzy-if(Android,8,464) == clipping-6.html clipping-6-ref.html # ThebesLayer and MaskLayer with transforms that aren't identical
+fuzzy-if(winWidget,105,71) fuzzy-if(Android,8,464) == clipping-6.html clipping-6-ref.html # PaintedLayer and MaskLayer with transforms that aren't identical
 fuzzy-if(true,2,29) fuzzy-if(Android&&AndroidVersion<15,12,81) fuzzy-if(Android&&AndroidVersion>=15,255,586) == clipping-7.html clipping-7-ref.html # ColorLayer and MaskLayer with transforms that aren't identical. Reference image rendered without using layers (which causes fuzzy failures).
 fuzzy-if(/^Windows\x20NT\x206\.2/.test(http.oscpu),1,5) == clipping-and-zindex-1.html clipping-and-zindex-1-ref.html
 fuzzy-if(cocoaWidget,1,4) == intersecting-clipping-1-canvas.html intersecting-clipping-1-refc.html
 == intersecting-clipping-1-image.html intersecting-clipping-1-refi.html
 == intersecting-clipping-1-overflow-hidden.html intersecting-clipping-1-ref.html
 fuzzy-if(Android,5,105) fuzzy-if(d2d,1,20) == intersecting-clipping-1-refi.html intersecting-clipping-1-ref.html
 fuzzy-if(true,1,33) fuzzy-if(cocoaWidget,1,332) fuzzy-if(Android&&browserIsRemote,7,310) fuzzy-if(Android&&!browserIsRemote,124,440) == intersecting-clipping-1-refc.html intersecting-clipping-1-ref.html # bug 732535
 
--- a/layout/svg/nsSVGIntegrationUtils.cpp
+++ b/layout/svg/nsSVGIntegrationUtils.cpp
@@ -392,17 +392,17 @@ public:
 
     gfxPoint devPixelOffset =
       nsLayoutUtils::PointToGfxPoint(-mOffset,
                                      aTarget->PresContext()->AppUnitsPerDevPixel());
 
     gfxContextMatrixAutoSaveRestore autoSR(ctx);
     ctx->SetMatrix(ctx->CurrentMatrix().Translate(devPixelOffset));
 
-    mLayerManager->EndTransaction(FrameLayerBuilder::DrawThebesLayer, mBuilder);
+    mLayerManager->EndTransaction(FrameLayerBuilder::DrawPaintedLayer, mBuilder);
   }
 
 private:
   nsDisplayListBuilder* mBuilder;
   LayerManager* mLayerManager;
   nsPoint mOffset;
 };
 
@@ -536,17 +536,17 @@ nsSVGIntegrationUtils::PaintFramesWithEf
     RegularFramePaintCallback callback(aBuilder, aLayerManager,
                                        offsetToUserSpace);
 
     nsRegion dirtyRegion = aDirtyRect - offsetToBoundingBox;
     gfxMatrix tm = nsSVGIntegrationUtils::GetCSSPxToDevPxMatrix(aFrame);
     nsFilterInstance::PaintFilteredFrame(aFrame, aCtx, tm, &callback, &dirtyRegion);
   } else {
     gfx->SetMatrix(matrixAutoSaveRestore.Matrix());
-    aLayerManager->EndTransaction(FrameLayerBuilder::DrawThebesLayer, aBuilder);
+    aLayerManager->EndTransaction(FrameLayerBuilder::DrawPaintedLayer, aBuilder);
     gfx->SetMatrix(gfx->CurrentMatrix().Translate(devPixelOffsetToUserSpace));
   }
 
   if (clipPathFrame && isTrivialClip) {
     gfx->Restore();
   }
 
   /* No more effects, we're done. */
--- a/widget/gonk/HwcComposer2D.cpp
+++ b/widget/gonk/HwcComposer2D.cpp
@@ -384,17 +384,17 @@ HwcComposer2D::PrepareLayerList(Layer* a
         if (aLayer->AsColorLayer() && mColorFill) {
             fillColor = true;
         } else {
             LOGD("%s Layer doesn't have a gralloc buffer", aLayer->Name());
             return false;
         }
     }
     // Buffer rotation is not to be confused with the angled rotation done by a transform matrix
-    // It's a fancy ThebesLayer feature used for scrolling
+    // It's a fancy PaintedLayer feature used for scrolling
     if (state.BufferRotated()) {
         LOGD("%s Layer has a rotated buffer", aLayer->Name());
         return false;
     }
 
     nsIntRect visibleRect = visibleRegion.GetBounds();
 
     nsIntRect bufferRect;