At the time that syntax highlighting DOM was introduced, the offsets of selection ranges had been broken. In change [1] Kasper fixed this for GR-DIFF-HIGHLIGHT with selection normalization functions. However, selections for copying code as implemented in GR-DIFF-SELECTION were still un-normalized. With this change, the normalization functionality introduced in [1] is moved to a JS library so that it can be used by both components. Tests are updated. [1] I26c61ca706575ea5df6e3b7b18a27225834396e8 Change-Id: I35ab0f71a46b3fc1d7356a314a0cae856f2ef28e
		
			
				
	
	
		
			49 lines
		
	
	
		
			2.1 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			49 lines
		
	
	
		
			2.1 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
<!--
 | 
						|
Copyright (C) 2016 The Android Open Source Project
 | 
						|
 | 
						|
Licensed under the Apache License, Version 2.0 (the "License");
 | 
						|
you may not use this file except in compliance with the License.
 | 
						|
You may obtain a copy of the License at
 | 
						|
 | 
						|
http://www.apache.org/licenses/LICENSE-2.0
 | 
						|
 | 
						|
Unless required by applicable law or agreed to in writing, software
 | 
						|
distributed under the License is distributed on an "AS IS" BASIS,
 | 
						|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 | 
						|
See the License for the specific language governing permissions and
 | 
						|
limitations under the License.
 | 
						|
-->
 | 
						|
<link rel="import" href="../../../bower_components/polymer/polymer.html">
 | 
						|
 | 
						|
<dom-module id="gr-diff-selection">
 | 
						|
  <template>
 | 
						|
    <style>
 | 
						|
      .contentWrapper ::content .content,
 | 
						|
      .contentWrapper ::content .contextControl {
 | 
						|
        -webkit-user-select: none;
 | 
						|
        -moz-user-select: none;
 | 
						|
        -ms-user-select: none;
 | 
						|
        user-select: none;
 | 
						|
      }
 | 
						|
 | 
						|
      :host-context(.selected-left:not(.selected-comment)) .contentWrapper ::content .side-by-side .left + .content .contentText,
 | 
						|
      :host-context(.selected-right:not(.selected-comment)) .contentWrapper ::content .side-by-side .right + .content .contentText,
 | 
						|
      :host-context(.selected-left:not(.selected-comment)) .contentWrapper ::content .unified .left.lineNum ~ .content:not(.both) .contentText,
 | 
						|
      :host-context(.selected-right:not(.selected-comment)) .contentWrapper ::content .unified .right.lineNum ~ .content .contentText,
 | 
						|
      :host-context(.selected-left.selected-comment) .contentWrapper ::content .side-by-side .left + .content .message,
 | 
						|
      :host-context(.selected-right.selected-comment) .contentWrapper ::content .side-by-side .right + .content .message,
 | 
						|
      :host-context(.selected-comment) .contentWrapper ::content .unified .message {
 | 
						|
        -webkit-user-select: text;
 | 
						|
        -moz-user-select: text;
 | 
						|
        -ms-user-select: text;
 | 
						|
        user-select: text;
 | 
						|
      }
 | 
						|
    </style>
 | 
						|
    <div class="contentWrapper">
 | 
						|
      <content></content>
 | 
						|
    </div>
 | 
						|
  </template>
 | 
						|
  <script src="../gr-diff-highlight/gr-range-normalizer.js"></script>
 | 
						|
  <script src="gr-diff-selection.js"></script>
 | 
						|
</dom-module>
 |