summaryrefslogtreecommitdiffstats
path: root/WebCore/dom
diff options
context:
space:
mode:
Diffstat (limited to 'WebCore/dom')
-rw-r--r--WebCore/dom/ClientRect.cpp5
-rw-r--r--WebCore/dom/ClientRect.h2
-rw-r--r--WebCore/dom/Document.cpp70
-rw-r--r--WebCore/dom/Document.h8
-rw-r--r--WebCore/dom/Element.cpp9
-rw-r--r--WebCore/dom/Event.cpp7
-rw-r--r--WebCore/dom/Event.h3
-rw-r--r--WebCore/dom/EventContext.cpp7
-rw-r--r--WebCore/dom/EventContext.h1
-rw-r--r--WebCore/dom/ExceptionCode.cpp16
-rw-r--r--WebCore/dom/Node.cpp2
-rw-r--r--WebCore/dom/Node.h5
-rw-r--r--WebCore/dom/Position.cpp4
-rw-r--r--WebCore/dom/Position.h6
-rw-r--r--WebCore/dom/ProcessingInstruction.cpp2
-rw-r--r--WebCore/dom/ProcessingInstruction.idl2
-rw-r--r--WebCore/dom/ProgressEvent.cpp10
-rw-r--r--WebCore/dom/ProgressEvent.h59
-rw-r--r--WebCore/dom/ProgressEvent.idl15
-rw-r--r--WebCore/dom/Range.cpp4
-rw-r--r--WebCore/dom/ScriptElement.cpp36
-rw-r--r--WebCore/dom/ScriptElement.h17
-rw-r--r--WebCore/dom/SelectElement.cpp8
-rw-r--r--WebCore/dom/ViewportArguments.cpp20
-rw-r--r--WebCore/dom/XMLDocumentParser.cpp8
25 files changed, 209 insertions, 117 deletions
diff --git a/WebCore/dom/ClientRect.cpp b/WebCore/dom/ClientRect.cpp
index c69a2ab..b132222 100644
--- a/WebCore/dom/ClientRect.cpp
+++ b/WebCore/dom/ClientRect.cpp
@@ -38,4 +38,9 @@ ClientRect::ClientRect(const IntRect& rect)
{
}
+ClientRect::ClientRect(const FloatRect& rect)
+ : m_rect(rect)
+{
+}
+
} // namespace WebCore
diff --git a/WebCore/dom/ClientRect.h b/WebCore/dom/ClientRect.h
index 349ea85..f9acef0 100644
--- a/WebCore/dom/ClientRect.h
+++ b/WebCore/dom/ClientRect.h
@@ -39,6 +39,7 @@ namespace WebCore {
public:
static PassRefPtr<ClientRect> create() { return adoptRef(new ClientRect); }
static PassRefPtr<ClientRect> create(const IntRect& rect) { return adoptRef(new ClientRect(rect)); }
+ static PassRefPtr<ClientRect> create(const FloatRect& rect) { return adoptRef(new ClientRect(rect)); }
float top() const { return m_rect.y(); }
float right() const { return m_rect.right(); }
@@ -50,6 +51,7 @@ namespace WebCore {
private:
ClientRect();
ClientRect(const IntRect&);
+ ClientRect(const FloatRect&);
FloatRect m_rect;
};
diff --git a/WebCore/dom/Document.cpp b/WebCore/dom/Document.cpp
index e0f3944..df37ebc 100644
--- a/WebCore/dom/Document.cpp
+++ b/WebCore/dom/Document.cpp
@@ -6,6 +6,7 @@
* Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
* Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
* Copyright (C) 2008, 2009 Google Inc. All rights reserved.
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -92,6 +93,8 @@
#include "InspectorInstrumentation.h"
#include "KeyboardEvent.h"
#include "Logging.h"
+#include "MediaQueryList.h"
+#include "MediaQueryMatcher.h"
#include "MessageEvent.h"
#include "MouseEvent.h"
#include "MouseEventWithHitTestResults.h"
@@ -586,9 +589,8 @@ Document::~Document()
clearAXObjectCache();
m_decoder = 0;
-
- unsigned count = sizeof(m_nameCollectionInfo) / sizeof(m_nameCollectionInfo[0]);
- for (unsigned i = 0; i < count; i++)
+
+ for (size_t i = 0; i < m_nameCollectionInfo.size(); ++i)
deleteAllValues(m_nameCollectionInfo[i]);
if (m_styleSheets)
@@ -606,6 +608,16 @@ Document::~Document()
}
m_weakReference->clear();
+
+ if (m_mediaQueryMatcher)
+ m_mediaQueryMatcher->documentDestroyed();
+}
+
+MediaQueryMatcher* Document::mediaQueryMatcher()
+{
+ if (!m_mediaQueryMatcher)
+ m_mediaQueryMatcher = MediaQueryMatcher::create(this);
+ return m_mediaQueryMatcher.get();
}
#if USE(JSC)
@@ -1712,7 +1724,7 @@ PassRefPtr<RenderStyle> Document::styleForElementIgnoringPendingStylesheets(Elem
bool oldIgnore = m_ignorePendingStylesheets;
m_ignorePendingStylesheets = true;
- RefPtr<RenderStyle> style = styleSelector()->styleForElement(element, element->parent() ? element->parent()->computedStyle() : 0);
+ RefPtr<RenderStyle> style = styleSelector()->styleForElement(element, element->parentNode() ? element->parentNode()->computedStyle() : 0);
m_ignorePendingStylesheets = oldIgnore;
return style.release();
}
@@ -1881,8 +1893,11 @@ void Document::clearAXObjectCache()
#else
// clear cache in top document
if (m_axObjectCache) {
- delete m_axObjectCache;
+ // Clear the cache member variable before calling delete because attempts
+ // are made to access it during destruction.
+ AXObjectCache* axObjectCache = m_axObjectCache;
m_axObjectCache = 0;
+ delete axObjectCache;
return;
}
@@ -2968,6 +2983,9 @@ void Document::styleSelectorChanged(StyleSelectorUpdateFlag updateFlag)
if (view())
view()->scheduleRelayout();
}
+
+ if (m_mediaQueryMatcher)
+ m_mediaQueryMatcher->styleSelectorChanged();
}
void Document::addStyleSheetCandidateNode(Node* node, bool createdByParser)
@@ -3143,24 +3161,24 @@ void Document::removeFocusedNodeOfSubtree(Node* node, bool amongChildrenOnly)
void Document::hoveredNodeDetached(Node* node)
{
- if (!m_hoverNode || (node != m_hoverNode && (!m_hoverNode->isTextNode() || node != m_hoverNode->parent())))
+ if (!m_hoverNode || (node != m_hoverNode && (!m_hoverNode->isTextNode() || node != m_hoverNode->parentNode())))
return;
- m_hoverNode = node->parent();
+ m_hoverNode = node->parentNode();
while (m_hoverNode && !m_hoverNode->renderer())
- m_hoverNode = m_hoverNode->parent();
+ m_hoverNode = m_hoverNode->parentNode();
if (frame())
frame()->eventHandler()->scheduleHoverStateUpdate();
}
void Document::activeChainNodeDetached(Node* node)
{
- if (!m_activeNode || (node != m_activeNode && (!m_activeNode->isTextNode() || node != m_activeNode->parent())))
+ if (!m_activeNode || (node != m_activeNode && (!m_activeNode->isTextNode() || node != m_activeNode->parentNode())))
return;
- m_activeNode = node->parent();
+ m_activeNode = node->parentNode();
while (m_activeNode && !m_activeNode->renderer())
- m_activeNode = m_activeNode->parent();
+ m_activeNode = m_activeNode->parentNode();
}
#if ENABLE(DASHBOARD_SUPPORT)
@@ -4930,4 +4948,34 @@ PassRefPtr<TouchList> Document::createTouchList(ExceptionCode&) const
}
#endif
+static bool hasHeadSibling(const Document* document)
+{
+ Node* de = document->documentElement();
+ if (!de)
+ return false;
+
+ for (Node* i = de->firstChild(); i; i = i->nextSibling()) {
+ // A child of the document element which is rather than <head> is
+ // typically visible and FOUC safe. So we return true here.
+ if (!i->hasTagName(headTag))
+ return true;
+ }
+
+ return false;
+}
+
+bool Document::mayCauseFlashOfUnstyledContent() const
+{
+ // Some kind of FOUC is caused by a repaint request before page's <body> arrival
+ // because page authors often give background styles to <body>, not to <html>.
+ // (And these styles are unavailable before <style> or <link> is given.)
+ // This functions is used for checking such possibility of FOUCs.
+ // Note that the implementation considers only empty or <head> only contents as a FOUC cause
+ // rather than missing <body>, because non-HTML document like SVG and arbitrary XML from foreign namespace
+ // should be painted even if there is no <body>.
+ if (didLayoutWithPendingStylesheets())
+ return true;
+ return !hasHeadSibling(this);
+}
+
} // namespace WebCore
diff --git a/WebCore/dom/Document.h b/WebCore/dom/Document.h
index ef1dbf2..a7df9ff 100644
--- a/WebCore/dom/Document.h
+++ b/WebCore/dom/Document.h
@@ -5,6 +5,7 @@
* (C) 2006 Alexey Proskuryakov (ap@webkit.org)
* Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
* Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -94,6 +95,8 @@ class IntPoint;
class DOMWrapperWorld;
class JSNode;
class MediaCanStartListener;
+class MediaQueryList;
+class MediaQueryMatcher;
class MouseEventWithHitTestResults;
class NodeFilter;
class NodeIterator;
@@ -203,6 +206,8 @@ public:
}
virtual ~Document();
+ MediaQueryMatcher* mediaQueryMatcher();
+
using ContainerNode::ref;
using ContainerNode::deref;
@@ -1068,6 +1073,8 @@ public:
const DocumentTiming* timing() const { return &m_documentTiming; }
+ bool mayCauseFlashOfUnstyledContent() const;
+
protected:
Document(Frame*, const KURL& url, bool isXHTML, bool isHTML, const KURL& baseURL = KURL());
@@ -1390,6 +1397,7 @@ private:
bool m_writingModeSetOnDocumentElement;
DocumentTiming m_documentTiming;
+ RefPtr<MediaQueryMatcher> m_mediaQueryMatcher;
};
inline bool Document::DocumentOrderedMap::contains(AtomicStringImpl* id) const
diff --git a/WebCore/dom/Element.cpp b/WebCore/dom/Element.cpp
index 5497465..fad24ee 100644
--- a/WebCore/dom/Element.cpp
+++ b/WebCore/dom/Element.cpp
@@ -546,16 +546,16 @@ PassRefPtr<ClientRect> Element::getBoundingClientRect() const
if (quads.isEmpty())
return ClientRect::create();
- IntRect result = quads[0].enclosingBoundingBox();
+ FloatRect result = quads[0].boundingBox();
for (size_t i = 1; i < quads.size(); ++i)
- result.unite(quads[i].enclosingBoundingBox());
+ result.unite(quads[i].boundingBox());
if (FrameView* view = document()->view()) {
IntRect visibleContentRect = view->visibleContentRect();
result.move(-visibleContentRect.x(), -visibleContentRect.y());
}
- adjustIntRectForAbsoluteZoom(result, renderer());
+ adjustFloatRectForAbsoluteZoom(result, renderer());
return ClientRect::create(result);
}
@@ -1757,7 +1757,8 @@ bool Element::isSpellCheckingEnabled() const
break;
}
- element = element->parentElement();
+ ContainerNode* parent = const_cast<Element*>(element)->parentOrHostNode();
+ element = (parent && parent->isElementNode()) ? toElement(parent) : 0;
}
return true;
diff --git a/WebCore/dom/Event.cpp b/WebCore/dom/Event.cpp
index c8da461..a949fd5 100644
--- a/WebCore/dom/Event.cpp
+++ b/WebCore/dom/Event.cpp
@@ -236,6 +236,13 @@ bool Event::isAudioProcessingEvent() const
}
#endif
+#if ENABLE(INPUT_SPEECH)
+bool Event::isSpeechInputEvent() const
+{
+ return false;
+}
+#endif
+
bool Event::fromUserGesture()
{
if (!UserGestureIndicator::processingUserGesture())
diff --git a/WebCore/dom/Event.h b/WebCore/dom/Event.h
index 0d2f2b9..f05d36c 100644
--- a/WebCore/dom/Event.h
+++ b/WebCore/dom/Event.h
@@ -142,6 +142,9 @@ namespace WebCore {
virtual bool isDeviceMotionEvent() const;
virtual bool isDeviceOrientationEvent() const;
#endif
+#if ENABLE(INPUT_SPEECH)
+ virtual bool isSpeechInputEvent() const;
+#endif
bool fromUserGesture();
bool propagationStopped() const { return m_propagationStopped || m_immediatePropagationStopped; }
diff --git a/WebCore/dom/EventContext.cpp b/WebCore/dom/EventContext.cpp
index 2a5c521..e5fe0ee 100644
--- a/WebCore/dom/EventContext.cpp
+++ b/WebCore/dom/EventContext.cpp
@@ -41,6 +41,13 @@ EventContext::EventContext(PassRefPtr<Node> node, PassRefPtr<EventTarget> curren
{
}
+void EventContext::defaultEventHandler(Event* event) const
+{
+ event->setTarget(m_target.get());
+ event->setCurrentTarget(m_currentTarget.get());
+ m_node->defaultEventHandler(event);
+}
+
void EventContext::handleLocalEvents(Event* event) const
{
event->setTarget(m_target.get());
diff --git a/WebCore/dom/EventContext.h b/WebCore/dom/EventContext.h
index 9bab9d4..8331b4d 100644
--- a/WebCore/dom/EventContext.h
+++ b/WebCore/dom/EventContext.h
@@ -42,6 +42,7 @@ public:
Node* node() const;
EventTarget* target() const;
+ void defaultEventHandler(Event*) const;
void handleLocalEvents(Event*) const;
private:
diff --git a/WebCore/dom/ExceptionCode.cpp b/WebCore/dom/ExceptionCode.cpp
index f048fe5..ad4fb6f 100644
--- a/WebCore/dom/ExceptionCode.cpp
+++ b/WebCore/dom/ExceptionCode.cpp
@@ -227,7 +227,7 @@ void getExceptionCodeDescription(ExceptionCode ec, ExceptionCodeDescription& des
code -= RangeException::RangeExceptionOffset;
nameTable = rangeExceptionNames;
descriptionTable = rangeExceptionDescriptions;
- nameTableSize = sizeof(rangeExceptionNames) / sizeof(rangeExceptionNames[0]);
+ nameTableSize = WTF_ARRAY_LENGTH(rangeExceptionNames);
nameTableOffset = RangeException::BAD_BOUNDARYPOINTS_ERR;
} else if (code >= EventException::EventExceptionOffset && code <= EventException::EventExceptionMax) {
type = EventExceptionType;
@@ -235,7 +235,7 @@ void getExceptionCodeDescription(ExceptionCode ec, ExceptionCodeDescription& des
code -= EventException::EventExceptionOffset;
nameTable = eventExceptionNames;
descriptionTable = eventExceptionDescriptions;
- nameTableSize = sizeof(eventExceptionNames) / sizeof(eventExceptionNames[0]);
+ nameTableSize = WTF_ARRAY_LENGTH(eventExceptionNames);
nameTableOffset = EventException::UNSPECIFIED_EVENT_TYPE_ERR;
} else if (code >= XMLHttpRequestException::XMLHttpRequestExceptionOffset && code <= XMLHttpRequestException::XMLHttpRequestExceptionMax) {
type = XMLHttpRequestExceptionType;
@@ -243,7 +243,7 @@ void getExceptionCodeDescription(ExceptionCode ec, ExceptionCodeDescription& des
code -= XMLHttpRequestException::XMLHttpRequestExceptionOffset;
nameTable = xmlHttpRequestExceptionNames;
descriptionTable = xmlHttpRequestExceptionDescriptions;
- nameTableSize = sizeof(xmlHttpRequestExceptionNames) / sizeof(xmlHttpRequestExceptionNames[0]);
+ nameTableSize = WTF_ARRAY_LENGTH(xmlHttpRequestExceptionNames);
// XMLHttpRequest exception codes start with 101 and we don't want 100 empty elements in the name array
nameTableOffset = XMLHttpRequestException::NETWORK_ERR;
#if ENABLE(XPATH)
@@ -253,7 +253,7 @@ void getExceptionCodeDescription(ExceptionCode ec, ExceptionCodeDescription& des
code -= XPathException::XPathExceptionOffset;
nameTable = xpathExceptionNames;
descriptionTable = xpathExceptionDescriptions;
- nameTableSize = sizeof(xpathExceptionNames) / sizeof(xpathExceptionNames[0]);
+ nameTableSize = WTF_ARRAY_LENGTH(xpathExceptionNames);
// XPath exception codes start with 51 and we don't want 51 empty elements in the name array
nameTableOffset = XPathException::INVALID_EXPRESSION_ERR;
#endif
@@ -264,7 +264,7 @@ void getExceptionCodeDescription(ExceptionCode ec, ExceptionCodeDescription& des
code -= SVGException::SVGExceptionOffset;
nameTable = svgExceptionNames;
descriptionTable = svgExceptionDescriptions;
- nameTableSize = sizeof(svgExceptionNames) / sizeof(svgExceptionNames[0]);
+ nameTableSize = WTF_ARRAY_LENGTH(svgExceptionNames);
nameTableOffset = SVGException::SVG_WRONG_TYPE_ERR;
#endif
#if ENABLE(DATABASE)
@@ -274,7 +274,7 @@ void getExceptionCodeDescription(ExceptionCode ec, ExceptionCodeDescription& des
code -= SQLException::SQLExceptionOffset;
nameTable = sqlExceptionNames;
descriptionTable = sqlExceptionDescriptions;
- nameTableSize = sizeof(sqlExceptionNames) / sizeof(sqlExceptionNames[0]);
+ nameTableSize = WTF_ARRAY_LENGTH(sqlExceptionNames);
nameTableOffset = SQLException::UNKNOWN_ERR;
#endif
#if ENABLE(BLOB) || ENABLE(FILE_SYSTEM)
@@ -284,7 +284,7 @@ void getExceptionCodeDescription(ExceptionCode ec, ExceptionCodeDescription& des
code -= FileException::FileExceptionOffset;
nameTable = fileExceptionNames;
descriptionTable = fileExceptionDescriptions;
- nameTableSize = sizeof(fileExceptionNames) / sizeof(fileExceptionNames[0]);
+ nameTableSize = WTF_ARRAY_LENGTH(fileExceptionNames);
nameTableOffset = FileException::NOT_FOUND_ERR;
#endif
} else {
@@ -292,7 +292,7 @@ void getExceptionCodeDescription(ExceptionCode ec, ExceptionCodeDescription& des
typeName = "DOM";
nameTable = exceptionNames;
descriptionTable = exceptionDescriptions;
- nameTableSize = sizeof(exceptionNames) / sizeof(exceptionNames[0]);
+ nameTableSize = WTF_ARRAY_LENGTH(exceptionNames);
nameTableOffset = INDEX_SIZE_ERR;
}
diff --git a/WebCore/dom/Node.cpp b/WebCore/dom/Node.cpp
index 3c0deb6..e76a37f 100644
--- a/WebCore/dom/Node.cpp
+++ b/WebCore/dom/Node.cpp
@@ -2708,7 +2708,7 @@ doneDispatching:
if (event->bubbles()) {
size_t size = ancestors.size();
for (size_t i = 0; i < size; ++i) {
- ancestors[i].node()->defaultEventHandler(event.get());
+ ancestors[i].defaultEventHandler(event.get());
ASSERT(!event->defaultPrevented());
if (event->defaultHandled())
goto doneWithDefault;
diff --git a/WebCore/dom/Node.h b/WebCore/dom/Node.h
index 17c1580..d346e21 100644
--- a/WebCore/dom/Node.h
+++ b/WebCore/dom/Node.h
@@ -668,6 +668,11 @@ private:
Element* ancestorElement() const;
+ // Use Node::parentNode as the consistent way of querying a parent node.
+ // This method is made private to ensure a compiler error on call sites that
+ // don't follow this rule.
+ using TreeShared<ContainerNode>::parent;
+
void trackForDebugging();
Document* m_document;
diff --git a/WebCore/dom/Position.cpp b/WebCore/dom/Position.cpp
index d56613e..be175aa 100644
--- a/WebCore/dom/Position.cpp
+++ b/WebCore/dom/Position.cpp
@@ -1006,7 +1006,7 @@ static Position downstreamIgnoringEditingBoundaries(Position position)
Position lastPosition;
while (position != lastPosition) {
lastPosition = position;
- position = position.downstream(Position::CanCrossEditingBoundary);
+ position = position.downstream(CanCrossEditingBoundary);
}
return position;
}
@@ -1016,7 +1016,7 @@ static Position upstreamIgnoringEditingBoundaries(Position position)
Position lastPosition;
while (position != lastPosition) {
lastPosition = position;
- position = position.upstream(Position::CanCrossEditingBoundary);
+ position = position.upstream(CanCrossEditingBoundary);
}
return position;
}
diff --git a/WebCore/dom/Position.h b/WebCore/dom/Position.h
index 552d675..4d3b5fe 100644
--- a/WebCore/dom/Position.h
+++ b/WebCore/dom/Position.h
@@ -27,6 +27,7 @@
#define Position_h
#include "ContainerNode.h"
+#include "EditingBoundary.h"
#include "TextAffinity.h"
#include "TextDirection.h"
#include <wtf/Assertions.h>
@@ -56,11 +57,6 @@ public:
PositionIsBeforeAnchor
};
- enum EditingBoundaryCrossingRule {
- CanCrossEditingBoundary,
- CannotCrossEditingBoundary
- };
-
Position()
: m_offset(0)
, m_anchorType(PositionIsOffsetInAnchor)
diff --git a/WebCore/dom/ProcessingInstruction.cpp b/WebCore/dom/ProcessingInstruction.cpp
index 80c58f3..e7dea48 100644
--- a/WebCore/dom/ProcessingInstruction.cpp
+++ b/WebCore/dom/ProcessingInstruction.cpp
@@ -143,7 +143,7 @@ void ProcessingInstruction::checkStyleSheet()
// to kick off import/include loads that can hang off some parent sheet.
if (m_isXSL) {
KURL finalURL(ParsedURLString, m_localHref);
- m_sheet = XSLStyleSheet::createInline(this, finalURL);
+ m_sheet = XSLStyleSheet::createEmbedded(this, finalURL);
m_loading = false;
}
#endif
diff --git a/WebCore/dom/ProcessingInstruction.idl b/WebCore/dom/ProcessingInstruction.idl
index efcc9c1..8c722d3 100644
--- a/WebCore/dom/ProcessingInstruction.idl
+++ b/WebCore/dom/ProcessingInstruction.idl
@@ -20,7 +20,7 @@
module core {
- interface ProcessingInstruction : Node {
+ interface [CustomMarkFunction] ProcessingInstruction : Node {
// DOM Level 1
diff --git a/WebCore/dom/ProgressEvent.cpp b/WebCore/dom/ProgressEvent.cpp
index 99de500..c85eeff 100644
--- a/WebCore/dom/ProgressEvent.cpp
+++ b/WebCore/dom/ProgressEvent.cpp
@@ -35,7 +35,7 @@ ProgressEvent::ProgressEvent()
{
}
-ProgressEvent::ProgressEvent(const AtomicString& type, bool lengthComputable, unsigned loaded, unsigned total)
+ProgressEvent::ProgressEvent(const AtomicString& type, bool lengthComputable, unsigned long long loaded, unsigned long long total)
: Event(type, false, true)
, m_lengthComputable(lengthComputable)
, m_loaded(loaded)
@@ -43,12 +43,8 @@ ProgressEvent::ProgressEvent(const AtomicString& type, bool lengthComputable, un
{
}
-void ProgressEvent::initProgressEvent(const AtomicString& typeArg,
- bool canBubbleArg,
- bool cancelableArg,
- bool lengthComputableArg,
- unsigned loadedArg,
- unsigned totalArg)
+void ProgressEvent::initProgressEvent(const AtomicString& typeArg, bool canBubbleArg, bool cancelableArg,
+ bool lengthComputableArg, unsigned long long loadedArg, unsigned long long totalArg)
{
if (dispatched())
return;
diff --git a/WebCore/dom/ProgressEvent.h b/WebCore/dom/ProgressEvent.h
index e30cb1b..3e295c6 100644
--- a/WebCore/dom/ProgressEvent.h
+++ b/WebCore/dom/ProgressEvent.h
@@ -30,40 +30,35 @@
namespace WebCore {
- class ProgressEvent : public Event {
- public:
- static PassRefPtr<ProgressEvent> create()
- {
- return adoptRef(new ProgressEvent);
- }
- static PassRefPtr<ProgressEvent> create(const AtomicString& type, bool lengthComputable, unsigned loaded, unsigned total)
- {
- return adoptRef(new ProgressEvent(type, lengthComputable, loaded, total));
- }
+class ProgressEvent : public Event {
+public:
+ static PassRefPtr<ProgressEvent> create()
+ {
+ return adoptRef(new ProgressEvent);
+ }
+ static PassRefPtr<ProgressEvent> create(const AtomicString& type, bool lengthComputable, unsigned long long loaded, unsigned long long total)
+ {
+ return adoptRef(new ProgressEvent(type, lengthComputable, loaded, total));
+ }
- void initProgressEvent(const AtomicString& typeArg,
- bool canBubbleArg,
- bool cancelableArg,
- bool lengthComputableArg,
- unsigned loadedArg,
- unsigned totalArg);
-
- bool lengthComputable() const { return m_lengthComputable; }
- unsigned loaded() const { return m_loaded; }
- unsigned total() const { return m_total; }
-
- virtual bool isProgressEvent() const { return true; }
-
- protected:
- ProgressEvent();
- ProgressEvent(const AtomicString& type, bool lengthComputable, unsigned loaded, unsigned total);
+ void initProgressEvent(const AtomicString& typeArg, bool canBubbleArg, bool cancelableArg,
+ bool lengthComputableArg, unsigned long long loadedArg, unsigned long long totalArg);
- private:
- bool m_lengthComputable;
- unsigned m_loaded;
- unsigned m_total;
- };
+ bool lengthComputable() const { return m_lengthComputable; }
+ unsigned long long loaded() const { return m_loaded; }
+ unsigned long long total() const { return m_total; }
+
+protected:
+ ProgressEvent();
+ ProgressEvent(const AtomicString& type, bool lengthComputable, unsigned long long loaded, unsigned long long total);
+
+private:
+ virtual bool isProgressEvent() const { return true; }
+
+ bool m_lengthComputable;
+ unsigned long long m_loaded;
+ unsigned long long m_total;
+};
}
#endif // ProgressEvent_h
-
diff --git a/WebCore/dom/ProgressEvent.idl b/WebCore/dom/ProgressEvent.idl
index afdf3a2..e832def 100644
--- a/WebCore/dom/ProgressEvent.idl
+++ b/WebCore/dom/ProgressEvent.idl
@@ -26,15 +26,12 @@
module events {
interface ProgressEvent : Event {
- readonly attribute boolean lengthComputable;
- readonly attribute unsigned long loaded;
- readonly attribute unsigned long total;
- void initProgressEvent(in DOMString typeArg,
- in boolean canBubbleArg,
- in boolean cancelableArg,
- in boolean lengthComputableArg,
- in unsigned long loadedArg,
- in unsigned long totalArg);
+ readonly attribute boolean lengthComputable;
+ readonly attribute unsigned long long loaded;
+ readonly attribute unsigned long long total;
+
+ void initProgressEvent(in DOMString typeArg, in boolean canBubbleArg, in boolean cancelableArg,
+ in boolean lengthComputableArg, in unsigned long long loadedArg, in unsigned long long totalArg);
};
}
diff --git a/WebCore/dom/Range.cpp b/WebCore/dom/Range.cpp
index 5507b83..96acf8e 100644
--- a/WebCore/dom/Range.cpp
+++ b/WebCore/dom/Range.cpp
@@ -1912,9 +1912,9 @@ PassRefPtr<ClientRect> Range::getBoundingClientRect() const
if (quads.isEmpty())
return ClientRect::create();
- IntRect result;
+ FloatRect result;
for (size_t i = 0; i < quads.size(); ++i)
- result.unite(quads[i].enclosingBoundingBox());
+ result.unite(quads[i].boundingBox());
return ClientRect::create(result);
}
diff --git a/WebCore/dom/ScriptElement.cpp b/WebCore/dom/ScriptElement.cpp
index 6c8441d..74f2580 100644
--- a/WebCore/dom/ScriptElement.cpp
+++ b/WebCore/dom/ScriptElement.cpp
@@ -51,13 +51,13 @@
namespace WebCore {
-ScriptElement::ScriptElement(Element* element, bool createdByParser, bool isEvaluated)
+ScriptElement::ScriptElement(Element* element, bool wasInsertedByParser, bool wasAlreadyStarted)
: m_element(element)
, m_cachedScript(0)
- , m_createdByParser(createdByParser)
- , m_requested(false)
- , m_isEvaluated(isEvaluated)
- , m_firedLoad(false)
+ , m_wasInsertedByParser(wasInsertedByParser)
+ , m_isExternalScript(false)
+ , m_wasAlreadyStarted(wasAlreadyStarted)
+ , m_haveFiredLoad(false)
{
ASSERT(m_element);
}
@@ -69,7 +69,7 @@ ScriptElement::~ScriptElement()
void ScriptElement::insertedIntoDocument(const String& sourceUrl)
{
- if (createdByParser() && !isAsynchronous())
+ if (wasInsertedByParser() && !isAsynchronous())
return;
// http://www.whatwg.org/specs/web-apps/current-work/#script
@@ -93,7 +93,7 @@ void ScriptElement::removedFromDocument()
void ScriptElement::childrenChanged()
{
- if (createdByParser())
+ if (wasInsertedByParser())
return;
// If a node is inserted as a child of the script element
@@ -108,7 +108,7 @@ void ScriptElement::finishParsingChildren(const String& sourceUrl)
// The parser just reached </script>. If we have no src and no text,
// allow dynamic loading later.
if (sourceUrl.isEmpty() && scriptContent().isEmpty())
- m_createdByParser = false;
+ m_wasInsertedByParser = false;
}
void ScriptElement::handleSourceAttribute(const String& sourceUrl)
@@ -158,12 +158,12 @@ void ScriptElement::requestScript(const String& sourceUrl)
ASSERT(!m_cachedScript);
m_cachedScript = document->cachedResourceLoader()->requestScript(sourceUrl, scriptCharset());
- m_requested = true;
+ m_isExternalScript = true;
- // m_createdByParser is never reset - always resied at the initial value set while parsing.
- // m_evaluated is left untouched as well to avoid script reexecution, if a <script> element
+ // m_wasInsertedByParser is never reset - always resied at the initial value set while parsing.
+ // m_wasAlreadyStarted is left untouched as well to avoid script reexecution, if a <script> element
// is removed and reappended to the document.
- m_firedLoad = false;
+ m_haveFiredLoad = false;
if (m_cachedScript) {
m_cachedScript->addClient(this);
@@ -175,7 +175,7 @@ void ScriptElement::requestScript(const String& sourceUrl)
void ScriptElement::evaluateScript(const ScriptSourceCode& sourceCode)
{
- if (m_isEvaluated || sourceCode.isEmpty() || !shouldExecuteAsJavaScript())
+ if (wasAlreadyStarted() || sourceCode.isEmpty() || !shouldExecuteAsJavaScript())
return;
RefPtr<Document> document = m_element->document();
@@ -184,12 +184,12 @@ void ScriptElement::evaluateScript(const ScriptSourceCode& sourceCode)
if (!frame->script()->canExecuteScripts(AboutToExecuteScript))
return;
- m_isEvaluated = true;
+ m_wasAlreadyStarted = true;
// http://www.whatwg.org/specs/web-apps/current-work/#script
{
- IgnoreDestructiveWriteCountIncrementer ignoreDesctructiveWriteCountIncrementer(m_requested ? document.get() : 0);
+ IgnoreDestructiveWriteCountIncrementer ignoreDesctructiveWriteCountIncrementer(m_isExternalScript ? document.get() : 0);
// Create a script from the script element node, using the script
// block's source and the script block's type.
// Note: This is where the script is compiled and actually executed.
@@ -202,7 +202,7 @@ void ScriptElement::evaluateScript(const ScriptSourceCode& sourceCode)
void ScriptElement::executeScript(const ScriptSourceCode& sourceCode)
{
- if (m_isEvaluated || sourceCode.isEmpty())
+ if (wasAlreadyStarted() || sourceCode.isEmpty())
return;
RefPtr<Document> document = m_element->document();
ASSERT(document);
@@ -210,7 +210,7 @@ void ScriptElement::executeScript(const ScriptSourceCode& sourceCode)
if (!frame)
return;
- m_isEvaluated = true;
+ m_wasAlreadyStarted = true;
frame->script()->executeScript(sourceCode);
}
@@ -244,7 +244,7 @@ void ScriptElement::notifyFinished(CachedResource* o)
bool ScriptElement::ignoresLoadRequest() const
{
- return m_isEvaluated || m_requested || m_createdByParser || !m_element->inDocument();
+ return wasAlreadyStarted() || m_isExternalScript || wasInsertedByParser() || !m_element->inDocument();
}
bool ScriptElement::shouldExecuteAsJavaScript() const
diff --git a/WebCore/dom/ScriptElement.h b/WebCore/dom/ScriptElement.h
index b6beb6e..07c59db 100644
--- a/WebCore/dom/ScriptElement.h
+++ b/WebCore/dom/ScriptElement.h
@@ -51,11 +51,12 @@ public:
virtual void dispatchLoadEvent() = 0;
virtual void dispatchErrorEvent() = 0;
+ bool haveFiredLoadEvent() const { return m_haveFiredLoad; }
+
protected:
- bool haveFiredLoadEvent() const { return m_firedLoad; }
- void setHaveFiredLoadEvent(bool firedLoad) { m_firedLoad = firedLoad; }
- bool createdByParser() const { return m_createdByParser; }
- bool isEvaluated() const { return m_isEvaluated; }
+ void setHaveFiredLoadEvent(bool haveFiredLoad) { m_haveFiredLoad = haveFiredLoad; }
+ bool wasInsertedByParser() const { return m_wasInsertedByParser; }
+ bool wasAlreadyStarted() const { return m_wasAlreadyStarted; }
// Helper functions used by our parent classes.
void insertedIntoDocument(const String& sourceUrl);
@@ -85,10 +86,10 @@ private:
Element* m_element;
CachedResourceHandle<CachedScript> m_cachedScript;
- bool m_createdByParser; // HTML5: "parser-inserted"
- bool m_requested;
- bool m_isEvaluated; // HTML5: "already started"
- bool m_firedLoad;
+ bool m_wasInsertedByParser;
+ bool m_isExternalScript;
+ bool m_wasAlreadyStarted;
+ bool m_haveFiredLoad;
};
ScriptElement* toScriptElement(Element*);
diff --git a/WebCore/dom/SelectElement.cpp b/WebCore/dom/SelectElement.cpp
index 34a4961..d236c96 100644
--- a/WebCore/dom/SelectElement.cpp
+++ b/WebCore/dom/SelectElement.cpp
@@ -949,8 +949,12 @@ void SelectElement::accessKeySetSelectedIndex(SelectElementData& data, Element*
else
setSelectedIndex(data, element, index, false, true);
}
-
- listBoxOnChange(data, element);
+
+ if (data.usesMenuList())
+ menuListOnChange(data, element);
+ else
+ listBoxOnChange(data, element);
+
scrollToSelection(data, element);
}
diff --git a/WebCore/dom/ViewportArguments.cpp b/WebCore/dom/ViewportArguments.cpp
index c3d1fc4..d3026e7 100644
--- a/WebCore/dom/ViewportArguments.cpp
+++ b/WebCore/dom/ViewportArguments.cpp
@@ -74,10 +74,26 @@ ViewportAttributes computeViewportAttributes(ViewportArguments args, int desktop
break;
}
- result.devicePixelRatio = float(deviceDPI / 160.0);
+ switch (int(args.targetDensityDpi)) {
+ case ViewportArguments::ValueDeviceDPI:
+ args.targetDensityDpi = deviceDPI;
+ break;
+ case ViewportArguments::ValueLowDPI:
+ args.targetDensityDpi = 120;
+ break;
+ case ViewportArguments::ValueAuto:
+ case ViewportArguments::ValueMediumDPI:
+ args.targetDensityDpi = 160;
+ break;
+ case ViewportArguments::ValueHighDPI:
+ args.targetDensityDpi = 240;
+ break;
+ }
+
+ result.devicePixelRatio = float(deviceDPI / args.targetDensityDpi);
// Resolve non-'auto' width and height to pixel values.
- if (deviceDPI != 1.0) {
+ if (result.devicePixelRatio != 1.0) {
availableWidth /= result.devicePixelRatio;
availableHeight /= result.devicePixelRatio;
deviceWidth /= result.devicePixelRatio;
diff --git a/WebCore/dom/XMLDocumentParser.cpp b/WebCore/dom/XMLDocumentParser.cpp
index b790217..27b0fd4 100644
--- a/WebCore/dom/XMLDocumentParser.cpp
+++ b/WebCore/dom/XMLDocumentParser.cpp
@@ -181,9 +181,9 @@ void XMLDocumentParser::enterText()
}
#if !USE(QXMLSTREAM)
-static inline String toString(const xmlChar* str, unsigned len)
-{
- return UTF8Encoding().decode(reinterpret_cast<const char*>(str), len);
+static inline String toString(const xmlChar* string, size_t size)
+{
+ return String::fromUTF8(reinterpret_cast<const char*>(string), size);
}
#endif
@@ -359,7 +359,7 @@ void XMLDocumentParser::notifyFinished(CachedResource* unusedResource)
if (errorOccurred)
scriptElement->dispatchErrorEvent();
else {
- m_view->frame()->script()->executeScript(sourceCode);
+ scriptElement->executeScript(sourceCode);
scriptElement->dispatchLoadEvent();
}