Title: [116687] trunk/Source
Revision
116687
Author
ander...@apple.com
Date
2012-05-10 14:21:00 -0700 (Thu, 10 May 2012)

Log Message

Rename the missing plug-in indicator to the unavailable plug-in indicator
https://bugs.webkit.org/show_bug.cgi?id=86136

Reviewed by Sam Weinig.

Source/WebCore:

Since the indicator is shown for more than just missing plug-ins, generalize it and use a plug-in unavailability
reason enum to make it easier to extend. Also, pass the unavailability reason to the ChromeClient member functions.

* WebCore.exp.in:
* html/HTMLEmbedElement.cpp:
(WebCore::HTMLEmbedElement::updateWidget):
* html/HTMLObjectElement.cpp:
(WebCore::HTMLObjectElement::updateWidget):
* html/HTMLPlugInElement.cpp:
(WebCore::HTMLPlugInElement::defaultEventHandler):
* html/HTMLPlugInImageElement.cpp:
(WebCore::HTMLPlugInImageElement::updateWidgetIfNecessary):
* loader/SubframeLoader.cpp:
(WebCore::SubframeLoader::loadPlugin):
* page/ChromeClient.h:
(WebCore::ChromeClient::shouldUnavailablePluginMessageBeButton):
(WebCore::ChromeClient::unavailablePluginButtonClicked):
* page/FrameView.cpp:
(WebCore::FrameView::updateWidget):
* rendering/RenderEmbeddedObject.cpp:
(WebCore::RenderEmbeddedObject::RenderEmbeddedObject):
(WebCore::RenderEmbeddedObject::setPluginUnavailabilityReason):
(WebCore::RenderEmbeddedObject::showsUnavailablePluginIndicator):
(WebCore::RenderEmbeddedObject::setUnavailablePluginIndicatorIsPressed):
(WebCore::RenderEmbeddedObject::paint):
(WebCore::RenderEmbeddedObject::paintReplaced):
(WebCore::RenderEmbeddedObject::getReplacementTextGeometry):
(WebCore::RenderEmbeddedObject::unavailablePluginReplacementText):
(WebCore):
(WebCore::RenderEmbeddedObject::isInUnavailablePluginIndicator):
(WebCore::shouldUnavailablePluginMessageBeButton):
(WebCore::RenderEmbeddedObject::handleUnavailablePluginIndicatorEvent):
(WebCore::RenderEmbeddedObject::getCursor):
* rendering/RenderEmbeddedObject.h:
(RenderEmbeddedObject):

Source/WebKit/mac:

* Plugins/Hosted/WebHostedNetscapePluginView.mm:
(-[WebHostedNetscapePluginView pluginHostDied]):
* WebCoreSupport/WebChromeClient.h:
* WebCoreSupport/WebChromeClient.mm:
(WebChromeClient::shouldUnavailablePluginMessageBeButton):
(WebChromeClient::unavailablePluginButtonClicked):

Source/WebKit/win:

* WebCoreSupport/WebChromeClient.cpp:
(WebChromeClient::shouldUnavailablePluginMessageBeButton):
(WebChromeClient::unavailablePluginButtonClicked):
* WebCoreSupport/WebChromeClient.h:
(WebChromeClient):

Source/WebKit2:

Update for WebCore changes.

* WebProcess/Plugins/PluginView.cpp:
(WebKit::PluginView::pluginProcessCrashed):
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::shouldUnavailablePluginMessageBeButton):
(WebKit::WebChromeClient::unavailablePluginButtonClicked):
* WebProcess/WebCoreSupport/WebChromeClient.h:
(WebChromeClient):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (116686 => 116687)


--- trunk/Source/WebCore/ChangeLog	2012-05-10 21:14:12 UTC (rev 116686)
+++ trunk/Source/WebCore/ChangeLog	2012-05-10 21:21:00 UTC (rev 116687)
@@ -1,3 +1,46 @@
+2012-05-10  Anders Carlsson  <ander...@apple.com>
+
+        Rename the missing plug-in indicator to the unavailable plug-in indicator
+        https://bugs.webkit.org/show_bug.cgi?id=86136
+
+        Reviewed by Sam Weinig.
+
+        Since the indicator is shown for more than just missing plug-ins, generalize it and use a plug-in unavailability
+        reason enum to make it easier to extend. Also, pass the unavailability reason to the ChromeClient member functions.
+
+        * WebCore.exp.in:
+        * html/HTMLEmbedElement.cpp:
+        (WebCore::HTMLEmbedElement::updateWidget):
+        * html/HTMLObjectElement.cpp:
+        (WebCore::HTMLObjectElement::updateWidget):
+        * html/HTMLPlugInElement.cpp:
+        (WebCore::HTMLPlugInElement::defaultEventHandler):
+        * html/HTMLPlugInImageElement.cpp:
+        (WebCore::HTMLPlugInImageElement::updateWidgetIfNecessary):
+        * loader/SubframeLoader.cpp:
+        (WebCore::SubframeLoader::loadPlugin):
+        * page/ChromeClient.h:
+        (WebCore::ChromeClient::shouldUnavailablePluginMessageBeButton):
+        (WebCore::ChromeClient::unavailablePluginButtonClicked):
+        * page/FrameView.cpp:
+        (WebCore::FrameView::updateWidget):
+        * rendering/RenderEmbeddedObject.cpp:
+        (WebCore::RenderEmbeddedObject::RenderEmbeddedObject):
+        (WebCore::RenderEmbeddedObject::setPluginUnavailabilityReason):
+        (WebCore::RenderEmbeddedObject::showsUnavailablePluginIndicator):
+        (WebCore::RenderEmbeddedObject::setUnavailablePluginIndicatorIsPressed):
+        (WebCore::RenderEmbeddedObject::paint):
+        (WebCore::RenderEmbeddedObject::paintReplaced):
+        (WebCore::RenderEmbeddedObject::getReplacementTextGeometry):
+        (WebCore::RenderEmbeddedObject::unavailablePluginReplacementText):
+        (WebCore):
+        (WebCore::RenderEmbeddedObject::isInUnavailablePluginIndicator):
+        (WebCore::shouldUnavailablePluginMessageBeButton):
+        (WebCore::RenderEmbeddedObject::handleUnavailablePluginIndicatorEvent):
+        (WebCore::RenderEmbeddedObject::getCursor):
+        * rendering/RenderEmbeddedObject.h:
+        (RenderEmbeddedObject):
+
 2012-05-10  Brady Eidson  <beid...@apple.com>
 
         <rdar://problem/10972577> and https://bugs.webkit.org/show_bug.cgi?id=80170

Modified: trunk/Source/WebCore/WebCore.exp.in (116686 => 116687)


--- trunk/Source/WebCore/WebCore.exp.in	2012-05-10 21:14:12 UTC (rev 116686)
+++ trunk/Source/WebCore/WebCore.exp.in	2012-05-10 21:21:00 UTC (rev 116687)
@@ -615,11 +615,11 @@
 __ZN7WebCore20NodeRenderingContextD1Ev
 __ZN7WebCore20PlatformEventFactory24createPlatformMouseEventEP7NSEventP6NSView
 __ZN7WebCore20PlatformEventFactory27createPlatformKeyboardEventEP7NSEvent
-__ZN7WebCore20RenderEmbeddedObject30setShowsCrashedPluginIndicatorEv
 __ZN7WebCore20ResourceResponseBase11setMimeTypeERKN3WTF6StringE
 __ZN7WebCore20ResourceResponseBase17setHTTPStatusCodeEi
 __ZN7WebCore20ResourceResponseBase20setSuggestedFilenameERKN3WTF6StringE
 __ZN7WebCore20ResourceResponseBase24setExpectedContentLengthEx
+__ZN7WebCore20RenderEmbeddedObject29setPluginUnavailabilityReasonENS0_26PluginUnavailabilityReasonE
 __ZN7WebCore20ResourceResponseBase6setURLERKNS_4KURLE
 __ZN7WebCore20ResourceResponseBaseC2Ev
 __ZN7WebCore20UserGestureIndicator7s_stateE

Modified: trunk/Source/WebCore/html/HTMLEmbedElement.cpp (116686 => 116687)


--- trunk/Source/WebCore/html/HTMLEmbedElement.cpp	2012-05-10 21:14:12 UTC (rev 116686)
+++ trunk/Source/WebCore/html/HTMLEmbedElement.cpp	2012-05-10 21:21:00 UTC (rev 116687)
@@ -132,7 +132,7 @@
 // moved down into HTMLPluginImageElement.cpp
 void HTMLEmbedElement::updateWidget(PluginCreationOption pluginCreationOption)
 {
-    ASSERT(!renderEmbeddedObject()->pluginCrashedOrWasMissing());
+    ASSERT(!renderEmbeddedObject()->showsUnavailablePluginIndicator());
     ASSERT(needsWidgetUpdate());
     setNeedsWidgetUpdate(false);
 

Modified: trunk/Source/WebCore/html/HTMLObjectElement.cpp (116686 => 116687)


--- trunk/Source/WebCore/html/HTMLObjectElement.cpp	2012-05-10 21:14:12 UTC (rev 116686)
+++ trunk/Source/WebCore/html/HTMLObjectElement.cpp	2012-05-10 21:21:00 UTC (rev 116687)
@@ -276,7 +276,7 @@
 // moved down into HTMLPluginImageElement.cpp
 void HTMLObjectElement::updateWidget(PluginCreationOption pluginCreationOption)
 {
-    ASSERT(!renderEmbeddedObject()->pluginCrashedOrWasMissing());
+    ASSERT(!renderEmbeddedObject()->showsUnavailablePluginIndicator());
     ASSERT(needsWidgetUpdate());
     setNeedsWidgetUpdate(false);
     // FIXME: This should ASSERT isFinishedParsingChildren() instead.

Modified: trunk/Source/WebCore/html/HTMLPlugInElement.cpp (116686 => 116687)


--- trunk/Source/WebCore/html/HTMLPlugInElement.cpp	2012-05-10 21:14:12 UTC (rev 116686)
+++ trunk/Source/WebCore/html/HTMLPlugInElement.cpp	2012-05-10 21:21:00 UTC (rev 116687)
@@ -169,8 +169,8 @@
     // FIXME: Mouse down and scroll events are passed down to plug-in via custom code in EventHandler; these code paths should be united.
 
     RenderObject* r = renderer();
-    if (r && r->isEmbeddedObject() && toRenderEmbeddedObject(r)->showsMissingPluginIndicator()) {
-        toRenderEmbeddedObject(r)->handleMissingPluginIndicatorEvent(event);
+    if (r && r->isEmbeddedObject() && toRenderEmbeddedObject(r)->showsUnavailablePluginIndicator()) {
+        toRenderEmbeddedObject(r)->handleUnavailablePluginIndicatorEvent(event);
         return;
     }
 

Modified: trunk/Source/WebCore/html/HTMLPlugInImageElement.cpp (116686 => 116687)


--- trunk/Source/WebCore/html/HTMLPlugInImageElement.cpp	2012-05-10 21:14:12 UTC (rev 116686)
+++ trunk/Source/WebCore/html/HTMLPlugInImageElement.cpp	2012-05-10 21:21:00 UTC (rev 116687)
@@ -189,7 +189,7 @@
     if (!needsWidgetUpdate() || useFallbackContent() || isImageType())
         return;
 
-    if (!renderEmbeddedObject() || renderEmbeddedObject()->pluginCrashedOrWasMissing())
+    if (!renderEmbeddedObject() || renderEmbeddedObject()->showsUnavailablePluginIndicator())
         return;
 
     updateWidget(CreateOnlyNonNetscapePlugins);

Modified: trunk/Source/WebCore/loader/SubframeLoader.cpp (116686 => 116687)


--- trunk/Source/WebCore/loader/SubframeLoader.cpp	2012-05-10 21:14:12 UTC (rev 116686)
+++ trunk/Source/WebCore/loader/SubframeLoader.cpp	2012-05-10 21:21:00 UTC (rev 116687)
@@ -376,7 +376,7 @@
         pluginElement, url, paramNames, paramValues, mimeType, loadManually);
 
     if (!widget) {
-        renderer->setShowsMissingPluginIndicator();
+        renderer->setPluginUnavailabilityReason(RenderEmbeddedObject::PluginMissing);
         return false;
     }
 

Modified: trunk/Source/WebCore/page/ChromeClient.h (116686 => 116687)


--- trunk/Source/WebCore/page/ChromeClient.h	2012-05-10 21:14:12 UTC (rev 116686)
+++ trunk/Source/WebCore/page/ChromeClient.h	2012-05-10 21:21:00 UTC (rev 116687)
@@ -30,6 +30,7 @@
 #include "HostWindow.h"
 #include "PopupMenu.h"
 #include "PopupMenuClient.h"
+#include "RenderEmbeddedObject.h"
 #include "ScrollTypes.h"
 #include "SearchPopupMenu.h"
 #include "WebCoreKeyboardUIMode.h"
@@ -170,8 +171,8 @@
         virtual void layoutUpdated(Frame*) const { }
         virtual void scrollRectIntoView(const IntRect&) const { }; // Currently only Mac has a non empty implementation.
        
-        virtual bool shouldMissingPluginMessageBeButton() const { return false; }
-        virtual void missingPluginButtonClicked(Element*) const { }
+        virtual bool shouldUnavailablePluginMessageBeButton(RenderEmbeddedObject::PluginUnavailabilityReason) const { return false; }
+        virtual void unavailablePluginButtonClicked(Element*, RenderEmbeddedObject::PluginUnavailabilityReason) const { }
         virtual void mouseDidMoveOverElement(const HitTestResult&, unsigned modifierFlags) = 0;
 
         virtual void setToolTip(const String&, TextDirection) = 0;

Modified: trunk/Source/WebCore/page/FrameView.cpp (116686 => 116687)


--- trunk/Source/WebCore/page/FrameView.cpp	2012-05-10 21:14:12 UTC (rev 116686)
+++ trunk/Source/WebCore/page/FrameView.cpp	2012-05-10 21:21:00 UTC (rev 116687)
@@ -2279,7 +2279,7 @@
         return;
 
     // No need to update if it's already crashed or known to be missing.
-    if (object->pluginCrashedOrWasMissing())
+    if (object->showsUnavailablePluginIndicator())
         return;
 
     // FIXME: This could turn into a real virtual dispatch if we defined

Modified: trunk/Source/WebCore/rendering/RenderEmbeddedObject.cpp (116686 => 116687)


--- trunk/Source/WebCore/rendering/RenderEmbeddedObject.cpp	2012-05-10 21:14:12 UTC (rev 116686)
+++ trunk/Source/WebCore/rendering/RenderEmbeddedObject.cpp	2012-05-10 21:21:00 UTC (rev 116687)
@@ -74,9 +74,9 @@
 RenderEmbeddedObject::RenderEmbeddedObject(Element* element)
     : RenderPart(element)
     , m_hasFallbackContent(false)
-    , m_showsMissingPluginIndicator(false)
-    , m_missingPluginIndicatorIsPressed(false)
-    , m_mouseDownWasInMissingPluginIndicator(false)
+    , m_showsUnavailablePluginIndicator(false)
+    , m_unavailablePluginIndicatorIsPressed(false)
+    , m_mouseDownWasInUnavailablePluginIndicator(false)
 {
     view()->frameView()->setIsVisuallyNonEmpty();
 }
@@ -102,30 +102,24 @@
 }
 #endif
 
-void RenderEmbeddedObject::setShowsMissingPluginIndicator()
+void RenderEmbeddedObject::setPluginUnavailabilityReason(PluginUnavailabilityReason pluginUnavailabilityReason)
 {
-    ASSERT(m_replacementText.isEmpty());
-    m_replacementText = missingPluginText();
-    m_showsMissingPluginIndicator = true;
+    ASSERT(!m_showsUnavailablePluginIndicator);
+    m_showsUnavailablePluginIndicator = true;
+    m_pluginUnavailabilityReason = pluginUnavailabilityReason;
 }
 
-void RenderEmbeddedObject::setShowsCrashedPluginIndicator()
+bool RenderEmbeddedObject::showsUnavailablePluginIndicator() const
 {
-    ASSERT(m_replacementText.isEmpty());
-    m_replacementText = crashedPluginText();
+    return m_showsUnavailablePluginIndicator;
 }
 
-bool RenderEmbeddedObject::pluginCrashedOrWasMissing() const
+void RenderEmbeddedObject::setUnavailablePluginIndicatorIsPressed(bool pressed)
 {
-    return !m_replacementText.isNull();
-}
-    
-void RenderEmbeddedObject::setMissingPluginIndicatorIsPressed(bool pressed)
-{
-    if (m_missingPluginIndicatorIsPressed == pressed)
+    if (m_unavailablePluginIndicatorIsPressed == pressed)
         return;
     
-    m_missingPluginIndicatorIsPressed = pressed;
+    m_unavailablePluginIndicatorIsPressed = pressed;
     repaint();
 }
 
@@ -135,7 +129,7 @@
     if (Frame* frame = this->frame())
         page = frame->page();
 
-    if (pluginCrashedOrWasMissing()) {
+    if (showsUnavailablePluginIndicator()) {
         if (page && paintInfo.phase == PaintPhaseForeground)
             page->addRelevantUnpaintedObject(this, visualOverflowRect());
         RenderReplaced::paint(paintInfo, paintOffset);
@@ -150,7 +144,7 @@
 
 void RenderEmbeddedObject::paintReplaced(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
 {
-    if (!pluginCrashedOrWasMissing())
+    if (!showsUnavailablePluginIndicator())
         return;
 
     if (paintInfo.phase == PaintPhaseSelection)
@@ -171,14 +165,14 @@
     
     GraphicsContextStateSaver stateSaver(*context);
     context->clip(contentRect);
-    context->setAlpha(m_missingPluginIndicatorIsPressed ? replacementTextPressedRoundedRectOpacity : replacementTextRoundedRectOpacity);
-    context->setFillColor(m_missingPluginIndicatorIsPressed ? replacementTextRoundedRectPressedColor() : Color::white, style()->colorSpace());
+    context->setAlpha(m_unavailablePluginIndicatorIsPressed ? replacementTextPressedRoundedRectOpacity : replacementTextRoundedRectOpacity);
+    context->setFillColor(m_unavailablePluginIndicatorIsPressed ? replacementTextRoundedRectPressedColor() : Color::white, style()->colorSpace());
     context->fillPath(path);
 
     const FontMetrics& fontMetrics = font.fontMetrics();
     float labelX = roundf(replacementTextRect.location().x() + (replacementTextRect.size().width() - textWidth) / 2);
     float labelY = roundf(replacementTextRect.location().y() + (replacementTextRect.size().height() - fontMetrics.height()) / 2 + fontMetrics.ascent());
-    context->setAlpha(m_missingPluginIndicatorIsPressed ? replacementTextPressedTextOpacity : replacementTextTextOpacity);
+    context->setAlpha(m_unavailablePluginIndicatorIsPressed ? replacementTextPressedTextOpacity : replacementTextTextOpacity);
     context->setFillColor(Color::black, style()->colorSpace());
     context->drawBidiText(font, run, FloatPoint(labelX, labelY));
 }
@@ -200,7 +194,7 @@
     font = Font(fontDescription, 0, 0);
     font.update(0);
     
-    run = TextRun(m_replacementText);
+    run = TextRun(unavailablePluginReplacementText());
     textWidth = font.width(run);
     
     replacementTextRect.setSize(FloatSize(textWidth + replacementTextRoundedRectLeftRightTextMargin * 2, replacementTextRoundedRectHeight));
@@ -213,6 +207,19 @@
     return true;
 }
 
+String RenderEmbeddedObject::unavailablePluginReplacementText() const
+{
+    switch (m_pluginUnavailabilityReason) {
+    case PluginMissing:
+        return missingPluginText();
+    case PluginCrashed:
+        return crashedPluginText();
+    }
+
+    ASSERT_NOT_REACHED();
+    return String();
+}
+
 void RenderEmbeddedObject::layout()
 {
     ASSERT(needsLayout());
@@ -295,7 +302,7 @@
 }
 
 
-bool RenderEmbeddedObject::isInMissingPluginIndicator(const LayoutPoint& point) const
+bool RenderEmbeddedObject::isInUnavailablePluginIndicator(const LayoutPoint& point) const
 {
     FloatRect contentRect;
     Path path;
@@ -307,20 +314,20 @@
         && path.contains(point);
 }
 
-bool RenderEmbeddedObject::isInMissingPluginIndicator(MouseEvent* event) const
+bool RenderEmbeddedObject::isInUnavailablePluginIndicator(MouseEvent* event) const
 {
-    return isInMissingPluginIndicator(roundedLayoutPoint(absoluteToLocal(event->absoluteLocation(), false, true)));
+    return isInUnavailablePluginIndicator(roundedLayoutPoint(absoluteToLocal(event->absoluteLocation(), false, true)));
 }
 
-static bool shouldMissingPluginMessageBeButton(Document* document)
+static bool shouldUnavailablePluginMessageBeButton(Document* document, RenderEmbeddedObject::PluginUnavailabilityReason pluginUnavailabilityReason)
 {
     Page* page = document->page();
-    return page && page->chrome()->client()->shouldMissingPluginMessageBeButton();
+    return page && page->chrome()->client()->shouldUnavailablePluginMessageBeButton(pluginUnavailabilityReason);
 }
 
-void RenderEmbeddedObject::handleMissingPluginIndicatorEvent(Event* event)
+void RenderEmbeddedObject::handleUnavailablePluginIndicatorEvent(Event* event)
 {
-    if (!shouldMissingPluginMessageBeButton(document()))
+    if (!shouldUnavailablePluginMessageBeButton(document(), m_pluginUnavailabilityReason))
         return;
     
     if (!event->isMouseEvent())
@@ -329,40 +336,40 @@
     MouseEvent* mouseEvent = static_cast<MouseEvent*>(event);
     HTMLPlugInElement* element = static_cast<HTMLPlugInElement*>(node());
     if (event->type() == eventNames().mousedownEvent && static_cast<MouseEvent*>(event)->button() == LeftButton) {
-        m_mouseDownWasInMissingPluginIndicator = isInMissingPluginIndicator(mouseEvent);
-        if (m_mouseDownWasInMissingPluginIndicator) {
+        m_mouseDownWasInUnavailablePluginIndicator = isInUnavailablePluginIndicator(mouseEvent);
+        if (m_mouseDownWasInUnavailablePluginIndicator) {
             if (Frame* frame = document()->frame()) {
                 frame->eventHandler()->setCapturingMouseEventsNode(element);
                 element->setIsCapturingMouseEvents(true);
             }
-            setMissingPluginIndicatorIsPressed(true);
+            setUnavailablePluginIndicatorIsPressed(true);
         }
         event->setDefaultHandled();
     }        
     if (event->type() == eventNames().mouseupEvent && static_cast<MouseEvent*>(event)->button() == LeftButton) {
-        if (m_missingPluginIndicatorIsPressed) {
+        if (m_unavailablePluginIndicatorIsPressed) {
             if (Frame* frame = document()->frame()) {
                 frame->eventHandler()->setCapturingMouseEventsNode(0);
                 element->setIsCapturingMouseEvents(false);
             }
-            setMissingPluginIndicatorIsPressed(false);
+            setUnavailablePluginIndicatorIsPressed(false);
         }
-        if (m_mouseDownWasInMissingPluginIndicator && isInMissingPluginIndicator(mouseEvent)) {
+        if (m_mouseDownWasInUnavailablePluginIndicator && isInUnavailablePluginIndicator(mouseEvent)) {
             if (Page* page = document()->page())
-                page->chrome()->client()->missingPluginButtonClicked(element);            
+                page->chrome()->client()->unavailablePluginButtonClicked(element, m_pluginUnavailabilityReason);
         }
-        m_mouseDownWasInMissingPluginIndicator = false;
+        m_mouseDownWasInUnavailablePluginIndicator = false;
         event->setDefaultHandled();
     }
     if (event->type() == eventNames().mousemoveEvent) {
-        setMissingPluginIndicatorIsPressed(m_mouseDownWasInMissingPluginIndicator && isInMissingPluginIndicator(mouseEvent));
+        setUnavailablePluginIndicatorIsPressed(m_mouseDownWasInUnavailablePluginIndicator && isInUnavailablePluginIndicator(mouseEvent));
         event->setDefaultHandled();
     }
 }
 
 CursorDirective RenderEmbeddedObject::getCursor(const LayoutPoint& point, Cursor& cursor) const
 {
-    if (m_showsMissingPluginIndicator && shouldMissingPluginMessageBeButton(document()) && isInMissingPluginIndicator(point)) {
+    if (showsUnavailablePluginIndicator() && shouldUnavailablePluginMessageBeButton(document(), m_pluginUnavailabilityReason) && isInUnavailablePluginIndicator(point)) {
         cursor = handCursor();
         return SetCursor;
     }

Modified: trunk/Source/WebCore/rendering/RenderEmbeddedObject.h (116686 => 116687)


--- trunk/Source/WebCore/rendering/RenderEmbeddedObject.h	2012-05-10 21:14:12 UTC (rev 116686)
+++ trunk/Source/WebCore/rendering/RenderEmbeddedObject.h	2012-05-10 21:21:00 UTC (rev 116687)
@@ -36,17 +36,18 @@
     RenderEmbeddedObject(Element*);
     virtual ~RenderEmbeddedObject();
 
-    bool pluginCrashedOrWasMissing() const;
-    
-    void setShowsMissingPluginIndicator();
-    void setShowsCrashedPluginIndicator();
-    bool showsMissingPluginIndicator() const { return m_showsMissingPluginIndicator; }
+    enum PluginUnavailabilityReason {
+        PluginMissing,
+        PluginCrashed,
+    };
+    void setPluginUnavailabilityReason(PluginUnavailabilityReason);
+    bool showsUnavailablePluginIndicator() const;
 
     // FIXME: This belongs on HTMLObjectElement.
     bool hasFallbackContent() const { return m_hasFallbackContent; }
     void setHasFallbackContent(bool hasFallbackContent) { m_hasFallbackContent = hasFallbackContent; }
 
-    void handleMissingPluginIndicatorEvent(Event*);
+    void handleUnavailablePluginIndicatorEvent(Event*);
 
 #if USE(ACCELERATED_COMPOSITING)
     virtual bool allowsAcceleratedCompositing() const;
@@ -72,16 +73,18 @@
     virtual bool scroll(ScrollDirection, ScrollGranularity, float multiplier, Node** stopNode);
     virtual bool logicalScroll(ScrollLogicalDirection, ScrollGranularity, float multiplier, Node** stopNode);
 
-    void setMissingPluginIndicatorIsPressed(bool);
-    bool isInMissingPluginIndicator(MouseEvent*) const;
-    bool isInMissingPluginIndicator(const LayoutPoint&) const;
+    void setUnavailablePluginIndicatorIsPressed(bool);
+    bool isInUnavailablePluginIndicator(MouseEvent*) const;
+    bool isInUnavailablePluginIndicator(const LayoutPoint&) const;
     bool getReplacementTextGeometry(const LayoutPoint& accumulatedOffset, FloatRect& contentRect, Path&, FloatRect& replacementTextRect, Font&, TextRun&, float& textWidth) const;
+    String unavailablePluginReplacementText() const;
 
-    String m_replacementText;
     bool m_hasFallbackContent; // FIXME: This belongs on HTMLObjectElement.
-    bool m_showsMissingPluginIndicator;
-    bool m_missingPluginIndicatorIsPressed;
-    bool m_mouseDownWasInMissingPluginIndicator;
+
+    bool m_showsUnavailablePluginIndicator;
+    PluginUnavailabilityReason m_pluginUnavailabilityReason;
+    bool m_unavailablePluginIndicatorIsPressed;
+    bool m_mouseDownWasInUnavailablePluginIndicator;
 };
 
 inline RenderEmbeddedObject* toRenderEmbeddedObject(RenderObject* object)

Modified: trunk/Source/WebKit/mac/ChangeLog (116686 => 116687)


--- trunk/Source/WebKit/mac/ChangeLog	2012-05-10 21:14:12 UTC (rev 116686)
+++ trunk/Source/WebKit/mac/ChangeLog	2012-05-10 21:21:00 UTC (rev 116687)
@@ -1,3 +1,17 @@
+2012-05-10  Anders Carlsson  <ander...@apple.com>
+
+        Rename the missing plug-in indicator to the unavailable plug-in indicator
+        https://bugs.webkit.org/show_bug.cgi?id=86136
+
+        Reviewed by Sam Weinig.
+
+        * Plugins/Hosted/WebHostedNetscapePluginView.mm:
+        (-[WebHostedNetscapePluginView pluginHostDied]):
+        * WebCoreSupport/WebChromeClient.h:
+        * WebCoreSupport/WebChromeClient.mm:
+        (WebChromeClient::shouldUnavailablePluginMessageBeButton):
+        (WebChromeClient::unavailablePluginButtonClicked):
+
 2012-05-09  Gyuyoung Kim  <gyuyoung....@samsung.com>
 
         Move suspendAnimations to use Internals interface.

Modified: trunk/Source/WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.mm (116686 => 116687)


--- trunk/Source/WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.mm	2012-05-10 21:14:12 UTC (rev 116686)
+++ trunk/Source/WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.mm	2012-05-10 21:21:00 UTC (rev 116687)
@@ -392,7 +392,7 @@
     if (_element->renderer() && _element->renderer()->isEmbeddedObject()) {
         // FIXME: The renderer could also be a RenderApplet, we should handle that.
         RenderEmbeddedObject* renderer = toRenderEmbeddedObject(_element->renderer());
-        renderer->setShowsCrashedPluginIndicator();
+        renderer->setPluginUnavailabilityReason(RenderEmbeddedObject::PluginCrashed);
     }
 
     _pluginLayer = nil;

Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebChromeClient.h (116686 => 116687)


--- trunk/Source/WebKit/mac/WebCoreSupport/WebChromeClient.h	2012-05-10 21:14:12 UTC (rev 116686)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebChromeClient.h	2012-05-10 21:21:00 UTC (rev 116687)
@@ -102,8 +102,8 @@
     virtual void setStatusbarText(const WTF::String&) OVERRIDE;
 
     virtual void scrollbarsModeDidChange() const OVERRIDE { }
-    virtual bool shouldMissingPluginMessageBeButton() const OVERRIDE;
-    virtual void missingPluginButtonClicked(WebCore::Element*) const OVERRIDE;
+    virtual bool shouldUnavailablePluginMessageBeButton(WebCore::RenderEmbeddedObject::PluginUnavailabilityReason) const OVERRIDE;
+    virtual void unavailablePluginButtonClicked(WebCore::Element*, WebCore::RenderEmbeddedObject::PluginUnavailabilityReason) const OVERRIDE;
     virtual void mouseDidMoveOverElement(const WebCore::HitTestResult&, unsigned modifierFlags) OVERRIDE;
 
     virtual void setToolTip(const WTF::String&, WebCore::TextDirection) OVERRIDE;

Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebChromeClient.mm (116686 => 116687)


--- trunk/Source/WebKit/mac/WebCoreSupport/WebChromeClient.mm	2012-05-10 21:14:12 UTC (rev 116686)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebChromeClient.mm	2012-05-10 21:21:00 UTC (rev 116687)
@@ -590,13 +590,17 @@
 
 // End host window methods.
 
-bool WebChromeClient::shouldMissingPluginMessageBeButton() const
+bool WebChromeClient::shouldUnavailablePluginMessageBeButton(RenderEmbeddedObject::PluginUnavailabilityReason pluginUnavailabilityReason) const
 {
-    return [[m_webView UIDelegate] respondsToSelector:@selector(webView:didPressMissingPluginButton:)];
+    if (pluginUnavailabilityReason == RenderEmbeddedObject::PluginMissing)
+        return [[m_webView UIDelegate] respondsToSelector:@selector(webView:didPressMissingPluginButton:)];
+
+    return false;
 }
 
-void WebChromeClient::missingPluginButtonClicked(Element* element) const
+void WebChromeClient::unavailablePluginButtonClicked(Element* element, RenderEmbeddedObject::PluginUnavailabilityReason pluginUnavailabilityReason) const
 {
+    ASSERT_UNUSED(pluginUnavailabilityReason, pluginUnavailabilityReason == RenderEmbeddedObject::PluginMissing);
     CallUIDelegate(m_webView, @selector(webView:didPressMissingPluginButton:), kit(element));
 }
 

Modified: trunk/Source/WebKit/win/ChangeLog (116686 => 116687)


--- trunk/Source/WebKit/win/ChangeLog	2012-05-10 21:14:12 UTC (rev 116686)
+++ trunk/Source/WebKit/win/ChangeLog	2012-05-10 21:21:00 UTC (rev 116687)
@@ -1,3 +1,16 @@
+2012-05-10  Anders Carlsson  <ander...@apple.com>
+
+        Rename the missing plug-in indicator to the unavailable plug-in indicator
+        https://bugs.webkit.org/show_bug.cgi?id=86136
+
+        Reviewed by Sam Weinig.
+
+        * WebCoreSupport/WebChromeClient.cpp:
+        (WebChromeClient::shouldUnavailablePluginMessageBeButton):
+        (WebChromeClient::unavailablePluginButtonClicked):
+        * WebCoreSupport/WebChromeClient.h:
+        (WebChromeClient):
+
 2012-05-09  Gyuyoung Kim  <gyuyoung....@samsung.com>
 
         Move suspendAnimations to use Internals interface.

Modified: trunk/Source/WebKit/win/WebCoreSupport/WebChromeClient.cpp (116686 => 116687)


--- trunk/Source/WebKit/win/WebCoreSupport/WebChromeClient.cpp	2012-05-10 21:14:12 UTC (rev 116686)
+++ trunk/Source/WebKit/win/WebCoreSupport/WebChromeClient.cpp	2012-05-10 21:21:00 UTC (rev 116687)
@@ -539,8 +539,11 @@
     uiDelegate->mouseDidMoveOverElement(m_webView, element.get(), modifierFlags);
 }
 
-bool WebChromeClient::shouldMissingPluginMessageBeButton() const
+bool WebChromeClient::shouldUnavailablePluginMessageBeButton(RenderEmbeddedObject::PluginUnavailabilityReason pluginUnavailabilityReason) const
 {
+    if (pluginUnavailabilityReason != RenderEmbeddedObject::PluginMissing)
+        return false;
+
     COMPtr<IWebUIDelegate> uiDelegate;
     if (FAILED(m_webView->uiDelegate(&uiDelegate)))
         return false;
@@ -551,8 +554,10 @@
     return uiDelegatePrivate3;
 }
 
-void WebChromeClient::missingPluginButtonClicked(Element* element) const
+void WebChromeClient::unavailablePluginButtonClicked(Element* element, RenderEmbeddedObject::PluginUnavailabilityReason pluginUnavailabilityReason) const
 {
+    ASSERT_UNUSED(pluginUnavailabilityReason, pluginUnavailabilityReason == RenderEmbeddedObject::PluginMissing);
+
     COMPtr<IWebUIDelegate> uiDelegate;
     if (FAILED(m_webView->uiDelegate(&uiDelegate)))
         return;

Modified: trunk/Source/WebKit/win/WebCoreSupport/WebChromeClient.h (116686 => 116687)


--- trunk/Source/WebKit/win/WebCoreSupport/WebChromeClient.h	2012-05-10 21:14:12 UTC (rev 116686)
+++ trunk/Source/WebKit/win/WebCoreSupport/WebChromeClient.h	2012-05-10 21:21:00 UTC (rev 116687)
@@ -106,8 +106,8 @@
 
     virtual void scrollbarsModeDidChange() const { }
     virtual void mouseDidMoveOverElement(const WebCore::HitTestResult&, unsigned modifierFlags);
-    virtual bool shouldMissingPluginMessageBeButton() const;
-    virtual void missingPluginButtonClicked(WebCore::Element*) const;
+    virtual bool shouldUnavailablePluginMessageBeButton(WebCore::RenderEmbeddedObject::PluginUnavailabilityReason) const;
+    virtual void unavailablePluginButtonClicked(WebCore::Element*, WebCore::RenderEmbeddedObject::PluginUnavailabilityReason) const;
 
     virtual void setToolTip(const WTF::String&, WebCore::TextDirection);
 

Modified: trunk/Source/WebKit2/ChangeLog (116686 => 116687)


--- trunk/Source/WebKit2/ChangeLog	2012-05-10 21:14:12 UTC (rev 116686)
+++ trunk/Source/WebKit2/ChangeLog	2012-05-10 21:21:00 UTC (rev 116687)
@@ -1,3 +1,20 @@
+2012-05-10  Anders Carlsson  <ander...@apple.com>
+
+        Rename the missing plug-in indicator to the unavailable plug-in indicator
+        https://bugs.webkit.org/show_bug.cgi?id=86136
+
+        Reviewed by Sam Weinig.
+
+        Update for WebCore changes.
+
+        * WebProcess/Plugins/PluginView.cpp:
+        (WebKit::PluginView::pluginProcessCrashed):
+        * WebProcess/WebCoreSupport/WebChromeClient.cpp:
+        (WebKit::WebChromeClient::shouldUnavailablePluginMessageBeButton):
+        (WebKit::WebChromeClient::unavailablePluginButtonClicked):
+        * WebProcess/WebCoreSupport/WebChromeClient.h:
+        (WebChromeClient):
+
 2012-05-10  Carlos Garcia Campos  <cgar...@igalia.com>
 
         [GTK] Test /webkit2/WebKitWebView/resources times out

Modified: trunk/Source/WebKit2/WebProcess/Plugins/PluginView.cpp (116686 => 116687)


--- trunk/Source/WebKit2/WebProcess/Plugins/PluginView.cpp	2012-05-10 21:14:12 UTC (rev 116686)
+++ trunk/Source/WebKit2/WebProcess/Plugins/PluginView.cpp	2012-05-10 21:21:00 UTC (rev 116687)
@@ -1109,7 +1109,7 @@
         return;
         
     RenderEmbeddedObject* renderer = toRenderEmbeddedObject(m_pluginElement->renderer());
-    renderer->setShowsCrashedPluginIndicator();
+    renderer->setPluginUnavailabilityReason(RenderEmbeddedObject::PluginCrashed);
     
     Widget::invalidate();
 }

Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp (116686 => 116687)


--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp	2012-05-10 21:14:12 UTC (rev 116686)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp	2012-05-10 21:21:00 UTC (rev 116687)
@@ -468,20 +468,26 @@
     notImplemented();
 }
 
-bool WebChromeClient::shouldMissingPluginMessageBeButton() const
+bool WebChromeClient::shouldUnavailablePluginMessageBeButton(RenderEmbeddedObject::PluginUnavailabilityReason pluginUnavailabilityReason) const
 {
-    // FIXME: <rdar://problem/8794397> We should only return true when there is a 
-    // missingPluginButtonClicked callback defined on the Page UI client.
-    return true;
+    if (pluginUnavailabilityReason == RenderEmbeddedObject::PluginMissing) {
+        // FIXME: <rdar://problem/8794397> We should only return true when there is a
+        // missingPluginButtonClicked callback defined on the Page UI client.
+        return true;
+    }
+
+    return false;
 }
     
-void WebChromeClient::missingPluginButtonClicked(Element* element) const
+void WebChromeClient::unavailablePluginButtonClicked(Element* element, RenderEmbeddedObject::PluginUnavailabilityReason pluginUnavailabilityReason) const
 {
     ASSERT(element->hasTagName(objectTag) || element->hasTagName(embedTag));
+    ASSERT(pluginUnavailabilityReason == RenderEmbeddedObject::PluginMissing);
 
     HTMLPlugInImageElement* pluginElement = static_cast<HTMLPlugInImageElement*>(element);
 
-    m_page->send(Messages::WebPageProxy::MissingPluginButtonClicked(pluginElement->serviceType(), pluginElement->url(), pluginElement->getAttribute(pluginspageAttr)));
+    if (pluginUnavailabilityReason == RenderEmbeddedObject::PluginMissing)
+        m_page->send(Messages::WebPageProxy::MissingPluginButtonClicked(pluginElement->serviceType(), pluginElement->url(), pluginElement->getAttribute(pluginspageAttr)));
 }
 
 void WebChromeClient::scrollbarsModeDidChange() const

Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h (116686 => 116687)


--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h	2012-05-10 21:14:12 UTC (rev 116686)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h	2012-05-10 21:21:00 UTC (rev 116687)
@@ -121,8 +121,8 @@
     virtual void contentsSizeChanged(WebCore::Frame*, const WebCore::IntSize&) const OVERRIDE;
     virtual void scrollRectIntoView(const WebCore::IntRect&) const OVERRIDE; // Currently only Mac has a non empty implementation.
 
-    virtual bool shouldMissingPluginMessageBeButton() const OVERRIDE;
-    virtual void missingPluginButtonClicked(WebCore::Element*) const OVERRIDE;
+    virtual bool shouldUnavailablePluginMessageBeButton(WebCore::RenderEmbeddedObject::PluginUnavailabilityReason) const OVERRIDE;
+    virtual void unavailablePluginButtonClicked(WebCore::Element*, WebCore::RenderEmbeddedObject::PluginUnavailabilityReason) const OVERRIDE;
 
     virtual void scrollbarsModeDidChange() const OVERRIDE;
     virtual void mouseDidMoveOverElement(const WebCore::HitTestResult&, unsigned modifierFlags) OVERRIDE;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to