| 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 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 } | 227 } |
| 228 } | 228 } |
| 229 | 229 |
| 230 String SmartClip::extractTextFromNode(Node* node) | 230 String SmartClip::extractTextFromNode(Node* node) |
| 231 { | 231 { |
| 232 // Science has proven that no text nodes are ever positioned at y == -99999. | 232 // Science has proven that no text nodes are ever positioned at y == -99999. |
| 233 int prevYPos = -99999; | 233 int prevYPos = -99999; |
| 234 | 234 |
| 235 StringBuilder result; | 235 StringBuilder result; |
| 236 for (Node& currentNode : NodeTraversal::inclusiveDescendantsOf(*node)) { | 236 for (Node& currentNode : NodeTraversal::inclusiveDescendantsOf(*node)) { |
| 237 const LayoutStyle* style = currentNode.computedStyle(); | 237 const ComputedStyle* style = currentNode.ensureComputedStyle(); |
| 238 if (style && style->userSelect() == SELECT_NONE) | 238 if (style && style->userSelect() == SELECT_NONE) |
| 239 continue; | 239 continue; |
| 240 | 240 |
| 241 if (Node* nodeFromFrame = nodeInsideFrame(¤tNode)) | 241 if (Node* nodeFromFrame = nodeInsideFrame(¤tNode)) |
| 242 result.append(extractTextFromNode(nodeFromFrame)); | 242 result.append(extractTextFromNode(nodeFromFrame)); |
| 243 | 243 |
| 244 IntRect nodeRect = currentNode.pixelSnappedBoundingBox(); | 244 IntRect nodeRect = currentNode.pixelSnappedBoundingBox(); |
| 245 if (currentNode.layoutObject() && !nodeRect.isEmpty()) { | 245 if (currentNode.layoutObject() && !nodeRect.isEmpty()) { |
| 246 if (currentNode.isTextNode()) { | 246 if (currentNode.isTextNode()) { |
| 247 String nodeValue = currentNode.nodeValue(); | 247 String nodeValue = currentNode.nodeValue(); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 258 | 258 |
| 259 result.append(nodeValue); | 259 result.append(nodeValue); |
| 260 } | 260 } |
| 261 } | 261 } |
| 262 } | 262 } |
| 263 | 263 |
| 264 return result.toString(); | 264 return result.toString(); |
| 265 } | 265 } |
| 266 | 266 |
| 267 } // namespace blink | 267 } // namespace blink |
| OLD | NEW |