Changeset 154678 in webkit
- Timestamp:
- Aug 27, 2013 6:00:34 AM (11 years ago)
- Location:
- trunk/Source
- Files:
-
- 30 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r154676 r154678 1 2013-08-26 Andreas Kling <akling@apple.com> 2 3 FocusController::focusedOrMainFrame() should return a reference. 4 <https://webkit.org/b/120339> 5 6 Reviewed by Antti Koivisto. 7 8 Now that Page::mainFrame() returns a reference, we can make this return a reference 9 too, since there's always either a focused or a main frame. 10 11 One hectogram of null checks removed as a result. 12 1 13 2013-08-26 Andreas Kling <akling@apple.com> 2 14 -
trunk/Source/WebCore/accessibility/AXObjectCache.cpp
r154580 r154678 162 162 163 163 // get the focused node in the page 164 Document* focusedDocument = page->focusController().focusedOrMainFrame() ->document();164 Document* focusedDocument = page->focusController().focusedOrMainFrame().document(); 165 165 Element* focusedElement = focusedDocument->focusedElement(); 166 166 if (focusedElement && isHTMLAreaElement(focusedElement)) -
trunk/Source/WebCore/editing/Editor.cpp
r154663 r154678 985 985 if (Frame* editedFrame = document->frame()) 986 986 if (Page* page = editedFrame->page()) 987 page->focusController().focusedOrMainFrame() ->selection().revealSelection(ScrollAlignment::alignCenterIfNeeded);987 page->focusController().focusedOrMainFrame().selection().revealSelection(ScrollAlignment::alignCenterIfNeeded); 988 988 } 989 989 } -
trunk/Source/WebCore/history/CachedPage.cpp
r154658 r154678 85 85 // Restore the focus appearance for the focused element. 86 86 // FIXME: Right now we don't support pages w/ frames in the b/f cache. This may need to be tweaked when we add support for that. 87 Document* focusedDocument = page->focusController().focusedOrMainFrame() ->document();87 Document* focusedDocument = page->focusController().focusedOrMainFrame().document(); 88 88 if (Element* element = focusedDocument->focusedElement()) 89 89 element->updateFocusAppearance(true); -
trunk/Source/WebCore/page/EventHandler.cpp
r154673 r154678 1966 1966 if (!m_frame->page()) 1967 1967 return false; 1968 Frame *focusFrame = m_frame->page()->focusController().focusedOrMainFrame();1968 Frame& focusFrame = m_frame->page()->focusController().focusedOrMainFrame(); 1969 1969 // Do not paste here if the focus was moved somewhere else. 1970 if (m_frame == focusFrame && m_frame->editor().client()->supportsGlobalSelection())1970 if (m_frame == &focusFrame && m_frame->editor().client()->supportsGlobalSelection()) 1971 1971 return m_frame->editor().command(ASCIILiteral("PasteGlobalSelection")).execute(); 1972 1972 … … 3337 3337 node->dispatchEvent(keydown, IGNORE_EXCEPTION); 3338 3338 // If frame changed as a result of keydown dispatch, then return true to avoid sending a subsequent keypress message to the new frame. 3339 bool changedFocusedFrame = m_frame->page() && m_frame != m_frame->page()->focusController().focusedOrMainFrame();3339 bool changedFocusedFrame = m_frame->page() && m_frame != &m_frame->page()->focusController().focusedOrMainFrame(); 3340 3340 return keydown->defaultHandled() || keydown->defaultPrevented() || changedFocusedFrame; 3341 3341 } … … 3359 3359 node->dispatchEvent(keydown, IGNORE_EXCEPTION); 3360 3360 // If frame changed as a result of keydown dispatch, then return early to avoid sending a subsequent keypress message to the new frame. 3361 bool changedFocusedFrame = m_frame->page() && m_frame != m_frame->page()->focusController().focusedOrMainFrame();3361 bool changedFocusedFrame = m_frame->page() && m_frame != &m_frame->page()->focusController().focusedOrMainFrame(); 3362 3362 bool keydownResult = keydown->defaultHandled() || keydown->defaultPrevented() || changedFocusedFrame; 3363 3363 if (handledByInputMethod || (keydownResult && !backwardCompatibilityMode)) -
trunk/Source/WebCore/page/FocusController.cpp
r154658 r154678 205 205 } 206 206 207 Frame *FocusController::focusedOrMainFrame() const207 Frame& FocusController::focusedOrMainFrame() const 208 208 { 209 209 if (Frame* frame = focusedFrame()) 210 return frame;211 return &m_page->mainFrame();210 return *frame; 211 return m_page->mainFrame(); 212 212 } 213 213 … … 220 220 221 221 if (!m_isFocused) 222 focusedOrMainFrame() ->eventHandler().stopAutoscrollTimer();222 focusedOrMainFrame().eventHandler().stopAutoscrollTimer(); 223 223 224 224 if (!m_focusedFrame) … … 256 256 // into the web area again, even if focus did not change within WebCore. PostNotification is called instead 257 257 // of handleFocusedUIElementChanged, because this will send the notification even if the element is the same. 258 if (AXObjectCache* cache = focusedOrMainFrame() ->document()->existingAXObjectCache())259 cache->postNotification(focusedOrMainFrame() ->document(), AXObjectCache::AXFocusedUIElementChanged, true);258 if (AXObjectCache* cache = focusedOrMainFrame().document()->existingAXObjectCache()) 259 cache->postNotification(focusedOrMainFrame().document(), AXObjectCache::AXFocusedUIElementChanged, true); 260 260 261 261 return didAdvanceFocus; … … 282 282 bool FocusController::advanceFocusInDocumentOrder(FocusDirection direction, KeyboardEvent* event, bool initialFocus) 283 283 { 284 Frame* frame = focusedOrMainFrame(); 285 ASSERT(frame); 286 Document* document = frame->document(); 284 Frame& frame = focusedOrMainFrame(); 285 Document* document = frame.document(); 287 286 288 287 Node* currentNode = document->focusedElement(); 289 288 // FIXME: Not quite correct when it comes to focus transitions leaving/entering the WebView itself 290 bool caretBrowsing = frame ->settings().caretBrowsingEnabled();289 bool caretBrowsing = frame.settings().caretBrowsingEnabled(); 291 290 292 291 if (caretBrowsing && !currentNode) 293 currentNode = frame ->selection().start().deprecatedNode();292 currentNode = frame.selection().start().deprecatedNode(); 294 293 295 294 document->updateLayoutIgnorePendingStylesheets(); … … 350 349 Position position = firstPositionInOrBeforeNode(element.get()); 351 350 VisibleSelection newSelection(position, position, DOWNSTREAM); 352 if (frame ->selection().shouldChangeSelection(newSelection))353 frame ->selection().setSelection(newSelection);351 if (frame.selection().shouldChangeSelection(newSelection)) 352 frame.selection().setSelection(newSelection); 354 353 } 355 354 … … 661 660 } 662 661 663 focusedOrMainFrame() ->selection().pageActivationChanged();662 focusedOrMainFrame().selection().pageActivationChanged(); 664 663 665 664 if (m_focusedFrame && isFocused()) … … 829 828 // Navigate into a new frame. 830 829 LayoutRect rect; 831 Element* focusedElement = focusedOrMainFrame() ->document()->focusedElement();830 Element* focusedElement = focusedOrMainFrame().document()->focusedElement(); 832 831 if (focusedElement && !hasOffscreenRect(focusedElement)) 833 832 rect = nodeRectInAbsoluteCoordinates(focusedElement, true /* ignore border */); … … 847 846 // Navigate into a new scrollable container. 848 847 LayoutRect startingRect; 849 Element* focusedElement = focusedOrMainFrame() ->document()->focusedElement();848 Element* focusedElement = focusedOrMainFrame().document()->focusedElement(); 850 849 if (focusedElement && !hasOffscreenRect(focusedElement)) 851 850 startingRect = nodeRectInAbsoluteCoordinates(focusedElement, true); … … 868 867 bool FocusController::advanceFocusDirectionally(FocusDirection direction, KeyboardEvent* event) 869 868 { 870 Frame* curFrame = focusedOrMainFrame(); 871 ASSERT(curFrame); 872 873 Document* focusedDocument = curFrame->document(); 869 Document* focusedDocument = focusedOrMainFrame().document(); 874 870 if (!focusedDocument) 875 871 return false; -
trunk/Source/WebCore/page/FocusController.h
r150869 r154678 67 67 void setFocusedFrame(PassRefPtr<Frame>); 68 68 Frame* focusedFrame() const { return m_focusedFrame.get(); } 69 Frame *focusedOrMainFrame() const;69 Frame& focusedOrMainFrame() const; 70 70 71 71 bool setInitialFocus(FocusDirection, KeyboardEvent*); -
trunk/Source/WebCore/page/Page.cpp
r154658 r154678 566 566 567 567 bool shouldWrap = options & WrapAround; 568 Frame* frame = focusController().focusedOrMainFrame();568 Frame* frame = &focusController().focusedOrMainFrame(); 569 569 Frame* startFrame = frame; 570 570 do { … … 698 698 const VisibleSelection& Page::selection() const 699 699 { 700 return focusController().focusedOrMainFrame() ->selection().selection();700 return focusController().focusedOrMainFrame().selection().selection(); 701 701 } 702 702 -
trunk/Source/WebKit/efl/WebCoreSupport/DumpRenderTreeSupportEfl.cpp
r154558 r154678 300 300 DRT_SUPPRT_PAGE_GET_OR_RETURN(ewkView, page); 301 301 302 page->focusController().focusedOrMainFrame() ->editor().command(name).execute(value);302 page->focusController().focusedOrMainFrame().editor().command(name).execute(value); 303 303 } 304 304 … … 349 349 DRT_SUPPRT_PAGE_GET_OR_RETURN(ewkView, page, false); 350 350 351 return page->focusController().focusedOrMainFrame() ->editor().command(name).isEnabled();351 return page->focusController().focusedOrMainFrame().editor().command(name).isEnabled(); 352 352 } 353 353 … … 566 566 DRT_SUPPRT_PAGE_GET_OR_RETURN(ewkView, page); 567 567 568 if (!page->focusController().focusedOrMainFrame()) 569 return; 570 571 WebCore::Editor& editor = page->focusController().focusedOrMainFrame()->editor(); 568 WebCore::Editor& editor = page->focusController().focusedOrMainFrame().editor(); 572 569 if (!editor.canEdit() && !editor.hasComposition()) 573 570 return; … … 583 580 DRT_SUPPRT_PAGE_GET_OR_RETURN(ewkView, page, false); 584 581 585 if (!page->focusController().focusedOrMainFrame()) 586 return false; 587 588 return page->focusController().focusedOrMainFrame()->editor().hasComposition(); 582 return page->focusController().focusedOrMainFrame().editor().hasComposition(); 589 583 } 590 584 … … 595 589 DRT_SUPPRT_PAGE_GET_OR_RETURN(ewkView, page, false); 596 590 597 if (!page->focusController().focusedOrMainFrame()) 598 return false; 599 600 WebCore::Editor& editor = page->focusController().focusedOrMainFrame()->editor(); 591 WebCore::Editor& editor = page->focusController().focusedOrMainFrame().editor(); 601 592 if (!editor.hasComposition()) 602 593 return false; … … 611 602 DRT_SUPPRT_PAGE_GET_OR_RETURN(ewkView, page); 612 603 613 if (!page->focusController().focusedOrMainFrame()) 614 return; 615 616 WebCore::Editor& editor = page->focusController().focusedOrMainFrame()->editor(); 604 WebCore::Editor& editor = page->focusController().focusedOrMainFrame().editor(); 617 605 618 606 if (!editor.hasComposition()) { … … 632 620 DRT_SUPPRT_PAGE_GET_OR_RETURN(ewkView, page, WebCore::IntRect()); 633 621 634 if (!page->focusController().focusedOrMainFrame())635 return WebCore::IntRect();636 637 622 if ((location + length < location) && (location + length)) 638 623 length = 0; 639 624 640 WebCore::Frame *frame = page->focusController().focusedOrMainFrame();641 642 RefPtr<WebCore::Range> range = WebCore::TextIterator::rangeFromLocationAndLength(frame ->selection().rootEditableElementOrDocumentElement(), location, length);625 WebCore::Frame& frame = page->focusController().focusedOrMainFrame(); 626 627 RefPtr<WebCore::Range> range = WebCore::TextIterator::rangeFromLocationAndLength(frame.selection().rootEditableElementOrDocumentElement(), location, length); 643 628 if (!range) 644 629 return WebCore::IntRect(); 645 630 646 return frame ->editor().firstRectForRange(range.get());631 return frame.editor().firstRectForRange(range.get()); 647 632 } 648 633 … … 654 639 DRT_SUPPRT_PAGE_GET_OR_RETURN(ewkView, page, false); 655 640 656 if (!page->focusController().focusedOrMainFrame()) 657 return false; 658 659 WebCore::Frame* frame = page->focusController().focusedOrMainFrame(); 660 RefPtr<WebCore::Range> range = frame->selection().toNormalizedRange().get(); 641 WebCore::Frame& frame = page->focusController().focusedOrMainFrame(); 642 RefPtr<WebCore::Range> range = frame.selection().toNormalizedRange().get(); 661 643 if (!range) 662 644 return false; 663 645 664 WebCore::Element* selectionRoot = frame ->selection().rootEditableElement();665 WebCore::Element* scope = selectionRoot ? selectionRoot : frame ->document()->documentElement();646 WebCore::Element* selectionRoot = frame.selection().rootEditableElement(); 647 WebCore::Element* scope = selectionRoot ? selectionRoot : frame.document()->documentElement(); 666 648 667 649 RefPtr<WebCore::Range> testRange = WebCore::Range::create(scope->document(), scope, 0, range->startContainer(), range->startOffset()); -
trunk/Source/WebKit/efl/ewk/ewk_view.cpp
r154658 r154678 1574 1574 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0); 1575 1575 EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0); 1576 CString selectedString = priv->page->focusController().focusedOrMainFrame() ->editor().selectedText().utf8();1576 CString selectedString = priv->page->focusController().focusedOrMainFrame().editor().selectedText().utf8(); 1577 1577 if (selectedString.isNull()) 1578 1578 return 0; … … 1589 1589 return false; 1590 1590 1591 return priv->page->focusController().focusedOrMainFrame() ->editor().command(commandString).execute(WTF::String::fromUTF8(value));1591 return priv->page->focusController().focusedOrMainFrame().editor().command(commandString).execute(WTF::String::fromUTF8(value)); 1592 1592 } 1593 1593 … … 2946 2946 EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); 2947 2947 EWK_VIEW_PRIV_GET(smartData, priv); 2948 WebCore::Frame *focusedFrame = priv->page->focusController().focusedOrMainFrame();2948 WebCore::Frame& focusedFrame = priv->page->focusController().focusedOrMainFrame(); 2949 2949 2950 2950 priv->imh = 0; 2951 if (focusedFrame 2952 && focusedFrame->document() 2953 && focusedFrame->document()->focusedElement() 2954 && isHTMLInputElement(focusedFrame->document()->focusedElement())) { 2951 if (focusedFrame.document() 2952 && focusedFrame.document()->focusedElement() 2953 && isHTMLInputElement(focusedFrame.document()->focusedElement())) { 2955 2954 WebCore::HTMLInputElement* inputElement; 2956 2955 2957 inputElement = static_cast<WebCore::HTMLInputElement*>(focusedFrame ->document()->focusedElement());2956 inputElement = static_cast<WebCore::HTMLInputElement*>(focusedFrame.document()->focusedElement()); 2958 2957 if (inputElement) { 2959 2958 // for password fields, active == false … … 4012 4011 // attribute and its CSS "direction" property. 4013 4012 // So, we just call the function as Safari does. 4014 WebCore::Frame* focusedFrame = priv->page->focusController().focusedOrMainFrame(); 4015 if (!focusedFrame) 4016 return; 4017 4018 WebCore::Editor& editor = focusedFrame->editor(); 4013 WebCore::Frame& focusedFrame = priv->page->focusController().focusedOrMainFrame(); 4014 4015 WebCore::Editor& editor = focusedFrame.editor(); 4019 4016 if (!editor.canEdit()) 4020 4017 return; -
trunk/Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp
r154658 r154678 624 624 // synced with cursor movement. For instance, a text field can move without 625 625 // the selection changing. 626 Frame *focusedFrame = core(m_webView)->focusController().focusedOrMainFrame();627 if (focusedFrame && focusedFrame->editor().canEdit())626 Frame& focusedFrame = core(m_webView)->focusController().focusedOrMainFrame(); 627 if (focusedFrame.editor().canEdit()) 628 628 m_webView->priv->imFilter.setCursorRect(frame.selection().absoluteCaretBounds()); 629 629 } -
trunk/Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.cpp
r154558 r154678 277 277 g_return_if_fail(value); 278 278 279 core(webView)->focusController().focusedOrMainFrame() ->editor().command(name).execute(value);279 core(webView)->focusController().focusedOrMainFrame().editor().command(name).execute(value); 280 280 } 281 281 … … 285 285 g_return_val_if_fail(name, FALSE); 286 286 287 return core(webView)->focusController().focusedOrMainFrame() ->editor().command(name).isEnabled();287 return core(webView)->focusController().focusedOrMainFrame().editor().command(name).isEnabled(); 288 288 } 289 289 … … 293 293 g_return_if_fail(text); 294 294 295 Frame* frame = core(webView)->focusController().focusedOrMainFrame(); 296 if (!frame) 297 return; 298 299 Editor& editor = frame->editor(); 295 Frame& frame = core(webView)->focusController().focusedOrMainFrame(); 296 Editor& editor = frame.editor(); 300 297 if (!editor.canEdit() && !editor.hasComposition()) 301 298 return; … … 310 307 { 311 308 g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), false); 312 Frame* frame = core(webView)->focusController().focusedOrMainFrame(); 313 if (!frame) 314 return false; 315 316 return frame->editor().hasComposition(); 309 Frame& frame = core(webView)->focusController().focusedOrMainFrame(); 310 return frame.editor().hasComposition(); 317 311 } 318 312 … … 323 317 324 318 g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), false); 325 Frame* frame = core(webView)->focusController().focusedOrMainFrame(); 326 if (!frame) 327 return false; 328 329 Editor& editor = frame->editor(); 319 Frame& frame = core(webView)->focusController().focusedOrMainFrame(); 320 Editor& editor = frame.editor(); 330 321 if (!editor.hasComposition()) 331 322 return false; … … 340 331 g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView)); 341 332 342 Frame* frame = core(webView)->focusController().focusedOrMainFrame(); 343 if (!frame) 344 return; 345 346 Editor& editor = frame->editor(); 333 Frame& frame = core(webView)->focusController().focusedOrMainFrame(); 334 Editor& editor = frame.editor(); 347 335 348 336 if (!editor.hasComposition()) { … … 360 348 { 361 349 g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView)); 362 Frame* frame = core(webView)->focusController().focusedOrMainFrame(); 363 if (!frame) 364 return; 365 366 Editor& editor = frame->editor(); 350 Frame& frame = core(webView)->focusController().focusedOrMainFrame(); 351 Editor& editor = frame.editor(); 367 352 368 353 String commandString(command); … … 388 373 length = 0; 389 374 390 Frame* frame = core(webView)->focusController().focusedOrMainFrame(); 391 if (!frame) 392 return false; 393 394 Editor& editor = frame->editor(); 395 396 RefPtr<Range> range = TextIterator::rangeFromLocationAndLength(frame->selection().rootEditableElementOrDocumentElement(), location, length); 375 Frame& frame = core(webView)->focusController().focusedOrMainFrame(); 376 Editor& editor = frame.editor(); 377 378 RefPtr<Range> range = TextIterator::rangeFromLocationAndLength(frame.selection().rootEditableElementOrDocumentElement(), location, length); 397 379 if (!range) 398 380 return false; … … 407 389 g_return_val_if_fail(start && length, false); 408 390 409 Frame* frame = core(webView)->focusController().focusedOrMainFrame(); 410 if (!frame) 411 return false; 412 413 RefPtr<Range> range = frame->selection().toNormalizedRange().get(); 391 Frame& frame = core(webView)->focusController().focusedOrMainFrame(); 392 393 RefPtr<Range> range = frame.selection().toNormalizedRange().get(); 414 394 if (!range) 415 395 return false; 416 396 417 Element* selectionRoot = frame ->selection().rootEditableElement();418 Element* scope = selectionRoot ? selectionRoot : frame ->document()->documentElement();397 Element* selectionRoot = frame.selection().rootEditableElement(); 398 Element* scope = selectionRoot ? selectionRoot : frame.document()->documentElement(); 419 399 420 400 RefPtr<Range> testRange = Range::create(scope->document(), scope, 0, range->startContainer(), range->startOffset()); -
trunk/Source/WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp
r154286 r154678 213 213 return; 214 214 215 Frame *frame = corePage->focusController().focusedOrMainFrame();215 Frame& frame = corePage->focusController().focusedOrMainFrame(); 216 216 217 217 // Collapse the selection without clearing it 218 ASSERT(frame); 219 frame->selection().setBase(frame->selection().extent(), frame->selection().affinity()); 218 frame.selection().setBase(frame.selection().extent(), frame.selection().affinity()); 220 219 } 221 220 … … 229 228 DataObjectGtk* dataObject = DataObjectGtk::forClipboard(clipboard); 230 229 WebCore::Page* corePage = core(webView); 231 Frame *targetFrame = corePage->focusController().focusedOrMainFrame();232 233 if (!targetFrame ->selection().isRange())230 Frame& targetFrame = corePage->focusController().focusedOrMainFrame(); 231 232 if (!targetFrame.selection().isRange()) 234 233 return; 235 234 236 235 dataObject->clearAll(); 237 dataObject->setRange(targetFrame ->selection().toNormalizedRange());236 dataObject->setRange(targetFrame.selection().toNormalizedRange()); 238 237 239 238 viewSettingClipboard = webView; -
trunk/Source/WebKit/gtk/WebCoreSupport/WebViewInputMethodFilter.cpp
r154178 r154678 40 40 return 0; 41 41 42 return page->focusController().focusedOrMainFrame();42 return &page->focusController().focusedOrMainFrame(); 43 43 } 44 44 -
trunk/Source/WebKit/gtk/webkit/webkitwebinspector.cpp
r154122 r154678 486 486 WebKitWebInspectorPrivate* priv = webInspector->priv; 487 487 488 Frame *frame = priv->page->focusController().focusedOrMainFrame();489 FrameView* view = frame ->view();488 Frame& frame = priv->page->focusController().focusedOrMainFrame(); 489 FrameView* view = frame.view(); 490 490 491 491 if (!view) … … 536 536 WebKitWebInspectorPrivate* priv = webInspector->priv; 537 537 538 Frame *frame = priv->page->focusController().focusedOrMainFrame();539 FrameView* view = frame ->view();538 Frame& frame = priv->page->focusController().focusedOrMainFrame(); 539 FrameView* view = frame.view(); 540 540 541 541 if (!view) … … 546 546 HitTestResult result(documentPoint); 547 547 548 frame ->contentRenderer()->layer()->hitTest(request, result);548 frame.contentRenderer()->layer()->hitTest(request, result); 549 549 priv->page->inspectorController()->inspect(result.innerNonSharedNode()); 550 550 } -
trunk/Source/WebKit/gtk/webkit/webkitwebview.cpp
r154658 r154678 362 362 targetFrame = mainFrame; 363 363 364 focusedFrame = page->focusController().focusedOrMainFrame();364 focusedFrame = &page->focusController().focusedOrMainFrame(); 365 365 if (targetFrame != focusedFrame) { 366 366 page->focusController().setFocusedFrame(targetFrame); … … 448 448 static gboolean webkit_web_view_popup_menu_handler(GtkWidget* widget) 449 449 { 450 Frame *frame = core(WEBKIT_WEB_VIEW(widget))->focusController().focusedOrMainFrame();451 IntPoint location = getLocationForKeyboardGeneratedContextMenu( frame);452 453 FrameView* view = frame ->view();450 Frame& frame = core(WEBKIT_WEB_VIEW(widget))->focusController().focusedOrMainFrame(); 451 IntPoint location = getLocationForKeyboardGeneratedContextMenu(&frame); 452 453 FrameView* view = frame.view(); 454 454 if (!view) 455 455 return FALSE; … … 1180 1180 static void webkit_web_view_real_select_all(WebKitWebView* webView) 1181 1181 { 1182 Frame *frame = core(webView)->focusController().focusedOrMainFrame();1183 frame ->editor().command("SelectAll").execute();1182 Frame& frame = core(webView)->focusController().focusedOrMainFrame(); 1183 frame.editor().command("SelectAll").execute(); 1184 1184 } 1185 1185 1186 1186 static void webkit_web_view_real_cut_clipboard(WebKitWebView* webView) 1187 1187 { 1188 Frame *frame = core(webView)->focusController().focusedOrMainFrame();1189 frame ->editor().command("Cut").execute();1188 Frame& frame = core(webView)->focusController().focusedOrMainFrame(); 1189 frame.editor().command("Cut").execute(); 1190 1190 } 1191 1191 1192 1192 static void webkit_web_view_real_copy_clipboard(WebKitWebView* webView) 1193 1193 { 1194 Frame *frame = core(webView)->focusController().focusedOrMainFrame();1195 frame ->editor().command("Copy").execute();1194 Frame& frame = core(webView)->focusController().focusedOrMainFrame(); 1195 frame.editor().command("Copy").execute(); 1196 1196 } 1197 1197 1198 1198 static void webkit_web_view_real_undo(WebKitWebView* webView) 1199 1199 { 1200 Frame *frame = core(webView)->focusController().focusedOrMainFrame();1201 frame ->editor().command("Undo").execute();1200 Frame& frame = core(webView)->focusController().focusedOrMainFrame(); 1201 frame.editor().command("Undo").execute(); 1202 1202 } 1203 1203 1204 1204 static void webkit_web_view_real_redo(WebKitWebView* webView) 1205 1205 { 1206 Frame *frame = core(webView)->focusController().focusedOrMainFrame();1207 frame ->editor().command("Redo").execute();1206 Frame& frame = core(webView)->focusController().focusedOrMainFrame(); 1207 frame.editor().command("Redo").execute(); 1208 1208 } 1209 1209 … … 1254 1254 } 1255 1255 1256 Frame *frame = core(webView)->focusController().focusedOrMainFrame();1257 if (!frame ->eventHandler().scrollOverflow(direction, granularity))1258 frame ->view()->scroll(direction, granularity);1256 Frame& frame = core(webView)->focusController().focusedOrMainFrame(); 1257 if (!frame.eventHandler().scrollOverflow(direction, granularity)) 1258 frame.view()->scroll(direction, granularity); 1259 1259 1260 1260 return true; … … 1263 1263 static void webkit_web_view_real_paste_clipboard(WebKitWebView* webView) 1264 1264 { 1265 Frame *frame = core(webView)->focusController().focusedOrMainFrame();1266 frame ->editor().command("Paste").execute();1265 Frame& frame = core(webView)->focusController().focusedOrMainFrame(); 1266 frame.editor().command("Paste").execute(); 1267 1267 } 1268 1268 … … 1491 1491 return; 1492 1492 1493 Frame* frame = core(webView)->focusController().focusedOrMainFrame(); 1494 if (!frame) 1495 return; 1493 Frame& frame = core(webView)->focusController().focusedOrMainFrame(); 1496 1494 1497 1495 // Synthesize a button release event to send with the drag end action. … … 1518 1516 1519 1517 PlatformMouseEvent platformEvent(&event->button); 1520 frame ->eventHandler().dragSourceEndedAt(platformEvent, gdkDragActionToDragOperation(gdk_drag_context_get_selected_action(context)));1518 frame.eventHandler().dragSourceEndedAt(platformEvent, gdkDragActionToDragOperation(gdk_drag_context_get_selected_action(context))); 1521 1519 } 1522 1520 … … 1590 1588 1591 1589 // Get the title of the current focused element. 1592 Frame* coreFrame = core(webView)->focusController().focusedOrMainFrame(); 1593 if (!coreFrame) 1594 return FALSE; 1595 1596 Node* node = getFocusedNode(coreFrame); 1590 Frame& coreFrame = core(webView)->focusController().focusedOrMainFrame(); 1591 1592 Node* node = getFocusedNode(&coreFrame); 1597 1593 if (!node) 1598 1594 return FALSE; … … 1602 1598 String title = toElement(titleNode)->title(); 1603 1599 if (!title.isEmpty()) { 1604 if (FrameView* view = coreFrame ->view()) {1600 if (FrameView* view = coreFrame.view()) { 1605 1601 GdkRectangle area = view->contentsToWindow(node->pixelSnappedBoundingBox()); 1606 1602 gtk_tooltip_set_tip_area(tooltip, &area); … … 4462 4458 g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), FALSE); 4463 4459 4464 Frame *frame = core(webView)->focusController().focusedOrMainFrame();4465 return frame ->editor().canCut() || frame->editor().canDHTMLCut();4460 Frame& frame = core(webView)->focusController().focusedOrMainFrame(); 4461 return frame.editor().canCut() || frame.editor().canDHTMLCut(); 4466 4462 } 4467 4463 … … 4478 4474 g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), FALSE); 4479 4475 4480 Frame *frame = core(webView)->focusController().focusedOrMainFrame();4481 return frame ->editor().canCopy() || frame->editor().canDHTMLCopy();4476 Frame& frame = core(webView)->focusController().focusedOrMainFrame(); 4477 return frame.editor().canCopy() || frame.editor().canDHTMLCopy(); 4482 4478 } 4483 4479 … … 4494 4490 g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), FALSE); 4495 4491 4496 Frame *frame = core(webView)->focusController().focusedOrMainFrame();4497 return frame ->editor().canPaste() || frame->editor().canDHTMLPaste();4492 Frame& frame = core(webView)->focusController().focusedOrMainFrame(); 4493 return frame.editor().canPaste() || frame.editor().canDHTMLPaste(); 4498 4494 } 4499 4495 … … 4550 4546 g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView)); 4551 4547 4552 Frame *frame = core(webView)->focusController().focusedOrMainFrame();4553 frame ->editor().performDelete();4548 Frame& frame = core(webView)->focusController().focusedOrMainFrame(); 4549 frame.editor().performDelete(); 4554 4550 } 4555 4551 … … 5081 5077 g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), FALSE); 5082 5078 5083 Frame *frame = core(webView)->focusController().focusedOrMainFrame();5084 return frame ->editor().canUndo();5079 Frame& frame = core(webView)->focusController().focusedOrMainFrame(); 5080 return frame.editor().canUndo(); 5085 5081 } 5086 5082 … … 5116 5112 g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), FALSE); 5117 5113 5118 Frame *frame = core(webView)->focusController().focusedOrMainFrame();5119 return frame ->editor().canRedo();5114 Frame& frame = core(webView)->focusController().focusedOrMainFrame(); 5115 return frame.editor().canRedo(); 5120 5116 } 5121 5117 … … 5300 5296 5301 5297 PlatformMouseEvent mouseEvent = PlatformMouseEvent(event); 5302 Frame *frame = core(webView)->focusController().focusedOrMainFrame();5298 Frame& frame = core(webView)->focusController().focusedOrMainFrame(); 5303 5299 HitTestRequest request(HitTestRequest::Active | HitTestRequest::DisallowShadowContent); 5304 IntPoint documentPoint = documentPointForWindowPoint( frame, mouseEvent.position());5305 MouseEventWithHitTestResults mev = frame ->document()->prepareMouseEvent(request, documentPoint, mouseEvent);5300 IntPoint documentPoint = documentPointForWindowPoint(&frame, mouseEvent.position()); 5301 MouseEventWithHitTestResults mev = frame.document()->prepareMouseEvent(request, documentPoint, mouseEvent); 5306 5302 5307 5303 return kit(mev.hitTestResult()); -
trunk/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp
r154658 r154678 330 330 void DumpRenderTreeSupportQt::executeCoreCommandByName(QWebPageAdapter* adapter, const QString& name, const QString& value) 331 331 { 332 adapter->page->focusController().focusedOrMainFrame() ->editor().command(name).execute(value);332 adapter->page->focusController().focusedOrMainFrame().editor().command(name).execute(value); 333 333 } 334 334 335 335 bool DumpRenderTreeSupportQt::isCommandEnabled(QWebPageAdapter *adapter, const QString& name) 336 336 { 337 return adapter->page->focusController().focusedOrMainFrame() ->editor().command(name).isEnabled();337 return adapter->page->focusController().focusedOrMainFrame().editor().command(name).isEnabled(); 338 338 } 339 339 340 340 QVariantList DumpRenderTreeSupportQt::selectedRange(QWebPageAdapter *adapter) 341 341 { 342 WebCore::Frame *frame = adapter->page->focusController().focusedOrMainFrame();342 WebCore::Frame& frame = adapter->page->focusController().focusedOrMainFrame(); 343 343 QVariantList selectedRange; 344 RefPtr<Range> range = frame ->selection().toNormalizedRange().get();345 346 Element* selectionRoot = frame ->selection().rootEditableElement();347 Element* scope = selectionRoot ? selectionRoot : frame ->document()->documentElement();344 RefPtr<Range> range = frame.selection().toNormalizedRange().get(); 345 346 Element* selectionRoot = frame.selection().rootEditableElement(); 347 Element* scope = selectionRoot ? selectionRoot : frame.document()->documentElement(); 348 348 349 349 RefPtr<Range> testRange = Range::create(scope->document(), scope, 0, range->startContainer(), range->startOffset()); … … 364 364 QVariantList DumpRenderTreeSupportQt::firstRectForCharacterRange(QWebPageAdapter *adapter, int location, int length) 365 365 { 366 WebCore::Frame *frame = adapter->page->focusController().focusedOrMainFrame();366 WebCore::Frame& frame = adapter->page->focusController().focusedOrMainFrame(); 367 367 QVariantList rect; 368 368 … … 370 370 length = 0; 371 371 372 RefPtr<Range> range = TextIterator::rangeFromLocationAndLength(frame ->selection().rootEditableElementOrDocumentElement(), location, length);372 RefPtr<Range> range = TextIterator::rangeFromLocationAndLength(frame.selection().rootEditableElementOrDocumentElement(), location, length); 373 373 374 374 if (!range) 375 375 return QVariantList(); 376 376 377 QRect resultRect = frame ->editor().firstRectForRange(range.get());377 QRect resultRect = frame.editor().firstRectForRange(range.get()); 378 378 rect << resultRect.x() << resultRect.y() << resultRect.width() << resultRect.height(); 379 379 return rect; … … 745 745 void DumpRenderTreeSupportQt::confirmComposition(QWebPageAdapter *adapter, const char* text) 746 746 { 747 Frame* frame = adapter->page->focusController().focusedOrMainFrame(); 748 if (!frame) 749 return; 750 751 Editor& editor = frame->editor(); 747 Frame& frame = adapter->page->focusController().focusedOrMainFrame(); 748 749 Editor& editor = frame.editor(); 752 750 if (!editor.hasComposition() && !text) 753 751 return; -
trunk/Source/WebKit/qt/WebCoreSupport/EditorClientQt.cpp
r154286 r154678 248 248 { 249 249 #ifndef QT_NO_UNDOSTACK 250 Frame *frame = m_page->page->focusController().focusedOrMainFrame();251 if (m_inUndoRedo || (frame && !frame->editor().lastEditCommand() /* HACK!! Don't recreate undos */))250 Frame& frame = m_page->page->focusController().focusedOrMainFrame(); 251 if (m_inUndoRedo || !frame.editor().lastEditCommand() /* HACK!! Don't recreate undos */) 252 252 return; 253 253 m_page->registerUndoStep(step); … … 423 423 void EditorClientQt::handleKeyboardEvent(KeyboardEvent* event) 424 424 { 425 Frame* frame = m_page->page->focusController().focusedOrMainFrame(); 426 if (!frame) 427 return; 425 Frame& frame = m_page->page->focusController().focusedOrMainFrame(); 428 426 429 427 const PlatformKeyboardEvent* kevent = event->keyEvent(); … … 431 429 return; 432 430 433 Node* start = frame ->selection().start().containerNode();431 Node* start = frame.selection().start().containerNode(); 434 432 if (!start) 435 433 return; … … 438 436 if (start->isContentEditable()) { 439 437 bool doSpatialNavigation = false; 440 if (isSpatialNavigationEnabled( frame)) {438 if (isSpatialNavigationEnabled(&frame)) { 441 439 if (!kevent->modifiers()) { 442 440 switch (kevent->windowsVirtualKeyCode()) { … … 456 454 // so we leave it upon WebCore to either handle them immediately (e.g. Tab that changes focus) or let a keypress event be generated 457 455 // (e.g. Tab that inserts a Tab character, or Enter). 458 if (frame ->editor().command(cmd).isTextInsertion()456 if (frame.editor().command(cmd).isTextInsertion() 459 457 && kevent->type() == PlatformEvent::RawKeyDown) 460 458 return; … … 468 466 String commandName = editorCommandForKeyDownEvent(event); 469 467 if (!commandName.isEmpty()) { 470 if (frame ->editor().command(commandName).execute()) // Event handled.468 if (frame.editor().command(commandName).execute()) // Event handled. 471 469 event->setDefaultHandled(); 472 470 return; … … 496 494 497 495 if (shouldInsertText) { 498 frame ->editor().insertText(kevent->text(), event);496 frame.editor().insertText(kevent->text(), event); 499 497 event->setDefaultHandled(); 500 498 return; … … 527 525 String commandName = editorCommandForKeyDownEvent(event); 528 526 ASSERT(!commandName.isEmpty()); 529 frame ->editor().command(commandName).execute();527 frame.editor().command(commandName).execute(); 530 528 event->setDefaultHandled(); 531 529 return; … … 618 616 619 617 HTMLInputElement* inputElement = 0; 620 Frame *frame = m_page->page->focusController().focusedOrMainFrame();621 if (frame && frame->document() && frame->document()->focusedElement())622 if (isHTMLInputElement(frame ->document()->focusedElement()))623 inputElement = toHTMLInputElement(frame ->document()->focusedElement());618 Frame& frame = m_page->page->focusController().focusedOrMainFrame(); 619 if (frame.document() && frame.document()->focusedElement()) 620 if (isHTMLInputElement(frame.document()->focusedElement())) 621 inputElement = toHTMLInputElement(frame.document()->focusedElement()); 624 622 625 623 if (inputElement) { -
trunk/Source/WebKit/qt/WebCoreSupport/QWebPageAdapter.cpp
r154671 r154678 354 354 bool QWebPageAdapter::hasSelection() const 355 355 { 356 Frame* frame = page->focusController().focusedOrMainFrame(); 357 if (frame) 358 return (frame->selection().selection().selectionType() != VisibleSelection::NoSelection); 359 return false; 356 Frame& frame = page->focusController().focusedOrMainFrame(); 357 return frame.selection().selection().selectionType() != VisibleSelection::NoSelection; 360 358 } 361 359 362 360 QString QWebPageAdapter::selectedText() const 363 361 { 364 Frame *frame = page->focusController().focusedOrMainFrame();365 if (frame ->selection().selection().selectionType() == VisibleSelection::NoSelection)362 Frame& frame = page->focusController().focusedOrMainFrame(); 363 if (frame.selection().selection().selectionType() == VisibleSelection::NoSelection) 366 364 return QString(); 367 return frame ->editor().selectedText();365 return frame.editor().selectedText(); 368 366 } 369 367 370 368 QString QWebPageAdapter::selectedHtml() const 371 369 { 372 return page->focusController().focusedOrMainFrame() ->editor().selectedRange()->toHTML();370 return page->focusController().focusedOrMainFrame().editor().selectedRange()->toHTML(); 373 371 } 374 372 … … 619 617 void QWebPageAdapter::inputMethodEvent(QInputMethodEvent *ev) 620 618 { 621 WebCore::Frame *frame = page->focusController().focusedOrMainFrame();622 WebCore::Editor &editor = frame->editor();619 WebCore::Frame& frame = page->focusController().focusedOrMainFrame(); 620 WebCore::Editor& editor = frame.editor(); 623 621 624 622 if (!editor.canEdit()) { … … 628 626 629 627 Node* node = 0; 630 if (frame ->selection().rootEditableElement())631 node = frame ->selection().rootEditableElement()->deprecatedShadowAncestorNode();628 if (frame.selection().rootEditableElement()) 629 node = frame.selection().rootEditableElement()->deprecatedShadowAncestorNode(); 632 630 633 631 Vector<CompositionUnderline> underlines; … … 644 642 } 645 643 case QInputMethodEvent::Cursor: { 646 frame ->selection().setCaretVisible(a.length); // if length is 0 cursor is invisible644 frame.selection().setCaretVisible(a.length); // if length is 0 cursor is invisible 647 645 if (a.length > 0) { 648 RenderObject* caretRenderer = frame ->selection().caretRenderer();646 RenderObject* caretRenderer = frame.selection().caretRenderer(); 649 647 if (caretRenderer) { 650 648 QColor qcolor = a.value.value<QColor>(); … … 678 676 679 677 if (node && ev->replacementLength() > 0) { 680 int cursorPos = frame ->selection().extent().offsetInContainerNode();678 int cursorPos = frame.selection().extent().offsetInContainerNode(); 681 679 int start = cursorPos + ev->replacementStart(); 682 680 if (isHTMLTextFormControlElement(node)) … … 909 907 { 910 908 ASSERT(visitedWebActions); 911 WebCore::Frame *focusedFrame = page->focusController().focusedOrMainFrame();912 HitTestResult result = focusedFrame ->eventHandler().hitTestResultAtPoint(focusedFrame->view()->windowToContents(pos));909 WebCore::Frame& focusedFrame = page->focusController().focusedOrMainFrame(); 910 HitTestResult result = focusedFrame.eventHandler().hitTestResultAtPoint(focusedFrame.view()->windowToContents(pos)); 913 911 page->contextMenuController().setHitTestResult(result); 914 912 … … 1010 1008 { 1011 1009 WebCore::FrameLoader& loader = mainFrameAdapter()->frame->loader(); 1012 WebCore::Editor& editor = page->focusController().focusedOrMainFrame() ->editor();1010 WebCore::Editor& editor = page->focusController().focusedOrMainFrame().editor(); 1013 1011 1014 1012 switch (action) { … … 1049 1047 void QWebPageAdapter::triggerAction(QWebPageAdapter::MenuAction action, QWebHitTestResultPrivate* hitTestResult, const char* commandName, bool endToEndReload) 1050 1048 { 1051 Frame* frame = page->focusController().focusedOrMainFrame(); 1052 if (!frame) 1053 return; 1054 Editor& editor = frame->editor(); 1049 Frame& frame = page->focusController().focusedOrMainFrame(); 1050 Editor& editor = frame.editor(); 1055 1051 1056 1052 // Convenience … … 1067 1063 // fall through 1068 1064 case OpenLinkInNewWindow: 1069 openNewWindow(hitTestResult->linkUrl, frame);1065 openNewWindow(hitTestResult->linkUrl, &frame); 1070 1066 break; 1071 1067 case OpenLinkInThisWindow: 1072 frame ->loader().loadFrameRequest(frameLoadRequest(hitTestResult->linkUrl,frame), /*lockHistory*/ false, /*lockBackForwardList*/ false, /*event*/ 0, /*FormState*/ 0, MaybeSendReferrer);1068 frame.loader().loadFrameRequest(frameLoadRequest(hitTestResult->linkUrl, &frame), /*lockHistory*/ false, /*lockBackForwardList*/ false, /*event*/ 0, /*FormState*/ 0, MaybeSendReferrer); 1073 1069 break; 1074 1070 case OpenFrameInNewWindow: { 1075 KURL url = frame ->loader().documentLoader()->unreachableURL();1071 KURL url = frame.loader().documentLoader()->unreachableURL(); 1076 1072 if (url.isEmpty()) 1077 url = frame ->loader().documentLoader()->url();1078 openNewWindow(url, frame);1073 url = frame.loader().documentLoader()->url(); 1074 openNewWindow(url, &frame); 1079 1075 break; 1080 1076 } … … 1090 1086 } 1091 1087 case OpenImageInNewWindow: 1092 openNewWindow(hitTestResult->imageUrl, frame);1088 openNewWindow(hitTestResult->imageUrl, &frame); 1093 1089 break; 1094 1090 case DownloadImageToDisk: 1095 frame ->loader().client().startDownload(WebCore::ResourceRequest(hitTestResult->imageUrl, frame->loader().outgoingReferrer()));1091 frame.loader().client().startDownload(WebCore::ResourceRequest(hitTestResult->imageUrl, frame.loader().outgoingReferrer())); 1096 1092 break; 1097 1093 case DownloadLinkToDisk: 1098 frame ->loader().client().startDownload(WebCore::ResourceRequest(hitTestResult->linkUrl, frame->loader().outgoingReferrer()));1094 frame.loader().client().startDownload(WebCore::ResourceRequest(hitTestResult->linkUrl, frame.loader().outgoingReferrer())); 1099 1095 break; 1100 1096 case Back: … … 1254 1250 QObject* QWebPageAdapter::currentFrame() const 1255 1251 { 1256 Frame *frame = page->focusController().focusedOrMainFrame();1257 return frame ->loader().networkingContext()->originatingObject();1252 Frame& frame = page->focusController().focusedOrMainFrame(); 1253 return frame.loader().networkingContext()->originatingObject(); 1258 1254 } 1259 1255 … … 1295 1291 bool QWebPageAdapter::handleKeyEvent(QKeyEvent *ev) 1296 1292 { 1297 Frame *frame = page->focusController().focusedOrMainFrame();1298 return frame ->eventHandler().keyEvent(PlatformKeyboardEvent(ev, m_useNativeVirtualKeyAsDOMKey));1293 Frame& frame = page->focusController().focusedOrMainFrame(); 1294 return frame.eventHandler().keyEvent(PlatformKeyboardEvent(ev, m_useNativeVirtualKeyAsDOMKey)); 1299 1295 } 1300 1296 1301 1297 bool QWebPageAdapter::handleScrolling(QKeyEvent *ev) 1302 1298 { 1303 Frame *frame = page->focusController().focusedOrMainFrame();1299 Frame& frame = page->focusController().focusedOrMainFrame(); 1304 1300 WebCore::ScrollDirection direction; 1305 1301 WebCore::ScrollGranularity granularity; … … 1343 1339 } 1344 1340 1345 return frame ->eventHandler().scrollRecursively(direction, granularity);1341 return frame.eventHandler().scrollRecursively(direction, granularity); 1346 1342 } 1347 1343 … … 1368 1364 bool QWebPageAdapter::handleShortcutOverrideEvent(QKeyEvent* event) 1369 1365 { 1370 WebCore::Frame *frame = page->focusController().focusedOrMainFrame();1371 WebCore::Editor& editor = frame ->editor();1366 WebCore::Frame& frame = page->focusController().focusedOrMainFrame(); 1367 WebCore::Editor& editor = frame.editor(); 1372 1368 if (!editor.canEdit()) 1373 1369 return false; … … 1451 1447 } 1452 1448 1453 WebCore::Frame *focusedFrame = page->focusController().focusedOrMainFrame();1454 focusedFrame ->eventHandler().sendContextMenuEvent(convertMouseEvent(event, 1));1449 WebCore::Frame& focusedFrame = page->focusController().focusedOrMainFrame(); 1450 focusedFrame.eventHandler().sendContextMenuEvent(convertMouseEvent(event, 1)); 1455 1451 ContextMenu* menu = page->contextMenuController().contextMenu(); 1456 1452 // If the website defines its own handler then sendContextMenuEvent takes care of -
trunk/Source/WebKit/win/WebView.cpp
r154661 r154678 1335 1335 m_page->contextMenuController().clearContextMenu(); 1336 1336 1337 Frame *focusedFrame = m_page->focusController().focusedOrMainFrame();1338 return focusedFrame ->eventHandler().sendContextMenuEventForKey();1337 Frame& focusedFrame = m_page->focusController().focusedOrMainFrame(); 1338 return focusedFrame.eventHandler().sendContextMenuEventForKey(); 1339 1339 1340 1340 } else { … … 1349 1349 IntPoint documentPoint(m_page->mainFrame().view()->windowToContents(coords)); 1350 1350 HitTestResult result = m_page->mainFrame().eventHandler().hitTestResultAtPoint(documentPoint); 1351 Frame* targetFrame = result.innerNonSharedNode() ? result.innerNonSharedNode()->document()->frame() : m_page->focusController().focusedOrMainFrame();1351 Frame* targetFrame = result.innerNonSharedNode() ? result.innerNonSharedNode()->document()->frame() : &m_page->focusController().focusedOrMainFrame(); 1352 1352 1353 1353 targetFrame->view()->setCursor(pointerCursor()); … … 1787 1787 } 1788 1788 1789 Frame *frame = m_page->focusController().focusedOrMainFrame();1790 return frame ->eventHandler().scrollRecursively(direction, granularity);1789 Frame& frame = m_page->focusController().focusedOrMainFrame(); 1790 return frame.eventHandler().scrollRecursively(direction, granularity); 1791 1791 } 1792 1792 … … 1816 1816 } 1817 1817 1818 Frame *frame = m_page->focusController().focusedOrMainFrame();1819 return frame ->eventHandler().scrollRecursively(direction, granularity);1818 Frame& frame = m_page->focusController().focusedOrMainFrame(); 1819 return frame.eventHandler().scrollRecursively(direction, granularity); 1820 1820 } 1821 1821 … … 1823 1823 bool WebView::execCommand(WPARAM wParam, LPARAM /*lParam*/) 1824 1824 { 1825 Frame *frame = m_page->focusController().focusedOrMainFrame();1825 Frame& frame = m_page->focusController().focusedOrMainFrame(); 1826 1826 switch (LOWORD(wParam)) { 1827 1827 case SelectAll: 1828 return frame ->editor().command("SelectAll").execute();1828 return frame.editor().command("SelectAll").execute(); 1829 1829 case Undo: 1830 return frame ->editor().command("Undo").execute();1830 return frame.editor().command("Undo").execute(); 1831 1831 case Redo: 1832 return frame ->editor().command("Redo").execute();1832 return frame.editor().command("Redo").execute(); 1833 1833 } 1834 1834 return false; … … 1839 1839 PlatformKeyboardEvent keyEvent(m_viewWindow, virtualKeyCode, keyData, PlatformEvent::KeyUp, systemKeyDown); 1840 1840 1841 Frame *frame = m_page->focusController().focusedOrMainFrame();1841 Frame& frame = m_page->focusController().focusedOrMainFrame(); 1842 1842 m_currentCharacterCode = 0; 1843 1843 1844 return frame ->eventHandler().keyEvent(keyEvent);1844 return frame.eventHandler().keyEvent(keyEvent); 1845 1845 } 1846 1846 … … 2005 2005 } 2006 2006 #endif 2007 Frame *frame = m_page->focusController().focusedOrMainFrame();2007 Frame& frame = m_page->focusController().focusedOrMainFrame(); 2008 2008 2009 2009 PlatformKeyboardEvent keyEvent(m_viewWindow, virtualKeyCode, keyData, PlatformEvent::RawKeyDown, systemKeyDown); 2010 bool handled = frame ->eventHandler().keyEvent(keyEvent);2010 bool handled = frame.eventHandler().keyEvent(keyEvent); 2011 2011 2012 2012 // These events cannot be canceled, and we have no default handling for them. … … 2072 2072 } 2073 2073 2074 return frame ->eventHandler().scrollRecursively(direction, granularity);2074 return frame.eventHandler().scrollRecursively(direction, granularity); 2075 2075 } 2076 2076 2077 2077 bool WebView::keyPress(WPARAM charCode, LPARAM keyData, bool systemKeyDown) 2078 2078 { 2079 Frame *frame = m_page->focusController().focusedOrMainFrame();2079 Frame& frame = m_page->focusController().focusedOrMainFrame(); 2080 2080 2081 2081 PlatformKeyboardEvent keyEvent(m_viewWindow, charCode, keyData, PlatformEvent::Char, systemKeyDown); 2082 2082 // IE does not dispatch keypress event for WM_SYSCHAR. 2083 2083 if (systemKeyDown) 2084 return frame ->eventHandler().handleAccessKey(keyEvent);2085 return frame ->eventHandler().keyEvent(keyEvent);2084 return frame.eventHandler().handleAccessKey(keyEvent); 2085 return frame.eventHandler().keyEvent(keyEvent); 2086 2086 } 2087 2087 … … 2288 2288 2289 2289 FocusController& focusController = webView->page()->focusController(); 2290 Frame *frame = focusController.focusedOrMainFrame();2291 webView->resetIME( frame);2290 Frame& frame = focusController.focusedOrMainFrame(); 2291 webView->resetIME(&frame); 2292 2292 // Send blur events unless we're losing focus to a child of ours. 2293 2293 if (!IsChild(hWnd, newFocusWnd)) … … 2295 2295 2296 2296 // If we are pan-scrolling when we lose focus, stop the pan scrolling. 2297 frame ->eventHandler().stopAutoscrollTimer();2297 frame.eventHandler().stopAutoscrollTimer(); 2298 2298 2299 2299 break; … … 3488 3488 bool active = m_page->focusController().isActive(); 3489 3489 Frame& mainFrame = m_page->mainFrame(); 3490 Frame *focusedFrame = m_page->focusController().focusedOrMainFrame();3491 mainFrame.selection().setFocused(active && &mainFrame == focusedFrame);3490 Frame& focusedFrame = m_page->focusController().focusedOrMainFrame(); 3491 mainFrame.selection().setFocused(active && &mainFrame == &focusedFrame); 3492 3492 3493 3493 return S_OK; … … 3496 3496 HRESULT STDMETHODCALLTYPE WebView::executeCoreCommandByName(BSTR name, BSTR value) 3497 3497 { 3498 m_page->focusController().focusedOrMainFrame() ->editor().command(toString(name)).execute(toString(value));3498 m_page->focusController().focusedOrMainFrame().editor().command(toString(name)).execute(toString(value)); 3499 3499 3500 3500 return S_OK; … … 3562 3562 *hBitmap = 0; 3563 3563 3564 WebCore::Frame* frame = m_page->focusController().focusedOrMainFrame(); 3565 3566 if (frame) { 3567 OwnPtr<HBITMAP> bitmap = imageFromSelection(frame, forceWhiteText ? TRUE : FALSE); 3568 *hBitmap = static_cast<OLE_HANDLE>(reinterpret_cast<ULONG64>(bitmap.leakPtr())); 3569 } 3564 WebCore::Frame& frame = m_page->focusController().focusedOrMainFrame(); 3565 3566 OwnPtr<HBITMAP> bitmap = imageFromSelection(&frame, forceWhiteText ? TRUE : FALSE); 3567 *hBitmap = static_cast<OLE_HANDLE>(reinterpret_cast<ULONG64>(bitmap.leakPtr())); 3570 3568 3571 3569 return S_OK; … … 3574 3572 HRESULT STDMETHODCALLTYPE WebView::selectionRect(RECT* rc) 3575 3573 { 3576 WebCore::Frame* frame = m_page->focusController().focusedOrMainFrame(); 3577 3578 if (frame) { 3579 IntRect ir = enclosingIntRect(frame->selection().bounds()); 3580 ir = frame->view()->convertToContainingWindow(ir); 3581 ir.move(-frame->view()->scrollOffset().width(), -frame->view()->scrollOffset().height()); 3582 rc->left = ir.x(); 3583 rc->top = ir.y(); 3584 rc->bottom = rc->top + ir.height(); 3585 rc->right = rc->left + ir.width(); 3586 } 3574 WebCore::Frame& frame = m_page->focusController().focusedOrMainFrame(); 3575 3576 IntRect ir = enclosingIntRect(frame.selection().bounds()); 3577 ir = frame.view()->convertToContainingWindow(ir); 3578 ir.move(-frame.view()->scrollOffset().width(), -frame.view()->scrollOffset().height()); 3579 rc->left = ir.x(); 3580 rc->top = ir.y(); 3581 rc->bottom = rc->top + ir.height(); 3582 rc->right = rc->left + ir.width(); 3587 3583 3588 3584 return S_OK; … … 3719 3715 *text = 0; 3720 3716 3721 Frame* focusedFrame = m_page ? m_page->focusController().focusedOrMainFrame() : 0;3717 Frame* focusedFrame = m_page ? &m_page->focusController().focusedOrMainFrame() : 0; 3722 3718 if (!focusedFrame) 3723 3719 return E_FAIL; … … 4308 4304 /* [retval][out] */ BOOL* enabled) 4309 4305 { 4310 Editor& editor = m_page->focusController().focusedOrMainFrame() ->editor();4306 Editor& editor = m_page->focusController().focusedOrMainFrame().editor(); 4311 4307 *enabled = editor.canCut() || editor.canDHTMLCut(); 4312 4308 return S_OK; … … 4316 4312 /* [retval][out] */ BOOL* enabled) 4317 4313 { 4318 Editor& editor = m_page->focusController().focusedOrMainFrame() ->editor();4314 Editor& editor = m_page->focusController().focusedOrMainFrame().editor(); 4319 4315 *enabled = editor.canCopy() || editor.canDHTMLCopy(); 4320 4316 return S_OK; … … 4324 4320 /* [retval][out] */ BOOL* enabled) 4325 4321 { 4326 Editor& editor = m_page->focusController().focusedOrMainFrame() ->editor();4322 Editor& editor = m_page->focusController().focusedOrMainFrame().editor(); 4327 4323 *enabled = editor.canPaste() || editor.canDHTMLPaste(); 4328 4324 return S_OK; … … 4332 4328 /* [retval][out] */ BOOL* enabled) 4333 4329 { 4334 *enabled = m_page->focusController().focusedOrMainFrame() ->editor().canDelete();4330 *enabled = m_page->focusController().focusedOrMainFrame().editor().canDelete(); 4335 4331 return S_OK; 4336 4332 } … … 4339 4335 /* [retval][out] */ BOOL* enabled) 4340 4336 { 4341 *enabled = m_page->focusController().focusedOrMainFrame() ->editor().canEdit();4337 *enabled = m_page->focusController().focusedOrMainFrame().editor().canEdit(); 4342 4338 return S_OK; 4343 4339 } … … 4391 4387 { 4392 4388 Position start = m_page->mainFrame().selection().selection().start(); 4393 m_page->focusController().focusedOrMainFrame() ->editor().insertText(toString(text), 0);4389 m_page->focusController().focusedOrMainFrame().editor().insertText(toString(text), 0); 4394 4390 m_page->mainFrame().selection().setBase(start); 4395 4391 return S_OK; … … 4412 4408 HRESULT STDMETHODCALLTYPE WebView::deleteSelection( void) 4413 4409 { 4414 Editor& editor = m_page->focusController().focusedOrMainFrame() ->editor();4410 Editor& editor = m_page->focusController().focusedOrMainFrame().editor(); 4415 4411 editor.deleteSelectionWithSmartDelete(editor.canSmartCopyOrDelete()); 4416 4412 return S_OK; … … 4419 4415 HRESULT STDMETHODCALLTYPE WebView::clearSelection( void) 4420 4416 { 4421 m_page->focusController().focusedOrMainFrame() ->selection().clear();4417 m_page->focusController().focusedOrMainFrame().selection().clear(); 4422 4418 return S_OK; 4423 4419 } … … 4435 4431 /* [in] */ IUnknown* /*sender*/) 4436 4432 { 4437 m_page->focusController().focusedOrMainFrame() ->editor().command("Copy").execute();4433 m_page->focusController().focusedOrMainFrame().editor().command("Copy").execute(); 4438 4434 return S_OK; 4439 4435 } … … 4442 4438 /* [in] */ IUnknown* /*sender*/) 4443 4439 { 4444 m_page->focusController().focusedOrMainFrame() ->editor().command("Cut").execute();4440 m_page->focusController().focusedOrMainFrame().editor().command("Cut").execute(); 4445 4441 return S_OK; 4446 4442 } … … 4449 4445 /* [in] */ IUnknown* /*sender*/) 4450 4446 { 4451 m_page->focusController().focusedOrMainFrame() ->editor().command("Paste").execute();4447 m_page->focusController().focusedOrMainFrame().editor().command("Paste").execute(); 4452 4448 return S_OK; 4453 4449 } … … 4456 4452 /* [in] */ BSTR url) 4457 4453 { 4458 m_page->focusController().focusedOrMainFrame() ->editor().copyURL(MarshallingHelpers::BSTRToKURL(url), "");4454 m_page->focusController().focusedOrMainFrame().editor().copyURL(MarshallingHelpers::BSTRToKURL(url), ""); 4459 4455 return S_OK; 4460 4456 } … … 4478 4474 /* [in] */ IUnknown* /*sender*/) 4479 4475 { 4480 m_page->focusController().focusedOrMainFrame() ->editor().command("Delete").execute();4476 m_page->focusController().focusedOrMainFrame().editor().command("Delete").execute(); 4481 4477 return S_OK; 4482 4478 } … … 5314 5310 { 5315 5311 if (m_page) { 5316 Frame *frame = m_page->focusController().focusedOrMainFrame();5317 frame ->document()->setFocusedElement(0);5312 Frame& frame = m_page->focusController().focusedOrMainFrame(); 5313 frame.document()->setFocusedElement(0); 5318 5314 m_page->focusController().setInitialFocus(forward ? FocusDirectionForward : FocusDirectionBackward, 0); 5319 5315 } … … 5400 5396 HRESULT STDMETHODCALLTYPE WebView::clearUndoRedoOperations() 5401 5397 { 5402 if (Frame* frame = m_page->focusController().focusedOrMainFrame())5403 frame->editor().clearUndoRedoOperations();5398 Frame& frame = m_page->focusController().focusedOrMainFrame(); 5399 frame.editor().clearUndoRedoOperations(); 5404 5400 return S_OK; 5405 5401 } … … 5542 5538 void WebView::updateSelectionForIME() 5543 5539 { 5544 Frame* targetFrame = m_page->focusController().focusedOrMainFrame(); 5545 5546 if (!targetFrame) 5547 return; 5548 5549 if (!targetFrame->editor().cancelCompositionIfSelectionIsInvalid()) 5550 resetIME(targetFrame); 5540 Frame& targetFrame = m_page->focusController().focusedOrMainFrame(); 5541 if (!targetFrame.editor().cancelCompositionIfSelectionIsInvalid()) 5542 resetIME(&targetFrame); 5551 5543 } 5552 5544 … … 5565 5557 LOG(TextInput, "onIMEStartComposition"); 5566 5558 m_inIMEComposition++; 5567 Frame* targetFrame = m_page->focusController().focusedOrMainFrame(); 5568 if (!targetFrame) 5569 return true; 5559 Frame& targetFrame = m_page->focusController().focusedOrMainFrame(); 5570 5560 5571 5561 HIMC hInputContext = getIMMContext(); 5572 prepareCandidateWindow( targetFrame, hInputContext);5562 prepareCandidateWindow(&targetFrame, hInputContext); 5573 5563 releaseIMMContext(hInputContext); 5574 5564 return true; … … 5702 5692 return true; 5703 5693 5704 Frame *targetFrame = m_page->focusController().focusedOrMainFrame();5705 if (!targetFrame || !targetFrame->editor().canEdit())5694 Frame& targetFrame = m_page->focusController().focusedOrMainFrame(); 5695 if (!targetFrame.editor().canEdit()) 5706 5696 return true; 5707 5697 5708 prepareCandidateWindow( targetFrame, hInputContext);5698 prepareCandidateWindow(&targetFrame, hInputContext); 5709 5699 5710 5700 if (lparam & GCS_RESULTSTR || !lparam) { … … 5713 5703 return true; 5714 5704 5715 targetFrame ->editor().confirmComposition(compositionString);5705 targetFrame.editor().confirmComposition(compositionString); 5716 5706 } else { 5717 5707 String compositionString; … … 5734 5724 int cursorPosition = LOWORD(IMMDict::dict().getCompositionString(hInputContext, GCS_CURSORPOS, 0, 0)); 5735 5725 5736 targetFrame ->editor().setComposition(compositionString, underlines, cursorPosition, 0);5726 targetFrame.editor().setComposition(compositionString, underlines, cursorPosition, 0); 5737 5727 } 5738 5728 … … 5745 5735 // If the composition hasn't been confirmed yet, it needs to be cancelled. 5746 5736 // This happens after deleting the last character from inline input hole. 5747 Frame *targetFrame = m_page->focusController().focusedOrMainFrame();5748 if (targetFrame && targetFrame->editor().hasComposition())5749 targetFrame ->editor().confirmComposition(String());5737 Frame& targetFrame = m_page->focusController().focusedOrMainFrame(); 5738 if (targetFrame.editor().hasComposition()) 5739 targetFrame.editor().confirmComposition(String()); 5750 5740 5751 5741 if (m_inIMEComposition) … … 5811 5801 { 5812 5802 LOG(TextInput, "onIMERequest %s", imeRequestName(request).latin1().data()); 5813 Frame *targetFrame = m_page->focusController().focusedOrMainFrame();5814 if (!targetFrame || !targetFrame->editor().canEdit())5803 Frame& targetFrame = m_page->focusController().focusedOrMainFrame(); 5804 if (!targetFrame.editor().canEdit()) 5815 5805 return 0; 5816 5806 5817 5807 switch (request) { 5818 5808 case IMR_RECONVERTSTRING: 5819 return onIMERequestReconvertString( targetFrame, (RECONVERTSTRING*)data);5809 return onIMERequestReconvertString(&targetFrame, (RECONVERTSTRING*)data); 5820 5810 5821 5811 case IMR_QUERYCHARPOSITION: 5822 return onIMERequestCharPosition( targetFrame, (IMECHARPOSITION*)data);5812 return onIMERequestCharPosition(&targetFrame, (IMECHARPOSITION*)data); 5823 5813 } 5824 5814 return 0; … … 6958 6948 return E_FAIL; 6959 6949 6960 Frame *frame = m_page->focusController().focusedOrMainFrame();6961 if (!frame || !frame->editor().canEdit())6950 Frame& frame = m_page->focusController().focusedOrMainFrame(); 6951 if (!frame.editor().canEdit()) 6962 6952 return E_FAIL; 6963 6953 … … 6966 6956 Vector<CompositionUnderline> underlines; 6967 6957 underlines.append(CompositionUnderline(0, compositionStr.length(), Color(Color::black), false)); 6968 frame ->editor().setComposition(compositionStr, underlines, from, from + length);6958 frame.editor().setComposition(compositionStr, underlines, from, from + length); 6969 6959 6970 6960 return S_OK; … … 6976 6966 return E_FAIL; 6977 6967 6978 Frame* frame = m_page->focusController().focusedOrMainFrame(); 6979 if (!frame) 6980 return E_FAIL; 6981 6982 *result = frame && frame->editor().hasComposition(); 6983 6968 Frame& frame = m_page->focusController().focusedOrMainFrame(); 6969 *result = frame.editor().hasComposition(); 6984 6970 return S_OK; 6985 6971 } … … 6990 6976 return E_FAIL; 6991 6977 6992 Frame *frame = m_page->focusController().focusedOrMainFrame();6993 if (!frame || !frame->editor().canEdit())6978 Frame& frame = m_page->focusController().focusedOrMainFrame(); 6979 if (!frame.editor().canEdit()) 6994 6980 return E_FAIL; 6995 6981 … … 6997 6983 6998 6984 if (compositionStr.isNull()) 6999 frame ->editor().confirmComposition();7000 7001 frame ->editor().confirmComposition(compositionStr);6985 frame.editor().confirmComposition(); 6986 6987 frame.editor().confirmComposition(compositionStr); 7002 6988 7003 6989 return S_OK; … … 7009 6995 return E_FAIL; 7010 6996 7011 Frame *frame = m_page->focusController().focusedOrMainFrame();7012 if (!frame || !frame->editor().canEdit())7013 return E_FAIL; 7014 7015 RefPtr<Range> range = frame ->editor().compositionRange();6997 Frame& frame = m_page->focusController().focusedOrMainFrame(); 6998 if (!frame.editor().canEdit()) 6999 return E_FAIL; 7000 7001 RefPtr<Range> range = frame.editor().compositionRange(); 7016 7002 7017 7003 if (!range) … … 7033 7019 return E_FAIL; 7034 7020 7035 Frame* frame = m_page->focusController().focusedOrMainFrame();7036 if (!frame)7037 return E_FAIL;7038 7039 7021 IntRect resultIntRect; 7040 7022 resultIntRect.setLocation(IntPoint(0, 0)); … … 7046 7028 length = INT_MAX - location; 7047 7029 7048 RefPtr<Range> range = TextIterator::rangeFromLocationAndLength(frame->selection().rootEditableElementOrDocumentElement(), location, length); 7030 Frame& frame = m_page->focusController().focusedOrMainFrame(); 7031 RefPtr<Range> range = TextIterator::rangeFromLocationAndLength(frame.selection().rootEditableElementOrDocumentElement(), location, length); 7049 7032 7050 7033 if (!range) … … 7054 7037 ASSERT(range->endContainer()); 7055 7038 7056 IntRect rect = frame ->editor().firstRectForRange(range.get());7057 resultIntRect = frame ->view()->contentsToWindow(rect);7039 IntRect rect = frame.editor().firstRectForRange(range.get()); 7040 resultIntRect = frame.view()->contentsToWindow(rect); 7058 7041 7059 7042 resultRect->left = resultIntRect.x(); … … 7070 7053 return E_FAIL; 7071 7054 7072 Frame* frame = m_page->focusController().focusedOrMainFrame(); 7073 if (!frame) 7074 return E_FAIL; 7075 7076 RefPtr<Range> range = frame->editor().selectedRange(); 7055 Frame& frame = m_page->focusController().focusedOrMainFrame(); 7056 7057 RefPtr<Range> range = frame.editor().selectedRange(); 7077 7058 7078 7059 size_t locationSize; 7079 7060 size_t lengthSize; 7080 if (range && TextIterator::getLocationAndLengthFromRange(frame ->selection().rootEditableElementOrDocumentElement(), range.get(), locationSize, lengthSize)) {7061 if (range && TextIterator::getLocationAndLengthFromRange(frame.selection().rootEditableElementOrDocumentElement(), range.get(), locationSize, lengthSize)) { 7081 7062 *location = static_cast<UINT>(locationSize); 7082 7063 *length = static_cast<UINT>(lengthSize); -
trunk/Source/WebKit/wince/WebView.cpp
r154658 r154678 350 350 bool WebView::handleKeyDown(WPARAM virtualKeyCode, LPARAM keyData, bool systemKeyDown) 351 351 { 352 Frame *frame = m_page->focusController().focusedOrMainFrame();352 Frame& frame = m_page->focusController().focusedOrMainFrame(); 353 353 354 354 PlatformKeyboardEvent keyEvent(m_windowHandle, virtualKeyCode, keyData, PlatformEvent::RawKeyDown, systemKeyDown); 355 bool handled = frame ->eventHandler().keyEvent(keyEvent);355 bool handled = frame.eventHandler().keyEvent(keyEvent); 356 356 357 357 // These events cannot be canceled, and we have no default handling for them. … … 372 372 bool WebView::handleKeyPress(WPARAM charCode, LPARAM keyData, bool systemKeyDown) 373 373 { 374 Frame *frame = m_page->focusController().focusedOrMainFrame();374 Frame& frame = m_page->focusController().focusedOrMainFrame(); 375 375 376 376 PlatformKeyboardEvent keyEvent(m_windowHandle, charCode, keyData, PlatformEvent::Char, systemKeyDown); 377 377 // IE does not dispatch keypress event for WM_SYSCHAR. 378 378 if (systemKeyDown) 379 return frame ->eventHandler().handleAccessKey(keyEvent);380 if (frame ->eventHandler().keyEvent(keyEvent))379 return frame.eventHandler().handleAccessKey(keyEvent); 380 if (frame.eventHandler().keyEvent(keyEvent)) 381 381 return true; 382 382 … … 388 388 PlatformKeyboardEvent keyEvent(m_windowHandle, virtualKeyCode, keyData, PlatformEvent::KeyUp, systemKeyDown); 389 389 390 Frame *frame = m_page->focusController().focusedOrMainFrame();391 return frame ->eventHandler().keyEvent(keyEvent);390 Frame& frame = m_page->focusController().focusedOrMainFrame(); 391 return frame.eventHandler().keyEvent(keyEvent); 392 392 } 393 393 -
trunk/Source/WebKit2/WebProcess/WebCoreSupport/efl/WebEditorClientEfl.cpp
r154122 r154678 50 50 void WebEditorClient::handleInputMethodKeydown(KeyboardEvent* event) 51 51 { 52 Frame *frame = m_page->corePage()->focusController().focusedOrMainFrame();53 if (!frame || !frame->editor().canEdit())52 Frame& frame = m_page->corePage()->focusController().focusedOrMainFrame(); 53 if (!frame.editor().canEdit()) 54 54 return; 55 55 -
trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm
r154658 r154678 134 134 static void changeWordCase(WebPage* page, SEL selector) 135 135 { 136 Frame *frame = page->corePage()->focusController().focusedOrMainFrame();137 if (!frame ->editor().canEdit())136 Frame& frame = page->corePage()->focusController().focusedOrMainFrame(); 137 if (!frame.editor().canEdit()) 138 138 return; 139 139 140 frame ->editor().command("selectWord").execute();141 142 NSString *selectedString = frame ->displayStringModifiedByEncoding(frame->editor().selectedText());143 page->replaceSelectionWithText( frame, [selectedString performSelector:selector]);140 frame.editor().command("selectWord").execute(); 141 142 NSString *selectedString = frame.displayStringModifiedByEncoding(frame.editor().selectedText()); 143 page->replaceSelectionWithText(&frame, [selectedString performSelector:selector]); 144 144 } 145 145 -
trunk/Source/WebKit2/WebProcess/WebPage/FindController.cpp
r154658 r154678 329 329 void FindController::showFindIndicatorInSelection() 330 330 { 331 Frame* selectedFrame = m_webPage->corePage()->focusController().focusedOrMainFrame(); 332 if (!selectedFrame) 333 return; 334 335 updateFindIndicator(selectedFrame, false); 331 Frame& selectedFrame = m_webPage->corePage()->focusController().focusedOrMainFrame(); 332 updateFindIndicator(&selectedFrame, false); 336 333 } 337 334 -
trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp
r154658 r154678 588 588 EditorState WebPage::editorState() const 589 589 { 590 Frame* frame = m_page->focusController().focusedOrMainFrame(); 591 ASSERT(frame); 590 Frame& frame = m_page->focusController().focusedOrMainFrame(); 592 591 593 592 EditorState result; … … 602 601 } 603 602 604 result.selectionIsNone = frame ->selection().isNone();605 result.selectionIsRange = frame ->selection().isRange();606 result.isContentEditable = frame ->selection().isContentEditable();607 result.isContentRichlyEditable = frame ->selection().isContentRichlyEditable();608 result.isInPasswordField = frame ->selection().isInPasswordField();609 result.hasComposition = frame ->editor().hasComposition();610 result.shouldIgnoreCompositionSelectionChange = frame ->editor().ignoreCompositionSelectionChange();603 result.selectionIsNone = frame.selection().isNone(); 604 result.selectionIsRange = frame.selection().isRange(); 605 result.isContentEditable = frame.selection().isContentEditable(); 606 result.isContentRichlyEditable = frame.selection().isContentRichlyEditable(); 607 result.isInPasswordField = frame.selection().isInPasswordField(); 608 result.hasComposition = frame.editor().hasComposition(); 609 result.shouldIgnoreCompositionSelectionChange = frame.editor().ignoreCompositionSelectionChange(); 611 610 612 611 #if PLATFORM(QT) … … 614 613 size_t length = 0; 615 614 616 Element* selectionRoot = frame ->selection().rootEditableElementRespectingShadowTree();617 Element* scope = selectionRoot ? selectionRoot : frame ->document()->documentElement();615 Element* selectionRoot = frame.selection().rootEditableElementRespectingShadowTree(); 616 Element* scope = selectionRoot ? selectionRoot : frame.document()->documentElement(); 618 617 619 618 if (!scope) … … 644 643 645 644 if (selectionRoot) 646 result.editorRect = frame ->view()->contentsToWindow(selectionRoot->pixelSnappedBoundingBox());645 result.editorRect = frame.view()->contentsToWindow(selectionRoot->pixelSnappedBoundingBox()); 647 646 648 647 RefPtr<Range> range; 649 if (result.hasComposition && (range = frame ->editor().compositionRange())) {650 frame ->editor().getCompositionSelection(result.anchorPosition, result.cursorPosition);651 652 result.compositionRect = frame ->view()->contentsToWindow(range->boundingBox());653 } 654 655 if (!result.hasComposition && !result.selectionIsNone && (range = frame ->selection().selection().firstRange())) {648 if (result.hasComposition && (range = frame.editor().compositionRange())) { 649 frame.editor().getCompositionSelection(result.anchorPosition, result.cursorPosition); 650 651 result.compositionRect = frame.view()->contentsToWindow(range->boundingBox()); 652 } 653 654 if (!result.hasComposition && !result.selectionIsNone && (range = frame.selection().selection().firstRange())) { 656 655 TextIterator::getLocationAndLengthFromRange(scope, range.get(), location, length); 657 bool baseIsFirst = frame ->selection().selection().isBaseFirst();656 bool baseIsFirst = frame.selection().selection().isBaseFirst(); 658 657 659 658 result.cursorPosition = (baseIsFirst) ? location + length : location; … … 663 662 664 663 if (range) 665 result.cursorRect = frame ->view()->contentsToWindow(frame->editor().firstRectForRange(range.get()));664 result.cursorRect = frame.view()->contentsToWindow(frame.editor().firstRectForRange(range.get())); 666 665 667 666 // FIXME: We should only transfer innerText when it changes and do this on the UI side. … … 676 675 677 676 #if PLATFORM(GTK) 678 result.cursorRect = frame ->selection().absoluteCaretBounds();677 result.cursorRect = frame.selection().absoluteCaretBounds(); 679 678 #endif 680 679 … … 739 738 } 740 739 741 PluginView* WebPage::focusedPluginViewForFrame(Frame *frame)742 { 743 if (!frame ->document()->isPluginDocument())740 PluginView* WebPage::focusedPluginViewForFrame(Frame& frame) 741 { 742 if (!frame.document()->isPluginDocument()) 744 743 return 0; 745 744 746 PluginDocument* pluginDocument = static_cast<PluginDocument*>(frame ->document());745 PluginDocument* pluginDocument = static_cast<PluginDocument*>(frame.document()); 747 746 748 747 if (pluginDocument->focusedElement() != pluginDocument->pluginElement()) … … 765 764 void WebPage::executeEditingCommand(const String& commandName, const String& argument) 766 765 { 767 Frame* frame = m_page->focusController().focusedOrMainFrame(); 768 if (!frame) 769 return; 766 Frame& frame = m_page->focusController().focusedOrMainFrame(); 770 767 771 768 if (PluginView* pluginView = focusedPluginViewForFrame(frame)) { … … 774 771 } 775 772 776 frame ->editor().command(commandName).execute(argument);773 frame.editor().command(commandName).execute(argument); 777 774 } 778 775 779 776 bool WebPage::isEditingCommandEnabled(const String& commandName) 780 777 { 781 Frame* frame = m_page->focusController().focusedOrMainFrame(); 782 if (!frame) 783 return false; 778 Frame& frame = m_page->focusController().focusedOrMainFrame(); 784 779 785 780 if (PluginView* pluginView = focusedPluginViewForFrame(frame)) 786 781 return pluginView->isEditingCommandEnabled(commandName); 787 782 788 Editor::Command command = frame ->editor().command(commandName);783 Editor::Command command = frame.editor().command(commandName); 789 784 return command.isSupported() && command.isEnabled(); 790 785 } … … 1767 1762 1768 1763 if (keyboardEvent.type() == WebEvent::Char && keyboardEvent.isSystemKey()) 1769 return page->focusController().focusedOrMainFrame() ->eventHandler().handleAccessKey(platform(keyboardEvent));1770 return page->focusController().focusedOrMainFrame() ->eventHandler().keyEvent(platform(keyboardEvent));1764 return page->focusController().focusedOrMainFrame().eventHandler().handleAccessKey(platform(keyboardEvent)); 1765 return page->focusController().focusedOrMainFrame().eventHandler().keyEvent(platform(keyboardEvent)); 1771 1766 } 1772 1767 … … 1849 1844 bool isEnabled = false; 1850 1845 int32_t state = 0; 1851 Frame* frame = m_page->focusController().focusedOrMainFrame(); 1852 if (frame) { 1853 if (PluginView* pluginView = focusedPluginViewForFrame(frame)) 1854 isEnabled = pluginView->isEditingCommandEnabled(commandName); 1855 else { 1856 Editor::Command command = frame->editor().command(commandName); 1857 state = command.state(); 1858 isEnabled = command.isSupported() && command.isEnabled(); 1859 } 1846 Frame& frame = m_page->focusController().focusedOrMainFrame(); 1847 if (PluginView* pluginView = focusedPluginViewForFrame(frame)) 1848 isEnabled = pluginView->isEditingCommandEnabled(commandName); 1849 else { 1850 Editor::Command command = frame.editor().command(commandName); 1851 state = command.state(); 1852 isEnabled = command.isSupported() && command.isEnabled(); 1860 1853 } 1861 1854 … … 1974 1967 bool WebPage::scroll(Page* page, ScrollDirection direction, ScrollGranularity granularity) 1975 1968 { 1976 return page->focusController().focusedOrMainFrame() ->eventHandler().scrollRecursively(direction, granularity);1969 return page->focusController().focusedOrMainFrame().eventHandler().scrollRecursively(direction, granularity); 1977 1970 } 1978 1971 1979 1972 bool WebPage::logicalScroll(Page* page, ScrollLogicalDirection direction, ScrollGranularity granularity) 1980 1973 { 1981 return page->focusController().focusedOrMainFrame() ->eventHandler().logicalScrollRecursively(direction, granularity);1974 return page->focusController().focusedOrMainFrame().eventHandler().logicalScrollRecursively(direction, granularity); 1982 1975 } 1983 1976 … … 1989 1982 void WebPage::centerSelectionInVisibleArea() 1990 1983 { 1991 Frame* frame = m_page->focusController().focusedOrMainFrame(); 1992 if (!frame) 1993 return; 1994 1995 frame->selection().revealSelection(ScrollAlignment::alignCenterAlways); 1984 Frame& frame = m_page->focusController().focusedOrMainFrame(); 1985 frame.selection().revealSelection(ScrollAlignment::alignCenterAlways); 1996 1986 m_findController.showFindIndicatorInSelection(); 1997 1987 } … … 2047 2037 2048 2038 // FIXME: This should propagate to all ScrollableAreas. 2049 if (Frame* frame = m_page->focusController().focusedOrMainFrame()) { 2050 if (FrameView* view = frame->view()) 2051 view->willStartLiveResize(); 2052 } 2039 Frame& frame = m_page->focusController().focusedOrMainFrame(); 2040 if (FrameView* view = frame.view()) 2041 view->willStartLiveResize(); 2053 2042 } 2054 2043 … … 2059 2048 2060 2049 // FIXME: This should propagate to all ScrollableAreas. 2061 if (Frame* frame = m_page->focusController().focusedOrMainFrame()) { 2062 if (FrameView* view = frame->view()) 2063 view->willEndLiveResize(); 2064 } 2050 Frame& frame = m_page->focusController().focusedOrMainFrame(); 2051 if (FrameView* view = frame.view()) 2052 view->willEndLiveResize(); 2065 2053 } 2066 2054 … … 2075 2063 return; 2076 2064 2077 Frame *frame = m_page->focusController().focusedOrMainFrame();2078 frame ->document()->setFocusedElement(0);2065 Frame& frame = m_page->focusController().focusedOrMainFrame(); 2066 frame.document()->setFocusedElement(0); 2079 2067 2080 2068 if (isKeyboardEventValid && event.type() == WebEvent::KeyDown) { 2081 2069 PlatformKeyboardEvent platformEvent(platform(event)); 2082 2070 platformEvent.disambiguateKeyDownEvent(PlatformEvent::RawKeyDown); 2083 m_page->focusController().setInitialFocus(forward ? FocusDirectionForward : FocusDirectionBackward, KeyboardEvent::create(platformEvent, frame ->document()->defaultView()).get());2071 m_page->focusController().setInitialFocus(forward ? FocusDirectionForward : FocusDirectionBackward, KeyboardEvent::create(platformEvent, frame.document()->defaultView()).get()); 2084 2072 return; 2085 2073 } … … 2935 2923 void WebPage::advanceToNextMisspelling(bool startBeforeSelection) 2936 2924 { 2937 Frame *frame = m_page->focusController().focusedOrMainFrame();2938 frame ->editor().advanceToNextMisspelling(startBeforeSelection);2925 Frame& frame = m_page->focusController().focusedOrMainFrame(); 2926 frame.editor().advanceToNextMisspelling(startBeforeSelection); 2939 2927 } 2940 2928 2941 2929 void WebPage::changeSpellingToWord(const String& word) 2942 2930 { 2943 replaceSelectionWithText( m_page->focusController().focusedOrMainFrame(), word);2931 replaceSelectionWithText(&m_page->focusController().focusedOrMainFrame(), word); 2944 2932 } 2945 2933 … … 2963 2951 void WebPage::uppercaseWord() 2964 2952 { 2965 m_page->focusController().focusedOrMainFrame() ->editor().uppercaseWord();2953 m_page->focusController().focusedOrMainFrame().editor().uppercaseWord(); 2966 2954 } 2967 2955 2968 2956 void WebPage::lowercaseWord() 2969 2957 { 2970 m_page->focusController().focusedOrMainFrame() ->editor().lowercaseWord();2958 m_page->focusController().focusedOrMainFrame().editor().lowercaseWord(); 2971 2959 } 2972 2960 2973 2961 void WebPage::capitalizeWord() 2974 2962 { 2975 m_page->focusController().focusedOrMainFrame() ->editor().capitalizeWord();2963 m_page->focusController().focusedOrMainFrame().editor().capitalizeWord(); 2976 2964 } 2977 2965 #endif … … 3015 3003 void WebPage::clearSelection() 3016 3004 { 3017 m_page->focusController().focusedOrMainFrame() ->selection().clear();3005 m_page->focusController().focusedOrMainFrame().selection().clear(); 3018 3006 } 3019 3007 … … 3607 3595 void WebPage::handleAlternativeTextUIResult(const String& result) 3608 3596 { 3609 Frame* frame = m_page->focusController().focusedOrMainFrame(); 3610 if (!frame) 3611 return; 3612 frame->editor().handleAlternativeTextUIResult(result); 3597 Frame& frame = m_page->focusController().focusedOrMainFrame(); 3598 frame.editor().handleAlternativeTextUIResult(result); 3613 3599 } 3614 3600 #endif … … 3631 3617 void WebPage::setCompositionForTesting(const String& compositionString, uint64_t from, uint64_t length) 3632 3618 { 3633 Frame *frame = m_page->focusController().focusedOrMainFrame();3634 if (!frame || !frame->editor().canEdit())3619 Frame& frame = m_page->focusController().focusedOrMainFrame(); 3620 if (!frame.editor().canEdit()) 3635 3621 return; 3636 3622 3637 3623 Vector<CompositionUnderline> underlines; 3638 3624 underlines.append(CompositionUnderline(0, compositionString.length(), Color(Color::black), false)); 3639 frame ->editor().setComposition(compositionString, underlines, from, from + length);3625 frame.editor().setComposition(compositionString, underlines, from, from + length); 3640 3626 } 3641 3627 3642 3628 bool WebPage::hasCompositionForTesting() 3643 3629 { 3644 Frame *frame = m_page->focusController().focusedOrMainFrame();3645 return frame && frame->editor().hasComposition();3630 Frame& frame = m_page->focusController().focusedOrMainFrame(); 3631 return frame.editor().hasComposition(); 3646 3632 } 3647 3633 3648 3634 void WebPage::confirmCompositionForTesting(const String& compositionString) 3649 3635 { 3650 Frame *frame = m_page->focusController().focusedOrMainFrame();3651 if (!frame || !frame->editor().canEdit())3636 Frame& frame = m_page->focusController().focusedOrMainFrame(); 3637 if (!frame.editor().canEdit()) 3652 3638 return; 3653 3639 3654 3640 if (compositionString.isNull()) 3655 frame ->editor().confirmComposition();3656 frame ->editor().confirmComposition(compositionString);3641 frame.editor().confirmComposition(); 3642 frame.editor().confirmComposition(compositionString); 3657 3643 } 3658 3644 … … 3807 3793 static Frame* targetFrameForEditing(WebPage* page) 3808 3794 { 3809 Frame* targetFrame = page->corePage()->focusController().focusedOrMainFrame(); 3810 3811 if (!targetFrame) 3812 return 0; 3813 3814 Editor& editor = targetFrame->editor(); 3795 Frame& targetFrame = page->corePage()->focusController().focusedOrMainFrame(); 3796 3797 Editor& editor = targetFrame.editor(); 3815 3798 if (!editor.canEdit()) 3816 3799 return 0; … … 3827 3810 } 3828 3811 } 3829 return targetFrame;3812 return &targetFrame; 3830 3813 } 3831 3814 -
trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h
r154085 r154678 844 844 static bool platformCanHandleRequest(const WebCore::ResourceRequest&); 845 845 846 static PluginView* focusedPluginViewForFrame(WebCore::Frame *);846 static PluginView* focusedPluginViewForFrame(WebCore::Frame&); 847 847 static PluginView* pluginViewForFrame(WebCore::Frame*); 848 848 -
trunk/Source/WebKit2/WebProcess/WebPage/efl/WebPageEfl.cpp
r154178 r154678 78 78 static inline void scroll(Page* page, ScrollDirection direction, ScrollGranularity granularity) 79 79 { 80 page->focusController().focusedOrMainFrame() ->eventHandler().scrollRecursively(direction, granularity);80 page->focusController().focusedOrMainFrame().eventHandler().scrollRecursively(direction, granularity); 81 81 } 82 82 … … 175 175 static Frame* targetFrameForEditing(WebPage* page) 176 176 { 177 Frame* frame = page->corePage()->focusController().focusedOrMainFrame(); 178 if (!frame) 179 return 0; 180 181 Editor& editor = frame->editor(); 177 Frame& frame = page->corePage()->focusController().focusedOrMainFrame(); 178 179 Editor& editor = frame.editor(); 182 180 if (!editor.canEdit()) 183 181 return 0; … … 195 193 } 196 194 197 return frame;195 return &frame; 198 196 } 199 197 … … 218 216 void WebPage::cancelComposition() 219 217 { 220 Frame* frame = m_page->focusController().focusedOrMainFrame(); 221 if (!frame) 222 return; 223 224 frame->editor().cancelComposition(); 218 Frame& frame = m_page->focusController().focusedOrMainFrame(); 219 frame.editor().cancelComposition(); 225 220 } 226 221 -
trunk/Source/WebKit2/WebProcess/WebPage/gtk/WebPageGtk.cpp
r154178 r154678 78 78 static inline void scroll(Page* page, ScrollDirection direction, ScrollGranularity granularity) 79 79 { 80 page->focusController().focusedOrMainFrame() ->eventHandler().scrollRecursively(direction, granularity);80 page->focusController().focusedOrMainFrame().eventHandler().scrollRecursively(direction, granularity); 81 81 } 82 82 -
trunk/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm
r154658 r154678 260 260 void WebPage::setComposition(const String& text, Vector<CompositionUnderline> underlines, uint64_t selectionStart, uint64_t selectionEnd, uint64_t replacementRangeStart, uint64_t replacementRangeEnd, EditorState& newState) 261 261 { 262 Frame *frame = m_page->focusController().focusedOrMainFrame();263 264 if (frame ->selection().isContentEditable()) {262 Frame& frame = m_page->focusController().focusedOrMainFrame(); 263 264 if (frame.selection().isContentEditable()) { 265 265 RefPtr<Range> replacementRange; 266 266 if (replacementRangeStart != NSNotFound) { 267 replacementRange = convertToRange( frame, NSMakeRange(replacementRangeStart, replacementRangeEnd - replacementRangeStart));268 frame ->selection().setSelection(VisibleSelection(replacementRange.get(), SEL_DEFAULT_AFFINITY));267 replacementRange = convertToRange(&frame, NSMakeRange(replacementRangeStart, replacementRangeEnd - replacementRangeStart)); 268 frame.selection().setSelection(VisibleSelection(replacementRange.get(), SEL_DEFAULT_AFFINITY)); 269 269 } 270 270 271 frame ->editor().setComposition(text, underlines, selectionStart, selectionEnd);271 frame.editor().setComposition(text, underlines, selectionStart, selectionEnd); 272 272 } 273 273 … … 277 277 void WebPage::confirmComposition(EditorState& newState) 278 278 { 279 Frame *frame = m_page->focusController().focusedOrMainFrame();280 frame ->editor().confirmComposition();279 Frame& frame = m_page->focusController().focusedOrMainFrame(); 280 frame.editor().confirmComposition(); 281 281 newState = editorState(); 282 282 } … … 284 284 void WebPage::cancelComposition(EditorState& newState) 285 285 { 286 Frame *frame = m_page->focusController().focusedOrMainFrame();287 frame ->editor().cancelComposition();286 Frame& frame = m_page->focusController().focusedOrMainFrame(); 287 frame.editor().cancelComposition(); 288 288 newState = editorState(); 289 289 } … … 291 291 void WebPage::insertText(const String& text, uint64_t replacementRangeStart, uint64_t replacementRangeEnd, bool& handled, EditorState& newState) 292 292 { 293 Frame *frame = m_page->focusController().focusedOrMainFrame();293 Frame& frame = m_page->focusController().focusedOrMainFrame(); 294 294 295 295 if (replacementRangeStart != NSNotFound) { 296 RefPtr<Range> replacementRange = convertToRange( frame, NSMakeRange(replacementRangeStart, replacementRangeEnd - replacementRangeStart));296 RefPtr<Range> replacementRange = convertToRange(&frame, NSMakeRange(replacementRangeStart, replacementRangeEnd - replacementRangeStart)); 297 297 if (replacementRange) 298 frame ->selection().setSelection(VisibleSelection(replacementRange.get(), SEL_DEFAULT_AFFINITY));299 } 300 301 if (!frame ->editor().hasComposition()) {298 frame.selection().setSelection(VisibleSelection(replacementRange.get(), SEL_DEFAULT_AFFINITY)); 299 } 300 301 if (!frame.editor().hasComposition()) { 302 302 // An insertText: might be handled by other responders in the chain if we don't handle it. 303 303 // One example is space bar that results in scrolling down the page. 304 handled = frame ->editor().insertText(text, m_keyboardEventBeingInterpreted);304 handled = frame.editor().insertText(text, m_keyboardEventBeingInterpreted); 305 305 } else { 306 306 handled = true; 307 frame ->editor().confirmComposition(text);307 frame.editor().confirmComposition(text); 308 308 } 309 309 … … 313 313 void WebPage::insertDictatedText(const String& text, uint64_t replacementRangeStart, uint64_t replacementRangeEnd, const Vector<WebCore::DictationAlternative>& dictationAlternativeLocations, bool& handled, EditorState& newState) 314 314 { 315 Frame *frame = m_page->focusController().focusedOrMainFrame();315 Frame& frame = m_page->focusController().focusedOrMainFrame(); 316 316 317 317 if (replacementRangeStart != NSNotFound) { 318 RefPtr<Range> replacementRange = convertToRange( frame, NSMakeRange(replacementRangeStart, replacementRangeEnd - replacementRangeStart));318 RefPtr<Range> replacementRange = convertToRange(&frame, NSMakeRange(replacementRangeStart, replacementRangeEnd - replacementRangeStart)); 319 319 if (replacementRange) 320 frame ->selection().setSelection(VisibleSelection(replacementRange.get(), SEL_DEFAULT_AFFINITY));321 } 322 323 ASSERT(!frame ->editor().hasComposition());324 handled = frame ->editor().insertDictatedText(text, dictationAlternativeLocations, m_keyboardEventBeingInterpreted);320 frame.selection().setSelection(VisibleSelection(replacementRange.get(), SEL_DEFAULT_AFFINITY)); 321 } 322 323 ASSERT(!frame.editor().hasComposition()); 324 handled = frame.editor().insertDictatedText(text, dictationAlternativeLocations, m_keyboardEventBeingInterpreted); 325 325 newState = editorState(); 326 326 } … … 328 328 void WebPage::getMarkedRange(uint64_t& location, uint64_t& length) 329 329 { 330 location = NSNotFound; 331 length = 0; 332 Frame* frame = m_page->focusController().focusedOrMainFrame(); 333 if (!frame) 334 return; 335 336 RefPtr<Range> range = frame->editor().compositionRange(); 330 Frame& frame = m_page->focusController().focusedOrMainFrame(); 331 332 RefPtr<Range> range = frame.editor().compositionRange(); 337 333 size_t locationSize; 338 334 size_t lengthSize; 339 if (range && TextIterator::getLocationAndLengthFromRange(frame ->selection().rootEditableElementOrDocumentElement(), range.get(), locationSize, lengthSize)) {335 if (range && TextIterator::getLocationAndLengthFromRange(frame.selection().rootEditableElementOrDocumentElement(), range.get(), locationSize, lengthSize)) { 340 336 location = static_cast<uint64_t>(locationSize); 341 337 length = static_cast<uint64_t>(lengthSize); 338 } else { 339 location = NSNotFound; 340 length = 0; 342 341 } 343 342 } … … 345 344 void WebPage::getSelectedRange(uint64_t& location, uint64_t& length) 346 345 { 347 location = NSNotFound; 348 length = 0; 349 Frame* frame = m_page->focusController().focusedOrMainFrame(); 350 if (!frame) 351 return; 346 Frame& frame = m_page->focusController().focusedOrMainFrame(); 352 347 353 348 size_t locationSize; 354 349 size_t lengthSize; 355 RefPtr<Range> range = frame ->selection().toNormalizedRange();356 if (range && TextIterator::getLocationAndLengthFromRange(frame ->selection().rootEditableElementOrDocumentElement(), range.get(), locationSize, lengthSize)) {350 RefPtr<Range> range = frame.selection().toNormalizedRange(); 351 if (range && TextIterator::getLocationAndLengthFromRange(frame.selection().rootEditableElementOrDocumentElement(), range.get(), locationSize, lengthSize)) { 357 352 location = static_cast<uint64_t>(locationSize); 358 353 length = static_cast<uint64_t>(lengthSize); 354 } else { 355 location = NSNotFound; 356 length = 0; 359 357 } 360 358 } … … 362 360 void WebPage::getAttributedSubstringFromRange(uint64_t location, uint64_t length, AttributedString& result) 363 361 { 362 Frame& frame = m_page->focusController().focusedOrMainFrame(); 363 364 if (frame.selection().isNone() || !frame.selection().isContentEditable() || frame.selection().isInPasswordField()) 365 return; 366 364 367 NSRange nsRange = NSMakeRange(location, length - location); 365 366 Frame* frame = m_page->focusController().focusedOrMainFrame(); 367 if (!frame) 368 return; 369 370 if (frame->selection().isNone() || !frame->selection().isContentEditable() || frame->selection().isInPasswordField()) 371 return; 372 373 RefPtr<Range> range = convertToRange(frame, nsRange); 368 RefPtr<Range> range = convertToRange(&frame, nsRange); 374 369 if (!range) 375 370 return; … … 393 388 394 389 HitTestResult result = m_page->mainFrame().eventHandler().hitTestResultAtPoint(point); 395 Frame* frame = result.innerNonSharedNode() ? result.innerNodeFrame() : m_page->focusController().focusedOrMainFrame();390 Frame* frame = result.innerNonSharedNode() ? result.innerNodeFrame() : &m_page->focusController().focusedOrMainFrame(); 396 391 397 392 RefPtr<Range> range = frame->rangeForPoint(result.roundedPointInInnerNodeFrame()); … … 423 418 void WebPage::firstRectForCharacterRange(uint64_t location, uint64_t length, WebCore::IntRect& resultRect) 424 419 { 425 Frame *frame = m_page->focusController().focusedOrMainFrame();420 Frame& frame = m_page->focusController().focusedOrMainFrame(); 426 421 resultRect.setLocation(IntPoint(0, 0)); 427 422 resultRect.setSize(IntSize(0, 0)); 428 423 429 RefPtr<Range> range = convertToRange( frame, NSMakeRange(location, length));424 RefPtr<Range> range = convertToRange(&frame, NSMakeRange(location, length)); 430 425 if (!range) 431 426 return; … … 434 429 ASSERT(range->endContainer()); 435 430 436 IntRect rect = frame ->editor().firstRectForRange(range.get());437 resultRect = frame ->view()->contentsToWindow(rect);431 IntRect rect = frame.editor().firstRectForRange(range.get()); 432 resultRect = frame.view()->contentsToWindow(rect); 438 433 } 439 434 … … 483 478 IntPoint point = roundedIntPoint(floatPoint); 484 479 HitTestResult result = m_page->mainFrame().eventHandler().hitTestResultAtPoint(m_page->mainFrame().view()->windowToContents(point)); 485 Frame* frame = result.innerNonSharedNode() ? result.innerNonSharedNode()->document()->frame() : m_page->focusController().focusedOrMainFrame();480 Frame* frame = result.innerNonSharedNode() ? result.innerNonSharedNode()->document()->frame() : &m_page->focusController().focusedOrMainFrame(); 486 481 487 482 IntPoint translatedPoint = frame->view()->windowToContents(point); … … 492 487 493 488 VisiblePosition position = frame->visiblePositionForPoint(translatedPoint); 494 VisibleSelection selection = m_page->focusController().focusedOrMainFrame() ->selection().selection();489 VisibleSelection selection = m_page->focusController().focusedOrMainFrame().selection().selection(); 495 490 if (shouldUseSelection(position, selection)) { 496 491 performDictionaryLookupForSelection(frame, selection); … … 674 669 void WebPage::readSelectionFromPasteboard(const String& pasteboardName, bool& result) 675 670 { 676 Frame *frame = m_page->focusController().focusedOrMainFrame();677 if ( !frame || frame->selection().isNone()) {671 Frame& frame = m_page->focusController().focusedOrMainFrame(); 672 if (frame.selection().isNone()) { 678 673 result = false; 679 674 return; 680 675 } 681 frame ->editor().readSelectionFromPasteboard(pasteboardName);676 frame.editor().readSelectionFromPasteboard(pasteboardName); 682 677 result = true; 683 678 } … … 685 680 void WebPage::getStringSelectionForPasteboard(String& stringValue) 686 681 { 687 Frame* frame = m_page->focusController().focusedOrMainFrame(); 688 689 if (!frame) 690 return; 682 Frame& frame = m_page->focusController().focusedOrMainFrame(); 691 683 692 684 if (PluginView* pluginView = focusedPluginViewForFrame(frame)) { … … 698 690 } 699 691 700 if (frame ->selection().isNone())701 return; 702 703 stringValue = frame ->editor().stringSelectionForPasteboard();692 if (frame.selection().isNone()) 693 return; 694 695 stringValue = frame.editor().stringSelectionForPasteboard(); 704 696 } 705 697 706 698 void WebPage::getDataSelectionForPasteboard(const String pasteboardType, SharedMemory::Handle& handle, uint64_t& size) 707 699 { 708 Frame *frame = m_page->focusController().focusedOrMainFrame();709 if ( !frame || frame->selection().isNone())710 return; 711 712 RefPtr<SharedBuffer> buffer = frame ->editor().dataSelectionForPasteboard(pasteboardType);700 Frame& frame = m_page->focusController().focusedOrMainFrame(); 701 if (frame.selection().isNone()) 702 return; 703 704 RefPtr<SharedBuffer> buffer = frame.editor().dataSelectionForPasteboard(pasteboardType); 713 705 if (!buffer) { 714 706 size = 0; … … 777 769 void WebPage::shouldDelayWindowOrderingEvent(const WebKit::WebMouseEvent& event, bool& result) 778 770 { 771 Frame& frame = m_page->focusController().focusedOrMainFrame(); 772 773 #if ENABLE(DRAG_SUPPORT) 774 HitTestResult hitResult = frame.eventHandler().hitTestResultAtPoint(frame.view()->windowToContents(event.position()), HitTestRequest::ReadOnly | HitTestRequest::Active); 775 if (hitResult.isSelected()) 776 result = frame.eventHandler().eventMayStartDrag(platform(event)); 777 else 778 #endif 779 result = false; 780 } 781 782 void WebPage::acceptsFirstMouse(int eventNumber, const WebKit::WebMouseEvent& event, bool& result) 783 { 779 784 result = false; 780 Frame* frame = m_page->focusController().focusedOrMainFrame(); 781 if (!frame) 782 return; 783 784 #if ENABLE(DRAG_SUPPORT) 785 HitTestResult hitResult = frame->eventHandler().hitTestResultAtPoint(frame->view()->windowToContents(event.position()), HitTestRequest::ReadOnly | HitTestRequest::Active); 786 if (hitResult.isSelected()) 787 result = frame->eventHandler().eventMayStartDrag(platform(event)); 788 #endif 789 } 790 791 void WebPage::acceptsFirstMouse(int eventNumber, const WebKit::WebMouseEvent& event, bool& result) 792 { 793 result = false; 794 Frame* frame = m_page->focusController().focusedOrMainFrame(); 795 if (!frame) 796 return; 797 798 HitTestResult hitResult = frame->eventHandler().hitTestResultAtPoint(frame->view()->windowToContents(event.position()), HitTestRequest::ReadOnly | HitTestRequest::Active); 799 frame->eventHandler().setActivationEventNumber(eventNumber); 785 Frame& frame = m_page->focusController().focusedOrMainFrame(); 786 787 HitTestResult hitResult = frame.eventHandler().hitTestResultAtPoint(frame.view()->windowToContents(event.position()), HitTestRequest::ReadOnly | HitTestRequest::Active); 788 frame.eventHandler().setActivationEventNumber(eventNumber); 800 789 #if ENABLE(DRAG_SUPPORT) 801 790 if (hitResult.isSelected()) 802 result = frame ->eventHandler().eventMayStartDrag(platform(event));791 result = frame.eventHandler().eventMayStartDrag(platform(event)); 803 792 else 804 793 #endif -
trunk/Source/WebKit2/WebProcess/WebPage/qt/WebPageQt.cpp
r154178 r154678 224 224 static inline void scroll(Page* page, ScrollDirection direction, ScrollGranularity granularity) 225 225 { 226 page->focusController().focusedOrMainFrame() ->eventHandler().scrollRecursively(direction, granularity);226 page->focusController().focusedOrMainFrame().eventHandler().scrollRecursively(direction, granularity); 227 227 } 228 228 229 229 static inline void logicalScroll(Page* page, ScrollLogicalDirection direction, ScrollGranularity granularity) 230 230 { 231 page->focusController().focusedOrMainFrame() ->eventHandler().logicalScrollRecursively(direction, granularity);231 page->focusController().focusedOrMainFrame().eventHandler().logicalScrollRecursively(direction, granularity); 232 232 } 233 233
Note: See TracChangeset
for help on using the changeset viewer.