diff --git a/src/applications/differential/render/DifferentialChangesetHTMLRenderer.php b/src/applications/differential/render/DifferentialChangesetHTMLRenderer.php --- a/src/applications/differential/render/DifferentialChangesetHTMLRenderer.php +++ b/src/applications/differential/render/DifferentialChangesetHTMLRenderer.php @@ -425,13 +425,6 @@ )); } - protected function renderInlineComment( - PhabricatorInlineCommentInterface $comment, - $on_right = false) { - - return $this->buildInlineComment($comment, $on_right)->render(); - } - protected function buildInlineComment( PhabricatorInlineCommentInterface $comment, $on_right = false) { diff --git a/src/applications/differential/render/DifferentialChangesetTwoUpRenderer.php b/src/applications/differential/render/DifferentialChangesetTwoUpRenderer.php --- a/src/applications/differential/render/DifferentialChangesetTwoUpRenderer.php +++ b/src/applications/differential/render/DifferentialChangesetTwoUpRenderer.php @@ -264,39 +264,33 @@ if ($o_num && isset($old_comments[$o_num])) { foreach ($old_comments[$o_num] as $comment) { - $comment_html = $this->renderInlineComment($comment, - $on_right = false); - $new = ''; + $inline = $this->buildInlineComment( + $comment, + $on_right = false); + $scaffold = $this->getRowScaffoldForInline($inline); + if ($n_num && isset($new_comments[$n_num])) { foreach ($new_comments[$n_num] as $key => $new_comment) { if ($comment->isCompatible($new_comment)) { - $new = $this->renderInlineComment($new_comment, - $on_right = true); + $companion = $this->buildInlineComment( + $new_comment, + $on_right = true); + + $scaffold->addInlineView($companion); unset($new_comments[$n_num][$key]); } } } - $html[] = phutil_tag('tr', array('class' => 'inline'), array( - phutil_tag('th', array()), - phutil_tag('td', array(), $comment_html), - phutil_tag('th', array()), - phutil_tag('td', array('colspan' => 3), $new), - )); + + $html[] = $scaffold; } } if ($n_num && isset($new_comments[$n_num])) { foreach ($new_comments[$n_num] as $comment) { - $comment_html = $this->renderInlineComment($comment, - $on_right = true); - $html[] = phutil_tag('tr', array('class' => 'inline'), array( - phutil_tag('th', array()), - phutil_tag('td', array()), - phutil_tag('th', array()), - phutil_tag( - 'td', - array('colspan' => 3), - $comment_html), - )); + $inline = $this->buildInlineComment( + $comment, + $on_right = true); + $html[] = $this->getRowScaffoldForInline($inline); } } } @@ -340,27 +334,18 @@ $html_new = array(); foreach ($this->getOldComments() as $on_line => $comment_group) { foreach ($comment_group as $comment) { - $comment_html = $this->renderInlineComment($comment, $on_right = false); - $html_old[] = phutil_tag('tr', array('class' => 'inline'), array( - phutil_tag('th', array()), - phutil_tag('td', array(), $comment_html), - phutil_tag('th', array()), - phutil_tag('td', array('colspan' => 3)), - )); + $inline = $this->buildInlineComment( + $comment, + $on_right = false); + $html_old[] = $this->getRowScaffoldForInline($inline); } } foreach ($this->getNewComments() as $lin_line => $comment_group) { foreach ($comment_group as $comment) { - $comment_html = $this->renderInlineComment($comment, $on_right = true); - $html_new[] = phutil_tag('tr', array('class' => 'inline'), array( - phutil_tag('th', array()), - phutil_tag('td', array()), - phutil_tag('th', array()), - phutil_tag( - 'td', - array('colspan' => 3), - $comment_html), - )); + $inline = $this->buildInlineComment( + $comment, + $on_right = true); + $html_new[] = $this->getRowScaffoldForInline($inline); } } diff --git a/src/infrastructure/diff/view/PHUIDiffInlineCommentRowScaffold.php b/src/infrastructure/diff/view/PHUIDiffInlineCommentRowScaffold.php --- a/src/infrastructure/diff/view/PHUIDiffInlineCommentRowScaffold.php +++ b/src/infrastructure/diff/view/PHUIDiffInlineCommentRowScaffold.php @@ -20,4 +20,12 @@ return $this; } + protected function getRowAttributes() { + // TODO: This is semantic information used by the JS when placing comments + // and using keyboard navigation; we should move it out of class names. + return array( + 'class' => 'inline', + ); + } + } diff --git a/src/infrastructure/diff/view/PHUIDiffOneUpInlineCommentRowScaffold.php b/src/infrastructure/diff/view/PHUIDiffOneUpInlineCommentRowScaffold.php --- a/src/infrastructure/diff/view/PHUIDiffOneUpInlineCommentRowScaffold.php +++ b/src/infrastructure/diff/view/PHUIDiffOneUpInlineCommentRowScaffold.php @@ -27,7 +27,7 @@ phutil_tag('td', $attrs, $inline), ); - return phutil_tag('tr', array(), $cells); + return phutil_tag('tr', $this->getRowAttributes(), $cells); } } diff --git a/src/infrastructure/diff/view/PHUIDiffTwoUpInlineCommentRowScaffold.php b/src/infrastructure/diff/view/PHUIDiffTwoUpInlineCommentRowScaffold.php --- a/src/infrastructure/diff/view/PHUIDiffTwoUpInlineCommentRowScaffold.php +++ b/src/infrastructure/diff/view/PHUIDiffTwoUpInlineCommentRowScaffold.php @@ -66,7 +66,7 @@ phutil_tag('td', $right_attrs, $right_side), ); - return phutil_tag('tr', array(), $cells); + return phutil_tag('tr', $this->getRowAttributes(), $cells); } }