Title: [86663] trunk
- Revision
- 86663
- Author
- [email protected]
- Date
- 2011-05-17 02:34:49 -0700 (Tue, 17 May 2011)
Log Message
2011-05-17 Alexander Pavlov <[email protected]>
Reviewed by Yury Semikhatsky.
Web Inspector: Increment/decrement of very big CSS numeric values results in invalid CSS
https://bugs.webkit.org/show_bug.cgi?id=60890
* inspector/styles/up-down-numerics-and-colors-expected.txt:
* inspector/styles/up-down-numerics-and-colors.html:
2011-05-17 Alexander Pavlov <[email protected]>
Reviewed by Yury Semikhatsky.
Web Inspector: Increment/decrement of very big CSS numeric values results in invalid CSS
https://bugs.webkit.org/show_bug.cgi?id=60890
* inspector/front-end/MetricsSidebarPane.js:
(WebInspector.MetricsSidebarPane.prototype._handleKeyDown):
* inspector/front-end/StylesSidebarPane.js:
(WebInspector.StylesSidebarPane.alteredFloatNumber):
(WebInspector.StylePropertyTreeElement.prototype):
Modified Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (86662 => 86663)
--- trunk/LayoutTests/ChangeLog 2011-05-17 09:31:52 UTC (rev 86662)
+++ trunk/LayoutTests/ChangeLog 2011-05-17 09:34:49 UTC (rev 86663)
@@ -1,3 +1,13 @@
+2011-05-17 Alexander Pavlov <[email protected]>
+
+ Reviewed by Yury Semikhatsky.
+
+ Web Inspector: Increment/decrement of very big CSS numeric values results in invalid CSS
+ https://bugs.webkit.org/show_bug.cgi?id=60890
+
+ * inspector/styles/up-down-numerics-and-colors-expected.txt:
+ * inspector/styles/up-down-numerics-and-colors.html:
+
2011-05-17 Yuzo Fujishima <[email protected]>
Unreviewed Chromium test expectation change.
Modified: trunk/LayoutTests/inspector/styles/up-down-numerics-and-colors-expected.txt (86662 => 86663)
--- trunk/LayoutTests/inspector/styles/up-down-numerics-and-colors-expected.txt 2011-05-17 09:31:52 UTC (rev 86662)
+++ trunk/LayoutTests/inspector/styles/up-down-numerics-and-colors-expected.txt 2011-05-17 09:34:49 UTC (rev 86663)
@@ -13,3 +13,6 @@
Running: testAlterNumber
opacity: 10.6;
+Running: testAlterBigNumber
+-webkit-transform: rotate(1000000000000000065537deg);
+
Modified: trunk/LayoutTests/inspector/styles/up-down-numerics-and-colors.html (86662 => 86663)
--- trunk/LayoutTests/inspector/styles/up-down-numerics-and-colors.html 2011-05-17 09:31:52 UTC (rev 86662)
+++ trunk/LayoutTests/inspector/styles/up-down-numerics-and-colors.html 2011-05-17 09:34:49 UTC (rev 86663)
@@ -5,6 +5,7 @@
h1 {
color: #FF2;
opacity: .5;
+ -webkit-transform: rotate(1000000000000000065537deg);
}
</style>
@@ -43,14 +44,31 @@
next();
},
- function testAlterNumber()
+ function testAlterNumber(next)
{
var opacityTreeElement = section.findTreeElementWithName("opacity");
opacityTreeElement.startEditing(opacityTreeElement.valueElement);
opacityTreeElement.valueElement.dispatchEvent(InspectorTest.createKeyEvent("Up"));
opacityTreeElement.valueElement.dispatchEvent(InspectorTest.createKeyEvent("PageUp"));
InspectorTest.addResult(opacityTreeElement.listItemElement.textContent);
- InspectorTest.completeTest();
+ next();
+ },
+
+ function testAlterBigNumber(next)
+ {
+ var treeElement = section.findTreeElementWithName("-webkit-transform");
+ treeElement.startEditing(treeElement.valueElement);
+ var selection = window.getSelection();
+ var range = selection.getRangeAt(0);
+ var newRange = document.createRange();
+ newRange.setStart(range.startContainer, 10);
+ newRange.setEnd(range.startContainer, 10);
+ selection.removeAllRanges();
+ selection.addRange(newRange);
+ treeElement.valueElement.dispatchEvent(InspectorTest.createKeyEvent("Up"));
+ treeElement.valueElement.dispatchEvent(InspectorTest.createKeyEvent("PageUp"));
+ InspectorTest.addResult(treeElement.listItemElement.textContent);
+ next();
}
]);
}
Modified: trunk/Source/WebCore/ChangeLog (86662 => 86663)
--- trunk/Source/WebCore/ChangeLog 2011-05-17 09:31:52 UTC (rev 86662)
+++ trunk/Source/WebCore/ChangeLog 2011-05-17 09:34:49 UTC (rev 86663)
@@ -1,3 +1,16 @@
+2011-05-17 Alexander Pavlov <[email protected]>
+
+ Reviewed by Yury Semikhatsky.
+
+ Web Inspector: Increment/decrement of very big CSS numeric values results in invalid CSS
+ https://bugs.webkit.org/show_bug.cgi?id=60890
+
+ * inspector/front-end/MetricsSidebarPane.js:
+ (WebInspector.MetricsSidebarPane.prototype._handleKeyDown):
+ * inspector/front-end/StylesSidebarPane.js:
+ (WebInspector.StylesSidebarPane.alteredFloatNumber):
+ (WebInspector.StylePropertyTreeElement.prototype):
+
2011-05-17 Pavel Podivilov <[email protected]>
Reviewed by Yury Semikhatsky.
Modified: trunk/Source/WebCore/inspector/front-end/MetricsSidebarPane.js (86662 => 86663)
--- trunk/Source/WebCore/inspector/front-end/MetricsSidebarPane.js 2011-05-17 09:31:52 UTC (rev 86662)
+++ trunk/Source/WebCore/inspector/front-end/MetricsSidebarPane.js 2011-05-17 09:34:49 UTC (rev 86663)
@@ -305,6 +305,11 @@
prefix = matches[1];
suffix = matches[3];
number = WebInspector.StylesSidebarPane.alteredFloatNumber(parseFloat(matches[2]), event);
+ if (number === null) {
+ // Need to check for null explicitly.
+ return;
+ }
+
if (styleProperty !== "margin" && number < 0)
number = 0;
Modified: trunk/Source/WebCore/inspector/front-end/StylesSidebarPane.js (86662 => 86663)
--- trunk/Source/WebCore/inspector/front-end/StylesSidebarPane.js 2011-05-17 09:31:52 UTC (rev 86662)
+++ trunk/Source/WebCore/inspector/front-end/StylesSidebarPane.js 2011-05-17 09:34:49 UTC (rev 86663)
@@ -110,6 +110,8 @@
"-webkit-resizer", "-webkit-input-list-button", "-webkit-inner-spin-button", "-webkit-outer-spin-button"
];
+WebInspector.StylesSidebarPane.CSSNumberRegex = /^(-?(?:\d+(?:\.\d+)?|\.\d+))$/;
+
WebInspector.StylesSidebarPane.alteredFloatNumber = function(number, event)
{
var arrowKeyPressed = (event.keyIdentifier === "Up" || event.keyIdentifier === "Down");
@@ -143,6 +145,8 @@
// Make the new number and constrain it to a precision of 6, this matches numbers the engine returns.
// Use the Number constructor to forget the fixed precision, so 1.100000 will print as 1.1.
result = Number((number + changeAmount).toFixed(6));
+ if (!String(result).match(WebInspector.StylesSidebarPane.CSSNumberRegex))
+ return null;
}
return result;
@@ -1757,6 +1761,10 @@
prefix = matches[1];
suffix = matches[3];
number = WebInspector.StylesSidebarPane.alteredFloatNumber(parseFloat(matches[2]), event);
+ if (number === null) {
+ // Need to check for null explicitly.
+ return false;
+ }
replacementString = prefix + number + suffix;
}
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes