本文整理汇总了C++中PluginView::countFindMatches方法的典型用法代码示例。如果您正苦于以下问题:C++ PluginView::countFindMatches方法的具体用法?C++ PluginView::countFindMatches怎么用?C++ PluginView::countFindMatches使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PluginView
的用法示例。
在下文中一共展示了PluginView::countFindMatches方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: countStringMatches
void FindController::countStringMatches(const String& string, FindOptions options, unsigned maxMatchCount)
{
if (maxMatchCount == std::numeric_limits<unsigned>::max())
--maxMatchCount;
PluginView* pluginView = pluginViewForFrame(m_webPage->mainFrame());
unsigned matchCount;
if (pluginView)
matchCount = pluginView->countFindMatches(string, core(options), maxMatchCount + 1);
else {
matchCount = m_webPage->corePage()->countFindMatches(string, core(options), maxMatchCount + 1);
m_webPage->corePage()->unmarkAllTextMatches();
}
if (matchCount > maxMatchCount)
matchCount = static_cast<unsigned>(kWKMoreThanMaximumMatchCount);
m_webPage->send(Messages::WebPageProxy::DidCountStringMatches(string, matchCount));
}
示例2: updateFindUIAfterPageScroll
void FindController::updateFindUIAfterPageScroll(bool found, const String& string, FindOptions options, unsigned maxMatchCount)
{
Frame* selectedFrame = frameWithSelection(m_webPage->corePage());
PluginView* pluginView = pluginViewForFrame(m_webPage->mainFrame());
bool shouldShowOverlay = false;
if (!found) {
if (!pluginView)
m_webPage->corePage()->unmarkAllTextMatches();
// Clear the selection.
if (selectedFrame)
selectedFrame->selection()->clear();
hideFindIndicator();
m_webPage->send(Messages::WebPageProxy::DidFailToFindString(string));
} else {
shouldShowOverlay = options & FindOptionsShowOverlay;
bool shouldShowHighlight = options & FindOptionsShowHighlight;
unsigned matchCount = 1;
if (shouldShowOverlay || shouldShowHighlight) {
if (maxMatchCount == numeric_limits<unsigned>::max())
--maxMatchCount;
if (pluginView) {
matchCount = pluginView->countFindMatches(string, core(options), maxMatchCount + 1);
shouldShowOverlay = false;
} else {
m_webPage->corePage()->unmarkAllTextMatches();
matchCount = m_webPage->corePage()->markAllMatchesForText(string, core(options), shouldShowHighlight, maxMatchCount + 1);
}
// Check if we have more matches than allowed.
if (matchCount > maxMatchCount) {
shouldShowOverlay = false;
matchCount = static_cast<unsigned>(kWKMoreThanMaximumMatchCount);
}
}
m_webPage->send(Messages::WebPageProxy::DidFindString(string, matchCount));
if (!(options & FindOptionsShowFindIndicator) || !updateFindIndicator(selectedFrame, shouldShowOverlay)) {
// Either we shouldn't show the find indicator, or we couldn't update it.
hideFindIndicator();
}
}
if (!shouldShowOverlay) {
if (m_findPageOverlay) {
// Get rid of the overlay.
m_webPage->uninstallPageOverlay(m_findPageOverlay, true);
}
} else {
if (!m_findPageOverlay) {
RefPtr<PageOverlay> findPageOverlay = PageOverlay::create(this);
m_findPageOverlay = findPageOverlay.get();
m_webPage->installPageOverlay(findPageOverlay.release(), true);
m_findPageOverlay->setNeedsDisplay();
} else
m_findPageOverlay->setNeedsDisplay();
}
}