REGRESSION(r116687): [Chromium] plugins/embed-attributes-style.html shows a garbled...
authorandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 11 May 2012 19:40:30 +0000 (19:40 +0000)
committerandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 11 May 2012 19:40:30 +0000 (19:40 +0000)
https://bugs.webkit.org/show_bug.cgi?id=86170

Reviewed by Andreas Kling.

The string we are passing to the TextRun constructor needs to stay alive for longer so revert back to the old
behavior where we store it as a member variable.

* rendering/RenderEmbeddedObject.cpp:
(WebCore::unavailablePluginReplacementText):
(WebCore):
(WebCore::RenderEmbeddedObject::setPluginUnavailabilityReason):
(WebCore::RenderEmbeddedObject::getReplacementTextGeometry):
* rendering/RenderEmbeddedObject.h:
(RenderEmbeddedObject):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@116794 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderEmbeddedObject.cpp
Source/WebCore/rendering/RenderEmbeddedObject.h

index 5d11c2c..ea1a96c 100644 (file)
@@ -1,3 +1,21 @@
+2012-05-11  Anders Carlsson  <andersca@apple.com>
+
+        REGRESSION(r116687): [Chromium] plugins/embed-attributes-style.html shows a garbled string
+        https://bugs.webkit.org/show_bug.cgi?id=86170
+
+        Reviewed by Andreas Kling.
+
+        The string we are passing to the TextRun constructor needs to stay alive for longer so revert back to the old
+        behavior where we store it as a member variable.
+
+        * rendering/RenderEmbeddedObject.cpp:
+        (WebCore::unavailablePluginReplacementText):
+        (WebCore):
+        (WebCore::RenderEmbeddedObject::setPluginUnavailabilityReason):
+        (WebCore::RenderEmbeddedObject::getReplacementTextGeometry):
+        * rendering/RenderEmbeddedObject.h:
+        (RenderEmbeddedObject):
+
 2012-05-11  Simon Fraser  <simon.fraser@apple.com>
 
         CVDisplayLink keeps running after a single requestAnimationFrame
index 55cfcfd..315c16f 100644 (file)
@@ -102,11 +102,28 @@ bool RenderEmbeddedObject::allowsAcceleratedCompositing() const
 }
 #endif
 
+static String unavailablePluginReplacementText(RenderEmbeddedObject::PluginUnavailabilityReason pluginUnavailabilityReason)
+{
+    switch (pluginUnavailabilityReason) {
+    case RenderEmbeddedObject::PluginMissing:
+        return missingPluginText();
+    case RenderEmbeddedObject::PluginCrashed:
+        return crashedPluginText();
+    case RenderEmbeddedObject::InsecurePluginVersion:
+        return insecurePluginVersionText();
+    }
+
+    ASSERT_NOT_REACHED();
+    return String();
+}
+
 void RenderEmbeddedObject::setPluginUnavailabilityReason(PluginUnavailabilityReason pluginUnavailabilityReason)
 {
     ASSERT(!m_showsUnavailablePluginIndicator);
     m_showsUnavailablePluginIndicator = true;
     m_pluginUnavailabilityReason = pluginUnavailabilityReason;
+
+    m_unavailablePluginReplacementText = unavailablePluginReplacementText(pluginUnavailabilityReason);
 }
 
 bool RenderEmbeddedObject::showsUnavailablePluginIndicator() const
@@ -193,8 +210,8 @@ bool RenderEmbeddedObject::getReplacementTextGeometry(const LayoutPoint& accumul
     fontDescription.setComputedSize(fontDescription.specifiedSize());
     font = Font(fontDescription, 0, 0);
     font.update(0);
-    
-    run = TextRun(unavailablePluginReplacementText());
+
+    run = TextRun(m_unavailablePluginReplacementText);
     textWidth = font.width(run);
     
     replacementTextRect.setSize(FloatSize(textWidth + replacementTextRoundedRectLeftRightTextMargin * 2, replacementTextRoundedRectHeight));
@@ -207,21 +224,6 @@ bool RenderEmbeddedObject::getReplacementTextGeometry(const LayoutPoint& accumul
     return true;
 }
 
-String RenderEmbeddedObject::unavailablePluginReplacementText() const
-{
-    switch (m_pluginUnavailabilityReason) {
-    case PluginMissing:
-        return missingPluginText();
-    case PluginCrashed:
-        return crashedPluginText();
-    case InsecurePluginVersion:
-        return insecurePluginVersionText();
-    }
-
-    ASSERT_NOT_REACHED();
-    return String();
-}
-
 void RenderEmbeddedObject::layout()
 {
     ASSERT(needsLayout());
index 3564ff2..1e0bffb 100644 (file)
@@ -78,12 +78,12 @@ private:
     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;
 
     bool m_hasFallbackContent; // FIXME: This belongs on HTMLObjectElement.
 
     bool m_showsUnavailablePluginIndicator;
     PluginUnavailabilityReason m_pluginUnavailabilityReason;
+    String m_unavailablePluginReplacementText;
     bool m_unavailablePluginIndicatorIsPressed;
     bool m_mouseDownWasInUnavailablePluginIndicator;
 };