2
* Copyright (C) 2006, 2007 Apple, Inc. All rights reserved.
4
* Redistribution and use in source and binary forms, with or without
5
* modification, are permitted provided that the following conditions
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.
13
* THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, 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 COMPUTER, 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.
27
#include "WebKitDLL.h"
28
#include "WebHTMLRepresentation.h"
32
#include "WebKitStatisticsPrivate.h"
33
#pragma warning(push, 0)
34
#include <WebCore/HTMLInputElement.h>
37
using namespace WebCore;
39
// WebHTMLRepresentation ------------------------------------------------------
41
WebHTMLRepresentation::WebHTMLRepresentation()
45
WebHTMLRepresentationCount++;
49
WebHTMLRepresentation::~WebHTMLRepresentation()
56
WebHTMLRepresentationCount--;
60
WebHTMLRepresentation* WebHTMLRepresentation::createInstance(WebFrame* frame)
62
WebHTMLRepresentation* instance = new WebHTMLRepresentation();
63
instance->m_frame = frame;
69
// IUnknown -------------------------------------------------------------------
71
HRESULT STDMETHODCALLTYPE WebHTMLRepresentation::QueryInterface(REFIID riid, void** ppvObject)
74
if (IsEqualGUID(riid, IID_IUnknown))
75
*ppvObject = static_cast<IWebHTMLRepresentation*>(this);
76
else if (IsEqualGUID(riid, IID_IWebHTMLRepresentation))
77
*ppvObject = static_cast<IWebHTMLRepresentation*>(this);
78
else if (IsEqualGUID(riid, IID_IWebDocumentRepresentation))
79
*ppvObject = static_cast<IWebDocumentRepresentation*>(this);
87
ULONG STDMETHODCALLTYPE WebHTMLRepresentation::AddRef(void)
92
ULONG STDMETHODCALLTYPE WebHTMLRepresentation::Release(void)
94
ULONG newRef = --m_refCount;
101
// IWebHTMLRepresentation --------------------------------------------------------------------
103
HRESULT STDMETHODCALLTYPE WebHTMLRepresentation::supportedMIMETypes(
104
/* [out][in] */ BSTR* /*types*/,
105
/* [out][in] */ int* /*cTypes*/)
107
ASSERT_NOT_REACHED();
111
HRESULT STDMETHODCALLTYPE WebHTMLRepresentation::supportedNonImageMIMETypes(
112
/* [out][in] */ BSTR* /*types*/,
113
/* [out][in] */ int* /*cTypes*/)
115
ASSERT_NOT_REACHED();
119
HRESULT STDMETHODCALLTYPE WebHTMLRepresentation::supportedImageMIMETypes(
120
/* [out][in] */ BSTR* /*types*/,
121
/* [out][in] */ int* /*cTypes*/)
123
ASSERT_NOT_REACHED();
127
HRESULT STDMETHODCALLTYPE WebHTMLRepresentation::attributedStringFromDOMNodes(
128
/* [in] */ IDOMNode* /*startNode*/,
129
/* [in] */ int /*startOffset*/,
130
/* [in] */ IDOMNode* /*endNode*/,
131
/* [in] */ int /*endOffset*/,
132
/* [retval][out] */ IDataObject** /*attributedString*/)
134
ASSERT_NOT_REACHED();
138
HRESULT STDMETHODCALLTYPE WebHTMLRepresentation::elementWithName(
139
/* [in] */ BSTR name,
140
/* [in] */ IDOMElement* form,
141
/* [retval][out] */ IDOMElement** element)
146
return m_frame->elementWithName(name, form, element);
149
HRESULT STDMETHODCALLTYPE WebHTMLRepresentation::elementDoesAutoComplete(
150
/* [in] */ IDOMElement* element,
151
/* [retval][out] */ BOOL* result)
153
bool doesAutoComplete;
154
HRESULT hr = m_frame->elementDoesAutoComplete(element, &doesAutoComplete);
155
*result = doesAutoComplete ? TRUE : FALSE;
159
HRESULT STDMETHODCALLTYPE WebHTMLRepresentation::elementIsPassword(
160
/* [in] */ IDOMElement* element,
161
/* [retval][out] */ BOOL* result)
164
HRESULT hr = m_frame->elementIsPassword(element, &isPassword);
165
*result = isPassword ? TRUE : FALSE;
169
HRESULT STDMETHODCALLTYPE WebHTMLRepresentation::formForElement(
170
/* [in] */ IDOMElement* element,
171
/* [retval][out] */ IDOMElement** form)
176
return m_frame->formForElement(element, form);
179
HRESULT STDMETHODCALLTYPE WebHTMLRepresentation::currentForm(
180
/* [retval][out] */ IDOMElement** form)
185
return m_frame->currentForm(form);
188
HRESULT STDMETHODCALLTYPE WebHTMLRepresentation::controlsInForm(
189
/* [in] */ IDOMElement* form,
190
/* [out][in] */ IDOMElement** controls,
191
/* [out][in] */ int* cControls)
193
return m_frame->controlsInForm(form, controls, cControls);
196
HRESULT STDMETHODCALLTYPE WebHTMLRepresentation::searchForLabels(
197
/* [size_is][in] */ BSTR* labels,
198
/* [in] */ int cLabels,
199
/* [in] */ IDOMElement* beforeElement,
200
/* [retval][out] */ BSTR* result)
202
return m_frame->searchForLabelsBeforeElement(labels, cLabels, beforeElement, result);
205
HRESULT STDMETHODCALLTYPE WebHTMLRepresentation::matchLabels(
206
/* [size_is][in] */ BSTR* labels,
207
/* [in] */ int cLabels,
208
/* [in] */ IDOMElement* againstElement,
209
/* [retval][out] */ BSTR* result)
211
return m_frame->matchLabelsAgainstElement(labels, cLabels, againstElement, result);
214
// IWebDocumentRepresentation ----------------------------------------------------------------
216
HRESULT STDMETHODCALLTYPE WebHTMLRepresentation::setDataSource(
217
/* [in] */ IWebDataSource* /*dataSource*/)
219
ASSERT_NOT_REACHED();
223
HRESULT STDMETHODCALLTYPE WebHTMLRepresentation::receivedData(
224
/* [in] */ IStream* /*data*/,
225
/* [in] */ IWebDataSource* /*dataSource*/)
227
ASSERT_NOT_REACHED();
231
HRESULT STDMETHODCALLTYPE WebHTMLRepresentation::receivedError(
232
/* [in] */ IWebError* /*error*/,
233
/* [in] */ IWebDataSource* /*dataSource*/)
235
ASSERT_NOT_REACHED();
239
HRESULT STDMETHODCALLTYPE WebHTMLRepresentation::finishedLoadingWithDataSource(
240
/* [in] */ IWebDataSource* /*dataSource*/)
242
ASSERT_NOT_REACHED();
246
HRESULT STDMETHODCALLTYPE WebHTMLRepresentation::canProvideDocumentSource(
247
/* [retval][out] */ BOOL* result)
249
bool canProvideSource;
250
HRESULT hr = this->m_frame->canProvideDocumentSource(&canProvideSource);
251
*result = canProvideSource ? TRUE : FALSE;
255
HRESULT STDMETHODCALLTYPE WebHTMLRepresentation::documentSource(
256
/* [retval][out] */ BSTR* /*source*/)
258
ASSERT_NOT_REACHED();
262
HRESULT STDMETHODCALLTYPE WebHTMLRepresentation::title(
263
/* [retval][out] */ BSTR* /*docTitle*/)
265
ASSERT_NOT_REACHED();