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

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

Issue 23819007: Have Node::document() return a reference instead of a pointer (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase on master Created 7 years, 3 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/testing/Internals.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. All rights reserved. 3 * Copyright (C) 2006, 2009 Apple Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 if (!isValidContextNode(contextNode)) { 62 if (!isValidContextNode(contextNode)) {
63 es.throwDOMException(NotSupportedError); 63 es.throwDOMException(NotSupportedError);
64 return 0; 64 return 0;
65 } 65 }
66 66
67 EvaluationContext& evaluationContext = Expression::evaluationContext(); 67 EvaluationContext& evaluationContext = Expression::evaluationContext();
68 evaluationContext.node = contextNode; 68 evaluationContext.node = contextNode;
69 evaluationContext.size = 1; 69 evaluationContext.size = 1;
70 evaluationContext.position = 1; 70 evaluationContext.position = 1;
71 evaluationContext.hadTypeConversionError = false; 71 evaluationContext.hadTypeConversionError = false;
72 RefPtr<XPathResult> result = XPathResult::create(contextNode->document(), m_ topExpression->evaluate()); 72 RefPtr<XPathResult> result = XPathResult::create(&contextNode->document(), m _topExpression->evaluate());
73 evaluationContext.node = 0; // Do not hold a reference to the context node, as this may prevent the whole document from being destroyed in time. 73 evaluationContext.node = 0; // Do not hold a reference to the context node, as this may prevent the whole document from being destroyed in time.
74 74
75 if (evaluationContext.hadTypeConversionError) { 75 if (evaluationContext.hadTypeConversionError) {
76 // It is not specified what to do if type conversion fails while evaluat ing an expression. 76 // It is not specified what to do if type conversion fails while evaluat ing an expression.
77 es.throwDOMException(SyntaxError); 77 es.throwDOMException(SyntaxError);
78 return 0; 78 return 0;
79 } 79 }
80 80
81 if (type != XPathResult::ANY_TYPE) { 81 if (type != XPathResult::ANY_TYPE) {
82 result->convertTo(type, es); 82 result->convertTo(type, es);
83 if (es.hadException()) 83 if (es.hadException())
84 return 0; 84 return 0;
85 } 85 }
86 86
87 return result; 87 return result;
88 } 88 }
89 89
90 } 90 }
OLDNEW
« no previous file with comments | « Source/core/testing/Internals.cpp ('k') | Source/core/xml/XPathNodeSet.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698