⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 kjs_html.cpp

📁 konqueror3 embedded版本, KDE环境下的当家浏览器的嵌入式版本源码包.
💻 CPP
📖 第 1 页 / 共 5 页
字号:
    case Write:    case WriteLn:    case GetElementsByName:    case GetSelection:    case CaptureEvents:    case ReleaseEvents:      return lookupOrCreateFunction<HTMLDocFunction>( exec, propertyName, this, entry->value, entry->params, entry->attr );    case CompatMode:      return String(static_cast<HTMLDocumentImpl *>(doc.handle())->parseMode()              == DocumentImpl::Compat ? "BackCompat" : "CSS1Compat");    }  }  // Look for overrides  ValueImp * val = ObjectImp::getDirect(propertyName);  if (val)    return Value(val);  DOM::HTMLBodyElement body = doc.body();  if (entry) {    switch (entry->value) {    case BgColor:      return String(body.bgColor());    case FgColor:      return String(body.text());    case AlinkColor:      return String(body.aLink());    case LinkColor:      return String(body.link());    case VlinkColor:      return String(body.vLink());    case LastModified:      return String(doc.lastModified());    case Height: // NS-only, not available in IE      return Number(view ? view->contentsHeight() : 0);    case Width: // NS-only, not available in IE      return Number(view ? view->contentsWidth() : 0);    case Dir:      return String(body.dir());    case Frames:      if ( win )        return Value(win->frames(exec));      else        return Undefined();    }  }  return DOMDocument::tryGet(exec, propertyName);}void KJS::HTMLDocument::tryPut(ExecState *exec, const Identifier &propertyName, const Value& value, int attr){#ifdef KJS_VERBOSE  kdDebug(6070) << "KJS::HTMLDocument::tryPut " << propertyName.qstring() << endl;#endif  KHTMLView *view = static_cast<DOM::DocumentImpl*>(node.handle())->view();  Window* win = view && view->part() ? Window::retrieveWindow(view->part()) : 0L;  if ( !win || !win->isSafeScript(exec) )    return;  DOMObjectLookupPut<HTMLDocument, DOMDocument>( exec, propertyName, value, attr, &HTMLDocumentTable, this );}void KJS::HTMLDocument::putValueProperty(ExecState *exec, int token, const Value& value, int /*attr*/){  DOM::HTMLDocument doc = static_cast<DOM::HTMLDocument>(node);  DOM::HTMLBodyElement body = doc.body();  DOM::DOMString val = value.toString(exec).string();  switch (token) {  case Title:    if (doc.title() != val) doc.setTitle(val);    break;  case Body: {    DOMNode *node = new DOMNode(exec, KJS::toNode(value));    // This is required to avoid leaking the node.    Value nodeValue(node);    doc.setBody(node->toNode());    break;  }  case Domain: { // not part of the DOM    DOM::HTMLDocumentImpl* docimpl = static_cast<DOM::HTMLDocumentImpl*>(doc.handle());    if (docimpl)      docimpl->setDomain(val);    break;  }  case Cookie:    doc.setCookie(val);    break;  case Location:  {    KHTMLView *view = static_cast<DOM::DocumentImpl*>(doc.handle())->view();    if ( view )      Window::retrieveWindow(view->part())->goURL(exec, value.toString(exec).qstring(), false /*don't lock history*/);    break;  }  case BgColor:    if (body.bgColor() != val) body.setBgColor(val);    break;  case FgColor:    if (body.text() != val) body.setText(val);    break;  case AlinkColor:    if (body.aLink() != val) body.setALink(val);    break;  case LinkColor:    if (body.link() != val) body.setLink(val);    break;  case VlinkColor:    if (body.vLink() != val) body.setVLink(val);    break;  case Dir:    body.setDir(val);    break;  default:    kdDebug(6070) << "WARNING: HTMLDocument::putValueProperty unhandled token " << token << endl;  }}// -------------------------------------------------------------------------const ClassInfo KJS::HTMLElement::info = { "HTMLElement", &DOMElement::info, &HTMLElementTable, 0 };const ClassInfo KJS::HTMLElement::html_info = { "HTMLHtmlElement", &KJS::HTMLElement::info, &HTMLHtmlElementTable, 0 };const ClassInfo KJS::HTMLElement::head_info = { "HTMLHeadElement", &KJS::HTMLElement::info, &HTMLHeadElementTable, 0 };const ClassInfo KJS::HTMLElement::link_info = { "HTMLLinkElement", &KJS::HTMLElement::info, &HTMLLinkElementTable, 0 };const ClassInfo KJS::HTMLElement::title_info = { "HTMLTitleElement", &KJS::HTMLElement::info, &HTMLTitleElementTable, 0 };const ClassInfo KJS::HTMLElement::meta_info = { "HTMLMetaElement", &KJS::HTMLElement::info, &HTMLMetaElementTable, 0 };const ClassInfo KJS::HTMLElement::base_info = { "HTMLBaseElement", &KJS::HTMLElement::info, &HTMLBaseElementTable, 0 };const ClassInfo KJS::HTMLElement::isIndex_info = { "HTMLIsIndexElement", &KJS::HTMLElement::info, &HTMLIsIndexElementTable, 0 };const ClassInfo KJS::HTMLElement::style_info = { "HTMLStyleElement", &KJS::HTMLElement::info, &HTMLStyleElementTable, 0 };const ClassInfo KJS::HTMLElement::body_info = { "HTMLBodyElement", &KJS::HTMLElement::info, &HTMLBodyElementTable, 0 };const ClassInfo KJS::HTMLElement::form_info = { "HTMLFormElement", &KJS::HTMLElement::info, &HTMLFormElementTable, 0 };const ClassInfo KJS::HTMLElement::select_info = { "HTMLSelectElement", &KJS::HTMLElement::info, &HTMLSelectElementTable, 0 };const ClassInfo KJS::HTMLElement::optGroup_info = { "HTMLOptGroupElement", &KJS::HTMLElement::info, &HTMLOptGroupElementTable, 0 };const ClassInfo KJS::HTMLElement::option_info = { "HTMLOptionElement", &KJS::HTMLElement::info, &HTMLOptionElementTable, 0 };const ClassInfo KJS::HTMLElement::input_info = { "HTMLInputElement", &KJS::HTMLElement::info, &HTMLInputElementTable, 0 };const ClassInfo KJS::HTMLElement::textArea_info = { "HTMLTextAreaElement", &KJS::HTMLElement::info, &HTMLTextAreaElementTable, 0 };const ClassInfo KJS::HTMLElement::button_info = { "HTMLButtonElement", &KJS::HTMLElement::info, &HTMLButtonElementTable, 0 };const ClassInfo KJS::HTMLElement::label_info = { "HTMLLabelElement", &KJS::HTMLElement::info, &HTMLLabelElementTable, 0 };const ClassInfo KJS::HTMLElement::fieldSet_info = { "HTMLFieldSetElement", &KJS::HTMLElement::info, &HTMLFieldSetElementTable, 0 };const ClassInfo KJS::HTMLElement::legend_info = { "HTMLLegendElement", &KJS::HTMLElement::info, &HTMLLegendElementTable, 0 };const ClassInfo KJS::HTMLElement::ul_info = { "HTMLUListElement", &KJS::HTMLElement::info, &HTMLUListElementTable, 0 };const ClassInfo KJS::HTMLElement::ol_info = { "HTMLOListElement", &KJS::HTMLElement::info, &HTMLOListElementTable, 0 };const ClassInfo KJS::HTMLElement::dl_info = { "HTMLDListElement", &KJS::HTMLElement::info, &HTMLDListElementTable, 0 };const ClassInfo KJS::HTMLElement::dir_info = { "HTMLDirectoryElement", &KJS::HTMLElement::info, &HTMLDirectoryElementTable, 0 };const ClassInfo KJS::HTMLElement::menu_info = { "HTMLMenuElement", &KJS::HTMLElement::info, &HTMLMenuElementTable, 0 };const ClassInfo KJS::HTMLElement::li_info = { "HTMLLIElement", &KJS::HTMLElement::info, &HTMLLIElementTable, 0 };const ClassInfo KJS::HTMLElement::div_info = { "HTMLDivElement", &KJS::HTMLElement::info, &HTMLDivElementTable, 0 };const ClassInfo KJS::HTMLElement::p_info = { "HTMLParagraphElement", &KJS::HTMLElement::info, &HTMLParagraphElementTable, 0 };const ClassInfo KJS::HTMLElement::heading_info = { "HTMLHeadingElement", &KJS::HTMLElement::info, &HTMLHeadingElementTable, 0 };const ClassInfo KJS::HTMLElement::blockQuote_info = { "HTMLBlockQuoteElement", &KJS::HTMLElement::info, &HTMLBlockQuoteElementTable, 0 };const ClassInfo KJS::HTMLElement::q_info = { "HTMLQuoteElement", &KJS::HTMLElement::info, &HTMLQuoteElementTable, 0 };const ClassInfo KJS::HTMLElement::pre_info = { "HTMLPreElement", &KJS::HTMLElement::info, &HTMLPreElementTable, 0 };const ClassInfo KJS::HTMLElement::br_info = { "HTMLBRElement", &KJS::HTMLElement::info, &HTMLBRElementTable, 0 };const ClassInfo KJS::HTMLElement::baseFont_info = { "HTMLBaseFontElement", &KJS::HTMLElement::info, &HTMLBaseFontElementTable, 0 };const ClassInfo KJS::HTMLElement::font_info = { "HTMLFontElement", &KJS::HTMLElement::info, &HTMLFontElementTable, 0 };const ClassInfo KJS::HTMLElement::hr_info = { "HTMLHRElement", &KJS::HTMLElement::info, &HTMLHRElementTable, 0 };const ClassInfo KJS::HTMLElement::mod_info = { "HTMLModElement", &KJS::HTMLElement::info, &HTMLModElementTable, 0 };const ClassInfo KJS::HTMLElement::a_info = { "HTMLAnchorElement", &KJS::HTMLElement::info, &HTMLAnchorElementTable, 0 };const ClassInfo KJS::HTMLElement::img_info = { "HTMLImageElement", &KJS::HTMLElement::info, &HTMLImageElementTable, 0 };const ClassInfo KJS::HTMLElement::object_info = { "HTMLObjectElement", &KJS::HTMLElement::info, &HTMLObjectElementTable, 0 };const ClassInfo KJS::HTMLElement::param_info = { "HTMLParamElement", &KJS::HTMLElement::info, &HTMLParamElementTable, 0 };const ClassInfo KJS::HTMLElement::applet_info = { "HTMLAppletElement", &KJS::HTMLElement::info, &HTMLAppletElementTable, 0 };const ClassInfo KJS::HTMLElement::map_info = { "HTMLMapElement", &KJS::HTMLElement::info, &HTMLMapElementTable, 0 };const ClassInfo KJS::HTMLElement::area_info = { "HTMLAreaElement", &KJS::HTMLElement::info, &HTMLAreaElementTable, 0 };const ClassInfo KJS::HTMLElement::script_info = { "HTMLScriptElement", &KJS::HTMLElement::info, &HTMLScriptElementTable, 0 };const ClassInfo KJS::HTMLElement::table_info = { "HTMLTableElement", &KJS::HTMLElement::info, &HTMLTableElementTable, 0 };const ClassInfo KJS::HTMLElement::caption_info = { "HTMLTableCaptionElement", &KJS::HTMLElement::info, &HTMLTableCaptionElementTable, 0 };const ClassInfo KJS::HTMLElement::col_info = { "HTMLTableColElement", &KJS::HTMLElement::info, &HTMLTableColElementTable, 0 };const ClassInfo KJS::HTMLElement::tablesection_info = { "HTMLTableSectionElement", &KJS::HTMLElement::info, &HTMLTableSectionElementTable, 0 };const ClassInfo KJS::HTMLElement::tr_info = { "HTMLTableRowElement", &KJS::HTMLElement::info, &HTMLTableRowElementTable, 0 };const ClassInfo KJS::HTMLElement::tablecell_info = { "HTMLTableCellElement", &KJS::HTMLElement::info, &HTMLTableCellElementTable, 0 };const ClassInfo KJS::HTMLElement::frameSet_info = { "HTMLFrameSetElement", &KJS::HTMLElement::info, &HTMLFrameSetElementTable, 0 };const ClassInfo KJS::HTMLElement::frame_info = { "HTMLFrameElement", &KJS::HTMLElement::info, &HTMLFrameElementTable, 0 };const ClassInfo KJS::HTMLElement::iFrame_info = { "HTMLIFrameElement", &KJS::HTMLElement::info, &HTMLIFrameElementTable, 0 };const ClassInfo KJS::HTMLElement::marquee_info = { "HTMLMarqueeElement", &KJS::HTMLElement::info, &HTMLMarqueeElementTable, 0 };const ClassInfo KJS::HTMLElement::layer_info = { "HTMLLayerElement", &KJS::HTMLElement::info, &HTMLLayerElementTable, 0 };const ClassInfo* KJS::HTMLElement::classInfo() const{  DOM::HTMLElement element = static_cast<DOM::HTMLElement>(node);  switch (element.elementId()) {  case ID_HTML:    return &html_info;  case ID_HEAD:    return &head_info;  case ID_LINK:    return &link_info;  case ID_TITLE:    return &title_info;  case ID_META:    return &meta_info;  case ID_BASE:    return &base_info;  case ID_ISINDEX:    return &isIndex_info;  case ID_STYLE:    return &style_info;  case ID_BODY:    return &body_info;  case ID_FORM:    return &form_info;  case ID_SELECT:    return &select_info;  case ID_OPTGROUP:    return &optGroup_info;  case ID_OPTION:    return &option_info;  case ID_INPUT:    return &input_info;  case ID_TEXTAREA:    return &textArea_info;  case ID_BUTTON:    return &button_info;  case ID_LABEL:    return &label_info;  case ID_FIELDSET:    return &fieldSet_info;  case ID_LEGEND:    return &legend_info;  case ID_UL:    return &ul_info;  case ID_OL:    return &ol_info;  case ID_DL:    return &dl_info;  case ID_DIR:    return &dir_info;  case ID_MENU:    return &menu_info;  case ID_LI:    return &li_info;  case ID_DIV:    return &div_info;  case ID_P:    return &p_info;  case ID_H1:  case ID_H2:  case ID_H3:  case ID_H4:  case ID_H5:  case ID_H6:    return &heading_info;  case ID_BLOCKQUOTE:    return &blockQuote_info;  case ID_Q:    return &q_info;  case ID_PRE:    return &pre_info;  case ID_BR:    return &br_info;  case ID_BASEFONT:    return &baseFont_info;  case ID_FONT:    return &font_info;  case ID_HR:    return &hr_info;  case ID_INS:  case ID_DEL:    return &mod_info;  case ID_A:    return &a_info;  case ID_IMG:    return &img_info;  case ID_OBJECT:    return &object_info;  case ID_PARAM:    return &param_info;  case ID_APPLET:    return &applet_info;  case ID_MAP:    return &map_info;  case ID_AREA:    return &area_info;  case ID_SCRIPT:    return &script_info;  case ID_TABLE:    return &table_info;  case ID_CAPTION:    return &caption_info;  case ID_COL:  case ID_COLGROUP:    return &col_info;  case ID_THEAD:    return &tablesection_info;  case ID_TBODY:    return &tablesection_info;  case ID_TFOOT:    return &tablesection_info;  case ID_TR:    return &tr_info;  case ID_TH:    return &tablecell_info;  case ID_TD:    return &tablecell_info;  case ID_FRAMESET:    return &frameSet_info;  case ID_FRAME:    return &frame_info;  case ID_IFRAME:    return &iFrame_info;  case ID_MARQUEE:    return &marquee_info;  case ID_LAYER:    return &layer_info;  default:    return &info;  }}/*@begin HTMLElementTable 11  id		KJS::HTMLElement::ElementId	DontDelete  title		KJS::HTMLElement::ElementTitle	DontDelete  lang		KJS::HTMLElement::ElementLang	DontDelete  dir		KJS::HTMLElement::ElementDir	DontDelete### isn't this "class" in the HTML spec?  className	KJS::HTMLElement::ElementClassName DontDelete  innerHTML	KJS::HTMLElement::ElementInnerHTML DontDelete  innerText	KJS::HTMLElement::ElementInnerText DontDelete

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -