Commit 3166fbf7 authored by thatcher's avatar thatcher

WebCore:

        Reviewed by Darin.
        
        http://bugzilla.opendarwin.org/show_bug.cgi?id=7450
        elementAtPoint is expensive and should return a smart dictionary

        Support for WebKit. This removes the old elementAtPoint: on the bridge.
        WebKit now uses the bridge method getInnerNonSharedNode:innerNode:URLElement:atPoint:

        * WebCore.exp: removes the WebCore* dictionary keys
        * bindings/objc/DOM.mm:
        (-[DOMElement image]): new method to get an NSImage if the element has an image renderer
        * bindings/objc/DOMHTML.mm:
        (-[DOMHTMLElement titleDisplayString]): new method that returns the title after doing the backslash as currency symbol conversion
        (-[DOMHTMLInputElement altDisplayString]): ditto for alt
        (-[DOMHTMLImageElement altDisplayString]): ditto
        (-[DOMHTMLAppletElement altDisplayString]): ditto
        (-[DOMHTMLAreaElement altDisplayString]): ditto
        (-[DOMHTMLAnchorElement absoluteLinkURL]): new method to get the absolute NSURL
        (-[DOMHTMLAreaElement absoluteLinkURL]): ditto
        (-[DOMHTMLLinkElement absoluteLinkURL]): ditto
        (-[DOMHTMLInputElement absoluteImageURL]): new method to get the absolute image location as an NSURL
        (-[DOMHTMLImageElement absoluteImageURL]): ditto
        (-[DOMHTMLObjectElement absoluteImageURL]): ditto
        * bindings/objc/DOMPrivate.h:
        * bridge/mac/WebCoreFrameBridge.h:
        * bridge/mac/WebCoreFrameBridge.mm:
        (-[WebCoreFrameBridge getInnerNonSharedNode:innerNode:URLElement:atPoint:]):
        (-[WebCoreFrameBridge isPointInsideSelection:]):
        * dom/DocumentImpl.cpp:
        (WebCore::DocumentImpl::prepareMouseEvent):
        (WebCore::DocumentImpl::backslashAsCurrencySymbol):
        * dom/DocumentImpl.h:
        * rendering/render_layer.cpp:
        (WebCore::RenderLayer::hitTest):
        * rendering/render_object.h:
        (WebCore::RenderObject::NodeInfo::URLElement):
        (WebCore::RenderObject::NodeInfo::setURLElement):

WebKit:

        Reviewed by Darin.

        http://bugzilla.opendarwin.org/show_bug.cgi?id=7450
        elementAtPoint is expensive and should return a smart dictionary
        
        elementAtPoint for WebHTMLView now returns a WebElementDictionary,
        when objectForKey is called it will lookup in the DOM, cache and return the value

        * Misc/WebElementDictionary.h: Added.
        * Misc/WebElementDictionary.m: Added.
        (addLookupKey):
        (cacheValueForKey):
        (+[WebElementDictionary initializeLookupTable]):
        (-[WebElementDictionary initWithInnerNonSharedNode:innerNode:URLElement:andPoint:]):
        (-[WebElementDictionary dealloc]):
        (-[WebElementDictionary _fillCache]):
        (-[WebElementDictionary count]):
        (-[WebElementDictionary keyEnumerator]):
        (-[WebElementDictionary objectForKey:]):
        (-[WebElementDictionary _domNode]):
        (-[WebElementDictionary _webFrame]):
        (-[WebElementDictionary _targetWebFrame]):
        (-[WebElementDictionary _title]):
        (-[WebElementDictionary _imageRect]):
        (-[WebElementDictionary _isSelected]):
        * Misc/WebNSViewExtras.m:
        (-[NSView _web_dragImage:element:rect:event:pasteboard:source:offset:]):
        * WebKit.xcodeproj/project.pbxproj:
        * WebView/WebHTMLView.m:
        (-[WebHTMLView _updateMouseoverWithEvent:]):
        (-[WebHTMLView _startDraggingImage:at:operation:event:sourceIsDHTML:DHTMLWroteData:]):
        (-[NSArray elementAtPoint:]):
        * WebView/WebView.m:
        * WebView/WebViewPrivate.h:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@13070 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent d0cf0353
2006-03-01 Timothy Hatcher <timothy@apple.com>
Reviewed by Darin.
http://bugzilla.opendarwin.org/show_bug.cgi?id=7450
elementAtPoint is expensive and should return a smart dictionary
Support for WebKit. This removes the old elementAtPoint: on the bridge.
WebKit now uses the bridge method getInnerNonSharedNode:innerNode:URLElement:atPoint:
* WebCore.exp: removes the WebCore* dictionary keys
* bindings/objc/DOM.mm:
(-[DOMElement image]): new method to get an NSImage if the element has an image renderer
* bindings/objc/DOMHTML.mm:
(-[DOMHTMLElement titleDisplayString]): new method that returns the title after doing the backslash as currency symbol conversion
(-[DOMHTMLInputElement altDisplayString]): ditto for alt
(-[DOMHTMLImageElement altDisplayString]): ditto
(-[DOMHTMLAppletElement altDisplayString]): ditto
(-[DOMHTMLAreaElement altDisplayString]): ditto
(-[DOMHTMLAnchorElement absoluteLinkURL]): new method to get the absolute NSURL
(-[DOMHTMLAreaElement absoluteLinkURL]): ditto
(-[DOMHTMLLinkElement absoluteLinkURL]): ditto
(-[DOMHTMLInputElement absoluteImageURL]): new method to get the absolute image location as an NSURL
(-[DOMHTMLImageElement absoluteImageURL]): ditto
(-[DOMHTMLObjectElement absoluteImageURL]): ditto
* bindings/objc/DOMPrivate.h:
* bridge/mac/WebCoreFrameBridge.h:
* bridge/mac/WebCoreFrameBridge.mm:
(-[WebCoreFrameBridge getInnerNonSharedNode:innerNode:URLElement:atPoint:]):
(-[WebCoreFrameBridge isPointInsideSelection:]):
* dom/DocumentImpl.cpp:
(WebCore::DocumentImpl::prepareMouseEvent):
(WebCore::DocumentImpl::backslashAsCurrencySymbol):
* dom/DocumentImpl.h:
* rendering/render_layer.cpp:
(WebCore::RenderLayer::hitTest):
* rendering/render_object.h:
(WebCore::RenderObject::NodeInfo::URLElement):
(WebCore::RenderObject::NodeInfo::setURLElement):
2006-03-01 Mitz Pettel <opendarwin.org@mitzpettel.com>
Test: fast/css/hover-subselector.html
......
......@@ -119,17 +119,6 @@
.objc_class_name_WebCoreTextRendererFactory
.objc_class_name_WebCoreViewFactory
.objc_class_name_WebDashboardRegion
_WebCoreElementDOMNodeKey
_WebCoreElementFrameKey
_WebCoreElementImageAltStringKey
_WebCoreElementImageRectKey
_WebCoreElementImageURLKey
_WebCoreElementIsSelectedKey
_WebCoreElementLinkLabelKey
_WebCoreElementLinkTargetFrameKey
_WebCoreElementLinkTitleKey
_WebCoreElementLinkURLKey
_WebCoreElementTitleKey
_WebCoreInitializeEmptyTextGeometry
_WebCoreInitializeEmptyTextStyle
_WebCoreInitializeFont
......
......@@ -1451,6 +1451,17 @@ static ListenerMap *listenerMap;
@implementation DOMElement (DOMElementExtensions)
- (NSImage*)image
{
RenderObject* renderer = [self _elementImpl]->renderer();
if (renderer && renderer->isImage()) {
RenderImage* img = static_cast<RenderImage*>(renderer);
if (img->cachedImage() && !img->cachedImage()->isErrorImage())
return img->cachedImage()->image()->getNSImage();
}
return nil;
}
- (void)focus
{
[self _elementImpl]->focus();
......@@ -1498,17 +1509,6 @@ static ListenerMap *listenerMap;
return nil;
}
- (NSImage*)_image
{
RenderObject *renderer = [self _elementImpl]->renderer();
if (renderer && renderer->isImage()) {
RenderImage* img = static_cast<RenderImage*>(renderer);
if (img->cachedImage() && !img->cachedImage()->isErrorImage())
return img->cachedImage()->image()->getNSImage();
}
return nil;
}
- (NSData*)_imageTIFFRepresentation
{
RenderObject *renderer = [self _elementImpl]->renderer();
......
......@@ -58,6 +58,7 @@
#import "DOMExtensions.h"
#import "DOMInternal.h"
#import "DOMPrivate.h"
#import "DOMHTMLInternal.h"
#import <kxmlcore/Assertions.h>
#import "FoundationExtras.h"
......@@ -259,6 +260,11 @@ using namespace DOM::HTMLNames;
return [self _HTMLElementImpl]->title();
}
- (NSString *)titleDisplayString
{
return [self _HTMLElementImpl]->title().replace('\\', [self _elementImpl]->getDocument()->backslashAsCurrencySymbol());
}
- (void)setTitle:(NSString *)title
{
[self _HTMLElementImpl]->setTitle(title);
......@@ -580,6 +586,11 @@ using namespace DOM::HTMLNames;
[self _linkElementImpl]->setCharset(charset);
}
- (NSURL *)absoluteLinkURL
{
return [self _getURLAttribute:@"href"];
}
- (NSString *)href
{
return [self _linkElementImpl]->href();
......@@ -1280,6 +1291,11 @@ using namespace DOM::HTMLNames;
return [self _inputElementImpl]->alt();
}
- (NSString *)altDisplayString
{
return [self _inputElementImpl]->alt().replace('\\', [self _elementImpl]->getDocument()->backslashAsCurrencySymbol());
}
- (void)setAlt:(NSString *)alt
{
[self _inputElementImpl]->setAlt(alt);
......@@ -1345,6 +1361,13 @@ using namespace DOM::HTMLNames;
[self _inputElementImpl]->setSize(size);
}
- (NSURL *)absoluteImageURL
{
if (![self _inputElementImpl]->renderer() || ![self _inputElementImpl]->renderer()->isImage())
return nil;
return [self _getURLAttribute:@"src"];
}
- (NSString *)src
{
return [self _inputElementImpl]->src();
......@@ -2165,6 +2188,11 @@ using namespace DOM::HTMLNames;
[self _anchorElementImpl]->setAttribute(coordsAttr, coords);
}
- (NSURL *)absoluteLinkURL
{
return [self _getURLAttribute:@"href"];
}
- (NSString *)href
{
return [self _anchorElementImpl]->href();
......@@ -2302,6 +2330,12 @@ using namespace DOM::HTMLNames;
return [self _imageElementImpl]->getAttribute(altAttr);
}
- (NSString *)altDisplayString
{
String alt = [self _imageElementImpl]->getAttribute(altAttr);
return alt.replace('\\', [self _elementImpl]->getDocument()->backslashAsCurrencySymbol());
}
- (void)setAlt:(NSString *)alt
{
[self _imageElementImpl]->setAttribute(altAttr, alt);
......@@ -2359,6 +2393,11 @@ using namespace DOM::HTMLNames;
[self _imageElementImpl]->setAttribute(longdescAttr, longDesc);
}
- (NSURL *)absoluteImageURL
{
return [self _getURLAttribute:@"src"];
}
- (NSString *)src
{
return [self _imageElementImpl]->src();
......@@ -2475,6 +2514,13 @@ using namespace DOM::HTMLNames;
[self _objectElementImpl]->setAttribute(codetypeAttr, codeType);
}
- (NSURL *)absoluteImageURL
{
if (![self _objectElementImpl]->renderer() || ![self _objectElementImpl]->renderer()->isImage())
return nil;
return [self _getURLAttribute:@"data"];
}
- (NSString *)data
{
return [self _objectElementImpl]->getAttribute(dataAttr);
......@@ -2666,6 +2712,12 @@ using namespace DOM::HTMLNames;
return [self _appletElementImpl]->getAttribute(altAttr);
}
- (NSString *)altDisplayString
{
String alt = [self _appletElementImpl]->getAttribute(altAttr);
return alt.replace('\\', [self _elementImpl]->getDocument()->backslashAsCurrencySymbol());
}
- (void)setAlt:(NSString *)alt
{
[self _appletElementImpl]->setAttribute(altAttr, alt);
......@@ -2812,6 +2864,12 @@ using namespace DOM::HTMLNames;
return [self _areaElementImpl]->getAttribute(altAttr);
}
- (NSString *)altDisplayString
{
String alt = [self _areaElementImpl]->getAttribute(altAttr);
return alt.replace('\\', [self _elementImpl]->getDocument()->backslashAsCurrencySymbol());
}
- (void)setAlt:(NSString *)alt
{
[self _areaElementImpl]->setAttribute(altAttr, alt);
......@@ -2827,6 +2885,11 @@ using namespace DOM::HTMLNames;
[self _areaElementImpl]->setAttribute(coordsAttr, coords);
}
- (NSURL *)absoluteLinkURL
{
return [self _getURLAttribute:@"href"];
}
- (NSString *)href
{
return [self _areaElementImpl]->href();
......
......@@ -39,7 +39,6 @@
@interface DOMElement (WebPrivate)
- (NSFont *)_font;
- (NSImage *)_image;
- (NSData *)_imageTIFFRepresentation;
- (NSURL *)_getURLAttribute:(NSString *)name;
@end
......@@ -76,8 +75,8 @@
- (void)_activateItemAtIndex:(int)index;
@end
// BEGIN PENDING PUBLIC WEB INSPECTOR APIS
// These APIs are for the Web Inspector, and they will be made public eventually.
// BEGIN PENDING PUBLIC APIS
// These APIs will be made public eventually.
@interface DOMAttr (DOMAttrExtensions)
- (DOMCSSStyleDeclaration *)style;
@end
......@@ -107,11 +106,43 @@
@end
@interface DOMElement (DOMElementExtensions)
- (NSImage *)image;
- (void)focus;
- (void)blur;
- (void)scrollIntoView:(BOOL)alignTop;
- (void)scrollIntoViewIfNeeded:(BOOL)centerIfNeeded;
@end
@interface DOMHTMLElement (DOMHTMLElementPendingPublic)
- (NSString *)titleDisplayString;
@end
@interface DOMHTMLInputElement (DOMHTMLInputElementPendingPublic)
- (NSString *)altDisplayString;
- (NSURL *)absoluteImageURL;
@end
@interface DOMHTMLImageElement (DOMHTMLImageElementPendingPublic)
- (NSString *)altDisplayString;
- (NSURL *)absoluteImageURL;
@end
@interface DOMHTMLObjectElement (DOMHTMLObjectElementPendingPublic)
- (NSURL *)absoluteImageURL;
@end
@interface DOMHTMLAnchorElement (DOMHTMLAnchorElementPendingPublic)
- (NSURL *)absoluteLinkURL;
@end
@interface DOMHTMLAreaElement (DOMHTMLAreaElementPendingPublic)
- (NSURL *)absoluteLinkURL;
@end
@interface DOMHTMLLinkElement (DOMHTMLLinkElementPendingPublic)
- (NSURL *)absoluteLinkURL;
@end
// END
// Pending DOM3 APIs
......
......@@ -69,18 +69,6 @@ typedef WebCore::RenderPart WebCoreRenderPart;
@protocol WebCoreFileButton;
@protocol WebCoreFileButtonDelegate;
extern NSString *WebCoreElementDOMNodeKey;
extern NSString *WebCoreElementFrameKey;
extern NSString *WebCoreElementImageAltStringKey;
extern NSString *WebCoreElementImageRectKey;
extern NSString *WebCoreElementImageURLKey;
extern NSString *WebCoreElementIsSelectedKey;
extern NSString *WebCoreElementLinkURLKey;
extern NSString *WebCoreElementLinkTargetFrameKey;
extern NSString *WebCoreElementLinkLabelKey;
extern NSString *WebCoreElementLinkTitleKey;
extern NSString *WebCoreElementTitleKey;
extern NSString *WebCorePageCacheStateKey;
typedef enum {
......@@ -302,7 +290,9 @@ typedef enum {
- (NSObject *)copyRenderTree:(id <WebCoreRenderTreeCopier>)copier;
- (NSString *)renderTreeAsExternalRepresentation;
- (NSDictionary *)elementAtPoint:(NSPoint)point;
- (void)getInnerNonSharedNode:(DOMNode **)innerNonSharedNode innerNode:(DOMNode **)innerNode URLElement:(DOMElement **)URLElement atPoint:(NSPoint)point;
- (BOOL)isPointInsideSelection:(NSPoint)point;
- (NSURL *)URLWithAttributeString:(NSString *)string;
- (DOMElement *)elementWithName:(NSString *)name inForm:(DOMElement *)form;
......
......@@ -123,19 +123,6 @@ using KJS::Bindings::RootObject;
using WebCore::RenderObject;
NSString *WebCoreElementDOMNodeKey = @"WebElementDOMNode";
NSString *WebCoreElementFrameKey = @"WebElementFrame";
NSString *WebCoreElementImageAltStringKey = @"WebElementImageAltString";
NSString *WebCoreElementImageRectKey = @"WebElementImageRect";
NSString *WebCoreElementImageURLKey = @"WebElementImageURL";
NSString *WebCoreElementIsSelectedKey = @"WebElementIsSelected";
NSString *WebCoreElementLinkURLKey = @"WebElementLinkURL";
NSString *WebCoreElementLinkTargetFrameKey = @"WebElementTargetFrame";
NSString *WebCoreElementLinkLabelKey = @"WebElementLinkLabel";
NSString *WebCoreElementLinkTitleKey = @"WebElementLinkTitle";
NSString *WebCoreElementNameKey = @"WebElementName";
NSString *WebCoreElementTitleKey = @"WebCoreElementTitle"; // not in WebKit API for now, could be in API some day
NSString *WebCorePageCacheStateKey = @"WebCorePageCacheState";
@interface WebCoreFrameBridge (WebCoreBridgeInternal)
......@@ -1276,107 +1263,25 @@ static HTMLFormElementImpl *formElementFromDOMElement(DOMElement *element)
return m_frame->matchLabelsAgainstElement(labels, [element _elementImpl]);
}
- (NSDictionary *)elementAtPoint:(NSPoint)point
- (void)getInnerNonSharedNode:(DOMNode **)innerNonSharedNode innerNode:(DOMNode **)innerNode URLElement:(DOMElement **)URLElement atPoint:(NSPoint)point
{
RenderObject *renderer = m_frame->renderer();
if (!renderer)
return nil;
RenderObject::NodeInfo nodeInfo = [self nodeInfoAtPoint:point];
NSMutableDictionary *element = [NSMutableDictionary dictionary];
[element setObject:[NSNumber numberWithBool:m_frame->isPointInsideSelection((int)point.x, (int)point.y)]
forKey:WebCoreElementIsSelectedKey];
// Find the title in the nearest enclosing DOM node.
// For <area> tags in image maps, walk the tree for the <area>, not the <img> using it.
for (NodeImpl *titleNode = nodeInfo.innerNode(); titleNode; titleNode = titleNode->parentNode()) {
if (titleNode->isElementNode()) {
const AtomicString& title = static_cast<ElementImpl *>(titleNode)->getAttribute(titleAttr);
if (!title.isNull()) {
// We found a node with a title.
QString titleText = title.qstring();
titleText.replace(QChar('\\'), m_frame->backslashAsCurrencySymbol());
[element setObject:titleText.getNSString() forKey:WebCoreElementTitleKey];
break;
}
}
}
NodeImpl *URLNode = nodeInfo.URLElement();
if (URLNode) {
ElementImpl *e = static_cast<ElementImpl *>(URLNode);
DocumentImpl *doc = e->getDocument();
ASSERT(doc);
const AtomicString& title = e->getAttribute(titleAttr);
if (!title.isEmpty()) {
QString titleText = title.qstring();
titleText.replace(QChar('\\'), m_frame->backslashAsCurrencySymbol());
[element setObject:titleText.getNSString() forKey:WebCoreElementLinkTitleKey];
}
const AtomicString& link = e->getAttribute(hrefAttr);
if (!link.isNull()) {
QString t = plainText(rangeOfContents(e).get());
if (!t.isEmpty()) {
[element setObject:t.getNSString() forKey:WebCoreElementLinkLabelKey];
}
QString URLString = parseURL(link).qstring();
[element setObject:doc->completeURL(URLString).getNSString() forKey:WebCoreElementLinkURLKey];
}
DOMString target = e->getAttribute(targetAttr);
if (target.isEmpty() && doc) { // FIXME: Take out this doc check when we're not just before a release.
target = doc->baseTarget();
}
if (!target.isEmpty()) {
[element setObject:target.qstring().getNSString() forKey:WebCoreElementLinkTargetFrameKey];
}
if (!renderer) {
*innerNonSharedNode = nil;
*innerNode = nil;
*URLElement = nil;
return;
}
NodeImpl *node = nodeInfo.innerNonSharedNode();
if (node) {
[element setObject:[DOMNode _nodeWithImpl:node] forKey:WebCoreElementDOMNodeKey];
// Only return image information if there is an image.
if (node->renderer() && node->renderer()->isImage()) {
RenderImage *r = static_cast<RenderImage *>(node->renderer());
int x, y;
if (r->absolutePosition(x, y)) {
NSValue *rect = [NSValue valueWithRect:NSMakeRect(x, y, r->contentWidth(), r->contentHeight())];
[element setObject:rect forKey:WebCoreElementImageRectKey];
}
RenderObject::NodeInfo nodeInfo = [self nodeInfoAtPoint:point];
*innerNonSharedNode = [DOMNode _nodeWithImpl:nodeInfo.innerNonSharedNode()];
*innerNode = [DOMNode _nodeWithImpl:nodeInfo.innerNode()];
*URLElement = [DOMElement _elementWithImpl:nodeInfo.URLElement()];
}
ElementImpl *i = static_cast<ElementImpl*>(node);
// FIXME: Code copied from RenderImage::updateFromElement; should share.
DOMString attr;
if (i->hasTagName(objectTag)) {
attr = i->getAttribute(dataAttr);
} else {
attr = i->getAttribute(srcAttr);
}
if (!attr.isEmpty()) {
QString URLString = parseURL(attr).qstring();
[element setObject:i->getDocument()->completeURL(URLString).getNSString() forKey:WebCoreElementImageURLKey];
}
// FIXME: Code copied from RenderImage::updateFromElement; should share.
DOMString alt;
if (i->hasTagName(inputTag))
alt = static_cast<HTMLInputElementImpl *>(i)->altText();
else if (i->hasTagName(imgTag))
alt = static_cast<HTMLImageElementImpl *>(i)->altText();
if (!alt.isNull()) {
QString altText = alt.qstring();
altText.replace(QChar('\\'), m_frame->backslashAsCurrencySymbol());
[element setObject:altText.getNSString() forKey:WebCoreElementImageAltStringKey];
}
}
}
return element;
- (BOOL)isPointInsideSelection:(NSPoint)point
{
return m_frame->isPointInsideSelection((int)point.x, (int)point.y);
}
- (NSURL *)URLWithAttributeString:(NSString *)string
......
......@@ -27,6 +27,7 @@
#include "CDATASectionImpl.h"
#include "CommentImpl.h"
#include "decoder.h"
#include "DOMImplementationImpl.h"
#include "DocLoader.h"
#include "DocumentFragmentImpl.h"
......@@ -1644,8 +1645,7 @@ MouseEventWithHitTestResults DocumentImpl::prepareMouseEvent(bool readonly, bool
String href;
String target;
if (renderInfo.URLElement()) {
assert(renderInfo.URLElement()->isElementNode());
ElementImpl* e = static_cast<ElementImpl*>(renderInfo.URLElement());
ElementImpl* e = renderInfo.URLElement();
href = parseURL(e->getAttribute(hrefAttr));
if (!href.isNull())
target = e->getAttribute(targetAttr);
......@@ -2492,6 +2492,13 @@ void DocumentImpl::setDecoder(Decoder *decoder)
m_decoder = decoder;
}
QChar DocumentImpl::backslashAsCurrencySymbol() const
{
if (!m_decoder)
return '\\';
return m_decoder->encoding().backslashAsCurrencySymbol();
}
QString DocumentImpl::completeURL(const QString &URL)
{
if (!m_decoder)
......
......@@ -676,6 +676,8 @@ public:
void setDecoder(Decoder*);
Decoder* decoder() const { return m_decoder.get(); }
QChar backslashAsCurrencySymbol() const;
#if __APPLE__
void setDashboardRegionsDirty(bool f) { m_dashboardRegionsDirty = f; }
bool dashboardRegionsDirty() const { return m_dashboardRegionsDirty; }
......
......@@ -1120,7 +1120,7 @@ RenderLayer::hitTest(RenderObject::NodeInfo& info, int x, int y)
NodeImpl* node = info.innerNode();
while (node) {
if (node->isLink() && !info.URLElement())
info.setURLElement(node);
info.setURLElement(static_cast<ElementImpl*>(node));
node = node->parentNode();
}
......
......@@ -488,19 +488,19 @@ public:
NodeImpl* innerNode() const { return m_innerNode; }
NodeImpl* innerNonSharedNode() const { return m_innerNonSharedNode; }
NodeImpl* URLElement() const { return m_innerURLElement; }
ElementImpl* URLElement() const { return m_innerURLElement; }
bool readonly() const { return m_readonly; }
bool active() const { return m_active; }
bool mouseMove() const { return m_mouseMove; }
void setInnerNode(NodeImpl* n) { m_innerNode = n; }
void setInnerNonSharedNode(NodeImpl* n) { m_innerNonSharedNode = n; }
void setURLElement(NodeImpl* n) { m_innerURLElement = n; }
void setURLElement(ElementImpl* n) { m_innerURLElement = n; }
private:
NodeImpl* m_innerNode;
NodeImpl* m_innerNonSharedNode;
NodeImpl* m_innerURLElement;
ElementImpl* m_innerURLElement;
bool m_readonly;
bool m_active;
bool m_mouseMove;
......
2006-03-01 Timothy Hatcher <timothy@apple.com>
Reviewed by Darin.
http://bugzilla.opendarwin.org/show_bug.cgi?id=7450
elementAtPoint is expensive and should return a smart dictionary
elementAtPoint for WebHTMLView now returns a WebElementDictionary,
when objectForKey is called it will lookup in the DOM, cache and return the value
* Misc/WebElementDictionary.h: Added.
* Misc/WebElementDictionary.m: Added.
(addLookupKey):
(cacheValueForKey):
(+[WebElementDictionary initializeLookupTable]):
(-[WebElementDictionary initWithInnerNonSharedNode:innerNode:URLElement:andPoint:]):
(-[WebElementDictionary dealloc]):
(-[WebElementDictionary _fillCache]):
(-[WebElementDictionary count]):
(-[WebElementDictionary keyEnumerator]):
(-[WebElementDictionary objectForKey:]):
(-[WebElementDictionary _domNode]):
(-[WebElementDictionary _webFrame]):
(-[WebElementDictionary _targetWebFrame]):
(-[WebElementDictionary _title]):
(-[WebElementDictionary _imageRect]):
(-[WebElementDictionary _isSelected]):
* Misc/WebNSViewExtras.m:
(-[NSView _web_dragImage:element:rect:event:pasteboard:source:offset:]):
* WebKit.xcodeproj/project.pbxproj:
* WebView/WebHTMLView.m:
(-[WebHTMLView _updateMouseoverWithEvent:]):
(-[WebHTMLView _startDraggingImage:at:operation:event:sourceIsDHTML:DHTMLWroteData:]):
(-[NSArray elementAtPoint:]):
* WebView/WebView.m:
* WebView/WebViewPrivate.h:
2006-02-28 Darin Adler <darin@apple.com>
Reviewed by Adele.
......
/*
* Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#import <Foundation/NSDictionary.h>
@class DOMNode;
@class DOMElement;