diff options
author | Ben Murdoch <benm@google.com> | 2009-08-18 15:36:45 +0100 |
---|---|---|
committer | Ben Murdoch <benm@google.com> | 2009-08-18 19:20:06 +0100 |
commit | d227fc870c7a697500a3c900c31baf05fb9a8524 (patch) | |
tree | a3fa109aa5bf52fef562ac49d97a2f723889cc71 /WebCore/wml | |
parent | f2c627513266faa73f7669058d98c60769fb3524 (diff) | |
download | external_webkit-d227fc870c7a697500a3c900c31baf05fb9a8524.zip external_webkit-d227fc870c7a697500a3c900c31baf05fb9a8524.tar.gz external_webkit-d227fc870c7a697500a3c900c31baf05fb9a8524.tar.bz2 |
Merge WebKit r47420
Diffstat (limited to 'WebCore/wml')
-rw-r--r-- | WebCore/wml/WMLAnchorElement.cpp | 4 | ||||
-rw-r--r-- | WebCore/wml/WMLCardElement.cpp | 2 | ||||
-rw-r--r-- | WebCore/wml/WMLDoElement.cpp | 13 | ||||
-rw-r--r-- | WebCore/wml/WMLDocument.cpp | 4 | ||||
-rw-r--r-- | WebCore/wml/WMLDocument.h | 4 | ||||
-rw-r--r-- | WebCore/wml/WMLGoElement.cpp | 18 | ||||
-rw-r--r-- | WebCore/wml/WMLGoElement.h | 2 | ||||
-rw-r--r-- | WebCore/wml/WMLIntrinsicEventHandler.cpp | 2 | ||||
-rw-r--r-- | WebCore/wml/WMLOptionElement.cpp | 4 | ||||
-rw-r--r-- | WebCore/wml/WMLPageState.cpp | 1 | ||||
-rw-r--r-- | WebCore/wml/WMLPageState.h | 4 | ||||
-rw-r--r-- | WebCore/wml/WMLPrevElement.cpp | 9 | ||||
-rw-r--r-- | WebCore/wml/WMLPrevElement.h | 2 | ||||
-rw-r--r-- | WebCore/wml/WMLRefreshElement.cpp | 11 | ||||
-rw-r--r-- | WebCore/wml/WMLRefreshElement.h | 2 | ||||
-rw-r--r-- | WebCore/wml/WMLSelectElement.cpp | 6 | ||||
-rw-r--r-- | WebCore/wml/WMLSelectElement.h | 3 | ||||
-rw-r--r-- | WebCore/wml/WMLTaskElement.h | 2 |
18 files changed, 54 insertions, 39 deletions
diff --git a/WebCore/wml/WMLAnchorElement.cpp b/WebCore/wml/WMLAnchorElement.cpp index 91526b9..b9b3f53 100644 --- a/WebCore/wml/WMLAnchorElement.cpp +++ b/WebCore/wml/WMLAnchorElement.cpp @@ -54,7 +54,7 @@ void WMLAnchorElement::defaultEventHandler(Event* event) shouldHandle = static_cast<KeyboardEvent*>(event)->keyIdentifier() == "Enter"; if (shouldHandle && m_task) { - m_task->executeTask(event); + m_task->executeTask(); event->setDefaultHandled(); return; } @@ -71,7 +71,7 @@ void WMLAnchorElement::registerTask(WMLTaskElement* task) void WMLAnchorElement::deregisterTask(WMLTaskElement* task) { - ASSERT(m_task == task); + ASSERT_UNUSED(task, m_task == task); m_task = 0; } diff --git a/WebCore/wml/WMLCardElement.cpp b/WebCore/wml/WMLCardElement.cpp index 63240f3..818b818 100644 --- a/WebCore/wml/WMLCardElement.cpp +++ b/WebCore/wml/WMLCardElement.cpp @@ -339,8 +339,6 @@ WMLCardElement* WMLCardElement::determineActiveCard(Document* doc) // Update the document title doc->setTitle(activeCard->title()); - // Set the active activeCard in the WMLPageState object - pageState->setActiveCard(activeCard); return activeCard; } diff --git a/WebCore/wml/WMLDoElement.cpp b/WebCore/wml/WMLDoElement.cpp index 34be6df..38ad5dd 100644 --- a/WebCore/wml/WMLDoElement.cpp +++ b/WebCore/wml/WMLDoElement.cpp @@ -70,14 +70,17 @@ void WMLDoElement::defaultEventHandler(Event* event) if (m_type == "accept" || m_type == "options") { if (m_task) - m_task->executeTask(event); + m_task->executeTask(); } else if (m_type == "prev") { - WMLPageState* pageState = wmlPageStateForDocument(document()); + ASSERT(document()->isWMLDocument()); + WMLDocument* document = static_cast<WMLDocument*>(this->document()); + + WMLPageState* pageState = wmlPageStateForDocument(document); if (!pageState) return; - + // Stop the timer of the current card if it is active - if (WMLCardElement* card = pageState->activeCard()) { + if (WMLCardElement* card = document->activeCard()) { if (WMLTimerElement* eventTimer = card->eventTimer()) eventTimer->stop(); } @@ -172,7 +175,7 @@ void WMLDoElement::registerTask(WMLTaskElement* task) void WMLDoElement::deregisterTask(WMLTaskElement* task) { - ASSERT(m_task == task); + ASSERT_UNUSED(task, m_task == task); m_task = 0; } diff --git a/WebCore/wml/WMLDocument.cpp b/WebCore/wml/WMLDocument.cpp index f2287be..ef0bfc8 100644 --- a/WebCore/wml/WMLDocument.cpp +++ b/WebCore/wml/WMLDocument.cpp @@ -79,10 +79,8 @@ void WMLDocument::finishedParsing() return; } - if (m_activeCard) { + if (m_activeCard) m_activeCard->handleIntrinsicEventIfNeeded(); - m_activeCard = 0; - } } bool WMLDocument::initialize(bool aboutToFinishParsing) diff --git a/WebCore/wml/WMLDocument.h b/WebCore/wml/WMLDocument.h index fb3e62e..9053518 100644 --- a/WebCore/wml/WMLDocument.h +++ b/WebCore/wml/WMLDocument.h @@ -34,7 +34,7 @@ class WMLDocument : public Document { public: static PassRefPtr<WMLDocument> create(Frame* frame) { - return new WMLDocument(frame); + return adoptRef(new WMLDocument(frame)); } virtual ~WMLDocument(); @@ -44,6 +44,8 @@ public: bool initialize(bool aboutToFinishParsing = false); + WMLCardElement* activeCard() const { return m_activeCard; } + private: WMLDocument(Frame*); WMLCardElement* m_activeCard; diff --git a/WebCore/wml/WMLGoElement.cpp b/WebCore/wml/WMLGoElement.cpp index 635302f..8076207 100644 --- a/WebCore/wml/WMLGoElement.cpp +++ b/WebCore/wml/WMLGoElement.cpp @@ -73,18 +73,20 @@ void WMLGoElement::parseMappedAttribute(MappedAttribute* attr) WMLTaskElement::parseMappedAttribute(attr); } -void WMLGoElement::executeTask(Event*) +void WMLGoElement::executeTask() { - Document* doc = document(); - WMLPageState* pageState = wmlPageStateForDocument(doc); + ASSERT(document()->isWMLDocument()); + WMLDocument* document = static_cast<WMLDocument*>(this->document()); + + WMLPageState* pageState = wmlPageStateForDocument(document); if (!pageState) return; - WMLCardElement* card = pageState->activeCard(); + WMLCardElement* card = document->activeCard(); if (!card) return; - Frame* frame = doc->frame(); + Frame* frame = document->frame(); if (!frame) return; @@ -97,7 +99,7 @@ void WMLGoElement::executeTask(Event*) return; // Substitute variables within target url attribute value - KURL url = doc->completeURL(substituteVariableReferences(href, doc, WMLVariableEscapingEscape)); + KURL url = document->completeURL(substituteVariableReferences(href, document, WMLVariableEscapingEscape)); if (url.isEmpty()) return; @@ -108,9 +110,9 @@ void WMLGoElement::executeTask(Event*) eventTimer->stop(); // FIXME: 'newcontext' handling not implemented for external cards - bool inSameDeck = doc->url().path() == url.path(); + bool inSameDeck = document->url().path() == url.path(); if (inSameDeck && url.hasFragmentIdentifier()) { - if (WMLCardElement* card = WMLCardElement::findNamedCardInDocument(doc, url.fragmentIdentifier())) { + if (WMLCardElement* card = WMLCardElement::findNamedCardInDocument(document, url.fragmentIdentifier())) { if (card->isNewContext()) pageState->reset(); } diff --git a/WebCore/wml/WMLGoElement.h b/WebCore/wml/WMLGoElement.h index 75c1858..36c7be2 100644 --- a/WebCore/wml/WMLGoElement.h +++ b/WebCore/wml/WMLGoElement.h @@ -39,7 +39,7 @@ public: void deregisterPostfieldElement(WMLPostfieldElement*); virtual void parseMappedAttribute(MappedAttribute*); - virtual void executeTask(Event*); + virtual void executeTask(); private: void preparePOSTRequest(ResourceRequest&, bool inSameDeck, const String& cacheControl); diff --git a/WebCore/wml/WMLIntrinsicEventHandler.cpp b/WebCore/wml/WMLIntrinsicEventHandler.cpp index 67364d9..8e4c276 100644 --- a/WebCore/wml/WMLIntrinsicEventHandler.cpp +++ b/WebCore/wml/WMLIntrinsicEventHandler.cpp @@ -48,7 +48,7 @@ void WMLIntrinsicEventHandler::triggerIntrinsicEvent(WMLIntrinsicEventType type) { RefPtr<WMLIntrinsicEvent> event = m_events.get(type); ASSERT(event->taskElement()); - event->taskElement()->executeTask(0); + event->taskElement()->executeTask(); } bool WMLIntrinsicEventHandler::hasIntrinsicEvent(WMLIntrinsicEventType type) const diff --git a/WebCore/wml/WMLOptionElement.cpp b/WebCore/wml/WMLOptionElement.cpp index 764d3a1..61fa762 100644 --- a/WebCore/wml/WMLOptionElement.cpp +++ b/WebCore/wml/WMLOptionElement.cpp @@ -158,6 +158,10 @@ RenderStyle* WMLOptionElement::nonRendererRenderStyle() const void WMLOptionElement::handleIntrinsicEventIfNeeded() { + WMLSelectElement* select = ownerSelectElement(this); + if (!select || !select->initialized()) + return; + WMLIntrinsicEventHandler* eventHandler = this->eventHandler(); if (!eventHandler) return; diff --git a/WebCore/wml/WMLPageState.cpp b/WebCore/wml/WMLPageState.cpp index 5f431bb..3e1863d 100644 --- a/WebCore/wml/WMLPageState.cpp +++ b/WebCore/wml/WMLPageState.cpp @@ -35,7 +35,6 @@ namespace WebCore { WMLPageState::WMLPageState(Page* page) : m_page(page) - , m_activeCard(0) , m_hasAccessControlData(false) { } diff --git a/WebCore/wml/WMLPageState.h b/WebCore/wml/WMLPageState.h index de0af91..a5d8b23 100644 --- a/WebCore/wml/WMLPageState.h +++ b/WebCore/wml/WMLPageState.h @@ -54,9 +54,6 @@ public: Page* page() const { return m_page; } - WMLCardElement* activeCard() const { return m_activeCard; } - void setActiveCard(WMLCardElement* card) { m_activeCard = card; } - // Deck access control bool processAccessControlData(const String& dmain, const String& path); void resetAccessControlData(); @@ -70,7 +67,6 @@ private: private: Page* m_page; WMLVariableMap m_variables; - WMLCardElement* m_activeCard; String m_accessDomain; String m_accessPath; bool m_hasAccessControlData; diff --git a/WebCore/wml/WMLPrevElement.cpp b/WebCore/wml/WMLPrevElement.cpp index 2688d03..3d487ea 100644 --- a/WebCore/wml/WMLPrevElement.cpp +++ b/WebCore/wml/WMLPrevElement.cpp @@ -40,13 +40,16 @@ WMLPrevElement::~WMLPrevElement() { } -void WMLPrevElement::executeTask(Event*) +void WMLPrevElement::executeTask() { - WMLPageState* pageState = wmlPageStateForDocument(document()); + ASSERT(document()->isWMLDocument()); + WMLDocument* document = static_cast<WMLDocument*>(this->document()); + + WMLPageState* pageState = wmlPageStateForDocument(document); if (!pageState) return; - WMLCardElement* card = pageState->activeCard(); + WMLCardElement* card = document->activeCard(); if (!card) return; diff --git a/WebCore/wml/WMLPrevElement.h b/WebCore/wml/WMLPrevElement.h index 232c1b0..ce8596e 100644 --- a/WebCore/wml/WMLPrevElement.h +++ b/WebCore/wml/WMLPrevElement.h @@ -31,7 +31,7 @@ public: WMLPrevElement(const QualifiedName& tagName, Document*); virtual ~WMLPrevElement(); - virtual void executeTask(Event*); + virtual void executeTask(); }; } diff --git a/WebCore/wml/WMLRefreshElement.cpp b/WebCore/wml/WMLRefreshElement.cpp index c05a2c9..bcf87ac 100644 --- a/WebCore/wml/WMLRefreshElement.cpp +++ b/WebCore/wml/WMLRefreshElement.cpp @@ -41,13 +41,16 @@ WMLRefreshElement::~WMLRefreshElement() { } -void WMLRefreshElement::executeTask(Event*) +void WMLRefreshElement::executeTask() { - WMLPageState* pageState = wmlPageStateForDocument(document()); + ASSERT(document()->isWMLDocument()); + WMLDocument* document = static_cast<WMLDocument*>(this->document()); + + WMLPageState* pageState = wmlPageStateForDocument(document); if (!pageState) return; - WMLCardElement* card = pageState->activeCard(); + WMLCardElement* card = document->activeCard(); if (!card) return; @@ -62,7 +65,7 @@ void WMLRefreshElement::executeTask(Event*) storeVariableState(pageState); // Redisplay curremt card with current variable state - if (Frame* frame = document()->frame()) { + if (Frame* frame = document->frame()) { if (FrameLoader* loader = frame->loader()) loader->reload(); } diff --git a/WebCore/wml/WMLRefreshElement.h b/WebCore/wml/WMLRefreshElement.h index 7b1729e..43b71b5 100644 --- a/WebCore/wml/WMLRefreshElement.h +++ b/WebCore/wml/WMLRefreshElement.h @@ -31,7 +31,7 @@ public: WMLRefreshElement(const QualifiedName& tagName, Document*); virtual ~WMLRefreshElement(); - virtual void executeTask(Event*); + virtual void executeTask(); }; } diff --git a/WebCore/wml/WMLSelectElement.cpp b/WebCore/wml/WMLSelectElement.cpp index 2d03a3f..03ca05a 100644 --- a/WebCore/wml/WMLSelectElement.cpp +++ b/WebCore/wml/WMLSelectElement.cpp @@ -39,6 +39,7 @@ using namespace WMLNames; WMLSelectElement::WMLSelectElement(const QualifiedName& tagName, Document* document) : WMLFormControlElement(tagName, document) + , m_initialized(false) { } @@ -242,14 +243,17 @@ void WMLSelectElement::selectInitialOptions() // Spec: Step 1 - the default option index is determined using iname and ivalue calculateDefaultOptionIndices(); - if (m_defaultOptionIndices.isEmpty()) + if (m_defaultOptionIndices.isEmpty()) { + m_initialized = true; return; + } // Spec: Step 2 – initialise variables initializeVariables(); // Spec: Step 3 – pre-select option(s) specified by the default option index selectDefaultOptions(); + m_initialized = true; } void WMLSelectElement::insertedIntoTree(bool deep) diff --git a/WebCore/wml/WMLSelectElement.h b/WebCore/wml/WMLSelectElement.h index 412a950..5ab7da6 100644 --- a/WebCore/wml/WMLSelectElement.h +++ b/WebCore/wml/WMLSelectElement.h @@ -85,6 +85,8 @@ public: void scrollToSelection(); void selectInitialOptions(); + bool initialized() const { return m_initialized; } + private: virtual void insertedIntoTree(bool); @@ -104,6 +106,7 @@ private: String ivalue() const; SelectElementData m_data; + bool m_initialized; Vector<unsigned> m_defaultOptionIndices; }; diff --git a/WebCore/wml/WMLTaskElement.h b/WebCore/wml/WMLTaskElement.h index b5dab8c..b813285 100644 --- a/WebCore/wml/WMLTaskElement.h +++ b/WebCore/wml/WMLTaskElement.h @@ -40,7 +40,7 @@ public: virtual void insertedIntoDocument(); virtual void removedFromDocument(); - virtual void executeTask(Event*) = 0; + virtual void executeTask() = 0; void registerVariableSetter(WMLSetvarElement*); void deregisterVariableSetter(WMLSetvarElement*); |