本文整理汇总了C++中HTMLAreaElement类的典型用法代码示例。如果您正苦于以下问题:C++ HTMLAreaElement类的具体用法?C++ HTMLAreaElement怎么用?C++ HTMLAreaElement使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了HTMLAreaElement类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: visibleNode
FocusCandidate::FocusCandidate(Node* node, FocusDirection direction)
: visibleNode(0)
, focusableNode(0)
, enclosingScrollableBox(0)
, distance(maxDistance())
, parentDistance(maxDistance())
, alignment(None)
, parentAlignment(None)
, isOffscreen(true)
, isOffscreenAfterScrolling(true)
{
ASSERT(node);
ASSERT(node->isElementNode());
if (node->hasTagName(HTMLNames::areaTag)) {
HTMLAreaElement* area = static_cast<HTMLAreaElement*>(node);
HTMLImageElement* image = area->imageElement();
if (!image || !image->renderer())
return;
visibleNode = image;
rect = virtualRectForAreaElementAndDirection(area, direction);
} else {
if (!node->renderer())
return;
visibleNode = node;
rect = nodeRectInAbsoluteCoordinates(node, true /* ignore border */);
}
focusableNode = node;
isOffscreen = hasOffscreenRect(visibleNode);
isOffscreenAfterScrolling = hasOffscreenRect(visibleNode, direction);
}
示例2: searchAttrGetter
static v8::Handle<v8::Value> searchAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
INC_STATS("DOM.HTMLAreaElement.search._get");
HTMLAreaElement* imp = V8HTMLAreaElement::toNative(info.Holder());
if (!R_check(imp)) return v8::Handle<v8::Value>(v8::Undefined());
return v8String(imp->search());
}
示例3: noHrefAttrGetter
static v8::Handle<v8::Value> noHrefAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
INC_STATS("DOM.HTMLAreaElement.noHref._get");
HTMLAreaElement* imp = V8HTMLAreaElement::toNative(info.Holder());
if (!R_check(imp)) return v8::Handle<v8::Value>(v8::Undefined());
return v8Boolean(imp->hasAttribute(WebCore::HTMLNames::nohrefAttr));
}
示例4: noHrefAttrSetter
static void noHrefAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info) {
INC_STATS("DOM.HTMLAreaElement.noHref._set");
HTMLAreaElement* imp = V8HTMLAreaElement::toNative(info.Holder());
bool v = value->BooleanValue();
imp->setNoHref(v);
return;
}
示例5: elementForTapHighlight
// This method filters what element will get tap-highlight'ed or not. To start with,
// we are going to highlight links (anchors with a valid href element), and elements
// whose tap highlight color value is different than the default value.
static Element* elementForTapHighlight(Element* elementUnderFatFinger)
{
// Do not bail out right way here if there element does not have a renderer.
// It is the casefor <map> (descendent of <area>) elements. The associated <image>
// element actually has the renderer.
if (elementUnderFatFinger->renderer()) {
Color tapHighlightColor = elementUnderFatFinger->renderStyle()->tapHighlightColor();
if (tapHighlightColor != RenderTheme::defaultTheme()->platformTapHighlightColor())
return elementUnderFatFinger;
}
bool isArea = elementUnderFatFinger->hasTagName(HTMLNames::areaTag);
Node* linkNode = elementUnderFatFinger->enclosingLinkEventParentOrSelf();
if (!linkNode || !linkNode->isHTMLElement() || (!linkNode->renderer() && !isArea))
return 0;
ASSERT(linkNode->isLink());
// FatFingers class selector ensure only anchor with valid href attr value get here.
// It includes empty hrefs.
Element* highlightCandidateElement = static_cast<Element*>(linkNode);
if (!isArea)
return highlightCandidateElement;
HTMLAreaElement* area = static_cast<HTMLAreaElement*>(highlightCandidateElement);
HTMLImageElement* image = area->imageElement();
if (image && image->renderer())
return image;
return 0;
}
示例6: virtualRectForAreaElementAndDirection
LayoutRect virtualRectForAreaElementAndDirection(HTMLAreaElement& area, FocusType type)
{
ASSERT(area.imageElement());
// Area elements tend to overlap more than other focusable elements. We flatten the rect of the area elements
// to minimize the effect of overlapping areas.
LayoutRect rect = virtualRectForDirection(type, rectToAbsoluteCoordinates(area.document().frame(), area.computeRect(area.imageElement()->renderer())), 1);
return rect;
}
示例7: mapMouseEvent
bool HTMLMapElement::mapMouseEvent(LayoutPoint location, const LayoutSize& size, HitTestResult& result)
{
HTMLAreaElement* defaultArea = 0;
for (HTMLAreaElement* area = Traversal<HTMLAreaElement>::firstWithin(*this); area; area = Traversal<HTMLAreaElement>::next(*area, this)) {
if (area->isDefault()) {
if (!defaultArea)
defaultArea = area;
} else if (area->mapMouseEvent(location, size, result)) {
return true;
}
}
if (defaultArea) {
result.setInnerNode(defaultArea);
result.setURLElement(defaultArea);
}
return defaultArea;
}
示例8: while
bool HTMLMapElement::mapMouseEvent(LayoutPoint location, const LayoutSize& size, HitTestResult& result)
{
HTMLAreaElement* defaultArea = 0;
Element* element = this;
while ((element = ElementTraversal::next(element, this))) {
if (element->hasTagName(areaTag)) {
HTMLAreaElement* areaElt = static_cast<HTMLAreaElement*>(element);
if (areaElt->isDefault()) {
if (!defaultArea)
defaultArea = areaElt;
} else if (areaElt->mapMouseEvent(location, size, result))
return true;
}
}
if (defaultArea) {
result.setInnerNode(defaultArea);
result.setURLElement(defaultArea);
}
return defaultArea;
}
示例9: while
bool HTMLMapElement::mapMouseEvent(int x, int y, const IntSize& size, HitTestResult& result)
{
HTMLAreaElement* defaultArea = 0;
Node *node = this;
while ((node = node->traverseNextNode(this))) {
if (node->hasTagName(areaTag)) {
HTMLAreaElement* areaElt = static_cast<HTMLAreaElement*>(node);
if (areaElt->isDefault()) {
if (!defaultArea)
defaultArea = areaElt;
} else if (areaElt->mapMouseEvent(x, y, size, result))
return true;
}
}
if (defaultArea) {
result.setInnerNode(defaultArea);
result.setURLElement(defaultArea);
}
return defaultArea;
}
示例10: toHTMLAreaElement
void RenderImage::paintAreaElementFocusRing(PaintInfo& paintInfo)
{
Document* document = this->document();
if (document->printing() || !document->frame()->selection()->isFocusedAndActive())
return;
if (paintInfo.context->paintingDisabled() && !paintInfo.context->updatingControlTints())
return;
Element* focusedElement = document->focusedElement();
if (!focusedElement || !isHTMLAreaElement(focusedElement))
return;
HTMLAreaElement* areaElement = toHTMLAreaElement(focusedElement);
if (areaElement->imageElement() != node())
return;
// Even if the theme handles focus ring drawing for entire elements, it won't do it for
// an area within an image, so we don't call RenderTheme::supportsFocusRing here.
Path path = areaElement->computePath(this);
if (path.isEmpty())
return;
RenderStyle* areaElementStyle = areaElement->computedStyle();
unsigned short outlineWidth = areaElementStyle->outlineWidth();
if (!outlineWidth)
return;
// FIXME: Clip path instead of context when Skia pathops is ready.
// https://crbug.com/251206
GraphicsContextStateSaver savedContext(*paintInfo.context);
paintInfo.context->clip(absoluteContentBox());
paintInfo.context->drawFocusRing(path, outlineWidth,
areaElementStyle->outlineOffset(),
resolveColor(areaElementStyle, CSSPropertyOutlineColor));
}
开发者ID:IllusionRom-deprecated,项目名称:android_platform_external_chromium_org_third_party_WebKit,代码行数:38,代码来源:RenderImage.cpp
示例11: paintAreaElementFocusRing
void RenderImage::paintAreaElementFocusRing(PaintInfo& paintInfo)
{
Document* document = this->document();
if (document->printing() || !document->frame()->selection()->isFocusedAndActive())
return;
if (paintInfo.context->paintingDisabled() && !paintInfo.context->updatingControlTints())
return;
Node* focusedNode = document->focusedNode();
if (!focusedNode || !focusedNode->hasTagName(areaTag))
return;
HTMLAreaElement* areaElement = static_cast<HTMLAreaElement*>(focusedNode);
if (areaElement->imageElement() != node())
return;
// Even if the theme handles focus ring drawing for entire elements, it won't do it for
// an area within an image, so we don't call RenderTheme::supportsFocusRing here.
Path path = areaElement->computePath(this);
if (path.isEmpty())
return;
// FIXME: Do we need additional code to clip the path to the image's bounding box?
RenderStyle* areaElementStyle = areaElement->computedStyle();
unsigned short outlineWidth = areaElementStyle->outlineWidth();
if (!outlineWidth)
return;
paintInfo.context->drawFocusRing(path, outlineWidth,
areaElementStyle->outlineOffset(),
areaElementStyle->visitedDependentColor(CSSPropertyOutlineColor));
}
示例12: imageMap
void RenderImage::paintFocusRings(PaintInfo& paintInfo, const RenderStyle* style)
{
// Don't draw focus rings if printing.
if (document()->printing() || !document()->frame()->selection()->isFocusedAndActive())
return;
if (paintInfo.context->paintingDisabled() && !paintInfo.context->updatingControlTints())
return;
HTMLMapElement* mapElement = imageMap();
if (!mapElement)
return;
Document* document = mapElement->document();
if (!document)
return;
Node* focusedNode = document->focusedNode();
if (!focusedNode)
return;
RefPtr<HTMLCollection> areas = mapElement->areas();
unsigned numAreas = areas->length();
// FIXME: Clip the paths to the image bounding box.
for (unsigned k = 0; k < numAreas; ++k) {
HTMLAreaElement* areaElement = static_cast<HTMLAreaElement*>(areas->item(k));
if (focusedNode != areaElement)
continue;
Vector<Path> focusRingPaths;
focusRingPaths.append(areaElement->getPath(this));
paintInfo.context->drawFocusRing(focusRingPaths, style->outlineWidth(), style->outlineOffset(), style->outlineColor());
break;
}
}
示例13: focusedOrMainFrame
bool FocusController::advanceFocusDirectionally(FocusDirection direction, KeyboardEvent* event)
{
Frame* curFrame = focusedOrMainFrame();
ASSERT(curFrame);
Document* focusedDocument = curFrame->document();
if (!focusedDocument)
return false;
Node* focusedNode = focusedDocument->focusedNode();
Node* container = focusedDocument;
if (container->isDocumentNode())
static_cast<Document*>(container)->updateLayoutIgnorePendingStylesheets();
// Figure out the starting rect.
LayoutRect startingRect;
if (focusedNode) {
if (!hasOffscreenRect(focusedNode)) {
container = scrollableEnclosingBoxOrParentFrameForNodeInDirection(direction, focusedNode);
startingRect = nodeRectInAbsoluteCoordinates(focusedNode, true /* ignore border */);
} else if (focusedNode->hasTagName(areaTag)) {
HTMLAreaElement* area = static_cast<HTMLAreaElement*>(focusedNode);
container = scrollableEnclosingBoxOrParentFrameForNodeInDirection(direction, area->imageElement());
startingRect = virtualRectForAreaElementAndDirection(area, direction);
}
}
bool consumed = false;
do {
consumed = advanceFocusDirectionallyInContainer(container, startingRect, direction, event);
startingRect = nodeRectInAbsoluteCoordinates(container, true /* ignore border */);
container = scrollableEnclosingBoxOrParentFrameForNodeInDirection(direction, container);
if (container && container->isDocumentNode())
static_cast<Document*>(container)->updateLayoutIgnorePendingStylesheets();
} while (!consumed && container);
return consumed;
}
示例14: hrefAttrGetter
static v8::Handle<v8::Value> hrefAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
INC_STATS("DOM.HTMLAreaElement.href._get");
HTMLAreaElement* imp = V8HTMLAreaElement::toNative(info.Holder());
return v8String(imp->getURLAttribute(WebCore::HTMLNames::hrefAttr));
}
示例15: noHrefAttrGetter
static v8::Handle<v8::Value> noHrefAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) {
INC_STATS("DOM.HTMLAreaElement.noHref._get");
HTMLAreaElement* imp = V8HTMLAreaElement::toNative(info.Holder());
return v8Boolean(imp->noHref());
}