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

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

Issue 224113002: Oilpan: move Range object to the oilpan heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Use STACK_ALLOCATED() + incorporate ager's overview of macros in this area. Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 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 525 matching lines...) Expand 10 before | Expand all | Expand 10 after
536 if (pos.isNotNull()) { 536 if (pos.isNotNull()) {
537 newSelection = VisibleSelection(pos); 537 newSelection = VisibleSelection(pos);
538 newSelection.expandUsingGranularity(ParagraphGranularity); 538 newSelection.expandUsingGranularity(ParagraphGranularity);
539 } 539 }
540 540
541 return updateSelectionForMouseDownDispatchingSelectStart(innerNode, expandSe lectionToRespectUserSelectAll(innerNode, newSelection), ParagraphGranularity); 541 return updateSelectionForMouseDownDispatchingSelectStart(innerNode, expandSe lectionToRespectUserSelectAll(innerNode, newSelection), ParagraphGranularity);
542 } 542 }
543 543
544 static int textDistance(const Position& start, const Position& end) 544 static int textDistance(const Position& start, const Position& end)
545 { 545 {
546 RefPtr<Range> range = Range::create(*start.document(), start, end); 546 RefPtrWillBeRawPtr<Range> range = Range::create(*start.document(), start, en d);
547 return TextIterator::rangeLength(range.get(), true); 547 return TextIterator::rangeLength(range.get(), true);
548 } 548 }
549 549
550 bool EventHandler::handleMousePressEventSingleClick(const MouseEventWithHitTestR esults& event) 550 bool EventHandler::handleMousePressEventSingleClick(const MouseEventWithHitTestR esults& event)
551 { 551 {
552 TRACE_EVENT0("webkit", "EventHandler::handleMousePressEventSingleClick"); 552 TRACE_EVENT0("webkit", "EventHandler::handleMousePressEventSingleClick");
553 553
554 m_frame->document()->updateLayoutIgnorePendingStylesheets(); 554 m_frame->document()->updateLayoutIgnorePendingStylesheets();
555 Node* innerNode = event.targetNode(); 555 Node* innerNode = event.targetNode();
556 if (!(innerNode && innerNode->renderer() && m_mouseDownMayStartSelect)) 556 if (!(innerNode && innerNode->renderer() && m_mouseDownMayStartSelect))
(...skipping 2272 matching lines...) Expand 10 before | Expand all | Expand 10 after
2829 int rightAligned = 0; 2829 int rightAligned = 0;
2830 #endif 2830 #endif
2831 IntPoint location; 2831 IntPoint location;
2832 2832
2833 Element* focusedElement = doc->focusedElement(); 2833 Element* focusedElement = doc->focusedElement();
2834 FrameSelection& selection = m_frame->selection(); 2834 FrameSelection& selection = m_frame->selection();
2835 Position start = selection.selection().start(); 2835 Position start = selection.selection().start();
2836 bool shouldTranslateToRootView = true; 2836 bool shouldTranslateToRootView = true;
2837 2837
2838 if (start.deprecatedNode() && (selection.rootEditableElement() || selection. isRange())) { 2838 if (start.deprecatedNode() && (selection.rootEditableElement() || selection. isRange())) {
2839 RefPtr<Range> selectionRange = selection.toNormalizedRange(); 2839 RefPtrWillBeRawPtr<Range> selectionRange = selection.toNormalizedRange() ;
2840 IntRect firstRect = m_frame->editor().firstRectForRange(selectionRange.g et()); 2840 IntRect firstRect = m_frame->editor().firstRectForRange(selectionRange.g et());
2841 2841
2842 int x = rightAligned ? firstRect.maxX() : firstRect.x(); 2842 int x = rightAligned ? firstRect.maxX() : firstRect.x();
2843 // In a multiline edit, firstRect.maxY() would endup on the next line, s o -1. 2843 // In a multiline edit, firstRect.maxY() would endup on the next line, s o -1.
2844 int y = firstRect.maxY() ? firstRect.maxY() - 1 : 0; 2844 int y = firstRect.maxY() ? firstRect.maxY() - 1 : 0;
2845 location = IntPoint(x, y); 2845 location = IntPoint(x, y);
2846 } else if (focusedElement) { 2846 } else if (focusedElement) {
2847 RenderBoxModelObject* box = focusedElement->renderBoxModelObject(); 2847 RenderBoxModelObject* box = focusedElement->renderBoxModelObject();
2848 if (!box) 2848 if (!box)
2849 return false; 2849 return false;
(...skipping 1192 matching lines...) Expand 10 before | Expand all | Expand 10 after
4042 unsigned EventHandler::accessKeyModifiers() 4042 unsigned EventHandler::accessKeyModifiers()
4043 { 4043 {
4044 #if OS(MACOSX) 4044 #if OS(MACOSX)
4045 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; 4045 return PlatformEvent::CtrlKey | PlatformEvent::AltKey;
4046 #else 4046 #else
4047 return PlatformEvent::AltKey; 4047 return PlatformEvent::AltKey;
4048 #endif 4048 #endif
4049 } 4049 }
4050 4050
4051 } // namespace WebCore 4051 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698