kjs_html.cpp

来自「最新Nokia手机浏览器全套源代码完美版。」· C++ 代码 · 共 1,528 行 · 第 1/5 页

CPP
1,528 行
字号
  size    KJS::HTMLElement::HRSize    DontDelete
  width   KJS::HTMLElement::HRWidth   DontDelete
@end
@begin HTMLModElementTable 2
  cite    KJS::HTMLElement::ModCite   DontDelete
  dateTime  KJS::HTMLElement::ModDateTime   DontDelete
@end
@begin HTMLAnchorElementTable 24
  accessKey KJS::HTMLElement::AnchorAccessKey DontDelete
  charset KJS::HTMLElement::AnchorCharset   DontDelete
  coords  KJS::HTMLElement::AnchorCoords    DontDelete
  href    KJS::HTMLElement::AnchorHref    DontDelete
  hreflang  KJS::HTMLElement::AnchorHrefLang  DontDelete
  hash    KJS::HTMLElement::AnchorHash    DontDelete|ReadOnly
  host    KJS::HTMLElement::AnchorHost    DontDelete|ReadOnly
  hostname  KJS::HTMLElement::AnchorHostname  DontDelete|ReadOnly
  name    KJS::HTMLElement::AnchorName    DontDelete
  pathname  KJS::HTMLElement::AnchorPathName  DontDelete|ReadOnly
  port    KJS::HTMLElement::AnchorPort    DontDelete|ReadOnly
  protocol  KJS::HTMLElement::AnchorProtocol  DontDelete|ReadOnly
  rel   KJS::HTMLElement::AnchorRel   DontDelete
  rev   KJS::HTMLElement::AnchorRev   DontDelete
  search  KJS::HTMLElement::AnchorSearch    DontDelete|ReadOnly
  shape   KJS::HTMLElement::AnchorShape   DontDelete
  tabIndex  KJS::HTMLElement::AnchorTabIndex  DontDelete
  target  KJS::HTMLElement::AnchorTarget    DontDelete
  text    KJS::HTMLElement::AnchorText    DontDelete|ReadOnly
  type    KJS::HTMLElement::AnchorType    DontDelete
  blur    KJS::HTMLElement::AnchorBlur    DontDelete|Function 0
  focus   KJS::HTMLElement::AnchorFocus   DontDelete|Function 0
  toString      KJS::HTMLElement::AnchorToString        DontDelete|Function 0
@end
@begin HTMLImageElementTable 14
  name    KJS::HTMLElement::ImageName   DontDelete
  align   KJS::HTMLElement::ImageAlign    DontDelete
  alt   KJS::HTMLElement::ImageAlt    DontDelete
  border  KJS::HTMLElement::ImageBorder   DontDelete
  height  KJS::HTMLElement::ImageHeight   DontDelete
  hspace  KJS::HTMLElement::ImageHspace   DontDelete
  isMap   KJS::HTMLElement::ImageIsMap    DontDelete
  longDesc  KJS::HTMLElement::ImageLongDesc   DontDelete
  src   KJS::HTMLElement::ImageSrc    DontDelete
  useMap  KJS::HTMLElement::ImageUseMap   DontDelete
  vspace  KJS::HTMLElement::ImageVspace   DontDelete
  width   KJS::HTMLElement::ImageWidth    DontDelete
  x         KJS::HTMLElement::ImageX            DontDelete|ReadOnly
  y         KJS::HTMLElement::ImageY            DontDelete|ReadOnly
@end
@begin HTMLObjectElementTable 20
  form      KJS::HTMLElement::ObjectForm      DontDelete|ReadOnly
  code      KJS::HTMLElement::ObjectCode      DontDelete
  align     KJS::HTMLElement::ObjectAlign     DontDelete
  archive   KJS::HTMLElement::ObjectArchive   DontDelete
  border    KJS::HTMLElement::ObjectBorder    DontDelete
  codeBase    KJS::HTMLElement::ObjectCodeBase    DontDelete
  codeType    KJS::HTMLElement::ObjectCodeType    DontDelete
  contentDocument KJS::HTMLElement::ObjectContentDocument DontDelete|ReadOnly
  data      KJS::HTMLElement::ObjectData      DontDelete
  declare   KJS::HTMLElement::ObjectDeclare   DontDelete
  height    KJS::HTMLElement::ObjectHeight    DontDelete
  hspace    KJS::HTMLElement::ObjectHspace    DontDelete
  name      KJS::HTMLElement::ObjectName      DontDelete
  standby   KJS::HTMLElement::ObjectStandby   DontDelete
  tabIndex    KJS::HTMLElement::ObjectTabIndex    DontDelete
  type      KJS::HTMLElement::ObjectType      DontDelete
  useMap    KJS::HTMLElement::ObjectUseMap    DontDelete
  vspace    KJS::HTMLElement::ObjectVspace    DontDelete
  width     KJS::HTMLElement::ObjectWidth     DontDelete
# Nokia changes
  PlaySource  KJS::HTMLElement::ObjectPlaySource  DontDelete|Function 1
@end
@begin HTMLEmbedElementTable 4
  src     KJS::HTMLElement::EmbedSrc      DontDelete
  height    KJS::HTMLElement::EmbedHeight     DontDelete
  width     KJS::HTMLElement::EmbedWidth      DontDelete
  PlaySource  KJS::HTMLElement::EmbedPlaySource   DontDelete|Function 1
# end of Nokia changes
@end
@begin HTMLParamElementTable 4
  name    KJS::HTMLElement::ParamName   DontDelete
  type    KJS::HTMLElement::ParamType   DontDelete
  value   KJS::HTMLElement::ParamValue    DontDelete
  valueType KJS::HTMLElement::ParamValueType  DontDelete
@end
@begin HTMLAppletElementTable 11
  align   KJS::HTMLElement::AppletAlign   DontDelete
  alt   KJS::HTMLElement::AppletAlt   DontDelete
  archive KJS::HTMLElement::AppletArchive   DontDelete
  code    KJS::HTMLElement::AppletCode    DontDelete
  codeBase  KJS::HTMLElement::AppletCodeBase  DontDelete
  height  KJS::HTMLElement::AppletHeight    DontDelete
  hspace  KJS::HTMLElement::AppletHspace    DontDelete
  name    KJS::HTMLElement::AppletName    DontDelete
  object  KJS::HTMLElement::AppletObject    DontDelete
  vspace  KJS::HTMLElement::AppletVspace    DontDelete
  width   KJS::HTMLElement::AppletWidth   DontDelete
@end
@begin HTMLMapElementTable 2
  areas   KJS::HTMLElement::MapAreas    DontDelete|ReadOnly
  name    KJS::HTMLElement::MapName   DontDelete
@end
@begin HTMLAreaElementTable 15
  accessKey KJS::HTMLElement::AreaAccessKey   DontDelete
  alt   KJS::HTMLElement::AreaAlt   DontDelete
  coords  KJS::HTMLElement::AreaCoords    DontDelete
  href    KJS::HTMLElement::AreaHref    DontDelete
  hash    KJS::HTMLElement::AreaHash    DontDelete|ReadOnly
  host    KJS::HTMLElement::AreaHost    DontDelete|ReadOnly
  hostname  KJS::HTMLElement::AreaHostName    DontDelete|ReadOnly
  pathname  KJS::HTMLElement::AreaPathName    DontDelete|ReadOnly
  port    KJS::HTMLElement::AreaPort    DontDelete|ReadOnly
  protocol  KJS::HTMLElement::AreaProtocol    DontDelete|ReadOnly
  search  KJS::HTMLElement::AreaSearch    DontDelete|ReadOnly
  noHref  KJS::HTMLElement::AreaNoHref    DontDelete
  shape   KJS::HTMLElement::AreaShape   DontDelete
  tabIndex  KJS::HTMLElement::AreaTabIndex    DontDelete
  target  KJS::HTMLElement::AreaTarget    DontDelete
@end
@begin HTMLScriptElementTable 7
  text    KJS::HTMLElement::ScriptText    DontDelete
  htmlFor KJS::HTMLElement::ScriptHtmlFor   DontDelete
  event   KJS::HTMLElement::ScriptEvent   DontDelete
  charset KJS::HTMLElement::ScriptCharset   DontDelete
  defer   KJS::HTMLElement::ScriptDefer   DontDelete
  src   KJS::HTMLElement::ScriptSrc   DontDelete
  type    KJS::HTMLElement::ScriptType    DontDelete
@end
@begin HTMLTableElementTable 23
  caption KJS::HTMLElement::TableCaption    DontDelete
  tHead   KJS::HTMLElement::TableTHead    DontDelete
  tFoot   KJS::HTMLElement::TableTFoot    DontDelete
  rows    KJS::HTMLElement::TableRows   DontDelete|ReadOnly
  tBodies KJS::HTMLElement::TableTBodies    DontDelete|ReadOnly
  align   KJS::HTMLElement::TableAlign    DontDelete
  bgColor KJS::HTMLElement::TableBgColor    DontDelete
  border  KJS::HTMLElement::TableBorder   DontDelete
  cellPadding KJS::HTMLElement::TableCellPadding  DontDelete
  cellSpacing KJS::HTMLElement::TableCellSpacing  DontDelete
  frame   KJS::HTMLElement::TableFrame    DontDelete
  rules   KJS::HTMLElement::TableRules    DontDelete
  summary KJS::HTMLElement::TableSummary    DontDelete
  width   KJS::HTMLElement::TableWidth    DontDelete
  createTHead KJS::HTMLElement::TableCreateTHead  DontDelete|Function 0
  deleteTHead KJS::HTMLElement::TableDeleteTHead  DontDelete|Function 0
  createTFoot KJS::HTMLElement::TableCreateTFoot  DontDelete|Function 0
  deleteTFoot KJS::HTMLElement::TableDeleteTFoot  DontDelete|Function 0
  createCaption KJS::HTMLElement::TableCreateCaption  DontDelete|Function 0
  deleteCaption KJS::HTMLElement::TableDeleteCaption  DontDelete|Function 0
  insertRow KJS::HTMLElement::TableInsertRow  DontDelete|Function 1
  deleteRow KJS::HTMLElement::TableDeleteRow  DontDelete|Function 1
@end
@begin HTMLTableCaptionElementTable 1
  align   KJS::HTMLElement::TableCaptionAlign DontDelete
@end
@begin HTMLTableColElementTable 7
  align   KJS::HTMLElement::TableColAlign   DontDelete
  ch    KJS::HTMLElement::TableColCh    DontDelete
  chOff   KJS::HTMLElement::TableColChOff   DontDelete
  span    KJS::HTMLElement::TableColSpan    DontDelete
  vAlign  KJS::HTMLElement::TableColVAlign  DontDelete
  width   KJS::HTMLElement::TableColWidth   DontDelete
@end
@begin HTMLTableSectionElementTable 7
  align   KJS::HTMLElement::TableSectionAlign   DontDelete
  ch    KJS::HTMLElement::TableSectionCh    DontDelete
  chOff   KJS::HTMLElement::TableSectionChOff   DontDelete
  vAlign  KJS::HTMLElement::TableSectionVAlign    DontDelete
  rows    KJS::HTMLElement::TableSectionRows    DontDelete|ReadOnly
  insertRow KJS::HTMLElement::TableSectionInsertRow   DontDelete|Function 1
  deleteRow KJS::HTMLElement::TableSectionDeleteRow   DontDelete|Function 1
@end
@begin HTMLTableRowElementTable 11
  rowIndex  KJS::HTMLElement::TableRowRowIndex    DontDelete|ReadOnly
  sectionRowIndex KJS::HTMLElement::TableRowSectionRowIndex DontDelete|ReadOnly
  cells   KJS::HTMLElement::TableRowCells     DontDelete|ReadOnly
  align   KJS::HTMLElement::TableRowAlign     DontDelete
  bgColor KJS::HTMLElement::TableRowBgColor   DontDelete
  ch    KJS::HTMLElement::TableRowCh      DontDelete
  chOff   KJS::HTMLElement::TableRowChOff     DontDelete
  vAlign  KJS::HTMLElement::TableRowVAlign    DontDelete
  insertCell  KJS::HTMLElement::TableRowInsertCell    DontDelete|Function 1
  deleteCell  KJS::HTMLElement::TableRowDeleteCell    DontDelete|Function 1
@end
@begin HTMLTableCellElementTable 15
  cellIndex KJS::HTMLElement::TableCellCellIndex    DontDelete|ReadOnly
  abbr    KJS::HTMLElement::TableCellAbbr     DontDelete
  align   KJS::HTMLElement::TableCellAlign    DontDelete
  axis    KJS::HTMLElement::TableCellAxis     DontDelete
  bgColor KJS::HTMLElement::TableCellBgColor    DontDelete
  ch    KJS::HTMLElement::TableCellCh     DontDelete
  chOff   KJS::HTMLElement::TableCellChOff    DontDelete
  colSpan KJS::HTMLElement::TableCellColSpan    DontDelete
  headers KJS::HTMLElement::TableCellHeaders    DontDelete
  height  KJS::HTMLElement::TableCellHeight   DontDelete
  noWrap  KJS::HTMLElement::TableCellNoWrap   DontDelete
  rowSpan KJS::HTMLElement::TableCellRowSpan    DontDelete
  scope   KJS::HTMLElement::TableCellScope    DontDelete
  vAlign  KJS::HTMLElement::TableCellVAlign   DontDelete
  width   KJS::HTMLElement::TableCellWidth    DontDelete
@end
@begin HTMLFrameSetElementTable 2
  cols    KJS::HTMLElement::FrameSetCols      DontDelete
  rows    KJS::HTMLElement::FrameSetRows      DontDelete
@end
@begin HTMLFrameElementTable 9
  contentDocument KJS::HTMLElement::FrameContentDocument        DontDelete|ReadOnly
  contentWindow   KJS::HTMLElement::FrameContentWindow          DontDelete|ReadOnly
  frameBorder     KJS::HTMLElement::FrameFrameBorder    DontDelete
  longDesc    KJS::HTMLElement::FrameLongDesc   DontDelete
  marginHeight    KJS::HTMLElement::FrameMarginHeight   DontDelete
  marginWidth   KJS::HTMLElement::FrameMarginWidth    DontDelete
  name      KJS::HTMLElement::FrameName     DontDelete
  noResize    KJS::HTMLElement::FrameNoResize   DontDelete
  scrolling   KJS::HTMLElement::FrameScrolling    DontDelete
  src     KJS::HTMLElement::FrameSrc      DontDelete
  location    KJS::HTMLElement::FrameLocation   DontDelete
@end
@begin HTMLIFrameElementTable 12
  align     KJS::HTMLElement::IFrameAlign     DontDelete
  contentDocument KJS::HTMLElement::IFrameContentDocument       DontDelete|ReadOnly
  contentWindow   KJS::HTMLElement::IFrameContentWindow         DontDelete|ReadOnly
  document    KJS::HTMLElement::IFrameDocument    DontDelete|ReadOnly
  frameBorder   KJS::HTMLElement::IFrameFrameBorder   DontDelete
  height    KJS::HTMLElement::IFrameHeight    DontDelete
  longDesc    KJS::HTMLElement::IFrameLongDesc    DontDelete
  marginHeight    KJS::HTMLElement::IFrameMarginHeight    DontDelete
  marginWidth   KJS::HTMLElement::IFrameMarginWidth   DontDelete
  name      KJS::HTMLElement::IFrameName      DontDelete
  scrolling   KJS::HTMLElement::IFrameScrolling   DontDelete
  src     KJS::HTMLElement::IFrameSrc     DontDelete
  width     KJS::HTMLElement::IFrameWidth     DontDelete
@end

@begin HTMLMarqueeElementTable 2
  start           KJS::HTMLElement::MarqueeStart    DontDelete|Function 0
  stop            KJS::HTMLElement::MarqueeStop                 DontDelete|Function 0
@end

@begin HTMLCanvasElementTable 1
  getContext      KJS::HTMLElement::GetContext                  DontDelete|Function 0
@end
*/

Value KJS::HTMLElement::tryGet(ExecState *exec, const Identifier &propertyName) const
{
  DOM::HTMLElement element = static_cast<DOM::HTMLElement>(node);
#ifdef KJS_VERBOSE
  kdDebug(6070) << "KJS::HTMLElement::tryGet " << propertyName.qstring() << " thisTag=" << element.tagName().string() << endl;
#endif
  // First look at dynamic properties
  switch (element.elementId()) {
    case ID_FORM: {
      DOM::HTMLFormElement form = element;
      // Check if we're retrieving an element (by index or by name)
      bool ok;
      uint u = propertyName.toULong(&ok);
      if (ok)
        return getDOMNode(exec,form.elements().item(u));
      KJS::HTMLCollection coll(exec,form.elements());
      Value namedItems = coll.getNamedItems(exec, propertyName);
      if (namedItems.type() != UndefinedType)
        return namedItems;
    }
      break;
    case ID_SELECT: {
      DOM::HTMLSelectElement select = element;
      bool ok;
      uint u = propertyName.toULong(&ok);
      if (ok)
        return getDOMNode(exec,select.options().item(u)); // not specified by DOM(?) but supported in netscape/IE
    }
      break;
    case ID_FRAMESET: {
        DOM::Node frame = element.children().namedItem(propertyName.string());
        if (!frame.isNull() && frame.elementId() == ID_FRAME) {
            DOM::DocumentImpl* doc = static_cast<DOM::HTMLFrameElementImpl *>(frame.handle())->contentDocument();
            if (doc) {
                KHTMLPart* part = doc->part();
                if (part) {
                    Window *window = Window::retrieveWindow(part);
                    if (window) {
                        return Value(window);
                    }
                }
            }
        }
    }
        break;
    case ID_FRAME:
    case ID_IFRAME: {
        DOM::DocumentImpl* doc = static_cast<DOM::HTMLFrameElementImpl *>(element.handle())->contentDocument();
        if ( doc ) {
            KHTMLPart* part = doc->part();
            if ( part ) {
        Object globalObject = Object::dynamicCast( Window::retrieve( part ) );
        // Calling hasProperty on a Window object doesn't work, it always says true.
        // Hence we need to use getDirect instead.
        if ( !globalObject.isNull() && static_cast<ObjectImp *>(globalObject.imp())->getDirect( propertyName ) )
                return globalObject.get( exec, propertyName );
            }
        }
    }
      break;
#if APPLE_CHANGES
    case ID_EMBED:
    case ID_OBJECT:

⌨️ 快捷键说明

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