本文整理汇总了C++中dom::Node::handle方法的典型用法代码示例。如果您正苦于以下问题:C++ Node::handle方法的具体用法?C++ Node::handle怎么用?C++ Node::handle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dom::Node
的用法示例。
在下文中一共展示了Node::handle方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: showRecursive
void DOMTreeView::showRecursive(const DOM::Node &pNode, const DOM::Node &node, uint depth)
{
DOMListViewItem *cur_item;
DOMListViewItem *parent_item = m_itemdict.value(pNode.handle(), 0);
if (depth > m_maxDepth) {
m_maxDepth = depth;
}
if (depth == 0) {
cur_item = new DOMListViewItem(node, m_listView);
m_document = pNode.ownerDocument();
} else {
cur_item = new DOMListViewItem(node, parent_item);
}
//kDebug(90180) << node.nodeName().string() << " [" << depth << "]";
cur_item = addElement (node, cur_item, false);
m_listView->setItemExpanded(cur_item, depth < m_expansionDepth);
if(node.handle()) {
m_itemdict.insert(node.handle(), cur_item);
}
DOM::Node child = node.firstChild();
if (child.isNull()) {
DOM::HTMLFrameElement frame = node;
if (!frame.isNull()) {
child = frame.contentDocument().documentElement();
} else {
DOM::HTMLIFrameElement iframe = node;
if (!iframe.isNull())
child = iframe.contentDocument().documentElement();
}
}
while(!child.isNull()) {
showRecursive(node, child, depth + 1);
child = child.nextSibling();
}
const DOM::Element element = node;
if (!m_bPure) {
if (!element.isNull() && !element.firstChild().isNull()) {
if(depth == 0) {
cur_item = new DOMListViewItem(node, m_listView, cur_item);
m_document = pNode.ownerDocument();
} else {
cur_item = new DOMListViewItem(node, parent_item, cur_item);
}
//kDebug(90180) << "</" << node.nodeName().string() << ">";
cur_item = addElement(element, cur_item, true);
// m_listView->setItemExpanded(cur_item, depth < m_expansionDepth);
}
}
}
示例2:
khtml::MouseEvent::MouseEvent(const char *name, QMouseEvent *qmouseEvent, int x, int y,
const DOM::DOMString &url, const DOM::DOMString &target,
const DOM::Node &innerNode)
: KParts::Event(name), m_qmouseEvent(qmouseEvent), m_x(x), m_y(y),
m_url(url), m_target(target), m_innerNode(innerNode)
{
d = 0;
if (innerNode.handle() && innerNode.handle()->renderer()) {
innerNode.handle()->renderer()->absolutePosition(m_nodeAbsX, m_nodeAbsY);
}
}
示例3: slotRefreshNode
void DOMTreeView::slotRefreshNode(const DOM::Node &pNode)
{
DOMListViewItem *cur = static_cast<DOMListViewItem *>(m_itemdict[pNode.handle()]);
if (!cur) return;
addElement(pNode, cur, false);
}
示例4: slotShowNode
void DOMTreeView::slotShowNode(const DOM::Node &pNode)
{
if (QListViewItem *item = m_itemdict[pNode.handle()]) {
m_listView->setCurrentItem(item);
m_listView->ensureItemVisible(item);
}
}
示例5: slotShowNode
void DOMTreeView::slotShowNode(const DOM::Node &pNode)
{
if (QTreeWidgetItem *item = m_itemdict.value(pNode.handle(), 0)) {
m_listView->setCurrentItem(item);
m_listView->scrollToItem(item);
}
}
示例6: innerNode
long khtml::MouseEvent::offset() const
{
Position pos;
if (innerNode().handle()) {
// FIXME: Shouldn't be necessary to skip text nodes.
DOM::Node inner = innerNode();
if (inner.nodeType() == Node::TEXT_NODE) {
inner = inner.parentNode();
}
pos = inner.handle()->positionForCoordinates(m_x, m_y).position();
}
return pos.offset();
}
示例7: tryCall
Value XMLSerializerProtoFunc::tryCall(ExecState *exec, Object &thisObj, const List &args)
{
if (!thisObj.inherits(&XMLSerializer::info)) {
Object err = Error::create(exec,TypeError);
exec->setException(err);
return err;
}
switch (id) {
case XMLSerializer::SerializeToString:
{
if (args.size() != 1) {
return Undefined();
}
if (!args[0].toObject(exec).inherits(&DOMDocument::info)) {
return Undefined();
}
DOM::Node docNode = static_cast<KJS::DOMDocument *>(args[0].toObject(exec).imp())->toNode();
DOM::DocumentImpl *doc = static_cast<DOM::DocumentImpl *>(docNode.handle());
if (!doc) {
return Undefined();
}
QString body;
try {
body = doc->toString().string();
} catch(DOM::DOMException& e) {
Object err = Error::create(exec, GeneralError, "Exception serializing document");
exec->setException(err);
return err;
}
return getStringOrNull(body);
}
}
return Undefined();
}
示例8: addElement
void DOMTreeView::addElement ( const DOM::Node &node, DOMListViewItem *cur_item, bool isLast)
{
cur_item->setClosing(isLast);
const QString nodeName(node.nodeName().string());
QString text;
const DOM::Element element = node;
if (!element.isNull()) {
if (!m_bPure) {
if (isLast) {
text ="</";
} else {
text = "<";
}
text += nodeName;
} else {
text = nodeName;
}
if (m_bShowAttributes && !isLast) {
QString attributes;
DOM::Attr attr;
DOM::NamedNodeMap attrs = element.attributes();
unsigned long lmap = attrs.length();
for( unsigned int j=0; j<lmap; j++ ) {
attr = static_cast<DOM::Attr>(attrs.item(j));
attributes += " " + attr.name().string() + "=\"" + attr.value().string() + "\"";
}
if (!(attributes.isEmpty())) {
text += " ";
}
text += attributes.simplifyWhiteSpace();
}
if (!m_bPure) {
if(element.firstChild().isNull()) {
text += "/>";
} else {
text += ">";
}
}
cur_item->setText(0, text);
} else {
text = "`" + node.nodeValue().string() + "'";
// Hacks to deal with PRE
QTextStream ts( text, IO_ReadOnly );
while (!ts.eof()) {
const QString txt(ts.readLine());
const QFont font(KGlobalSettings::fixedFont());
cur_item->setFont( font );
cur_item->setText(0, txt);
if(node.handle()) {
m_itemdict.insert(node.handle(), cur_item);
}
DOMListViewItem *parent;
if (cur_item->parent()) {
parent = static_cast<DOMListViewItem *>(cur_item->parent());
} else {
parent = cur_item;
}
cur_item = new DOMListViewItem(node, parent, cur_item);
}
// This is one is too much
DOMListViewItem *notLastItem = static_cast<DOMListViewItem *>(cur_item->itemAbove());
delete cur_item;
cur_item = notLastItem;
}
if (m_bHighlightHTML && node.ownerDocument().isHTMLDocument()) {
highlightHTML(cur_item, nodeName);
}
}
示例9: if
ArtSVP *LibartCanvas::clipSingleSVP(ArtSVP *svp, SVGShapeImpl *shape)
{
ArtSVP *clippedSvp = copy_svp(svp);
SVGStylableImpl *style = dynamic_cast<SVGStylableImpl *>(shape);
if(style)
{
QString clipPathRef = style->getClipPath();
if(!clipPathRef.isEmpty())
{
CanvasClipPath *clipPath = m_clipPaths[clipPathRef];
if(clipPath)
{
LibartClipPath *lclip = dynamic_cast<LibartClipPath *>(clipPath);
reinterpret_cast<SVGClipPathElementImpl *>(clipPath->element())->setBBoxTarget(shape);
lclip->init();
if(lclip->clipSVP())
{
ArtSVP *s = art_svp_intersect(lclip->clipSVP(), clippedSvp);
art_svp_free(clippedSvp);
clippedSvp = s;
}
}
}
}
SVGSVGElementImpl *svg = dynamic_cast<SVGSVGElementImpl *>(shape);
// Clip outer svg, unless width and height not set
if(svg && (!svg->isRootElement() || !svg->getAttribute("width").isEmpty() || !svg->getAttribute("height").isEmpty()) && !svg->getOverflow())
{
ArtSVP *svgClip = clippingRect(svg->clip(), svg->screenCTM());
ArtSVP *s = art_svp_intersect(svgClip, clippedSvp);
art_svp_free(clippedSvp);
art_svp_free(svgClip);
clippedSvp = s;
}
if(dynamic_cast<SVGPatternElementImpl *>(shape) != 0)
{
// TODO: inherit clipping paths into tile space
}
else if(dynamic_cast<SVGMarkerElementImpl *>(shape) != 0)
{
SVGMarkerElementImpl *marker = static_cast<SVGMarkerElementImpl *>(shape);
if(!marker->clipShape().isEmpty())
{
ArtSVP *clipShape = svpFromPolygon(marker->clipShape());
ArtSVP *s = art_svp_intersect(clipShape, clippedSvp);
art_svp_free(clipShape);
art_svp_free(clippedSvp);
clippedSvp = s;
}
// TODO: inherit clipping paths into marker space
}
else
{
SVGElementImpl *element = dynamic_cast<SVGElementImpl *>(shape);
DOM::Node parentNode = element->parentNode();
if(!parentNode.isNull())
{
SVGElementImpl *parent = element->ownerDoc()->getElementFromHandle(parentNode.handle());
if(parent)
{
SVGShapeImpl *parentShape = dynamic_cast<SVGShapeImpl *>(parent);
if(parentShape)
{
// Clip against ancestor clipping paths
ArtSVP *parentClippedSvp = clipSingleSVP(clippedSvp, parentShape);
art_svp_free(clippedSvp);
clippedSvp = parentClippedSvp;
}
}
}
}
return clippedSvp;
}
示例10: return
// collection of nodes for which to emit the nodeChanged signal
inline static bool operator <(const DOM::Node &n1, const DOM::Node &n2)
{
return (qptrdiff)n1.handle() - (qptrdiff)n2.handle() < 0;
}