Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
KDE Libraries
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Unmaintained
KDE Libraries
Commits
018de9de
Commit
018de9de
authored
May 10, 2010
by
Maks Orlovich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix an isolation buglet involving DOMImplementation.
svn path=/trunk/KDE/kdelibs/; revision=1125019
parent
6dd25d41
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
52 additions
and
72 deletions
+52
-72
khtml/dom/dom_doc.cpp
khtml/dom/dom_doc.cpp
+4
-3
khtml/dom/html_document.cpp
khtml/dom/html_document.cpp
+2
-2
khtml/html/html_documentimpl.cpp
khtml/html/html_documentimpl.cpp
+2
-2
khtml/html/html_documentimpl.h
khtml/html/html_documentimpl.h
+1
-1
khtml/khtml_part.cpp
khtml/khtml_part.cpp
+3
-3
khtml/svg/SVGDocument.cpp
khtml/svg/SVGDocument.cpp
+2
-2
khtml/svg/SVGDocument.h
khtml/svg/SVGDocument.h
+1
-1
khtml/svg/SVGElement.cpp
khtml/svg/SVGElement.cpp
+1
-4
khtml/svg/SVGTests.cpp
khtml/svg/SVGTests.cpp
+1
-1
khtml/xml/dom_docimpl.cpp
khtml/xml/dom_docimpl.cpp
+20
-31
khtml/xml/dom_docimpl.h
khtml/xml/dom_docimpl.h
+13
-21
khtml/xml/dom_nodeimpl.cpp
khtml/xml/dom_nodeimpl.cpp
+2
-1
No files found.
khtml/dom/dom_doc.cpp
View file @
018de9de
...
...
@@ -117,7 +117,8 @@ DOMImplementation DOMImplementation::getInterface(const DOMString &feature) cons
if
(
!
impl
)
throw
DOMException
(
DOMException
::
NOT_FOUND_ERR
);
return
impl
->
getInterface
(
feature
);
// This method is a no-op for us.
return
impl
;
}
CSSStyleSheet
DOMImplementation
::
createCSSStyleSheet
(
const
DOMString
&
title
,
const
DOMString
&
media
)
...
...
@@ -149,7 +150,7 @@ Document::Document()
:
Node
()
{
// we always want an implementation
impl
=
DOMImplementationImpl
::
instance
()
->
createDocument
();
impl
=
DOMImplementationImpl
::
createDocument
();
impl
->
ref
();
}
...
...
@@ -158,7 +159,7 @@ Document::Document(bool create)
{
if
(
create
)
{
impl
=
DOMImplementationImpl
::
instance
()
->
createDocument
();
impl
=
DOMImplementationImpl
::
createDocument
();
impl
->
ref
();
}
else
...
...
khtml/dom/html_document.cpp
View file @
018de9de
...
...
@@ -34,7 +34,7 @@ using namespace DOM;
HTMLDocument
::
HTMLDocument
()
:
Document
(
false
)
// create the impl here
{
impl
=
DOMImplementationImpl
::
instance
()
->
createHTMLDocument
();
impl
=
DOMImplementationImpl
::
createHTMLDocument
();
impl
->
ref
();
}
...
...
@@ -42,7 +42,7 @@ HTMLDocument::HTMLDocument() : Document(false) // create the impl here
HTMLDocument
::
HTMLDocument
(
KHTMLView
*
parent
)
:
Document
(
false
)
// create the impl here
{
impl
=
DOMImplementationImpl
::
instance
()
->
createHTMLDocument
(
parent
);
impl
=
DOMImplementationImpl
::
createHTMLDocument
(
parent
);
impl
->
ref
();
}
...
...
khtml/html/html_documentimpl.cpp
View file @
018de9de
...
...
@@ -57,8 +57,8 @@ using namespace DOM;
using
namespace
khtml
;
HTMLDocumentImpl
::
HTMLDocumentImpl
(
DOMImplementationImpl
*
_implementation
,
KHTMLView
*
v
)
:
DocumentImpl
(
_implementation
,
v
)
HTMLDocumentImpl
::
HTMLDocumentImpl
(
KHTMLView
*
v
)
:
DocumentImpl
(
v
)
{
// kDebug( 6090 ) << "HTMLDocumentImpl constructor this = " << this;
htmlElement
=
0
;
...
...
khtml/html/html_documentimpl.h
View file @
018de9de
...
...
@@ -44,7 +44,7 @@ class HTMLDocumentImpl : public DOM::DocumentImpl
{
Q_OBJECT
public:
HTMLDocumentImpl
(
DOMImplementationImpl
*
_implementation
,
KHTMLView
*
v
=
0
);
HTMLDocumentImpl
(
KHTMLView
*
v
=
0
);
~
HTMLDocumentImpl
();
virtual
bool
isHTMLDocument
()
const
{
return
true
;
}
...
...
khtml/khtml_part.cpp
View file @
018de9de
...
...
@@ -1995,12 +1995,12 @@ void KHTMLPart::begin( const KUrl &url, int xOffset, int yOffset )
bool
servedAsXML
=
mime
&&
mime
->
is
(
"text/xml"
);
// ### not sure if XHTML documents served as text/xml should use DocumentImpl or HTMLDocumentImpl
if
(
servedAsSVG
)
{
d
->
m_doc
=
DOMImplementationImpl
::
instance
()
->
createSVGDocument
(
d
->
m_view
);
d
->
m_doc
=
DOMImplementationImpl
::
createSVGDocument
(
d
->
m_view
);
}
else
{
if
(
servedAsXML
&&
!
servedAsXHTML
)
{
// any XML derivative, except XHTML
d
->
m_doc
=
DOMImplementationImpl
::
instance
()
->
createXMLDocument
(
d
->
m_view
);
d
->
m_doc
=
DOMImplementationImpl
::
createXMLDocument
(
d
->
m_view
);
}
else
{
d
->
m_doc
=
DOMImplementationImpl
::
instance
()
->
createHTMLDocument
(
d
->
m_view
);
d
->
m_doc
=
DOMImplementationImpl
::
createHTMLDocument
(
d
->
m_view
);
// HTML or XHTML? (#86446)
static_cast
<
HTMLDocumentImpl
*>
(
d
->
m_doc
)
->
setHTMLRequested
(
!
servedAsXHTML
);
}
...
...
khtml/svg/SVGDocument.cpp
View file @
018de9de
...
...
@@ -37,8 +37,8 @@
namespace
WebCore
{
SVGDocument
::
SVGDocument
(
DOMImplementation
*
i
,
Frame
*
frame
)
:
Document
(
i
,
frame
)
SVGDocument
::
SVGDocument
(
Frame
*
frame
)
:
Document
(
frame
)
{
}
...
...
khtml/svg/SVGDocument.h
View file @
018de9de
...
...
@@ -36,7 +36,7 @@ namespace WebCore {
class
SVGDocument
:
public
Document
{
public:
SVGDocument
(
DOMImplementation
*
,
Frame
*
);
SVGDocument
(
Frame
*
);
virtual
~
SVGDocument
();
virtual
bool
isSVGDocument
()
const
{
return
true
;
}
...
...
khtml/svg/SVGElement.cpp
View file @
018de9de
...
...
@@ -64,10 +64,7 @@ SVGElement::~SVGElement()
bool
SVGElement
::
isSupported
(
StringImpl
*
feature
,
StringImpl
*
version
)
const
{
if
(
DOMImplementation
::
instance
()
->
hasFeature
(
feature
,
version
))
return
true
;
return
DOMImplementation
::
instance
()
->
hasFeature
(
feature
,
version
);
return
DOMImplementation
::
hasFeature
(
feature
,
version
);
}
...
...
khtml/svg/SVGTests.cpp
View file @
018de9de
...
...
@@ -78,7 +78,7 @@ bool SVGTests::isValid() const
if
(
m_features
)
{
for
(
unsigned
long
i
=
0
;
i
<
m_features
->
numberOfItems
();
i
++
)
{
String
value
=
m_features
->
getItem
(
i
,
ec
);
if
(
value
.
isEmpty
()
||
!
DOMImplementation
::
instance
()
->
hasFeature
(
value
,
String
()))
if
(
value
.
isEmpty
()
||
!
DOMImplementation
::
hasFeature
(
value
,
String
()))
return
false
;
}
}
...
...
khtml/xml/dom_docimpl.cpp
View file @
018de9de
...
...
@@ -132,8 +132,6 @@ using namespace khtml;
// ------------------------------------------------------------------------
DOMImplementationImpl
*
DOMImplementationImpl
::
m_instance
=
0
;
DOMImplementationImpl
::
DOMImplementationImpl
()
{
}
...
...
@@ -197,13 +195,7 @@ DocumentTypeImpl *DOMImplementationImpl::createDocumentType( const DOMString &qu
return
0
;
}
return
new
DocumentTypeImpl
(
this
,
0
,
qualifiedName
,
publicId
,
systemId
);
}
DOMImplementationImpl
*
DOMImplementationImpl
::
getInterface
(
const
DOMString
&
/*feature*/
)
const
{
// ###
return
0
;
return
new
DocumentTypeImpl
(
this
,
0
,
qualifiedName
,
publicId
,
systemId
);
}
DocumentImpl
*
DOMImplementationImpl
::
createDocument
(
const
DOMString
&
namespaceURI
,
const
DOMString
&
qualifiedName
,
...
...
@@ -219,7 +211,10 @@ DocumentImpl *DOMImplementationImpl::createDocument( const DOMString &namespaceU
// WRONG_DOCUMENT_ERR: Raised if doctype has already been used with a different document or was
// created from a different implementation.
if
(
dtype
&&
(
dtype
->
document
()
||
dtype
->
implementation
()
!=
this
))
{
// We elide the "different implementation" case here, since we're not doing interop
// of different implementations, and different impl objects exist only for
// isolation reasons
if
(
dtype
&&
dtype
->
document
())
{
exceptioncode
=
DOMException
::
WRONG_DOCUMENT_ERR
;
return
0
;
}
...
...
@@ -227,9 +222,9 @@ DocumentImpl *DOMImplementationImpl::createDocument( const DOMString &namespaceU
// ### view can be 0 which can cause problems
DocumentImpl
*
doc
;
if
(
namespaceURI
==
XHTML_NAMESPACE
)
doc
=
new
HTMLDocumentImpl
(
this
,
v
);
doc
=
new
HTMLDocumentImpl
(
v
);
else
doc
=
new
DocumentImpl
(
this
,
v
);
doc
=
new
DocumentImpl
(
v
);
if
(
dtype
)
{
dtype
->
setDocument
(
doc
);
...
...
@@ -264,21 +259,21 @@ CSSStyleSheetImpl *DOMImplementationImpl::createCSSStyleSheet(DOMStringImpl* tit
DocumentImpl
*
DOMImplementationImpl
::
createDocument
(
KHTMLView
*
v
)
{
DocumentImpl
*
doc
=
new
DocumentImpl
(
this
,
v
);
DocumentImpl
*
doc
=
new
DocumentImpl
(
v
);
return
doc
;
}
XMLDocumentImpl
*
DOMImplementationImpl
::
createXMLDocument
(
KHTMLView
*
v
)
{
XMLDocumentImpl
*
doc
=
new
XMLDocumentImpl
(
this
,
v
);
XMLDocumentImpl
*
doc
=
new
XMLDocumentImpl
(
v
);
return
doc
;
}
HTMLDocumentImpl
*
DOMImplementationImpl
::
createHTMLDocument
(
KHTMLView
*
v
)
{
HTMLDocumentImpl
*
doc
=
new
HTMLDocumentImpl
(
this
,
v
);
HTMLDocumentImpl
*
doc
=
new
HTMLDocumentImpl
(
v
);
return
doc
;
}
...
...
@@ -286,7 +281,7 @@ HTMLDocumentImpl *DOMImplementationImpl::createHTMLDocument( KHTMLView *v )
// create SVG document
WebCore
::
SVGDocument
*
DOMImplementationImpl
::
createSVGDocument
(
KHTMLView
*
v
)
{
WebCore
::
SVGDocument
*
doc
=
new
WebCore
::
SVGDocument
(
this
,
v
);
WebCore
::
SVGDocument
*
doc
=
new
WebCore
::
SVGDocument
(
v
);
return
doc
;
}
...
...
@@ -303,16 +298,6 @@ HTMLDocumentImpl* DOMImplementationImpl::createHTMLDocument( const DOMString& ti
return
r
;
}
DOMImplementationImpl
*
DOMImplementationImpl
::
instance
()
{
if
(
!
m_instance
)
{
m_instance
=
new
DOMImplementationImpl
();
m_instance
->
ref
();
}
return
m_instance
;
}
// ------------------------------------------------------------------------
ElementMappingCache
::
ElementMappingCache
()
:
m_dict
()
...
...
@@ -387,7 +372,7 @@ typedef QList<DocumentImpl*> ChangedDocuments ;
K_GLOBAL_STATIC
(
ChangedDocuments
,
s_changedDocuments
)
// KHTMLView might be 0
DocumentImpl
::
DocumentImpl
(
DOMImplementationImpl
*
_implementation
,
KHTMLView
*
v
)
DocumentImpl
::
DocumentImpl
(
KHTMLView
*
v
)
:
NodeBaseImpl
(
0
),
m_svgExtensions
(
0
),
m_counterDict
(),
m_imageLoadEventTimer
(
0
)
{
...
...
@@ -417,8 +402,7 @@ DocumentImpl::DocumentImpl(DOMImplementationImpl *_implementation, KHTMLView *v)
m_tokenizer
=
0
;
m_decoder
=
0
;
m_doctype
=
0
;
m_implementation
=
_implementation
;
m_implementation
->
ref
();
m_implementation
=
0
;
pMode
=
Strict
;
hMode
=
XHtml
;
m_htmlCompat
=
false
;
...
...
@@ -532,7 +516,8 @@ DocumentImpl::~DocumentImpl()
if
(
m_elemSheet
)
m_elemSheet
->
deref
();
if
(
m_doctype
)
m_doctype
->
deref
();
m_implementation
->
deref
();
if
(
m_implementation
)
m_implementation
->
deref
();
delete
m_dynamicDomRestyler
;
delete
m_jsEditor
;
m_defaultView
->
deref
();
...
...
@@ -559,6 +544,10 @@ DocumentImpl::~DocumentImpl()
DOMImplementationImpl
*
DocumentImpl
::
implementation
()
const
{
if
(
!
m_implementation
)
{
m_implementation
=
new
DOMImplementationImpl
();
m_implementation
->
ref
();
}
return
m_implementation
;
}
...
...
@@ -2120,7 +2109,7 @@ WTF::PassRefPtr<NodeImpl> DocumentImpl::cloneNode ( bool deep )
#endif
int
exceptioncode
;
WTF
::
RefPtr
<
NodeImpl
>
clone
=
m_implementation
->
createDocument
(
""
,
WTF
::
RefPtr
<
NodeImpl
>
clone
=
DOMImplementationImpl
::
createDocument
(
""
,
""
,
0
,
0
,
exceptioncode
);
...
...
khtml/xml/dom_docimpl.h
View file @
018de9de
...
...
@@ -114,34 +114,25 @@ public:
DOMImplementationImpl
();
~
DOMImplementationImpl
();
// DOM methods & attributes for DOMImplementation
bool
hasFeature
(
const
DOMString
&
feature
,
const
DOMString
&
version
);
// DOM methods & attributes for DOMImplementation
.
static
bool
hasFeature
(
const
DOMString
&
feature
,
const
DOMString
&
version
);
DocumentTypeImpl
*
createDocumentType
(
const
DOMString
&
qualifiedName
,
const
DOMString
&
publicId
,
const
DOMString
&
systemId
,
int
&
exceptioncode
);
DocumentImpl
*
createDocument
(
const
DOMString
&
namespaceURI
,
const
DOMString
&
qualifiedName
,
static
DocumentImpl
*
createDocument
(
const
DOMString
&
namespaceURI
,
const
DOMString
&
qualifiedName
,
DocumentTypeImpl
*
dtype
,
KHTMLView
*
v
,
int
&
exceptioncode
);
DOMImplementationImpl
*
getInterface
(
const
DOMString
&
feature
)
const
;
// From the DOMImplementationCSS interface
CSSStyleSheetImpl
*
createCSSStyleSheet
(
DOMStringImpl
*
title
,
DOMStringImpl
*
media
,
int
&
exceptioncode
);
static
CSSStyleSheetImpl
*
createCSSStyleSheet
(
DOMStringImpl
*
title
,
DOMStringImpl
*
media
,
int
&
exceptioncode
);
// From the HTMLDOMImplementation interface
HTMLDocumentImpl
*
createHTMLDocument
(
const
DOMString
&
title
);
static
HTMLDocumentImpl
*
createHTMLDocument
(
const
DOMString
&
title
);
// Other methods (not part of DOM)
DocumentImpl
*
createDocument
(
KHTMLView
*
v
=
0
);
XMLDocumentImpl
*
createXMLDocument
(
KHTMLView
*
v
=
0
);
HTMLDocumentImpl
*
createHTMLDocument
(
KHTMLView
*
v
=
0
);
WebCore
::
SVGDocument
*
createSVGDocument
(
KHTMLView
*
v
=
0
);
// Returns the static instance of this class - only one instance of this class should
// ever be present, and is used as a factory method for creating DocumentImpl objects
static
DOMImplementationImpl
*
instance
();
protected:
static
DOMImplementationImpl
*
m_instance
;
static
DocumentImpl
*
createDocument
(
KHTMLView
*
v
=
0
);
static
XMLDocumentImpl
*
createXMLDocument
(
KHTMLView
*
v
=
0
);
static
HTMLDocumentImpl
*
createHTMLDocument
(
KHTMLView
*
v
=
0
);
static
WebCore
::
SVGDocument
*
createSVGDocument
(
KHTMLView
*
v
=
0
);
};
/**
...
...
@@ -203,7 +194,7 @@ class DocumentImpl : public QObject, private khtml::CachedObjectClient, public N
{
Q_OBJECT
public:
DocumentImpl
(
DOMImplementationImpl
*
_implementation
,
KHTMLView
*
v
);
DocumentImpl
(
KHTMLView
*
v
);
~
DocumentImpl
();
// DOM methods & attributes for Document
...
...
@@ -640,7 +631,8 @@ protected:
QString
m_baseTarget
;
mutable
DocumentTypeImpl
*
m_doctype
;
DOMImplementationImpl
*
m_implementation
;
mutable
DOMImplementationImpl
*
m_implementation
;
// lazily created
QString
m_usersheet
;
QString
m_printSheet
;
...
...
@@ -806,7 +798,7 @@ protected:
class
XMLDocumentImpl
:
public
DocumentImpl
{
public:
XMLDocumentImpl
(
DOMImplementationImpl
*
_implementation
,
KHTMLView
*
v
)
:
DocumentImpl
(
_implementation
,
v
)
{
}
XMLDocumentImpl
(
KHTMLView
*
v
)
:
DocumentImpl
(
v
)
{
}
virtual
void
close
(
);
};
...
...
khtml/xml/dom_nodeimpl.cpp
View file @
018de9de
...
...
@@ -1272,7 +1272,7 @@ bool NodeImpl::hasAttributes() const
bool
NodeImpl
::
isSupported
(
const
DOMString
&
feature
,
const
DOMString
&
version
)
{
return
DOMImplementationImpl
::
instance
()
->
hasFeature
(
feature
,
version
);
return
DOMImplementationImpl
::
hasFeature
(
feature
,
version
);
}
DocumentImpl
*
NodeImpl
::
ownerDocument
()
const
...
...
@@ -1454,6 +1454,7 @@ void NodeImpl::setDocument(DocumentImpl* doc)
DOM
::
DOMString
DOM
::
NodeImpl
::
lookupNamespaceURI
(
const
DOM
::
DOMString
&
prefix
)
{
//for details see http://www.w3.org/TR/DOM-Level-3-Core/namespaces-algorithms.html#lookupNamespaceURIAlgo
switch
(
this
->
nodeType
()
)
{
case
Node
::
ELEMENT_NODE
:
if
(
!
this
->
namespaceURI
().
isNull
()
&&
this
->
prefix
()
==
prefix
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment