Empty RenderInline objects should not be line break objects.
authorjhoneycutt@apple.com <jhoneycutt@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 21 Apr 2014 21:45:35 +0000 (21:45 +0000)
committerjhoneycutt@apple.com <jhoneycutt@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 21 Apr 2014 21:45:35 +0000 (21:45 +0000)
https://bugs.webkit.org/show_bug.cgi?id=131861
<rdar://problem/15663617>

Reviewed by David Hyatt.

.:
* ManualTests/empty-inline-as-line-break-position.html: Added.
This issue wouldn't reproduce in WebKitTestRunner.

Source/WebCore:
* rendering/line/BreakingContextInlineHeaders.h:
(WebCore::BreakingContext::canBreakAtThisPosition):
Don't break at this position if this is an empty RenderInline.

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

ChangeLog
ManualTests/empty-inline-as-line-break-position.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/rendering/line/BreakingContextInlineHeaders.h

index f337ca8..803f808 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2014-04-18  Jon Honeycutt  <jhoneycutt@apple.com>
+
+        Empty RenderInline objects should not be line break objects.
+
+        https://bugs.webkit.org/show_bug.cgi?id=131861
+        <rdar://problem/15663617>
+
+        Reviewed by David Hyatt.
+
+        * ManualTests/empty-inline-as-line-break-position.html: Added.
+        This issue wouldn't reproduce in WebKitTestRunner.
+
 2014-04-19  Brent Fulgham  <bfulgham@apple.com>
 
         Revert unintended workspace change in my last commit.
diff --git a/ManualTests/empty-inline-as-line-break-position.html b/ManualTests/empty-inline-as-line-break-position.html
new file mode 100644 (file)
index 0000000..ae6f6d8
--- /dev/null
@@ -0,0 +1,20 @@
+<div>
+    WebKit bug #<a href="https://bugs.webkit.org/show_bug.cgi?id=131861">131861</a>: Empty inlines should not be line break objects. This test must be run manually. On success, you will see "Test passed" below.
+</div>
+<script>
+    window.onload = function() {
+        document.body.offsetTop;
+        b.style.display = "inline-block";
+
+        document.body.offsetTop;
+        a.removeChild(c);
+
+        window.resizeTo(window.outerWidth + 1, window.outerHeight + 1);
+        setTimeout(function() { x.innerHTML = "Test passed"; }, 100);
+    }
+</script>
+<div style="width: 0px;" id="x">foo<span id="a">
+        <span id="b"></span><span>bar</span><span id="c"></span>
+    </span>
+    >
+
index 6779325..0153b15 100644 (file)
@@ -1,3 +1,16 @@
+2014-04-18  Jon Honeycutt  <jhoneycutt@apple.com>
+
+        Empty RenderInline objects should not be line break objects.
+
+        https://bugs.webkit.org/show_bug.cgi?id=131861
+        <rdar://problem/15663617>
+
+        Reviewed by David Hyatt.
+
+        * rendering/line/BreakingContextInlineHeaders.h:
+        (WebCore::BreakingContext::canBreakAtThisPosition):
+        Don't break at this position if this is an empty RenderInline.
+
 2014-04-21  Enrica Casucci  <enrica@apple.com>
 
         [iOS WebKit2] support replacements for misspelled words.
index 83ac7a0..0166a63 100644 (file)
@@ -931,6 +931,10 @@ inline bool BreakingContext::canBreakAtThisPosition()
     if (m_width.committedWidth() && !m_width.fitsOnLine(m_currentCharacterIsSpace) && m_currWS == NOWRAP)
         return true;
 
+    // Avoid breaking on empty inlines.
+    if (m_current.renderer()->isRenderInline() && isEmptyInline(toRenderInline(*m_current.renderer())))
+        return false;
+
     // Avoid breaking before empty inlines.
     if (m_nextObject && m_nextObject->isRenderInline() && isEmptyInline(toRenderInline(*m_nextObject)))
         return false;