Diff
Modified: branches/safari-601-branch/Source/WebInspectorUI/ChangeLog (193090 => 193091)
--- branches/safari-601-branch/Source/WebInspectorUI/ChangeLog 2015-12-03 18:45:44 UTC (rev 193090)
+++ branches/safari-601-branch/Source/WebInspectorUI/ChangeLog 2015-12-03 18:45:52 UTC (rev 193091)
@@ -1,5 +1,29 @@
2015-12-02 Timothy Hatcher <[email protected]>
+ Merge r188360. rdar://problem/23221163
+
+ 2015-08-12 Matt Baker <[email protected]>
+
+ Web Inspector: Remove clamp and adopt Number.constrain
+ https://bugs.webkit.org/show_bug.cgi?id=147952
+
+ Reviewed by Timothy Hatcher.
+
+ * UserInterface/Base/Utilities.js:
+ Removed clamp function.
+
+ * UserInterface/Views/BezierEditor.js:
+ (WebInspector.BezierEditor.prototype._updateControlPointsForMouseEvent):
+ * UserInterface/Views/ProfileNodeDataGridNode.js:
+ (WebInspector.ProfileNodeDataGridNode.prototype.updateRangeTimes):
+ * UserInterface/Views/ScriptTimelineDataGridNode.js:
+ (WebInspector.ScriptTimelineDataGridNode.prototype.updateRangeTimes):
+ * UserInterface/Views/TimelineRuler.js:
+ (WebInspector.TimelineRuler.prototype._updateSelection):
+ Replaced instances of clamp with Number.constrain.
+
+2015-12-02 Timothy Hatcher <[email protected]>
+
Merge r188343. rdar://problem/23221163
2015-08-12 Joseph Pecoraro <[email protected]>
Modified: branches/safari-601-branch/Source/WebInspectorUI/UserInterface/Base/Utilities.js (193090 => 193091)
--- branches/safari-601-branch/Source/WebInspectorUI/UserInterface/Base/Utilities.js 2015-12-03 18:45:44 UTC (rev 193090)
+++ branches/safari-601-branch/Source/WebInspectorUI/UserInterface/Base/Utilities.js 2015-12-03 18:45:52 UTC (rev 193091)
@@ -1079,11 +1079,6 @@
return "\"" + str.replace(/"/g, "\\\"") + "\"";
}
-function clamp(min, value, max)
-{
- return Math.min(Math.max(min, value), max);
-}
-
function insertionIndexForObjectInListSortedByFunction(object, list, comparator, insertionIndexAfter)
{
if (insertionIndexAfter) {
Modified: branches/safari-601-branch/Source/WebInspectorUI/UserInterface/External/ESLint/eslint.js (193090 => 193091)
--- branches/safari-601-branch/Source/WebInspectorUI/UserInterface/External/ESLint/eslint.js 2015-12-03 18:45:44 UTC (rev 193090)
+++ branches/safari-601-branch/Source/WebInspectorUI/UserInterface/External/ESLint/eslint.js 2015-12-03 18:45:52 UTC (rev 193091)
@@ -18220,4 +18220,4 @@
};
},{}]},{},[9])(9)
-});
\ No newline at end of file
+});
Modified: branches/safari-601-branch/Source/WebInspectorUI/UserInterface/Models/WrappedPromise.js (193090 => 193091)
--- branches/safari-601-branch/Source/WebInspectorUI/UserInterface/Models/WrappedPromise.js 2015-12-03 18:45:44 UTC (rev 193090)
+++ branches/safari-601-branch/Source/WebInspectorUI/UserInterface/Models/WrappedPromise.js 2015-12-03 18:45:52 UTC (rev 193091)
@@ -52,4 +52,4 @@
{
this._reject(value);
}
-}
\ No newline at end of file
+}
Modified: branches/safari-601-branch/Source/WebInspectorUI/UserInterface/Views/BezierEditor.js (193090 => 193091)
--- branches/safari-601-branch/Source/WebInspectorUI/UserInterface/Views/BezierEditor.js 2015-12-03 18:45:44 UTC (rev 193090)
+++ branches/safari-601-branch/Source/WebInspectorUI/UserInterface/Views/BezierEditor.js 2015-12-03 18:45:52 UTC (rev 193091)
@@ -187,7 +187,7 @@
_updateControlPointsForMouseEvent(event, calculateSelectedControlPoint)
{
var point = WebInspector.Point.fromEventInElement(event, this._bezierContainer);
- point.x = clamp(0, point.x - this._controlHandleRadius, this._bezierWidth);
+ point.x = Number.constrain(point.x - this._controlHandleRadius, 0, this._bezierWidth);
point.y -= this._controlHandleRadius + this._padding;
if (calculateSelectedControlPoint) {
Modified: branches/safari-601-branch/Source/WebInspectorUI/UserInterface/Views/LogContentView.js (193090 => 193091)
--- branches/safari-601-branch/Source/WebInspectorUI/UserInterface/Views/LogContentView.js 2015-12-03 18:45:44 UTC (rev 193090)
+++ branches/safari-601-branch/Source/WebInspectorUI/UserInterface/Views/LogContentView.js 2015-12-03 18:45:52 UTC (rev 193091)
@@ -974,4 +974,4 @@
WebInspector.LogContentView.SelectedStyleClassName = "selected";
WebInspector.LogContentView.SearchInProgressStyleClassName = "search-in-progress";
WebInspector.LogContentView.FilteredOutBySearchStyleClassName = "filtered-out-by-search";
-WebInspector.LogContentView.HighlightedStyleClassName = "highlighted";
\ No newline at end of file
+WebInspector.LogContentView.HighlightedStyleClassName = "highlighted";
Modified: branches/safari-601-branch/Source/WebInspectorUI/UserInterface/Views/ProfileNodeDataGridNode.js (193090 => 193091)
--- branches/safari-601-branch/Source/WebInspectorUI/UserInterface/Views/ProfileNodeDataGridNode.js 2015-12-03 18:45:44 UTC (rev 193090)
+++ branches/safari-601-branch/Source/WebInspectorUI/UserInterface/Views/ProfileNodeDataGridNode.js 2015-12-03 18:45:52 UTC (rev 193091)
@@ -86,10 +86,10 @@
// We only need a refresh if the new range time changes the visible portion of this record.
var profileStart = this._profileNode.startTime;
var profileEnd = this._profileNode.endTime;
- var oldStartBoundary = clamp(profileStart, oldRangeStartTime, profileEnd);
- var oldEndBoundary = clamp(profileStart, oldRangeEndTime, profileEnd);
- var newStartBoundary = clamp(profileStart, startTime, profileEnd);
- var newEndBoundary = clamp(profileStart, endTime, profileEnd);
+ var oldStartBoundary = Number.constrain(oldRangeStartTime, profileStart, profileEnd);
+ var oldEndBoundary = Number.constrain(oldRangeEndTime, profileStart, profileEnd);
+ var newStartBoundary = Number.constrain(startTime, profileStart, profileEnd);
+ var newEndBoundary = Number.constrain(endTime, profileStart, profileEnd);
if (oldStartBoundary !== newStartBoundary || oldEndBoundary !== newEndBoundary)
this.needsRefresh();
Modified: branches/safari-601-branch/Source/WebInspectorUI/UserInterface/Views/ScriptTimelineDataGridNode.js (193090 => 193091)
--- branches/safari-601-branch/Source/WebInspectorUI/UserInterface/Views/ScriptTimelineDataGridNode.js 2015-12-03 18:45:44 UTC (rev 193090)
+++ branches/safari-601-branch/Source/WebInspectorUI/UserInterface/Views/ScriptTimelineDataGridNode.js 2015-12-03 18:45:52 UTC (rev 193091)
@@ -99,10 +99,10 @@
// We only need a refresh if the new range time changes the visible portion of this record.
var recordStart = this._record.startTime;
var recordEnd = this._record.startTime + this._record.duration;
- var oldStartBoundary = clamp(recordStart, oldRangeStartTime, recordEnd);
- var oldEndBoundary = clamp(recordStart, oldRangeEndTime, recordEnd);
- var newStartBoundary = clamp(recordStart, startTime, recordEnd);
- var newEndBoundary = clamp(recordStart, endTime, recordEnd);
+ var oldStartBoundary = Number.constrain(oldRangeStartTime, recordStart, recordEnd);
+ var oldEndBoundary = Number.constrain(oldRangeEndTime, recordStart, recordEnd);
+ var newStartBoundary = Number.constrain(startTime, recordStart, recordEnd);
+ var newEndBoundary = Number.constrain(endTime, recordStart, recordEnd);
if (oldStartBoundary !== newStartBoundary || oldEndBoundary !== newEndBoundary)
this.needsRefresh();
Modified: branches/safari-601-branch/Source/WebInspectorUI/UserInterface/Views/StyleDetailsPanel.js (193090 => 193091)
--- branches/safari-601-branch/Source/WebInspectorUI/UserInterface/Views/StyleDetailsPanel.js 2015-12-03 18:45:44 UTC (rev 193090)
+++ branches/safari-601-branch/Source/WebInspectorUI/UserInterface/Views/StyleDetailsPanel.js 2015-12-03 18:45:52 UTC (rev 193091)
@@ -167,4 +167,4 @@
WebInspector.StyleDetailsPanel.Event = {
Refreshed: "style-details-panel-refreshed"
-};
\ No newline at end of file
+};
Modified: branches/safari-601-branch/Source/WebInspectorUI/UserInterface/Views/TimelineRuler.js (193090 => 193091)
--- branches/safari-601-branch/Source/WebInspectorUI/UserInterface/Views/TimelineRuler.js 2015-12-03 18:45:44 UTC (rev 193090)
+++ branches/safari-601-branch/Source/WebInspectorUI/UserInterface/Views/TimelineRuler.js 2015-12-03 18:45:52 UTC (rev 193091)
@@ -595,7 +595,7 @@
var formattedStartTimeText = this._formatDividerLabelText(this._selectionStartTime);
var formattedEndTimeText = this._formatDividerLabelText(this._selectionEndTime);
- var newLeftPosition = clamp(0, (this._selectionStartTime - this._startTime) / duration, 1);
+ var newLeftPosition = Number.constrain((this._selectionStartTime - this._startTime) / duration, 0, 1);
this._updatePositionOfElement(this._leftShadedAreaElement, newLeftPosition, visibleWidth, "width");
this._updatePositionOfElement(this._leftSelectionHandleElement, newLeftPosition, visibleWidth, "left");
this._updatePositionOfElement(this._selectionDragElement, newLeftPosition, visibleWidth, "left");
@@ -604,7 +604,7 @@
this._leftSelectionHandleElement.classList.toggle("hidden", startTimeClamped && endTimeClamped && this._selectionStartTime < this._startTime);
this._leftSelectionHandleElement.title = formattedStartTimeText;
- var newRightPosition = 1 - clamp(0, (this._selectionEndTime - this._startTime) / duration, 1);
+ var newRightPosition = 1 - Number.constrain((this._selectionEndTime - this._startTime) / duration, 0, 1);
this._updatePositionOfElement(this._rightShadedAreaElement, newRightPosition, visibleWidth, "width");
this._updatePositionOfElement(this._rightSelectionHandleElement, newRightPosition, visibleWidth, "right");
this._updatePositionOfElement(this._selectionDragElement, newRightPosition, visibleWidth, "right");