Diff
Modified: trunk/Source/WebCore/CMakeLists.txt (134218 => 134219)
--- trunk/Source/WebCore/CMakeLists.txt 2012-11-12 13:52:07 UTC (rev 134218)
+++ trunk/Source/WebCore/CMakeLists.txt 2012-11-12 13:54:53 UTC (rev 134219)
@@ -1540,6 +1540,7 @@
html/shadow/MediaControlRootElement.cpp
html/shadow/MeterShadowElement.cpp
html/shadow/ProgressShadowElement.cpp
+ html/shadow/SelectRuleFeatureSet.cpp
html/shadow/SliderThumbElement.cpp
html/shadow/SpinButtonElement.cpp
html/shadow/TextControlInnerElements.cpp
Modified: trunk/Source/WebCore/ChangeLog (134218 => 134219)
--- trunk/Source/WebCore/ChangeLog 2012-11-12 13:52:07 UTC (rev 134218)
+++ trunk/Source/WebCore/ChangeLog 2012-11-12 13:54:53 UTC (rev 134219)
@@ -1,3 +1,44 @@
+2012-11-12 Shinya Kawanaka <[email protected]>
+
+ [Refactoring] Create SelectRuleFeatureSet for collecting RuleFeatureSet for select attribute
+ https://bugs.webkit.org/show_bug.cgi?id=101891
+
+ Reviewed by Hajime Morita.
+
+ We would like to have another class for RuleFeatureSet to collect 'select' attribute features,
+ since it will have more features than the original RuleFeatureSet has.
+
+ Also, some methods of ElementShadow are removed and we provide a method to get SelectRuleFeatureSet itself.
+
+ No new tests, no change in behavior.
+
+ * CMakeLists.txt:
+ * GNUmakefile.list.am:
+ * Target.pri:
+ * WebCore.gypi:
+ * WebCore.vcproj/WebCore.vcproj:
+ * WebCore.xcodeproj/project.pbxproj:
+ * dom/ElementShadow.h:
+ (ElementShadow):
+ (WebCore::ElementShadow::selectRuleFeatureSet):
+ (WebCore):
+ * html/shadow/SelectRuleFeatureSet.cpp: Added.
+ (WebCore):
+ (WebCore::SelectRuleFeatureSet::SelectRuleFeatureSet):
+ (WebCore::SelectRuleFeatureSet::add):
+ (WebCore::SelectRuleFeatureSet::clear):
+ (WebCore::SelectRuleFeatureSet::collectFeaturesFromSelector):
+ * html/shadow/SelectRuleFeatureSet.h: Added.
+ (WebCore):
+ (SelectRuleFeatureSet):
+ (WebCore::SelectRuleFeatureSet::hasSelectorForId):
+ (WebCore::SelectRuleFeatureSet::hasSelectorForClass):
+ (WebCore::SelectRuleFeatureSet::hasSelectorForAttribute):
+ * testing/Internals.cpp:
+ (WebCore::Internals::hasSelectorForIdInShadow):
+ (WebCore::Internals::hasSelectorForClassInShadow):
+ (WebCore::Internals::hasSelectorForAttributeInShadow):
+
2012-11-13 Keishi Hattori <[email protected]>
Build fix for Chromium Android (caused by r134216)
Modified: trunk/Source/WebCore/GNUmakefile.list.am (134218 => 134219)
--- trunk/Source/WebCore/GNUmakefile.list.am 2012-11-12 13:52:07 UTC (rev 134218)
+++ trunk/Source/WebCore/GNUmakefile.list.am 2012-11-12 13:54:53 UTC (rev 134219)
@@ -3554,6 +3554,8 @@
Source/WebCore/html/shadow/MeterShadowElement.h \
Source/WebCore/html/shadow/ProgressShadowElement.cpp \
Source/WebCore/html/shadow/ProgressShadowElement.h \
+ Source/WebCore/html/shadow/SelectRuleFeatureSet.cpp \
+ Source/WebCore/html/shadow/SelectRuleFeatureSet.h \
Source/WebCore/html/shadow/SliderThumbElement.cpp \
Source/WebCore/html/shadow/SliderThumbElement.h \
Source/WebCore/html/shadow/SpinButtonElement.cpp \
Modified: trunk/Source/WebCore/Target.pri (134218 => 134219)
--- trunk/Source/WebCore/Target.pri 2012-11-12 13:52:07 UTC (rev 134218)
+++ trunk/Source/WebCore/Target.pri 2012-11-12 13:54:53 UTC (rev 134219)
@@ -735,6 +735,7 @@
html/shadow/MediaControlRootElement.cpp \
html/shadow/MeterShadowElement.cpp \
html/shadow/ProgressShadowElement.cpp \
+ html/shadow/SelectRuleFeatureSet.cpp \
html/shadow/SliderThumbElement.cpp \
html/shadow/SpinButtonElement.cpp \
html/shadow/TextControlInnerElements.cpp \
Modified: trunk/Source/WebCore/WebCore.gypi (134218 => 134219)
--- trunk/Source/WebCore/WebCore.gypi 2012-11-12 13:52:07 UTC (rev 134218)
+++ trunk/Source/WebCore/WebCore.gypi 2012-11-12 13:54:53 UTC (rev 134219)
@@ -4424,6 +4424,8 @@
'html/shadow/MeterShadowElement.h',
'html/shadow/ProgressShadowElement.cpp',
'html/shadow/ProgressShadowElement.h',
+ 'html/shadow/SelectRuleFeatureSet.cpp',
+ 'html/shadow/SelectRuleFeatureSet.h',
'html/shadow/SliderThumbElement.cpp',
'html/shadow/SliderThumbElement.h',
'html/shadow/SpinButtonElement.cpp',
Modified: trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj (134218 => 134219)
--- trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj 2012-11-12 13:52:07 UTC (rev 134218)
+++ trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj 2012-11-12 13:54:53 UTC (rev 134219)
@@ -64334,6 +64334,14 @@
>
</File>
<File
+ RelativePath="..\html\shadow\SelectRuleFeatureSet.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\html\shadow\SelectRuleFeatureSet.h"
+ >
+ </File>
+ <File
RelativePath="..\html\shadow\SliderThumbElement.cpp"
>
</File>
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (134218 => 134219)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2012-11-12 13:52:07 UTC (rev 134218)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2012-11-12 13:54:53 UTC (rev 134219)
@@ -1663,6 +1663,8 @@
53C8298E13D8D92700DE2DEB /* RenderFlexibleBox.h in Headers */ = {isa = PBXBuildFile; fileRef = 53C8298C13D8D92700DE2DEB /* RenderFlexibleBox.h */; };
550A0BC9085F6039007353D6 /* QualifiedName.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 550A0BC7085F6039007353D6 /* QualifiedName.cpp */; };
550A0BCA085F6039007353D6 /* QualifiedName.h in Headers */ = {isa = PBXBuildFile; fileRef = 550A0BC8085F6039007353D6 /* QualifiedName.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 570B78BF1650CE81001DBE1B /* SelectRuleFeatureSet.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 570B78BD1650CE81001DBE1B /* SelectRuleFeatureSet.cpp */; };
+ 570B78C01650CE81001DBE1B /* SelectRuleFeatureSet.h in Headers */ = {isa = PBXBuildFile; fileRef = 570B78BE1650CE81001DBE1B /* SelectRuleFeatureSet.h */; };
5728BD9E1625369600C40B56 /* SiblingTraversalStrategies.h in Headers */ = {isa = PBXBuildFile; fileRef = 5728BD9D1625369600C40B56 /* SiblingTraversalStrategies.h */; };
573D134714CE39FF0057ABCA /* InspectorTypeBuilder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 573D134514CE39FF0057ABCA /* InspectorTypeBuilder.cpp */; };
5759898715AAC0B100353C31 /* ImageInnerElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 572145CC15A51DA700AD119C /* ImageInnerElement.h */; };
@@ -8891,6 +8893,8 @@
53C8298C13D8D92700DE2DEB /* RenderFlexibleBox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderFlexibleBox.h; sourceTree = "<group>"; };
550A0BC7085F6039007353D6 /* QualifiedName.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = QualifiedName.cpp; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
550A0BC8085F6039007353D6 /* QualifiedName.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = QualifiedName.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
+ 570B78BD1650CE81001DBE1B /* SelectRuleFeatureSet.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SelectRuleFeatureSet.cpp; sourceTree = "<group>"; };
+ 570B78BE1650CE81001DBE1B /* SelectRuleFeatureSet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SelectRuleFeatureSet.h; sourceTree = "<group>"; };
572145CB15A51DA700AD119C /* ImageInnerElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ImageInnerElement.cpp; sourceTree = "<group>"; };
572145CC15A51DA700AD119C /* ImageInnerElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageInnerElement.h; sourceTree = "<group>"; };
5728BD9D1625369600C40B56 /* SiblingTraversalStrategies.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SiblingTraversalStrategies.h; sourceTree = "<group>"; };
@@ -15108,6 +15112,8 @@
A78E526E1346BD1700AD9C31 /* MeterShadowElement.h */,
A715E650134BBBEC00D8E713 /* ProgressShadowElement.cpp */,
A715E651134BBBEC00D8E713 /* ProgressShadowElement.h */,
+ 570B78BD1650CE81001DBE1B /* SelectRuleFeatureSet.cpp */,
+ 570B78BE1650CE81001DBE1B /* SelectRuleFeatureSet.h */,
4150F9F012B6E0E70008C860 /* SliderThumbElement.cpp */,
4150F9EF12B6E0E70008C860 /* SliderThumbElement.h */,
4512502015DCE37D002F84E2 /* SpinButtonElement.cpp */,
@@ -25692,6 +25698,7 @@
E1424C8A164B3B4E00F32D40 /* PlatformCookieJar.h in Headers */,
E1424C94164B52C800F32D40 /* CookieJar.h in Headers */,
1411DCB1164C39A800D49BC1 /* WidthCache.h in Headers */,
+ 570B78C01650CE81001DBE1B /* SelectRuleFeatureSet.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -28779,6 +28786,7 @@
4FC8534C1644272300D1C275 /* CachedMetadata.cpp in Sources */,
E1424C90164B460B00F32D40 /* CookieJarMac.mm in Sources */,
E1424C93164B52C800F32D40 /* CookieJar.cpp in Sources */,
+ 570B78BF1650CE81001DBE1B /* SelectRuleFeatureSet.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Modified: trunk/Source/WebCore/dom/ElementShadow.h (134218 => 134219)
--- trunk/Source/WebCore/dom/ElementShadow.h 2012-11-12 13:52:07 UTC (rev 134218)
+++ trunk/Source/WebCore/dom/ElementShadow.h 2012-11-12 13:54:53 UTC (rev 134219)
@@ -29,7 +29,7 @@
#include "ContentDistributor.h"
#include "ExceptionCode.h"
-#include "RuleFeature.h"
+#include "SelectRuleFeatureSet.h"
#include "ShadowRoot.h"
#include <wtf/DoublyLinkedList.h>
#include <wtf/Noncopyable.h>
@@ -74,9 +74,7 @@
void setShouldCollectSelectFeatureSet();
void ensureSelectFeatureSetCollected();
- bool hasSelectorForId(const AtomicString&) const;
- bool hasSelectorForClass(const AtomicString&) const;
- bool hasSelectorForAttribute(const AtomicString&) const;
+ const SelectRuleFeatureSet& selectRuleFeatureSet() const;
void reportMemoryUsage(MemoryObjectInfo*) const;
@@ -87,7 +85,7 @@
DoublyLinkedList<ShadowRoot> m_shadowRoots;
ContentDistributor m_distributor;
- RuleFeatureSet m_selectFeatures;
+ SelectRuleFeatureSet m_selectFeatures;
bool m_shouldCollectSelectFeatureSet : 1;
};
@@ -117,6 +115,12 @@
return youngestShadowRoot()->host();
}
+inline const SelectRuleFeatureSet& ElementShadow::selectRuleFeatureSet() const
+{
+ ASSERT(!m_shouldCollectSelectFeatureSet);
+ return m_selectFeatures;
+}
+
inline ShadowRoot* Node::youngestShadowRoot() const
{
if (!this->isElementNode())
@@ -126,27 +130,6 @@
return 0;
}
-inline bool ElementShadow::hasSelectorForId(const AtomicString& idValue) const
-{
- ASSERT(!idValue.isEmpty());
- ASSERT(!m_shouldCollectSelectFeatureSet);
- return m_selectFeatures.idsInRules.contains(idValue.impl());
-}
-
-inline bool ElementShadow::hasSelectorForClass(const AtomicString& classValue) const
-{
- ASSERT(!classValue.isEmpty());
- ASSERT(!m_shouldCollectSelectFeatureSet);
- return m_selectFeatures.classesInRules.contains(classValue.impl());
-}
-
-inline bool ElementShadow::hasSelectorForAttribute(const AtomicString& attributeName) const
-{
- ASSERT(!attributeName.isEmpty());
- ASSERT(!m_shouldCollectSelectFeatureSet);
- return m_selectFeatures.attrsInRules.contains(attributeName.impl());
-}
-
class ShadowRootVector : public Vector<RefPtr<ShadowRoot> > {
public:
explicit ShadowRootVector(ElementShadow* tree)
Added: trunk/Source/WebCore/html/shadow/SelectRuleFeatureSet.cpp (0 => 134219)
--- trunk/Source/WebCore/html/shadow/SelectRuleFeatureSet.cpp (rev 0)
+++ trunk/Source/WebCore/html/shadow/SelectRuleFeatureSet.cpp 2012-11-12 13:54:53 UTC (rev 134219)
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "SelectRuleFeatureSet.h"
+
+#include "CSSSelector.h"
+
+namespace WebCore {
+
+SelectRuleFeatureSet::SelectRuleFeatureSet()
+{
+}
+
+void SelectRuleFeatureSet::add(const SelectRuleFeatureSet& featureSet)
+{
+ m_cssRuleFeatureSet.add(featureSet.m_cssRuleFeatureSet);
+}
+
+void SelectRuleFeatureSet::clear()
+{
+ m_cssRuleFeatureSet.clear();
+}
+
+void SelectRuleFeatureSet::collectFeaturesFromSelector(const CSSSelector* selector)
+{
+ m_cssRuleFeatureSet.collectFeaturesFromSelector(selector);
+}
+
+}
+
Added: trunk/Source/WebCore/html/shadow/SelectRuleFeatureSet.h (0 => 134219)
--- trunk/Source/WebCore/html/shadow/SelectRuleFeatureSet.h (rev 0)
+++ trunk/Source/WebCore/html/shadow/SelectRuleFeatureSet.h 2012-11-12 13:54:53 UTC (rev 134219)
@@ -0,0 +1,74 @@
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SelectRuleFeatureSet_h
+#define SelectRuleFeatureSet_h
+
+#include "RuleFeature.h"
+
+namespace WebCore {
+
+class SelectRuleFeatureSet {
+public:
+ SelectRuleFeatureSet();
+
+ void add(const SelectRuleFeatureSet&);
+ void clear();
+ void collectFeaturesFromSelector(const CSSSelector*);
+
+ bool hasSelectorForId(const AtomicString&) const;
+ bool hasSelectorForClass(const AtomicString&) const;
+ bool hasSelectorForAttribute(const AtomicString&) const;
+
+private:
+ RuleFeatureSet m_cssRuleFeatureSet;
+};
+
+inline bool SelectRuleFeatureSet::hasSelectorForId(const AtomicString& idValue) const
+{
+ ASSERT(!idValue.isEmpty());
+ return m_cssRuleFeatureSet.idsInRules.contains(idValue.impl());
+}
+
+inline bool SelectRuleFeatureSet::hasSelectorForClass(const AtomicString& classValue) const
+{
+ ASSERT(!classValue.isEmpty());
+ return m_cssRuleFeatureSet.classesInRules.contains(classValue.impl());
+}
+
+inline bool SelectRuleFeatureSet::hasSelectorForAttribute(const AtomicString& attributeName) const
+{
+ ASSERT(!attributeName.isEmpty());
+ return m_cssRuleFeatureSet.attrsInRules.contains(attributeName.impl());
+}
+
+}
+
+#endif
Modified: trunk/Source/WebCore/testing/Internals.cpp (134218 => 134219)
--- trunk/Source/WebCore/testing/Internals.cpp 2012-11-12 13:52:07 UTC (rev 134218)
+++ trunk/Source/WebCore/testing/Internals.cpp 2012-11-12 13:54:53 UTC (rev 134219)
@@ -68,6 +68,7 @@
#include "RenderTreeAsText.h"
#include "RuntimeEnabledFeatures.h"
#include "SchemeRegistry.h"
+#include "SelectRuleFeatureSet.h"
#include "Settings.h"
#include "ShadowRoot.h"
#include "SpellChecker.h"
@@ -314,7 +315,7 @@
}
host->shadow()->ensureSelectFeatureSetCollected();
- return host->shadow()->hasSelectorForId(idValue);
+ return host->shadow()->selectRuleFeatureSet().hasSelectorForId(idValue);
}
bool Internals::hasSelectorForClassInShadow(Element* host, const String& className, ExceptionCode& ec)
@@ -325,7 +326,7 @@
}
host->shadow()->ensureSelectFeatureSetCollected();
- return host->shadow()->hasSelectorForClass(className);
+ return host->shadow()->selectRuleFeatureSet().hasSelectorForClass(className);
}
bool Internals::hasSelectorForAttributeInShadow(Element* host, const String& attributeName, ExceptionCode& ec)
@@ -336,7 +337,7 @@
}
host->shadow()->ensureSelectFeatureSetCollected();
- return host->shadow()->hasSelectorForAttribute(attributeName);
+ return host->shadow()->selectRuleFeatureSet().hasSelectorForAttribute(attributeName);
}
bool Internals::hasShadowInsertionPoint(const Node* root, ExceptionCode& ec) const