<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[206101] trunk/Source/WebInspectorUI</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/206101">206101</a></dd>
<dt>Author</dt> <dd>mattbaker@apple.com</dd>
<dt>Date</dt> <dd>2016-09-19 10:53:37 -0700 (Mon, 19 Sep 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>Web Inspector: Make it easier to create a view from an existing DOM element
https://bugs.webkit.org/show_bug.cgi?id=162165
<rdar://problem/28365848>
Reviewed by Timothy Hatcher.
* UserInterface/Base/Main.js:
(WebInspector.contentLoaded):
Pass id string for views created from existing DOM elements.
* UserInterface/Views/View.js:
(WebInspector.View):
Change `element` to `elementOrIdentifier`. If the value is a string,
treat it as an element identifier. If the identifier is invalid, create
a default element.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebInspectorUIChangeLog">trunk/Source/WebInspectorUI/ChangeLog</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceBaseMainjs">trunk/Source/WebInspectorUI/UserInterface/Base/Main.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceViewsViewjs">trunk/Source/WebInspectorUI/UserInterface/Views/View.js</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebInspectorUIChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/ChangeLog (206100 => 206101)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/ChangeLog        2016-09-19 17:36:58 UTC (rev 206100)
+++ trunk/Source/WebInspectorUI/ChangeLog        2016-09-19 17:53:37 UTC (rev 206101)
</span><span class="lines">@@ -1,3 +1,21 @@
</span><ins>+2016-09-19 Matt Baker <mattbaker@apple.com>
+
+ Web Inspector: Make it easier to create a view from an existing DOM element
+ https://bugs.webkit.org/show_bug.cgi?id=162165
+ <rdar://problem/28365848>
+
+ Reviewed by Timothy Hatcher.
+
+ * UserInterface/Base/Main.js:
+ (WebInspector.contentLoaded):
+ Pass id string for views created from existing DOM elements.
+
+ * UserInterface/Views/View.js:
+ (WebInspector.View):
+ Change `element` to `elementOrIdentifier`. If the value is a string,
+ treat it as an element identifier. If the identifier is invalid, create
+ a default element.
+
</ins><span class="cx"> 2016-09-19 Joseph Pecoraro <pecoraro@apple.com>
</span><span class="cx">
</span><span class="cx"> Web Inspector: Color picker in Style sidebar stops working after 1st color change
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceBaseMainjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Base/Main.js (206100 => 206101)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Base/Main.js        2016-09-19 17:36:58 UTC (rev 206100)
+++ trunk/Source/WebInspectorUI/UserInterface/Base/Main.js        2016-09-19 17:53:37 UTC (rev 206101)
</span><span class="lines">@@ -227,11 +227,11 @@
</span><span class="cx"> document.body.classList.add(this.debuggableType);
</span><span class="cx">
</span><span class="cx"> // Create the user interface elements.
</span><del>- this.toolbar = new WebInspector.Toolbar(document.getElementById("toolbar"), null, true);
</del><ins>+ this.toolbar = new WebInspector.Toolbar("toolbar", null, true);
</ins><span class="cx"> this.toolbar.displayMode = WebInspector.Toolbar.DisplayMode.IconOnly;
</span><span class="cx"> this.toolbar.sizeMode = WebInspector.Toolbar.SizeMode.Small;
</span><span class="cx">
</span><del>- this.tabBar = new WebInspector.TabBar(document.getElementById("tab-bar"));
</del><ins>+ this.tabBar = new WebInspector.TabBar("tab-bar");
</ins><span class="cx"> this.tabBar.addEventListener(WebInspector.TabBar.Event.NewTabItemClicked, this._newTabItemClicked, this);
</span><span class="cx"> this.tabBar.addEventListener(WebInspector.TabBar.Event.OpenDefaultTab, this._openDefaultTab, this);
</span><span class="cx">
</span><span class="lines">@@ -239,10 +239,10 @@
</span><span class="cx"> this._contentElement.setAttribute("role", "main");
</span><span class="cx"> this._contentElement.setAttribute("aria-label", WebInspector.UIString("Content"));
</span><span class="cx">
</span><del>- this.splitContentBrowser = new WebInspector.ContentBrowser(document.getElementById("split-content-browser"), this, true, true);
</del><ins>+ this.splitContentBrowser = new WebInspector.ContentBrowser("split-content-browser", this, true, true);
</ins><span class="cx"> this.splitContentBrowser.navigationBar.element.addEventListener("mousedown", this._consoleResizerMouseDown.bind(this));
</span><span class="cx">
</span><del>- this.quickConsole = new WebInspector.QuickConsole(document.getElementById("quick-console"));
</del><ins>+ this.quickConsole = new WebInspector.QuickConsole("quick-console");
</ins><span class="cx"> this.quickConsole.addEventListener(WebInspector.QuickConsole.Event.DidResize, this._quickConsoleDidResize, this);
</span><span class="cx">
</span><span class="cx"> this._consoleRepresentedObject = new WebInspector.LogObject;
</span><span class="lines">@@ -252,10 +252,10 @@
</span><span class="cx"> this.breakpointPopoverController = new WebInspector.BreakpointPopoverController;
</span><span class="cx">
</span><span class="cx"> // FIXME: The sidebars should be flipped in RTL languages.
</span><del>- this.navigationSidebar = new WebInspector.Sidebar(document.getElementById("navigation-sidebar"), WebInspector.Sidebar.Sides.Left);
</del><ins>+ this.navigationSidebar = new WebInspector.Sidebar("navigation-sidebar", WebInspector.Sidebar.Sides.Left);
</ins><span class="cx"> this.navigationSidebar.addEventListener(WebInspector.Sidebar.Event.WidthDidChange, this._sidebarWidthDidChange, this);
</span><span class="cx">
</span><del>- this.detailsSidebar = new WebInspector.Sidebar(document.getElementById("details-sidebar"), WebInspector.Sidebar.Sides.Right, null, null, WebInspector.UIString("Details"), true);
</del><ins>+ this.detailsSidebar = new WebInspector.Sidebar("details-sidebar", WebInspector.Sidebar.Sides.Right, null, null, WebInspector.UIString("Details"), true);
</ins><span class="cx"> this.detailsSidebar.addEventListener(WebInspector.Sidebar.Event.WidthDidChange, this._sidebarWidthDidChange, this);
</span><span class="cx">
</span><span class="cx"> this.searchKeyboardShortcut = new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl | WebInspector.KeyboardShortcut.Modifier.Shift, "F", this._focusSearchField.bind(this));
</span><span class="lines">@@ -276,7 +276,7 @@
</span><span class="cx"> this._showTabAtIndexKeyboardShortcuts = [1, 2, 3, 4, 5, 6, 7, 8, 9].map((i) => new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl | WebInspector.KeyboardShortcut.Modifier.Option, `${i}`, this._showTabAtIndex.bind(this, i)));
</span><span class="cx"> this._openNewTabKeyboardShortcut = new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl | WebInspector.KeyboardShortcut.Modifier.Option, "T", this.showNewTabTab.bind(this));
</span><span class="cx">
</span><del>- this.tabBrowser = new WebInspector.TabBrowser(document.getElementById("tab-browser"), this.tabBar, this.navigationSidebar, this.detailsSidebar);
</del><ins>+ this.tabBrowser = new WebInspector.TabBrowser("tab-browser", this.tabBar, this.navigationSidebar, this.detailsSidebar);
</ins><span class="cx"> this.tabBrowser.addEventListener(WebInspector.TabBrowser.Event.SelectedTabContentViewDidChange, this._tabBrowserSelectedTabContentViewDidChange, this);
</span><span class="cx">
</span><span class="cx"> this.tabBar.addEventListener(WebInspector.TabBar.Event.TabBarItemAdded, this._updateNewTabButtonState, this);
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceViewsViewjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Views/View.js (206100 => 206101)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Views/View.js        2016-09-19 17:36:58 UTC (rev 206100)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/View.js        2016-09-19 17:53:37 UTC (rev 206101)
</span><span class="lines">@@ -25,11 +25,18 @@
</span><span class="cx">
</span><span class="cx"> WebInspector.View = class View extends WebInspector.Object
</span><span class="cx"> {
</span><del>- constructor(element)
</del><ins>+ constructor(elementOrIdentifier)
</ins><span class="cx"> {
</span><span class="cx"> super();
</span><span class="cx">
</span><del>- this._element = element || document.createElement("div");
</del><ins>+ if (elementOrIdentifier instanceof HTMLElement)
+ this._element = elementOrIdentifier;
+ else if (typeof elementOrIdentifier === "string") {
+ this._element = document.getElementById(elementOrIdentifier);
+ console.assert(this._element, "Couldn't create view for unknown element " + elementOrIdentifier);
+ }
+
+ this._element = this._element || document.createElement("div");
</ins><span class="cx"> this._element.__view = this;
</span><span class="cx"> this._parentView = null;
</span><span class="cx"> this._subviews = [];
</span></span></pre>
</div>
</div>
</body>
</html>