当前位置: 首页>>代码示例>>C++>>正文


C++ HTMLDocument::GetCSSContext方法代码示例

本文整理汇总了C++中HTMLDocument::GetCSSContext方法的典型用法代码示例。如果您正苦于以下问题:C++ HTMLDocument::GetCSSContext方法的具体用法?C++ HTMLDocument::GetCSSContext怎么用?C++ HTMLDocument::GetCSSContext使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在HTMLDocument的用法示例。


在下文中一共展示了HTMLDocument::GetCSSContext方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: jhtml_collection_namedItem


//.........这里部分代码省略.........
				}
				break;
			}

			case ELEMENT_NODES:
			{
				HTMLNameOrIdFinder finder(name);
				pElem = pColl->pTop->FindElement(&finder,1, INCLUDE_SELF_NODES_DEFAULT);
				break;
			}

			case FORM_INPUTS:
			{
				//for this type of collection, the top will always be of type form
				HTMLForm *form = (HTMLForm *)pColl->pTop;
				if (form && name && *name)
				{
					pElem = jutils_CheckObjectList(form->GetFieldVector(), _matchInputByNameOrId, (WEBC_PFBYTE)name);
				}//end if
				break;
			}

			case DOCUMENT_STYLESHEETS:
			{
#if (WEBC_SUPPORT_STYLE_SHEETS)
				//GMP this needs to be revisited if CSS is changed to have more than 1 style sheet
#endif
				break;
			}

			case SSHEET_RULES:
			{
#if (WEBC_SUPPORT_STYLE_SHEETS)
				CSSDocumentContext *pCSSCx= pDoc->GetCSSContext();
	/*			if (pCSSCx)
				{
					int i = 0;
					vector_iterator pvi[1];
					CSSPropertyDescriptor * pCSSPD = pCSSCx->EnumFirstProperty(pvi);
					while (pCSSPD)
					{
						char *cName = pCSSPD->EnumFirstClass();
						while (cName)
						{
							if (tc_stricmp(cName, name) == 0)
							{
								*rval = OBJECT_TO_JSVAL(pCSSPD->GetJSObject());
								return JS_TRUE;
							}
							pCSSPD->EnumNextClass();
						}
						pCSSPD = pCSSCx->EnumNextProperty(pvi);
					}
				}*/
#endif //(WEBC_SUPPORT_STYLE_SHEETS)
				return JS_TRUE;
			}

			case RADIO_BUTTONS:
			{
				HTMLRadioButton *pRadio = (HTMLRadioButton *) pColl->pTop;

				if (name)
				{
					while (pRadio && pRadio->Value() && webc_stricmp(name, pRadio->Value()))
					{
开发者ID:peteratebs,项目名称:webcwebbrowser,代码行数:67,代码来源:jhcoll.cpp

示例2: jhtml_collection_item


//.........这里部分代码省略.........
					pElem = jutils_GetNthOfObjectList(form->GetFieldVector(),
					                                  index,
					                                  _matchInput,
					                                  0);

					if (pElem)
					{
						*rval = OBJECT_TO_JSVAL(pElem->CreateJSObject());
					}
					else
					{
						*rval = JSVAL_NULL;
					}

					return JS_TRUE;
				}
				break;
			}

			case DOCUMENT_STYLESHEETS:
			{
#if (WEBC_SUPPORT_STYLE_SHEETS)
				//GMP this needs to be revisited if CSS is changed to have more than 1 style sheet
				*rval = OBJECT_TO_JSVAL(pDoc->GetCSSContext()->GetJSObject());
#else
				*rval = JSVAL_NULL;
#endif
				return JS_TRUE;
			}

			case SSHEET_RULES:
			{
#if (WEBC_SUPPORT_STYLE_SHEETS)
				/*int i = 0;
				CSSDocumentContext *pCSSCx = pDoc->GetCSSContext();
				if (pCSSCx)
				{
					vector_iterator pvi[1];
					CSSPropertyDescriptor *pCSSPD = pCSSCx->EnumFirstProperty(pvi);
					while(pCSSPD)
					{
						if ( i == index)
						{
							*rval = OBJECT_TO_JSVAL(pCSSPD->GetJSObject());
							return JS_TRUE;
						}
						i++;
						pCSSPD = pCSSCx->EnumNextProperty(pvi);
					}
				}*/
#endif // (WEBC_SUPPORT_STYLE_SHEETS)
				return JS_TRUE;
			}

			case RADIO_BUTTONS:
			{
				HTMLRadioButton *pRadio = (HTMLRadioButton*)pColl->pTop;
				while (index > 0)
				{
					index--;
					pRadio = (pRadio->mpGroupNext != pColl->pTop)
						? pRadio->mpGroupNext : 0;
				}

				if (pRadio)
				{
					*rval = OBJECT_TO_JSVAL(pRadio->CreateJSObject());
					return JS_TRUE;
				}
			}
			break;

		}//end switch

		if (ele_type != HTML_ELEMENT_NONE)
		{
			HTMLNthOfTypeFinder finder(ele_type, index);
			pElem = pColl->pTop->FindElement(&finder,1, INCLUDE_SELF_ELEMENT_DEFAULT);
		}

		if (pElem)
		{
			*rval = OBJECT_TO_JSVAL(pElem->CreateJSObject());
		}
		else
		{
			*rval = JSVAL_NULL;
		}

		return JS_TRUE;
	}//end if
	else if (argc > 0 && JSVAL_IS_STRING(argv[0]))
	{
		//MSIE allows for the item method to take a srting that corresponds to the name
		//therefore we call namedItem instead
		return jhtml_collection_namedItem(cx, obj, argc, argv, rval);
	}
	*rval = JSVAL_NULL;
	return JS_TRUE;
}
开发者ID:peteratebs,项目名称:webcwebbrowser,代码行数:101,代码来源:jhcoll.cpp

示例3: jhtml_collection_getProperty


//.........这里部分代码省略.........
						if (!pColl->nameOfAll)
						{
							*vp = INT_TO_JSVAL(0);
							return JS_TRUE;
						}
						//this finder counts the total number of elements with the
						//name given by nameOfAll
						HTMLCountByNameFinder finder(pColl->nameOfAll);
						pColl->pTop->FindElement(&finder, 1, INCLUDE_SELF_ELEMENT_DEFAULT);
						int count = finder.Length();
						*vp = INT_TO_JSVAL(count);
						return JS_TRUE;
					}
					case ALL_TAGS_BY_TAGNAME:
					{
						if (!pColl->nameOfAll)
						{
							*vp = INT_TO_JSVAL(0);
							return JS_TRUE;
						}
						// use this finder to count the total number of elements with the
						// type given by nameOfAll (misnomer)
						HTMLTagType hType = HTML_ParseTagType(pColl->nameOfAll, webc_strlen(pColl->nameOfAll));
						HTMLElementType eType = TagToHTMLElementType[hType];
						HTMLCountByTypeFinder finder(eType);
						pColl->pTop->FindElement(&finder, 1, WEBC_FALSE); // don't include myself in the search results
						int count = finder.Length();
						*vp = INT_TO_JSVAL(count);
						return JS_TRUE;
					}
					case FORM_INPUTS:
					{
						//for this type of collection, the top will always be of type form
						HTMLForm *form = (HTMLForm *)pColl->pTop;
						int len = vector_get_size(form->GetFieldVector());
						*vp = INT_TO_JSVAL(len);
						return JS_TRUE;
					}
					case DOCUMENT_STYLESHEETS:
					{
						//GMP this needs to be revisited if CSS is changed to have more than 1 style sheet
						*vp = INT_TO_JSVAL(1);
						return JS_TRUE;
					}
					case SSHEET_RULES:
					{
#if (WEBC_SUPPORT_STYLE_SHEETS)
						CSSDocumentContext *pCSSCx= pDoc->GetCSSContext();
	/*					int i = 0;
						if (pCSSCx)
						{
							vector_iterator pvi[1];
							CSSPropertyDescriptor * pCSSPD = pCSSCx->EnumFirstProperty(pvi);
							while (pCSSPD)
							{
								i++;
								pCSSPD = pCSSCx->EnumNextProperty(pvi);
							}
						}
						*vp = INT_TO_JSVAL(i);*/
#endif //(WEBC_SUPPORT_STYLE_SHEETS)
						return JS_TRUE;
					}

					case RADIO_BUTTONS:
					{
						int numRadioElems = 0;
						HTMLRadioButton *pRadio = (HTMLRadioButton*)pColl->pTop;
						while (pRadio)
						{
							numRadioElems++;
							pRadio = (pRadio->mpGroupNext != pColl->pTop)
								? pRadio->mpGroupNext : 0;
						}
						*vp = INT_TO_JSVAL(numRadioElems);
						return JS_TRUE;
					}

				}//end inner switch
				if (ele_type != HTML_ELEMENT_NONE)
				{
					HTMLCountByTypeFinder finder(ele_type);
					pColl->pTop->FindElement(&finder, 1, INCLUDE_SELF_ELEMENT_DEFAULT);
					*vp = INT_TO_JSVAL(finder.Length());
				}
			}//end if
			return JS_TRUE;
		}//end case length
		default:
		{
			//MSIE allows collections to be index like 'document.all.nameofelement' where
			//nameofelement is an element name in the document tree.  It also allows
			//'document.all[4]' To account for that we call item on the element passed in.
			//which will call namedItem if the jsval passed is not an int.
			jhtml_collection_item(cx, obj, 1, &id, vp);
			break;
		}
	}//end switch
	return JS_TRUE;
}
开发者ID:peteratebs,项目名称:webcwebbrowser,代码行数:101,代码来源:jhcoll.cpp


注:本文中的HTMLDocument::GetCSSContext方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。