Changeset 46418 in webkit
- Timestamp:
- Jul 27, 2009 10:04:35 AM (15 years ago)
- Location:
- trunk
- Files:
-
- 8 added
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r46412 r46418 1 2009-07-27 Nikolas Zimmermann <nikolas.zimmermann@torchmobile.com> 2 3 Reviewed by George Staikos. 4 5 [WML] History handling / page cache / loading is buggy and depends on several hacks 6 https://bugs.webkit.org/show_bug.cgi?id=27707 7 8 Add two new WML layout tests after redesigning WML history/loading handling. 9 10 * wml/enter-card-with-events-expected.txt: Added. 11 * wml/enter-card-with-events.html: Added. 12 * wml/enter-first-card-with-events-expected.txt: Added. 13 * wml/enter-first-card-with-events.html: Added. 14 * wml/resources/WMLTestCase.js: 15 * wml/resources/enter-card-with-events.js: Added. 16 (setupTestDocument): 17 (prepareTest): 18 (executeTest): 19 * wml/resources/enter-card-with-events.wml: Added. 20 * wml/resources/enter-first-card-with-events.js: Added. 21 (setupTestDocument): 22 (prepareTest): 23 (executeTest): 24 * wml/resources/enter-first-card-with-events.wml: Added. 25 1 26 2009-07-27 Jan Michael Alonzo <jmalonzo@webkit.org> 2 27 -
trunk/LayoutTests/wml/resources/WMLTestCase.js
r46395 r46418 10 10 } 11 11 12 function createWMLTestCase(testDescription, substitutesVariables, testName, executeImmediately ) {12 function createWMLTestCase(testDescription, substitutesVariables, testName, executeImmediately, needsReset) { 13 13 // Setup default test options 14 14 if (substitutesVariables == null) { … … 24 24 } 25 25 26 // Some tests may want to handle resetting the page state themselves 27 if (needsReset == null) { 28 needsReset = true; 29 } 30 26 31 // Initialize JS test 27 32 description(testDescription); … … 29 34 30 35 // Clear variable state & history 31 document.resetWMLPageState(); 36 if (needsReset) 37 document.resetWMLPageState(); 32 38 33 39 // Setup DRT specific settings -
trunk/WebCore/ChangeLog
r46417 r46418 1 2009-07-27 Nikolas Zimmermann <nikolas.zimmermann@torchmobile.com> 2 3 Reviewed by George Staikos. 4 5 [WML] History handling / page cache / loading is buggy and depends on several hacks 6 https://bugs.webkit.org/show_bug.cgi?id=27707 7 8 Redesign WML history/loading handling. In detail: 9 10 - Remove FrameLoader::setForceReloadWmlDeck(). WML used to force a special loading behaviour 11 by calling this method from WMLGoElement & friends - instead teach FrameLoader to detect 12 WML content itself. 13 14 WML content is usually a standalone WML document (isWMLDocument()=true) or as special case 15 an XHTML document which embeds a WML document (that's the way the WML layout tests work). 16 Force WML loading behaviour even for XHTML document which embed WML documents. This only 17 applies to our layout tests, not for any real world site. Though it gives us a perfect 18 way to test the WML loading code even when we're not operating on a standalone WML document. 19 20 Whenever a WMLCardElement is inserted into the document it will check wheter it's inserted 21 in a standalone WML document or wheter the main frame document is different. If it differs 22 the main frame documents' "containsWMLContent" property is set to true. 23 24 -> Make FrameLoader::shouldReload() use the new frameContainsWMLContent() method, which 25 checks if the associated frame document is a WML document or wheter it contains WML content. 26 27 - Change FrameLoader::loadItem() to use the new frameContainsWMLContent() method for 'shouldScroll' 28 detection. WML documents (or those containing WML content) always want new loads even for in-page 29 navigation. No "scroll to anchor" mechanism should apply. 30 31 - Modify FrameLoader::canCachePageContainingThisFrame() to check for !frameContainsWMLContent(). 32 WML pages should never be cached, potential security problem due the use of variables (per spec). 33 34 Add two new WML tests which were broken before, testing onenterforward/onenterbackward event handling 35 and history navigation (<prev/> task). 36 37 Tests: wml/enter-card-with-events.html 38 wml/enter-first-card-with-events.html 39 40 * dom/Document.cpp: Initialize new 'm_containsWMLContent' property. 41 (WebCore::Document::Document): 42 * dom/Document.h: Add new helper methods and 'm_containsWMLContent" variable (explained above). 43 (WebCore::Document::setContainsWMLContent): 44 (WebCore::Document::containsWMLContent): 45 * history/BackForwardList.cpp: 46 (WebCore::BackForwardList::clearWMLPageHistory): Renamed from clearWmlPageHistory() & slight cleanup. 47 * history/BackForwardList.h: 48 * loader/FrameLoader.cpp: Rework WML loading behaviour (explained above). 49 (WebCore::FrameLoader::FrameLoader): 50 (WebCore::frameContainsWMLContent): 51 (WebCore::FrameLoader::canCachePageContainingThisFrame): 52 (WebCore::FrameLoader::shouldReload): 53 (WebCore::FrameLoader::loadItem): 54 * loader/FrameLoader.h: 55 * wml/WMLCardElement.cpp: 56 (WebCore::WMLCardElement::handleIntrinsicEventIfNeeded): No need anymore to manually track history length. 57 (WebCore::WMLCardElement::insertedIntoDocument): Handle setting containsWMLContent on the main frame document. 58 * wml/WMLGoElement.cpp: 59 (WebCore::WMLGoElement::executeTask): Remove call to FrameLoader::setForceReloadWmlDeck() 60 * wml/WMLPageState.cpp: Remove 'm_historyLength' - no need anymore to track history length on our own. 61 (WebCore::WMLPageState::WMLPageState): 62 (WebCore::WMLPageState::dump): 63 (WebCore::WMLPageState::reset): 64 * wml/WMLPageState.h: 65 1 66 2009-07-27 Pavel Feldman <pfeldman@chromium.org> 2 67 -
trunk/WebCore/dom/Document.cpp
r46301 r46418 336 336 #endif 337 337 , m_usingGeolocation(false) 338 #if ENABLE(WML) 339 , m_containsWMLContent(false) 340 #endif 338 341 { 339 342 m_document.resetSkippingRef(this); -
trunk/WebCore/dom/Document.h
r46136 r46418 1035 1035 1036 1036 #if ENABLE(WML) 1037 void setContainsWMLContent(bool value) { m_containsWMLContent = value; } 1038 bool containsWMLContent() const { return m_containsWMLContent; } 1039 1037 1040 void resetWMLPageState(); 1038 1041 void initializeWMLPageState(); … … 1117 1120 1118 1121 bool m_usingGeolocation; 1122 1123 #if ENABLE(WML) 1124 bool m_containsWMLContent; 1125 #endif 1119 1126 }; 1120 1127 -
trunk/WebCore/history/BackForwardList.cpp
r39432 r46418 267 267 268 268 #if ENABLE(WML) 269 void BackForwardList::clearWmlPageHistory() 270 { 271 PassRefPtr<HistoryItem> cur = currentItem(); 272 273 for (unsigned i = 0; i < m_entries.size(); ++i) 269 void BackForwardList::clearWMLPageHistory() 270 { 271 int size = m_entries.size(); 272 for (int i = 0; i < size; ++i) 274 273 pageCache()->remove(m_entries[i].get()); 275 274 -
trunk/WebCore/history/BackForwardList.h
r39989 r46418 98 98 99 99 #if ENABLE(WML) 100 void clearW mlPageHistory();100 void clearWMLPageHistory(); 101 101 #endif 102 102 -
trunk/WebCore/loader/FrameLoader.cpp
r46298 r46418 272 272 , m_didDispatchDidCommitLoad(false) 273 273 #endif 274 #if ENABLE(WML)275 , m_forceReloadWmlDeck(false)276 #endif277 274 { 278 275 } … … 1784 1781 } 1785 1782 1783 #if ENABLE(WML) 1784 static inline bool frameContainsWMLContent(Frame* frame) 1785 { 1786 Document* document = frame ? frame->document() : 0; 1787 if (!document) 1788 return false; 1789 1790 return document->containsWMLContent() || document->isWMLDocument(); 1791 } 1792 #endif 1793 1786 1794 bool FrameLoader::canCachePageContainingThisFrame() 1787 1795 { … … 1811 1819 && !m_documentLoader->applicationCache() 1812 1820 && !m_documentLoader->candidateApplicationCacheGroup() 1821 #endif 1822 #if ENABLE(WML) 1823 && !frameContainsWMLContent(m_frame) 1813 1824 #endif 1814 1825 && m_client->canCachePage() … … 2964 2975 } 2965 2976 2977 bool FrameLoader::shouldReload(const KURL& currentURL, const KURL& destinationURL) 2978 { 2966 2979 #if ENABLE(WML) 2967 void FrameLoader::setForceReloadWmlDeck(bool reload) 2968 { 2969 m_forceReloadWmlDeck = reload; 2970 } 2971 #endif 2972 2973 bool FrameLoader::shouldReload(const KURL& currentURL, const KURL& destinationURL) 2974 { 2975 #if ENABLE(WML) 2976 // As for WML deck, sometimes it's supposed to be reloaded even if the same URL with fragment 2977 if (m_forceReloadWmlDeck) 2980 // All WML decks are supposed to be reloaded, even within the same URL fragment 2981 if (frameContainsWMLContent(m_frame)) 2978 2982 return true; 2979 2983 #endif … … 4430 4434 4431 4435 #if ENABLE(WML) 4432 if (m_frame->document()->isWMLDocument()) 4436 // All WML decks should go through the real load mechanism, not the scroll-to-anchor code 4437 if (frameContainsWMLContent(m_frame)) 4433 4438 shouldScroll = false; 4434 4439 #endif -
trunk/WebCore/loader/FrameLoader.h
r45891 r46418 1 1 /* 2 2 * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. 3 * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)3 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/) 4 4 * 5 5 * Redistribution and use in source and binary forms, with or without … … 237 237 void didFirstVisuallyNonEmptyLayout(); 238 238 239 #if ENABLE(WML)240 void setForceReloadWmlDeck(bool);241 #endif242 243 239 void loadedResourceFromMemoryCache(const CachedResource*); 244 240 void tellClientAboutPastMemoryCacheLoads(); … … 626 622 bool m_didDispatchDidCommitLoad; 627 623 #endif 628 629 #if ENABLE(WML)630 bool m_forceReloadWmlDeck;631 #endif632 624 }; 633 625 -
trunk/WebCore/wml/WMLCardElement.cpp
r45342 r46418 29 29 #include "MappedAttribute.h" 30 30 #include "NodeList.h" 31 #include "Page.h" 31 32 #include "RenderStyle.h" 32 33 #include "WMLDocument.h" … … 132 133 if (!loader) 133 134 return; 134 135 int currentHistoryLength = loader->getHistoryLength();136 int lastHistoryLength = pageState->historyLength();137 135 138 136 // Calculate the entry method of current card 139 137 WMLIntrinsicEventType eventType = WMLIntrinsicEventUnknown; 140 if (lastHistoryLength > currentHistoryLength) 138 139 switch (loader->loadType()) { 140 case FrameLoadTypeReload: 141 break; 142 case FrameLoadTypeBack: 141 143 eventType = WMLIntrinsicEventOnEnterBackward; 142 else if (lastHistoryLength < currentHistoryLength) 144 break; 145 default: 143 146 eventType = WMLIntrinsicEventOnEnterForward; 144 145 // Synchronize history length with WMLPageState 146 pageState->setHistoryLength(currentHistoryLength); 147 147 break; 148 } 149 148 150 // Figure out target event handler 149 151 WMLIntrinsicEventHandler* eventHandler = this->eventHandler(); … … 242 244 { 243 245 WMLElement::insertedIntoDocument(); 246 Document* document = this->document(); 244 247 245 248 // The first card inserted into a document, is visible by default. 246 249 if (!m_isVisible) { 247 RefPtr<NodeList> nodeList = document ()->getElementsByTagName("card");250 RefPtr<NodeList> nodeList = document->getElementsByTagName("card"); 248 251 if (nodeList && nodeList->length() == 1 && nodeList->item(0) == this) 249 252 m_isVisible = true; 253 } 254 255 // For the WML layout tests we embed WML content in a XHTML document. Navigating to different cards 256 // within the same deck has a different behaviour in HTML than in WML. HTML wants to "scroll to anchor" 257 // (see FrameLoader) but WML wants a reload. Notify the root document of the layout test that we want 258 // to mimic WML behaviour. This is rather tricky, but has been tested extensively. Usually it's not possible 259 // at all to embed WML in HTML, it's not designed that way, we're just "abusing" it for dynamically created layout tests. 260 if (document->page() && document->page()->mainFrame()) { 261 Document* rootDocument = document->page()->mainFrame()->document(); 262 if (rootDocument && rootDocument != document) 263 rootDocument->setContainsWMLContent(true); 250 264 } 251 265 } -
trunk/WebCore/wml/WMLGoElement.cpp
r43310 r46418 1 1 /** 2 * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)2 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/) 3 3 * 4 4 * This library is free software; you can redistribute it and/or … … 103 103 bool inSameDeck = doc->url().path() == url.path(); 104 104 if (inSameDeck && url.hasRef()) { 105 // Force frame loader to load the URL with fragment identifier106 loader->setForceReloadWmlDeck(true);107 108 105 if (WMLCardElement* card = WMLCardElement::findNamedCardInDocument(doc, url.ref())) { 109 106 if (card->isNewContext()) -
trunk/WebCore/wml/WMLPageState.cpp
r45444 r46418 1 1 /* 2 * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/) 3 * 2 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/) 4 3 * Copyright (C) 2004-2007 Apple Inc. All rights reserved. 5 4 * … … 26 25 #include "WMLPageState.h" 27 26 27 #include "CString.h" 28 28 #include "HistoryItem.h" 29 29 #include "KURL.h" … … 34 34 WMLPageState::WMLPageState(Page* page) 35 35 : m_page(page) 36 , m_historyLength(0)37 36 , m_activeCard(0) 38 37 , m_hasDeckAccess(false) … … 45 44 } 46 45 46 #ifndef NDEBUG 47 // Debugging helper for use within gdb 48 void WMLPageState::dump() 49 { 50 WMLVariableMap::iterator it = m_variables.begin(); 51 WMLVariableMap::iterator end = m_variables.end(); 52 53 fprintf(stderr, "Dumping WMLPageState (this=%p) associated with Page (page=%p)...\n", this, m_page); 54 for (; it != end; ++it) 55 fprintf(stderr, "\t-> name: '%s'\tvalue: '%s'\n", (*it).first.latin1().data(), (*it).second.latin1().data()); 56 } 57 #endif 58 47 59 void WMLPageState::reset() 48 60 { 49 // remove all the variables in the current browser context61 // Remove all the variables 50 62 m_variables.clear(); 51 63 52 // clear the navigation history state 53 if (m_page) 54 m_page->backForwardList()->clearWmlPageHistory(); 55 56 // reset implementation-specfic state if UA has 57 m_historyLength = 0; 64 // Clear the navigation history state 65 if (BackForwardList* list = m_page ? m_page->backForwardList() : 0) 66 list->clearWMLPageHistory(); 58 67 } 59 68 -
trunk/WebCore/wml/WMLPageState.h
r39432 r46418 40 40 virtual ~WMLPageState(); 41 41 42 #ifndef NDEBUG 43 void dump(); 44 #endif 45 42 46 // reset the browser context when 'newcontext' attribute 43 47 // of card element is performed as part of go task
Note: See TracChangeset
for help on using the changeset viewer.