1/*
2 * Copyright (C) 2004-2006 Apple Inc.  All rights reserved.
3 * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
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 *
14 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
15 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
17 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
18 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
20 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
21 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */
26
27#import <WebCore/DOM.h>
28
29#if TARGET_OS_IPHONE
30#import <WebCore/WebAutocapitalize.h>
31#import <CoreText/CoreText.h>
32#endif
33
34@interface DOMNode (DOMNodeExtensionsPendingPublic)
35#if !TARGET_OS_IPHONE
36- (NSImage *)renderedImage;
37#endif
38- (NSArray *)textRects;
39@end
40
41@interface DOMNode (WebPrivate)
42+ (id)_nodeFromJSWrapper:(JSObjectRef)jsWrapper;
43@end
44
45// FIXME: this should be removed as soon as all internal Apple uses of it have been replaced with
46// calls to the public method - (NSColor *)color.
47@interface DOMRGBColor (WebPrivate)
48#if !TARGET_OS_IPHONE
49- (NSColor *)_color;
50#endif
51@end
52
53// FIXME: this should be removed as soon as all internal Apple uses of it have been replaced with
54// calls to the public method - (NSString *)text.
55@interface DOMRange (WebPrivate)
56- (NSString *)_text;
57@end
58
59@interface DOMRange (DOMRangeExtensions)
60#if TARGET_OS_IPHONE
61- (CGRect)boundingBox;
62#else
63- (NSRect)boundingBox;
64#endif
65#if !TARGET_OS_IPHONE
66- (NSImage *)renderedImageForcingBlackText:(BOOL)forceBlackText;
67#else
68- (CGImageRef)renderedImageForcingBlackText:(BOOL)forceBlackText;
69#endif
70- (NSArray *)lineBoxRects; // Deprecated. Use textRects instead.
71- (NSArray *)textRects;
72@end
73
74@interface DOMElement (WebPrivate)
75#if !TARGET_OS_IPHONE
76- (NSFont *)_font;
77- (NSData *)_imageTIFFRepresentation;
78#else
79- (CTFontRef)_font;
80#endif
81- (NSURL *)_getURLAttribute:(NSString *)name;
82- (BOOL)isFocused;
83@end
84
85@interface DOMCSSStyleDeclaration (WebPrivate)
86- (NSString *)_fontSizeDelta;
87- (void)_setFontSizeDelta:(NSString *)fontSizeDelta;
88@end
89
90@interface DOMHTMLDocument (WebPrivate)
91- (DOMDocumentFragment *)_createDocumentFragmentWithMarkupString:(NSString *)markupString baseURLString:(NSString *)baseURLString;
92- (DOMDocumentFragment *)_createDocumentFragmentWithText:(NSString *)text;
93@end
94
95@interface DOMHTMLTableCellElement (WebPrivate)
96- (DOMHTMLTableCellElement *)_cellAbove;
97@end
98
99// All the methods in this category are used by Safari forms autofill and should not be used for any other purpose.
100// Each one should eventually be replaced by public DOM API, and when that happens Safari will switch to implementations
101// using that public API, and these will be deleted.
102@interface DOMHTMLInputElement (FormAutoFillTransition)
103- (BOOL)_isTextField;
104#if TARGET_OS_IPHONE
105- (BOOL)_isAutofilled;
106- (void)_setAutofilled:(BOOL)filled;
107#endif
108@end
109
110#if TARGET_OS_IPHONE
111// These changes are necessary to detect whether a form input was modified by a user
112// or javascript
113@interface DOMHTMLInputElement (FormPromptAdditions)
114- (BOOL)_isEdited;
115@end
116
117@interface DOMHTMLTextAreaElement (FormPromptAdditions)
118- (BOOL)_isEdited;
119@end
120#endif // TARGET_OS_IPHONE
121
122// All the methods in this category are used by Safari forms autofill and should not be used for any other purpose.
123// They are stopgap measures until we finish transitioning form controls to not use NSView. Each one should become
124// replaceable by public DOM API, and when that happens Safari will switch to implementations using that public API,
125// and these will be deleted.
126@interface DOMHTMLSelectElement (FormAutoFillTransition)
127- (void)_activateItemAtIndex:(int)index;
128- (void)_activateItemAtIndex:(int)index allowMultipleSelection:(BOOL)allowMultipleSelection;
129@end
130
131#if TARGET_OS_IPHONE
132enum { WebMediaQueryOrientationCurrent, WebMediaQueryOrientationPortrait, WebMediaQueryOrientationLandscape };
133@interface DOMHTMLLinkElement (WebPrivate)
134- (BOOL)_mediaQueryMatchesForOrientation:(int)orientation;
135- (BOOL)_mediaQueryMatches;
136@end
137
138// These changes are useful to get the AutocapitalizeType on particular form controls.
139@interface DOMHTMLInputElement (AutocapitalizeAdditions)
140- (WebAutocapitalizeType)_autocapitalizeType;
141@end
142
143@interface DOMHTMLTextAreaElement (AutocapitalizeAdditions)
144- (WebAutocapitalizeType)_autocapitalizeType;
145@end
146
147// These are used by Date and Time input types because the generated ObjC methods default to not dispatching events.
148@interface DOMHTMLInputElement (WebInputChangeEventAdditions)
149- (void)setValueWithChangeEvent:(NSString *)newValue;
150- (void)setValueAsNumberWithChangeEvent:(double)newValueAsNumber;
151@end
152#endif // TARGET_OS_IPHONE
153