diff --git modules/filter/filter.module modules/filter/filter.module
index 24c64bd..c7a6100 100644
--- modules/filter/filter.module
+++ modules/filter/filter.module
@@ -1594,7 +1594,7 @@ function _filter_autop($text) {
   // We don't apply any processing to the contents of these tags to avoid messing
   // up code. We look for matched pairs and allow basic nesting. For example:
   // "processed <pre> ignored <script> ignored </script> ignored </pre> processed"
-  $chunks = preg_split('@(<!--.*?-->|</?(?:pre|script|style|object|!--)[^>]*>)@i', $text, -1, PREG_SPLIT_DELIM_CAPTURE);
+  $chunks = preg_split('@(<!--.*?-->|</?(?:pre|script|style|object|iframe|!--)[^>]*>)@i', $text, -1, PREG_SPLIT_DELIM_CAPTURE);
   // Note: PHP ensures the array consists of alternating delimiters and literals
   // and begins and ends with a literal (inserting NULL as required).
   $ignore = FALSE;
@@ -1602,9 +1602,14 @@ function _filter_autop($text) {
   $output = '';
   foreach ($chunks as $i => $chunk) {
     if ($i % 2) {
-      // Opening or closing tag?
-      $open = ($chunk[1] != '/' || $chunk[1] != '!');
       $comment = (substr($chunk, 0, 4) == '<!--');
+      if ($comment) {
+        // Nothing to do, this is a comment.
+        $output .= $chunk;
+        continue;
+      }
+      // Opening or closing tag?
+      $open = ($chunk[1] != '/');
       list($tag) = preg_split('/[ >]/', substr($chunk, 2 - $open), 2);
       if (!$ignore) {
         if ($open) {
@@ -1613,7 +1618,7 @@ function _filter_autop($text) {
         }
       }
       // Only allow a matching tag to close it.
-      elseif ((!$open && $ignoretag == $tag) || $comment) {
+      elseif (!$open && $ignoretag == $tag) {
         $ignore = FALSE;
         $ignoretag = '';
       }
diff --git modules/filter/filter.test modules/filter/filter.test
index e8b8058..40d0977 100644
--- modules/filter/filter.test
+++ modules/filter/filter.test
@@ -833,6 +833,10 @@ class FilterUnitTestCase extends DrupalUnitTestCase {
       '<blockquote><pre>aaa</pre></blockquote>' => array(
         "<blockquote><pre>aaa</pre></blockquote>" => TRUE,
       ),
+      "<pre>aaa\nbbb\nccc</pre>\nddd\neee" => array(
+        "<pre>aaa\nbbb\nccc</pre>" => TRUE,
+        "<p>ddd<br />\neee</p>" => TRUE,
+      )
     );
     $this->assertFilteredString($filter, $tests);
 
