Changeset 120135 in webkit
- Timestamp:
- Jun 12, 2012 4:04:17 PM (12 years ago)
- Location:
- trunk/Source
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r120132 r120135 1 2012-06-12 Adrienne Walker <enne@google.com> 2 3 [chromium] Paint scrollbars on WebKit thread and composite those textures 4 https://bugs.webkit.org/show_bug.cgi?id=88145 5 6 Reviewed by James Robinson. 7 8 Scrollbars were previously painted and uploaded on the compositor 9 thread. This isn't possible to do for many scrollbar themes. This 10 patch changes ScrollbarLayerChromium to paint the scrollbar into two 11 parts: the thumb, and everything else. These are uploaded into 12 textures and synced over to the CCScrollbarImpl where they are 13 composited and drawn. 14 15 Mac and overlay scrollbars are still not enabled to have compositor 16 thread-updated scrollbars. 17 18 As a bonus, fix LayerRendererChromium::drawTextureQuad to draw quads 19 that do not fill the entire layer bounds. 20 21 Tested by existing layout and unit tests by removing the condition 22 that these scrollbar layers are only created when the threaded proxy 23 exists. 24 25 * page/scrolling/chromium/ScrollingCoordinatorChromium.cpp: 26 (WebCore::scrollbarLayerDidChange): 27 * platform/ScrollbarThemeComposite.cpp: 28 (WebCore::ScrollbarThemeComposite::thumbRect): 29 (WebCore): 30 * platform/ScrollbarThemeComposite.h: 31 (ScrollbarThemeComposite): 32 * platform/graphics/chromium/LayerRendererChromium.cpp: 33 (WebCore::LayerRendererChromium::drawTextureQuad): 34 * platform/graphics/chromium/ScrollbarLayerChromium.cpp: 35 (WebCore::ScrollbarLayerChromium::ScrollbarLayerChromium): 36 (WebCore::ScrollbarLayerChromium::theme): 37 (WebCore): 38 (WebCore::ScrollbarLayerChromium::pushPropertiesTo): 39 (ScrollbarBackgroundPainter): 40 (WebCore::ScrollbarBackgroundPainter::create): 41 (WebCore::ScrollbarBackgroundPainter::paint): 42 (WebCore::ScrollbarBackgroundPainter::ScrollbarBackgroundPainter): 43 (ScrollbarThumbPainter): 44 (WebCore::ScrollbarThumbPainter::create): 45 (WebCore::ScrollbarThumbPainter::paint): 46 (WebCore::ScrollbarThumbPainter::ScrollbarThumbPainter): 47 (WebCore::ScrollbarLayerChromium::setLayerTreeHost): 48 (WebCore::ScrollbarLayerChromium::createTextureUpdaterIfNeeded): 49 (WebCore::ScrollbarLayerChromium::updatePart): 50 (WebCore::ScrollbarLayerChromium::update): 51 * platform/graphics/chromium/ScrollbarLayerChromium.h: 52 (WebCore): 53 (ScrollbarLayerChromium): 54 * platform/graphics/chromium/cc/CCScrollbarLayerImpl.cpp: 55 (WebCore::CCScrollbarLayerImpl::CCScrollbarLayerImpl): 56 (WebCore::CCScrollbarLayerImpl::appendQuads): 57 * platform/graphics/chromium/cc/CCScrollbarLayerImpl.h: 58 (WebCore::CCScrollbarLayerImpl::setBackgroundTextureId): 59 (WebCore::CCScrollbarLayerImpl::setThumbTextureId): 60 (CCScrollbarLayerImpl): 61 1 62 2012-06-12 Tony Chang <tony@chromium.org> 2 63 -
trunk/Source/WebCore/page/scrolling/chromium/ScrollingCoordinatorChromium.cpp
r120125 r120135 121 121 scrollbarGraphicsLayer->setContentsOpaque(isOpaqueRootScrollbar); 122 122 123 // Only certain platforms support the way that scrollbars are currently 124 // being painted on the impl thread. For example, Cocoa is not threadsafe. 125 bool platformSupported = false; 126 #if OS(LINUX) 127 platformSupported = true; 123 // FIXME: Mac scrollbar themes are not thread-safe. 124 bool platformSupported = true; 125 #if OS(DARWIN) 126 platformSupported = false; 128 127 #endif 129 128 130 if ( scrollbar->isCustomScrollbar() || !CCProxy::hasImplThread() || !platformSupported) {129 if (!platformSupported || scrollbar->isOverlayScrollbar()) { 131 130 scrollbarGraphicsLayer->setContentsToMedia(0); 132 131 scrollbarGraphicsLayer->setDrawsContent(true); -
trunk/Source/WebCore/platform/ScrollbarThemeComposite.cpp
r119617 r120135 272 272 } 273 273 274 IntRect ScrollbarThemeComposite::thumbRect(ScrollbarThemeClient* scrollbar) 275 { 276 if (!hasThumb(scrollbar)) 277 return IntRect(); 278 279 IntRect track = trackRect(scrollbar); 280 IntRect startTrackRect; 281 IntRect thumbRect; 282 IntRect endTrackRect; 283 splitTrack(scrollbar, track, startTrackRect, thumbRect, endTrackRect); 284 285 return thumbRect; 286 } 287 274 288 void ScrollbarThemeComposite::paintOverhangAreas(ScrollView*, GraphicsContext* context, const IntRect& horizontalOverhangRect, const IntRect& verticalOverhangRect, const IntRect& dirtyRect) 275 289 { -
trunk/Source/WebCore/platform/ScrollbarThemeComposite.h
r109451 r120135 33 33 class ScrollbarThemeComposite : public ScrollbarTheme { 34 34 public: 35 // Implement ScrollbarTheme interface 35 36 virtual bool paint(ScrollbarThemeClient*, GraphicsContext*, const IntRect& damageRect); 36 37 37 virtual ScrollbarPart hitTest(ScrollbarThemeClient*, const PlatformMouseEvent&); 38 39 38 virtual void invalidatePart(ScrollbarThemeClient*, ScrollbarPart); 40 41 39 virtual int thumbPosition(ScrollbarThemeClient*); 42 40 virtual int thumbLength(ScrollbarThemeClient*); 43 41 virtual int trackPosition(ScrollbarThemeClient*); 44 42 virtual int trackLength(ScrollbarThemeClient*); 45 46 43 virtual void paintScrollCorner(ScrollView*, GraphicsContext*, const IntRect& cornerRect); 47 44 virtual void paintOverhangAreas(ScrollView*, GraphicsContext*, const IntRect& horizontalOverhangArea, const IntRect& verticalOverhangArea, const IntRect& dirtyRect); 48 45 49 protected:50 46 virtual bool hasButtons(ScrollbarThemeClient*) = 0; 51 47 virtual bool hasThumb(ScrollbarThemeClient*) = 0; … … 54 50 virtual IntRect forwardButtonRect(ScrollbarThemeClient*, ScrollbarPart, bool painting = false) = 0; 55 51 virtual IntRect trackRect(ScrollbarThemeClient*, bool painting = false) = 0; 52 virtual IntRect thumbRect(ScrollbarThemeClient*); 56 53 57 54 virtual void splitTrack(ScrollbarThemeClient*, const IntRect& track, IntRect& startTrack, IntRect& thumb, IntRect& endTrack); -
trunk/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp
r120073 r120135 1131 1131 GLC(context(), context()->blendFunc(GraphicsContext3D::SRC_ALPHA, GraphicsContext3D::ONE_MINUS_SRC_ALPHA)); 1132 1132 1133 const IntSize& bounds = quad->quadRect().size(); 1134 1135 drawTexturedQuad(quad->layerTransform(), bounds.width(), bounds.height(), quad->opacity(), sharedGeometryQuad(), binding.matrixLocation, binding.alphaLocation, -1); 1133 WebTransformationMatrix quadTransform = quad->quadTransform(); 1134 IntRect quadRect = quad->quadRect(); 1135 quadTransform.translate(quadRect.x() + quadRect.width() / 2.0, quadRect.y() + quadRect.height() / 2.0); 1136 1137 drawTexturedQuad(quadTransform, quadRect.width(), quadRect.height(), quad->opacity(), sharedGeometryQuad(), binding.matrixLocation, binding.alphaLocation, -1); 1136 1138 1137 1139 if (!quad->premultipliedAlpha()) -
trunk/Source/WebCore/platform/graphics/chromium/ScrollbarLayerChromium.cpp
r110338 r120135 29 29 #include "ScrollbarLayerChromium.h" 30 30 31 #include "BitmapCanvasLayerTextureUpdater.h" 32 #include "LayerPainterChromium.h" 31 33 #include "Scrollbar.h" 34 #include "ScrollbarThemeComposite.h" 35 #include "cc/CCLayerTreeHost.h" 32 36 #include "cc/CCScrollbarLayerImpl.h" 37 #include "cc/CCTextureUpdater.h" 33 38 34 39 namespace WebCore { … … 47 52 : m_scrollbar(scrollbar) 48 53 , m_scrollLayerId(scrollLayerId) 54 , m_textureFormat(GraphicsContext3D::INVALID_ENUM) 49 55 , m_scrollbarOverlayStyle(scrollbar->scrollbarOverlayStyle()) 50 56 , m_isScrollableAreaActive(scrollbar->isScrollableAreaActive()) … … 55 61 } 56 62 63 ScrollbarThemeComposite* ScrollbarLayerChromium::theme() const 64 { 65 // All Chromium scrollbars are ScrollbarThemeComposite-derived. 66 return static_cast<ScrollbarThemeComposite*>(m_scrollbar->theme()); 67 } 68 57 69 void ScrollbarLayerChromium::pushPropertiesTo(CCLayerImpl* layer) 58 70 { … … 62 74 63 75 scrollbarLayer->setScrollbarOverlayStyle(m_scrollbarOverlayStyle); 76 77 if (m_background && m_background->texture()->isReserved()) 78 scrollbarLayer->setBackgroundTextureId(m_background->texture()->textureId()); 79 else 80 scrollbarLayer->setBackgroundTextureId(0); 81 82 if (m_thumb && m_thumb->texture()->isReserved()) 83 scrollbarLayer->setThumbTextureId(m_thumb->texture()->textureId()); 84 else 85 scrollbarLayer->setThumbTextureId(0); 64 86 65 87 Vector<IntRect> tickmarks; … … 80 102 } 81 103 104 class ScrollbarBackgroundPainter : public LayerPainterChromium { 105 WTF_MAKE_NONCOPYABLE(ScrollbarBackgroundPainter); 106 public: 107 static PassOwnPtr<ScrollbarBackgroundPainter> create(ScrollbarThemeClient* scrollbar, ScrollbarThemeComposite* theme) 108 { 109 return adoptPtr(new ScrollbarBackgroundPainter(scrollbar, theme)); 110 } 111 112 virtual void paint(GraphicsContext& context, const IntRect& contentRect) 113 { 114 // The following is a simplification of ScrollbarThemeComposite::paint. 115 m_theme->paintScrollbarBackground(&context, m_scrollbar); 116 117 if (m_theme->hasButtons(m_scrollbar)) { 118 IntRect backButtonStartPaintRect = m_theme->backButtonRect(m_scrollbar, BackButtonStartPart, true); 119 m_theme->paintButton(&context, m_scrollbar, backButtonStartPaintRect, BackButtonStartPart); 120 121 IntRect backButtonEndPaintRect = m_theme->backButtonRect(m_scrollbar, BackButtonEndPart, true); 122 m_theme->paintButton(&context, m_scrollbar, backButtonEndPaintRect, BackButtonEndPart); 123 124 IntRect forwardButtonStartPaintRect = m_theme->forwardButtonRect(m_scrollbar, ForwardButtonStartPart, true); 125 m_theme->paintButton(&context, m_scrollbar, forwardButtonStartPaintRect, ForwardButtonStartPart); 126 127 IntRect forwardButtonEndPaintRect = m_theme->forwardButtonRect(m_scrollbar, ForwardButtonEndPart, true); 128 m_theme->paintButton(&context, m_scrollbar, forwardButtonEndPaintRect, ForwardButtonEndPart); 129 } 130 131 IntRect trackPaintRect = m_theme->trackRect(m_scrollbar, true); 132 m_theme->paintTrackBackground(&context, m_scrollbar, trackPaintRect); 133 134 bool thumbPresent = m_theme->hasThumb(m_scrollbar); 135 if (thumbPresent) { 136 // FIXME: There's no "paint the whole track" part. Drawing both the 137 // BackTrackPart and the ForwardTrackPart in their splitTrack rects 138 // ends up leaving a distinctive line. Painting one part as the 139 // entire track appears to be identical to painting both and 140 // covering up the split between them with the thumb. 141 m_theme->paintTrackPiece(&context, m_scrollbar, trackPaintRect, BackTrackPart); 142 } 143 144 m_theme->paintTickmarks(&context, m_scrollbar, trackPaintRect); 145 } 146 private: 147 ScrollbarBackgroundPainter(ScrollbarThemeClient* scrollbar, ScrollbarThemeComposite* theme) 148 : m_scrollbar(scrollbar) 149 , m_theme(theme) 150 { 151 } 152 153 ScrollbarThemeClient* m_scrollbar; 154 ScrollbarThemeComposite* m_theme; 155 }; 156 157 class ScrollbarThumbPainter : public LayerPainterChromium { 158 WTF_MAKE_NONCOPYABLE(ScrollbarThumbPainter); 159 public: 160 static PassOwnPtr<ScrollbarThumbPainter> create(ScrollbarThemeClient* scrollbar, ScrollbarThemeComposite* theme) 161 { 162 return adoptPtr(new ScrollbarThumbPainter(scrollbar, theme)); 163 } 164 165 virtual void paint(GraphicsContext& context, const IntRect& contentRect) 166 { 167 context.clearRect(contentRect); 168 169 // Consider the thumb to be at the origin when painting. 170 IntRect thumbRect = IntRect(IntPoint(), m_theme->thumbRect(m_scrollbar).size()); 171 m_theme->paintThumb(&context, m_scrollbar, thumbRect); 172 } 173 174 private: 175 ScrollbarThumbPainter(ScrollbarThemeClient* scrollbar, ScrollbarThemeComposite* theme) 176 : m_scrollbar(scrollbar) 177 , m_theme(theme) 178 { 179 } 180 181 ScrollbarThemeClient* m_scrollbar; 182 ScrollbarThemeComposite* m_theme; 183 }; 184 185 void ScrollbarLayerChromium::setLayerTreeHost(CCLayerTreeHost* host) 186 { 187 if (!host || host != layerTreeHost()) { 188 m_backgroundUpdater.clear(); 189 m_background.clear(); 190 m_thumbUpdater.clear(); 191 m_thumb.clear(); 192 } 193 194 LayerChromium::setLayerTreeHost(host); 195 } 196 197 void ScrollbarLayerChromium::createTextureUpdaterIfNeeded() 198 { 199 bool useMapSubImage = layerTreeHost()->layerRendererCapabilities().usingMapSub; 200 m_textureFormat = layerTreeHost()->layerRendererCapabilities().bestTextureFormat; 201 202 if (!m_backgroundUpdater) 203 m_backgroundUpdater = BitmapCanvasLayerTextureUpdater::create(ScrollbarBackgroundPainter::create(m_scrollbar.get(), theme()), useMapSubImage); 204 if (!m_background) 205 m_background = m_backgroundUpdater->createTexture(layerTreeHost()->contentsTextureManager()); 206 207 if (!m_thumbUpdater) 208 m_thumbUpdater = BitmapCanvasLayerTextureUpdater::create(ScrollbarThumbPainter::create(m_scrollbar.get(), theme()), useMapSubImage); 209 if (!m_thumb) 210 m_thumb = m_thumbUpdater->createTexture(layerTreeHost()->contentsTextureManager()); 211 } 212 213 void ScrollbarLayerChromium::updatePart(LayerTextureUpdater* painter, LayerTextureUpdater::Texture* texture, const IntRect& rect, CCTextureUpdater& updater) 214 { 215 bool textureValid = texture->texture()->isValid(rect.size(), m_textureFormat); 216 // Skip painting and uploading if there are no invalidations. 217 if (textureValid && m_updateRect.isEmpty()) { 218 texture->texture()->reserve(rect.size(), m_textureFormat); 219 return; 220 } 221 222 // ScrollbarLayerChromium doesn't support partial uploads, so any 223 // invalidation is treated a full layer invalidation. 224 if (layerTreeHost()->bufferedUpdates() && textureValid) 225 layerTreeHost()->deleteTextureAfterCommit(texture->texture()->steal()); 226 227 if (!texture->texture()->reserve(rect.size(), m_textureFormat)) 228 return; 229 230 // Paint and upload the entire part. 231 IntRect paintedOpaqueRect; 232 painter->prepareToUpdate(rect, rect.size(), false, 1, paintedOpaqueRect); 233 texture->prepareRect(rect); 234 235 IntRect destRect(IntPoint(), rect.size()); 236 updater.appendUpdate(texture, rect, destRect); 237 } 238 239 void ScrollbarLayerChromium::update(CCTextureUpdater& updater, const CCOcclusionTracker*) 240 { 241 if (contentBounds().isEmpty()) 242 return; 243 244 createTextureUpdaterIfNeeded(); 245 246 IntPoint scrollbarOrigin(m_scrollbar->x(), m_scrollbar->y()); 247 IntRect contentRect(scrollbarOrigin, contentBounds()); 248 updatePart(m_backgroundUpdater.get(), m_background.get(), contentRect, updater); 249 250 // Consider the thumb to be at the origin when painting. 251 IntRect thumbRect = IntRect(IntPoint(), theme()->thumbRect(m_scrollbar.get()).size()); 252 if (!thumbRect.isEmpty()) 253 updatePart(m_thumbUpdater.get(), m_thumb.get(), thumbRect, updater); 254 } 255 82 256 } 83 257 #endif // USE(ACCELERATED_COMPOSITING) -
trunk/Source/WebCore/platform/graphics/chromium/ScrollbarLayerChromium.h
r120125 r120135 30 30 31 31 #include "LayerChromium.h" 32 #include "LayerTextureUpdater.h" 32 33 #include "ScrollTypes.h" 33 34 … … 35 36 36 37 class Scrollbar; 38 class ScrollbarThemeComposite; 39 class CCTextureUpdater; 37 40 38 41 class ScrollbarLayerChromium : public LayerChromium { … … 41 44 static PassRefPtr<ScrollbarLayerChromium> create(Scrollbar*, int scrollLayerId); 42 45 43 virtual void pushPropertiesTo(CCLayerImpl*); 46 // LayerChromium interface 47 virtual void update(CCTextureUpdater&, const CCOcclusionTracker*) OVERRIDE; 48 virtual void setLayerTreeHost(CCLayerTreeHost*) OVERRIDE; 49 virtual void pushPropertiesTo(CCLayerImpl*) OVERRIDE; 44 50 45 51 int scrollLayerId() const { return m_scrollLayerId; } … … 52 58 53 59 private: 60 ScrollbarThemeComposite* theme() const; 61 void updatePart(LayerTextureUpdater*, LayerTextureUpdater::Texture*, const IntRect&, CCTextureUpdater&); 62 void createTextureUpdaterIfNeeded(); 63 54 64 RefPtr<Scrollbar> m_scrollbar; 55 65 int m_scrollLayerId; 66 67 GC3Denum m_textureFormat; 68 69 RefPtr<LayerTextureUpdater> m_backgroundUpdater; 70 RefPtr<LayerTextureUpdater> m_thumbUpdater; 71 72 // All the parts of the scrollbar except the thumb 73 OwnPtr<LayerTextureUpdater::Texture> m_background; 74 OwnPtr<LayerTextureUpdater::Texture> m_thumb; 56 75 57 76 ScrollbarOverlayStyle m_scrollbarOverlayStyle; -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCScrollbarLayerImpl.cpp
r119419 r120135 30 30 #include "CCScrollbarLayerImpl.h" 31 31 32 #include "CCTileDrawQuad.h"33 32 #include "LayerRendererChromium.h" 34 33 #include "ManagedTexture.h" 35 34 #include "PlatformCanvas.h" 36 35 #include "ScrollbarTheme.h" 36 #include "ScrollbarThemeComposite.h" 37 37 #include "cc/CCQuadCuller.h" 38 #include "cc/CCTextureDrawQuad.h" 38 39 39 40 namespace WebCore { … … 48 49 , m_scrollLayer(0) 49 50 , m_scrollbar(this) 50 { 51 } 52 53 void CCScrollbarLayerImpl::willDraw(CCRenderer* layerRenderer, CCGraphicsContext* context) 54 { 55 CCLayerImpl::willDraw(layerRenderer, context); 56 57 if (bounds().isEmpty() || contentBounds().isEmpty()) 51 , m_backgroundTextureId(0) 52 , m_thumbTextureId(0) 53 { 54 } 55 56 void CCScrollbarLayerImpl::appendQuads(CCQuadCuller& quadList, const CCSharedQuadState* sharedQuadState, bool&) 57 { 58 ScrollbarThemeComposite* theme = static_cast<ScrollbarThemeComposite*>(ScrollbarTheme::theme()); 59 if (!theme) 58 60 return; 59 61 60 if (!m_texture)61 m_texture = ManagedTexture::create(layerRenderer->implTextureManager());62 63 // The context could have been lost since the last frame and the old texture 64 // manager may no longer be valid.65 m_texture->setTextureManager(layerRenderer->implTextureManager());66 67 IntSize textureSize = contentBounds();68 if (!m_ texture->reserve(textureSize, GraphicsContext3D::RGBA))62 bool premultipledAlpha = false; 63 FloatRect uvRect(0, 0, 1, 1); 64 bool flipped = false; 65 66 IntRect thumbRect = theme->thumbRect(&m_scrollbar); 67 thumbRect.move(-m_scrollbar.x(), -m_scrollbar.y()); 68 if (m_thumbTextureId && theme->hasThumb(&m_scrollbar) && !thumbRect.isEmpty()) 69 quadList.append(CCTextureDrawQuad::create(sharedQuadState, thumbRect, m_thumbTextureId, premultipledAlpha, uvRect, flipped)); 70 if (!m_backgroundTextureId) 69 71 return; 70 72 71 PlatformCanvas canvas; 72 canvas.resize(textureSize); 73 { 74 PlatformCanvas::Painter painter(&canvas, PlatformCanvas::Painter::GrayscaleText); 75 paint(painter.context()); 76 } 77 78 { 79 PlatformCanvas::AutoLocker locker(&canvas); 80 m_texture->bindTexture(context, layerRenderer->implTextureAllocator()); 81 82 // FIXME: Skia uses BGRA actually, we correct that with the swizzle pixel shader. 83 GraphicsContext3D* context3d = context->context3D(); 84 if (!context3d) { 85 // FIXME: Implement this path for software compositing. 86 return; 87 } 88 89 GLC(context3d, context3d->texImage2D(GraphicsContext3D::TEXTURE_2D, 0, m_texture->format(), canvas.size().width(), canvas.size().height(), 0, GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, locker.pixels())); 90 } 91 } 92 93 void CCScrollbarLayerImpl::appendQuads(CCQuadCuller& quadList, const CCSharedQuadState* sharedQuadState, bool&) 94 { 95 if (!m_texture->isReserved()) 96 return; 97 98 IntRect quadRect(IntPoint(), bounds()); 99 quadList.append(CCTileDrawQuad::create(sharedQuadState, quadRect, quadRect, m_texture->textureId(), IntPoint(), m_texture->size(), GraphicsContext3D::NEAREST, true, true, true, true, true)); 100 } 101 102 void CCScrollbarLayerImpl::didDraw() 103 { 104 CCLayerImpl::didDraw(); 105 106 m_texture->unreserve(); 107 } 108 109 void CCScrollbarLayerImpl::paint(GraphicsContext* context) 110 { 111 ScrollbarTheme* theme = ScrollbarTheme::theme(); // FIXME: should make impl-side clone if needed 112 113 context->clearRect(IntRect(IntPoint(), contentBounds())); 114 theme->paint(&m_scrollbar, context, IntRect(IntPoint(), contentBounds())); 115 } 116 73 IntRect backgroundRect(IntPoint(), contentBounds()); 74 quadList.append(CCTextureDrawQuad::create(sharedQuadState, backgroundRect, m_backgroundTextureId, premultipledAlpha, uvRect, flipped)); 75 } 117 76 118 77 int CCScrollbarLayerImpl::CCScrollbar::x() const -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCScrollbarLayerImpl.h
r119313 r120135 56 56 void setEnabled(bool enabled) { m_enabled = enabled; } 57 57 58 void setBackgroundTextureId(unsigned id) { m_backgroundTextureId = id; } 59 void setThumbTextureId(unsigned id) { m_thumbTextureId = id; } 58 60 59 61 CCLayerImpl* scrollLayer() const { return m_scrollLayer; } 60 62 void setScrollLayer(CCLayerImpl* scrollLayer) { m_scrollLayer = scrollLayer; } 61 63 62 virtual void willDraw(CCRenderer*, CCGraphicsContext*) OVERRIDE;63 64 virtual void appendQuads(CCQuadCuller&, const CCSharedQuadState*, bool& hadMissingTiles) OVERRIDE; 64 virtual void didDraw() OVERRIDE;65 65 66 66 protected: 67 67 explicit CCScrollbarLayerImpl(int id); 68 68 69 virtual void paint(GraphicsContext*);70 71 69 private: 72 70 CCLayerImpl* m_scrollLayer; 73 OwnPtr<ManagedTexture> m_texture;74 71 75 72 // nested class only to avoid namespace problem … … 129 126 CCScrollbar m_scrollbar; 130 127 128 unsigned m_backgroundTextureId; 129 unsigned m_thumbTextureId; 130 131 131 ScrollbarOverlayStyle m_scrollbarOverlayStyle; 132 132 Vector<IntRect> m_tickmarks; -
trunk/Source/WebKit/chromium/ChangeLog
r120131 r120135 1 2012-06-12 Adrienne Walker <enne@google.com> 2 3 [chromium] Paint scrollbars on WebKit thread and composite those textures 4 https://bugs.webkit.org/show_bug.cgi?id=88145 5 6 Reviewed by James Robinson. 7 8 Remove scrollbarLayerLostContext test that no longer makes sense. The 9 compositor won't draw at all after a lost context if it has no 10 contents. 11 12 * tests/CCLayerTreeHostImplTest.cpp: 13 1 14 2012-06-12 Joshua Bell <jsbell@chromium.org> 2 15 -
trunk/Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp
r120127 r120135 1585 1585 }; 1586 1586 1587 TEST_F(CCLayerTreeHostImplTest, scrollbarLayerLostContext)1588 {1589 m_hostImpl->setRootLayer(ScrollbarLayerFakePaint::create(0));1590 ScrollbarLayerFakePaint* scrollbar = static_cast<ScrollbarLayerFakePaint*>(m_hostImpl->rootLayer());1591 scrollbar->setBounds(IntSize(1, 1));1592 scrollbar->setContentBounds(IntSize(1, 1));1593 scrollbar->setDrawsContent(true);1594 1595 for (int i = 0; i < 2; ++i) {1596 CCLayerTreeHostImpl::FrameData frame;1597 EXPECT_TRUE(m_hostImpl->prepareToDraw(frame));1598 ASSERT(frame.renderPasses.size() == 1);1599 CCRenderPass* renderPass = frame.renderPasses[0].get();1600 // Scrollbar layer should always generate quads, even after lost context1601 EXPECT_GT(renderPass->quadList().size(), 0u);1602 m_hostImpl->didDrawAllLayers(frame);1603 m_hostImpl->initializeLayerRenderer(createContext(), UnthrottledUploader);1604 }1605 }1606 1607 1587 // Fake WebGraphicsContext3D that will cause a failure if trying to use a 1608 1588 // resource that wasn't created by it (resources created by
Note: See TracChangeset
for help on using the changeset viewer.