Reviewed by Ken Kocienda.
[WebKit-https.git] / WebCore / khtml / xml / dom_nodeimpl.cpp
index b40cb3ba737b24e78ddd34ae46c0b2b48afd7c06..b7149a6cdb8f759dcaf8202e6ad59fa62b676ec6 100644 (file)
 #include "xbl/xbl_binding_manager.h"
 #endif
 
+#if APPLE_CHANGES
+#include "KWQAssertions.h"
+#include "KWQLogging.h"
+#else
+#define ASSERT(assertion) assert(assertion)
+#define LOG(channel, formatAndArgs...) ((void)0)
+#endif
+
 using namespace DOM;
 using namespace khtml;
 
@@ -1357,6 +1365,21 @@ ElementImpl *NodeImpl::enclosingBlockFlowElement() const
     return 0;
 }
 
+ElementImpl *NodeImpl::enclosingNonBlockFlowElement() const
+{
+    NodeImpl *n = const_cast<NodeImpl *>(this);
+    NodeImpl *p;
+
+    while (1) {
+        p = n->parentNode();
+        if (!p || p->isBlockFlow() || p->id() == ID_BODY)
+            return static_cast<ElementImpl *>(n);
+        n = p;
+    }
+    ASSERT_NOT_REACHED();
+    return 0;
+}
+
 ElementImpl *NodeImpl::rootEditableElement() const
 {
     if (!isContentEditable())