Title: [154560] trunk/Source/WebCore
Revision
154560
Author
[email protected]
Date
2013-08-24 20:41:04 -0700 (Sat, 24 Aug 2013)

Log Message

Move Frame::inScope into FrameTree
https://bugs.webkit.org/show_bug.cgi?id=120257

Reviewed by Sam Weinig.

* page/Frame.cpp: Removed inScope.
* page/Frame.h: Ditto.

* page/FrameTree.cpp:
(WebCore::inScope): Moved it here.
(WebCore::FrameTree::scopedChild): Changed to call new function.
(WebCore::FrameTree::scopedChildCount): Ditto.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (154559 => 154560)


--- trunk/Source/WebCore/ChangeLog	2013-08-25 03:08:24 UTC (rev 154559)
+++ trunk/Source/WebCore/ChangeLog	2013-08-25 03:41:04 UTC (rev 154560)
@@ -1,3 +1,18 @@
+2013-08-24  Darin Adler  <[email protected]>
+
+        Move Frame::inScope into FrameTree
+        https://bugs.webkit.org/show_bug.cgi?id=120257
+
+        Reviewed by Sam Weinig.
+
+        * page/Frame.cpp: Removed inScope.
+        * page/Frame.h: Ditto.
+
+        * page/FrameTree.cpp:
+        (WebCore::inScope): Moved it here.
+        (WebCore::FrameTree::scopedChild): Changed to call new function.
+        (WebCore::FrameTree::scopedChildCount): Ditto.
+
 2013-08-24  David Kilzer  <[email protected]>
 
         BUILD FIX: Include HTMLPlugInImageElement.h for ENABLE(PLUGIN_PROXY_FOR_VIDEO)

Modified: trunk/Source/WebCore/page/Frame.cpp (154559 => 154560)


--- trunk/Source/WebCore/page/Frame.cpp	2013-08-25 03:08:24 UTC (rev 154559)
+++ trunk/Source/WebCore/page/Frame.cpp	2013-08-25 03:41:04 UTC (rev 154560)
@@ -228,18 +228,6 @@
         (*it)->frameDestroyed();
 }
 
-bool Frame::inScope(TreeScope* scope) const
-{
-    ASSERT(scope);
-    Document* doc = document();
-    if (!doc)
-        return false;
-    HTMLFrameOwnerElement* owner = doc->ownerElement();
-    if (!owner)
-        return false;
-    return owner->treeScope() == scope;
-}
-
 void Frame::addDestructionObserver(FrameDestructionObserver* observer)
 {
     m_destructionObservers.add(observer);

Modified: trunk/Source/WebCore/page/Frame.h (154559 => 154560)


--- trunk/Source/WebCore/page/Frame.h	2013-08-25 03:08:24 UTC (rev 154559)
+++ trunk/Source/WebCore/page/Frame.h	2013-08-25 03:41:04 UTC (rev 154560)
@@ -71,14 +71,12 @@
     class ScriptController;
     class Settings;
     class TiledBackingStore;
-    class TreeScope;
     class VisiblePosition;
 
 #if !USE(TILED_BACKING_STORE)
     class TiledBackingStoreClient { };
 #endif
 
-
     enum {
         LayerTreeFlagsIncludeDebugInfo = 1 << 0,
         LayerTreeFlagsIncludeVisibleRects = 1 << 1,
@@ -132,8 +130,6 @@
 
     // ======== All public functions below this point are candidates to move out of Frame into another class. ========
 
-        bool inScope(TreeScope*) const;
-
         void injectUserScripts(UserScriptInjectionTime);
         
         String layerTreeAsText(LayerTreeFlags = 0) const;

Modified: trunk/Source/WebCore/page/FrameTree.cpp (154559 => 154560)


--- trunk/Source/WebCore/page/FrameTree.cpp	2013-08-25 03:08:24 UTC (rev 154559)
+++ trunk/Source/WebCore/page/FrameTree.cpp	2013-08-25 03:41:04 UTC (rev 154560)
@@ -1,6 +1,6 @@
 /*
+ * Copyright (C) 2006, 2013 Apple Inc. All rights reserved.
  * Copyright (C) Research In Motion Limited 2010. All rights reserved.
- * Copyright (C) 2006 Apple Computer, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Library General Public
@@ -21,11 +21,12 @@
 #include "config.h"
 #include "FrameTree.h"
 
+#include "Document.h"
 #include "Frame.h"
 #include "FrameView.h"
+#include "HTMLFrameOwnerElement.h"
 #include "Page.h"
 #include "PageGroup.h"
-#include "Document.h"
 #include <stdarg.h>
 #include <wtf/StringExtras.h>
 #include <wtf/Vector.h>
@@ -170,6 +171,17 @@
     return name.toAtomicString();
 }
 
+static bool inScope(Frame& frame, TreeScope& scope)
+{
+    Document* document = frame.document();
+    if (!document)
+        return false;
+    HTMLFrameOwnerElement* owner = document->ownerElement();
+    if (!owner)
+        return false;
+    return owner->treeScope() == &scope;
+}
+
 inline Frame* FrameTree::scopedChild(unsigned index, TreeScope* scope) const
 {
     if (!scope)
@@ -177,7 +189,7 @@
 
     unsigned scopedIndex = 0;
     for (Frame* result = firstChild(); result; result = result->tree().nextSibling()) {
-        if (result->inScope(scope)) {
+        if (inScope(*result, *scope)) {
             if (scopedIndex == index)
                 return result;
             scopedIndex++;
@@ -192,9 +204,10 @@
     if (!scope)
         return 0;
 
-    for (Frame* child = firstChild(); child; child = child->tree().nextSibling())
-        if (child->tree().uniqueName() == name && child->inScope(scope))
+    for (Frame* child = firstChild(); child; child = child->tree().nextSibling()) {
+        if (child->tree()->uniqueName() == name && inScope(*child, *scope))
             return child;
+    }
     return 0;
 }
 
@@ -205,7 +218,7 @@
 
     unsigned scopedCount = 0;
     for (Frame* result = firstChild(); result; result = result->tree().nextSibling()) {
-        if (result->inScope(scope))
+        if (inScope(*result, *scope))
             scopedCount++;
     }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to