Diff
Modified: trunk/Source/WebCore/CMakeLists.txt (91547 => 91548)
--- trunk/Source/WebCore/CMakeLists.txt 2011-07-22 03:00:52 UTC (rev 91547)
+++ trunk/Source/WebCore/CMakeLists.txt 2011-07-22 03:12:43 UTC (rev 91548)
@@ -576,7 +576,7 @@
dom/SelectElement.cpp
dom/SelectorNodeList.cpp
dom/ShadowContentElement.cpp
- dom/ShadowContentSelector.cpp
+ dom/ShadowInclusionSelector.cpp
dom/ShadowRoot.cpp
dom/SpaceSplitString.cpp
dom/StaticHashSetNodeList.cpp
Modified: trunk/Source/WebCore/ChangeLog (91547 => 91548)
--- trunk/Source/WebCore/ChangeLog 2011-07-22 03:00:52 UTC (rev 91547)
+++ trunk/Source/WebCore/ChangeLog 2011-07-22 03:12:43 UTC (rev 91548)
@@ -1,3 +1,73 @@
+2011-07-21 MORITA Hajime <[email protected]>
+
+ [Refactoring] ShadowContentSelector should be ShadowInclusionSelector
+ https://bugs.webkit.org/show_bug.cgi?id=64850
+
+ Reviewed by Dimitri Glazkov.
+
+ Renamed:
+ - ShadowContentSelector -> ShadowInclusionSelector
+ - ShadowContentSelector::findInclusionFor -> ShadowInclusionSelector::findFor
+ - ShadowContentSelector::selectInclusion -> ShadowInclusionSelector::select
+ - ShadowContentSelector::unselectInclusion -> ShadowInclusionSelector::unselect
+ - ShadowContentSelector::didSelectInclusion -> ShadowInclusionSelector::didSelect
+ - ShadowContentSelector::willSelectInclusionOver -> ShadowInclusionSelector::willSelectOver
+ - ShadowContentSelector::hasChildren -> ShadowInclusionSelector::hasCandidates
+
+ No new tests. Just a textual change.
+
+ * CMakeLists.txt:
+ * GNUmakefile.list.am:
+ * WebCore.gypi:
+ * WebCore.pro:
+ * WebCore.vcproj/WebCore.vcproj:
+ * WebCore.xcodeproj/project.pbxproj:
+ * dom/DOMAllInOne.cpp:
+ * dom/NodeRenderingContext.cpp:
+ * dom/ShadowContentElement.cpp:
+ (WebCore::ShadowContentElement::attach):
+ (WebCore::ShadowContentElement::detach):
+ * dom/ShadowInclusionSelector.cpp: Renamed from Source/WebCore/dom/ShadowContentSelector.cpp.
+ (WebCore::ShadowInclusion::append):
+ (WebCore::ShadowInclusion::unlink):
+ (WebCore::ShadowInclusionList::ShadowInclusionList):
+ (WebCore::ShadowInclusionList::~ShadowInclusionList):
+ (WebCore::ShadowInclusionList::find):
+ (WebCore::ShadowInclusionList::clear):
+ (WebCore::ShadowInclusionList::append):
+ (WebCore::ShadowInclusionSelector::ShadowInclusionSelector):
+ (WebCore::ShadowInclusionSelector::~ShadowInclusionSelector):
+ (WebCore::ShadowInclusionSelector::select):
+ (WebCore::ShadowInclusionSelector::unselect):
+ (WebCore::ShadowInclusionSelector::findFor):
+ (WebCore::ShadowInclusionSelector::didSelect):
+ (WebCore::ShadowInclusionSelector::willSelectOver):
+ * dom/ShadowInclusionSelector.h: Renamed from Source/WebCore/dom/ShadowContentSelector.h.
+ (WebCore::ShadowInclusion::includer):
+ (WebCore::ShadowInclusion::content):
+ (WebCore::ShadowInclusion::next):
+ (WebCore::ShadowInclusion::previous):
+ (WebCore::ShadowInclusion::ShadowInclusion):
+ (WebCore::ShadowInclusion::create):
+ (WebCore::ShadowInclusionList::first):
+ (WebCore::ShadowInclusionList::last):
+ (WebCore::ShadowInclusionList::isEmpty):
+ (WebCore::ShadowInclusionSet::add):
+ (WebCore::ShadowInclusionSet::remove):
+ (WebCore::ShadowInclusionSet::isEmpty):
+ (WebCore::ShadowInclusionSet::Translator::hash):
+ (WebCore::ShadowInclusionSet::Translator::equal):
+ (WebCore::ShadowInclusionSet::Hash::hash):
+ (WebCore::ShadowInclusionSet::Hash::equal):
+ (WebCore::ShadowInclusionSet::find):
+ (WebCore::ShadowInclusionSelector::hasCandidates):
+ * dom/ShadowRoot.cpp:
+ (WebCore::ShadowRoot::includerFor):
+ (WebCore::ShadowRoot::attach):
+ (WebCore::ShadowRoot::inclusions):
+ (WebCore::ShadowRoot::ensureInclusions):
+ * dom/ShadowRoot.h:
+
2011-07-21 Robin Qiu <[email protected]>
https://bugs.webkit.org/show_bug.cgi?id=60737
Modified: trunk/Source/WebCore/GNUmakefile.list.am (91547 => 91548)
--- trunk/Source/WebCore/GNUmakefile.list.am 2011-07-22 03:00:52 UTC (rev 91547)
+++ trunk/Source/WebCore/GNUmakefile.list.am 2011-07-22 03:12:43 UTC (rev 91548)
@@ -1273,8 +1273,8 @@
Source/WebCore/dom/SelectorNodeList.h \
Source/WebCore/dom/ShadowContentElement.cpp \
Source/WebCore/dom/ShadowContentElement.h \
- Source/WebCore/dom/ShadowContentSelector.cpp \
- Source/WebCore/dom/ShadowContentSelector.h \
+ Source/WebCore/dom/ShadowInclusionSelector.cpp \
+ Source/WebCore/dom/ShadowInclusionSelector.h \
Source/WebCore/dom/ShadowRoot.cpp \
Source/WebCore/dom/ShadowRoot.h \
Source/WebCore/dom/SpaceSplitString.cpp \
Modified: trunk/Source/WebCore/WebCore.gypi (91547 => 91548)
--- trunk/Source/WebCore/WebCore.gypi 2011-07-22 03:00:52 UTC (rev 91547)
+++ trunk/Source/WebCore/WebCore.gypi 2011-07-22 03:12:43 UTC (rev 91548)
@@ -2593,8 +2593,8 @@
'dom/SelectorNodeList.h',
'dom/ShadowContentElement.cpp',
'dom/ShadowContentElement.h',
- 'dom/ShadowContentSelector.cpp',
- 'dom/ShadowContentSelector.h',
+ 'dom/ShadowInclusionSelector.cpp',
+ 'dom/ShadowInclusionSelector.h',
'dom/ShadowRoot.cpp',
'dom/ShadowRoot.h',
'dom/SpaceSplitString.cpp',
Modified: trunk/Source/WebCore/WebCore.pro (91547 => 91548)
--- trunk/Source/WebCore/WebCore.pro 2011-07-22 03:00:52 UTC (rev 91547)
+++ trunk/Source/WebCore/WebCore.pro 2011-07-22 03:12:43 UTC (rev 91548)
@@ -538,7 +538,7 @@
dom/SelectElement.cpp \
dom/SelectorNodeList.cpp \
dom/ShadowContentElement.cpp \
- dom/ShadowContentSelector.cpp \
+ dom/ShadowInclusionSelector.cpp \
dom/ShadowRoot.cpp \
dom/SpaceSplitString.cpp \
dom/StaticNodeList.cpp \
@@ -1521,7 +1521,7 @@
dom/SelectElement.h \
dom/SelectorNodeList.h \
dom/ShadowContentElement.h \
- dom/ShadowContentSelector.h \
+ dom/ShadowInclusionSelector.h \
dom/ShadowRoot.h \
dom/SpaceSplitString.h \
dom/StaticNodeList.h \
Modified: trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj (91547 => 91548)
--- trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj 2011-07-22 03:00:52 UTC (rev 91547)
+++ trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj 2011-07-22 03:12:43 UTC (rev 91548)
@@ -48150,7 +48150,7 @@
>
</File>
<File
- RelativePath="..\dom\ShadowContentSelector.cpp"
+ RelativePath="..\dom\ShadowInclusionSelector.cpp"
>
<FileConfiguration
Name="Debug|Win32"
@@ -48202,7 +48202,7 @@
</FileConfiguration>
</File>
<File
- RelativePath="..\dom\ShadowContentSelector.h"
+ RelativePath="..\dom\ShadowInclusionSelector.h"
>
</File>
<File
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (91547 => 91548)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2011-07-22 03:00:52 UTC (rev 91547)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2011-07-22 03:12:43 UTC (rev 91548)
@@ -3330,8 +3330,8 @@
A715E653134BBBEC00D8E713 /* ProgressShadowElement.h in Headers */ = {isa = PBXBuildFile; fileRef = A715E651134BBBEC00D8E713 /* ProgressShadowElement.h */; };
A718760E0B2A120100A16ECE /* DragActions.h in Headers */ = {isa = PBXBuildFile; fileRef = A718760D0B2A120100A16ECE /* DragActions.h */; settings = {ATTRIBUTES = (Private, ); }; };
A71878900B2D04AC00A16ECE /* DragControllerMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = A718788F0B2D04AC00A16ECE /* DragControllerMac.mm */; };
- A71C30B81381265E00DBC351 /* ShadowContentSelector.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A71C30B61381265E00DBC351 /* ShadowContentSelector.cpp */; };
- A71C30B91381265E00DBC351 /* ShadowContentSelector.h in Headers */ = {isa = PBXBuildFile; fileRef = A71C30B71381265E00DBC351 /* ShadowContentSelector.h */; };
+ A71C30B81381265E00DBC351 /* ShadowInclusionSelector.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A71C30B61381265E00DBC351 /* ShadowInclusionSelector.cpp */; };
+ A71C30B91381265E00DBC351 /* ShadowInclusionSelector.h in Headers */ = {isa = PBXBuildFile; fileRef = A71C30B71381265E00DBC351 /* ShadowInclusionSelector.h */; };
A73F95FE12C97BFE0031AAF9 /* RoundedRect.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A73F95FC12C97BFE0031AAF9 /* RoundedRect.cpp */; };
A73F95FF12C97BFE0031AAF9 /* RoundedRect.h in Headers */ = {isa = PBXBuildFile; fileRef = A73F95FD12C97BFE0031AAF9 /* RoundedRect.h */; settings = {ATTRIBUTES = (Private, ); }; };
A74BB76B13BDA86300FF7BF0 /* ExceptionCodePlaceholder.h in Headers */ = {isa = PBXBuildFile; fileRef = A74BB76A13BDA86300FF7BF0 /* ExceptionCodePlaceholder.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -9899,8 +9899,8 @@
A718760D0B2A120100A16ECE /* DragActions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DragActions.h; sourceTree = "<group>"; };
A718788F0B2D04AC00A16ECE /* DragControllerMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DragControllerMac.mm; sourceTree = "<group>"; };
A71A70C911AFB02000989D6D /* HTMLMeterElement.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = HTMLMeterElement.idl; sourceTree = "<group>"; };
- A71C30B61381265E00DBC351 /* ShadowContentSelector.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ShadowContentSelector.cpp; sourceTree = "<group>"; };
- A71C30B71381265E00DBC351 /* ShadowContentSelector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ShadowContentSelector.h; sourceTree = "<group>"; };
+ A71C30B61381265E00DBC351 /* ShadowInclusionSelector.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ShadowInclusionSelector.cpp; sourceTree = "<group>"; };
+ A71C30B71381265E00DBC351 /* ShadowInclusionSelector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ShadowInclusionSelector.h; sourceTree = "<group>"; };
A73F95FC12C97BFE0031AAF9 /* RoundedRect.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RoundedRect.cpp; sourceTree = "<group>"; };
A73F95FD12C97BFE0031AAF9 /* RoundedRect.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RoundedRect.h; sourceTree = "<group>"; };
A74BB76A13BDA86300FF7BF0 /* ExceptionCodePlaceholder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ExceptionCodePlaceholder.h; sourceTree = "<group>"; };
@@ -19882,8 +19882,8 @@
BC7FA67F0D1F167900DB22A9 /* SelectorNodeList.h */,
A766CF8B13810E0C0011A0B3 /* ShadowContentElement.cpp */,
A74C2D3B13811E0D00F83572 /* ShadowContentElement.h */,
- A71C30B61381265E00DBC351 /* ShadowContentSelector.cpp */,
- A71C30B71381265E00DBC351 /* ShadowContentSelector.h */,
+ A71C30B61381265E00DBC351 /* ShadowInclusionSelector.cpp */,
+ A71C30B71381265E00DBC351 /* ShadowInclusionSelector.h */,
A6D169611346B49B000EB770 /* ShadowRoot.cpp */,
A6D169631346B4C1000EB770 /* ShadowRoot.h */,
D01A27AB10C9BFD800026A42 /* SpaceSplitString.cpp */,
@@ -22652,7 +22652,7 @@
498770E91242C535002226BA /* Shader.h in Headers */,
0F3DD45012F5EA1B000D9190 /* ShadowBlur.h in Headers */,
A74C2D3C13811E0D00F83572 /* ShadowContentElement.h in Headers */,
- A71C30B91381265E00DBC351 /* ShadowContentSelector.h in Headers */,
+ A71C30B91381265E00DBC351 /* ShadowInclusionSelector.h in Headers */,
BC5EB8C40E82031B00B25965 /* ShadowData.h in Headers */,
A6D169641346B4C1000EB770 /* ShadowRoot.h in Headers */,
A80E6CE80A1989CA007FB8C5 /* ShadowValue.h in Headers */,
@@ -25562,7 +25562,7 @@
498770E81242C535002226BA /* Shader.cpp in Sources */,
0F3DD44F12F5EA1B000D9190 /* ShadowBlur.cpp in Sources */,
A766CF8C13810E0C0011A0B3 /* ShadowContentElement.cpp in Sources */,
- A71C30B81381265E00DBC351 /* ShadowContentSelector.cpp in Sources */,
+ A71C30B81381265E00DBC351 /* ShadowInclusionSelector.cpp in Sources */,
BC5EB8C30E82031B00B25965 /* ShadowData.cpp in Sources */,
A6D169621346B49B000EB770 /* ShadowRoot.cpp in Sources */,
A80E6CF40A1989CA007FB8C5 /* ShadowValue.cpp in Sources */,
Modified: trunk/Source/WebCore/dom/DOMAllInOne.cpp (91547 => 91548)
--- trunk/Source/WebCore/dom/DOMAllInOne.cpp 2011-07-22 03:00:52 UTC (rev 91547)
+++ trunk/Source/WebCore/dom/DOMAllInOne.cpp 2011-07-22 03:12:43 UTC (rev 91548)
@@ -115,7 +115,7 @@
#include "SelectElement.cpp"
#include "SelectorNodeList.cpp"
#include "ShadowContentElement.cpp"
-#include "ShadowContentSelector.cpp"
+#include "ShadowInclusionSelector.cpp"
#include "ShadowRoot.cpp"
#include "SpaceSplitString.cpp"
#include "StaticHashSetNodeList.cpp"
Modified: trunk/Source/WebCore/dom/NodeRenderingContext.cpp (91547 => 91548)
--- trunk/Source/WebCore/dom/NodeRenderingContext.cpp 2011-07-22 03:00:52 UTC (rev 91547)
+++ trunk/Source/WebCore/dom/NodeRenderingContext.cpp 2011-07-22 03:12:43 UTC (rev 91548)
@@ -31,7 +31,7 @@
#include "RenderFullScreen.h"
#include "RenderObject.h"
#include "ShadowContentElement.h"
-#include "ShadowContentSelector.h"
+#include "ShadowInclusionSelector.h"
#include "ShadowRoot.h"
namespace WebCore {
Modified: trunk/Source/WebCore/dom/ShadowContentElement.cpp (91547 => 91548)
--- trunk/Source/WebCore/dom/ShadowContentElement.cpp 2011-07-22 03:00:52 UTC (rev 91547)
+++ trunk/Source/WebCore/dom/ShadowContentElement.cpp 2011-07-22 03:12:43 UTC (rev 91548)
@@ -28,7 +28,7 @@
#include "ShadowContentElement.h"
#include "HTMLNames.h"
-#include "ShadowContentSelector.h"
+#include "ShadowInclusionSelector.h"
#include "ShadowRoot.h"
namespace WebCore {
@@ -55,9 +55,9 @@
StyledElement::attach();
if (ShadowRoot* root = toShadowRoot(shadowTreeRootNode())) {
- ShadowContentSelector* selector = root->ensureInclusions();
- selector->unselectInclusion(m_inclusions.get());
- selector->selectInclusion(this, m_inclusions.get());
+ ShadowInclusionSelector* selector = root->ensureInclusions();
+ selector->unselect(m_inclusions.get());
+ selector->select(this, m_inclusions.get());
for (ShadowInclusion* inclusion = m_inclusions->first(); inclusion; inclusion = inclusion->next())
inclusion->content()->detach();
for (ShadowInclusion* inclusion = m_inclusions->first(); inclusion; inclusion = inclusion->next())
@@ -68,8 +68,8 @@
void ShadowContentElement::detach()
{
if (ShadowRoot* root = toShadowRoot(shadowTreeRootNode())) {
- if (ShadowContentSelector* selector = root->inclusions())
- selector->unselectInclusion(m_inclusions.get());
+ if (ShadowInclusionSelector* selector = root->inclusions())
+ selector->unselect(m_inclusions.get());
}
ASSERT(m_inclusions->isEmpty());
Deleted: trunk/Source/WebCore/dom/ShadowContentSelector.cpp (91547 => 91548)
--- trunk/Source/WebCore/dom/ShadowContentSelector.cpp 2011-07-22 03:00:52 UTC (rev 91547)
+++ trunk/Source/WebCore/dom/ShadowContentSelector.cpp 2011-07-22 03:12:43 UTC (rev 91548)
@@ -1,153 +0,0 @@
-/*
- * Copyright (C) 2011 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.
- * * 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 "ShadowContentSelector.h"
-
-#include "ShadowContentElement.h"
-#include "ShadowRoot.h"
-
-
-namespace WebCore {
-
-void ShadowInclusion::append(PassRefPtr<ShadowInclusion> next)
-{
- ASSERT(!m_next);
- ASSERT(!next->previous());
- m_next = next;
- m_next->m_previous = this;
-}
-
-void ShadowInclusion::unlink()
-{
- ASSERT(!m_previous); // Can be called only for a head.
- RefPtr<ShadowInclusion> item = this;
- while (item) {
- ASSERT(!item->previous());
- RefPtr<ShadowInclusion> nextItem = item->m_next;
- item->m_next.clear();
- if (nextItem)
- nextItem->m_previous.clear();
- item = nextItem;
- }
-}
-
-ShadowInclusionList::ShadowInclusionList()
-{
-}
-
-ShadowInclusionList::~ShadowInclusionList()
-{
- ASSERT(isEmpty());
-}
-
-ShadowInclusion* ShadowInclusionList::find(Node* content) const
-{
- for (ShadowInclusion* item = first(); item; item = item->next()) {
- if (content == item->content())
- return item;
- }
-
- return 0;
-}
-
-void ShadowInclusionList::clear()
-{
- if (isEmpty()) {
- ASSERT(!m_last);
- return;
- }
-
- m_first->unlink();
- m_first.clear();
- m_last.clear();
-}
-
-void ShadowInclusionList::append(PassRefPtr<ShadowInclusion> child)
-{
- if (isEmpty()) {
- ASSERT(!m_last);
- m_first = m_last = child;
- return;
- }
-
- m_last->append(child);
- m_last = m_last->next();
-}
-
-ShadowContentSelector::ShadowContentSelector()
-{
-}
-
-ShadowContentSelector::~ShadowContentSelector()
-{
- ASSERT(m_children.isEmpty());
-}
-
-void ShadowContentSelector::selectInclusion(ShadowContentElement* contentElement, ShadowInclusionList* inclusions)
-{
- ASSERT(inclusions->isEmpty());
-
- for (size_t i = 0; i < m_children.size(); ++i) {
- Node* child = m_children[i].get();
- if (!child)
- continue;
- if (!contentElement->shouldInclude(child))
- continue;
-
- RefPtr<ShadowInclusion> inclusion = ShadowInclusion::create(contentElement, child);
- inclusions->append(inclusion);
- m_inclusionSet.add(inclusion.get());
- m_children[i] = 0;
- }
-}
-
-void ShadowContentSelector::unselectInclusion(ShadowInclusionList* list)
-{
- for (ShadowInclusion* inclusion = list->first(); inclusion; inclusion = inclusion->next())
- m_inclusionSet.remove(inclusion);
- list->clear();
-}
-
-ShadowInclusion* ShadowContentSelector::findInclusionFor(Node* key) const
-{
- return m_inclusionSet.find(key);
-}
-
-void ShadowContentSelector::didSelectInclusion()
-{
- m_children.clear();
-}
-
-void ShadowContentSelector::willSelectInclusionOver(ShadowRoot* scope)
-{
- if (!m_children.isEmpty())
- return;
- for (Node* node = scope->shadowHost()->firstChild(); node; node = node->nextSibling())
- m_children.append(node);
-}
-
-}
Deleted: trunk/Source/WebCore/dom/ShadowContentSelector.h (91547 => 91548)
--- trunk/Source/WebCore/dom/ShadowContentSelector.h 2011-07-22 03:00:52 UTC (rev 91547)
+++ trunk/Source/WebCore/dom/ShadowContentSelector.h 2011-07-22 03:12:43 UTC (rev 91548)
@@ -1,151 +0,0 @@
-/*
- * Copyright (C) 2011 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 ShadowContentSelector_h
-#define ShadowContentSelector_h
-
-#include <wtf/Forward.h>
-#include <wtf/HashSet.h>
-#include <wtf/RefCounted.h>
-#include <wtf/Vector.h>
-
-namespace WebCore {
-
-class Element;
-class Node;
-class ShadowRoot;
-class ShadowContentElement;
-
-class ShadowInclusion : public RefCounted<ShadowInclusion> {
-public:
- static PassRefPtr<ShadowInclusion> create(ShadowContentElement*, Node*);
-
- ShadowContentElement* includer() const { return m_includer; }
- Node* content() const { return m_content.get(); }
- ShadowInclusion* next() const { return m_next.get(); }
- ShadowInclusion* previous() const { return m_previous.get(); }
-
- void append(PassRefPtr<ShadowInclusion>);
- void unlink();
-
-private:
- ShadowInclusion(ShadowContentElement*, Node*);
-
- ShadowContentElement* m_includer;
- RefPtr<Node> m_content;
- RefPtr<ShadowInclusion> m_next;
- RefPtr<ShadowInclusion> m_previous;
-};
-
-inline ShadowInclusion::ShadowInclusion(ShadowContentElement* includer, Node* content)
- : m_includer(includer), m_content(content)
-{ }
-
-inline PassRefPtr<ShadowInclusion> ShadowInclusion::create(ShadowContentElement* includer, Node* content)
-{
- return adoptRef(new ShadowInclusion(includer, content));
-}
-
-class ShadowInclusionList {
-public:
- ShadowInclusionList();
- ~ShadowInclusionList();
-
- ShadowInclusion* first() const { return m_first.get(); }
- ShadowInclusion* last() const { return m_last.get(); }
- ShadowInclusion* find(Node*) const;
- bool isEmpty() const { return !m_first; }
-
- void clear();
- void append(PassRefPtr<ShadowInclusion>);
-
-private:
- RefPtr<ShadowInclusion> m_first;
- RefPtr<ShadowInclusion> m_last;
-};
-
-
-class ShadowInclusionSet {
-public:
- void add(ShadowInclusion* value) { m_set.add(value); }
- void remove(ShadowInclusion* value) { m_set.remove(value); }
- bool isEmpty() const { return m_set.isEmpty(); }
- ShadowInclusion* find(Node* key) const;
-
-private:
- struct Translator {
- public:
- static unsigned hash(const Node* key) { return PtrHash<const Node*>::hash(key); }
- static bool equal(const ShadowInclusion* inclusion, const Node* content) { return inclusion->content() == content; }
- };
-
- struct Hash {
- static unsigned hash(ShadowInclusion* key) { return PtrHash<const Node*>::hash(key->content()); }
- static bool equal(ShadowInclusion* a, ShadowInclusion* b) { return a->content() == b->content(); }
- static const bool safeToCompareToEmptyOrDeleted = false;
- };
-
- typedef HashSet<ShadowInclusion*, Hash> PointerSet;
-
- PointerSet m_set;
-};
-
-inline ShadowInclusion* ShadowInclusionSet::find(Node* key) const
-{
- PointerSet::iterator found = m_set.find<Node*, ShadowInclusionSet::Translator>(key);
- return found != m_set.end() ? *found : 0;
-}
-
-class ShadowContentSelector {
- WTF_MAKE_NONCOPYABLE(ShadowContentSelector);
-public:
- ShadowContentSelector();
- ~ShadowContentSelector();
-
- void selectInclusion(ShadowContentElement*, ShadowInclusionList*);
- void unselectInclusion(ShadowInclusionList*);
- ShadowInclusion* findInclusionFor(Node* key) const;
-
- void willSelectInclusionOver(ShadowRoot*);
- void didSelectInclusion();
- bool hasChildren() const { return !m_children.isEmpty(); }
-
-
-private:
- void removeFromSet(ShadowInclusionList*);
- void addToSet(ShadowInclusionList*);
-
- Vector<RefPtr<Node> > m_children;
- ShadowInclusionSet m_inclusionSet;
-};
-
-}
-
-#endif
Copied: trunk/Source/WebCore/dom/ShadowInclusionSelector.cpp (from rev 91547, trunk/Source/WebCore/dom/ShadowContentSelector.cpp) (0 => 91548)
--- trunk/Source/WebCore/dom/ShadowInclusionSelector.cpp (rev 0)
+++ trunk/Source/WebCore/dom/ShadowInclusionSelector.cpp 2011-07-22 03:12:43 UTC (rev 91548)
@@ -0,0 +1,153 @@
+/*
+ * Copyright (C) 2011 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.
+ * * 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 "ShadowInclusionSelector.h"
+
+#include "ShadowContentElement.h"
+#include "ShadowRoot.h"
+
+
+namespace WebCore {
+
+void ShadowInclusion::append(PassRefPtr<ShadowInclusion> next)
+{
+ ASSERT(!m_next);
+ ASSERT(!next->previous());
+ m_next = next;
+ m_next->m_previous = this;
+}
+
+void ShadowInclusion::unlink()
+{
+ ASSERT(!m_previous); // Can be called only for a head.
+ RefPtr<ShadowInclusion> item = this;
+ while (item) {
+ ASSERT(!item->previous());
+ RefPtr<ShadowInclusion> nextItem = item->m_next;
+ item->m_next.clear();
+ if (nextItem)
+ nextItem->m_previous.clear();
+ item = nextItem;
+ }
+}
+
+ShadowInclusionList::ShadowInclusionList()
+{
+}
+
+ShadowInclusionList::~ShadowInclusionList()
+{
+ ASSERT(isEmpty());
+}
+
+ShadowInclusion* ShadowInclusionList::find(Node* content) const
+{
+ for (ShadowInclusion* item = first(); item; item = item->next()) {
+ if (content == item->content())
+ return item;
+ }
+
+ return 0;
+}
+
+void ShadowInclusionList::clear()
+{
+ if (isEmpty()) {
+ ASSERT(!m_last);
+ return;
+ }
+
+ m_first->unlink();
+ m_first.clear();
+ m_last.clear();
+}
+
+void ShadowInclusionList::append(PassRefPtr<ShadowInclusion> child)
+{
+ if (isEmpty()) {
+ ASSERT(!m_last);
+ m_first = m_last = child;
+ return;
+ }
+
+ m_last->append(child);
+ m_last = m_last->next();
+}
+
+ShadowInclusionSelector::ShadowInclusionSelector()
+{
+}
+
+ShadowInclusionSelector::~ShadowInclusionSelector()
+{
+ ASSERT(m_candidates.isEmpty());
+}
+
+void ShadowInclusionSelector::select(ShadowContentElement* contentElement, ShadowInclusionList* inclusions)
+{
+ ASSERT(inclusions->isEmpty());
+
+ for (size_t i = 0; i < m_candidates.size(); ++i) {
+ Node* child = m_candidates[i].get();
+ if (!child)
+ continue;
+ if (!contentElement->shouldInclude(child))
+ continue;
+
+ RefPtr<ShadowInclusion> inclusion = ShadowInclusion::create(contentElement, child);
+ inclusions->append(inclusion);
+ m_inclusionSet.add(inclusion.get());
+ m_candidates[i] = 0;
+ }
+}
+
+void ShadowInclusionSelector::unselect(ShadowInclusionList* list)
+{
+ for (ShadowInclusion* inclusion = list->first(); inclusion; inclusion = inclusion->next())
+ m_inclusionSet.remove(inclusion);
+ list->clear();
+}
+
+ShadowInclusion* ShadowInclusionSelector::findFor(Node* key) const
+{
+ return m_inclusionSet.find(key);
+}
+
+void ShadowInclusionSelector::didSelect()
+{
+ m_candidates.clear();
+}
+
+void ShadowInclusionSelector::willSelectOver(ShadowRoot* scope)
+{
+ if (!m_candidates.isEmpty())
+ return;
+ for (Node* node = scope->shadowHost()->firstChild(); node; node = node->nextSibling())
+ m_candidates.append(node);
+}
+
+}
Copied: trunk/Source/WebCore/dom/ShadowInclusionSelector.h (from rev 91547, trunk/Source/WebCore/dom/ShadowContentSelector.h) (0 => 91548)
--- trunk/Source/WebCore/dom/ShadowInclusionSelector.h (rev 0)
+++ trunk/Source/WebCore/dom/ShadowInclusionSelector.h 2011-07-22 03:12:43 UTC (rev 91548)
@@ -0,0 +1,151 @@
+/*
+ * Copyright (C) 2011 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 ShadowInclusionSelector_h
+#define ShadowInclusionSelector_h
+
+#include <wtf/Forward.h>
+#include <wtf/HashSet.h>
+#include <wtf/RefCounted.h>
+#include <wtf/Vector.h>
+
+namespace WebCore {
+
+class Element;
+class Node;
+class ShadowRoot;
+class ShadowContentElement;
+
+class ShadowInclusion : public RefCounted<ShadowInclusion> {
+public:
+ static PassRefPtr<ShadowInclusion> create(ShadowContentElement*, Node*);
+
+ ShadowContentElement* includer() const { return m_includer; }
+ Node* content() const { return m_content.get(); }
+ ShadowInclusion* next() const { return m_next.get(); }
+ ShadowInclusion* previous() const { return m_previous.get(); }
+
+ void append(PassRefPtr<ShadowInclusion>);
+ void unlink();
+
+private:
+ ShadowInclusion(ShadowContentElement*, Node*);
+
+ ShadowContentElement* m_includer;
+ RefPtr<Node> m_content;
+ RefPtr<ShadowInclusion> m_next;
+ RefPtr<ShadowInclusion> m_previous;
+};
+
+inline ShadowInclusion::ShadowInclusion(ShadowContentElement* includer, Node* content)
+ : m_includer(includer), m_content(content)
+{ }
+
+inline PassRefPtr<ShadowInclusion> ShadowInclusion::create(ShadowContentElement* includer, Node* content)
+{
+ return adoptRef(new ShadowInclusion(includer, content));
+}
+
+class ShadowInclusionList {
+public:
+ ShadowInclusionList();
+ ~ShadowInclusionList();
+
+ ShadowInclusion* first() const { return m_first.get(); }
+ ShadowInclusion* last() const { return m_last.get(); }
+ ShadowInclusion* find(Node*) const;
+ bool isEmpty() const { return !m_first; }
+
+ void clear();
+ void append(PassRefPtr<ShadowInclusion>);
+
+private:
+ RefPtr<ShadowInclusion> m_first;
+ RefPtr<ShadowInclusion> m_last;
+};
+
+
+class ShadowInclusionSet {
+public:
+ void add(ShadowInclusion* value) { m_set.add(value); }
+ void remove(ShadowInclusion* value) { m_set.remove(value); }
+ bool isEmpty() const { return m_set.isEmpty(); }
+ ShadowInclusion* find(Node* key) const;
+
+private:
+ struct Translator {
+ public:
+ static unsigned hash(const Node* key) { return PtrHash<const Node*>::hash(key); }
+ static bool equal(const ShadowInclusion* inclusion, const Node* content) { return inclusion->content() == content; }
+ };
+
+ struct Hash {
+ static unsigned hash(ShadowInclusion* key) { return PtrHash<const Node*>::hash(key->content()); }
+ static bool equal(ShadowInclusion* a, ShadowInclusion* b) { return a->content() == b->content(); }
+ static const bool safeToCompareToEmptyOrDeleted = false;
+ };
+
+ typedef HashSet<ShadowInclusion*, Hash> PointerSet;
+
+ PointerSet m_set;
+};
+
+inline ShadowInclusion* ShadowInclusionSet::find(Node* key) const
+{
+ PointerSet::iterator found = m_set.find<Node*, ShadowInclusionSet::Translator>(key);
+ return found != m_set.end() ? *found : 0;
+}
+
+class ShadowInclusionSelector {
+ WTF_MAKE_NONCOPYABLE(ShadowInclusionSelector);
+public:
+ ShadowInclusionSelector();
+ ~ShadowInclusionSelector();
+
+ void select(ShadowContentElement*, ShadowInclusionList*);
+ void unselect(ShadowInclusionList*);
+ ShadowInclusion* findFor(Node* key) const;
+
+ void willSelectOver(ShadowRoot*);
+ void didSelect();
+ bool hasCandidates() const { return !m_candidates.isEmpty(); }
+
+
+private:
+ void removeFromSet(ShadowInclusionList*);
+ void addToSet(ShadowInclusionList*);
+
+ Vector<RefPtr<Node> > m_candidates;
+ ShadowInclusionSet m_inclusionSet;
+};
+
+}
+
+#endif
Modified: trunk/Source/WebCore/dom/ShadowRoot.cpp (91547 => 91548)
--- trunk/Source/WebCore/dom/ShadowRoot.cpp 2011-07-22 03:00:52 UTC (rev 91547)
+++ trunk/Source/WebCore/dom/ShadowRoot.cpp 2011-07-22 03:12:43 UTC (rev 91548)
@@ -31,7 +31,7 @@
#include "Document.h"
#include "NodeRareData.h"
#include "ShadowContentElement.h"
-#include "ShadowContentSelector.h"
+#include "ShadowInclusionSelector.h"
namespace WebCore {
@@ -100,7 +100,7 @@
{
if (!m_inclusions)
return 0;
- ShadowInclusion* found = m_inclusions->findInclusionFor(node);
+ ShadowInclusion* found = m_inclusions->findFor(node);
if (!found)
return 0;
return found->includer();
@@ -139,22 +139,22 @@
// Children of m_inclusions is populated lazily in
// ensureInclusions(), and here we just ensure that
// it is in clean state.
- ASSERT(!m_inclusions || !m_inclusions->hasChildren());
+ ASSERT(!m_inclusions || !m_inclusions->hasCandidates());
TreeScope::attach();
if (m_inclusions)
- m_inclusions->didSelectInclusion();
+ m_inclusions->didSelect();
}
-ShadowContentSelector* ShadowRoot::inclusions() const
+ShadowInclusionSelector* ShadowRoot::inclusions() const
{
return m_inclusions.get();
}
-ShadowContentSelector* ShadowRoot::ensureInclusions()
+ShadowInclusionSelector* ShadowRoot::ensureInclusions()
{
if (!m_inclusions)
- m_inclusions = adoptPtr(new ShadowContentSelector());
- m_inclusions->willSelectInclusionOver(this);
+ m_inclusions = adoptPtr(new ShadowInclusionSelector());
+ m_inclusions->willSelectOver(this);
return m_inclusions.get();
}
Modified: trunk/Source/WebCore/dom/ShadowRoot.h (91547 => 91548)
--- trunk/Source/WebCore/dom/ShadowRoot.h 2011-07-22 03:00:52 UTC (rev 91547)
+++ trunk/Source/WebCore/dom/ShadowRoot.h 2011-07-22 03:12:43 UTC (rev 91548)
@@ -33,7 +33,7 @@
class Document;
class ShadowContentElement;
-class ShadowContentSelector;
+class ShadowInclusionSelector;
class ShadowRoot : public TreeScope {
public:
@@ -49,8 +49,8 @@
virtual bool applyAuthorSheets() const;
void setApplyAuthorSheets(bool);
- ShadowContentSelector* inclusions() const;
- ShadowContentSelector* ensureInclusions();
+ ShadowInclusionSelector* inclusions() const;
+ ShadowInclusionSelector* ensureInclusions();
private:
ShadowRoot(Document*);
@@ -64,7 +64,7 @@
bool hasContentElement() const;
bool m_applyAuthorSheets;
- OwnPtr<ShadowContentSelector> m_inclusions;
+ OwnPtr<ShadowInclusionSelector> m_inclusions;
};
inline PassRefPtr<ShadowRoot> ShadowRoot::create(Document* document)