Bug 611103 - Part 3: Handle the edge case where the br element appears immediately after another br. r=bzbarsky, a=lmandel
authorEhsan Akhgari <ehsan@mozilla.com>
Fri, 23 Jan 2015 11:23:24 -0500
changeset 249613 e0de9ceed8b37b1ca315ff7fb83fe5f461aab1c7
parent 249612 05d65b2c6a3d7b47063c18cc90c0b6c2c2199990
child 249614 9455f35972cb821b87a3ee780639a1b61eb9f054
push id4489
push userraliiev@mozilla.com
push dateMon, 23 Feb 2015 15:17:55 +0000
treeherdermozilla-beta@fd7c3dc24146 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbzbarsky, lmandel
bugs611103, 1119503
milestone37.0a2
Bug 611103 - Part 3: Handle the edge case where the br element appears immediately after another br. r=bzbarsky, a=lmandel The test for bug 1119503 examines this edge case.
dom/base/nsDocumentEncoder.cpp
--- a/dom/base/nsDocumentEncoder.cpp
+++ b/dom/base/nsDocumentEncoder.cpp
@@ -325,19 +325,22 @@ IsInvisibleBreak(nsINode *aNode) {
     return false;
   }
   nsIFrame* frame = aNode->AsElement()->GetPrimaryFrame();
   if (!frame || frame->GetType() != nsGkAtoms::brFrame) {
     return false;
   }
 
   // If the BRFrame has caused a visible line break, it should have a next
-  // sibling, or otherwise no siblings and a non-zero height.
+  // sibling, or otherwise no siblings (or immediately after a br) and a
+  // non-zero height.
   bool visible = frame->GetNextSibling() ||
-                 (!frame->GetPrevSibling() && frame->GetRect().Height() != 0);
+                 ((!frame->GetPrevSibling() ||
+                   frame->GetPrevSibling()->GetType() == nsGkAtoms::brFrame) &&
+                  frame->GetRect().Height() != 0);
   return !visible;
 }
 
 nsresult
 nsDocumentEncoder::SerializeNodeStart(nsINode* aNode,
                                       int32_t aStartOffset,
                                       int32_t aEndOffset,
                                       nsAString& aStr,