Borders inside box-decoration-break: clone after a br do not contribute to line breaking
authormmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 8 Jan 2015 16:14:59 +0000 (16:14 +0000)
committermmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 8 Jan 2015 16:14:59 +0000 (16:14 +0000)
https://bugs.webkit.org/show_bug.cgi?id=140238

Reviewed by Darin Adler.

Source/WebCore:

When we iterate through renderers for line breaking, we determine which of the renderers
is responsible for inserting its parent's border width. However, this determination didn't
take a <br> and box-decoration-break: clone into account.

Test: fast/box-decoration-break/box-decoration-break-clone-line-break.html

* rendering/line/BreakingContextInlineHeaders.h:
(WebCore::shouldAddBorderPaddingMargin):
(WebCore::previousInFlowSibling): Clean up to use a do / while block.

LayoutTests:

* fast/box-decoration-break/box-decoration-break-clone-line-break-expected.html: Added.
* fast/box-decoration-break/box-decoration-break-clone-line-break.html: Added.
* platform/mac/TestExpectations:

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

LayoutTests/ChangeLog
LayoutTests/fast/box-decoration-break/box-decoration-break-clone-line-break-expected.html [new file with mode: 0644]
LayoutTests/fast/box-decoration-break/box-decoration-break-clone-line-break.html [new file with mode: 0644]
LayoutTests/platform/mac/TestExpectations
Source/WebCore/ChangeLog
Source/WebCore/rendering/line/BreakingContextInlineHeaders.h

index c0663df52b1edad9dce0affaad11d76140af6fe5..82d9b88937216382a916f2aa1aa87ed6a6272a85 100644 (file)
@@ -1,3 +1,14 @@
+2015-01-08  Myles C. Maxfield  <mmaxfield@apple.com>
+
+        Borders inside box-decoration-break: clone after a br do not contribute to line breaking
+        https://bugs.webkit.org/show_bug.cgi?id=140238
+
+        Reviewed by Darin Adler.
+
+        * fast/box-decoration-break/box-decoration-break-clone-line-break-expected.html: Added.
+        * fast/box-decoration-break/box-decoration-break-clone-line-break.html: Added.
+        * platform/mac/TestExpectations:
+
 2015-01-08  Bartlomiej Gajda  <b.gajda@samsung.com>
 
         [EFL] Clean typos in tests expectations after r177492.
diff --git a/LayoutTests/fast/box-decoration-break/box-decoration-break-clone-line-break-expected.html b/LayoutTests/fast/box-decoration-break/box-decoration-break-clone-line-break-expected.html
new file mode 100644 (file)
index 0000000..00809ed
--- /dev/null
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+This test makes sure that starting border after a newline inside a box-decoration-break span correctly influences line breaking.
+<div style="width: 200px; background: yellow; font: 20px Ahem; color: blue;">
+<span style="border-left: 160px solid black; -webkit-box-decoration-break: clone;">a</span><br>
+<span style="border-left: 160px solid black; -webkit-box-decoration-break: clone;">a</span><br>
+<span style="border-left: 160px solid black; -webkit-box-decoration-break: clone;">a</span>
+</div>
+</body>
+</html>
diff --git a/LayoutTests/fast/box-decoration-break/box-decoration-break-clone-line-break.html b/LayoutTests/fast/box-decoration-break/box-decoration-break-clone-line-break.html
new file mode 100644 (file)
index 0000000..3b026a7
--- /dev/null
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+This test makes sure that starting border after a newline inside a box-decoration-break span correctly influences line breaking.
+<div style="width: 200px; background: yellow; font: 20px Ahem; color: blue;">
+<span style="border-left: 160px solid black; -webkit-box-decoration-break: clone;">a<br>a a</span>
+</div>
+</body>
+</html>
index 541f7b803fe6e3a4537802cc984b9a16919719d4..baf36d53aeed8b9392add02c8fceb0598aeb3f9b 100644 (file)
@@ -1340,7 +1340,6 @@ fast/canvas/canvas-fillRect-gradient-shadow.html [ Pass Failure ]
 # Kerning, Ligatures, and Printer Fonts caused these tests to fail
 # The following tests are reftests
 webkit.org/b/139968 css3/flexbox/csswg/flexbox_direction-row-reverse.html [ ImageOnlyFailure ]
-webkit.org/b/139968 fast/box-decoration-break/box-decoration-break-rendering.html [ ImageOnlyFailure ]
 webkit.org/b/139968 fast/css-generated-content/after-with-inline-continuation.html [ ImageOnlyFailure ]
 webkit.org/b/139968 fast/css-intrinsic-dimensions/width-avoid-floats.html [ ImageOnlyFailure ]
 webkit.org/b/139968 fast/css/object-fit/object-fit-canvas.html [ ImageOnlyFailure ]
index aae0c13ec523f506a079718741dde31f0503737c..2e7e20066595ef5d732b0fbd0ebdf9c55fa85cbd 100644 (file)
@@ -1,3 +1,20 @@
+2015-01-08  Myles C. Maxfield  <mmaxfield@apple.com>
+
+        Borders inside box-decoration-break: clone after a br do not contribute to line breaking
+        https://bugs.webkit.org/show_bug.cgi?id=140238
+
+        Reviewed by Darin Adler.
+
+        When we iterate through renderers for line breaking, we determine which of the renderers
+        is responsible for inserting its parent's border width. However, this determination didn't
+        take a <br> and box-decoration-break: clone into account.
+
+        Test: fast/box-decoration-break/box-decoration-break-clone-line-break.html
+
+        * rendering/line/BreakingContextInlineHeaders.h:
+        (WebCore::shouldAddBorderPaddingMargin):
+        (WebCore::previousInFlowSibling): Clean up to use a do / while block.
+
 2015-01-08  Gwang Yoon Hwang  <yoon@igalia.com>
 
         [GTK] Seperate updateBackingStore from flushCompositingState.
index 6e2ef909e3bca2ca77429c237976ff55484505bc..340a7c4585f581cba80d5e64412258af160cecb5 100644 (file)
@@ -32,6 +32,7 @@
 #include "RenderCombineText.h"
 #include "RenderCounter.h"
 #include "RenderInline.h"
+#include "RenderLineBreak.h"
 #include "RenderListMarker.h"
 #include "RenderRubyRun.h"
 #include "RenderSVGInlineText.h"
@@ -269,15 +270,23 @@ inline LayoutUnit borderPaddingMarginEnd(const RenderInline& child)
 
 inline bool shouldAddBorderPaddingMargin(RenderObject* child)
 {
+    if (!child)
+        return true;
     // When deciding whether we're at the edge of an inline, adjacent collapsed whitespace is the same as no sibling at all.
-    return !child || (is<RenderText>(*child) && !downcast<RenderText>(*child).textLength());
+    if (is<RenderText>(*child) && !downcast<RenderText>(*child).textLength())
+        return true;
+#if ENABLE(CSS_BOX_DECORATION_BREAK)
+    if (is<RenderLineBreak>(*child) && child->parent()->style().boxDecorationBreak() == DCLONE)
+        return true;
+#endif
+    return false;
 }
 
 inline RenderObject* previousInFlowSibling(RenderObject* child)
 {
-    child = child->previousSibling();
-    while (child && child->isOutOfFlowPositioned())
+    do {
         child = child->previousSibling();
+    } while (child && child->isOutOfFlowPositioned());
     return child;
 }