| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
| 3 * Copyright (C) 2013 Apple Inc. All rights reserved. | 3 * Copyright (C) 2013 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 788 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 799 | 799 |
| 800 unsigned Internals::activeMarkerCountForNode(Node* node, ExceptionState& excepti
onState) | 800 unsigned Internals::activeMarkerCountForNode(Node* node, ExceptionState& excepti
onState) |
| 801 { | 801 { |
| 802 if (!node) { | 802 if (!node) { |
| 803 exceptionState.throwDOMException(InvalidAccessError, ExceptionMessages::
argumentNullOrIncorrectType(1, "Node")); | 803 exceptionState.throwDOMException(InvalidAccessError, ExceptionMessages::
argumentNullOrIncorrectType(1, "Node")); |
| 804 return 0; | 804 return 0; |
| 805 } | 805 } |
| 806 | 806 |
| 807 // Only TextMatch markers can be active. | 807 // Only TextMatch markers can be active. |
| 808 DocumentMarker::MarkerType markerType = DocumentMarker::TextMatch; | 808 DocumentMarker::MarkerType markerType = DocumentMarker::TextMatch; |
| 809 Vector<DocumentMarker*> markers = node->document().markers().markersFor(node
, markerType); | 809 WillBeHeapVector<DocumentMarker*> markers = node->document().markers().marke
rsFor(node, markerType); |
| 810 | 810 |
| 811 unsigned activeMarkerCount = 0; | 811 unsigned activeMarkerCount = 0; |
| 812 for (Vector<DocumentMarker*>::iterator iter = markers.begin(); iter != marke
rs.end(); ++iter) { | 812 for (WillBeHeapVector<DocumentMarker*>::iterator iter = markers.begin(); ite
r != markers.end(); ++iter) { |
| 813 if ((*iter)->activeMatch()) | 813 if ((*iter)->activeMatch()) |
| 814 activeMarkerCount++; | 814 activeMarkerCount++; |
| 815 } | 815 } |
| 816 | 816 |
| 817 return activeMarkerCount; | 817 return activeMarkerCount; |
| 818 } | 818 } |
| 819 | 819 |
| 820 DocumentMarker* Internals::markerAt(Node* node, const String& markerType, unsign
ed index, ExceptionState& exceptionState) | 820 DocumentMarker* Internals::markerAt(Node* node, const String& markerType, unsign
ed index, ExceptionState& exceptionState) |
| 821 { | 821 { |
| 822 if (!node) { | 822 if (!node) { |
| 823 exceptionState.throwDOMException(InvalidAccessError, ExceptionMessages::
argumentNullOrIncorrectType(1, "Node")); | 823 exceptionState.throwDOMException(InvalidAccessError, ExceptionMessages::
argumentNullOrIncorrectType(1, "Node")); |
| 824 return 0; | 824 return 0; |
| 825 } | 825 } |
| 826 | 826 |
| 827 DocumentMarker::MarkerTypes markerTypes = 0; | 827 DocumentMarker::MarkerTypes markerTypes = 0; |
| 828 if (!markerTypesFrom(markerType, markerTypes)) { | 828 if (!markerTypesFrom(markerType, markerTypes)) { |
| 829 exceptionState.throwDOMException(SyntaxError, "The marker type provided
('" + markerType + "') is invalid."); | 829 exceptionState.throwDOMException(SyntaxError, "The marker type provided
('" + markerType + "') is invalid."); |
| 830 return 0; | 830 return 0; |
| 831 } | 831 } |
| 832 | 832 |
| 833 Vector<DocumentMarker*> markers = node->document().markers().markersFor(node
, markerTypes); | 833 WillBeHeapVector<DocumentMarker*> markers = node->document().markers().marke
rsFor(node, markerTypes); |
| 834 if (markers.size() <= index) | 834 if (markers.size() <= index) |
| 835 return 0; | 835 return 0; |
| 836 return markers[index]; | 836 return markers[index]; |
| 837 } | 837 } |
| 838 | 838 |
| 839 PassRefPtrWillBeRawPtr<Range> Internals::markerRangeForNode(Node* node, const St
ring& markerType, unsigned index, ExceptionState& exceptionState) | 839 PassRefPtrWillBeRawPtr<Range> Internals::markerRangeForNode(Node* node, const St
ring& markerType, unsigned index, ExceptionState& exceptionState) |
| 840 { | 840 { |
| 841 DocumentMarker* marker = markerAt(node, markerType, index, exceptionState); | 841 DocumentMarker* marker = markerAt(node, markerType, index, exceptionState); |
| 842 if (!marker) | 842 if (!marker) |
| 843 return nullptr; | 843 return nullptr; |
| (...skipping 1508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2352 String Internals::textSurroundingNode(Node* node, int x, int y, unsigned long ma
xLength) | 2352 String Internals::textSurroundingNode(Node* node, int x, int y, unsigned long ma
xLength) |
| 2353 { | 2353 { |
| 2354 if (!node) | 2354 if (!node) |
| 2355 return String(); | 2355 return String(); |
| 2356 blink::WebPoint point(x, y); | 2356 blink::WebPoint point(x, y); |
| 2357 SurroundingText surroundingText(VisiblePosition(node->renderer()->positionFo
rPoint(static_cast<IntPoint>(point))), maxLength); | 2357 SurroundingText surroundingText(VisiblePosition(node->renderer()->positionFo
rPoint(static_cast<IntPoint>(point))), maxLength); |
| 2358 return surroundingText.content(); | 2358 return surroundingText.content(); |
| 2359 } | 2359 } |
| 2360 | 2360 |
| 2361 } | 2361 } |
| OLD | NEW |