mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-27 04:38:02 +00:00
Bug 1392181 - part2: HasRTLChars() should check if the character is at least equal or larger than the minimum RTL character, U+0590 r=emk
HasRTLChars() appears in profile of attachment 8848015 after landing the patches for bug 1391538 because the landing made text in <input> or <textarea> always treated as non-single byte characters. Therefore, HasRTLChars() is now called by nsTextFragment::SetTo() a lot in editors. HasRTLChar() checks if it's in an RTL character for each character until it becomes true. However, if character is less than the minimum RTL character, U+0590, it works faster at least for Western languages. MozReview-Commit-ID: 4YecxQWUcmK --HG-- extra : rebase_source : 172be670795f0e2155d4bd5044ee37f652367734
This commit is contained in:
parent
2eff2ba40d
commit
6b9eda1dda
@ -5,6 +5,10 @@
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
#include "nsBidiUtils.h"
|
||||
|
||||
namespace mozilla {
|
||||
static const uint32_t kMinRTLChar = 0x0590;
|
||||
} // namespace mozilla;
|
||||
|
||||
#define ARABIC_TO_HINDI_DIGIT_INCREMENT (START_HINDI_DIGITS - START_ARABIC_DIGITS)
|
||||
#define PERSIAN_TO_HINDI_DIGIT_INCREMENT (START_HINDI_DIGITS - START_FARSI_DIGITS)
|
||||
#define ARABIC_TO_PERSIAN_DIGIT_INCREMENT (START_FARSI_DIGITS - START_ARABIC_DIGITS)
|
||||
@ -90,6 +94,9 @@ bool HasRTLChars(const char16_t* aText, uint32_t aLength)
|
||||
const char16_t* end = cp + aLength;
|
||||
while (cp < end) {
|
||||
uint32_t ch = *cp++;
|
||||
if (ch < mozilla::kMinRTLChar) {
|
||||
continue;
|
||||
}
|
||||
if (NS_IS_HIGH_SURROGATE(ch) && cp < end && NS_IS_LOW_SURROGATE(*cp)) {
|
||||
ch = SURROGATE_TO_UCS4(ch, *cp++);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user