Commit a28a9152 authored by darin@apple.com's avatar darin@apple.com

WebCore:

        Reviewed by Geoff.

        - fix <rdar://problem/5715692> REGRESSION (r28570): JavaScript window.scrollTo()
          calls no longer accept 'undefined' values

        By default, we should accept non-numeric parameters and non-integral numbers for
        parameters that expect integers, without throwing exceptions.

        While creating the test for this, I ran into a couple minor bugs with the
        functions involved, and this patch fixes those too.

        Test: fast/dom/non-numeric-values-numeric-parameters.html

        * bindings/js/JSHTMLOptionsCollectionCustom.cpp:
        (WebCore::JSHTMLOptionsCollection::add): Added. This function has unusual behavior
        when passed non-integral values for its second parameter, so it needs to be written
        by hand. I think that [Custom] is better here than inventing a new keyword.

        * bindings/scripts/CodeGeneratorJS.pm: Changed default for "long" and "unsigned long"
        to ignore errors rather than failing due to type differences. Also changed a couple
        functions to use hashes.

        * css/CSSStyleSheet.h:
        (WebCore::CSSStyleSheet::removeRule): Remove overload of removeRule without a second
        parameters. While we do allow this from JavaScript, it's not a true optional parameter,
        but rather just a case of "you can omit parameters and they are treated as undefined"
        combined with "undefined turns into 0 when passed to a function that takes an integer".
        * css/CSSStyleSheet.idl: Removed [Optional] on the index parameter for removeRule.
        This is not truly an optional parameter.

        * dom/ProgressEvent.cpp:
        (WebCore::ProgressEvent::initProgressEvent): Updated this function to match other
        DOM event init functions -- important to do nothing if this is called on the an
        already-dispatched event and we need to respect the bubble and cancelable arguments.
        Also removed initProgressEventNS. We don't support namespaced events, and if we add
        support, it should be across all event classes, not just ProgressEvent.
        * dom/ProgressEvent.h: Removed initProgressEventNS.
        * dom/ProgressEvent.idl: Ditto.

        * dom/Range.cpp:
        (WebCore::Range::createContextualFragment): Added a check for 0. This can happen
        if the passed-in start container is a node that's not an HTML element and also
        does not have a parent.

        * html/HTMLOptionsCollection.idl: Added the [Custom] attribute to add, since the
        rules for processing its parameters are unusual.

        * page/DOMSelection.cpp: Removed the version of setPosition that has only
        one parameter. The offset is not really optional.
        * page/DOMSelection.h: Ditto.
        * page/DOMSelection.idl: Removed the [Optional] keyword for the second parameter of
        setPosition. It's not a true optional parameter (see discussion of removeRule above).

        * page/DOMWindow.cpp:
        (WebCore::DOMWindow::adjustWindowRect): Simplified logic for constraining the X
        and Y coordinates, in a way that makes them work even when the window coordinates
        are infinite. Also strengthened the assertion.

WebKitTools:

        Reviewed by Geoff.

        * Scripts/make-js-test-wrappers: Look at the whole LayoutTests tree, not just the fast
        and svg subdirectories. Added some more exceptions for the benefit of the fast/dom
        subdirectory.

LayoutTests:

        Reviewed by Geoff.

        - test for <rdar://problem/5715692> REGRESSION (r28570): JavaScript window.scrollTo() calls
          no longer accept 'undefined' values

        * fast/dom/non-numeric-values-numeric-parameters-expected.txt: Added.
        * fast/dom/non-numeric-values-numeric-parameters.html: Added.
        * fast/dom/resources/TEMPLATE.html: Copied from fast/dom/Element/resources/TEMPLATE.html.
        * fast/dom/resources/non-numeric-values-numeric-parameters.js: Added.

        * editing/selection/extend-expected.txt: Updated.
        * editing/selection/extend.html: Removed test that extend throws if passed only one parameter.
        There's no reason for us to be strict about this -- we generally treat missing parameters the
        same as if "undefined" had been passed with few exceptions.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@29963 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 1212ffc1
2008-02-04 Darin Adler <darin@apple.com>
Reviewed by Geoff.
- test for <rdar://problem/5715692> REGRESSION (r28570): JavaScript window.scrollTo() calls
no longer accept 'undefined' values
* fast/dom/non-numeric-values-numeric-parameters-expected.txt: Added.
* fast/dom/non-numeric-values-numeric-parameters.html: Added.
* fast/dom/resources/TEMPLATE.html: Copied from fast/dom/Element/resources/TEMPLATE.html.
* fast/dom/resources/non-numeric-values-numeric-parameters.js: Added.
* editing/selection/extend-expected.txt: Updated.
* editing/selection/extend.html: Removed test that extend throws if passed only one parameter.
There's no reason for us to be strict about this -- we generally treat missing parameters the
same as if "undefined" had been passed with few exceptions.
2008-02-03 Oliver Hunt <oliver@apple.com>
RS=Eric.
......
......@@ -5,5 +5,4 @@ Success: s.extend(span2.firstChild, -1) raised Error: INDEX_SIZE_ERR: DOM Except
Success: window.getSelection() is b.
Success: window.getSelection() is arbaz.
Success: s.extend() raised Error: TYPE_MISMATCH_ERR: DOM Exception 17.
Success: s.extend(span3) raised Error: TYPE_MISMATCH_ERR: DOM Exception 17.
Success: s.extend(null, 0) raised Error: TYPE_MISMATCH_ERR: DOM Exception 17.
......@@ -56,7 +56,6 @@ s.extend(span3, 1);
shouldBe('window.getSelection()', 'arbaz');
shouldThrow('s.extend()');
shouldThrow('s.extend(span3)');
shouldThrow('s.extend(null, 0)');
</script>
......
This tests the behavior of non-numeric values in contexts where the DOM has a numeric parameter.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS nonNumericPolicy('document.createTextNode("a").substringData(x, 0)') is 'any type allowed'
PASS nonNumericPolicy('document.createTextNode("a").substringData(0, x)') is 'any type allowed'
PASS nonNumericPolicy('document.createTextNode("a").insertData(x, "b")') is 'any type allowed'
PASS nonNumericPolicy('document.createTextNode("a").deleteData(x, 0)') is 'any type allowed'
PASS nonNumericPolicy('document.createTextNode("a").deleteData(0, x)') is 'any type allowed'
PASS nonNumericPolicy('document.createTextNode("a").replaceData(x, 0, "b")') is 'any type allowed'
PASS nonNumericPolicy('document.createTextNode("a").replaceData(0, x, "b")') is 'any type allowed'
PASS nonNumericPolicy('createCSSMediaRule().insertRule(ruleText, x)') is 'any type allowed'
PASS nonNumericPolicy('createCSSMediaRule().deleteRule(x)') is 'any type allowed'
PASS nonNumericPolicy('createCSSRuleList().item(x)') is 'any type allowed'
PASS nonNumericPolicy('createCSSStyleDeclaration().item(x)') is 'any type allowed'
PASS nonNumericPolicy('createCSSStyleSheet().insertRule(ruleText, x)') is 'any type allowed'
PASS nonNumericPolicy('createCSSStyleSheet().deleteRule(x)') is 'any type allowed'
PASS nonNumericPolicy('createCSSStyleSheet().addRule(selector, styleText, x)') is 'any type allowed'
PASS nonNumericPolicy('createCSSStyleSheet().removeRule(x)') is 'any type allowed'
PASS nonNumericPolicy('createCSSValueList().item(x)') is 'any type allowed'
PASS nonNumericPolicy('document.elementFromPoint(x, 0)') is 'any type allowed'
PASS nonNumericPolicy('document.elementFromPoint(0, x)') is 'any type allowed'
PASS nonNumericPolicy('document.body.scrollByLines(x)') is 'any type allowed'
PASS nonNumericPolicy('document.body.scrollByPages(x)') is 'any type allowed'
PASS nonNumericPolicy('document.body.scrollLeft = x') is 'any type allowed'
PASS nonNumericPolicy('document.body.scrollTop = x') is 'any type allowed'
PASS nonNumericPolicy('document.images.item(x)') is 'any type allowed'
PASS nonNumericPolicy('document.createElement("input").setSelectionRange(x, 0)') is 'any type allowed'
PASS nonNumericPolicy('document.createElement("input").setSelectionRange(0, x)') is 'any type allowed'
PASS nonNumericPolicy('createHTMLOptionsCollection().add(document.createElement("option"), x)') is 'number or null allowed (or omitted, but not infinite)'
PASS nonNumericPolicy('createHTMLOptionsCollection().remove(x)') is 'any type allowed'
PASS nonNumericPolicy('createHTMLSelectElement().remove(x)') is 'any type allowed'
PASS nonNumericPolicy('createHTMLSelectElement().item(x)') is 'any type allowed'
PASS nonNumericPolicy('createHTMLTableElement().insertRow(x)') is 'any type allowed'
PASS nonNumericPolicy('createHTMLTableElement().deleteRow(x)') is 'any type allowed'
PASS nonNumericPolicy('createHTMLTableRowElement().insertCell(x)') is 'any type allowed'
PASS nonNumericPolicy('createHTMLTableRowElement().deleteCell(x)') is 'any type allowed'
PASS nonNumericPolicy('createHTMLTableSectionElement().insertRow(x)') is 'any type allowed'
PASS nonNumericPolicy('createHTMLTableSectionElement().deleteRow(x)') is 'any type allowed'
PASS nonNumericPolicy('document.createElement("textarea").setSelectionRange(x, 0)') is 'any type allowed'
PASS nonNumericPolicy('document.createElement("textarea").setSelectionRange(0, x)') is 'any type allowed'
PASS nonNumericPolicy('document.createEvent("KeyboardEvent").initKeyboardEvent("a", false, false, null, "b", x, false, false, false, false, false)') is 'any type allowed'
PASS nonNumericPolicy('createMediaList().item(x)') is 'any type allowed'
PASS nonNumericPolicy('document.createEvent("MouseEvent").initMouseEvent("a", false, false, null, x, 0, 0, 0, 0, false, false, false, false, 0, null)') is 'any type allowed'
PASS nonNumericPolicy('document.createEvent("MouseEvent").initMouseEvent("a", false, false, null, 0, x, 0, 0, 0, false, false, false, false, 0, null)') is 'any type allowed'
PASS nonNumericPolicy('document.createEvent("MouseEvent").initMouseEvent("a", false, false, null, 0, 0, x, 0, 0, false, false, false, false, 0, null)') is 'any type allowed'
PASS nonNumericPolicy('document.createEvent("MouseEvent").initMouseEvent("a", false, false, null, 0, 0, 0, x, 0, false, false, false, false, 0, null)') is 'any type allowed'
PASS nonNumericPolicy('document.createEvent("MouseEvent").initMouseEvent("a", false, false, null, 0, 0, 0, 0, x, false, false, false, false, 0, null)') is 'any type allowed'
PASS nonNumericPolicy('document.createEvent("MouseEvent").initMouseEvent("a", false, false, null, 0, 0, 0, 0, 0, false, false, false, false, x, null)') is 'any type allowed'
PASS nonNumericPolicy('document.body.attributes.item(x)') is 'any type allowed'
PASS nonNumericPolicy('document.createNodeIterator(document, x, null, false)') is 'any type allowed'
PASS nonNumericPolicy('document.getElementsByTagName("div").item(x)') is 'any type allowed'
PASS nonNumericPolicy('document.createEvent("ProgressEvent").initProgressEvent("a", false, false, false, x, 0)') is 'any type allowed'
PASS nonNumericPolicy('document.createEvent("ProgressEvent").initProgressEvent("a", false, false, false, 0, x)') is 'any type allowed'
PASS nonNumericPolicy('document.createRange().setStart(document, x)') is 'any type allowed'
PASS nonNumericPolicy('document.createRange().setEnd(document, x)') is 'any type allowed'
PASS nonNumericPolicy('document.createRange().comparePoint(document, x)') is 'any type allowed'
PASS nonNumericPolicy('document.createRange().isPointInRange(document, x)') is 'any type allowed'
PASS nonNumericPolicy('getSelection().collapse(document, x)') is 'any type allowed'
PASS nonNumericPolicy('getSelection().setBaseAndExtent(document, x, document, 0)') is 'any type allowed'
PASS nonNumericPolicy('getSelection().setBaseAndExtent(document, 0, document, x)') is 'any type allowed'
PASS nonNumericPolicy('getSelection().setPosition(document, x)') is 'any type allowed'
PASS nonNumericPolicy('getSelection().extend(document, x)') is 'any type allowed'
PASS nonNumericPolicy('getSelection().getRangeAt(x)') is 'any type allowed'
PASS nonNumericPolicy('document.styleSheets.item(x)') is 'any type allowed'
PASS nonNumericPolicy('document.createTextNode("a").splitText(x)') is 'any type allowed'
PASS nonNumericPolicy('document.createTreeWalker(document, x, null, false)') is 'any type allowed'
PASS nonNumericPolicy('document.createEvent("UIEvent").initUIEvent("a", false, false, null, x)') is 'any type allowed'
PASS nonNumericPolicy('window.scrollBy(x, 0)') is 'any type allowed'
PASS nonNumericPolicy('window.scrollBy(0, x)') is 'any type allowed'
PASS nonNumericPolicy('window.scrollTo(x, 0)') is 'any type allowed'
PASS nonNumericPolicy('window.scrollTo(0, x)') is 'any type allowed'
PASS nonNumericPolicy('window.scroll(x, 0)') is 'any type allowed'
PASS nonNumericPolicy('window.scroll(0, x)') is 'any type allowed'
PASS nonNumericPolicy('window.moveBy(x, 0)') is 'any type allowed'
PASS nonNumericPolicy('window.moveBy(0, x)') is 'any type allowed'
PASS nonNumericPolicy('window.moveTo(x, 0)') is 'any type allowed'
PASS nonNumericPolicy('window.moveTo(0, x)') is 'any type allowed'
PASS nonNumericPolicy('window.resizeBy(x, 0)') is 'any type allowed'
PASS nonNumericPolicy('window.resizeBy(0, x)') is 'any type allowed'
PASS nonNumericPolicy('window.resizeTo(x, 0)') is 'any type allowed'
PASS nonNumericPolicy('window.resizeTo(0, x)') is 'any type allowed'
PASS successfullyParsed is true
TEST COMPLETE
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<link rel="stylesheet" href="../js/resources/js-test-style.css">
<script src="../js/resources/js-test-pre.js"></script>
</head>
<body>
<p id="description"></p>
<div id="console"></div>
<script src="resources/non-numeric-values-numeric-parameters.js"></script>
<script src="../js/resources/js-test-post.js"></script>
</body>
</html>
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<link rel="stylesheet" href="../js/resources/js-test-style.css">
<script src="../js/resources/js-test-pre.js"></script>
</head>
<body>
<p id="description"></p>
<div id="console"></div>
<script src="YOUR_JS_FILE_HERE"></script>
<script src="../js/resources/js-test-post.js"></script>
</body>
</html>
2008-02-04 Darin Adler <darin@apple.com>
Reviewed by Geoff.
- fix <rdar://problem/5715692> REGRESSION (r28570): JavaScript window.scrollTo()
calls no longer accept 'undefined' values
By default, we should accept non-numeric parameters and non-integral numbers for
parameters that expect integers, without throwing exceptions.
While creating the test for this, I ran into a couple minor bugs with the
functions involved, and this patch fixes those too.
Test: fast/dom/non-numeric-values-numeric-parameters.html
* bindings/js/JSHTMLOptionsCollectionCustom.cpp:
(WebCore::JSHTMLOptionsCollection::add): Added. This function has unusual behavior
when passed non-integral values for its second parameter, so it needs to be written
by hand. I think that [Custom] is better here than inventing a new keyword.
* bindings/scripts/CodeGeneratorJS.pm: Changed default for "long" and "unsigned long"
to ignore errors rather than failing due to type differences. Also changed a couple
functions to use hashes.
* css/CSSStyleSheet.h:
(WebCore::CSSStyleSheet::removeRule): Remove overload of removeRule without a second
parameters. While we do allow this from JavaScript, it's not a true optional parameter,
but rather just a case of "you can omit parameters and they are treated as undefined"
combined with "undefined turns into 0 when passed to a function that takes an integer".
* css/CSSStyleSheet.idl: Removed [Optional] on the index parameter for removeRule.
This is not truly an optional parameter.
* dom/ProgressEvent.cpp:
(WebCore::ProgressEvent::initProgressEvent): Updated this function to match other
DOM event init functions -- important to do nothing if this is called on the an
already-dispatched event and we need to respect the bubble and cancelable arguments.
Also removed initProgressEventNS. We don't support namespaced events, and if we add
support, it should be across all event classes, not just ProgressEvent.
* dom/ProgressEvent.h: Removed initProgressEventNS.
* dom/ProgressEvent.idl: Ditto.
* dom/Range.cpp:
(WebCore::Range::createContextualFragment): Added a check for 0. This can happen
if the passed-in start container is a node that's not an HTML element and also
does not have a parent.
* html/HTMLOptionsCollection.idl: Added the [Custom] attribute to add, since the
rules for processing its parameters are unusual.
* page/DOMSelection.cpp: Removed the version of setPosition that has only
one parameter. The offset is not really optional.
* page/DOMSelection.h: Ditto.
* page/DOMSelection.idl: Removed the [Optional] keyword for the second parameter of
setPosition. It's not a true optional parameter (see discussion of removeRule above).
* page/DOMWindow.cpp:
(WebCore::DOMWindow::adjustWindowRect): Simplified logic for constraining the X
and Y coordinates, in a way that makes them work even when the window coordinates
are infinite. Also strengthened the assertion.
2008-02-04 Alp Toker <alp@atoker.com>
Rubber-stamped by Mark Rowe.
/*
* Copyright (C) 2006 Apple Computer, Inc.
* Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
......@@ -60,14 +60,35 @@ void JSHTMLOptionsCollection::setLength(ExecState* exec, JSValue* value)
setDOMException(exec, ec);
}
void JSHTMLOptionsCollection::indexSetter(KJS::ExecState* exec, unsigned index, KJS::JSValue* value, int attr)
void JSHTMLOptionsCollection::indexSetter(ExecState* exec, unsigned index, JSValue* value, int attr)
{
HTMLOptionsCollection* imp = static_cast<HTMLOptionsCollection*>(impl());
HTMLSelectElement* base = static_cast<HTMLSelectElement*>(imp->base());
selectIndexSetter(base, exec, index, value);
}
KJS::JSValue* JSHTMLOptionsCollection::remove(KJS::ExecState* exec, const KJS::List& args)
JSValue* JSHTMLOptionsCollection::add(ExecState* exec, const List& args)
{
HTMLOptionsCollection* imp = static_cast<HTMLOptionsCollection*>(impl());
HTMLOptionElement* option = toHTMLOptionElement(args[0]);
ExceptionCode ec = 0;
if (args.size() < 2)
imp->add(option, ec);
else {
bool ok;
int index = args[1]->toInt32(exec, ok);
if (exec->hadException())
return jsUndefined();
if (!ok)
ec = TYPE_MISMATCH_ERR;
else
imp->add(option, index, ec);
}
setDOMException(exec, ec);
return jsUndefined();
}
JSValue* JSHTMLOptionsCollection::remove(ExecState* exec, const List& args)
{
HTMLOptionsCollection* imp = static_cast<HTMLOptionsCollection*>(impl());
JSHTMLSelectElement* base = static_cast<JSHTMLSelectElement*>(toJS(exec, imp->base()));
......
......@@ -1275,78 +1275,86 @@ sub GetNativeTypeFromSignature
return GetNativeType($type);
}
my %nativeType = (
"AtomicString" => "AtomicString",
"CompareHow" => "Range::CompareHow",
"DOMString" => "String",
"EventTarget" => "EventTargetNode*",
"SVGLength" => "SVGLength",
"SVGMatrix" => "AffineTransform",
"SVGNumber" => "float",
"SVGPaintType" => "SVGPaint::SVGPaintType",
"SVGPoint" => "FloatPoint",
"SVGRect" => "FloatRect",
"SVGTransform" => "SVGTransform",
"boolean" => "bool",
"double" => "double",
"float" => "float",
"long" => "int",
"unsigned long" => "unsigned",
"unsigned short" => "unsigned short",
);
sub GetNativeType
{
my $type = shift;
return "unsigned" if $type eq "unsigned long";
return $type if $type eq "unsigned short" or $type eq "float" or $type eq "double" or $type eq "AtomicString";
return "bool" if $type eq "boolean";
return "int" if $type eq "long";
return "String" if $type eq "DOMString";
return "Range::CompareHow" if $type eq "CompareHow";
return "EventTargetNode*" if $type eq "EventTarget";
return "FloatRect" if $type eq "SVGRect";
return "FloatPoint" if $type eq "SVGPoint";
return "AffineTransform" if $type eq "SVGMatrix";
return "SVGTransform" if $type eq "SVGTransform";
return "SVGLength" if $type eq "SVGLength";
return "float" if $type eq "SVGNumber";
return "SVGPaint::SVGPaintType" if $type eq "SVGPaintType";
# Default, assume native type is a pointer with same type name as idl type
return $nativeType{$type} if exists $nativeType{$type};
# For all other types, the native type is a pointer with same type name as the IDL type.
return "${type}*";
}
my %typeCanFailConversion = (
"AtomicString" => 0,
"Attr" => 1,
"CompareHow" => 0,
"DOMString" => 0,
"DOMWindow" => 0,
"DocumentType" => 0,
"Element" => 0,
"Event" => 0,
"EventListener" => 0,
"EventTarget" => 0,
"HTMLElement" => 0,
"HTMLOptionElement" => 0,
"Node" => 0,
"NodeFilter" => 0,
"Range" => 0,
"SQLResultSet" => 0,
"SVGAngle" => 0,
"SVGElement" => 0,
"SVGLength" => 0,
"SVGMatrix" => 0,
"SVGNumber" => 0,
"SVGPaintType" => 0,
"SVGPathSeg" => 0,
"SVGPoint" => 0,
"SVGRect" => 0,
"SVGTransform" => 0,
"VoidCallback" => 1,
"XPathEvaluator" => 0,
"XPathNSResolver" => 0,
"XPathResult" => 0,
"boolean" => 0,
"double" => 0,
"float" => 0,
"long" => 0,
"unsigned long" => 0,
"unsigned short" => 0,
);
sub TypeCanFailConversion
{
my $signature = shift;
my $type = $codeGenerator->StripModule($signature->type);
# FIXME: convert to use a hash
return 0 if $type eq "boolean" or
$type eq "float" or
$type eq "double" or
$type eq "AtomicString" or
$type eq "DOMString" or
$type eq "Node" or
$type eq "Element" or
$type eq "DocumentType" or
$type eq "Event" or
$type eq "EventListener" or
$type eq "EventTarget" or
$type eq "Range" or
$type eq "NodeFilter" or
$type eq "DOMWindow" or
$type eq "SQLResultSet" or
$type eq "XPathEvaluator" or
$type eq "XPathNSResolver" or
$type eq "XPathResult" or
$type eq "SVGAngle" or
$type eq "SVGLength" or
$type eq "SVGNumber" or
$type eq "SVGPoint" or
$type eq "SVGTransform" or
$type eq "SVGPathSeg" or
$type eq "SVGMatrix" or
$type eq "SVGRect" or
$type eq "SVGElement" or
$type eq "HTMLElement" or
$type eq "HTMLOptionElement" or
$type eq "unsigned short" or # or can it?
$type eq "CompareHow" or # or can it?
$type eq "SVGPaintType"; # or can it?
return 1 if $type eq "VoidCallback";
if ($type eq "unsigned long" or $type eq "long" or $type eq "Attr") {
$implIncludes{"ExceptionCode.h"} = 1;
return 1;
}
die "Don't know whether a JS value can fail conversion to type $type."
$implIncludes{"ExceptionCode.h"} = 1 if $type eq "Attr";
return $typeCanFailConversion{$type} if exists $typeCanFailConversion{$type};
die "Don't know whether a JS value can fail conversion to type $type.";
}
sub JSValueToNative
......
/*
* (C) 1999-2003 Lars Knoll (knoll@kde.org)
* Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved.
* Copyright (C) 2004, 2006, 2007, 2008 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
......@@ -56,7 +56,6 @@ public:
int addRule(const String& selector, const String& style, int index, ExceptionCode&);
int addRule(const String& selector, const String& style, ExceptionCode&);
void removeRule(unsigned index, ExceptionCode& ec) { deleteRule(index, ec); }
void removeRule(ExceptionCode& ec) { deleteRule(0, ec); }
void addNamespace(CSSParser*, const AtomicString& prefix, const AtomicString& uri);
const AtomicString& determineNamespace(const AtomicString& prefix);
......
/*
* Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
* Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
* Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
*
* This library is free software; you can redistribute it and/or
......@@ -41,7 +41,7 @@ module css {
in DOMString style,
in [Optional] unsigned long index)
raises(DOMException);
void removeRule(in [Optional] unsigned long index)
void removeRule(in unsigned long index)
raises(DOMException);
};
......
/*
* Copyright (C) 2007 Apple Inc. All rights reserved.
* Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
......@@ -26,12 +26,8 @@
#include "config.h"
#include "ProgressEvent.h"
#include "EventNames.h"
namespace WebCore {
using namespace EventNames;
ProgressEvent::ProgressEvent()
: m_lengthComputable(false)
, m_loaded(0)
......@@ -48,30 +44,20 @@ ProgressEvent::ProgressEvent(const AtomicString& type, bool lengthComputable, un
}
void ProgressEvent::initProgressEvent(const AtomicString& typeArg,
bool /*canBubbleArg*/,
bool /*cancelableArg*/,
bool canBubbleArg,
bool cancelableArg,
bool lengthComputableArg,
unsigned loadedArg,
unsigned totalArg)
{
initEvent(typeArg, false, true);
m_lengthComputable = lengthComputableArg;
m_loaded = loadedArg;
m_total = totalArg;
}
if (dispatched())
return;
initEvent(typeArg, canBubbleArg, cancelableArg);
void ProgressEvent::initProgressEventNS(const AtomicString& /*namespaceURI*/,
const AtomicString& typeArg,
bool /*canBubbleArg*/,
bool /*cancelableArg*/,
bool lengthComputableArg,
unsigned loadedArg,
unsigned totalArg)
{
initEvent(typeArg, false, true);
m_lengthComputable = lengthComputableArg;
m_loaded = loadedArg;
m_total = lengthComputableArg ? totalArg : 0;
m_total = totalArg;
}
}
/*
* Copyright (C) 2007 Apple Inc. All rights reserved.
* Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
......@@ -32,7 +32,6 @@ namespace WebCore {
class ProgressEvent : public Event {
public:
ProgressEvent();
ProgressEvent(const AtomicString& type, bool lengthComputable, unsigned loaded, unsigned total);
......@@ -42,13 +41,6 @@ namespace WebCore {
bool lengthComputableArg,
unsigned loadedArg,
unsigned totalArg);
void initProgressEventNS(const AtomicString& namespaceURI,
const AtomicString& typeArg,
bool canBubbleArg,
bool cancelableArg,
bool lengthComputableArg,
unsigned loadedArg,
unsigned totalArg);
bool lengthComputable() const { return m_lengthComputable; }
unsigned loaded() const { return m_loaded; }
......
......@@ -37,13 +37,6 @@ module events {
in boolean lengthComputableArg,
in unsigned long loadedArg,
in unsigned long totalArg);
void initProgressEventNS(in DOMString namespaceURI,
in DOMString typeArg,
in boolean canBubbleArg,
in boolean cancelableArg,
in boolean lengthComputableArg,
in unsigned long loadedArg,
in unsigned long totalArg);
};
}
......@@ -1131,8 +1131,7 @@ PassRefPtr<DocumentFragment> Range::createContextualFragment(const String &html,
}
Node* htmlElement = m_startContainer->isHTMLElement() ? m_startContainer.get() : m_startContainer->parentNode();
if (!htmlElement->isHTMLElement()) {
if (!htmlElement || !htmlElement->isHTMLElement()) {
ec = NOT_SUPPORTED_ERR;
return 0;
}
......
......@@ -32,7 +32,7 @@ module html {
attribute [Custom] unsigned long length
setter raises (DOMException);
void add(in HTMLOptionElement option, in [Optional] unsigned long index)
[Custom] void add(in HTMLOptionElement option, in [Optional] unsigned long index)
raises (DOMException);
[Custom] void remove(in unsigned long index);
......
......@@ -219,13 +219,6 @@ void DOMSelection::setPosition(Node* node, int offset, ExceptionCode& ec)
m_frame->selectionController()->moveTo(VisiblePosition(node, offset, DOWNSTREAM));
}
void DOMSelection::setPosition(Node* node, ExceptionCode& ec)
{
if (!m_frame)
return;
m_frame->selectionController()->moveTo(VisiblePosition(node, 0, DOWNSTREAM));
}
void DOMSelection::modify(const String& alterString, const String& directionString, const String& granularityString)
{
if (!m_frame)
......
......@@ -59,7 +59,6 @@ namespace WebCore {
String type() const;
void setBaseAndExtent(Node* baseNode, int baseOffset, Node* extentNode, int extentOffset, ExceptionCode&);
void setPosition(Node*, int offset, ExceptionCode&);
void setPosition(Node*, ExceptionCode&);
void modify(const String& alter, const String& direction, const String& granularity);
// Mozilla Selection Object API
......
......@@ -52,7 +52,7 @@ module window {
void empty();
void setBaseAndExtent(in Node baseNode, in long baseOffset, in Node extentNode, in long extentOffset)
raises(DOMException);
void setPosition(in Node node, in [Optional] long offset)
void setPosition(in Node node, in long offset)
raises(DOMException);
void modify(in DOMString alter, in DOMString direction, in DOMString granularity);
void extend(in Node node, in long offset)
......
......@@ -69,11 +69,17 @@ namespace WebCore {
// the screen rect.
void DOMWindow::adjustWindowRect(const FloatRect& screen, FloatRect& window, const FloatRect& pendingChanges)
{
// Make sure we're in a valid state before adjusting dimensions
ASSERT(!isnan(screen.x()) && !isnan(screen.y()) && !isnan(screen.width()) && !isnan(screen.height()) &&
!isnan(window.x()) && !isnan(window.y()) && !isnan(window.width()) && !isnan(window.height()));
// Make sure we're in a valid state before adjusting dimensions.
ASSERT(isfinite(screen.x()));
ASSERT(isfinite(screen.y()));
ASSERT(isfinite(screen.width()));
ASSERT(isfinite(screen.height()));
ASSERT(isfinite(window.x()));
ASSERT(isfinite(window.y()));
ASSERT(isfinite(window.width()));
ASSERT(isfinite(window.height()));