~oif-team/ubuntu/natty/qt4-x11/xi2.1

« back to all changes in this revision

Viewing changes to src/3rdparty/webkit/WebCore/wml/WMLDoElement.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Alessandro Ghersi
  • Date: 2009-11-02 18:30:08 UTC
  • mfrom: (1.2.2 upstream)
  • mto: (15.2.5 experimental)
  • mto: This revision was merged to the branch mainline in revision 88.
  • Revision ID: james.westby@ubuntu.com-20091102183008-b6a4gcs128mvfb3m
Tags: upstream-4.6.0~beta1
ImportĀ upstreamĀ versionĀ 4.6.0~beta1

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/**
2
 
 * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
 
2
 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
3
3
 *
4
4
 * This library is free software; you can redistribute it and/or
5
5
 * modify it under the terms of the GNU Library General Public
27
27
#include "EventNames.h"
28
28
#include "HTMLNames.h"
29
29
#include "KeyboardEvent.h"
 
30
#include "MappedAttribute.h"
30
31
#include "Page.h"
31
32
#include "RenderButton.h"
32
33
#include "WMLCardElement.h"
69
70
 
70
71
    if (m_type == "accept" || m_type == "options") {
71
72
        if (m_task)
72
 
            m_task->executeTask(event);
 
73
            m_task->executeTask();
73
74
    } else if (m_type == "prev") {
74
 
        WMLPageState* pageState = wmlPageStateForDocument(document());
 
75
        ASSERT(document()->isWMLDocument());
 
76
        WMLDocument* document = static_cast<WMLDocument*>(this->document());
 
77
 
 
78
        WMLPageState* pageState = wmlPageStateForDocument(document);
75
79
        if (!pageState)
76
80
            return;
77
 
 
 
81
    
78
82
        // Stop the timer of the current card if it is active
79
 
        if (WMLCardElement* card = pageState->activeCard()) {
 
83
        if (WMLCardElement* card = document->activeCard()) {
80
84
            if (WMLTimerElement* eventTimer = card->eventTimer())
81
85
                eventTimer->stop();
82
86
        }
97
101
        m_type = parseValueForbiddingVariableReferences(attr->value());
98
102
    else if (attr->name() == HTMLNames::nameAttr)
99
103
        m_name = parseValueForbiddingVariableReferences(attr->value());
100
 
    else if (attr->name() == HTMLNames::labelAttr)
101
 
        m_label = parseValueSubstitutingVariableReferences(attr->value());
102
104
    else if (attr->name() == optionalAttr)
103
105
        m_isOptional = (attr->value() == "true");
104
106
    else
114
116
        m_name = m_type;
115
117
 
116
118
    Node* parent = parentNode();
117
 
    ASSERT(parent);
118
 
 
119
119
    if (!parent || !parent->isWMLElement())
120
120
        return;
121
121
 
122
 
    WMLElement* parentElement = static_cast<WMLElement*>(parent);
123
 
    if (!parentElement->isWMLEventHandlingElement())
124
 
        return;
125
 
 
126
 
    static_cast<WMLEventHandlingElement*>(parentElement)->registerDoElement(this);
 
122
    if (WMLEventHandlingElement* eventHandlingElement = toWMLEventHandlingElement(static_cast<WMLElement*>(parent)))
 
123
        eventHandlingElement->registerDoElement(this, document());
 
124
}
 
125
 
 
126
void WMLDoElement::removedFromDocument()
 
127
{
 
128
    Node* parent = parentNode();
 
129
 
 
130
    if (parent  && parent->isWMLElement()) {
 
131
        if (WMLEventHandlingElement* eventHandlingElement = toWMLEventHandlingElement(static_cast<WMLElement*>(parent)))
 
132
            eventHandlingElement->deregisterDoElement(this);
 
133
    }
 
134
 
 
135
    WMLElement::removedFromDocument();
 
136
}
 
137
 
 
138
void WMLDoElement::attach()
 
139
{
 
140
    WMLElement::attach();
 
141
 
 
142
    // The call to updateFromElement() needs to go after the call through
 
143
    // to the base class's attach() because that can sometimes do a close
 
144
    // on the renderer.
 
145
    if (renderer())
 
146
        renderer()->updateFromElement();
127
147
}
128
148
 
129
149
RenderObject* WMLDoElement::createRenderer(RenderArena* arena, RenderStyle* style)
147
167
        renderer()->updateFromElement();
148
168
}
149
169
 
 
170
void WMLDoElement::registerTask(WMLTaskElement* task)
 
171
{
 
172
    ASSERT(!m_task);
 
173
    m_task = task;
 
174
}
 
175
 
 
176
void WMLDoElement::deregisterTask(WMLTaskElement* task)
 
177
{
 
178
    ASSERT_UNUSED(task, m_task == task);
 
179
    m_task = 0;
 
180
}
 
181
 
 
182
String WMLDoElement::label() const
 
183
{
 
184
    return parseValueSubstitutingVariableReferences(getAttribute(HTMLNames::labelAttr));
 
185
}
 
186
 
150
187
}
151
188
 
152
189
#endif