OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 WebInspector.ScreencastView._HttpRegex = /^https?:\/\/(.+)/; | 50 WebInspector.ScreencastView._HttpRegex = /^https?:\/\/(.+)/; |
51 | 51 |
52 WebInspector.ScreencastView.prototype = { | 52 WebInspector.ScreencastView.prototype = { |
53 initialize: function() | 53 initialize: function() |
54 { | 54 { |
55 this.element.classList.add("screencast"); | 55 this.element.classList.add("screencast"); |
56 | 56 |
57 this._createNavigationBar(); | 57 this._createNavigationBar(); |
58 | 58 |
59 this._viewportElement = this.element.createChild("div", "screencast-view
port hidden"); | 59 this._viewportElement = this.element.createChild("div", "screencast-view
port hidden"); |
60 this._glassPaneElement = this.element.createChild("div", "screencast-gla
sspane hidden"); | 60 this._canvasContainerElement = this._viewportElement.createChild("div",
"screencast-canvas-container"); |
| 61 this._glassPaneElement = this._canvasContainerElement.createChild("div",
"screencast-glasspane hidden"); |
61 | 62 |
62 this._canvasElement = this._viewportElement.createChild("canvas"); | 63 this._canvasElement = this._canvasContainerElement.createChild("canvas")
; |
63 this._canvasElement.tabIndex = 1; | 64 this._canvasElement.tabIndex = 1; |
64 this._canvasElement.addEventListener("mousedown", this._handleMouseEvent
.bind(this), false); | 65 this._canvasElement.addEventListener("mousedown", this._handleMouseEvent
.bind(this), false); |
65 this._canvasElement.addEventListener("mouseup", this._handleMouseEvent.b
ind(this), false); | 66 this._canvasElement.addEventListener("mouseup", this._handleMouseEvent.b
ind(this), false); |
66 this._canvasElement.addEventListener("mousemove", this._handleMouseEvent
.bind(this), false); | 67 this._canvasElement.addEventListener("mousemove", this._handleMouseEvent
.bind(this), false); |
67 this._canvasElement.addEventListener("mousewheel", this._handleMouseEven
t.bind(this), false); | 68 this._canvasElement.addEventListener("mousewheel", this._handleMouseEven
t.bind(this), false); |
68 this._canvasElement.addEventListener("click", this._handleMouseEvent.bin
d(this), false); | 69 this._canvasElement.addEventListener("click", this._handleMouseEvent.bin
d(this), false); |
69 this._canvasElement.addEventListener("contextmenu", this._handleContextM
enuEvent.bind(this), false); | 70 this._canvasElement.addEventListener("contextmenu", this._handleContextM
enuEvent.bind(this), false); |
70 this._canvasElement.addEventListener("keydown", this._handleKeyEvent.bin
d(this), false); | 71 this._canvasElement.addEventListener("keydown", this._handleKeyEvent.bin
d(this), false); |
71 this._canvasElement.addEventListener("keyup", this._handleKeyEvent.bind(
this), false); | 72 this._canvasElement.addEventListener("keyup", this._handleKeyEvent.bind(
this), false); |
72 this._canvasElement.addEventListener("keypress", this._handleKeyEvent.bi
nd(this), false); | 73 this._canvasElement.addEventListener("keypress", this._handleKeyEvent.bi
nd(this), false); |
73 | 74 |
74 this._titleElement = this._viewportElement.createChild("div", "screencas
t-element-title monospace hidden"); | 75 this._titleElement = this._canvasContainerElement.createChild("div", "sc
reencast-element-title monospace hidden"); |
75 this._tagNameElement = this._titleElement.createChild("span", "screencas
t-tag-name"); | 76 this._tagNameElement = this._titleElement.createChild("span", "screencas
t-tag-name"); |
76 this._nodeIdElement = this._titleElement.createChild("span", "screencast
-node-id"); | 77 this._nodeIdElement = this._titleElement.createChild("span", "screencast
-node-id"); |
77 this._classNameElement = this._titleElement.createChild("span", "screenc
ast-class-name"); | 78 this._classNameElement = this._titleElement.createChild("span", "screenc
ast-class-name"); |
78 this._titleElement.appendChild(document.createTextNode(" ")); | 79 this._titleElement.appendChild(document.createTextNode(" ")); |
79 this._nodeWidthElement = this._titleElement.createChild("span"); | 80 this._nodeWidthElement = this._titleElement.createChild("span"); |
80 this._titleElement.createChild("span", "screencast-px").textContent = "p
x"; | 81 this._titleElement.createChild("span", "screencast-px").textContent = "p
x"; |
81 this._titleElement.appendChild(document.createTextNode(" \u00D7 ")); | 82 this._titleElement.appendChild(document.createTextNode(" \u00D7 ")); |
82 this._nodeHeightElement = this._titleElement.createChild("span"); | 83 this._nodeHeightElement = this._titleElement.createChild("span"); |
83 this._titleElement.createChild("span", "screencast-px").textContent = "p
x"; | 84 this._titleElement.createChild("span", "screencast-px").textContent = "p
x"; |
84 | 85 |
(...skipping 763 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
848 | 849 |
849 pctx.fillStyle = "rgb(225, 225, 225)"; | 850 pctx.fillStyle = "rgb(225, 225, 225)"; |
850 pctx.fillRect(0, 0, size, size); | 851 pctx.fillRect(0, 0, size, size); |
851 pctx.fillRect(size, size, size, size); | 852 pctx.fillRect(size, size, size, size); |
852 return context.createPattern(pattern, "repeat"); | 853 return context.createPattern(pattern, "repeat"); |
853 }, | 854 }, |
854 | 855 |
855 _createNavigationBar: function() | 856 _createNavigationBar: function() |
856 { | 857 { |
857 this._navigationBar = this.element.createChild("div", "toolbar-backgroun
d screencast-navigation"); | 858 this._navigationBar = this.element.createChild("div", "toolbar-backgroun
d screencast-navigation"); |
| 859 if (WebInspector.queryParam("hideNavigation")) |
| 860 this._navigationBar.classList.add("hidden"); |
858 | 861 |
859 this._navigationBack = this._navigationBar.createChild("button", "back")
; | 862 this._navigationBack = this._navigationBar.createChild("button", "back")
; |
860 this._navigationBack.disabled = true; | 863 this._navigationBack.disabled = true; |
861 this._navigationBack.addEventListener("click", this._navigateToHistoryEn
try.bind(this, -1), false); | 864 this._navigationBack.addEventListener("click", this._navigateToHistoryEn
try.bind(this, -1), false); |
862 | 865 |
863 this._navigationForward = this._navigationBar.createChild("button", "for
ward"); | 866 this._navigationForward = this._navigationBar.createChild("button", "for
ward"); |
864 this._navigationForward.disabled = true; | 867 this._navigationForward.disabled = true; |
865 this._navigationForward.addEventListener("click", this._navigateToHistor
yEntry.bind(this, 1), false); | 868 this._navigationForward.addEventListener("click", this._navigateToHistor
yEntry.bind(this, 1), false); |
866 | 869 |
867 this._navigationReload = this._navigationBar.createChild("button", "relo
ad"); | 870 this._navigationReload = this._navigationBar.createChild("button", "relo
ad"); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
917 this._historyIndex = currentIndex; | 920 this._historyIndex = currentIndex; |
918 this._historyEntries = entries; | 921 this._historyEntries = entries; |
919 | 922 |
920 this._navigationBack.disabled = currentIndex == 0; | 923 this._navigationBack.disabled = currentIndex == 0; |
921 this._navigationForward.disabled = currentIndex == (entries.length - 1); | 924 this._navigationForward.disabled = currentIndex == (entries.length - 1); |
922 | 925 |
923 var url = entries[currentIndex].url; | 926 var url = entries[currentIndex].url; |
924 var match = url.match(WebInspector.ScreencastView._HttpRegex); | 927 var match = url.match(WebInspector.ScreencastView._HttpRegex); |
925 if (match) | 928 if (match) |
926 url = match[1]; | 929 url = match[1]; |
| 930 InspectorFrontendHost.inspectedURLChanged(url); |
927 this._navigationUrl.value = url; | 931 this._navigationUrl.value = url; |
928 }, | 932 }, |
929 | 933 |
930 _focusNavigationBar: function() | 934 _focusNavigationBar: function() |
931 { | 935 { |
932 this._navigationUrl.focus(); | 936 this._navigationUrl.focus(); |
933 this._navigationUrl.select(); | 937 this._navigationUrl.select(); |
934 return true; | 938 return true; |
935 }, | 939 }, |
936 | 940 |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1085 * @return {!Element} | 1089 * @return {!Element} |
1086 */ | 1090 */ |
1087 statusBarItem: function() | 1091 statusBarItem: function() |
1088 { | 1092 { |
1089 if (this._initialized) | 1093 if (this._initialized) |
1090 return this._toggleScreencastButton.element; | 1094 return this._toggleScreencastButton.element; |
1091 this._statusBarPlaceholder = document.createElement("div"); | 1095 this._statusBarPlaceholder = document.createElement("div"); |
1092 return this._statusBarPlaceholder; | 1096 return this._statusBarPlaceholder; |
1093 } | 1097 } |
1094 }; | 1098 }; |
OLD | NEW |