Changeset 90859 in webkit
- Timestamp:
- Jul 12, 2011 3:17:19 PM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 4 deleted
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r90856 r90859 1 2011-07-12 Sheriff Bot <webkit.review.bot@gmail.com> 2 3 Unreviewed, rolling out r90842. 4 http://trac.webkit.org/changeset/90842 5 https://bugs.webkit.org/show_bug.cgi?id=64401 6 7 Causes crash in debug on compositing/overflow/content-gains- 8 scrollbars.html (Requested by jamesr on #webkit). 9 10 * WebCore.gypi: 11 * platform/graphics/chromium/ContentLayerChromium.cpp: 12 (WebCore::ContentLayerChromium::ContentLayerChromium): 13 (WebCore::ContentLayerChromium::paintContentsIfDirty): 14 (WebCore::ContentLayerChromium::cleanupResources): 15 (WebCore::ContentLayerChromium::setLayerRenderer): 16 (WebCore::ContentLayerChromium::tilingTransform): 17 (WebCore::ContentLayerChromium::contentBounds): 18 (WebCore::ContentLayerChromium::updateLayerSize): 19 (WebCore::ContentLayerChromium::draw): 20 (WebCore::ContentLayerChromium::drawsContent): 21 (WebCore::ContentLayerChromium::createTilerIfNeeded): 22 (WebCore::ContentLayerChromium::updateCompositorResources): 23 (WebCore::ContentLayerChromium::setTilingOption): 24 (WebCore::ContentLayerChromium::bindContentsTexture): 25 (WebCore::ContentLayerChromium::setIsMask): 26 (WebCore::writeIndent): 27 (WebCore::ContentLayerChromium::dumpLayerProperties): 28 * platform/graphics/chromium/ContentLayerChromium.h: 29 * platform/graphics/chromium/ImageLayerChromium.cpp: 30 (WebCore::ImageLayerChromium::ImageLayerChromium): 31 (WebCore::ImageLayerChromium::paintContentsIfDirty): 32 (WebCore::ImageLayerChromium::updateCompositorResources): 33 (WebCore::ImageLayerChromium::contentBounds): 34 * platform/graphics/chromium/ImageLayerChromium.h: 35 (WebCore::ImageLayerChromium::drawsContent): 36 * platform/graphics/chromium/LayerChromium.cpp: 37 (WebCore::LayerChromium::pushPropertiesTo): 38 (WebCore::LayerChromium::ccLayerImpl): 39 * platform/graphics/chromium/LayerChromium.h: 40 (WebCore::LayerChromium::draw): 41 * platform/graphics/chromium/LayerRendererChromium.cpp: 42 (WebCore::LayerRendererChromium::drawRootLayer): 43 * platform/graphics/chromium/LayerTilerChromium.cpp: 44 (WebCore::LayerTilerChromium::updateRect): 45 (WebCore::LayerTilerChromium::draw): 46 (WebCore::LayerTilerChromium::drawTiles): 47 * platform/graphics/chromium/LayerTilerChromium.h: 48 * platform/graphics/chromium/TiledLayerChromium.cpp: Removed. 49 * platform/graphics/chromium/TiledLayerChromium.h: Removed. 50 * platform/graphics/chromium/cc/CCLayerImpl.cpp: 51 (WebCore::CCLayerImpl::drawsContent): 52 (WebCore::CCLayerImpl::draw): 53 * platform/graphics/chromium/cc/CCLayerImpl.h: 54 * platform/graphics/chromium/cc/CCTiledLayerImpl.cpp: Removed. 55 * platform/graphics/chromium/cc/CCTiledLayerImpl.h: Removed. 56 1 57 2011-07-12 Joseph Pecoraro <joepeck@webkit.org> 2 58 -
trunk/Source/WebCore/WebCore.gypi
r90849 r90859 4141 4141 'platform/graphics/chromium/TextureManager.cpp', 4142 4142 'platform/graphics/chromium/TextureManager.h', 4143 'platform/graphics/chromium/TiledLayerChromium.cpp',4144 'platform/graphics/chromium/TiledLayerChromium.h',4145 4143 'platform/graphics/chromium/TransparencyWin.cpp', 4146 4144 'platform/graphics/chromium/TransparencyWin.h', … … 4184 4182 'platform/graphics/chromium/cc/CCThread.h', 4185 4183 'platform/graphics/chromium/cc/CCThreadTask.h', 4186 'platform/graphics/chromium/cc/CCTiledLayerImpl.cpp',4187 'platform/graphics/chromium/cc/CCTiledLayerImpl.h',4188 4184 'platform/graphics/chromium/cc/CCVideoLayerImpl.cpp', 4189 4185 'platform/graphics/chromium/cc/CCVideoLayerImpl.h', -
trunk/Source/WebCore/platform/graphics/chromium/ContentLayerChromium.cpp
r90842 r90859 35 35 #include "ContentLayerChromium.h" 36 36 37 #include "cc/CCLayerImpl.h" 38 #include "GraphicsContext3D.h" 37 39 #include "LayerPainterChromium.h" 38 40 #include "LayerRendererChromium.h" 41 #include "LayerTexture.h" 39 42 #include "LayerTextureUpdaterCanvas.h" 43 #include "LayerTilerChromium.h" 40 44 #include "PlatformBridge.h" 45 #include "RenderLayerBacking.h" 46 #include "TextStream.h" 41 47 #include <wtf/CurrentTime.h> 48 49 // Start tiling when the width and height of a layer are larger than this size. 50 static int maxUntiledSize = 510; 51 52 // When tiling is enabled, use tiles of this dimension squared. 53 static int defaultTileSize = 256; 54 55 using namespace std; 42 56 43 57 namespace WebCore { … … 77 91 78 92 ContentLayerChromium::ContentLayerChromium(GraphicsLayerChromium* owner) 79 : TiledLayerChromium(owner) 93 : LayerChromium(owner) 94 , m_tilingOption(ContentLayerChromium::AutoTile) 95 , m_borderTexels(true) 80 96 { 81 97 } … … 91 107 ASSERT(layerRenderer()); 92 108 93 update TileSizeAndTilingOption();109 updateLayerSize(); 94 110 95 111 const IntRect& layerRect = visibleLayerRect(); … … 104 120 return; 105 121 106 m_tiler->prepareToUpdate(layerRect, textureUpdater());122 m_tiler->prepareToUpdate(layerRect, m_textureUpdater.get()); 107 123 m_dirtyRect = FloatRect(); 108 124 } 109 125 110 bool ContentLayerChromium::drawsContent() const 111 { 112 return m_owner && m_owner->drawsContent() && TiledLayerChromium::drawsContent(); 126 void ContentLayerChromium::cleanupResources() 127 { 128 m_textureUpdater.clear(); 129 m_tiler.clear(); 130 LayerChromium::cleanupResources(); 131 } 132 133 void ContentLayerChromium::setLayerRenderer(LayerRendererChromium* layerRenderer) 134 { 135 LayerChromium::setLayerRenderer(layerRenderer); 136 createTilerIfNeeded(); 113 137 } 114 138 … … 126 150 } 127 151 152 TransformationMatrix ContentLayerChromium::tilingTransform() 153 { 154 TransformationMatrix transform = ccLayerImpl()->drawTransform(); 155 156 if (contentBounds().isEmpty()) 157 return transform; 158 159 transform.scaleNonUniform(bounds().width() / static_cast<double>(contentBounds().width()), 160 bounds().height() / static_cast<double>(contentBounds().height())); 161 162 // Tiler draws with a different origin from other layers. 163 transform.translate(-contentBounds().width() / 2.0, -contentBounds().height() / 2.0); 164 165 return transform; 166 } 167 168 IntSize ContentLayerChromium::contentBounds() const 169 { 170 return bounds(); 171 } 172 173 void ContentLayerChromium::updateLayerSize() 174 { 175 if (!m_tiler) 176 return; 177 178 const IntSize tileSize(defaultTileSize, defaultTileSize); 179 180 // Tile if both dimensions large, or any one dimension large and the other 181 // extends into a second tile. This heuristic allows for long skinny layers 182 // (e.g. scrollbars) that are Nx1 tiles to minimize wasted texture space. 183 const bool anyDimensionLarge = contentBounds().width() > maxUntiledSize || contentBounds().height() > maxUntiledSize; 184 const bool anyDimensionOneTile = contentBounds().width() <= defaultTileSize || contentBounds().height() <= defaultTileSize; 185 const bool autoTiled = anyDimensionLarge && !anyDimensionOneTile; 186 187 bool isTiled; 188 if (m_tilingOption == AlwaysTile) 189 isTiled = true; 190 else if (m_tilingOption == NeverTile) 191 isTiled = false; 192 else 193 isTiled = autoTiled; 194 195 // Empty tile size tells the tiler to avoid tiling. 196 IntSize requestedSize = isTiled ? tileSize : IntSize(); 197 const int maxSize = layerRenderer()->maxTextureSize(); 198 IntSize clampedSize = requestedSize.shrunkTo(IntSize(maxSize, maxSize)); 199 m_tiler->setTileSize(clampedSize); 200 } 201 202 void ContentLayerChromium::draw() 203 { 204 const IntRect& layerRect = visibleLayerRect(); 205 if (!layerRect.isEmpty()) 206 m_tiler->draw(layerRect, tilingTransform(), ccLayerImpl()->drawOpacity(), m_textureUpdater.get()); 207 } 208 209 bool ContentLayerChromium::drawsContent() const 210 { 211 if (!m_owner || !m_owner->drawsContent()) 212 return false; 213 214 if (!m_tiler) 215 return true; 216 217 if (m_tilingOption == NeverTile && m_tiler->numTiles() > 1) 218 return false; 219 220 return !m_tiler->skipsDraw(); 221 } 222 223 void ContentLayerChromium::createTilerIfNeeded() 224 { 225 if (m_tiler) 226 return; 227 228 createTextureUpdaterIfNeeded(); 229 230 m_tiler = LayerTilerChromium::create( 231 layerRenderer(), 232 IntSize(defaultTileSize, defaultTileSize), 233 m_borderTexels ? LayerTilerChromium::HasBorderTexels : 234 LayerTilerChromium::NoBorderTexels); 235 } 236 237 void ContentLayerChromium::updateCompositorResources() 238 { 239 m_tiler->updateRect(m_textureUpdater.get()); 240 } 241 242 void ContentLayerChromium::setTilingOption(TilingOption option) 243 { 244 m_tilingOption = option; 245 updateLayerSize(); 246 } 247 248 void ContentLayerChromium::bindContentsTexture() 249 { 250 // This function is only valid for single texture layers, e.g. masks. 251 ASSERT(m_tilingOption == NeverTile); 252 ASSERT(m_tiler); 253 254 LayerTexture* texture = m_tiler->getSingleTexture(); 255 ASSERT(texture); 256 257 texture->bindTexture(); 258 } 259 260 void ContentLayerChromium::setIsMask(bool isMask) 261 { 262 m_borderTexels = false; 263 setTilingOption(isMask ? NeverTile : AutoTile); 264 } 265 266 static void writeIndent(TextStream& ts, int indent) 267 { 268 for (int i = 0; i != indent; ++i) 269 ts << " "; 270 } 271 272 void ContentLayerChromium::dumpLayerProperties(TextStream& ts, int indent) const 273 { 274 LayerChromium::dumpLayerProperties(ts, indent); 275 writeIndent(ts, indent); 276 ts << "skipsDraw: " << (!m_tiler || m_tiler->skipsDraw()) << "\n"; 277 } 278 128 279 } 129 280 #endif // USE(ACCELERATED_COMPOSITING) -
trunk/Source/WebCore/platform/graphics/chromium/ContentLayerChromium.h
r90842 r90859 35 35 #if USE(ACCELERATED_COMPOSITING) 36 36 37 #include "TiledLayerChromium.h" 38 #include "cc/CCTiledLayerImpl.h" 37 #include "LayerChromium.h" 39 38 40 39 namespace WebCore { … … 45 44 46 45 // A Layer that requires a GraphicsContext to render its contents. 47 class ContentLayerChromium : public TiledLayerChromium { 46 class ContentLayerChromium : public LayerChromium { 47 friend class LayerRendererChromium; 48 48 public: 49 enum TilingOption { AlwaysTile, NeverTile, AutoTile }; 50 49 51 static PassRefPtr<ContentLayerChromium> create(GraphicsLayerChromium* owner = 0); 50 52 … … 52 54 53 55 virtual void paintContentsIfDirty(); 56 virtual void updateCompositorResources(); 57 virtual void setIsMask(bool); 58 virtual void bindContentsTexture(); 54 59 55 private: 60 virtual void draw(); 61 virtual bool drawsContent() const; 62 63 protected: 56 64 explicit ContentLayerChromium(GraphicsLayerChromium* owner); 57 65 58 66 virtual const char* layerTypeAsString() const { return "ContentLayer"; } 67 virtual void dumpLayerProperties(TextStream&, int indent) const; 59 68 60 virtual bool drawsContent() const; 69 virtual void cleanupResources(); 70 virtual void setLayerRenderer(LayerRendererChromium*); 71 72 virtual IntSize contentBounds() const; 73 74 TransformationMatrix tilingTransform(); 75 76 void updateLayerSize(); 77 void createTilerIfNeeded(); 61 78 virtual void createTextureUpdaterIfNeeded(); 62 v irtual LayerTextureUpdater* textureUpdater() const { return m_textureUpdater.get(); }79 void setTilingOption(TilingOption); 63 80 64 81 OwnPtr<LayerTextureUpdater> m_textureUpdater; 82 OwnPtr<LayerTilerChromium> m_tiler; 83 TilingOption m_tilingOption; 84 bool m_borderTexels; 65 85 }; 66 86 -
trunk/Source/WebCore/platform/graphics/chromium/ImageLayerChromium.cpp
r90842 r90859 116 116 117 117 ImageLayerChromium::ImageLayerChromium(GraphicsLayerChromium* owner) 118 : TiledLayerChromium(owner)118 : ContentLayerChromium(owner) 119 119 , m_imageForCurrentFrame(0) 120 , m_contents(0) 120 121 { 121 122 } … … 123 124 ImageLayerChromium::~ImageLayerChromium() 124 125 { 125 }126 127 void ImageLayerChromium::cleanupResources()128 {129 m_textureUpdater.clear();130 TiledLayerChromium::cleanupResources();131 126 } 132 127 … … 151 146 152 147 if (!m_dirtyRect.isEmpty()) { 153 m_textureUpdater->updateFromImage(m_contents->nativeImageForCurrentFrame()); 154 updateTileSizeAndTilingOption(); 148 // FIXME: This downcast is bad. The fix is to make ImageLayerChromium not derive from ContentLayerChromium. 149 ImageLayerTextureUpdater* imageTextureUpdater = static_cast<ImageLayerTextureUpdater*>(m_textureUpdater.get()); 150 imageTextureUpdater->updateFromImage(m_contents->nativeImageForCurrentFrame()); 151 updateLayerSize(); 155 152 IntRect paintRect(IntPoint(), contentBounds()); 156 153 if (!m_dirtyRect.isEmpty()) { … … 160 157 } 161 158 162 if (visibleLayerRect().isEmpty())163 return;164 165 159 m_tiler->prepareToUpdate(visibleLayerRect(), m_textureUpdater.get()); 166 160 } 167 161 168 LayerTextureUpdater* ImageLayerChromium::textureUpdater() const 162 void ImageLayerChromium::updateCompositorResources() 169 163 { 170 return m_textureUpdater.get(); 171 } 172 173 IntSize ImageLayerChromium::contentBounds() const 174 { 175 if (!m_contents) 176 return IntSize(); 177 return m_contents->size(); 178 } 179 180 bool ImageLayerChromium::drawsContent() const 181 { 182 return m_contents && TiledLayerChromium::drawsContent(); 164 m_tiler->updateRect(m_textureUpdater.get()); 183 165 } 184 166 … … 189 171 } 190 172 173 IntSize ImageLayerChromium::contentBounds() const 174 { 175 return m_contents->size(); 176 } 177 191 178 } 192 179 #endif // USE(ACCELERATED_COMPOSITING) -
trunk/Source/WebCore/platform/graphics/chromium/ImageLayerChromium.h
r90842 r90859 45 45 46 46 class Image; 47 class ImageLayerTextureUpdater;48 47 49 48 // A Layer that contains only an Image element. 50 class ImageLayerChromium : public TiledLayerChromium {49 class ImageLayerChromium : public ContentLayerChromium { 51 50 public: 52 51 static PassRefPtr<ImageLayerChromium> create(GraphicsLayerChromium* owner = 0); 53 52 virtual ~ImageLayerChromium(); 54 53 55 virtual bool drawsContent() const;56 54 virtual void paintContentsIfDirty(); 55 virtual void updateCompositorResources(); 56 virtual bool drawsContent() const { return m_contents; } 57 57 58 58 void setContents(Image* image); … … 61 61 virtual const char* layerTypeAsString() const { return "ImageLayer"; } 62 62 63 virtual IntSize contentBounds() const; 64 63 65 private: 64 66 ImageLayerChromium(GraphicsLayerChromium* owner); 65 67 66 virtual void cleanupResources();67 68 virtual void createTextureUpdaterIfNeeded(); 68 void setTilingOption(TilingOption);69 70 virtual LayerTextureUpdater* textureUpdater() const;71 virtual IntSize contentBounds() const;72 69 73 70 NativeImagePtr m_imageForCurrentFrame; 74 71 RefPtr<Image> m_contents; 75 76 OwnPtr<ImageLayerTextureUpdater> m_textureUpdater;77 72 }; 78 73 -
trunk/Source/WebCore/platform/graphics/chromium/LayerChromium.cpp
r90842 r90859 296 296 layer->setDebugBorderWidth(m_debugBorderWidth); 297 297 layer->setDoubleSided(m_doubleSided); 298 layer->setDrawsContent(drawsContent());299 298 layer->setLayerRenderer(m_layerRenderer.get()); 300 299 layer->setMasksToBounds(m_masksToBounds); … … 385 384 } 386 385 387 CCLayerImpl* LayerChromium::ccLayerImpl() const386 CCLayerImpl* LayerChromium::ccLayerImpl() 388 387 { 389 388 return m_ccLayerImpl; -
trunk/Source/WebCore/platform/graphics/chromium/LayerChromium.h
r90842 r90859 162 162 virtual void unreserveContentsTexture() { } 163 163 virtual void bindContentsTexture() { } 164 virtual void draw() { } 164 165 165 166 // These exists just for debugging (via drawDebugBorder()). … … 172 173 173 174 // Everything from here down in the public section will move to CCLayerImpl. 174 CCLayerImpl* ccLayerImpl() const;175 CCLayerImpl* ccLayerImpl(); 175 176 176 177 static void drawTexturedQuad(GraphicsContext3D*, const TransformationMatrix& projectionMatrix, const TransformationMatrix& layerMatrix, -
trunk/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp
r90850 r90859 228 228 scroll.translate(-m_viewportVisibleRect.x(), -m_viewportVisibleRect.y()); 229 229 230 m_rootLayerContentTiler->draw(m_viewportVisibleRect, scroll, 1.0f );230 m_rootLayerContentTiler->draw(m_viewportVisibleRect, scroll, 1.0f, m_rootLayerTextureUpdater.get()); 231 231 } 232 232 -
trunk/Source/WebCore/platform/graphics/chromium/LayerTilerChromium.cpp
r90842 r90859 327 327 328 328 GraphicsContext3D* context = layerRendererContext(); 329 m_textureOrientation = textureUpdater->orientation();330 m_sampledTexelFormat = textureUpdater->sampledTexelFormat(m_textureFormat);331 329 332 330 int left, top, right, bottom; … … 388 386 } 389 387 390 void LayerTilerChromium::draw(const IntRect& contentRect, const TransformationMatrix& globalTransform, float opacity )388 void LayerTilerChromium::draw(const IntRect& contentRect, const TransformationMatrix& globalTransform, float opacity, LayerTextureUpdater* textureUpdater) 391 389 { 392 390 if (m_skipsDraw || !m_tiles.size() || contentRect.isEmpty()) 393 391 return; 394 392 395 switch ( m_sampledTexelFormat) {393 switch (textureUpdater->sampledTexelFormat(m_textureFormat)) { 396 394 case LayerTextureUpdater::SampledTexelFormatRGBA: 397 drawTiles(contentRect, globalTransform, opacity, layerRenderer()->tilerProgram() );395 drawTiles(contentRect, globalTransform, opacity, layerRenderer()->tilerProgram(), textureUpdater); 398 396 break; 399 397 case LayerTextureUpdater::SampledTexelFormatBGRA: 400 drawTiles(contentRect, globalTransform, opacity, layerRenderer()->tilerProgramSwizzle() );398 drawTiles(contentRect, globalTransform, opacity, layerRenderer()->tilerProgramSwizzle(), textureUpdater); 401 399 break; 402 400 default: … … 456 454 457 455 template <class T> 458 void LayerTilerChromium::drawTiles(const IntRect& contentRect, const TransformationMatrix& globalTransform, float opacity, const T* program )456 void LayerTilerChromium::drawTiles(const IntRect& contentRect, const TransformationMatrix& globalTransform, float opacity, const T* program, LayerTextureUpdater* textureUpdater) 459 457 { 460 458 GraphicsContext3D* context = layerRendererContext(); … … 550 548 // OpenGL coordinate system is bottom-up. 551 549 // If tile texture is top-down, we need to flip the texture coordinates. 552 if ( m_textureOrientation== LayerTextureUpdater::TopDownOrientation) {550 if (textureUpdater->orientation() == LayerTextureUpdater::TopDownOrientation) { 553 551 texTranslateY = 1.0 - texTranslateY; 554 552 texScaleY *= -1.0; -
trunk/Source/WebCore/platform/graphics/chromium/LayerTilerChromium.h
r90842 r90859 32 32 #include "LayerChromium.h" 33 33 #include "LayerTexture.h" 34 #include "LayerTextureUpdater.h"35 34 #include "TilingData.h" 36 35 #include <wtf/HashTraits.h> … … 61 60 void updateRect(LayerTextureUpdater*); 62 61 // Draw all tiles that intersect with the content rect. 63 void draw(const IntRect& contentRect, const TransformationMatrix&, float opacity );62 void draw(const IntRect& contentRect, const TransformationMatrix&, float opacity, LayerTextureUpdater*); 64 63 65 64 int numTiles() const { return m_tilingData.numTiles(); } … … 111 110 // Draw all tiles that intersect with contentRect. 112 111 template <class T> 113 void drawTiles(const IntRect& contentRect, const TransformationMatrix&, float opacity, const T* program );112 void drawTiles(const IntRect& contentRect, const TransformationMatrix&, float opacity, const T* program, LayerTextureUpdater*); 114 113 115 114 template <class T> … … 167 166 IntRect m_updateRect; 168 167 169 LayerTextureUpdater::Orientation m_textureOrientation;170 LayerTextureUpdater::SampledTexelFormat m_sampledTexelFormat;171 168 TilingData m_tilingData; 172 169 -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.cpp
r90842 r90859 137 137 } 138 138 139 // These belong on CCLayerImpl, but should be overridden by each type and not defer to the LayerChromium subtypes. 140 bool CCLayerImpl::drawsContent() const 141 { 142 return m_owner->drawsContent(); 143 } 144 139 145 void CCLayerImpl::draw() 140 146 { 141 ASSERT_NOT_REACHED();147 return m_owner->draw(); 142 148 } 143 149 -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.h
r90842 r90859 73 73 virtual void updateCompositorResources(); 74 74 void unreserveContentsTexture(); 75 v irtual void bindContentsTexture();75 void bindContentsTexture(); 76 76 77 77 // Returns true if this layer has content to draw. 78 void setDrawsContent(bool drawsContent) { m_drawsContent = drawsContent; } 79 bool drawsContent() const { return m_drawsContent; } 78 virtual bool drawsContent() const; 80 79 81 80 // Returns true if any of the layer's descendants has content to draw. … … 203 202 bool m_usesLayerScissor; 204 203 205 bool m_drawsContent;206 207 204 // Properties owned exclusively by this CCLayerImpl. 208 205 // Debugging.
Note: See TracChangeset
for help on using the changeset viewer.