From 1028613ce49b7296ebf1d69fc28851c1ba1ec5a6 Mon Sep 17 00:00:00 2001 From: Simon Montagu Date: Wed, 5 Mar 2014 21:04:36 +0200 Subject: [PATCH] Add U+2029 PARAGRAPH SEPARATOR and other characters with bidi type Segment Separator and Paragraph Separator to the characters we convert to whitespace before passing text to the Bidi engine. Bug 847242, r=roc --- layout/base/crashtests/847242.html | 13 +++++++++++++ layout/base/crashtests/crashtests.list | 1 + layout/base/nsBidiPresUtils.cpp | 16 +++++++++++++++- layout/reftests/bidi/847242-1-ref.html | 15 +++++++++++++++ layout/reftests/bidi/847242-1.html | 18 ++++++++++++++++++ layout/reftests/bidi/reftest.list | 1 + 6 files changed, 63 insertions(+), 1 deletion(-) create mode 100644 layout/base/crashtests/847242.html create mode 100644 layout/reftests/bidi/847242-1-ref.html create mode 100644 layout/reftests/bidi/847242-1.html diff --git a/layout/base/crashtests/847242.html b/layout/base/crashtests/847242.html new file mode 100644 index 00000000000..c148dbb663d --- /dev/null +++ b/layout/base/crashtests/847242.html @@ -0,0 +1,13 @@ + + + + + + +

ت萁 +x
+ + diff --git a/layout/base/crashtests/crashtests.list b/layout/base/crashtests/crashtests.list index 5974ebf24f8..f49fa88fb50 100644 --- a/layout/base/crashtests/crashtests.list +++ b/layout/base/crashtests/crashtests.list @@ -415,6 +415,7 @@ load 826163.html load 833604-1.html load 835056.html load 836990-1.html +load 847242.html load 852293.html load 860579-1.html pref(layers.force-active,true) load 859526-1.html diff --git a/layout/base/nsBidiPresUtils.cpp b/layout/base/nsBidiPresUtils.cpp index 94dc090c1f4..f30b0c26369 100644 --- a/layout/base/nsBidiPresUtils.cpp +++ b/layout/base/nsBidiPresUtils.cpp @@ -35,6 +35,20 @@ static const char16_t kRLE = 0x202B; static const char16_t kLRO = 0x202D; static const char16_t kRLO = 0x202E; static const char16_t kPDF = 0x202C; +static const char16_t kSeparators[] = { + // All characters with Bidi type Segment Separator or Block Separator + char16_t('\t'), + char16_t('\r'), + char16_t('\n'), + char16_t(0xb), + char16_t(0x1c), + char16_t(0x1d), + char16_t(0x1e), + char16_t(0x1f), + char16_t(0x85), + char16_t(0x2029), + char16_t(0) +}; #define NS_BIDI_CONTROL_FRAME ((nsIFrame*)0xfffb1d1) @@ -631,7 +645,7 @@ nsBidiPresUtils::ResolveParagraph(nsBlockFrame* aBlockFrame, if (aBpd->BufferLength() < 1) { return NS_OK; } - aBpd->mBuffer.ReplaceChar("\t\r\n", kSpace); + aBpd->mBuffer.ReplaceChar(kSeparators, kSpace); int32_t runCount; diff --git a/layout/reftests/bidi/847242-1-ref.html b/layout/reftests/bidi/847242-1-ref.html new file mode 100644 index 00000000000..8bb910fa086 --- /dev/null +++ b/layout/reftests/bidi/847242-1-ref.html @@ -0,0 +1,15 @@ + + + + + + + +
PASS

+ + diff --git a/layout/reftests/bidi/847242-1.html b/layout/reftests/bidi/847242-1.html new file mode 100644 index 00000000000..7672216f744 --- /dev/null +++ b/layout/reftests/bidi/847242-1.html @@ -0,0 +1,18 @@ + + + + + + + +

SSAP
+ + diff --git a/layout/reftests/bidi/reftest.list b/layout/reftests/bidi/reftest.list index b870f0407d6..fbea5ec677a 100644 --- a/layout/reftests/bidi/reftest.list +++ b/layout/reftests/bidi/reftest.list @@ -138,6 +138,7 @@ skip-if(B2G) == 726420-1.html 726420-1-ref.html == 746987-4.html 746987-4-ref.html == 779003-1.html 779003-1-ref.html == 779003-1-dynamic.html 779003-1-ref.html +== 847242-1.html 847242-1-ref.html == 869833-1.xul 869833-1-ref.xul == 922530-1.html 922530-1-ref.html == 922550-1.html 922550-1-ref.html