Title: [159952] trunk/Source/WebInspectorUI
- Revision
- 159952
- Author
- [email protected]
- Date
- 2013-12-02 12:40:58 -0800 (Mon, 02 Dec 2013)
Log Message
Web Inspector: popover can overlap target frame
https://bugs.webkit.org/show_bug.cgi?id=125069
Reviewed by Joseph Pecoraro.
Fix a regression introduced in http://trac.webkit.org/changeset/159286. We should only
offset the frame of the popover in the y-axis if the target edge is on the x-axis, and
vice versa. We also remove the needsToDrawBackground check since it incorrectly disregarded
the anchor point. We now always draw the background which is a lot safer and guarantees
we'll always draw an adequate frame and anchor point.
* UserInterface/Popover.js:
(WebInspector.Popover.prototype._update):
(WebInspector.Popover.prototype._bestMetricsForEdge):
Modified Paths
Diff
Modified: trunk/Source/WebInspectorUI/ChangeLog (159951 => 159952)
--- trunk/Source/WebInspectorUI/ChangeLog 2013-12-02 20:28:54 UTC (rev 159951)
+++ trunk/Source/WebInspectorUI/ChangeLog 2013-12-02 20:40:58 UTC (rev 159952)
@@ -1,5 +1,22 @@
2013-12-02 Antoine Quint <[email protected]>
+ Web Inspector: popover can overlap target frame
+ https://bugs.webkit.org/show_bug.cgi?id=125069
+
+ Reviewed by Joseph Pecoraro.
+
+ Fix a regression introduced in http://trac.webkit.org/changeset/159286. We should only
+ offset the frame of the popover in the y-axis if the target edge is on the x-axis, and
+ vice versa. We also remove the needsToDrawBackground check since it incorrectly disregarded
+ the anchor point. We now always draw the background which is a lot safer and guarantees
+ we'll always draw an adequate frame and anchor point.
+
+ * UserInterface/Popover.js:
+ (WebInspector.Popover.prototype._update):
+ (WebInspector.Popover.prototype._bestMetricsForEdge):
+
+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
Modified: trunk/Source/WebInspectorUI/UserInterface/Popover.js (159951 => 159952)
--- trunk/Source/WebInspectorUI/UserInterface/Popover.js 2013-12-02 20:28:54 UTC (rev 159951)
+++ trunk/Source/WebInspectorUI/UserInterface/Popover.js 2013-12-02 20:40:58 UTC (rev 159952)
@@ -232,8 +232,6 @@
var anchorPoint;
var bestFrame = bestMetrics.frame;
- var needsToDrawBackground = !this._frame.size.equals(bestFrame.size) || this._edge !== bestEdge;
-
this.frame = bestFrame;
this._edge = bestEdge;
@@ -258,8 +256,7 @@
this._element.classList.add(this._cssClassNameForEdge());
- if (needsToDrawBackground)
- this._drawBackground(bestEdge, anchorPoint);
+ this._drawBackground(bestEdge, anchorPoint);
// Make sure content is centered in case either of the dimension is smaller than the minimal bounds.
if (this._preferredSize.width < WebInspector.Popover.MinWidth || this._preferredSize.height < WebInspector.Popover.MinHeight)
@@ -394,14 +391,17 @@
break;
}
- if (x < containerFrame.minX())
- x = containerFrame.minX();
- if (y < containerFrame.minY())
- y = containerFrame.minY();
- if (x + width > containerFrame.maxX())
- x += containerFrame.maxX() - (x + width);
- if (y + height > containerFrame.maxY())
- y += containerFrame.maxY() - (y + height);
+ if (edge === WebInspector.RectEdge.MIN_X || edge === WebInspector.RectEdge.MAX_X) {
+ if (y < containerFrame.minY())
+ y = containerFrame.minY();
+ if (y + height > containerFrame.maxY())
+ y = containerFrame.maxY() - height;
+ } else {
+ if (x < containerFrame.minX())
+ x = containerFrame.minX();
+ if (x + width > containerFrame.maxX())
+ x = containerFrame.maxX() - width;
+ }
var preferredFrame = new WebInspector.Rect(x, y, width, height);
var bestFrame = preferredFrame.intersectionWithRect(containerFrame);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes