Wyatt Allen 72b87fcb2a Added the diff cursor element
Adds gr-diff-cursor, which is a specialized cursor for navigating
through diff content. It tracks the diff line being targeted, and, in
side-by-side mode, it tracks the side of the diff being targeted.

Also includes special behavior that ships blank spaces and other
non-commentable content in diffs, as well as automatically switching
sides when appropriate.

Support for more than one diff.

Also updates the diff builders to emit some useful element classes.

Note that this only adds the diff cursor along with tests. This is
setting up the work to actually add the diff cursor to the diff views.

Bug: Issue 4033
Change-Id: I991fd514f56ddd19d43d8e1354ad0d4fc71930c4
2016-05-18 11:11:02 -07:00

164 lines
4.8 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="mock-diff-response">
<template></template>
<script>
(function() {
'use strict';
var RESPONSE = {
"meta_a": {
"name": "lorem-ipsum.txt",
"content_type": "text/plain",
"lines": 45,
},
"meta_b": {
"name": "lorem-ipsum.txt",
"content_type": "text/plain",
"lines": 48,
},
"intraline_status": "OK",
"change_type": "MODIFIED",
"diff_header": [
"diff --git a/lorem-ipsum.txt b/lorem-ipsum.txt",
"index b2adcf4..554ae49 100644",
"--- a/lorem-ipsum.txt",
"+++ b/lorem-ipsum.txt",
],
"content": [
{
"ab": [
"Lorem ipsum dolor sit amet, suspendisse inceptos vehicula, nulla phasellus.",
"Mattis lectus.",
"Sodales duis.",
"Orci a faucibus.",
]
},
{
"b": [
"Nullam neque, ligula ac, id blandit.",
"Sagittis tincidunt torquent, tempor nunc amet.",
"At rhoncus id.",
],
},
{
"ab": [
"Sem nascetur, erat ut, non in.",
"A donec, venenatis pellentesque dis.",
"Mauris mauris.",
"Quisque nisl duis, facilisis viverra.",
"Justo purus, semper eget et.",
],
},
{ "a": [
"Est amet, vestibulum pellentesque.",
"Erat ligula.",
"Justo eros.",
"Fringilla quisque.",
],
},
{
"ab": [
"Arcu eget, rhoncus amet cursus, ipsum elementum.",
"Eros suspendisse.",
],
},
{
"a": [
"Rhoncus tempor, ultricies aliquam ipsum.",
],
"b": [
"Rhoncus tempor, ultricies praesent ipsum.",
],
"edit_a": [
[
26,
7,
],
],
"edit_b": [
[
26,
8,
],
],
},
{
"ab": [
"Sollicitudin duis.",
"Blandit blandit, ante nisl fusce.",
"Felis ac at, tellus consectetuer.",
"Sociis ligula sapien, egestas leo.",
"Cum pulvinar, sed mauris, cursus neque velit.",
"Augue porta lobortis.",
"Nibh lorem, amet fermentum turpis, vel pulvinar diam.",
"Id quam ipsum, id urna et, massa suspendisse.",
"Ac nec, nibh praesent.",
"Rutrum vestibulum.",
"Est tellus, bibendum habitasse.",
"Justo facilisis, vel nulla.",
"Donec eu, vulputate neque aliquam, nulla dui.",
"Risus adipiscing in.",
"Lacus arcu arcu.",
"Urna velit.",
"Urna a dolor.",
"Lectus magna augue, convallis mattis tortor, sed tellus consequat.",
"Etiam dui, blandit wisi.",
"Mi nec.",
"Vitae eget vestibulum.",
"Ullamcorper nunc ante, nec imperdiet felis, consectetur in.",
"Ac eget.",
"Vel fringilla, interdum pellentesque placerat, proin ante.",
],
},
{
"b": [
"Eu congue risus.",
"Enim ac, quis elementum.",
"Non et elit.",
"Etiam aliquam, diam vel nunc.",
],
},
{
"ab": [
"Nec at.",
"Arcu mauris, venenatis lacus fermentum, praesent duis.",
"Pellentesque amet et, tellus duis.",
"Ipsum arcu vitae, justo elit, sed libero tellus.",
"Metus rutrum euismod, vivamus sodales, vel arcu nisl.",
],
},
],
};
Polymer({
is: 'mock-diff-response',
properties: {
diffResponse: {
type: Object,
value: function() {
return RESPONSE;
},
},
},
});
})();
</script>
</dom-module>