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

Side by Side Diff: third_party/WebKit/Source/web/WebViewImpl.cpp

Issue 2816263003: Move spelling marker related functions from WebView to WebLocalFrame (Closed)
Patch Set: Created 3 years, 8 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) 2011, 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 27 matching lines...) Expand all
38 #include "core/dom/Document.h" 38 #include "core/dom/Document.h"
39 #include "core/dom/DocumentUserGestureToken.h" 39 #include "core/dom/DocumentUserGestureToken.h"
40 #include "core/dom/Fullscreen.h" 40 #include "core/dom/Fullscreen.h"
41 #include "core/dom/LayoutTreeBuilderTraversal.h" 41 #include "core/dom/LayoutTreeBuilderTraversal.h"
42 #include "core/dom/Text.h" 42 #include "core/dom/Text.h"
43 #include "core/editing/EditingUtilities.h" 43 #include "core/editing/EditingUtilities.h"
44 #include "core/editing/Editor.h" 44 #include "core/editing/Editor.h"
45 #include "core/editing/FrameSelection.h" 45 #include "core/editing/FrameSelection.h"
46 #include "core/editing/InputMethodController.h" 46 #include "core/editing/InputMethodController.h"
47 #include "core/editing/iterators/TextIterator.h" 47 #include "core/editing/iterators/TextIterator.h"
48 #include "core/editing/markers/DocumentMarkerController.h"
49 #include "core/editing/serializers/HTMLInterchange.h" 48 #include "core/editing/serializers/HTMLInterchange.h"
50 #include "core/editing/serializers/Serialization.h" 49 #include "core/editing/serializers/Serialization.h"
51 #include "core/events/KeyboardEvent.h" 50 #include "core/events/KeyboardEvent.h"
52 #include "core/events/UIEventWithKeyState.h" 51 #include "core/events/UIEventWithKeyState.h"
53 #include "core/events/WheelEvent.h" 52 #include "core/events/WheelEvent.h"
54 #include "core/frame/BrowserControls.h" 53 #include "core/frame/BrowserControls.h"
55 #include "core/frame/EventHandlerRegistry.h" 54 #include "core/frame/EventHandlerRegistry.h"
56 #include "core/frame/FrameView.h" 55 #include "core/frame/FrameView.h"
57 #include "core/frame/LocalFrame.h" 56 #include "core/frame/LocalFrame.h"
58 #include "core/frame/LocalFrameClient.h" 57 #include "core/frame/LocalFrameClient.h"
(...skipping 3357 matching lines...) Expand 10 before | Expand all | Expand 10 after
3416 HitTestResult WebViewImpl::CoreHitTestResultAt( 3415 HitTestResult WebViewImpl::CoreHitTestResultAt(
3417 const WebPoint& point_in_viewport) { 3416 const WebPoint& point_in_viewport) {
3418 DocumentLifecycle::AllowThrottlingScope throttling_scope( 3417 DocumentLifecycle::AllowThrottlingScope throttling_scope(
3419 MainFrameImpl()->GetFrame()->GetDocument()->Lifecycle()); 3418 MainFrameImpl()->GetFrame()->GetDocument()->Lifecycle());
3420 FrameView* view = MainFrameImpl()->GetFrameView(); 3419 FrameView* view = MainFrameImpl()->GetFrameView();
3421 IntPoint point_in_root_frame = 3420 IntPoint point_in_root_frame =
3422 view->ContentsToFrame(view->ViewportToContents(point_in_viewport)); 3421 view->ContentsToFrame(view->ViewportToContents(point_in_viewport));
3423 return HitTestResultForRootFramePos(point_in_root_frame); 3422 return HitTestResultForRootFramePos(point_in_root_frame);
3424 } 3423 }
3425 3424
3426 void WebViewImpl::SpellingMarkerOffsetsForTest(WebVector<unsigned>* offsets) {
3427 Vector<unsigned> result;
3428 for (Frame* frame = page_->MainFrame(); frame;
3429 frame = frame->Tree().TraverseNext()) {
3430 if (!frame->IsLocalFrame())
3431 continue;
3432 const DocumentMarkerVector& document_markers =
3433 ToLocalFrame(frame)->GetDocument()->Markers().Markers();
3434 for (size_t i = 0; i < document_markers.size(); ++i)
3435 result.push_back(document_markers[i]->StartOffset());
3436 }
3437 offsets->Assign(result);
3438 }
3439
3440 void WebViewImpl::RemoveSpellingMarkersUnderWords(
3441 const WebVector<WebString>& words) {
3442 Vector<String> converted_words;
3443 converted_words.Append(words.Data(), words.size());
3444
3445 for (Frame* frame = page_->MainFrame(); frame;
3446 frame = frame->Tree().TraverseNext()) {
3447 if (frame->IsLocalFrame())
3448 ToLocalFrame(frame)->RemoveSpellingMarkersUnderWords(converted_words);
3449 }
3450 }
3451
3452 void WebViewImpl::SendResizeEventAndRepaint() { 3425 void WebViewImpl::SendResizeEventAndRepaint() {
3453 // FIXME: This is wrong. The FrameView is responsible sending a resizeEvent 3426 // FIXME: This is wrong. The FrameView is responsible sending a resizeEvent
3454 // as part of layout. Layout is also responsible for sending invalidations 3427 // as part of layout. Layout is also responsible for sending invalidations
3455 // to the embedder. This method and all callers may be wrong. -- eseidel. 3428 // to the embedder. This method and all callers may be wrong. -- eseidel.
3456 if (MainFrameImpl()->GetFrameView()) { 3429 if (MainFrameImpl()->GetFrameView()) {
3457 // Enqueues the resize event. 3430 // Enqueues the resize event.
3458 MainFrameImpl()->GetFrame()->GetDocument()->EnqueueResizeEvent(); 3431 MainFrameImpl()->GetFrame()->GetDocument()->EnqueueResizeEvent();
3459 } 3432 }
3460 3433
3461 if (client_) { 3434 if (client_) {
(...skipping 728 matching lines...) Expand 10 before | Expand all | Expand 10 after
4190 if (focused_frame->LocalFrameRoot() != MainFrameImpl()->GetFrame()) 4163 if (focused_frame->LocalFrameRoot() != MainFrameImpl()->GetFrame())
4191 return nullptr; 4164 return nullptr;
4192 return focused_frame; 4165 return focused_frame;
4193 } 4166 }
4194 4167
4195 LocalFrame* WebViewImpl::FocusedLocalFrameAvailableForIme() const { 4168 LocalFrame* WebViewImpl::FocusedLocalFrameAvailableForIme() const {
4196 return ime_accept_events_ ? FocusedLocalFrameInWidget() : nullptr; 4169 return ime_accept_events_ ? FocusedLocalFrameInWidget() : nullptr;
4197 } 4170 }
4198 4171
4199 } // namespace blink 4172 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/WebViewImpl.h ('k') | third_party/WebKit/Source/web/tests/WebFrameTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698