#include "config.h"
#include "core/dom/Node.h"
+#include "bindings/core/v8/DOMDataStore.h"
#include "bindings/core/v8/ExceptionState.h"
#include "bindings/core/v8/ScriptCallStackFactory.h"
+#include "bindings/core/v8/V8DOMWrapper.h"
#include "core/HTMLNames.h"
#include "core/XMLNames.h"
#include "core/accessibility/AXObjectCache.h"
#include "core/events/WheelEvent.h"
#include "core/frame/EventHandlerRegistry.h"
#include "core/frame/LocalFrame.h"
+#include "core/frame/Settings.h"
#include "core/html/HTMLAnchorElement.h"
#include "core/html/HTMLDialogElement.h"
#include "core/html/HTMLFrameOwnerElement.h"
#include "core/page/ContextMenuController.h"
#include "core/page/EventHandler.h"
#include "core/page/Page.h"
-#include "core/frame/Settings.h"
#include "core/rendering/FlowThreadController.h"
#include "core/rendering/RenderBox.h"
#include "core/svg/graphics/SVGImage.h"
, m_next(nullptr)
{
ASSERT(m_treeScope || type == CreateDocument || type == CreateShadowRoot);
- ScriptWrappable::init(this);
#if !ENABLE(OILPAN)
if (m_treeScope)
m_treeScope->guardRef();
void Node::normalize()
{
+ document().updateDistributionForNodeIfNeeded(this);
+
// Go through the subtree beneath us, normalizing all nodes. This means that
// any two adjacent text nodes are merged and any empty text nodes are removed.
if (editableLevel == RichlyEditable)
return false;
- ASSERT(AXObjectCache::accessibilityEnabled());
+ ASSERT(document().settings() && document().settings()->accessibilityEnabled());
ASSERT(document().existingAXObjectCache());
if (AXObjectCache* cache = document().existingAXObjectCache())
DOCUMENT_POSITION_PRECEDING | DOCUMENT_POSITION_CONTAINS | connection;
}
-FloatPoint Node::convertToPage(const FloatPoint& p) const
-{
- // If there is a renderer, just ask it to do the conversion
- if (renderer())
- return renderer()->localToAbsolute(p, UseTransforms);
-
- // Otherwise go up the tree looking for a renderer
- if (Element* parent = parentElement())
- return parent->convertToPage(p);
-
- // No parent - no conversion needed
- return p;
-}
-
-FloatPoint Node::convertFromPage(const FloatPoint& p) const
-{
- // If there is a renderer, just ask it to do the conversion
- if (renderer())
- return renderer()->absoluteToLocal(p, UseTransforms);
-
- // Otherwise go up the tree looking for a renderer
- if (Element* parent = parentElement())
- return parent->convertFromPage(p);
-
- // No parent - no conversion needed
- return p;
-}
-
String Node::debugName() const
{
StringBuilder name;
return;
stringBuilder.append(attrDesc);
- stringBuilder.append("=\"");
+ stringBuilder.appendLiteral("=\"");
stringBuilder.append(attr);
- stringBuilder.append("\"");
+ stringBuilder.appendLiteral("\"");
}
void Node::showNode(const char* prefix) const
}
}
- if (AXObjectCache::accessibilityEnabled()) {
+ Settings* settings = document().settings();
+ if (settings && settings->accessibilityEnabled()) {
if (AXObjectCache* cache = oldDocument.existingAXObjectCache())
cache->remove(this);
}
return 0;
}
+v8::Handle<v8::Object> Node::wrap(v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
+{
+ // It's possible that no one except for the new wrapper owns this object at
+ // this moment, so we have to prevent GC to collect this object until the
+ // object gets associated with the wrapper.
+ RefPtrWillBeRawPtr<Node> protect(this);
+
+ ASSERT(!DOMDataStore::containsWrapperNonTemplate(this, isolate));
+
+ const WrapperTypeInfo* wrapperType = wrapperTypeInfo();
+
+ v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext, wrapperType, toScriptWrappableBase(), isolate);
+ if (UNLIKELY(wrapper.IsEmpty()))
+ return wrapper;
+
+ wrapperType->installConditionallyEnabledProperties(wrapper, isolate);
+ return associateWithWrapper(wrapperType, wrapper, isolate);
+}
+
+v8::Handle<v8::Object> Node::associateWithWrapper(const WrapperTypeInfo* wrapperType, v8::Handle<v8::Object> wrapper, v8::Isolate* isolate)
+{
+ return V8DOMWrapper::associateObjectWithWrapperNonTemplate(this, wrapperType, wrapper, isolate);
+}
+
} // namespace blink
#ifndef NDEBUG