<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[178965] trunk</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/178965">178965</a></dd>
<dt>Author</dt> <dd>bfulgham@apple.com</dd>
<dt>Date</dt> <dd>2015-01-22 15:46:41 -0800 (Thu, 22 Jan 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>[Win] Expose missing editing features through WebView interface
https://bugs.webkit.org/show_bug.cgi?id=140773
<rdar://problem/19565421>
Reviewed by Dean Jackson.
Connect the various WebView editing delegate methods to our
test infrastructure. Also prefer _bstr_t to raw BSTR types
to simplify life cycle management.
Source/WebKit/win:
* DOMCoreClasses.cpp: Flesh out the DOMRange object.
(DOMElement::createInstance):
(DOMRange::QueryInterface):
(DOMRange::DOMRange):
(DOMRange::~DOMRange):
(DOMRange::createInstance):
(DOMRange::startContainer):
(DOMRange::startOffset):
(DOMRange::endContainer):
(DOMRange::endOffset):
(DOMRange::collapsed):
(DOMRange::commonAncestorContainer):
(DOMRange::setStart):
(DOMRange::setEnd):
(DOMRange::setStartBefore):
(DOMRange::setStartAfter):
(DOMRange::setEndBefore):
(DOMRange::setEndAfter):
(DOMRange::collapse):
(DOMRange::selectNode):
(DOMRange::selectNodeContents):
(DOMRange::compareBoundaryPoints):
(DOMRange::deleteContents):
(DOMRange::extractContents):
(DOMRange::cloneContents):
(DOMRange::insertNode):
(DOMRange::surroundContents):
(DOMRange::cloneRange):
(DOMRange::toString):
(DOMRange::detach):
* DOMCoreClasses.h:
(DOMRange::AddRef):
(DOMRange::Release):
(DOMRange::throwException):
(DOMRange::callWebScriptMethod):
(DOMRange::evaluateWebScript):
(DOMRange::removeWebScriptKey):
(DOMRange::stringRepresentation):
(DOMRange::webScriptValueAtIndex):
(DOMRange::setWebScriptValueAtIndex):
(DOMRange::setException):
* Interfaces/IWebEditingDelegate.idl:
* Interfaces/IWebView.idl:
* WebCoreSupport/WebEditorClient.cpp: Connect more methods
to actual editing features in WebCore.
(WebEditorClient::shouldBeginEditing):
(WebEditorClient::shouldEndEditing):
(WebEditorClient::didBeginEditing):
(WebEditorClient::respondToChangedContents):
(WebEditorClient::respondToChangedSelection):
(WebEditorClient::didEndEditing):
(WebEditorClient::shouldDeleteRange):
(WebEditorClient::shouldInsertNode):
(WebEditorClient::shouldInsertText):
(WebEditorClient::shouldChangeSelectedRange):
(WebEditorClient::webViewDidChangeTypingStyle):
(WebEditorClient::webViewDidChangeSelection):
(WebEditorClient::isSelectTrailingWhitespaceEnabled):
* WebView.cpp:
(WebView::setEditingDelegate): Added.
Tools:
* DumpRenderTree/win/DumpRenderTree.cpp:
(resetWebViewToConsistentStateBeforeTesting):
* DumpRenderTree/win/EditingDelegate.cpp:
(EditingDelegate::QueryInterface):
(dumpPath):
(dump):
(EditingDelegate::shouldBeginEditingInDOMRange):
(EditingDelegate::shouldEndEditingInDOMRange):
(EditingDelegate::shouldInsertNode):
(EditingDelegate::shouldInsertText):
(EditingDelegate::shouldDeleteDOMRange):
(EditingDelegate::shouldChangeSelectedDOMRange):
(EditingDelegate::shouldApplyStyle):
(EditingDelegate::shouldChangeTypingStyle):
(EditingDelegate::doPlatformCommand):
(EditingDelegate::webViewDidBeginEditing):
(EditingDelegate::webViewDidChange):
(EditingDelegate::webViewDidEndEditing):
(EditingDelegate::webViewDidChangeTypingStyle):
(EditingDelegate::webViewDidChangeSelection):
(EditingDelegate::checkSpellingOfString):
(EditingDelegate::onNotify):
* DumpRenderTree/win/EditingDelegate.h:</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebKitwinChangeLog">trunk/Source/WebKit/win/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitwinDOMCoreClassescpp">trunk/Source/WebKit/win/DOMCoreClasses.cpp</a></li>
<li><a href="#trunkSourceWebKitwinDOMCoreClassesh">trunk/Source/WebKit/win/DOMCoreClasses.h</a></li>
<li><a href="#trunkSourceWebKitwinInterfacesIWebEditingDelegateidl">trunk/Source/WebKit/win/Interfaces/IWebEditingDelegate.idl</a></li>
<li><a href="#trunkSourceWebKitwinInterfacesIWebViewidl">trunk/Source/WebKit/win/Interfaces/IWebView.idl</a></li>
<li><a href="#trunkSourceWebKitwinWebCoreSupportWebEditorClientcpp">trunk/Source/WebKit/win/WebCoreSupport/WebEditorClient.cpp</a></li>
<li><a href="#trunkSourceWebKitwinWebViewcpp">trunk/Source/WebKit/win/WebView.cpp</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsDumpRenderTreewinDumpRenderTreecpp">trunk/Tools/DumpRenderTree/win/DumpRenderTree.cpp</a></li>
<li><a href="#trunkToolsDumpRenderTreewinEditingDelegatecpp">trunk/Tools/DumpRenderTree/win/EditingDelegate.cpp</a></li>
<li><a href="#trunkToolsDumpRenderTreewinEditingDelegateh">trunk/Tools/DumpRenderTree/win/EditingDelegate.h</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKitwinChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/win/ChangeLog (178964 => 178965)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/win/ChangeLog        2015-01-22 23:42:46 UTC (rev 178964)
+++ trunk/Source/WebKit/win/ChangeLog        2015-01-22 23:46:41 UTC (rev 178965)
</span><span class="lines">@@ -1,3 +1,76 @@
</span><ins>+2015-01-22 Brent Fulgham <bfulgham@apple.com>
+
+ [Win] Expose missing editing features through WebView interface
+ https://bugs.webkit.org/show_bug.cgi?id=140773
+ <rdar://problem/19565421>
+
+ Reviewed by Dean Jackson.
+
+ Connect the various WebView editing delegate methods to our
+ test infrastructure. Also prefer _bstr_t to raw BSTR types
+ to simplify life cycle management.
+
+ * DOMCoreClasses.cpp: Flesh out the DOMRange object.
+ (DOMElement::createInstance):
+ (DOMRange::QueryInterface):
+ (DOMRange::DOMRange):
+ (DOMRange::~DOMRange):
+ (DOMRange::createInstance):
+ (DOMRange::startContainer):
+ (DOMRange::startOffset):
+ (DOMRange::endContainer):
+ (DOMRange::endOffset):
+ (DOMRange::collapsed):
+ (DOMRange::commonAncestorContainer):
+ (DOMRange::setStart):
+ (DOMRange::setEnd):
+ (DOMRange::setStartBefore):
+ (DOMRange::setStartAfter):
+ (DOMRange::setEndBefore):
+ (DOMRange::setEndAfter):
+ (DOMRange::collapse):
+ (DOMRange::selectNode):
+ (DOMRange::selectNodeContents):
+ (DOMRange::compareBoundaryPoints):
+ (DOMRange::deleteContents):
+ (DOMRange::extractContents):
+ (DOMRange::cloneContents):
+ (DOMRange::insertNode):
+ (DOMRange::surroundContents):
+ (DOMRange::cloneRange):
+ (DOMRange::toString):
+ (DOMRange::detach):
+ * DOMCoreClasses.h:
+ (DOMRange::AddRef):
+ (DOMRange::Release):
+ (DOMRange::throwException):
+ (DOMRange::callWebScriptMethod):
+ (DOMRange::evaluateWebScript):
+ (DOMRange::removeWebScriptKey):
+ (DOMRange::stringRepresentation):
+ (DOMRange::webScriptValueAtIndex):
+ (DOMRange::setWebScriptValueAtIndex):
+ (DOMRange::setException):
+ * Interfaces/IWebEditingDelegate.idl:
+ * Interfaces/IWebView.idl:
+ * WebCoreSupport/WebEditorClient.cpp: Connect more methods
+ to actual editing features in WebCore.
+ (WebEditorClient::shouldBeginEditing):
+ (WebEditorClient::shouldEndEditing):
+ (WebEditorClient::didBeginEditing):
+ (WebEditorClient::respondToChangedContents):
+ (WebEditorClient::respondToChangedSelection):
+ (WebEditorClient::didEndEditing):
+ (WebEditorClient::shouldDeleteRange):
+ (WebEditorClient::shouldInsertNode):
+ (WebEditorClient::shouldInsertText):
+ (WebEditorClient::shouldChangeSelectedRange):
+ (WebEditorClient::webViewDidChangeTypingStyle):
+ (WebEditorClient::webViewDidChangeSelection):
+ (WebEditorClient::isSelectTrailingWhitespaceEnabled):
+ * WebView.cpp:
+ (WebView::setEditingDelegate): Added.
+
</ins><span class="cx"> 2015-01-21 Brent Fulgham <bfulgham@apple.com>
</span><span class="cx">
</span><span class="cx"> [Win] eventSender does not support scalePageBy
</span></span></pre></div>
<a id="trunkSourceWebKitwinDOMCoreClassescpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/win/DOMCoreClasses.cpp (178964 => 178965)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/win/DOMCoreClasses.cpp        2015-01-22 23:42:46 UTC (rev 178964)
+++ trunk/Source/WebKit/win/DOMCoreClasses.cpp        2015-01-22 23:46:41 UTC (rev 178965)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2006, 2007, 2009 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2006, 2007, 2009, 2014-2015 Apple Inc. All rights reserved.
</ins><span class="cx"> *
</span><span class="cx"> * Redistribution and use in source and binary forms, with or without
</span><span class="cx"> * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -47,6 +47,7 @@
</span><span class="cx"> #include <WebCore/HTMLSelectElement.h>
</span><span class="cx"> #include <WebCore/HTMLTextAreaElement.h>
</span><span class="cx"> #include <WebCore/NodeList.h>
</span><ins>+#include <WebCore/Range.h>
</ins><span class="cx"> #include <WebCore/RenderElement.h>
</span><span class="cx"> #include <WebCore/RenderTreeAsText.h>
</span><span class="cx">
</span><span class="lines">@@ -1530,3 +1531,212 @@
</span><span class="cx">
</span><span class="cx"> return domElement;
</span><span class="cx"> }
</span><ins>+
+// DOMRange - IUnknown -----------------------------------------------------
+
+HRESULT DOMRange::QueryInterface(REFIID riid, void** ppvObject)
+{
+ *ppvObject = nullptr;
+ if (IsEqualGUID(riid, IID_IDOMRange))
+ *ppvObject = static_cast<IDOMRange*>(this);
+ else
+ return DOMObject::QueryInterface(riid, ppvObject);
+
+ AddRef();
+ return S_OK;
+}
+
+// DOMRange -----------------------------------------------------------------
+
+DOMRange::DOMRange(WebCore::Range* e)
+ : m_range(e)
+{
+}
+
+DOMRange::~DOMRange()
+{
+}
+
+IDOMRange* DOMRange::createInstance(WebCore::Range* range)
+{
+ if (!range)
+ return nullptr;
+
+ DOMRange* newRange = new DOMRange(range);
+
+ IDOMRange* domRange = nullptr;
+ if (FAILED(newRange->QueryInterface(IID_IDOMRange, reinterpret_cast<void**>(&domRange))))
+ return nullptr;
+
+ return newRange;
+}
+
+HRESULT DOMRange::startContainer(IDOMNode** node)
+{
+ if (!node)
+ return E_POINTER;
+
+ if (!m_range)
+ return E_UNEXPECTED;
+
+ *node = DOMNode::createInstance(m_range->startContainer());
+
+ return S_OK;
+}
+
+HRESULT DOMRange::startOffset(int* offset)
+{
+ if (!offset)
+ return E_POINTER;
+
+ if (!m_range)
+ return E_UNEXPECTED;
+
+ *offset = m_range->startOffset();
+
+ return S_OK;
+}
+
+HRESULT DOMRange::endContainer(IDOMNode** node)
+{
+ if (!node)
+ return E_POINTER;
+
+ if (!m_range)
+ return E_UNEXPECTED;
+
+ *node = DOMNode::createInstance(m_range->endContainer());
+
+ return S_OK;
+}
+
+HRESULT DOMRange::endOffset(int* offset)
+{
+ if (!offset)
+ return E_POINTER;
+
+ if (!m_range)
+ return E_UNEXPECTED;
+
+ *offset = m_range->endOffset();
+
+ return S_OK;
+}
+
+HRESULT DOMRange::collapsed(BOOL* result)
+{
+ if (!result)
+ return E_POINTER;
+
+ if (!m_range)
+ return E_UNEXPECTED;
+
+ WebCore::ExceptionCode ec = 0;
+ *result = m_range->collapsed(ec);
+
+ return S_OK;
+}
+
+HRESULT DOMRange::commonAncestorContainer(IDOMNode** container)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT DOMRange::setStart(IDOMNode* refNode, int offset)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT DOMRange::setEnd(IDOMNode* refNode, int offset)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT DOMRange::setStartBefore(IDOMNode* refNode)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT DOMRange::setStartAfter(IDOMNode* refNode)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT DOMRange::setEndBefore(IDOMNode* refNode)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT DOMRange::setEndAfter(IDOMNode* refNode)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT DOMRange::collapse(BOOL toStart)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT DOMRange::selectNode(IDOMNode* refNode)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT DOMRange::selectNodeContents(IDOMNode* refNode)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT DOMRange::compareBoundaryPoints(unsigned short how, IDOMRange* sourceRange)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT DOMRange::deleteContents()
+{
+ return E_NOTIMPL;
+}
+
+HRESULT DOMRange::extractContents(IDOMDocumentFragment** fragment)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT DOMRange::cloneContents(IDOMDocumentFragment** fragment)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT DOMRange::insertNode(IDOMNode* newNode)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT DOMRange::surroundContents(IDOMNode* newParent)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT DOMRange::cloneRange(IDOMRange** range)
+{
+ return E_NOTIMPL;
+}
+
+HRESULT DOMRange::toString(BSTR* str)
+{
+ if (!str)
+ return E_POINTER;
+
+ if (!m_range)
+ return E_UNEXPECTED;
+
+ WebCore::ExceptionCode ec = 0;
+ *str = BString(m_range->toString(ec)).release();
+
+ return S_OK;
+}
+
+HRESULT DOMRange::detach()
+{
+ return E_NOTIMPL;
+}
</ins></span></pre></div>
<a id="trunkSourceWebKitwinDOMCoreClassesh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/win/DOMCoreClasses.h (178964 => 178965)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/win/DOMCoreClasses.h        2015-01-22 23:42:46 UTC (rev 178964)
+++ trunk/Source/WebKit/win/DOMCoreClasses.h        2015-01-22 23:46:41 UTC (rev 178965)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2006, 2007, 2014 Apple Inc. All rights reserved.
</ins><span class="cx"> *
</span><span class="cx"> * Redistribution and use in source and binary forms, with or without
</span><span class="cx"> * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -35,6 +35,7 @@
</span><span class="cx"> class DOMWindow;
</span><span class="cx"> class Node;
</span><span class="cx"> class NodeList;
</span><ins>+class Range;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx">
</span><span class="lines">@@ -925,4 +926,87 @@
</span><span class="cx"> WebCore::Element* m_element;
</span><span class="cx"> };
</span><span class="cx">
</span><ins>+class DOMRange : public DOMObject, public IDOMRange {
+protected:
+ DOMRange(WebCore::Range*);
+ ~DOMRange();
+
+public:
+ static IDOMRange* createInstance(WebCore::Range*);
+
+public:
+ // IUnknown
+ virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
+ virtual ULONG STDMETHODCALLTYPE AddRef(void) { return DOMObject::AddRef(); }
+ virtual ULONG STDMETHODCALLTYPE Release(void) { return DOMObject::Release(); }
+
+ // IWebScriptObject
+ virtual HRESULT STDMETHODCALLTYPE throwException(BSTR exceptionMessage, BOOL* result)
+ {
+ return DOMObject::throwException(exceptionMessage, result);
+ }
+
+ virtual HRESULT STDMETHODCALLTYPE callWebScriptMethod(BSTR name, const VARIANT args[], int cArgs, VARIANT* result)
+ {
+ return DOMObject::callWebScriptMethod(name, args, cArgs, result);
+ }
+
+ virtual HRESULT STDMETHODCALLTYPE evaluateWebScript(BSTR script, VARIANT* result)
+ {
+ return DOMObject::evaluateWebScript(script, result);
+ }
+
+ virtual HRESULT STDMETHODCALLTYPE removeWebScriptKey(BSTR name)
+ {
+ return DOMObject::removeWebScriptKey(name);
+ }
+
+ virtual HRESULT STDMETHODCALLTYPE stringRepresentation(BSTR* stringRepresentation)
+ {
+ return DOMObject::stringRepresentation(stringRepresentation);
+ }
+
+ virtual HRESULT STDMETHODCALLTYPE webScriptValueAtIndex(unsigned index, VARIANT* result)
+ {
+ return DOMObject::webScriptValueAtIndex(index, result);
+ }
+
+ virtual HRESULT STDMETHODCALLTYPE setWebScriptValueAtIndex(unsigned index, VARIANT val)
+ {
+ return DOMObject::setWebScriptValueAtIndex(index, val);
+ }
+
+ virtual HRESULT STDMETHODCALLTYPE setException(BSTR description)
+ {
+ return DOMObject::setException(description);
+ }
+
+ virtual HRESULT STDMETHODCALLTYPE startContainer(IDOMNode**);
+ virtual HRESULT STDMETHODCALLTYPE startOffset(int*);
+ virtual HRESULT STDMETHODCALLTYPE endContainer(IDOMNode**);
+ virtual HRESULT STDMETHODCALLTYPE endOffset(int*);
+ virtual HRESULT STDMETHODCALLTYPE collapsed(BOOL*);
+ virtual HRESULT STDMETHODCALLTYPE commonAncestorContainer(IDOMNode**);
+ virtual HRESULT STDMETHODCALLTYPE setStart(IDOMNode*, int offset);
+ virtual HRESULT STDMETHODCALLTYPE setEnd(IDOMNode*, int offset);
+ virtual HRESULT STDMETHODCALLTYPE setStartBefore(IDOMNode*);
+ virtual HRESULT STDMETHODCALLTYPE setStartAfter(IDOMNode*);
+ virtual HRESULT STDMETHODCALLTYPE setEndBefore(IDOMNode*);
+ virtual HRESULT STDMETHODCALLTYPE setEndAfter(IDOMNode*);
+ virtual HRESULT STDMETHODCALLTYPE collapse(BOOL);
+ virtual HRESULT STDMETHODCALLTYPE selectNode(IDOMNode*);
+ virtual HRESULT STDMETHODCALLTYPE selectNodeContents(IDOMNode*);
+ virtual HRESULT STDMETHODCALLTYPE compareBoundaryPoints(unsigned short how, IDOMRange* sourceRange);
+ virtual HRESULT STDMETHODCALLTYPE deleteContents();
+ virtual HRESULT STDMETHODCALLTYPE extractContents(IDOMDocumentFragment**);
+ virtual HRESULT STDMETHODCALLTYPE cloneContents(IDOMDocumentFragment**);
+ virtual HRESULT STDMETHODCALLTYPE insertNode(IDOMNode*);
+ virtual HRESULT STDMETHODCALLTYPE surroundContents(IDOMNode* newParent);
+ virtual HRESULT STDMETHODCALLTYPE cloneRange(IDOMRange**);
+ virtual HRESULT STDMETHODCALLTYPE toString(BSTR*);
+ virtual HRESULT STDMETHODCALLTYPE detach();
+
+protected:
+ WebCore::Range* m_range;
+};
</ins><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebKitwinInterfacesIWebEditingDelegateidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/win/Interfaces/IWebEditingDelegate.idl (178964 => 178965)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/win/Interfaces/IWebEditingDelegate.idl        2015-01-22 23:42:46 UTC (rev 178964)
+++ trunk/Source/WebKit/win/Interfaces/IWebEditingDelegate.idl        2015-01-22 23:46:41 UTC (rev 178965)
</span><span class="lines">@@ -113,7 +113,7 @@
</span><span class="cx"> /*
</span><span class="cx"> - (BOOL)webView:(WebView *)webView shouldInsertNode:(DOMNode *)node replacingDOMRange:(DOMRange *)range givenAction:(WebViewInsertAction)action;
</span><span class="cx"> */
</span><del>- HRESULT shouldInsertNode([in] IWebView* webView, [in] IDOMNode* node, [in] IDOMRange* range, [in] WebViewInsertAction action);
</del><ins>+ HRESULT shouldInsertNode([in] IWebView* webView, [in] IDOMNode* node, [in] IDOMRange* range, [in] WebViewInsertAction action, [out, retval] BOOL* result);
</ins><span class="cx">
</span><span class="cx"> /*
</span><span class="cx"> - (BOOL)webView:(WebView *)webView shouldInsertText:(NSString *)text replacingDOMRange:(DOMRange *)range givenAction:(WebViewInsertAction)action;
</span></span></pre></div>
<a id="trunkSourceWebKitwinInterfacesIWebViewidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/win/Interfaces/IWebView.idl (178964 => 178965)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/win/Interfaces/IWebView.idl        2015-01-22 23:42:46 UTC (rev 178964)
+++ trunk/Source/WebKit/win/Interfaces/IWebView.idl        2015-01-22 23:46:41 UTC (rev 178965)
</span><span class="lines">@@ -30,6 +30,10 @@
</span><span class="cx"> cpp_quote("#define WebViewProgressEstimateChangedNotification TEXT(\"WebProgressEstimateChangedNotification\")")
</span><span class="cx"> cpp_quote("#define WebViewProgressFinishedNotification TEXT(\"WebProgressFinishedNotification\")")
</span><span class="cx"> cpp_quote("#define WebViewDidChangeSelectionNotification TEXT(\"WebViewDidChangeSelectionNotification\")")
</span><ins>+cpp_quote("#define WebViewDidBeginEditingNotification TEXT(\"WebViewDidBeginEditingNotification\")")
+cpp_quote("#define WebViewDidEndEditingNotification TEXT(\"WebViewDidEndEditingNotification\")")
+cpp_quote("#define WebViewDidChangeTypingStyleNotification TEXT(\"WebViewDidChangeTypingStyleNotification\")")
+cpp_quote("#define WebViewDidChangeNotification TEXT(\"WebViewDidChangeNotification\")")
</ins><span class="cx">
</span><span class="cx"> #ifndef DO_NO_IMPORTS
</span><span class="cx"> import "oaidl.idl";
</span></span></pre></div>
<a id="trunkSourceWebKitwinWebCoreSupportWebEditorClientcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/win/WebCoreSupport/WebEditorClient.cpp (178964 => 178965)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/win/WebCoreSupport/WebEditorClient.cpp        2015-01-22 23:42:46 UTC (rev 178964)
+++ trunk/Source/WebKit/win/WebCoreSupport/WebEditorClient.cpp        2015-01-22 23:46:41 UTC (rev 178965)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2006, 2007, 2011 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2006, 2007, 2011, 2014 Apple Inc. All rights reserved.
</ins><span class="cx"> *
</span><span class="cx"> * Redistribution and use in source and binary forms, with or without
</span><span class="cx"> * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -31,6 +31,7 @@
</span><span class="cx"> #include "WebNotificationCenter.h"
</span><span class="cx"> #include "WebView.h"
</span><span class="cx"> #include "DOMCoreClasses.h"
</span><ins>+#include <comutil.h>
</ins><span class="cx"> #include <WebCore/BString.h>
</span><span class="cx"> #include <WebCore/Document.h>
</span><span class="cx"> #include <WebCore/HTMLElement.h>
</span><span class="lines">@@ -188,35 +189,57 @@
</span><span class="cx"> return 0;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool WebEditorClient::shouldBeginEditing(Range*)
</del><ins>+bool WebEditorClient::shouldBeginEditing(WebCore::Range* range)
</ins><span class="cx"> {
</span><del>- notImplemented();
- return true;
</del><ins>+ COMPtr<IWebEditingDelegate> ed;
+ if (FAILED(m_webView->editingDelegate(&ed)) || !ed.get())
+ return true;
+
+ COMPtr<IDOMRange> currentRange(AdoptCOM, DOMRange::createInstance(range));
+
+ BOOL shouldBegin = FALSE;
+ if (FAILED(ed->shouldBeginEditingInDOMRange(m_webView, currentRange.get(), &shouldBegin)))
+ return true;
+
+ return shouldBegin;
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-bool WebEditorClient::shouldEndEditing(Range*)
</del><ins>+bool WebEditorClient::shouldEndEditing(Range* range)
</ins><span class="cx"> {
</span><del>- notImplemented();
- return true;
</del><ins>+ COMPtr<IWebEditingDelegate> ed;
+ if (FAILED(m_webView->editingDelegate(&ed)) || !ed.get())
+ return true;
+
+ COMPtr<IDOMRange> currentRange(AdoptCOM, DOMRange::createInstance(range));
+
+ BOOL shouldEnd = FALSE;
+ if (FAILED(ed->shouldEndEditingInDOMRange(m_webView, currentRange.get(), &shouldEnd)))
+ return true;
+
+ return shouldEnd;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void WebEditorClient::didBeginEditing()
</span><span class="cx"> {
</span><del>- notImplemented();
</del><ins>+ static _bstr_t webViewDidBeginEditingNotificationName(WebViewDidBeginEditingNotification);
+ IWebNotificationCenter* notifyCenter = WebNotificationCenter::defaultCenterInternal();
+ notifyCenter->postNotificationName(webViewDidBeginEditingNotificationName.GetBSTR(), static_cast<IWebView*>(m_webView), nullptr);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void WebEditorClient::respondToChangedContents()
</span><span class="cx"> {
</span><del>- notImplemented();
</del><ins>+ static _bstr_t webViewDidChangeNotificationName(WebViewDidChangeNotification);
+ IWebNotificationCenter* notifyCenter = WebNotificationCenter::defaultCenterInternal();
+ notifyCenter->postNotificationName(webViewDidChangeNotificationName.GetBSTR(), static_cast<IWebView*>(m_webView), 0);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void WebEditorClient::respondToChangedSelection(Frame*)
</span><span class="cx"> {
</span><span class="cx"> m_webView->selectionChanged();
</span><span class="cx">
</span><del>- static BSTR webViewDidChangeSelectionNotificationName = SysAllocString(WebViewDidChangeSelectionNotification);
</del><ins>+ static _bstr_t webViewDidChangeSelectionNotificationName(WebViewDidChangeSelectionNotification);
</ins><span class="cx"> IWebNotificationCenter* notifyCenter = WebNotificationCenter::defaultCenterInternal();
</span><del>- notifyCenter->postNotificationName(webViewDidChangeSelectionNotificationName, static_cast<IWebView*>(m_webView), 0);
</del><ins>+ notifyCenter->postNotificationName(webViewDidChangeSelectionNotificationName.GetBSTR(), static_cast<IWebView*>(m_webView), 0);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void WebEditorClient::discardedComposition(Frame*)
</span><span class="lines">@@ -226,7 +249,9 @@
</span><span class="cx">
</span><span class="cx"> void WebEditorClient::didEndEditing()
</span><span class="cx"> {
</span><del>- notImplemented();
</del><ins>+ static _bstr_t webViewDidEndEditingNotificationName(WebViewDidEndEditingNotification);
+ IWebNotificationCenter* notifyCenter = WebNotificationCenter::defaultCenterInternal();
+ notifyCenter->postNotificationName(webViewDidEndEditingNotificationName.GetBSTR(), static_cast<IWebView*>(m_webView), nullptr);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void WebEditorClient::didWriteSelectionToPasteboard()
</span><span class="lines">@@ -244,50 +269,76 @@
</span><span class="cx"> notImplemented();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool WebEditorClient::shouldDeleteRange(Range* /*range*/)
</del><ins>+bool WebEditorClient::shouldDeleteRange(Range* range)
</ins><span class="cx"> {
</span><del>- notImplemented();
- return true;
</del><ins>+ COMPtr<IWebEditingDelegate> ed;
+ if (FAILED(m_webView->editingDelegate(&ed)) || !ed.get())
+ return true;
</ins><span class="cx">
</span><del>- // FIXME: calling m_webView->editingDelegate() will cause an assertion failure so we don't want to enable this code until that's implemented.
- //BOOL result = false;
- //IWebViewEditingDelegate* editingDelegate;
- //// FIXME: DOMRange needs to be implemented before anything meaningful can be done here
- //IDOMRange* domRange(0);
- //if (SUCCEEDED(m_webView->editingDelegate(&editingDelegate))) {
- // editingDelegate->shouldDeleteDOMRange(m_webView, domRange, &result);
- // editingDelegate->Release();
- //}
- //return !!result;
</del><ins>+ COMPtr<IDOMRange> currentRange(AdoptCOM, DOMRange::createInstance(range));
+
+ BOOL shouldDelete = FALSE;
+ if (FAILED(ed->shouldDeleteDOMRange(m_webView, currentRange.get(), &shouldDelete)))
+ return true;
+
+ return shouldDelete;
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-bool WebEditorClient::shouldInsertNode(Node* /*node*/, Range* /*replacingRange*/, EditorInsertAction /*givenAction*/)
</del><ins>+bool WebEditorClient::shouldInsertNode(Node* node, Range* insertingRange, EditorInsertAction givenAction)
</ins><span class="cx"> {
</span><del>- notImplemented();
- return true;
</del><ins>+ COMPtr<IWebEditingDelegate> editingDelegate;
+ if (FAILED(m_webView->editingDelegate(&editingDelegate)) || !editingDelegate.get())
+ return true;
+
+ COMPtr<IDOMRange> insertingDOMRange(AdoptCOM, DOMRange::createInstance(insertingRange));
+ if (!insertingDOMRange)
+ return true;
+
+ COMPtr<IDOMNode> insertDOMNode(AdoptCOM, DOMNode::createInstance(node));
+ if (!insertDOMNode)
+ return true;
+
+ BOOL shouldInsert = FALSE;
+ if (FAILED(editingDelegate->shouldInsertNode(m_webView, insertDOMNode.get(), insertingDOMRange.get(), static_cast<WebViewInsertAction>(givenAction), &shouldInsert)))
+ return true;
+
+ return shouldInsert;
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-bool WebEditorClient::shouldInsertText(const String& /*str*/, Range* /* replacingRange */, EditorInsertAction /*givenAction*/)
-{
- notImplemented();
- return true;
</del><ins>+bool WebEditorClient::shouldInsertText(const String& str, Range* insertingRange, EditorInsertAction givenAction)
+{
+ COMPtr<IWebEditingDelegate> editingDelegate;
+ if (FAILED(m_webView->editingDelegate(&editingDelegate)) || !editingDelegate.get())
+ return true;
</ins><span class="cx">
</span><del>- // FIXME: calling m_webView->editingDelegate() will cause an assertion failure so we don't want to enable this code until that's implemented.
- //BOOL result = false;
- //IWebViewEditingDelegate* editingDelegate;
- //// FIXME: DOMRange needs to be implemented before anything meaningful can be done here
- //IDOMRange* domRange(0); // make a DOMRange from replacingRange
- //BString text(str);
- //if (SUCCEEDED(m_webView->editingDelegate(&editingDelegate))) {
- // editingDelegate->shouldInsertText(m_webView, text, domRange, (WebViewInsertAction) givenAction, &result);
- // editingDelegate->Release();
- //}
- //return !!result;
</del><ins>+ COMPtr<IDOMRange> insertingDOMRange(AdoptCOM, DOMRange::createInstance(insertingRange));
+ if (!insertingDOMRange)
+ return true;
+
+ BString text(str);
+ BOOL shouldInsert = FALSE;
+ if (FAILED(editingDelegate->shouldInsertText(m_webView, text, insertingDOMRange.get(), static_cast<WebViewInsertAction>(givenAction), &shouldInsert)))
+ return true;
+
+ return shouldInsert;
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-//bool WebEditorClient::shouldChangeSelectedRange(Range *currentRange, Range *toProposedRange, SelectionAffinity selectionAffinity, bool stillSelecting)
-//{ notImplemented(); return false; }
</del><ins>+bool WebEditorClient::shouldChangeSelectedRange(WebCore::Range* currentRange, WebCore::Range* proposedRange, WebCore::EAffinity selectionAffinity, bool flag)
+{
+ COMPtr<IWebEditingDelegate> ed;
+ if (FAILED(m_webView->editingDelegate(&ed)) || !ed.get())
+ return true;
</ins><span class="cx">
</span><ins>+ COMPtr<IDOMRange> currentIDOMRange(AdoptCOM, DOMRange::createInstance(currentRange));
+ COMPtr<IDOMRange> proposedIDOMRange(AdoptCOM, DOMRange::createInstance(proposedRange));
+
+ BOOL shouldChange = FALSE;
+ if (FAILED(ed->shouldChangeSelectedDOMRange(m_webView, currentIDOMRange.get(), proposedIDOMRange.get(), static_cast<WebSelectionAffinity>(selectionAffinity), flag, &shouldChange)))
+ return true;
+
+ return shouldChange;
+}
+
</ins><span class="cx"> bool WebEditorClient::shouldApplyStyle(StyleProperties* /*style*/, Range* /*toElementsInDOMRange*/)
</span><span class="cx"> { notImplemented(); return true; }
</span><span class="cx">
</span><span class="lines">@@ -298,10 +349,14 @@
</span><span class="cx"> { notImplemented(); return false; }
</span><span class="cx">
</span><span class="cx"> void WebEditorClient::webViewDidChangeTypingStyle(WebNotification* /*notification*/)
</span><del>-{ notImplemented(); }
</del><ins>+{
+ notImplemented();
+}
</ins><span class="cx">
</span><span class="cx"> void WebEditorClient::webViewDidChangeSelection(WebNotification* /*notification*/)
</span><del>-{ notImplemented(); }
</del><ins>+{
+ notImplemented();
+}
</ins><span class="cx">
</span><span class="cx"> bool WebEditorClient::smartInsertDeleteEnabled(void)
</span><span class="cx"> {
</span><span class="lines">@@ -319,9 +374,6 @@
</span><span class="cx"> return page->settings().selectTrailingWhitespaceEnabled();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool WebEditorClient::shouldChangeSelectedRange(WebCore::Range*, WebCore::Range*, WebCore::EAffinity, bool)
-{ notImplemented(); return true; }
-
</del><span class="cx"> void WebEditorClient::textFieldDidBeginEditing(Element* e)
</span><span class="cx"> {
</span><span class="cx"> IWebFormDelegate* formDelegate;
</span></span></pre></div>
<a id="trunkSourceWebKitwinWebViewcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/win/WebView.cpp (178964 => 178965)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/win/WebView.cpp        2015-01-22 23:42:46 UTC (rev 178964)
+++ trunk/Source/WebKit/win/WebView.cpp        2015-01-22 23:46:41 UTC (rev 178965)
</span><span class="lines">@@ -4340,10 +4340,39 @@
</span><span class="cx"> return E_NOTIMPL;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-HRESULT STDMETHODCALLTYPE WebView::setEditingDelegate(
- /* [in] */ IWebEditingDelegate* d)
</del><ins>+HRESULT WebView::setEditingDelegate(IWebEditingDelegate* d)
</ins><span class="cx"> {
</span><ins>+ if (m_editingDelegate == d)
+ return S_OK;
+
+ static BSTR webViewDidBeginEditingNotificationName = SysAllocString(WebViewDidBeginEditingNotification);
+ static BSTR webViewDidChangeSelectionNotificationName = SysAllocString(WebViewDidChangeSelectionNotification);
+ static BSTR webViewDidEndEditingNotificationName = SysAllocString(WebViewDidEndEditingNotification);
+ static BSTR webViewDidChangeTypingStyleNotificationName = SysAllocString(WebViewDidChangeTypingStyleNotification);
+ static BSTR webViewDidChangeNotificationName = SysAllocString(WebViewDidChangeNotification);
+
+ IWebNotificationCenter* notifyCenter = WebNotificationCenter::defaultCenterInternal();
+
+ COMPtr<IWebNotificationObserver> wasObserver(Query, m_editingDelegate);
+ if (wasObserver) {
+ notifyCenter->removeObserver(wasObserver.get(), webViewDidBeginEditingNotificationName, nullptr);
+ notifyCenter->removeObserver(wasObserver.get(), webViewDidChangeSelectionNotificationName, nullptr);
+ notifyCenter->removeObserver(wasObserver.get(), webViewDidEndEditingNotificationName, nullptr);
+ notifyCenter->removeObserver(wasObserver.get(), webViewDidChangeTypingStyleNotificationName, nullptr);
+ notifyCenter->removeObserver(wasObserver.get(), webViewDidChangeNotificationName, nullptr);
+ }
+
</ins><span class="cx"> m_editingDelegate = d;
</span><ins>+
+ COMPtr<IWebNotificationObserver> isObserver(Query, m_editingDelegate);
+ if (isObserver) {
+ notifyCenter->addObserver(isObserver.get(), webViewDidBeginEditingNotificationName, nullptr);
+ notifyCenter->addObserver(isObserver.get(), webViewDidChangeSelectionNotificationName, nullptr);
+ notifyCenter->addObserver(isObserver.get(), webViewDidEndEditingNotificationName, nullptr);
+ notifyCenter->addObserver(isObserver.get(), webViewDidChangeTypingStyleNotificationName, nullptr);
+ notifyCenter->addObserver(isObserver.get(), webViewDidChangeNotificationName, nullptr);
+ }
+
</ins><span class="cx"> return S_OK;
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (178964 => 178965)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2015-01-22 23:42:46 UTC (rev 178964)
+++ trunk/Tools/ChangeLog        2015-01-22 23:46:41 UTC (rev 178965)
</span><span class="lines">@@ -1,3 +1,39 @@
</span><ins>+2015-01-22 Brent Fulgham <bfulgham@apple.com>
+
+ [Win] Expose missing editing features through WebView interface
+ https://bugs.webkit.org/show_bug.cgi?id=140773
+ <rdar://problem/19565421>
+
+ Reviewed by Dean Jackson.
+
+ Connect the various WebView editing delegate methods to our
+ test infrastructure. Also prefer _bstr_t to raw BSTR types
+ to simplify life cycle management.
+
+ * DumpRenderTree/win/DumpRenderTree.cpp:
+ (resetWebViewToConsistentStateBeforeTesting):
+ * DumpRenderTree/win/EditingDelegate.cpp:
+ (EditingDelegate::QueryInterface):
+ (dumpPath):
+ (dump):
+ (EditingDelegate::shouldBeginEditingInDOMRange):
+ (EditingDelegate::shouldEndEditingInDOMRange):
+ (EditingDelegate::shouldInsertNode):
+ (EditingDelegate::shouldInsertText):
+ (EditingDelegate::shouldDeleteDOMRange):
+ (EditingDelegate::shouldChangeSelectedDOMRange):
+ (EditingDelegate::shouldApplyStyle):
+ (EditingDelegate::shouldChangeTypingStyle):
+ (EditingDelegate::doPlatformCommand):
+ (EditingDelegate::webViewDidBeginEditing):
+ (EditingDelegate::webViewDidChange):
+ (EditingDelegate::webViewDidEndEditing):
+ (EditingDelegate::webViewDidChangeTypingStyle):
+ (EditingDelegate::webViewDidChangeSelection):
+ (EditingDelegate::checkSpellingOfString):
+ (EditingDelegate::onNotify):
+ * DumpRenderTree/win/EditingDelegate.h:
+
</ins><span class="cx"> 2015-01-22 Ryosuke Niwa <rniwa@webkit.org>
</span><span class="cx">
</span><span class="cx"> Add a build flag for ES6 class syntax
</span></span></pre></div>
<a id="trunkToolsDumpRenderTreewinDumpRenderTreecpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/DumpRenderTree/win/DumpRenderTree.cpp (178964 => 178965)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/DumpRenderTree/win/DumpRenderTree.cpp        2015-01-22 23:42:46 UTC (rev 178964)
+++ trunk/Tools/DumpRenderTree/win/DumpRenderTree.cpp        2015-01-22 23:46:41 UTC (rev 178965)
</span><span class="lines">@@ -866,6 +866,19 @@
</span><span class="cx"> if (FAILED(frame->webView(&webView)))
</span><span class="cx"> return;
</span><span class="cx">
</span><ins>+ COMPtr<IWebViewEditing> viewEditing;
+ if (SUCCEEDED(webView->QueryInterface(&viewEditing)) && viewEditing) {
+
+ viewEditing->setEditable(FALSE);
+
+ COMPtr<IWebEditingDelegate> delegate;
+ if (SUCCEEDED(viewEditing->editingDelegate(&delegate)) && delegate) {
+ COMPtr<EditingDelegate> editingDelegate(Query, viewEditing.get());
+ if (editingDelegate)
+ editingDelegate->setAcceptsEditing(TRUE);
+ }
+ }
+
</ins><span class="cx"> COMPtr<IWebIBActions> webIBActions(Query, webView);
</span><span class="cx"> if (webIBActions) {
</span><span class="cx"> webIBActions->makeTextStandardSize(0);
</span></span></pre></div>
<a id="trunkToolsDumpRenderTreewinEditingDelegatecpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/DumpRenderTree/win/EditingDelegate.cpp (178964 => 178965)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/DumpRenderTree/win/EditingDelegate.cpp        2015-01-22 23:42:46 UTC (rev 178964)
+++ trunk/Tools/DumpRenderTree/win/EditingDelegate.cpp        2015-01-22 23:46:41 UTC (rev 178965)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2007, 2014 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2007, 2014-2015 Apple Inc. All rights reserved.
</ins><span class="cx"> *
</span><span class="cx"> * Redistribution and use in source and binary forms, with or without
</span><span class="cx"> * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -35,6 +35,7 @@
</span><span class="cx"> #include <WebCore/COMPtr.h>
</span><span class="cx"> #include <wtf/Assertions.h>
</span><span class="cx"> #include <wtf/Platform.h>
</span><ins>+#include <wtf/StringExtras.h>
</ins><span class="cx"> #include <string>
</span><span class="cx"> #include <tchar.h>
</span><span class="cx">
</span><span class="lines">@@ -54,6 +55,8 @@
</span><span class="cx"> *ppvObject = static_cast<IWebEditingDelegate*>(this);
</span><span class="cx"> else if (IsEqualGUID(riid, IID_IWebEditingDelegate))
</span><span class="cx"> *ppvObject = static_cast<IWebEditingDelegate*>(this);
</span><ins>+ else if (IsEqualGUID(riid, IID_IWebNotificationObserver))
+ *ppvObject = static_cast<IWebNotificationObserver*>(this);
</ins><span class="cx"> else
</span><span class="cx"> return E_NOINTERFACE;
</span><span class="cx">
</span><span class="lines">@@ -75,46 +78,47 @@
</span><span class="cx"> return newRef;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-static wstring dumpPath(IDOMNode* node)
</del><ins>+static std::string dumpPath(IDOMNode* node)
</ins><span class="cx"> {
</span><span class="cx"> ASSERT(node);
</span><span class="cx">
</span><del>- wstring result;
</del><ins>+ std::string result;
</ins><span class="cx">
</span><span class="cx"> _bstr_t name;
</span><span class="cx"> if (FAILED(node->nodeName(&name.GetBSTR())))
</span><span class="cx"> return result;
</span><del>- result.assign(static_cast<wchar_t*>(name), name.length());
</del><ins>+ result.assign(static_cast<const char*>(name), name.length());
</ins><span class="cx">
</span><span class="cx"> COMPtr<IDOMNode> parent;
</span><span class="cx"> if (SUCCEEDED(node->parentNode(&parent)))
</span><del>- result += TEXT(" > ") + dumpPath(parent.get());
</del><ins>+ result += " > " + dumpPath(parent.get());
</ins><span class="cx">
</span><span class="cx"> return result;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-static wstring dump(IDOMRange* range)
</del><ins>+static std::string dump(IDOMRange* range)
</ins><span class="cx"> {
</span><del>- ASSERT(range);
</del><ins>+ if (!range)
+ return std::string();
</ins><span class="cx">
</span><span class="cx"> int startOffset;
</span><span class="cx"> if (FAILED(range->startOffset(&startOffset)))
</span><del>- return 0;
</del><ins>+ return std::string();
</ins><span class="cx">
</span><span class="cx"> int endOffset;
</span><span class="cx"> if (FAILED(range->endOffset(&endOffset)))
</span><del>- return 0;
</del><ins>+ return std::string();
</ins><span class="cx">
</span><span class="cx"> COMPtr<IDOMNode> startContainer;
</span><span class="cx"> if (FAILED(range->startContainer(&startContainer)))
</span><del>- return 0;
</del><ins>+ return std::string();
</ins><span class="cx">
</span><span class="cx"> COMPtr<IDOMNode> endContainer;
</span><span class="cx"> if (FAILED(range->endContainer(&endContainer)))
</span><del>- return 0;
</del><ins>+ return std::string();
</ins><span class="cx">
</span><del>- wchar_t buffer[1024];
- _snwprintf(buffer, ARRAYSIZE(buffer), L"range from %ld of %s to %ld of %s", startOffset, dumpPath(startContainer.get()).c_str(), endOffset, dumpPath(endContainer.get()).c_str());
</del><ins>+ char buffer[1024];
+ snprintf(buffer, ARRAYSIZE(buffer), "range from %ld of %s to %ld of %s", startOffset, dumpPath(startContainer.get()).c_str(), endOffset, dumpPath(endContainer.get()).c_str());
</ins><span class="cx"> return buffer;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -126,7 +130,7 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if (::gTestRunner->dumpEditingCallbacks() && !done)
</span><del>- _tprintf(TEXT("EDITING DELEGATE: shouldBeginEditingInDOMRange:%s\n"), dump(range).c_str());
</del><ins>+ printf("EDITING DELEGATE: shouldBeginEditingInDOMRange:%s\n", dump(range).c_str());
</ins><span class="cx">
</span><span class="cx"> *result = m_acceptsEditing;
</span><span class="cx"> return S_OK;
</span><span class="lines">@@ -140,23 +144,24 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if (::gTestRunner->dumpEditingCallbacks() && !done)
</span><del>- _tprintf(TEXT("EDITING DELEGATE: shouldEndEditingInDOMRange:%s\n"), dump(range).c_str());
</del><ins>+ printf("EDITING DELEGATE: shouldEndEditingInDOMRange:%s\n", dump(range).c_str());
</ins><span class="cx">
</span><span class="cx"> *result = m_acceptsEditing;
</span><span class="cx"> return S_OK;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-HRESULT EditingDelegate::shouldInsertNode(IWebView* /*webView*/, IDOMNode* node, IDOMRange* range, WebViewInsertAction action)
</del><ins>+HRESULT EditingDelegate::shouldInsertNode(IWebView* /*webView*/, IDOMNode* node, IDOMRange* range, WebViewInsertAction action, BOOL* result)
</ins><span class="cx"> {
</span><del>- static LPCTSTR insertactionstring[] = {
- TEXT("WebViewInsertActionTyped"),
- TEXT("WebViewInsertActionPasted"),
- TEXT("WebViewInsertActionDropped"),
</del><ins>+ static const char* insertActionString[] = {
+ "WebViewInsertActionTyped",
+ "WebViewInsertActionPasted",
+ "WebViewInsertActionDropped",
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> if (::gTestRunner->dumpEditingCallbacks() && !done)
</span><del>- _tprintf(TEXT("EDITING DELEGATE: shouldInsertNode:%s replacingDOMRange:%s givenAction:%s\n"), dumpPath(node).c_str(), dump(range).c_str(), insertactionstring[action]);
</del><ins>+ printf("EDITING DELEGATE: shouldInsertNode:%s replacingDOMRange:%s givenAction:%s\n", dumpPath(node).c_str(), dump(range).c_str(), insertActionString[action]);
</ins><span class="cx">
</span><ins>+ *result = m_acceptsEditing;
</ins><span class="cx"> return S_OK;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -167,14 +172,16 @@
</span><span class="cx"> return E_POINTER;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- static LPCTSTR insertactionstring[] = {
- TEXT("WebViewInsertActionTyped"),
- TEXT("WebViewInsertActionPasted"),
- TEXT("WebViewInsertActionDropped"),
</del><ins>+ static const char* insertactionstring[] = {
+ "WebViewInsertActionTyped",
+ "WebViewInsertActionPasted",
+ "WebViewInsertActionDropped",
</ins><span class="cx"> };
</span><span class="cx">
</span><del>- if (::gTestRunner->dumpEditingCallbacks() && !done)
- _tprintf(TEXT("EDITING DELEGATE: shouldInsertText:%s replacingDOMRange:%s givenAction:%s\n"), text ? text : TEXT(""), dump(range).c_str(), insertactionstring[action]);
</del><ins>+ if (::gTestRunner->dumpEditingCallbacks() && !done) {
+ _bstr_t textBstr(text);
+ printf("EDITING DELEGATE: shouldInsertText:%s replacingDOMRange:%s givenAction:%s\n", static_cast<const char*>(textBstr), dump(range).c_str(), insertactionstring[action]);
+ }
</ins><span class="cx">
</span><span class="cx"> *result = m_acceptsEditing;
</span><span class="cx"> return S_OK;
</span><span class="lines">@@ -188,7 +195,7 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if (::gTestRunner->dumpEditingCallbacks() && !done)
</span><del>- _tprintf(TEXT("EDITING DELEGATE: shouldDeleteDOMRange:%s\n"), dump(range).c_str());
</del><ins>+ printf("EDITING DELEGATE: shouldDeleteDOMRange:%s\n", dump(range).c_str());
</ins><span class="cx">
</span><span class="cx"> *result = m_acceptsEditing;
</span><span class="cx"> return S_OK;
</span><span class="lines">@@ -202,17 +209,17 @@
</span><span class="cx"> return E_POINTER;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- static LPCTSTR affinitystring[] = {
- TEXT("NSSelectionAffinityUpstream"),
- TEXT("NSSelectionAffinityDownstream")
</del><ins>+ static const char* affinityString[] = {
+ "NSSelectionAffinityUpstream",
+ "NSSelectionAffinityDownstream"
</ins><span class="cx"> };
</span><del>- static LPCTSTR boolstring[] = {
- TEXT("FALSE"),
- TEXT("TRUE")
</del><ins>+ static const char* boolstring[] = {
+ "FALSE",
+ "TRUE"
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> if (::gTestRunner->dumpEditingCallbacks() && !done)
</span><del>- _tprintf(TEXT("EDITING DELEGATE: shouldChangeSelectedDOMRange:%s toDOMRange:%s affinity:%s stillSelecting:%s\n"), dump(currentRange).c_str(), dump(proposedRange).c_str(), affinitystring[selectionAffinity], boolstring[stillSelecting]);
</del><ins>+ printf("EDITING DELEGATE: shouldChangeSelectedDOMRange:%s toDOMRange:%s affinity:%s stillSelecting:%s\n", dump(currentRange).c_str(), dump(proposedRange).c_str(), affinityString[selectionAffinity], boolstring[stillSelecting]);
</ins><span class="cx">
</span><span class="cx"> *result = m_acceptsEditing;
</span><span class="cx"> return S_OK;
</span><span class="lines">@@ -226,7 +233,7 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if (::gTestRunner->dumpEditingCallbacks() && !done)
</span><del>- _tprintf(TEXT("EDITING DELEGATE: shouldApplyStyle:%s toElementsInDOMRange:%s\n"), TEXT("'style description'")/*[[style description] UTF8String]*/, dump(range).c_str());
</del><ins>+ printf("EDITING DELEGATE: shouldApplyStyle:%s toElementsInDOMRange:%s\n", "'style description'"/*[[style description] UTF8String]*/, dump(range).c_str());
</ins><span class="cx">
</span><span class="cx"> *result = m_acceptsEditing;
</span><span class="cx"> return S_OK;
</span><span class="lines">@@ -240,7 +247,7 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if (::gTestRunner->dumpEditingCallbacks() && !done)
</span><del>- _tprintf(TEXT("EDITING DELEGATE: shouldChangeTypingStyle:%s toStyle:%s\n"), TEXT("'currentStyle description'"), TEXT("'proposedStyle description'"));
</del><ins>+ printf("EDITING DELEGATE: shouldChangeTypingStyle:%s toStyle:%s\n", "'currentStyle description'", "'proposedStyle description'");
</ins><span class="cx">
</span><span class="cx"> *result = m_acceptsEditing;
</span><span class="cx"> return S_OK;
</span><span class="lines">@@ -253,8 +260,10 @@
</span><span class="cx"> return E_POINTER;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- if (::gTestRunner->dumpEditingCallbacks() && !done)
- _tprintf(TEXT("EDITING DELEGATE: doPlatformCommand:%s\n"), command ? command : TEXT(""));
</del><ins>+ if (::gTestRunner->dumpEditingCallbacks() && !done) {
+ _bstr_t commandBSTR(command);
+ printf("EDITING DELEGATE: doPlatformCommand:%s\n", static_cast<const char*>(commandBSTR));
+ }
</ins><span class="cx">
</span><span class="cx"> *result = m_acceptsEditing;
</span><span class="cx"> return S_OK;
</span><span class="lines">@@ -265,7 +274,7 @@
</span><span class="cx"> if (::gTestRunner->dumpEditingCallbacks() && !done) {
</span><span class="cx"> _bstr_t name;
</span><span class="cx"> notification->name(&name.GetBSTR());
</span><del>- _tprintf(TEXT("EDITING DELEGATE: webViewDidBeginEditing:%s\n"), static_cast<TCHAR*>(name));
</del><ins>+ printf("EDITING DELEGATE: webViewDidBeginEditing:%s\n", static_cast<const char*>(name));
</ins><span class="cx"> }
</span><span class="cx"> return S_OK;
</span><span class="cx"> }
</span><span class="lines">@@ -275,7 +284,7 @@
</span><span class="cx"> if (::gTestRunner->dumpEditingCallbacks() && !done) {
</span><span class="cx"> _bstr_t name;
</span><span class="cx"> notification->name(&name.GetBSTR());
</span><del>- _tprintf(TEXT("EDITING DELEGATE: webViewDidBeginEditing:%s\n"), static_cast<TCHAR*>(name));
</del><ins>+ printf("EDITING DELEGATE: webViewDidChange:%s\n", static_cast<const char*>(name));
</ins><span class="cx"> }
</span><span class="cx"> return S_OK;
</span><span class="cx"> }
</span><span class="lines">@@ -285,7 +294,7 @@
</span><span class="cx"> if (::gTestRunner->dumpEditingCallbacks() && !done) {
</span><span class="cx"> _bstr_t name;
</span><span class="cx"> notification->name(&name.GetBSTR());
</span><del>- _tprintf(TEXT("EDITING DELEGATE: webViewDidEndEditing:%s\n"), static_cast<TCHAR*>(name));
</del><ins>+ printf("EDITING DELEGATE: webViewDidEndEditing:%s\n", static_cast<const char*>(name));
</ins><span class="cx"> }
</span><span class="cx"> return S_OK;
</span><span class="cx"> }
</span><span class="lines">@@ -295,7 +304,7 @@
</span><span class="cx"> if (::gTestRunner->dumpEditingCallbacks() && !done) {
</span><span class="cx"> _bstr_t name;
</span><span class="cx"> notification->name(&name.GetBSTR());
</span><del>- _tprintf(TEXT("EDITING DELEGATE: webViewDidChangeTypingStyle:%s\n"), static_cast<TCHAR*>(name));
</del><ins>+ printf("EDITING DELEGATE: webViewDidChangeTypingStyle:%s\n", static_cast<const char*>(name));
</ins><span class="cx"> }
</span><span class="cx"> return S_OK;
</span><span class="cx"> }
</span><span class="lines">@@ -305,7 +314,7 @@
</span><span class="cx"> if (::gTestRunner->dumpEditingCallbacks() && !done) {
</span><span class="cx"> _bstr_t name;
</span><span class="cx"> notification->name(&name.GetBSTR());
</span><del>- _tprintf(TEXT("EDITING DELEGATE: webViewDidChangeSelection:%s\n"), static_cast<TCHAR*>(name));
</del><ins>+ printf("EDITING DELEGATE: webViewDidChangeSelection:%s\n", static_cast<const char*>(name));
</ins><span class="cx"> }
</span><span class="cx"> return S_OK;
</span><span class="cx"> }
</span><span class="lines">@@ -378,3 +387,34 @@
</span><span class="cx">
</span><span class="cx"> return S_OK;
</span><span class="cx"> }
</span><ins>+
+HRESULT EditingDelegate::onNotify(IWebNotification* notification)
+{
+ _bstr_t notificationName;
+ HRESULT hr = notification->name(&notificationName.GetBSTR());
+ if (FAILED(hr))
+ return hr;
+
+ static _bstr_t webViewDidBeginEditingNotificationName(WebViewDidBeginEditingNotification);
+ static _bstr_t webViewDidChangeSelectionNotificationName(WebViewDidChangeSelectionNotification);
+ static _bstr_t webViewDidEndEditingNotificationName(WebViewDidEndEditingNotification);
+ static _bstr_t webViewDidChangeTypingStyleNotificationName(WebViewDidChangeTypingStyleNotification);
+ static _bstr_t webViewDidChangeNotificationName(WebViewDidChangeNotification);
+
+ if (!wcscmp(notificationName, webViewDidBeginEditingNotificationName))
+ return webViewDidBeginEditing(notification);
+
+ if (!wcscmp(notificationName, webViewDidChangeSelectionNotificationName))
+ return webViewDidChangeSelection(notification);
+
+ if (!wcscmp(notificationName, webViewDidEndEditingNotificationName))
+ return webViewDidEndEditing(notification);
+
+ if (!wcscmp(notificationName, webViewDidChangeTypingStyleNotificationName))
+ return webViewDidChangeTypingStyle(notification);
+
+ if (!wcscmp(notificationName, webViewDidChangeNotificationName))
+ return webViewDidChange(notification);
+
+ return S_OK;
+}
</ins></span></pre></div>
<a id="trunkToolsDumpRenderTreewinEditingDelegateh"></a>
<div class="modfile"><h4>Modified: trunk/Tools/DumpRenderTree/win/EditingDelegate.h (178964 => 178965)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/DumpRenderTree/win/EditingDelegate.h        2015-01-22 23:42:46 UTC (rev 178964)
+++ trunk/Tools/DumpRenderTree/win/EditingDelegate.h        2015-01-22 23:46:41 UTC (rev 178965)
</span><span class="lines">@@ -31,7 +31,7 @@
</span><span class="cx">
</span><span class="cx"> #include <WebKit/WebKit.h>
</span><span class="cx">
</span><del>-class __declspec(uuid("265DCD4B-79C3-44a2-84BC-511C3EDABD6F")) EditingDelegate : public IWebEditingDelegate {
</del><ins>+class __declspec(uuid("265DCD4B-79C3-44a2-84BC-511C3EDABD6F")) EditingDelegate : public IWebEditingDelegate, public IWebNotificationObserver {
</ins><span class="cx"> public:
</span><span class="cx"> EditingDelegate();
</span><span class="cx">
</span><span class="lines">@@ -53,11 +53,7 @@
</span><span class="cx"> /* [in] */ IDOMRange *range,
</span><span class="cx"> /* [retval][out] */ BOOL *result);
</span><span class="cx">
</span><del>- virtual HRESULT STDMETHODCALLTYPE shouldInsertNode(
- /* [in] */ IWebView *webView,
- /* [in] */ IDOMNode *node,
- /* [in] */ IDOMRange *range,
- /* [in] */ WebViewInsertAction action);
</del><ins>+ virtual HRESULT STDMETHODCALLTYPE shouldInsertNode(IWebView*, IDOMNode*, IDOMRange*, WebViewInsertAction, BOOL* result);
</ins><span class="cx">
</span><span class="cx"> virtual HRESULT STDMETHODCALLTYPE shouldInsertText(
</span><span class="cx"> /* [in] */ IWebView *webView,
</span><span class="lines">@@ -168,6 +164,9 @@
</span><span class="cx">
</span><span class="cx"> virtual HRESULT STDMETHODCALLTYPE updateGrammar( void) { return E_NOTIMPL; }
</span><span class="cx">
</span><ins>+ // IWebNotificationObserver
+ virtual HRESULT STDMETHODCALLTYPE onNotify(IWebNotification* notification);
+
</ins><span class="cx"> private:
</span><span class="cx"> bool m_acceptsEditing;
</span><span class="cx"> ULONG m_refCount;
</span></span></pre>
</div>
</div>
</body>
</html>