Blocked painting of selection for inline inputbox
[framework/web/webkit-efl.git] / webkit-efl-contributions / patch-[20121129]-[gen.kim@samsung.com]-[[EFL][WK2] Implement Accelerated2dCanvas on WK2 Efl port].patch
1 diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
2 index c8b1b68..e6061e1 100644
3 --- a/Source/WebCore/ChangeLog
4 +++ b/Source/WebCore/ChangeLog
5 @@ -1,3 +1,59 @@
6 +2012-11-29  Kyungjin Kim  <gen.kim@samsung.com>
7 +
8 +        [EFL][WK2] Implement Accelerated2dCanvas on WK2 Efl port
9 +        https://bugs.webkit.org/show_bug.cgi?id=XXXXX
10 +
11 +        Reviewed by NOBODY (OOPS!).
12 +
13 +        Implement accelerated 2d canvas using Coordinated Graphics on WK2 Efl port.
14 +        This implementation is based on COORDINATED_GRAPHICS.
15 +
16 +        No new tests. Covered by existing tests.
17 +
18 +        * PlatformEfl.cmake:
19 +        * platform/graphics/GraphicsContext.cpp:
20 +        (WebCore):
21 +        * platform/graphics/ImageBuffer.cpp:
22 +        (WebCore):
23 +        * platform/graphics/ImageBuffer.h:
24 +        (ImageBuffer):
25 +        (WebCore::ImageBuffer::getSurface):
26 +        * platform/graphics/cairo/GraphicsContextCairo.cpp:
27 +        (WebCore::GraphicsContext::isAcceleratedContext):
28 +        (WebCore):
29 +        * platform/graphics/cairo/ImageBufferCairo.cpp:
30 +        (WebCore::ImageBufferData::ImageBufferData):
31 +        (WebCore::ImageBuffer::ImageBuffer):
32 +        (WebCore):
33 +        (WebCore::ImageBuffer::platformLayer):
34 +        * platform/graphics/cairo/ImageBufferDataCairo.h:
35 +        (WebCore):
36 +        (ImageBufferData):
37 +        * platform/graphics/cairo/PlatformContextCairo.cpp:
38 +        (WebCore::PlatformContextCairo::PlatformContextCairo):
39 +        * platform/graphics/cairo/PlatformContextCairo.h:
40 +        (WebCore::PlatformContextCairo::isAccelerated):
41 +        (WebCore::PlatformContextCairo::setAccelerated):
42 +        (PlatformContextCairo):
43 +        * platform/graphics/efl/Canvas2DLayerEfl.cpp: Added.
44 +        (WebCore):
45 +        (WebCore::Canvas2DLayerEfl::create):
46 +        (WebCore::Canvas2DLayerEfl::Canvas2DLayerEfl):
47 +        (WebCore::Canvas2DLayerEfl::~Canvas2DLayerEfl):
48 +        (WebCore::Canvas2DLayerEfl::copyToGraphicsSurface):
49 +        (WebCore::Canvas2DLayerEfl::graphicsSurfaceToken):
50 +        (WebCore::Canvas2DLayerEfl::paintContents):
51 +        * platform/graphics/efl/Canvas2DLayerEfl.h: Added.
52 +        (WebCore):
53 +        (Canvas2DLayerEfl):
54 +        (WebCore::Canvas2DLayerEfl::paintToTextureMapper):
55 +        (WebCore::Canvas2DLayerEfl::platformLayerSize):
56 +        (WebCore::Canvas2DLayerEfl::is2D):
57 +        * platform/graphics/texmap/TextureMapperPlatformLayer.h:
58 +        (WebCore):
59 +        (TextureMapperPlatformLayer):
60 +        (WebCore::TextureMapperPlatformLayer::paintContents):
61 +        (WebCore::TextureMapperPlatformLayer::is2D):
62 +
63  2012-11-29  Sheriff Bot  <webkit.review.bot@gmail.com>
64  
65          Unreviewed, rolling out r136111.
66 diff --git a/Source/WebCore/PlatformEfl.cmake b/Source/WebCore/PlatformEfl.cmake
67 index 31e4c87..28e8b18 100644
68 --- a/Source/WebCore/PlatformEfl.cmake
69 +++ b/Source/WebCore/PlatformEfl.cmake
70 @@ -299,6 +299,12 @@ IF (WTF_USE_3D_GRAPHICS)
71    )
72  ENDIF ()
73  
74 +IF (ENABLE_ACCELERATED_2D_CANVAS)
75 +  LIST(APPEND WebCore_SOURCES
76 +    platform/graphics/efl/Canvas2DLayerEfl.cpp
77 +  )
78 +ENDIF ()
79 +
80  ADD_DEFINITIONS(-DDATA_DIR="${CMAKE_INSTALL_PREFIX}/${DATA_INSTALL_DIR}")
81  
82  IF (ENABLE_WEB_AUDIO)
83 diff --git a/Source/WebCore/platform/graphics/GraphicsContext.cpp b/Source/WebCore/platform/graphics/GraphicsContext.cpp
84 index c21173a..15e61f2 100644
85 --- a/Source/WebCore/platform/graphics/GraphicsContext.cpp
86 +++ b/Source/WebCore/platform/graphics/GraphicsContext.cpp
87 @@ -730,7 +730,7 @@ void GraphicsContext::setPlatformShouldSmoothFonts(bool)
88  }
89  #endif
90  
91 -#if !USE(SKIA) && !USE(CG)
92 +#if !USE(SKIA) && !USE(CG) && !USE(CAIRO)
93  bool GraphicsContext::isAcceleratedContext() const
94  {
95      return false;
96 diff --git a/Source/WebCore/platform/graphics/ImageBuffer.cpp b/Source/WebCore/platform/graphics/ImageBuffer.cpp
97 index 138d078..67f2b11 100644
98 --- a/Source/WebCore/platform/graphics/ImageBuffer.cpp
99 +++ b/Source/WebCore/platform/graphics/ImageBuffer.cpp
100 @@ -99,7 +99,7 @@ void ImageBuffer::convertToLuminanceMask()
101      genericConvertToLuminanceMask();
102  }
103  
104 -#if USE(ACCELERATED_COMPOSITING) && !USE(SKIA)
105 +#if USE(ACCELERATED_COMPOSITING) && !USE(SKIA) && !USE(CAIRO)
106  PlatformLayer* ImageBuffer::platformLayer() const
107  {
108      return 0;
109 diff --git a/Source/WebCore/platform/graphics/ImageBuffer.h b/Source/WebCore/platform/graphics/ImageBuffer.h
110 index 47cfeb8..476a31e 100644
111 --- a/Source/WebCore/platform/graphics/ImageBuffer.h
112 +++ b/Source/WebCore/platform/graphics/ImageBuffer.h
113 @@ -120,6 +120,9 @@ namespace WebCore {
114  #else
115          AffineTransform baseTransform() const { return AffineTransform(1, 0, 0, -1, 0, internalSize().height()); }
116  #endif
117 +#if USE(CAIRO)
118 +        cairo_surface_t* getSurface() const { return m_data.m_surface; }
119 +#endif
120  #if USE(ACCELERATED_COMPOSITING)
121          PlatformLayer* platformLayer() const;
122  #endif
123 diff --git a/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp b/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp
124 index b87af4a..ba8203e 100644
125 --- a/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp
126 +++ b/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp
127 @@ -1173,6 +1173,11 @@ void GraphicsContext::set3DTransform(const TransformationMatrix& transform)
128  }
129  #endif
130  
131 +bool GraphicsContext::isAcceleratedContext() const
132 +{
133 +    return platformContext()->isAccelerated();
134 +}
135 +
136  } // namespace WebCore
137  
138  #endif // USE(CAIRO)
139 diff --git a/Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp b/Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp
140 index 026f449..363622f 100644
141 --- a/Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp
142 +++ b/Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp
143 @@ -51,10 +51,13 @@ namespace WebCore {
144  ImageBufferData::ImageBufferData(const IntSize&)
145      : m_surface(0)
146      , m_platformContext(0)
147 +#if USE(ACCELERATED_COMPOSITING)
148 +    , m_platformLayer(0)
149 +#endif
150  {
151  }
152  
153 -ImageBuffer::ImageBuffer(const IntSize& size, float /* resolutionScale */, ColorSpace, RenderingMode, DeferralMode, bool& success)
154 +ImageBuffer::ImageBuffer(const IntSize& size, float /* resolutionScale */, ColorSpace, RenderingMode renderingMode, DeferralMode, bool& success)
155      : m_data(size)
156      , m_size(size)
157      , m_logicalSize(size)
158 @@ -70,6 +73,14 @@ ImageBuffer::ImageBuffer(const IntSize& size, float /* resolutionScale */, Color
159      m_data.m_platformContext.setCr(cr.get());
160      m_context = adoptPtr(new GraphicsContext(&m_data.m_platformContext));
161      success = true;
162 +#if ENABLE(ACCELERATED_2D_CANVAS) && PLATFORM(EFL)
163 +    if (renderingMode == Accelerated) {
164 +        m_data.m_platformLayer = Canvas2DLayerEfl::create(this, m_size);
165 +        context()->platformContext()->setAccelerated(true);
166 +    }
167 +#else
168 +    UNUSED_PARAM(renderingMode);
169 +#endif
170  }
171  
172  ImageBuffer::~ImageBuffer()
173 @@ -310,4 +321,11 @@ String ImageBuffer::toDataURL(const String& mimeType, const double*, CoordinateS
174  }
175  #endif
176  
177 +#if USE(ACCELERATED_COMPOSITING)
178 +PlatformLayer* ImageBuffer::platformLayer() const
179 +{
180 +    return static_cast<TextureMapperPlatformLayer*>(m_data.m_platformLayer.get());
181 +}
182 +#endif
183 +
184  } // namespace WebCore
185 diff --git a/Source/WebCore/platform/graphics/cairo/ImageBufferDataCairo.h b/Source/WebCore/platform/graphics/cairo/ImageBufferDataCairo.h
186 index 5ca7262..466eaf9 100644
187 --- a/Source/WebCore/platform/graphics/cairo/ImageBufferDataCairo.h
188 +++ b/Source/WebCore/platform/graphics/cairo/ImageBufferDataCairo.h
189 @@ -24,12 +24,18 @@
190   */
191  
192  #include "PlatformContextCairo.h"
193 +#if USE(ACCELERATED_COMPOSITING) && PLATFORM(EFL)
194 +#include <efl/Canvas2DLayerEfl.h>
195 +#endif
196  
197  typedef struct _cairo_surface cairo_surface_t;
198  
199  namespace WebCore {
200  
201  class IntSize;
202 +#if USE(ACCELERATED_COMPOSITING) && PLATFORM(EFL)
203 +class Canvas2DLayerEfl;
204 +#endif
205  
206  class ImageBufferData {
207  public:
208 @@ -37,6 +43,9 @@ public:
209  
210      cairo_surface_t* m_surface;
211      PlatformContextCairo m_platformContext;
212 +#if USE(ACCELERATED_COMPOSITING) && PLATFORM(EFL)
213 +    RefPtr<Canvas2DLayerEfl> m_platformLayer;
214 +#endif
215  };
216  
217  } // namespace WebCore
218 diff --git a/Source/WebCore/platform/graphics/cairo/PlatformContextCairo.cpp b/Source/WebCore/platform/graphics/cairo/PlatformContextCairo.cpp
219 index 865d152..92fd924 100644
220 --- a/Source/WebCore/platform/graphics/cairo/PlatformContextCairo.cpp
221 +++ b/Source/WebCore/platform/graphics/cairo/PlatformContextCairo.cpp
222 @@ -82,6 +82,7 @@ public:
223  
224  PlatformContextCairo::PlatformContextCairo(cairo_t* cr)
225      : m_cr(cr)
226 +    , m_accelerated(false)
227  {
228      m_stateStack.append(State());
229      m_state = &m_stateStack.last();
230 diff --git a/Source/WebCore/platform/graphics/cairo/PlatformContextCairo.h b/Source/WebCore/platform/graphics/cairo/PlatformContextCairo.h
231 index d7f1205..436407a 100644
232 --- a/Source/WebCore/platform/graphics/cairo/PlatformContextCairo.h
233 +++ b/Source/WebCore/platform/graphics/cairo/PlatformContextCairo.h
234 @@ -67,6 +67,9 @@ public:
235      enum AlphaPreservation { DoNotPreserveAlpha, PreserveAlpha };
236      void prepareForStroking(const GraphicsContextState&, AlphaPreservation = PreserveAlpha);
237  
238 +    bool isAccelerated() const { return m_accelerated; }
239 +    void setAccelerated(bool accelerated) { m_accelerated = accelerated; }
240 +
241  private:
242      void clipForPatternFilling(const GraphicsContextState&);
243  
244 @@ -79,6 +82,7 @@ private:
245      // GraphicsContext is responsible for managing the state of the ShadowBlur,
246      // so it does not need to be on the state stack.
247      ShadowBlur m_shadowBlur;
248 +    bool m_accelerated;
249  
250  };
251  
252 diff --git a/Source/WebCore/platform/graphics/efl/Canvas2DLayerEfl.cpp b/Source/WebCore/platform/graphics/efl/Canvas2DLayerEfl.cpp
253 new file mode 100644
254 index 0000000..0391ac1
255 --- /dev/null
256 +++ b/Source/WebCore/platform/graphics/efl/Canvas2DLayerEfl.cpp
257 @@ -0,0 +1,64 @@
258 +/*
259 +    Copyright (C) 2012 Samsung Electronics
260 +
261 +    This library is free software; you can redistribute it and/or
262 +    modify it under the terms of the GNU Library General Public
263 +    License as published by the Free Software Foundation; either
264 +    version 2 of the License, or (at your option) any later version.
265 +
266 +    This library is distributed in the hope that it will be useful,
267 +    but WITHOUT ANY WARRANTY; without even the implied warranty of
268 +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
269 +    Library General Public License for more details.
270 +
271 +    You should have received a copy of the GNU Library General Public License
272 +    along with this library; see the file COPYING.LIB.  If not, write to
273 +    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
274 +    Boston, MA 02110-1301, USA.
275 +*/
276 +
277 +#include "config.h"
278 +
279 +#if USE(ACCELERATED_COMPOSITING) && ENABLE(ACCELERATED_2D_CANVAS)
280 +#include "Canvas2DLayerEfl.h"
281 +
282 +#include "CanvasRenderingContext2D.h"
283 +
284 +namespace WebCore {
285 +
286 +PassRefPtr<Canvas2DLayerEfl> Canvas2DLayerEfl::create(ImageBuffer* buffer, IntSize& size)
287 +{
288 +    return adoptRef(new Canvas2DLayerEfl(buffer, size));
289 +}
290 +
291 +Canvas2DLayerEfl::Canvas2DLayerEfl(ImageBuffer* buffer, IntSize& size)
292 +    : m_buffer(buffer)
293 +    , m_size(size)
294 +{
295 +}
296 +
297 +Canvas2DLayerEfl::~Canvas2DLayerEfl()
298 +{
299 +}
300 +
301 +#if USE(GRAPHICS_SURFACE)
302 +uint32_t Canvas2DLayerEfl::copyToGraphicsSurface()
303 +{
304 +}
305 +
306 +GraphicsSurfaceToken Canvas2DLayerEfl::graphicsSurfaceToken() const
307 +{
308 +}
309 +#else
310 +void Canvas2DLayerEfl::paintContents(GraphicsContext& context, const IntRect& rect)
311 +{
312 +    if (m_buffer) {
313 +        context.clearRect(FloatRect(rect));
314 +        context.platformContext()->drawSurfaceToContext(m_buffer->getSurface(), FloatRect(rect), FloatRect(rect), &context);
315 +    }
316 +}
317 +#endif
318 +
319 +} // namespace WebCore
320 +
321 +#endif
322 diff --git a/Source/WebCore/platform/graphics/efl/Canvas2DLayerEfl.h b/Source/WebCore/platform/graphics/efl/Canvas2DLayerEfl.h
323 new file mode 100644
324 index 0000000..69aa786
325 --- /dev/null
326 +++ b/Source/WebCore/platform/graphics/efl/Canvas2DLayerEfl.h
327 @@ -0,0 +1,62 @@
328 +/*
329 +   Copyright (C) 2012 Samsung Electronics
330 +
331 +    This library is free software; you can redistribute it and/or
332 +    modify it under the terms of the GNU Library General Public
333 +    License as published by the Free Software Foundation; either
334 +    version 2 of the License, or (at your option) any later version.
335 +
336 +    This library is distributed in the hope that it will be useful,
337 +    but WITHOUT ANY WARRANTY; without even the implied warranty of
338 +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
339 +    Library General Public License for more details.
340 +
341 +    You should have received a copy of the GNU Library General Public License
342 +    along with this library; see the file COPYING.LIB.  If not, write to
343 +    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
344 +    Boston, MA 02110-1301, USA.
345 +*/
346 +
347 +#ifndef Canvas2DLayerEfl_h
348 +#define Canvas2DLayerEfl_h
349 +
350 +#if USE(GRAPHICS_SURFACE)
351 +#include "GraphicsSurface.h"
352 +#endif
353 +#if USE(TEXTURE_MAPPER_GL)
354 +#include <texmap/TextureMapperPlatformLayer.h>
355 +#endif
356 +
357 +namespace WebCore {
358 +class CanvasRenderingContext2D;
359 +
360 +class Canvas2DLayerEfl :
361 +#if USE(TEXTURE_MAPPER_GL)
362 +    public TextureMapperPlatformLayer
363 +#endif
364 +    , public RefCounted<Canvas2DLayerEfl> {
365 +public:
366 +    static PassRefPtr<Canvas2DLayerEfl> create(ImageBuffer*, IntSize&);
367 +    virtual ~Canvas2DLayerEfl();
368 +
369 +#if USE(TEXTURE_MAPPER_GL)
370 +    virtual void paintToTextureMapper(TextureMapper*, const FloatRect&, const TransformationMatrix&, float, BitmapTexture*) { }
371 +#endif
372 +#if USE(GRAPHICS_SURFACE)
373 +    virtual IntSize platformLayerSize() const { return m_size; }
374 +    virtual uint32_t copyToGraphicsSurface();
375 +    virtual GraphicsSurfaceToken graphicsSurfaceToken() const;
376 +#else
377 +    void paintContents(GraphicsContext&, const IntRect&);
378 +#endif
379 +    virtual bool is2D() { return true; }
380 +
381 +private:
382 +    Canvas2DLayerEfl(ImageBuffer*, IntSize&);
383 +    ImageBuffer* m_buffer;
384 +    IntSize m_size;
385 +};
386 +
387 +} // namespace WebCore
388 +
389 +#endif // Canvas2DLayerEfl_h
390 diff --git a/Source/WebCore/platform/graphics/texmap/TextureMapperPlatformLayer.h b/Source/WebCore/platform/graphics/texmap/TextureMapperPlatformLayer.h
391 index 38af03e..0a26fca 100644
392 --- a/Source/WebCore/platform/graphics/texmap/TextureMapperPlatformLayer.h
393 +++ b/Source/WebCore/platform/graphics/texmap/TextureMapperPlatformLayer.h
394 @@ -20,6 +20,9 @@
395  #ifndef TextureMapperPlatformLayer_h
396  #define TextureMapperPlatformLayer_h
397  
398 +#if ENABLE(ACCELERATED_2D_CANVAS)
399 +#include "GraphicsContext.h"
400 +#endif
401  #if USE(GRAPHICS_SURFACE)
402  #include "GraphicsSurface.h"
403  #endif
404 @@ -41,6 +44,10 @@ public:
405      virtual uint32_t copyToGraphicsSurface() { return 0; }
406      virtual GraphicsSurfaceToken graphicsSurfaceToken() const { return GraphicsSurfaceToken(); }
407  #endif
408 +#if ENABLE(ACCELERATED_2D_CANVAS)
409 +    virtual void paintContents(GraphicsContext&, const IntRect&) { }
410 +    virtual bool is2D() { return false; }
411 +#endif
412  };
413  
414  };
415 diff --git a/Source/WebKit2/ChangeLog b/Source/WebKit2/ChangeLog
416 index b805594..1897c41 100644
417 --- a/Source/WebKit2/ChangeLog
418 +++ b/Source/WebKit2/ChangeLog
419 @@ -1,3 +1,21 @@
420 +2012-11-29  Kyungjin Kim  <gen.kim@samsung.com>
421 +
422 +        [EFL][WK2] Implement Accelerated2dCanvas on WK2 Efl port
423 +        https://bugs.webkit.org/show_bug.cgi?id=XXXXX
424 +
425 +        Reviewed by NOBODY (OOPS!).
426 +
427 +        Implement accelerated 2d canvas using Coordinated Graphics on WK2 Efl port.
428 +        This implementation is based on COORDINATED_GRAPHICS.
429 +
430 +        * UIProcess/API/efl/EwkViewImpl.cpp:
431 +        (EwkViewImpl::EwkViewImpl):
432 +        * WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.cpp:
433 +        (WebCore::CoordinatedGraphicsLayer::setContentsToCanvas):
434 +        (WebCore::CoordinatedGraphicsLayer::syncCanvas):
435 +        (WebCore::CoordinatedGraphicsLayer::tiledBackingStorePaint):
436 +        (WebCore::CoordinatedGraphicsLayer::updateContentBuffers):
437 +
438  2012-11-28  Jocelyn Turcotte  <jocelyn.turcotte@digia.com>
439  
440          [Qt] The WebView should be flickable only using touch events
441 diff --git a/Source/WebKit2/UIProcess/API/efl/EwkViewImpl.cpp b/Source/WebKit2/UIProcess/API/efl/EwkViewImpl.cpp
442 index 50e4cb2..d7b5a1a 100644
443 --- a/Source/WebKit2/UIProcess/API/efl/EwkViewImpl.cpp
444 +++ b/Source/WebKit2/UIProcess/API/efl/EwkViewImpl.cpp
445 @@ -151,6 +151,9 @@ EwkViewImpl::EwkViewImpl(Evas_Object* view, PassRefPtr<EwkContext> context, Pass
446  #if ENABLE(WEBGL)
447      m_pageProxy->pageGroup()->preferences()->setWebGLEnabled(true);
448  #endif
449 +#if ENABLE(ACCELERATED_2D_CANVAS)
450 +    m_pageProxy->pageGroup()->preferences()->setAccelerated2dCanvasEnabled(true);
451 +#endif
452      if (behavior == DefaultBehavior)
453          m_pageProxy->setUseFixedLayout(true);
454  #endif
455 diff --git a/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.cpp b/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.cpp
456 index 349948e..c42c910 100644
457 --- a/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.cpp
458 +++ b/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.cpp
459 @@ -345,7 +345,10 @@ void CoordinatedGraphicsLayer::setContentsToCanvas(PlatformLayer* platformLayer)
460      if (client())
461          client()->notifyFlushRequired(this);
462  #else
463 -    UNUSED_PARAM(platformLayer);
464 +    m_canvasPlatformLayer = platformLayer;
465 +    m_canvasNeedsDisplay = true;
466 +    if (client())
467 +        client()->notifyFlushRequired(this);
468  #endif
469  }
470  
471 @@ -553,6 +556,9 @@ void CoordinatedGraphicsLayer::syncCanvas()
472      ASSERT(m_canvasPlatformLayer);
473  #if USE(GRAPHICS_SURFACE)
474      m_coordinator->syncCanvas(m_id, m_canvasPlatformLayer);
475 +#elif ENABLE(ACCELERATED_2D_CANVAS)
476 +    if (m_canvasPlatformLayer->is2D())
477 +        setNeedsDisplay();
478  #endif
479      m_canvasNeedsDisplay = false;
480  }
481 @@ -667,6 +673,13 @@ void CoordinatedGraphicsLayer::tiledBackingStorePaint(GraphicsContext* context,
482  {
483      if (rect.isEmpty())
484          return;
485 +
486 +#if ENABLE(ACCELERATED_2D_CANVAS) && !USE(GRAPHICS_SURFACE)
487 +    if (m_canvasPlatformLayer && m_canvasPlatformLayer->is2D()) {
488 +        m_canvasPlatformLayer->paintContents(*context, rect);
489 +        return;
490 +    }
491 +#endif
492      paintGraphicsLayerContents(*context, rect);
493  }
494  
495 @@ -747,6 +760,10 @@ void CoordinatedGraphicsLayer::removeTile(int tileID)
496  
497  void CoordinatedGraphicsLayer::updateContentBuffers()
498  {
499 +#if ENABLE(ACCELERATED_2D_CANVAS) && !USE(GRAPHICS_SURFACE)
500 +    if (m_canvasPlatformLayer && m_canvasPlatformLayer->is2D())
501 +        setDrawsContent(true);
502 +#endif
503      if (!drawsContent() || !contentsAreVisible() || m_size.isEmpty()) {
504          m_mainBackingStore.clear();
505          m_previousBackingStore.clear();