Reviewed by Adele.
authordarin <darin@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 12 May 2006 16:49:36 +0000 (16:49 +0000)
committerdarin <darin@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 12 May 2006 16:49:36 +0000 (16:49 +0000)
        - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=8521
          crash bringing up context menu with CSS generated content

        * bridge/mac/FrameMac.mm: (WebCore::FrameMac::sendContextMenuEvent):
        Added a null check.

        * manual-tests/context-click-generated-content.html: Added.

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

WebCore/ChangeLog
WebCore/bridge/mac/FrameMac.mm
WebCore/manual-tests/context-click-generated-content.html [new file with mode: 0644]

index bfa7174d3ceb8bbab3bc3f8276f76b8f89f3db3e..9904342f5cb87efd7839e8ba2d6c37b96bdef251 100644 (file)
@@ -1,3 +1,15 @@
+2006-05-12  Darin Adler  <darin@apple.com>
+
+        Reviewed by Adele.
+
+        - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=8521
+          crash bringing up context menu with CSS generated content
+
+        * bridge/mac/FrameMac.mm: (WebCore::FrameMac::sendContextMenuEvent):
+        Added a null check.
+
+        * manual-tests/context-click-generated-content.html: Added.
+
 2006-05-12  Darin Adler  <darin@apple.com>
 
         Reviewed by Adele.
index 11de414933a4f5dd00e1e90eb5fa9d32e61160f2..dc5c4767358c46acf9cdb5e3c17548030695a6a5 100644 (file)
@@ -2141,7 +2141,8 @@ bool FrameMac::sendContextMenuEvent(NSEvent *event)
 
     swallowEvent = v->dispatchMouseEvent(contextmenuEvent, mev.targetNode(), true, 0, mouseEvent, true);
     if (!swallowEvent && !isPointInsideSelection(viewportPos) &&
-        ([_bridge selectWordBeforeMenuEvent] || [_bridge isEditable] || mev.targetNode()->isContentEditable())) {
+            ([_bridge selectWordBeforeMenuEvent] || [_bridge isEditable]
+                || (mev.targetNode() && mev.targetNode()->isContentEditable()))) {
         _mouseDownMayStartSelect = true; // context menu events are always allowed to perform a selection
         selectClosestWordFromMouseEvent(mouseEvent, mev.targetNode());
     }
diff --git a/WebCore/manual-tests/context-click-generated-content.html b/WebCore/manual-tests/context-click-generated-content.html
new file mode 100644 (file)
index 0000000..3fcaf6d
--- /dev/null
@@ -0,0 +1,21 @@
+<style type="text/css">
+html:before, html:after {
+       content: "";
+       width: 50px;
+       height: 50px;
+       position: fixed;
+}
+html:before {
+       border: solid red 5px;
+}
+html:after {
+       border: solid green 5px;
+       top: 60px;
+}
+</style>
+
+<p>
+Test of crash when context-clicking on generated content.
+Do a control-click or a right-click in one of these two
+boxes, and make sure you don't see a crash.
+</p>