⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 130688 in webkit


Ignore:
Timestamp:
Oct 8, 2012, 2:27:29 PM (14 years ago)
Author:
jonlee@apple.com
Message:

Add render object that paints plugin snapshots
​https://bugs.webkit.org/show_bug.cgi?id=98322
<rdar://problem/12426546>

Reviewed by Simon Fraser.

First, teach plugins to maintain a set of states when plugin snapshotting is enabled.

Second, a new RenderSnapshottedPlugIn class is a RenderEmbeddedObject that knows how to paint
snapshots when the plugin is not visibly playing. It maintains a RenderImageResource to
the generated poster image.

  • html/HTMLPlugInElement.cpp:

(WebCore::HTMLPlugInElement::HTMLPlugInElement): By default all plugins play on load.

  • html/HTMLPlugInElement.h: Move the inheritance of ImageLoaderClientBase down to

HTMLPlugInImageElement, since that is the class that actually deals with image-based plugins.
(WebCore::HTMLPlugInElement::displayState): Add bit for display state.
(WebCore::HTMLPlugInElement::setDisplayState):
(WebCore::HTMLPlugInElement::updateSnapshot):

  • html/HTMLPlugInImageElement.cpp:

(WebCore::HTMLPlugInImageElement::HTMLPlugInImageElement): If plugin snapshotting is
enabled, plugin state is set to wait for a poster image.
(WebCore::HTMLPlugInImageElement::createRenderer): Create RenderSnapshottedPlugIn if
plugin snapshotting is enabled.
(WebCore::HTMLPlugInImageElement::updateSnapshot): Once a snapshot is available, update the
renderer and set its state to wait for user input to start the plugin.

  • html/HTMLPlugInImageElement.h:

(HTMLPlugInImageElement):

  • rendering/RenderObject.h:

(WebCore::RenderObject::isSnapshottedPlugIn): Add new function to identify
RenderSnapshottedPlugIn instances. Since RenderSnapshottedPlugIn inherits from
RenderEmbeddedObject, isEmbeddedObject() still returns true.

  • rendering/RenderEmbeddedObject.h:

(RenderEmbeddedObject): Elevate a few virtual methods to protected for
RenderSnapshottedPlugIn to override.

  • rendering/RenderSnapshottedPlugIn.cpp: Added.

(WebCore::RenderSnapshottedPlugIn::RenderSnapshottedPlugIn): Initialize snapshot
resource.
(WebCore::RenderSnapshottedPlugIn::~RenderSnapshottedPlugIn): Shut down snapshot
image resource to remove the renderer as a client, and remove image from memory cache.
(WebCore::RenderSnapshottedPlugIn::plugInImageElement): Convenience function to get the
HTML element.
(WebCore::RenderSnapshottedPlugIn::updateSnapshot): Cache the snapshot, and repaint.
(WebCore::RenderSnapshottedPlugIn::paint): If the plugin is not playing, paint like a
RenderImage does.
(WebCore::RenderSnapshottedPlugIn::paintReplaced): Paint the snapshot and overlay if the
plugin is not playing.
(WebCore::RenderSnapshottedPlugIn::paintReplacedSnapshot): Inspired by
RenderImage::paintReplaced() and RenderImage::paintIntoRect().

  • rendering/RenderSnapshottedPlugIn.h: Added.

(WebCore::RenderSnapshottedPlugIn::isSnapshottedPlugin): Returns true.

  • rendering/RenderTheme.h: Add a function that paints the overlay on top of the snapshot.
  • rendering/RenderThemeMac.h:
  • rendering/RenderThemeMac.mm:

(WebCore::RenderThemeMac::paintPlugInSnapshotOverlay):

  • WebCore.xcodeproj/project.pbxproj: Add new RenderSnapshottedPlugIn class.
  • CMakeLists.txt: Ditto.
  • GNUmakefile.list.am: Ditto.
  • Target.pri: Ditto.
  • WebCore.gypi: Ditto.
  • WebCore.vcproj/WebCore.vcproj: Ditto.
  • rendering/RenderingAllInOne.cpp: Ditto.
Location:
trunk/Source/WebCore
Files:
2 added
17 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/CMakeLists.txt

    r130687 r130688  
    21182118    rendering/RenderSearchField.cpp
    21192119    rendering/RenderSlider.cpp
     2120    rendering/RenderSnapshottedPlugIn.cpp
    21202121    rendering/RenderTable.cpp
    21212122    rendering/RenderTableCaption.cpp
  • trunk/Source/WebCore/ChangeLog

    r130687 r130688  
     12012-10-08  Jon Lee  <jonlee@apple.com>
     2
     3        Add render object that paints plugin snapshots
     4        https://bugs.webkit.org/show_bug.cgi?id=98322
     5        <rdar://problem/12426546>
     6
     7        Reviewed by Simon Fraser.
     8
     9        First, teach plugins to maintain a set of states when plugin snapshotting is enabled.
     10
     11        Second, a new RenderSnapshottedPlugIn class is a RenderEmbeddedObject that knows how to paint
     12        snapshots when the plugin is not visibly playing. It maintains a RenderImageResource to
     13        the generated poster image.
     14
     15        * html/HTMLPlugInElement.cpp:
     16        (WebCore::HTMLPlugInElement::HTMLPlugInElement): By default all plugins play on load.
     17        * html/HTMLPlugInElement.h: Move the inheritance of ImageLoaderClientBase down to
     18        HTMLPlugInImageElement, since that is the class that actually deals with image-based plugins.
     19        (WebCore::HTMLPlugInElement::displayState): Add bit for display state.
     20        (WebCore::HTMLPlugInElement::setDisplayState):
     21        (WebCore::HTMLPlugInElement::updateSnapshot):
     22
     23        * html/HTMLPlugInImageElement.cpp:
     24        (WebCore::HTMLPlugInImageElement::HTMLPlugInImageElement): If plugin snapshotting is
     25        enabled, plugin state is set to wait for a poster image.
     26        (WebCore::HTMLPlugInImageElement::createRenderer): Create RenderSnapshottedPlugIn if
     27        plugin snapshotting is enabled.
     28        (WebCore::HTMLPlugInImageElement::updateSnapshot): Once a snapshot is available, update the
     29        renderer and set its state to wait for user input to start the plugin.
     30        * html/HTMLPlugInImageElement.h:
     31        (HTMLPlugInImageElement):
     32
     33        * rendering/RenderObject.h:
     34        (WebCore::RenderObject::isSnapshottedPlugIn): Add new function to identify
     35        RenderSnapshottedPlugIn instances. Since RenderSnapshottedPlugIn inherits from
     36        RenderEmbeddedObject, isEmbeddedObject() still returns true.
     37        * rendering/RenderEmbeddedObject.h:
     38        (RenderEmbeddedObject): Elevate a few virtual methods to protected for
     39        RenderSnapshottedPlugIn to override.
     40
     41        * rendering/RenderSnapshottedPlugIn.cpp: Added.
     42        (WebCore::RenderSnapshottedPlugIn::RenderSnapshottedPlugIn): Initialize snapshot
     43        resource.
     44        (WebCore::RenderSnapshottedPlugIn::~RenderSnapshottedPlugIn): Shut down snapshot
     45        image resource to remove the renderer as a client, and remove image from memory cache.
     46        (WebCore::RenderSnapshottedPlugIn::plugInImageElement): Convenience function to get the
     47        HTML element.
     48        (WebCore::RenderSnapshottedPlugIn::updateSnapshot): Cache the snapshot, and repaint.
     49        (WebCore::RenderSnapshottedPlugIn::paint): If the plugin is not playing, paint like a
     50        RenderImage does.
     51        (WebCore::RenderSnapshottedPlugIn::paintReplaced): Paint the snapshot and overlay if the
     52        plugin is not playing.
     53        (WebCore::RenderSnapshottedPlugIn::paintReplacedSnapshot): Inspired by
     54        RenderImage::paintReplaced() and RenderImage::paintIntoRect().
     55        * rendering/RenderSnapshottedPlugIn.h: Added.
     56        (WebCore::RenderSnapshottedPlugIn::isSnapshottedPlugin): Returns true.
     57
     58        * rendering/RenderTheme.h: Add a function that paints the overlay on top of the snapshot.
     59        * rendering/RenderThemeMac.h:
     60        * rendering/RenderThemeMac.mm:
     61        (WebCore::RenderThemeMac::paintPlugInSnapshotOverlay):
     62
     63        * WebCore.xcodeproj/project.pbxproj: Add new RenderSnapshottedPlugIn class.
     64        * CMakeLists.txt: Ditto.
     65        * GNUmakefile.list.am: Ditto.
     66        * Target.pri: Ditto.
     67        * WebCore.gypi: Ditto.
     68        * WebCore.vcproj/WebCore.vcproj: Ditto.
     69        * rendering/RenderingAllInOne.cpp: Ditto.
     70
    1712012-10-08  Hans Muller  <hmuller@adobe.com>
    272
  • trunk/Source/WebCore/GNUmakefile.list.am

    r130687 r130688  
    50865086        Source/WebCore/rendering/RenderSlider.cpp \
    50875087        Source/WebCore/rendering/RenderSlider.h \
     5088        Source/WebCore/rendering/RenderSnapshottedPlugIn.cpp \
     5089        Source/WebCore/rendering/RenderSnapshottedPlugIn.h \
    50885090        Source/WebCore/rendering/RenderTableCaption.cpp \
    50895091        Source/WebCore/rendering/RenderTableCaption.h \
  • trunk/Source/WebCore/Target.pri

    r130687 r130688  
    11851185    rendering/RenderSearchField.cpp \
    11861186    rendering/RenderSlider.cpp \
     1187    rendering/RenderSnapshottedPlugIn.cpp \
    11871188    rendering/RenderTable.cpp \
    11881189    rendering/RenderTableCaption.cpp \
    … …  
    23842385    rendering/RenderSearchField.h \
    23852386    rendering/RenderSlider.h \
     2387    rendering/RenderSnapshottedPlugIn.h \
    23862388    rendering/RenderTableCaption.h \
    23872389    rendering/RenderTableCell.h \
  • trunk/Source/WebCore/WebCore.gypi

    r130687 r130688  
    34333433            'rendering/RenderSlider.cpp',
    34343434            'rendering/RenderSlider.h',
     3435            'rendering/RenderSnapshottedPlugIn.cpp',
     3436            'rendering/RenderSnapshottedPlugIn.h',
    34353437            'rendering/RenderTable.cpp',
    34363438            'rendering/RenderTable.h',
  • trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj

    r130687 r130688  
    4216842168                        </File>
    4216942169                        <File
     42170                                RelativePath="..\rendering\RenderSnapshottedPlugIn.cpp"
     42171                                >
     42172                                <FileConfiguration
     42173                                        Name="Debug|Win32"
     42174                                        ExcludedFromBuild="true"
     42175                                        >
     42176                                        <Tool
     42177                                                Name="VCCLCompilerTool"
     42178                                        />
     42179                                </FileConfiguration>
     42180                                <FileConfiguration
     42181                                        Name="Release|Win32"
     42182                                        ExcludedFromBuild="true"
     42183                                        >
     42184                                        <Tool
     42185                                                Name="VCCLCompilerTool"
     42186                                        />
     42187                                </FileConfiguration>
     42188                                <FileConfiguration
     42189                                        Name="Debug_Cairo_CFLite|Win32"
     42190                                        ExcludedFromBuild="true"
     42191                                        >
     42192                                        <Tool
     42193                                                Name="VCCLCompilerTool"
     42194                                        />
     42195                                </FileConfiguration>
     42196                                <FileConfiguration
     42197                                        Name="Release_Cairo_CFLite|Win32"
     42198                                        ExcludedFromBuild="true"
     42199                                        >
     42200                                        <Tool
     42201                                                Name="VCCLCompilerTool"
     42202                                        />
     42203                                </FileConfiguration>
     42204                                <FileConfiguration
     42205                                        Name="Debug_All|Win32"
     42206                                        ExcludedFromBuild="true"
     42207                                        >
     42208                                        <Tool
     42209                                                Name="VCCLCompilerTool"
     42210                                        />
     42211                                </FileConfiguration>
     42212                                <FileConfiguration
     42213                                        Name="Production|Win32"
     42214                                        ExcludedFromBuild="true"
     42215                                        >
     42216                                        <Tool
     42217                                                Name="VCCLCompilerTool"
     42218                                        />
     42219                                </FileConfiguration>
     42220                        </File>
     42221                        <File
     42222                                RelativePath="..\rendering\RenderSnapshottedPlugIn.h"
     42223                                >
     42224                        </File>
     42225                        <File
    4217042226                                RelativePath="..\rendering\svg\RenderSVGAllInOne.cpp"
    4217142227                                >
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r130687 r130688  
    910910                3194620513022BF1004BB3F8 /* DOMWebKitAnimationList.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3194620313022BF1004BB3F8 /* DOMWebKitAnimationList.mm */; };
    911911                3194623213022F65004BB3F8 /* JSWebKitAnimationListCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3194623113022F65004BB3F8 /* JSWebKitAnimationListCustom.cpp */; };
     912                31955A86160D199000858025 /* RenderSnapshottedPlugIn.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 31E8D8BA160BC94B004CE8F5 /* RenderSnapshottedPlugIn.cpp */; };
     913                31955A88160D199200858025 /* RenderSnapshottedPlugIn.h in Headers */ = {isa = PBXBuildFile; fileRef = 31E8D8BB160BC94C004CE8F5 /* RenderSnapshottedPlugIn.h */; settings = {ATTRIBUTES = (Private, ); }; };
    912914                319AE063142D6B24006563A1 /* StyleFilterData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 319AE061142D6B24006563A1 /* StyleFilterData.cpp */; };
    913915                319AE064142D6B24006563A1 /* StyleFilterData.h in Headers */ = {isa = PBXBuildFile; fileRef = 319AE062142D6B24006563A1 /* StyleFilterData.h */; settings = {ATTRIBUTES = (Private, ); }; };
    … …  
    80418043                31C0FF470E4CEFDD007D6FE5 /* DOMWebKitTransitionEvent.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DOMWebKitTransitionEvent.mm; sourceTree = "<group>"; };
    80428044                31C0FF480E4CEFDD007D6FE5 /* DOMWebKitTransitionEventInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMWebKitTransitionEventInternal.h; sourceTree = "<group>"; };
     8045                31E8D8BA160BC94B004CE8F5 /* RenderSnapshottedPlugIn.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderSnapshottedPlugIn.cpp; sourceTree = "<group>"; };
     8046                31E8D8BB160BC94C004CE8F5 /* RenderSnapshottedPlugIn.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderSnapshottedPlugIn.h; sourceTree = "<group>"; };
    80438047                31EC1D5014FEFD0800C94662 /* NotificationPermissionCallback.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = NotificationPermissionCallback.idl; path = Modules/notifications/NotificationPermissionCallback.idl; sourceTree = "<group>"; };
    80448048                31EC1DAC14FF26EA00C94662 /* NotificationPermissionCallback.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = NotificationPermissionCallback.h; path = Modules/notifications/NotificationPermissionCallback.h; sourceTree = "<group>"; };
    … …  
    2149021494                                AB247A6A0AFD6383003FA5FD /* RenderSlider.cpp */,
    2149121495                                AB247A6B0AFD6383003FA5FD /* RenderSlider.h */,
     21496                                31E8D8BA160BC94B004CE8F5 /* RenderSnapshottedPlugIn.cpp */,
     21497                                31E8D8BB160BC94C004CE8F5 /* RenderSnapshottedPlugIn.h */,
    2149221498                                A8DF4AE20980C42C0052981B /* RenderTable.cpp */,
    2149321499                                A8DF4AE10980C42C0052981B /* RenderTable.h */,
    … …  
    2554525551                                931CBD11161A44E900E4C874 /* ScrollingStateTree.h in Headers */,
    2554625552                                6EAF34101613869A00859625 /* ExclusionPolygon.h in Headers */,
     25553                                31955A88160D199200858025 /* RenderSnapshottedPlugIn.h in Headers */,
    2554725554                        );
    2554825555                        runOnlyForDeploymentPostprocessing = 0;
    … …  
    2864328650                                931CBD13161A44F800E4C874 /* ScrollingStateNodeMac.mm in Sources */,
    2864428651                                6EAF340F1613869A00859625 /* ExclusionPolygon.cpp in Sources */,
     28652                                31955A86160D199000858025 /* RenderSnapshottedPlugIn.cpp in Sources */,
    2864528653                        );
    2864628654                        runOnlyForDeploymentPostprocessing = 0;
  • trunk/Source/WebCore/html/HTMLPlugInElement.cpp

    r124963 r130688  
    5656#endif
    5757    , m_isCapturingMouseEvents(false)
     58    , m_displayState(Playing)
    5859{
    5960}
  • trunk/Source/WebCore/html/HTMLPlugInElement.h

    r128323 r130688  
    22 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
    33 *           (C) 1999 Antti Koivisto (koivisto@kde.org)
    4  * Copyright (C) 2004, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
     4 * Copyright (C) 2004, 2006, 2007, 2008, 2009, 2012 Apple Inc. All rights reserved.
    55 *
    66 * This library is free software; you can redistribute it and/or
    … …  
    3434namespace WebCore {
    3535
     36class Image;
    3637class RenderEmbeddedObject;
    3738class RenderWidget;
    3839class Widget;
    3940
    40 class HTMLPlugInElement : public HTMLFrameOwnerElement, public ImageLoaderClientBase<HTMLPlugInElement> {
     41class HTMLPlugInElement : public HTMLFrameOwnerElement {
    4142public:
    4243    virtual ~HTMLPlugInElement();
    … …  
    4748
    4849    Widget* pluginWidget() const;
     50
     51    enum DisplayState {
     52        WaitingForSnapshot,
     53        DisplayingSnapshot,
     54        Playing
     55    };
     56    DisplayState displayState() const { return m_displayState; }
     57    void setDisplayState(DisplayState state) { m_displayState = state; }
     58    virtual void updateSnapshot(Image*) { }
    4959
    5060#if ENABLE(NETSCAPE_PLUGIN_API)
    … …  
    8595#endif
    8696    bool m_isCapturingMouseEvents;
     97
     98    DisplayState m_displayState;
    8799};
    88100
  • trunk/Source/WebCore/html/HTMLPlugInImageElement.cpp

    r129707 r130688  
    11/*
    2  * Copyright (C) 2008, 2011 Apple Inc. All rights reserved.
     2 * Copyright (C) 2008, 2011, 2012 Apple Inc. All rights reserved.
    33 *
    44 * This library is free software; you can redistribute it and/or
    … …  
    3232#include "RenderEmbeddedObject.h"
    3333#include "RenderImage.h"
     34#include "RenderSnapshottedPlugIn.h"
    3435#include "SecurityOrigin.h"
     36#include "Settings.h"
    3537#include "StyleResolver.h"
    3638
    … …  
    4850{
    4951    setHasCustomCallbacks();
     52
     53    if (document->page() && document->page()->settings()->plugInSnapshottingEnabled())
     54        setDisplayState(WaitingForSnapshot);
    5055}
    5156
    … …  
    142147        return image;
    143148    }
     149
     150    if (document()->page() && document()->page()->settings()->plugInSnapshottingEnabled())
     151        return new (arena) RenderSnapshottedPlugIn(this);
    144152    return new (arena) RenderEmbeddedObject(this);
    145153}
    … …  
    254262}
    255263
     264void HTMLPlugInImageElement::updateSnapshot(Image* image)
     265{
     266    if (displayState() > WaitingForSnapshot || !renderer()->isSnapshottedPlugIn())
     267        return;
     268
     269    toRenderSnapshottedPlugIn(renderer())->updateSnapshot(image);
     270    setDisplayState(DisplayingSnapshot);
     271}
     272
    256273} // namespace WebCore
  • trunk/Source/WebCore/html/HTMLPlugInImageElement.h

    r103679 r130688  
    11/*
    2  * Copyright (C) 2008, 2009, 2011 Apple Inc. All rights reserved.
     2 * Copyright (C) 2008, 2009, 2011, 2012 Apple Inc. All rights reserved.
    33 *
    44 * This library is free software; you can redistribute it and/or
    … …  
    4343
    4444// Base class for HTMLObjectElement and HTMLEmbedElement
    45 class HTMLPlugInImageElement : public HTMLPlugInElement {
     45class HTMLPlugInImageElement : public HTMLPlugInElement, public ImageLoaderClientBase<HTMLPlugInImageElement> {
    4646public:
    4747    virtual ~HTMLPlugInImageElement();
    … …  
    9191    virtual bool useFallbackContent() const { return false; }
    9292   
     93    virtual void updateSnapshot(Image*) OVERRIDE;
     94
    9395    bool m_needsWidgetUpdate;
    9496    bool m_shouldPreferPlugInsForImages;
  • trunk/Source/WebCore/rendering/RenderEmbeddedObject.h

    r126859 r130688  
    22 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
    33 *           (C) 2000 Simon Hausmann <hausmann@kde.org>
    4  * Copyright (C) 2004, 2005, 2006, 2008, 2009, 2010 Apple Inc. All rights reserved.
     4 * Copyright (C) 2004, 2005, 2006, 2008, 2009, 2010, 2012 Apple Inc. All rights reserved.
    55 *
    66 * This library is free software; you can redistribute it and/or
    … …  
    5757#endif
    5858
     59protected:
     60    virtual void paintReplaced(PaintInfo&, const LayoutPoint&);
     61    virtual void paint(PaintInfo&, const LayoutPoint&);
     62
     63    virtual CursorDirective getCursor(const LayoutPoint&, Cursor&) const;
     64
    5965private:
    6066    virtual const char* renderName() const { return "RenderEmbeddedObject"; }
    6167    virtual bool isEmbeddedObject() const { return true; }
    62 
    63     virtual void paintReplaced(PaintInfo&, const LayoutPoint&);
    64     virtual void paint(PaintInfo&, const LayoutPoint&);
    65     virtual CursorDirective getCursor(const LayoutPoint&, Cursor&) const;
    6668
    6769#if USE(ACCELERATED_COMPOSITING)
  • trunk/Source/WebCore/rendering/RenderObject.h

    r130081 r130688  
    44 *           (C) 2000 Dirk Mueller (mueller@kde.org)
    55 *           (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com)
    6  * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
     6 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2012 Apple Inc. All rights reserved.
    77 * Copyright (C) 2009 Google Inc. All rights reserved.
    88 *
    … …  
    338338    virtual bool isMeter() const { return false; }
    339339#endif
     340    virtual bool isSnapshottedPlugIn() const { return false; }
    340341#if ENABLE(PROGRESS_ELEMENT)
    341342    virtual bool isProgress() const { return false; }
  • trunk/Source/WebCore/rendering/RenderTheme.h

    r130567 r130688  
    3636namespace WebCore {
    3737
     38class CSSStyleSheet;
    3839class Element;
    3940class FileList;
    … …  
    4748class RenderProgress;
    4849#endif
    49 class CSSStyleSheet;
     50class RenderSnapshottedPlugIn;
    5051
    5152class RenderTheme : public RefCounted<RenderTheme> {
    … …  
    241242    virtual String fileListDefaultLabel(bool multipleFilesAllowed) const;
    242243    virtual String fileListNameForWidth(const FileList*, const Font&, int width, bool multipleFilesAllowed) const;
     244
     245    virtual void paintPlugInSnapshotOverlay(RenderSnapshottedPlugIn*, const PaintInfo&, const LayoutPoint&) const { }
    243246
    244247protected:
  • trunk/Source/WebCore/rendering/RenderThemeMac.h

    r130567 r130688  
    102102    // A view associated to the contained document. Subclasses may not have such a view and return a fake.
    103103    virtual NSView* documentViewFor(RenderObject*) const;
     104
     105    virtual void paintPlugInSnapshotOverlay(RenderSnapshottedPlugIn*, const PaintInfo&, const LayoutPoint&) const OVERRIDE;
     106
    104107protected:
    105108    RenderThemeMac();
  • trunk/Source/WebCore/rendering/RenderThemeMac.mm

    r130612 r130688  
    4242#import "RenderMediaControls.h"
    4343#import "RenderSlider.h"
     44#import "RenderSnapshottedPlugIn.h"
    4445#import "RenderView.h"
    4546#import "SharedBuffer.h"
    … …  
    22332234}
    22342235
     2236void RenderThemeMac::paintPlugInSnapshotOverlay(RenderSnapshottedPlugIn* renderer, const PaintInfo& paintInfo, const LayoutPoint& paintOffset) const
     2237{
     2238    LayoutUnit cWidth = renderer->contentWidth();
     2239    LayoutUnit cHeight = renderer->contentHeight();
     2240    if (!cWidth || !cHeight)
     2241        return;
     2242
     2243    GraphicsContext* context = paintInfo.context;
     2244    GraphicsContextStateSaver saver(*context);
     2245
     2246    LayoutSize borderAndPadding(renderer->borderLeft() + renderer->paddingLeft(), renderer->borderTop() + renderer->paddingTop());
     2247
     2248    LayoutSize contentSize(cWidth, cHeight);
     2249    LayoutPoint contentLocation = paintOffset;
     2250    contentLocation.move(borderAndPadding);
     2251
     2252    RefPtr<Gradient> g = Gradient::create(contentLocation, FloatPoint(contentLocation.x(), contentLocation.y() + cHeight));
     2253    g->addColorStop(0,  Color(.5f, .5, .5, .7));
     2254    g->addColorStop(.2, Color(.54f, .54, .54, .3));
     2255    g->addColorStop(.6, Color(.62f, .62, .62, .3));
     2256    g->addColorStop(1,  Color(.7f, .7, .7, .95));
     2257    context->setFillGradient(g.release());
     2258    context->fillRect(pixelSnappedIntRect(LayoutRect(contentLocation, contentSize)));
     2259
     2260    static const float diameter = 50, triangleRadius = 12;
     2261    LayoutPoint center = contentLocation;
     2262    center.move(cWidth / 2, cHeight / 2);
     2263    context->setFillColor(Color(.4f, .4, .4, .7), ColorSpaceSRGB);
     2264    context->fillEllipse(FloatRect(center.x() - diameter / 2, center.y() - diameter / 2, diameter, diameter));
     2265
     2266    Path p;
     2267    p.moveTo(FloatPoint(center.x() - triangleRadius * 3 / 4, center.y() - triangleRadius));
     2268    p.addLineTo(FloatPoint(center.x() + triangleRadius * 5 / 4, center.y()));
     2269    p.addLineTo(FloatPoint(center.x() - triangleRadius * 3 / 4, center.y() + triangleRadius));
     2270    p.closeSubpath();
     2271    context->setFillColor(Color(1.f, 1.f, 1.f, .9f), ColorSpaceSRGB);
     2272    context->fillPath(p);
     2273}
     2274
    22352275} // namespace WebCore
  • trunk/Source/WebCore/rendering/RenderingAllInOne.cpp

    r130081 r130688  
    9696#include "RenderSearchField.cpp"
    9797#include "RenderSlider.cpp"
     98#include "RenderSnapshottedPlugin.cpp"
    9899#include "RenderTable.cpp"
    99100#include "RenderTableCaption.cpp"
Note: See TracChangeset for help on using the changeset viewer.