Reviewed by Darin.
- Added support for strings that masquerade as undefined. Currently used
by WebCore to implement undetectable style.filter.
The name is a little long, but it's only used in one line of code, so I
thought clarity should win over brevity.
* JavaScriptCore.exp:
* JavaScriptCore.xcodeproj/project.pbxproj:
* kjs/object.h:
* kjs/string_object.h:
(KJS::StringInstanceThatMasqueradesAsUndefined::StringInstanceThatMasqueradesAsUndefined):
(KJS::StringInstanceThatMasqueradesAsUndefined::masqueradeAsUndefined):
(KJS::StringInstanceThatMasqueradesAsUndefined::toBoolean):
LayoutTests:
Test for undetectable style.filter property.
* fast/dom/undetectable-style-filter-expected.txt: Added.
* fast/dom/undetectable-style-filter.html: Added.
WebCore:
Reviewed by Darin.
- Fixed <rdar://problem/
4507265> REGRESSION: overlays don't work on
HousingMaps.com (Google Maps-based site)
- Made style.filter undetectable, like document.all.
Unfortunately, the SVG spec-makers invented a CSS attribute named 'filter',
which conflicts with IE's custom CSS attribute by the same name. Web programs
like the Google maps API test for style.filter, and assume it's the IE
style.filter if they find it, so we need to make style.filter undetectable
to avoid breaking them.
An alternative solution would be to hotwire a delorean, go back in time,
and beg the web standards makers to make standards that work on the web.
* bindings/js/kjs_css.cpp:
(KJS::DOMCSSStyleDeclaration::cssPropertyGetter):
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@15557
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2006-07-21 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Darin.
+
+ - Added support for strings that masquerade as undefined. Currently used
+ by WebCore to implement undetectable style.filter.
+
+ The name is a little long, but it's only used in one line of code, so I
+ thought clarity should win over brevity.
+
+ * JavaScriptCore.exp:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * kjs/object.h:
+ * kjs/string_object.h:
+ (KJS::StringInstanceThatMasqueradesAsUndefined::StringInstanceThatMasqueradesAsUndefined):
+ (KJS::StringInstanceThatMasqueradesAsUndefined::masqueradeAsUndefined):
+ (KJS::StringInstanceThatMasqueradesAsUndefined::toBoolean):
+
2006-07-20 Steve Falkenburg <sfalken@apple.com>
Fix the build
+
_JSCheckScriptSyntax
_JSClassCreate
_JSClassRelease
__ZN3KJS12jsNumberCellEd
__ZN3KJS13SavedBuiltinsC1Ev
__ZN3KJS13SavedBuiltinsD1Ev
+__ZN3KJS14StringInstance14deletePropertyEPNS_9ExecStateERKNS_10IdentifierE
+__ZN3KJS14StringInstance16getPropertyNamesEPNS_9ExecStateERNS_17PropertyNameArrayE
+__ZN3KJS14StringInstance18getOwnPropertySlotEPNS_9ExecStateERKNS_10IdentifierERNS_12PropertySlotE
+__ZN3KJS14StringInstance3putEPNS_9ExecStateERKNS_10IdentifierEPNS_7JSValueEi
+__ZN3KJS14StringInstance4infoE
+__ZN3KJS14StringInstanceC1EPNS_8JSObjectERKNS_7UStringE
+__ZN3KJS14StringInstanceC2EPNS_8JSObjectERKNS_7UStringE
__ZN3KJS15SavedPropertiesC1Ev
__ZN3KJS15SavedPropertiesD1Ev
__ZN3KJS16RuntimeObjectImp4infoE
__ZNK3KJS11Interpreter12saveBuiltinsERNS_13SavedBuiltinsE
__ZNK3KJS11Interpreter15builtinFunctionEv
__ZNK3KJS11Interpreter22builtinObjectPrototypeEv
+__ZNK3KJS11Interpreter22builtinStringPrototypeEv
__ZNK3KJS11Interpreter24builtinFunctionPrototypeEv
__ZNK3KJS11PropertyMap3getERKNS_10IdentifierE
__ZNK3KJS11PropertyMap4saveERNS_15SavedPropertiesE
__ZNK3KJS8JSObject9classNameEv
__ZNK3KJS8JSObject9toBooleanEPNS_9ExecStateE
__ZNK3KJS9ExecState18lexicalInterpreterEv
+__ZTVN3KJS14StringInstanceE
__ZTVN3KJS19InternalFunctionImpE
__ZTVN3KJS8JSObjectE
_kJSClassDefinitionEmpty
bool getPropertyAttributes(const Identifier& propertyName, unsigned& attributes) const;
- // Returns whether the object should be treated as undefined when doing equality comparisons
+ // WebCore uses this to make document.all and style.filter undetectable
virtual bool masqueradeAsUndefined() const { return false; }
// This get function only looks at the property map.
static JSValue *indexGetter(ExecState *exec, JSObject *, const Identifier&, const PropertySlot &slot);
};
+ // WebCore uses this to make style.filter undetectable
+ class StringInstanceThatMasqueradesAsUndefined : public StringInstance {
+ public:
+ StringInstanceThatMasqueradesAsUndefined(JSObject* proto, const UString& string)
+ : StringInstance(proto, string) { }
+ virtual bool masqueradeAsUndefined() const { return true; }
+ virtual bool toBoolean(ExecState*) const { return false; }
+ };
+
/**
* @internal
*
+2006-07-21 Geoffrey Garen <ggaren@apple.com>
+
+ Test for undetectable style.filter property.
+
+ * fast/dom/undetectable-style-filter-expected.txt: Added.
+ * fast/dom/undetectable-style-filter.html: Added.
+
2006-07-21 Justin Garcia <justin.garcia@apple.com>
Reviewed by john
--- /dev/null
+This page tests whether the CSS 'filter' property is undetectable. If the test passes, you'll see a series of 'PASS' messages below.
+
+PASS: typeof document.body.style.filter should be undefined and is.
+PASS: document.body.style.filter ? true : false should be false and is.
+PASS: document.body.style.filter == undefined should be true and is.
+
--- /dev/null
+<html>
+<head>
+<script>
+function print(message, color)
+{
+ var paragraph = document.createElement("div");
+ paragraph.appendChild(document.createTextNode(message));
+ paragraph.style.fontFamily = "monospace";
+ if (color)
+ paragraph.style.color = color;
+ document.getElementById("console").appendChild(paragraph);
+}
+
+function shouldBe(a, b)
+{
+ var evalA;
+ try {
+ evalA = eval(a);
+ } catch(e) {
+ evalA = e;
+ }
+
+ if (evalA == b)
+ print("PASS: " + a + " should be " + b + " and is.", "green");
+ else
+ print("FAIL: " + a + " should be " + b + " but instead is " + evalA + ".", "red");
+}
+
+function test()
+{
+ if (window.layoutTestController)
+ layoutTestController.dumpAsText();
+
+ shouldBe("typeof document.body.style.filter", "undefined");
+ shouldBe("document.body.style.filter ? true : false", false);
+ shouldBe("document.body.style.filter == undefined", true);
+}
+</script>
+</head>
+
+<body onload="test();">
+<p>This page tests whether the CSS 'filter' property is undetectable. If the test passes, you'll see a series of 'PASS' messages below.</p>
+<hr>
+
+<div id='console'></div>
+
+</body>
+</html>
+2006-07-21 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Darin.
+
+ - Fixed <rdar://problem/4507265> REGRESSION: overlays don't work on
+ HousingMaps.com (Google Maps-based site)
+
+ - Made style.filter undetectable, like document.all.
+
+ Unfortunately, the SVG spec-makers invented a CSS attribute named 'filter',
+ which conflicts with IE's custom CSS attribute by the same name. Web programs
+ like the Google maps API test for style.filter, and assume it's the IE
+ style.filter if they find it, so we need to make style.filter undetectable
+ to avoid breaking them.
+
+ An alternative solution would be to hotwire a delorean, go back in time,
+ and beg the web standards makers to make standards that work on the web.
+
+ * bindings/js/kjs_css.cpp:
+ (KJS::DOMCSSStyleDeclaration::cssPropertyGetter):
+
2006-07-20 Justin Garcia <justin.garcia@apple.com>
Reviewed by john
--- /dev/null
+#include <JavaScriptCore/string_object.h>
#include "StyleSheetList.h"
#include "kjs_dom.h"
+#include <kjs/string_object.h>
+
#include "kjs_css.lut.h"
using namespace WebCore;
return jsNumber(static_pointer_cast<CSSPrimitiveValue>(v)->getFloatValue(CSSPrimitiveValue::CSS_PX));
return jsStringOrNull(v->cssText());
}
+
// If the property is a shorthand property (such as "padding"),
// it can only be accessed using getPropertyValue.
+
+ // Make the SVG 'filter' attribute undetectable, to avoid confusion with the IE 'filter' attribute.
+ if (propertyName == "filter")
+ return new StringInstanceThatMasqueradesAsUndefined(exec->lexicalInterpreter()->builtinStringPrototype(), thisObj->m_impl->getPropertyValue(prop));
+
return jsString(thisObj->m_impl->getPropertyValue(prop));
}