Diff
Modified: trunk/Source/WebCore/ChangeLog (142340 => 142341)
--- trunk/Source/WebCore/ChangeLog 2013-02-09 02:40:09 UTC (rev 142340)
+++ trunk/Source/WebCore/ChangeLog 2013-02-09 02:42:51 UTC (rev 142341)
@@ -1,3 +1,7 @@
+2013-02-08 Dean Jackson <[email protected]>
+
+ Rolling out r142333 and r142337 which broke Mac Release builds.
+
2013-02-08 Sheriff Bot <[email protected]>
Unreviewed, rolling out r142337.
Modified: trunk/Source/WebCore/css/plugIns.css (142340 => 142341)
--- trunk/Source/WebCore/css/plugIns.css 2013-02-09 02:40:09 UTC (rev 142340)
+++ trunk/Source/WebCore/css/plugIns.css 2013-02-09 02:42:51 UTC (rev 142341)
@@ -22,74 +22,5 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-/*
- * This is the UA StyleSheet for <object> and <embed> elements.
- *
- * Such elements, when snapshotted (paused), will contain a ShadowRoot
- * with the following structure:
- *
- * <object>
- * #ShadowRoot
- * <div class="snapshot-container">
- * <div class="snapshot-overlay"></div> <!-- e.g. for dimming content -->
- * <div class="snapshot-label">
- * <div class="snapshot-title">Snapshotted Plug-In</div>
- * <div class="snapshot-subtitle">Click to restart</div>
- * </div>
- * </div>
- * </div>
- *
- */
-
-object::-webkit-snapshotted-plugin-content,
-embed::-webkit-snapshotted-plugin-content
-{
- position: relative;
- display: inline-block;
- width: 100%;
- height: 100%;
-}
-
-object::-webkit-snapshotted-plugin-content *,
-embed::-webkit-snapshotted-plugin-content *
-{
- -webkit-user-select: none;
-}
-
-object::-webkit-snapshotted-plugin-content .snapshot-container,
-embed::-webkit-snapshotted-plugin-content .snapshot-container
-{
- position: absolute;
- width: 100%;
- height: 100%;
-}
-
-object::-webkit-snapshotted-plugin-content .snapshot-container .snapshot-overlay,
-embed::-webkit-snapshotted-plugin-content .snapshot-container .snapshot-overlay
-{
- display: none;
-}
-
-object::-webkit-snapshotted-plugin-content .snapshot-container .snapshot-label,
-embed::-webkit-snapshotted-plugin-content .snapshot-container .snapshot-label
-{
- position: absolute;
- background-color: white;
- color: black;
- margin: 1em;
- padding: 0.25em 2em;
- text-align: center;
-}
-
-object::-webkit-snapshotted-plugin-content .snapshot-container .snapshot-label .snapshot-title,
-embed::-webkit-snapshotted-plugin-content .snapshot-container .snapshot-label .snapshot-title
-{
- font-weight: bold;
-}
-
-object::-webkit-snapshotted-plugin-content .snapshot-container .snapshot-label .snapshot-subtitle,
-embed::-webkit-snapshotted-plugin-content .snapshot-container .snapshot-label .snapshot-subtitle
-{
- font-style: italic;
- color: #444;
-}
+/* plug-ins */
+p{} /*Needed by Windows because it doesn't like empty files*/
Modified: trunk/Source/WebCore/html/HTMLPlugInElement.cpp (142340 => 142341)
--- trunk/Source/WebCore/html/HTMLPlugInElement.cpp 2013-02-09 02:40:09 UTC (rev 142340)
+++ trunk/Source/WebCore/html/HTMLPlugInElement.cpp 2013-02-09 02:42:51 UTC (rev 142341)
@@ -201,10 +201,10 @@
toRenderEmbeddedObject(r)->handleUnavailablePluginIndicatorEvent(event);
return;
}
- } else if (r && r->isSnapshottedPlugIn() && displayState() < PlayingWithPendingMouseClick) {
- toRenderSnapshottedPlugIn(r)->handleEvent(event);
- HTMLFrameOwnerElement::defaultEventHandler(event);
- return;
+ if (r->isSnapshottedPlugIn() && displayState() < PlayingWithPendingMouseClick) {
+ toRenderSnapshottedPlugIn(r)->handleEvent(event);
+ return;
+ }
}
if (!r || !r->isWidget())
Modified: trunk/Source/WebCore/html/HTMLPlugInImageElement.cpp (142340 => 142341)
--- trunk/Source/WebCore/html/HTMLPlugInImageElement.cpp 2013-02-09 02:40:09 UTC (rev 142340)
+++ trunk/Source/WebCore/html/HTMLPlugInImageElement.cpp 2013-02-09 02:42:51 UTC (rev 142341)
@@ -21,20 +21,16 @@
#include "config.h"
#include "HTMLPlugInImageElement.h"
-#include "Chrome.h"
-#include "ChromeClient.h"
#include "Frame.h"
#include "FrameLoader.h"
#include "FrameLoaderClient.h"
#include "FrameView.h"
-#include "HTMLDivElement.h"
#include "HTMLImageLoader.h"
+#include "HTMLNames.h"
#include "Image.h"
-#include "LocalizedStrings.h"
#include "Logging.h"
#include "MouseEvent.h"
#include "NodeRenderStyle.h"
-#include "NodeRenderingContext.h"
#include "Page.h"
#include "PlugInClient.h"
#include "PlugInOriginHash.h"
@@ -45,14 +41,10 @@
#include "SchemeRegistry.h"
#include "SecurityOrigin.h"
#include "Settings.h"
-#include "ShadowRoot.h"
#include "StyleResolver.h"
-#include "Text.h"
namespace WebCore {
-using namespace HTMLNames;
-
static const int autoStartPlugInSizeThresholdWidth = 1;
static const int autoStartPlugInSizeThresholdHeight = 1;
static const int autoShowLabelSizeThresholdWidth = 400;
@@ -69,9 +61,7 @@
, m_needsWidgetUpdate(!createdByParser)
, m_shouldPreferPlugInsForImages(preferPlugInsForImagesOption == ShouldPreferPlugInsForImages)
, m_needsDocumentActivationCallbacks(false)
- , m_shouldShowSnapshotLabelAutomatically(false)
, m_simulatedMouseClickTimer(this, &HTMLPlugInImageElement::simulatedMouseClickTimerFired, simulatedMouseClickTimerDelay)
- , m_swapRendererTimer(this, &HTMLPlugInImageElement::swapRendererTimerFired)
{
setHasCustomCallbacks();
}
@@ -142,34 +132,27 @@
m_needsDocumentActivationCallbacks = true;
document()->registerForPageCacheSuspensionCallbacks(this);
}
-
- if (displayState() == DisplayingSnapshot) {
- RenderSnapshottedPlugIn* renderSnapshottedPlugIn = new (arena) RenderSnapshottedPlugIn(this);
- renderSnapshottedPlugIn->updateSnapshot(m_snapshotImage);
- if (m_shouldShowSnapshotLabelAutomatically)
- renderSnapshottedPlugIn->setShouldShowLabelAutomatically();
- return renderSnapshottedPlugIn;
- }
-
+
// Fallback content breaks the DOM->Renderer class relationship of this
// class and all superclasses because createObject won't necessarily
// return a RenderEmbeddedObject, RenderPart or even RenderWidget.
if (useFallbackContent())
return RenderObject::createObject(this, style);
-
if (isImageType()) {
RenderImage* image = new (arena) RenderImage(this);
image->setImageResource(RenderImageResource::create());
return image;
}
+ if (document()->page() && document()->page()->settings()->plugInSnapshottingEnabled())
+ return new (arena) RenderSnapshottedPlugIn(this);
return new (arena) RenderEmbeddedObject(this);
}
bool HTMLPlugInImageElement::willRecalcStyle(StyleChange)
{
// FIXME: Why is this necessary? Manual re-attach is almost always wrong.
- if (!useFallbackContent() && needsWidgetUpdate() && renderer() && !isImageType() && (displayState() != DisplayingSnapshot))
+ if (!useFallbackContent() && needsWidgetUpdate() && renderer() && !isImageType())
reattach();
return true;
}
@@ -275,81 +258,18 @@
void HTMLPlugInImageElement::updateSnapshot(PassRefPtr<Image> image)
{
- if (displayState() > DisplayingSnapshot)
+ if (displayState() > DisplayingSnapshot || !renderer()->isSnapshottedPlugIn())
return;
- m_snapshotImage = image;
- if (renderer()->isSnapshottedPlugIn()) {
- toRenderSnapshottedPlugIn(renderer())->updateSnapshot(image);
- return;
- }
-
+ toRenderSnapshottedPlugIn(renderer())->updateSnapshot(image);
setDisplayState(DisplayingSnapshot);
- m_swapRendererTimer.startOneShot(0);
}
-void HTMLPlugInImageElement::didAddUserAgentShadowRoot(ShadowRoot* root)
-{
- Document* doc = document();
-
- RefPtr<Element> shadowContainer = HTMLDivElement::create(doc);
- shadowContainer->setPseudo(AtomicString("-webkit-snapshotted-plugin-content", AtomicString::ConstructFromLiteral));
-
- RefPtr<Element> container = HTMLDivElement::create(doc);
- container->setAttribute(classAttr, AtomicString("snapshot-container", AtomicString::ConstructFromLiteral));
-
- RefPtr<Element> overlay = HTMLDivElement::create(doc);
- overlay->setAttribute(classAttr, AtomicString("snapshot-overlay", AtomicString::ConstructFromLiteral));
- container->appendChild(overlay, ASSERT_NO_EXCEPTION);
-
- RefPtr<Element> label = HTMLDivElement::create(doc);
- label->setAttribute(classAttr, AtomicString("snapshot-label", AtomicString::ConstructFromLiteral));
-
- String titleText = snapshottedPlugInLabelTitle();
- String subtitleText = snapshottedPlugInLabelSubtitle();
- if (document()->page()) {
- String clientTitleText = document()->page()->chrome()->client()->plugInStartLabelTitle();
- if (!clientTitleText.isEmpty())
- titleText = clientTitleText;
- String clientSubtitleText = document()->page()->chrome()->client()->plugInStartLabelSubtitle();
- if (!clientSubtitleText.isEmpty())
- subtitleText = clientSubtitleText;
- }
-
- RefPtr<Element> title = HTMLDivElement::create(doc);
- title->setAttribute(classAttr, AtomicString("snapshot-title", AtomicString::ConstructFromLiteral));
- title->appendChild(doc->createTextNode(titleText), ASSERT_NO_EXCEPTION);
- label->appendChild(title, ASSERT_NO_EXCEPTION);
-
- RefPtr<Element> subTitle = HTMLDivElement::create(doc);
- subTitle->setAttribute(classAttr, AtomicString("snapshot-subtitle", AtomicString::ConstructFromLiteral));
- subTitle->appendChild(doc->createTextNode(subtitleText), ASSERT_NO_EXCEPTION);
- label->appendChild(subTitle, ASSERT_NO_EXCEPTION);
-
- container->appendChild(label, ASSERT_NO_EXCEPTION);
-
- shadowContainer->appendChild(container, ASSERT_NO_EXCEPTION);
- root->appendChild(shadowContainer, ASSERT_NO_EXCEPTION);
-}
-
-void HTMLPlugInImageElement::swapRendererTimerFired(Timer<HTMLPlugInImageElement>*)
-{
- ASSERT(displayState() == DisplayingSnapshot);
- if (userAgentShadowRoot())
- return;
-
- // Create a shadow root, which will trigger the code to add a snapshot container
- // and reattach, thus making a new Renderer.
- ensureUserAgentShadowRoot();
-}
-
void HTMLPlugInImageElement::userDidClickSnapshot(PassRefPtr<MouseEvent> event)
{
m_pendingClickEventFromSnapshot = event;
if (document()->page() && !SchemeRegistry::shouldTreatURLSchemeAsLocal(document()->page()->mainFrame()->document()->baseURL().protocol()))
document()->page()->plugInClient()->addAutoStartOrigin(document()->page()->mainFrame()->document()->baseURL().host(), m_plugInOriginHash);
-
- reattach();
}
void HTMLPlugInImageElement::dispatchPendingMouseClick()
@@ -399,12 +319,16 @@
return;
}
+ if (!renderer()->isSnapshottedPlugIn()) {
+ LOG(Plugins, "%p Renderer is not snapshotted plugin, set to play", this);
+ return;
+ }
if (ScriptController::processingUserGesture()) {
LOG(Plugins, "%p Script is processing user gesture, set to play", this);
return;
}
- LayoutRect rect = toRenderEmbeddedObject(renderer())->contentBoxRect();
+ LayoutRect rect = toRenderSnapshottedPlugIn(renderer())->contentBoxRect();
int width = rect.width();
int height = rect.height();
if (!width || !height || (width <= autoStartPlugInSizeThresholdWidth && height <= autoStartPlugInSizeThresholdHeight)) {
@@ -427,13 +351,10 @@
}
if (shouldPlugInShowLabelAutomatically(document()->page()->mainFrame()->view()->contentsSize(), this))
- setShouldShowSnapshotLabelAutomatically();
+ toRenderSnapshottedPlugIn(renderer())->setShouldShowLabelAutomatically();
LOG(Plugins, "%p Plug-in hash %x is %dx%d, origin is not auto-start, set to wait for snapshot", this, m_plugInOriginHash, width, height);
- // We may have got to this point by restarting a snapshotted plug-in, in which case we don't want to
- // reset the display state.
- if (displayState() != PlayingWithPendingMouseClick)
- setDisplayState(WaitingForSnapshot);
+ setDisplayState(WaitingForSnapshot);
}
void HTMLPlugInImageElement::subframeLoaderDidCreatePlugIn(const Widget* widget)
Modified: trunk/Source/WebCore/html/HTMLPlugInImageElement.h (142340 => 142341)
--- trunk/Source/WebCore/html/HTMLPlugInImageElement.h 2013-02-09 02:40:09 UTC (rev 142340)
+++ trunk/Source/WebCore/html/HTMLPlugInImageElement.h 2013-02-09 02:42:51 UTC (rev 142341)
@@ -25,13 +25,11 @@
#include "RenderStyle.h"
#include <wtf/OwnPtr.h>
-#include <wtf/RefPtr.h>
namespace WebCore {
class HTMLImageLoader;
class FrameLoader;
-class Image;
class MouseEvent;
class Widget;
@@ -39,7 +37,7 @@
CreateAnyWidgetType,
CreateOnlyNonNetscapePlugins,
};
-
+
enum PreferPlugInsForImagesOption {
ShouldPreferPlugInsForImages,
ShouldNotPreferPlugInsForImages
@@ -94,31 +92,22 @@
private:
virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
virtual bool willRecalcStyle(StyleChange);
-
- void didAddUserAgentShadowRoot(ShadowRoot*) OVERRIDE;
-
+
virtual void finishParsingChildren();
void updateWidgetIfNecessary();
virtual bool useFallbackContent() const { return false; }
-
+
virtual void updateSnapshot(PassRefPtr<Image>) OVERRIDE;
virtual void dispatchPendingMouseClick() OVERRIDE;
void simulatedMouseClickTimerFired(DeferrableOneShotTimer<HTMLPlugInImageElement>*);
- void swapRendererTimerFired(Timer<HTMLPlugInImageElement>*);
-
- void setShouldShowSnapshotLabelAutomatically() { m_shouldShowSnapshotLabelAutomatically = true; }
-
bool m_needsWidgetUpdate;
bool m_shouldPreferPlugInsForImages;
bool m_needsDocumentActivationCallbacks;
- bool m_shouldShowSnapshotLabelAutomatically;
RefPtr<RenderStyle> m_customStyleForPageCache;
RefPtr<MouseEvent> m_pendingClickEventFromSnapshot;
DeferrableOneShotTimer<HTMLPlugInImageElement> m_simulatedMouseClickTimer;
- Timer<HTMLPlugInImageElement> m_swapRendererTimer;
- RefPtr<Image> m_snapshotImage;
};
} // namespace WebCore
Modified: trunk/Source/WebCore/page/ChromeClient.h (142340 => 142341)
--- trunk/Source/WebCore/page/ChromeClient.h 2013-02-09 02:40:09 UTC (rev 142340)
+++ trunk/Source/WebCore/page/ChromeClient.h 2013-02-09 02:42:51 UTC (rev 142341)
@@ -373,6 +373,7 @@
virtual bool isEmptyChromeClient() const { return false; }
+ virtual PassRefPtr<Image> plugInStartLabelImage(RenderSnapshottedPlugIn::LabelSize) const { return 0; }
virtual String plugInStartLabelTitle() const { return String(); }
virtual String plugInStartLabelSubtitle() const { return String(); }
virtual String plugInExtraStyleSheet() const { return String(); }
Modified: trunk/Source/WebCore/platform/LocalizedStrings.cpp (142340 => 142341)
--- trunk/Source/WebCore/platform/LocalizedStrings.cpp 2013-02-09 02:40:09 UTC (rev 142340)
+++ trunk/Source/WebCore/platform/LocalizedStrings.cpp 2013-02-09 02:42:51 UTC (rev 142341)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003, 2006, 2009, 2010, 2012, 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2003, 2006, 2009, 2010, 2012 Apple Inc. All rights reserved.
* Copyright (C) 2010 Igalia S.L
*
* Redistribution and use in source and binary forms, with or without
Modified: trunk/Source/WebCore/platform/LocalizedStrings.h (142340 => 142341)
--- trunk/Source/WebCore/platform/LocalizedStrings.h 2013-02-09 02:40:09 UTC (rev 142340)
+++ trunk/Source/WebCore/platform/LocalizedStrings.h 2013-02-09 02:42:51 UTC (rev 142341)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003, 2006, 2009, 2011, 2012, 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2003, 2006, 2009, 2011 Apple Inc. All rights reserved.
* Copyright (C) 2010 Igalia S.L
*
* Redistribution and use in source and binary forms, with or without
Modified: trunk/Source/WebCore/platform/blackberry/LocalizedStringsBlackBerry.cpp (142340 => 142341)
--- trunk/Source/WebCore/platform/blackberry/LocalizedStringsBlackBerry.cpp 2013-02-09 02:40:09 UTC (rev 142340)
+++ trunk/Source/WebCore/platform/blackberry/LocalizedStringsBlackBerry.cpp 2013-02-09 02:42:51 UTC (rev 142341)
@@ -617,16 +617,4 @@
return String::fromUTF8(s_resource.getString(BlackBerry::Platform::FILE_BUTTON_NO_FILE_SELECTED_LABEL));
}
-String snapshottedPlugInLabelTitle()
-{
- notImplemented();
- return String();
-}
-
-String snapshottedPlugInLabelSubtitle()
-{
- notImplemented();
- return String();
-}
-
} // namespace WebCore
Modified: trunk/Source/WebCore/platform/chromium/LocalizedStringsChromium.cpp (142340 => 142341)
--- trunk/Source/WebCore/platform/chromium/LocalizedStringsChromium.cpp 2013-02-09 02:40:09 UTC (rev 142340)
+++ trunk/Source/WebCore/platform/chromium/LocalizedStringsChromium.cpp 2013-02-09 02:42:51 UTC (rev 142341)
@@ -416,8 +416,6 @@
String contextMenuItemTagMediaPlay() { return String(); }
String contextMenuItemTagMediaPause() { return String(); }
String contextMenuItemTagMediaMute() { return String(); }
-String snapshottedPlugInLabelTitle() { return String(); }
-String snapshottedPlugInLabelSubtitle() { return String(); }
#if ENABLE(VIDEO_TRACK)
String textTrackClosedCaptionsText() { return String(); }
Modified: trunk/Source/WebCore/platform/efl/LocalizedStringsEfl.cpp (142340 => 142341)
--- trunk/Source/WebCore/platform/efl/LocalizedStringsEfl.cpp 2013-02-09 02:40:09 UTC (rev 142340)
+++ trunk/Source/WebCore/platform/efl/LocalizedStringsEfl.cpp 2013-02-09 02:42:51 UTC (rev 142341)
@@ -610,15 +610,4 @@
}
#endif
-String snapshottedPlugInLabelTitle()
-{
- return String("Snapshotted Plug-In");
}
-
-String snapshottedPlugInLabelSubtitle()
-{
- return String("Click to restart");
-}
-
-
-}
Modified: trunk/Source/WebCore/platform/gtk/LocalizedStringsGtk.cpp (142340 => 142341)
--- trunk/Source/WebCore/platform/gtk/LocalizedStringsGtk.cpp 2013-02-09 02:40:09 UTC (rev 142340)
+++ trunk/Source/WebCore/platform/gtk/LocalizedStringsGtk.cpp 2013-02-09 02:42:51 UTC (rev 142341)
@@ -774,14 +774,4 @@
}
#endif
-String snapshottedPlugInLabelTitle()
-{
- return String::fromUTF8(C_("Snapshotted Plug-In", "Title of the label to show on a snapshotted plug-in"));
}
-
-String snapshottedPlugInLabelSubtitle()
-{
- return String::fromUTF8(C_("Click to restart", "Subtitle of the label to show on a snapshotted plug-in"));
-}
-
-}
Modified: trunk/Source/WebCore/platform/qt/LocalizedStringsQt.cpp (142340 => 142341)
--- trunk/Source/WebCore/platform/qt/LocalizedStringsQt.cpp 2013-02-09 02:40:09 UTC (rev 142340)
+++ trunk/Source/WebCore/platform/qt/LocalizedStringsQt.cpp 2013-02-09 02:42:51 UTC (rev 142341)
@@ -723,18 +723,6 @@
return validationMessageTypeMismatchText();
}
-String snapshottedPlugInLabelTitle()
-{
- notImplemented();
- return String();
-}
-
-String snapshottedPlugInLabelSubtitle()
-{
- notImplemented();
- return String();
-}
-
String localizedString(const char* key)
{
return String::fromUTF8(key, strlen(key));
Modified: trunk/Source/WebCore/rendering/RenderSnapshottedPlugIn.cpp (142340 => 142341)
--- trunk/Source/WebCore/rendering/RenderSnapshottedPlugIn.cpp 2013-02-09 02:40:09 UTC (rev 142340)
+++ trunk/Source/WebCore/rendering/RenderSnapshottedPlugIn.cpp 2013-02-09 02:42:51 UTC (rev 142341)
@@ -40,13 +40,14 @@
#include "Page.h"
#include "PaintInfo.h"
#include "Path.h"
-#include "RenderView.h"
#include "SourceGraphic.h"
namespace WebCore {
static const int autoStartPlugInSizeThresholdWidth = 1;
static const int autoStartPlugInSizeThresholdHeight = 1;
+static const int startLabelPadding = 10; // Label should be 10px from edge of box.
+static const int startLabelInset = 20; // But the label is inset from its box also. FIXME: This will be removed when we go to a ShadowDOM approach.
static const double showLabelAfterMouseOverDelay = 1;
static const double showLabelAutomaticallyDelay = 3;
static const int snapshotLabelBlurRadius = 5;
@@ -99,7 +100,7 @@
#endif
RenderSnapshottedPlugIn::RenderSnapshottedPlugIn(HTMLPlugInImageElement* element)
- : RenderBlock(element)
+ : RenderEmbeddedObject(element)
, m_snapshotResource(RenderImageResource::create())
, m_shouldShowLabel(false)
, m_shouldShowLabelAutomatically(false)
@@ -144,17 +145,28 @@
void RenderSnapshottedPlugIn::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
{
- if (paintInfo.phase == PaintPhaseBlockBackground && plugInImageElement()->displayState() < HTMLPlugInElement::PlayingWithPendingMouseClick) {
+ if (plugInImageElement()->displayState() < HTMLPlugInElement::PlayingWithPendingMouseClick) {
+ RenderReplaced::paint(paintInfo, paintOffset);
+ return;
+ }
+
+ RenderEmbeddedObject::paint(paintInfo, paintOffset);
+}
+
+void RenderSnapshottedPlugIn::paintReplaced(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
+{
+ if (plugInImageElement()->displayState() < HTMLPlugInElement::PlayingWithPendingMouseClick) {
if (m_shouldShowLabel)
- paintSnapshotWithLabel(paintInfo, paintOffset);
+ paintReplacedSnapshotWithLabel(paintInfo, paintOffset);
else
- paintSnapshot(paintInfo, paintOffset);
+ paintReplacedSnapshot(paintInfo, paintOffset);
+ return;
}
- RenderBlock::paint(paintInfo, paintOffset);
+ RenderEmbeddedObject::paintReplaced(paintInfo, paintOffset);
}
-void RenderSnapshottedPlugIn::paintSnapshotImage(Image* image, PaintInfo& paintInfo, const LayoutPoint& paintOffset)
+void RenderSnapshottedPlugIn::paintSnapshot(Image* image, PaintInfo& paintInfo, const LayoutPoint& paintOffset)
{
LayoutUnit cWidth = contentWidth();
LayoutUnit cHeight = contentHeight();
@@ -168,7 +180,7 @@
#endif
LayoutSize contentSize(cWidth, cHeight);
- LayoutPoint contentLocation = location() + paintOffset;
+ LayoutPoint contentLocation = paintOffset;
contentLocation.move(borderLeft() + paddingLeft(), borderTop() + paddingTop());
LayoutRect rect(contentLocation, contentSize);
@@ -180,15 +192,33 @@
context->drawImage(image, style()->colorSpace(), alignedRect, CompositeSourceOver, shouldRespectImageOrientation(), useLowQualityScaling);
}
-void RenderSnapshottedPlugIn::paintSnapshot(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
+void RenderSnapshottedPlugIn::paintReplacedSnapshot(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
{
RefPtr<Image> image = m_snapshotResource->image();
if (!image || image->isNull())
return;
- paintSnapshotImage(image.get(), paintInfo, paintOffset);
+ paintSnapshot(image.get(), paintInfo, paintOffset);
}
+Image* RenderSnapshottedPlugIn::startLabelImage(LabelSize size) const
+{
+ static Image* labelImages[2] = { 0, 0 };
+ static bool initializedImages[2] = { false, false };
+
+ int arrayIndex = static_cast<int>(size);
+ if (labelImages[arrayIndex])
+ return labelImages[arrayIndex];
+ if (initializedImages[arrayIndex])
+ return 0;
+
+ if (document()->page()) {
+ labelImages[arrayIndex] = document()->page()->chrome()->client()->plugInStartLabelImage(size).leakRef();
+ initializedImages[arrayIndex] = true;
+ }
+ return labelImages[arrayIndex];
+}
+
#if ENABLE(FILTERS)
static PassRefPtr<Image> snapshottedPluginImageForLabelDisplay(PassRefPtr<Image> snapshot, const LayoutRect& blurRegion)
{
@@ -208,7 +238,7 @@
}
#endif
-void RenderSnapshottedPlugIn::paintSnapshotWithLabel(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
+void RenderSnapshottedPlugIn::paintReplacedSnapshotWithLabel(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
{
if (contentBoxRect().isEmpty())
return;
@@ -217,26 +247,43 @@
return;
m_showedLabelOnce = true;
- LayoutRect labelRect;
+ LayoutRect rect = contentBoxRect();
+ LayoutRect labelRect = tryToFitStartLabel(LabelSizeLarge, rect);
+ LabelSize size = NoLabel;
+ if (!labelRect.isEmpty())
+ size = LabelSizeLarge;
+ else {
+ labelRect = tryToFitStartLabel(LabelSizeSmall, rect);
+ if (!labelRect.isEmpty())
+ size = LabelSizeSmall;
+ else
+ return;
+ }
+ Image* labelImage = startLabelImage(size);
+ if (!labelImage)
+ return;
+
RefPtr<Image> snapshotImage = m_snapshotResource->image();
if (!snapshotImage || snapshotImage->isNull())
return;
#if ENABLE(FILTERS)
- // FIXME: Temporarily disabling the blur behind the label.
- // https://bugs.webkit.org/show_bug.cgi?id=108368
- if (!labelRect.isEmpty()) {
- RefPtr<Image> blurredSnapshotImage = m_snapshotResourceForLabel->image();
- if (!blurredSnapshotImage || blurredSnapshotImage->isNull()) {
- blurredSnapshotImage = snapshottedPluginImageForLabelDisplay(snapshotImage, labelRect);
- m_snapshotResourceForLabel->setCachedImage(new CachedImage(blurredSnapshotImage.get()));
- }
- snapshotImage = blurredSnapshotImage;
+ RefPtr<Image> blurredSnapshotImage = m_snapshotResourceForLabel->image();
+ if (!blurredSnapshotImage || blurredSnapshotImage->isNull()) {
+ blurredSnapshotImage = snapshottedPluginImageForLabelDisplay(snapshotImage, labelRect);
+ m_snapshotResourceForLabel->setCachedImage(new CachedImage(blurredSnapshotImage.get()));
}
+ snapshotImage = blurredSnapshotImage;
#endif
- paintSnapshotImage(snapshotImage.get(), paintInfo, paintOffset);
+ paintSnapshot(snapshotImage.get(), paintInfo, paintOffset);
+
+ // Remember that the labelRect includes the label inset, so we need to adjust for it.
+ paintInfo.context->drawImage(labelImage, ColorSpaceDeviceRGB,
+ IntRect(roundedIntPoint(paintOffset + labelRect.location() - IntSize(startLabelInset, startLabelInset)),
+ roundedIntSize(labelRect.size() + IntSize(2 * startLabelInset, 2 * startLabelInset))),
+ labelImage->rect());
}
void RenderSnapshottedPlugIn::repaintLabel()
@@ -262,7 +309,7 @@
overrideCursor = handCursor();
return SetCursor;
}
- return RenderBlock::getCursor(point, overrideCursor);
+ return RenderEmbeddedObject::getCursor(point, overrideCursor);
}
void RenderSnapshottedPlugIn::handleEvent(Event* event)
@@ -278,6 +325,12 @@
plugInImageElement()->setDisplayState(HTMLPlugInElement::PlayingWithPendingMouseClick);
plugInImageElement()->userDidClickSnapshot(mouseEvent);
+
+ if (widget()) {
+ if (Frame* frame = document()->frame())
+ frame->loader()->client()->recreatePlugin(widget());
+ repaint();
+ }
event->setDefaultHandled();
} else if (event->type() == eventNames().mousedownEvent) {
if (mouseEvent->button() != LeftButton)
@@ -305,6 +358,27 @@
}
}
+LayoutRect RenderSnapshottedPlugIn::tryToFitStartLabel(LabelSize size, const LayoutRect& contentBox) const
+{
+ Image* labelImage = startLabelImage(size);
+ if (!labelImage)
+ return LayoutRect();
+
+ // Assume that the labelImage has been provided to match our device scale.
+ float scaleFactor = 1;
+ if (document()->page())
+ scaleFactor = document()->page()->deviceScaleFactor();
+ IntSize labelImageSize = labelImage->size();
+ labelImageSize.scale(1 / (scaleFactor ? scaleFactor : 1));
+
+ LayoutSize labelSize = labelImageSize - LayoutSize(2 * startLabelInset, 2 * startLabelInset);
+ LayoutRect candidateRect(contentBox.maxXMinYCorner() + LayoutSize(-startLabelPadding, startLabelPadding) + LayoutSize(-labelSize.width(), 0), labelSize);
+ // The minimum allowed content box size is the label image placed in the center of the box, surrounded by startLabelPadding.
+ if (candidateRect.x() < startLabelPadding || candidateRect.maxY() > contentBox.height() - startLabelPadding)
+ return LayoutRect();
+ return candidateRect;
+}
+
void RenderSnapshottedPlugIn::resetDelayTimer(ShowReason reason)
{
m_showReason = reason;
Modified: trunk/Source/WebCore/rendering/RenderSnapshottedPlugIn.h (142340 => 142341)
--- trunk/Source/WebCore/rendering/RenderSnapshottedPlugIn.h 2013-02-09 02:40:09 UTC (rev 142340)
+++ trunk/Source/WebCore/rendering/RenderSnapshottedPlugIn.h 2013-02-09 02:42:51 UTC (rev 142341)
@@ -27,7 +27,7 @@
#define RenderSnapshottedPlugIn_h
#include "RenderBlock.h"
-
+#include "RenderEmbeddedObject.h"
#include "RenderImageResource.h"
#include "Timer.h"
@@ -35,11 +35,17 @@
class HTMLPlugInImageElement;
-class RenderSnapshottedPlugIn : public RenderBlock {
+class RenderSnapshottedPlugIn : public RenderEmbeddedObject {
public:
explicit RenderSnapshottedPlugIn(HTMLPlugInImageElement*);
virtual ~RenderSnapshottedPlugIn();
+ enum LabelSize {
+ LabelSizeSmall,
+ LabelSizeLarge,
+ NoLabel,
+ };
+
void updateSnapshot(PassRefPtr<Image>);
void handleEvent(Event*);
@@ -54,12 +60,16 @@
virtual CursorDirective getCursor(const LayoutPoint&, Cursor&) const OVERRIDE;
virtual bool isSnapshottedPlugIn() const OVERRIDE { return true; }
virtual void paint(PaintInfo&, const LayoutPoint&) OVERRIDE;
+ virtual void paintReplaced(PaintInfo&, const LayoutPoint&) OVERRIDE;
- void paintSnapshot(PaintInfo&, const LayoutPoint&);
- void paintSnapshotWithLabel(PaintInfo&, const LayoutPoint&);
- void paintSnapshotImage(Image*, PaintInfo&, const LayoutPoint&);
+ void paintReplacedSnapshot(PaintInfo&, const LayoutPoint&);
+ void paintReplacedSnapshotWithLabel(PaintInfo&, const LayoutPoint&);
+ void paintSnapshot(Image*, PaintInfo&, const LayoutPoint&);
void repaintLabel();
+ LayoutRect tryToFitStartLabel(LabelSize, const LayoutRect& contentBox) const;
+ Image* startLabelImage(LabelSize) const;
+
enum ShowReason {
UserMousedOver,
ShouldShowAutomatically
Modified: trunk/Source/WebKit2/ChangeLog (142340 => 142341)
--- trunk/Source/WebKit2/ChangeLog 2013-02-09 02:40:09 UTC (rev 142340)
+++ trunk/Source/WebKit2/ChangeLog 2013-02-09 02:42:51 UTC (rev 142341)
@@ -1,3 +1,7 @@
+2013-02-08 Dean Jackson <[email protected]>
+
+ Rolling out r142333 and r142337 which broke Mac Release builds.
+
2013-02-08 Anders Carlsson <[email protected]>
Move plug-in enumeration back to the main thread
Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageUIClient.cpp (142340 => 142341)
--- trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageUIClient.cpp 2013-02-09 02:40:09 UTC (rev 142340)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageUIClient.cpp 2013-02-09 02:42:51 UTC (rev 142341)
@@ -163,6 +163,26 @@
return m_client.didExceedDatabaseQuota(toAPI(page), toAPI(origin), toAPI(databaseName.impl()), toAPI(databaseDisplayName.impl()), currentQuotaBytes, currentOriginUsageBytes, currentDatabaseUsageBytes, expectedUsageBytes, m_client.clientInfo);
}
+PassRefPtr<WebImage> InjectedBundlePageUIClient::plugInStartLabelImage(RenderSnapshottedPlugIn::LabelSize size) const
+{
+ if (!m_client.plugInStartLabelImage)
+ return 0;
+
+ WKBundlePageLabelSize wkSize;
+ switch (size) {
+ case RenderSnapshottedPlugIn::LabelSizeSmall:
+ wkSize = WKBundlePageLabelSizeSmall;
+ break;
+ case RenderSnapshottedPlugIn::LabelSizeLarge:
+ wkSize = WKBundlePageLabelSizeLarge;
+ break;
+ default:
+ return 0;
+ }
+
+ return adoptRef(toImpl(m_client.plugInStartLabelImage(wkSize, m_client.clientInfo)));
+}
+
String InjectedBundlePageUIClient::plugInStartLabelTitle() const
{
return String();
Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageUIClient.h (142340 => 142341)
--- trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageUIClient.h 2013-02-09 02:40:09 UTC (rev 142340)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageUIClient.h 2013-02-09 02:42:51 UTC (rev 142341)
@@ -29,6 +29,7 @@
#include "APIClient.h"
#include "WKBundlePage.h"
#include "WebEvent.h"
+#include "WebImage.h"
#include <WebCore/RenderSnapshottedPlugIn.h>
#include <wtf/Forward.h>
@@ -70,6 +71,7 @@
void didReachApplicationCacheOriginQuota(WebPage*, WebSecurityOrigin*, int64_t totalBytesNeeded);
uint64_t didExceedDatabaseQuota(WebPage*, WebSecurityOrigin*, const String& databaseName, const String& databaseDisplayName, uint64_t currentQuotaBytes, uint64_t currentOriginUsageBytes, uint64_t currentDatabaseUsageBytes, uint64_t expectedUsageBytes);
+ PassRefPtr<WebImage> plugInStartLabelImage(WebCore::RenderSnapshottedPlugIn::LabelSize) const;
String plugInStartLabelTitle() const;
String plugInStartLabelSubtitle() const;
String plugInExtraStyleSheet() const;
Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp (142340 => 142341)
--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp 2013-02-09 02:40:09 UTC (rev 142340)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp 2013-02-09 02:42:51 UTC (rev 142341)
@@ -798,6 +798,11 @@
m_page->injectedBundleDiagnosticLoggingClient().logDiagnosticMessage(m_page, message, description, success);
}
+PassRefPtr<Image> WebChromeClient::plugInStartLabelImage(RenderSnapshottedPlugIn::LabelSize size) const
+{
+ return m_page->injectedBundleUIClient().plugInStartLabelImage(size)->bitmap()->createImage();
+}
+
String WebChromeClient::plugInStartLabelTitle() const
{
return m_page->injectedBundleUIClient().plugInStartLabelTitle();
Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h (142340 => 142341)
--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h 2013-02-09 02:40:09 UTC (rev 142340)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h 2013-02-09 02:42:51 UTC (rev 142341)
@@ -28,6 +28,7 @@
#define WebChromeClient_h
#include <WebCore/ChromeClient.h>
+#include <WebCore/Image.h>
#include <WebCore/ViewportArguments.h>
#include <wtf/text/WTFString.h>
@@ -217,6 +218,7 @@
virtual void logDiagnosticMessage(const String& message, const String& description, const String& success) OVERRIDE;
+ virtual PassRefPtr<WebCore::Image> plugInStartLabelImage(WebCore::RenderSnapshottedPlugIn::LabelSize) const OVERRIDE;
virtual String plugInStartLabelTitle() const OVERRIDE;
virtual String plugInStartLabelSubtitle() const OVERRIDE;
virtual String plugInExtraStyleSheet() const OVERRIDE;