本文整理汇总了C++中webcore::Node类的典型用法代码示例。如果您正苦于以下问题:C++ Node类的具体用法?C++ Node怎么用?C++ Node使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Node类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getFrameFromHandle
static WebCore::Frame* getFrameFromHandle(void* objectHandle)
{
WebCore::Node* node = static_cast<WebCore::Node*>(objectHandle);
if (!node->inDocument())
return 0;
WebCore::Document* document = node->document();
if (!document)
return 0;
return document->frame();
}
示例2: dumpPath
static QString dumpPath(WebCore::Node *node)
{
QString str = node->nodeName();
WebCore::Node *parent = node->parentNode();
while (parent) {
str.append(QLatin1String(" > "));
str.append(parent->nodeName());
parent = parent->parentNode();
}
return str;
}
示例3: mediaType
BundleHitTestResultMediaType InjectedBundleHitTestResult::mediaType() const
{
#if !ENABLE(VIDEO)
return BundleHitTestResultMediaTypeNone;
#else
WebCore::Node* node = m_hitTestResult.innerNonSharedNode();
if (!node->isElementNode())
return BundleHitTestResultMediaTypeNone;
if (!toElement(node)->isMediaElement())
return BundleHitTestResultMediaTypeNone;
return m_hitTestResult.mediaIsVideo() ? BundleHitTestResultMediaTypeVideo : BundleHitTestResultMediaTypeAudio;
#endif
}
示例4: pauseTransitionAtTimeOnElementWithId
bool LayoutTestController::pauseTransitionAtTimeOnElementWithId(JSStringRef propertyName, double time, JSStringRef elementId)
{
if (!mainFrame)
return false;
int nameLen = JSStringGetMaximumUTF8CStringSize(propertyName);
int idLen = JSStringGetMaximumUTF8CStringSize(elementId);
OwnArrayPtr<char> name = adoptArrayPtr(new char[nameLen]);
OwnArrayPtr<char> eId = adoptArrayPtr(new char[idLen]);
JSStringGetUTF8CString(propertyName, name.get(), nameLen);
JSStringGetUTF8CString(elementId, eId.get(), idLen);
WebCore::AnimationController* animationController = mainFrame->animation();
if (!animationController)
return false;
WebCore::Node* node = mainFrame->document()->getElementById(eId.get());
if (!node || !node->renderer())
return false;
return animationController->pauseTransitionAtTime(node->renderer(), name.get(), time);
}
示例5: setInputMethodState
void EditorClientEA::setInputMethodState(bool active)
{
WebCore::Node* pNode = NULL;
Frame* frame = m_page->d->page->focusController()->focusedOrMainFrame();
if (frame && frame->document() && frame->document()->focusedNode())
{
pNode = frame->document()->focusedNode();
}
// Note by Arpit Baldeva: If on console(true by default on consoles/can be enabled on PC through emulation),
// we detect if the node was focused due to the user input or through javascript.
// If the node was focused by user input(such as click), we present the editor(emulated keyboard on consoles, debug log on PC).
// If the node was focused by javascript, we make the cursor jump to the node. In addition, we blur <input>/<textarea> element
// so that the user click can bring up the emulated keyboard.
EA::WebKit::View* pView = m_page->view();
#if defined(EA_PLATFORM_CONSOLE)
bool onConsole = true;
#elif defined(EA_PLATFORM_WINDOWS)
bool onConsole = pView->IsEmulatingConsoleOnPC();
#elif defined(EA_PLATFORM_OSX)
bool onConsole = false;
#endif
if(onConsole && !pView->AllowJSTextInputStateNotificationOnConsole())
{
if(!m_page->handle()->mouseCausedEventActive)
{
pView->MoveMouseCursorToNode(pNode);
if (pNode && pNode->isHTMLElement())
{
if(pNode->hasTagName(WebCore::HTMLNames::inputTag) || pNode->hasTagName(WebCore::HTMLNames::textareaTag))
{
HTMLElement* pElement = static_cast<HTMLElement*> (pNode);
pElement->blur();
}
}
return;
}
}
// CSidhall 1/22/09 Added notify user app of text input state for possible virtual keyboard...
// We can't fully trust the enabled flag because the input field might be a password in which case we still
// want to activate the keyboard input. So we do our own checking and also get extra info...
//Note by Arpit Baldeva: We are interested in the <input> and <textarea> elements. The problem is that we can't rely on the shouldUseInputMethod() of node to reliably detect an
//editable node since it does not include password(as noted above). Webkit trunk has some cryptic comment explaining why that is the right thing to do. So we do as follows.
// We could add a new method to the class hierarchy to achieve following but want to minimize the changes inside core layer.
bool inputActive = active;
bool searchActive = false;
bool passwordActive = false;
EA::WebKit::KeyboardType kbType = EA::WebKit::kDefaultKeyBoard;
EA::WebKit::InputType inputType = EA::WebKit::kInputTypeNone;
if( pNode && pNode->isHTMLElement())
{
if(pNode->hasTagName(WebCore::HTMLNames::inputTag) )
{
HTMLInputElement* pInputElement = static_cast<HTMLInputElement*> (pNode);
inputActive = pInputElement->isTextField(); // This check makes sure that we are not firing this event with inputActive set to true in case of HTML like <input type="button" value="Click me" onclick="msg()">
//+ Deprecated
searchActive = pInputElement->isSearchField();
passwordActive = pInputElement->isPasswordField();
//-
//New HTML5 input types (text field related)
if(pInputElement->isEmailField())
inputType = EA::WebKit::kInputTypeEmail;
else if (pInputElement->isNumberField())
inputType = EA::WebKit::kInputTypeNumber;
else if(pInputElement->isSearchField())
inputType = EA::WebKit::kInputTypeSearch;
else if(pInputElement->isTelephoneField())
inputType = EA::WebKit::kInputTypeTelephone;
else if(pInputElement->isURLField())
inputType = EA::WebKit::kInputTypeUrl;
else if(pInputElement->isPasswordField())
inputType = EA::WebKit::kInputTypePassword;
}
/* //Note by Arpit Baldeva: This will always come back as true but provided the commented out code here for the sack of clarity
else if(pNode->hasTagName(WebCore::HTMLNames::textareaTag))
{
inputActive = enabled;
}
*/
HTMLElement* pElement = static_cast<HTMLElement*> (pNode);
if(pElement->hasClass())
{
const WebCore::SpaceSplitString& classNames = pElement->classNames();
for(int i = 0; i < EA::WebKit::kCountKeyBoardTypes; ++i)
{
if(classNames.contains(sKeyBoardClassMap[i].mKeyboardClass))
{
kbType = sKeyBoardClassMap[i].mKeyboardType;
break;
}
}
//.........这里部分代码省略.........
示例6: FindBestNode
void DocumentNavigator::FindBestNode(WebCore::Node* rootNode)
{
// Note by Arpit Baldeva - Changed the recursive algorithm to an iterative algorithm. This results in 25% to 40% increase in efficiency.
while (rootNode)
{
IsNodeNavigableDelegate nodeNavigableDelegate(mView);
// As it turns out, getRect on HTMLElement is pretty expensive. So we don't do it inside the delegate as we require getRect here too. We do that check here.
// It is at least ~15% more efficient and can be up to ~25% more efficient (depends on the page layout and current node you are at).
nodeNavigableDelegate(rootNode,false);
if (nodeNavigableDelegate.FoundNode())
{
WebCore::HTMLElement* htmlElement = (WebCore::HTMLElement*) rootNode;
WebCore::IntRect rectAbsolute = htmlElement->getRect();
// Adjust the rectangle position based on the frame offset so that we have absolute geometrical position.
WebCore::FrameView* pFrameView = htmlElement->document()->view(); //Can be NULL
if(pFrameView)
{
rectAbsolute.setX(rectAbsolute.x() + pFrameView->x());
rectAbsolute.setY(rectAbsolute.y() + pFrameView->y());
}
/* printf("Looking at ELEMENT_NODE : nodeName=%S (%d,%d)->(%d,%d) ThetaRange(%f,%f)\n\n%S\n-----------------------------------\n",
htmlElement->tagName().charactersWithNullTermination(),
rect.topLeft().x(),rect.topLeft().y(),
rect.bottomRight().x(), rect.bottomRight().y(),
mMinThetaRange,mMaxThetaRange,
htmlElement->innerHTML().charactersWithNullTermination()
);
*/
if (!WouldBeTrappedInElement(rectAbsolute,mStartingPosition,mDirection))
{
if (!TryingToDoPerpendicularJump(rectAbsolute,mPreviousNodeRect,mDirection))
{
if(rectAbsolute.width()>=1 && rectAbsolute.height() >= 1) //Avoid 0 size elements
{
if (doAxisCheck(rectAbsolute))
{
PolarRegion pr(rectAbsolute, mStartingPosition);
if (pr.minR < mMinR )
{
if (areAnglesInRange(pr.minTheta,pr.maxTheta))
{
mMinR = pr.minR;
EAW_ASSERT( *(uint32_t*)rootNode > 10000000u );
//mBestNode = rootNode; //We don't assign it here since we do the Z-layer testing later on.
FoundNodeInfo foundNodeInfo = {rootNode, mMinR};
mNodeListContainer->mFoundNodes.push_back(foundNodeInfo);
/*printf("Found ELEMENT_NODE : nodeName=%s (%d,%d)->(%d,%d) polar: R(%f,%f) Theta(%f,%f) ThetaRange(%f,%f) \n",
(char*)htmlElement->nodeName().characters(),
rect.topLeft().x(),rect.topLeft().y(),
rect.bottomRight().x(), rect.bottomRight().y(),
pr.minR,pr.maxR,pr.minTheta,pr.maxTheta,
mMinThetaRange,mMaxThetaRange
);*/
}
else
{
#if EAWEBKIT_ENABLE_JUMP_NAVIGATION_DEBUGGING
mNodeListContainer->mRejectedByAngleNodes.push_back(rootNode);
#endif
/*printf("RejectedA ELEMENT_NODE : nodeName=%s (%d,%d)->(%d,%d) polar: R(%f,%f) Theta(%f,%f) ThetaRange(%f,%f) \n",
(char*)htmlElement->nodeName().characters(),
rect.topLeft().x(),rect.topLeft().y(),
rect.bottomRight().x(), rect.bottomRight().y(),
pr.minR,pr.maxR,pr.minTheta,pr.maxTheta,
mMinThetaRange,mMaxThetaRange
);*/
}
}
else
{
#if EAWEBKIT_ENABLE_JUMP_NAVIGATION_DEBUGGING
mNodeListContainer->mRejectedByRadiusNodes.push_back(rootNode);
#endif
/*printf("RejectedR ELEMENT_NODE : nodeName=%s (%d,%d)->(%d,%d) polar: R(%f,%f) Theta(%f,%f) ThetaRange(%f,%f) \n",
(char*)htmlElement->nodeName().characters(),
rect.topLeft().x(),rect.topLeft().y(),
rect.bottomRight().x(), rect.bottomRight().y(),
pr.minR,pr.maxR,pr.minTheta,pr.maxTheta,
mMinThetaRange,mMaxThetaRange
);*/
}
}
else
{
//printf(" - failed axis check\n");
}
}
else
{
//printf(" - too small\n");
}
//.........这里部分代码省略.........