mirror of
https://github.com/reactos/wine.git
synced 2024-11-25 12:49:45 +00:00
mshtml: Fixed hr element handling in range object.
This commit is contained in:
parent
8c686f9d00
commit
0bc9f9a7d5
@ -38,6 +38,7 @@
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
|
||||
|
||||
static const WCHAR brW[] = {'b','r',0};
|
||||
static const WCHAR hrW[] = {'h','r',0};
|
||||
|
||||
typedef struct {
|
||||
const IHTMLTxtRangeVtbl *lpHTMLTxtRangeVtbl;
|
||||
@ -132,7 +133,7 @@ static PRUint16 get_node_type(nsIDOMNode *node)
|
||||
return type;
|
||||
}
|
||||
|
||||
static BOOL is_br_node(nsIDOMNode *node)
|
||||
static BOOL is_elem_tag(nsIDOMNode *node, LPCWSTR istag)
|
||||
{
|
||||
nsIDOMElement *elem;
|
||||
nsAString tag_str;
|
||||
@ -149,8 +150,31 @@ static BOOL is_br_node(nsIDOMNode *node)
|
||||
nsIDOMElement_Release(elem);
|
||||
nsAString_GetData(&tag_str, &tag);
|
||||
|
||||
if(!strcmpiW(tag, brW))
|
||||
ret = TRUE;
|
||||
ret = !strcmpiW(tag, istag);
|
||||
|
||||
nsAString_Finish(&tag_str);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static BOOL is_space_elem(nsIDOMNode *node)
|
||||
{
|
||||
nsIDOMElement *elem;
|
||||
nsAString tag_str;
|
||||
const PRUnichar *tag;
|
||||
BOOL ret = FALSE;
|
||||
nsresult nsres;
|
||||
|
||||
nsres = nsIDOMNode_QueryInterface(node, &IID_nsIDOMElement, (void**)&elem);
|
||||
if(NS_FAILED(nsres))
|
||||
return FALSE;
|
||||
|
||||
nsAString_Init(&tag_str, NULL);
|
||||
nsIDOMElement_GetTagName(elem, &tag_str);
|
||||
nsIDOMElement_Release(elem);
|
||||
nsAString_GetData(&tag_str, &tag);
|
||||
|
||||
ret = !strcmpiW(tag, brW) || !strcmpiW(tag, hrW);
|
||||
|
||||
nsAString_Finish(&tag_str);
|
||||
|
||||
@ -242,9 +266,12 @@ static void wstrbuf_append_node(wstrbuf_t *buf, nsIDOMNode *node)
|
||||
break;
|
||||
}
|
||||
case ELEMENT_NODE:
|
||||
if(is_br_node(node)) {
|
||||
if(is_elem_tag(node, brW)) {
|
||||
static const WCHAR endlW[] = {'\r','\n'};
|
||||
wstrbuf_append_len(buf, endlW, 2);
|
||||
}else if(is_elem_tag(node, hrW)) {
|
||||
static const WCHAR endl2W[] = {'\r','\n','\r','\n'};
|
||||
wstrbuf_append_len(buf, endl2W, 4);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -524,7 +551,7 @@ static WCHAR get_pos_char(const dompos_t *pos)
|
||||
case TEXT_NODE:
|
||||
return pos->p[pos->off];
|
||||
case ELEMENT_NODE:
|
||||
if(is_br_node(pos->node))
|
||||
if(is_space_elem(pos->node))
|
||||
return '\n';
|
||||
}
|
||||
|
||||
@ -634,7 +661,7 @@ static WCHAR next_char(const dompos_t *pos, dompos_t *new_pos)
|
||||
return *p;
|
||||
|
||||
case ELEMENT_NODE:
|
||||
if(!is_br_node(iter))
|
||||
if(!is_space_elem(iter))
|
||||
break;
|
||||
|
||||
if(cspace)
|
||||
@ -718,7 +745,7 @@ static WCHAR prev_char(HTMLTxtRange *This, const dompos_t *pos, dompos_t *new_po
|
||||
}
|
||||
|
||||
case ELEMENT_NODE:
|
||||
if(!is_br_node(iter))
|
||||
if(!is_space_elem(iter))
|
||||
break;
|
||||
|
||||
if(skip_space) {
|
||||
|
Loading…
Reference in New Issue
Block a user