Physikerwelt has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/292332

Change subject: Use img instead of meta tags for SVGs
......................................................................

Use img instead of meta tags for SVGs

* replace meta tag with img tag
* remove js workaround for IE

Bug: T136709
Change-Id: Ifdd75ce51076b098af67a96b5dcb0fc0726d2b00
---
M MathMathML.php
M modules/ext.math.js
2 files changed, 6 insertions(+), 14 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Math 
refs/changes/32/292332/1

diff --git a/MathMathML.php b/MathMathML.php
index 09722bd..26ee1b3 100644
--- a/MathMathML.php
+++ b/MathMathML.php
@@ -385,9 +385,9 @@
         * @return string XML the image html tag
         */
        private function getFallbackImage( $noRender = false, $classOverride = 
false ) {
-               $url = $this->getFallbackImageUrl( $noRender );
-
-               $attribs = [];
+               $attribs = [
+                       'src' => $this->getFallbackImageUrl( $noRender )
+               ];
                if ( $classOverride === false ) { // $class = '' suppresses 
class attribute
                        $class = $this->getClassName( true );
                } else {
@@ -396,18 +396,13 @@
                if ( ! $this->mathoidStyle ) {
                        $this->correctSvgStyle( $this->mathoidStyle );
                }
-               // TODO: move the common styles to the global stylesheet!
-               $style = 'background-image: url(\''. $url .
-                        '\'); background-repeat: no-repeat; background-size: 
100% 100%; '.
-                       $this->mathoidStyle;
                if ( $class ) {
                        $attribs['class'] = $class;
                }
 
-               // Don't use an empty span, as that is going to be stripped by 
HTML tidy
-               // when enabled (which is true in production).
-               return Xml::element( 'meta', $this->getAttributes(
-                       'span', $attribs, [ 'aria-hidden' => 'true', 'style' => 
$style
+               return Xml::element( 'img', $this->getAttributes( 'span', 
$attribs, [
+                       'aria-hidden' => 'true',
+                       'style' => $this->mathoidStyle
                ] ) );
        }
 
diff --git a/modules/ext.math.js b/modules/ext.math.js
index b3fe744..d2a79e1 100644
--- a/modules/ext.math.js
+++ b/modules/ext.math.js
@@ -31,8 +31,5 @@
        // PNG fallback. See 
https://github.com/Modernizr/Modernizr/blob/master/feature-detects/svg/asimg.js
        if ( !document.implementation.hasFeature( 
'http://www.w3.org/TR/SVG11/feature#Image', '1.1' ) ) {
                insertImg( true );
-       } else if ( $.client.profile().name.match( /msie|edge/ ) ) {
-               // For all IE versions the meta tags are rendered blurry, while 
img tags are rendered fine.
-               insertImg( false );
        }
 }( jQuery ) );

-- 
To view, visit https://gerrit.wikimedia.org/r/292332
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ifdd75ce51076b098af67a96b5dcb0fc0726d2b00
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Math
Gerrit-Branch: master
Gerrit-Owner: Physikerwelt <w...@physikerwelt.de>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to