From 6a0aa2cf499bbd2a8a6d957732f2be47bfdcb750 Mon Sep 17 00:00:00 2001 From: Fabian Lange Date: Mon, 18 Aug 2014 21:56:15 +0200 Subject: [PATCH 1/2] Set transformOrigin for text layer in css. transformOrigin is set to 0% 0% in all cases. This adds extra memory impact into the dom tree. It also involves the CustomStyles workaround to determine the correct css rule for the browser. By setting all vendor and standard variants in css, the rule is applied without the dom memory overhead and without the minor computation overhead to set the value. --- web/text_layer_builder.js | 1 - web/viewer.css | 9 +++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/web/text_layer_builder.js b/web/text_layer_builder.js index 04f166e69..666ebc97b 100644 --- a/web/text_layer_builder.js +++ b/web/text_layer_builder.js @@ -91,7 +91,6 @@ var TextLayerBuilder = (function TextLayerBuilderClosure() { transform = 'rotate(' + rotation + 'deg) ' + transform; } CustomStyle.setProp('transform' , textDiv, transform); - CustomStyle.setProp('transformOrigin' , textDiv, '0% 0%'); } } diff --git a/web/viewer.css b/web/viewer.css index c7dce035d..6b2f58b0b 100644 --- a/web/viewer.css +++ b/web/viewer.css @@ -1027,7 +1027,7 @@ html[dir='rtl'] .verticalToolbarSeparator { } .horizontalToolbarSeparator { - display: block; + display: block; margin: 0 0 4px 0; height: 1px; width: 100%; @@ -1315,6 +1315,11 @@ canvas { position: absolute; white-space: pre; cursor: text; + -webkit-transform-origin: 0% 0%; + -moz-transform-origin: 0% 0%; + -o-transform-origin: 0% 0%; + -ms-transform-origin: 0% 0%; + transform-origin: 0% 0%; } .textLayer .highlight { @@ -1489,7 +1494,7 @@ canvas { } .dialog .separator { - display: block; + display: block; margin: 4px 0 4px 0; height: 1px; width: 100%; From 1da38ec91e08a606abca77574b30fa6e5908a6f8 Mon Sep 17 00:00:00 2001 From: Fabian Lange Date: Tue, 19 Aug 2014 22:47:39 +0200 Subject: [PATCH 2/2] no need to set textlayer properties which are overwritten in individual styles. --- web/viewer.css | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/web/viewer.css b/web/viewer.css index 6b2f58b0b..3d05518e4 100644 --- a/web/viewer.css +++ b/web/viewer.css @@ -1305,8 +1305,6 @@ canvas { top: 0; right: 0; bottom: 0; - color: #000; - font-family: sans-serif; overflow: hidden; } @@ -1677,7 +1675,7 @@ html[dir='rtl'] #documentPropertiesOverlay .row > * { background: url(images/toolbarButton-menuArrows@2x.png) no-repeat; background-size: 7px 16px; } - + html[dir='ltr'] .toolbarButton#sidebarToggle::before { content: url(images/toolbarButton-sidebarToggle@2x.png); } @@ -1967,4 +1965,3 @@ html[dir='rtl'] #documentPropertiesOverlay .row > * { display: none; } } -