function updateLayer(layer)
        {
            if (!layer.drawsContent() && !showInternalLayers)
                return;
            if (seenLayers.get(layer))
                console.assert(false, "Duplicate layer: " + layer.id());
            seenLayers.set(layer, true);
            var node = layer[WebInspector.LayerTreeElement._symbol];
            var parentLayer = layer.parent();
            // Skip till nearest visible ancestor.
            while (parentLayer && parentLayer !== root && !parentLayer.drawsContent() && !showInternalLayers)
                parentLayer = parentLayer.parent();
            var parent = layer === root ? this._treeOutline : parentLayer[WebInspector.LayerTreeElement._symbol];
            if (!parent) {
                console.assert(false, "Parent is not in the tree");
                return;
            }
            if (!node) {
                node = new WebInspector.LayerTreeElement(this, layer);
                parent.appendChild(node);
                // Expand all new non-content layers to expose content layers better.
                if (!layer.drawsContent())
                    node.expand();
            } else {
                if (node.parent !== parent) {
                    var oldSelection = this._treeOutline.selectedTreeElement;
                    node.parent.removeChild(node);
                    parent.appendChild(node);
                    if (oldSelection !== this._treeOutline.selectedTreeElement)
                        oldSelection.select();
                }
                node._update();
            }
        }
@param {!WebInspector.Layer} layer
@this {WebInspector.LayerTreeOutline}