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

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

Issue 195813003: Use new is*Element() helper functions further more in HTML code (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix bad assertion Created 6 years, 9 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 | Annotate | Revision Log
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 * (C) 2000 Stefan Schimanski (1Stein@gmx.de) 4 * (C) 2000 Stefan Schimanski (1Stein@gmx.de)
5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011 Apple Inc. All rights reserved. 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011 Apple Inc. All rights reserved.
6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 } 205 }
206 206
207 207
208 bool HTMLObjectElement::hasFallbackContent() const 208 bool HTMLObjectElement::hasFallbackContent() const
209 { 209 {
210 for (Node* child = firstChild(); child; child = child->nextSibling()) { 210 for (Node* child = firstChild(); child; child = child->nextSibling()) {
211 // Ignore whitespace-only text, and <param> tags, any other content is f allback content. 211 // Ignore whitespace-only text, and <param> tags, any other content is f allback content.
212 if (child->isTextNode()) { 212 if (child->isTextNode()) {
213 if (!toText(child)->containsOnlyWhitespace()) 213 if (!toText(child)->containsOnlyWhitespace())
214 return true; 214 return true;
215 } else if (!child->hasTagName(paramTag)) 215 } else if (!isHTMLParamElement(*child)) {
216 return true; 216 return true;
217 }
217 } 218 }
218 return false; 219 return false;
219 } 220 }
220 221
221 bool HTMLObjectElement::shouldAllowQuickTimeClassIdQuirk() 222 bool HTMLObjectElement::shouldAllowQuickTimeClassIdQuirk()
222 { 223 {
223 // This site-specific hack maintains compatibility with Mac OS X Wiki Server , 224 // This site-specific hack maintains compatibility with Mac OS X Wiki Server ,
224 // which embeds QuickTime movies using an object tag containing QuickTime's 225 // which embeds QuickTime movies using an object tag containing QuickTime's
225 // ActiveX classid. Treat this classid as valid only if OS X Server's unique 226 // ActiveX classid. Treat this classid as valid only if OS X Server's unique
226 // 'generator' meta tag is present. Only apply this quirk if there is no 227 // 'generator' meta tag is present. Only apply this quirk if there is no
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 m_useFallbackContent = true; 408 m_useFallbackContent = true;
408 409
409 // FIXME: Style gets recalculated which is suboptimal. 410 // FIXME: Style gets recalculated which is suboptimal.
410 reattachFallbackContent(); 411 reattachFallbackContent();
411 } 412 }
412 413
413 bool HTMLObjectElement::isExposed() const 414 bool HTMLObjectElement::isExposed() const
414 { 415 {
415 // http://www.whatwg.org/specs/web-apps/current-work/#exposed 416 // http://www.whatwg.org/specs/web-apps/current-work/#exposed
416 for (Node* ancestor = parentNode(); ancestor; ancestor = ancestor->parentNod e()) { 417 for (Node* ancestor = parentNode(); ancestor; ancestor = ancestor->parentNod e()) {
417 if (ancestor->hasTagName(objectTag) && toHTMLObjectElement(ancestor)->is Exposed()) 418 if (isHTMLObjectElement(*ancestor) && toHTMLObjectElement(ancestor)->isE xposed())
418 return false; 419 return false;
419 } 420 }
420 for (Element* element = ElementTraversal::firstWithin(*this); element; eleme nt = ElementTraversal::next(*element, this)) { 421 for (HTMLElement* element = Traversal<HTMLElement>::firstWithin(*this); elem ent; element = Traversal<HTMLElement>::next(*element, this)) {
421 if (element->hasTagName(objectTag) || element->hasTagName(embedTag)) 422 if (isHTMLObjectElement(*element) || isHTMLEmbedElement(*element))
422 return false; 423 return false;
423 } 424 }
424 return true; 425 return true;
425 } 426 }
426 427
427 bool HTMLObjectElement::containsJavaApplet() const 428 bool HTMLObjectElement::containsJavaApplet() const
428 { 429 {
429 if (MIMETypeRegistry::isJavaAppletMIMEType(getAttribute(typeAttr))) 430 if (MIMETypeRegistry::isJavaAppletMIMEType(getAttribute(typeAttr)))
430 return true; 431 return true;
431 432
432 for (Element* child = ElementTraversal::firstWithin(*this); child; child = E lementTraversal::nextSkippingChildren(*child, this)) { 433 for (HTMLElement* child = Traversal<HTMLElement>::firstWithin(*this); child; child = Traversal<HTMLElement>::nextSkippingChildren(*child, this)) {
433 if (child->hasTagName(paramTag) 434 if (isHTMLParamElement(*child)
434 && equalIgnoringCase(child->getNameAttribute(), "type") 435 && equalIgnoringCase(child->getNameAttribute(), "type")
435 && MIMETypeRegistry::isJavaAppletMIMEType(child->getAttribute(va lueAttr).string())) 436 && MIMETypeRegistry::isJavaAppletMIMEType(child->getAttribute(va lueAttr).string()))
436 return true; 437 return true;
437 if (child->hasTagName(objectTag) && toHTMLObjectElement(child)->contains JavaApplet()) 438 if (isHTMLObjectElement(*child) && toHTMLObjectElement(*child).containsJ avaApplet())
438 return true; 439 return true;
439 if (child->hasTagName(appletTag)) 440 if (isHTMLAppletElement(*child))
440 return true; 441 return true;
441 } 442 }
442 443
443 return false; 444 return false;
444 } 445 }
445 446
446 void HTMLObjectElement::didMoveToNewDocument(Document& oldDocument) 447 void HTMLObjectElement::didMoveToNewDocument(Document& oldDocument)
447 { 448 {
448 FormAssociatedElement::didMoveToNewDocument(oldDocument); 449 FormAssociatedElement::didMoveToNewDocument(oldDocument);
449 HTMLPlugInElement::didMoveToNewDocument(oldDocument); 450 HTMLPlugInElement::didMoveToNewDocument(oldDocument);
(...skipping 23 matching lines...) Expand all
473 { 474 {
474 return fastHasAttribute(usemapAttr); 475 return fastHasAttribute(usemapAttr);
475 } 476 }
476 477
477 bool HTMLObjectElement::useFallbackContent() const 478 bool HTMLObjectElement::useFallbackContent() const
478 { 479 {
479 return HTMLPlugInElement::useFallbackContent() || m_useFallbackContent; 480 return HTMLPlugInElement::useFallbackContent() || m_useFallbackContent;
480 } 481 }
481 482
482 } 483 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698