1/*
2 * Copyright (C) 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 * 1. Redistributions of source code must retain the above copyright
8 *    notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 *    notice, this list of conditions and the following disclaimer in the
11 *    documentation and/or other materials provided with the distribution.
12 *
13 * THIS SOFTWARE IS PROVIDED BY APPLE, INC. ``AS IS'' AND ANY
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 *
25 */
26
27#if TARGET_OS_IPHONE
28
29#import <WebCore/DOMElement.h>
30#import <WebCore/DOMExtensions.h>
31#import <WebCore/DOMHTMLAreaElement.h>
32#import <WebCore/DOMHTMLImageElement.h>
33#import <WebCore/DOMHTMLSelectElement.h>
34#import <WebCore/DOMNode.h>
35#import <WebCore/DOMRange.h>
36
37typedef enum {
38    // The first four match SelectionDirection.  The last two don't have WebKit counterparts because
39    // they aren't necessary until there is support vertical layout.
40    WebTextAdjustmentForward,
41    WebTextAdjustmentBackward,
42    WebTextAdjustmentRight,
43    WebTextAdjustmentLeft,
44    WebTextAdjustmentUp,
45    WebTextAdjustmentDown
46} WebTextAdjustmentDirection;
47
48@interface DOMRange (UIKitExtensions)
49
50- (void)move:(UInt32)amount inDirection:(WebTextAdjustmentDirection)direction;
51- (void)extend:(UInt32)amount inDirection:(WebTextAdjustmentDirection)direction;
52- (DOMNode *)firstNode;
53
54@end
55
56@interface DOMNode (UIKitExtensions)
57- (NSArray *)borderRadii;
58- (NSArray *)boundingBoxes;
59- (NSArray *)absoluteQuads;     // return array of WKQuadObjects. takes transforms into account
60
61- (BOOL)containsOnlyInlineObjects;
62- (BOOL)isSelectableBlock;
63- (DOMRange *)rangeOfContainingParagraph;
64- (CGFloat)textHeight;
65- (DOMNode *)findExplodedTextNodeAtPoint:(CGPoint)point;  // A second-chance pass to look for text nodes missed by the hit test.
66@end
67
68@interface DOMHTMLAreaElement (UIKitExtensions)
69- (CGRect)boundingBoxWithOwner:(DOMNode *)anOwner;
70- (WKQuad)absoluteQuadWithOwner:(DOMNode *)anOwner;     // takes transforms into account
71- (NSArray *)boundingBoxesWithOwner:(DOMNode *)anOwner;
72- (NSArray *)absoluteQuadsWithOwner:(DOMNode *)anOwner; // return array of WKQuadObjects. takes transforms into account
73@end
74
75@interface DOMHTMLSelectElement (UIKitExtensions)
76- (unsigned)completeLength;
77- (DOMNode *)listItemAtIndex:(int)anIndex;
78@end
79
80@interface DOMHTMLImageElement (WebDOMHTMLImageElementOperationsPrivate)
81- (NSData *)dataRepresentation:(BOOL)rawImageData;
82- (NSString *)mimeType;
83@end
84
85@interface DOMElement (DOMUIKitComplexityExtensions)
86- (int)structuralComplexityContribution; // Does not include children.
87@end
88
89#endif // TARGET_OS_IPHONE
90