+2007-02-22 Timothy Hatcher <timothy@apple.com>
+
+ Reviewed by Darin.
+
+ <rdar://problem/4948887> REGRESSION: Correct differences in public DOM API that inadvertently changed in Leopard
+
+ * bindings/objc/PublicDOMInterfaces.h: Changes return types for two size properties, adds deprecated DOMEventTarget methods.
+ * bindings/scripts/CodeGeneratorObjC.pm: Fixed public API checking for protocols, adds support for ConvertToString.
+ * dom/EventTarget.idl: Marks addEventListener and removeEventListener with the OldStyleObjC attribute.
+ * html/HTMLBaseFontElement.idl: Changes the size property to a DOMString for ObjC only.
+ * html/HTMLInputElement.idl: Changes the size property to a DOMString for ObjC only.
+ * html/HTMLOptionsCollection.idl: Changes the length property to be unsigned.
+
2007-02-22 Adele Peterson <adele@apple.com>
Reviewed by John.
0867D690FE84028FC02AAC07 /* Project object */ = {
isa = PBXProject;
buildConfigurationList = 149C284308902B11008A9EFC /* Build configuration list for PBXProject "WebCore" */;
+ compatibilityVersion = "Xcode 2.4";
hasScannedForEncodings = 1;
knownRegions = (
English,
productRefGroup = 034768DFFF38A50411DB9C8B /* Products */;
projectDirPath = "";
projectRoot = "";
+ shouldCheckCompatibility = 1;
targets = (
93F198A508245E59001E9ABC /* WebCore */,
DD041FBE09D9DDBE0010AF2A /* Derived Sources */,
@interface DOMHTMLBaseFontElement : DOMHTMLElement
@property(copy) NSString *color;
@property(copy) NSString *face;
-@property int size;
+@property(copy) NSString *size;
@end
@interface DOMHTMLBodyElement : DOMHTMLElement
@property int maxLength;
@property(copy) NSString *name;
@property BOOL readOnly;
-@property unsigned size;
+@property(copy) NSString *size;
@property(copy) NSString *src;
@property int tabIndex;
@property(copy) NSString *type;
@end
@interface DOMHTMLOptionsCollection : DOMObject
-@property int length;
+@property unsigned length;
- (DOMNode *)item:(unsigned)index;
- (DOMNode *)namedItem:(NSString *)name;
@end
@end
@protocol DOMEventTarget <NSObject, NSCopying>
+- (void)addEventListener:(NSString *)type :(id <DOMEventListener>)listener :(BOOL)useCapture;
+- (void)removeEventListener:(NSString *)type :(id <DOMEventListener>)listener :(BOOL)useCapture;
- (void)addEventListener:(NSString *)type listener:(id <DOMEventListener>)listener useCapture:(BOOL)useCapture;
- (void)removeEventListener:(NSString *)type listener:(id <DOMEventListener>)listener useCapture:(BOOL)useCapture;
- (BOOL)dispatchEvent:(DOMEvent *)event;
"zone" => "NSObject",
);
-my $sawConflict = 0;
+my $fatalError = 0;
# Default Licence Templates
my $headerLicenceTemplate = << "EOF";
my $class = shift;
my $superClass = shift;
my $defines = shift;
+ my $isProtocol = shift;
my $found = 0;
my $actualSuperClass;
close FILE;
foreach $line (@documentContent) {
- if ($line =~ /^\s?\@interface $class\s?:\s?(\w+)\s?$/) {
- die "error: Public API change. Superclass for \"$class\" differs ($1 != $superClass)" if $superClass ne $1;
+ if (!$isProtocol && $line =~ /^\s*\@interface\s*$class\s*:\s*(\w+)\s*/) {
+ if ($superClass ne $1) {
+ warn "Public API change. Superclass for \"$class\" differs ($1 != $superClass)";
+ $fatalError = 1;
+ }
+
+ $found = 1;
+ next;
+ } elsif ($isProtocol && $line =~ /^\s*\@protocol $class\s*/) {
$found = 1;
next;
}
my $dataNode = shift;
my $defines = shift;
- $sawConflict = 0;
+ $fatalError = 0;
my $name = $dataNode->name;
my $className = GetClassName($name);
$isProtocol = $dataNode->extendedAttributes->{ObjCProtocol};
$noImpl = $dataNode->extendedAttributes->{ObjCCustomImplementation} || $isProtocol;
- ReadPublicInterfaces($className, $parentClassName, $defines);
+ ReadPublicInterfaces($className, $parentClassName, $defines, $isProtocol);
# Start actual generation..
$object->GenerateHeader($dataNode);
# Check for missing public API
if (keys %publicInterfaces > 0) {
my $missing = join("\n", keys %publicInterfaces);
- die "error: Public API change. There are missing public properties and/or methods from the \"$className\" class.\n$missing\n";
+ warn "Public API change. There are missing public properties and/or methods from the \"$className\" class.\n$missing\n";
+ $fatalError = 1;
}
- die if $sawConflict;
+ die if $fatalError;
}
# Params: 'idlDocument' struct
my $conflict = $conflictMethod{$attributeName};
if ($conflict) {
warn "$className conflicts with $conflict method $attributeName\n";
- $sawConflict = 1;
+ $fatalError = 1;
}
$conflict = $conflictMethod{$setterName};
if ($conflict) {
warn "$className conflicts with $conflict method $setterName\n";
- $sawConflict = 1;
+ $fatalError = 1;
}
if ($buildingForLeopardOrLater) {
my $conflict = $conflictMethod{$methodName};
if ($conflict) {
warn "$className conflicts with $conflict method $methodName\n";
- $sawConflict = 1;
+ $fatalError = 1;
+ }
+
+ if ($isProtocol && !$newPublicClass && !defined $publicInterfaces{$functionSig}) {
+ warn "Protocol method $functionSig is not in PublicDOMInterfaces.h. Protocols require all methods to be public";
+ $fatalError = 1;
}
my $public = ($publicInterfaces{$functionSig} or $newPublicClass);
push(@deprecatedHeaderFunctions, $deprecatedFunctionSig);
$deprecatedFunctionKey =~ s/\n$//; # remove the newline
+
+ unless (defined $publicInterfaces{$deprecatedFunctionKey}) {
+ warn "Deprecated method $deprecatedFunctionKey is not in PublicDOMInterfaces.h. All deprecated methods need to be public, or should have the OldStyleObjC IDL attribute removed";
+ $fatalError = 1;
+ }
+
delete $publicInterfaces{$deprecatedFunctionKey};
}
}
}
}
+ if (@deprecatedHeaderFunctions > 0 && $isProtocol) {
+ push(@headerContent, @deprecatedHeaderFunctions);
+ }
+
# - End @interface or @protocol
push(@headerContent, "\@end\n");
- if (@deprecatedHeaderFunctions > 0) {
+ if (@deprecatedHeaderFunctions > 0 && !$isProtocol) {
# - Deprecated category @interface
push(@headerContent, "\n\@interface $className (" . $className . "Deprecated)\n");
push(@headerContent, @deprecatedHeaderFunctions);
push(@customGetterContent, " // This node iterator was created from the C++ side.\n");
$getterContentHead = "[$attributeClassName $typeMaker:WTF::getPtr(" . $getterContentHead;
$getterContentTail .= ")]";
+ } elsif ($attribute->signature->extendedAttributes->{"ConvertToString"}) {
+ $getterContentHead = "WebCore::String::number(" . $getterContentHead;
+ $getterContentTail .= ")";
} elsif ($attribute->signature->extendedAttributes->{"ConvertFromString"}) {
$getterContentTail .= ".toInt()";
} elsif ($codeGenerator->IsPodType($idlType)) {
my $argName = "new" . ucfirst($attributeInterfaceName);
my $arg = GetObjCTypeGetter($argName, $idlType);
+ # The definition of ConvertFromString and ConvertToString is flipped for the setter
if ($attribute->signature->extendedAttributes->{"ConvertFromString"}) {
$arg = "WebCore::String::number($arg)";
+ } elsif ($attribute->signature->extendedAttributes->{"ConvertToString"}) {
+ $arg = "WebCore::String($arg).toInt()";
}
my $setterSig = "- (void)$setterName:($attributeType)$argName\n";
// Introduced in DOM Level 2:
interface [ObjCProtocol] EventTarget {
- void addEventListener(in DOMString type,
- in EventListener listener,
- in boolean useCapture);
- void removeEventListener(in DOMString type,
- in EventListener listener,
- in boolean useCapture);
+ [OldStyleObjC] void addEventListener(in DOMString type,
+ in EventListener listener,
+ in boolean useCapture);
+ [OldStyleObjC] void removeEventListener(in DOMString type,
+ in EventListener listener,
+ in boolean useCapture);
boolean dispatchEvent(in Event event)
raises(EventException);
};
interface [LegacyParent=KJS::JSHTMLElement, GenerateConstructor] HTMLBaseFontElement : HTMLElement {
attribute DOMString color;
attribute DOMString face;
+#if defined(LANGUAGE_OBJECTIVE_C)
+ attribute [ConvertToString] DOMString size; // this changed to a long, but our existing API is a string
+#else
attribute long size;
+#endif
};
}
attribute long maxLength;
attribute DOMString name;
attribute boolean readOnly;
+#if defined(LANGUAGE_OBJECTIVE_C)
+ attribute [ConvertToString] DOMString size; // DOM level 2 changed this to a long, but our existing API is a string
+#else
attribute unsigned long size; // Changed string -> long as part of DOM level 2
+#endif
attribute DOMString src;
attribute long tabIndex;
attribute DOMString type; // readonly dropped as part of DOM level 2
module html {
- // FIXME: the spec say that HTMLOptionsCollection should not have a parent class
+ // FIXME: The W3C spec says that HTMLOptionsCollection should not have a parent class.
interface [LegacyParent=KJS::JSHTMLCollection, HasCustomIndexSetter] HTMLOptionsCollection : HTMLCollection {
attribute long selectedIndex;
- attribute [Custom] long length
+ attribute [Custom] unsigned long length
setter raises (DOMException);
void add(in HTMLOptionElement option, in [Optional] unsigned long index)