[Libreoffice-commits] core.git: filter/source
Szymon KÅos (via logerrit)
logerrit at kemper.freedesktop.org
Mon Mar 22 20:13:24 UTC 2021
filter/source/svg/presentation_engine.js | 23 ++++++++++++++++-------
1 file changed, 16 insertions(+), 7 deletions(-)
New commits:
commit b1d933568a1ca4f1752cbabbf7c841d0facc7655
Author: Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Wed Mar 17 15:57:21 2021 +0100
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Mon Mar 22 21:12:39 2021 +0100
Polyfill presentation_engine.js for IE11
IE11 doesn't support:
Array.includes, String.startsWith and Math.trunc
Change-Id: I71c5810ad9230988453f70e880f46869728f49c5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112626
Tested-by: Jenkins
Reviewed-by: Andras Timar <andras.timar at collabora.com>
diff --git a/filter/source/svg/presentation_engine.js b/filter/source/svg/presentation_engine.js
index 377647c8ec1c..636fc3a50d37 100644
--- a/filter/source/svg/presentation_engine.js
+++ b/filter/source/svg/presentation_engine.js
@@ -31,6 +31,15 @@ var round = Math.round;
var abs = Math.abs;
var now = Date.now;
+/**
+ * polyfill for IE11
+ */
+if (!Math.trunc) {
+ Math.trunc = function (v) {
+ return v < 0 ? Math.ceil(v) : Math.floor(v);
+ };
+}
+
/**
* set a timeout with a given scope
* @param {Function} fn
@@ -5393,9 +5402,9 @@ function getTextFieldType ( elem )
function isTextFieldByClassName ( sClassName )
{
return sClassName === aDateTimeClassName || sClassName === aFooterClassName
- || sClassName === aHeaderClassName || sClassName.startsWith( aSlideNumberClassName )
- || sClassName.startsWith( aDateClassName ) || sClassName.startsWith( aTimeClassName )
- || sClassName.startsWith( aSlideNameClassName );
+ || sClassName === aHeaderClassName || sClassName.indexOf( aSlideNumberClassName ) == 0
+ || sClassName.indexOf( aDateClassName ) == 0 || sClassName.indexOf( aTimeClassName ) == 0
+ || sClassName.indexOf( aSlideNameClassName ) == 0;
}
/** Class MasterPage
@@ -5819,7 +5828,7 @@ MasterPageView.prototype.createElement = function()
for( ; i < aBackgroundObjectSubGroupIdList.length; ++i )
{
sId = aBackgroundObjectSubGroupIdList[i];
- if( sId.startsWith( aSlideNumberClassName ) )
+ if( sId.indexOf( aSlideNumberClassName ) == 0 )
{
// Slide Number Field
// The cloned element is appended directly to the field group element
@@ -5873,9 +5882,9 @@ MasterPageView.prototype.createElement = function()
aTextFieldHandlerSet, sMasterSlideId );
}
}
- else if( sId.startsWith( aDateClassName )
- || sId.startsWith( aTimeClassName )
- || sId.startsWith( aSlideNameClassName ) )
+ else if( sId.indexOf( aDateClassName ) == 0
+ || sId.indexOf( aTimeClassName ) == 0
+ || sId.indexOf( aSlideNameClassName ) == 0 )
{
this.initTextFieldHandler( sId, aPlaceholderShapeSet,
aTextFieldContentProviderSet, aDefsElement,
More information about the Libreoffice-commits
mailing list