Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge r173943 - Old Turkic characters behave as left-to-right instead…
… of right-to-left, because they are encoded as surrogate pairs. https://bugs.webkit.org/show_bug.cgi?id=70029 Reviewed by Dan Bernstein. Source/WebCore: Test: fast/text/international/old-turkic-direction.html * CMakeLists.txt: Added InlineIterator.cpp. * WebCore.vcxproj/WebCore.vcxproj: Ditto. * WebCore.vcxproj/WebCore.vcxproj.filters: Ditto. * WebCore.xcodeproj/project.pbxproj: Ditto. * rendering/RenderingAllInOne.cpp: Ditto. * rendering/InlineIterator.cpp: Added. (WebCore::InlineIterator::surrogateTextDirection): New function used to compute the direction when a surrogate pair is involved. * rendering/InlineIterator.h: Made the characterAt function private. (WebCore::InlineIterator::previousInSameNode): Took out unneeded range check. A zero will underflow and become a large number and the characterAt function will return 0 in that case. (WebCore::InlineIterator::direction): Added code to check U16_IS_SINGLE before calling u_charDirection, and call surrogateTextDirection instead. LayoutTests: * fast/text/international/old-turkic-direction.html: Added. * fast/text/international/old-turkic-direction-expected.html: Added. Canonical link: https://commits.webkit.org/154760.49@webkitgtk/2.6 git-svn-id: https://svn.webkit.org/repository/webkit/releases/WebKitGTK/webkit-2.6@174436 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
1 parent
ca0e5a7
commit 03f2a89
Showing
11 changed files
with
143 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
LayoutTests/fast/text/international/old-turkic-direction-expected.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<!DOCTYPE html> | ||
<body> | ||
<p>Test that checks that at least one Old Turkic character has RTL direction.</p> | ||
<p>Word that starts with an Old Turkic character, with and without RTL override:</p> | ||
<p dir="rtl" style="width:100px"><bdo dir="rtl">𐰀a</bdo></p> | ||
<p dir="rtl" style="width:100px"><bdo dir="rtl">𐰀a</bdo></p> | ||
<p>Word that has an Old Turkic character in the middle, with and without RTL override:</p> | ||
<p dir="rtl" style="width:100px"><bdo dir="rtl">b𐰀c</bdo></p> | ||
<p dir="rtl" style="width:100px"><bdo dir="rtl">b𐰀c</bdo></p> | ||
</body> |
10 changes: 10 additions & 0 deletions
10
LayoutTests/fast/text/international/old-turkic-direction.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<!DOCTYPE html> | ||
<body> | ||
<p>Test that checks that at least one Old Turkic character has RTL direction.</p> | ||
<p>Word that starts with an Old Turkic character, with and without RTL override:</p> | ||
<p dir="rtl" style="width:100px">𐰀a</p> | ||
<p dir="rtl" style="width:100px"><bdo dir="rtl">𐰀a</bdo></p> | ||
<p>Word that has an Old Turkic character in the middle, with and without RTL override:</p> | ||
<p dir="rtl" style="width:100px">b𐰀c</p> | ||
<p dir="rtl" style="width:100px"><bdo dir="rtl">b𐰀c</bdo></p> | ||
</body> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* | ||
Copyright (C) 2014 Apple Inc. All rights reserved. | ||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions | ||
are met: | ||
1. Redistributions of source code must retain the above copyright | ||
notice, this list of conditions and the following disclaimer. | ||
2. Redistributions in binary form must reproduce the above copyright | ||
notice, this list of conditions and the following disclaimer in the | ||
documentation and/or other materials provided with the distribution. | ||
THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY | ||
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY | ||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | ||
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
*/ | ||
|
||
#include "config.h" | ||
#include "InlineIterator.h" | ||
|
||
namespace WebCore { | ||
|
||
UCharDirection InlineIterator::surrogateTextDirection(UChar currentCodeUnit) const | ||
{ | ||
RenderText& text = toRenderText(*m_renderer); | ||
UChar lead; | ||
UChar trail; | ||
if (U16_IS_LEAD(currentCodeUnit)) { | ||
lead = currentCodeUnit; | ||
trail = text.characterAt(m_pos + 1); | ||
if (!U16_IS_TRAIL(trail)) | ||
return U_OTHER_NEUTRAL; | ||
} else { | ||
ASSERT(U16_IS_TRAIL(currentCodeUnit)); | ||
lead = text.characterAt(m_pos - 1); | ||
if (!U16_IS_LEAD(lead)) | ||
return U_OTHER_NEUTRAL; | ||
trail = currentCodeUnit; | ||
} | ||
return u_charDirection(U16_GET_SUPPLEMENTARY(lead, trail)); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters