summaryrefslogtreecommitdiff
path: root/Source/WebCore/dom/WebKitNamedFlow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebCore/dom/WebKitNamedFlow.cpp')
-rw-r--r--Source/WebCore/dom/WebKitNamedFlow.cpp65
1 files changed, 64 insertions, 1 deletions
diff --git a/Source/WebCore/dom/WebKitNamedFlow.cpp b/Source/WebCore/dom/WebKitNamedFlow.cpp
index 7a07fba17..aa5901b67 100644
--- a/Source/WebCore/dom/WebKitNamedFlow.cpp
+++ b/Source/WebCore/dom/WebKitNamedFlow.cpp
@@ -30,9 +30,12 @@
#include "config.h"
#include "WebKitNamedFlow.h"
+#include "EventNames.h"
#include "RenderNamedFlowThread.h"
#include "RenderRegion.h"
+#include "ScriptExecutionContext.h"
#include "StaticNodeList.h"
+#include "UIEvent.h"
#include "WebKitNamedFlowCollection.h"
namespace WebCore {
@@ -114,7 +117,8 @@ PassRefPtr<NodeList> WebKitNamedFlow::getRegionsByContent(Node* contentNode)
const RenderRegionList& regionList = m_parentFlowThread->renderRegionList();
for (RenderRegionList::const_iterator iter = regionList.begin(); iter != regionList.end(); ++iter) {
const RenderRegion* renderRegion = *iter;
- if (!renderRegion->isValid())
+ // FIXME: Pseudo-elements are not included in the list
+ if (!renderRegion->isValid() || !renderRegion->node())
continue;
if (m_parentFlowThread->objectInFlowRegion(contentNode->renderer(), renderRegion))
regionNodes.append(renderRegion->node());
@@ -124,6 +128,30 @@ PassRefPtr<NodeList> WebKitNamedFlow::getRegionsByContent(Node* contentNode)
return StaticNodeList::adopt(regionNodes);
}
+PassRefPtr<NodeList> WebKitNamedFlow::getRegions()
+{
+ Vector<RefPtr<Node> > regionNodes;
+
+ if (m_flowManager->document())
+ m_flowManager->document()->updateLayoutIgnorePendingStylesheets();
+
+ // The renderer may be destroyed or created after the style update.
+ // Because this is called from JS, where the wrapper keeps a reference to the NamedFlow, no guard is necessary.
+ if (!m_parentFlowThread)
+ return StaticNodeList::adopt(regionNodes);
+
+ const RenderRegionList& regionList = m_parentFlowThread->renderRegionList();
+ for (RenderRegionList::const_iterator iter = regionList.begin(); iter != regionList.end(); ++iter) {
+ const RenderRegion* renderRegion = *iter;
+ // FIXME: Pseudo-elements are not included in the list
+ if (!renderRegion->isValid() || !renderRegion->node())
+ continue;
+ regionNodes.append(renderRegion->node());
+ }
+
+ return StaticNodeList::adopt(regionNodes);
+}
+
PassRefPtr<NodeList> WebKitNamedFlow::getContent()
{
Vector<RefPtr<Node> > contentNodes;
@@ -155,5 +183,40 @@ void WebKitNamedFlow::setRenderer(RenderNamedFlowThread* parentFlowThread)
m_parentFlowThread = parentFlowThread;
}
+EventTargetData* WebKitNamedFlow::eventTargetData()
+{
+ return &m_eventTargetData;
+}
+
+EventTargetData* WebKitNamedFlow::ensureEventTargetData()
+{
+ return &m_eventTargetData;
+}
+
+void WebKitNamedFlow::dispatchRegionLayoutUpdateEvent()
+{
+ ASSERT(!eventDispatchForbidden());
+ ASSERT(m_parentFlowThread);
+
+ RefPtr<Event> event = UIEvent::create(eventNames().webkitRegionLayoutUpdateEvent, false, false, m_parentFlowThread->document()->defaultView(), 0);
+
+ dispatchEvent(event);
+}
+
+const AtomicString& WebKitNamedFlow::interfaceName() const
+{
+ return eventNames().interfaceForWebKitNamedFlow;
+}
+
+ScriptExecutionContext* WebKitNamedFlow::scriptExecutionContext() const
+{
+ return m_flowManager->document();
+}
+
+Node* WebKitNamedFlow::base() const
+{
+ return m_flowManager->document();
+}
+
} // namespace WebCore