Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2014 Google Inc. All rights reserved. | 2 * Copyright (C) 2014 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 43 this._model.addEventListener(WebInspector.LayerTreeModel.Events.LayerPainted , this._onLayerPainted, this); | 43 this._model.addEventListener(WebInspector.LayerTreeModel.Events.LayerPainted , this._onLayerPainted, this); |
| 44 this._rotatingContainerElement = this.element.createChild("div", "fill rotat ing-container"); | 44 this._rotatingContainerElement = this.element.createChild("div", "fill rotat ing-container"); |
| 45 this._transformController = new WebInspector.TransformController(this.elemen t); | 45 this._transformController = new WebInspector.TransformController(this.elemen t); |
| 46 this._transformController.addEventListener(WebInspector.TransformController. Events.TransformChanged, this._onTransformChanged, this); | 46 this._transformController.addEventListener(WebInspector.TransformController. Events.TransformChanged, this._onTransformChanged, this); |
| 47 this.element.addEventListener("dblclick", this._onDoubleClick.bind(this), fa lse); | 47 this.element.addEventListener("dblclick", this._onDoubleClick.bind(this), fa lse); |
| 48 this.element.addEventListener("click", this._onClick.bind(this), false); | 48 this.element.addEventListener("click", this._onClick.bind(this), false); |
| 49 this.element.addEventListener("mouseout", this._onMouseMove.bind(this), fals e); | 49 this.element.addEventListener("mouseout", this._onMouseMove.bind(this), fals e); |
| 50 this.element.addEventListener("mousemove", this._onMouseMove.bind(this), fal se); | 50 this.element.addEventListener("mousemove", this._onMouseMove.bind(this), fal se); |
| 51 this.element.addEventListener("contextmenu", this._onContextMenu.bind(this), false); | 51 this.element.addEventListener("contextmenu", this._onContextMenu.bind(this), false); |
| 52 this._elementsByLayerId = {}; | 52 this._elementsByLayerId = {}; |
| 53 this._scrollRectElementsByLayerId = {} | |
|
caseq
2014/03/11 11:14:38
unused?
malch
2014/03/11 11:49:08
Done.
| |
| 53 this._scaleAdjustmentStylesheet = this.element.ownerDocument.head.createChil d("style"); | 54 this._scaleAdjustmentStylesheet = this.element.ownerDocument.head.createChil d("style"); |
| 54 this._scaleAdjustmentStylesheet.disabled = true; | 55 this._scaleAdjustmentStylesheet.disabled = true; |
| 55 this._lastOutlinedElement = {}; | 56 this._lastOutlinedElement = {}; |
| 56 this._layerImage = document.createElement("img"); | 57 this._layerImage = document.createElement("img"); |
| 57 this._layerImage.style.width = "100%"; | 58 this._layerImage.style.width = "100%"; |
| 58 this._layerImage.style.height = "100%"; | 59 this._layerImage.style.height = "100%"; |
| 59 WebInspector.settings.showPaintRects.addChangeListener(this._update, this); | 60 WebInspector.settings.showPaintRects.addChangeListener(this._update, this); |
| 60 } | 61 } |
| 61 | 62 |
| 62 /** | 63 /** |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 75 LayerSelected: "LayerSelected", | 76 LayerSelected: "LayerSelected", |
| 76 LayerSnapshotRequested: "LayerSnapshotRequested" | 77 LayerSnapshotRequested: "LayerSnapshotRequested" |
| 77 } | 78 } |
| 78 | 79 |
| 79 WebInspector.Layers3DView.PaintRectColors = [ | 80 WebInspector.Layers3DView.PaintRectColors = [ |
| 80 WebInspector.Color.fromRGBA([0, 0x5F, 0, 0x3F]), | 81 WebInspector.Color.fromRGBA([0, 0x5F, 0, 0x3F]), |
| 81 WebInspector.Color.fromRGBA([0, 0xAF, 0, 0x3F]), | 82 WebInspector.Color.fromRGBA([0, 0xAF, 0, 0x3F]), |
| 82 WebInspector.Color.fromRGBA([0, 0xFF, 0, 0x3F]) | 83 WebInspector.Color.fromRGBA([0, 0xFF, 0, 0x3F]) |
| 83 ] | 84 ] |
| 84 | 85 |
| 86 /** | |
| 87 * @enum {string} | |
| 88 */ | |
| 89 WebInspector.Layers3DView.ScrollRectTitles = { | |
| 90 RepaintsOnScroll: WebInspector.UIString("repaints on scroll"), | |
| 91 TouchEventHandler: WebInspector.UIString("touch event listener"), | |
| 92 WheelEventHandler: WebInspector.UIString("mousewheel event listener") | |
| 93 } | |
| 94 | |
| 85 WebInspector.Layers3DView.prototype = { | 95 WebInspector.Layers3DView.prototype = { |
| 86 onResize: function() | 96 onResize: function() |
| 87 { | 97 { |
| 88 this._update(); | 98 this._update(); |
| 89 }, | 99 }, |
| 90 | 100 |
| 91 willHide: function() | 101 willHide: function() |
| 92 { | 102 { |
| 93 this._scaleAdjustmentStylesheet.disabled = true; | 103 this._scaleAdjustmentStylesheet.disabled = true; |
| 94 }, | 104 }, |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 146 { | 156 { |
| 147 var element = this._elementForLayer(layer); | 157 var element = this._elementForLayer(layer); |
| 148 this._layerImage.removeAttribute("src"); | 158 this._layerImage.removeAttribute("src"); |
| 149 if (imageURL) | 159 if (imageURL) |
| 150 this._layerImage.src = imageURL; | 160 this._layerImage.src = imageURL; |
| 151 element.appendChild(this._layerImage); | 161 element.appendChild(this._layerImage); |
| 152 }, | 162 }, |
| 153 | 163 |
| 154 _scaleToFit: function() | 164 _scaleToFit: function() |
| 155 { | 165 { |
| 156 var root = this._model.contentRoot(); | 166 // var root = this._model.root(); |
| 157 if (!root) | 167 // TODO: RENAME |
| 168 var contentRoot = this._model.contentRoot(); | |
|
caseq
2014/03/11 11:14:38
Do we really have to rename it here?
malch
2014/03/11 11:49:08
Done.
| |
| 169 if (!contentRoot) | |
| 158 return; | 170 return; |
| 159 | 171 |
| 160 const padding = 40; | 172 const padding = 40; |
| 161 var scaleX = this._clientWidth / (root.width() + 2 * padding); | 173 var scaleX = this._clientWidth / (contentRoot.width() + 2 * padding); |
| 162 var scaleY = this._clientHeight / (root.height() + 2 * padding); | 174 var scaleY = this._clientHeight / (contentRoot.height() + 2 * padding); |
| 163 var autoScale = Math.min(scaleX, scaleY); | 175 var autoScale = Math.min(scaleX, scaleY); |
| 164 | 176 |
| 165 this._scale = autoScale * this._transformController.scale(); | 177 this._scale = autoScale * this._transformController.scale(); |
| 166 this._paddingX = ((this._clientWidth / autoScale - root.width()) >> 1) * this._scale; | 178 this._paddingX = ((this._clientWidth / autoScale - contentRoot.width()) >> 1) * this._scale; |
| 167 this._paddingY = ((this._clientHeight / autoScale - root.height()) >> 1) * this._scale; | 179 this._paddingY = ((this._clientHeight / autoScale - contentRoot.height() ) >> 1) * this._scale; |
| 168 const screenLayerSpacing = 20; | 180 const screenLayerSpacing = 20; |
| 169 this._layerSpacing = screenLayerSpacing + "px"; | 181 this._layerSpacing = screenLayerSpacing + "px"; |
| 170 const screenLayerThickness = 4; | 182 const screenLayerThickness = 4; |
| 171 var layerThickness = screenLayerThickness + "px"; | 183 var layerThickness = screenLayerThickness + "px"; |
| 172 | 184 |
| 173 var stylesheetContent = ".layer-container .side-wall { height: " + layer Thickness + "; width: " + layerThickness + "; } " + | 185 var stylesheetContent = ".layer-container .side-wall { height: " + layer Thickness + "; width: " + layerThickness + "; } " + |
| 174 ".layer-container .back-wall { -webkit-transform: translateZ(-" + la yerThickness + "); } " + | 186 ".layer-container .back-wall { -webkit-transform: translateZ(-" + la yerThickness + "); } " + |
| 175 ".layer-container { -webkit-transform: translateZ(" + this._layerSpa cing + "); }"; | 187 ".layer-container { -webkit-transform: translateZ(" + this._layerSpa cing + "); }"; |
| 176 // Workaround for double style recalculation upon assignment to style sh eet's text content. | 188 // Workaround for double style recalculation upon assignment to style sh eet's text content. |
| 177 var stylesheetTextNode = this._scaleAdjustmentStylesheet.firstChild; | 189 var stylesheetTextNode = this._scaleAdjustmentStylesheet.firstChild; |
| 178 if (!stylesheetTextNode || stylesheetTextNode.nodeType !== Node.TEXT_NOD E || stylesheetTextNode.nextSibling) | 190 if (!stylesheetTextNode || stylesheetTextNode.nodeType !== Node.TEXT_NOD E || stylesheetTextNode.nextSibling) |
| 179 this._scaleAdjustmentStylesheet.textContent = stylesheetContent; | 191 this._scaleAdjustmentStylesheet.textContent = stylesheetContent; |
| 180 else | 192 else |
| 181 stylesheetTextNode.nodeValue = stylesheetContent; | 193 stylesheetTextNode.nodeValue = stylesheetContent; |
| 182 | 194 |
| 183 var style = this._elementForLayer(root).style; | 195 var style = this._elementForLayer(contentRoot).style; |
| 184 style.left = Math.round(this._paddingX) + "px"; | 196 style.left = Math.round(this._paddingX) + "px"; |
| 185 style.top = Math.round(this._paddingY) + "px"; | 197 style.top = Math.round(this._paddingY) + "px"; |
| 186 style.webkitTransformOrigin = ""; | 198 style.webkitTransformOrigin = ""; |
| 187 }, | 199 }, |
| 188 | 200 |
| 189 /** | 201 /** |
| 190 * @param {!WebInspector.Event} event | 202 * @param {!WebInspector.Event} event |
| 191 */ | 203 */ |
| 192 _onTransformChanged: function(event) | 204 _onTransformChanged: function(event) |
| 193 { | 205 { |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 208 var style = this._rotatingContainerElement.style; | 220 var style = this._rotatingContainerElement.style; |
| 209 // Translate well to front so that no matter how we turn the plane, no p arts of it goes below parent. | 221 // Translate well to front so that no matter how we turn the plane, no p arts of it goes below parent. |
| 210 // This makes sure mouse events go to proper layers, not straight to the parent. | 222 // This makes sure mouse events go to proper layers, not straight to the parent. |
| 211 style.webkitTransform = "translateZ(10000px)" + | 223 style.webkitTransform = "translateZ(10000px)" + |
| 212 " rotateX(" + this._transformController.rotateX() + "deg) rotateY(" + this._transformController.rotateY() + "deg)" + | 224 " rotateX(" + this._transformController.rotateX() + "deg) rotateY(" + this._transformController.rotateY() + "deg)" + |
| 213 " translateX(" + offsetX + "px) translateY(" + offsetY + "px)"; | 225 " translateX(" + offsetX + "px) translateY(" + offsetY + "px)"; |
| 214 // Compute where the center of shitfted and scaled root layer would be a nd use is as origin for rotation. | 226 // Compute where the center of shitfted and scaled root layer would be a nd use is as origin for rotation. |
| 215 style.webkitTransformOrigin = Math.round(this._paddingX + offsetX + root .width() * this._scale / 2) + "px " + Math.round(this._paddingY + offsetY + root .height() * this._scale / 2) + "px"; | 227 style.webkitTransformOrigin = Math.round(this._paddingX + offsetX + root .width() * this._scale / 2) + "px " + Math.round(this._paddingY + offsetY + root .height() * this._scale / 2) + "px"; |
| 216 }, | 228 }, |
| 217 | 229 |
| 230 /** | |
| 231 * @param {!Element} element | |
| 232 */ | |
| 233 _removeElement: function(element) | |
|
caseq
2014/03/11 11:14:38
looks like you can define it within the only remai
malch
2014/03/11 11:49:08
Done.
| |
| 234 { | |
| 235 element.remove() | |
| 236 }, | |
| 237 | |
| 238 /** | |
| 239 * @param {!WebInspector.Layer} layer | |
| 240 * @param {!LayerTreeAgent.ScrollRect} scrollRect | |
| 241 * @return {!Element} | |
| 242 */ | |
| 243 _createScrollRectElement: function(layer, scrollRect) | |
| 244 { | |
| 245 var element = document.createElement("div"); | |
| 246 var style = element.style; | |
|
caseq
2014/03/11 11:14:38
unused?
malch
2014/03/11 11:49:08
Done.
| |
| 247 var parentLayerId = layer.id(); | |
|
caseq
2014/03/11 11:14:38
inline
malch
2014/03/11 11:49:08
Done.
| |
| 248 var parentLayerElement = this._elementsByLayerId[parentLayerId]; | |
| 249 element.className = "scroll-rect"; | |
| 250 element.title = WebInspector.Layers3DView.ScrollRectTitles[scrollRect.ty pe]; | |
| 251 parentLayerElement.appendChild(element); | |
| 252 return element; | |
| 253 }, | |
| 254 | |
| 255 /** | |
| 256 * @param {!Array.<!Element>} elements | |
| 257 * @param {!LayerTreeAgent.ScrollRect} scrollRect | |
| 258 * @param {!number} index | |
| 259 */ | |
| 260 _updateScrollRectElement: function(elements, scrollRect, index) | |
| 261 { | |
| 262 var element = elements[index]; | |
| 263 var style = element.style; | |
| 264 style.width = Math.round(scrollRect.rect.width * this._scale) + "px"; | |
| 265 style.height = Math.round(scrollRect.rect.height * this._scale) + "px"; | |
| 266 style.left = Math.round(scrollRect.rect.x * this._scale) + "px"; | |
| 267 style.top = Math.round(scrollRect.rect.y * this._scale) + "px"; | |
| 268 }, | |
| 269 | |
| 270 /** | |
| 271 * @param {!WebInspector.Layer} layer | |
| 272 */ | |
| 273 _updateScrollRectsForLayer: function(layer) | |
| 274 { | |
| 275 var newScrollRects = layer.scrollRects(), | |
| 276 layerDetails = this._elementsByLayerId[layer.id()].__layerDetails; | |
| 277 if (newScrollRects != layerDetails.scrollRects) { | |
|
caseq
2014/03/11 11:14:38
We use !==
malch
2014/03/11 11:49:08
Done.
| |
| 278 layerDetails.scrollRectElements.forEach(this._removeElement); | |
| 279 layerDetails.scrollRects = newScrollRects; | |
| 280 layerDetails.scrollRectElements = layerDetails.scrollRects.map(this. _createScrollRectElement.bind(this, layer)); | |
| 281 } | |
| 282 layerDetails.scrollRects.forEach(this._updateScrollRectElement.bind(this , layerDetails.scrollRectElements)); | |
| 283 }, | |
| 284 | |
| 218 _update: function() | 285 _update: function() |
| 219 { | 286 { |
| 220 if (!this.isShowing()) { | 287 if (!this.isShowing()) { |
| 221 this._needsUpdate = true; | 288 this._needsUpdate = true; |
| 222 return; | 289 return; |
| 223 } | 290 } |
| 224 if (!this._model.contentRoot()) { | 291 if (!this._model.contentRoot()) { |
| 225 this._emptyView.show(this.element); | 292 this._emptyView.show(this.element); |
| 226 this._rotatingContainerElement.removeChildren(); | 293 this._rotatingContainerElement.removeChildren(); |
| 227 return; | 294 return; |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 238 this._clientWidth = this.element.clientWidth; | 305 this._clientWidth = this.element.clientWidth; |
| 239 this._clientHeight = this.element.clientHeight; | 306 this._clientHeight = this.element.clientHeight; |
| 240 for (var layerId in this._elementsByLayerId) { | 307 for (var layerId in this._elementsByLayerId) { |
| 241 if (this._model.layerById(layerId)) | 308 if (this._model.layerById(layerId)) |
| 242 continue; | 309 continue; |
| 243 this._elementsByLayerId[layerId].remove(); | 310 this._elementsByLayerId[layerId].remove(); |
| 244 delete this._elementsByLayerId[layerId]; | 311 delete this._elementsByLayerId[layerId]; |
| 245 } | 312 } |
| 246 this._scaleToFit(); | 313 this._scaleToFit(); |
| 247 this._updateTransform(); | 314 this._updateTransform(); |
| 248 this._model.forEachLayer(updateLayer.bind(this), this._model.contentRoot ()); | 315 this._model.forEachLayer(updateLayer.bind(this)); |
| 316 this._model.forEachLayer(this._updateScrollRectsForLayer.bind(this)); | |
| 249 this._needsUpdate = false; | 317 this._needsUpdate = false; |
| 250 }, | 318 }, |
| 251 | 319 |
| 252 /** | 320 /** |
| 253 * @param {!WebInspector.Event} event | 321 * @param {!WebInspector.Event} event |
| 254 */ | 322 */ |
| 255 _onLayerPainted: function(event) | 323 _onLayerPainted: function(event) |
| 256 { | 324 { |
| 257 var layer = /** @type {!WebInspector.Layer} */ (event.data); | 325 var layer = /** @type {!WebInspector.Layer} */ (event.data); |
| 258 this._updatePaintRect(this._elementForLayer(layer)); | 326 if (layer.nodeId()) |
| 327 this._updatePaintRect(this._elementForLayer(layer)); | |
| 259 }, | 328 }, |
| 260 | 329 |
| 261 /** | 330 /** |
| 262 * @param {!WebInspector.Layer} layer | 331 * @param {!WebInspector.Layer} layer |
| 263 * @return {!Element} | 332 * @return {!Element} |
| 264 */ | 333 */ |
| 265 _elementForLayer: function(layer) | 334 _elementForLayer: function(layer) |
| 266 { | 335 { |
| 267 var element = this._elementsByLayerId[layer.id()]; | 336 var element = this._elementsByLayerId[layer.id()]; |
| 268 if (element) { | 337 if (element) { |
| 269 // We might have missed an update were a layer with given id was gon e and re-created, | 338 // We might have missed an update were a layer with given id was gon e and re-created, |
| 270 // so update reference to point to proper layer object. | 339 // so update reference to point to proper layer object. |
| 271 element.__layerDetails.layer = layer; | 340 element.__layerDetails.layer = layer; |
| 272 return element; | 341 return element; |
| 273 } | 342 } |
| 274 element = document.createElement("div"); | 343 element = document.createElement("div"); |
| 275 element.className = "layer-container"; | 344 if (layer.nodeId()) { |
| 276 ["fill back-wall", "side-wall top", "side-wall right", "side-wall bottom ", "side-wall left"].forEach(element.createChild.bind(element, "div")); | 345 element.className = "layer-container"; |
| 277 element.__layerDetails = new WebInspector.LayerDetails(layer, element.cr eateChild("div", "paint-rect")); | 346 ["fill back-wall", "side-wall top", "side-wall right", "side-wall bo ttom", "side-wall left"].forEach(element.createChild.bind(element, "div")); |
| 347 element.__layerDetails = new WebInspector.LayerDetails(layer, elemen t.createChild("div", "paint-rect")); | |
| 348 } else { | |
| 349 element.className = "layer-transparent"; | |
| 350 element.__layerDetails = new WebInspector.LayerDetails(layer); | |
| 351 } | |
| 278 this._elementsByLayerId[layer.id()] = element; | 352 this._elementsByLayerId[layer.id()] = element; |
| 279 return element; | 353 return element; |
| 280 }, | 354 }, |
| 281 | 355 |
| 282 /** | 356 /** |
| 283 * @param {!Element} element | 357 * @param {!Element} element |
| 284 */ | 358 */ |
| 285 _updateLayerElement: function(element) | 359 _updateLayerElement: function(element) |
| 286 { | 360 { |
| 287 var layer = element.__layerDetails.layer; | 361 var layer = element.__layerDetails.layer; |
| 288 var style = element.style; | 362 var style = element.style; |
| 289 var isContentRoot = layer === this._model.contentRoot(); | 363 |
| 290 var parentElement = isContentRoot ? this._rotatingContainerElement : thi s._elementForLayer(layer.parent()); | 364 var contentRoot = /** @type {!WebInspector.Layer} */ (this._model.conten tRoot()); |
| 365 var isContentRoot = layer === contentRoot; | |
| 366 var isRoot = layer === this._model.root(); | |
| 367 var parentElement = isContentRoot ? this._rotatingContainerElement : (is Root ? this._elementForLayer(contentRoot) : this._elementForLayer(layer.parent() )); | |
| 291 element.__layerDetails.depth = parentElement.__layerDetails ? parentElem ent.__layerDetails.depth + 1 : 0; | 368 element.__layerDetails.depth = parentElement.__layerDetails ? parentElem ent.__layerDetails.depth + 1 : 0; |
| 292 element.classList.toggle("invisible", layer.invisible()); | 369 element.classList.toggle("invisible", layer.invisible()); |
| 293 this._updateElementColor(element); | 370 if (layer.nodeId()) |
| 371 this._updateElementColor(element); | |
| 294 if (parentElement !== element.parentElement) | 372 if (parentElement !== element.parentElement) |
| 295 parentElement.appendChild(element); | 373 parentElement.appendChild(element); |
| 296 | 374 |
| 297 style.width = Math.round(layer.width() * this._scale) + "px"; | 375 style.width = Math.round(layer.width() * this._scale) + "px"; |
| 298 style.height = Math.round(layer.height() * this._scale) + "px"; | 376 style.height = Math.round(layer.height() * this._scale) + "px"; |
| 299 this._updatePaintRect(element); | 377 if (layer.nodeId()) |
| 300 if (isContentRoot) | 378 this._updatePaintRect(element); |
| 379 if (isContentRoot || isRoot) | |
| 301 return; | 380 return; |
| 302 style.left = Math.round(layer.offsetX() * this._scale) + "px"; | 381 style.left = Math.round(layer.offsetX() * this._scale) + "px"; |
| 303 style.top = Math.round(layer.offsetY() * this._scale) + "px"; | 382 style.top = Math.round(layer.offsetY() * this._scale) + "px"; |
| 304 var transform = layer.transform(); | 383 var transform = layer.transform(); |
| 305 if (transform) { | 384 if (transform) { |
| 306 transform = transform.slice(); | 385 transform = transform.slice(); |
| 307 // Adjust offset in the transform matrix according to scale. | 386 // Adjust offset in the transform matrix according to scale. |
| 308 for (var i = 12; i < 15; ++i) | 387 for (var i = 12; i < 15; ++i) |
| 309 transform[i] *= this._scale; | 388 transform[i] *= this._scale; |
| 310 // Avoid exponential notation in CSS. | 389 // Avoid exponential notation in CSS. |
| 311 style.webkitTransform = "matrix3d(" + transform.map(toFixed5).join(" ,") + ") translateZ(" + this._layerSpacing + ")"; | 390 style.webkitTransform = "matrix3d(" + transform.map(toFixed5).join(" ,") + ") translateZ(" + this._layerSpacing + ")"; |
| 312 var anchor = layer.anchorPoint(); | 391 var anchor = layer.anchorPoint(); |
| 313 style.webkitTransformOrigin = Math.round(anchor[0] * 100) + "% " + M ath.round(anchor[1] * 100) + "% " + anchor[2]; | 392 style.webkitTransformOrigin = Math.round(anchor[0] * 100) + "% " + M ath.round(anchor[1] * 100) + "% " + anchor[2]; |
| 314 } else { | 393 } else { |
| 315 style.webkitTransform = ""; | 394 style.webkitTransform = ""; |
| 316 style.webkitTransformOrigin = ""; | 395 style.webkitTransformOrigin = ""; |
| 317 } | 396 } |
| 318 | 397 |
| 319 function toFixed5(x) | 398 function toFixed5(x) |
| 320 { | 399 { |
| 321 return x.toFixed(5); | 400 return x.toFixed(5); |
| 322 } | 401 } |
| 323 }, | 402 }, |
| 324 | 403 |
| 404 /** | |
| 405 * @param {!Element} element | |
| 406 */ | |
| 325 _updatePaintRect: function(element) | 407 _updatePaintRect: function(element) |
| 326 { | 408 { |
| 327 var details = element.__layerDetails; | 409 var details = element.__layerDetails; |
| 328 var paintRect = details.layer.lastPaintRect(); | 410 var paintRect = details.layer.lastPaintRect(); |
| 329 var paintRectElement = details.paintRectElement; | 411 var paintRectElement = details.paintRectElement; |
| 330 if (!paintRect || !WebInspector.settings.showPaintRects.get()) { | 412 if (!paintRect || !WebInspector.settings.showPaintRects.get()) { |
| 331 paintRectElement.classList.add("hidden"); | 413 paintRectElement.classList.add("hidden"); |
| 332 return; | 414 return; |
| 333 } | 415 } |
| 334 paintRectElement.classList.remove("hidden"); | 416 paintRectElement.classList.remove("hidden"); |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 419 this.dispatchEventToListeners(WebInspector.Layers3DView.Events.Layer SnapshotRequested, layer); | 501 this.dispatchEventToListeners(WebInspector.Layers3DView.Events.Layer SnapshotRequested, layer); |
| 420 event.stopPropagation(); | 502 event.stopPropagation(); |
| 421 }, | 503 }, |
| 422 | 504 |
| 423 __proto__: WebInspector.View.prototype | 505 __proto__: WebInspector.View.prototype |
| 424 } | 506 } |
| 425 | 507 |
| 426 /** | 508 /** |
| 427 * @constructor | 509 * @constructor |
| 428 * @param {!WebInspector.Layer} layer | 510 * @param {!WebInspector.Layer} layer |
| 429 * @param {!Element} paintRectElement | 511 * @param {!Element=} paintRectElement |
| 430 */ | 512 */ |
| 431 WebInspector.LayerDetails = function(layer, paintRectElement) | 513 WebInspector.LayerDetails = function(layer, paintRectElement) |
| 432 { | 514 { |
| 433 this.layer = layer; | 515 this.layer = layer; |
| 434 this.depth = 0; | 516 this.depth = 0; |
| 435 this.paintRectElement = paintRectElement; | 517 if (paintRectElement) |
|
caseq
2014/03/11 11:14:38
I think you can omit this check.
malch
2014/03/11 11:49:08
Done.
| |
| 518 this.paintRectElement = paintRectElement; | |
| 436 this.paintCount = 0; | 519 this.paintCount = 0; |
| 520 this.scrollRects = []; | |
| 521 this.scrollRectElements = []; | |
| 437 } | 522 } |
| OLD | NEW |