Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(234)

Unified Diff: third_party/WebKit/Source/bindings/core/v8/custom/V8CSSStyleDeclarationCustom.cpp

Issue 1607653002: Remove getComputedStyle(e).css* properties (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove unnecessary property name prefix check Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/bindings/core/v8/custom/V8CSSStyleDeclarationCustom.cpp
diff --git a/third_party/WebKit/Source/bindings/core/v8/custom/V8CSSStyleDeclarationCustom.cpp b/third_party/WebKit/Source/bindings/core/v8/custom/V8CSSStyleDeclarationCustom.cpp
index 2a7ad49cd6ba066b269040d70b46bde4411eee9e..63a74be02043944bd5e9a5d8399104190f4ab053 100644
--- a/third_party/WebKit/Source/bindings/core/v8/custom/V8CSSStyleDeclarationCustom.cpp
+++ b/third_party/WebKit/Source/bindings/core/v8/custom/V8CSSStyleDeclarationCustom.cpp
@@ -39,7 +39,6 @@
#include "core/css/CSSValue.h"
#include "core/css/parser/CSSParser.h"
#include "core/events/EventTarget.h"
-#include "core/frame/UseCounter.h"
#include "wtf/ASCIICType.h"
#include "wtf/PassRefPtr.h"
#include "wtf/RefPtr.h"
@@ -80,7 +79,7 @@ static bool hasCSSPropertyNamePrefix(const String& propertyName, const char* pre
return false;
}
-static CSSPropertyID parseCSSPropertyID(v8::Isolate* isolate, const String& propertyName)
+static CSSPropertyID parseCSSPropertyID(const String& propertyName)
{
unsigned length = propertyName.length();
if (!length)
@@ -92,12 +91,7 @@ static CSSPropertyID parseCSSPropertyID(v8::Isolate* isolate, const String& prop
unsigned i = 0;
bool hasSeenDash = false;
- if (hasCSSPropertyNamePrefix(propertyName, "css")) {
- i += 3;
- // getComputedStyle(elem).cssX is a non-standard behaviour
- // Measure this behaviour as CSSXGetComputedStyleQueries.
- UseCounter::countDeprecationIfNotPrivateScript(isolate, currentExecutionContext(isolate), UseCounter::CSSXGetComputedStyleQueries);
- } else if (hasCSSPropertyNamePrefix(propertyName, "webkit"))
+ if (hasCSSPropertyNamePrefix(propertyName, "webkit"))
builder.append('-');
else if (isASCIIUpper(propertyName[0]))
return CSSPropertyInvalid;
@@ -136,7 +130,7 @@ static CSSPropertyID parseCSSPropertyID(v8::Isolate* isolate, const String& prop
// Example: 'backgroundPositionY' -> 'background-position-y'
//
// Also, certain prefixes such as 'css-' are stripped.
-static CSSPropertyID cssPropertyInfo(v8::Local<v8::String> v8PropertyName, v8::Isolate* isolate)
+static CSSPropertyID cssPropertyInfo(v8::Local<v8::String> v8PropertyName)
{
String propertyName = toCoreString(v8PropertyName);
typedef HashMap<String, CSSPropertyID> CSSPropertyIDMap;
@@ -145,7 +139,7 @@ static CSSPropertyID cssPropertyInfo(v8::Local<v8::String> v8PropertyName, v8::I
if (iter != map.end())
return iter->value;
- CSSPropertyID unresolvedProperty = parseCSSPropertyID(isolate, propertyName);
+ CSSPropertyID unresolvedProperty = parseCSSPropertyID(propertyName);
map.add(propertyName, unresolvedProperty);
ASSERT(!unresolvedProperty || CSSPropertyMetadata::isEnabledProperty(unresolvedProperty));
return unresolvedProperty;
@@ -186,7 +180,7 @@ void V8CSSStyleDeclaration::namedPropertyQueryCustom(v8::Local<v8::Name> v8Name,
return;
// NOTE: cssPropertyInfo lookups incur several mallocs.
// Successful lookups have the same cost the first time, but are cached.
- if (cssPropertyInfo(v8Name.As<v8::String>(), info.GetIsolate())) {
+ if (cssPropertyInfo(v8Name.As<v8::String>())) {
v8SetReturnValueInt(info, 0);
return;
}
@@ -195,7 +189,7 @@ void V8CSSStyleDeclaration::namedPropertyQueryCustom(v8::Local<v8::Name> v8Name,
void V8CSSStyleDeclaration::namedPropertyGetterCustom(v8::Local<v8::Name> name, const v8::PropertyCallbackInfo<v8::Value>& info)
{
// Search the style declaration.
- CSSPropertyID unresolvedProperty = cssPropertyInfo(name.As<v8::String>(), info.GetIsolate());
+ CSSPropertyID unresolvedProperty = cssPropertyInfo(name.As<v8::String>());
// Do not handle non-property names.
if (!unresolvedProperty)
@@ -219,7 +213,7 @@ void V8CSSStyleDeclaration::namedPropertySetterCustom(v8::Local<v8::Name> name,
if (!name->IsString())
return;
CSSStyleDeclaration* impl = V8CSSStyleDeclaration::toImpl(info.Holder());
- CSSPropertyID unresolvedProperty = cssPropertyInfo(name.As<v8::String>(), info.GetIsolate());
+ CSSPropertyID unresolvedProperty = cssPropertyInfo(name.As<v8::String>());
if (!unresolvedProperty)
return;

Powered by Google App Engine
This is Rietveld 408576698