OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010 Apple Inc. All rights reserv
ed. | 4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010 Apple Inc. All rights reserv
ed. |
5 * Copyright (C) 2010 Google Inc. All rights reserved. | 5 * Copyright (C) 2010 Google Inc. All rights reserved. |
6 * | 6 * |
7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 setAttributeEventListener(EventTypeNames::beforeload, createAttributeEve
ntListener(this, name, value)); | 137 setAttributeEventListener(EventTypeNames::beforeload, createAttributeEve
ntListener(this, name, value)); |
138 else if (name == compositeAttr) { | 138 else if (name == compositeAttr) { |
139 // FIXME: images don't support blend modes in their compositing attribut
e. | 139 // FIXME: images don't support blend modes in their compositing attribut
e. |
140 blink::WebBlendMode blendOp = blink::WebBlendModeNormal; | 140 blink::WebBlendMode blendOp = blink::WebBlendModeNormal; |
141 if (!parseCompositeAndBlendOperator(value, m_compositeOperator, blendOp)
) | 141 if (!parseCompositeAndBlendOperator(value, m_compositeOperator, blendOp)
) |
142 m_compositeOperator = CompositeSourceOver; | 142 m_compositeOperator = CompositeSourceOver; |
143 } else | 143 } else |
144 HTMLElement::parseAttribute(name, value); | 144 HTMLElement::parseAttribute(name, value); |
145 } | 145 } |
146 | 146 |
147 String HTMLImageElement::altText() const | 147 const AtomicString& HTMLImageElement::altText() const |
148 { | 148 { |
149 // lets figure out the alt text.. magic stuff | 149 // lets figure out the alt text.. magic stuff |
150 // http://www.w3.org/TR/1998/REC-html40-19980424/appendix/notes.html#altgen | 150 // http://www.w3.org/TR/1998/REC-html40-19980424/appendix/notes.html#altgen |
151 // also heavily discussed by Hixie on bugzilla | 151 // also heavily discussed by Hixie on bugzilla |
152 String alt = getAttribute(altAttr); | 152 if (!getAttribute(altAttr).isNull()) |
| 153 return getAttribute(altAttr); |
153 // fall back to title attribute | 154 // fall back to title attribute |
154 if (alt.isNull()) | 155 return getAttribute(titleAttr); |
155 alt = getAttribute(titleAttr); | |
156 return alt; | |
157 } | 156 } |
158 | 157 |
159 RenderObject* HTMLImageElement::createRenderer(RenderStyle* style) | 158 RenderObject* HTMLImageElement::createRenderer(RenderStyle* style) |
160 { | 159 { |
161 if (style->hasContent()) | 160 if (style->hasContent()) |
162 return RenderObject::createObject(this, style); | 161 return RenderObject::createObject(this, style); |
163 | 162 |
164 RenderImage* image = new RenderImage(this); | 163 RenderImage* image = new RenderImage(this); |
165 image->setImageResource(RenderImageResource::create()); | 164 image->setImageResource(RenderImageResource::create()); |
166 image->setImageDevicePixelRatio(m_imageDevicePixelRatio); | 165 image->setImageDevicePixelRatio(m_imageDevicePixelRatio); |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 setIntegralAttribute(heightAttr, value); | 311 setIntegralAttribute(heightAttr, value); |
313 } | 312 } |
314 | 313 |
315 KURL HTMLImageElement::src() const | 314 KURL HTMLImageElement::src() const |
316 { | 315 { |
317 return document().completeURL(getAttribute(srcAttr)); | 316 return document().completeURL(getAttribute(srcAttr)); |
318 } | 317 } |
319 | 318 |
320 void HTMLImageElement::setSrc(const String& value) | 319 void HTMLImageElement::setSrc(const String& value) |
321 { | 320 { |
322 setAttribute(srcAttr, value); | 321 setAttribute(srcAttr, AtomicString(value)); |
323 } | 322 } |
324 | 323 |
325 void HTMLImageElement::setWidth(int value) | 324 void HTMLImageElement::setWidth(int value) |
326 { | 325 { |
327 setIntegralAttribute(widthAttr, value); | 326 setIntegralAttribute(widthAttr, value); |
328 } | 327 } |
329 | 328 |
330 int HTMLImageElement::x() const | 329 int HTMLImageElement::x() const |
331 { | 330 { |
332 RenderObject* r = renderer(); | 331 RenderObject* r = renderer(); |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 | 389 |
391 return m_imageLoader.image()->image(); | 390 return m_imageLoader.image()->image(); |
392 } | 391 } |
393 | 392 |
394 bool HTMLImageElement::isInteractiveContent() const | 393 bool HTMLImageElement::isInteractiveContent() const |
395 { | 394 { |
396 return fastHasAttribute(usemapAttr); | 395 return fastHasAttribute(usemapAttr); |
397 } | 396 } |
398 | 397 |
399 } | 398 } |
OLD | NEW |