+2006-05-15 Eric Seidel <eseidel@apple.com>
+
+ Reviewed by Tim Hatcher.
+
+ Split html_imageimpl.* into separate files (one per class).
+ http://bugzilla.opendarwin.org/show_bug.cgi?id=8929
+
+ * WebCore.xcodeproj/project.pbxproj:
+ * bindings/js/JSCanvasRenderingContext2DBase.cpp:
+ * bindings/js/kjs_events.cpp:
+ * bindings/js/kjs_html.cpp:
+ * bindings/objc/DOMHTML.mm:
+ * bridge/mac/WebCoreFrameBridge.mm:
+ * dom/Document.cpp:
+ * editing/JSEditor.cpp:
+ * html/CanvasRenderingContext2D.cpp:
+ * html/HTMLAnchorElement.cpp:
+ * html/HTMLAreaElement.cpp: Added.
+ (WebCore::HTMLAreaElement::HTMLAreaElement):
+ (WebCore::HTMLAreaElement::mapMouseEvent):
+ (WebCore::HTMLAreaElement::getRect):
+ (WebCore::HTMLAreaElement::getRegion):
+ * html/HTMLAreaElement.h: Added.
+ * html/HTMLCanvasElement.h:
+ * html/HTMLDocument.cpp:
+ * html/HTMLElementFactory.cpp:
+ * html/HTMLFormCollection.cpp:
+ * html/HTMLFormElement.cpp:
+ * html/HTMLImageElement.cpp: Added.
+ (WebCore::HTMLImageElement::HTMLImageElement):
+ * html/HTMLImageElement.h: Added.
+ * html/HTMLImageLoader.cpp: Added.
+ (WebCore::HTMLImageLoader::HTMLImageLoader):
+ * html/HTMLImageLoader.h: Added.
+ * html/HTMLInputElement.cpp:
+ * html/HTMLMapElement.cpp: Added.
+ (WebCore::HTMLMapElement::mapMouseEvent):
+ (WebCore::HTMLMapElement::parseMappedAttribute):
+ * html/HTMLMapElement.h: Added.
+ * html/HTMLObjectElement.cpp:
+ * html/HTMLParser.cpp:
+ * html/html_imageimpl.cpp: Removed.
+ * html/html_imageimpl.h: Removed.
+ * ksvg2/misc/SVGImageLoader.h:
+ * kwq/WebCoreAXObject.mm:
+ (-[WebCoreAXObject addChildrenToArray:]):
+ * page/Frame.cpp:
+ * rendering/RenderImage.cpp:
+ (WebCore::RenderImage::RenderImage):
+ (WebCore::RenderImage::nodeAtPoint):
+
2006-05-15 Eric Seidel <eseidel@apple.com>
Reviewed by beth.
RelativePath="..\..\html\HTMLDivElement.h"\r
>\r
</File>\r
+\r
+ <File\r
+ RelativePath="..\..\html\HTMLMapElement.cpp"\r
+ >\r
+ </File>\r
+ <File\r
+ RelativePath="..\..\html\HTMLMapElement.h"\r
+ >\r
+ </File>\r
+ <File\r
+ RelativePath="..\..\html\HTMLImageElement.cpp"\r
+ >\r
+ </File>\r
+ <File\r
+ RelativePath="..\..\html\HTMLImageElement.h"\r
+ >\r
+ </File>\r
+ <File\r
+ RelativePath="..\..\html\HTMLAreaElement.cpp"\r
+ >\r
+ </File>\r
+ <File\r
+ RelativePath="..\..\html\HTMLAreaElement.h"\r
+ >\r
+ </File>\r
<File\r
- RelativePath="..\..\html\html_imageimpl.cpp"\r
+ RelativePath="..\..\html\HTMLImageLoader.cpp"\r
>\r
</File>\r
<File\r
- RelativePath="..\..\html\html_imageimpl.h"\r
+ RelativePath="..\..\html\HTMLImageLoader.h"\r
>\r
</File>\r
<File\r
93EEC27109C3218800C515D1 /* CanvasStyle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93EEC27009C3218800C515D1 /* CanvasStyle.cpp */; };
93F198E508245E59001E9ABC /* HTMLDocument.h in Headers */ = {isa = PBXBuildFile; fileRef = F523D23C02DE4396018635CA /* HTMLDocument.h */; };
93F198E608245E59001E9ABC /* HTMLElement.h in Headers */ = {isa = PBXBuildFile; fileRef = F523D23F02DE4396018635CA /* HTMLElement.h */; };
- 93F198E908245E59001E9ABC /* html_imageimpl.h in Headers */ = {isa = PBXBuildFile; fileRef = F523D24502DE4396018635CA /* html_imageimpl.h */; };
93F198EF08245E59001E9ABC /* HTMLParser.h in Headers */ = {isa = PBXBuildFile; fileRef = F523D25102DE4396018635CA /* HTMLParser.h */; };
93F198F008245E59001E9ABC /* HTMLTokenizer.h in Headers */ = {isa = PBXBuildFile; fileRef = F523D25302DE4396018635CA /* HTMLTokenizer.h */; };
93F198F608245E59001E9ABC /* Decoder.h in Headers */ = {isa = PBXBuildFile; fileRef = F523D27902DE43D7018635CA /* Decoder.h */; };
93F19A5F08245E59001E9ABC /* WebCoreViewFactory.m in Sources */ = {isa = PBXBuildFile; fileRef = F587855502DE375901EA4122 /* WebCoreViewFactory.m */; };
93F19A9108245E59001E9ABC /* HTMLDocument.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F523D23B02DE4396018635CA /* HTMLDocument.cpp */; };
93F19A9208245E59001E9ABC /* HTMLElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F523D23E02DE4396018635CA /* HTMLElement.cpp */; };
- 93F19A9508245E59001E9ABC /* html_imageimpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F523D24402DE4396018635CA /* html_imageimpl.cpp */; };
93F19A9B08245E59001E9ABC /* HTMLParser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F523D25002DE4396018635CA /* HTMLParser.cpp */; };
93F19A9C08245E59001E9ABC /* HTMLTokenizer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F523D25202DE4396018635CA /* HTMLTokenizer.cpp */; };
93F19A9D08245E59001E9ABC /* Decoder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F523D27802DE43D7018635CA /* Decoder.cpp */; };
A8EA7CB60A192B9C00A8EF5F /* HTMLBlockquoteElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8EA7CA80A192B9C00A8EF5F /* HTMLBlockquoteElement.cpp */; };
A8EA7CB70A192B9C00A8EF5F /* HTMLDivElement.h in Headers */ = {isa = PBXBuildFile; fileRef = A8EA7CA90A192B9C00A8EF5F /* HTMLDivElement.h */; };
A8EA7CB80A192B9C00A8EF5F /* HTMLHeadingElement.h in Headers */ = {isa = PBXBuildFile; fileRef = A8EA7CAA0A192B9C00A8EF5F /* HTMLHeadingElement.h */; };
+ A8EA7D2B0A19385500A8EF5F /* HTMLImageLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = A8EA7D230A19385500A8EF5F /* HTMLImageLoader.h */; };
+ A8EA7D2C0A19385500A8EF5F /* HTMLMapElement.h in Headers */ = {isa = PBXBuildFile; fileRef = A8EA7D240A19385500A8EF5F /* HTMLMapElement.h */; };
+ A8EA7D2D0A19385500A8EF5F /* HTMLImageElement.h in Headers */ = {isa = PBXBuildFile; fileRef = A8EA7D250A19385500A8EF5F /* HTMLImageElement.h */; };
+ A8EA7D2E0A19385500A8EF5F /* HTMLAreaElement.h in Headers */ = {isa = PBXBuildFile; fileRef = A8EA7D260A19385500A8EF5F /* HTMLAreaElement.h */; };
+ A8EA7D2F0A19385500A8EF5F /* HTMLAreaElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8EA7D270A19385500A8EF5F /* HTMLAreaElement.cpp */; };
+ A8EA7D300A19385500A8EF5F /* HTMLImageLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8EA7D280A19385500A8EF5F /* HTMLImageLoader.cpp */; };
+ A8EA7D310A19385500A8EF5F /* HTMLImageElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8EA7D290A19385500A8EF5F /* HTMLImageElement.cpp */; };
+ A8EA7D320A19385500A8EF5F /* HTMLMapElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8EA7D2A0A19385500A8EF5F /* HTMLMapElement.cpp */; };
A8FD8B86087CB44C00DC3707 /* KWQWMatrix.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A85D7A8C0879EC64006A9172 /* KWQWMatrix.cpp */; };
A8FD8B87087CB45700DC3707 /* KWQWMatrix.h in Headers */ = {isa = PBXBuildFile; fileRef = A85D7A8D0879EC64006A9172 /* KWQWMatrix.h */; };
A8FEFB0A0979F472005839FD /* RenderForeignObject.h in Headers */ = {isa = PBXBuildFile; fileRef = A8FEFB080979F472005839FD /* RenderForeignObject.h */; };
A8EA7CA80A192B9C00A8EF5F /* HTMLBlockquoteElement.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLBlockquoteElement.cpp; sourceTree = "<group>"; };
A8EA7CA90A192B9C00A8EF5F /* HTMLDivElement.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = HTMLDivElement.h; sourceTree = "<group>"; };
A8EA7CAA0A192B9C00A8EF5F /* HTMLHeadingElement.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = HTMLHeadingElement.h; sourceTree = "<group>"; };
+ A8EA7D230A19385500A8EF5F /* HTMLImageLoader.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = HTMLImageLoader.h; sourceTree = "<group>"; };
+ A8EA7D240A19385500A8EF5F /* HTMLMapElement.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = HTMLMapElement.h; sourceTree = "<group>"; };
+ A8EA7D250A19385500A8EF5F /* HTMLImageElement.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = HTMLImageElement.h; sourceTree = "<group>"; };
+ A8EA7D260A19385500A8EF5F /* HTMLAreaElement.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = HTMLAreaElement.h; sourceTree = "<group>"; };
+ A8EA7D270A19385500A8EF5F /* HTMLAreaElement.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLAreaElement.cpp; sourceTree = "<group>"; };
+ A8EA7D280A19385500A8EF5F /* HTMLImageLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLImageLoader.cpp; sourceTree = "<group>"; };
+ A8EA7D290A19385500A8EF5F /* HTMLImageElement.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLImageElement.cpp; sourceTree = "<group>"; };
+ A8EA7D2A0A19385500A8EF5F /* HTMLMapElement.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLMapElement.cpp; sourceTree = "<group>"; };
A8FEFB080979F472005839FD /* RenderForeignObject.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = RenderForeignObject.h; sourceTree = "<group>"; };
A8FEFB090979F472005839FD /* RenderForeignObject.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = RenderForeignObject.cpp; sourceTree = "<group>"; };
A8FEFB2F0979F4F6005839FD /* SVGForeignObjectElement.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = SVGForeignObjectElement.cpp; sourceTree = "<group>"; };
F523D23C02DE4396018635CA /* HTMLDocument.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = HTMLDocument.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
F523D23E02DE4396018635CA /* HTMLElement.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLElement.cpp; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
F523D23F02DE4396018635CA /* HTMLElement.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = HTMLElement.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
- F523D24402DE4396018635CA /* html_imageimpl.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = html_imageimpl.cpp; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
- F523D24502DE4396018635CA /* html_imageimpl.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = html_imageimpl.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
F523D25002DE4396018635CA /* HTMLParser.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLParser.cpp; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
F523D25102DE4396018635CA /* HTMLParser.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = HTMLParser.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
F523D25202DE4396018635CA /* HTMLTokenizer.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLTokenizer.cpp; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
93EEC1EF09C2877700C515D1 /* CanvasStyle.h */,
A8136D370973A8E700D74463 /* FormDataList.cpp */,
A8136D360973A8E700D74463 /* FormDataList.h */,
- F523D24402DE4396018635CA /* html_imageimpl.cpp */,
- F523D24502DE4396018635CA /* html_imageimpl.h */,
A8CFF79A0A156978000A4234 /* HTMLAnchorElement.cpp */,
A8CFF7A10A156978000A4234 /* HTMLAnchorElement.h */,
A871D4540A127CBC00B12A68 /* HTMLAppletElement.cpp */,
A871D4530A127CBC00B12A68 /* HTMLAppletElement.h */,
+ A8EA7D270A19385500A8EF5F /* HTMLAreaElement.cpp */,
+ A8EA7D260A19385500A8EF5F /* HTMLAreaElement.h */,
A871DC1E0A15205700B12A68 /* HTMLBaseElement.cpp */,
A871DC130A15205700B12A68 /* HTMLBaseElement.h */,
A8DF3FCB097FA0FB0052981B /* HTMLBaseFontElement.cpp */,
A871DE1B0A152AC800B12A68 /* HTMLHtmlElement.h */,
A871DE180A152AC800B12A68 /* HTMLIFrameElement.cpp */,
A871DE1E0A152AC800B12A68 /* HTMLIFrameElement.h */,
+ A8EA7D290A19385500A8EF5F /* HTMLImageElement.cpp */,
+ A8EA7D250A19385500A8EF5F /* HTMLImageElement.h */,
+ A8EA7D280A19385500A8EF5F /* HTMLImageLoader.cpp */,
+ A8EA7D230A19385500A8EF5F /* HTMLImageLoader.h */,
A81369B1097374F500D74463 /* HTMLInputElement.cpp */,
A81369B0097374F500D74463 /* HTMLInputElement.h */,
A81369AF097374F500D74463 /* HTMLIsIndexElement.cpp */,
A8EA79EA0A1916DF00A8EF5F /* HTMLLIElement.h */,
A871DC150A15205700B12A68 /* HTMLLinkElement.cpp */,
A871DC140A15205700B12A68 /* HTMLLinkElement.h */,
+ A8EA7D2A0A19385500A8EF5F /* HTMLMapElement.cpp */,
+ A8EA7D240A19385500A8EF5F /* HTMLMapElement.h */,
A8EA7C9E0A192B9C00A8EF5F /* HTMLMarqueeElement.cpp */,
A8EA7C9D0A192B9C00A8EF5F /* HTMLMarqueeElement.h */,
A8EA79EC0A1916DF00A8EF5F /* HTMLMenuElement.cpp */,
files = (
93F198E508245E59001E9ABC /* HTMLDocument.h in Headers */,
93F198E608245E59001E9ABC /* HTMLElement.h in Headers */,
- 93F198E908245E59001E9ABC /* html_imageimpl.h in Headers */,
93F198EF08245E59001E9ABC /* HTMLParser.h in Headers */,
93F198F008245E59001E9ABC /* HTMLTokenizer.h in Headers */,
93F198F608245E59001E9ABC /* Decoder.h in Headers */,
A8EA7CB50A192B9C00A8EF5F /* HTMLParagraphElement.h in Headers */,
A8EA7CB70A192B9C00A8EF5F /* HTMLDivElement.h in Headers */,
A8EA7CB80A192B9C00A8EF5F /* HTMLHeadingElement.h in Headers */,
+ A8EA7D2B0A19385500A8EF5F /* HTMLImageLoader.h in Headers */,
+ A8EA7D2C0A19385500A8EF5F /* HTMLMapElement.h in Headers */,
+ A8EA7D2D0A19385500A8EF5F /* HTMLImageElement.h in Headers */,
+ A8EA7D2E0A19385500A8EF5F /* HTMLAreaElement.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
93F19A5F08245E59001E9ABC /* WebCoreViewFactory.m in Sources */,
93F19A9108245E59001E9ABC /* HTMLDocument.cpp in Sources */,
93F19A9208245E59001E9ABC /* HTMLElement.cpp in Sources */,
- 93F19A9508245E59001E9ABC /* html_imageimpl.cpp in Sources */,
93F19A9B08245E59001E9ABC /* HTMLParser.cpp in Sources */,
93F19A9C08245E59001E9ABC /* HTMLTokenizer.cpp in Sources */,
93F19A9D08245E59001E9ABC /* Decoder.cpp in Sources */,
A8EA7CB20A192B9C00A8EF5F /* HTMLParagraphElement.cpp in Sources */,
A8EA7CB30A192B9C00A8EF5F /* HTMLHRElement.cpp in Sources */,
A8EA7CB60A192B9C00A8EF5F /* HTMLBlockquoteElement.cpp in Sources */,
+ A8EA7D2F0A19385500A8EF5F /* HTMLAreaElement.cpp in Sources */,
+ A8EA7D300A19385500A8EF5F /* HTMLImageLoader.cpp in Sources */,
+ A8EA7D310A19385500A8EF5F /* HTMLImageElement.cpp in Sources */,
+ A8EA7D320A19385500A8EF5F /* HTMLMapElement.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
#include "CanvasStyle.h"
#include "ExceptionCode.h"
#include "HTMLCanvasElement.h"
+#include "HTMLImageElement.h"
#include "JSCanvasGradient.h"
#include "JSCanvasPattern.h"
#include "JSCanvasRenderingContext2D.h"
#include "JSMouseEvent.h"
#include "JSKeyboardEvent.h"
#include "dom2_eventsimpl.h"
-#include "html_imageimpl.h"
#include "HTMLNames.h"
+#include "HTMLImageElement.h"
#include "kjs_proxy.h"
#include "kjs_window.h"
#include "DocLoader.h"
#include "EventNames.h"
#include "Frame.h"
+#include "HTMLAnchorElement.h"
#include "HTMLAppletElement.h"
+#include "HTMLAreaElement.h"
#include "HTMLBaseElement.h"
#include "HTMLBaseFontElement.h"
#include "HTMLBlockquoteElement.h"
#include "HTMLHRElement.h"
#include "HTMLHtmlElement.h"
#include "HTMLIFrameElement.h"
+#include "HTMLImageElement.h"
#include "HTMLIsIndexElement.h"
#include "HTMLLabelElement.h"
#include "HTMLLegendElement.h"
#include "HTMLLIElement.h"
#include "HTMLLinkElement.h"
+#include "HTMLMapElement.h"
#include "HTMLMenuElement.h"
#include "HTMLMetaElement.h"
#include "HTMLModElement.h"
#include "Text.h"
#include "css_ruleimpl.h"
#include "dom2_eventsimpl.h"
-#include "html_imageimpl.h"
#include "kjs_css.h"
#include "kjs_events.h"
#include "kjs_proxy.h"
#import "DocumentFragment.h"
#import "FoundationExtras.h"
#import "HTMLAppletElement.h"
+#import "HTMLAreaElement.h"
#import "HTMLBaseElement.h"
#import "HTMLBaseFontElement.h"
#import "HTMLBodyElement.h"
#import "HTMLHRElement.h"
#import "HTMLHtmlElement.h"
#import "HTMLIFrameElement.h"
+#import "HTMLImageElement.h"
#import "HTMLIsIndexElement.h"
#import "HTMLLabelElement.h"
#import "HTMLLegendElement.h"
#import "HTMLLIElement.h"
#import "HTMLLinkElement.h"
+#import "HTMLMapElement.h"
#import "HTMLMenuElement.h"
#import "HTMLMetaElement.h"
#import "HTMLNames.h"
#import "HTMLTitleElement.h"
#import "HTMLUListElement.h"
#import "NameNodeList.h"
-#import "html_imageimpl.h"
#import "markup.h"
#import "RenderTextField.h"
#import "FrameView.h"
#import "csshelper.h"
#import "DeleteSelectionCommand.h"
#import "HTMLDocument.h"
-#import "html_imageimpl.h"
#import "htmlediting.h"
#import "HTMLNames.h"
#import "kjs_proxy.h"
#include "HTMLBodyElement.h"
#include "HTMLDocument.h"
#include "HTMLElementFactory.h"
+#include "HTMLImageLoader.h"
#include "HTMLInputElement.h"
#include "HTMLLinkElement.h"
+#include "HTMLMapElement.h"
#include "HTMLNameCollection.h"
#include "HTMLNames.h"
#include "HTMLStyleElement.h"
#include "cssstyleselector.h"
#include "dom2_eventsimpl.h"
#include "dom_xmlimpl.h"
-#include "html_imageimpl.h"
#include "kjs_binding.h"
#include "kjs_proxy.h"
#include "xml_tokenizer.h"
#include "DocumentFragment.h"
#include "Frame.h"
#include "HTMLNames.h"
+#include "HTMLImageElement.h"
#include "ReplaceSelectionCommand.h"
#include "SelectionController.h"
#include "TypingCommand.h"
#include "UnlinkCommand.h"
-#include "html_imageimpl.h"
#include "htmlediting.h"
#include "markup.h"
#include "config.h"
#include "CanvasRenderingContext2D.h"
+#include "CachedImage.h"
#include "CanvasGradient.h"
#include "CanvasPattern.h"
#include "CanvasStyle.h"
#include "ExceptionCode.h"
#include "GraphicsContext.h"
#include "HTMLCanvasElement.h"
+#include "HTMLImageElement.h"
#include "HTMLNames.h"
#include "RenderHTMLCanvas.h"
#include "cssparser.h"
#include "dom2_eventsimpl.h"
#include "EventNames.h"
#include "Frame.h"
-#include "html_imageimpl.h"
+#include "HTMLImageElement.h"
#include "HTMLNames.h"
#include "RenderFlow.h"
#include "RenderImage.h"
--- /dev/null
+/**
+ * This file is part of the DOM implementation for KDE.
+ *
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+#include "config.h"
+#include "HTMLAreaElement.h"
+
+#include "Document.h"
+#include "HTMLNames.h"
+#include "FloatRect.h"
+#include "IntSize.h"
+
+using namespace std;
+
+namespace WebCore {
+
+using namespace HTMLNames;
+
+HTMLAreaElement::HTMLAreaElement(Document *doc)
+ : HTMLAnchorElement(areaTag, doc)
+ , m_coords(0)
+ , m_coordsLen(0)
+ , m_lastSize(-1, -1)
+ , m_shape(Unknown)
+{
+}
+
+HTMLAreaElement::~HTMLAreaElement()
+{
+ delete [] m_coords;
+}
+
+void HTMLAreaElement::parseMappedAttribute(MappedAttribute *attr)
+{
+ if (attr->name() == shapeAttr) {
+ if (equalIgnoringCase(attr->value(), "default"))
+ m_shape = Default;
+ else if (equalIgnoringCase(attr->value(), "circle"))
+ m_shape = Circle;
+ else if (equalIgnoringCase(attr->value(), "poly"))
+ m_shape = Poly;
+ else if (equalIgnoringCase(attr->value(), "rect"))
+ m_shape = Rect;
+ } else if (attr->name() == coordsAttr) {
+ delete [] m_coords;
+ m_coords = attr->value().toCoordsArray(m_coordsLen);
+ } else if (attr->name() == targetAttr) {
+ m_hasTarget = !attr->isNull();
+ } else if (attr->name() == altAttr || attr->name() == accesskeyAttr) {
+ // Do nothing.
+ } else
+ HTMLAnchorElement::parseMappedAttribute(attr);
+}
+
+bool HTMLAreaElement::mapMouseEvent(int x, int y, const IntSize& size, RenderObject::NodeInfo& info)
+{
+ if (m_lastSize != size) {
+ region = getRegion(size);
+ m_lastSize = size;
+ }
+
+ if (!region.contains(IntPoint(x, y)))
+ return false;
+
+ info.setInnerNode(this);
+ info.setURLElement(this);
+ return true;
+}
+
+IntRect HTMLAreaElement::getRect(RenderObject* obj) const
+{
+ int dx, dy;
+ obj->absolutePosition(dx, dy);
+ Path p = getRegion(m_lastSize);
+ p.translate(IntSize(dx, dy));
+ return enclosingIntRect(p.boundingRect());
+}
+
+Path HTMLAreaElement::getRegion(const IntSize& size) const
+{
+ if (!m_coords)
+ return Path();
+
+ int width = size.width();
+ int height = size.height();
+
+ // If element omits the shape attribute, select shape based on number of coordinates.
+ Shape shape = m_shape;
+ if (shape == Unknown) {
+ if (m_coordsLen == 3)
+ shape = Circle;
+ else if (m_coordsLen == 4)
+ shape = Rect;
+ else if (m_coordsLen >= 6)
+ shape = Poly;
+ }
+
+ Path path;
+ switch (shape) {
+ case Poly:
+ if (m_coordsLen >= 6) {
+ int numPoints = m_coordsLen / 2;
+ path.moveTo(FloatPoint(m_coords[0].calcMinValue(width), m_coords[1].calcMinValue(height)));
+ for (int i = 1; i < numPoints; ++i)
+ path.addLineTo(FloatPoint(m_coords[i * 2].calcMinValue(width), m_coords[i * 2 + 1].calcMinValue(height)));
+ path.closeSubpath();
+ }
+ break;
+ case Circle:
+ if (m_coordsLen >= 3) {
+ Length radius = m_coords[2];
+ int r = min(radius.calcMinValue(width), radius.calcMinValue(height));
+ path.addEllipse(FloatRect(m_coords[0].calcMinValue(width) - r, m_coords[1].calcMinValue(height) - r, 2 * r, 2 * r));
+ }
+ break;
+ case Rect:
+ if (m_coordsLen >= 4) {
+ int x0 = m_coords[0].calcMinValue(width);
+ int y0 = m_coords[1].calcMinValue(height);
+ int x1 = m_coords[2].calcMinValue(width);
+ int y1 = m_coords[3].calcMinValue(height);
+ path.addRect(FloatRect(x0, y0, x1 - x0, y1 - y0));
+ }
+ break;
+ case Default:
+ path.addRect(FloatRect(0, 0, width, height));
+ break;
+ case Unknown:
+ break;
+ }
+
+ return path;
+}
+
+String HTMLAreaElement::accessKey() const
+{
+ return getAttribute(accesskeyAttr);
+}
+
+void HTMLAreaElement::setAccessKey(const String& value)
+{
+ setAttribute(accesskeyAttr, value);
+}
+
+String HTMLAreaElement::alt() const
+{
+ return getAttribute(altAttr);
+}
+
+void HTMLAreaElement::setAlt(const String& value)
+{
+ setAttribute(altAttr, value);
+}
+
+String HTMLAreaElement::coords() const
+{
+ return getAttribute(coordsAttr);
+}
+
+void HTMLAreaElement::setCoords(const String& value)
+{
+ setAttribute(coordsAttr, value);
+}
+
+String HTMLAreaElement::href() const
+{
+ return document()->completeURL(getAttribute(hrefAttr));
+}
+
+void HTMLAreaElement::setHref(const String& value)
+{
+ setAttribute(hrefAttr, value);
+}
+
+bool HTMLAreaElement::noHref() const
+{
+ return !getAttribute(nohrefAttr).isNull();
+}
+
+void HTMLAreaElement::setNoHref(bool noHref)
+{
+ setAttribute(nohrefAttr, noHref ? "" : 0);
+}
+
+String HTMLAreaElement::shape() const
+{
+ return getAttribute(shapeAttr);
+}
+
+void HTMLAreaElement::setShape(const String& value)
+{
+ setAttribute(shapeAttr, value);
+}
+
+int HTMLAreaElement::tabIndex() const
+{
+ return getAttribute(tabindexAttr).toInt();
+}
+
+void HTMLAreaElement::setTabIndex(int tabIndex)
+{
+ setAttribute(tabindexAttr, String::number(tabIndex));
+}
+
+String HTMLAreaElement::target() const
+{
+ return getAttribute(targetAttr);
+}
+
+void HTMLAreaElement::setTarget(const String& value)
+{
+ setAttribute(targetAttr, value);
+}
+
+}
--- /dev/null
+/*
+ * This file is part of the DOM implementation for KDE.
+ *
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ * Copyright (C) 2004 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ */
+
+#ifndef HTMLAreaElement_H
+#define HTMLAreaElement_H
+
+#include "HTMLAnchorElement.h"
+#include "Path.h"
+#include "RenderObject.h" // for RenderObject::NodeInfo
+
+namespace WebCore {
+
+class HTMLAreaElement : public HTMLAnchorElement {
+public:
+ enum Shape { Default, Poly, Rect, Circle, Unknown };
+
+ HTMLAreaElement(Document*);
+ ~HTMLAreaElement();
+
+ virtual HTMLTagStatus endTagRequirement() const { return TagStatusForbidden; }
+ virtual int tagPriority() const { return 0; }
+
+ virtual void parseMappedAttribute(MappedAttribute*);
+
+ bool isDefault() const { return m_shape == Default; }
+
+ bool mapMouseEvent(int x, int y, const IntSize&, RenderObject::NodeInfo&);
+
+ virtual IntRect getRect(RenderObject*) const;
+
+ String accessKey() const;
+ void setAccessKey(const String&);
+
+ String alt() const;
+ void setAlt(const String&);
+
+ String coords() const;
+ void setCoords(const String&);
+
+ String href() const;
+ void setHref(const String&);
+
+ bool noHref() const;
+ void setNoHref(bool);
+
+ String shape() const;
+ void setShape(const String&);
+
+ int tabIndex() const;
+ void setTabIndex(int);
+
+ String target() const;
+ void setTarget(const String&);
+
+protected:
+ Path getRegion(const IntSize&) const;
+ Path region;
+ Length* m_coords;
+ int m_coordsLen;
+ IntSize m_lastSize;
+ Shape m_shape;
+};
+
+} //namespace
+
+#endif
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef HTML_CANVASIMPL_H
-#define HTML_CANVASIMPL_H
+#ifndef HTMLCanvasElement_H
+#define HTMLCanvasElement_H
-#include "html_imageimpl.h"
+#include "HTMLElement.h"
+#include "IntSize.h"
#if __APPLE__
// FIXME: Mac-specific parts need to move to the platform directory.
class CanvasRenderingContext2D;
typedef CanvasRenderingContext2D CanvasRenderingContext;
+class FloatRect;
class HTMLCanvasElement : public HTMLElement {
public:
#include "Frame.h"
#include "cssstyleselector.h"
#include "CSSPropertyNames.h"
-#include "html_imageimpl.h"
#include "HTMLTokenizer.h"
+#include "HTMLElement.h"
#include "HTMLElementFactory.h"
#include "HTMLNames.h"
#include "dom2_eventsimpl.h"
#include "config.h"
#include "HTMLElementFactory.h"
+#include "HTMLAnchorElement.h"
#include "HTMLAppletElement.h"
+#include "HTMLAreaElement.h"
#include "HTMLBaseFontElement.h"
#include "HTMLBaseElement.h"
#include "HTMLBlockquoteElement.h"
#include "HTMLHRElement.h"
#include "HTMLHtmlElement.h"
#include "HTMLIFrameElement.h"
+#include "HTMLImageElement.h"
#include "HTMLIsIndexElement.h"
#include "HTMLLabelElement.h"
#include "HTMLLegendElement.h"
#include "HTMLLIElement.h"
#include "HTMLLinkElement.h"
+#include "HTMLMapElement.h"
#include "HTMLMarqueeElement.h"
#include "HTMLMenuElement.h"
#include "HTMLMetaElement.h"
#include "HTMLGenericFormElement.h"
#include "HTMLFormElement.h"
-#include "html_imageimpl.h"
+#include "HTMLImageElement.h"
#include "HTMLNames.h"
namespace WebCore {
#include "Frame.h"
#include "HTMLDocument.h"
#include "HTMLFormCollection.h"
+#include "HTMLImageElement.h"
#include "HTMLInputElement.h"
#include "HTMLNames.h"
#include "csshelper.h"
-#include "html_imageimpl.h"
#include "RenderLineEdit.h"
namespace WebCore {
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
-
#include "config.h"
-#include "html_imageimpl.h"
+#include "HTMLImageElement.h"
-#include "DocLoader.h"
-#include "EventNames.h"
-#include "FloatRect.h"
-#include "HTMLFormElement.h"
#include "csshelper.h"
#include "CSSPropertyNames.h"
#include "CSSValueKeywords.h"
+#include "EventNames.h"
#include "HTMLDocument.h"
-#include "RenderImage.h"
+#include "HTMLFormElement.h"
#include "HTMLNames.h"
+#include "RenderImage.h"
using namespace std;
using namespace EventNames;
using namespace HTMLNames;
-HTMLImageLoader::HTMLImageLoader(Element* elt)
- : m_element(elt), m_image(0), m_firedLoad(true), m_imageComplete(true)
-{
-}
-
-HTMLImageLoader::~HTMLImageLoader()
-{
- if (m_image)
- m_image->deref(this);
- m_element->document()->removeImage(this);
-}
-
-void HTMLImageLoader::setLoadingImage(CachedImage *loadingImage)
-{
- m_firedLoad = false;
- m_imageComplete = false;
- m_image = loadingImage;
-}
-
-void HTMLImageLoader::updateFromElement()
-{
- // If we're not making renderers for the page, then don't load images. We don't want to slow
- // down the raw HTML parsing case by loading images we don't intend to display.
- Element* elem = element();
- Document* doc = elem->document();
- if (!doc->renderer())
- return;
-
- AtomicString attr = elem->getAttribute(elem->hasLocalName(objectTag) ? dataAttr : srcAttr);
-
- // Treat a lack of src or empty string for src as no image at all.
- CachedImage *newImage = 0;
- if (!attr.isEmpty())
- newImage = doc->docLoader()->requestImage(parseURL(attr));
-
- CachedImage *oldImage = m_image;
- if (newImage != oldImage) {
-#ifdef INSTRUMENT_LAYOUT_SCHEDULING
- if (!doc->ownerElement() && newImage)
- printf("Image requested at %d\n", doc->elapsedTime());
-#endif
- setLoadingImage(newImage);
- if (newImage)
- newImage->ref(this);
- if (oldImage)
- oldImage->deref(this);
- }
-
- if (RenderImage* renderer = static_cast<RenderImage*>(elem->renderer()))
- renderer->resetAnimation();
-}
-
-void HTMLImageLoader::dispatchLoadEvent()
-{
- if (!m_firedLoad && m_image) {
- m_firedLoad = true;
- element()->dispatchHTMLEvent(m_image->isErrorImage() ? errorEvent : loadEvent, false, false);
- }
-}
-
-void HTMLImageLoader::notifyFinished(CachedObject *image)
-{
- m_imageComplete = true;
- Element* elem = element();
- Document* doc = elem->document();
- doc->dispatchImageLoadEventSoon(this);
-#ifdef INSTRUMENT_LAYOUT_SCHEDULING
- if (!doc->ownerElement())
- printf("Image loaded at %d\n", doc->elapsedTime());
-#endif
- if (RenderImage* renderer = static_cast<RenderImage*>(elem->renderer()))
- renderer->setCachedImage(m_image);
-}
-
-// -------------------------------------------------------------------------
-
-HTMLImageElement::HTMLImageElement(Document *doc, HTMLFormElement *f)
- : HTMLElement(imgTag, doc), m_imageLoader(this), ismap(false), m_form(f)
+HTMLImageElement::HTMLImageElement(Document* doc, HTMLFormElement* f)
+ : HTMLElement(imgTag, doc)
+ , m_imageLoader(this)
+ , ismap(false)
+ , m_form(f)
, m_compositeOperator(CompositeSourceOver)
{
if (f)
f->registerImgElement(this);
}
-HTMLImageElement::HTMLImageElement(const QualifiedName& tagName, Document *doc)
- : HTMLElement(tagName, doc), m_imageLoader(this), ismap(false), m_form(0)
+HTMLImageElement::HTMLImageElement(const QualifiedName& tagName, Document* doc)
+ : HTMLElement(tagName, doc)
+ , m_imageLoader(this)
+ , ismap(false)
+ , m_form(0)
, m_compositeOperator(CompositeSourceOver)
{
}
return m_imageLoader.imageComplete();
}
-// -------------------------------------------------------------------------
-
-HTMLMapElement::HTMLMapElement(Document *doc)
- : HTMLElement(mapTag, doc)
-{
-}
-
-HTMLMapElement::~HTMLMapElement()
-{
- document()->removeImageMap(this);
-}
-
-bool HTMLMapElement::checkDTD(const Node* newChild)
-{
- // FIXME: This seems really odd, allowing only blocks inside map elements.
- return newChild->hasTagName(areaTag) || newChild->hasTagName(scriptTag) || inBlockTagList(newChild);
-}
-
-bool HTMLMapElement::mapMouseEvent(int x, int y, int width, int height, RenderObject::NodeInfo& info)
-{
- Node *node = this;
- while ((node = node->traverseNextNode(this)))
- if (node->hasTagName(areaTag))
- if (static_cast<HTMLAreaElement *>(node)->mapMouseEvent(x, y, width, height, info))
- return true;
- return false;
-}
-
-void HTMLMapElement::parseMappedAttribute(MappedAttribute *attr)
-{
- const QualifiedName& attrName = attr->name();
- if (attrName == idAttr || attrName == nameAttr) {
- Document* doc = document();
- if (attrName == idAttr) {
- // Call base class so that hasID bit gets set.
- HTMLElement::parseMappedAttribute(attr);
- if (doc->htmlMode() != Document::XHtml)
- return;
- }
- doc->removeImageMap(this);
- m_name = attr->value();
- if (m_name[0] == '#') {
- String mapName(m_name.domString().copy());
- mapName.remove(0, 1);
- m_name = mapName;
- }
- doc->addImageMap(this);
- } else
- HTMLElement::parseMappedAttribute(attr);
-}
-
-PassRefPtr<HTMLCollection> HTMLMapElement::areas()
-{
- return new HTMLCollection(this, HTMLCollection::MAP_AREAS);
-}
-
-String HTMLMapElement::name() const
-{
- return getAttribute(nameAttr);
-}
-
-void HTMLMapElement::setName(const String& value)
-{
- setAttribute(nameAttr, value);
-}
-
-// -------------------------------------------------------------------------
-
-HTMLAreaElement::HTMLAreaElement(Document *doc)
- : HTMLAnchorElement(areaTag, doc)
-{
- m_coords = 0;
- m_coordsLen = 0;
- m_shape = Unknown;
- lasth = -1;
- lastw = -1;
-}
-
-HTMLAreaElement::~HTMLAreaElement()
-{
- delete [] m_coords;
-}
-
-void HTMLAreaElement::parseMappedAttribute(MappedAttribute *attr)
-{
- if (attr->name() == shapeAttr) {
- if (equalIgnoringCase(attr->value(), "default"))
- m_shape = Default;
- else if (equalIgnoringCase(attr->value(), "circle"))
- m_shape = Circle;
- else if (equalIgnoringCase(attr->value(), "poly"))
- m_shape = Poly;
- else if (equalIgnoringCase(attr->value(), "rect"))
- m_shape = Rect;
- } else if (attr->name() == coordsAttr) {
- delete [] m_coords;
- m_coords = attr->value().toCoordsArray(m_coordsLen);
- } else if (attr->name() == targetAttr) {
- m_hasTarget = !attr->isNull();
- } else if (attr->name() == altAttr || attr->name() == accesskeyAttr) {
- // Do nothing.
- } else
- HTMLAnchorElement::parseMappedAttribute(attr);
-}
-
-bool HTMLAreaElement::mapMouseEvent(int x, int y, int width, int height, RenderObject::NodeInfo& info)
-{
- if (width != lastw || height != lasth) {
- region = getRegion(width, height);
- lastw = width;
- lasth = height;
- }
-
- if (!region.contains(IntPoint(x, y)))
- return false;
-
- info.setInnerNode(this);
- info.setURLElement(this);
- return true;
-}
-
-IntRect HTMLAreaElement::getRect(RenderObject* obj) const
-{
- int dx, dy;
- obj->absolutePosition(dx, dy);
- Path p = getRegion(lastw, lasth);
- p.translate(IntSize(dx, dy));
- return enclosingIntRect(p.boundingRect());
-}
-
-Path HTMLAreaElement::getRegion(int width, int height) const
-{
- if (!m_coords)
- return Path();
-
- // If element omits the shape attribute, select shape based on number of coordinates.
- Shape shape = m_shape;
- if (shape == Unknown) {
- if (m_coordsLen == 3)
- shape = Circle;
- else if (m_coordsLen == 4)
- shape = Rect;
- else if (m_coordsLen >= 6)
- shape = Poly;
- }
-
- Path path;
- switch (shape) {
- case Poly:
- if (m_coordsLen >= 6) {
- int numPoints = m_coordsLen / 2;
- path.moveTo(FloatPoint(m_coords[0].calcMinValue(width), m_coords[1].calcMinValue(height)));
- for (int i = 1; i < numPoints; ++i)
- path.addLineTo(FloatPoint(m_coords[i * 2].calcMinValue(width), m_coords[i * 2 + 1].calcMinValue(height)));
- path.closeSubpath();
- }
- break;
- case Circle:
- if (m_coordsLen >= 3) {
- Length radius = m_coords[2];
- int r = min(radius.calcMinValue(width), radius.calcMinValue(height));
- path.addEllipse(FloatRect(m_coords[0].calcMinValue(width) - r, m_coords[1].calcMinValue(height) - r,
- 2 * r, 2 * r));
- }
- break;
- case Rect:
- if (m_coordsLen >= 4) {
- int x0 = m_coords[0].calcMinValue(width);
- int y0 = m_coords[1].calcMinValue(height);
- int x1 = m_coords[2].calcMinValue(width);
- int y1 = m_coords[3].calcMinValue(height);
- path.addRect(FloatRect(x0, y0, x1 - x0, y1 - y0));
- }
- break;
- case Default:
- path.addRect(FloatRect(0, 0, width, height));
- break;
- case Unknown:
- break;
- }
-
- return path;
-}
-
-String HTMLAreaElement::accessKey() const
-{
- return getAttribute(accesskeyAttr);
-}
-
-void HTMLAreaElement::setAccessKey(const String& value)
-{
- setAttribute(accesskeyAttr, value);
-}
-
-String HTMLAreaElement::alt() const
-{
- return getAttribute(altAttr);
-}
-
-void HTMLAreaElement::setAlt(const String& value)
-{
- setAttribute(altAttr, value);
-}
-
-String HTMLAreaElement::coords() const
-{
- return getAttribute(coordsAttr);
-}
-
-void HTMLAreaElement::setCoords(const String& value)
-{
- setAttribute(coordsAttr, value);
-}
-
-String HTMLAreaElement::href() const
-{
- return document()->completeURL(getAttribute(hrefAttr));
-}
-
-void HTMLAreaElement::setHref(const String& value)
-{
- setAttribute(hrefAttr, value);
-}
-
-bool HTMLAreaElement::noHref() const
-{
- return !getAttribute(nohrefAttr).isNull();
-}
-
-void HTMLAreaElement::setNoHref(bool noHref)
-{
- setAttribute(nohrefAttr, noHref ? "" : 0);
-}
-
-String HTMLAreaElement::shape() const
-{
- return getAttribute(shapeAttr);
-}
-
-void HTMLAreaElement::setShape(const String& value)
-{
- setAttribute(shapeAttr, value);
-}
-
-int HTMLAreaElement::tabIndex() const
-{
- return getAttribute(tabindexAttr).toInt();
-}
-
-void HTMLAreaElement::setTabIndex(int tabIndex)
-{
- setAttribute(tabindexAttr, String::number(tabIndex));
-}
-
-String HTMLAreaElement::target() const
-{
- return getAttribute(targetAttr);
-}
-
-void HTMLAreaElement::setTarget(const String& value)
-{
- setAttribute(targetAttr, value);
-}
-
}
*
*/
-#ifndef HTML_IMAGEIMPL_H
-#define HTML_IMAGEIMPL_H
+#ifndef HTMLImageElement_H
+#define HTMLImageElement_H
-#include "CachedImage.h"
-#include "HTMLAnchorElement.h"
-#include "Image.h"
-#include "Path.h"
-#include "RenderObject.h"
+#include "HTMLElement.h"
+#include "GraphicsTypes.h"
+#include "HTMLImageLoader.h"
namespace WebCore {
-class HTMLCollection;
-class HTMLFormElement;
-class Image;
-class String;
-
-struct Length;
-
-class HTMLImageLoader : public CachedObjectClient {
-public:
- HTMLImageLoader(Element*);
- virtual ~HTMLImageLoader();
-
- virtual void updateFromElement();
-
- void dispatchLoadEvent();
-
- Element* element() const { return m_element; }
- bool imageComplete() const { return m_imageComplete; }
- CachedImage* image() const { return m_image; }
-
- // CachedObjectClient API
- virtual void notifyFinished(CachedObject*);
-
-protected:
- void setLoadingImage(CachedImage*);
-
-private:
- Element* m_element;
- CachedImage* m_image;
- bool m_firedLoad : 1;
- bool m_imageComplete : 1;
-};
-
class HTMLImageElement : public HTMLElement {
friend class HTMLFormElement;
public:
HTMLImageElement(Document*, HTMLFormElement* = 0);
- HTMLImageElement(const QualifiedName& tagName, Document*);
+ HTMLImageElement(const QualifiedName&, Document*);
~HTMLImageElement();
virtual HTMLTagStatus endTagRequirement() const { return TagStatusForbidden; }
CompositeOperator m_compositeOperator;
};
-//------------------------------------------------------------------
-
-class HTMLAreaElement : public HTMLAnchorElement {
-public:
- enum Shape { Default, Poly, Rect, Circle, Unknown };
-
- HTMLAreaElement(Document*);
- ~HTMLAreaElement();
-
- virtual HTMLTagStatus endTagRequirement() const { return TagStatusForbidden; }
- virtual int tagPriority() const { return 0; }
-
- virtual void parseMappedAttribute(MappedAttribute*);
-
- bool isDefault() const { return m_shape == Default; }
-
- bool mapMouseEvent(int x, int y, int width, int height, RenderObject::NodeInfo& info);
-
- virtual IntRect getRect(RenderObject*) const;
-
- String accessKey() const;
- void setAccessKey(const String&);
-
- String alt() const;
- void setAlt(const String&);
-
- String coords() const;
- void setCoords(const String&);
-
- String href() const;
- void setHref(const String&);
-
- bool noHref() const;
- void setNoHref(bool);
-
- String shape() const;
- void setShape(const String&);
-
- int tabIndex() const;
- void setTabIndex(int);
-
- String target() const;
- void setTarget(const String&);
-
-protected:
- Path getRegion(int width, int height) const;
- Path region;
- Length* m_coords;
- int m_coordsLen;
- int lastw, lasth;
- Shape m_shape;
-};
-
-// -------------------------------------------------------------------------
-
-class HTMLMapElement : public HTMLElement {
-public:
- HTMLMapElement(Document*);
- ~HTMLMapElement();
-
- virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
- virtual int tagPriority() const { return 1; }
- virtual bool checkDTD(const Node*);
-
- const AtomicString& getName() const { return m_name; }
-
- virtual void parseMappedAttribute(MappedAttribute*);
-
- bool mapMouseEvent(int x, int y, int width, int height, RenderObject::NodeInfo&);
-
- PassRefPtr<HTMLCollection> areas();
-
- String name() const;
- void setName(const String&);
-
-private:
- AtomicString m_name;
-};
-
} //namespace
#endif
--- /dev/null
+/**
+ * This file is part of the DOM implementation for KDE.
+ *
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+#include "config.h"
+#include "HTMLImageLoader.h"
+
+#include "csshelper.h"
+#include "CachedImage.h"
+#include "DocLoader.h"
+#include "Document.h"
+#include "Element.h"
+#include "EventNames.h"
+#include "HTMLNames.h"
+#include "RenderImage.h"
+
+using namespace std;
+
+namespace WebCore {
+
+using namespace EventNames;
+using namespace HTMLNames;
+
+HTMLImageLoader::HTMLImageLoader(Element* elt)
+ : m_element(elt)
+ , m_image(0)
+ , m_firedLoad(true)
+ , m_imageComplete(true)
+{
+}
+
+HTMLImageLoader::~HTMLImageLoader()
+{
+ if (m_image)
+ m_image->deref(this);
+ m_element->document()->removeImage(this);
+}
+
+void HTMLImageLoader::setLoadingImage(CachedImage *loadingImage)
+{
+ m_firedLoad = false;
+ m_imageComplete = false;
+ m_image = loadingImage;
+}
+
+void HTMLImageLoader::updateFromElement()
+{
+ // If we're not making renderers for the page, then don't load images. We don't want to slow
+ // down the raw HTML parsing case by loading images we don't intend to display.
+ Element* elem = element();
+ Document* doc = elem->document();
+ if (!doc->renderer())
+ return;
+
+ AtomicString attr = elem->getAttribute(elem->hasLocalName(objectTag) ? dataAttr : srcAttr);
+
+ // Treat a lack of src or empty string for src as no image at all.
+ CachedImage *newImage = 0;
+ if (!attr.isEmpty())
+ newImage = doc->docLoader()->requestImage(parseURL(attr));
+
+ CachedImage *oldImage = m_image;
+ if (newImage != oldImage) {
+#ifdef INSTRUMENT_LAYOUT_SCHEDULING
+ if (!doc->ownerElement() && newImage)
+ printf("Image requested at %d\n", doc->elapsedTime());
+#endif
+ setLoadingImage(newImage);
+ if (newImage)
+ newImage->ref(this);
+ if (oldImage)
+ oldImage->deref(this);
+ }
+
+ if (RenderImage* renderer = static_cast<RenderImage*>(elem->renderer()))
+ renderer->resetAnimation();
+}
+
+void HTMLImageLoader::dispatchLoadEvent()
+{
+ if (!m_firedLoad && m_image) {
+ m_firedLoad = true;
+ element()->dispatchHTMLEvent(m_image->isErrorImage() ? errorEvent : loadEvent, false, false);
+ }
+}
+
+void HTMLImageLoader::notifyFinished(CachedObject *image)
+{
+ m_imageComplete = true;
+ Element* elem = element();
+ Document* doc = elem->document();
+ doc->dispatchImageLoadEventSoon(this);
+#ifdef INSTRUMENT_LAYOUT_SCHEDULING
+ if (!doc->ownerElement())
+ printf("Image loaded at %d\n", doc->elapsedTime());
+#endif
+ if (RenderImage* renderer = static_cast<RenderImage*>(elem->renderer()))
+ renderer->setCachedImage(m_image);
+}
+
+}
--- /dev/null
+/*
+ * This file is part of the DOM implementation for KDE.
+ *
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ * Copyright (C) 2004 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ */
+
+#ifndef HTMLImageLoader_H
+#define HTMLImageLoader_H
+
+#include "CachedObjectClient.h"
+
+namespace WebCore {
+
+class Element;
+
+class HTMLImageLoader : public CachedObjectClient {
+public:
+ HTMLImageLoader(Element*);
+ virtual ~HTMLImageLoader();
+
+ virtual void updateFromElement();
+
+ void dispatchLoadEvent();
+
+ Element* element() const { return m_element; }
+ bool imageComplete() const { return m_imageComplete; }
+ CachedImage* image() const { return m_image; }
+
+ // CachedObjectClient API
+ virtual void notifyFinished(CachedObject*);
+
+protected:
+ void setLoadingImage(CachedImage*);
+
+private:
+ Element* m_element;
+ CachedImage* m_image;
+ bool m_firedLoad : 1;
+ bool m_imageComplete : 1;
+};
+
+} //namespace
+
+#endif
#include "FormDataList.h"
#include "Frame.h"
#include "HTMLFormElement.h"
+#include "HTMLImageLoader.h"
#include "HTMLNames.h"
#include "LocalizedStrings.h"
#include "RenderFileButton.h"
#include "RenderTheme.h"
#include "RenderSlider.h"
#include "SelectionController.h"
-#include "html_imageimpl.h"
#include "RenderButton.h"
#include <unicode/ubrk.h>
--- /dev/null
+/**
+ * This file is part of the DOM implementation for KDE.
+ *
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+#include "config.h"
+#include "HTMLMapElement.h"
+
+#include "Document.h"
+#include "HTMLAreaElement.h"
+#include "HTMLCollection.h"
+#include "HTMLNames.h"
+
+using namespace std;
+
+namespace WebCore {
+
+using namespace HTMLNames;
+
+HTMLMapElement::HTMLMapElement(Document *doc)
+ : HTMLElement(mapTag, doc)
+{
+}
+
+HTMLMapElement::~HTMLMapElement()
+{
+ document()->removeImageMap(this);
+}
+
+bool HTMLMapElement::checkDTD(const Node* newChild)
+{
+ // FIXME: This seems really odd, allowing only blocks inside map elements.
+ return newChild->hasTagName(areaTag) || newChild->hasTagName(scriptTag) || inBlockTagList(newChild);
+}
+
+bool HTMLMapElement::mapMouseEvent(int x, int y, const IntSize& size, RenderObject::NodeInfo& info)
+{
+ Node *node = this;
+ while ((node = node->traverseNextNode(this)))
+ if (node->hasTagName(areaTag))
+ if (static_cast<HTMLAreaElement*>(node)->mapMouseEvent(x, y, size, info))
+ return true;
+ return false;
+}
+
+void HTMLMapElement::parseMappedAttribute(MappedAttribute* attr)
+{
+ const QualifiedName& attrName = attr->name();
+ if (attrName == idAttr || attrName == nameAttr) {
+ Document* doc = document();
+ if (attrName == idAttr) {
+ // Call base class so that hasID bit gets set.
+ HTMLElement::parseMappedAttribute(attr);
+ if (doc->htmlMode() != Document::XHtml)
+ return;
+ }
+ doc->removeImageMap(this);
+ m_name = attr->value();
+ if (m_name[0] == '#') {
+ String mapName(m_name.domString().copy());
+ mapName.remove(0, 1);
+ m_name = mapName;
+ }
+ doc->addImageMap(this);
+ } else
+ HTMLElement::parseMappedAttribute(attr);
+}
+
+PassRefPtr<HTMLCollection> HTMLMapElement::areas()
+{
+ return new HTMLCollection(this, HTMLCollection::MAP_AREAS);
+}
+
+String HTMLMapElement::name() const
+{
+ return getAttribute(nameAttr);
+}
+
+void HTMLMapElement::setName(const String& value)
+{
+ setAttribute(nameAttr, value);
+}
+
+}
--- /dev/null
+/*
+ * This file is part of the DOM implementation for KDE.
+ *
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ * Copyright (C) 2004 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ */
+
+#ifndef HTMLMapElement_H
+#define HTMLMapElement_H
+
+#include "HTMLElement.h"
+#include "RenderObject.h" // for RenderObject::NodeInfo
+
+namespace WebCore {
+
+class HTMLMapElement : public HTMLElement {
+public:
+ HTMLMapElement(Document*);
+ ~HTMLMapElement();
+
+ virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
+ virtual int tagPriority() const { return 1; }
+ virtual bool checkDTD(const Node*);
+
+ const AtomicString& getName() const { return m_name; }
+
+ virtual void parseMappedAttribute(MappedAttribute*);
+
+ bool mapMouseEvent(int x, int y, const IntSize&, RenderObject::NodeInfo&);
+
+ PassRefPtr<HTMLCollection> areas();
+
+ String name() const;
+ void setName(const String&);
+
+private:
+ AtomicString m_name;
+};
+
+} //namespace
+
+#endif
#include "Frame.h"
#include "HTMLFormElement.h"
#include "HTMLDocument.h"
+#include "HTMLImageLoader.h"
#include "HTMLNames.h"
+#include "Image.h"
#include "RenderImage.h"
#include "RenderPartObject.h"
#include "RenderWidget.h"
#include "Text.h"
#include "csshelper.h"
-#include "html_imageimpl.h"
namespace WebCore {
#include "HTMLHRElement.h"
#include "HTMLHtmlElement.h"
#include "HTMLIsIndexElement.h"
+#include "HTMLMapElement.h"
#include "HTMLNames.h"
#include "HTMLTableCellElement.h"
#include "HTMLTableRowElement.h"
#define KSVG_SVGImageLoader_H
#if SVG_SUPPORT
-#include "html_imageimpl.h"
+#include "HTMLImageLoader.h"
namespace WebCore
{
class SVGImageElement;
- class SVGImageLoader : public WebCore::HTMLImageLoader {
+ class SVGImageLoader : public HTMLImageLoader {
public:
SVGImageLoader(SVGImageElement *node);
virtual ~SVGImageLoader();
#import "EventNames.h"
#import "FoundationExtras.h"
#import "FrameMac.h"
+#import "HTMLAreaElement.h"
#import "HTMLCollection.h"
#import "HTMLInputElement.h"
+#import "HTMLMapElement.h"
#import "HTMLNames.h"
#import "RenderCanvas.h"
#import "RenderImage.h"
#import "WebCoreFrameBridge.h"
#import "WebCoreFrameView.h"
#import "WebCoreViewFactory.h"
-#import "html_imageimpl.h"
#import "kjs_html.h"
#import "visible_units.h"
if (m_renderer->isImage() && !m_areaElement) {
HTMLMapElement* map = static_cast<RenderImage*>(m_renderer)->imageMap();
if (map) {
- for (Node *current = map->firstChild(); current; current = current->traverseNextNode(map)) {
+ for (Node* current = map->firstChild(); current; current = current->traverseNextNode(map)) {
// add an <area> element for this child if it has a link
// NOTE: can't cache these because they all have the same renderer, which is the cache key, right?
// plus there may be little reason to since they are being added to the handy array
#include "TypingCommand.h"
#include "cssstyleselector.h"
#include "dom2_eventsimpl.h"
-#include "html_imageimpl.h"
#include "htmlediting.h"
#include "kjs_window.h"
#include "markup.h"
#include "Document.h"
#include "GraphicsContext.h"
+#include "HTMLImageElement.h"
#include "HTMLInputElement.h"
-#include "html_imageimpl.h"
+#include "HTMLMapElement.h"
#include "HTMLNames.h"
#include "RenderCanvas.h"
using namespace HTMLNames;
-RenderImage::RenderImage(Node *_node)
- : RenderReplaced(_node)
+RenderImage::RenderImage(Node* n)
+ : RenderReplaced(n)
+ , m_cachedImage(0)
{
- m_cachedImage = 0;
m_selectionState = SelectionNone;
setIntrinsicWidth(0);
setIntrinsicHeight(0);
return i ? i->document()->getImageMap(i->imageMap()) : 0;
}
-bool RenderImage::nodeAtPoint(NodeInfo& info, int _x, int _y, int _tx, int _ty,
- HitTestAction hitTestAction)
+bool RenderImage::nodeAtPoint(NodeInfo& info, int _x, int _y, int _tx, int _ty, HitTestAction hitTestAction)
{
bool inside = RenderReplaced::nodeAtPoint(info, _x, _y, _tx, _ty, hitTestAction);
HTMLMapElement* map = imageMap();
if (map) {
// we're a client side image map
- inside = map->mapMouseEvent(_x - tx, _y - ty, contentWidth(), contentHeight(), info);
+ inside = map->mapMouseEvent(_x - tx, _y - ty, IntSize(contentWidth(), contentHeight()), info);
info.setInnerNonSharedNode(element());
}
}