[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: branches/KDE/4.2/kdelibs/khtml
From: Maks Orlovich <maksim () kde ! org>
Date: 2009-03-21 16:06:38
Message-ID: 1237651598.079656.19676.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 942373 by orlovich:
Merged revision:r941604 | vtokarev | 2009-03-19 21:49:24 -0400 (Thu, 19 Mar 2009) | 2 lines
Use optimized version of getAttribute, store DOMString for contentLanguage
in the document, to avoid conversions
M +16 -18 css/cssstyleselector.cpp
M +2 -29 xml/dom_docimpl.h
--- branches/KDE/4.2/kdelibs/khtml/css/cssstyleselector.cpp #942372:942373
@@ -1661,35 +1661,33 @@
if (e == element) {
e->document()->dynamicDomRestyler().addDependency(ATTR_LANG, PersonalDependency);
e->document()->dynamicDomRestyler().addDependency(ATTR_LANG, AncestorDependency);
- }
- else if (isAncestor)
+ } else if (isAncestor)
e->document()->dynamicDomRestyler().addDependency(ATTR_LANG, AncestorDependency);
else
e->document()->dynamicDomRestyler().addDependency(ATTR_LANG, PredecessorDependency);
// ### check xml:lang attribute in XML and XHTML documents
- DOMString value = e->getAttribute(ATTR_LANG);
+ DOMStringImpl* value = e->getAttributeImplById(ATTR_LANG);
// The LANG attribute is inherited like a property
NodeImpl *n = e->parent();;
- while (n && value.isEmpty()) {
+ while (n && !(value && value->length())) {
if (n->isElementNode()) {
- value = static_cast<ElementImpl*>(n)->getAttribute(ATTR_LANG);
- } else
- if (n->isDocumentNode()) {
- value = static_cast<DocumentImpl*>(n)->contentLanguage();
+ value = static_cast<ElementImpl*>(n)->getAttributeImplById(ATTR_LANG);
+ } else if (n->isDocumentNode()) {
+ value = static_cast<DocumentImpl*>(n)->contentLanguage().implementation();
}
n = n->parent();
}
- if (value.isEmpty()) return false;
+ if (!(value && value->length()))
+ return false;
- QString langAttr = value.string();
- QString langSel = sel->string_arg.string();
-
- if(langAttr.length() < langSel.length()) return false;
-
- langAttr = langAttr.toLower();
- langSel = langSel.toLower();
-// kDebug(6080) << ":lang " << langAttr << "=" << langSel << "?";
- return (langAttr == langSel || langAttr.startsWith(langSel+'-'));
+ DOMStringImpl* selValue = sel->value.impl();
+ if (value->length() < selValue->length())
+ return false;
+ if (!value->startsWith(selValue))
+ return false;
+ if (value->length() != selValue->length() && (*value)[selValue->length()].unicode() != '-')
+ return false;
+ return true;
}
case CSSSelector::PseudoNot: {
// check the simple selector
--- branches/KDE/4.2/kdelibs/khtml/xml/dom_docimpl.h #942372:942373
@@ -577,7 +577,7 @@
return m_getElementByIdCache;
}
- QString contentLanguage() const { return m_contentLanguage; }
+ DOMString contentLanguage() const { return m_contentLanguage; }
void setContentLanguage(const QString& cl) { m_contentLanguage = cl; }
khtml::DynamicDomRestyler& dynamicDomRestyler() { return *m_dynamicDomRestyler; }
@@ -609,7 +609,7 @@
QString m_printSheet;
QStringList m_availableSheets;
- QString m_contentLanguage;
+ DOMString m_contentLanguage;
// Track the number of currently loading top-level stylesheets. Sheets
// loaded using the @import directive are not included in this count.
@@ -632,33 +632,6 @@
unsigned int m_domtree_version;
- struct IdNameMapping {
- IdNameMapping(unsigned short _start)
- : idStart(_start), count(0) {}
- ~IdNameMapping() {
- QHashIterator<long,DOM::DOMStringImpl*> it(names);
- while (it.hasNext())
- it.next().value()->deref();
- }
- unsigned short idStart;
- unsigned short count;
- QHash<long,DOM::DOMStringImpl*> names;
- QHash<QString,void*> ids;
-
- void addAlias(DOMStringImpl* _prefix, DOMStringImpl* _name, bool cs, NodeImpl::Id id) {
- if(_prefix && _prefix->l) {
- QString n(_name->s, _name->l);
- QString px( _prefix->s, _prefix->l );
- QString name = cs ? n : n.toUpper();
- QString qn("aliases: " + (cs ? px : px.toUpper()) + ":" + name);
- if (!ids.contains( qn )) {
- ids.insert( qn, (void*)id );
- }
- }
- }
-
- };
-
WebCore::SVGDocumentExtensions* m_svgExtensions;
QList<NodeIteratorImpl*> m_nodeIterators;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic