Diff
Modified: trunk/Source/WebInspectorUI/ChangeLog (159945 => 159946)
--- trunk/Source/WebInspectorUI/ChangeLog 2013-12-02 19:55:30 UTC (rev 159945)
+++ trunk/Source/WebInspectorUI/ChangeLog 2013-12-02 19:55:52 UTC (rev 159946)
@@ -1,3 +1,27 @@
+2013-12-02 Antoine Quint <[email protected]>
+
+ Web Inspector: add a method to add padding around a WebInspector.Rect
+ https://bugs.webkit.org/show_bug.cgi?id=125072
+
+ Reviewed by Joseph Pecoraro.
+
+ Add a new WebInspector.Rect.prototype.pad() method which does not alter
+ the rectangle it's called and returns a new rect much like .inset(). I've
+ checked all call sites and there was no reuse of the rectangle that was
+ padded so this patch won't have any side effects.
+
+ * UserInterface/Breakpoint.js:
+ (WebInspector.Breakpoint.prototype._showEditBreakpointPopover):
+ * UserInterface/CSSStyleDeclarationTextEditor.js:
+ * UserInterface/Geometry.js:
+ (WebInspector.Rect.prototype.pad):
+ * UserInterface/LayerTreeSidebarPanel.js:
+ (WebInspector.LayerTreeSidebarPanel.prototype._updatePopoverForSelectedNode):
+ * UserInterface/SourceCodeTextEditor.js:
+ (WebInspector.SourceCodeTextEditor.prototype._showPopover):
+ * UserInterface/TimelineDataGrid.js:
+ (WebInspector.TimelineDataGrid.prototype._updatePopoverForSelectedNode):
+
2013-11-26 Antoine Quint <[email protected]>
Web Inspector: Allow showing a context menu on all mouse events.
Modified: trunk/Source/WebInspectorUI/UserInterface/Breakpoint.js (159945 => 159946)
--- trunk/Source/WebInspectorUI/UserInterface/Breakpoint.js 2013-12-02 19:55:30 UTC (rev 159945)
+++ trunk/Source/WebInspectorUI/UserInterface/Breakpoint.js 2013-12-02 19:55:52 UTC (rev 159946)
@@ -480,18 +480,12 @@
_showEditBreakpointPopover: function(boundingClientRect)
{
- const padding = 2;
var bounds = WebInspector.Rect.rectFromClientRect(boundingClientRect);
-
bounds.origin.x -= 1; // Move the anchor left one pixel so it looks more centered.
- bounds.origin.x -= padding;
- bounds.origin.y -= padding;
- bounds.size.width += padding * 2;
- bounds.size.height += padding * 2;
this._popover = this._popover || new WebInspector.Popover(this);
this._popover.content = this._editBreakpointPopoverContentElement();
- this._popover.present(bounds, [WebInspector.RectEdge.MAX_Y]);
+ this._popover.present(bounds.pad(2), [WebInspector.RectEdge.MAX_Y]);
if (!this._keyboardShortcutEsc) {
this._keyboardShortcutEsc = new WebInspector.KeyboardShortcut(null, WebInspector.KeyboardShortcut.Key.Escape);
Modified: trunk/Source/WebInspectorUI/UserInterface/CSSStyleDeclarationTextEditor.js (159945 => 159946)
--- trunk/Source/WebInspectorUI/UserInterface/CSSStyleDeclarationTextEditor.js 2013-12-02 19:55:30 UTC (rev 159945)
+++ trunk/Source/WebInspectorUI/UserInterface/CSSStyleDeclarationTextEditor.js 2013-12-02 19:55:52 UTC (rev 159946)
@@ -750,14 +750,9 @@
}.bind(this));
var bounds = WebInspector.Rect.rectFromClientRect(swatch.getBoundingClientRect());
- const padding = 2;
- bounds.origin.x -= padding;
- bounds.origin.y -= padding;
- bounds.size.width += padding * 2;
- bounds.size.height += padding * 2;
this._colorPickerPopover.content = colorPicker.element;
- this._colorPickerPopover.present(bounds, [WebInspector.RectEdge.MIN_X]);
+ this._colorPickerPopover.present(bounds.pad(2), [WebInspector.RectEdge.MIN_X]);
colorPicker.color = color;
}
Modified: trunk/Source/WebInspectorUI/UserInterface/Geometry.js (159945 => 159946)
--- trunk/Source/WebInspectorUI/UserInterface/Geometry.js 2013-12-02 19:55:30 UTC (rev 159945)
+++ trunk/Source/WebInspectorUI/UserInterface/Geometry.js 2013-12-02 19:55:52 UTC (rev 159946)
@@ -126,6 +126,16 @@
);
},
+ pad: function(padding)
+ {
+ return new WebInspector.Rect(
+ this.origin.x - padding,
+ this.origin.y - padding,
+ this.size.width + padding * 2,
+ this.size.height + padding * 2
+ );
+ },
+
minX: function()
{
return this.origin.x;
Modified: trunk/Source/WebInspectorUI/UserInterface/LayerTreeSidebarPanel.js (159945 => 159946)
--- trunk/Source/WebInspectorUI/UserInterface/LayerTreeSidebarPanel.js 2013-12-02 19:55:30 UTC (rev 159945)
+++ trunk/Source/WebInspectorUI/UserInterface/LayerTreeSidebarPanel.js 2013-12-02 19:55:52 UTC (rev 159946)
@@ -337,16 +337,11 @@
popover = this._popover = new WebInspector.Popover;
var targetFrame = WebInspector.Rect.rectFromClientRect(dataGridNode.element.getBoundingClientRect());
- const padding = 2;
- targetFrame.origin.x -= padding;
- targetFrame.origin.y -= padding;
- targetFrame.size.width += padding * 2;
- targetFrame.size.height += padding * 2;
if (content)
popover.content = content;
- popover.present(targetFrame, [WebInspector.RectEdge.MIN_X]);
+ popover.present(targetFrame.pad(2), [WebInspector.RectEdge.MIN_X]);
},
_hidePopover: function()
Modified: trunk/Source/WebInspectorUI/UserInterface/SourceCodeTextEditor.js (159945 => 159946)
--- trunk/Source/WebInspectorUI/UserInterface/SourceCodeTextEditor.js 2013-12-02 19:55:30 UTC (rev 159945)
+++ trunk/Source/WebInspectorUI/UserInterface/SourceCodeTextEditor.js 2013-12-02 19:55:52 UTC (rev 159946)
@@ -1091,15 +1091,9 @@
content.classList.add(WebInspector.SourceCodeTextEditor.PopoverDebuggerContentStyleClassName);
- const padding = 5;
- bounds.origin.x -= padding;
- bounds.origin.y -= padding;
- bounds.size.width += padding * 2;
- bounds.size.height += padding * 2;
-
this._popover = this._popover || new WebInspector.Popover(this);
this._popover.content = content;
- this._popover.present(bounds, [WebInspector.RectEdge.MIN_Y, WebInspector.RectEdge.MAX_Y, WebInspector.RectEdge.MAX_X]);
+ this._popover.present(bounds.pad(5), [WebInspector.RectEdge.MIN_Y, WebInspector.RectEdge.MAX_Y, WebInspector.RectEdge.MAX_X]);
this._trackPopoverEvents();
Modified: trunk/Source/WebInspectorUI/UserInterface/TimelineDataGrid.js (159945 => 159946)
--- trunk/Source/WebInspectorUI/UserInterface/TimelineDataGrid.js 2013-12-02 19:55:30 UTC (rev 159945)
+++ trunk/Source/WebInspectorUI/UserInterface/TimelineDataGrid.js 2013-12-02 19:55:52 UTC (rev 159946)
@@ -217,16 +217,10 @@
delete this._hidePopoverContentClearTimeout;
}
- const padding = 2;
- targetFrame.origin.x -= padding;
- targetFrame.origin.y -= padding;
- targetFrame.size.width += padding * 2;
- targetFrame.size.height += padding * 2;
-
if (updateContent)
this._popover.content = this._createPopoverContent();
- this._popover.present(targetFrame, [WebInspector.RectEdge.MAX_Y, WebInspector.RectEdge.MIN_Y, WebInspector.RectEdge.MAX_X]);
+ this._popover.present(targetFrame.pad(2), [WebInspector.RectEdge.MAX_Y, WebInspector.RectEdge.MIN_Y, WebInspector.RectEdge.MAX_X]);
},
_createPopoverContent: function()