Emoji: Update Twemoji to version 16.0.1.
Introduces support for Emoji 16: - replaces emoji support test with splatter , - replaces two letter coded flag support test with Sark 🇨🇶, - introduces the function `emojiRendersEmptyCenterPoint()` to the emoji loader to enable testing of emoji with a single data point. Not to harp on about it, but Emoji 16 is perfect for tiring yourself out digging up root vegetables while visiting Sark 🇨🇶. Reviewed by audrasjb. Merges [60227] to the 6.8 branch. Props westonruter, kraftbj, pento, JeffPaul, abcd95, SergeyBiryukov, dd32, peterwilsoncc. Fixes #63324. Built from https://develop.svn.wordpress.org/branches/6.8@60317 git-svn-id: http://core.svn.wordpress.org/branches/6.8@59653 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
2
wp-includes/js/twemoji.min.js
vendored
2
wp-includes/js/twemoji.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -117,6 +117,11 @@
|
||||
/**
|
||||
* Checks if two sets of Emoji characters render the same visually.
|
||||
*
|
||||
* This is used to determine if the browser is rendering an emoji with multiple data points
|
||||
* correctly. set1 is the emoji in the correct form, using a zero-width joiner. set2 is the emoji
|
||||
* in the incorrect form, using a zero-width space. If the two sets render the same, then the browser
|
||||
* does not support the emoji correctly.
|
||||
*
|
||||
* This function may be serialized to run in a Worker. Therefore, it cannot refer to variables from the containing
|
||||
* scope. Everything must be passed by parameters.
|
||||
*
|
||||
@@ -160,6 +165,42 @@
|
||||
} );
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the center point of a single emoji is empty.
|
||||
*
|
||||
* This is used to determine if the browser is rendering an emoji with a single data point
|
||||
* correctly. The center point of an incorrectly rendered emoji will be empty. A correctly
|
||||
* rendered emoji will have a non-zero value at the center point.
|
||||
*
|
||||
* This function may be serialized to run in a Worker. Therefore, it cannot refer to variables from the containing
|
||||
* scope. Everything must be passed by parameters.
|
||||
*
|
||||
* @since 6.8.2
|
||||
*
|
||||
* @private
|
||||
*
|
||||
* @param {CanvasRenderingContext2D} context 2D Context.
|
||||
* @param {string} emoji Emoji to test.
|
||||
*
|
||||
* @return {boolean} True if the center point is empty.
|
||||
*/
|
||||
function emojiRendersEmptyCenterPoint( context, emoji ) {
|
||||
// Cleanup from previous test.
|
||||
context.clearRect( 0, 0, context.canvas.width, context.canvas.height );
|
||||
context.fillText( emoji, 0, 0 );
|
||||
|
||||
// Test if the center point (16, 16) is empty (0,0,0,0).
|
||||
var centerPoint = context.getImageData(16, 16, 1, 1);
|
||||
for ( var i = 0; i < centerPoint.data.length; i++ ) {
|
||||
if ( centerPoint.data[ i ] !== 0 ) {
|
||||
// Stop checking the moment it's known not to be empty.
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if the browser properly renders Emoji that Twemoji can supplement.
|
||||
*
|
||||
@@ -173,10 +214,11 @@
|
||||
* @param {CanvasRenderingContext2D} context 2D Context.
|
||||
* @param {string} type Whether to test for support of "flag" or "emoji".
|
||||
* @param {Function} emojiSetsRenderIdentically Reference to emojiSetsRenderIdentically function, needed due to minification.
|
||||
* @param {Function} emojiRendersEmptyCenterPoint Reference to emojiRendersEmptyCenterPoint function, needed due to minification.
|
||||
*
|
||||
* @return {boolean} True if the browser can render emoji, false if it cannot.
|
||||
*/
|
||||
function browserSupportsEmoji( context, type, emojiSetsRenderIdentically ) {
|
||||
function browserSupportsEmoji( context, type, emojiSetsRenderIdentically, emojiRendersEmptyCenterPoint ) {
|
||||
var isIdentical;
|
||||
|
||||
switch ( type ) {
|
||||
@@ -198,16 +240,16 @@
|
||||
}
|
||||
|
||||
/*
|
||||
* Test for UN flag compatibility. This is the least supported of the letter locale flags,
|
||||
* Test for Sark flag compatibility. This is the least supported of the letter locale flags,
|
||||
* so gives us an easy test for full support.
|
||||
*
|
||||
* To test for support, we try to render it, and compare the rendering to how it would look if
|
||||
* the browser doesn't render it correctly ([U] + [N]).
|
||||
* the browser doesn't render it correctly ([C] + [Q]).
|
||||
*/
|
||||
isIdentical = emojiSetsRenderIdentically(
|
||||
context,
|
||||
'\uD83C\uDDFA\uD83C\uDDF3', // as the sequence of two code points
|
||||
'\uD83C\uDDFA\u200B\uD83C\uDDF3' // as the two code points separated by a zero-width space
|
||||
'\uD83C\uDDE8\uD83C\uDDF6', // as the sequence of two code points
|
||||
'\uD83C\uDDE8\u200B\uD83C\uDDF6' // as the two code points separated by a zero-width space
|
||||
);
|
||||
|
||||
if ( isIdentical ) {
|
||||
@@ -232,31 +274,21 @@
|
||||
return ! isIdentical;
|
||||
case 'emoji':
|
||||
/*
|
||||
* Rise Like a Phoenix.
|
||||
* Does Emoji 16.0 cause the browser to go splat?
|
||||
*
|
||||
* To test for Emoji 15.1 support, try to render a new emoji: Phoenix.
|
||||
* To test for Emoji 16.0 support, try to render a new emoji: Splatter.
|
||||
*
|
||||
* A phoenix, a mythical immortal bird with flame-like feathers found in the folklore of many global
|
||||
* cultures. Often used to symbolize renewal or rebirth.
|
||||
* The splatter emoji is a single code point emoji. Testing for browser support
|
||||
* required testing the center point of the emoji to see if it is empty.
|
||||
*
|
||||
* The Phoenix emoji is a ZWJ sequence combining 🐦 Bird, Zero Width Joiner and 🔥 Fire.
|
||||
* These display as a single emoji on supported platforms.
|
||||
* 0xD83E 0xDEDF (\uD83E\uDEDF) == Splatter.
|
||||
*
|
||||
* 0xD83D 0xDC26 (\uD83D\uDC26) == 🐦 Bird
|
||||
* 0x200D == Zero-Width Joiner (ZWJ) that links the code points for the new emoji or
|
||||
* 0x200B == Zero-Width Space (ZWS) that is rendered for clients not supporting the new emoji.
|
||||
* 0xD83D 0xDD25 (\uD83D\uDD25) == 🔥 Fire
|
||||
*
|
||||
* When updating this test for future Emoji releases, ensure that individual emoji that make up the
|
||||
* sequence come from older emoji standards.
|
||||
* When updating this test, please ensure that the emoji is either a single code point
|
||||
* or switch to using the emojiSetsRenderIdentically function and testing with a zero-width
|
||||
* joiner vs a zero-width space.
|
||||
*/
|
||||
isIdentical = emojiSetsRenderIdentically(
|
||||
context,
|
||||
'\uD83D\uDC26\u200D\uD83D\uDD25', // as the zero-width joiner sequence
|
||||
'\uD83D\uDC26\u200B\uD83D\uDD25' // separated by a zero-width space
|
||||
);
|
||||
|
||||
return ! isIdentical;
|
||||
var notSupported = emojiRendersEmptyCenterPoint( context, '\uD83E\uDEDF' );
|
||||
return ! notSupported;
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -275,10 +307,11 @@
|
||||
* @param {string[]} tests Tests.
|
||||
* @param {Function} browserSupportsEmoji Reference to browserSupportsEmoji function, needed due to minification.
|
||||
* @param {Function} emojiSetsRenderIdentically Reference to emojiSetsRenderIdentically function, needed due to minification.
|
||||
* @param {Function} emojiRendersEmptyCenterPoint Reference to emojiRendersEmptyCenterPoint function, needed due to minification.
|
||||
*
|
||||
* @return {SupportTests} Support tests.
|
||||
*/
|
||||
function testEmojiSupports( tests, browserSupportsEmoji, emojiSetsRenderIdentically ) {
|
||||
function testEmojiSupports( tests, browserSupportsEmoji, emojiSetsRenderIdentically, emojiRendersEmptyCenterPoint ) {
|
||||
var canvas;
|
||||
if (
|
||||
typeof WorkerGlobalScope !== 'undefined' &&
|
||||
@@ -301,7 +334,7 @@
|
||||
|
||||
var supports = {};
|
||||
tests.forEach( function ( test ) {
|
||||
supports[ test ] = browserSupportsEmoji( context, test, emojiSetsRenderIdentically );
|
||||
supports[ test ] = browserSupportsEmoji( context, test, emojiSetsRenderIdentically, emojiRendersEmptyCenterPoint );
|
||||
} );
|
||||
return supports;
|
||||
}
|
||||
@@ -354,7 +387,8 @@
|
||||
[
|
||||
JSON.stringify( tests ),
|
||||
browserSupportsEmoji.toString(),
|
||||
emojiSetsRenderIdentically.toString()
|
||||
emojiSetsRenderIdentically.toString(),
|
||||
emojiRendersEmptyCenterPoint.toString()
|
||||
].join( ',' ) +
|
||||
'));';
|
||||
var blob = new Blob( [ workerScript ], {
|
||||
@@ -371,7 +405,7 @@
|
||||
} catch ( e ) {}
|
||||
}
|
||||
|
||||
supportTests = testEmojiSupports( tests, browserSupportsEmoji, emojiSetsRenderIdentically );
|
||||
supportTests = testEmojiSupports( tests, browserSupportsEmoji, emojiSetsRenderIdentically, emojiRendersEmptyCenterPoint );
|
||||
setSessionSupportTests( supportTests );
|
||||
resolve( supportTests );
|
||||
} )
|
||||
|
||||
2
wp-includes/js/wp-emoji-loader.min.js
vendored
2
wp-includes/js/wp-emoji-loader.min.js
vendored
@@ -1,2 +1,2 @@
|
||||
/*! This file is auto-generated */
|
||||
!function(i,n){var o,s,e;function c(e){try{var t={supportTests:e,timestamp:(new Date).valueOf()};sessionStorage.setItem(o,JSON.stringify(t))}catch(e){}}function p(e,t,n){e.clearRect(0,0,e.canvas.width,e.canvas.height),e.fillText(t,0,0);var t=new Uint32Array(e.getImageData(0,0,e.canvas.width,e.canvas.height).data),r=(e.clearRect(0,0,e.canvas.width,e.canvas.height),e.fillText(n,0,0),new Uint32Array(e.getImageData(0,0,e.canvas.width,e.canvas.height).data));return t.every(function(e,t){return e===r[t]})}function u(e,t,n){switch(t){case"flag":return n(e,"\ud83c\udff3\ufe0f\u200d\u26a7\ufe0f","\ud83c\udff3\ufe0f\u200b\u26a7\ufe0f")?!1:!n(e,"\ud83c\uddfa\ud83c\uddf3","\ud83c\uddfa\u200b\ud83c\uddf3")&&!n(e,"\ud83c\udff4\udb40\udc67\udb40\udc62\udb40\udc65\udb40\udc6e\udb40\udc67\udb40\udc7f","\ud83c\udff4\u200b\udb40\udc67\u200b\udb40\udc62\u200b\udb40\udc65\u200b\udb40\udc6e\u200b\udb40\udc67\u200b\udb40\udc7f");case"emoji":return!n(e,"\ud83d\udc26\u200d\ud83d\udd25","\ud83d\udc26\u200b\ud83d\udd25")}return!1}function f(e,t,n){var r="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?new OffscreenCanvas(300,150):i.createElement("canvas"),a=r.getContext("2d",{willReadFrequently:!0}),o=(a.textBaseline="top",a.font="600 32px Arial",{});return e.forEach(function(e){o[e]=t(a,e,n)}),o}function t(e){var t=i.createElement("script");t.src=e,t.defer=!0,i.head.appendChild(t)}"undefined"!=typeof Promise&&(o="wpEmojiSettingsSupports",s=["flag","emoji"],n.supports={everything:!0,everythingExceptFlag:!0},e=new Promise(function(e){i.addEventListener("DOMContentLoaded",e,{once:!0})}),new Promise(function(t){var n=function(){try{var e=JSON.parse(sessionStorage.getItem(o));if("object"==typeof e&&"number"==typeof e.timestamp&&(new Date).valueOf()<e.timestamp+604800&&"object"==typeof e.supportTests)return e.supportTests}catch(e){}return null}();if(!n){if("undefined"!=typeof Worker&&"undefined"!=typeof OffscreenCanvas&&"undefined"!=typeof URL&&URL.createObjectURL&&"undefined"!=typeof Blob)try{var e="postMessage("+f.toString()+"("+[JSON.stringify(s),u.toString(),p.toString()].join(",")+"));",r=new Blob([e],{type:"text/javascript"}),a=new Worker(URL.createObjectURL(r),{name:"wpTestEmojiSupports"});return void(a.onmessage=function(e){c(n=e.data),a.terminate(),t(n)})}catch(e){}c(n=f(s,u,p))}t(n)}).then(function(e){for(var t in e)n.supports[t]=e[t],n.supports.everything=n.supports.everything&&n.supports[t],"flag"!==t&&(n.supports.everythingExceptFlag=n.supports.everythingExceptFlag&&n.supports[t]);n.supports.everythingExceptFlag=n.supports.everythingExceptFlag&&!n.supports.flag,n.DOMReady=!1,n.readyCallback=function(){n.DOMReady=!0}}).then(function(){return e}).then(function(){var e;n.supports.everything||(n.readyCallback(),(e=n.source||{}).concatemoji?t(e.concatemoji):e.wpemoji&&e.twemoji&&(t(e.twemoji),t(e.wpemoji)))}))}((window,document),window._wpemojiSettings);
|
||||
!function(s,n){var o,i,e;function c(e){try{var t={supportTests:e,timestamp:(new Date).valueOf()};sessionStorage.setItem(o,JSON.stringify(t))}catch(e){}}function p(e,t,n){e.clearRect(0,0,e.canvas.width,e.canvas.height),e.fillText(t,0,0);var t=new Uint32Array(e.getImageData(0,0,e.canvas.width,e.canvas.height).data),a=(e.clearRect(0,0,e.canvas.width,e.canvas.height),e.fillText(n,0,0),new Uint32Array(e.getImageData(0,0,e.canvas.width,e.canvas.height).data));return t.every(function(e,t){return e===a[t]})}function u(e,t){e.clearRect(0,0,e.canvas.width,e.canvas.height),e.fillText(t,0,0);for(var n=e.getImageData(16,16,1,1),a=0;a<n.data.length;a++)if(0!==n.data[a])return!1;return!0}function f(e,t,n,a){switch(t){case"flag":return n(e,"\ud83c\udff3\ufe0f\u200d\u26a7\ufe0f","\ud83c\udff3\ufe0f\u200b\u26a7\ufe0f")?!1:!n(e,"\ud83c\udde8\ud83c\uddf6","\ud83c\udde8\u200b\ud83c\uddf6")&&!n(e,"\ud83c\udff4\udb40\udc67\udb40\udc62\udb40\udc65\udb40\udc6e\udb40\udc67\udb40\udc7f","\ud83c\udff4\u200b\udb40\udc67\u200b\udb40\udc62\u200b\udb40\udc65\u200b\udb40\udc6e\u200b\udb40\udc67\u200b\udb40\udc7f");case"emoji":return!a(e,"\ud83e\udedf")}return!1}function g(e,t,n,a){var r="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?new OffscreenCanvas(300,150):s.createElement("canvas"),o=r.getContext("2d",{willReadFrequently:!0}),i=(o.textBaseline="top",o.font="600 32px Arial",{});return e.forEach(function(e){i[e]=t(o,e,n,a)}),i}function t(e){var t=s.createElement("script");t.src=e,t.defer=!0,s.head.appendChild(t)}"undefined"!=typeof Promise&&(o="wpEmojiSettingsSupports",i=["flag","emoji"],n.supports={everything:!0,everythingExceptFlag:!0},e=new Promise(function(e){s.addEventListener("DOMContentLoaded",e,{once:!0})}),new Promise(function(t){var n=function(){try{var e=JSON.parse(sessionStorage.getItem(o));if("object"==typeof e&&"number"==typeof e.timestamp&&(new Date).valueOf()<e.timestamp+604800&&"object"==typeof e.supportTests)return e.supportTests}catch(e){}return null}();if(!n){if("undefined"!=typeof Worker&&"undefined"!=typeof OffscreenCanvas&&"undefined"!=typeof URL&&URL.createObjectURL&&"undefined"!=typeof Blob)try{var e="postMessage("+g.toString()+"("+[JSON.stringify(i),f.toString(),p.toString(),u.toString()].join(",")+"));",a=new Blob([e],{type:"text/javascript"}),r=new Worker(URL.createObjectURL(a),{name:"wpTestEmojiSupports"});return void(r.onmessage=function(e){c(n=e.data),r.terminate(),t(n)})}catch(e){}c(n=g(i,f,p,u))}t(n)}).then(function(e){for(var t in e)n.supports[t]=e[t],n.supports.everything=n.supports.everything&&n.supports[t],"flag"!==t&&(n.supports.everythingExceptFlag=n.supports.everythingExceptFlag&&n.supports[t]);n.supports.everythingExceptFlag=n.supports.everythingExceptFlag&&!n.supports.flag,n.DOMReady=!1,n.readyCallback=function(){n.DOMReady=!0}}).then(function(){return e}).then(function(){var e;n.supports.everything||(n.readyCallback(),(e=n.source||{}).concatemoji?t(e.concatemoji):e.wpemoji&&e.twemoji&&(t(e.twemoji),t(e.wpemoji)))}))}((window,document),window._wpemojiSettings);
|
||||
2
wp-includes/js/wp-emoji-release.min.js
vendored
2
wp-includes/js/wp-emoji-release.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -16,7 +16,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '6.8.2-alpha-60224';
|
||||
$wp_version = '6.8.2-alpha-60317';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
||||
Reference in New Issue
Block a user