1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
|
/*
* Copyright (C) 2006, 2007 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.
*/
#ifndef WebView_H
#define WebView_H
#include "COMPtr.h"
#include "WebKit.h"
#include "WebFrame.h"
#include "WebPreferences.h"
#include <WebCore/IntRect.h>
#include <WebCore/Timer.h>
#include <WebCore/WindowMessageListener.h>
#include <wtf/HashSet.h>
#include <wtf/OwnPtr.h>
class WebFrame;
class WebBackForwardList;
class WebInspector;
class WebInspectorClient;
WebView* kit(WebCore::Page*);
WebCore::Page* core(IWebView*);
interface IDropTargetHelper;
class WebView
: public IWebView
, public IWebViewPrivate
, public IWebIBActions
, public IWebViewCSS
, public IWebViewEditing
, public IWebViewUndoableEditing
, public IWebViewEditingActions
, public IWebNotificationObserver
, public IDropTarget
, WebCore::WindowMessageListener
{
public:
static WebView* createInstance();
protected:
WebView();
~WebView();
public:
// IUnknown
virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
virtual ULONG STDMETHODCALLTYPE AddRef(void);
virtual ULONG STDMETHODCALLTYPE Release(void);
// IWebView
virtual HRESULT STDMETHODCALLTYPE canShowMIMEType(
/* [in] */ BSTR mimeType,
/* [retval][out] */ BOOL *canShow);
virtual HRESULT STDMETHODCALLTYPE canShowMIMETypeAsHTML(
/* [in] */ BSTR mimeType,
/* [retval][out] */ BOOL *canShow);
virtual HRESULT STDMETHODCALLTYPE MIMETypesShownAsHTML(
/* [retval][out] */ IEnumVARIANT **enumVariant);
virtual HRESULT STDMETHODCALLTYPE setMIMETypesShownAsHTML(
/* [size_is][in] */ BSTR *mimeTypes,
/* [in] */ int cMimeTypes);
virtual HRESULT STDMETHODCALLTYPE URLFromPasteboard(
/* [in] */ IDataObject *pasteboard,
/* [retval][out] */ BSTR *url);
virtual HRESULT STDMETHODCALLTYPE URLTitleFromPasteboard(
/* [in] */ IDataObject *pasteboard,
/* [retval][out] */ BSTR *urlTitle);
virtual HRESULT STDMETHODCALLTYPE initWithFrame(
/* [in] */ RECT frame,
/* [in] */ BSTR frameName,
/* [in] */ BSTR groupName);
virtual HRESULT STDMETHODCALLTYPE setUIDelegate(
/* [in] */ IWebUIDelegate *d);
virtual HRESULT STDMETHODCALLTYPE uiDelegate(
/* [out][retval] */ IWebUIDelegate **d);
virtual HRESULT STDMETHODCALLTYPE setResourceLoadDelegate(
/* [in] */ IWebResourceLoadDelegate *d);
virtual HRESULT STDMETHODCALLTYPE resourceLoadDelegate(
/* [out][retval] */ IWebResourceLoadDelegate **d);
virtual HRESULT STDMETHODCALLTYPE setDownloadDelegate(
/* [in] */ IWebDownloadDelegate *d);
virtual HRESULT STDMETHODCALLTYPE downloadDelegate(
/* [out][retval] */ IWebDownloadDelegate **d);
virtual HRESULT STDMETHODCALLTYPE setFrameLoadDelegate(
/* [in] */ IWebFrameLoadDelegate *d);
virtual HRESULT STDMETHODCALLTYPE frameLoadDelegate(
/* [out][retval] */ IWebFrameLoadDelegate **d);
virtual HRESULT STDMETHODCALLTYPE setPolicyDelegate(
/* [in] */ IWebPolicyDelegate *d);
virtual HRESULT STDMETHODCALLTYPE policyDelegate(
/* [out][retval] */ IWebPolicyDelegate **d);
virtual HRESULT STDMETHODCALLTYPE mainFrame(
/* [out][retval] */ IWebFrame **frame);
virtual HRESULT STDMETHODCALLTYPE focusedFrame(
/* [out][retval] */ IWebFrame **frame);
virtual HRESULT STDMETHODCALLTYPE backForwardList(
/* [out][retval] */ IWebBackForwardList **list);
virtual HRESULT STDMETHODCALLTYPE setMaintainsBackForwardList(
/* [in] */ BOOL flag);
virtual HRESULT STDMETHODCALLTYPE goBack(
/* [retval][out] */ BOOL *succeeded);
virtual HRESULT STDMETHODCALLTYPE goForward(
/* [retval][out] */ BOOL *succeeded);
virtual HRESULT STDMETHODCALLTYPE goToBackForwardItem(
/* [in] */ IWebHistoryItem *item,
/* [retval][out] */ BOOL *succeeded);
virtual HRESULT STDMETHODCALLTYPE setTextSizeMultiplier(
/* [in] */ float multiplier);
virtual HRESULT STDMETHODCALLTYPE textSizeMultiplier(
/* [retval][out] */ float *multiplier);
virtual HRESULT STDMETHODCALLTYPE setApplicationNameForUserAgent(
/* [in] */ BSTR applicationName);
virtual HRESULT STDMETHODCALLTYPE applicationNameForUserAgent(
/* [retval][out] */ BSTR *applicationName);
virtual HRESULT STDMETHODCALLTYPE setCustomUserAgent(
/* [in] */ BSTR userAgentString);
virtual HRESULT STDMETHODCALLTYPE customUserAgent(
/* [retval][out] */ BSTR *userAgentString);
virtual HRESULT STDMETHODCALLTYPE userAgentForURL(
/* [in] */ BSTR url,
/* [retval][out] */ BSTR *userAgent);
virtual HRESULT STDMETHODCALLTYPE supportsTextEncoding(
/* [retval][out] */ BOOL *supports);
virtual HRESULT STDMETHODCALLTYPE setCustomTextEncodingName(
/* [in] */ BSTR encodingName);
virtual HRESULT STDMETHODCALLTYPE customTextEncodingName(
/* [retval][out] */ BSTR *encodingName);
virtual HRESULT STDMETHODCALLTYPE setMediaStyle(
/* [in] */ BSTR media);
virtual HRESULT STDMETHODCALLTYPE mediaStyle(
/* [retval][out] */ BSTR *media);
virtual HRESULT STDMETHODCALLTYPE stringByEvaluatingJavaScriptFromString(
/* [in] */ BSTR script,
/* [retval][out] */ BSTR *result);
virtual HRESULT STDMETHODCALLTYPE windowScriptObject(
/* [retval][out] */ IWebScriptObject **webScriptObject);
virtual HRESULT STDMETHODCALLTYPE setPreferences(
/* [in] */ IWebPreferences *prefs);
virtual HRESULT STDMETHODCALLTYPE preferences(
/* [retval][out] */ IWebPreferences **prefs);
virtual HRESULT STDMETHODCALLTYPE setPreferencesIdentifier(
/* [in] */ BSTR anIdentifier);
virtual HRESULT STDMETHODCALLTYPE preferencesIdentifier(
/* [retval][out] */ BSTR *anIdentifier);
virtual HRESULT STDMETHODCALLTYPE setHostWindow(
/* [in] */ OLE_HANDLE window);
virtual HRESULT STDMETHODCALLTYPE hostWindow(
/* [retval][out] */ OLE_HANDLE *window);
virtual HRESULT STDMETHODCALLTYPE searchFor(
/* [in] */ BSTR str,
/* [in] */ BOOL forward,
/* [in] */ BOOL caseFlag,
/* [in] */ BOOL wrapFlag,
/* [retval][out] */ BOOL *found);
virtual HRESULT STDMETHODCALLTYPE registerViewClass(
/* [in] */ IWebDocumentView *view,
/* [in] */ IWebDocumentRepresentation *representation,
/* [in] */ BSTR forMIMEType);
virtual HRESULT STDMETHODCALLTYPE setGroupName(
/* [in] */ BSTR groupName);
virtual HRESULT STDMETHODCALLTYPE groupName(
/* [retval][out] */ BSTR *groupName);
virtual HRESULT STDMETHODCALLTYPE estimatedProgress(
/* [retval][out] */ double *estimatedProgress);
virtual HRESULT STDMETHODCALLTYPE isLoading(
/* [retval][out] */ BOOL *isLoading);
virtual HRESULT STDMETHODCALLTYPE elementAtPoint(
/* [in] */ LPPOINT point,
/* [retval][out] */ IPropertyBag **elementDictionary);
virtual HRESULT STDMETHODCALLTYPE pasteboardTypesForSelection(
/* [retval][out] */ IEnumVARIANT **enumVariant);
virtual HRESULT STDMETHODCALLTYPE writeSelectionWithPasteboardTypes(
/* [size_is][in] */ BSTR *types,
/* [in] */ int cTypes,
/* [in] */ IDataObject *pasteboard);
virtual HRESULT STDMETHODCALLTYPE pasteboardTypesForElement(
/* [in] */ IPropertyBag *elementDictionary,
/* [retval][out] */ IEnumVARIANT **enumVariant);
virtual HRESULT STDMETHODCALLTYPE writeElement(
/* [in] */ IPropertyBag *elementDictionary,
/* [size_is][in] */ BSTR *withPasteboardTypes,
/* [in] */ int cWithPasteboardTypes,
/* [in] */ IDataObject *pasteboard);
virtual HRESULT STDMETHODCALLTYPE selectedText(
/* [out, retval] */ BSTR* str);
virtual HRESULT STDMETHODCALLTYPE centerSelectionInVisibleArea(
/* [in] */ IUnknown* sender);
virtual HRESULT STDMETHODCALLTYPE moveDragCaretToPoint(
/* [in] */ LPPOINT point);
virtual HRESULT STDMETHODCALLTYPE removeDragCaret( void);
virtual HRESULT STDMETHODCALLTYPE setDrawsBackground(
/* [in] */ BOOL drawsBackground);
virtual HRESULT STDMETHODCALLTYPE drawsBackground(
/* [retval][out] */ BOOL *drawsBackground);
virtual HRESULT STDMETHODCALLTYPE setMainFrameURL(
/* [in] */ BSTR urlString);
virtual HRESULT STDMETHODCALLTYPE mainFrameURL(
/* [retval][out] */ BSTR *urlString);
virtual HRESULT STDMETHODCALLTYPE mainFrameDocument(
/* [retval][out] */ IDOMDocument **document);
virtual HRESULT STDMETHODCALLTYPE mainFrameTitle(
/* [retval][out] */ BSTR *title);
virtual HRESULT STDMETHODCALLTYPE mainFrameIcon(
/* [retval][out] */ OLE_HANDLE *hBitmap);
virtual HRESULT STDMETHODCALLTYPE registerURLSchemeAsLocal(
/* [in] */ BSTR scheme);
// IWebIBActions
virtual HRESULT STDMETHODCALLTYPE takeStringURLFrom(
/* [in] */ IUnknown *sender);
virtual HRESULT STDMETHODCALLTYPE stopLoading(
/* [in] */ IUnknown *sender);
virtual HRESULT STDMETHODCALLTYPE reload(
/* [in] */ IUnknown *sender);
virtual HRESULT STDMETHODCALLTYPE canGoBack(
/* [in] */ IUnknown *sender,
/* [retval][out] */ BOOL *result);
virtual HRESULT STDMETHODCALLTYPE goBack(
/* [in] */ IUnknown *sender);
virtual HRESULT STDMETHODCALLTYPE canGoForward(
/* [in] */ IUnknown *sender,
/* [retval][out] */ BOOL *result);
virtual HRESULT STDMETHODCALLTYPE goForward(
/* [in] */ IUnknown *sender);
virtual HRESULT STDMETHODCALLTYPE canMakeTextLarger(
/* [in] */ IUnknown *sender,
/* [retval][out] */ BOOL *result);
virtual HRESULT STDMETHODCALLTYPE makeTextLarger(
/* [in] */ IUnknown *sender);
virtual HRESULT STDMETHODCALLTYPE canMakeTextSmaller(
/* [in] */ IUnknown *sender,
/* [retval][out] */ BOOL *result);
virtual HRESULT STDMETHODCALLTYPE makeTextSmaller(
/* [in] */ IUnknown *sender);
virtual HRESULT STDMETHODCALLTYPE canMakeTextStandardSize(
/* [in] */ IUnknown *sender,
/* [retval][out] */ BOOL *result);
virtual HRESULT STDMETHODCALLTYPE makeTextStandardSize(
/* [in] */ IUnknown *sender);
virtual HRESULT STDMETHODCALLTYPE toggleContinuousSpellChecking(
/* [in] */ IUnknown *sender);
virtual HRESULT STDMETHODCALLTYPE toggleSmartInsertDelete(
/* [in] */ IUnknown *sender);
virtual HRESULT STDMETHODCALLTYPE toggleGrammarChecking(
/* [in] */ IUnknown *sender);
// IWebViewCSS
virtual HRESULT STDMETHODCALLTYPE computedStyleForElement(
/* [in] */ IDOMElement *element,
/* [in] */ BSTR pseudoElement,
/* [retval][out] */ IDOMCSSStyleDeclaration **style);
// IWebViewEditing
virtual HRESULT STDMETHODCALLTYPE editableDOMRangeForPoint(
/* [in] */ LPPOINT point,
/* [retval][out] */ IDOMRange **range);
virtual HRESULT STDMETHODCALLTYPE setSelectedDOMRange(
/* [in] */ IDOMRange *range,
/* [in] */ WebSelectionAffinity affinity);
virtual HRESULT STDMETHODCALLTYPE selectedDOMRange(
/* [retval][out] */ IDOMRange **range);
virtual HRESULT STDMETHODCALLTYPE selectionAffinity(
/* [retval][out][retval][out] */ WebSelectionAffinity *affinity);
virtual HRESULT STDMETHODCALLTYPE setEditable(
/* [in] */ BOOL flag);
virtual HRESULT STDMETHODCALLTYPE isEditable(
/* [retval][out] */ BOOL *isEditable);
virtual HRESULT STDMETHODCALLTYPE setTypingStyle(
/* [in] */ IDOMCSSStyleDeclaration *style);
virtual HRESULT STDMETHODCALLTYPE typingStyle(
/* [retval][out] */ IDOMCSSStyleDeclaration **style);
virtual HRESULT STDMETHODCALLTYPE setSmartInsertDeleteEnabled(
/* [in] */ BOOL flag);
virtual HRESULT STDMETHODCALLTYPE smartInsertDeleteEnabled(
/* [in] */ BOOL *enabled);
virtual HRESULT STDMETHODCALLTYPE setSelectTrailingWhitespaceEnabled(
/* [in] */ BOOL flag);
virtual HRESULT STDMETHODCALLTYPE isSelectTrailingWhitespaceEnabled(
/* [in] */ BOOL *enabled);
virtual HRESULT STDMETHODCALLTYPE setContinuousSpellCheckingEnabled(
/* [in] */ BOOL flag);
virtual HRESULT STDMETHODCALLTYPE isContinuousSpellCheckingEnabled(
/* [retval][out] */ BOOL *enabled);
virtual HRESULT STDMETHODCALLTYPE spellCheckerDocumentTag(
/* [retval][out] */ int *tag);
virtual HRESULT STDMETHODCALLTYPE undoManager(
/* [retval][out] */ IWebUndoManager **manager);
virtual HRESULT STDMETHODCALLTYPE setEditingDelegate(
/* [in] */ IWebEditingDelegate *d);
virtual HRESULT STDMETHODCALLTYPE editingDelegate(
/* [retval][out] */ IWebEditingDelegate **d);
virtual HRESULT STDMETHODCALLTYPE styleDeclarationWithText(
/* [in] */ BSTR text,
/* [retval][out] */ IDOMCSSStyleDeclaration **style);
virtual HRESULT STDMETHODCALLTYPE hasSelectedRange(
/* [retval][out] */ BOOL *hasSelectedRange);
virtual HRESULT STDMETHODCALLTYPE cutEnabled(
/* [retval][out] */ BOOL *enabled);
virtual HRESULT STDMETHODCALLTYPE copyEnabled(
/* [retval][out] */ BOOL *enabled);
virtual HRESULT STDMETHODCALLTYPE pasteEnabled(
/* [retval][out] */ BOOL *enabled);
virtual HRESULT STDMETHODCALLTYPE deleteEnabled(
/* [retval][out] */ BOOL *enabled);
virtual HRESULT STDMETHODCALLTYPE editingEnabled(
/* [retval][out] */ BOOL *enabled);
virtual HRESULT STDMETHODCALLTYPE isGrammarCheckingEnabled(
/* [retval][out] */ BOOL *enabled);
virtual HRESULT STDMETHODCALLTYPE setGrammarCheckingEnabled(
BOOL enabled);
virtual HRESULT STDMETHODCALLTYPE setPageSizeMultiplier(
/* [in] */ float multiplier);
virtual HRESULT STDMETHODCALLTYPE pageSizeMultiplier(
/* [retval][out] */ float *multiplier);
virtual HRESULT STDMETHODCALLTYPE canZoomPageIn(
/* [in] */ IUnknown *sender,
/* [retval][out] */ BOOL *result);
virtual HRESULT STDMETHODCALLTYPE zoomPageIn(
/* [in] */ IUnknown *sender);
virtual HRESULT STDMETHODCALLTYPE canZoomPageOut(
/* [in] */ IUnknown *sender,
/* [retval][out] */ BOOL *result);
virtual HRESULT STDMETHODCALLTYPE zoomPageOut(
/* [in] */ IUnknown *sender);
virtual HRESULT STDMETHODCALLTYPE canResetPageZoom(
/* [in] */ IUnknown *sender,
/* [retval][out] */ BOOL *result);
virtual HRESULT STDMETHODCALLTYPE resetPageZoom(
/* [in] */ IUnknown *sender);
// IWebViewUndoableEditing
virtual HRESULT STDMETHODCALLTYPE replaceSelectionWithNode(
/* [in] */ IDOMNode *node);
virtual HRESULT STDMETHODCALLTYPE replaceSelectionWithText(
/* [in] */ BSTR text);
virtual HRESULT STDMETHODCALLTYPE replaceSelectionWithMarkupString(
/* [in] */ BSTR markupString);
virtual HRESULT STDMETHODCALLTYPE replaceSelectionWithArchive(
/* [in] */ IWebArchive *archive);
virtual HRESULT STDMETHODCALLTYPE deleteSelection( void);
virtual HRESULT STDMETHODCALLTYPE clearSelection(void);
virtual HRESULT STDMETHODCALLTYPE applyStyle(
/* [in] */ IDOMCSSStyleDeclaration *style);
// IWebViewEditingActions
virtual HRESULT STDMETHODCALLTYPE copy(
/* [in] */ IUnknown *sender);
virtual HRESULT STDMETHODCALLTYPE cut(
/* [in] */ IUnknown *sender);
virtual HRESULT STDMETHODCALLTYPE paste(
/* [in] */ IUnknown *sender);
virtual HRESULT STDMETHODCALLTYPE copyURL(
/* [in] */ BSTR url);
virtual HRESULT STDMETHODCALLTYPE copyFont(
/* [in] */ IUnknown *sender);
virtual HRESULT STDMETHODCALLTYPE pasteFont(
/* [in] */ IUnknown *sender);
virtual HRESULT STDMETHODCALLTYPE delete_(
/* [in] */ IUnknown *sender);
virtual HRESULT STDMETHODCALLTYPE pasteAsPlainText(
/* [in] */ IUnknown *sender);
virtual HRESULT STDMETHODCALLTYPE pasteAsRichText(
/* [in] */ IUnknown *sender);
virtual HRESULT STDMETHODCALLTYPE changeFont(
/* [in] */ IUnknown *sender);
virtual HRESULT STDMETHODCALLTYPE changeAttributes(
/* [in] */ IUnknown *sender);
virtual HRESULT STDMETHODCALLTYPE changeDocumentBackgroundColor(
/* [in] */ IUnknown *sender);
virtual HRESULT STDMETHODCALLTYPE changeColor(
/* [in] */ IUnknown *sender);
virtual HRESULT STDMETHODCALLTYPE alignCenter(
/* [in] */ IUnknown *sender);
virtual HRESULT STDMETHODCALLTYPE alignJustified(
/* [in] */ IUnknown *sender);
virtual HRESULT STDMETHODCALLTYPE alignLeft(
/* [in] */ IUnknown *sender);
virtual HRESULT STDMETHODCALLTYPE alignRight(
/* [in] */ IUnknown *sender);
virtual HRESULT STDMETHODCALLTYPE checkSpelling(
/* [in] */ IUnknown *sender);
virtual HRESULT STDMETHODCALLTYPE showGuessPanel(
/* [in] */ IUnknown *sender);
virtual HRESULT STDMETHODCALLTYPE performFindPanelAction(
/* [in] */ IUnknown *sender);
virtual HRESULT STDMETHODCALLTYPE startSpeaking(
/* [in] */ IUnknown *sender);
virtual HRESULT STDMETHODCALLTYPE stopSpeaking(
/* [in] */ IUnknown *sender);
// IWebNotificationObserver
virtual HRESULT STDMETHODCALLTYPE onNotify(
/* [in] */ IWebNotification *notification);
// IWebViewPrivate
virtual HRESULT STDMETHODCALLTYPE setCustomDropTarget(
/* [in] */ IDropTarget* dt);
virtual HRESULT STDMETHODCALLTYPE removeCustomDropTarget();
virtual HRESULT STDMETHODCALLTYPE setInViewSourceMode(
/* [in] */ BOOL flag);
virtual HRESULT STDMETHODCALLTYPE inViewSourceMode(
/* [retval][out] */ BOOL* flag);
virtual HRESULT STDMETHODCALLTYPE viewWindow(
/* [retval][out] */ OLE_HANDLE *window);
virtual HRESULT STDMETHODCALLTYPE setFormDelegate(
/* [in] */ IWebFormDelegate *formDelegate);
virtual HRESULT STDMETHODCALLTYPE formDelegate(
/* [retval][out] */ IWebFormDelegate **formDelegate);
virtual HRESULT STDMETHODCALLTYPE setFrameLoadDelegatePrivate(
/* [in] */ IWebFrameLoadDelegatePrivate *frameLoadDelegatePrivate);
virtual HRESULT STDMETHODCALLTYPE frameLoadDelegatePrivate(
/* [retval][out] */ IWebFrameLoadDelegatePrivate **frameLoadDelegatePrivate);
virtual HRESULT STDMETHODCALLTYPE scrollOffset(
/* [retval][out] */ LPPOINT offset);
virtual HRESULT STDMETHODCALLTYPE scrollBy(
/* [in] */ LPPOINT offset);
virtual HRESULT STDMETHODCALLTYPE visibleContentRect(
/* [retval][out] */ LPRECT rect);
virtual HRESULT STDMETHODCALLTYPE updateFocusedAndActiveState();
virtual HRESULT STDMETHODCALLTYPE executeCoreCommandByName(BSTR name, BSTR value);
virtual HRESULT STDMETHODCALLTYPE clearMainFrameName();
virtual HRESULT STDMETHODCALLTYPE markAllMatchesForText(
BSTR search, BOOL caseSensitive, BOOL highlight, UINT limit, UINT* matches);
virtual HRESULT STDMETHODCALLTYPE unmarkAllTextMatches();
virtual HRESULT STDMETHODCALLTYPE rectsForTextMatches(
IEnumTextMatches** pmatches);
virtual HRESULT STDMETHODCALLTYPE generateSelectionImage(
BOOL forceWhiteText, OLE_HANDLE* hBitmap);
virtual HRESULT STDMETHODCALLTYPE selectionRect(
RECT* rc);
virtual HRESULT STDMETHODCALLTYPE DragEnter(
IDataObject* pDataObject, DWORD grfKeyState, POINTL pt, DWORD* pdwEffect);
virtual HRESULT STDMETHODCALLTYPE DragOver(
DWORD grfKeyState, POINTL pt, DWORD* pdwEffect);
virtual HRESULT STDMETHODCALLTYPE DragLeave();
virtual HRESULT STDMETHODCALLTYPE Drop(
IDataObject* pDataObject, DWORD grfKeyState, POINTL pt, DWORD* pdwEffect);
virtual HRESULT STDMETHODCALLTYPE canHandleRequest(
IWebURLRequest *request,
BOOL *result);
virtual HRESULT STDMETHODCALLTYPE standardUserAgentWithApplicationName(
/* [in] */ BSTR applicationName,
/* [retval][out] */ BSTR *groupName);
virtual HRESULT STDMETHODCALLTYPE clearFocusNode();
virtual HRESULT STDMETHODCALLTYPE setInitialFocus(
/* [in] */ BOOL forward);
virtual HRESULT STDMETHODCALLTYPE setTabKeyCyclesThroughElements(
/* [in] */ BOOL cycles);
virtual HRESULT STDMETHODCALLTYPE tabKeyCyclesThroughElements(
/* [retval][out] */ BOOL *result);
virtual HRESULT STDMETHODCALLTYPE setAllowSiteSpecificHacks(
/* [in] */ BOOL allows);
virtual HRESULT STDMETHODCALLTYPE addAdditionalPluginDirectory(
/* [in] */ BSTR directory);
virtual HRESULT STDMETHODCALLTYPE loadBackForwardListFromOtherView(
/* [in] */ IWebView *otherView);
virtual HRESULT STDMETHODCALLTYPE inspector(
/* [retval][out] */ IWebInspector**);
virtual HRESULT STDMETHODCALLTYPE clearUndoRedoOperations( void);
virtual HRESULT STDMETHODCALLTYPE shouldClose(
/* [retval][out] */ BOOL* result);
virtual HRESULT STDMETHODCALLTYPE setProhibitsMainFrameScrolling(BOOL);
virtual HRESULT STDMETHODCALLTYPE setShouldApplyMacFontAscentHack(BOOL);
virtual HRESULT STDMETHODCALLTYPE windowAncestryDidChange();
virtual HRESULT STDMETHODCALLTYPE paintDocumentRectToContext(
/* [in] */ RECT rect,
/* [in] */ OLE_HANDLE dc);
virtual HRESULT STDMETHODCALLTYPE setCustomHTMLTokenizerTimeDelay(
/* [in] */ double timeDelay);
virtual HRESULT STDMETHODCALLTYPE setCustomHTMLTokenizerChunkSize(
/* [in] */ int chunkSize);
virtual HRESULT STDMETHODCALLTYPE backingStore(
/* [out, retval] */ OLE_HANDLE* hBitmap);
virtual HRESULT STDMETHODCALLTYPE setTransparent(
/* [in] */ BOOL transparent);
virtual HRESULT STDMETHODCALLTYPE transparent(
/* [out, retval] */ BOOL* transparent);
virtual HRESULT STDMETHODCALLTYPE setDefersCallbacks(
/* [in] */ BOOL defersCallbacks);
virtual HRESULT STDMETHODCALLTYPE defersCallbacks(
/* [out, retval] */ BOOL* defersCallbacks);
virtual HRESULT STDMETHODCALLTYPE globalHistoryItem(
/* [out, retval] */ IWebHistoryItem** item);
virtual HRESULT STDMETHODCALLTYPE setAlwaysUsesComplexTextCodePath(
/* [in] */ BOOL complex);
virtual HRESULT STDMETHODCALLTYPE alwaysUsesComplexTextCodePath(
/* [out, retval] */ BOOL* complex);
virtual HRESULT STDMETHODCALLTYPE setCookieEnabled(
/* [in] */ BOOL enable);
virtual HRESULT STDMETHODCALLTYPE cookieEnabled(
/* [out, retval] */ BOOL* enabled);
virtual HRESULT STDMETHODCALLTYPE setMediaVolume(
/* [in] */ float volume);
virtual HRESULT STDMETHODCALLTYPE mediaVolume(
/* [out, retval] */ float* volume);
virtual HRESULT STDMETHODCALLTYPE registerEmbeddedViewMIMEType(
/* [in] */ BSTR mimeType);
virtual HRESULT STDMETHODCALLTYPE setMemoryCacheDelegateCallsEnabled(
/* [in] */ BOOL enabled);
// WebView
bool shouldUseEmbeddedView(const WebCore::String& mimeType) const;
WebCore::Page* page();
bool handleMouseEvent(UINT, WPARAM, LPARAM);
void setMouseActivated(bool flag) { m_mouseActivated = flag; }
bool handleContextMenuEvent(WPARAM, LPARAM);
bool onMeasureItem(WPARAM, LPARAM);
bool onDrawItem(WPARAM, LPARAM);
bool onInitMenuPopup(WPARAM, LPARAM);
bool onUninitMenuPopup(WPARAM, LPARAM);
void performContextMenuAction(WPARAM, LPARAM, bool byPosition);
bool mouseWheel(WPARAM, LPARAM, bool isHorizontal);
bool execCommand(WPARAM wParam, LPARAM lParam);
bool keyDown(WPARAM, LPARAM, bool systemKeyDown = false);
bool keyUp(WPARAM, LPARAM, bool systemKeyDown = false);
bool keyPress(WPARAM, LPARAM, bool systemKeyDown = false);
bool inResizer(LPARAM lParam);
void paint(HDC, LPARAM);
void paintIntoWindow(HDC bitmapDC, HDC windowDC, const WebCore::IntRect& dirtyRect);
bool ensureBackingStore();
void addToDirtyRegion(const WebCore::IntRect&);
void addToDirtyRegion(HRGN);
void scrollBackingStore(WebCore::FrameView*, int dx, int dy, const WebCore::IntRect& scrollViewRect, const WebCore::IntRect& clipRect);
void deleteBackingStore();
void repaint(const WebCore::IntRect&, bool contentChanged, bool immediate = false, bool repaintContentOnly = false);
void frameRect(RECT* rect);
void closeWindow();
void closeWindowSoon();
void close();
bool didClose() const { return m_didClose; }
bool transparent() const { return m_transparent; }
bool onIMEStartComposition();
bool onIMEComposition(LPARAM);
bool onIMEEndComposition();
bool onIMEChar(WPARAM, LPARAM);
bool onIMENotify(WPARAM, LPARAM, LRESULT*);
bool onIMERequest(WPARAM, LPARAM, LRESULT*);
bool onIMESelect(WPARAM, LPARAM);
bool onIMESetContext(WPARAM, LPARAM);
void selectionChanged();
void resetIME(WebCore::Frame*);
void setInputMethodState(bool);
HRESULT registerDragDrop();
HRESULT revokeDragDrop();
// Convenient to be able to violate the rules of COM here for easy movement to the frame.
WebFrame* topLevelFrame() const { return m_mainFrame; }
const WebCore::String& userAgentForKURL(const WebCore::KURL& url);
static bool canHandleRequest(const WebCore::ResourceRequest&);
static WebCore::String standardUserAgentWithApplicationName(const WebCore::String&);
void setIsBeingDestroyed() { m_isBeingDestroyed = true; }
bool isBeingDestroyed() const { return m_isBeingDestroyed; }
const char* interpretKeyEvent(const WebCore::KeyboardEvent*);
bool handleEditingKeyboardEvent(WebCore::KeyboardEvent*);
bool isPainting() const { return m_paintCount > 0; }
void setToolTip(const WebCore::String&);
void registerForIconNotification(bool listen);
void dispatchDidReceiveIconFromWebFrame(WebFrame*);
HRESULT notifyDidAddIcon(IWebNotification*);
HRESULT notifyPreferencesChanged(IWebNotification*);
static void setCacheModel(WebCacheModel);
static WebCacheModel cacheModel();
static bool didSetCacheModel();
static WebCacheModel maxCacheModelInAnyInstance();
void updateActiveStateSoon() const;
void deleteBackingStoreSoon();
void cancelDeleteBackingStoreSoon();
HWND topLevelParent() const { return m_topLevelParent; }
void updateActiveState();
bool onGetObject(WPARAM, LPARAM, LRESULT&) const;
static STDMETHODIMP AccessibleObjectFromWindow(HWND, DWORD objectID, REFIID, void** ppObject);
private:
void setZoomMultiplier(float multiplier, bool isTextOnly);
float zoomMultiplier(bool isTextOnly);
bool canZoomIn(bool isTextOnly);
HRESULT zoomIn(bool isTextOnly);
bool canZoomOut(bool isTextOnly);
HRESULT zoomOut(bool isTextOnly);
bool canResetZoom(bool isTextOnly);
HRESULT resetZoom(bool isTextOnly);
bool active();
enum WindowsToPaint { PaintWebViewOnly, PaintWebViewAndChildren };
void paintIntoBackingStore(WebCore::FrameView*, HDC bitmapDC, const WebCore::IntRect& dirtyRect, WindowsToPaint);
void updateBackingStore(WebCore::FrameView*, HDC = 0, bool backingStoreCompletelyDirty = false, WindowsToPaint = PaintWebViewOnly);
protected:
HIMC getIMMContext();
void releaseIMMContext(HIMC);
static bool allowSiteSpecificHacks() { return s_allowSiteSpecificHacks; }
void preflightSpellChecker();
bool continuousCheckingAllowed();
void initializeToolTipWindow();
void closeWindowTimerFired(WebCore::Timer<WebView>*);
void prepareCandidateWindow(WebCore::Frame*, HIMC);
void updateSelectionForIME();
bool onIMERequestCharPosition(WebCore::Frame*, IMECHARPOSITION*, LRESULT*);
bool onIMERequestReconvertString(WebCore::Frame*, RECONVERTSTRING*, LRESULT*);
bool developerExtrasEnabled() const;
// AllWebViewSet functions
void addToAllWebViewsSet();
void removeFromAllWebViewsSet();
virtual void windowReceivedMessage(HWND, UINT message, WPARAM, LPARAM);
ULONG m_refCount;
HWND m_hostWindow;
HWND m_viewWindow;
WebFrame* m_mainFrame;
WebCore::Page* m_page;
OwnPtr<HBITMAP> m_backingStoreBitmap;
SIZE m_backingStoreSize;
OwnPtr<HRGN> m_backingStoreDirtyRegion;
COMPtr<IWebEditingDelegate> m_editingDelegate;
COMPtr<IWebFrameLoadDelegate> m_frameLoadDelegate;
COMPtr<IWebFrameLoadDelegatePrivate> m_frameLoadDelegatePrivate;
COMPtr<IWebUIDelegate> m_uiDelegate;
COMPtr<IWebUIDelegatePrivate> m_uiDelegatePrivate;
COMPtr<IWebFormDelegate> m_formDelegate;
COMPtr<IWebPolicyDelegate> m_policyDelegate;
COMPtr<IWebResourceLoadDelegate> m_resourceLoadDelegate;
COMPtr<IWebDownloadDelegate> m_downloadDelegate;
COMPtr<WebPreferences> m_preferences;
COMPtr<WebInspector> m_webInspector;
bool m_userAgentOverridden;
bool m_useBackForwardList;
WebCore::String m_userAgentCustom;
WebCore::String m_userAgentStandard;
float m_zoomMultiplier;
WebCore::String m_overrideEncoding;
WebCore::String m_applicationName;
bool m_mouseActivated;
// WebCore dragging logic needs to be able to inspect the drag data
// this is updated in DragEnter/Leave/Drop
COMPtr<IDataObject> m_dragData;
COMPtr<IDropTargetHelper> m_dropTargetHelper;
UChar m_currentCharacterCode;
bool m_isBeingDestroyed;
unsigned m_paintCount;
bool m_hasSpellCheckerDocumentTag;
bool m_smartInsertDeleteEnabled;
bool m_selectTrailingWhitespaceEnabled;
bool m_didClose;
bool m_hasCustomDropTarget;
unsigned m_inIMEComposition;
HWND m_toolTipHwnd;
WebCore::String m_toolTip;
bool m_deleteBackingStoreTimerActive;
bool m_transparent;
static bool s_allowSiteSpecificHacks;
WebCore::Timer<WebView> m_closeWindowTimer;
OwnPtr<TRACKMOUSEEVENT> m_mouseOutTracker;
HWND m_topLevelParent;
OwnPtr<HashSet<WebCore::String> > m_embeddedViewMIMETypes;
};
#endif
|