| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 | 104 |
| 105 if (Node* nodeFromFrame = nodeInsideFrame(bestNode)) { | 105 if (Node* nodeFromFrame = nodeInsideFrame(bestNode)) { |
| 106 // FIXME: This code only hit-tests a single iframe. It seems like we oug
ht support nested frames. | 106 // FIXME: This code only hit-tests a single iframe. It seems like we oug
ht support nested frames. |
| 107 if (Node* bestNodeInFrame = findBestOverlappingNode(nodeFromFrame, resiz
edCropRect)) | 107 if (Node* bestNodeInFrame = findBestOverlappingNode(nodeFromFrame, resiz
edCropRect)) |
| 108 bestNode = bestNodeInFrame; | 108 bestNode = bestNodeInFrame; |
| 109 } | 109 } |
| 110 | 110 |
| 111 Vector<Node*> hitNodes; | 111 Vector<Node*> hitNodes; |
| 112 collectOverlappingChildNodes(bestNode, resizedCropRect, hitNodes); | 112 collectOverlappingChildNodes(bestNode, resizedCropRect, hitNodes); |
| 113 | 113 |
| 114 if (hitNodes.isEmpty() || hitNodes.size() == bestNode->childNodeCount()) { | 114 if (hitNodes.isEmpty() || hitNodes.size() == bestNode->countChildren()) { |
| 115 hitNodes.clear(); | 115 hitNodes.clear(); |
| 116 hitNodes.append(bestNode); | 116 hitNodes.append(bestNode); |
| 117 } | 117 } |
| 118 | 118 |
| 119 // Unite won't work with the empty rect, so we initialize to the first rect. | 119 // Unite won't work with the empty rect, so we initialize to the first rect. |
| 120 IntRect unitedRects = hitNodes[0]->pixelSnappedBoundingBox(); | 120 IntRect unitedRects = hitNodes[0]->pixelSnappedBoundingBox(); |
| 121 StringBuilder collectedText; | 121 StringBuilder collectedText; |
| 122 for (size_t i = 0; i < hitNodes.size(); ++i) { | 122 for (size_t i = 0; i < hitNodes.size(); ++i) { |
| 123 collectedText.append(extractTextFromNode(hitNodes[i])); | 123 collectedText.append(extractTextFromNode(hitNodes[i])); |
| 124 unitedRects.unite(hitNodes[i]->pixelSnappedBoundingBox()); | 124 unitedRects.unite(hitNodes[i]->pixelSnappedBoundingBox()); |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 | 285 |
| 286 result.append(nodeValue); | 286 result.append(nodeValue); |
| 287 } | 287 } |
| 288 } | 288 } |
| 289 } | 289 } |
| 290 | 290 |
| 291 return result.toString(); | 291 return result.toString(); |
| 292 } | 292 } |
| 293 | 293 |
| 294 } // namespace WebCore | 294 } // namespace WebCore |
| OLD | NEW |