diff options
Diffstat (limited to 'Source/WebCore/page')
94 files changed, 2173 insertions, 3044 deletions
diff --git a/Source/WebCore/page/AbstractView.idl b/Source/WebCore/page/AbstractView.idl index c57aaeaba..6d8232b50 100644 --- a/Source/WebCore/page/AbstractView.idl +++ b/Source/WebCore/page/AbstractView.idl @@ -24,12 +24,15 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -// Introduced in DOM Level 2: -[ - ObjCCustomImplementation, - OmitConstructor -] interface AbstractView { - readonly attribute Document document; - readonly attribute StyleMedia styleMedia; -}; +module views { + // Introduced in DOM Level 2: + interface [ + ObjCCustomImplementation, + OmitConstructor + ] AbstractView { + readonly attribute Document document; + readonly attribute StyleMedia styleMedia; + }; + +} diff --git a/Source/WebCore/page/BarInfo.idl b/Source/WebCore/page/BarInfo.idl index a7dc091f6..11a97c70e 100644 --- a/Source/WebCore/page/BarInfo.idl +++ b/Source/WebCore/page/BarInfo.idl @@ -26,10 +26,13 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -[ - JSGenerateIsReachable=ImplFrame, - OmitConstructor -] interface BarInfo { - readonly attribute boolean visible; -}; +module window { + interface [ + JSGenerateIsReachable=ImplFrame, + OmitConstructor + ] BarInfo { + readonly attribute boolean visible; + }; + +} diff --git a/Source/WebCore/page/Chrome.cpp b/Source/WebCore/page/Chrome.cpp index e95b2a6cb..cca4a0925 100644 --- a/Source/WebCore/page/Chrome.cpp +++ b/Source/WebCore/page/Chrome.cpp @@ -491,7 +491,7 @@ void Chrome::scheduleAnimation() // -------- #if ENABLE(DASHBOARD_SUPPORT) || ENABLE(WIDGET_REGION) -void ChromeClient::annotatedRegionsChanged() +void ChromeClient::dashboardRegionsChanged() { } #endif diff --git a/Source/WebCore/page/ChromeClient.h b/Source/WebCore/page/ChromeClient.h index 6a3631d22..fa5b485e0 100644 --- a/Source/WebCore/page/ChromeClient.h +++ b/Source/WebCore/page/ChromeClient.h @@ -78,7 +78,6 @@ namespace WebCore { #if USE(ACCELERATED_COMPOSITING) class GraphicsLayer; - class GraphicsLayerFactory; #endif #if ENABLE(INPUT_TYPE_COLOR) @@ -208,7 +207,7 @@ namespace WebCore { virtual void reachedApplicationCacheOriginQuota(SecurityOrigin*, int64_t totalSpaceNeeded) = 0; #if ENABLE(DASHBOARD_SUPPORT) || ENABLE(WIDGET_REGION) - virtual void annotatedRegionsChanged(); + virtual void dashboardRegionsChanged(); #endif virtual void populateVisitedLinks(); @@ -247,9 +246,6 @@ namespace WebCore { virtual void elementDidBlur(const Node*) { }; #if USE(ACCELERATED_COMPOSITING) - // Allows ports to customize the type of graphics layers created by this page. - virtual GraphicsLayerFactory* graphicsLayerFactory() const { return 0; } - // Pass 0 as the GraphicsLayer to detatch the root layer. virtual void attachRootGraphicsLayer(Frame*, GraphicsLayer*) = 0; // Sets a flag to specify that the next time content is drawn to the window, @@ -257,7 +253,7 @@ namespace WebCore { virtual void setNeedsOneShotDrawingSynchronization() = 0; // Sets a flag to specify that the view needs to be updated, so we need // to do an eager layout before the drawing. - virtual void scheduleCompositingLayerFlush() = 0; + virtual void scheduleCompositingLayerSync() = 0; // Returns whether or not the client can render the composited layer, // regardless of the settings. virtual bool allowsAcceleratedCompositing() const { return true; } diff --git a/Source/WebCore/page/Console.idl b/Source/WebCore/page/Console.idl index 1f2b96ac6..56221d64c 100644 --- a/Source/WebCore/page/Console.idl +++ b/Source/WebCore/page/Console.idl @@ -26,39 +26,42 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -[ - JSGenerateIsReachable=ImplFrame, - OmitConstructor -] interface Console { +module window { - [CallWith=ScriptArguments|CallStack] void debug(); - [CallWith=ScriptArguments|CallStack] void error(); - [CallWith=ScriptArguments|CallStack] void info(); - [CallWith=ScriptArguments|CallStack] void log(); - [CallWith=ScriptArguments|CallStack] void warn(); - [CallWith=ScriptArguments|CallStack] void dir(); - [CallWith=ScriptArguments|CallStack] void dirxml(); - [V8Custom, CallWith=ScriptArguments|CallStack] void trace(); - [V8Custom, CallWith=ScriptArguments|CallStack, ImplementedAs=assertCondition] void assert(in boolean condition); - [CallWith=ScriptArguments|CallStack] void count(); - [CallWith=ScriptArguments|CallStack] void markTimeline(); + interface [ + JSGenerateIsReachable=ImplFrame, + OmitConstructor + ] Console { + + [CallWith=ScriptArguments|CallStack] void debug(); + [CallWith=ScriptArguments|CallStack] void error(); + [CallWith=ScriptArguments|CallStack] void info(); + [CallWith=ScriptArguments|CallStack] void log(); + [CallWith=ScriptArguments|CallStack] void warn(); + [CallWith=ScriptArguments|CallStack] void dir(); + [CallWith=ScriptArguments|CallStack] void dirxml(); + [V8Custom, CallWith=ScriptArguments|CallStack] void trace(); + [V8Custom, CallWith=ScriptArguments|CallStack, ImplementedAs=assertCondition] void assert(in boolean condition); + [CallWith=ScriptArguments|CallStack] void count(); + [CallWith=ScriptArguments|CallStack] void markTimeline(); #if defined(ENABLE_JAVASCRIPT_DEBUGGER) && ENABLE_JAVASCRIPT_DEBUGGER - // As per spec: http://www.w3.org/TR/WebIDL/#idl-sequence - // "Sequences must not be used as the type of an attribute, constant or exception field." - // FIXME: this will lead to BUG console.profiles !== console.profiles as profile will always returns new array. - readonly attribute ScriptProfile[] profiles; - [Custom] void profile(in DOMString title); - [Custom] void profileEnd(in DOMString title); + // As per spec: http://www.w3.org/TR/WebIDL/#idl-sequence + // "Sequences must not be used as the type of an attribute, constant or exception field." + // FIXME: this will lead to BUG console.profiles !== console.profiles as profile will always returns new array. + readonly attribute ScriptProfile[] profiles; + [Custom] void profile(in DOMString title); + [Custom] void profileEnd(in DOMString title); #endif - void time(in [TreatNullAs=NullString, TreatUndefinedAs=NullString,Optional=DefaultIsUndefined] DOMString title); - [CallWith=ScriptArguments|CallStack] void timeEnd(in [TreatNullAs=NullString, TreatUndefinedAs=NullString] DOMString title); - [CallWith=ScriptArguments|CallStack] void timeStamp(); - [CallWith=ScriptArguments|CallStack] void group(); - [CallWith=ScriptArguments|CallStack] void groupCollapsed(); - void groupEnd(); + void time(in [TreatNullAs=NullString, TreatUndefinedAs=NullString,Optional=DefaultIsUndefined] DOMString title); + [CallWith=ScriptArguments|CallStack] void timeEnd(in [TreatNullAs=NullString, TreatUndefinedAs=NullString] DOMString title); + [CallWith=ScriptArguments|CallStack] void timeStamp(); + [CallWith=ScriptArguments|CallStack] void group(); + [CallWith=ScriptArguments|CallStack] void groupCollapsed(); + void groupEnd(); - [V8CustomGetter] readonly attribute MemoryInfo memory; -}; + readonly attribute [V8CustomGetter] MemoryInfo memory; + }; +} diff --git a/Source/WebCore/page/ContentSecurityPolicy.cpp b/Source/WebCore/page/ContentSecurityPolicy.cpp index 58d395fab..2667a8284 100644 --- a/Source/WebCore/page/ContentSecurityPolicy.cpp +++ b/Source/WebCore/page/ContentSecurityPolicy.cpp @@ -39,8 +39,6 @@ #include "PingLoader.h" #include "SchemeRegistry.h" #include "ScriptCallStack.h" -#include "ScriptCallStackFactory.h" -#include "ScriptState.h" #include "SecurityOrigin.h" #include "TextEncoding.h" #include <wtf/HashSet.h> @@ -738,7 +736,7 @@ public: bool allowInlineEventHandlers(const String& contextURL, const WTF::OrdinalNumber& contextLine, ContentSecurityPolicy::ReportingStatus) const; bool allowInlineScript(const String& contextURL, const WTF::OrdinalNumber& contextLine, ContentSecurityPolicy::ReportingStatus) const; bool allowInlineStyle(const String& contextURL, const WTF::OrdinalNumber& contextLine, ContentSecurityPolicy::ReportingStatus) const; - bool allowEval(ScriptState*, ContentSecurityPolicy::ReportingStatus) const; + bool allowEval(PassRefPtr<ScriptCallStack>, ContentSecurityPolicy::ReportingStatus) const; bool allowScriptNonce(const String& nonce, const String& contextURL, const WTF::OrdinalNumber& contextLine, const KURL&) const; bool allowPluginType(const String& type, const String& typeAttribute, const KURL&, ContentSecurityPolicy::ReportingStatus) const; @@ -771,7 +769,7 @@ private: void setCSPDirective(const String& name, const String& value, OwnPtr<CSPDirectiveType>&); SourceListDirective* operativeDirective(SourceListDirective*) const; - void reportViolation(const String& directiveText, const String& consoleMessage, const KURL& blockedURL = KURL(), const String& contextURL = String(), const WTF::OrdinalNumber& contextLine = WTF::OrdinalNumber::beforeFirst(), ScriptState* = 0) const; + void reportViolation(const String& directiveText, const String& consoleMessage, const KURL& blockedURL = KURL(), const String& contextURL = String(), const WTF::OrdinalNumber& contextLine = WTF::OrdinalNumber::beforeFirst(), PassRefPtr<ScriptCallStack> = 0) const; bool checkEval(SourceListDirective*) const; bool checkInline(SourceListDirective*) const; @@ -781,7 +779,7 @@ private: void setEvalDisabledErrorMessage(const String& errorMessage) { m_evalDisabledErrorMessage = errorMessage; } - bool checkEvalAndReportViolation(SourceListDirective*, const String& consoleMessage, const String& contextURL = String(), const WTF::OrdinalNumber& contextLine = WTF::OrdinalNumber::beforeFirst(), ScriptState* = 0) const; + bool checkEvalAndReportViolation(SourceListDirective*, const String& consoleMessage, const String& contextURL = String(), const WTF::OrdinalNumber& contextLine = WTF::OrdinalNumber::beforeFirst(), PassRefPtr<ScriptCallStack> = 0) const; bool checkInlineAndReportViolation(SourceListDirective*, const String& consoleMessage, const String& contextURL, const WTF::OrdinalNumber& contextLine, bool isScript) const; bool checkNonceAndReportViolation(NonceDirective*, const String& nonce, const String& consoleMessage, const String& contextURL, const WTF::OrdinalNumber& contextLine) const; @@ -845,10 +843,10 @@ PassOwnPtr<CSPDirectiveList> CSPDirectiveList::create(ContentSecurityPolicy* pol return directives.release(); } -void CSPDirectiveList::reportViolation(const String& directiveText, const String& consoleMessage, const KURL& blockedURL, const String& contextURL, const WTF::OrdinalNumber& contextLine, ScriptState* state) const +void CSPDirectiveList::reportViolation(const String& directiveText, const String& consoleMessage, const KURL& blockedURL, const String& contextURL, const WTF::OrdinalNumber& contextLine, PassRefPtr<ScriptCallStack> callStack) const { String message = m_reportOnly ? "[Report Only] " + consoleMessage : consoleMessage; - m_policy->reportViolation(directiveText, message, blockedURL, m_reportURIs, m_header, contextURL, contextLine, state); + m_policy->reportViolation(directiveText, message, blockedURL, m_reportURIs, m_header, contextURL, contextLine, callStack); } bool CSPDirectiveList::checkEval(SourceListDirective* directive) const @@ -885,7 +883,7 @@ SourceListDirective* CSPDirectiveList::operativeDirective(SourceListDirective* d return directive ? directive : m_defaultSrc.get(); } -bool CSPDirectiveList::checkEvalAndReportViolation(SourceListDirective* directive, const String& consoleMessage, const String& contextURL, const WTF::OrdinalNumber& contextLine, ScriptState* state) const +bool CSPDirectiveList::checkEvalAndReportViolation(SourceListDirective* directive, const String& consoleMessage, const String& contextURL, const WTF::OrdinalNumber& contextLine, PassRefPtr<ScriptCallStack> callStack) const { if (checkEval(directive)) return true; @@ -894,7 +892,7 @@ bool CSPDirectiveList::checkEvalAndReportViolation(SourceListDirective* directiv if (directive == m_defaultSrc) suffix = " Note that 'script-src' was not explicitly set, so 'default-src' is used as a fallback."; - reportViolation(directive->text(), consoleMessage + "\"" + directive->text() + "\"." + suffix + "\n", KURL(), contextURL, contextLine, state); + reportViolation(directive->text(), consoleMessage + "\"" + directive->text() + "\"." + suffix + "\n", KURL(), contextURL, contextLine, callStack); if (!m_reportOnly) { m_policy->reportBlockedScriptExecutionToInspector(directive->text()); return false; @@ -1001,11 +999,11 @@ bool CSPDirectiveList::allowInlineStyle(const String& contextURL, const WTF::Ord checkInline(operativeDirective(m_styleSrc.get())); } -bool CSPDirectiveList::allowEval(ScriptState* state, ContentSecurityPolicy::ReportingStatus reportingStatus) const +bool CSPDirectiveList::allowEval(PassRefPtr<ScriptCallStack> callStack, ContentSecurityPolicy::ReportingStatus reportingStatus) const { DEFINE_STATIC_LOCAL(String, consoleMessage, (ASCIILiteral("Refused to evaluate script because it violates the following Content Security Policy directive: "))); return reportingStatus == ContentSecurityPolicy::SendReport ? - checkEvalAndReportViolation(operativeDirective(m_scriptSrc.get()), consoleMessage, String(), WTF::OrdinalNumber::beforeFirst(), state) : + checkEvalAndReportViolation(operativeDirective(m_scriptSrc.get()), consoleMessage, String(), WTF::OrdinalNumber::beforeFirst(), callStack) : checkEval(operativeDirective(m_scriptSrc.get())); } @@ -1306,8 +1304,7 @@ void ContentSecurityPolicy::didReceiveHeader(const String& header, HeaderType ty { if (m_scriptExecutionContext->isDocument()) { Document* document = static_cast<Document*>(m_scriptExecutionContext); - if (document->domWindow()) - FeatureObserver::observe(document->domWindow(), FeatureObserver::PrefixedContentSecurityPolicy); + FeatureObserver::observe(document->domWindow(), FeatureObserver::PrefixedContentSecurityPolicy); } // RFC2616, section 4.2 specifies that headers appearing multiple times can @@ -1348,21 +1345,11 @@ ContentSecurityPolicy::HeaderType ContentSecurityPolicy::deprecatedHeaderType() return m_policies.isEmpty() ? EnforcePolicy : m_policies[0]->headerType(); } -template<bool (CSPDirectiveList::*allowed)(ContentSecurityPolicy::ReportingStatus) const> -bool isAllowedByAll(const CSPDirectiveListVector& policies, ContentSecurityPolicy::ReportingStatus reportingStatus) +template<bool (CSPDirectiveList::*allowed)(PassRefPtr<ScriptCallStack>, ContentSecurityPolicy::ReportingStatus) const> +bool isAllowedByAllWithCallStack(const CSPDirectiveListVector& policies, PassRefPtr<ScriptCallStack> callStack, ContentSecurityPolicy::ReportingStatus reportingStatus) { for (size_t i = 0; i < policies.size(); ++i) { - if (!(policies[i].get()->*allowed)(reportingStatus)) - return false; - } - return true; -} - -template<bool (CSPDirectiveList::*allowed)(ScriptState* state, ContentSecurityPolicy::ReportingStatus) const> -bool isAllowedByAllWithState(const CSPDirectiveListVector& policies, ScriptState* state, ContentSecurityPolicy::ReportingStatus reportingStatus) -{ - for (size_t i = 0; i < policies.size(); ++i) { - if (!(policies[i].get()->*allowed)(state, reportingStatus)) + if (!(policies[i].get()->*allowed)(callStack, reportingStatus)) return false; } return true; @@ -1423,9 +1410,9 @@ bool ContentSecurityPolicy::allowInlineStyle(const String& contextURL, const WTF return isAllowedByAllWithContext<&CSPDirectiveList::allowInlineStyle>(m_policies, contextURL, contextLine, reportingStatus); } -bool ContentSecurityPolicy::allowEval(ScriptState* state, ContentSecurityPolicy::ReportingStatus reportingStatus) const +bool ContentSecurityPolicy::allowEval(PassRefPtr<ScriptCallStack> callStack, ContentSecurityPolicy::ReportingStatus reportingStatus) const { - return isAllowedByAllWithState<&CSPDirectiveList::allowEval>(m_policies, state, reportingStatus); + return isAllowedByAllWithCallStack<&CSPDirectiveList::allowEval>(m_policies, callStack, reportingStatus); } String ContentSecurityPolicy::evalDisabledErrorMessage() const @@ -1527,9 +1514,9 @@ void ContentSecurityPolicy::enforceSandboxFlags(SandboxFlags mask) const m_scriptExecutionContext->enforceSandboxFlags(mask); } -void ContentSecurityPolicy::reportViolation(const String& directiveText, const String& consoleMessage, const KURL& blockedURL, const Vector<KURL>& reportURIs, const String& header, const String& contextURL, const WTF::OrdinalNumber& contextLine, ScriptState* state) const +void ContentSecurityPolicy::reportViolation(const String& directiveText, const String& consoleMessage, const KURL& blockedURL, const Vector<KURL>& reportURIs, const String& header, const String& contextURL, const WTF::OrdinalNumber& contextLine, PassRefPtr<ScriptCallStack> callStack) const { - logToConsole(consoleMessage, contextURL, contextLine, state); + logToConsole(consoleMessage, contextURL, contextLine, callStack); if (reportURIs.isEmpty()) return; @@ -1625,17 +1612,8 @@ void ContentSecurityPolicy::reportInvalidSourceExpression(const String& directiv logToConsole(message); } -void ContentSecurityPolicy::logToConsole(const String& message, const String& contextURL, const WTF::OrdinalNumber& contextLine, ScriptState* state) const +void ContentSecurityPolicy::logToConsole(const String& message, const String& contextURL, const WTF::OrdinalNumber& contextLine, PassRefPtr<ScriptCallStack> callStack) const { - RefPtr<ScriptCallStack> callStack; - if (InspectorInstrumentation::consoleAgentEnabled(m_scriptExecutionContext)) { - if (state) - callStack = createScriptCallStackForConsole(state); - else - callStack = createScriptCallStack(ScriptCallStack::maxCallStackSizeToCapture, true); - if (callStack && !callStack->size()) - callStack = 0; - } m_scriptExecutionContext->addConsoleMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, message, contextURL, contextLine.oneBasedInt(), callStack); } diff --git a/Source/WebCore/page/ContentSecurityPolicy.h b/Source/WebCore/page/ContentSecurityPolicy.h index 0f87dfc3f..39e049e10 100644 --- a/Source/WebCore/page/ContentSecurityPolicy.h +++ b/Source/WebCore/page/ContentSecurityPolicy.h @@ -27,7 +27,6 @@ #define ContentSecurityPolicy_h #include "KURL.h" -#include "ScriptState.h" #include <wtf/PassOwnPtr.h> #include <wtf/RefCounted.h> #include <wtf/Vector.h> @@ -41,6 +40,7 @@ class OrdinalNumber; namespace WebCore { class CSPDirectiveList; +class ScriptCallStack; class DOMStringList; class ScriptExecutionContext; class SecurityOrigin; @@ -80,7 +80,7 @@ public: bool allowInlineEventHandlers(const String& contextURL, const WTF::OrdinalNumber& contextLine, ReportingStatus = SendReport) const; bool allowInlineScript(const String& contextURL, const WTF::OrdinalNumber& contextLine, ReportingStatus = SendReport) const; bool allowInlineStyle(const String& contextURL, const WTF::OrdinalNumber& contextLine, ReportingStatus = SendReport) const; - bool allowEval(ScriptState* = 0, ReportingStatus = SendReport) const; + bool allowEval(PassRefPtr<ScriptCallStack>, ReportingStatus = SendReport) const; bool allowScriptNonce(const String& nonce, const String& contextURL, const WTF::OrdinalNumber& contextLine, const KURL& = KURL()) const; bool allowPluginType(const String& type, const String& typeAttribute, const KURL&, ReportingStatus = SendReport) const; @@ -106,7 +106,7 @@ public: void reportInvalidPluginTypes(const String&) const; void reportInvalidSourceExpression(const String& directiveName, const String& source) const; void reportUnrecognizedDirective(const String&) const; - void reportViolation(const String& directiveText, const String& consoleMessage, const KURL& blockedURL, const Vector<KURL>& reportURIs, const String& header, const String& contextURL = String(), const WTF::OrdinalNumber& contextLine = WTF::OrdinalNumber::beforeFirst(), ScriptState* = 0) const; + void reportViolation(const String& directiveText, const String& consoleMessage, const KURL& blockedURL, const Vector<KURL>& reportURIs, const String& header, const String& contextURL = String(), const WTF::OrdinalNumber& contextLine = WTF::OrdinalNumber::beforeFirst(), PassRefPtr<ScriptCallStack> = 0) const; void reportBlockedScriptExecutionToInspector(const String& directiveText) const; @@ -119,7 +119,7 @@ public: private: explicit ContentSecurityPolicy(ScriptExecutionContext*); - void logToConsole(const String& message, const String& contextURL = String(), const WTF::OrdinalNumber& contextLine = WTF::OrdinalNumber::beforeFirst(), ScriptState* = 0) const; + void logToConsole(const String& message, const String& contextURL = String(), const WTF::OrdinalNumber& contextLine = WTF::OrdinalNumber::beforeFirst(), PassRefPtr<ScriptCallStack> = 0) const; ScriptExecutionContext* m_scriptExecutionContext; bool m_overrideInlineStyleAllowed; diff --git a/Source/WebCore/page/Coordinates.idl b/Source/WebCore/page/Coordinates.idl index cccba2272..f83d87e55 100644 --- a/Source/WebCore/page/Coordinates.idl +++ b/Source/WebCore/page/Coordinates.idl @@ -23,14 +23,17 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -[ - OmitConstructor -] interface Coordinates { - readonly attribute double latitude; - readonly attribute double longitude; - [Custom] readonly attribute double altitude; - readonly attribute double accuracy; - [Custom] readonly attribute double altitudeAccuracy; - [Custom] readonly attribute double heading; - [Custom] readonly attribute double speed; -}; +module core { + + interface [ + OmitConstructor + ] Coordinates { + readonly attribute double latitude; + readonly attribute double longitude; + readonly attribute [Custom] double altitude; + readonly attribute double accuracy; + readonly attribute [Custom] double altitudeAccuracy; + readonly attribute [Custom] double heading; + readonly attribute [Custom] double speed; + }; +} diff --git a/Source/WebCore/page/Crypto.idl b/Source/WebCore/page/Crypto.idl index 589281af5..807b63f81 100644 --- a/Source/WebCore/page/Crypto.idl +++ b/Source/WebCore/page/Crypto.idl @@ -26,9 +26,12 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -[ - OmitConstructor -] interface Crypto { - void getRandomValues(in ArrayBufferView array) raises(DOMException); -}; +module window { + interface [ + OmitConstructor + ] Crypto { + void getRandomValues(in ArrayBufferView array) raises(DOMException); + }; + +} diff --git a/Source/WebCore/page/DOMSecurityPolicy.idl b/Source/WebCore/page/DOMSecurityPolicy.idl index c9ff043d8..46077a00f 100644 --- a/Source/WebCore/page/DOMSecurityPolicy.idl +++ b/Source/WebCore/page/DOMSecurityPolicy.idl @@ -22,28 +22,32 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -[ - Conditional=CSP_NEXT, - OmitConstructor, - InterfaceName=SecurityPolicy -] interface DOMSecurityPolicy { - readonly attribute DOMStringList reportURIs; +module core { - boolean isActive(); + interface [ + Conditional=CSP_NEXT, + OmitConstructor, + InterfaceName=SecurityPolicy + ] DOMSecurityPolicy { + readonly attribute DOMStringList reportURIs; - boolean allowsConnectionTo(in DOMString url); - boolean allowsFontFrom(in DOMString url); - boolean allowsFormAction(in DOMString url); - boolean allowsFrameFrom(in DOMString url); - boolean allowsImageFrom(in DOMString url); - boolean allowsMediaFrom(in DOMString url); - boolean allowsObjectFrom(in DOMString url); - boolean allowsPluginType(in DOMString type); - boolean allowsScriptFrom(in DOMString url); - boolean allowsStyleFrom(in DOMString url); + boolean isActive(); - boolean allowsEval(); - boolean allowsInlineScript(); - boolean allowsInlineStyle(); -}; + boolean allowsConnectionTo(in DOMString url); + boolean allowsFontFrom(in DOMString url); + boolean allowsFormAction(in DOMString url); + boolean allowsFrameFrom(in DOMString url); + boolean allowsImageFrom(in DOMString url); + boolean allowsMediaFrom(in DOMString url); + boolean allowsObjectFrom(in DOMString url); + boolean allowsPluginType(in DOMString type); + boolean allowsScriptFrom(in DOMString url); + boolean allowsStyleFrom(in DOMString url); + + boolean allowsEval(); + boolean allowsInlineScript(); + boolean allowsInlineStyle(); + }; + +} diff --git a/Source/WebCore/page/DOMSelection.cpp b/Source/WebCore/page/DOMSelection.cpp index 062443ac4..c3ad42807 100644 --- a/Source/WebCore/page/DOMSelection.cpp +++ b/Source/WebCore/page/DOMSelection.cpp @@ -53,7 +53,10 @@ static Node* selectionShadowAncestor(Frame* frame) if (!node->isInShadowTree()) return 0; - return frame->document()->ancestorInThisScope(node); + Node* shadowAncestor = node->shadowAncestorNode(); + while (shadowAncestor->isInShadowTree()) + shadowAncestor = shadowAncestor->shadowAncestorNode(); + return shadowAncestor; } DOMSelection::DOMSelection(const TreeScope* treeScope) diff --git a/Source/WebCore/page/DOMSelection.idl b/Source/WebCore/page/DOMSelection.idl index ee6979ae1..1f7d3da3f 100644 --- a/Source/WebCore/page/DOMSelection.idl +++ b/Source/WebCore/page/DOMSelection.idl @@ -27,71 +27,74 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -// This is based off of Mozilla's Selection interface -// https://developer.mozilla.org/En/DOM/Selection -[ - JSGenerateIsReachable=ImplFrame, - InterfaceName=Selection -] interface DOMSelection { - readonly attribute Node anchorNode; - readonly attribute long anchorOffset; - readonly attribute Node focusNode; - readonly attribute long focusOffset; +module window { - readonly attribute boolean isCollapsed; - readonly attribute long rangeCount; + // This is based off of Mozilla's Selection interface + // https://developer.mozilla.org/En/DOM/Selection + interface [ + JSGenerateIsReachable=ImplFrame, + InterfaceName=Selection + ] DOMSelection { + readonly attribute Node anchorNode; + readonly attribute long anchorOffset; + readonly attribute Node focusNode; + readonly attribute long focusOffset; - void collapse(in [Optional=DefaultIsUndefined] Node node, - in [Optional=DefaultIsUndefined] long index) - raises(DOMException); - void collapseToEnd() - raises(DOMException); - void collapseToStart() - raises(DOMException); + readonly attribute boolean isCollapsed; + readonly attribute long rangeCount; - void deleteFromDocument(); - boolean containsNode(in [Optional=DefaultIsUndefined] Node node, - in [Optional=DefaultIsUndefined] boolean allowPartial); - void selectAllChildren(in [Optional=DefaultIsUndefined] Node node) - raises(DOMException); + void collapse(in [Optional=DefaultIsUndefined] Node node, + in [Optional=DefaultIsUndefined] long index) + raises(DOMException); + void collapseToEnd() + raises(DOMException); + void collapseToStart() + raises(DOMException); - void extend(in [Optional=DefaultIsUndefined] Node node, - in [Optional=DefaultIsUndefined] long offset) - raises(DOMException); + void deleteFromDocument(); + boolean containsNode(in [Optional=DefaultIsUndefined] Node node, + in [Optional=DefaultIsUndefined] boolean allowPartial); + void selectAllChildren(in [Optional=DefaultIsUndefined] Node node) + raises(DOMException); - Range getRangeAt(in [Optional=DefaultIsUndefined] long index) - raises(DOMException); - void removeAllRanges(); - void addRange(in [Optional=DefaultIsUndefined] Range range); + void extend(in [Optional=DefaultIsUndefined] Node node, + in [Optional=DefaultIsUndefined] long offset) + raises(DOMException); + + Range getRangeAt(in [Optional=DefaultIsUndefined] long index) + raises(DOMException); + void removeAllRanges(); + void addRange(in [Optional=DefaultIsUndefined] Range range); #if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT - [NotEnumerable] DOMString toString(); + [NotEnumerable] DOMString toString(); #endif - // WebKit extensions - readonly attribute Node baseNode; - readonly attribute long baseOffset; - readonly attribute Node extentNode; - readonly attribute long extentOffset; + // WebKit extensions + readonly attribute Node baseNode; + readonly attribute long baseOffset; + readonly attribute Node extentNode; + readonly attribute long extentOffset; - // WebKit's "type" accessor returns "None", "Range" and "Caret" - // IE's type accessor returns "none", "text" and "control" - readonly attribute DOMString type; + // WebKit's "type" accessor returns "None", "Range" and "Caret" + // IE's type accessor returns "none", "text" and "control" + readonly attribute DOMString type; - void modify(in [Optional=DefaultIsUndefined] DOMString alter, - in [Optional=DefaultIsUndefined] DOMString direction, - in [Optional=DefaultIsUndefined] DOMString granularity); - void setBaseAndExtent(in [Optional=DefaultIsUndefined] Node baseNode, - in [Optional=DefaultIsUndefined] long baseOffset, - in [Optional=DefaultIsUndefined] Node extentNode, - in [Optional=DefaultIsUndefined] long extentOffset) - raises(DOMException); - void setPosition(in [Optional=DefaultIsUndefined] Node node, - in [Optional=DefaultIsUndefined] long offset) - raises(DOMException); + void modify(in [Optional=DefaultIsUndefined] DOMString alter, + in [Optional=DefaultIsUndefined] DOMString direction, + in [Optional=DefaultIsUndefined] DOMString granularity); + void setBaseAndExtent(in [Optional=DefaultIsUndefined] Node baseNode, + in [Optional=DefaultIsUndefined] long baseOffset, + in [Optional=DefaultIsUndefined] Node extentNode, + in [Optional=DefaultIsUndefined] long extentOffset) + raises(DOMException); + void setPosition(in [Optional=DefaultIsUndefined] Node node, + in [Optional=DefaultIsUndefined] long offset) + raises(DOMException); - // IE extentions - // http://msdn.microsoft.com/en-us/library/ms535869(VS.85).aspx - void empty(); -}; + // IE extentions + // http://msdn.microsoft.com/en-us/library/ms535869(VS.85).aspx + void empty(); + }; +} diff --git a/Source/WebCore/page/DOMTimer.cpp b/Source/WebCore/page/DOMTimer.cpp index 7d6831196..dad76f58d 100644 --- a/Source/WebCore/page/DOMTimer.cpp +++ b/Source/WebCore/page/DOMTimer.cpp @@ -30,7 +30,7 @@ #include "InspectorInstrumentation.h" #include "ScheduledAction.h" #include "ScriptExecutionContext.h" -#include <wtf/CurrentTime.h> +#include "UserGestureIndicator.h" #include <wtf/HashSet.h> #include <wtf/StdLibExtras.h> @@ -42,7 +42,6 @@ static const int maxIntervalForUserGestureForwarding = 1000; // One second match static const int maxTimerNestingLevel = 5; static const double oneMillisecond = 0.001; double DOMTimer::s_minDefaultTimerInterval = 0.010; // 10 milliseconds -double DOMTimer::s_defaultTimerAlignmentInterval = 0; static int timerNestingLevel = 0; @@ -69,9 +68,8 @@ DOMTimer::DOMTimer(ScriptExecutionContext* context, PassOwnPtr<ScheduledAction> , m_nestingLevel(timerNestingLevel + 1) , m_action(action) , m_originalInterval(interval) + , m_shouldForwardUserGesture(shouldForwardUserGesture(interval, m_nestingLevel)) { - if (shouldForwardUserGesture(interval, m_nestingLevel)) - m_userGestureToken = UserGestureIndicator::currentToken(); scriptExecutionContext()->addTimeout(m_timeoutId, this); double intervalMilliseconds = intervalClampedToMinimum(interval, context->minimumTimerInterval()); @@ -118,8 +116,10 @@ void DOMTimer::fired() ScriptExecutionContext* context = scriptExecutionContext(); timerNestingLevel = m_nestingLevel; ASSERT(!context->activeDOMObjectsAreSuspended()); + UserGestureIndicator gestureIndicator(m_shouldForwardUserGesture ? DefinitelyProcessingUserGesture : PossiblyProcessingUserGesture); + // Only the first execution of a multi-shot timer should get an affirmative user gesture indicator. - UserGestureIndicator gestureIndicator(m_userGestureToken.release()); + m_shouldForwardUserGesture = false; InspectorInstrumentationCookie cookie = InspectorInstrumentation::willFireTimer(context, m_timeoutId); @@ -194,19 +194,4 @@ double DOMTimer::intervalClampedToMinimum(int timeout, double minimumTimerInterv return intervalMilliseconds; } -double DOMTimer::alignedFireTime(double fireTime) const -{ - double alignmentInterval = scriptExecutionContext()->timerAlignmentInterval(); - if (alignmentInterval) { - double currentTime = monotonicallyIncreasingTime(); - if (fireTime <= currentTime) - return fireTime; - - double alignedTime = ceil(fireTime / alignmentInterval) * alignmentInterval; - return alignedTime; - } - - return fireTime; -} - } // namespace WebCore diff --git a/Source/WebCore/page/DOMTimer.h b/Source/WebCore/page/DOMTimer.h index d23898de0..4fbc9aeb3 100644 --- a/Source/WebCore/page/DOMTimer.h +++ b/Source/WebCore/page/DOMTimer.h @@ -28,7 +28,6 @@ #define DOMTimer_h #include "SuspendableTimer.h" -#include "UserGestureIndicator.h" #include <wtf/OwnPtr.h> #include <wtf/PassOwnPtr.h> @@ -66,22 +65,12 @@ namespace WebCore { static double defaultMinTimerInterval() { return s_minDefaultTimerInterval; } static void setDefaultMinTimerInterval(double value) { s_minDefaultTimerInterval = value; } - // Retuns timer fire time rounded to the next multiple of timer alignment interval. - virtual double alignedFireTime(double) const; - - // The default timer alignment interval (in seconds). If non zero, timer fire times - // will be rounded to a multiple of the alignment interval. - // These are only modified via static methods in Settings. - static double defaultTimerAlignmentInterval() { return s_defaultTimerAlignmentInterval; } - static void setDefaultTimerAlignmentInterval(double value) { s_defaultTimerAlignmentInterval = value; } - int m_timeoutId; int m_nestingLevel; OwnPtr<ScheduledAction> m_action; int m_originalInterval; - RefPtr<UserGestureIndicator::Token> m_userGestureToken; + bool m_shouldForwardUserGesture; static double s_minDefaultTimerInterval; - static double s_defaultTimerAlignmentInterval; }; } // namespace WebCore diff --git a/Source/WebCore/page/DOMWindow.cpp b/Source/WebCore/page/DOMWindow.cpp index faa4ba048..c4651d744 100644 --- a/Source/WebCore/page/DOMWindow.cpp +++ b/Source/WebCore/page/DOMWindow.cpp @@ -248,7 +248,7 @@ bool DOMWindow::dispatchAllPendingBeforeUnloadEvents() Vector<RefPtr<DOMWindow> > windows; DOMWindowSet::iterator end = set.end(); for (DOMWindowSet::iterator it = set.begin(); it != end; ++it) - windows.append(it->key); + windows.append(it->first); size_t size = windows.size(); for (size_t i = 0; i < size; ++i) { @@ -290,7 +290,7 @@ void DOMWindow::dispatchAllPendingUnloadEvents() Vector<RefPtr<DOMWindow> > windows; DOMWindowSet::iterator end = set.end(); for (DOMWindowSet::iterator it = set.begin(); it != end; ++it) - windows.append(it->key); + windows.append(it->first); size_t size = windows.size(); for (size_t i = 0; i < size; ++i) { @@ -834,7 +834,7 @@ void DOMWindow::postMessage(PassRefPtr<SerializedScriptValue> message, const Mes // Capture stack trace only when inspector front-end is loaded as it may be time consuming. RefPtr<ScriptCallStack> stackTrace; - if (InspectorInstrumentation::consoleAgentEnabled(sourceDocument)) + if (InspectorInstrumentation::hasFrontends()) stackTrace = createScriptCallStack(ScriptCallStack::maxCallStackSizeToCapture, true); // Schedule the message. @@ -1533,17 +1533,17 @@ void DOMWindow::clearInterval(int timeoutId) } #if ENABLE(REQUEST_ANIMATION_FRAME) -int DOMWindow::requestAnimationFrame(PassRefPtr<RequestAnimationFrameCallback> callback) +int DOMWindow::webkitRequestAnimationFrame(PassRefPtr<RequestAnimationFrameCallback> callback) { if (Document* d = document()) - return d->requestAnimationFrame(callback); + return d->webkitRequestAnimationFrame(callback); return 0; } -void DOMWindow::cancelAnimationFrame(int id) +void DOMWindow::webkitCancelAnimationFrame(int id) { if (Document* d = document()) - d->cancelAnimationFrame(id); + d->webkitCancelAnimationFrame(id); } #endif diff --git a/Source/WebCore/page/DOMWindow.h b/Source/WebCore/page/DOMWindow.h index 95f6ef1ee..87396185c 100644 --- a/Source/WebCore/page/DOMWindow.h +++ b/Source/WebCore/page/DOMWindow.h @@ -263,8 +263,9 @@ namespace WebCore { // WebKit animation extensions #if ENABLE(REQUEST_ANIMATION_FRAME) - int requestAnimationFrame(PassRefPtr<RequestAnimationFrameCallback>); - void cancelAnimationFrame(int id); + int webkitRequestAnimationFrame(PassRefPtr<RequestAnimationFrameCallback>); + void webkitCancelAnimationFrame(int id); + void webkitCancelRequestAnimationFrame(int id) { webkitCancelAnimationFrame(id); } #endif // Events diff --git a/Source/WebCore/page/DOMWindow.idl b/Source/WebCore/page/DOMWindow.idl index 0e104b692..9649aa931 100644 --- a/Source/WebCore/page/DOMWindow.idl +++ b/Source/WebCore/page/DOMWindow.idl @@ -24,777 +24,782 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -[ - CheckSecurity, - JSCustomDefineOwnProperty, - CustomDeleteProperty, - CustomGetOwnPropertySlot, - CustomEnumerateProperty, - JSCustomMarkFunction, - JSCustomToNativeObject, - CustomPutFunction, - EventTarget, - ExtendsDOMGlobalObject, - JSGenerateToNativeObject, - ReplaceableConstructor, - JSLegacyParent=JSDOMWindowBase, - V8CustomToJSObject, - InterfaceName=Window -] interface DOMWindow { - // DOM Level 0 - attribute [Replaceable] Screen screen; - attribute [Replaceable, DoNotCheckSecurityOnGetter] History history; - attribute [Replaceable] BarInfo locationbar; - attribute [Replaceable] BarInfo menubar; - attribute [Replaceable] BarInfo personalbar; - attribute [Replaceable] BarInfo scrollbars; - attribute [Replaceable] BarInfo statusbar; - attribute [Replaceable] BarInfo toolbar; - attribute [Replaceable] Navigator navigator; - attribute [Replaceable] Navigator clientInformation; - readonly attribute Crypto crypto; +module window { + + interface [ + CheckSecurity, + JSCustomDefineOwnProperty, + CustomDeleteProperty, + CustomGetOwnPropertySlot, + CustomEnumerateProperty, + JSCustomMarkFunction, + JSCustomToNativeObject, + CustomPutFunction, + EventTarget, + ExtendsDOMGlobalObject, + JSGenerateToNativeObject, + ReplaceableConstructor, + JSLegacyParent=JSDOMWindowBase, + V8CustomToJSObject, + InterfaceName=Window + ] DOMWindow { + // DOM Level 0 + attribute [Replaceable] Screen screen; + attribute [Replaceable, DoNotCheckSecurityOnGetter] History history; + attribute [Replaceable] BarInfo locationbar; + attribute [Replaceable] BarInfo menubar; + attribute [Replaceable] BarInfo personalbar; + attribute [Replaceable] BarInfo scrollbars; + attribute [Replaceable] BarInfo statusbar; + attribute [Replaceable] BarInfo toolbar; + attribute [Replaceable] Navigator navigator; + attribute [Replaceable] Navigator clientInformation; + readonly attribute Crypto crypto; #if !defined(LANGUAGE_CPP) || !LANGUAGE_CPP - attribute [DoNotCheckSecurity, CustomSetter, V8Unforgeable] Location location; + attribute [DoNotCheckSecurity, CustomSetter, V8Unforgeable] Location location; #endif - attribute [Replaceable, CustomGetter, V8CustomSetter] Event event; - - DOMSelection getSelection(); - - readonly attribute [CheckSecurityForNode] Element frameElement; - - [DoNotCheckSecurity, CallWith=ScriptExecutionContext] void focus(); - [DoNotCheckSecurity] void blur(); - [DoNotCheckSecurity, CallWith=ScriptExecutionContext] void close(); - - void print(); - void stop(); - - [Custom] DOMWindow open(in DOMString url, - in DOMString name, - in [Optional] DOMString options); - - [Custom] DOMObject showModalDialog(in DOMString url, - in [Optional] DOMObject dialogArgs, - in [Optional] DOMString featureArgs); - - void alert(in [Optional=DefaultIsUndefined] DOMString message); - boolean confirm(in [Optional=DefaultIsUndefined] DOMString message); - [TreatReturnedNullStringAs=Null] DOMString prompt(in [Optional=DefaultIsUndefined] DOMString message, - in [TreatNullAs=NullString, TreatUndefinedAs=NullString,Optional=DefaultIsUndefined] DOMString defaultValue); - - boolean find(in [Optional=DefaultIsUndefined] DOMString string, - in [Optional=DefaultIsUndefined] boolean caseSensitive, - in [Optional=DefaultIsUndefined] boolean backwards, - in [Optional=DefaultIsUndefined] boolean wrap, - in [Optional=DefaultIsUndefined] boolean wholeWord, - in [Optional=DefaultIsUndefined] boolean searchInFrames, - in [Optional=DefaultIsUndefined] boolean showDialog); - - attribute [Replaceable] boolean offscreenBuffering; - - attribute [Replaceable] long outerHeight; - attribute [Replaceable] long outerWidth; - attribute [Replaceable] long innerHeight; - attribute [Replaceable] long innerWidth; - attribute [Replaceable] long screenX; - attribute [Replaceable] long screenY; - attribute [Replaceable] long screenLeft; - attribute [Replaceable] long screenTop; - attribute [Replaceable] long scrollX; - attribute [Replaceable] long scrollY; - readonly attribute long pageXOffset; - readonly attribute long pageYOffset; - - void scrollBy(in [Optional=DefaultIsUndefined] long x, in [Optional=DefaultIsUndefined] long y); - void scrollTo(in [Optional=DefaultIsUndefined] long x, in [Optional=DefaultIsUndefined] long y); - void scroll(in [Optional=DefaultIsUndefined] long x, in [Optional=DefaultIsUndefined] long y); - void moveBy(in [Optional=DefaultIsUndefined] float x, in [Optional=DefaultIsUndefined] float y); // FIXME: this should take longs not floats. - void moveTo(in [Optional=DefaultIsUndefined] float x, in [Optional=DefaultIsUndefined] float y); // FIXME: this should take longs not floats. - void resizeBy(in [Optional=DefaultIsUndefined] float x, in [Optional=DefaultIsUndefined] float y); // FIXME: this should take longs not floats. - void resizeTo(in [Optional=DefaultIsUndefined] float width, in [Optional=DefaultIsUndefined] float height); // FIXME: this should take longs not floats. - - readonly attribute [DoNotCheckSecurity] boolean closed; - - attribute [Replaceable, DoNotCheckSecurityOnGetter] unsigned long length; - - attribute DOMString name; - - attribute DOMString status; - attribute DOMString defaultStatus; + attribute [Replaceable, CustomGetter, V8CustomSetter] Event event; + + DOMSelection getSelection(); + + readonly attribute [CheckSecurityForNode] Element frameElement; + + [DoNotCheckSecurity, CallWith=ScriptExecutionContext] void focus(); + [DoNotCheckSecurity] void blur(); + [DoNotCheckSecurity, CallWith=ScriptExecutionContext] void close(); + + void print(); + void stop(); + + [Custom] DOMWindow open(in DOMString url, + in DOMString name, + in [Optional] DOMString options); + + [Custom] DOMObject showModalDialog(in DOMString url, + in [Optional] DOMObject dialogArgs, + in [Optional] DOMString featureArgs); + + void alert(in [Optional=DefaultIsUndefined] DOMString message); + boolean confirm(in [Optional=DefaultIsUndefined] DOMString message); + [TreatReturnedNullStringAs=Null] DOMString prompt(in [Optional=DefaultIsUndefined] DOMString message, + in [TreatNullAs=NullString, TreatUndefinedAs=NullString,Optional=DefaultIsUndefined] DOMString defaultValue); + + boolean find(in [Optional=DefaultIsUndefined] DOMString string, + in [Optional=DefaultIsUndefined] boolean caseSensitive, + in [Optional=DefaultIsUndefined] boolean backwards, + in [Optional=DefaultIsUndefined] boolean wrap, + in [Optional=DefaultIsUndefined] boolean wholeWord, + in [Optional=DefaultIsUndefined] boolean searchInFrames, + in [Optional=DefaultIsUndefined] boolean showDialog); + + attribute [Replaceable] boolean offscreenBuffering; + + attribute [Replaceable] long outerHeight; + attribute [Replaceable] long outerWidth; + attribute [Replaceable] long innerHeight; + attribute [Replaceable] long innerWidth; + attribute [Replaceable] long screenX; + attribute [Replaceable] long screenY; + attribute [Replaceable] long screenLeft; + attribute [Replaceable] long screenTop; + attribute [Replaceable] long scrollX; + attribute [Replaceable] long scrollY; + readonly attribute long pageXOffset; + readonly attribute long pageYOffset; + + void scrollBy(in [Optional=DefaultIsUndefined] long x, in [Optional=DefaultIsUndefined] long y); + void scrollTo(in [Optional=DefaultIsUndefined] long x, in [Optional=DefaultIsUndefined] long y); + void scroll(in [Optional=DefaultIsUndefined] long x, in [Optional=DefaultIsUndefined] long y); + void moveBy(in [Optional=DefaultIsUndefined] float x, in [Optional=DefaultIsUndefined] float y); // FIXME: this should take longs not floats. + void moveTo(in [Optional=DefaultIsUndefined] float x, in [Optional=DefaultIsUndefined] float y); // FIXME: this should take longs not floats. + void resizeBy(in [Optional=DefaultIsUndefined] float x, in [Optional=DefaultIsUndefined] float y); // FIXME: this should take longs not floats. + void resizeTo(in [Optional=DefaultIsUndefined] float width, in [Optional=DefaultIsUndefined] float height); // FIXME: this should take longs not floats. + + readonly attribute [DoNotCheckSecurity] boolean closed; + + attribute [Replaceable, DoNotCheckSecurityOnGetter] unsigned long length; + + attribute DOMString name; + + attribute DOMString status; + attribute DOMString defaultStatus; #if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT - // This attribute is an alias of defaultStatus and is necessary for legacy uses. - attribute DOMString defaultstatus; + // This attribute is an alias of defaultStatus and is necessary for legacy uses. + attribute DOMString defaultstatus; #endif - // Self referential attributes - attribute [Replaceable, DoNotCheckSecurityOnGetter] DOMWindow self; - readonly attribute [DoNotCheckSecurity, V8Unforgeable] DOMWindow window; - attribute [Replaceable, DoNotCheckSecurityOnGetter] DOMWindow frames; + // Self referential attributes + attribute [Replaceable, DoNotCheckSecurityOnGetter] DOMWindow self; + readonly attribute [DoNotCheckSecurity, V8Unforgeable] DOMWindow window; + attribute [Replaceable, DoNotCheckSecurityOnGetter] DOMWindow frames; - attribute [Replaceable, DoNotCheckSecurityOnGetter, V8CustomSetter] DOMWindow opener; - attribute [Replaceable, DoNotCheckSecurityOnGetter] DOMWindow parent; - readonly attribute [DoNotCheckSecurityOnGetter, V8Unforgeable] DOMWindow top; + attribute [Replaceable, DoNotCheckSecurityOnGetter, V8CustomSetter] DOMWindow opener; + attribute [Replaceable, DoNotCheckSecurityOnGetter] DOMWindow parent; + readonly attribute [DoNotCheckSecurityOnGetter, V8Unforgeable] DOMWindow top; - // DOM Level 2 AbstractView Interface - readonly attribute Document document; + // DOM Level 2 AbstractView Interface + readonly attribute Document document; - // CSSOM View Module - MediaQueryList matchMedia(in DOMString query); + // CSSOM View Module + MediaQueryList matchMedia(in DOMString query); - // styleMedia has been removed from the CSSOM View specification. - readonly attribute StyleMedia styleMedia; + // styleMedia has been removed from the CSSOM View specification. + readonly attribute StyleMedia styleMedia; - // DOM Level 2 Style Interface - CSSStyleDeclaration getComputedStyle(in [Optional=DefaultIsUndefined] Element element, - in [TreatNullAs=NullString, TreatUndefinedAs=NullString,Optional=DefaultIsUndefined] DOMString pseudoElement); + // DOM Level 2 Style Interface + CSSStyleDeclaration getComputedStyle(in [Optional=DefaultIsUndefined] Element element, + in [TreatNullAs=NullString, TreatUndefinedAs=NullString,Optional=DefaultIsUndefined] DOMString pseudoElement); - // WebKit extensions + // WebKit extensions #if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT - CSSRuleList getMatchedCSSRules(in [Optional=DefaultIsUndefined] Element element, - in [TreatNullAs=NullString, TreatUndefinedAs=NullString,Optional=DefaultIsUndefined] DOMString pseudoElement); + CSSRuleList getMatchedCSSRules(in [Optional=DefaultIsUndefined] Element element, + in [TreatNullAs=NullString, TreatUndefinedAs=NullString,Optional=DefaultIsUndefined] DOMString pseudoElement); #endif - attribute [Replaceable] double devicePixelRatio; - - WebKitPoint webkitConvertPointFromPageToNode(in [Optional=DefaultIsUndefined] Node node, - in [Optional=DefaultIsUndefined] WebKitPoint p); - WebKitPoint webkitConvertPointFromNodeToPage(in [Optional=DefaultIsUndefined] Node node, - in [Optional=DefaultIsUndefined] WebKitPoint p); + attribute [Replaceable] double devicePixelRatio; + + WebKitPoint webkitConvertPointFromPageToNode(in [Optional=DefaultIsUndefined] Node node, + in [Optional=DefaultIsUndefined] WebKitPoint p); + WebKitPoint webkitConvertPointFromNodeToPage(in [Optional=DefaultIsUndefined] Node node, + in [Optional=DefaultIsUndefined] WebKitPoint p); - readonly attribute [V8EnabledAtRuntime] DOMApplicationCache applicationCache; + readonly attribute [V8EnabledAtRuntime] DOMApplicationCache applicationCache; - readonly attribute [V8EnabledAtRuntime] Storage sessionStorage - getter raises(DOMException); - readonly attribute [V8EnabledAtRuntime] Storage localStorage - getter raises(DOMException); + readonly attribute [V8EnabledAtRuntime] Storage sessionStorage + getter raises(DOMException); + readonly attribute [V8EnabledAtRuntime] Storage localStorage + getter raises(DOMException); #if defined(ENABLE_ORIENTATION_EVENTS) && ENABLE_ORIENTATION_EVENTS - // This is the interface orientation in degrees. Some examples are: - // 0 is straight up; -90 is when the device is rotated 90 clockwise; - // 90 is when rotated counter clockwise. - readonly attribute long orientation; + // This is the interface orientation in degrees. Some examples are: + // 0 is straight up; -90 is when the device is rotated 90 clockwise; + // 90 is when rotated counter clockwise. + readonly attribute long orientation; #endif - attribute [Replaceable] Console console; + attribute [Replaceable] Console console; - // cross-document messaging + // cross-document messaging #if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT - [DoNotCheckSecurity, Custom] void postMessage(in SerializedScriptValue message, in DOMString targetOrigin) - raises(DOMException); - [DoNotCheckSecurity, Custom] void postMessage(in SerializedScriptValue message, in DOMString targetOrigin, in Array messagePorts) - raises(DOMException); + [DoNotCheckSecurity, Custom] void postMessage(in SerializedScriptValue message, in DOMString targetOrigin) + raises(DOMException); + [DoNotCheckSecurity, Custom] void postMessage(in SerializedScriptValue message, in DOMString targetOrigin, in Array messagePorts) + raises(DOMException); #if defined(ENABLE_LEGACY_VENDOR_PREFIXES) && ENABLE_LEGACY_VENDOR_PREFIXES - [DoNotCheckSecurity, Custom] void webkitPostMessage(in SerializedScriptValue message, in DOMString targetOrigin) - raises(DOMException); - [DoNotCheckSecurity, Custom] void webkitPostMessage(in SerializedScriptValue message, in DOMString targetOrigin, in Array transferList) - raises(DOMException); + [DoNotCheckSecurity, Custom] void webkitPostMessage(in SerializedScriptValue message, in DOMString targetOrigin) + raises(DOMException); + [DoNotCheckSecurity, Custom] void webkitPostMessage(in SerializedScriptValue message, in DOMString targetOrigin, in Array transferList) + raises(DOMException); #endif // defined(ENABLE_LEGACY_VENDOR_PREFIXES) && ENABLE_LEGACY_VENDOR_PREFIXES #else - // There's no good way to expose an array via the ObjC bindings, so for now just allow passing in a single port. - [DoNotCheckSecurity, Custom] void postMessage(in SerializedScriptValue message, in [Optional] MessagePort messagePort, in DOMString targetOrigin) - raises(DOMException); + // There's no good way to expose an array via the ObjC bindings, so for now just allow passing in a single port. + [DoNotCheckSecurity, Custom] void postMessage(in SerializedScriptValue message, in [Optional] MessagePort messagePort, in DOMString targetOrigin) + raises(DOMException); #endif #if defined(ENABLE_WEB_TIMING) && ENABLE_WEB_TIMING - attribute [Replaceable] Performance performance; + attribute [Replaceable] Performance performance; #endif - // Timers - [Custom] long setTimeout(in [Optional=DefaultIsUndefined] TimeoutHandler handler, - in [Optional=DefaultIsUndefined] long timeout); - // [Custom] long setTimeout(in TimeoutHandler handler, in long timeout, arguments...); - // [Custom] long setTimeout(in DOMString code, in long timeout); - void clearTimeout(in [Optional=DefaultIsUndefined] long handle); - [Custom] long setInterval(in TimeoutHandler handler, in long timeout); - // [Custom] long setInterval(in TimeoutHandler handler, in long timeout, arguments...); - // [Custom] long setInterval(in DOMString code, in long timeout); - void clearInterval(in [Optional=DefaultIsUndefined] long handle); + // Timers + [Custom] long setTimeout(in [Optional=DefaultIsUndefined] TimeoutHandler handler, + in [Optional=DefaultIsUndefined] long timeout); + // [Custom] long setTimeout(in TimeoutHandler handler, in long timeout, arguments...); + // [Custom] long setTimeout(in DOMString code, in long timeout); + void clearTimeout(in [Optional=DefaultIsUndefined] long handle); + [Custom] long setInterval(in TimeoutHandler handler, in long timeout); + // [Custom] long setInterval(in TimeoutHandler handler, in long timeout, arguments...); + // [Custom] long setInterval(in DOMString code, in long timeout); + void clearInterval(in [Optional=DefaultIsUndefined] long handle); #if defined(ENABLE_REQUEST_ANIMATION_FRAME) && ENABLE_REQUEST_ANIMATION_FRAME - [V8MeasureAs=UnprefixedRequestAnimationFrame] long requestAnimationFrame(in [Callback] RequestAnimationFrameCallback callback); - void cancelAnimationFrame(in long id); - [ImplementedAs=requestAnimationFrame, V8MeasureAs=PrefixedRequestAnimationFrame] long webkitRequestAnimationFrame(in [Callback] RequestAnimationFrameCallback callback); - [ImplementedAs=cancelAnimationFrame] void webkitCancelAnimationFrame(in long id); - [ImplementedAs=cancelAnimationFrame] void webkitCancelRequestAnimationFrame(in long id); // This is a deprecated alias for webkitCancelAnimationFrame(). Remove this when removing vendor prefix. + // WebKit animation extensions, being standardized in the WebPerf WG + long webkitRequestAnimationFrame(in [Callback] RequestAnimationFrameCallback callback); + void webkitCancelAnimationFrame(in long id); + void webkitCancelRequestAnimationFrame(in long id); // This is a deprecated alias for webkitCancelAnimationFrame(). Remove this when removing vendor prefix. #endif - // Base64 - DOMString atob(in [TreatNullAs=NullString,Optional=DefaultIsUndefined] DOMString string) - raises(DOMException); - DOMString btoa(in [TreatNullAs=NullString,Optional=DefaultIsUndefined] DOMString string) - raises(DOMException); - - // Events - attribute EventListener onabort; - attribute EventListener onbeforeunload; - attribute EventListener onblur; - attribute EventListener oncanplay; - attribute EventListener oncanplaythrough; - attribute EventListener onchange; - attribute EventListener onclick; - attribute EventListener oncontextmenu; - attribute EventListener ondblclick; - attribute EventListener ondrag; - attribute EventListener ondragend; - attribute EventListener ondragenter; - attribute EventListener ondragleave; - attribute EventListener ondragover; - attribute EventListener ondragstart; - attribute EventListener ondrop; - attribute EventListener ondurationchange; - attribute EventListener onemptied; - attribute EventListener onended; - attribute EventListener onerror; - attribute EventListener onfocus; - attribute EventListener onhashchange; - attribute EventListener oninput; - attribute EventListener oninvalid; - attribute EventListener onkeydown; - attribute EventListener onkeypress; - attribute EventListener onkeyup; - attribute EventListener onload; - attribute EventListener onloadeddata; - attribute EventListener onloadedmetadata; - attribute EventListener onloadstart; - attribute EventListener onmessage; - attribute EventListener onmousedown; - attribute EventListener onmousemove; - attribute EventListener onmouseout; - attribute EventListener onmouseover; - attribute EventListener onmouseup; - attribute EventListener onmousewheel; - attribute EventListener onoffline; - attribute EventListener ononline; - attribute EventListener onpagehide; - attribute EventListener onpageshow; - attribute EventListener onpause; - attribute EventListener onplay; - attribute EventListener onplaying; - attribute EventListener onpopstate; - attribute EventListener onprogress; - attribute EventListener onratechange; - attribute EventListener onresize; - attribute EventListener onscroll; - attribute EventListener onseeked; - attribute EventListener onseeking; - attribute EventListener onselect; - attribute EventListener onstalled; - attribute EventListener onstorage; - attribute EventListener onsubmit; - attribute EventListener onsuspend; - attribute EventListener ontimeupdate; - attribute EventListener onunload; - attribute EventListener onvolumechange; - attribute EventListener onwaiting; - - // Not implemented yet. - // attribute EventListener onafterprint; - // attribute EventListener onbeforeprint; - // attribute EventListener onreadystatechange; - // attribute EventListener onredo; - // attribute EventListener onshow; - // attribute EventListener onundo; - - // Webkit extensions - attribute EventListener onreset; - attribute EventListener onsearch; - attribute EventListener onwebkitanimationend; - attribute EventListener onwebkitanimationiteration; - attribute EventListener onwebkitanimationstart; - attribute EventListener onwebkittransitionend; + // Base64 + DOMString atob(in [TreatNullAs=NullString,Optional=DefaultIsUndefined] DOMString string) + raises(DOMException); + DOMString btoa(in [TreatNullAs=NullString,Optional=DefaultIsUndefined] DOMString string) + raises(DOMException); + + // Events + attribute EventListener onabort; + attribute EventListener onbeforeunload; + attribute EventListener onblur; + attribute EventListener oncanplay; + attribute EventListener oncanplaythrough; + attribute EventListener onchange; + attribute EventListener onclick; + attribute EventListener oncontextmenu; + attribute EventListener ondblclick; + attribute EventListener ondrag; + attribute EventListener ondragend; + attribute EventListener ondragenter; + attribute EventListener ondragleave; + attribute EventListener ondragover; + attribute EventListener ondragstart; + attribute EventListener ondrop; + attribute EventListener ondurationchange; + attribute EventListener onemptied; + attribute EventListener onended; + attribute EventListener onerror; + attribute EventListener onfocus; + attribute EventListener onhashchange; + attribute EventListener oninput; + attribute EventListener oninvalid; + attribute EventListener onkeydown; + attribute EventListener onkeypress; + attribute EventListener onkeyup; + attribute EventListener onload; + attribute EventListener onloadeddata; + attribute EventListener onloadedmetadata; + attribute EventListener onloadstart; + attribute EventListener onmessage; + attribute EventListener onmousedown; + attribute EventListener onmousemove; + attribute EventListener onmouseout; + attribute EventListener onmouseover; + attribute EventListener onmouseup; + attribute EventListener onmousewheel; + attribute EventListener onoffline; + attribute EventListener ononline; + attribute EventListener onpagehide; + attribute EventListener onpageshow; + attribute EventListener onpause; + attribute EventListener onplay; + attribute EventListener onplaying; + attribute EventListener onpopstate; + attribute EventListener onprogress; + attribute EventListener onratechange; + attribute EventListener onresize; + attribute EventListener onscroll; + attribute EventListener onseeked; + attribute EventListener onseeking; + attribute EventListener onselect; + attribute EventListener onstalled; + attribute EventListener onstorage; + attribute EventListener onsubmit; + attribute EventListener onsuspend; + attribute EventListener ontimeupdate; + attribute EventListener onunload; + attribute EventListener onvolumechange; + attribute EventListener onwaiting; + + // Not implemented yet. + // attribute EventListener onafterprint; + // attribute EventListener onbeforeprint; + // attribute EventListener onreadystatechange; + // attribute EventListener onredo; + // attribute EventListener onshow; + // attribute EventListener onundo; + + // Webkit extensions + attribute EventListener onreset; + attribute EventListener onsearch; + attribute EventListener onwebkitanimationend; + attribute EventListener onwebkitanimationiteration; + attribute EventListener onwebkitanimationstart; + attribute EventListener onwebkittransitionend; #if defined(ENABLE_ORIENTATION_EVENTS) && ENABLE_ORIENTATION_EVENTS - attribute EventListener onorientationchange; + attribute EventListener onorientationchange; #endif - attribute [Conditional=TOUCH_EVENTS,V8EnabledAtRuntime] EventListener ontouchstart; - attribute [Conditional=TOUCH_EVENTS,V8EnabledAtRuntime] EventListener ontouchmove; - attribute [Conditional=TOUCH_EVENTS,V8EnabledAtRuntime] EventListener ontouchend; - attribute [Conditional=TOUCH_EVENTS,V8EnabledAtRuntime] EventListener ontouchcancel; + attribute [Conditional=TOUCH_EVENTS,V8EnabledAtRuntime] EventListener ontouchstart; + attribute [Conditional=TOUCH_EVENTS,V8EnabledAtRuntime] EventListener ontouchmove; + attribute [Conditional=TOUCH_EVENTS,V8EnabledAtRuntime] EventListener ontouchend; + attribute [Conditional=TOUCH_EVENTS,V8EnabledAtRuntime] EventListener ontouchcancel; - attribute [Conditional=DEVICE_ORIENTATION,V8EnabledAtRuntime] EventListener ondevicemotion; - attribute [Conditional=DEVICE_ORIENTATION,V8EnabledAtRuntime] EventListener ondeviceorientation; + attribute [Conditional=DEVICE_ORIENTATION,V8EnabledAtRuntime] EventListener ondevicemotion; + attribute [Conditional=DEVICE_ORIENTATION,V8EnabledAtRuntime] EventListener ondeviceorientation; - attribute [Conditional=PROXIMITY_EVENTS] EventListener onwebkitdeviceproximity; + attribute [Conditional=PROXIMITY_EVENTS] EventListener onwebkitdeviceproximity; - // EventTarget interface - [Custom] void addEventListener(in DOMString type, - in EventListener listener, - in [Optional] boolean useCapture); - [Custom] void removeEventListener(in DOMString type, + // EventTarget interface + [Custom] void addEventListener(in DOMString type, in EventListener listener, in [Optional] boolean useCapture); - boolean dispatchEvent(in Event evt) - raises(EventException); + [Custom] void removeEventListener(in DOMString type, + in EventListener listener, + in [Optional] boolean useCapture); + boolean dispatchEvent(in Event evt) + raises(EventException); - [V8Custom] void captureEvents(/*in long eventFlags*/); - [V8Custom] void releaseEvents(/*in long eventFlags*/); + [V8Custom] void captureEvents(/*in long eventFlags*/); + [V8Custom] void releaseEvents(/*in long eventFlags*/); #if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT - // Global constructors - attribute StyleSheetConstructor StyleSheet; - attribute CSSStyleSheetConstructor CSSStyleSheet; + // Global constructors + attribute StyleSheetConstructor StyleSheet; + attribute CSSStyleSheetConstructor CSSStyleSheet; - attribute CSSValueConstructor CSSValue; - attribute CSSPrimitiveValueConstructor CSSPrimitiveValue; - attribute CSSValueListConstructor CSSValueList; - attribute WebKitCSSTransformValueConstructor WebKitCSSTransformValue; + attribute CSSValueConstructor CSSValue; + attribute CSSPrimitiveValueConstructor CSSPrimitiveValue; + attribute CSSValueListConstructor CSSValueList; + attribute WebKitCSSTransformValueConstructor WebKitCSSTransformValue; #if defined(ENABLE_CSS_FILTERS) && ENABLE_CSS_FILTERS - attribute WebKitCSSFilterValueConstructor WebKitCSSFilterValue; + attribute WebKitCSSFilterValueConstructor WebKitCSSFilterValue; #endif - attribute CSSRuleConstructor CSSRule; - attribute CSSCharsetRuleConstructor CSSCharsetRule; - attribute CSSFontFaceRuleConstructor CSSFontFaceRule; - attribute CSSImportRuleConstructor CSSImportRule; - attribute CSSMediaRuleConstructor CSSMediaRule; - attribute CSSPageRuleConstructor CSSPageRule; - attribute CSSStyleRuleConstructor CSSStyleRule; - - attribute CSSStyleDeclarationConstructor CSSStyleDeclaration; - attribute MediaListConstructor MediaList; - attribute CounterConstructor Counter; - attribute CSSRuleListConstructor CSSRuleList; - attribute RectConstructor Rect; - attribute RGBColorConstructor RGBColor; - attribute StyleSheetListConstructor StyleSheetList; - - // FIXME: Implement the commented-out global constructors for interfaces listed in DOM Level 3 Core specification. - attribute DOMCoreExceptionConstructor DOMException; - attribute DOMStringListConstructor DOMStringList; + attribute CSSRuleConstructor CSSRule; + attribute CSSCharsetRuleConstructor CSSCharsetRule; + attribute CSSFontFaceRuleConstructor CSSFontFaceRule; + attribute CSSImportRuleConstructor CSSImportRule; + attribute CSSMediaRuleConstructor CSSMediaRule; + attribute CSSPageRuleConstructor CSSPageRule; + attribute CSSStyleRuleConstructor CSSStyleRule; + + attribute CSSStyleDeclarationConstructor CSSStyleDeclaration; + attribute MediaListConstructor MediaList; + attribute CounterConstructor Counter; + attribute CSSRuleListConstructor CSSRuleList; + attribute RectConstructor Rect; + attribute RGBColorConstructor RGBColor; + attribute StyleSheetListConstructor StyleSheetList; + + // FIXME: Implement the commented-out global constructors for interfaces listed in DOM Level 3 Core specification. + attribute DOMCoreExceptionConstructor DOMException; + attribute DOMStringListConstructor DOMStringList; // attribute NameListConstructor NameList; // attribute DOMImplementationListConstructor DOMImplementationList; // attribute DOMImplementationSourceConstructor DOMImplementationSource; - attribute DOMImplementationConstructor DOMImplementation; - attribute DOMSettableTokenListConstructor DOMSettableTokenList; - attribute DOMTokenListConstructor DOMTokenList; - attribute DocumentFragmentConstructor DocumentFragment; - attribute DocumentConstructor Document; - attribute NodeConstructor Node; - attribute NodeListConstructor NodeList; - [Conditional=MICRODATA] attribute PropertyNodeListConstructor PropertyNodeList; - attribute NamedNodeMapConstructor NamedNodeMap; - attribute CharacterDataConstructor CharacterData; - attribute AttrConstructor Attr; - attribute ElementConstructor Element; - attribute TextConstructor Text; - attribute CommentConstructor Comment; + attribute DOMImplementationConstructor DOMImplementation; + attribute DOMSettableTokenListConstructor DOMSettableTokenList; + attribute DOMTokenListConstructor DOMTokenList; + attribute DocumentFragmentConstructor DocumentFragment; + attribute DocumentConstructor Document; + attribute NodeConstructor Node; + attribute NodeListConstructor NodeList; + attribute [Conditional=MICRODATA] PropertyNodeListConstructor PropertyNodeList; + attribute NamedNodeMapConstructor NamedNodeMap; + attribute CharacterDataConstructor CharacterData; + attribute AttrConstructor Attr; + attribute ElementConstructor Element; + attribute TextConstructor Text; + attribute CommentConstructor Comment; // attribute TypeInfoConstructor TypeInfo; // attribute UserDataHandlerConstructor UserDataHandler; // attribute DOMErrorConstructor DOMError; // attribute DOMErrorHandlerConstructor DOMErrorHandler // attribute DOMLocatorConstructor DOMLocator; // attribute DOMConfigurationConstructor DOMConfiguration; - attribute CDATASectionConstructor CDATASection; - attribute DocumentTypeConstructor DocumentType; - attribute NotationConstructor Notation; - attribute EntityConstructor Entity; - attribute EntityReferenceConstructor EntityReference; - attribute ProcessingInstructionConstructor ProcessingInstruction; - [Conditional=SHADOW_DOM, V8EnabledPerContext=shadowDOM] attribute ShadowRootConstructor WebKitShadowRoot; - [Conditional=SHADOW_DOM, V8EnabledPerContext=shadowDOM] attribute HTMLContentElementConstructor HTMLContentElement; - [Conditional=SHADOW_DOM, V8EnabledPerContext=shadowDOM] attribute HTMLShadowElementConstructor HTMLShadowElement; - - attribute DOMSelectionConstructor Selection; - attribute DOMWindowConstructor Window; - - attribute HTMLDocumentConstructor HTMLDocument; - attribute HTMLElementConstructor HTMLElement; - attribute HTMLAnchorElementConstructor HTMLAnchorElement; - attribute HTMLAppletElementConstructor HTMLAppletElement; - attribute HTMLAreaElementConstructor HTMLAreaElement; - attribute HTMLBRElementConstructor HTMLBRElement; - attribute HTMLBaseElementConstructor HTMLBaseElement; - attribute HTMLBaseFontElementConstructor HTMLBaseFontElement; - attribute HTMLBodyElementConstructor HTMLBodyElement; - attribute HTMLButtonElementConstructor HTMLButtonElement; - attribute HTMLCanvasElementConstructor HTMLCanvasElement; - attribute HTMLDListElementConstructor HTMLDListElement; - [Conditional=DATALIST_ELEMENT] attribute HTMLDataListElementConstructor HTMLDataListElement; - [Conditional=DIALOG_ELEMENT, V8EnabledPerContext=dialogElement] attribute HTMLDialogElementConstructor HTMLDialogElement; - attribute HTMLDirectoryElementConstructor HTMLDirectoryElement; - attribute HTMLDivElementConstructor HTMLDivElement; - attribute HTMLEmbedElementConstructor HTMLEmbedElement; - attribute HTMLFieldSetElementConstructor HTMLFieldSetElement; - attribute HTMLFontElementConstructor HTMLFontElement; - attribute HTMLFormElementConstructor HTMLFormElement; - attribute HTMLFrameElementConstructor HTMLFrameElement; - attribute HTMLFrameSetElementConstructor HTMLFrameSetElement; - attribute HTMLHRElementConstructor HTMLHRElement; - attribute HTMLHeadElementConstructor HTMLHeadElement; - attribute HTMLHeadingElementConstructor HTMLHeadingElement; - attribute HTMLHtmlElementConstructor HTMLHtmlElement; - attribute HTMLIFrameElementConstructor HTMLIFrameElement; - attribute HTMLImageElementConstructor HTMLImageElement; - attribute HTMLInputElementConstructor HTMLInputElement; - attribute HTMLKeygenElementConstructor HTMLKeygenElement; - attribute HTMLLIElementConstructor HTMLLIElement; - attribute HTMLLabelElementConstructor HTMLLabelElement; - attribute HTMLLegendElementConstructor HTMLLegendElement; - attribute HTMLLinkElementConstructor HTMLLinkElement; - attribute HTMLMapElementConstructor HTMLMapElement; - attribute HTMLMarqueeElementConstructor HTMLMarqueeElement; - attribute HTMLMenuElementConstructor HTMLMenuElement; - attribute HTMLMetaElementConstructor HTMLMetaElement; + attribute CDATASectionConstructor CDATASection; + attribute DocumentTypeConstructor DocumentType; + attribute NotationConstructor Notation; + attribute EntityConstructor Entity; + attribute EntityReferenceConstructor EntityReference; + attribute ProcessingInstructionConstructor ProcessingInstruction; + attribute [Conditional=SHADOW_DOM, V8EnabledPerContext=shadowDOM] ShadowRootConstructor WebKitShadowRoot; + attribute [Conditional=SHADOW_DOM, V8EnabledPerContext=shadowDOM] HTMLContentElementConstructor HTMLContentElement; + attribute [Conditional=SHADOW_DOM, V8EnabledPerContext=shadowDOM] HTMLShadowElementConstructor HTMLShadowElement; + + attribute DOMSelectionConstructor Selection; + attribute DOMWindowConstructor Window; + + attribute HTMLDocumentConstructor HTMLDocument; + attribute HTMLElementConstructor HTMLElement; + attribute HTMLAnchorElementConstructor HTMLAnchorElement; + attribute HTMLAppletElementConstructor HTMLAppletElement; + attribute HTMLAreaElementConstructor HTMLAreaElement; + attribute HTMLBRElementConstructor HTMLBRElement; + attribute HTMLBaseElementConstructor HTMLBaseElement; + attribute HTMLBaseFontElementConstructor HTMLBaseFontElement; + attribute HTMLBodyElementConstructor HTMLBodyElement; + attribute HTMLButtonElementConstructor HTMLButtonElement; + attribute HTMLCanvasElementConstructor HTMLCanvasElement; + attribute HTMLDListElementConstructor HTMLDListElement; + attribute [Conditional=DATALIST_ELEMENT] HTMLDataListElementConstructor HTMLDataListElement; + attribute [Conditional=DIALOG_ELEMENT, V8EnabledPerContext=dialogElement] HTMLDialogElementConstructor HTMLDialogElement; + attribute HTMLDirectoryElementConstructor HTMLDirectoryElement; + attribute HTMLDivElementConstructor HTMLDivElement; + attribute HTMLEmbedElementConstructor HTMLEmbedElement; + attribute HTMLFieldSetElementConstructor HTMLFieldSetElement; + attribute HTMLFontElementConstructor HTMLFontElement; + attribute HTMLFormElementConstructor HTMLFormElement; + attribute HTMLFrameElementConstructor HTMLFrameElement; + attribute HTMLFrameSetElementConstructor HTMLFrameSetElement; + attribute HTMLHRElementConstructor HTMLHRElement; + attribute HTMLHeadElementConstructor HTMLHeadElement; + attribute HTMLHeadingElementConstructor HTMLHeadingElement; + attribute HTMLHtmlElementConstructor HTMLHtmlElement; + attribute HTMLIFrameElementConstructor HTMLIFrameElement; + attribute HTMLImageElementConstructor HTMLImageElement; + attribute HTMLInputElementConstructor HTMLInputElement; + attribute HTMLKeygenElementConstructor HTMLKeygenElement; + attribute HTMLLIElementConstructor HTMLLIElement; + attribute HTMLLabelElementConstructor HTMLLabelElement; + attribute HTMLLegendElementConstructor HTMLLegendElement; + attribute HTMLLinkElementConstructor HTMLLinkElement; + attribute HTMLMapElementConstructor HTMLMapElement; + attribute HTMLMarqueeElementConstructor HTMLMarqueeElement; + attribute HTMLMenuElementConstructor HTMLMenuElement; + attribute HTMLMetaElementConstructor HTMLMetaElement; #if defined(ENABLE_METER_ELEMENT) && ENABLE_METER_ELEMENT - attribute HTMLMeterElementConstructor HTMLMeterElement; + attribute HTMLMeterElementConstructor HTMLMeterElement; #endif - attribute HTMLModElementConstructor HTMLModElement; - attribute HTMLOListElementConstructor HTMLOListElement; - attribute HTMLObjectElementConstructor HTMLObjectElement; - attribute HTMLOptGroupElementConstructor HTMLOptGroupElement; - attribute HTMLOptionElementConstructor HTMLOptionElement; - attribute HTMLOutputElementConstructor HTMLOutputElement; - attribute HTMLParagraphElementConstructor HTMLParagraphElement; - attribute HTMLParamElementConstructor HTMLParamElement; - attribute HTMLPreElementConstructor HTMLPreElement; + attribute HTMLModElementConstructor HTMLModElement; + attribute HTMLOListElementConstructor HTMLOListElement; + attribute HTMLObjectElementConstructor HTMLObjectElement; + attribute HTMLOptGroupElementConstructor HTMLOptGroupElement; + attribute HTMLOptionElementConstructor HTMLOptionElement; + attribute HTMLOutputElementConstructor HTMLOutputElement; + attribute HTMLParagraphElementConstructor HTMLParagraphElement; + attribute HTMLParamElementConstructor HTMLParamElement; + attribute HTMLPreElementConstructor HTMLPreElement; #if defined(ENABLE_PROGRESS_ELEMENT) && ENABLE_PROGRESS_ELEMENT - attribute HTMLProgressElementConstructor HTMLProgressElement; + attribute HTMLProgressElementConstructor HTMLProgressElement; #endif - attribute HTMLQuoteElementConstructor HTMLQuoteElement; - attribute HTMLScriptElementConstructor HTMLScriptElement; - attribute HTMLSelectElementConstructor HTMLSelectElement; - attribute HTMLSpanElementConstructor HTMLSpanElement; - attribute HTMLStyleElementConstructor HTMLStyleElement; - attribute HTMLTableCaptionElementConstructor HTMLTableCaptionElement; - attribute HTMLTableCellElementConstructor HTMLTableCellElement; - attribute HTMLTableColElementConstructor HTMLTableColElement; - attribute HTMLTableElementConstructor HTMLTableElement; - attribute HTMLTableRowElementConstructor HTMLTableRowElement; - attribute HTMLTableSectionElementConstructor HTMLTableSectionElement; - attribute HTMLTextAreaElementConstructor HTMLTextAreaElement; - attribute HTMLTitleElementConstructor HTMLTitleElement; - attribute HTMLUListElementConstructor HTMLUListElement; - - attribute HTMLCollectionConstructor HTMLCollection; - attribute HTMLAllCollectionConstructor HTMLAllCollection; - [Conditional=MICRODATA] attribute HTMLPropertiesCollectionConstructor HTMLPropertiesCollection; - attribute HTMLUnknownElementConstructor HTMLUnknownElement; - - [JSCustomGetter, CustomConstructor] attribute HTMLImageElementConstructorConstructor Image; // Usable with new operator - [JSCustomGetter] attribute HTMLOptionElementConstructorConstructor Option; // Usable with new operator - - [Conditional=ENCRYPTED_MEDIA, V8EnabledAtRuntime=encryptedMedia] attribute MediaKeyErrorConstructor MediaKeyError; - [Conditional=ENCRYPTED_MEDIA, V8EnabledAtRuntime=encryptedMedia] attribute MediaKeyEventConstructor MediaKeyEvent; - - [Conditional=VIDEO_TRACK, V8EnabledAtRuntime=webkitVideoTrack] attribute HTMLTrackElementConstructor HTMLTrackElement; - [Conditional=VIDEO_TRACK, V8EnabledAtRuntime=webkitVideoTrack] attribute TextTrackConstructor TextTrack; - [Conditional=VIDEO_TRACK, V8EnabledAtRuntime=webkitVideoTrack] attribute TextTrackCueConstructor TextTrackCue; // Usable with the new operator - [Conditional=VIDEO_TRACK, V8EnabledAtRuntime=webkitVideoTrack] attribute TextTrackCueListConstructor TextTrackCueList; - [Conditional=VIDEO_TRACK, V8EnabledAtRuntime=webkitVideoTrack] attribute TextTrackListConstructor TextTrackList; - [Conditional=VIDEO_TRACK, V8EnabledAtRuntime=webkitVideoTrack] attribute TrackEventConstructor TrackEvent; - - [JSCustomGetter, Conditional=VIDEO, V8EnabledAtRuntime] attribute HTMLAudioElementConstructorConstructor Audio; // Usable with the new operator - [Conditional=VIDEO, V8EnabledAtRuntime] attribute HTMLAudioElementConstructor HTMLAudioElement; - [Conditional=VIDEO, V8EnabledAtRuntime] attribute HTMLMediaElementConstructor HTMLMediaElement; - [Conditional=VIDEO, V8EnabledAtRuntime] attribute HTMLVideoElementConstructor HTMLVideoElement; - [Conditional=VIDEO, V8EnabledAtRuntime] attribute MediaErrorConstructor MediaError; - [Conditional=VIDEO, V8EnabledAtRuntime] attribute TimeRangesConstructor TimeRanges; - [Conditional=VIDEO, V8EnabledAtRuntime] attribute HTMLSourceElementConstructor HTMLSourceElement; - [Conditional=VIDEO, V8EnabledAtRuntime] attribute MediaControllerConstructor MediaController; - - [Conditional=WEB_INTENTS_TAG] attribute HTMLIntentElementConstructor HTMLIntentElement; - - attribute CanvasPatternConstructor CanvasPattern; - attribute CanvasGradientConstructor CanvasGradient; - attribute CanvasRenderingContext2DConstructor CanvasRenderingContext2D; - - attribute ImageDataConstructor ImageData; - attribute TextMetricsConstructor TextMetrics; - - [Conditional=WEBGL] attribute WebGLActiveInfoConstructor WebGLActiveInfo; - [Conditional=WEBGL] attribute WebGLBufferConstructor WebGLBuffer; - [Conditional=WEBGL] attribute WebGLFramebufferConstructor WebGLFramebuffer; - [Conditional=WEBGL] attribute WebGLProgramConstructor WebGLProgram; - [Conditional=WEBGL] attribute WebGLRenderbufferConstructor WebGLRenderbuffer; - [Conditional=WEBGL] attribute WebGLRenderingContextConstructor WebGLRenderingContext; - [Conditional=WEBGL] attribute WebGLShaderConstructor WebGLShader; - [Conditional=WEBGL] attribute WebGLShaderPrecisionFormatConstructor WebGLShaderPrecisionFormat; - [Conditional=WEBGL] attribute WebGLTextureConstructor WebGLTexture; - [Conditional=WEBGL] attribute WebGLUniformLocationConstructor WebGLUniformLocation; - - attribute DOMStringMapConstructor DOMStringMap; - - attribute ArrayBufferConstructor ArrayBuffer; // Usable with new operator - attribute Int8ArrayConstructor Int8Array; // Usable with new operator - attribute Uint8ArrayConstructor Uint8Array; // Usable with new operator - attribute Uint8ClampedArrayConstructor Uint8ClampedArray; // Usable with new operator - attribute Int16ArrayConstructor Int16Array; // Usable with new operator - attribute Uint16ArrayConstructor Uint16Array; // Usable with new operator - attribute Int32ArrayConstructor Int32Array; // Usable with new operator - attribute Uint32ArrayConstructor Uint32Array; // Usable with new operator - attribute Float32ArrayConstructor Float32Array; // Usable with new operator - attribute Float64ArrayConstructor Float64Array; // Usable with new operator - attribute DataViewConstructor DataView; // Usable with new operator - - // Event Constructors - attribute EventConstructor Event; - attribute BeforeLoadEventConstructor BeforeLoadEvent; - attribute CompositionEventConstructor CompositionEvent; - attribute CustomEventConstructor CustomEvent; - attribute ErrorEventConstructor ErrorEvent; - attribute HashChangeEventConstructor HashChangeEvent; - attribute KeyboardEventConstructor KeyboardEvent; - attribute MessageEventConstructor MessageEvent; - attribute MouseEventConstructor MouseEvent; - attribute MutationEventConstructor MutationEvent; - attribute OverflowEventConstructor OverflowEvent; - attribute PopStateEventConstructor PopStateEvent; - attribute PageTransitionEventConstructor PageTransitionEvent; - attribute ProgressEventConstructor ProgressEvent; - attribute TextEventConstructor TextEvent; - attribute UIEventConstructor UIEvent; - attribute WebKitAnimationEventConstructor WebKitAnimationEvent; - attribute WebKitTransitionEventConstructor WebKitTransitionEvent; - attribute WheelEventConstructor WheelEvent; - attribute XMLHttpRequestProgressEventConstructor XMLHttpRequestProgressEvent; - [Conditional=DEVICE_ORIENTATION, V8EnabledAtRuntime] attribute DeviceMotionEventConstructor DeviceMotionEvent; - [Conditional=DEVICE_ORIENTATION, V8EnabledAtRuntime] attribute DeviceOrientationEventConstructor DeviceOrientationEvent; - [Conditional=TOUCH_EVENTS] attribute TouchEventConstructor TouchEvent; - attribute StorageEventConstructor StorageEvent; - [Conditional=INPUT_SPEECH] attribute SpeechInputEventConstructor SpeechInputEvent; - [Conditional=WEBGL] attribute WebGLContextEventConstructor WebGLContextEvent; - [Conditional=PROXIMITY_EVENTS] attribute DeviceProximityEventConstructor DeviceProximityEvent; - - attribute EventExceptionConstructor EventException; - - attribute WebKitCSSKeyframeRuleConstructor WebKitCSSKeyframeRule; - attribute WebKitCSSKeyframesRuleConstructor WebKitCSSKeyframesRule; - [Conditional=CSS_REGIONS] attribute WebKitCSSRegionRuleConstructor WebKitCSSRegionRule; - - attribute WebKitCSSMatrixConstructor WebKitCSSMatrix; // Usable with the new operator - - attribute WebKitPointConstructor WebKitPoint; // Usable with new the operator - - attribute ClipboardConstructor Clipboard; - - [Conditional=WORKERS] attribute WorkerConstructor Worker; // Usable with the new operator - [Conditional=SHARED_WORKERS, JSCustomGetter, V8EnabledAtRuntime] attribute SharedWorkerConstructor SharedWorker; // Usable with the new operator - - attribute FileConstructor File; - attribute FileListConstructor FileList; - attribute BlobConstructor Blob; - - attribute NodeFilterConstructor NodeFilter; - attribute RangeConstructor Range; - attribute RangeExceptionConstructor RangeException; - - attribute EventSourceConstructor EventSource; // Usable with new the operator - - // Mozilla has a separate XMLDocument object for XML documents. - // We just use Document for this. - attribute DocumentConstructor XMLDocument; - attribute DOMParserConstructor DOMParser; - attribute XMLSerializerConstructor XMLSerializer; - attribute XMLHttpRequestConstructor XMLHttpRequest; // Usable with the new operator - attribute XMLHttpRequestUploadConstructor XMLHttpRequestUpload; - attribute XMLHttpRequestExceptionConstructor XMLHttpRequestException; - [Conditional=XSLT] attribute XSLTProcessorConstructor XSLTProcessor; // Usable with the new operator + attribute HTMLQuoteElementConstructor HTMLQuoteElement; + attribute HTMLScriptElementConstructor HTMLScriptElement; + attribute HTMLSelectElementConstructor HTMLSelectElement; + attribute HTMLSpanElementConstructor HTMLSpanElement; + attribute HTMLStyleElementConstructor HTMLStyleElement; + attribute HTMLTableCaptionElementConstructor HTMLTableCaptionElement; + attribute HTMLTableCellElementConstructor HTMLTableCellElement; + attribute HTMLTableColElementConstructor HTMLTableColElement; + attribute HTMLTableElementConstructor HTMLTableElement; + attribute HTMLTableRowElementConstructor HTMLTableRowElement; + attribute HTMLTableSectionElementConstructor HTMLTableSectionElement; + attribute HTMLTextAreaElementConstructor HTMLTextAreaElement; + attribute HTMLTitleElementConstructor HTMLTitleElement; + attribute HTMLUListElementConstructor HTMLUListElement; + + attribute HTMLCollectionConstructor HTMLCollection; + attribute HTMLAllCollectionConstructor HTMLAllCollection; + attribute [Conditional=MICRODATA] HTMLPropertiesCollectionConstructor HTMLPropertiesCollection; + attribute HTMLUnknownElementConstructor HTMLUnknownElement; + + attribute [JSCustomGetter, CustomConstructor] HTMLImageElementConstructorConstructor Image; // Usable with new operator + attribute [JSCustomGetter] HTMLOptionElementConstructorConstructor Option; // Usable with new operator + + attribute [Conditional=ENCRYPTED_MEDIA, V8EnabledAtRuntime=encryptedMedia] MediaKeyErrorConstructor MediaKeyError; + attribute [Conditional=ENCRYPTED_MEDIA, V8EnabledAtRuntime=encryptedMedia] MediaKeyEventConstructor MediaKeyEvent; + + attribute [Conditional=VIDEO_TRACK, V8EnabledAtRuntime=webkitVideoTrack] HTMLTrackElementConstructor HTMLTrackElement; + attribute [Conditional=VIDEO_TRACK, V8EnabledAtRuntime=webkitVideoTrack] TextTrackConstructor TextTrack; + attribute [Conditional=VIDEO_TRACK, V8EnabledAtRuntime=webkitVideoTrack] TextTrackCueConstructor TextTrackCue; // Usable with the new operator + attribute [Conditional=VIDEO_TRACK, V8EnabledAtRuntime=webkitVideoTrack] TextTrackCueListConstructor TextTrackCueList; + attribute [Conditional=VIDEO_TRACK, V8EnabledAtRuntime=webkitVideoTrack] TextTrackListConstructor TextTrackList; + attribute [Conditional=VIDEO_TRACK, V8EnabledAtRuntime=webkitVideoTrack] TrackEventConstructor TrackEvent; + + attribute [JSCustomGetter, Conditional=VIDEO, V8EnabledAtRuntime] HTMLAudioElementConstructorConstructor Audio; // Usable with the new operator + attribute [Conditional=VIDEO, V8EnabledAtRuntime] HTMLAudioElementConstructor HTMLAudioElement; + attribute [Conditional=VIDEO, V8EnabledAtRuntime] HTMLMediaElementConstructor HTMLMediaElement; + attribute [Conditional=VIDEO, V8EnabledAtRuntime] HTMLVideoElementConstructor HTMLVideoElement; + attribute [Conditional=VIDEO, V8EnabledAtRuntime] MediaErrorConstructor MediaError; + attribute [Conditional=VIDEO, V8EnabledAtRuntime] TimeRangesConstructor TimeRanges; + attribute [Conditional=VIDEO, V8EnabledAtRuntime] HTMLSourceElementConstructor HTMLSourceElement; + attribute [Conditional=VIDEO, V8EnabledAtRuntime] MediaControllerConstructor MediaController; + + attribute [Conditional=WEB_INTENTS_TAG] HTMLIntentElementConstructor HTMLIntentElement; + + attribute CanvasPatternConstructor CanvasPattern; + attribute CanvasGradientConstructor CanvasGradient; + attribute CanvasRenderingContext2DConstructor CanvasRenderingContext2D; + + attribute ImageDataConstructor ImageData; + attribute TextMetricsConstructor TextMetrics; + + attribute [Conditional=WEBGL] WebGLActiveInfoConstructor WebGLActiveInfo; + attribute [Conditional=WEBGL] WebGLBufferConstructor WebGLBuffer; + attribute [Conditional=WEBGL] WebGLFramebufferConstructor WebGLFramebuffer; + attribute [Conditional=WEBGL] WebGLProgramConstructor WebGLProgram; + attribute [Conditional=WEBGL] WebGLRenderbufferConstructor WebGLRenderbuffer; + attribute [Conditional=WEBGL] WebGLRenderingContextConstructor WebGLRenderingContext; + attribute [Conditional=WEBGL] WebGLShaderConstructor WebGLShader; + attribute [Conditional=WEBGL] WebGLShaderPrecisionFormatConstructor WebGLShaderPrecisionFormat; + attribute [Conditional=WEBGL] WebGLTextureConstructor WebGLTexture; + attribute [Conditional=WEBGL] WebGLUniformLocationConstructor WebGLUniformLocation; + + attribute DOMStringMapConstructor DOMStringMap; + + attribute ArrayBufferConstructor ArrayBuffer; // Usable with new operator + attribute Int8ArrayConstructor Int8Array; // Usable with new operator + attribute Uint8ArrayConstructor Uint8Array; // Usable with new operator + attribute Uint8ClampedArrayConstructor Uint8ClampedArray; // Usable with new operator + attribute Int16ArrayConstructor Int16Array; // Usable with new operator + attribute Uint16ArrayConstructor Uint16Array; // Usable with new operator + attribute Int32ArrayConstructor Int32Array; // Usable with new operator + attribute Uint32ArrayConstructor Uint32Array; // Usable with new operator + attribute Float32ArrayConstructor Float32Array; // Usable with new operator + attribute Float64ArrayConstructor Float64Array; // Usable with new operator + attribute DataViewConstructor DataView; // Usable with new operator + + // Event Constructors + attribute EventConstructor Event; + attribute BeforeLoadEventConstructor BeforeLoadEvent; + attribute CompositionEventConstructor CompositionEvent; + attribute CustomEventConstructor CustomEvent; + attribute ErrorEventConstructor ErrorEvent; + attribute HashChangeEventConstructor HashChangeEvent; + attribute KeyboardEventConstructor KeyboardEvent; + attribute MessageEventConstructor MessageEvent; + attribute MouseEventConstructor MouseEvent; + attribute MutationEventConstructor MutationEvent; + attribute OverflowEventConstructor OverflowEvent; + attribute PopStateEventConstructor PopStateEvent; + attribute PageTransitionEventConstructor PageTransitionEvent; + attribute ProgressEventConstructor ProgressEvent; + attribute TextEventConstructor TextEvent; + attribute UIEventConstructor UIEvent; + attribute WebKitAnimationEventConstructor WebKitAnimationEvent; + attribute WebKitTransitionEventConstructor WebKitTransitionEvent; + attribute WheelEventConstructor WheelEvent; + attribute XMLHttpRequestProgressEventConstructor XMLHttpRequestProgressEvent; + attribute [Conditional=DEVICE_ORIENTATION, V8EnabledAtRuntime] DeviceMotionEventConstructor DeviceMotionEvent; + attribute [Conditional=DEVICE_ORIENTATION, V8EnabledAtRuntime] DeviceOrientationEventConstructor DeviceOrientationEvent; + attribute [Conditional=TOUCH_EVENTS] TouchEventConstructor TouchEvent; + attribute StorageEventConstructor StorageEvent; + attribute [Conditional=INPUT_SPEECH] SpeechInputEventConstructor SpeechInputEvent; + attribute [Conditional=WEBGL] WebGLContextEventConstructor WebGLContextEvent; + attribute [Conditional=PROXIMITY_EVENTS] DeviceProximityEventConstructor DeviceProximityEvent; + + attribute EventExceptionConstructor EventException; + + attribute WebKitCSSKeyframeRuleConstructor WebKitCSSKeyframeRule; + attribute WebKitCSSKeyframesRuleConstructor WebKitCSSKeyframesRule; + attribute [Conditional=CSS_REGIONS] WebKitCSSRegionRuleConstructor WebKitCSSRegionRule; + + attribute WebKitCSSMatrixConstructor WebKitCSSMatrix; // Usable with the new operator + + attribute WebKitPointConstructor WebKitPoint; // Usable with new the operator + + attribute ClipboardConstructor Clipboard; + + attribute [Conditional=WORKERS] WorkerConstructor Worker; // Usable with the new operator + attribute [Conditional=SHARED_WORKERS, JSCustomGetter, V8EnabledAtRuntime] SharedWorkerConstructor SharedWorker; // Usable with the new operator + + attribute FileConstructor File; + attribute FileListConstructor FileList; + attribute BlobConstructor Blob; + + attribute NodeFilterConstructor NodeFilter; + attribute RangeConstructor Range; + attribute RangeExceptionConstructor RangeException; + + attribute EventSourceConstructor EventSource; // Usable with new the operator + + // Mozilla has a separate XMLDocument object for XML documents. + // We just use Document for this. + attribute DocumentConstructor XMLDocument; + attribute DOMParserConstructor DOMParser; + attribute XMLSerializerConstructor XMLSerializer; + attribute XMLHttpRequestConstructor XMLHttpRequest; // Usable with the new operator + attribute XMLHttpRequestUploadConstructor XMLHttpRequestUpload; + attribute XMLHttpRequestExceptionConstructor XMLHttpRequestException; + attribute [Conditional=XSLT] XSLTProcessorConstructor XSLTProcessor; // Usable with the new operator #if defined(ENABLE_CHANNEL_MESSAGING) && ENABLE_CHANNEL_MESSAGING - attribute MessagePortConstructor MessagePort; - attribute MessageChannelConstructor MessageChannel; // Usable with the new operator + attribute MessagePortConstructor MessagePort; + attribute MessageChannelConstructor MessageChannel; // Usable with the new operator #endif - attribute DOMPluginConstructor Plugin; - attribute DOMPluginArrayConstructor PluginArray; + attribute DOMPluginConstructor Plugin; + attribute DOMPluginArrayConstructor PluginArray; - attribute DOMMimeTypeConstructor MimeType; - attribute DOMMimeTypeArrayConstructor MimeTypeArray; + attribute DOMMimeTypeConstructor MimeType; + attribute DOMMimeTypeArrayConstructor MimeTypeArray; - attribute ClientRectConstructor ClientRect; - attribute ClientRectListConstructor ClientRectList; + attribute ClientRectConstructor ClientRect; + attribute ClientRectListConstructor ClientRectList; - attribute StorageConstructor Storage; + attribute StorageConstructor Storage; #if defined(ENABLE_ANIMATION_API) && ENABLE_ANIMATION_API - attribute WebKitAnimationConstructor WebKitAnimation; - attribute WebKitAnimationListConstructor WebKitAnimationList; + attribute WebKitAnimationConstructor WebKitAnimation; + attribute WebKitAnimationListConstructor WebKitAnimationList; #endif - attribute XPathEvaluatorConstructor XPathEvaluator; - attribute XPathResultConstructor XPathResult; - attribute XPathExceptionConstructor XPathException; + attribute XPathEvaluatorConstructor XPathEvaluator; + attribute XPathResultConstructor XPathResult; + attribute XPathExceptionConstructor XPathException; - [Conditional=SVG] attribute SVGZoomEventConstructor SVGZoomEvent; + attribute [Conditional=SVG] SVGZoomEventConstructor SVGZoomEvent; #if defined(ENABLE_SVG) && ENABLE_SVG - // Expose all implemented SVG 1.1 interfaces, excluding the SVG MI interfaces: - // SVGAnimatedPathData, SVGAnimatedPoints, SVGExternalResourcesRequired, - // SVGFilterPrimitiveStandardAttributes, SVGFitToViewBox, SVGLangSpace, SVGLocatable - // SVGStylable, SVGTests, SVGTransformable, SVGURIReference, SVGZoomAndPan - attribute SVGAElementConstructor SVGAElement; - attribute SVGAngleConstructor SVGAngle; - attribute SVGAnimatedAngleConstructor SVGAnimatedAngle; - attribute SVGAnimatedBooleanConstructor SVGAnimatedBoolean; - attribute SVGAnimatedEnumerationConstructor SVGAnimatedEnumeration; - attribute SVGAnimatedIntegerConstructor SVGAnimatedInteger; - attribute SVGAnimatedLengthConstructor SVGAnimatedLength; - attribute SVGAnimatedLengthListConstructor SVGAnimatedLengthList; - attribute SVGAnimatedNumberConstructor SVGAnimatedNumber; - attribute SVGAnimatedNumberListConstructor SVGAnimatedNumberList; - attribute SVGAnimatedPreserveAspectRatioConstructor SVGAnimatedPreserveAspectRatio; - attribute SVGAnimatedRectConstructor SVGAnimatedRect; - attribute SVGAnimatedStringConstructor SVGAnimatedString; - attribute SVGAnimatedTransformListConstructor SVGAnimatedTransformList; - attribute SVGCircleElementConstructor SVGCircleElement; - attribute SVGClipPathElementConstructor SVGClipPathElement; - attribute SVGColorConstructor SVGColor; - attribute SVGCursorElementConstructor SVGCursorElement; + // Expose all implemented SVG 1.1 interfaces, excluding the SVG MI interfaces: + // SVGAnimatedPathData, SVGAnimatedPoints, SVGExternalResourcesRequired, + // SVGFilterPrimitiveStandardAttributes, SVGFitToViewBox, SVGLangSpace, SVGLocatable + // SVGStylable, SVGTests, SVGTransformable, SVGURIReference, SVGZoomAndPan + attribute SVGAElementConstructor SVGAElement; + attribute SVGAngleConstructor SVGAngle; + attribute SVGAnimatedAngleConstructor SVGAnimatedAngle; + attribute SVGAnimatedBooleanConstructor SVGAnimatedBoolean; + attribute SVGAnimatedEnumerationConstructor SVGAnimatedEnumeration; + attribute SVGAnimatedIntegerConstructor SVGAnimatedInteger; + attribute SVGAnimatedLengthConstructor SVGAnimatedLength; + attribute SVGAnimatedLengthListConstructor SVGAnimatedLengthList; + attribute SVGAnimatedNumberConstructor SVGAnimatedNumber; + attribute SVGAnimatedNumberListConstructor SVGAnimatedNumberList; + attribute SVGAnimatedPreserveAspectRatioConstructor SVGAnimatedPreserveAspectRatio; + attribute SVGAnimatedRectConstructor SVGAnimatedRect; + attribute SVGAnimatedStringConstructor SVGAnimatedString; + attribute SVGAnimatedTransformListConstructor SVGAnimatedTransformList; + attribute SVGCircleElementConstructor SVGCircleElement; + attribute SVGClipPathElementConstructor SVGClipPathElement; + attribute SVGColorConstructor SVGColor; + attribute SVGCursorElementConstructor SVGCursorElement; // attribute SVGCSSRuleConstructor SVGCSSRule; - attribute SVGDefsElementConstructor SVGDefsElement; - attribute SVGDescElementConstructor SVGDescElement; - attribute SVGDocumentConstructor SVGDocument; - attribute SVGElementConstructor SVGElement; - attribute SVGElementInstanceConstructor SVGElementInstance; - attribute SVGElementInstanceListConstructor SVGElementInstanceList; - attribute SVGEllipseElementConstructor SVGEllipseElement; - attribute SVGForeignObjectElementConstructor SVGForeignObjectElement; - attribute SVGExceptionConstructor SVGException; - attribute SVGGElementConstructor SVGGElement; - attribute SVGGradientElementConstructor SVGGradientElement; - attribute SVGImageElementConstructor SVGImageElement; - attribute SVGLengthConstructor SVGLength; - attribute SVGLengthListConstructor SVGLengthList; - attribute SVGLinearGradientElementConstructor SVGLinearGradientElement; - attribute SVGLineElementConstructor SVGLineElement; - attribute SVGMarkerElementConstructor SVGMarkerElement; - attribute SVGMaskElementConstructor SVGMaskElement; - attribute SVGMatrixConstructor SVGMatrix; - attribute SVGMetadataElementConstructor SVGMetadataElement; - attribute SVGNumberConstructor SVGNumber; - attribute SVGNumberListConstructor SVGNumberList; - attribute SVGPaintConstructor SVGPaint; - attribute SVGPathElementConstructor SVGPathElement; - attribute SVGPathSegConstructor SVGPathSeg; - attribute SVGPathSegArcAbsConstructor SVGPathSegArcAbs; - attribute SVGPathSegArcRelConstructor SVGPathSegArcRel; - attribute SVGPathSegClosePathConstructor SVGPathSegClosePath; - attribute SVGPathSegCurvetoCubicAbsConstructor SVGPathSegCurvetoCubicAbs; - attribute SVGPathSegCurvetoCubicRelConstructor SVGPathSegCurvetoCubicRel; - attribute SVGPathSegCurvetoCubicSmoothAbsConstructor SVGPathSegCurvetoCubicSmoothAbs; - attribute SVGPathSegCurvetoCubicSmoothRelConstructor SVGPathSegCurvetoCubicSmoothRel; - attribute SVGPathSegCurvetoQuadraticAbsConstructor SVGPathSegCurvetoQuadraticAbs; - attribute SVGPathSegCurvetoQuadraticRelConstructor SVGPathSegCurvetoQuadraticRel; - attribute SVGPathSegCurvetoQuadraticSmoothAbsConstructor SVGPathSegCurvetoQuadraticSmoothAbs; - attribute SVGPathSegCurvetoQuadraticSmoothRelConstructor SVGPathSegCurvetoQuadraticSmoothRel; - attribute SVGPathSegLinetoAbsConstructor SVGPathSegLinetoAbs; - attribute SVGPathSegLinetoHorizontalAbsConstructor SVGPathSegLinetoHorizontalAbs; - attribute SVGPathSegLinetoHorizontalRelConstructor SVGPathSegLinetoHorizontalRel; - attribute SVGPathSegLinetoRelConstructor SVGPathSegLinetoRel; - attribute SVGPathSegLinetoVerticalAbsConstructor SVGPathSegLinetoVerticalAbs; - attribute SVGPathSegLinetoVerticalRelConstructor SVGPathSegLinetoVerticalRel; - attribute SVGPathSegListConstructor SVGPathSegList; - attribute SVGPathSegMovetoAbsConstructor SVGPathSegMovetoAbs; - attribute SVGPathSegMovetoRelConstructor SVGPathSegMovetoRel; - attribute SVGPatternElementConstructor SVGPatternElement; - attribute SVGPointConstructor SVGPoint; - attribute SVGPointListConstructor SVGPointList; - attribute SVGPolygonElementConstructor SVGPolygonElement; - attribute SVGPolylineElementConstructor SVGPolylineElement; - attribute SVGPreserveAspectRatioConstructor SVGPreserveAspectRatio; - attribute SVGRadialGradientElementConstructor SVGRadialGradientElement; - attribute SVGRectConstructor SVGRect; - attribute SVGRectElementConstructor SVGRectElement; - attribute SVGRenderingIntentConstructor SVGRenderingIntent; - attribute SVGScriptElementConstructor SVGScriptElement; - attribute SVGStopElementConstructor SVGStopElement; - attribute SVGStringListConstructor SVGStringList; - attribute SVGStyleElementConstructor SVGStyleElement; - attribute SVGSVGElementConstructor SVGSVGElement; - attribute SVGSwitchElementConstructor SVGSwitchElement; - attribute SVGSymbolElementConstructor SVGSymbolElement; - attribute SVGTextContentElementConstructor SVGTextContentElement; - attribute SVGTextElementConstructor SVGTextElement; - attribute SVGTextPathElementConstructor SVGTextPathElement; - attribute SVGTextPositioningElementConstructor SVGTextPositioningElement; - attribute SVGTitleElementConstructor SVGTitleElement; - attribute SVGTransformConstructor SVGTransform; - attribute SVGTransformListConstructor SVGTransformList; - attribute SVGTRefElementConstructor SVGTRefElement; - attribute SVGTSpanElementConstructor SVGTSpanElement; - attribute SVGUnitTypesConstructor SVGUnitTypes; - attribute SVGUseElementConstructor SVGUseElement; - attribute SVGViewElementConstructor SVGViewElement; - attribute SVGViewSpecConstructor SVGViewSpec; - attribute SVGZoomAndPanConstructor SVGZoomAndPan; - - attribute SVGAnimateColorElementConstructor SVGAnimateColorElement; - attribute SVGAnimateElementConstructor SVGAnimateElement; - attribute SVGAnimateMotionElementConstructor SVGAnimateMotionElement; - attribute SVGAnimateTransformElementConstructor SVGAnimateTransformElement; - attribute SVGMPathElementConstructor SVGMPathElement; - attribute SVGSetElementConstructor SVGSetElement; + attribute SVGDefsElementConstructor SVGDefsElement; + attribute SVGDescElementConstructor SVGDescElement; + attribute SVGDocumentConstructor SVGDocument; + attribute SVGElementConstructor SVGElement; + attribute SVGElementInstanceConstructor SVGElementInstance; + attribute SVGElementInstanceListConstructor SVGElementInstanceList; + attribute SVGEllipseElementConstructor SVGEllipseElement; + attribute SVGForeignObjectElementConstructor SVGForeignObjectElement; + attribute SVGExceptionConstructor SVGException; + attribute SVGGElementConstructor SVGGElement; + attribute SVGGradientElementConstructor SVGGradientElement; + attribute SVGImageElementConstructor SVGImageElement; + attribute SVGLengthConstructor SVGLength; + attribute SVGLengthListConstructor SVGLengthList; + attribute SVGLinearGradientElementConstructor SVGLinearGradientElement; + attribute SVGLineElementConstructor SVGLineElement; + attribute SVGMarkerElementConstructor SVGMarkerElement; + attribute SVGMaskElementConstructor SVGMaskElement; + attribute SVGMatrixConstructor SVGMatrix; + attribute SVGMetadataElementConstructor SVGMetadataElement; + attribute SVGNumberConstructor SVGNumber; + attribute SVGNumberListConstructor SVGNumberList; + attribute SVGPaintConstructor SVGPaint; + attribute SVGPathElementConstructor SVGPathElement; + attribute SVGPathSegConstructor SVGPathSeg; + attribute SVGPathSegArcAbsConstructor SVGPathSegArcAbs; + attribute SVGPathSegArcRelConstructor SVGPathSegArcRel; + attribute SVGPathSegClosePathConstructor SVGPathSegClosePath; + attribute SVGPathSegCurvetoCubicAbsConstructor SVGPathSegCurvetoCubicAbs; + attribute SVGPathSegCurvetoCubicRelConstructor SVGPathSegCurvetoCubicRel; + attribute SVGPathSegCurvetoCubicSmoothAbsConstructor SVGPathSegCurvetoCubicSmoothAbs; + attribute SVGPathSegCurvetoCubicSmoothRelConstructor SVGPathSegCurvetoCubicSmoothRel; + attribute SVGPathSegCurvetoQuadraticAbsConstructor SVGPathSegCurvetoQuadraticAbs; + attribute SVGPathSegCurvetoQuadraticRelConstructor SVGPathSegCurvetoQuadraticRel; + attribute SVGPathSegCurvetoQuadraticSmoothAbsConstructor SVGPathSegCurvetoQuadraticSmoothAbs; + attribute SVGPathSegCurvetoQuadraticSmoothRelConstructor SVGPathSegCurvetoQuadraticSmoothRel; + attribute SVGPathSegLinetoAbsConstructor SVGPathSegLinetoAbs; + attribute SVGPathSegLinetoHorizontalAbsConstructor SVGPathSegLinetoHorizontalAbs; + attribute SVGPathSegLinetoHorizontalRelConstructor SVGPathSegLinetoHorizontalRel; + attribute SVGPathSegLinetoRelConstructor SVGPathSegLinetoRel; + attribute SVGPathSegLinetoVerticalAbsConstructor SVGPathSegLinetoVerticalAbs; + attribute SVGPathSegLinetoVerticalRelConstructor SVGPathSegLinetoVerticalRel; + attribute SVGPathSegListConstructor SVGPathSegList; + attribute SVGPathSegMovetoAbsConstructor SVGPathSegMovetoAbs; + attribute SVGPathSegMovetoRelConstructor SVGPathSegMovetoRel; + attribute SVGPatternElementConstructor SVGPatternElement; + attribute SVGPointConstructor SVGPoint; + attribute SVGPointListConstructor SVGPointList; + attribute SVGPolygonElementConstructor SVGPolygonElement; + attribute SVGPolylineElementConstructor SVGPolylineElement; + attribute SVGPreserveAspectRatioConstructor SVGPreserveAspectRatio; + attribute SVGRadialGradientElementConstructor SVGRadialGradientElement; + attribute SVGRectConstructor SVGRect; + attribute SVGRectElementConstructor SVGRectElement; + attribute SVGRenderingIntentConstructor SVGRenderingIntent; + attribute SVGScriptElementConstructor SVGScriptElement; + attribute SVGStopElementConstructor SVGStopElement; + attribute SVGStringListConstructor SVGStringList; + attribute SVGStyleElementConstructor SVGStyleElement; + attribute SVGSVGElementConstructor SVGSVGElement; + attribute SVGSwitchElementConstructor SVGSwitchElement; + attribute SVGSymbolElementConstructor SVGSymbolElement; + attribute SVGTextContentElementConstructor SVGTextContentElement; + attribute SVGTextElementConstructor SVGTextElement; + attribute SVGTextPathElementConstructor SVGTextPathElement; + attribute SVGTextPositioningElementConstructor SVGTextPositioningElement; + attribute SVGTitleElementConstructor SVGTitleElement; + attribute SVGTransformConstructor SVGTransform; + attribute SVGTransformListConstructor SVGTransformList; + attribute SVGTRefElementConstructor SVGTRefElement; + attribute SVGTSpanElementConstructor SVGTSpanElement; + attribute SVGUnitTypesConstructor SVGUnitTypes; + attribute SVGUseElementConstructor SVGUseElement; + attribute SVGViewElementConstructor SVGViewElement; + attribute SVGViewSpecConstructor SVGViewSpec; + attribute SVGZoomAndPanConstructor SVGZoomAndPan; + + attribute SVGAnimateColorElementConstructor SVGAnimateColorElement; + attribute SVGAnimateElementConstructor SVGAnimateElement; + attribute SVGAnimateMotionElementConstructor SVGAnimateMotionElement; + attribute SVGAnimateTransformElementConstructor SVGAnimateTransformElement; + attribute SVGMPathElementConstructor SVGMPathElement; + attribute SVGSetElementConstructor SVGSetElement; #if defined(ENABLE_SVG_FONTS) && ENABLE_SVG_FONTS - attribute SVGAltGlyphDefElementConstructor SVGAltGlyphDefElement; - attribute SVGAltGlyphElementConstructor SVGAltGlyphElement; - attribute SVGAltGlyphItemElementConstructor SVGAltGlyphItemElement; + attribute SVGAltGlyphDefElementConstructor SVGAltGlyphDefElement; + attribute SVGAltGlyphElementConstructor SVGAltGlyphElement; + attribute SVGAltGlyphItemElementConstructor SVGAltGlyphItemElement; // attribute SVGDefinitionSrcElementConstructor SVGDefinitionSrcElement; - attribute SVGFontElementConstructor SVGFontElement; - attribute SVGFontFaceElementConstructor SVGFontFaceElement; - attribute SVGFontFaceFormatElementConstructor SVGFontFaceFormatElement; - attribute SVGFontFaceNameElementConstructor SVGFontFaceNameElement; - attribute SVGFontFaceSrcElementConstructor SVGFontFaceSrcElement; - attribute SVGFontFaceUriElementConstructor SVGFontFaceUriElement; - attribute SVGGlyphElementConstructor SVGGlyphElement; - attribute SVGGlyphRefElementConstructor SVGGlyphRefElement; - attribute SVGHKernElementConstructor SVGHKernElement; - attribute SVGMissingGlyphElementConstructor SVGMissingGlyphElement; - attribute SVGVKernElementConstructor SVGVKernElement; + attribute SVGFontElementConstructor SVGFontElement; + attribute SVGFontFaceElementConstructor SVGFontFaceElement; + attribute SVGFontFaceFormatElementConstructor SVGFontFaceFormatElement; + attribute SVGFontFaceNameElementConstructor SVGFontFaceNameElement; + attribute SVGFontFaceSrcElementConstructor SVGFontFaceSrcElement; + attribute SVGFontFaceUriElementConstructor SVGFontFaceUriElement; + attribute SVGGlyphElementConstructor SVGGlyphElement; + attribute SVGGlyphRefElementConstructor SVGGlyphRefElement; + attribute SVGHKernElementConstructor SVGHKernElement; + attribute SVGMissingGlyphElementConstructor SVGMissingGlyphElement; + attribute SVGVKernElementConstructor SVGVKernElement; #endif #if defined(ENABLE_FILTERS) && ENABLE_FILTERS - attribute SVGComponentTransferFunctionElementConstructor SVGComponentTransferFunctionElement; - attribute SVGFEBlendElementConstructor SVGFEBlendElement; - attribute SVGFEColorMatrixElementConstructor SVGFEColorMatrixElement; - attribute SVGFEComponentTransferElementConstructor SVGFEComponentTransferElement; - attribute SVGFECompositeElementConstructor SVGFECompositeElement; - attribute SVGFEConvolveMatrixElementConstructor SVGFEConvolveMatrixElement; - attribute SVGFEDiffuseLightingElementConstructor SVGFEDiffuseLightingElement; - attribute SVGFEDisplacementMapElementConstructor SVGFEDisplacementMapElement; - attribute SVGFEDistantLightElementConstructor SVGFEDistantLightElement; - attribute SVGFEDropShadowElementConstructor SVGFEDropShadowElement; - attribute SVGFEFloodElementConstructor SVGFEFloodElement; - attribute SVGFEFuncAElementConstructor SVGFEFuncAElement; - attribute SVGFEFuncBElementConstructor SVGFEFuncBElement; - attribute SVGFEFuncGElementConstructor SVGFEFuncGElement; - attribute SVGFEFuncRElementConstructor SVGFEFuncRElement; - attribute SVGFEGaussianBlurElementConstructor SVGFEGaussianBlurElement; - attribute SVGFEImageElementConstructor SVGFEImageElement; - attribute SVGFEMergeElementConstructor SVGFEMergeElement; - attribute SVGFEMergeNodeElementConstructor SVGFEMergeNodeElement; - attribute SVGFEMorphologyElementConstructor SVGFEMorphologyElement; - attribute SVGFEOffsetElementConstructor SVGFEOffsetElement; - attribute SVGFEPointLightElementConstructor SVGFEPointLightElement; - attribute SVGFESpecularLightingElementConstructor SVGFESpecularLightingElement; - attribute SVGFESpotLightElementConstructor SVGFESpotLightElement; - attribute SVGFETileElementConstructor SVGFETileElement; - attribute SVGFETurbulenceElementConstructor SVGFETurbulenceElement; - attribute SVGFilterElementConstructor SVGFilterElement; + attribute SVGComponentTransferFunctionElementConstructor SVGComponentTransferFunctionElement; + attribute SVGFEBlendElementConstructor SVGFEBlendElement; + attribute SVGFEColorMatrixElementConstructor SVGFEColorMatrixElement; + attribute SVGFEComponentTransferElementConstructor SVGFEComponentTransferElement; + attribute SVGFECompositeElementConstructor SVGFECompositeElement; + attribute SVGFEConvolveMatrixElementConstructor SVGFEConvolveMatrixElement; + attribute SVGFEDiffuseLightingElementConstructor SVGFEDiffuseLightingElement; + attribute SVGFEDisplacementMapElementConstructor SVGFEDisplacementMapElement; + attribute SVGFEDistantLightElementConstructor SVGFEDistantLightElement; + attribute SVGFEDropShadowElementConstructor SVGFEDropShadowElement; + attribute SVGFEFloodElementConstructor SVGFEFloodElement; + attribute SVGFEFuncAElementConstructor SVGFEFuncAElement; + attribute SVGFEFuncBElementConstructor SVGFEFuncBElement; + attribute SVGFEFuncGElementConstructor SVGFEFuncGElement; + attribute SVGFEFuncRElementConstructor SVGFEFuncRElement; + attribute SVGFEGaussianBlurElementConstructor SVGFEGaussianBlurElement; + attribute SVGFEImageElementConstructor SVGFEImageElement; + attribute SVGFEMergeElementConstructor SVGFEMergeElement; + attribute SVGFEMergeNodeElementConstructor SVGFEMergeNodeElement; + attribute SVGFEMorphologyElementConstructor SVGFEMorphologyElement; + attribute SVGFEOffsetElementConstructor SVGFEOffsetElement; + attribute SVGFEPointLightElementConstructor SVGFEPointLightElement; + attribute SVGFESpecularLightingElementConstructor SVGFESpecularLightingElement; + attribute SVGFESpotLightElementConstructor SVGFESpotLightElement; + attribute SVGFETileElementConstructor SVGFETileElement; + attribute SVGFETurbulenceElementConstructor SVGFETurbulenceElement; + attribute SVGFilterElementConstructor SVGFilterElement; #endif #endif - attribute DOMFormDataConstructor FormData; + attribute DOMFormDataConstructor FormData; - [Conditional=BLOB|FILE_SYSTEM] attribute FileErrorConstructor FileError; - [Conditional=BLOB] attribute FileReaderConstructor FileReader; + attribute [Conditional=BLOB|FILE_SYSTEM] FileErrorConstructor FileError; + attribute [Conditional=BLOB] FileReaderConstructor FileReader; - [Conditional=BLOB] attribute DOMURLConstructor URL; - [Conditional=BLOB] attribute DOMURLConstructor webkitURL; // FIXME: deprecate this. + attribute [Conditional=BLOB&LEGACY_WEBKIT_BLOB_BUILDER] WebKitBlobBuilderConstructor WebKitBlobBuilder; - [Conditional=MUTATION_OBSERVERS] attribute MutationObserverConstructor WebKitMutationObserver; + attribute [Conditional=BLOB] DOMURLConstructor URL; + attribute [Conditional=BLOB] DOMURLConstructor webkitURL; // FIXME: deprecate this. - [Conditional=MEDIA_SOURCE, V8EnabledAtRuntime=mediaSource] attribute MediaSourceConstructor WebKitMediaSource; - [Conditional=MEDIA_SOURCE, V8EnabledAtRuntime=mediaSource] attribute SourceBufferConstructor WebKitSourceBuffer; - [Conditional=MEDIA_SOURCE, V8EnabledAtRuntime=mediaSource] attribute SourceBufferListConstructor WebKitSourceBufferList; + attribute [Conditional=MUTATION_OBSERVERS] MutationObserverConstructor WebKitMutationObserver; + + attribute [Conditional=MEDIA_SOURCE, V8EnabledAtRuntime=mediaSource] MediaSourceConstructor WebKitMediaSource; + attribute [Conditional=MEDIA_SOURCE, V8EnabledAtRuntime=mediaSource] SourceBufferConstructor WebKitSourceBuffer; + attribute [Conditional=MEDIA_SOURCE, V8EnabledAtRuntime=mediaSource] SourceBufferListConstructor WebKitSourceBufferList; #endif // defined(LANGUAGE_JAVASCRIPT) #if defined(V8_BINDING) && V8_BINDING - // window.toString() requires special handling in V8 - [V8DoNotCheckSignature, DoNotCheckSecurity, Custom, NotEnumerable] DOMString toString(); + // window.toString() requires special handling in V8 + [V8DoNotCheckSignature, DoNotCheckSecurity, Custom, NotEnumerable] DOMString toString(); #endif // defined(V8_BINDING) -}; + }; + +} diff --git a/Source/WebCore/page/DOMWindowPagePopup.idl b/Source/WebCore/page/DOMWindowPagePopup.idl index 301d8b963..aa477a111 100644 --- a/Source/WebCore/page/DOMWindowPagePopup.idl +++ b/Source/WebCore/page/DOMWindowPagePopup.idl @@ -28,9 +28,11 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -[ - Conditional=PAGE_POPUP, - Supplemental=DOMWindow -] interface DOMWindowPagePopup { - [V8EnabledPerContext=pagePopup] readonly attribute PagePopupController pagePopupController; -}; +module window { + interface [ + Conditional=PAGE_POPUP, + Supplemental=DOMWindow + ] DOMWindowPagePopup { + readonly attribute [V8EnabledPerContext=pagePopup] PagePopupController pagePopupController; + }; +} diff --git a/Source/WebCore/page/EventHandler.cpp b/Source/WebCore/page/EventHandler.cpp index 5ef0c61da..32d238ce3 100644 --- a/Source/WebCore/page/EventHandler.cpp +++ b/Source/WebCore/page/EventHandler.cpp @@ -1,7 +1,6 @@ /* * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) - * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies) * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -40,7 +39,6 @@ #include "DragController.h" #include "DragState.h" #include "Editor.h" -#include "EditorClient.h" #include "EventNames.h" #include "FloatPoint.h" #include "FloatRect.h" @@ -430,33 +428,25 @@ bool EventHandler::updateSelectionForMouseDownDispatchingSelectStart(Node* targe return true; } -void EventHandler::selectClosestWordFromHitTestResult(const HitTestResult& result, AppendTrailingWhitespace appendTrailingWhitespace) +void EventHandler::selectClosestWordFromMouseEvent(const MouseEventWithHitTestResults& result) { Node* innerNode = result.targetNode(); VisibleSelection newSelection; - if (innerNode && innerNode->renderer()) { + if (innerNode && innerNode->renderer() && m_mouseDownMayStartSelect) { VisiblePosition pos(innerNode->renderer()->positionForPoint(result.localPoint())); if (pos.isNotNull()) { newSelection = VisibleSelection(pos); newSelection.expandUsingGranularity(WordGranularity); } - if (appendTrailingWhitespace == ShouldAppendTrailingWhitespace && newSelection.isRange()) + if (newSelection.isRange() && result.event().clickCount() == 2 && m_frame->editor()->isSelectTrailingWhitespaceEnabled()) newSelection.appendTrailingWhitespace(); updateSelectionForMouseDownDispatchingSelectStart(innerNode, newSelection, WordGranularity); } } -void EventHandler::selectClosestWordFromMouseEvent(const MouseEventWithHitTestResults& result) -{ - if (m_mouseDownMayStartSelect) { - selectClosestWordFromHitTestResult(result.hitTestResult(), - (result.event().clickCount() == 2 && m_frame->editor()->isSelectTrailingWhitespaceEnabled()) ? ShouldAppendTrailingWhitespace : DontAppendTrailingWhitespace); - } -} - void EventHandler::selectClosestWordOrLinkFromMouseEvent(const MouseEventWithHitTestResults& result) { if (!result.hitTestResult().isLiveLink()) @@ -569,13 +559,7 @@ bool EventHandler::handleMousePressEventSingleClick(const MouseEventWithHitTestR } else newSelection = VisibleSelection(visiblePos); - bool handled = updateSelectionForMouseDownDispatchingSelectStart(innerNode, newSelection, granularity); - - if (event.event().button() == MiddleButton) { - // Ignore handled, since we want to paste to where the caret was placed anyway. - handled = handlePasteGlobalSelection(event.event()) || handled; - } - return handled; + return updateSelectionForMouseDownDispatchingSelectStart(innerNode, newSelection, granularity); } static inline bool canMouseDownStartSelect(Node* node) @@ -920,11 +904,6 @@ bool EventHandler::handleMouseReleaseEvent(const MouseEventWithHitTestResults& e m_frame->selection()->selectFrameElementInParentIfFullySelected(); - if (event.event().button() == MiddleButton) { - // Ignore handled, since we want to paste to where the caret was placed anyway. - handled = handlePasteGlobalSelection(event.event()) || handled; - } - return handled; } @@ -1692,8 +1671,8 @@ static RenderLayer* layerForNode(Node* node) bool EventHandler::mouseMoved(const PlatformMouseEvent& event) { - RefPtr<FrameView> protector(m_frame->view()); MaximumDurationTracker maxDurationTracker(&m_maxMouseMovedDuration); + RefPtr<FrameView> protector(m_frame->view()); #if ENABLE(TOUCH_EVENTS) @@ -1917,41 +1896,6 @@ bool EventHandler::handleMouseReleaseEvent(const PlatformMouseEvent& mouseEvent) return swallowMouseUpEvent || swallowClickEvent || swallowMouseReleaseEvent; } -bool EventHandler::handlePasteGlobalSelection(const PlatformMouseEvent& mouseEvent) -{ - // If the event was a middle click, attempt to copy global selection in after - // the newly set caret position. - // - // This code is called from either the mouse up or mouse down handling. There - // is some debate about when the global selection is pasted: - // xterm: pastes on up. - // GTK: pastes on down. - // Qt: pastes on up. - // Firefox: pastes on up. - // Chromium: pastes on up. - // - // There is something of a webcompat angle to this well, as highlighted by - // crbug.com/14608. Pages can clear text boxes 'onclick' and, if we paste on - // down then the text is pasted just before the onclick handler runs and - // clears the text box. So it's important this happens after the event - // handlers have been fired. -#if PLATFORM(GTK) - if (mouseEvent.type() != PlatformEvent::MousePressed) - return false; -#else - if (mouseEvent.type() != PlatformEvent::MouseReleased) - return false; -#endif - - Frame* focusFrame = m_frame->page()->focusController()->focusedOrMainFrame(); - // Do not paste here if the focus was moved somewhere else. - if (m_frame == focusFrame && m_frame->editor()->client()->supportsGlobalSelection()) - return m_frame->editor()->command(AtomicString("PasteGlobalSelection")).execute(); - - return false; -} - - #if ENABLE(DRAG_SUPPORT) bool EventHandler::dispatchDragEvent(const AtomicString& eventType, Node* dragTarget, const PlatformMouseEvent& event, Clipboard* clipboard) { @@ -2174,8 +2118,8 @@ void EventHandler::updateMouseEventTargetNode(Node* targetNode, const PlatformMo else { // If the target node is a text node, dispatch on the parent node - rdar://4196646 if (result && result->isTextNode()) { - AncestorChainWalker walker(result); - walker.parent(); + ComposedShadowTreeParentWalker walker(result); + walker.parentIncludingInsertionPointAndShadowRoot(); result = walker.get(); } } @@ -2521,9 +2465,8 @@ bool EventHandler::handleGestureEvent(const PlatformGestureEvent& gestureEvent) return handleGestureTap(gestureEvent); case PlatformEvent::GestureTapDown: return handleGestureTapDown(); - case PlatformEvent::GestureLongPress: - return handleGestureLongPress(gestureEvent); case PlatformEvent::GestureDoubleTap: + case PlatformEvent::GestureLongPress: case PlatformEvent::GesturePinchBegin: case PlatformEvent::GesturePinchEnd: case PlatformEvent::GesturePinchUpdate: @@ -2570,25 +2513,6 @@ bool EventHandler::handleGestureTap(const PlatformGestureEvent& gestureEvent) return defaultPrevented; } -bool EventHandler::handleGestureLongPress(const PlatformGestureEvent& gestureEvent) -{ -#if OS(ANDROID) - IntPoint hitTestPoint = m_frame->view()->windowToContents(gestureEvent.position()); - HitTestResult result = hitTestResultAtPoint(hitTestPoint, true); - Node* innerNode = result.targetNode(); - if (!result.isLiveLink() && innerNode && (innerNode->isContentEditable() || innerNode->isTextNode())) { - selectClosestWordFromHitTestResult(result, DontAppendTrailingWhitespace); - if (m_frame->selection()->isRange()) - return true; - } -#endif -#if ENABLE(CONTEXT_MENUS) - return sendContextMenuEventForGesture(gestureEvent); -#else - return false; -#endif -} - bool EventHandler::handleGestureScrollUpdate(const PlatformGestureEvent& gestureEvent) { return handleGestureScrollCore(gestureEvent, ScrollByPixelWheelEvent, true); @@ -3699,9 +3623,6 @@ bool EventHandler::handleTouchEvent(const PlatformTouchEvent& event) if (node->isTextNode()) node = node->parentNode(); - if (InspectorInstrumentation::handleTouchEvent(m_frame->page(), node)) - return true; - Document* doc = node->document(); if (!doc) continue; @@ -3755,7 +3676,7 @@ bool EventHandler::handleTouchEvent(const PlatformTouchEvent& event) // released or cancelled it will only appear in the changedTouches list. if (pointState != PlatformTouchPoint::TouchReleased && pointState != PlatformTouchPoint::TouchCancelled) { touches->append(touch); - targetTouchesIterator->value->append(touch); + targetTouchesIterator->second->append(touch); } // Now build up the correct list for changedTouches. diff --git a/Source/WebCore/page/EventHandler.h b/Source/WebCore/page/EventHandler.h index a604da2c8..6d8a0ab76 100644 --- a/Source/WebCore/page/EventHandler.h +++ b/Source/WebCore/page/EventHandler.h @@ -89,7 +89,6 @@ extern const int GeneralDragHysteresis; #endif // ENABLE(DRAG_SUPPORT) enum HitTestScrollbars { ShouldHitTestScrollbars, DontHitTestScrollbars }; -enum AppendTrailingWhitespace { ShouldAppendTrailingWhitespace, DontAppendTrailingWhitespace }; class EventHandler { WTF_MAKE_NONCOPYABLE(EventHandler); @@ -112,7 +111,6 @@ public: void stopAutoscrollTimer(bool rendererIsBeingDestroyed = false); RenderObject* autoscrollRenderer() const; void updateAutoscrollRenderer(); - bool autoscrollInProgress() const { return m_autoscrollInProgress; } void dispatchFakeMouseMoveEventSoon(); void dispatchFakeMouseMoveEventSoonInQuad(const FloatQuad&); @@ -162,12 +160,10 @@ public: bool handleMouseReleaseEvent(const PlatformMouseEvent&); bool handleWheelEvent(const PlatformWheelEvent&); void defaultWheelEventHandler(Node*, WheelEvent*); - bool handlePasteGlobalSelection(const PlatformMouseEvent&); #if ENABLE(GESTURE_EVENTS) bool handleGestureEvent(const PlatformGestureEvent&); bool handleGestureTap(const PlatformGestureEvent&); - bool handleGestureLongPress(const PlatformGestureEvent&); bool handleGestureScrollUpdate(const PlatformGestureEvent&); #endif @@ -243,7 +239,6 @@ private: bool eventActivatedView(const PlatformMouseEvent&) const; bool updateSelectionForMouseDownDispatchingSelectStart(Node*, const VisibleSelection&, TextGranularity); - void selectClosestWordFromHitTestResult(const HitTestResult&, AppendTrailingWhitespace); void selectClosestWordFromMouseEvent(const MouseEventWithHitTestResults&); void selectClosestWordOrLinkFromMouseEvent(const MouseEventWithHitTestResults&); diff --git a/Source/WebCore/page/EventSource.idl b/Source/WebCore/page/EventSource.idl index 60d36faa0..48df3ebe8 100644 --- a/Source/WebCore/page/EventSource.idl +++ b/Source/WebCore/page/EventSource.idl @@ -29,38 +29,41 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -[ - ActiveDOMObject, - Constructor(in DOMString scriptUrl), - CallWith=ScriptExecutionContext, - ConstructorRaisesException, - EventTarget, - JSNoStaticTables -] interface EventSource { +module window { - readonly attribute DOMString URL; // Lowercased .url is the one in the spec, but leaving .URL for compatibility reasons. - readonly attribute DOMString url; + interface [ + ActiveDOMObject, + Constructor(in DOMString scriptUrl), + CallWith=ScriptExecutionContext, + ConstructorRaisesException, + EventTarget, + JSNoStaticTables + ] EventSource { - // ready state - const unsigned short CONNECTING = 0; - const unsigned short OPEN = 1; - const unsigned short CLOSED = 2; - readonly attribute unsigned short readyState; + readonly attribute DOMString URL; // Lowercased .url is the one in the spec, but leaving .URL for compatibility reasons. + readonly attribute DOMString url; - // networking - attribute EventListener onopen; - attribute EventListener onmessage; - attribute EventListener onerror; - void close(); + // ready state + const unsigned short CONNECTING = 0; + const unsigned short OPEN = 1; + const unsigned short CLOSED = 2; + readonly attribute unsigned short readyState; - // EventTarget interface - void addEventListener(in DOMString type, - in EventListener listener, - in [Optional] boolean useCapture); - void removeEventListener(in DOMString type, - in EventListener listener, - in [Optional] boolean useCapture); - boolean dispatchEvent(in Event evt) - raises(EventException); + // networking + attribute EventListener onopen; + attribute EventListener onmessage; + attribute EventListener onerror; + void close(); -}; + // EventTarget interface + void addEventListener(in DOMString type, + in EventListener listener, + in [Optional] boolean useCapture); + void removeEventListener(in DOMString type, + in EventListener listener, + in [Optional] boolean useCapture); + boolean dispatchEvent(in Event evt) + raises(EventException); + + }; +} diff --git a/Source/WebCore/page/FeatureObserver.cpp b/Source/WebCore/page/FeatureObserver.cpp index 31d22c55f..a1f889ec8 100644 --- a/Source/WebCore/page/FeatureObserver.cpp +++ b/Source/WebCore/page/FeatureObserver.cpp @@ -54,8 +54,6 @@ FeatureObserver::~FeatureObserver() void FeatureObserver::observe(DOMWindow* domWindow, Feature feature) { - ASSERT(domWindow); - Document* document = domWindow->document(); if (!document) return; diff --git a/Source/WebCore/page/FeatureObserver.h b/Source/WebCore/page/FeatureObserver.h index 8e0e84588..6a50c53df 100644 --- a/Source/WebCore/page/FeatureObserver.h +++ b/Source/WebCore/page/FeatureObserver.h @@ -41,7 +41,7 @@ public: enum Feature { PageDestruction, LegacyNotifications, - UnusedSlot01, // Prior to 10/2012, we used this slot for LegacyBlobBuilder. + LegacyBlobBuilder, PrefixedIndexedDB, WorkerStart, SharedWorkerStart, @@ -49,11 +49,6 @@ public: WebAudioStart, PrefixedContentSecurityPolicy, UnprefixedIndexedDB, - OpenWebDatabase, - LegacyHTMLNotifications, - LegacyTextNotifications, - UnprefixedRequestAnimationFrame, - PrefixedRequestAnimationFrame, // Add new features above this line. NumberOfFeatures, // This enum value must be last. }; diff --git a/Source/WebCore/page/Frame.cpp b/Source/WebCore/page/Frame.cpp index 6205fa6ce..a7aaf954b 100644 --- a/Source/WebCore/page/Frame.cpp +++ b/Source/WebCore/page/Frame.cpp @@ -184,7 +184,7 @@ inline Frame::Frame(Page* page, HTMLFrameOwnerElement* ownerElement, FrameLoader setTiledBackingStoreEnabled(page->settings()->tiledBackingStoreEnabled()); #endif } else { - page->incrementSubframeCount(); + page->incrementFrameCount(); // Make sure we will not end up with two frames referencing the same owner element. Frame*& contentFrameSlot = ownerElement->m_contentFrame; @@ -579,7 +579,7 @@ void Frame::injectUserScripts(UserScriptInjectionTime injectionTime) return; UserScriptMap::const_iterator end = userScripts->end(); for (UserScriptMap::const_iterator it = userScripts->begin(); it != end; ++it) - injectUserScriptsForWorld(it->key.get(), *it->value, injectionTime); + injectUserScriptsForWorld(it->first.get(), *it->second, injectionTime); } void Frame::injectUserScriptsForWorld(DOMWrapperWorld* world, const UserScriptVector& userScripts, UserScriptInjectionTime injectionTime) @@ -704,7 +704,7 @@ void Frame::disconnectOwnerElement() doc->clearAXObjectCache(); m_ownerElement->m_contentFrame = 0; if (m_page) - m_page->decrementSubframeCount(); + m_page->decrementFrameCount(); } m_ownerElement = 0; } @@ -876,7 +876,7 @@ Color Frame::tiledBackingStoreBackgroundColor() const } #endif -String Frame::layerTreeAsText(LayerTreeFlags flags) const +String Frame::layerTreeAsText(bool showDebugInfo) const { #if USE(ACCELERATED_COMPOSITING) document()->updateLayout(); @@ -884,9 +884,9 @@ String Frame::layerTreeAsText(LayerTreeFlags flags) const if (!contentRenderer()) return String(); - return contentRenderer()->compositor()->layerTreeAsText(flags); + return contentRenderer()->compositor()->layerTreeAsText(showDebugInfo); #else - UNUSED_PARAM(flags); + UNUSED_PARAM(showDebugInfo); return String(); #endif } @@ -956,9 +956,8 @@ float Frame::frameScaleFactor() const Page* page = this->page(); // Main frame is scaled with respect to he container but inner frames are not scaled with respect to the main frame. - if (!page || page->mainFrame() != this || page->settings()->applyPageScaleFactorInCompositor()) + if (!page || page->mainFrame() != this) return 1; - return page->pageScaleFactor(); } diff --git a/Source/WebCore/page/Frame.h b/Source/WebCore/page/Frame.h index 0a07c4220..719692269 100644 --- a/Source/WebCore/page/Frame.h +++ b/Source/WebCore/page/Frame.h @@ -76,12 +76,6 @@ namespace WebCore { class TreeScope; - enum { - LayerTreeFlagsIncludeDebugInfo = 1 << 0, - LayerTreeFlagsIncludeVisibleRects = 1 << 2 - }; - typedef unsigned LayerTreeFlags; - class Frame : public RefCounted<Frame>, public TiledBackingStoreClient { public: static PassRefPtr<Frame> create(Page*, HTMLFrameOwnerElement*, FrameLoaderClient*); @@ -131,7 +125,7 @@ namespace WebCore { void injectUserScripts(UserScriptInjectionTime); - String layerTreeAsText(LayerTreeFlags = 0) const; + String layerTreeAsText(bool showDebugInfo = false) const; static Frame* frameForWidget(const Widget*); diff --git a/Source/WebCore/page/FrameTree.cpp b/Source/WebCore/page/FrameTree.cpp index 1e0afe1dd..6f8171450 100644 --- a/Source/WebCore/page/FrameTree.cpp +++ b/Source/WebCore/page/FrameTree.cpp @@ -172,9 +172,6 @@ AtomicString FrameTree::uniqueChildName(const AtomicString& requestedName) const inline Frame* FrameTree::scopedChild(unsigned index, TreeScope* scope) const { - if (!scope) - return 0; - unsigned scopedIndex = 0; for (Frame* result = firstChild(); result; result = result->tree()->nextSibling()) { if (result->inScope(scope)) { @@ -189,9 +186,6 @@ inline Frame* FrameTree::scopedChild(unsigned index, TreeScope* scope) const inline Frame* FrameTree::scopedChild(const AtomicString& name, TreeScope* scope) const { - if (!scope) - return 0; - for (Frame* child = firstChild(); child; child = child->tree()->nextSibling()) if (child->tree()->uniqueName() == name && child->inScope(scope)) return child; @@ -200,9 +194,6 @@ inline Frame* FrameTree::scopedChild(const AtomicString& name, TreeScope* scope) inline unsigned FrameTree::scopedChildCount(TreeScope* scope) const { - if (!scope) - return 0; - unsigned scopedCount = 0; for (Frame* result = firstChild(); result; result = result->tree()->nextSibling()) { if (result->inScope(scope)) diff --git a/Source/WebCore/page/FrameView.cpp b/Source/WebCore/page/FrameView.cpp index 5006b95a1..9f7274627 100644 --- a/Source/WebCore/page/FrameView.cpp +++ b/Source/WebCore/page/FrameView.cpp @@ -97,7 +97,6 @@ using namespace HTMLNames; double FrameView::sCurrentPaintTimeStamp = 0.0; - // REPAINT_THROTTLING now chooses default values for throttling parameters. // Should be removed when applications start using runtime configuration. #if ENABLE(REPAINT_THROTTLING) @@ -335,7 +334,7 @@ void FrameView::init() // Propagate the marginwidth/height and scrolling modes to the view. Element* ownerElement = m_frame ? m_frame->ownerElement() : 0; if (ownerElement && (ownerElement->hasTagName(frameTag) || ownerElement->hasTagName(iframeTag))) { - HTMLFrameElementBase* frameElt = static_cast<HTMLFrameElementBase*>(ownerElement); + HTMLFrameElement* frameElt = static_cast<HTMLFrameElement*>(ownerElement); if (frameElt->scrollingMode() == ScrollbarAlwaysOff) setCanHaveScrollbars(false); LayoutUnit marginWidth = frameElt->marginWidth(); @@ -782,19 +781,6 @@ TiledBacking* FrameView::tiledBacking() return backing->graphicsLayer()->tiledBacking(); } -uint64_t FrameView::scrollLayerID() const -{ - RenderView* root = rootRenderer(this); - if (!root) - return 0; - - RenderLayerBacking* backing = root->layer()->backing(); - if (!backing) - return 0; - - return backing->scrollLayerID(); -} - #if ENABLE(RUBBER_BANDING) GraphicsLayer* FrameView::layerForOverhangAreas() const { @@ -805,7 +791,7 @@ GraphicsLayer* FrameView::layerForOverhangAreas() const } #endif -bool FrameView::flushCompositingStateForThisFrame(Frame* rootFrameForFlush) +bool FrameView::syncCompositingStateForThisFrame(Frame* rootFrameForSync) { RenderView* root = rootRenderer(this); if (!root) @@ -822,7 +808,7 @@ bool FrameView::flushCompositingStateForThisFrame(Frame* rootFrameForFlush) // visible flash to occur. Instead, stop the deferred repaint timer and repaint immediately. flushDeferredRepaints(); - root->compositor()->flushPendingLayerChanges(rootFrameForFlush == m_frame); + root->compositor()->flushPendingLayerChanges(rootFrameForSync == m_frame); return true; } @@ -901,16 +887,16 @@ bool FrameView::isEnclosedInCompositingLayer() const return false; } -bool FrameView::flushCompositingStateIncludingSubframes() +bool FrameView::syncCompositingStateIncludingSubframes() { #if USE(ACCELERATED_COMPOSITING) - bool allFramesFlushed = flushCompositingStateForThisFrame(m_frame.get()); + bool allFramesSynced = syncCompositingStateForThisFrame(m_frame.get()); for (Frame* child = m_frame->tree()->firstChild(); child; child = child->tree()->traverseNext(m_frame.get())) { - bool flushed = child->view()->flushCompositingStateForThisFrame(m_frame.get()); - allFramesFlushed &= flushed; + bool synced = child->view()->syncCompositingStateForThisFrame(m_frame.get()); + allFramesSynced &= synced; } - return allFramesFlushed; + return allFramesSynced; #else // USE(ACCELERATED_COMPOSITING) return true; #endif @@ -1045,7 +1031,6 @@ void FrameView::layout(bool allowSubtree) ASSERT(m_frame->view() == this); Document* document = m_frame->document(); - ASSERT(!document->inPageCache()); bool subtree; RenderObject* root; @@ -1228,7 +1213,7 @@ void FrameView::layout(bool allowSubtree) root->document()->axObjectCache()->postNotification(root, AXObjectCache::AXLayoutComplete, true); #endif #if ENABLE(DASHBOARD_SUPPORT) || ENABLE(WIDGET_REGION) - updateAnnotatedRegions(); + updateDashboardRegions(); #endif ASSERT(!root->needsLayout()); @@ -2198,21 +2183,19 @@ void FrameView::scheduleRelayoutOfSubtree(RenderObject* relayoutRoot) m_layoutRoot->markContainingBlocksForLayout(false, relayoutRoot); m_layoutRoot = relayoutRoot; ASSERT(!m_layoutRoot->container() || !m_layoutRoot->container()->needsLayout()); - InspectorInstrumentation::didInvalidateLayout(m_frame.get()); } else { // Just do a full relayout if (m_layoutRoot) m_layoutRoot->markContainingBlocksForLayout(false); m_layoutRoot = 0; relayoutRoot->markContainingBlocksForLayout(false); - InspectorInstrumentation::didInvalidateLayout(m_frame.get()); } } } else if (m_layoutSchedulingEnabled) { + InspectorInstrumentation::didInvalidateLayout(m_frame.get()); int delay = m_frame->document()->minimumLayoutDelay(); m_layoutRoot = relayoutRoot; ASSERT(!m_layoutRoot->container() || !m_layoutRoot->container()->needsLayout()); - InspectorInstrumentation::didInvalidateLayout(m_frame.get()); m_delayedLayout = delay != 0; m_layoutTimer.startOneShot(delay * 0.001); } @@ -2264,7 +2247,7 @@ void FrameView::unscheduleRelayout() } #if ENABLE(REQUEST_ANIMATION_FRAME) -void FrameView::serviceScriptedAnimations(double monotonicAnimationStartTime) +void FrameView::serviceScriptedAnimations(DOMTimeStamp time) { for (Frame* frame = m_frame.get(); frame; frame = frame->tree()->traverseNext()) { frame->view()->serviceScrollAnimations(); @@ -2276,7 +2259,7 @@ void FrameView::serviceScriptedAnimations(double monotonicAnimationStartTime) documents.append(frame->document()); for (size_t i = 0; i < documents.size(); ++i) - documents[i]->serviceScriptedAnimations(monotonicAnimationStartTime); + documents[i]->serviceScriptedAnimations(time); } #endif @@ -2501,7 +2484,7 @@ void FrameView::performPostLayoutTasks() #if USE(ACCELERATED_COMPOSITING) if (TiledBacking* tiledBacking = this->tiledBacking()) - tiledBacking->setTileCoverage(canHaveScrollbars() ? TiledBacking::CoverageForScrolling : TiledBacking::CoverageForVisibleArea); + tiledBacking->setCanHaveScrollbars(canHaveScrollbars()); #endif scrollToAnchor(); @@ -2913,20 +2896,20 @@ bool FrameView::scrollAnimatorEnabled() const } #if ENABLE(DASHBOARD_SUPPORT) || ENABLE(WIDGET_REGION) -void FrameView::updateAnnotatedRegions() +void FrameView::updateDashboardRegions() { Document* document = m_frame->document(); - if (!document->hasAnnotatedRegions()) + if (!document->hasDashboardRegions()) return; - Vector<AnnotatedRegionValue> newRegions; - document->renderBox()->collectAnnotatedRegions(newRegions); - if (newRegions == document->annotatedRegions()) + Vector<DashboardRegionValue> newRegions; + document->renderBox()->collectDashboardRegions(newRegions); + if (newRegions == document->dashboardRegions()) return; - document->setAnnotatedRegions(newRegions); + document->setDashboardRegions(newRegions); Page* page = m_frame->page(); if (!page) return; - page->chrome()->client()->annotatedRegionsChanged(); + page->chrome()->client()->dashboardRegionsChanged(); } #endif @@ -3065,9 +3048,10 @@ bool FrameView::hasCustomScrollbars() const FrameView* FrameView::parentFrameView() const { - if (Frame* parentFrame = m_frame->tree()->parent()) - return parentFrame->view(); - + if (Widget* parentView = parent()) { + if (parentView->isFrameView()) + return static_cast<FrameView*>(parentView); + } return 0; } @@ -3208,7 +3192,7 @@ void FrameView::paintContents(GraphicsContext* p, const IntRect& rect) #if USE(ACCELERATED_COMPOSITING) if (!p->paintingDisabled() && !document->printing()) - flushCompositingStateForThisFrame(m_frame.get()); + syncCompositingStateForThisFrame(m_frame.get()); #endif PaintBehavior oldPaintBehavior = m_paintBehavior; @@ -3249,10 +3233,10 @@ void FrameView::paintContents(GraphicsContext* p, const IntRect& rect) m_paintBehavior = oldPaintBehavior; m_lastPaintTime = currentTime(); - // Regions may have changed as a result of the visibility/z-index of element changing. #if ENABLE(DASHBOARD_SUPPORT) || ENABLE(WIDGET_REGION) - if (document->annotatedRegionsDirty()) - updateAnnotatedRegions(); + // Regions may have changed as a result of the visibility/z-index of element changing. + if (document->dashboardRegionsDirty()) + updateDashboardRegions(); #endif if (isTopLevelPainter) @@ -3475,7 +3459,7 @@ void FrameView::adjustPageHeightDeprecated(float *newBottom, float oldTop, float IntRect FrameView::convertFromRenderer(const RenderObject* renderer, const IntRect& rendererRect) const { - IntRect rect = renderer->localToAbsoluteQuad(FloatRect(rendererRect), SnapOffsetForTransforms).enclosingBoundingBox(); + IntRect rect = renderer->localToAbsoluteQuad(FloatRect(rendererRect)).enclosingBoundingBox(); // Convert from page ("absolute") to FrameView coordinates. if (!delegatesScrolling()) @@ -3494,13 +3478,13 @@ IntRect FrameView::convertToRenderer(const RenderObject* renderer, const IntRect // FIXME: we don't have a way to map an absolute rect down to a local quad, so just // move the rect for now. - rect.setLocation(roundedIntPoint(renderer->absoluteToLocal(rect.location(), UseTransforms | SnapOffsetForTransforms))); + rect.setLocation(roundedIntPoint(renderer->absoluteToLocal(rect.location(), false, true /* use transforms */))); return rect; } IntPoint FrameView::convertFromRenderer(const RenderObject* renderer, const IntPoint& rendererPoint) const { - IntPoint point = roundedIntPoint(renderer->localToAbsolute(rendererPoint, UseTransforms | SnapOffsetForTransforms)); + IntPoint point = roundedIntPoint(renderer->localToAbsolute(rendererPoint, false, true /* use transforms */)); // Convert from page ("absolute") to FrameView coordinates. if (!delegatesScrolling()) @@ -3516,7 +3500,7 @@ IntPoint FrameView::convertToRenderer(const RenderObject* renderer, const IntPoi if (!delegatesScrolling()) point += IntSize(scrollX(), scrollY()); - return roundedIntPoint(renderer->absoluteToLocal(point, UseTransforms | SnapOffsetForTransforms)); + return roundedIntPoint(renderer->absoluteToLocal(point, false, true /* use transforms */)); } IntRect FrameView::convertToContainingView(const IntRect& localRect) const diff --git a/Source/WebCore/page/FrameView.h b/Source/WebCore/page/FrameView.h index 944d9d16b..ceea73ff5 100644 --- a/Source/WebCore/page/FrameView.h +++ b/Source/WebCore/page/FrameView.h @@ -115,13 +115,13 @@ public: bool needsFullRepaint() const { return m_doFullRepaint; } #if ENABLE(REQUEST_ANIMATION_FRAME) - void serviceScriptedAnimations(double monotonicAnimationStartTime); + void serviceScriptedAnimations(DOMTimeStamp); #endif #if USE(ACCELERATED_COMPOSITING) void updateCompositingLayersAfterStyleChange(); void updateCompositingLayersAfterLayout(); - bool flushCompositingStateForThisFrame(Frame* rootFrameForFlush); + bool syncCompositingStateForThisFrame(Frame* rootFrameForSync); void clearBackingStores(); void restoreBackingStores(); @@ -131,10 +131,6 @@ public: void setNeedsOneShotDrawingSynchronization(); virtual TiledBacking* tiledBacking() OVERRIDE; - - // In the future when any ScrollableArea can have a node in th ScrollingTree, this should - // become a virtual function on ScrollableArea. - uint64_t scrollLayerID() const; #endif bool hasCompositedContent() const; @@ -144,8 +140,8 @@ public: bool isEnclosedInCompositingLayer() const; // Only used with accelerated compositing, but outside the #ifdef to make linkage easier. - // Returns true if the flush was completed. - bool flushCompositingStateIncludingSubframes(); + // Returns true if the sync was completed. + bool syncCompositingStateIncludingSubframes(); // Returns true when a paint with the PaintBehaviorFlattenCompositingLayers flag set gives // a faithful representation of the content. @@ -180,7 +176,7 @@ public: virtual IntRect windowResizerRect() const; virtual void setFixedVisibleContentRect(const IntRect&) OVERRIDE; - virtual void setScrollPosition(const IntPoint&) OVERRIDE; + void setScrollPosition(const IntPoint&); void scrollPositionChangedViaPlatformWidget(); virtual void repaintFixedElementsAfterScrolling(); virtual void updateFixedElementsAfterScrolling(); @@ -226,7 +222,7 @@ public: bool repaintsDisabled() { return m_disableRepaints > 0; } #if ENABLE(DASHBOARD_SUPPORT) || ENABLE(WIDGET_REGION) - void updateAnnotatedRegions(); + void updateDashboardRegions(); #endif void updateControlTints(); @@ -364,9 +360,6 @@ public: // distinguish between the two. const Pagination& pagination() const; void setPagination(const Pagination&); - - bool inProgrammaticScroll() const { return m_inProgrammaticScroll; } - void setInProgrammaticScroll(bool programmaticScroll) { m_inProgrammaticScroll = programmaticScroll; } protected: virtual bool scrollContentsFastPath(const IntSize& scrollDelta, const IntRect& rectToScroll, const IntRect& clipRect); diff --git a/Source/WebCore/page/GestureTapHighlighter.cpp b/Source/WebCore/page/GestureTapHighlighter.cpp index 56df47c26..bb8f423bc 100644 --- a/Source/WebCore/page/GestureTapHighlighter.cpp +++ b/Source/WebCore/page/GestureTapHighlighter.cpp @@ -93,24 +93,20 @@ inline bool strikes(const LayoutRect& a, const LayoutRect& b) && a.y() <= b.maxY() && b.y() <= a.maxY(); } -inline void shiftXEdgesToContainIfStrikes(LayoutRect& rect, LayoutRect& other, bool isFirst) +inline void shiftXEdgesToContainIfStrikes(LayoutRect& rect, const LayoutRect& other) { if (rect.isEmpty()) return; + LayoutUnit leftSide = rect.x(); + LayoutUnit rightSide = rect.maxX(); - if (other.isEmpty() || !strikes(rect, other)) - return; - - LayoutUnit leftSide = std::min(rect.x(), other.x()); - LayoutUnit rightSide = std::max(rect.maxX(), other.maxX()); - - rect.shiftXEdgeTo(leftSide); - rect.shiftMaxXEdgeTo(rightSide); + if (!other.isEmpty() && strikes(rect, other)) { + leftSide = std::min(leftSide, other.x()); + rightSide = std::max(rightSide, other.maxX()); + } - if (isFirst) - other.shiftMaxXEdgeTo(rightSide); - else - other.shiftXEdgeTo(leftSide); + rect.setX(leftSide); + rect.setWidth(rightSide - leftSide); } inline void addHighlightRect(Path& path, const LayoutRect& rect, const LayoutRect& prev, const LayoutRect& next) @@ -162,38 +158,33 @@ Path absolutePathForRenderer(RenderObject* const o) for (int i = 1; i < end; ++i) mid.uniteIfNonZero(rects.at(i)); - LayoutRect first; - LayoutRect last; + Vector<LayoutRect> drawableRects; + + if (!mid.isEmpty()) + drawableRects.append(mid); // Add the first box, but merge it with the center boxes if it intersects. if (rects.size() && !rects.first().isEmpty()) { - if (!mid.isEmpty() && mid.intersects(rects.first())) - mid.unite(rects.first()); - else { - first = rects.first(); - shiftXEdgesToContainIfStrikes(mid, first, /* isFirst */ true); - } + // Adjust center boxes to boundary of first + if (drawableRects.size()) + shiftXEdgesToContainIfStrikes(drawableRects.last(), rects.first()); + if (drawableRects.size() && drawableRects.last().intersects(rects.first())) + drawableRects.last().unite(rects.first()); + else + drawableRects.prepend(rects.first()); } // Add the last box, but merge it with the center boxes if it intersects. if (rects.size() > 1 && !rects.last().isEmpty()) { // Adjust center boxes to boundary of last - if (!mid.isEmpty() && mid.intersects(rects.last())) - mid.unite(rects.last()); - else { - last = rects.last(); - shiftXEdgesToContainIfStrikes(mid, last, /* isFirst */ false); - } + if (drawableRects.size()) + shiftXEdgesToContainIfStrikes(drawableRects.last(), rects.last()); + if (drawableRects.size() && drawableRects.last().intersects(rects.last())) + drawableRects.last().unite(rects.last()); + else + drawableRects.append(rects.last()); } - Vector<LayoutRect> drawableRects; - if (!first.isEmpty()) - drawableRects.append(first); - if (!mid.isEmpty()) - drawableRects.append(mid); - if (!last.isEmpty()) - drawableRects.append(last); - // Clip the overflow rects if needed, before the ring path is formed to // ensure rounded highlight rects. This clipping has the problem with nested // divs with transforms, which could be resolved by proper Path::intersecting. @@ -208,7 +199,7 @@ Path absolutePathForRenderer(RenderObject* const o) // Check ancestor layers for overflow clip and intersect them. for (; layer; layer = layer->parent()) { - RenderLayerModelObject* layerRenderer = layer->renderer(); + RenderBoxModelObject* layerRenderer = layer->renderer(); if (layerRenderer->hasOverflowClip() && layerRenderer != currentRenderer) { bool containerSkipped = false; diff --git a/Source/WebCore/page/History.idl b/Source/WebCore/page/History.idl index abb245f1d..2c7d7998c 100644 --- a/Source/WebCore/page/History.idl +++ b/Source/WebCore/page/History.idl @@ -23,27 +23,30 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -[ +module window { + + interface [ #if defined(V8_BINDING) && V8_BINDING - CheckSecurity, + CheckSecurity, #endif - JSCustomGetOwnPropertySlotAndDescriptor, - CustomNamedSetter, - JSGenerateIsReachable=ImplFrame, - CustomDeleteProperty, - CustomEnumerateProperty, - OmitConstructor -] interface History { - readonly attribute unsigned long length; - [CachedAttribute, Custom] readonly attribute SerializedScriptValue state; + JSCustomGetOwnPropertySlotAndDescriptor, + CustomNamedSetter, + JSGenerateIsReachable=ImplFrame, + CustomDeleteProperty, + CustomEnumerateProperty, + OmitConstructor + ] History { + readonly attribute unsigned long length; + readonly attribute [CachedAttribute, Custom] SerializedScriptValue state; - [DoNotCheckSecurity, CallWith=ScriptExecutionContext] void back(); - [DoNotCheckSecurity, CallWith=ScriptExecutionContext] void forward(); - [DoNotCheckSecurity, CallWith=ScriptExecutionContext] void go(in [Optional=DefaultIsUndefined] long distance); + [DoNotCheckSecurity, CallWith=ScriptExecutionContext] void back(); + [DoNotCheckSecurity, CallWith=ScriptExecutionContext] void forward(); + [DoNotCheckSecurity, CallWith=ScriptExecutionContext] void go(in [Optional=DefaultIsUndefined] long distance); - [Custom] void pushState(in any data, in DOMString title, in [Optional] DOMString url) - raises(DOMException); - [Custom] void replaceState(in any data, in DOMString title, in [Optional] DOMString url) - raises(DOMException); -}; + [Custom] void pushState(in any data, in DOMString title, in [Optional] DOMString url) + raises(DOMException); + [Custom] void replaceState(in any data, in DOMString title, in [Optional] DOMString url) + raises(DOMException); + }; +} diff --git a/Source/WebCore/page/Location.idl b/Source/WebCore/page/Location.idl index 0707f0758..1bc32a038 100644 --- a/Source/WebCore/page/Location.idl +++ b/Source/WebCore/page/Location.idl @@ -26,48 +26,51 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -[ +module window { + + interface [ #if defined(V8_BINDING) && V8_BINDING - CheckSecurity, + CheckSecurity, #endif - JSCustomGetOwnPropertySlotAndDescriptor, - CustomNamedSetter, - JSGenerateIsReachable=ImplFrame, - CustomDeleteProperty, - CustomEnumerateProperty, - JSCustomDefineOwnProperty, - JSCustomNamedGetterOnPrototype, - JSCustomDefineOwnPropertyOnPrototype, - OmitConstructor -] interface Location { + JSCustomGetOwnPropertySlotAndDescriptor, + CustomNamedSetter, + JSGenerateIsReachable=ImplFrame, + CustomDeleteProperty, + CustomEnumerateProperty, + JSCustomDefineOwnProperty, + JSCustomNamedGetterOnPrototype, + JSCustomDefineOwnPropertyOnPrototype, + OmitConstructor + ] Location { #if !defined(LANGUAGE_CPP) || !LANGUAGE_CPP - [DoNotCheckSecurityOnSetter, CustomSetter, V8Unforgeable] attribute DOMString href; + attribute [DoNotCheckSecurityOnSetter, CustomSetter, V8Unforgeable] DOMString href; #endif - [Custom, V8Unforgeable] void assign(in [Optional=DefaultIsUndefined] DOMString url); - [Custom, V8Unforgeable] void replace(in [Optional=DefaultIsUndefined] DOMString url); - [Custom, V8Unforgeable] void reload(); + [Custom, V8Unforgeable] void assign(in [Optional=DefaultIsUndefined] DOMString url); + [Custom, V8Unforgeable] void replace(in [Optional=DefaultIsUndefined] DOMString url); + [Custom, V8Unforgeable] void reload(); - // URI decomposition attributes + // URI decomposition attributes #if !defined(LANGUAGE_CPP) || !LANGUAGE_CPP - [CustomSetter] attribute DOMString protocol; - [CustomSetter] attribute DOMString host; - [CustomSetter] attribute DOMString hostname; - [CustomSetter] attribute DOMString port; - [CustomSetter] attribute DOMString pathname; - [CustomSetter] attribute DOMString search; - [CustomSetter] attribute DOMString hash; + attribute [CustomSetter] DOMString protocol; + attribute [CustomSetter] DOMString host; + attribute [CustomSetter] DOMString hostname; + attribute [CustomSetter] DOMString port; + attribute [CustomSetter] DOMString pathname; + attribute [CustomSetter] DOMString search; + attribute [CustomSetter] DOMString hash; - readonly attribute DOMString origin; + readonly attribute DOMString origin; #endif - readonly attribute DOMStringList ancestorOrigins; + readonly attribute DOMStringList ancestorOrigins; #if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT - [NotEnumerable, Custom, V8Unforgeable, V8ReadOnly, ImplementedAs=toStringFunction] DOMString toString(); + [NotEnumerable, Custom, V8Unforgeable, V8ReadOnly, ImplementedAs=toStringFunction] DOMString toString(); #endif #if defined(V8_BINDING) && V8_BINDING - [NotEnumerable, Custom, V8Unforgeable, V8ReadOnly] DOMObject valueOf(); + [NotEnumerable, Custom, V8Unforgeable, V8ReadOnly] DOMObject valueOf(); #endif -}; + }; +} diff --git a/Source/WebCore/page/MemoryInfo.idl b/Source/WebCore/page/MemoryInfo.idl index df50b4804..b9149d54d 100644 --- a/Source/WebCore/page/MemoryInfo.idl +++ b/Source/WebCore/page/MemoryInfo.idl @@ -28,13 +28,16 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -[ - OmitConstructor -] interface MemoryInfo { +module window { - readonly attribute unsigned long totalJSHeapSize; - readonly attribute unsigned long usedJSHeapSize; - [JSCustomGetter] readonly attribute unsigned long jsHeapSizeLimit; + interface [ + OmitConstructor + ] MemoryInfo { -}; + readonly attribute unsigned long totalJSHeapSize; + readonly attribute unsigned long usedJSHeapSize; + readonly attribute [JSCustomGetter] unsigned long jsHeapSizeLimit; + }; + +} diff --git a/Source/WebCore/page/Navigator.idl b/Source/WebCore/page/Navigator.idl index 0c676ebe5..3c2af01c9 100644 --- a/Source/WebCore/page/Navigator.idl +++ b/Source/WebCore/page/Navigator.idl @@ -17,27 +17,30 @@ Boston, MA 02110-1301, USA. */ -[ - JSGenerateIsReachable=ImplFrame, - OmitConstructor -] interface Navigator { - readonly attribute DOMString appCodeName; - readonly attribute DOMString appName; - readonly attribute DOMString appVersion; - readonly attribute DOMString language; - readonly attribute DOMString userAgent; - readonly attribute DOMString platform; - readonly attribute DOMPluginArray plugins; - readonly attribute DOMMimeTypeArray mimeTypes; - readonly attribute DOMString product; - readonly attribute DOMString productSub; - readonly attribute DOMString vendor; - readonly attribute DOMString vendorSub; - readonly attribute boolean cookieEnabled; - boolean javaEnabled(); - - readonly attribute boolean onLine; - - void getStorageUpdates(); // FIXME: Remove this method or rename to yieldForStorageUpdates. -}; +module window { + interface [ + JSGenerateIsReachable=ImplFrame, + OmitConstructor + ] Navigator { + readonly attribute DOMString appCodeName; + readonly attribute DOMString appName; + readonly attribute DOMString appVersion; + readonly attribute DOMString language; + readonly attribute DOMString userAgent; + readonly attribute DOMString platform; + readonly attribute DOMPluginArray plugins; + readonly attribute DOMMimeTypeArray mimeTypes; + readonly attribute DOMString product; + readonly attribute DOMString productSub; + readonly attribute DOMString vendor; + readonly attribute DOMString vendorSub; + readonly attribute boolean cookieEnabled; + boolean javaEnabled(); + + readonly attribute boolean onLine; + + void getStorageUpdates(); // FIXME: Remove this method or rename to yieldForStorageUpdates. + }; + +} diff --git a/Source/WebCore/page/Page.cpp b/Source/WebCore/page/Page.cpp index 3df7586e8..1793df15e 100644 --- a/Source/WebCore/page/Page.cpp +++ b/Source/WebCore/page/Page.cpp @@ -72,7 +72,6 @@ #include "StyleResolver.h" #include "TextResourceDecoder.h" #include "VoidCallback.h" -#include "WebCoreMemoryInstrumentation.h" #include "Widget.h" #include <wtf/HashMap.h> #include <wtf/RefCountedLeakCounter.h> @@ -83,7 +82,6 @@ namespace WebCore { static HashSet<Page*>* allPages; -static const double hiddenPageTimerAlignmentInterval = 1.0; // once a second DEFINE_DEBUG_ONLY_GLOBAL(WTF::RefCountedLeakCounter, pageCounter, ("Page")); @@ -136,7 +134,7 @@ Page::Page(PageClients& pageClients) , m_theme(RenderTheme::themeForPage(this)) , m_editorClient(pageClients.editorClient) , m_validationMessageClient(pageClients.validationMessageClient) - , m_subframeCount(0) + , m_frameCount(0) , m_openedByDOM(false) , m_tabKeyCyclesThroughElements(true) , m_defersLoading(false) @@ -158,7 +156,6 @@ Page::Page(PageClients& pageClients) , m_canStartMedia(true) , m_viewMode(ViewModeWindowed) , m_minimumTimerInterval(Settings::defaultMinDOMTimerInterval()) - , m_timerAlignmentInterval(Settings::defaultDOMTimerAlignmentInterval()) , m_isEditable(false) , m_isOnscreen(true) #if ENABLE(PAGE_VISIBILITY_API) @@ -654,7 +651,7 @@ void Page::setPageScaleFactor(float scale, const IntPoint& origin) FrameView* view = document->view(); if (scale == m_pageScaleFactor) { - if (view && (view->scrollPosition() != origin || view->delegatesScrolling())) { + if (view && view->scrollPosition() != origin) { document->updateLayoutIgnorePendingStylesheets(); view->setScrollPosition(origin); } @@ -1028,23 +1025,6 @@ double Page::minimumTimerInterval() const return m_minimumTimerInterval; } -void Page::setTimerAlignmentInterval(double interval) -{ - if (interval == m_timerAlignmentInterval) - return; - - m_timerAlignmentInterval = interval; - for (Frame* frame = mainFrame(); frame; frame = frame->tree()->traverseNextWithWrap(false)) { - if (frame->document()) - frame->document()->didChangeTimerAlignmentInterval(); - } -} - -double Page::timerAlignmentInterval() const -{ - return m_timerAlignmentInterval; -} - void Page::dnsPrefetchingStateChanged() { for (Frame* frame = mainFrame(); frame; frame = frame->tree()->traverseNext()) @@ -1101,22 +1081,21 @@ void Page::privateBrowsingStateChanged() } #if !ASSERT_DISABLED -void Page::checkSubframeCountConsistency() const +void Page::checkFrameCountConsistency() const { - ASSERT(m_subframeCount >= 0); + ASSERT(m_frameCount >= 0); - int subframeCount = 0; + int frameCount = 0; for (Frame* frame = mainFrame(); frame; frame = frame->tree()->traverseNext()) - ++subframeCount; + ++frameCount; - ASSERT(m_subframeCount + 1 == subframeCount); + ASSERT(m_frameCount + 1 == frameCount); } #endif -#if ENABLE(PAGE_VISIBILITY_API) || ENABLE(HIDDEN_PAGE_DOM_TIMER_THROTTLING) +#if ENABLE(PAGE_VISIBILITY_API) void Page::setVisibilityState(PageVisibilityState visibilityState, bool isInitialState) { -#if ENABLE(PAGE_VISIBILITY_API) if (m_visibilityState == visibilityState) return; m_visibilityState = visibilityState; @@ -1129,21 +1108,8 @@ void Page::setVisibilityState(PageVisibilityState visibilityState, bool isInitia } m_mainFrame->dispatchVisibilityStateChangeEvent(); } -#endif - -#if ENABLE(HIDDEN_PAGE_DOM_TIMER_THROTTLING) - if (visibilityState == WebCore::PageVisibilityStateHidden) - setTimerAlignmentInterval(hiddenPageTimerAlignmentInterval); - else - setTimerAlignmentInterval(Settings::defaultDOMTimerAlignmentInterval()); -#if !ENABLE(PAGE_VISIBILITY_API) - UNUSED_PARAM(isInitialState); -#endif -#endif } -#endif // ENABLE(PAGE_VISIBILITY_API) || ENABLE(HIDDEN_PAGE_DOM_TIMER_THROTTLING) -#if ENABLE(PAGE_VISIBILITY_API) PageVisibilityState Page::visibilityState() const { return m_visibilityState; @@ -1267,49 +1233,6 @@ void Page::resetSeenPlugins() m_seenPlugins.clear(); } -void Page::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const -{ - MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::Page); - info.addMember(m_chrome); - info.addMember(m_dragCaretController); - -#if ENABLE(DRAG_SUPPORT) - info.addMember(m_dragController); -#endif - info.addMember(m_focusController); -#if ENABLE(CONTEXT_MENUS) - info.addMember(m_contextMenuController); -#endif -#if ENABLE(INSPECTOR) - info.addMember(m_inspectorController); -#endif -#if ENABLE(POINTER_LOCK) - info.addMember(m_pointerLockController); -#endif - info.addMember(m_scrollingCoordinator); - info.addMember(m_settings); - info.addMember(m_progress); - info.addMember(m_backForwardController); - info.addMember(m_mainFrame); - info.addMember(m_pluginData); - info.addMember(m_theme); - info.addMember(m_editorClient); - info.addMember(m_featureObserver); - info.addMember(m_groupName); - info.addMember(m_pagination); - info.addMember(m_userStyleSheetPath); - info.addMember(m_userStyleSheet); - info.addMember(m_singlePageGroup); - info.addMember(m_group); - info.addWeakPointer(m_debugger); - info.addMember(m_sessionStorage); - info.addMember(m_relevantUnpaintedRenderObjects); - info.addMember(m_relevantPaintedRegion); - info.addMember(m_relevantUnpaintedRegion); - info.addMember(m_alternativeTextClient); - info.addMember(m_seenPlugins); -} - Page::PageClients::PageClients() : alternativeTextClient(0) , chromeClient(0) diff --git a/Source/WebCore/page/Page.h b/Source/WebCore/page/Page.h index 76d9ac7ed..cd6c665b4 100644 --- a/Source/WebCore/page/Page.h +++ b/Source/WebCore/page/Page.h @@ -172,9 +172,9 @@ namespace WebCore { PageGroup& group() { if (!m_group) initGroup(); return *m_group; } PageGroup* groupPtr() { return m_group; } // can return 0 - void incrementSubframeCount() { ++m_subframeCount; } - void decrementSubframeCount() { ASSERT(m_subframeCount); --m_subframeCount; } - int subframeCount() const { checkSubframeCountConsistency(); return m_subframeCount; } + void incrementFrameCount() { ++m_frameCount; } + void decrementFrameCount() { ASSERT(m_frameCount); --m_frameCount; } + int frameCount() const { checkFrameCountConsistency(); return m_frameCount; } Chrome* chrome() const { return m_chrome.get(); } DragCaretController* dragCaretController() const { return m_dragCaretController.get(); } @@ -322,8 +322,6 @@ namespace WebCore { #if ENABLE(PAGE_VISIBILITY_API) PageVisibilityState visibilityState() const; -#endif -#if ENABLE(PAGE_VISIBILITY_API) || ENABLE(HIDDEN_PAGE_DOM_TIMER_THROTTLING) void setVisibilityState(PageVisibilityState, bool); #endif @@ -352,15 +350,13 @@ namespace WebCore { void sawPlugin(const String& serviceType); void resetSeenPlugins(); - void reportMemoryUsage(MemoryObjectInfo*) const; - private: void initGroup(); #if ASSERT_DISABLED - void checkSubframeCountConsistency() const { } + void checkFrameCountConsistency() const { } #else - void checkSubframeCountConsistency() const; + void checkFrameCountConsistency() const; #endif MediaCanStartListener* takeAnyMediaCanStartListener(); @@ -368,9 +364,6 @@ namespace WebCore { void setMinimumTimerInterval(double); double minimumTimerInterval() const; - void setTimerAlignmentInterval(double); - double timerAlignmentInterval() const; - void collectPluginViews(Vector<RefPtr<PluginViewBase>, 32>& pluginViewBases); OwnPtr<Chrome> m_chrome; @@ -406,7 +399,7 @@ namespace WebCore { FeatureObserver m_featureObserver; - int m_subframeCount; + int m_frameCount; String m_groupName; bool m_openedByDOM; @@ -449,8 +442,6 @@ namespace WebCore { double m_minimumTimerInterval; - double m_timerAlignmentInterval; - bool m_isEditable; bool m_isOnscreen; diff --git a/Source/WebCore/page/PageGroup.cpp b/Source/WebCore/page/PageGroup.cpp index 314ed1419..0fed49138 100644 --- a/Source/WebCore/page/PageGroup.cpp +++ b/Source/WebCore/page/PageGroup.cpp @@ -94,12 +94,12 @@ PageGroup* PageGroup::pageGroup(const String& groupName) PageGroupMap::AddResult result = pageGroups->add(groupName, 0); if (result.isNewEntry) { - ASSERT(!result.iterator->value); - result.iterator->value = new PageGroup(groupName); + ASSERT(!result.iterator->second); + result.iterator->second = new PageGroup(groupName); } - ASSERT(result.iterator->value); - return result.iterator->value; + ASSERT(result.iterator->second); + return result.iterator->second; } void PageGroup::closeLocalStorage() @@ -110,8 +110,8 @@ void PageGroup::closeLocalStorage() PageGroupMap::iterator end = pageGroups->end(); for (PageGroupMap::iterator it = pageGroups->begin(); it != end; ++it) { - if (it->value->hasLocalStorage()) - it->value->localStorage()->close(); + if (it->second->hasLocalStorage()) + it->second->localStorage()->close(); } } @@ -122,8 +122,8 @@ void PageGroup::clearLocalStorageForAllOrigins() PageGroupMap::iterator end = pageGroups->end(); for (PageGroupMap::iterator it = pageGroups->begin(); it != end; ++it) { - if (it->value->hasLocalStorage()) - it->value->localStorage()->clearAllOriginsForDeletion(); + if (it->second->hasLocalStorage()) + it->second->localStorage()->clearAllOriginsForDeletion(); } } @@ -134,8 +134,8 @@ void PageGroup::clearLocalStorageForOrigin(SecurityOrigin* origin) PageGroupMap::iterator end = pageGroups->end(); for (PageGroupMap::iterator it = pageGroups->begin(); it != end; ++it) { - if (it->value->hasLocalStorage()) - it->value->localStorage()->clearOriginForDeletion(origin); + if (it->second->hasLocalStorage()) + it->second->localStorage()->clearOriginForDeletion(origin); } } @@ -146,8 +146,8 @@ void PageGroup::syncLocalStorage() PageGroupMap::iterator end = pageGroups->end(); for (PageGroupMap::iterator it = pageGroups->begin(); it != end; ++it) { - if (it->value->hasLocalStorage()) - it->value->localStorage()->sync(); + if (it->second->hasLocalStorage()) + it->second->localStorage()->sync(); } } @@ -262,7 +262,7 @@ StorageNamespace* PageGroup::localStorage() } void PageGroup::addUserScriptToWorld(DOMWrapperWorld* world, const String& source, const KURL& url, - const Vector<String>& whitelist, const Vector<String>& blacklist, + PassOwnPtr<Vector<String> > whitelist, PassOwnPtr<Vector<String> > blacklist, UserScriptInjectionTime injectionTime, UserContentInjectedFrames injectedFrames) { ASSERT_ARG(world, world); @@ -270,14 +270,14 @@ void PageGroup::addUserScriptToWorld(DOMWrapperWorld* world, const String& sourc OwnPtr<UserScript> userScript = adoptPtr(new UserScript(source, url, whitelist, blacklist, injectionTime, injectedFrames)); if (!m_userScripts) m_userScripts = adoptPtr(new UserScriptMap); - OwnPtr<UserScriptVector>& scriptsInWorld = m_userScripts->add(world, nullptr).iterator->value; + OwnPtr<UserScriptVector>& scriptsInWorld = m_userScripts->add(world, nullptr).iterator->second; if (!scriptsInWorld) scriptsInWorld = adoptPtr(new UserScriptVector); scriptsInWorld->append(userScript.release()); } void PageGroup::addUserStyleSheetToWorld(DOMWrapperWorld* world, const String& source, const KURL& url, - const Vector<String>& whitelist, const Vector<String>& blacklist, + PassOwnPtr<Vector<String> > whitelist, PassOwnPtr<Vector<String> > blacklist, UserContentInjectedFrames injectedFrames, UserStyleLevel level, UserStyleInjectionTime injectionTime) @@ -287,7 +287,7 @@ void PageGroup::addUserStyleSheetToWorld(DOMWrapperWorld* world, const String& s OwnPtr<UserStyleSheet> userStyleSheet = adoptPtr(new UserStyleSheet(source, url, whitelist, blacklist, injectedFrames, level)); if (!m_userStyleSheets) m_userStyleSheets = adoptPtr(new UserStyleSheetMap); - OwnPtr<UserStyleSheetVector>& styleSheetsInWorld = m_userStyleSheets->add(world, nullptr).iterator->value; + OwnPtr<UserStyleSheetVector>& styleSheetsInWorld = m_userStyleSheets->add(world, nullptr).iterator->second; if (!styleSheetsInWorld) styleSheetsInWorld = adoptPtr(new UserStyleSheetVector); styleSheetsInWorld->append(userStyleSheet.release()); @@ -307,7 +307,7 @@ void PageGroup::removeUserScriptFromWorld(DOMWrapperWorld* world, const KURL& ur if (it == m_userScripts->end()) return; - UserScriptVector* scripts = it->value.get(); + UserScriptVector* scripts = it->second.get(); for (int i = scripts->size() - 1; i >= 0; --i) { if (scripts->at(i)->url() == url) scripts->remove(i); @@ -329,7 +329,7 @@ void PageGroup::removeUserStyleSheetFromWorld(DOMWrapperWorld* world, const KURL if (it == m_userStyleSheets->end()) return; - UserStyleSheetVector* stylesheets = it->value.get(); + UserStyleSheetVector* stylesheets = it->second.get(); for (int i = stylesheets->size() - 1; i >= 0; --i) { if (stylesheets->at(i)->url() == url) { stylesheets->remove(i); diff --git a/Source/WebCore/page/PageGroup.h b/Source/WebCore/page/PageGroup.h index 7d2ddfaf1..98c51dd59 100644 --- a/Source/WebCore/page/PageGroup.h +++ b/Source/WebCore/page/PageGroup.h @@ -83,10 +83,10 @@ namespace WebCore { bool hasLocalStorage() { return m_localStorage; } void addUserScriptToWorld(DOMWrapperWorld*, const String& source, const KURL&, - const Vector<String>& whitelist, const Vector<String>& blacklist, + PassOwnPtr<Vector<String> > whitelist, PassOwnPtr<Vector<String> > blacklist, UserScriptInjectionTime, UserContentInjectedFrames); void addUserStyleSheetToWorld(DOMWrapperWorld*, const String& source, const KURL&, - const Vector<String>& whitelist, const Vector<String>& blacklist, + PassOwnPtr<Vector<String> > whitelist, PassOwnPtr<Vector<String> > blacklist, UserContentInjectedFrames, UserStyleLevel level = UserStyleUserLevel, UserStyleInjectionTime injectionTime = InjectInExistingDocuments); diff --git a/Source/WebCore/page/PagePopupClient.cpp b/Source/WebCore/page/PagePopupClient.cpp index 7dab828b7..5b666ea45 100644 --- a/Source/WebCore/page/PagePopupClient.cpp +++ b/Source/WebCore/page/PagePopupClient.cpp @@ -61,14 +61,6 @@ void PagePopupClient::addProperty(const char* name, const String& value, Documen addLiteral(",\n", writer); } -void PagePopupClient::addProperty(const char* name, int value, DocumentWriter& writer) -{ - writer.addData(name, strlen(name)); - addLiteral(": ", writer); - addString(String::number(value), writer); - addLiteral(",\n", writer); -} - void PagePopupClient::addProperty(const char* name, unsigned value, DocumentWriter& writer) { writer.addData(name, strlen(name)); @@ -100,17 +92,6 @@ void PagePopupClient::addProperty(const char* name, const Vector<String>& values addLiteral("],\n", writer); } -void PagePopupClient::addProperty(const char* name, const IntRect& rect, DocumentWriter& writer) -{ - writer.addData(name, strlen(name)); - addLiteral(": {", writer); - addProperty("x", rect.x(), writer); - addProperty("y", rect.y(), writer); - addProperty("width", rect.width(), writer); - addProperty("height", rect.height(), writer); - addLiteral("},\n", writer); -} - } // namespace WebCore #endif // ENABLE(PAGE_POPUP) diff --git a/Source/WebCore/page/PagePopupClient.h b/Source/WebCore/page/PagePopupClient.h index d0fb4bb56..02aee3225 100644 --- a/Source/WebCore/page/PagePopupClient.h +++ b/Source/WebCore/page/PagePopupClient.h @@ -34,13 +34,12 @@ #if ENABLE(PAGE_POPUP) #include "DocumentWriter.h" -#include "IntRect.h" +#include "IntSize.h" #include <wtf/text/WTFString.h> namespace WebCore { class DocumentWriter; -class Localizer; class PagePopupClient { public: @@ -53,9 +52,6 @@ public: // - window.setValueAndClosePopup(number, string). virtual void writeDocument(DocumentWriter&) = 0; - // Returns a Localizer object associated to the client. - virtual Localizer& localizer() = 0; - // This is called by the content HTML of a PagePopup. // An implementation of this function should call ChromeClient::closePagePopup(). virtual void setValueAndClosePopup(int numValue, const String& stringValue) = 0; @@ -69,11 +65,9 @@ public: static void addString(const String&, DocumentWriter&); static void addJavaScriptString(const String&, DocumentWriter&); static void addProperty(const char* name, const String& value, DocumentWriter&); - static void addProperty(const char* name, int value, DocumentWriter&); static void addProperty(const char* name, unsigned value, DocumentWriter&); static void addProperty(const char* name, bool value, DocumentWriter&); static void addProperty(const char* name, const Vector<String>& values, DocumentWriter&); - static void addProperty(const char* name, const IntRect&, DocumentWriter&); }; inline void PagePopupClient::addString(const String& str, DocumentWriter& writer) diff --git a/Source/WebCore/page/PagePopupController.cpp b/Source/WebCore/page/PagePopupController.cpp index 24e4b349e..8ee36536b 100644 --- a/Source/WebCore/page/PagePopupController.cpp +++ b/Source/WebCore/page/PagePopupController.cpp @@ -32,7 +32,7 @@ #include "PagePopupController.h" #if ENABLE(PAGE_POPUP) -#include "Localizer.h" +#include "LocalizedNumber.h" #include "PagePopupClient.h" namespace WebCore { @@ -55,7 +55,7 @@ void PagePopupController::setValueAndClosePopup(int numValue, const String& stri String PagePopupController::localizeNumberString(const String& numberString) { - return m_popupClient->localizer().convertToLocalizedNumber(numberString); + return convertToLocalizedNumber(numberString); } } diff --git a/Source/WebCore/page/PagePopupController.idl b/Source/WebCore/page/PagePopupController.idl index b2350bfec..d0669efe5 100644 --- a/Source/WebCore/page/PagePopupController.idl +++ b/Source/WebCore/page/PagePopupController.idl @@ -28,9 +28,11 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -[ - Conditional=PAGE_POPUP -] interface PagePopupController { - void setValueAndClosePopup(in long numberValue, in DOMString stringValue); - DOMString localizeNumberString(in DOMString numberString); -}; +module window { + interface [ + Conditional=PAGE_POPUP + ] PagePopupController { + void setValueAndClosePopup(in long numberValue, in DOMString stringValue); + DOMString localizeNumberString(in DOMString numberString); + }; +} diff --git a/Source/WebCore/page/PageSerializer.cpp b/Source/WebCore/page/PageSerializer.cpp index 23aadb32f..c911d54a9 100644 --- a/Source/WebCore/page/PageSerializer.cpp +++ b/Source/WebCore/page/PageSerializer.cpp @@ -267,7 +267,7 @@ void PageSerializer::serializeCSSStyleSheet(CSSStyleSheet* styleSheet, const KUR Document* document = styleSheet->ownerDocument(); // Some rules have resources associated with them that we need to retrieve. if (rule->isImportRule()) { - CSSImportRule* importRule = static_cast<CSSImportRule*>(rule); + CSSImportRule* importRule = static_cast<CSSImportRule*>(rule); KURL importURL = document->completeURL(importRule->href()); if (m_resourceURLs.contains(importURL)) continue; @@ -298,14 +298,8 @@ void PageSerializer::addImageToResources(CachedImage* image, RenderObject* image if (!image || image->image() == Image::nullImage()) return; - RefPtr<SharedBuffer> data = imageRenderer ? image->imageForRenderer(imageRenderer)->data() : image->image()->data(); - if (!data) { - // SVG images don't return data at this point. Bug 99102. - LOG_ERROR("No data for image %s", url.string().utf8().data()); - return; - } String mimeType = image->response().mimeType(); - m_resources->append(Resource(url, mimeType, data)); + m_resources->append(Resource(url, mimeType, imageRenderer ? image->imageForRenderer(imageRenderer)->data() : image->image()->data())); m_resourceURLs.add(url); } @@ -345,7 +339,7 @@ KURL PageSerializer::urlForBlankFrame(Frame* frame) { HashMap<Frame*, KURL>::iterator iter = m_blankFrameURLs.find(frame); if (iter != m_blankFrameURLs.end()) - return iter->value; + return iter->second; String url = "wyciwyg://frame/" + String::number(m_blankFrameCounter++); KURL fakeURL(ParsedURLString, url); m_blankFrameURLs.add(frame, fakeURL); diff --git a/Source/WebCore/page/Performance.cpp b/Source/WebCore/page/Performance.cpp index bff1b5361..903393021 100644 --- a/Source/WebCore/page/Performance.cpp +++ b/Source/WebCore/page/Performance.cpp @@ -165,9 +165,9 @@ EventTargetData* Performance::ensureEventTargetData() return &m_eventTargetData; } -double Performance::now() const +double Performance::webkitNow() const { - return 1000.0 * m_frame->document()->loader()->timing()->monotonicTimeToZeroBasedDocumentTime(monotonicallyIncreasingTime()); + return 1000.0 * m_frame->document()->loader()->timing()->convertMonotonicTimeToZeroBasedDocumentTime(monotonicallyIncreasingTime()); } } // namespace WebCore diff --git a/Source/WebCore/page/Performance.h b/Source/WebCore/page/Performance.h index 7c270ce0d..8ba8c5eea 100644 --- a/Source/WebCore/page/Performance.h +++ b/Source/WebCore/page/Performance.h @@ -61,7 +61,7 @@ public: PassRefPtr<MemoryInfo> memory() const; PerformanceNavigation* navigation() const; PerformanceTiming* timing() const; - double now() const; + double webkitNow() const; #if ENABLE(PERFORMANCE_TIMELINE) PassRefPtr<PerformanceEntryList> webkitGetEntries() const; diff --git a/Source/WebCore/page/Performance.idl b/Source/WebCore/page/Performance.idl index c32cf328e..fc9ffdf1f 100644 --- a/Source/WebCore/page/Performance.idl +++ b/Source/WebCore/page/Performance.idl @@ -28,29 +28,32 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -// See: http://dev.w3.org/2006/webapi/WebTiming/ -[ - Conditional=WEB_TIMING, - EventTarget, - OmitConstructor -] interface Performance { - readonly attribute PerformanceNavigation navigation; - readonly attribute PerformanceTiming timing; - [V8CustomGetter] readonly attribute MemoryInfo memory; +module window { + + // See: http://dev.w3.org/2006/webapi/WebTiming/ + interface [ + Conditional=WEB_TIMING, + EventTarget, + OmitConstructor + ] Performance { + readonly attribute PerformanceNavigation navigation; + readonly attribute PerformanceTiming timing; + readonly attribute [V8CustomGetter] MemoryInfo memory; #if defined(ENABLE_PERFORMANCE_TIMELINE) && ENABLE_PERFORMANCE_TIMELINE - PerformanceEntryList webkitGetEntries(); - PerformanceEntryList webkitGetEntriesByType(in DOMString entryType); - PerformanceEntryList webkitGetEntriesByName(in DOMString name, in [Optional=DefaultIsNullString] DOMString entryType); + PerformanceEntryList webkitGetEntries(); + PerformanceEntryList webkitGetEntriesByType(in DOMString entryType); + PerformanceEntryList webkitGetEntriesByName(in DOMString name, in [Optional=DefaultIsNullString] DOMString entryType); #endif #if defined(ENABLE_RESOURCE_TIMING) && ENABLE_RESOURCE_TIMING - void webkitClearResourceTimings(); - void webkitSetResourceTimingBufferSize(in unsigned long maxSize); + void webkitClearResourceTimings(); + void webkitSetResourceTimingBufferSize(in unsigned long maxSize); - attribute EventListener onwebkitresourcetimingbufferfull; + attribute EventListener onwebkitresourcetimingbufferfull; #endif - // See http://www.w3.org/TR/hr-time/ for details. - double now(); -}; + // See http://www.w3.org/TR/hr-time/ for details. + double webkitNow(); + }; +} diff --git a/Source/WebCore/page/PerformanceEntry.idl b/Source/WebCore/page/PerformanceEntry.idl index ff38ded7c..9e10fe0bf 100644 --- a/Source/WebCore/page/PerformanceEntry.idl +++ b/Source/WebCore/page/PerformanceEntry.idl @@ -28,15 +28,18 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -// See: https://dvcs.w3.org/hg/webperf/raw-file/tip/specs/PerformanceTimeline/Overview.html -[ - Conditional=WEB_TIMING, - Conditional=PERFORMANCE_TIMELINE, - CustomToJSObject, - OmitConstructor -] interface PerformanceEntry { - readonly attribute DOMString name; - readonly attribute DOMString entryType; - readonly attribute double startTime; - readonly attribute double duration; -}; +module window { + + // See: https://dvcs.w3.org/hg/webperf/raw-file/tip/specs/PerformanceTimeline/Overview.html + interface [ + Conditional=WEB_TIMING, + Conditional=PERFORMANCE_TIMELINE, + CustomToJSObject, + OmitConstructor + ] PerformanceEntry { + readonly attribute DOMString name; + readonly attribute DOMString entryType; + readonly attribute double startTime; + readonly attribute double duration; + }; +} diff --git a/Source/WebCore/page/PerformanceEntryList.idl b/Source/WebCore/page/PerformanceEntryList.idl index 9226541c8..8be43d576 100644 --- a/Source/WebCore/page/PerformanceEntryList.idl +++ b/Source/WebCore/page/PerformanceEntryList.idl @@ -28,14 +28,17 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -// See: https://dvcs.w3.org/hg/webperf/raw-file/tip/specs/PerformanceTimeline/Overview.html -[ - Conditional=WEB_TIMING, - Conditional=PERFORMANCE_TIMELINE, - OmitConstructor, - IndexedGetter -] interface PerformanceEntryList { - readonly attribute unsigned long length; - PerformanceEntry item(in unsigned long index); -}; +module window { + // See: https://dvcs.w3.org/hg/webperf/raw-file/tip/specs/PerformanceTimeline/Overview.html + interface [ + Conditional=WEB_TIMING, + Conditional=PERFORMANCE_TIMELINE, + OmitConstructor, + IndexedGetter + ] PerformanceEntryList { + readonly attribute unsigned long length; + PerformanceEntry item(in unsigned long index); + }; + +} diff --git a/Source/WebCore/page/PerformanceNavigation.idl b/Source/WebCore/page/PerformanceNavigation.idl index e9add4cb5..4c6b612ef 100644 --- a/Source/WebCore/page/PerformanceNavigation.idl +++ b/Source/WebCore/page/PerformanceNavigation.idl @@ -28,17 +28,20 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -// See: http://www.w3.org/TR/navigation-timing/ -[ - Conditional=WEB_TIMING, - OmitConstructor -] interface PerformanceNavigation { - const unsigned short TYPE_NAVIGATE = 0; - const unsigned short TYPE_RELOAD = 1; - const unsigned short TYPE_BACK_FORWARD = 2; - const unsigned short TYPE_RESERVED = 255; - readonly attribute unsigned short type; +module window { - readonly attribute unsigned short redirectCount; -}; + // See: http://www.w3.org/TR/navigation-timing/ + interface [ + Conditional=WEB_TIMING, + OmitConstructor + ] PerformanceNavigation { + const unsigned short TYPE_NAVIGATE = 0; + const unsigned short TYPE_RELOAD = 1; + const unsigned short TYPE_BACK_FORWARD = 2; + const unsigned short TYPE_RESERVED = 255; + readonly attribute unsigned short type; + readonly attribute unsigned short redirectCount; + }; + +} diff --git a/Source/WebCore/page/PerformanceResourceTiming.idl b/Source/WebCore/page/PerformanceResourceTiming.idl index b5d6053b2..3e0ad59ce 100644 --- a/Source/WebCore/page/PerformanceResourceTiming.idl +++ b/Source/WebCore/page/PerformanceResourceTiming.idl @@ -28,22 +28,25 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -// See: https://dvcs.w3.org/hg/webperf/raw-file/tip/specs/ResourceTiming/Overview.html -[ - Conditional=RESOURCE_TIMING, - OmitConstructor -] interface PerformanceResourceTiming : PerformanceEntry { - readonly attribute DOMString initiatorType; +module window { - readonly attribute double redirectStart; - readonly attribute double redirectEnd; - readonly attribute double fetchStart; - readonly attribute double domainLookupStart; - readonly attribute double domainLookupEnd; - readonly attribute double connectStart; - readonly attribute double connectEnd; - readonly attribute double secureConnectionStart; - readonly attribute double requestStart; - readonly attribute double responseStart; - readonly attribute double responseEnd; -}; + // See: https://dvcs.w3.org/hg/webperf/raw-file/tip/specs/ResourceTiming/Overview.html + interface [ + Conditional=RESOURCE_TIMING, + OmitConstructor + ] PerformanceResourceTiming : PerformanceEntry { + readonly attribute DOMString initiatorType; + + readonly attribute double redirectStart; + readonly attribute double redirectEnd; + readonly attribute double fetchStart; + readonly attribute double domainLookupStart; + readonly attribute double domainLookupEnd; + readonly attribute double connectStart; + readonly attribute double connectEnd; + readonly attribute double secureConnectionStart; + readonly attribute double requestStart; + readonly attribute double responseStart; + readonly attribute double responseEnd; + }; +} diff --git a/Source/WebCore/page/PerformanceTiming.cpp b/Source/WebCore/page/PerformanceTiming.cpp index 4a0c0bd74..6a4524b09 100644 --- a/Source/WebCore/page/PerformanceTiming.cpp +++ b/Source/WebCore/page/PerformanceTiming.cpp @@ -61,7 +61,7 @@ unsigned long long PerformanceTiming::navigationStart() const if (!timing) return 0; - return monotonicTimeToIntegerMilliseconds(timing->navigationStart()); + return toIntegerMilliseconds(timing->navigationStart()); } unsigned long long PerformanceTiming::unloadEventStart() const @@ -73,7 +73,7 @@ unsigned long long PerformanceTiming::unloadEventStart() const if (timing->hasCrossOriginRedirect() || !timing->hasSameOriginAsPreviousDocument()) return 0; - return monotonicTimeToIntegerMilliseconds(timing->unloadEventStart()); + return toIntegerMilliseconds(timing->unloadEventStart()); } unsigned long long PerformanceTiming::unloadEventEnd() const @@ -85,7 +85,7 @@ unsigned long long PerformanceTiming::unloadEventEnd() const if (timing->hasCrossOriginRedirect() || !timing->hasSameOriginAsPreviousDocument()) return 0; - return monotonicTimeToIntegerMilliseconds(timing->unloadEventEnd()); + return toIntegerMilliseconds(timing->unloadEventEnd()); } unsigned long long PerformanceTiming::redirectStart() const @@ -97,7 +97,7 @@ unsigned long long PerformanceTiming::redirectStart() const if (timing->hasCrossOriginRedirect()) return 0; - return monotonicTimeToIntegerMilliseconds(timing->redirectStart()); + return toIntegerMilliseconds(timing->redirectStart()); } unsigned long long PerformanceTiming::redirectEnd() const @@ -109,7 +109,7 @@ unsigned long long PerformanceTiming::redirectEnd() const if (timing->hasCrossOriginRedirect()) return 0; - return monotonicTimeToIntegerMilliseconds(timing->redirectEnd()); + return toIntegerMilliseconds(timing->redirectEnd()); } unsigned long long PerformanceTiming::fetchStart() const @@ -118,7 +118,7 @@ unsigned long long PerformanceTiming::fetchStart() const if (!timing) return 0; - return monotonicTimeToIntegerMilliseconds(timing->fetchStart()); + return toIntegerMilliseconds(timing->fetchStart()); } unsigned long long PerformanceTiming::domainLookupStart() const @@ -243,7 +243,7 @@ unsigned long long PerformanceTiming::responseEnd() const if (!timing) return 0; - return monotonicTimeToIntegerMilliseconds(timing->responseEnd()); + return toIntegerMilliseconds(timing->responseEnd()); } unsigned long long PerformanceTiming::domLoading() const @@ -297,7 +297,7 @@ unsigned long long PerformanceTiming::loadEventStart() const if (!timing) return 0; - return monotonicTimeToIntegerMilliseconds(timing->loadEventStart()); + return toIntegerMilliseconds(timing->loadEventStart()); } unsigned long long PerformanceTiming::loadEventEnd() const @@ -306,7 +306,7 @@ unsigned long long PerformanceTiming::loadEventEnd() const if (!timing) return 0; - return monotonicTimeToIntegerMilliseconds(timing->loadEventEnd()); + return toIntegerMilliseconds(timing->loadEventEnd()); } DocumentLoader* PerformanceTiming::documentLoader() const @@ -352,7 +352,7 @@ unsigned long long PerformanceTiming::resourceLoadTimeRelativeToAbsolute(int rel ASSERT(relativeMilliseconds >= 0); ResourceLoadTiming* resourceTiming = resourceLoadTiming(); ASSERT(resourceTiming); - return monotonicTimeToIntegerMilliseconds(resourceTiming->convertResourceLoadTimeToMonotonicTime(relativeMilliseconds)); + return toIntegerMilliseconds(resourceTiming->convertResourceLoadTimeToDocumentTime(documentLoadTiming(), relativeMilliseconds)); } unsigned long long PerformanceTiming::monotonicTimeToIntegerMilliseconds(double monotonicSeconds) const @@ -360,7 +360,7 @@ unsigned long long PerformanceTiming::monotonicTimeToIntegerMilliseconds(double ASSERT(monotonicSeconds >= 0); const DocumentLoadTiming* timing = documentLoadTiming(); ASSERT(timing); - return toIntegerMilliseconds(timing->monotonicTimeToPseudoWallTime(monotonicSeconds)); + return toIntegerMilliseconds(timing->convertMonotonicTimeToDocumentTime(monotonicSeconds)); } } // namespace WebCore diff --git a/Source/WebCore/page/PerformanceTiming.idl b/Source/WebCore/page/PerformanceTiming.idl index ea823aa82..3e14f7c44 100644 --- a/Source/WebCore/page/PerformanceTiming.idl +++ b/Source/WebCore/page/PerformanceTiming.idl @@ -28,31 +28,34 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -// See: http://dev.w3.org/2006/webapi/WebTiming/ -[ - Conditional=WEB_TIMING, - OmitConstructor -] interface PerformanceTiming { - readonly attribute unsigned long long navigationStart; - readonly attribute unsigned long long unloadEventStart; - readonly attribute unsigned long long unloadEventEnd; - readonly attribute unsigned long long redirectStart; - readonly attribute unsigned long long redirectEnd; - readonly attribute unsigned long long fetchStart; - readonly attribute unsigned long long domainLookupStart; - readonly attribute unsigned long long domainLookupEnd; - readonly attribute unsigned long long connectStart; - readonly attribute unsigned long long connectEnd; - readonly attribute unsigned long long secureConnectionStart; - readonly attribute unsigned long long requestStart; - readonly attribute unsigned long long responseStart; - readonly attribute unsigned long long responseEnd; - readonly attribute unsigned long long domLoading; - readonly attribute unsigned long long domInteractive; - readonly attribute unsigned long long domContentLoadedEventStart; - readonly attribute unsigned long long domContentLoadedEventEnd; - readonly attribute unsigned long long domComplete; - readonly attribute unsigned long long loadEventStart; - readonly attribute unsigned long long loadEventEnd; -}; +module window { + // See: http://dev.w3.org/2006/webapi/WebTiming/ + interface [ + Conditional=WEB_TIMING, + OmitConstructor + ] PerformanceTiming { + readonly attribute unsigned long long navigationStart; + readonly attribute unsigned long long unloadEventStart; + readonly attribute unsigned long long unloadEventEnd; + readonly attribute unsigned long long redirectStart; + readonly attribute unsigned long long redirectEnd; + readonly attribute unsigned long long fetchStart; + readonly attribute unsigned long long domainLookupStart; + readonly attribute unsigned long long domainLookupEnd; + readonly attribute unsigned long long connectStart; + readonly attribute unsigned long long connectEnd; + readonly attribute unsigned long long secureConnectionStart; + readonly attribute unsigned long long requestStart; + readonly attribute unsigned long long responseStart; + readonly attribute unsigned long long responseEnd; + readonly attribute unsigned long long domLoading; + readonly attribute unsigned long long domInteractive; + readonly attribute unsigned long long domContentLoadedEventStart; + readonly attribute unsigned long long domContentLoadedEventEnd; + readonly attribute unsigned long long domComplete; + readonly attribute unsigned long long loadEventStart; + readonly attribute unsigned long long loadEventEnd; + }; + +} diff --git a/Source/WebCore/page/Screen.idl b/Source/WebCore/page/Screen.idl index ee3cc30ae..588060914 100644 --- a/Source/WebCore/page/Screen.idl +++ b/Source/WebCore/page/Screen.idl @@ -27,17 +27,20 @@ */ -[ - JSGenerateIsReachable=ImplFrame, - OmitConstructor -] interface Screen { - readonly attribute unsigned long height; - readonly attribute unsigned long width; - readonly attribute unsigned long colorDepth; - readonly attribute unsigned long pixelDepth; - readonly attribute long availLeft; - readonly attribute long availTop; - readonly attribute unsigned long availHeight; - readonly attribute unsigned long availWidth; -}; +module window { + interface [ + JSGenerateIsReachable=ImplFrame, + OmitConstructor + ] Screen { + readonly attribute unsigned long height; + readonly attribute unsigned long width; + readonly attribute unsigned long colorDepth; + readonly attribute unsigned long pixelDepth; + readonly attribute long availLeft; + readonly attribute long availTop; + readonly attribute unsigned long availHeight; + readonly attribute unsigned long availWidth; + }; + +} diff --git a/Source/WebCore/page/SecurityOrigin.cpp b/Source/WebCore/page/SecurityOrigin.cpp index d53750a17..da15021bd 100644 --- a/Source/WebCore/page/SecurityOrigin.cpp +++ b/Source/WebCore/page/SecurityOrigin.cpp @@ -427,6 +427,11 @@ void SecurityOrigin::grantLoadLocalResources() // is a security hazard because the documents without the privilege can // obtain the privilege by injecting script into the documents that have // been granted the privilege. + // + // To be backwards compatible with older versions of WebKit, we also use + // this function to grant the ability to load local resources to documents + // loaded with SubstituteData. + ASSERT(isUnique() || SecurityPolicy::allowSubstituteDataAccessToLocal()); m_canLoadLocalResources = true; } diff --git a/Source/WebCore/page/SecurityPolicy.cpp b/Source/WebCore/page/SecurityPolicy.cpp index 5b36f4f71..c2a5ab114 100644 --- a/Source/WebCore/page/SecurityPolicy.cpp +++ b/Source/WebCore/page/SecurityPolicy.cpp @@ -133,9 +133,9 @@ void SecurityPolicy::addOriginAccessWhitelistEntry(const SecurityOrigin& sourceO String sourceString = sourceOrigin.toString(); OriginAccessMap::AddResult result = originAccessMap().add(sourceString, nullptr); if (result.isNewEntry) - result.iterator->value = adoptPtr(new OriginAccessWhiteList); + result.iterator->second = adoptPtr(new OriginAccessWhiteList); - OriginAccessWhiteList* list = result.iterator->value.get(); + OriginAccessWhiteList* list = result.iterator->second.get(); list->append(OriginAccessEntry(destinationProtocol, destinationDomain, allowDestinationSubdomains ? OriginAccessEntry::AllowSubdomains : OriginAccessEntry::DisallowSubdomains)); } @@ -152,7 +152,7 @@ void SecurityPolicy::removeOriginAccessWhitelistEntry(const SecurityOrigin& sour if (it == map.end()) return; - OriginAccessWhiteList* list = it->value.get(); + OriginAccessWhiteList* list = it->second.get(); size_t index = list->find(OriginAccessEntry(destinationProtocol, destinationDomain, allowDestinationSubdomains ? OriginAccessEntry::AllowSubdomains : OriginAccessEntry::DisallowSubdomains)); if (index == notFound) return; diff --git a/Source/WebCore/page/Settings.cpp b/Source/WebCore/page/Settings.cpp index 9876af5c7..30666c561 100644 --- a/Source/WebCore/page/Settings.cpp +++ b/Source/WebCore/page/Settings.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All rights reserved. + * Copyright (C) 2006, 2007, 2008, 2009, 2011 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -62,7 +62,7 @@ static inline void setGenericFontFamilyMap(ScriptFontFamilyMap& fontMap, const A if (it == fontMap.end()) return; fontMap.remove(it); - } else if (it != fontMap.end() && it->value == family) + } else if (it != fontMap.end() && it->second == family) return; else fontMap.set(static_cast<int>(script), family); @@ -75,7 +75,7 @@ static inline const AtomicString& getGenericFontFamilyForScript(const ScriptFont { ScriptFontFamilyMap::const_iterator it = fontMap.find(static_cast<int>(script)); if (it != fontMap.end()) - return it->value; + return it->second; if (script != USCRIPT_COMMON) return getGenericFontFamilyForScript(fontMap, USCRIPT_COMMON); return emptyAtom; @@ -293,8 +293,6 @@ Settings::Settings(Page* page) , m_windowFocusRestricted(true) , m_diagnosticLoggingEnabled(false) , m_scrollingPerformanceLoggingEnabled(false) - , m_applyPageScaleFactorInCompositor(false) - , m_plugInSnapshottingEnabled(false) , m_setImageLoadingSettingsTimer(this, &Settings::imageLoadingSettingsTimerFired) , m_incrementalRenderingSuppressionTimeoutInSeconds(defaultIncrementalRenderingSuppressionTimeoutInSeconds) { @@ -683,26 +681,6 @@ double Settings::minDOMTimerInterval() return m_page->minimumTimerInterval(); } -void Settings::setDefaultDOMTimerAlignmentInterval(double interval) -{ - DOMTimer::setDefaultTimerAlignmentInterval(interval); -} - -double Settings::defaultDOMTimerAlignmentInterval() -{ - return DOMTimer::defaultTimerAlignmentInterval(); -} - -void Settings::setDOMTimerAlignmentInterval(double interval) -{ - m_page->setTimerAlignmentInterval(interval); -} - -double Settings::domTimerAlignmentInterval() const -{ - return m_page->timerAlignmentInterval(); -} - void Settings::setUsesPageCache(bool usesPageCache) { if (m_usesPageCache == usesPageCache) diff --git a/Source/WebCore/page/Settings.h b/Source/WebCore/page/Settings.h index 89785d12f..c18dfd730 100644 --- a/Source/WebCore/page/Settings.h +++ b/Source/WebCore/page/Settings.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All rights reserved. + * Copyright (C) 2003, 2006, 2007, 2008, 2009, 2011 Apple Inc. All rights reserved. * (C) 2006 Graham Dennis (graham.dennis@gmail.com) * * Redistribution and use in source and binary forms, with or without @@ -254,12 +254,6 @@ namespace WebCore { void setMinDOMTimerInterval(double); // Per-page; initialized to default value. double minDOMTimerInterval(); - static void setDefaultDOMTimerAlignmentInterval(double); - static double defaultDOMTimerAlignmentInterval(); - - void setDOMTimerAlignmentInterval(double); - double domTimerAlignmentInterval() const; - void setUsesPageCache(bool); bool usesPageCache() const { return m_usesPageCache; } @@ -639,12 +633,6 @@ namespace WebCore { void setDiagnosticLoggingEnabled(bool enabled) { m_diagnosticLoggingEnabled = enabled; } bool diagnosticLoggingEnabled() const { return m_diagnosticLoggingEnabled; } - void setApplyPageScaleFactorInCompositor(bool enabled) { m_applyPageScaleFactorInCompositor = enabled; } - bool applyPageScaleFactorInCompositor() const { return m_applyPageScaleFactorInCompositor; } - - void setPlugInSnapshottingEnabled(bool enabled) { m_plugInSnapshottingEnabled = enabled; } - bool plugInSnapshottingEnabled() const { return m_plugInSnapshottingEnabled; } - private: explicit Settings(Page*); @@ -830,12 +818,9 @@ namespace WebCore { bool m_scrollingPerformanceLoggingEnabled : 1; - bool m_applyPageScaleFactorInCompositor : 1; - bool m_plugInSnapshottingEnabled : 1; - Timer<Settings> m_setImageLoadingSettingsTimer; void imageLoadingSettingsTimerFired(Timer<Settings>*); - + double m_incrementalRenderingSuppressionTimeoutInSeconds; #if USE(AVFOUNDATION) diff --git a/Source/WebCore/page/SpeechInput.cpp b/Source/WebCore/page/SpeechInput.cpp index 8328c5d4d..0128ef8a4 100644 --- a/Source/WebCore/page/SpeechInput.cpp +++ b/Source/WebCore/page/SpeechInput.cpp @@ -62,7 +62,7 @@ int SpeechInput::registerListener(SpeechInputListener* listener) #if defined(DEBUG) // Check if already present. for (HashMap<int, SpeechInputListener*>::iterator it = m_listeners.begin(); it != m_listeners.end(); ++it) - ASSERT(it->value != listener); + ASSERT(it->second != listener); #endif m_listeners.add(m_nextListenerId, listener); diff --git a/Source/WebCore/page/SpeechInputEvent.idl b/Source/WebCore/page/SpeechInputEvent.idl index be82107d1..03846af14 100644 --- a/Source/WebCore/page/SpeechInputEvent.idl +++ b/Source/WebCore/page/SpeechInputEvent.idl @@ -23,9 +23,12 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -[ - Conditional=INPUT_SPEECH, -] interface SpeechInputEvent : Event { - readonly attribute SpeechInputResultList results; -}; +module core { + interface [ + Conditional=INPUT_SPEECH, + ] SpeechInputEvent : Event { + readonly attribute SpeechInputResultList results; + }; + +} diff --git a/Source/WebCore/page/SpeechInputResult.idl b/Source/WebCore/page/SpeechInputResult.idl index ee1727089..3542c6056 100644 --- a/Source/WebCore/page/SpeechInputResult.idl +++ b/Source/WebCore/page/SpeechInputResult.idl @@ -23,10 +23,13 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -[ - Conditional=INPUT_SPEECH, -] interface SpeechInputResult { - readonly attribute DOMString utterance; - readonly attribute float confidence; -}; +module core { + interface [ + Conditional=INPUT_SPEECH, + ] SpeechInputResult { + readonly attribute DOMString utterance; + readonly attribute float confidence; + }; + +} diff --git a/Source/WebCore/page/SpeechInputResultList.idl b/Source/WebCore/page/SpeechInputResultList.idl index 79357cdad..b9213d002 100644 --- a/Source/WebCore/page/SpeechInputResultList.idl +++ b/Source/WebCore/page/SpeechInputResultList.idl @@ -23,11 +23,14 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -[ - IndexedGetter, - Conditional=INPUT_SPEECH -] interface SpeechInputResultList { - readonly attribute unsigned long length; - SpeechInputResult item(in [IsIndex] unsigned long index); -}; +module core { + interface [ + IndexedGetter, + Conditional=INPUT_SPEECH + ] SpeechInputResultList { + readonly attribute unsigned long length; + SpeechInputResult item(in [IsIndex] unsigned long index); + }; + +} diff --git a/Source/WebCore/page/SuspendableTimer.cpp b/Source/WebCore/page/SuspendableTimer.cpp index 15e56280f..dd3e89f18 100644 --- a/Source/WebCore/page/SuspendableTimer.cpp +++ b/Source/WebCore/page/SuspendableTimer.cpp @@ -64,7 +64,7 @@ void SuspendableTimer::suspend(ReasonForSuspension) #endif m_active = isActive(); if (m_active) { - m_nextFireInterval = nextUnalignedFireInterval(); + m_nextFireInterval = nextFireInterval(); m_repeatInterval = repeatInterval(); TimerBase::stop(); } diff --git a/Source/WebCore/page/TouchDisambiguation.cpp b/Source/WebCore/page/TouchDisambiguation.cpp index b582338c2..54319a6a4 100644 --- a/Source/WebCore/page/TouchDisambiguation.cpp +++ b/Source/WebCore/page/TouchDisambiguation.cpp @@ -106,7 +106,7 @@ void findGoodTouchTargets(const IntRect& touchBox, Frame* mainFrame, float pageS if (node->isDocumentNode() || node->hasTagName(HTMLNames::htmlTag) || node->hasTagName(HTMLNames::bodyTag)) break; if (node->willRespondToMouseClickEvents()) { - TouchTargetData& targetData = touchTargets.add(node, TouchTargetData()).iterator->value; + TouchTargetData& targetData = touchTargets.add(node, TouchTargetData()).iterator->second; targetData.windowBoundingBox = boundingBoxForEventNodes(node); targetData.score = scoreTouchTarget(touchPoint, touchPointPadding, targetData.windowBoundingBox); bestScore = max(bestScore, targetData.score); @@ -118,9 +118,9 @@ void findGoodTouchTargets(const IntRect& touchBox, Frame* mainFrame, float pageS for (HashMap<Node*, TouchTargetData>::iterator it = touchTargets.begin(); it != touchTargets.end(); ++it) { // Currently the scoring function uses the overlap area with the fat point as the score. // We ignore the candidates that has less than 1/2 overlap (we consider not really ambiguous enough) than the best candidate to avoid excessive popups. - if (it->value.score < bestScore * 0.5) + if (it->second.score < bestScore * 0.5) continue; - goodTargets.append(it->value.windowBoundingBox); + goodTargets.append(it->second.windowBoundingBox); } } diff --git a/Source/WebCore/page/UserContentURLPattern.cpp b/Source/WebCore/page/UserContentURLPattern.cpp index c7d819b0b..676b65573 100644 --- a/Source/WebCore/page/UserContentURLPattern.cpp +++ b/Source/WebCore/page/UserContentURLPattern.cpp @@ -25,21 +25,19 @@ #include "config.h" #include "UserContentURLPattern.h" - #include "KURL.h" #include <wtf/StdLibExtras.h> namespace WebCore { -bool UserContentURLPattern::matchesPatterns(const KURL& url, const Vector<String>& whitelist, const Vector<String>& blacklist) +bool UserContentURLPattern::matchesPatterns(const KURL& url, const Vector<String>* whitelist, const Vector<String>* blacklist) { // In order for a URL to be a match it has to be present in the whitelist and not present in the blacklist. // If there is no whitelist at all, then all URLs are assumed to be in the whitelist. - bool matchesWhitelist = whitelist.isEmpty(); + bool matchesWhitelist = !whitelist || whitelist->isEmpty(); if (!matchesWhitelist) { - size_t whitelistSize = whitelist.size(); - for (size_t i = 0; i < whitelistSize; ++i) { - UserContentURLPattern contentPattern(whitelist[i]); + for (unsigned i = 0; i < whitelist->size(); ++i) { + UserContentURLPattern contentPattern(whitelist->at(i)); if (contentPattern.matches(url)) { matchesWhitelist = true; break; @@ -48,10 +46,9 @@ bool UserContentURLPattern::matchesPatterns(const KURL& url, const Vector<String } bool matchesBlacklist = false; - if (!blacklist.isEmpty()) { - size_t blacklistSize = blacklist.size(); - for (size_t i = 0; i < blacklistSize; ++i) { - UserContentURLPattern contentPattern(blacklist[i]); + if (blacklist) { + for (unsigned i = 0; i < blacklist->size(); ++i) { + UserContentURLPattern contentPattern(blacklist->at(i)); if (contentPattern.matches(url)) { matchesBlacklist = true; break; diff --git a/Source/WebCore/page/UserContentURLPattern.h b/Source/WebCore/page/UserContentURLPattern.h index 0de055ef5..51d9fee33 100644 --- a/Source/WebCore/page/UserContentURLPattern.h +++ b/Source/WebCore/page/UserContentURLPattern.h @@ -53,7 +53,7 @@ public: bool matchSubdomains() const { return m_matchSubdomains; } - static bool matchesPatterns(const KURL&, const Vector<String>& whitelist, const Vector<String>& blacklist); + static bool matchesPatterns(const KURL&, const Vector<String>* whitelist, const Vector<String>* blacklist); private: bool parse(const String& pattern); diff --git a/Source/WebCore/page/UserScript.h b/Source/WebCore/page/UserScript.h index 8bbfa49bb..051409038 100644 --- a/Source/WebCore/page/UserScript.h +++ b/Source/WebCore/page/UserScript.h @@ -29,20 +29,18 @@ #include "KURL.h" #include "UserContentTypes.h" #include "UserScriptTypes.h" +#include <wtf/OwnPtr.h> +#include <wtf/PassOwnPtr.h> #include <wtf/Vector.h> namespace WebCore { class UserScript { - WTF_MAKE_FAST_ALLOCATED; + WTF_MAKE_NONCOPYABLE(UserScript); WTF_MAKE_FAST_ALLOCATED; public: - UserScript() - : m_injectionTime(InjectAtDocumentStart) - , m_injectedFrames(InjectInAllFrames) - { - } - - UserScript(const String& source, const KURL& url, const Vector<String>& whitelist, const Vector<String>& blacklist, UserScriptInjectionTime injectionTime, UserContentInjectedFrames injectedFrames) + UserScript(const String& source, const KURL& url, + PassOwnPtr<Vector<String> > whitelist, PassOwnPtr<Vector<String> > blacklist, + UserScriptInjectionTime injectionTime, UserContentInjectedFrames injectedFrames) : m_source(source) , m_url(url) , m_whitelist(whitelist) @@ -54,16 +52,16 @@ public: const String& source() const { return m_source; } const KURL& url() const { return m_url; } - const Vector<String>& whitelist() const { return m_whitelist; } - const Vector<String>& blacklist() const { return m_blacklist; } + const Vector<String>* whitelist() const { return m_whitelist.get(); } + const Vector<String>* blacklist() const { return m_blacklist.get(); } UserScriptInjectionTime injectionTime() const { return m_injectionTime; } UserContentInjectedFrames injectedFrames() const { return m_injectedFrames; } private: String m_source; KURL m_url; - Vector<String> m_whitelist; - Vector<String> m_blacklist; + OwnPtr<Vector<String> > m_whitelist; + OwnPtr<Vector<String> > m_blacklist; UserScriptInjectionTime m_injectionTime; UserContentInjectedFrames m_injectedFrames; }; diff --git a/Source/WebCore/page/UserStyleSheet.h b/Source/WebCore/page/UserStyleSheet.h index fc67d7aca..068df1ef6 100644 --- a/Source/WebCore/page/UserStyleSheet.h +++ b/Source/WebCore/page/UserStyleSheet.h @@ -29,20 +29,18 @@ #include "KURL.h" #include "UserContentTypes.h" #include "UserStyleSheetTypes.h" +#include <wtf/OwnPtr.h> +#include <wtf/PassOwnPtr.h> #include <wtf/Vector.h> namespace WebCore { class UserStyleSheet { - WTF_MAKE_FAST_ALLOCATED; + WTF_MAKE_NONCOPYABLE(UserStyleSheet); WTF_MAKE_FAST_ALLOCATED; public: - UserStyleSheet() - : m_injectedFrames(InjectInAllFrames) - , m_level(UserStyleUserLevel) - { - } - - UserStyleSheet(const String& source, const KURL& url, const Vector<String>& whitelist, const Vector<String>& blacklist, UserContentInjectedFrames injectedFrames, UserStyleLevel level) + UserStyleSheet(const String& source, const KURL& url, + PassOwnPtr<Vector<String> > whitelist, PassOwnPtr<Vector<String> > blacklist, + UserContentInjectedFrames injectedFrames, UserStyleLevel level) : m_source(source) , m_url(url) , m_whitelist(whitelist) @@ -54,16 +52,16 @@ public: const String& source() const { return m_source; } const KURL& url() const { return m_url; } - const Vector<String>& whitelist() const { return m_whitelist; } - const Vector<String>& blacklist() const { return m_blacklist; } + const Vector<String>* whitelist() const { return m_whitelist.get(); } + const Vector<String>* blacklist() const { return m_blacklist.get(); } UserContentInjectedFrames injectedFrames() const { return m_injectedFrames; } UserStyleLevel level() const { return m_level; } private: String m_source; KURL m_url; - Vector<String> m_whitelist; - Vector<String> m_blacklist; + OwnPtr<Vector<String> > m_whitelist; + OwnPtr<Vector<String> > m_blacklist; UserContentInjectedFrames m_injectedFrames; UserStyleLevel m_level; }; diff --git a/Source/WebCore/page/WebKitAnimation.idl b/Source/WebCore/page/WebKitAnimation.idl index 2618be085..4d3cad26d 100644 --- a/Source/WebCore/page/WebKitAnimation.idl +++ b/Source/WebCore/page/WebKitAnimation.idl @@ -26,30 +26,33 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -interface WebKitAnimation { +module html { - readonly attribute DOMString name; + interface WebKitAnimation { - readonly attribute double duration; - attribute double elapsedTime; + readonly attribute DOMString name; - readonly attribute double delay; - [Custom] readonly attribute long iterationCount; + readonly attribute double duration; + attribute double elapsedTime; - readonly attribute boolean paused; - readonly attribute boolean ended; + readonly attribute double delay; + readonly attribute [Custom] long iterationCount; - const unsigned short DIRECTION_NORMAL = 0; - const unsigned short DIRECTION_ALTERNATE = 1; - readonly attribute unsigned short direction; + readonly attribute boolean paused; + readonly attribute boolean ended; - const unsigned short FILL_NONE = 0; - const unsigned short FILL_BACKWARDS = 1; - const unsigned short FILL_FORWARDS = 2; - const unsigned short FILL_BOTH = 3; - readonly attribute unsigned short fillMode; + const unsigned short DIRECTION_NORMAL = 0; + const unsigned short DIRECTION_ALTERNATE = 1; + readonly attribute unsigned short direction; - void play(); - void pause(); -}; + const unsigned short FILL_NONE = 0; + const unsigned short FILL_BACKWARDS = 1; + const unsigned short FILL_FORWARDS = 2; + const unsigned short FILL_BOTH = 3; + readonly attribute unsigned short fillMode; + void play(); + void pause(); + }; + +} diff --git a/Source/WebCore/page/WebKitAnimationList.idl b/Source/WebCore/page/WebKitAnimationList.idl index cf2da14f1..ed305f792 100644 --- a/Source/WebCore/page/WebKitAnimationList.idl +++ b/Source/WebCore/page/WebKitAnimationList.idl @@ -23,10 +23,13 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -[ - IndexedGetter -] interface WebKitAnimationList { - readonly attribute unsigned long length; - WebKitAnimation item(in unsigned long index); -}; +module html { + interface [ + IndexedGetter + ] WebKitAnimationList { + readonly attribute unsigned long length; + WebKitAnimation item(in unsigned long index); + }; + +} diff --git a/Source/WebCore/page/WebKitPoint.idl b/Source/WebCore/page/WebKitPoint.idl index 7034eb46e..e44fd2104 100644 --- a/Source/WebCore/page/WebKitPoint.idl +++ b/Source/WebCore/page/WebKitPoint.idl @@ -23,11 +23,14 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -[ - CustomConstructor, - ConstructorParameters=2 -] interface WebKitPoint { - attribute float x; - attribute float y; -}; +module window { + interface [ + CustomConstructor, + ConstructorParameters=2 + ] WebKitPoint { + attribute float x; + attribute float y; + }; + +} diff --git a/Source/WebCore/page/WindowFeatures.cpp b/Source/WebCore/page/WindowFeatures.cpp index 7768a09cd..6cde9b5ef 100644 --- a/Source/WebCore/page/WindowFeatures.cpp +++ b/Source/WebCore/page/WindowFeatures.cpp @@ -211,7 +211,7 @@ bool WindowFeatures::boolFeature(const DialogFeaturesMap& features, const char* DialogFeaturesMap::const_iterator it = features.find(key); if (it == features.end()) return defaultValue; - const String& value = it->value; + const String& value = it->second; return value.isNull() || value == "1" || value == "yes" || value == "on"; } @@ -223,7 +223,7 @@ float WindowFeatures::floatFeature(const DialogFeaturesMap& features, const char // FIXME: The toDouble function does not offer a way to tell "0q" from string with no digits in it: Both // return the number 0 and false for ok. But "0q" should yield the minimum rather than the default. bool ok; - double parsedNumber = it->value.toDouble(&ok); + double parsedNumber = it->second.toDouble(&ok); if ((parsedNumber == 0 && !ok) || isnan(parsedNumber)) return defaultValue; if (parsedNumber < min || max <= min) diff --git a/Source/WebCore/page/WorkerNavigator.idl b/Source/WebCore/page/WorkerNavigator.idl index c37e200af..819de09d6 100644 --- a/Source/WebCore/page/WorkerNavigator.idl +++ b/Source/WebCore/page/WorkerNavigator.idl @@ -26,17 +26,20 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -[ - Conditional=WORKERS, - JSGenerateIsReachable=Impl, - JSNoStaticTables, - OmitConstructor -] interface WorkerNavigator { - readonly attribute DOMString appName; - readonly attribute DOMString appVersion; - readonly attribute DOMString platform; - readonly attribute DOMString userAgent; +module threads { - readonly attribute boolean onLine; -}; + interface [ + Conditional=WORKERS, + JSGenerateIsReachable=Impl, + JSNoStaticTables, + OmitConstructor + ] WorkerNavigator { + readonly attribute DOMString appName; + readonly attribute DOMString appVersion; + readonly attribute DOMString platform; + readonly attribute DOMString userAgent; + readonly attribute boolean onLine; + }; + +} diff --git a/Source/WebCore/page/animation/AnimationController.cpp b/Source/WebCore/page/animation/AnimationController.cpp index 5e0717e0a..c49119e6a 100644 --- a/Source/WebCore/page/animation/AnimationController.cpp +++ b/Source/WebCore/page/animation/AnimationController.cpp @@ -93,14 +93,14 @@ double AnimationControllerPrivate::updateAnimations(SetChanged callSetChanged/* RenderObjectAnimationMap::const_iterator animationsEnd = m_compositeAnimations.end(); for (RenderObjectAnimationMap::const_iterator it = m_compositeAnimations.begin(); it != animationsEnd; ++it) { - CompositeAnimation* compAnim = it->value.get(); + CompositeAnimation* compAnim = it->second.get(); if (!compAnim->suspended() && compAnim->hasAnimations()) { double t = compAnim->timeToNextService(); if (t != -1 && (t < timeToNextService || timeToNextService == -1)) timeToNextService = t; if (!timeToNextService) { if (callSetChanged == CallSetChanged) { - Node* node = it->key->node(); + Node* node = it->first->node(); ASSERT(!node || (node->document() && !node->document()->inPageCache())); node->setNeedsStyleRecalc(SyntheticStyleChange); calledSetChanged = true; @@ -292,9 +292,9 @@ void AnimationControllerPrivate::suspendAnimationsForDocument(Document* document RenderObjectAnimationMap::const_iterator animationsEnd = m_compositeAnimations.end(); for (RenderObjectAnimationMap::const_iterator it = m_compositeAnimations.begin(); it != animationsEnd; ++it) { - RenderObject* renderer = it->key; + RenderObject* renderer = it->first; if (renderer->document() == document) { - CompositeAnimation* compAnim = it->value.get(); + CompositeAnimation* compAnim = it->second.get(); compAnim->suspendAnimations(); } } @@ -308,9 +308,9 @@ void AnimationControllerPrivate::resumeAnimationsForDocument(Document* document) RenderObjectAnimationMap::const_iterator animationsEnd = m_compositeAnimations.end(); for (RenderObjectAnimationMap::const_iterator it = m_compositeAnimations.begin(); it != animationsEnd; ++it) { - RenderObject* renderer = it->key; + RenderObject* renderer = it->first; if (renderer->document() == document) { - CompositeAnimation* compAnim = it->value.get(); + CompositeAnimation* compAnim = it->second.get(); compAnim->resumeAnimations(); } } @@ -396,8 +396,8 @@ unsigned AnimationControllerPrivate::numberOfActiveAnimations(Document* document RenderObjectAnimationMap::const_iterator animationsEnd = m_compositeAnimations.end(); for (RenderObjectAnimationMap::const_iterator it = m_compositeAnimations.begin(); it != animationsEnd; ++it) { - RenderObject* renderer = it->key; - CompositeAnimation* compAnim = it->value.get(); + RenderObject* renderer = it->first; + CompositeAnimation* compAnim = it->second.get(); if (renderer->document() == document) count += compAnim->numberOfActiveAnimations(); } diff --git a/Source/WebCore/page/animation/CompositeAnimation.cpp b/Source/WebCore/page/animation/CompositeAnimation.cpp index 0b0f379d5..f35778189 100644 --- a/Source/WebCore/page/animation/CompositeAnimation.cpp +++ b/Source/WebCore/page/animation/CompositeAnimation.cpp @@ -58,7 +58,7 @@ void CompositeAnimation::clearRenderer() // an animation callback (see https://bugs.webkit.org/show_bug.cgi?id=22052) CSSPropertyTransitionsMap::const_iterator transitionsEnd = m_transitions.end(); for (CSSPropertyTransitionsMap::const_iterator it = m_transitions.begin(); it != transitionsEnd; ++it) { - ImplicitAnimation* transition = it->value.get(); + ImplicitAnimation* transition = it->second.get(); animationController()->animationWillBeRemoved(transition); transition->clear(); } @@ -67,7 +67,7 @@ void CompositeAnimation::clearRenderer() m_keyframeAnimations.checkConsistency(); AnimationNameMap::const_iterator animationsEnd = m_keyframeAnimations.end(); for (AnimationNameMap::const_iterator it = m_keyframeAnimations.begin(); it != animationsEnd; ++it) { - KeyframeAnimation* anim = it->value.get(); + KeyframeAnimation* anim = it->second.get(); animationController()->animationWillBeRemoved(anim); anim->clear(); } @@ -84,7 +84,7 @@ void CompositeAnimation::updateTransitions(RenderObject* renderer, RenderStyle* // in the next loop and then toss the ones that didn't get marked. CSSPropertyTransitionsMap::const_iterator end = m_transitions.end(); for (CSSPropertyTransitionsMap::const_iterator it = m_transitions.begin(); it != end; ++it) - it->value->setActive(false); + it->second->setActive(false); RefPtr<RenderStyle> modifiedCurrentStyle; @@ -181,7 +181,7 @@ void CompositeAnimation::updateTransitions(RenderObject* renderer, RenderStyle* Vector<int> toBeRemoved; end = m_transitions.end(); for (CSSPropertyTransitionsMap::const_iterator it = m_transitions.begin(); it != end; ++it) { - ImplicitAnimation* anim = it->value.get(); + ImplicitAnimation* anim = it->second.get(); if (!anim->active()) { animationController()->animationWillBeRemoved(anim); toBeRemoved.append(anim->animatingProperty()); @@ -207,13 +207,13 @@ void CompositeAnimation::updateKeyframeAnimations(RenderObject* renderer, Render // The current and target animations are the same so we just need to toss any // animation which is finished (postActive). for (AnimationNameMap::const_iterator it = m_keyframeAnimations.begin(); it != kfend; ++it) { - if (it->value->postActive()) - it->value->setIndex(-1); + if (it->second->postActive()) + it->second->setIndex(-1); } } else { // Mark all existing animations as no longer active. for (AnimationNameMap::const_iterator it = m_keyframeAnimations.begin(); it != kfend; ++it) - it->value->setIndex(-1); + it->second->setIndex(-1); // Toss the animation order map. m_keyframeAnimationOrderMap.clear(); @@ -262,7 +262,7 @@ void CompositeAnimation::updateKeyframeAnimations(RenderObject* renderer, Render Vector<AtomicStringImpl*> animsToBeRemoved; kfend = m_keyframeAnimations.end(); for (AnimationNameMap::const_iterator it = m_keyframeAnimations.begin(); it != kfend; ++it) { - KeyframeAnimation* keyframeAnim = it->value.get(); + KeyframeAnimation* keyframeAnim = it->second.get(); if (keyframeAnim->index() < 0) { animsToBeRemoved.append(keyframeAnim->name().impl()); animationController()->animationWillBeRemoved(keyframeAnim); @@ -290,7 +290,7 @@ PassRefPtr<RenderStyle> CompositeAnimation::animate(RenderObject* renderer, Rend if (!m_transitions.isEmpty()) { CSSPropertyTransitionsMap::const_iterator end = m_transitions.end(); for (CSSPropertyTransitionsMap::const_iterator it = m_transitions.begin(); it != end; ++it) { - if (ImplicitAnimation* anim = it->value.get()) + if (ImplicitAnimation* anim = it->second.get()) anim->animate(this, renderer, currentStyle, targetStyle, resultStyle); } } @@ -312,7 +312,7 @@ PassRefPtr<RenderStyle> CompositeAnimation::getAnimatedStyle() const RefPtr<RenderStyle> resultStyle; CSSPropertyTransitionsMap::const_iterator end = m_transitions.end(); for (CSSPropertyTransitionsMap::const_iterator it = m_transitions.begin(); it != end; ++it) { - if (ImplicitAnimation* implicitAnimation = it->value.get()) + if (ImplicitAnimation* implicitAnimation = it->second.get()) implicitAnimation->getAnimatedStyle(resultStyle); } @@ -333,7 +333,7 @@ void CompositeAnimation::setAnimating(bool animating) if (!m_transitions.isEmpty()) { CSSPropertyTransitionsMap::const_iterator transitionsEnd = m_transitions.end(); for (CSSPropertyTransitionsMap::const_iterator it = m_transitions.begin(); it != transitionsEnd; ++it) { - ImplicitAnimation* transition = it->value.get(); + ImplicitAnimation* transition = it->second.get(); transition->setAnimating(animating); } } @@ -341,7 +341,7 @@ void CompositeAnimation::setAnimating(bool animating) m_keyframeAnimations.checkConsistency(); AnimationNameMap::const_iterator animationsEnd = m_keyframeAnimations.end(); for (AnimationNameMap::const_iterator it = m_keyframeAnimations.begin(); it != animationsEnd; ++it) { - KeyframeAnimation* anim = it->value.get(); + KeyframeAnimation* anim = it->second.get(); anim->setAnimating(animating); } } @@ -356,7 +356,7 @@ double CompositeAnimation::timeToNextService() const if (!m_transitions.isEmpty()) { CSSPropertyTransitionsMap::const_iterator transitionsEnd = m_transitions.end(); for (CSSPropertyTransitionsMap::const_iterator it = m_transitions.begin(); it != transitionsEnd; ++it) { - ImplicitAnimation* transition = it->value.get(); + ImplicitAnimation* transition = it->second.get(); double t = transition ? transition->timeToNextService() : -1; if (t < minT || minT == -1) minT = t; @@ -368,7 +368,7 @@ double CompositeAnimation::timeToNextService() const m_keyframeAnimations.checkConsistency(); AnimationNameMap::const_iterator animationsEnd = m_keyframeAnimations.end(); for (AnimationNameMap::const_iterator it = m_keyframeAnimations.begin(); it != animationsEnd; ++it) { - KeyframeAnimation* animation = it->value.get(); + KeyframeAnimation* animation = it->second.get(); double t = animation ? animation->timeToNextService() : -1; if (t < minT || minT == -1) minT = t; @@ -390,7 +390,7 @@ PassRefPtr<KeyframeAnimation> CompositeAnimation::getAnimationForProperty(CSSPro m_keyframeAnimations.checkConsistency(); AnimationNameMap::const_iterator animationsEnd = m_keyframeAnimations.end(); for (AnimationNameMap::const_iterator it = m_keyframeAnimations.begin(); it != animationsEnd; ++it) { - RefPtr<KeyframeAnimation> anim = it->value; + RefPtr<KeyframeAnimation> anim = it->second; if (anim->hasAnimationForProperty(property)) retval = anim; } @@ -410,14 +410,14 @@ void CompositeAnimation::suspendAnimations() m_keyframeAnimations.checkConsistency(); AnimationNameMap::const_iterator animationsEnd = m_keyframeAnimations.end(); for (AnimationNameMap::const_iterator it = m_keyframeAnimations.begin(); it != animationsEnd; ++it) { - if (KeyframeAnimation* anim = it->value.get()) + if (KeyframeAnimation* anim = it->second.get()) anim->updatePlayState(AnimPlayStatePaused); } } if (!m_transitions.isEmpty()) { CSSPropertyTransitionsMap::const_iterator transitionsEnd = m_transitions.end(); for (CSSPropertyTransitionsMap::const_iterator it = m_transitions.begin(); it != transitionsEnd; ++it) { - ImplicitAnimation* anim = it->value.get(); + ImplicitAnimation* anim = it->second.get(); if (anim && anim->hasStyle()) anim->updatePlayState(AnimPlayStatePaused); } @@ -435,7 +435,7 @@ void CompositeAnimation::resumeAnimations() m_keyframeAnimations.checkConsistency(); AnimationNameMap::const_iterator animationsEnd = m_keyframeAnimations.end(); for (AnimationNameMap::const_iterator it = m_keyframeAnimations.begin(); it != animationsEnd; ++it) { - KeyframeAnimation* anim = it->value.get(); + KeyframeAnimation* anim = it->second.get(); if (anim && anim->playStatePlaying()) anim->updatePlayState(AnimPlayStatePlaying); } @@ -444,7 +444,7 @@ void CompositeAnimation::resumeAnimations() if (!m_transitions.isEmpty()) { CSSPropertyTransitionsMap::const_iterator transitionsEnd = m_transitions.end(); for (CSSPropertyTransitionsMap::const_iterator it = m_transitions.begin(); it != transitionsEnd; ++it) { - ImplicitAnimation* anim = it->value.get(); + ImplicitAnimation* anim = it->second.get(); if (anim && anim->hasStyle()) anim->updatePlayState(AnimPlayStatePlaying); } @@ -456,7 +456,7 @@ void CompositeAnimation::overrideImplicitAnimations(CSSPropertyID property) CSSPropertyTransitionsMap::const_iterator end = m_transitions.end(); if (!m_transitions.isEmpty()) { for (CSSPropertyTransitionsMap::const_iterator it = m_transitions.begin(); it != end; ++it) { - ImplicitAnimation* anim = it->value.get(); + ImplicitAnimation* anim = it->second.get(); if (anim && anim->animatingProperty() == property) anim->setOverridden(true); } @@ -468,7 +468,7 @@ void CompositeAnimation::resumeOverriddenImplicitAnimations(CSSPropertyID proper if (!m_transitions.isEmpty()) { CSSPropertyTransitionsMap::const_iterator end = m_transitions.end(); for (CSSPropertyTransitionsMap::const_iterator it = m_transitions.begin(); it != end; ++it) { - ImplicitAnimation* anim = it->value.get(); + ImplicitAnimation* anim = it->second.get(); if (anim && anim->animatingProperty() == property) anim->setOverridden(false); } @@ -481,7 +481,7 @@ bool CompositeAnimation::isAnimatingProperty(CSSPropertyID property, bool accele m_keyframeAnimations.checkConsistency(); AnimationNameMap::const_iterator animationsEnd = m_keyframeAnimations.end(); for (AnimationNameMap::const_iterator it = m_keyframeAnimations.begin(); it != animationsEnd; ++it) { - KeyframeAnimation* anim = it->value.get(); + KeyframeAnimation* anim = it->second.get(); if (anim && anim->isAnimatingProperty(property, acceleratedOnly, isRunningNow)) return true; } @@ -490,7 +490,7 @@ bool CompositeAnimation::isAnimatingProperty(CSSPropertyID property, bool accele if (!m_transitions.isEmpty()) { CSSPropertyTransitionsMap::const_iterator transitionsEnd = m_transitions.end(); for (CSSPropertyTransitionsMap::const_iterator it = m_transitions.begin(); it != transitionsEnd; ++it) { - ImplicitAnimation* anim = it->value.get(); + ImplicitAnimation* anim = it->second.get(); if (anim && anim->isAnimatingProperty(property, acceleratedOnly, isRunningNow)) return true; } @@ -556,7 +556,7 @@ unsigned CompositeAnimation::numberOfActiveAnimations() const m_keyframeAnimations.checkConsistency(); AnimationNameMap::const_iterator animationsEnd = m_keyframeAnimations.end(); for (AnimationNameMap::const_iterator it = m_keyframeAnimations.begin(); it != animationsEnd; ++it) { - KeyframeAnimation* anim = it->value.get(); + KeyframeAnimation* anim = it->second.get(); if (anim->running()) ++count; } @@ -565,7 +565,7 @@ unsigned CompositeAnimation::numberOfActiveAnimations() const if (!m_transitions.isEmpty()) { CSSPropertyTransitionsMap::const_iterator transitionsEnd = m_transitions.end(); for (CSSPropertyTransitionsMap::const_iterator it = m_transitions.begin(); it != transitionsEnd; ++it) { - ImplicitAnimation* anim = it->value.get(); + ImplicitAnimation* anim = it->second.get(); if (anim->running()) ++count; } diff --git a/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp b/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp index b19bb13d9..a6018ba5d 100644 --- a/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp +++ b/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp @@ -36,6 +36,7 @@ #include "Region.h" #include "RenderView.h" #include "ScrollAnimator.h" +#include "ScrollingTreeState.h" #include <wtf/MainThread.h> #if USE(ACCELERATED_COMPOSITING) @@ -43,45 +44,47 @@ #endif #if ENABLE(THREADED_SCROLLING) -#include "ScrollingCoordinatorMac.h" -#endif - -#if PLATFORM(CHROMIUM) -#include "ScrollingCoordinatorChromium.h" +#include "ScrollingThread.h" +#include "ScrollingTree.h" +#include <wtf/Functional.h> +#include <wtf/PassRefPtr.h> #endif namespace WebCore { -PassRefPtr<ScrollingCoordinator> ScrollingCoordinator::create(Page* page) -{ -#if USE(ACCELERATED_COMPOSITING) && ENABLE(THREADED_SCROLLING) - return adoptRef(new ScrollingCoordinatorMac(page)); -#endif - -#if PLATFORM(CHROMIUM) - return adoptRef(new ScrollingCoordinatorChromium(page)); -#endif - - return adoptRef(new ScrollingCoordinator(page)); -} - ScrollingCoordinator::ScrollingCoordinator(Page* page) : m_page(page) , m_forceMainThreadScrollLayerPositionUpdates(false) +#if ENABLE(THREADED_SCROLLING) + , m_scrollingTreeState(ScrollingTreeState::create()) + , m_scrollingTree(ScrollingTree::create(this)) + , m_scrollingTreeStateCommitterTimer(this, &ScrollingCoordinator::scrollingTreeStateCommitterTimerFired) +#endif + , m_private(0) { } -ScrollingCoordinator::~ScrollingCoordinator() -{ - ASSERT(!m_page); -} - void ScrollingCoordinator::pageDestroyed() { ASSERT(m_page); m_page = 0; + +#if ENABLE(THREADED_SCROLLING) + m_scrollingTreeStateCommitterTimer.stop(); + + // Invalidating the scrolling tree will break the reference cycle between the ScrollingCoordinator and ScrollingTree objects. + ScrollingThread::dispatch(bind(&ScrollingTree::invalidate, m_scrollingTree.release())); +#endif } +#if ENABLE(THREADED_SCROLLING) +ScrollingTree* ScrollingCoordinator::scrollingTree() const +{ + ASSERT(m_scrollingTree); + return m_scrollingTree.get(); +} +#endif + bool ScrollingCoordinator::coordinatesScrollingForFrameView(FrameView* frameView) const { ASSERT(isMainThread()); @@ -102,7 +105,7 @@ bool ScrollingCoordinator::coordinatesScrollingForFrameView(FrameView* frameView #endif } -Region ScrollingCoordinator::computeNonFastScrollableRegion(Frame* frame, const IntPoint& frameLocation) +static Region computeNonFastScrollableRegion(Frame* frame, const IntPoint& frameLocation) { Region nonFastScrollableRegion; FrameView* frameView = frame->view(); @@ -144,24 +147,41 @@ Region ScrollingCoordinator::computeNonFastScrollableRegion(Frame* frame, const return nonFastScrollableRegion; } -unsigned ScrollingCoordinator::computeCurrentWheelEventHandlerCount() +void ScrollingCoordinator::frameViewLayoutUpdated(FrameView* frameView) { - unsigned wheelEventHandlerCount = 0; + ASSERT(isMainThread()); + ASSERT(m_page); - for (Frame* frame = m_page->mainFrame(); frame; frame = frame->tree()->traverseNext()) { - if (frame->document()) - wheelEventHandlerCount += frame->document()->wheelEventHandlerCount(); - } + // Compute the region of the page that we can't do fast scrolling for. This currently includes + // all scrollable areas, such as subframes, overflow divs and list boxes. We need to do this even if the + // frame view whose layout was updated is not the main frame. + Region nonFastScrollableRegion = computeNonFastScrollableRegion(m_page->mainFrame(), IntPoint()); + setNonFastScrollableRegion(nonFastScrollableRegion); - return wheelEventHandlerCount; + if (!coordinatesScrollingForFrameView(frameView)) + return; + + ScrollParameters scrollParameters; + scrollParameters.horizontalScrollElasticity = frameView->horizontalScrollElasticity(); + scrollParameters.verticalScrollElasticity = frameView->verticalScrollElasticity(); + scrollParameters.hasEnabledHorizontalScrollbar = frameView->horizontalScrollbar() && frameView->horizontalScrollbar()->enabled(); + scrollParameters.hasEnabledVerticalScrollbar = frameView->verticalScrollbar() && frameView->verticalScrollbar()->enabled(); + scrollParameters.horizontalScrollbarMode = frameView->horizontalScrollbarMode(); + scrollParameters.verticalScrollbarMode = frameView->verticalScrollbarMode(); + + scrollParameters.scrollOrigin = frameView->scrollOrigin(); + scrollParameters.viewportRect = IntRect(IntPoint(), frameView->visibleContentRect().size()); + scrollParameters.contentsSize = frameView->contentsSize(); + + setScrollParameters(scrollParameters); } -void ScrollingCoordinator::frameViewWheelEventHandlerCountChanged(FrameView* frameView) +void ScrollingCoordinator::frameViewWheelEventHandlerCountChanged(FrameView*) { ASSERT(isMainThread()); ASSERT(m_page); - recomputeWheelEventHandlerCountForFrameView(frameView); + recomputeWheelEventHandlerCount(); } void ScrollingCoordinator::frameViewHasSlowRepaintObjectsDidChange(FrameView* frameView) @@ -186,7 +206,7 @@ void ScrollingCoordinator::frameViewFixedObjectsDidChange(FrameView* frameView) updateShouldUpdateScrollLayerPositionOnMainThread(); } -GraphicsLayer* ScrollingCoordinator::scrollLayerForFrameView(FrameView* frameView) +static GraphicsLayer* scrollLayerForFrameView(FrameView* frameView) { #if USE(ACCELERATED_COMPOSITING) Frame* frame = frameView->frame(); @@ -212,11 +232,53 @@ void ScrollingCoordinator::frameViewRootLayerDidChange(FrameView* frameView) return; frameViewLayoutUpdated(frameView); - recomputeWheelEventHandlerCountForFrameView(frameView); + recomputeWheelEventHandlerCount(); updateShouldUpdateScrollLayerPositionOnMainThread(); + setScrollLayer(scrollLayerForFrameView(frameView)); +} + +bool ScrollingCoordinator::requestScrollPositionUpdate(FrameView* frameView, const IntPoint& scrollPosition) +{ + ASSERT(isMainThread()); + ASSERT(m_page); + + if (!coordinatesScrollingForFrameView(frameView)) + return false; + +#if ENABLE(THREADED_SCROLLING) + if (frameView->frame()->document()->inPageCache()) { + // If this frame view's document is being put into the page cache, we don't want to update our + // main frame scroll position. Just let the FrameView think that we did. + updateMainFrameScrollPosition(scrollPosition); + return true; + } + + m_scrollingTreeState->setRequestedScrollPosition(scrollPosition); + scheduleTreeStateCommit(); + return true; +#else + UNUSED_PARAM(scrollPosition); + return false; +#endif } -void ScrollingCoordinator::updateMainFrameScrollPosition(const IntPoint& scrollPosition, bool programmaticScroll) +bool ScrollingCoordinator::handleWheelEvent(FrameView*, const PlatformWheelEvent& wheelEvent) +{ + ASSERT(isMainThread()); + ASSERT(m_page); + +#if ENABLE(THREADED_SCROLLING) + if (m_scrollingTree->willWheelEventStartSwipeGesture(wheelEvent)) + return false; + + ScrollingThread::dispatch(bind(&ScrollingTree::handleWheelEvent, m_scrollingTree.get(), wheelEvent)); +#else + UNUSED_PARAM(wheelEvent); +#endif + return true; +} + +void ScrollingCoordinator::updateMainFrameScrollPosition(const IntPoint& scrollPosition) { ASSERT(isMainThread()); @@ -227,14 +289,49 @@ void ScrollingCoordinator::updateMainFrameScrollPosition(const IntPoint& scrollP if (!frameView) return; - bool oldProgrammaticScroll = frameView->inProgrammaticScroll(); - frameView->setInProgrammaticScroll(programmaticScroll); + frameView->setConstrainsScrollingToContentEdge(false); + frameView->notifyScrollPositionChanged(scrollPosition); + frameView->setConstrainsScrollingToContentEdge(true); +} + +void ScrollingCoordinator::updateMainFrameScrollLayerPosition() +{ +#if USE(ACCELERATED_COMPOSITING) && ENABLE(THREADED_SCROLLING) + ASSERT(isMainThread()); + + if (!m_page) + return; + + FrameView* frameView = m_page->mainFrame()->view(); + if (!frameView) + return; + + if (GraphicsLayer* scrollLayer = scrollLayerForFrameView(frameView)) + scrollLayer->setPosition(-frameView->scrollPosition()); +#endif +} + +void ScrollingCoordinator::updateMainFrameScrollPositionAndScrollLayerPosition() +{ +#if USE(ACCELERATED_COMPOSITING) && ENABLE(THREADED_SCROLLING) + ASSERT(isMainThread()); + + if (!m_page) + return; + + FrameView* frameView = m_page->mainFrame()->view(); + if (!frameView) + return; + + IntPoint scrollPosition = m_scrollingTree->mainFrameScrollPosition(); frameView->setConstrainsScrollingToContentEdge(false); frameView->notifyScrollPositionChanged(scrollPosition); frameView->setConstrainsScrollingToContentEdge(true); - frameView->setInProgrammaticScroll(oldProgrammaticScroll); + if (GraphicsLayer* scrollLayer = scrollLayerForFrameView(frameView)) + scrollLayer->setPosition(-frameView->scrollPosition()); +#endif } #if PLATFORM(MAC) || (PLATFORM(CHROMIUM) && OS(DARWIN)) @@ -253,6 +350,16 @@ void ScrollingCoordinator::handleWheelEventPhase(PlatformWheelEventPhase phase) } #endif +void ScrollingCoordinator::recomputeWheelEventHandlerCount() +{ + unsigned wheelEventHandlerCount = 0; + for (Frame* frame = m_page->mainFrame(); frame; frame = frame->tree()->traverseNext()) { + if (frame->document()) + wheelEventHandlerCount += frame->document()->wheelEventHandlerCount(); + } + setWheelEventHandlerCount(wheelEventHandlerCount); +} + bool ScrollingCoordinator::hasNonLayerFixedObjects(FrameView* frameView) { const FrameView::ViewportConstrainedObjectSet* viewportConstrainedObjects = frameView->viewportConstrainedObjects(); @@ -303,10 +410,104 @@ void ScrollingCoordinator::setForceMainThreadScrollLayerPositionUpdates(bool for updateShouldUpdateScrollLayerPositionOnMainThread(); } -ScrollingNodeID ScrollingCoordinator::uniqueScrollLayerID() +#if ENABLE(THREADED_SCROLLING) +void ScrollingCoordinator::setScrollLayer(GraphicsLayer* scrollLayer) +{ + m_scrollingTreeState->setScrollLayer(scrollLayer); + scheduleTreeStateCommit(); +} + +void ScrollingCoordinator::setNonFastScrollableRegion(const Region& region) +{ + m_scrollingTreeState->setNonFastScrollableRegion(region); + scheduleTreeStateCommit(); +} + +void ScrollingCoordinator::setScrollParameters(const ScrollParameters& scrollParameters) +{ + m_scrollingTreeState->setHorizontalScrollElasticity(scrollParameters.horizontalScrollElasticity); + m_scrollingTreeState->setVerticalScrollElasticity(scrollParameters.verticalScrollElasticity); + m_scrollingTreeState->setHasEnabledHorizontalScrollbar(scrollParameters.hasEnabledHorizontalScrollbar); + m_scrollingTreeState->setHasEnabledVerticalScrollbar(scrollParameters.hasEnabledVerticalScrollbar); + m_scrollingTreeState->setHorizontalScrollbarMode(scrollParameters.horizontalScrollbarMode); + m_scrollingTreeState->setVerticalScrollbarMode(scrollParameters.verticalScrollbarMode); + + m_scrollingTreeState->setScrollOrigin(scrollParameters.scrollOrigin); + m_scrollingTreeState->setViewportRect(scrollParameters.viewportRect); + m_scrollingTreeState->setContentsSize(scrollParameters.contentsSize); + scheduleTreeStateCommit(); +} + + +void ScrollingCoordinator::setWheelEventHandlerCount(unsigned wheelEventHandlerCount) +{ + m_scrollingTreeState->setWheelEventHandlerCount(wheelEventHandlerCount); + scheduleTreeStateCommit(); +} + +void ScrollingCoordinator::setShouldUpdateScrollLayerPositionOnMainThread(MainThreadScrollingReasons reasons) +{ + // The FrameView's GraphicsLayer is likely to be out-of-synch with the PlatformLayer + // at this point. So we'll update it before we switch back to main thread scrolling + // in order to avoid layer positioning bugs. + if (reasons) + updateMainFrameScrollLayerPosition(); + m_scrollingTreeState->setShouldUpdateScrollLayerPositionOnMainThread(reasons); + scheduleTreeStateCommit(); +} + +void ScrollingCoordinator::scheduleTreeStateCommit() +{ + if (m_scrollingTreeStateCommitterTimer.isActive()) + return; + + if (!m_scrollingTreeState->hasChangedProperties()) + return; + + m_scrollingTreeStateCommitterTimer.startOneShot(0); +} + +void ScrollingCoordinator::scrollingTreeStateCommitterTimerFired(Timer<ScrollingCoordinator>*) +{ + commitTreeState(); +} + +void ScrollingCoordinator::commitTreeStateIfNeeded() +{ + if (!m_scrollingTreeState->hasChangedProperties()) + return; + + commitTreeState(); + m_scrollingTreeStateCommitterTimer.stop(); +} + +void ScrollingCoordinator::commitTreeState() +{ + ASSERT(m_scrollingTreeState->hasChangedProperties()); + + OwnPtr<ScrollingTreeState> treeState = m_scrollingTreeState->commit(); + ScrollingThread::dispatch(bind(&ScrollingTree::commitNewTreeState, m_scrollingTree.get(), treeState.release())); +} + +bool ScrollingCoordinator::supportsFixedPositionLayers() const +{ + return false; +} + +void ScrollingCoordinator::setLayerIsContainerForFixedPositionLayers(GraphicsLayer*, bool) +{ + // FIXME: Implement! +} + +void ScrollingCoordinator::setLayerIsFixedToContainerLayer(GraphicsLayer*, bool) +{ + // FIXME: Implement! +} + +void ScrollingCoordinator::scrollableAreaScrollLayerDidChange(ScrollableArea*, GraphicsLayer*) { - static ScrollingNodeID uniqueScrollLayerID = 1; - return uniqueScrollLayerID++; + // FIXME: Implement. } +#endif // !ENABLE(THREADED_SCROLLING) } // namespace WebCore diff --git a/Source/WebCore/page/scrolling/ScrollingCoordinator.h b/Source/WebCore/page/scrolling/ScrollingCoordinator.h index fdbbc7374..110ed9393 100644 --- a/Source/WebCore/page/scrolling/ScrollingCoordinator.h +++ b/Source/WebCore/page/scrolling/ScrollingCoordinator.h @@ -34,7 +34,6 @@ #include <wtf/Forward.h> #if ENABLE(THREADED_SCROLLING) -#include <wtf/HashMap.h> #include <wtf/ThreadSafeRefCounted.h> #include <wtf/Threading.h> #endif @@ -46,17 +45,14 @@ namespace WebCore { typedef unsigned MainThreadScrollingReasons; -typedef uint64_t ScrollingNodeID; -class Frame; class FrameView; class GraphicsLayer; class Page; class Region; class ScrollableArea; -class ScrollingStateNode; -class ScrollingStateScrollingNode; -class ScrollingStateTree; +class ScrollingCoordinatorPrivate; +class ScrollingTreeState; #if ENABLE(THREADED_SCROLLING) class ScrollingTree; @@ -65,19 +61,20 @@ class ScrollingTree; class ScrollingCoordinator : public ThreadSafeRefCounted<ScrollingCoordinator> { public: static PassRefPtr<ScrollingCoordinator> create(Page*); - virtual ~ScrollingCoordinator(); + ~ScrollingCoordinator(); - virtual void pageDestroyed(); + void pageDestroyed(); #if ENABLE(THREADED_SCROLLING) - virtual ScrollingTree* scrollingTree() const { return 0; } + ScrollingTree* scrollingTree() const; + void commitTreeStateIfNeeded(); #endif // Return whether this scrolling coordinator handles scrolling for the given frame view. bool coordinatesScrollingForFrameView(FrameView*) const; // Should be called whenever the given frame view has been laid out. - virtual void frameViewLayoutUpdated(FrameView*) { } + void frameViewLayoutUpdated(FrameView*); // Should be called whenever a wheel event handler is added or removed in the // frame view's underlying document. @@ -90,11 +87,29 @@ public: void frameViewFixedObjectsDidChange(FrameView*); // Should be called whenever the root layer for the given frame view changes. - virtual void frameViewRootLayerDidChange(FrameView*); + void frameViewRootLayerDidChange(FrameView*); - // Return whether this scrolling coordinator can keep fixed position layers fixed to their - // containers while scrolling. - virtual bool supportsFixedPositionLayers() const { return false; } + // Should be called whenever the horizontal scrollbar layer for the given frame view changes. + void frameViewHorizontalScrollbarLayerDidChange(FrameView*, GraphicsLayer* horizontalScrollbarLayer); + + // Should be called whenever the vertical scrollbar layer for the given frame view changes. + void frameViewVerticalScrollbarLayerDidChange(FrameView*, GraphicsLayer* verticalScrollbarLayer); + + // Should be called whenever the scrollable layer for the given scroll area changes. + void scrollableAreaScrollLayerDidChange(ScrollableArea*, GraphicsLayer*); + + // Requests that the scrolling coordinator updates the scroll position of the given frame view. If this function returns true, it means that the + // position will be updated asynchronously. If it returns false, the caller should update the scrolling position itself. + bool requestScrollPositionUpdate(FrameView*, const IntPoint&); + + // Handle the wheel event on the scrolling thread. Returns whether the event was handled or not. + bool handleWheelEvent(FrameView*, const PlatformWheelEvent&); + + // Dispatched by the scrolling tree whenever the main frame scroll position changes. + void updateMainFrameScrollPosition(const IntPoint&); + + // Dispatched by the scrolling tree whenever the main frame scroll position changes and the scroll layer position needs to be updated as well. + void updateMainFrameScrollPositionAndScrollLayerPosition(); #if PLATFORM(MAC) || (PLATFORM(CHROMIUM) && OS(DARWIN)) // Dispatched by the scrolling tree during handleWheelEvent. This is required as long as scrollbars are painted on the main thread. @@ -104,21 +119,15 @@ public: // Force all scroll layer position updates to happen on the main thread. void setForceMainThreadScrollLayerPositionUpdates(bool); - // These virtual functions are currently unique to the threaded scrolling architecture. - // Their meaningful implementations are in ScrollingCoordinatorMac. - virtual void commitTreeStateIfNeeded() { } - virtual bool requestScrollPositionUpdate(FrameView*, const IntPoint&) { return false; } - virtual bool handleWheelEvent(FrameView*, const PlatformWheelEvent&) { return true; } - virtual void updateMainFrameScrollPositionAndScrollLayerPosition() { } - virtual ScrollingNodeID attachToStateTree(ScrollingNodeID nodeID) { return nodeID; } - virtual void detachFromStateTree(ScrollingNodeID) { } - virtual void clearStateTree() { } + // Return whether this scrolling coordinator can keep fixed position layers fixed to their + // containers while scrolling. + bool supportsFixedPositionLayers() const; - // Generated a unique id for scroll layers. - ScrollingNodeID uniqueScrollLayerID(); + // Mark/unmark a layer as a container for fixed position layers. + void setLayerIsContainerForFixedPositionLayers(GraphicsLayer*, bool); - // Dispatched by the scrolling tree whenever the main frame scroll position changes. - void updateMainFrameScrollPosition(const IntPoint&, bool programmaticScroll); + // Attach/detach layer position to ancestor fixed position container. + void setLayerIsFixedToContainerLayer(GraphicsLayer*, bool); enum MainThreadScrollingReasonFlags { ForcedOnMainThread = 1 << 0, @@ -128,31 +137,54 @@ public: IsImageDocument = 1 << 4 }; - // These virtual functions are currently unique to Chromium's WebLayer approach. Their meaningful - // implementations are in ScrollingCoordinatorChromium. - virtual void frameViewHorizontalScrollbarLayerDidChange(FrameView*, GraphicsLayer*) { } - virtual void frameViewVerticalScrollbarLayerDidChange(FrameView*, GraphicsLayer*) { } - virtual void scrollableAreaScrollLayerDidChange(ScrollableArea*, GraphicsLayer*) { } - virtual void setLayerIsContainerForFixedPositionLayers(GraphicsLayer*, bool) { } - virtual void setLayerIsFixedToContainerLayer(GraphicsLayer*, bool) { } - -protected: +private: explicit ScrollingCoordinator(Page*); - Region computeNonFastScrollableRegion(Frame*, const IntPoint& frameLocation); - unsigned computeCurrentWheelEventHandlerCount(); - GraphicsLayer* scrollLayerForFrameView(FrameView*); + void recomputeWheelEventHandlerCount(); + bool hasNonLayerFixedObjects(FrameView*); + void updateShouldUpdateScrollLayerPositionOnMainThread(); - Page* m_page; + void setScrollLayer(GraphicsLayer*); + void setNonFastScrollableRegion(const Region&); -private: - virtual void recomputeWheelEventHandlerCountForFrameView(FrameView*) { } - virtual void setShouldUpdateScrollLayerPositionOnMainThread(MainThreadScrollingReasons) { } + struct ScrollParameters { + ScrollElasticity horizontalScrollElasticity; + ScrollElasticity verticalScrollElasticity; - bool hasNonLayerFixedObjects(FrameView*); - void updateShouldUpdateScrollLayerPositionOnMainThread(); + bool hasEnabledHorizontalScrollbar; + bool hasEnabledVerticalScrollbar; + + ScrollbarMode horizontalScrollbarMode; + ScrollbarMode verticalScrollbarMode; + + IntPoint scrollOrigin; + + IntRect viewportRect; + IntSize contentsSize; + }; + + void setScrollParameters(const ScrollParameters&); + void setWheelEventHandlerCount(unsigned); + void setShouldUpdateScrollLayerPositionOnMainThread(MainThreadScrollingReasons); + + void updateMainFrameScrollLayerPosition(); + + Page* m_page; bool m_forceMainThreadScrollLayerPositionUpdates; + +#if ENABLE(THREADED_SCROLLING) + void scheduleTreeStateCommit(); + + void scrollingTreeStateCommitterTimerFired(Timer<ScrollingCoordinator>*); + void commitTreeState(); + + OwnPtr<ScrollingTreeState> m_scrollingTreeState; + RefPtr<ScrollingTree> m_scrollingTree; + Timer<ScrollingCoordinator> m_scrollingTreeStateCommitterTimer; +#endif + + ScrollingCoordinatorPrivate* m_private; }; } // namespace WebCore diff --git a/Source/WebCore/page/scrolling/ScrollingCoordinatorNone.cpp b/Source/WebCore/page/scrolling/ScrollingCoordinatorNone.cpp new file mode 100644 index 000000000..19c37f8e2 --- /dev/null +++ b/Source/WebCore/page/scrolling/ScrollingCoordinatorNone.cpp @@ -0,0 +1,92 @@ +/* + * Copyright (C) 2012 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 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. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" + +#include "ScrollingCoordinator.h" + +namespace WebCore { + +class ScrollingCoordinatorPrivate { +}; + +#if !ENABLE(THREADED_SCROLLING) +PassRefPtr<ScrollingCoordinator> ScrollingCoordinator::create(Page* page) +{ + return adoptRef(new ScrollingCoordinator(page)); +} + +ScrollingCoordinator::~ScrollingCoordinator() +{ + ASSERT(!m_page); +} + +void ScrollingCoordinator::frameViewHorizontalScrollbarLayerDidChange(FrameView*, GraphicsLayer*) +{ +} + +void ScrollingCoordinator::frameViewVerticalScrollbarLayerDidChange(FrameView*, GraphicsLayer*) +{ +} + +void ScrollingCoordinator::setScrollLayer(GraphicsLayer*) +{ +} + +void ScrollingCoordinator::setNonFastScrollableRegion(const Region&) +{ +} + +void ScrollingCoordinator::setScrollParameters(const ScrollParameters&) +{ +} + +void ScrollingCoordinator::setWheelEventHandlerCount(unsigned) +{ +} + +void ScrollingCoordinator::setShouldUpdateScrollLayerPositionOnMainThread(MainThreadScrollingReasons) +{ +} + +bool ScrollingCoordinator::supportsFixedPositionLayers() const +{ + return false; +} + +void ScrollingCoordinator::setLayerIsContainerForFixedPositionLayers(GraphicsLayer*, bool) +{ +} + +void ScrollingCoordinator::setLayerIsFixedToContainerLayer(GraphicsLayer*, bool) +{ +} + +void ScrollingCoordinator::scrollableAreaScrollLayerDidChange(ScrollableArea*, GraphicsLayer*) +{ +} +#endif // !ENABLE(THREADED_SCROLLING) + +} diff --git a/Source/WebCore/page/scrolling/ScrollingStateNode.cpp b/Source/WebCore/page/scrolling/ScrollingStateNode.cpp deleted file mode 100644 index 8c1a3836b..000000000 --- a/Source/WebCore/page/scrolling/ScrollingStateNode.cpp +++ /dev/null @@ -1,97 +0,0 @@ -/* - * 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 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. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "ScrollingStateNode.h" - -#include "ScrollingStateTree.h" - -#if ENABLE(THREADED_SCROLLING) - -namespace WebCore { - -ScrollingStateNode::ScrollingStateNode(ScrollingStateTree* scrollingStateTree, ScrollingNodeID nodeID) - : m_scrollingStateTree(scrollingStateTree) - , m_nodeID(nodeID) - , m_parent(0) - , m_scrollLayerDidChange(false) -{ -} - -// This copy constructor is used for cloning nodes in the tree, and it doesn't make sense -// to clone the relationship pointers, so don't copy that information from the original -// node. -ScrollingStateNode::ScrollingStateNode(ScrollingStateNode* stateNode) - : m_scrollingStateTree(0) - , m_nodeID(stateNode->scrollingNodeID()) - , m_parent(0) - , m_scrollLayerDidChange(stateNode->scrollLayerDidChange()) -{ - setScrollLayer(stateNode->platformScrollLayer()); -} - -ScrollingStateNode::~ScrollingStateNode() -{ -} - -void ScrollingStateNode::cloneAndResetChildNodes(ScrollingStateNode* clone) -{ - if (!m_children) - return; - - size_t size = m_children->size(); - for (size_t i = 0; i < size; ++i) - clone->appendChild(m_children->at(i)->cloneAndResetNode()); -} - -void ScrollingStateNode::appendChild(PassOwnPtr<ScrollingStateNode> childNode) -{ - childNode->setParent(this); - - if (!m_children) - m_children = adoptPtr(new Vector<OwnPtr<ScrollingStateNode> >); - - m_children->append(childNode); -} - -void ScrollingStateNode::removeChild(ScrollingStateNode* node) -{ - if (!m_children) - return; - - if (size_t index = m_children->find(node)) { - m_scrollingStateTree->didRemoveNode(node->scrollingNodeID()); - m_children->remove(index); - return; - } - - size_t size = m_children->size(); - for (size_t i = 0; i < size; ++i) - m_children->at(i)->removeChild(node); -} - -} // namespace WebCore - -#endif // ENABLE(THREADED_SCROLLING) diff --git a/Source/WebCore/page/scrolling/ScrollingStateNode.h b/Source/WebCore/page/scrolling/ScrollingStateNode.h deleted file mode 100644 index dc813ac10..000000000 --- a/Source/WebCore/page/scrolling/ScrollingStateNode.h +++ /dev/null @@ -1,104 +0,0 @@ -/* - * 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 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. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS 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 ScrollingStateNode_h -#define ScrollingStateNode_h - -#if ENABLE(THREADED_SCROLLING) - -#include "GraphicsLayer.h" -#include "ScrollingCoordinator.h" -#include <wtf/OwnPtr.h> -#include <wtf/PassOwnPtr.h> -#include <wtf/Vector.h> - -#if PLATFORM(MAC) -#include <wtf/RetainPtr.h> -#endif - -namespace WebCore { - -class ScrollingStateTree; - -class ScrollingStateNode { - WTF_MAKE_NONCOPYABLE(ScrollingStateNode); - -public: - ScrollingStateNode(ScrollingStateTree*, ScrollingNodeID); - virtual ~ScrollingStateNode(); - - virtual bool isScrollingStateScrollingNode() { return false; } - - virtual PassOwnPtr<ScrollingStateNode> cloneAndResetNode() = 0; - void cloneAndResetChildNodes(ScrollingStateNode*); - - virtual bool hasChangedProperties() const = 0; - virtual unsigned changedProperties() const = 0; - virtual void resetChangedProperties() = 0; - virtual void setHasChangedProperties() { setScrollLayerDidChange(true); } - - PlatformLayer* platformScrollLayer() const; - void setScrollLayer(const GraphicsLayer*); - void setScrollLayer(PlatformLayer*); - - bool scrollLayerDidChange() const { return m_scrollLayerDidChange; } - void setScrollLayerDidChange(bool scrollLayerDidChange) { m_scrollLayerDidChange = scrollLayerDidChange; } - - ScrollingStateTree* scrollingStateTree() const { return m_scrollingStateTree; } - void setScrollingStateTree(ScrollingStateTree* tree) { m_scrollingStateTree = tree; } - - ScrollingNodeID scrollingNodeID() const { return m_nodeID; } - - ScrollingStateNode* parent() const { return m_parent; } - void setParent(ScrollingStateNode* parent) { m_parent = parent; } - - void appendChild(PassOwnPtr<ScrollingStateNode>); - - void removeChild(ScrollingStateNode*); - -protected: - ScrollingStateNode(ScrollingStateNode*); - - ScrollingStateTree* m_scrollingStateTree; - -private: - ScrollingNodeID m_nodeID; - - ScrollingStateNode* m_parent; - OwnPtr<Vector<OwnPtr<ScrollingStateNode> > > m_children; - - bool m_scrollLayerDidChange; - -#if PLATFORM(MAC) - RetainPtr<PlatformLayer> m_platformScrollLayer; -#endif - -}; - -} // namespace WebCore - -#endif // ENABLE(THREADED_SCROLLING) - -#endif // ScrollingStateNode_h diff --git a/Source/WebCore/page/scrolling/ScrollingStateScrollingNode.cpp b/Source/WebCore/page/scrolling/ScrollingStateScrollingNode.cpp deleted file mode 100644 index 06ea4730f..000000000 --- a/Source/WebCore/page/scrolling/ScrollingStateScrollingNode.cpp +++ /dev/null @@ -1,228 +0,0 @@ -/* - * 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 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. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "ScrollingStateScrollingNode.h" - -#include "ScrollingStateTree.h" -#include <wtf/OwnPtr.h> - -#if ENABLE(THREADED_SCROLLING) - -namespace WebCore { - -PassOwnPtr<ScrollingStateScrollingNode> ScrollingStateScrollingNode::create(ScrollingStateTree* stateTree, ScrollingNodeID nodeID) -{ - return adoptPtr(new ScrollingStateScrollingNode(stateTree, nodeID)); -} - -ScrollingStateScrollingNode::ScrollingStateScrollingNode(ScrollingStateTree* stateTree, ScrollingNodeID nodeID) - : ScrollingStateNode(stateTree, nodeID) - , m_changedProperties(0) - , m_wheelEventHandlerCount(0) - , m_shouldUpdateScrollLayerPositionOnMainThread(0) - , m_horizontalScrollElasticity(ScrollElasticityNone) - , m_verticalScrollElasticity(ScrollElasticityNone) - , m_hasEnabledHorizontalScrollbar(false) - , m_hasEnabledVerticalScrollbar(false) - , m_requestedScrollPositionRepresentsProgrammaticScroll(false) - , m_horizontalScrollbarMode(ScrollbarAuto) - , m_verticalScrollbarMode(ScrollbarAuto) -{ -} - -ScrollingStateScrollingNode::ScrollingStateScrollingNode(ScrollingStateScrollingNode* stateNode) - : ScrollingStateNode(stateNode) - , m_changedProperties(stateNode->changedProperties()) - , m_viewportRect(stateNode->viewportRect()) - , m_contentsSize(stateNode->contentsSize()) - , m_nonFastScrollableRegion(stateNode->nonFastScrollableRegion()) - , m_wheelEventHandlerCount(stateNode->wheelEventHandlerCount()) - , m_shouldUpdateScrollLayerPositionOnMainThread(stateNode->shouldUpdateScrollLayerPositionOnMainThread()) - , m_horizontalScrollElasticity(stateNode->horizontalScrollElasticity()) - , m_verticalScrollElasticity(stateNode->verticalScrollElasticity()) - , m_hasEnabledHorizontalScrollbar(stateNode->hasEnabledHorizontalScrollbar()) - , m_hasEnabledVerticalScrollbar(stateNode->hasEnabledVerticalScrollbar()) - , m_requestedScrollPositionRepresentsProgrammaticScroll(stateNode->requestedScrollPositionRepresentsProgrammaticScroll()) - , m_horizontalScrollbarMode(stateNode->horizontalScrollbarMode()) - , m_verticalScrollbarMode(stateNode->verticalScrollbarMode()) - , m_requestedScrollPosition(stateNode->requestedScrollPosition()) - , m_scrollOrigin(stateNode->scrollOrigin()) -{ -} - -ScrollingStateScrollingNode::~ScrollingStateScrollingNode() -{ -} - -void ScrollingStateScrollingNode::setHasChangedProperties() -{ - m_changedProperties = All; - ScrollingStateNode::setHasChangedProperties(); -} - -PassOwnPtr<ScrollingStateNode> ScrollingStateScrollingNode::cloneAndResetNode() -{ - OwnPtr<ScrollingStateScrollingNode> clone = adoptPtr(new ScrollingStateScrollingNode(this)); - - // Now that this node is cloned, reset our change properties. - setScrollLayerDidChange(false); - resetChangedProperties(); - - cloneAndResetChildNodes(clone.get()); - return clone.release(); -} - -void ScrollingStateScrollingNode::setViewportRect(const IntRect& viewportRect) -{ - if (m_viewportRect == viewportRect) - return; - - m_viewportRect = viewportRect; - m_changedProperties |= ViewportRect; - m_scrollingStateTree->setHasChangedProperties(true); -} - -void ScrollingStateScrollingNode::setContentsSize(const IntSize& contentsSize) -{ - if (m_contentsSize == contentsSize) - return; - - m_contentsSize = contentsSize; - m_changedProperties |= ContentsSize; - m_scrollingStateTree->setHasChangedProperties(true); -} - -void ScrollingStateScrollingNode::setNonFastScrollableRegion(const Region& nonFastScrollableRegion) -{ - if (m_nonFastScrollableRegion == nonFastScrollableRegion) - return; - - m_nonFastScrollableRegion = nonFastScrollableRegion; - m_changedProperties |= NonFastScrollableRegion; - m_scrollingStateTree->setHasChangedProperties(true); -} - -void ScrollingStateScrollingNode::setWheelEventHandlerCount(unsigned wheelEventHandlerCount) -{ - if (m_wheelEventHandlerCount == wheelEventHandlerCount) - return; - - m_wheelEventHandlerCount = wheelEventHandlerCount; - m_changedProperties |= WheelEventHandlerCount; - m_scrollingStateTree->setHasChangedProperties(true); -} - -void ScrollingStateScrollingNode::setShouldUpdateScrollLayerPositionOnMainThread(MainThreadScrollingReasons reasons) -{ - if (m_shouldUpdateScrollLayerPositionOnMainThread == reasons) - return; - - m_shouldUpdateScrollLayerPositionOnMainThread = reasons; - m_changedProperties |= ShouldUpdateScrollLayerPositionOnMainThread; - m_scrollingStateTree->setHasChangedProperties(true); -} - -void ScrollingStateScrollingNode::setHorizontalScrollElasticity(ScrollElasticity horizontalScrollElasticity) -{ - if (m_horizontalScrollElasticity == horizontalScrollElasticity) - return; - - m_horizontalScrollElasticity = horizontalScrollElasticity; - m_changedProperties |= HorizontalScrollElasticity; - m_scrollingStateTree->setHasChangedProperties(true); -} - -void ScrollingStateScrollingNode::setVerticalScrollElasticity(ScrollElasticity verticalScrollElasticity) -{ - if (m_verticalScrollElasticity == verticalScrollElasticity) - return; - - m_verticalScrollElasticity = verticalScrollElasticity; - m_changedProperties |= VerticalScrollElasticity; - m_scrollingStateTree->setHasChangedProperties(true); -} - -void ScrollingStateScrollingNode::setHasEnabledHorizontalScrollbar(bool hasEnabledHorizontalScrollbar) -{ - if (m_hasEnabledHorizontalScrollbar == hasEnabledHorizontalScrollbar) - return; - - m_hasEnabledHorizontalScrollbar = hasEnabledHorizontalScrollbar; - m_changedProperties |= HasEnabledHorizontalScrollbar; - m_scrollingStateTree->setHasChangedProperties(true); -} - -void ScrollingStateScrollingNode::setHasEnabledVerticalScrollbar(bool hasEnabledVerticalScrollbar) -{ - if (m_hasEnabledVerticalScrollbar == hasEnabledVerticalScrollbar) - return; - - m_hasEnabledVerticalScrollbar = hasEnabledVerticalScrollbar; - m_changedProperties |= HasEnabledVerticalScrollbar; - m_scrollingStateTree->setHasChangedProperties(true); -} - -void ScrollingStateScrollingNode::setHorizontalScrollbarMode(ScrollbarMode horizontalScrollbarMode) -{ - if (m_horizontalScrollbarMode == horizontalScrollbarMode) - return; - - m_horizontalScrollbarMode = horizontalScrollbarMode; - m_changedProperties |= HorizontalScrollbarMode; - m_scrollingStateTree->setHasChangedProperties(true); -} - -void ScrollingStateScrollingNode::setVerticalScrollbarMode(ScrollbarMode verticalScrollbarMode) -{ - if (m_verticalScrollbarMode == verticalScrollbarMode) - return; - - m_verticalScrollbarMode = verticalScrollbarMode; - m_changedProperties |= VerticalScrollbarMode; - m_scrollingStateTree->setHasChangedProperties(true); -} - -void ScrollingStateScrollingNode::setRequestedScrollPosition(const IntPoint& requestedScrollPosition, bool representsProgrammaticScroll) -{ - m_requestedScrollPosition = requestedScrollPosition; - m_requestedScrollPositionRepresentsProgrammaticScroll = representsProgrammaticScroll; - m_changedProperties |= RequestedScrollPosition; - m_scrollingStateTree->setHasChangedProperties(true); -} - -void ScrollingStateScrollingNode::setScrollOrigin(const IntPoint& scrollOrigin) -{ - if (m_scrollOrigin == scrollOrigin) - return; - - m_scrollOrigin = scrollOrigin; - m_changedProperties |= ScrollOrigin; - m_scrollingStateTree->setHasChangedProperties(true); -} - -} // namespace WebCore - -#endif // ENABLE(THREADED_SCROLLING) diff --git a/Source/WebCore/page/scrolling/ScrollingStateTree.cpp b/Source/WebCore/page/scrolling/ScrollingStateTree.cpp deleted file mode 100644 index 850841e9a..000000000 --- a/Source/WebCore/page/scrolling/ScrollingStateTree.cpp +++ /dev/null @@ -1,93 +0,0 @@ -/* - * 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 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. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "ScrollingStateTree.h" - -#if ENABLE(THREADED_SCROLLING) - -namespace WebCore { - -PassOwnPtr<ScrollingStateTree> ScrollingStateTree::create() -{ - return adoptPtr(new ScrollingStateTree); -} - -ScrollingStateTree::ScrollingStateTree() - : m_hasChangedProperties(false) -{ -} - -ScrollingStateTree::~ScrollingStateTree() -{ -} - -PassOwnPtr<ScrollingStateTree> ScrollingStateTree::commit() -{ - // This function clones and resets the current state tree, but leaves the tree structure intact. - OwnPtr<ScrollingStateTree> treeStateClone = ScrollingStateTree::create(); - treeStateClone->setRootStateNode(static_pointer_cast<ScrollingStateScrollingNode>(m_rootStateNode->cloneAndResetNode())); - - // Copy the IDs of the nodes that have been removed since the last commit into the clone. - treeStateClone->m_nodesRemovedSinceLastCommit.swap(m_nodesRemovedSinceLastCommit); - - // Now the clone tree has changed properties, and the original tree does not. - treeStateClone->m_hasChangedProperties = true; - m_hasChangedProperties = false; - - return treeStateClone.release(); -} - -void ScrollingStateTree::removeNode(ScrollingStateNode* node) -{ - ASSERT(m_rootStateNode); - - if (node == m_rootStateNode) { - didRemoveNode(m_rootStateNode->scrollingNodeID()); - m_rootStateNode = 0; - return; - } - - m_rootStateNode->removeChild(node); -} - -void ScrollingStateTree::didRemoveNode(ScrollingNodeID nodeID) -{ - m_nodesRemovedSinceLastCommit.append(nodeID); -} - -void ScrollingStateTree::rootLayerDidChange() -{ - // If the root layer has changed, then destroyed and re-created the root state node. That means that the - // cached properties in ScrollingStateScrollingNode are no longer reflective of the properties we have - // cached over in the ScrollingTree. To resolve this, we will mark all of the properties as having changed - // so that the ScrollingTree will be in synch with the state tree. - setHasChangedProperties(true); - rootStateNode()->setHasChangedProperties(); -} - -} // namespace WebCore - -#endif // ENABLE(THREADED_SCROLLING) diff --git a/Source/WebCore/page/scrolling/ScrollingStateTree.h b/Source/WebCore/page/scrolling/ScrollingStateTree.h deleted file mode 100644 index fc5b73542..000000000 --- a/Source/WebCore/page/scrolling/ScrollingStateTree.h +++ /dev/null @@ -1,86 +0,0 @@ -/* - * 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 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. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS 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 ScrollingStateTree_h -#define ScrollingStateTree_h - -#if ENABLE(THREADED_SCROLLING) - -#include "ScrollingStateScrollingNode.h" -#include <wtf/OwnPtr.h> -#include <wtf/PassOwnPtr.h> -#include <wtf/RefPtr.h> - -namespace WebCore { - -// The ScrollingStateTree is a tree that managed ScrollingStateNodes. The nodes keep track of the current -// state of scrolling related properties. Whenever any properties change, the scrolling coordinator -// will be informed and will schedule a timer that will clone the new state tree and send it over to -// the scrolling thread, avoiding locking. - -// FIXME: Right now the scrolling thread only ever looks at the root node. In the future, it should -// look at the whole tree and build a ScrollingTree that mimics the ScrollingStateTree. - -// FIXME: Right now there is only one type of ScrollingStateNode, which is the ScrollingStateScrollingNode. -// It is currently used for the main frame, but in the future it should be able to be used for subframes -// and overflow areas. In the future, more classes will inherit from ScrollingStateNode, such as -// ScrollingStateFixedNode and ScrollingStateStickyNode for fixed position objects and sticky positoned -// objects, respectively. - -class ScrollingStateTree { -public: - static PassOwnPtr<ScrollingStateTree> create(); - ~ScrollingStateTree(); - - ScrollingStateScrollingNode* rootStateNode() const { return m_rootStateNode.get(); } - void setRootStateNode(PassOwnPtr<ScrollingStateScrollingNode> rootStateNode) { m_rootStateNode = rootStateNode; } - - // Copies the current tree state and clears the changed properties mask in the original. - PassOwnPtr<ScrollingStateTree> commit(); - - void removeNode(ScrollingStateNode*); - void didRemoveNode(ScrollingNodeID); - const Vector<ScrollingNodeID>& removedNodes() const { return m_nodesRemovedSinceLastCommit; } - - void rootLayerDidChange(); - - void setHasChangedProperties(bool changedProperties) { m_hasChangedProperties = changedProperties; } - bool hasChangedProperties() const { return m_hasChangedProperties; } - -private: - ScrollingStateTree(); - - PassOwnPtr<ScrollingStateTree> clone(); - - OwnPtr<ScrollingStateScrollingNode> m_rootStateNode; - Vector<ScrollingNodeID> m_nodesRemovedSinceLastCommit; - bool m_hasChangedProperties; -}; - -} // namespace WebCore - -#endif // ENABLE(THREADED_SCROLLING) - -#endif // ScrollingStateTree_h diff --git a/Source/WebCore/page/scrolling/ScrollingTree.cpp b/Source/WebCore/page/scrolling/ScrollingTree.cpp index f274f4704..690ec9225 100644 --- a/Source/WebCore/page/scrolling/ScrollingTree.cpp +++ b/Source/WebCore/page/scrolling/ScrollingTree.cpp @@ -30,11 +30,10 @@ #include "PlatformWheelEvent.h" #include "ScrollingCoordinator.h" -#include "ScrollingStateTree.h" #include "ScrollingThread.h" #include "ScrollingTreeNode.h" +#include "ScrollingTreeState.h" #include <wtf/MainThread.h> -#include <wtf/TemporaryChange.h> namespace WebCore { @@ -52,7 +51,6 @@ ScrollingTree::ScrollingTree(ScrollingCoordinator* scrollingCoordinator) , m_mainFramePinnedToTheLeft(false) , m_mainFramePinnedToTheRight(false) , m_scrollingPerformanceLoggingEnabled(false) - , m_isHandlingProgrammaticScroll(false) { } @@ -120,24 +118,22 @@ void ScrollingTree::invalidate() callOnMainThread(bind(derefScrollingCoordinator, m_scrollingCoordinator.release().leakRef())); } -void ScrollingTree::commitNewTreeState(PassOwnPtr<ScrollingStateTree> scrollingStateTree) +void ScrollingTree::commitNewTreeState(PassOwnPtr<ScrollingTreeState> scrollingTreeState) { ASSERT(ScrollingThread::isCurrentThread()); - if (scrollingStateTree->rootStateNode()->changedProperties() & (ScrollingStateScrollingNode::WheelEventHandlerCount | ScrollingStateScrollingNode::NonFastScrollableRegion) || scrollingStateTree->rootStateNode()->scrollLayerDidChange()) { + if (scrollingTreeState->changedProperties() & (ScrollingTreeState::WheelEventHandlerCount | ScrollingTreeState::NonFastScrollableRegion | ScrollingTreeState::ScrollLayer)) { MutexLocker lock(m_mutex); - if (scrollingStateTree->rootStateNode()->scrollLayerDidChange()) + if (scrollingTreeState->changedProperties() & ScrollingTreeState::ScrollLayer) m_mainFrameScrollPosition = IntPoint(); - if (scrollingStateTree->rootStateNode()->changedProperties() & ScrollingStateScrollingNode::WheelEventHandlerCount) - m_hasWheelEventHandlers = scrollingStateTree->rootStateNode()->wheelEventHandlerCount(); - if (scrollingStateTree->rootStateNode()->changedProperties() & ScrollingStateScrollingNode::NonFastScrollableRegion) - m_nonFastScrollableRegion = scrollingStateTree->rootStateNode()->nonFastScrollableRegion(); + if (scrollingTreeState->changedProperties() & ScrollingTreeState::WheelEventHandlerCount) + m_hasWheelEventHandlers = scrollingTreeState->wheelEventHandlerCount(); + if (scrollingTreeState->changedProperties() & ScrollingTreeState::NonFastScrollableRegion) + m_nonFastScrollableRegion = scrollingTreeState->nonFastScrollableRegion(); } - - TemporaryChange<bool> changeHandlingProgrammaticScroll(m_isHandlingProgrammaticScroll, scrollingStateTree->rootStateNode()->requestedScrollPositionRepresentsProgrammaticScroll()); - m_rootNode->update(scrollingStateTree->rootStateNode()); + m_rootNode->update(scrollingTreeState.get()); updateDebugRootLayer(); } @@ -160,7 +156,7 @@ void ScrollingTree::updateMainFrameScrollPosition(const IntPoint& scrollPosition m_mainFrameScrollPosition = scrollPosition; } - callOnMainThread(bind(&ScrollingCoordinator::updateMainFrameScrollPosition, m_scrollingCoordinator.get(), scrollPosition, m_isHandlingProgrammaticScroll)); + callOnMainThread(bind(&ScrollingCoordinator::updateMainFrameScrollPosition, m_scrollingCoordinator.get(), scrollPosition)); } IntPoint ScrollingTree::mainFrameScrollPosition() diff --git a/Source/WebCore/page/scrolling/ScrollingTree.h b/Source/WebCore/page/scrolling/ScrollingTree.h index 35e7b02e6..40705a0fc 100644 --- a/Source/WebCore/page/scrolling/ScrollingTree.h +++ b/Source/WebCore/page/scrolling/ScrollingTree.h @@ -47,7 +47,7 @@ namespace WebCore { class IntPoint; class ScrollingCoordinator; class ScrollingTreeNode; -class ScrollingStateTree; +class ScrollingTreeState; // The ScrollingTree class lives almost exclusively on the scrolling thread and manages the // hierarchy of scrollable regions on the page. It's also responsible for dispatching events @@ -76,7 +76,7 @@ public: void handleWheelEvent(const PlatformWheelEvent&); void invalidate(); - void commitNewTreeState(PassOwnPtr<ScrollingStateTree>); + void commitNewTreeState(PassOwnPtr<ScrollingTreeState>); void setMainFramePinState(bool pinnedToTheLeft, bool pinnedToTheRight); @@ -120,8 +120,6 @@ private: bool m_mainFramePinnedToTheRight; bool m_scrollingPerformanceLoggingEnabled; - - bool m_isHandlingProgrammaticScroll; #if PLATFORM(MAC) RetainPtr<CALayer> m_debugInfoLayer; diff --git a/Source/WebCore/page/scrolling/ScrollingTreeNode.cpp b/Source/WebCore/page/scrolling/ScrollingTreeNode.cpp index 79321ae8c..252c57708 100644 --- a/Source/WebCore/page/scrolling/ScrollingTreeNode.cpp +++ b/Source/WebCore/page/scrolling/ScrollingTreeNode.cpp @@ -28,7 +28,7 @@ #if ENABLE(THREADED_SCROLLING) -#include "ScrollingStateTree.h" +#include "ScrollingTreeState.h" namespace WebCore { @@ -48,36 +48,36 @@ ScrollingTreeNode::~ScrollingTreeNode() { } -void ScrollingTreeNode::update(ScrollingStateScrollingNode* state) +void ScrollingTreeNode::update(ScrollingTreeState* state) { - if (state->changedProperties() & ScrollingStateScrollingNode::ViewportRect) + if (state->changedProperties() & ScrollingTreeState::ViewportRect) m_viewportRect = state->viewportRect(); - if (state->changedProperties() & ScrollingStateScrollingNode::ContentsSize) + if (state->changedProperties() & ScrollingTreeState::ContentsSize) m_contentsSize = state->contentsSize(); - if (state->changedProperties() & ScrollingStateScrollingNode::ShouldUpdateScrollLayerPositionOnMainThread) + if (state->changedProperties() & ScrollingTreeState::ShouldUpdateScrollLayerPositionOnMainThread) m_shouldUpdateScrollLayerPositionOnMainThread = state->shouldUpdateScrollLayerPositionOnMainThread(); - if (state->changedProperties() & ScrollingStateScrollingNode::HorizontalScrollElasticity) + if (state->changedProperties() & ScrollingTreeState::HorizontalScrollElasticity) m_horizontalScrollElasticity = state->horizontalScrollElasticity(); - if (state->changedProperties() & ScrollingStateScrollingNode::VerticalScrollElasticity) + if (state->changedProperties() & ScrollingTreeState::VerticalScrollElasticity) m_verticalScrollElasticity = state->verticalScrollElasticity(); - if (state->changedProperties() & ScrollingStateScrollingNode::HasEnabledHorizontalScrollbar) + if (state->changedProperties() & ScrollingTreeState::HasEnabledHorizontalScrollbar) m_hasEnabledHorizontalScrollbar = state->hasEnabledHorizontalScrollbar(); - if (state->changedProperties() & ScrollingStateScrollingNode::HasEnabledVerticalScrollbar) + if (state->changedProperties() & ScrollingTreeState::HasEnabledVerticalScrollbar) m_hasEnabledVerticalScrollbar = state->hasEnabledVerticalScrollbar(); - if (state->changedProperties() & ScrollingStateScrollingNode::HorizontalScrollbarMode) + if (state->changedProperties() & ScrollingTreeState::HorizontalScrollbarMode) m_horizontalScrollbarMode = state->horizontalScrollbarMode(); - if (state->changedProperties() & ScrollingStateScrollingNode::VerticalScrollbarMode) + if (state->changedProperties() & ScrollingTreeState::VerticalScrollbarMode) m_verticalScrollbarMode = state->verticalScrollbarMode(); - if (state->changedProperties() & ScrollingStateScrollingNode::ScrollOrigin) + if (state->changedProperties() & ScrollingTreeState::ScrollOrigin) m_scrollOrigin = state->scrollOrigin(); } diff --git a/Source/WebCore/page/scrolling/ScrollingTreeNode.h b/Source/WebCore/page/scrolling/ScrollingTreeNode.h index 6df7321b2..0feb253e9 100644 --- a/Source/WebCore/page/scrolling/ScrollingTreeNode.h +++ b/Source/WebCore/page/scrolling/ScrollingTreeNode.h @@ -37,14 +37,14 @@ namespace WebCore { class PlatformWheelEvent; class ScrollingTree; -class ScrollingStateScrollingNode; +class ScrollingTreeState; class ScrollingTreeNode { public: static PassOwnPtr<ScrollingTreeNode> create(ScrollingTree*); virtual ~ScrollingTreeNode(); - virtual void update(ScrollingStateScrollingNode*); + virtual void update(ScrollingTreeState*); virtual void handleWheelEvent(const PlatformWheelEvent&) = 0; virtual void setScrollPosition(const IntPoint&) = 0; diff --git a/Source/WebCore/page/scrolling/ScrollingTreeState.cpp b/Source/WebCore/page/scrolling/ScrollingTreeState.cpp new file mode 100644 index 000000000..3197961e8 --- /dev/null +++ b/Source/WebCore/page/scrolling/ScrollingTreeState.cpp @@ -0,0 +1,179 @@ +/* + * 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 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. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "ScrollingTreeState.h" + +#if ENABLE(THREADED_SCROLLING) + +namespace WebCore { + +PassOwnPtr<ScrollingTreeState> ScrollingTreeState::create() +{ + return adoptPtr(new ScrollingTreeState); +} + +ScrollingTreeState::ScrollingTreeState() + : m_changedProperties(0) + , m_wheelEventHandlerCount(0) + , m_shouldUpdateScrollLayerPositionOnMainThread(0) + , m_horizontalScrollElasticity(ScrollElasticityNone) + , m_verticalScrollElasticity(ScrollElasticityNone) + , m_hasEnabledHorizontalScrollbar(false) + , m_hasEnabledVerticalScrollbar(false) + , m_horizontalScrollbarMode(ScrollbarAuto) + , m_verticalScrollbarMode(ScrollbarAuto) +{ +} + +ScrollingTreeState::~ScrollingTreeState() +{ +} + +void ScrollingTreeState::setViewportRect(const IntRect& viewportRect) +{ + if (m_viewportRect == viewportRect) + return; + + m_viewportRect = viewportRect; + m_changedProperties |= ViewportRect; +} + +void ScrollingTreeState::setContentsSize(const IntSize& contentsSize) +{ + if (m_contentsSize == contentsSize) + return; + + m_contentsSize = contentsSize; + m_changedProperties |= ContentsSize; +} + +void ScrollingTreeState::setNonFastScrollableRegion(const Region& nonFastScrollableRegion) +{ + if (m_nonFastScrollableRegion == nonFastScrollableRegion) + return; + + m_nonFastScrollableRegion = nonFastScrollableRegion; + m_changedProperties |= NonFastScrollableRegion; +} + +void ScrollingTreeState::setWheelEventHandlerCount(unsigned wheelEventHandlerCount) +{ + if (m_wheelEventHandlerCount == wheelEventHandlerCount) + return; + + m_wheelEventHandlerCount = wheelEventHandlerCount; + m_changedProperties |= WheelEventHandlerCount; +} + +void ScrollingTreeState::setShouldUpdateScrollLayerPositionOnMainThread(MainThreadScrollingReasons reasons) +{ + if (m_shouldUpdateScrollLayerPositionOnMainThread == reasons) + return; + + m_shouldUpdateScrollLayerPositionOnMainThread = reasons; + m_changedProperties |= ShouldUpdateScrollLayerPositionOnMainThread; +} + +void ScrollingTreeState::setHorizontalScrollElasticity(ScrollElasticity horizontalScrollElasticity) +{ + if (m_horizontalScrollElasticity == horizontalScrollElasticity) + return; + + m_horizontalScrollElasticity = horizontalScrollElasticity; + m_changedProperties |= HorizontalScrollElasticity; +} + +void ScrollingTreeState::setVerticalScrollElasticity(ScrollElasticity verticalScrollElasticity) +{ + if (m_verticalScrollElasticity == verticalScrollElasticity) + return; + + m_verticalScrollElasticity = verticalScrollElasticity; + m_changedProperties |= VerticalScrollElasticity; +} + +void ScrollingTreeState::setHasEnabledHorizontalScrollbar(bool hasEnabledHorizontalScrollbar) +{ + if (m_hasEnabledHorizontalScrollbar == hasEnabledHorizontalScrollbar) + return; + + m_hasEnabledHorizontalScrollbar = hasEnabledHorizontalScrollbar; + m_changedProperties |= HasEnabledHorizontalScrollbar; +} + +void ScrollingTreeState::setHasEnabledVerticalScrollbar(bool hasEnabledVerticalScrollbar) +{ + if (m_hasEnabledVerticalScrollbar == hasEnabledVerticalScrollbar) + return; + + m_hasEnabledVerticalScrollbar = hasEnabledVerticalScrollbar; + m_changedProperties |= HasEnabledVerticalScrollbar; +} + +void ScrollingTreeState::setHorizontalScrollbarMode(ScrollbarMode horizontalScrollbarMode) +{ + if (m_horizontalScrollbarMode == horizontalScrollbarMode) + return; + + m_horizontalScrollbarMode = horizontalScrollbarMode; + m_changedProperties |= HorizontalScrollbarMode; +} + +void ScrollingTreeState::setVerticalScrollbarMode(ScrollbarMode verticalScrollbarMode) +{ + if (m_verticalScrollbarMode == verticalScrollbarMode) + return; + + m_verticalScrollbarMode = verticalScrollbarMode; + m_changedProperties |= VerticalScrollbarMode; +} + +void ScrollingTreeState::setRequestedScrollPosition(const IntPoint& requestedScrollPosition) +{ + m_requestedScrollPosition = requestedScrollPosition; + m_changedProperties |= RequestedScrollPosition; +} + +void ScrollingTreeState::setScrollOrigin(const IntPoint& scrollOrigin) +{ + if (m_scrollOrigin == scrollOrigin) + return; + + m_scrollOrigin = scrollOrigin; + m_changedProperties |= ScrollOrigin; +} + +PassOwnPtr<ScrollingTreeState> ScrollingTreeState::commit() +{ + OwnPtr<ScrollingTreeState> treeState = adoptPtr(new ScrollingTreeState(*this)); + m_changedProperties = 0; + + return treeState.release(); +} + +} // namespace WebCore + +#endif // ENABLE(THREADED_SCROLLING) diff --git a/Source/WebCore/page/scrolling/ScrollingStateScrollingNode.h b/Source/WebCore/page/scrolling/ScrollingTreeState.h index ba9f6475e..4000cce2e 100644 --- a/Source/WebCore/page/scrolling/ScrollingStateScrollingNode.h +++ b/Source/WebCore/page/scrolling/ScrollingTreeState.h @@ -23,24 +23,32 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef ScrollingStateScrollingNode_h -#define ScrollingStateScrollingNode_h +#ifndef ScrollingTreeState_h +#define ScrollingTreeState_h #if ENABLE(THREADED_SCROLLING) +#include "GraphicsLayer.h" #include "IntRect.h" #include "Region.h" #include "ScrollTypes.h" #include "ScrollingCoordinator.h" -#include "ScrollingStateNode.h" #include <wtf/PassOwnPtr.h> +#if PLATFORM(MAC) +#include <wtf/RetainPtr.h> +#endif + namespace WebCore { -class ScrollingStateScrollingNode : public ScrollingStateNode { +// The ScrollingTreeState object keeps track of the current state of scrolling related properties. +// Whenever any properties change, the scrolling coordinator will be informed and will update the state +// and schedule a timer that will clone the new state and send it over to the scrolling thread, avoiding locking. +// FIXME: Once we support fast scrolling in subframes, this will have to become a tree-like structure. +class ScrollingTreeState { public: - static PassOwnPtr<ScrollingStateScrollingNode> create(ScrollingStateTree*, ScrollingNodeID); - virtual ~ScrollingStateScrollingNode(); + static PassOwnPtr<ScrollingTreeState> create(); + ~ScrollingTreeState(); enum ChangedProperty { ViewportRect = 1 << 0, @@ -55,18 +63,12 @@ public: HorizontalScrollbarMode = 1 << 9, VerticalScrollbarMode = 1 << 10, ScrollOrigin = 1 << 11, - RequestedScrollPosition = 1 << 12, - All = (1 << 13) - 1 // This will need to be updated if we add or remove anything the ChangedProperties. + ScrollLayer = 1 << 12, + RequestedScrollPosition = 1 << 13, }; - virtual bool isScrollingStateScrollingNode() OVERRIDE { return true; } - - virtual PassOwnPtr<ScrollingStateNode> cloneAndResetNode() OVERRIDE; - - virtual bool hasChangedProperties() const OVERRIDE { return m_changedProperties; } - virtual unsigned changedProperties() const OVERRIDE { return m_changedProperties; } - virtual void resetChangedProperties() OVERRIDE { m_changedProperties = 0; } - virtual void setHasChangedProperties(); + bool hasChangedProperties() const { return m_changedProperties; } + unsigned changedProperties() const { return m_changedProperties; } const IntRect& viewportRect() const { return m_viewportRect; } void setViewportRect(const IntRect&); @@ -101,17 +103,20 @@ public: ScrollbarMode verticalScrollbarMode() const { return m_verticalScrollbarMode; } void setVerticalScrollbarMode(ScrollbarMode); + PlatformLayer* platformScrollLayer() const; + void setScrollLayer(const GraphicsLayer*); + const IntPoint& requestedScrollPosition() const { return m_requestedScrollPosition; } - void setRequestedScrollPosition(const IntPoint&, bool representsProgrammaticScroll); + void setRequestedScrollPosition(const IntPoint&); const IntPoint& scrollOrigin() const { return m_scrollOrigin; } void setScrollOrigin(const IntPoint&); - bool requestedScrollPositionRepresentsProgrammaticScroll() const { return m_requestedScrollPositionRepresentsProgrammaticScroll; } + // Copies the current tree state and clears the changed properties mask in the original. + PassOwnPtr<ScrollingTreeState> commit(); private: - ScrollingStateScrollingNode(ScrollingStateTree*, ScrollingNodeID); - ScrollingStateScrollingNode(ScrollingStateScrollingNode*); + ScrollingTreeState(); unsigned m_changedProperties; @@ -129,26 +134,21 @@ private: bool m_hasEnabledHorizontalScrollbar; bool m_hasEnabledVerticalScrollbar; - bool m_requestedScrollPositionRepresentsProgrammaticScroll; ScrollbarMode m_horizontalScrollbarMode; ScrollbarMode m_verticalScrollbarMode; IntPoint m_requestedScrollPosition; IntPoint m_scrollOrigin; -}; -inline ScrollingStateScrollingNode* toScrollingStateScrollingNode(ScrollingStateNode* node) -{ - ASSERT(!node || node->isScrollingStateScrollingNode()); - return static_cast<ScrollingStateScrollingNode*>(node); -} - -// This will catch anyone doing an unnecessary cast. -void toScrollingStateScrollingNode(const ScrollingStateScrollingNode*); +#if PLATFORM(MAC) + RetainPtr<PlatformLayer> m_platformScrollLayer; +#endif + +}; } // namespace WebCore #endif // ENABLE(THREADED_SCROLLING) -#endif // ScrollingStateScrollingNode_h +#endif // ScrollingTreeState_h diff --git a/Source/WebCore/page/scrolling/chromium/ScrollingCoordinatorChromium.cpp b/Source/WebCore/page/scrolling/chromium/ScrollingCoordinatorChromium.cpp index 9743289c1..aa056ad32 100644 --- a/Source/WebCore/page/scrolling/chromium/ScrollingCoordinatorChromium.cpp +++ b/Source/WebCore/page/scrolling/chromium/ScrollingCoordinatorChromium.cpp @@ -25,7 +25,7 @@ #include "config.h" -#include "ScrollingCoordinatorChromium.h" +#include "ScrollingCoordinator.h" #include "Frame.h" #include "FrameView.h" @@ -95,32 +95,33 @@ private: OwnPtr<WebScrollbarLayer> m_verticalScrollbarLayer; }; -ScrollingCoordinatorChromium::ScrollingCoordinatorChromium(Page* page) - : ScrollingCoordinator(page) - , m_private(new ScrollingCoordinatorPrivate) +PassRefPtr<ScrollingCoordinator> ScrollingCoordinator::create(Page* page) { + RefPtr<ScrollingCoordinator> coordinator(adoptRef(new ScrollingCoordinator(page))); + coordinator->m_private = new ScrollingCoordinatorPrivate; + return coordinator.release(); } -ScrollingCoordinatorChromium::~ScrollingCoordinatorChromium() +ScrollingCoordinator::~ScrollingCoordinator() { + ASSERT(!m_page); delete m_private; } -void ScrollingCoordinatorChromium::frameViewLayoutUpdated(FrameView*) +static GraphicsLayer* scrollLayerForFrameView(FrameView* frameView) { - ASSERT(m_page); - - // Compute the region of the page that we can't do fast scrolling for. This currently includes - // all scrollable areas, such as subframes, overflow divs and list boxes. We need to do this even if the - // frame view whose layout was updated is not the main frame. - Region nonFastScrollableRegion = computeNonFastScrollableRegion(m_page->mainFrame(), IntPoint()); - setNonFastScrollableRegion(nonFastScrollableRegion); -} - -void ScrollingCoordinatorChromium::frameViewRootLayerDidChange(FrameView* frameView) -{ - ScrollingCoordinator::frameViewRootLayerDidChange(frameView); - setScrollLayer(scrollLayerForFrameView(frameView)); +#if USE(ACCELERATED_COMPOSITING) + Frame* frame = frameView->frame(); + if (!frame) + return 0; + + RenderView* renderView = frame->contentRenderer(); + if (!renderView) + return 0; + return renderView->compositor()->scrollLayer(); +#else + return 0; +#endif } static WebLayer* scrollableLayerForGraphicsLayer(GraphicsLayer* layer) @@ -128,7 +129,7 @@ static WebLayer* scrollableLayerForGraphicsLayer(GraphicsLayer* layer) return layer->platformLayer(); } -PassOwnPtr<WebScrollbarLayer> ScrollingCoordinatorChromium::createScrollbarLayer(Scrollbar* scrollbar, WebLayer* scrollLayer, GraphicsLayer* scrollbarGraphicsLayer, FrameView* frameView) +static PassOwnPtr<WebScrollbarLayer> createScrollbarLayer(Scrollbar* scrollbar, WebLayer* scrollLayer, GraphicsLayer* scrollbarGraphicsLayer, FrameView* frameView) { ASSERT(scrollbar); ASSERT(scrollbarGraphicsLayer); @@ -173,7 +174,7 @@ PassOwnPtr<WebScrollbarLayer> ScrollingCoordinatorChromium::createScrollbarLayer return scrollbarLayer.release(); } -void ScrollingCoordinatorChromium::frameViewHorizontalScrollbarLayerDidChange(FrameView* frameView, GraphicsLayer* horizontalScrollbarLayer) +void ScrollingCoordinator::frameViewHorizontalScrollbarLayerDidChange(FrameView* frameView, GraphicsLayer* horizontalScrollbarLayer) { if (!horizontalScrollbarLayer || !coordinatesScrollingForFrameView(frameView)) return; @@ -182,7 +183,7 @@ void ScrollingCoordinatorChromium::frameViewHorizontalScrollbarLayerDidChange(Fr m_private->setHorizontalScrollbarLayer(createScrollbarLayer(frameView->horizontalScrollbar(), m_private->scrollLayer(), horizontalScrollbarLayer, frameView)); } -void ScrollingCoordinatorChromium::frameViewVerticalScrollbarLayerDidChange(FrameView* frameView, GraphicsLayer* verticalScrollbarLayer) +void ScrollingCoordinator::frameViewVerticalScrollbarLayerDidChange(FrameView* frameView, GraphicsLayer* verticalScrollbarLayer) { if (!verticalScrollbarLayer || !coordinatesScrollingForFrameView(frameView)) return; @@ -191,12 +192,12 @@ void ScrollingCoordinatorChromium::frameViewVerticalScrollbarLayerDidChange(Fram m_private->setVerticalScrollbarLayer(createScrollbarLayer(frameView->verticalScrollbar(), m_private->scrollLayer(), verticalScrollbarLayer, frameView)); } -void ScrollingCoordinatorChromium::setScrollLayer(GraphicsLayer* scrollLayer) +void ScrollingCoordinator::setScrollLayer(GraphicsLayer* scrollLayer) { m_private->setScrollLayer(scrollLayer ? scrollableLayerForGraphicsLayer(scrollLayer) : 0); } -void ScrollingCoordinatorChromium::setNonFastScrollableRegion(const Region& region) +void ScrollingCoordinator::setNonFastScrollableRegion(const Region& region) { // We won't necessarily get a setScrollLayer() call before this one, so grab the root ourselves. setScrollLayer(scrollLayerForFrameView(m_page->mainFrame()->view())); @@ -209,7 +210,12 @@ void ScrollingCoordinatorChromium::setNonFastScrollableRegion(const Region& regi } } -void ScrollingCoordinatorChromium::setWheelEventHandlerCount(unsigned wheelEventHandlerCount) +void ScrollingCoordinator::setScrollParameters(const ScrollParameters&) +{ + // FIXME: Implement! +} + +void ScrollingCoordinator::setWheelEventHandlerCount(unsigned wheelEventHandlerCount) { // We won't necessarily get a setScrollLayer() call before this one, so grab the root ourselves. setScrollLayer(scrollLayerForFrameView(m_page->mainFrame()->view())); @@ -217,7 +223,7 @@ void ScrollingCoordinatorChromium::setWheelEventHandlerCount(unsigned wheelEvent m_private->scrollLayer()->setHaveWheelEventHandlers(wheelEventHandlerCount > 0); } -void ScrollingCoordinatorChromium::setShouldUpdateScrollLayerPositionOnMainThread(MainThreadScrollingReasons reasons) +void ScrollingCoordinator::setShouldUpdateScrollLayerPositionOnMainThread(MainThreadScrollingReasons reasons) { // We won't necessarily get a setScrollLayer() call before this one, so grab the root ourselves. setScrollLayer(scrollLayerForFrameView(m_page->mainFrame()->view())); @@ -225,19 +231,24 @@ void ScrollingCoordinatorChromium::setShouldUpdateScrollLayerPositionOnMainThrea m_private->scrollLayer()->setShouldScrollOnMainThread(reasons); } -void ScrollingCoordinatorChromium::setLayerIsContainerForFixedPositionLayers(GraphicsLayer* layer, bool enable) +bool ScrollingCoordinator::supportsFixedPositionLayers() const +{ + return true; +} + +void ScrollingCoordinator::setLayerIsContainerForFixedPositionLayers(GraphicsLayer* layer, bool enable) { if (WebLayer* scrollableLayer = scrollableLayerForGraphicsLayer(layer)) scrollableLayer->setIsContainerForFixedPositionLayers(enable); } -void ScrollingCoordinatorChromium::setLayerIsFixedToContainerLayer(GraphicsLayer* layer, bool enable) +void ScrollingCoordinator::setLayerIsFixedToContainerLayer(GraphicsLayer* layer, bool enable) { if (WebLayer* scrollableLayer = scrollableLayerForGraphicsLayer(layer)) scrollableLayer->setFixedToContainerLayer(enable); } -void ScrollingCoordinatorChromium::scrollableAreaScrollLayerDidChange(ScrollableArea* scrollableArea, GraphicsLayer* scrollLayer) +void ScrollingCoordinator::scrollableAreaScrollLayerDidChange(ScrollableArea* scrollableArea, GraphicsLayer* scrollLayer) { if (!scrollLayer) return; @@ -251,10 +262,4 @@ void ScrollingCoordinatorChromium::scrollableAreaScrollLayerDidChange(Scrollable } } -void ScrollingCoordinatorChromium::recomputeWheelEventHandlerCountForFrameView(FrameView* frameView) -{ - UNUSED_PARAM(frameView); - setWheelEventHandlerCount(computeCurrentWheelEventHandlerCount()); -} - } diff --git a/Source/WebCore/page/scrolling/chromium/ScrollingCoordinatorChromium.h b/Source/WebCore/page/scrolling/chromium/ScrollingCoordinatorChromium.h deleted file mode 100644 index f6948e240..000000000 --- a/Source/WebCore/page/scrolling/chromium/ScrollingCoordinatorChromium.h +++ /dev/null @@ -1,85 +0,0 @@ -/* - * 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 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. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS 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 ScrollingCoordinatorChromium_h -#define ScrollingCoordinatorChromium_h - -#include "ScrollingCoordinator.h" - -namespace WebKit { -class WebScrollbarLayer; -class WebLayer; -} - -namespace WebCore { - -class Scrollbar; -class ScrollingCoordinatorPrivate; - -class ScrollingCoordinatorChromium : public ScrollingCoordinator { -public: - explicit ScrollingCoordinatorChromium(Page*); - virtual ~ScrollingCoordinatorChromium(); - - // Should be called whenever the given frame view has been laid out. - virtual void frameViewLayoutUpdated(FrameView*); - - // Should be called whenever the root layer for the given frame view changes. - virtual void frameViewRootLayerDidChange(FrameView*); - - // Should be called whenever the horizontal scrollbar layer for the given frame view changes. - virtual void frameViewHorizontalScrollbarLayerDidChange(FrameView*, GraphicsLayer*); - - // Should be called whenever the vertical scrollbar layer for the given frame view changes. - virtual void frameViewVerticalScrollbarLayerDidChange(FrameView*, GraphicsLayer*); - - // Return whether this scrolling coordinator can keep fixed position layers fixed to their - // containers while scrolling. - virtual bool supportsFixedPositionLayers() const { return true; } - - // Mark/unmark a layer as a container for fixed position layers. - virtual void setLayerIsContainerForFixedPositionLayers(GraphicsLayer*, bool); - - // Attach/detach layer position to ancestor fixed position container. - virtual void setLayerIsFixedToContainerLayer(GraphicsLayer*, bool); - - // Should be called whenever the scrollable layer for the given scroll area changes. - virtual void scrollableAreaScrollLayerDidChange(ScrollableArea*, GraphicsLayer*); - -private: - virtual void recomputeWheelEventHandlerCountForFrameView(FrameView*); - virtual void setShouldUpdateScrollLayerPositionOnMainThread(MainThreadScrollingReasons); - - void setScrollLayer(GraphicsLayer*); - void setNonFastScrollableRegion(const Region&); - void setWheelEventHandlerCount(unsigned); - PassOwnPtr<WebKit::WebScrollbarLayer> createScrollbarLayer(Scrollbar*, WebKit::WebLayer* scrollLayer, GraphicsLayer* scrollbarGraphicsLayer, FrameView*); - - ScrollingCoordinatorPrivate* m_private; -}; - -} // namespace WebCore - -#endif // ScrollingCoordinatorChromium_h diff --git a/Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.h b/Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.h deleted file mode 100644 index c0d617fa9..000000000 --- a/Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.h +++ /dev/null @@ -1,121 +0,0 @@ -/* - * 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 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. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS 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 ScrollingCoordinatorMac_h -#define ScrollingCoordinatorMac_h - -#if ENABLE(THREADED_SCROLLING) - -#include "ScrollingCoordinator.h" - -namespace WebCore { - -class ScrollingCoordinatorMac : public ScrollingCoordinator { -public: - explicit ScrollingCoordinatorMac(Page*); - virtual ~ScrollingCoordinatorMac(); - - virtual void pageDestroyed(); - - virtual ScrollingTree* scrollingTree() const; - virtual void commitTreeStateIfNeeded(); - - // Should be called whenever the given frame view has been laid out. - virtual void frameViewLayoutUpdated(FrameView*); - - // Should be called whenever the root layer for the given frame view changes. - virtual void frameViewRootLayerDidChange(FrameView*); - - // Should be called whenever the horizontal scrollbar layer for the given frame view changes. - virtual void frameViewHorizontalScrollbarLayerDidChange(FrameView*, GraphicsLayer* horizontalScrollbarLayer); - - // Should be called whenever the vertical scrollbar layer for the given frame view changes. - virtual void frameViewVerticalScrollbarLayerDidChange(FrameView*, GraphicsLayer* verticalScrollbarLayer); - - // Requests that the scrolling coordinator updates the scroll position of the given frame view. If this function returns true, it means that the - // position will be updated asynchronously. If it returns false, the caller should update the scrolling position itself. - virtual bool requestScrollPositionUpdate(FrameView*, const IntPoint&); - - // Handle the wheel event on the scrolling thread. Returns whether the event was handled or not. - virtual bool handleWheelEvent(FrameView*, const PlatformWheelEvent&); - - // Dispatched by the scrolling tree whenever the main frame scroll position changes and the scroll layer position needs to be updated as well. - virtual void updateMainFrameScrollPositionAndScrollLayerPosition(); - - // These functions are used to indicate that a layer should be (or should not longer be) represented by a node - // in the scrolling tree. - virtual ScrollingNodeID attachToStateTree(ScrollingNodeID); - virtual void detachFromStateTree(ScrollingNodeID); - - // This function wipes out the current tree. - virtual void clearStateTree(); - -private: - virtual void recomputeWheelEventHandlerCountForFrameView(FrameView*); - virtual void setShouldUpdateScrollLayerPositionOnMainThread(MainThreadScrollingReasons); - - void ensureRootStateNodeForFrameView(FrameView*); - ScrollingStateScrollingNode* stateNodeForID(ScrollingNodeID); - - struct ScrollParameters { - ScrollElasticity horizontalScrollElasticity; - ScrollElasticity verticalScrollElasticity; - - bool hasEnabledHorizontalScrollbar; - bool hasEnabledVerticalScrollbar; - - ScrollbarMode horizontalScrollbarMode; - ScrollbarMode verticalScrollbarMode; - - IntPoint scrollOrigin; - - IntRect viewportRect; - IntSize contentsSize; - }; - - void setScrollParametersForNode(const ScrollParameters&, ScrollingStateScrollingNode*); - void setScrollLayerForNode(GraphicsLayer*, ScrollingStateNode*); - void setNonFastScrollableRegionForNode(const Region&, ScrollingStateScrollingNode*); - void setWheelEventHandlerCountForNode(unsigned, ScrollingStateScrollingNode*); - - void updateMainFrameScrollLayerPosition(); - - void scheduleTreeStateCommit(); - - void scrollingStateTreeCommitterTimerFired(Timer<ScrollingCoordinatorMac>*); - void commitTreeState(); - - OwnPtr<ScrollingStateTree> m_scrollingStateTree; - RefPtr<ScrollingTree> m_scrollingTree; - Timer<ScrollingCoordinatorMac> m_scrollingStateTreeCommitterTimer; - - HashMap<ScrollingNodeID, ScrollingStateNode*> m_stateNodeMap; -}; - -} // namespace WebCore - -#endif // ENABLE(THREADED_SCROLLING) - -#endif // ScrollingCoordinatorMac_h diff --git a/Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.mm b/Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.mm index cb5fcde51..dbe821338 100644 --- a/Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.mm +++ b/Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.mm @@ -27,134 +27,37 @@ #if ENABLE(THREADED_SCROLLING) -#import "ScrollingCoordinatorMac.h" - -#include "Frame.h" -#include "FrameView.h" -#include "IntRect.h" -#include "Page.h" -#include "PlatformWheelEvent.h" -#include "PluginViewBase.h" -#include "Region.h" -#include "RenderLayerCompositor.h" -#include "RenderView.h" -#include "ScrollAnimator.h" -#include "ScrollingStateScrollingNode.h" -#include "ScrollingStateTree.h" -#include "ScrollingThread.h" -#include "ScrollingTree.h" - -#include <wtf/Functional.h> -#include <wtf/MainThread.h> -#include <wtf/PassRefPtr.h> - +#import "ScrollingCoordinator.h" + +#import "FrameView.h" +#import "Page.h" +#import "ScrollingThread.h" +#import "ScrollingTree.h" +#import "ScrollingTreeState.h" +#import <QuartzCore/QuartzCore.h> +#import <wtf/Functional.h> +#import <wtf/MainThread.h> +#import <wtf/RetainPtr.h> +#import <wtf/StdLibExtras.h> +#import <wtf/Vector.h> namespace WebCore { class ScrollingCoordinatorPrivate { }; -ScrollingCoordinatorMac::ScrollingCoordinatorMac(Page* page) - : ScrollingCoordinator(page) - , m_scrollingStateTree(ScrollingStateTree::create()) - , m_scrollingTree(ScrollingTree::create(this)) - , m_scrollingStateTreeCommitterTimer(this, &ScrollingCoordinatorMac::scrollingStateTreeCommitterTimerFired) +PassRefPtr<ScrollingCoordinator> ScrollingCoordinator::create(Page* page) { + return adoptRef(new ScrollingCoordinator(page)); } -ScrollingCoordinatorMac::~ScrollingCoordinatorMac() +ScrollingCoordinator::~ScrollingCoordinator() { + ASSERT(!m_page); ASSERT(!m_scrollingTree); } -void ScrollingCoordinatorMac::pageDestroyed() -{ - ScrollingCoordinator::pageDestroyed(); - - m_scrollingStateTreeCommitterTimer.stop(); - - // Invalidating the scrolling tree will break the reference cycle between the ScrollingCoordinator and ScrollingTree objects. - ScrollingThread::dispatch(bind(&ScrollingTree::invalidate, m_scrollingTree.release())); -} - -ScrollingTree* ScrollingCoordinatorMac::scrollingTree() const -{ - ASSERT(m_scrollingTree); - return m_scrollingTree.get(); -} - -void ScrollingCoordinatorMac::commitTreeStateIfNeeded() -{ - if (!m_scrollingStateTree->hasChangedProperties()) - return; - - commitTreeState(); - m_scrollingStateTreeCommitterTimer.stop(); -} - -void ScrollingCoordinatorMac::frameViewLayoutUpdated(FrameView* frameView) -{ - ASSERT(isMainThread()); - ASSERT(m_page); - - // Compute the region of the page that we can't do fast scrolling for. This currently includes - // all scrollable areas, such as subframes, overflow divs and list boxes. We need to do this even if the - // frame view whose layout was updated is not the main frame. - Region nonFastScrollableRegion = computeNonFastScrollableRegion(m_page->mainFrame(), IntPoint()); - - // In the future, we may want to have the ability to set non-fast scrolling regions for more than - // just the root node. But right now, this concept only applies to the root. - setNonFastScrollableRegionForNode(nonFastScrollableRegion, m_scrollingStateTree->rootStateNode()); - - if (!coordinatesScrollingForFrameView(frameView)) - return; - - ScrollingStateScrollingNode* node = stateNodeForID(frameView->scrollLayerID()); - if (!node) - return; - - ScrollParameters scrollParameters; - scrollParameters.horizontalScrollElasticity = frameView->horizontalScrollElasticity(); - scrollParameters.verticalScrollElasticity = frameView->verticalScrollElasticity(); - scrollParameters.hasEnabledHorizontalScrollbar = frameView->horizontalScrollbar() && frameView->horizontalScrollbar()->enabled(); - scrollParameters.hasEnabledVerticalScrollbar = frameView->verticalScrollbar() && frameView->verticalScrollbar()->enabled(); - scrollParameters.horizontalScrollbarMode = frameView->horizontalScrollbarMode(); - scrollParameters.verticalScrollbarMode = frameView->verticalScrollbarMode(); - - scrollParameters.scrollOrigin = frameView->scrollOrigin(); - scrollParameters.viewportRect = IntRect(IntPoint(), frameView->visibleContentRect().size()); - scrollParameters.contentsSize = frameView->contentsSize(); - - setScrollParametersForNode(scrollParameters, node); -} - -void ScrollingCoordinatorMac::recomputeWheelEventHandlerCountForFrameView(FrameView* frameView) -{ - ScrollingStateScrollingNode* node = stateNodeForID(frameView->scrollLayerID()); - if (!node) - return; - setWheelEventHandlerCountForNode(computeCurrentWheelEventHandlerCount(), node); -} - -void ScrollingCoordinatorMac::frameViewRootLayerDidChange(FrameView* frameView) -{ - ASSERT(isMainThread()); - ASSERT(m_page); - - if (!coordinatesScrollingForFrameView(frameView)) - return; - - // If the root layer does not have a ScrollingStateNode, then we should create one. - ensureRootStateNodeForFrameView(frameView); - ASSERT(m_scrollingStateTree->rootStateNode()); - m_scrollingStateTree->rootLayerDidChange(); - - ScrollingCoordinator::frameViewRootLayerDidChange(frameView); - - setScrollLayerForNode(scrollLayerForFrameView(frameView), stateNodeForID(frameView->scrollLayerID())); -} - -void ScrollingCoordinatorMac::frameViewHorizontalScrollbarLayerDidChange(FrameView* frameView, GraphicsLayer*) +void ScrollingCoordinator::frameViewHorizontalScrollbarLayerDidChange(FrameView* frameView, GraphicsLayer*) { ASSERT(isMainThread()); ASSERT(m_page); @@ -165,7 +68,7 @@ void ScrollingCoordinatorMac::frameViewHorizontalScrollbarLayerDidChange(FrameVi // FIXME: Implement. } -void ScrollingCoordinatorMac::frameViewVerticalScrollbarLayerDidChange(FrameView* frameView, GraphicsLayer*) +void ScrollingCoordinator::frameViewVerticalScrollbarLayerDidChange(FrameView* frameView, GraphicsLayer*) { ASSERT(isMainThread()); ASSERT(m_page); @@ -176,206 +79,6 @@ void ScrollingCoordinatorMac::frameViewVerticalScrollbarLayerDidChange(FrameView // FIXME: Implement. } -bool ScrollingCoordinatorMac::requestScrollPositionUpdate(FrameView* frameView, const IntPoint& scrollPosition) -{ - ASSERT(isMainThread()); - ASSERT(m_page); - - if (!coordinatesScrollingForFrameView(frameView)) - return false; - - if (frameView->frame()->document()->inPageCache()) { - // If this frame view's document is being put into the page cache, we don't want to update our - // main frame scroll position. Just let the FrameView think that we did. - updateMainFrameScrollPosition(scrollPosition, frameView->inProgrammaticScroll()); - return true; - } - - ScrollingStateScrollingNode* stateNode = stateNodeForID(frameView->scrollLayerID()); - if (!stateNode) - return false; - - stateNode->setRequestedScrollPosition(scrollPosition, frameView->inProgrammaticScroll()); - scheduleTreeStateCommit(); - return true; -} - -bool ScrollingCoordinatorMac::handleWheelEvent(FrameView*, const PlatformWheelEvent& wheelEvent) -{ - ASSERT(isMainThread()); - ASSERT(m_page); - - if (m_scrollingTree->willWheelEventStartSwipeGesture(wheelEvent)) - return false; - - ScrollingThread::dispatch(bind(&ScrollingTree::handleWheelEvent, m_scrollingTree.get(), wheelEvent)); - - return true; -} - -void ScrollingCoordinatorMac::updateMainFrameScrollPositionAndScrollLayerPosition() -{ - ASSERT(isMainThread()); - - if (!m_page) - return; - - FrameView* frameView = m_page->mainFrame()->view(); - if (!frameView) - return; - - IntPoint scrollPosition = m_scrollingTree->mainFrameScrollPosition(); - - frameView->setConstrainsScrollingToContentEdge(false); - frameView->notifyScrollPositionChanged(scrollPosition); - frameView->setConstrainsScrollingToContentEdge(true); - - if (GraphicsLayer* scrollLayer = scrollLayerForFrameView(frameView)) - scrollLayer->setPosition(-frameView->scrollPosition()); -} - -ScrollingNodeID ScrollingCoordinatorMac::attachToStateTree(ScrollingNodeID scrollLayerID) -{ - ASSERT(scrollLayerID); - - ScrollingStateScrollingNode* existingNode = stateNodeForID(scrollLayerID); - if (existingNode && existingNode == m_scrollingStateTree->rootStateNode()) - return scrollLayerID; - - clearStateTree(); - - // FIXME: In the future, this function will have to take a parent ID so that it can - // append the node in the appropriate spot in the state tree. For now we always assume - // this is the root node. - m_scrollingStateTree->setRootStateNode(ScrollingStateScrollingNode::create(m_scrollingStateTree.get(), scrollLayerID)); - m_stateNodeMap.set(scrollLayerID, m_scrollingStateTree->rootStateNode()); - return scrollLayerID; -} - -void ScrollingCoordinatorMac::detachFromStateTree(ScrollingNodeID scrollLayerID) -{ - if (!scrollLayerID) - return; - - ScrollingStateNode* node = m_stateNodeMap.take(scrollLayerID); - m_scrollingStateTree->removeNode(node); - - // ScrollingStateTree::removeNode() will destroy children, so we have to make sure we remove those children - // from the HashMap. - const Vector<ScrollingNodeID>& removedNodes = m_scrollingStateTree->removedNodes(); - size_t size = removedNodes.size(); - for (size_t i = 0; i < size; ++i) - m_stateNodeMap.remove(removedNodes[i]); -} - -void ScrollingCoordinatorMac::clearStateTree() -{ - m_stateNodeMap.clear(); - if (ScrollingStateScrollingNode* node = m_scrollingStateTree->rootStateNode()) - m_scrollingStateTree->removeNode(node); -} - -ScrollingStateScrollingNode* ScrollingCoordinatorMac::stateNodeForID(ScrollingNodeID scrollLayerID) -{ - if (!scrollLayerID) - return 0; - - HashMap<ScrollingNodeID, ScrollingStateNode*>::const_iterator it = m_stateNodeMap.find(scrollLayerID); - if (it == m_stateNodeMap.end()) - return 0; - - ScrollingStateNode* node = it->value; - return toScrollingStateScrollingNode(node); -} - -void ScrollingCoordinatorMac::ensureRootStateNodeForFrameView(FrameView* frameView) -{ - attachToStateTree(frameView->scrollLayerID()); -} - -void ScrollingCoordinatorMac::setScrollLayerForNode(GraphicsLayer* scrollLayer, ScrollingStateNode* node) -{ - node->setScrollLayer(scrollLayer); - scheduleTreeStateCommit(); -} - -void ScrollingCoordinatorMac::setNonFastScrollableRegionForNode(const Region& region, ScrollingStateScrollingNode* node) -{ - node->setNonFastScrollableRegion(region); - scheduleTreeStateCommit(); -} - -void ScrollingCoordinatorMac::setScrollParametersForNode(const ScrollParameters& scrollParameters, ScrollingStateScrollingNode* node) -{ - node->setHorizontalScrollElasticity(scrollParameters.horizontalScrollElasticity); - node->setVerticalScrollElasticity(scrollParameters.verticalScrollElasticity); - node->setHasEnabledHorizontalScrollbar(scrollParameters.hasEnabledHorizontalScrollbar); - node->setHasEnabledVerticalScrollbar(scrollParameters.hasEnabledVerticalScrollbar); - node->setHorizontalScrollbarMode(scrollParameters.horizontalScrollbarMode); - node->setVerticalScrollbarMode(scrollParameters.verticalScrollbarMode); - - node->setScrollOrigin(scrollParameters.scrollOrigin); - node->setViewportRect(scrollParameters.viewportRect); - node->setContentsSize(scrollParameters.contentsSize); - scheduleTreeStateCommit(); -} - -void ScrollingCoordinatorMac::setWheelEventHandlerCountForNode(unsigned wheelEventHandlerCount, ScrollingStateScrollingNode* node) -{ - node->setWheelEventHandlerCount(wheelEventHandlerCount); - scheduleTreeStateCommit(); -} - -void ScrollingCoordinatorMac::setShouldUpdateScrollLayerPositionOnMainThread(MainThreadScrollingReasons reasons) -{ - // The FrameView's GraphicsLayer is likely to be out-of-synch with the PlatformLayer - // at this point. So we'll update it before we switch back to main thread scrolling - // in order to avoid layer positioning bugs. - if (reasons) - updateMainFrameScrollLayerPosition(); - m_scrollingStateTree->rootStateNode()->setShouldUpdateScrollLayerPositionOnMainThread(reasons); - scheduleTreeStateCommit(); -} - -void ScrollingCoordinatorMac::updateMainFrameScrollLayerPosition() -{ - ASSERT(isMainThread()); - - if (!m_page) - return; - - FrameView* frameView = m_page->mainFrame()->view(); - if (!frameView) - return; - - if (GraphicsLayer* scrollLayer = scrollLayerForFrameView(frameView)) - scrollLayer->setPosition(-frameView->scrollPosition()); -} - -void ScrollingCoordinatorMac::scheduleTreeStateCommit() -{ - if (m_scrollingStateTreeCommitterTimer.isActive()) - return; - - if (!m_scrollingStateTree->hasChangedProperties()) - return; - - m_scrollingStateTreeCommitterTimer.startOneShot(0); -} - -void ScrollingCoordinatorMac::scrollingStateTreeCommitterTimerFired(Timer<ScrollingCoordinatorMac>*) -{ - commitTreeState(); -} - -void ScrollingCoordinatorMac::commitTreeState() -{ - ASSERT(m_scrollingStateTree->hasChangedProperties()); - - OwnPtr<ScrollingStateTree> treeState = m_scrollingStateTree->commit(); - ScrollingThread::dispatch(bind(&ScrollingTree::commitNewTreeState, m_scrollingTree.get(), treeState.release())); -} - } // namespace WebCore #endif // ENABLE(THREADED_SCROLLING) diff --git a/Source/WebCore/page/scrolling/mac/ScrollingTreeNodeMac.h b/Source/WebCore/page/scrolling/mac/ScrollingTreeNodeMac.h index 45f70ed73..4304b61bb 100644 --- a/Source/WebCore/page/scrolling/mac/ScrollingTreeNodeMac.h +++ b/Source/WebCore/page/scrolling/mac/ScrollingTreeNodeMac.h @@ -43,7 +43,7 @@ public: private: // ScrollingTreeNode member functions. - virtual void update(ScrollingStateScrollingNode*) OVERRIDE; + virtual void update(ScrollingTreeState*) OVERRIDE; virtual void handleWheelEvent(const PlatformWheelEvent&) OVERRIDE; // ScrollElasticityController member functions. diff --git a/Source/WebCore/page/scrolling/mac/ScrollingTreeNodeMac.mm b/Source/WebCore/page/scrolling/mac/ScrollingTreeNodeMac.mm index e27be0959..68b079cbd 100644 --- a/Source/WebCore/page/scrolling/mac/ScrollingTreeNodeMac.mm +++ b/Source/WebCore/page/scrolling/mac/ScrollingTreeNodeMac.mm @@ -31,7 +31,7 @@ #include "PlatformWheelEvent.h" #include "ScrollingCoordinator.h" #include "ScrollingTree.h" -#include "ScrollingStateTree.h" +#include "ScrollingTreeState.h" #include "Settings.h" #include "TileCache.h" #include "WebTileLayer.h" @@ -62,26 +62,26 @@ ScrollingTreeNodeMac::~ScrollingTreeNodeMac() CFRunLoopTimerInvalidate(m_snapRubberbandTimer.get()); } -void ScrollingTreeNodeMac::update(ScrollingStateScrollingNode* state) +void ScrollingTreeNodeMac::update(ScrollingTreeState* state) { ScrollingTreeNode::update(state); - if (state->scrollLayerDidChange()) + if (state->changedProperties() & ScrollingTreeState::ScrollLayer) m_scrollLayer = state->platformScrollLayer(); - if (state->changedProperties() & ScrollingStateScrollingNode::RequestedScrollPosition) + if (state->changedProperties() & ScrollingTreeState::RequestedScrollPosition) setScrollPosition(state->requestedScrollPosition()); - if (state->scrollLayerDidChange() || state->changedProperties() & (ScrollingStateScrollingNode::ContentsSize | ScrollingStateScrollingNode::ViewportRect)) + if (state->changedProperties() & (ScrollingTreeState::ScrollLayer | ScrollingTreeState::ContentsSize | ScrollingTreeState::ViewportRect)) updateMainFramePinState(scrollPosition()); - if ((state->changedProperties() & ScrollingStateScrollingNode::ShouldUpdateScrollLayerPositionOnMainThread)) { + if ((state->changedProperties() & ScrollingTreeState::ShouldUpdateScrollLayerPositionOnMainThread)) { unsigned mainThreadScrollingReasons = this->shouldUpdateScrollLayerPositionOnMainThread(); if (mainThreadScrollingReasons) { // We're transitioning to the slow "update scroll layer position on the main thread" mode. // Initialize the probable main thread scroll position with the current scroll layer position. - if (state->changedProperties() & ScrollingStateScrollingNode::RequestedScrollPosition) + if (state->changedProperties() & ScrollingTreeState::RequestedScrollPosition) m_probableMainThreadScrollPosition = state->requestedScrollPosition(); else { CGPoint scrollLayerPosition = m_scrollLayer.get().position; diff --git a/Source/WebCore/page/scrolling/mac/ScrollingStateNodeMac.mm b/Source/WebCore/page/scrolling/mac/ScrollingTreeStateMac.mm index 5ea7532f6..21f0c7253 100644 --- a/Source/WebCore/page/scrolling/mac/ScrollingStateNodeMac.mm +++ b/Source/WebCore/page/scrolling/mac/ScrollingTreeStateMac.mm @@ -24,25 +24,18 @@ */ #include "config.h" -#include "ScrollingStateNode.h" - -#include "ScrollingStateTree.h" +#include "ScrollingTreeState.h" #if ENABLE(THREADED_SCROLLING) namespace WebCore { -PlatformLayer* ScrollingStateNode::platformScrollLayer() const +PlatformLayer* ScrollingTreeState::platformScrollLayer() const { return m_platformScrollLayer.get(); } -void ScrollingStateNode::setScrollLayer(PlatformLayer* platformLayer) -{ - m_platformScrollLayer = platformLayer; -} - -void ScrollingStateNode::setScrollLayer(const GraphicsLayer* graphicsLayer) +void ScrollingTreeState::setScrollLayer(const GraphicsLayer* graphicsLayer) { PlatformLayer* platformScrollLayer = graphicsLayer ? graphicsLayer->platformLayer() : nil; @@ -50,8 +43,7 @@ void ScrollingStateNode::setScrollLayer(const GraphicsLayer* graphicsLayer) return; m_platformScrollLayer = platformScrollLayer; - m_scrollLayerDidChange = true; - m_scrollingStateTree->setHasChangedProperties(true); + m_changedProperties |= ScrollLayer; } } // namespace WebCore |
