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

« back to all changes in this revision

Viewing changes to src/3rdparty/webkit/WebCore/html/HTMLImageElement.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:
30
30
#include "HTMLDocument.h"
31
31
#include "HTMLFormElement.h"
32
32
#include "HTMLNames.h"
 
33
#include "MappedAttribute.h"
33
34
#include "RenderImage.h"
 
35
#include "ScriptEventListener.h"
34
36
 
35
37
using namespace std;
36
38
 
80
82
    const QualifiedName& attrName = attr->name();
81
83
    if (attrName == altAttr) {
82
84
        if (renderer() && renderer()->isImage())
83
 
            static_cast<RenderImage*>(renderer())->updateAltText();
 
85
            toRenderImage(renderer())->updateAltText();
84
86
    } else if (attrName == srcAttr)
85
87
        m_imageLoader.updateFromElementIgnoringPreviousError();
86
88
    else if (attrName == widthAttr)
108
110
        if (attr->value().string()[0] == '#')
109
111
            usemap = attr->value();
110
112
        else
111
 
            usemap = document()->completeURL(parseURL(attr->value())).string();
 
113
            usemap = document()->completeURL(deprecatedParseURL(attr->value())).string();
112
114
        setIsLink(!attr->isNull());
113
115
    } else if (attrName == ismapAttr)
114
116
        ismap = true;
115
117
    else if (attrName == onabortAttr)
116
 
        setInlineEventListenerForTypeAndAttribute(eventNames().abortEvent, attr);
 
118
        setAttributeEventListener(eventNames().abortEvent, createAttributeEventListener(this, attr));
117
119
    else if (attrName == onloadAttr)
118
 
        setInlineEventListenerForTypeAndAttribute(eventNames().loadEvent, attr);
 
120
        setAttributeEventListener(eventNames().loadEvent, createAttributeEventListener(this, attr));
119
121
    else if (attrName == compositeAttr) {
120
122
        if (!parseCompositeOperator(attr->value(), m_compositeOperator))
121
123
            m_compositeOperator = CompositeSourceOver;
166
168
    HTMLElement::attach();
167
169
 
168
170
    if (renderer() && renderer()->isImage()) {
169
 
        RenderImage* imageObj = static_cast<RenderImage*>(renderer());
 
171
        RenderImage* imageObj = toRenderImage(renderer());
170
172
        if (imageObj->hasImage())
171
173
            return;
172
174
        imageObj->setCachedImage(m_imageLoader.image());
226
228
    else
227
229
        document()->updateLayout();
228
230
 
229
 
    return renderer() ? renderer()->contentWidth() : 0;
 
231
    return renderBox() ? renderBox()->contentWidth() : 0;
230
232
}
231
233
 
232
234
int HTMLImageElement::height(bool ignorePendingStylesheets) const
250
252
    else
251
253
        document()->updateLayout();
252
254
 
253
 
    return renderer() ? renderer()->contentHeight() : 0;
 
255
    return renderBox() ? renderBox()->contentHeight() : 0;
254
256
}
255
257
 
256
258
int HTMLImageElement::naturalWidth() const
277
279
        || (attr->name() == usemapAttr && attr->value().string()[0] != '#');
278
280
}
279
281
 
280
 
String HTMLImageElement::name() const
281
 
{
282
 
    return getAttribute(nameAttr);
283
 
}
284
 
 
285
 
void HTMLImageElement::setName(const String& value)
286
 
{
287
 
    setAttribute(nameAttr, value);
288
 
}
289
 
 
290
 
String HTMLImageElement::align() const
291
 
{
292
 
    return getAttribute(alignAttr);
293
 
}
294
 
 
295
 
void HTMLImageElement::setAlign(const String& value)
296
 
{
297
 
    setAttribute(alignAttr, value);
298
 
}
299
 
 
300
 
String HTMLImageElement::alt() const
 
282
const AtomicString& HTMLImageElement::alt() const
301
283
{
302
284
    return getAttribute(altAttr);
303
285
}
304
286
 
305
 
void HTMLImageElement::setAlt(const String& value)
306
 
{
307
 
    setAttribute(altAttr, value);
308
 
}
309
 
 
310
 
String HTMLImageElement::border() const
311
 
{
312
 
    return getAttribute(borderAttr);
313
 
}
314
 
 
315
 
void HTMLImageElement::setBorder(const String& value)
316
 
{
317
 
    setAttribute(borderAttr, value);
 
287
bool HTMLImageElement::draggable() const
 
288
{
 
289
    // Image elements are draggable by default.
 
290
    return !equalIgnoringCase(getAttribute(draggableAttr), "false");
318
291
}
319
292
 
320
293
void HTMLImageElement::setHeight(int value)
373
346
    setAttribute(srcAttr, value);
374
347
}
375
348
 
376
 
String HTMLImageElement::useMap() const
377
 
{
378
 
    return getAttribute(usemapAttr);
379
 
}
380
 
 
381
 
void HTMLImageElement::setUseMap(const String& value)
382
 
{
383
 
    setAttribute(usemapAttr, value);
384
 
}
385
 
 
386
349
int HTMLImageElement::vspace() const
387
350
{
388
351
    // ### return actual vspace
431
394
    HTMLElement::addSubresourceAttributeURLs(urls);
432
395
 
433
396
    addSubresourceURL(urls, src());
434
 
    addSubresourceURL(urls, document()->completeURL(useMap()));
 
397
    // FIXME: What about when the usemap attribute begins with "#"?
 
398
    addSubresourceURL(urls, document()->completeURL(getAttribute(usemapAttr)));
435
399
}
436
400
 
437
401
}