Merge from Chromium at DEPS revision 224184
This commit was generated by merge_to_master.py.
Change-Id: I6aa2623a399e683ff92335749916c23088d1fbd8
diff --git a/Source/core/dom/Attr.cpp b/Source/core/dom/Attr.cpp
index 0d20c05..440ca96 100644
--- a/Source/core/dom/Attr.cpp
+++ b/Source/core/dom/Attr.cpp
@@ -24,6 +24,7 @@
#include "core/dom/Attr.h"
#include "XMLNSNames.h"
+#include "bindings/v8/ExceptionMessages.h"
#include "bindings/v8/ExceptionState.h"
#include "bindings/v8/ExceptionStatePlaceholder.h"
#include "core/dom/Element.h"
@@ -97,9 +98,13 @@
if (es.hadException())
return;
- if ((prefix == xmlnsAtom && namespaceURI() != XMLNSNames::xmlnsNamespaceURI)
- || static_cast<Attr*>(this)->qualifiedName() == xmlnsAtom) {
- es.throwDOMException(NamespaceError);
+ if (prefix == xmlnsAtom && namespaceURI() != XMLNSNames::xmlnsNamespaceURI) {
+ es.throwDOMException(NamespaceError, ExceptionMessages::failedToSet("prefix", "Attr", "The prefix '" + xmlnsAtom + "' may not be used on the namespace '" + namespaceURI() + "'."));
+ return;
+ }
+
+ if (static_cast<Attr*>(this)->qualifiedName() == xmlnsAtom) {
+ es.throwDOMException(NamespaceError, ExceptionMessages::failedToSet("prefix", "Attr", "The prefix '" + prefix + "' may not be used as a namespace prefix for attributes whose qualified name is '" + xmlnsAtom + "'."));
return;
}
diff --git a/Source/core/dom/CharacterData.cpp b/Source/core/dom/CharacterData.cpp
index ecf9f6c..9d6f9c7 100644
--- a/Source/core/dom/CharacterData.cpp
+++ b/Source/core/dom/CharacterData.cpp
@@ -22,6 +22,7 @@
#include "config.h"
#include "core/dom/CharacterData.h"
+#include "bindings/v8/ExceptionMessages.h"
#include "bindings/v8/ExceptionState.h"
#include "core/dom/Document.h"
#include "core/dom/EventNames.h"
@@ -55,13 +56,13 @@
unsigned oldLength = length();
setDataAndUpdate(nonNullData, 0, oldLength, nonNullData.length());
- document().textRemoved(this, 0, oldLength);
+ document().didRemoveText(this, 0, oldLength);
}
String CharacterData::substringData(unsigned offset, unsigned count, ExceptionState& es)
{
if (offset > length()) {
- es.throwDOMException(IndexSizeError);
+ es.throwDOMException(IndexSizeError, ExceptionMessages::failedToExecute("substringData", "CharacterData", "The offset " + String::number(offset) + " is greater than the node's length (" + String::number(length()) + ")."));
return String();
}
@@ -120,7 +121,7 @@
void CharacterData::insertData(unsigned offset, const String& data, ExceptionState& es, RecalcStyleBehavior recalcStyleBehavior)
{
if (offset > length()) {
- es.throwDOMException(IndexSizeError);
+ es.throwDOMException(IndexSizeError, ExceptionMessages::failedToExecute("insertData", "CharacterData", "The offset " + String::number(offset) + " is greater than the node's length (" + String::number(length()) + ")."));
return;
}
@@ -129,13 +130,13 @@
setDataAndUpdate(newStr, offset, 0, data.length(), recalcStyleBehavior);
- document().textInserted(this, offset, data.length());
+ document().didInsertText(this, offset, data.length());
}
void CharacterData::deleteData(unsigned offset, unsigned count, ExceptionState& es, RecalcStyleBehavior recalcStyleBehavior)
{
if (offset > length()) {
- es.throwDOMException(IndexSizeError);
+ es.throwDOMException(IndexSizeError, ExceptionMessages::failedToExecute("deleteData", "CharacterData", "The offset " + String::number(offset) + " is greater than the node's length (" + String::number(length()) + ")."));
return;
}
@@ -150,13 +151,13 @@
setDataAndUpdate(newStr, offset, count, 0, recalcStyleBehavior);
- document().textRemoved(this, offset, realCount);
+ document().didRemoveText(this, offset, realCount);
}
void CharacterData::replaceData(unsigned offset, unsigned count, const String& data, ExceptionState& es)
{
if (offset > length()) {
- es.throwDOMException(IndexSizeError);
+ es.throwDOMException(IndexSizeError, ExceptionMessages::failedToExecute("replaceData", "CharacterData", "The offset " + String::number(offset) + " is greater than the node's length (" + String::number(length()) + ")."));
return;
}
@@ -173,8 +174,8 @@
setDataAndUpdate(newStr, offset, count, data.length());
// update the markers for spell checking and grammar checking
- document().textRemoved(this, offset, realCount);
- document().textInserted(this, offset, data.length());
+ document().didRemoveText(this, offset, realCount);
+ document().didInsertText(this, offset, data.length());
}
String CharacterData::nodeValue() const
@@ -205,7 +206,7 @@
toProcessingInstruction(this)->checkStyleSheet();
if (document().frame())
- document().frame()->selection().textWasReplaced(this, offsetOfReplacedData, oldLength, newLength);
+ document().frame()->selection().didUpdateCharacterData(this, offsetOfReplacedData, oldLength, newLength);
document().incDOMTreeVersion();
didModifyData(oldData);
diff --git a/Source/core/dom/Document.cpp b/Source/core/dom/Document.cpp
index d04d081..7417915 100644
--- a/Source/core/dom/Document.cpp
+++ b/Source/core/dom/Document.cpp
@@ -47,7 +47,7 @@
#include "core/css/CSSFontSelector.h"
#include "core/css/CSSStyleDeclaration.h"
#include "core/css/CSSStyleSheet.h"
-#include "core/css/FontLoader.h"
+#include "core/css/FontFaceSet.h"
#include "core/css/MediaQueryMatcher.h"
#include "core/css/StylePropertySet.h"
#include "core/css/StyleSheetContents.h"
@@ -94,7 +94,7 @@
#include "core/dom/ScriptRunner.h"
#include "core/dom/ScriptedAnimationController.h"
#include "core/dom/SelectorQuery.h"
-#include "core/dom/StyleSheetCollections.h"
+#include "core/dom/StyleEngine.h"
#include "core/dom/TouchList.h"
#include "core/dom/TransformSource.h"
#include "core/dom/TreeWalker.h"
@@ -156,7 +156,6 @@
#include "core/page/animation/AnimationController.h"
#include "core/page/scrolling/ScrollingCoordinator.h"
#include "core/platform/DateComponents.h"
-#include "core/platform/HistogramSupport.h"
#include "core/platform/Language.h"
#include "core/platform/ScrollbarTheme.h"
#include "core/platform/Timer.h"
@@ -405,7 +404,7 @@
, m_domTreeVersion(++s_globalTreeVersion)
, m_listenerTypes(0)
, m_mutationObserverTypes(0)
- , m_styleSheetCollections(StyleSheetCollections::create(*this))
+ , m_styleEngine(StyleEngine::create(*this))
, m_visitedLinkState(VisitedLinkState::create(this))
, m_visuallyOrdered(false)
, m_readyState(Complete)
@@ -462,7 +461,7 @@
#endif
, m_timeline(DocumentTimeline::create(this))
, m_templateDocumentHost(0)
- , m_fontloader(0)
+ , m_fonts(0)
, m_didAssociateFormControlsTimer(this, &Document::didAssociateFormControlsTimerFired)
{
ScriptWrappable::init(this);
@@ -494,16 +493,6 @@
InspectorCounters::incrementCounter(InspectorCounters::DocumentCounter);
}
-static void histogramMutationEventUsage(const unsigned short& listenerTypes)
-{
- HistogramSupport::histogramEnumeration("DOMAPI.PerDocumentMutationEventUsage.DOMSubtreeModified", static_cast<bool>(listenerTypes & Document::DOMSUBTREEMODIFIED_LISTENER), 2);
- HistogramSupport::histogramEnumeration("DOMAPI.PerDocumentMutationEventUsage.DOMNodeInserted", static_cast<bool>(listenerTypes & Document::DOMNODEINSERTED_LISTENER), 2);
- HistogramSupport::histogramEnumeration("DOMAPI.PerDocumentMutationEventUsage.DOMNodeRemoved", static_cast<bool>(listenerTypes & Document::DOMNODEREMOVED_LISTENER), 2);
- HistogramSupport::histogramEnumeration("DOMAPI.PerDocumentMutationEventUsage.DOMNodeRemovedFromDocument", static_cast<bool>(listenerTypes & Document::DOMNODEREMOVEDFROMDOCUMENT_LISTENER), 2);
- HistogramSupport::histogramEnumeration("DOMAPI.PerDocumentMutationEventUsage.DOMNodeInsertedIntoDocument", static_cast<bool>(listenerTypes & Document::DOMNODEINSERTEDINTODOCUMENT_LISTENER), 2);
- HistogramSupport::histogramEnumeration("DOMAPI.PerDocumentMutationEventUsage.DOMCharacterDataModified", static_cast<bool>(listenerTypes & Document::DOMCHARACTERDATAMODIFIED_LISTENER), 2);
-}
-
static bool isAttributeOnAllOwners(const WebCore::QualifiedName& attribute, const WebCore::QualifiedName& prefixedAttribute, const HTMLFrameOwnerElement* owner)
{
if (!owner)
@@ -525,13 +514,10 @@
if (m_templateDocument)
m_templateDocument->setTemplateDocumentHost(0); // balanced in templateDocument().
- if (Document* ownerDocument = this->ownerDocument())
- ownerDocument->didRemoveEventTargetNode(this);
+ lifecycleNotifier()->notifyDocumentBeingDestroyed();
m_scriptRunner.clear();
- histogramMutationEventUsage(m_listenerTypes);
-
removeAllEventListeners();
// Currently we believe that Document can never outlive the parser.
@@ -556,7 +542,7 @@
m_import = 0;
}
- m_styleSheetCollections.clear();
+ m_styleEngine.clear();
if (m_elemSheet)
m_elemSheet->clearOwnerNode();
@@ -630,11 +616,6 @@
lifecycleNotifier()->notifyDocumentWasDisposed();
}
-Element* Document::getElementById(const AtomicString& id) const
-{
- return TreeScope::getElementById(id);
-}
-
SelectorQueryCache* Document::selectorQueryCache()
{
if (!m_selectorQueryCache)
@@ -658,8 +639,8 @@
selectorQueryCache()->invalidate();
if (inQuirksMode() != wasInQuirksMode) {
// All user stylesheets have to reparse using the different mode.
- m_styleSheetCollections->clearPageUserSheet();
- m_styleSheetCollections->invalidateInjectedStyleSheetCache();
+ m_styleEngine->clearPageUserSheet();
+ m_styleEngine->invalidateInjectedStyleSheetCache();
}
}
@@ -1708,13 +1689,13 @@
// re-attaching our containing iframe, which when asked HTMLFrameElementBase::isURLAllowed
// hits a null-dereference due to security code always assuming the document has a SecurityOrigin.
- if (m_styleSheetCollections->needsUpdateActiveStylesheetsOnStyleRecalc())
- m_styleSheetCollections->updateActiveStyleSheets(FullStyleUpdate);
+ if (m_styleEngine->needsUpdateActiveStylesheetsOnStyleRecalc())
+ m_styleEngine->updateActiveStyleSheets(FullStyleUpdate);
InspectorInstrumentationCookie cookie = InspectorInstrumentation::willRecalculateStyle(this);
if (m_elemSheet && m_elemSheet->contents()->usesRemUnits())
- m_styleSheetCollections->setUsesRemUnit(true);
+ m_styleEngine->setUsesRemUnit(true);
m_inStyleRecalc = true;
{
@@ -1760,15 +1741,15 @@
unscheduleStyleRecalc();
// FIXME: SVG <use> element can schedule a recalc in the middle of an already running one.
- // See StyleSheetCollections::updateActiveStyleSheets.
- if (m_styleSheetCollections->needsUpdateActiveStylesheetsOnStyleRecalc())
+ // See StyleEngine::updateActiveStyleSheets.
+ if (m_styleEngine->needsUpdateActiveStylesheetsOnStyleRecalc())
setNeedsStyleRecalc();
m_inStyleRecalc = false;
// Pseudo element removal and similar may only work with these flags still set. Reset them after the style recalc.
if (m_styleResolver) {
- m_styleSheetCollections->resetCSSFeatureFlags(m_styleResolver->ruleFeatureSet());
+ m_styleEngine->resetCSSFeatureFlags(m_styleResolver->ruleFeatureSet());
m_styleResolver->clearStyleSharingList();
}
@@ -1990,7 +1971,7 @@
if (Settings* docSettings = settings())
matchAuthorAndUserStyles = docSettings->authorAndUserStylesEnabled();
m_styleResolver = adoptPtr(new StyleResolver(*this, matchAuthorAndUserStyles));
- m_styleSheetCollections->combineCSSFeatureFlags(m_styleResolver->ruleFeatureSet());
+ m_styleEngine->combineCSSFeatureFlags(m_styleResolver->ruleFeatureSet());
}
void Document::clearStyleResolver()
@@ -2061,9 +2042,6 @@
if (render)
render->destroy();
- if (m_touchEventTargets && m_touchEventTargets->size() && parentDocument())
- parentDocument()->didRemoveEventTargetNode(this);
-
// This is required, as our Frame might delete itself as soon as it detaches
// us. However, this violates Node::detach() semantics, as it's never
// possible to re-attach. Eventually Document::detach() should be renamed,
@@ -2831,7 +2809,7 @@
void Document::seamlessParentUpdatedStylesheets()
{
- m_styleSheetCollections->didModifySeamlessParentStyleSheet();
+ m_styleEngine->didModifySeamlessParentStyleSheet();
styleResolverChanged(RecalcStyleImmediately);
}
@@ -2907,8 +2885,8 @@
// For more info, see the test at:
// http://www.hixie.ch/tests/evil/css/import/main/preferred.html
// -dwh
- m_styleSheetCollections->setSelectedStylesheetSetName(content);
- m_styleSheetCollections->setPreferredStylesheetSetName(content);
+ m_styleEngine->setSelectedStylesheetSetName(content);
+ m_styleEngine->setPreferredStylesheetSetName(content);
styleResolverChanged(RecalcStyleDeferred);
}
@@ -3282,17 +3260,17 @@
String Document::preferredStylesheetSet() const
{
- return m_styleSheetCollections->preferredStylesheetSetName();
+ return m_styleEngine->preferredStylesheetSetName();
}
String Document::selectedStylesheetSet() const
{
- return m_styleSheetCollections->selectedStylesheetSetName();
+ return m_styleEngine->selectedStylesheetSetName();
}
void Document::setSelectedStylesheetSet(const String& aString)
{
- m_styleSheetCollections->setSelectedStylesheetSetName(aString);
+ m_styleEngine->setSelectedStylesheetSetName(aString);
styleResolverChanged(RecalcStyleDeferred);
}
@@ -3312,9 +3290,9 @@
}
m_didCalculateStyleResolver = true;
- bool needsRecalc = m_styleSheetCollections->updateActiveStyleSheets(updateMode);
+ bool needsRecalc = m_styleEngine->updateActiveStyleSheets(updateMode);
- if (didLayoutWithPendingStylesheets() && !m_styleSheetCollections->hasPendingSheets()) {
+ if (didLayoutWithPendingStylesheets() && !m_styleEngine->hasPendingSheets()) {
// We need to manually repaint because we avoid doing all repaints in layout or style
// recalc while sheets are still loading to avoid FOUC.
m_pendingSheetLayout = IgnoreLayoutWithPendingSheets;
@@ -3668,24 +3646,24 @@
}
}
-void Document::textInserted(Node* text, unsigned offset, unsigned length)
+void Document::didInsertText(Node* text, unsigned offset, unsigned length)
{
if (!m_ranges.isEmpty()) {
HashSet<Range*>::const_iterator end = m_ranges.end();
for (HashSet<Range*>::const_iterator it = m_ranges.begin(); it != end; ++it)
- (*it)->textInserted(text, offset, length);
+ (*it)->didInsertText(text, offset, length);
}
// Update the markers for spelling and grammar checking.
m_markers->shiftMarkers(text, offset, length);
}
-void Document::textRemoved(Node* text, unsigned offset, unsigned length)
+void Document::didRemoveText(Node* text, unsigned offset, unsigned length)
{
if (!m_ranges.isEmpty()) {
HashSet<Range*>::const_iterator end = m_ranges.end();
for (HashSet<Range*>::const_iterator it = m_ranges.begin(); it != end; ++it)
- (*it)->textRemoved(text, offset, length);
+ (*it)->didRemoveText(text, offset, length);
}
// Update the markers for spelling and grammar checking.
@@ -3693,28 +3671,28 @@
m_markers->shiftMarkers(text, offset + length, 0 - length);
}
-void Document::textNodesMerged(Text* oldNode, unsigned offset)
+void Document::didMergeTextNodes(Text* oldNode, unsigned offset)
{
if (!m_ranges.isEmpty()) {
NodeWithIndex oldNodeWithIndex(oldNode);
HashSet<Range*>::const_iterator end = m_ranges.end();
for (HashSet<Range*>::const_iterator it = m_ranges.begin(); it != end; ++it)
- (*it)->textNodesMerged(oldNodeWithIndex, offset);
+ (*it)->didMergeTextNodes(oldNodeWithIndex, offset);
}
// FIXME: This should update markers for spelling and grammar checking.
}
-void Document::textNodeSplit(Text* oldNode)
+void Document::didSplitTextNode(Text* oldNode)
{
if (!m_ranges.isEmpty()) {
HashSet<Range*>::const_iterator end = m_ranges.end();
for (HashSet<Range*>::const_iterator it = m_ranges.begin(); it != end; ++it)
- (*it)->textNodeSplit(oldNode);
+ (*it)->didSplitTextNode(oldNode);
}
if (m_frame)
- m_frame->selection().textNodeSplit(*oldNode);
+ m_frame->selection().didSplitTextNode(*oldNode);
// FIXME: This should update markers for spelling and grammar checking.
}
@@ -3783,32 +3761,39 @@
void Document::addListenerTypeIfNeeded(const AtomicString& eventType)
{
- if (eventType == eventNames().DOMSubtreeModifiedEvent)
+ if (eventType == eventNames().DOMSubtreeModifiedEvent) {
+ UseCounter::count(this, UseCounter::DOMSubtreeModifiedEvent);
addMutationEventListenerTypeIfEnabled(DOMSUBTREEMODIFIED_LISTENER);
- else if (eventType == eventNames().DOMNodeInsertedEvent)
+ } else if (eventType == eventNames().DOMNodeInsertedEvent) {
+ UseCounter::count(this, UseCounter::DOMNodeInsertedEvent);
addMutationEventListenerTypeIfEnabled(DOMNODEINSERTED_LISTENER);
- else if (eventType == eventNames().DOMNodeRemovedEvent)
+ } else if (eventType == eventNames().DOMNodeRemovedEvent) {
+ UseCounter::count(this, UseCounter::DOMNodeRemovedEvent);
addMutationEventListenerTypeIfEnabled(DOMNODEREMOVED_LISTENER);
- else if (eventType == eventNames().DOMNodeRemovedFromDocumentEvent)
+ } else if (eventType == eventNames().DOMNodeRemovedFromDocumentEvent) {
+ UseCounter::count(this, UseCounter::DOMNodeRemovedFromDocumentEvent);
addMutationEventListenerTypeIfEnabled(DOMNODEREMOVEDFROMDOCUMENT_LISTENER);
- else if (eventType == eventNames().DOMNodeInsertedIntoDocumentEvent)
+ } else if (eventType == eventNames().DOMNodeInsertedIntoDocumentEvent) {
+ UseCounter::count(this, UseCounter::DOMNodeInsertedIntoDocumentEvent);
addMutationEventListenerTypeIfEnabled(DOMNODEINSERTEDINTODOCUMENT_LISTENER);
- else if (eventType == eventNames().DOMCharacterDataModifiedEvent)
+ } else if (eventType == eventNames().DOMCharacterDataModifiedEvent) {
+ UseCounter::count(this, UseCounter::DOMCharacterDataModifiedEvent);
addMutationEventListenerTypeIfEnabled(DOMCHARACTERDATAMODIFIED_LISTENER);
- else if (eventType == eventNames().overflowchangedEvent)
+ } else if (eventType == eventNames().overflowchangedEvent) {
addListenerType(OVERFLOWCHANGED_LISTENER);
- else if (eventType == eventNames().webkitAnimationStartEvent || (RuntimeEnabledFeatures::cssAnimationUnprefixedEnabled() && eventType == eventNames().animationstartEvent))
+ } else if (eventType == eventNames().webkitAnimationStartEvent || (RuntimeEnabledFeatures::cssAnimationUnprefixedEnabled() && eventType == eventNames().animationstartEvent)) {
addListenerType(ANIMATIONSTART_LISTENER);
- else if (eventType == eventNames().webkitAnimationEndEvent || (RuntimeEnabledFeatures::cssAnimationUnprefixedEnabled() && eventType == eventNames().animationendEvent))
+ } else if (eventType == eventNames().webkitAnimationEndEvent || (RuntimeEnabledFeatures::cssAnimationUnprefixedEnabled() && eventType == eventNames().animationendEvent)) {
addListenerType(ANIMATIONEND_LISTENER);
- else if (eventType == eventNames().webkitAnimationIterationEvent || (RuntimeEnabledFeatures::cssAnimationUnprefixedEnabled() && eventType == eventNames().animationiterationEvent))
+ } else if (eventType == eventNames().webkitAnimationIterationEvent || (RuntimeEnabledFeatures::cssAnimationUnprefixedEnabled() && eventType == eventNames().animationiterationEvent)) {
addListenerType(ANIMATIONITERATION_LISTENER);
- else if (eventType == eventNames().webkitTransitionEndEvent || eventType == eventNames().transitionendEvent)
+ } else if (eventType == eventNames().webkitTransitionEndEvent || eventType == eventNames().transitionendEvent) {
addListenerType(TRANSITIONEND_LISTENER);
- else if (eventType == eventNames().beforeloadEvent)
+ } else if (eventType == eventNames().beforeloadEvent) {
addListenerType(BEFORELOAD_LISTENER);
- else if (eventType == eventNames().scrollEvent)
+ } else if (eventType == eventNames().scrollEvent) {
addListenerType(SCROLL_LISTENER);
+ }
}
CSSStyleDeclaration* Document::getOverrideStyle(Element*, const String&)
@@ -5056,58 +5041,9 @@
return Touch::create(frame, target, identifier, screenX, screenY, pageX, pageY, radiusX, radiusY, rotationAngle, force);
}
-void Document::didAddTouchEventHandler(Node* handler)
+PassRefPtr<TouchList> Document::createTouchList(Vector<RefPtr<Touch> >& touches) const
{
- if (!m_touchEventTargets.get())
- m_touchEventTargets = adoptPtr(new TouchEventTargetSet);
- m_touchEventTargets->add(handler);
- if (Document* parent = parentDocument()) {
- parent->didAddTouchEventHandler(this);
- return;
- }
- if (Page* page = this->page()) {
- if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordinator())
- scrollingCoordinator->touchEventTargetRectsDidChange(this);
- if (m_touchEventTargets->size() == 1)
- page->chrome().client().needTouchEvents(true);
- }
-}
-
-void Document::didRemoveTouchEventHandler(Node* handler)
-{
- if (!m_touchEventTargets.get())
- return;
- ASSERT(m_touchEventTargets->contains(handler));
- m_touchEventTargets->remove(handler);
- if (Document* parent = parentDocument()) {
- parent->didRemoveTouchEventHandler(this);
- return;
- }
-
- Page* page = this->page();
- if (!page)
- return;
- if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordinator())
- scrollingCoordinator->touchEventTargetRectsDidChange(this);
- if (m_touchEventTargets->size())
- return;
- for (const Frame* frame = page->mainFrame(); frame; frame = frame->tree()->traverseNext()) {
- if (frame->document() && frame->document()->hasTouchEventHandlers())
- return;
- }
- page->chrome().client().needTouchEvents(false);
-}
-
-void Document::didRemoveEventTargetNode(Node* handler)
-{
- if (m_touchEventTargets && !m_touchEventTargets->isEmpty()) {
- if (handler == this)
- m_touchEventTargets->clear();
- else
- m_touchEventTargets->removeAll(handler);
- if (m_touchEventTargets->isEmpty() && parentDocument())
- parentDocument()->didRemoveEventTargetNode(this);
- }
+ return TouchList::create(touches);
}
void Document::resetLastHandledUserGestureTimestamp()
@@ -5148,13 +5084,6 @@
return loader;
}
-IntSize Document::viewportSize() const
-{
- if (!view())
- return IntSize();
- return view()->visibleContentRect(ScrollableArea::IncludeScrollbars).size();
-}
-
IntSize Document::initialViewportSize() const
{
if (!view())
@@ -5384,7 +5313,7 @@
bool Document::haveStylesheetsLoaded() const
{
- return !m_styleSheetCollections->hasPendingSheets() || m_ignorePendingStylesheets;
+ return !m_styleEngine->hasPendingSheets() || m_ignorePendingStylesheets;
}
Locale& Document::getCachedLocale(const AtomicString& locale)
@@ -5416,11 +5345,11 @@
return *m_templateDocument.get();
}
-PassRefPtr<FontLoader> Document::fontloader()
+PassRefPtr<FontFaceSet> Document::fonts()
{
- if (!m_fontloader)
- m_fontloader = FontLoader::create(this);
- return m_fontloader;
+ if (!m_fonts)
+ m_fonts = FontFaceSet::create(this);
+ return m_fonts;
}
void Document::didAssociateFormControl(Element* element)
diff --git a/Source/core/dom/Document.h b/Source/core/dom/Document.h
index 1d0be02..0e46a60 100644
--- a/Source/core/dom/Document.h
+++ b/Source/core/dom/Document.h
@@ -49,7 +49,6 @@
#include "weborigin/ReferrerPolicy.h"
#include "core/platform/Timer.h"
#include "core/rendering/HitTestRequest.h"
-#include "wtf/Deque.h"
#include "wtf/HashSet.h"
#include "wtf/OwnPtr.h"
#include "wtf/PassOwnPtr.h"
@@ -146,7 +145,7 @@
class Settings;
class StyleResolver;
class StyleSheet;
-class StyleSheetCollections;
+class StyleEngine;
class StyleSheetContents;
class StyleSheetList;
class Text;
@@ -161,7 +160,7 @@
struct AnnotatedRegionValue;
-class FontLoader;
+class FontFaceSet;
typedef int ExceptionCode;
@@ -192,8 +191,6 @@
};
const int numNodeListInvalidationTypes = InvalidateOnAnyAttrChange + 1;
-typedef HashCountedSet<Node*> TouchEventTargetSet;
-
enum DocumentClass {
DefaultDocumentClass = 0,
HTMLDocumentClass = 1,
@@ -223,8 +220,6 @@
using ContainerNode::ref;
using ContainerNode::deref;
- Element* getElementById(const AtomicString& id) const;
-
virtual bool canContainRangeEndPoint() const { return true; }
SelectorQueryCache* selectorQueryCache();
@@ -443,7 +438,7 @@
// This is a DOM function.
StyleSheetList* styleSheets();
- StyleSheetCollections* styleSheetCollections() { return m_styleSheetCollections.get(); }
+ StyleEngine* styleEngine() { return m_styleEngine.get(); }
bool gotoAnchorNeededAfterStylesheetsLoad() { return m_gotoAnchorNeededAfterStylesheetsLoad; }
void setGotoAnchorNeededAfterStylesheetsLoad(bool b) { m_gotoAnchorNeededAfterStylesheetsLoad = b; }
@@ -700,10 +695,10 @@
void nodeWillBeRemoved(Node*);
bool canReplaceChild(Node* newChild, Node* oldChild);
- void textInserted(Node*, unsigned offset, unsigned length);
- void textRemoved(Node*, unsigned offset, unsigned length);
- void textNodesMerged(Text* oldNode, unsigned offset);
- void textNodeSplit(Text* oldNode);
+ void didInsertText(Node*, unsigned offset, unsigned length);
+ void didRemoveText(Node*, unsigned offset, unsigned length);
+ void didMergeTextNodes(Text* oldNode, unsigned offset);
+ void didSplitTextNode(Text* oldNode);
void setDOMWindow(DOMWindow* domWindow) { m_domWindow = domWindow; }
DOMWindow* domWindow() const { return m_domWindow; }
@@ -974,6 +969,7 @@
bool isDelayingLoadEvent() const { return m_loadEventDelayCount; }
PassRefPtr<Touch> createTouch(DOMWindow*, EventTarget*, int identifier, int pageX, int pageY, int screenX, int screenY, int radiusX, int radiusY, float rotationAngle, float force) const;
+ PassRefPtr<TouchList> createTouchList(Vector<RefPtr<Touch> >&) const;
const DocumentTiming* timing() const { return &m_documentTiming; }
@@ -989,21 +985,11 @@
double lastHandledUserGestureTimestamp() const { return m_lastHandledUserGestureTimestamp; }
void resetLastHandledUserGestureTimestamp();
- bool hasTouchEventHandlers() const { return (m_touchEventTargets.get()) ? m_touchEventTargets->size() : false; }
-
- void didAddTouchEventHandler(Node*);
- void didRemoveTouchEventHandler(Node*);
-
- void didRemoveEventTargetNode(Node*);
-
- const TouchEventTargetSet* touchEventTargets() const { return m_touchEventTargets.get(); }
-
bool isInDocumentWrite() { return m_writeRecursionDepth > 0; }
void suspendScheduledTasks(ActiveDOMObject::ReasonForSuspension);
void resumeScheduledTasks();
- IntSize viewportSize() const;
IntSize initialViewportSize() const;
Prerenderer* prerenderer() { return m_prerenderer.get(); }
@@ -1063,7 +1049,7 @@
virtual DOMWindow* executingWindow() OVERRIDE { return domWindow(); }
virtual void userEventWasHandled() OVERRIDE { resetLastHandledUserGestureTimestamp(); }
- PassRefPtr<FontLoader> fontloader();
+ PassRefPtr<FontFaceSet> fonts();
DocumentLifecycleNotifier* lifecycleNotifier();
enum HttpRefreshType {
@@ -1231,7 +1217,7 @@
MutationObserverOptions m_mutationObserverTypes;
- OwnPtr<StyleSheetCollections> m_styleSheetCollections;
+ OwnPtr<StyleEngine> m_styleEngine;
RefPtr<StyleSheetList> m_styleSheetList;
OwnPtr<FormController> m_formController;
@@ -1347,8 +1333,6 @@
bool m_writeRecursionIsTooDeep;
unsigned m_writeRecursionDepth;
- OwnPtr<TouchEventTargetSet> m_touchEventTargets;
-
double m_lastHandledUserGestureTimestamp;
RefPtr<ScriptedAnimationController> m_scriptedAnimationController;
@@ -1385,7 +1369,7 @@
RefPtr<Document> m_templateDocument;
Document* m_templateDocumentHost; // Manually managed weakref (backpointer from m_templateDocument).
- RefPtr<FontLoader> m_fontloader;
+ RefPtr<FontFaceSet> m_fonts;
Timer<Document> m_didAssociateFormControlsTimer;
HashSet<RefPtr<Element> > m_associatedFormControls;
diff --git a/Source/core/dom/Document.idl b/Source/core/dom/Document.idl
index f2fba14..a18606d 100644
--- a/Source/core/dom/Document.idl
+++ b/Source/core/dom/Document.idl
@@ -167,7 +167,7 @@
[EnabledAtRuntime=CSSRegions] WebKitNamedFlowCollection webkitGetNamedFlows();
- [EnabledAtRuntime=FontLoadEvents] readonly attribute FontLoader fontloader;
+ [EnabledAtRuntime=FontLoadEvents] readonly attribute FontFaceSet fonts;
// Event handler DOM attributes
[NotEnumerable] attribute EventHandler onabort;
@@ -259,7 +259,7 @@
[Default=Undefined] optional long webkitRadiusY,
[Default=Undefined] optional float webkitRotationAngle,
[Default=Undefined] optional float webkitForce);
- [EnabledAtRuntime=Touch, Custom, RaisesException] TouchList createTouchList();
+ [EnabledAtRuntime=Touch] TouchList createTouchList(Touch... touches);
[DeprecateAs=PrefixedDocumentRegister, EnabledAtRuntime=CustomElements, ImplementedAs=registerElement, CallWith=ScriptState, CustomElementCallbacks=Enable, RaisesException] CustomElementConstructor webkitRegister(DOMString name, optional Dictionary options);
[EnabledAtRuntime=CustomElements, ImplementedAs=registerElement, CallWith=ScriptState, CustomElementCallbacks=Enable, RaisesException] CustomElementConstructor register(DOMString name, optional Dictionary options);
diff --git a/Source/core/dom/DocumentLifecycleObserver.h b/Source/core/dom/DocumentLifecycleObserver.h
index 27f1a68..6838e68 100644
--- a/Source/core/dom/DocumentLifecycleObserver.h
+++ b/Source/core/dom/DocumentLifecycleObserver.h
@@ -42,6 +42,7 @@
virtual ~DocumentLifecycleObserver();
virtual void documentWasDetached() { }
virtual void documentWasDisposed() { }
+ virtual void documentBeingDestroyed() { }
};
class DocumentLifecycleNotifier : public ContextLifecycleNotifier {
@@ -50,6 +51,7 @@
void notifyDocumentWasDetached();
void notifyDocumentWasDisposed();
+ void notifyDocumentBeingDestroyed();
virtual void addObserver(LifecycleObserver*) OVERRIDE;
virtual void removeObserver(LifecycleObserver*) OVERRIDE;
@@ -80,6 +82,13 @@
(*i)->documentWasDisposed();
}
+inline void DocumentLifecycleNotifier::notifyDocumentBeingDestroyed()
+{
+ TemporaryChange<IterationType> scope(this->m_iterating, IteratingOverDocumentObservers);
+ for (DocumentObserverSet::iterator i = m_documentObservers.begin(); i != m_documentObservers.end(); ++i)
+ (*i)->documentBeingDestroyed();
+}
+
} // namespace WebCore
#endif // DocumentLifecycleObserver_h
diff --git a/Source/core/dom/DocumentStyleSheetCollection.cpp b/Source/core/dom/DocumentStyleSheetCollection.cpp
index 8055751..c4e18a9 100644
--- a/Source/core/dom/DocumentStyleSheetCollection.cpp
+++ b/Source/core/dom/DocumentStyleSheetCollection.cpp
@@ -34,7 +34,7 @@
#include "core/dom/Document.h"
#include "core/dom/Element.h"
#include "core/dom/ProcessingInstruction.h"
-#include "core/dom/StyleSheetCollections.h"
+#include "core/dom/StyleEngine.h"
#include "core/html/HTMLIFrameElement.h"
#include "core/html/HTMLLinkElement.h"
#include "core/html/HTMLStyleElement.h"
@@ -51,7 +51,7 @@
ASSERT(treeScope.rootNode() == &treeScope.rootNode()->document());
}
-void DocumentStyleSheetCollection::collectStyleSheets(StyleSheetCollections* collections, Vector<RefPtr<StyleSheet> >& styleSheets, Vector<RefPtr<CSSStyleSheet> >& activeSheets)
+void DocumentStyleSheetCollection::collectStyleSheets(StyleEngine* collections, Vector<RefPtr<StyleSheet> >& styleSheets, Vector<RefPtr<CSSStyleSheet> >& activeSheets)
{
if (document()->settings() && !document()->settings()->authorAndUserStylesEnabled())
return;
@@ -100,7 +100,7 @@
if (!sheet)
title = nullAtom;
} else if (n->isSVGElement() && n->hasTagName(SVGNames::styleTag)) {
- sheet = static_cast<SVGStyleElement*>(n)->sheet();
+ sheet = toSVGStyleElement(n)->sheet();
} else {
sheet = toHTMLStyleElement(n)->sheet();
}
@@ -143,10 +143,10 @@
HTMLIFrameElement* seamlessParentIFrame = document->seamlessParentIFrame();
if (!seamlessParentIFrame)
return;
- sheets.append(seamlessParentIFrame->document().styleSheetCollections()->activeAuthorStyleSheets());
+ sheets.append(seamlessParentIFrame->document().styleEngine()->activeAuthorStyleSheets());
}
-bool DocumentStyleSheetCollection::updateActiveStyleSheets(StyleSheetCollections* collections, StyleResolverUpdateMode updateMode)
+bool DocumentStyleSheetCollection::updateActiveStyleSheets(StyleEngine* collections, StyleResolverUpdateMode updateMode)
{
Vector<RefPtr<StyleSheet> > styleSheets;
Vector<RefPtr<CSSStyleSheet> > activeCSSStyleSheets;
diff --git a/Source/core/dom/DocumentStyleSheetCollection.h b/Source/core/dom/DocumentStyleSheetCollection.h
index 9f035f0..1a039fb 100644
--- a/Source/core/dom/DocumentStyleSheetCollection.h
+++ b/Source/core/dom/DocumentStyleSheetCollection.h
@@ -35,7 +35,7 @@
class CSSStyleSheet;
class StyleSheet;
class StyleSheetCollection;
-class StyleSheetCollections;
+class StyleEngine;
class TreeScope;
class DocumentStyleSheetCollection FINAL : public StyleSheetCollection {
@@ -43,10 +43,10 @@
public:
explicit DocumentStyleSheetCollection(TreeScope&);
- bool updateActiveStyleSheets(StyleSheetCollections*, StyleResolverUpdateMode);
+ bool updateActiveStyleSheets(StyleEngine*, StyleResolverUpdateMode);
private:
- void collectStyleSheets(StyleSheetCollections*, Vector<RefPtr<StyleSheet> >& styleSheets, Vector<RefPtr<CSSStyleSheet> >& activeSheets);
+ void collectStyleSheets(StyleEngine*, Vector<RefPtr<StyleSheet> >& styleSheets, Vector<RefPtr<CSSStyleSheet> >& activeSheets);
};
}
diff --git a/Source/core/dom/Element.cpp b/Source/core/dom/Element.cpp
index 02518c5..1b732d9 100644
--- a/Source/core/dom/Element.cpp
+++ b/Source/core/dom/Element.cpp
@@ -1502,7 +1502,7 @@
// If "rem" units are used anywhere in the document, and if the document element's font size changes, then go ahead and force font updating
// all the way down the tree. This is simpler than having to maintain a cache of objects (and such font size changes should be rare anyway).
- if (document().styleSheetCollections()->usesRemUnits() && document().documentElement() == this && oldStyle && newStyle && oldStyle->fontSize() != newStyle->fontSize()) {
+ if (document().styleEngine()->usesRemUnits() && document().documentElement() == this && oldStyle && newStyle && oldStyle->fontSize() != newStyle->fontSize()) {
// Cached RenderStyles may depend on the re units.
document().styleResolver()->invalidateMatchedPropertiesCache();
return Force;
@@ -2464,15 +2464,24 @@
void Element::createPseudoElementIfNeeded(PseudoId pseudoId)
{
+ if (needsPseudoElement(pseudoId))
+ createPseudoElement(pseudoId);
+}
+
+bool Element::needsPseudoElement(PseudoId pseudoId) const
+{
if (pseudoId == BACKDROP && !isInTopLayer())
- return;
-
+ return false;
if (!renderer() || !pseudoElementRendererIsNeeded(renderer()->getCachedPseudoStyle(pseudoId)))
- return;
-
+ return false;
if (!renderer()->canHaveGeneratedChildren())
- return;
+ return false;
+ return true;
+}
+void Element::createPseudoElement(PseudoId pseudoId)
+{
+ ASSERT(needsPseudoElement(pseudoId));
ASSERT(!isPseudoElement());
RefPtr<PseudoElement> element = PseudoElement::create(this, pseudoId);
if (pseudoId == BACKDROP)
diff --git a/Source/core/dom/Element.h b/Source/core/dom/Element.h
index 25c434b..a1bf613 100644
--- a/Source/core/dom/Element.h
+++ b/Source/core/dom/Element.h
@@ -703,7 +703,10 @@
void rebuildPresentationAttributeStyle();
void updatePseudoElement(PseudoId, StyleRecalcChange);
- void createPseudoElementIfNeeded(PseudoId);
+
+ inline void createPseudoElementIfNeeded(PseudoId);
+ inline bool needsPseudoElement(PseudoId) const;
+ void createPseudoElement(PseudoId);
// FIXME: Everyone should allow author shadows.
virtual bool areAuthorShadowsAllowed() const { return true; }
diff --git a/Source/core/dom/Element.idl b/Source/core/dom/Element.idl
index 3de2173..55df834 100644
--- a/Source/core/dom/Element.idl
+++ b/Source/core/dom/Element.idl
@@ -124,10 +124,10 @@
// Mozilla version
const unsigned short ALLOW_KEYBOARD_INPUT = 1;
- [EnabledAtRuntime=Fullscreen] void webkitRequestFullScreen([Default=Undefined] optional unsigned short flags);
+ [EnabledAtRuntime=Fullscreen, PerWorldBindings, ActivityLog=Access] void webkitRequestFullScreen([Default=Undefined] optional unsigned short flags);
// W3C version
- [EnabledAtRuntime=Fullscreen] void webkitRequestFullscreen();
+ [EnabledAtRuntime=Fullscreen, PerWorldBindings, ActivityLog=Access] void webkitRequestFullscreen();
void webkitRequestPointerLock();
diff --git a/Source/core/dom/ElementRareData.h b/Source/core/dom/ElementRareData.h
index 7371c7a..f483681 100644
--- a/Source/core/dom/ElementRareData.h
+++ b/Source/core/dom/ElementRareData.h
@@ -30,6 +30,7 @@
#include "core/dom/shadow/ElementShadow.h"
#include "core/html/ClassList.h"
#include "core/html/ime/InputMethodContext.h"
+#include "core/inspector/InspectorInstrumentation.h"
#include "core/rendering/style/StyleInheritedData.h"
#include "wtf/OwnPtr.h"
@@ -227,8 +228,9 @@
ASSERT(!m_backdrop);
}
-inline void ElementRareData::setPseudoElement(PseudoId pseudoId, PassRefPtr<PseudoElement> element)
+inline void ElementRareData::setPseudoElement(PseudoId pseudoId, PassRefPtr<PseudoElement> prpElement)
{
+ RefPtr<PseudoElement> element = prpElement;
switch (pseudoId) {
case BEFORE:
releasePseudoElement(m_generatedBefore.get());
@@ -245,6 +247,7 @@
default:
ASSERT_NOT_REACHED();
}
+ InspectorInstrumentation::pseudoElementCreated(element.get());
}
inline PseudoElement* ElementRareData::pseudoElement(PseudoId pseudoId) const
@@ -266,6 +269,8 @@
if (!element)
return;
+ InspectorInstrumentation::pseudoElementDestroyed(element);
+
if (element->attached())
element->detach();
diff --git a/Source/core/dom/Entity.h b/Source/core/dom/Entity.h
index 31e042a..ee46c2c 100644
--- a/Source/core/dom/Entity.h
+++ b/Source/core/dom/Entity.h
@@ -26,13 +26,7 @@
namespace WebCore {
-// FIXME: This abstract class is only here so that the JavaScript and bindings can continue to be compiled.
class Entity : public ContainerNode {
-public:
- String publicId() const { ASSERT_NOT_REACHED(); return String(); }
- String systemId() const { ASSERT_NOT_REACHED(); return String(); }
- String notationName() const { ASSERT_NOT_REACHED(); return String(); }
-
private:
Entity() : ContainerNode(0)
{
diff --git a/Source/core/dom/Entity.idl b/Source/core/dom/Entity.idl
index 12b9234..151572f 100644
--- a/Source/core/dom/Entity.idl
+++ b/Source/core/dom/Entity.idl
@@ -16,10 +16,10 @@
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
-[
-] interface Entity : Node {
- [TreatReturnedNullStringAs=Null] readonly attribute DOMString publicId;
- [TreatReturnedNullStringAs=Null] readonly attribute DOMString systemId;
- [TreatReturnedNullStringAs=Null] readonly attribute DOMString notationName;
+
+// FIXME: Remove Entity interface. We never create Entity objects. We have this
+// interface to provide window.Entity.
+interface Entity : Node {
+ // We don't need to provide any attributes.
};
diff --git a/Source/core/dom/EventNames.h b/Source/core/dom/EventNames.h
index 1633336..225727d 100644
--- a/Source/core/dom/EventNames.h
+++ b/Source/core/dom/EventNames.h
@@ -89,6 +89,7 @@
macro(load) \
macro(loading) \
macro(loadingdone) \
+ macro(loadingerror) \
macro(loadstart) \
macro(message) \
macro(midimessage) \
diff --git a/Source/core/dom/EventTargetFactory.in b/Source/core/dom/EventTargetFactory.in
index 5227c79..9ead7d2 100644
--- a/Source/core/dom/EventTargetFactory.in
+++ b/Source/core/dom/EventTargetFactory.in
@@ -1,6 +1,6 @@
namespace="EventTarget"
-core/css/FontLoader
+core/css/FontFaceSet
core/dom/MessagePort
core/dom/Node
core/dom/WebKitNamedFlow ImplementedAs=NamedFlow
diff --git a/Source/core/dom/KeyboardEvent.cpp b/Source/core/dom/KeyboardEvent.cpp
index 4dc27d7..b20d77a 100644
--- a/Source/core/dom/KeyboardEvent.cpp
+++ b/Source/core/dom/KeyboardEvent.cpp
@@ -70,7 +70,6 @@
if (key.isKeypad())
return KeyboardEvent::DOM_KEY_LOCATION_NUMPAD;
- // FIXME: Support DOM_KEY_LOCATION_MOBILE & DOM_KEY_LOCATION_JOYSTICK (crbug.com/265446).
switch (key.windowsVirtualKeyCode()) {
case VK_LCONTROL:
case VK_LSHIFT:
diff --git a/Source/core/dom/KeyboardEvent.h b/Source/core/dom/KeyboardEvent.h
index 274e2c7..3cbeb06 100644
--- a/Source/core/dom/KeyboardEvent.h
+++ b/Source/core/dom/KeyboardEvent.h
@@ -51,9 +51,6 @@
DOM_KEY_LOCATION_LEFT = 0x01,
DOM_KEY_LOCATION_RIGHT = 0x02,
DOM_KEY_LOCATION_NUMPAD = 0x03
- // FIXME: The following values are not supported yet (crbug.com/265446)
- // DOM_KEY_LOCATION_MOBILE = 0x04,
- // DOM_KEY_LOCATION_JOYSTICK = 0x05
};
static PassRefPtr<KeyboardEvent> create()
diff --git a/Source/core/dom/KeyboardEvent.idl b/Source/core/dom/KeyboardEvent.idl
index 81b2c17..62dd799 100644
--- a/Source/core/dom/KeyboardEvent.idl
+++ b/Source/core/dom/KeyboardEvent.idl
@@ -25,10 +25,6 @@
const unsigned long DOM_KEY_LOCATION_LEFT = 0x01;
const unsigned long DOM_KEY_LOCATION_RIGHT = 0x02;
const unsigned long DOM_KEY_LOCATION_NUMPAD = 0x03;
- // FIXME: The following constants are defined in the specification but
- // not yet supported (crbug.com/265446).
- // const unsigned long DOM_KEY_LOCATION_MOBILE = 0x04;
- // const unsigned long DOM_KEY_LOCATION_JOYSTICK = 0x05;
[InitializedByEventConstructor] readonly attribute DOMString keyIdentifier;
[InitializedByEventConstructor] readonly attribute unsigned long location;
diff --git a/Source/core/dom/Node.cpp b/Source/core/dom/Node.cpp
index 0e3d2cb..f6a2d3e 100644
--- a/Source/core/dom/Node.cpp
+++ b/Source/core/dom/Node.cpp
@@ -27,6 +27,7 @@
#include "HTMLNames.h"
#include "XMLNames.h"
+#include "bindings/v8/ExceptionMessages.h"
#include "bindings/v8/ExceptionState.h"
#include "bindings/v8/ExceptionStatePlaceholder.h"
#include "core/accessibility/AXObjectCache.h"
@@ -62,6 +63,7 @@
#include "core/dom/TemplateContentDocumentFragment.h"
#include "core/dom/Text.h"
#include "core/dom/TextEvent.h"
+#include "core/dom/TouchController.h"
#include "core/dom/TouchEvent.h"
#include "core/dom/TreeScopeAdopter.h"
#include "core/dom/UIEvent.h"
@@ -310,7 +312,7 @@
{
if (hasEventTargetData()) {
if (document)
- document->didRemoveEventTargetNode(this);
+ TouchController::from(document)->didRemoveEventTargetNode(document, this);
clearEventTargetData();
}
@@ -538,7 +540,7 @@
// Both non-empty text nodes. Merge them.
unsigned offset = text->length();
text->appendData(nextText->data());
- document().textNodesMerged(nextText.get(), offset);
+ document().didMergeTextNodes(nextText.get(), offset);
nextText->remove(IGNORE_EXCEPTION);
}
@@ -897,9 +899,13 @@
// FIXME: Raise NamespaceError if prefix is malformed per the Namespaces in XML specification.
const AtomicString& nodeNamespaceURI = namespaceURI();
- if ((nodeNamespaceURI.isEmpty() && !prefix.isEmpty())
- || (prefix == xmlAtom && nodeNamespaceURI != XMLNames::xmlNamespaceURI)) {
- es.throwDOMException(NamespaceError);
+ if (nodeNamespaceURI.isEmpty() && !prefix.isEmpty()) {
+ es.throwDOMException(NamespaceError, ExceptionMessages::failedToSet("prefix", "Node", "No namespace is set, so a namespace prefix may not be set."));
+ return;
+ }
+
+ if (prefix == xmlAtom && nodeNamespaceURI != XMLNames::xmlNamespaceURI) {
+ es.throwDOMException(NamespaceError, ExceptionMessages::failedToSet("prefix", "Node", "The prefix '" + xmlAtom + "' may not be set on namespace '" + nodeNamespaceURI + "'."));
return;
}
// Attribute-specific checks are in Attr::setPrefix().
@@ -2065,23 +2071,25 @@
cache->remove(this);
const EventListenerVector& mousewheelListeners = getEventListeners(eventNames().mousewheelEvent);
- WheelController* oldController = WheelController::from(oldDocument);
- WheelController* newController = WheelController::from(&document());
+ WheelController* oldWheelController = WheelController::from(oldDocument);
+ WheelController* newWheelController = WheelController::from(&document());
for (size_t i = 0; i < mousewheelListeners.size(); ++i) {
- oldController->didRemoveWheelEventHandler(oldDocument);
- newController->didAddWheelEventHandler(&document());
+ oldWheelController->didRemoveWheelEventHandler(oldDocument);
+ newWheelController->didAddWheelEventHandler(&document());
}
const EventListenerVector& wheelListeners = getEventListeners(eventNames().wheelEvent);
for (size_t i = 0; i < wheelListeners.size(); ++i) {
- oldController->didRemoveWheelEventHandler(oldDocument);
- newController->didAddWheelEventHandler(&document());
+ oldWheelController->didRemoveWheelEventHandler(oldDocument);
+ newWheelController->didAddWheelEventHandler(&document());
}
- if (const TouchEventTargetSet* touchHandlers = oldDocument ? oldDocument->touchEventTargets() : 0) {
+ TouchController* oldTouchController = TouchController::from(oldDocument);
+ if (const TouchEventTargetSet* touchHandlers = oldDocument ? oldTouchController->touchEventTargets() : 0) {
+ TouchController* newTouchController = TouchController::from(&document());
while (touchHandlers->contains(this)) {
- oldDocument->didRemoveTouchEventHandler(this);
- document().didAddTouchEventHandler(this);
+ oldTouchController->didRemoveTouchEventHandler(oldDocument, this);
+ newTouchController->didAddTouchEventHandler(&document(), this);
}
}
@@ -2108,7 +2116,7 @@
if (eventType == eventNames().wheelEvent || eventType == eventNames().mousewheelEvent)
WheelController::from(&document)->didAddWheelEventHandler(&document);
else if (eventNames().isTouchEventType(eventType))
- document.didAddTouchEventHandler(targetNode);
+ TouchController::from(&document)->didAddTouchEventHandler(&document, targetNode);
return true;
}
@@ -2129,7 +2137,7 @@
if (eventType == eventNames().wheelEvent || eventType == eventNames().mousewheelEvent)
WheelController::from(&document)->didAddWheelEventHandler(&document);
else if (eventNames().isTouchEventType(eventType))
- document.didRemoveTouchEventHandler(targetNode);
+ TouchController::from(&document)->didRemoveTouchEventHandler(&document, targetNode);
return true;
}
diff --git a/Source/core/dom/NodeRenderingContext.cpp b/Source/core/dom/NodeRenderingContext.cpp
index da6f56f..236ac4f 100644
--- a/Source/core/dom/NodeRenderingContext.cpp
+++ b/Source/core/dom/NodeRenderingContext.cpp
@@ -43,15 +43,6 @@
namespace WebCore {
-NodeRenderingContext::NodeRenderingContext(Node* node, RenderStyle* style)
- : m_node(node)
- , m_renderingParent(0)
- , m_style(style)
- , m_parentFlowRenderer(0)
-{
- m_renderingParent = NodeRenderingTraversal::parent(node, &m_parentDetails);
-}
-
static bool isRendererReparented(const RenderObject* renderer)
{
if (!renderer->node()->isElementNode())
diff --git a/Source/core/dom/NodeRenderingContext.h b/Source/core/dom/NodeRenderingContext.h
index c31bb1f..ac2bab3 100644
--- a/Source/core/dom/NodeRenderingContext.h
+++ b/Source/core/dom/NodeRenderingContext.h
@@ -40,7 +40,14 @@
class NodeRenderingContext {
public:
- NodeRenderingContext(Node*, RenderStyle* = 0);
+ explicit NodeRenderingContext(Node* node, RenderStyle* style = 0)
+ : m_node(node)
+ , m_renderingParent(0)
+ , m_style(style)
+ , m_parentFlowRenderer(0)
+ {
+ m_renderingParent = NodeRenderingTraversal::parent(node, &m_parentDetails);
+ }
void createRendererForTextIfNeeded();
void createRendererForElementIfNeeded();
diff --git a/Source/core/dom/Notation.cpp b/Source/core/dom/Notation.cpp
deleted file mode 100644
index e635eab..0000000
--- a/Source/core/dom/Notation.cpp
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (C) 2000 Peter Kelly (pmk@post.com)
- * Copyright (C) 2006, 2009 Apple Inc. All rights reserved.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include "config.h"
-#include "core/dom/Notation.h"
-
-namespace WebCore {
-
-Notation::Notation(TreeScope* treeScope, const String& name, const String& publicId, const String& systemId)
- : ContainerNode(treeScope)
- , m_name(name)
- , m_publicId(publicId)
- , m_systemId(systemId)
-{
- ASSERT_NOT_REACHED();
- ScriptWrappable::init(this);
-}
-
-String Notation::nodeName() const
-{
- return m_name;
-}
-
-Node::NodeType Notation::nodeType() const
-{
- return NOTATION_NODE;
-}
-
-PassRefPtr<Node> Notation::cloneNode(bool /*deep*/)
-{
- // Spec says cloning Notation nodes is "implementation dependent". We do not support it.
- return 0;
-}
-
-bool Notation::childTypeAllowed(NodeType) const
-{
- return false;
-}
-
-} // namespace
diff --git a/Source/core/dom/Notation.h b/Source/core/dom/Notation.h
index 0d59e02..30401f2 100644
--- a/Source/core/dom/Notation.h
+++ b/Source/core/dom/Notation.h
@@ -26,26 +26,15 @@
namespace WebCore {
-// FIXME: This class is never instantiated. Maybe it should be removed.
-
-class Notation FINAL : public ContainerNode {
-public:
- const String& publicId() const { return m_publicId; }
- const String& systemId() const { return m_systemId; }
-
+class Notation : public ContainerNode {
private:
- Notation(TreeScope*, const String& name, const String& publicId, const String& systemId);
-
- virtual String nodeName() const;
- virtual NodeType nodeType() const;
- virtual PassRefPtr<Node> cloneNode(bool deep = true);
- virtual bool childTypeAllowed(NodeType) const;
-
- String m_name;
- String m_publicId;
- String m_systemId;
+ Notation(TreeScope* treeScope) : ContainerNode(treeScope)
+ {
+ ASSERT_NOT_REACHED();
+ ScriptWrappable::init(this);
+ }
};
-} //namespace
+} // namespace WebCore
#endif
diff --git a/Source/core/dom/Notation.idl b/Source/core/dom/Notation.idl
index 4ac628f..5ad13ec 100644
--- a/Source/core/dom/Notation.idl
+++ b/Source/core/dom/Notation.idl
@@ -17,8 +17,9 @@
* Boston, MA 02110-1301, USA.
*/
+// FIXME: Remove Notation interface. We never create Notation objects. We have
+// this interface to provide window.Notation.
interface Notation : Node {
- [TreatReturnedNullStringAs=Null] readonly attribute DOMString publicId;
- [TreatReturnedNullStringAs=Null] readonly attribute DOMString systemId;
+ // We don't need to provide any attributes.
};
diff --git a/Source/core/dom/ProcessingInstruction.cpp b/Source/core/dom/ProcessingInstruction.cpp
index 94ee37e..be736e8 100644
--- a/Source/core/dom/ProcessingInstruction.cpp
+++ b/Source/core/dom/ProcessingInstruction.cpp
@@ -26,7 +26,7 @@
#include "core/css/MediaList.h"
#include "core/css/StyleSheetContents.h"
#include "core/dom/Document.h"
-#include "core/dom/StyleSheetCollections.h"
+#include "core/dom/StyleEngine.h"
#include "core/fetch/CSSStyleSheetResource.h"
#include "core/fetch/FetchRequest.h"
#include "core/fetch/ResourceFetcher.h"
@@ -63,7 +63,7 @@
m_resource->removeClient(this);
if (inDocument())
- document().styleSheetCollections()->removeStyleSheetCandidateNode(this);
+ document().styleEngine()->removeStyleSheetCandidateNode(this);
}
String ProcessingInstruction::nodeName() const
@@ -133,7 +133,7 @@
return;
m_loading = true;
- document().styleSheetCollections()->addPendingSheet();
+ document().styleEngine()->addPendingSheet();
FetchRequest request(ResourceRequest(document().completeURL(href)), FetchInitiatorTypeNames::processinginstruction);
if (m_isXSL)
m_resource = document().fetcher()->fetchXSLStyleSheet(request);
@@ -151,7 +151,7 @@
else {
// The request may have been denied if (for example) the stylesheet is local and the document is remote.
m_loading = false;
- document().styleSheetCollections()->removePendingSheet(this);
+ document().styleEngine()->removePendingSheet(this);
}
}
}
@@ -169,7 +169,7 @@
bool ProcessingInstruction::sheetLoaded()
{
if (!isLoading()) {
- document().styleSheetCollections()->removePendingSheet(this);
+ document().styleEngine()->removePendingSheet(this);
return true;
}
return false;
@@ -248,7 +248,7 @@
CharacterData::insertedInto(insertionPoint);
if (!insertionPoint->inDocument())
return InsertionDone;
- document().styleSheetCollections()->addStyleSheetCandidateNode(this, m_createdByParser);
+ document().styleEngine()->addStyleSheetCandidateNode(this, m_createdByParser);
checkStyleSheet();
return InsertionDone;
}
@@ -259,7 +259,7 @@
if (!insertionPoint->inDocument())
return;
- document().styleSheetCollections()->removeStyleSheetCandidateNode(this);
+ document().styleEngine()->removeStyleSheetCandidateNode(this);
RefPtr<StyleSheet> removedSheet = m_sheet;
diff --git a/Source/core/dom/Range.cpp b/Source/core/dom/Range.cpp
index 7767ffd..a6a6d7d 100644
--- a/Source/core/dom/Range.cpp
+++ b/Source/core/dom/Range.cpp
@@ -1726,7 +1726,7 @@
boundary.setOffset(boundaryOffset + length);
}
-void Range::textInserted(Node* text, unsigned offset, unsigned length)
+void Range::didInsertText(Node* text, unsigned offset, unsigned length)
{
ASSERT(text);
ASSERT(&text->document() == m_ownerDocument);
@@ -1747,7 +1747,7 @@
boundary.setOffset(boundaryOffset - length);
}
-void Range::textRemoved(Node* text, unsigned offset, unsigned length)
+void Range::didRemoveText(Node* text, unsigned offset, unsigned length)
{
ASSERT(text);
ASSERT(&text->document() == m_ownerDocument);
@@ -1763,7 +1763,7 @@
boundary.set(oldNode.node()->previousSibling(), offset, 0);
}
-void Range::textNodesMerged(NodeWithIndex& oldNode, unsigned offset)
+void Range::didMergeTextNodes(NodeWithIndex& oldNode, unsigned offset)
{
ASSERT(oldNode.node());
ASSERT(&oldNode.node()->document() == m_ownerDocument);
@@ -1775,7 +1775,7 @@
boundaryTextNodesMerged(m_end, oldNode, offset);
}
-static inline void boundaryTextNodesSplit(RangeBoundaryPoint& boundary, Text* oldNode)
+static inline void boundaryTextNodeSplit(RangeBoundaryPoint& boundary, Text* oldNode)
{
if (boundary.container() != oldNode)
return;
@@ -1785,7 +1785,7 @@
boundary.set(oldNode->nextSibling(), boundaryOffset - oldNode->length(), 0);
}
-void Range::textNodeSplit(Text* oldNode)
+void Range::didSplitTextNode(Text* oldNode)
{
ASSERT(oldNode);
ASSERT(&oldNode->document() == m_ownerDocument);
@@ -1793,8 +1793,8 @@
ASSERT(oldNode->isTextNode());
ASSERT(oldNode->nextSibling());
ASSERT(oldNode->nextSibling()->isTextNode());
- boundaryTextNodesSplit(m_start, oldNode);
- boundaryTextNodesSplit(m_end, oldNode);
+ boundaryTextNodeSplit(m_start, oldNode);
+ boundaryTextNodeSplit(m_end, oldNode);
}
void Range::expand(const String& unit, ExceptionState& es)
diff --git a/Source/core/dom/Range.h b/Source/core/dom/Range.h
index 736b7a8..8850144 100644
--- a/Source/core/dom/Range.h
+++ b/Source/core/dom/Range.h
@@ -132,10 +132,10 @@
void nodeChildrenWillBeRemoved(ContainerNode*);
void nodeWillBeRemoved(Node*);
- void textInserted(Node*, unsigned offset, unsigned length);
- void textRemoved(Node*, unsigned offset, unsigned length);
- void textNodesMerged(NodeWithIndex& oldNode, unsigned offset);
- void textNodeSplit(Text* oldNode);
+ void didInsertText(Node*, unsigned offset, unsigned length);
+ void didRemoveText(Node*, unsigned offset, unsigned length);
+ void didMergeTextNodes(NodeWithIndex& oldNode, unsigned offset);
+ void didSplitTextNode(Text* oldNode);
// Expand range to a unit (word or sentence or block or document) boundary.
// Please refer to https://bugs.webkit.org/show_bug.cgi?id=27632 comment #5
diff --git a/Source/core/dom/ShadowTreeStyleSheetCollection.cpp b/Source/core/dom/ShadowTreeStyleSheetCollection.cpp
index a0d7c84..a952d05 100644
--- a/Source/core/dom/ShadowTreeStyleSheetCollection.cpp
+++ b/Source/core/dom/ShadowTreeStyleSheetCollection.cpp
@@ -32,7 +32,7 @@
#include "core/css/resolver/StyleResolver.h"
#include "core/dom/Document.h"
#include "core/dom/Element.h"
-#include "core/dom/StyleSheetCollections.h"
+#include "core/dom/StyleEngine.h"
#include "core/dom/shadow/ShadowRoot.h"
#include "core/html/HTMLStyleElement.h"
#include "core/page/Settings.h"
@@ -46,7 +46,7 @@
{
}
-void ShadowTreeStyleSheetCollection::collectStyleSheets(StyleSheetCollections* collections, Vector<RefPtr<StyleSheet> >& styleSheets, Vector<RefPtr<CSSStyleSheet> >& activeSheets)
+void ShadowTreeStyleSheetCollection::collectStyleSheets(StyleEngine* collections, Vector<RefPtr<StyleSheet> >& styleSheets, Vector<RefPtr<CSSStyleSheet> >& activeSheets)
{
if (document()->settings() && !document()->settings()->authorAndUserStylesEnabled())
return;
@@ -94,7 +94,7 @@
}
}
-bool ShadowTreeStyleSheetCollection::updateActiveStyleSheets(StyleSheetCollections* collections, StyleResolverUpdateMode updateMode)
+bool ShadowTreeStyleSheetCollection::updateActiveStyleSheets(StyleEngine* collections, StyleResolverUpdateMode updateMode)
{
Vector<RefPtr<StyleSheet> > styleSheets;
Vector<RefPtr<CSSStyleSheet> > activeCSSStyleSheets;
diff --git a/Source/core/dom/ShadowTreeStyleSheetCollection.h b/Source/core/dom/ShadowTreeStyleSheetCollection.h
index a849d68..253ad63 100644
--- a/Source/core/dom/ShadowTreeStyleSheetCollection.h
+++ b/Source/core/dom/ShadowTreeStyleSheetCollection.h
@@ -36,17 +36,17 @@
class ShadowRoot;
class StyleSheet;
class StyleSheetCollection;
-class StyleSheetCollections;
+class StyleEngine;
class ShadowTreeStyleSheetCollection FINAL : public StyleSheetCollection {
WTF_MAKE_NONCOPYABLE(ShadowTreeStyleSheetCollection); WTF_MAKE_FAST_ALLOCATED;
public:
explicit ShadowTreeStyleSheetCollection(ShadowRoot&);
- bool updateActiveStyleSheets(StyleSheetCollections*, StyleResolverUpdateMode);
+ bool updateActiveStyleSheets(StyleEngine*, StyleResolverUpdateMode);
private:
- void collectStyleSheets(StyleSheetCollections*, Vector<RefPtr<StyleSheet> >& styleSheets, Vector<RefPtr<CSSStyleSheet> >& activeSheets);
+ void collectStyleSheets(StyleEngine*, Vector<RefPtr<StyleSheet> >& styleSheets, Vector<RefPtr<CSSStyleSheet> >& activeSheets);
};
}
diff --git a/Source/core/dom/StyleElement.cpp b/Source/core/dom/StyleElement.cpp
index 8f8a151..cd1d2f4 100644
--- a/Source/core/dom/StyleElement.cpp
+++ b/Source/core/dom/StyleElement.cpp
@@ -27,7 +27,7 @@
#include "core/dom/Document.h"
#include "core/dom/Element.h"
#include "core/dom/ScriptableDocumentParser.h"
-#include "core/dom/StyleSheetCollections.h"
+#include "core/dom/StyleEngine.h"
#include "core/html/HTMLStyleElement.h"
#include "core/page/ContentSecurityPolicy.h"
#include "wtf/text/StringBuilder.h"
@@ -58,7 +58,7 @@
void StyleElement::processStyleSheet(Document& document, Element* element)
{
ASSERT(element);
- document.styleSheetCollections()->addStyleSheetCandidateNode(element, m_createdByParser);
+ document.styleEngine()->addStyleSheetCandidateNode(element, m_createdByParser);
if (m_createdByParser)
return;
@@ -68,7 +68,7 @@
void StyleElement::removedFromDocument(Document& document, Element* element, ContainerNode* scopingNode)
{
ASSERT(element);
- document.styleSheetCollections()->removeStyleSheetCandidateNode(element, scopingNode);
+ document.styleEngine()->removeStyleSheetCandidateNode(element, scopingNode);
RefPtr<StyleSheet> removedSheet = m_sheet;
@@ -86,7 +86,7 @@
m_sheet->clearOwnerNode();
if (element->inDocument())
- document.styleSheetCollections()->removeStyleSheetCandidateNode(element, isHTMLStyleElement(element) ? toHTMLStyleElement(element)->scopingNode() : 0);
+ document.styleEngine()->removeStyleSheetCandidateNode(element, isHTMLStyleElement(element) ? toHTMLStyleElement(element)->scopingNode() : 0);
}
void StyleElement::childrenChanged(Element* element)
@@ -125,7 +125,7 @@
Document& document = e->document();
if (m_sheet) {
if (m_sheet->isLoading())
- document.styleSheetCollections()->removePendingSheet(e);
+ document.styleEngine()->removePendingSheet(e);
clearSheet();
}
@@ -137,7 +137,7 @@
MediaQueryEvaluator screenEval("screen", true);
MediaQueryEvaluator printEval("print", true);
if (screenEval.eval(mediaQueries.get()) || printEval.eval(mediaQueries.get())) {
- document.styleSheetCollections()->addPendingSheet();
+ document.styleEngine()->addPendingSheet();
m_loading = true;
TextPosition startPosition = m_startPosition == TextPosition::belowRangePosition() ? TextPosition::minimumPosition() : m_startPosition;
@@ -166,13 +166,13 @@
if (isLoading())
return false;
- document.styleSheetCollections()->removePendingSheet(m_sheet->ownerNode());
+ document.styleEngine()->removePendingSheet(m_sheet->ownerNode());
return true;
}
void StyleElement::startLoadingDynamicSheet(Document& document)
{
- document.styleSheetCollections()->addPendingSheet();
+ document.styleEngine()->addPendingSheet();
}
}
diff --git a/Source/core/dom/StyleSheetCollections.cpp b/Source/core/dom/StyleEngine.cpp
similarity index 86%
rename from Source/core/dom/StyleSheetCollections.cpp
rename to Source/core/dom/StyleEngine.cpp
index 665c240..94a218b 100644
--- a/Source/core/dom/StyleSheetCollections.cpp
+++ b/Source/core/dom/StyleEngine.cpp
@@ -26,7 +26,7 @@
*/
#include "config.h"
-#include "core/dom/StyleSheetCollections.h"
+#include "core/dom/StyleEngine.h"
#include "HTMLNames.h"
#include "SVGNames.h"
@@ -52,7 +52,7 @@
using namespace HTMLNames;
-StyleSheetCollections::StyleSheetCollections(Document& document)
+StyleEngine::StyleEngine(Document& document)
: m_document(document)
, m_pendingStylesheets(0)
, m_injectedStyleSheetCacheValid(false)
@@ -67,7 +67,7 @@
{
}
-StyleSheetCollections::~StyleSheetCollections()
+StyleEngine::~StyleEngine()
{
if (m_pageUserSheet)
m_pageUserSheet->clearOwnerNode();
@@ -81,7 +81,7 @@
m_authorStyleSheets[i]->clearOwnerNode();
}
-void StyleSheetCollections::insertTreeScopeInDocumentOrder(TreeScopeSet& treeScopes, TreeScope* treeScope)
+void StyleEngine::insertTreeScopeInDocumentOrder(TreeScopeSet& treeScopes, TreeScope* treeScope)
{
if (treeScopes.isEmpty()) {
treeScopes.add(treeScope);
@@ -108,7 +108,7 @@
treeScopes.insertBefore(followingTreeScope, treeScope);
}
-StyleSheetCollection* StyleSheetCollections::ensureStyleSheetCollectionFor(TreeScope& treeScope)
+StyleSheetCollection* StyleEngine::ensureStyleSheetCollectionFor(TreeScope& treeScope)
{
if (&treeScope == &m_document)
return &m_documentStyleSheetCollection;
@@ -119,7 +119,7 @@
return result.iterator->value.get();
}
-StyleSheetCollection* StyleSheetCollections::styleSheetCollectionFor(TreeScope& treeScope)
+StyleSheetCollection* StyleEngine::styleSheetCollectionFor(TreeScope& treeScope)
{
if (&treeScope == &m_document)
return &m_documentStyleSheetCollection;
@@ -130,17 +130,17 @@
return it->value.get();
}
-const Vector<RefPtr<StyleSheet> >& StyleSheetCollections::styleSheetsForStyleSheetList()
+const Vector<RefPtr<StyleSheet> >& StyleEngine::styleSheetsForStyleSheetList()
{
return m_documentStyleSheetCollection.styleSheetsForStyleSheetList();
}
-const Vector<RefPtr<CSSStyleSheet> >& StyleSheetCollections::activeAuthorStyleSheets() const
+const Vector<RefPtr<CSSStyleSheet> >& StyleEngine::activeAuthorStyleSheets() const
{
return m_documentStyleSheetCollection.activeAuthorStyleSheets();
}
-void StyleSheetCollections::getActiveAuthorStyleSheets(Vector<const Vector<RefPtr<CSSStyleSheet> >*>& activeAuthorStyleSheets) const
+void StyleEngine::getActiveAuthorStyleSheets(Vector<const Vector<RefPtr<CSSStyleSheet> >*>& activeAuthorStyleSheets) const
{
activeAuthorStyleSheets.append(&m_documentStyleSheetCollection.activeAuthorStyleSheets());
@@ -153,20 +153,20 @@
}
}
-void StyleSheetCollections::combineCSSFeatureFlags(const RuleFeatureSet& features)
+void StyleEngine::combineCSSFeatureFlags(const RuleFeatureSet& features)
{
// Delay resetting the flags until after next style recalc since unapplying the style may not work without these set (this is true at least with before/after).
m_usesSiblingRules = m_usesSiblingRules || features.usesSiblingRules();
m_usesFirstLineRules = m_usesFirstLineRules || features.usesFirstLineRules();
}
-void StyleSheetCollections::resetCSSFeatureFlags(const RuleFeatureSet& features)
+void StyleEngine::resetCSSFeatureFlags(const RuleFeatureSet& features)
{
m_usesSiblingRules = features.usesSiblingRules();
m_usesFirstLineRules = features.usesFirstLineRules();
}
-CSSStyleSheet* StyleSheetCollections::pageUserSheet()
+CSSStyleSheet* StyleEngine::pageUserSheet()
{
if (m_pageUserSheet)
return m_pageUserSheet.get();
@@ -186,7 +186,7 @@
return m_pageUserSheet.get();
}
-void StyleSheetCollections::clearPageUserSheet()
+void StyleEngine::clearPageUserSheet()
{
if (m_pageUserSheet) {
RefPtr<StyleSheet> removedSheet = m_pageUserSheet;
@@ -195,7 +195,7 @@
}
}
-void StyleSheetCollections::updatePageUserSheet()
+void StyleEngine::updatePageUserSheet()
{
clearPageUserSheet();
// FIXME: Why is this immediately and not defer?
@@ -203,19 +203,19 @@
m_document.addedStyleSheet(addedSheet, RecalcStyleImmediately);
}
-const Vector<RefPtr<CSSStyleSheet> >& StyleSheetCollections::injectedUserStyleSheets() const
+const Vector<RefPtr<CSSStyleSheet> >& StyleEngine::injectedUserStyleSheets() const
{
updateInjectedStyleSheetCache();
return m_injectedUserStyleSheets;
}
-const Vector<RefPtr<CSSStyleSheet> >& StyleSheetCollections::injectedAuthorStyleSheets() const
+const Vector<RefPtr<CSSStyleSheet> >& StyleEngine::injectedAuthorStyleSheets() const
{
updateInjectedStyleSheetCache();
return m_injectedAuthorStyleSheets;
}
-void StyleSheetCollections::updateInjectedStyleSheetCache() const
+void StyleEngine::updateInjectedStyleSheetCache() const
{
if (m_injectedStyleSheetCacheValid)
return;
@@ -246,7 +246,7 @@
}
}
-void StyleSheetCollections::invalidateInjectedStyleSheetCache()
+void StyleEngine::invalidateInjectedStyleSheetCache()
{
m_injectedStyleSheetCacheValid = false;
m_needsDocumentStyleSheetsUpdate = true;
@@ -255,7 +255,7 @@
m_document.styleResolverChanged(RecalcStyleDeferred);
}
-void StyleSheetCollections::addAuthorSheet(PassRefPtr<StyleSheetContents> authorSheet)
+void StyleEngine::addAuthorSheet(PassRefPtr<StyleSheetContents> authorSheet)
{
ASSERT(!authorSheet->isUserStyleSheet());
m_authorStyleSheets.append(CSSStyleSheet::create(authorSheet, &m_document));
@@ -263,7 +263,7 @@
m_needsDocumentStyleSheetsUpdate = true;
}
-void StyleSheetCollections::addUserSheet(PassRefPtr<StyleSheetContents> userSheet)
+void StyleEngine::addUserSheet(PassRefPtr<StyleSheetContents> userSheet)
{
ASSERT(userSheet->isUserStyleSheet());
m_userStyleSheets.append(CSSStyleSheet::create(userSheet, &m_document));
@@ -272,7 +272,7 @@
}
// This method is called whenever a top-level stylesheet has finished loading.
-void StyleSheetCollections::removePendingSheet(Node* styleSheetCandidateNode, RemovePendingSheetNotificationType notification)
+void StyleEngine::removePendingSheet(Node* styleSheetCandidateNode, RemovePendingSheetNotificationType notification)
{
// Make sure we knew this sheet was pending, and that our count isn't out of sync.
ASSERT(m_pendingStylesheets > 0);
@@ -298,7 +298,7 @@
m_document.didRemoveAllPendingStylesheet();
}
-void StyleSheetCollections::addStyleSheetCandidateNode(Node* node, bool createdByParser)
+void StyleEngine::addStyleSheetCandidateNode(Node* node, bool createdByParser)
{
if (!node->inDocument())
return;
@@ -319,7 +319,7 @@
m_dirtyTreeScopes.add(&treeScope);
}
-void StyleSheetCollections::removeStyleSheetCandidateNode(Node* node, ContainerNode* scopingNode)
+void StyleEngine::removeStyleSheetCandidateNode(Node* node, ContainerNode* scopingNode)
{
TreeScope& treeScope = scopingNode ? scopingNode->treeScope() : m_document;
ASSERT(isHTMLStyleElement(node) || &treeScope == &m_document);
@@ -336,7 +336,7 @@
m_activeTreeScopes.remove(&treeScope);
}
-void StyleSheetCollections::modifiedStyleSheetCandidateNode(Node* node)
+void StyleEngine::modifiedStyleSheetCandidateNode(Node* node)
{
if (!node->inDocument())
return;
@@ -350,12 +350,12 @@
m_dirtyTreeScopes.add(&treeScope);
}
-bool StyleSheetCollections::shouldUpdateShadowTreeStyleSheetCollection(StyleResolverUpdateMode updateMode)
+bool StyleEngine::shouldUpdateShadowTreeStyleSheetCollection(StyleResolverUpdateMode updateMode)
{
return !m_dirtyTreeScopes.isEmpty() || updateMode == FullStyleUpdate;
}
-bool StyleSheetCollections::updateActiveStyleSheets(StyleResolverUpdateMode updateMode)
+bool StyleEngine::updateActiveStyleSheets(StyleResolverUpdateMode updateMode)
{
if (m_document.inStyleRecalc()) {
// SVG <use> element may manage to invalidate style selector in the middle of a style recalc.
@@ -408,7 +408,7 @@
return requiresFullStyleRecalc;
}
-void StyleSheetCollections::activeStyleSheetsUpdatedForInspector()
+void StyleEngine::activeStyleSheetsUpdatedForInspector()
{
if (m_activeTreeScopes.isEmpty()) {
InspectorInstrumentation::activeStyleSheetsUpdated(&m_document, m_documentStyleSheetCollection.styleSheetsForStyleSheetList());
@@ -431,12 +431,12 @@
InspectorInstrumentation::activeStyleSheetsUpdated(&m_document, activeStyleSheets);
}
-void StyleSheetCollections::didRemoveShadowRoot(ShadowRoot* shadowRoot)
+void StyleEngine::didRemoveShadowRoot(ShadowRoot* shadowRoot)
{
m_styleSheetCollectionMap.remove(shadowRoot);
}
-void StyleSheetCollections::appendActiveAuthorStyleSheets(StyleResolver* styleResolver)
+void StyleEngine::appendActiveAuthorStyleSheets(StyleResolver* styleResolver)
{
ASSERT(styleResolver);
diff --git a/Source/core/dom/StyleSheetCollections.h b/Source/core/dom/StyleEngine.h
similarity index 95%
rename from Source/core/dom/StyleSheetCollections.h
rename to Source/core/dom/StyleEngine.h
index 978d1b0..98d2bae 100644
--- a/Source/core/dom/StyleSheetCollections.h
+++ b/Source/core/dom/StyleEngine.h
@@ -25,8 +25,8 @@
*
*/
-#ifndef StyleSheetCollections_h
-#define StyleSheetCollections_h
+#ifndef StyleEngine_h
+#define StyleEngine_h
#include "core/dom/Document.h"
#include "core/dom/DocumentOrderedList.h"
@@ -48,12 +48,12 @@
class StyleSheetContents;
class StyleSheetList;
-class StyleSheetCollections {
+class StyleEngine {
WTF_MAKE_FAST_ALLOCATED;
public:
- static PassOwnPtr<StyleSheetCollections> create(Document& document) { return adoptPtr(new StyleSheetCollections(document)); }
+ static PassOwnPtr<StyleEngine> create(Document& document) { return adoptPtr(new StyleEngine(document)); }
- ~StyleSheetCollections();
+ ~StyleEngine();
const Vector<RefPtr<StyleSheet> >& styleSheetsForStyleSheetList();
const Vector<RefPtr<CSSStyleSheet> >& activeAuthorStyleSheets() const;
@@ -112,7 +112,7 @@
void getActiveAuthorStyleSheets(Vector<const Vector<RefPtr<CSSStyleSheet> >*>& activeAuthorStyleSheets) const;
private:
- StyleSheetCollections(Document&);
+ StyleEngine(Document&);
StyleSheetCollection* ensureStyleSheetCollectionFor(TreeScope&);
StyleSheetCollection* styleSheetCollectionFor(TreeScope&);
diff --git a/Source/core/dom/StyleSheetCollection.cpp b/Source/core/dom/StyleSheetCollection.cpp
index 1edd2b8..6f807b9 100644
--- a/Source/core/dom/StyleSheetCollection.cpp
+++ b/Source/core/dom/StyleSheetCollection.cpp
@@ -33,7 +33,7 @@
#include "core/css/resolver/StyleResolver.h"
#include "core/dom/Document.h"
#include "core/dom/Element.h"
-#include "core/dom/StyleSheetCollections.h"
+#include "core/dom/StyleEngine.h"
#include "core/html/HTMLStyleElement.h"
#include "core/page/Settings.h"
diff --git a/Source/core/dom/StyleSheetCollection.h b/Source/core/dom/StyleSheetCollection.h
index 0a89677..6519617 100644
--- a/Source/core/dom/StyleSheetCollection.h
+++ b/Source/core/dom/StyleSheetCollection.h
@@ -43,7 +43,7 @@
class ContainerNode;
class CSSStyleSheet;
-class StyleSheetCollections;
+class StyleEngine;
class Node;
class StyleSheet;
class StyleSheetContents;
diff --git a/Source/core/dom/Text.cpp b/Source/core/dom/Text.cpp
index 90446f1..744c15d 100644
--- a/Source/core/dom/Text.cpp
+++ b/Source/core/dom/Text.cpp
@@ -77,7 +77,7 @@
toRenderText(renderer())->setTextWithOffset(dataImpl(), 0, oldStr.length());
if (parentNode())
- document().textNodeSplit(this);
+ document().didSplitTextNode(this);
return newText.release();
}
diff --git a/Source/core/dom/TouchController.cpp b/Source/core/dom/TouchController.cpp
new file mode 100644
index 0000000..ce730d2
--- /dev/null
+++ b/Source/core/dom/TouchController.cpp
@@ -0,0 +1,162 @@
+/*
+ * Copyright (C) 2013 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``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 "core/dom/TouchController.h"
+
+#include "core/dom/Document.h"
+#include "core/dom/EventNames.h"
+#include "core/dom/TouchEvent.h"
+#include "core/page/Chrome.h"
+#include "core/page/ChromeClient.h"
+#include "core/page/Frame.h"
+#include "core/page/Page.h"
+#include "core/page/scrolling/ScrollingCoordinator.h"
+
+namespace WebCore {
+
+TouchController::TouchController(Document* document)
+ : DOMWindowLifecycleObserver(document->domWindow())
+ , DocumentLifecycleObserver(document)
+{
+}
+
+TouchController::~TouchController()
+{
+}
+
+const char* TouchController::supplementName()
+{
+ return "TouchController";
+}
+
+TouchController* TouchController::from(Document* document)
+{
+ TouchController* controller = static_cast<TouchController*>(Supplement<ScriptExecutionContext>::from(document, supplementName()));
+ if (!controller) {
+ controller = new TouchController(document);
+ Supplement<ScriptExecutionContext>::provideTo(document, supplementName(), adoptPtr(controller));
+ }
+ return controller;
+}
+
+void TouchController::didAddTouchEventHandler(Document* document, Node* handler)
+{
+ if (!m_touchEventTargets)
+ m_touchEventTargets = adoptPtr(new TouchEventTargetSet);
+ m_touchEventTargets->add(handler);
+ if (Document* parent = document->parentDocument()) {
+ TouchController::from(parent)->didAddTouchEventHandler(parent, document);
+ return;
+ }
+ if (Page* page = document->page()) {
+ if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordinator())
+ scrollingCoordinator->touchEventTargetRectsDidChange(document);
+ if (m_touchEventTargets->size() == 1)
+ page->chrome().client().needTouchEvents(true);
+ }
+}
+
+void TouchController::didRemoveTouchEventHandler(Document* document, Node* handler)
+{
+ if (!m_touchEventTargets)
+ return;
+ ASSERT(m_touchEventTargets->contains(handler));
+ m_touchEventTargets->remove(handler);
+ if (Document* parent = document->parentDocument()) {
+ TouchController::from(parent)->didRemoveTouchEventHandler(parent, document);
+ return;
+ }
+
+ Page* page = document->page();
+ if (!page)
+ return;
+ if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordinator())
+ scrollingCoordinator->touchEventTargetRectsDidChange(document);
+ if (m_touchEventTargets->size())
+ return;
+ for (const Frame* frame = page->mainFrame(); frame; frame = frame->tree()->traverseNext()) {
+ if (frame->document() && TouchController::from(frame->document())->hasTouchEventHandlers())
+ return;
+ }
+ page->chrome().client().needTouchEvents(false);
+}
+
+void TouchController::didRemoveEventTargetNode(Document* document, Node* handler)
+{
+ if (m_touchEventTargets && !m_touchEventTargets->isEmpty()) {
+ if (handler == document)
+ m_touchEventTargets->clear();
+ else
+ m_touchEventTargets->removeAll(handler);
+ Document* parent = document->parentDocument();
+ if (m_touchEventTargets->isEmpty() && parent)
+ TouchController::from(parent)->didRemoveEventTargetNode(parent, document);
+ }
+}
+
+void TouchController::didAddEventListener(DOMWindow* window, const AtomicString& eventType)
+{
+ if (eventNames().isTouchEventType(eventType)) {
+ Document* document = window->document();
+ didAddTouchEventHandler(document, document);
+ }
+}
+
+void TouchController::didRemoveEventListener(DOMWindow* window, const AtomicString& eventType)
+{
+ if (eventNames().isTouchEventType(eventType)) {
+ Document* document = window->document();
+ didRemoveTouchEventHandler(document, document);
+ }
+}
+
+void TouchController::didRemoveAllEventListeners(DOMWindow* window)
+{
+ if (Document* document = window->document())
+ didRemoveEventTargetNode(document, document);
+}
+
+void TouchController::documentWasDetached()
+{
+ Document* document = static_cast<Document*>(scriptExecutionContext());
+ Document* parentDocument = document->parentDocument();
+
+ if (parentDocument) {
+ TouchController* parentController = TouchController::from(parentDocument);
+ if (parentController->hasTouchEventHandlers())
+ parentController->didRemoveEventTargetNode(parentDocument, document);
+ }
+}
+
+void TouchController::documentBeingDestroyed()
+{
+ Document* document = static_cast<Document*>(scriptExecutionContext());
+
+ if (Document* ownerDocument = document->ownerDocument())
+ TouchController::from(ownerDocument)->didRemoveEventTargetNode(ownerDocument, document);
+}
+
+} // namespace WebCore
diff --git a/Source/core/dom/TouchController.h b/Source/core/dom/TouchController.h
new file mode 100644
index 0000000..24d1ae1
--- /dev/null
+++ b/Source/core/dom/TouchController.h
@@ -0,0 +1,76 @@
+/*
+* Copyright (C) 2013 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.
+*
+* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``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 TouchController_h
+#define TouchController_h
+
+#include "core/dom/DocumentLifecycleObserver.h"
+#include "core/dom/Event.h"
+#include "core/dom/Node.h"
+#include "core/page/DOMWindowLifecycleObserver.h"
+#include "core/platform/Supplementable.h"
+#include "wtf/HashSet.h"
+
+namespace WebCore {
+
+typedef HashCountedSet<Node*> TouchEventTargetSet;
+
+class Document;
+class DOMWindow;
+
+class TouchController : public Supplement<ScriptExecutionContext>, public DOMWindowLifecycleObserver, public DocumentLifecycleObserver {
+
+public:
+ virtual ~TouchController();
+
+ static const char* supplementName();
+ static TouchController* from(Document*);
+
+ bool hasTouchEventHandlers() const { return m_touchEventTargets ? m_touchEventTargets->size() : false; }
+
+ void didAddTouchEventHandler(Document*, Node*);
+ void didRemoveTouchEventHandler(Document*, Node*);
+ void didRemoveEventTargetNode(Document*, Node*);
+
+ const TouchEventTargetSet* touchEventTargets() const { return m_touchEventTargets.get(); }
+
+ // Inherited from DOMWindowLifecycleObserver
+ virtual void didAddEventListener(DOMWindow*, const AtomicString&) OVERRIDE;
+ virtual void didRemoveEventListener(DOMWindow*, const AtomicString&) OVERRIDE;
+ virtual void didRemoveAllEventListeners(DOMWindow*) OVERRIDE;
+
+ // Inherited from DocumentLifecycleObserver
+ virtual void documentWasDetached() OVERRIDE;
+ virtual void documentBeingDestroyed() OVERRIDE;
+
+private:
+ explicit TouchController(Document*);
+
+ OwnPtr<TouchEventTargetSet> m_touchEventTargets;
+};
+
+} // namespace WebCore
+
+#endif // TouchController_h
diff --git a/Source/core/dom/TouchList.h b/Source/core/dom/TouchList.h
index 74a712c..6d5f2bf 100644
--- a/Source/core/dom/TouchList.h
+++ b/Source/core/dom/TouchList.h
@@ -40,6 +40,11 @@
return adoptRef(new TouchList);
}
+ static PassRefPtr<TouchList> create(Vector<RefPtr<Touch> >& touches)
+ {
+ return adoptRef(new TouchList(touches));
+ }
+
unsigned length() const { return m_values.size(); }
Touch* item(unsigned);
@@ -53,6 +58,12 @@
ScriptWrappable::init(this);
}
+ TouchList(Vector<RefPtr<Touch> >& touches)
+ {
+ m_values.swap(touches);
+ ScriptWrappable::init(this);
+ }
+
Vector<RefPtr<Touch> > m_values;
};
diff --git a/Source/core/dom/UserGestureIndicator.cpp b/Source/core/dom/UserGestureIndicator.cpp
index 68e3feb..b52b871 100644
--- a/Source/core/dom/UserGestureIndicator.cpp
+++ b/Source/core/dom/UserGestureIndicator.cpp
@@ -135,17 +135,17 @@
{
if (token) {
static_cast<GestureToken*>(token.get())->resetTimestamp();
- if (static_cast<GestureToken*>(token.get())->hasGestures()) {
- if (!s_topmostIndicator) {
- s_topmostIndicator = this;
- m_token = token;
- } else {
- m_token = s_topmostIndicator->currentToken();
+ if (!s_topmostIndicator) {
+ s_topmostIndicator = this;
+ m_token = token;
+ } else {
+ m_token = s_topmostIndicator->currentToken();
+ if (static_cast<GestureToken*>(token.get())->hasGestures()) {
static_cast<GestureToken*>(m_token.get())->addGesture();
static_cast<GestureToken*>(token.get())->consumeGesture();
}
- s_state = DefinitelyProcessingUserGesture;
}
+ s_state = DefinitelyProcessingUserGesture;
}
ASSERT(isDefinite(s_state));
diff --git a/Source/core/dom/shadow/ContentDistribution.h b/Source/core/dom/shadow/ContentDistribution.h
index 2fd8fc1..65a221d 100644
--- a/Source/core/dom/shadow/ContentDistribution.h
+++ b/Source/core/dom/shadow/ContentDistribution.h
@@ -40,6 +40,8 @@
class ContentDistribution {
public:
+ ContentDistribution() { m_nodes.reserveInitialCapacity(32); }
+
PassRefPtr<Node> first() const { return m_nodes.first(); }
PassRefPtr<Node> last() const { return m_nodes.last(); }
PassRefPtr<Node> at(size_t index) const { return m_nodes.at(index); }
@@ -49,6 +51,7 @@
void append(PassRefPtr<Node>);
void clear() { m_nodes.clear(); m_indices.clear(); }
+ void shrinkToFit() { m_nodes.shrinkToFit(); }
bool contains(const Node* node) const { return m_indices.contains(node); }
size_t find(const Node*) const;
diff --git a/Source/core/dom/shadow/ElementShadow.cpp b/Source/core/dom/shadow/ElementShadow.cpp
index 455ad32..bebad50 100644
--- a/Source/core/dom/shadow/ElementShadow.cpp
+++ b/Source/core/dom/shadow/ElementShadow.cpp
@@ -194,15 +194,16 @@
void ElementShadow::distribute()
{
Vector<Node*> pool;
+ pool.reserveInitialCapacity(32);
for (Node* node = host()->firstChild(); node; node = node->nextSibling())
populate(node, pool);
host()->setNeedsStyleRecalc();
- Vector<bool> distributed(pool.size());
- distributed.fill(false);
+ Vector<bool> distributed;
+ distributed.fill(false, pool.size());
- Vector<HTMLShadowElement*, 8> activeShadowInsertionPoints;
+ Vector<HTMLShadowElement*, 32> activeShadowInsertionPoints;
for (ShadowRoot* root = youngestShadowRoot(); root; root = root->olderShadowRoot()) {
HTMLShadowElement* firstActiveShadowInsertionPoint = 0;
@@ -282,8 +283,9 @@
InsertionPoint* innerInsertionPoint = toInsertionPoint(node);
if (innerInsertionPoint->hasDistribution()) {
for (size_t i = 0; i < innerInsertionPoint->size(); ++i) {
- distribution.append(innerInsertionPoint->at(i));
- m_nodeToInsertionPoint.add(innerInsertionPoint->at(i), insertionPoint);
+ Node* nodeToAdd = innerInsertionPoint->at(i);
+ distribution.append(nodeToAdd);
+ m_nodeToInsertionPoint.add(nodeToAdd, insertionPoint);
}
} else {
for (Node* child = innerInsertionPoint->firstChild(); child; child = child->nextSibling()) {
diff --git a/Source/core/dom/shadow/InsertionPoint.cpp b/Source/core/dom/shadow/InsertionPoint.cpp
index 4c2b26d..7d05daa 100644
--- a/Source/core/dom/shadow/InsertionPoint.cpp
+++ b/Source/core/dom/shadow/InsertionPoint.cpp
@@ -92,6 +92,7 @@
distribution.at(j)->lazyReattachIfAttached();
m_distribution.swap(distribution);
+ m_distribution.shrinkToFit();
}
void InsertionPoint::attach(const AttachContext& context)
@@ -146,8 +147,9 @@
document().updateDistributionForNodeIfNeeded(this);
Vector<RefPtr<Node> > nodes;
+ nodes.reserveInitialCapacity(m_distribution.size());
for (size_t i = 0; i < m_distribution.size(); ++i)
- nodes.append(m_distribution.at(i));
+ nodes.uncheckedAppend(m_distribution.at(i));
return StaticNodeList::adopt(nodes);
}
diff --git a/Source/core/dom/shadow/ShadowRoot.cpp b/Source/core/dom/shadow/ShadowRoot.cpp
index fa21b00..bb0f5a1 100644
--- a/Source/core/dom/shadow/ShadowRoot.cpp
+++ b/Source/core/dom/shadow/ShadowRoot.cpp
@@ -31,7 +31,7 @@
#include "bindings/v8/ExceptionState.h"
#include "core/css/resolver/StyleResolver.h"
#include "core/dom/ElementTraversal.h"
-#include "core/dom/StyleSheetCollections.h"
+#include "core/dom/StyleEngine.h"
#include "core/dom/Text.h"
#include "core/dom/shadow/ElementShadow.h"
#include "core/dom/shadow/InsertionPoint.h"
@@ -80,7 +80,7 @@
ASSERT(!m_prev);
ASSERT(!m_next);
- documentInternal()->styleSheetCollections()->didRemoveShadowRoot(this);
+ documentInternal()->styleEngine()->didRemoveShadowRoot(this);
// We cannot let ContainerNode destructor call willBeDeletedFrom()
// for this ShadowRoot instance because TreeScope destructor