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 #if MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_4
     36 #define WebCGFloat float
     37 #else
     38 #define WebCGFloat CGFloat
     39 #endif
     40 
     41 @class DOMDocumentFragment;
     42 @class DOMNode;
     43 @class DOMRange;
     44 @class WebPluginController;
     45 
     46 @protocol WebHTMLHighlighter
     47 - (NSRect)highlightRectForLine:(NSRect)lineRect representedNode:(DOMNode *)node;
     48 - (void)paintHighlightForBox:(NSRect)boxRect onLine:(NSRect)lineRect behindText:(BOOL)text entireLine:(BOOL)line representedNode:(DOMNode *)node;
     49 @end
     50 
     51 extern const float _WebHTMLViewPrintingMinimumShrinkFactor;
     52 extern const float _WebHTMLViewPrintingMaximumShrinkFactor;
     53 
     54 @interface WebHTMLView (WebPrivate)
     55 
     56 + (NSArray *)supportedMIMETypes;
     57 + (NSArray *)supportedImageMIMETypes;
     58 + (NSArray *)supportedNonImageMIMETypes;
     59 + (NSArray *)unsupportedTextMIMETypes;
     60 
     61 - (void)close;
     62 
     63 // Modifier (flagsChanged) tracking SPI
     64 + (void)_postFlagsChangedEvent:(NSEvent *)flagsChangedEvent;
     65 - (void)_updateMouseoverWithFakeEvent;
     66 
     67 - (void)_setAsideSubviews;
     68 - (void)_restoreSubviews;
     69 
     70 - (BOOL)_insideAnotherHTMLView;
     71 - (void)_clearLastHitViewIfSelf;
     72 - (void)_updateMouseoverWithEvent:(NSEvent *)event;
     73 
     74 + (NSArray *)_insertablePasteboardTypes;
     75 + (NSArray *)_selectionPasteboardTypes;
     76 - (void)_writeSelectionToPasteboard:(NSPasteboard *)pasteboard;
     77 
     78 - (void)_frameOrBoundsChanged;
     79 
     80 - (void)_handleAutoscrollForMouseDragged:(NSEvent *)event;
     81 - (WebPluginController *)_pluginController;
     82 
     83 // FIXME: _selectionRect is deprecated in favor of selectionRect, which is in protocol WebDocumentSelection.
     84 // We can't remove this yet because it's still in use by Mail.
     85 - (NSRect)_selectionRect;
     86 
     87 - (void)_startAutoscrollTimer:(NSEvent *)event;
     88 - (void)_stopAutoscrollTimer;
     89 
     90 - (BOOL)_canEdit;
     91 - (BOOL)_canEditRichly;
     92 - (BOOL)_canAlterCurrentSelection;
     93 - (BOOL)_hasSelection;
     94 - (BOOL)_hasSelectionOrInsertionPoint;
     95 - (BOOL)_isEditable;
     96 
     97 - (BOOL)_transparentBackground;
     98 - (void)_setTransparentBackground:(BOOL)isBackgroundTransparent;
     99 
    100 - (void)_setToolTip:(NSString *)string;
    101 
    102 // SPI used by Mail.
    103 // FIXME: These should all be moved to WebView; we won't always have a WebHTMLView.
    104 - (NSImage *)_selectionDraggingImage;
    105 - (NSRect)_selectionDraggingRect;
    106 - (DOMNode *)_insertOrderedList;
    107 - (DOMNode *)_insertUnorderedList;
    108 - (BOOL)_canIncreaseSelectionListLevel;
    109 - (BOOL)_canDecreaseSelectionListLevel;
    110 - (DOMNode *)_increaseSelectionListLevel;
    111 - (DOMNode *)_increaseSelectionListLevelOrdered;
    112 - (DOMNode *)_increaseSelectionListLevelUnordered;
    113 - (void)_decreaseSelectionListLevel;
    114 - (void)_setHighlighter:(id <WebHTMLHighlighter>)highlighter ofType:(NSString *)type;
    115 - (void)_removeHighlighterOfType:(NSString *)type;
    116 - (DOMDocumentFragment *)_documentFragmentFromPasteboard:(NSPasteboard *)pasteboard forType:(NSString *)pboardType inContext:(DOMRange *)context subresources:(NSArray **)subresources;
    117 
    118 #if ENABLE_NETSCAPE_PLUGIN_API
    119 - (void)_resumeNullEventsForAllNetscapePlugins;
    120 - (void)_pauseNullEventsForAllNetscapePlugins;
    121 #endif
    122 
    123 - (BOOL)_isUsingAcceleratedCompositing;
    124 - (NSView *)_compositingLayersHostingView;
    125 
    126 // SPI for printing (should be converted to API someday). When the WebHTMLView isn't being printed
    127 // directly, this method must be called before paginating, or the computed height might be incorrect.
    128 // Typically this would be called from inside an override of -[NSView knowsPageRange:].
    129 - (void)_layoutForPrinting;
    130 - (WebCGFloat)_adjustedBottomOfPageWithTop:(WebCGFloat)top bottom:(WebCGFloat)bottom limit:(WebCGFloat)bottomLimit;
    131 - (BOOL)_isInPrintMode;
    132 - (BOOL)_beginPrintModeWithPageWidth:(float)pageWidth height:(float)pageHeight shrinkToFit:(BOOL)shrinkToFit;
    133 // Lays out to pages of the given minimum width and height or more (increasing both dimensions proportionally)
    134 // as needed for the content to fit, but no more than the given maximum width.
    135 - (BOOL)_beginPrintModeWithMinimumPageWidth:(WebCGFloat)minimumPageWidth height:(WebCGFloat)minimumPageHeight maximumPageWidth:(WebCGFloat)maximumPageWidth;
    136 - (void)_endPrintMode;
    137 
    138 - (BOOL)_isInScreenPaginationMode;
    139 - (BOOL)_beginScreenPaginationModeWithPageSize:(CGSize)pageSize shrinkToFit:(BOOL)shrinkToFit;
    140 - (void)_endScreenPaginationMode;
    141 
    142 - (BOOL)_canSmartReplaceWithPasteboard:(NSPasteboard *)pasteboard;
    143 
    144 @end
    145 
    146 #undef WebCGFloat
    147