root/trunk/WebCore/html/HTMLDocument.h

Revision 34574, 3.0 kB (checked in by weinig@apple.com, 3 months ago)

WebCore:

2008-06-15 Darin Adler <darin@apple.com>

Reviewed and tweaked by Sam Weinig.

Fix for <rdar://problem/5908591>
https://bugs.webkit.org/show_bug.cgi?id=18743

Makes DOMImplementation per-document.

Test: http/tests/security/cross-frame-access-DOMImplementation.html

  • bindings/objc/DOMImplementationFront.cpp: (WebCore::DOMImplementationFront::getInterface):
  • bindings/objc/DOMImplementationFront.h:
  • dom/DOMImplementation.cpp: (WebCore::DOMImplementation::hasFeature): (WebCore::DOMImplementation::createDocumentType): (WebCore::DOMImplementation::getInterface): (WebCore::DOMImplementation::createDocument): (WebCore::DOMImplementation::createHTMLDocument):
  • dom/DOMImplementation.h: (WebCore::DOMImplementation::create):
  • dom/Document.cpp: (WebCore::Document::Document): (WebCore::Document::implementation):
  • dom/Document.h: (WebCore::Document::create): (WebCore::Document::createXHTML):
  • dom/DocumentType.cpp:
  • dom/DocumentType.h: (WebCore::DocumentType::create): (WebCore::DocumentType::entities): (WebCore::DocumentType::notations): (WebCore::DocumentType::name): (WebCore::DocumentType::publicId): (WebCore::DocumentType::systemId): (WebCore::DocumentType::internalSubset):
  • dom/Node.cpp: (WebCore::Node::isSupported):
  • dom/XMLTokenizer.cpp: (WebCore::XMLTokenizer::internalSubset):
  • html/HTMLDocument.cpp: (WebCore::HTMLDocument::HTMLDocument):
  • html/HTMLDocument.h: (WebCore::HTMLDocument::create): (WebCore::HTMLDocument::isHTMLDocument):
  • html/HTMLParser.cpp: (WebCore::HTMLParser::parseDoctypeToken):
  • html/HTMLViewSourceDocument.cpp: (WebCore::HTMLViewSourceDocument::HTMLViewSourceDocument): (WebCore::HTMLViewSourceDocument::createTokenizer):
  • html/HTMLViewSourceDocument.h: (WebCore::HTMLViewSourceDocument::create):
  • loader/CachedFont.cpp: (WebCore::CachedFont::ensureSVGFontData):
  • loader/FTPDirectoryDocument.cpp: (WebCore::FTPDirectoryDocument::FTPDirectoryDocument):
  • loader/FTPDirectoryDocument.h: (WebCore::FTPDirectoryDocument::create):
  • loader/FrameLoader.cpp: (WebCore::FrameLoader::begin):
  • loader/ImageDocument.cpp: (WebCore::ImageDocument::ImageDocument):
  • loader/ImageDocument.h: (WebCore::ImageDocument::create): (WebCore::ImageDocument::isImageDocument):
  • loader/PluginDocument.cpp: (WebCore::PluginDocument::PluginDocument):
  • loader/PluginDocument.h: (WebCore::PluginDocument::create): (WebCore::PluginDocument::isPluginDocument):
  • loader/TextDocument.cpp: (WebCore::TextTokenizer::checkBuffer): (WebCore::TextDocument::TextDocument): (WebCore::createTextTokenizer):
  • loader/TextDocument.h: (WebCore::TextDocument::create):
  • svg/SVGDocument.cpp: (WebCore::SVGDocument::SVGDocument):
  • svg/SVGDocument.h: (WebCore::SVGDocument::create):
  • svg/SVGElement.cpp: (WebCore::SVGElement::isSupported):
  • svg/SVGTests.cpp: (WebCore::SVGTests::isValid):
  • xml/DOMParser.cpp: (WebCore::DOMParser::parseFromString):

LayoutTests:

2008-06-15 Darin Adler <darin@apple.com>

Reviewed and tweaked by Sam Weinig.

Test for <rdar://problem/5908591>
https://bugs.webkit.org/show_bug.cgi?id=18743

  • http/tests/security/cross-frame-access-DOMImplementation-expected.txt: Added.
  • http/tests/security/cross-frame-access-DOMImplementation.html: Added.
  • http/tests/security/resources/cross-frame-iframe-for-DOMImplementation-test.html: Added.
  • Property svn:eol-style set to native
Line 
1/*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 *           (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * Copyright (C) 2004, 2006, 2007, 2008 Apple Inc. All rights reserved.
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 * Library General Public License for more details.
15 *
16 * You should have received a copy of the GNU Library General Public License
17 * along with this library; see the file COPYING.LIB.  If not, write to
18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 * Boston, MA 02110-1301, USA.
20 *
21 */
22
23#ifndef HTMLDocument_h
24#define HTMLDocument_h
25
26#include "CachedResourceClient.h"
27#include "Document.h"
28
29namespace WebCore {
30
31class FrameView;
32class HTMLElement;
33
34class HTMLDocument : public Document, public CachedResourceClient {
35public:
36    static PassRefPtr<HTMLDocument> create(Frame* frame)
37    {
38        return new HTMLDocument(frame);
39    }
40    virtual ~HTMLDocument();
41
42    int width();
43    int height();
44
45    String dir();
46    void setDir(const String&);
47
48    String designMode() const;
49    void setDesignMode(const String&);
50
51    String compatMode() const;
52
53    Element* activeElement();
54    bool hasFocus();
55
56    String bgColor();
57    void setBgColor(const String&);
58    String fgColor();
59    void setFgColor(const String&);
60    String alinkColor();
61    void setAlinkColor(const String&);
62    String linkColor();
63    void setLinkColor(const String&);
64    String vlinkColor();
65    void setVlinkColor(const String&);
66
67    void clear();
68
69    void captureEvents();
70    void releaseEvents();
71
72    virtual bool childAllowed(Node*);
73
74    virtual PassRefPtr<Element> createElement(const AtomicString& tagName, ExceptionCode&);
75
76    void addNamedItem(const AtomicString& name);
77    void removeNamedItem(const AtomicString& name);
78    bool hasNamedItem(AtomicStringImpl* name);
79
80    void addExtraNamedItem(const AtomicString& name);
81    void removeExtraNamedItem(const AtomicString& name);
82    bool hasExtraNamedItem(AtomicStringImpl* name);
83
84    typedef HashMap<AtomicStringImpl*, int> NameCountMap;
85
86protected:
87    HTMLDocument(Frame*);
88
89private:
90    virtual bool isHTMLDocument() const { return true; }
91    virtual Tokenizer* createTokenizer();
92    virtual void determineParseMode();
93
94    NameCountMap m_namedItemCounts;
95    NameCountMap m_extraNamedItemCounts;
96};
97
98inline bool HTMLDocument::hasNamedItem(AtomicStringImpl* name)
99{
100    ASSERT(name);
101    return m_namedItemCounts.contains(name);
102}
103
104inline bool HTMLDocument::hasExtraNamedItem(AtomicStringImpl* name)
105{
106    ASSERT(name);
107    return m_extraNamedItemCounts.contains(name);
108}
109
110} // namespace
111
112#endif
Note: See TracBrowser for help on using the browser.