зеркало из https://github.com/mozilla/pjs.git
perignon now compiles, and back out brendan's xp.h change
This commit is contained in:
Родитель
a1ad0f723b
Коммит
2886b9a12f
|
@ -29,6 +29,7 @@ CSRCS = domattr.c \
|
||||||
domdoc.c \
|
domdoc.c \
|
||||||
domelement.c \
|
domelement.c \
|
||||||
domnode.c \
|
domnode.c \
|
||||||
|
domstyle.c \
|
||||||
domtext.c \
|
domtext.c \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,10 @@
|
||||||
#define DOM_PRIV_H
|
#define DOM_PRIV_H
|
||||||
|
|
||||||
#include "dom.h"
|
#include "dom.h"
|
||||||
#include "xp.h"
|
#include "xp_mem.h"
|
||||||
|
#include "xpassert.h"
|
||||||
|
#include "xp_str.h"
|
||||||
|
/* #include "xp.h" -- this pulls in half the freaking client...no thanks! */
|
||||||
|
|
||||||
JSObject *
|
JSObject *
|
||||||
dom_NodeInit(JSContext *cx, JSObject *obj);
|
dom_NodeInit(JSContext *cx, JSObject *obj);
|
||||||
|
|
|
@ -168,6 +168,7 @@ JSClass DOM_DOMClass = {
|
||||||
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, dom_finalize
|
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, dom_finalize
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#if 0
|
||||||
static JSBool
|
static JSBool
|
||||||
dom_hasFeature(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
|
dom_hasFeature(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
|
||||||
jsval *rval)
|
jsval *rval)
|
||||||
|
@ -188,4 +189,5 @@ static JSFunctionSpec dom_methods[] = {
|
||||||
{"hasFeature", dom_hasFeature, 2},
|
{"hasFeature", dom_hasFeature, 2},
|
||||||
{0}
|
{0}
|
||||||
};
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -1,223 +0,0 @@
|
||||||
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
|
||||||
*
|
|
||||||
* The contents of this file are subject to the Netscape Public License
|
|
||||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
|
||||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
|
||||||
* http://www.mozilla.org/NPL/
|
|
||||||
*
|
|
||||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
|
||||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
|
||||||
* for the specific language governing rights and limitations under the
|
|
||||||
* NPL.
|
|
||||||
*
|
|
||||||
* The Original Code is Mozilla Communicator client code.
|
|
||||||
*
|
|
||||||
* The Initial Developer of this code under the NPL is Netscape
|
|
||||||
* Communications Corporation. Portions created by Netscape are
|
|
||||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
|
||||||
* Reserved.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* DOM Document, DocumentFragment implementation.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "dom_priv.h"
|
|
||||||
|
|
||||||
typedef struct DOM_DocumentFragmentStruct {
|
|
||||||
DOM_Node node;
|
|
||||||
void *data;
|
|
||||||
} DOM_DocumentFragmentStruct;
|
|
||||||
|
|
||||||
static JSBool
|
|
||||||
docfrag_masterDoc_get(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|
||||||
{
|
|
||||||
return JS_TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static JSPropertySpec docfrag_props[] = {
|
|
||||||
{"masterDoc", -1, 0, docfrag_masterDoc_get},
|
|
||||||
{0}
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Document
|
|
||||||
*
|
|
||||||
* XXX mush this stuff into existing "document" in lm_doc.c?
|
|
||||||
*/
|
|
||||||
|
|
||||||
typedef struct DOM_DocumentStruct {
|
|
||||||
DOM_DocumentFragmentStruct fragment;
|
|
||||||
} DOM_DocumentStruct;
|
|
||||||
|
|
||||||
static void
|
|
||||||
document_finalize(JSContext *cx, JSObject *obj)
|
|
||||||
{
|
|
||||||
/* chain destructors */
|
|
||||||
/* node_finalize(cx, obj); */
|
|
||||||
}
|
|
||||||
|
|
||||||
static JSBool
|
|
||||||
document_setter(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|
||||||
{
|
|
||||||
return JS_TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static JSBool
|
|
||||||
document_getter(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|
||||||
{
|
|
||||||
return JS_TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
JSClass DOM_DocumentClass = {
|
|
||||||
"Document", JSCLASS_HAS_PRIVATE,
|
|
||||||
JS_PropertyStub, JS_PropertyStub, document_getter, document_setter,
|
|
||||||
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, document_finalize
|
|
||||||
};
|
|
||||||
|
|
||||||
static JSBool
|
|
||||||
doc_createEntity(JSContext *cx, JSObject* obj, uintN argc, jsval *argv,
|
|
||||||
jsval *rval)
|
|
||||||
{
|
|
||||||
/* new Entity */
|
|
||||||
return JS_TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static JSBool
|
|
||||||
doc_createEntityReference(JSContext *cx, JSObject* obj, uintN argc,
|
|
||||||
jsval *argv, jsval *rval)
|
|
||||||
{
|
|
||||||
/* new EntityReference */
|
|
||||||
return JS_TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static JSBool
|
|
||||||
doc_createDocumentFragment(JSContext *cx, JSObject* obj, uintN argc,
|
|
||||||
jsval *argv, jsval *rval)
|
|
||||||
{
|
|
||||||
/* new DocumentFragment */
|
|
||||||
return JS_TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static JSBool
|
|
||||||
doc_createElement(JSContext *cx, JSObject* obj, uintN argc, jsval *argv,
|
|
||||||
jsval *rval)
|
|
||||||
{
|
|
||||||
JSString *tagName;
|
|
||||||
if (!JS_ConvertArguments(cx, argc, argv, "S", &tagName))
|
|
||||||
return JS_FALSE;
|
|
||||||
/* new Element */
|
|
||||||
return JS_TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static JSBool
|
|
||||||
doc_createTextNode(JSContext *cx, JSObject* obj, uintN argc, jsval *argv,
|
|
||||||
jsval *rval)
|
|
||||||
{
|
|
||||||
JSString *text;
|
|
||||||
if (!JS_ConvertArguments(cx, argc, argv, "S", &text))
|
|
||||||
return JS_FALSE;
|
|
||||||
/* new TextNode */
|
|
||||||
return JS_TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static JSBool
|
|
||||||
doc_createComment(JSContext *cx, JSObject* obj, uintN argc, jsval *argv,
|
|
||||||
jsval *rval)
|
|
||||||
{
|
|
||||||
JSString *comment;
|
|
||||||
if (!JS_ConvertArguments(cx, argc, argv, "S", &comment))
|
|
||||||
return JS_FALSE;
|
|
||||||
/* new Comment */
|
|
||||||
return JS_TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static JSBool
|
|
||||||
doc_createCDATASection(JSContext *cx, JSObject* obj, uintN argc, jsval *argv,
|
|
||||||
jsval *rval)
|
|
||||||
{
|
|
||||||
JSString *cdata;
|
|
||||||
if (!JS_ConvertArguments(cx, argc, argv, "S", &cdata))
|
|
||||||
return JS_FALSE;
|
|
||||||
/* new CDATA */
|
|
||||||
return JS_TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static JSBool
|
|
||||||
doc_createProcessingInstruction(JSContext *cx, JSObject* obj, uintN argc,
|
|
||||||
jsval *argv, jsval *rval)
|
|
||||||
{
|
|
||||||
JSString *target, *data;
|
|
||||||
if (!JS_ConvertArguments(cx, argc, argv, "SS", &target, &data))
|
|
||||||
return JS_FALSE;
|
|
||||||
/* new PI */
|
|
||||||
return JS_TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static JSBool
|
|
||||||
doc_createAttribute(JSContext *cx, JSObject* obj, uintN argc, jsval *argv,
|
|
||||||
jsval *rval)
|
|
||||||
{
|
|
||||||
JSString *name;
|
|
||||||
if (!JS_ConvertArguments(cx, argc, argv, "S", &name))
|
|
||||||
return JS_FALSE;
|
|
||||||
/* new attr */
|
|
||||||
return JS_TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static JSBool
|
|
||||||
doc_getElementsByTagName(JSContext *cx, JSObject* obj, uintN argc,
|
|
||||||
jsval *argv, jsval *rval)
|
|
||||||
{
|
|
||||||
JSString *tagName;
|
|
||||||
if (!JS_ConvertArguments(cx, argc, argv, "S", &tagName))
|
|
||||||
return JS_FALSE;
|
|
||||||
|
|
||||||
return JS_TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static JSFunctionSpec document_methods[] = {
|
|
||||||
{"createEntity", doc_createEntity, 0},
|
|
||||||
{"createEntityReference", doc_createEntityReference, 0},
|
|
||||||
{"createDocumentFragment", doc_createDocumentFragment, 0},
|
|
||||||
{"createElement", doc_createElement, 1},
|
|
||||||
{"createTextNode", doc_createTextNode, 1},
|
|
||||||
{"createComment", doc_createComment, 1},
|
|
||||||
{"createCDATASection", doc_createCDATASection, 1},
|
|
||||||
{"createProcessingInstruction", doc_createProcessingInstruction, 2},
|
|
||||||
{"createAttribute", doc_createAttribute, 1},
|
|
||||||
{"getElementsByTagName", doc_getElementsByTagName, 1},
|
|
||||||
{0}
|
|
||||||
};
|
|
||||||
|
|
||||||
enum {
|
|
||||||
DOCUMENT_DOCTYPE = -1,
|
|
||||||
DOCUMENT_IMPLEMENTATION = -2,
|
|
||||||
DOCUMENT_DOCUMENTELEMENT = -3
|
|
||||||
};
|
|
||||||
|
|
||||||
static JSPropertySpec document_props[] = {
|
|
||||||
{"doctype", DOCUMENT_DOCTYPE},
|
|
||||||
{"implementation", DOCUMENT_IMPLEMENTATION},
|
|
||||||
{"documentElement", DOCUMENT_DOCUMENTELEMENT},
|
|
||||||
{0}
|
|
||||||
};
|
|
||||||
|
|
||||||
static JSBool
|
|
||||||
Document(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *vp)
|
|
||||||
{
|
|
||||||
return JS_TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
JSObject *
|
|
||||||
DOM_DocumentInit(JSContext *cx, JSObject *scope, JSObject *docfrag_prototype)
|
|
||||||
{
|
|
||||||
JSObject *documentProto;
|
|
||||||
documentProto = JS_InitClass(cx, scope, docfrag_prototype,
|
|
||||||
&DOM_DocumentClass, Document, 0,
|
|
||||||
document_props, document_methods,
|
|
||||||
NULL, NULL);
|
|
||||||
if (!documentProto)
|
|
||||||
return NULL;
|
|
||||||
return documentProto;
|
|
||||||
}
|
|
|
@ -18,6 +18,54 @@
|
||||||
|
|
||||||
#include "domstyle.h"
|
#include "domstyle.h"
|
||||||
|
|
||||||
|
static int
|
||||||
|
CompareSelectors(const void *v1, const void *v2)
|
||||||
|
{
|
||||||
|
DOM_StyleSelector *s1 = (DOM_StyleSelector *)v1,
|
||||||
|
*s2 = (DOM_StyleSelector *)v2;
|
||||||
|
|
||||||
|
return s1->type == s2->type &&
|
||||||
|
|
||||||
|
/* compare base selector */
|
||||||
|
!XP_STRCMP(s1->selector, s2->selector) &&
|
||||||
|
|
||||||
|
/* if both have a psuedo, they have to match, else both must be NULL */
|
||||||
|
(s1->pseudo && s2->pseudo ?
|
||||||
|
XP_STRCMP(s1->pseudo, s2->pseudo) :
|
||||||
|
!(s1 || s2));
|
||||||
|
}
|
||||||
|
|
||||||
|
DOM_StyleDatabase *
|
||||||
|
DOM_NewStyleDatabase(JSContext *cx)
|
||||||
|
{
|
||||||
|
DOM_StyleDatabase *db = XP_NEW_ZAP(DOM_StyleDatabase);
|
||||||
|
if (!db)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
db->ht = PL_NewHashTable(32, PL_HashString, PL_CompareStrings,
|
||||||
|
CompareSelectors, NULL, NULL);
|
||||||
|
if (!db->ht) {
|
||||||
|
XP_FREE(db);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return db;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
DOM_DestroyStyleDatabase(JSContext *cx, DOM_StyleDatabase *db)
|
||||||
|
{
|
||||||
|
PL_HashTableDestroy(db->ht);
|
||||||
|
XP_FREE(db);
|
||||||
|
}
|
||||||
|
|
||||||
|
static JSBool
|
||||||
|
InsertBaseSelector(JSContext *cx, DOM_StyleDatabase *db,
|
||||||
|
DOM_StyleSelector *sel)
|
||||||
|
{
|
||||||
|
return PL_HashTableAdd(db->ht, sel->selector, sel) != NULL;
|
||||||
|
}
|
||||||
|
|
||||||
static DOM_StyleSelector *
|
static DOM_StyleSelector *
|
||||||
GetBaseSelector(JSContext *cx, DOM_StyleDatabase *db, DOM_StyleToken type,
|
GetBaseSelector(JSContext *cx, DOM_StyleDatabase *db, DOM_StyleToken type,
|
||||||
DOM_StyleToken pseudo)
|
DOM_StyleToken pseudo)
|
||||||
|
@ -30,16 +78,16 @@ GetBaseSelector(JSContext *cx, DOM_StyleDatabase *db, DOM_StyleToken type,
|
||||||
static void
|
static void
|
||||||
DestroySelector(JSContext *cx, DOM_StyleSelector *sel)
|
DestroySelector(JSContext *cx, DOM_StyleSelector *sel)
|
||||||
{
|
{
|
||||||
XP_FREE(sel->selector);
|
XP_FREE((char *)sel->selector);
|
||||||
if (sel->pseudo)
|
if (sel->pseudo)
|
||||||
XP_FREE(sel->pseudo);
|
XP_FREE((char *)sel->pseudo);
|
||||||
if (sel->rules) {
|
if (sel->rules) {
|
||||||
DOM_StyleRule *iter, *next;
|
DOM_StyleRule *iter, *next;
|
||||||
iter = sel->rules;
|
iter = sel->rules;
|
||||||
do {
|
do {
|
||||||
next = iter->next;
|
next = iter->next;
|
||||||
XP_FREE(iter->entry.name);
|
XP_FREE((char *)iter->entry.name);
|
||||||
XP_FREE(iter->entry.value);
|
XP_FREE((char *)iter->entry.value);
|
||||||
XP_FREE(iter);
|
XP_FREE(iter);
|
||||||
iter = next;
|
iter = next;
|
||||||
} while (iter);
|
} while (iter);
|
||||||
|
@ -93,23 +141,24 @@ GetPseudo(JSContext *cx, DOM_Element *element)
|
||||||
return entry ? entry->value : NULL;
|
return entry ? entry->value : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define ELEMENT_IS_TYPE(node, element) \
|
|
||||||
(!XP_STRCMP(((element))->tagName, (type)))
|
|
||||||
|
|
||||||
#define PSEUDO_MATCHES(p1, p2) (!XP_STRCMP((p1), (p2)))
|
#define PSEUDO_MATCHES(p1, p2) (!XP_STRCMP((p1), (p2)))
|
||||||
|
|
||||||
|
#ifdef DEBUG_shaver
|
||||||
#define MATCH() \
|
#define MATCH() \
|
||||||
#ifdef DEBUG_shaver \
|
|
||||||
fprintf(stderr, "selector %s:%s matches element %s\n", \
|
fprintf(stderr, "selector %s:%s matches element %s\n", \
|
||||||
sel->selector, sel->pseudo ? sel->pseudo : "", \
|
sel->selector, sel->pseudo ? sel->pseudo : "", \
|
||||||
element->tagName); \
|
element->tagName);
|
||||||
|
#else
|
||||||
|
#define MATCH()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef DEBUG_shaver
|
||||||
#define NO_MATCH() \
|
#define NO_MATCH() \
|
||||||
#ifdef DEBUG_shaver \
|
|
||||||
fprintf(stderr, "selector %s:%s doesn't match element %s\n", \
|
fprintf(stderr, "selector %s:%s doesn't match element %s\n", \
|
||||||
sel->selector, sel->pseudo ? sel->pseudo : "", \
|
sel->selector, sel->pseudo ? sel->pseudo : "", \
|
||||||
element->tagName); \
|
element->tagName);
|
||||||
|
#else
|
||||||
|
#define NO_MATCH()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static JSBool
|
static JSBool
|
||||||
|
@ -117,9 +166,12 @@ SelectorMatchesToken(JSContext *cx, DOM_StyleSelector *sel,
|
||||||
DOM_StyleToken token, DOM_StyleToken pseudo)
|
DOM_StyleToken token, DOM_StyleToken pseudo)
|
||||||
{
|
{
|
||||||
/* XXX handle #ID and .class */
|
/* XXX handle #ID and .class */
|
||||||
return !XPSTRCMP(sel->type, token);
|
return !XP_STRCMP(sel->selector, token);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define ELEMENT_IS_TYPE(element, type) \
|
||||||
|
(!XP_STRCMP(((element))->tagName, (type)))
|
||||||
|
|
||||||
static JSBool
|
static JSBool
|
||||||
SelectorMatchesElement(JSContext *cx, DOM_Element *element,
|
SelectorMatchesElement(JSContext *cx, DOM_Element *element,
|
||||||
DOM_StyleSelector *sel)
|
DOM_StyleSelector *sel)
|
||||||
|
@ -128,7 +180,7 @@ SelectorMatchesElement(JSContext *cx, DOM_Element *element,
|
||||||
if (ELEMENT_IS_TYPE(element, sel->selector)) {
|
if (ELEMENT_IS_TYPE(element, sel->selector)) {
|
||||||
/* check pseudo, if any */
|
/* check pseudo, if any */
|
||||||
if (sel->pseudo) {
|
if (sel->pseudo) {
|
||||||
DOM_StyleToken elementPseudo = GetPseudo(element);
|
DOM_StyleToken elementPseudo = GetPseudo(cx, element);
|
||||||
if (PSEUDO_MATCHES(sel->pseudo, elementPseudo)) {
|
if (PSEUDO_MATCHES(sel->pseudo, elementPseudo)) {
|
||||||
MATCH();
|
MATCH();
|
||||||
return JS_TRUE;
|
return JS_TRUE;
|
||||||
|
@ -163,7 +215,7 @@ AncestorOfType(JSContext *cx, DOM_Element *element, DOM_StyleSelector *sel)
|
||||||
/* check type */
|
/* check type */
|
||||||
if (SelectorMatchesElement(cx, element, sel))
|
if (SelectorMatchesElement(cx, element, sel))
|
||||||
return element;
|
return element;
|
||||||
element = (DOM_Element *)element.node->parent;
|
element = (DOM_Element *)element->node.parent;
|
||||||
} while (element);
|
} while (element);
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -187,7 +239,7 @@ CheckSelector(JSContext *cx, DOM_Element *element, DOM_StyleSelector *sel,
|
||||||
if (sel->rules) {
|
if (sel->rules) {
|
||||||
uintN score = SELECTOR_SCORE(sel, specificity);
|
uintN score = SELECTOR_SCORE(sel, specificity);
|
||||||
if (score > *best) { /* are we the best so far? */
|
if (score > *best) { /* are we the best so far? */
|
||||||
entry = RuleValueFor(sel, property);
|
entry = RuleValueFor(cx, sel->rules, property);
|
||||||
if (entry) { /* do we have a value for this property? */
|
if (entry) { /* do we have a value for this property? */
|
||||||
#ifdef DEBUG_shaver
|
#ifdef DEBUG_shaver
|
||||||
fprintf(stderr, "- score %d, value %s\n",
|
fprintf(stderr, "- score %d, value %s\n",
|
||||||
|
@ -220,7 +272,7 @@ CheckSelector(JSContext *cx, DOM_Element *element, DOM_StyleSelector *sel,
|
||||||
|
|
||||||
JSBool
|
JSBool
|
||||||
DOM_StyleGetProperty(JSContext *cx, DOM_StyleDatabase *db,
|
DOM_StyleGetProperty(JSContext *cx, DOM_StyleDatabase *db,
|
||||||
DOM_Node *node, DOM_StyleToken property.
|
DOM_Node *node, DOM_StyleToken property,
|
||||||
DOM_StyleToken pseudo, DOM_AttributeEntry **entryp)
|
DOM_StyleToken pseudo, DOM_AttributeEntry **entryp)
|
||||||
{
|
{
|
||||||
DOM_StyleSelector *sel;
|
DOM_StyleSelector *sel;
|
||||||
|
@ -236,7 +288,7 @@ DOM_StyleGetProperty(JSContext *cx, DOM_StyleDatabase *db,
|
||||||
|
|
||||||
*entryp = NULL;
|
*entryp = NULL;
|
||||||
|
|
||||||
sel = GetBaseSelector(db, element->tagName);
|
sel = GetBaseSelector(cx, db, element->tagName, GetPseudo(cx, element));
|
||||||
if (!sel)
|
if (!sel)
|
||||||
return JS_TRUE;
|
return JS_TRUE;
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,8 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "jsapi.h"
|
#include "jsapi.h"
|
||||||
#include "dom.h"
|
#include "dom_priv.h"
|
||||||
|
#include "plhash.h"
|
||||||
|
|
||||||
#ifndef DOM_STYLE_H
|
#ifndef DOM_STYLE_H
|
||||||
#define DOM_STYLE_H
|
#define DOM_STYLE_H
|
||||||
|
@ -45,14 +46,14 @@ typedef const char *DOM_StyleToken;
|
||||||
#define DOM_PSEUDOIZE(sel) ((sel) | DOM_STYLE_PSEUDO_TAG)
|
#define DOM_PSEUDOIZE(sel) ((sel) | DOM_STYLE_PSEUDO_TAG)
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
SELECTOR_UNKNOWN = 0
|
SELECTOR_UNKNOWN = 0,
|
||||||
SELECTOR_ID,
|
SELECTOR_ID,
|
||||||
SELECTOR_CLASS,
|
SELECTOR_CLASS,
|
||||||
SELECTOR_TAG
|
SELECTOR_TAG
|
||||||
};
|
};
|
||||||
|
|
||||||
struct DOM_StyleDatabase {
|
struct DOM_StyleDatabase {
|
||||||
PRHashTable *hashtable; /* PRHash, from js/ref or nsprpub, depending? */
|
PLHashTable *ht; /* PRHash, from js/ref or nsprpub, depending? */
|
||||||
};
|
};
|
||||||
|
|
||||||
DOM_StyleDatabase *
|
DOM_StyleDatabase *
|
||||||
|
@ -99,8 +100,8 @@ struct DOM_StyleRule {
|
||||||
*
|
*
|
||||||
* Usage example:
|
* Usage example:
|
||||||
*
|
*
|
||||||
* DOM_StyleAddRule(JSContext *cx, DOM_StyleDatabase *db,
|
* DOM_StyleParseRule(JSContext *cx, DOM_StyleDatabase *db,
|
||||||
* "A:visited { color: blue }", 0, DOM_STYLE_WEIGHT_AUTHOR);
|
* "A:visited { color: blue }", 0, DOM_STYLE_WEIGHT_AUTHOR);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define DOM_STYLE_WEIGHT_NONE 0
|
#define DOM_STYLE_WEIGHT_NONE 0
|
||||||
|
@ -109,8 +110,8 @@ struct DOM_StyleRule {
|
||||||
#define DOM_STYLE_WEIGHT_AUTHOR 6
|
#define DOM_STYLE_WEIGHT_AUTHOR 6
|
||||||
|
|
||||||
JSBool
|
JSBool
|
||||||
DOM_StyleAddRule(JSContext *cx, DOM_StyleDatabase *db, const char *rule,
|
DOM_StyleParseRule(JSContext *cx, DOM_StyleDatabase *db, const char *rule,
|
||||||
uintN len, intN baseWeight);
|
uintN len, intN baseWeight);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get a style property for a node.
|
* Get a style property for a node.
|
||||||
|
|
Загрузка…
Ссылка в новой задаче