Bug 1073103 - SReplace 'Thebes' with 'Painted' in some more places. r=roc
authorMarkus Stange <mstange@themasta.com>
Fri, 26 Sep 2014 13:07:06 -0400
changeset 222951 0edd9d046fd1f3de02a839122c188599a8e36328
parent 222950 0e92508994019308a549b841ee0ec32321f93e72
child 222952 13df548b65912936bbd9b8364bc613271237c19d
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 - SReplace 'Thebes' with 'Painted' in some more places. r=roc
gfx/layers/LayerScope.cpp
gfx/layers/Layers.cpp
gfx/layers/Layers.h
gfx/layers/ReadbackProcessor.cpp
gfx/layers/basic/BasicImplData.h
gfx/layers/client/ClientLayerManager.h
gfx/layers/client/ClientPaintedLayer.cpp
gfx/layers/client/ClientTiledPaintedLayer.cpp
gfx/layers/client/ClientTiledPaintedLayer.h
gfx/layers/client/CompositableClient.h
gfx/layers/client/ContentClient.h
gfx/layers/composite/ContentHost.h
gfx/layers/composite/PaintedLayerComposite.h
gfx/layers/composite/TiledContentHost.h
gfx/layers/d3d10/ContainerLayerD3D10.cpp
gfx/layers/d3d9/ContainerLayerD3D9.cpp
gfx/layers/ipc/CompositableTransactionParent.cpp
gfx/layers/ipc/ShadowLayerParent.cpp
gfx/layers/moz.build
gfx/layers/protobuf/LayerScopePacket.proto
gfx/tests/gtest/TestLayers.cpp
gfx/thebes/gfxPlatformGtk.cpp
layout/base/FrameLayerBuilder.cpp
layout/base/FrameLayerBuilder.h
layout/generic/nsPluginFrame.cpp
--- a/gfx/layers/LayerScope.cpp
+++ b/gfx/layers/LayerScope.cpp
@@ -710,17 +710,17 @@ SenderHelper::SendLayer(LayerComposite* 
         case Layer::TYPE_COLOR: {
             EffectChain effect;
             aLayer->GenEffectChain(effect);
             SenderHelper::SendEffectChain(nullptr, effect, aWidth, aHeight);
             break;
         }
         case Layer::TYPE_IMAGE:
         case Layer::TYPE_CANVAS:
-        case Layer::TYPE_THEBES: {
+        case Layer::TYPE_PAINTED: {
             // Get CompositableHost and Compositor
             CompositableHost* compHost = aLayer->GetCompositableHost();
             Compositor* comp = compHost->GetCompositor();
             // Send EffectChain only for CompositorOGL
             if (LayersBackend::LAYERS_OPENGL == comp->GetBackendType()) {
                 CompositorOGL* compOGL = static_cast<CompositorOGL*>(comp);
                 EffectChain effect;
                 // Generate primary effect (lock and gen)
--- a/gfx/layers/Layers.cpp
+++ b/gfx/layers/Layers.cpp
@@ -1338,17 +1338,17 @@ void WriteSnapshotToDumpFile(Compositor*
 #endif
 
 void
 Layer::Dump(std::stringstream& aStream, const char* aPrefix, bool aDumpHtml)
 {
   if (aDumpHtml) {
     aStream << nsPrintfCString("<li><a id=\"%p\" ", this).get();
 #ifdef MOZ_DUMP_PAINTING
-    if (GetType() == TYPE_CONTAINER || GetType() == TYPE_THEBES) {
+    if (GetType() == TYPE_CONTAINER || GetType() == TYPE_PAINTED) {
       WriteSnapshotLinkToDumpFile(this, aStream);
     }
 #endif
     aStream << ">";
   }
   DumpSelf(aStream, aPrefix);
 
 #ifdef MOZ_DUMP_PAINTING
--- a/gfx/layers/Layers.h
+++ b/gfx/layers/Layers.h
@@ -368,17 +368,17 @@ public:
 #ifdef DEBUG
   // In debug builds, we check some properties of |aLayer|.
   virtual void Mutated(Layer* aLayer);
 #else
   virtual void Mutated(Layer* aLayer) { }
 #endif
 
   /**
-   * Hints that can be used during Thebes layer creation to influence the type
+   * Hints that can be used during PaintedLayer creation to influence the type
    * or properties of the layer created.
    *
    * NONE: No hint.
    * SCROLLABLE: This layer may represent scrollable content.
    */
   enum PaintedLayerCreationHint {
     NONE, SCROLLABLE
   };
@@ -733,17 +733,17 @@ public:
   enum LayerType {
     TYPE_CANVAS,
     TYPE_COLOR,
     TYPE_CONTAINER,
     TYPE_IMAGE,
     TYPE_READBACK,
     TYPE_REF,
     TYPE_SHADOW,
-    TYPE_THEBES
+    TYPE_PAINTED
   };
 
   /**
    * Returns the LayerManager this Layer belongs to. Note that the layer
    * manager might be in a destroyed state, at which point it's only
    * valid to set/get user data from it.
    */
   LayerManager* Manager() { return mManager; }
@@ -1318,17 +1318,17 @@ public:
    * safe no-op; no crashy or uaf etc.
    *
    * 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
+   * Dynamic downcast to a PaintedLayer. Returns null if this is not
    * a PaintedLayer.
    */
   virtual PaintedLayer* AsPaintedLayer() { return nullptr; }
 
   /**
    * Dynamic cast to a ContainerLayer. Returns null if this is not
    * a ContainerLayer.
    */
@@ -1650,17 +1650,17 @@ protected:
   // stay in sync with the animation manager
   uint64_t mAnimationGeneration;
 #ifdef MOZ_DUMP_PAINTING
   nsTArray<nsCString> mExtraDumpInfo;
 #endif
 };
 
 /**
- * A Layer which we can draw into using Thebes. It is a conceptually
+ * A Layer which we can paint into. It is a conceptually
  * 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.
  *
  * PaintedLayers are rendered into during the drawing phase of a transaction.
  *
  * Currently the contents of a PaintedLayer are in the device output color
  * space.
@@ -1690,17 +1690,17 @@ public:
 
   /**
    * Can be used anytime
    */
   const nsIntRegion& GetValidRegion() const { return mValidRegion; }
 
   virtual PaintedLayer* AsPaintedLayer() { return this; }
 
-  MOZ_LAYER_DECL_NAME("PaintedLayer", TYPE_THEBES)
+  MOZ_LAYER_DECL_NAME("PaintedLayer", TYPE_PAINTED)
 
   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
--- a/gfx/layers/ReadbackProcessor.cpp
+++ b/gfx/layers/ReadbackProcessor.cpp
@@ -72,17 +72,17 @@ FindBackgroundLayer(ReadbackLayer* aLaye
       return nullptr;
 
     // cliprects are post-transform
     const nsIntRect* clipRect = l->GetEffectiveClipRect();
     if (clipRect && !clipRect->Contains(nsIntRect(transformOffset, aLayer->GetSize())))
       return nullptr;
 
     Layer::LayerType type = l->GetType();
-    if (type != Layer::TYPE_COLOR && type != Layer::TYPE_THEBES)
+    if (type != Layer::TYPE_COLOR && type != Layer::TYPE_PAINTED)
       return nullptr;
 
     *aOffset = backgroundOffset - transformOffset;
     return l;
   }
 
   return nullptr;
 }
--- a/gfx/layers/basic/BasicImplData.h
+++ b/gfx/layers/basic/BasicImplData.h
@@ -16,17 +16,17 @@ namespace layers {
 
 class ReadbackProcessor;
 class SurfaceDescriptor;
 
 /**
  * This is the ImplData for all Basic layers. It also exposes methods
  * private to the Basic implementation that are common to all Basic layer types.
  * In particular, there is an internal Paint() method that we can use
- * to paint the contents of non-Thebes layers.
+ * to paint the contents of non-PaintedLayers.
  *
  * The class hierarchy for Basic layers is like this:
  *                                 BasicImplData
  * Layer                            |   |   |
  *  |                               |   |   |
  *  +-> ContainerLayer              |   |   |
  *  |    |                          |   |   |
  *  |    +-> BasicContainerLayer <--+   |   |
--- a/gfx/layers/client/ClientLayerManager.h
+++ b/gfx/layers/client/ClientLayerManager.h
@@ -287,17 +287,17 @@ private:
   bool EndTransactionInternal(DrawPaintedLayerCallback aCallback,
                               void* aCallbackData,
                               EndTransactionFlags);
 
   LayerRefArray mKeepAlive;
 
   nsIWidget* mWidget;
   
-  /* Thebes layer callbacks; valid at the end of a transaciton,
+  /* PaintedLayer callbacks; valid at the end of a transaciton,
    * while rendering */
   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
--- a/gfx/layers/client/ClientPaintedLayer.cpp
+++ b/gfx/layers/client/ClientPaintedLayer.cpp
@@ -162,20 +162,20 @@ ClientLayerManager::CreatePaintedLayerWi
 #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<ClientTiledPaintedLayer> layer = new ClientTiledPaintedLayer(this, aHint);
-    CREATE_SHADOW(Thebes);
+    CREATE_SHADOW(Painted);
     return layer.forget();
   } else {
     nsRefPtr<ClientPaintedLayer> layer = new ClientPaintedLayer(this, aHint);
-    CREATE_SHADOW(Thebes);
+    CREATE_SHADOW(Painted);
     return layer.forget();
   }
 }
 
 
 }
 }
--- a/gfx/layers/client/ClientTiledPaintedLayer.cpp
+++ b/gfx/layers/client/ClientTiledPaintedLayer.cpp
@@ -127,17 +127,17 @@ ClientTiledPaintedLayer::BeginPaint()
   LayerMetricsWrapper displayPortAncestor;
   GetAncestorLayers(&scrollAncestor, &displayPortAncestor);
 
   if (!displayPortAncestor || !scrollAncestor) {
     // No displayport or scroll ancestor, so we can't do progressive rendering.
 #if defined(MOZ_WIDGET_ANDROID) || defined(MOZ_B2G)
     // Both Android and b2g are guaranteed to have a displayport set, so this
     // should never happen.
-    NS_WARNING("Tiled Thebes layer with no scrollable container ancestor");
+    NS_WARNING("Tiled PaintedLayer with no scrollable container ancestor");
 #endif
     return;
   }
 
   TILING_LOG("TILING %p: Found scrollAncestor %p and displayPortAncestor %p\n", this,
     scrollAncestor.GetLayer(), displayPortAncestor.GetLayer());
 
   const FrameMetrics& scrollMetrics = scrollAncestor.Metrics();
--- a/gfx/layers/client/ClientTiledPaintedLayer.h
+++ b/gfx/layers/client/ClientTiledPaintedLayer.h
@@ -21,17 +21,17 @@ class ShadowableLayer;
 class SpecificLayerAttributes;
 
 /**
  * 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
+ * Tiled PaintedLayers 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.
  */
@@ -46,17 +46,17 @@ public:
 
 protected:
   ~ClientTiledPaintedLayer();
 
 public:
   // Override name to distinguish it from ClientPaintedLayer in layer dumps
   virtual const char* Name() const { return "TiledPaintedLayer"; }
 
-  // Thebes Layer
+  // PaintedLayer
   virtual Layer* AsLayer() { return this; }
   virtual void InvalidateRegion(const nsIntRegion& aRegion) {
     mInvalidRegion.Or(mInvalidRegion, aRegion);
     mValidRegion.Sub(mValidRegion, aRegion);
     mLowPrecisionValidRegion.Sub(mLowPrecisionValidRegion, aRegion);
   }
 
   // Shadow methods
--- a/gfx/layers/client/CompositableClient.h
+++ b/gfx/layers/client/CompositableClient.h
@@ -105,17 +105,17 @@ private:
  * To do async texture transfer (like async-video), the CompositableClient
  * should be created with a different CompositableForwarder (like
  * ImageBridgeChild) and attachment is done with
  * CompositableForwarder::AttachAsyncCompositable that takes an identifier
  * instead of a CompositableChild, since the CompositableClient is not managed
  * by this layer forwarder (the matching uses a global map on the compositor side,
  * see CompositableMap in ImageBridgeParent.cpp)
  *
- * Subclasses: Thebes layers use ContentClients, ImageLayers use ImageClients,
+ * Subclasses: Painted layers use ContentClients, ImageLayers use ImageClients,
  * Canvas layers use CanvasClients (but ImageHosts). We have a different subclass
  * where we have a different way of interfacing with the textures - in terms of
  * drawing into the compositable and/or passing its contents to the compostior.
  */
 class CompositableClient
 {
 protected:
   virtual ~CompositableClient();
--- a/gfx/layers/client/ContentClient.h
+++ b/gfx/layers/client/ContentClient.h
@@ -36,17 +36,17 @@ class DrawTarget;
 }
 
 namespace layers {
 
 class BasicLayerManager;
 class PaintedLayer;
 
 /**
- * A compositable client for Thebes layers. These are different to Image/Canvas
+ * A compositable client for PaintedLayers. 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
  * 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.
--- a/gfx/layers/composite/ContentHost.h
+++ b/gfx/layers/composite/ContentHost.h
@@ -42,17 +42,17 @@ class Compositor;
 class ThebesBufferData;
 class TiledLayerComposer;
 struct EffectChain;
 class TextureImageTextureSourceOGL;
 
 struct TexturedEffect;
 
 /**
- * ContentHosts are used for compositing Thebes layers, always matched by a
+ * ContentHosts are used for compositing Painted layers, always matched by a
  * ContentClient of the same type.
  *
  * ContentHosts support only UpdateThebes(), not Update().
  */
 class ContentHost : public CompositableHost
 {
 public:
   // Subclasses should implement this method if they support being used as a
--- a/gfx/layers/composite/PaintedLayerComposite.h
+++ b/gfx/layers/composite/PaintedLayerComposite.h
@@ -19,19 +19,19 @@
 struct nsIntPoint;
 struct nsIntRect;
 
 
 namespace mozilla {
 namespace layers {
 
 /**
- * Thebes layers use ContentHosts for their compsositable host.
+ * PaintedLayers use ContentHosts for their compsositable host.
  * By using different ContentHosts, PaintedLayerComposite support tiled and
- * non-tiled Thebes layers and single or double buffering.
+ * non-tiled PaintedLayers and single or double buffering.
  */
 
 class CompositableHost;
 class ContentHost;
 class TiledLayerComposer;
 
 class PaintedLayerComposite : public PaintedLayer,
                              public LayerComposite
@@ -72,17 +72,17 @@ public:
 
   void SetValidRegion(const nsIntRegion& aRegion)
   {
     MOZ_LAYERS_LOG_IF_SHADOWABLE(this, ("Layer::Mutated(%p) ValidRegion", this));
     mValidRegion = aRegion;
     Mutated();
   }
 
-  MOZ_LAYER_DECL_NAME("PaintedLayerComposite", TYPE_THEBES)
+  MOZ_LAYER_DECL_NAME("PaintedLayerComposite", TYPE_PAINTED)
 
 protected:
 
   virtual void PrintInfo(std::stringstream& aStream, const char* aPrefix) MOZ_OVERRIDE;
 
 private:
   gfx::Filter GetEffectFilter() { return gfx::Filter::LINEAR; }
 
--- a/gfx/layers/composite/TiledContentHost.h
+++ b/gfx/layers/composite/TiledContentHost.h
@@ -161,17 +161,17 @@ protected:
   void PostValidate(const nsIntRegion& aPaintRegion) {}
 private:
   CSSToParentLayerScale mFrameResolution;
   bool mHasDoubleBufferedTiles;
   bool mUninitialized;
 };
 
 /**
- * ContentHost for tiled Thebes layers. Since tiled layers are special snow
+ * ContentHost for tiled PaintedLayers. Since tiled layers are special snow
  * flakes, we have a unique update process. All the textures that back the
  * tiles are added in the usual way, but Updated is called on the host side
  * in response to a message that describes the transaction for every tile.
  * Composition happens in the normal way.
  *
  * TiledContentHost has a TiledLayerBufferComposite which keeps hold of the tiles.
  * Each tile has a reference to a texture host. During the layers transaction, we
  * receive a list of descriptors for the client-side tile buffer tiles
--- a/gfx/layers/d3d10/ContainerLayerD3D10.cpp
+++ b/gfx/layers/d3d10/ContainerLayerD3D10.cpp
@@ -250,17 +250,17 @@ ContainerLayerD3D10::Validate()
         (mParent && mParent->SupportsComponentAlphaChildren());
   }
 
   ReadbackProcessor readback;
   readback.BuildUpdates(this);
 
   Layer *layer = GetFirstChild();
   while (layer) {
-    if (layer->GetType() == TYPE_THEBES) {
+    if (layer->GetType() == TYPE_PAINTED) {
       static_cast<PaintedLayerD3D10*>(layer)->Validate(&readback);
     } else {
       static_cast<LayerD3D10*>(layer->ImplData())->Validate();
     }
     layer = layer->GetNextSibling();
   }
 }
 
--- a/gfx/layers/d3d9/ContainerLayerD3D9.cpp
+++ b/gfx/layers/d3d9/ContainerLayerD3D9.cpp
@@ -168,17 +168,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) {
+    if (layerToRender->GetLayer()->GetType() == TYPE_PAINTED) {
       static_cast<PaintedLayerD3D9*>(layerToRender)->RenderPaintedLayer(&readback);
     } else {
       layerToRender->RenderLayer();
     }
   }
     
   if (useIntermediate && !mD3DManager->CompositingDisabled()) {
     device()->SetRenderTarget(0, previousRenderTarget);
--- a/gfx/layers/ipc/CompositableTransactionParent.cpp
+++ b/gfx/layers/ipc/CompositableTransactionParent.cpp
@@ -88,17 +88,17 @@ CompositableParentManager::ReceiveCompos
       break;
     }
     case CompositableOperation::TOpPaintTextureRegion: {
       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) {
+      if (!layer || layer->GetType() != Layer::TYPE_PAINTED) {
         return false;
       }
       PaintedLayerComposite* thebes = static_cast<PaintedLayerComposite*>(layer);
 
       const ThebesBufferData& bufferData = op.bufferData();
 
       RenderTraceInvalidateStart(thebes, "FF00FF", op.updatedRegion().GetBounds());
 
--- a/gfx/layers/ipc/ShadowLayerParent.cpp
+++ b/gfx/layers/ipc/ShadowLayerParent.cpp
@@ -83,17 +83,17 @@ ShadowLayerParent::AsRefLayerComposite()
   return mLayer && mLayer->GetType() == Layer::TYPE_REF
          ? static_cast<RefLayerComposite*>(mLayer.get())
          : nullptr;
 }
 
 PaintedLayerComposite*
 ShadowLayerParent::AsPaintedLayerComposite() const
 {
-  return mLayer && mLayer->GetType() == Layer::TYPE_THEBES
+  return mLayer && mLayer->GetType() == Layer::TYPE_PAINTED
          ? static_cast<PaintedLayerComposite*>(mLayer.get())
          : nullptr;
 }
 
 void
 ShadowLayerParent::ActorDestroy(ActorDestroyReason why)
 {
   switch (why) {
--- a/gfx/layers/moz.build
+++ b/gfx/layers/moz.build
@@ -278,19 +278,19 @@ UNIFIED_SOURCES += [
     'composite/ColorLayerComposite.cpp',
     'composite/CompositableHost.cpp',
     'composite/ContainerLayerComposite.cpp',
     'composite/ContentHost.cpp',
     'composite/FPSCounter.cpp',
     'composite/ImageHost.cpp',
     'composite/ImageLayerComposite.cpp',
     'composite/LayerManagerComposite.cpp',
+    'composite/PaintedLayerComposite.cpp',
     'composite/TextRenderer.cpp',
     'composite/TextureHost.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.proto
+++ b/gfx/layers/protobuf/LayerScopePacket.proto
@@ -89,17 +89,17 @@ message LayersPacket {
     optional float opacity = 14;
     optional bool cOpaque = 15;   // content opaque
     optional bool cAlpha = 16;    // component alpha
     optional ScrollingDirect direct = 17;
     optional uint64 barID = 18;
     optional uint64 mask = 19;    // mask layer
 
     // Specific info (100 to max)
-    // Thebes Layer
+    // Painted Layer
     optional Region valid = 100;
     // Color Layer
     optional uint32 color = 101;
     // Canvas & Image Layer
     optional Filter filter = 102;
     // Ref Layer
     optional uint64 refID = 103;
     // Readback Layer
--- a/gfx/tests/gtest/TestLayers.cpp
+++ b/gfx/tests/gtest/TestLayers.cpp
@@ -60,17 +60,17 @@ public:
     : PaintedLayer(aManager, nullptr)
   {}
 
   virtual const char* Name() const {
     return "TestPaintedLayer";
   }
 
   virtual LayerType GetType() const {
-    return TYPE_THEBES;
+    return TYPE_PAINTED;
   }
 
   virtual void InvalidateRegion(const nsIntRegion& aRegion) {
     MOZ_CRASH();
   }
 };
 
 class TestUserData: public LayerUserData {
--- a/gfx/thebes/gfxPlatformGtk.cpp
+++ b/gfx/thebes/gfxPlatformGtk.cpp
@@ -88,17 +88,17 @@ gfxPlatformGtk::CreateOffscreenSurface(c
     bool needsClear = true;
     gfxImageFormat imageFormat = OptimalFormatForContent(contentType);
 #ifdef MOZ_X11
     // XXX we really need a different interface here, something that passes
     // in more context, including the display and/or target surface type that
     // we should try to match
     GdkScreen *gdkScreen = gdk_screen_get_default();
     if (gdkScreen) {
-        // When forcing Thebes Layers to use image surfaces for content,
+        // When forcing PaintedLayers to use image surfaces for content,
         // force creation of gfxImageSurface surfaces.
         if (UseXRender() && !UseImageOffscreenSurfaces()) {
             Screen *screen = gdk_x11_screen_get_xscreen(gdkScreen);
             XRenderPictFormat* xrenderFormat =
                 gfxXlibSurface::FindRenderFormat(DisplayOfScreen(screen),
                                                  imageFormat);
 
             if (xrenderFormat) {
--- a/layout/base/FrameLayerBuilder.cpp
+++ b/layout/base/FrameLayerBuilder.cpp
@@ -375,21 +375,21 @@ public:
 
 #ifdef MOZ_DUMP_PAINTING
 
   /**
    * Keep track of important decisions for debugging.
    */
   nsAutoCString mLog;
 
-  #define FLB_LOG_THEBES_DECISION(tld, ...) \
+  #define FLB_LOG_PAINTED_LAYER_DECISION(tld, ...) \
           tld->mLog.AppendPrintf("\t\t\t\t"); \
           tld->mLog.AppendPrintf(__VA_ARGS__);
 #else
-  #define FLB_LOG_THEBES_DECISION(...)
+  #define FLB_LOG_PAINTED_LAYER_DECISION(...)
 #endif
 
   /**
    * The region of visible content in the layer, relative to the
    * container layer (which is at the snapped top-left of the display
    * list reference frame).
    */
   nsIntRegion  mVisibleRegion;
@@ -474,17 +474,17 @@ public:
    * convert this to an ImageLayer.
    */
   nsDisplayImageContainer* mImage;
   /**
    * Stores the clip that we need to apply to the image or, if there is no
    * image, a clip for SOME item in the layer. There is no guarantee which
    * item's clip will be stored here and mItemClip should not be used to clip
    * the whole layer - only some part of the clip should be used, as determined
-   * by ThebesDisplayItemLayerUserData::GetCommonClipCount() - which may even be
+   * by PaintedDisplayItemLayerUserData::GetCommonClipCount() - which may even be
    * no part at all.
    */
   DisplayItemClip mItemClip;
   /**
    * The first mCommonClipCount rounded rectangle clips are identical for
    * all items in the layer.
    * -1 if there are no items in the layer; must be >=0 by the time that this
    * data is popped from the stack.
@@ -704,22 +704,22 @@ protected:
    */
   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(PaintedLayer* aThebes);
+  already_AddRefed<ColorLayer> CreateOrRecycleColorLayer(PaintedLayer* aPainted);
   /**
    * Grab the next recyclable ImageLayer, or create one if there are no
    * more recyclable ImageLayers.
    */
-  already_AddRefed<ImageLayer> CreateOrRecycleImageLayer(PaintedLayer* aThebes);
+  already_AddRefed<ImageLayer> CreateOrRecycleImageLayer(PaintedLayer* aPainted);
   /**
    * 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 PaintedLayers and ColorLayers from the ContainerLayer and makes them
@@ -867,17 +867,17 @@ protected:
   ContainerLayer*                  mContainerLayer;
   nsRect                           mContainerBounds;
   DebugOnly<nsRect>                mAccumulatedChildBounds;
   ContainerLayerParameters         mParameters;
   /**
    * The region of PaintedLayers that should be invalidated every time
    * we recycle one.
    */
-  nsIntRegion                      mInvalidThebesContent;
+  nsIntRegion                      mInvalidPaintedContent;
   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.
    * 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
@@ -889,29 +889,29 @@ protected:
   nsDataHashtable<nsPtrHashKey<Layer>, nsRefPtr<ImageLayer> >
     mRecycledMaskImageLayers;
   uint32_t                         mNextFreeRecycledPaintedLayer;
   nscoord                          mAppUnitsPerDevPixel;
   bool                             mSnappingEnabled;
   bool                             mFlattenToSingleLayer;
 };
 
-class ThebesDisplayItemLayerUserData : public LayerUserData
+class PaintedDisplayItemLayerUserData : public LayerUserData
 {
 public:
-  ThebesDisplayItemLayerUserData() :
+  PaintedDisplayItemLayerUserData() :
     mMaskClipCount(0),
     mForcedBackgroundColor(NS_RGBA(0,0,0,0)),
     mXScale(1.f), mYScale(1.f),
     mAppUnitsPerDevPixel(0),
     mTranslation(0, 0),
     mAnimatedGeometryRootPosition(0, 0) {}
 
   /**
-   * Record the number of clips in the Thebes layer's mask layer.
+   * Record the number of clips in the PaintedLayer's mask layer.
    * Should not be reset when the layer is recycled since it is used to track
    * changes in the use of mask layers.
    */
   uint32_t mMaskClipCount;
 
   /**
    * A color that should be painted over the bounds of the layer's visible
    * region before any other content is painted.
@@ -988,25 +988,25 @@ struct MaskLayerUserData : public LayerU
   // scale from the masked layer which is applied to the mask
   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
+ * The address of gPaintedDisplayItemLayerUserData is used as the user
  * 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 PaintedLayers in BuildLayer, if necessary,
  * and we wouldn't want to accidentally recycle those.
- * The user data is a ThebesDisplayItemLayerUserData.
+ * The user data is a PaintedDisplayItemLayerUserData.
  */
-uint8_t gThebesDisplayItemLayerUserData;
+uint8_t gPaintedDisplayItemLayerUserData;
 /**
  * The address of gColorLayerUserData is used as the user
  * data key for ColorLayers created by FrameLayerBuilder.
  * The user data is null.
  */
 uint8_t gColorLayerUserData;
 /**
  * The address of gImageLayerUserData is used as the user
@@ -1031,20 +1031,20 @@ uint8_t gMaskLayerUserData;
   * Helper functions for getting user data and casting it to the correct type.
   * aLayer is the layer where the user data is stored.
   */
 MaskLayerUserData* GetMaskLayerUserData(Layer* aLayer)
 {
   return static_cast<MaskLayerUserData*>(aLayer->GetUserData(&gMaskLayerUserData));
 }
 
-ThebesDisplayItemLayerUserData* GetThebesDisplayItemLayerUserData(Layer* aLayer)
+PaintedDisplayItemLayerUserData* GetPaintedDisplayItemLayerUserData(Layer* aLayer)
 {
-  return static_cast<ThebesDisplayItemLayerUserData*>(
-    aLayer->GetUserData(&gThebesDisplayItemLayerUserData));
+  return static_cast<PaintedDisplayItemLayerUserData*>(
+    aLayer->GetUserData(&gPaintedDisplayItemLayerUserData));
 }
 
 /* static */ void
 FrameLayerBuilder::Shutdown()
 {
   if (gMaskLayerImageCache) {
     delete gMaskLayerImageCache;
     gMaskLayerImageCache = nullptr;
@@ -1142,32 +1142,32 @@ InvalidatePostTransformRegion(PaintedLay
 #endif
 }
 
 static void
 InvalidatePostTransformRegion(PaintedLayer* aLayer, const nsRect& aRect,
                               const DisplayItemClip& aClip,
                               const nsIntPoint& aTranslation)
 {
-  ThebesDisplayItemLayerUserData* data =
-      static_cast<ThebesDisplayItemLayerUserData*>(aLayer->GetUserData(&gThebesDisplayItemLayerUserData));
+  PaintedDisplayItemLayerUserData* data =
+      static_cast<PaintedDisplayItemLayerUserData*>(aLayer->GetUserData(&gPaintedDisplayItemLayerUserData));
 
   nsRect rect = aClip.ApplyNonRoundedIntersection(aRect);
 
   nsIntRect pixelRect = rect.ScaleToOutsidePixels(data->mXScale, data->mYScale, data->mAppUnitsPerDevPixel);
   InvalidatePostTransformRegion(aLayer, pixelRect, aTranslation);
 }
 
 
 static nsIntPoint
 GetTranslationForPaintedLayer(PaintedLayer* aLayer)
 {
-  ThebesDisplayItemLayerUserData* data =
-    static_cast<ThebesDisplayItemLayerUserData*>
-      (aLayer->GetUserData(&gThebesDisplayItemLayerUserData));
+  PaintedDisplayItemLayerUserData* data =
+    static_cast<PaintedDisplayItemLayerUserData*>
+      (aLayer->GetUserData(&gPaintedDisplayItemLayerUserData));
   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).
@@ -1210,24 +1210,24 @@ FrameLayerBuilder::RemoveFrameFromLayerM
   }
 #endif
 
   for (uint32_t i = 0; i < array->Length(); ++i) {
     DisplayItemData* data = array->ElementAt(i);
 
     PaintedLayer* t = data->mLayer->AsPaintedLayer();
     if (t) {
-      ThebesDisplayItemLayerUserData* thebesData =
-          static_cast<ThebesDisplayItemLayerUserData*>(t->GetUserData(&gThebesDisplayItemLayerUserData));
-      if (thebesData) {
+      PaintedDisplayItemLayerUserData* paintedData =
+          static_cast<PaintedDisplayItemLayerUserData*>(t->GetUserData(&gPaintedDisplayItemLayerUserData));
+      if (paintedData) {
         nsRegion old = data->mGeometry->ComputeInvalidationRegion();
-        nsIntRegion rgn = old.ScaleToOutsidePixels(thebesData->mXScale, thebesData->mYScale, thebesData->mAppUnitsPerDevPixel);
+        nsIntRegion rgn = old.ScaleToOutsidePixels(paintedData->mXScale, paintedData->mYScale, paintedData->mAppUnitsPerDevPixel);
         rgn.MoveBy(-GetTranslationForPaintedLayer(t));
-        thebesData->mRegionToInvalidate.Or(thebesData->mRegionToInvalidate, rgn);
-        thebesData->mRegionToInvalidate.SimplifyOutward(8);
+        paintedData->mRegionToInvalidate.Or(paintedData->mRegionToInvalidate, rgn);
+        paintedData->mRegionToInvalidate.SimplifyOutward(8);
       }
     }
 
     data->mParent->mDisplayItems.RemoveEntry(data);
   }
 
   arrayCopy.Clear();
   delete array;
@@ -1483,54 +1483,54 @@ FrameLayerBuilder::GetDebugOldLayerFor(n
     if (data->mDisplayItemKey == aDisplayItemKey) {
       return data->mLayer;
     }
   }
   return nullptr;
 }
 
 already_AddRefed<ColorLayer>
-ContainerState::CreateOrRecycleColorLayer(PaintedLayer *aThebes)
+ContainerState::CreateOrRecycleColorLayer(PaintedLayer *aPainted)
 {
-  ThebesDisplayItemLayerUserData* data =
-      static_cast<ThebesDisplayItemLayerUserData*>(aThebes->GetUserData(&gThebesDisplayItemLayerUserData));
+  PaintedDisplayItemLayerUserData* data =
+      static_cast<PaintedDisplayItemLayerUserData*>(aPainted->GetUserData(&gPaintedDisplayItemLayerUserData));
   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
+    // Mark this layer as being used for painting display items
     data->mColorLayer = layer;
     layer->SetUserData(&gColorLayerUserData, nullptr);
 
     // Remove other layer types we might have stored for this PaintedLayer
     data->mImageLayer = nullptr;
   }
   return layer.forget();
 }
 
 already_AddRefed<ImageLayer>
-ContainerState::CreateOrRecycleImageLayer(PaintedLayer *aThebes)
+ContainerState::CreateOrRecycleImageLayer(PaintedLayer *aPainted)
 {
-  ThebesDisplayItemLayerUserData* data =
-      static_cast<ThebesDisplayItemLayerUserData*>(aThebes->GetUserData(&gThebesDisplayItemLayerUserData));
+  PaintedDisplayItemLayerUserData* data =
+      static_cast<PaintedDisplayItemLayerUserData*>(aPainted->GetUserData(&gPaintedDisplayItemLayerUserData));
   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
+    // Mark this layer as being used for painting display items
     data->mImageLayer = layer;
     layer->SetUserData(&gImageLayerUserData, nullptr);
 
     // Remove other layer types we might have stored for this PaintedLayer
     data->mColorLayer = nullptr;
   }
   return layer.forget();
 }
@@ -1608,17 +1608,17 @@ InvalidateEntirePaintedLayer(PaintedLaye
 
 already_AddRefed<PaintedLayer>
 ContainerState::CreateOrRecyclePaintedLayer(const nsIFrame* aAnimatedGeometryRoot,
                                            const nsIFrame* aReferenceFrame,
                                            const nsPoint& aTopLeft)
 {
   // We need a new painted layer
   nsRefPtr<PaintedLayer> layer;
-  ThebesDisplayItemLayerUserData* data;
+  PaintedDisplayItemLayerUserData* 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::PaintedLayerCreationHint creationHint = LayerManager::NONE;
@@ -1641,27 +1641,27 @@ ContainerState::CreateOrRecyclePaintedLa
     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));
+      data = static_cast<PaintedDisplayItemLayerUserData*>
+          (layer->GetUserData(&gPaintedDisplayItemLayerUserData));
       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 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 PaintedLayer to its new
       // transform. See nsGfxScrollFrame::InvalidateInternal, where
-      // we ensure that mInvalidThebesContent is updated according to the
+      // we ensure that mInvalidPaintedContent 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());
       }
@@ -1694,34 +1694,34 @@ ContainerState::CreateOrRecyclePaintedLa
     }
   }
 
   if (!layerRecycled) {
     // 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);
+    // Mark this layer as being used for painting display items
+    data = new PaintedDisplayItemLayerUserData();
+    layer->SetUserData(&gPaintedDisplayItemLayerUserData, data);
     ResetScrollPositionForLayerPixelAlignment(aAnimatedGeometryRoot);
 #ifndef MOZ_WIDGET_ANDROID
     didResetScrollPositionForLayerPixelAlignment = true;
 #endif
   }
   data->mXScale = mParameters.mXScale;
   data->mYScale = mParameters.mYScale;
   data->mLastAnimatedGeometryRootOrigin = data->mAnimatedGeometryRootOrigin;
   data->mAnimatedGeometryRootOrigin = aTopLeft;
   data->mAppUnitsPerDevPixel = mAppUnitsPerDevPixel;
   layer->SetAllowResidualTranslation(mParameters.AllowResidualTranslation());
 
   mLayerBuilder->SavePreviousDataForLayer(layer, data->mMaskClipCount);
 
-  // Set up transform so that 0,0 in the Thebes layer corresponds to the
+  // Set up transform so that 0,0 in the Painted layer corresponds to the
   // (pixel-snapped) top-left of the aAnimatedGeometryRoot.
   nsPoint offset = aAnimatedGeometryRoot->GetOffsetToCrossDoc(aReferenceFrame);
   nscoord appUnitsPerDevPixel = aAnimatedGeometryRoot->PresContext()->AppUnitsPerDevPixel();
   gfxPoint scaledOffset(
       NSAppUnitsToDoublePixels(offset.x, appUnitsPerDevPixel)*mParameters.mXScale,
       NSAppUnitsToDoublePixels(offset.y, appUnitsPerDevPixel)*mParameters.mYScale);
   // We call RoundToMatchResidual here so that the residual after rounding
   // is close to data->mAnimatedGeometryRootPosition if possible.
@@ -1830,17 +1830,17 @@ ContainerState::SetOuterVisibleRegionFor
 
 nscolor
 ContainerState::FindOpaqueBackgroundColorFor(int32_t aPaintedLayerIndex)
 {
   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
+      // Some non-PaintedLayer content between target and candidate; this is
       // hopeless
       break;
     }
 
     nsIntRegion intersection;
     intersection.And(candidate->mVisibleRegion, target->mVisibleRegion);
     if (intersection.IsEmpty()) {
       // The layer doesn't intersect our target, ignore it and move on
@@ -2088,18 +2088,18 @@ ContainerState::PopPaintedLayerData()
                                      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",
+  FLB_LOG_PAINTED_LAYER_DECISION(data, "Selecting layer for tld=%p\n", data);
+  FLB_LOG_PAINTED_LAYER_DECISION(data, "  Solid=%i, hasImage=%i, canOptimizeAwayPaintedLayer=%i\n",
           data->mIsSolidColorInVisibleRegion, !!imageContainer,
           CanOptimizeAwayPaintedLayer(data, mLayerBuilder));
 
   if ((data->mIsSolidColorInVisibleRegion || imageContainer) &&
       CanOptimizeAwayPaintedLayer(data, mLayerBuilder)) {
     NS_ASSERTION(!(data->mIsSolidColorInVisibleRegion && imageContainer),
                  "Can't be a solid color as well as an image!");
     if (imageContainer) {
@@ -2113,37 +2113,37 @@ ContainerState::PopPaintedLayerData()
         clip.MoveBy(mParameters.mOffset);
         imageLayer->SetClipRect(&clip);
       } else {
         imageLayer->SetClipRect(nullptr);
       }
       layer = imageLayer;
       mLayerBuilder->StoreOptimizedLayerForFrame(data->mImage,
                                                  imageLayer);
-      FLB_LOG_THEBES_DECISION(data, "  Selected image layer=%p\n", layer.get());
+      FLB_LOG_PAINTED_LAYER_DECISION(data, "  Selected image layer=%p\n", layer.get());
     } else {
       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(-GetTranslationForPaintedLayer(data->mLayer));
       colorLayer->SetBounds(visibleRect);
 
       layer = colorLayer;
-      FLB_LOG_THEBES_DECISION(data, "  Selected color layer=%p\n", layer.get());
+      FLB_LOG_PAINTED_LAYER_DECISION(data, "  Selected color layer=%p\n", layer.get());
     }
 
     NS_ASSERTION(FindIndexOfLayerIn(mNewChildLayers, layer) < 0,
                  "Layer already in list???");
     NS_ASSERTION(newLayerEntry->mLayer == data->mLayer,
-                 "Thebes layer at wrong index");
+                 "Painted 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 PaintedLayer. We leave it in the layer tree so that we
@@ -2152,17 +2152,17 @@ ContainerState::PopPaintedLayerData()
     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 painted layer=%p\n", layer.get());
+    FLB_LOG_PAINTED_LAYER_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 {
@@ -2188,18 +2188,18 @@ ContainerState::PopPaintedLayerData()
     if (!isOpaque) {
       backgroundColor = FindOpaqueBackgroundColorFor(lastIndex);
       if (NS_GET_A(backgroundColor) == 255) {
         isOpaque = true;
       }
     }
 
     // Store the background color
-    ThebesDisplayItemLayerUserData* userData =
-      GetThebesDisplayItemLayerUserData(data->mLayer);
+    PaintedDisplayItemLayerUserData* userData =
+      GetPaintedDisplayItemLayerUserData(data->mLayer);
     NS_ASSERTION(userData, "where did our user data go?");
     if (userData->mForcedBackgroundColor != backgroundColor) {
       // 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);
@@ -2326,17 +2326,17 @@ IsItemAreaInWindowOpaqueRegion(nsDisplay
 void
 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);
+  FLB_LOG_PAINTED_LAYER_DECISION(this, "Accumulating dp=%s(%p), f=%p against tld=%p\n", aItem->Name(), aItem, aItem->Frame(), this);
 
   bool snap;
   nsRect itemBounds = aItem->GetBounds(aState->mBuilder, &snap);
   mBounds.OrWith(aState->ScaleToOutsidePixels(itemBounds, snap));
 
   if (aState->mBuilder->NeedToForceTransparentSurfaceForItem(aItem)) {
     mForceTransparentSurface = true;
   }
@@ -2366,19 +2366,19 @@ PaintedLayerData::Accumulate(ContainerSt
 
   /* Mark as available for conversion to image layer if this is a nsDisplayImage and
    * it's the only thing visible in this layer.
    */
   if (nsIntRegion(aVisibleRect).Contains(mVisibleRegion) &&
       aClippedOpaqueRegion.Contains(mVisibleRegion) &&
       aItem->SupportsOptimizingToImage()) {
     mImage = static_cast<nsDisplayImageContainer*>(aItem);
-    FLB_LOG_THEBES_DECISION(this, "  Tracking image: nsDisplayImageContainer covers the layer\n");
+    FLB_LOG_PAINTED_LAYER_DECISION(this, "  Tracking image: nsDisplayImageContainer covers the layer\n");
   } else if (mImage) {
-    FLB_LOG_THEBES_DECISION(this, "  No longer tracking image\n");
+    FLB_LOG_PAINTED_LAYER_DECISION(this, "  No longer tracking image\n");
     mImage = nullptr;
   }
 
   nscolor uniformColor;
   bool isUniform = aItem->IsUniform(aState->mBuilder, &uniformColor);
 
   // Some display items have to exist (so they can set forceTransparentSurface
   // below) but don't draw anything. They'll return true for isUniform but
@@ -2387,35 +2387,35 @@ PaintedLayerData::Accumulate(ContainerSt
     // Make sure that the visible area is covered by uniform pixels. In
     // particular this excludes cases where the edges of the item are not
     // pixel-aligned (thus the item will not be truly uniform).
     if (isUniform) {
       bool snap;
       nsRect bounds = aItem->GetBounds(aState->mBuilder, &snap);
       if (!aState->ScaleToInsidePixels(bounds, snap).Contains(aVisibleRect)) {
         isUniform = false;
-        FLB_LOG_THEBES_DECISION(this, "  Display item does not cover the visible rect\n");
+        FLB_LOG_PAINTED_LAYER_DECISION(this, "  Display item does not cover the visible rect\n");
       }
     }
     if (isUniform) {
       if (mVisibleRegion.IsEmpty()) {
         // This color is all we have
         mSolidColor = uniformColor;
         mIsSolidColorInVisibleRegion = true;
       } else if (mIsSolidColorInVisibleRegion &&
                  mVisibleRegion.IsEqual(nsIntRegion(aVisibleRect)) &&
                  clipMatches) {
         // we can just blend the colors together
         mSolidColor = NS_ComposeColors(mSolidColor, uniformColor);
       } else {
-        FLB_LOG_THEBES_DECISION(this, "  Layer not a solid color: Can't blend colors togethers\n");
+        FLB_LOG_PAINTED_LAYER_DECISION(this, "  Layer not a solid color: Can't blend colors togethers\n");
         mIsSolidColorInVisibleRegion = false;
       }
     } else {
-      FLB_LOG_THEBES_DECISION(this, "  Layer is not a solid color: Display item is not uniform over the visible bound\n");
+      FLB_LOG_PAINTED_LAYER_DECISION(this, "  Layer is not a solid color: Display item is not uniform over the visible bound\n");
       mIsSolidColorInVisibleRegion = false;
     }
 
     mVisibleRegion.Or(mVisibleRegion, aVisibleRect);
     mVisibleRegion.SimplifyOutward(4);
     mDrawRegion.Or(mDrawRegion, aDrawRect);
     mDrawRegion.SimplifyOutward(4);
   }
@@ -2720,17 +2720,17 @@ 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 PaintedLayers where an item
  * has moved from one PaintedLayer to another. Also,
- * aState->mInvalidThebesContent is invalidated in every PaintedLayer.
+ * aState->mInvalidPaintedContent 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.
  * (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 PaintedLayers is deferred until the calling
  * of ContainerState::Finish.
  */
@@ -2889,17 +2889,17 @@ ContainerState::ProcessDisplayItems(nsDi
       nsIntRect layerContentsVisibleRect(0, 0, -1, -1);
       mParameters.mLayerContentsVisibleRect = &layerContentsVisibleRect;
       nsRefPtr<Layer> ownLayer = item->BuildLayer(mBuilder, mManager, mParameters);
       if (!ownLayer) {
         continue;
       }
 
       NS_ASSERTION(!ownLayer->AsPaintedLayer(),
-                   "Should never have created a dedicated Thebes layer!");
+                   "Should never have created a dedicated Painted layer!");
 
       const nsIFrame* fixedPosFrame =
         FindFixedPosFrameForLayerData(animatedGeometryRoot, shouldFixToViewport);
       if (fixedPosFrame) {
         nsIntRegion visibleRegion(itemVisibleRect);
         AdjustLayerDataForFixedPositioning(fixedPosFrame,
                                            nsIntRegion(itemDrawRect), &visibleRegion);
         itemVisibleRect = visibleRegion.GetBounds();
@@ -3035,17 +3035,17 @@ ContainerState::ProcessDisplayItems(nsDi
                                                 eventRegions->DispatchToContentHitRegion());
       } else {
         // check to see if the new item has rounded rect clips in common with
         // other items in the layer
         paintedLayerData->UpdateCommonClipCount(itemClip);
 
         InvalidateForLayerChange(item, paintedLayerData->mLayer);
 
-        mLayerBuilder->AddThebesDisplayItem(paintedLayerData, item, itemClip, itemVisibleRect,
+        mLayerBuilder->AddPaintedDisplayItem(paintedLayerData, item, itemClip, itemVisibleRect,
                                             *this, layerState, topLeft);
         nsIntRegion opaquePixels = ComputeOpaqueRect(item,
             animatedGeometryRoot, paintedLayerData->mFixedPosFrameForLayerData,
             itemClip, aList,
             &paintedLayerData->mHideAllLayersBelow,
             &paintedLayerData->mOpaqueForAnimatedGeometryRootParent);
         paintedLayerData->Accumulate(this, item, opaquePixels,
             itemVisibleRect, itemDrawRect, itemClip);
@@ -3103,31 +3103,31 @@ FrameLayerBuilder::ComputeGeometryChange
     aData->EndUpdate();
     return;
   }
 
   PaintedLayerItemsEntry* entry = mPaintedLayerItems.GetEntry(paintedLayer);
 
   nsAutoPtr<nsDisplayItemGeometry> geometry(item->AllocateGeometry(mDisplayListBuilder));
 
-  ThebesDisplayItemLayerUserData* layerData =
-    static_cast<ThebesDisplayItemLayerUserData*>(aData->mLayer->GetUserData(&gThebesDisplayItemLayerUserData));
+  PaintedDisplayItemLayerUserData* layerData =
+    static_cast<PaintedDisplayItemLayerUserData*>(aData->mLayer->GetUserData(&gPaintedDisplayItemLayerUserData));
   nsPoint shift = layerData->mAnimatedGeometryRootOrigin - layerData->mLastAnimatedGeometryRootOrigin;
 
   const DisplayItemClip& clip = item->GetClip();
 
   // If the frame is marked as invalidated, and didn't specify a rect to invalidate  then we want to
   // invalidate both the old and new bounds, otherwise we only want to invalidate the changed areas.
   // If we do get an invalid rect, then we want to add this on top of the change areas.
   nsRect invalid;
   nsRegion combined;
   bool notifyRenderingChanged = true;
   if (!aData->mGeometry) {
     // This item is being added for the first time, invalidate its entire area.
-    //TODO: We call GetGeometry again in AddThebesDisplayItem, we should reuse this.
+    //TODO: We call GetGeometry again in AddPaintedDisplayItem, we should reuse this.
     combined = clip.ApplyNonRoundedIntersection(geometry->ComputeInvalidationRegion());
 #ifdef MOZ_DUMP_PAINTING
     if (nsLayoutUtils::InvalidationDebuggingIsEnabled()) {
       printf_stderr("Display item type %s(%p) added to layer %p!\n", item->Name(), item->Frame(), aData->mLayer.get());
     }
 #endif
   } else if (aData->mIsInvalid || (item->IsInvalid(invalid) && invalid.IsEmpty())) {
     // Either layout marked item as needing repainting, invalidate the entire old and new areas.
@@ -3194,28 +3194,28 @@ FrameLayerBuilder::ComputeGeometryChange
         combined.ScaleToOutsidePixels(layerData->mXScale, layerData->mYScale, layerData->mAppUnitsPerDevPixel),
         layerData->mTranslation);
   }
 
   aData->EndUpdate(geometry);
 }
 
 void
-FrameLayerBuilder::AddThebesDisplayItem(PaintedLayerData* aLayerData,
+FrameLayerBuilder::AddPaintedDisplayItem(PaintedLayerData* aLayerData,
                                         nsDisplayItem* aItem,
                                         const DisplayItemClip& aClip,
                                         const nsIntRect& aItemVisibleRect,
                                         const ContainerState& aContainerState,
                                         LayerState aLayerState,
                                         const nsPoint& aTopLeft)
 {
   PaintedLayer* layer = aLayerData->mLayer;
-  ThebesDisplayItemLayerUserData* thebesData =
-    static_cast<ThebesDisplayItemLayerUserData*>
-      (layer->GetUserData(&gThebesDisplayItemLayerUserData));
+  PaintedDisplayItemLayerUserData* paintedData =
+    static_cast<PaintedDisplayItemLayerUserData*>
+      (layer->GetUserData(&gPaintedDisplayItemLayerUserData));
   nsRefPtr<BasicLayerManager> tempManager;
   nsIntRect intClip;
   bool hasClip = false;
   if (aLayerState != LAYER_NONE) {
     DisplayItemData *data = GetDisplayItemDataForManager(aItem, layer->Manager());
     if (data) {
       tempManager = data->mInactiveManager;
     }
@@ -3223,23 +3223,23 @@ FrameLayerBuilder::AddThebesDisplayItem(
       tempManager = new BasicLayerManager(BasicLayerManager::BLM_INACTIVE);
     }
 
     // We need to grab these before calling AddLayerDisplayItem because it will overwrite them.
     nsRegion clip;
     DisplayItemClip* oldClip = nullptr;
     GetOldLayerFor(aItem, nullptr, &oldClip);
     hasClip = aClip.ComputeRegionInClips(oldClip,
-                                         aTopLeft - thebesData->mLastAnimatedGeometryRootOrigin,
+                                         aTopLeft - paintedData->mLastAnimatedGeometryRootOrigin,
                                          &clip);
 
     if (hasClip) {
-      intClip = clip.GetBounds().ScaleToOutsidePixels(thebesData->mXScale,
-                                                      thebesData->mYScale,
-                                                      thebesData->mAppUnitsPerDevPixel);
+      intClip = clip.GetBounds().ScaleToOutsidePixels(paintedData->mXScale,
+                                                      paintedData->mYScale,
+                                                      paintedData->mAppUnitsPerDevPixel);
     }
   }
 
   AddLayerDisplayItem(layer, aItem, aLayerState, aTopLeft, tempManager);
 
   PaintedLayerItemsEntry* entry = mPaintedLayerItems.PutEntry(layer);
   if (entry) {
     entry->mContainerLayerFrame = aContainerState.GetContainerFrame();
@@ -3264,17 +3264,17 @@ FrameLayerBuilder::AddThebesDisplayItem(
         tempManager->EndTransaction(nullptr, nullptr);
         tempManager->SetUserData(&gLayerManagerLayerBuilder, nullptr);
         return;
       }
 
       bool snap;
       nsRect visibleRect =
         aItem->GetVisibleRect().Intersect(aItem->GetBounds(mDisplayListBuilder, &snap));
-      nsIntRegion rgn = visibleRect.ToOutsidePixels(thebesData->mAppUnitsPerDevPixel);
+      nsIntRegion rgn = visibleRect.ToOutsidePixels(paintedData->mAppUnitsPerDevPixel);
       SetOuterVisibleRegion(tmpLayer, &rgn);
 
       // If BuildLayer didn't call BuildContainerLayerFor, then our new layer won't have been
       // stored in layerBuilder. Manually add it now.
       if (mRetainingManager) {
 #ifdef DEBUG_DISPLAY_ITEM_DATA
         LayerManagerData* parentLmd = static_cast<LayerManagerData*>
           (layer->Manager()->GetUserData(&gLayerManagerUserData));
@@ -3298,17 +3298,17 @@ FrameLayerBuilder::AddThebesDisplayItem(
                                                                         invalid);
       }
       if (!invalid.IsEmpty()) {
 #ifdef MOZ_DUMP_PAINTING
         if (nsLayoutUtils::InvalidationDebuggingIsEnabled()) {
           printf_stderr("Inactive LayerManager(%p) for display item %s(%p) has an invalid region - invalidating layer %p\n", tempManager.get(), aItem->Name(), aItem->Frame(), layer);
         }
 #endif
-        invalid.ScaleRoundOut(thebesData->mXScale, thebesData->mYScale);
+        invalid.ScaleRoundOut(paintedData->mXScale, paintedData->mYScale);
 
         if (hasClip) {
           invalid.And(invalid, intClip);
         }
 
         InvalidatePostTransformRegion(layer, invalid,
                                       GetTranslationForPaintedLayer(layer));
       }
@@ -3432,17 +3432,17 @@ 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)) {
+    if (layer->HasUserData(&gPaintedDisplayItemLayerUserData)) {
       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));
@@ -3916,17 +3916,17 @@ FrameLayerBuilder::BuildContainerLayerFo
       DisplayItemData *data = GetOldLayerForFrame(aContainerFrame, containerDisplayItemKey);
       if (data) {
         oldLayer = data->mLayer;
       }
     }
 
     if (oldLayer) {
       NS_ASSERTION(oldLayer->Manager() == aManager, "Wrong manager");
-      if (oldLayer->HasUserData(&gThebesDisplayItemLayerUserData)) {
+      if (oldLayer->HasUserData(&gPaintedDisplayItemLayerUserData)) {
         // 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);
@@ -4062,17 +4062,17 @@ FrameLayerBuilder::BuildContainerLayerFo
 
 Layer*
 FrameLayerBuilder::GetLeafLayerFor(nsDisplayListBuilder* aBuilder,
                                    nsDisplayItem* aItem)
 {
   Layer* layer = GetOldLayerFor(aItem);
   if (!layer)
     return nullptr;
-  if (layer->HasUserData(&gThebesDisplayItemLayerUserData)) {
+  if (layer->HasUserData(&gPaintedDisplayItemLayerUserData)) {
     // This layer was created to render Thebes-rendered content for this
     // display item. The display item should not use it for its own
     // layer rendering.
     return nullptr;
   }
   layer->SetMaskLayer(nullptr);
   return layer;
 }
@@ -4118,17 +4118,17 @@ FrameLayerBuilder::GetDedicatedLayer(nsI
       if (element->mDisplayItemKey == aDisplayItemKey) {
         if (element->mOptLayer) {
           return element->mOptLayer;
         }
 
         Layer* layer = element->mLayer;
         if (!layer->HasUserData(&gColorLayerUserData) &&
             !layer->HasUserData(&gImageLayerUserData) &&
-            !layer->HasUserData(&gThebesDisplayItemLayerUserData)) {
+            !layer->HasUserData(&gPaintedDisplayItemLayerUserData)) {
           return layer;
         }
       }
     }
   }
   return nullptr;
 }
 
@@ -4172,19 +4172,19 @@ FrameLayerBuilder::GetPaintedLayerScaleF
     for (uint32_t i = 0; i < array->Length(); i++) {
       Layer* layer = array->ElementAt(i)->mLayer;
       ContainerLayer* container = layer->AsContainerLayer();
       if (!container ||
           !layer->Manager()->IsWidgetLayerManager()) {
         continue;
       }
       for (Layer* l = container->GetFirstChild(); l; l = l->GetNextSibling()) {
-        ThebesDisplayItemLayerUserData* data =
-            static_cast<ThebesDisplayItemLayerUserData*>
-              (l->GetUserData(&gThebesDisplayItemLayerUserData));
+        PaintedDisplayItemLayerUserData* data =
+            static_cast<PaintedDisplayItemLayerUserData*>
+              (l->GetUserData(&gPaintedDisplayItemLayerUserData));
         if (data) {
           return PredictScaleForContent(aFrame, f, gfxSize(data->mXScale, data->mYScale));
         }
       }
     }
   }
 
   return PredictScaleForContent(aFrame, last,
@@ -4439,19 +4439,19 @@ FrameLayerBuilder::DrawPaintedLayer(Pain
 
   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*>
-      (aLayer->GetUserData(&gThebesDisplayItemLayerUserData));
+  PaintedDisplayItemLayerUserData* userData =
+    static_cast<PaintedDisplayItemLayerUserData*>
+      (aLayer->GetUserData(&gPaintedDisplayItemLayerUserData));
   NS_ASSERTION(userData, "where did our user data go?");
 
   bool shouldDrawRectsSeparately = ShouldDrawRectsSeparately(aContext, aClip);
 
   if (!shouldDrawRectsSeparately) {
     if (aClip == DrawRegionClip::DRAW_SNAPPED) {
       gfxUtils::ClipToRegionSnapped(aContext, aRegionToDraw);
     } else if (aClip == DrawRegionClip::DRAW) {
@@ -4573,63 +4573,63 @@ CalculateBounds(const nsTArray<DisplayIt
   for (uint32_t i = 1; i < aRects.Length(); ++i) {
     bounds.UnionRect(bounds, aRects[i].mRect);
    }
 
   return gfx::ToRect(nsLayoutUtils::RectToGfxRect(bounds, A2D));
 }
 
 static void
-SetClipCount(ThebesDisplayItemLayerUserData* aThebesData,
+SetClipCount(PaintedDisplayItemLayerUserData* apaintedData,
              uint32_t aClipCount)
 {
-  if (aThebesData) {
-    aThebesData->mMaskClipCount = aClipCount;
+  if (apaintedData) {
+    apaintedData->mMaskClipCount = aClipCount;
   }
 }
 
 void
 ContainerState::SetupMaskLayer(Layer *aLayer,
                                const DisplayItemClip& aClip,
                                const nsIntRegion& aLayerVisibleRegion,
                                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) {
-    PaintedLayer* thebes = aLayer->AsPaintedLayer();
-    thebes->InvalidateRegion(thebes->GetValidRegion().GetBounds());
+  PaintedDisplayItemLayerUserData* paintedData = GetPaintedDisplayItemLayerUserData(aLayer);
+  if (paintedData &&
+      aRoundedRectClipCount < paintedData->mMaskClipCount) {
+    PaintedLayer* painted = aLayer->AsPaintedLayer();
+    painted->InvalidateRegion(painted->GetValidRegion().GetBounds());
   }
 
   // don't build an unnecessary mask
   nsIntRect layerBounds = aLayerVisibleRegion.GetBounds();
   if (aClip.GetRoundedRectCount() == 0 ||
       aRoundedRectClipCount == 0 ||
       layerBounds.IsEmpty()) {
-    SetClipCount(thebesData, 0);
+    SetClipCount(paintedData, 0);
     return;
   }
 
   // check if we can re-use the mask layer
   nsRefPtr<ImageLayer> maskLayer =  CreateOrRecycleMaskImageLayerFor(aLayer);
   MaskLayerUserData* userData = GetMaskLayerUserData(maskLayer);
 
   MaskLayerUserData newData;
   aClip.AppendRoundedRects(&newData.mRoundedClipRects, aRoundedRectClipCount);
   newData.mScaleX = mParameters.mXScale;
   newData.mScaleY = mParameters.mYScale;
   newData.mOffset = mParameters.mOffset;
   newData.mAppUnitsPerDevPixel = mContainerFrame->PresContext()->AppUnitsPerDevPixel();
 
   if (*userData == newData) {
     aLayer->SetMaskLayer(maskLayer);
-    SetClipCount(thebesData, aRoundedRectClipCount);
+    SetClipCount(paintedData, aRoundedRectClipCount);
     return;
   }
 
   // calculate a more precise bounding rect
   gfx::Rect boundingRect = CalculateBounds(newData.mRoundedClipRects,
                                            newData.mAppUnitsPerDevPixel);
   boundingRect.Scale(mParameters.mXScale, mParameters.mYScale);
 
@@ -4673,17 +4673,17 @@ ContainerState::SetupMaskLayer(Layer *aL
                            NSToIntCeil(surfaceSize.height));
     // no existing mask image, so build a new one
     RefPtr<DrawTarget> dt =
       aLayer->Manager()->CreateOptimalMaskDrawTarget(surfaceSizeInt);
 
     // fail if we can't get the right surface
     if (!dt) {
       NS_WARNING("Could not create DrawTarget for mask layer.");
-      SetClipCount(thebesData, 0);
+      SetClipCount(paintedData, 0);
       return;
     }
 
     nsRefPtr<gfxContext> context = new gfxContext(dt);
     context->Multiply(ThebesMatrix(imageTransform));
 
     // paint the clipping rects with alpha to create the mask
     context->SetColor(gfxRGBA(1, 1, 1, 1));
@@ -4720,13 +4720,13 @@ ContainerState::SetupMaskLayer(Layer *aL
   userData->mScaleX = newData.mScaleX;
   userData->mScaleY = newData.mScaleY;
   userData->mOffset = newData.mOffset;
   userData->mAppUnitsPerDevPixel = newData.mAppUnitsPerDevPixel;
   userData->mRoundedClipRects.SwapElements(newData.mRoundedClipRects);
   userData->mImageKey = lookupKey;
 
   aLayer->SetMaskLayer(maskLayer);
-  SetClipCount(thebesData, aRoundedRectClipCount);
+  SetClipCount(paintedData, aRoundedRectClipCount);
   return;
 }
 
 } // namespace mozilla
--- a/layout/base/FrameLayerBuilder.h
+++ b/layout/base/FrameLayerBuilder.h
@@ -130,17 +130,17 @@ struct ContainerLayerParameters {
  * 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 PaintedLayers so that 0,0 in the Thebes layer
+ * FrameLayerBuilder sets up PaintedLayers so that 0,0 in the Painted 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 PaintedLayer
@@ -244,17 +244,17 @@ public:
   /**
    * Call this to force all retained layers to be discarded and recreated at
    * the next paint.
    */
   static void InvalidateAllLayers(LayerManager* aManager);
   static void InvalidateAllLayersForFrame(nsIFrame *aFrame);
 
   /**
-   * Call this to determine if a frame has a dedicated (non-Thebes) layer
+   * Call this to determine if a frame has a dedicated (non-Painted) layer
    * for the given display item key. If there isn't one, we return null,
    * otherwise we return the layer.
    */
   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.
@@ -299,17 +299,17 @@ public:
 
   /**
    * 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(PaintedLayerData* aLayer,
+  void AddPaintedDisplayItem(PaintedLayerData* aLayer,
                             nsDisplayItem* aItem,
                             const DisplayItemClip& aClip,
                             const nsIntRect& aItemVisibleRect,
                             const ContainerState& aContainerState,
                             LayerState aLayerState,
                             const nsPoint& aTopLeft);
 
   /**
--- a/layout/generic/nsPluginFrame.cpp
+++ b/layout/generic/nsPluginFrame.cpp
@@ -359,17 +359,17 @@ nsPluginFrame::PrepForDrawing(nsIWidget 
     parentWidget->ConfigureChildren(configurations);
 
     nsRefPtr<nsDeviceContext> dx = viewMan->GetDeviceContext();
     mInnerView->AttachWidgetEventHandler(mWidget);
 
 #ifdef XP_MACOSX
     // On Mac, we need to invalidate ourselves since even windowed
     // plugins are painted through Thebes and we need to ensure
-    // the Thebes layer containing the plugin is updated.
+    // the PaintedLayer containing the plugin is updated.
     if (parentWidget == GetNearestWidget()) {
       InvalidateFrame();
     }
 #endif
 
     RegisterPluginForGeometryUpdates();
 
     // Here we set the background color for this widget because some plugins will use