summaryrefslogtreecommitdiff
path: root/Source/WebCore
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebCore')
-rw-r--r--Source/WebCore/CMakeLists.txt1
-rw-r--r--Source/WebCore/ChangeLog1624
-rw-r--r--Source/WebCore/GNUmakefile.list.am7
-rw-r--r--Source/WebCore/Modules/indexeddb/DOMWindowIndexedDatabase.cpp6
-rw-r--r--Source/WebCore/Modules/indexeddb/DOMWindowIndexedDatabase.h4
-rw-r--r--Source/WebCore/Modules/indexeddb/DOMWindowIndexedDatabase.idl14
-rw-r--r--Source/WebCore/Modules/indexeddb/WorkerContextIndexedDatabase.cpp6
-rw-r--r--Source/WebCore/Modules/indexeddb/WorkerContextIndexedDatabase.h4
-rw-r--r--Source/WebCore/Modules/indexeddb/WorkerContextIndexedDatabase.idl32
-rw-r--r--Source/WebCore/Modules/mediastream/RTCPeerConnection.cpp2
-rw-r--r--Source/WebCore/Modules/mediastream/RTCPeerConnection.h2
-rw-r--r--Source/WebCore/Modules/mediastream/RTCPeerConnection.idl2
-rw-r--r--Source/WebCore/Modules/webaudio/BiquadProcessor.cpp1
-rw-r--r--Source/WebCore/PlatformBlackBerry.cmake1
-rw-r--r--Source/WebCore/Resources/pagepopups/calendarPicker.js6
-rw-r--r--Source/WebCore/Target.pri2
-rw-r--r--Source/WebCore/WebCore.exp.in11
-rw-r--r--Source/WebCore/WebCore.gypi4
-rwxr-xr-xSource/WebCore/WebCore.vcproj/WebCore.vcproj8
-rw-r--r--Source/WebCore/WebCore.xcodeproj/project.pbxproj16
-rw-r--r--Source/WebCore/bindings/generic/RuntimeEnabledFeatures.h11
-rw-r--r--Source/WebCore/bindings/js/JSDOMWindowShell.h1
-rw-r--r--Source/WebCore/bindings/js/JSHTMLCanvasElementCustom.cpp16
-rw-r--r--Source/WebCore/bindings/js/JSInjectedScriptManager.cpp8
-rw-r--r--Source/WebCore/bindings/js/ScriptFunctionCall.cpp7
-rw-r--r--Source/WebCore/bindings/js/SerializedScriptValue.cpp2
-rw-r--r--Source/WebCore/bindings/scripts/CodeGeneratorGObject.pm2
-rw-r--r--Source/WebCore/bindings/v8/V8PerIsolateData.cpp3
-rw-r--r--Source/WebCore/bindings/v8/custom/V8ArrayBufferViewCustom.h12
-rw-r--r--Source/WebCore/bindings/v8/custom/V8HTMLCanvasElementCustom.cpp16
-rw-r--r--Source/WebCore/css/CSSGradientValue.cpp3
-rw-r--r--Source/WebCore/css/CSSImageSetValue.cpp3
-rw-r--r--Source/WebCore/css/CSSMediaRule.cpp3
-rw-r--r--Source/WebCore/css/CSSParser.cpp2
-rw-r--r--Source/WebCore/css/CSSParserValues.h2
-rw-r--r--Source/WebCore/css/CSSRule.cpp6
-rw-r--r--Source/WebCore/css/CSSRule.h6
-rw-r--r--Source/WebCore/css/CSSRuleList.cpp3
-rw-r--r--Source/WebCore/css/CSSSelector.cpp4
-rw-r--r--Source/WebCore/css/CSSSelector.h1
-rw-r--r--Source/WebCore/css/CSSStyleSheet.cpp3
-rw-r--r--Source/WebCore/css/CSSValueList.cpp3
-rw-r--r--Source/WebCore/css/MediaList.cpp3
-rw-r--r--Source/WebCore/css/MediaQuery.cpp3
-rw-r--r--Source/WebCore/css/SelectorChecker.cpp9
-rw-r--r--Source/WebCore/css/StylePropertySet.cpp5
-rw-r--r--Source/WebCore/css/StyleResolver.cpp60
-rw-r--r--Source/WebCore/css/StyleResolver.h2
-rw-r--r--Source/WebCore/css/StyleRule.cpp3
-rw-r--r--Source/WebCore/css/StyleSheetContents.cpp7
-rw-r--r--Source/WebCore/css/StyleSheetList.cpp27
-rw-r--r--Source/WebCore/css/StyleSheetList.h26
-rw-r--r--Source/WebCore/css/WebKitCSSKeyframesRule.cpp5
-rw-r--r--Source/WebCore/css/WebKitCSSRegionRule.cpp3
-rw-r--r--Source/WebCore/dom/CharacterData.idl5
-rw-r--r--Source/WebCore/dom/ContainerNode.cpp95
-rw-r--r--Source/WebCore/dom/Document.cpp615
-rw-r--r--Source/WebCore/dom/Document.h128
-rw-r--r--Source/WebCore/dom/DocumentStyleSheetCollection.cpp484
-rw-r--r--Source/WebCore/dom/DocumentStyleSheetCollection.h143
-rw-r--r--Source/WebCore/dom/DocumentType.idl3
-rw-r--r--Source/WebCore/dom/Element.cpp9
-rw-r--r--Source/WebCore/dom/Element.idl4
-rw-r--r--Source/WebCore/dom/ElementAttributeData.cpp3
-rw-r--r--Source/WebCore/dom/EventNames.h2
-rw-r--r--Source/WebCore/dom/Node.cpp2
-rw-r--r--Source/WebCore/dom/ProcessingInstruction.cpp15
-rw-r--r--Source/WebCore/dom/StyleElement.cpp15
-rw-r--r--Source/WebCore/html/DateTimeFieldsState.cpp7
-rw-r--r--Source/WebCore/html/DateTimeFieldsState.h3
-rw-r--r--Source/WebCore/html/HTMLLinkElement.cpp15
-rw-r--r--Source/WebCore/html/HTMLQuoteElement.cpp3
-rw-r--r--Source/WebCore/html/HTMLViewSourceDocument.cpp3
-rw-r--r--Source/WebCore/html/TimeInputType.cpp24
-rw-r--r--Source/WebCore/html/TimeInputType.h1
-rw-r--r--Source/WebCore/html/parser/HTMLTreeBuilder.cpp4
-rw-r--r--Source/WebCore/html/shadow/DateTimeEditElement.cpp21
-rw-r--r--Source/WebCore/html/shadow/DateTimeEditElement.h3
-rw-r--r--Source/WebCore/html/shadow/DateTimeFieldElement.cpp5
-rw-r--r--Source/WebCore/html/shadow/DateTimeFieldElement.h2
-rw-r--r--Source/WebCore/html/shadow/DateTimeFieldElements.cpp26
-rw-r--r--Source/WebCore/html/shadow/DateTimeFieldElements.h5
-rw-r--r--Source/WebCore/html/track/TextTrackCue.cpp3
-rw-r--r--Source/WebCore/inspector/InjectedScriptCanvasModule.cpp18
-rw-r--r--Source/WebCore/inspector/InjectedScriptCanvasModule.h6
-rw-r--r--Source/WebCore/inspector/InjectedScriptCanvasModuleSource.js337
-rw-r--r--Source/WebCore/inspector/Inspector.json33
-rw-r--r--Source/WebCore/inspector/InspectorCSSAgent.cpp89
-rw-r--r--Source/WebCore/inspector/InspectorCSSAgent.h4
-rw-r--r--Source/WebCore/inspector/InspectorCanvasAgent.cpp34
-rw-r--r--Source/WebCore/inspector/InspectorCanvasAgent.h4
-rw-r--r--Source/WebCore/inspector/InspectorCanvasInstrumentation.h14
-rw-r--r--Source/WebCore/inspector/InspectorClient.h2
-rw-r--r--Source/WebCore/inspector/InspectorDOMAgent.cpp6
-rw-r--r--Source/WebCore/inspector/InspectorInstrumentation.h1
-rw-r--r--Source/WebCore/inspector/InspectorOverlay.cpp3
-rw-r--r--Source/WebCore/inspector/InspectorPageAgent.cpp7
-rw-r--r--Source/WebCore/inspector/InspectorProfilerAgent.cpp13
-rw-r--r--Source/WebCore/inspector/InspectorProfilerAgent.h1
-rw-r--r--Source/WebCore/inspector/InspectorStyleSheet.cpp27
-rw-r--r--Source/WebCore/inspector/InspectorStyleSheet.h1
-rw-r--r--Source/WebCore/inspector/front-end/AuditRules.js8
-rw-r--r--Source/WebCore/inspector/front-end/CSSStyleModel.js32
-rw-r--r--Source/WebCore/inspector/front-end/DOMAgent.js5
-rw-r--r--Source/WebCore/inspector/front-end/DefaultTextEditor.js35
-rw-r--r--Source/WebCore/inspector/front-end/FilteredItemSelectionDialog.js22
-rw-r--r--Source/WebCore/inspector/front-end/InspectorFrontendAPI.js2
-rw-r--r--Source/WebCore/inspector/front-end/ObjectPropertiesSection.js2
-rw-r--r--Source/WebCore/inspector/front-end/ResourceScriptMapping.js5
-rw-r--r--Source/WebCore/inspector/front-end/SettingsScreen.js75
-rw-r--r--Source/WebCore/inspector/front-end/StylesSidebarPane.js156
-rw-r--r--Source/WebCore/inspector/front-end/UserAgentSupport.js45
-rw-r--r--Source/WebCore/inspector/front-end/externs.js5
-rw-r--r--Source/WebCore/inspector/front-end/inspector.css1
-rw-r--r--Source/WebCore/inspector/front-end/inspector.js6
-rw-r--r--Source/WebCore/loader/DocumentLoader.cpp7
-rw-r--r--Source/WebCore/loader/FrameLoader.cpp5
-rw-r--r--Source/WebCore/loader/SubresourceLoader.cpp10
-rw-r--r--Source/WebCore/loader/cache/CachedImage.cpp1
-rw-r--r--Source/WebCore/loader/cache/CachedImage.h3
-rwxr-xr-xSource/WebCore/loader/cache/CachedResource.cpp3
-rw-r--r--Source/WebCore/loader/cache/CachedResource.h2
-rw-r--r--Source/WebCore/loader/cache/CachedResourceLoader.cpp116
-rw-r--r--Source/WebCore/loader/cache/CachedResourceLoader.h19
-rw-r--r--Source/WebCore/loader/cache/MemoryCache.cpp3
-rw-r--r--Source/WebCore/mathml/MathMLMathElement.cpp2
-rw-r--r--Source/WebCore/page/FeatureObserver.h1
-rw-r--r--Source/WebCore/page/Page.cpp3
-rw-r--r--Source/WebCore/page/PageGroup.cpp3
-rw-r--r--Source/WebCore/page/Settings.cpp17
-rw-r--r--Source/WebCore/page/Settings.h4
-rw-r--r--Source/WebCore/page/ValidationMessageClient.h2
-rw-r--r--Source/WebCore/page/mac/EventHandlerMac.mm7
-rw-r--r--Source/WebCore/platform/FractionalLayoutUnit.h11
-rw-r--r--Source/WebCore/platform/KURLWTFURL.cpp73
-rw-r--r--Source/WebCore/platform/SharedBuffer.cpp5
-rw-r--r--Source/WebCore/platform/blackberry/AuthenticationChallengeManager.cpp253
-rw-r--r--Source/WebCore/platform/blackberry/AuthenticationChallengeManager.h35
-rw-r--r--Source/WebCore/platform/blackberry/CookieManager.cpp11
-rw-r--r--Source/WebCore/platform/blackberry/CookieManager.h1
-rw-r--r--Source/WebCore/platform/blackberry/CookieParser.cpp5
-rw-r--r--Source/WebCore/platform/blackberry/CookieParser.h2
-rw-r--r--Source/WebCore/platform/blackberry/PageClientBlackBerry.h2
-rw-r--r--Source/WebCore/platform/cairo/WidgetBackingStoreCairo.cpp2
-rw-r--r--Source/WebCore/platform/chromium/PlatformSupport.h12
-rw-r--r--Source/WebCore/platform/chromium/ScrollbarThemeChromiumAndroid.cpp23
-rw-r--r--Source/WebCore/platform/chromium/ScrollbarThemeChromiumAndroid.h1
-rw-r--r--Source/WebCore/platform/clutter/GRefPtrClutter.cpp53
-rw-r--r--Source/WebCore/platform/clutter/GRefPtrClutter.h34
-rw-r--r--Source/WebCore/platform/graphics/BitmapImage.cpp3
-rw-r--r--Source/WebCore/platform/graphics/BitmapImage.h1
-rw-r--r--Source/WebCore/platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.cpp41
-rw-r--r--Source/WebCore/platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.h3
-rw-r--r--Source/WebCore/platform/graphics/chromium/CrossProcessFontLoading.mm16
-rw-r--r--Source/WebCore/platform/graphics/clutter/GraphicsLayerClutter.h2
-rw-r--r--Source/WebCore/platform/graphics/clutter/PlatformClutterLayerClient.h51
-rw-r--r--Source/WebCore/platform/graphics/clutter/TransformationMatrixClutter.cpp54
-rw-r--r--Source/WebCore/platform/graphics/mac/ComplexTextController.cpp10
-rw-r--r--Source/WebCore/platform/graphics/opengl/Extensions3DOpenGLCommon.cpp2
-rw-r--r--Source/WebCore/platform/graphics/transforms/TransformationMatrix.h6
-rw-r--r--Source/WebCore/platform/gtk/GtkInputMethodFilter.cpp2
-rw-r--r--Source/WebCore/platform/gtk/GtkWidgetBackingStoreX11.cpp4
-rw-r--r--Source/WebCore/platform/mac/KURLMac.mm2
-rw-r--r--Source/WebCore/platform/mock/GeolocationClientMock.cpp28
-rw-r--r--Source/WebCore/platform/mock/GeolocationClientMock.h12
-rw-r--r--Source/WebCore/platform/network/FormData.cpp3
-rw-r--r--Source/WebCore/platform/network/ResourceRequestBase.cpp3
-rw-r--r--Source/WebCore/platform/network/blackberry/CredentialBackingStore.cpp2
-rw-r--r--Source/WebCore/platform/network/blackberry/NetworkJob.cpp30
-rw-r--r--Source/WebCore/platform/network/blackberry/NetworkJob.h5
-rw-r--r--Source/WebCore/platform/text/mac/LocaleMac.h2
-rw-r--r--Source/WebCore/platform/text/mac/LocaleMac.mm53
-rw-r--r--Source/WebCore/plugins/gtk/PluginViewGtk.cpp2
-rw-r--r--Source/WebCore/rendering/ExclusionRectangle.cpp18
-rw-r--r--Source/WebCore/rendering/ExclusionRectangle.h21
-rw-r--r--Source/WebCore/rendering/ExclusionShape.cpp96
-rw-r--r--Source/WebCore/rendering/ExclusionShape.h37
-rw-r--r--Source/WebCore/rendering/RenderBR.cpp2
-rwxr-xr-xSource/WebCore/rendering/RenderBlock.cpp10
-rw-r--r--Source/WebCore/rendering/RenderFlowThread.cpp11
-rw-r--r--Source/WebCore/rendering/RenderFlowThread.h2
-rw-r--r--Source/WebCore/rendering/RenderInline.cpp10
-rw-r--r--Source/WebCore/rendering/RenderMeter.cpp17
-rw-r--r--Source/WebCore/rendering/RenderMeter.h2
-rw-r--r--Source/WebCore/rendering/RenderMultiColumnFlowThread.cpp7
-rw-r--r--Source/WebCore/rendering/RenderMultiColumnFlowThread.h2
-rwxr-xr-xSource/WebCore/rendering/RenderObject.cpp4
-rw-r--r--Source/WebCore/rendering/RenderObject.h3
-rw-r--r--Source/WebCore/rendering/RenderObjectChildList.cpp2
-rw-r--r--Source/WebCore/rendering/RenderTableRow.cpp2
-rw-r--r--Source/WebCore/rendering/RenderWidget.cpp45
-rw-r--r--Source/WebCore/rendering/RenderWidget.h29
-rw-r--r--Source/WebCore/rendering/RootInlineBox.cpp2
-rw-r--r--Source/WebCore/rendering/WrapShapeInfo.cpp16
-rw-r--r--Source/WebCore/rendering/WrapShapeInfo.h8
-rw-r--r--Source/WebCore/rendering/style/RenderStyle.cpp4
-rw-r--r--Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp3
-rwxr-xr-xSource/WebCore/testing/InternalSettings.cpp8
-rwxr-xr-xSource/WebCore/testing/InternalSettings.h3
-rwxr-xr-xSource/WebCore/testing/InternalSettings.idl1
-rw-r--r--Source/WebCore/testing/Internals.cpp89
-rw-r--r--Source/WebCore/testing/Internals.h8
-rw-r--r--Source/WebCore/testing/Internals.idl2
203 files changed, 4203 insertions, 1999 deletions
diff --git a/Source/WebCore/CMakeLists.txt b/Source/WebCore/CMakeLists.txt
index 4b0250629..5d06bb550 100644
--- a/Source/WebCore/CMakeLists.txt
+++ b/Source/WebCore/CMakeLists.txt
@@ -1125,6 +1125,7 @@ SET(WebCore_SOURCES
dom/DocumentFragment.cpp
dom/DocumentParser.cpp
dom/DocumentOrderedMap.cpp
+ dom/DocumentStyleSheetCollection.cpp
dom/DocumentType.cpp
dom/DynamicNodeList.cpp
dom/EditingText.cpp
diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index c4321a62b..50675f666 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,1627 @@
+2012-09-25 Vsevolod Vlasov <vsevik@chromium.org>
+
+ Web Inspector: ResourceScriptMapping should no steal scripts from other mappings.
+ https://bugs.webkit.org/show_bug.cgi?id=97453
+
+ Reviewed by Pavel Feldman.
+
+ Exposed sourceMapping getter on Script so that resource mapping could check it.
+
+ * inspector/front-end/ResourceScriptMapping.js:
+ (WebInspector.ResourceScriptMapping):
+ (WebInspector.ResourceScriptMapping.prototype._scriptsForSourceURL):
+ (WebInspector.ResourceScriptMapping.prototype._reset):
+
+2012-09-25 Keishi Hattori <keishi@webkit.org>
+
+ REGRESSION(r129448): multiple fields time input UI doesn't use system time format settings on Chromium-Mac
+ https://bugs.webkit.org/show_bug.cgi?id=97517
+
+ Reviewed by Kent Tamura.
+
+ We need to locale [NSLocale currentLocale] if browser language/@lang equals [[NSLocal currentLocale] localeIdentifier]. Otherwise it won't use the custom time format that the user has set.
+
+ No new tests. Unable to test because we need to change system locale settings.
+
+ * platform/text/mac/LocaleMac.h:
+ (LocaleMac):
+ * platform/text/mac/LocaleMac.mm:
+ (WebCore::languageFromLocale): Moved to top.
+ (WebCore):
+ (WebCore::determineLocale): Modified so it takes a locale as an argument.
+ (WebCore::Localizer::create):
+ (WebCore::LocaleMac::LocaleMac): Added checks for invalid locales to this constructor and removed the other one so we don't have duplicated code.
+ (WebCore::LocaleMac::create):
+ (WebCore::LocaleMac::currentLocale):
+
+2012-09-20 Alexander Pavlov <apavlov@chromium.org>
+
+ Web Inspector: Relative URL Link Tooltips do not respect <base>
+ https://bugs.webkit.org/show_bug.cgi?id=43434
+
+ Reviewed by Pavel Feldman.
+
+ New "baseURL" field added into the DOM.Node payload for document nodes and is made use of while resolving and completing URLs.
+
+ * inspector/Inspector.json:
+ * inspector/InspectorDOMAgent.cpp:
+ (WebCore::documentBaseURLString):
+ (WebCore):
+ (WebCore::InspectorDOMAgent::buildObjectForNode):
+ * inspector/front-end/AuditRules.js:
+ (WebInspector.AuditRules.ImageDimensionsRule.prototype.doRun):
+ (WebInspector.AuditRules.CssInHeadRule.prototype.doRun.externalStylesheetsReceived):
+ (WebInspector.AuditRules.StylesScriptsOrderRule.prototype.doRun.cssBeforeInlineReceived):
+ * inspector/front-end/DOMAgent.js:
+ (WebInspector.DOMNode.prototype.resolveURL):
+ (WebInspector.DOMDocument):
+
+2012-09-25 Peter Wang <peter.wang@torchmobile.com.cn>
+
+ Web Inspector: The JS code injected by worker inspector shouldn't be evaluated through JSMainThreadExecState
+ https://bugs.webkit.org/show_bug.cgi?id=95341
+
+ Reviewed by Yury Semikhatsky.
+
+ Add extra code to "JSC::InjectedScriptManager" and "JSC::ScriptFunctionCall" to make sure the
+ interfaces of JSMainThreadExecState are invoked only in main thread.
+
+ No new test case for this bug. Without this patch, opening worker inspector will meet failed assert statements.
+
+ * bindings/js/JSInjectedScriptManager.cpp:
+ (WebCore::InjectedScriptManager::createInjectedScript):
+ * bindings/js/ScriptFunctionCall.cpp:
+ (WebCore::ScriptFunctionCall::call):
+
+2012-09-25 Andreas Kling <kling@webkit.org>
+
+ CSSParserString: Avoid pointless String refcount churn in init().
+ <http://webkit.org/b/94748>
+
+ Reviewed by Sam Weinig.
+
+ Have CSSParserString::init() take a const String& instead of a String.
+
+ * css/CSSParserValues.h:
+ (WebCore::CSSParserString::init):
+
+2012-09-25 Alexander Pavlov <apavlov@chromium.org>
+
+ Web Inspector: [Styles] For group selectors, transmit their segments with the "matches" flag
+ https://bugs.webkit.org/show_bug.cgi?id=96999
+
+ Reviewed by Pavel Feldman.
+
+ The CSSRule protocol object has been modified to include a SelectorList object that contains selector-related data.
+ CSSAgent methods that return CSS rule matches will return RuleMatch objects that encapsulate matching CSSRules
+ with indices of matching selectors on the associated selector list, so the additional backend roundtrips
+ from StylesSidebarPane are no longer necessary.
+
+ * inspector/Inspector.json:
+ * inspector/InspectorCSSAgent.cpp:
+ (WebCore::InspectorCSSAgent::getMatchedStylesForNode):
+ (WebCore::InspectorCSSAgent::buildObjectForRule):
+ (WebCore):
+ (WebCore::InspectorCSSAgent::buildArrayForRuleList):
+ (WebCore::InspectorCSSAgent::buildArrayForMatchedRuleList):
+ * inspector/InspectorCSSAgent.h:
+ (InspectorCSSAgent):
+ * inspector/InspectorStyleSheet.cpp:
+ (WebCore::InspectorStyleSheet::buildObjectForSelectorList):
+ (WebCore):
+ (WebCore::InspectorStyleSheet::buildObjectForRule):
+ * inspector/InspectorStyleSheet.h:
+ (InspectorStyleSheet):
+ * inspector/front-end/CSSStyleModel.js:
+ (WebInspector.CSSStyleModel.parseRuleMatchArrayPayload):
+ (WebInspector.CSSStyleModel.prototype.getMatchedStylesAsync):
+ (WebInspector.CSSRule):
+ (WebInspector.CSSRule.parsePayload):
+ * inspector/front-end/StylesSidebarPane.js:
+ (WebInspector.StylesSidebarPane.prototype._innerRebuildUpdate):
+ (WebInspector.StylesSidebarPane.prototype._rebuildSectionsForStyleRules):
+ (WebInspector.StylePropertiesSection.prototype._markSelectorMatches):
+ (WebInspector.StylePropertiesSection.prototype._moveEditorFromSelector):
+ (WebInspector.StylePropertiesSection.prototype.editingSelectorCancelled):
+
+2012-09-25 MORITA Hajime <morrita@google.com>
+
+ adoptNode() shouldn't reset ownerDocument if the source node failed to remove itself
+ https://bugs.webkit.org/show_bug.cgi?id=97527
+
+ Reviewed by Ryosuke Niwa.
+
+ Document::adoptNode() overlooked an error which can happen in Node::removeChild().
+ Which results an assertion failure. This change adds an error check for that code path.
+
+ Test: fast/dom/adopt-node-prevented.html
+
+ * dom/Document.cpp:
+ (WebCore::Document::adoptNode):
+
+2012-09-21 Ilya Tikhonovsky <loislo@chromium.org>
+
+ Web Inspector: extract Vector instrumentation from core NMI code into MemoryInstrumentationVector.h header.
+ https://bugs.webkit.org/show_bug.cgi?id=96650
+
+ Reviewed by Vsevolod Vlasov.
+
+ addInstrumentedVector and addInstrumentedVectorPtr were replaced with addMember.
+ The same thing happens with addVector and addVectorPtr.
+
+ * css/CSSGradientValue.cpp:
+ (WebCore::CSSGradientValue::reportBaseClassMemoryUsage):
+ * css/CSSImageSetValue.cpp:
+ (WebCore::CSSImageSetValue::reportDescendantMemoryUsage):
+ * css/CSSMediaRule.cpp:
+ (WebCore::CSSMediaRule::reportDescendantMemoryUsage):
+ * css/CSSRuleList.cpp:
+ (WebCore::StaticCSSRuleList::reportMemoryUsage):
+ * css/CSSStyleSheet.cpp:
+ (WebCore::CSSStyleSheet::reportMemoryUsage):
+ * css/CSSValueList.cpp:
+ (WebCore::CSSValueList::reportDescendantMemoryUsage):
+ * css/MediaList.cpp:
+ (WebCore::MediaQuerySet::reportMemoryUsage):
+ * css/MediaQuery.cpp:
+ (WebCore::MediaQuery::reportMemoryUsage):
+ * css/StyleResolver.cpp:
+ (WebCore::StyleResolver::collectMatchingRulesForList):
+ * css/StyleRule.cpp:
+ (WebCore::StyleRuleBlock::reportDescendantMemoryUsage):
+ * css/StyleSheetContents.cpp:
+ (WebCore::StyleSheetContents::reportMemoryUsage):
+ * css/WebKitCSSKeyframesRule.cpp:
+ (WebCore::StyleRuleKeyframes::reportDescendantMemoryUsage):
+ (WebCore::WebKitCSSKeyframesRule::reportDescendantMemoryUsage):
+ * css/WebKitCSSRegionRule.cpp:
+ (WebCore::WebKitCSSRegionRule::reportDescendantMemoryUsage):
+ * dom/Document.cpp:
+ (WebCore::Document::reportMemoryUsage):
+ * loader/DocumentLoader.cpp:
+ (WebCore::DocumentLoader::reportMemoryUsage):
+ * platform/network/ResourceRequestBase.cpp:
+ (WebCore::ResourceRequestBase::reportMemoryUsage):
+
+2012-09-25 Vivek Galatage <vivekgalatage@gmail.com>
+
+ REGRESSION(r129346): It broke !ENABLE(INSPECTOR) build
+ https://bugs.webkit.org/show_bug.cgi?id=97490
+
+ Reviewed by Csaba Osztrogonác.
+
+ The dummy class implementation must be under the ENABLE(INSPECTOR)
+ guard. Added them to prevent from braking the build with --minimal
+ option for build-webkit
+
+ No new tests as caused by missing compile guard.
+
+ * testing/Internals.cpp:
+ (WebCore):
+
+2012-09-24 Bo Liu <boliu@chromium.org>
+
+ Reland "Add in-place reload behavior to ImagesEnabled setting" with optimizations
+ https://bugs.webkit.org/show_bug.cgi?id=97055
+
+ Reviewed by Adam Barth.
+
+ Relanding 128780, 128676, 128645. Was reverted in 128914 due to
+ performance regression in Chromium.
+
+ New changes in addition to previously reverted patches:
+
+ Refactored CachedResource::requestResource, loadResource, and
+ revalidateResource. Moved CachedResource::load method to end of
+ requestResource so there is one place where load is called for all
+ resources.
+
+ Added a enum parameter for requestResource and
+ determineRevalidationPolicy so that FrameLoaderClient::allowImage call
+ do not need to be called multiple times.
+
+ Removed CachedImage::load call in requestImage so it is not called
+ twice.
+
+ Removed unnecessary Frame.h includes in CachedResource and
+ CachedImage.
+
+ Removed dead load() method declaration in CachedImage.
+
+ Updated text expectation for two image-permissions tests to reflect
+ the removed calls to allowImage.
+
+ Tests: fast/loader/display-image-unset-allows-cached-image-load.html
+ fast/loader/display-image-unset-can-block-image-and-can-reload-in-place.html
+ fast/loader/images-enabled-unset-can-block-image-and-can-reload-in-place.html
+
+ * WebCore.exp.in:
+ * loader/FrameLoader.cpp:
+ (WebCore::FrameLoader::didBeginDocument):
+ * loader/SubresourceLoader.cpp:
+ (WebCore::SubresourceLoader::willSendRequest):
+ * loader/cache/CachedImage.cpp:
+ * loader/cache/CachedImage.h:
+ * loader/cache/CachedResource.cpp:
+ (WebCore::CachedResource::didAddClient):
+ * loader/cache/CachedResource.h:
+ (WebCore):
+ (WebCore::CachedResource::stillNeedsLoad):
+ * loader/cache/CachedResourceLoader.cpp:
+ (WebCore::CachedResourceLoader::CachedResourceLoader):
+ (WebCore::CachedResourceLoader::requestImage):
+ (WebCore::CachedResourceLoader::canRequest):
+ (WebCore::CachedResourceLoader::requestResource):
+ (WebCore::CachedResourceLoader::revalidateResource):
+ (WebCore::CachedResourceLoader::loadResource):
+ (WebCore::CachedResourceLoader::determineRevalidationPolicy):
+ (WebCore::CachedResourceLoader::setAutoLoadImages):
+ (WebCore):
+ (WebCore::CachedResourceLoader::setImagesEnabled):
+ (WebCore::CachedResourceLoader::clientDefersImage):
+ (WebCore::CachedResourceLoader::shouldDeferImageLoad):
+ (WebCore::CachedResourceLoader::reloadImagesIfNotDeferred):
+ * loader/cache/CachedResourceLoader.h:
+ (CachedResourceLoader):
+ * page/Settings.cpp:
+ (WebCore::setImageLoadingSettings):
+ (WebCore::Settings::Settings):
+ (WebCore::Settings::setLoadsImagesAutomatically):
+ (WebCore::Settings::imageLoadingSettingsTimerFired):
+ (WebCore::Settings::setImagesEnabled):
+ * page/Settings.h:
+ (Settings):
+ * testing/InternalSettings.cpp:
+ (WebCore::InternalSettings::Backup::Backup):
+ (WebCore::InternalSettings::Backup::restoreTo):
+ (WebCore::InternalSettings::setImagesEnabled):
+ (WebCore):
+ * testing/InternalSettings.h:
+ (Backup):
+ (InternalSettings):
+ * testing/InternalSettings.idl:
+
+2012-09-24 Filip Pizlo <fpizlo@apple.com>
+
+ SerializedScriptValue isn't aware of indexed storage, but should be
+ https://bugs.webkit.org/show_bug.cgi?id=97515
+ <rdar://problem/12361874>
+
+ Reviewed by Sam Weinig.
+
+ New test: fast/js/post-message-numeric-property.html
+
+ * bindings/js/SerializedScriptValue.cpp:
+ (WebCore::CloneDeserializer::putProperty):
+
+2012-09-24 Gavin Barraclough <barraclough@apple.com>
+
+ Remove JSObject::unwrappedGlobalObject(), JSObject::unwrappedObject()
+ https://bugs.webkit.org/show_bug.cgi?id=97519
+
+ Reviewed by Geoff Garen.
+
+ JSDOMWindowShell::setWindow should update the structure's globalObject.
+
+ * bindings/js/JSDOMWindowShell.h:
+ (WebCore::JSDOMWindowShell::setWindow):
+ - Update the JSDOMWindowShell's structure's globalObject when the
+ window changes.
+
+2012-09-24 Yoshifumi Inoue <yosin@chromium.org>
+
+ [Forms] We should remove DateTimeEditElement::valueAsDouble()
+ https://bugs.webkit.org/show_bug.cgi?id=97327
+
+ Reviewed by Kent Tamura.
+
+ This patch removes unused function DateTimeEditElement::valueAsDouble()
+ and related functions in DateTimeFieldElement.
+
+ This patch affects ports which enable both ENABLE_INPUT_TYPE_TIME and
+ ENABLE_INPUT_TYPE_TIME_MULTIPLE_FIELDS.
+
+ No new tests. This patch doesn't change behavior.
+
+ * html/shadow/DateTimeEditElement.cpp: Removed valueAsDouble() implementation.
+ * html/shadow/DateTimeEditElement.h: Removed valueAsDouble() declaration.
+ (DateTimeEditElement):
+ * html/shadow/DateTimeFieldElement.cpp: Removed valueAsDouble() implementation.
+ * html/shadow/DateTimeFieldElement.h: Removed unitInMillisecond() and valueAsDouble() declarations.
+ (DateTimeFieldElement):
+ * html/shadow/DateTimeFieldElements.cpp: Removed unitInMillisecond() implementations.
+ * html/shadow/DateTimeFieldElements.h:
+ (DateTimeAMPMFieldElement): Removed unitInMillisecond() declaration.
+ (DateTimeHourFieldElement): ditto.
+ (DateTimeMillisecondFieldElement): ditto.
+ (DateTimeMinuteFieldElement): ditto.
+ (DateTimeSecondFieldElement): ditto.
+
+2012-09-24 Antti Koivisto <antti@apple.com>
+
+ Don't use StyleSheetList internally.
+ https://bugs.webkit.org/show_bug.cgi?id=97504
+
+ Reviewed by Ryosuke Niwa.
+
+ StyleSheetList is a DOM type and should not be used internally. Use plain Vector instead and construct StyleSheetList on DOM access only.
+
+ * css/StyleResolver.cpp:
+ (WebCore::StyleResolver::StyleResolver):
+ (WebCore::StyleResolver::addStylesheetsFromSeamlessParents):
+ (WebCore::StyleResolver::collectMatchingRulesForList):
+ * css/StyleSheetList.cpp:
+ (WebCore::StyleSheetList::StyleSheetList):
+ (WebCore::StyleSheetList::styleSheets):
+ (WebCore):
+ (WebCore::StyleSheetList::detachFromDocument):
+
+ Use live stylesheet vector of the documents stylesheet collection as long as we are attached to a document.
+ When detached copy the stylesheet vector to a member field and use that instead.
+
+ (WebCore::StyleSheetList::length):
+ (WebCore::StyleSheetList::item):
+ (WebCore::StyleSheetList::getNamedItem):
+ * css/StyleSheetList.h:
+
+ Removed StyleSheetVector typedef as Vector<RefPtr<StyleSheet> > is less opaque and not much longer.
+
+ (WebCore):
+ (WebCore::StyleSheetList::create):
+ (StyleSheetList):
+ (WebCore::StyleSheetList::document):
+ * dom/Document.cpp:
+ (WebCore::Document::~Document):
+ (WebCore::Document::setCompatibilityMode):
+ (WebCore::Document::styleSheets):
+ * dom/Document.h:
+ (Document):
+ * dom/DocumentStyleSheetCollection.cpp:
+ (WebCore::DocumentStyleSheetCollection::DocumentStyleSheetCollection):
+ (WebCore::DocumentStyleSheetCollection::~DocumentStyleSheetCollection):
+ (WebCore::DocumentStyleSheetCollection::analyzeStyleSheetChange):
+ (WebCore::DocumentStyleSheetCollection::updateActiveStyleSheets):
+ * dom/DocumentStyleSheetCollection.h:
+ (WebCore::DocumentStyleSheetCollec
+
+2012-09-24 Laszlo Gombos <l.gombos@samsung.com>
+
+ [GTK][EFL] Remove cairo prefix from include statements
+ https://bugs.webkit.org/show_bug.cgi?id=97509
+
+ Reviewed by Gyuyoung Kim.
+
+ Make the build system consistent by always assuming that directory
+ that includes the cairo headers is included in the include path.
+
+ No new tests as there is no new functionality.
+
+ * platform/cairo/WidgetBackingStoreCairo.cpp:
+ * platform/gtk/GtkWidgetBackingStoreX11.cpp:
+ * plugins/gtk/PluginViewGtk.cpp:
+
+2012-09-24 Yoshifumi Inoue <yosin@chromium.org>
+
+ Document::adoptNode for multiple fields time input UI should not crash
+ https://bugs.webkit.org/show_bug.cgi?id=97428
+
+ Reviewed by Dimitri Glazkov.
+
+ This patch changes Document::removeFocusedNodeOfSubtree() to check
+ focused node in shadow DOM tree for avoiding Document::m_focusedNode
+ not to have dangling pointer to field owner in DateTimeFieldElement.
+
+ Test:
+ - fast/dom/shadow/shadow-removechild-and-blur-event.html: test for removeChild dispatches blur event.
+ - fast/forms/time-multiple-fields/time-multiple-fields-crash-after-adoptnode.html: test for adoptNode not to crash.
+ - fast/forms/time-multiple-fields/time-multiple-fields-state-change-on-focus-or-blur.html: removeChild of input type "time" dispatches blur event, existing test.
+
+ * dom/Document.cpp:
+ (WebCore::Document::removeFocusedNodeOfSubtree): Changed to check
+ focused node in shadow DOM tree in addition to descendant node.
+
+2012-09-24 Robin Cao <robin.cao@torchmobile.com.cn>
+
+ [Blackberry] Add a software rendering path for media player
+ https://bugs.webkit.org/show_bug.cgi?id=97443
+
+ Reviewed by Yong Li.
+
+ This patch adds a software rendering path for media player. When accelerated rendering
+ is not supported by the media engine for the current media, the rendering will fallback
+ to this software path.
+
+ PR #212386
+ Reviewed internally by Max Feil.
+
+ * platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.cpp:
+ (WebCore::MediaPlayerPrivate::paint):
+ (WebCore::MediaPlayerPrivate::updateStates):
+ (WebCore::MediaPlayerPrivate::supportsAcceleratedRendering):
+ (WebCore):
+ * platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.h:
+ (MediaPlayerPrivate):
+
+2012-09-24 Benjamin Poulain <bpoulain@apple.com>
+
+ Fix Geolocation error reporting in the test support
+ https://bugs.webkit.org/show_bug.cgi?id=97386
+
+ Reviewed by Sam Weinig.
+
+ GeolocationController currently expose GeolocationError which can be either
+ PermissionDenied or PositionUnavailable.
+
+ In practice, only PositionUnavailable is supported and tested, only Chrome
+ somewhat expose PermissionDenied.
+ The correct way to deny the permission is through Geolocation::setIsAllowed().
+
+ This patch does some of the initial cleanup toward that goal, reducing how
+ far GeolocationError is spread.
+
+ * WebCore.exp.in:
+ * WebCore.xcodeproj/project.pbxproj:
+ Mac does not use GeolocationClientMock, it should not be compiled in WebCore.
+
+ * platform/mock/GeolocationClientMock.cpp:
+ (WebCore::GeolocationClientMock::GeolocationClientMock):
+ (WebCore::GeolocationClientMock::setPosition):
+ (WebCore::GeolocationClientMock::setPositionUnavailableError):
+ This method replace setError(). It is limited to PositionUnavailable errors.
+
+ (WebCore::GeolocationClientMock::reset):
+ (WebCore::GeolocationClientMock::controllerTimerFired):
+ (WebCore):
+ (WebCore::GeolocationClientMock::clearError):
+ * platform/mock/GeolocationClientMock.h:
+ (WebCore):
+ (GeolocationClientMock):
+
+2012-09-24 Kent Tamura <tkent@chromium.org>
+
+ [Chromium] Implement ValidationMessageClient for Chromium
+ https://bugs.webkit.org/show_bug.cgi?id=97167
+
+ Reviewed by Hajime Morita.
+
+ * page/ValidationMessageClient.h:
+ Add forward declaration for WTF::String.
+
+2012-09-24 Yoshifumi Inoue <yosin@chromium.org>
+
+ [Forms] DateTimeEditElement should return string value for ease of implementing other date/time input types.
+ https://bugs.webkit.org/show_bug.cgi?id=97303
+
+ Reviewed by Kent Tamura.
+
+ This patch introduces a function DateTimeEditElement::value() for
+ setting internal text value of TimeInputType with new function
+ EditControlOwner::formatDateTimeFieldsState() to utilize this protocl
+ in other date time input types.
+
+ We used DateTimeEditElement::valueAsDouble() and and BaseDateAndTimeInputType::serialize()
+ to make string value then setting internal text value of multiple
+ fields time input UI. Although, this steps doesn't work well for
+ other date/time input types.
+
+ This patch affects ports which enable both ENABLE_INPUT_TYPE_TIME and
+ ENABLE_INPUT_TYPE_TIME_MULTIPLE_FIELDS.
+
+ No new tests. This patch doesn't change behavior.
+
+ * html/DateTimeFieldsState.cpp:
+ (WebCore::DateTimeFieldsState::hour23): Added to convert 1 to 12 hour value to 0 to 23 hour.
+ * html/DateTimeFieldsState.h:
+ (DateTimeFieldsState): Added declaration of hour23().
+ * html/TimeInputType.cpp:
+ (WebCore::TimeInputType::DateTimeEditControlOwnerImpl::editControlValueChanged): Changed to use DateTimeEditElement::value() instead of DateTimeEditElement::valueAsDouble().
+ (WebCore::TimeInputType::DateTimeEditControlOwnerImpl::formatDateTimeFieldsState): Added to format time.
+ (WebCore::TimeInputType::restoreFormControlState): Changed to use DateTimeEditElement::value() instead of DateTimeEditElement::valueAsDouble().
+ * html/TimeInputType.h:
+ (DateTimeEditControlOwnerImpl): Added a declaration of formatDateTimeFieldsState().
+ * html/shadow/DateTimeEditElement.cpp:
+ (WebCore::DateTimeEditElement::value): Added.
+ * html/shadow/DateTimeEditElement.h:
+ (EditControlOwner): Added a declaration of formatDateTimeFieldsState().
+ (DateTimeEditElement): Added a declaration of value().
+
+2012-09-24 Dean Jackson <dino@apple.com>
+
+ [WebGL] Intel Mac needs built-in function emulation
+ https://bugs.webkit.org/show_bug.cgi?id=96140
+
+ Reviewed by Sam Weinig.
+
+ Temporarily turn on built-in function emulation for Intel GPUs
+ on OS X. This is a work-around for a driver bug, and
+ will be removed once the driver is updated:
+ https://bugs.webkit.org/show_bug.cgi?id=97503
+
+ This can be tested using the Khronos WebGL conformance
+ suite, in particular:
+
+ conformance/glsl/functions/glsl-function-dot.html
+ conformance/glsl/functions/glsl-function-length.html
+ conformance/glsl/functions/glsl-function-normalize.html
+ conformance/glsl/functions/glsl-function-reflect.html
+
+ Note that the faceforward built-in will still cause
+ problems on Intel GPUs, but this would require an unnecessary
+ change in the ANGLE project (remember, we're going to
+ remove this code once the driver is fixed).
+
+ * platform/graphics/opengl/Extensions3DOpenGLCommon.cpp:
+ (WebCore::Extensions3DOpenGLCommon::getTranslatedShaderSourceANGLE):
+ Temporarily add "Intel" to the list of GPUs we do translation
+ for in the shader compiler.
+
+2012-09-24 Peter Wang <peter.wang@torchmobile.com.cn>
+
+ There is a mistake in InspectorProfilerAgent::enable(bool skipRecompile)
+ https://bugs.webkit.org/show_bug.cgi?id=97450
+
+ Reviewed by Yury Semikhatsky.
+
+ The "InspectorProfilerAgent::enable()" should invokes "PageScriptDebugServer" in
+ no-worker thread.
+
+ No new test case.
+
+ * inspector/InspectorProfilerAgent.cpp:
+ (WebCore::PageProfilerAgent::recompileScript):
+ (PageProfilerAgent):
+ (WebCore::WorkerProfilerAgent::recompileScript):
+ (WorkerProfilerAgent):
+ (WebCore::InspectorProfilerAgent::disable):
+ (WebCore::InspectorProfilerAgent::enable):
+ * inspector/InspectorProfilerAgent.h:
+ (InspectorProfilerAgent):
+
+2012-09-24 Patrick Gansterer <paroga@webkit.org>
+
+ Remove String::operator+=()
+ https://bugs.webkit.org/show_bug.cgi?id=96172
+
+ Reviewed by Benjamin Poulain.
+
+ Replace the last usage with String::append() in Gtk.
+
+ * platform/gtk/GtkInputMethodFilter.cpp:
+ (WebCore::GtkInputMethodFilter::handleCommit):
+
+2012-09-24 Mark Pilgrim <pilgrim@chromium.org>
+
+ [Chromium][Mac] Remove loadFont from PlatformSupport
+ https://bugs.webkit.org/show_bug.cgi?id=97360
+
+ Reviewed by Adam Barth.
+
+ Part of a refactoring series. See tracking bug 82948.
+
+ * platform/chromium/PlatformSupport.h:
+ (PlatformSupport):
+ * platform/graphics/chromium/CrossProcessFontLoading.mm:
+
+2012-09-24 Tony Chang <tony@chromium.org>
+
+ Replace 2 uses of updateLogicalHeight with computeLogicalHeight
+ https://bugs.webkit.org/show_bug.cgi?id=97486
+
+ Reviewed by Ojan Vafai.
+
+ More work for bug 96804. This is just a refactoring.
+
+ No new tests, behavior should be the same as before.
+
+ * rendering/RenderFlowThread.cpp:
+ (WebCore::RenderFlowThread::computeLogicalHeight):
+ * rendering/RenderFlowThread.h:
+ * rendering/RenderMultiColumnFlowThread.cpp:
+ (WebCore::RenderMultiColumnFlowThread::computeLogicalHeight):
+ (WebCore):
+ * rendering/RenderMultiColumnFlowThread.h:
+ (RenderMultiColumnFlowThread):
+
+2012-09-21 Kenneth Russell <kbr@google.com>
+
+ [V8] ArrayBuffer code should not pass a negative length to SetIndexedPropertiesToExternalArrayData()
+ https://bugs.webkit.org/show_bug.cgi?id=96703
+
+ Reviewed by Adam Barth.
+
+ Check length arguments that may be passed to SetIndexedPropertiesToExternalArrayData.
+
+ No tests because it is not guaranteed that buffers this large can actually be allocated.
+
+ * bindings/v8/custom/V8ArrayBufferViewCustom.h:
+ (WebCore::wrapArrayBufferView):
+ (WebCore::constructWebGLArrayWithArrayBufferArgument):
+ (WebCore::constructWebGLArray):
+
+2012-09-24 Antti Koivisto <antti@apple.com>
+
+ Split stylesheet related code out from Document
+ https://bugs.webkit.org/show_bug.cgi?id=97353
+
+ Reviewed by Andreas Kling.
+
+ Document is big and unwieldy. The code related to tracking active stylesheets can be factored out.
+
+ The patch moves stylesheet upkeep, collection and invalidation code from Document to a separate
+ DocumentStyleSheetCollection class. There are no functional changes.
+
+ The usesLinkRules stylesheet feature bit and the related code is removed as no one was using it.
+
+ * WebCore.xcodeproj/project.pbxproj:
+ * css/SelectorChecker.cpp:
+ (WebCore::SelectorChecker::checkOneSelector):
+ * css/StyleResolver.cpp:
+ (WebCore::StyleResolver::StyleResolver):
+ (WebCore::StyleResolver::Features::Features):
+ (WebCore::StyleResolver::Features::add):
+ (WebCore::StyleResolver::Features::clear):
+ (WebCore::StyleResolver::collectMatchingRulesForList):
+ * css/StyleResolver.h:
+ (WebCore::StyleResolver::usesBeforeAfterRules):
+ (Features):
+ * dom/Document.cpp:
+ (WebCore::Document::Document):
+ (WebCore::Document::~Document):
+ (WebCore::Document::setCompatibilityMode):
+ (WebCore::Document::recalcStyle):
+ (WebCore):
+ (WebCore::Document::createStyleResolver):
+ (WebCore::Document::seamlessParentUpdatedStylesheets):
+ (WebCore::Document::didRemoveAllPendingStylesheet):
+ (WebCore::Document::processHttpEquiv):
+ (WebCore::Document::styleSheets):
+ (WebCore::Document::preferredStylesheetSet):
+ (WebCore::Document::selectedStylesheetSet):
+ (WebCore::Document::setSelectedStylesheetSet):
+ (WebCore::Document::styleResolverChanged):
+ (WebCore::Document::reportMemoryUsage):
+ (WebCore::Document::haveStylesheetsLoaded):
+ * dom/Document.h:
+ (WebCore):
+ (Document):
+ (WebCore::Document::styleSheetCollection):
+ (WebCore::Document::hasNodesWithPlaceholderStyle):
+ (WebCore::Document::setNeedsNotifyRemoveAllPendingStylesheet):
+ (WebCore::Document::inStyleRecalc):
+ * dom/DocumentStyleSheetCollection.cpp: Added.
+ (WebCore):
+ (WebCore::DocumentStyleSheetCollection::DocumentStyleSheetCollection):
+ (WebCore::DocumentStyleSheetCollection::~DocumentStyleSheetCollection):
+ (WebCore::DocumentStyleSheetCollection::pageUserSheet):
+ (WebCore::DocumentStyleSheetCollection::clearPageUserSheet):
+ (WebCore::DocumentStyleSheetCollection::updatePageUserSheet):
+ (WebCore::DocumentStyleSheetCollection::pageGroupUserSheets):
+ (WebCore::DocumentStyleSheetCollection::clearPageGroupUserSheets):
+ (WebCore::DocumentStyleSheetCollection::updatePageGroupUserSheets):
+ (WebCore::DocumentStyleSheetCollection::addUserSheet):
+ (WebCore::DocumentStyleSheetCollection::removePendingSheet):
+ (WebCore::DocumentStyleSheetCollection::addStyleSheetCandidateNode):
+ (WebCore::DocumentStyleSheetCollection::removeStyleSheetCandidateNode):
+ (WebCore::DocumentStyleSheetCollection::collectActiveStyleSheets):
+ (WebCore::DocumentStyleSheetCollection::testAddedStyleSheetRequiresStyleRecalc):
+ (WebCore::DocumentStyleSheetCollection::analyzeStyleSheetChange):
+ (WebCore::styleSheetsUseRemUnits):
+ (WebCore::DocumentStyleSheetCollection::updateActiveStyleSheets):
+ (WebCore::DocumentStyleSheetCollection::combineCSSFeatureFlags):
+ (WebCore::DocumentStyleSheetCollection::resetCSSFeatureFlags):
+ (WebCore::DocumentStyleSheetCollection::reportMemoryUsage):
+ * dom/DocumentStyleSheetCollection.h: Added.
+ (WebCore):
+ (DocumentStyleSheetCollection):
+ (WebCore::DocumentStyleSheetCollection::authorStyleSheets):
+ (WebCore::DocumentStyleSheetCollection::documentUserSheets):
+ (WebCore::DocumentStyleSheetCollection::needsUpdateActiveStylesheetsOnStyleRecalc):
+ (WebCore::DocumentStyleSheetCollection::preferredStylesheetSetName):
+ (WebCore::DocumentStyleSheetCollection::selectedStylesheetSetName):
+ (WebCore::DocumentStyleSheetCollection::setPreferredStylesheetSetName):
+ (WebCore::DocumentStyleSheetCollection::setSelectedStylesheetSetName):
+ (WebCore::DocumentStyleSheetCollection::addPendingSheet):
+ (WebCore::DocumentStyleSheetCollection::hasPendingSheets):
+ (WebCore::DocumentStyleSheetCollection::usesSiblingRules):
+ (WebCore::DocumentStyleSheetCollection::setUsesSiblingRulesOverride):
+ (WebCore::DocumentStyleSheetCollection::usesFirstLineRules):
+ (WebCore::DocumentStyleSheetCollection::usesFirstLetterRules):
+ (WebCore::DocumentStyleSheetCollection::setUsesFirstLetterRules):
+ (WebCore::DocumentStyleSheetCollection::usesBeforeAfterRules):
+ (WebCore::DocumentStyleSheetCollection::setUsesBeforeAfterRulesOverride):
+ (WebCore::DocumentStyleSheetCollection::usesRemUnits):
+ (WebCore::DocumentStyleSheetCollection::setUsesRemUnit):
+ * dom/Element.cpp:
+ (WebCore::Element::recalcStyle):
+ * dom/ProcessingInstruction.cpp:
+ (WebCore::ProcessingInstruction::~ProcessingInstruction):
+ (WebCore::ProcessingInstruction::checkStyleSheet):
+ (WebCore::ProcessingInstruction::sheetLoaded):
+ (WebCore::ProcessingInstruction::insertedInto):
+ (WebCore::ProcessingInstruction::removedFrom):
+ * dom/StyleElement.cpp:
+ (WebCore::StyleElement::insertedIntoDocument):
+ (WebCore::StyleElement::removedFromDocument):
+ (WebCore::StyleElement::clearDocumentData):
+ (WebCore::StyleElement::createSheet):
+ (WebCore::StyleElement::sheetLoaded):
+ (WebCore::StyleElement::startLoadingDynamicSheet):
+ * html/HTMLLinkElement.cpp:
+ (WebCore::HTMLLinkElement::~HTMLLinkElement):
+ (WebCore::HTMLLinkElement::insertedInto):
+ (WebCore::HTMLLinkElement::removedFrom):
+ (WebCore::HTMLLinkElement::addPendingSheet):
+ (WebCore::HTMLLinkElement::removePendingSheet):
+ * html/HTMLQuoteElement.cpp:
+ (WebCore::HTMLQuoteElement::insertedInto):
+ * html/HTMLViewSourceDocument.cpp:
+ (WebCore::HTMLViewSourceDocument::HTMLViewSourceDocument):
+ * mathml/MathMLMathElement.cpp:
+ (WebCore::MathMLMathElement::insertedInto):
+ * page/Page.cpp:
+ (WebCore::Page::userStyleSheetLocationChanged):
+ * page/PageGroup.cpp:
+ (WebCore::PageGroup::resetUserStyleCacheInAllFrames):
+ * rendering/RenderBR.cpp:
+ (WebCore::RenderBR::lineHeight):
+ * rendering/RenderBlock.cpp:
+ (WebCore::RenderBlock::styleDidChange):
+ (WebCore::RenderBlock::splitBlocks):
+ (WebCore::RenderBlock::addChildIgnoringAnonymousColumnBlocks):
+ (WebCore::RenderBlock::lineHeight):
+ (WebCore::RenderBlock::updateFirstLetter):
+ * rendering/RenderInline.cpp:
+ (WebCore::RenderInline::styleDidChange):
+ (WebCore::RenderInline::updateAlwaysCreateLineBoxes):
+ (WebCore::RenderInline::addChildIgnoringContinuation):
+ (WebCore::RenderInline::splitInlines):
+ (WebCore::RenderInline::lineHeight):
+ * rendering/RenderObject.cpp:
+ (WebCore::RenderObject::uncachedFirstLineStyle):
+ (WebCore::RenderObject::firstLineStyleSlowCase):
+ * rendering/RenderObject.h:
+ (WebCore::RenderObject::firstLineStyle):
+ * rendering/RenderObjectChildList.cpp:
+ (WebCore::RenderObjectChildList::updateBeforeAfterContent):
+ * rendering/RenderTableRow.cpp:
+ (WebCore::RenderTableRow::updateBeforeAndAfterContent):
+ * rendering/RootInlineBox.cpp:
+ (WebCore::RootInlineBox::verticalPositionForBox):
+
+2012-09-24 Otto Derek Cheung <otcheung@rim.com>
+
+ [BlackBerry] Reverting implementation for 407 error pages
+ https://bugs.webkit.org/show_bug.cgi?id=97455
+
+ Reviewed by Rob Buis.
+
+ Revert "[BlackBerry] Reverting implementation for 407 error pages"
+ This reverts commit fda0a1b6ac40c06c03bb6293b4a7d7353c3ca238.
+
+ This revert also reverts commit 0cffe01961fb80204138505bcec29a83818efb73
+ due to dependency issues.
+
+ * PlatformBlackBerry.cmake:
+ * platform/blackberry/AuthenticationChallengeManager.cpp: Removed.
+ * platform/blackberry/AuthenticationChallengeManager.h:
+ * platform/blackberry/PageClientBlackBerry.h:
+ * platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.cpp:
+ (WebCore::MediaPlayerPrivate::MediaPlayerPrivate):
+ (WebCore::MediaPlayerPrivate::~MediaPlayerPrivate):
+ (WebCore::MediaPlayerPrivate::onAuthenticationNeeded):
+ (WebCore::MediaPlayerPrivate::notifyChallengeResult):
+ * platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.h:
+ (MediaPlayerPrivate):
+ * platform/network/blackberry/NetworkJob.cpp:
+ (WebCore::NetworkJob::NetworkJob):
+ (WebCore::NetworkJob::handleNotifyStatusReceived):
+ (WebCore::NetworkJob::notifyAuthReceived):
+ (WebCore::NetworkJob::handleNotifyClose):
+ (WebCore::NetworkJob::sendRequestWithCredentials):
+ (WebCore::NetworkJob::notifyChallengeResult):
+ * platform/network/blackberry/NetworkJob.h:
+ (NetworkJob):
+
+2012-09-24 Chris Rogers <crogers@google.com>
+
+ [REGRESSION] Layout Test webaudio/biquad-getFrequencyResponse.html is failing
+ https://bugs.webkit.org/show_bug.cgi?id=97439
+
+ Reviewed by Kenneth Russell.
+
+ Fixes uninitialized member variable.
+
+ This should fix flaky failing test: webaudio/biquad-getFrequencyResponse.html
+
+ * Modules/webaudio/BiquadProcessor.cpp:
+ (WebCore::BiquadProcessor::BiquadProcessor):
+
+2012-09-24 Tony Chang <tony@chromium.org>
+
+ flex-grow should be 1 when omitted from flex shorthand
+ https://bugs.webkit.org/show_bug.cgi?id=97480
+
+ Reviewed by Ojan Vafai.
+
+ We were using 0, based on an outdated version of the spec.
+
+ Tests: css3/flexbox/flex-property-parsing.html
+ css3/flexbox/flex-algorithm.html: New test case.
+
+ * css/CSSParser.cpp:
+ (WebCore::CSSParser::parseFlex):
+
+2012-09-24 Benjamin Poulain <benjamin@webkit.org>
+
+ Add support for query encoding to WTFURL
+ https://bugs.webkit.org/show_bug.cgi?id=97422
+
+ Reviewed by Adam Barth.
+
+ Add the Charset conversion on WebCore side.
+
+ * platform/KURLWTFURL.cpp:
+ (WebCore::KURL::KURL):
+ (CharsetConverter):
+ (WebCore::CharsetConverter::CharsetConverter):
+ * platform/mac/KURLMac.mm:
+ (WebCore::KURL::KURL):
+
+2012-09-24 Benjamin Poulain <benjamin@webkit.org>
+
+ Integrate most of GoogleURL in WTFURL
+ https://bugs.webkit.org/show_bug.cgi?id=97405
+
+ Reviewed by Adam Barth.
+
+ Loosen KURLWTFURL to be able to run most tests in Debug.
+
+ * platform/KURLWTFURL.cpp:
+ (WebCore::KURL::KURL):
+ (WebCore::KURL::hasPort):
+ (WebCore::KURL::user):
+ (WebCore::KURL::pass):
+ (WebCore::KURL::hasPath):
+ (WebCore::KURL::path):
+ (WebCore::KURL::query):
+ (WebCore::KURL::fragmentIdentifier):
+ (WebCore::KURL::fileSystemPath):
+
+2012-09-24 Hans Muller <hmuller@adobe.com>
+
+ [CSS Exclusions] ExclusionShape API should use logical coordinates for input/output
+ https://bugs.webkit.org/show_bug.cgi?id=96156
+
+ Reviewed by Dirk Schulze.
+
+ Correct how ExclusionShapes deal with logical coordinates and enable
+ shape-inside exclusion layout for vertical writing-modes.
+
+ BasicShape's are defined in physical cooordinates, incoming line and box
+ dimensions are logical coordinates, and the ExclusionShape internals assume
+ that lines are aligned with the Y axis. The createExclusionShape() method
+ is responsible for converting the BasicShape to the internal coordinate
+ system when the writing-mode is vertical. Similarly, the getInclude,ExcludedIntervals()
+ methods are responsible for converting their logical line parameters to Y
+ values in the internal coordinate system. The min,maxYForLogicalLine()
+ methods do the conversion, based on the WritingMode the ExclusionShape
+ was created with. The getInclude,ExcludedIntervals() methods return the
+ logical left and right edges of line segments. No transformation is needed for this.
+
+ The ExclusionShape's internal coordinate system is essentially the
+ "logical" one, except that top/bottom always map to Y, no matter what
+ the writing-mode is. This is just to simplify writing geometrical shape
+ algorithms, notably the complex ones for polygons. The bug report includes a
+ pair of diagrams that clarify how internal coordinates are related to logical
+ and physical coordinates.
+
+ Test: fast/exclusions/shape-inside/shape-inside-vertical-text.html
+
+ * rendering/ExclusionRectangle.cpp:
+ (WebCore::ExclusionRectangle::getExcludedIntervals): rename more accurately reflects return value
+ (WebCore::ExclusionRectangle::getIncludedIntervals): rename for consistency with "excluded" version
+ * rendering/ExclusionRectangle.h:
+ * rendering/ExclusionShape.cpp:
+ (WebCore):
+ (WebCore::ExclusionShape::createExclusionShape):
+ * rendering/ExclusionShape.h:
+ (LineSegment):
+ (WebCore::LineSegment::LineSegment): relocated from WrapShapeInfo.h
+ (WebCore):
+ (ExclusionShape):
+ (WebCore::ExclusionShape::minYForLogicalLine):
+ (WebCore::ExclusionShape::maxYForLogicalLine):
+ (WebCore::ExclusionShape::internalToLogicalBoundingBox):
+ * rendering/WrapShapeInfo.cpp:
+ (WebCore::WrapShapeInfo::isWrapShapeInfoEnabledForRenderBlock):
+ (WebCore::WrapShapeInfo::computeShapeSize): pass writingMode to createExclusionShape()
+ (WebCore::WrapShapeInfo::computeSegmentsForLine): removed short-circuit for vertical writing-modes
+ * rendering/WrapShapeInfo.h:
+ (WebCore):
+
+2012-09-24 Tony Chang <tony@chromium.org>
+
+ Replace RenderMeter::updateLogicalHeight to RenderMeter::computeLogicalHeight
+ https://bugs.webkit.org/show_bug.cgi?id=97475
+
+ Reviewed by Ojan Vafai.
+
+ Using RenderMeter::computeLogicalHeight is part of bug 96804.
+ Also fix some code to be vertical writing mode aware. This doesn't actually cause
+ a behavioral difference because we use percentage heights/widths which don't depend on
+ updateLogicalWidth or computeLogicalHeight. You can still see bugs if you try to set
+ the min-width on a <meter> node in a vertical writing mode.
+
+ No new tests, no behavioral changes.
+
+ * rendering/RenderMeter.cpp:
+ (WebCore::RenderMeter::updateLogicalWidth): Make vertical writing mode aware.
+ (WebCore::RenderMeter::computeLogicalHeight): Switch from updateLogicalHeight and make vertical writing mode aware.
+ * rendering/RenderMeter.h:
+ (RenderMeter):
+
+2012-09-24 Dimitri Glazkov <dglazkov@chromium.org>
+
+ Remove unbaked support for :scope pseudo-class.
+ https://bugs.webkit.org/show_bug.cgi?id=97467
+
+ Reviewed by Antti Koivisto.
+
+ It turns out, the Selectors 4 require ":scope" to match contextual reference element set, which would be the root node in querySelector:
+ http://dev.w3.org/csswg/selectors4/#the-scope-pseudo
+
+ Right now, we simply make ":scope" equivalent to ":root", which is not correct. Let's remove the partial implementation until we have
+ time/energy to fully implement it.
+
+ No new tests, removing half-baked feature.
+
+ * css/CSSSelector.cpp:
+ (WebCore::CSSSelector::pseudoId): Removed all mentions of PseudoScope
+ (WebCore::nameToPseudoTypeMap): Ditto.
+ (WebCore::CSSSelector::extractPseudoType): Ditto.
+ * css/CSSSelector.h: Ditto.
+ * css/SelectorChecker.cpp:
+ (WebCore::SelectorChecker::checkOneSelector): Ditto.
+
+2012-09-24 Ryosuke Niwa <rniwa@webkit.org>
+
+ suspend/resumeWidgetHierarchyUpdates should be a RAII object
+ https://bugs.webkit.org/show_bug.cgi?id=96706
+
+ Reviewed by Simon Fraser.
+
+ Replaced suspendWidgetHierarchyUpdates and resumeWidgetHierarchyUpdates by WidgetHierarchyUpdatesSuspensionScope.
+
+ * WebCore.exp.in: Export new symbols.
+ * dom/ContainerNode.cpp:
+ (WebCore::ContainerNode::removeChild):
+ (WebCore::ContainerNode::removeChildren):
+ * dom/Document.cpp:
+ (WebCore::Document::recalcStyle):
+ * dom/Element.cpp:
+ (WebCore::Element::attach):
+ (WebCore::Element::detach):
+ * page/mac/EventHandlerMac.mm:
+ (WebCore::EventHandler::passMouseDownEventToWidget):
+ * rendering/RenderWidget.cpp:
+ (WebCore):
+ (WebCore::WidgetHierarchyUpdatesSuspensionScope::widgetNewParentMap):
+ (WebCore::WidgetHierarchyUpdatesSuspensionScope::moveWidgets):
+ (WebCore::moveWidgetToParentSoon):
+ * rendering/RenderWidget.h:
+ (WidgetHierarchyUpdatesSuspensionScope):
+ (WebCore::WidgetHierarchyUpdatesSuspensionScope::WidgetHierarchyUpdatesSuspensionScope):
+ (WebCore::WidgetHierarchyUpdatesSuspensionScope::~WidgetHierarchyUpdatesSuspensionScope):
+ (WebCore::WidgetHierarchyUpdatesSuspensionScope::isSuspended):
+ (WebCore::WidgetHierarchyUpdatesSuspensionScope::scheduleWidgetToMove):
+ (WebCore):
+ (RenderWidget):
+
+2012-09-24 Otto Derek Cheung <otcheung@rim.com>
+
+ [BlackBerry] Reverting implementation for 407 error pages
+ https://bugs.webkit.org/show_bug.cgi?id=97455
+
+ Reviewed by Rob Buis.
+
+ Revert "[BlackBerry] Show custom error page when 407 is received"
+ This reverts commit e6d14529428fe47916fcb997528095b8acad2f2b.
+
+ * platform/network/blackberry/NetworkJob.cpp:
+ (WebCore::NetworkJob::handleNotifyStatusReceived):
+ (WebCore::NetworkJob::notifyAuthReceived):
+ (WebCore::NetworkJob::sendRequestWithCredentials):
+
+2012-09-24 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r129388.
+ http://trac.webkit.org/changeset/129388
+ https://bugs.webkit.org/show_bug.cgi?id=97477
+
+ Caused an assertion in a WebKit2 unit test (Requested by
+ abarth on #webkit).
+
+ * WebCore.exp.in:
+ * loader/FrameLoader.cpp:
+ (WebCore::FrameLoader::didBeginDocument):
+ * loader/SubresourceLoader.cpp:
+ (WebCore::SubresourceLoader::willSendRequest):
+ * loader/cache/CachedImage.cpp:
+ * loader/cache/CachedImage.h:
+ (WebCore::CachedImage::stillNeedsLoad):
+ (CachedImage):
+ * loader/cache/CachedResource.cpp:
+ (WebCore::CachedResource::didAddClient):
+ * loader/cache/CachedResource.h:
+ (WebCore):
+ * loader/cache/CachedResourceLoader.cpp:
+ (WebCore::CachedResourceLoader::CachedResourceLoader):
+ (WebCore::CachedResourceLoader::requestImage):
+ (WebCore::CachedResourceLoader::canRequest):
+ (WebCore::CachedResourceLoader::requestResource):
+ (WebCore::CachedResourceLoader::revalidateResource):
+ (WebCore::CachedResourceLoader::loadResource):
+ (WebCore::CachedResourceLoader::determineRevalidationPolicy):
+ (WebCore::CachedResourceLoader::setAutoLoadImages):
+ * loader/cache/CachedResourceLoader.h:
+ (CachedResourceLoader):
+ * page/Settings.cpp:
+ (WebCore::setLoadsImagesAutomaticallyInAllFrames):
+ (WebCore::Settings::Settings):
+ (WebCore::Settings::setLoadsImagesAutomatically):
+ (WebCore::Settings::loadsImagesAutomaticallyTimerFired):
+ (WebCore::Settings::setImagesEnabled):
+ * page/Settings.h:
+ (Settings):
+ * testing/InternalSettings.cpp:
+ (WebCore::InternalSettings::Backup::Backup):
+ (WebCore::InternalSettings::Backup::restoreTo):
+ * testing/InternalSettings.h:
+ (Backup):
+ (InternalSettings):
+ * testing/InternalSettings.idl:
+
+2012-09-24 Erik Arvidsson <arv@chromium.org>
+
+ DOM4 remove method
+ https://bugs.webkit.org/show_bug.cgi?id=73885
+
+ Reviewed by Ojan Vafai.
+
+ This adds the DOM 4 remove method.
+
+ http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#dom-childnode-remove
+
+ The remove method removes the node from its parent if it has a parent.
+
+ Tests: fast/dom/Comment/remove.html
+ fast/dom/DocumentType/remove.html
+ fast/dom/Element/remove.html
+ fast/dom/Text/remove.html
+
+ * dom/CharacterData.idl:
+ * dom/DocumentType.idl:
+ * dom/Element.idl:
+ * dom/Node.cpp:
+ (WebCore::Node::remove): The spec says to do nothing if the node has no parent.
+ * html/parser/HTMLTreeBuilder.cpp:
+ (WebCore::HTMLTreeBuilder::processStartTagForInBody): Cleanup.
+ * html/track/TextTrackCue.cpp:
+ (WebCore::TextTrackCue::removeDisplayTree): No need to check parenNode twice.
+
+2012-09-24 Tommy Widenflycht <tommyw@google.com>
+
+ MediaStream API: Fix the incorrectly spelled RTCPeerConnection::onnegotiationneeded callback
+ https://bugs.webkit.org/show_bug.cgi?id=97456
+
+ Reviewed by Adam Barth.
+
+ Renamed onnegotationneeded to onnegotiationneeded.
+
+ Existing test updated.
+
+ * Modules/mediastream/RTCPeerConnection.cpp:
+ (WebCore::RTCPeerConnection::negotiationNeeded):
+ * Modules/mediastream/RTCPeerConnection.h:
+ (RTCPeerConnection):
+ * Modules/mediastream/RTCPeerConnection.idl:
+ * dom/EventNames.h:
+ (WebCore):
+
+2012-09-24 Peter Beverloo <peter@chromium.org>
+
+ Android's mock scrollbars shows up as a difference in layout test results
+ https://bugs.webkit.org/show_bug.cgi?id=96382
+
+ Reviewed by Adam Barth.
+
+ Remove the exceptions made for layout tests in Android's scrollbar theme.
+ This will make our actual scrollbars show up in layout test pixel results,
+ bringing the tests closer to what we actually ship.
+
+ An important difference with other platforms is that scrollbars do not
+ take any width on Android, they're rendered on top of the content. Therefore
+ each test that has a visible scrollbar does not just need a new pixel
+ result, but will also need a new text result. This will be handled as part
+ of a larger rebaselining process.
+
+ Will be exercised by every layout test that has a scrollbar.
+
+ * platform/chromium/ScrollbarThemeChromiumAndroid.cpp:
+ (WebCore::ScrollbarThemeChromiumAndroid::scrollbarThickness):
+ (WebCore::ScrollbarThemeChromiumAndroid::usesOverlayScrollbars):
+ (WebCore::ScrollbarThemeChromiumAndroid::hasThumb):
+ * platform/chromium/ScrollbarThemeChromiumAndroid.h:
+ (ScrollbarThemeChromiumAndroid):
+
+2012-09-24 Sean Wang <Xuewen.Wang@torchmobile.com.cn>
+
+ [BlackBerry] Basic authentication challenge credentials for stored credentials again after restarting browser
+ https://bugs.webkit.org/show_bug.cgi?id=96362
+
+ Reviewed by Rob Buis.
+
+ Fix a mistake of the commit 11fdc73c7c74bbd736ed4160248ff59636a01864
+ Trunk has been changed during reviewing that patch.
+
+ No new tests, this is to correct a build error.
+
+ * platform/network/blackberry/CredentialBackingStore.cpp:
+ (WebCore::CredentialBackingStore::getProtectionSpace):
+
+2012-09-24 Dan Bernstein <mitz@apple.com>
+
+ Reverted r129176, the fix for <http://webkit.org/b/97269>, because it introduced a
+ discrepancy between line breaking and max width computation.
+
+ Rubber-stamped by Anders Carlsson.
+
+ * platform/graphics/mac/ComplexTextController.cpp:
+ (WebCore::ComplexTextController::adjustGlyphsAndAdvances):
+
+2012-09-24 Bo Liu <boliu@chromium.org>
+
+ Reland "Add in-place reload behavior to ImagesEnabled setting" with optimizations
+ https://bugs.webkit.org/show_bug.cgi?id=97055
+
+ Reviewed by Adam Barth.
+
+ Relanding 128780, 128676, 128645. Was reverted in 128914 due to
+ performance regression in Chromium.
+
+ New changes in addition to previously reverted patches:
+
+ Refactored CachedResource::requestResource, loadResource, and
+ revalidateResource. Moved CachedResource::load method to end of
+ requestResource so there is one place where load is called for all
+ resources.
+
+ Added a enum parameter for requestResource and
+ determineRevalidationPolicy so that FrameLoaderClient::allowImage call
+ do not need to be called multiple times.
+
+ Removed CachedImage::load call in requestImage so it is not called
+ twice.
+
+ Removed unnecessary Frame.h includes in CachedResource and
+ CachedImage.
+
+ Removed dead load() method declaration in CachedImage.
+
+ Updated text expectation for two image-permissions tests to reflect
+ the removed calls to allowImage.
+
+ Tests: fast/loader/display-image-unset-allows-cached-image-load.html
+ fast/loader/display-image-unset-can-block-image-and-can-reload-in-place.html
+ fast/loader/images-enabled-unset-can-block-image-and-can-reload-in-place.html
+
+ * WebCore.exp.in:
+ * loader/FrameLoader.cpp:
+ (WebCore::FrameLoader::didBeginDocument):
+ * loader/SubresourceLoader.cpp:
+ (WebCore::SubresourceLoader::willSendRequest):
+ * loader/cache/CachedImage.cpp:
+ * loader/cache/CachedImage.h:
+ * loader/cache/CachedResource.cpp:
+ (WebCore::CachedResource::didAddClient):
+ * loader/cache/CachedResource.h:
+ (WebCore):
+ (WebCore::CachedResource::stillNeedsLoad):
+ * loader/cache/CachedResourceLoader.cpp:
+ (WebCore::CachedResourceLoader::CachedResourceLoader):
+ (WebCore::CachedResourceLoader::requestImage):
+ (WebCore::CachedResourceLoader::canRequest):
+ (WebCore::CachedResourceLoader::requestResource):
+ (WebCore::CachedResourceLoader::revalidateResource):
+ (WebCore::CachedResourceLoader::loadResource):
+ (WebCore::CachedResourceLoader::determineRevalidationPolicy):
+ (WebCore::CachedResourceLoader::setAutoLoadImages):
+ (WebCore):
+ (WebCore::CachedResourceLoader::setImagesEnabled):
+ (WebCore::CachedResourceLoader::clientDefersImage):
+ (WebCore::CachedResourceLoader::shouldDeferImageLoad):
+ (WebCore::CachedResourceLoader::reloadImagesIfNotDeferred):
+ * loader/cache/CachedResourceLoader.h:
+ (CachedResourceLoader):
+ * page/Settings.cpp:
+ (WebCore::setImageLoadingSettings):
+ (WebCore::Settings::Settings):
+ (WebCore::Settings::setLoadsImagesAutomatically):
+ (WebCore::Settings::imageLoadingSettingsTimerFired):
+ (WebCore::Settings::setImagesEnabled):
+ * page/Settings.h:
+ (Settings):
+ * testing/InternalSettings.cpp:
+ (WebCore::InternalSettings::Backup::Backup):
+ (WebCore::InternalSettings::Backup::restoreTo):
+ (WebCore::InternalSettings::setImagesEnabled):
+ (WebCore):
+ * testing/InternalSettings.h:
+ (Backup):
+ (InternalSettings):
+ * testing/InternalSettings.idl:
+
+2012-09-24 Joone Hur <joone.hur@intel.com>, Gustavo Noronha Silva <gustavo.noronha@collabora.com>
+
+ [GTK] Implement GraphicsLayer using Clutter
+ https://bugs.webkit.org/show_bug.cgi?id=73767
+
+ Reviewed by Martin Robinson.
+
+ This patch is needed for enabling Accelerated Compositing(Clutter backend)
+ with the patches submitted in bug 92045 and 91940.
+
+ No new tests. This will be covered by pixel tests for Qt/GTK+ accelerated
+ compositing and 3D transforms.
+
+ * GNUmakefile.list.am:
+ * platform/clutter/GRefPtrClutter.cpp: Removed.
+ * platform/clutter/GRefPtrClutter.h: Removed.
+ * platform/graphics/clutter/PlatformClutterLayerClient.h: Added.
+ (WebCore):
+ (PlatformClutterLayerClient):
+ (WebCore::PlatformClutterLayerClient::~PlatformClutterLayerClient):
+ * platform/graphics/clutter/TransformationMatrixClutter.cpp: Added to convert CoglMatrix to
+ TransformationMatrix.
+ (WebCore):
+ (WebCore::TransformationMatrix::operator CoglMatrix):
+ * platform/graphics/transforms/TransformationMatrix.h:
+ (TransformationMatrix):
+
+2012-09-24 David Grogan <dgrogan@chromium.org>
+
+ Unprefix IndexedDB
+ https://bugs.webkit.org/show_bug.cgi?id=96548
+
+ Reviewed by Adam Barth.
+
+ We are largely compatible with the FF implementation and the w3c test
+ suite submitted by MS. The w3c test suite doesn't yet check
+ for lack of prefix; this is mostly to signal to devs that we think our
+ implementation is stable.
+
+ This patch uses the new FeatureObserver to get data about prefixed
+ vs unprefixed usage.
+
+ Tests: storage/indexeddb/unprefix-workers.html
+ storage/indexeddb/unprefix.html
+
+ * Modules/indexeddb/DOMWindowIndexedDatabase.cpp:
+ (WebCore::DOMWindowIndexedDatabase::indexedDB):
+ * Modules/indexeddb/DOMWindowIndexedDatabase.h:
+ (DOMWindowIndexedDatabase):
+ * Modules/indexeddb/DOMWindowIndexedDatabase.idl:
+ * Modules/indexeddb/WorkerContextIndexedDatabase.cpp:
+ (WebCore::WorkerContextIndexedDatabase::indexedDB):
+ * Modules/indexeddb/WorkerContextIndexedDatabase.h:
+ (WorkerContextIndexedDatabase):
+ * Modules/indexeddb/WorkerContextIndexedDatabase.idl:
+ * bindings/generic/RuntimeEnabledFeatures.h:
+ Making the auxiliary objects RuntimeEnabled didn't make much sense as
+ they are useless without the factory, so always enable them.
+
+ (WebCore::RuntimeEnabledFeatures::indexedDBEnabled):
+ * bindings/scripts/CodeGeneratorGObject.pm:
+ (SkipAttribute):
+ * page/FeatureObserver.h:
+
+2012-09-24 Andrey Adaikin <aandrey@chromium.org>
+
+ Web Inspector: [WebGL] First step towards 2D canvas instrumentation in injected script
+ https://bugs.webkit.org/show_bug.cgi?id=96746
+
+ Reviewed by Pavel Feldman.
+
+ First step towards the 2D canvas instrumentation from the WebGL injected script module side.
+ We trace and save all calls that affect the 2D canvas context state and it's resources (Gradient and Pattern)
+ so that we could replay the context and resources states later.
+ The 2D canvas context state consists of:
+ - current transformation matrix
+ - current default path
+ - current clipping region (affected by the "clip" command)
+ - current values of the context attributes (like strokeStyle, fillStyle, etc.)
+ - a stack of saved drawing states (affected by the "save" and "restore" commands)
+
+ * inspector/InjectedScriptCanvasModuleSource.js:
+ (.):
+
+2012-09-24 Andrey Adaikin <aandrey@chromium.org>
+
+ Web Inspector: [TextEditor] conditional breakpoint popup not showing up the first time
+ https://bugs.webkit.org/show_bug.cgi?id=97442
+
+ Reviewed by Pavel Feldman.
+
+ 1) The conditional breakpoint popup may not show up the first time we click on the gutter.
+ This was the case because the popup decoration element would be deleted from the line while
+ it was being highlighted and appended afterwards. Now we do not remove decorations from the
+ DOM while highlighting.
+
+ 2) Also the popup will close itself on any mouse click event, even if it's targeted to the
+ input box itself. This was due to pointer-events: none; CSS style for the parent element.
+ Now we just override this style for the input box.
+
+ * inspector/front-end/DefaultTextEditor.js:
+ (WebInspector.TextEditorMainPanel.prototype._paintLine):
+ (WebInspector.TextEditorMainPanel.prototype._insertSpanBefore):
+ (WebInspector.TextEditorMainPanel.prototype._insertTextNodeBefore):
+ * inspector/front-end/inspector.css:
+ (.source-frame-breakpoint-condition):
+
+2012-09-24 Andrey Adaikin <aandrey@chromium.org>
+
+ Web Inspector: [Canvas] set CanvasAgent in InstrumentingAgents upon calling enable command
+ https://bugs.webkit.org/show_bug.cgi?id=97331
+
+ Reviewed by Yury Semikhatsky.
+
+ We should set CanvasAgent in InstrumentingAgents from enable() command and remove from disable(), instead of doing this in constructor and destructor.
+
+ * inspector/InspectorCanvasAgent.cpp:
+ (WebCore::InspectorCanvasAgent::InspectorCanvasAgent):
+ (WebCore::InspectorCanvasAgent::~InspectorCanvasAgent):
+ (WebCore::InspectorCanvasAgent::restore):
+ (WebCore::InspectorCanvasAgent::enable):
+ (WebCore::InspectorCanvasAgent::disable):
+ * inspector/InspectorCanvasAgent.h:
+ (InspectorCanvasAgent):
+ * inspector/InspectorCanvasInstrumentation.h:
+ (WebCore::InspectorInstrumentation::wrapCanvas2DRenderingContextForInstrumentation):
+ (WebCore::InspectorInstrumentation::wrapWebGLRenderingContextForInstrumentation):
+
+2012-09-24 Patrick Gansterer <paroga@webkit.org>
+
+ Remove remaining WTF_DEPRECATED_STRING_OPERATORS from cpp files
+ https://bugs.webkit.org/show_bug.cgi?id=97412
+
+ Reviewed by Adam Barth.
+
+ * css/StylePropertySet.cpp: Removed useless define.
+
+2012-09-20 Emil A Eklund <eae@chromium.org>
+
+ snapToSize rounds the incorrectly for negative locations
+ https://bugs.webkit.org/show_bug.cgi?id=97265
+
+ Reviewed by Eric Seidel.
+
+ Change snapSizeToPixel to preserve sign for location which
+ affects rounding.
+
+ Test: fast/sub-pixel/snap-negative-location.html
+
+ * platform/FractionalLayoutUnit.h:
+ (WebCore::snapSizeToPixel):
+
+2012-09-24 Jonathan Liu <net147@gmail.com>
+
+ Use unsigned char for bitfield instead of unsigned.
+ https://bugs.webkit.org/show_bug.cgi?id=97447
+
+ Reviewed by Andreas Kling.
+
+ Not all compilers will pad an unsigned bitfield to the smallest size.
+ Use unsigned char instead of unsigned to reduce padding for compilers
+ that pad to the underlying type.
+
+ No new tests. There is already a compile-time assertion.
+
+ * css/CSSRule.cpp:
+ (SameSizeAsCSSRule):
+ * css/CSSRule.h:
+ (CSSRule):
+
+2012-09-24 Peter Rybin <peter.rybin@gmail.com>
+
+ Web Inspector: don't allow exception in front-end when expanding function scope
+ https://bugs.webkit.org/show_bug.cgi?id=97346
+
+ Reviewed by Yury Semikhatsky.
+
+ A missing guard condition is added.
+
+ * inspector/front-end/ObjectPropertiesSection.js:
+ (WebInspector.FunctionScopeMainTreeElement.prototype.onpopulate.didGetDetails):
+ (WebInspector.FunctionScopeMainTreeElement.prototype.onpopulate):
+
+2012-09-24 Arvid Nilsson <anilsson@rim.com>
+
+ [BlackBerry] Add cookie database API
+ https://bugs.webkit.org/show_bug.cgi?id=97102
+
+ Reviewed by Antonio Gomes.
+
+ Add a CookieManager method that takes a list of strings to parse
+ instead of just one string. Expose CookieParser::parseOneCookie.
+
+ Reviewed internally by Otto D. Cheung.
+
+ No change in behavior, no new tests.
+
+ * platform/blackberry/CookieManager.cpp:
+ (WebCore::CookieManager::setCookies):
+ (WebCore):
+ * platform/blackberry/CookieManager.h:
+ * platform/blackberry/CookieParser.cpp:
+ (WebCore::CookieParser::parseOneCookie):
+ (WebCore):
+ * platform/blackberry/CookieParser.h:
+ (CookieParser):
+
+2012-09-24 Vsevolod Vlasov <vsevik@chromium.org>
+
+ Web Inspector: Open resource dialog has too many false positive matches.
+ https://bugs.webkit.org/show_bug.cgi?id=97332
+
+ Reviewed by Alexander Pavlov.
+
+ Improved open resource dialog filtering to make the amount of false
+ positive search results less.
+
+ * inspector/front-end/FilteredItemSelectionDialog.js:
+ (WebInspector.FilteredItemSelectionDialog.prototype._innerCreateSearchRegExp):
+ (WebInspector.FilteredItemSelectionDialog.prototype._highlightItem.get var):
+ (WebInspector.FilteredItemSelectionDialog.prototype._highlightItem):
+
+2012-09-24 Andrey Adaikin <aandrey@chromium.org>
+
+ Web Inspector: [Canvas] support 2D canvas instrumentation from the inspector C++ code
+ https://bugs.webkit.org/show_bug.cgi?id=97203
+
+ Reviewed by Yury Semikhatsky.
+
+ Implements wrapping a 2D canvas context through the injected canvas module script facility.
+
+ * bindings/js/JSHTMLCanvasElementCustom.cpp:
+ (WebCore::JSHTMLCanvasElement::getContext):
+ * bindings/v8/custom/V8HTMLCanvasElementCustom.cpp:
+ (WebCore::V8HTMLCanvasElement::getContextCallback):
+ * inspector/InjectedScriptCanvasModule.cpp:
+ (WebCore::InjectedScriptCanvasModule::wrapCanvas2DContext):
+ (WebCore):
+ (WebCore::InjectedScriptCanvasModule::wrapWebGLContext):
+ (WebCore::InjectedScriptCanvasModule::callWrapContextFunction):
+ * inspector/InjectedScriptCanvasModule.h:
+ (InjectedScriptCanvasModule):
+ * inspector/InspectorCanvasAgent.cpp:
+ (WebCore::InspectorCanvasAgent::wrapCanvas2DRenderingContextForInstrumentation):
+ (WebCore):
+ * inspector/InspectorCanvasAgent.h:
+ (InspectorCanvasAgent):
+ * inspector/InspectorCanvasInstrumentation.h:
+ (WebCore::InspectorInstrumentation::wrapCanvas2DRenderingContextForInstrumentation):
+ (WebCore):
+ * inspector/InspectorInstrumentation.h:
+ (InspectorInstrumentation):
+
+2012-09-24 Pavel Feldman <pfeldman@chromium.org>
+
+ Web Inspector:EXC_BAD_ACCESS upon closing page with node highlighted
+ https://bugs.webkit.org/show_bug.cgi?id=97446
+
+ Reviewed by Alexander Pavlov.
+
+ Added 0 check on frame view.
+
+ * inspector/InspectorOverlay.cpp:
+ (WebCore::InspectorOverlay::update):
+
+2012-09-21 Alexander Pavlov <apavlov@chromium.org>
+
+ Web Inspector: [REGRESSION] Cmd-Shift-C doesn't enable element inspection mode when inspector hidden
+ https://bugs.webkit.org/show_bug.cgi?id=97249
+
+ Reviewed by Yury Semikhatsky.
+
+ Fix regression from r125871.
+
+ * inspector/front-end/InspectorFrontendAPI.js:
+ (InspectorFrontendAPI.enterInspectElementMode):
+ * inspector/front-end/inspector.js:
+ (WebInspector._createGlobalStatusBarItems):
+ (WebInspector.documentKeyDown):
+
+2012-09-24 Alexander Pavlov <apavlov@chromium.org>
+
+ Web Inspector: Disable persistence of master switches in the "Overrides" settings tab
+ https://bugs.webkit.org/show_bug.cgi?id=97440
+
+ Reviewed by Yury Semikhatsky.
+
+ Disables enforcement of device metrics, geolocation, and device orientation overrides on Web Inspector start.
+
+ * inspector/InspectorPageAgent.cpp:
+ (WebCore::InspectorPageAgent::restore):
+ * inspector/front-end/SettingsScreen.js:
+ (WebInspector.UserAgentSettingsTab.prototype._onMetricsCheckboxClicked):
+ (WebInspector.UserAgentSettingsTab.prototype._onGeolocationOverrideCheckboxClicked):
+ (WebInspector.UserAgentSettingsTab.prototype._onDeviceOrientationOverrideCheckboxClicked):
+ * inspector/front-end/UserAgentSupport.js:
+ (WebInspector.UserAgentSupport):
+ (WebInspector.UserAgentSupport.prototype.toggleDeviceMetricsOverride):
+ (WebInspector.UserAgentSupport.prototype.toggleGeolocationPositionOverride):
+ (WebInspector.UserAgentSupport.prototype.toggleDeviceOrientationOverride):
+ * inspector/front-end/externs.js:
+
+2012-09-24 Vivek Galatage <vivekgalatage@gmail.com>
+
+ Web Inspector: implement testing harness for pure protocol tests.
+ https://bugs.webkit.org/show_bug.cgi?id=90675
+
+ Reviewed by Yury Semikhatsky.
+
+ Implementing the testing harness as the APIs of Internals object not
+ only reduced platform specific patching of DRTs but also minimized the
+ the effort required to open up the new dummy inspector Frontend.
+
+ The openDummyInspectorFrontend method will return the handle to newly
+ created DOMWindow. This DOMWindow object can be utilized inside the test
+ case to communicate using postMessage WebAPI.
+
+ The newly created DOMWindow will host the protocol-test.html which
+ will seed the necessary JS libraries to communicate with the
+ InspectorBackend.
+
+ Test: inspector-protocol/css-getSupportedCSSProperties.html
+
+ * WebCore.exp.in:
+ * WebCore.gypi:
+ * inspector/InspectorClient.h:
+ (InspectorClient):
+ * testing/Internals.cpp:
+ (InspectorFrontendClientDummy):
+ (WebCore::InspectorFrontendClientDummy::~InspectorFrontendClientDummy):
+ (WebCore):
+ (WebCore::InspectorFrontendClientDummy::InspectorFrontendClientDummy):
+ (InspectorFrontendChannelDummy):
+ (WebCore::InspectorFrontendChannelDummy::~InspectorFrontendChannelDummy):
+ (WebCore::InspectorFrontendChannelDummy::InspectorFrontendChannelDummy):
+ (WebCore::InspectorFrontendChannelDummy::sendMessageToFrontend):
+ (WebCore::Internals::consoleMessageArgumentCounts):
+ (WebCore::Internals::openDummyInspectorFrontend):
+ (WebCore::Internals::closeDummyInspectorFrontend):
+ * testing/Internals.h:
+ (WebCore):
+ (Internals):
+ * testing/Internals.idl:
+
+2012-09-24 Keishi Hattori <keishi@webkit.org>
+
+ REGRESSION(r127727): Calendar picker focus doesn't loop in calendar-picker.html
+ https://bugs.webkit.org/show_bug.cgi?id=97183
+
+ Reviewed by Kent Tamura.
+
+ Fixing bug calendar-picker.html. The page popup behaves fine because
+ this code is only necessary in calendar-picker.html where the focus can
+ move outside of the picker because we are just using an iframe.
+
+ No new tests. Added tests to calendar-picker-key-operations.html.
+
+ * Resources/pagepopups/calendarPicker.js:
+ (YearMonthController.prototype.attachTo):
+ (CalendarPicker.prototype._handleBodyKeyDown):
+
2012-09-24 Andrey Kosyakov <caseq@chromium.org>
Unreviewed follow-up to r129336 -- fixed closure compiler warnings.
diff --git a/Source/WebCore/GNUmakefile.list.am b/Source/WebCore/GNUmakefile.list.am
index 8ca8b268e..d2ed2915f 100644
--- a/Source/WebCore/GNUmakefile.list.am
+++ b/Source/WebCore/GNUmakefile.list.am
@@ -2734,6 +2734,8 @@ webcore_sources += \
Source/WebCore/dom/DocumentOrderedMap.h \
Source/WebCore/dom/DocumentParser.cpp \
Source/WebCore/dom/DocumentParser.h \
+ Source/WebCore/dom/DocumentStyleSheetCollection.cpp \
+ Source/WebCore/dom/DocumentStyleSheetCollection.h \
Source/WebCore/dom/DocumentTiming.h \
Source/WebCore/dom/DocumentType.cpp \
Source/WebCore/dom/DocumentType.h \
@@ -6238,10 +6240,9 @@ endif # END ENABLE_WEBGL
if USE_ACCELERATED_COMPOSITING
if USE_CLUTTER
webcore_sources += \
- Source/WebCore/platform/clutter/GRefPtrClutter.cpp \
- Source/WebCore/platform/clutter/GRefPtrClutter.h \
Source/WebCore/platform/graphics/clutter/GraphicsLayerClutter.cpp \
- Source/WebCore/platform/graphics/clutter/GraphicsLayerClutter.h
+ Source/WebCore/platform/graphics/clutter/GraphicsLayerClutter.h \
+ Source/WebCore/platform/graphics/clutter/TransformationMatrixClutter.cpp
endif # END USE_CLUTTER
if USE_TEXTURE_MAPPER_CAIRO
diff --git a/Source/WebCore/Modules/indexeddb/DOMWindowIndexedDatabase.cpp b/Source/WebCore/Modules/indexeddb/DOMWindowIndexedDatabase.cpp
index 9f4cbb4f7..168028b63 100644
--- a/Source/WebCore/Modules/indexeddb/DOMWindowIndexedDatabase.cpp
+++ b/Source/WebCore/Modules/indexeddb/DOMWindowIndexedDatabase.cpp
@@ -88,12 +88,12 @@ void DOMWindowIndexedDatabase::willDetachGlobalObjectFromFrame()
DOMWindowProperty::willDetachGlobalObjectFromFrame();
}
-IDBFactory* DOMWindowIndexedDatabase::webkitIndexedDB(DOMWindow* window)
+IDBFactory* DOMWindowIndexedDatabase::indexedDB(DOMWindow* window)
{
- return from(window)->webkitIndexedDB();
+ return from(window)->indexedDB();
}
-IDBFactory* DOMWindowIndexedDatabase::webkitIndexedDB()
+IDBFactory* DOMWindowIndexedDatabase::indexedDB()
{
Document* document = m_window->document();
if (!document)
diff --git a/Source/WebCore/Modules/indexeddb/DOMWindowIndexedDatabase.h b/Source/WebCore/Modules/indexeddb/DOMWindowIndexedDatabase.h
index fd32f9d42..c8c6303b2 100644
--- a/Source/WebCore/Modules/indexeddb/DOMWindowIndexedDatabase.h
+++ b/Source/WebCore/Modules/indexeddb/DOMWindowIndexedDatabase.h
@@ -41,7 +41,7 @@ public:
virtual ~DOMWindowIndexedDatabase();
static DOMWindowIndexedDatabase* from(DOMWindow*);
- static IDBFactory* webkitIndexedDB(DOMWindow*);
+ static IDBFactory* indexedDB(DOMWindow*);
virtual void disconnectFrameForPageCache() OVERRIDE;
virtual void reconnectFrameFromPageCache(Frame*) OVERRIDE;
@@ -52,7 +52,7 @@ public:
private:
explicit DOMWindowIndexedDatabase(DOMWindow*);
- IDBFactory* webkitIndexedDB();
+ IDBFactory* indexedDB();
DOMWindow* m_window;
RefPtr<IDBFactory> m_idbFactory;
diff --git a/Source/WebCore/Modules/indexeddb/DOMWindowIndexedDatabase.idl b/Source/WebCore/Modules/indexeddb/DOMWindowIndexedDatabase.idl
index 09513f1fa..a290b7300 100644
--- a/Source/WebCore/Modules/indexeddb/DOMWindowIndexedDatabase.idl
+++ b/Source/WebCore/Modules/indexeddb/DOMWindowIndexedDatabase.idl
@@ -30,7 +30,7 @@ module window {
Conditional=INDEXED_DATABASE,
Supplemental=DOMWindow
] DOMWindowIndexedDatabase {
- readonly attribute [V8MeasureAs=PrefixedIndexedDB] IDBFactory webkitIndexedDB;
+ readonly attribute [ImplementedAs=indexedDB,V8MeasureAs=PrefixedIndexedDB] IDBFactory webkitIndexedDB;
attribute IDBCursorConstructor webkitIDBCursor;
attribute IDBDatabaseConstructor webkitIDBDatabase;
@@ -41,6 +41,18 @@ module window {
attribute IDBObjectStoreConstructor webkitIDBObjectStore;
attribute IDBRequestConstructor webkitIDBRequest;
attribute IDBTransactionConstructor webkitIDBTransaction;
+
+ readonly attribute [V8MeasureAs=UnprefixedIndexedDB] IDBFactory indexedDB;
+
+ attribute IDBCursorConstructor IDBCursor;
+ attribute IDBDatabaseConstructor IDBDatabase;
+ attribute IDBDatabaseExceptionConstructor IDBDatabaseException;
+ attribute IDBFactoryConstructor IDBFactory;
+ attribute IDBIndexConstructor IDBIndex;
+ attribute IDBKeyRangeConstructor IDBKeyRange;
+ attribute IDBObjectStoreConstructor IDBObjectStore;
+ attribute IDBRequestConstructor IDBRequest;
+ attribute IDBTransactionConstructor IDBTransaction;
};
}
diff --git a/Source/WebCore/Modules/indexeddb/WorkerContextIndexedDatabase.cpp b/Source/WebCore/Modules/indexeddb/WorkerContextIndexedDatabase.cpp
index b3d209992..0a25ea7d7 100644
--- a/Source/WebCore/Modules/indexeddb/WorkerContextIndexedDatabase.cpp
+++ b/Source/WebCore/Modules/indexeddb/WorkerContextIndexedDatabase.cpp
@@ -58,12 +58,12 @@ WorkerContextIndexedDatabase* WorkerContextIndexedDatabase::from(ScriptExecution
return supplement;
}
-IDBFactory* WorkerContextIndexedDatabase::webkitIndexedDB(ScriptExecutionContext* context)
+IDBFactory* WorkerContextIndexedDatabase::indexedDB(ScriptExecutionContext* context)
{
- return from(context)->webkitIndexedDB();
+ return from(context)->indexedDB();
}
-IDBFactory* WorkerContextIndexedDatabase::webkitIndexedDB()
+IDBFactory* WorkerContextIndexedDatabase::indexedDB()
{
if (!m_context->securityOrigin()->canAccessDatabase())
return 0;
diff --git a/Source/WebCore/Modules/indexeddb/WorkerContextIndexedDatabase.h b/Source/WebCore/Modules/indexeddb/WorkerContextIndexedDatabase.h
index 836caa8c6..9a84f1799 100644
--- a/Source/WebCore/Modules/indexeddb/WorkerContextIndexedDatabase.h
+++ b/Source/WebCore/Modules/indexeddb/WorkerContextIndexedDatabase.h
@@ -42,12 +42,12 @@ public:
virtual ~WorkerContextIndexedDatabase();
static WorkerContextIndexedDatabase* from(ScriptExecutionContext*);
- static IDBFactory* webkitIndexedDB(ScriptExecutionContext*);
+ static IDBFactory* indexedDB(ScriptExecutionContext*);
private:
explicit WorkerContextIndexedDatabase(ScriptExecutionContext*);
- IDBFactory* webkitIndexedDB();
+ IDBFactory* indexedDB();
ScriptExecutionContext* m_context;
RefPtr<IDBFactoryBackendInterface> m_factoryBackend;
diff --git a/Source/WebCore/Modules/indexeddb/WorkerContextIndexedDatabase.idl b/Source/WebCore/Modules/indexeddb/WorkerContextIndexedDatabase.idl
index c336c57ee..acc5565bd 100644
--- a/Source/WebCore/Modules/indexeddb/WorkerContextIndexedDatabase.idl
+++ b/Source/WebCore/Modules/indexeddb/WorkerContextIndexedDatabase.idl
@@ -30,17 +30,29 @@ module threads {
Conditional=INDEXED_DATABASE,
Supplemental=WorkerContext
] WorkerContextIndexedDatabase {
- readonly attribute [V8EnabledAtRuntime] IDBFactory webkitIndexedDB;
+ readonly attribute [ImplementedAs=indexedDB,V8EnabledAtRuntime] IDBFactory webkitIndexedDB;
- attribute [V8EnabledAtRuntime] IDBCursorConstructor webkitIDBCursor;
- attribute [V8EnabledAtRuntime] IDBDatabaseConstructor webkitIDBDatabase;
- attribute [V8EnabledAtRuntime] IDBDatabaseExceptionConstructor webkitIDBDatabaseException;
- attribute [V8EnabledAtRuntime] IDBFactoryConstructor webkitIDBFactory;
- attribute [V8EnabledAtRuntime] IDBIndexConstructor webkitIDBIndex;
- attribute [V8EnabledAtRuntime] IDBKeyRangeConstructor webkitIDBKeyRange;
- attribute [V8EnabledAtRuntime] IDBObjectStoreConstructor webkitIDBObjectStore;
- attribute [V8EnabledAtRuntime] IDBRequestConstructor webkitIDBRequest;
- attribute [V8EnabledAtRuntime] IDBTransactionConstructor webkitIDBTransaction;
+ attribute IDBCursorConstructor webkitIDBCursor;
+ attribute IDBDatabaseConstructor webkitIDBDatabase;
+ attribute IDBDatabaseExceptionConstructor webkitIDBDatabaseException;
+ attribute IDBFactoryConstructor webkitIDBFactory;
+ attribute IDBIndexConstructor webkitIDBIndex;
+ attribute IDBKeyRangeConstructor webkitIDBKeyRange;
+ attribute IDBObjectStoreConstructor webkitIDBObjectStore;
+ attribute IDBRequestConstructor webkitIDBRequest;
+ attribute IDBTransactionConstructor webkitIDBTransaction;
+
+ readonly attribute [V8EnabledAtRuntime] IDBFactory indexedDB;
+
+ attribute IDBCursorConstructor IDBCursor;
+ attribute IDBDatabaseConstructor IDBDatabase;
+ attribute IDBDatabaseExceptionConstructor IDBDatabaseException;
+ attribute IDBFactoryConstructor IDBFactory;
+ attribute IDBIndexConstructor IDBIndex;
+ attribute IDBKeyRangeConstructor IDBKeyRange;
+ attribute IDBObjectStoreConstructor IDBObjectStore;
+ attribute IDBRequestConstructor IDBRequest;
+ attribute IDBTransactionConstructor IDBTransaction;
};
}
diff --git a/Source/WebCore/Modules/mediastream/RTCPeerConnection.cpp b/Source/WebCore/Modules/mediastream/RTCPeerConnection.cpp
index 78896a796..cb9ba7c5a 100644
--- a/Source/WebCore/Modules/mediastream/RTCPeerConnection.cpp
+++ b/Source/WebCore/Modules/mediastream/RTCPeerConnection.cpp
@@ -393,7 +393,7 @@ void RTCPeerConnection::close(ExceptionCode& ec)
void RTCPeerConnection::negotiationNeeded()
{
- dispatchEvent(Event::create(eventNames().negotationneededEvent, false, false));
+ dispatchEvent(Event::create(eventNames().negotiationneededEvent, false, false));
}
void RTCPeerConnection::didGenerateIceCandidate(PassRefPtr<RTCIceCandidateDescriptor> iceCandidateDescriptor)
diff --git a/Source/WebCore/Modules/mediastream/RTCPeerConnection.h b/Source/WebCore/Modules/mediastream/RTCPeerConnection.h
index 1615581a5..84d1e1fbe 100644
--- a/Source/WebCore/Modules/mediastream/RTCPeerConnection.h
+++ b/Source/WebCore/Modules/mediastream/RTCPeerConnection.h
@@ -86,7 +86,7 @@ public:
void close(ExceptionCode&);
- DEFINE_ATTRIBUTE_EVENT_LISTENER(negotationneeded);
+ DEFINE_ATTRIBUTE_EVENT_LISTENER(negotiationneeded);
DEFINE_ATTRIBUTE_EVENT_LISTENER(icecandidate);
DEFINE_ATTRIBUTE_EVENT_LISTENER(open);
DEFINE_ATTRIBUTE_EVENT_LISTENER(statechange);
diff --git a/Source/WebCore/Modules/mediastream/RTCPeerConnection.idl b/Source/WebCore/Modules/mediastream/RTCPeerConnection.idl
index 967ad4023..bc4390f54 100644
--- a/Source/WebCore/Modules/mediastream/RTCPeerConnection.idl
+++ b/Source/WebCore/Modules/mediastream/RTCPeerConnection.idl
@@ -75,7 +75,7 @@ module mediastream {
void close()
raises(DOMException);
- attribute EventListener onnegotationneeded;
+ attribute EventListener onnegotiationneeded;
attribute EventListener onicecandidate;
attribute EventListener onopen;
attribute EventListener onstatechange;
diff --git a/Source/WebCore/Modules/webaudio/BiquadProcessor.cpp b/Source/WebCore/Modules/webaudio/BiquadProcessor.cpp
index 3ae02636a..6362a10e7 100644
--- a/Source/WebCore/Modules/webaudio/BiquadProcessor.cpp
+++ b/Source/WebCore/Modules/webaudio/BiquadProcessor.cpp
@@ -39,6 +39,7 @@ BiquadProcessor::BiquadProcessor(AudioContext* context, float sampleRate, size_t
, m_parameter2(0)
, m_parameter3(0)
, m_filterCoefficientsDirty(true)
+ , m_hasSampleAccurateValues(false)
{
double nyquist = 0.5 * this->sampleRate();
diff --git a/Source/WebCore/PlatformBlackBerry.cmake b/Source/WebCore/PlatformBlackBerry.cmake
index 987202cde..b608ae873 100644
--- a/Source/WebCore/PlatformBlackBerry.cmake
+++ b/Source/WebCore/PlatformBlackBerry.cmake
@@ -61,7 +61,6 @@ LIST(APPEND WebCore_SOURCES
bindings/cpp/WebDOMString.cpp
bindings/cpp/WebExceptionHandler.cpp
platform/blackberry/CookieDatabaseBackingStore/CookieDatabaseBackingStore.cpp
- platform/blackberry/AuthenticationChallengeManager.cpp
platform/blackberry/CookieManager.cpp
platform/blackberry/CookieMap.cpp
platform/blackberry/CookieParser.cpp
diff --git a/Source/WebCore/Resources/pagepopups/calendarPicker.js b/Source/WebCore/Resources/pagepopups/calendarPicker.js
index db984a538..3758006f9 100644
--- a/Source/WebCore/Resources/pagepopups/calendarPicker.js
+++ b/Source/WebCore/Resources/pagepopups/calendarPicker.js
@@ -479,7 +479,7 @@ YearMonthController.prototype.attachTo = function(element) {
}
this._month.style.minWidth = maxWidth + 'px';
- global.firstFocusableControl = this._left2; // FIXME: Should it be this.month?
+ this.picker.firstFocusableControl = this._left2; // FIXME: Should it be this.month?
};
YearMonthController.addTenYearsButtons = false;
@@ -1178,11 +1178,11 @@ CalendarPicker.prototype._handleBodyKeyDown = function(event) {
this.maybeUpdateFocusStyle();
var key = event.keyIdentifier;
if (key == "U+0009") {
- if (!event.shiftKey && document.activeElement == global.lastFocusableControl) {
+ if (!event.shiftKey && document.activeElement == this.lastFocusableControl) {
event.stopPropagation();
event.preventDefault();
this.firstFocusableControl.focus();
- } else if (event.shiftKey && document.activeElement == global.firstFocusableControl) {
+ } else if (event.shiftKey && document.activeElement == this.firstFocusableControl) {
event.stopPropagation();
event.preventDefault();
this.lastFocusableControl.focus();
diff --git a/Source/WebCore/Target.pri b/Source/WebCore/Target.pri
index 7465d4405..523d884df 100644
--- a/Source/WebCore/Target.pri
+++ b/Source/WebCore/Target.pri
@@ -371,6 +371,7 @@ SOURCES += \
dom/DocumentMarker.cpp \
dom/DocumentOrderedMap.cpp \
dom/DocumentParser.cpp \
+ dom/DocumentStyleSheetCollection.cpp \
dom/DocumentType.cpp \
dom/DOMCoreException.cpp \
dom/DOMError.cpp \
@@ -1528,6 +1529,7 @@ HEADERS += \
dom/DocumentMarker.h \
dom/DocumentMarkerController.h \
dom/DocumentOrderedMap.h \
+ dom/DocumentStyleSheetCollection.h \
dom/DocumentType.h \
dom/DOMError.h \
dom/DOMImplementation.h \
diff --git a/Source/WebCore/WebCore.exp.in b/Source/WebCore/WebCore.exp.in
index dff830d50..5e087ac56 100644
--- a/Source/WebCore/WebCore.exp.in
+++ b/Source/WebCore/WebCore.exp.in
@@ -186,8 +186,6 @@ __ZN7WebCore12PrintContextC1EPNS_5FrameE
__ZN7WebCore12PrintContextD1Ev
__ZNK7WebCore12RenderObject16repaintRectangleERKNS_20FractionalLayoutRectEb
__ZN7WebCore12RenderObject19scrollRectToVisibleERKNS_20FractionalLayoutRectERKNS_15ScrollAlignmentES6_
-__ZN7WebCore12RenderWidget28resumeWidgetHierarchyUpdatesEv
-__ZN7WebCore12RenderWidget29suspendWidgetHierarchyUpdatesEv
__ZN7WebCore12SharedBuffer10wrapCFDataEPK8__CFData
__ZN7WebCore12SharedBuffer10wrapNSDataEP6NSData
__ZN7WebCore12SharedBuffer12createNSDataEv
@@ -638,6 +636,8 @@ __ZN7WebCore31CrossOriginPreflightResultCache5emptyEv
__ZN7WebCore31CrossOriginPreflightResultCache6sharedEv
__ZN7WebCore32plainTextToMallocAllocatedBufferEPKNS_5RangeERjbNS_20TextIteratorBehaviorE
__ZN7WebCore33stripLeadingAndTrailingHTMLSpacesERKN3WTF6StringE
+__ZN7WebCore37WidgetHierarchyUpdatesSuspensionScope11moveWidgetsEv
+__ZN7WebCore37WidgetHierarchyUpdatesSuspensionScope35s_widgetHierarchyUpdateSuspendCountE
__ZN7WebCore3macERKNS_10CredentialE
__ZN7WebCore3macERKNS_23AuthenticationChallengeE
__ZN7WebCore40restrictMinimumScaleFactorToViewportSizeERNS_18ViewportAttributesENS_7IntSizeE
@@ -852,6 +852,7 @@ __ZN7WebCore8GradientC1ERKNS_10FloatPointES3_
__ZN7WebCore8PositionC1EN3WTF10PassRefPtrINS_4NodeEEEiNS0_10AnchorTypeE
__ZN7WebCore8Settings14setJavaEnabledEb
__ZN7WebCore8Settings15setWebGLEnabledEb
+__ZN7WebCore8Settings16setImagesEnabledEb
__ZN7WebCore8Settings16setScriptEnabledEb
__ZN7WebCore8Settings16setUsesPageCacheEb
__ZN7WebCore8Settings17setPluginsEnabledEb
@@ -2191,7 +2192,6 @@ __ZN7WebCore11Geolocation12setIsAllowedEb
__ZN7WebCore11GeolocationD1Ev
__ZNK7WebCore11Geolocation5frameEv
__ZN7WebCore20provideGeolocationToEPNS_4PageEPNS_17GeolocationClientE
-__ZN7WebCore21GeolocationClientMock13setPermissionEb
__ZN7WebCore21GeolocationController13errorOccurredEPNS_16GeolocationErrorE
__ZN7WebCore21GeolocationController14supplementNameEv
__ZN7WebCore21GeolocationController15positionChangedEPNS_19GeolocationPositionE
@@ -2235,6 +2235,7 @@ __ZN7WebCore16HTMLInputElement25selectColorInColorChooserERKNS_5ColorE
__ZN7WebCore15InspectorClient31doDispatchMessageOnFrontendPageEPNS_4PageERKN3WTF6StringE
__ZN7WebCore17InspectorCounters12counterValueENS0_11CounterTypeE
__ZN7WebCore19InspectorController15profilerEnabledEv
+__ZN7WebCore19InspectorController15connectFrontendEPNS_24InspectorFrontendChannelE
__ZN7WebCore19InspectorController18disconnectFrontendEv
__ZN7WebCore19InspectorController18setProfilerEnabledEb
__ZN7WebCore19InspectorController25evaluateForTestInFrontendElRKN3WTF6StringE
@@ -2273,7 +2274,11 @@ __ZN7WebCore28InspectorFrontendClientLocal27setTimelineProfilingEnabledEb
__ZN7WebCore28InspectorFrontendClientLocal31constrainedAttachedWindowHeightEjj
__ZN7WebCore28InspectorFrontendClientLocalC2EPNS_19InspectorControllerEPNS_4PageEN3WTF10PassOwnPtrINS0_8SettingsEEE
__ZN7WebCore28InspectorFrontendClientLocalD2Ev
+__ZN7WebCore4toJSEPN3JSC9ExecStateEPNS_17JSDOMGlobalObjectEPNS_9DOMWindowE
+__ZN7WebCore9DOMWindow4openERKN3WTF6StringERKNS1_12AtomicStringES4_PS0_S8_
+__ZN7WebCore9DOMWindow5closeEPNS_22ScriptExecutionContextE
__ZNK7WebCore19InspectorController13drawHighlightERNS_15GraphicsContextE
+__ZNK7WebCore9DOMWindow8documentEv
#endif
#if ENABLE(INSPECTOR) && PLATFORM(IOS)
diff --git a/Source/WebCore/WebCore.gypi b/Source/WebCore/WebCore.gypi
index e8af673cc..311e75866 100644
--- a/Source/WebCore/WebCore.gypi
+++ b/Source/WebCore/WebCore.gypi
@@ -657,6 +657,7 @@
'dom/DocumentMarkerController.h',
'dom/DocumentOrderedMap.h',
'dom/DocumentParser.h',
+ 'dom/DocumentStyleSheetCollection.h',
'dom/DocumentTiming.h',
'dom/DocumentType.h',
'dom/Element.h',
@@ -3816,6 +3817,7 @@
'dom/DocumentMarker.cpp',
'dom/DocumentOrderedMap.cpp',
'dom/DocumentParser.cpp',
+ 'dom/DocumentStyleSheetCollection.cpp',
'dom/DocumentType.cpp',
'dom/DynamicNodeList.cpp',
'dom/DynamicNodeList.h',
@@ -6313,6 +6315,8 @@
'testing/MallocStatistics.idl',
],
'webcore_test_support_files': [
+ 'inspector/InspectorFrontendClientLocal.cpp',
+ 'inspector/InspectorFrontendClientLocal.h',
'testing/v8/WebCoreTestSupport.cpp',
'testing/v8/WebCoreTestSupport.h',
'testing/js/WebCoreTestSupport.cpp',
diff --git a/Source/WebCore/WebCore.vcproj/WebCore.vcproj b/Source/WebCore/WebCore.vcproj/WebCore.vcproj
index ce26603d8..16ab4216d 100755
--- a/Source/WebCore/WebCore.vcproj/WebCore.vcproj
+++ b/Source/WebCore/WebCore.vcproj/WebCore.vcproj
@@ -50406,6 +50406,14 @@
RelativePath="..\dom\DocumentParser.h"
>
</File>
+ <File
+ RelativePath="..\dom\DocumentStyleSheetCollection.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\dom\DocumentStyleSheetCollection.h"
+ >
+ </File>
<File
RelativePath="..\dom\DocumentTiming.h"
>
diff --git a/Source/WebCore/WebCore.xcodeproj/project.pbxproj b/Source/WebCore/WebCore.xcodeproj/project.pbxproj
index 7a25eaa88..b32c24029 100644
--- a/Source/WebCore/WebCore.xcodeproj/project.pbxproj
+++ b/Source/WebCore/WebCore.xcodeproj/project.pbxproj
@@ -76,8 +76,6 @@
033A6A7E147E07E700509B36 /* HTMLPropertiesCollection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 033A6A7D147E07E700509B36 /* HTMLPropertiesCollection.cpp */; };
033A6A81147E088600509B36 /* JSHTMLPropertiesCollection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 033A6A80147E088600509B36 /* JSHTMLPropertiesCollection.cpp */; };
033A6A83147E08A600509B36 /* JSHTMLPropertiesCollection.h in Headers */ = {isa = PBXBuildFile; fileRef = 033A6A82147E08A600509B36 /* JSHTMLPropertiesCollection.h */; };
- 052BFCE9128ABF1500FD338D /* GeolocationClientMock.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 052BFCE8128ABF1500FD338D /* GeolocationClientMock.cpp */; };
- 052BFCEB128ABF2100FD338D /* GeolocationClientMock.h in Headers */ = {isa = PBXBuildFile; fileRef = 052BFCEA128ABF2100FD338D /* GeolocationClientMock.h */; settings = {ATTRIBUTES = (Private, ); }; };
0562F9461573ECEB0031CA16 /* WebKitCSSSVGDocumentValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0562F9441573ECEB0031CA16 /* WebKitCSSSVGDocumentValue.cpp */; };
0562F9471573ECEB0031CA16 /* WebKitCSSSVGDocumentValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 0562F9451573ECEB0031CA16 /* WebKitCSSSVGDocumentValue.h */; };
0562F9611573F88F0031CA16 /* PlatformLayer.h in Headers */ = {isa = PBXBuildFile; fileRef = 0562F9601573F88F0031CA16 /* PlatformLayer.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -6141,6 +6139,8 @@
E4778B80115A581A00B5D372 /* JSCustomEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = E4778B7E115A581A00B5D372 /* JSCustomEvent.h */; };
E47B4BE80E71241600038854 /* CachedResourceHandle.h in Headers */ = {isa = PBXBuildFile; fileRef = E47B4BE60E71241600038854 /* CachedResourceHandle.h */; settings = {ATTRIBUTES = (Private, ); }; };
E47B4BE90E71241600038854 /* CachedResourceHandle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E47B4BE70E71241600038854 /* CachedResourceHandle.cpp */; };
+ E47E276516036ED200EE2AFB /* DocumentStyleSheetCollection.h in Headers */ = {isa = PBXBuildFile; fileRef = E47E276416036ED200EE2AFB /* DocumentStyleSheetCollection.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ E47E276816036EDC00EE2AFB /* DocumentStyleSheetCollection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E47E276716036EDC00EE2AFB /* DocumentStyleSheetCollection.cpp */; };
E4946EAE156E64DD00D3297F /* StyleRuleImport.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4946EAC156E64DD00D3297F /* StyleRuleImport.cpp */; };
E4946EAF156E64DD00D3297F /* StyleRuleImport.h in Headers */ = {isa = PBXBuildFile; fileRef = E4946EAD156E64DD00D3297F /* StyleRuleImport.h */; };
E49BD9FA131FD2ED003C56F0 /* CSSValuePool.h in Headers */ = {isa = PBXBuildFile; fileRef = E49BD9F9131FD2ED003C56F0 /* CSSValuePool.h */; };
@@ -7088,8 +7088,6 @@
033A6A7F147E07F900509B36 /* HTMLPropertiesCollection.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = HTMLPropertiesCollection.idl; sourceTree = "<group>"; };
033A6A80147E088600509B36 /* JSHTMLPropertiesCollection.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLPropertiesCollection.cpp; sourceTree = "<group>"; };
033A6A82147E08A600509B36 /* JSHTMLPropertiesCollection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSHTMLPropertiesCollection.h; sourceTree = "<group>"; };
- 052BFCE8128ABF1500FD338D /* GeolocationClientMock.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = GeolocationClientMock.cpp; path = mock/GeolocationClientMock.cpp; sourceTree = "<group>"; };
- 052BFCEA128ABF2100FD338D /* GeolocationClientMock.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GeolocationClientMock.h; path = mock/GeolocationClientMock.h; sourceTree = "<group>"; };
0562F9441573ECEB0031CA16 /* WebKitCSSSVGDocumentValue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebKitCSSSVGDocumentValue.cpp; sourceTree = "<group>"; };
0562F9451573ECEB0031CA16 /* WebKitCSSSVGDocumentValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebKitCSSSVGDocumentValue.h; sourceTree = "<group>"; };
0562F9601573F88F0031CA16 /* PlatformLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlatformLayer.h; sourceTree = "<group>"; };
@@ -13520,6 +13518,8 @@
E4778B7E115A581A00B5D372 /* JSCustomEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCustomEvent.h; sourceTree = "<group>"; };
E47B4BE60E71241600038854 /* CachedResourceHandle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CachedResourceHandle.h; sourceTree = "<group>"; };
E47B4BE70E71241600038854 /* CachedResourceHandle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CachedResourceHandle.cpp; sourceTree = "<group>"; };
+ E47E276416036ED200EE2AFB /* DocumentStyleSheetCollection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DocumentStyleSheetCollection.h; sourceTree = "<group>"; };
+ E47E276716036EDC00EE2AFB /* DocumentStyleSheetCollection.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DocumentStyleSheetCollection.cpp; sourceTree = "<group>"; };
E4946EAC156E64DD00D3297F /* StyleRuleImport.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StyleRuleImport.cpp; sourceTree = "<group>"; };
E4946EAD156E64DD00D3297F /* StyleRuleImport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StyleRuleImport.h; sourceTree = "<group>"; };
E49BD9F9131FD2ED003C56F0 /* CSSValuePool.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSSValuePool.h; sourceTree = "<group>"; };
@@ -15461,8 +15461,6 @@
children = (
59309A1011F4AE5800250603 /* DeviceOrientationClientMock.cpp */,
59309A1211F4AE6A00250603 /* DeviceOrientationClientMock.h */,
- 052BFCE8128ABF1500FD338D /* GeolocationClientMock.cpp */,
- 052BFCEA128ABF2100FD338D /* GeolocationClientMock.h */,
0FE71403142170B800DB33BA /* ScrollbarThemeMock.cpp */,
0FE71404142170B800DB33BA /* ScrollbarThemeMock.h */,
);
@@ -21671,6 +21669,8 @@
14947FFC12F80CD200A0F631 /* DocumentOrderedMap.h */,
A8C2280D11D4A59700D5A7D3 /* DocumentParser.cpp */,
BCCFBAE70B5152ED0001F1D7 /* DocumentParser.h */,
+ E47E276716036EDC00EE2AFB /* DocumentStyleSheetCollection.cpp */,
+ E47E276416036ED200EE2AFB /* DocumentStyleSheetCollection.h */,
86D982F6125C154000AD9E3D /* DocumentTiming.h */,
A8185F3209765765005826D9 /* DocumentType.cpp */,
A8185F3109765765005826D9 /* DocumentType.h */,
@@ -22275,6 +22275,7 @@
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
+ E47E276516036ED200EE2AFB /* DocumentStyleSheetCollection.h in Headers */,
97BC69DB1505F076001B74AC /* AbstractDatabase.h in Headers */,
41E1B1D10FF5986900576B3B /* AbstractWorker.h in Headers */,
29A8122E0FBB9C1D00510293 /* AccessibilityARIAGridCell.h in Headers */,
@@ -23521,7 +23522,6 @@
0720B0A114D3323500642955 /* GenericEventQueue.h in Headers */,
9746AF2414F4DDE6003E7A70 /* Geolocation.h in Headers */,
BC56CB2310D5AC8000A77C64 /* GeolocationClient.h in Headers */,
- 052BFCEB128ABF2100FD338D /* GeolocationClientMock.h in Headers */,
9746AF2714F4DDE6003E7A70 /* GeolocationController.h in Headers */,
9746AF2814F4DDE6003E7A70 /* GeolocationError.h in Headers */,
9746AF2914F4DDE6003E7A70 /* GeolocationPosition.h in Headers */,
@@ -26753,7 +26753,6 @@
2D481F03146B5C6500AA7834 /* GeneratorGeneratedImage.cpp in Sources */,
0720B0A014D3323500642955 /* GenericEventQueue.cpp in Sources */,
9746AF2314F4DDE6003E7A70 /* Geolocation.cpp in Sources */,
- 052BFCE9128ABF1500FD338D /* GeolocationClientMock.cpp in Sources */,
9746AF2614F4DDE6003E7A70 /* GeolocationController.cpp in Sources */,
0720B0A014D3323500642956 /* GestureEvent.cpp in Sources */,
B2C3DA6D0D006CD600EF6F26 /* GlyphPageTreeNode.cpp in Sources */,
@@ -28668,6 +28667,7 @@
E1BE512D0CF6C512002EA959 /* XSLTUnicodeSort.cpp in Sources */,
977E2E0E12F0FC9C00C13379 /* XSSAuditor.cpp in Sources */,
FD537352137B651800008DCE /* ZeroPole.cpp in Sources */,
+ E47E276816036EDC00EE2AFB /* DocumentStyleSheetCollection.cpp in Sources */,
4F1D11BF15FF37200026E908 /* PlatformMemoryInstrumentation.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
diff --git a/Source/WebCore/bindings/generic/RuntimeEnabledFeatures.h b/Source/WebCore/bindings/generic/RuntimeEnabledFeatures.h
index fa5945843..33a7e6fe5 100644
--- a/Source/WebCore/bindings/generic/RuntimeEnabledFeatures.h
+++ b/Source/WebCore/bindings/generic/RuntimeEnabledFeatures.h
@@ -61,16 +61,7 @@ public:
static void setWebkitIndexedDBEnabled(bool isEnabled) { isIndexedDBEnabled = isEnabled; }
static bool webkitIndexedDBEnabled() { return isIndexedDBEnabled; }
- static bool webkitIDBCursorEnabled() { return isIndexedDBEnabled; }
- static bool webkitIDBDatabaseEnabled() { return isIndexedDBEnabled; }
- static bool webkitIDBDatabaseErrorEnabled() { return isIndexedDBEnabled; }
- static bool webkitIDBDatabaseExceptionEnabled() { return isIndexedDBEnabled; }
- static bool webkitIDBFactoryEnabled() { return isIndexedDBEnabled; }
- static bool webkitIDBIndexEnabled() { return isIndexedDBEnabled; }
- static bool webkitIDBKeyRangeEnabled() { return isIndexedDBEnabled; }
- static bool webkitIDBObjectStoreEnabled() { return isIndexedDBEnabled; }
- static bool webkitIDBRequestEnabled() { return isIndexedDBEnabled; }
- static bool webkitIDBTransactionEnabled() { return isIndexedDBEnabled; }
+ static bool indexedDBEnabled() { return isIndexedDBEnabled; }
#if ENABLE(CSS_EXCLUSIONS)
static void setCSSExclusionsEnabled(bool isEnabled) { isCSSExclusionsEnabled = isEnabled; }
diff --git a/Source/WebCore/bindings/js/JSDOMWindowShell.h b/Source/WebCore/bindings/js/JSDOMWindowShell.h
index 9fe38ea41..fccc703e1 100644
--- a/Source/WebCore/bindings/js/JSDOMWindowShell.h
+++ b/Source/WebCore/bindings/js/JSDOMWindowShell.h
@@ -48,6 +48,7 @@ namespace WebCore {
{
ASSERT_ARG(window, window);
setUnwrappedObject(globalData, window);
+ structure()->setGlobalObject(*JSDOMWindow::commonJSGlobalData(), window);
}
void setWindow(PassRefPtr<DOMWindow>);
diff --git a/Source/WebCore/bindings/js/JSHTMLCanvasElementCustom.cpp b/Source/WebCore/bindings/js/JSHTMLCanvasElementCustom.cpp
index 556bdf75f..72bf386a0 100644
--- a/Source/WebCore/bindings/js/JSHTMLCanvasElementCustom.cpp
+++ b/Source/WebCore/bindings/js/JSHTMLCanvasElementCustom.cpp
@@ -29,11 +29,11 @@
#include "CanvasContextAttributes.h"
#include "HTMLCanvasElement.h"
+#include "InspectorCanvasInstrumentation.h"
#include "JSCanvasRenderingContext2D.h"
+#include "ScriptObject.h"
#if ENABLE(WEBGL)
-#include "InspectorCanvasInstrumentation.h"
#include "JSWebGLRenderingContext.h"
-#include "ScriptObject.h"
#include "WebGLContextAttributes.h"
#endif
#include <wtf/GetPtr.h>
@@ -78,14 +78,18 @@ JSValue JSHTMLCanvasElement::getContext(ExecState* exec)
if (!context)
return jsNull();
JSValue jsValue = toJS(exec, globalObject(), WTF::getPtr(context));
+ if (InspectorInstrumentation::hasFrontends()) {
+ ScriptObject contextObject(exec, jsValue.getObject());
+ ScriptObject wrapped;
+ if (context->is2d())
+ wrapped = InspectorInstrumentation::wrapCanvas2DRenderingContextForInstrumentation(canvas->document(), contextObject);
#if ENABLE(WEBGL)
- if (context->is3d() && InspectorInstrumentation::hasFrontends()) {
- ScriptObject glContext(exec, jsValue.getObject());
- ScriptObject wrapped = InspectorInstrumentation::wrapWebGLRenderingContextForInstrumentation(canvas->document(), glContext);
+ else if (context->is3d())
+ wrapped = InspectorInstrumentation::wrapWebGLRenderingContextForInstrumentation(canvas->document(), contextObject);
+#endif
if (!wrapped.hasNoValue())
return wrapped.jsValue();
}
-#endif
return jsValue;
}
diff --git a/Source/WebCore/bindings/js/JSInjectedScriptManager.cpp b/Source/WebCore/bindings/js/JSInjectedScriptManager.cpp
index dc502fc8d..9f9109849 100644
--- a/Source/WebCore/bindings/js/JSInjectedScriptManager.cpp
+++ b/Source/WebCore/bindings/js/JSInjectedScriptManager.cpp
@@ -59,7 +59,13 @@ ScriptObject InjectedScriptManager::createInjectedScript(const String& source, S
JSValue globalThisValue = scriptState->globalThisValue();
JSValue evaluationException;
- JSValue evaluationReturnValue = JSMainThreadExecState::evaluate(scriptState, sourceCode, globalThisValue, &evaluationException);
+ JSValue evaluationReturnValue;
+ if (isMainThread())
+ evaluationReturnValue = JSMainThreadExecState::evaluate(scriptState, sourceCode, globalThisValue, &evaluationException);
+ else {
+ JSC::JSLockHolder lock(scriptState);
+ evaluationReturnValue = JSC::evaluate(scriptState, sourceCode, globalThisValue, &evaluationException);
+ }
if (evaluationException)
return ScriptObject();
diff --git a/Source/WebCore/bindings/js/ScriptFunctionCall.cpp b/Source/WebCore/bindings/js/ScriptFunctionCall.cpp
index e52842e0b..be91d5cdc 100644
--- a/Source/WebCore/bindings/js/ScriptFunctionCall.cpp
+++ b/Source/WebCore/bindings/js/ScriptFunctionCall.cpp
@@ -135,7 +135,12 @@ ScriptValue ScriptFunctionCall::call(bool& hadException, bool reportExceptions)
if (callType == CallTypeNone)
return ScriptValue();
- JSValue result = JSMainThreadExecState::call(m_exec, function, callType, callData, thisObject, m_arguments);
+ JSValue result;
+ if (isMainThread())
+ result = JSMainThreadExecState::call(m_exec, function, callType, callData, thisObject, m_arguments);
+ else
+ result = JSC::call(m_exec, function, callType, callData, thisObject, m_arguments);
+
if (m_exec->hadException()) {
if (reportExceptions)
reportException(m_exec, m_exec->exception());
diff --git a/Source/WebCore/bindings/js/SerializedScriptValue.cpp b/Source/WebCore/bindings/js/SerializedScriptValue.cpp
index 6ae5e3803..02f8cff66 100644
--- a/Source/WebCore/bindings/js/SerializedScriptValue.cpp
+++ b/Source/WebCore/bindings/js/SerializedScriptValue.cpp
@@ -1320,7 +1320,7 @@ private:
void putProperty(JSObject* object, const Identifier& property, JSValue value)
{
- object->putDirect(m_exec->globalData(), property, value);
+ object->putDirectMayBeIndex(m_exec, property, value);
}
bool readFile(RefPtr<File>& file)
diff --git a/Source/WebCore/bindings/scripts/CodeGeneratorGObject.pm b/Source/WebCore/bindings/scripts/CodeGeneratorGObject.pm
index c84087b19..5d8af4a0e 100644
--- a/Source/WebCore/bindings/scripts/CodeGeneratorGObject.pm
+++ b/Source/WebCore/bindings/scripts/CodeGeneratorGObject.pm
@@ -203,7 +203,7 @@ sub SkipAttribute {
}
# Skip indexed database attributes for now, they aren't yet supported for the GObject generator.
- if ($attribute->signature->name =~ /^webkitIndexedDB/ or $attribute->signature->name =~ /^webkitIDB/) {
+ if ($attribute->signature->name =~ /^(?:webkit)?[Ii]ndexedDB/ or $attribute->signature->name =~ /^(?:webkit)?IDB/) {
return 1;
}
diff --git a/Source/WebCore/bindings/v8/V8PerIsolateData.cpp b/Source/WebCore/bindings/v8/V8PerIsolateData.cpp
index e1bc31e5c..4e1e0a1f5 100644
--- a/Source/WebCore/bindings/v8/V8PerIsolateData.cpp
+++ b/Source/WebCore/bindings/v8/V8PerIsolateData.cpp
@@ -28,6 +28,7 @@
#include "ScriptGCEvent.h"
#include "V8Binding.h"
+#include <wtf/MemoryInstrumentationVector.h>
namespace WebCore {
@@ -87,7 +88,7 @@ void V8PerIsolateData::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) con
info.addHashMap(m_rawTemplates);
info.addHashMap(m_templates);
info.addMember(m_stringCache);
- info.addVector(m_domDataList);
+ info.addMember(m_domDataList);
for (size_t i = 0; i < m_domDataList.size(); i++)
info.addMember(m_domDataList[i]);
diff --git a/Source/WebCore/bindings/v8/custom/V8ArrayBufferViewCustom.h b/Source/WebCore/bindings/v8/custom/V8ArrayBufferViewCustom.h
index 1ce2bebd1..615584438 100644
--- a/Source/WebCore/bindings/v8/custom/V8ArrayBufferViewCustom.h
+++ b/Source/WebCore/bindings/v8/custom/V8ArrayBufferViewCustom.h
@@ -52,6 +52,7 @@ v8::Handle<v8::Value> wrapArrayBufferView(const v8::Arguments& args, WrapperType
{
// Transform the holder into a wrapper object for the array.
V8DOMWrapper::setDOMWrapper(args.Holder(), type, array.get());
+ ASSERT(!hasIndexer || static_cast<int32_t>(array.get()->length()) >= 0);
if (hasIndexer)
args.Holder()->SetIndexedPropertiesToExternalArrayData(array.get()->baseAddress(), arrayType, array.get()->length());
v8::Handle<v8::Object> wrapper = args.Holder();
@@ -85,6 +86,10 @@ v8::Handle<v8::Value> constructWebGLArrayWithArrayBufferArgument(const v8::Argum
return throwError(RangeError, "ArrayBuffer length minus the byteOffset is not a multiple of the element size.", args.GetIsolate());
length = (buf->byteLength() - offset) / sizeof(ElementType);
}
+
+ if (static_cast<int32_t>(length) < 0)
+ return throwError(RangeError, tooLargeSize, args.GetIsolate());
+
RefPtr<ArrayClass> array = ArrayClass::create(buf, offset, length);
if (!array)
return throwError(RangeError, tooLargeSize, args.GetIsolate());
@@ -143,6 +148,10 @@ v8::Handle<v8::Value> constructWebGLArray(const v8::Arguments& args, WrapperType
if (JavaScriptWrapperArrayType::HasInstance(args[0])) {
ArrayClass* source = JavaScriptWrapperArrayType::toNative(args[0]->ToObject());
uint32_t length = source->length();
+
+ if (static_cast<int32_t>(length) < 0)
+ return throwError(RangeError, tooLargeSize, args.GetIsolate());
+
RefPtr<ArrayClass> array = ArrayClass::createUninitialized(length);
if (!array.get())
return throwError(RangeError, tooLargeSize, args.GetIsolate());
@@ -174,6 +183,9 @@ v8::Handle<v8::Value> constructWebGLArray(const v8::Arguments& args, WrapperType
}
}
+ if (static_cast<int32_t>(len) < 0)
+ return throwError(RangeError, tooLargeSize, args.GetIsolate());
+
RefPtr<ArrayClass> array;
if (doInstantiation) {
if (srcArray.IsEmpty())
diff --git a/Source/WebCore/bindings/v8/custom/V8HTMLCanvasElementCustom.cpp b/Source/WebCore/bindings/v8/custom/V8HTMLCanvasElementCustom.cpp
index 0b157279c..a6fb22a44 100644
--- a/Source/WebCore/bindings/v8/custom/V8HTMLCanvasElementCustom.cpp
+++ b/Source/WebCore/bindings/v8/custom/V8HTMLCanvasElementCustom.cpp
@@ -35,12 +35,12 @@
#include "CanvasContextAttributes.h"
#include "CanvasRenderingContext.h"
#include "HTMLCanvasElement.h"
+#include "InspectorCanvasInstrumentation.h"
#include "WebGLContextAttributes.h"
#include "V8Binding.h"
#include "V8CanvasRenderingContext2D.h"
#include "V8Node.h"
#if ENABLE(WEBGL)
-#include "InspectorCanvasInstrumentation.h"
#include "V8WebGLRenderingContext.h"
#endif
#include <wtf/MathExtras.h>
@@ -85,9 +85,17 @@ v8::Handle<v8::Value> V8HTMLCanvasElement::getContextCallback(const v8::Argument
CanvasRenderingContext* result = imp->getContext(contextId, attrs.get());
if (!result)
return v8::Null(args.GetIsolate());
-
- if (result->is2d())
- return toV8(static_cast<CanvasRenderingContext2D*>(result), args.Holder(), args.GetIsolate());
+ else if (result->is2d()) {
+ v8::Handle<v8::Value> v8Result = toV8(static_cast<CanvasRenderingContext2D*>(result), args.Holder(), args.GetIsolate());
+ if (InspectorInstrumentation::hasFrontends()) {
+ ScriptState* scriptState = ScriptState::forContext(v8::Context::GetCurrent());
+ ScriptObject context(scriptState, v8::Handle<v8::Object>::Cast(v8Result));
+ ScriptObject wrapped = InspectorInstrumentation::wrapCanvas2DRenderingContextForInstrumentation(imp->document(), context);
+ if (!wrapped.hasNoValue())
+ return wrapped.v8Value();
+ }
+ return v8Result;
+ }
#if ENABLE(WEBGL)
else if (result->is3d()) {
// 3D canvas contexts can hold on to lots of GPU resources, and we want to take an
diff --git a/Source/WebCore/css/CSSGradientValue.cpp b/Source/WebCore/css/CSSGradientValue.cpp
index f9715f27f..d00c1308e 100644
--- a/Source/WebCore/css/CSSGradientValue.cpp
+++ b/Source/WebCore/css/CSSGradientValue.cpp
@@ -37,6 +37,7 @@
#include "RenderObject.h"
#include "StyleResolver.h"
#include "WebCoreMemoryInstrumentation.h"
+#include <wtf/MemoryInstrumentationVector.h>
#include <wtf/text/StringBuilder.h>
#include <wtf/text/WTFString.h>
@@ -469,7 +470,7 @@ void CSSGradientValue::reportBaseClassMemoryUsage(MemoryObjectInfo* memoryObject
info.addMember(m_firstY);
info.addMember(m_secondX);
info.addMember(m_secondY);
- info.addInstrumentedVector(m_stops);
+ info.addMember(m_stops);
}
String CSSLinearGradientValue::customCssText() const
diff --git a/Source/WebCore/css/CSSImageSetValue.cpp b/Source/WebCore/css/CSSImageSetValue.cpp
index 5e6bee5a6..6e02a20f9 100644
--- a/Source/WebCore/css/CSSImageSetValue.cpp
+++ b/Source/WebCore/css/CSSImageSetValue.cpp
@@ -37,6 +37,7 @@
#include "StyleCachedImageSet.h"
#include "StylePendingImage.h"
#include "WebCoreMemoryInstrumentation.h"
+#include <wtf/MemoryInstrumentationVector.h>
namespace WebCore {
@@ -168,7 +169,7 @@ void CSSImageSetValue::reportDescendantMemoryUsage(MemoryObjectInfo* memoryObjec
{
MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS);
CSSValueList::reportDescendantMemoryUsage(memoryObjectInfo);
- info.addInstrumentedVector(m_imagesInSet);
+ info.addMember(m_imagesInSet);
}
void CSSImageSetValue::ImageWithScale::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
diff --git a/Source/WebCore/css/CSSMediaRule.cpp b/Source/WebCore/css/CSSMediaRule.cpp
index f0e9c79c3..8c2c973c2 100644
--- a/Source/WebCore/css/CSSMediaRule.cpp
+++ b/Source/WebCore/css/CSSMediaRule.cpp
@@ -29,6 +29,7 @@
#include "ExceptionCode.h"
#include "StyleRule.h"
#include "WebCoreMemoryInstrumentation.h"
+#include <wtf/MemoryInstrumentationVector.h>
#include <wtf/text/StringBuilder.h>
namespace WebCore {
@@ -180,7 +181,7 @@ void CSSMediaRule::reportDescendantMemoryUsage(MemoryObjectInfo* memoryObjectInf
MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS);
CSSRule::reportBaseClassMemoryUsage(memoryObjectInfo);
info.addMember(m_mediaCSSOMWrapper);
- info.addInstrumentedVector(m_childRuleCSSOMWrappers);
+ info.addMember(m_childRuleCSSOMWrappers);
info.addMember(m_ruleListCSSOMWrapper);
}
diff --git a/Source/WebCore/css/CSSParser.cpp b/Source/WebCore/css/CSSParser.cpp
index efd9bae3a..9a922f191 100644
--- a/Source/WebCore/css/CSSParser.cpp
+++ b/Source/WebCore/css/CSSParser.cpp
@@ -5994,7 +5994,7 @@ bool CSSParser::parseFlex(CSSParserValueList* args, bool important)
}
if (flexGrow == unsetValue)
- flexGrow = 0;
+ flexGrow = 1;
if (flexShrink == unsetValue)
flexShrink = 1;
if (!flexBasis)
diff --git a/Source/WebCore/css/CSSParserValues.h b/Source/WebCore/css/CSSParserValues.h
index ad11198be..83aa77c33 100644
--- a/Source/WebCore/css/CSSParserValues.h
+++ b/Source/WebCore/css/CSSParserValues.h
@@ -46,7 +46,7 @@ struct CSSParserString {
m_is8Bit = false;
}
- void init(String string)
+ void init(const String& string)
{
m_length = string.length();
if (m_length && string.is8Bit()) {
diff --git a/Source/WebCore/css/CSSRule.cpp b/Source/WebCore/css/CSSRule.cpp
index b61f3fe65..cd533d9a8 100644
--- a/Source/WebCore/css/CSSRule.cpp
+++ b/Source/WebCore/css/CSSRule.cpp
@@ -40,11 +40,7 @@
namespace WebCore {
struct SameSizeAsCSSRule : public RefCounted<SameSizeAsCSSRule> {
-#if USE(JSC)
- char bitfields;
-#else
- unsigned bitfields;
-#endif
+ unsigned char bitfields;
void* pointerUnion;
};
diff --git a/Source/WebCore/css/CSSRule.h b/Source/WebCore/css/CSSRule.h
index c3bfcab01..b31fe7b8d 100644
--- a/Source/WebCore/css/CSSRule.h
+++ b/Source/WebCore/css/CSSRule.h
@@ -127,9 +127,9 @@ protected:
void reportBaseClassMemoryUsage(MemoryObjectInfo*) const;
private:
- mutable unsigned m_hasCachedSelectorText : 1;
- unsigned m_parentIsRule : 1;
- unsigned m_type : 5;
+ mutable unsigned char m_hasCachedSelectorText : 1;
+ unsigned char m_parentIsRule : 1;
+ unsigned char m_type : 5;
union {
CSSRule* m_parentRule;
CSSStyleSheet* m_parentStyleSheet;
diff --git a/Source/WebCore/css/CSSRuleList.cpp b/Source/WebCore/css/CSSRuleList.cpp
index 472b3dd60..dadc93b15 100644
--- a/Source/WebCore/css/CSSRuleList.cpp
+++ b/Source/WebCore/css/CSSRuleList.cpp
@@ -24,6 +24,7 @@
#include "CSSRule.h"
#include "CSSStyleSheet.h"
+#include <wtf/MemoryInstrumentationVector.h>
namespace WebCore {
@@ -54,7 +55,7 @@ void StaticCSSRuleList::deref()
void StaticCSSRuleList::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
{
MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS);
- info.addInstrumentedVector(m_rules);
+ info.addMember(m_rules);
}
} // namespace WebCore
diff --git a/Source/WebCore/css/CSSSelector.cpp b/Source/WebCore/css/CSSSelector.cpp
index 5c26256a8..62233e6d4 100644
--- a/Source/WebCore/css/CSSSelector.cpp
+++ b/Source/WebCore/css/CSSSelector.cpp
@@ -183,7 +183,6 @@ PseudoId CSSSelector::pseudoId(PseudoType type)
case PseudoValid:
case PseudoInvalid:
case PseudoIndeterminate:
- case PseudoScope:
case PseudoTarget:
case PseudoLang:
case PseudoNot:
@@ -265,7 +264,6 @@ static HashMap<AtomicStringImpl*, CSSSelector::PseudoType>* nameToPseudoTypeMap(
DEFINE_STATIC_LOCAL(AtomicString, scrollbarTrack, ("-webkit-scrollbar-track", AtomicString::ConstructFromLiteral));
DEFINE_STATIC_LOCAL(AtomicString, scrollbarTrackPiece, ("-webkit-scrollbar-track-piece", AtomicString::ConstructFromLiteral));
DEFINE_STATIC_LOCAL(AtomicString, selection, ("selection", AtomicString::ConstructFromLiteral));
- DEFINE_STATIC_LOCAL(AtomicString, scope, ("scope", AtomicString::ConstructFromLiteral));
DEFINE_STATIC_LOCAL(AtomicString, target, ("target", AtomicString::ConstructFromLiteral));
DEFINE_STATIC_LOCAL(AtomicString, visited, ("visited", AtomicString::ConstructFromLiteral));
DEFINE_STATIC_LOCAL(AtomicString, windowInactive, ("window-inactive", AtomicString::ConstructFromLiteral));
@@ -353,7 +351,6 @@ static HashMap<AtomicStringImpl*, CSSSelector::PseudoType>* nameToPseudoTypeMap(
nameToPseudoType->set(scrollbarTrackPiece.impl(), CSSSelector::PseudoScrollbarTrackPiece);
nameToPseudoType->set(cornerPresent.impl(), CSSSelector::PseudoCornerPresent);
nameToPseudoType->set(selection.impl(), CSSSelector::PseudoSelection);
- nameToPseudoType->set(scope.impl(), CSSSelector::PseudoScope);
nameToPseudoType->set(target.impl(), CSSSelector::PseudoTarget);
nameToPseudoType->set(visited.impl(), CSSSelector::PseudoVisited);
nameToPseudoType->set(firstPage.impl(), CSSSelector::PseudoFirstPage);
@@ -445,7 +442,6 @@ void CSSSelector::extractPseudoType() const
case PseudoValid:
case PseudoInvalid:
case PseudoIndeterminate:
- case PseudoScope:
case PseudoTarget:
case PseudoLang:
case PseudoNot:
diff --git a/Source/WebCore/css/CSSSelector.h b/Source/WebCore/css/CSSSelector.h
index 2e9e5908f..5ca24f4e0 100644
--- a/Source/WebCore/css/CSSSelector.h
+++ b/Source/WebCore/css/CSSSelector.h
@@ -116,7 +116,6 @@ namespace WebCore {
PseudoValid,
PseudoInvalid,
PseudoIndeterminate,
- PseudoScope,
PseudoTarget,
PseudoBefore,
PseudoAfter,
diff --git a/Source/WebCore/css/CSSStyleSheet.cpp b/Source/WebCore/css/CSSStyleSheet.cpp
index 0e10202c7..dcfc22006 100644
--- a/Source/WebCore/css/CSSStyleSheet.cpp
+++ b/Source/WebCore/css/CSSStyleSheet.cpp
@@ -38,6 +38,7 @@
#include "StyleRule.h"
#include "StyleSheetContents.h"
#include "WebCoreMemoryInstrumentation.h"
+#include <wtf/MemoryInstrumentationVector.h>
#include <wtf/text/StringBuilder.h>
namespace WebCore {
@@ -187,7 +188,7 @@ void CSSStyleSheet::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
info.addMember(m_ownerNode);
info.addMember(m_ownerRule);
info.addMember(m_mediaCSSOMWrapper);
- info.addInstrumentedVector(m_childRuleCSSOMWrappers);
+ info.addMember(m_childRuleCSSOMWrappers);
}
void CSSStyleSheet::setDisabled(bool disabled)
diff --git a/Source/WebCore/css/CSSValueList.cpp b/Source/WebCore/css/CSSValueList.cpp
index 21e4fa703..9ec2d5085 100644
--- a/Source/WebCore/css/CSSValueList.cpp
+++ b/Source/WebCore/css/CSSValueList.cpp
@@ -23,6 +23,7 @@
#include "CSSParserValues.h"
#include "WebCoreMemoryInstrumentation.h"
+#include <wtf/MemoryInstrumentationVector.h>
#include <wtf/PassOwnPtr.h>
#include <wtf/text/StringBuilder.h>
@@ -189,7 +190,7 @@ PassRefPtr<CSSValueList> CSSValueList::cloneForCSSOM() const
void CSSValueList::reportDescendantMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
{
MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS);
- info.addInstrumentedVector(m_values);
+ info.addMember(m_values);
}
} // namespace WebCore
diff --git a/Source/WebCore/css/MediaList.cpp b/Source/WebCore/css/MediaList.cpp
index 62903d6b1..bdbc57174 100644
--- a/Source/WebCore/css/MediaList.cpp
+++ b/Source/WebCore/css/MediaList.cpp
@@ -27,6 +27,7 @@
#include "MediaQuery.h"
#include "MediaQueryExp.h"
#include "WebCoreMemoryInstrumentation.h"
+#include <wtf/MemoryInstrumentationVector.h>
#include <wtf/text/StringBuilder.h>
namespace WebCore {
@@ -215,7 +216,7 @@ String MediaQuerySet::mediaText() const
void MediaQuerySet::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
{
MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS);
- info.addInstrumentedVector(m_queries);
+ info.addMember(m_queries);
}
MediaList::MediaList(MediaQuerySet* mediaQueries, CSSStyleSheet* parentSheet)
diff --git a/Source/WebCore/css/MediaQuery.cpp b/Source/WebCore/css/MediaQuery.cpp
index a3f25d712..fc4551ffb 100644
--- a/Source/WebCore/css/MediaQuery.cpp
+++ b/Source/WebCore/css/MediaQuery.cpp
@@ -31,6 +31,7 @@
#include "MediaQueryExp.h"
#include "WebCoreMemoryInstrumentation.h"
+#include <wtf/MemoryInstrumentationVector.h>
#include <wtf/NonCopyingSort.h>
#include <wtf/text/StringBuilder.h>
@@ -138,7 +139,7 @@ void MediaQuery::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
{
MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS);
info.addMember(m_mediaType);
- info.addInstrumentedVectorPtr(m_expressions);
+ info.addMember(m_expressions);
info.addMember(m_serializationCache);
}
diff --git a/Source/WebCore/css/SelectorChecker.cpp b/Source/WebCore/css/SelectorChecker.cpp
index 133e2a8aa..aae47e2cf 100644
--- a/Source/WebCore/css/SelectorChecker.cpp
+++ b/Source/WebCore/css/SelectorChecker.cpp
@@ -31,6 +31,7 @@
#include "CSSSelector.h"
#include "CSSSelectorList.h"
#include "Document.h"
+#include "DocumentStyleSheetCollection.h"
#include "FocusController.h"
#include "Frame.h"
#include "FrameSelection.h"
@@ -783,7 +784,7 @@ bool SelectorChecker::checkOneSelector(const SelectorCheckingContext& context, P
if (m_mode == ResolvingStyle) {
if (context.elementStyle)
context.elementStyle->setEmptyState(result);
- else if (element->renderStyle() && (element->document()->usesSiblingRules() || element->renderStyle()->unique()))
+ else if (element->renderStyle() && (element->document()->styleSheetCollection()->usesSiblingRules() || element->renderStyle()->unique()))
element->renderStyle()->setEmptyState(result);
}
return result;
@@ -1115,10 +1116,6 @@ bool SelectorChecker::checkOneSelector(const SelectorCheckingContext& context, P
return true;
break;
}
- case CSSSelector::PseudoScope:
- if (context.scope)
- return element == context.scope;
- // If there is no scope, :scope should behave as :root -> fall through
case CSSSelector::PseudoRoot:
if (element == element->document()->documentElement())
return true;
@@ -1187,7 +1184,7 @@ bool SelectorChecker::checkOneSelector(const SelectorCheckingContext& context, P
PseudoId pseudoId = CSSSelector::pseudoId(selector->pseudoType());
if (pseudoId == FIRST_LETTER) {
if (Document* document = element->document())
- document->setUsesFirstLetterRules(true);
+ document->styleSheetCollection()->setUsesFirstLetterRules(true);
}
if (pseudoId != NOPSEUDO)
dynamicPseudo = pseudoId;
diff --git a/Source/WebCore/css/StylePropertySet.cpp b/Source/WebCore/css/StylePropertySet.cpp
index 6e3c0fde9..52e4a24d7 100644
--- a/Source/WebCore/css/StylePropertySet.cpp
+++ b/Source/WebCore/css/StylePropertySet.cpp
@@ -19,8 +19,6 @@
* Boston, MA 02110-1301, USA.
*/
-#define WTF_DEPRECATED_STRING_OPERATORS
-
#include "config.h"
#include "StylePropertySet.h"
@@ -33,6 +31,7 @@
#include "StylePropertyShorthand.h"
#include "StyleSheetContents.h"
#include <wtf/BitArray.h>
+#include <wtf/MemoryInstrumentationVector.h>
#include <wtf/text/StringBuilder.h>
#ifndef NDEBUG
@@ -1123,7 +1122,7 @@ void StylePropertySet::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) con
size_t actualSize = m_isMutable ? sizeof(StylePropertySet) : immutableStylePropertySetSize(m_arraySize);
MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS, actualSize);
if (m_isMutable)
- info.addVectorPtr(m_mutablePropertyVector);
+ info.addMember(m_mutablePropertyVector);
unsigned count = propertyCount();
for (unsigned i = 0; i < count; ++i)
diff --git a/Source/WebCore/css/StyleResolver.cpp b/Source/WebCore/css/StyleResolver.cpp
index ec0c39c49..6ae35acf8 100644
--- a/Source/WebCore/css/StyleResolver.cpp
+++ b/Source/WebCore/css/StyleResolver.cpp
@@ -60,6 +60,7 @@
#include "Counter.h"
#include "CounterContent.h"
#include "CursorList.h"
+#include "DocumentStyleSheetCollection.h"
#include "FontFeatureValue.h"
#include "FontValue.h"
#include "Frame.h"
@@ -125,6 +126,7 @@
#include "WebKitCSSTransformValue.h"
#include "WebKitFontFamilyNames.h"
#include "XMLNames.h"
+#include <wtf/MemoryInstrumentationVector.h>
#include <wtf/StdLibExtras.h>
#include <wtf/Vector.h>
@@ -428,12 +430,13 @@ StyleResolver::StyleResolver(Document* document, bool matchAuthorAndUserStyles)
// Note that there usually is only 1 sheet for scoped rules, so auto-shrink-to-fit is fine.
m_authorStyle->disableAutoShrinkToFit();
+ DocumentStyleSheetCollection* styleSheetCollection = document->styleSheetCollection();
// FIXME: This sucks! The user sheet is reparsed every time!
OwnPtr<RuleSet> tempUserStyle = RuleSet::create();
- if (CSSStyleSheet* pageUserSheet = document->pageUserSheet())
+ if (CSSStyleSheet* pageUserSheet = styleSheetCollection->pageUserSheet())
tempUserStyle->addRulesFromSheet(pageUserSheet->contents(), *m_medium, this);
- addAuthorRulesAndCollectUserRulesFromSheets(document->pageGroupUserSheets(), *tempUserStyle);
- addAuthorRulesAndCollectUserRulesFromSheets(document->documentUserSheets(), *tempUserStyle);
+ addAuthorRulesAndCollectUserRulesFromSheets(styleSheetCollection->pageGroupUserSheets(), *tempUserStyle);
+ addAuthorRulesAndCollectUserRulesFromSheets(styleSheetCollection->documentUserSheets(), *tempUserStyle);
if (tempUserStyle->m_ruleCount > 0 || tempUserStyle->m_pageRules.size() > 0)
m_userStyle = tempUserStyle.release();
@@ -447,7 +450,7 @@ StyleResolver::StyleResolver(Document* document, bool matchAuthorAndUserStyles)
#endif
addStylesheetsFromSeamlessParents();
- appendAuthorStylesheets(0, document->styleSheets()->vector());
+ appendAuthorStylesheets(0, styleSheetCollection->authorStyleSheets());
}
void StyleResolver::addStylesheetsFromSeamlessParents()
@@ -455,14 +458,14 @@ void StyleResolver::addStylesheetsFromSeamlessParents()
// Build a list of stylesheet lists from our ancestors, and walk that
// list in reverse order so that the root-most sheets are appended first.
Document* childDocument = document();
- Vector<StyleSheetList*> ancestorSheets;
+ Vector<const Vector<RefPtr<StyleSheet> >* > ancestorSheets;
while (HTMLIFrameElement* parentIFrame = childDocument->seamlessParentIFrame()) {
Document* parentDocument = parentIFrame->document();
- ancestorSheets.append(parentDocument->styleSheets());
+ ancestorSheets.append(&parentDocument->styleSheetCollection()->authorStyleSheets());
childDocument = parentDocument;
}
for (int i = ancestorSheets.size() - 1; i >= 0; i--)
- appendAuthorStylesheets(0, ancestorSheets.at(i)->vector());
+ appendAuthorStylesheets(0, *ancestorSheets[i]);
}
void StyleResolver::addAuthorRulesAndCollectUserRulesFromSheets(const Vector<RefPtr<CSSStyleSheet> >* userSheets, RuleSet& userStyle)
@@ -708,7 +711,6 @@ void StyleResolver::sweepMatchedPropertiesCache()
StyleResolver::Features::Features()
: usesFirstLineRules(false)
, usesBeforeAfterRules(false)
- , usesLinkRules(false)
{
}
@@ -728,7 +730,6 @@ void StyleResolver::Features::add(const StyleResolver::Features& other)
uncommonAttributeRules.append(other.uncommonAttributeRules);
usesFirstLineRules = usesFirstLineRules || other.usesFirstLineRules;
usesBeforeAfterRules = usesBeforeAfterRules || other.usesBeforeAfterRules;
- usesLinkRules = usesLinkRules || other.usesLinkRules;
}
void StyleResolver::Features::clear()
@@ -739,7 +740,6 @@ void StyleResolver::Features::clear()
uncommonAttributeRules.clear();
usesFirstLineRules = false;
usesBeforeAfterRules = false;
- usesLinkRules = false;
}
void StyleResolver::Features::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
@@ -747,8 +747,8 @@ void StyleResolver::Features::reportMemoryUsage(MemoryObjectInfo* memoryObjectIn
MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS);
info.addHashSet(idsInRules);
info.addHashSet(attrsInRules);
- info.addVector(siblingRules);
- info.addVector(uncommonAttributeRules);
+ info.addMember(siblingRules);
+ info.addMember(uncommonAttributeRules);
}
static StyleSheetContents* parseUASheet(const String& str)
@@ -2568,7 +2568,7 @@ static void reportAtomRuleMap(MemoryClassInfo* info, const RuleSet::AtomRuleMap&
{
info->addHashMap(atomicRuleMap);
for (RuleSet::AtomRuleMap::const_iterator it = atomicRuleMap.begin(); it != atomicRuleMap.end(); ++it)
- info->addInstrumentedVector(*it->second);
+ info->addMember(*it->second);
}
void RuleSet::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
@@ -2578,11 +2578,11 @@ void RuleSet::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
reportAtomRuleMap(&info, m_classRules);
reportAtomRuleMap(&info, m_tagRules);
reportAtomRuleMap(&info, m_shadowPseudoElementRules);
- info.addInstrumentedVector(m_linkPseudoClassRules);
- info.addInstrumentedVector(m_focusPseudoClassRules);
- info.addInstrumentedVector(m_universalRules);
- info.addVector(m_pageRules);
- info.addInstrumentedVector(m_regionSelectorsAndRuleSets);
+ info.addMember(m_linkPseudoClassRules);
+ info.addMember(m_focusPseudoClassRules);
+ info.addMember(m_universalRules);
+ info.addMember(m_pageRules);
+ info.addMember(m_regionSelectorsAndRuleSets);
}
void RuleSet::RuleSetSelectorPair::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
@@ -2605,10 +2605,6 @@ static inline void collectFeaturesFromSelector(StyleResolver::Features& features
case CSSSelector::PseudoAfter:
features.usesBeforeAfterRules = true;
break;
- case CSSSelector::PseudoLink:
- case CSSSelector::PseudoVisited:
- features.usesLinkRules = true;
- break;
default:
break;
}
@@ -3181,25 +3177,25 @@ static void collectCSSOMWrappers(HashMap<StyleRule*, RefPtr<CSSStyleRule> >& wra
collectCSSOMWrappers(wrapperMap, styleSheetWrapper.get());
}
-static void collectCSSOMWrappers(HashMap<StyleRule*, RefPtr<CSSStyleRule> >& wrapperMap, Document* document)
+static void collectCSSOMWrappers(HashMap<StyleRule*, RefPtr<CSSStyleRule> >& wrapperMap, DocumentStyleSheetCollection* styleSheetCollection)
{
- const Vector<RefPtr<StyleSheet> >& styleSheets = document->styleSheets()->vector();
+ const Vector<RefPtr<StyleSheet> >& styleSheets = styleSheetCollection->authorStyleSheets();
for (unsigned i = 0; i < styleSheets.size(); ++i) {
StyleSheet* styleSheet = styleSheets[i].get();
if (!styleSheet->isCSSStyleSheet())
continue;
collectCSSOMWrappers(wrapperMap, static_cast<CSSStyleSheet*>(styleSheet));
}
- collectCSSOMWrappers(wrapperMap, document->pageUserSheet());
+ collectCSSOMWrappers(wrapperMap, styleSheetCollection->pageUserSheet());
{
- const Vector<RefPtr<CSSStyleSheet> >* pageGroupUserSheets = document->pageGroupUserSheets();
+ const Vector<RefPtr<CSSStyleSheet> >* pageGroupUserSheets = styleSheetCollection->pageGroupUserSheets();
if (pageGroupUserSheets) {
for (size_t i = 0, size = pageGroupUserSheets->size(); i < size; ++i)
collectCSSOMWrappers(wrapperMap, pageGroupUserSheets->at(i).get());
}
}
{
- const Vector<RefPtr<CSSStyleSheet> >* documentUserSheets = document->documentUserSheets();
+ const Vector<RefPtr<CSSStyleSheet> >* documentUserSheets = styleSheetCollection->documentUserSheets();
if (documentUserSheets) {
for (size_t i = 0, size = documentUserSheets->size(); i < size; ++i)
collectCSSOMWrappers(wrapperMap, documentUserSheets->at(i).get());
@@ -3218,7 +3214,7 @@ CSSStyleRule* StyleResolver::ensureFullCSSOMWrapperForInspector(StyleRule* rule)
collectCSSOMWrappers(m_styleRuleToCSSOMWrapperMap, m_styleSheetCSSOMWrapperSet, mediaControlsStyleSheet);
collectCSSOMWrappers(m_styleRuleToCSSOMWrapperMap, m_styleSheetCSSOMWrapperSet, fullscreenStyleSheet);
- collectCSSOMWrappers(m_styleRuleToCSSOMWrapperMap, document());
+ collectCSSOMWrappers(m_styleRuleToCSSOMWrapperMap, document()->styleSheetCollection());
}
return m_styleRuleToCSSOMWrapperMap.get(rule).get();
}
@@ -5767,7 +5763,7 @@ void StyleResolver::MatchedProperties::reportMemoryUsage(MemoryObjectInfo* memor
void StyleResolver::MatchedPropertiesCacheItem::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
{
MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS);
- info.addInstrumentedVector(matchedProperties);
+ info.addMember(matchedProperties);
}
void MediaQueryResult::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
@@ -5787,13 +5783,13 @@ void StyleResolver::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
info.addHashMap(m_keyframesRuleMap);
info.addHashMap(m_matchedPropertiesCache);
info.addInstrumentedMapValues(m_matchedPropertiesCache);
- info.addVector(m_matchedRules);
+ info.addMember(m_matchedRules);
info.addMember(m_ruleList);
info.addHashMap(m_pendingImageProperties);
info.addInstrumentedMapValues(m_pendingImageProperties);
info.addMember(m_lineHeightValue);
- info.addInstrumentedVector(m_viewportDependentMediaQueryResults);
+ info.addMember(m_viewportDependentMediaQueryResults);
info.addHashMap(m_styleRuleToCSSOMWrapperMap);
info.addInstrumentedMapEntries(m_styleRuleToCSSOMWrapperMap);
info.addInstrumentedHashSet(m_styleSheetCSSOMWrapperSet);
@@ -5803,7 +5799,7 @@ void StyleResolver::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
#if ENABLE(STYLE_SCOPED)
info.addHashMap(m_scopedAuthorStyles);
info.addInstrumentedMapEntries(m_scopedAuthorStyles);
- info.addVector(m_scopeStack);
+ info.addMember(m_scopeStack);
#endif
// FIXME: move this to a place where it would be called only once?
diff --git a/Source/WebCore/css/StyleResolver.h b/Source/WebCore/css/StyleResolver.h
index 9c6fe1d3c..2e530f0e5 100644
--- a/Source/WebCore/css/StyleResolver.h
+++ b/Source/WebCore/css/StyleResolver.h
@@ -244,7 +244,6 @@ public:
bool usesSiblingRules() const { return !m_features.siblingRules.isEmpty(); }
bool usesFirstLineRules() const { return m_features.usesFirstLineRules; }
bool usesBeforeAfterRules() const { return m_features.usesBeforeAfterRules; }
- bool usesLinkRules() const { return m_features.usesLinkRules; }
static bool createTransformOperations(CSSValue* inValue, RenderStyle* inStyle, RenderStyle* rootStyle, TransformOperations& outOperations);
@@ -297,7 +296,6 @@ public:
Vector<RuleFeature> uncommonAttributeRules;
bool usesFirstLineRules;
bool usesBeforeAfterRules;
- bool usesLinkRules;
};
private:
diff --git a/Source/WebCore/css/StyleRule.cpp b/Source/WebCore/css/StyleRule.cpp
index 5ece1b4a2..73b0af26c 100644
--- a/Source/WebCore/css/StyleRule.cpp
+++ b/Source/WebCore/css/StyleRule.cpp
@@ -33,6 +33,7 @@
#include "WebKitCSSKeyframeRule.h"
#include "WebKitCSSKeyframesRule.h"
#include "WebKitCSSRegionRule.h"
+#include <wtf/MemoryInstrumentationVector.h>
namespace WebCore {
@@ -340,7 +341,7 @@ void StyleRuleBlock::wrapperRemoveRule(unsigned index)
void StyleRuleBlock::reportDescendantMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
{
MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS);
- info.addInstrumentedVector(m_childRules);
+ info.addMember(m_childRules);
}
StyleRuleMedia::StyleRuleMedia(PassRefPtr<MediaQuerySet> media, Vector<RefPtr<StyleRuleBase> >& adoptRules)
diff --git a/Source/WebCore/css/StyleSheetContents.cpp b/Source/WebCore/css/StyleSheetContents.cpp
index 048273bec..945f355a3 100644
--- a/Source/WebCore/css/StyleSheetContents.cpp
+++ b/Source/WebCore/css/StyleSheetContents.cpp
@@ -33,6 +33,7 @@
#include "StyleRuleImport.h"
#include "WebCoreMemoryInstrumentation.h"
#include <wtf/Deque.h>
+#include <wtf/MemoryInstrumentationVector.h>
namespace WebCore {
@@ -489,10 +490,10 @@ void StyleSheetContents::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) c
MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS);
info.addMember(m_originalURL);
info.addMember(m_encodingFromCharsetRule);
- info.addVector(m_importRules);
- info.addInstrumentedVector(m_childRules);
+ info.addMember(m_importRules);
+ info.addMember(m_childRules);
info.addHashMap(m_namespaces);
- info.addVector(m_clients);
+ info.addMember(m_clients);
}
}
diff --git a/Source/WebCore/css/StyleSheetList.cpp b/Source/WebCore/css/StyleSheetList.cpp
index f1ab52dc9..0f8fc2517 100644
--- a/Source/WebCore/css/StyleSheetList.cpp
+++ b/Source/WebCore/css/StyleSheetList.cpp
@@ -23,6 +23,7 @@
#include "CSSStyleSheet.h"
#include "Document.h"
+#include "DocumentStyleSheetCollection.h"
#include "HTMLNames.h"
#include "HTMLStyleElement.h"
#include <wtf/text/WTFString.h>
@@ -31,8 +32,8 @@ namespace WebCore {
using namespace HTMLNames;
-StyleSheetList::StyleSheetList(Document* doc)
- : m_doc(doc)
+StyleSheetList::StyleSheetList(Document* document)
+ : m_document(document)
{
}
@@ -40,24 +41,33 @@ StyleSheetList::~StyleSheetList()
{
}
-void StyleSheetList::documentDestroyed()
+inline const Vector<RefPtr<StyleSheet> >& StyleSheetList::styleSheets() const
{
- m_doc = 0;
+ if (!m_document)
+ return m_detachedStyleSheets;
+ return m_document->styleSheetCollection()->authorStyleSheets();
+}
+
+void StyleSheetList::detachFromDocument()
+{
+ m_detachedStyleSheets = m_document->styleSheetCollection()->authorStyleSheets();
+ m_document = 0;
}
unsigned StyleSheetList::length() const
{
- return m_sheets.size();
+ return styleSheets().size();
}
StyleSheet* StyleSheetList::item(unsigned index)
{
- return index < length() ? m_sheets[index].get() : 0;
+ const Vector<RefPtr<StyleSheet> >& sheets = styleSheets();
+ return index < sheets.size() ? sheets[index].get() : 0;
}
HTMLStyleElement* StyleSheetList::getNamedItem(const String& name) const
{
- if (!m_doc)
+ if (!m_document)
return 0;
// IE also supports retrieving a stylesheet by name, using the name/id of the <style> tag
@@ -65,8 +75,7 @@ HTMLStyleElement* StyleSheetList::getNamedItem(const String& name) const
// ### Bad implementation because returns a single element (are IDs always unique?)
// and doesn't look for name attribute.
// But unicity of stylesheet ids is good practice anyway ;)
-
- Element* element = m_doc->getElementById(name);
+ Element* element = m_document->getElementById(name);
if (element && element->hasTagName(styleTag))
return static_cast<HTMLStyleElement*>(element);
return 0;
diff --git a/Source/WebCore/css/StyleSheetList.h b/Source/WebCore/css/StyleSheetList.h
index 3f81163e6..c05284159 100644
--- a/Source/WebCore/css/StyleSheetList.h
+++ b/Source/WebCore/css/StyleSheetList.h
@@ -32,40 +32,26 @@ class Document;
class HTMLStyleElement;
class StyleSheet;
-typedef Vector<RefPtr<StyleSheet> > StyleSheetVector;
-
class StyleSheetList : public RefCounted<StyleSheetList> {
public:
- static PassRefPtr<StyleSheetList> create(Document* doc) { return adoptRef(new StyleSheetList(doc)); }
+ static PassRefPtr<StyleSheetList> create(Document* document) { return adoptRef(new StyleSheetList(document)); }
~StyleSheetList();
- void documentDestroyed();
-
unsigned length() const;
StyleSheet* item(unsigned index);
HTMLStyleElement* getNamedItem(const String&) const;
- const StyleSheetVector& vector() const
- {
- return m_sheets;
- }
-
- void swap(StyleSheetVector& sheets)
- {
- m_sheets.swap(sheets);
- }
+ Document* document() { return m_document; }
- Document* document()
- {
- return m_doc;
- }
+ void detachFromDocument();
private:
StyleSheetList(Document*);
+ const Vector<RefPtr<StyleSheet> >& styleSheets() const;
- Document* m_doc;
- StyleSheetVector m_sheets;
+ Document* m_document;
+ Vector<RefPtr<StyleSheet> > m_detachedStyleSheets;
};
} // namespace WebCore
diff --git a/Source/WebCore/css/WebKitCSSKeyframesRule.cpp b/Source/WebCore/css/WebKitCSSKeyframesRule.cpp
index a2991a818..08fbb0a55 100644
--- a/Source/WebCore/css/WebKitCSSKeyframesRule.cpp
+++ b/Source/WebCore/css/WebKitCSSKeyframesRule.cpp
@@ -33,6 +33,7 @@
#include "StyleSheet.h"
#include "WebCoreMemoryInstrumentation.h"
#include "WebKitCSSKeyframeRule.h"
+#include <wtf/MemoryInstrumentationVector.h>
#include <wtf/text/StringBuilder.h>
namespace WebCore {
@@ -90,7 +91,7 @@ int StyleRuleKeyframes::findKeyframeIndex(const String& key) const
void StyleRuleKeyframes::reportDescendantMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
{
MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS);
- info.addInstrumentedVector(m_keyframes);
+ info.addMember(m_keyframes);
info.addMember(m_name);
}
@@ -211,7 +212,7 @@ void WebKitCSSKeyframesRule::reportDescendantMemoryUsage(MemoryObjectInfo* memor
MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS);
CSSRule::reportBaseClassMemoryUsage(memoryObjectInfo);
info.addMember(m_keyframesRule);
- info.addInstrumentedVector(m_childRuleCSSOMWrappers);
+ info.addMember(m_childRuleCSSOMWrappers);
info.addMember(m_ruleListCSSOMWrapper);
}
diff --git a/Source/WebCore/css/WebKitCSSRegionRule.cpp b/Source/WebCore/css/WebKitCSSRegionRule.cpp
index 5c2c721cd..ce1207cab 100644
--- a/Source/WebCore/css/WebKitCSSRegionRule.cpp
+++ b/Source/WebCore/css/WebKitCSSRegionRule.cpp
@@ -34,6 +34,7 @@
#include "CSSParser.h"
#include "CSSRuleList.h"
#include "StyleRule.h"
+#include <wtf/MemoryInstrumentationVector.h>
#include <wtf/text/StringBuilder.h>
#if ENABLE(CSS_REGIONS)
@@ -113,7 +114,7 @@ void WebKitCSSRegionRule::reportDescendantMemoryUsage(MemoryObjectInfo* memoryOb
MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS);
CSSRule::reportBaseClassMemoryUsage(memoryObjectInfo);
info.addMember(m_regionRule);
- info.addInstrumentedVector(m_childRuleCSSOMWrappers);
+ info.addMember(m_childRuleCSSOMWrappers);
info.addMember(m_ruleListCSSOMWrapper);
}
diff --git a/Source/WebCore/dom/CharacterData.idl b/Source/WebCore/dom/CharacterData.idl
index 2bb3d4e49..bf8fef19f 100644
--- a/Source/WebCore/dom/CharacterData.idl
+++ b/Source/WebCore/dom/CharacterData.idl
@@ -45,7 +45,10 @@ module core {
in [IsIndex,Optional=DefaultIsUndefined] unsigned long length,
in [Optional=DefaultIsUndefined] DOMString data)
raises(DOMException);
-
+
+ // DOM 4
+ void remove()
+ raises(DOMException);
};
}
diff --git a/Source/WebCore/dom/ContainerNode.cpp b/Source/WebCore/dom/ContainerNode.cpp
index cd118f17d..dafee6077 100644
--- a/Source/WebCore/dom/ContainerNode.cpp
+++ b/Source/WebCore/dom/ContainerNode.cpp
@@ -419,15 +419,15 @@ bool ContainerNode::removeChild(Node* oldChild, ExceptionCode& ec)
return false;
}
- RenderWidget::suspendWidgetHierarchyUpdates();
-
- Node* prev = child->previousSibling();
- Node* next = child->nextSibling();
- removeBetween(prev, next, child.get());
- childrenChanged(false, prev, next, -1);
- ChildNodeRemovalNotifier(this).notify(child.get());
-
- RenderWidget::resumeWidgetHierarchyUpdates();
+ {
+ WidgetHierarchyUpdatesSuspensionScope suspendWidgetHierarchyUpdates;
+
+ Node* prev = child->previousSibling();
+ Node* next = child->nextSibling();
+ removeBetween(prev, next, child.get());
+ childrenChanged(false, prev, next, -1);
+ ChildNodeRemovalNotifier(this).notify(child.get());
+ }
dispatchSubtreeModifiedEvent();
return child;
@@ -497,49 +497,50 @@ void ContainerNode::removeChildren()
// and remove... e.g. stop loading frames, fire unload events.
willRemoveChildren(protect.get());
- RenderWidget::suspendWidgetHierarchyUpdates();
- forbidEventDispatch();
Vector<RefPtr<Node>, 10> removedChildren;
- removedChildren.reserveInitialCapacity(childNodeCount());
- while (RefPtr<Node> n = m_firstChild) {
- Node* next = n->nextSibling();
-
- // Remove the node from the tree before calling detach or removedFromDocument (4427024, 4129744).
- // removeChild() does this after calling detach(). There is no explanation for
- // this discrepancy between removeChild() and its optimized version removeChildren().
- n->setPreviousSibling(0);
- n->setNextSibling(0);
- n->setParentOrHostNode(0);
- document()->adoptIfNeeded(n.get());
-
- m_firstChild = next;
- if (n == m_lastChild)
- m_lastChild = 0;
- removedChildren.append(n.release());
- }
+ {
+ WidgetHierarchyUpdatesSuspensionScope suspendWidgetHierarchyUpdates;
+ forbidEventDispatch();
+ removedChildren.reserveInitialCapacity(childNodeCount());
+ while (RefPtr<Node> n = m_firstChild) {
+ Node* next = n->nextSibling();
+
+ // Remove the node from the tree before calling detach or removedFromDocument (4427024, 4129744).
+ // removeChild() does this after calling detach(). There is no explanation for
+ // this discrepancy between removeChild() and its optimized version removeChildren().
+ n->setPreviousSibling(0);
+ n->setNextSibling(0);
+ n->setParentOrHostNode(0);
+ document()->adoptIfNeeded(n.get());
+
+ m_firstChild = next;
+ if (n == m_lastChild)
+ m_lastChild = 0;
+ removedChildren.append(n.release());
+ }
- size_t removedChildrenCount = removedChildren.size();
- size_t i;
-
- // Detach the nodes only after properly removed from the tree because
- // a. detaching requires a proper DOM tree (for counters and quotes for
- // example) and during the previous loop the next sibling still points to
- // the node being removed while the node being removed does not point back
- // and does not point to the same parent as its next sibling.
- // b. destroying Renderers of standalone nodes is sometimes faster.
- for (i = 0; i < removedChildrenCount; ++i) {
- Node* removedChild = removedChildren[i].get();
- if (removedChild->attached())
- removedChild->detach();
- }
+ size_t removedChildrenCount = removedChildren.size();
+ size_t i;
+
+ // Detach the nodes only after properly removed from the tree because
+ // a. detaching requires a proper DOM tree (for counters and quotes for
+ // example) and during the previous loop the next sibling still points to
+ // the node being removed while the node being removed does not point back
+ // and does not point to the same parent as its next sibling.
+ // b. destroying Renderers of standalone nodes is sometimes faster.
+ for (i = 0; i < removedChildrenCount; ++i) {
+ Node* removedChild = removedChildren[i].get();
+ if (removedChild->attached())
+ removedChild->detach();
+ }
- childrenChanged(false, 0, 0, -static_cast<int>(removedChildrenCount));
+ childrenChanged(false, 0, 0, -static_cast<int>(removedChildrenCount));
- for (i = 0; i < removedChildrenCount; ++i)
- ChildNodeRemovalNotifier(this).notify(removedChildren[i].get());
+ for (i = 0; i < removedChildrenCount; ++i)
+ ChildNodeRemovalNotifier(this).notify(removedChildren[i].get());
- allowEventDispatch();
- RenderWidget::resumeWidgetHierarchyUpdates();
+ allowEventDispatch();
+ }
dispatchSubtreeModifiedEvent();
}
diff --git a/Source/WebCore/dom/Document.cpp b/Source/WebCore/dom/Document.cpp
index 3fa6b41ab..009c84592 100644
--- a/Source/WebCore/dom/Document.cpp
+++ b/Source/WebCore/dom/Document.cpp
@@ -57,6 +57,7 @@
#include "DocumentFragment.h"
#include "DocumentLoader.h"
#include "DocumentMarkerController.h"
+#include "DocumentStyleSheetCollection.h"
#include "DocumentType.h"
#include "EditingText.h"
#include "Editor.h"
@@ -173,6 +174,7 @@
#include <wtf/CurrentTime.h>
#include <wtf/HashFunctions.h>
#include <wtf/MainThread.h>
+#include <wtf/MemoryInstrumentationVector.h>
#include <wtf/PassRefPtr.h>
#include <wtf/StdLibExtras.h>
#include <wtf/text/StringBuffer.h>
@@ -437,8 +439,7 @@ Document::Document(Frame* frame, const KURL& url, bool isXHTML, bool isHTML)
#if ENABLE(MUTATION_OBSERVERS)
, m_mutationObserverTypes(0)
#endif
- , m_styleSheets(StyleSheetList::create(this))
- , m_hadActiveLoadingStylesheet(false)
+ , m_styleSheetCollection(adoptPtr(new DocumentStyleSheetCollection(this)))
, m_readyState(Complete)
, m_styleRecalcTimer(this, &Document::styleRecalcTimerFired)
, m_pendingStyleRecalcShouldForce(false)
@@ -504,8 +505,6 @@ Document::Document(Frame* frame, const KURL& url, bool isXHTML, bool isHTML)
{
m_document = this;
- m_pageGroupUserSheetCacheValid = false;
-
m_printing = false;
m_paginatedForScreen = false;
@@ -543,20 +542,9 @@ Document::Document(Frame* frame, const KURL& url, bool isXHTML, bool isHTML)
m_inStyleRecalc = false;
m_closeAfterStyleRecalc = false;
- m_usesSiblingRules = false;
- m_usesSiblingRulesOverride = false;
- m_usesFirstLineRules = false;
- m_usesFirstLetterRules = false;
- m_usesBeforeAfterRules = false;
- m_usesBeforeAfterRulesOverride = false;
- m_usesRemUnits = false;
- m_usesLinkRules = false;
-
m_gotoAnchorNeededAfterStylesheetsLoad = false;
m_didCalculateStyleResolver = false;
- m_hasDirtyStyleResolver = false;
- m_pendingStylesheets = 0;
m_ignorePendingStylesheets = false;
m_needsNotifyRemoveAllPendingStylesheet = false;
m_hasNodesWithPlaceholderStyle = false;
@@ -643,24 +631,16 @@ Document::~Document()
m_decoder = 0;
- if (m_styleSheets)
- m_styleSheets->documentDestroyed();
+ if (m_styleSheetList)
+ m_styleSheetList->detachFromDocument();
+
+ m_styleSheetCollection.clear();
if (m_namedFlows)
m_namedFlows->documentDestroyed();
if (m_elemSheet)
m_elemSheet->clearOwnerNode();
- if (m_pageUserSheet)
- m_pageUserSheet->clearOwnerNode();
- if (m_pageGroupUserSheets) {
- for (size_t i = 0; i < m_pageGroupUserSheets->size(); ++i)
- (*m_pageGroupUserSheets)[i]->clearOwnerNode();
- }
- if (m_userSheets) {
- for (size_t i = 0; i < m_userSheets->size(); ++i)
- (*m_userSheets)[i]->clearOwnerNode();
- }
deleteCustomFonts();
@@ -802,14 +782,14 @@ void Document::setCompatibilityMode(CompatibilityMode mode)
{
if (m_compatibilityModeLocked || mode == m_compatibilityMode)
return;
- ASSERT(!m_styleSheets->length());
+ ASSERT(m_styleSheetCollection->authorStyleSheets().isEmpty());
bool wasInQuirksMode = inQuirksMode();
m_compatibilityMode = mode;
selectorQueryCache()->invalidate();
if (inQuirksMode() != wasInQuirksMode) {
// All user stylesheets have to reparse using the different mode.
- clearPageUserSheet();
- clearPageGroupUserSheets();
+ m_styleSheetCollection->clearPageUserSheet();
+ m_styleSheetCollection->clearPageGroupUserSheets();
}
}
@@ -1069,8 +1049,11 @@ PassRefPtr<Node> Document::adoptNode(PassRefPtr<Node> source, ExceptionCode& ec)
return 0;
}
}
- if (source->parentNode())
+ if (source->parentNode()) {
source->parentNode()->removeChild(source.get(), ec);
+ if (ec)
+ return 0;
+ }
}
this->adoptIfNeeded(source.get());
@@ -1822,75 +1805,76 @@ void Document::recalcStyle(StyleChange change)
// 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_hasDirtyStyleResolver)
- updateActiveStylesheets(RecalcStyleImmediately);
+ if (m_styleSheetCollection->needsUpdateActiveStylesheetsOnStyleRecalc())
+ m_styleSheetCollection->updateActiveStyleSheets(DocumentStyleSheetCollection::FullUpdate);
InspectorInstrumentationCookie cookie = InspectorInstrumentation::willRecalculateStyle(this);
if (m_elemSheet && m_elemSheet->contents()->usesRemUnits())
- m_usesRemUnits = true;
+ m_styleSheetCollection->setUsesRemUnit(true);
m_inStyleRecalc = true;
suspendPostAttachCallbacks();
- RenderWidget::suspendWidgetHierarchyUpdates();
-
- RefPtr<FrameView> frameView = view();
- if (frameView) {
- frameView->pauseScheduledEvents();
- frameView->beginDeferredRepaints();
- }
+ {
+ WidgetHierarchyUpdatesSuspensionScope suspendWidgetHierarchyUpdates;
- ASSERT(!renderer() || renderArena());
- if (!renderer() || !renderArena())
- goto bail_out;
+ RefPtr<FrameView> frameView = view();
+ if (frameView) {
+ frameView->pauseScheduledEvents();
+ frameView->beginDeferredRepaints();
+ }
- if (m_pendingStyleRecalcShouldForce)
- change = Force;
+ ASSERT(!renderer() || renderArena());
+ if (!renderer() || !renderArena())
+ goto bailOut;
- // Recalculating the root style (on the document) is not needed in the common case.
- if ((change == Force) || (shouldDisplaySeamlesslyWithParent() && (change >= Inherit))) {
- // style selector may set this again during recalc
- m_hasNodesWithPlaceholderStyle = false;
-
- RefPtr<RenderStyle> documentStyle = StyleResolver::styleForDocument(this, m_styleResolver ? m_styleResolver->fontSelector() : 0);
- StyleChange ch = Node::diff(documentStyle.get(), renderer()->style(), this);
- if (ch != NoChange)
- renderer()->setStyle(documentStyle.release());
- }
+ if (m_pendingStyleRecalcShouldForce)
+ change = Force;
- for (Node* n = firstChild(); n; n = n->nextSibling()) {
- if (!n->isElementNode())
- continue;
- Element* element = static_cast<Element*>(n);
- if (change >= Inherit || element->childNeedsStyleRecalc() || element->needsStyleRecalc())
- element->recalcStyle(change);
- }
+ // Recalculating the root style (on the document) is not needed in the common case.
+ if ((change == Force) || (shouldDisplaySeamlesslyWithParent() && (change >= Inherit))) {
+ // style selector may set this again during recalc
+ m_hasNodesWithPlaceholderStyle = false;
+
+ RefPtr<RenderStyle> documentStyle = StyleResolver::styleForDocument(this, m_styleResolver ? m_styleResolver->fontSelector() : 0);
+ StyleChange ch = Node::diff(documentStyle.get(), renderer()->style(), this);
+ if (ch != NoChange)
+ renderer()->setStyle(documentStyle.release());
+ }
-#if USE(ACCELERATED_COMPOSITING)
- if (view()) {
- bool layoutPending = view()->layoutPending() || renderer()->needsLayout();
- // If we didn't update compositing layers because of layout(), we need to do so here.
- if (!layoutPending)
- view()->updateCompositingLayersAfterStyleChange();
- }
-#endif
+ for (Node* n = firstChild(); n; n = n->nextSibling()) {
+ if (!n->isElementNode())
+ continue;
+ Element* element = static_cast<Element*>(n);
+ if (change >= Inherit || element->childNeedsStyleRecalc() || element->needsStyleRecalc())
+ element->recalcStyle(change);
+ }
-bail_out:
- clearNeedsStyleRecalc();
- clearChildNeedsStyleRecalc();
- unscheduleStyleRecalc();
+ #if USE(ACCELERATED_COMPOSITING)
+ if (view()) {
+ bool layoutPending = view()->layoutPending() || renderer()->needsLayout();
+ // If we didn't update compositing layers because of layout(), we need to do so here.
+ if (!layoutPending)
+ view()->updateCompositingLayersAfterStyleChange();
+ }
+ #endif
- 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)
- resetCSSFeatureFlags();
+ bailOut:
+ clearNeedsStyleRecalc();
+ clearChildNeedsStyleRecalc();
+ unscheduleStyleRecalc();
+
+ m_inStyleRecalc = false;
- if (frameView) {
- frameView->resumeScheduledEvents();
- frameView->endDeferredRepaints();
+ // Pseudo element removal and similar may only work with these flags still set. Reset them after the style recalc.
+ if (m_styleResolver)
+ m_styleSheetCollection->resetCSSFeatureFlags();
+
+ if (frameView) {
+ frameView->resumeScheduledEvents();
+ frameView->endDeferredRepaints();
+ }
}
- RenderWidget::resumeWidgetHierarchyUpdates();
resumePostAttachCallbacks();
// If we wanted to call implicitClose() during recalcStyle, do so now that we're finished.
@@ -2067,33 +2051,16 @@ void Document::setIsViewSource(bool isViewSource)
didUpdateSecurityOrigin();
}
-void Document::combineCSSFeatureFlags()
-{
- // 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 || m_styleResolver->usesSiblingRules();
- m_usesFirstLineRules = m_usesFirstLineRules || m_styleResolver->usesFirstLineRules();
- m_usesBeforeAfterRules = m_usesBeforeAfterRules || m_styleResolver->usesBeforeAfterRules();
- m_usesLinkRules = m_usesLinkRules || m_styleResolver->usesLinkRules();
-}
-
-void Document::resetCSSFeatureFlags()
-{
- m_usesSiblingRules = m_styleResolver->usesSiblingRules();
- m_usesFirstLineRules = m_styleResolver->usesFirstLineRules();
- m_usesBeforeAfterRules = m_styleResolver->usesBeforeAfterRules();
- m_usesLinkRules = m_styleResolver->usesLinkRules();
-}
-
void Document::createStyleResolver()
{
bool matchAuthorAndUserStyles = true;
if (Settings* docSettings = settings())
matchAuthorAndUserStyles = docSettings->authorAndUserStylesEnabled();
m_styleResolver = adoptPtr(new StyleResolver(this, matchAuthorAndUserStyles));
- combineCSSFeatureFlags();
+ m_styleSheetCollection->combineCSSFeatureFlags();
}
-inline void Document::clearStyleResolver()
+void Document::clearStyleResolver()
{
m_styleResolver.clear();
}
@@ -2903,105 +2870,23 @@ Frame* Document::findUnsafeParentScrollPropagationBoundary()
return 0;
}
-CSSStyleSheet* Document::pageUserSheet()
-{
- if (m_pageUserSheet)
- return m_pageUserSheet.get();
-
- Page* owningPage = page();
- if (!owningPage)
- return 0;
-
- String userSheetText = owningPage->userStyleSheet();
- if (userSheetText.isEmpty())
- return 0;
-
- // Parse the sheet and cache it.
- m_pageUserSheet = CSSStyleSheet::createInline(this, settings()->userStyleSheetLocation());
- m_pageUserSheet->contents()->setIsUserStyleSheet(true);
- m_pageUserSheet->contents()->parseString(userSheetText);
- return m_pageUserSheet.get();
-}
-
-void Document::clearPageUserSheet()
-{
- if (m_pageUserSheet) {
- m_pageUserSheet = 0;
- styleResolverChanged(DeferRecalcStyle);
- }
-}
-
-void Document::updatePageUserSheet()
-{
- clearPageUserSheet();
- if (pageUserSheet())
- styleResolverChanged(RecalcStyleImmediately);
-}
-const Vector<RefPtr<CSSStyleSheet> >* Document::pageGroupUserSheets() const
+void Document::seamlessParentUpdatedStylesheets()
{
- if (m_pageGroupUserSheetCacheValid)
- return m_pageGroupUserSheets.get();
-
- m_pageGroupUserSheetCacheValid = true;
-
- Page* owningPage = page();
- if (!owningPage)
- return 0;
-
- const PageGroup& pageGroup = owningPage->group();
- const UserStyleSheetMap* sheetsMap = pageGroup.userStyleSheets();
- if (!sheetsMap)
- return 0;
-
- UserStyleSheetMap::const_iterator end = sheetsMap->end();
- for (UserStyleSheetMap::const_iterator it = sheetsMap->begin(); it != end; ++it) {
- const UserStyleSheetVector* sheets = it->second.get();
- for (unsigned i = 0; i < sheets->size(); ++i) {
- const UserStyleSheet* sheet = sheets->at(i).get();
- if (sheet->injectedFrames() == InjectInTopFrameOnly && ownerElement())
- continue;
- if (!UserContentURLPattern::matchesPatterns(url(), sheet->whitelist(), sheet->blacklist()))
- continue;
- RefPtr<CSSStyleSheet> groupSheet = CSSStyleSheet::createInline(const_cast<Document*>(this), sheet->url());
- if (!m_pageGroupUserSheets)
- m_pageGroupUserSheets = adoptPtr(new Vector<RefPtr<CSSStyleSheet> >);
- m_pageGroupUserSheets->append(groupSheet);
- groupSheet->contents()->setIsUserStyleSheet(sheet->level() == UserStyleUserLevel);
- groupSheet->contents()->parseString(sheet->source());
- }
- }
-
- return m_pageGroupUserSheets.get();
+ styleResolverChanged(RecalcStyleImmediately);
}
-void Document::clearPageGroupUserSheets()
+void Document::didRemoveAllPendingStylesheet()
{
- m_pageGroupUserSheetCacheValid = false;
- if (m_pageGroupUserSheets && m_pageGroupUserSheets->size()) {
- m_pageGroupUserSheets->clear();
- styleResolverChanged(DeferRecalcStyle);
- }
-}
+ m_needsNotifyRemoveAllPendingStylesheet = false;
-void Document::updatePageGroupUserSheets()
-{
- clearPageGroupUserSheets();
- if (pageGroupUserSheets() && pageGroupUserSheets()->size())
- styleResolverChanged(RecalcStyleImmediately);
-}
+ styleResolverChanged(RecalcStyleIfNeeded);
-void Document::addUserSheet(PassRefPtr<StyleSheetContents> userSheet)
-{
- if (!m_userSheets)
- m_userSheets = adoptPtr(new Vector<RefPtr<CSSStyleSheet> >);
- m_userSheets->append(CSSStyleSheet::create(userSheet, this));
- styleResolverChanged(RecalcStyleImmediately);
-}
+ if (ScriptableDocumentParser* parser = scriptableDocumentParser())
+ parser->executeScriptsWaitingForStylesheets();
-void Document::seamlessParentUpdatedStylesheets()
-{
- styleResolverChanged(RecalcStyleImmediately);
+ if (m_gotoAnchorNeededAfterStylesheetsLoad && view())
+ view()->scrollToFragment(m_url);
}
CSSStyleSheet* Document::elementSheet()
@@ -3042,8 +2927,8 @@ void Document::processHttpEquiv(const String& equiv, const String& content)
// For more info, see the test at:
// http://www.hixie.ch/tests/evil/css/import/main/preferred.html
// -dwh
- m_selectedStylesheetSet = content;
- m_preferredStylesheetSet = content;
+ m_styleSheetCollection->setSelectedStylesheetSetName(content);
+ m_styleSheetCollection->setPreferredStylesheetSetName(content);
styleResolverChanged(DeferRecalcStyle);
} else if (equalIgnoringCase(equiv, "refresh")) {
double delay;
@@ -3315,63 +3200,27 @@ PassRefPtr<Node> Document::cloneNode(bool /*deep*/)
StyleSheetList* Document::styleSheets()
{
- return m_styleSheets.get();
+ if (!m_styleSheetList)
+ m_styleSheetList = StyleSheetList::create(this);
+ return m_styleSheetList.get();
}
String Document::preferredStylesheetSet() const
{
- return m_preferredStylesheetSet;
+ return m_styleSheetCollection->preferredStylesheetSetName();
}
String Document::selectedStylesheetSet() const
{
- return m_selectedStylesheetSet;
+ return m_styleSheetCollection->selectedStylesheetSetName();
}
void Document::setSelectedStylesheetSet(const String& aString)
{
- m_selectedStylesheetSet = aString;
+ m_styleSheetCollection->setSelectedStylesheetSetName(aString);
styleResolverChanged(DeferRecalcStyle);
}
-// This method is called whenever a top-level stylesheet has finished loading.
-void Document::removePendingSheet(RemovePendingSheetNotificationType notification)
-{
- // Make sure we knew this sheet was pending, and that our count isn't out of sync.
- ASSERT(m_pendingStylesheets > 0);
-
- m_pendingStylesheets--;
-
-#ifdef INSTRUMENT_LAYOUT_SCHEDULING
- if (!ownerElement())
- printf("Stylesheet loaded at time %d. %d stylesheets still remain.\n", elapsedTime(), m_pendingStylesheets);
-#endif
-
- if (m_pendingStylesheets)
- return;
-
- if (notification == RemovePendingSheetNotifyLater) {
- setNeedsNotifyRemoveAllPendingStylesheet();
- return;
- }
-
- didRemoveAllPendingStylesheet();
-}
-
-void Document::didRemoveAllPendingStylesheet()
-{
- m_needsNotifyRemoveAllPendingStylesheet = false;
-
- styleResolverChanged(RecalcStyleIfNeeded);
-
- if (ScriptableDocumentParser* parser = scriptableDocumentParser())
- parser->executeScriptsWaitingForStylesheets();
-
- if (m_gotoAnchorNeededAfterStylesheetsLoad && view())
- view()->scrollToFragment(m_url);
-}
-
-
void Document::evaluateMediaQueryList()
{
if (m_mediaQueryMatcher)
@@ -3386,20 +3235,24 @@ void Document::styleResolverChanged(StyleResolverUpdateFlag updateFlag)
m_styleResolver.clear();
return;
}
+ m_didCalculateStyleResolver = true;
#ifdef INSTRUMENT_LAYOUT_SCHEDULING
if (!ownerElement())
printf("Beginning update of style selector at time %d.\n", elapsedTime());
#endif
- bool stylesheetChangeRequiresStyleRecalc = updateActiveStylesheets(updateFlag);
+ DocumentStyleSheetCollection::UpdateFlag styleSheetUpdate = (updateFlag == RecalcStyleIfNeeded)
+ ? DocumentStyleSheetCollection::OptimizedUpdate
+ : DocumentStyleSheetCollection::FullUpdate;
+ bool stylesheetChangeRequiresStyleRecalc = m_styleSheetCollection->updateActiveStyleSheets(styleSheetUpdate);
if (updateFlag == DeferRecalcStyle) {
scheduleForcedStyleRecalc();
return;
}
- if (didLayoutWithPendingStylesheets() && m_pendingStylesheets <= 0) {
+ if (didLayoutWithPendingStylesheets() && !m_styleSheetCollection->hasPendingSheets()) {
m_pendingSheetLayout = IgnoreLayoutWithPendingSheets;
if (renderer())
renderer()->repaint();
@@ -3429,219 +3282,6 @@ void Document::styleResolverChanged(StyleResolverUpdateFlag updateFlag)
evaluateMediaQueryList();
}
-void Document::addStyleSheetCandidateNode(Node* node, bool createdByParser)
-{
- if (!node->inDocument())
- return;
-
- // Until the <body> exists, we have no choice but to compare document positions,
- // since styles outside of the body and head continue to be shunted into the head
- // (and thus can shift to end up before dynamically added DOM content that is also
- // outside the body).
- if ((createdByParser && body()) || m_styleSheetCandidateNodes.isEmpty()) {
- m_styleSheetCandidateNodes.add(node);
- return;
- }
-
- // Determine an appropriate insertion point.
- StyleSheetCandidateListHashSet::iterator begin = m_styleSheetCandidateNodes.begin();
- StyleSheetCandidateListHashSet::iterator end = m_styleSheetCandidateNodes.end();
- StyleSheetCandidateListHashSet::iterator it = end;
- Node* followingNode = 0;
- do {
- --it;
- Node* n = *it;
- unsigned short position = n->compareDocumentPosition(node);
- if (position == DOCUMENT_POSITION_FOLLOWING) {
- m_styleSheetCandidateNodes.insertBefore(followingNode, node);
- return;
- }
- followingNode = n;
- } while (it != begin);
-
- m_styleSheetCandidateNodes.insertBefore(followingNode, node);
-}
-
-void Document::removeStyleSheetCandidateNode(Node* node)
-{
- m_styleSheetCandidateNodes.remove(node);
-}
-
-void Document::collectActiveStylesheets(Vector<RefPtr<StyleSheet> >& sheets)
-{
- if (settings() && !settings()->authorAndUserStylesEnabled())
- return;
-
- StyleSheetCandidateListHashSet::iterator begin = m_styleSheetCandidateNodes.begin();
- StyleSheetCandidateListHashSet::iterator end = m_styleSheetCandidateNodes.end();
- for (StyleSheetCandidateListHashSet::iterator it = begin; it != end; ++it) {
- Node* n = *it;
- StyleSheet* sheet = 0;
- if (n->nodeType() == PROCESSING_INSTRUCTION_NODE) {
- // Processing instruction (XML documents only).
- // We don't support linking to embedded CSS stylesheets, see <https://bugs.webkit.org/show_bug.cgi?id=49281> for discussion.
- ProcessingInstruction* pi = static_cast<ProcessingInstruction*>(n);
- sheet = pi->sheet();
-#if ENABLE(XSLT)
- // Don't apply XSL transforms to already transformed documents -- <rdar://problem/4132806>
- if (pi->isXSL() && !transformSourceDocument()) {
- // Don't apply XSL transforms until loading is finished.
- if (!parsing())
- applyXSLTransform(pi);
- return;
- }
-#endif
- } else if ((n->isHTMLElement() && (n->hasTagName(linkTag) || n->hasTagName(styleTag)))
-#if ENABLE(SVG)
- || (n->isSVGElement() && n->hasTagName(SVGNames::styleTag))
-#endif
- ) {
- Element* e = static_cast<Element*>(n);
- AtomicString title = e->getAttribute(titleAttr);
- bool enabledViaScript = false;
- if (e->hasLocalName(linkTag)) {
- // <LINK> element
- HTMLLinkElement* linkElement = static_cast<HTMLLinkElement*>(n);
- if (linkElement->isDisabled())
- continue;
- enabledViaScript = linkElement->isEnabledViaScript();
- if (linkElement->styleSheetIsLoading()) {
- // it is loading but we should still decide which style sheet set to use
- if (!enabledViaScript && !title.isEmpty() && m_preferredStylesheetSet.isEmpty()) {
- const AtomicString& rel = e->getAttribute(relAttr);
- if (!rel.contains("alternate")) {
- m_preferredStylesheetSet = title;
- m_selectedStylesheetSet = title;
- }
- }
- continue;
- }
- if (!linkElement->sheet())
- title = nullAtom;
- }
- // Get the current preferred styleset. This is the
- // set of sheets that will be enabled.
-#if ENABLE(SVG)
- if (n->isSVGElement() && n->hasTagName(SVGNames::styleTag))
- sheet = static_cast<SVGStyleElement*>(n)->sheet();
- else
-#endif
- if (e->hasLocalName(linkTag))
- sheet = static_cast<HTMLLinkElement*>(n)->sheet();
- else
- // <STYLE> element
- sheet = static_cast<HTMLStyleElement*>(n)->sheet();
- // Check to see if this sheet belongs to a styleset
- // (thus making it PREFERRED or ALTERNATE rather than
- // PERSISTENT).
- AtomicString rel = e->getAttribute(relAttr);
- if (!enabledViaScript && !title.isEmpty()) {
- // Yes, we have a title.
- if (m_preferredStylesheetSet.isEmpty()) {
- // No preferred set has been established. If
- // we are NOT an alternate sheet, then establish
- // us as the preferred set. Otherwise, just ignore
- // this sheet.
- if (e->hasLocalName(styleTag) || !rel.contains("alternate"))
- m_preferredStylesheetSet = m_selectedStylesheetSet = title;
- }
- if (title != m_preferredStylesheetSet)
- sheet = 0;
- }
-
- if (rel.contains("alternate") && title.isEmpty())
- sheet = 0;
- }
- if (sheet)
- sheets.append(sheet);
- }
-}
-
-bool Document::testAddedStylesheetRequiresStyleRecalc(StyleSheetContents* stylesheet)
-{
- // See if all rules on the sheet are scoped to some specific ids or classes.
- // Then test if we actually have any of those in the tree at the moment.
- HashSet<AtomicStringImpl*> idScopes;
- HashSet<AtomicStringImpl*> classScopes;
- if (!StyleResolver::determineStylesheetSelectorScopes(stylesheet, idScopes, classScopes))
- return true;
- // Invalidate the subtrees that match the scopes.
- Node* node = firstChild();
- while (node) {
- if (!node->isStyledElement()) {
- node = node->traverseNextNode();
- continue;
- }
- StyledElement* element = static_cast<StyledElement*>(node);
- if (SelectorChecker::elementMatchesSelectorScopes(element, idScopes, classScopes)) {
- element->setNeedsStyleRecalc();
- // The whole subtree is now invalidated, we can skip to the next sibling.
- node = node->traverseNextSibling();
- continue;
- }
- node = node->traverseNextNode();
- }
- return false;
-}
-
-void Document::analyzeStylesheetChange(StyleResolverUpdateFlag updateFlag, const Vector<RefPtr<StyleSheet> >& newStylesheets, bool& requiresStyleResolverReset, bool& requiresFullStyleRecalc)
-{
- requiresStyleResolverReset = true;
- requiresFullStyleRecalc = true;
-
- // Stylesheets of <style> elements that @import stylesheets are active but loading. We need to trigger a full recalc when such loads are done.
- bool hasActiveLoadingStylesheet = false;
- unsigned newStylesheetCount = newStylesheets.size();
- for (unsigned i = 0; i < newStylesheetCount; ++i) {
- if (newStylesheets[i]->isLoading())
- hasActiveLoadingStylesheet = true;
- }
- if (m_hadActiveLoadingStylesheet && !hasActiveLoadingStylesheet) {
- m_hadActiveLoadingStylesheet = false;
- return;
- }
- m_hadActiveLoadingStylesheet = hasActiveLoadingStylesheet;
-
- if (updateFlag != RecalcStyleIfNeeded)
- return;
- if (!m_styleResolver)
- return;
-
- // See if we are just adding stylesheets.
- unsigned oldStylesheetCount = m_styleSheets->length();
- if (newStylesheetCount < oldStylesheetCount)
- return;
- for (unsigned i = 0; i < oldStylesheetCount; ++i) {
- if (m_styleSheets->item(i) != newStylesheets[i])
- return;
- }
- requiresStyleResolverReset = false;
-
- // If we are already parsing the body and so may have significant amount of elements, put some effort into trying to avoid style recalcs.
- if (!body() || m_hasNodesWithPlaceholderStyle)
- return;
- for (unsigned i = oldStylesheetCount; i < newStylesheetCount; ++i) {
- if (!newStylesheets[i]->isCSSStyleSheet())
- return;
- if (newStylesheets[i]->disabled())
- continue;
- if (testAddedStylesheetRequiresStyleRecalc(static_cast<CSSStyleSheet*>(newStylesheets[i].get())->contents()))
- return;
- }
- requiresFullStyleRecalc = false;
-}
-
-static bool styleSheetsUseRemUnits(const Vector<RefPtr<StyleSheet> >& sheets)
-{
- for (unsigned i = 0; i < sheets.size(); ++i) {
- if (!sheets[i]->isCSSStyleSheet())
- continue;
- if (static_cast<CSSStyleSheet*>(sheets[i].get())->contents()->usesRemUnits())
- return true;
- }
- return false;
-}
-
void Document::notifySeamlessChildDocumentsOfStylesheetUpdate() const
{
// If we're not in a frame yet any potential child documents won't have a StyleResolver to update.
@@ -3658,43 +3298,6 @@ void Document::notifySeamlessChildDocumentsOfStylesheetUpdate() const
}
}
-bool Document::updateActiveStylesheets(StyleResolverUpdateFlag updateFlag)
-{
- if (m_inStyleRecalc) {
- // SVG <use> element may manage to invalidate style selector in the middle of a style recalc.
- // https://bugs.webkit.org/show_bug.cgi?id=54344
- // FIXME: This should be fixed in SVG and this code replaced with ASSERT(!m_inStyleRecalc).
- m_hasDirtyStyleResolver = true;
- scheduleForcedStyleRecalc();
- return false;
- }
- if (!renderer() || !attached())
- return false;
-
- StyleSheetVector newStylesheets;
- collectActiveStylesheets(newStylesheets);
-
- bool requiresStyleResolverReset;
- bool requiresFullStyleRecalc;
- analyzeStylesheetChange(updateFlag, newStylesheets, requiresStyleResolverReset, requiresFullStyleRecalc);
-
- if (requiresStyleResolverReset)
- clearStyleResolver();
- else {
- m_styleResolver->appendAuthorStylesheets(m_styleSheets->length(), newStylesheets);
- resetCSSFeatureFlags();
- }
- m_styleSheets->swap(newStylesheets);
-
- m_usesRemUnits = styleSheetsUseRemUnits(m_styleSheets->vector());
- m_didCalculateStyleResolver = true;
- m_hasDirtyStyleResolver = false;
-
- notifySeamlessChildDocumentsOfStylesheetUpdate();
-
- return requiresFullStyleRecalc;
-}
-
void Document::setHoverNode(PassRefPtr<Node> newHoverNode)
{
m_hoverNode = newHoverNode;
@@ -3714,12 +3317,16 @@ void Document::removeFocusedNodeOfSubtree(Node* node, bool amongChildrenOnly)
{
if (!m_focusedNode || this->inPageCache()) // If the document is in the page cache, then we don't need to clear out the focused node.
return;
-
+
+ Node* focusedNode = node->treeScope()->focusedNode();
+ if (!focusedNode)
+ return;
+
bool nodeInSubtree = false;
if (amongChildrenOnly)
- nodeInSubtree = m_focusedNode->isDescendantOf(node);
+ nodeInSubtree = focusedNode->isDescendantOf(node);
else
- nodeInSubtree = (m_focusedNode == node) || m_focusedNode->isDescendantOf(node);
+ nodeInSubtree = (focusedNode == node) || focusedNode->isDescendantOf(node);
if (nodeInSubtree)
document()->focusedNodeRemoved();
@@ -6262,7 +5869,7 @@ void Document::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::DOM);
info.addMember(m_styleResolver);
ContainerNode::reportMemoryUsage(memoryObjectInfo);
- info.addVector(m_customFonts);
+ info.addMember(m_customFonts);
info.addMember(m_url);
info.addMember(m_baseURL);
info.addMember(m_baseURLOverride);
@@ -6274,16 +5881,9 @@ void Document::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
info.addMember(m_frame);
info.addMember(m_cachedResourceLoader);
info.addMember(m_elemSheet);
- info.addMember(m_pageUserSheet);
- if (m_pageGroupUserSheets)
- info.addInstrumentedVectorPtr(m_pageGroupUserSheets);
- if (m_userSheets)
- info.addInstrumentedVectorPtr(m_userSheets);
+ info.addMember(m_styleSheetCollection);
info.addHashSet(m_nodeIterators);
info.addHashSet(m_ranges);
- info.addListHashSet(m_styleSheetCandidateNodes);
- info.addMember(m_preferredStylesheetSet);
- info.addMember(m_selectedStylesheetSet);
info.addMember(m_title.string());
info.addMember(m_rawTitle.string());
info.addMember(m_xmlEncoding);
@@ -6292,17 +5892,17 @@ void Document::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
info.addHashMap(m_documentNamedItemCollections);
info.addHashMap(m_windowNamedItemCollections);
#if ENABLE(DASHBOARD_SUPPORT)
- info.addVector(m_dashboardRegions);
+ info.addMember(m_dashboardRegions);
#endif
info.addHashMap(m_cssCanvasElements);
- info.addVector(m_iconURLs);
+ info.addMember(m_iconURLs);
info.addHashSet(m_documentSuspensionCallbackElements);
info.addHashSet(m_mediaVolumeCallbackElements);
info.addHashSet(m_privateBrowsingStateChangedElements);
info.addHashMap(m_elementsByAccessKey);
info.addMember(m_eventQueue);
info.addHashSet(m_mediaCanStartListeners);
- info.addVector(m_pendingTasks);
+ info.addMember(m_pendingTasks);
}
#if ENABLE(UNDO_MANAGER)
@@ -6378,6 +5978,11 @@ PassRefPtr<ElementAttributeData> Document::cachedImmutableAttributeData(const El
return attributeData.release();
}
+bool Document::haveStylesheetsLoaded() const
+{
+ return !m_styleSheetCollection->hasPendingSheets() || m_ignorePendingStylesheets;
+}
+
Localizer& Document::getLocalizer(const AtomicString& locale)
{
AtomicString localeKey = locale;
diff --git a/Source/WebCore/dom/Document.h b/Source/WebCore/dom/Document.h
index d8119c30b..f6d700ac0 100644
--- a/Source/WebCore/dom/Document.h
+++ b/Source/WebCore/dom/Document.h
@@ -78,6 +78,7 @@ class DocumentFragment;
class DocumentLoader;
class DocumentMarkerController;
class DocumentParser;
+class DocumentStyleSheetCollection;
class DocumentType;
class DocumentWeakReference;
class DynamicNodeListCacheBase;
@@ -485,34 +486,14 @@ public:
return m_styleResolver.get();
}
- /**
- * Updates the pending sheet count and then calls updateActiveStylesheets.
- */
- enum RemovePendingSheetNotificationType {
- RemovePendingSheetNotifyImmediately,
- RemovePendingSheetNotifyLater
- };
-
- void removePendingSheet(RemovePendingSheetNotificationType = RemovePendingSheetNotifyImmediately);
void notifyRemovePendingSheetIfNeeded();
- /**
- * This method returns true if all top-level stylesheets have loaded (including
- * any @imports that they may be loading).
- */
- bool haveStylesheetsLoaded() const
- {
- return m_pendingStylesheets <= 0 || m_ignorePendingStylesheets;
- }
+ bool haveStylesheetsLoaded() const;
- /**
- * Increments the number of pending sheets. The <link> elements
- * invoke this to add themselves to the loading list.
- */
- void addPendingSheet() { m_pendingStylesheets++; }
+ // This is a DOM function.
+ StyleSheetList* styleSheets();
- void addStyleSheetCandidateNode(Node*, bool createdByParser);
- void removeStyleSheetCandidateNode(Node*);
+ DocumentStyleSheetCollection* styleSheetCollection() { return m_styleSheetCollection.get(); }
bool gotoAnchorNeededAfterStylesheetsLoad() { return m_gotoAnchorNeededAfterStylesheetsLoad; }
void setGotoAnchorNeededAfterStylesheetsLoad(bool b) { m_gotoAnchorNeededAfterStylesheetsLoad = b; }
@@ -530,17 +511,6 @@ public:
void evaluateMediaQueryList();
- bool usesSiblingRules() const { return m_usesSiblingRules || m_usesSiblingRulesOverride; }
- void setUsesSiblingRules(bool b) { m_usesSiblingRulesOverride = b; }
- bool usesFirstLineRules() const { return m_usesFirstLineRules; }
- bool usesFirstLetterRules() const { return m_usesFirstLetterRules; }
- void setUsesFirstLetterRules(bool b) { m_usesFirstLetterRules = b; }
- bool usesBeforeAfterRules() const { return m_usesBeforeAfterRules || m_usesBeforeAfterRulesOverride; }
- void setUsesBeforeAfterRules(bool b) { m_usesBeforeAfterRulesOverride = b; }
- bool usesRemUnits() const { return m_usesRemUnits; }
- bool usesLinkRules() const { return linkColor() != visitedLinkColor() || m_usesLinkRules; }
- void setUsesLinkRules(bool b) { m_usesLinkRules = b; }
-
// Never returns 0.
FormController* formController();
Vector<String> formElementsState() const;
@@ -556,7 +526,7 @@ public:
PassRefPtr<NodeIterator> createNodeIterator(Node* root, unsigned whatToShow,
PassRefPtr<NodeFilter>, bool expandEntityReferences, ExceptionCode&);
- PassRefPtr<TreeWalker> createTreeWalker(Node* root, unsigned whatToShow,
+ PassRefPtr<TreeWalker> createTreeWalker(Node* root, unsigned whatToShow,
PassRefPtr<NodeFilter>, bool expandEntityReferences, ExceptionCode&);
// Special support for editing
@@ -649,17 +619,6 @@ public:
bool canNavigate(Frame* targetFrame);
Frame* findUnsafeParentScrollPropagationBoundary();
- CSSStyleSheet* pageUserSheet();
- void clearPageUserSheet();
- void updatePageUserSheet();
-
- const Vector<RefPtr<CSSStyleSheet> >* pageGroupUserSheets() const;
- void clearPageGroupUserSheets();
- void updatePageGroupUserSheets();
-
- const Vector<RefPtr<CSSStyleSheet> >* documentUserSheets() const { return m_userSheets.get(); }
- void addUserSheet(PassRefPtr<StyleSheetContents> userSheet);
-
CSSStyleSheet* elementSheet();
virtual PassRefPtr<DocumentParser> createParser();
@@ -716,8 +675,6 @@ public:
MouseEventWithHitTestResults prepareMouseEvent(const HitTestRequest&, const LayoutPoint&, const PlatformMouseEvent&);
- StyleSheetList* styleSheets();
-
/* Newly proposed CSS3 mechanism for selecting alternate
stylesheets using the DOM. May be subject to change as
spec matures. - dwh
@@ -974,7 +931,8 @@ public:
enum PendingSheetLayout { NoLayoutWithPendingSheets, DidLayoutWithPendingSheets, IgnoreLayoutWithPendingSheets };
bool didLayoutWithPendingStylesheets() const { return m_pendingSheetLayout == DidLayoutWithPendingSheets; }
-
+
+ bool hasNodesWithPlaceholderStyle() const { return m_hasNodesWithPlaceholderStyle; }
void setHasNodesWithPlaceholderStyle() { m_hasNodesWithPlaceholderStyle = true; }
const Vector<IconURL>& iconURLs();
@@ -1194,6 +1152,13 @@ public:
PassRefPtr<ElementAttributeData> cachedImmutableAttributeData(const Element*, const Vector<Attribute>&);
+ void didRemoveAllPendingStylesheet();
+ void setNeedsNotifyRemoveAllPendingStylesheet() { m_needsNotifyRemoveAllPendingStylesheet = true; }
+ void clearStyleResolver();
+ void notifySeamlessChildDocumentsOfStylesheetUpdate() const;
+
+ bool inStyleRecalc() { return m_inStyleRecalc; }
+
Localizer& getLocalizer(const AtomicString& locale);
protected:
@@ -1241,19 +1206,8 @@ private:
void buildAccessKeyMap(TreeScope* root);
void createStyleResolver();
- void clearStyleResolver();
- void combineCSSFeatureFlags();
- void resetCSSFeatureFlags();
-
- bool updateActiveStylesheets(StyleResolverUpdateFlag);
- void collectActiveStylesheets(Vector<RefPtr<StyleSheet> >&);
- bool testAddedStylesheetRequiresStyleRecalc(StyleSheetContents*);
- void analyzeStylesheetChange(StyleResolverUpdateFlag, const Vector<RefPtr<StyleSheet> >& newStylesheets, bool& requiresStyleResolverReset, bool& requiresFullStyleRecalc);
- void didRemoveAllPendingStylesheet();
- void setNeedsNotifyRemoveAllPendingStylesheet() { m_needsNotifyRemoveAllPendingStylesheet = true; }
void seamlessParentUpdatedStylesheets();
- void notifySeamlessChildDocumentsOfStylesheetUpdate() const;
void deleteCustomFonts();
@@ -1290,6 +1244,17 @@ private:
OwnPtr<StyleResolver> m_styleResolver;
bool m_didCalculateStyleResolver;
bool m_hasDirtyStyleResolver;
+ bool m_hasNodesWithPlaceholderStyle;
+ bool m_needsNotifyRemoveAllPendingStylesheet;
+ // But sometimes you need to ignore pending stylesheet count to
+ // force an immediate layout when requested by JS.
+ bool m_ignorePendingStylesheets;
+
+ // If we do ignore the pending stylesheet count, then we need to add a boolean
+ // to track that this happened so that we can do a full repaint when the stylesheets
+ // do eventually load.
+ PendingSheetLayout m_pendingSheetLayout;
+
Vector<OwnPtr<FontData> > m_customFonts;
Frame* m_frame;
@@ -1323,29 +1288,7 @@ private:
RefPtr<DocumentType> m_docType;
OwnPtr<DOMImplementation> m_implementation;
- // Track the number of currently loading top-level stylesheets needed for rendering.
- // Sheets loaded using the @import directive are not included in this count.
- // We use this count of pending sheets to detect when we can begin attaching
- // elements and when it is safe to execute scripts.
- int m_pendingStylesheets;
-
- // But sometimes you need to ignore pending stylesheet count to
- // force an immediate layout when requested by JS.
- bool m_ignorePendingStylesheets : 1;
- bool m_needsNotifyRemoveAllPendingStylesheet : 1;
-
- // If we do ignore the pending stylesheet count, then we need to add a boolean
- // to track that this happened so that we can do a full repaint when the stylesheets
- // do eventually load.
- PendingSheetLayout m_pendingSheetLayout;
-
- bool m_hasNodesWithPlaceholderStyle;
-
RefPtr<CSSStyleSheet> m_elemSheet;
- RefPtr<CSSStyleSheet> m_pageUserSheet;
- mutable OwnPtr<Vector<RefPtr<CSSStyleSheet> > > m_pageGroupUserSheets;
- OwnPtr<Vector<RefPtr<CSSStyleSheet> > > m_userSheets;
- mutable bool m_pageGroupUserSheetCacheValid;
bool m_printing;
bool m_paginatedForScreen;
@@ -1374,11 +1317,9 @@ private:
MutationObserverOptions m_mutationObserverTypes;
#endif
- RefPtr<StyleSheetList> m_styleSheets; // All of the stylesheets that are currently in effect for our media type and stylesheet set.
- bool m_hadActiveLoadingStylesheet;
-
- typedef ListHashSet<Node*, 32> StyleSheetCandidateListHashSet;
- StyleSheetCandidateListHashSet m_styleSheetCandidateNodes; // All of the nodes that could potentially provide stylesheets to the document (<link>, <style>, <?xml-stylesheet>)
+
+ OwnPtr<DocumentStyleSheetCollection> m_styleSheetCollection;
+ RefPtr<StyleSheetList> m_styleSheetList;
OwnPtr<FormController> m_formController;
@@ -1386,9 +1327,6 @@ private:
Color m_visitedLinkColor;
Color m_activeLinkColor;
- String m_preferredStylesheetSet;
- String m_selectedStylesheetSet;
-
bool m_loadingSheet;
bool m_visuallyOrdered;
ReadyState m_readyState;
@@ -1399,14 +1337,6 @@ private:
bool m_inStyleRecalc;
bool m_closeAfterStyleRecalc;
- bool m_usesSiblingRules;
- bool m_usesSiblingRulesOverride;
- bool m_usesFirstLineRules;
- bool m_usesFirstLetterRules;
- bool m_usesBeforeAfterRules;
- bool m_usesBeforeAfterRulesOverride;
- bool m_usesRemUnits;
- bool m_usesLinkRules;
bool m_gotoAnchorNeededAfterStylesheetsLoad;
bool m_isDNSPrefetchEnabled;
bool m_haveExplicitlyDisabledDNSPrefetch;
diff --git a/Source/WebCore/dom/DocumentStyleSheetCollection.cpp b/Source/WebCore/dom/DocumentStyleSheetCollection.cpp
new file mode 100644
index 000000000..70f542713
--- /dev/null
+++ b/Source/WebCore/dom/DocumentStyleSheetCollection.cpp
@@ -0,0 +1,484 @@
+/*
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ * (C) 2001 Dirk Mueller (mueller@kde.org)
+ * (C) 2006 Alexey Proskuryakov (ap@webkit.org)
+ * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All rights reserved.
+ * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
+ * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved.
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
+ * Copyright (C) Research In Motion Limited 2010-2011. 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 "DocumentStyleSheetCollection.h"
+
+#include "CSSStyleSheet.h"
+#include "Document.h"
+#include "Element.h"
+#include "HTMLLinkElement.h"
+#include "HTMLNames.h"
+#include "HTMLStyleElement.h"
+#include "Page.h"
+#include "PageGroup.h"
+#include "ProcessingInstruction.h"
+#include "SVGNames.h"
+#include "SVGStyleElement.h"
+#include "SelectorChecker.h"
+#include "Settings.h"
+#include "StyleResolver.h"
+#include "StyleSheetContents.h"
+#include "StyleSheetList.h"
+#include "UserContentURLPattern.h"
+#include "WebCoreMemoryInstrumentation.h"
+#include <wtf/MemoryInstrumentationVector.h>
+
+namespace WebCore {
+
+using namespace HTMLNames;
+
+DocumentStyleSheetCollection::DocumentStyleSheetCollection(Document* document)
+ : m_document(document)
+ , m_pendingStylesheets(0)
+ , m_pageGroupUserSheetCacheValid(false)
+ , m_hadActiveLoadingStylesheet(false)
+ , m_needsUpdateActiveStylesheetsOnStyleRecalc(false)
+ , m_usesSiblingRules(false)
+ , m_usesSiblingRulesOverride(false)
+ , m_usesFirstLineRules(false)
+ , m_usesFirstLetterRules(false)
+ , m_usesBeforeAfterRules(false)
+ , m_usesBeforeAfterRulesOverride(false)
+ , m_usesRemUnits(false)
+{
+}
+
+DocumentStyleSheetCollection::~DocumentStyleSheetCollection()
+{
+ if (m_pageUserSheet)
+ m_pageUserSheet->clearOwnerNode();
+ if (m_pageGroupUserSheets) {
+ for (size_t i = 0; i < m_pageGroupUserSheets->size(); ++i)
+ (*m_pageGroupUserSheets)[i]->clearOwnerNode();
+ }
+ if (m_userSheets) {
+ for (size_t i = 0; i < m_userSheets->size(); ++i)
+ (*m_userSheets)[i]->clearOwnerNode();
+ }
+}
+
+void DocumentStyleSheetCollection::combineCSSFeatureFlags()
+{
+ // 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).
+ StyleResolver* styleResolver = m_document->styleResolver();
+ m_usesSiblingRules = m_usesSiblingRules || styleResolver->usesSiblingRules();
+ m_usesFirstLineRules = m_usesFirstLineRules || styleResolver->usesFirstLineRules();
+ m_usesBeforeAfterRules = m_usesBeforeAfterRules || styleResolver->usesBeforeAfterRules();
+}
+
+void DocumentStyleSheetCollection::resetCSSFeatureFlags()
+{
+ StyleResolver* styleResolver = m_document->styleResolver();
+ m_usesSiblingRules = styleResolver->usesSiblingRules();
+ m_usesFirstLineRules = styleResolver->usesFirstLineRules();
+ m_usesBeforeAfterRules = styleResolver->usesBeforeAfterRules();
+}
+
+CSSStyleSheet* DocumentStyleSheetCollection::pageUserSheet()
+{
+ if (m_pageUserSheet)
+ return m_pageUserSheet.get();
+
+ Page* owningPage = m_document->page();
+ if (!owningPage)
+ return 0;
+
+ String userSheetText = owningPage->userStyleSheet();
+ if (userSheetText.isEmpty())
+ return 0;
+
+ // Parse the sheet and cache it.
+ m_pageUserSheet = CSSStyleSheet::createInline(m_document, m_document->settings()->userStyleSheetLocation());
+ m_pageUserSheet->contents()->setIsUserStyleSheet(true);
+ m_pageUserSheet->contents()->parseString(userSheetText);
+ return m_pageUserSheet.get();
+}
+
+void DocumentStyleSheetCollection::clearPageUserSheet()
+{
+ if (m_pageUserSheet) {
+ m_pageUserSheet = 0;
+ m_document->styleResolverChanged(DeferRecalcStyle);
+ }
+}
+
+void DocumentStyleSheetCollection::updatePageUserSheet()
+{
+ clearPageUserSheet();
+ if (pageUserSheet())
+ m_document->styleResolverChanged(RecalcStyleImmediately);
+}
+
+const Vector<RefPtr<CSSStyleSheet> >* DocumentStyleSheetCollection::pageGroupUserSheets() const
+{
+ if (m_pageGroupUserSheetCacheValid)
+ return m_pageGroupUserSheets.get();
+
+ m_pageGroupUserSheetCacheValid = true;
+
+ Page* owningPage = m_document->page();
+ if (!owningPage)
+ return 0;
+
+ const PageGroup& pageGroup = owningPage->group();
+ const UserStyleSheetMap* sheetsMap = pageGroup.userStyleSheets();
+ if (!sheetsMap)
+ return 0;
+
+ UserStyleSheetMap::const_iterator end = sheetsMap->end();
+ for (UserStyleSheetMap::const_iterator it = sheetsMap->begin(); it != end; ++it) {
+ const UserStyleSheetVector* sheets = it->second.get();
+ for (unsigned i = 0; i < sheets->size(); ++i) {
+ const UserStyleSheet* sheet = sheets->at(i).get();
+ if (sheet->injectedFrames() == InjectInTopFrameOnly && m_document->ownerElement())
+ continue;
+ if (!UserContentURLPattern::matchesPatterns(m_document->url(), sheet->whitelist(), sheet->blacklist()))
+ continue;
+ RefPtr<CSSStyleSheet> groupSheet = CSSStyleSheet::createInline(const_cast<Document*>(m_document), sheet->url());
+ if (!m_pageGroupUserSheets)
+ m_pageGroupUserSheets = adoptPtr(new Vector<RefPtr<CSSStyleSheet> >);
+ m_pageGroupUserSheets->append(groupSheet);
+ groupSheet->contents()->setIsUserStyleSheet(sheet->level() == UserStyleUserLevel);
+ groupSheet->contents()->parseString(sheet->source());
+ }
+ }
+
+ return m_pageGroupUserSheets.get();
+}
+
+void DocumentStyleSheetCollection::clearPageGroupUserSheets()
+{
+ m_pageGroupUserSheetCacheValid = false;
+ if (m_pageGroupUserSheets && m_pageGroupUserSheets->size()) {
+ m_pageGroupUserSheets->clear();
+ m_document->styleResolverChanged(DeferRecalcStyle);
+ }
+}
+
+void DocumentStyleSheetCollection::updatePageGroupUserSheets()
+{
+ clearPageGroupUserSheets();
+ if (pageGroupUserSheets() && pageGroupUserSheets()->size())
+ m_document->styleResolverChanged(RecalcStyleImmediately);
+}
+
+void DocumentStyleSheetCollection::addUserSheet(PassRefPtr<StyleSheetContents> userSheet)
+{
+ if (!m_userSheets)
+ m_userSheets = adoptPtr(new Vector<RefPtr<CSSStyleSheet> >);
+ m_userSheets->append(CSSStyleSheet::create(userSheet, m_document));
+ m_document->styleResolverChanged(RecalcStyleImmediately);
+}
+
+// This method is called whenever a top-level stylesheet has finished loading.
+void DocumentStyleSheetCollection::removePendingSheet(RemovePendingSheetNotificationType notification)
+{
+ // Make sure we knew this sheet was pending, and that our count isn't out of sync.
+ ASSERT(m_pendingStylesheets > 0);
+
+ m_pendingStylesheets--;
+
+#ifdef INSTRUMENT_LAYOUT_SCHEDULING
+ if (!ownerElement())
+ printf("Stylesheet loaded at time %d. %d stylesheets still remain.\n", elapsedTime(), m_pendingStylesheets);
+#endif
+
+ if (m_pendingStylesheets)
+ return;
+
+ if (notification == RemovePendingSheetNotifyLater) {
+ m_document->setNeedsNotifyRemoveAllPendingStylesheet();
+ return;
+ }
+
+ m_document->didRemoveAllPendingStylesheet();
+}
+
+void DocumentStyleSheetCollection::addStyleSheetCandidateNode(Node* node, bool createdByParser)
+{
+ if (!node->inDocument())
+ return;
+
+ // Until the <body> exists, we have no choice but to compare document positions,
+ // since styles outside of the body and head continue to be shunted into the head
+ // (and thus can shift to end up before dynamically added DOM content that is also
+ // outside the body).
+ if ((createdByParser && m_document->body()) || m_styleSheetCandidateNodes.isEmpty()) {
+ m_styleSheetCandidateNodes.add(node);
+ return;
+ }
+
+ // Determine an appropriate insertion point.
+ StyleSheetCandidateListHashSet::iterator begin = m_styleSheetCandidateNodes.begin();
+ StyleSheetCandidateListHashSet::iterator end = m_styleSheetCandidateNodes.end();
+ StyleSheetCandidateListHashSet::iterator it = end;
+ Node* followingNode = 0;
+ do {
+ --it;
+ Node* n = *it;
+ unsigned short position = n->compareDocumentPosition(node);
+ if (position == Node::DOCUMENT_POSITION_FOLLOWING) {
+ m_styleSheetCandidateNodes.insertBefore(followingNode, node);
+ return;
+ }
+ followingNode = n;
+ } while (it != begin);
+
+ m_styleSheetCandidateNodes.insertBefore(followingNode, node);
+}
+
+void DocumentStyleSheetCollection::removeStyleSheetCandidateNode(Node* node)
+{
+ m_styleSheetCandidateNodes.remove(node);
+}
+
+void DocumentStyleSheetCollection::collectActiveStyleSheets(Vector<RefPtr<StyleSheet> >& sheets)
+{
+ if (m_document->settings() && !m_document->settings()->authorAndUserStylesEnabled())
+ return;
+
+ StyleSheetCandidateListHashSet::iterator begin = m_styleSheetCandidateNodes.begin();
+ StyleSheetCandidateListHashSet::iterator end = m_styleSheetCandidateNodes.end();
+ for (StyleSheetCandidateListHashSet::iterator it = begin; it != end; ++it) {
+ Node* n = *it;
+ StyleSheet* sheet = 0;
+ if (n->nodeType() == Node::PROCESSING_INSTRUCTION_NODE) {
+ // Processing instruction (XML documents only).
+ // We don't support linking to embedded CSS stylesheets, see <https://bugs.webkit.org/show_bug.cgi?id=49281> for discussion.
+ ProcessingInstruction* pi = static_cast<ProcessingInstruction*>(n);
+ sheet = pi->sheet();
+#if ENABLE(XSLT)
+ // Don't apply XSL transforms to already transformed documents -- <rdar://problem/4132806>
+ if (pi->isXSL() && !m_document->transformSourceDocument()) {
+ // Don't apply XSL transforms until loading is finished.
+ if (!m_document->parsing())
+ m_document->applyXSLTransform(pi);
+ return;
+ }
+#endif
+ } else if ((n->isHTMLElement() && (n->hasTagName(linkTag) || n->hasTagName(styleTag)))
+#if ENABLE(SVG)
+ || (n->isSVGElement() && n->hasTagName(SVGNames::styleTag))
+#endif
+ ) {
+ Element* e = static_cast<Element*>(n);
+ AtomicString title = e->getAttribute(titleAttr);
+ bool enabledViaScript = false;
+ if (e->hasLocalName(linkTag)) {
+ // <LINK> element
+ HTMLLinkElement* linkElement = static_cast<HTMLLinkElement*>(n);
+ if (linkElement->isDisabled())
+ continue;
+ enabledViaScript = linkElement->isEnabledViaScript();
+ if (linkElement->styleSheetIsLoading()) {
+ // it is loading but we should still decide which style sheet set to use
+ if (!enabledViaScript && !title.isEmpty() && m_preferredStylesheetSetName.isEmpty()) {
+ const AtomicString& rel = e->getAttribute(relAttr);
+ if (!rel.contains("alternate")) {
+ m_preferredStylesheetSetName = title;
+ m_selectedStylesheetSetName = title;
+ }
+ }
+ continue;
+ }
+ if (!linkElement->sheet())
+ title = nullAtom;
+ }
+ // Get the current preferred styleset. This is the
+ // set of sheets that will be enabled.
+#if ENABLE(SVG)
+ if (n->isSVGElement() && n->hasTagName(SVGNames::styleTag))
+ sheet = static_cast<SVGStyleElement*>(n)->sheet();
+ else
+#endif
+ if (e->hasLocalName(linkTag))
+ sheet = static_cast<HTMLLinkElement*>(n)->sheet();
+ else
+ // <STYLE> element
+ sheet = static_cast<HTMLStyleElement*>(n)->sheet();
+ // Check to see if this sheet belongs to a styleset
+ // (thus making it PREFERRED or ALTERNATE rather than
+ // PERSISTENT).
+ AtomicString rel = e->getAttribute(relAttr);
+ if (!enabledViaScript && !title.isEmpty()) {
+ // Yes, we have a title.
+ if (m_preferredStylesheetSetName.isEmpty()) {
+ // No preferred set has been established. If
+ // we are NOT an alternate sheet, then establish
+ // us as the preferred set. Otherwise, just ignore
+ // this sheet.
+ if (e->hasLocalName(styleTag) || !rel.contains("alternate"))
+ m_preferredStylesheetSetName = m_selectedStylesheetSetName = title;
+ }
+ if (title != m_preferredStylesheetSetName)
+ sheet = 0;
+ }
+
+ if (rel.contains("alternate") && title.isEmpty())
+ sheet = 0;
+ }
+ if (sheet)
+ sheets.append(sheet);
+ }
+}
+
+bool DocumentStyleSheetCollection::testAddedStyleSheetRequiresStyleRecalc(StyleSheetContents* stylesheet)
+{
+ // See if all rules on the sheet are scoped to some specific ids or classes.
+ // Then test if we actually have any of those in the tree at the moment.
+ HashSet<AtomicStringImpl*> idScopes;
+ HashSet<AtomicStringImpl*> classScopes;
+ if (!StyleResolver::determineStylesheetSelectorScopes(stylesheet, idScopes, classScopes))
+ return true;
+ // Invalidate the subtrees that match the scopes.
+ Node* node = m_document->firstChild();
+ while (node) {
+ if (!node->isStyledElement()) {
+ node = node->traverseNextNode();
+ continue;
+ }
+ StyledElement* element = static_cast<StyledElement*>(node);
+ if (SelectorChecker::elementMatchesSelectorScopes(element, idScopes, classScopes)) {
+ element->setNeedsStyleRecalc();
+ // The whole subtree is now invalidated, we can skip to the next sibling.
+ node = node->traverseNextSibling();
+ continue;
+ }
+ node = node->traverseNextNode();
+ }
+ return false;
+}
+
+void DocumentStyleSheetCollection::analyzeStyleSheetChange(UpdateFlag updateFlag, const Vector<RefPtr<StyleSheet> >& newStylesheets, bool& requiresStyleResolverReset, bool& requiresFullStyleRecalc)
+{
+ requiresStyleResolverReset = true;
+ requiresFullStyleRecalc = true;
+
+ // Stylesheets of <style> elements that @import stylesheets are active but loading. We need to trigger a full recalc when such loads are done.
+ bool hasActiveLoadingStylesheet = false;
+ unsigned newStylesheetCount = newStylesheets.size();
+ for (unsigned i = 0; i < newStylesheetCount; ++i) {
+ if (newStylesheets[i]->isLoading())
+ hasActiveLoadingStylesheet = true;
+ }
+ if (m_hadActiveLoadingStylesheet && !hasActiveLoadingStylesheet) {
+ m_hadActiveLoadingStylesheet = false;
+ return;
+ }
+ m_hadActiveLoadingStylesheet = hasActiveLoadingStylesheet;
+
+ if (updateFlag != OptimizedUpdate)
+ return;
+ if (!m_document->styleResolverIfExists())
+ return;
+
+ // See if we are just adding stylesheets.
+ unsigned oldStylesheetCount = m_authorStyleSheets.size();
+ if (newStylesheetCount < oldStylesheetCount)
+ return;
+ for (unsigned i = 0; i < oldStylesheetCount; ++i) {
+ if (m_authorStyleSheets[i] != newStylesheets[i])
+ return;
+ }
+ requiresStyleResolverReset = false;
+
+ // If we are already parsing the body and so may have significant amount of elements, put some effort into trying to avoid style recalcs.
+ if (!m_document->body() || m_document->hasNodesWithPlaceholderStyle())
+ return;
+ for (unsigned i = oldStylesheetCount; i < newStylesheetCount; ++i) {
+ if (!newStylesheets[i]->isCSSStyleSheet())
+ return;
+ if (newStylesheets[i]->disabled())
+ continue;
+ if (testAddedStyleSheetRequiresStyleRecalc(static_cast<CSSStyleSheet*>(newStylesheets[i].get())->contents()))
+ return;
+ }
+ requiresFullStyleRecalc = false;
+}
+
+static bool styleSheetsUseRemUnits(const Vector<RefPtr<StyleSheet> >& sheets)
+{
+ for (unsigned i = 0; i < sheets.size(); ++i) {
+ if (!sheets[i]->isCSSStyleSheet())
+ continue;
+ if (static_cast<CSSStyleSheet*>(sheets[i].get())->contents()->usesRemUnits())
+ return true;
+ }
+ return false;
+}
+
+bool DocumentStyleSheetCollection::updateActiveStyleSheets(UpdateFlag updateFlag)
+{
+ if (m_document->inStyleRecalc()) {
+ // SVG <use> element may manage to invalidate style selector in the middle of a style recalc.
+ // https://bugs.webkit.org/show_bug.cgi?id=54344
+ // FIXME: This should be fixed in SVG and the call site replaced by ASSERT(!m_inStyleRecalc).
+ m_needsUpdateActiveStylesheetsOnStyleRecalc = true;
+ m_document->scheduleForcedStyleRecalc();
+ return false;
+
+ }
+ if (!m_document->renderer() || !m_document->attached())
+ return false;
+
+ Vector<RefPtr<StyleSheet> > newStylesheets;
+ collectActiveStyleSheets(newStylesheets);
+
+ bool requiresStyleResolverReset;
+ bool requiresFullStyleRecalc;
+ analyzeStyleSheetChange(updateFlag, newStylesheets, requiresStyleResolverReset, requiresFullStyleRecalc);
+
+ if (requiresStyleResolverReset)
+ m_document->clearStyleResolver();
+ else {
+ m_document->styleResolver()->appendAuthorStylesheets(m_authorStyleSheets.size(), newStylesheets);
+ resetCSSFeatureFlags();
+ }
+ m_authorStyleSheets.swap(newStylesheets);
+
+ m_usesRemUnits = styleSheetsUseRemUnits(m_authorStyleSheets);
+ m_needsUpdateActiveStylesheetsOnStyleRecalc = false;
+
+ m_document->notifySeamlessChildDocumentsOfStylesheetUpdate();
+
+ return requiresFullStyleRecalc;
+}
+
+void DocumentStyleSheetCollection::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
+{
+ MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::DOM);
+ info.addMember(m_pageUserSheet);
+ info.addMember(m_pageGroupUserSheets);
+ info.addMember(m_userSheets);
+ info.addMember(m_authorStyleSheets);
+ info.addListHashSet(m_styleSheetCandidateNodes);
+ info.addMember(m_preferredStylesheetSetName);
+ info.addMember(m_selectedStylesheetSetName);
+}
+
+}
diff --git a/Source/WebCore/dom/DocumentStyleSheetCollection.h b/Source/WebCore/dom/DocumentStyleSheetCollection.h
new file mode 100644
index 000000000..a8104dfd9
--- /dev/null
+++ b/Source/WebCore/dom/DocumentStyleSheetCollection.h
@@ -0,0 +1,143 @@
+/*
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ * (C) 2001 Dirk Mueller (mueller@kde.org)
+ * (C) 2006 Alexey Proskuryakov (ap@webkit.org)
+ * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All rights reserved.
+ * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
+ * Copyright (C) 2011 Google 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.
+ *
+ */
+
+#ifndef DocumentStyleSheetCollection_h
+#define DocumentStyleSheetCollection_h
+
+#include <wtf/FastAllocBase.h>
+#include <wtf/ListHashSet.h>
+#include <wtf/RefPtr.h>
+#include <wtf/Vector.h>
+#include <wtf/text/WTFString.h>
+
+namespace WebCore {
+
+class CSSStyleSheet;
+class Document;
+class Node;
+class StyleSheet;
+class StyleSheetContents;
+class StyleSheetList;
+
+class DocumentStyleSheetCollection {
+ WTF_MAKE_FAST_ALLOCATED;
+public:
+ DocumentStyleSheetCollection(Document*);
+ ~DocumentStyleSheetCollection();
+
+ const Vector<RefPtr<StyleSheet> >& authorStyleSheets() { return m_authorStyleSheets; }
+
+ CSSStyleSheet* pageUserSheet();
+ const Vector<RefPtr<CSSStyleSheet> >* pageGroupUserSheets() const;
+ const Vector<RefPtr<CSSStyleSheet> >* documentUserSheets() const { return m_userSheets.get(); }
+
+ void addStyleSheetCandidateNode(Node*, bool createdByParser);
+ void removeStyleSheetCandidateNode(Node*);
+
+ void clearPageUserSheet();
+ void updatePageUserSheet();
+ void clearPageGroupUserSheets();
+ void updatePageGroupUserSheets();
+
+ void addUserSheet(PassRefPtr<StyleSheetContents> userSheet);
+
+ bool needsUpdateActiveStylesheetsOnStyleRecalc() { return m_needsUpdateActiveStylesheetsOnStyleRecalc; }
+
+ enum UpdateFlag { FullUpdate, OptimizedUpdate };
+ bool updateActiveStyleSheets(UpdateFlag);
+
+ String preferredStylesheetSetName() const { return m_preferredStylesheetSetName; }
+ String selectedStylesheetSetName() const { return m_selectedStylesheetSetName; }
+ void setPreferredStylesheetSetName(const String& name) { m_preferredStylesheetSetName = name; }
+ void setSelectedStylesheetSetName(const String& name) { m_selectedStylesheetSetName = name; }
+
+ void addPendingSheet() { m_pendingStylesheets++; }
+ enum RemovePendingSheetNotificationType {
+ RemovePendingSheetNotifyImmediately,
+ RemovePendingSheetNotifyLater
+ };
+ void removePendingSheet(RemovePendingSheetNotificationType = RemovePendingSheetNotifyImmediately);
+
+ bool hasPendingSheets() const { return m_pendingStylesheets > 0; }
+
+ bool usesSiblingRules() const { return m_usesSiblingRules || m_usesSiblingRulesOverride; }
+ void setUsesSiblingRulesOverride(bool b) { m_usesSiblingRulesOverride = b; }
+ bool usesFirstLineRules() const { return m_usesFirstLineRules; }
+ bool usesFirstLetterRules() const { return m_usesFirstLetterRules; }
+ void setUsesFirstLetterRules(bool b) { m_usesFirstLetterRules = b; }
+ bool usesBeforeAfterRules() const { return m_usesBeforeAfterRules || m_usesBeforeAfterRulesOverride; }
+ void setUsesBeforeAfterRulesOverride(bool b) { m_usesBeforeAfterRulesOverride = b; }
+ bool usesRemUnits() const { return m_usesRemUnits; }
+ void setUsesRemUnit(bool b) { m_usesRemUnits = b; }
+
+ void combineCSSFeatureFlags();
+ void resetCSSFeatureFlags();
+
+ void reportMemoryUsage(MemoryObjectInfo*) const;
+
+private:
+ void collectActiveStyleSheets(Vector<RefPtr<StyleSheet> >&);
+ bool testAddedStyleSheetRequiresStyleRecalc(StyleSheetContents*);
+ void analyzeStyleSheetChange(UpdateFlag, const Vector<RefPtr<StyleSheet> >& newStylesheets, bool& requiresStyleResolverReset, bool& requiresFullStyleRecalc);
+
+ Document* m_document;
+
+ Vector<RefPtr<StyleSheet> > m_authorStyleSheets;
+
+ // Track the number of currently loading top-level stylesheets needed for rendering.
+ // Sheets loaded using the @import directive are not included in this count.
+ // We use this count of pending sheets to detect when we can begin attaching
+ // elements and when it is safe to execute scripts.
+ int m_pendingStylesheets;
+
+ RefPtr<CSSStyleSheet> m_pageUserSheet;
+ mutable OwnPtr<Vector<RefPtr<CSSStyleSheet> > > m_pageGroupUserSheets;
+ OwnPtr<Vector<RefPtr<CSSStyleSheet> > > m_userSheets;
+ mutable bool m_pageGroupUserSheetCacheValid;
+
+ bool m_hadActiveLoadingStylesheet;
+ bool m_needsUpdateActiveStylesheetsOnStyleRecalc;
+
+ typedef ListHashSet<Node*, 32> StyleSheetCandidateListHashSet;
+ StyleSheetCandidateListHashSet m_styleSheetCandidateNodes;
+
+ String m_preferredStylesheetSetName;
+ String m_selectedStylesheetSetName;
+
+ bool m_usesSiblingRules;
+ bool m_usesSiblingRulesOverride;
+ bool m_usesFirstLineRules;
+ bool m_usesFirstLetterRules;
+ bool m_usesBeforeAfterRules;
+ bool m_usesBeforeAfterRulesOverride;
+ bool m_usesRemUnits;
+};
+
+}
+
+#endif
+
diff --git a/Source/WebCore/dom/DocumentType.idl b/Source/WebCore/dom/DocumentType.idl
index 729023271..4206de70d 100644
--- a/Source/WebCore/dom/DocumentType.idl
+++ b/Source/WebCore/dom/DocumentType.idl
@@ -35,6 +35,9 @@ module core {
readonly attribute [TreatReturnedNullStringAs=Null] DOMString systemId;
readonly attribute [TreatReturnedNullStringAs=Null] DOMString internalSubset;
+ // DOM 4
+ void remove()
+ raises(DOMException);
};
}
diff --git a/Source/WebCore/dom/Element.cpp b/Source/WebCore/dom/Element.cpp
index 15804a3fa..9176f8977 100644
--- a/Source/WebCore/dom/Element.cpp
+++ b/Source/WebCore/dom/Element.cpp
@@ -999,7 +999,7 @@ void Element::removedFrom(ContainerNode* insertionPoint)
void Element::attach()
{
suspendPostAttachCallbacks();
- RenderWidget::suspendWidgetHierarchyUpdates();
+ WidgetHierarchyUpdatesSuspensionScope suspendWidgetHierarchyUpdates;
createRendererIfNeeded();
StyleResolverParentPusher parentPusher(this);
@@ -1028,7 +1028,6 @@ void Element::attach()
}
}
- RenderWidget::resumeWidgetHierarchyUpdates();
resumePostAttachCallbacks();
}
@@ -1042,7 +1041,7 @@ void Element::unregisterNamedFlowContentNode()
void Element::detach()
{
- RenderWidget::suspendWidgetHierarchyUpdates();
+ WidgetHierarchyUpdatesSuspensionScope suspendWidgetHierarchyUpdates;
unregisterNamedFlowContentNode();
cancelFocusAppearanceUpdate();
if (hasRareData()) {
@@ -1055,8 +1054,6 @@ void Element::detach()
shadow->detach();
}
ContainerNode::detach();
-
- RenderWidget::resumeWidgetHierarchyUpdates();
}
bool Element::pseudoStyleCacheIsInvalid(const RenderStyle* currentStyle, RenderStyle* newStyle)
@@ -1176,7 +1173,7 @@ void Element::recalcStyle(StyleChange change)
// 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()->usesRemUnits() && document()->documentElement() == this && ch != NoChange && currentStyle && newStyle && currentStyle->fontSize() != newStyle->fontSize()) {
+ if (document()->styleSheetCollection()->usesRemUnits() && document()->documentElement() == this && ch != NoChange && currentStyle && newStyle && currentStyle->fontSize() != newStyle->fontSize()) {
// Cached RenderStyles may depend on the rem units.
document()->styleResolver()->invalidateMatchedPropertiesCache();
change = Force;
diff --git a/Source/WebCore/dom/Element.idl b/Source/WebCore/dom/Element.idl
index 4bd64ed4e..6b3427c3a 100644
--- a/Source/WebCore/dom/Element.idl
+++ b/Source/WebCore/dom/Element.idl
@@ -120,6 +120,10 @@ module core {
readonly attribute Element nextElementSibling;
readonly attribute unsigned long childElementCount;
+ // DOM 4
+ void remove()
+ raises(DOMException);
+
#if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT
// CSSOM View Module API
ClientRectList getClientRects();
diff --git a/Source/WebCore/dom/ElementAttributeData.cpp b/Source/WebCore/dom/ElementAttributeData.cpp
index 03f7b81fc..5a7f34125 100644
--- a/Source/WebCore/dom/ElementAttributeData.cpp
+++ b/Source/WebCore/dom/ElementAttributeData.cpp
@@ -31,6 +31,7 @@
#include "CSSStyleSheet.h"
#include "StyledElement.h"
#include "WebCoreMemoryInstrumentation.h"
+#include <wtf/MemoryInstrumentationVector.h>
namespace WebCore {
@@ -300,7 +301,7 @@ void ElementAttributeData::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo)
info.addMember(m_classNames);
info.addMember(m_idForStyleResolution);
if (m_isMutable)
- info.addVector(mutableAttributeVector());
+ info.addMember(mutableAttributeVector());
for (unsigned i = 0, len = length(); i < len; i++)
info.addMember(*attributeItem(i));
}
diff --git a/Source/WebCore/dom/EventNames.h b/Source/WebCore/dom/EventNames.h
index b3cd846ea..136f7aac2 100644
--- a/Source/WebCore/dom/EventNames.h
+++ b/Source/WebCore/dom/EventNames.h
@@ -229,7 +229,7 @@ namespace WebCore {
macro(unmute) \
macro(icechange) \
macro(icecandidate) \
- macro(negotationneeded) \
+ macro(negotiationneeded) \
\
macro(show) \
\
diff --git a/Source/WebCore/dom/Node.cpp b/Source/WebCore/dom/Node.cpp
index aef669c50..8ab3352f6 100644
--- a/Source/WebCore/dom/Node.cpp
+++ b/Source/WebCore/dom/Node.cpp
@@ -630,8 +630,6 @@ void Node::remove(ExceptionCode& ec)
{
if (ContainerNode* parent = parentNode())
parent->removeChild(this, ec);
- else
- ec = HIERARCHY_REQUEST_ERR;
}
void Node::normalize()
diff --git a/Source/WebCore/dom/ProcessingInstruction.cpp b/Source/WebCore/dom/ProcessingInstruction.cpp
index ef13b4690..6759becbc 100644
--- a/Source/WebCore/dom/ProcessingInstruction.cpp
+++ b/Source/WebCore/dom/ProcessingInstruction.cpp
@@ -23,9 +23,10 @@
#include "CSSStyleSheet.h"
#include "CachedCSSStyleSheet.h"
+#include "CachedResourceLoader.h"
#include "CachedXSLStyleSheet.h"
#include "Document.h"
-#include "CachedResourceLoader.h"
+#include "DocumentStyleSheetCollection.h"
#include "ExceptionCode.h"
#include "Frame.h"
#include "FrameLoader.h"
@@ -65,7 +66,7 @@ ProcessingInstruction::~ProcessingInstruction()
m_cachedSheet->removeClient(this);
if (inDocument())
- document()->removeStyleSheetCandidateNode(this);
+ document()->styleSheetCollection()->removeStyleSheetCandidateNode(this);
}
void ProcessingInstruction::setData(const String& data, ExceptionCode&)
@@ -160,7 +161,7 @@ void ProcessingInstruction::checkStyleSheet()
return;
m_loading = true;
- document()->addPendingSheet();
+ document()->styleSheetCollection()->addPendingSheet();
ResourceRequest request(document()->completeURL(href));
#if ENABLE(XSLT)
@@ -180,7 +181,7 @@ void ProcessingInstruction::checkStyleSheet()
else {
// The request may have been denied if (for example) the stylesheet is local and the document is remote.
m_loading = false;
- document()->removePendingSheet();
+ document()->styleSheetCollection()->removePendingSheet();
}
}
}
@@ -198,7 +199,7 @@ bool ProcessingInstruction::isLoading() const
bool ProcessingInstruction::sheetLoaded()
{
if (!isLoading()) {
- document()->removePendingSheet();
+ document()->styleSheetCollection()->removePendingSheet();
return true;
}
return false;
@@ -293,7 +294,7 @@ Node::InsertionNotificationRequest ProcessingInstruction::insertedInto(Container
Node::insertedInto(insertionPoint);
if (!insertionPoint->inDocument())
return InsertionDone;
- document()->addStyleSheetCandidateNode(this, m_createdByParser);
+ document()->styleSheetCollection()->addStyleSheetCandidateNode(this, m_createdByParser);
checkStyleSheet();
return InsertionDone;
}
@@ -304,7 +305,7 @@ void ProcessingInstruction::removedFrom(ContainerNode* insertionPoint)
if (!insertionPoint->inDocument())
return;
- document()->removeStyleSheetCandidateNode(this);
+ document()->styleSheetCollection()->removeStyleSheetCandidateNode(this);
if (m_sheet) {
ASSERT(m_sheet->ownerNode() == this);
diff --git a/Source/WebCore/dom/StyleElement.cpp b/Source/WebCore/dom/StyleElement.cpp
index dd4de2901..ff22fe9db 100644
--- a/Source/WebCore/dom/StyleElement.cpp
+++ b/Source/WebCore/dom/StyleElement.cpp
@@ -24,6 +24,7 @@
#include "Attribute.h"
#include "ContentSecurityPolicy.h"
#include "Document.h"
+#include "DocumentStyleSheetCollection.h"
#include "Element.h"
#include "MediaList.h"
#include "MediaQueryEvaluator.h"
@@ -63,7 +64,7 @@ void StyleElement::insertedIntoDocument(Document* document, Element* element)
{
ASSERT(document);
ASSERT(element);
- document->addStyleSheetCandidateNode(element, m_createdByParser);
+ document->styleSheetCollection()->addStyleSheetCandidateNode(element, m_createdByParser);
if (m_createdByParser)
return;
@@ -74,7 +75,7 @@ void StyleElement::removedFromDocument(Document* document, Element* element)
{
ASSERT(document);
ASSERT(element);
- document->removeStyleSheetCandidateNode(element);
+ document->styleSheetCollection()->removeStyleSheetCandidateNode(element);
if (m_sheet)
clearSheet();
@@ -90,7 +91,7 @@ void StyleElement::clearDocumentData(Document* document, Element* element)
m_sheet->clearOwnerNode();
if (element->inDocument())
- document->removeStyleSheetCandidateNode(element);
+ document->styleSheetCollection()->removeStyleSheetCandidateNode(element);
}
void StyleElement::childrenChanged(Element* element)
@@ -152,7 +153,7 @@ void StyleElement::createSheet(Element* e, WTF::OrdinalNumber startLineNumber, c
Document* document = e->document();
if (m_sheet) {
if (m_sheet->isLoading())
- document->removePendingSheet();
+ document->styleSheetCollection()->removePendingSheet();
clearSheet();
}
@@ -168,7 +169,7 @@ void StyleElement::createSheet(Element* e, WTF::OrdinalNumber startLineNumber, c
MediaQueryEvaluator screenEval("screen", true);
MediaQueryEvaluator printEval("print", true);
if (screenEval.eval(mediaQueries.get()) || printEval.eval(mediaQueries.get())) {
- document->addPendingSheet();
+ document->styleSheetCollection()->addPendingSheet();
m_loading = true;
m_sheet = CSSStyleSheet::createInline(e, KURL(), document->inputEncoding());
@@ -197,14 +198,14 @@ bool StyleElement::sheetLoaded(Document* document)
if (isLoading())
return false;
- document->removePendingSheet();
+ document->styleSheetCollection()->removePendingSheet();
return true;
}
void StyleElement::startLoadingDynamicSheet(Document* document)
{
ASSERT(document);
- document->addPendingSheet();
+ document->styleSheetCollection()->addPendingSheet();
}
}
diff --git a/Source/WebCore/html/DateTimeFieldsState.cpp b/Source/WebCore/html/DateTimeFieldsState.cpp
index 8e2bd6c1c..990389dc4 100644
--- a/Source/WebCore/html/DateTimeFieldsState.cpp
+++ b/Source/WebCore/html/DateTimeFieldsState.cpp
@@ -67,6 +67,13 @@ DateTimeFieldsState::DateTimeFieldsState()
{
}
+unsigned DateTimeFieldsState::hour23() const
+{
+ if (!hasHour() || !hasAMPM())
+ return emptyValue;
+ return (m_hour % 12) + (m_ampm == AMPMValuePM ? 12 : 0);
+}
+
DateTimeFieldsState DateTimeFieldsState::restoreFormControlState(const FormControlState& state)
{
DateTimeFieldsState dateTimeFieldsState;
diff --git a/Source/WebCore/html/DateTimeFieldsState.h b/Source/WebCore/html/DateTimeFieldsState.h
index b6240629e..6fb444071 100644
--- a/Source/WebCore/html/DateTimeFieldsState.h
+++ b/Source/WebCore/html/DateTimeFieldsState.h
@@ -57,6 +57,7 @@ public:
AMPMValue ampm() const { return m_ampm; }
unsigned dayOfMonth() const { return m_dayOfMonth; }
unsigned hour() const { return m_hour; }
+ unsigned hour23() const;
unsigned millisecond() const { return m_millisecond; }
unsigned minute() const { return m_minute; }
unsigned month() const { return m_month; }
@@ -88,7 +89,7 @@ private:
unsigned m_year;
unsigned m_month;
unsigned m_dayOfMonth;
- unsigned m_hour;
+ unsigned m_hour; // 1 to 12.
unsigned m_minute;
unsigned m_second;
unsigned m_millisecond;
diff --git a/Source/WebCore/html/HTMLLinkElement.cpp b/Source/WebCore/html/HTMLLinkElement.cpp
index d2868b610..fdc7a5cce 100644
--- a/Source/WebCore/html/HTMLLinkElement.cpp
+++ b/Source/WebCore/html/HTMLLinkElement.cpp
@@ -30,6 +30,7 @@
#include "CachedResource.h"
#include "CachedResourceLoader.h"
#include "Document.h"
+#include "DocumentStyleSheetCollection.h"
#include "EventSender.h"
#include "Frame.h"
#include "FrameLoader.h"
@@ -87,7 +88,7 @@ HTMLLinkElement::~HTMLLinkElement()
m_cachedSheet->removeClient(this);
if (inDocument())
- document()->removeStyleSheetCandidateNode(this);
+ document()->styleSheetCollection()->removeStyleSheetCandidateNode(this);
linkLoadEventSender().cancelEvent(this);
}
@@ -254,7 +255,7 @@ Node::InsertionNotificationRequest HTMLLinkElement::insertedInto(ContainerNode*
if (m_isInShadowTree)
return InsertionDone;
- document()->addStyleSheetCandidateNode(this, m_createdByParser);
+ document()->styleSheetCollection()->addStyleSheetCandidateNode(this, m_createdByParser);
process();
return InsertionDone;
@@ -272,7 +273,7 @@ void HTMLLinkElement::removedFrom(ContainerNode* insertionPoint)
ASSERT(!m_sheet);
return;
}
- document()->removeStyleSheetCandidateNode(this);
+ document()->styleSheetCollection()->removeStyleSheetCandidateNode(this);
if (m_sheet)
clearSheet();
@@ -455,7 +456,7 @@ void HTMLLinkElement::addPendingSheet(PendingSheetType type)
if (m_pendingSheetType == NonBlocking)
return;
- document()->addPendingSheet();
+ document()->styleSheetCollection()->addPendingSheet();
}
void HTMLLinkElement::removePendingSheet(RemovePendingSheetNotificationType notification)
@@ -471,10 +472,10 @@ void HTMLLinkElement::removePendingSheet(RemovePendingSheetNotificationType noti
return;
}
- document()->removePendingSheet(
+ document()->styleSheetCollection()->removePendingSheet(
notification == RemovePendingSheetNotifyImmediately
- ? Document::RemovePendingSheetNotifyImmediately
- : Document::RemovePendingSheetNotifyLater);
+ ? DocumentStyleSheetCollection::RemovePendingSheetNotifyImmediately
+ : DocumentStyleSheetCollection::RemovePendingSheetNotifyLater);
}
DOMSettableTokenList* HTMLLinkElement::sizes() const
diff --git a/Source/WebCore/html/HTMLQuoteElement.cpp b/Source/WebCore/html/HTMLQuoteElement.cpp
index 05a33ab5e..d5be2f2f7 100644
--- a/Source/WebCore/html/HTMLQuoteElement.cpp
+++ b/Source/WebCore/html/HTMLQuoteElement.cpp
@@ -24,6 +24,7 @@
#include "HTMLQuoteElement.h"
#include "Document.h"
+#include "DocumentStyleSheetCollection.h"
#include "HTMLNames.h"
namespace WebCore {
@@ -44,7 +45,7 @@ PassRefPtr<HTMLQuoteElement> HTMLQuoteElement::create(const QualifiedName& tagNa
Node::InsertionNotificationRequest HTMLQuoteElement::insertedInto(ContainerNode* insertionPoint)
{
if (hasTagName(qTag))
- document()->setUsesBeforeAfterRules(true);
+ document()->styleSheetCollection()->setUsesBeforeAfterRulesOverride(true);
return HTMLElement::insertedInto(insertionPoint);
}
diff --git a/Source/WebCore/html/HTMLViewSourceDocument.cpp b/Source/WebCore/html/HTMLViewSourceDocument.cpp
index 3de813770..a4da71a25 100644
--- a/Source/WebCore/html/HTMLViewSourceDocument.cpp
+++ b/Source/WebCore/html/HTMLViewSourceDocument.cpp
@@ -27,6 +27,7 @@
#include "Attribute.h"
#include "DOMImplementation.h"
+#include "DocumentStyleSheetCollection.h"
#include "HTMLAnchorElement.h"
#include "HTMLBRElement.h"
#include "HTMLBaseElement.h"
@@ -52,7 +53,7 @@ HTMLViewSourceDocument::HTMLViewSourceDocument(Frame* frame, const KURL& url, co
: HTMLDocument(frame, url)
, m_type(mimeType)
{
- setUsesBeforeAfterRules(true);
+ styleSheetCollection()->setUsesBeforeAfterRulesOverride(true);
setIsViewSource(true);
setCompatibilityMode(QuirksMode);
diff --git a/Source/WebCore/html/TimeInputType.cpp b/Source/WebCore/html/TimeInputType.cpp
index 4b5bb1f15..a0051513a 100644
--- a/Source/WebCore/html/TimeInputType.cpp
+++ b/Source/WebCore/html/TimeInputType.cpp
@@ -48,6 +48,7 @@
#include "KeyboardEvent.h"
#include "Localizer.h"
#include "ShadowRoot.h"
+#include <wtf/text/WTFString.h>
#endif
namespace WebCore {
@@ -149,13 +150,32 @@ void TimeInputType::DateTimeEditControlOwnerImpl::didFocusOnControl()
void TimeInputType::DateTimeEditControlOwnerImpl::editControlValueChanged()
{
RefPtr<HTMLInputElement> input(m_timeInputType.element());
- input->setValueInternal(m_timeInputType.serialize(Decimal::fromDouble(m_timeInputType.m_dateTimeEditElement->valueAsDouble())), DispatchNoEvent);
+ input->setValueInternal(m_timeInputType.m_dateTimeEditElement->value(), DispatchNoEvent);
input->setNeedsStyleRecalc();
input->dispatchFormControlInputEvent();
input->dispatchFormControlChangeEvent();
input->notifyFormStateChanged();
}
+
+String TimeInputType::DateTimeEditControlOwnerImpl::formatDateTimeFieldsState(const DateTimeFieldsState& dateTimeFieldsState) const
+{
+ if (!dateTimeFieldsState.hasHour() || !dateTimeFieldsState.hasMinute() || !dateTimeFieldsState.hasAMPM())
+ return emptyString();
+ if (dateTimeFieldsState.hasMillisecond() && dateTimeFieldsState.millisecond())
+ return String::format("%02u:%02u:%02u.%03u",
+ dateTimeFieldsState.hour23(),
+ dateTimeFieldsState.minute(),
+ dateTimeFieldsState.hasSecond() ? dateTimeFieldsState.second() : 0,
+ dateTimeFieldsState.millisecond());
+ if (dateTimeFieldsState.hasSecond() && dateTimeFieldsState.second())
+ return String::format("%02u:%02u:%02u",
+ dateTimeFieldsState.hour23(),
+ dateTimeFieldsState.minute(),
+ dateTimeFieldsState.second());
+ return String::format("%02u:%02u", dateTimeFieldsState.hour23(), dateTimeFieldsState.minute());
+}
+
bool TimeInputType::hasCustomFocusLogic() const
{
return false;
@@ -271,7 +291,7 @@ void TimeInputType::restoreFormControlState(const FormControlState& state)
setMillisecondToDateComponents(createStepRange(AnyIsDefaultStep).minimum().toDouble(), &date);
DateTimeFieldsState dateTimeFieldsState = DateTimeFieldsState::restoreFormControlState(state);
m_dateTimeEditElement->setValueAsDateTimeFieldsState(dateTimeFieldsState, date);
- element()->setValueInternal(serialize(Decimal::fromDouble(m_dateTimeEditElement->valueAsDouble())), DispatchNoEvent);
+ element()->setValueInternal(m_dateTimeEditElement->value(), DispatchNoEvent);
}
FormControlState TimeInputType::saveFormControlState() const
diff --git a/Source/WebCore/html/TimeInputType.h b/Source/WebCore/html/TimeInputType.h
index 0787c3a21..59e272102 100644
--- a/Source/WebCore/html/TimeInputType.h
+++ b/Source/WebCore/html/TimeInputType.h
@@ -71,6 +71,7 @@ private:
virtual void didBlurFromControl() OVERRIDE FINAL;
virtual void didFocusOnControl() OVERRIDE FINAL;
virtual void editControlValueChanged() OVERRIDE FINAL;
+ virtual String formatDateTimeFieldsState(const DateTimeFieldsState&) const OVERRIDE FINAL;
virtual bool isEditControlOwnerDisabled() const OVERRIDE FINAL;
virtual bool isEditControlOwnerReadOnly() const OVERRIDE FINAL;
diff --git a/Source/WebCore/html/parser/HTMLTreeBuilder.cpp b/Source/WebCore/html/parser/HTMLTreeBuilder.cpp
index 131cdbff6..940800ef8 100644
--- a/Source/WebCore/html/parser/HTMLTreeBuilder.cpp
+++ b/Source/WebCore/html/parser/HTMLTreeBuilder.cpp
@@ -686,9 +686,7 @@ void HTMLTreeBuilder::processStartTagForInBody(AtomicHTMLToken* token)
}
if (!m_framesetOk)
return;
- ExceptionCode ec = 0;
- m_tree.openElements()->bodyElement()->remove(ec);
- ASSERT(!ec);
+ m_tree.openElements()->bodyElement()->remove(ASSERT_NO_EXCEPTION);
m_tree.openElements()->popUntil(m_tree.openElements()->bodyElement());
m_tree.openElements()->popHTMLBodyElement();
ASSERT(m_tree.openElements()->top() == m_tree.openElements()->htmlElement());
diff --git a/Source/WebCore/html/shadow/DateTimeEditElement.cpp b/Source/WebCore/html/shadow/DateTimeEditElement.cpp
index 07befd874..ad4870ca8 100644
--- a/Source/WebCore/html/shadow/DateTimeEditElement.cpp
+++ b/Source/WebCore/html/shadow/DateTimeEditElement.cpp
@@ -450,6 +450,13 @@ void DateTimeEditElement::updateUIState()
}
}
+String DateTimeEditElement::value() const
+{
+ if (!m_editControlOwner)
+ return emptyString();
+ return m_editControlOwner->formatDateTimeFieldsState(valueAsDateTimeFieldsState());
+}
+
DateTimeFieldsState DateTimeEditElement::valueAsDateTimeFieldsState() const
{
DateTimeFieldsState dateTimeFieldsState;
@@ -458,20 +465,6 @@ DateTimeFieldsState DateTimeEditElement::valueAsDateTimeFieldsState() const
return dateTimeFieldsState;
}
-double DateTimeEditElement::valueAsDouble() const
-{
- double value = 0;
-
- for (size_t fieldIndex = 0; fieldIndex < m_fields.size(); ++fieldIndex) {
- const DateTimeFieldElement* const field = m_fields[fieldIndex];
- if (!field->hasValue())
- return std::numeric_limits<double>::quiet_NaN();
- value += field->valueAsDouble();
- }
-
- return value;
-}
-
} // namespace WebCore
#endif
diff --git a/Source/WebCore/html/shadow/DateTimeEditElement.h b/Source/WebCore/html/shadow/DateTimeEditElement.h
index e547cbdea..84cf229c6 100644
--- a/Source/WebCore/html/shadow/DateTimeEditElement.h
+++ b/Source/WebCore/html/shadow/DateTimeEditElement.h
@@ -55,6 +55,7 @@ public:
virtual void didBlurFromControl() = 0;
virtual void didFocusOnControl() = 0;
virtual void editControlValueChanged() = 0;
+ virtual String formatDateTimeFieldsState(const DateTimeFieldsState&) const = 0;
virtual bool isEditControlOwnerDisabled() const = 0;
virtual bool isEditControlOwnerReadOnly() const = 0;
};
@@ -88,8 +89,8 @@ public:
void setEmptyValue(const LayoutParameters&, const DateComponents& dateForReadOnlyField);
void setValueAsDate(const LayoutParameters&, const DateComponents&);
void setValueAsDateTimeFieldsState(const DateTimeFieldsState&, const DateComponents& dateForReadOnlyField);
+ String value() const;
DateTimeFieldsState valueAsDateTimeFieldsState() const;
- double valueAsDouble() const;
private:
static const size_t invalidFieldIndex = static_cast<size_t>(-1);
diff --git a/Source/WebCore/html/shadow/DateTimeFieldElement.cpp b/Source/WebCore/html/shadow/DateTimeFieldElement.cpp
index 74817570a..a0ec51e59 100644
--- a/Source/WebCore/html/shadow/DateTimeFieldElement.cpp
+++ b/Source/WebCore/html/shadow/DateTimeFieldElement.cpp
@@ -186,11 +186,6 @@ void DateTimeFieldElement::updateVisibleValue(EventBehavior eventBehavior)
m_fieldOwner->fieldValueChanged();
}
-double DateTimeFieldElement::valueAsDouble() const
-{
- return hasValue() ? valueAsInteger() * unitInMillisecond() : std::numeric_limits<double>::quiet_NaN();
-}
-
} // namespace WebCore
#endif
diff --git a/Source/WebCore/html/shadow/DateTimeFieldElement.h b/Source/WebCore/html/shadow/DateTimeFieldElement.h
index e8d25cf91..f5c9810a1 100644
--- a/Source/WebCore/html/shadow/DateTimeFieldElement.h
+++ b/Source/WebCore/html/shadow/DateTimeFieldElement.h
@@ -70,7 +70,6 @@ public:
virtual void stepDown() = 0;
virtual void stepUp() = 0;
virtual String value() const = 0;
- double valueAsDouble() const;
virtual int valueAsInteger() const = 0;
virtual String visibleValue() const = 0;
@@ -83,7 +82,6 @@ protected:
void initialize(const AtomicString& shadowPseudoId, const String& axHelpText);
virtual int maximum() const = 0;
virtual int minimum() const = 0;
- virtual double unitInMillisecond() const = 0;
void updateVisibleValue(EventBehavior);
private:
diff --git a/Source/WebCore/html/shadow/DateTimeFieldElements.cpp b/Source/WebCore/html/shadow/DateTimeFieldElements.cpp
index 2016c69a8..c2f458a21 100644
--- a/Source/WebCore/html/shadow/DateTimeFieldElements.cpp
+++ b/Source/WebCore/html/shadow/DateTimeFieldElements.cpp
@@ -30,7 +30,6 @@
#include "DateComponents.h"
#include "DateTimeFieldsState.h"
#include "LocalizedStrings.h"
-#include <wtf/DateMath.h>
namespace WebCore {
@@ -68,11 +67,6 @@ void DateTimeAMPMFieldElement::setValueAsDateTimeFieldsState(const DateTimeField
setEmptyValue(dateForReadOnlyField);
}
-double DateTimeAMPMFieldElement::unitInMillisecond() const
-{
- return msPerHour * 12;
-}
-
// ----------------------------
DateTimeHourFieldElement::DateTimeHourFieldElement(Document* document, FieldOwner& fieldOwner, int minimum, int maximum)
@@ -173,11 +167,6 @@ void DateTimeHourFieldElement::setValueAsInteger(int valueAsHour23, EventBehavio
DateTimeNumericFieldElement::setValueAsInteger(range().minimum && !value ? m_alignment : value, eventBehavior);
}
-double DateTimeHourFieldElement::unitInMillisecond() const
-{
- return msPerHour;
-}
-
int DateTimeHourFieldElement::valueAsInteger() const
{
return hasValue() ? DateTimeNumericFieldElement::valueAsInteger() % m_alignment : -1;
@@ -224,11 +213,6 @@ void DateTimeMillisecondFieldElement::setValueAsDateTimeFieldsState(const DateTi
setValueAsInteger(value);
}
-double DateTimeMillisecondFieldElement::unitInMillisecond() const
-{
- return 1;
-}
-
// ----------------------------
DateTimeMinuteFieldElement::DateTimeMinuteFieldElement(Document* document, FieldOwner& fieldOwner)
@@ -270,11 +254,6 @@ void DateTimeMinuteFieldElement::setValueAsDateTimeFieldsState(const DateTimeFie
setValueAsInteger(value);
}
-double DateTimeMinuteFieldElement::unitInMillisecond() const
-{
- return msPerMinute;
-}
-
// ----------------------------
DateTimeSecondFieldElement::DateTimeSecondFieldElement(Document* document, FieldOwner& fieldOwner)
@@ -316,11 +295,6 @@ void DateTimeSecondFieldElement::setValueAsDateTimeFieldsState(const DateTimeFie
setValueAsInteger(value);
}
-double DateTimeSecondFieldElement::unitInMillisecond() const
-{
- return msPerSecond;
-}
-
} // namespace WebCore
#endif
diff --git a/Source/WebCore/html/shadow/DateTimeFieldElements.h b/Source/WebCore/html/shadow/DateTimeFieldElements.h
index e141f838f..23f3403ea 100644
--- a/Source/WebCore/html/shadow/DateTimeFieldElements.h
+++ b/Source/WebCore/html/shadow/DateTimeFieldElements.h
@@ -45,7 +45,6 @@ private:
virtual void populateDateTimeFieldsState(DateTimeFieldsState&) OVERRIDE FINAL;
virtual void setValueAsDate(const DateComponents&) OVERRIDE FINAL;
virtual void setValueAsDateTimeFieldsState(const DateTimeFieldsState&, const DateComponents& dateForReadOnlyField) OVERRIDE FINAL;
- virtual double unitInMillisecond() const OVERRIDE FINAL;
};
@@ -69,7 +68,6 @@ private:
virtual void setValueAsDate(const DateComponents&) OVERRIDE FINAL;
virtual void setValueAsDateTimeFieldsState(const DateTimeFieldsState&, const DateComponents& dateForReadOnlyField) OVERRIDE FINAL;
virtual void setValueAsInteger(int, EventBehavior = DispatchNoEvent) OVERRIDE FINAL;
- virtual double unitInMillisecond() const OVERRIDE FINAL;
virtual int valueAsInteger() const OVERRIDE FINAL;
const int m_alignment;
@@ -88,7 +86,6 @@ private:
virtual void populateDateTimeFieldsState(DateTimeFieldsState&) OVERRIDE FINAL;
virtual void setValueAsDate(const DateComponents&) OVERRIDE FINAL;
virtual void setValueAsDateTimeFieldsState(const DateTimeFieldsState&, const DateComponents& dateForReadOnlyField) OVERRIDE FINAL;
- virtual double unitInMillisecond() const OVERRIDE FINAL;
};
class DateTimeMinuteFieldElement : public DateTimeNumericFieldElement {
@@ -104,7 +101,6 @@ private:
virtual void populateDateTimeFieldsState(DateTimeFieldsState&) OVERRIDE FINAL;
virtual void setValueAsDate(const DateComponents&) OVERRIDE FINAL;
virtual void setValueAsDateTimeFieldsState(const DateTimeFieldsState&, const DateComponents& dateForReadOnlyField) OVERRIDE FINAL;
- virtual double unitInMillisecond() const OVERRIDE FINAL;
};
class DateTimeSecondFieldElement : public DateTimeNumericFieldElement {
@@ -120,7 +116,6 @@ private:
virtual void populateDateTimeFieldsState(DateTimeFieldsState&) OVERRIDE FINAL;
virtual void setValueAsDate(const DateComponents&) OVERRIDE FINAL;
virtual void setValueAsDateTimeFieldsState(const DateTimeFieldsState&, const DateComponents& dateForReadOnlyField) OVERRIDE FINAL;
- virtual double unitInMillisecond() const OVERRIDE FINAL;
};
} // namespace WebCore
diff --git a/Source/WebCore/html/track/TextTrackCue.cpp b/Source/WebCore/html/track/TextTrackCue.cpp
index 299fc1b7c..2fd4f1d4b 100644
--- a/Source/WebCore/html/track/TextTrackCue.cpp
+++ b/Source/WebCore/html/track/TextTrackCue.cpp
@@ -742,8 +742,7 @@ PassRefPtr<TextTrackCueBox> TextTrackCue::getDisplayTree()
void TextTrackCue::removeDisplayTree()
{
- if (m_displayTree->parentNode())
- m_displayTree->remove(ASSERT_NO_EXCEPTION);
+ m_displayTree->remove(ASSERT_NO_EXCEPTION);
}
std::pair<double, double> TextTrackCue::getPositionCoordinates() const
diff --git a/Source/WebCore/inspector/InjectedScriptCanvasModule.cpp b/Source/WebCore/inspector/InjectedScriptCanvasModule.cpp
index db278d976..b1f1dca27 100644
--- a/Source/WebCore/inspector/InjectedScriptCanvasModule.cpp
+++ b/Source/WebCore/inspector/InjectedScriptCanvasModule.cpp
@@ -59,20 +59,30 @@ String InjectedScriptCanvasModule::source() const
return String(reinterpret_cast<const char*>(InjectedScriptCanvasModuleSource_js), sizeof(InjectedScriptCanvasModuleSource_js));
}
+ScriptObject InjectedScriptCanvasModule::wrapCanvas2DContext(const ScriptObject& context)
+{
+ return callWrapContextFunction("wrapCanvas2DContext", context);
+}
+
#if ENABLE(WEBGL)
ScriptObject InjectedScriptCanvasModule::wrapWebGLContext(const ScriptObject& glContext)
{
- ScriptFunctionCall function(injectedScriptObject(), "wrapWebGLContext");
- function.appendArgument(glContext);
+ return callWrapContextFunction("wrapWebGLContext", glContext);
+}
+#endif // ENABLE(WEBGL)
+
+ScriptObject InjectedScriptCanvasModule::callWrapContextFunction(const String& functionName, const ScriptObject& context)
+{
+ ScriptFunctionCall function(injectedScriptObject(), functionName);
+ function.appendArgument(context);
bool hadException = false;
ScriptValue resultValue = callFunctionWithEvalEnabled(function, hadException);
if (hadException || resultValue.hasNoValue() || !resultValue.isObject()) {
ASSERT_NOT_REACHED();
return ScriptObject();
}
- return ScriptObject(glContext.scriptState(), resultValue);
+ return ScriptObject(context.scriptState(), resultValue);
}
-#endif // ENABLE(WEBGL)
void InjectedScriptCanvasModule::captureFrame(ErrorString* errorString, String* traceLogId)
{
diff --git a/Source/WebCore/inspector/InjectedScriptCanvasModule.h b/Source/WebCore/inspector/InjectedScriptCanvasModule.h
index 4de223660..2e960aa6e 100644
--- a/Source/WebCore/inspector/InjectedScriptCanvasModule.h
+++ b/Source/WebCore/inspector/InjectedScriptCanvasModule.h
@@ -50,14 +50,18 @@ public:
static InjectedScriptCanvasModule moduleForState(InjectedScriptManager*, ScriptState*);
+ ScriptObject wrapCanvas2DContext(const ScriptObject&);
#if ENABLE(WEBGL)
- ScriptObject wrapWebGLContext(const ScriptObject& glContext);
+ ScriptObject wrapWebGLContext(const ScriptObject&);
#endif
void captureFrame(ErrorString*, String*);
void dropTraceLog(ErrorString*, const String&);
void traceLog(ErrorString*, const String&, RefPtr<TypeBuilder::Canvas::TraceLog>*);
void replayTraceLog(ErrorString*, const String&, int, String*);
+
+private:
+ ScriptObject callWrapContextFunction(const String&, const ScriptObject&);
};
#endif
diff --git a/Source/WebCore/inspector/InjectedScriptCanvasModuleSource.js b/Source/WebCore/inspector/InjectedScriptCanvasModuleSource.js
index 6780af3c4..26afeeb54 100644
--- a/Source/WebCore/inspector/InjectedScriptCanvasModuleSource.js
+++ b/Source/WebCore/inspector/InjectedScriptCanvasModuleSource.js
@@ -743,7 +743,7 @@ Resource.prototype = {
if (isCapturing) {
var call = wrapFunction.call();
call.setStackTrace(StackTrace.create(1, arguments.callee));
- manager.reportCall(call);
+ manager.captureCall(call);
}
return wrapFunction.result();
};
@@ -767,7 +767,7 @@ Resource.prototype = {
var result = originalFunction.apply(originalObject, arguments);
var stackTrace = StackTrace.create(1, arguments.callee);
var call = new Call(resource, functionName, arguments, result, stackTrace);
- manager.reportCall(call);
+ manager.captureCall(call);
return result;
};
},
@@ -833,6 +833,27 @@ Resource.WrapFunction.prototype = {
}
/**
+ * @param {!Function} resourceConstructor
+ * @return {Function}
+ */
+Resource.WrapFunction.resourceFactoryMethod = function(resourceConstructor)
+{
+ /** @this Resource.WrapFunction */
+ return function()
+ {
+ var wrappedObject = this.result();
+ if (!wrappedObject)
+ return;
+ var resource = new resourceConstructor(wrappedObject);
+ var manager = this._resource.manager();
+ if (manager)
+ manager.registerResource(resource);
+ this.overrideResult(resource.proxyObject());
+ resource.pushCall(this.call());
+ }
+}
+
+/**
* @constructor
* @param {Resource} originalResource
* @param {Object} data
@@ -867,6 +888,10 @@ ReplayableResource.replay = function(obj, cache)
return (obj instanceof ReplayableResource) ? obj.replay(cache).wrappedObject() : obj;
}
+////////////////////////////////////////////////////////////////////////////////
+// WebGL
+////////////////////////////////////////////////////////////////////////////////
+
/**
* @constructor
* @extends {Resource}
@@ -1033,8 +1058,10 @@ WebGLTextureResource.prototype = {
var framebufferResource = glResource.currentBinding(gl.FRAMEBUFFER);
if (framebufferResource)
this.pushCall(new Call(glResource, "bindFramebuffer", [gl.FRAMEBUFFER, framebufferResource]));
- else
- console.error("ASSERT_NOT_REACHED: No FRAMEBUFFER bound while calling gl." + call.functionName());
+ else {
+ // FIXME: Implement this case.
+ console.error("ASSERT_NOT_REACHED: Could not properly process a gl." + call.functionName() + " call while the DRAWING BUFFER is bound.");
+ }
this.pushCall(call);
}
}
@@ -1369,10 +1396,10 @@ WebGLRenderingContextResource.forObject = function(obj)
var resource = Resource.forObject(obj);
if (!resource || resource instanceof WebGLRenderingContextResource)
return resource;
- var call = resource.calls();
- if (!call || !call.length)
+ var calls = resource.calls();
+ if (!calls || !calls.length)
return null;
- resource = call[0].resource();
+ resource = calls[0].resource();
return (resource instanceof WebGLRenderingContextResource) ? resource : null;
}
@@ -1593,7 +1620,7 @@ WebGLRenderingContextResource.prototype = {
}
gl.activeTexture(glState.ACTIVE_TEXTURE);
- return Resource.prototype._doReplayCalls.call(this, data, cache);
+ Resource.prototype._doReplayCalls.call(this, data, cache);
},
/**
@@ -1661,33 +1688,13 @@ WebGLRenderingContextResource.prototype = {
if (!wrapFunctions) {
wrapFunctions = Object.create(null);
- /**
- * @param {string} methodName
- * @param {Function} resourceConstructor
- */
- function createResourceWrapFunction(methodName, resourceConstructor)
- {
- /** @this Resource.WrapFunction */
- wrapFunctions[methodName] = function()
- {
- var wrappedObject = this.result();
- if (!wrappedObject)
- return;
- var resource = new resourceConstructor(wrappedObject);
- var manager = this._resource.manager();
- if (manager)
- manager.registerResource(resource);
- this.overrideResult(resource.proxyObject());
- resource.pushCall(this.call());
- }
- }
- createResourceWrapFunction("createBuffer", WebGLBufferResource);
- createResourceWrapFunction("createShader", WebGLShaderResource);
- createResourceWrapFunction("createProgram", WebGLProgramResource);
- createResourceWrapFunction("createTexture", WebGLTextureResource);
- createResourceWrapFunction("createFramebuffer", WebGLFramebufferResource);
- createResourceWrapFunction("createRenderbuffer", WebGLRenderbufferResource);
- createResourceWrapFunction("getUniformLocation", Resource);
+ wrapFunctions["createBuffer"] = Resource.WrapFunction.resourceFactoryMethod(WebGLBufferResource);
+ wrapFunctions["createShader"] = Resource.WrapFunction.resourceFactoryMethod(WebGLShaderResource);
+ wrapFunctions["createProgram"] = Resource.WrapFunction.resourceFactoryMethod(WebGLProgramResource);
+ wrapFunctions["createTexture"] = Resource.WrapFunction.resourceFactoryMethod(WebGLTextureResource);
+ wrapFunctions["createFramebuffer"] = Resource.WrapFunction.resourceFactoryMethod(WebGLFramebufferResource);
+ wrapFunctions["createRenderbuffer"] = Resource.WrapFunction.resourceFactoryMethod(WebGLRenderbufferResource);
+ wrapFunctions["getUniformLocation"] = Resource.WrapFunction.resourceFactoryMethod(Resource);
/**
* @param {string} methodName
@@ -1753,6 +1760,227 @@ WebGLRenderingContextResource.prototype = {
WebGLRenderingContextResource.prototype.__proto__ = Resource.prototype;
+////////////////////////////////////////////////////////////////////////////////
+// 2D Canvas
+////////////////////////////////////////////////////////////////////////////////
+
+/**
+ * @constructor
+ * @extends {Resource}
+ * @param {CanvasRenderingContext2D} context
+ * @param {Function} replayContextCallback
+ */
+function CanvasRenderingContext2DResource(context, replayContextCallback)
+{
+ Resource.call(this, context);
+ this._replayContextCallback = replayContextCallback;
+ this._attributesStack = [];
+}
+
+/**
+ * @const
+ * @type {Array.<string>}
+ */
+CanvasRenderingContext2DResource.AttributeProperties = [
+ "strokeStyle",
+ "fillStyle",
+ "globalAlpha",
+ "lineWidth",
+ "lineCap",
+ "lineJoin",
+ "miterLimit",
+ "shadowOffsetX",
+ "shadowOffsetY",
+ "shadowBlur",
+ "shadowColor",
+ "globalCompositeOperation",
+ "font",
+ "textAlign",
+ "textBaseline"
+];
+
+/**
+ * @const
+ * @type {Array.<string>}
+ */
+CanvasRenderingContext2DResource.PathMethods = [
+ "beginPath",
+ "moveTo",
+ "closePath",
+ "lineTo",
+ "quadraticCurveTo",
+ "bezierCurveTo",
+ "arcTo",
+ "arc",
+ "rect"
+];
+
+/**
+ * @const
+ * @type {Array.<string>}
+ */
+CanvasRenderingContext2DResource.TransformationMatrixMethods = [
+ "scale",
+ "rotate",
+ "translate",
+ "transform",
+ "setTransform"
+];
+
+CanvasRenderingContext2DResource.prototype = {
+ /**
+ * @override
+ * @param {Object} data
+ * @param {Cache} cache
+ */
+ _populateReplayableData: function(data, cache)
+ {
+ data.replayContextCallback = this._replayContextCallback;
+ data.attributesStack = this._attributesStack.slice(0);
+ data.currentAttributes = this._currentAttributesState();
+ },
+
+ /**
+ * @override
+ * @param {Object} data
+ * @param {Cache} cache
+ */
+ _doReplayCalls: function(data, cache)
+ {
+ this._replayContextCallback = data.replayContextCallback;
+ this._attributesStack = data.attributesStack.slice(0);
+
+ var ctx = Resource.wrappedObject(this._replayContextCallback());
+ this.setWrappedObject(ctx);
+
+ var saveCalls = 0;
+ for (var i = 0, n = data.calls.length; i < n; ++i) {
+ var replayableCall = data.calls[i];
+ if (replayableCall.functionName() === "save") {
+ console.assert(saveCalls < this._attributesStack.length, "Size of attributes stack is less than 'save' calls");
+ this._applyAttributesState(this._attributesStack[saveCalls++]);
+ }
+ this._calls.push(replayableCall.replay(cache));
+ }
+ console.assert(saveCalls === this._attributesStack.length, "Size of attributes stack should be equal to the number of 'save' calls");
+ this._applyAttributesState(data.currentAttributes);
+ },
+
+ /**
+ * @param {Call} call
+ */
+ pushCall_setTransform: function(call)
+ {
+ // FIXME: Remove obsolete transform matrix methods.
+ this.pushCall(call);
+ },
+
+ /**
+ * @param {Call} call
+ */
+ pushCall_beginPath: function(call)
+ {
+ // FIXME: Remove obsolete path methods.
+ this.pushCall(call);
+ },
+
+ /**
+ * @param {Call} call
+ */
+ pushCall_save: function(call)
+ {
+ this._attributesStack.push(this._currentAttributesState());
+ this.pushCall(call);
+ },
+
+ /**
+ * @param {Call} call
+ */
+ pushCall_restore: function(call)
+ {
+ this._attributesStack.pop();
+ // FIXME: Remove obsolete clip,save methods.
+ this.pushCall(call);
+ },
+
+ /**
+ * @return {!Object.<string, string>}
+ */
+ _currentAttributesState: function()
+ {
+ var ctx = this.wrappedObject();
+ var state = {};
+ CanvasRenderingContext2DResource.AttributeProperties.forEach(function(attribute) {
+ state[attribute] = ctx[attribute];
+ });
+ return state;
+ },
+
+ /**
+ * @param {!Object.<string, string>} state
+ */
+ _applyAttributesState: function(state)
+ {
+ var ctx = this.wrappedObject();
+ Object.keys(state).forEach(function(attribute) {
+ ctx[attribute] = state[attribute];
+ });
+ },
+
+ /**
+ * @override
+ * @return {Object.<string, Function>}
+ */
+ _customWrapFunctions: function()
+ {
+ var wrapFunctions = CanvasRenderingContext2DResource._wrapFunctions;
+ if (!wrapFunctions) {
+ wrapFunctions = Object.create(null);
+
+ wrapFunctions["createLinearGradient"] = Resource.WrapFunction.resourceFactoryMethod(Resource);
+ wrapFunctions["createRadialGradient"] = Resource.WrapFunction.resourceFactoryMethod(Resource);
+ wrapFunctions["createPattern"] = Resource.WrapFunction.resourceFactoryMethod(Resource);
+
+ /**
+ * @param {string} methodName
+ * @param {Function=} func
+ */
+ function stateModifyingWrapFunction(methodName, func)
+ {
+ if (func) {
+ /** @this Resource.WrapFunction */
+ wrapFunctions[methodName] = function()
+ {
+ func.call(this._resource, this.call());
+ }
+ } else {
+ /** @this Resource.WrapFunction */
+ wrapFunctions[methodName] = function()
+ {
+ this._resource.pushCall(this.call());
+ }
+ }
+ }
+ CanvasRenderingContext2DResource.TransformationMatrixMethods.forEach(function(methodName) {
+ var func = methodName === "setTransform" ? this.pushCall_setTransform : null;
+ stateModifyingWrapFunction(methodName, func);
+ });
+ CanvasRenderingContext2DResource.PathMethods.forEach(function(methodName) {
+ var func = methodName === "beginPath" ? this.pushCall_beginPath : null;
+ stateModifyingWrapFunction(methodName, func);
+ });
+ stateModifyingWrapFunction("save", this.pushCall_save);
+ stateModifyingWrapFunction("restore", this.pushCall_restore);
+ stateModifyingWrapFunction("clip");
+
+ CanvasRenderingContext2DResource._wrapFunctions = wrapFunctions;
+ }
+ return wrapFunctions;
+ }
+};
+
+CanvasRenderingContext2DResource.prototype.__proto__ = Resource.prototype;
+
/**
* @constructor
*/
@@ -1942,7 +2170,7 @@ ResourceTrackingManager.prototype = {
/**
* @param {Call} call
*/
- reportCall: function(call)
+ captureCall: function(call)
{
if (!this._capturing)
return;
@@ -1988,8 +2216,18 @@ InjectedScript.prototype = {
{
var resource = Resource.forObject(glContext) || new WebGLRenderingContextResource(glContext, this._constructWebGLReplayContext.bind(this, glContext));
this._manager.registerResource(resource);
- var proxy = resource.proxyObject();
- return proxy;
+ return resource.proxyObject();
+ },
+
+ /**
+ * @param {CanvasRenderingContext2D} context
+ * @return {Object}
+ */
+ wrapCanvas2DContext: function(context)
+ {
+ var resource = Resource.forObject(context) || new CanvasRenderingContext2DResource(context, this._constructCanvas2DReplayContext.bind(this, context));
+ this._manager.registerResource(resource);
+ return resource.proxyObject();
},
captureFrame: function()
@@ -2104,6 +2342,29 @@ InjectedScript.prototype = {
// FIXME: Reset the replay GL state and clear the canvas.
}
return replayContext;
+ },
+
+ /**
+ * @param {CanvasRenderingContext2D} originalContext
+ * @return {CanvasRenderingContext2D}
+ */
+ _constructCanvas2DReplayContext: function(originalContext)
+ {
+ var replayContext = originalContext["__replayContext"];
+ if (!replayContext) {
+ var canvas = originalContext.canvas.cloneNode(true);
+ replayContext = /** @type {CanvasRenderingContext2D} */ Resource.wrappedObject(canvas.getContext("2d"));
+ Object.defineProperty(originalContext, "__replayContext", {
+ value: replayContext,
+ writable: false,
+ enumerable: false,
+ configurable: true
+ });
+ this._replayContext = replayContext;
+ } else {
+ // FIXME: Clear the canvas.
+ }
+ return replayContext;
}
}
diff --git a/Source/WebCore/inspector/Inspector.json b/Source/WebCore/inspector/Inspector.json
index 5c18dad95..21d927c21 100644
--- a/Source/WebCore/inspector/Inspector.json
+++ b/Source/WebCore/inspector/Inspector.json
@@ -1567,6 +1567,7 @@
{ "name": "children", "type": "array", "optional": true, "items": { "$ref": "Node" }, "description": "Child nodes of this node when requested with children." },
{ "name": "attributes", "type": "array", "optional": true, "items": { "type": "string" }, "description": "Attributes of the <code>Element</code> node in the form of flat array <code>[name1, value1, name2, value2]</code>." },
{ "name": "documentURL", "type": "string", "optional": true, "description": "Document URL that <code>Document</code> or <code>FrameOwner</code> node points to." },
+ { "name": "baseURL", "type": "string", "optional": true, "description": "Base URL that <code>Document</code> or <code>FrameOwner</code> node uses for URL completion." },
{ "name": "publicId", "type": "string", "optional": true, "description": "<code>DocumentType</code>'s publicId." },
{ "name": "systemId", "type": "string", "optional": true, "description": "<code>DocumentType</code>'s systemId." },
{ "name": "internalSubset", "type": "string", "optional": true, "description": "<code>DocumentType</code>'s internalSubset." },
@@ -2006,11 +2007,11 @@
"description": "This object identifies a CSS rule in a unique way."
},
{
- "id": "PseudoIdRules",
+ "id": "PseudoIdMatches",
"type": "object",
"properties": [
{ "name": "pseudoId", "type": "integer", "description": "Pseudo style identifier (see <code>enum PseudoId</code> in <code>RenderStyleConstants.h</code>)."},
- { "name": "rules", "type": "array", "items": { "$ref": "CSSRule" }, "description": "CSS rules applicable to the pseudo style."}
+ { "name": "matches", "type": "array", "items": { "$ref": "RuleMatch" }, "description": "Matches of CSS rules applicable to the pseudo style."}
],
"description": "CSS rule collection for a single pseudo style."
},
@@ -2019,11 +2020,30 @@
"type": "object",
"properties": [
{ "name": "inlineStyle", "$ref": "CSSStyle", "optional": true, "description": "The ancestor node's inline style, if any, in the style inheritance chain." },
- { "name": "matchedCSSRules", "type": "array", "items": { "$ref": "CSSRule" }, "description": "CSS rules matching the ancestor node in the style inheritance chain." }
+ { "name": "matchedCSSRules", "type": "array", "items": { "$ref": "RuleMatch" }, "description": "Matches of CSS rules matching the ancestor node in the style inheritance chain." }
],
"description": "CSS rule collection for a single pseudo style."
},
{
+ "id": "RuleMatch",
+ "type": "object",
+ "properties": [
+ { "name": "rule", "$ref": "CSSRule", "description": "CSS rule in the match." },
+ { "name": "matchingSelectors", "type": "array", "items": { "type": "integer" }, "description": "Matching selector indices in the rule's selectorList selectors (0-based)." }
+ ],
+ "description": "Match data for a CSS rule."
+ },
+ {
+ "id": "SelectorList",
+ "type": "object",
+ "properties": [
+ { "name": "selectors", "type": "array", "items": { "type": "string" }, "description": "Selectors in the list." },
+ { "name": "text", "type": "string", "description": "Rule selector text." },
+ { "name": "range", "$ref": "SourceRange", "optional": true, "description": "Rule selector range in the underlying resource (if available)." }
+ ],
+ "description": "Selector list data."
+ },
+ {
"id": "CSSStyleAttribute",
"type": "object",
"properties": [
@@ -2060,12 +2080,11 @@
"type": "object",
"properties": [
{ "name": "ruleId", "$ref": "CSSRuleId", "optional": true, "description": "The CSS rule identifier (absent for user agent stylesheet and user-specified stylesheet rules)."},
- { "name": "selectorText", "type": "string", "description": "Rule selector."},
+ { "name": "selectorList", "$ref": "SelectorList", "description": "Rule selector data." },
{ "name": "sourceURL", "type": "string", "optional": true, "description": "Parent stylesheet resource URL (for regular rules)."},
{ "name": "sourceLine", "type": "integer", "description": "Line ordinal of the rule selector start character in the resource."},
{ "name": "origin", "$ref": "StyleSheetOrigin", "description": "Parent stylesheet's origin."},
{ "name": "style", "$ref": "CSSStyle", "description": "Associated style declaration." },
- { "name": "selectorRange", "$ref": "SourceRange", "optional": true, "description": "The rule selector range in the underlying resource (if available)." },
{ "name": "media", "type": "array", "items": { "$ref": "CSSMedia" }, "optional": true, "description": "Media list array (for rules involving media queries). The array enumerates media queries starting with the innermost one, going outwards." }
],
"description": "CSS rule representation."
@@ -2205,8 +2224,8 @@
{ "name": "includeInherited", "type": "boolean", "optional": true, "description": "Whether to include inherited styles (default: true)." }
],
"returns": [
- { "name": "matchedCSSRules", "type": "array", "items": { "$ref": "CSSRule" }, "optional": true, "description": "CSS rules matching this node, from all applicable stylesheets." },
- { "name": "pseudoElements", "type": "array", "items": { "$ref": "PseudoIdRules" }, "optional": true, "description": "Pseudo style rules for this node." },
+ { "name": "matchedCSSRules", "type": "array", "items": { "$ref": "RuleMatch" }, "optional": true, "description": "CSS rules matching this node, from all applicable stylesheets." },
+ { "name": "pseudoElements", "type": "array", "items": { "$ref": "PseudoIdMatches" }, "optional": true, "description": "Pseudo style matches for this node." },
{ "name": "inherited", "type": "array", "items": { "$ref": "InheritedStyleEntry" }, "optional": true, "description": "A chain of inherited styles (from the immediate node parent up to the DOM tree root)." }
],
"description": "Returns requested styles for a DOM node identified by <code>nodeId</code>."
diff --git a/Source/WebCore/inspector/InspectorCSSAgent.cpp b/Source/WebCore/inspector/InspectorCSSAgent.cpp
index 60ebd9312..bbe88d2c0 100644
--- a/Source/WebCore/inspector/InspectorCSSAgent.cpp
+++ b/Source/WebCore/inspector/InspectorCSSAgent.cpp
@@ -678,7 +678,7 @@ bool InspectorCSSAgent::forcePseudoState(Element* element, CSSSelector::PseudoTy
}
}
-void InspectorCSSAgent::getMatchedStylesForNode(ErrorString* errorString, int nodeId, const bool* includePseudo, const bool* includeInherited, RefPtr<TypeBuilder::Array<TypeBuilder::CSS::CSSRule> >& matchedCSSRules, RefPtr<TypeBuilder::Array<TypeBuilder::CSS::PseudoIdRules> >& pseudoIdRules, RefPtr<TypeBuilder::Array<TypeBuilder::CSS::InheritedStyleEntry> >& inheritedEntries)
+void InspectorCSSAgent::getMatchedStylesForNode(ErrorString* errorString, int nodeId, const bool* includePseudo, const bool* includeInherited, RefPtr<TypeBuilder::Array<TypeBuilder::CSS::RuleMatch> >& matchedCSSRules, RefPtr<TypeBuilder::Array<TypeBuilder::CSS::PseudoIdMatches> >& pseudoIdMatches, RefPtr<TypeBuilder::Array<TypeBuilder::CSS::InheritedStyleEntry> >& inheritedEntries)
{
Element* element = elementForId(errorString, nodeId);
if (!element)
@@ -687,44 +687,44 @@ void InspectorCSSAgent::getMatchedStylesForNode(ErrorString* errorString, int no
// Matched rules.
StyleResolver* styleResolver = element->ownerDocument()->styleResolver();
RefPtr<CSSRuleList> matchedRules = styleResolver->styleRulesForElement(element, StyleResolver::AllCSSRules);
- matchedCSSRules = buildArrayForRuleList(matchedRules.get(), styleResolver);
+ matchedCSSRules = buildArrayForMatchedRuleList(matchedRules.get(), styleResolver, element);
// Pseudo elements.
if (!includePseudo || *includePseudo) {
- RefPtr<TypeBuilder::Array<TypeBuilder::CSS::PseudoIdRules> > pseudoElements = TypeBuilder::Array<TypeBuilder::CSS::PseudoIdRules>::create();
+ RefPtr<TypeBuilder::Array<TypeBuilder::CSS::PseudoIdMatches> > pseudoElements = TypeBuilder::Array<TypeBuilder::CSS::PseudoIdMatches>::create();
for (PseudoId pseudoId = FIRST_PUBLIC_PSEUDOID; pseudoId < AFTER_LAST_INTERNAL_PSEUDOID; pseudoId = static_cast<PseudoId>(pseudoId + 1)) {
RefPtr<CSSRuleList> matchedRules = styleResolver->pseudoStyleRulesForElement(element, pseudoId, StyleResolver::AllCSSRules);
if (matchedRules && matchedRules->length()) {
- RefPtr<TypeBuilder::CSS::PseudoIdRules> pseudoStyles = TypeBuilder::CSS::PseudoIdRules::create()
+ RefPtr<TypeBuilder::CSS::PseudoIdMatches> matches = TypeBuilder::CSS::PseudoIdMatches::create()
.setPseudoId(static_cast<int>(pseudoId))
- .setRules(buildArrayForRuleList(matchedRules.get(), styleResolver));
- pseudoElements->addItem(pseudoStyles.release());
+ .setMatches(buildArrayForMatchedRuleList(matchedRules.get(), styleResolver, element));
+ pseudoElements->addItem(matches.release());
}
}
- pseudoIdRules = pseudoElements.release();
+ pseudoIdMatches = pseudoElements.release();
}
// Inherited styles.
if (!includeInherited || *includeInherited) {
- RefPtr<TypeBuilder::Array<TypeBuilder::CSS::InheritedStyleEntry> > inheritedStyles = TypeBuilder::Array<TypeBuilder::CSS::InheritedStyleEntry>::create();
+ RefPtr<TypeBuilder::Array<TypeBuilder::CSS::InheritedStyleEntry> > entries = TypeBuilder::Array<TypeBuilder::CSS::InheritedStyleEntry>::create();
Element* parentElement = element->parentElement();
while (parentElement) {
- StyleResolver* parentStyleResolver= parentElement->ownerDocument()->styleResolver();
+ StyleResolver* parentStyleResolver = parentElement->ownerDocument()->styleResolver();
RefPtr<CSSRuleList> parentMatchedRules = parentStyleResolver->styleRulesForElement(parentElement, StyleResolver::AllCSSRules);
- RefPtr<TypeBuilder::CSS::InheritedStyleEntry> parentStyle = TypeBuilder::CSS::InheritedStyleEntry::create()
- .setMatchedCSSRules(buildArrayForRuleList(parentMatchedRules.get(), styleResolver));
+ RefPtr<TypeBuilder::CSS::InheritedStyleEntry> entry = TypeBuilder::CSS::InheritedStyleEntry::create()
+ .setMatchedCSSRules(buildArrayForMatchedRuleList(parentMatchedRules.get(), styleResolver, parentElement));
if (parentElement->style() && parentElement->style()->length()) {
InspectorStyleSheetForInlineStyle* styleSheet = asInspectorStyleSheet(parentElement);
if (styleSheet)
- parentStyle->setInlineStyle(styleSheet->buildObjectForStyle(styleSheet->styleForId(InspectorCSSId(styleSheet->id(), 0))));
+ entry->setInlineStyle(styleSheet->buildObjectForStyle(styleSheet->styleForId(InspectorCSSId(styleSheet->id(), 0))));
}
- inheritedStyles->addItem(parentStyle.release());
+ entries->addItem(entry.release());
parentElement = parentElement->parentElement();
}
- inheritedEntries = inheritedStyles.release();
+ inheritedEntries = entries.release();
}
}
@@ -1116,6 +1116,23 @@ TypeBuilder::CSS::StyleSheetOrigin::Enum InspectorCSSAgent::detectOrigin(CSSStyl
return origin;
}
+PassRefPtr<TypeBuilder::CSS::CSSRule> InspectorCSSAgent::buildObjectForRule(CSSStyleRule* rule, StyleResolver* styleResolver)
+{
+ if (!rule)
+ return 0;
+
+ // CSSRules returned by StyleResolver::styleRulesForElement lack parent pointers since that infomation is not cheaply available.
+ // Since the inspector wants to walk the parent chain, we construct the full wrappers here.
+ // FIXME: This could be factored better. StyleResolver::styleRulesForElement should return a StyleRule vector, not a CSSRuleList.
+ if (!rule->parentStyleSheet()) {
+ rule = styleResolver->ensureFullCSSOMWrapperForInspector(rule->styleRule());
+ if (!rule)
+ return 0;
+ }
+ InspectorStyleSheet* inspectorStyleSheet = bindStyleSheet(rule->parentStyleSheet());
+ return inspectorStyleSheet ? inspectorStyleSheet->buildObjectForRule(rule) : 0;
+}
+
PassRefPtr<TypeBuilder::Array<TypeBuilder::CSS::CSSRule> > InspectorCSSAgent::buildArrayForRuleList(CSSRuleList* ruleList, StyleResolver* styleResolver)
{
RefPtr<TypeBuilder::Array<TypeBuilder::CSS::CSSRule> > result = TypeBuilder::Array<TypeBuilder::CSS::CSSRule>::create();
@@ -1124,22 +1141,42 @@ PassRefPtr<TypeBuilder::Array<TypeBuilder::CSS::CSSRule> > InspectorCSSAgent::bu
for (unsigned i = 0, size = ruleList->length(); i < size; ++i) {
CSSStyleRule* rule = asCSSStyleRule(ruleList->item(i));
- if (!rule)
+ RefPtr<TypeBuilder::CSS::CSSRule> ruleObject = buildObjectForRule(rule, styleResolver);
+ if (!ruleObject)
continue;
+ result->addItem(ruleObject);
+ }
+ return result.release();
+}
+
+PassRefPtr<TypeBuilder::Array<TypeBuilder::CSS::RuleMatch> > InspectorCSSAgent::buildArrayForMatchedRuleList(CSSRuleList* ruleList, StyleResolver* styleResolver, Element* element)
+{
+ RefPtr<TypeBuilder::Array<TypeBuilder::CSS::RuleMatch> > result = TypeBuilder::Array<TypeBuilder::CSS::RuleMatch>::create();
+ if (!ruleList)
+ return result.release();
- // CSSRules returned by StyleResolver::styleRulesForElement lack parent pointers since that infomation is not cheaply available.
- // Since the inspector wants to walk the parent chain, we construct the full wrappers here.
- // FIXME: This could be factored better. StyleResolver::styleRulesForElement should return a StyleRule vector, not a CSSRuleList.
- if (!rule->parentStyleSheet()) {
- rule = styleResolver->ensureFullCSSOMWrapperForInspector(rule->styleRule());
- if (!rule)
- continue;
+ for (unsigned i = 0, size = ruleList->length(); i < size; ++i) {
+ CSSStyleRule* rule = asCSSStyleRule(ruleList->item(i));
+ RefPtr<TypeBuilder::CSS::CSSRule> ruleObject = buildObjectForRule(rule, styleResolver);
+ if (!ruleObject)
+ continue;
+ RefPtr<TypeBuilder::Array<int> > matchingSelectors = TypeBuilder::Array<int>::create();
+ const CSSSelectorList& selectorList = rule->styleRule()->selectorList();
+ long index = 0;
+ for (CSSSelector* selector = selectorList.first(); selector; selector = CSSSelectorList::next(selector)) {
+ ExceptionCode ec;
+ bool matched = element->webkitMatchesSelector(selector->selectorText(), ec);
+ if (matched)
+ matchingSelectors->addItem(index);
+ ++index;
}
- InspectorStyleSheet* inspectorStyleSheet = bindStyleSheet(rule->parentStyleSheet());
- if (inspectorStyleSheet)
- result->addItem(inspectorStyleSheet->buildObjectForRule(rule));
+ RefPtr<TypeBuilder::CSS::RuleMatch> match = TypeBuilder::CSS::RuleMatch::create()
+ .setRule(ruleObject)
+ .setMatchingSelectors(matchingSelectors);
+ result->addItem(match);
}
- return result.release();
+
+ return result;
}
PassRefPtr<TypeBuilder::CSS::CSSStyle> InspectorCSSAgent::buildObjectForAttributesStyle(Element* element)
diff --git a/Source/WebCore/inspector/InspectorCSSAgent.h b/Source/WebCore/inspector/InspectorCSSAgent.h
index c9aa3a48e..3ea451c2c 100644
--- a/Source/WebCore/inspector/InspectorCSSAgent.h
+++ b/Source/WebCore/inspector/InspectorCSSAgent.h
@@ -107,7 +107,7 @@ public:
virtual void getComputedStyleForNode(ErrorString*, int nodeId, RefPtr<TypeBuilder::Array<TypeBuilder::CSS::CSSComputedStyleProperty> >&);
virtual void getInlineStylesForNode(ErrorString*, int nodeId, RefPtr<TypeBuilder::CSS::CSSStyle>& inlineStyle, RefPtr<TypeBuilder::CSS::CSSStyle>& attributes);
- virtual void getMatchedStylesForNode(ErrorString*, int nodeId, const bool* includePseudo, const bool* includeInherited, RefPtr<TypeBuilder::Array<TypeBuilder::CSS::CSSRule> >& matchedCSSRules, RefPtr<TypeBuilder::Array<TypeBuilder::CSS::PseudoIdRules> >& pseudoRules, RefPtr<TypeBuilder::Array<TypeBuilder::CSS::InheritedStyleEntry> >& inheritedEntries);
+ virtual void getMatchedStylesForNode(ErrorString*, int nodeId, const bool* includePseudo, const bool* includeInherited, RefPtr<TypeBuilder::Array<TypeBuilder::CSS::RuleMatch> >& matchedCSSRules, RefPtr<TypeBuilder::Array<TypeBuilder::CSS::PseudoIdMatches> >& pseudoIdMatches, RefPtr<TypeBuilder::Array<TypeBuilder::CSS::InheritedStyleEntry> >& inheritedEntries);
virtual void getAllStyleSheets(ErrorString*, RefPtr<TypeBuilder::Array<TypeBuilder::CSS::CSSStyleSheetHeader> >& styleSheetInfos);
virtual void getStyleSheet(ErrorString*, const String& styleSheetId, RefPtr<TypeBuilder::CSS::CSSStyleSheetBody>& result);
virtual void getStyleSheetText(ErrorString*, const String& styleSheetId, String* result);
@@ -156,7 +156,9 @@ private:
InspectorStyleSheet* assertStyleSheetForId(ErrorString*, const String&);
TypeBuilder::CSS::StyleSheetOrigin::Enum detectOrigin(CSSStyleSheet* pageStyleSheet, Document* ownerDocument);
+ PassRefPtr<TypeBuilder::CSS::CSSRule> buildObjectForRule(CSSStyleRule*, StyleResolver*);
PassRefPtr<TypeBuilder::Array<TypeBuilder::CSS::CSSRule> > buildArrayForRuleList(CSSRuleList*, StyleResolver*);
+ PassRefPtr<TypeBuilder::Array<TypeBuilder::CSS::RuleMatch> > buildArrayForMatchedRuleList(CSSRuleList*, StyleResolver*, Element*);
PassRefPtr<TypeBuilder::CSS::CSSStyle> buildObjectForAttributesStyle(Element*);
PassRefPtr<TypeBuilder::Array<TypeBuilder::CSS::Region> > buildArrayForRegions(ErrorString*, PassRefPtr<NodeList>, int documentNodeId);
PassRefPtr<TypeBuilder::CSS::NamedFlow> buildObjectForNamedFlow(ErrorString*, WebKitNamedFlow*, int documentNodeId);
diff --git a/Source/WebCore/inspector/InspectorCanvasAgent.cpp b/Source/WebCore/inspector/InspectorCanvasAgent.cpp
index dff293845..10bef0cd2 100644
--- a/Source/WebCore/inspector/InspectorCanvasAgent.cpp
+++ b/Source/WebCore/inspector/InspectorCanvasAgent.cpp
@@ -55,14 +55,11 @@ InspectorCanvasAgent::InspectorCanvasAgent(InstrumentingAgents* instrumentingAge
, m_inspectedPage(page)
, m_injectedScriptManager(injectedScriptManager)
, m_frontend(0)
- , m_enabled(false)
{
- m_instrumentingAgents->setInspectorCanvasAgent(this);
}
InspectorCanvasAgent::~InspectorCanvasAgent()
{
- m_instrumentingAgents->setInspectorCanvasAgent(0);
}
void InspectorCanvasAgent::setFrontend(InspectorFrontend* frontend)
@@ -79,23 +76,22 @@ void InspectorCanvasAgent::clearFrontend()
void InspectorCanvasAgent::restore()
{
- m_enabled = m_state->getBoolean(CanvasAgentState::canvasAgentEnabled);
+ if (m_state->getBoolean(CanvasAgentState::canvasAgentEnabled)) {
+ ErrorString error;
+ enable(&error);
+ }
}
void InspectorCanvasAgent::enable(ErrorString*)
{
- if (m_enabled)
- return;
- m_enabled = true;
- m_state->setBoolean(CanvasAgentState::canvasAgentEnabled, m_enabled);
+ m_state->setBoolean(CanvasAgentState::canvasAgentEnabled, true);
+ m_instrumentingAgents->setInspectorCanvasAgent(this);
}
void InspectorCanvasAgent::disable(ErrorString*)
{
- if (!m_enabled)
- return;
- m_enabled = false;
- m_state->setBoolean(CanvasAgentState::canvasAgentEnabled, m_enabled);
+ m_instrumentingAgents->setInspectorCanvasAgent(0);
+ m_state->setBoolean(CanvasAgentState::canvasAgentEnabled, false);
}
void InspectorCanvasAgent::dropTraceLog(ErrorString* errorString, const String& traceLogId)
@@ -130,6 +126,20 @@ void InspectorCanvasAgent::replayTraceLog(ErrorString* errorString, const String
module.replayTraceLog(errorString, traceLogId, stepNo, result);
}
+ScriptObject InspectorCanvasAgent::wrapCanvas2DRenderingContextForInstrumentation(const ScriptObject& context)
+{
+ if (context.hasNoValue()) {
+ ASSERT_NOT_REACHED();
+ return ScriptObject();
+ }
+ InjectedScriptCanvasModule module = InjectedScriptCanvasModule::moduleForState(m_injectedScriptManager, context.scriptState());
+ if (module.hasNoValue()) {
+ ASSERT_NOT_REACHED();
+ return ScriptObject();
+ }
+ return module.wrapCanvas2DContext(context);
+}
+
#if ENABLE(WEBGL)
ScriptObject InspectorCanvasAgent::wrapWebGLRenderingContextForInstrumentation(const ScriptObject& glContext)
{
diff --git a/Source/WebCore/inspector/InspectorCanvasAgent.h b/Source/WebCore/inspector/InspectorCanvasAgent.h
index f460c6410..ef4cbd58c 100644
--- a/Source/WebCore/inspector/InspectorCanvasAgent.h
+++ b/Source/WebCore/inspector/InspectorCanvasAgent.h
@@ -64,8 +64,7 @@ public:
virtual void clearFrontend();
virtual void restore();
- bool enabled() { return m_enabled; }
-
+ ScriptObject wrapCanvas2DRenderingContextForInstrumentation(const ScriptObject&);
#if ENABLE(WEBGL)
ScriptObject wrapWebGLRenderingContextForInstrumentation(const ScriptObject&);
#endif
@@ -90,7 +89,6 @@ private:
Page* m_inspectedPage;
InjectedScriptManager* m_injectedScriptManager;
InspectorFrontend::Canvas* m_frontend;
- bool m_enabled;
};
} // namespace WebCore
diff --git a/Source/WebCore/inspector/InspectorCanvasInstrumentation.h b/Source/WebCore/inspector/InspectorCanvasInstrumentation.h
index 5904b8789..2c2bea9d0 100644
--- a/Source/WebCore/inspector/InspectorCanvasInstrumentation.h
+++ b/Source/WebCore/inspector/InspectorCanvasInstrumentation.h
@@ -38,13 +38,23 @@
namespace WebCore {
+ScriptObject InspectorInstrumentation::wrapCanvas2DRenderingContextForInstrumentation(Document* document, const ScriptObject& context)
+{
+#if ENABLE(INSPECTOR)
+ if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document)) {
+ if (InspectorCanvasAgent* canvasAgent = instrumentingAgents->inspectorCanvasAgent())
+ return canvasAgent->wrapCanvas2DRenderingContextForInstrumentation(context);
+ }
+#endif
+ return ScriptObject();
+}
+
#if ENABLE(WEBGL)
ScriptObject InspectorInstrumentation::wrapWebGLRenderingContextForInstrumentation(Document* document, const ScriptObject& glContext)
{
#if ENABLE(INSPECTOR)
if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForDocument(document)) {
- InspectorCanvasAgent* canvasAgent = instrumentingAgents->inspectorCanvasAgent();
- if (canvasAgent && canvasAgent->enabled())
+ if (InspectorCanvasAgent* canvasAgent = instrumentingAgents->inspectorCanvasAgent())
return canvasAgent->wrapWebGLRenderingContextForInstrumentation(glContext);
}
#endif
diff --git a/Source/WebCore/inspector/InspectorClient.h b/Source/WebCore/inspector/InspectorClient.h
index fc8d0247f..e8d2659d5 100644
--- a/Source/WebCore/inspector/InspectorClient.h
+++ b/Source/WebCore/inspector/InspectorClient.h
@@ -71,7 +71,7 @@ public:
virtual bool supportsFrameInstrumentation() { return false; }
- bool doDispatchMessageOnFrontendPage(Page* frontendPage, const String& message);
+ static bool doDispatchMessageOnFrontendPage(Page* frontendPage, const String& message);
};
} // namespace WebCore
diff --git a/Source/WebCore/inspector/InspectorDOMAgent.cpp b/Source/WebCore/inspector/InspectorDOMAgent.cpp
index 4491487b3..a533e5253 100644
--- a/Source/WebCore/inspector/InspectorDOMAgent.cpp
+++ b/Source/WebCore/inspector/InspectorDOMAgent.cpp
@@ -1176,6 +1176,11 @@ String InspectorDOMAgent::documentURLString(Document* document)
return document->url().string();
}
+static String documentBaseURLString(Document* document)
+{
+ return document->completeURL("").string();
+}
+
PassRefPtr<TypeBuilder::DOM::Node> InspectorDOMAgent::buildObjectForNode(Node* node, int depth, NodeToIdMap* nodesMap)
{
int id = bind(node, nodesMap);
@@ -1240,6 +1245,7 @@ PassRefPtr<TypeBuilder::DOM::Node> InspectorDOMAgent::buildObjectForNode(Node* n
} else if (node->isDocumentNode()) {
Document* document = static_cast<Document*>(node);
value->setDocumentURL(documentURLString(document));
+ value->setBaseURL(documentBaseURLString(document));
value->setXmlVersion(document->xmlVersion());
} else if (node->nodeType() == Node::DOCUMENT_TYPE_NODE) {
DocumentType* docType = static_cast<DocumentType*>(node);
diff --git a/Source/WebCore/inspector/InspectorInstrumentation.h b/Source/WebCore/inspector/InspectorInstrumentation.h
index 217d98d02..400c443b8 100644
--- a/Source/WebCore/inspector/InspectorInstrumentation.h
+++ b/Source/WebCore/inspector/InspectorInstrumentation.h
@@ -251,6 +251,7 @@ public:
static void didReceiveWebSocketFrameError(Document*, unsigned long identifier, const String& errorMessage);
#endif
+ static ScriptObject wrapCanvas2DRenderingContextForInstrumentation(Document*, const ScriptObject&);
#if ENABLE(WEBGL)
static ScriptObject wrapWebGLRenderingContextForInstrumentation(Document*, const ScriptObject&);
#endif
diff --git a/Source/WebCore/inspector/InspectorOverlay.cpp b/Source/WebCore/inspector/InspectorOverlay.cpp
index 5241545e1..7a87b0f0e 100644
--- a/Source/WebCore/inspector/InspectorOverlay.cpp
+++ b/Source/WebCore/inspector/InspectorOverlay.cpp
@@ -271,6 +271,9 @@ void InspectorOverlay::update()
}
FrameView* view = m_page->mainFrame()->view();
+ if (!view)
+ return;
+
FrameView* overlayView = overlayPage()->mainFrame()->view();
IntRect visibleRect = enclosingIntRect(view->visibleContentRect());
overlayView->resize(visibleRect.width(), visibleRect.height());
diff --git a/Source/WebCore/inspector/InspectorPageAgent.cpp b/Source/WebCore/inspector/InspectorPageAgent.cpp
index fa23aaaf9..ef39e6f13 100644
--- a/Source/WebCore/inspector/InspectorPageAgent.cpp
+++ b/Source/WebCore/inspector/InspectorPageAgent.cpp
@@ -349,13 +349,6 @@ void InspectorPageAgent::restore()
ErrorString error;
enable(&error);
- // When restoring the agent, override values are restored into the FrameView.
- int width = static_cast<int>(m_state->getLong(PageAgentState::pageAgentScreenWidthOverride));
- int height = static_cast<int>(m_state->getLong(PageAgentState::pageAgentScreenHeightOverride));
- double fontScaleFactor = m_state->getDouble(PageAgentState::pageAgentFontScaleFactorOverride);
- bool fitWindow = m_state->getBoolean(PageAgentState::pageAgentFitWindow);
- updateViewMetrics(width, height, fontScaleFactor, fitWindow);
-
if (m_inspectorAgent->didCommitLoadFired())
frameNavigated(m_page->mainFrame()->loader()->documentLoader());
#if ENABLE(TOUCH_EVENTS)
diff --git a/Source/WebCore/inspector/InspectorProfilerAgent.cpp b/Source/WebCore/inspector/InspectorProfilerAgent.cpp
index 4540aa7cd..9c864c5dd 100644
--- a/Source/WebCore/inspector/InspectorProfilerAgent.cpp
+++ b/Source/WebCore/inspector/InspectorProfilerAgent.cpp
@@ -48,6 +48,7 @@
#include "ScriptObject.h"
#include "ScriptProfile.h"
#include "ScriptProfiler.h"
+#include "WorkerScriptDebugServer.h"
#include <wtf/OwnPtr.h>
#include <wtf/text/StringConcatenate.h>
@@ -70,6 +71,11 @@ public:
virtual ~PageProfilerAgent() { }
private:
+ virtual void recompileScript()
+ {
+ PageScriptDebugServer::shared().recompileAllJSFunctionsSoon();
+ }
+
virtual void startProfiling(const String& title)
{
ScriptProfiler::startForPage(m_inspectedPage, title);
@@ -88,7 +94,6 @@ PassOwnPtr<InspectorProfilerAgent> InspectorProfilerAgent::create(InstrumentingA
return adoptPtr(new PageProfilerAgent(instrumentingAgents, consoleAgent, inspectedPage, inspectorState, injectedScriptManager));
}
-
#if ENABLE(WORKERS)
class WorkerProfilerAgent : public InspectorProfilerAgent {
public:
@@ -97,6 +102,8 @@ public:
virtual ~WorkerProfilerAgent() { }
private:
+ virtual void recompileScript() { }
+
virtual void startProfiling(const String& title)
{
ScriptProfiler::startForWorkerContext(m_workerContext, title);
@@ -222,7 +229,7 @@ void InspectorProfilerAgent::disable()
return;
m_enabled = false;
m_headersRequested = false;
- PageScriptDebugServer::shared().recompileAllJSFunctionsSoon();
+ recompileScript();
}
void InspectorProfilerAgent::enable(bool skipRecompile)
@@ -231,7 +238,7 @@ void InspectorProfilerAgent::enable(bool skipRecompile)
return;
m_enabled = true;
if (!skipRecompile)
- PageScriptDebugServer::shared().recompileAllJSFunctionsSoon();
+ recompileScript();
}
String InspectorProfilerAgent::getCurrentUserInitiatedProfileName(bool incrementProfileNumber)
diff --git a/Source/WebCore/inspector/InspectorProfilerAgent.h b/Source/WebCore/inspector/InspectorProfilerAgent.h
index c35536fae..d548bbfa4 100644
--- a/Source/WebCore/inspector/InspectorProfilerAgent.h
+++ b/Source/WebCore/inspector/InspectorProfilerAgent.h
@@ -73,6 +73,7 @@ public:
void resetState();
virtual void causesRecompilation(ErrorString*, bool*);
+ virtual void recompileScript() = 0;
virtual void isSampling(ErrorString*, bool*);
virtual void hasHeapProfiler(ErrorString*, bool*);
diff --git a/Source/WebCore/inspector/InspectorStyleSheet.cpp b/Source/WebCore/inspector/InspectorStyleSheet.cpp
index 2de8d9cba..5b94de6c1 100644
--- a/Source/WebCore/inspector/InspectorStyleSheet.cpp
+++ b/Source/WebCore/inspector/InspectorStyleSheet.cpp
@@ -911,6 +911,25 @@ PassRefPtr<TypeBuilder::CSS::CSSStyleSheetHeader> InspectorStyleSheet::buildObje
return result.release();
}
+PassRefPtr<TypeBuilder::CSS::SelectorList> InspectorStyleSheet::buildObjectForSelectorList(CSSStyleRule* rule)
+{
+ RefPtr<TypeBuilder::Array<String> > selectors = TypeBuilder::Array<String>::create();
+ const CSSSelectorList& selectorList = rule->styleRule()->selectorList();
+ for (CSSSelector* selector = selectorList.first(); selector; selector = CSSSelectorList::next(selector))
+ selectors->addItem(selector->selectorText());
+
+ RefPtr<TypeBuilder::CSS::SelectorList> result = TypeBuilder::CSS::SelectorList::create()
+ .setSelectors(selectors)
+ .setText(rule->selectorText());
+
+ RefPtr<CSSRuleSourceData> sourceData;
+ if (ensureParsedDataReady())
+ sourceData = ruleSourceDataFor(rule->style());
+ if (sourceData)
+ result->setRange(buildSourceRangeObject(sourceData->ruleHeaderRange));
+ return result.release();
+}
+
PassRefPtr<TypeBuilder::CSS::CSSRule> InspectorStyleSheet::buildObjectForRule(CSSStyleRule* rule)
{
CSSStyleSheet* styleSheet = pageStyleSheet();
@@ -918,7 +937,7 @@ PassRefPtr<TypeBuilder::CSS::CSSRule> InspectorStyleSheet::buildObjectForRule(CS
return 0;
RefPtr<TypeBuilder::CSS::CSSRule> result = TypeBuilder::CSS::CSSRule::create()
- .setSelectorText(rule->selectorText())
+ .setSelectorList(buildObjectForSelectorList(rule))
.setSourceLine(rule->styleRule()->sourceLine())
.setOrigin(m_origin)
.setStyle(buildObjectForStyle(rule->style()));
@@ -933,12 +952,6 @@ PassRefPtr<TypeBuilder::CSS::CSSRule> InspectorStyleSheet::buildObjectForRule(CS
result->setRuleId(id.asProtocolValue<TypeBuilder::CSS::CSSRuleId>());
}
- RefPtr<CSSRuleSourceData> sourceData;
- if (ensureParsedDataReady())
- sourceData = ruleSourceDataFor(rule->style());
- if (sourceData)
- result->setSelectorRange(buildSourceRangeObject(sourceData->ruleHeaderRange));
-
RefPtr<Array<TypeBuilder::CSS::CSSMedia> > mediaArray = Array<TypeBuilder::CSS::CSSMedia>::create();
fillMediaListChain(rule, mediaArray.get());
diff --git a/Source/WebCore/inspector/InspectorStyleSheet.h b/Source/WebCore/inspector/InspectorStyleSheet.h
index d426d579f..d8d4e481d 100644
--- a/Source/WebCore/inspector/InspectorStyleSheet.h
+++ b/Source/WebCore/inspector/InspectorStyleSheet.h
@@ -234,6 +234,7 @@ private:
bool resourceStyleSheetText(String* result) const;
bool inlineStyleSheetText(String* result) const;
PassRefPtr<TypeBuilder::Array<TypeBuilder::CSS::CSSRule> > buildArrayForRuleList(CSSRuleList*);
+ PassRefPtr<TypeBuilder::CSS::SelectorList> buildObjectForSelectorList(CSSStyleRule*);
InspectorPageAgent* m_pageAgent;
String m_id;
diff --git a/Source/WebCore/inspector/front-end/AuditRules.js b/Source/WebCore/inspector/front-end/AuditRules.js
index e91f27064..14b59ac47 100644
--- a/Source/WebCore/inspector/front-end/AuditRules.js
+++ b/Source/WebCore/inspector/front-end/AuditRules.js
@@ -755,8 +755,8 @@ WebInspector.AuditRules.ImageDimensionsRule.prototype = {
var src = node.getAttribute("src");
if (!src.asParsedURL()) {
for (var frameOwnerCandidate = node; frameOwnerCandidate; frameOwnerCandidate = frameOwnerCandidate.parentNode) {
- if (frameOwnerCandidate.documentURL) {
- var completeSrc = WebInspector.ParsedURL.completeURL(frameOwnerCandidate.documentURL, src);
+ if (frameOwnerCandidate.baseURL) {
+ var completeSrc = WebInspector.ParsedURL.completeURL(frameOwnerCandidate.baseURL, src);
break;
}
}
@@ -902,7 +902,7 @@ WebInspector.AuditRules.CssInHeadRule.prototype = {
var externalStylesheetHrefs = [];
for (var j = 0; j < externalStylesheetNodeIds.length; ++j) {
var linkNode = WebInspector.domAgent.nodeForId(externalStylesheetNodeIds[j]);
- var completeHref = WebInspector.ParsedURL.completeURL(linkNode.ownerDocument.documentURL, linkNode.getAttribute("href"));
+ var completeHref = WebInspector.ParsedURL.completeURL(linkNode.ownerDocument.baseURL, linkNode.getAttribute("href"));
externalStylesheetHrefs.push(completeHref || "<empty>");
}
urlToViolationsArray[root.documentURL] = [inlineStyleNodeIds.length, externalStylesheetHrefs];
@@ -989,7 +989,7 @@ WebInspector.AuditRules.StylesScriptsOrderRule.prototype = {
var lateStyleUrls = [];
for (var i = 0; i < lateStyleIds.length; ++i) {
var lateStyleNode = WebInspector.domAgent.nodeForId(lateStyleIds[i]);
- var completeHref = WebInspector.ParsedURL.completeURL(lateStyleNode.ownerDocument.documentURL, lateStyleNode.getAttribute("href"));
+ var completeHref = WebInspector.ParsedURL.completeURL(lateStyleNode.ownerDocument.baseURL, lateStyleNode.getAttribute("href"));
lateStyleUrls.push(completeHref || "<empty>");
}
result = [ lateStyleUrls, cssBeforeInlineCount ];
diff --git a/Source/WebCore/inspector/front-end/CSSStyleModel.js b/Source/WebCore/inspector/front-end/CSSStyleModel.js
index 6e99dac82..e071f60fa 100644
--- a/Source/WebCore/inspector/front-end/CSSStyleModel.js
+++ b/Source/WebCore/inspector/front-end/CSSStyleModel.js
@@ -56,6 +56,17 @@ WebInspector.CSSStyleModel.parseRuleArrayPayload = function(ruleArray)
return result;
}
+/**
+ * @param {Array.<CSSAgent.RuleMatch>} matchArray
+ */
+WebInspector.CSSStyleModel.parseRuleMatchArrayPayload = function(matchArray)
+{
+ var result = [];
+ for (var i = 0; i < matchArray.length; ++i)
+ result.push(WebInspector.CSSRule.parsePayload(matchArray[i].rule, matchArray[i].matchingSelectors));
+ return result;
+}
+
WebInspector.CSSStyleModel.Events = {
StyleSheetChanged: "StyleSheetChanged",
MediaQueryResultChanged: "MediaQueryResultChanged",
@@ -90,13 +101,13 @@ WebInspector.CSSStyleModel.prototype = {
var result = {};
if (matchedPayload)
- result.matchedCSSRules = WebInspector.CSSStyleModel.parseRuleArrayPayload(matchedPayload);
+ result.matchedCSSRules = WebInspector.CSSStyleModel.parseRuleMatchArrayPayload(matchedPayload);
if (pseudoPayload) {
result.pseudoElements = [];
for (var i = 0; i < pseudoPayload.length; ++i) {
var entryPayload = pseudoPayload[i];
- result.pseudoElements.push({ pseudoId: entryPayload.pseudoId, rules: WebInspector.CSSStyleModel.parseRuleArrayPayload(entryPayload.rules) });
+ result.pseudoElements.push({ pseudoId: entryPayload.pseudoId, rules: WebInspector.CSSStyleModel.parseRuleMatchArrayPayload(entryPayload.matches) });
}
}
@@ -108,7 +119,7 @@ WebInspector.CSSStyleModel.prototype = {
if (entryPayload.inlineStyle)
entry.inlineStyle = WebInspector.CSSStyleDeclaration.parsePayload(entryPayload.inlineStyle);
if (entryPayload.matchedCSSRules)
- entry.matchedCSSRules = WebInspector.CSSStyleModel.parseRuleArrayPayload(entryPayload.matchedCSSRules);
+ entry.matchedCSSRules = WebInspector.CSSStyleModel.parseRuleMatchArrayPayload(entryPayload.matchedCSSRules);
result.inherited.push(entry);
}
}
@@ -724,11 +735,16 @@ WebInspector.CSSStyleDeclaration.prototype = {
/**
* @constructor
* @param {CSSAgent.CSSRule} payload
+ * @param {Array.<number>=} matchingSelectors
*/
-WebInspector.CSSRule = function(payload)
+WebInspector.CSSRule = function(payload, matchingSelectors)
{
this.id = payload.ruleId;
- this.selectorText = payload.selectorText;
+ if (matchingSelectors)
+ this.matchingSelectors = matchingSelectors;
+ this.selectors = payload.selectorList.selectors;
+ this.selectorText = payload.selectorList.text;
+ this.selectorRange = payload.selectorList.range;
this.sourceLine = payload.sourceLine;
this.sourceURL = payload.sourceURL;
if (payload.sourceURL)
@@ -736,18 +752,18 @@ WebInspector.CSSRule = function(payload)
this.origin = payload.origin;
this.style = WebInspector.CSSStyleDeclaration.parsePayload(payload.style);
this.style.parentRule = this;
- this.selectorRange = payload.selectorRange;
if (payload.media)
this.media = WebInspector.CSSMedia.parseMediaArrayPayload(payload.media);
}
/**
* @param {CSSAgent.CSSRule} payload
+ * @param {Array.<number>=} matchingIndices
* @return {WebInspector.CSSRule}
*/
-WebInspector.CSSRule.parsePayload = function(payload)
+WebInspector.CSSRule.parsePayload = function(payload, matchingIndices)
{
- return new WebInspector.CSSRule(payload);
+ return new WebInspector.CSSRule(payload, matchingIndices);
}
WebInspector.CSSRule.prototype = {
diff --git a/Source/WebCore/inspector/front-end/DOMAgent.js b/Source/WebCore/inspector/front-end/DOMAgent.js
index 811fd2e6d..5f4f06162 100644
--- a/Source/WebCore/inspector/front-end/DOMAgent.js
+++ b/Source/WebCore/inspector/front-end/DOMAgent.js
@@ -747,8 +747,8 @@ WebInspector.DOMNode.prototype = {
if (!url)
return url;
for (var frameOwnerCandidate = this; frameOwnerCandidate; frameOwnerCandidate = frameOwnerCandidate.parentNode) {
- if (frameOwnerCandidate.documentURL)
- return WebInspector.ParsedURL.completeURL(frameOwnerCandidate.documentURL, url);
+ if (frameOwnerCandidate.baseURL)
+ return WebInspector.ParsedURL.completeURL(frameOwnerCandidate.baseURL, url);
}
return null;
}
@@ -764,6 +764,7 @@ WebInspector.DOMDocument = function(domAgent, payload)
{
WebInspector.DOMNode.call(this, domAgent, this, false, payload);
this.documentURL = payload.documentURL || "";
+ this.baseURL = payload.baseURL;
this.xmlVersion = payload.xmlVersion;
this._listeners = {};
}
diff --git a/Source/WebCore/inspector/front-end/DefaultTextEditor.js b/Source/WebCore/inspector/front-end/DefaultTextEditor.js
index f90b902e3..69c87ce12 100644
--- a/Source/WebCore/inspector/front-end/DefaultTextEditor.js
+++ b/Source/WebCore/inspector/front-end/DefaultTextEditor.js
@@ -1863,10 +1863,21 @@ WebInspector.TextEditorMainPanel.prototype = {
if (!highlight)
return;
- lineRow.removeChildren();
+ var decorationsElement = lineRow.decorationsElement;
+ if (!decorationsElement)
+ lineRow.removeChildren();
+ else {
+ while (true) {
+ var child = lineRow.firstChild;
+ if (!child || child === decorationsElement)
+ break;
+ lineRow.removeChild(child);
+ }
+ }
+
var line = this._textModel.line(lineNumber);
if (!line)
- lineRow.appendChild(document.createElement("br"));
+ lineRow.insertBefore(document.createElement("br"), decorationsElement);
var plainTextStart = -1;
for (var j = 0; j < line.length;) {
@@ -1883,21 +1894,19 @@ WebInspector.TextEditorMainPanel.prototype = {
j++;
} else {
if (plainTextStart !== -1) {
- this._appendTextNode(lineRow, line.substring(plainTextStart, j));
+ this._insertTextNodeBefore(lineRow, decorationsElement, line.substring(plainTextStart, j));
plainTextStart = -1;
--this._paintLinesOperationsCredit;
}
- this._appendSpan(lineRow, line.substring(j, j + attribute.length), attribute.tokenType);
+ this._insertSpanBefore(lineRow, decorationsElement, line.substring(j, j + attribute.length), attribute.tokenType);
j += attribute.length;
--this._paintLinesOperationsCredit;
}
}
if (plainTextStart !== -1) {
- this._appendTextNode(lineRow, line.substring(plainTextStart, line.length));
+ this._insertTextNodeBefore(lineRow, decorationsElement, line.substring(plainTextStart, line.length));
--this._paintLinesOperationsCredit;
}
- if (lineRow.decorationsElement)
- lineRow.appendChild(lineRow.decorationsElement);
} finally {
if (this._rangeToMark && this._rangeToMark.startLine === lineNumber)
this._markedRangeElement = WebInspector.highlightSearchResult(lineRow, this._rangeToMark.startColumn, this._rangeToMark.endColumn - this._rangeToMark.startColumn);
@@ -2050,20 +2059,21 @@ WebInspector.TextEditorMainPanel.prototype = {
/**
* @param {Element} element
+ * @param {Element} oldChild
* @param {string} content
* @param {string} className
*/
- _appendSpan: function(element, content, className)
+ _insertSpanBefore: function(element, oldChild, content, className)
{
if (className === "html-resource-link" || className === "html-external-link") {
- element.appendChild(this._createLink(content, className === "html-external-link"));
+ element.insertBefore(this._createLink(content, className === "html-external-link"), oldChild);
return;
}
var span = this._cachedSpans.pop() || document.createElement("span");
span.className = "webkit-" + className;
span.textContent = content;
- element.appendChild(span);
+ element.insertBefore(span, oldChild);
if (!("spans" in element))
element.spans = [];
element.spans.push(span);
@@ -2071,16 +2081,17 @@ WebInspector.TextEditorMainPanel.prototype = {
/**
* @param {Element} element
+ * @param {Element} oldChild
* @param {string} text
*/
- _appendTextNode: function(element, text)
+ _insertTextNodeBefore: function(element, oldChild, text)
{
var textNode = this._cachedTextNodes.pop();
if (textNode)
textNode.nodeValue = text;
else
textNode = document.createTextNode(text);
- element.appendChild(textNode);
+ element.insertBefore(textNode, oldChild);
if (!("textNodes" in element))
element.textNodes = [];
element.textNodes.push(textNode);
diff --git a/Source/WebCore/inspector/front-end/FilteredItemSelectionDialog.js b/Source/WebCore/inspector/front-end/FilteredItemSelectionDialog.js
index e086dadaf..41340a894 100644
--- a/Source/WebCore/inspector/front-end/FilteredItemSelectionDialog.js
+++ b/Source/WebCore/inspector/front-end/FilteredItemSelectionDialog.js
@@ -192,23 +192,17 @@ WebInspector.FilteredItemSelectionDialog.prototype = {
*/
_innerCreateSearchRegExp: function(query, isGlobal)
{
- query = query ? query.trim() : query;
if (!query)
return new RegExp(".*");
+ query = query.trim();
var ignoreCase = (query === query.toLowerCase());
-
- const toEscape = "^[]{}()\\.$*+?|";
-
- var regExpString = "";
- for (var i = 0; i < query.length; ++i) {
- var c = query.charAt(i);
- if (toEscape.indexOf(c) !== -1)
- c = "\\" + c;
- if (i)
- regExpString += "[^" + c + "]*";
- regExpString += c;
- }
+ var regExpString = query.escapeForRegExp().replace(/\\\*/g, ".*").replace(/\\\?/g, ".")
+ if (ignoreCase)
+ regExpString = regExpString.replace(/(?!^)(\\\.|[_:-])/g, "[^._:-]*$1");
+ else
+ regExpString = regExpString.replace(/(?!^)(\\\.|[A-Z_:-])/g, "[^.A-Z_:-]*$1");
+ regExpString = "^" + "[^a-zA-Z0-9]*" + regExpString;
return new RegExp(regExpString, (ignoreCase ? "i" : "") + (isGlobal ? "g" : ""));
},
@@ -393,7 +387,7 @@ WebInspector.FilteredItemSelectionDialog.prototype = {
var ranges = [];
var match;
- while ((match = regex.exec(key)) !== null) {
+ while ((match = regex.exec(key)) !== null && match[0]) {
ranges.push({ offset: match.index, length: regex.lastIndex - match.index });
}
diff --git a/Source/WebCore/inspector/front-end/InspectorFrontendAPI.js b/Source/WebCore/inspector/front-end/InspectorFrontendAPI.js
index bab529ef0..06363986e 100644
--- a/Source/WebCore/inspector/front-end/InspectorFrontendAPI.js
+++ b/Source/WebCore/inspector/front-end/InspectorFrontendAPI.js
@@ -101,7 +101,7 @@ InspectorFrontendAPI = {
enterInspectElementMode: function()
{
- WebInspector.panel("elements").toggleSearchingForNode();
+ WebInspector.toggleSearchingForNode();
},
savedURL: function(url)
diff --git a/Source/WebCore/inspector/front-end/ObjectPropertiesSection.js b/Source/WebCore/inspector/front-end/ObjectPropertiesSection.js
index e9a097045..c58ff53fe 100644
--- a/Source/WebCore/inspector/front-end/ObjectPropertiesSection.js
+++ b/Source/WebCore/inspector/front-end/ObjectPropertiesSection.js
@@ -438,6 +438,8 @@ WebInspector.FunctionScopeMainTreeElement.prototype = {
this.removeChildren();
var scopeChain = response.scopeChain;
+ if (!scopeChain)
+ return;
for (var i = 0; i < scopeChain.length; ++i) {
var scope = scopeChain[i];
var title = null;
diff --git a/Source/WebCore/inspector/front-end/ResourceScriptMapping.js b/Source/WebCore/inspector/front-end/ResourceScriptMapping.js
index 02eb62e72..6dfeb11ff 100644
--- a/Source/WebCore/inspector/front-end/ResourceScriptMapping.js
+++ b/Source/WebCore/inspector/front-end/ResourceScriptMapping.js
@@ -45,6 +45,7 @@ WebInspector.ResourceScriptMapping = function(workspace)
this._temporaryUISourceCodes = new Map();
/** @type {Object.<string, number>} */
this._nextDynamicScriptIndexForURL = {};
+ this._scripts = [];
}
WebInspector.ResourceScriptMapping.prototype = {
@@ -82,6 +83,7 @@ WebInspector.ResourceScriptMapping.prototype = {
var isDynamicScript = false;
if (!script.isAnonymousScript()) {
+ this._scripts.push(script);
var uiSourceCode = this._workspace.uiSourceCodeForURL(script.sourceURL);
isDynamicScript = !!uiSourceCode && uiSourceCode.contentType() === WebInspector.resourceTypes.Document && !script.isInlineScript();
if (uiSourceCode && !isDynamicScript && !this._temporaryUISourceCodes.get(uiSourceCode))
@@ -122,7 +124,7 @@ WebInspector.ResourceScriptMapping.prototype = {
return script.sourceURL === sourceURL && script.isInlineScript() === isInlineScript;
}
- return Object.values(WebInspector.debuggerModel.scripts).filter(filter);
+ return this._scripts.filter(filter.bind(this));
},
/**
@@ -220,5 +222,6 @@ WebInspector.ResourceScriptMapping.prototype = {
this._scriptIdForUISourceCode.clear();
this._temporaryUISourceCodes.clear();
this._nextDynamicScriptIndexForURL = {};
+ this._scripts = [];
},
}
diff --git a/Source/WebCore/inspector/front-end/SettingsScreen.js b/Source/WebCore/inspector/front-end/SettingsScreen.js
index 728389c7f..1c98e3e40 100644
--- a/Source/WebCore/inspector/front-end/SettingsScreen.js
+++ b/Source/WebCore/inspector/front-end/SettingsScreen.js
@@ -541,7 +541,7 @@ WebInspector.UserAgentSettingsTab.prototype = {
const checkboxElement = labelElement.createChild("input");
checkboxElement.id = "metrics-override-checkbox";
checkboxElement.type = "checkbox";
- checkboxElement.checked = !metrics || (metrics.width && metrics.height && metrics.fontScaleFactor);
+ checkboxElement.checked = false;
checkboxElement.addEventListener("click", this._onMetricsCheckboxClicked.bind(this), false);
this._metricsCheckboxElement = checkboxElement;
labelElement.appendChild(document.createTextNode(WebInspector.UIString("Device metrics")));
@@ -549,8 +549,7 @@ WebInspector.UserAgentSettingsTab.prototype = {
const metricsSectionElement = this._createDeviceMetricsElement(metrics);
p.appendChild(metricsSectionElement);
this._metricsSectionElement = metricsSectionElement;
-
- this._setDeviceMetricsOverride(metrics, false, true);
+ this._onMetricsCheckboxClicked();
return p;
},
@@ -564,16 +563,18 @@ WebInspector.UserAgentSettingsTab.prototype = {
this._swapDimensionsElement.disabled = controlsDisabled;
this._fitWindowCheckboxElement.disabled = controlsDisabled;
- if (this._metricsCheckboxElement.checked) {
- var metrics = WebInspector.UserAgentSupport.DeviceMetrics.parseUserInput(this._widthOverrideElement.value, this._heightOverrideElement.value, this._fontScaleFactorOverrideElement.value);
- if (metrics && metrics.isValid() && metrics.width && metrics.height)
- this._setDeviceMetricsOverride(metrics, false, false);
- if (!this._widthOverrideElement.value)
- this._widthOverrideElement.focus();
- } else {
- if (WebInspector.settings.deviceMetrics.get())
- WebInspector.settings.deviceMetrics.set("");
+ if (controlsDisabled) {
+ WebInspector.userAgentSupport.toggleDeviceMetricsOverride(false);
+ return;
+ }
+
+ var metrics = WebInspector.UserAgentSupport.DeviceMetrics.parseUserInput(this._widthOverrideElement.value, this._heightOverrideElement.value, this._fontScaleFactorOverrideElement.value);
+ if (metrics && metrics.isValid() && metrics.width && metrics.height) {
+ this._setDeviceMetricsOverride(metrics, false, false);
+ WebInspector.userAgentSupport.toggleDeviceMetricsOverride(true);
}
+ if (!this._widthOverrideElement.value)
+ this._widthOverrideElement.focus();
},
_applyDeviceMetricsUserInput: function()
@@ -675,7 +676,7 @@ WebInspector.UserAgentSettingsTab.prototype = {
var checkboxElement = labelElement.createChild("input");
checkboxElement.id = "geolocation-override-checkbox";
checkboxElement.type = "checkbox";
- checkboxElement.checked = !geolocation || (((typeof geolocation.latitude === "number") && (typeof geolocation.longitude === "number")) || geolocation.error);
+ checkboxElement.checked = false;
checkboxElement.addEventListener("click", this._onGeolocationOverrideCheckboxClicked.bind(this), false);
this._geolocationOverrideCheckboxElement = checkboxElement;
labelElement.appendChild(document.createTextNode(WebInspector.UIString("Override Geolocation")));
@@ -683,7 +684,7 @@ WebInspector.UserAgentSettingsTab.prototype = {
var geolocationSectionElement = this._createGeolocationOverrideElement(geolocation);
p.appendChild(geolocationSectionElement);
this._geolocationSectionElement = geolocationSectionElement;
- this._setGeolocationPosition(geolocation, false, true);
+ this._onGeolocationOverrideCheckboxClicked();
return p;
},
@@ -694,14 +695,18 @@ WebInspector.UserAgentSettingsTab.prototype = {
this._longitudeElement.disabled = controlsDisabled;
this._geolocationErrorElement.disabled = controlsDisabled;
- if (this._geolocationOverrideCheckboxElement.checked) {
- var geolocation = WebInspector.UserAgentSupport.GeolocationPosition.parseUserInput(this._latitudeElement.value, this._longitudeElement.value, this._geolocationErrorElement.checked);
- if (geolocation)
- this._setGeolocationPosition(geolocation, false, false);
- if (!this._latitudeElement.value)
- this._latitudeElement.focus();
- } else
- WebInspector.UserAgentSupport.GeolocationPosition.clearGeolocationOverride();
+ if (controlsDisabled) {
+ WebInspector.userAgentSupport.toggleGeolocationPositionOverride(false);
+ return;
+ }
+
+ var geolocation = WebInspector.UserAgentSupport.GeolocationPosition.parseUserInput(this._latitudeElement.value, this._longitudeElement.value, this._geolocationErrorElement.checked);
+ if (geolocation) {
+ this._setGeolocationPosition(geolocation, false, false);
+ WebInspector.userAgentSupport.toggleGeolocationPositionOverride(true);
+ }
+ if (!this._latitudeElement.value)
+ this._latitudeElement.focus();
},
_applyGeolocationUserInput: function()
@@ -774,7 +779,7 @@ WebInspector.UserAgentSettingsTab.prototype = {
var checkboxElement = labelElement.createChild("input");
checkboxElement.id = "device-orientation-override-checkbox";
checkboxElement.type = "checkbox";
- checkboxElement.checked = !deviceOrientation;
+ checkboxElement.checked = false;
checkboxElement.addEventListener("click", this._onDeviceOrientationOverrideCheckboxClicked.bind(this), false);
this._deviceOrientationOverrideCheckboxElement = checkboxElement;
labelElement.appendChild(document.createTextNode(WebInspector.UIString("Override Device Orientation")));
@@ -782,9 +787,7 @@ WebInspector.UserAgentSettingsTab.prototype = {
var deviceOrientationSectionElement = this._createDeviceOrientationOverrideElement(deviceOrientation);
p.appendChild(deviceOrientationSectionElement);
this._deviceOrientationSectionElement = deviceOrientationSectionElement;
-
- this._setDeviceOrientation(deviceOrientation, false, true);
-
+ this._onDeviceOrientationOverrideCheckboxClicked();
return p;
},
@@ -795,14 +798,18 @@ WebInspector.UserAgentSettingsTab.prototype = {
this._betaElement.disabled = controlsDisabled;
this._gammaElement.disabled = controlsDisabled;
- if (this._deviceOrientationOverrideCheckboxElement.checked) {
- var deviceOrientation = WebInspector.UserAgentSupport.DeviceOrientation.parseUserInput(this._alphaElement.value, this._betaElement.value, this._gammaElement.value);
- if (deviceOrientation)
- this._setDeviceOrientation(deviceOrientation, false, false);
- if (!this._alphaElement.value)
- this._alphaElement.focus();
- } else
- WebInspector.UserAgentSupport.DeviceOrientation.clearDeviceOrientationOverride();
+ if (controlsDisabled) {
+ WebInspector.userAgentSupport.toggleDeviceOrientationOverride(false);
+ return;
+ }
+
+ var deviceOrientation = WebInspector.UserAgentSupport.DeviceOrientation.parseUserInput(this._alphaElement.value, this._betaElement.value, this._gammaElement.value);
+ if (deviceOrientation) {
+ this._setDeviceOrientation(deviceOrientation, false, false);
+ WebInspector.userAgentSupport.toggleDeviceOrientationOverride(true);
+ }
+ if (!this._alphaElement.value)
+ this._alphaElement.focus();
},
_applyDeviceOrientationUserInput: function()
diff --git a/Source/WebCore/inspector/front-end/StylesSidebarPane.js b/Source/WebCore/inspector/front-end/StylesSidebarPane.js
index 6ce7b7989..e18c6359c 100644
--- a/Source/WebCore/inspector/front-end/StylesSidebarPane.js
+++ b/Source/WebCore/inspector/front-end/StylesSidebarPane.js
@@ -358,7 +358,6 @@ WebInspector.StylesSidebarPane.prototype = {
var usedProperties = {};
this._markUsedProperties(styleRules, usedProperties);
this.sections[0] = this._rebuildSectionsForStyleRules(styleRules, usedProperties, 0, null);
- var responsesLeft = this.sections[0].length;
var anchorElement = this.sections[0].inheritedPropertiesSeparatorElement;
if (styles.computedStyle)
@@ -381,28 +380,9 @@ WebInspector.StylesSidebarPane.prototype = {
usedProperties = {};
this._markUsedProperties(styleRules, usedProperties);
this.sections[pseudoId] = this._rebuildSectionsForStyleRules(styleRules, usedProperties, pseudoId, anchorElement);
- responsesLeft += this.sections[pseudoId].length;
}
- // Mark matching selectors in comma-delimited selector groups.
- var boundMarkCallback = markCallback.bind(this);
- for (var id in this.sections) {
- var sectionsForPseudoId = this.sections[id].slice();
- for (var j = 0; j < sectionsForPseudoId.length; ++j) {
- var section = sectionsForPseudoId[j];
- if (!section.styleRule || section.isBlank || section.styleRule.computedStyle || section.styleRule.isAttribute) {
- boundMarkCallback();
- continue;
- }
- section._markMatchedSelectorsInGroup(boundMarkCallback);
- }
- }
-
- function markCallback()
- {
- if (!(--responsesLeft))
- this._nodeStylesUpdatedForTest(node, true);
- }
+ this._nodeStylesUpdatedForTest(node, true);
},
_nodeStylesUpdatedForTest: function(node, rebuild)
@@ -606,8 +586,10 @@ WebInspector.StylesSidebarPane.prototype = {
if (computedStyle)
var section = new WebInspector.ComputedStylePropertiesSection(this, styleRule, usedProperties);
- else
+ else {
var section = new WebInspector.StylePropertiesSection(this, styleRule, editable, styleRule.isInherited, lastWasSeparator);
+ section._markSelectorMatches();
+ }
section.expanded = true;
if (computedStyle) {
@@ -1124,89 +1106,38 @@ WebInspector.StylePropertiesSection.prototype = {
return null;
},
- /**
- * @param {function()=} callback
- */
- _markMatchedSelectorsInGroup: function(callback)
+ _markSelectorMatches: function()
{
- var self = this;
- function mycallback()
- {
- if (callback)
- callback();
- }
-
- var selectorText = this._selectorElement.textContent;
- if (!selectorText || selectorText.indexOf(",") === -1) {
- mycallback();
+ var rule = this.styleRule.rule;
+ if (!rule)
return;
- }
- var paneNode = this._parentPane.node;
- var relatedNode = this.styleRule.parentNode || paneNode;
- if (!relatedNode) {
- mycallback();
+ var selectors = rule.selectors;
+ var matchingSelectors = rule.matchingSelectors;
+ if (selectors.length < 2 || !matchingSelectors)
return;
- }
-
- function trim(text)
- {
- return text.trim();
- }
- var selectors = selectorText.split(",").map(trim);
-
- WebInspector.RemoteObject.resolveNode(relatedNode, "", resolvedCallback);
- function resolvedCallback(object)
- {
- if (!object) {
- mycallback();
- return;
- }
-
- for (var i = 0, size = selectors.length; i < size; ++i) {
- var selector = selectors[i];
- object.callFunctionJSON(matchesSelector, [{ value: selectors[i] }], matchesCallback.bind(this, i));
- }
- }
-
- function matchesSelector(selector)
- {
- return this.webkitMatchesSelector(selector);
- }
-
- var result = [];
- var matchFound;
- function matchesCallback(selectorIndex, matches)
- {
- var isLast = selectorIndex === selectors.length - 1;
- var fragment = document.createDocumentFragment();
- result[selectorIndex] = fragment;
+ var fragment = document.createDocumentFragment();
+ var currentMatch = 0;
+ for (var i = 0, lastSelectorIndex = selectors.length - 1; i <= lastSelectorIndex ; ++i) {
var selectorNode;
- if (matches && paneNode === self._parentPane.node) {
+ var textNode = document.createTextNode(selectors[i]);
+ if (matchingSelectors[currentMatch] === i) {
+ ++currentMatch;
selectorNode = document.createElement("span");
selectorNode.className = "selector-matches";
- selectorNode.appendChild(document.createTextNode(selectors[selectorIndex]));
- matchFound = true;
+ selectorNode.appendChild(textNode);
} else
- selectorNode = document.createTextNode(selectors[selectorIndex]);
+ selectorNode = textNode;
fragment.appendChild(selectorNode);
- if (!isLast) {
+ if (i !== lastSelectorIndex)
fragment.appendChild(document.createTextNode(", "));
- return;
- }
-
- // This check is here in case the element class has been changed from JS during the roundtrip,
- // so the element matches none of the distinct selectors. Fall back to "all selectors match".
- if (matchFound) {
- self._selectorElement.className = "selector";
- self._selectorElement.removeChildren();
- for (var i = 0; i < result.length; ++i)
- self._selectorElement.appendChild(result[i]);
- }
- mycallback();
}
+
+ this._selectorElement.className = "selector";
+ this._selectorElement.removeChildren();
+ this._selectorElement.appendChild(fragment);
},
_checkWillCancelEditing: function()
@@ -1350,32 +1281,27 @@ WebInspector.StylePropertiesSection.prototype = {
_moveEditorFromSelector: function(moveDirection)
{
+ this._markSelectorMatches();
- if (!moveDirection) {
- this._markMatchedSelectorsInGroup();
+ if (!moveDirection)
return;
- }
-
- this._markMatchedSelectorsInGroup(markCallback.bind(this));
- function markCallback() {
- if (moveDirection === "forward") {
- this.expand();
- var firstChild = this.propertiesTreeOutline.children[0];
- while (firstChild && firstChild.inherited)
- firstChild = firstChild.nextSibling;
- if (!firstChild)
- this.addNewBlankProperty().startEditing();
- else
- firstChild.startEditing(firstChild.nameElement);
- } else {
- var previousSection = this.previousEditableSibling();
- if (!previousSection)
- return;
+ if (moveDirection === "forward") {
+ this.expand();
+ var firstChild = this.propertiesTreeOutline.children[0];
+ while (firstChild && firstChild.inherited)
+ firstChild = firstChild.nextSibling;
+ if (!firstChild)
+ this.addNewBlankProperty().startEditing();
+ else
+ firstChild.startEditing(firstChild.nameElement);
+ } else {
+ var previousSection = this.previousEditableSibling();
+ if (!previousSection)
+ return;
- previousSection.expand();
- previousSection.addNewBlankProperty().startEditing();
- }
+ previousSection.expand();
+ previousSection.addNewBlankProperty().startEditing();
}
},
@@ -1415,7 +1341,7 @@ WebInspector.StylePropertiesSection.prototype = {
{
// Do nothing but mark the selectors in group if necessary.
// This is overridden by BlankStylePropertiesSection.
- this._markMatchedSelectorsInGroup();
+ this._markSelectorMatches();
}
}
diff --git a/Source/WebCore/inspector/front-end/UserAgentSupport.js b/Source/WebCore/inspector/front-end/UserAgentSupport.js
index 794d11a96..ebed8079c 100644
--- a/Source/WebCore/inspector/front-end/UserAgentSupport.js
+++ b/Source/WebCore/inspector/front-end/UserAgentSupport.js
@@ -33,8 +33,10 @@
*/
WebInspector.UserAgentSupport = function()
{
- if (WebInspector.settings.deviceMetrics.get())
- this._deviceMetricsChanged();
+ this._deviceMetricsOverrideEnabled = false;
+ this._geolocationPositionOverrideEnabled = false;
+ this._deviceOrientationOverrideEnabled = false;
+
WebInspector.settings.deviceMetrics.addChangeListener(this._deviceMetricsChanged, this);
WebInspector.settings.deviceFitWindow.addChangeListener(this._deviceMetricsChanged, this);
WebInspector.settings.geolocationOverride.addChangeListener(this._geolocationPositionChanged, this);
@@ -305,15 +307,43 @@ WebInspector.UserAgentSupport.DeviceOrientation.clearDeviceOrientationOverride =
}
WebInspector.UserAgentSupport.prototype = {
+ toggleDeviceMetricsOverride: function(enabled)
+ {
+ if (enabled === this._deviceMetricsOverrideEnabled)
+ return;
+ this._deviceMetricsOverrideEnabled = enabled;
+ this._deviceMetricsChanged();
+ },
+
+ toggleGeolocationPositionOverride: function(enabled)
+ {
+ if (enabled === this._geolocationPositionOverrideEnabled)
+ return;
+ this._geolocationPositionOverrideEnabled = enabled;
+ this._geolocationPositionChanged();
+ },
+
+ toggleDeviceOrientationOverride: function(enabled)
+ {
+ if (enabled === this._deviceOrientationOverrideEnabled)
+ return;
+ this._deviceOrientationOverrideEnabled = enabled;
+ this._deviceOrientationChanged();
+ },
+
_deviceMetricsChanged: function()
{
- var metrics = WebInspector.UserAgentSupport.DeviceMetrics.parseSetting(WebInspector.settings.deviceMetrics.get());
+ var metrics = WebInspector.UserAgentSupport.DeviceMetrics.parseSetting(this._deviceMetricsOverrideEnabled ? WebInspector.settings.deviceMetrics.get() : "");
if (metrics.isValid())
PageAgent.setDeviceMetricsOverride(metrics.width, metrics.height, metrics.fontScaleFactor, WebInspector.settings.deviceFitWindow.get());
},
_geolocationPositionChanged: function()
{
+ if (!this._geolocationPositionOverrideEnabled) {
+ PageAgent.clearGeolocationOverride();
+ return;
+ }
var geolocation = WebInspector.UserAgentSupport.GeolocationPosition.parseSetting(WebInspector.settings.geolocationOverride.get());
if (geolocation.error)
PageAgent.setGeolocationOverride();
@@ -321,11 +351,12 @@ WebInspector.UserAgentSupport.prototype = {
PageAgent.setGeolocationOverride(geolocation.latitude, geolocation.longitude, 150);
},
- /**
- * @param {WebInspector.Event} event
- */
- _deviceOrientationChanged: function(event)
+ _deviceOrientationChanged: function()
{
+ if (!this._deviceOrientationOverrideEnabled) {
+ PageAgent.clearDeviceOrientationOverride();
+ return;
+ }
var deviceOrientation = WebInspector.UserAgentSupport.DeviceOrientation.parseSetting(WebInspector.settings.deviceOrientationOverride.get());
PageAgent.setDeviceOrientationOverride(deviceOrientation.alpha, deviceOrientation.beta, deviceOrientation.gamma);
}
diff --git a/Source/WebCore/inspector/front-end/externs.js b/Source/WebCore/inspector/front-end/externs.js
index 8cf53d26c..21d61a00a 100644
--- a/Source/WebCore/inspector/front-end/externs.js
+++ b/Source/WebCore/inspector/front-end/externs.js
@@ -262,6 +262,11 @@ WebInspector.showPanel = function(panel)
*/
WebInspector.inspectedPageDomain;
+/**
+ * @type {WebInspector.UserAgentSupport}
+ */
+WebInspector.userAgentSupport;
+
WebInspector.isCompactMode = function() { return false; }
WebInspector.SourceJavaScriptTokenizer = {}
diff --git a/Source/WebCore/inspector/front-end/inspector.css b/Source/WebCore/inspector/front-end/inspector.css
index d5b13097b..1c126ea8e 100644
--- a/Source/WebCore/inspector/front-end/inspector.css
+++ b/Source/WebCore/inspector/front-end/inspector.css
@@ -2348,6 +2348,7 @@ li.breakpoint-hit .breakpoint-hit-marker {
-webkit-border-radius: 7px;
border: 2px solid rgb(169, 172, 203);
width: 90%;
+ pointer-events: auto;
}
.source-frame-breakpoint-message {
diff --git a/Source/WebCore/inspector/front-end/inspector.js b/Source/WebCore/inspector/front-end/inspector.js
index ab67c474c..e77a90bfa 100644
--- a/Source/WebCore/inspector/front-end/inspector.js
+++ b/Source/WebCore/inspector/front-end/inspector.js
@@ -86,7 +86,7 @@ var WebInspector = {
if (!WebInspector.WorkerManager.isWorkerFrontend()) {
this._nodeSearchButton = new WebInspector.StatusBarButton(WebInspector.UIString("Select an element in the page to inspect it."), "node-search-status-bar-item");
- this._nodeSearchButton.addEventListener("click", this._toggleSearchingForNode, this);
+ this._nodeSearchButton.addEventListener("click", this.toggleSearchingForNode, this);
mainStatusBar.insertBefore(this._nodeSearchButton.element, bottomStatusBarContainer);
}
@@ -356,7 +356,7 @@ var WebInspector = {
InspectorFrontendHost.setZoomFactor(Math.pow(1.2, this._zoomLevel));
},
- _toggleSearchingForNode: function()
+ toggleSearchingForNode: function()
{
var enabled = !this._nodeSearchButton.toggled;
/**
@@ -862,7 +862,7 @@ WebInspector.documentKeyDown = function(event)
var isNodeSearchKey = event.ctrlKey && !event.metaKey && !event.altKey && event.shiftKey;
if (isNodeSearchKey) {
- this._toggleSearchingForNode();
+ this.toggleSearchingForNode();
event.consume(true);
return;
}
diff --git a/Source/WebCore/loader/DocumentLoader.cpp b/Source/WebCore/loader/DocumentLoader.cpp
index 8368041cf..900af978a 100644
--- a/Source/WebCore/loader/DocumentLoader.cpp
+++ b/Source/WebCore/loader/DocumentLoader.cpp
@@ -53,6 +53,7 @@
#include "TextResourceDecoder.h"
#include "WebCoreMemoryInstrumentation.h"
#include <wtf/Assertions.h>
+#include <wtf/MemoryInstrumentationVector.h>
#include <wtf/text/CString.h>
#include <wtf/text/WTFString.h>
#include <wtf/unicode/Unicode.h>
@@ -368,16 +369,16 @@ void DocumentLoader::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
info.addMember(m_substituteData);
info.addMember(m_pageTitle.string());
info.addMember(m_overrideEncoding);
- info.addVector(m_responses);
+ info.addMember(m_responses);
info.addMember(m_originalRequest);
info.addMember(m_originalRequestCopy);
info.addMember(m_request);
info.addMember(m_response);
info.addMember(m_lastCheckedRequest);
- info.addInstrumentedVector(m_responses);
+ info.addMember(m_responses);
info.addHashMap(m_pendingSubstituteResources);
info.addInstrumentedHashSet(m_resourcesClientKnowsAbout);
- info.addVector(m_resourcesLoadedFromMemoryCacheForClientNotification);
+ info.addMember(m_resourcesLoadedFromMemoryCacheForClientNotification);
info.addMember(m_clientRedirectSourceForHistory);
info.addMember(m_mainResourceData);
}
diff --git a/Source/WebCore/loader/FrameLoader.cpp b/Source/WebCore/loader/FrameLoader.cpp
index b26b6d4cc..89f876242 100644
--- a/Source/WebCore/loader/FrameLoader.cpp
+++ b/Source/WebCore/loader/FrameLoader.cpp
@@ -647,7 +647,10 @@ void FrameLoader::didBeginDocument(bool dispatch)
m_frame->document()->initContentSecurityPolicy();
Settings* settings = m_frame->document()->settings();
- m_frame->document()->cachedResourceLoader()->setAutoLoadImages(settings && settings->loadsImagesAutomatically());
+ if (settings) {
+ m_frame->document()->cachedResourceLoader()->setImagesEnabled(settings->areImagesEnabled());
+ m_frame->document()->cachedResourceLoader()->setAutoLoadImages(settings->loadsImagesAutomatically());
+ }
if (m_documentLoader) {
String dnsPrefetchControl = m_documentLoader->response().httpHeaderField("X-DNS-Prefetch-Control");
diff --git a/Source/WebCore/loader/SubresourceLoader.cpp b/Source/WebCore/loader/SubresourceLoader.cpp
index ff3be6edf..56de0d341 100644
--- a/Source/WebCore/loader/SubresourceLoader.cpp
+++ b/Source/WebCore/loader/SubresourceLoader.cpp
@@ -167,11 +167,13 @@ void SubresourceLoader::willSendRequest(ResourceRequest& newRequest, const Resou
ResourceLoader::willSendRequest(newRequest, redirectResponse);
if (!previousURL.isNull() && !newRequest.isNull() && previousURL != newRequest.url()) {
- if (!m_document->cachedResourceLoader()->canRequest(m_resource->type(), newRequest.url())) {
- cancel();
- return;
+ if (m_document->cachedResourceLoader()->canRequest(m_resource->type(), newRequest.url())) {
+ if (m_resource->type() != CachedResource::ImageResource || !m_document->cachedResourceLoader()->shouldDeferImageLoad(newRequest.url())) {
+ m_resource->willSendRequest(newRequest, redirectResponse);
+ return;
+ }
}
- m_resource->willSendRequest(newRequest, redirectResponse);
+ cancel();
}
}
diff --git a/Source/WebCore/loader/cache/CachedImage.cpp b/Source/WebCore/loader/cache/CachedImage.cpp
index 4316616b3..41075a7b3 100644
--- a/Source/WebCore/loader/cache/CachedImage.cpp
+++ b/Source/WebCore/loader/cache/CachedImage.cpp
@@ -29,7 +29,6 @@
#include "CachedResourceClient.h"
#include "CachedResourceClientWalker.h"
#include "CachedResourceLoader.h"
-#include "Frame.h"
#include "FrameLoaderClient.h"
#include "FrameLoaderTypes.h"
#include "FrameView.h"
diff --git a/Source/WebCore/loader/cache/CachedImage.h b/Source/WebCore/loader/cache/CachedImage.h
index 4865c7e24..078f7ab1c 100644
--- a/Source/WebCore/loader/cache/CachedImage.h
+++ b/Source/WebCore/loader/cache/CachedImage.h
@@ -82,8 +82,7 @@ public:
virtual bool shouldIgnoreHTTPStatusCodeErrors() const { return true; }
virtual bool isImage() const { return true; }
- bool stillNeedsLoad() const { return !errorOccurred() && status() == Unknown && !isLoading(); }
- void load();
+ virtual bool stillNeedsLoad() const OVERRIDE { return !errorOccurred() && status() == Unknown && !isLoading(); }
// ImageObserver
virtual void decodedSizeChanged(const Image* image, int delta);
diff --git a/Source/WebCore/loader/cache/CachedResource.cpp b/Source/WebCore/loader/cache/CachedResource.cpp
index 43c3d144f..33d1ba823 100755
--- a/Source/WebCore/loader/cache/CachedResource.cpp
+++ b/Source/WebCore/loader/cache/CachedResource.cpp
@@ -32,7 +32,6 @@
#include "CachedResourceLoader.h"
#include "CrossOriginAccessControl.h"
#include "Document.h"
-#include "Frame.h"
#include "FrameLoaderClient.h"
#include "InspectorInstrumentation.h"
#include "KURL.h"
@@ -390,7 +389,7 @@ void CachedResource::didAddClient(CachedResourceClient* c)
m_clients.add(c);
m_clientsAwaitingCallback.remove(c);
}
- if (!isLoading())
+ if (!isLoading() && !stillNeedsLoad())
c->notifyFinished(this);
}
diff --git a/Source/WebCore/loader/cache/CachedResource.h b/Source/WebCore/loader/cache/CachedResource.h
index 0cad3ee7c..b739d68af 100644
--- a/Source/WebCore/loader/cache/CachedResource.h
+++ b/Source/WebCore/loader/cache/CachedResource.h
@@ -45,7 +45,6 @@ class CachedMetadata;
class CachedResourceClient;
class CachedResourceHandleBase;
class CachedResourceLoader;
-class Frame;
class InspectorResource;
class PurgeableBuffer;
class SecurityOrigin;
@@ -144,6 +143,7 @@ public:
bool isLoading() const { return m_loading; }
void setLoading(bool b) { m_loading = b; }
+ virtual bool stillNeedsLoad() const { return false; }
SubresourceLoader* loader() { return m_loader.get(); }
diff --git a/Source/WebCore/loader/cache/CachedResourceLoader.cpp b/Source/WebCore/loader/cache/CachedResourceLoader.cpp
index 353a62aa6..593d532a1 100644
--- a/Source/WebCore/loader/cache/CachedResourceLoader.cpp
+++ b/Source/WebCore/loader/cache/CachedResourceLoader.cpp
@@ -115,6 +115,7 @@ CachedResourceLoader::CachedResourceLoader(Document* document)
, m_requestCount(0)
, m_garbageCollectDocumentResourcesTimer(this, &CachedResourceLoader::garbageCollectDocumentResourcesTimerFired)
, m_autoLoadImages(true)
+ , m_imagesEnabled(true)
, m_allowStaleResources(false)
{
}
@@ -159,10 +160,7 @@ CachedResourceHandle<CachedImage> CachedResourceLoader::requestImage(ResourceReq
return 0;
}
}
- CachedResourceHandle<CachedImage> resource(static_cast<CachedImage*>(requestResource(CachedResource::ImageResource, request, String(), defaultCachedResourceOptions()).get()));
- if (autoLoadImages() && resource && resource->stillNeedsLoad())
- resource->load(this, defaultCachedResourceOptions());
- return resource;
+ return static_cast<CachedImage*>(requestResource(CachedResource::ImageResource, request, String(), defaultCachedResourceOptions(), ResourceLoadPriorityUnresolved, false, clientDefersImage(request.url()) ? DeferredByClient : NoDefer).get());
}
CachedResourceHandle<CachedFont> CachedResourceLoader::requestFont(ResourceRequest& request)
@@ -362,12 +360,6 @@ bool CachedResourceLoader::canRequest(CachedResource::Type type, const KURL& url
case CachedResource::ImageResource:
if (!m_document->contentSecurityPolicy()->allowImageFromSource(url))
return false;
-
- if (frame()) {
- Settings* settings = frame()->settings();
- if (!frame()->loader()->client()->allowImage(!settings || settings->areImagesEnabled(), url))
- return false;
- }
break;
case CachedResource::FontResource: {
if (!m_document->contentSecurityPolicy()->allowFontFromSource(url))
@@ -401,7 +393,7 @@ bool CachedResourceLoader::canRequest(CachedResource::Type type, const KURL& url
return true;
}
-CachedResourceHandle<CachedResource> CachedResourceLoader::requestResource(CachedResource::Type type, ResourceRequest& request, const String& charset, const ResourceLoaderOptions& options, ResourceLoadPriority priority, bool forPreload)
+CachedResourceHandle<CachedResource> CachedResourceLoader::requestResource(CachedResource::Type type, ResourceRequest& request, const String& charset, const ResourceLoaderOptions& options, ResourceLoadPriority priority, bool forPreload, DeferOption defer)
{
KURL url = request.url();
@@ -430,16 +422,16 @@ CachedResourceHandle<CachedResource> CachedResourceLoader::requestResource(Cache
if (request.url() != url)
request.setURL(url);
- switch (determineRevalidationPolicy(type, request, forPreload, resource.get())) {
- case Load:
- resource = loadResource(type, request, charset, priority, options);
- break;
+ const RevalidationPolicy policy = determineRevalidationPolicy(type, request, forPreload, resource.get(), defer);
+ switch (policy) {
case Reload:
memoryCache()->remove(resource.get());
- resource = loadResource(type, request, charset, priority, options);
+ // Fall through
+ case Load:
+ resource = loadResource(type, request, charset);
break;
case Revalidate:
- resource = revalidateResource(resource.get(), priority, options);
+ resource = revalidateResource(resource.get());
break;
case Use:
memoryCache()->resourceAccessed(resource.get());
@@ -450,12 +442,27 @@ CachedResourceHandle<CachedResource> CachedResourceLoader::requestResource(Cache
if (!resource)
return 0;
+ resource->setLoadPriority(priority);
+ if ((policy != Use || resource->stillNeedsLoad()) && NoDefer == defer) {
+ resource->load(this, options);
+
+ // We don't support immediate loads, but we do support immediate failure.
+ if (resource->errorOccurred()) {
+ if (resource->inCache())
+ memoryCache()->remove(resource.get());
+ return 0;
+ }
+ }
+
+ if (!request.url().protocolIsData())
+ m_validatedURLs.add(request.url());
+
ASSERT(resource->url() == url.string());
m_documentResources.set(resource->url(), resource);
return resource;
}
-CachedResourceHandle<CachedResource> CachedResourceLoader::revalidateResource(CachedResource* resource, ResourceLoadPriority priority, const ResourceLoaderOptions& options)
+CachedResourceHandle<CachedResource> CachedResourceLoader::revalidateResource(CachedResource* resource)
{
ASSERT(resource);
ASSERT(resource->inCache());
@@ -465,7 +472,6 @@ CachedResourceHandle<CachedResource> CachedResourceLoader::revalidateResource(Ca
// Copy the URL out of the resource to be revalidated in case it gets deleted by the remove() call below.
String url = resource->url();
- bool urlProtocolIsData = resource->url().protocolIsData();
CachedResourceHandle<CachedResource> newResource = createResource(resource->type(), resource->resourceRequest(), resource->encoding());
LOG(ResourceLoading, "Resource %p created to revalidate %p", newResource.get(), resource);
@@ -473,16 +479,10 @@ CachedResourceHandle<CachedResource> CachedResourceLoader::revalidateResource(Ca
memoryCache()->remove(resource);
memoryCache()->add(newResource.get());
-
- newResource->setLoadPriority(priority);
- newResource->load(this, options);
-
- if (!urlProtocolIsData)
- m_validatedURLs.add(url);
return newResource;
}
-CachedResourceHandle<CachedResource> CachedResourceLoader::loadResource(CachedResource::Type type, ResourceRequest& request, const String& charset, ResourceLoadPriority priority, const ResourceLoaderOptions& options)
+CachedResourceHandle<CachedResource> CachedResourceLoader::loadResource(CachedResource::Type type, ResourceRequest& request, const String& charset)
{
ASSERT(!memoryCache()->resourceForURL(request.url()));
@@ -490,35 +490,20 @@ CachedResourceHandle<CachedResource> CachedResourceLoader::loadResource(CachedRe
CachedResourceHandle<CachedResource> resource = createResource(type, request, charset);
- bool inCache = memoryCache()->add(resource.get());
-
- resource->setLoadPriority(priority);
- resource->load(this, options);
-
- if (!inCache)
+ if (!memoryCache()->add(resource.get()))
resource->setOwningCachedResourceLoader(this);
-
- // We don't support immediate loads, but we do support immediate failure.
- if (resource->errorOccurred()) {
- if (inCache)
- memoryCache()->remove(resource.get());
- return 0;
- }
-
- if (!request.url().protocolIsData())
- m_validatedURLs.add(request.url());
return resource;
}
-CachedResourceLoader::RevalidationPolicy CachedResourceLoader::determineRevalidationPolicy(CachedResource::Type type, ResourceRequest& request, bool forPreload, CachedResource* existingResource) const
+CachedResourceLoader::RevalidationPolicy CachedResourceLoader::determineRevalidationPolicy(CachedResource::Type type, ResourceRequest& request, bool forPreload, CachedResource* existingResource, DeferOption defer) const
{
if (!existingResource)
return Load;
-
+
// We already have a preload going for this URL.
if (forPreload && existingResource->isPreloaded())
return Use;
-
+
// If the same URL has been loaded as a different type, we need to reload.
if (existingResource->type() != type) {
LOG(ResourceLoading, "CachedResourceLoader::determineRevalidationPolicy reloading due to type mismatch.");
@@ -533,6 +518,11 @@ CachedResourceLoader::RevalidationPolicy CachedResourceLoader::determineRevalida
// of things about how revalidation works that manual headers violate, so punt to Reload instead.
if (request.isConditional())
return Reload;
+
+ // Do not load from cache if images are not enabled. The load for this image will be blocked
+ // in CachedImage::load.
+ if (DeferredByClient == defer)
+ return Reload;
// Don't reload resources while pasting.
if (m_allowStaleResources)
@@ -629,15 +619,39 @@ void CachedResourceLoader::setAutoLoadImages(bool enable)
if (!m_autoLoadImages)
return;
+ reloadImagesIfNotDeferred();
+}
+
+void CachedResourceLoader::setImagesEnabled(bool enable)
+{
+ if (enable == m_imagesEnabled)
+ return;
+
+ m_imagesEnabled = enable;
+
+ if (!m_imagesEnabled)
+ return;
+
+ reloadImagesIfNotDeferred();
+}
+
+bool CachedResourceLoader::clientDefersImage(const KURL& url) const
+{
+ return frame() && !frame()->loader()->client()->allowImage(m_imagesEnabled, url);
+}
+
+bool CachedResourceLoader::shouldDeferImageLoad(const KURL& url) const
+{
+ return clientDefersImage(url) || !m_autoLoadImages;
+}
+
+void CachedResourceLoader::reloadImagesIfNotDeferred()
+{
DocumentResourceMap::iterator end = m_documentResources.end();
for (DocumentResourceMap::iterator it = m_documentResources.begin(); it != end; ++it) {
CachedResource* resource = it->second.get();
- if (resource->type() == CachedResource::ImageResource) {
- CachedImage* image = const_cast<CachedImage*>(static_cast<const CachedImage*>(resource));
-
- if (image->stillNeedsLoad())
- image->load(this, defaultCachedResourceOptions());
- }
+ if (resource->type() == CachedResource::ImageResource && resource->stillNeedsLoad() && !clientDefersImage(resource->url()))
+ const_cast<CachedResource*>(resource)->load(this, defaultCachedResourceOptions());
}
}
diff --git a/Source/WebCore/loader/cache/CachedResourceLoader.h b/Source/WebCore/loader/cache/CachedResourceLoader.h
index f4755c22f..b5dc69482 100644
--- a/Source/WebCore/loader/cache/CachedResourceLoader.h
+++ b/Source/WebCore/loader/cache/CachedResourceLoader.h
@@ -97,6 +97,10 @@ public:
bool autoLoadImages() const { return m_autoLoadImages; }
void setAutoLoadImages(bool);
+
+ void setImagesEnabled(bool);
+
+ bool shouldDeferImageLoad(const KURL&) const;
CachePolicy cachePolicy() const;
@@ -122,19 +126,23 @@ public:
void reportMemoryUsage(MemoryObjectInfo*) const;
private:
- CachedResourceHandle<CachedResource> requestResource(CachedResource::Type, ResourceRequest&, const String& charset, const ResourceLoaderOptions&, ResourceLoadPriority = ResourceLoadPriorityUnresolved, bool isPreload = false);
- CachedResourceHandle<CachedResource> revalidateResource(CachedResource*, ResourceLoadPriority, const ResourceLoaderOptions&);
- CachedResourceHandle<CachedResource> loadResource(CachedResource::Type, ResourceRequest&, const String& charset, ResourceLoadPriority, const ResourceLoaderOptions&);
+ enum DeferOption { NoDefer, DeferredByClient };
+ CachedResourceHandle<CachedResource> requestResource(CachedResource::Type, ResourceRequest&, const String& charset, const ResourceLoaderOptions&, ResourceLoadPriority = ResourceLoadPriorityUnresolved, bool isPreload = false, DeferOption = NoDefer);
+ CachedResourceHandle<CachedResource> revalidateResource(CachedResource*);
+ CachedResourceHandle<CachedResource> loadResource(CachedResource::Type, ResourceRequest&, const String& charset);
void requestPreload(CachedResource::Type, ResourceRequest&, const String& charset);
enum RevalidationPolicy { Use, Revalidate, Reload, Load };
- RevalidationPolicy determineRevalidationPolicy(CachedResource::Type, ResourceRequest&, bool forPreload, CachedResource* existingResource) const;
+ RevalidationPolicy determineRevalidationPolicy(CachedResource::Type, ResourceRequest&, bool forPreload, CachedResource* existingResource, DeferOption) const;
void notifyLoadedFromMemoryCache(CachedResource*);
bool checkInsecureContent(CachedResource::Type, const KURL&) const;
void garbageCollectDocumentResourcesTimerFired(Timer<CachedResourceLoader>*);
void performPostLoadActions();
+
+ bool clientDefersImage(const KURL&) const;
+ void reloadImagesIfNotDeferred();
HashSet<String> m_validatedURLs;
mutable DocumentResourceMap m_documentResources;
@@ -152,8 +160,9 @@ private:
Timer<CachedResourceLoader> m_garbageCollectDocumentResourcesTimer;
- // 30 bits left
+ // 29 bits left
bool m_autoLoadImages : 1;
+ bool m_imagesEnabled : 1;
bool m_allowStaleResources : 1;
};
diff --git a/Source/WebCore/loader/cache/MemoryCache.cpp b/Source/WebCore/loader/cache/MemoryCache.cpp
index 66d3201eb..c1af09d69 100644
--- a/Source/WebCore/loader/cache/MemoryCache.cpp
+++ b/Source/WebCore/loader/cache/MemoryCache.cpp
@@ -45,6 +45,7 @@
#include "WorkerThread.h"
#include <stdio.h>
#include <wtf/CurrentTime.h>
+#include <wtf/MemoryInstrumentationVector.h>
#include <wtf/TemporaryChange.h>
#include <wtf/text/CString.h>
@@ -724,7 +725,7 @@ void MemoryCache::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
info.addMember(i->first);
info.addMember(i->second);
}
- info.addVector(m_allResources);
+ info.addMember(m_allResources);
info.addMember(m_liveDecodedResources);
}
diff --git a/Source/WebCore/mathml/MathMLMathElement.cpp b/Source/WebCore/mathml/MathMLMathElement.cpp
index 80d915700..bc50d9b8a 100644
--- a/Source/WebCore/mathml/MathMLMathElement.cpp
+++ b/Source/WebCore/mathml/MathMLMathElement.cpp
@@ -47,7 +47,7 @@ Node::InsertionNotificationRequest MathMLMathElement::insertedInto(ContainerNode
{
// There are sibling rules in the MathML default style.
if (insertionPoint->inDocument())
- document()->setUsesSiblingRules(true);
+ document()->styleSheetCollection()->setUsesSiblingRulesOverride(true);
return MathMLInlineContainerElement::insertedInto(insertionPoint);
}
diff --git a/Source/WebCore/page/FeatureObserver.h b/Source/WebCore/page/FeatureObserver.h
index 9096ec596..6a50c53df 100644
--- a/Source/WebCore/page/FeatureObserver.h
+++ b/Source/WebCore/page/FeatureObserver.h
@@ -48,6 +48,7 @@ public:
LegacyWebAudioNoteOn,
WebAudioStart,
PrefixedContentSecurityPolicy,
+ UnprefixedIndexedDB,
// Add new features above this line.
NumberOfFeatures, // This enum value must be last.
};
diff --git a/Source/WebCore/page/Page.cpp b/Source/WebCore/page/Page.cpp
index cf4d0fec9..62b4c55b5 100644
--- a/Source/WebCore/page/Page.cpp
+++ b/Source/WebCore/page/Page.cpp
@@ -29,6 +29,7 @@
#include "ContextMenuController.h"
#include "DOMWindow.h"
#include "DocumentMarkerController.h"
+#include "DocumentStyleSheetCollection.h"
#include "DragController.h"
#include "EditorClient.h"
#include "Event.h"
@@ -838,7 +839,7 @@ void Page::userStyleSheetLocationChanged()
for (Frame* frame = mainFrame(); frame; frame = frame->tree()->traverseNext()) {
if (frame->document())
- frame->document()->updatePageUserSheet();
+ frame->document()->styleSheetCollection()->updatePageUserSheet();
}
}
diff --git a/Source/WebCore/page/PageGroup.cpp b/Source/WebCore/page/PageGroup.cpp
index 45d25f552..0fed49138 100644
--- a/Source/WebCore/page/PageGroup.cpp
+++ b/Source/WebCore/page/PageGroup.cpp
@@ -29,6 +29,7 @@
#include "Chrome.h"
#include "ChromeClient.h"
#include "Document.h"
+#include "DocumentStyleSheetCollection.h"
#include "Frame.h"
#include "GroupSettings.h"
#include "Page.h"
@@ -391,7 +392,7 @@ void PageGroup::resetUserStyleCacheInAllFrames()
HashSet<Page*>::const_iterator end = m_pages.end();
for (HashSet<Page*>::const_iterator it = m_pages.begin(); it != end; ++it) {
for (Frame* frame = (*it)->mainFrame(); frame; frame = frame->tree()->traverseNext())
- frame->document()->updatePageGroupUserSheets();
+ frame->document()->styleSheetCollection()->updatePageGroupUserSheets();
}
}
diff --git a/Source/WebCore/page/Settings.cpp b/Source/WebCore/page/Settings.cpp
index df425964d..30666c561 100644
--- a/Source/WebCore/page/Settings.cpp
+++ b/Source/WebCore/page/Settings.cpp
@@ -46,10 +46,12 @@ using namespace std;
namespace WebCore {
-static void setLoadsImagesAutomaticallyInAllFrames(Page* page)
+static void setImageLoadingSettings(Page* page)
{
- for (Frame* frame = page->mainFrame(); frame; frame = frame->tree()->traverseNext())
+ for (Frame* frame = page->mainFrame(); frame; frame = frame->tree()->traverseNext()) {
+ frame->document()->cachedResourceLoader()->setImagesEnabled(page->settings()->areImagesEnabled());
frame->document()->cachedResourceLoader()->setAutoLoadImages(page->settings()->loadsImagesAutomatically());
+ }
}
// Sets the entry in the font map for the given script. If family is the empty string, removes the entry instead.
@@ -291,7 +293,7 @@ Settings::Settings(Page* page)
, m_windowFocusRestricted(true)
, m_diagnosticLoggingEnabled(false)
, m_scrollingPerformanceLoggingEnabled(false)
- , m_loadsImagesAutomaticallyTimer(this, &Settings::loadsImagesAutomaticallyTimerFired)
+ , m_setImageLoadingSettingsTimer(this, &Settings::imageLoadingSettingsTimerFired)
, m_incrementalRenderingSuppressionTimeoutInSeconds(defaultIncrementalRenderingSuppressionTimeoutInSeconds)
{
// A Frame may not have been created yet, so we initialize the AtomicString
@@ -466,12 +468,12 @@ void Settings::setLoadsImagesAutomatically(bool loadsImagesAutomatically)
// Starting these loads synchronously is not important. By putting it on a 0-delay, properly closing the Page cancels them
// before they have a chance to really start.
// See http://webkit.org/b/60572 for more discussion.
- m_loadsImagesAutomaticallyTimer.startOneShot(0);
+ m_setImageLoadingSettingsTimer.startOneShot(0);
}
-void Settings::loadsImagesAutomaticallyTimerFired(Timer<Settings>*)
+void Settings::imageLoadingSettingsTimerFired(Timer<Settings>*)
{
- setLoadsImagesAutomaticallyInAllFrames(m_page);
+ setImageLoadingSettings(m_page);
}
void Settings::setLoadsSiteIconsIgnoringImageLoadingSetting(bool loadsSiteIcons)
@@ -517,6 +519,9 @@ void Settings::setJavaEnabledForLocalFiles(bool isJavaEnabledForLocalFiles)
void Settings::setImagesEnabled(bool areImagesEnabled)
{
m_areImagesEnabled = areImagesEnabled;
+
+ // See comment in setLoadsImagesAutomatically.
+ m_setImageLoadingSettingsTimer.startOneShot(0);
}
void Settings::setMediaEnabled(bool isMediaEnabled)
diff --git a/Source/WebCore/page/Settings.h b/Source/WebCore/page/Settings.h
index 83986f697..c18dfd730 100644
--- a/Source/WebCore/page/Settings.h
+++ b/Source/WebCore/page/Settings.h
@@ -818,8 +818,8 @@ namespace WebCore {
bool m_scrollingPerformanceLoggingEnabled : 1;
- Timer<Settings> m_loadsImagesAutomaticallyTimer;
- void loadsImagesAutomaticallyTimerFired(Timer<Settings>*);
+ Timer<Settings> m_setImageLoadingSettingsTimer;
+ void imageLoadingSettingsTimerFired(Timer<Settings>*);
double m_incrementalRenderingSuppressionTimeoutInSeconds;
diff --git a/Source/WebCore/page/ValidationMessageClient.h b/Source/WebCore/page/ValidationMessageClient.h
index 5c8a3556c..3beaca09f 100644
--- a/Source/WebCore/page/ValidationMessageClient.h
+++ b/Source/WebCore/page/ValidationMessageClient.h
@@ -26,6 +26,8 @@
#ifndef ValidationMessageClient_h
#define ValidationMessageClient_h
+#include <wtf/Forward.h>
+
namespace WebCore {
class Element;
diff --git a/Source/WebCore/page/mac/EventHandlerMac.mm b/Source/WebCore/page/mac/EventHandlerMac.mm
index bd8ee4704..d2020c771 100644
--- a/Source/WebCore/page/mac/EventHandlerMac.mm
+++ b/Source/WebCore/page/mac/EventHandlerMac.mm
@@ -225,9 +225,10 @@ bool EventHandler::passMouseDownEventToWidget(Widget* pWidget)
ASSERT(!m_sendingEventToSubview);
m_sendingEventToSubview = true;
- RenderWidget::suspendWidgetHierarchyUpdates();
- [view mouseDown:currentNSEvent()];
- RenderWidget::resumeWidgetHierarchyUpdates();
+ {
+ WidgetHierarchyUpdatesSuspensionScope suspendWidgetHierarchyUpdates;
+ [view mouseDown:currentNSEvent()];
+ }
m_sendingEventToSubview = false;
diff --git a/Source/WebCore/platform/FractionalLayoutUnit.h b/Source/WebCore/platform/FractionalLayoutUnit.h
index 0f3a86a1f..06be89787 100644
--- a/Source/WebCore/platform/FractionalLayoutUnit.h
+++ b/Source/WebCore/platform/FractionalLayoutUnit.h
@@ -227,6 +227,15 @@ public:
#endif
}
+ FractionalLayoutUnit fraction() const
+ {
+ // Add the fraction to the size (as opposed to the full location) to avoid overflows.
+ // Compute fraction using the mod operator to preserve the sign of the value as it may affect rounding.
+ FractionalLayoutUnit fraction;
+ fraction.setRawValue(rawValue() % kFixedPointDenominator);
+ return fraction;
+ }
+
#if ENABLE(SUBPIXEL_LAYOUT)
static float epsilon() { return 1.0f / kFixedPointDenominator; }
#else
@@ -807,7 +816,7 @@ inline float& operator/=(float& a, const FractionalLayoutUnit& b)
inline int snapSizeToPixel(FractionalLayoutUnit size, FractionalLayoutUnit location)
{
- FractionalLayoutUnit fraction = location - location.floor();
+ FractionalLayoutUnit fraction = location.fraction();
return (fraction + size).round() - fraction.round();
}
diff --git a/Source/WebCore/platform/KURLWTFURL.cpp b/Source/WebCore/platform/KURLWTFURL.cpp
index f030b8719..9a3484d41 100644
--- a/Source/WebCore/platform/KURLWTFURL.cpp
+++ b/Source/WebCore/platform/KURLWTFURL.cpp
@@ -26,7 +26,11 @@
#include "config.h"
#include "KURL.h"
+#include <TextEncoding.h>
#include <wtf/DataLog.h>
+#include <wtf/text/CString.h>
+#include <wtf/url/api/URLBuffer.h>
+#include <wtf/url/api/URLQueryCharsetConverter.h>
#if USE(WTFURL)
@@ -51,29 +55,55 @@ static inline void detach(RefPtr<KURLWTFURLImpl>& urlImpl)
KURL::KURL(ParsedURLStringTag, const String& urlString)
: m_urlImpl(adoptRef(new KURLWTFURLImpl()))
{
- m_urlImpl->m_parsedURL = ParsedURL(urlString);
+ m_urlImpl->m_parsedURL = ParsedURL(urlString, ParsedURL::ParsedURLString);
// FIXME: Frame::init() actually create empty URL, investigate why not just null URL.
// ASSERT(m_urlImpl->m_parsedURL.isValid());
}
+class CharsetConverter : public URLQueryCharsetConverter {
+public:
+ CharsetConverter(const TextEncoding& encoding)
+ : m_encoding(encoding)
+ {
+ }
+
+ virtual void convertFromUTF16(const UChar* input, unsigned inputLength, URLBuffer<char>& output) OVERRIDE
+ {
+ CString encoded = m_encoding.encode(input, inputLength, URLEncodedEntitiesForUnencodables);
+ output.append(encoded.data(), static_cast<int>(encoded.length()));
+ }
+
+private:
+ const TextEncoding& m_encoding;
+};
+
KURL::KURL(const KURL& baseURL, const String& relative)
: m_urlImpl(adoptRef(new KURLWTFURLImpl()))
{
// FIXME: the case with a null baseURL is common. We should have a separate constructor in KURL.
// FIXME: the case of an empty Base is useless, we should get rid of empty URLs.
+ CharsetConverter charsetConverter(UTF8Encoding());
if (baseURL.isEmpty())
- m_urlImpl->m_parsedURL = ParsedURL(relative);
+ m_urlImpl->m_parsedURL = ParsedURL(relative, &charsetConverter);
else
- m_urlImpl->m_parsedURL = ParsedURL(baseURL.m_urlImpl->m_parsedURL, relative);
+ m_urlImpl->m_parsedURL = ParsedURL(baseURL.m_urlImpl->m_parsedURL, relative, &charsetConverter);
if (!m_urlImpl->m_parsedURL.isValid())
m_urlImpl->m_invalidUrlString = relative;
}
-KURL::KURL(const KURL&, const String&, const TextEncoding&)
+KURL::KURL(const KURL& baseURL, const String& relative, const TextEncoding& encoding)
+ : m_urlImpl(adoptRef(new KURLWTFURLImpl()))
{
- // FIXME: Add WTFURL Implementation.
+ CharsetConverter charsetConverter(encoding.encodingForFormSubmission());
+ if (baseURL.isEmpty())
+ m_urlImpl->m_parsedURL = ParsedURL(relative, &charsetConverter);
+ else
+ m_urlImpl->m_parsedURL = ParsedURL(baseURL.m_urlImpl->m_parsedURL, relative, &charsetConverter);
+
+ if (!m_urlImpl->m_parsedURL.isValid())
+ m_urlImpl->m_invalidUrlString = relative;
}
KURL KURL::copy() const
@@ -141,7 +171,10 @@ String KURL::host() const
bool KURL::hasPort() const
{
- ASSERT(isValid());
+ // This should be an ASSERT. HTMLAnchorElement::port() does not check the validity of the URL.
+ if (!isValid())
+ return false;
+
return !m_urlImpl->m_parsedURL.port().isNull();
}
@@ -164,25 +197,37 @@ unsigned short KURL::port() const
String KURL::user() const
{
- ASSERT(isValid());
+ // FIXME: this should be an ASSERT(), call site should not use invalid URLs.
+ if (!isValid())
+ return String();
+
return m_urlImpl->m_parsedURL.username();
}
String KURL::pass() const
{
- ASSERT(isValid());
+ // FIXME: this should be an ASSERT(), call site should not use invalid URLs.
+ if (!isValid())
+ return String();
+
return m_urlImpl->m_parsedURL.password();
}
bool KURL::hasPath() const
{
- ASSERT(isValid());
+ // FIXME: this should be an ASSERTION, call site should not use invalid URLs.
+ if (!isValid())
+ return false;
+
return !path().isEmpty();
}
String KURL::path() const
{
- ASSERT(isValid());
+ // FIXME: this should be an ASSERTION, HTMLAnchorElement should not use invalid URLs.
+ if (!isValid())
+ return String();
+
return m_urlImpl->m_parsedURL.path();
}
@@ -201,7 +246,10 @@ String KURL::lastPathComponent() const
String KURL::query() const
{
- ASSERT(isValid());
+ // FIXME: this should be an ASSERTION, HTMLAnchorElement should not use invalid URLs.
+ if (!isValid())
+ return String();
+
return m_urlImpl->m_parsedURL.query();
}
@@ -221,6 +269,7 @@ String KURL::fragmentIdentifier() const
// ASSERT(isValid());
if (!isValid())
return String();
+
return m_urlImpl->m_parsedURL.fragment();
}
@@ -234,7 +283,7 @@ String KURL::baseAsString() const
// FIXME: Get rid of this function from KURL.
String KURL::fileSystemPath() const
{
- return String();
+ return string();
}
bool KURL::protocolIs(const char* testProtocol) const
diff --git a/Source/WebCore/platform/SharedBuffer.cpp b/Source/WebCore/platform/SharedBuffer.cpp
index 68c3196a7..de5f71dc2 100644
--- a/Source/WebCore/platform/SharedBuffer.cpp
+++ b/Source/WebCore/platform/SharedBuffer.cpp
@@ -29,6 +29,7 @@
#include "PlatformMemoryInstrumentation.h"
#include "PurgeableBuffer.h"
+#include <wtf/MemoryInstrumentationVector.h>
#include <wtf/PassOwnPtr.h>
#include <wtf/unicode/UTF8.h>
#include <wtf/unicode/Unicode.h>
@@ -251,8 +252,8 @@ const Vector<char>& SharedBuffer::buffer() const
void SharedBuffer::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
{
MemoryClassInfo info(memoryObjectInfo, this);
- info.addVector(m_buffer);
- info.addVector(m_segments);
+ info.addMember(m_buffer);
+ info.addMember(m_segments);
for (unsigned i = 0; i < m_segments.size(); ++i)
info.addRawBuffer(m_segments[i], segmentSize);
info.addMember(m_purgeableBuffer.get());
diff --git a/Source/WebCore/platform/blackberry/AuthenticationChallengeManager.cpp b/Source/WebCore/platform/blackberry/AuthenticationChallengeManager.cpp
deleted file mode 100644
index e40a42b7e..000000000
--- a/Source/WebCore/platform/blackberry/AuthenticationChallengeManager.cpp
+++ /dev/null
@@ -1,253 +0,0 @@
-/*
- * Copyright (C) 2012 Research In Motion Limited. All rights reserved.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "config.h"
-#include "AuthenticationChallengeManager.h"
-
-#include "Credential.h"
-#include "KURL.h"
-#include "PageClientBlackBerry.h"
-#include "ProtectionSpace.h"
-
-#include <BlackBerryPlatformAssert.h>
-#include <BlackBerryPlatformLog.h>
-#include <wtf/Assertions.h>
-#include <wtf/HashMap.h>
-#include <wtf/Vector.h>
-#include <wtf/text/CString.h>
-
-namespace WebCore {
-
-typedef HashMap<PageClientBlackBerry*, bool> PageVisibilityMap;
-
-struct ChallengeInfo {
- ChallengeInfo(const KURL&, const ProtectionSpace&, const Credential&, AuthenticationChallengeClient*, PageClientBlackBerry*);
-
- KURL url;
- ProtectionSpace space;
- Credential credential;
- AuthenticationChallengeClient* authClient;
- PageClientBlackBerry* pageClient;
- bool blocked;
-};
-
-ChallengeInfo::ChallengeInfo(const KURL& aUrl,
- const ProtectionSpace& aSpace,
- const Credential& aCredential,
- AuthenticationChallengeClient* anAuthClient,
- PageClientBlackBerry* aPageClient)
- : url(aUrl)
- , space(aSpace)
- , credential(aCredential)
- , authClient(anAuthClient)
- , pageClient(aPageClient)
- , blocked(false)
-{
-}
-
-class AuthenticationChallengeManagerPrivate {
-public:
- AuthenticationChallengeManagerPrivate();
-
- bool resumeAuthenticationChallenge(PageClientBlackBerry*);
- void startAuthenticationChallenge(ChallengeInfo*);
- bool pageExists(PageClientBlackBerry*);
-
- ChallengeInfo* m_activeChallenge;
- PageVisibilityMap m_pageVisibilityMap;
- Vector<OwnPtr<ChallengeInfo> > m_challenges;
-};
-
-AuthenticationChallengeManagerPrivate::AuthenticationChallengeManagerPrivate()
- : m_activeChallenge(0)
-{
-}
-
-bool AuthenticationChallengeManagerPrivate::resumeAuthenticationChallenge(PageClientBlackBerry* client)
-{
- ASSERT(!m_activeChallenge);
-
- for (size_t i = 0; i < m_challenges.size(); ++i) {
- if (m_challenges[i]->pageClient == client && m_challenges[i]->blocked) {
- startAuthenticationChallenge(m_challenges[i].get());
- return true;
- }
- }
-
- return false;
-}
-
-void AuthenticationChallengeManagerPrivate::startAuthenticationChallenge(ChallengeInfo* info)
-{
- m_activeChallenge = info;
- m_activeChallenge->blocked = false;
- m_activeChallenge->pageClient->authenticationChallenge(m_activeChallenge->url,
- m_activeChallenge->space,
- m_activeChallenge->credential);
-}
-
-bool AuthenticationChallengeManagerPrivate::pageExists(PageClientBlackBerry* client)
-{
- return m_pageVisibilityMap.find(client) != m_pageVisibilityMap.end();
-}
-
-AuthenticationChallengeManager::AuthenticationChallengeManager()
- : d(adoptPtr(new AuthenticationChallengeManagerPrivate))
-{
-}
-
-void AuthenticationChallengeManager::pageCreated(PageClientBlackBerry* client)
-{
- d->m_pageVisibilityMap.add(client, true);
-}
-
-void AuthenticationChallengeManager::pageDeleted(PageClientBlackBerry* client)
-{
- d->m_pageVisibilityMap.remove(client);
-
- if (d->m_activeChallenge && d->m_activeChallenge->pageClient == client)
- d->m_activeChallenge = 0;
-
- Vector<OwnPtr<ChallengeInfo> > existing;
- d->m_challenges.swap(existing);
-
- for (size_t i = 0; i < existing.size(); ++i) {
- if (existing[i]->pageClient != client)
- d->m_challenges.append(existing[i].release());
- }
-}
-
-void AuthenticationChallengeManager::pageVisibilityChanged(PageClientBlackBerry* client, bool visible)
-{
- PageVisibilityMap::iterator iter = d->m_pageVisibilityMap.find(client);
-
- ASSERT(iter != d->m_pageVisibilityMap.end());
- if (iter == d->m_pageVisibilityMap.end()) {
- d->m_pageVisibilityMap.add(client, visible);
- return;
- }
-
- if (iter->second == visible)
- return;
-
- iter->second = visible;
- if (!visible)
- return;
-
- if (d->m_activeChallenge)
- return;
-
- d->resumeAuthenticationChallenge(client);
-}
-
-void AuthenticationChallengeManager::authenticationChallenge(const KURL& url,
- const ProtectionSpace& space,
- const Credential& credential,
- AuthenticationChallengeClient* authClient,
- PageClientBlackBerry* pageClient)
-{
- BLACKBERRY_ASSERT(authClient);
- BLACKBERRY_ASSERT(pageClient);
-
- ChallengeInfo* info = new ChallengeInfo(url, space, credential, authClient, pageClient);
- d->m_challenges.append(adoptPtr(info));
-
- if (d->m_activeChallenge || !pageClient->isVisible()) {
- info->blocked = true;
- return;
- }
-
- d->startAuthenticationChallenge(info);
-}
-
-void AuthenticationChallengeManager::cancelAuthenticationChallenge(AuthenticationChallengeClient* client)
-{
- BLACKBERRY_ASSERT(client);
-
- if (d->m_activeChallenge && d->m_activeChallenge->authClient == client)
- d->m_activeChallenge = 0;
-
- Vector<OwnPtr<ChallengeInfo> > existing;
- d->m_challenges.swap(existing);
-
- ChallengeInfo* next = 0;
- PageClientBlackBerry* page = 0;
-
- for (size_t i = 0; i < existing.size(); ++i) {
- if (existing[i]->authClient != client) {
- if (page && !next && existing[i]->pageClient == page)
- next = existing[i].get();
- d->m_challenges.append(existing[i].release());
- } else if (d->m_activeChallenge == existing[i].get())
- page = existing[i]->pageClient;
- }
-
- if (next)
- d->startAuthenticationChallenge(next);
-}
-
-void AuthenticationChallengeManager::notifyChallengeResult(const KURL& url,
- const ProtectionSpace& space,
- AuthenticationChallengeResult result,
- const Credential& credential)
-{
- d->m_activeChallenge = 0;
-
- Vector<OwnPtr<ChallengeInfo> > existing;
- d->m_challenges.swap(existing);
-
- ChallengeInfo* next = 0;
- PageClientBlackBerry* page = 0;
-
- for (size_t i = 0; i < existing.size(); ++i) {
- if (existing[i]->space != space) {
- if (page && !next && existing[i]->pageClient == page)
- next = existing[i].get();
- d->m_challenges.append(existing[i].release());
- } else {
- page = existing[i]->pageClient;
- existing[i]->authClient->notifyChallengeResult(existing[i]->url, space, result, credential);
-
- // After calling notifyChallengeResult(), page could be destroyed or something.
- if (!d->pageExists(page) || !page->isVisible())
- page = 0;
- }
- }
-
- if (next)
- d->startAuthenticationChallenge(next);
-}
-
-// Keep following code at the end of this file!!!
-static AuthenticationChallengeManager* s_manager = 0;
-
-AuthenticationChallengeManager* AuthenticationChallengeManager::instance()
-{
- ASSERT(s_manager);
- return s_manager;
-}
-
-void AuthenticationChallengeManager::init()
-{
- ASSERT(!s_manager);
- s_manager = new AuthenticationChallengeManager();
-}
-
-// No more code after this line, all new code should come before s_manager declaration!!!
-
-} // namespace WebCore
diff --git a/Source/WebCore/platform/blackberry/AuthenticationChallengeManager.h b/Source/WebCore/platform/blackberry/AuthenticationChallengeManager.h
index 20e799bb3..52224f511 100644
--- a/Source/WebCore/platform/blackberry/AuthenticationChallengeManager.h
+++ b/Source/WebCore/platform/blackberry/AuthenticationChallengeManager.h
@@ -19,13 +19,8 @@
#ifndef AuthenticationChallengeManager_h
#define AuthenticationChallengeManager_h
-#include <wtf/OwnPtr.h>
-
-class PageClientBlackBerry;
-
namespace WebCore {
-class AuthenticationChallengeManagerPrivate;
class Credential;
class KURL;
class ProtectionSpace;
@@ -40,36 +35,6 @@ public:
virtual void notifyChallengeResult(const KURL&, const ProtectionSpace&, AuthenticationChallengeResult, const Credential&) = 0;
};
-class AuthenticationChallengeManager {
-public:
- static void init();
- static AuthenticationChallengeManager* instance();
-
- void pageCreated(PageClientBlackBerry*);
- void pageDeleted(PageClientBlackBerry*);
- void pageVisibilityChanged(PageClientBlackBerry*, bool visible);
-
- void authenticationChallenge(const KURL&,
- const ProtectionSpace&,
- const Credential&,
- AuthenticationChallengeClient*,
- PageClientBlackBerry*);
-
- void cancelAuthenticationChallenge(AuthenticationChallengeClient*);
-
- void notifyChallengeResult(const KURL&,
- const ProtectionSpace&,
- AuthenticationChallengeResult,
- const Credential&);
-
-private:
- AuthenticationChallengeManager();
- ~AuthenticationChallengeManager();
-
- OwnPtr<AuthenticationChallengeManagerPrivate> d;
-};
-
-
} // namespace WebCore
#endif // AuthenticationChallengeManager_h
diff --git a/Source/WebCore/platform/blackberry/CookieManager.cpp b/Source/WebCore/platform/blackberry/CookieManager.cpp
index 091d7531e..db012bfb4 100644
--- a/Source/WebCore/platform/blackberry/CookieManager.cpp
+++ b/Source/WebCore/platform/blackberry/CookieManager.cpp
@@ -137,6 +137,17 @@ void CookieManager::setCookies(const KURL& url, const String& value, CookieFilte
}
}
+void CookieManager::setCookies(const KURL& url, const Vector<String>& cookies, CookieFilter filter)
+{
+ CookieLog("CookieManager - Setting cookies");
+ CookieParser parser(url);
+ for (size_t i = 0; i < cookies.size(); ++i) {
+ BackingStoreRemovalPolicy treatment = m_privateMode ? DoNotRemoveFromBackingStore : RemoveFromBackingStore;
+ if (ParsedCookie* parsedCookie = parser.parseOneCookie(cookies[i]))
+ checkAndTreatCookie(parsedCookie, treatment, filter);
+ }
+}
+
String CookieManager::getCookie(const KURL& url, CookieFilter filter) const
{
Vector<ParsedCookie*> rawCookies;
diff --git a/Source/WebCore/platform/blackberry/CookieManager.h b/Source/WebCore/platform/blackberry/CookieManager.h
index acb2fcd7a..d334e67fd 100644
--- a/Source/WebCore/platform/blackberry/CookieManager.h
+++ b/Source/WebCore/platform/blackberry/CookieManager.h
@@ -71,6 +71,7 @@ public:
void setCanLocalAccessAllCookies(bool enabled) { m_shouldDumpAllCookies = enabled; }
void setCookies(const KURL&, const String& value, CookieFilter = WithHttpOnlyCookies);
+ void setCookies(const KURL&, const Vector<String>& cookies, CookieFilter);
void removeAllCookies(BackingStoreRemovalPolicy);
void removeCookieWithName(const KURL&, const String& cookieName);
diff --git a/Source/WebCore/platform/blackberry/CookieParser.cpp b/Source/WebCore/platform/blackberry/CookieParser.cpp
index ff6b871b8..dc3580f2b 100644
--- a/Source/WebCore/platform/blackberry/CookieParser.cpp
+++ b/Source/WebCore/platform/blackberry/CookieParser.cpp
@@ -103,6 +103,11 @@ Vector<ParsedCookie*> CookieParser::parse(const String& cookies)
return parsedCookies;
}
+ParsedCookie* CookieParser::parseOneCookie(const String& cookie)
+{
+ return parseOneCookie(cookie, 0, cookie.length() - 1, currentTime());
+}
+
// The cookie String passed into this method will only contian the name value pairs as well as other related cookie
// attributes such as max-age and domain. Set-Cookie should never be part of this string.
ParsedCookie* CookieParser::parseOneCookie(const String& cookie, unsigned start, unsigned end, double curTime)
diff --git a/Source/WebCore/platform/blackberry/CookieParser.h b/Source/WebCore/platform/blackberry/CookieParser.h
index 00fafcfef..aed5e87eb 100644
--- a/Source/WebCore/platform/blackberry/CookieParser.h
+++ b/Source/WebCore/platform/blackberry/CookieParser.h
@@ -45,6 +45,8 @@ public:
// Parses a sequence of "Cookie:" header and return the parsed cookies.
Vector<ParsedCookie*> parse(const String& cookies);
+ ParsedCookie* parseOneCookie(const String& cookie);
+
private:
// FIXME: curTime, start, end parameters should be removed. And this method can be public.
ParsedCookie* parseOneCookie(const String& cookie, unsigned start, unsigned end, double curTime);
diff --git a/Source/WebCore/platform/blackberry/PageClientBlackBerry.h b/Source/WebCore/platform/blackberry/PageClientBlackBerry.h
index f2c7c0e65..bdb2f1607 100644
--- a/Source/WebCore/platform/blackberry/PageClientBlackBerry.h
+++ b/Source/WebCore/platform/blackberry/PageClientBlackBerry.h
@@ -72,7 +72,7 @@ public:
virtual int showAlertDialog(BlackBerry::WebKit::WebPageClient::AlertType) = 0;
virtual bool isActive() const = 0;
virtual bool isVisible() const = 0;
- virtual void authenticationChallenge(const WebCore::KURL&, const WebCore::ProtectionSpace&, const WebCore::Credential&) = 0;
+ virtual void authenticationChallenge(const WebCore::KURL&, const WebCore::ProtectionSpace&, const WebCore::Credential&, WebCore::AuthenticationChallengeClient*) = 0;
virtual SaveCredentialType notifyShouldSaveCredential(bool) = 0;
virtual void syncProxyCredential(const WebCore::Credential&) = 0;
};
diff --git a/Source/WebCore/platform/cairo/WidgetBackingStoreCairo.cpp b/Source/WebCore/platform/cairo/WidgetBackingStoreCairo.cpp
index 1dec7c2e7..69b79efca 100644
--- a/Source/WebCore/platform/cairo/WidgetBackingStoreCairo.cpp
+++ b/Source/WebCore/platform/cairo/WidgetBackingStoreCairo.cpp
@@ -22,7 +22,7 @@
#include "CairoUtilities.h"
#include "RefPtrCairo.h"
-#include <cairo/cairo.h>
+#include <cairo.h>
#if PLATFORM(GTK)
#include "GtkVersioning.h"
diff --git a/Source/WebCore/platform/chromium/PlatformSupport.h b/Source/WebCore/platform/chromium/PlatformSupport.h
index eb1970b8a..7af75b8ef 100644
--- a/Source/WebCore/platform/chromium/PlatformSupport.h
+++ b/Source/WebCore/platform/chromium/PlatformSupport.h
@@ -49,15 +49,6 @@ typedef struct NPObject NPObject;
typedef struct _NPP NPP_t;
typedef NPP_t* NPP;
-#if OS(DARWIN)
-typedef struct CGFont* CGFontRef;
-#ifdef __OBJC__
-@class NSFont;
-#else
-class NSFont;
-#endif
-#endif // OS(DARWIN)
-
#if OS(WINDOWS)
typedef struct HFONT__* HFONT;
#endif
@@ -99,9 +90,6 @@ public:
#if OS(WINDOWS)
static bool ensureFontLoaded(HFONT);
#endif
-#if OS(DARWIN)
- static bool loadFont(NSFont* srcFont, CGFontRef*, uint32_t* fontID);
-#endif
// IndexedDB ----------------------------------------------------------
static PassRefPtr<IDBFactoryBackendInterface> idbFactory();
diff --git a/Source/WebCore/platform/chromium/ScrollbarThemeChromiumAndroid.cpp b/Source/WebCore/platform/chromium/ScrollbarThemeChromiumAndroid.cpp
index 1b9e571b1..6f555fbd1 100644
--- a/Source/WebCore/platform/chromium/ScrollbarThemeChromiumAndroid.cpp
+++ b/Source/WebCore/platform/chromium/ScrollbarThemeChromiumAndroid.cpp
@@ -26,7 +26,6 @@
#include "config.h"
#include "ScrollbarThemeChromiumAndroid.h"
-#include "LayoutTestSupport.h"
#include "PlatformContextSkia.h"
#include "PlatformMouseEvent.h"
#include "PlatformSupport.h"
@@ -50,21 +49,12 @@ ScrollbarTheme* ScrollbarTheme::nativeTheme()
int ScrollbarThemeChromiumAndroid::scrollbarThickness(ScrollbarControlSize controlSize)
{
- if (isRunningLayoutTest()) {
- // Match Chromium-Linux for DumpRenderTree, so the layout test results
- // can be shared. The width of scrollbar down arrow should equal the
- // width of the vertical scrollbar.
- IntSize scrollbarSize = PlatformSupport::getThemePartSize(PlatformSupport::PartScrollbarDownArrow);
- return scrollbarSize.width();
- }
-
return scrollbarWidth + scrollbarMargin;
}
bool ScrollbarThemeChromiumAndroid::usesOverlayScrollbars() const
{
- // In layout test mode, match Chromium-Linux.
- return !isRunningLayoutTest();
+ return true;
}
int ScrollbarThemeChromiumAndroid::thumbPosition(ScrollbarThemeClient* scrollbar)
@@ -92,8 +82,7 @@ int ScrollbarThemeChromiumAndroid::thumbLength(ScrollbarThemeClient* scrollbar)
bool ScrollbarThemeChromiumAndroid::hasThumb(ScrollbarThemeClient* scrollbar)
{
- // In layout test mode, match Chromium-Linux.
- return !isRunningLayoutTest();
+ return true;
}
IntRect ScrollbarThemeChromiumAndroid::backButtonRect(ScrollbarThemeClient*, ScrollbarPart, bool)
@@ -157,12 +146,4 @@ void ScrollbarThemeChromiumAndroid::paintThumb(GraphicsContext* context, Scrollb
fillSmoothEdgedRect(context, thumbRect, Color(128, 128, 128, 128));
}
-void ScrollbarThemeChromiumAndroid::paintScrollbarBackground(GraphicsContext* context, ScrollbarThemeClient* scrollbar)
-{
- // Paint black background in DumpRenderTree, otherwise the pixels in the scrollbar area depend
- // on their previous state, which makes the dumped result undetermined.
- if (isRunningLayoutTest())
- context->fillRect(scrollbar->frameRect(), Color::black, ColorSpaceDeviceRGB);
-}
-
} // namespace WebCore
diff --git a/Source/WebCore/platform/chromium/ScrollbarThemeChromiumAndroid.h b/Source/WebCore/platform/chromium/ScrollbarThemeChromiumAndroid.h
index eab501029..84d647dde 100644
--- a/Source/WebCore/platform/chromium/ScrollbarThemeChromiumAndroid.h
+++ b/Source/WebCore/platform/chromium/ScrollbarThemeChromiumAndroid.h
@@ -46,7 +46,6 @@ public:
virtual IntRect trackRect(ScrollbarThemeClient*, bool painting = false);
virtual void paintThumb(GraphicsContext*, ScrollbarThemeClient*, const IntRect&);
- virtual void paintScrollbarBackground(GraphicsContext*, ScrollbarThemeClient*);
};
} // namespace WebCore
diff --git a/Source/WebCore/platform/clutter/GRefPtrClutter.cpp b/Source/WebCore/platform/clutter/GRefPtrClutter.cpp
deleted file mode 100644
index 2a34186c2..000000000
--- a/Source/WebCore/platform/clutter/GRefPtrClutter.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (C) 2011 Collabora Ltd.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-
-#include "config.h"
-#include "GRefPtrClutter.h"
-
-#include <clutter/clutter.h>
-
-namespace WTF {
-
-template <> GRefPtr<ClutterActor> adoptGRef(ClutterActor* ptr)
-{
- if (g_object_is_floating(ptr))
- g_object_ref_sink(ptr);
-
- return GRefPtr<ClutterActor>(ptr, GRefPtrAdopt);
-}
-
-template <> ClutterActor* refGPtr<ClutterActor>(ClutterActor* ptr)
-{
- if (ptr) {
- if (g_object_is_floating(ptr))
- g_object_ref_sink(ptr);
-
- g_object_ref(ptr);
- }
-
- return ptr;
-}
-
-template <> void derefGPtr<ClutterActor>(ClutterActor* ptr)
-{
- if (ptr)
- g_object_unref(ptr);
-}
-
-}
diff --git a/Source/WebCore/platform/clutter/GRefPtrClutter.h b/Source/WebCore/platform/clutter/GRefPtrClutter.h
deleted file mode 100644
index bdec65481..000000000
--- a/Source/WebCore/platform/clutter/GRefPtrClutter.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright (C) 2011 Collabora Ltd.
- *
- * 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.
- */
-
-#ifndef GRefPtrClutter_h
-#define GRefPtrClutter_h
-
-#include <wtf/gobject/GRefPtr.h>
-
-typedef struct _ClutterActor ClutterActor;
-
-namespace WTF {
-
-template<> ClutterActor* refGPtr<ClutterActor>(ClutterActor* ptr);
-template<> void derefGPtr<ClutterActor>(ClutterActor* ptr);
-
-}
-
-#endif
diff --git a/Source/WebCore/platform/graphics/BitmapImage.cpp b/Source/WebCore/platform/graphics/BitmapImage.cpp
index 0b1168078..d0a2aabd1 100644
--- a/Source/WebCore/platform/graphics/BitmapImage.cpp
+++ b/Source/WebCore/platform/graphics/BitmapImage.cpp
@@ -34,6 +34,7 @@
#include "PlatformMemoryInstrumentation.h"
#include "Timer.h"
#include <wtf/CurrentTime.h>
+#include <wtf/MemoryInstrumentationVector.h>
#include <wtf/Vector.h>
#include <wtf/text/WTFString.h>
@@ -578,7 +579,7 @@ void BitmapImage::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
Image::reportMemoryUsage(memoryObjectInfo);
info.addMember(m_source);
info.addMember(m_frameTimer);
- info.addVector(m_frames);
+ info.addMember(m_frames);
for (unsigned i = 0; i < m_frameCount; ++i) {
#if OS(WINCE) && !PLATFORM(QT)
info.addRawBuffer(m_frames[i].m_frame.get(), m_frames[i].m_frameBytes);
diff --git a/Source/WebCore/platform/graphics/BitmapImage.h b/Source/WebCore/platform/graphics/BitmapImage.h
index 10b372948..3f23dcedf 100644
--- a/Source/WebCore/platform/graphics/BitmapImage.h
+++ b/Source/WebCore/platform/graphics/BitmapImage.h
@@ -87,7 +87,6 @@ public:
// Clear the cached image data on the frame, and (optionally) the metadata.
// Returns whether there was cached image data to clear.
bool clear(bool clearMetadata);
- void reportMemoryUsage(MemoryObjectInfo*) const;
NativeImagePtr m_frame;
ImageOrientation m_orientation;
diff --git a/Source/WebCore/platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.cpp b/Source/WebCore/platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.cpp
index d696ad199..867d8158c 100644
--- a/Source/WebCore/platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.cpp
+++ b/Source/WebCore/platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.cpp
@@ -21,7 +21,6 @@
#if ENABLE(VIDEO)
#include "MediaPlayerPrivateBlackBerry.h"
-#include "AuthenticationChallengeManager.h"
#include "CookieManager.h"
#include "Credential.h"
#include "CredentialStorage.h"
@@ -115,7 +114,6 @@ MediaPlayerPrivate::MediaPlayerPrivate(MediaPlayer* player)
, m_userDrivenSeekTimer(this, &MediaPlayerPrivate::userDrivenSeekTimerFired)
, m_lastSeekTime(0)
, m_lastSeekTimePending(false)
- , m_isAuthenticationChallenging(false)
, m_waitMetadataTimer(this, &MediaPlayerPrivate::waitMetadataTimerFired)
, m_waitMetadataPopDialogCounter(0)
{
@@ -123,9 +121,6 @@ MediaPlayerPrivate::MediaPlayerPrivate(MediaPlayer* player)
MediaPlayerPrivate::~MediaPlayerPrivate()
{
- if (m_isAuthenticationChallenging)
- AuthenticationChallengeManager::instance()->cancelAuthenticationChallenge(this);
-
if (isFullscreen()) {
m_webCorePlayer->mediaPlayerClient()->mediaPlayerExitFullscreen();
}
@@ -352,13 +347,16 @@ void MediaPlayerPrivate::paint(GraphicsContext* context, const IntRect& rect)
return;
#if USE(ACCELERATED_COMPOSITING)
- // Only process paint calls coming via the accelerated compositing code
- // path, where we get called with a null graphics context. See
- // LayerCompositingThread::drawTextures(). Ignore calls from the regular
- // rendering path.
- if (!context)
- m_platformPlayer->notifyOutputUpdate(BlackBerry::Platform::IntRect(rect.x(), rect.y(), rect.width(), rect.height()));
- return;
+ if (supportsAcceleratedRendering()) {
+ // Only process paint calls coming via the accelerated compositing code
+ // path, where we get called with a null graphics context. See
+ // LayerCompositingThread::drawTextures(). Ignore calls from the regular
+ // rendering path.
+ if (!context)
+ m_platformPlayer->notifyOutputUpdate(BlackBerry::Platform::IntRect(rect.x(), rect.y(), rect.width(), rect.height()));
+
+ return;
+ }
#endif
paintCurrentFrameInContext(context, rect);
@@ -545,7 +543,7 @@ void MediaPlayerPrivate::updateStates()
m_showBufferingImage = false;
m_mediaIsBuffering = false;
// Create platform layer for video (create hole punch rect).
- if (!m_platformLayer)
+ if (!m_platformLayer && supportsAcceleratedRendering())
m_platformLayer = VideoLayerWebKitThread::create(m_webCorePlayer);
#endif
break;
@@ -715,18 +713,12 @@ void MediaPlayerPrivate::onAuthenticationNeeded(MMRAuthChallenge& authChallenge)
return;
}
- m_isAuthenticationChallenging = true;
- AuthenticationChallengeManager::instance()->authenticationChallenge(url,
- protectionSpace,
- credential,
- this,
- m_webCorePlayer->mediaPlayerClient()->mediaPlayerHostWindow()->platformPageClient());
+ if (frameView() && frameView()->hostWindow())
+ frameView()->hostWindow()->platformPageClient()->authenticationChallenge(url, protectionSpace, credential, this);
}
void MediaPlayerPrivate::notifyChallengeResult(const KURL& url, const ProtectionSpace& protectionSpace, AuthenticationChallengeResult result, const Credential& credential)
{
- m_isAuthenticationChallenging = false;
-
if (result != AuthenticationChallengeSuccess || !url.isValid())
return;
@@ -831,6 +823,13 @@ bool MediaPlayerPrivate::isTabVisible() const
return m_webCorePlayer->mediaPlayerClient()->mediaPlayerHostWindow()->platformPageClient()->isVisible();
}
+bool MediaPlayerPrivate::supportsAcceleratedRendering() const
+{
+ if (m_platformPlayer)
+ return m_platformPlayer->supportsAcceleratedRendering();
+ return false;
+}
+
#if USE(ACCELERATED_COMPOSITING)
static const double BufferingAnimationDelay = 1.0 / 24;
static char* s_bufferingImageData = 0;
diff --git a/Source/WebCore/platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.h b/Source/WebCore/platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.h
index 5a083b59e..2629e04f6 100644
--- a/Source/WebCore/platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.h
+++ b/Source/WebCore/platform/graphics/blackberry/MediaPlayerPrivateBlackBerry.h
@@ -96,7 +96,7 @@ public:
#if USE(ACCELERATED_COMPOSITING)
// Whether accelerated rendering is supported by the media engine for the current media.
- virtual bool supportsAcceleratedRendering() const { return true; }
+ virtual bool supportsAcceleratedRendering() const;
// Called when the rendering system flips the into or out of accelerated rendering mode.
virtual void acceleratedRenderingStateChanged() { }
#endif
@@ -174,7 +174,6 @@ private:
Timer<MediaPlayerPrivate> m_userDrivenSeekTimer;
float m_lastSeekTime;
bool m_lastSeekTimePending;
- bool m_isAuthenticationChallenging;
void waitMetadataTimerFired(Timer<MediaPlayerPrivate>*);
Timer<MediaPlayerPrivate> m_waitMetadataTimer;
int m_waitMetadataPopDialogCounter;
diff --git a/Source/WebCore/platform/graphics/chromium/CrossProcessFontLoading.mm b/Source/WebCore/platform/graphics/chromium/CrossProcessFontLoading.mm
index c0f10dc6b..a10956366 100644
--- a/Source/WebCore/platform/graphics/chromium/CrossProcessFontLoading.mm
+++ b/Source/WebCore/platform/graphics/chromium/CrossProcessFontLoading.mm
@@ -30,8 +30,10 @@
#import "CrossProcessFontLoading.h"
#import "../graphics/FontPlatformData.h"
-#import "PlatformSupport.h"
+#include "LinkHash.h"
#import <AppKit/NSFont.h>
+#import <public/Platform.h>
+#import <public/mac/WebSandboxSupport.h>
#import <wtf/HashMap.h>
namespace WebCore {
@@ -121,7 +123,15 @@ PassRefPtr<MemoryActivatedFont> loadFontFromBrowserProcess(NSFont* nsFont)
CGFontRef tmpCGFont;
uint32_t fontID;
// Send cross-process request to load font.
- if (!PlatformSupport::loadFont(nsFont, &tmpCGFont, &fontID))
+ WebKit::WebSandboxSupport* sandboxSupport = WebKit::Platform::current()->sandboxSupport();
+ if (!sandboxSupport) {
+ // This function should only be called in response to an error loading a
+ // font due to being blocked by the sandbox.
+ // This by definition shouldn't happen if there is no sandbox support.
+ ASSERT_NOT_REACHED();
+ return 0;
+ }
+ if (!sandboxSupport->loadFont(nsFont, &tmpCGFont, &fontID))
return 0;
RetainPtr<CGFontRef> cgFont(tmpCGFont);
@@ -129,7 +139,7 @@ PassRefPtr<MemoryActivatedFont> loadFontFromBrowserProcess(NSFont* nsFont)
// the ID cache.
font = fontCacheByFontID().get(fontID);
if (font)
- // FIXME: PlatformSupport::loadFont() should consult the id cache
+ // FIXME: WebSandboxSupport::loadFont() should consult the id cache
// before activating the font.
return font;
diff --git a/Source/WebCore/platform/graphics/clutter/GraphicsLayerClutter.h b/Source/WebCore/platform/graphics/clutter/GraphicsLayerClutter.h
index 42f6b76f9..3e142e487 100644
--- a/Source/WebCore/platform/graphics/clutter/GraphicsLayerClutter.h
+++ b/Source/WebCore/platform/graphics/clutter/GraphicsLayerClutter.h
@@ -29,10 +29,10 @@
#if USE(ACCELERATED_COMPOSITING)
-#include "GRefPtrClutter.h"
#include "GraphicsLayer.h"
#include <clutter/clutter.h>
+#include <wtf/gobject/GRefPtr.h>
namespace WebCore {
diff --git a/Source/WebCore/platform/graphics/clutter/PlatformClutterLayerClient.h b/Source/WebCore/platform/graphics/clutter/PlatformClutterLayerClient.h
new file mode 100644
index 000000000..90b56ab6a
--- /dev/null
+++ b/Source/WebCore/platform/graphics/clutter/PlatformClutterLayerClient.h
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2011 Collabora Ltd.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. 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 APPLE INC. ``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 APPLE COMPUTER, INC. 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 PlatformClutterLayerClient_h
+#define PlatformClutterLayerClient_h
+
+#if USE(ACCELERATED_COMPOSITING)
+
+#include "GraphicsContext.h"
+#include "GraphicsLayer.h"
+
+namespace WebCore {
+
+class PlatformClutterLayerClient {
+public:
+ virtual void platformClutterLayerPaintContents(GraphicsContext&, const IntRect& inClip) = 0;
+ virtual void platformClutterLayerAnimationStarted(double startTime) = 0;
+
+protected:
+ virtual ~PlatformClutterLayerClient() { }
+};
+
+}
+
+#endif // USE(ACCELERATED_COMPOSITING)
+
+#endif // PlatformClutterLayerClient_h
+
diff --git a/Source/WebCore/platform/graphics/clutter/TransformationMatrixClutter.cpp b/Source/WebCore/platform/graphics/clutter/TransformationMatrixClutter.cpp
new file mode 100644
index 000000000..d5c3f2ae4
--- /dev/null
+++ b/Source/WebCore/platform/graphics/clutter/TransformationMatrixClutter.cpp
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2011 Collabora Ltd.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301 USA
+ */
+
+#include "config.h"
+#include "TransformationMatrix.h"
+
+#include <cogl/cogl.h>
+
+namespace WebCore {
+
+TransformationMatrix::operator CoglMatrix() const
+{
+ CoglMatrix matrix;
+
+ matrix.xx = m11();
+ matrix.xy = m21();
+ matrix.xz = m31();
+ matrix.xw = m41();
+
+ matrix.yx = m12();
+ matrix.yy = m22();
+ matrix.yz = m32();
+ matrix.yw = m42();
+
+ matrix.zx = m13();
+ matrix.zy = m23();
+ matrix.zz = m33();
+ matrix.zw = m43();
+
+ matrix.wx = m14();
+ matrix.wy = m24();
+ matrix.wz = m34();
+ matrix.ww = m44();
+
+ return matrix;
+}
+
+}
diff --git a/Source/WebCore/platform/graphics/mac/ComplexTextController.cpp b/Source/WebCore/platform/graphics/mac/ComplexTextController.cpp
index edc74fbb5..3553a9780 100644
--- a/Source/WebCore/platform/graphics/mac/ComplexTextController.cpp
+++ b/Source/WebCore/platform/graphics/mac/ComplexTextController.cpp
@@ -575,14 +575,8 @@ void ComplexTextController::adjustGlyphsAndAdvances()
nextCh = *(m_complexTextRuns[r + 1]->characters() + m_complexTextRuns[r + 1]->indexAt(0));
bool treatAsSpace = Font::treatAsSpace(ch);
- CGGlyph glyph = glyphs[i];
- CGSize advance = advances[i];
- // FIXME: We should find a way to substitute spaces for characters that are treated as spaces
- // before handing them off to Core Text, so that kerning can be applied as if they were spaces.
- if (treatAsSpace && ch != ' ') {
- glyph = fontData->spaceGlyph();
- advance.width = spaceWidth;
- }
+ CGGlyph glyph = treatAsSpace ? fontData->spaceGlyph() : glyphs[i];
+ CGSize advance = treatAsSpace ? CGSizeMake(spaceWidth, advances[i].height) : advances[i];
if (ch == '\t' && m_run.allowTabs())
advance.width = m_font.tabWidth(*fontData, m_run.tabSize(), m_run.xPos() + m_totalWidth + widthSinceLastCommit);
diff --git a/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGLCommon.cpp b/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGLCommon.cpp
index a3c056591..60f6bfaf3 100644
--- a/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGLCommon.cpp
+++ b/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGLCommon.cpp
@@ -125,7 +125,7 @@ String Extensions3DOpenGLCommon::getTranslatedShaderSourceANGLE(Platform3DObject
#if PLATFORM(MAC)
const char* vendor = reinterpret_cast<const char*>(::glGetString(GL_VENDOR));
- if (vendor && (std::strstr(vendor, "ATI") || std::strstr(vendor, "AMD")))
+ if (vendor && (std::strstr(vendor, "ATI") || std::strstr(vendor, "AMD") || std::strstr(vendor, "Intel")))
extraCompileOptions |= SH_EMULATE_BUILT_IN_FUNCTIONS;
#endif
diff --git a/Source/WebCore/platform/graphics/transforms/TransformationMatrix.h b/Source/WebCore/platform/graphics/transforms/TransformationMatrix.h
index cd1db5e03..9eda74608 100644
--- a/Source/WebCore/platform/graphics/transforms/TransformationMatrix.h
+++ b/Source/WebCore/platform/graphics/transforms/TransformationMatrix.h
@@ -34,6 +34,9 @@
#if USE(CA)
typedef struct CATransform3D CATransform3D;
#endif
+#if USE(CLUTTER)
+typedef struct _CoglMatrix CoglMatrix;
+#endif
#if USE(CG)
typedef struct CGAffineTransform CGAffineTransform;
#elif USE(CAIRO)
@@ -324,6 +327,9 @@ public:
TransformationMatrix(const CATransform3D&);
operator CATransform3D() const;
#endif
+#if USE(CLUTTER)
+ operator CoglMatrix() const;
+#endif
#if USE(CG)
TransformationMatrix(const CGAffineTransform&);
operator CGAffineTransform() const;
diff --git a/Source/WebCore/platform/gtk/GtkInputMethodFilter.cpp b/Source/WebCore/platform/gtk/GtkInputMethodFilter.cpp
index da0ec7fa0..8696ef37a 100644
--- a/Source/WebCore/platform/gtk/GtkInputMethodFilter.cpp
+++ b/Source/WebCore/platform/gtk/GtkInputMethodFilter.cpp
@@ -292,7 +292,7 @@ void GtkInputMethodFilter::handleCommit(const char* compositionString)
if (!m_enabled)
return;
- m_confirmedComposition += String::fromUTF8(compositionString);
+ m_confirmedComposition.append(String::fromUTF8(compositionString));
// If the commit was triggered outside of a key event, just send
// the IME event now. If we are handling a key event, we'll decide
diff --git a/Source/WebCore/platform/gtk/GtkWidgetBackingStoreX11.cpp b/Source/WebCore/platform/gtk/GtkWidgetBackingStoreX11.cpp
index afead805b..60376bc77 100644
--- a/Source/WebCore/platform/gtk/GtkWidgetBackingStoreX11.cpp
+++ b/Source/WebCore/platform/gtk/GtkWidgetBackingStoreX11.cpp
@@ -22,8 +22,8 @@
#include "GtkVersioning.h"
#include "RefPtrCairo.h"
#include <X11/Xlib.h>
-#include <cairo/cairo-xlib.h>
-#include <cairo/cairo.h>
+#include <cairo-xlib.h>
+#include <cairo.h>
#include <gdk/gdkx.h>
namespace WebCore {
diff --git a/Source/WebCore/platform/mac/KURLMac.mm b/Source/WebCore/platform/mac/KURLMac.mm
index 9efbee0d8..d5c25e147 100644
--- a/Source/WebCore/platform/mac/KURLMac.mm
+++ b/Source/WebCore/platform/mac/KURLMac.mm
@@ -53,7 +53,7 @@ KURL::KURL(NSURL *url)
#else
m_urlImpl = adoptRef(new KURLWTFURLImpl());
String urlString(bytes, bytesLength);
- m_urlImpl->m_parsedURL = ParsedURL(urlString);
+ m_urlImpl->m_parsedURL = ParsedURL(urlString, 0);
if (!m_urlImpl->m_parsedURL.isValid())
m_urlImpl->m_invalidUrlString = urlString;
#endif // USE(WTFURL)
diff --git a/Source/WebCore/platform/mock/GeolocationClientMock.cpp b/Source/WebCore/platform/mock/GeolocationClientMock.cpp
index 276b4a343..9901b66aa 100644
--- a/Source/WebCore/platform/mock/GeolocationClientMock.cpp
+++ b/Source/WebCore/platform/mock/GeolocationClientMock.cpp
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2010 Google Inc. All rights reserved.
+ * Copyright (C) 2012 Apple Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -41,6 +42,7 @@ namespace WebCore {
GeolocationClientMock::GeolocationClientMock()
: m_controller(0)
+ , m_hasError(false)
, m_controllerTimer(this, &GeolocationClientMock::controllerTimerFired)
, m_permissionTimer(this, &GeolocationClientMock::permissionTimerFired)
, m_isActive(false)
@@ -62,14 +64,15 @@ void GeolocationClientMock::setController(GeolocationController *controller)
void GeolocationClientMock::setPosition(PassRefPtr<GeolocationPosition> position)
{
m_lastPosition = position;
- m_lastError = 0;
+ clearError();
asyncUpdateController();
}
-void GeolocationClientMock::setError(PassRefPtr<GeolocationError> error)
+void GeolocationClientMock::setPositionUnavailableError(const String& errorMessage)
{
- m_lastError = error;
- m_lastPosition = 0;
+ m_hasError = true;
+ m_errorMessage = errorMessage;
+ m_lastPosition = nullptr;
asyncUpdateController();
}
@@ -125,7 +128,7 @@ void GeolocationClientMock::permissionTimerFired(WebCore::Timer<GeolocationClien
void GeolocationClientMock::reset()
{
m_lastPosition = 0;
- m_lastError = 0;
+ clearError();
m_permissionState = PermissionStateUnset;
}
@@ -171,10 +174,19 @@ void GeolocationClientMock::controllerTimerFired(Timer<GeolocationClientMock>* t
ASSERT_UNUSED(timer, timer == &m_controllerTimer);
ASSERT(m_controller);
- if (m_lastPosition.get())
+ if (m_lastPosition.get()) {
+ ASSERT(!m_hasError);
m_controller->positionChanged(m_lastPosition.get());
- else if (m_lastError.get())
- m_controller->errorOccurred(m_lastError.get());
+ } else if (m_hasError) {
+ RefPtr<GeolocationError> geolocatioError = GeolocationError::create(GeolocationError::PositionUnavailable, m_errorMessage);
+ m_controller->errorOccurred(geolocatioError.get());
+ }
+}
+
+void GeolocationClientMock::clearError()
+{
+ m_hasError = false;
+ m_errorMessage = String();
}
} // WebCore
diff --git a/Source/WebCore/platform/mock/GeolocationClientMock.h b/Source/WebCore/platform/mock/GeolocationClientMock.h
index 8abd5e970..f380c1443 100644
--- a/Source/WebCore/platform/mock/GeolocationClientMock.h
+++ b/Source/WebCore/platform/mock/GeolocationClientMock.h
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2010 Google Inc. All rights reserved.
+ * Copyright (C) 2012 Apple Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -42,9 +43,9 @@ namespace WebCore {
class GeolocationController;
class GeolocationPosition;
-class GeolocationError;
-// Provides a mock object for the geolocation client
+// FIXME: this should not be in WebCore. It should be moved to WebKit.
+// Provides a mock object for the geolocation client.
class GeolocationClientMock : public GeolocationClient {
public:
GeolocationClientMock();
@@ -53,8 +54,8 @@ public:
void reset();
void setController(GeolocationController*);
- void setError(PassRefPtr<GeolocationError>);
void setPosition(PassRefPtr<GeolocationPosition>);
+ void setPositionUnavailableError(const String& errorMessage);
void setPermission(bool allowed);
int numberOfPendingPermissionRequests() const;
@@ -74,9 +75,12 @@ private:
void asyncUpdatePermission();
void permissionTimerFired(Timer<GeolocationClientMock>*);
+ void clearError();
+
GeolocationController* m_controller;
RefPtr<GeolocationPosition> m_lastPosition;
- RefPtr<GeolocationError> m_lastError;
+ bool m_hasError;
+ String m_errorMessage;
Timer<GeolocationClientMock> m_controllerTimer;
Timer<GeolocationClientMock> m_permissionTimer;
bool m_isActive;
diff --git a/Source/WebCore/platform/network/FormData.cpp b/Source/WebCore/platform/network/FormData.cpp
index 45f730248..43a71af1a 100644
--- a/Source/WebCore/platform/network/FormData.cpp
+++ b/Source/WebCore/platform/network/FormData.cpp
@@ -37,6 +37,7 @@
#include "TextEncoding.h"
#include <wtf/Decoder.h>
#include <wtf/Encoder.h>
+#include <wtf/MemoryInstrumentationVector.h>
namespace WebCore {
@@ -360,7 +361,7 @@ void FormData::removeGeneratedFilesIfNeeded()
void FormData::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
{
MemoryClassInfo info(memoryObjectInfo, this, PlatformMemoryTypes::Loader);
- info.addVector(m_boundary);
+ info.addMember(m_boundary);
}
static void encode(Encoder& encoder, const FormDataElement& element)
diff --git a/Source/WebCore/platform/network/ResourceRequestBase.cpp b/Source/WebCore/platform/network/ResourceRequestBase.cpp
index 00f583905..303deaa9c 100644
--- a/Source/WebCore/platform/network/ResourceRequestBase.cpp
+++ b/Source/WebCore/platform/network/ResourceRequestBase.cpp
@@ -28,6 +28,7 @@
#include "PlatformMemoryInstrumentation.h"
#include "ResourceRequest.h"
+#include <wtf/MemoryInstrumentationVector.h>
using namespace std;
@@ -452,7 +453,7 @@ void ResourceRequestBase::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo)
info.addMember(m_httpMethod);
info.addHashMap(m_httpHeaderFields);
info.addInstrumentedMapEntries(m_httpHeaderFields);
- info.addInstrumentedVector(m_responseContentDispositionEncodingFallbackArray);
+ info.addMember(m_responseContentDispositionEncodingFallbackArray);
info.addMember(m_httpBody);
}
diff --git a/Source/WebCore/platform/network/blackberry/CredentialBackingStore.cpp b/Source/WebCore/platform/network/blackberry/CredentialBackingStore.cpp
index f60c6c212..b08a84110 100644
--- a/Source/WebCore/platform/network/blackberry/CredentialBackingStore.cpp
+++ b/Source/WebCore/platform/network/blackberry/CredentialBackingStore.cpp
@@ -265,7 +265,7 @@ ProtectionSpace CredentialBackingStore::getProtectionSpace(const KURL& url)
int result = m_getLoginByURLStatement->step();
String username = m_getLoginByURLStatement->getColumnText(0);
- String password = m_usingCertManager ? "" : m_getLoginByURLStatement->getColumnBlobAsString(1);
+ String password = certMgrWrapper()->isReady() ? "" : m_getLoginByURLStatement->getColumnBlobAsString(1);
String host = m_getLoginByURLStatement->getColumnText(2);
int port = m_getLoginByURLStatement->getColumnInt(3);
int serviceType = m_getLoginByURLStatement->getColumnInt(4);
diff --git a/Source/WebCore/platform/network/blackberry/NetworkJob.cpp b/Source/WebCore/platform/network/blackberry/NetworkJob.cpp
index cca89b520..98ebe6059 100644
--- a/Source/WebCore/platform/network/blackberry/NetworkJob.cpp
+++ b/Source/WebCore/platform/network/blackberry/NetworkJob.cpp
@@ -19,7 +19,6 @@
#include "config.h"
#include "NetworkJob.h"
-#include "AuthenticationChallengeManager.h"
#include "Chrome.h"
#include "ChromeClient.h"
#include "CookieManager.h"
@@ -85,16 +84,9 @@ NetworkJob::NetworkJob()
, m_deferredData(*this)
, m_deferLoadingCount(0)
, m_frame(0)
- , m_isAuthenticationChallenging(false)
{
}
-NetworkJob::~NetworkJob()
-{
- if (m_isAuthenticationChallenging)
- AuthenticationChallengeManager::instance()->cancelAuthenticationChallenge(this);
-}
-
bool NetworkJob::initialize(int playerId,
const String& pageGroupName,
const KURL& url,
@@ -211,8 +203,10 @@ void NetworkJob::handleNotifyStatusReceived(int status, const String& message)
m_response.setHTTPStatusText(message);
- if (isUnauthorized(m_extendedStatusCode))
+ if (isUnauthorized(m_extendedStatusCode)) {
purgeCredentials();
+ BlackBerry::Platform::log(BlackBerry::Platform::LogLevelCritical, "Authentication failed, purge the stored credentials for this site.");
+ }
}
void NetworkJob::notifyHeadersReceived(BlackBerry::Platform::NetworkRequest::HeaderList& headers)
@@ -490,7 +484,6 @@ void NetworkJob::handleNotifyClose(int status)
#ifndef NDEBUG
m_isRunning = false;
#endif
-
if (!m_cancelled) {
if (!m_statusReceived) {
// Connection failed before sending notifyStatusReceived: use generic NetworkError.
@@ -502,7 +495,6 @@ void NetworkJob::handleNotifyClose(int status)
m_extendedStatusCode = BlackBerry::Platform::FilterStream::StatusTooManyRedirects;
sendResponseIfNeeded();
-
if (isClientAvailable()) {
if (isError(status))
m_extendedStatusCode = status;
@@ -775,15 +767,7 @@ bool NetworkJob::sendRequestWithCredentials(ProtectionSpaceServerType type, Prot
return false;
m_handle->getInternal()->m_currentWebChallenge = AuthenticationChallenge();
-
- m_isAuthenticationChallenging = true;
- updateDeferLoadingCount(1);
-
- AuthenticationChallengeManager::instance()->authenticationChallenge(newURL,
- protectionSpace,
- Credential(),
- this,
- m_frame->page()->chrome()->client()->platformPageClient());
+ m_frame->page()->chrome()->client()->platformPageClient()->authenticationChallenge(newURL, protectionSpace, Credential(), this);
return true;
}
@@ -844,17 +828,11 @@ void NetworkJob::fireDeleteJobTimer(Timer<NetworkJob>*)
void NetworkJob::notifyChallengeResult(const KURL& url, const ProtectionSpace& protectionSpace, AuthenticationChallengeResult result, const Credential& credential)
{
- m_isAuthenticationChallenging = false;
-
if (result != AuthenticationChallengeSuccess || protectionSpace.host().isEmpty() || !url.isValid()) {
m_newJobWithCredentialsStarted = false;
- updateDeferLoadingCount(-1);
return;
}
- cancelJob();
- updateDeferLoadingCount(-1);
-
if (m_handle->getInternal()->m_currentWebChallenge.isNull())
m_handle->getInternal()->m_currentWebChallenge = AuthenticationChallenge(protectionSpace, credential, 0, m_response, ResourceError());
diff --git a/Source/WebCore/platform/network/blackberry/NetworkJob.h b/Source/WebCore/platform/network/blackberry/NetworkJob.h
index 8bfb46708..3526374ab 100644
--- a/Source/WebCore/platform/network/blackberry/NetworkJob.h
+++ b/Source/WebCore/platform/network/blackberry/NetworkJob.h
@@ -29,7 +29,6 @@
#include <network/FilterStream.h>
#include <wtf/OwnPtr.h>
#include <wtf/RefPtr.h>
-#include <wtf/Vector.h>
#include <wtf/text/WTFString.h>
namespace BlackBerry {
@@ -50,8 +49,6 @@ class ResourceRequest;
class NetworkJob : public AuthenticationChallengeClient, public BlackBerry::Platform::FilterStream {
public:
NetworkJob();
- ~NetworkJob();
-
bool initialize(int playerId,
const String& pageGroupName,
const KURL&,
@@ -174,8 +171,6 @@ private:
DeferredData m_deferredData;
int m_deferLoadingCount;
const Frame* m_frame;
-
- bool m_isAuthenticationChallenging;
};
} // namespace WebCore
diff --git a/Source/WebCore/platform/text/mac/LocaleMac.h b/Source/WebCore/platform/text/mac/LocaleMac.h
index 26ca6a220..0e48c2e96 100644
--- a/Source/WebCore/platform/text/mac/LocaleMac.h
+++ b/Source/WebCore/platform/text/mac/LocaleMac.h
@@ -47,6 +47,7 @@ class DateComponents;
class LocaleMac : public Localizer {
public:
static PassOwnPtr<LocaleMac> create(const String&);
+ static PassOwnPtr<LocaleMac> create(NSLocale*);
static LocaleMac* currentLocale();
~LocaleMac();
double parseDate(const String&);
@@ -67,7 +68,6 @@ public:
private:
explicit LocaleMac(NSLocale*);
- explicit LocaleMac(const String&);
NSDateFormatter *createShortDateFormatter();
virtual void initializeLocalizerData() OVERRIDE;
diff --git a/Source/WebCore/platform/text/mac/LocaleMac.mm b/Source/WebCore/platform/text/mac/LocaleMac.mm
index 91ece4d06..e381c022d 100644
--- a/Source/WebCore/platform/text/mac/LocaleMac.mm
+++ b/Source/WebCore/platform/text/mac/LocaleMac.mm
@@ -45,9 +45,30 @@ using namespace std;
namespace WebCore {
+static inline String languageFromLocale(const String& locale)
+{
+ String normalizedLocale = locale;
+ normalizedLocale.replace('-', '_');
+ size_t separatorPosition = normalizedLocale.find('_');
+ if (separatorPosition == notFound)
+ return normalizedLocale;
+ return normalizedLocale.left(separatorPosition);
+}
+
+static NSLocale* determineLocale(const String& locale)
+{
+ NSLocale* currentLocale = [NSLocale currentLocale];
+ String currentLocaleLanguage = languageFromLocale(String([currentLocale localeIdentifier]));
+ String localeLanguage = languageFromLocale(locale);
+ if (equalIgnoringCase(currentLocaleLanguage, localeLanguage))
+ return currentLocale;
+ // It seems initWithLocaleIdentifier accepts dash-separated locale identifier.
+ return [[NSLocale alloc] initWithLocaleIdentifier:locale];
+}
+
PassOwnPtr<Localizer> Localizer::create(const AtomicString& locale)
{
- return LocaleMac::create(locale.string());
+ return LocaleMac::create(determineLocale(locale.string()));
}
static NSDateFormatter* createDateTimeFormatter(NSLocale* locale, NSDateFormatterStyle dateStyle, NSDateFormatterStyle timeStyle)
@@ -65,12 +86,6 @@ LocaleMac::LocaleMac(NSLocale* locale)
: m_locale(locale)
, m_didInitializeNumberData(false)
{
-}
-
-LocaleMac::LocaleMac(const String& localeIdentifier)
- : m_locale([[NSLocale alloc] initWithLocaleIdentifier:localeIdentifier])
- , m_didInitializeNumberData(false)
-{
NSArray* availableLanguages = [NSLocale ISOLanguageCodes];
// NSLocale returns a lower case NSLocaleLanguageCode so we don't have care about case.
NSString* language = [m_locale.get() objectForKey:NSLocaleLanguageCode];
@@ -84,33 +99,17 @@ LocaleMac::~LocaleMac()
PassOwnPtr<LocaleMac> LocaleMac::create(const String& localeIdentifier)
{
- return adoptPtr(new LocaleMac(localeIdentifier));
+ return adoptPtr(new LocaleMac([[NSLocale alloc] initWithLocaleIdentifier:localeIdentifier]));
}
-static inline String languageFromLocale(const String& locale)
+PassOwnPtr<LocaleMac> LocaleMac::create(NSLocale* locale)
{
- String normalizedLocale = locale;
- normalizedLocale.replace('-', '_');
- size_t separatorPosition = normalizedLocale.find('_');
- if (separatorPosition == notFound)
- return normalizedLocale;
- return normalizedLocale.left(separatorPosition);
-}
-
-static NSLocale* determineLocale()
-{
- NSLocale* currentLocale = [NSLocale currentLocale];
- String currentLocaleLanguage = languageFromLocale(String([currentLocale localeIdentifier]));
- String browserLanguage = languageFromLocale(defaultLanguage());
- if (equalIgnoringCase(currentLocaleLanguage, browserLanguage))
- return currentLocale;
- // It seems initWithLocaleIdentifier accepts dash-separated locale identifier.
- return [[NSLocale alloc] initWithLocaleIdentifier:defaultLanguage()];
+ return adoptPtr(new LocaleMac(locale));
}
LocaleMac* LocaleMac::currentLocale()
{
- static LocaleMac* currentLocale = new LocaleMac(determineLocale());
+ static LocaleMac* currentLocale = new LocaleMac(determineLocale(defaultLanguage()));
return currentLocale;
}
diff --git a/Source/WebCore/plugins/gtk/PluginViewGtk.cpp b/Source/WebCore/plugins/gtk/PluginViewGtk.cpp
index 62f9f8d84..4006040d8 100644
--- a/Source/WebCore/plugins/gtk/PluginViewGtk.cpp
+++ b/Source/WebCore/plugins/gtk/PluginViewGtk.cpp
@@ -76,7 +76,7 @@
#define Bool int // this got undefined somewhere
#define Status int // ditto
#include <X11/extensions/Xrender.h>
-#include <cairo/cairo-xlib.h>
+#include <cairo-xlib.h>
#include <gdk/gdkx.h>
using JSC::ExecState;
diff --git a/Source/WebCore/rendering/ExclusionRectangle.cpp b/Source/WebCore/rendering/ExclusionRectangle.cpp
index 78f83b055..3bdde0aee 100644
--- a/Source/WebCore/rendering/ExclusionRectangle.cpp
+++ b/Source/WebCore/rendering/ExclusionRectangle.cpp
@@ -40,10 +40,10 @@ static inline float ellipseXIntercept(float y, float rx, float ry)
return rx * sqrt(1 - (y*y) / (ry*ry));
}
-void ExclusionRectangle::getOutsideIntervals(float y1, float y2, Vector<ExclusionInterval>& rv) const
+void ExclusionRectangle::getExcludedIntervals(float logicalTop, float logicalBottom, SegmentList& result) const
{
- if (y1 > y2)
- std::swap(y1, y2);
+ float y1 = minYForLogicalLine(logicalTop, logicalBottom);
+ float y2 = maxYForLogicalLine(logicalTop, logicalBottom);
if (y2 < m_y || y1 >= m_y + m_height)
return;
@@ -65,15 +65,15 @@ void ExclusionRectangle::getOutsideIntervals(float y1, float y2, Vector<Exclusio
}
}
- rv.append(ExclusionInterval(x1, x2));
+ result.append(LineSegment(x1, x2));
}
-void ExclusionRectangle::getInsideIntervals(float y1, float y2, Vector<ExclusionInterval>& rv) const
+void ExclusionRectangle::getIncludedIntervals(float logicalTop, float logicalBottom, SegmentList& result) const
{
- if (y1 > y2)
- std::swap(y1, y2);
+ float y1 = minYForLogicalLine(logicalTop, logicalBottom);
+ float y2 = maxYForLogicalLine(logicalTop, logicalBottom);
- if (y1 < m_y || y2 >= m_y + m_height)
+ if (y1 < m_y || y2 > m_y + m_height)
return;
float x1 = m_x;
@@ -106,7 +106,7 @@ void ExclusionRectangle::getInsideIntervals(float y1, float y2, Vector<Exclusion
}
}
- rv.append(ExclusionInterval(x1, x2));
+ result.append(LineSegment(x1, x2));
}
} // namespace WebCore
diff --git a/Source/WebCore/rendering/ExclusionRectangle.h b/Source/WebCore/rendering/ExclusionRectangle.h
index 6af021772..5ca289d86 100644
--- a/Source/WebCore/rendering/ExclusionRectangle.h
+++ b/Source/WebCore/rendering/ExclusionRectangle.h
@@ -31,6 +31,7 @@
#define ExclusionRectangle_h
#include "ExclusionShape.h"
+#include "FloatSize.h"
#include <wtf/Assertions.h>
#include <wtf/Vector.h>
@@ -38,20 +39,20 @@ namespace WebCore {
class ExclusionRectangle : public ExclusionShape {
public:
- ExclusionRectangle(float x, float y, float width, float height, float rx = 0, float ry = 0)
+ ExclusionRectangle(const FloatRect& bounds, const FloatSize& radii)
: ExclusionShape()
- , m_x(x)
- , m_y(y)
- , m_width(width)
- , m_height(height)
- , m_rx(rx)
- , m_ry(ry)
+ , m_x(bounds.x())
+ , m_y(bounds.y())
+ , m_width(bounds.width())
+ , m_height(bounds.height())
+ , m_rx(radii.width())
+ , m_ry(radii.height())
{
}
- virtual FloatRect shapeLogicalBoundingBox() const OVERRIDE { return FloatRect(m_x, m_y, m_width, m_height); }
- virtual void getOutsideIntervals(float y1, float y2, Vector<ExclusionInterval>&) const OVERRIDE;
- virtual void getInsideIntervals(float y1, float y2, Vector<ExclusionInterval>&) const OVERRIDE;
+ virtual FloatRect shapeLogicalBoundingBox() const OVERRIDE { return internalToLogicalBoundingBox(FloatRect(m_x, m_y, m_width, m_height)); }
+ virtual void getExcludedIntervals(float logicalTop, float logicalBottom, SegmentList&) const OVERRIDE;
+ virtual void getIncludedIntervals(float logicalTop, float logicalBottom, SegmentList&) const OVERRIDE;
private:
float m_x;
diff --git a/Source/WebCore/rendering/ExclusionShape.cpp b/Source/WebCore/rendering/ExclusionShape.cpp
index 48c88b653..0f430ef04 100644
--- a/Source/WebCore/rendering/ExclusionShape.cpp
+++ b/Source/WebCore/rendering/ExclusionShape.cpp
@@ -32,6 +32,7 @@
#include "BasicShapeFunctions.h"
#include "ExclusionRectangle.h"
+#include "FloatSize.h"
#include "LengthFunctions.h"
#include "NotImplemented.h"
#include "WindRule.h"
@@ -41,66 +42,93 @@
namespace WebCore {
-static PassOwnPtr<ExclusionShape> createExclusionRectangle(float x, float y, float width, float height, float rx, float ry)
+static PassOwnPtr<ExclusionShape> createExclusionRectangle(const FloatRect& bounds, const FloatSize& radii)
{
- ASSERT(width >= 0 && height >= 0 && rx >= 0 && ry >= 0);
- return adoptPtr(new ExclusionRectangle(x, y, width, height, rx, ry));
+ ASSERT(bounds.width() >= 0 && bounds.height() >= 0 && radii.width() >= 0 && radii.height() >= 0);
+ return adoptPtr(new ExclusionRectangle(bounds, radii));
}
-static PassOwnPtr<ExclusionShape> createExclusionCircle(float cx, float cy, float radius)
+static PassOwnPtr<ExclusionShape> createExclusionCircle(const FloatPoint& center, float radius)
{
ASSERT(radius >= 0);
- return adoptPtr(new ExclusionRectangle(cx - radius, cy - radius, cx + radius, cy + radius, radius, radius));
+ return adoptPtr(new ExclusionRectangle(FloatRect(center.x() - radius, center.y() - radius, radius*2, radius*2), FloatSize(radius, radius)));
}
-static PassOwnPtr<ExclusionShape> createExclusionEllipse(float cx, float cy, float rx, float ry)
+static PassOwnPtr<ExclusionShape> createExclusionEllipse(const FloatPoint& center, const FloatSize& radii)
{
- ASSERT(rx >= 0 && ry >= 0);
- return adoptPtr(new ExclusionRectangle(cx - rx, cy - ry, cx + rx, cy + ry, rx, ry));
+ ASSERT(radii.width() >= 0 && radii.height() >= 0);
+ return adoptPtr(new ExclusionRectangle(FloatRect(center.x() - radii.width(), center.y() - radii.height(), radii.width()*2, radii.height()*2), radii));
}
-PassOwnPtr<ExclusionShape> ExclusionShape::createExclusionShape(const BasicShape* wrapShape, float borderBoxLogicalWidth, float borderBoxLogicalHeight)
+// If the writingMode is vertical, then the BasicShape's (physical) x and y coordinates are swapped, so that
+// line segments are parallel to the internal coordinate system's X axis.
+
+PassOwnPtr<ExclusionShape> ExclusionShape::createExclusionShape(const BasicShape* basicShape, float logicalBoxWidth, float logicalBoxHeight, WritingMode writingMode)
{
- if (!wrapShape)
+ if (!basicShape)
return nullptr;
- switch (wrapShape->type()) {
+ bool horizontalWritingMode = isHorizontalWritingMode(writingMode);
+ float boxWidth = horizontalWritingMode ? logicalBoxWidth : logicalBoxHeight;
+ float boxHeight = horizontalWritingMode ? logicalBoxHeight : logicalBoxWidth;
+ OwnPtr<ExclusionShape> exclusionShape;
+
+ switch (basicShape->type()) {
+
case BasicShape::BASIC_SHAPE_RECTANGLE: {
- const BasicShapeRectangle* rectangle = static_cast<const BasicShapeRectangle*>(wrapShape);
- Length rx = rectangle->cornerRadiusX();
- Length ry = rectangle->cornerRadiusY();
- return createExclusionRectangle(
- floatValueForLength(rectangle->x(), borderBoxLogicalWidth),
- floatValueForLength(rectangle->y(), borderBoxLogicalHeight),
- floatValueForLength(rectangle->width(), borderBoxLogicalWidth),
- floatValueForLength(rectangle->height(), borderBoxLogicalHeight),
- rx.isUndefined() ? 0 : floatValueForLength(rx, borderBoxLogicalWidth),
- ry.isUndefined() ? 0 : floatValueForLength(ry, borderBoxLogicalHeight) );
+ const BasicShapeRectangle* rectangle = static_cast<const BasicShapeRectangle*>(basicShape);
+ float x = floatValueForLength(rectangle->x(), boxWidth);
+ float y = floatValueForLength(rectangle->y(), boxHeight);
+ float width = floatValueForLength(rectangle->width(), boxWidth);
+ float height = floatValueForLength(rectangle->height(), boxHeight);
+ Length radiusXLength = rectangle->cornerRadiusX();
+ Length radiusYLength = rectangle->cornerRadiusY();
+ float radiusX = radiusXLength.isUndefined() ? 0 : floatValueForLength(radiusXLength, boxWidth);
+ float radiusY = radiusYLength.isUndefined() ? 0 : floatValueForLength(radiusYLength, boxHeight);
+
+ exclusionShape = horizontalWritingMode
+ ? createExclusionRectangle(FloatRect(x, y, width, height), FloatSize(radiusX, radiusY))
+ : createExclusionRectangle(FloatRect(y, x, height, width), FloatSize(radiusY, radiusX));
+ break;
}
case BasicShape::BASIC_SHAPE_CIRCLE: {
- const BasicShapeCircle* circle = static_cast<const BasicShapeCircle*>(wrapShape);
- return createExclusionCircle(
- floatValueForLength(circle->centerX(), borderBoxLogicalWidth),
- floatValueForLength(circle->centerY(), borderBoxLogicalHeight),
- floatValueForLength(circle->radius(), std::max(borderBoxLogicalHeight, borderBoxLogicalWidth)) );
+ const BasicShapeCircle* circle = static_cast<const BasicShapeCircle*>(basicShape);
+ float centerX = floatValueForLength(circle->centerX(), boxWidth);
+ float centerY = floatValueForLength(circle->centerY(), boxHeight);
+ float radius = floatValueForLength(circle->radius(), std::max(boxHeight, boxWidth));
+
+ exclusionShape = horizontalWritingMode
+ ? createExclusionCircle(FloatPoint(centerX, centerY), radius)
+ : createExclusionCircle(FloatPoint(centerY, centerX), radius);
+ break;
}
case BasicShape::BASIC_SHAPE_ELLIPSE: {
- const BasicShapeEllipse* ellipse = static_cast<const BasicShapeEllipse*>(wrapShape);
- return createExclusionEllipse(
- floatValueForLength(ellipse->centerX(), borderBoxLogicalWidth),
- floatValueForLength(ellipse->centerY(), borderBoxLogicalHeight),
- floatValueForLength(ellipse->radiusX(), borderBoxLogicalWidth),
- floatValueForLength(ellipse->radiusY(), borderBoxLogicalHeight) );
+ const BasicShapeEllipse* ellipse = static_cast<const BasicShapeEllipse*>(basicShape);
+ float centerX = floatValueForLength(ellipse->centerX(), boxWidth);
+ float centerY = floatValueForLength(ellipse->centerY(), boxHeight);
+ float radiusX = floatValueForLength(ellipse->radiusX(), boxWidth);
+ float radiusY = floatValueForLength(ellipse->radiusY(), boxHeight);
+
+ exclusionShape = horizontalWritingMode
+ ? createExclusionEllipse(FloatPoint(centerX, centerY), FloatSize(radiusX, radiusY))
+ : createExclusionEllipse(FloatPoint(centerY, centerX), FloatSize(radiusY, radiusX));
+ break;
}
case BasicShape::BASIC_SHAPE_POLYGON:
notImplemented();
+
+ default:
+ ASSERT_NOT_REACHED();
}
- ASSERT_NOT_REACHED();
- return nullptr;
+ exclusionShape->m_logicalBoxWidth = logicalBoxWidth;
+ exclusionShape->m_logicalBoxHeight = logicalBoxHeight;
+ exclusionShape->m_writingMode = writingMode;
+
+ return exclusionShape.release();
}
} // namespace WebCore
diff --git a/Source/WebCore/rendering/ExclusionShape.h b/Source/WebCore/rendering/ExclusionShape.h
index c5de4d705..bb1edc6d1 100644
--- a/Source/WebCore/rendering/ExclusionShape.h
+++ b/Source/WebCore/rendering/ExclusionShape.h
@@ -31,22 +31,51 @@
#define ExclusionShape_h
#include "BasicShapes.h"
-#include "ExclusionInterval.h"
#include "FloatRect.h"
+#include "WritingMode.h"
#include <wtf/PassOwnPtr.h>
#include <wtf/Vector.h>
namespace WebCore {
+struct LineSegment {
+ float logicalLeft;
+ float logicalRight;
+
+ LineSegment(float logicalLeft, float logicalRight)
+ : logicalLeft(logicalLeft)
+ , logicalRight(logicalRight)
+ {
+ }
+};
+
+typedef Vector<LineSegment> SegmentList;
+
+
+// A representation of a BasicShape that enables layout code to determine how to break a line up into segments
+// that will fit within or around a shape. The line is defined by a pair of logical Y coordinates and the
+// computed segments are returned as pairs of logical X coordinates. The BasicShape itself is defined in
+// physical coordinates.
+
class ExclusionShape {
public:
- static PassOwnPtr<ExclusionShape> createExclusionShape(const BasicShape*, float borderBoxLogicalWidth, float borderBoxLogicalHeight);
+ static PassOwnPtr<ExclusionShape> createExclusionShape(const BasicShape*, float logicalBoxWidth, float logicalBoxHeight, WritingMode);
virtual ~ExclusionShape() { }
virtual FloatRect shapeLogicalBoundingBox() const = 0;
- virtual void getInsideIntervals(float logicalTop, float logicalBottom, Vector<ExclusionInterval>&) const = 0;
- virtual void getOutsideIntervals(float logicalTop, float logicalBottom, Vector<ExclusionInterval>&) const = 0;
+ virtual void getIncludedIntervals(float logicalTop, float logicalBottom, SegmentList&) const = 0;
+ virtual void getExcludedIntervals(float logicalTop, float logicalBottom, SegmentList&) const = 0;
+
+protected:
+ float minYForLogicalLine(float logicalTop, float logicalBottom) const { return (m_writingMode == RightToLeftWritingMode) ? m_logicalBoxHeight - logicalBottom : logicalTop; }
+ float maxYForLogicalLine(float logicalTop, float logicalBottom) const { return (m_writingMode == RightToLeftWritingMode) ? m_logicalBoxHeight - logicalTop : logicalBottom; }
+ FloatRect internalToLogicalBoundingBox(FloatRect r) const { return (m_writingMode == RightToLeftWritingMode) ? FloatRect(r.x(), m_logicalBoxHeight - r.maxY(), r.width(), r.height()) : r; }
+
+private:
+ WritingMode m_writingMode;
+ float m_logicalBoxWidth;
+ float m_logicalBoxHeight;
};
} // namespace WebCore
diff --git a/Source/WebCore/rendering/RenderBR.cpp b/Source/WebCore/rendering/RenderBR.cpp
index d80393614..304a27945 100644
--- a/Source/WebCore/rendering/RenderBR.cpp
+++ b/Source/WebCore/rendering/RenderBR.cpp
@@ -40,7 +40,7 @@ RenderBR::~RenderBR()
int RenderBR::lineHeight(bool firstLine) const
{
- if (firstLine && document()->usesFirstLineRules()) {
+ if (firstLine && document()->styleSheetCollection()->usesFirstLineRules()) {
RenderStyle* s = style(firstLine);
if (s != style())
return s->computedLineHeight(view());
diff --git a/Source/WebCore/rendering/RenderBlock.cpp b/Source/WebCore/rendering/RenderBlock.cpp
index abed66220..4c1371e81 100755
--- a/Source/WebCore/rendering/RenderBlock.cpp
+++ b/Source/WebCore/rendering/RenderBlock.cpp
@@ -347,7 +347,7 @@ void RenderBlock::styleDidChange(StyleDifference diff, const RenderStyle* oldSty
m_lineHeight = -1;
// Update pseudos for :before and :after now.
- if (!isAnonymous() && document()->usesBeforeAfterRules() && canHaveGeneratedChildren()) {
+ if (!isAnonymous() && document()->styleSheetCollection()->usesBeforeAfterRules() && canHaveGeneratedChildren()) {
updateBeforeAfterContent(BEFORE);
updateBeforeAfterContent(AFTER);
}
@@ -602,7 +602,7 @@ void RenderBlock::splitBlocks(RenderBlock* fromBlock, RenderBlock* toBlock,
RenderBoxModelObject* curr = toRenderBoxModelObject(parent());
RenderBoxModelObject* currChild = this;
RenderObject* currChildNextSibling = currChild->nextSibling();
- bool documentUsesBeforeAfterRules = document()->usesBeforeAfterRules();
+ bool documentUsesBeforeAfterRules = document()->styleSheetCollection()->usesBeforeAfterRules();
// Note: |this| can be destroyed inside this loop if it is an empty anonymous
// block and we try to call updateBeforeAfterContent inside which removes the
@@ -877,7 +877,7 @@ void RenderBlock::addChildIgnoringAnonymousColumnBlocks(RenderObject* newChild,
// content gets properly destroyed.
bool isFirstChild = (beforeChild == firstChild());
bool isLastChild = (beforeChild == lastChild());
- if (document()->usesBeforeAfterRules())
+ if (document()->styleSheetCollection()->usesBeforeAfterRules())
children()->updateBeforeAfterContent(this, AFTER);
if (isLastChild && beforeChild != lastChild()) {
// We destroyed the last child, so now we need to update our insertion
@@ -6153,7 +6153,7 @@ LayoutUnit RenderBlock::lineHeight(bool firstLine, LineDirectionMode direction,
if (isReplaced() && linePositionMode == PositionOnContainingLine)
return RenderBox::lineHeight(firstLine, direction, linePositionMode);
- if (firstLine && document()->usesFirstLineRules()) {
+ if (firstLine && document()->styleSheetCollection()->usesFirstLineRules()) {
RenderStyle* s = style(firstLine);
if (s != style())
return s->computedLineHeight(view());
@@ -6461,7 +6461,7 @@ void RenderBlock::createFirstLetterRenderer(RenderObject* firstLetterBlock, Rend
void RenderBlock::updateFirstLetter()
{
- if (!document()->usesFirstLetterRules())
+ if (!document()->styleSheetCollection()->usesFirstLetterRules())
return;
// Don't recur
if (style()->styleType() == FIRST_LETTER)
diff --git a/Source/WebCore/rendering/RenderFlowThread.cpp b/Source/WebCore/rendering/RenderFlowThread.cpp
index 0741ea8c8..d5a99b7bb 100644
--- a/Source/WebCore/rendering/RenderFlowThread.cpp
+++ b/Source/WebCore/rendering/RenderFlowThread.cpp
@@ -222,19 +222,18 @@ void RenderFlowThread::updateLogicalWidth()
}
}
-void RenderFlowThread::updateLogicalHeight()
+void RenderFlowThread::computeLogicalHeight(LayoutUnit, LayoutUnit logicalTop, LogicalExtentComputedValues& computedValues) const
{
- LayoutUnit logicalHeight = 0;
+ computedValues.m_position = logicalTop;
+ computedValues.m_extent = 0;
- for (RenderRegionList::iterator iter = m_regionList.begin(); iter != m_regionList.end(); ++iter) {
+ for (RenderRegionList::const_iterator iter = m_regionList.begin(); iter != m_regionList.end(); ++iter) {
RenderRegion* region = *iter;
if (!region->isValid())
continue;
ASSERT(!region->needsLayout());
- logicalHeight += region->logicalHeightOfAllFlowThreadContent();
+ computedValues.m_extent += region->logicalHeightOfAllFlowThreadContent();
}
-
- setLogicalHeight(logicalHeight);
}
void RenderFlowThread::paintFlowThreadPortionInRegion(PaintInfo& paintInfo, RenderRegion* region, LayoutRect flowThreadPortionRect, LayoutRect flowThreadPortionOverflowRect, const LayoutPoint& paintOffset) const
diff --git a/Source/WebCore/rendering/RenderFlowThread.h b/Source/WebCore/rendering/RenderFlowThread.h
index d09183d95..b942eee57 100644
--- a/Source/WebCore/rendering/RenderFlowThread.h
+++ b/Source/WebCore/rendering/RenderFlowThread.h
@@ -74,7 +74,7 @@ public:
const RenderRegionList& renderRegionList() const { return m_regionList; }
virtual void updateLogicalWidth() OVERRIDE;
- virtual void updateLogicalHeight() OVERRIDE;
+ virtual void computeLogicalHeight(LayoutUnit logicalHeight, LayoutUnit logicalTop, LogicalExtentComputedValues&) const OVERRIDE;
void paintFlowThreadPortionInRegion(PaintInfo&, RenderRegion*, LayoutRect flowThreadPortionRect, LayoutRect flowThreadPortionOverflowRect, const LayoutPoint&) const;
bool hitTestFlowThreadPortionInRegion(RenderRegion*, LayoutRect flowThreadPortionRect, LayoutRect flowThreadPortionOverflowRect, const HitTestRequest&, HitTestResult&, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset) const;
diff --git a/Source/WebCore/rendering/RenderInline.cpp b/Source/WebCore/rendering/RenderInline.cpp
index 234cea28b..239aba370 100644
--- a/Source/WebCore/rendering/RenderInline.cpp
+++ b/Source/WebCore/rendering/RenderInline.cpp
@@ -194,7 +194,7 @@ void RenderInline::styleDidChange(StyleDifference diff, const RenderStyle* oldSt
}
// Update pseudos for :before and :after now.
- if (!isAnonymous() && document()->usesBeforeAfterRules()) {
+ if (!isAnonymous() && document()->styleSheetCollection()->usesBeforeAfterRules()) {
children()->updateBeforeAfterContent(this, BEFORE);
children()->updateBeforeAfterContent(this, AFTER);
}
@@ -218,7 +218,7 @@ void RenderInline::updateAlwaysCreateLineBoxes(bool fullLayout)
|| parentStyle->lineHeight() != style()->lineHeight()))
|| (inRenderFlowThread() && enclosingRenderFlowThread()->hasRegionsWithStyling());
- if (!alwaysCreateLineBoxes && checkFonts && document()->usesFirstLineRules()) {
+ if (!alwaysCreateLineBoxes && checkFonts && document()->styleSheetCollection()->usesFirstLineRules()) {
// Have to check the first line style as well.
parentStyle = parent()->style(true);
RenderStyle* childStyle = style(true);
@@ -324,7 +324,7 @@ void RenderInline::addChildIgnoringContinuation(RenderObject* newChild, RenderOb
// has to move into the inline continuation. Call updateBeforeAfterContent to ensure that our :after
// content gets properly destroyed.
bool isLastChild = (beforeChild == lastChild());
- if (document()->usesBeforeAfterRules())
+ if (document()->styleSheetCollection()->usesBeforeAfterRules())
children()->updateBeforeAfterContent(this, AFTER);
if (isLastChild && beforeChild != lastChild())
beforeChild = 0; // We destroyed the last child, so now we need to update our insertion
@@ -399,7 +399,7 @@ void RenderInline::splitInlines(RenderBlock* fromBlock, RenderBlock* toBlock,
// Someone may have indirectly caused a <q> to split. When this happens, the :after content
// has to move into the inline continuation. Call updateBeforeAfterContent to ensure that the inline's :after
// content gets properly destroyed.
- if (document()->usesBeforeAfterRules())
+ if (document()->styleSheetCollection()->usesBeforeAfterRules())
inlineCurr->children()->updateBeforeAfterContent(inlineCurr, AFTER);
// Now we need to take all of the children starting from the first child
@@ -1283,7 +1283,7 @@ InlineFlowBox* RenderInline::createAndAppendInlineFlowBox()
LayoutUnit RenderInline::lineHeight(bool firstLine, LineDirectionMode /*direction*/, LinePositionMode /*linePositionMode*/) const
{
- if (firstLine && document()->usesFirstLineRules()) {
+ if (firstLine && document()->styleSheetCollection()->usesFirstLineRules()) {
RenderStyle* s = style(firstLine);
if (s != style())
return s->computedLineHeight(view());
diff --git a/Source/WebCore/rendering/RenderMeter.cpp b/Source/WebCore/rendering/RenderMeter.cpp
index b539c0a3a..a4b3eca35 100644
--- a/Source/WebCore/rendering/RenderMeter.cpp
+++ b/Source/WebCore/rendering/RenderMeter.cpp
@@ -55,13 +55,22 @@ HTMLMeterElement* RenderMeter::meterElement() const
void RenderMeter::updateLogicalWidth()
{
RenderBox::updateLogicalWidth();
- setWidth(theme()->meterSizeForBounds(this, pixelSnappedIntRect(frameRect())).width());
+
+ IntSize frameSize = theme()->meterSizeForBounds(this, pixelSnappedIntRect(frameRect()));
+ setLogicalWidth(isHorizontalWritingMode() ? frameSize.width() : frameSize.height());
}
-void RenderMeter::updateLogicalHeight()
+void RenderMeter::computeLogicalHeight(LayoutUnit logicalHeight, LayoutUnit logicalTop, LogicalExtentComputedValues& computedValues) const
{
- RenderBox::updateLogicalHeight();
- setHeight(theme()->meterSizeForBounds(this, pixelSnappedIntRect(frameRect())).height());
+ RenderBox::computeLogicalHeight(logicalHeight, logicalTop, computedValues);
+
+ LayoutRect frame = frameRect();
+ if (isHorizontalWritingMode())
+ frame.setHeight(computedValues.m_extent);
+ else
+ frame.setWidth(computedValues.m_extent);
+ IntSize frameSize = theme()->meterSizeForBounds(this, pixelSnappedIntRect(frame));
+ computedValues.m_extent = isHorizontalWritingMode() ? frameSize.height() : frameSize.width();
}
double RenderMeter::valueRatio() const
diff --git a/Source/WebCore/rendering/RenderMeter.h b/Source/WebCore/rendering/RenderMeter.h
index 9051951d1..b7c3ecee7 100644
--- a/Source/WebCore/rendering/RenderMeter.h
+++ b/Source/WebCore/rendering/RenderMeter.h
@@ -40,7 +40,7 @@ public:
private:
virtual void updateLogicalWidth() OVERRIDE;
- virtual void updateLogicalHeight() OVERRIDE;
+ virtual void computeLogicalHeight(LayoutUnit logicalHeight, LayoutUnit logicalTop, LogicalExtentComputedValues&) const OVERRIDE;
virtual const char* renderName() const { return "RenderMeter"; }
virtual bool isMeter() const { return true; }
diff --git a/Source/WebCore/rendering/RenderMultiColumnFlowThread.cpp b/Source/WebCore/rendering/RenderMultiColumnFlowThread.cpp
index e553c5401..562506842 100644
--- a/Source/WebCore/rendering/RenderMultiColumnFlowThread.cpp
+++ b/Source/WebCore/rendering/RenderMultiColumnFlowThread.cpp
@@ -42,4 +42,11 @@ const char* RenderMultiColumnFlowThread::renderName() const
return "RenderMultiColumnFlowThread";
}
+void RenderMultiColumnFlowThread::computeLogicalHeight(LayoutUnit logicalHeight, LayoutUnit logicalTop, LogicalExtentComputedValues& computedValues) const
+{
+ // We simply remain at our intrinsic height.
+ computedValues.m_extent = logicalHeight;
+ computedValues.m_position = logicalTop;
+}
+
}
diff --git a/Source/WebCore/rendering/RenderMultiColumnFlowThread.h b/Source/WebCore/rendering/RenderMultiColumnFlowThread.h
index 363cd0771..595222784 100644
--- a/Source/WebCore/rendering/RenderMultiColumnFlowThread.h
+++ b/Source/WebCore/rendering/RenderMultiColumnFlowThread.h
@@ -39,7 +39,7 @@ public:
private:
virtual const char* renderName() const OVERRIDE;
- virtual void updateLogicalHeight() OVERRIDE { } // We simply remain at our intrinsic height.
+ virtual void computeLogicalHeight(LayoutUnit logicalHeight, LayoutUnit logicalTop, LogicalExtentComputedValues&) const OVERRIDE;
};
} // namespace WebCore
diff --git a/Source/WebCore/rendering/RenderObject.cpp b/Source/WebCore/rendering/RenderObject.cpp
index 214970a35..c523d26b6 100755
--- a/Source/WebCore/rendering/RenderObject.cpp
+++ b/Source/WebCore/rendering/RenderObject.cpp
@@ -2597,7 +2597,7 @@ void RenderObject::layout()
PassRefPtr<RenderStyle> RenderObject::uncachedFirstLineStyle(RenderStyle* style) const
{
- if (!document()->usesFirstLineRules())
+ if (!document()->styleSheetCollection()->usesFirstLineRules())
return 0;
ASSERT(!isText());
@@ -2618,7 +2618,7 @@ PassRefPtr<RenderStyle> RenderObject::uncachedFirstLineStyle(RenderStyle* style)
RenderStyle* RenderObject::firstLineStyleSlowCase() const
{
- ASSERT(document()->usesFirstLineRules());
+ ASSERT(document()->styleSheetCollection()->usesFirstLineRules());
RenderStyle* style = m_style.get();
const RenderObject* renderer = isText() ? parent() : this;
diff --git a/Source/WebCore/rendering/RenderObject.h b/Source/WebCore/rendering/RenderObject.h
index 0b10b69dc..28cda3ad7 100644
--- a/Source/WebCore/rendering/RenderObject.h
+++ b/Source/WebCore/rendering/RenderObject.h
@@ -27,6 +27,7 @@
#define RenderObject_h
#include "CachedImageClient.h"
+#include "DocumentStyleSheetCollection.h"
#include "Element.h"
#include "FractionalLayoutUnit.h"
#include "FloatQuad.h"
@@ -735,7 +736,7 @@ public:
virtual LayoutUnit maxPreferredLogicalWidth() const { return 0; }
RenderStyle* style() const { return m_style.get(); }
- RenderStyle* firstLineStyle() const { return document()->usesFirstLineRules() ? firstLineStyleSlowCase() : style(); }
+ RenderStyle* firstLineStyle() const { return document()->styleSheetCollection()->usesFirstLineRules() ? firstLineStyleSlowCase() : style(); }
RenderStyle* style(bool firstLine) const { return firstLine ? firstLineStyle() : style(); }
// Used only by Element::pseudoStyleCacheIsInvalid to get a first line style based off of a
diff --git a/Source/WebCore/rendering/RenderObjectChildList.cpp b/Source/WebCore/rendering/RenderObjectChildList.cpp
index 247f7dda4..c3b4d4831 100644
--- a/Source/WebCore/rendering/RenderObjectChildList.cpp
+++ b/Source/WebCore/rendering/RenderObjectChildList.cpp
@@ -369,7 +369,7 @@ static RenderObject* ensureBeforeAfterContainer(RenderObject* owner, PseudoId ty
void RenderObjectChildList::updateBeforeAfterContent(RenderObject* owner, PseudoId type, const RenderObject* styledObject)
{
// Double check that the document did in fact use generated content rules. Otherwise we should not have been called.
- ASSERT(owner->document()->usesBeforeAfterRules());
+ ASSERT(owner->document()->styleSheetCollection()->usesBeforeAfterRules());
// In CSS2, before/after pseudo-content cannot nest. Check this first.
if (owner->style()->styleType() == BEFORE || owner->style()->styleType() == AFTER)
diff --git a/Source/WebCore/rendering/RenderTableRow.cpp b/Source/WebCore/rendering/RenderTableRow.cpp
index 1f2bd0689..b102f0842 100644
--- a/Source/WebCore/rendering/RenderTableRow.cpp
+++ b/Source/WebCore/rendering/RenderTableRow.cpp
@@ -55,7 +55,7 @@ void RenderTableRow::willBeRemovedFromTree()
void RenderTableRow::updateBeforeAndAfterContent()
{
- if (!isAnonymous() && document()->usesBeforeAfterRules()) {
+ if (!isAnonymous() && document()->styleSheetCollection()->usesBeforeAfterRules()) {
children()->updateBeforeAfterContent(this, BEFORE);
children()->updateBeforeAfterContent(this, AFTER);
}
diff --git a/Source/WebCore/rendering/RenderWidget.cpp b/Source/WebCore/rendering/RenderWidget.cpp
index 9537edf5d..21d0c3ad6 100644
--- a/Source/WebCore/rendering/RenderWidget.cpp
+++ b/Source/WebCore/rendering/RenderWidget.cpp
@@ -47,53 +47,42 @@ static HashMap<const Widget*, RenderWidget*>& widgetRendererMap()
return *staticWidgetRendererMap;
}
-static unsigned widgetHierarchyUpdateSuspendCount;
+unsigned WidgetHierarchyUpdatesSuspensionScope::s_widgetHierarchyUpdateSuspendCount = 0;
-typedef HashMap<RefPtr<Widget>, FrameView*> WidgetToParentMap;
-
-static WidgetToParentMap& widgetNewParentMap()
+WidgetHierarchyUpdatesSuspensionScope::WidgetToParentMap& WidgetHierarchyUpdatesSuspensionScope::widgetNewParentMap()
{
DEFINE_STATIC_LOCAL(WidgetToParentMap, map, ());
return map;
}
-void RenderWidget::suspendWidgetHierarchyUpdates()
+void WidgetHierarchyUpdatesSuspensionScope::moveWidgets()
{
- widgetHierarchyUpdateSuspendCount++;
-}
-
-void RenderWidget::resumeWidgetHierarchyUpdates()
-{
- ASSERT(widgetHierarchyUpdateSuspendCount);
- if (widgetHierarchyUpdateSuspendCount == 1) {
- WidgetToParentMap map = widgetNewParentMap();
- widgetNewParentMap().clear();
- WidgetToParentMap::iterator end = map.end();
- for (WidgetToParentMap::iterator it = map.begin(); it != end; ++it) {
- Widget* child = it->first.get();
- ScrollView* currentParent = child->parent();
- FrameView* newParent = it->second;
- if (newParent != currentParent) {
- if (currentParent)
- currentParent->removeChild(child);
- if (newParent)
- newParent->addChild(child);
- }
+ WidgetToParentMap map = widgetNewParentMap();
+ widgetNewParentMap().clear();
+ WidgetToParentMap::iterator end = map.end();
+ for (WidgetToParentMap::iterator it = map.begin(); it != end; ++it) {
+ Widget* child = it->first.get();
+ ScrollView* currentParent = child->parent();
+ FrameView* newParent = it->second;
+ if (newParent != currentParent) {
+ if (currentParent)
+ currentParent->removeChild(child);
+ if (newParent)
+ newParent->addChild(child);
}
}
- widgetHierarchyUpdateSuspendCount--;
}
static void moveWidgetToParentSoon(Widget* child, FrameView* parent)
{
- if (!widgetHierarchyUpdateSuspendCount) {
+ if (!WidgetHierarchyUpdatesSuspensionScope::isSuspended()) {
if (parent)
parent->addChild(child);
else
child->removeFromParent();
return;
}
- widgetNewParentMap().set(child, parent);
+ WidgetHierarchyUpdatesSuspensionScope::scheduleWidgetToMove(child, parent);
}
RenderWidget::RenderWidget(Node* node)
diff --git a/Source/WebCore/rendering/RenderWidget.h b/Source/WebCore/rendering/RenderWidget.h
index b7db3b809..d20123a68 100644
--- a/Source/WebCore/rendering/RenderWidget.h
+++ b/Source/WebCore/rendering/RenderWidget.h
@@ -28,6 +28,32 @@
namespace WebCore {
+class WidgetHierarchyUpdatesSuspensionScope {
+public:
+ WidgetHierarchyUpdatesSuspensionScope()
+ {
+ s_widgetHierarchyUpdateSuspendCount++;
+ }
+ ~WidgetHierarchyUpdatesSuspensionScope()
+ {
+ ASSERT(s_widgetHierarchyUpdateSuspendCount);
+ if (s_widgetHierarchyUpdateSuspendCount == 1)
+ moveWidgets();
+ s_widgetHierarchyUpdateSuspendCount--;
+ }
+
+ static bool isSuspended() { return s_widgetHierarchyUpdateSuspendCount; }
+ static void scheduleWidgetToMove(Widget* widget, FrameView* frame) { widgetNewParentMap().set(widget, frame); }
+
+private:
+ typedef HashMap<RefPtr<Widget>, FrameView*> WidgetToParentMap;
+ static WidgetToParentMap& widgetNewParentMap();
+
+ void moveWidgets();
+
+ static unsigned s_widgetHierarchyUpdateSuspendCount;
+};
+
class RenderWidget : public RenderReplaced, private OverlapTestRequestClient {
public:
virtual ~RenderWidget();
@@ -42,9 +68,6 @@ public:
IntRect windowClipRect() const;
void notifyWidget(WidgetNotification);
-
- static void suspendWidgetHierarchyUpdates();
- static void resumeWidgetHierarchyUpdates();
RenderArena* ref() { ++m_refCount; return renderArena(); }
void deref(RenderArena*);
diff --git a/Source/WebCore/rendering/RootInlineBox.cpp b/Source/WebCore/rendering/RootInlineBox.cpp
index 928fe667e..1f4206700 100644
--- a/Source/WebCore/rendering/RootInlineBox.cpp
+++ b/Source/WebCore/rendering/RootInlineBox.cpp
@@ -846,7 +846,7 @@ LayoutUnit RootInlineBox::verticalPositionForBox(InlineBox* box, VerticalPositio
// This method determines the vertical position for inline elements.
bool firstLine = isFirstLineStyle();
- if (firstLine && !renderer->document()->usesFirstLineRules())
+ if (firstLine && !renderer->document()->styleSheetCollection()->usesFirstLineRules())
firstLine = false;
// Check the cache.
diff --git a/Source/WebCore/rendering/WrapShapeInfo.cpp b/Source/WebCore/rendering/WrapShapeInfo.cpp
index 0a16cc51f..0ce46e665 100644
--- a/Source/WebCore/rendering/WrapShapeInfo.cpp
+++ b/Source/WebCore/rendering/WrapShapeInfo.cpp
@@ -71,10 +71,6 @@ WrapShapeInfo* WrapShapeInfo::wrapShapeInfoForRenderBlock(const RenderBlock* blo
bool WrapShapeInfo::isWrapShapeInfoEnabledForRenderBlock(const RenderBlock* block)
{
- // FIXME: Bug 89705: Enable shape inside for vertical writing modes
- if (!block->isHorizontalWritingMode())
- return false;
-
// FIXME: Bug 89707: Enable shape inside for non-rectangular shapes
BasicShape* shape = block->style()->wrapShapeInside();
return (shape && shape->type() == BasicShape::BASIC_SHAPE_RECTANGLE);
@@ -107,7 +103,7 @@ void WrapShapeInfo::computeShapeSize(LayoutUnit logicalWidth, LayoutUnit logical
BasicShape* shape = m_block->style()->wrapShapeInside();
ASSERT(shape);
- m_shape = ExclusionShape::createExclusionShape(shape, logicalWidth, logicalHeight);
+ m_shape = ExclusionShape::createExclusionShape(shape, logicalWidth, logicalHeight, m_block->style()->writingMode());
ASSERT(m_shape);
}
@@ -118,15 +114,7 @@ bool WrapShapeInfo::computeSegmentsForLine(LayoutUnit lineTop)
if (lineState() == LINE_INSIDE_SHAPE) {
ASSERT(m_shape);
-
- Vector<ExclusionInterval> intervals;
- m_shape->getInsideIntervals(lineTop, lineTop, intervals); // FIXME: Bug 95479, workaround for now
- for (size_t i = 0; i < intervals.size(); i++) {
- LineSegment segment;
- segment.logicalLeft = intervals[i].x1;
- segment.logicalRight = intervals[i].x2;
- m_segments.append(segment);
- }
+ m_shape->getIncludedIntervals(lineTop, lineTop, m_segments); // FIXME: Bug 95479, workaround for now
}
return m_segments.size();
}
diff --git a/Source/WebCore/rendering/WrapShapeInfo.h b/Source/WebCore/rendering/WrapShapeInfo.h
index 080b842a8..3a2673b4f 100644
--- a/Source/WebCore/rendering/WrapShapeInfo.h
+++ b/Source/WebCore/rendering/WrapShapeInfo.h
@@ -42,14 +42,6 @@
namespace WebCore {
class RenderBlock;
-class WrapShapeInfo;
-
-struct LineSegment {
- LayoutUnit logicalLeft;
- LayoutUnit logicalRight;
-};
-
-typedef Vector<LineSegment> SegmentList;
class WrapShapeInfo {
WTF_MAKE_FAST_ALLOCATED;
diff --git a/Source/WebCore/rendering/style/RenderStyle.cpp b/Source/WebCore/rendering/style/RenderStyle.cpp
index 0602cfa9b..63d5e0550 100644
--- a/Source/WebCore/rendering/style/RenderStyle.cpp
+++ b/Source/WebCore/rendering/style/RenderStyle.cpp
@@ -40,6 +40,7 @@
#include "RenderTheme.h"
#endif
#include "WebCoreMemoryInstrumentation.h"
+#include <wtf/MemoryInstrumentationVector.h>
#include <wtf/StdLibExtras.h>
#include <algorithm>
@@ -1615,8 +1616,7 @@ void RenderStyle::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
info.addMember(rareInheritedData);
// FIXME: inherited contains StyleImage and Font fields that might need to be instrumented.
info.addMember(inherited);
- if (m_cachedPseudoStyles)
- info.addVectorPtr(m_cachedPseudoStyles.get());
+ info.addMember(m_cachedPseudoStyles);
#if ENABLE(SVG)
info.addMember(m_svgStyle);
#endif
diff --git a/Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp b/Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp
index bbe07bfde..ff5c28d9c 100644
--- a/Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp
+++ b/Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp
@@ -31,6 +31,7 @@
#include "StyleImage.h"
#include "StyleResolver.h"
#include "WebCoreMemoryInstrumentation.h"
+#include <wtf/MemoryInstrumentationVector.h>
namespace WebCore {
@@ -306,7 +307,7 @@ void StyleRareNonInheritedData::reportMemoryUsage(MemoryObjectInfo* memoryObject
{
MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS);
#if ENABLE(DASHBOARD_SUPPORT)
- info.addVector(m_dashboardRegions);
+ info.addMember(m_dashboardRegions);
#endif
info.addMember(m_deprecatedFlexibleBox);
info.addMember(m_flexibleBox);
diff --git a/Source/WebCore/testing/InternalSettings.cpp b/Source/WebCore/testing/InternalSettings.cpp
index bd2376607..bb9eed6b1 100755
--- a/Source/WebCore/testing/InternalSettings.cpp
+++ b/Source/WebCore/testing/InternalSettings.cpp
@@ -100,6 +100,7 @@ InternalSettings::Backup::Backup(Page* page, Settings* settings)
, m_canStartMedia(page->canStartMedia())
, m_originalMockScrollbarsEnabled(settings->mockScrollbarsEnabled())
, m_langAttributeAwareFormControlUIEnabled(RuntimeEnabledFeatures::langAttributeAwareFormControlUIEnabled())
+ , m_imagesEnabled(settings->areImagesEnabled())
{
}
@@ -135,6 +136,7 @@ void InternalSettings::Backup::restoreTo(Page* page, Settings* settings)
page->setCanStartMedia(m_canStartMedia);
settings->setMockScrollbarsEnabled(m_originalMockScrollbarsEnabled);
RuntimeEnabledFeatures::setLangAttributeAwareFormControlUIEnabled(m_langAttributeAwareFormControlUIEnabled);
+ settings->setImagesEnabled(m_imagesEnabled);
}
InternalSettings* InternalSettings::from(Page* page)
@@ -659,4 +661,10 @@ void InternalSettings::setLangAttributeAwareFormControlUIEnabled(bool enabled)
RuntimeEnabledFeatures::setLangAttributeAwareFormControlUIEnabled(enabled);
}
+void InternalSettings::setImagesEnabled(bool enabled, ExceptionCode& ec)
+{
+ InternalSettingsGuardForSettings();
+ settings()->setImagesEnabled(enabled);
+}
+
}
diff --git a/Source/WebCore/testing/InternalSettings.h b/Source/WebCore/testing/InternalSettings.h
index 2c073df6e..be8810de6 100755
--- a/Source/WebCore/testing/InternalSettings.h
+++ b/Source/WebCore/testing/InternalSettings.h
@@ -82,6 +82,7 @@ public:
bool m_canStartMedia;
bool m_originalMockScrollbarsEnabled;
bool m_langAttributeAwareFormControlUIEnabled;
+ bool m_imagesEnabled;
};
typedef RefCountedSupplement<Page, InternalSettings> SuperType;
@@ -147,6 +148,8 @@ public:
void setMemoryInfoEnabled(bool, ExceptionCode&);
void setStorageBlockingPolicy(const String&, ExceptionCode&);
void setLangAttributeAwareFormControlUIEnabled(bool);
+ void setImagesEnabled(bool enabled, ExceptionCode&);
+
private:
explicit InternalSettings(Page*);
virtual void hostDestroyed() OVERRIDE { m_page = 0; }
diff --git a/Source/WebCore/testing/InternalSettings.idl b/Source/WebCore/testing/InternalSettings.idl
index 9673d2f1c..d8a8aaf8b 100755
--- a/Source/WebCore/testing/InternalSettings.idl
+++ b/Source/WebCore/testing/InternalSettings.idl
@@ -82,6 +82,7 @@ module window {
#endif
void setMemoryInfoEnabled(in boolean enabled) raises(DOMException);
void setStorageBlockingPolicy(in DOMString policy) raises(DOMException);
+ void setImagesEnabled(in boolean enabled) raises(DOMException);
};
}
diff --git a/Source/WebCore/testing/Internals.cpp b/Source/WebCore/testing/Internals.cpp
index 3afb3347a..a213f2faf 100644
--- a/Source/WebCore/testing/Internals.cpp
+++ b/Source/WebCore/testing/Internals.cpp
@@ -32,6 +32,7 @@
#include "ClientRectList.h"
#include "ComposedShadowTreeWalker.h"
#include "DOMStringList.h"
+#include "DOMWindow.h"
#include "Document.h"
#include "DocumentMarker.h"
#include "DocumentMarkerController.h"
@@ -46,9 +47,12 @@
#include "HTMLNames.h"
#include "HTMLTextAreaElement.h"
#include "HistoryItem.h"
+#include "InspectorClient.h"
#include "InspectorConsoleAgent.h"
#include "InspectorController.h"
#include "InspectorCounters.h"
+#include "InspectorFrontendChannel.h"
+#include "InspectorFrontendClientLocal.h"
#include "InspectorInstrumentation.h"
#include "InspectorOverlay.h"
#include "InstrumentingAgents.h"
@@ -105,6 +109,52 @@ namespace WebCore {
using namespace HTMLNames;
+#if ENABLE(INSPECTOR)
+class InspectorFrontendClientDummy : public InspectorFrontendClientLocal {
+public:
+ InspectorFrontendClientDummy(InspectorController*, Page*);
+ virtual ~InspectorFrontendClientDummy() { }
+ virtual void attachWindow() OVERRIDE { }
+ virtual void detachWindow() OVERRIDE { }
+
+ virtual String localizedStringsURL() OVERRIDE { return String(); }
+ virtual String hiddenPanels() OVERRIDE { return String(); }
+
+ virtual void bringToFront() OVERRIDE { }
+ virtual void closeWindow() OVERRIDE { }
+
+ virtual void inspectedURLChanged(const String&) OVERRIDE { }
+
+protected:
+ virtual void setAttachedWindowHeight(unsigned) OVERRIDE { }
+};
+
+InspectorFrontendClientDummy::InspectorFrontendClientDummy(InspectorController* controller, Page* page)
+ : InspectorFrontendClientLocal(controller, page, adoptPtr(new InspectorFrontendClientLocal::Settings()))
+{
+}
+
+class InspectorFrontendChannelDummy : public InspectorFrontendChannel {
+public:
+ explicit InspectorFrontendChannelDummy(Page*);
+ virtual ~InspectorFrontendChannelDummy() { }
+ virtual bool sendMessageToFrontend(const String& message) OVERRIDE;
+
+private:
+ Page* m_frontendPage;
+};
+
+InspectorFrontendChannelDummy::InspectorFrontendChannelDummy(Page* page)
+ : m_frontendPage(page)
+{
+}
+
+bool InspectorFrontendChannelDummy::sendMessageToFrontend(const String& message)
+{
+ return InspectorClient::doDispatchMessageOnFrontendPage(m_frontendPage, message);
+}
+#endif // ENABLE(INSPECTOR)
+
static bool markerTypesFrom(const String& markerType, DocumentMarker::MarkerTypes& result)
{
if (markerType.isEmpty() || equalIgnoringCase(markerType, "all"))
@@ -1061,6 +1111,45 @@ Vector<String> Internals::consoleMessageArgumentCounts(Document* document) const
result[i] = String::number(counts[i]);
return result;
}
+
+PassRefPtr<DOMWindow> Internals::openDummyInspectorFrontend(const String& url)
+{
+ Page* page = contextDocument()->frame()->page();
+ ASSERT(page);
+
+ DOMWindow* window = page->mainFrame()->document()->domWindow();
+ ASSERT(window);
+
+ m_frontendWindow = window->open(url, "", "", window, window);
+ ASSERT(m_frontendWindow);
+
+ Page* frontendPage = m_frontendWindow->document()->page();
+ ASSERT(frontendPage);
+
+ OwnPtr<InspectorFrontendClientDummy> frontendClient = adoptPtr(new InspectorFrontendClientDummy(page->inspectorController(), frontendPage));
+
+ frontendPage->inspectorController()->setInspectorFrontendClient(frontendClient.release());
+
+ m_frontendChannel = adoptPtr(new InspectorFrontendChannelDummy(frontendPage));
+
+ page->inspectorController()->connectFrontend(m_frontendChannel.get());
+
+ return m_frontendWindow;
+}
+
+void Internals::closeDummyInspectorFrontend()
+{
+ Page* page = contextDocument()->frame()->page();
+ ASSERT(page);
+ ASSERT(m_frontendWindow);
+
+ page->inspectorController()->disconnectFrontend();
+
+ m_frontendChannel.release();
+
+ m_frontendWindow->close(m_frontendWindow->scriptExecutionContext());
+ m_frontendWindow.release();
+}
#endif // ENABLE(INSPECTOR)
bool Internals::hasGrammarMarker(Document* document, int from, int length, ExceptionCode&)
diff --git a/Source/WebCore/testing/Internals.h b/Source/WebCore/testing/Internals.h
index d2d452ea9..c3c4cb44b 100644
--- a/Source/WebCore/testing/Internals.h
+++ b/Source/WebCore/testing/Internals.h
@@ -38,10 +38,12 @@ namespace WebCore {
class ClientRect;
class ClientRectList;
class DOMStringList;
+class DOMWindow;
class Document;
class DocumentMarker;
class Element;
class Frame;
+class InspectorFrontendChannelDummy;
class InternalSettings;
class Node;
class PagePopupController;
@@ -192,6 +194,8 @@ public:
unsigned numberOfLiveNodes() const;
unsigned numberOfLiveDocuments() const;
Vector<String> consoleMessageArgumentCounts(Document*) const;
+ PassRefPtr<DOMWindow> openDummyInspectorFrontend(const String& url);
+ void closeDummyInspectorFrontend();
#endif
String counterValue(Element*);
@@ -223,6 +227,10 @@ private:
Frame* frame() const;
DocumentMarker* markerAt(Node*, const String& markerType, unsigned index, ExceptionCode&);
+#if ENABLE(INSPECTOR)
+ RefPtr<DOMWindow> m_frontendWindow;
+ OwnPtr<InspectorFrontendChannelDummy> m_frontendChannel;
+#endif
};
} // namespace WebCore
diff --git a/Source/WebCore/testing/Internals.idl b/Source/WebCore/testing/Internals.idl
index 3bd91299f..f7d0bce70 100644
--- a/Source/WebCore/testing/Internals.idl
+++ b/Source/WebCore/testing/Internals.idl
@@ -171,6 +171,8 @@ module window {
[Conditional=INSPECTOR] unsigned long numberOfLiveNodes();
[Conditional=INSPECTOR] unsigned long numberOfLiveDocuments();
[Conditional=INSPECTOR] sequence<String> consoleMessageArgumentCounts(in Document document);
+ [Conditional=INSPECTOR] DOMWindow openDummyInspectorFrontend(in DOMString url);
+ [Conditional=INSPECTOR] void closeDummyInspectorFrontend();
DOMString counterValue(in Element element);
long pageNumber(in Element element, in [Optional] float pageWidth, in [Optional] float pageHeight);