本文整理汇总了C++中ShadowRoot::childNodes方法的典型用法代码示例。如果您正苦于以下问题:C++ ShadowRoot::childNodes方法的具体用法?C++ ShadowRoot::childNodes怎么用?C++ ShadowRoot::childNodes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ShadowRoot
的用法示例。
在下文中一共展示了ShadowRoot::childNodes方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: searchText
TEST_F(TextFinderTest, ScopeTextMatchesWithShadowDOM) {
document().body()->setInnerHTML("<b>FOO</b><i>foo</i>");
ShadowRoot* shadowRoot = document().body()->createShadowRootInternal(
ShadowRootType::V0, ASSERT_NO_EXCEPTION);
shadowRoot->setInnerHTML(
"<content select=\"i\"></content><u>Foo</u><content></content>");
Node* textInBElement = document().body()->firstChild()->firstChild();
Node* textInIElement = document().body()->lastChild()->firstChild();
Node* textInUElement = shadowRoot->childNodes()->item(1)->firstChild();
document().updateStyleAndLayout();
int identifier = 0;
WebString searchText(String("fOO"));
WebFindOptions findOptions; // Default.
textFinder().resetMatchCount();
textFinder().startScopingStringMatches(identifier, searchText, findOptions);
while (textFinder().scopingInProgress())
runPendingTasks();
// TextIterator currently returns the matches in the flat tree order,
// so in this case the matches will be returned in the order of
// <i> -> <u> -> <b>.
EXPECT_EQ(3, textFinder().totalMatchCount());
WebVector<WebFloatRect> matchRects;
textFinder().findMatchRects(matchRects);
ASSERT_EQ(3u, matchRects.size());
EXPECT_EQ(findInPageRect(textInIElement, 0, textInIElement, 3),
matchRects[0]);
EXPECT_EQ(findInPageRect(textInUElement, 0, textInUElement, 3),
matchRects[1]);
EXPECT_EQ(findInPageRect(textInBElement, 0, textInBElement, 3),
matchRects[2]);
}