Differential D17861 Diff 43049 src/applications/differential/render/DifferentialChangesetTwoUpRenderer.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/differential/render/DifferentialChangesetTwoUpRenderer.php
| Show First 20 Lines • Show All 63 Lines • ▼ Show 20 Lines | public function renderTextChange( | ||||
| $highlight_new = $this->getHighlightNew(); | $highlight_new = $this->getHighlightNew(); | ||||
| $old_render = $this->getOldRender(); | $old_render = $this->getOldRender(); | ||||
| $new_render = $this->getNewRender(); | $new_render = $this->getNewRender(); | ||||
| $original_left = $this->getOriginalOld(); | $original_left = $this->getOriginalOld(); | ||||
| $original_right = $this->getOriginalNew(); | $original_right = $this->getOriginalNew(); | ||||
| $depths = $this->getDepths(); | $depths = $this->getDepths(); | ||||
| $mask = $this->getMask(); | $mask = $this->getMask(); | ||||
| $hidden = new PHUIDiffRevealIconView(); | |||||
| for ($ii = $range_start; $ii < $range_start + $range_len; $ii++) { | for ($ii = $range_start; $ii < $range_start + $range_len; $ii++) { | ||||
| if (empty($mask[$ii])) { | if (empty($mask[$ii])) { | ||||
| // If we aren't going to show this line, we've just entered a gap. | // If we aren't going to show this line, we've just entered a gap. | ||||
| // Pop information about the next gap off the $gaps stack and render | // Pop information about the next gap off the $gaps stack and render | ||||
| // an appropriate "Show more context" element. This branch eventually | // an appropriate "Show more context" element. This branch eventually | ||||
| // increments $ii by the entire size of the gap and then continues | // increments $ii by the entire size of the gap and then continues | ||||
| // the loop. | // the loop. | ||||
| $gap = array_pop($gaps); | $gap = array_pop($gaps); | ||||
| ▲ Show 20 Lines • Show All 154 Lines • ▼ Show 20 Lines | for ($ii = $range_start; $ii < $range_start + $range_len; $ii++) { | ||||
| } else { | } else { | ||||
| $n_id = null; | $n_id = null; | ||||
| } | } | ||||
| $old_comments = $this->getOldComments(); | $old_comments = $this->getOldComments(); | ||||
| $new_comments = $this->getNewComments(); | $new_comments = $this->getNewComments(); | ||||
| $scaffolds = array(); | $scaffolds = array(); | ||||
| $o_hidden = array(); | |||||
| $n_hidden = array(); | |||||
| if ($o_num && isset($old_comments[$o_num])) { | if ($o_num && isset($old_comments[$o_num])) { | ||||
| foreach ($old_comments[$o_num] as $comment) { | foreach ($old_comments[$o_num] as $comment) { | ||||
| $inline = $this->buildInlineComment( | $inline = $this->buildInlineComment( | ||||
| $comment, | $comment, | ||||
| $on_right = false); | $on_right = false); | ||||
| $scaffold = $this->getRowScaffoldForInline($inline); | $scaffold = $this->getRowScaffoldForInline($inline); | ||||
| if ($comment->isHidden()) { | |||||
| $o_hidden[] = $comment; | |||||
| } | |||||
| if ($n_num && isset($new_comments[$n_num])) { | if ($n_num && isset($new_comments[$n_num])) { | ||||
| foreach ($new_comments[$n_num] as $key => $new_comment) { | foreach ($new_comments[$n_num] as $key => $new_comment) { | ||||
| if ($comment->isCompatible($new_comment)) { | if ($comment->isCompatible($new_comment)) { | ||||
| $companion = $this->buildInlineComment( | $companion = $this->buildInlineComment( | ||||
| $new_comment, | $new_comment, | ||||
| $on_right = true); | $on_right = true); | ||||
| if ($new_comment->isHidden()) { | |||||
| $n_hidden = $new_comment; | |||||
| } | |||||
| $scaffold->addInlineView($companion); | $scaffold->addInlineView($companion); | ||||
| unset($new_comments[$n_num][$key]); | unset($new_comments[$n_num][$key]); | ||||
| break; | break; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| $scaffolds[] = $scaffold; | $scaffolds[] = $scaffold; | ||||
| } | } | ||||
| } | } | ||||
| if ($n_num && isset($new_comments[$n_num])) { | if ($n_num && isset($new_comments[$n_num])) { | ||||
| foreach ($new_comments[$n_num] as $comment) { | foreach ($new_comments[$n_num] as $comment) { | ||||
| $inline = $this->buildInlineComment( | $inline = $this->buildInlineComment( | ||||
| $comment, | $comment, | ||||
| $on_right = true); | $on_right = true); | ||||
| if ($comment->isHidden()) { | |||||
| $n_hidden[] = $comment; | |||||
| } | |||||
| $scaffolds[] = $this->getRowScaffoldForInline($inline); | $scaffolds[] = $this->getRowScaffoldForInline($inline); | ||||
| } | } | ||||
| } | } | ||||
| if ($o_hidden) { | |||||
| $o_num = array($hidden, $o_num); | |||||
| } | |||||
| if ($n_hidden) { | |||||
| $n_num = array($hidden, $n_num); | |||||
| } | |||||
| // NOTE: This is a unicode zero-width space, which we use as a hint when | // NOTE: This is a unicode zero-width space, which we use as a hint when | ||||
| // intercepting 'copy' events to make sure sensible text ends up on the | // intercepting 'copy' events to make sure sensible text ends up on the | ||||
| // clipboard. See the 'phabricator-oncopy' behavior. | // clipboard. See the 'phabricator-oncopy' behavior. | ||||
| $zero_space = "\xE2\x80\x8B"; | $zero_space = "\xE2\x80\x8B"; | ||||
| $html[] = phutil_tag('tr', array(), array( | $html[] = phutil_tag('tr', array(), array( | ||||
| phutil_tag('th', array('id' => $o_id, 'class' => $o_classes), $o_num), | phutil_tag('th', array('id' => $o_id, 'class' => $o_classes), $o_num), | ||||
| phutil_tag('td', array('class' => $o_classes), $o_text), | phutil_tag('td', array('class' => $o_classes), $o_text), | ||||
| ▲ Show 20 Lines • Show All 98 Lines • Show Last 20 Lines | |||||