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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 addHTMLLengthToStyle(style, CSSPropertyMarginLeft, value); | 100 addHTMLLengthToStyle(style, CSSPropertyMarginLeft, value); |
101 addHTMLLengthToStyle(style, CSSPropertyMarginRight, value); | 101 addHTMLLengthToStyle(style, CSSPropertyMarginRight, value); |
102 } else if (name == alignAttr) | 102 } else if (name == alignAttr) |
103 applyAlignmentAttributeToStyle(value, style); | 103 applyAlignmentAttributeToStyle(value, style); |
104 else if (name == valignAttr) | 104 else if (name == valignAttr) |
105 addPropertyToPresentationAttributeStyle(style, CSSPropertyVerticalAlign,
value); | 105 addPropertyToPresentationAttributeStyle(style, CSSPropertyVerticalAlign,
value); |
106 else | 106 else |
107 HTMLElement::collectStyleForPresentationAttribute(name, value, style); | 107 HTMLElement::collectStyleForPresentationAttribute(name, value, style); |
108 } | 108 } |
109 | 109 |
| 110 const AtomicString HTMLImageElement::imageSourceURL() const |
| 111 { |
| 112 return m_bestFitImageURL.isEmpty() ? fastGetAttribute(srcAttr) : m_bestFitIm
ageURL; |
| 113 } |
| 114 |
110 void HTMLImageElement::parseAttribute(const QualifiedName& name, const AtomicStr
ing& value) | 115 void HTMLImageElement::parseAttribute(const QualifiedName& name, const AtomicStr
ing& value) |
111 { | 116 { |
112 if (name == altAttr) { | 117 if (name == altAttr) { |
113 if (renderer() && renderer()->isImage()) | 118 if (renderer() && renderer()->isImage()) |
114 toRenderImage(renderer())->updateAltText(); | 119 toRenderImage(renderer())->updateAltText(); |
115 } else if (name == srcAttr) | 120 } else if (name == srcAttr || name == srcsetAttr) { |
| 121 m_bestFitImageURL = bestFitSourceForImageAttributes(document().devicePix
elRatio(), fastGetAttribute(srcAttr), fastGetAttribute(srcsetAttr)); |
116 m_imageLoader.updateFromElementIgnoringPreviousError(); | 122 m_imageLoader.updateFromElementIgnoringPreviousError(); |
| 123 } |
117 else if (name == usemapAttr) | 124 else if (name == usemapAttr) |
118 setIsLink(!value.isNull()); | 125 setIsLink(!value.isNull()); |
119 else if (name == onbeforeloadAttr) | 126 else if (name == onbeforeloadAttr) |
120 setAttributeEventListener(eventNames().beforeloadEvent, createAttributeE
ventListener(this, name, value)); | 127 setAttributeEventListener(eventNames().beforeloadEvent, createAttributeE
ventListener(this, name, value)); |
121 else if (name == compositeAttr) { | 128 else if (name == compositeAttr) { |
122 // FIXME: images don't support blend modes in their compositing attribut
e. | 129 // FIXME: images don't support blend modes in their compositing attribut
e. |
123 BlendMode blendOp = BlendModeNormal; | 130 BlendMode blendOp = BlendModeNormal; |
124 if (!parseCompositeAndBlendOperator(value, m_compositeOperator, blendOp)
) | 131 if (!parseCompositeAndBlendOperator(value, m_compositeOperator, blendOp)
) |
125 m_compositeOperator = CompositeSourceOver; | 132 m_compositeOperator = CompositeSourceOver; |
126 } else | 133 } else |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 | 374 |
368 Image* HTMLImageElement::imageContents() | 375 Image* HTMLImageElement::imageContents() |
369 { | 376 { |
370 if (!m_imageLoader.imageComplete()) | 377 if (!m_imageLoader.imageComplete()) |
371 return 0; | 378 return 0; |
372 | 379 |
373 return m_imageLoader.image()->image(); | 380 return m_imageLoader.image()->image(); |
374 } | 381 } |
375 | 382 |
376 } | 383 } |
OLD | NEW |