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

Side by Side Diff: Source/core/page/EventHandler.cpp

Issue 20681004: Make first-letter style to work with editing Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 2013-09-20T18:27:32 Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv ed. 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv ed.
3 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) 3 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org)
4 * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies) 4 * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies)
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 } 411 }
412 412
413 m_frame->selection().setNonDirectionalSelectionIfNeeded(selection, granulari ty); 413 m_frame->selection().setNonDirectionalSelectionIfNeeded(selection, granulari ty);
414 414
415 return true; 415 return true;
416 } 416 }
417 417
418 void EventHandler::selectClosestWordFromHitTestResult(const HitTestResult& resul t, AppendTrailingWhitespace appendTrailingWhitespace) 418 void EventHandler::selectClosestWordFromHitTestResult(const HitTestResult& resul t, AppendTrailingWhitespace appendTrailingWhitespace)
419 { 419 {
420 Node* innerNode = result.targetNode(); 420 Node* innerNode = result.targetNode();
421 RenderObject* renderer = result.renderer();
421 VisibleSelection newSelection; 422 VisibleSelection newSelection;
422 423
423 if (innerNode && innerNode->renderer()) { 424 if (innerNode && renderer) {
424 VisiblePosition pos(innerNode->renderer()->positionForPoint(result.local Point())); 425 VisiblePosition pos(renderer->positionForPoint(result.localPoint()));
425 if (pos.isNotNull()) { 426 if (pos.isNotNull()) {
426 newSelection = VisibleSelection(pos); 427 newSelection = VisibleSelection(pos);
427 newSelection.expandUsingGranularity(WordGranularity); 428 newSelection.expandUsingGranularity(WordGranularity);
428 } 429 }
429 430
430 if (appendTrailingWhitespace == ShouldAppendTrailingWhitespace && newSel ection.isRange()) 431 if (appendTrailingWhitespace == ShouldAppendTrailingWhitespace && newSel ection.isRange())
431 newSelection.appendTrailingWhitespace(); 432 newSelection.appendTrailingWhitespace();
432 433
433 updateSelectionForMouseDownDispatchingSelectStart(innerNode, expandSelec tionToRespectUserSelectAll(innerNode, newSelection), WordGranularity); 434 updateSelectionForMouseDownDispatchingSelectStart(innerNode, expandSelec tionToRespectUserSelectAll(innerNode, newSelection), WordGranularity);
434 } 435 }
435 } 436 }
436 437
437 void EventHandler::selectClosestMisspellingFromHitTestResult(const HitTestResult & result, AppendTrailingWhitespace appendTrailingWhitespace) 438 void EventHandler::selectClosestMisspellingFromHitTestResult(const HitTestResult & result, AppendTrailingWhitespace appendTrailingWhitespace)
438 { 439 {
439 Node* innerNode = result.targetNode(); 440 Node* innerNode = result.targetNode();
441 RenderObject* renderer = result.renderer();
440 VisibleSelection newSelection; 442 VisibleSelection newSelection;
441 443
442 if (innerNode && innerNode->renderer()) { 444 if (innerNode && renderer) {
443 VisiblePosition pos(innerNode->renderer()->positionForPoint(result.local Point())); 445 VisiblePosition pos(renderer->positionForPoint(result.localPoint()));
444 Position start = pos.deepEquivalent(); 446 Position start = pos.deepEquivalent();
445 Position end = pos.deepEquivalent(); 447 Position end = pos.deepEquivalent();
446 if (pos.isNotNull()) { 448 if (pos.isNotNull()) {
447 Vector<DocumentMarker*> markers = innerNode->document().markers()->m arkersInRange( 449 Vector<DocumentMarker*> markers = innerNode->document().markers()->m arkersInRange(
448 makeRange(pos, pos).get(), DocumentMarker::Spelling | DocumentMa rker::Grammar); 450 makeRange(pos, pos).get(), DocumentMarker::Spelling | DocumentMa rker::Grammar);
449 if (markers.size() == 1) { 451 if (markers.size() == 1) {
450 start.moveToOffset(markers[0]->startOffset()); 452 start.moveToOffset(markers[0]->startOffset());
451 end.moveToOffset(markers[0]->endOffset()); 453 end.moveToOffset(markers[0]->endOffset());
452 newSelection = VisibleSelection(start, end); 454 newSelection = VisibleSelection(start, end);
453 } 455 }
(...skipping 21 matching lines...) Expand all
475 (result.event().clickCount() == 2 && m_frame->editor().isSelectTrail ingWhitespaceEnabled()) ? ShouldAppendTrailingWhitespace : DontAppendTrailingWhi tespace); 477 (result.event().clickCount() == 2 && m_frame->editor().isSelectTrail ingWhitespaceEnabled()) ? ShouldAppendTrailingWhitespace : DontAppendTrailingWhi tespace);
476 } 478 }
477 } 479 }
478 480
479 void EventHandler::selectClosestWordOrLinkFromMouseEvent(const MouseEventWithHit TestResults& result) 481 void EventHandler::selectClosestWordOrLinkFromMouseEvent(const MouseEventWithHit TestResults& result)
480 { 482 {
481 if (!result.hitTestResult().isLiveLink()) 483 if (!result.hitTestResult().isLiveLink())
482 return selectClosestWordFromMouseEvent(result); 484 return selectClosestWordFromMouseEvent(result);
483 485
484 Node* innerNode = result.targetNode(); 486 Node* innerNode = result.targetNode();
487 RenderObject* renderer = result.hitTestResult().renderer();
485 488
486 if (innerNode && innerNode->renderer() && m_mouseDownMayStartSelect) { 489 if (innerNode && renderer && m_mouseDownMayStartSelect) {
487 VisibleSelection newSelection; 490 VisibleSelection newSelection;
488 Element* URLElement = result.hitTestResult().URLElement(); 491 Element* URLElement = result.hitTestResult().URLElement();
489 VisiblePosition pos(innerNode->renderer()->positionForPoint(result.local Point())); 492 VisiblePosition pos(renderer->positionForPoint(result.localPoint()));
490 if (pos.isNotNull() && pos.deepEquivalent().deprecatedNode()->isDescenda ntOf(URLElement)) 493 if (pos.isNotNull() && pos.deepEquivalent().deprecatedNode()->isDescenda ntOf(URLElement))
491 newSelection = VisibleSelection::selectionFromContentsOfNode(URLElem ent); 494 newSelection = VisibleSelection::selectionFromContentsOfNode(URLElem ent);
492 495
493 updateSelectionForMouseDownDispatchingSelectStart(innerNode, expandSelec tionToRespectUserSelectAll(innerNode, newSelection), WordGranularity); 496 updateSelectionForMouseDownDispatchingSelectStart(innerNode, expandSelec tionToRespectUserSelectAll(innerNode, newSelection), WordGranularity);
494 } 497 }
495 } 498 }
496 499
497 bool EventHandler::handleMousePressEventDoubleClick(const MouseEventWithHitTestR esults& event) 500 bool EventHandler::handleMousePressEventDoubleClick(const MouseEventWithHitTestR esults& event)
498 { 501 {
499 if (event.event().button() != LeftButton) 502 if (event.event().button() != LeftButton)
(...skipping 11 matching lines...) Expand all
511 } 514 }
512 return true; 515 return true;
513 } 516 }
514 517
515 bool EventHandler::handleMousePressEventTripleClick(const MouseEventWithHitTestR esults& event) 518 bool EventHandler::handleMousePressEventTripleClick(const MouseEventWithHitTestR esults& event)
516 { 519 {
517 if (event.event().button() != LeftButton) 520 if (event.event().button() != LeftButton)
518 return false; 521 return false;
519 522
520 Node* innerNode = event.targetNode(); 523 Node* innerNode = event.targetNode();
521 if (!(innerNode && innerNode->renderer() && m_mouseDownMayStartSelect)) 524 RenderObject* renderer = event.hitTestResult().renderer();
525 if (!(innerNode && renderer && m_mouseDownMayStartSelect))
522 return false; 526 return false;
523 527
524 VisibleSelection newSelection; 528 VisibleSelection newSelection;
525 VisiblePosition pos(innerNode->renderer()->positionForPoint(event.localPoint ())); 529 VisiblePosition pos(renderer->positionForPoint(event.localPoint()));
526 if (pos.isNotNull()) { 530 if (pos.isNotNull()) {
527 newSelection = VisibleSelection(pos); 531 newSelection = VisibleSelection(pos);
528 newSelection.expandUsingGranularity(ParagraphGranularity); 532 newSelection.expandUsingGranularity(ParagraphGranularity);
529 } 533 }
530 534
531 return updateSelectionForMouseDownDispatchingSelectStart(innerNode, expandSe lectionToRespectUserSelectAll(innerNode, newSelection), ParagraphGranularity); 535 return updateSelectionForMouseDownDispatchingSelectStart(innerNode, expandSe lectionToRespectUserSelectAll(innerNode, newSelection), ParagraphGranularity);
532 } 536 }
533 537
534 static int textDistance(const Position& start, const Position& end) 538 static int textDistance(const Position& start, const Position& end)
535 { 539 {
536 RefPtr<Range> range = Range::create(*start.document(), start, end); 540 RefPtr<Range> range = Range::create(*start.document(), start, end);
537 return TextIterator::rangeLength(range.get(), true); 541 return TextIterator::rangeLength(range.get(), true);
538 } 542 }
539 543
540 bool EventHandler::handleMousePressEventSingleClick(const MouseEventWithHitTestR esults& event) 544 bool EventHandler::handleMousePressEventSingleClick(const MouseEventWithHitTestR esults& event)
541 { 545 {
542 m_frame->document()->updateLayoutIgnorePendingStylesheets(); 546 m_frame->document()->updateLayoutIgnorePendingStylesheets();
543 Node* innerNode = event.targetNode(); 547 Node* innerNode = event.targetNode();
544 if (!(innerNode && innerNode->renderer() && m_mouseDownMayStartSelect)) 548 RenderObject* renderer = event.hitTestResult().renderer();
549 if (!(innerNode && renderer && m_mouseDownMayStartSelect))
545 return false; 550 return false;
546 551
547 // Extend the selection if the Shift key is down, unless the click is in a l ink. 552 // Extend the selection if the Shift key is down, unless the click is in a l ink.
548 bool extendSelection = event.event().shiftKey() && !event.isOverLink(); 553 bool extendSelection = event.event().shiftKey() && !event.isOverLink();
549 554
550 // Don't restart the selection when the mouse is pressed on an 555 // Don't restart the selection when the mouse is pressed on an
551 // existing selection so we can allow for text dragging. 556 // existing selection so we can allow for text dragging.
552 if (FrameView* view = m_frame->view()) { 557 if (FrameView* view = m_frame->view()) {
553 LayoutPoint vPoint = view->windowToContents(event.event().position()); 558 LayoutPoint vPoint = view->windowToContents(event.event().position());
554 if (!extendSelection && m_frame->selection().contains(vPoint)) { 559 if (!extendSelection && m_frame->selection().contains(vPoint)) {
555 m_mouseDownWasSingleClickInSelection = true; 560 m_mouseDownWasSingleClickInSelection = true;
556 return false; 561 return false;
557 } 562 }
558 } 563 }
559 564
560 VisiblePosition visiblePos(innerNode->renderer()->positionForPoint(event.loc alPoint())); 565 VisiblePosition visiblePos(renderer->positionForPoint(event.localPoint()));
561 if (visiblePos.isNull()) 566 if (visiblePos.isNull())
562 visiblePos = VisiblePosition(firstPositionInOrBeforeNode(innerNode), DOW NSTREAM); 567 visiblePos = VisiblePosition(firstPositionInOrBeforeNode(innerNode), DOW NSTREAM);
563 Position pos = visiblePos.deepEquivalent(); 568 Position pos = visiblePos.deepEquivalent();
564 569
565 VisibleSelection newSelection = m_frame->selection().selection(); 570 VisibleSelection newSelection = m_frame->selection().selection();
566 TextGranularity granularity = CharacterGranularity; 571 TextGranularity granularity = CharacterGranularity;
567 572
568 if (extendSelection && newSelection.isCaretOrRange()) { 573 if (extendSelection && newSelection.isCaretOrRange()) {
569 VisibleSelection selectionInUserSelectAll = expandSelectionToRespectUser SelectAll(innerNode, VisibleSelection(pos)); 574 VisibleSelection selectionInUserSelectAll = expandSelectionToRespectUser SelectAll(innerNode, VisibleSelection(pos));
570 if (selectionInUserSelectAll.isRange()) { 575 if (selectionInUserSelectAll.isRange()) {
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
680 if (!m_mousePressed) 685 if (!m_mousePressed)
681 return false; 686 return false;
682 687
683 if (handleDrag(event, ShouldCheckDragHysteresis)) 688 if (handleDrag(event, ShouldCheckDragHysteresis))
684 return true; 689 return true;
685 690
686 Node* targetNode = event.targetNode(); 691 Node* targetNode = event.targetNode();
687 if (event.event().button() != LeftButton || !targetNode) 692 if (event.event().button() != LeftButton || !targetNode)
688 return false; 693 return false;
689 694
690 RenderObject* renderer = targetNode->renderer(); 695 RenderObject* renderer = event.hitTestResult().renderer();
691 if (!renderer) { 696 if (!renderer) {
692 Node* parent = EventPathWalker::parent(targetNode); 697 Node* parent = EventPathWalker::parent(targetNode);
693 if (!parent) 698 if (!parent)
694 return false; 699 return false;
695 700
696 renderer = parent->renderer(); 701 renderer = parent->renderer();
697 if (!renderer || !renderer->isListBox()) 702 if (!renderer || !renderer->isListBox())
698 return false; 703 return false;
699 } 704 }
700 705
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
735 740
736 void EventHandler::updateSelectionForMouseDrag(const HitTestResult& hitTestResul t) 741 void EventHandler::updateSelectionForMouseDrag(const HitTestResult& hitTestResul t)
737 { 742 {
738 if (!m_mouseDownMayStartSelect) 743 if (!m_mouseDownMayStartSelect)
739 return; 744 return;
740 745
741 Node* target = hitTestResult.targetNode(); 746 Node* target = hitTestResult.targetNode();
742 if (!target) 747 if (!target)
743 return; 748 return;
744 749
750 RenderObject* targetRenderer = hitTestResult.renderer();
745 VisiblePosition targetPosition = m_frame->selection().selection().visiblePos itionRespectingEditingBoundary(hitTestResult.localPoint(), target); 751 VisiblePosition targetPosition = m_frame->selection().selection().visiblePos itionRespectingEditingBoundary(hitTestResult.localPoint(), target);
746 // Don't modify the selection if we're not on a node. 752 // Don't modify the selection if we're not on a node.
747 if (targetPosition.isNull()) 753 if (targetPosition.isNull())
748 return; 754 return;
749 755
750 // Restart the selection if this is the first mouse move. This work is usual ly 756 // Restart the selection if this is the first mouse move. This work is usual ly
751 // done in handleMousePressEvent, but not if the mouse press was on an exist ing selection. 757 // done in handleMousePressEvent, but not if the mouse press was on an exist ing selection.
752 VisibleSelection newSelection = m_frame->selection().selection(); 758 VisibleSelection newSelection = m_frame->selection().selection();
753 759
754 // Special case to limit selection to the containing block for SVG text. 760 // Special case to limit selection to the containing block for SVG text.
755 // FIXME: Isn't there a better non-SVG-specific way to do this? 761 // FIXME: Isn't there a better non-SVG-specific way to do this?
756 if (Node* selectionBaseNode = newSelection.base().deprecatedNode()) 762 if (Node* selectionBaseNode = newSelection.base().deprecatedNode())
757 if (RenderObject* selectionBaseRenderer = selectionBaseNode->renderer()) 763 if (RenderObject* selectionBaseRenderer = selectionBaseNode->renderer())
758 if (selectionBaseRenderer->isSVGText()) 764 if (selectionBaseRenderer->isSVGText())
759 if (target->renderer()->containingBlock() != selectionBaseRender er->containingBlock()) 765 if (targetRenderer->containingBlock() != selectionBaseRenderer-> containingBlock())
760 return; 766 return;
761 767
762 if (m_selectionInitiationState == HaveNotStartedSelection && !dispatchSelect Start(target)) 768 if (m_selectionInitiationState == HaveNotStartedSelection && !dispatchSelect Start(target))
763 return; 769 return;
764 770
765 if (m_selectionInitiationState != ExtendedSelection) { 771 if (m_selectionInitiationState != ExtendedSelection) {
766 // Always extend selection here because it's caused by a mouse drag 772 // Always extend selection here because it's caused by a mouse drag
767 m_selectionInitiationState = ExtendedSelection; 773 m_selectionInitiationState = ExtendedSelection;
768 newSelection = VisibleSelection(targetPosition); 774 newSelection = VisibleSelection(targetPosition);
769 } 775 }
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
822 // Clear the selection if the mouse didn't move after the last mouse 828 // Clear the selection if the mouse didn't move after the last mouse
823 // press and it's not a context menu click. We do this so when clicking 829 // press and it's not a context menu click. We do this so when clicking
824 // on the selection, the selection goes away. However, if we are 830 // on the selection, the selection goes away. However, if we are
825 // editing, place the caret. 831 // editing, place the caret.
826 if (m_mouseDownWasSingleClickInSelection && m_selectionInitiationState != Ex tendedSelection 832 if (m_mouseDownWasSingleClickInSelection && m_selectionInitiationState != Ex tendedSelection
827 && m_dragStartPos == event.event().position() 833 && m_dragStartPos == event.event().position()
828 && m_frame->selection().isRange() 834 && m_frame->selection().isRange()
829 && event.event().button() != RightButton) { 835 && event.event().button() != RightButton) {
830 VisibleSelection newSelection; 836 VisibleSelection newSelection;
831 Node* node = event.targetNode(); 837 Node* node = event.targetNode();
838 RenderObject* renderer = event.hitTestResult().renderer();
832 bool caretBrowsing = m_frame->settings() && m_frame->settings()->caretBr owsingEnabled(); 839 bool caretBrowsing = m_frame->settings() && m_frame->settings()->caretBr owsingEnabled();
833 if (node && (caretBrowsing || node->rendererIsEditable()) && node->rende rer()) { 840 if (node && (caretBrowsing || node->rendererIsEditable()) && renderer)
834 VisiblePosition pos = VisiblePosition(node->renderer()->positionForP oint(event.localPoint())); 841 newSelection = VisibleSelection(VisiblePosition(renderer->positionFo rPoint(event.localPoint())));
835 newSelection = VisibleSelection(pos);
836 }
837 842
838 setSelectionIfNeeded(m_frame->selection(), newSelection); 843 setSelectionIfNeeded(m_frame->selection(), newSelection);
839 844
840 handled = true; 845 handled = true;
841 } 846 }
842 847
843 m_frame->selection().notifyRendererOfSelectionChange(UserTriggered); 848 m_frame->selection().notifyRendererOfSelectionChange(UserTriggered);
844 849
845 m_frame->selection().selectFrameElementInParentIfFullySelected(); 850 m_frame->selection().selectFrameElementInParentIfFullySelected();
846 851
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
1094 1099
1095 Page* page = m_frame->page(); 1100 Page* page = m_frame->page();
1096 if (!page) 1101 if (!page)
1097 return NoCursorChange; 1102 return NoCursorChange;
1098 #if OS(WIN) 1103 #if OS(WIN)
1099 if (panScrollInProgress()) 1104 if (panScrollInProgress())
1100 return NoCursorChange; 1105 return NoCursorChange;
1101 #endif 1106 #endif
1102 1107
1103 Node* node = event.targetNode(); 1108 Node* node = event.targetNode();
1104 RenderObject* renderer = node ? node->renderer() : 0; 1109 RenderObject* renderer = event.hitTestResult().renderer();
1105 RenderStyle* style = renderer ? renderer->style() : 0; 1110 RenderStyle* style = renderer ? renderer->style() : 0;
1106 bool horizontalText = !style || style->isHorizontalWritingMode(); 1111 bool horizontalText = !style || style->isHorizontalWritingMode();
1107 const Cursor& iBeam = horizontalText ? iBeamCursor() : verticalTextCursor(); 1112 const Cursor& iBeam = horizontalText ? iBeamCursor() : verticalTextCursor();
1108 1113
1109 if (renderer) { 1114 if (renderer) {
1110 Cursor overrideCursor; 1115 Cursor overrideCursor;
1111 switch (renderer->getCursor(roundedIntPoint(event.localPoint()), overrid eCursor)) { 1116 switch (renderer->getCursor(roundedIntPoint(event.localPoint()), overrid eCursor)) {
1112 case SetCursorBasedOnStyle: 1117 case SetCursorBasedOnStyle:
1113 break; 1118 break;
1114 case SetCursor: 1119 case SetCursor:
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
1321 if (isPanScrollInProgress) { 1326 if (isPanScrollInProgress) {
1322 // We invalidate the click when exiting pan scrolling so that we don't i nadvertently navigate 1327 // We invalidate the click when exiting pan scrolling so that we don't i nadvertently navigate
1323 // away from the current page (e.g. the click was on a hyperlink). See < rdar://problem/6095023>. 1328 // away from the current page (e.g. the click was on a hyperlink). See < rdar://problem/6095023>.
1324 invalidateClick(); 1329 invalidateClick();
1325 return true; 1330 return true;
1326 } 1331 }
1327 #endif 1332 #endif
1328 1333
1329 m_clickCount = mouseEvent.clickCount(); 1334 m_clickCount = mouseEvent.clickCount();
1330 m_clickNode = mev.targetNode(); 1335 m_clickNode = mev.targetNode();
1336 RenderObject* clickRenderer = mev.hitTestResult().renderer();
1331 1337
1332 if (FrameView* view = m_frame->view()) { 1338 if (FrameView* view = m_frame->view()) {
1333 RenderLayer* layer = m_clickNode->renderer() ? m_clickNode->renderer()-> enclosingLayer() : 0; 1339 RenderLayer* layer = clickRenderer ? clickRenderer->enclosingLayer() : 0 ;
1334 IntPoint p = view->windowToContents(mouseEvent.position()); 1340 IntPoint p = view->windowToContents(mouseEvent.position());
1335 if (layer && layer->isPointInResizeControl(p, ResizerForPointer)) { 1341 if (layer && layer->isPointInResizeControl(p, ResizerForPointer)) {
1336 layer->setInResizeMode(true); 1342 layer->setInResizeMode(true);
1337 m_resizeLayer = layer; 1343 m_resizeLayer = layer;
1338 m_offsetFromResizeCorner = layer->offsetFromResizeCorner(p); 1344 m_offsetFromResizeCorner = layer->offsetFromResizeCorner(p);
1339 invalidateClick(); 1345 invalidateClick();
1340 return true; 1346 return true;
1341 } 1347 }
1342 } 1348 }
1343 1349
(...skipping 2474 matching lines...) Expand 10 before | Expand all | Expand 10 after
3818 // the event via an EventTargetNode dispatch when this returns false. 3824 // the event via an EventTargetNode dispatch when this returns false.
3819 if (!widget->isFrameView()) 3825 if (!widget->isFrameView())
3820 return false; 3826 return false;
3821 3827
3822 return toFrameView(widget)->frame().eventHandler()->handleWheelEvent(wheelEv ent); 3828 return toFrameView(widget)->frame().eventHandler()->handleWheelEvent(wheelEv ent);
3823 } 3829 }
3824 3830
3825 bool EventHandler::passWidgetMouseDownEventToWidget(const MouseEventWithHitTestR esults& event) 3831 bool EventHandler::passWidgetMouseDownEventToWidget(const MouseEventWithHitTestR esults& event)
3826 { 3832 {
3827 // Figure out which view to send the event to. 3833 // Figure out which view to send the event to.
3828 if (!event.targetNode() || !event.targetNode()->renderer() || !event.targetN ode()->renderer()->isWidget()) 3834 if (!event.targetNode() || !event.hitTestResult().renderer() || !event.hitTe stResult().renderer()->isWidget())
3829 return false; 3835 return false;
3830 return false; 3836 return false;
3831 } 3837 }
3832 3838
3833 PassRefPtr<Clipboard> EventHandler::createDraggingClipboard() const 3839 PassRefPtr<Clipboard> EventHandler::createDraggingClipboard() const
3834 { 3840 {
3835 RefPtr<ChromiumDataObject> dataObject = ChromiumDataObject::create(); 3841 RefPtr<ChromiumDataObject> dataObject = ChromiumDataObject::create();
3836 return ClipboardChromium::create(Clipboard::DragAndDrop, dataObject.get(), C lipboardWritable, m_frame); 3842 return ClipboardChromium::create(Clipboard::DragAndDrop, dataObject.get(), C lipboardWritable, m_frame);
3837 } 3843 }
3838 3844
3839 void EventHandler::focusDocumentView() 3845 void EventHandler::focusDocumentView()
3840 { 3846 {
3841 Page* page = m_frame->page(); 3847 Page* page = m_frame->page();
3842 if (!page) 3848 if (!page)
3843 return; 3849 return;
3844 page->focusController().setFocusedFrame(m_frame); 3850 page->focusController().setFocusedFrame(m_frame);
3845 } 3851 }
3846 3852
3847 unsigned EventHandler::accessKeyModifiers() 3853 unsigned EventHandler::accessKeyModifiers()
3848 { 3854 {
3849 #if OS(MACOSX) 3855 #if OS(MACOSX)
3850 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; 3856 return PlatformEvent::CtrlKey | PlatformEvent::AltKey;
3851 #else 3857 #else
3852 return PlatformEvent::AltKey; 3858 return PlatformEvent::AltKey;
3853 #endif 3859 #endif
3854 } 3860 }
3855 3861
3856 } // namespace WebCore 3862 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698