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 905 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
916 | 916 |
917 WTF::Optional<DocumentMarker::MarkerType> type = markerTypeFrom(markerType); | 917 WTF::Optional<DocumentMarker::MarkerType> type = markerTypeFrom(markerType); |
918 if (!type) { | 918 if (!type) { |
919 exceptionState.throwDOMException( | 919 exceptionState.throwDOMException( |
920 SyntaxError, | 920 SyntaxError, |
921 "The marker type provided ('" + markerType + "') is invalid."); | 921 "The marker type provided ('" + markerType + "') is invalid."); |
922 return; | 922 return; |
923 } | 923 } |
924 | 924 |
925 document->updateStyleAndLayoutIgnorePendingStylesheets(); | 925 document->updateStyleAndLayoutIgnorePendingStylesheets(); |
926 document->markers().addMarker(range->startPosition(), range->endPosition(), | 926 |
927 type.value()); | 927 if (type == DocumentMarker::Grammar) { |
| 928 document->markers().addGrammarMarker(range->startPosition(), |
| 929 range->endPosition()); |
| 930 return; |
| 931 } |
| 932 |
| 933 if (type == DocumentMarker::Spelling) { |
| 934 document->markers().addSpellingMarker(range->startPosition(), |
| 935 range->endPosition()); |
| 936 return; |
| 937 } |
| 938 |
| 939 // Grammar and Spelling markers are the only marker types that can be set with |
| 940 // just a range |
| 941 exceptionState.throwDOMException( |
| 942 SyntaxError, |
| 943 "Marker of type '" + markerType + |
| 944 "' was provided; type must be either Grammar or Spelling."); |
928 } | 945 } |
929 | 946 |
930 unsigned Internals::markerCountForNode(Node* node, | 947 unsigned Internals::markerCountForNode(Node* node, |
931 const String& markerType, | 948 const String& markerType, |
932 ExceptionState& exceptionState) { | 949 ExceptionState& exceptionState) { |
933 DCHECK(node); | 950 DCHECK(node); |
934 WTF::Optional<DocumentMarker::MarkerTypes> markerTypes = | 951 WTF::Optional<DocumentMarker::MarkerTypes> markerTypes = |
935 markerTypesFrom(markerType); | 952 markerTypesFrom(markerType); |
936 if (!markerTypes) { | 953 if (!markerTypes) { |
937 exceptionState.throwDOMException( | 954 exceptionState.throwDOMException( |
(...skipping 2280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3218 | 3235 |
3219 void Internals::crash() { | 3236 void Internals::crash() { |
3220 CHECK(false) << "Intentional crash"; | 3237 CHECK(false) << "Intentional crash"; |
3221 } | 3238 } |
3222 | 3239 |
3223 void Internals::setIsLowEndDevice(bool isLowEndDevice) { | 3240 void Internals::setIsLowEndDevice(bool isLowEndDevice) { |
3224 MemoryCoordinator::setIsLowEndDeviceForTesting(isLowEndDevice); | 3241 MemoryCoordinator::setIsLowEndDeviceForTesting(isLowEndDevice); |
3225 } | 3242 } |
3226 | 3243 |
3227 } // namespace blink | 3244 } // namespace blink |
OLD | NEW |