Skip to content

Commit 6a036f3

Browse files
committed
Move Macro image height/width to CSS
Summary: This makes macros and memes grow to 100% of their container //at most//, instead of showing a scrollbar. This is useful for overly large macros, smaller spaces like Feed and Conpherences, and Inline Comments. Fixes T7528 Test Plan: Tested a very large macro, a very large meme, and a very very tiny macro. It looks like memes get cached though, unsure if we should clean them up or just leave them Reviewers: btrahan, epriestley Reviewed By: epriestley Subscribers: Korvin, epriestley Maniphest Tasks: T7528 Differential Revision: https://secure.phabricator.com/D12045
1 parent 7d7deaf commit 6a036f3

File tree

5 files changed

+26
-26
lines changed

5 files changed

+26
-26
lines changed

resources/celerity/map.php

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*/
88
return array(
99
'names' => array(
10-
'core.pkg.css' => '856b962f',
10+
'core.pkg.css' => 'efdeeb14',
1111
'core.pkg.js' => '5f50c01b',
1212
'darkconsole.pkg.js' => '8ab24e01',
1313
'differential.pkg.css' => '1940be3f',
@@ -105,7 +105,7 @@
105105
'rsrc/css/application/tokens/tokens.css' => '3d0f239e',
106106
'rsrc/css/application/uiexample/example.css' => '528b19de',
107107
'rsrc/css/core/core.css' => '86bfbe8c',
108-
'rsrc/css/core/remarkup.css' => '2dbff225',
108+
'rsrc/css/core/remarkup.css' => 'bc65f3cc',
109109
'rsrc/css/core/syntax.css' => '56c1ba38',
110110
'rsrc/css/core/z-index.css' => '2db67397',
111111
'rsrc/css/diviner/diviner-shared.css' => '38813222',
@@ -353,7 +353,7 @@
353353
'rsrc/js/application/auth/behavior-persona-login.js' => '9414ff18',
354354
'rsrc/js/application/config/behavior-reorder-fields.js' => '14a827de',
355355
'rsrc/js/application/conpherence/ConpherenceThreadManager.js' => '0324970d',
356-
'rsrc/js/application/conpherence/behavior-durable-column.js' => '64fc1053',
356+
'rsrc/js/application/conpherence/behavior-durable-column.js' => '44100dc7',
357357
'rsrc/js/application/conpherence/behavior-menu.js' => 'c4151295',
358358
'rsrc/js/application/conpherence/behavior-pontificate.js' => '21ba5861',
359359
'rsrc/js/application/conpherence/behavior-quicksand-blacklist.js' => '7927a7d3',
@@ -585,7 +585,7 @@
585585
'javelin-behavior-diffusion-locate-file' => '6d3e1947',
586586
'javelin-behavior-diffusion-pull-lastmodified' => '2b228192',
587587
'javelin-behavior-doorkeeper-tag' => 'e5822781',
588-
'javelin-behavior-durable-column' => '64fc1053',
588+
'javelin-behavior-durable-column' => '44100dc7',
589589
'javelin-behavior-error-log' => '6882e80a',
590590
'javelin-behavior-fancy-datepicker' => 'c51ae228',
591591
'javelin-behavior-global-drag-and-drop' => '07f199d8',
@@ -739,7 +739,7 @@
739739
'phabricator-phtize' => 'd254d646',
740740
'phabricator-prefab' => '72da38cc',
741741
'phabricator-profile-css' => '1a20dcbf',
742-
'phabricator-remarkup-css' => '2dbff225',
742+
'phabricator-remarkup-css' => 'bc65f3cc',
743743
'phabricator-search-results-css' => '559cc554',
744744
'phabricator-shaped-request' => '7cbe244b',
745745
'phabricator-side-menu-view-css' => '7e8c6341',
@@ -1110,6 +1110,15 @@
11101110
'javelin-dom',
11111111
'javelin-request',
11121112
),
1113+
'44100dc7' => array(
1114+
'javelin-behavior',
1115+
'javelin-dom',
1116+
'javelin-stratcom',
1117+
'javelin-scrollbar',
1118+
'javelin-quicksand',
1119+
'phabricator-keyboard-shortcut',
1120+
'conpherence-thread-manager',
1121+
),
11131122
'44168bad' => array(
11141123
'javelin-behavior',
11151124
'javelin-dom',
@@ -1257,15 +1266,6 @@
12571266
'javelin-dom',
12581267
'javelin-fx',
12591268
),
1260-
'64fc1053' => array(
1261-
'javelin-behavior',
1262-
'javelin-dom',
1263-
'javelin-stratcom',
1264-
'javelin-scrollbar',
1265-
'javelin-quicksand',
1266-
'phabricator-keyboard-shortcut',
1267-
'conpherence-thread-manager',
1268-
),
12691269
'6882e80a' => array(
12701270
'javelin-dom',
12711271
),

src/applications/files/markup/PhabricatorEmbedFileRemarkupRule.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,8 @@ private function renderImageFile(
9696
case 'full':
9797
$attrs += array(
9898
'src' => $file->getBestURI(),
99+
'height' => $file->getImageHeight(),
100+
'width' => $file->getImageWidth(),
99101
);
100102
$image_class = 'phabricator-remarkup-embed-image-full';
101103
break;

src/applications/macro/markup/PhabricatorImageMacroRemarkupRule.php

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -113,17 +113,6 @@ public function didMarkupText() {
113113
$src_uri = PhabricatorEnv::getProductionURI($src_uri);
114114
}
115115

116-
$file_data = $file->getMetadata();
117-
$style = null;
118-
$height = idx($file_data, PhabricatorFile::METADATA_IMAGE_HEIGHT);
119-
$width = idx($file_data, PhabricatorFile::METADATA_IMAGE_WIDTH);
120-
if ($height && $width) {
121-
$style = sprintf(
122-
'height: %dpx; width: %dpx;',
123-
$height,
124-
$width);
125-
}
126-
127116
$id = null;
128117
$audio = idx($files, $macro->getAudioPHID());
129118
$should_play = ($audio && $macro->getAudioBehavior() !=
@@ -154,7 +143,9 @@ public function didMarkupText() {
154143
'src' => $src_uri,
155144
'alt' => $spec['original'],
156145
'title' => $spec['original'],
157-
'style' => $style,
146+
'height' => $file->getImageHeight(),
147+
'width' => $file->getImageWidth(),
148+
'class' => 'phabricator-remarkup-macro',
158149
));
159150

160151
$engine->overwriteStoredText($spec['token'], $result);

src/applications/macro/markup/PhabricatorMemeRemarkupRule.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ public function markupMeme($matches) {
5555
array(
5656
'src' => $uri,
5757
'alt' => $alt_text,
58+
'class' => 'phabricator-remarkup-macro',
5859
));
5960
}
6061

webroot/rsrc/css/core/remarkup.css

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,7 @@
300300
}
301301

302302
.phabricator-remarkup-embed-image-full img {
303+
height: auto;
303304
max-width: 100%;
304305
}
305306

@@ -488,6 +489,11 @@ var.remarkup-assist-textarea {
488489
max-width: 95%;
489490
}
490491

492+
.phabricator-remarkup-macro {
493+
height: auto;
494+
max-width: 100%;
495+
}
496+
491497
.remarkup-nav-sequence-arrow {
492498
color: {$lightgreytext};
493499
}

0 commit comments

Comments
 (0)