Reviewed by Darin.
authormjs <mjs@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 21 Feb 2004 01:06:29 +0000 (01:06 +0000)
committermjs <mjs@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 21 Feb 2004 01:06:29 +0000 (01:06 +0000)
<rdar://problem/3552346>: REGRESSION 100-125: nil-dereference in KHTMLPart::isPointInsideSelection (progz.ru, many other sites)

        * khtml/rendering/render_layer.cpp:
        (RenderLayer::nodeAtPointForLayer): To cover the case of
positioned generated content, make sure to find an element if we
don't have one yet when we get to the layer level.

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

WebCore/ChangeLog-2005-08-23
WebCore/khtml/rendering/render_layer.cpp

index c83a57b..7346623 100644 (file)
@@ -1,3 +1,14 @@
+2004-02-20  Maciej Stachowiak  <mjs@apple.com>
+
+        Reviewed by Darin.
+
+       <rdar://problem/3552346>: REGRESSION 100-125: nil-dereference in KHTMLPart::isPointInsideSelection (progz.ru, many other sites)
+       
+        * khtml/rendering/render_layer.cpp:
+        (RenderLayer::nodeAtPointForLayer): To cover the case of
+       positioned generated content, make sure to find an element if we
+       don't have one yet when we get to the layer level.
+
 === Safari-129 ===
 
 2004-02-19  Chris Blumenberg  <cblu@apple.com>
index a9ddce8..8a70622 100644 (file)
@@ -880,8 +880,34 @@ RenderLayer::nodeAtPointForLayer(RenderLayer* rootLayer, RenderObject::NodeInfo&
         renderer()->nodeAtPoint(info, xMousePos, yMousePos,
                                 layerBounds.x() - renderer()->xPos(),
                                 layerBounds.y() - renderer()->yPos(),
-                                HitTestChildrenOnly))
+                                HitTestChildrenOnly)) {
+
+       // for positioned generated content, we might still not have a
+       // node by the time we get to the layer level, since none of
+       // the content in the layer has an element. So just walk up
+       // the tree.
+         if (!info.innerNode()) {
+           for (RenderObject *r = renderer(); r != NULL; r = r->parent()) { 
+               if (r->element()) {
+                   info.setInnerNode(r->element());
+                   break;
+               }
+           }
+        }
+
+        if (!info.innerNonSharedNode()) {
+            for (RenderObject *r = renderer(); r != NULL; r = r->parent()) { 
+                if (r->element()) {
+                    info.setInnerNonSharedNode(r->element());
+                    break;
+                }
+            }
+        }
+
+
+
         return this;
+    }
         
     // Now check our negative z-index children.
     if (m_negZOrderList) {