r39837 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r39836‎ | r39837 | r39838 >
Date:15:49, 22 August 2008
Author:guyvdb
Status:old
Tags:
Comment:
Removed non-XHTML-compliant attributes from HTML differ output. Removed unused javascript.
Modified paths:
  • /trunk/phase3/includes/HTMLDiff.php (modified) (history)
  • /trunk/phase3/skins/common/diff.js (modified) (history)

Diff [purge]

Index: trunk/phase3/skins/common/diff.js
@@ -18,15 +18,3 @@
1919 "table.diff td div { overflow: visible; }",
2020 lastSheet.cssRules.length);
2121 }
22 -
23 -function tipA(content){
24 - return false;
25 -}
26 -
27 -function tipR(content){
28 - return false;
29 -}
30 -
31 -function tipC(content){
32 - return false;
33 -}
Index: trunk/phase3/includes/HTMLDiff.php
@@ -456,10 +456,6 @@
457457
458458 public $id = -1;
459459
460 - public $prevMod;
461 -
462 - public $nextMod;
463 -
464460 public $firstOfID = false;
465461
466462 public $changes;
@@ -608,8 +604,6 @@
609605 private $oldTextNodes;
610606 private $oldBodyNode;
611607
612 - private $lastModified = array();
613 -
614608 private $newID = 0;
615609
616610 private $changedID = 0;
@@ -637,27 +631,15 @@
638632 $this->textNodes[$start]->whiteBefore = false;
639633 }
640634
641 - $nextLastModified = array();
642 -
643635 for ($i = $start; $i < $end; ++$i) {
644636 $mod = new Modification(Modification::ADDED);
645637 $mod->id = $this->newID;
646 - if (count($this->lastModified) > 0) {
647 - $mod->prevMod = $this->lastModified[0];
648 - if (is_null($this->lastModified[0]->nextMod )) {
649 - foreach ($this->lastModified as &$lastMod) {
650 - $lastMod->nextMod = $mod;
651 - }
652 - }
653 - }
654 - $nextLastModified[] = $mod;
655638 $this->textNodes[$i]->modification = $mod;
656639 }
657640 if ($start < $end) {
658641 $this->textNodes[$start]->modification->firstOfID = true;
659642 }
660643 ++$this->newID;
661 - $this->lastModified = $nextLastModified;
662644 }
663645
664646 public function handlePossibleChangedPart($leftstart, $leftend, $rightstart, $rightend) {
@@ -669,8 +651,6 @@
670652 $this->changedIDUsed = false;
671653 }
672654
673 - $nextLastModified = array();
674 -
675655 $changes;
676656 while ($i < $rightend) {
677657 $acthis = new AncestorComparator($this->textNodes[$i]->getParentTree());
@@ -678,35 +658,16 @@
679659 $result = $acthis->getResult($acother);
680660 unset($acthis, $acother);
681661
682 - $nbLastModified = count($this->lastModified);
683662 if ($result->changed) {
684663 $mod = new Modification(Modification::CHANGED);
685664
686665 if (!$this->changedIDUsed) {
687666 $mod->firstOfID = true;
688 - if (count($nextLastModified) > 0) {
689 - $this->lastModified = $nextLastModified;
690 - $nextLastModified = array();
691 - }
692667 } else if (!is_null($result->changes) && $result->changes !== $this->changes) {
693668 ++$this->changedID;
694669 $mod->firstOfID = true;
695 - if (count($nextLastModified) > 0) {
696 - $this->lastModified = $nextLastModified;
697 - $nextLastModified = array();
698 - }
699670 }
700671
701 - if ($nbLastModified > 0) {
702 - $mod->prevMod = $this->lastModified[0];
703 - if (is_null($this->lastModified[0]->nextMod )) {
704 - foreach ($this->lastModified as &$lastMod) {
705 - $lastMod->nextMod = $mod;
706 - }
707 - }
708 - }
709 - $nextLastModified[] = $mod;
710 -
711672 $mod->changes = $result->changes;
712673 $mod->id = $this->changedID;
713674
@@ -720,9 +681,6 @@
721682 ++$i;
722683 ++$j;
723684 }
724 - if (count($nextLastModified) > 0) {
725 - $this->lastModified = $nextLastModified;
726 - }
727685 }
728686
729687 public function markAsDeleted($start, $end, $before) {
@@ -737,20 +695,9 @@
738696 $this->whiteAfterLastChangedPart = false;
739697 }
740698
741 - $nextLastModified = array();
742 -
743699 for ($i = $start; $i < $end; ++$i) {
744700 $mod = new Modification(Modification::REMOVED);
745701 $mod->id = $this->deletedID;
746 - if (count($this->lastModified) > 0) {
747 - $mod->prevMod = $this->lastModified[0];
748 - if (is_null($this->lastModified[0]->nextMod )) {
749 - foreach ($this->lastModified as &$lastMod) {
750 - $lastMod->nextMod = $mod;
751 - }
752 - }
753 - }
754 - $nextLastModified[] = $mod;
755702
756703 // oldTextNodes is used here because we're going to move its deleted
757704 // elements to this tree!
@@ -842,7 +789,6 @@
843790 throw new Exception("Uh?");
844791 }
845792 }
846 - $this->lastModified = $nextLastModified;
847793 ++$this->deletedID;
848794 }
849795
@@ -1376,8 +1322,6 @@
13771323 if ($mod->firstOfID) {
13781324 $attrs['id'] = "added-{$this->prefix}-{$mod->id}";
13791325 }
1380 - $this->addAttributes($mod, $attrs);
1381 - $attrs['onclick'] = 'return tipA(constructToolTipA(this));';
13821326 $handler->startElement('span', $attrs);
13831327 $newStarted = true;
13841328 } else if (!$changeStarted && $mod->type == Modification::CHANGED) {
@@ -1385,8 +1329,6 @@
13861330 if ($mod->firstOfID) {
13871331 $attrs['id'] = "changed-{$this->prefix}-{$mod->id}";
13881332 }
1389 - $this->addAttributes($mod, $attrs);
1390 - $attrs['onclick'] = 'return tipC(constructToolTipC(this));';
13911333 $handler->startElement('span', $attrs);
13921334
13931335 //tooltip
@@ -1401,8 +1343,6 @@
14021344 if ($mod->firstOfID) {
14031345 $attrs['id'] = "removed-{$this->prefix}-{$mod->id}";
14041346 }
1405 - $this->addAttributes($mod, $attrs);
1406 - $attrs['onclick'] = 'return tipR(constructToolTipR(this));';
14071347 $handler->startElement('span', $attrs);
14081348 $remStarted = true;
14091349 }
@@ -1414,7 +1354,6 @@
14151355 } else {
14161356 $handler->characters($chars);
14171357 }
1418 -
14191358 }
14201359 }
14211360
@@ -1437,39 +1376,9 @@
14381377
14391378 private function writeImage(ImageNode $imgNode) {
14401379 $attrs = $imgNode->attributes;
1441 - if ($imgNode->modification->type == Modification::REMOVED) {
1442 - $attrs['changeType']='diff-removed-image';
1443 - } else if ($imgNode->modification->type == Modification::ADDED) {
1444 - $attrs['changeType'] = 'diff-added-image';
1445 - }
1446 - $attrs['onload'] = 'updateOverlays()';
1447 - $attrs['onError'] = 'updateOverlays()';
1448 - $attrs['onAbort'] = 'updateOverlays()';
14491380 $this->handler->startElement('img', $attrs);
14501381 $this->handler->endElement('img');
14511382 }
1452 -
1453 - private function addAttributes(Modification $mod, /*array*/ &$attrs) {
1454 - if (is_null($mod->prevMod)) {
1455 - $previous = 'first-' . $this->prefix;
1456 - } else {
1457 - $type = Modification::typeToString($mod->prevMod->type);
1458 - $previous = "$type-{$this->prefix}-{$mod->prevMod->id}";
1459 - }
1460 - $attrs['previous'] = $previous;
1461 -
1462 - $type = Modification::typeToString($mod->type);
1463 - $changeId = "$type-{$this->prefix}-{$mod->id}";
1464 - $attrs['changeId'] = $changeId;
1465 -
1466 - if (is_null($mod->nextMod )) {
1467 - $next = "last-{$this->prefix}";
1468 - } else {
1469 - $type = Modification::typeToString($mod->nextMod->type);
1470 - $next = "$type-{$this->prefix}-{$mod->nextMod->id}";
1471 - }
1472 - $attrs['next'] = $next;
1473 - }
14741383 }
14751384
14761385 class EchoingContentHandler {

Status & tagging log