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

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

Issue 2623513005: Introduce Element::AttributeModificationParams (Closed)
Patch Set: Created 3 years, 11 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 4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010 Apple Inc. All rights
5 * reserved. 5 * reserved.
6 * Copyright (C) 2010 Google Inc. All rights reserved. 6 * Copyright (C) 2010 Google Inc. All rights reserved.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 if (intrinsicSizingViewportDependant) { 241 if (intrinsicSizingViewportDependant) {
242 if (!m_listener) 242 if (!m_listener)
243 m_listener = ViewportChangeListener::create(this); 243 m_listener = ViewportChangeListener::create(this);
244 244
245 document().mediaQueryMatcher().addViewportListener(m_listener); 245 document().mediaQueryMatcher().addViewportListener(m_listener);
246 } else if (m_listener) { 246 } else if (m_listener) {
247 document().mediaQueryMatcher().removeViewportListener(m_listener); 247 document().mediaQueryMatcher().removeViewportListener(m_listener);
248 } 248 }
249 } 249 }
250 250
251 void HTMLImageElement::parseAttribute(const QualifiedName& name, 251 void HTMLImageElement::parseAttribute(
252 const AtomicString& oldValue, 252 const AttributeModificationParams& params) {
253 const AtomicString& value) { 253 const QualifiedName& name = params.name;
254 if (name == altAttr || name == titleAttr) { 254 if (name == altAttr || name == titleAttr) {
255 if (userAgentShadowRoot()) { 255 if (userAgentShadowRoot()) {
256 Element* text = userAgentShadowRoot()->getElementById("alttext"); 256 Element* text = userAgentShadowRoot()->getElementById("alttext");
257 String value = altText(); 257 String value = altText();
258 if (text && text->textContent() != value) 258 if (text && text->textContent() != params.newValue)
259 text->setTextContent(altText()); 259 text->setTextContent(altText());
260 } 260 }
261 } else if (name == srcAttr || name == srcsetAttr || name == sizesAttr) { 261 } else if (name == srcAttr || name == srcsetAttr || name == sizesAttr) {
262 selectSourceURL(ImageLoader::UpdateIgnorePreviousError); 262 selectSourceURL(ImageLoader::UpdateIgnorePreviousError);
263 } else if (name == usemapAttr) { 263 } else if (name == usemapAttr) {
264 setIsLink(!value.isNull()); 264 setIsLink(!params.newValue.isNull());
265 } else if (name == referrerpolicyAttr) { 265 } else if (name == referrerpolicyAttr) {
266 m_referrerPolicy = ReferrerPolicyDefault; 266 m_referrerPolicy = ReferrerPolicyDefault;
267 if (!value.isNull()) 267 if (!params.newValue.isNull()) {
268 SecurityPolicy::referrerPolicyFromStringWithLegacyKeywords( 268 SecurityPolicy::referrerPolicyFromStringWithLegacyKeywords(
269 value, &m_referrerPolicy); 269 params.newValue, &m_referrerPolicy);
270 }
270 } else { 271 } else {
271 HTMLElement::parseAttribute(name, oldValue, value); 272 HTMLElement::parseAttribute(params);
272 } 273 }
273 } 274 }
274 275
275 String HTMLImageElement::altText() const { 276 String HTMLImageElement::altText() const {
276 // lets figure out the alt text.. magic stuff 277 // lets figure out the alt text.. magic stuff
277 // http://www.w3.org/TR/1998/REC-html40-19980424/appendix/notes.html#altgen 278 // http://www.w3.org/TR/1998/REC-html40-19980424/appendix/notes.html#altgen
278 // also heavily discussed by Hixie on bugzilla 279 // also heavily discussed by Hixie on bugzilla
279 const AtomicString& alt = fastGetAttribute(altAttr); 280 const AtomicString& alt = fastGetAttribute(altAttr);
280 if (!alt.isNull()) 281 if (!alt.isNull())
281 return alt; 282 return alt;
(...skipping 627 matching lines...) Expand 10 before | Expand all | Expand 10 after
909 void HTMLImageElement::associateWith(HTMLFormElement* form) { 910 void HTMLImageElement::associateWith(HTMLFormElement* form) {
910 if (form && form->isConnected()) { 911 if (form && form->isConnected()) {
911 m_form = form; 912 m_form = form;
912 m_formWasSetByParser = true; 913 m_formWasSetByParser = true;
913 m_form->associate(*this); 914 m_form->associate(*this);
914 m_form->didAssociateByParser(); 915 m_form->didAssociateByParser();
915 } 916 }
916 }; 917 };
917 918
918 } // namespace blink 919 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLImageElement.h ('k') | third_party/WebKit/Source/core/html/HTMLInputElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698