~ubuntu-branches/ubuntu/karmic/webkit/karmic-proposed

« back to all changes in this revision

Viewing changes to WebCore/bindings/js/JSOptionConstructor.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Gustavo Noronha Silva
  • Date: 2009-05-15 18:30:58 UTC
  • mfrom: (1.1.8 upstream)
  • Revision ID: james.westby@ubuntu.com-20090515183058-50q5exjo9b1kxy9s
Tags: 1.1.7-1
* New upstream release
* debian/libwebkit-1.0-2.symbols:
- updated with the new symbols in 1.1.7
* debian/libwebkit-dev.install, debian/libwebkit-dev.links,
  debian/rules:
- Build, and ship gtk-doc documentation (Closes: #526683)
* debian/copyright:
- updated.

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
#include "JSHTMLOptionElement.h"
26
26
#include "ScriptExecutionContext.h"
27
27
#include "Text.h"
 
28
#include <runtime/Error.h>
28
29
 
29
30
using namespace JSC;
30
31
 
53
54
static JSObject* constructHTMLOptionElement(ExecState* exec, JSObject* constructor, const ArgList& args)
54
55
{
55
56
    Document* document = static_cast<JSOptionConstructor*>(constructor)->document();
 
57
    if (!document)
 
58
        return throwError(exec, ReferenceError, "Option constructor associated document is unavailable");
56
59
 
57
60
    RefPtr<HTMLOptionElement> element = static_pointer_cast<HTMLOptionElement>(document->createElement(HTMLNames::optionTag, false));
58
61
 
59
62
    ExceptionCode ec = 0;
60
63
    RefPtr<Text> text = document->createTextNode("");
61
 
    if (!args.at(exec, 0).isUndefined())
62
 
        text->setData(args.at(exec, 0).toString(exec), ec);
 
64
    if (!args.at(0).isUndefined())
 
65
        text->setData(args.at(0).toString(exec), ec);
63
66
    if (ec == 0)
64
67
        element->appendChild(text.release(), ec);
65
 
    if (ec == 0 && !args.at(exec, 1).isUndefined())
66
 
        element->setValue(args.at(exec, 1).toString(exec));
67
 
    if (ec == 0)
68
 
        element->setDefaultSelected(args.at(exec, 2).toBoolean(exec));
69
 
    if (ec == 0)
70
 
        element->setSelected(args.at(exec, 3).toBoolean(exec));
 
68
    if (ec == 0 && !args.at(1).isUndefined())
 
69
        element->setValue(args.at(1).toString(exec));
 
70
    if (ec == 0)
 
71
        element->setDefaultSelected(args.at(2).toBoolean(exec));
 
72
    if (ec == 0)
 
73
        element->setSelected(args.at(3).toBoolean(exec));
71
74
 
72
75
    if (ec) {
73
76
        setDOMException(exec, ec);