Title: [262594] trunk/Source/WebCore
Revision
262594
Author
za...@apple.com
Date
2020-06-04 20:57:49 -0700 (Thu, 04 Jun 2020)

Log Message

HTMLAppletElement::updateWidget should check for renderer after the overlapping test.
https://bugs.webkit.org/show_bug.cgi?id=212789
<rdar://problem/61854614>

Reviewed by Simon Fraser.

createJavaAppletWidget needs to check if the plugin(replacement) is obscured.
Since the overlapping test requires up-to-date geometry, it initiates a top level style recalc/layout.
We need to check if the apple element still has a renderer after the style recalc.

* html/HTMLAppletElement.cpp:
(WebCore::HTMLAppletElement::updateWidget):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (262593 => 262594)


--- trunk/Source/WebCore/ChangeLog	2020-06-05 03:37:14 UTC (rev 262593)
+++ trunk/Source/WebCore/ChangeLog	2020-06-05 03:57:49 UTC (rev 262594)
@@ -1,3 +1,18 @@
+2020-06-04  Zalan Bujtas  <za...@apple.com>
+
+        HTMLAppletElement::updateWidget should check for renderer after the overlapping test.
+        https://bugs.webkit.org/show_bug.cgi?id=212789
+        <rdar://problem/61854614>
+
+        Reviewed by Simon Fraser.
+
+        createJavaAppletWidget needs to check if the plugin(replacement) is obscured.
+        Since the overlapping test requires up-to-date geometry, it initiates a top level style recalc/layout.
+        We need to check if the apple element still has a renderer after the style recalc.
+
+        * html/HTMLAppletElement.cpp:
+        (WebCore::HTMLAppletElement::updateWidget):
+
 2020-06-04  Jack Lee  <shihchieh_...@apple.com>
 
         Nullptr crash in DeleteSelectionCommand::doApply() when ending position is disconnected.

Modified: trunk/Source/WebCore/html/HTMLAppletElement.cpp (262593 => 262594)


--- trunk/Source/WebCore/html/HTMLAppletElement.cpp	2020-06-05 03:37:14 UTC (rev 262593)
+++ trunk/Source/WebCore/html/HTMLAppletElement.cpp	2020-06-05 03:57:49 UTC (rev 262594)
@@ -117,13 +117,6 @@
 
     setNeedsWidgetUpdate(false);
 
-    RenderEmbeddedObject* renderer = renderEmbeddedObject();
-
-    LayoutUnit contentWidth = renderer->style().width().isFixed() ? LayoutUnit(renderer->style().width().value()) :
-        renderer->width() - renderer->horizontalBorderAndPaddingExtent();
-    LayoutUnit contentHeight = renderer->style().height().isFixed() ? LayoutUnit(renderer->style().height().value()) :
-        renderer->height() - renderer->verticalBorderAndPaddingExtent();
-
     Vector<String> paramNames;
     Vector<String> paramValues;
 
@@ -168,7 +161,20 @@
     RefPtr<Frame> frame = document().frame();
     ASSERT(frame);
 
-    renderer->setWidget(frame->loader().subframeLoader().createJavaAppletWidget(roundedIntSize(LayoutSize(contentWidth, contentHeight)), *this, paramNames, paramValues));
+    auto contentSize = LayoutSize { };
+    {
+        auto* renderer = renderEmbeddedObject();
+        auto& style = renderer->style();
+
+        contentSize = LayoutSize { style.width().isFixed() ? LayoutUnit(style.width().value()) : renderer->width() - renderer->horizontalBorderAndPaddingExtent(),
+            style.height().isFixed() ? LayoutUnit(style.height().value()) : renderer->height() - renderer->verticalBorderAndPaddingExtent() };
+    }
+
+    auto widget = frame->loader().subframeLoader().createJavaAppletWidget(roundedIntSize(contentSize), *this, paramNames, paramValues);
+    // createJavaAppletWidget needs to check if the plugin(replacement) is obscured. Since the overlapping test requires up-to-date geometry, it initiates a top level style recalc/layout.
+    // Let's see if this element still has a renderer after the style recalc.
+    if (auto* renderer = renderEmbeddedObject())
+        renderer->setWidget(WTFMove(widget));
 #endif // !PLATFORM(IOS_FAMILY)
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to