Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
573d612d
Commit
573d612d
authored
May 10, 2007
by
Jacek Caban
Committed by
Alexandre Julliard
May 10, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mshtml: Reimplement IHTMTxtRange on top of nsIDOMRange.
parent
a543e60d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
45 additions
and
21 deletions
+45
-21
mshtml_private.h
dlls/mshtml/mshtml_private.h
+1
-1
selection.c
dlls/mshtml/selection.c
+15
-1
txtrange.c
dlls/mshtml/txtrange.c
+29
-19
No files found.
dlls/mshtml/mshtml_private.h
View file @
573d612d
...
...
@@ -351,7 +351,7 @@ void set_document_bscallback(HTMLDocument*,BSCallback*);
IHlink
*
Hlink_Create
(
void
);
IHTMLSelectionObject
*
HTMLSelectionObject_Create
(
nsISelection
*
);
IHTMLTxtRange
*
HTMLTxtRange_Create
(
nsI
Selection
*
);
IHTMLTxtRange
*
HTMLTxtRange_Create
(
nsI
DOMRange
*
);
IHTMLStyle
*
HTMLStyle_Create
(
nsIDOMCSSStyleDeclaration
*
);
IHTMLStyleSheet
*
HTMLStyleSheet_Create
(
void
);
...
...
dlls/mshtml/selection.c
View file @
573d612d
...
...
@@ -139,10 +139,24 @@ static HRESULT WINAPI HTMLSelectionObject_Invoke(IHTMLSelectionObject *iface, DI
static
HRESULT
WINAPI
HTMLSelectionObject_createRange
(
IHTMLSelectionObject
*
iface
,
IDispatch
**
range
)
{
HTMLSelectionObject
*
This
=
HTMLSELOBJ_THIS
(
iface
);
nsIDOMRange
*
nsrange
=
NULL
;
TRACE
(
"(%p)->(%p)
\n
"
,
This
,
range
);
*
range
=
(
IDispatch
*
)
HTMLTxtRange_Create
(
This
->
nsselection
);
if
(
This
->
nsselection
)
{
PRInt32
nsrange_cnt
=
0
;
nsresult
nsres
;
nsISelection_GetRangeCount
(
This
->
nsselection
,
&
nsrange_cnt
);
if
(
nsrange_cnt
!=
1
)
FIXME
(
"range_cnt = %d
\n
"
,
nsrange_cnt
);
nsres
=
nsISelection_GetRangeAt
(
This
->
nsselection
,
0
,
&
nsrange
);
if
(
NS_FAILED
(
nsres
))
ERR
(
"GetRangeAt failed: %08x
\n
"
,
nsres
);
}
*
range
=
(
IDispatch
*
)
HTMLTxtRange_Create
(
nsrange
);
return
S_OK
;
}
...
...
dlls/mshtml/txtrange.c
View file @
573d612d
...
...
@@ -41,7 +41,7 @@ typedef struct {
LONG
ref
;
nsI
Selection
*
nsselection
;
nsI
DOMRange
*
nsrange
;
}
HTMLTxtRange
;
#define HTMLTXTRANGE(x) ((IHTMLTxtRange*) &(x)->lpHTMLTxtRangeVtbl)
...
...
@@ -92,8 +92,8 @@ static ULONG WINAPI HTMLTxtRange_Release(IHTMLTxtRange *iface)
TRACE
(
"(%p) ref=%d
\n
"
,
This
,
ref
);
if
(
!
ref
)
{
if
(
This
->
ns
selection
)
nsISelection_Release
(
This
->
ns
selection
);
if
(
This
->
ns
range
)
nsISelection_Release
(
This
->
ns
range
);
mshtml_free
(
This
);
}
...
...
@@ -152,25 +152,35 @@ static HRESULT WINAPI HTMLTxtRange_put_text(IHTMLTxtRange *iface, BSTR v)
static
HRESULT
WINAPI
HTMLTxtRange_get_text
(
IHTMLTxtRange
*
iface
,
BSTR
*
p
)
{
HTMLTxtRange
*
This
=
HTMLTXTRANGE_THIS
(
iface
);
PRUnichar
*
nstext
=
NULL
;
nsresult
nsres
;
TRACE
(
"(%p)->(%p)
\n
"
,
This
,
p
);
if
(
!
This
->
nsselection
)
{
static
const
WCHAR
empty
[]
=
{
0
};
*
p
=
SysAllocString
(
empty
);
return
S_OK
;
*
p
=
NULL
;
if
(
This
->
nsrange
)
{
nsAString
text_str
;
nsresult
nsres
;
nsAString_Init
(
&
text_str
,
NULL
);
nsres
=
nsIDOMRange_ToString
(
This
->
nsrange
,
&
text_str
);
if
(
NS_SUCCEEDED
(
nsres
))
{
const
PRUnichar
*
nstext
;
nsAString_GetData
(
&
text_str
,
&
nstext
,
NULL
);
*
p
=
SysAllocString
(
nstext
);
}
else
{
ERR
(
"ToString failed: %08x
\n
"
,
nsres
);
}
nsAString_Finish
(
&
text_str
);
}
nsres
=
nsISelection_ToString
(
This
->
nsselection
,
&
nstext
);
if
(
NS_FAILED
(
nsres
)
||
!
nstext
)
{
ERR
(
"toString failed: %08x
\n
"
,
nsres
);
return
E_FAIL
;
if
(
!*
p
)
{
static
const
WCHAR
empty
[]
=
{
0
};
*
p
=
SysAllocString
(
empty
);
}
*
p
=
SysAllocString
(
nstext
);
nsfree
(
nstext
);
return
S_OK
;
}
...
...
@@ -422,16 +432,16 @@ static const IHTMLTxtRangeVtbl HTMLTxtRangeVtbl = {
HTMLTxtRange_execCommandShowHelp
};
IHTMLTxtRange
*
HTMLTxtRange_Create
(
nsI
Selection
*
nsselection
)
IHTMLTxtRange
*
HTMLTxtRange_Create
(
nsI
DOMRange
*
nsrange
)
{
HTMLTxtRange
*
ret
=
mshtml_alloc
(
sizeof
(
HTMLTxtRange
));
ret
->
lpHTMLTxtRangeVtbl
=
&
HTMLTxtRangeVtbl
;
ret
->
ref
=
1
;
if
(
ns
selection
)
nsI
Selection_AddRef
(
nsselection
);
ret
->
ns
selection
=
nsselection
;
if
(
ns
range
)
nsI
DOMRange_AddRef
(
nsrange
);
ret
->
ns
range
=
nsrange
;
return
HTMLTXTRANGE
(
ret
);
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment