Emoji: Fix the diversity emoji check in Safari.
When the browser test for diversity emoji was added in [36160], it included a workaround for Chrome not being able to compare Uint8ClampedArray objects directly, by converting them to a string. Unfortunately, Safari doesn't support the Uint8ClampedArray.toString() method correctly, so the test was incorrectly failing in Safari. Merge of [37028] to the 4.4 branch. Fixes #36266. git-svn-id: https://develop.svn.wordpress.org/branches/4.4@37090 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
ecd6a1a0e5
commit
e0d1286129
@ -14,7 +14,7 @@
|
||||
var canvas = document.createElement( 'canvas' ),
|
||||
context = canvas.getContext && canvas.getContext( '2d' ),
|
||||
stringFromCharCode = String.fromCharCode,
|
||||
tone;
|
||||
tonedata, tone, tone2;
|
||||
|
||||
if ( ! context || ! context.fillText ) {
|
||||
return false;
|
||||
@ -47,10 +47,15 @@
|
||||
* compares if the emoji rendering has changed.
|
||||
*/
|
||||
context.fillText( stringFromCharCode( 55356, 57221 ), 0, 0 );
|
||||
tone = context.getImageData( 16, 16, 1, 1 ).data.toString();
|
||||
tonedata = context.getImageData( 16, 16, 1, 1 ).data;
|
||||
|
||||
context.fillText( stringFromCharCode( 55356, 57221, 55356, 57343 ), 0, 0 );
|
||||
// Chrome has issues comparing arrays, so we compare it as a string, instead.
|
||||
return tone !== context.getImageData( 16, 16, 1, 1 ).data.toString();
|
||||
// Chrome has issues comparing arrays, and Safari has issues converting arrays to strings.
|
||||
// So, we create our own string and compare that, instead.
|
||||
tonedata = context.getImageData( 16, 16, 1, 1 ).data;
|
||||
tone2 = tonedata[0] + ',' + tonedata[1] + ',' + tonedata[2] + ',' + tonedata[3];
|
||||
|
||||
return tone !== tone2;
|
||||
} else {
|
||||
if ( 'simple' === type ) {
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user