summaryrefslogtreecommitdiff
path: root/Source/WebKit/blackberry/WebKitSupport/DOMSupport.h
blob: a86e12a359b736ac44cf48fe84ec7beb1bcdfa4c (plain)
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
/*
 * Copyright (C) 2011, 2012 Research In Motion Limited. All rights reserved.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 */

#ifndef DOMSupport_h
#define DOMSupport_h

#include "IntPoint.h"
#include "IntRect.h"

#include <wtf/Vector.h>

namespace WTF {
class String;
}

namespace WebCore {
class Element;
class FloatQuad;
class Frame;
class HTMLInputElement;
class HTMLTextFormControlElement;
class Node;
class Position;
class QualifiedName;
class Range;
class RenderObject;
class VisiblePosition;
class VisibleSelection;
}

namespace BlackBerry {
namespace WebKit {
namespace DOMSupport {

enum AttributeState { On, Off, Default };

bool isElementTypePlugin(const WebCore::Element*);

bool isTextInputElement(WebCore::Element*);
bool isTextBasedContentEditableElement(WebCore::Element*);
bool isPasswordElement(const WebCore::Element*);

bool isPopupInputField(const WebCore::Element*);
bool isDateTimeInputField(const WebCore::Element*);
bool isColorInputField(const WebCore::Element*);

AttributeState elementAttributeState(const WebCore::Element*, const WebCore::QualifiedName&);
AttributeState elementSupportsAutocorrect(const WebCore::Element*);
AttributeState elementSupportsAutocomplete(const WebCore::Element*);
AttributeState elementSupportsSpellCheck(const WebCore::Element*);

WTF::String inputElementText(WebCore::Element*);
WTF::String webWorksContext(const WebCore::Element*);

WebCore::HTMLTextFormControlElement* toTextControlElement(WebCore::Node*);

WebCore::IntRect transformedBoundingBoxForRange(const WebCore::Range&);
void visibleTextQuads(const WebCore::Range&, WTF::Vector<WebCore::FloatQuad>& quads, bool useSelectionHeight = false);
void visibleTextQuads(const WebCore::VisibleSelection&, WTF::Vector<WebCore::FloatQuad>& quads);

WebCore::VisibleSelection visibleSelectionForRangeInputElement(WebCore::Element*, int start, int end);
WebCore::VisibleSelection visibleSelectionForInputElement(WebCore::Element*);

WebCore::Node* DOMContainerNodeForPosition(const WebCore::Position&);
bool isPositionInNode(WebCore::Node*, const WebCore::Position&);

bool elementIdOrNameIndicatesNoAutocomplete(const WebCore::Element*);
bool elementIdOrNameIndicatesEmail(const WebCore::HTMLInputElement*);
bool elementIdOrNameIndicatesUrl(const WebCore::HTMLInputElement*);
bool elementPatternMatches(const char*, const WebCore::HTMLInputElement*);
bool elementPatternIndicatesNumber(const WebCore::HTMLInputElement*);
bool elementPatternIndicatesHexadecimal(const WebCore::HTMLInputElement*);

WebCore::IntPoint convertPointToFrame(const WebCore::Frame* sourceFrame, const WebCore::Frame* targetFrame, const WebCore::IntPoint& sourcePoint, const bool clampToTargetFrame = false);

static const WebCore::IntPoint InvalidPoint = WebCore::IntPoint(-1, -1);

WebCore::VisibleSelection visibleSelectionForClosestActualWordStart(const WebCore::VisibleSelection&);

WebCore::Frame* incrementFrame(WebCore::Frame* curr, bool forward, bool wrapFlag);

PassRefPtr<WebCore::Range> trimWhitespaceFromRange(WebCore::VisiblePosition startPosition, WebCore::VisiblePosition endPosition);
bool isEmptyRangeOrAllSpaces(WebCore::VisiblePosition, WebCore::VisiblePosition);

bool isFixedPositionOrHasFixedPositionAncestor(WebCore::RenderObject*);

} // DOMSupport
} // WebKit
} // BlackBerry

#endif // DOMSupport_h