#import "WKDOMNode.h"
#import "WKDOMRange.h"
#import <WebCore/Node.h>
#import <WebCore/Range.h>
#import <wtf/HashMap.h>
#if WK_API_ENABLED
namespace WebCore {
class Element;
class Document;
}
@class WKDOMElement;
@class WKDOMDocument;
@class WKDOMText;
@interface WKDOMNode () {
@public
RefPtr<WebCore::Node> _impl;
}
- (id)_initWithImpl:(WebCore::Node*)impl;
@end
@interface WKDOMRange () {
@public
RefPtr<WebCore::Range> _impl;
}
- (id)_initWithImpl:(WebCore::Range*)impl;
@end
namespace WebKit {
template<typename WebCoreType, typename WKDOMType>
class DOMCache {
public:
DOMCache()
{
}
void add(WebCoreType core, WKDOMType kit)
{
m_map.add(core, kit);
}
WKDOMType get(WebCoreType core)
{
return m_map.get(core);
}
void remove(WebCoreType core)
{
m_map.remove(core);
}
private:
~DOMCache() = delete;
HashMap<WebCoreType, WKDOMType> m_map;
};
DOMCache<WebCore::Node*, WKDOMNode *>& WKDOMNodeCache();
DOMCache<WebCore::Range*, WKDOMRange *>& WKDOMRangeCache();
WebCore::Node* toWebCoreNode(WKDOMNode *);
WKDOMNode *toWKDOMNode(WebCore::Node*);
WebCore::Element* toWebCoreElement(WKDOMElement *);
WKDOMElement *toWKDOMElement(WebCore::Element*);
WebCore::Document* toWebCoreDocument(WKDOMDocument *);
WKDOMDocument *toWKDOMDocument(WebCore::Document*);
WebCore::Text* toWebCoreText(WKDOMText *);
WKDOMText *toWKDOMText(WebCore::Text*);
WebCore::Range* toWebCoreRange(WKDOMRange *);
WKDOMRange *toWKDOMRange(WebCore::Range*);
NSArray *toNSArray(const Vector<WebCore::IntRect>&);
}
#endif // WK_API_ENABLED