diff --git a/dlls/mshtml/Makefile.in b/dlls/mshtml/Makefile.in
index d4a08038fd1..99f2e81a896 100644
--- a/dlls/mshtml/Makefile.in
+++ b/dlls/mshtml/Makefile.in
@@ -10,6 +10,7 @@ EXTRADEFS = -DCOM_NO_WINDOWS_H
C_SRCS = \
conpoint.c \
+ editor.c \
hlink.c \
htmlbody.c \
htmldoc.c \
diff --git a/dlls/mshtml/editor.c b/dlls/mshtml/editor.c
new file mode 100644
index 00000000000..64c5daf5c1c
--- /dev/null
+++ b/dlls/mshtml/editor.c
@@ -0,0 +1,233 @@
+/*
+ * Copyright 2006 Jacek Caban for CodeWeavers
+ *
+ * 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.1 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 St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include "config.h"
+
+#include
+#include
+
+#define COBJMACROS
+
+#include "windef.h"
+#include "winbase.h"
+#include "winuser.h"
+#include "winnls.h"
+#include "ole2.h"
+
+#include "wine/debug.h"
+#include "wine/unicode.h"
+
+#include "mshtml_private.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
+
+static const WCHAR wszFont[] = {'f','o','n','t',0};
+static const WCHAR wszSize[] = {'s','i','z','e',0};
+
+static nsISelection *get_ns_selection(HTMLDocument *This)
+{
+ nsIDOMWindow *dom_window;
+ nsISelection *nsselection = NULL;
+ nsresult nsres;
+
+ if(!This->nscontainer)
+ return NULL;
+
+ nsres = nsIWebBrowser_GetContentDOMWindow(This->nscontainer->webbrowser, &dom_window);
+ if(NS_FAILED(nsres))
+ return NULL;
+
+ nsIDOMWindow_GetSelection(dom_window, &nsselection);
+ nsIDOMWindow_Release(dom_window);
+
+ return nsselection;
+
+}
+
+static void remove_child_attr(nsIDOMElement *elem, LPCWSTR tag, nsAString *attr_str)
+{
+ PRBool has_children;
+ PRUint32 child_cnt, i;
+ nsIDOMNode *child_node;
+ nsIDOMNodeList *node_list;
+ PRUint16 node_type;
+
+ nsIDOMElement_HasChildNodes(elem, &has_children);
+ if(!has_children)
+ return;
+
+ nsIDOMElement_GetChildNodes(elem, &node_list);
+ nsIDOMNodeList_GetLength(node_list, &child_cnt);
+
+ for(i=0; inscontainer->navigation, &nsdoc);
+ if(NS_FAILED(nsres))
+ return;
+
+ nsAString_Init(&font_str, wszFont);
+ nsAString_Init(&size_str, wszSize);
+ nsAString_Init(&val_str, size);
+
+ nsISelection_GetRangeCount(nsselection, &range_cnt);
+ if(range_cnt != 1)
+ FIXME("range_cnt %d not supprted\n", range_cnt);
+
+ nsIDOMDocument_CreateElement(nsdoc, &font_str, &elem);
+ nsIDOMElement_SetAttribute(elem, &size_str, &val_str);
+
+ nsISelection_GetRangeAt(nsselection, 0, &range);
+ nsISelection_GetIsCollapsed(nsselection, &collapsed);
+ nsISelection_RemoveAllRanges(nsselection);
+
+ nsIDOMRange_SurroundContents(range, (nsIDOMNode*)elem);
+
+ if(collapsed) {
+ nsISelection_Collapse(nsselection, (nsIDOMNode*)elem, 0);
+ }else {
+ /* Remove all size attrbutes from the range */
+ remove_child_attr(elem, wszFont, &size_str);
+ nsISelection_SelectAllChildren(nsselection, (nsIDOMNode*)elem);
+ }
+
+ nsIDOMRange_Release(range);
+ nsIDOMElement_Release(elem);
+
+ nsAString_Finish(&font_str);
+ nsAString_Finish(&size_str);
+ nsAString_Finish(&val_str);
+
+ nsISelection_Release(nsselection);
+ nsIDOMDocument_Release(nsdoc);
+}
diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h
index 452a53cb044..52a913b90ec 100644
--- a/dlls/mshtml/mshtml_private.h
+++ b/dlls/mshtml/mshtml_private.h
@@ -350,6 +350,10 @@ void release_nodes(HTMLDocument*);
void install_wine_gecko(void);
+/* editor */
+void get_font_size(HTMLDocument*,WCHAR*);
+void set_font_size(HTMLDocument*,LPCWSTR);
+
extern DWORD mshtml_tls;
typedef struct task_t {
diff --git a/dlls/mshtml/nsiface.idl b/dlls/mshtml/nsiface.idl
index e03ee4a4132..f0a3f054f85 100644
--- a/dlls/mshtml/nsiface.idl
+++ b/dlls/mshtml/nsiface.idl
@@ -105,7 +105,6 @@ typedef nsISupports nsIDOMEntityReference;
typedef nsISupports nsIDOMHTMLFormElement;
typedef nsISupports nsIDOMHTMLOptionsCollection;
typedef nsISupports nsIDOMHTMLCollection;
-typedef nsISupports nsIDOMRange;
typedef nsISupports nsIEditor;
typedef nsISupports nsIWebProgressListener;
typedef nsISupports nsIDOMCSSValue;
@@ -615,6 +614,38 @@ interface nsIDOMHTMLDocument : nsIDOMDocument
nsresult GetElementsByName(const nsAString *elementName, nsIDOMNodeList **_retval);
}
+[
+ object,
+ uuid(a6cf90ce-15b3-11d2-932e-00805f8add32)
+]
+interface nsIDOMRange : nsISupports
+{
+ nsresult GetStartContainer(nsIDOMNode **aStartContainer);
+ nsresult GetStartOffset(PRInt32 *aStartOffset);
+ nsresult GetEndContainer(nsIDOMNode **aEndContainer);
+ nsresult GetEndOffset(PRInt32 *aEndOffset);
+ nsresult GetCollapsed(PRBool *aCollapsed);
+ nsresult GetCommonAncestorContainer(nsIDOMNode **aCommonAncestorContainer);
+ nsresult SetStart(nsIDOMNode *refNode, PRInt32 offset);
+ nsresult SetEnd(nsIDOMNode *refNode, PRInt32 offset);
+ nsresult SetStartBefore(nsIDOMNode *refNode);
+ nsresult SetStartAfter(nsIDOMNode *refNode);
+ nsresult SetEndBefore(nsIDOMNode *refNode);
+ nsresult SetEndAfter(nsIDOMNode *refNode);
+ nsresult Collapse(PRBool toStart);
+ nsresult SelectNode(nsIDOMNode *refNode);
+ nsresult SelectNodeContents(nsIDOMNode *refNode);
+ nsresult CompareBoundaryPoints(PRUint16 how, nsIDOMRange *sourceRange, PRInt16 *_retval);
+ nsresult DeleteContents();
+ nsresult ExtractContents(nsIDOMDocumentFragment **_retval);
+ nsresult CloneContents(nsIDOMDocumentFragment **_retval);
+ nsresult InsertNode(nsIDOMNode *newNode);
+ nsresult SurroundContents(nsIDOMNode *newParent);
+ nsresult CloneRange(nsIDOMRange **_retval);
+ nsresult ToString(nsAString *_retval);
+ nsresult Detach();
+}
+
[
object,
uuid(b2c7ed59-8634-4352-9e37-5484c8b6e4e1)
diff --git a/dlls/mshtml/olecmd.c b/dlls/mshtml/olecmd.c
index 8714a6e1921..cdfce498d3a 100644
--- a/dlls/mshtml/olecmd.c
+++ b/dlls/mshtml/olecmd.c
@@ -34,6 +34,7 @@
#include "mshtmcid.h"
#include "wine/debug.h"
+#include "wine/unicode.h"
#include "mshtml_private.h"
@@ -464,8 +465,43 @@ static HRESULT exec_forecolor(HTMLDocument *This, VARIANT *in, VARIANT *out)
static HRESULT exec_fontsize(HTMLDocument *This, VARIANT *in, VARIANT *out)
{
- FIXME("(%p)->(%p %p)\n", This, in, out);
- return E_NOTIMPL;
+ TRACE("(%p)->(%p %p)\n", This, in, out);
+
+ if(out) {
+ WCHAR val[10] = {0};
+
+ switch(V_VT(out)) {
+ case VT_I4:
+ get_font_size(This, val);
+ V_I4(out) = strtolW(val, NULL, 10);
+ break;
+ case VT_BSTR:
+ get_font_size(This, val);
+ V_BSTR(out) = SysAllocString(val);
+ break;
+ default:
+ FIXME("unsupported vt %d\n", V_VT(out));
+ }
+ }
+
+ if(in) {
+ switch(V_VT(in)) {
+ case VT_I4: {
+ WCHAR size[10];
+ static const WCHAR format[] = {'%','d',0};
+ wsprintfW(size, format, V_I4(in));
+ set_font_size(This, size);
+ break;
+ }
+ case VT_BSTR:
+ set_font_size(This, V_BSTR(in));
+ break;
+ default:
+ FIXME("unsupported vt %d\n", V_VT(out));
+ }
+ }
+
+ return S_OK;
}
static HRESULT exec_bold(HTMLDocument *This)