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 907 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 | 926 |
927 if (type == DocumentMarker::Grammar) { | 927 if (type == DocumentMarker::Grammar) { |
928 document->markers().addGrammarMarker(range->startPosition(), | 928 document->markers().addGrammarMarker(EphemeralRange(range)); |
929 range->endPosition()); | |
930 return; | 929 return; |
931 } | 930 } |
932 | 931 |
933 if (type == DocumentMarker::Spelling) { | 932 if (type == DocumentMarker::Spelling) { |
934 document->markers().addSpellingMarker(range->startPosition(), | 933 document->markers().addSpellingMarker(EphemeralRange(range)); |
935 range->endPosition()); | |
936 return; | 934 return; |
937 } | 935 } |
938 | 936 |
939 // Grammar and Spelling markers are the only marker types that can be set with | 937 // Grammar and Spelling markers are the only marker types that can be set with |
940 // just a range | 938 // just a range |
941 exceptionState.throwDOMException( | 939 exceptionState.throwDOMException( |
942 SyntaxError, | 940 SyntaxError, |
943 "Marker of type '" + markerType + | 941 "Marker of type '" + markerType + |
944 "' was provided; type must be either Grammar or Spelling."); | 942 "' was provided; type must be either Grammar or Spelling."); |
945 } | 943 } |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1056 DCHECK(range); | 1054 DCHECK(range); |
1057 range->ownerDocument().updateStyleAndLayoutIgnorePendingStylesheets(); | 1055 range->ownerDocument().updateStyleAndLayoutIgnorePendingStylesheets(); |
1058 | 1056 |
1059 Color underlineColor; | 1057 Color underlineColor; |
1060 Color backgroundColor; | 1058 Color backgroundColor; |
1061 if (parseColor(underlineColorValue, underlineColor, exceptionState, | 1059 if (parseColor(underlineColorValue, underlineColor, exceptionState, |
1062 "Invalid underline color.") && | 1060 "Invalid underline color.") && |
1063 parseColor(backgroundColorValue, backgroundColor, exceptionState, | 1061 parseColor(backgroundColorValue, backgroundColor, exceptionState, |
1064 "Invalid background color.")) { | 1062 "Invalid background color.")) { |
1065 range->ownerDocument().markers().addCompositionMarker( | 1063 range->ownerDocument().markers().addCompositionMarker( |
1066 range->startPosition(), range->endPosition(), underlineColor, thick, | 1064 EphemeralRange(range), underlineColor, thick, backgroundColor); |
1067 backgroundColor); | |
1068 } | 1065 } |
1069 } | 1066 } |
1070 | 1067 |
1071 void Internals::setMarkersActive(Node* node, | 1068 void Internals::setMarkersActive(Node* node, |
1072 unsigned startOffset, | 1069 unsigned startOffset, |
1073 unsigned endOffset, | 1070 unsigned endOffset, |
1074 bool active) { | 1071 bool active) { |
1075 DCHECK(node); | 1072 DCHECK(node); |
1076 node->document().markers().setTextMatchMarkersActive(node, startOffset, | 1073 node->document().markers().setTextMatchMarkersActive(node, startOffset, |
1077 endOffset, active); | 1074 endOffset, active); |
(...skipping 2157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3235 | 3232 |
3236 void Internals::crash() { | 3233 void Internals::crash() { |
3237 CHECK(false) << "Intentional crash"; | 3234 CHECK(false) << "Intentional crash"; |
3238 } | 3235 } |
3239 | 3236 |
3240 void Internals::setIsLowEndDevice(bool isLowEndDevice) { | 3237 void Internals::setIsLowEndDevice(bool isLowEndDevice) { |
3241 MemoryCoordinator::setIsLowEndDeviceForTesting(isLowEndDevice); | 3238 MemoryCoordinator::setIsLowEndDeviceForTesting(isLowEndDevice); |
3242 } | 3239 } |
3243 | 3240 |
3244 } // namespace blink | 3241 } // namespace blink |
OLD | NEW |