Clean up FrameTree::traverseNext() traversals of main frames
authorzandobersek@gmail.com <zandobersek@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 12 Jan 2015 20:22:53 +0000 (20:22 +0000)
committerzandobersek@gmail.com <zandobersek@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 12 Jan 2015 20:22:53 +0000 (20:22 +0000)
https://bugs.webkit.org/show_bug.cgi?id=140338

Reviewed by Andreas Kling.

There's no reason to pass the main frame as the stayWithin parameter
to FrameTree::traverseNext() when traversing over that same main frame.

Source/WebCore:

* inspector/InspectorApplicationCacheAgent.cpp:
(WebCore::InspectorApplicationCacheAgent::getFramesWithManifests):
* inspector/InspectorPageAgent.cpp:
(WebCore::InspectorPageAgent::getCookies):
(WebCore::InspectorPageAgent::deleteCookie):
(WebCore::InspectorPageAgent::searchInResources):
* replay/SerializationMethods.cpp:
(WebCore::frameIndexFromFrame):
(WebCore::frameFromFrameIndex):

Source/WebKit2:

* WebProcess/WebCoreSupport/mac/WebContextMenuClientMac.mm:
(WebKit::WebContextMenuClient::searchWithSpotlight):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@178291 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/inspector/InspectorApplicationCacheAgent.cpp
Source/WebCore/inspector/InspectorPageAgent.cpp
Source/WebCore/replay/SerializationMethods.cpp
Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/WebCoreSupport/mac/WebContextMenuClientMac.mm

index cb9c279..7f98b62 100644 (file)
@@ -1,3 +1,23 @@
+2015-01-12  Zan Dobersek  <zdobersek@igalia.com>
+
+        Clean up FrameTree::traverseNext() traversals of main frames
+        https://bugs.webkit.org/show_bug.cgi?id=140338
+
+        Reviewed by Andreas Kling.
+
+        There's no reason to pass the main frame as the stayWithin parameter
+        to FrameTree::traverseNext() when traversing over that same main frame.
+
+        * inspector/InspectorApplicationCacheAgent.cpp:
+        (WebCore::InspectorApplicationCacheAgent::getFramesWithManifests):
+        * inspector/InspectorPageAgent.cpp:
+        (WebCore::InspectorPageAgent::getCookies):
+        (WebCore::InspectorPageAgent::deleteCookie):
+        (WebCore::InspectorPageAgent::searchInResources):
+        * replay/SerializationMethods.cpp:
+        (WebCore::frameIndexFromFrame):
+        (WebCore::frameFromFrameIndex):
+
 2015-01-12  Timothy Horton  <timothy_horton@apple.com>
 
         Multi-rect TextIndicators are vertically flipped in WebKit1
index 47d83b9..ccaf608 100644 (file)
@@ -98,8 +98,7 @@ void InspectorApplicationCacheAgent::getFramesWithManifests(ErrorString&, RefPtr
 {
     result = Inspector::Protocol::Array<Inspector::Protocol::ApplicationCache::FrameWithManifest>::create();
 
-    Frame* mainFrame = m_pageAgent->mainFrame();
-    for (Frame* frame = mainFrame; frame; frame = frame->tree().traverseNext(mainFrame)) {
+    for (Frame* frame = m_pageAgent->mainFrame(); frame; frame = frame->tree().traverseNext()) {
         DocumentLoader* documentLoader = frame->loader().documentLoader();
         if (!documentLoader)
             continue;
index 10def73..4bd3043 100644 (file)
@@ -501,7 +501,7 @@ void InspectorPageAgent::getCookies(ErrorString&, RefPtr<Inspector::Protocol::Ar
     // always return the same true/false value.
     bool rawCookiesImplemented = false;
 
-    for (Frame* frame = mainFrame(); frame; frame = frame->tree().traverseNext(mainFrame())) {
+    for (Frame* frame = mainFrame(); frame; frame = frame->tree().traverseNext()) {
         Document* document = frame->document();
 
         for (auto& url : allResourcesURLsForFrame(frame)) {
@@ -533,7 +533,7 @@ void InspectorPageAgent::getCookies(ErrorString&, RefPtr<Inspector::Protocol::Ar
 void InspectorPageAgent::deleteCookie(ErrorString&, const String& cookieName, const String& url)
 {
     URL parsedURL(ParsedURLString, url);
-    for (Frame* frame = &m_page->mainFrame(); frame; frame = frame->tree().traverseNext(&m_page->mainFrame()))
+    for (Frame* frame = &m_page->mainFrame(); frame; frame = frame->tree().traverseNext())
         WebCore::deleteCookie(frame->document(), parsedURL, cookieName);
 }
 
@@ -615,7 +615,7 @@ void InspectorPageAgent::searchInResources(ErrorString&, const String& text, con
     bool caseSensitive = optionalCaseSensitive ? *optionalCaseSensitive : false;
     JSC::Yarr::RegularExpression regex = ContentSearchUtilities::createSearchRegex(text, caseSensitive, isRegex);
 
-    for (Frame* frame = &m_page->mainFrame(); frame; frame = frame->tree().traverseNext(&m_page->mainFrame())) {
+    for (Frame* frame = &m_page->mainFrame(); frame; frame = frame->tree().traverseNext()) {
         String content;
 
         for (auto* cachedResource : cachedResourcesForFrame(frame)) {
index 6a2e473..c932580 100644 (file)
@@ -82,8 +82,7 @@ uint32_t frameIndexFromFrame(const Frame* targetFrame)
     ASSERT(targetFrame);
 
     uint32_t currentIndex = 0;
-    const Frame* mainFrame = &targetFrame->tree().top();
-    for (const Frame* frame = mainFrame; frame; ++currentIndex, frame = frame->tree().traverseNext(mainFrame)) {
+    for (const Frame* frame = &targetFrame->tree().top(); frame; ++currentIndex, frame = frame->tree().traverseNext()) {
         if (frame == targetFrame)
             return currentIndex;
     }
@@ -103,10 +102,9 @@ Frame* frameFromFrameIndex(Page* page, uint32_t frameIndex)
     ASSERT(page);
     ASSERT(frameIndex >= 0);
 
-    MainFrame* mainFrame = &page->mainFrame();
-    Frame* frame = mainFrame;
+    Frame* frame = &page->mainFrame();
     uint32_t currentIndex = 0;
-    for (; currentIndex < frameIndex && frame; ++currentIndex, frame = frame->tree().traverseNext(mainFrame)) { }
+    for (; currentIndex < frameIndex && frame; ++currentIndex, frame = frame->tree().traverseNext()) { }
 
     return frame;
 }
index 858d444..d670f9c 100644 (file)
@@ -1,3 +1,16 @@
+2015-01-12  Zan Dobersek  <zdobersek@igalia.com>
+
+        Clean up FrameTree::traverseNext() traversals of main frames
+        https://bugs.webkit.org/show_bug.cgi?id=140338
+
+        Reviewed by Andreas Kling.
+
+        There's no reason to pass the main frame as the stayWithin parameter
+        to FrameTree::traverseNext() when traversing over that same main frame.
+
+        * WebProcess/WebCoreSupport/mac/WebContextMenuClientMac.mm:
+        (WebKit::WebContextMenuClient::searchWithSpotlight):
+
 2015-01-12  Timothy Horton  <timothy_horton@apple.com>
 
         Multi-rect TextIndicators are vertically flipped in WebKit1
index 4ed5e25..8c52f44 100644 (file)
@@ -79,7 +79,7 @@ void WebContextMenuClient::searchWithSpotlight()
     Frame& mainFrame = m_page->corePage()->mainFrame();
     
     Frame* selectionFrame = &mainFrame;
-    for (; selectionFrame; selectionFrame = selectionFrame->tree().traverseNext(&mainFrame)) {
+    for (; selectionFrame; selectionFrame = selectionFrame->tree().traverseNext()) {
         if (selectionFrame->selection().isRange())
             break;
     }