Commit ee52d73f authored by adachan@apple.com's avatar adachan@apple.com
Browse files

Implemented DOMHTMLElement::idName() and WebFrame::frameElement().

        Added IWebFrame::paintDocumentRectToContext() so we can paint a frame's
        content into a device context.  Changed WebView::paintDocumentRectToContext()
        to call that WebFrame method.

        Reviewed by Adam Roben.

        * DOMHTMLClasses.cpp:
        (DOMHTMLElement::idName):
        * Interfaces/IWebFramePrivate.idl:
        * WebFrame.cpp:
        (WebFrame::paintDocumentRectToContext):
        (WebFrame::frameElement):
        * WebFrame.h:
        * WebView.cpp:
        (WebView::paintDocumentRectToContext):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@35723 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent f0426606
2008-08-13 Ada Chan <adachan@apple.com>
Implemented DOMHTMLElement::idName() and WebFrame::frameElement().
Added IWebFrame::paintDocumentRectToContext() so we can paint a frame's
content into a device context. Changed WebView::paintDocumentRectToContext()
to call that WebFrame method.
Reviewed by Adam Roben.
* DOMHTMLClasses.cpp:
(DOMHTMLElement::idName):
* Interfaces/IWebFramePrivate.idl:
* WebFrame.cpp:
(WebFrame::paintDocumentRectToContext):
(WebFrame::frameElement):
* WebFrame.h:
* WebView.cpp:
(WebView::paintDocumentRectToContext):
2008-08-12 Timothy Hatcher <timothy@apple.com>
 
Add a stub for InspectorClient::setAttachedWindowHeight.
......
......@@ -352,10 +352,15 @@ HRESULT STDMETHODCALLTYPE DOMHTMLElement::QueryInterface(REFIID riid, void** ppv
// DOMHTMLElement -------------------------------------------------------------
HRESULT STDMETHODCALLTYPE DOMHTMLElement::idName(
/* [retval][out] */ BSTR* /*result*/)
/* [retval][out] */ BSTR* result)
{
ASSERT_NOT_REACHED();
return E_NOTIMPL;
if (!result)
return E_POINTER;
ASSERT(m_element && m_element->isHTMLElement());
String idString = static_cast<HTMLElement*>(m_element)->id();
*result = BString(idString).release();
return S_OK;
}
HRESULT STDMETHODCALLTYPE DOMHTMLElement::setIdName(
......
......@@ -79,4 +79,6 @@ interface IWebFramePrivate : IUnknown
HRESULT pendingFrameUnloadEventCount([out, retval] UINT* result);
HRESULT fetchApplicationIcon([in] IWebIconFetcherDelegate* delegate, [out, retval] IWebIconFetcher** result);
HRESULT paintDocumentRectToContext([in] RECT rect, [in] OLE_HANDLE deviceContext);
}
......@@ -32,6 +32,7 @@
#include "COMPropertyBag.h"
#include "DefaultPolicyDelegate.h"
#include "DOMCoreClasses.h"
#include "HTMLFrameOwnerElement.h"
#include "MarshallingHelpers.h"
#include "WebActionPropertyBag.h"
#include "WebChromeClient.h"
......@@ -284,6 +285,37 @@ HRESULT STDMETHODCALLTYPE WebFrame::setIsDisconnected(
return E_FAIL;
}
HRESULT STDMETHODCALLTYPE WebFrame::paintDocumentRectToContext(
/* [in] */ RECT rect,
/* [in] */ OLE_HANDLE deviceContext)
{
Frame* coreFrame = core(this);
if (!coreFrame)
return E_FAIL;
FrameView* view = coreFrame->view();
if (!view)
return E_FAIL;
// We can't paint with a layout still pending.
view->layoutIfNeededRecursive();
HDC dc = (HDC)(ULONG64)deviceContext;
GraphicsContext gc(dc);
gc.save();
LONG width = rect.right - rect.left;
LONG height = rect.bottom - rect.top;
FloatRect dirtyRect;
dirtyRect.setWidth(width);
dirtyRect.setHeight(height);
gc.clip(dirtyRect);
gc.translate(-rect.left, -rect.top);
coreFrame->paint(&gc, rect);
gc.restore();
return S_OK;
}
// IUnknown -------------------------------------------------------------------
HRESULT STDMETHODCALLTYPE WebFrame::QueryInterface(REFIID riid, void** ppvObject)
......@@ -376,10 +408,21 @@ HRESULT STDMETHODCALLTYPE WebFrame::DOMDocument(
}
HRESULT STDMETHODCALLTYPE WebFrame::frameElement(
/* [retval][out] */ IDOMHTMLElement** /*frameElement*/)
/* [retval][out] */ IDOMHTMLElement** frameElement)
{
ASSERT_NOT_REACHED();
return E_NOTIMPL;
if (!frameElement)
return E_POINTER;
*frameElement = 0;
Frame* coreFrame = core(this);
if (!coreFrame)
return E_FAIL;
COMPtr<IDOMElement> domElement(AdoptCOM, DOMElement::createInstance(coreFrame->ownerElement()));
COMPtr<IDOMHTMLElement> htmlElement(Query, domElement);
if (!htmlElement)
return E_FAIL;
return htmlElement.copyRefTo(frameElement);
}
HRESULT STDMETHODCALLTYPE WebFrame::currentForm(
......
......@@ -213,6 +213,10 @@ public:
virtual HRESULT STDMETHODCALLTYPE setIsDisconnected(
/* [in] */ BOOL flag);
virtual HRESULT STDMETHODCALLTYPE paintDocumentRectToContext(
/* [in] */ RECT rect,
/* [in] */ OLE_HANDLE deviceContext);
// IWebDocumentText
virtual HRESULT STDMETHODCALLTYPE supportsTextEncoding(
/* [retval][out] */ BOOL* result);
......
......@@ -4813,31 +4813,10 @@ HRESULT STDMETHODCALLTYPE WebView::paintDocumentRectToContext(
if (!deviceContext)
return E_POINTER;
Frame* frame = m_page->mainFrame();
if (!frame)
return E_FAIL;
FrameView* view = frame->view();
if (!view)
if (!m_mainFrame)
return E_FAIL;
// We can't paint with a layout still pending.
view->layoutIfNeededRecursive();
HDC dc = (HDC)(ULONG64)deviceContext;
GraphicsContext gc(dc);
gc.save();
LONG width = rect.right - rect.left;
LONG height = rect.bottom - rect.top;
FloatRect dirtyRect;
dirtyRect.setWidth(width);
dirtyRect.setHeight(height);
gc.clip(dirtyRect);
gc.translate(-rect.left, -rect.top);
frame->paint(&gc, rect);
gc.restore();
return S_OK;
return m_mainFrame->paintDocumentRectToContext(rect, deviceContext);
}
bool WebView::onGetObject(WPARAM wParam, LPARAM lParam, LRESULT& lResult) const
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment