'num')), phutil_tag('col', array('class' => 'num')), phutil_tag('col', array('class' => 'copy')), phutil_tag('col', array('class' => 'unified')), )); } public function renderTextChange( $range_start, $range_len, $rows) { $primitives = $this->buildPrimitives($range_start, $range_len); return $this->renderPrimitives($primitives, $rows); } protected function renderPrimitives(array $primitives, $rows) { list($left_prefix, $right_prefix) = $this->getLineIDPrefixes(); $no_copy = phutil_tag('td', array('class' => 'copy')); $no_coverage = null; $column_width = 4; $hidden = new PHUIDiffRevealIconView(); $out = array(); foreach ($primitives as $k => $p) { $type = $p['type']; switch ($type) { case 'old': case 'new': case 'old-file': case 'new-file': $is_old = ($type == 'old' || $type == 'old-file'); $o_hidden = array(); $n_hidden = array(); for ($look = $k + 1; isset($primitives[$look]); $look++) { $next = $primitives[$look]; switch ($next['type']) { case 'inline': $comment = $next['comment']; if ($comment->isHidden()) { if ($next['right']) { $n_hidden[] = $comment; } else { $o_hidden[] = $comment; } } break; default: break 2; } } $cells = array(); if ($is_old) { if ($p['htype']) { $class = 'left old'; } else { $class = 'left'; } if ($type == 'old-file') { $class = "{$class} differential-old-image"; } if ($left_prefix) { $left_id = $left_prefix.$p['line']; } else { $left_id = null; } $line = $p['line']; if ($o_hidden) { $line = array($hidden, $line); } $cells[] = phutil_tag('th', array('id' => $left_id), $line); $cells[] = phutil_tag('th', array()); $cells[] = $no_copy; $cells[] = phutil_tag('td', array('class' => $class), $p['render']); $cells[] = $no_coverage; } else { if ($p['htype']) { $class = 'right new'; $cells[] = phutil_tag('th', array()); } else { $class = 'right'; if ($left_prefix) { $left_id = $left_prefix.$p['oline']; } else { $left_id = null; } $oline = $p['oline']; if ($o_hidden) { $oline = array($hidden, $oline); } $cells[] = phutil_tag('th', array('id' => $left_id), $oline); } if ($type == 'new-file') { $class = "{$class} differential-new-image"; } if ($right_prefix) { $right_id = $right_prefix.$p['line']; } else { $right_id = null; } $line = $p['line']; if ($n_hidden) { $line = array($hidden, $line); } $cells[] = phutil_tag('th', array('id' => $right_id), $line); $cells[] = $no_copy; $cells[] = phutil_tag('td', array('class' => $class), $p['render']); $cells[] = $no_coverage; } $out[] = phutil_tag('tr', array(), $cells); break; case 'inline': $inline = $this->buildInlineComment( $p['comment'], $p['right']); $out[] = $this->getRowScaffoldForInline($inline); break; case 'no-context': $out[] = phutil_tag( 'tr', array(), phutil_tag( 'td', array( 'class' => 'show-more', 'colspan' => $column_width, ), pht('Context not available.'))); break; case 'context': $top = $p['top']; $len = $p['len']; $links = $this->renderShowContextLinks($top, $len, $rows); $out[] = javelin_tag( 'tr', array( 'sigil' => 'context-target', ), phutil_tag( 'td', array( 'class' => 'show-more', 'colspan' => $column_width, ), $links)); break; default: $out[] = hsprintf('