Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 661880 | Differences between
and this patch

Collapse All | Expand All

(-)file_not_specified_in_diff (-42 / +35 lines)
Line  Link Here
0
-- /third_party/blink/renderer/platform/text/character.cc
0
++ /third_party/blink/renderer/platform/text/character.cc
Lines 33-38 Link Here
33
#include <unicode/uobject.h>
33
#include <unicode/uobject.h>
34
#include <unicode/uscript.h>
34
#include <unicode/uscript.h>
35
#include <algorithm>
35
#include <algorithm>
36
#include <vector>
36
#include "third_party/blink/renderer/platform/text/icu_error.h"
37
#include "third_party/blink/renderer/platform/text/icu_error.h"
37
#include "third_party/blink/renderer/platform/wtf/std_lib_extras.h"
38
#include "third_party/blink/renderer/platform/wtf/std_lib_extras.h"
38
#include "third_party/blink/renderer/platform/wtf/text/string_builder.h"
39
#include "third_party/blink/renderer/platform/wtf/text/string_builder.h"
Lines 48-69 Link Here
48
namespace blink {
49
namespace blink {
49
50
50
#if defined(USING_SYSTEM_ICU)
51
#if defined(USING_SYSTEM_ICU)
51
static icu::UnicodeSet* createUnicodeSet(const UChar32* characters,
52
static icu::UnicodeSet* createUnicodeSet(std::vector<UChar32> characters,
52
                                         size_t charactersCount,
53
                                         std::vector<UChar32> ranges) {
53
                                         const UChar32* ranges,
54
                                         size_t rangesCount) {
55
  icu::UnicodeSet* unicodeSet = new icu::UnicodeSet();
54
  icu::UnicodeSet* unicodeSet = new icu::UnicodeSet();
56
  for (size_t i = 0; i < charactersCount; i++)
55
  for (auto i = characters.cbegin(); i != characters.cend(); i++)
57
    unicodeSet->add(characters[i]);
56
    unicodeSet->add(*i);
58
  for (size_t i = 0; i < rangesCount; i += 2)
57
  for (auto i = ranges.cbegin(); i != ranges.cend(); i += 2)
59
    unicodeSet->add(ranges[i], ranges[i + 1]);
58
    unicodeSet->add(*i, *(i + 1));
60
  unicodeSet->freeze();
59
  unicodeSet->freeze();
61
  return unicodeSet;
60
  return unicodeSet;
62
}
61
}
63
62
64
#define CREATE_UNICODE_SET(name)                                      \
63
#define CREATE_UNICODE_SET(name)                \
65
  createUnicodeSet(name##Array, arraysize(name##Array), name##Ranges, \
64
  createUnicodeSet(name##Array, name##Ranges)
66
                   arraysize(name##Ranges))
67
65
68
#define RETURN_HAS_PROPERTY(c, name)            \
66
#define RETURN_HAS_PROPERTY(c, name)            \
69
  static icu::UnicodeSet* unicodeSet = nullptr; \
67
  static icu::UnicodeSet* unicodeSet = nullptr; \
70
-- /third_party/blink/renderer/platform/text/character_property_data_generator.cc
68
++ /third_party/blink/renderer/platform/text/character_property_data_generator.cc
Lines 8-13 Link Here
8
#include <cassert>
8
#include <cassert>
9
#include <cstring>
9
#include <cstring>
10
#include <memory>
10
#include <memory>
11
#include <vector>
11
#include "third_party/blink/renderer/platform/text/character_property.h"
12
#include "third_party/blink/renderer/platform/text/character_property.h"
12
#if !defined(USING_SYSTEM_ICU)
13
#if !defined(USING_SYSTEM_ICU)
13
#define MUTEX_H  // Prevent compile failure of utrie2.h on Windows
14
#define MUTEX_H  // Prevent compile failure of utrie2.h on Windows
Lines 21-49 Link Here
21
#else
22
#else
22
23
23
const UChar32 kMaxCodepoint = 0x10FFFF;
24
const UChar32 kMaxCodepoint = 0x10FFFF;
24
#define ARRAY_LENGTH(a) (sizeof(a) / sizeof((a)[0]))
25
25
26
static void SetRanges(CharacterProperty* values,
26
static void SetRanges(CharacterProperty* values,
27
                      const UChar32* ranges,
27
                      std::vector<UChar32> ranges,
28
                      size_t length,
29
                      CharacterProperty value) {
28
                      CharacterProperty value) {
30
  assert(length % 2 == 0);
29
  assert(ranges.size() % 2 == 0);
31
  const UChar32* end = ranges + length;
30
  for (auto i = ranges.cbegin(); i != ranges.cend(); i += 2) {
32
  for (; ranges != end; ranges += 2) {
31
    assert(*i <= *(i + 1) && *(i + 1) <= kMaxCodepoint);
33
    assert(ranges[0] <= ranges[1] && ranges[1] <= kMaxCodepoint);
32
    for (UChar32 c = *i; c <= *(i + 1); c++)
34
    for (UChar32 c = ranges[0]; c <= ranges[1]; c++)
35
      values[c] |= value;
33
      values[c] |= value;
36
  }
34
  }
37
}
35
}
38
36
39
static void SetValues(CharacterProperty* values,
37
static void SetValues(CharacterProperty* values,
40
                      const UChar32* begin,
38
                      std::vector<UChar32> characters,
41
                      size_t length,
42
                      CharacterProperty value) {
39
                      CharacterProperty value) {
43
  const UChar32* end = begin + length;
40
  for (auto i = characters.cbegin(); i != characters.cend(); i++) {
44
  for (; begin != end; begin++) {
41
    assert(*i <= kMaxCodepoint);
45
    assert(*begin <= kMaxCodepoint);
42
    values[*i] |= value;
46
    values[*begin] |= value;
47
  }
43
  }
48
}
44
}
49
45
Lines 73-82 Link Here
73
  memset(values.get(), 0, sizeof(CharacterProperty) * kSize);
69
  memset(values.get(), 0, sizeof(CharacterProperty) * kSize);
74
70
75
#define SET(name)                                                   \
71
#define SET(name)                                                   \
76
  SetRanges(values.get(), name##Ranges, ARRAY_LENGTH(name##Ranges), \
72
  SetRanges(values.get(), name##Ranges, CharacterProperty::name);   \
77
            CharacterProperty::name);                               \
73
  SetValues(values.get(), name##Array, CharacterProperty::name);
78
  SetValues(values.get(), name##Array, ARRAY_LENGTH(name##Array),   \
79
            CharacterProperty::name);
80
74
81
  SET(kIsCJKIdeographOrSymbol);
75
  SET(kIsCJKIdeographOrSymbol);
82
  SET(kIsUprightInMixedVertical);
76
  SET(kIsUprightInMixedVertical);
83
-- /third_party/blink/renderer/platform/text/character_property_data_generator.h
77
++ /third_party/blink/renderer/platform/text/character_property_data_generator.h
Lines 6-15 Link Here
6
#define THIRD_PARTY_BLINK_RENDERER_PLATFORM_TEXT_CHARACTER_PROPERTY_DATA_GENERATOR_H_
6
#define THIRD_PARTY_BLINK_RENDERER_PLATFORM_TEXT_CHARACTER_PROPERTY_DATA_GENERATOR_H_
7
7
8
#include <unicode/uobject.h>
8
#include <unicode/uobject.h>
9
#include <vector>
9
10
10
namespace blink {
11
namespace blink {
11
12
12
static const UChar32 kIsCJKIdeographOrSymbolArray[] = {
13
static std::vector<UChar32> kIsCJKIdeographOrSymbolArray = {
13
    // 0x2C7 Caron, Mandarin Chinese 3rd Tone
14
    // 0x2C7 Caron, Mandarin Chinese 3rd Tone
14
    0x2C7,
15
    0x2C7,
15
    // 0x2CA Modifier Letter Acute Accent, Mandarin Chinese 2nd Tone
16
    // 0x2CA Modifier Letter Acute Accent, Mandarin Chinese 2nd Tone
Lines 32-38 Link Here
32
    // Emoji.
33
    // Emoji.
33
    0x1F100, 0x1F004, 0x1F0CF, 0x1F18E};
34
    0x1F100, 0x1F004, 0x1F0CF, 0x1F18E};
34
35
35
static const UChar32 kIsCJKIdeographOrSymbolRanges[] = {
36
static std::vector<UChar32> kIsCJKIdeographOrSymbolRanges = {
36
    // STAFF OF AESCULAPIUS..SCALES for emoji sequences for doctor and judge
37
    // STAFF OF AESCULAPIUS..SCALES for emoji sequences for doctor and judge
37
    // professions.
38
    // professions.
38
    0x2695, 0x2696,
39
    0x2695, 0x2696,
Lines 114-123 Link Here
114
// http://www.unicode.org/reports/tr50/
115
// http://www.unicode.org/reports/tr50/
115
// Taken from the corresponding data file:
116
// Taken from the corresponding data file:
116
// http://www.unicode.org/Public/vertical/revision-16/VerticalOrientation-16.txt
117
// http://www.unicode.org/Public/vertical/revision-16/VerticalOrientation-16.txt
117
static const UChar32 kIsUprightInMixedVerticalArray[] = {
118
static std::vector<UChar32> kIsUprightInMixedVerticalArray = {
118
    0x000A7, 0x000A9, 0x000AE, 0x000B1, 0x000D7, 0x000F7};
119
    0x000A7, 0x000A9, 0x000AE, 0x000B1, 0x000D7, 0x000F7};
119
120
120
static const UChar32 kIsUprightInMixedVerticalRanges[] = {
121
static std::vector<UChar32> kIsUprightInMixedVerticalRanges = {
121
    0x000BC, 0x000BE,
122
    0x000BC, 0x000BE,
122
    // Spacing Modifier Letters (Part of)
123
    // Spacing Modifier Letters (Part of)
123
    0x002EA, 0x002EB,
124
    0x002EA, 0x002EB,
Lines 212-222 Link Here
212
};
213
};
213
214
214
// https://html.spec.whatwg.org/multipage/scripting.html#prod-potentialcustomelementname
215
// https://html.spec.whatwg.org/multipage/scripting.html#prod-potentialcustomelementname
215
static const UChar32 kIsPotentialCustomElementNameCharArray[] = {
216
static std::vector<UChar32> kIsPotentialCustomElementNameCharArray = {
216
    '-', '.', '_', 0xB7,
217
    '-', '.', '_', 0xB7,
217
};
218
};
218
219
219
static const UChar32 kIsPotentialCustomElementNameCharRanges[] = {
220
static std::vector<UChar32> kIsPotentialCustomElementNameCharRanges = {
220
    '0',    '9',    'a',    'z',    0xC0,    0xD6,    0xD8,   0xF6,
221
    '0',    '9',    'a',    'z',    0xC0,    0xD6,    0xD8,   0xF6,
221
    0xF8,   0x2FF,  0x300,  0x37D,  0x37F,   0x1FFF,  0x200C, 0x200D,
222
    0xF8,   0x2FF,  0x300,  0x37D,  0x37F,   0x1FFF,  0x200C, 0x200D,
222
    0x203F, 0x2040, 0x2070, 0x218F, 0x2C00,  0x2FEF,  0x3001, 0xD7FF,
223
    0x203F, 0x2040, 0x2070, 0x218F, 0x2C00,  0x2FEF,  0x3001, 0xD7FF,
Lines 224-237 Link Here
224
};
225
};
225
226
226
// http://unicode.org/reports/tr9/#Directional_Formatting_Characters
227
// http://unicode.org/reports/tr9/#Directional_Formatting_Characters
227
static const UChar32 kIsBidiControlArray[] = {0x061C, 0x200E, 0x200F};
228
static std::vector<UChar32> kIsBidiControlArray = {0x061C, 0x200E, 0x200F};
228
229
229
static const UChar32 kIsBidiControlRanges[] = {
230
static std::vector<UChar32> kIsBidiControlRanges = {
230
    0x202A, 0x202E, 0x2066, 0x2069,
231
    0x202A, 0x202E, 0x2066, 0x2069,
231
};
232
};
232
233
233
// https://unicode.org/Public/UNIDATA/Blocks.txt
234
// https://unicode.org/Public/UNIDATA/Blocks.txt
234
static const UChar32 kIsHangulRanges[] = {
235
static std::vector<UChar32> kIsHangulRanges = {
235
    // Hangul Jamo
236
    // Hangul Jamo
236
    0x1100, 0x11FF,
237
    0x1100, 0x11FF,
237
    // Hangul Compatibility Jamo
238
    // Hangul Compatibility Jamo
Lines 247-253 Link Here
247
    0xFFA0, 0xFFDC,
248
    0xFFA0, 0xFFDC,
248
};
249
};
249
250
250
static const UChar32 kIsHangulArray[] = {};
251
static std::vector<UChar32> kIsHangulArray = {};
251
252
252
}  // namespace blink
253
}  // namespace blink
253
254

Return to bug 661880