Title: [89205] trunk/Source/WebCore
- Revision
- 89205
- Author
- jer.no...@apple.com
- Date
- 2011-06-18 13:34:57 -0700 (Sat, 18 Jun 2011)
Log Message
2011-06-18 Jer Noble <jer.no...@apple.com>
Reviewed by Darin Adler.
Rename Document::setContainsFullScreenElementRecursively
https://bugs.webkit.org/show_bug.cgi?id=62528
No new tests; no net change in functionality, so this is covered by existing tests.
The name of setContainsFullScreenElementRecursively is confusing, since it doesn't actually use
recursion, and it walks the ancestor tree instead of the descendent tree (as recursive might
otherwise imply). Move the function into Element, turn it into a member function, and change
the behavior so that the function operates on the called object's parents (as opposed to the
object itself).
* dom/Element.h:
* dom/Element.cpp:
(WebCore::parentCrossingFrameBoundaries): Added.
(WebCore::Element::setContainsFullScreenElementOnAncestorsCrossingFrameBoundaries): Renamed and
moved from Document.
(WebCore::Element::willRemove): Use the newly renamed function.
(WebCore::Element::insertedIntoTree): Ditto.
* dom/Document.h:
* dom/Document.cpp:
(WebCore::Document::webkitWillEnterFullScreenForElement): Ditto.
(WebCore::Document::webkitWillExitFullScreenForElement): Ditto.
(WebCore::Document::fullScreenElementRemoved): Ditto.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (89204 => 89205)
--- trunk/Source/WebCore/ChangeLog 2011-06-18 20:27:31 UTC (rev 89204)
+++ trunk/Source/WebCore/ChangeLog 2011-06-18 20:34:57 UTC (rev 89205)
@@ -1,3 +1,31 @@
+2011-06-18 Jer Noble <jer.no...@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Rename Document::setContainsFullScreenElementRecursively
+ https://bugs.webkit.org/show_bug.cgi?id=62528
+
+ No new tests; no net change in functionality, so this is covered by existing tests.
+
+ The name of setContainsFullScreenElementRecursively is confusing, since it doesn't actually use
+ recursion, and it walks the ancestor tree instead of the descendent tree (as recursive might
+ otherwise imply). Move the function into Element, turn it into a member function, and change
+ the behavior so that the function operates on the called object's parents (as opposed to the
+ object itself).
+
+ * dom/Element.h:
+ * dom/Element.cpp:
+ (WebCore::parentCrossingFrameBoundaries): Added.
+ (WebCore::Element::setContainsFullScreenElementOnAncestorsCrossingFrameBoundaries): Renamed and
+ moved from Document.
+ (WebCore::Element::willRemove): Use the newly renamed function.
+ (WebCore::Element::insertedIntoTree): Ditto.
+ * dom/Document.h:
+ * dom/Document.cpp:
+ (WebCore::Document::webkitWillEnterFullScreenForElement): Ditto.
+ (WebCore::Document::webkitWillExitFullScreenForElement): Ditto.
+ (WebCore::Document::fullScreenElementRemoved): Ditto.
+
2011-06-18 Alice Boxhall <aboxh...@chromium.org>
Reviewed by Chris Fleizach.
Modified: trunk/Source/WebCore/dom/Document.cpp (89204 => 89205)
--- trunk/Source/WebCore/dom/Document.cpp 2011-06-18 20:27:31 UTC (rev 89204)
+++ trunk/Source/WebCore/dom/Document.cpp 2011-06-18 20:34:57 UTC (rev 89205)
@@ -4738,14 +4738,6 @@
page()->chrome()->client()->exitFullScreenForElement(m_fullScreenElement.get());
}
-void Document::setContainsFullScreenElementRecursively(Element* element, bool contains)
-{
- while (element) {
- element->setContainsFullScreenElement(contains);
- element = (element->parentElement() ? element->parentElement() : element->document()->ownerElement());
- }
-}
-
void Document::webkitWillEnterFullScreenForElement(Element* element)
{
ASSERT(element);
@@ -4767,7 +4759,7 @@
if (m_fullScreenElement != documentElement())
m_fullScreenElement->detach();
- setContainsFullScreenElementRecursively(m_fullScreenElement->parentElement() ? m_fullScreenElement->parentElement() : ownerElement(), true);
+ m_fullScreenElement->setContainsFullScreenElementOnAncestorsCrossingFrameBoundaries(true);
recalcStyle(Force);
@@ -4798,7 +4790,7 @@
void Document::webkitWillExitFullScreenForElement(Element*)
{
- setContainsFullScreenElementRecursively(m_fullScreenElement->parentElement() ? m_fullScreenElement->parentElement() : ownerElement(), false);
+ m_fullScreenElement->setContainsFullScreenElementOnAncestorsCrossingFrameBoundaries(false);
m_fullScreenElement->willStopBeingFullscreenElement();
@@ -4908,7 +4900,7 @@
void Document::fullScreenElementRemoved()
{
- setContainsFullScreenElementRecursively(m_fullScreenElement->parentElement() ? m_fullScreenElement->parentElement() : ownerElement(), false);
+ m_fullScreenElement->setContainsFullScreenElementOnAncestorsCrossingFrameBoundaries(false);
webkitCancelFullScreen();
}
Modified: trunk/Source/WebCore/dom/Document.h (89204 => 89205)
--- trunk/Source/WebCore/dom/Document.h 2011-06-18 20:27:31 UTC (rev 89204)
+++ trunk/Source/WebCore/dom/Document.h 2011-06-18 20:34:57 UTC (rev 89205)
@@ -1056,7 +1056,6 @@
void removeFullScreenElementOfSubtree(Node*, bool amongChildrenOnly = false);
bool isAnimatingFullScreen() const;
void setAnimatingFullScreen(bool);
- static void setContainsFullScreenElementRecursively(Element*, bool);
#endif
// Used to allow element that loads data without going through a FrameLoader to delay the 'load' event.
Modified: trunk/Source/WebCore/dom/Element.cpp (89204 => 89205)
--- trunk/Source/WebCore/dom/Element.cpp 2011-06-18 20:27:31 UTC (rev 89204)
+++ trunk/Source/WebCore/dom/Element.cpp 2011-06-18 20:34:57 UTC (rev 89205)
@@ -44,6 +44,7 @@
#include "Frame.h"
#include "FrameView.h"
#include "HTMLElement.h"
+#include "HTMLFrameOwnerElement.h"
#include "HTMLNames.h"
#include "HTMLParserIdioms.h"
#include "InspectorInstrumentation.h"
@@ -944,8 +945,8 @@
void Element::willRemove()
{
#if ENABLE(FULLSCREEN_API)
- if (containsFullScreenElement() && parentElement())
- document()->setContainsFullScreenElementRecursively(parentElement(), false);
+ if (containsFullScreenElement())
+ setContainsFullScreenElementOnAncestorsCrossingFrameBoundaries(false);
#endif
ContainerNode::willRemove();
}
@@ -991,8 +992,8 @@
shadow->insertedIntoTree(true);
#if ENABLE(FULLSCREEN_API)
- if (parentElement() && containsFullScreenElement() && !parentElement()->containsFullScreenElement())
- document()->setContainsFullScreenElementRecursively(parentElement(), true);
+ if (containsFullScreenElement() && parentElement() && !parentElement()->containsFullScreenElement())
+ setContainsFullScreenElementOnAncestorsCrossingFrameBoundaries(true);
#endif
}
@@ -1920,6 +1921,19 @@
ensureRareData()->m_containsFullScreenElement = flag;
setNeedsStyleRecalc(SyntheticStyleChange);
}
+
+static Element* parentCrossingFrameBoundaries(Element* element)
+{
+ ASSERT(element);
+ return element->parentElement() ? element->parentElement() : element->document()->ownerElement();
+}
+
+void Element::setContainsFullScreenElementOnAncestorsCrossingFrameBoundaries(bool flag)
+{
+ Element* element = this;
+ while ((element = parentCrossingFrameBoundaries(element)))
+ element->setContainsFullScreenElement(flag);
+}
#endif
SpellcheckAttributeState Element::spellcheckAttributeState() const
Modified: trunk/Source/WebCore/dom/Element.h (89204 => 89205)
--- trunk/Source/WebCore/dom/Element.h 2011-06-18 20:27:31 UTC (rev 89204)
+++ trunk/Source/WebCore/dom/Element.h 2011-06-18 20:34:57 UTC (rev 89205)
@@ -357,6 +357,7 @@
void webkitRequestFullScreen(unsigned short flags);
virtual bool containsFullScreenElement() const;
virtual void setContainsFullScreenElement(bool);
+ virtual void setContainsFullScreenElementOnAncestorsCrossingFrameBoundaries(bool);
#endif
virtual bool isSpellCheckingEnabled() const;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes