OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2001 Dirk Mueller (mueller@kde.org) | 4 * (C) 2001 Dirk Mueller (mueller@kde.org) |
5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) | 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) |
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r ights reserved. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r ights reserved. |
7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) | 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) |
8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. | 8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. |
9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) | 9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) |
10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. | 10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. |
(...skipping 22 matching lines...) Expand all Loading... | |
33 #include "RuntimeEnabledFeatures.h" | 33 #include "RuntimeEnabledFeatures.h" |
34 #include "SVGElementFactory.h" | 34 #include "SVGElementFactory.h" |
35 #include "SVGNames.h" | 35 #include "SVGNames.h" |
36 #include "XMLNSNames.h" | 36 #include "XMLNSNames.h" |
37 #include "XMLNames.h" | 37 #include "XMLNames.h" |
38 #include "bindings/v8/CustomElementConstructorBuilder.h" | 38 #include "bindings/v8/CustomElementConstructorBuilder.h" |
39 #include "bindings/v8/Dictionary.h" | 39 #include "bindings/v8/Dictionary.h" |
40 #include "bindings/v8/ScriptController.h" | 40 #include "bindings/v8/ScriptController.h" |
41 #include "core/accessibility/AXObjectCache.h" | 41 #include "core/accessibility/AXObjectCache.h" |
42 #include "core/animation/DocumentTimeline.h" | 42 #include "core/animation/DocumentTimeline.h" |
43 #include "core/css/CSSParser.h" | |
43 #include "core/css/CSSStyleDeclaration.h" | 44 #include "core/css/CSSStyleDeclaration.h" |
44 #include "core/css/CSSStyleSheet.h" | 45 #include "core/css/CSSStyleSheet.h" |
45 #include "core/css/FontLoader.h" | 46 #include "core/css/FontLoader.h" |
46 #include "core/css/MediaQueryMatcher.h" | 47 #include "core/css/MediaQueryMatcher.h" |
47 #include "core/css/StylePropertySet.h" | 48 #include "core/css/StylePropertySet.h" |
48 #include "core/css/StyleSheetContents.h" | 49 #include "core/css/StyleSheetContents.h" |
49 #include "core/css/StyleSheetList.h" | 50 #include "core/css/StyleSheetList.h" |
50 #include "core/css/resolver/StyleResolver.h" | 51 #include "core/css/resolver/StyleResolver.h" |
51 #include "core/dom/Attr.h" | 52 #include "core/dom/Attr.h" |
52 #include "core/dom/CDATASection.h" | 53 #include "core/dom/CDATASection.h" |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
115 #include "core/html/PluginDocument.h" | 116 #include "core/html/PluginDocument.h" |
116 #include "core/html/parser/HTMLDocumentParser.h" | 117 #include "core/html/parser/HTMLDocumentParser.h" |
117 #include "core/html/parser/HTMLParserIdioms.h" | 118 #include "core/html/parser/HTMLParserIdioms.h" |
118 #include "core/html/parser/NestingLevelIncrementer.h" | 119 #include "core/html/parser/NestingLevelIncrementer.h" |
119 #include "core/inspector/InspectorCounters.h" | 120 #include "core/inspector/InspectorCounters.h" |
120 #include "core/inspector/InspectorInstrumentation.h" | 121 #include "core/inspector/InspectorInstrumentation.h" |
121 #include "core/inspector/ScriptCallStack.h" | 122 #include "core/inspector/ScriptCallStack.h" |
122 #include "core/loader/CookieJar.h" | 123 #include "core/loader/CookieJar.h" |
123 #include "core/loader/DocumentLoader.h" | 124 #include "core/loader/DocumentLoader.h" |
124 #include "core/loader/FrameLoader.h" | 125 #include "core/loader/FrameLoader.h" |
126 #include "core/loader/FrameLoaderClient.h" | |
125 #include "core/loader/ImageLoader.h" | 127 #include "core/loader/ImageLoader.h" |
126 #include "core/loader/Prerenderer.h" | 128 #include "core/loader/Prerenderer.h" |
127 #include "core/loader/TextResourceDecoder.h" | 129 #include "core/loader/TextResourceDecoder.h" |
128 #include "core/loader/cache/CachedResourceLoader.h" | 130 #include "core/loader/cache/CachedResourceLoader.h" |
129 #include "core/page/Chrome.h" | 131 #include "core/page/Chrome.h" |
130 #include "core/page/ChromeClient.h" | 132 #include "core/page/ChromeClient.h" |
131 #include "core/page/ContentSecurityPolicy.h" | 133 #include "core/page/ContentSecurityPolicy.h" |
132 #include "core/page/DOMSecurityPolicy.h" | 134 #include "core/page/DOMSecurityPolicy.h" |
133 #include "core/page/DOMWindow.h" | 135 #include "core/page/DOMWindow.h" |
134 #include "core/page/EventHandler.h" | 136 #include "core/page/EventHandler.h" |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
437 , m_writingModeSetOnDocumentElement(false) | 439 , m_writingModeSetOnDocumentElement(false) |
438 , m_writeRecursionIsTooDeep(false) | 440 , m_writeRecursionIsTooDeep(false) |
439 , m_writeRecursionDepth(0) | 441 , m_writeRecursionDepth(0) |
440 , m_wheelEventHandlerCount(0) | 442 , m_wheelEventHandlerCount(0) |
441 , m_lastHandledUserGestureTimestamp(0) | 443 , m_lastHandledUserGestureTimestamp(0) |
442 , m_prerenderer(Prerenderer::create(this)) | 444 , m_prerenderer(Prerenderer::create(this)) |
443 , m_textAutosizer(TextAutosizer::create(this)) | 445 , m_textAutosizer(TextAutosizer::create(this)) |
444 , m_pendingTasksTimer(this, &Document::pendingTasksTimerFired) | 446 , m_pendingTasksTimer(this, &Document::pendingTasksTimerFired) |
445 , m_import(0) | 447 , m_import(0) |
446 , m_scheduledTasksAreSuspended(false) | 448 , m_scheduledTasksAreSuspended(false) |
449 , m_callbackSelectorChangeTimer(this, &Document::callbackSelectorChangeTimer Fired) | |
447 , m_sharedObjectPoolClearTimer(this, &Document::sharedObjectPoolClearTimerFi red) | 450 , m_sharedObjectPoolClearTimer(this, &Document::sharedObjectPoolClearTimerFi red) |
448 #ifndef NDEBUG | 451 #ifndef NDEBUG |
449 , m_didDispatchViewportPropertiesChanged(false) | 452 , m_didDispatchViewportPropertiesChanged(false) |
450 #endif | 453 #endif |
451 , m_timeline(DocumentTimeline::create(this)) | 454 , m_timeline(DocumentTimeline::create(this)) |
452 , m_templateDocumentHost(0) | 455 , m_templateDocumentHost(0) |
453 , m_fontloader(0) | 456 , m_fontloader(0) |
454 , m_didAssociateFormControlsTimer(this, &Document::didAssociateFormControlsT imerFired) | 457 , m_didAssociateFormControlsTimer(this, &Document::didAssociateFormControlsT imerFired) |
455 { | 458 { |
456 ScriptWrappable::init(this); | 459 ScriptWrappable::init(this); |
(...skipping 1383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1840 matchAuthorAndUserStyles = docSettings->authorAndUserStylesEnabled(); | 1843 matchAuthorAndUserStyles = docSettings->authorAndUserStylesEnabled(); |
1841 m_styleResolver = adoptPtr(new StyleResolver(this, matchAuthorAndUserStyles) ); | 1844 m_styleResolver = adoptPtr(new StyleResolver(this, matchAuthorAndUserStyles) ); |
1842 m_styleSheetCollection->combineCSSFeatureFlags(); | 1845 m_styleSheetCollection->combineCSSFeatureFlags(); |
1843 } | 1846 } |
1844 | 1847 |
1845 void Document::clearStyleResolver() | 1848 void Document::clearStyleResolver() |
1846 { | 1849 { |
1847 m_styleResolver.clear(); | 1850 m_styleResolver.clear(); |
1848 } | 1851 } |
1849 | 1852 |
1853 #if ENABLE(CSS_CALLBACKS) | |
1854 void Document::callbackSelectorChangeTimerFired(Timer<Document>*) | |
1855 { | |
1856 if (m_addedSelectors.isEmpty() && m_removedSelectors.isEmpty()) | |
1857 return; | |
1858 if (frame()) { | |
1859 Vector<String> addedSelectors, removedSelectors; | |
1860 copyToVector(m_addedSelectors, addedSelectors); | |
1861 copyToVector(m_removedSelectors, removedSelectors); | |
1862 frame()->loader()->client()->selectorMatchChanged(addedSelectors, remove dSelectors); | |
1863 } | |
1864 m_addedSelectors.clear(); | |
1865 m_removedSelectors.clear(); | |
1866 } | |
1867 | |
1868 void Document::addSelectorMatch(const String& selector, StyleRareNonInheritedDat a* data) | |
1869 { | |
1870 // Set m_document here to avoid exposing the weakFactory outside of Document . | |
1871 data->m_document = m_weakFactory.createWeakPtr(); | |
1872 | |
1873 HashMap<String, int>::iterator count = m_matchingCallbackSelectors.find(sele ctor); | |
1874 if (count != m_matchingCallbackSelectors.end()) { | |
1875 ++count->value; | |
1876 return; | |
1877 } | |
1878 if (!m_callbackSelectorChangeTimer.isActive()) | |
1879 m_callbackSelectorChangeTimer.startOneShot(0); | |
1880 | |
1881 m_matchingCallbackSelectors.set(selector, 1); | |
1882 if (m_removedSelectors.contains(selector)) | |
1883 m_removedSelectors.remove(selector); | |
1884 else | |
1885 m_addedSelectors.add(selector); | |
1886 } | |
1887 | |
1888 void Document::removeSelectorMatch(const String& selector) | |
1889 { | |
1890 HashMap<String, int>::iterator count = m_matchingCallbackSelectors.find(sele ctor); | |
1891 if (count == m_matchingCallbackSelectors.end()) | |
1892 return; | |
1893 --count->value; | |
1894 if (!count->value) { | |
1895 if (!m_callbackSelectorChangeTimer.isActive()) | |
1896 m_callbackSelectorChangeTimer.startOneShot(0); | |
1897 | |
1898 m_matchingCallbackSelectors.remove(count); | |
1899 if (m_addedSelectors.contains(selector)) | |
1900 m_addedSelectors.remove(selector); | |
1901 else | |
1902 m_removedSelectors.add(selector); | |
1903 } | |
1904 } | |
1905 #endif // ENABLE(CSS_CALLBACKS) | |
abarth-chromium
2013/07/12 23:44:11
This code should move into a supplement too. It's
Jeffrey Yasskin
2013/07/16 00:38:51
Done.
| |
1906 | |
1850 void Document::attach(const AttachContext& context) | 1907 void Document::attach(const AttachContext& context) |
1851 { | 1908 { |
1852 ASSERT(!attached()); | 1909 ASSERT(!attached()); |
1853 ASSERT(!m_axObjectCache || this != topDocument()); | 1910 ASSERT(!m_axObjectCache || this != topDocument()); |
1854 | 1911 |
1855 if (!m_renderArena) | 1912 if (!m_renderArena) |
1856 m_renderArena = RenderArena::create(); | 1913 m_renderArena = RenderArena::create(); |
1857 | 1914 |
1858 // Create the rendering tree | 1915 // Create the rendering tree |
1859 setRenderer(new (m_renderArena.get()) RenderView(this)); | 1916 setRenderer(new (m_renderArena.get()) RenderView(this)); |
(...skipping 1158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3018 // Seamless child frames are expected to notify their seamless children recu rsively, so we only do direct children. | 3075 // Seamless child frames are expected to notify their seamless children recu rsively, so we only do direct children. |
3019 for (Frame* child = frame()->tree()->firstChild(); child; child = child->tre e()->nextSibling()) { | 3076 for (Frame* child = frame()->tree()->firstChild(); child; child = child->tre e()->nextSibling()) { |
3020 Document* childDocument = child->document(); | 3077 Document* childDocument = child->document(); |
3021 if (childDocument->shouldDisplaySeamlesslyWithParent()) { | 3078 if (childDocument->shouldDisplaySeamlesslyWithParent()) { |
3022 ASSERT(childDocument->seamlessParentIFrame()->document() == this); | 3079 ASSERT(childDocument->seamlessParentIFrame()->document() == this); |
3023 childDocument->seamlessParentUpdatedStylesheets(); | 3080 childDocument->seamlessParentUpdatedStylesheets(); |
3024 } | 3081 } |
3025 } | 3082 } |
3026 } | 3083 } |
3027 | 3084 |
3085 void Document::watchCssSelectors(const Vector<String>& selectors) | |
3086 { | |
3087 m_watchedCallbackSelectors.clear(); | |
3088 CSSParserContext context(UASheetMode); | |
3089 CSSParser parser(context); | |
3090 | |
3091 const CSSProperty callbackProperty(CSSPropertyInternalCallback, CSSPrimitive Value::createIdentifier(CSSValueInternalPresence)); | |
3092 const RefPtr<StylePropertySet> callbackPropertySet = ImmutableStylePropertyS et::create(&callbackProperty, 1, UASheetMode); | |
3093 | |
3094 CSSSelectorList selectorList; | |
3095 for (unsigned i = 0; i < selectors.size(); ++i) { | |
3096 RefPtr<StyleRule> rule = StyleRule::create(i); | |
3097 | |
3098 parser.parseSelector(selectors[i], selectorList); | |
3099 rule->wrapperAdoptSelectorList(selectorList); | |
3100 | |
3101 rule->setProperties(callbackPropertySet); | |
3102 | |
3103 m_watchedCallbackSelectors.append(rule.release()); | |
3104 } | |
3105 styleResolverChanged(RecalcStyleImmediately, FullStyleUpdate); | |
esprehn
2013/07/13 01:43:01
DeferRecalcStyle, this definitely doesn't need a s
Jeffrey Yasskin
2013/07/16 00:38:51
Done.
| |
3106 } | |
3107 | |
3028 void Document::setHoverNode(PassRefPtr<Node> newHoverNode) | 3108 void Document::setHoverNode(PassRefPtr<Node> newHoverNode) |
3029 { | 3109 { |
3030 m_hoverNode = newHoverNode; | 3110 m_hoverNode = newHoverNode; |
3031 } | 3111 } |
3032 | 3112 |
3033 void Document::setActiveElement(PassRefPtr<Element> newActiveElement) | 3113 void Document::setActiveElement(PassRefPtr<Element> newActiveElement) |
3034 { | 3114 { |
3035 if (!newActiveElement) { | 3115 if (!newActiveElement) { |
3036 m_activeElement.clear(); | 3116 m_activeElement.clear(); |
3037 return; | 3117 return; |
(...skipping 2123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5161 { | 5241 { |
5162 return DocumentLifecycleNotifier::create(this); | 5242 return DocumentLifecycleNotifier::create(this); |
5163 } | 5243 } |
5164 | 5244 |
5165 DocumentLifecycleNotifier* Document::lifecycleNotifier() | 5245 DocumentLifecycleNotifier* Document::lifecycleNotifier() |
5166 { | 5246 { |
5167 return static_cast<DocumentLifecycleNotifier*>(ScriptExecutionContext::lifec ycleNotifier()); | 5247 return static_cast<DocumentLifecycleNotifier*>(ScriptExecutionContext::lifec ycleNotifier()); |
5168 } | 5248 } |
5169 | 5249 |
5170 } // namespace WebCore | 5250 } // namespace WebCore |
OLD | NEW |