Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
c4801e2a
Commit
c4801e2a
authored
Mar 02, 2017
by
Eric Eastwood
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix up off index when reading canvas and something failed
parent
02ce3133
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
3 deletions
+6
-3
app/assets/javascripts/behaviors/gl_emoji/unicode_support_map.js
...ets/javascripts/behaviors/gl_emoji/unicode_support_map.js
+6
-3
No files found.
app/assets/javascripts/behaviors/gl_emoji/unicode_support_map.js
View file @
c4801e2a
...
...
@@ -74,6 +74,7 @@ function testUnicodeSupportMap(testMap) {
.
reduce
((
list
,
testKey
)
=>
list
.
concat
(
testMap
[
testKey
]),
[]).
length
;
const
canvas
=
document
.
createElement
(
'
canvas
'
);
(
window
.
gl
||
window
).
testEmojiUnicodeSupportMapCanvas
=
canvas
;
const
ctx
=
canvas
.
getContext
(
'
2d
'
);
canvas
.
width
=
(
2
*
fontSize
);
canvas
.
height
=
(
numTestEntries
*
fontSize
);
...
...
@@ -95,7 +96,9 @@ function testUnicodeSupportMap(testMap) {
let
readIndex
=
0
;
testMapKeys
.
forEach
((
testKey
)
=>
{
const
testEntry
=
testMap
[
testKey
];
const
isTestSatisfied
=
[].
concat
(
testEntry
).
every
(()
=>
{
// This needs to be a `reduce` instead of `every` because we need to
// keep the `readIndex` in sync from the writes by running all entries
const
isTestSatisfied
=
[].
concat
(
testEntry
).
reduce
((
isSatisfied
)
=>
{
// Sample along the vertical-middle for a couple of characters
const
imageData
=
ctx
.
getImageData
(
0
,
...
...
@@ -121,8 +124,8 @@ function testUnicodeSupportMap(testMap) {
}
readIndex
+=
1
;
return
isValidEmoji
;
});
return
is
Satisfied
&&
is
ValidEmoji
;
}
,
true
);
resultMap
[
testKey
]
=
isTestSatisfied
;
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment