diff options
| author | Simon Hausmann <simon.hausmann@nokia.com> | 2012-09-14 16:29:47 +0200 |
|---|---|---|
| committer | Simon Hausmann <simon.hausmann@nokia.com> | 2012-09-14 16:29:47 +0200 |
| commit | d0424a769059c84ae20beb3c217812792ea6726b (patch) | |
| tree | 6f94a5c3db8c52c6694ee56498542a6c35417350 /Source/WebCore/dom/Element.cpp | |
| parent | 88a04ac016f57c2d78e714682445dff2e7db4ade (diff) | |
| download | qtwebkit-d0424a769059c84ae20beb3c217812792ea6726b.tar.gz | |
Imported WebKit commit 37c5e5041d39a14ea0d429a77ebd352e4bd26516 (http://svn.webkit.org/repository/webkit/trunk@128608)
New snapshot that enables WebKit2 build on Windows (still some bugs) and allows for WebKit to be built with qmake && make
Diffstat (limited to 'Source/WebCore/dom/Element.cpp')
| -rw-r--r-- | Source/WebCore/dom/Element.cpp | 55 |
1 files changed, 46 insertions, 9 deletions
diff --git a/Source/WebCore/dom/Element.cpp b/Source/WebCore/dom/Element.cpp index 5372c2228..0d448e111 100644 --- a/Source/WebCore/dom/Element.cpp +++ b/Source/WebCore/dom/Element.cpp @@ -755,17 +755,36 @@ void Element::parseAttribute(const Attribute& attribute) classAttributeChanged(attribute.value()); } -void Element::classAttributeChanged(const AtomicString& newClassString) +template <typename CharacterType> +static inline bool classStringHasClassName(const CharacterType* characters, unsigned length) { - const UChar* characters = newClassString.characters(); - unsigned length = newClassString.length(); - unsigned i; - for (i = 0; i < length; ++i) { + ASSERT(length > 0); + + unsigned i = 0; + do { if (isNotHTMLSpace(characters[i])) break; - } - bool hasClass = i < length; - if (hasClass) { + ++i; + } while (i < length); + + return i < length; +} + +static inline bool classStringHasClassName(const AtomicString& newClassString) +{ + unsigned length = newClassString.length(); + + if (!length) + return false; + + if (newClassString.is8Bit()) + return classStringHasClassName(newClassString.characters8(), length); + return classStringHasClassName(newClassString.characters16(), length); +} + +void Element::classAttributeChanged(const AtomicString& newClassString) +{ + if (classStringHasClassName(newClassString)) { const bool shouldFoldCase = document()->inQuirksMode(); ensureAttributeData()->setClass(newClassString, shouldFoldCase); } else if (attributeData()) @@ -2043,6 +2062,24 @@ const AtomicString& Element::webkitRegionOverset() const return undefinedState; } +#if ENABLE(CSS_REGIONS) + +Vector<RefPtr<Range> > Element::webkitGetRegionFlowRanges() const +{ + document()->updateLayoutIgnorePendingStylesheets(); + + Vector<RefPtr<Range> > rangeObjects; + if (document()->cssRegionsEnabled() && renderer() && renderer()->isRenderRegion()) { + RenderRegion* region = toRenderRegion(renderer()); + if (region->isValid()) + region->getRanges(rangeObjects); + } + + return rangeObjects; +} + +#endif + #ifndef NDEBUG bool Element::fastAttributeLookupAllowed(const QualifiedName& name) const { @@ -2246,7 +2283,7 @@ void Element::createMutableAttributeData() if (!m_attributeData) m_attributeData = ElementAttributeData::create(); else - m_attributeData = m_attributeData->makeMutable(); + m_attributeData = m_attributeData->makeMutableCopy(); } } // namespace WebCore |
