Diff
Modified: trunk/LayoutTests/ChangeLog (109771 => 109772)
--- trunk/LayoutTests/ChangeLog 2012-03-05 18:57:38 UTC (rev 109771)
+++ trunk/LayoutTests/ChangeLog 2012-03-05 18:57:48 UTC (rev 109772)
@@ -1,3 +1,13 @@
+2012-03-05 Alexander Pavlov <apav...@chromium.org>
+
+ Web Inspector: CSS inactive property check should account for vendor prefixes
+ https://bugs.webkit.org/show_bug.cgi?id=80225
+
+ Reviewed by Pavel Feldman.
+
+ * inspector/styles/vendor-prefixes-expected.txt: Added.
+ * inspector/styles/vendor-prefixes.html: Added.
+
2012-03-05 Dan Bernstein <m...@apple.com>
fast/text/international/spaces-combined-in-vertical-text.html has incorrect expected results
Added: trunk/LayoutTests/inspector/styles/vendor-prefixes-expected.txt (0 => 109772)
--- trunk/LayoutTests/inspector/styles/vendor-prefixes-expected.txt (rev 0)
+++ trunk/LayoutTests/inspector/styles/vendor-prefixes-expected.txt 2012-03-05 18:57:48 UTC (rev 109772)
@@ -0,0 +1,31 @@
+Tests that properties with WebKit vendor-specific prefixes ("-apple-", "-webkit-", and "-khtml-") are treated the same as those without the prefix.
+
+Text
+[expanded]
+display: block;
+ div - block user agent stylesheet
+opacity: 0.75;
+ #inspected - 0.75 vendor-prefixes.html:11
+ /-- overloaded --/ #inspected - 1 vendor-prefixes.html:4
+
+[expanded]
+element.style { ()
+
+======== Matched CSS Rules ========
+[expanded]
+#inspected { (vendor-prefixes.html:11)
+-apple-opacity: 0.75;
+
+[expanded]
+#inspected { (vendor-prefixes.html:4)
+/-- overloaded --/ -apple-opacity: 0.35;
+/-- overloaded --/ -webkit-opacity: 0.5;
+/-- overloaded --/ opacity: 1;
+/-- overloaded --/ -khtml-opacity: 0.25;
+
+[expanded]
+div { (user agent stylesheet)
+display: block;
+
+
+
Added: trunk/LayoutTests/inspector/styles/vendor-prefixes.html (0 => 109772)
--- trunk/LayoutTests/inspector/styles/vendor-prefixes.html (rev 0)
+++ trunk/LayoutTests/inspector/styles/vendor-prefixes.html 2012-03-05 18:57:48 UTC (rev 109772)
@@ -0,0 +1,44 @@
+<html>
+<head>
+<style>
+#inspected {
+ -apple-opacity: 0.35;
+ -webkit-opacity: 0.5;
+ opacity: 1;
+ -khtml-opacity: 0.25;
+}
+
+#inspected {
+ -apple-opacity: 0.75;
+}
+
+</style>
+<script src=""
+<script src=""
+<script>
+
+function test()
+{
+ WebInspector.showPanel("elements");
+ InspectorTest.selectNodeAndWaitForStylesWithComputed("inspected", dumpAllStyles);
+
+ function dumpAllStyles()
+ {
+ InspectorTest.dumpSelectedElementStyles();
+ InspectorTest.completeTest();
+ }
+}
+
+</script>
+</head>
+
+<body _onload_="runTest()">
+<p>
+Tests that properties with WebKit vendor-specific prefixes ("-apple-", "-webkit-", and "-khtml-") are treated the same as those without the prefix.
+</p>
+
+<div id="inspected">Text</div>
+<div id="other"></div>
+
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (109771 => 109772)
--- trunk/Source/WebCore/ChangeLog 2012-03-05 18:57:38 UTC (rev 109771)
+++ trunk/Source/WebCore/ChangeLog 2012-03-05 18:57:48 UTC (rev 109772)
@@ -1,3 +1,20 @@
+2012-03-05 Alexander Pavlov <apav...@chromium.org>
+
+ Web Inspector: CSS inactive property check should account for vendor prefixes
+ https://bugs.webkit.org/show_bug.cgi?id=80225
+
+ Reviewed by Pavel Feldman.
+
+ Test: inspector/styles/vendor-prefixes.html
+
+ * inspector/InspectorStyleSheet.cpp:
+ (WebCore::InspectorStyle::populateObjectWithStyleProperties):
+ * inspector/front-end/StylesSidebarPane.js:
+ (WebInspector.StylesSidebarPane.alteredHexNumber):
+ (WebInspector.StylesSidebarPane.canonicalPropertyName):
+ (WebInspector.StylesSidebarPane.prototype._markUsedProperties):
+ (WebInspector.StylePropertiesSection.prototype.isPropertyOverloaded):
+
2012-03-05 Adam Barth <aba...@webkit.org>
Geolocation should use a ScriptExecutionContext as its context object
Modified: trunk/Source/WebCore/inspector/InspectorStyleSheet.cpp (109771 => 109772)
--- trunk/Source/WebCore/inspector/InspectorStyleSheet.cpp 2012-03-05 18:57:38 UTC (rev 109771)
+++ trunk/Source/WebCore/inspector/InspectorStyleSheet.cpp 2012-03-05 18:57:48 UTC (rev 109772)
@@ -30,6 +30,7 @@
#include "CSSImportRule.h"
#include "CSSMediaRule.h"
#include "CSSParser.h"
+#include "CSSPropertyNames.h"
#include "CSSPropertySourceData.h"
#include "CSSRule.h"
#include "CSSRuleList.h"
@@ -484,7 +485,10 @@
// Parsed property overrides any property with the same name. Non-parsed property overrides
// previous non-parsed property with the same name (if any).
bool shouldInactivate = false;
- HashMap<String, RefPtr<InspectorObject> >::iterator activeIt = propertyNameToPreviousActiveProperty.find(name);
+ CSSPropertyID propertyId = static_cast<CSSPropertyID>(cssPropertyID(name));
+ // Canonicalize property names to treat non-prefixed and vendor-prefixed property names the same (opacity vs. -webkit-opacity).
+ String canonicalPropertyName = propertyId ? String(getPropertyName(propertyId)) : name;
+ HashMap<String, RefPtr<InspectorObject> >::iterator activeIt = propertyNameToPreviousActiveProperty.find(canonicalPropertyName);
if (activeIt != propertyNameToPreviousActiveProperty.end()) {
if (propertyEntry.parsedOk)
shouldInactivate = true;
@@ -495,12 +499,12 @@
shouldInactivate = true;
}
} else
- propertyNameToPreviousActiveProperty.set(name, property);
+ propertyNameToPreviousActiveProperty.set(canonicalPropertyName, property);
if (shouldInactivate) {
activeIt->second->setString("status", "inactive");
activeIt->second->remove("shorthandName");
- propertyNameToPreviousActiveProperty.set(name, property);
+ propertyNameToPreviousActiveProperty.set(canonicalPropertyName, property);
}
} else {
bool implicit = m_style->isPropertyImplicit(name);
Modified: trunk/Source/WebCore/inspector/front-end/StylesSidebarPane.js (109771 => 109772)
--- trunk/Source/WebCore/inspector/front-end/StylesSidebarPane.js 2012-03-05 18:57:38 UTC (rev 109771)
+++ trunk/Source/WebCore/inspector/front-end/StylesSidebarPane.js 2012-03-05 18:57:48 UTC (rev 109772)
@@ -189,8 +189,18 @@
for (var i = 0, lengthDelta = hexString.length - resultString.length; i < lengthDelta; ++i)
resultString = "0" + resultString;
return resultString;
-},
+}
+WebInspector.StylesSidebarPane.canonicalPropertyName = function(name)
+{
+ if (!name || name.length < 9 || name.charAt(0) !== "-")
+ return name;
+ var match = name.match(/(?:-webkit-|-khtml-|-apple-)(.+)/);
+ if (!match)
+ return name;
+ return match[1];
+}
+
WebInspector.StylesSidebarPane.prototype = {
_contextMenuEventFired: function(event)
{
@@ -563,26 +573,26 @@
var property = allProperties[j];
if (!property.isLive || !property.parsedOk)
continue;
- var name = property.name;
+ var canonicalName = WebInspector.StylesSidebarPane.canonicalPropertyName(property.name);
if (!priorityUsed && property.priority.length)
priorityUsed = true;
// If the property name is already used by another rule then this rule's
// property is overloaded, so don't add it to the rule's usedProperties.
- if (!(name in usedProperties))
- styleRule.usedProperties[name] = true;
+ if (!(canonicalName in usedProperties))
+ styleRule.usedProperties[canonicalName] = true;
}
// Add all the properties found in this style to the used properties list.
// Do this here so only future rules are affect by properties used in this rule.
- for (var name in styleRules[i].usedProperties)
- usedProperties[name] = true;
+ for (var canonicalName in styleRules[i].usedProperties)
+ usedProperties[canonicalName] = true;
}
if (priorityUsed) {
// Walk the properties again and account for !important.
- var foundPriorityProperties = [];
+ var foundPriorityProperties = {};
// Walk in direct order to detect the active/most specific rule providing a priority
// (in this case all subsequent !important values get canceled.)
@@ -596,15 +606,15 @@
var property = allProperties[j];
if (!property.isLive)
continue;
- var name = property.name;
+ var canonicalName = WebInspector.StylesSidebarPane.canonicalPropertyName(property.name);
if (property.priority.length) {
- if (!(name in foundPriorityProperties))
- styleRules[i].usedProperties[name] = true;
+ if (!(canonicalName in foundPriorityProperties))
+ styleRules[i].usedProperties[canonicalName] = true;
else
- delete styleRules[i].usedProperties[name];
- foundPriorityProperties[name] = true;
- } else if (name in foundPriorityProperties)
- delete styleRules[i].usedProperties[name];
+ delete styleRules[i].usedProperties[canonicalName];
+ foundPriorityProperties[canonicalName] = true;
+ } else if (canonicalName in foundPriorityProperties)
+ delete styleRules[i].usedProperties[canonicalName];
}
}
}
@@ -1032,7 +1042,8 @@
return false;
}
- var used = (propertyName in this._usedProperties);
+ var canonicalName = WebInspector.StylesSidebarPane.canonicalPropertyName(propertyName);
+ var used = (canonicalName in this._usedProperties);
if (used || !shorthand)
return !used;
@@ -1041,7 +1052,7 @@
var longhandProperties = this.styleRule.style.getLonghandProperties(propertyName);
for (var j = 0; j < longhandProperties.length; ++j) {
var individualProperty = longhandProperties[j];
- if (individualProperty.name in this._usedProperties)
+ if (WebInspector.StylesSidebarPane.canonicalPropertyName(individualProperty.name) in this._usedProperties)
return false;
}