void HTMLAnchorElement::parseAttribute(Attribute* attr) { if (attr->name() == hrefAttr) { bool wasLink = isLink(); setIsLink(!attr->isNull()); if (wasLink != isLink()) setNeedsStyleRecalc(); if (isLink()) { String parsedURL = stripLeadingAndTrailingHTMLSpaces(attr->value()); if (document()->isDNSPrefetchEnabled()) { if (protocolIs(parsedURL, "http") || protocolIs(parsedURL, "https") || parsedURL.startsWith("//")) prefetchDNS(document()->completeURL(parsedURL).host()); } if (document()->page() && !document()->page()->javaScriptURLsAreAllowed() && protocolIsJavaScript(parsedURL)) { clearIsLink(); // FIXME: This is horribly factored. if (Attribute* hrefAttribute = getAttributeItem(hrefAttr)) hrefAttribute->setValue(nullAtom); } #ifdef ARTEMIS else if(protocolIsJavaScript(parsedURL) && !hasEventListeners(eventNames().clickEvent)) { // Don't set the onclick event handler if it already has one. setAttributeEventListener(eventNames().clickEvent, createAttributeEventListener(this, attr)); } #endif } invalidateCachedVisitedLinkHash(); } else if (attr->name() == nameAttr || attr->name() == titleAttr) { // Do nothing. } else if (attr->name() == relAttr) setRel(attr->value()); else HTMLElement::parseAttribute(attr); }
void HTMLAnchorElement::parseAttribute(Attribute* attr) { if (attr->name() == hrefAttr) { bool wasLink = isLink(); setIsLink(!attr->isNull()); if (wasLink != isLink()) setNeedsStyleRecalc(); if (isLink()) { String parsedURL = stripLeadingAndTrailingHTMLSpaces(attr->value()); if (document()->isDNSPrefetchEnabled()) { if (protocolIs(parsedURL, "http") || protocolIs(parsedURL, "https") || parsedURL.startsWith("//")) prefetchDNS(document()->completeURL(parsedURL).host()); } if (document()->page() && !document()->page()->javaScriptURLsAreAllowed() && protocolIsJavaScript(parsedURL)) { clearIsLink(); attr->setValue(nullAtom); } } invalidateCachedVisitedLinkHash(); } else if (attr->name() == nameAttr || attr->name() == titleAttr) { // Do nothing. } else if (attr->name() == relAttr) setRel(attr->value()); else HTMLElement::parseAttribute(attr); }
void HTMLAnchorElement::parseAttribute(const QualifiedName& name, const AtomicString& value) { if (name == hrefAttr) { bool wasLink = isLink(); setIsLink(!value.isNull() && !shouldProhibitLinks(this)); if (wasLink != isLink()) setNeedsStyleRecalc(); if (isLink()) { String parsedURL = stripLeadingAndTrailingHTMLSpaces(value); if (document().isDNSPrefetchEnabled()) { if (protocolIsInHTTPFamily(parsedURL) || parsedURL.startsWith("//")) prefetchDNS(document().completeURL(parsedURL).host()); } } invalidateCachedVisitedLinkHash(); } else if (name == nameAttr || name == titleAttr) { // Do nothing. } else if (name == relAttr) { if (SpaceSplitString::spaceSplitStringContainsValue(value, "noreferrer", true)) m_linkRelations |= RelationNoReferrer; if (m_relList) m_relList->updateRelAttribute(value); } else HTMLElement::parseAttribute(name, value); }
void SVGAElement::svgAttributeChanged(const QualifiedName& attrName) { if (SVGURIReference::isKnownAttribute(attrName)) { bool wasLink = isLink(); setIsLink(!href().isNull() && !shouldProhibitLinks(this)); if (wasLink != isLink()) { InstanceInvalidationGuard guard(*this); setNeedsStyleRecalc(); } } SVGGraphicsElement::svgAttributeChanged(attrName); }
void SVGAElement::svgAttributeChanged(const QualifiedName& attrName) { SVGStyledTransformableElement::svgAttributeChanged(attrName); // Unlike other SVG*Element classes, SVGAElement only listens to SVGURIReference changes // as none of the other properties changes the linking behaviour for our <a> element. if (SVGURIReference::isKnownAttribute(attrName)) { bool wasLink = isLink(); setIsLink(!href().isNull()); if (wasLink != isLink()) setNeedsStyleRecalc(); } }
bool HTMLAnchorElement::canStartSelection() const { // FIXME: We probably want this same behavior in SVGAElement too if (!isLink()) return HTMLElement::canStartSelection(); return rendererIsEditable(); }
void HTMLAnchorElement::defaultEventHandler(Event* event) { if (isLink()) { if (focused() && isEnterKeyKeydownEvent(event) && treatLinkAsLiveForEventType(NonMouseEvent)) { event->setDefaultHandled(); dispatchSimulatedClick(event); return; } if (isLinkClick(event) && treatLinkAsLiveForEventType(eventType(event))) { handleClick(event); return; } if (rendererIsEditable()) { // 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 (event->type() == eventNames().mousedownEvent && event->isMouseEvent() && static_cast<MouseEvent*>(event)->button() != RightButton && document()->frame() && document()->frame()->selection()) { setRootEditableElementForSelectionOnMouseDown(document()->frame()->selection()->rootEditableElement()); m_wasShiftKeyDownOnMouseDown = static_cast<MouseEvent*>(event)->shiftKey(); } else if (event->type() == eventNames().mouseoverEvent) { // These are cleared on mouseover and not mouseout because their values are needed for drag events, // but drag events happen after mouse out events. clearRootEditableElementForSelectionOnMouseDown(); m_wasShiftKeyDownOnMouseDown = false; } } } HTMLElement::defaultEventHandler(event); }
bool SVGAElement::supportsFocus() const { if (hasEditableStyle()) return SVGGraphicsElement::supportsFocus(); // If not a link we should still be able to focus the element if it has a tabIndex. return isLink() || Element::supportsFocus(); }
bool HTMLAnchorElement::supportsFocus() const { if (rendererIsEditable()) return HTMLElement::supportsFocus(); // If not a link we should still be able to focus the element if it has tabIndex. return isLink() || HTMLElement::supportsFocus(); }
/*! \reimp */ QString BSciDrmFileEngine::fileName( FileName file ) const { if( baseName().isEmpty() ) return QFSFileEngine::fileName( file ); switch( file ) { case DefaultName: return defaultName(); case BaseName: return baseName(); case PathName: return QFSFileEngine::fileName( DefaultName ); case AbsoluteName: return QFSFileEngine::fileName( AbsoluteName ) + QDir::separator() + baseName(); case AbsolutePathName: return QFSFileEngine::fileName( AbsoluteName ); case LinkName: return isLink() ? QFSFileEngine::fileName( AbsoluteName ) + QDir::separator() + contentId() : QString(); case CanonicalName: QFSFileEngine::fileName( CanonicalName ) + QDir::separator() + contentId(); case CanonicalPathName: return QFSFileEngine::fileName( CanonicalName ); default: return QString(); } }
bool SVGAElement::isMouseFocusable() const { if (isLink()) return supportsFocus(); return SVGElement::isMouseFocusable(); }
bool SVGAElement::canStartSelection() const { if (!isLink()) return SVGElement::canStartSelection(); return hasEditableStyle(); }
bool TripleNetwork::doChangeLink(const link_id_t l, const node_id_t source, const node_id_t target) { if (isLink(source, target).first) return false; return TripleMultiNetwork::doChangeLink(l, source, target); }
bool Node::removeLink(int link_id) { std::vector<Link>::iterator it = std::find_if (links.begin(), links.end(), isLink(link_id)); //it points to a Link in links if(it!=links.end()) { //link found, can be removed links.erase(it); return true; } return false; }
bool SVGAElement::isKeyboardFocusable() const { if (isFocusable() && Element::supportsFocus()) return SVGElement::isKeyboardFocusable(); if (isLink()) return document().frameHost()->chrome().client().tabsToLinks(); return SVGElement::isKeyboardFocusable(); }
int Node::getLinkCost(int link_id) { std::vector<Link>::iterator it = std::find_if (links.begin(), links.end(), isLink(link_id)); if(it!=links.end()) { //link found return it->cost; } if(link_id==id) return 0; //link not found return -999; }
void SVGAElement::svgAttributeChanged(const QualifiedName& attrName) { if (!isSupportedAttribute(attrName)) { SVGGraphicsElement::svgAttributeChanged(attrName); return; } SVGElementInstance::InvalidationGuard invalidationGuard(this); // Unlike other SVG*Element classes, SVGAElement only listens to SVGURIReference changes // as none of the other properties changes the linking behaviour for our <a> element. if (SVGURIReference::isKnownAttribute(attrName)) { bool wasLink = isLink(); setIsLink(!href().isNull() && !shouldProhibitLinks(this)); if (wasLink != isLink()) setNeedsStyleRecalc(); } }
bool SVGAElement::isMouseFocusable() const { // Links are focusable by default, but only allow links with tabindex or contenteditable to be mouse focusable. // https://bugs.webkit.org/show_bug.cgi?id=26856 if (isLink()) return Element::supportsFocus(); return SVGElement::isMouseFocusable(); }
void SVGAElement::svgAttributeChanged(const QualifiedName& attrName) { // Unlike other SVG*Element classes, SVGAElement only listens to SVGURIReference changes // as none of the other properties changes the linking behaviour for our <a> element. if (SVGURIReference::isKnownAttribute(attrName)) { SVGElement::InvalidationGuard invalidationGuard(this); bool wasLink = isLink(); setIsLink(!hrefString().isNull()); if (wasLink != isLink()) setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracing::create(StyleChangeReason::LinkColorChange)); return; } SVGGraphicsElement::svgAttributeChanged(attrName); }
bool HTMLAnchorElement::isMouseFocusable() const { // Anchor elements should be mouse focusable, https://bugs.webkit.org/show_bug.cgi?id=26856 if (isLink()) // Only allow links with tabIndex or contentEditable to be mouse focusable. return HTMLElement::supportsFocus(); // Allow tab index etc to control focus. return HTMLElement::isMouseFocusable(); }
bool Node::setLink(int link_id, int new_cost) { std::vector<Link>::iterator it = std::find_if (links.begin(), links.end(), isLink(link_id)); //it points to a Link in links if(it!=links.end()) { //link found it->cost = new_cost; return true; } //link not found return false; }
bool SVGAElement::isKeyboardFocusable(KeyboardEvent* event) const { if (isFocusable() && Element::supportsFocus()) return SVGElement::isKeyboardFocusable(event); if (isLink()) return document().frame()->eventHandler().tabsToLinks(event); return SVGElement::isKeyboardFocusable(event); }
bool AccessibilityObject::allowsTextRanges() const { // Check type for the AccessibilityObject. if (isTextControl() || isWebArea() || isGroup() || isLink() || isHeading() || isListItem() || isTableCell()) return true; // Check roles as the last fallback mechanism. AccessibilityRole role = roleValue(); return role == ParagraphRole || role == LabelRole || role == DivRole || role == FormRole; }
void SVGAElement::defaultEventHandler(Event* evt) { 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) { SVGStyledTransformableElement::defaultEventHandler(evt); return; } if (k) { if (k->keyIdentifier() != "Enter") { SVGStyledTransformableElement::defaultEventHandler(evt); return; } evt->setDefaultHandled(); dispatchSimulatedClick(evt); return; } String target = this->target(); if (e && e->button() == MiddleButton) target = "_blank"; else if (target.isEmpty()) // if target is empty, default to "_self" or use xlink:target if set target = (getAttribute(XLinkNames::showAttr) == "new") ? "_blank" : "_self"; if (!evt->defaultPrevented()) { String url = deprecatedParseURL(href()); #if ENABLE(SVG_ANIMATION) if (url.startsWith("#")) { Element* targetElement = document()->getElementById(url.substring(1)); if (SVGSMILElement::isSMILElement(targetElement)) { SVGSMILElement* timed = static_cast<SVGSMILElement*>(targetElement); timed->beginByLinkActivation(); evt->setDefaultHandled(); SVGStyledTransformableElement::defaultEventHandler(evt); return; } } #endif if (document()->frame()) document()->frame()->loader()->urlSelected(document()->completeURL(url), target, evt, false, false, true, SendReferrer); } evt->setDefaultHandled(); } SVGStyledTransformableElement::defaultEventHandler(evt); }
bool HTMLAnchorElement::isMouseFocusable() const { #if !(PLATFORM(EFL) || PLATFORM(GTK)) // Only allow links with tabIndex or contentEditable to be mouse focusable. // This is our rule for the Mac platform; on many other platforms we focus any link you click on. if (isLink()) return HTMLElement::supportsFocus(); #endif return HTMLElement::isMouseFocusable(); }
void File::remove(bool bRecursive) { if (bRecursive && !isLink() && isDirectory()) { FileVector files; list(files, false); for (FileVector::iterator it = files.begin(); it != files.end(); ++it) { it->remove(true); } } FileImpl::remove(m_sPath); }
void HTMLAnchorElement::parseAttribute(const Attribute& attribute) { if (attribute.name() == hrefAttr) { bool wasLink = isLink(); setIsLink(!attribute.isNull()); if (wasLink != isLink()) setNeedsStyleRecalc(); if (isLink()) { String parsedURL = stripLeadingAndTrailingHTMLSpaces(attribute.value()); if (document()->isDNSPrefetchEnabled()) { if (protocolIs(parsedURL, "http") || protocolIs(parsedURL, "https") || parsedURL.startsWith("//")) prefetchDNS(document()->completeURL(parsedURL).host()); } } invalidateCachedVisitedLinkHash(); } else if (attribute.name() == nameAttr || attribute.name() == titleAttr) { // Do nothing. } else if (attribute.name() == relAttr) setRel(attribute.value()); else HTMLElement::parseAttribute(attribute); }
void File::remove(bool recursive) { if (recursive && !isLink() && isDirectory()) { std::vector<File> files; list(files); for (std::vector<File>::iterator it = files.begin(); it != files.end(); ++it) { it->remove(true); } } removeImpl(); }
void HTMLAnchorElement::parseAttribute(const QualifiedName& name, const AtomicString& value) { if (name == hrefAttr) { bool wasLink = isLink(); setIsLink(!value.isNull() && !shouldProhibitLinks(this)); if (wasLink != isLink()) didAffectSelector(AffectedSelectorLink | AffectedSelectorVisited | AffectedSelectorEnabled); if (isLink()) { String parsedURL = stripLeadingAndTrailingHTMLSpaces(value); if (document().isDNSPrefetchEnabled()) { if (protocolIsInHTTPFamily(parsedURL) || parsedURL.startsWith("//")) prefetchDNS(document().completeURL(parsedURL).host()); } } invalidateCachedVisitedLinkHash(); } else if (name == nameAttr || name == titleAttr) { // Do nothing. } else if (name == relAttr) setRel(value); else HTMLElement::parseAttribute(name, value); }
link_id_t TripleNetwork::doAddLink(const node_id_t source, const node_id_t target) { std::pair<bool, link_id_t> linkExists = isLink(source, target); link_id_t l; if (!linkExists.first) { l = TripleMultiNetwork::doAddLink(source, target); } else { l = linkExists.second; } return l; }