Commit 88f07961 authored by graouts@apple.com's avatar graouts@apple.com

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):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159952 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent ae139851
2013-12-02 Antoine Quint <graouts@apple.com>
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 <graouts@apple.com>
Web Inspector: add a method to add padding around a WebInspector.Rect
......
......@@ -232,8 +232,6 @@ WebInspector.Popover.prototype = {
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 @@ WebInspector.Popover.prototype = {
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 @@ WebInspector.Popover.prototype = {
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);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment