mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-10-29 17:50:22 +00:00
Merge pull request #882 from github/obj_cpp
Updating Obj C++ PR so that it merges cleanly
This commit is contained in:
@@ -1246,8 +1246,14 @@ Objective-C:
|
||||
- obj-c
|
||||
- objc
|
||||
primary_extension: .m
|
||||
extensions:
|
||||
- .mm
|
||||
|
||||
Objective-C++:
|
||||
type: programming
|
||||
color: "#4886FC"
|
||||
aliases:
|
||||
- obj-c++
|
||||
- objc++
|
||||
primary_extension: .mm
|
||||
|
||||
Objective-J:
|
||||
type: programming
|
||||
|
||||
@@ -304,6 +304,9 @@
|
||||
".h",
|
||||
".m"
|
||||
],
|
||||
"Objective-C++": [
|
||||
".mm"
|
||||
],
|
||||
"OCaml": [
|
||||
".eliom",
|
||||
".ml"
|
||||
@@ -594,8 +597,8 @@
|
||||
".gemrc"
|
||||
]
|
||||
},
|
||||
"tokens_total": 517423,
|
||||
"languages_total": 632,
|
||||
"tokens_total": 523444,
|
||||
"languages_total": 634,
|
||||
"tokens": {
|
||||
"ABAP": {
|
||||
"*/**": 1,
|
||||
@@ -39455,6 +39458,756 @@
|
||||
"indexPathWithIndexes": 1,
|
||||
"indexAtPosition": 2
|
||||
},
|
||||
"Objective-C++": {
|
||||
"#include": 26,
|
||||
"<objc/objc-runtime.h>": 1,
|
||||
"<wtf/StdLibExtras.h>": 1,
|
||||
"#if": 10,
|
||||
"(": 612,
|
||||
"defined": 1,
|
||||
"OBJC_API_VERSION": 2,
|
||||
")": 610,
|
||||
"&&": 12,
|
||||
"static": 16,
|
||||
"inline": 3,
|
||||
"IMP": 4,
|
||||
"method_setImplementation": 2,
|
||||
"Method": 2,
|
||||
"m": 3,
|
||||
"i": 29,
|
||||
"{": 151,
|
||||
"oi": 2,
|
||||
"-": 175,
|
||||
"method_imp": 2,
|
||||
";": 494,
|
||||
"return": 149,
|
||||
"}": 148,
|
||||
"#endif": 19,
|
||||
"namespace": 1,
|
||||
"WebCore": 1,
|
||||
"ENABLE": 10,
|
||||
"DRAG_SUPPORT": 7,
|
||||
"const": 16,
|
||||
"double": 1,
|
||||
"EventHandler": 30,
|
||||
"TextDragDelay": 1,
|
||||
"RetainPtr": 4,
|
||||
"<NSEvent>": 4,
|
||||
"&": 21,
|
||||
"currentNSEventSlot": 6,
|
||||
"DEFINE_STATIC_LOCAL": 1,
|
||||
"event": 30,
|
||||
"NSEvent": 21,
|
||||
"*EventHandler": 2,
|
||||
"currentNSEvent": 13,
|
||||
".get": 1,
|
||||
"class": 14,
|
||||
"CurrentEventScope": 14,
|
||||
"WTF_MAKE_NONCOPYABLE": 1,
|
||||
"public": 1,
|
||||
"*": 34,
|
||||
"private": 1,
|
||||
"m_savedCurrentEvent": 3,
|
||||
"#ifndef": 3,
|
||||
"NDEBUG": 2,
|
||||
"m_event": 3,
|
||||
"*event": 11,
|
||||
"ASSERT": 13,
|
||||
"bool": 26,
|
||||
"wheelEvent": 5,
|
||||
"Page*": 7,
|
||||
"page": 33,
|
||||
"m_frame": 24,
|
||||
"if": 104,
|
||||
"false": 40,
|
||||
"scope": 6,
|
||||
"PlatformWheelEvent": 2,
|
||||
"chrome": 8,
|
||||
"platformPageClient": 4,
|
||||
"handleWheelEvent": 2,
|
||||
"wheelEvent.isAccepted": 1,
|
||||
"PassRefPtr": 2,
|
||||
"<KeyboardEvent>": 1,
|
||||
"currentKeyboardEvent": 1,
|
||||
"[": 268,
|
||||
"NSApp": 5,
|
||||
"currentEvent": 2,
|
||||
"]": 266,
|
||||
"switch": 4,
|
||||
"type": 10,
|
||||
"case": 25,
|
||||
"NSKeyDown": 4,
|
||||
"PlatformKeyboardEvent": 6,
|
||||
"platformEvent": 2,
|
||||
"platformEvent.disambiguateKeyDownEvent": 1,
|
||||
"RawKeyDown": 1,
|
||||
"KeyboardEvent": 2,
|
||||
"create": 3,
|
||||
"document": 6,
|
||||
"defaultView": 2,
|
||||
"NSKeyUp": 3,
|
||||
"default": 3,
|
||||
"keyEvent": 2,
|
||||
"BEGIN_BLOCK_OBJC_EXCEPTIONS": 13,
|
||||
"||": 18,
|
||||
"END_BLOCK_OBJC_EXCEPTIONS": 13,
|
||||
"void": 18,
|
||||
"focusDocumentView": 1,
|
||||
"FrameView*": 7,
|
||||
"frameView": 4,
|
||||
"view": 28,
|
||||
"NSView": 14,
|
||||
"*documentView": 1,
|
||||
"documentView": 2,
|
||||
"focusNSView": 1,
|
||||
"focusController": 1,
|
||||
"setFocusedFrame": 1,
|
||||
"passWidgetMouseDownEventToWidget": 3,
|
||||
"MouseEventWithHitTestResults": 7,
|
||||
"RenderObject*": 2,
|
||||
"target": 6,
|
||||
"targetNode": 3,
|
||||
"renderer": 7,
|
||||
"isWidget": 2,
|
||||
"passMouseDownEventToWidget": 3,
|
||||
"toRenderWidget": 3,
|
||||
"widget": 18,
|
||||
"RenderWidget*": 1,
|
||||
"renderWidget": 2,
|
||||
"lastEventIsMouseUp": 2,
|
||||
"*currentEventAfterHandlingMouseDown": 1,
|
||||
"currentEventAfterHandlingMouseDown": 3,
|
||||
"NSLeftMouseUp": 3,
|
||||
"timestamp": 8,
|
||||
"Widget*": 3,
|
||||
"pWidget": 2,
|
||||
"RefPtr": 1,
|
||||
"<Widget>": 1,
|
||||
"LOG_ERROR": 1,
|
||||
"true": 29,
|
||||
"platformWidget": 6,
|
||||
"*nodeView": 1,
|
||||
"nodeView": 9,
|
||||
"superview": 5,
|
||||
"*view": 4,
|
||||
"hitTest": 2,
|
||||
"convertPoint": 2,
|
||||
"locationInWindow": 4,
|
||||
"fromView": 3,
|
||||
"nil": 25,
|
||||
"client": 3,
|
||||
"firstResponder": 1,
|
||||
"clickCount": 8,
|
||||
"<=>": 1,
|
||||
"1": 1,
|
||||
"acceptsFirstResponder": 1,
|
||||
"needsPanelToBecomeKey": 1,
|
||||
"makeFirstResponder": 1,
|
||||
"wasDeferringLoading": 3,
|
||||
"defersLoading": 1,
|
||||
"setDefersLoading": 2,
|
||||
"m_sendingEventToSubview": 24,
|
||||
"*outerView": 1,
|
||||
"getOuterView": 1,
|
||||
"beforeMouseDown": 1,
|
||||
"outerView": 2,
|
||||
"widget.get": 2,
|
||||
"mouseDown": 2,
|
||||
"afterMouseDown": 1,
|
||||
"m_mouseDownView": 5,
|
||||
"m_mouseDownWasInSubframe": 7,
|
||||
"m_mousePressed": 2,
|
||||
"findViewInSubviews": 3,
|
||||
"*superview": 1,
|
||||
"*target": 1,
|
||||
"NSEnumerator": 1,
|
||||
"*e": 1,
|
||||
"subviews": 1,
|
||||
"objectEnumerator": 1,
|
||||
"*subview": 1,
|
||||
"while": 4,
|
||||
"subview": 3,
|
||||
"e": 1,
|
||||
"nextObject": 1,
|
||||
"mouseDownViewIfStillGood": 3,
|
||||
"*mouseDownView": 1,
|
||||
"mouseDownView": 3,
|
||||
"topFrameView": 3,
|
||||
"*topView": 1,
|
||||
"topView": 2,
|
||||
"eventLoopHandleMouseDragged": 1,
|
||||
"mouseDragged": 2,
|
||||
"//": 7,
|
||||
"eventLoopHandleMouseUp": 1,
|
||||
"mouseUp": 2,
|
||||
"passSubframeEventToSubframe": 4,
|
||||
"Frame*": 5,
|
||||
"subframe": 13,
|
||||
"HitTestResult*": 2,
|
||||
"hoveredNode": 5,
|
||||
"NSLeftMouseDragged": 1,
|
||||
"NSOtherMouseDragged": 1,
|
||||
"NSRightMouseDragged": 1,
|
||||
"dragController": 1,
|
||||
"didInitiateDrag": 1,
|
||||
"NSMouseMoved": 2,
|
||||
"eventHandler": 6,
|
||||
"handleMouseMoveEvent": 3,
|
||||
"currentPlatformMouseEvent": 8,
|
||||
"NSLeftMouseDown": 3,
|
||||
"Node*": 1,
|
||||
"node": 3,
|
||||
"isFrameView": 2,
|
||||
"handleMouseReleaseEvent": 3,
|
||||
"originalNSScrollViewScrollWheel": 4,
|
||||
"_nsScrollViewScrollWheelShouldRetainSelf": 3,
|
||||
"selfRetainingNSScrollViewScrollWheel": 3,
|
||||
"NSScrollView": 2,
|
||||
"SEL": 2,
|
||||
"nsScrollViewScrollWheelShouldRetainSelf": 2,
|
||||
"isMainThread": 3,
|
||||
"setNSScrollViewScrollWheelShouldRetainSelf": 3,
|
||||
"shouldRetain": 2,
|
||||
"method": 2,
|
||||
"class_getInstanceMethod": 1,
|
||||
"objc_getRequiredClass": 1,
|
||||
"@selector": 4,
|
||||
"scrollWheel": 2,
|
||||
"reinterpret_cast": 1,
|
||||
"<IMP>": 1,
|
||||
"*self": 1,
|
||||
"selector": 2,
|
||||
"shouldRetainSelf": 3,
|
||||
"self": 70,
|
||||
"retain": 1,
|
||||
"release": 1,
|
||||
"passWheelEventToWidget": 1,
|
||||
"NSView*": 1,
|
||||
"static_cast": 1,
|
||||
"<FrameView*>": 1,
|
||||
"frame": 3,
|
||||
"NSScrollWheel": 1,
|
||||
"v": 6,
|
||||
"loader": 1,
|
||||
"resetMultipleFormSubmissionProtection": 1,
|
||||
"handleMousePressEvent": 2,
|
||||
"int": 36,
|
||||
"%": 2,
|
||||
"handleMouseDoubleClickEvent": 1,
|
||||
"else": 11,
|
||||
"sendFakeEventsAfterWidgetTracking": 1,
|
||||
"*initiatingEvent": 1,
|
||||
"eventType": 5,
|
||||
"initiatingEvent": 22,
|
||||
"*fakeEvent": 1,
|
||||
"fakeEvent": 6,
|
||||
"mouseEventWithType": 2,
|
||||
"location": 3,
|
||||
"modifierFlags": 6,
|
||||
"windowNumber": 6,
|
||||
"context": 6,
|
||||
"eventNumber": 3,
|
||||
"pressure": 3,
|
||||
"postEvent": 3,
|
||||
"atStart": 3,
|
||||
"YES": 6,
|
||||
"keyEventWithType": 1,
|
||||
"characters": 3,
|
||||
"charactersIgnoringModifiers": 2,
|
||||
"isARepeat": 2,
|
||||
"keyCode": 2,
|
||||
"window": 1,
|
||||
"convertScreenToBase": 1,
|
||||
"mouseLocation": 1,
|
||||
"mouseMoved": 2,
|
||||
"frameHasPlatformWidget": 4,
|
||||
"passMousePressEventToSubframe": 1,
|
||||
"mev": 6,
|
||||
"mev.event": 3,
|
||||
"passMouseMoveEventToSubframe": 1,
|
||||
"m_mouseDownMayStartDrag": 1,
|
||||
"passMouseReleaseEventToSubframe": 1,
|
||||
"PlatformMouseEvent": 5,
|
||||
"*windowView": 1,
|
||||
"windowView": 2,
|
||||
"CONTEXT_MENUS": 2,
|
||||
"sendContextMenuEvent": 2,
|
||||
"eventMayStartDrag": 2,
|
||||
"eventActivatedView": 1,
|
||||
"m_activationEventNumber": 1,
|
||||
"event.eventNumber": 1,
|
||||
"<Clipboard>": 1,
|
||||
"createDraggingClipboard": 1,
|
||||
"NSPasteboard": 2,
|
||||
"*pasteboard": 1,
|
||||
"pasteboardWithName": 1,
|
||||
"NSDragPboard": 1,
|
||||
"pasteboard": 2,
|
||||
"declareTypes": 1,
|
||||
"NSArray": 3,
|
||||
"array": 2,
|
||||
"owner": 15,
|
||||
"ClipboardMac": 1,
|
||||
"Clipboard": 1,
|
||||
"DragAndDrop": 1,
|
||||
"ClipboardWritable": 1,
|
||||
"tabsToAllFormControls": 1,
|
||||
"KeyboardEvent*": 1,
|
||||
"KeyboardUIMode": 1,
|
||||
"keyboardUIMode": 5,
|
||||
"handlingOptionTab": 4,
|
||||
"isKeyboardOptionTab": 1,
|
||||
"KeyboardAccessTabsToLinks": 2,
|
||||
"KeyboardAccessFull": 1,
|
||||
"needsKeyboardEventDisambiguationQuirks": 2,
|
||||
"Document*": 1,
|
||||
"applicationIsSafari": 1,
|
||||
"url": 2,
|
||||
".protocolIs": 2,
|
||||
"Settings*": 1,
|
||||
"settings": 5,
|
||||
"DASHBOARD_SUPPORT": 1,
|
||||
"usesDashboardBackwardCompatibilityMode": 1,
|
||||
"unsigned": 2,
|
||||
"accessKeyModifiers": 1,
|
||||
"AXObjectCache": 1,
|
||||
"accessibilityEnhancedUserInterfaceEnabled": 1,
|
||||
"CtrlKey": 2,
|
||||
"|": 3,
|
||||
"AltKey": 1,
|
||||
"#import": 3,
|
||||
"<objc/runtime.h>": 1,
|
||||
"<sqlite3.h>": 1,
|
||||
"#ifdef": 6,
|
||||
"OODEBUG": 1,
|
||||
"#define": 1,
|
||||
"OODEBUG_SQL": 4,
|
||||
"OOOODatabase": 1,
|
||||
"OODB": 1,
|
||||
"NSString": 25,
|
||||
"*kOOObject": 1,
|
||||
"@": 28,
|
||||
"*kOOInsert": 1,
|
||||
"*kOOUpdate": 1,
|
||||
"*kOOExecSQL": 1,
|
||||
"#pragma": 5,
|
||||
"mark": 5,
|
||||
"OORecord": 3,
|
||||
"abstract": 1,
|
||||
"superclass": 1,
|
||||
"for": 14,
|
||||
"records": 1,
|
||||
"@implementation": 7,
|
||||
"+": 55,
|
||||
"id": 19,
|
||||
"record": 18,
|
||||
"OO_AUTORETURNS": 2,
|
||||
"OO_AUTORELEASE": 3,
|
||||
"alloc": 11,
|
||||
"init": 4,
|
||||
"insert": 7,
|
||||
"*record": 4,
|
||||
"insertWithParent": 1,
|
||||
"parent": 10,
|
||||
"OODatabase": 26,
|
||||
"sharedInstance": 37,
|
||||
"copyJoinKeysFrom": 1,
|
||||
"to": 6,
|
||||
"delete": 4,
|
||||
"update": 4,
|
||||
"indate": 4,
|
||||
"upsert": 4,
|
||||
"commit": 6,
|
||||
"rollback": 5,
|
||||
"setNilValueForKey": 1,
|
||||
"key": 2,
|
||||
"OOReference": 2,
|
||||
"<NSValue>": 1,
|
||||
"zeroForNull": 4,
|
||||
"NSNumber": 4,
|
||||
"numberWithInt": 1,
|
||||
"setValue": 1,
|
||||
"forKey": 1,
|
||||
"OOArray": 16,
|
||||
"<id>": 14,
|
||||
"select": 21,
|
||||
"intoClass": 11,
|
||||
"joinFrom": 10,
|
||||
"cOOString": 15,
|
||||
"sql": 21,
|
||||
"selectRecordsRelatedTo": 1,
|
||||
"importFrom": 1,
|
||||
"OOFile": 4,
|
||||
"file": 2,
|
||||
"delimiter": 4,
|
||||
"delim": 4,
|
||||
"rows": 2,
|
||||
"OOMetaData": 21,
|
||||
"import": 1,
|
||||
"file.string": 1,
|
||||
"insertArray": 3,
|
||||
"BOOL": 11,
|
||||
"exportTo": 1,
|
||||
"file.save": 1,
|
||||
"export": 1,
|
||||
"bindToView": 1,
|
||||
"OOView": 2,
|
||||
"delegate": 4,
|
||||
"bindRecord": 1,
|
||||
"toView": 1,
|
||||
"updateFromView": 1,
|
||||
"updateRecord": 1,
|
||||
"description": 6,
|
||||
"*metaData": 14,
|
||||
"metaDataForClass": 3,
|
||||
"hack": 1,
|
||||
"required": 2,
|
||||
"where": 1,
|
||||
"contains": 1,
|
||||
"a": 9,
|
||||
"field": 1,
|
||||
"avoid": 1,
|
||||
"recursion": 1,
|
||||
"OOStringArray": 6,
|
||||
"ivars": 5,
|
||||
"<<": 2,
|
||||
"metaData": 26,
|
||||
"encode": 3,
|
||||
"dictionaryWithValuesForKeys": 3,
|
||||
"@end": 14,
|
||||
"OOAdaptor": 6,
|
||||
"all": 3,
|
||||
"methods": 1,
|
||||
"by": 1,
|
||||
"objsql": 1,
|
||||
"access": 2,
|
||||
"database": 12,
|
||||
"@interface": 6,
|
||||
"NSObject": 1,
|
||||
"sqlite3": 1,
|
||||
"*db": 1,
|
||||
"sqlite3_stmt": 1,
|
||||
"*stmt": 1,
|
||||
"struct": 5,
|
||||
"_str_link": 5,
|
||||
"*next": 2,
|
||||
"char": 9,
|
||||
"str": 7,
|
||||
"*strs": 1,
|
||||
"OO_UNSAFE": 1,
|
||||
"*owner": 3,
|
||||
"initPath": 5,
|
||||
"path": 9,
|
||||
"prepare": 4,
|
||||
"bindCols": 5,
|
||||
"cOOStringArray": 3,
|
||||
"columns": 7,
|
||||
"values": 29,
|
||||
"cOOValueDictionary": 2,
|
||||
"startingAt": 5,
|
||||
"pno": 13,
|
||||
"bindNulls": 8,
|
||||
"bindResultsIntoInstancesOfClass": 4,
|
||||
"Class": 9,
|
||||
"recordClass": 16,
|
||||
"sqlite_int64": 2,
|
||||
"lastInsertRowID": 2,
|
||||
"NSData": 3,
|
||||
"OOExtras": 9,
|
||||
"initWithDescription": 1,
|
||||
"is": 2,
|
||||
"the": 5,
|
||||
"low": 1,
|
||||
"level": 1,
|
||||
"interface": 1,
|
||||
"particular": 2,
|
||||
"<OODatabase>": 1,
|
||||
"sharedInstanceForPath": 2,
|
||||
"OODocument": 1,
|
||||
".path": 1,
|
||||
"OONil": 1,
|
||||
"OO_RELEASE": 6,
|
||||
"exec": 10,
|
||||
"fmt": 9,
|
||||
"...": 3,
|
||||
"va_list": 3,
|
||||
"argp": 12,
|
||||
"va_start": 3,
|
||||
"*sql": 5,
|
||||
"initWithFormat": 3,
|
||||
"arguments": 3,
|
||||
"va_end": 3,
|
||||
"objects": 4,
|
||||
"deleteArray": 2,
|
||||
"object": 13,
|
||||
"commitTransaction": 3,
|
||||
"super": 3,
|
||||
"adaptor": 1,
|
||||
"registerSubclassesOf": 1,
|
||||
"recordSuperClass": 2,
|
||||
"numClasses": 5,
|
||||
"objc_getClassList": 2,
|
||||
"NULL": 4,
|
||||
"*classes": 2,
|
||||
"malloc": 2,
|
||||
"sizeof": 2,
|
||||
"<Class>": 1,
|
||||
"viewClasses": 4,
|
||||
"classNames": 4,
|
||||
"scan": 1,
|
||||
"registered": 2,
|
||||
"classes": 12,
|
||||
"relevant": 1,
|
||||
"subclasses": 1,
|
||||
"c": 14,
|
||||
"<": 5,
|
||||
"superClass": 5,
|
||||
"class_getName": 4,
|
||||
"class_getSuperclass": 1,
|
||||
"respondsToSelector": 2,
|
||||
"ooTableSql": 1,
|
||||
"tableMetaDataForClass": 8,
|
||||
"break": 6,
|
||||
"delay": 1,
|
||||
"creation": 1,
|
||||
"views": 1,
|
||||
"until": 1,
|
||||
"after": 1,
|
||||
"tables": 1,
|
||||
"<viewClasses>": 1,
|
||||
"in": 9,
|
||||
"order": 1,
|
||||
"free": 3,
|
||||
"Register": 1,
|
||||
"list": 1,
|
||||
"of": 2,
|
||||
"before": 1,
|
||||
"using": 2,
|
||||
"them": 2,
|
||||
"so": 2,
|
||||
"can": 1,
|
||||
"determine": 1,
|
||||
"relationships": 1,
|
||||
"between": 1,
|
||||
"registerTableClassesNamed": 1,
|
||||
"tableClass": 2,
|
||||
"NSBundle": 1,
|
||||
"mainBundle": 1,
|
||||
"classNamed": 1,
|
||||
"Send": 1,
|
||||
"any": 2,
|
||||
"SQL": 1,
|
||||
"Sql": 1,
|
||||
"format": 1,
|
||||
"string": 1,
|
||||
"escape": 1,
|
||||
"Any": 1,
|
||||
"results": 3,
|
||||
"returned": 1,
|
||||
"are": 1,
|
||||
"placed": 1,
|
||||
"as": 1,
|
||||
"an": 1,
|
||||
"dictionary": 1,
|
||||
"results.": 1,
|
||||
"*/": 1,
|
||||
"errcode": 12,
|
||||
"OOString": 6,
|
||||
"stringForSql": 2,
|
||||
"*aColumnName": 1,
|
||||
"**results": 1,
|
||||
"allKeys": 1,
|
||||
"objectAtIndex": 1,
|
||||
"OOValueDictionary": 5,
|
||||
"joinValues": 4,
|
||||
"sharedColumns": 5,
|
||||
"*parentMetaData": 1,
|
||||
"parentMetaData": 2,
|
||||
"naturalJoinTo": 1,
|
||||
"joinableColumns": 1,
|
||||
"whereClauseFor": 2,
|
||||
"qualifyNulls": 2,
|
||||
"NO": 3,
|
||||
"ooOrderBy": 2,
|
||||
"OOFormat": 5,
|
||||
"NSLog": 4,
|
||||
"*joinValues": 1,
|
||||
"*adaptor": 7,
|
||||
"<OOMetaData>": 1,
|
||||
"tablesRelatedByNaturalJoinFrom": 1,
|
||||
"tablesWithNaturalJoin": 5,
|
||||
"**tablesWithNaturalJoin": 1,
|
||||
"*childMetaData": 1,
|
||||
"tableMetaDataByClassName": 3,
|
||||
"prepareSql": 1,
|
||||
"toTable": 1,
|
||||
"childMetaData": 1,
|
||||
"OODictionary": 2,
|
||||
"<NSNumber>": 1,
|
||||
"tmpResults": 1,
|
||||
"kOOExecSQL": 1,
|
||||
"*exec": 2,
|
||||
"OOWarn": 9,
|
||||
"errmsg": 5,
|
||||
"continue": 3,
|
||||
"OORef": 2,
|
||||
"<NSObject>": 1,
|
||||
"*values": 3,
|
||||
"kOOObject": 3,
|
||||
"isInsert": 4,
|
||||
"kOOInsert": 1,
|
||||
"isUpdate": 5,
|
||||
"kOOUpdate": 2,
|
||||
"newValues": 3,
|
||||
"changedCols": 4,
|
||||
"*name": 4,
|
||||
"*newValues": 1,
|
||||
"name": 9,
|
||||
"isEqual": 1,
|
||||
"tableName": 4,
|
||||
"columns/": 1,
|
||||
"nchanged": 4,
|
||||
"*object": 1,
|
||||
"lastSQL": 4,
|
||||
"**changedCols": 1,
|
||||
"quote": 2,
|
||||
"commaQuote": 2,
|
||||
"<metaData->": 1,
|
||||
"commited": 2,
|
||||
"updateCount": 2,
|
||||
"transaction": 2,
|
||||
"updated": 2,
|
||||
"NSMutableDictionary": 1,
|
||||
"*d": 1,
|
||||
"*transaction": 1,
|
||||
"d": 2,
|
||||
"<OORecord>": 1,
|
||||
"OO_ARC": 1,
|
||||
"boxed": 1,
|
||||
"valueForKey": 1,
|
||||
"pointerValue": 1,
|
||||
"setValuesForKeysWithDictionary": 2,
|
||||
"decode": 2,
|
||||
"count": 1,
|
||||
"className": 3,
|
||||
"createTableSQL": 2,
|
||||
"*idx": 1,
|
||||
"indexes": 1,
|
||||
"idx": 2,
|
||||
"implements": 1,
|
||||
".directory": 1,
|
||||
".mkdir": 1,
|
||||
"sqlite3_open": 1,
|
||||
"db": 8,
|
||||
"SQLITE_OK": 6,
|
||||
"*path": 1,
|
||||
"sqlite3_prepare_v2": 1,
|
||||
"stmt": 20,
|
||||
"sqlite3_errmsg": 3,
|
||||
"bindValue": 2,
|
||||
"value": 26,
|
||||
"asParameter": 2,
|
||||
"OODEBUG_BIND": 1,
|
||||
"OONull": 3,
|
||||
"sqlite3_bind_null": 1,
|
||||
"OOSQL_THREAD_SAFE_BUT_USES_MORE_MEMORY": 1,
|
||||
"isKindOfClass": 3,
|
||||
"sqlite3_bind_text": 2,
|
||||
"UTF8String": 1,
|
||||
"SQLITE_STATIC": 3,
|
||||
"#else": 1,
|
||||
"len": 4,
|
||||
"lengthOfBytesUsingEncoding": 1,
|
||||
"NSUTF8StringEncoding": 3,
|
||||
"*str": 2,
|
||||
"next": 3,
|
||||
"strs": 6,
|
||||
"getCString": 1,
|
||||
"maxLength": 1,
|
||||
"encoding": 2,
|
||||
"sqlite3_bind_blob": 1,
|
||||
"bytes": 5,
|
||||
"length": 4,
|
||||
"*type": 1,
|
||||
"objCType": 1,
|
||||
"sqlite3_bind_int": 1,
|
||||
"intValue": 3,
|
||||
"sqlite3_bind_int64": 1,
|
||||
"longLongValue": 1,
|
||||
"sqlite3_bind_double": 1,
|
||||
"doubleValue": 1,
|
||||
"*columns": 1,
|
||||
"valuesForNextRow": 2,
|
||||
"ncols": 2,
|
||||
"sqlite3_column_count": 1,
|
||||
"sqlite3_column_name": 1,
|
||||
"sqlite3_column_type": 2,
|
||||
"SQLITE_NULL": 1,
|
||||
"SQLITE_INTEGER": 1,
|
||||
"initWithLongLong": 1,
|
||||
"sqlite3_column_int64": 1,
|
||||
"SQLITE_FLOAT": 1,
|
||||
"initWithDouble": 1,
|
||||
"sqlite3_column_double": 1,
|
||||
"SQLITE_TEXT": 1,
|
||||
"*bytes": 2,
|
||||
"sqlite3_column_text": 1,
|
||||
"NSMutableString": 1,
|
||||
"initWithBytes": 2,
|
||||
"sqlite3_column_bytes": 2,
|
||||
"SQLITE_BLOB": 1,
|
||||
"sqlite3_column_blob": 1,
|
||||
"out": 4,
|
||||
"awakeFromDB": 4,
|
||||
"instancesRespondToSelector": 1,
|
||||
"sqlite3_step": 1,
|
||||
"SQLITE_ROW": 1,
|
||||
"SQLITE_DONE": 1,
|
||||
"out.alloc": 1,
|
||||
"sqlite3_changes": 1,
|
||||
"sqlite3_finalize": 1,
|
||||
"sqlite3_last_insert_rowid": 1,
|
||||
"dealloc": 1,
|
||||
"sqlite3_close": 1,
|
||||
"OO_DEALLOC": 1,
|
||||
"instances": 1,
|
||||
"represent": 1,
|
||||
"table": 1,
|
||||
"and": 2,
|
||||
"it": 2,
|
||||
"s": 2,
|
||||
"l": 1,
|
||||
"C": 1,
|
||||
"S": 1,
|
||||
"I": 1,
|
||||
"L": 1,
|
||||
"q": 1,
|
||||
"Q": 1,
|
||||
"f": 1,
|
||||
"_": 2,
|
||||
"tag": 1,
|
||||
"A": 2,
|
||||
"<'>": 1,
|
||||
"iptr": 4,
|
||||
"*optr": 1,
|
||||
"unhex": 2,
|
||||
"*iptr": 1,
|
||||
"*16": 1,
|
||||
"hex": 1,
|
||||
"initWithBytesNoCopy": 1,
|
||||
"optr": 1,
|
||||
"freeWhenDone": 1,
|
||||
"stringValue": 4,
|
||||
"charValue": 1,
|
||||
"shortValue": 1,
|
||||
"OOReplace": 2,
|
||||
"reformat": 4,
|
||||
"NSDictionary": 2,
|
||||
"__IPHONE_OS_VERSION_MIN_REQUIRED": 1,
|
||||
"UISwitch": 2,
|
||||
"text": 1,
|
||||
"self.on": 1
|
||||
},
|
||||
"OCaml": {
|
||||
"{": 11,
|
||||
"shared": 1,
|
||||
@@ -53312,6 +54065,7 @@
|
||||
"NSIS": 725,
|
||||
"Nu": 116,
|
||||
"Objective-C": 26518,
|
||||
"Objective-C++": 6021,
|
||||
"OCaml": 382,
|
||||
"Omgrofl": 57,
|
||||
"Opa": 28,
|
||||
@@ -53469,6 +54223,7 @@
|
||||
"NSIS": 2,
|
||||
"Nu": 2,
|
||||
"Objective-C": 19,
|
||||
"Objective-C++": 2,
|
||||
"OCaml": 2,
|
||||
"Omgrofl": 1,
|
||||
"Opa": 2,
|
||||
@@ -53535,5 +54290,5 @@
|
||||
"Xtend": 2,
|
||||
"YAML": 2
|
||||
},
|
||||
"md5": "a37b96a29c39d400ee3b98dabd43da4e"
|
||||
"md5": "856e1bcc53c067f8a7e56e6aa1563b0e"
|
||||
}
|
||||
778
samples/Objective-C++/EventHandlerMac.mm
Normal file
778
samples/Objective-C++/EventHandlerMac.mm
Normal file
@@ -0,0 +1,778 @@
|
||||
// grabbed from https://raw.github.com/AOKP/external_webkit/61b2fb934bdd3a5fea253e2de0bcf8a47a552333/Source/WebCore/page/mac/EventHandlerMac.mm
|
||||
|
||||
/*
|
||||
* Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "EventHandler.h"
|
||||
|
||||
#include "AXObjectCache.h"
|
||||
#include "BlockExceptions.h"
|
||||
#include "Chrome.h"
|
||||
#include "ChromeClient.h"
|
||||
#include "ClipboardMac.h"
|
||||
#include "DragController.h"
|
||||
#include "EventNames.h"
|
||||
#include "FocusController.h"
|
||||
#include "Frame.h"
|
||||
#include "FrameLoader.h"
|
||||
#include "FrameView.h"
|
||||
#include "KeyboardEvent.h"
|
||||
#include "MouseEventWithHitTestResults.h"
|
||||
#include "NotImplemented.h"
|
||||
#include "Page.h"
|
||||
#include "PlatformKeyboardEvent.h"
|
||||
#include "PlatformWheelEvent.h"
|
||||
#include "RenderWidget.h"
|
||||
#include "RuntimeApplicationChecks.h"
|
||||
#include "Scrollbar.h"
|
||||
#include "Settings.h"
|
||||
#include "WebCoreSystemInterface.h"
|
||||
#include <objc/objc-runtime.h>
|
||||
#include <wtf/StdLibExtras.h>
|
||||
|
||||
#if !(defined(OBJC_API_VERSION) && OBJC_API_VERSION > 0)
|
||||
static inline IMP method_setImplementation(Method m, IMP i)
|
||||
{
|
||||
IMP oi = m->method_imp;
|
||||
m->method_imp = i;
|
||||
return oi;
|
||||
}
|
||||
#endif
|
||||
|
||||
namespace WebCore {
|
||||
|
||||
#if ENABLE(DRAG_SUPPORT)
|
||||
const double EventHandler::TextDragDelay = 0.15;
|
||||
#endif
|
||||
|
||||
static RetainPtr<NSEvent>& currentNSEventSlot()
|
||||
{
|
||||
DEFINE_STATIC_LOCAL(RetainPtr<NSEvent>, event, ());
|
||||
return event;
|
||||
}
|
||||
|
||||
NSEvent *EventHandler::currentNSEvent()
|
||||
{
|
||||
return currentNSEventSlot().get();
|
||||
}
|
||||
|
||||
class CurrentEventScope {
|
||||
WTF_MAKE_NONCOPYABLE(CurrentEventScope);
|
||||
public:
|
||||
CurrentEventScope(NSEvent *);
|
||||
~CurrentEventScope();
|
||||
|
||||
private:
|
||||
RetainPtr<NSEvent> m_savedCurrentEvent;
|
||||
#ifndef NDEBUG
|
||||
RetainPtr<NSEvent> m_event;
|
||||
#endif
|
||||
};
|
||||
|
||||
inline CurrentEventScope::CurrentEventScope(NSEvent *event)
|
||||
: m_savedCurrentEvent(currentNSEventSlot())
|
||||
#ifndef NDEBUG
|
||||
, m_event(event)
|
||||
#endif
|
||||
{
|
||||
currentNSEventSlot() = event;
|
||||
}
|
||||
|
||||
inline CurrentEventScope::~CurrentEventScope()
|
||||
{
|
||||
ASSERT(currentNSEventSlot() == m_event);
|
||||
currentNSEventSlot() = m_savedCurrentEvent;
|
||||
}
|
||||
|
||||
bool EventHandler::wheelEvent(NSEvent *event)
|
||||
{
|
||||
Page* page = m_frame->page();
|
||||
if (!page)
|
||||
return false;
|
||||
|
||||
CurrentEventScope scope(event);
|
||||
|
||||
PlatformWheelEvent wheelEvent(event, page->chrome()->platformPageClient());
|
||||
handleWheelEvent(wheelEvent);
|
||||
|
||||
return wheelEvent.isAccepted();
|
||||
}
|
||||
|
||||
PassRefPtr<KeyboardEvent> EventHandler::currentKeyboardEvent() const
|
||||
{
|
||||
NSEvent *event = [NSApp currentEvent];
|
||||
if (!event)
|
||||
return 0;
|
||||
switch ([event type]) {
|
||||
case NSKeyDown: {
|
||||
PlatformKeyboardEvent platformEvent(event);
|
||||
platformEvent.disambiguateKeyDownEvent(PlatformKeyboardEvent::RawKeyDown);
|
||||
return KeyboardEvent::create(platformEvent, m_frame->document()->defaultView());
|
||||
}
|
||||
case NSKeyUp:
|
||||
return KeyboardEvent::create(event, m_frame->document()->defaultView());
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
bool EventHandler::keyEvent(NSEvent *event)
|
||||
{
|
||||
BEGIN_BLOCK_OBJC_EXCEPTIONS;
|
||||
|
||||
ASSERT([event type] == NSKeyDown || [event type] == NSKeyUp);
|
||||
|
||||
CurrentEventScope scope(event);
|
||||
return keyEvent(PlatformKeyboardEvent(event));
|
||||
|
||||
END_BLOCK_OBJC_EXCEPTIONS;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void EventHandler::focusDocumentView()
|
||||
{
|
||||
Page* page = m_frame->page();
|
||||
if (!page)
|
||||
return;
|
||||
|
||||
if (FrameView* frameView = m_frame->view()) {
|
||||
if (NSView *documentView = frameView->documentView())
|
||||
page->chrome()->focusNSView(documentView);
|
||||
}
|
||||
|
||||
page->focusController()->setFocusedFrame(m_frame);
|
||||
}
|
||||
|
||||
bool EventHandler::passWidgetMouseDownEventToWidget(const MouseEventWithHitTestResults& event)
|
||||
{
|
||||
// Figure out which view to send the event to.
|
||||
RenderObject* target = targetNode(event) ? targetNode(event)->renderer() : 0;
|
||||
if (!target || !target->isWidget())
|
||||
return false;
|
||||
|
||||
// Double-click events don't exist in Cocoa. Since passWidgetMouseDownEventToWidget will
|
||||
// just pass currentEvent down to the widget, we don't want to call it for events that
|
||||
// don't correspond to Cocoa events. The mousedown/ups will have already been passed on as
|
||||
// part of the pressed/released handling.
|
||||
return passMouseDownEventToWidget(toRenderWidget(target)->widget());
|
||||
}
|
||||
|
||||
bool EventHandler::passWidgetMouseDownEventToWidget(RenderWidget* renderWidget)
|
||||
{
|
||||
return passMouseDownEventToWidget(renderWidget->widget());
|
||||
}
|
||||
|
||||
static bool lastEventIsMouseUp()
|
||||
{
|
||||
// Many AppKit widgets run their own event loops and consume events while the mouse is down.
|
||||
// When they finish, currentEvent is the mouseUp that they exited on. We need to update
|
||||
// the WebCore state with this mouseUp, which we never saw. This method lets us detect
|
||||
// that state. Handling this was critical when we used AppKit widgets for form elements.
|
||||
// It's not clear in what cases this is helpful now -- it's possible it can be removed.
|
||||
|
||||
BEGIN_BLOCK_OBJC_EXCEPTIONS;
|
||||
NSEvent *currentEventAfterHandlingMouseDown = [NSApp currentEvent];
|
||||
return EventHandler::currentNSEvent() != currentEventAfterHandlingMouseDown
|
||||
&& [currentEventAfterHandlingMouseDown type] == NSLeftMouseUp
|
||||
&& [currentEventAfterHandlingMouseDown timestamp] >= [EventHandler::currentNSEvent() timestamp];
|
||||
END_BLOCK_OBJC_EXCEPTIONS;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool EventHandler::passMouseDownEventToWidget(Widget* pWidget)
|
||||
{
|
||||
// FIXME: This function always returns true. It should be changed either to return
|
||||
// false in some cases or the return value should be removed.
|
||||
|
||||
RefPtr<Widget> widget = pWidget;
|
||||
|
||||
if (!widget) {
|
||||
LOG_ERROR("hit a RenderWidget without a corresponding Widget, means a frame is half-constructed");
|
||||
return true;
|
||||
}
|
||||
|
||||
// In WebKit2 we will never have an NSView. Just return early and let the regular event handler machinery take care of
|
||||
// dispatching the event.
|
||||
if (!widget->platformWidget())
|
||||
return false;
|
||||
|
||||
BEGIN_BLOCK_OBJC_EXCEPTIONS;
|
||||
|
||||
NSView *nodeView = widget->platformWidget();
|
||||
ASSERT([nodeView superview]);
|
||||
NSView *view = [nodeView hitTest:[[nodeView superview] convertPoint:[currentNSEvent() locationInWindow] fromView:nil]];
|
||||
if (!view) {
|
||||
// We probably hit the border of a RenderWidget
|
||||
return true;
|
||||
}
|
||||
|
||||
Page* page = m_frame->page();
|
||||
if (!page)
|
||||
return true;
|
||||
|
||||
if (page->chrome()->client()->firstResponder() != view) {
|
||||
// Normally [NSWindow sendEvent:] handles setting the first responder.
|
||||
// But in our case, the event was sent to the view representing the entire web page.
|
||||
if ([currentNSEvent() clickCount] <= 1 && [view acceptsFirstResponder] && [view needsPanelToBecomeKey])
|
||||
page->chrome()->client()->makeFirstResponder(view);
|
||||
}
|
||||
|
||||
// We need to "defer loading" while tracking the mouse, because tearing down the
|
||||
// page while an AppKit control is tracking the mouse can cause a crash.
|
||||
|
||||
// FIXME: In theory, WebCore now tolerates tear-down while tracking the
|
||||
// mouse. We should confirm that, and then remove the deferrsLoading
|
||||
// hack entirely.
|
||||
|
||||
bool wasDeferringLoading = page->defersLoading();
|
||||
if (!wasDeferringLoading)
|
||||
page->setDefersLoading(true);
|
||||
|
||||
ASSERT(!m_sendingEventToSubview);
|
||||
m_sendingEventToSubview = true;
|
||||
NSView *outerView = widget->getOuterView();
|
||||
widget->beforeMouseDown(outerView, widget.get());
|
||||
[view mouseDown:currentNSEvent()];
|
||||
widget->afterMouseDown(outerView, widget.get());
|
||||
m_sendingEventToSubview = false;
|
||||
|
||||
if (!wasDeferringLoading)
|
||||
page->setDefersLoading(false);
|
||||
|
||||
// Remember which view we sent the event to, so we can direct the release event properly.
|
||||
m_mouseDownView = view;
|
||||
m_mouseDownWasInSubframe = false;
|
||||
|
||||
// Many AppKit widgets run their own event loops and consume events while the mouse is down.
|
||||
// When they finish, currentEvent is the mouseUp that they exited on. We need to update
|
||||
// the EventHandler state with this mouseUp, which we never saw.
|
||||
// If this event isn't a mouseUp, we assume that the mouseUp will be coming later. There
|
||||
// is a hole here if the widget consumes both the mouseUp and subsequent events.
|
||||
if (lastEventIsMouseUp())
|
||||
m_mousePressed = false;
|
||||
|
||||
END_BLOCK_OBJC_EXCEPTIONS;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Note that this does the same kind of check as [target isDescendantOf:superview].
|
||||
// There are two differences: This is a lot slower because it has to walk the whole
|
||||
// tree, and this works in cases where the target has already been deallocated.
|
||||
static bool findViewInSubviews(NSView *superview, NSView *target)
|
||||
{
|
||||
BEGIN_BLOCK_OBJC_EXCEPTIONS;
|
||||
NSEnumerator *e = [[superview subviews] objectEnumerator];
|
||||
NSView *subview;
|
||||
while ((subview = [e nextObject])) {
|
||||
if (subview == target || findViewInSubviews(subview, target)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
END_BLOCK_OBJC_EXCEPTIONS;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
NSView *EventHandler::mouseDownViewIfStillGood()
|
||||
{
|
||||
// Since we have no way of tracking the lifetime of m_mouseDownView, we have to assume that
|
||||
// it could be deallocated already. We search for it in our subview tree; if we don't find
|
||||
// it, we set it to nil.
|
||||
NSView *mouseDownView = m_mouseDownView;
|
||||
if (!mouseDownView) {
|
||||
return nil;
|
||||
}
|
||||
FrameView* topFrameView = m_frame->view();
|
||||
NSView *topView = topFrameView ? topFrameView->platformWidget() : nil;
|
||||
if (!topView || !findViewInSubviews(topView, mouseDownView)) {
|
||||
m_mouseDownView = nil;
|
||||
return nil;
|
||||
}
|
||||
return mouseDownView;
|
||||
}
|
||||
|
||||
#if ENABLE(DRAG_SUPPORT)
|
||||
bool EventHandler::eventLoopHandleMouseDragged(const MouseEventWithHitTestResults&)
|
||||
{
|
||||
NSView *view = mouseDownViewIfStillGood();
|
||||
|
||||
if (!view)
|
||||
return false;
|
||||
|
||||
if (!m_mouseDownWasInSubframe) {
|
||||
ASSERT(!m_sendingEventToSubview);
|
||||
m_sendingEventToSubview = true;
|
||||
BEGIN_BLOCK_OBJC_EXCEPTIONS;
|
||||
[view mouseDragged:currentNSEvent()];
|
||||
END_BLOCK_OBJC_EXCEPTIONS;
|
||||
m_sendingEventToSubview = false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
#endif // ENABLE(DRAG_SUPPORT)
|
||||
|
||||
bool EventHandler::eventLoopHandleMouseUp(const MouseEventWithHitTestResults&)
|
||||
{
|
||||
NSView *view = mouseDownViewIfStillGood();
|
||||
if (!view)
|
||||
return false;
|
||||
|
||||
if (!m_mouseDownWasInSubframe) {
|
||||
ASSERT(!m_sendingEventToSubview);
|
||||
m_sendingEventToSubview = true;
|
||||
BEGIN_BLOCK_OBJC_EXCEPTIONS;
|
||||
[view mouseUp:currentNSEvent()];
|
||||
END_BLOCK_OBJC_EXCEPTIONS;
|
||||
m_sendingEventToSubview = false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool EventHandler::passSubframeEventToSubframe(MouseEventWithHitTestResults& event, Frame* subframe, HitTestResult* hoveredNode)
|
||||
{
|
||||
BEGIN_BLOCK_OBJC_EXCEPTIONS;
|
||||
|
||||
switch ([currentNSEvent() type]) {
|
||||
case NSLeftMouseDragged:
|
||||
case NSOtherMouseDragged:
|
||||
case NSRightMouseDragged:
|
||||
// This check is bogus and results in <rdar://6813830>, but removing it breaks a number of
|
||||
// layout tests.
|
||||
if (!m_mouseDownWasInSubframe)
|
||||
return false;
|
||||
#if ENABLE(DRAG_SUPPORT)
|
||||
if (subframe->page()->dragController()->didInitiateDrag())
|
||||
return false;
|
||||
#endif
|
||||
case NSMouseMoved:
|
||||
// Since we're passing in currentNSEvent() here, we can call
|
||||
// handleMouseMoveEvent() directly, since the save/restore of
|
||||
// currentNSEvent() that mouseMoved() does would have no effect.
|
||||
ASSERT(!m_sendingEventToSubview);
|
||||
m_sendingEventToSubview = true;
|
||||
subframe->eventHandler()->handleMouseMoveEvent(currentPlatformMouseEvent(), hoveredNode);
|
||||
m_sendingEventToSubview = false;
|
||||
return true;
|
||||
|
||||
case NSLeftMouseDown: {
|
||||
Node* node = targetNode(event);
|
||||
if (!node)
|
||||
return false;
|
||||
RenderObject* renderer = node->renderer();
|
||||
if (!renderer || !renderer->isWidget())
|
||||
return false;
|
||||
Widget* widget = toRenderWidget(renderer)->widget();
|
||||
if (!widget || !widget->isFrameView())
|
||||
return false;
|
||||
if (!passWidgetMouseDownEventToWidget(toRenderWidget(renderer)))
|
||||
return false;
|
||||
m_mouseDownWasInSubframe = true;
|
||||
return true;
|
||||
}
|
||||
case NSLeftMouseUp: {
|
||||
if (!m_mouseDownWasInSubframe)
|
||||
return false;
|
||||
ASSERT(!m_sendingEventToSubview);
|
||||
m_sendingEventToSubview = true;
|
||||
subframe->eventHandler()->handleMouseReleaseEvent(currentPlatformMouseEvent());
|
||||
m_sendingEventToSubview = false;
|
||||
return true;
|
||||
}
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
END_BLOCK_OBJC_EXCEPTIONS;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static IMP originalNSScrollViewScrollWheel;
|
||||
static bool _nsScrollViewScrollWheelShouldRetainSelf;
|
||||
static void selfRetainingNSScrollViewScrollWheel(NSScrollView *, SEL, NSEvent *);
|
||||
|
||||
static bool nsScrollViewScrollWheelShouldRetainSelf()
|
||||
{
|
||||
ASSERT(isMainThread());
|
||||
|
||||
return _nsScrollViewScrollWheelShouldRetainSelf;
|
||||
}
|
||||
|
||||
static void setNSScrollViewScrollWheelShouldRetainSelf(bool shouldRetain)
|
||||
{
|
||||
ASSERT(isMainThread());
|
||||
|
||||
if (!originalNSScrollViewScrollWheel) {
|
||||
Method method = class_getInstanceMethod(objc_getRequiredClass("NSScrollView"), @selector(scrollWheel:));
|
||||
originalNSScrollViewScrollWheel = method_setImplementation(method, reinterpret_cast<IMP>(selfRetainingNSScrollViewScrollWheel));
|
||||
}
|
||||
|
||||
_nsScrollViewScrollWheelShouldRetainSelf = shouldRetain;
|
||||
}
|
||||
|
||||
static void selfRetainingNSScrollViewScrollWheel(NSScrollView *self, SEL selector, NSEvent *event)
|
||||
{
|
||||
bool shouldRetainSelf = isMainThread() && nsScrollViewScrollWheelShouldRetainSelf();
|
||||
|
||||
if (shouldRetainSelf)
|
||||
[self retain];
|
||||
originalNSScrollViewScrollWheel(self, selector, event);
|
||||
if (shouldRetainSelf)
|
||||
[self release];
|
||||
}
|
||||
|
||||
bool EventHandler::passWheelEventToWidget(PlatformWheelEvent& wheelEvent, Widget* widget)
|
||||
{
|
||||
BEGIN_BLOCK_OBJC_EXCEPTIONS;
|
||||
|
||||
if (!widget)
|
||||
return false;
|
||||
|
||||
NSView* nodeView = widget->platformWidget();
|
||||
if (!nodeView) {
|
||||
// WebKit2 code path.
|
||||
if (!widget->isFrameView())
|
||||
return false;
|
||||
|
||||
return static_cast<FrameView*>(widget)->frame()->eventHandler()->handleWheelEvent(wheelEvent);
|
||||
}
|
||||
|
||||
if ([currentNSEvent() type] != NSScrollWheel || m_sendingEventToSubview)
|
||||
return false;
|
||||
|
||||
ASSERT(nodeView);
|
||||
ASSERT([nodeView superview]);
|
||||
NSView *view = [nodeView hitTest:[[nodeView superview] convertPoint:[currentNSEvent() locationInWindow] fromView:nil]];
|
||||
if (!view)
|
||||
// We probably hit the border of a RenderWidget
|
||||
return false;
|
||||
|
||||
ASSERT(!m_sendingEventToSubview);
|
||||
m_sendingEventToSubview = true;
|
||||
// Work around <rdar://problem/6806810> which can cause -[NSScrollView scrollWheel:] to
|
||||
// crash if the NSScrollView is released during timer or network callback dispatch
|
||||
// in the nested tracking runloop that -[NSScrollView scrollWheel:] runs.
|
||||
setNSScrollViewScrollWheelShouldRetainSelf(true);
|
||||
[view scrollWheel:currentNSEvent()];
|
||||
setNSScrollViewScrollWheelShouldRetainSelf(false);
|
||||
m_sendingEventToSubview = false;
|
||||
return true;
|
||||
|
||||
END_BLOCK_OBJC_EXCEPTIONS;
|
||||
return false;
|
||||
}
|
||||
|
||||
void EventHandler::mouseDown(NSEvent *event)
|
||||
{
|
||||
FrameView* v = m_frame->view();
|
||||
if (!v || m_sendingEventToSubview)
|
||||
return;
|
||||
|
||||
BEGIN_BLOCK_OBJC_EXCEPTIONS;
|
||||
|
||||
m_frame->loader()->resetMultipleFormSubmissionProtection();
|
||||
|
||||
m_mouseDownView = nil;
|
||||
|
||||
CurrentEventScope scope(event);
|
||||
|
||||
handleMousePressEvent(currentPlatformMouseEvent());
|
||||
|
||||
END_BLOCK_OBJC_EXCEPTIONS;
|
||||
}
|
||||
|
||||
void EventHandler::mouseDragged(NSEvent *event)
|
||||
{
|
||||
FrameView* v = m_frame->view();
|
||||
if (!v || m_sendingEventToSubview)
|
||||
return;
|
||||
|
||||
BEGIN_BLOCK_OBJC_EXCEPTIONS;
|
||||
|
||||
CurrentEventScope scope(event);
|
||||
handleMouseMoveEvent(currentPlatformMouseEvent());
|
||||
|
||||
END_BLOCK_OBJC_EXCEPTIONS;
|
||||
}
|
||||
|
||||
void EventHandler::mouseUp(NSEvent *event)
|
||||
{
|
||||
FrameView* v = m_frame->view();
|
||||
if (!v || m_sendingEventToSubview)
|
||||
return;
|
||||
|
||||
BEGIN_BLOCK_OBJC_EXCEPTIONS;
|
||||
|
||||
CurrentEventScope scope(event);
|
||||
|
||||
// Our behavior here is a little different that Qt. Qt always sends
|
||||
// a mouse release event, even for a double click. To correct problems
|
||||
// in khtml's DOM click event handling we do not send a release here
|
||||
// for a double click. Instead we send that event from FrameView's
|
||||
// handleMouseDoubleClickEvent. Note also that the third click of
|
||||
// a triple click is treated as a single click, but the fourth is then
|
||||
// treated as another double click. Hence the "% 2" below.
|
||||
int clickCount = [event clickCount];
|
||||
if (clickCount > 0 && clickCount % 2 == 0)
|
||||
handleMouseDoubleClickEvent(currentPlatformMouseEvent());
|
||||
else
|
||||
handleMouseReleaseEvent(currentPlatformMouseEvent());
|
||||
|
||||
m_mouseDownView = nil;
|
||||
|
||||
END_BLOCK_OBJC_EXCEPTIONS;
|
||||
}
|
||||
|
||||
/*
|
||||
A hack for the benefit of AK's PopUpButton, which uses the Carbon menu manager, which thus
|
||||
eats all subsequent events after it is starts its modal tracking loop. After the interaction
|
||||
is done, this routine is used to fix things up. When a mouse down started us tracking in
|
||||
the widget, we post a fake mouse up to balance the mouse down we started with. When a
|
||||
key down started us tracking in the widget, we post a fake key up to balance things out.
|
||||
In addition, we post a fake mouseMoved to get the cursor in sync with whatever we happen to
|
||||
be over after the tracking is done.
|
||||
*/
|
||||
void EventHandler::sendFakeEventsAfterWidgetTracking(NSEvent *initiatingEvent)
|
||||
{
|
||||
FrameView* view = m_frame->view();
|
||||
if (!view)
|
||||
return;
|
||||
|
||||
BEGIN_BLOCK_OBJC_EXCEPTIONS;
|
||||
|
||||
m_sendingEventToSubview = false;
|
||||
int eventType = [initiatingEvent type];
|
||||
if (eventType == NSLeftMouseDown || eventType == NSKeyDown) {
|
||||
NSEvent *fakeEvent = nil;
|
||||
if (eventType == NSLeftMouseDown) {
|
||||
fakeEvent = [NSEvent mouseEventWithType:NSLeftMouseUp
|
||||
location:[initiatingEvent locationInWindow]
|
||||
modifierFlags:[initiatingEvent modifierFlags]
|
||||
timestamp:[initiatingEvent timestamp]
|
||||
windowNumber:[initiatingEvent windowNumber]
|
||||
context:[initiatingEvent context]
|
||||
eventNumber:[initiatingEvent eventNumber]
|
||||
clickCount:[initiatingEvent clickCount]
|
||||
pressure:[initiatingEvent pressure]];
|
||||
|
||||
[NSApp postEvent:fakeEvent atStart:YES];
|
||||
} else { // eventType == NSKeyDown
|
||||
fakeEvent = [NSEvent keyEventWithType:NSKeyUp
|
||||
location:[initiatingEvent locationInWindow]
|
||||
modifierFlags:[initiatingEvent modifierFlags]
|
||||
timestamp:[initiatingEvent timestamp]
|
||||
windowNumber:[initiatingEvent windowNumber]
|
||||
context:[initiatingEvent context]
|
||||
characters:[initiatingEvent characters]
|
||||
charactersIgnoringModifiers:[initiatingEvent charactersIgnoringModifiers]
|
||||
isARepeat:[initiatingEvent isARepeat]
|
||||
keyCode:[initiatingEvent keyCode]];
|
||||
[NSApp postEvent:fakeEvent atStart:YES];
|
||||
}
|
||||
// FIXME: We should really get the current modifierFlags here, but there's no way to poll
|
||||
// them in Cocoa, and because the event stream was stolen by the Carbon menu code we have
|
||||
// no up-to-date cache of them anywhere.
|
||||
fakeEvent = [NSEvent mouseEventWithType:NSMouseMoved
|
||||
location:[[view->platformWidget() window] convertScreenToBase:[NSEvent mouseLocation]]
|
||||
modifierFlags:[initiatingEvent modifierFlags]
|
||||
timestamp:[initiatingEvent timestamp]
|
||||
windowNumber:[initiatingEvent windowNumber]
|
||||
context:[initiatingEvent context]
|
||||
eventNumber:0
|
||||
clickCount:0
|
||||
pressure:0];
|
||||
[NSApp postEvent:fakeEvent atStart:YES];
|
||||
}
|
||||
|
||||
END_BLOCK_OBJC_EXCEPTIONS;
|
||||
}
|
||||
|
||||
void EventHandler::mouseMoved(NSEvent *event)
|
||||
{
|
||||
// Reject a mouse moved if the button is down - screws up tracking during autoscroll
|
||||
// These happen because WebKit sometimes has to fake up moved events.
|
||||
if (!m_frame->view() || m_mousePressed || m_sendingEventToSubview)
|
||||
return;
|
||||
|
||||
BEGIN_BLOCK_OBJC_EXCEPTIONS;
|
||||
CurrentEventScope scope(event);
|
||||
mouseMoved(currentPlatformMouseEvent());
|
||||
END_BLOCK_OBJC_EXCEPTIONS;
|
||||
}
|
||||
|
||||
static bool frameHasPlatformWidget(Frame* frame)
|
||||
{
|
||||
if (FrameView* frameView = frame->view()) {
|
||||
if (frameView->platformWidget())
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool EventHandler::passMousePressEventToSubframe(MouseEventWithHitTestResults& mev, Frame* subframe)
|
||||
{
|
||||
// WebKit1 code path.
|
||||
if (frameHasPlatformWidget(m_frame))
|
||||
return passSubframeEventToSubframe(mev, subframe);
|
||||
|
||||
// WebKit2 code path.
|
||||
subframe->eventHandler()->handleMousePressEvent(mev.event());
|
||||
return true;
|
||||
}
|
||||
|
||||
bool EventHandler::passMouseMoveEventToSubframe(MouseEventWithHitTestResults& mev, Frame* subframe, HitTestResult* hoveredNode)
|
||||
{
|
||||
// WebKit1 code path.
|
||||
if (frameHasPlatformWidget(m_frame))
|
||||
return passSubframeEventToSubframe(mev, subframe, hoveredNode);
|
||||
|
||||
// WebKit2 code path.
|
||||
if (m_mouseDownMayStartDrag && !m_mouseDownWasInSubframe)
|
||||
return false;
|
||||
subframe->eventHandler()->handleMouseMoveEvent(mev.event(), hoveredNode);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool EventHandler::passMouseReleaseEventToSubframe(MouseEventWithHitTestResults& mev, Frame* subframe)
|
||||
{
|
||||
// WebKit1 code path.
|
||||
if (frameHasPlatformWidget(m_frame))
|
||||
return passSubframeEventToSubframe(mev, subframe);
|
||||
|
||||
// WebKit2 code path.
|
||||
subframe->eventHandler()->handleMouseReleaseEvent(mev.event());
|
||||
return true;
|
||||
}
|
||||
|
||||
PlatformMouseEvent EventHandler::currentPlatformMouseEvent() const
|
||||
{
|
||||
NSView *windowView = nil;
|
||||
if (Page* page = m_frame->page())
|
||||
windowView = page->chrome()->platformPageClient();
|
||||
return PlatformMouseEvent(currentNSEvent(), windowView);
|
||||
}
|
||||
|
||||
#if ENABLE(CONTEXT_MENUS)
|
||||
bool EventHandler::sendContextMenuEvent(NSEvent *event)
|
||||
{
|
||||
Page* page = m_frame->page();
|
||||
if (!page)
|
||||
return false;
|
||||
return sendContextMenuEvent(PlatformMouseEvent(event, page->chrome()->platformPageClient()));
|
||||
}
|
||||
#endif // ENABLE(CONTEXT_MENUS)
|
||||
|
||||
#if ENABLE(DRAG_SUPPORT)
|
||||
bool EventHandler::eventMayStartDrag(NSEvent *event)
|
||||
{
|
||||
Page* page = m_frame->page();
|
||||
if (!page)
|
||||
return false;
|
||||
return eventMayStartDrag(PlatformMouseEvent(event, page->chrome()->platformPageClient()));
|
||||
}
|
||||
#endif // ENABLE(DRAG_SUPPORT)
|
||||
|
||||
bool EventHandler::eventActivatedView(const PlatformMouseEvent& event) const
|
||||
{
|
||||
return m_activationEventNumber == event.eventNumber();
|
||||
}
|
||||
|
||||
#if ENABLE(DRAG_SUPPORT)
|
||||
|
||||
PassRefPtr<Clipboard> EventHandler::createDraggingClipboard() const
|
||||
{
|
||||
NSPasteboard *pasteboard = [NSPasteboard pasteboardWithName:NSDragPboard];
|
||||
// Must be done before ondragstart adds types and data to the pboard,
|
||||
// also done for security, as it erases data from the last drag
|
||||
[pasteboard declareTypes:[NSArray array] owner:nil];
|
||||
return ClipboardMac::create(Clipboard::DragAndDrop, pasteboard, ClipboardWritable, m_frame);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
bool EventHandler::tabsToAllFormControls(KeyboardEvent* event) const
|
||||
{
|
||||
Page* page = m_frame->page();
|
||||
if (!page)
|
||||
return false;
|
||||
|
||||
KeyboardUIMode keyboardUIMode = page->chrome()->client()->keyboardUIMode();
|
||||
bool handlingOptionTab = isKeyboardOptionTab(event);
|
||||
|
||||
// If tab-to-links is off, option-tab always highlights all controls
|
||||
if ((keyboardUIMode & KeyboardAccessTabsToLinks) == 0 && handlingOptionTab)
|
||||
return true;
|
||||
|
||||
// If system preferences say to include all controls, we always include all controls
|
||||
if (keyboardUIMode & KeyboardAccessFull)
|
||||
return true;
|
||||
|
||||
// Otherwise tab-to-links includes all controls, unless the sense is flipped via option-tab.
|
||||
if (keyboardUIMode & KeyboardAccessTabsToLinks)
|
||||
return !handlingOptionTab;
|
||||
|
||||
return handlingOptionTab;
|
||||
}
|
||||
|
||||
bool EventHandler::needsKeyboardEventDisambiguationQuirks() const
|
||||
{
|
||||
Document* document = m_frame->document();
|
||||
|
||||
// RSS view needs arrow key keypress events.
|
||||
if (applicationIsSafari() && (document->url().protocolIs("feed") || document->url().protocolIs("feeds")))
|
||||
return true;
|
||||
Settings* settings = m_frame->settings();
|
||||
if (!settings)
|
||||
return false;
|
||||
|
||||
#if ENABLE(DASHBOARD_SUPPORT)
|
||||
if (settings->usesDashboardBackwardCompatibilityMode())
|
||||
return true;
|
||||
#endif
|
||||
|
||||
if (settings->needsKeyboardEventDisambiguationQuirks())
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
unsigned EventHandler::accessKeyModifiers()
|
||||
{
|
||||
// Control+Option key combinations are usually unused on Mac OS X, but not when VoiceOver is enabled.
|
||||
// So, we use Control in this case, even though it conflicts with Emacs-style key bindings.
|
||||
// See <https://bugs.webkit.org/show_bug.cgi?id=21107> for more detail.
|
||||
if (AXObjectCache::accessibilityEnhancedUserInterfaceEnabled())
|
||||
return PlatformKeyboardEvent::CtrlKey;
|
||||
|
||||
return PlatformKeyboardEvent::CtrlKey | PlatformKeyboardEvent::AltKey;
|
||||
}
|
||||
|
||||
}
|
||||
1372
samples/Objective-C++/objsql.mm
Normal file
1372
samples/Objective-C++/objsql.mm
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user