本文整理汇总了C++中HTMLImageElement::isServerMap方法的典型用法代码示例。如果您正苦于以下问题:C++ HTMLImageElement::isServerMap方法的具体用法?C++ HTMLImageElement::isServerMap怎么用?C++ HTMLImageElement::isServerMap使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTMLImageElement
的用法示例。
在下文中一共展示了HTMLImageElement::isServerMap方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: appendServerMapMousePosition
static void appendServerMapMousePosition(String& url, Event* event)
{
if (!event->isMouseEvent())
return;
ASSERT(event->target());
Node* target = event->target()->toNode();
ASSERT(target);
if (!target->hasTagName(imgTag))
return;
HTMLImageElement* imageElement = static_cast<HTMLImageElement*>(event->target()->toNode());
if (!imageElement || !imageElement->isServerMap())
return;
RenderImage* renderer = toRenderImage(imageElement->renderer());
if (!renderer)
return;
// FIXME: This should probably pass true for useTransforms.
FloatPoint absolutePosition = renderer->absoluteToLocal(FloatPoint(static_cast<MouseEvent*>(event)->pageX(), static_cast<MouseEvent*>(event)->pageY()));
int x = absolutePosition.x();
int y = absolutePosition.y();
url += "?";
url += String::number(x);
url += ",";
url += String::number(y);
}
示例2: appendServerMapMousePosition
static void appendServerMapMousePosition(StringBuilder& url, Event* event)
{
if (!event->isMouseEvent())
return;
ASSERT(event->target());
Node* target = event->target()->toNode();
ASSERT(target);
if (!isHTMLImageElement(target))
return;
HTMLImageElement* imageElement = toHTMLImageElement(target);
if (!imageElement || !imageElement->isServerMap())
return;
if (!imageElement->renderer() || !imageElement->renderer()->isRenderImage())
return;
RenderImage* renderer = toRenderImage(imageElement->renderer());
// FIXME: This should probably pass true for useTransforms.
FloatPoint absolutePosition = renderer->absoluteToLocal(FloatPoint(toMouseEvent(event)->pageX(), toMouseEvent(event)->pageY()));
int x = absolutePosition.x();
int y = absolutePosition.y();
url.append('?');
url.appendNumber(x);
url.append(',');
url.appendNumber(y);
}
示例3: defaultEventHandler
void HTMLAnchorElement::defaultEventHandler(Event* evt)
{
// React on clicks and on keypresses.
// Don't make this KEYUP_EVENT again, it makes khtml follow links it shouldn't,
// when pressing Enter in the combo.
if (isLink() && (evt->type() == eventNames().clickEvent || (evt->type() == eventNames().keydownEvent && focused()))) {
MouseEvent* e = 0;
if (evt->type() == eventNames().clickEvent && evt->isMouseEvent())
e = static_cast<MouseEvent*>(evt);
KeyboardEvent* k = 0;
if (evt->type() == eventNames().keydownEvent && evt->isKeyboardEvent())
k = static_cast<KeyboardEvent*>(evt);
if (e && e->button() == RightButton) {
HTMLElement::defaultEventHandler(evt);
return;
}
// If the link is editable, then we need to check the settings to see whether or not to follow the link
if (isContentEditable()) {
EditableLinkBehavior editableLinkBehavior = EditableLinkDefaultBehavior;
if (Settings* settings = document()->settings())
editableLinkBehavior = settings->editableLinkBehavior();
switch (editableLinkBehavior) {
// Always follow the link (Safari 2.0 behavior)
default:
case EditableLinkDefaultBehavior:
case EditableLinkAlwaysLive:
break;
case EditableLinkNeverLive:
HTMLElement::defaultEventHandler(evt);
return;
// If the selection prior to clicking on this link resided in the same editable block as this link,
// and the shift key isn't pressed, we don't want to follow the link
case EditableLinkLiveWhenNotFocused:
if (e && !e->shiftKey() && m_rootEditableElementForSelectionOnMouseDown == rootEditableElement()) {
HTMLElement::defaultEventHandler(evt);
return;
}
break;
// Only follow the link if the shift key is down (WinIE/Firefox behavior)
case EditableLinkOnlyLiveWithShiftKey:
if (e && !e->shiftKey()) {
HTMLElement::defaultEventHandler(evt);
return;
}
break;
}
}
if (k) {
if (k->keyIdentifier() != "Enter") {
HTMLElement::defaultEventHandler(evt);
return;
}
evt->setDefaultHandled();
dispatchSimulatedClick(evt);
return;
}
String url = parseURL(getAttribute(hrefAttr));
ASSERT(evt->target());
ASSERT(evt->target()->toNode());
if (evt->target()->toNode()->hasTagName(imgTag)) {
HTMLImageElement* img = static_cast<HTMLImageElement*>(evt->target()->toNode());
if (img && img->isServerMap()) {
RenderImage* r = static_cast<RenderImage*>(img->renderer());
if (r && e) {
// FIXME: broken with transforms
FloatPoint absPos = r->localToAbsolute();
int x = e->pageX() - absPos.x();
int y = e->pageY() - absPos.y();
url += "?";
url += String::number(x);
url += ",";
url += String::number(y);
} else {
evt->setDefaultHandled();
HTMLElement::defaultEventHandler(evt);
return;
}
}
}
if (!evt->defaultPrevented() && document()->frame())
document()->frame()->loader()->urlSelected(document()->completeURL(url), getAttribute(targetAttr), evt, false, false, true);
evt->setDefaultHandled();
} else if (isLink() && isContentEditable()) {
// This keeps track of the editable block that the selection was in (if it was in one) just before the link was clicked
// for the LiveWhenNotFocused editable link behavior
if (evt->type() == eventNames().mousedownEvent && evt->isMouseEvent() && static_cast<MouseEvent*>(evt)->button() != RightButton && document()->frame() && document()->frame()->selection()) {
MouseEvent* e = static_cast<MouseEvent*>(evt);
//.........这里部分代码省略.........