Changeset View
Changeset View
Standalone View
Standalone View
src/applications/files/document/PhabricatorImageDocumentEngine.php
Show All 33 Lines | public function newEngineBlocks( | ||||
$u_blocks = $this->newDiffBlocks($uref); | $u_blocks = $this->newDiffBlocks($uref); | ||||
$v_blocks = $this->newDiffBlocks($vref); | $v_blocks = $this->newDiffBlocks($vref); | ||||
return id(new PhabricatorDocumentEngineBlocks()) | return id(new PhabricatorDocumentEngineBlocks()) | ||||
->addBlockList($uref, $u_blocks) | ->addBlockList($uref, $u_blocks) | ||||
->addBlockList($vref, $v_blocks); | ->addBlockList($vref, $v_blocks); | ||||
} | } | ||||
public function newBlockDiffViews( | |||||
PhabricatorDocumentRef $uref, | |||||
PhabricatorDocumentEngineBlock $ublock, | |||||
PhabricatorDocumentRef $vref, | |||||
PhabricatorDocumentEngineBlock $vblock) { | |||||
$u_content = $this->newBlockContentView($uref, $ublock); | |||||
$v_content = $this->newBlockContentView($vref, $vblock); | |||||
return id(new PhabricatorDocumentEngineBlockDiff()) | |||||
->setOldContent($u_content) | |||||
->addOldClass('diff-image-cell') | |||||
->setNewContent($v_content) | |||||
->addNewClass('diff-image-cell'); | |||||
} | |||||
private function newDiffBlocks(PhabricatorDocumentRef $ref) { | private function newDiffBlocks(PhabricatorDocumentRef $ref) { | ||||
$blocks = array(); | $blocks = array(); | ||||
$file = $ref->getFile(); | $file = $ref->getFile(); | ||||
$image_view = phutil_tag( | $image_view = phutil_tag( | ||||
'div', | 'div', | ||||
array( | array( | ||||
'class' => 'differential-image-stage', | 'class' => 'differential-image-stage', | ||||
), | ), | ||||
phutil_tag( | phutil_tag( | ||||
'img', | 'img', | ||||
array( | array( | ||||
'src' => $file->getBestURI(), | 'src' => $file->getBestURI(), | ||||
))); | ))); | ||||
$hash = $file->getContentHash(); | $hash = $file->getContentHash(); | ||||
$blocks[] = id(new PhabricatorDocumentEngineBlock()) | $blocks[] = id(new PhabricatorDocumentEngineBlock()) | ||||
->setBlockKey('1') | ->setBlockKey('1') | ||||
->addClass('diff-image-cell') | |||||
->setDifferenceHash($hash) | ->setDifferenceHash($hash) | ||||
->setContent($image_view); | ->setContent($image_view); | ||||
return $blocks; | return $blocks; | ||||
} | } | ||||
protected function canRenderDocumentType(PhabricatorDocumentRef $ref) { | protected function canRenderDocumentType(PhabricatorDocumentRef $ref) { | ||||
$file = $ref->getFile(); | $file = $ref->getFile(); | ||||
▲ Show 20 Lines • Show All 50 Lines • Show Last 20 Lines |