const AtomicString& JavaScriptAudioNode::interfaceName() const { return eventNames().interfaceForJavaScriptAudioNode; }
static unsigned logCanCacheFrameDecision(Frame* frame, int indentLevel) { PCLOG("+---"); if (!frame->loader().documentLoader()) { PCLOG(" -There is no DocumentLoader object"); return 1 << NoDocumentLoader; } URL currentURL = frame->loader().documentLoader()->url(); URL newURL = frame->loader().provisionalDocumentLoader() ? frame->loader().provisionalDocumentLoader()->url() : URL(); if (!newURL.isEmpty()) PCLOG(" Determining if frame can be cached navigating from (", currentURL.string(), ") to (", newURL.string(), "):"); else PCLOG(" Determining if subframe with URL (", currentURL.string(), ") can be cached:"); unsigned rejectReasons = 0; if (!frame->loader().documentLoader()->mainDocumentError().isNull()) { PCLOG(" -Main document has an error"); rejectReasons |= 1 << MainDocumentError; } if (frame->loader().documentLoader()->substituteData().isValid() && frame->loader().documentLoader()->substituteData().failingURL().isEmpty()) { PCLOG(" -Frame is an error page"); rejectReasons |= 1 << IsErrorPage; } if (frame->loader().subframeLoader().containsPlugins() && !frame->page()->settings().pageCacheSupportsPlugins()) { PCLOG(" -Frame contains plugins"); rejectReasons |= 1 << HasPlugins; } if (frame->document()->url().protocolIs("https") && (frame->loader().documentLoader()->response().cacheControlContainsNoCache() || frame->loader().documentLoader()->response().cacheControlContainsNoStore())) { PCLOG(" -Frame is HTTPS, and cache control prohibits caching or storing"); rejectReasons |= 1 << IsHttpsAndCacheControlled; } if (frame->document()->domWindow() && frame->document()->domWindow()->hasEventListeners(eventNames().unloadEvent)) { PCLOG(" -Frame has an unload event listener"); rejectReasons |= 1 << HasUnloadListener; } #if ENABLE(SQL_DATABASE) if (DatabaseManager::manager().hasOpenDatabases(frame->document())) { PCLOG(" -Frame has open database handles"); rejectReasons |= 1 << HasDatabaseHandles; } #endif #if ENABLE(SHARED_WORKERS) if (SharedWorkerRepository::hasSharedWorkers(frame->document())) { PCLOG(" -Frame has associated SharedWorkers"); rejectReasons |= 1 << HasSharedWorkers; } #endif if (!frame->loader().history().currentItem()) { PCLOG(" -No current history item"); rejectReasons |= 1 << NoHistoryItem; } if (frame->loader().quickRedirectComing()) { PCLOG(" -Quick redirect is coming"); rejectReasons |= 1 << QuickRedirectComing; } if (frame->loader().documentLoader()->isLoadingInAPISense()) { PCLOG(" -DocumentLoader is still loading in API sense"); rejectReasons |= 1 << IsLoadingInAPISense; } if (frame->loader().documentLoader()->isStopping()) { PCLOG(" -DocumentLoader is in the middle of stopping"); rejectReasons |= 1 << IsStopping; } if (!frame->document()->canSuspendActiveDOMObjects()) { PCLOG(" -The document cannot suspect its active DOM Objects"); rejectReasons |= 1 << CannotSuspendActiveDOMObjects; } if (!frame->loader().documentLoader()->applicationCacheHost()->canCacheInPageCache()) { PCLOG(" -The DocumentLoader uses an application cache"); rejectReasons |= 1 << DocumentLoaderUsesApplicationCache; } if (!frame->loader().client().canCachePage()) { PCLOG(" -The client says this frame cannot be cached"); rejectReasons |= 1 << ClientDeniesCaching; } HistogramSupport::histogramEnumeration("PageCache.FrameCacheable", !rejectReasons, 2); int reasonCount = 0; for (int i = 0; i < NumberOfReasonsFramesCannotBeInPageCache; ++i) { if (rejectReasons & (1 << i)) { ++reasonCount; HistogramSupport::histogramEnumeration("PageCache.FrameRejectReason", i, NumberOfReasonsFramesCannotBeInPageCache); } } HistogramSupport::histogramEnumeration("PageCache.FrameRejectReasonCount", reasonCount, 1 + NumberOfReasonsFramesCannotBeInPageCache); for (Frame* child = frame->tree().firstChild(); child; child = child->tree().nextSibling()) rejectReasons |= logCanCacheFrameDecision(child, indentLevel + 1); PCLOG(rejectReasons ? " Frame CANNOT be cached" : " Frame CAN be cached"); PCLOG("+---"); return rejectReasons; }
OfflineAudioCompletionEvent::OfflineAudioCompletionEvent(PassRefPtr<AudioBuffer> renderedBuffer) : Event(eventNames().completeEvent, true, false) , m_renderedBuffer(renderedBuffer) { }
bool ScriptController::processingUserGestureEvent() const { if (!m_windowShell) return false; if (Event* event = m_windowShell->window()->currentEvent()) { const AtomicString& type = event->type(); if ( // mouse events type == eventNames().clickEvent || type == eventNames().mousedownEvent || type == eventNames().mouseupEvent || type == eventNames().dblclickEvent || // keyboard events type == eventNames().keydownEvent || type == eventNames().keypressEvent || type == eventNames().keyupEvent || #if ENABLE(TOUCH_EVENTS) // Android // touch events type == eventNames().touchstartEvent || type == eventNames().touchmoveEvent || type == eventNames().touchendEvent || type == eventNames().touchcancelEvent || #endif // other accepted events type == eventNames().selectEvent || type == eventNames().changeEvent || type == eventNames().focusEvent || type == eventNames().blurEvent || type == eventNames().submitEvent) return true; } return false; }
static ImageEventSender& errorEventSender() { DEFINE_STATIC_LOCAL(ImageEventSender, sender, (eventNames().errorEvent)); return sender; }
void Notification::dispatchShowEvent() { dispatchEvent(Event::create(eventNames().showEvent, false, false)); }
bool isEnterKeyKeydownEvent(Event* event) { return event->type() == eventNames().keydownEvent && event->isKeyboardEvent() && toKeyboardEvent(event)->keyIdentifier() == "Enter"; }
void SpeechSynthesis::didStartSpeaking(PassRefPtr<PlatformSpeechSynthesisUtterance> utterance) { if (utterance->client()) fireEvent(eventNames().startEvent, static_cast<SpeechSynthesisUtterance*>(utterance->client()), 0, String()); }
void SpeechSynthesis::didResumeSpeaking(PassRefPtr<PlatformSpeechSynthesisUtterance> utterance) { m_isPaused = false; if (utterance->client()) fireEvent(eventNames().resumeEvent, static_cast<SpeechSynthesisUtterance*>(utterance->client()), 0, String()); }
void FileReader::didStartLoading() { fireEvent(eventNames().loadstartEvent); }
const AtomicString& MessagePort::interfaceName() const { return eventNames().interfaceForMessagePort; }
const AtomicString& DOMApplicationCache::interfaceName() const { return eventNames().interfaceForDOMApplicationCache; }
void HTMLTextAreaElement::defaultEventHandler(Event* event) { if (renderer() && (event->isMouseEvent() || event->isDragEvent() || event->hasInterface(eventNames().interfaceForWheelEvent) || event->type() == eventNames().blurEvent)) forwardEvent(event); else if (renderer() && event->isBeforeTextInsertedEvent()) handleBeforeTextInsertedEvent(static_cast<BeforeTextInsertedEvent*>(event)); HTMLTextFormControlElement::defaultEventHandler(event); }
virtual void performTask(ScriptExecutionContext *context) { AtomicString eventName = m_isOnLine ? eventNames().onlineEvent : eventNames().offlineEvent; toWorkerGlobalScope(context)->dispatchEvent(Event::create(eventName, false, false)); }
const AtomicString& TextTrackCue::interfaceName() const { return eventNames().interfaceForTextTrackCue; }
void SearchFieldCancelButtonElement::defaultEventHandler(Event* event) { // If the element is visible, on mouseup, clear the value, and set selection HTMLInputElement* input = static_cast<HTMLInputElement*>(shadowAncestorNode()); if (event->type() == eventNames().mousedownEvent && event->isMouseEvent() && static_cast<MouseEvent*>(event)->button() == LeftButton) { if (renderer() && renderer()->visibleToHitTesting()) { if (Frame* frame = document()->frame()) { frame->eventHandler()->setCapturingMouseEventsNode(this); m_capturing = true; } } input->focus(); input->select(); event->setDefaultHandled(); } if (event->type() == eventNames().mouseupEvent && event->isMouseEvent() && static_cast<MouseEvent*>(event)->button() == LeftButton) { if (m_capturing && renderer() && renderer()->visibleToHitTesting()) { if (Frame* frame = document()->frame()) { frame->eventHandler()->setCapturingMouseEventsNode(0); m_capturing = false; } #if !PLATFORM(OLYMPIA) // FIXME: It's always false on OLYMPIA platform. This problem depends on RIM bug #1067. if (hovered()) { #else if (event->target() == this) { #endif RefPtr<HTMLInputElement> protector(input); String oldValue = input->value(); input->setValue(""); if (!oldValue.isEmpty()) { toRenderTextControl(input->renderer())->setChangedSinceLastChangeEvent(true); input->dispatchEvent(Event::create(eventNames().inputEvent, true, false)); } input->onSearch(); event->setDefaultHandled(); } } } if (!event->defaultHandled()) HTMLDivElement::defaultEventHandler(event); } // ---------------------------- inline SpinButtonElement::SpinButtonElement(HTMLElement* shadowParent) : TextControlInnerElement(shadowParent->document(), shadowParent) , m_capturing(false) , m_upDownState(Indeterminate) , m_pressStartingState(Indeterminate) , m_repeatingTimer(this, &SpinButtonElement::repeatingTimerFired) { } PassRefPtr<SpinButtonElement> SpinButtonElement::create(HTMLElement* shadowParent) { return adoptRef(new SpinButtonElement(shadowParent)); } void SpinButtonElement::defaultEventHandler(Event* event) { if (!event->isMouseEvent()) { if (!event->defaultHandled()) HTMLDivElement::defaultEventHandler(event); return; } RenderBox* box = renderBox(); if (!box) { if (!event->defaultHandled()) HTMLDivElement::defaultEventHandler(event); return; } HTMLInputElement* input = static_cast<HTMLInputElement*>(shadowAncestorNode()); if (input->disabled() || input->isReadOnlyFormControl()) { if (!event->defaultHandled()) HTMLDivElement::defaultEventHandler(event); return; } MouseEvent* mouseEvent = static_cast<MouseEvent*>(event); IntPoint local = roundedIntPoint(box->absoluteToLocal(mouseEvent->absoluteLocation(), false, true)); if (mouseEvent->type() == eventNames().mousedownEvent && mouseEvent->button() == LeftButton) { if (box->borderBoxRect().contains(local)) { RefPtr<Node> protector(input); input->focus(); input->select(); input->stepUpFromRenderer(m_upDownState == Up ? 1 : -1); event->setDefaultHandled(); startRepeatingTimer(); } } else if (mouseEvent->type() == eventNames().mouseupEvent && mouseEvent->button() == LeftButton) stopRepeatingTimer(); else if (event->type() == eventNames().mousemoveEvent) { if (box->borderBoxRect().contains(local)) { if (!m_capturing) { if (Frame* frame = document()->frame()) { frame->eventHandler()->setCapturingMouseEventsNode(this); m_capturing = true; } } UpDownState oldUpDownState = m_upDownState; m_upDownState = local.y() < box->height() / 2 ? Up : Down; if (m_upDownState != oldUpDownState) renderer()->repaint(); } else { if (m_capturing) { stopRepeatingTimer(); if (Frame* frame = document()->frame()) { frame->eventHandler()->setCapturingMouseEventsNode(0); m_capturing = false; } } } } if (!event->defaultHandled()) HTMLDivElement::defaultEventHandler(event); } void SpinButtonElement::startRepeatingTimer() { m_pressStartingState = m_upDownState; ScrollbarTheme* theme = ScrollbarTheme::nativeTheme(); m_repeatingTimer.start(theme->initialAutoscrollTimerDelay(), theme->autoscrollTimerDelay()); }
const AtomicString& Notification::interfaceName() const { return eventNames().interfaceForNotification; }
void WebSocket::didConnect() { LOG(Network, "WebSocket %p didConnect", this); if (m_state != CONNECTING) { didClose(); return; } m_state = OPEN; scriptExecutionContext()->postTask(ProcessWebSocketEventTask::create(this, Event::create(eventNames().openEvent, false, false))); }
void Notification::dispatchCloseEvent() { dispatchEvent(Event::create(eventNames().closeEvent, false, false)); }
void WebSocket::didClose() { LOG(Network, "WebSocket %p didClose", this); m_state = CLOSED; scriptExecutionContext()->postTask(ProcessWebSocketEventTask::create(this, Event::create(eventNames().closeEvent, false, false))); }
bool isLinkClick(Event* event) { return event->type() == eventNames().clickEvent && (!event->isMouseEvent() || toMouseEvent(event)->button() != RightButton); }
const AtomicString& Event::interfaceName() const { return eventNames().interfaceForEvent; }
static ImageEventSender& beforeLoadEventSender() { DEFINE_STATIC_LOCAL(ImageEventSender, sender, (eventNames().beforeloadEvent)); return sender; }
const AtomicString& PeerConnection00::interfaceName() const { return eventNames().interfaceForPeerConnection00; }
void EditorClient::handleKeyboardEvent(KeyboardEvent* event) { Node* node = event->target()->toNode(); ASSERT(node); Frame* frame = node->document()->frame(); ASSERT(frame); const PlatformKeyboardEvent* platformEvent = event->keyEvent(); if (!platformEvent) return; generateEditorCommands(event); if (m_pendingEditorCommands.size() > 0) { // During RawKeyDown events if an editor command will insert text, defer // the insertion until the keypress event. We want keydown to bubble up // through the DOM first. if (platformEvent->type() == PlatformKeyboardEvent::RawKeyDown) { if (executePendingEditorCommands(frame, false)) event->setDefaultHandled(); return; } // Only allow text insertion commands if the current node is editable. if (executePendingEditorCommands(frame, frame->editor()->canEdit())) { event->setDefaultHandled(); return; } } // Don't allow text insertion for nodes that cannot edit. if (!frame->editor()->canEdit()) return; // This is just a normal text insertion, so wait to execute the insertion // until a keypress event happens. This will ensure that the insertion will not // be reflected in the contents of the field until the keyup DOM event. if (event->type() == eventNames().keypressEvent) { // If we have a pending composition at this point, it happened while // filtering a keypress, so we treat it as a normal text insertion. // This will also ensure that if the keypress event handler changed the // currently focused node, the text is still inserted into the original // node (insertText() has this logic, but confirmComposition() does not). if (m_pendingComposition) { frame->editor()->insertText(String::fromUTF8(m_pendingComposition.get()), event); clearPendingComposition(); event->setDefaultHandled(); } else { // Don't insert null or control characters as they can result in unexpected behaviour if (event->charCode() < ' ') return; // Don't insert anything if a modifier is pressed if (platformEvent->ctrlKey() || platformEvent->altKey()) return; if (frame->editor()->insertText(platformEvent->text(), event)) event->setDefaultHandled(); } } }
const AtomicString& WebKitNamedFlow::interfaceName() const { return eventNames().interfaceForWebKitNamedFlow; }
const AtomicString& Worker::interfaceName() const { return eventNames().interfaceForWorker; }
AtomicString HTMLElement::eventNameForAttributeName(const QualifiedName& attrName) const { if (!attrName.namespaceURI().isNull()) return AtomicString(); typedef HashMap<AtomicString, AtomicString> StringToStringMap; DEFINE_STATIC_LOCAL(StringToStringMap, attributeNameToEventNameMap, ()); if (!attributeNameToEventNameMap.size()) { attributeNameToEventNameMap.set(onanimationstartAttr.localName(), eventNames().animationstartEvent); attributeNameToEventNameMap.set(onanimationiterationAttr.localName(), eventNames().animationiterationEvent); attributeNameToEventNameMap.set(onanimationendAttr.localName(), eventNames().animationendEvent); attributeNameToEventNameMap.set(onclickAttr.localName(), eventNames().clickEvent); attributeNameToEventNameMap.set(oncontextmenuAttr.localName(), eventNames().contextmenuEvent); attributeNameToEventNameMap.set(ondblclickAttr.localName(), eventNames().dblclickEvent); attributeNameToEventNameMap.set(onmousedownAttr.localName(), eventNames().mousedownEvent); attributeNameToEventNameMap.set(onmouseenterAttr.localName(), eventNames().mouseenterEvent); attributeNameToEventNameMap.set(onmouseleaveAttr.localName(), eventNames().mouseleaveEvent); attributeNameToEventNameMap.set(onmousemoveAttr.localName(), eventNames().mousemoveEvent); attributeNameToEventNameMap.set(onmouseoutAttr.localName(), eventNames().mouseoutEvent); attributeNameToEventNameMap.set(onmouseoverAttr.localName(), eventNames().mouseoverEvent); attributeNameToEventNameMap.set(onmouseupAttr.localName(), eventNames().mouseupEvent); attributeNameToEventNameMap.set(onmousewheelAttr.localName(), eventNames().mousewheelEvent); attributeNameToEventNameMap.set(onwheelAttr.localName(), eventNames().wheelEvent); attributeNameToEventNameMap.set(onfocusAttr.localName(), eventNames().focusEvent); attributeNameToEventNameMap.set(onfocusinAttr.localName(), eventNames().focusinEvent); attributeNameToEventNameMap.set(onfocusoutAttr.localName(), eventNames().focusoutEvent); attributeNameToEventNameMap.set(onblurAttr.localName(), eventNames().blurEvent); attributeNameToEventNameMap.set(onkeydownAttr.localName(), eventNames().keydownEvent); attributeNameToEventNameMap.set(onkeypressAttr.localName(), eventNames().keypressEvent); attributeNameToEventNameMap.set(onkeyupAttr.localName(), eventNames().keyupEvent); attributeNameToEventNameMap.set(onscrollAttr.localName(), eventNames().scrollEvent); attributeNameToEventNameMap.set(onbeforecutAttr.localName(), eventNames().beforecutEvent); attributeNameToEventNameMap.set(oncutAttr.localName(), eventNames().cutEvent); attributeNameToEventNameMap.set(onbeforecopyAttr.localName(), eventNames().beforecopyEvent); attributeNameToEventNameMap.set(oncopyAttr.localName(), eventNames().copyEvent); attributeNameToEventNameMap.set(onbeforepasteAttr.localName(), eventNames().beforepasteEvent); attributeNameToEventNameMap.set(onpasteAttr.localName(), eventNames().pasteEvent); attributeNameToEventNameMap.set(ondragenterAttr.localName(), eventNames().dragenterEvent); attributeNameToEventNameMap.set(ondragoverAttr.localName(), eventNames().dragoverEvent); attributeNameToEventNameMap.set(ondragleaveAttr.localName(), eventNames().dragleaveEvent); attributeNameToEventNameMap.set(ondropAttr.localName(), eventNames().dropEvent); attributeNameToEventNameMap.set(ondragstartAttr.localName(), eventNames().dragstartEvent); attributeNameToEventNameMap.set(ondragAttr.localName(), eventNames().dragEvent); attributeNameToEventNameMap.set(ondragendAttr.localName(), eventNames().dragendEvent); attributeNameToEventNameMap.set(onselectstartAttr.localName(), eventNames().selectstartEvent); attributeNameToEventNameMap.set(onsubmitAttr.localName(), eventNames().submitEvent); attributeNameToEventNameMap.set(onerrorAttr.localName(), eventNames().errorEvent); attributeNameToEventNameMap.set(onwebkitanimationstartAttr.localName(), eventNames().webkitAnimationStartEvent); attributeNameToEventNameMap.set(onwebkitanimationiterationAttr.localName(), eventNames().webkitAnimationIterationEvent); attributeNameToEventNameMap.set(onwebkitanimationendAttr.localName(), eventNames().webkitAnimationEndEvent); attributeNameToEventNameMap.set(onwebkittransitionendAttr.localName(), eventNames().webkitTransitionEndEvent); attributeNameToEventNameMap.set(ontransitionendAttr.localName(), eventNames().webkitTransitionEndEvent); attributeNameToEventNameMap.set(oninputAttr.localName(), eventNames().inputEvent); attributeNameToEventNameMap.set(oninvalidAttr.localName(), eventNames().invalidEvent); attributeNameToEventNameMap.set(ontouchstartAttr.localName(), eventNames().touchstartEvent); attributeNameToEventNameMap.set(ontouchmoveAttr.localName(), eventNames().touchmoveEvent); attributeNameToEventNameMap.set(ontouchendAttr.localName(), eventNames().touchendEvent); attributeNameToEventNameMap.set(ontouchcancelAttr.localName(), eventNames().touchcancelEvent); attributeNameToEventNameMap.set(onwebkitfullscreenchangeAttr.localName(), eventNames().webkitfullscreenchangeEvent); attributeNameToEventNameMap.set(onwebkitfullscreenerrorAttr.localName(), eventNames().webkitfullscreenerrorEvent); attributeNameToEventNameMap.set(onabortAttr.localName(), eventNames().abortEvent); attributeNameToEventNameMap.set(oncanplayAttr.localName(), eventNames().canplayEvent); attributeNameToEventNameMap.set(oncanplaythroughAttr.localName(), eventNames().canplaythroughEvent); attributeNameToEventNameMap.set(onchangeAttr.localName(), eventNames().changeEvent); attributeNameToEventNameMap.set(ondurationchangeAttr.localName(), eventNames().durationchangeEvent); attributeNameToEventNameMap.set(onemptiedAttr.localName(), eventNames().emptiedEvent); attributeNameToEventNameMap.set(onendedAttr.localName(), eventNames().endedEvent); attributeNameToEventNameMap.set(onloadeddataAttr.localName(), eventNames().loadeddataEvent); attributeNameToEventNameMap.set(onloadedmetadataAttr.localName(), eventNames().loadedmetadataEvent); attributeNameToEventNameMap.set(onloadstartAttr.localName(), eventNames().loadstartEvent); attributeNameToEventNameMap.set(onpauseAttr.localName(), eventNames().pauseEvent); attributeNameToEventNameMap.set(onplayAttr.localName(), eventNames().playEvent); attributeNameToEventNameMap.set(onplayingAttr.localName(), eventNames().playingEvent); attributeNameToEventNameMap.set(onprogressAttr.localName(), eventNames().progressEvent); attributeNameToEventNameMap.set(onratechangeAttr.localName(), eventNames().ratechangeEvent); attributeNameToEventNameMap.set(onresetAttr.localName(), eventNames().resetEvent); attributeNameToEventNameMap.set(onseekedAttr.localName(), eventNames().seekedEvent); attributeNameToEventNameMap.set(onseekingAttr.localName(), eventNames().seekingEvent); attributeNameToEventNameMap.set(onselectAttr.localName(), eventNames().selectEvent); attributeNameToEventNameMap.set(onstalledAttr.localName(), eventNames().stalledEvent); attributeNameToEventNameMap.set(onsuspendAttr.localName(), eventNames().suspendEvent); attributeNameToEventNameMap.set(ontimeupdateAttr.localName(), eventNames().timeupdateEvent); attributeNameToEventNameMap.set(onvolumechangeAttr.localName(), eventNames().volumechangeEvent); attributeNameToEventNameMap.set(onwaitingAttr.localName(), eventNames().waitingEvent); attributeNameToEventNameMap.set(onloadAttr.localName(), eventNames().loadEvent); } return attributeNameToEventNameMap.get(attrName.localName()); }
const AtomicString& OfflineAudioCompletionEvent::interfaceName() const { return eventNames().interfaceForOfflineAudioCompletionEvent; }
const AtomicString& MediaStreamEvent::interfaceName() const { return eventNames().interfaceForMediaStreamEvent; }