| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2008, 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2008, 2011 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies) | 3 * Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies) |
| 4 * | 4 * |
| 5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
| 6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
| 7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
| 8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
| 9 * | 9 * |
| 10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
| (...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 Node* node, | 390 Node* node, |
| 391 const HitTestLocation& location, | 391 const HitTestLocation& location, |
| 392 const LayoutRect& rect) { | 392 const LayoutRect& rect) { |
| 393 // If not a list-based test, stop testing because the hit has been found. | 393 // If not a list-based test, stop testing because the hit has been found. |
| 394 if (!hitTestRequest().listBased()) | 394 if (!hitTestRequest().listBased()) |
| 395 return StopHitTesting; | 395 return StopHitTesting; |
| 396 | 396 |
| 397 if (!node) | 397 if (!node) |
| 398 return ContinueHitTesting; | 398 return ContinueHitTesting; |
| 399 | 399 |
| 400 mutableListBasedTestResult().add(node); | 400 mutableListBasedTestResult().insert(node); |
| 401 | 401 |
| 402 if (hitTestRequest().penetratingList()) | 402 if (hitTestRequest().penetratingList()) |
| 403 return ContinueHitTesting; | 403 return ContinueHitTesting; |
| 404 | 404 |
| 405 return rect.contains(LayoutRect(location.boundingBox())) ? StopHitTesting | 405 return rect.contains(LayoutRect(location.boundingBox())) ? StopHitTesting |
| 406 : ContinueHitTesting; | 406 : ContinueHitTesting; |
| 407 } | 407 } |
| 408 | 408 |
| 409 ListBasedHitTestBehavior HitTestResult::addNodeToListBasedTestResult( | 409 ListBasedHitTestBehavior HitTestResult::addNodeToListBasedTestResult( |
| 410 Node* node, | 410 Node* node, |
| 411 const HitTestLocation& location, | 411 const HitTestLocation& location, |
| 412 const Region& region) { | 412 const Region& region) { |
| 413 // If not a list-based test, stop testing because the hit has been found. | 413 // If not a list-based test, stop testing because the hit has been found. |
| 414 if (!hitTestRequest().listBased()) | 414 if (!hitTestRequest().listBased()) |
| 415 return StopHitTesting; | 415 return StopHitTesting; |
| 416 | 416 |
| 417 if (!node) | 417 if (!node) |
| 418 return ContinueHitTesting; | 418 return ContinueHitTesting; |
| 419 | 419 |
| 420 mutableListBasedTestResult().add(node); | 420 mutableListBasedTestResult().insert(node); |
| 421 | 421 |
| 422 if (hitTestRequest().penetratingList()) | 422 if (hitTestRequest().penetratingList()) |
| 423 return ContinueHitTesting; | 423 return ContinueHitTesting; |
| 424 | 424 |
| 425 return region.contains(location.boundingBox()) ? StopHitTesting | 425 return region.contains(location.boundingBox()) ? StopHitTesting |
| 426 : ContinueHitTesting; | 426 : ContinueHitTesting; |
| 427 } | 427 } |
| 428 | 428 |
| 429 void HitTestResult::append(const HitTestResult& other) { | 429 void HitTestResult::append(const HitTestResult& other) { |
| 430 ASSERT(hitTestRequest().listBased()); | 430 ASSERT(hitTestRequest().listBased()); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 441 m_innerURLElement = other.URLElement(); | 441 m_innerURLElement = other.URLElement(); |
| 442 m_isOverWidget = other.isOverWidget(); | 442 m_isOverWidget = other.isOverWidget(); |
| 443 m_canvasRegionId = other.canvasRegionId(); | 443 m_canvasRegionId = other.canvasRegionId(); |
| 444 } | 444 } |
| 445 | 445 |
| 446 if (other.m_listBasedTestResult) { | 446 if (other.m_listBasedTestResult) { |
| 447 NodeSet& set = mutableListBasedTestResult(); | 447 NodeSet& set = mutableListBasedTestResult(); |
| 448 for (NodeSet::const_iterator it = other.m_listBasedTestResult->begin(), | 448 for (NodeSet::const_iterator it = other.m_listBasedTestResult->begin(), |
| 449 last = other.m_listBasedTestResult->end(); | 449 last = other.m_listBasedTestResult->end(); |
| 450 it != last; ++it) | 450 it != last; ++it) |
| 451 set.add(it->get()); | 451 set.insert(it->get()); |
| 452 } | 452 } |
| 453 } | 453 } |
| 454 | 454 |
| 455 const HitTestResult::NodeSet& HitTestResult::listBasedTestResult() const { | 455 const HitTestResult::NodeSet& HitTestResult::listBasedTestResult() const { |
| 456 if (!m_listBasedTestResult) | 456 if (!m_listBasedTestResult) |
| 457 m_listBasedTestResult = new NodeSet; | 457 m_listBasedTestResult = new NodeSet; |
| 458 return *m_listBasedTestResult; | 458 return *m_listBasedTestResult; |
| 459 } | 459 } |
| 460 | 460 |
| 461 HitTestResult::NodeSet& HitTestResult::mutableListBasedTestResult() { | 461 HitTestResult::NodeSet& HitTestResult::mutableListBasedTestResult() { |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 503 else if (isHTMLMapElement(m_innerNode)) | 503 else if (isHTMLMapElement(m_innerNode)) |
| 504 imageMapImageElement = toHTMLMapElement(m_innerNode)->imageElement(); | 504 imageMapImageElement = toHTMLMapElement(m_innerNode)->imageElement(); |
| 505 | 505 |
| 506 if (!imageMapImageElement) | 506 if (!imageMapImageElement) |
| 507 return m_innerNode.get(); | 507 return m_innerNode.get(); |
| 508 | 508 |
| 509 return imageMapImageElement; | 509 return imageMapImageElement; |
| 510 } | 510 } |
| 511 | 511 |
| 512 } // namespace blink | 512 } // namespace blink |
| OLD | NEW |