Home | History | Annotate | Download | only in WebView
      1 /*
      2  * Copyright (C) 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
      3  *
      4  * Redistribution and use in source and binary forms, with or without
      5  * modification, are permitted provided that the following conditions
      6  * are met:
      7  *
      8  * 1.  Redistributions of source code must retain the above copyright
      9  *     notice, this list of conditions and the following disclaimer.
     10  * 2.  Redistributions in binary form must reproduce the above copyright
     11  *     notice, this list of conditions and the following disclaimer in the
     12  *     documentation and/or other materials provided with the distribution.
     13  * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
     14  *     its contributors may be used to endorse or promote products derived
     15  *     from this software without specific prior written permission.
     16  *
     17  * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
     18  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
     19  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
     20  * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
     21  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
     22  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
     23  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
     24  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     25  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     26  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     27  */
     28 
     29 #import <WebKit/WebHTMLView.h>
     30 
     31 #if !defined(ENABLE_NETSCAPE_PLUGIN_API)
     32 #define ENABLE_NETSCAPE_PLUGIN_API 1
     33 #endif
     34 
     35 @class DOMDocumentFragment;
     36 @class DOMNode;
     37 @class DOMRange;
     38 @class WebPluginController;
     39 
     40 @protocol WebHTMLHighlighter
     41 - (NSRect)highlightRectForLine:(NSRect)lineRect representedNode:(DOMNode *)node;
     42 - (void)paintHighlightForBox:(NSRect)boxRect onLine:(NSRect)lineRect behindText:(BOOL)text entireLine:(BOOL)line representedNode:(DOMNode *)node;
     43 
     44 // the following methods are deprecated and will be removed once Mail switches to the new methods <rdar://problem/5050528>
     45 - (NSRect)highlightRectForLine:(NSRect)lineRect;
     46 - (void)paintHighlightForBox:(NSRect)boxRect onLine:(NSRect)lineRect behindText:(BOOL)text entireLine:(BOOL)line;
     47 @end
     48 
     49 @interface WebHTMLView (WebPrivate)
     50 
     51 + (NSArray *)supportedMIMETypes;
     52 + (NSArray *)supportedImageMIMETypes;
     53 + (NSArray *)supportedNonImageMIMETypes;
     54 + (NSArray *)unsupportedTextMIMETypes;
     55 
     56 - (void)close;
     57 
     58 // Modifier (flagsChanged) tracking SPI
     59 + (void)_postFlagsChangedEvent:(NSEvent *)flagsChangedEvent;
     60 - (void)_updateMouseoverWithFakeEvent;
     61 
     62 - (void)_setAsideSubviews;
     63 - (void)_restoreSubviews;
     64 
     65 - (BOOL)_insideAnotherHTMLView;
     66 - (void)_clearLastHitViewIfSelf;
     67 - (void)_updateMouseoverWithEvent:(NSEvent *)event;
     68 
     69 + (NSArray *)_insertablePasteboardTypes;
     70 + (NSArray *)_selectionPasteboardTypes;
     71 - (void)_writeSelectionToPasteboard:(NSPasteboard *)pasteboard;
     72 
     73 - (void)_frameOrBoundsChanged;
     74 
     75 - (NSImage *)_dragImageForLinkElement:(NSDictionary *)element;
     76 - (NSImage *)_dragImageForURL:(NSString*)linkURL withLabel:(NSString*)label;
     77 - (void)_handleAutoscrollForMouseDragged:(NSEvent *)event;
     78 - (WebPluginController *)_pluginController;
     79 
     80 // FIXME: _selectionRect is deprecated in favor of selectionRect, which is in protocol WebDocumentSelection.
     81 // We can't remove this yet because it's still in use by Mail.
     82 - (NSRect)_selectionRect;
     83 
     84 - (void)_startAutoscrollTimer:(NSEvent *)event;
     85 - (void)_stopAutoscrollTimer;
     86 
     87 - (BOOL)_canEdit;
     88 - (BOOL)_canEditRichly;
     89 - (BOOL)_canAlterCurrentSelection;
     90 - (BOOL)_hasSelection;
     91 - (BOOL)_hasSelectionOrInsertionPoint;
     92 - (BOOL)_isEditable;
     93 
     94 - (BOOL)_transparentBackground;
     95 - (void)_setTransparentBackground:(BOOL)isBackgroundTransparent;
     96 
     97 - (void)_setToolTip:(NSString *)string;
     98 
     99 // SPI used by Mail.
    100 // FIXME: These should all be moved to WebView; we won't always have a WebHTMLView.
    101 - (NSImage *)_selectionDraggingImage;
    102 - (NSRect)_selectionDraggingRect;
    103 - (DOMNode *)_insertOrderedList;
    104 - (DOMNode *)_insertUnorderedList;
    105 - (BOOL)_canIncreaseSelectionListLevel;
    106 - (BOOL)_canDecreaseSelectionListLevel;
    107 - (DOMNode *)_increaseSelectionListLevel;
    108 - (DOMNode *)_increaseSelectionListLevelOrdered;
    109 - (DOMNode *)_increaseSelectionListLevelUnordered;
    110 - (void)_decreaseSelectionListLevel;
    111 - (void)_setHighlighter:(id <WebHTMLHighlighter>)highlighter ofType:(NSString *)type;
    112 - (void)_removeHighlighterOfType:(NSString *)type;
    113 - (DOMDocumentFragment *)_documentFragmentFromPasteboard:(NSPasteboard *)pasteboard forType:(NSString *)pboardType inContext:(DOMRange *)context subresources:(NSArray **)subresources;
    114 
    115 #if ENABLE_NETSCAPE_PLUGIN_API
    116 - (void)_resumeNullEventsForAllNetscapePlugins;
    117 - (void)_pauseNullEventsForAllNetscapePlugins;
    118 #endif
    119 
    120 - (BOOL)_isUsingAcceleratedCompositing;
    121 - (NSView *)_compositingLayersHostingView;
    122 
    123 // SPI for printing (should be converted to API someday). When the WebHTMLView isn't being printed
    124 // directly, this method must be called before paginating, or the computed height might be incorrect.
    125 // Typically this would be called from inside an override of -[NSView knowsPageRange:].
    126 - (void)_layoutForPrinting;
    127 
    128 - (BOOL)_canSmartReplaceWithPasteboard:(NSPasteboard *)pasteboard;
    129 
    130 @end
    131