mshtml: Moved selection_list to HTMLDocumentNode object.
This commit is contained in:
parent
b827996515
commit
068489fb94
|
@ -428,8 +428,7 @@ static HRESULT WINAPI HTMLDocument_get_selection(IHTMLDocument2 *iface, IHTMLSel
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
*p = HTMLSelectionObject_Create(This, nsselection);
|
return HTMLSelectionObject_Create(This->doc_node, nsselection, p);
|
||||||
return S_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI HTMLDocument_get_readyState(IHTMLDocument2 *iface, BSTR *p)
|
static HRESULT WINAPI HTMLDocument_get_readyState(IHTMLDocument2 *iface, BSTR *p)
|
||||||
|
@ -1741,7 +1740,6 @@ static void init_doc(HTMLDocument *doc, const htmldoc_vtbl_t *vtbl)
|
||||||
doc->readystate = READYSTATE_UNINITIALIZED;
|
doc->readystate = READYSTATE_UNINITIALIZED;
|
||||||
|
|
||||||
list_init(&doc->bindings);
|
list_init(&doc->bindings);
|
||||||
list_init(&doc->selection_list);
|
|
||||||
list_init(&doc->range_list);
|
list_init(&doc->range_list);
|
||||||
|
|
||||||
HTMLDocument_HTMLDocument3_Init(doc);
|
HTMLDocument_HTMLDocument3_Init(doc);
|
||||||
|
@ -1787,7 +1785,6 @@ static void destroy_htmldoc(HTMLDocument *This)
|
||||||
release_event_target(This->event_target);
|
release_event_target(This->event_target);
|
||||||
|
|
||||||
heap_free(This->mime);
|
heap_free(This->mime);
|
||||||
detach_selection(This);
|
|
||||||
detach_ranges(This);
|
detach_ranges(This);
|
||||||
release_nodes(This);
|
release_nodes(This);
|
||||||
release_dispex(&This->dispex);
|
release_dispex(&This->dispex);
|
||||||
|
@ -1825,6 +1822,7 @@ static ULONG HTMLDocumentNode_Release(HTMLDocument *base)
|
||||||
TRACE("(%p) ref = %u\n", This, ref);
|
TRACE("(%p) ref = %u\n", This, ref);
|
||||||
|
|
||||||
if(!ref) {
|
if(!ref) {
|
||||||
|
detach_selection(This);
|
||||||
destroy_htmldoc(&This->basedoc);
|
destroy_htmldoc(&This->basedoc);
|
||||||
heap_free(This);
|
heap_free(This);
|
||||||
}
|
}
|
||||||
|
@ -1859,6 +1857,8 @@ HRESULT create_doc_from_nsdoc(nsIDOMHTMLDocument *nsdoc, HTMLDocumentObj *doc_ob
|
||||||
|
|
||||||
doc->basedoc.window = window;
|
doc->basedoc.window = window;
|
||||||
|
|
||||||
|
list_init(&doc->selection_list);
|
||||||
|
|
||||||
*ret = doc;
|
*ret = doc;
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -320,7 +320,6 @@ struct HTMLDocument {
|
||||||
ConnectionPoint cp_htmldocevents2;
|
ConnectionPoint cp_htmldocevents2;
|
||||||
ConnectionPoint cp_propnotif;
|
ConnectionPoint cp_propnotif;
|
||||||
|
|
||||||
struct list selection_list;
|
|
||||||
struct list range_list;
|
struct list range_list;
|
||||||
|
|
||||||
HTMLDOMNode *nodes;
|
HTMLDOMNode *nodes;
|
||||||
|
@ -345,6 +344,8 @@ struct HTMLDocumentNode {
|
||||||
HTMLDocument basedoc;
|
HTMLDocument basedoc;
|
||||||
|
|
||||||
LONG ref;
|
LONG ref;
|
||||||
|
|
||||||
|
struct list selection_list;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct HTMLDocumentObj {
|
struct HTMLDocumentObj {
|
||||||
|
@ -635,13 +636,13 @@ HRESULT channelbsc_load_stream(nsChannelBSC*,IStream*);
|
||||||
void channelbsc_set_channel(nsChannelBSC*,nsChannel*,nsIStreamListener*,nsISupports*);
|
void channelbsc_set_channel(nsChannelBSC*,nsChannel*,nsIStreamListener*,nsISupports*);
|
||||||
IMoniker *get_channelbsc_mon(nsChannelBSC*);
|
IMoniker *get_channelbsc_mon(nsChannelBSC*);
|
||||||
|
|
||||||
IHTMLSelectionObject *HTMLSelectionObject_Create(HTMLDocument*,nsISelection*);
|
HRESULT HTMLSelectionObject_Create(HTMLDocumentNode*,nsISelection*,IHTMLSelectionObject**);
|
||||||
IHTMLTxtRange *HTMLTxtRange_Create(HTMLDocument*,nsIDOMRange*);
|
IHTMLTxtRange *HTMLTxtRange_Create(HTMLDocument*,nsIDOMRange*);
|
||||||
IHTMLStyle *HTMLStyle_Create(nsIDOMCSSStyleDeclaration*);
|
IHTMLStyle *HTMLStyle_Create(nsIDOMCSSStyleDeclaration*);
|
||||||
IHTMLStyleSheet *HTMLStyleSheet_Create(nsIDOMStyleSheet*);
|
IHTMLStyleSheet *HTMLStyleSheet_Create(nsIDOMStyleSheet*);
|
||||||
IHTMLStyleSheetsCollection *HTMLStyleSheetsCollection_Create(nsIDOMStyleSheetList*);
|
IHTMLStyleSheetsCollection *HTMLStyleSheetsCollection_Create(nsIDOMStyleSheetList*);
|
||||||
|
|
||||||
void detach_selection(HTMLDocument*);
|
void detach_selection(HTMLDocumentNode*);
|
||||||
void detach_ranges(HTMLDocument*);
|
void detach_ranges(HTMLDocument*);
|
||||||
HRESULT get_node_text(HTMLDOMNode*,BSTR*);
|
HRESULT get_node_text(HTMLDOMNode*,BSTR*);
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ typedef struct {
|
||||||
LONG ref;
|
LONG ref;
|
||||||
|
|
||||||
nsISelection *nsselection;
|
nsISelection *nsselection;
|
||||||
HTMLDocument *doc;
|
HTMLDocumentNode *doc;
|
||||||
|
|
||||||
struct list entry;
|
struct list entry;
|
||||||
} HTMLSelectionObject;
|
} HTMLSelectionObject;
|
||||||
|
@ -154,12 +154,12 @@ static HRESULT WINAPI HTMLSelectionObject_createRange(IHTMLSelectionObject *ifac
|
||||||
|
|
||||||
TRACE("nsrange_cnt = 0\n");
|
TRACE("nsrange_cnt = 0\n");
|
||||||
|
|
||||||
if(!This->doc->nsdoc) {
|
if(!This->doc->basedoc.nsdoc) {
|
||||||
WARN("nsdoc is NULL\n");
|
WARN("nsdoc is NULL\n");
|
||||||
return E_UNEXPECTED;
|
return E_UNEXPECTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsres = nsIDOMHTMLDocument_GetBody(This->doc->nsdoc, &nsbody);
|
nsres = nsIDOMHTMLDocument_GetBody(This->doc->basedoc.nsdoc, &nsbody);
|
||||||
if(NS_FAILED(nsres) || !nsbody) {
|
if(NS_FAILED(nsres) || !nsbody) {
|
||||||
ERR("Could not get body: %08x\n", nsres);
|
ERR("Could not get body: %08x\n", nsres);
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
|
@ -178,7 +178,7 @@ static HRESULT WINAPI HTMLSelectionObject_createRange(IHTMLSelectionObject *ifac
|
||||||
ERR("GetRangeAt failed: %08x\n", nsres);
|
ERR("GetRangeAt failed: %08x\n", nsres);
|
||||||
}
|
}
|
||||||
|
|
||||||
*range = (IDispatch*)HTMLTxtRange_Create(This->doc, nsrange);
|
*range = (IDispatch*)HTMLTxtRange_Create(&This->doc->basedoc, nsrange);
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -230,21 +230,26 @@ static const IHTMLSelectionObjectVtbl HTMLSelectionObjectVtbl = {
|
||||||
HTMLSelectionObject_get_type
|
HTMLSelectionObject_get_type
|
||||||
};
|
};
|
||||||
|
|
||||||
IHTMLSelectionObject *HTMLSelectionObject_Create(HTMLDocument *doc, nsISelection *nsselection)
|
HRESULT HTMLSelectionObject_Create(HTMLDocumentNode *doc, nsISelection *nsselection, IHTMLSelectionObject **ret)
|
||||||
{
|
{
|
||||||
HTMLSelectionObject *ret = heap_alloc(sizeof(HTMLSelectionObject));
|
HTMLSelectionObject *selection;
|
||||||
|
|
||||||
ret->lpHTMLSelectionObjectVtbl = &HTMLSelectionObjectVtbl;
|
selection = heap_alloc(sizeof(HTMLSelectionObject));
|
||||||
ret->ref = 1;
|
if(!selection)
|
||||||
ret->nsselection = nsselection; /* We shouldn't call AddRef here */
|
return E_OUTOFMEMORY;
|
||||||
|
|
||||||
ret->doc = doc;
|
selection->lpHTMLSelectionObjectVtbl = &HTMLSelectionObjectVtbl;
|
||||||
list_add_head(&doc->selection_list, &ret->entry);
|
selection->ref = 1;
|
||||||
|
selection->nsselection = nsselection; /* We shouldn't call AddRef here */
|
||||||
|
|
||||||
return HTMLSELOBJ(ret);
|
selection->doc = doc;
|
||||||
|
list_add_head(&doc->selection_list, &selection->entry);
|
||||||
|
|
||||||
|
*ret = HTMLSELOBJ(selection);
|
||||||
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void detach_selection(HTMLDocument *This)
|
void detach_selection(HTMLDocumentNode *This)
|
||||||
{
|
{
|
||||||
HTMLSelectionObject *iter;
|
HTMLSelectionObject *iter;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue