Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1252)

Side by Side Diff: Source/core/html/HTMLImageElement.cpp

Issue 150103007: Use fastGetAttribute in more places (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add more instances Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 m_compositeOperator = CompositeSourceOver; 175 m_compositeOperator = CompositeSourceOver;
176 } else 176 } else
177 HTMLElement::parseAttribute(name, value); 177 HTMLElement::parseAttribute(name, value);
178 } 178 }
179 179
180 const AtomicString& HTMLImageElement::altText() const 180 const AtomicString& HTMLImageElement::altText() const
181 { 181 {
182 // lets figure out the alt text.. magic stuff 182 // lets figure out the alt text.. magic stuff
183 // http://www.w3.org/TR/1998/REC-html40-19980424/appendix/notes.html#altgen 183 // http://www.w3.org/TR/1998/REC-html40-19980424/appendix/notes.html#altgen
184 // also heavily discussed by Hixie on bugzilla 184 // also heavily discussed by Hixie on bugzilla
185 if (!getAttribute(altAttr).isNull()) 185 const AtomicString& alt = fastGetAttribute(altAttr);
186 return getAttribute(altAttr); 186 if (!alt.isNull())
187 return alt;
187 // fall back to title attribute 188 // fall back to title attribute
188 return getAttribute(titleAttr); 189 return getAttribute(titleAttr);
Inactive 2014/02/13 16:03:43 Why don't we use fastGetAttribute for this one?
189 } 190 }
190 191
191 RenderObject* HTMLImageElement::createRenderer(RenderStyle* style) 192 RenderObject* HTMLImageElement::createRenderer(RenderStyle* style)
192 { 193 {
193 if (style->hasContent()) 194 if (style->hasContent())
194 return RenderObject::createObject(this, style); 195 return RenderObject::createObject(this, style);
195 196
196 RenderImage* image = new RenderImage(this); 197 RenderImage* image = new RenderImage(this);
197 image->setImageResource(RenderImageResource::create()); 198 image->setImageResource(RenderImageResource::create());
198 image->setImageDevicePixelRatio(m_imageDevicePixelRatio); 199 image->setImageDevicePixelRatio(m_imageDevicePixelRatio);
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 { 314 {
314 return attribute.name() == srcAttr 315 return attribute.name() == srcAttr
315 || attribute.name() == lowsrcAttr 316 || attribute.name() == lowsrcAttr
316 || attribute.name() == longdescAttr 317 || attribute.name() == longdescAttr
317 || (attribute.name() == usemapAttr && attribute.value().string()[0] != ' #') 318 || (attribute.name() == usemapAttr && attribute.value().string()[0] != ' #')
318 || HTMLElement::isURLAttribute(attribute); 319 || HTMLElement::isURLAttribute(attribute);
319 } 320 }
320 321
321 const AtomicString& HTMLImageElement::alt() const 322 const AtomicString& HTMLImageElement::alt() const
322 { 323 {
323 return getAttribute(altAttr); 324 return fastGetAttribute(altAttr);
324 } 325 }
325 326
326 bool HTMLImageElement::draggable() const 327 bool HTMLImageElement::draggable() const
327 { 328 {
328 // Image elements are draggable by default. 329 // Image elements are draggable by default.
329 return !equalIgnoringCase(getAttribute(draggableAttr), "false"); 330 return !equalIgnoringCase(getAttribute(draggableAttr), "false");
330 } 331 }
331 332
332 void HTMLImageElement::setHeight(int value) 333 void HTMLImageElement::setHeight(int value)
333 { 334 {
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 404
404 return m_imageLoader.image()->image(); 405 return m_imageLoader.image()->image();
405 } 406 }
406 407
407 bool HTMLImageElement::isInteractiveContent() const 408 bool HTMLImageElement::isInteractiveContent() const
408 { 409 {
409 return fastHasAttribute(usemapAttr); 410 return fastHasAttribute(usemapAttr);
410 } 411 }
411 412
412 } 413 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698