| OLD | NEW |
| 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 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 323 for (size_t i = 0; i < nodes.size(); ++i) { | 323 for (size_t i = 0; i < nodes.size(); ++i) { |
| 324 String str = stringValue(nodes[i]); | 324 String str = stringValue(nodes[i]); |
| 325 idList.append(str); | 325 idList.append(str); |
| 326 idList.append(' '); | 326 idList.append(' '); |
| 327 } | 327 } |
| 328 } else { | 328 } else { |
| 329 String str = a.toString(); | 329 String str = a.toString(); |
| 330 idList.append(str); | 330 idList.append(str); |
| 331 } | 331 } |
| 332 | 332 |
| 333 TreeScope& contextScope = evaluationContext().node->treeScope(); | 333 NonNullPtr<TreeScope> contextScope = evaluationContext().node->treeScope(); |
| 334 NodeSet result; | 334 NodeSet result; |
| 335 HashSet<Node*> resultSet; | 335 HashSet<Node*> resultSet; |
| 336 | 336 |
| 337 unsigned startPos = 0; | 337 unsigned startPos = 0; |
| 338 unsigned length = idList.length(); | 338 unsigned length = idList.length(); |
| 339 while (true) { | 339 while (true) { |
| 340 while (startPos < length && isWhitespace(idList[startPos])) | 340 while (startPos < length && isWhitespace(idList[startPos])) |
| 341 ++startPos; | 341 ++startPos; |
| 342 | 342 |
| 343 if (startPos == length) | 343 if (startPos == length) |
| 344 break; | 344 break; |
| 345 | 345 |
| 346 size_t endPos = startPos; | 346 size_t endPos = startPos; |
| 347 while (endPos < length && !isWhitespace(idList[endPos])) | 347 while (endPos < length && !isWhitespace(idList[endPos])) |
| 348 ++endPos; | 348 ++endPos; |
| 349 | 349 |
| 350 // If there are several nodes with the same id, id() should return the f
irst one. | 350 // If there are several nodes with the same id, id() should return the f
irst one. |
| 351 // In WebKit, getElementById behaves so, too, although its behavior in t
his case is formally undefined. | 351 // In WebKit, getElementById behaves so, too, although its behavior in t
his case is formally undefined. |
| 352 Node* node = contextScope.getElementById(idList.substring(startPos, endP
os - startPos)); | 352 Node* node = contextScope->getElementById(idList.substring(startPos, end
Pos - startPos)); |
| 353 if (node && resultSet.add(node).isNewEntry) | 353 if (node && resultSet.add(node).isNewEntry) |
| 354 result.append(node); | 354 result.append(node); |
| 355 | 355 |
| 356 startPos = endPos; | 356 startPos = endPos; |
| 357 } | 357 } |
| 358 | 358 |
| 359 result.markSorted(false); | 359 result.markSorted(false); |
| 360 | 360 |
| 361 return Value(result, Value::adopt); | 361 return Value(result, Value::adopt); |
| 362 } | 362 } |
| (...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 724 return 0; | 724 return 0; |
| 725 | 725 |
| 726 Function* function = functionRec->factoryFn(); | 726 Function* function = functionRec->factoryFn(); |
| 727 function->setArguments(args); | 727 function->setArguments(args); |
| 728 function->setName(name); | 728 function->setName(name); |
| 729 return function; | 729 return function; |
| 730 } | 730 } |
| 731 | 731 |
| 732 } | 732 } |
| 733 } | 733 } |
| OLD | NEW |