Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(304)

Side by Side Diff: third_party/WebKit/Source/core/testing/Internals.cpp

Issue 2895253003: Split general DocumentMarkerController::AddMarker() method into spelling/grammar versions (Closed)
Patch Set: Split off InputMethodControllerTest changes, make other requested changes Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 903 matching lines...) Expand 10 before | Expand all | Expand 10 after
914 } 914 }
915 915
916 WTF::Optional<DocumentMarker::MarkerType> type = MarkerTypeFrom(marker_type); 916 WTF::Optional<DocumentMarker::MarkerType> type = MarkerTypeFrom(marker_type);
917 if (!type) { 917 if (!type) {
918 exception_state.ThrowDOMException( 918 exception_state.ThrowDOMException(
919 kSyntaxError, 919 kSyntaxError,
920 "The marker type provided ('" + marker_type + "') is invalid."); 920 "The marker type provided ('" + marker_type + "') is invalid.");
921 return; 921 return;
922 } 922 }
923 923
924 if (type != DocumentMarker::kSpelling && type != DocumentMarker::kGrammar) {
925 exception_state.ThrowDOMException(kSyntaxError,
926 "internals.setMarker() currently only "
927 "supports spelling and grammar markers; "
928 "attempted to add marker of type '" +
929 marker_type + "'.");
930 return;
931 }
932
924 document->UpdateStyleAndLayoutIgnorePendingStylesheets(); 933 document->UpdateStyleAndLayoutIgnorePendingStylesheets();
925 document->Markers().AddMarker(range->StartPosition(), range->EndPosition(), 934 if (type == DocumentMarker::kSpelling) {
926 type.value()); 935 document->Markers().AddSpellingMarker(range->StartPosition(),
936 range->EndPosition());
937 } else {
938 document->Markers().AddGrammarMarker(range->StartPosition(),
939 range->EndPosition());
940 }
927 } 941 }
928 942
929 unsigned Internals::markerCountForNode(Node* node, 943 unsigned Internals::markerCountForNode(Node* node,
930 const String& marker_type, 944 const String& marker_type,
931 ExceptionState& exception_state) { 945 ExceptionState& exception_state) {
932 DCHECK(node); 946 DCHECK(node);
933 WTF::Optional<DocumentMarker::MarkerTypes> marker_types = 947 WTF::Optional<DocumentMarker::MarkerTypes> marker_types =
934 MarkerTypesFrom(marker_type); 948 MarkerTypesFrom(marker_type);
935 if (!marker_types) { 949 if (!marker_types) {
936 exception_state.ThrowDOMException( 950 exception_state.ThrowDOMException(
(...skipping 2344 matching lines...) Expand 10 before | Expand all | Expand 10 after
3281 3295
3282 void Internals::crash() { 3296 void Internals::crash() {
3283 CHECK(false) << "Intentional crash"; 3297 CHECK(false) << "Intentional crash";
3284 } 3298 }
3285 3299
3286 void Internals::setIsLowEndDevice(bool is_low_end_device) { 3300 void Internals::setIsLowEndDevice(bool is_low_end_device) {
3287 MemoryCoordinator::SetIsLowEndDeviceForTesting(is_low_end_device); 3301 MemoryCoordinator::SetIsLowEndDeviceForTesting(is_low_end_device);
3288 } 3302 }
3289 3303
3290 } // namespace blink 3304 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698