summaryrefslogtreecommitdiffstats
path: root/WebCore/dom
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2011-01-05 12:15:11 +0000
committerSteve Block <steveblock@google.com>2011-01-06 14:14:00 +0000
commitd06194330da2bb8da887d2e1adeacb3a5c1504b2 (patch)
treee0af8413af65a8e30630563441af7bdb8478e513 /WebCore/dom
parent419a5cf2f8db6ca014df624865197ffb82caad37 (diff)
downloadexternal_webkit-d06194330da2bb8da887d2e1adeacb3a5c1504b2.zip
external_webkit-d06194330da2bb8da887d2e1adeacb3a5c1504b2.tar.gz
external_webkit-d06194330da2bb8da887d2e1adeacb3a5c1504b2.tar.bz2
Merge WebKit at r72805: Initial merge by Git
Note that this is a backwards merge from Chromium release 9.0.600.0 to 9.0.597.0, to align with the Chromium 9 stable release branch. Change-Id: I5d2bb4e8cee9d39ae8485abf48bdb55ecf8b3790
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.cpp19
-rw-r--r--WebCore/dom/Element.cpp6
-rw-r--r--WebCore/dom/Node.h5
-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
12 files changed, 89 insertions, 97 deletions
diff --git a/WebCore/dom/ClientRect.cpp b/WebCore/dom/ClientRect.cpp
index b132222..c69a2ab 100644
--- a/WebCore/dom/ClientRect.cpp
+++ b/WebCore/dom/ClientRect.cpp
@@ -38,9 +38,4 @@ 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 f9acef0..349ea85 100644
--- a/WebCore/dom/ClientRect.h
+++ b/WebCore/dom/ClientRect.h
@@ -39,7 +39,6 @@ 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(); }
@@ -51,7 +50,6 @@ 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 df37ebc..4bd3af3 100644
--- a/WebCore/dom/Document.cpp
+++ b/WebCore/dom/Document.cpp
@@ -1724,7 +1724,7 @@ PassRefPtr<RenderStyle> Document::styleForElementIgnoringPendingStylesheets(Elem
bool oldIgnore = m_ignorePendingStylesheets;
m_ignorePendingStylesheets = true;
- RefPtr<RenderStyle> style = styleSelector()->styleForElement(element, element->parentNode() ? element->parentNode()->computedStyle() : 0);
+ RefPtr<RenderStyle> style = styleSelector()->styleForElement(element, element->parent() ? element->parent()->computedStyle() : 0);
m_ignorePendingStylesheets = oldIgnore;
return style.release();
}
@@ -1893,11 +1893,8 @@ void Document::clearAXObjectCache()
#else
// clear cache in top document
if (m_axObjectCache) {
- // Clear the cache member variable before calling delete because attempts
- // are made to access it during destruction.
- AXObjectCache* axObjectCache = m_axObjectCache;
+ delete m_axObjectCache;
m_axObjectCache = 0;
- delete axObjectCache;
return;
}
@@ -3161,24 +3158,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->parentNode())))
+ if (!m_hoverNode || (node != m_hoverNode && (!m_hoverNode->isTextNode() || node != m_hoverNode->parent())))
return;
- m_hoverNode = node->parentNode();
+ m_hoverNode = node->parent();
while (m_hoverNode && !m_hoverNode->renderer())
- m_hoverNode = m_hoverNode->parentNode();
+ m_hoverNode = m_hoverNode->parent();
if (frame())
frame()->eventHandler()->scheduleHoverStateUpdate();
}
void Document::activeChainNodeDetached(Node* node)
{
- if (!m_activeNode || (node != m_activeNode && (!m_activeNode->isTextNode() || node != m_activeNode->parentNode())))
+ if (!m_activeNode || (node != m_activeNode && (!m_activeNode->isTextNode() || node != m_activeNode->parent())))
return;
- m_activeNode = node->parentNode();
+ m_activeNode = node->parent();
while (m_activeNode && !m_activeNode->renderer())
- m_activeNode = m_activeNode->parentNode();
+ m_activeNode = m_activeNode->parent();
}
#if ENABLE(DASHBOARD_SUPPORT)
diff --git a/WebCore/dom/Element.cpp b/WebCore/dom/Element.cpp
index fad24ee..6c0e291 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();
- FloatRect result = quads[0].boundingBox();
+ IntRect result = quads[0].enclosingBoundingBox();
for (size_t i = 1; i < quads.size(); ++i)
- result.unite(quads[i].boundingBox());
+ result.unite(quads[i].enclosingBoundingBox());
if (FrameView* view = document()->view()) {
IntRect visibleContentRect = view->visibleContentRect();
result.move(-visibleContentRect.x(), -visibleContentRect.y());
}
- adjustFloatRectForAbsoluteZoom(result, renderer());
+ adjustIntRectForAbsoluteZoom(result, renderer());
return ClientRect::create(result);
}
diff --git a/WebCore/dom/Node.h b/WebCore/dom/Node.h
index d346e21..17c1580 100644
--- a/WebCore/dom/Node.h
+++ b/WebCore/dom/Node.h
@@ -668,11 +668,6 @@ 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/ProgressEvent.cpp b/WebCore/dom/ProgressEvent.cpp
index c85eeff..99de500 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 long long loaded, unsigned long long total)
+ProgressEvent::ProgressEvent(const AtomicString& type, bool lengthComputable, unsigned loaded, unsigned total)
: Event(type, false, true)
, m_lengthComputable(lengthComputable)
, m_loaded(loaded)
@@ -43,8 +43,12 @@ ProgressEvent::ProgressEvent(const AtomicString& type, bool lengthComputable, un
{
}
-void ProgressEvent::initProgressEvent(const AtomicString& typeArg, bool canBubbleArg, bool cancelableArg,
- bool lengthComputableArg, unsigned long long loadedArg, unsigned long long totalArg)
+void ProgressEvent::initProgressEvent(const AtomicString& typeArg,
+ bool canBubbleArg,
+ bool cancelableArg,
+ bool lengthComputableArg,
+ unsigned loadedArg,
+ unsigned totalArg)
{
if (dispatched())
return;
diff --git a/WebCore/dom/ProgressEvent.h b/WebCore/dom/ProgressEvent.h
index 3e295c6..e30cb1b 100644
--- a/WebCore/dom/ProgressEvent.h
+++ b/WebCore/dom/ProgressEvent.h
@@ -30,35 +30,40 @@
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 long long loaded, unsigned long long 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 loaded, unsigned total)
+ {
+ return adoptRef(new ProgressEvent(type, lengthComputable, loaded, total));
+ }
- void initProgressEvent(const AtomicString& typeArg, bool canBubbleArg, bool cancelableArg,
- bool lengthComputableArg, unsigned long long loadedArg, unsigned long long totalArg);
+ 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);
- 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;
-};
+ private:
+ bool m_lengthComputable;
+ unsigned m_loaded;
+ unsigned m_total;
+ };
}
#endif // ProgressEvent_h
+
diff --git a/WebCore/dom/ProgressEvent.idl b/WebCore/dom/ProgressEvent.idl
index e832def..afdf3a2 100644
--- a/WebCore/dom/ProgressEvent.idl
+++ b/WebCore/dom/ProgressEvent.idl
@@ -26,12 +26,15 @@
module events {
interface ProgressEvent : Event {
- 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);
+ 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);
};
}
diff --git a/WebCore/dom/Range.cpp b/WebCore/dom/Range.cpp
index 96acf8e..5507b83 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();
- FloatRect result;
+ IntRect result;
for (size_t i = 0; i < quads.size(); ++i)
- result.unite(quads[i].boundingBox());
+ result.unite(quads[i].enclosingBoundingBox());
return ClientRect::create(result);
}
diff --git a/WebCore/dom/ScriptElement.cpp b/WebCore/dom/ScriptElement.cpp
index 74f2580..6c8441d 100644
--- a/WebCore/dom/ScriptElement.cpp
+++ b/WebCore/dom/ScriptElement.cpp
@@ -51,13 +51,13 @@
namespace WebCore {
-ScriptElement::ScriptElement(Element* element, bool wasInsertedByParser, bool wasAlreadyStarted)
+ScriptElement::ScriptElement(Element* element, bool createdByParser, bool isEvaluated)
: m_element(element)
, m_cachedScript(0)
- , m_wasInsertedByParser(wasInsertedByParser)
- , m_isExternalScript(false)
- , m_wasAlreadyStarted(wasAlreadyStarted)
- , m_haveFiredLoad(false)
+ , m_createdByParser(createdByParser)
+ , m_requested(false)
+ , m_isEvaluated(isEvaluated)
+ , m_firedLoad(false)
{
ASSERT(m_element);
}
@@ -69,7 +69,7 @@ ScriptElement::~ScriptElement()
void ScriptElement::insertedIntoDocument(const String& sourceUrl)
{
- if (wasInsertedByParser() && !isAsynchronous())
+ if (createdByParser() && !isAsynchronous())
return;
// http://www.whatwg.org/specs/web-apps/current-work/#script
@@ -93,7 +93,7 @@ void ScriptElement::removedFromDocument()
void ScriptElement::childrenChanged()
{
- if (wasInsertedByParser())
+ if (createdByParser())
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_wasInsertedByParser = false;
+ m_createdByParser = 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_isExternalScript = true;
+ m_requested = true;
- // 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
+ // 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
// is removed and reappended to the document.
- m_haveFiredLoad = false;
+ m_firedLoad = 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 (wasAlreadyStarted() || sourceCode.isEmpty() || !shouldExecuteAsJavaScript())
+ if (m_isEvaluated || 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_wasAlreadyStarted = true;
+ m_isEvaluated = true;
// http://www.whatwg.org/specs/web-apps/current-work/#script
{
- IgnoreDestructiveWriteCountIncrementer ignoreDesctructiveWriteCountIncrementer(m_isExternalScript ? document.get() : 0);
+ IgnoreDestructiveWriteCountIncrementer ignoreDesctructiveWriteCountIncrementer(m_requested ? 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 (wasAlreadyStarted() || sourceCode.isEmpty())
+ if (m_isEvaluated || 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_wasAlreadyStarted = true;
+ m_isEvaluated = true;
frame->script()->executeScript(sourceCode);
}
@@ -244,7 +244,7 @@ void ScriptElement::notifyFinished(CachedResource* o)
bool ScriptElement::ignoresLoadRequest() const
{
- return wasAlreadyStarted() || m_isExternalScript || wasInsertedByParser() || !m_element->inDocument();
+ return m_isEvaluated || m_requested || m_createdByParser || !m_element->inDocument();
}
bool ScriptElement::shouldExecuteAsJavaScript() const
diff --git a/WebCore/dom/ScriptElement.h b/WebCore/dom/ScriptElement.h
index 07c59db..b6beb6e 100644
--- a/WebCore/dom/ScriptElement.h
+++ b/WebCore/dom/ScriptElement.h
@@ -51,12 +51,11 @@ public:
virtual void dispatchLoadEvent() = 0;
virtual void dispatchErrorEvent() = 0;
- bool haveFiredLoadEvent() const { return m_haveFiredLoad; }
-
protected:
- void setHaveFiredLoadEvent(bool haveFiredLoad) { m_haveFiredLoad = haveFiredLoad; }
- bool wasInsertedByParser() const { return m_wasInsertedByParser; }
- bool wasAlreadyStarted() const { return m_wasAlreadyStarted; }
+ 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; }
// Helper functions used by our parent classes.
void insertedIntoDocument(const String& sourceUrl);
@@ -86,10 +85,10 @@ private:
Element* m_element;
CachedResourceHandle<CachedScript> m_cachedScript;
- bool m_wasInsertedByParser;
- bool m_isExternalScript;
- bool m_wasAlreadyStarted;
- bool m_haveFiredLoad;
+ bool m_createdByParser; // HTML5: "parser-inserted"
+ bool m_requested;
+ bool m_isEvaluated; // HTML5: "already started"
+ bool m_firedLoad;
};
ScriptElement* toScriptElement(Element*);
diff --git a/WebCore/dom/SelectElement.cpp b/WebCore/dom/SelectElement.cpp
index d236c96..34a4961 100644
--- a/WebCore/dom/SelectElement.cpp
+++ b/WebCore/dom/SelectElement.cpp
@@ -949,12 +949,8 @@ void SelectElement::accessKeySetSelectedIndex(SelectElementData& data, Element*
else
setSelectedIndex(data, element, index, false, true);
}
-
- if (data.usesMenuList())
- menuListOnChange(data, element);
- else
- listBoxOnChange(data, element);
-
+
+ listBoxOnChange(data, element);
scrollToSelection(data, element);
}