Bug 123279

Summary: Make TileController manipulate PlatformCALayers instead of CALayers
Product: WebKit Reporter: Tim Horton <thorton>
Component: Layout and RenderingAssignee: Tim Horton <thorton>
Status: RESOLVED FIXED    
Severity: Normal CC: andersca, cmarcelo, commit-queue, eric.carlson, glenn, jamesr, jer.noble, luiz, simon.fraser, tonikitoo
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
preliminary patch
buildbot: commit-queue-
patch
buildbot: commit-queue-
windows, please.
buildbot: commit-queue-
windows again
none
somehow uploaded old patch
none
missed one fixme (removing stale repaint counts) simon.fraser: review+

Description Tim Horton 2013-10-24 11:05:53 PDT
As the first of a bunch of steps towards making TileController work with the remote layer tree code, make TileController operate on PlatformCALayers instead of directly on Objective-C CALayers.

It will still explicitly make PlatformCALayerMac instances, and it will still live in mac/, and so it won't yet work with remote layer trees - it's just step one.

This might all help get TileController working on Windows, too.
Comment 1 Tim Horton 2013-10-24 17:48:29 PDT
Created attachment 215125 [details]
preliminary patch
Comment 2 Build Bot 2013-10-24 18:28:24 PDT
Comment on attachment 215125 [details]
preliminary patch

Attachment 215125 [details] did not pass win-ews (win):
Output: http://webkit-queues.appspot.com/results/11678029
Comment 3 Tim Horton 2013-10-24 18:43:03 PDT
Created attachment 215133 [details]
patch
Comment 4 Tim Horton 2013-10-24 18:43:38 PDT
Note that even with this patch, TileController still explicitly makes PlatformCALayer*Mac* instances, but that's why it's "the first of a bunch of steps" :D
Comment 5 Tim Horton 2013-10-24 18:45:53 PDT
Comment on attachment 215133 [details]
patch

View in context: https://bugs.webkit.org/attachment.cgi?id=215133&action=review

> Source/WebCore/ChangeLog:8
> +        No new tests, just a (largeish) refactor.

Probably needs more description of the overall change here.
Comment 6 Build Bot 2013-10-24 19:16:30 PDT
Comment on attachment 215133 [details]
patch

Attachment 215133 [details] did not pass win-ews (win):
Output: http://webkit-queues.appspot.com/results/10408242
Comment 7 Darin Adler 2013-10-25 12:39:49 PDT
Comment on attachment 215133 [details]
patch

1>..\platform\graphics\win\MediaPlayerPrivateQuickTimeVisualContext.cpp(179): error C2259: 'WebCore::MediaPlayerPrivateQuickTimeVisualContext::LayerClient' : cannot instantiate abstract class
                 due to following members:
                 'void WebCore::PlatformCALayerClient::platformCALayerPaintContents(WebCore::PlatformCALayer *,WebCore::GraphicsContext &,const WebCore::IntRect &)' : is abstract
                 c:\cygwin\home\buildbot\webkit\source\webcore\platform\graphics\ca\PlatformCALayerClient.h(53) : see declaration of 'WebCore::PlatformCALayerClient::platformCALayerPaintContents'
                 'int WebCore::PlatformCALayerClient::platformCALayerIncrementRepaintCount(WebCore::PlatformCALayer *)' : is abstract
                 c:\cygwin\home\buildbot\webkit\source\webcore\platform\graphics\ca\PlatformCALayerClient.h(56) : see declaration of 'WebCore::PlatformCALayerClient::platformCALayerIncrementRepaintCount'
Comment 8 Tim Horton 2013-10-25 13:47:47 PDT
Created attachment 215208 [details]
windows, please.
Comment 9 Build Bot 2013-10-25 14:46:01 PDT
Comment on attachment 215208 [details]
windows, please.

Attachment 215208 [details] did not pass win-ews (win):
Output: http://webkit-queues.appspot.com/results/13068012
Comment 10 Tim Horton 2013-10-25 14:54:52 PDT
Now WebKit is failing on Windows, but at least we got past WebCore! Will fix.
Comment 11 Tim Horton 2013-10-25 14:56:31 PDT
Created attachment 215218 [details]
windows again
Comment 12 Tim Horton 2013-10-25 15:00:08 PDT
Created attachment 215219 [details]
somehow uploaded old patch
Comment 13 Tim Horton 2013-10-25 15:19:21 PDT
Created attachment 215221 [details]
missed one fixme (removing stale repaint counts)
Comment 14 Simon Fraser (smfr) 2013-10-28 11:36:11 PDT
Comment on attachment 215221 [details]
missed one fixme (removing stale repaint counts)

View in context: https://bugs.webkit.org/attachment.cgi?id=215221&action=review

> Source/WebCore/platform/graphics/ca/mac/TileController.h:142
> +    virtual void platformCALayerLayoutSublayersOfLayer(PlatformCALayer*) OVERRIDE { }
> +    virtual bool platformCALayerRespondsToLayoutChanges() const OVERRIDE { return false; }
> +    virtual void platformCALayerAnimationStarted(CFTimeInterval) OVERRIDE { }
> +    virtual GraphicsLayer::CompositingCoordinatesOrientation platformCALayerContentsOrientation() const OVERRIDE { return GraphicsLayer::CompositingCoordinatesTopDown; }
> +    virtual void platformCALayerPaintContents(PlatformCALayer*, GraphicsContext&, const IntRect&) OVERRIDE;
> +    virtual bool platformCALayerShowDebugBorders() const OVERRIDE;
> +    virtual bool platformCALayerShowRepaintCounter(PlatformCALayer*) const OVERRIDE;
> +    virtual int platformCALayerIncrementRepaintCount(PlatformCALayer*) OVERRIDE;
> +
> +    virtual bool platformCALayerContentsOpaque() const OVERRIDE { return m_tilesAreOpaque; }
> +    virtual bool platformCALayerDrawsContent() const OVERRIDE { return true; }
> +    virtual void platformCALayerLayerDidDisplay(PlatformLayer*) OVERRIDE { }
> +
> +    virtual void platformCALayerSetNeedsToRevalidateTiles() OVERRIDE { }
> +    virtual float platformCALayerDeviceScaleFactor() OVERRIDE;

It's weird that these client functions don't all take a PlatformCALayer*

Not sure why platformCALayerDeviceScaleFactor isnt' const.

> Source/WebCore/platform/graphics/ca/mac/TileController.mm:-120
> -    [CATransaction commit];

You should explain why it's OK to remove the transaction.

> Source/WebCore/platform/graphics/ca/mac/TileController.mm:193
> +    return m_tileCacheLayer->owner()->platformCALayerDeviceScaleFactor();

These redirections are pretty confusing.
Comment 15 Tim Horton 2013-10-28 12:04:47 PDT
(In reply to comment #14)
> (From update of attachment 215221 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=215221&action=review
> 
> > Source/WebCore/platform/graphics/ca/mac/TileController.h:142
> > +    virtual void platformCALayerLayoutSublayersOfLayer(PlatformCALayer*) OVERRIDE { }
> > +    virtual bool platformCALayerRespondsToLayoutChanges() const OVERRIDE { return false; }
> > +    virtual void platformCALayerAnimationStarted(CFTimeInterval) OVERRIDE { }
> > +    virtual GraphicsLayer::CompositingCoordinatesOrientation platformCALayerContentsOrientation() const OVERRIDE { return GraphicsLayer::CompositingCoordinatesTopDown; }
> > +    virtual void platformCALayerPaintContents(PlatformCALayer*, GraphicsContext&, const IntRect&) OVERRIDE;
> > +    virtual bool platformCALayerShowDebugBorders() const OVERRIDE;
> > +    virtual bool platformCALayerShowRepaintCounter(PlatformCALayer*) const OVERRIDE;
> > +    virtual int platformCALayerIncrementRepaintCount(PlatformCALayer*) OVERRIDE;
> > +
> > +    virtual bool platformCALayerContentsOpaque() const OVERRIDE { return m_tilesAreOpaque; }
> > +    virtual bool platformCALayerDrawsContent() const OVERRIDE { return true; }
> > +    virtual void platformCALayerLayerDidDisplay(PlatformLayer*) OVERRIDE { }
> > +
> > +    virtual void platformCALayerSetNeedsToRevalidateTiles() OVERRIDE { }
> > +    virtual float platformCALayerDeviceScaleFactor() OVERRIDE;
> 
> It's weird that these client functions don't all take a PlatformCALayer*

Agreed, but I didn't want to do that here in places that aren't relevant to the patch because of the changes required to Windows.

> Not sure why platformCALayerDeviceScaleFactor isnt' const.

Ditto. I'll add them both to my list of good cleanups.

> > Source/WebCore/platform/graphics/ca/mac/TileController.mm:-120
> > -    [CATransaction commit];
> 
> You should explain why it's OK to remove the transaction.

Yikes! I should probably double check that it is :)

> > Source/WebCore/platform/graphics/ca/mac/TileController.mm:193
> > +    return m_tileCacheLayer->owner()->platformCALayerDeviceScaleFactor();
> 
> These redirections are pretty confusing.

Maybe tileCacheClient()?
Comment 16 Tim Horton 2013-10-28 12:31:01 PDT
(In reply to comment #15)
> (In reply to comment #14)
> > (From update of attachment 215221 [details] [details])
> > View in context: https://bugs.webkit.org/attachment.cgi?id=215221&action=review
> > 
> > > Source/WebCore/platform/graphics/ca/mac/TileController.h:142
> > > +    virtual void platformCALayerLayoutSublayersOfLayer(PlatformCALayer*) OVERRIDE { }
> > > +    virtual bool platformCALayerRespondsToLayoutChanges() const OVERRIDE { return false; }
> > > +    virtual void platformCALayerAnimationStarted(CFTimeInterval) OVERRIDE { }
> > > +    virtual GraphicsLayer::CompositingCoordinatesOrientation platformCALayerContentsOrientation() const OVERRIDE { return GraphicsLayer::CompositingCoordinatesTopDown; }
> > > +    virtual void platformCALayerPaintContents(PlatformCALayer*, GraphicsContext&, const IntRect&) OVERRIDE;
> > > +    virtual bool platformCALayerShowDebugBorders() const OVERRIDE;
> > > +    virtual bool platformCALayerShowRepaintCounter(PlatformCALayer*) const OVERRIDE;
> > > +    virtual int platformCALayerIncrementRepaintCount(PlatformCALayer*) OVERRIDE;
> > > +
> > > +    virtual bool platformCALayerContentsOpaque() const OVERRIDE { return m_tilesAreOpaque; }
> > > +    virtual bool platformCALayerDrawsContent() const OVERRIDE { return true; }
> > > +    virtual void platformCALayerLayerDidDisplay(PlatformLayer*) OVERRIDE { }
> > > +
> > > +    virtual void platformCALayerSetNeedsToRevalidateTiles() OVERRIDE { }
> > > +    virtual float platformCALayerDeviceScaleFactor() OVERRIDE;
> > 
> > It's weird that these client functions don't all take a PlatformCALayer*
> 
> Agreed, but I didn't want to do that here in places that aren't relevant to the patch because of the changes required to Windows.
> 
> > Not sure why platformCALayerDeviceScaleFactor isnt' const.
> 
> Ditto. I'll add them both to my list of good cleanups.
> 
> > > Source/WebCore/platform/graphics/ca/mac/TileController.mm:-120
> > > -    [CATransaction commit];
> > 
> > You should explain why it's OK to remove the transaction.
> 
> Yikes! I should probably double check that it is :)

PlatformCALayerMac fills the implicit animation dictionary with nulls, so it's OK. Pretty sure that's the only thing that transaction was there for.

> > > Source/WebCore/platform/graphics/ca/mac/TileController.mm:193
> > > +    return m_tileCacheLayer->owner()->platformCALayerDeviceScaleFactor();
> > 
> > These redirections are pretty confusing.
> 
> Maybe tileCacheClient()?

Going with (after talking to smfr) owningGraphicsLayer() for clarity, despite it not *strictly* being a GraphicsLayer.
Comment 17 Tim Horton 2013-10-28 12:59:51 PDT
http://trac.webkit.org/changeset/158122