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

Side by Side Diff: Source/core/xml/XPathFunctions.cpp

Issue 436603003: Make Element::attributes() less error-prone and simplify call sites (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Take feedback into consideration Created 6 years, 4 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
« no previous file with comments | « Source/core/page/PageSerializer.cpp ('k') | Source/core/xml/XPathNodeSet.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2005 Frerich Raabe <raabe@kde.org> 2 * Copyright (C) 2005 Frerich Raabe <raabe@kde.org>
3 * Copyright (C) 2006, 2009 Apple Inc. 3 * Copyright (C) 2006, 2009 Apple Inc.
4 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> 4 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org>
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 9 *
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
(...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after
595 595
596 Value FunLang::evaluate(EvaluationContext& context) const 596 Value FunLang::evaluate(EvaluationContext& context) const
597 { 597 {
598 String lang = arg(0)->evaluate(context).toString(); 598 String lang = arg(0)->evaluate(context).toString();
599 599
600 const Attribute* languageAttribute = 0; 600 const Attribute* languageAttribute = 0;
601 Node* node = context.node.get(); 601 Node* node = context.node.get();
602 while (node) { 602 while (node) {
603 if (node->isElementNode()) { 603 if (node->isElementNode()) {
604 Element* element = toElement(node); 604 Element* element = toElement(node);
605 if (element->hasAttributes()) 605 languageAttribute = element->attributes().find(XMLNames::langAttr);
606 languageAttribute = element->attributes().find(XMLNames::langAtt r);
607 } 606 }
608 if (languageAttribute) 607 if (languageAttribute)
609 break; 608 break;
610 node = node->parentNode(); 609 node = node->parentNode();
611 } 610 }
612 611
613 if (!languageAttribute) 612 if (!languageAttribute)
614 return false; 613 return false;
615 614
616 String langValue = languageAttribute->value(); 615 String langValue = languageAttribute->value();
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
744 return 0; 743 return 0;
745 744
746 Function* function = functionRec->factoryFn(); 745 Function* function = functionRec->factoryFn();
747 function->setArguments(args); 746 function->setArguments(args);
748 function->setName(name); 747 function->setName(name);
749 return function; 748 return function;
750 } 749 }
751 750
752 } 751 }
753 } 752 }
OLDNEW
« no previous file with comments | « Source/core/page/PageSerializer.cpp ('k') | Source/core/xml/XPathNodeSet.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698