<!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>[212913] 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/212913">212913</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2017-02-23 12:24:10 -0800 (Thu, 23 Feb 2017)</dd>
</dl>

<h3>Log Message</h3>
<pre>Web Inspector: RTL: DOM Tree spacing is wrong
https://bugs.webkit.org/show_bug.cgi?id=168744

Patch by Devin Rousso &lt;dcrousso+webkit@gmail.com&gt; on 2017-02-23
Reviewed by Brian Burg.

* UserInterface/Base/Utilities.js:
(Element.prototype.totalOffsetRight):

* UserInterface/Views/DOMTreeOutline.css:
(.tree-outline.dom):
(.tree-outline.dom ol):
(body[dir=ltr] .tree-outline.dom ol):
(body[dir=rtl] .tree-outline.dom ol):
(.tree-outline.dom li:matches(.hovered, .selected) + ol.children.expanded):
(body[dir=ltr] .tree-outline.dom li:matches(.hovered, .selected) + ol.children.expanded):
(body[dir=rtl] .tree-outline.dom li:matches(.hovered, .selected) + ol.children.expanded):
(.tree-outline.dom li.selected + ol.children.expanded):
(.tree-outline.dom li):
(body[dir=ltr] .tree-outline.dom li):
(body[dir=rtl] .tree-outline.dom li):
(.tree-outline.dom li.pseudo-class-enabled &gt; .selection-area::before):
(body[dir=rtl] .tree-outline.dom li.pseudo-class-enabled &gt; .selection-area::before):
(body[dir=ltr] .tree-outline.dom.single-node li):
(body[dir=rtl] .tree-outline.dom.single-node li):
(.tree-outline.dom li.parent):
(body[dir=ltr] .tree-outline.dom li.parent):
(body[dir=rtl] .tree-outline.dom li.parent):
(body[dir=ltr] .tree-outline.dom li .html-tag.close):
(body[dir=rtl] .tree-outline.dom li .html-tag.close):
(.tree-outline.dom li.parent::before):
(body[dir=rtl] .tree-outline.dom li.parent::before):
(body[dir=ltr] .tree-outline.dom li.parent::before):
(.tree-outline.dom li.parent.shadow::after):
(body[dir=ltr] .tree-outline.dom li.parent.shadow::after):
(body[dir=rtl] .tree-outline.dom li.parent.shadow::after):
(.tree-outline.dom.single-node li): Deleted.
(.tree-outline.dom li .html-tag.close): Deleted.

* UserInterface/Views/TreeElement.js:
(WebInspector.TreeElement.prototype.isEventWithinDisclosureTriangle):
Calculate the position of the ::before triangle based on the layout direction.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebInspectorUIChangeLog">trunk/Source/WebInspectorUI/ChangeLog</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceBaseUtilitiesjs">trunk/Source/WebInspectorUI/UserInterface/Base/Utilities.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceViewsDOMTreeOutlinecss">trunk/Source/WebInspectorUI/UserInterface/Views/DOMTreeOutline.css</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceViewsTreeElementjs">trunk/Source/WebInspectorUI/UserInterface/Views/TreeElement.js</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebInspectorUIChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/ChangeLog (212912 => 212913)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/ChangeLog        2017-02-23 20:12:23 UTC (rev 212912)
+++ trunk/Source/WebInspectorUI/ChangeLog        2017-02-23 20:24:10 UTC (rev 212913)
</span><span class="lines">@@ -1,5 +1,49 @@
</span><span class="cx"> 2017-02-23  Devin Rousso  &lt;dcrousso+webkit@gmail.com&gt;
</span><span class="cx"> 
</span><ins>+        Web Inspector: RTL: DOM Tree spacing is wrong
+        https://bugs.webkit.org/show_bug.cgi?id=168744
+
+        Reviewed by Brian Burg.
+
+        * UserInterface/Base/Utilities.js:
+        (Element.prototype.totalOffsetRight):
+
+        * UserInterface/Views/DOMTreeOutline.css:
+        (.tree-outline.dom):
+        (.tree-outline.dom ol):
+        (body[dir=ltr] .tree-outline.dom ol):
+        (body[dir=rtl] .tree-outline.dom ol):
+        (.tree-outline.dom li:matches(.hovered, .selected) + ol.children.expanded):
+        (body[dir=ltr] .tree-outline.dom li:matches(.hovered, .selected) + ol.children.expanded):
+        (body[dir=rtl] .tree-outline.dom li:matches(.hovered, .selected) + ol.children.expanded):
+        (.tree-outline.dom li.selected + ol.children.expanded):
+        (.tree-outline.dom li):
+        (body[dir=ltr] .tree-outline.dom li):
+        (body[dir=rtl] .tree-outline.dom li):
+        (.tree-outline.dom li.pseudo-class-enabled &gt; .selection-area::before):
+        (body[dir=rtl] .tree-outline.dom li.pseudo-class-enabled &gt; .selection-area::before):
+        (body[dir=ltr] .tree-outline.dom.single-node li):
+        (body[dir=rtl] .tree-outline.dom.single-node li):
+        (.tree-outline.dom li.parent):
+        (body[dir=ltr] .tree-outline.dom li.parent):
+        (body[dir=rtl] .tree-outline.dom li.parent):
+        (body[dir=ltr] .tree-outline.dom li .html-tag.close):
+        (body[dir=rtl] .tree-outline.dom li .html-tag.close):
+        (.tree-outline.dom li.parent::before):
+        (body[dir=rtl] .tree-outline.dom li.parent::before):
+        (body[dir=ltr] .tree-outline.dom li.parent::before):
+        (.tree-outline.dom li.parent.shadow::after):
+        (body[dir=ltr] .tree-outline.dom li.parent.shadow::after):
+        (body[dir=rtl] .tree-outline.dom li.parent.shadow::after):
+        (.tree-outline.dom.single-node li): Deleted.
+        (.tree-outline.dom li .html-tag.close): Deleted.
+
+        * UserInterface/Views/TreeElement.js:
+        (WebInspector.TreeElement.prototype.isEventWithinDisclosureTriangle):
+        Calculate the position of the ::before triangle based on the layout direction.
+
+2017-02-23  Devin Rousso  &lt;dcrousso+webkit@gmail.com&gt;
+
</ins><span class="cx">         Web Inspector: RTL: navigation sidebar section disclosure triangles and tree element icons should be aligned right
</span><span class="cx">         https://bugs.webkit.org/show_bug.cgi?id=168284
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceBaseUtilitiesjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Base/Utilities.js (212912 => 212913)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Base/Utilities.js        2017-02-23 20:12:23 UTC (rev 212912)
+++ trunk/Source/WebInspectorUI/UserInterface/Base/Utilities.js        2017-02-23 20:24:10 UTC (rev 212913)
</span><span class="lines">@@ -372,6 +372,14 @@
</span><span class="cx">     }
</span><span class="cx"> });
</span><span class="cx"> 
</span><ins>+Object.defineProperty(Element.prototype, &quot;totalOffsetRight&quot;,
+{
+    get: function()
+    {
+        return this.getBoundingClientRect().right;
+    }
+});
+
</ins><span class="cx"> Object.defineProperty(Element.prototype, &quot;totalOffsetTop&quot;,
</span><span class="cx"> {
</span><span class="cx">     get: function()
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceViewsDOMTreeOutlinecss"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Views/DOMTreeOutline.css (212912 => 212913)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Views/DOMTreeOutline.css        2017-02-23 20:12:23 UTC (rev 212912)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/DOMTreeOutline.css        2017-02-23 20:24:10 UTC (rev 212913)
</span><span class="lines">@@ -37,6 +37,23 @@
</span><span class="cx">  /* Needed to make the negative z-index on .selection-area works. Otherwise the background-color from .syntax-highlighted hides the selection. */
</span><span class="cx">     background-color: transparent !important;
</span><span class="cx">     color: black;
</span><ins>+
+    --item-padding-start: 17px;
+    --item-padding-end: 6px;
+
+    --item-parent-margin-start: -15px;
+
+    --item-parent-before-padding-end: 2px;
+
+    --item-parent-shadow-after-margin-start: -2px;
+
+    --item-pseudo-class-enabled-selection-before-start: 2px;
+
+    --single-item-padding-start: 2px;
+
+    --sublist-margin-start: 4px;
+    --sublist-padding-start: 1px;
+    --sublist-border-width-start: 9px;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> .tree-outline.dom li.hovered:not(.selected) .selection-area {
</span><span class="lines">@@ -77,10 +94,17 @@
</span><span class="cx"> 
</span><span class="cx"> .tree-outline.dom ol {
</span><span class="cx">     list-style-type: none;
</span><del>-    padding-left: 14px;
</del><span class="cx">     margin: 0;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+body[dir=ltr] .tree-outline.dom ol {
+    padding-left: calc(var(--sublist-margin-start) + var(--sublist-padding-start) + var(--sublist-border-width-start));
+}
+
+body[dir=rtl] .tree-outline.dom ol {
+    padding-right: calc(var(--sublist-margin-start) + var(--sublist-padding-start) + var(--sublist-border-width-start));
+}
+
</ins><span class="cx"> .tree-outline.dom ol.children {
</span><span class="cx">     display: none;
</span><span class="cx"> }
</span><span class="lines">@@ -90,25 +114,41 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> .tree-outline.dom li:matches(.hovered, .selected) + ol.children.expanded {
</span><del>-    margin-left: 4px;
-    padding-left: 1px;
-    border-left: 9px solid hsla(0, 0%, 83%, 0.5);
</del><ins>+    border: 0 solid hsla(0, 0%, 83%, 0.5);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+body[dir=ltr] .tree-outline.dom li:matches(.hovered, .selected) + ol.children.expanded {
+    margin-left: var(--sublist-margin-start);
+    padding-left: var(--sublist-padding-start);
+    border-left-width: var(--sublist-border-width-start);
+}
+
+body[dir=rtl] .tree-outline.dom li:matches(.hovered, .selected) + ol.children.expanded {
+    margin-right: var(--sublist-margin-start);
+    padding-right: var(--sublist-padding-start);
+    border-right-width: var(--sublist-border-width-start);
+}
+
</ins><span class="cx"> .tree-outline.dom li.selected + ol.children.expanded {
</span><del>-    border-left-color: hsl(0, 0%, 83%);
</del><ins>+    border-color: hsl(0, 0%, 83%);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> .tree-outline.dom li {
</span><del>-    padding: 0 6px 0 17px;
</del><span class="cx">     word-wrap: break-word;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+body[dir=ltr] .tree-outline.dom li {
+    padding: 0 var(--item-padding-end) 0 var(--item-padding-start);
+}
+
+body[dir=rtl] .tree-outline.dom li {
+    padding: 0 var(--item-padding-start) 0 var(--item-padding-end);
+}
+
</ins><span class="cx"> .tree-outline.dom li.pseudo-class-enabled &gt; .selection-area::before {
</span><span class="cx">     display: inline-block;
</span><span class="cx">     position: absolute;
</span><span class="cx">     top: 4px;
</span><del>-    left: 2px;
</del><span class="cx">     width: 5px;
</span><span class="cx">     height: 5px;
</span><span class="cx">     content: &quot;&quot;;
</span><span class="lines">@@ -116,10 +156,22 @@
</span><span class="cx">     border-radius: 50%;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-.tree-outline.dom.single-node li {
-    padding-left: 2px;
</del><ins>+body[dir=rtl] .tree-outline.dom li.pseudo-class-enabled &gt; .selection-area::before {
+    left: var(--item-pseudo-class-enabled-selection-before-start);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+body[dir=rtl] .tree-outline.dom li.pseudo-class-enabled &gt; .selection-area::before {
+    right: var(--item-pseudo-class-enabled-selection-before-start);
+}
+
+body[dir=ltr] .tree-outline.dom.single-node li {
+    padding-left: var(--single-item-padding-start);
+}
+
+body[dir=rtl] .tree-outline.dom.single-node li {
+    padding-right: var(--single-item-padding-start);
+}
+
</ins><span class="cx"> .tree-outline.dom:focus li.selected {
</span><span class="cx">     color: white;
</span><span class="cx"> }
</span><span class="lines">@@ -133,33 +185,50 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> .tree-outline.dom li.parent {
</span><del>-    margin-left: -15px;
</del><span class="cx">     line-height: 13px;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-.tree-outline.dom li .html-tag.close {
-    margin-left: -13px;
</del><ins>+body[dir=ltr] .tree-outline.dom li.parent {
+    margin-left: var(--item-parent-margin-start);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+body[dir=rtl] .tree-outline.dom li.parent {
+    margin-right: var(--item-parent-margin-start);
+}
+
+body[dir=ltr] .tree-outline.dom li .html-tag.close {
+    margin-left: calc(-1 * var(--sublist-margin-start) - var(--sublist-border-width-start));
+}
+
+body[dir=rtl] .tree-outline.dom li .html-tag.close {
+    margin-right: calc(-1 * var(--sublist-margin-start) - var(--sublist-border-width-start));
+}
+
</ins><span class="cx"> .tree-outline.dom li.parent::before {
</span><span class="cx">     position: relative;
</span><span class="cx">     z-index: 20;
</span><del>-
-    float: left;
-
</del><ins>+    width: 13px;
+    height: 13px;
</ins><span class="cx">     content: &quot;&quot;;
</span><del>-
</del><span class="cx">     background-image: url(../Images/DisclosureTriangles.svg#closed-normal);
</span><span class="cx">     background-size: 13px 13px;
</span><span class="cx">     background-repeat: no-repeat;
</span><ins>+}
</ins><span class="cx"> 
</span><del>-    width: 13px;
-    height: 13px;
</del><ins>+body[dir=rtl] .tree-outline.dom li.parent::before {
+    transform: scaleX(-1);
+}
</ins><span class="cx"> 
</span><del>-    margin-left: 0;
-    padding-right: 2px;
</del><ins>+body[dir=ltr] .tree-outline.dom li.parent::before {
+    float: left;
+    padding-right: var(--item-parent-before-padding-end);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+body[dir=rtl] .tree-outline.dom li.parent::before {
+    float: right;
+    padding-left: var(--item-parent-before-padding-end);
+}
+
</ins><span class="cx"> .tree-outline.dom:focus li.parent.selected::before {
</span><span class="cx">     background-image: url(../Images/DisclosureTriangles.svg#closed-selected);
</span><span class="cx"> }
</span><span class="lines">@@ -193,11 +262,18 @@
</span><span class="cx">     width: calc(100% + 8px);
</span><span class="cx">     height: 1.2em;
</span><span class="cx">     margin-top: -13px;
</span><del>-    margin-left: -2px;
</del><span class="cx">     content: &quot;&quot;;
</span><span class="cx">     background-color: hsla(0, 0%, 90%, 0.5);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+body[dir=ltr] .tree-outline.dom li.parent.shadow::after {
+    margin-left: var(--item-parent-shadow-after-margin-start);
+}
+
+body[dir=rtl] .tree-outline.dom li.parent.shadow::after {
+    margin-right: var(--item-parent-shadow-after-margin-start);
+}
+
</ins><span class="cx"> .tree-outline.dom li.parent.shadow + ol.children.expanded {
</span><span class="cx">     background-color: hsla(0, 0%, 90%, 0.5);
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceViewsTreeElementjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Views/TreeElement.js (212912 => 212913)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Views/TreeElement.js        2017-02-23 20:12:23 UTC (rev 212912)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/TreeElement.js        2017-02-23 20:24:10 UTC (rev 212913)
</span><span class="lines">@@ -614,9 +614,14 @@
</span><span class="cx">             return false;
</span><span class="cx"> 
</span><span class="cx">         // FIXME: We should not use getComputedStyle(). For that we need to get rid of using ::before for disclosure triangle. (http://webk.it/74446)
</span><del>-        var computedLeftPadding = window.getComputedStyle(this._listItemNode).getPropertyCSSValue(&quot;padding-left&quot;).getFloatValue(CSSPrimitiveValue.CSS_PX);
-        var left = this._listItemNode.totalOffsetLeft + computedLeftPadding;
-        return event.pageX &gt;= left &amp;&amp; event.pageX &lt;= left + this.arrowToggleWidth &amp;&amp; this.hasChildren;
</del><ins>+        let computedStyle = window.getComputedStyle(this._listItemNode);
+        let start = 0;
+        if (WebInspector.resolvedLayoutDirection() === WebInspector.LayoutDirection.RTL)
+            start += this._listItemNode.totalOffsetRight - computedStyle.getPropertyCSSValue(&quot;padding-right&quot;).getFloatValue(CSSPrimitiveValue.CSS_PX) - this.arrowToggleWidth;
+        else
+            start += this._listItemNode.totalOffsetLeft + computedStyle.getPropertyCSSValue(&quot;padding-left&quot;).getFloatValue(CSSPrimitiveValue.CSS_PX);
+
+        return event.pageX &gt;= start &amp;&amp; event.pageX &lt;= start + this.arrowToggleWidth &amp;&amp; this.hasChildren;
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     populateContextMenu(contextMenu, event)
</span></span></pre>
</div>
</div>

</body>
</html>