Index: /FCKeditor/trunk/editor/_source/internals/fckselection_gecko.js
===================================================================
--- /FCKeditor/trunk/editor/_source/internals/fckselection_gecko.js	(revision 629)
+++ /FCKeditor/trunk/editor/_source/internals/fckselection_gecko.js	(revision 630)
@@ -66,10 +66,32 @@
 		if ( oSel )
 		{
-			var oNode = oSel.anchorNode ;
-
-			while ( oNode && oNode.nodeType != 1 )
-				oNode = oNode.parentNode ;
-
-			return oNode ;
+			// make the common case fast - for collapsed/nearly collapsed selections just return anchor.parent.
+			if ( oSel.anchorNode == oSel.focusNode )
+				return oSel.anchorNode.parentNode ;
+
+			// looks like we're having a large selection here. To make the behavior same as IE's TextRange.parentElement(),
+			// we need to find the nearest ancestor node which encapsulates both the beginning and the end of the selection.
+			var anchorPath = new FCKElementPath( oSel.anchorNode ) ;
+			var focusPath = new FCKElementPath( oSel.focusNode ) ; 
+			var deepPath = null ;
+			var shallowPath = null ;
+			if ( anchorPath.Elements.length > focusPath.Elements.length )
+			{
+				deepPath = anchorPath.Elements ;
+				shallowPath = focusPath.Elements ;
+			}
+			else
+			{
+				deepPath = focusPath.Elements ;
+				shallowPath = anchorPath.Elements ;
+			}
+			
+			var deepPathBase = deepPath.length - shallowPath.length ;
+			for( var i = 0 ; i < shallowPath.length ; i++)
+			{
+				if ( deepPath[deepPathBase + i] == shallowPath[i])
+					return shallowPath[i];
+			}
+			return null ;
 		}
 	}
Index: /FCKeditor/trunk/editor/_source/internals/fckselection_ie.js
===================================================================
--- /FCKeditor/trunk/editor/_source/internals/fckselection_ie.js	(revision 629)
+++ /FCKeditor/trunk/editor/_source/internals/fckselection_ie.js	(revision 630)
@@ -25,5 +25,14 @@
 FCKSelection.GetType = function()
 {
-	return FCK.EditorDocument.selection.type ;
+	var ieType = FCK.EditorDocument.selection.type ;
+	if ( ieType == 'Control' || ieType == 'Text' )
+		return ieType ;
+
+	// It is possible that we can still get a text range object even when type=='None' is returned by IE.
+	// So we'd better check the object returned by createRange() rather than by looking at the type.
+	if ( FCK.EditorDocument.selection.createRange().parentElement )
+		return 'Text' ;
+	else
+		return 'None' ;
 } ;
 
