r92284 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r92283‎ | r92284 | r92285 >
Date:19:17, 15 July 2011
Author:reedy
Status:ok
Tags:
Comment:
1.17wmf1 MFT r88870
Modified paths:
  • /branches/wmf/1.17wmf1/includes/media/SVGMetadataExtractor.php (modified) (history)

Diff [purge]

Index: branches/wmf/1.17wmf1/includes/media/SVGMetadataExtractor.php
@@ -101,7 +101,7 @@
102102 $keepReading = $this->reader->read();
103103 }
104104
105 - if ( !$this->qualifiedNameEquals( $this->reader->name, 'svg', 'svg' ) ) {
 105+ if ( $this->reader->name != 'svg' ) {
106106 throw new MWException( "Expected <svg> tag, got ".
107107 $this->reader->name );
108108 }
@@ -116,13 +116,13 @@
117117
118118 $this->debug( "$tag" );
119119
120 - if ( $this->qualifiedNameEquals( $tag, 'svg', 'svg' ) && $type == XmlReader::END_ELEMENT && $this->reader->depth <= $exitDepth ) {
 120+ if ( $tag == 'svg' && $type == XmlReader::END_ELEMENT && $this->reader->depth <= $exitDepth ) {
121121 break;
122 - } elseif ( $this->qualifiedNameEquals( $tag, 'svg', 'title' ) ) {
 122+ } elseif ( $tag == 'title' ) {
123123 $this->readField( $tag, 'title' );
124 - } elseif ( $this->qualifiedNameEquals( $tag, 'svg', 'desc' ) ) {
 124+ } elseif ( $tag == 'desc' ) {
125125 $this->readField( $tag, 'description' );
126 - } elseif ( $this->qualifiedNameEquals( $tag, 'svg', 'metadata' ) && $type == XmlReader::ELEMENT ) {
 126+ } elseif ( $tag == 'metadata' && $type == XmlReader::ELEMENT ) {
127127 $this->readXml( $tag, 'metadata' );
128128 } elseif ( $tag !== '#text' ) {
129129 $this->debug( "Unhandled top-level XML tag $tag" );
@@ -198,15 +198,10 @@
199199 } elseif ( $this->reader->nodeType == XmlReader::ELEMENT ) {
200200 switch( $this->reader->name ) {
201201 case 'animate':
202 - case 'svg:animate':
203202 case 'set':
204 - case 'svg:set':
205203 case 'animateMotion':
206 - case 'svg:animateMotion':
207204 case 'animateColor':
208 - case 'svg:animateColor':
209205 case 'animateTransform':
210 - case 'svg:animateTransform':
211206 $this->debug( "HOUSTON WE HAVE ANIMATION" );
212207 $this->metadata['animated'] = true;
213208 break;
@@ -315,22 +310,4 @@
316311 return floatval( $length );
317312 }
318313 }
319 -
320 - /**
321 - * XML namespace check
322 - *
323 - * Check if a read node name matches the expected nodeName
324 - * @param $qualifiedName as read by XMLReader
325 - * @param $prefix the namespace prefix that you expect for this element, defaults to svg namespace
326 - * @param $localName the localName part of the element that you want to match
327 - *
328 - * @return boolean
329 - */
330 - private function qualifiedNameEquals( $qualifiedName, $prefix="svg", $localName ) {
331 - if( ($qualifiedName == $localName && $prefix == "svg" ) ||
332 - $qualifiedName == ($prefix . ":" . $localName) ) {
333 - return true;
334 - }
335 - return false;
336 - }
337314 }

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r88870Reverting r82307 (bug 27465) as initial step to recommitting a cleaner fix.brion23:57, 25 May 2011

Status & tagging log