diff options
Diffstat (limited to 'src/3rdparty/webkit/WebCore/dom')
31 files changed, 356 insertions, 102 deletions
diff --git a/src/3rdparty/webkit/WebCore/dom/BeforeLoadEvent.h b/src/3rdparty/webkit/WebCore/dom/BeforeLoadEvent.h new file mode 100644 index 0000000..fc5814a --- /dev/null +++ b/src/3rdparty/webkit/WebCore/dom/BeforeLoadEvent.h @@ -0,0 +1,67 @@ +/* + * Copyright (C) 2009 Apple Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef BeforeLoadEvent_h +#define BeforeLoadEvent_h + +#include "Event.h" +#include "EventNames.h" + +namespace WebCore { + +class BeforeLoadEvent : public Event { +public: + virtual bool isBeforeLoadEvent() const { return true; } + + static PassRefPtr<BeforeLoadEvent> create(const String& url) + { + return adoptRef(new BeforeLoadEvent(url)); + } + + void initBeforeLoadEvent(const AtomicString& type, bool canBubble, bool cancelable, const String& url) + { + if (dispatched()) + return; + + initEvent(type, canBubble, cancelable); + + m_url = url; + } + + const String& url() const { return m_url; } + +private: + BeforeLoadEvent(const String& url) + : Event(eventNames().beforeloadEvent, false, true) + , m_url(url) + {} + + String m_url; +}; + +} // namespace WebCore + +#endif // BeforeLoadEvent_h diff --git a/src/3rdparty/webkit/WebCore/dom/BeforeLoadEvent.idl b/src/3rdparty/webkit/WebCore/dom/BeforeLoadEvent.idl new file mode 100644 index 0000000..d06a39d --- /dev/null +++ b/src/3rdparty/webkit/WebCore/dom/BeforeLoadEvent.idl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2009 Apple Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +module events { + + interface [ + GenerateConstructor + ] BeforeLoadEvent : Event { + void initBeforeLoadEvent(in DOMString type, + in boolean canBubble, + in boolean cancelable, + in DOMString url); + readonly attribute DOMString url; + }; + +} diff --git a/src/3rdparty/webkit/WebCore/dom/ContainerNode.cpp b/src/3rdparty/webkit/WebCore/dom/ContainerNode.cpp index 7274b5d..5cd0781 100644 --- a/src/3rdparty/webkit/WebCore/dom/ContainerNode.cpp +++ b/src/3rdparty/webkit/WebCore/dom/ContainerNode.cpp @@ -23,6 +23,7 @@ #include "config.h" #include "ContainerNode.h" +#include "BeforeLoadEvent.h" #include "Cache.h" #include "ContainerNodeAlgorithms.h" #include "DeleteButtonController.h" @@ -909,4 +910,15 @@ static void dispatchChildRemovalEvents(Node* child) } } +bool ContainerNode::dispatchBeforeLoadEvent(const String& sourceURL) +{ + if (!document()->hasListenerType(Document::BEFORELOAD_LISTENER)) + return true; + + RefPtr<ContainerNode> protector(this); + RefPtr<BeforeLoadEvent> beforeLoadEvent = BeforeLoadEvent::create(sourceURL); + dispatchEvent(beforeLoadEvent.get()); + return !beforeLoadEvent->defaultPrevented(); +} + } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/dom/ContainerNode.h b/src/3rdparty/webkit/WebCore/dom/ContainerNode.h index aa480a7..9789f1f 100644 --- a/src/3rdparty/webkit/WebCore/dom/ContainerNode.h +++ b/src/3rdparty/webkit/WebCore/dom/ContainerNode.h @@ -71,6 +71,8 @@ public: void removeAllChildren(); void cloneChildNodes(ContainerNode* clone); + + bool dispatchBeforeLoadEvent(const String& sourceURL); protected: ContainerNode(Document*, ConstructionType = CreateContainer); diff --git a/src/3rdparty/webkit/WebCore/dom/Document.cpp b/src/3rdparty/webkit/WebCore/dom/Document.cpp index 6dba900..475a8c1 100644 --- a/src/3rdparty/webkit/WebCore/dom/Document.cpp +++ b/src/3rdparty/webkit/WebCore/dom/Document.cpp @@ -943,7 +943,7 @@ Element* Document::elementFromPoint(int x, int y) const return 0; float zoomFactor = frame->pageZoomFactor(); - IntPoint point = roundedIntPoint(FloatPoint(x * zoomFactor, y * zoomFactor)) + view()->scrollOffset(); + IntPoint point = roundedIntPoint(FloatPoint((x + view()->scrollX()) * zoomFactor, (y + view()->scrollY()) * zoomFactor)); if (!frameView->visibleContentRect().contains(point)) return 0; @@ -973,7 +973,7 @@ PassRefPtr<Range> Document::caretRangeFromPoint(int x, int y) return 0; float zoomFactor = frame->pageZoomFactor(); - IntPoint point = roundedIntPoint(FloatPoint(x * zoomFactor, y * zoomFactor)) + view()->scrollOffset(); + IntPoint point = roundedIntPoint(FloatPoint((x + view()->scrollX()) * zoomFactor, (y + view()->scrollY()) * zoomFactor)); if (!frameView->visibleContentRect().contains(point)) return 0; @@ -1561,6 +1561,9 @@ void Document::open(Document* ownerDocument) implicitOpen(); + if (DOMWindow* domWindow = this->domWindow()) + domWindow->removeAllEventListeners(); + if (m_frame) m_frame->loader()->didExplicitOpen(); } @@ -1582,7 +1585,11 @@ void Document::implicitOpen() { cancelParsing(); - clear(); + delete m_tokenizer; + m_tokenizer = 0; + + removeChildren(); + m_tokenizer = createTokenizer(); setParsing(true); @@ -1664,7 +1671,7 @@ void Document::implicitClose() return; } - bool wasLocationChangePending = frame() && frame()->loader()->isScheduledLocationChangePending(); + bool wasLocationChangePending = frame() && frame()->redirectScheduler()->locationChangePending(); bool doload = !parsing() && m_tokenizer && !m_processingLoadEvent && !wasLocationChangePending; if (!doload) @@ -1711,7 +1718,7 @@ void Document::implicitClose() if (f) f->animation()->resumeAnimations(this); - ImageLoader::dispatchPendingLoadEvents(); + ImageLoader::dispatchPendingEvents(); dispatchWindowLoadEvent(); dispatchWindowEvent(PageTransitionEvent::create(eventNames().pageshowEvent, false), this); if (f) @@ -1731,7 +1738,7 @@ void Document::implicitClose() // fires. This will improve onload scores, and other browsers do it. // If they wanna cheat, we can too. -dwh - if (frame()->loader()->isScheduledLocationChangePending() && elapsedTime() < cLayoutScheduleThreshold) { + if (frame()->redirectScheduler()->locationChangePending() && elapsedTime() < cLayoutScheduleThreshold) { // Just bail out. Before or during the onload we were shifted to another page. // The old i-Bench suite does this. When this happens don't bother painting or laying out. view()->unscheduleRelayout(); @@ -1860,16 +1867,6 @@ void Document::finishParsing() m_tokenizer->finish(); } -void Document::clear() -{ - delete m_tokenizer; - m_tokenizer = 0; - - removeChildren(); - if (DOMWindow* domWindow = this->domWindow()) - domWindow->removeAllEventListeners(); -} - const KURL& Document::virtualURL() const { return m_url; @@ -1969,7 +1966,7 @@ const Vector<RefPtr<CSSStyleSheet> >* Document::pageGroupUserSheets() const const UserStyleSheetVector* sheets = it->second; for (unsigned i = 0; i < sheets->size(); ++i) { const UserStyleSheet* sheet = sheets->at(i).get(); - if (!UserContentURLPattern::matchesPatterns(url(), sheet->patterns())) + if (!UserContentURLPattern::matchesPatterns(url(), sheet->whitelist(), sheet->blacklist())) continue; RefPtr<CSSStyleSheet> parsedSheet = CSSStyleSheet::create(const_cast<Document*>(this), sheet->url()); parsedSheet->setIsUserStyleSheet(true); @@ -2160,7 +2157,7 @@ void Document::processHttpEquiv(const String& equiv, const String& content) url = frame->loader()->url().string(); else url = completeURL(url).string(); - frame->loader()->scheduleHTTPRedirection(delay, url); + frame->redirectScheduler()->scheduleRedirect(delay, url); } } else if (equalIgnoringCase(equiv, "set-cookie")) { // FIXME: make setCookie work on XML documents too; e.g. in case of <html:meta .....> @@ -2174,7 +2171,7 @@ void Document::processHttpEquiv(const String& equiv, const String& content) FrameLoader* frameLoader = frame->loader(); if (frameLoader->shouldInterruptLoadForXFrameOptions(content, url())) { frameLoader->stopAllLoaders(); - frameLoader->scheduleLocationChange(blankURL(), String()); + frame->redirectScheduler()->scheduleLocationChange(blankURL(), String()); } } } @@ -2357,8 +2354,8 @@ void Document::removePendingSheet() if (!m_pendingStylesheets && m_tokenizer) m_tokenizer->executeScriptsWaitingForStylesheets(); - if (!m_pendingStylesheets && m_gotoAnchorNeededAfterStylesheetsLoad && m_frame) - m_frame->loader()->gotoAnchor(); + if (!m_pendingStylesheets && m_gotoAnchorNeededAfterStylesheetsLoad && view()) + view()->scrollToFragment(m_frame->loader()->url()); } void Document::updateStyleSelector() @@ -2894,42 +2891,47 @@ void Document::dispatchWindowLoadEvent() PassRefPtr<Event> Document::createEvent(const String& eventType, ExceptionCode& ec) { + RefPtr<Event> event; if (eventType == "Event" || eventType == "Events" || eventType == "HTMLEvents") - return Event::create(); - if (eventType == "KeyboardEvent" || eventType == "KeyboardEvents") - return KeyboardEvent::create(); - if (eventType == "MessageEvent") - return MessageEvent::create(); - if (eventType == "MouseEvent" || eventType == "MouseEvents") - return MouseEvent::create(); - if (eventType == "MutationEvent" || eventType == "MutationEvents") - return MutationEvent::create(); - if (eventType == "OverflowEvent") - return OverflowEvent::create(); - if (eventType == "PageTransitionEvent") - return PageTransitionEvent::create(); - if (eventType == "ProgressEvent") - return ProgressEvent::create(); + event = Event::create(); + else if (eventType == "KeyboardEvent" || eventType == "KeyboardEvents") + event = KeyboardEvent::create(); + else if (eventType == "MessageEvent") + event = MessageEvent::create(); + else if (eventType == "MouseEvent" || eventType == "MouseEvents") + event = MouseEvent::create(); + else if (eventType == "MutationEvent" || eventType == "MutationEvents") + event = MutationEvent::create(); + else if (eventType == "OverflowEvent") + event = OverflowEvent::create(); + else if (eventType == "PageTransitionEvent") + event = PageTransitionEvent::create(); + else if (eventType == "ProgressEvent") + event = ProgressEvent::create(); #if ENABLE(DOM_STORAGE) - if (eventType == "StorageEvent") - return StorageEvent::create(); + else if (eventType == "StorageEvent") + event = StorageEvent::create(); #endif - if (eventType == "TextEvent") - return TextEvent::create(); - if (eventType == "UIEvent" || eventType == "UIEvents") - return UIEvent::create(); - if (eventType == "WebKitAnimationEvent") - return WebKitAnimationEvent::create(); - if (eventType == "WebKitTransitionEvent") - return WebKitTransitionEvent::create(); - if (eventType == "WheelEvent") - return WheelEvent::create(); + else if (eventType == "TextEvent") + event = TextEvent::create(); + else if (eventType == "UIEvent" || eventType == "UIEvents") + event = UIEvent::create(); + else if (eventType == "WebKitAnimationEvent") + event = WebKitAnimationEvent::create(); + else if (eventType == "WebKitTransitionEvent") + event = WebKitTransitionEvent::create(); + else if (eventType == "WheelEvent") + event = WheelEvent::create(); #if ENABLE(SVG) - if (eventType == "SVGEvents") - return Event::create(); - if (eventType == "SVGZoomEvents") - return SVGZoomEvent::create(); + else if (eventType == "SVGEvents") + event = Event::create(); + else if (eventType == "SVGZoomEvents") + event = SVGZoomEvent::create(); #endif + if (event) { + event->setCreatedByDOM(true); + return event.release(); + } ec = NOT_SUPPORTED_ERR; return 0; } @@ -2960,6 +2962,8 @@ void Document::addListenerTypeIfNeeded(const AtomicString& eventType) addListenerType(ANIMATIONITERATION_LISTENER); else if (eventType == eventNames().webkitTransitionEndEvent) addListenerType(TRANSITIONEND_LISTENER); + else if (eventType == eventNames().beforeloadEvent) + addListenerType(BEFORELOAD_LISTENER); } CSSStyleDeclaration* Document::getOverrideStyle(Element*, const String&) @@ -4016,8 +4020,17 @@ void Document::finishedParsing() { setParsing(false); dispatchEvent(Event::create(eventNames().DOMContentLoadedEvent, true, false)); - if (Frame* f = frame()) + if (Frame* f = frame()) { f->loader()->finishedParsing(); + +#if ENABLE(INSPECTOR) + if (!page()) + return; + + if (InspectorController* controller = page()->inspectorController()) + controller->mainResourceFiredDOMContentEvent(f->loader()->documentLoader(), url()); +#endif + } } Vector<String> Document::formElementsState() const @@ -4230,7 +4243,7 @@ void Document::initSecurityContext() m_cookieURL = url; ScriptExecutionContext::setSecurityOrigin(SecurityOrigin::create(url)); - if (FrameLoader::allowSubstituteDataAccessToLocal()) { + if (SecurityOrigin::allowSubstituteDataAccessToLocal()) { // If this document was loaded with substituteData, then the document can // load local resources. See https://bugs.webkit.org/show_bug.cgi?id=16756 // and https://bugs.webkit.org/show_bug.cgi?id=19760 for further @@ -4494,7 +4507,7 @@ void Document::resourceRetrievedByXMLHttpRequest(unsigned long identifier, const Frame* frame = this->frame(); if (frame) { FrameLoader* frameLoader = frame->loader(); - frameLoader->didLoadResourceByXMLHttpRequest(identifier, sourceString); + frameLoader->notifier()->didLoadResourceByXMLHttpRequest(identifier, sourceString); } } diff --git a/src/3rdparty/webkit/WebCore/dom/Document.h b/src/3rdparty/webkit/WebCore/dom/Document.h index f05c9f9..09bba58 100644 --- a/src/3rdparty/webkit/WebCore/dom/Document.h +++ b/src/3rdparty/webkit/WebCore/dom/Document.h @@ -473,7 +473,6 @@ public: void write(const String& text, Document* ownerDocument = 0); void writeln(const String& text, Document* ownerDocument = 0); void finishParsing(); - void clear(); bool wellFormed() const { return m_wellFormed; } @@ -615,7 +614,8 @@ public: ANIMATIONEND_LISTENER = 0x100, ANIMATIONSTART_LISTENER = 0x200, ANIMATIONITERATION_LISTENER = 0x400, - TRANSITIONEND_LISTENER = 0x800 + TRANSITIONEND_LISTENER = 0x800, + BEFORELOAD_LISTENER = 0x1000 }; bool hasListenerType(ListenerType listenerType) const { return (m_listenerTypes & listenerType); } diff --git a/src/3rdparty/webkit/WebCore/dom/Document.idl b/src/3rdparty/webkit/WebCore/dom/Document.idl index 822f860..e9b5480 100644 --- a/src/3rdparty/webkit/WebCore/dom/Document.idl +++ b/src/3rdparty/webkit/WebCore/dom/Document.idl @@ -172,6 +172,9 @@ module core { attribute HTMLElement body setter raises (DOMException); +#if !defined(LANGUAGE_COM) || !LANGUAGE_COM + readonly attribute HTMLHeadElement head; +#endif readonly attribute HTMLCollection images; readonly attribute HTMLCollection applets; readonly attribute HTMLCollection links; diff --git a/src/3rdparty/webkit/WebCore/dom/Element.cpp b/src/3rdparty/webkit/WebCore/dom/Element.cpp index 50ff033..621c63a 100644 --- a/src/3rdparty/webkit/WebCore/dom/Element.cpp +++ b/src/3rdparty/webkit/WebCore/dom/Element.cpp @@ -123,6 +123,7 @@ PassRefPtr<Element> Element::cloneElementWithoutChildren() void Element::removeAttribute(const QualifiedName& name, ExceptionCode& ec) { if (namedAttrMap) { + ec = 0; namedAttrMap->removeNamedItem(name, ec); if (ec == NOT_FOUND_ERR) ec = 0; @@ -515,7 +516,7 @@ void Element::setAttribute(const AtomicString& name, const AtomicString& value, return; } - const AtomicString& localName = (shouldIgnoreAttributeCase(this) && !name.string().impl()->isLower()) ? AtomicString(name.string().lower()) : name; + const AtomicString& localName = shouldIgnoreAttributeCase(this) ? name.lower() : name; // allocate attributemap if necessary Attribute* old = attributes(false)->getAttributeItem(localName, false); diff --git a/src/3rdparty/webkit/WebCore/dom/Event.cpp b/src/3rdparty/webkit/WebCore/dom/Event.cpp index 4088e2c..ba310ef 100644 --- a/src/3rdparty/webkit/WebCore/dom/Event.cpp +++ b/src/3rdparty/webkit/WebCore/dom/Event.cpp @@ -35,6 +35,7 @@ Event::Event() , m_defaultPrevented(false) , m_defaultHandled(false) , m_cancelBubble(false) + , m_createdByDOM(false) , m_eventPhase(0) , m_currentTarget(0) , m_createTime(static_cast<DOMTimeStamp>(currentTime() * 1000.0)) @@ -49,6 +50,7 @@ Event::Event(const AtomicString& eventType, bool canBubbleArg, bool cancelableAr , m_defaultPrevented(false) , m_defaultHandled(false) , m_cancelBubble(false) + , m_createdByDOM(false) , m_eventPhase(0) , m_currentTarget(0) , m_createTime(static_cast<DOMTimeStamp>(currentTime() * 1000.0)) @@ -149,6 +151,11 @@ bool Event::isXMLHttpRequestProgressEvent() const return false; } +bool Event::isBeforeLoadEvent() const +{ + return false; +} + #if ENABLE(SVG) bool Event::isSVGZoomEvent() const { diff --git a/src/3rdparty/webkit/WebCore/dom/Event.h b/src/3rdparty/webkit/WebCore/dom/Event.h index 7d06378..74a2f10 100644 --- a/src/3rdparty/webkit/WebCore/dom/Event.h +++ b/src/3rdparty/webkit/WebCore/dom/Event.h @@ -114,6 +114,7 @@ namespace WebCore { virtual bool isXMLHttpRequestProgressEvent() const; virtual bool isWebKitAnimationEvent() const; virtual bool isWebKitTransitionEvent() const; + virtual bool isBeforeLoadEvent() const; #if ENABLE(SVG) virtual bool isSVGZoomEvent() const; #endif @@ -144,6 +145,9 @@ namespace WebCore { virtual Clipboard* clipboard() const { return 0; } + bool createdByDOM() const { return m_createdByDOM; } + void setCreatedByDOM(bool createdByDOM) { m_createdByDOM = createdByDOM; } + protected: Event(); Event(const AtomicString& type, bool canBubble, bool cancelable); @@ -161,6 +165,9 @@ namespace WebCore { bool m_defaultHandled; bool m_cancelBubble; + // Whether this event was created by document.createEvent(). + bool m_createdByDOM; + unsigned short m_eventPhase; EventTarget* m_currentTarget; RefPtr<EventTarget> m_target; diff --git a/src/3rdparty/webkit/WebCore/dom/EventNames.h b/src/3rdparty/webkit/WebCore/dom/EventNames.h index 0eb98ec..2c4cd32 100644 --- a/src/3rdparty/webkit/WebCore/dom/EventNames.h +++ b/src/3rdparty/webkit/WebCore/dom/EventNames.h @@ -32,6 +32,7 @@ namespace WebCore { macro(abort) \ macro(beforecopy) \ macro(beforecut) \ + macro(beforeload) \ macro(beforepaste) \ macro(beforeunload) \ macro(blur) \ @@ -63,7 +64,6 @@ namespace WebCore { macro(keypress) \ macro(keyup) \ macro(load) \ - macro(loadend) \ macro(loadstart) \ macro(message) \ macro(mousedown) \ diff --git a/src/3rdparty/webkit/WebCore/dom/ExceptionBase.cpp b/src/3rdparty/webkit/WebCore/dom/ExceptionBase.cpp index c73d514..d175d8b 100644 --- a/src/3rdparty/webkit/WebCore/dom/ExceptionBase.cpp +++ b/src/3rdparty/webkit/WebCore/dom/ExceptionBase.cpp @@ -34,6 +34,7 @@ namespace WebCore { ExceptionBase::ExceptionBase(const ExceptionCodeDescription& description) : m_code(description.code) , m_name(description.name) + , m_description(description.description) { if (description.name) m_message = String::format("%s: %s Exception %d", description.name, description.typeName, description.code); diff --git a/src/3rdparty/webkit/WebCore/dom/ExceptionBase.h b/src/3rdparty/webkit/WebCore/dom/ExceptionBase.h index 44fad7e..81e2d7f 100644 --- a/src/3rdparty/webkit/WebCore/dom/ExceptionBase.h +++ b/src/3rdparty/webkit/WebCore/dom/ExceptionBase.h @@ -40,6 +40,7 @@ namespace WebCore { unsigned short code() const { return m_code; } String name() const { return m_name; } String message() const { return m_message; } + String description() const { return m_description; } String toString() const; @@ -50,6 +51,7 @@ namespace WebCore { unsigned short m_code; String m_name; String m_message; + String m_description; }; } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/dom/ExceptionCode.cpp b/src/3rdparty/webkit/WebCore/dom/ExceptionCode.cpp index 0291a21..7bb8a50 100644 --- a/src/3rdparty/webkit/WebCore/dom/ExceptionCode.cpp +++ b/src/3rdparty/webkit/WebCore/dom/ExceptionCode.cpp @@ -65,25 +65,70 @@ static const char* const exceptionNames[] = { "QUOTA_EXCEEDED_ERR" }; +static const char* const exceptionDescriptions[] = { + "Index or size was negative, or greater than the allowed value.", + "The specified range of text did not fit into a DOMString.", + "A Node was inserted somewhere it doesn't belong.", + "A Node was used in a different document than the one that created it (that doesn't support it).", + "An invalid or illegal character was specified, such as in an XML name.", + "Data was specified for a Node which does not support data.", + "An attempt was made to modify an object where modifications are not allowed.", + "An attempt was made to reference a Node in a context where it does not exist.", + "The implementation did not support the requested type of object or operation.", + "An attempt was made to add an attribute that is already in use elsewhere.", + "An attempt was made to use an object that is not, or is no longer, usable.", + "An invalid or illegal string was specified.", + "An attempt was made to modify the type of the underlying object.", + "An attempt was made to create or change an object in a way which is incorrect with regard to namespaces.", + "A parameter or an operation was not supported by the underlying object.", + "A call to a method such as insertBefore or removeChild would make the Node invalid with respect to \"partial validity\", this exception would be raised and the operation would not be done.", + "The type of an object was incompatible with the expected type of the parameter associated to the object.", + "An attempt was made to break through the security policy of the user agent.", + // FIXME: Couldn't find a description in the HTML/DOM specifications for NETWORK_ERR, ABORT_ERR, URL_MISMATCH_ERR, and QUOTA_EXCEEDED_ERR + "A network error occured.", + "The user aborted a request.", + "A worker global scope represented an absolute URL that is not equal to the resulting absolute URL.", + "An attempt was made to add something to storage that exceeded the quota." +}; + static const char* const rangeExceptionNames[] = { "BAD_BOUNDARYPOINTS_ERR", "INVALID_NODE_TYPE_ERR" }; +static const char* const rangeExceptionDescriptions[] = { + "The boundary-points of a Range did not meet specific requirements.", + "The container of an boundary-point of a Range was being set to either a node of an invalid type or a node with an ancestor of an invalid type." +}; + static const char* const eventExceptionNames[] = { "UNSPECIFIED_EVENT_TYPE_ERR" }; +static const char* const eventExceptionDescriptions[] = { + "The Event's type was not specified by initializing the event before the method was called." +}; + static const char* const xmlHttpRequestExceptionNames[] = { "NETWORK_ERR", "ABORT_ERR" }; +static const char* const xmlHttpRequestExceptionDescriptions[] = { + "A network error occured in synchronous requests.", + "The user aborted a request in synchronous requests." +}; + #if ENABLE(XPATH) static const char* const xpathExceptionNames[] = { "INVALID_EXPRESSION_ERR", "TYPE_ERR" }; + +static const char* const xpathExceptionDescriptions[] = { + "The expression had a syntax error or otherwise is not a legal expression according to the rules of the specific XPathEvaluator.", + "The expression could not be converted to return the specified type." +}; #endif #if ENABLE(SVG) @@ -92,6 +137,12 @@ static const char* const svgExceptionNames[] = { "SVG_INVALID_VALUE_ERR", "SVG_MATRIX_NOT_INVERTABLE" }; + +static const char* const svgExceptionDescriptions[] = { + "An object of the wrong type was passed to an operation.", + "An invalid value was passed to an operation or assigned to an attribute.", + "An attempt was made to invert a matrix that is not invertible." +}; #endif void getExceptionCodeDescription(ExceptionCode ec, ExceptionCodeDescription& description) @@ -101,6 +152,7 @@ void getExceptionCodeDescription(ExceptionCode ec, ExceptionCodeDescription& des const char* typeName; int code = ec; const char* const* nameTable; + const char* const* descriptionTable; int nameTableSize; int nameTableOffset; ExceptionType type; @@ -110,6 +162,7 @@ void getExceptionCodeDescription(ExceptionCode ec, ExceptionCodeDescription& des typeName = "DOM Range"; code -= RangeException::RangeExceptionOffset; nameTable = rangeExceptionNames; + descriptionTable = rangeExceptionDescriptions; nameTableSize = sizeof(rangeExceptionNames) / sizeof(rangeExceptionNames[0]); nameTableOffset = RangeException::BAD_BOUNDARYPOINTS_ERR; } else if (code >= EventException::EventExceptionOffset && code <= EventException::EventExceptionMax) { @@ -117,6 +170,7 @@ void getExceptionCodeDescription(ExceptionCode ec, ExceptionCodeDescription& des typeName = "DOM Events"; code -= EventException::EventExceptionOffset; nameTable = eventExceptionNames; + descriptionTable = eventExceptionDescriptions; nameTableSize = sizeof(eventExceptionNames) / sizeof(eventExceptionNames[0]); nameTableOffset = EventException::UNSPECIFIED_EVENT_TYPE_ERR; } else if (code >= XMLHttpRequestException::XMLHttpRequestExceptionOffset && code <= XMLHttpRequestException::XMLHttpRequestExceptionMax) { @@ -124,6 +178,7 @@ void getExceptionCodeDescription(ExceptionCode ec, ExceptionCodeDescription& des typeName = "XMLHttpRequest"; code -= XMLHttpRequestException::XMLHttpRequestExceptionOffset; nameTable = xmlHttpRequestExceptionNames; + descriptionTable = xmlHttpRequestExceptionDescriptions; nameTableSize = sizeof(xmlHttpRequestExceptionNames) / sizeof(xmlHttpRequestExceptionNames[0]); // XMLHttpRequest exception codes start with 101 and we don't want 100 empty elements in the name array nameTableOffset = XMLHttpRequestException::NETWORK_ERR; @@ -133,6 +188,7 @@ void getExceptionCodeDescription(ExceptionCode ec, ExceptionCodeDescription& des typeName = "DOM XPath"; code -= XPathException::XPathExceptionOffset; nameTable = xpathExceptionNames; + descriptionTable = xpathExceptionDescriptions; nameTableSize = sizeof(xpathExceptionNames) / sizeof(xpathExceptionNames[0]); // XPath exception codes start with 51 and we don't want 51 empty elements in the name array nameTableOffset = XPathException::INVALID_EXPRESSION_ERR; @@ -143,6 +199,7 @@ void getExceptionCodeDescription(ExceptionCode ec, ExceptionCodeDescription& des typeName = "DOM SVG"; code -= SVGException::SVGExceptionOffset; nameTable = svgExceptionNames; + descriptionTable = svgExceptionDescriptions; nameTableSize = sizeof(svgExceptionNames) / sizeof(svgExceptionNames[0]); nameTableOffset = SVGException::SVG_WRONG_TYPE_ERR; #endif @@ -150,17 +207,20 @@ void getExceptionCodeDescription(ExceptionCode ec, ExceptionCodeDescription& des type = DOMExceptionType; typeName = "DOM"; nameTable = exceptionNames; + descriptionTable = exceptionDescriptions; nameTableSize = sizeof(exceptionNames) / sizeof(exceptionNames[0]); nameTableOffset = INDEX_SIZE_ERR; } description.typeName = typeName; description.name = (ec >= nameTableOffset && ec - nameTableOffset < nameTableSize) ? nameTable[ec - nameTableOffset] : 0; + description.description = (ec >= nameTableOffset && ec - nameTableOffset < nameTableSize) ? descriptionTable[ec - nameTableOffset] : 0; description.code = code; description.type = type; // All exceptions used in the DOM code should have names. ASSERT(description.name); + ASSERT(description.description); } } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/dom/ExceptionCode.h b/src/3rdparty/webkit/WebCore/dom/ExceptionCode.h index 58b18e2..573fb36 100644 --- a/src/3rdparty/webkit/WebCore/dom/ExceptionCode.h +++ b/src/3rdparty/webkit/WebCore/dom/ExceptionCode.h @@ -77,6 +77,7 @@ namespace WebCore { struct ExceptionCodeDescription { const char* typeName; // has spaces and is suitable for use in exception description strings; maximum length is 10 characters const char* name; // exception name, also intended for use in exception description strings; 0 if name not known; maximum length is 27 characters + const char* description; // exception description, intended for use in exception strings; more readable explanation of error int code; // numeric value of the exception within a particular type ExceptionType type; }; diff --git a/src/3rdparty/webkit/WebCore/dom/MessageEvent.cpp b/src/3rdparty/webkit/WebCore/dom/MessageEvent.cpp index 2ef8bc2..3c84642 100644 --- a/src/3rdparty/webkit/WebCore/dom/MessageEvent.cpp +++ b/src/3rdparty/webkit/WebCore/dom/MessageEvent.cpp @@ -34,10 +34,11 @@ namespace WebCore { MessageEvent::MessageEvent() + : m_data(SerializedScriptValue::create()) { } -MessageEvent::MessageEvent(const String& data, const String& origin, const String& lastEventId, PassRefPtr<DOMWindow> source, PassOwnPtr<MessagePortArray> ports) +MessageEvent::MessageEvent(PassRefPtr<SerializedScriptValue> data, const String& origin, const String& lastEventId, PassRefPtr<DOMWindow> source, PassOwnPtr<MessagePortArray> ports) : Event(eventNames().messageEvent, false, false) , m_data(data) , m_origin(origin) @@ -51,7 +52,7 @@ MessageEvent::~MessageEvent() { } -void MessageEvent::initMessageEvent(const AtomicString& type, bool canBubble, bool cancelable, const String& data, const String& origin, const String& lastEventId, DOMWindow* source, PassOwnPtr<MessagePortArray> ports) +void MessageEvent::initMessageEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<SerializedScriptValue> data, const String& origin, const String& lastEventId, DOMWindow* source, PassOwnPtr<MessagePortArray> ports) { if (dispatched()) return; @@ -74,7 +75,7 @@ MessagePort* MessageEvent::messagePort() return (*m_ports)[0].get(); } -void MessageEvent::initMessageEvent(const AtomicString& type, bool canBubble, bool cancelable, const String& data, const String& origin, const String& lastEventId, DOMWindow* source, MessagePort* port) +void MessageEvent::initMessageEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<SerializedScriptValue> data, const String& origin, const String& lastEventId, DOMWindow* source, MessagePort* port) { MessagePortArray* ports = 0; if (port) { diff --git a/src/3rdparty/webkit/WebCore/dom/MessageEvent.h b/src/3rdparty/webkit/WebCore/dom/MessageEvent.h index 555ed47..b7f9b02 100644 --- a/src/3rdparty/webkit/WebCore/dom/MessageEvent.h +++ b/src/3rdparty/webkit/WebCore/dom/MessageEvent.h @@ -31,6 +31,7 @@ #include "DOMWindow.h" #include "Event.h" #include "MessagePort.h" +#include "SerializedScriptValue.h" namespace WebCore { @@ -42,15 +43,15 @@ namespace WebCore { { return adoptRef(new MessageEvent); } - static PassRefPtr<MessageEvent> create(PassOwnPtr<MessagePortArray> ports, const String& data = "", const String& origin = "", const String& lastEventId = "", PassRefPtr<DOMWindow> source = 0) + static PassRefPtr<MessageEvent> create(PassOwnPtr<MessagePortArray> ports, PassRefPtr<SerializedScriptValue> data = 0, const String& origin = "", const String& lastEventId = "", PassRefPtr<DOMWindow> source = 0) { return adoptRef(new MessageEvent(data, origin, lastEventId, source, ports)); } virtual ~MessageEvent(); - void initMessageEvent(const AtomicString& type, bool canBubble, bool cancelable, const String& data, const String& origin, const String& lastEventId, DOMWindow* source, PassOwnPtr<MessagePortArray>); + void initMessageEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<SerializedScriptValue> data, const String& origin, const String& lastEventId, DOMWindow* source, PassOwnPtr<MessagePortArray>); - const String& data() const { return m_data; } + SerializedScriptValue* data() const { return m_data.get(); } const String& origin() const { return m_origin; } const String& lastEventId() const { return m_lastEventId; } DOMWindow* source() const { return m_source.get(); } @@ -59,15 +60,15 @@ namespace WebCore { // FIXME: remove this when we update the ObjC bindings (bug #28774). MessagePort* messagePort(); // FIXME: remove this when we update the ObjC bindings (bug #28774). - void initMessageEvent(const AtomicString& type, bool canBubble, bool cancelable, const String& data, const String& origin, const String& lastEventId, DOMWindow* source, MessagePort*); + void initMessageEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<SerializedScriptValue> data, const String& origin, const String& lastEventId, DOMWindow* source, MessagePort*); virtual bool isMessageEvent() const; private: MessageEvent(); - MessageEvent(const String& data, const String& origin, const String& lastEventId, PassRefPtr<DOMWindow> source, PassOwnPtr<MessagePortArray>); + MessageEvent(PassRefPtr<SerializedScriptValue> data, const String& origin, const String& lastEventId, PassRefPtr<DOMWindow> source, PassOwnPtr<MessagePortArray>); - String m_data; + RefPtr<SerializedScriptValue> m_data; String m_origin; String m_lastEventId; RefPtr<DOMWindow> m_source; diff --git a/src/3rdparty/webkit/WebCore/dom/MessageEvent.idl b/src/3rdparty/webkit/WebCore/dom/MessageEvent.idl index a32cc93..7e497fc 100644 --- a/src/3rdparty/webkit/WebCore/dom/MessageEvent.idl +++ b/src/3rdparty/webkit/WebCore/dom/MessageEvent.idl @@ -30,20 +30,20 @@ module events { GenerateConstructor, NoStaticTables ] MessageEvent : Event { + readonly attribute SerializedScriptValue data; - readonly attribute DOMString data; readonly attribute DOMString origin; readonly attribute DOMString lastEventId; readonly attribute DOMWindow source; #if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT readonly attribute [CustomGetter] Array ports; - [Custom] void initMessageEvent(in DOMString typeArg, in boolean canBubbleArg, in boolean cancelableArg, in DOMString dataArg, in DOMString originArg, in DOMString lastEventIdArg, in DOMWindow sourceArg, in Array messagePorts); + [Custom] void initMessageEvent(in DOMString typeArg, in boolean canBubbleArg, in boolean cancelableArg, in SerializedScriptValue dataArg, in DOMString originArg, in DOMString lastEventIdArg, in DOMWindow sourceArg, in Array messagePorts); #else // There's no good way to expose an array via the ObjC bindings, so for now just expose a single port. readonly attribute MessagePort messagePort; - void initMessageEvent(in DOMString typeArg, in boolean canBubbleArg, in boolean cancelableArg, in DOMString dataArg, in DOMString originArg, in DOMString lastEventIdArg, in DOMWindow sourceArg, in MessagePort messagePort); + void initMessageEvent(in DOMString typeArg, in boolean canBubbleArg, in boolean cancelableArg, in SerializedScriptValue dataArg, in DOMString originArg, in DOMString lastEventIdArg, in DOMWindow sourceArg, in MessagePort messagePort); #endif }; diff --git a/src/3rdparty/webkit/WebCore/dom/MessagePort.cpp b/src/3rdparty/webkit/WebCore/dom/MessagePort.cpp index 50a0106..9f6e649 100644 --- a/src/3rdparty/webkit/WebCore/dom/MessagePort.cpp +++ b/src/3rdparty/webkit/WebCore/dom/MessagePort.cpp @@ -56,7 +56,7 @@ MessagePort::~MessagePort() } // FIXME: remove this when we update the ObjC bindings (bug #28774). -void MessagePort::postMessage(const String& message, MessagePort* port, ExceptionCode& ec) +void MessagePort::postMessage(PassRefPtr<SerializedScriptValue> message, MessagePort* port, ExceptionCode& ec) { MessagePortArray ports; if (port) @@ -64,12 +64,12 @@ void MessagePort::postMessage(const String& message, MessagePort* port, Exceptio postMessage(message, &ports, ec); } -void MessagePort::postMessage(const String& message, ExceptionCode& ec) +void MessagePort::postMessage(PassRefPtr<SerializedScriptValue> message, ExceptionCode& ec) { postMessage(message, static_cast<MessagePortArray*>(0), ec); } -void MessagePort::postMessage(const String& message, const MessagePortArray* ports, ExceptionCode& ec) +void MessagePort::postMessage(PassRefPtr<SerializedScriptValue> message, const MessagePortArray* ports, ExceptionCode& ec) { if (!m_entangledChannel) return; diff --git a/src/3rdparty/webkit/WebCore/dom/MessagePort.h b/src/3rdparty/webkit/WebCore/dom/MessagePort.h index e649d5d..0ab0f50 100644 --- a/src/3rdparty/webkit/WebCore/dom/MessagePort.h +++ b/src/3rdparty/webkit/WebCore/dom/MessagePort.h @@ -56,10 +56,10 @@ namespace WebCore { static PassRefPtr<MessagePort> create(ScriptExecutionContext& scriptExecutionContext) { return adoptRef(new MessagePort(scriptExecutionContext)); } ~MessagePort(); - void postMessage(const String& message, ExceptionCode&); - void postMessage(const String& message, const MessagePortArray*, ExceptionCode&); + void postMessage(PassRefPtr<SerializedScriptValue> message, ExceptionCode&); + void postMessage(PassRefPtr<SerializedScriptValue> message, const MessagePortArray*, ExceptionCode&); // FIXME: remove this when we update the ObjC bindings (bug #28774). - void postMessage(const String& message, MessagePort*, ExceptionCode&); + void postMessage(PassRefPtr<SerializedScriptValue> message, MessagePort*, ExceptionCode&); void start(); void close(); diff --git a/src/3rdparty/webkit/WebCore/dom/MessagePortChannel.cpp b/src/3rdparty/webkit/WebCore/dom/MessagePortChannel.cpp index 34b2ce7..e1a3ac6 100644 --- a/src/3rdparty/webkit/WebCore/dom/MessagePortChannel.cpp +++ b/src/3rdparty/webkit/WebCore/dom/MessagePortChannel.cpp @@ -33,13 +33,13 @@ namespace WebCore { -PassOwnPtr<MessagePortChannel::EventData> MessagePortChannel::EventData::create(const String& message, PassOwnPtr<MessagePortChannelArray> channels) +PassOwnPtr<MessagePortChannel::EventData> MessagePortChannel::EventData::create(PassRefPtr<SerializedScriptValue> message, PassOwnPtr<MessagePortChannelArray> channels) { return new EventData(message, channels); } -MessagePortChannel::EventData::EventData(const String& message, PassOwnPtr<MessagePortChannelArray> channels) - : m_message(message.copy()) +MessagePortChannel::EventData::EventData(PassRefPtr<SerializedScriptValue> message, PassOwnPtr<MessagePortChannelArray> channels) + : m_message(message->release()) , m_channels(channels) { } diff --git a/src/3rdparty/webkit/WebCore/dom/MessagePortChannel.h b/src/3rdparty/webkit/WebCore/dom/MessagePortChannel.h index 4acfe7f..2321b1f 100644 --- a/src/3rdparty/webkit/WebCore/dom/MessagePortChannel.h +++ b/src/3rdparty/webkit/WebCore/dom/MessagePortChannel.h @@ -33,6 +33,8 @@ #include "PlatformString.h" +#include "SerializedScriptValue.h" + #include <wtf/OwnPtr.h> #include <wtf/PassOwnPtr.h> #include <wtf/PassRefPtr.h> @@ -45,6 +47,7 @@ namespace WebCore { class MessagePortChannel; class PlatformMessagePortChannel; class ScriptExecutionContext; + class SerializedScriptValue; class String; // The overwhelmingly common case is sending a single port, so handle that efficiently with an inline buffer of size 1. @@ -77,14 +80,14 @@ namespace WebCore { class EventData { public: - static PassOwnPtr<EventData> create(const String&, PassOwnPtr<MessagePortChannelArray>); + static PassOwnPtr<EventData> create(PassRefPtr<SerializedScriptValue>, PassOwnPtr<MessagePortChannelArray>); - const String& message() { return m_message; } + SerializedScriptValue* message() { return m_message.get(); } PassOwnPtr<MessagePortChannelArray> channels() { return m_channels.release(); } private: - EventData(const String& message, PassOwnPtr<MessagePortChannelArray>); - String m_message; + EventData(PassRefPtr<SerializedScriptValue> message, PassOwnPtr<MessagePortChannelArray>); + RefPtr<SerializedScriptValue> m_message; OwnPtr<MessagePortChannelArray> m_channels; }; diff --git a/src/3rdparty/webkit/WebCore/dom/MouseRelatedEvent.cpp b/src/3rdparty/webkit/WebCore/dom/MouseRelatedEvent.cpp index 4ed85ce..87815b1 100644 --- a/src/3rdparty/webkit/WebCore/dom/MouseRelatedEvent.cpp +++ b/src/3rdparty/webkit/WebCore/dom/MouseRelatedEvent.cpp @@ -57,7 +57,7 @@ static int contentsX(AbstractView* abstractView) FrameView* frameView = frame->view(); if (!frameView) return 0; - return frameView->scrollX(); + return frameView->scrollX() / frame->pageZoomFactor(); } static int contentsY(AbstractView* abstractView) @@ -70,7 +70,7 @@ static int contentsY(AbstractView* abstractView) FrameView* frameView = frame->view(); if (!frameView) return 0; - return frameView->scrollY(); + return frameView->scrollY() / frame->pageZoomFactor(); } MouseRelatedEvent::MouseRelatedEvent(const AtomicString& eventType, bool canBubble, bool cancelable, PassRefPtr<AbstractView> viewArg, diff --git a/src/3rdparty/webkit/WebCore/dom/ProcessingInstruction.cpp b/src/3rdparty/webkit/WebCore/dom/ProcessingInstruction.cpp index 8404481..72993dd 100644 --- a/src/3rdparty/webkit/WebCore/dom/ProcessingInstruction.cpp +++ b/src/3rdparty/webkit/WebCore/dom/ProcessingInstruction.cpp @@ -64,6 +64,7 @@ void ProcessingInstruction::setData(const String& data, ExceptionCode&) int oldLength = m_data.length(); m_data = data; document()->textRemoved(this, 0, oldLength); + checkStyleSheet(); } String ProcessingInstruction::nodeName() const @@ -142,13 +143,21 @@ void ProcessingInstruction::checkStyleSheet() } #endif } else { + if (m_cachedSheet) { + m_cachedSheet->removeClient(this); + m_cachedSheet = 0; + } + + String url = document()->completeURL(href).string(); + if (!dispatchBeforeLoadEvent(url)) + return; + m_loading = true; document()->addPendingSheet(); - if (m_cachedSheet) - m_cachedSheet->removeClient(this); + #if ENABLE(XSLT) if (m_isXSL) - m_cachedSheet = document()->docLoader()->requestXSLStyleSheet(document()->completeURL(href).string()); + m_cachedSheet = document()->docLoader()->requestXSLStyleSheet(url); else #endif { @@ -156,10 +165,15 @@ void ProcessingInstruction::checkStyleSheet() if (charset.isEmpty()) charset = document()->frame()->loader()->encoding(); - m_cachedSheet = document()->docLoader()->requestCSSStyleSheet(document()->completeURL(href).string(), charset); + m_cachedSheet = document()->docLoader()->requestCSSStyleSheet(url, charset); } if (m_cachedSheet) m_cachedSheet->addClient(this); + else { + // The request may have been denied if (for example) the stylesheet is local and the document is remote. + m_loading = false; + document()->removePendingSheet(); + } } } } diff --git a/src/3rdparty/webkit/WebCore/dom/QualifiedName.cpp b/src/3rdparty/webkit/WebCore/dom/QualifiedName.cpp index 607c846..2c5f39a 100644 --- a/src/3rdparty/webkit/WebCore/dom/QualifiedName.cpp +++ b/src/3rdparty/webkit/WebCore/dom/QualifiedName.cpp @@ -97,4 +97,11 @@ void QualifiedName::init() } } +const AtomicString& QualifiedName::localNameUpper() const +{ + if (!m_impl->m_localNameUpper) + m_impl->m_localNameUpper = m_impl->m_localName.upper(); + return m_impl->m_localNameUpper; +} + } diff --git a/src/3rdparty/webkit/WebCore/dom/QualifiedName.h b/src/3rdparty/webkit/WebCore/dom/QualifiedName.h index 939927b..3b9f5c4 100644 --- a/src/3rdparty/webkit/WebCore/dom/QualifiedName.h +++ b/src/3rdparty/webkit/WebCore/dom/QualifiedName.h @@ -41,9 +41,10 @@ public: return adoptRef(new QualifiedNameImpl(prefix, localName, namespaceURI)); } - AtomicString m_prefix; - AtomicString m_localName; - AtomicString m_namespace; + const AtomicString m_prefix; + const AtomicString m_localName; + const AtomicString m_namespace; + mutable AtomicString m_localNameUpper; private: QualifiedNameImpl(const AtomicString& prefix, const AtomicString& localName, const AtomicString& namespaceURI) @@ -76,6 +77,9 @@ public: const AtomicString& localName() const { return m_impl->m_localName; } const AtomicString& namespaceURI() const { return m_impl->m_namespace; } + // Uppercased localName, cached for efficiency + const AtomicString& localNameUpper() const; + String toString() const; QualifiedNameImpl* impl() const { return m_impl; } diff --git a/src/3rdparty/webkit/WebCore/dom/ScriptElement.cpp b/src/3rdparty/webkit/WebCore/dom/ScriptElement.cpp index fe38b46..827aff3 100644 --- a/src/3rdparty/webkit/WebCore/dom/ScriptElement.cpp +++ b/src/3rdparty/webkit/WebCore/dom/ScriptElement.cpp @@ -151,6 +151,9 @@ void ScriptElementData::requestScript(const String& sourceUrl) if (!document->frame()) return; + if (!m_element->dispatchBeforeLoadEvent(sourceUrl)) + return; + ASSERT(!m_cachedScript); m_cachedScript = document->docLoader()->requestScript(sourceUrl, scriptCharset()); m_requested = true; diff --git a/src/3rdparty/webkit/WebCore/dom/StyledElement.cpp b/src/3rdparty/webkit/WebCore/dom/StyledElement.cpp index 5212380..46ce137 100644 --- a/src/3rdparty/webkit/WebCore/dom/StyledElement.cpp +++ b/src/3rdparty/webkit/WebCore/dom/StyledElement.cpp @@ -240,8 +240,8 @@ void StyledElement::parseMappedAttribute(MappedAttribute *attr) if (namedAttrMap) { if (attr->isNull()) namedAttrMap->setID(nullAtom); - else if (document()->inCompatMode() && !attr->value().impl()->isLower()) - namedAttrMap->setID(AtomicString(attr->value().string().lower())); + else if (document()->inCompatMode()) + namedAttrMap->setID(attr->value().lower()); else namedAttrMap->setID(attr->value()); } diff --git a/src/3rdparty/webkit/WebCore/dom/XMLTokenizer.cpp b/src/3rdparty/webkit/WebCore/dom/XMLTokenizer.cpp index 4d06343..543927d 100644 --- a/src/3rdparty/webkit/WebCore/dom/XMLTokenizer.cpp +++ b/src/3rdparty/webkit/WebCore/dom/XMLTokenizer.cpp @@ -40,6 +40,7 @@ #include "HTMLLinkElement.h" #include "HTMLNames.h" #include "HTMLStyleElement.h" +#include "ImageLoader.h" #include "ProcessingInstruction.h" #include "ResourceError.h" #include "ResourceHandle.h" @@ -105,6 +106,9 @@ void XMLTokenizer::write(const SegmentedString& s, bool /*appendData*/) } doWrite(s.toString()); + + // After parsing, go ahead and dispatch image beforeload/load events. + ImageLoader::dispatchPendingEvents(); } void XMLTokenizer::handleError(ErrorType type, const char* m, int lineNumber, int columnNumber) @@ -296,7 +300,7 @@ void XMLTokenizer::notifyFinished(CachedResource* unusedResource) if (errorOccurred) scriptElement->dispatchErrorEvent(); else { - m_view->frame()->loader()->executeScript(sourceCode); + m_view->frame()->script()->executeScript(sourceCode); scriptElement->dispatchLoadEvent(); } diff --git a/src/3rdparty/webkit/WebCore/dom/XMLTokenizerLibxml2.cpp b/src/3rdparty/webkit/WebCore/dom/XMLTokenizerLibxml2.cpp index d3c6546..6cc0a0c 100644 --- a/src/3rdparty/webkit/WebCore/dom/XMLTokenizerLibxml2.cpp +++ b/src/3rdparty/webkit/WebCore/dom/XMLTokenizerLibxml2.cpp @@ -851,7 +851,8 @@ void XMLTokenizer::endElementNs() if (!scriptHref.isEmpty()) { // we have a src attribute String scriptCharset = scriptElement->scriptCharset(); - if ((m_pendingScript = m_doc->docLoader()->requestScript(scriptHref, scriptCharset))) { + if (element->dispatchBeforeLoadEvent(scriptHref) && + (m_pendingScript = m_doc->docLoader()->requestScript(scriptHref, scriptCharset))) { m_scriptElement = element; m_pendingScript->addClient(this); @@ -861,7 +862,7 @@ void XMLTokenizer::endElementNs() } else m_scriptElement = 0; } else - m_view->frame()->loader()->executeScript(ScriptSourceCode(scriptElement->scriptContent(), m_doc->url(), m_scriptStartLine)); + m_view->frame()->script()->executeScript(ScriptSourceCode(scriptElement->scriptContent(), m_doc->url(), m_scriptStartLine)); } m_requestingScript = false; setCurrentNode(parent.get()); @@ -886,7 +887,7 @@ void XMLTokenizer::error(ErrorType type, const char* message, va_list args) if (m_parserStopped) return; -#if PLATFORM(WIN_OS) +#if COMPILER(MSVC) char m[1024]; vsnprintf(m, sizeof(m) - 1, message, args); #else @@ -900,7 +901,7 @@ void XMLTokenizer::error(ErrorType type, const char* message, va_list args) else handleError(type, m, lineNumber(), columnNumber()); -#if !PLATFORM(WIN_OS) +#if !COMPILER(MSVC) free(m); #endif } diff --git a/src/3rdparty/webkit/WebCore/dom/XMLTokenizerQt.cpp b/src/3rdparty/webkit/WebCore/dom/XMLTokenizerQt.cpp index 04405d6..65cbc21 100644 --- a/src/3rdparty/webkit/WebCore/dom/XMLTokenizerQt.cpp +++ b/src/3rdparty/webkit/WebCore/dom/XMLTokenizerQt.cpp @@ -611,7 +611,8 @@ void XMLTokenizer::parseEndElement() if (!scriptHref.isEmpty()) { // we have a src attribute String scriptCharset = scriptElement->scriptCharset(); - if ((m_pendingScript = m_doc->docLoader()->requestScript(scriptHref, scriptCharset))) { + if (element->dispatchBeforeLoadEvent(scriptHref) && + (m_pendingScript = m_doc->docLoader()->requestScript(scriptHref, scriptCharset))) { m_scriptElement = element; m_pendingScript->addClient(this); @@ -621,7 +622,7 @@ void XMLTokenizer::parseEndElement() } else m_scriptElement = 0; } else - m_view->frame()->loader()->executeScript(ScriptSourceCode(scriptElement->scriptContent(), m_doc->url(), m_scriptStartLine)); + m_view->frame()->script()->executeScript(ScriptSourceCode(scriptElement->scriptContent(), m_doc->url(), m_scriptStartLine)); } m_requestingScript = false; setCurrentNode(parent.get()); |