Page MenuHomePhabricator

D19348.id46286.diff
No OneTemporary

D19348.id46286.diff

diff --git a/resources/celerity/map.php b/resources/celerity/map.php
--- a/resources/celerity/map.php
+++ b/resources/celerity/map.php
@@ -119,7 +119,7 @@
'rsrc/css/font/font-lato.css' => 'c7ccd872',
'rsrc/css/font/phui-font-icon-base.css' => '870a7360',
'rsrc/css/layout/phabricator-filetree-view.css' => 'b912ad97',
- 'rsrc/css/layout/phabricator-source-code-view.css' => '326df52d',
+ 'rsrc/css/layout/phabricator-source-code-view.css' => 'c5edc888',
'rsrc/css/phui/button/phui-button-bar.css' => 'f1ff5494',
'rsrc/css/phui/button/phui-button-simple.css' => '8e1baf68',
'rsrc/css/phui/button/phui-button.css' => '1863cc6e',
@@ -471,7 +471,7 @@
'rsrc/js/core/behavior-keyboard-pager.js' => 'a8da01f0',
'rsrc/js/core/behavior-keyboard-shortcuts.js' => '01fca1f0',
'rsrc/js/core/behavior-lightbox-attachments.js' => '6b31879a',
- 'rsrc/js/core/behavior-line-linker.js' => '1e017314',
+ 'rsrc/js/core/behavior-line-linker.js' => '69837bed',
'rsrc/js/core/behavior-more.js' => 'a80d0378',
'rsrc/js/core/behavior-object-selector.js' => '77c1f0b0',
'rsrc/js/core/behavior-oncopy.js' => '2926fff2',
@@ -634,7 +634,7 @@
'javelin-behavior-phabricator-gesture-example' => '558829c2',
'javelin-behavior-phabricator-keyboard-pager' => 'a8da01f0',
'javelin-behavior-phabricator-keyboard-shortcuts' => '01fca1f0',
- 'javelin-behavior-phabricator-line-linker' => '1e017314',
+ 'javelin-behavior-phabricator-line-linker' => '69837bed',
'javelin-behavior-phabricator-nav' => '94b7c320',
'javelin-behavior-phabricator-notification-example' => '8ce821c5',
'javelin-behavior-phabricator-object-selector' => '77c1f0b0',
@@ -780,7 +780,7 @@
'phabricator-search-results-css' => '505dd8cf',
'phabricator-shaped-request' => '7cbe244b',
'phabricator-slowvote-css' => 'a94b7230',
- 'phabricator-source-code-view-css' => '326df52d',
+ 'phabricator-source-code-view-css' => 'c5edc888',
'phabricator-standard-page-view' => '34ee718b',
'phabricator-textareautils' => '320810c8',
'phabricator-title' => '485aaa6c',
@@ -1003,12 +1003,6 @@
'javelin-workflow',
'javelin-magical-init',
),
- '1e017314' => array(
- 'javelin-behavior',
- 'javelin-stratcom',
- 'javelin-dom',
- 'javelin-history',
- ),
'1f6794f6' => array(
'javelin-behavior',
'javelin-stratcom',
@@ -1413,6 +1407,12 @@
'javelin-dom',
'phuix-button-view',
),
+ '69837bed' => array(
+ 'javelin-behavior',
+ 'javelin-stratcom',
+ 'javelin-dom',
+ 'javelin-history',
+ ),
'69adf288' => array(
'javelin-install',
),
diff --git a/webroot/rsrc/css/layout/phabricator-source-code-view.css b/webroot/rsrc/css/layout/phabricator-source-code-view.css
--- a/webroot/rsrc/css/layout/phabricator-source-code-view.css
+++ b/webroot/rsrc/css/layout/phabricator-source-code-view.css
@@ -52,10 +52,14 @@
text-decoration: none;
}
-.phabricator-source-highlight {
+.phabricator-source-highlight .phabricator-source-code {
background: {$paste.highlight};
}
+.phabricator-source-highlight .phabricator-source-line {
+ background: {$paste.border};
+}
+
.phabricator-source-code-summary {
padding-bottom: 8px;
}
diff --git a/webroot/rsrc/js/core/behavior-line-linker.js b/webroot/rsrc/js/core/behavior-line-linker.js
--- a/webroot/rsrc/js/core/behavior-line-linker.js
+++ b/webroot/rsrc/js/core/behavior-line-linker.js
@@ -19,24 +19,7 @@
// Ignore.
}
- function getRowNumber(tr) {
- // Starting from the left, find the rightmost "<th />" tag among all
- // "<th />" tags at the start of the row. Our goal here is to skip over
- // blame information in Diffusion. This could probably be significantly
- // more graceful.
- var th = null;
- for (var ii = 0; ii < tr.childNodes.length; ii++) {
- if (JX.DOM.isType(tr.childNodes[ii], 'th')) {
- th = tr.childNodes[ii];
- continue;
- }
- break;
- }
-
- if (!th) {
- return null;
- }
-
+ function getRowNumber(th) {
// If the "<th />" tag contains an "<a />" with "data-n" that we're using
// to prevent copy/paste of line numbers, use that.
if (th.firstChild) {
@@ -51,7 +34,7 @@
JX.Stratcom.listen(
['click', 'mousedown'],
- ['phabricator-source', 'tag:tr', 'tag:th', 'tag:a'],
+ ['phabricator-source', 'tag:th', 'tag:a'],
function(e) {
if (!e.isNormalMouseEvent()) {
return;
@@ -62,13 +45,13 @@
// table. The row's immediate ancestor table needs to be the table with
// the "phabricator-source" sigil.
- var row = e.getNode('tag:tr');
+ var cell = e.getNode('tag:th');
var table = e.getNode('phabricator-source');
- if (JX.DOM.findAbove(row, 'table') !== table) {
+ if (JX.DOM.findAbove(cell, 'table') !== table) {
return;
}
- var number = getRowNumber(row);
+ var number = getRowNumber(cell);
if (!number) {
return;
}
@@ -81,7 +64,7 @@
return;
}
- origin = row;
+ origin = cell;
target = origin;
root = table;
@@ -95,7 +78,7 @@
if (e.getNode('phabricator-source') !== root) {
return;
}
- target = e.getNode('tag:tr');
+ target = e.getNode('tag:th');
var min;
var max;
@@ -130,6 +113,9 @@
highlighted = [];
// Highlight the newly selected rows.
+ min = JX.DOM.findAbove(min, 'tr');
+ max = JX.DOM.findAbove(max, 'tr');
+
var cursor = min;
while (true) {
JX.DOM.alterClass(cursor, 'phabricator-source-highlight', true);

File Metadata

Mime Type
text/plain
Expires
Sat, Nov 23, 3:33 AM (17 h, 52 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6777024
Default Alt Text
D19348.id46286.diff (5 KB)

Event Timeline