WebCore:
authormitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 29 Feb 2008 17:28:13 +0000 (17:28 +0000)
committermitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 29 Feb 2008 17:28:13 +0000 (17:28 +0000)
        Reviewed by Darin Adler.

        - fix a bug where explicit embedding past the end of a line could
          affect text that line

        Test: fast/text/embed-at-end-of-pre-wrap-line.html

        * rendering/bidi.cpp:
        (WebCore::RenderBlock::skipWhitespace): Removed calls to
        setAdjustEmbedding().
        (WebCore::RenderBlock::findNextLineBreak): Added calls to
        setAdjustEmbedding() around skipWhitespace() only where needed.

LayoutTests:

        Reviewed by Darin Adler.

        - test for a bug where explicit embedding past the end of a line could
          affect text that line

        * fast/text/embed-at-end-of-pre-wrap-line.html: Added.
        * platform/mac-leopard/fast/text/embed-at-end-of-pre-wrap-line-expected.checksum: Added.
        * platform/mac-leopard/fast/text/embed-at-end-of-pre-wrap-line-expected.png: Added.
        * platform/mac/fast/text/embed-at-end-of-pre-wrap-line-expected.txt: Added.

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

LayoutTests/ChangeLog
LayoutTests/fast/text/embed-at-end-of-pre-wrap-line.html [new file with mode: 0644]
LayoutTests/platform/mac-leopard/fast/text/embed-at-end-of-pre-wrap-line-expected.checksum [new file with mode: 0644]
LayoutTests/platform/mac-leopard/fast/text/embed-at-end-of-pre-wrap-line-expected.png [new file with mode: 0644]
LayoutTests/platform/mac/fast/text/embed-at-end-of-pre-wrap-line-expected.txt [new file with mode: 0644]
WebCore/ChangeLog
WebCore/rendering/bidi.cpp

index c215eaa8b777fa3e211b064d614bd76426cdcf33..566c39b503a4c86764ae47c3644535b6ff439ce4 100644 (file)
@@ -1,3 +1,15 @@
+2008-02-29  Dan Bernstein  <mitz@apple.com>
+
+        Reviewed by Darin Adler.
+
+        - test for a bug where explicit embedding past the end of a line could
+          affect text that line
+
+        * fast/text/embed-at-end-of-pre-wrap-line.html: Added.
+        * platform/mac-leopard/fast/text/embed-at-end-of-pre-wrap-line-expected.checksum: Added.
+        * platform/mac-leopard/fast/text/embed-at-end-of-pre-wrap-line-expected.png: Added.
+        * platform/mac/fast/text/embed-at-end-of-pre-wrap-line-expected.txt: Added.
+
 2008-02-28  Justin Garcia  <justin.garcia@apple.com>
 
         Reviewed by Darin Adler.
diff --git a/LayoutTests/fast/text/embed-at-end-of-pre-wrap-line.html b/LayoutTests/fast/text/embed-at-end-of-pre-wrap-line.html
new file mode 100644 (file)
index 0000000..abafd99
--- /dev/null
@@ -0,0 +1,10 @@
+<style>
+    div { white-space: pre-wrap; border: 1px solid; padding: 4px; width: 70px; margin: 8px 0; }
+</style>
+<p>
+    The following boxes should be identical.
+</p>
+<div>Lorem....... <span style="direction: rtl; unicode-bidi: bidi-override;">muspi</span>
+</div>
+<div>Lorem....... ipsum
+</div>
diff --git a/LayoutTests/platform/mac-leopard/fast/text/embed-at-end-of-pre-wrap-line-expected.checksum b/LayoutTests/platform/mac-leopard/fast/text/embed-at-end-of-pre-wrap-line-expected.checksum
new file mode 100644 (file)
index 0000000..6ff632f
--- /dev/null
@@ -0,0 +1 @@
+580d24ca0efe96acec34f4f64bc0dde0
\ No newline at end of file
diff --git a/LayoutTests/platform/mac-leopard/fast/text/embed-at-end-of-pre-wrap-line-expected.png b/LayoutTests/platform/mac-leopard/fast/text/embed-at-end-of-pre-wrap-line-expected.png
new file mode 100644 (file)
index 0000000..d625407
Binary files /dev/null and b/LayoutTests/platform/mac-leopard/fast/text/embed-at-end-of-pre-wrap-line-expected.png differ
diff --git a/LayoutTests/platform/mac/fast/text/embed-at-end-of-pre-wrap-line-expected.txt b/LayoutTests/platform/mac/fast/text/embed-at-end-of-pre-wrap-line-expected.txt
new file mode 100644 (file)
index 0000000..67da8b6
--- /dev/null
@@ -0,0 +1,23 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderBlock {HTML} at (0,0) size 800x600
+    RenderBody {BODY} at (8,8) size 784x584
+      RenderBlock {P} at (0,0) size 784x18
+        RenderText {#text} at (0,0) size 257x18
+          text run at (0,0) width 257: "The following boxes should be identical."
+      RenderBlock {DIV} at (0,34) size 80x46 [border: (1px solid #000000)]
+        RenderText {#text} at (5,5) size 70x18
+          text run at (5,5) width 70: "Lorem......."
+          text run at (75,5) width 0: " "
+        RenderInline {SPAN} at (0,0) size 38x18
+          RenderText {#text} at (5,23) size 38x18
+            text run at (5,23) width 38 RTL override: "muspi"
+        RenderText {#text} at (43,23) size 0x18
+          text run at (43,23) width 0: " "
+      RenderBlock {DIV} at (0,88) size 80x46 [border: (1px solid #000000)]
+        RenderText {#text} at (5,5) size 70x36
+          text run at (5,5) width 70: "Lorem......."
+          text run at (75,5) width 0: " "
+          text run at (5,23) width 38: "ipsum"
+          text run at (43,23) width 0: " "
index f894b75449ac7fe5bebfa4a87372e51e19e2c54f..f8a0e1a852335fba21fb6207993ab37ab8fdb354 100644 (file)
@@ -1,3 +1,18 @@
+2008-02-29  Dan Bernstein  <mitz@apple.com>
+
+        Reviewed by Darin Adler.
+
+        - fix a bug where explicit embedding past the end of a line could
+          affect text that line
+
+        Test: fast/text/embed-at-end-of-pre-wrap-line.html
+
+        * rendering/bidi.cpp:
+        (WebCore::RenderBlock::skipWhitespace): Removed calls to
+        setAdjustEmbedding().
+        (WebCore::RenderBlock::findNextLineBreak): Added calls to
+        setAdjustEmbedding() around skipWhitespace() only where needed.
+
 2008-02-29  Mark Rowe  <mrowe@apple.com>
 
         Reviewed by Oliver Hunt.
index 152aaa2638a3bc28cb9ed637f342c582ba88c2fc..56fa321a1ba56de7e0ba9c962f00ec84d88e809a 100644 (file)
@@ -1227,7 +1227,6 @@ int RenderBlock::skipWhitespace(BidiIterator& it, BidiState& bidi)
     // elements quite right.  In other words, we need to build this function's work into the normal line
     // object iteration process.
     int w = lineWidth(m_height);
-    bidi.setAdjustEmbedding(true);
 
     while (!it.atEnd() && !requiresLineBox(it)) {
         RenderObject* o = it.obj;
@@ -1260,7 +1259,6 @@ int RenderBlock::skipWhitespace(BidiIterator& it, BidiState& bidi)
         it.increment(bidi);
     }
 
-    bidi.setAdjustEmbedding(false);
     return w;
 }
 
@@ -1309,8 +1307,9 @@ BidiIterator RenderBlock::findNextLineBreak(BidiIterator &start, BidiState &bidi
 {
     bool appliedStartWidth = start.pos > 0;
 
-    // eliminate spaces at beginning of line
+    bidi.setAdjustEmbedding(true);
     int width = skipWhitespace(start, bidi);
+    bidi.setAdjustEmbedding(false);
     int w = 0;
     int tmpW = 0;