Changeset 116334 in webkit


Ignore:
Timestamp:
May 7, 2012 11:57:46 AM (12 years ago)
Author:
wjmaclean@chromium.org
Message:

[chromium] Create LinkHighlightLayerChromium class to provide link-highlight preview animations for GraphicsLayerChromium.
https://bugs.webkit.org/show_bug.cgi?id=85084

Reviewed by Adrienne Walker.

Source/WebCore:

Unit test provided.

Creates a layer delegate class to provide link highlight animations for link-preview feature.
These are added to a GraphicsLayerChromium via provided methods. Moves dispensing of animation
ids into a separate class.

  • WebCore.gypi:
  • platform/graphics/chromium/AnimationIdVendor.cpp: Added.

(WebCore):
(WebCore::AnimationIdVendor::getNextAnimationId):
(WebCore::AnimationIdVendor::getNextGroupId):

  • platform/graphics/chromium/AnimationIdVendor.h: Added.

(WebCore):
(AnimationIdVendor):

  • platform/graphics/chromium/GraphicsLayerChromium.cpp:

(WebCore::GraphicsLayerChromium::updateNames):
(WebCore::GraphicsLayerChromium::addAnimation):
(WebCore::GraphicsLayerChromium::addLinkHighlightLayer):
(WebCore):
(WebCore::GraphicsLayerChromium::didFinishLinkHighlightLayer):
(WebCore::GraphicsLayerChromium::updateChildList):
(WebCore::GraphicsLayerChromium::mapAnimationNameToId):

  • platform/graphics/chromium/GraphicsLayerChromium.h:

(WebCore):
(GraphicsLayerChromium):

  • platform/graphics/chromium/LinkHighlightLayerDelegate.cpp: Added.

(WebCore):
(WebCore::LinkHighlightLayerDelegate::create):
(WebCore::LinkHighlightLayerDelegate::LinkHighlightLayerDelegate):
(WebCore::LinkHighlightLayerDelegate::~LinkHighlightLayerDelegate):
(WebCore::LinkHighlightLayerDelegate::getContentLayer):
(WebCore::LinkHighlightLayerDelegate::paintContents):
(WebCore::LinkHighlightLayerDelegate::didScroll):
(WebCore::LinkHighlightLayerDelegate::notifyAnimationStarted):
(WebCore::LinkHighlightLayerDelegate::notifyAnimationFinished):

  • platform/graphics/chromium/LinkHighlightLayerDelegate.h: Added.

(WebCore):
(LinkHighlightLayerDelegate):

Source/WebKit/chromium:

  • WebKit.gypi:
  • tests/LinkHighlightLayerDelegateTest.cpp: Added.

(WebCore):
(MockGraphicsLayerClient):
(WebCore::MockGraphicsLayerClient::notifyAnimationStarted):
(WebCore::MockGraphicsLayerClient::notifySyncRequired):
(WebCore::MockGraphicsLayerClient::paintContents):
(WebCore::MockGraphicsLayerClient::showDebugBorders):
(WebCore::MockGraphicsLayerClient::showRepaintCounter):
(WebCore::TEST):

Location:
trunk/Source
Files:
5 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r116333 r116334  
     12012-05-07  W. James MacLean  <wjmaclean@chromium.org>
     2
     3        [chromium] Create LinkHighlightLayerChromium class to provide link-highlight preview animations for GraphicsLayerChromium.
     4        https://bugs.webkit.org/show_bug.cgi?id=85084
     5
     6        Reviewed by Adrienne Walker.
     7
     8        Unit test provided.
     9
     10        Creates a layer delegate class to provide link highlight animations for link-preview feature.
     11        These are added to a GraphicsLayerChromium via provided methods. Moves dispensing of animation
     12        ids into a separate class.
     13
     14        * WebCore.gypi:
     15        * platform/graphics/chromium/AnimationIdVendor.cpp: Added.
     16        (WebCore):
     17        (WebCore::AnimationIdVendor::getNextAnimationId):
     18        (WebCore::AnimationIdVendor::getNextGroupId):
     19        * platform/graphics/chromium/AnimationIdVendor.h: Added.
     20        (WebCore):
     21        (AnimationIdVendor):
     22        * platform/graphics/chromium/GraphicsLayerChromium.cpp:
     23        (WebCore::GraphicsLayerChromium::updateNames):
     24        (WebCore::GraphicsLayerChromium::addAnimation):
     25        (WebCore::GraphicsLayerChromium::addLinkHighlightLayer):
     26        (WebCore):
     27        (WebCore::GraphicsLayerChromium::didFinishLinkHighlightLayer):
     28        (WebCore::GraphicsLayerChromium::updateChildList):
     29        (WebCore::GraphicsLayerChromium::mapAnimationNameToId):
     30        * platform/graphics/chromium/GraphicsLayerChromium.h:
     31        (WebCore):
     32        (GraphicsLayerChromium):
     33        * platform/graphics/chromium/LinkHighlightLayerDelegate.cpp: Added.
     34        (WebCore):
     35        (WebCore::LinkHighlightLayerDelegate::create):
     36        (WebCore::LinkHighlightLayerDelegate::LinkHighlightLayerDelegate):
     37        (WebCore::LinkHighlightLayerDelegate::~LinkHighlightLayerDelegate):
     38        (WebCore::LinkHighlightLayerDelegate::getContentLayer):
     39        (WebCore::LinkHighlightLayerDelegate::paintContents):
     40        (WebCore::LinkHighlightLayerDelegate::didScroll):
     41        (WebCore::LinkHighlightLayerDelegate::notifyAnimationStarted):
     42        (WebCore::LinkHighlightLayerDelegate::notifyAnimationFinished):
     43        * platform/graphics/chromium/LinkHighlightLayerDelegate.h: Added.
     44        (WebCore):
     45        (LinkHighlightLayerDelegate):
     46
    1472012-05-07  Joshua Bell  <jsbell@chromium.org>
    248
  • trunk/Source/WebCore/WebCore.gypi

    r116277 r116334  
    35253525            'platform/graphics/cg/PatternCG.cpp',
    35263526            'platform/graphics/cg/TransformationMatrixCG.cpp',
     3527            'platform/graphics/chromium/AnimationIdVendor.cpp',
     3528            'platform/graphics/chromium/AnimationIdVendor.h',
    35273529            'platform/graphics/chromium/BitmapCanvasLayerTextureUpdater.cpp',
    35283530            'platform/graphics/chromium/BitmapCanvasLayerTextureUpdater.h',
     
    35743576            'platform/graphics/chromium/LayerTextureSubImage.h',
    35753577            'platform/graphics/chromium/LayerTextureUpdater.h',
     3578            'platform/graphics/chromium/LinkHighlightLayerDelegate.cpp',
     3579            'platform/graphics/chromium/LinkHighlightLayerDelegate.h',
    35763580            'platform/graphics/chromium/ManagedTexture.cpp',
    35773581            'platform/graphics/chromium/ManagedTexture.h',
  • trunk/Source/WebCore/platform/graphics/chromium/GraphicsLayerChromium.cpp

    r115519 r116334  
    4646#include "GraphicsLayerChromium.h"
    4747
     48#include "AnimationIdVendor.h"
    4849#include "Canvas2DLayerChromium.h"
    4950#include "ContentLayerChromium.h"
     
    5354#include "ImageLayerChromium.h"
    5455#include "LayerChromium.h"
     56#include "LinkHighlightLayerDelegate.h"
    5557#include "PlatformString.h"
    5658#include "SystemTime.h"
     
    6163
    6264using namespace std;
    63 
    64 namespace {
    65 static int s_nextGroupId = 1;
    66 static int s_nextAnimationId = 1;
    67 }
    6865
    6966namespace WebCore {
     
    131128    if (m_contentsLayer)
    132129        m_contentsLayer->setDebugName("ContentsLayer for " + m_nameBase);
     130    if (m_linkHighlightLayerDelegate)
     131        m_linkHighlightLayerDelegate->getContentLayer()->setDebugName("LinkHighlightLayer for " + m_nameBase);
    133132}
    134133
     
    408407{
    409408    primaryLayer()->setLayerAnimationDelegate(this);
    410     return primaryLayer()->addAnimation(values, boxSize, animation, mapAnimationNameToId(animationName), s_nextGroupId++, timeOffset);
     409    return primaryLayer()->addAnimation(values, boxSize, animation, mapAnimationNameToId(animationName), AnimationIdVendor::getNextGroupId(), timeOffset);
    411410}
    412411
     
    432431{
    433432    primaryLayer()->resumeAnimations(monotonicallyIncreasingTime());
     433}
     434
     435void GraphicsLayerChromium::addLinkHighlightLayer(const Path& path)
     436{
     437    m_linkHighlightLayerDelegate = LinkHighlightLayerDelegate::create(this, path, AnimationIdVendor::LinkHighlightAnimationId, AnimationIdVendor::getNextGroupId());
     438    updateChildList();
     439}
     440
     441void GraphicsLayerChromium::didFinishLinkHighlightLayer()
     442{
     443    if (m_linkHighlightLayerDelegate)
     444        m_linkHighlightLayerDelegate->getContentLayer()->removeFromParent();
     445
     446    m_linkHighlightLayerDelegate.clear();
    434447}
    435448
     
    514527    }
    515528
     529    if (m_linkHighlightLayerDelegate)
     530        newChildren.append(m_linkHighlightLayerDelegate->getContentLayer());
     531
    516532    for (size_t i = 0; i < newChildren.size(); ++i)
    517533        newChildren[i]->removeFromParent();
     
    750766
    751767    if (!m_animationIdMap.contains(animationName))
    752         m_animationIdMap.add(animationName, s_nextAnimationId++);
     768        m_animationIdMap.add(animationName, AnimationIdVendor::getNextAnimationId());
    753769
    754770    return m_animationIdMap.find(animationName)->second;
  • trunk/Source/WebCore/platform/graphics/chromium/GraphicsLayerChromium.h

    r116142 r116334  
    4545
    4646class LayerChromium;
     47class LinkHighlightLayerDelegate;
    4748
    4849class GraphicsLayerChromium : public GraphicsLayer, public ContentLayerDelegate, public CCLayerAnimationDelegate {
     
    106107    virtual void resumeAnimations();
    107108
     109    virtual void addLinkHighlightLayer(const Path&);
     110    virtual void didFinishLinkHighlightLayer();
     111
    108112    virtual PlatformLayer* platformLayer() const;
    109113
     
    158162    RefPtr<LayerChromium> m_transformLayer;
    159163    RefPtr<LayerChromium> m_contentsLayer;
     164    RefPtr<LinkHighlightLayerDelegate> m_linkHighlightLayerDelegate;
    160165
    161166    enum ContentsLayerPurpose {
  • trunk/Source/WebKit/chromium/ChangeLog

    r116333 r116334  
     12012-05-07  W. James MacLean  <wjmaclean@chromium.org>
     2
     3        [chromium] Create LinkHighlightLayerChromium class to provide link-highlight preview animations for GraphicsLayerChromium.
     4        https://bugs.webkit.org/show_bug.cgi?id=85084
     5
     6        Reviewed by Adrienne Walker.
     7
     8        * WebKit.gypi:
     9        * tests/LinkHighlightLayerDelegateTest.cpp: Added.
     10        (WebCore):
     11        (MockGraphicsLayerClient):
     12        (WebCore::MockGraphicsLayerClient::notifyAnimationStarted):
     13        (WebCore::MockGraphicsLayerClient::notifySyncRequired):
     14        (WebCore::MockGraphicsLayerClient::paintContents):
     15        (WebCore::MockGraphicsLayerClient::showDebugBorders):
     16        (WebCore::MockGraphicsLayerClient::showRepaintCounter):
     17        (WebCore::TEST):
     18
    1192012-05-07  Joshua Bell  <jsbell@chromium.org>
    220
  • trunk/Source/WebKit/chromium/WebKit.gypi

    r116242 r116334  
    114114            'tests/LayerTextureUpdaterTest.cpp',
    115115            'tests/LevelDBTest.cpp',
     116            'tests/LinkHighlightLayerDelegateTest.cpp',
    116117            'tests/LocalizedNumberICUTest.cpp',
    117118            'tests/MockCCQuadCuller.h',
Note: See TracChangeset for help on using the changeset viewer.