diff options
author | Zeno Albisser <zeno.albisser@digia.com> | 2013-11-21 14:09:57 +0100 |
---|---|---|
committer | Andras Becsi <andras.becsi@digia.com> | 2013-11-29 15:14:36 +0100 |
commit | eb32ba6f51d0c21d58cd7d89785285ff8fa64624 (patch) | |
tree | 2c7c940e1dbee81b89d935626110816b494aa32c /chromium/third_party/WebKit | |
parent | 9427c1a0222ebd67efef1a2c7990a0fa5c9aac84 (diff) | |
download | qtwebengine-chromium-eb32ba6f51d0c21d58cd7d89785285ff8fa64624.tar.gz |
Update chromium to branch 1599.
Change-Id: I04e775a946a208bb4500d3b722bcb05c82b9d7cb
Reviewed-by: Andras Becsi <andras.becsi@digia.com>
Diffstat (limited to 'chromium/third_party/WebKit')
533 files changed, 3962 insertions, 7357 deletions
diff --git a/chromium/third_party/WebKit/Source/bindings/OWNERS b/chromium/third_party/WebKit/Source/bindings/OWNERS index 53d82fa65a9..04eb6bc41ea 100644 --- a/chromium/third_party/WebKit/Source/bindings/OWNERS +++ b/chromium/third_party/WebKit/Source/bindings/OWNERS @@ -1,6 +1,5 @@ abarth@chromium.org adamk@chromium.org -arv@chromium.org ch.dumez@sisa.samsung.com dcarney@chromium.org dglazkov@chromium.org diff --git a/chromium/third_party/WebKit/Source/bindings/scripts/IDLAttributes.txt b/chromium/third_party/WebKit/Source/bindings/scripts/IDLAttributes.txt index bec45e791f4..f3768392a09 100644 --- a/chromium/third_party/WebKit/Source/bindings/scripts/IDLAttributes.txt +++ b/chromium/third_party/WebKit/Source/bindings/scripts/IDLAttributes.txt @@ -59,6 +59,7 @@ GlobalContext=Window|WorkerGlobalScope|SharedWorkerGlobalScope|DedicatedWorkerGl Immutable ImplementedAs=* InitializedByEventConstructor +IsIndex # FIXME: We should remove this extended attribute once the needed refactoring is complete. LegacyImplementedInBaseClass MasqueradesAsUndefined diff --git a/chromium/third_party/WebKit/Source/bindings/scripts/deprecated_code_generator_v8.pm b/chromium/third_party/WebKit/Source/bindings/scripts/deprecated_code_generator_v8.pm index 39c5394140f..c327e692186 100644 --- a/chromium/third_party/WebKit/Source/bindings/scripts/deprecated_code_generator_v8.pm +++ b/chromium/third_party/WebKit/Source/bindings/scripts/deprecated_code_generator_v8.pm @@ -2191,6 +2191,14 @@ END } my $raisesExceptions = $function->extendedAttributes->{"RaisesException"}; + if (!$raisesExceptions) { + foreach my $parameter (@{$function->parameters}) { + if ($parameter->extendedAttributes->{"IsIndex"}) { + $raisesExceptions = 1; + } + } + } + if ($raisesExceptions) { AddToImplIncludes("bindings/v8/ExceptionState.h"); $code .= " ExceptionState es(args.GetIsolate());\n"; @@ -2409,6 +2417,14 @@ sub GenerateParametersCheck } } + if ($parameter->extendedAttributes->{"IsIndex"}) { + AddToImplIncludes("core/dom/ExceptionCode.h"); + $parameterCheckString .= " if (UNLIKELY($parameterName < 0)) {\n"; + $parameterCheckString .= " setDOMException(IndexSizeError, args.GetIsolate());\n"; + $parameterCheckString .= " return;\n"; + $parameterCheckString .= " }\n"; + } + $paramIndex++; } return ($parameterCheckString, $paramIndex, %replacements); @@ -2464,6 +2480,13 @@ sub GenerateSingleConstructorCallback if ($interface->extendedAttributes->{"ConstructorRaisesException"}) { $raisesExceptions = 1; } + if (!$raisesExceptions) { + foreach my $parameter (@{$function->parameters}) { + if ($parameter->extendedAttributes->{"IsIndex"}) { + $raisesExceptions = 1; + } + } + } my @beforeArgumentList; my @afterArgumentList; @@ -2723,6 +2746,13 @@ sub GenerateNamedConstructor if ($interface->extendedAttributes->{"ConstructorRaisesException"}) { $raisesExceptions = 1; } + if (!$raisesExceptions) { + foreach my $parameter (@{$function->parameters}) { + if ($parameter->extendedAttributes->{"IsIndex"}) { + $raisesExceptions = 1; + } + } + } my $maybeObserveFeature = GenerateFeatureObservation($function->extendedAttributes->{"MeasureAs"}); my $maybeDeprecateFeature = GenerateDeprecationNotification($function->extendedAttributes->{"DeprecateAs"}); @@ -4952,6 +4982,10 @@ sub GetNativeType return "double" if $type eq "double"; return "int" if $type eq "long" or $type eq "int" or $type eq "short" or $type eq "byte"; if ($type eq "unsigned long" or $type eq "unsigned int" or $type eq "unsigned short" or $type eq "octet") { + if ($extendedAttributes->{"IsIndex"}) { + # Special-case index arguments because we need to check that they aren't < 0. + return "int"; + } return "unsigned"; } return "long long" if $type eq "long long"; @@ -5031,6 +5065,10 @@ sub JSValueToNativeStatement my $getIsolate = shift; my $nativeType = GetNativeType($type, $extendedAttributes, "parameter"); + if ($type eq "unsigned long" and $extendedAttributes->{"IsIndex"}) { + # Special-case index arguments because we need to check that they aren't < 0. + $nativeType = "int"; + } my $native_value = JSValueToNative($type, $extendedAttributes, $jsValue, $getIsolate); my $code = ""; if ($type eq "DOMString" || IsEnumType($type)) { diff --git a/chromium/third_party/WebKit/Source/bindings/v8/CustomElementConstructorBuilder.cpp b/chromium/third_party/WebKit/Source/bindings/v8/CustomElementConstructorBuilder.cpp index b808512b8a9..02fd9273e7a 100644 --- a/chromium/third_party/WebKit/Source/bindings/v8/CustomElementConstructorBuilder.cpp +++ b/chromium/third_party/WebKit/Source/bindings/v8/CustomElementConstructorBuilder.cpp @@ -47,7 +47,6 @@ #include "core/dom/CustomElementCallbackDispatcher.h" #include "core/dom/CustomElementDefinition.h" #include "core/dom/CustomElementDescriptor.h" -#include "core/dom/CustomElementException.h" #include "core/dom/Document.h" #include "wtf/Assertions.h" @@ -69,7 +68,7 @@ bool CustomElementConstructorBuilder::isFeatureAllowed() const return !DOMWrapperWorld::isolatedWorld(m_context); } -bool CustomElementConstructorBuilder::validateOptions(const AtomicString& type, ExceptionState& es) +bool CustomElementConstructorBuilder::validateOptions() { ASSERT(m_prototype.IsEmpty()); @@ -80,21 +79,17 @@ bool CustomElementConstructorBuilder::validateOptions(const AtomicString& type, // is HTMLSpanElement.prototype, has an ambiguity about its // behavior. The spec should be fixed before WebKit implements // it. https://www.w3.org/Bugs/Public/show_bug.cgi?id=20801 - CustomElementException::throwException(CustomElementException::NotYetImplemented, type, es); return false; } v8::Handle<v8::Value> prototypeValue = prototypeScriptValue.v8Value(); - if (prototypeValue.IsEmpty() || !prototypeValue->IsObject()) { - CustomElementException::throwException(CustomElementException::PrototypeNotAnObject, type, es); + if (prototypeValue.IsEmpty() || !prototypeValue->IsObject()) return false; - } m_prototype = prototypeValue.As<v8::Object>(); V8PerContextData* perContextData; if (!(perContextData = V8PerContextData::from(m_context))) { // FIXME: This should generate an InvalidContext exception at a later point. - CustomElementException::throwException(CustomElementException::ContextDestroyedCheckingPrototype, type, es); return false; } @@ -114,7 +109,6 @@ bool CustomElementConstructorBuilder::validateOptions(const AtomicString& type, return true; } - CustomElementException::throwException(CustomElementException::PrototypeDoesNotExtendHTMLElementSVGElementPrototype, type, es); return false; } @@ -176,7 +170,7 @@ v8::Handle<v8::Function> CustomElementConstructorBuilder::retrieveCallback(v8::I return value.As<v8::Function>(); } -bool CustomElementConstructorBuilder::createConstructor(Document* document, CustomElementDefinition* definition, ExceptionState& es) +bool CustomElementConstructorBuilder::createConstructor(Document* document, CustomElementDefinition* definition) { ASSERT(!m_prototype.IsEmpty()); ASSERT(m_constructor.IsEmpty()); @@ -184,16 +178,14 @@ bool CustomElementConstructorBuilder::createConstructor(Document* document, Cust v8::Isolate* isolate = m_context->GetIsolate(); - if (!prototypeIsValid(definition->descriptor().type(), es)) + if (!prototypeIsValid()) return false; v8::Local<v8::FunctionTemplate> constructorTemplate = v8::FunctionTemplate::New(); constructorTemplate->SetCallHandler(constructCustomElement); m_constructor = constructorTemplate->GetFunction(); - if (m_constructor.IsEmpty()) { - CustomElementException::throwException(CustomElementException::ContextDestroyedRegisteringDefinition, definition->descriptor().type(), es); + if (m_constructor.IsEmpty()) return false; - } const CustomElementDescriptor& descriptor = definition->descriptor(); @@ -228,15 +220,15 @@ bool CustomElementConstructorBuilder::createConstructor(Document* document, Cust return true; } -bool CustomElementConstructorBuilder::prototypeIsValid(const AtomicString& type, ExceptionState& es) const +bool CustomElementConstructorBuilder::prototypeIsValid() const { if (m_prototype->InternalFieldCount() || !m_prototype->GetHiddenValue(V8HiddenPropertyName::customElementIsInterfacePrototypeObject()).IsEmpty()) { - CustomElementException::throwException(CustomElementException::PrototypeInUse, type, es); + // Alcreated an interface prototype object. return false; } if (m_prototype->GetPropertyAttributes(v8String("constructor", m_context->GetIsolate())) & v8::DontDelete) { - CustomElementException::throwException(CustomElementException::ConstructorPropertyNotConfigurable, type, es); + // "constructor" is not configurable. return false; } diff --git a/chromium/third_party/WebKit/Source/bindings/v8/CustomElementConstructorBuilder.h b/chromium/third_party/WebKit/Source/bindings/v8/CustomElementConstructorBuilder.h index 84e46bb568a..354fd12aff9 100644 --- a/chromium/third_party/WebKit/Source/bindings/v8/CustomElementConstructorBuilder.h +++ b/chromium/third_party/WebKit/Source/bindings/v8/CustomElementConstructorBuilder.h @@ -47,7 +47,6 @@ class CustomElementDefinition; class Dictionary; class Document; class Element; -class ExceptionState; class QualifiedName; class ScriptState; class V8PerContextData; @@ -67,10 +66,10 @@ public: // (returns false), the calls must stop. bool isFeatureAllowed() const; - bool validateOptions(const AtomicString& type, ExceptionState&); + bool validateOptions(); bool findTagName(const AtomicString& customElementType, QualifiedName& tagName); PassRefPtr<CustomElementLifecycleCallbacks> createCallbacks(); - bool createConstructor(Document*, CustomElementDefinition*, ExceptionState&); + bool createConstructor(Document*, CustomElementDefinition*); bool didRegisterDefinition(CustomElementDefinition*) const; // This method collects a return value for the bindings. It is @@ -81,7 +80,7 @@ public: private: static WrapperTypeInfo* findWrapperType(v8::Handle<v8::Value> chain); bool hasValidPrototypeChainFor(V8PerContextData*, WrapperTypeInfo*) const; - bool prototypeIsValid(const AtomicString& type, ExceptionState&) const; + bool prototypeIsValid() const; v8::Handle<v8::Function> retrieveCallback(v8::Isolate*, const char* name); v8::Handle<v8::Context> m_context; diff --git a/chromium/third_party/WebKit/Source/bindings/v8/ScriptProfiler.cpp b/chromium/third_party/WebKit/Source/bindings/v8/ScriptProfiler.cpp index f9f5604fd51..f2856c68bc5 100644 --- a/chromium/third_party/WebKit/Source/bindings/v8/ScriptProfiler.cpp +++ b/chromium/third_party/WebKit/Source/bindings/v8/ScriptProfiler.cpp @@ -303,11 +303,4 @@ ProfileNameIdleTimeMap* ScriptProfiler::currentProfileNameIdleTimeMap() return *map; } -void ScriptProfiler::setIdle(bool isIdle) -{ - v8::Isolate* isolate = v8::Isolate::GetCurrent(); - if (v8::CpuProfiler* profiler = isolate->GetCpuProfiler()) - profiler->SetIdle(isIdle); -} - } // namespace WebCore diff --git a/chromium/third_party/WebKit/Source/bindings/v8/ScriptProfiler.h b/chromium/third_party/WebKit/Source/bindings/v8/ScriptProfiler.h index 93f25bcb86c..e11979c02de 100644 --- a/chromium/third_party/WebKit/Source/bindings/v8/ScriptProfiler.h +++ b/chromium/third_party/WebKit/Source/bindings/v8/ScriptProfiler.h @@ -79,7 +79,6 @@ public: static void initialize(); static void visitNodeWrappers(WrappedNodeVisitor*); static HashMap<String, double>* currentProfileNameIdleTimeMap(); - static void setIdle(bool isIdle); }; } // namespace WebCore diff --git a/chromium/third_party/WebKit/Source/bindings/v8/ScriptSourceCode.h b/chromium/third_party/WebKit/Source/bindings/v8/ScriptSourceCode.h index 5bacd8bb116..97046ef4024 100644 --- a/chromium/third_party/WebKit/Source/bindings/v8/ScriptSourceCode.h +++ b/chromium/third_party/WebKit/Source/bindings/v8/ScriptSourceCode.h @@ -31,8 +31,8 @@ #ifndef ScriptSourceCode_h #define ScriptSourceCode_h -#include "core/fetch/ResourcePtr.h" -#include "core/fetch/ScriptResource.h" +#include "core/loader/cache/ResourcePtr.h" +#include "core/loader/cache/ScriptResource.h" #include "weborigin/KURL.h" #include "wtf/PassOwnPtr.h" #include "wtf/text/TextPosition.h" diff --git a/chromium/third_party/WebKit/Source/bindings/v8/V8ErrorHandler.cpp b/chromium/third_party/WebKit/Source/bindings/v8/V8ErrorHandler.cpp index f7b9681e8d6..8f8b7c2cde5 100644 --- a/chromium/third_party/WebKit/Source/bindings/v8/V8ErrorHandler.cpp +++ b/chromium/third_party/WebKit/Source/bindings/v8/V8ErrorHandler.cpp @@ -31,16 +31,12 @@ #include "config.h" #include "bindings/v8/V8ErrorHandler.h" -#include "V8ErrorEvent.h" #include "bindings/v8/ScriptController.h" #include "bindings/v8/V8Binding.h" #include "bindings/v8/V8HiddenPropertyName.h" #include "bindings/v8/V8ScriptRunner.h" -#include "core/dom/Document.h" #include "core/dom/ErrorEvent.h" #include "core/dom/EventNames.h" -#include "core/dom/ScriptExecutionContext.h" -#include "core/page/Frame.h" namespace WebCore { @@ -77,16 +73,6 @@ v8::Local<v8::Value> V8ErrorHandler::callListenerFunction(ScriptExecutionContext return returnValue; } -// static -void V8ErrorHandler::storeExceptionOnErrorEventWrapper(ErrorEvent* event, v8::Handle<v8::Value> data, v8::Isolate* isolate) -{ - v8::Local<v8::Value> wrappedEvent = toV8(event, v8::Handle<v8::Object>(), isolate); - if (!wrappedEvent.IsEmpty()) { - ASSERT(wrappedEvent->IsObject()); - v8::Local<v8::Object>::Cast(wrappedEvent)->SetHiddenValue(V8HiddenPropertyName::error(), data); - } -} - bool V8ErrorHandler::shouldPreventDefault(v8::Local<v8::Value> returnValue) { return returnValue->IsBoolean() && returnValue->BooleanValue(); diff --git a/chromium/third_party/WebKit/Source/bindings/v8/V8ErrorHandler.h b/chromium/third_party/WebKit/Source/bindings/v8/V8ErrorHandler.h index 92246d3f136..90fdf5f81a0 100644 --- a/chromium/third_party/WebKit/Source/bindings/v8/V8ErrorHandler.h +++ b/chromium/third_party/WebKit/Source/bindings/v8/V8ErrorHandler.h @@ -37,9 +37,6 @@ namespace WebCore { -class ErrorEvent; -class Frame; - class V8ErrorHandler : public V8EventListener { public: static PassRefPtr<V8ErrorHandler> create(v8::Local<v8::Object> listener, bool isInline) @@ -47,8 +44,6 @@ public: return adoptRef(new V8ErrorHandler(listener, isInline)); } - static void storeExceptionOnErrorEventWrapper(ErrorEvent*, v8::Handle<v8::Value>, v8::Isolate*); - private: V8ErrorHandler(v8::Local<v8::Object> listener, bool isInline); diff --git a/chromium/third_party/WebKit/Source/bindings/v8/V8Initializer.cpp b/chromium/third_party/WebKit/Source/bindings/v8/V8Initializer.cpp index d2e2d9c26a1..fa8be8f0948 100644 --- a/chromium/third_party/WebKit/Source/bindings/v8/V8Initializer.cpp +++ b/chromium/third_party/WebKit/Source/bindings/v8/V8Initializer.cpp @@ -35,7 +35,6 @@ #include "bindings/v8/ScriptController.h" #include "bindings/v8/ScriptProfiler.h" #include "bindings/v8/V8Binding.h" -#include "bindings/v8/V8ErrorHandler.h" #include "bindings/v8/V8GCController.h" #include "bindings/v8/V8HiddenPropertyName.h" #include "bindings/v8/V8PerContextData.h" @@ -47,9 +46,9 @@ #include "core/page/DOMWindow.h" #include "core/page/Frame.h" #include "core/platform/MemoryUsageSupport.h" +#include <v8-debug.h> #include "wtf/RefPtr.h" #include "wtf/text/WTFString.h" -#include <v8-debug.h> namespace WebCore { @@ -100,14 +99,20 @@ static void messageHandlerInMainThread(v8::Handle<v8::Message> message, v8::Hand bool shouldUseDocumentURL = resourceName.IsEmpty() || !resourceName->IsString(); String resource = shouldUseDocumentURL ? firstWindow->document()->url() : toWebCoreString(resourceName); RefPtr<ErrorEvent> event = ErrorEvent::create(errorMessage, resource, message->GetLineNumber(), message->GetStartColumn()); - AccessControlStatus corsStatus = message->IsSharedCrossOrigin() ? SharableCrossOrigin : NotSharableCrossOrigin; - // This method might be called while we're creating a new context. In this case, we - // avoid storing the exception object, as we can't create a wrapper during context creation. + // messageHandlerInMainThread can be called while we're creating a new context. + // Since we cannot create a wrapper in the intermediate timing, we need to skip + // creating a wrapper for |event|. DOMWrapperWorld* world = DOMWrapperWorld::current(); Frame* frame = firstWindow->document()->frame(); - if (world && frame && frame->script()->existingWindowShell(world)) - V8ErrorHandler::storeExceptionOnErrorEventWrapper(event.get(), data, v8::Isolate::GetCurrent()); + if (world && frame && frame->script()->existingWindowShell(world)) { + v8::Local<v8::Value> wrappedEvent = toV8(event.get(), v8::Handle<v8::Object>(), v8::Isolate::GetCurrent()); + if (!wrappedEvent.IsEmpty()) { + ASSERT(wrappedEvent->IsObject()); + v8::Local<v8::Object>::Cast(wrappedEvent)->SetHiddenValue(V8HiddenPropertyName::error(), data); + } + } + AccessControlStatus corsStatus = message->IsSharedCrossOrigin() ? SharableCrossOrigin : NotSharableCrossOrigin; firstWindow->document()->reportException(event.release(), callStack, corsStatus); } @@ -178,9 +183,12 @@ static void messageHandlerInWorker(v8::Handle<v8::Message> message, v8::Handle<v String errorMessage = toWebCoreString(message->Get()); String sourceURL = toWebCoreString(message->GetScriptResourceName()); RefPtr<ErrorEvent> event = ErrorEvent::create(errorMessage, sourceURL, message->GetLineNumber(), message->GetStartColumn()); + v8::Local<v8::Value> wrappedEvent = toV8(event.get(), v8::Handle<v8::Object>(), v8::Isolate::GetCurrent()); + if (!wrappedEvent.IsEmpty()) { + ASSERT(wrappedEvent->IsObject()); + v8::Local<v8::Object>::Cast(wrappedEvent)->SetHiddenValue(V8HiddenPropertyName::error(), data); + } AccessControlStatus corsStatus = message->IsSharedCrossOrigin() ? SharableCrossOrigin : NotSharableCrossOrigin; - - V8ErrorHandler::storeExceptionOnErrorEventWrapper(event.get(), data, v8::Isolate::GetCurrent()); context->reportException(event.release(), 0, corsStatus); } diff --git a/chromium/third_party/WebKit/Source/bindings/v8/V8ScriptRunner.cpp b/chromium/third_party/WebKit/Source/bindings/v8/V8ScriptRunner.cpp index cab312f6445..700441650cc 100644 --- a/chromium/third_party/WebKit/Source/bindings/v8/V8ScriptRunner.cpp +++ b/chromium/third_party/WebKit/Source/bindings/v8/V8ScriptRunner.cpp @@ -30,8 +30,8 @@ #include "bindings/v8/V8GCController.h" #include "bindings/v8/V8RecursionScope.h" #include "core/dom/ScriptExecutionContext.h" -#include "core/fetch/ScriptResource.h" #include "core/loader/CachedMetadata.h" +#include "core/loader/cache/ScriptResource.h" #include "core/platform/chromium/TraceEvent.h" namespace WebCore { diff --git a/chromium/third_party/WebKit/Source/bindings/v8/WorkerScriptController.cpp b/chromium/third_party/WebKit/Source/bindings/v8/WorkerScriptController.cpp index cbbf758d16d..a0d3b2f5b1e 100644 --- a/chromium/third_party/WebKit/Source/bindings/v8/WorkerScriptController.cpp +++ b/chromium/third_party/WebKit/Source/bindings/v8/WorkerScriptController.cpp @@ -37,7 +37,6 @@ #include "V8WorkerGlobalScope.h" #include "bindings/v8/ScriptSourceCode.h" #include "bindings/v8/ScriptValue.h" -#include "bindings/v8/V8ErrorHandler.h" #include "bindings/v8/V8GCController.h" #include "bindings/v8/V8Initializer.h" #include "bindings/v8/V8ObjectConstructor.h" @@ -168,7 +167,6 @@ ScriptValue WorkerScriptController::evaluate(const String& script, const String& state->lineNumber = message->GetLineNumber(); state->columnNumber = message->GetStartColumn(); state->sourceURL = toWebCoreString(message->GetScriptResourceName()); - state->exception = ScriptValue(block.Exception()); block.Reset(); } else state->hadException = false; @@ -190,10 +188,10 @@ void WorkerScriptController::evaluate(const ScriptSourceCode& sourceCode, RefPtr if (errorEvent) { *errorEvent = m_workerGlobalScope->shouldSanitizeScriptError(state.sourceURL, NotSharableCrossOrigin) ? ErrorEvent::createSanitizedError() : ErrorEvent::create(state.errorMessage, state.sourceURL, state.lineNumber, state.columnNumber); - V8ErrorHandler::storeExceptionOnErrorEventWrapper(errorEvent->get(), state.exception.v8Value(), m_isolate); } else { ASSERT(!m_workerGlobalScope->shouldSanitizeScriptError(state.sourceURL, NotSharableCrossOrigin)); RefPtr<ErrorEvent> event = m_errorEventFromImportedScript ? m_errorEventFromImportedScript.release() : ErrorEvent::create(state.errorMessage, state.sourceURL, state.lineNumber, state.columnNumber); + m_errorEventFromImportedScript.clear(); m_workerGlobalScope->reportException(event, 0, NotSharableCrossOrigin); } } diff --git a/chromium/third_party/WebKit/Source/bindings/v8/WorkerScriptController.h b/chromium/third_party/WebKit/Source/bindings/v8/WorkerScriptController.h index 0697da0b0a6..dd0e5745106 100644 --- a/chromium/third_party/WebKit/Source/bindings/v8/WorkerScriptController.h +++ b/chromium/third_party/WebKit/Source/bindings/v8/WorkerScriptController.h @@ -58,7 +58,6 @@ namespace WebCore { int lineNumber; int columnNumber; String sourceURL; - ScriptValue exception; }; class WorkerScriptController { diff --git a/chromium/third_party/WebKit/Source/bindings/v8/custom/V8WorkerGlobalScopeCustom.cpp b/chromium/third_party/WebKit/Source/bindings/v8/custom/V8WorkerGlobalScopeCustom.cpp index b2e35d93b49..87d751da456 100644 --- a/chromium/third_party/WebKit/Source/bindings/v8/custom/V8WorkerGlobalScopeCustom.cpp +++ b/chromium/third_party/WebKit/Source/bindings/v8/custom/V8WorkerGlobalScopeCustom.cpp @@ -94,6 +94,26 @@ void SetTimeoutOrInterval(const v8::FunctionCallbackInfo<v8::Value>& args, bool v8SetReturnValue(args, timerId); } +void V8WorkerGlobalScope::importScriptsMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& args) +{ + if (!args.Length()) + return; + + Vector<String> urls; + for (int i = 0; i < args.Length(); i++) { + V8TRYCATCH_VOID(v8::Handle<v8::String>, scriptUrl, args[i]->ToString()); + if (scriptUrl.IsEmpty()) + return; + urls.append(toWebCoreString(scriptUrl)); + } + + WorkerGlobalScope* workerGlobalScope = V8WorkerGlobalScope::toNative(args.Holder()); + + ExceptionState es(args.GetIsolate()); + workerGlobalScope->importScripts(urls, es); + es.throwIfNeeded(); +} + void V8WorkerGlobalScope::setTimeoutMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& args) { return SetTimeoutOrInterval(args, true); diff --git a/chromium/third_party/WebKit/Source/bindings/v8/custom/V8XMLHttpRequestCustom.cpp b/chromium/third_party/WebKit/Source/bindings/v8/custom/V8XMLHttpRequestCustom.cpp index 9d734b6b26d..e9eabc2f481 100644 --- a/chromium/third_party/WebKit/Source/bindings/v8/custom/V8XMLHttpRequestCustom.cpp +++ b/chromium/third_party/WebKit/Source/bindings/v8/custom/V8XMLHttpRequestCustom.cpp @@ -102,14 +102,20 @@ void V8XMLHttpRequest::responseAttrGetterCustom(v8::Local<v8::String> name, cons case XMLHttpRequest::ResponseTypeBlob: { - Blob* blob = xmlHttpRequest->responseBlob(); + ExceptionState es(info.GetIsolate()); + Blob* blob = xmlHttpRequest->responseBlob(es); + if (es.throwIfNeeded()) + return; v8SetReturnValue(info, toV8Fast(blob, info, xmlHttpRequest)); return; } case XMLHttpRequest::ResponseTypeArrayBuffer: { - ArrayBuffer* arrayBuffer = xmlHttpRequest->responseArrayBuffer(); + ExceptionState es(info.GetIsolate()); + ArrayBuffer* arrayBuffer = xmlHttpRequest->responseArrayBuffer(es); + if (es.throwIfNeeded()) + return; if (arrayBuffer && !arrayBuffer->hasDeallocationObserver()) { arrayBuffer->setDeallocationObserver(V8ArrayBufferDeallocationObserver::instance()); v8::V8::AdjustAmountOfExternalAllocatedMemory(arrayBuffer->byteLength()); diff --git a/chromium/third_party/WebKit/Source/core/animation/AnimatableTransform.cpp b/chromium/third_party/WebKit/Source/core/animation/AnimatableTransform.cpp deleted file mode 100644 index 8606a25a179..00000000000 --- a/chromium/third_party/WebKit/Source/core/animation/AnimatableTransform.cpp +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (C) 2013 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "core/animation/AnimatableTransform.h" - -namespace WebCore { - -PassRefPtr<AnimatableTransform> AnimatableTransform::create(const TransformOperations& transform) -{ - return adoptRef(new AnimatableTransform(transform)); -} - -PassRefPtr<AnimatableValue> AnimatableTransform::interpolateTo(const AnimatableValue* value, double fraction) const -{ - const AnimatableTransform* transform = toAnimatableTransform(value); - return AnimatableTransform::create(transform->m_transform.blend(m_transform, fraction)); -} - -PassRefPtr<AnimatableValue> AnimatableTransform::addWith(const AnimatableValue* value) const -{ - const AnimatableTransform* transform = toAnimatableTransform(value); - return AnimatableTransform::create(m_transform.add(transform->m_transform)); -} - -} // namespace WebCore - diff --git a/chromium/third_party/WebKit/Source/core/animation/AnimatableValue.h b/chromium/third_party/WebKit/Source/core/animation/AnimatableValue.h index 94a65d1caef..3145e0a7621 100644 --- a/chromium/third_party/WebKit/Source/core/animation/AnimatableValue.h +++ b/chromium/third_party/WebKit/Source/core/animation/AnimatableValue.h @@ -50,14 +50,12 @@ public: bool isNumber() const { return m_type == TypeNumber; } bool isNeutral() const { return m_type == TypeNeutral; } - bool isTransform() const { return m_type == TypeTransform; } bool isUnknown() const { return m_type == TypeUnknown; } protected: enum AnimatableType { TypeNeutral, TypeNumber, - TypeTransform, TypeUnknown, }; diff --git a/chromium/third_party/WebKit/Source/core/animation/DocumentTimeline.cpp b/chromium/third_party/WebKit/Source/core/animation/DocumentTimeline.cpp index 6a023d2a7d2..63ce0b325db 100644 --- a/chromium/third_party/WebKit/Source/core/animation/DocumentTimeline.cpp +++ b/chromium/third_party/WebKit/Source/core/animation/DocumentTimeline.cpp @@ -45,7 +45,6 @@ PassRefPtr<DocumentTimeline> DocumentTimeline::create(Document* document) DocumentTimeline::DocumentTimeline(Document* document) : m_currentTime(nullValue()) , m_document(document) - , m_zeroTimeAsPerfTime(nullValue()) { ASSERT(document); } @@ -63,10 +62,7 @@ PassRefPtr<Player> DocumentTimeline::play(TimedItem* child) void DocumentTimeline::serviceAnimations(double monotonicAnimationStartTime) { - if (!isNull(m_zeroTimeAsPerfTime)) { - ASSERT((isNull(m_currentTime)) || (m_currentTime + m_zeroTimeAsPerfTime <= monotonicAnimationStartTime)); - m_currentTime = monotonicAnimationStartTime - m_zeroTimeAsPerfTime; - } + m_currentTime = monotonicAnimationStartTime; for (int i = m_players.size() - 1; i >= 0; --i) { if (!m_players[i]->update()) @@ -79,12 +75,6 @@ void DocumentTimeline::serviceAnimations(double monotonicAnimationStartTime) dispatchEvents(); } -void DocumentTimeline::setZeroTimeAsPerfTime(double zeroTime) -{ - ASSERT(isNull(m_zeroTimeAsPerfTime)); - m_zeroTimeAsPerfTime = zeroTime; -} - void DocumentTimeline::pauseAnimationsForTesting(double pauseTime) { for (size_t i = 0; i < m_players.size(); i++) { @@ -95,17 +85,9 @@ void DocumentTimeline::pauseAnimationsForTesting(double pauseTime) void DocumentTimeline::dispatchEvents() { - Vector<EventToDispatch> events = m_events; + for (size_t i = 0; i < m_events.size(); i++) + m_events[i].target->dispatchEvent(m_events[i].event.release()); m_events.clear(); - for (size_t i = 0; i < events.size(); i++) - events[i].target->dispatchEvent(events[i].event.release()); -} - -size_t DocumentTimeline::numberOfActiveAnimationsForTesting() const -{ - // Includes all players whose directly associated timed items - // are current or in effect. - return isNull(m_currentTime) ? 0 : m_players.size(); } } // namespace diff --git a/chromium/third_party/WebKit/Source/core/animation/DocumentTimeline.h b/chromium/third_party/WebKit/Source/core/animation/DocumentTimeline.h index 56c4c388028..f5e438fd7db 100644 --- a/chromium/third_party/WebKit/Source/core/animation/DocumentTimeline.h +++ b/chromium/third_party/WebKit/Source/core/animation/DocumentTimeline.h @@ -51,12 +51,8 @@ public: static PassRefPtr<DocumentTimeline> create(Document*); void serviceAnimations(double); PassRefPtr<Player> play(TimedItem*); - // Called from setReadyState() in Document.cpp to set m_zeroTimeAsPerfTime to - // performance.timing.domInteractive. - void setZeroTimeAsPerfTime(double); double currentTime() { return m_currentTime; } void pauseAnimationsForTesting(double); - size_t numberOfActiveAnimationsForTesting() const; AnimationStack* animationStack(const Element* element) const { if (ActiveAnimations* animations = element->activeAnimations()) @@ -72,7 +68,6 @@ private: DocumentTimeline(Document*); void dispatchEvents(); double m_currentTime; - double m_zeroTimeAsPerfTime; Document* m_document; Vector<RefPtr<Player> > m_players; diff --git a/chromium/third_party/WebKit/Source/core/animation/DocumentTimelineTest.cpp b/chromium/third_party/WebKit/Source/core/animation/DocumentTimelineTest.cpp index e7d0e435c1d..ca515be0a69 100644 --- a/chromium/third_party/WebKit/Source/core/animation/DocumentTimelineTest.cpp +++ b/chromium/third_party/WebKit/Source/core/animation/DocumentTimelineTest.cpp @@ -51,7 +51,6 @@ protected: document = Document::create(); element = Element::create(nullQName() , document.get()); timeline = DocumentTimeline::create(document.get()); - timeline->setZeroTimeAsPerfTime(0); } RefPtr<Document> document; @@ -78,24 +77,6 @@ TEST_F(DocumentTimelineTest, EmptyKeyframeAnimation) EXPECT_FLOAT_EQ(100, timeline->currentTime()); } -TEST_F(DocumentTimelineTest, ZeroTimeAsPerfTime) -{ - timeline = DocumentTimeline::create(document.get()); - - timeline->serviceAnimations(100); - EXPECT_TRUE(isNull(timeline->currentTime())); - - timeline->serviceAnimations(200); - EXPECT_TRUE(isNull(timeline->currentTime())); - - timeline->setZeroTimeAsPerfTime(300); - timeline->serviceAnimations(300); - EXPECT_EQ(0, timeline->currentTime()); - - timeline->serviceAnimations(400); - EXPECT_EQ(100, timeline->currentTime()); -} - TEST_F(DocumentTimelineTest, PauseForTesting) { float seekTime = 1; @@ -109,47 +90,4 @@ TEST_F(DocumentTimelineTest, PauseForTesting) EXPECT_FLOAT_EQ(seekTime, player2->currentTime()); } -TEST_F(DocumentTimelineTest, NumberOfActiveAnimations) -{ - Timing timingForwardFill; - timingForwardFill.hasIterationDuration = true; - timingForwardFill.iterationDuration = 2; - - Timing timingNoFill; - timingNoFill.hasIterationDuration = true; - timingNoFill.iterationDuration = 2; - timingNoFill.fillMode = Timing::FillModeNone; - - Timing timingBackwardFillDelay; - timingBackwardFillDelay.hasIterationDuration = true; - timingBackwardFillDelay.iterationDuration = 1; - timingBackwardFillDelay.fillMode = Timing::FillModeBackwards; - timingBackwardFillDelay.startDelay = 1; - - Timing timingNoFillDelay; - timingNoFillDelay.hasIterationDuration = true; - timingNoFillDelay.iterationDuration = 1; - timingNoFillDelay.fillMode = Timing::FillModeNone; - timingNoFillDelay.startDelay = 1; - - RefPtr<Animation> anim1 = Animation::create(element.get(), KeyframeAnimationEffect::create(KeyframeAnimationEffect::KeyframeVector()), timingForwardFill); - RefPtr<Animation> anim2 = Animation::create(element.get(), KeyframeAnimationEffect::create(KeyframeAnimationEffect::KeyframeVector()), timingNoFill); - RefPtr<Animation> anim3 = Animation::create(element.get(), KeyframeAnimationEffect::create(KeyframeAnimationEffect::KeyframeVector()), timingBackwardFillDelay); - RefPtr<Animation> anim4 = Animation::create(element.get(), KeyframeAnimationEffect::create(KeyframeAnimationEffect::KeyframeVector()), timingNoFillDelay); - - RefPtr<Player> player1 = timeline->play(anim1.get()); - RefPtr<Player> player2 = timeline->play(anim2.get()); - RefPtr<Player> player3 = timeline->play(anim3.get()); - RefPtr<Player> player4 = timeline->play(anim4.get()); - - timeline->serviceAnimations(0); - EXPECT_EQ(4U, timeline->numberOfActiveAnimationsForTesting()); - timeline->serviceAnimations(0.5); - EXPECT_EQ(4U, timeline->numberOfActiveAnimationsForTesting()); - timeline->serviceAnimations(1.5); - EXPECT_EQ(4U, timeline->numberOfActiveAnimationsForTesting()); - timeline->serviceAnimations(3); - EXPECT_EQ(1U, timeline->numberOfActiveAnimationsForTesting()); -} - } diff --git a/chromium/third_party/WebKit/Source/core/animation/Player.cpp b/chromium/third_party/WebKit/Source/core/animation/Player.cpp index 0d44da78a69..7af07e2d49d 100644 --- a/chromium/third_party/WebKit/Source/core/animation/Player.cpp +++ b/chromium/third_party/WebKit/Source/core/animation/Player.cpp @@ -99,7 +99,6 @@ void Player::cancel() if (!m_content) return; - ASSERT(m_content->player() == this); m_content->detach(); m_content = 0; } diff --git a/chromium/third_party/WebKit/Source/core/animation/PlayerTest.cpp b/chromium/third_party/WebKit/Source/core/animation/PlayerTest.cpp index 744f2189b76..26970a998b5 100644 --- a/chromium/third_party/WebKit/Source/core/animation/PlayerTest.cpp +++ b/chromium/third_party/WebKit/Source/core/animation/PlayerTest.cpp @@ -48,7 +48,6 @@ protected: document = Document::create(); timeline = DocumentTimeline::create(document.get()); player = Player::create(timeline.get(), 0); - timeline->setZeroTimeAsPerfTime(0); } bool updateTimeline(double time) diff --git a/chromium/third_party/WebKit/Source/core/animation/css/CSSAnimatableValueFactory.cpp b/chromium/third_party/WebKit/Source/core/animation/css/CSSAnimatableValueFactory.cpp index 59381639cba..3d97ec3fff2 100644 --- a/chromium/third_party/WebKit/Source/core/animation/css/CSSAnimatableValueFactory.cpp +++ b/chromium/third_party/WebKit/Source/core/animation/css/CSSAnimatableValueFactory.cpp @@ -33,7 +33,6 @@ #include "CSSValueKeywords.h" #include "core/animation/AnimatableNumber.h" -#include "core/animation/AnimatableTransform.h" #include "core/animation/AnimatableUnknown.h" #include "core/platform/Length.h" #include "core/rendering/style/RenderStyle.h" @@ -113,6 +112,7 @@ namespace WebCore { // CSSPropertyWebkitShapeInside // CSSPropertyWebkitTextFillColor // CSSPropertyWebkitTextStrokeColor +// CSSPropertyWebkitTransform // CSSPropertyWebkitTransformOriginZ // CSSPropertyWidows // CSSPropertyWordSpacing @@ -207,8 +207,6 @@ PassRefPtr<AnimatableValue> CSSAnimatableValueFactory::create(CSSPropertyID prop return createFromLength(style->perspectiveOriginX(), style); case CSSPropertyWebkitPerspectiveOriginY: return createFromLength(style->perspectiveOriginY(), style); - case CSSPropertyWebkitTransform: - return AnimatableTransform::create(style->transform()); case CSSPropertyWebkitTransformOriginX: return createFromLength(style->transformOriginX(), style); case CSSPropertyWebkitTransformOriginY: diff --git a/chromium/third_party/WebKit/Source/core/animation/css/CSSAnimations.h b/chromium/third_party/WebKit/Source/core/animation/css/CSSAnimations.h index bd3c4e9517c..45dcf84b59e 100644 --- a/chromium/third_party/WebKit/Source/core/animation/css/CSSAnimations.h +++ b/chromium/third_party/WebKit/Source/core/animation/css/CSSAnimations.h @@ -78,7 +78,7 @@ public: bool isEmpty() const { return m_animations.isEmpty(); } void cancel(); private: - typedef HashMap<StringImpl*, RefPtr<Player> > AnimationMap; + typedef HashMap<StringImpl*, Player*> AnimationMap; AnimationMap m_animations; class EventDelegate FINAL : public TimedItemEventDelegate { public: diff --git a/chromium/third_party/WebKit/Source/core/core.gyp b/chromium/third_party/WebKit/Source/core/core.gyp index 106900d4266..7bf2ad20d6f 100644 --- a/chromium/third_party/WebKit/Source/core/core.gyp +++ b/chromium/third_party/WebKit/Source/core/core.gyp @@ -623,6 +623,27 @@ ['exclude', 'platform/graphics/cpu/arm/filters/.*NEON\\.(cpp|h)'], ], 'conditions': [ + ['use_default_render_theme==1', { + 'sources/': [ + ['exclude', 'platform/chromium/PlatformThemeChromiumWin.h'], + ['exclude', 'platform/chromium/PlatformThemeChromiumWin.cpp'], + ['exclude', 'platform/chromium/ScrollbarThemeChromiumWin.cpp'], + ['exclude', 'platform/chromium/ScrollbarThemeChromiumWin.h'], + ], + }, { # use_default_render_theme==0 + 'sources/': [ + ['exclude', 'platform/chromium/PlatformThemeChromiumDefault.cpp'], + ['exclude', 'platform/chromium/PlatformThemeChromiumDefault.h'], + ['exclude', 'platform/chromium/ScrollbarThemeChromiumDefault.cpp'], + ['exclude', 'platform/chromium/ScrollbarThemeChromiumDefault.h'], + ], + }], + ['use_default_render_theme==0 and OS!="android"', { + 'sources/': [ + ['exclude', 'platform/chromium/ScrollbarThemeChromiumOverlay.cpp'], + ['exclude', 'platform/chromium/ScrollbarThemeChromiumOverlay.h'], + ] + }], ['OS=="linux" or OS=="android"', { 'sources/': [ # Cherry-pick files excluded by the broader regular expressions above. @@ -649,9 +670,14 @@ ['exclude', 'Linux\\.cpp$'], ], }], - ['toolkit_uses_gtk == 0', { + ['toolkit_uses_gtk == 1', { + 'sources/': [ + # Cherry-pick files excluded by the broader regular expressions above. + ['include', 'platform/chromium/KeyCodeConversionGtk\\.cpp$'], + ], + }, { # toolkit_uses_gtk==0 'sources/': [ - ['exclude', 'platform/chromium/KeyCodeConversionGtk\\.cpp$'], + ['exclude', 'Gtk\\.cpp$'], ], }], ['OS=="mac"', { @@ -690,6 +716,9 @@ ['include', 'platform/mac/KillRingMac\\.mm$'], ['include', 'platform/mac/LocalCurrentGraphicsContext\\.mm$'], ['include', 'platform/mac/NSScrollerImpDetails\\.mm$'], + ['include', 'platform/mac/ScrollbarThemeMac\\.mm$'], + ['include', 'platform/mac/ScrollbarThemeMacNonOverlayAPI\\.mm$'], + ['include', 'platform/mac/ScrollbarThemeMacOverlayAPI\\.mm$'], ['include', 'platform/mac/ScrollAnimatorMac\\.mm$'], ['include', 'platform/mac/ScrollElasticityController\\.mm$'], ['include', 'platform/mac/ThemeMac\\.h$'], @@ -715,7 +744,9 @@ # included by regex above, instead. ['exclude', 'platform/graphics/skia/FontCustomPlatformDataSkia\\.cpp$'], - ['exclude', 'platform/ScrollbarThemeNonMacCommon\\.(cpp|h)$'], + # The Mac currently uses ScrollbarThemeChromiumMac.mm, which is not + # related to ScrollbarThemeChromium.cpp. + ['exclude', 'platform/chromium/ScrollbarThemeChromium\\.cpp$'], # Mac uses only ScrollAnimatorMac. ['exclude', 'platform/ScrollAnimatorNone\\.cpp$'], @@ -740,7 +771,6 @@ },{ # OS!="mac" 'sources/': [ ['exclude', 'Mac\\.(cpp|mm?)$'], - ['exclude', 'ScrollbarThemeMac'], # FIXME: We will eventually compile this too, but for now it's # only used on mac. @@ -756,10 +786,9 @@ 'sources/': [ ['exclude', 'Posix\\.cpp$'], - ['include', 'platform/ScrollbarThemeWin\\.(cpp|h)$'], - ['include', 'platform/graphics/chromium/TransparencyWin\\.(cpp|h)$'], - ['include', 'platform/graphics/opentype/'], - ['include', 'platform/graphics/skia/SkiaFontWin\\.(cpp|h)$'], + ['include', '/opentype/'], + ['include', '/SkiaFontWin\\.cpp$'], + ['include', '/TransparencyWin\\.cpp$'], ['exclude', 'platform/graphics/skia/FontCacheSkia\\.cpp$'], @@ -815,22 +844,6 @@ ['exclude', 'Android\\.cpp$'], ], }], - ['use_default_render_theme==1', { - 'sources/': [ - ['exclude', 'platform/ScrollbarThemeWin\\.(cpp|h)'], - ['exclude', 'platform/chromium/PlatformThemeChromiumWin\\.(cpp|h)'], - ], - }, { # use_default_render_theme==0 - 'sources/': [ - ['exclude', 'platform/ScrollbarThemeAuraOrGtk\\.(cpp|h)'], - ['exclude', 'platform/chromium/PlatformThemeChromiumDefault\\.(cpp|h)'], - ], - }], - ['use_default_render_theme==0 and OS!="android"', { - 'sources/': [ - ['exclude', 'platform/ScrollbarThemeOverlay\\.(cpp|h)'], - ] - }], ], }, { diff --git a/chromium/third_party/WebKit/Source/core/core.gypi b/chromium/third_party/WebKit/Source/core/core.gypi index 8d42702f791..fba11faa789 100644 --- a/chromium/third_party/WebKit/Source/core/core.gypi +++ b/chromium/third_party/WebKit/Source/core/core.gypi @@ -241,6 +241,7 @@ 'page/EventSource.idl', 'page/History.idl', 'page/ImageBitmap.idl', + 'page/ImageBitmapFactories.idl', 'page/Location.idl', 'page/MemoryInfo.idl', 'page/Navigator.idl', @@ -524,8 +525,6 @@ 'animation/AnimatableNeutral.h', 'animation/AnimatableNumber.cpp', 'animation/AnimatableNumber.h', - 'animation/AnimatableTransform.cpp', - 'animation/AnimatableTransform.h', 'animation/AnimatableUnknown.h', 'animation/AnimatableValue.cpp', 'animation/AnimatableValue.h', @@ -875,42 +874,6 @@ 'editing/chromium/EditorChromium.cpp', 'editing/htmlediting.cpp', 'editing/markup.cpp', - 'fetch/CSSStyleSheetResource.cpp', - 'fetch/CSSStyleSheetResource.h', - 'fetch/DocumentResource.cpp', - 'fetch/DocumentResource.h', - 'fetch/FontResource.cpp', - 'fetch/FontResource.h', - 'fetch/ImageResource.cpp', - 'fetch/ImageResource.h', - 'fetch/RawResource.cpp', - 'fetch/RawResource.h', - 'fetch/Resource.cpp', - 'fetch/Resource.h', - 'fetch/ResourceClientWalker.h', - 'fetch/ResourceFetcher.cpp', - 'fetch/ResourceFetcher.h', - 'fetch/ResourceLoadNotifier.cpp', - 'fetch/ResourceLoadNotifier.h', - 'fetch/ResourceLoader.cpp', - 'fetch/ResourceLoader.h', - 'fetch/ResourceLoaderOptions.h', - 'fetch/ResourcePtr.cpp', - 'fetch/ResourcePtr.h', - 'fetch/FetchRequest.cpp', - 'fetch/FetchRequest.h', - 'fetch/FetchInitiatorInfo.h', - 'fetch/ScriptResource.cpp', - 'fetch/ScriptResource.h', - 'fetch/ShaderResource.cpp', - 'fetch/ShaderResource.h', - 'fetch/DocumentResourceReference.h', - 'fetch/TextTrackResource.cpp', - 'fetch/TextTrackResource.h', - 'fetch/XSLStyleSheetResource.cpp', - 'fetch/XSLStyleSheetResource.h', - 'fetch/MemoryCache.cpp', - 'fetch/MemoryCache.h', 'fileapi/Blob.cpp', 'fileapi/Blob.h', 'fileapi/BlobBuilder.cpp', @@ -1107,6 +1070,9 @@ 'loader/PrerendererClient.cpp', 'loader/PrerendererClient.h', 'loader/ProgressTracker.cpp', + 'loader/ResourceLoadNotifier.cpp', + 'loader/ResourceLoader.cpp', + 'loader/ResourceLoaderOptions.h', 'loader/SinkDocument.cpp', 'loader/SinkDocument.h', 'loader/SubstituteData.h', @@ -1132,6 +1098,30 @@ 'loader/archive/MHTMLArchive.h', 'loader/archive/MHTMLParser.cpp', 'loader/archive/MHTMLParser.h', + 'loader/cache/CSSStyleSheetResource.cpp', + 'loader/cache/CSSStyleSheetResource.h', + 'loader/cache/DocumentResource.cpp', + 'loader/cache/DocumentResource.h', + 'loader/cache/FontResource.cpp', + 'loader/cache/FontResource.h', + 'loader/cache/ImageResource.cpp', + 'loader/cache/RawResource.cpp', + 'loader/cache/Resource.cpp', + 'loader/cache/ResourceClientWalker.h', + 'loader/cache/ResourcePtr.cpp', + 'loader/cache/ResourceFetcher.cpp', + 'loader/cache/FetchRequest.cpp', + 'loader/cache/FetchInitiatorInfo.h', + 'loader/cache/ScriptResource.cpp', + 'loader/cache/ScriptResource.h', + 'loader/cache/ShaderResource.cpp', + 'loader/cache/ShaderResource.h', + 'loader/cache/DocumentResourceReference.h', + 'loader/cache/TextTrackResource.cpp', + 'loader/cache/TextTrackResource.h', + 'loader/cache/XSLStyleSheetResource.cpp', + 'loader/cache/XSLStyleSheetResource.h', + 'loader/cache/MemoryCache.cpp', 'page/AutoscrollController.cpp', 'page/AutoscrollController.h', 'page/BarProp.cpp', @@ -1159,10 +1149,6 @@ 'page/DOMWindow.h', 'page/DOMWindowBase64.cpp', 'page/DOMWindowBase64.h', - 'page/DOMWindowLifecycleNotifier.cpp', - 'page/DOMWindowLifecycleNotifier.h', - 'page/DOMWindowLifecycleObserver.cpp', - 'page/DOMWindowLifecycleObserver.h', 'page/DOMWindowTimers.cpp', 'page/DOMWindowTimers.h', 'page/DOMWindowPagePopup.cpp', @@ -1185,6 +1171,8 @@ 'page/History.h', 'page/ImageBitmap.cpp', 'page/ImageBitmap.h', + 'page/ImageBitmapFactories.cpp', + 'page/ImageBitmapFactories.h', 'page/LayoutMilestones.h', 'page/Location.cpp', 'page/Location.h', @@ -1494,8 +1482,6 @@ 'rendering/RenderWordBreak.h', 'rendering/RootInlineBox.cpp', 'rendering/ScrollBehavior.cpp', - 'rendering/SubtreeLayoutScope.cpp', - 'rendering/SubtreeLayoutScope.h', 'rendering/TableLayout.h', 'rendering/TrailingFloatsRootInlineBox.h', 'rendering/VerticalPositionCache.h', @@ -1503,8 +1489,6 @@ 'rendering/break_lines.h', 'rendering/shapes/PolygonShape.cpp', 'rendering/shapes/PolygonShape.h', - 'rendering/shapes/RasterShape.cpp', - 'rendering/shapes/RasterShape.h', 'rendering/shapes/RectangleShape.cpp', 'rendering/shapes/RectangleShape.h', 'rendering/shapes/Shape.cpp', @@ -1764,11 +1748,7 @@ 'dom/CustomElementDefinition.h', 'dom/CustomElementDescriptor.h', 'dom/CustomElementDescriptorHash.h', - 'dom/CustomElementException.cpp', - 'dom/CustomElementException.h', 'dom/CustomElementLifecycleCallbacks.h', - 'dom/CustomElementObserver.cpp', - 'dom/CustomElementObserver.h', 'dom/CustomElementRegistrationContext.cpp', 'dom/CustomElementRegistrationContext.h', 'dom/CustomElementRegistry.cpp', @@ -1946,8 +1926,6 @@ 'dom/SecurityPolicyViolationEvent.h', 'dom/SelectorQuery.cpp', 'dom/SelectorQuery.h', - 'dom/ShadowTreeStyleSheetCollection.cpp', - 'dom/ShadowTreeStyleSheetCollection.h', 'dom/SimulatedClickOptions.h', 'dom/SpaceSplitString.cpp', 'dom/StaticNodeList.cpp', @@ -2605,25 +2583,7 @@ 'platform/ScrollView.cpp', 'platform/ScrollableArea.cpp', 'platform/Scrollbar.cpp', - 'platform/Scrollbar.h', 'platform/ScrollbarTheme.cpp', - 'platform/ScrollbarTheme.h', - 'platform/ScrollbarThemeAndroid.cpp', - 'platform/ScrollbarThemeAuraOrGtk.cpp', - 'platform/ScrollbarThemeAuraOrGtk.h', - 'platform/ScrollbarThemeClient.h', - 'platform/ScrollbarThemeMacCommon.h', - 'platform/ScrollbarThemeMacCommon.mm', - 'platform/ScrollbarThemeMacNonOverlayAPI.h', - 'platform/ScrollbarThemeMacNonOverlayAPI.mm', - 'platform/ScrollbarThemeMacOverlayAPI.h', - 'platform/ScrollbarThemeMacOverlayAPI.mm', - 'platform/ScrollbarThemeNonMacCommon.cpp', - 'platform/ScrollbarThemeNonMacCommon.h', - 'platform/ScrollbarThemeOverlay.cpp', - 'platform/ScrollbarThemeOverlay.h', - 'platform/ScrollbarThemeWin.cpp', - 'platform/ScrollbarThemeWin.h', 'platform/SecureTextInput.cpp', 'platform/SecureTextInput.h', 'platform/SerializedResource.h', @@ -2765,6 +2725,15 @@ 'platform/chromium/Prerender.h', 'platform/chromium/PrerenderHandle.cpp', 'platform/chromium/SSLKeyGeneratorChromium.cpp', + 'platform/chromium/ScrollbarThemeChromium.cpp', + 'platform/chromium/ScrollbarThemeChromium.h', + 'platform/chromium/ScrollbarThemeChromiumAndroid.cpp', + 'platform/chromium/ScrollbarThemeChromiumDefault.cpp', + 'platform/chromium/ScrollbarThemeChromiumDefault.h', + 'platform/chromium/ScrollbarThemeChromiumOverlay.cpp', + 'platform/chromium/ScrollbarThemeChromiumOverlay.h', + 'platform/chromium/ScrollbarThemeChromiumWin.cpp', + 'platform/chromium/ScrollbarThemeChromiumWin.h', 'platform/chromium/SharedTimerChromium.cpp', 'platform/chromium/SoundChromiumPosix.cpp', 'platform/chromium/SoundChromiumWin.cpp', @@ -3088,6 +3057,12 @@ 'platform/mac/ScrollAnimatorMac.mm', 'platform/mac/ScrollElasticityController.h', 'platform/mac/ScrollElasticityController.mm', + 'platform/mac/ScrollbarThemeMac.h', + 'platform/mac/ScrollbarThemeMac.mm', + 'platform/mac/ScrollbarThemeMacNonOverlayAPI.h', + 'platform/mac/ScrollbarThemeMacNonOverlayAPI.mm', + 'platform/mac/ScrollbarThemeMacOverlayAPI.h', + 'platform/mac/ScrollbarThemeMacOverlayAPI.mm', 'platform/mac/ThemeMac.h', 'platform/mac/ThemeMac.mm', 'platform/mac/WebFontCache.mm', @@ -3765,10 +3740,10 @@ 'animation/TimedItemCalculationsTest.cpp', 'animation/TimedItemTest.cpp', 'css/CSSParserValuesTest.cpp', - 'fetch/ImageResourceTest.cpp', - 'fetch/MemoryCacheTest.cpp', - 'fetch/ResourceFetcherTest.cpp', 'html/TimeRangesTest.cpp', + 'loader/cache/ImageResourceTest.cpp', + 'loader/cache/MemoryCacheTest.cpp', + 'loader/cache/ResourceFetcherTest.cpp', 'page/ImageBitmapTest.cpp', 'platform/DecimalTest.cpp', 'platform/SharedBufferTest.cpp', diff --git a/chromium/third_party/WebKit/Source/core/core_derived_sources.gyp b/chromium/third_party/WebKit/Source/core/core_derived_sources.gyp index e89bab627a6..7e09172cdc1 100644 --- a/chromium/third_party/WebKit/Source/core/core_derived_sources.gyp +++ b/chromium/third_party/WebKit/Source/core/core_derived_sources.gyp @@ -481,7 +481,7 @@ 'scripts/Hasher.pm', 'scripts/StaticString.pm', 'scripts/make_names.pl', - 'fetch/FetchInitiatorTypeNames.in', + 'loader/cache/FetchInitiatorTypeNames.in', ], 'outputs': [ '<(SHARED_INTERMEDIATE_DIR)/blink/FetchInitiatorTypeNames.cpp', diff --git a/chromium/third_party/WebKit/Source/core/css/CSSArrayFunctionValue.h b/chromium/third_party/WebKit/Source/core/css/CSSArrayFunctionValue.h index 9325207b6b0..2e25e9cb3ca 100644 --- a/chromium/third_party/WebKit/Source/core/css/CSSArrayFunctionValue.h +++ b/chromium/third_party/WebKit/Source/core/css/CSSArrayFunctionValue.h @@ -50,7 +50,7 @@ public: private: CSSArrayFunctionValue(); - explicit CSSArrayFunctionValue(const CSSArrayFunctionValue& cloneFrom); + CSSArrayFunctionValue(const CSSArrayFunctionValue& cloneFrom); }; } // namespace WebCore diff --git a/chromium/third_party/WebKit/Source/core/css/CSSCanvasValue.h b/chromium/third_party/WebKit/Source/core/css/CSSCanvasValue.h index 8283adb124e..c2e7b779a1b 100644 --- a/chromium/third_party/WebKit/Source/core/css/CSSCanvasValue.h +++ b/chromium/third_party/WebKit/Source/core/css/CSSCanvasValue.h @@ -50,7 +50,7 @@ public: bool equals(const CSSCanvasValue&) const; private: - explicit CSSCanvasValue(const String& name) + CSSCanvasValue(const String& name) : CSSImageGeneratorValue(CanvasClass) , m_canvasObserver(this) , m_name(name) diff --git a/chromium/third_party/WebKit/Source/core/css/CSSComputedStyleDeclaration.cpp b/chromium/third_party/WebKit/Source/core/css/CSSComputedStyleDeclaration.cpp index 7285c6033ca..5484ae54383 100644 --- a/chromium/third_party/WebKit/Source/core/css/CSSComputedStyleDeclaration.cpp +++ b/chromium/third_party/WebKit/Source/core/css/CSSComputedStyleDeclaration.cpp @@ -83,14 +83,6 @@ namespace WebCore { // NOTE: Do not use this list, use computableProperties() instead // to respect runtime enabling of CSS properties. static const CSSPropertyID staticComputableProperties[] = { - CSSPropertyAnimationDelay, - CSSPropertyAnimationDirection, - CSSPropertyAnimationDuration, - CSSPropertyAnimationFillMode, - CSSPropertyAnimationIterationCount, - CSSPropertyAnimationName, - CSSPropertyAnimationPlayState, - CSSPropertyAnimationTimingFunction, CSSPropertyBackgroundAttachment, CSSPropertyBackgroundBlendMode, CSSPropertyBackgroundClip, @@ -2338,48 +2330,24 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(CSSPropert return cssValuePool().createIdentifierValue(CSSValueBorderBox); case CSSPropertyWebkitAppRegion: return cssValuePool().createIdentifierValue(style->getDraggableRegionMode() == DraggableRegionDrag ? CSSValueDrag : CSSValueNoDrag); - case CSSPropertyAnimationDelay: - if (!RuntimeEnabledFeatures::cssAnimationUnprefixedEnabled()) - break; case CSSPropertyWebkitAnimationDelay: return getDelayValue(style->animations()); - case CSSPropertyAnimationDirection: - if (!RuntimeEnabledFeatures::cssAnimationUnprefixedEnabled()) - break; case CSSPropertyWebkitAnimationDirection: { RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); const CSSAnimationDataList* t = style->animations(); if (t) { for (size_t i = 0; i < t->size(); ++i) { - switch (t->animation(i)->direction()) { - case CSSAnimationData::AnimationDirectionNormal: - list->append(cssValuePool().createIdentifierValue(CSSValueNormal)); - break; - case CSSAnimationData::AnimationDirectionAlternate: + if (t->animation(i)->direction()) list->append(cssValuePool().createIdentifierValue(CSSValueAlternate)); - break; - case CSSAnimationData::AnimationDirectionReverse: - list->append(cssValuePool().createIdentifierValue(CSSValueReverse)); - break; - case CSSAnimationData::AnimationDirectionAlternateReverse: - list->append(cssValuePool().createIdentifierValue(CSSValueAlternateReverse)); - break; - default: - ASSERT_NOT_REACHED(); - } + else + list->append(cssValuePool().createIdentifierValue(CSSValueNormal)); } } else list->append(cssValuePool().createIdentifierValue(CSSValueNormal)); return list.release(); } - case CSSPropertyAnimationDuration: - if (!RuntimeEnabledFeatures::cssAnimationUnprefixedEnabled()) - break; case CSSPropertyWebkitAnimationDuration: return getDurationValue(style->animations()); - case CSSPropertyAnimationFillMode: - if (!RuntimeEnabledFeatures::cssAnimationUnprefixedEnabled()) - break; case CSSPropertyWebkitAnimationFillMode: { RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); const CSSAnimationDataList* t = style->animations(); @@ -2404,9 +2372,6 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(CSSPropert list->append(cssValuePool().createIdentifierValue(CSSValueNone)); return list.release(); } - case CSSPropertyAnimationIterationCount: - if (!RuntimeEnabledFeatures::cssAnimationUnprefixedEnabled()) - break; case CSSPropertyWebkitAnimationIterationCount: { RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); const CSSAnimationDataList* t = style->animations(); @@ -2422,9 +2387,6 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(CSSPropert list->append(cssValuePool().createValue(CSSAnimationData::initialAnimationIterationCount(), CSSPrimitiveValue::CSS_NUMBER)); return list.release(); } - case CSSPropertyAnimationName: - if (!RuntimeEnabledFeatures::cssAnimationUnprefixedEnabled()) - break; case CSSPropertyWebkitAnimationName: { RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); const CSSAnimationDataList* t = style->animations(); @@ -2435,9 +2397,6 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(CSSPropert list->append(cssValuePool().createIdentifierValue(CSSValueNone)); return list.release(); } - case CSSPropertyAnimationPlayState: - if (!RuntimeEnabledFeatures::cssAnimationUnprefixedEnabled()) - break; case CSSPropertyWebkitAnimationPlayState: { RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); const CSSAnimationDataList* t = style->animations(); @@ -2453,9 +2412,6 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(CSSPropert list->append(cssValuePool().createIdentifierValue(CSSValueRunning)); return list.release(); } - case CSSPropertyAnimationTimingFunction: - if (!RuntimeEnabledFeatures::cssAnimationUnprefixedEnabled()) - break; case CSSPropertyWebkitAnimationTimingFunction: return getTimingFunctionValue(style->animations()); case CSSPropertyWebkitAppearance: @@ -2810,7 +2766,6 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(CSSPropert break; /* Unimplemented -webkit- properties */ - case CSSPropertyAnimation: case CSSPropertyWebkitAnimation: case CSSPropertyWebkitBorderRadius: case CSSPropertyWebkitMarginCollapse: diff --git a/chromium/third_party/WebKit/Source/core/css/CSSCrossfadeValue.cpp b/chromium/third_party/WebKit/Source/core/css/CSSCrossfadeValue.cpp index d409f79aafa..c48eaf220e0 100644 --- a/chromium/third_party/WebKit/Source/core/css/CSSCrossfadeValue.cpp +++ b/chromium/third_party/WebKit/Source/core/css/CSSCrossfadeValue.cpp @@ -27,7 +27,7 @@ #include "core/css/CSSCrossfadeValue.h" #include "core/css/CSSImageValue.h" -#include "core/fetch/ImageResource.h" +#include "core/loader/cache/ImageResource.h" #include "core/platform/graphics/CrossfadeGeneratedImage.h" #include "core/rendering/RenderObject.h" #include "core/rendering/style/StyleFetchedImage.h" diff --git a/chromium/third_party/WebKit/Source/core/css/CSSCrossfadeValue.h b/chromium/third_party/WebKit/Source/core/css/CSSCrossfadeValue.h index 4df75201818..450b6153caf 100644 --- a/chromium/third_party/WebKit/Source/core/css/CSSCrossfadeValue.h +++ b/chromium/third_party/WebKit/Source/core/css/CSSCrossfadeValue.h @@ -28,9 +28,9 @@ #include "core/css/CSSImageGeneratorValue.h" #include "core/css/CSSPrimitiveValue.h" -#include "core/fetch/ImageResource.h" -#include "core/fetch/ImageResourceClient.h" -#include "core/fetch/ResourcePtr.h" +#include "core/loader/cache/ImageResource.h" +#include "core/loader/cache/ImageResourceClient.h" +#include "core/loader/cache/ResourcePtr.h" #include "core/platform/graphics/Image.h" namespace WebCore { diff --git a/chromium/third_party/WebKit/Source/core/css/CSSCursorImageValue.cpp b/chromium/third_party/WebKit/Source/core/css/CSSCursorImageValue.cpp index dd68e0b9850..21deed71b99 100644 --- a/chromium/third_party/WebKit/Source/core/css/CSSCursorImageValue.cpp +++ b/chromium/third_party/WebKit/Source/core/css/CSSCursorImageValue.cpp @@ -25,8 +25,8 @@ #include "SVGNames.h" #include "core/css/CSSImageSetValue.h" #include "core/css/CSSImageValue.h" -#include "core/fetch/ImageResource.h" -#include "core/fetch/ResourceFetcher.h" +#include "core/loader/cache/ImageResource.h" +#include "core/loader/cache/ResourceFetcher.h" #include "core/rendering/style/StyleFetchedImage.h" #include "core/rendering/style/StyleFetchedImageSet.h" #include "core/rendering/style/StyleImage.h" diff --git a/chromium/third_party/WebKit/Source/core/css/CSSFilterValue.h b/chromium/third_party/WebKit/Source/core/css/CSSFilterValue.h index 3398cfa788b..d937e0c201e 100644 --- a/chromium/third_party/WebKit/Source/core/css/CSSFilterValue.h +++ b/chromium/third_party/WebKit/Source/core/css/CSSFilterValue.h @@ -66,8 +66,8 @@ public: bool equals(const CSSFilterValue&) const; private: - explicit CSSFilterValue(FilterOperationType); - explicit CSSFilterValue(const CSSFilterValue& cloneFrom); + CSSFilterValue(FilterOperationType); + CSSFilterValue(const CSSFilterValue& cloneFrom); FilterOperationType m_type; }; diff --git a/chromium/third_party/WebKit/Source/core/css/CSSFontFaceSource.cpp b/chromium/third_party/WebKit/Source/core/css/CSSFontFaceSource.cpp index c70ee4aa4b0..1f160aa51f7 100644 --- a/chromium/third_party/WebKit/Source/core/css/CSSFontFaceSource.cpp +++ b/chromium/third_party/WebKit/Source/core/css/CSSFontFaceSource.cpp @@ -28,7 +28,7 @@ #include "core/css/CSSFontFace.h" #include "core/css/CSSFontSelector.h" -#include "core/fetch/FontResource.h" +#include "core/loader/cache/FontResource.h" #include "core/platform/HistogramSupport.h" #include "core/platform/graphics/FontCache.h" #include "core/platform/graphics/FontDescription.h" diff --git a/chromium/third_party/WebKit/Source/core/css/CSSFontFaceSource.h b/chromium/third_party/WebKit/Source/core/css/CSSFontFaceSource.h index e99c8e52a86..aea2ac51258 100644 --- a/chromium/third_party/WebKit/Source/core/css/CSSFontFaceSource.h +++ b/chromium/third_party/WebKit/Source/core/css/CSSFontFaceSource.h @@ -26,8 +26,8 @@ #ifndef CSSFontFaceSource_h #define CSSFontFaceSource_h -#include "core/fetch/FontResource.h" -#include "core/fetch/ResourcePtr.h" +#include "core/loader/cache/FontResource.h" +#include "core/loader/cache/ResourcePtr.h" #include "core/platform/Timer.h" #include "wtf/HashMap.h" #include "wtf/text/AtomicString.h" diff --git a/chromium/third_party/WebKit/Source/core/css/CSSFontFaceSrcValue.cpp b/chromium/third_party/WebKit/Source/core/css/CSSFontFaceSrcValue.cpp index 7b3cef66d05..46fd349a0db 100644 --- a/chromium/third_party/WebKit/Source/core/css/CSSFontFaceSrcValue.cpp +++ b/chromium/third_party/WebKit/Source/core/css/CSSFontFaceSrcValue.cpp @@ -30,9 +30,9 @@ #include "core/css/StyleSheetContents.h" #include "core/dom/Document.h" #include "core/dom/Node.h" -#include "core/fetch/FetchRequest.h" -#include "core/fetch/FontResource.h" -#include "core/fetch/ResourceFetcher.h" +#include "core/loader/cache/FetchRequest.h" +#include "core/loader/cache/FontResource.h" +#include "core/loader/cache/ResourceFetcher.h" #include "core/platform/graphics/FontCustomPlatformData.h" #include "core/svg/SVGFontFaceElement.h" #include "wtf/text/StringBuilder.h" diff --git a/chromium/third_party/WebKit/Source/core/css/CSSFontFaceSrcValue.h b/chromium/third_party/WebKit/Source/core/css/CSSFontFaceSrcValue.h index 9129f1c9b4d..023e38ec181 100644 --- a/chromium/third_party/WebKit/Source/core/css/CSSFontFaceSrcValue.h +++ b/chromium/third_party/WebKit/Source/core/css/CSSFontFaceSrcValue.h @@ -27,7 +27,7 @@ #define CSSFontFaceSrcValue_h #include "core/css/CSSValue.h" -#include "core/fetch/ResourcePtr.h" +#include "core/loader/cache/ResourcePtr.h" #include "wtf/PassRefPtr.h" #include "wtf/text/WTFString.h" diff --git a/chromium/third_party/WebKit/Source/core/css/CSSFontSelector.cpp b/chromium/third_party/WebKit/Source/core/css/CSSFontSelector.cpp index 3bc725a2c93..f721acd1d2e 100644 --- a/chromium/third_party/WebKit/Source/core/css/CSSFontSelector.cpp +++ b/chromium/third_party/WebKit/Source/core/css/CSSFontSelector.cpp @@ -43,9 +43,9 @@ #include "core/css/StyleRule.h" #include "core/css/resolver/StyleResolver.h" #include "core/dom/Document.h" -#include "core/fetch/FontResource.h" -#include "core/fetch/ResourceFetcher.h" #include "core/loader/FrameLoader.h" +#include "core/loader/cache/FontResource.h" +#include "core/loader/cache/ResourceFetcher.h" #include "core/page/Frame.h" #include "core/page/Settings.h" #include "core/platform/graphics/FontCache.h" diff --git a/chromium/third_party/WebKit/Source/core/css/CSSFontSelector.h b/chromium/third_party/WebKit/Source/core/css/CSSFontSelector.h index 306160f49c3..8d41ad2ba01 100644 --- a/chromium/third_party/WebKit/Source/core/css/CSSFontSelector.h +++ b/chromium/third_party/WebKit/Source/core/css/CSSFontSelector.h @@ -26,7 +26,7 @@ #ifndef CSSFontSelector_h #define CSSFontSelector_h -#include "core/fetch/ResourcePtr.h" +#include "core/loader/cache/ResourcePtr.h" #include "core/platform/Timer.h" #include "core/platform/graphics/FontSelector.h" #include "wtf/Forward.h" @@ -74,7 +74,7 @@ public: void beginLoadingFontSoon(FontResource*); private: - explicit CSSFontSelector(Document*); + CSSFontSelector(Document*); void dispatchInvalidationCallbacks(); diff --git a/chromium/third_party/WebKit/Source/core/css/CSSGradientValue.h b/chromium/third_party/WebKit/Source/core/css/CSSGradientValue.h index 2eed10b981f..5c3c631d507 100644 --- a/chromium/third_party/WebKit/Source/core/css/CSSGradientValue.h +++ b/chromium/third_party/WebKit/Source/core/css/CSSGradientValue.h @@ -164,7 +164,7 @@ private: { } - explicit CSSLinearGradientValue(const CSSLinearGradientValue& other) + CSSLinearGradientValue(const CSSLinearGradientValue& other) : CSSGradientValue(other, LinearGradientClass, other.gradientType()) , m_angle(other.m_angle) { @@ -207,7 +207,7 @@ private: { } - explicit CSSRadialGradientValue(const CSSRadialGradientValue& other) + CSSRadialGradientValue(const CSSRadialGradientValue& other) : CSSGradientValue(other, RadialGradientClass, other.gradientType()) , m_firstRadius(other.m_firstRadius) , m_secondRadius(other.m_secondRadius) diff --git a/chromium/third_party/WebKit/Source/core/css/CSSImageGeneratorValue.h b/chromium/third_party/WebKit/Source/core/css/CSSImageGeneratorValue.h index 4d967684ed4..8a1602410af 100644 --- a/chromium/third_party/WebKit/Source/core/css/CSSImageGeneratorValue.h +++ b/chromium/third_party/WebKit/Source/core/css/CSSImageGeneratorValue.h @@ -68,7 +68,7 @@ public: void loadSubimages(ResourceFetcher*); protected: - explicit CSSImageGeneratorValue(ClassType); + CSSImageGeneratorValue(ClassType); Image* getImage(RenderObject*, const IntSize&); void putImage(const IntSize&, PassRefPtr<Image>); diff --git a/chromium/third_party/WebKit/Source/core/css/CSSImageSetValue.cpp b/chromium/third_party/WebKit/Source/core/css/CSSImageSetValue.cpp index 231244d3271..efae6467979 100644 --- a/chromium/third_party/WebKit/Source/core/css/CSSImageSetValue.cpp +++ b/chromium/third_party/WebKit/Source/core/css/CSSImageSetValue.cpp @@ -30,9 +30,9 @@ #include "core/css/CSSImageValue.h" #include "core/css/CSSPrimitiveValue.h" #include "core/dom/Document.h" -#include "core/fetch/FetchRequest.h" -#include "core/fetch/ImageResource.h" -#include "core/fetch/ResourceFetcher.h" +#include "core/loader/cache/FetchRequest.h" +#include "core/loader/cache/ImageResource.h" +#include "core/loader/cache/ResourceFetcher.h" #include "core/rendering/style/StyleFetchedImageSet.h" #include "core/rendering/style/StylePendingImage.h" #include "wtf/text/StringBuilder.h" diff --git a/chromium/third_party/WebKit/Source/core/css/CSSImageSetValue.h b/chromium/third_party/WebKit/Source/core/css/CSSImageSetValue.h index 7f5a377441f..42fdae908ea 100644 --- a/chromium/third_party/WebKit/Source/core/css/CSSImageSetValue.h +++ b/chromium/third_party/WebKit/Source/core/css/CSSImageSetValue.h @@ -66,7 +66,7 @@ protected: private: CSSImageSetValue(); - explicit CSSImageSetValue(const CSSImageSetValue& cloneFrom); + CSSImageSetValue(const CSSImageSetValue& cloneFrom); void fillImageSet(); static inline bool compareByScaleFactor(ImageWithScale first, ImageWithScale second) { return first.scaleFactor < second.scaleFactor; } diff --git a/chromium/third_party/WebKit/Source/core/css/CSSImageValue.cpp b/chromium/third_party/WebKit/Source/core/css/CSSImageValue.cpp index c2b4cde2260..afd96591987 100644 --- a/chromium/third_party/WebKit/Source/core/css/CSSImageValue.cpp +++ b/chromium/third_party/WebKit/Source/core/css/CSSImageValue.cpp @@ -24,9 +24,9 @@ #include "FetchInitiatorTypeNames.h" #include "core/css/CSSParser.h" #include "core/dom/Document.h" -#include "core/fetch/FetchRequest.h" -#include "core/fetch/ImageResource.h" -#include "core/fetch/ResourceFetcher.h" +#include "core/loader/cache/FetchRequest.h" +#include "core/loader/cache/ImageResource.h" +#include "core/loader/cache/ResourceFetcher.h" #include "core/rendering/style/StyleFetchedImage.h" #include "core/rendering/style/StylePendingImage.h" diff --git a/chromium/third_party/WebKit/Source/core/css/CSSImageValue.h b/chromium/third_party/WebKit/Source/core/css/CSSImageValue.h index 0e66982cb1a..1a9b3ea5852 100644 --- a/chromium/third_party/WebKit/Source/core/css/CSSImageValue.h +++ b/chromium/third_party/WebKit/Source/core/css/CSSImageValue.h @@ -22,7 +22,7 @@ #define CSSImageValue_h #include "core/css/CSSValue.h" -#include "core/fetch/ResourceFetcher.h" +#include "core/loader/cache/ResourceFetcher.h" #include "wtf/RefPtr.h" namespace WebCore { diff --git a/chromium/third_party/WebKit/Source/core/css/CSSInitialValue.h b/chromium/third_party/WebKit/Source/core/css/CSSInitialValue.h index f2bc029904f..4a0f53fb772 100644 --- a/chromium/third_party/WebKit/Source/core/css/CSSInitialValue.h +++ b/chromium/third_party/WebKit/Source/core/css/CSSInitialValue.h @@ -44,7 +44,7 @@ public: bool equals(const CSSInitialValue&) const { return true; } private: - explicit CSSInitialValue(bool implicit) + CSSInitialValue(bool implicit) : CSSValue(InitialClass) , m_isImplicit(implicit) { diff --git a/chromium/third_party/WebKit/Source/core/css/CSSKeyframeRule.cpp b/chromium/third_party/WebKit/Source/core/css/CSSKeyframeRule.cpp index 672b726c4c7..6024c87c838 100644 --- a/chromium/third_party/WebKit/Source/core/css/CSSKeyframeRule.cpp +++ b/chromium/third_party/WebKit/Source/core/css/CSSKeyframeRule.cpp @@ -54,14 +54,14 @@ void StyleKeyframe::setProperties(PassRefPtr<StylePropertySet> properties) } /* static */ -void StyleKeyframe::parseKeyString(const String& s, Vector<double>& keys) +void StyleKeyframe::parseKeyString(const String& s, Vector<float>& keys) { keys.clear(); Vector<String> strings; s.split(',', strings); for (size_t i = 0; i < strings.size(); ++i) { - double key = -1; + float key = -1; String cur = strings[i].stripWhiteSpace(); // For now the syntax MUST be 'xxx%' or 'from' or 'to', where xxx is a legal floating point number @@ -70,7 +70,7 @@ void StyleKeyframe::parseKeyString(const String& s, Vector<double>& keys) else if (cur == "to") key = 1; else if (cur.endsWith('%')) { - double k = cur.substring(0, cur.length() - 1).toDouble(); + float k = cur.substring(0, cur.length() - 1).toFloat(); if (k >= 0 && k <= 100) key = k / 100; } diff --git a/chromium/third_party/WebKit/Source/core/css/CSSKeyframeRule.h b/chromium/third_party/WebKit/Source/core/css/CSSKeyframeRule.h index a2833a2d954..17a44829661 100644 --- a/chromium/third_party/WebKit/Source/core/css/CSSKeyframeRule.h +++ b/chromium/third_party/WebKit/Source/core/css/CSSKeyframeRule.h @@ -51,7 +51,7 @@ public: // invalid string? void setKeyText(const String& s) { m_key = s; } - void getKeys(Vector<double>& keys) const { parseKeyString(m_key, keys); } + void getKeys(Vector<float>& keys) const { parseKeyString(m_key, keys); } const StylePropertySet* properties() const { return m_properties.get(); } MutableStylePropertySet* mutableProperties(); @@ -62,7 +62,7 @@ public: private: StyleKeyframe(); - static void parseKeyString(const String&, Vector<double>& keys); + static void parseKeyString(const String&, Vector<float>& keys); RefPtr<StylePropertySet> m_properties; // FIXME: This should be a parsed vector of floats. diff --git a/chromium/third_party/WebKit/Source/core/css/CSSKeyframesRule.h b/chromium/third_party/WebKit/Source/core/css/CSSKeyframesRule.h index be2ba3cef38..cae53c61092 100644 --- a/chromium/third_party/WebKit/Source/core/css/CSSKeyframesRule.h +++ b/chromium/third_party/WebKit/Source/core/css/CSSKeyframesRule.h @@ -58,7 +58,7 @@ public: private: StyleRuleKeyframes(); - explicit StyleRuleKeyframes(const StyleRuleKeyframes&); + StyleRuleKeyframes(const StyleRuleKeyframes&); Vector<RefPtr<StyleKeyframe> > m_keyframes; AtomicString m_name; diff --git a/chromium/third_party/WebKit/Source/core/css/CSSLineBoxContainValue.h b/chromium/third_party/WebKit/Source/core/css/CSSLineBoxContainValue.h index 6e5a050e525..de630498b07 100644 --- a/chromium/third_party/WebKit/Source/core/css/CSSLineBoxContainValue.h +++ b/chromium/third_party/WebKit/Source/core/css/CSSLineBoxContainValue.h @@ -53,7 +53,7 @@ private: LineBoxContain m_value; private: - explicit CSSLineBoxContainValue(LineBoxContain); + CSSLineBoxContainValue(LineBoxContain); }; } // namespace diff --git a/chromium/third_party/WebKit/Source/core/css/CSSParser-in.cpp b/chromium/third_party/WebKit/Source/core/css/CSSParser-in.cpp index ee73ceef792..0e45c5c3823 100644 --- a/chromium/third_party/WebKit/Source/core/css/CSSParser-in.cpp +++ b/chromium/third_party/WebKit/Source/core/css/CSSParser-in.cpp @@ -2402,16 +2402,6 @@ bool CSSParser::parseValue(CSSPropertyID propId, bool important) } return false; } - case CSSPropertyAnimationDelay: - case CSSPropertyAnimationDirection: - case CSSPropertyAnimationDuration: - case CSSPropertyAnimationFillMode: - case CSSPropertyAnimationName: - case CSSPropertyAnimationPlayState: - case CSSPropertyAnimationIterationCount: - case CSSPropertyAnimationTimingFunction: - if (!RuntimeEnabledFeatures::cssAnimationUnprefixedEnabled()) - break; case CSSPropertyWebkitAnimationDelay: case CSSPropertyWebkitAnimationDirection: case CSSPropertyWebkitAnimationDuration: @@ -2603,7 +2593,7 @@ bool CSSParser::parseValue(CSSPropertyID propId, bool important) case CSSPropertyBorder: // [ 'border-width' || 'border-style' || <color> ] | inherit { - if (parseShorthand(propId, parsingShorthandForProperty(CSSPropertyBorder), important)) { + if (parseShorthand(propId, borderShorthandForParsing(), important)) { // The CSS3 Borders and Backgrounds specification says that border also resets border-image. It's as // though a value of none was specified for the image. addExpandedPropertyForValue(CSSPropertyBorderImage, cssValuePool().createImplicitInitialValue(), important); @@ -2667,11 +2657,8 @@ bool CSSParser::parseValue(CSSPropertyID propId, bool important) return parseShorthand(propId, webkitColumnRuleShorthand(), important); case CSSPropertyWebkitTextStroke: return parseShorthand(propId, webkitTextStrokeShorthand(), important); - case CSSPropertyAnimation: - if (!RuntimeEnabledFeatures::cssAnimationUnprefixedEnabled()) - break; case CSSPropertyWebkitAnimation: - return parseAnimationShorthand(propId, important); + return parseAnimationShorthand(important); case CSSPropertyTransition: case CSSPropertyWebkitTransition: return parseTransitionShorthand(propId, important); @@ -3086,18 +3073,18 @@ void CSSParser::addAnimationValue(RefPtr<CSSValue>& lval, PassRefPtr<CSSValue> r lval = rval; } -bool CSSParser::parseAnimationShorthand(CSSPropertyID propId, bool important) +bool CSSParser::parseAnimationShorthand(bool important) { - const StylePropertyShorthand& animationProperties = parsingShorthandForProperty(propId); + const StylePropertyShorthand& animationProperties = webkitAnimationShorthandForParsing(); const unsigned numProperties = 7; // The list of properties in the shorthand should be the same // length as the list with animation name in last position, even though they are // in a different order. - ASSERT(numProperties == animationProperties.length()); - ASSERT(numProperties == shorthandForProperty(propId).length()); + ASSERT(numProperties == webkitAnimationShorthandForParsing().length()); + ASSERT(numProperties == webkitAnimationShorthand().length()); - ShorthandScope scope(this, propId); + ShorthandScope scope(this, CSSPropertyWebkitAnimation); bool parsedProperty[numProperties] = { false }; AnimationParseContext context; @@ -4463,7 +4450,6 @@ bool CSSParser::parseAnimationProperty(CSSPropertyID propId, RefPtr<CSSValue>& r } else { switch (propId) { - case CSSPropertyAnimationDelay: case CSSPropertyWebkitAnimationDelay: case CSSPropertyTransitionDelay: case CSSPropertyWebkitTransitionDelay: @@ -4471,13 +4457,11 @@ bool CSSParser::parseAnimationProperty(CSSPropertyID propId, RefPtr<CSSValue>& r if (currValue) m_valueList->next(); break; - case CSSPropertyAnimationDirection: case CSSPropertyWebkitAnimationDirection: currValue = parseAnimationDirection(); if (currValue) m_valueList->next(); break; - case CSSPropertyAnimationDuration: case CSSPropertyWebkitAnimationDuration: case CSSPropertyTransitionDuration: case CSSPropertyWebkitTransitionDuration: @@ -4485,25 +4469,21 @@ bool CSSParser::parseAnimationProperty(CSSPropertyID propId, RefPtr<CSSValue>& r if (currValue) m_valueList->next(); break; - case CSSPropertyAnimationFillMode: case CSSPropertyWebkitAnimationFillMode: currValue = parseAnimationFillMode(); if (currValue) m_valueList->next(); break; - case CSSPropertyAnimationIterationCount: case CSSPropertyWebkitAnimationIterationCount: currValue = parseAnimationIterationCount(); if (currValue) m_valueList->next(); break; - case CSSPropertyAnimationName: case CSSPropertyWebkitAnimationName: currValue = parseAnimationName(); if (currValue) m_valueList->next(); break; - case CSSPropertyAnimationPlayState: case CSSPropertyWebkitAnimationPlayState: currValue = parseAnimationPlayState(); if (currValue) @@ -4517,7 +4497,6 @@ bool CSSParser::parseAnimationProperty(CSSPropertyID propId, RefPtr<CSSValue>& r if (currValue) m_valueList->next(); break; - case CSSPropertyAnimationTimingFunction: case CSSPropertyWebkitAnimationTimingFunction: case CSSPropertyTransitionTimingFunction: case CSSPropertyWebkitTransitionTimingFunction: @@ -10226,7 +10205,7 @@ inline void CSSParser::detectAtToken(int length, bool hasEscape) --length; // charset, font-face, import, media, namespace, page, supports, - // -webkit-keyframes, keyframes, and -webkit-mediaquery are not affected by hasEscape. + // -webkit-keyframes, and -webkit-mediaquery are not affected by hasEscape. SWITCH(name, length) { CASE("bottom-left") { if (LIKELY(!hasEscape)) @@ -10262,9 +10241,6 @@ inline void CSSParser::detectAtToken(int length, bool hasEscape) m_parsingMode = MediaQueryMode; m_token = IMPORT_SYM; } - CASE("keyframes") { - m_token = WEBKIT_KEYFRAMES_SYM; - } CASE("left-top") { if (LIKELY(!hasEscape)) m_token = LEFTTOP_SYM; @@ -11508,7 +11484,7 @@ StyleKeyframe* CSSParser::createKeyframe(CSSParserValueList* keys) StringBuilder keyString; for (unsigned i = 0; i < keys->size(); ++i) { ASSERT(keys->valueAt(i)->unit == CSSPrimitiveValue::CSS_NUMBER); - double key = keys->valueAt(i)->fValue; + float key = static_cast<float>(keys->valueAt(i)->fValue); if (key < 0 || key > 100) { // As per http://www.w3.org/TR/css3-animations/#keyframes, // "If a keyframe selector specifies negative percentage values diff --git a/chromium/third_party/WebKit/Source/core/css/CSSParser.h b/chromium/third_party/WebKit/Source/core/css/CSSParser.h index ce4532832fc..1f0ff6a0644 100644 --- a/chromium/third_party/WebKit/Source/core/css/CSSParser.h +++ b/chromium/third_party/WebKit/Source/core/css/CSSParser.h @@ -167,7 +167,7 @@ public: bool parseCubicBezierTimingFunctionValue(CSSParserValueList*& args, double& result); bool parseAnimationProperty(CSSPropertyID, RefPtr<CSSValue>&, AnimationParseContext&); bool parseTransitionShorthand(CSSPropertyID, bool important); - bool parseAnimationShorthand(CSSPropertyID, bool important); + bool parseAnimationShorthand(bool important); PassRefPtr<CSSValue> parseColumnWidth(); PassRefPtr<CSSValue> parseColumnCount(); diff --git a/chromium/third_party/WebKit/Source/core/css/CSSProperty.cpp b/chromium/third_party/WebKit/Source/core/css/CSSProperty.cpp index 57912167f4e..9fee7be3cd0 100644 --- a/chromium/third_party/WebKit/Source/core/css/CSSProperty.cpp +++ b/chromium/third_party/WebKit/Source/core/css/CSSProperty.cpp @@ -361,15 +361,6 @@ bool CSSProperty::isInheritedProperty(CSSPropertyID propertyID) case CSSPropertyWordWrap: case CSSPropertyWritingMode: return true; - case CSSPropertyAnimation: - case CSSPropertyAnimationDelay: - case CSSPropertyAnimationDirection: - case CSSPropertyAnimationDuration: - case CSSPropertyAnimationFillMode: - case CSSPropertyAnimationIterationCount: - case CSSPropertyAnimationName: - case CSSPropertyAnimationPlayState: - case CSSPropertyAnimationTimingFunction: case CSSPropertyAlignmentBaseline: case CSSPropertyBackground: case CSSPropertyBackgroundAttachment: diff --git a/chromium/third_party/WebKit/Source/core/css/CSSProperty.h b/chromium/third_party/WebKit/Source/core/css/CSSProperty.h index fd802ecbe40..a400af1b582 100644 --- a/chromium/third_party/WebKit/Source/core/css/CSSProperty.h +++ b/chromium/third_party/WebKit/Source/core/css/CSSProperty.h @@ -22,7 +22,6 @@ #define CSSProperty_h #include "CSSPropertyNames.h" -#include "RuntimeEnabledFeatures.h" #include "core/css/CSSValue.h" #include "core/platform/text/TextDirection.h" #include "core/platform/text/WritingMode.h" @@ -90,38 +89,8 @@ private: inline CSSPropertyID prefixingVariantForPropertyId(CSSPropertyID propId) { - if (!RuntimeEnabledFeatures::cssAnimationUnprefixedEnabled() && (propId >= CSSPropertyWebkitAnimation && propId <= CSSPropertyAnimationTimingFunction)) - return propId; - CSSPropertyID propertyId = CSSPropertyInvalid; switch (propId) { - case CSSPropertyAnimation: - propertyId = CSSPropertyWebkitAnimation; - break; - case CSSPropertyAnimationDelay: - propertyId = CSSPropertyWebkitAnimationDelay; - break; - case CSSPropertyAnimationDirection: - propertyId = CSSPropertyWebkitAnimationDirection; - break; - case CSSPropertyAnimationDuration: - propertyId = CSSPropertyWebkitAnimationDuration; - break; - case CSSPropertyAnimationFillMode: - propertyId = CSSPropertyWebkitAnimationFillMode; - break; - case CSSPropertyAnimationIterationCount: - propertyId = CSSPropertyWebkitAnimationIterationCount; - break; - case CSSPropertyAnimationName: - propertyId = CSSPropertyWebkitAnimationName; - break; - case CSSPropertyAnimationPlayState: - propertyId = CSSPropertyWebkitAnimationPlayState; - break; - case CSSPropertyAnimationTimingFunction: - propertyId = CSSPropertyWebkitAnimationTimingFunction; - break; case CSSPropertyTransitionDelay: propertyId = CSSPropertyWebkitTransitionDelay; break; @@ -137,33 +106,6 @@ inline CSSPropertyID prefixingVariantForPropertyId(CSSPropertyID propId) case CSSPropertyTransition: propertyId = CSSPropertyWebkitTransition; break; - case CSSPropertyWebkitAnimation: - propertyId = CSSPropertyAnimation; - break; - case CSSPropertyWebkitAnimationDelay: - propertyId = CSSPropertyAnimationDelay; - break; - case CSSPropertyWebkitAnimationDirection: - propertyId = CSSPropertyAnimationDirection; - break; - case CSSPropertyWebkitAnimationDuration: - propertyId = CSSPropertyAnimationDuration; - break; - case CSSPropertyWebkitAnimationFillMode: - propertyId = CSSPropertyAnimationFillMode; - break; - case CSSPropertyWebkitAnimationIterationCount: - propertyId = CSSPropertyAnimationIterationCount; - break; - case CSSPropertyWebkitAnimationName: - propertyId = CSSPropertyAnimationName; - break; - case CSSPropertyWebkitAnimationPlayState: - propertyId = CSSPropertyAnimationPlayState; - break; - case CSSPropertyWebkitAnimationTimingFunction: - propertyId = CSSPropertyAnimationTimingFunction; - break; case CSSPropertyWebkitTransitionDelay: propertyId = CSSPropertyTransitionDelay; break; diff --git a/chromium/third_party/WebKit/Source/core/css/CSSPropertyNames.in b/chromium/third_party/WebKit/Source/core/css/CSSPropertyNames.in index 1a982238083..11f385b451a 100644 --- a/chromium/third_party/WebKit/Source/core/css/CSSPropertyNames.in +++ b/chromium/third_party/WebKit/Source/core/css/CSSPropertyNames.in @@ -19,15 +19,6 @@ display -webkit-animation-name -webkit-animation-play-state -webkit-animation-timing-function -animation -animation-delay -animation-direction -animation-duration -animation-fill-mode -animation-iteration-count -animation-name -animation-play-state -animation-timing-function -webkit-transition -webkit-transition-delay -webkit-transition-duration diff --git a/chromium/third_party/WebKit/Source/core/css/CSSSVGDocumentValue.cpp b/chromium/third_party/WebKit/Source/core/css/CSSSVGDocumentValue.cpp index 85886e2374e..38a9874f755 100644 --- a/chromium/third_party/WebKit/Source/core/css/CSSSVGDocumentValue.cpp +++ b/chromium/third_party/WebKit/Source/core/css/CSSSVGDocumentValue.cpp @@ -29,9 +29,9 @@ #include "FetchInitiatorTypeNames.h" #include "core/css/CSSParser.h" #include "core/dom/Document.h" -#include "core/fetch/DocumentResource.h" -#include "core/fetch/FetchRequest.h" -#include "core/fetch/ResourceFetcher.h" +#include "core/loader/cache/DocumentResource.h" +#include "core/loader/cache/FetchRequest.h" +#include "core/loader/cache/ResourceFetcher.h" namespace WebCore { diff --git a/chromium/third_party/WebKit/Source/core/css/CSSSVGDocumentValue.h b/chromium/third_party/WebKit/Source/core/css/CSSSVGDocumentValue.h index 7e43406ffb5..5f132211c9c 100644 --- a/chromium/third_party/WebKit/Source/core/css/CSSSVGDocumentValue.h +++ b/chromium/third_party/WebKit/Source/core/css/CSSSVGDocumentValue.h @@ -26,8 +26,8 @@ #define CSSSVGDocumentValue_h #include "core/css/CSSValue.h" -#include "core/fetch/DocumentResource.h" -#include "core/fetch/ResourcePtr.h" +#include "core/loader/cache/DocumentResource.h" +#include "core/loader/cache/ResourcePtr.h" namespace WebCore { diff --git a/chromium/third_party/WebKit/Source/core/css/CSSShaderValue.cpp b/chromium/third_party/WebKit/Source/core/css/CSSShaderValue.cpp index bc8ce082d3e..a21af14661f 100644 --- a/chromium/third_party/WebKit/Source/core/css/CSSShaderValue.cpp +++ b/chromium/third_party/WebKit/Source/core/css/CSSShaderValue.cpp @@ -34,8 +34,8 @@ #include "FetchInitiatorTypeNames.h" #include "core/css/CSSParser.h" #include "core/dom/Document.h" -#include "core/fetch/FetchRequest.h" -#include "core/fetch/ResourceFetcher.h" +#include "core/loader/cache/FetchRequest.h" +#include "core/loader/cache/ResourceFetcher.h" #include "core/rendering/style/StyleFetchedShader.h" #include "core/rendering/style/StylePendingShader.h" #include "wtf/text/StringBuilder.h" diff --git a/chromium/third_party/WebKit/Source/core/css/CSSShorthands.in b/chromium/third_party/WebKit/Source/core/css/CSSShorthands.in index 9738a793d4d..04f9a632375 100644 --- a/chromium/third_party/WebKit/Source/core/css/CSSShorthands.in +++ b/chromium/third_party/WebKit/Source/core/css/CSSShorthands.in @@ -3,7 +3,6 @@ // followed by the longhands associated to the shorthand. // Note: Mandatory blank line to skip parameter parsing phase -animation longhands=animation-name;animation-duration;animation-timing-function;animation-delay;animation-iteration-count;animation-direction;animation-fill-mode, runtimeEnabledShorthand=CSSAnimationUnprefixed background longhands=background-image;background-position-x;background-position-y;background-size;background-repeat-x;background-repeat-y;background-attachment;background-origin;background-clip;background-color background-position longhands=background-position-x;background-position-y background-repeat longhands=background-repeat-x;background-repeat-y diff --git a/chromium/third_party/WebKit/Source/core/css/MediaQueryEvaluator.cpp b/chromium/third_party/WebKit/Source/core/css/MediaQueryEvaluator.cpp index 42e71e531f9..413c80ea910 100644 --- a/chromium/third_party/WebKit/Source/core/css/MediaQueryEvaluator.cpp +++ b/chromium/third_party/WebKit/Source/core/css/MediaQueryEvaluator.cpp @@ -272,8 +272,8 @@ static bool deviceAspectRatioMediaFeatureEval(CSSValue* value, RenderStyle*, Fra static bool evalResolution(CSSValue* value, Frame* frame, MediaFeaturePrefix op) { - // FIXME: Possibly handle other media types than 'screen' and 'print'. - float actualResolution = 0; + // FIXME: Possible handle other media types than 'screen' and 'print'. + float deviceScaleFactor = 0; // This checks the actual media type applied to the document, and we know // this method only got called if this media type matches the one defined @@ -281,16 +281,16 @@ static bool evalResolution(CSSValue* value, Frame* frame, MediaFeaturePrefix op) // media type of the query will either be "print" or "all". String mediaType = frame->view()->mediaType(); if (equalIgnoringCase(mediaType, "screen")) - actualResolution = clampTo<float>(frame->devicePixelRatio()); + deviceScaleFactor = frame->page()->deviceScaleFactor(); else if (equalIgnoringCase(mediaType, "print")) { // The resolution of images while printing should not depend on the DPI // of the screen. Until we support proper ways of querying this info // we use 300px which is considered minimum for current printers. - actualResolution = 300 / cssPixelsPerInch; + deviceScaleFactor = 300 / cssPixelsPerInch; } if (!value) - return !!actualResolution; + return !!deviceScaleFactor; if (!value->isPrimitiveValue()) return false; @@ -298,7 +298,7 @@ static bool evalResolution(CSSValue* value, Frame* frame, MediaFeaturePrefix op) CSSPrimitiveValue* resolution = toCSSPrimitiveValue(value); if (resolution->isNumber()) - return compareValue(actualResolution, resolution->getFloatValue(), op); + return compareValue(deviceScaleFactor, resolution->getFloatValue(), op); if (!resolution->isResolution()) return false; @@ -310,11 +310,11 @@ static bool evalResolution(CSSValue* value, Frame* frame, MediaFeaturePrefix op) // approximates the reference pixel". With that in mind, allowing 2 decimal // point precision seems appropriate. return compareValue( - floorf(0.5 + 100 * actualResolution) / 100, + floorf(0.5 + 100 * deviceScaleFactor) / 100, floorf(0.5 + 100 * resolution->getFloatValue(CSSPrimitiveValue::CSS_DPPX)) / 100, op); } - return compareValue(actualResolution, resolution->getFloatValue(CSSPrimitiveValue::CSS_DPPX), op); + return compareValue(deviceScaleFactor, resolution->getFloatValue(CSSPrimitiveValue::CSS_DPPX), op); } static bool devicePixelRatioMediaFeatureEval(CSSValue *value, RenderStyle*, Frame* frame, MediaFeaturePrefix op) diff --git a/chromium/third_party/WebKit/Source/core/css/StyleInvalidationAnalysis.cpp b/chromium/third_party/WebKit/Source/core/css/StyleInvalidationAnalysis.cpp index 9dea9bac2be..25773727488 100644 --- a/chromium/third_party/WebKit/Source/core/css/StyleInvalidationAnalysis.cpp +++ b/chromium/third_party/WebKit/Source/core/css/StyleInvalidationAnalysis.cpp @@ -88,34 +88,18 @@ static bool hasDistributedRule(StyleSheetContents* styleSheetContents) return false; } -static bool hasAtHostRule(StyleSheetContents* styleSheetContents) -{ - const Vector<RefPtr<StyleRuleBase> >& rules = styleSheetContents->childRules(); - for (unsigned i = 0; i < rules.size(); i++) { - const StyleRuleBase* rule = rules[i].get(); - if (rule->isHostRule()) - return true; - } - return false; -} - static Node* determineScopingNodeForStyleScoped(HTMLStyleElement* ownerElement, StyleSheetContents* styleSheetContents) { ASSERT(ownerElement && ownerElement->isRegisteredAsScoped()); - if (ownerElement->isInShadowTree()) { - if (hasDistributedRule(styleSheetContents)) { - ContainerNode* scope = ownerElement; - do { - scope = scope->containingShadowRoot()->shadowHost(); - } while (scope->isInShadowTree()); + if (ownerElement->isInShadowTree() && hasDistributedRule(styleSheetContents)) { + ContainerNode* scope = ownerElement; + do { + scope = scope->containingShadowRoot()->shadowHost(); + } while (scope->isInShadowTree()); - return scope; - } - if (ownerElement->isRegisteredAsScoped() && hasAtHostRule(styleSheetContents)) - return ownerElement->containingShadowRoot()->shadowHost(); + return scope; } - return ownerElement->isRegisteredInShadowRoot() ? ownerElement->containingShadowRoot()->shadowHost() : ownerElement->parentNode(); } diff --git a/chromium/third_party/WebKit/Source/core/css/StylePropertyShorthandCustom.cpp b/chromium/third_party/WebKit/Source/core/css/StylePropertyShorthandCustom.cpp index 1e6e628c340..e49efe5739f 100644 --- a/chromium/third_party/WebKit/Source/core/css/StylePropertyShorthandCustom.cpp +++ b/chromium/third_party/WebKit/Source/core/css/StylePropertyShorthandCustom.cpp @@ -36,30 +36,6 @@ const StylePropertyShorthand& borderShorthandForParsing() return borderForParsingLonghands; } -const StylePropertyShorthand& animationShorthandForParsing() -{ - // When we parse the animation shorthand we need to look for animation-name - // last because otherwise it might match against the keywords for fill mode, - // timing functions and infinite iteration. This means that animation names - // that are the same as keywords (e.g. 'forwards') won't always match in the - // shorthand. In that case the authors should be using longhands (or - // reconsidering their approach). This is covered by the animations spec - // bug: https://www.w3.org/Bugs/Public/show_bug.cgi?id=14790 - // And in the spec (editor's draft) at: - // http://dev.w3.org/csswg/css3-animations/#animation-shorthand-property - static const CSSPropertyID animationPropertiesForParsing[] = { - CSSPropertyAnimationDuration, - CSSPropertyAnimationTimingFunction, - CSSPropertyAnimationDelay, - CSSPropertyAnimationIterationCount, - CSSPropertyAnimationDirection, - CSSPropertyAnimationFillMode, - CSSPropertyAnimationName - }; - DEFINE_STATIC_LOCAL(StylePropertyShorthand, webkitAnimationLonghandsForParsing, (CSSPropertyAnimation, animationPropertiesForParsing, WTF_ARRAY_LENGTH(animationPropertiesForParsing))); - return webkitAnimationLonghandsForParsing; -} - const StylePropertyShorthand& webkitAnimationShorthandForParsing() { // When we parse the animation shorthand we need to look for animation-name @@ -84,21 +60,6 @@ const StylePropertyShorthand& webkitAnimationShorthandForParsing() return webkitAnimationLonghandsForParsing; } -// Returns an empty list if the property is not a shorthand, otherwise the list of longhands for parsing. -const StylePropertyShorthand& parsingShorthandForProperty(CSSPropertyID propertyID) -{ - switch (propertyID) { - case CSSPropertyAnimation: - return animationShorthandForParsing(); - case CSSPropertyBorder: - return borderShorthandForParsing(); - case CSSPropertyWebkitAnimation: - return webkitAnimationShorthandForParsing(); - default: - return shorthandForProperty(propertyID); - } -} - bool isExpandedShorthand(CSSPropertyID id) { // The system fonts bypass the normal style resolution by using RenderTheme, diff --git a/chromium/third_party/WebKit/Source/core/css/StyleRuleImport.cpp b/chromium/third_party/WebKit/Source/core/css/StyleRuleImport.cpp index 15d3d5ba498..cf728136525 100644 --- a/chromium/third_party/WebKit/Source/core/css/StyleRuleImport.cpp +++ b/chromium/third_party/WebKit/Source/core/css/StyleRuleImport.cpp @@ -25,9 +25,9 @@ #include "FetchInitiatorTypeNames.h" #include "core/css/StyleSheetContents.h" #include "core/dom/Document.h" -#include "core/fetch/CSSStyleSheetResource.h" -#include "core/fetch/FetchRequest.h" -#include "core/fetch/ResourceFetcher.h" +#include "core/loader/cache/CSSStyleSheetResource.h" +#include "core/loader/cache/FetchRequest.h" +#include "core/loader/cache/ResourceFetcher.h" namespace WebCore { diff --git a/chromium/third_party/WebKit/Source/core/css/StyleRuleImport.h b/chromium/third_party/WebKit/Source/core/css/StyleRuleImport.h index c44253f53c9..40412e398c3 100644 --- a/chromium/third_party/WebKit/Source/core/css/StyleRuleImport.h +++ b/chromium/third_party/WebKit/Source/core/css/StyleRuleImport.h @@ -23,8 +23,8 @@ #define StyleRuleImport_h #include "core/css/StyleRule.h" -#include "core/fetch/ResourcePtr.h" -#include "core/fetch/StyleSheetResourceClient.h" +#include "core/loader/cache/ResourcePtr.h" +#include "core/loader/cache/StyleSheetResourceClient.h" namespace WebCore { diff --git a/chromium/third_party/WebKit/Source/core/css/StyleSheetContents.cpp b/chromium/third_party/WebKit/Source/core/css/StyleSheetContents.cpp index b99216d84a2..163276bf41a 100644 --- a/chromium/third_party/WebKit/Source/core/css/StyleSheetContents.cpp +++ b/chromium/third_party/WebKit/Source/core/css/StyleSheetContents.cpp @@ -28,7 +28,7 @@ #include "core/css/StyleRule.h" #include "core/css/StyleRuleImport.h" #include "core/dom/Node.h" -#include "core/fetch/CSSStyleSheetResource.h" +#include "core/loader/cache/CSSStyleSheetResource.h" #include "weborigin/SecurityOrigin.h" #include "wtf/Deque.h" diff --git a/chromium/third_party/WebKit/Source/core/css/resolver/AnimatedStyleBuilder.cpp b/chromium/third_party/WebKit/Source/core/css/resolver/AnimatedStyleBuilder.cpp index 208325e19e1..8fc95356f4a 100644 --- a/chromium/third_party/WebKit/Source/core/css/resolver/AnimatedStyleBuilder.cpp +++ b/chromium/third_party/WebKit/Source/core/css/resolver/AnimatedStyleBuilder.cpp @@ -32,7 +32,6 @@ #include "core/css/resolver/AnimatedStyleBuilder.h" #include "core/animation/AnimatableNumber.h" -#include "core/animation/AnimatableTransform.h" #include "core/animation/AnimatableUnknown.h" #include "core/animation/AnimatableValue.h" #include "core/css/resolver/StyleBuilder.h" @@ -123,9 +122,6 @@ void AnimatedStyleBuilder::applyProperty(CSSPropertyID property, StyleResolverSt case CSSPropertyWebkitPerspectiveOriginY: style->setPerspectiveOriginY(animatableValueToLength(value, state)); return; - case CSSPropertyWebkitTransform: - style->setTransform(toAnimatableTransform(value)->transformOperations()); - return; case CSSPropertyWebkitTransformOriginX: style->setTransformOriginX(animatableValueToLength(value, state)); return; diff --git a/chromium/third_party/WebKit/Source/core/css/resolver/SharedStyleFinder.cpp b/chromium/third_party/WebKit/Source/core/css/resolver/SharedStyleFinder.cpp index d3899ad1042..ee83ce26fad 100644 --- a/chromium/third_party/WebKit/Source/core/css/resolver/SharedStyleFinder.cpp +++ b/chromium/third_party/WebKit/Source/core/css/resolver/SharedStyleFinder.cpp @@ -56,11 +56,64 @@ namespace WebCore { using namespace HTMLNames; +static const unsigned cStyleSearchThreshold = 10; +static const unsigned cStyleSearchLevelThreshold = 10; + static inline bool parentElementPreventsSharing(const Element* parentElement) { + if (!parentElement) + return false; return parentElement->hasFlagsSetDuringStylingOfChildren(); } +Node* SharedStyleFinder::locateCousinList(Element* parent, unsigned& visitedNodeCount) const +{ + if (visitedNodeCount >= cStyleSearchThreshold * cStyleSearchLevelThreshold) + return 0; + if (!parent || !parent->isStyledElement()) + return 0; + if (parent->hasScopedHTMLStyleChild()) + return 0; + if (parent->inlineStyle()) + return 0; + if (parent->isSVGElement() && toSVGElement(parent)->animatedSMILStyleProperties()) + return 0; + if (parent->hasID() && m_features.idsInRules.contains(parent->idForStyleResolution().impl())) + return 0; + if (isShadowHost(parent) && parent->shadow()->containsActiveStyles()) + return 0; + + RenderStyle* parentStyle = parent->renderStyle(); + unsigned subcount = 0; + Node* thisCousin = parent; + Node* currentNode = parent->previousSibling(); + + // Reserve the tries for this level. This effectively makes sure that the algorithm + // will never go deeper than cStyleSearchLevelThreshold levels into recursion. + visitedNodeCount += cStyleSearchThreshold; + while (thisCousin) { + while (currentNode) { + ++subcount; + if (!currentNode->hasScopedHTMLStyleChild() && currentNode->renderStyle() == parentStyle && currentNode->lastChild() + && currentNode->isElementNode() && !parentElementPreventsSharing(toElement(currentNode)) + && !toElement(currentNode)->shadow() + ) { + // Adjust for unused reserved tries. + visitedNodeCount -= cStyleSearchThreshold - subcount; + return currentNode->lastChild(); + } + if (subcount >= cStyleSearchThreshold) + return 0; + currentNode = currentNode->previousSibling(); + } + currentNode = locateCousinList(thisCousin->parentElement(), visitedNodeCount); + thisCousin = currentNode; + } + + return 0; +} + + bool SharedStyleFinder::canShareStyleWithControl(const ElementResolveContext& context, Element* element) const { if (!element->hasTagName(inputTag) || !context.element()->hasTagName(inputTag)) @@ -161,16 +214,9 @@ bool SharedStyleFinder::sharingCandidateHasIdenticalStyleAffectingAttributes(con bool SharedStyleFinder::canShareStyleWithElement(const ElementResolveContext& context, Element* element) const { - if (context.element() == element) - return false; - Element* parent = element->parentElement(); RenderStyle* style = element->renderStyle(); if (!style) return false; - if (!parent) - return false; - if (context.element()->parentElement()->renderStyle() != parent->renderStyle()) - return false; if (style->unique()) return false; if (style->hasUniquePseudoStyle()) @@ -250,24 +296,22 @@ bool SharedStyleFinder::canShareStyleWithElement(const ElementResolveContext& co return false; } - if (context.element()->parentElement() != parent) { - if (!parent->isStyledElement()) - return false; - if (parent->hasScopedHTMLStyleChild()) - return false; - if (parent->inlineStyle()) - return false; - if (parent->isSVGElement() && toSVGElement(parent)->animatedSMILStyleProperties()) - return false; - if (parent->hasID() && m_features.idsInRules.contains(parent->idForStyleResolution().impl())) - return false; - if (parentElementPreventsSharing(parent)) - return false; - } - return true; } +inline Element* SharedStyleFinder::findSiblingForStyleSharing(const ElementResolveContext& context, Node* node, unsigned& count) const +{ + for (; node; node = node->previousSibling()) { + if (!node->isStyledElement()) + continue; + if (canShareStyleWithElement(context, toElement(node))) + break; + if (count++ == cStyleSearchThreshold) + return 0; + } + return toElement(node); +} + #ifdef STYLE_STATS Element* SharedStyleFinder::searchDocumentForSharedStyle(const ElementResolveContext& context) const { @@ -279,28 +323,10 @@ Element* SharedStyleFinder::searchDocumentForSharedStyle(const ElementResolveCon } #endif -inline Element* SharedStyleFinder::findElementForStyleSharing(const ElementResolveContext& context) const -{ - StyleSharingList& styleSharingList = m_styleResolver->styleSharingList(); - for (StyleSharingList::iterator iter = styleSharingList.begin(); iter != styleSharingList.end(); ++iter) { - if (canShareStyleWithElement(context, *iter)) { - Element* element = *iter; - if (iter != styleSharingList.begin()) { - // Move the element to the front of the LRU - styleSharingList.remove(iter); - styleSharingList.prepend(element); - } - return element; - } - } - m_styleResolver->addToStyleSharingList(context.element()); - return 0; -} - RenderStyle* SharedStyleFinder::locateSharedStyle(const ElementResolveContext& context, RenderStyle* newStyle) { STYLE_STATS_ADD_SEARCH(); - if (!context.element() || !context.element()->isStyledElement() || !context.element()->parentElement()) + if (!context.element() || !context.element()->isStyledElement()) return 0; // If the element has inline style it is probably unique. @@ -344,7 +370,17 @@ RenderStyle* SharedStyleFinder::locateSharedStyle(const ElementResolveContext& c // FIXME: This should be an explicit out parameter, instead of a member variable. m_elementAffectedByClassRules = context.element() && context.element()->hasClass() && classNamesAffectedByRules(context.element()->classNames()); - Element* shareElement = findElementForStyleSharing(context); + // Check previous siblings and their cousins. + unsigned count = 0; + unsigned visitedNodeCount = 0; + Element* shareElement = 0; + Node* cousinList = context.element()->previousSibling(); + while (cousinList) { + shareElement = findSiblingForStyleSharing(context, cousinList, count); + if (shareElement) + break; + cousinList = locateCousinList(cousinList->parentElement(), visitedNodeCount); + } #ifdef STYLE_STATS // FIXME: these stats don't to into account whether or not sibling/attribute diff --git a/chromium/third_party/WebKit/Source/core/css/resolver/SharedStyleFinder.h b/chromium/third_party/WebKit/Source/core/css/resolver/SharedStyleFinder.h index d407279a588..7734c3665d7 100644 --- a/chromium/third_party/WebKit/Source/core/css/resolver/SharedStyleFinder.h +++ b/chromium/third_party/WebKit/Source/core/css/resolver/SharedStyleFinder.h @@ -51,7 +51,8 @@ public: RenderStyle* locateSharedStyle(const ElementResolveContext&, RenderStyle* newStyle); private: - Element* findElementForStyleSharing(const ElementResolveContext&) const; + Node* locateCousinList(Element* parent, unsigned& visitedNodeCount) const; + Element* findSiblingForStyleSharing(const ElementResolveContext&, Node*, unsigned& count) const; // Only used when we're collecting stats on styles Element* searchDocumentForSharedStyle(const ElementResolveContext&) const; diff --git a/chromium/third_party/WebKit/Source/core/css/resolver/StyleBuilderCustom.cpp b/chromium/third_party/WebKit/Source/core/css/resolver/StyleBuilderCustom.cpp index 5f494e42d41..f49afb1a607 100644 --- a/chromium/third_party/WebKit/Source/core/css/resolver/StyleBuilderCustom.cpp +++ b/chromium/third_party/WebKit/Source/core/css/resolver/StyleBuilderCustom.cpp @@ -1395,7 +1395,6 @@ void StyleBuilder::oldApplyProperty(CSSPropertyID id, StyleResolverState& state, state.setLineHeightValue(0); state.fontBuilder().fromSystemFont(primitiveValue->getValueID(), state.style()->effectiveZoom()); return; - case CSSPropertyAnimation: case CSSPropertyBackground: case CSSPropertyBackgroundPosition: case CSSPropertyBackgroundRepeat: @@ -1823,14 +1822,6 @@ void StyleBuilder::oldApplyProperty(CSSPropertyID id, StyleResolverState& state, } // These properties are aliased and we already applied the property on the prefixed version. - case CSSPropertyAnimationDelay: - case CSSPropertyAnimationDirection: - case CSSPropertyAnimationDuration: - case CSSPropertyAnimationFillMode: - case CSSPropertyAnimationIterationCount: - case CSSPropertyAnimationName: - case CSSPropertyAnimationPlayState: - case CSSPropertyAnimationTimingFunction: case CSSPropertyTransitionDelay: case CSSPropertyTransitionDuration: case CSSPropertyTransitionProperty: diff --git a/chromium/third_party/WebKit/Source/core/css/resolver/StyleResolver.cpp b/chromium/third_party/WebKit/Source/core/css/resolver/StyleResolver.cpp index 8070d0f3f27..4ce361fa0a3 100644 --- a/chromium/third_party/WebKit/Source/core/css/resolver/StyleResolver.cpp +++ b/chromium/third_party/WebKit/Source/core/css/resolver/StyleResolver.cpp @@ -149,8 +149,8 @@ StyleResolver::StyleResolver(Document* document, bool matchAuthorAndUserStyles) fontSelector()->addFontFaceRule((*it)->fontFaceRule()); } #endif - - styleSheetCollection->appendActiveAuthorStyleSheets(this); + m_styleTree.setBuildInDocumentOrder(!styleSheetCollection->hasScopedStyleSheet()); + appendAuthorStyleSheets(0, styleSheetCollection->activeAuthorStyleSheets()); } void StyleResolver::appendAuthorStyleSheets(unsigned firstNew, const Vector<RefPtr<CSSStyleSheet> >& styleSheets) @@ -170,10 +170,7 @@ void StyleResolver::appendAuthorStyleSheets(unsigned firstNew, const Vector<RefP resolver->addRulesFromSheet(sheet, *m_medium, this); m_inspectorCSSOMWrappers.collectFromStyleSheetIfNeeded(cssSheet); } -} -void StyleResolver::finishAppendAuthorStyleSheets() -{ collectFeatures(); if (document()->renderer() && document()->renderer()->style()) @@ -185,6 +182,7 @@ void StyleResolver::finishAppendAuthorStyleSheets() void StyleResolver::resetAuthorStyle(const ContainerNode* scopingNode) { + m_styleTree.clear(); ScopedStyleResolver* resolver = scopingNode ? m_styleTree.scopedStyleResolverFor(scopingNode) : m_styleTree.scopedStyleResolverForDocument(); if (!resolver) return; @@ -192,13 +190,8 @@ void StyleResolver::resetAuthorStyle(const ContainerNode* scopingNode) m_ruleSets.shadowDistributedRules().reset(scopingNode); resolver->resetAuthorStyle(); - if (!scopingNode) - return; - - if (scopingNode->isShadowRoot()) - resetAtHostRules(scopingNode); - if (!resolver->hasOnlyEmptyRuleSets()) + if (!scopingNode || !resolver->hasOnlyEmptyRuleSets()) return; m_styleTree.remove(scopingNode); @@ -243,18 +236,6 @@ void StyleResolver::collectFeatures() m_uncommonAttributeRuleSet = makeRuleSet(m_features.uncommonAttributeRules); } -void StyleResolver::addToStyleSharingList(Element* element) -{ - if (m_styleSharingList.size() >= styleSharingListSize) - m_styleSharingList.remove(--m_styleSharingList.end()); - m_styleSharingList.prepend(element); -} - -void StyleResolver::clearStyleSharingList() -{ - m_styleSharingList.clear(); -} - void StyleResolver::pushParentElement(Element* parent) { const ContainerNode* parentsParent = parent->parentOrShadowHostElement(); @@ -789,7 +770,7 @@ void StyleResolver::keyframeStylesForAnimation(Element* e, const RenderStyle* el keyframeValue.addProperties(keyframe->properties()); // Add this keyframe style to all the indicated key times - Vector<double> keys; + Vector<float> keys; keyframe->getKeys(keys); for (size_t keyIndex = 0; keyIndex < keys.size(); ++keyIndex) { keyframeValue.setKey(keys[keyIndex]); @@ -837,7 +818,7 @@ void StyleResolver::resolveKeyframes(Element* element, const RenderStyle* style, for (size_t i = 0; i < styleKeyframes.size(); ++i) { const StyleKeyframe* styleKeyframe = styleKeyframes[i].get(); RefPtr<RenderStyle> keyframeStyle = styleForKeyframe(element, style, styleKeyframe); - Vector<double> offsets; + Vector<float> offsets; styleKeyframe->getKeys(offsets); RefPtr<Keyframe> firstOffsetKeyframe; for (size_t j = 0; j < offsets.size(); ++j) { @@ -921,7 +902,7 @@ const StylePropertySet* StyleResolver::firstKeyframeStyles(const Element* elemen for (unsigned i = 0; i < styleKeyframes.size(); ++i) { const StyleKeyframe* styleKeyframe = styleKeyframes[i].get(); - Vector<double> offsets; + Vector<float> offsets; styleKeyframe->getKeys(offsets); for (size_t j = 0; j < offsets.size(); ++j) { if (!offsets[j]) { diff --git a/chromium/third_party/WebKit/Source/core/css/resolver/StyleResolver.h b/chromium/third_party/WebKit/Source/core/css/resolver/StyleResolver.h index 15db7d44f56..d9d14e9fc7e 100644 --- a/chromium/third_party/WebKit/Source/core/css/resolver/StyleResolver.h +++ b/chromium/third_party/WebKit/Source/core/css/resolver/StyleResolver.h @@ -36,7 +36,6 @@ #include "core/css/resolver/StyleBuilder.h" #include "core/css/resolver/StyleResolverState.h" #include "core/css/resolver/StyleResourceLoader.h" -#include "wtf/Deque.h" #include "wtf/HashMap.h" #include "wtf/HashSet.h" #include "wtf/RefPtr.h" @@ -86,9 +85,6 @@ enum RuleMatchingBehavior { MatchOnlyUserAgentRules, }; -const unsigned styleSharingListSize = 20; -typedef WTF::Deque<Element*, styleSharingListSize> StyleSharingList; - #undef STYLE_STATS #ifdef STYLE_STATS @@ -216,9 +212,10 @@ public: // FIXME: It could be better to call m_ruleSets.appendAuthorStyleSheets() directly after we factor StyleRsolver further. // https://bugs.webkit.org/show_bug.cgi?id=108890 void appendAuthorStyleSheets(unsigned firstNew, const Vector<RefPtr<CSSStyleSheet> >&); + // FIXME: resetAuthorStyle() will be removed when rulesets are reset in a per-scoping node manner. + void resetAuthorStyle(); void resetAuthorStyle(const ContainerNode*); void resetAtHostRules(const ContainerNode*); - void finishAppendAuthorStyleSheets(); DocumentRuleSets& ruleSets() { return m_ruleSets; } const DocumentRuleSets& ruleSets() const { return m_ruleSets; } @@ -279,11 +276,6 @@ public: const RuleFeatureSet& ruleFeatureSet() const { return m_features; } - StyleSharingList& styleSharingList() { return m_styleSharingList; } - - void addToStyleSharingList(Element*); - void clearStyleSharingList(); - #ifdef STYLE_STATS ALWAYS_INLINE static StyleSharingStats& styleSharingStats() { return m_styleSharingStats; } #endif @@ -367,8 +359,6 @@ private: StyleResourceLoader m_styleResourceLoader; - StyleSharingList m_styleSharingList; - #ifdef STYLE_STATS static StyleSharingStats m_styleSharingStats; #endif diff --git a/chromium/third_party/WebKit/Source/core/css/resolver/StyleResourceLoader.cpp b/chromium/third_party/WebKit/Source/core/css/resolver/StyleResourceLoader.cpp index 3158763d320..bec09851013 100644 --- a/chromium/third_party/WebKit/Source/core/css/resolver/StyleResourceLoader.cpp +++ b/chromium/third_party/WebKit/Source/core/css/resolver/StyleResourceLoader.cpp @@ -29,7 +29,7 @@ #include "core/css/CSSSVGDocumentValue.h" #include "core/css/CSSShaderValue.h" #include "core/css/resolver/ElementStyleResources.h" -#include "core/fetch/ResourceFetcher.h" +#include "core/loader/cache/ResourceFetcher.h" #include "core/platform/graphics/filters/custom/CustomFilterOperation.h" #include "core/rendering/style/ContentData.h" #include "core/rendering/style/CursorList.h" diff --git a/chromium/third_party/WebKit/Source/core/dom/Clipboard.cpp b/chromium/third_party/WebKit/Source/core/dom/Clipboard.cpp index ee98d9f9586..0c7f7252955 100644 --- a/chromium/third_party/WebKit/Source/core/dom/Clipboard.cpp +++ b/chromium/third_party/WebKit/Source/core/dom/Clipboard.cpp @@ -26,8 +26,8 @@ #include "config.h" #include "core/dom/Clipboard.h" -#include "core/fetch/ImageResource.h" #include "core/fileapi/FileList.h" +#include "core/loader/cache/ImageResource.h" namespace WebCore { diff --git a/chromium/third_party/WebKit/Source/core/dom/Clipboard.h b/chromium/third_party/WebKit/Source/core/dom/Clipboard.h index bc861ded2e0..a32134b905c 100644 --- a/chromium/third_party/WebKit/Source/core/dom/Clipboard.h +++ b/chromium/third_party/WebKit/Source/core/dom/Clipboard.h @@ -27,7 +27,7 @@ #include "bindings/v8/ScriptWrappable.h" #include "core/dom/ClipboardAccessPolicy.h" #include "core/dom/Node.h" -#include "core/fetch/ResourcePtr.h" +#include "core/loader/cache/ResourcePtr.h" #include "core/page/DragActions.h" #include "core/platform/DragImage.h" #include "core/platform/graphics/IntPoint.h" diff --git a/chromium/third_party/WebKit/Source/core/dom/ContainerNode.cpp b/chromium/third_party/WebKit/Source/core/dom/ContainerNode.cpp index 0fb80f01519..1b26b71ed40 100644 --- a/chromium/third_party/WebKit/Source/core/dom/ContainerNode.cpp +++ b/chromium/third_party/WebKit/Source/core/dom/ContainerNode.cpp @@ -25,7 +25,6 @@ #include "bindings/v8/ExceptionState.h" #include "bindings/v8/ExceptionStatePlaceholder.h" -#include "core/css/resolver/StyleResolver.h" #include "core/dom/ChildListMutationScope.h" #include "core/dom/ContainerNodeAlgorithms.h" #include "core/dom/EventNames.h" @@ -683,8 +682,6 @@ void ContainerNode::resumePostAttachCallbacks() if (s_postAttachCallbackQueue) dispatchPostAttachCallbacks(); - if (StyleResolver* resolver = document()->styleResolverIfExists()) - resolver->clearStyleSharingList(); } --s_attachDepth; } @@ -1039,8 +1036,6 @@ static void updateTreeAfterInsertion(ContainerNode* parent, Node* child, AttachB child->lazyAttach(); else child->attach(); - if (StyleResolver* resolver = parent->document()->document()->styleResolverIfExists()) - resolver->clearStyleSharingList(); } dispatchChildInsertionEvents(child); diff --git a/chromium/third_party/WebKit/Source/core/dom/CustomElement.cpp b/chromium/third_party/WebKit/Source/core/dom/CustomElement.cpp index 1e506c5dcd7..6ffcd2a9730 100644 --- a/chromium/third_party/WebKit/Source/core/dom/CustomElement.cpp +++ b/chromium/third_party/WebKit/Source/core/dom/CustomElement.cpp @@ -35,7 +35,7 @@ #include "MathMLNames.h" #include "SVGNames.h" #include "core/dom/CustomElementCallbackScheduler.h" -#include "core/dom/CustomElementObserver.h" +#include "core/dom/CustomElementUpgradeCandidateMap.h" #include "core/dom/Element.h" namespace WebCore { @@ -131,13 +131,12 @@ void CustomElement::wasDestroyed(Element* element) break; case Element::UpgradeCandidate: - CustomElementObserver::notifyElementWasDestroyed(element); + CustomElementUpgradeCandidateMap::elementWasDestroyed(element); break; case Element::Defined: case Element::Upgraded: definitions().remove(element); - CustomElementObserver::notifyElementWasDestroyed(element); break; } } diff --git a/chromium/third_party/WebKit/Source/core/dom/CustomElementException.cpp b/chromium/third_party/WebKit/Source/core/dom/CustomElementException.cpp deleted file mode 100644 index b5752a8c02d..00000000000 --- a/chromium/third_party/WebKit/Source/core/dom/CustomElementException.cpp +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright (C) 2013 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 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. - * 3. Neither the name of Google Inc. nor the names of its contributors - * may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "core/dom/CustomElementException.h" - -#include "bindings/v8/ExceptionState.h" -#include "core/dom/ExceptionCode.h" - -namespace WebCore { - -String CustomElementException::preamble(const AtomicString& type) -{ - return "Failed to call 'register' on 'Document' for type '" + type + "': "; -} - -void CustomElementException::throwException(Reason reason, const AtomicString& type, ExceptionState& es) -{ - switch (reason) { - case CannotRegisterFromExtension: - es.throwDOMException(NotSupportedError, preamble(type) + "elements cannot be registered from extensions."); - return; - - case ConstructorPropertyNotConfigurable: - es.throwDOMException(NotSupportedError, preamble(type) + "prototype constructor property is not configurable."); - return; - - case ContextDestroyedCheckingPrototype: - es.throwDOMException(InvalidStateError, preamble(type) + "the context is no longer valid."); - return; - - case ContextDestroyedCreatingCallbacks: - es.throwDOMException(InvalidStateError); - return; - - case ContextDestroyedRegisteringDefinition: - es.throwDOMException(NotSupportedError); - return; - - case InvalidName: - es.throwDOMException(InvalidCharacterError, preamble(type) + ": '" + type + "' is not a valid name."); - return; - - case NotYetImplemented: - es.throwDOMException(InvalidStateError); - return; - - case PrototypeDoesNotExtendHTMLElementSVGElementNamespace: - es.throwDOMException(NamespaceError, preamble(type) + "the prototype does not extend an HTML or SVG element."); - return; - - case PrototypeDoesNotExtendHTMLElementSVGElementPrototype: - es.throwDOMException(InvalidStateError, preamble(type) + "the prototype does not extend an HTML or SVG element."); - return; - - case PrototypeInUse: - es.throwDOMException(NotSupportedError, preamble(type) + "prototype is already in-use as an interface prototype object."); - return; - - case PrototypeNotAnObject: - es.throwDOMException(InvalidStateError, preamble(type) + "the prototype option is not an object."); - return; - - case TypeAlreadyRegistered: - es.throwDOMException(InvalidStateError, preamble(type) + "a type with that name is already registered."); - return; - } - - ASSERT_NOT_REACHED(); -} - -} // namespace WebCore diff --git a/chromium/third_party/WebKit/Source/core/dom/CustomElementException.h b/chromium/third_party/WebKit/Source/core/dom/CustomElementException.h deleted file mode 100644 index 622ef220699..00000000000 --- a/chromium/third_party/WebKit/Source/core/dom/CustomElementException.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (C) 2013 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 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. - * 3. Neither the name of Google Inc. nor the names of its contributors - * may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef CustomElementException_h -#define CustomElementException_h - -#include "wtf/text/AtomicString.h" -#include "wtf/text/WTFString.h" - -namespace WebCore { - -class ExceptionState; - -class CustomElementException { -public: - enum Reason { - CannotRegisterFromExtension, - ConstructorPropertyNotConfigurable, - ContextDestroyedCheckingPrototype, - ContextDestroyedCreatingCallbacks, - ContextDestroyedRegisteringDefinition, - InvalidName, - NotYetImplemented, - PrototypeDoesNotExtendHTMLElementSVGElementNamespace, - PrototypeDoesNotExtendHTMLElementSVGElementPrototype, - PrototypeInUse, - PrototypeNotAnObject, - TypeAlreadyRegistered - }; - - static void throwException(Reason, const AtomicString& type, ExceptionState&); - -private: - CustomElementException(); - - static String preamble(const AtomicString& type); -}; - -} - -#endif // CustomElementException_h diff --git a/chromium/third_party/WebKit/Source/core/dom/CustomElementObserver.cpp b/chromium/third_party/WebKit/Source/core/dom/CustomElementObserver.cpp deleted file mode 100644 index d4a9fba2842..00000000000 --- a/chromium/third_party/WebKit/Source/core/dom/CustomElementObserver.cpp +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (C) 2013 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 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. - * 3. Neither the name of Google Inc. nor the names of its contributors - * may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "core/dom/CustomElementObserver.h" - -namespace WebCore { - -CustomElementObserver::ElementObserverMap& CustomElementObserver::elementObservers() -{ - DEFINE_STATIC_LOCAL(ElementObserverMap, map, ()); - return map; -} - -void CustomElementObserver::notifyElementWasDestroyed(Element* element) -{ - ElementObserverMap::iterator it = elementObservers().find(element); - if (it == elementObservers().end()) - return; - it->value->elementWasDestroyed(element); -} - -void CustomElementObserver::observe(Element* element) -{ - ElementObserverMap::AddResult result = elementObservers().add(element, this); - ASSERT(result.isNewEntry); -} - -void CustomElementObserver::unobserve(Element* element) -{ - CustomElementObserver* observer = elementObservers().take(element); - ASSERT(observer == this); -} - -} // namespace WebCore diff --git a/chromium/third_party/WebKit/Source/core/dom/CustomElementObserver.h b/chromium/third_party/WebKit/Source/core/dom/CustomElementObserver.h deleted file mode 100644 index 39d702e6e92..00000000000 --- a/chromium/third_party/WebKit/Source/core/dom/CustomElementObserver.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (C) 2013 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 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. - * 3. Neither the name of Google Inc. nor the names of its contributors - * may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef CustomElementObserver_h -#define CustomElementObserver_h - -#include "wtf/HashMap.h" - -namespace WebCore { - -class Element; - -class CustomElementObserver { -public: - CustomElementObserver() { } - virtual ~CustomElementObserver() { } - - // API for CustomElement to kick off notifications - - static void notifyElementWasDestroyed(Element*); - -protected: - void observe(Element*); - void unobserve(Element*); - - virtual void elementWasDestroyed(Element* element) { unobserve(element); } - -private: - // Maps elements to the observer watching them. At most one per - // element at a time. - typedef HashMap<Element*, CustomElementObserver*> ElementObserverMap; - static ElementObserverMap& elementObservers(); -}; - -} - -#endif // CustomElementObserver_h diff --git a/chromium/third_party/WebKit/Source/core/dom/CustomElementRegistry.cpp b/chromium/third_party/WebKit/Source/core/dom/CustomElementRegistry.cpp index 472cde1e9d2..9d9195cef5a 100644 --- a/chromium/third_party/WebKit/Source/core/dom/CustomElementRegistry.cpp +++ b/chromium/third_party/WebKit/Source/core/dom/CustomElementRegistry.cpp @@ -34,11 +34,12 @@ #include "HTMLNames.h" #include "SVGNames.h" #include "bindings/v8/CustomElementConstructorBuilder.h" +#include "bindings/v8/ExceptionState.h" #include "core/dom/CustomElement.h" #include "core/dom/CustomElementDefinition.h" -#include "core/dom/CustomElementException.h" #include "core/dom/CustomElementRegistrationContext.h" #include "core/dom/DocumentLifecycleObserver.h" +#include "core/dom/ExceptionCode.h" namespace WebCore { @@ -66,30 +67,31 @@ CustomElementDefinition* CustomElementRegistry::registerElement(Document* docume // consolidated in one place. RegistrationContextObserver observer(document); - AtomicString type = userSuppliedName.lower(); - if (!constructorBuilder->isFeatureAllowed()) { - CustomElementException::throwException(CustomElementException::CannotRegisterFromExtension, type, es); + es.throwDOMException(NotSupportedError); return 0; } + AtomicString type = userSuppliedName.lower(); if (!CustomElement::isValidTypeName(type)) { - CustomElementException::throwException(CustomElementException::InvalidName, type, es); + es.throwDOMException(InvalidCharacterError); return 0; } - if (!constructorBuilder->validateOptions(type, es)) + if (!constructorBuilder->validateOptions()) { + es.throwDOMException(InvalidStateError); return 0; + } QualifiedName tagName = nullQName(); if (!constructorBuilder->findTagName(type, tagName)) { - CustomElementException::throwException(CustomElementException::PrototypeDoesNotExtendHTMLElementSVGElementNamespace, type, es); + es.throwDOMException(NamespaceError); return 0; } ASSERT(tagName.namespaceURI() == HTMLNames::xhtmlNamespaceURI || tagName.namespaceURI() == SVGNames::svgNamespaceURI); if (m_registeredTypeNames.contains(type)) { - CustomElementException::throwException(CustomElementException::TypeAlreadyRegistered, type, es); + es.throwDOMException(InvalidStateError); return 0; } @@ -100,21 +102,23 @@ CustomElementDefinition* CustomElementRegistry::registerElement(Document* docume // Consulting the constructor builder could execute script and // kill the document. if (observer.registrationContextWentAway()) { - CustomElementException::throwException(CustomElementException::ContextDestroyedCreatingCallbacks, type, es); + es.throwDOMException(InvalidStateError); return 0; } const CustomElementDescriptor descriptor(type, tagName.namespaceURI(), tagName.localName()); RefPtr<CustomElementDefinition> definition = CustomElementDefinition::create(descriptor, lifecycleCallbacks); - if (!constructorBuilder->createConstructor(document, definition.get(), es)) + if (!constructorBuilder->createConstructor(document, definition.get())) { + es.throwDOMException(NotSupportedError); return 0; + } m_definitions.add(descriptor, definition); m_registeredTypeNames.add(descriptor.type()); if (!constructorBuilder->didRegisterDefinition(definition.get())) { - CustomElementException::throwException(CustomElementException::ContextDestroyedRegisteringDefinition, type, es); + es.throwDOMException(NotSupportedError); return 0; } diff --git a/chromium/third_party/WebKit/Source/core/dom/CustomElementUpgradeCandidateMap.cpp b/chromium/third_party/WebKit/Source/core/dom/CustomElementUpgradeCandidateMap.cpp index 7dda7901d45..c84bcb7dec5 100644 --- a/chromium/third_party/WebKit/Source/core/dom/CustomElementUpgradeCandidateMap.cpp +++ b/chromium/third_party/WebKit/Source/core/dom/CustomElementUpgradeCandidateMap.cpp @@ -39,14 +39,14 @@ CustomElementUpgradeCandidateMap::~CustomElementUpgradeCandidateMap() { UpgradeCandidateMap::const_iterator::Keys end = m_upgradeCandidates.end().keys(); for (UpgradeCandidateMap::const_iterator::Keys it = m_upgradeCandidates.begin().keys(); it != end; ++it) - unobserve(*it); + unregisterForElementDestructionNotification(*it, this); } void CustomElementUpgradeCandidateMap::add(const CustomElementDescriptor& descriptor, Element* element) { element->setCustomElementState(Element::UpgradeCandidate); - observe(element); + registerForElementDestructionNotification(element, this); UpgradeCandidateMap::AddResult result = m_upgradeCandidates.add(element, descriptor); ASSERT(result.isNewEntry); @@ -59,18 +59,8 @@ void CustomElementUpgradeCandidateMap::add(const CustomElementDescriptor& descri void CustomElementUpgradeCandidateMap::remove(Element* element) { - unobserve(element); - removeCommon(element); -} - -void CustomElementUpgradeCandidateMap::elementWasDestroyed(Element* element) -{ - CustomElementObserver::elementWasDestroyed(element); - removeCommon(element); -} + unregisterForElementDestructionNotification(element, this); -void CustomElementUpgradeCandidateMap::removeCommon(Element* element) -{ UpgradeCandidateMap::iterator candidate = m_upgradeCandidates.find(element); ASSERT(candidate != m_upgradeCandidates.end()); @@ -85,11 +75,37 @@ ListHashSet<Element*> CustomElementUpgradeCandidateMap::takeUpgradeCandidatesFor const ListHashSet<Element*>& candidates = m_unresolvedDefinitions.take(descriptor); for (ElementSet::const_iterator candidate = candidates.begin(); candidate != candidates.end(); ++candidate) { - unobserve(*candidate); + unregisterForElementDestructionNotification(*candidate, this); m_upgradeCandidates.remove(*candidate); } return candidates; } +void CustomElementUpgradeCandidateMap::elementWasDestroyed(Element* element) +{ + DestructionObserverMap::iterator it = destructionObservers().find(element); + if (it == destructionObservers().end()) + return; + it->value->remove(element); // will also remove the destruction observer +} + +CustomElementUpgradeCandidateMap::DestructionObserverMap& CustomElementUpgradeCandidateMap::destructionObservers() +{ + DEFINE_STATIC_LOCAL(DestructionObserverMap, map, ()); + return map; +} + +void CustomElementUpgradeCandidateMap::registerForElementDestructionNotification(Element* element, CustomElementUpgradeCandidateMap* observer) +{ + DestructionObserverMap::AddResult result = destructionObservers().add(element, observer); + ASSERT(result.isNewEntry); +} + +void CustomElementUpgradeCandidateMap::unregisterForElementDestructionNotification(Element* element, CustomElementUpgradeCandidateMap* observer) +{ + CustomElementUpgradeCandidateMap* map = destructionObservers().take(element); + ASSERT(map == observer); +} + } diff --git a/chromium/third_party/WebKit/Source/core/dom/CustomElementUpgradeCandidateMap.h b/chromium/third_party/WebKit/Source/core/dom/CustomElementUpgradeCandidateMap.h index 0fef2f85969..2814c0a2d20 100644 --- a/chromium/third_party/WebKit/Source/core/dom/CustomElementUpgradeCandidateMap.h +++ b/chromium/third_party/WebKit/Source/core/dom/CustomElementUpgradeCandidateMap.h @@ -33,7 +33,6 @@ #include "core/dom/CustomElementDescriptor.h" #include "core/dom/CustomElementDescriptorHash.h" -#include "core/dom/CustomElementObserver.h" #include "wtf/HashMap.h" #include "wtf/ListHashSet.h" #include "wtf/Noncopyable.h" @@ -42,23 +41,26 @@ namespace WebCore { class Element; -class CustomElementUpgradeCandidateMap : CustomElementObserver { +class CustomElementUpgradeCandidateMap { WTF_MAKE_NONCOPYABLE(CustomElementUpgradeCandidateMap); public: CustomElementUpgradeCandidateMap() { } ~CustomElementUpgradeCandidateMap(); - // API for CustomElementRegistrationContext to save and take candidates - - typedef ListHashSet<Element*> ElementSet; + static void elementWasDestroyed(Element*); void add(const CustomElementDescriptor&, Element*); void remove(Element*); + + typedef ListHashSet<Element*> ElementSet; ElementSet takeUpgradeCandidatesFor(const CustomElementDescriptor&); private: - virtual void elementWasDestroyed(Element*) OVERRIDE; - void removeCommon(Element*); + // Maps elements to upgrade candidate maps observing their destruction + typedef HashMap<Element*, CustomElementUpgradeCandidateMap*> DestructionObserverMap; + static DestructionObserverMap& destructionObservers(); + static void registerForElementDestructionNotification(Element*, CustomElementUpgradeCandidateMap*); + static void unregisterForElementDestructionNotification(Element*, CustomElementUpgradeCandidateMap*); typedef HashMap<Element*, CustomElementDescriptor> UpgradeCandidateMap; UpgradeCandidateMap m_upgradeCandidates; diff --git a/chromium/third_party/WebKit/Source/core/dom/DataTransferItemList.h b/chromium/third_party/WebKit/Source/core/dom/DataTransferItemList.h index 90d847f886a..91fd9679e1d 100644 --- a/chromium/third_party/WebKit/Source/core/dom/DataTransferItemList.h +++ b/chromium/third_party/WebKit/Source/core/dom/DataTransferItemList.h @@ -56,8 +56,8 @@ public: virtual PassRefPtr<DataTransferItem> item(unsigned long index) = 0; virtual void deleteItem(unsigned long index, ExceptionState&) = 0; virtual void clear() = 0; - virtual PassRefPtr<DataTransferItem> add(const String& data, const String& type, ExceptionState&) = 0; - virtual PassRefPtr<DataTransferItem> add(PassRefPtr<File>) = 0; + virtual void add(const String& data, const String& type, ExceptionState&) = 0; + virtual void add(PassRefPtr<File>) = 0; }; } // namespace WebCore diff --git a/chromium/third_party/WebKit/Source/core/dom/DataTransferItemList.idl b/chromium/third_party/WebKit/Source/core/dom/DataTransferItemList.idl index 0babe031c24..eec5c0c5020 100644 --- a/chromium/third_party/WebKit/Source/core/dom/DataTransferItemList.idl +++ b/chromium/third_party/WebKit/Source/core/dom/DataTransferItemList.idl @@ -28,13 +28,15 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -interface DataTransferItemList { +[ + NoInterfaceObject +] interface DataTransferItemList { readonly attribute long length; - [ImplementedAs=item] getter DataTransferItem (unsigned long index); + getter DataTransferItem item([Default=Undefined] optional unsigned long index); - [RaisesException, ImplementedAs=deleteItem] void remove(unsigned long index); void clear(); - DataTransferItem add(File? file); - [RaisesException] DataTransferItem add(DOMString data, DOMString type); + void add(File? file); + [RaisesException] void add([Default=Undefined] optional DOMString data, + [Default=Undefined] optional DOMString type); }; diff --git a/chromium/third_party/WebKit/Source/core/dom/Document.cpp b/chromium/third_party/WebKit/Source/core/dom/Document.cpp index 82367ea555d..62dee7a7bbf 100644 --- a/chromium/third_party/WebKit/Source/core/dom/Document.cpp +++ b/chromium/third_party/WebKit/Source/core/dom/Document.cpp @@ -51,7 +51,6 @@ #include "core/css/StyleSheetList.h" #include "core/css/resolver/StyleResolver.h" #include "core/dom/Attr.h" -#include "core/dom/BeforeUnloadEvent.h" #include "core/dom/CDATASection.h" #include "core/dom/Comment.h" #include "core/dom/ContextFeatures.h" @@ -98,7 +97,6 @@ #include "core/dom/shadow/ShadowRoot.h" #include "core/editing/Editor.h" #include "core/editing/FrameSelection.h" -#include "core/fetch/ResourceFetcher.h" #include "core/html/FormController.h" #include "core/html/HTMLAllCollection.h" #include "core/html/HTMLAnchorElement.h" @@ -110,7 +108,6 @@ #include "core/html/HTMLHtmlElement.h" #include "core/html/HTMLIFrameElement.h" #include "core/html/HTMLImport.h" -#include "core/html/HTMLInputElement.h" #include "core/html/HTMLLinkElement.h" #include "core/html/HTMLNameCollection.h" #include "core/html/HTMLScriptElement.h" @@ -131,6 +128,7 @@ #include "core/loader/Prerenderer.h" #include "core/loader/TextResourceDecoder.h" #include "core/loader/appcache/ApplicationCacheHost.h" +#include "core/loader/cache/ResourceFetcher.h" #include "core/page/Chrome.h" #include "core/page/ChromeClient.h" #include "core/page/ContentSecurityPolicy.h" @@ -146,6 +144,7 @@ #include "core/page/PageConsole.h" #include "core/page/PointerLockController.h" #include "core/page/Settings.h" +#include "core/page/ValidationMessageClient.h" #include "core/page/animation/AnimationController.h" #include "core/page/scrolling/ScrollingCoordinator.h" #include "core/platform/DateComponents.h" @@ -436,7 +435,6 @@ Document::Document(const DocumentInit& initializer, DocumentClassFlags documentC , m_referrerPolicy(ReferrerPolicyDefault) , m_directionSetOnDocumentElement(false) , m_writingModeSetOnDocumentElement(false) - , m_didAllowNavigationViaBeforeUnloadConfirmationPanel(false) , m_writeRecursionIsTooDeep(false) , m_writeRecursionDepth(0) , m_wheelEventHandlerCount(0) @@ -1088,11 +1086,8 @@ void Document::setReadyState(ReadyState readyState) m_documentTiming.domLoading = monotonicallyIncreasingTime(); break; case Interactive: - if (!m_documentTiming.domInteractive) { + if (!m_documentTiming.domInteractive) m_documentTiming.domInteractive = monotonicallyIncreasingTime(); - if (RuntimeEnabledFeatures::webAnimationsEnabled()) - m_timeline->setZeroTimeAsPerfTime(m_documentTiming.domInteractive); - } break; case Complete: if (!m_documentTiming.domComplete) @@ -1298,7 +1293,6 @@ void Document::updateTitle(const StringWithDirection& title) m_rawTitle = title; - StringWithDirection oldTitle = m_title; if (m_rawTitle.string().isEmpty()) m_title = StringWithDirection(); else { @@ -1307,11 +1301,8 @@ void Document::updateTitle(const StringWithDirection& title) else m_title = canonicalizedTitle<UChar>(this, m_rawTitle); } - - if (!m_frame || oldTitle == m_title) - return; - m_frame->loader()->history()->setCurrentItemTitle(m_title); - m_frame->loader()->client()->dispatchDidReceiveTitle(m_title); + if (Frame* f = frame()) + f->loader()->setTitle(m_title); } void Document::setTitle(const String& title) @@ -1680,10 +1671,8 @@ void Document::recalcStyle(StyleChange change) m_inStyleRecalc = false; // Pseudo element removal and similar may only work with these flags still set. Reset them after the style recalc. - if (m_styleResolver) { + if (m_styleResolver) m_styleSheetCollection->resetCSSFeatureFlags(m_styleResolver->ruleFeatureSet()); - m_styleResolver->clearStyleSharingList(); - } if (frameView) { frameView->resumeScheduledEvents(); @@ -1899,8 +1888,11 @@ void Document::detach(const AttachContext& context) { ASSERT(attached()); - if (page()) - page()->documentDetached(this); + if (page()) { + page()->pointerLockController()->documentDetached(this); + if (ValidationMessageClient* client = page()->validationMessageClient()) + client->documentDetached(*this); + } if (this == topDocument()) clearAXObjectCache(); @@ -2330,95 +2322,6 @@ void Document::implicitClose() accessSVGExtensions()->startAnimations(); } -bool Document::dispatchBeforeUnloadEvent(Chrome& chrome, Document* navigatingDocument) -{ - if (!m_domWindow) - return true; - - if (!body()) - return true; - - RefPtr<Document> protect(this); - - RefPtr<BeforeUnloadEvent> beforeUnloadEvent = BeforeUnloadEvent::create(); - m_loadEventProgress = BeforeUnloadEventInProgress; - dispatchWindowEvent(beforeUnloadEvent.get(), this); - m_loadEventProgress = BeforeUnloadEventCompleted; - if (!beforeUnloadEvent->defaultPrevented()) - defaultEventHandler(beforeUnloadEvent.get()); - if (beforeUnloadEvent->result().isNull()) - return true; - - if (navigatingDocument->m_didAllowNavigationViaBeforeUnloadConfirmationPanel) { - addConsoleMessage(JSMessageSource, ErrorMessageLevel, "Blocked attempt to show multiple 'beforeunload' confirmation panels for a single navigation."); - return true; - } - - String text = displayStringModifiedByEncoding(beforeUnloadEvent->result()); - if (chrome.runBeforeUnloadConfirmPanel(text, m_frame)) { - navigatingDocument->m_didAllowNavigationViaBeforeUnloadConfirmationPanel = true; - return true; - } - return false; -} - -void Document::dispatchUnloadEvents() -{ - RefPtr<Document> protect(this); - if (m_parser) - m_parser->stopParsing(); - - if (m_loadEventProgress >= LoadEventTried && m_loadEventProgress <= UnloadEventInProgress) { - Element* currentFocusedElement = focusedElement(); - if (currentFocusedElement && currentFocusedElement->hasTagName(inputTag)) - toHTMLInputElement(currentFocusedElement)->endEditing(); - if (m_loadEventProgress < PageHideInProgress) { - m_loadEventProgress = PageHideInProgress; - dispatchWindowEvent(PageTransitionEvent::create(eventNames().pagehideEvent, false), this); - if (!m_frame) - return; - - // The DocumentLoader (and thus its DocumentLoadTiming) might get destroyed - // while dispatching the event, so protect it to prevent writing the end - // time into freed memory. - RefPtr<DocumentLoader> documentLoader = m_frame->loader()->provisionalDocumentLoader(); - m_loadEventProgress = UnloadEventInProgress; - RefPtr<Event> unloadEvent(Event::create(eventNames().unloadEvent, false, false)); - if (documentLoader && !documentLoader->timing()->unloadEventStart() && !documentLoader->timing()->unloadEventEnd()) { - DocumentLoadTiming* timing = documentLoader->timing(); - ASSERT(timing->navigationStart()); - timing->markUnloadEventStart(); - dispatchWindowEvent(unloadEvent, this); - timing->markUnloadEventEnd(); - } else { - m_frame->domWindow()->dispatchEvent(unloadEvent, m_frame->document()); - } - } - updateStyleIfNeeded(); - m_loadEventProgress = UnloadEventHandled; - } - - if (!m_frame) - return; - - // Don't remove event listeners from a transitional empty document (see https://bugs.webkit.org/show_bug.cgi?id=28716 for more information). - bool keepEventListeners = m_frame->loader()->stateMachine()->isDisplayingInitialEmptyDocument() && m_frame->loader()->provisionalDocumentLoader() - && isSecureTransitionTo(m_frame->loader()->provisionalDocumentLoader()->url()); - if (!keepEventListeners) - removeAllEventListeners(); -} - -Document::PageDismissalType Document::pageDismissalEventBeingDispatched() const -{ - if (m_loadEventProgress == BeforeUnloadEventInProgress) - return BeforeUnloadDismissal; - if (m_loadEventProgress == PageHideInProgress) - return PageHideDismissal; - if (m_loadEventProgress == UnloadEventInProgress) - return UnloadDismissal; - return NoDismissal; -} - void Document::setParsing(bool b) { m_bParsing = b; @@ -2710,7 +2613,6 @@ Frame* Document::findUnsafeParentScrollPropagationBoundary() void Document::seamlessParentUpdatedStylesheets() { - m_styleSheetCollection->didModifySeamlessParentStyleSheet(); styleResolverChanged(RecalcStyleImmediately); } @@ -4730,18 +4632,18 @@ void Document::webkitExitPointerLock() { if (!page()) return; - if (Element* target = page()->pointerLockController().element()) { + if (Element* target = page()->pointerLockController()->element()) { if (target->document() != this) return; } - page()->pointerLockController().requestPointerUnlock(); + page()->pointerLockController()->requestPointerUnlock(); } Element* Document::webkitPointerLockElement() const { - if (!page() || page()->pointerLockController().lockPending()) + if (!page() || page()->pointerLockController()->lockPending()) return 0; - if (Element* element = page()->pointerLockController().element()) { + if (Element* element = page()->pointerLockController()->element()) { if (element->document() == this) return element; } diff --git a/chromium/third_party/WebKit/Source/core/dom/Document.h b/chromium/third_party/WebKit/Source/core/dom/Document.h index f6aadfd9832..cd905432eef 100644 --- a/chromium/third_party/WebKit/Source/core/dom/Document.h +++ b/chromium/third_party/WebKit/Source/core/dom/Document.h @@ -67,7 +67,6 @@ class CSSStyleSheetResource; class ScriptResource; class CanvasRenderingContext; class CharacterData; -class Chrome; class Comment; class ContentSecurityPolicyResponseHeaders; class ContextFeatures; @@ -546,17 +545,6 @@ public: // implicitClose() actually does the work of closing the input stream. void implicitClose(); - bool dispatchBeforeUnloadEvent(Chrome&, Document* navigatingDocument); - void dispatchUnloadEvents(); - - enum PageDismissalType { - NoDismissal = 0, - BeforeUnloadDismissal = 1, - PageHideDismissal = 2, - UnloadDismissal = 3 - }; - PageDismissalType pageDismissalEventBeingDispatched() const; - void cancelParsing(); void write(const SegmentedString& text, Document* ownerDocument = 0); @@ -766,8 +754,6 @@ public: String title() const { return m_title.string(); } void setTitle(const String&); - const StringWithDirection& titleWithDirection() const { return m_title; } - Element* titleElement() const { return m_titleElement.get(); } void setTitleElement(const StringWithDirection&, Element* titleElement); void removeTitle(Element* titleElement); @@ -928,15 +914,15 @@ public: LoadEventTried, LoadEventInProgress, LoadEventCompleted, - BeforeUnloadEventInProgress, - BeforeUnloadEventCompleted, - PageHideInProgress, UnloadEventInProgress, UnloadEventHandled }; bool loadEventStillNeeded() const { return m_loadEventProgress == LoadEventNotRun; } bool processingLoadEvent() const { return m_loadEventProgress == LoadEventInProgress; } bool loadEventFinished() const { return m_loadEventProgress >= LoadEventCompleted; } + bool unloadEventStillNeeded() const { return m_loadEventProgress >= LoadEventTried && m_loadEventProgress <= UnloadEventInProgress; } + void unloadEventStarted() { m_loadEventProgress = UnloadEventInProgress; } + void unloadEventWasHandled() { m_loadEventProgress = UnloadEventHandled; } virtual bool isContextThread() const; virtual bool isJSExecutionForbidden() const { return false; } @@ -1331,8 +1317,6 @@ private: bool m_directionSetOnDocumentElement; bool m_writingModeSetOnDocumentElement; - bool m_didAllowNavigationViaBeforeUnloadConfirmationPanel; - DocumentTiming m_documentTiming; RefPtr<MediaQueryMatcher> m_mediaQueryMatcher; bool m_writeRecursionIsTooDeep; diff --git a/chromium/third_party/WebKit/Source/core/dom/Document.idl b/chromium/third_party/WebKit/Source/core/dom/Document.idl index c27623ad891..0fc91ba9df1 100644 --- a/chromium/third_party/WebKit/Source/core/dom/Document.idl +++ b/chromium/third_party/WebKit/Source/core/dom/Document.idl @@ -33,10 +33,10 @@ callback CustomElementConstructor = Element (); DocumentFragment createDocumentFragment(); [PerWorldBindings] Text createTextNode([Default=Undefined] optional DOMString data); Comment createComment([Default=Undefined] optional DOMString data); - [RaisesException, MeasureAs=DocumentCreateCDATASection] CDATASection createCDATASection([Default=Undefined] optional DOMString data); // Removed from DOM4. + [RaisesException] CDATASection createCDATASection([Default=Undefined] optional DOMString data); [RaisesException] ProcessingInstruction createProcessingInstruction([Default=Undefined] optional DOMString target, [Default=Undefined] optional DOMString data); - [RaisesException, MeasureAs=DocumentCreateAttribute] Attr createAttribute([Default=Undefined] optional DOMString name); // Removed from DOM4. + [RaisesException] Attr createAttribute([Default=Undefined] optional DOMString name); [PerWorldBindings] NodeList getElementsByTagName([Default=Undefined] optional DOMString tagname); // Introduced in DOM Level 2: @@ -45,19 +45,19 @@ callback CustomElementConstructor = Element (); optional boolean deep); [CustomElementCallbacks=Enable, PerWorldBindings, ActivityLog=AccessForIsolatedWorlds, RaisesException] Element createElementNS([TreatNullAs=NullString,Default=Undefined] optional DOMString namespaceURI, [TreatNullAs=NullString,Default=Undefined] optional DOMString qualifiedName); - [RaisesException, MeasureAs=DocumentCreateAttributeNS] Attr createAttributeNS([TreatNullAs=NullString,Default=Undefined] optional DOMString namespaceURI, - [TreatNullAs=NullString,Default=Undefined] optional DOMString qualifiedName); // Removed from DOM4. + [RaisesException] Attr createAttributeNS([TreatNullAs=NullString,Default=Undefined] optional DOMString namespaceURI, + [TreatNullAs=NullString,Default=Undefined] optional DOMString qualifiedName); NodeList getElementsByTagNameNS([TreatNullAs=NullString,Default=Undefined] optional DOMString namespaceURI, [Default=Undefined] optional DOMString localName); [PerWorldBindings] Element getElementById([Default=Undefined] optional DOMString elementId); // DOM Level 3 Core - [TreatReturnedNullStringAs=Null, MeasureAs=DocumentInputEncoding] readonly attribute DOMString inputEncoding; // Removed from DOM4. + [TreatReturnedNullStringAs=Null] readonly attribute DOMString inputEncoding; - [TreatReturnedNullStringAs=Null, MeasureAs=DocumentXMLEncoding] readonly attribute DOMString xmlEncoding; // Removed from DOM4. - [TreatReturnedNullStringAs=Null, TreatNullAs=NullString, SetterRaisesException, MeasureAs=DocumentXMLVersion] attribute DOMString xmlVersion; // Removed from DOM4. - [SetterRaisesException, MeasureAs=DocumentXMLStandalone] attribute boolean xmlStandalone; // Removed from DOM4. + [TreatReturnedNullStringAs=Null] readonly attribute DOMString xmlEncoding; + [TreatReturnedNullStringAs=Null, TreatNullAs=NullString, SetterRaisesException] attribute DOMString xmlVersion; + [SetterRaisesException] attribute boolean xmlStandalone; [RaisesException, CustomElementCallbacks=Enable] Node adoptNode([Default=Undefined] optional Node source); diff --git a/chromium/third_party/WebKit/Source/core/dom/DocumentStyleSheetCollection.cpp b/chromium/third_party/WebKit/Source/core/dom/DocumentStyleSheetCollection.cpp index 5e24213368a..74ef2b1164a 100644 --- a/chromium/third_party/WebKit/Source/core/dom/DocumentStyleSheetCollection.cpp +++ b/chromium/third_party/WebKit/Source/core/dom/DocumentStyleSheetCollection.cpp @@ -37,8 +37,6 @@ #include "core/dom/Document.h" #include "core/dom/Element.h" #include "core/dom/ProcessingInstruction.h" -#include "core/dom/ShadowTreeStyleSheetCollection.h" -#include "core/dom/shadow/ShadowRoot.h" #include "core/html/HTMLIFrameElement.h" #include "core/html/HTMLLinkElement.h" #include "core/html/HTMLStyleElement.h" @@ -65,7 +63,6 @@ DocumentStyleSheetCollection::DocumentStyleSheetCollection(Document* document) , m_usesBeforeAfterRulesOverride(false) , m_usesRemUnits(false) , m_collectionForDocument(document) - , m_needsDocumentStyleSheetsUpdate(true) { } @@ -83,55 +80,6 @@ DocumentStyleSheetCollection::~DocumentStyleSheetCollection() m_authorStyleSheets[i]->clearOwnerNode(); } -void DocumentStyleSheetCollection::insertTreeScopeInDocumentOrder(TreeScopeSet& treeScopes, TreeScope* treeScope) -{ - if (treeScopes.isEmpty()) { - treeScopes.add(treeScope); - return; - } - if (treeScopes.contains(treeScope)) - return; - - TreeScopeSet::iterator begin = treeScopes.begin(); - TreeScopeSet::iterator end = treeScopes.end(); - TreeScopeSet::iterator it = end; - TreeScope* followingTreeScope = 0; - do { - --it; - TreeScope* n = *it; - unsigned short position = n->comparePosition(treeScope); - if (position & Node::DOCUMENT_POSITION_FOLLOWING) { - treeScopes.insertBefore(followingTreeScope, treeScope); - return; - } - followingTreeScope = n; - } while (it != begin); - - treeScopes.insertBefore(followingTreeScope, treeScope); -} - -StyleSheetCollection* DocumentStyleSheetCollection::ensureStyleSheetCollectionFor(TreeScope* treeScope) -{ - if (treeScope == m_document) - return &m_collectionForDocument; - - HashMap<TreeScope*, OwnPtr<StyleSheetCollection> >::AddResult result = m_styleSheetCollectionMap.add(treeScope, nullptr); - if (result.isNewEntry) - result.iterator->value = adoptPtr(new ShadowTreeStyleSheetCollection(toShadowRoot(treeScope))); - return result.iterator->value.get(); -} - -StyleSheetCollection* DocumentStyleSheetCollection::styleSheetCollectionFor(TreeScope* treeScope) -{ - if (treeScope == m_document) - return &m_collectionForDocument; - - HashMap<TreeScope*, OwnPtr<StyleSheetCollection> >::iterator it = m_styleSheetCollectionMap.find(treeScope); - if (it == m_styleSheetCollectionMap.end()) - return 0; - return it->value.get(); -} - const Vector<RefPtr<StyleSheet> >& DocumentStyleSheetCollection::styleSheetsForStyleSheetList() { return m_collectionForDocument.styleSheetsForStyleSheetList(); @@ -142,19 +90,6 @@ const Vector<RefPtr<CSSStyleSheet> >& DocumentStyleSheetCollection::activeAuthor return m_collectionForDocument.activeAuthorStyleSheets(); } -void DocumentStyleSheetCollection::getActiveAuthorStyleSheets(Vector<const Vector<RefPtr<CSSStyleSheet> >*>& activeAuthorStyleSheets) const -{ - activeAuthorStyleSheets.append(&m_collectionForDocument.activeAuthorStyleSheets()); - - HashMap<TreeScope*, OwnPtr<StyleSheetCollection> >::const_iterator::Values begin = m_styleSheetCollectionMap.values().begin(); - HashMap<TreeScope*, OwnPtr<StyleSheetCollection> >::const_iterator::Values end = m_styleSheetCollectionMap.values().end(); - HashMap<TreeScope*, OwnPtr<StyleSheetCollection> >::const_iterator::Values it = begin; - for (; it != end; ++it) { - const StyleSheetCollection* collection = it->get(); - activeAuthorStyleSheets.append(&collection->activeAuthorStyleSheets()); - } -} - void DocumentStyleSheetCollection::combineCSSFeatureFlags(const RuleFeatureSet& features) { // Delay resetting the flags until after next style recalc since unapplying the style may not work without these set (this is true at least with before/after). @@ -253,7 +188,6 @@ void DocumentStyleSheetCollection::updateInjectedStyleSheetCache() const void DocumentStyleSheetCollection::invalidateInjectedStyleSheetCache() { m_injectedStyleSheetCacheValid = false; - m_needsDocumentStyleSheetsUpdate = true; // FIXME: updateInjectedStyleSheetCache is called inside StyleSheetCollection::updateActiveStyleSheets // and batch updates lots of sheets so we can't call addedStyleSheet() or removedStyleSheet(). m_document->styleResolverChanged(DeferRecalcStyle); @@ -264,7 +198,6 @@ void DocumentStyleSheetCollection::addAuthorSheet(PassRefPtr<StyleSheetContents> ASSERT(!authorSheet->isUserStyleSheet()); m_authorStyleSheets.append(CSSStyleSheet::create(authorSheet, m_document)); m_document->addedStyleSheet(m_authorStyleSheets.last().get(), RecalcStyleImmediately); - m_needsDocumentStyleSheetsUpdate = true; } void DocumentStyleSheetCollection::addUserSheet(PassRefPtr<StyleSheetContents> userSheet) @@ -272,23 +205,16 @@ void DocumentStyleSheetCollection::addUserSheet(PassRefPtr<StyleSheetContents> u ASSERT(userSheet->isUserStyleSheet()); m_userStyleSheets.append(CSSStyleSheet::create(userSheet, m_document)); m_document->addedStyleSheet(m_userStyleSheets.last().get(), RecalcStyleImmediately); - m_needsDocumentStyleSheetsUpdate = true; } // This method is called whenever a top-level stylesheet has finished loading. -void DocumentStyleSheetCollection::removePendingSheet(Node* styleSheetCandidateNode, RemovePendingSheetNotificationType notification) +void DocumentStyleSheetCollection::removePendingSheet(RemovePendingSheetNotificationType notification) { // Make sure we knew this sheet was pending, and that our count isn't out of sync. ASSERT(m_pendingStylesheets > 0); m_pendingStylesheets--; - TreeScope* treeScope = isHTMLStyleElement(styleSheetCandidateNode) ? styleSheetCandidateNode->treeScope() : m_document; - if (treeScope == m_document) - m_needsDocumentStyleSheetsUpdate = true; - else - m_dirtyTreeScopes.add(treeScope); - if (m_pendingStylesheets) return; @@ -304,59 +230,21 @@ void DocumentStyleSheetCollection::removePendingSheet(Node* styleSheetCandidateN void DocumentStyleSheetCollection::addStyleSheetCandidateNode(Node* node, bool createdByParser) { - if (!node->inDocument()) - return; - - TreeScope* treeScope = isHTMLStyleElement(node) ? node->treeScope() : m_document; - ASSERT(isHTMLStyleElement(node) || treeScope == m_document); - - StyleSheetCollection* collection = ensureStyleSheetCollectionFor(treeScope); - ASSERT(collection); - collection->addStyleSheetCandidateNode(node, createdByParser); - - if (treeScope == m_document) { - m_needsDocumentStyleSheetsUpdate = true; - return; - } - - insertTreeScopeInDocumentOrder(m_activeTreeScopes, treeScope); - m_dirtyTreeScopes.add(treeScope); + m_collectionForDocument.addStyleSheetCandidateNode(node, createdByParser); } void DocumentStyleSheetCollection::removeStyleSheetCandidateNode(Node* node, ContainerNode* scopingNode) { - TreeScope* treeScope = scopingNode ? scopingNode->treeScope() : m_document; - ASSERT(isHTMLStyleElement(node) || treeScope == m_document); - - StyleSheetCollection* collection = styleSheetCollectionFor(treeScope); - ASSERT(collection); - collection->removeStyleSheetCandidateNode(node, scopingNode); - - if (treeScope == m_document) { - m_needsDocumentStyleSheetsUpdate = true; - return; - } - m_dirtyTreeScopes.add(treeScope); - m_activeTreeScopes.remove(treeScope); + m_collectionForDocument.removeStyleSheetCandidateNode(node, scopingNode); } -void DocumentStyleSheetCollection::modifiedStyleSheetCandidateNode(Node* node) +static bool styleSheetsUseRemUnits(const Vector<RefPtr<CSSStyleSheet> >& sheets) { - if (!node->inDocument()) - return; - - TreeScope* treeScope = isHTMLStyleElement(node) ? node->treeScope() : m_document; - ASSERT(isHTMLStyleElement(node) || treeScope == m_document); - if (treeScope == m_document) { - m_needsDocumentStyleSheetsUpdate = true; - return; + for (unsigned i = 0; i < sheets.size(); ++i) { + if (sheets[i]->contents()->usesRemUnits()) + return true; } - m_dirtyTreeScopes.add(treeScope); -} - -bool DocumentStyleSheetCollection::shouldUpdateShadowTreeStyleSheetCollection(StyleResolverUpdateMode updateMode) -{ - return !m_dirtyTreeScopes.isEmpty() || updateMode == FullStyleUpdate; + return false; } bool DocumentStyleSheetCollection::updateActiveStyleSheets(StyleResolverUpdateMode updateMode) @@ -372,91 +260,18 @@ bool DocumentStyleSheetCollection::updateActiveStyleSheets(StyleResolverUpdateMo if (!m_document->renderer() || !m_document->attached()) return false; - bool requiresFullStyleRecalc = false; - if (m_needsDocumentStyleSheetsUpdate || updateMode == FullStyleUpdate) - requiresFullStyleRecalc = m_collectionForDocument.updateActiveStyleSheets(this, updateMode); - - if (shouldUpdateShadowTreeStyleSheetCollection(updateMode)) { - TreeScopeSet treeScopes = updateMode == FullStyleUpdate ? m_activeTreeScopes : m_dirtyTreeScopes; - HashSet<TreeScope*> treeScopesRemoved; - - for (TreeScopeSet::iterator it = treeScopes.begin(); it != treeScopes.end(); ++it) { - TreeScope* treeScope = *it; - ASSERT(treeScope != m_document); - ShadowTreeStyleSheetCollection* collection = static_cast<ShadowTreeStyleSheetCollection*>(styleSheetCollectionFor(treeScope)); - ASSERT(collection); - collection->updateActiveStyleSheets(this, updateMode); - if (!collection->hasStyleSheetCandidateNodes()) - treeScopesRemoved.add(treeScope); - } - if (!treeScopesRemoved.isEmpty()) - for (HashSet<TreeScope*>::iterator it = treeScopesRemoved.begin(); it != treeScopesRemoved.end(); ++it) - m_activeTreeScopes.remove(*it); - m_dirtyTreeScopes.clear(); - } - - if (StyleResolver* styleResolver = m_document->styleResolverIfExists()) { - styleResolver->finishAppendAuthorStyleSheets(); - resetCSSFeatureFlags(styleResolver->ruleFeatureSet()); - } - + StyleSheetCollection::StyleResolverUpdateType styleResolverUpdateType; + bool requiresFullStyleRecalc = m_collectionForDocument.updateActiveStyleSheets(this, updateMode, styleResolverUpdateType); m_needsUpdateActiveStylesheetsOnStyleRecalc = false; - activeStyleSheetsUpdatedForInspector(); - m_usesRemUnits = m_collectionForDocument.usesRemUnits(); - - if (m_needsDocumentStyleSheetsUpdate || updateMode == FullStyleUpdate) { - m_document->notifySeamlessChildDocumentsOfStylesheetUpdate(); - m_needsDocumentStyleSheetsUpdate = false; - } - - return requiresFullStyleRecalc; -} - -void DocumentStyleSheetCollection::activeStyleSheetsUpdatedForInspector() -{ - if (m_activeTreeScopes.isEmpty()) { - InspectorInstrumentation::activeStyleSheetsUpdated(m_document, m_collectionForDocument.styleSheetsForStyleSheetList()); - return; - } - Vector<RefPtr<StyleSheet> > activeStyleSheets; - activeStyleSheets.append(m_collectionForDocument.styleSheetsForStyleSheetList()); + if (styleResolverUpdateType != StyleSheetCollection::Reconstruct) + resetCSSFeatureFlags(m_document->styleResolver()->ruleFeatureSet()); - TreeScopeSet::iterator begin = m_activeTreeScopes.begin(); - TreeScopeSet::iterator end = m_activeTreeScopes.end(); - for (TreeScopeSet::iterator it = begin; it != end; ++it) { - if (StyleSheetCollection* collection = m_styleSheetCollectionMap.get(*it)) - activeStyleSheets.append(collection->styleSheetsForStyleSheetList()); - } + InspectorInstrumentation::activeStyleSheetsUpdated(m_document, m_collectionForDocument.styleSheetsForStyleSheetList()); + m_usesRemUnits = styleSheetsUseRemUnits(m_collectionForDocument.activeAuthorStyleSheets()); + m_document->notifySeamlessChildDocumentsOfStylesheetUpdate(); - // FIXME: Inspector needs a vector which has all active stylesheets. - // However, creating such a large vector might cause performance regression. - // Need to implement some smarter solution. - InspectorInstrumentation::activeStyleSheetsUpdated(m_document, activeStyleSheets); -} - -void DocumentStyleSheetCollection::didRemoveShadowRoot(ShadowRoot* shadowRoot) -{ - m_styleSheetCollectionMap.remove(shadowRoot); -} - -void DocumentStyleSheetCollection::appendActiveAuthorStyleSheets(StyleResolver* styleResolver) -{ - ASSERT(styleResolver); - - styleResolver->setBuildScopedStyleTreeInDocumentOrder(true); - styleResolver->appendAuthorStyleSheets(0, m_collectionForDocument.activeAuthorStyleSheets()); - - TreeScopeSet::iterator begin = m_activeTreeScopes.begin(); - TreeScopeSet::iterator end = m_activeTreeScopes.end(); - for (TreeScopeSet::iterator it = begin; it != end; ++it) { - if (StyleSheetCollection* collection = m_styleSheetCollectionMap.get(*it)) { - styleResolver->setBuildScopedStyleTreeInDocumentOrder(!collection->scopingNodesForStyleScoped()); - styleResolver->appendAuthorStyleSheets(0, collection->activeAuthorStyleSheets()); - } - } - styleResolver->finishAppendAuthorStyleSheets(); - styleResolver->setBuildScopedStyleTreeInDocumentOrder(false); + return requiresFullStyleRecalc; } } diff --git a/chromium/third_party/WebKit/Source/core/dom/DocumentStyleSheetCollection.h b/chromium/third_party/WebKit/Source/core/dom/DocumentStyleSheetCollection.h index 2dd47c549f7..bbafeb858e6 100644 --- a/chromium/third_party/WebKit/Source/core/dom/DocumentStyleSheetCollection.h +++ b/chromium/third_party/WebKit/Source/core/dom/DocumentStyleSheetCollection.h @@ -64,7 +64,6 @@ public: void addStyleSheetCandidateNode(Node*, bool createdByParser); void removeStyleSheetCandidateNode(Node*, ContainerNode* scopingNode = 0); - void modifiedStyleSheetCandidateNode(Node*); void clearPageUserSheet(); void updatePageUserSheet(); @@ -88,7 +87,7 @@ public: RemovePendingSheetNotifyImmediately, RemovePendingSheetNotifyLater }; - void removePendingSheet(Node* styleSheetCandidateNode, RemovePendingSheetNotificationType = RemovePendingSheetNotifyImmediately); + void removePendingSheet(RemovePendingSheetNotificationType = RemovePendingSheetNotifyImmediately); bool hasPendingSheets() const { return m_pendingStylesheets > 0; } @@ -106,22 +105,9 @@ public: void combineCSSFeatureFlags(const RuleFeatureSet&); void resetCSSFeatureFlags(const RuleFeatureSet&); - void didModifySeamlessParentStyleSheet() { m_needsDocumentStyleSheetsUpdate = true; } - void didRemoveShadowRoot(ShadowRoot*); - void appendActiveAuthorStyleSheets(StyleResolver*); - void getActiveAuthorStyleSheets(Vector<const Vector<RefPtr<CSSStyleSheet> >*>& activeAuthorStyleSheets) const; - private: DocumentStyleSheetCollection(Document*); - StyleSheetCollection* ensureStyleSheetCollectionFor(TreeScope*); - StyleSheetCollection* styleSheetCollectionFor(TreeScope*); - void activeStyleSheetsUpdatedForInspector(); - bool shouldUpdateShadowTreeStyleSheetCollection(StyleResolverUpdateMode); - - typedef ListHashSet<TreeScope*, 16> TreeScopeSet; - static void insertTreeScopeInDocumentOrder(TreeScopeSet&, TreeScope*); - Document* m_document; // Track the number of currently loading top-level stylesheets needed for rendering. @@ -139,14 +125,10 @@ private: Vector<RefPtr<CSSStyleSheet> > m_userStyleSheets; Vector<RefPtr<CSSStyleSheet> > m_authorStyleSheets; + bool m_hadActiveLoadingStylesheet; bool m_needsUpdateActiveStylesheetsOnStyleRecalc; - StyleSheetCollectionForDocument m_collectionForDocument; - HashMap<TreeScope*, OwnPtr<StyleSheetCollection> > m_styleSheetCollectionMap; - - TreeScopeSet m_dirtyTreeScopes; - TreeScopeSet m_activeTreeScopes; - bool m_needsDocumentStyleSheetsUpdate; + StyleSheetCollection m_collectionForDocument; String m_preferredStylesheetSetName; String m_selectedStylesheetSetName; diff --git a/chromium/third_party/WebKit/Source/core/dom/DocumentType.idl b/chromium/third_party/WebKit/Source/core/dom/DocumentType.idl index 510240a1362..8f192f3f562 100644 --- a/chromium/third_party/WebKit/Source/core/dom/DocumentType.idl +++ b/chromium/third_party/WebKit/Source/core/dom/DocumentType.idl @@ -22,14 +22,14 @@ interface DocumentType : Node { // DOM Level 1 readonly attribute DOMString name; - [MeasureAs=DocumentTypeEntities] readonly attribute NamedNodeMap entities; // Removed from DOM4. - [MeasureAs=DocumentTypeNotations] readonly attribute NamedNodeMap notations; // Removed from DOM4. + readonly attribute NamedNodeMap entities; + readonly attribute NamedNodeMap notations; // DOM Level 2 [TreatReturnedNullStringAs=Null] readonly attribute DOMString publicId; [TreatReturnedNullStringAs=Null] readonly attribute DOMString systemId; - [TreatReturnedNullStringAs=Null, MeasureAs=DocumentTypeInternalSubset] readonly attribute DOMString internalSubset; // Removed from DOM4. + [TreatReturnedNullStringAs=Null] readonly attribute DOMString internalSubset; }; DocumentType implements ChildNode; diff --git a/chromium/third_party/WebKit/Source/core/dom/Element.cpp b/chromium/third_party/WebKit/Source/core/dom/Element.cpp index ade43c82f1f..b7147bcdc82 100644 --- a/chromium/third_party/WebKit/Source/core/dom/Element.cpp +++ b/chromium/third_party/WebKit/Source/core/dom/Element.cpp @@ -1279,7 +1279,7 @@ void Element::removedFrom(ContainerNode* insertionPoint) setContainsFullScreenElementOnAncestorsCrossingFrameBoundaries(false); if (document()->page()) - document()->page()->pointerLockController().elementRemoved(this); + document()->page()->pointerLockController()->elementRemoved(this); setSavedLayerScrollOffset(IntSize()); @@ -1318,16 +1318,6 @@ void Element::attach(const AttachContext& context) StyleResolverParentPusher parentPusher(this); WidgetHierarchyUpdatesSuspensionScope suspendWidgetHierarchyUpdates; - // We've already been through detach when doing a lazyAttach, but we might - // need to clear any state that's been added since then. - if (hasRareData() && styleChangeType() == LazyAttachStyleChange) { - ElementRareData* data = elementRareData(); - data->clearComputedStyle(); - data->resetDynamicRestyleObservations(); - if (!context.resolvedStyle) - data->resetStyleState(); - } - NodeRenderingContext(this, context.resolvedStyle).createRendererForElementIfNeeded(); createPseudoElementIfNeeded(BEFORE); @@ -1511,9 +1501,6 @@ bool Element::recalcStyle(StyleChange change) change = Force; else if (change != Force) change = localChange; - } else { - // We still want to seed the style sharing list when just walking the tree to maximize sharing. - document()->styleResolver()->addToStyleSharingList(this); } StyleResolverParentPusher parentPusher(this); @@ -1547,11 +1534,10 @@ bool Element::recalcStyle(StyleChange change) } else if (child->isElementNode()) { Element* element = toElement(child); - bool childRulesChanged = element->needsStyleRecalc() && element->styleChangeType() >= SubtreeStyleChange; - if (forceCheckOfNextElementSibling || forceCheckOfAnyElementSibling) element->setNeedsStyleRecalc(); + bool childRulesChanged = element->needsStyleRecalc() && element->styleChangeType() >= SubtreeStyleChange; forceCheckOfNextElementSibling = childRulesChanged && hasDirectAdjacentRules; forceCheckOfAnyElementSibling = forceCheckOfAnyElementSibling || (childRulesChanged && hasIndirectAdjacentRules); @@ -1642,6 +1628,12 @@ ShadowRoot* Element::ensureUserAgentShadowRoot() return shadowRoot; } +Element* Element::uaShadowElementById(const AtomicString& id) const +{ + ShadowRoot* shadowRoot = userAgentShadowRoot(); + return shadowRoot ? shadowRoot->getElementById(id) : 0; +} + bool Element::supportsShadowElementForUserAgentShadow() const { return true; @@ -2638,7 +2630,7 @@ void Element::setIsInTopLayer(bool inTopLayer) void Element::webkitRequestPointerLock() { if (document()->page()) - document()->page()->pointerLockController().requestPointerLock(this); + document()->page()->pointerLockController()->requestPointerLock(this); } SpellcheckAttributeState Element::spellcheckAttributeState() const diff --git a/chromium/third_party/WebKit/Source/core/dom/Element.h b/chromium/third_party/WebKit/Source/core/dom/Element.h index f90ed9e58dd..7b075ce8638 100644 --- a/chromium/third_party/WebKit/Source/core/dom/Element.h +++ b/chromium/third_party/WebKit/Source/core/dom/Element.h @@ -446,6 +446,7 @@ public: ShadowRoot* userAgentShadowRoot() const; ShadowRoot* ensureUserAgentShadowRoot(); + Element* uaShadowElementById(const AtomicString& id) const; virtual bool supportsShadowElementForUserAgentShadow() const; virtual const AtomicString& shadowPseudoId() const { return !part().isEmpty() ? part() : pseudo(); } diff --git a/chromium/third_party/WebKit/Source/core/dom/Element.idl b/chromium/third_party/WebKit/Source/core/dom/Element.idl index 72241970591..0137af97e90 100644 --- a/chromium/third_party/WebKit/Source/core/dom/Element.idl +++ b/chromium/third_party/WebKit/Source/core/dom/Element.idl @@ -30,9 +30,9 @@ [RaisesException, CustomElementCallbacks=Enable] void setAttribute([Default=Undefined] optional DOMString name, [Default=Undefined] optional DOMString value); [CustomElementCallbacks=Enable] void removeAttribute([Default=Undefined] optional DOMString name); - [MeasureAs=ElementGetAttributeNode] Attr getAttributeNode([Default=Undefined] optional DOMString name); // Removed from DOM4. - [RaisesException, CustomElementCallbacks=Enable, MeasureAs=ElementSetAttributeNode] Attr setAttributeNode([Default=Undefined, StrictTypeChecking] optional Attr newAttr); // Removed from DOM4. - [RaisesException, CustomElementCallbacks=Enable, MeasureAs=ElementRemoveAttributeNode] Attr removeAttributeNode([Default=Undefined, StrictTypeChecking] optional Attr oldAttr); // Removed from DOM4. + Attr getAttributeNode([Default=Undefined] optional DOMString name); + [RaisesException, CustomElementCallbacks=Enable] Attr setAttributeNode([Default=Undefined, StrictTypeChecking] optional Attr newAttr); + [RaisesException, CustomElementCallbacks=Enable] Attr removeAttributeNode([Default=Undefined, StrictTypeChecking] optional Attr oldAttr); [PerWorldBindings] NodeList getElementsByTagName([Default=Undefined] optional DOMString name); // For ObjC this is defined on Node for legacy support. @@ -50,8 +50,8 @@ DOMString localName); NodeList getElementsByTagNameNS([TreatNullAs=NullString,Default=Undefined] optional DOMString namespaceURI, [Default=Undefined] optional DOMString localName); - [MeasureAs=ElementGetAttributeNodeNS] Attr getAttributeNodeNS([TreatNullAs=NullString,Default=Undefined] optional DOMString namespaceURI, - [Default=Undefined] optional DOMString localName); // Removed from DOM4. + Attr getAttributeNodeNS([TreatNullAs=NullString,Default=Undefined] optional DOMString namespaceURI, + [Default=Undefined] optional DOMString localName); [RaisesException, CustomElementCallbacks=Enable] Attr setAttributeNodeNS([Default=Undefined, StrictTypeChecking] optional Attr newAttr); boolean hasAttribute(DOMString name); boolean hasAttributeNS([TreatNullAs=NullString,Default=Undefined] optional DOMString namespaceURI, diff --git a/chromium/third_party/WebKit/Source/core/dom/Node.cpp b/chromium/third_party/WebKit/Source/core/dom/Node.cpp index 981e4afc5c4..39360244d6c 100644 --- a/chromium/third_party/WebKit/Source/core/dom/Node.cpp +++ b/chromium/third_party/WebKit/Source/core/dom/Node.cpp @@ -1030,33 +1030,6 @@ bool Node::containsIncludingHostElements(const Node* node) const return false; } -inline void Node::detachNode(Node* root, const AttachContext& context) -{ - Node* node = root; - while (node) { - if (node->styleChangeType() == LazyAttachStyleChange) { - // FIXME: This is needed because Node::lazyAttach marks nodes as being attached even - // though they've never been through attach(). This allows us to avoid doing all the - // virtual calls to detach() and other associated work. - node->clearAttached(); - node->clearChildNeedsStyleRecalc(); - - for (ShadowRoot* shadowRoot = node->youngestShadowRoot(); shadowRoot; shadowRoot = shadowRoot->olderShadowRoot()) - detachNode(shadowRoot, context); - - node = NodeTraversal::next(node, root); - continue; - } - // Handle normal reattaches from style recalc (ex. display type changes) - // or descendants of lazy attached nodes that got actually attached, for example, - // by innerHTML or editing. - // FIXME: innerHTML and editing should also lazyAttach. - if (node->attached()) - node->detach(context); - node = NodeTraversal::nextSkippingChildren(node, root); - } -} - void Node::reattach(const AttachContext& context) { // FIXME: Text::updateTextRenderer calls reattach outside a style recalc. @@ -1064,7 +1037,8 @@ void Node::reattach(const AttachContext& context) AttachContext reattachContext(context); reattachContext.performingReattach = true; - detachNode(this, reattachContext); + if (attached()) + detach(reattachContext); attach(reattachContext); } @@ -1136,7 +1110,7 @@ void Node::detach(const AttachContext& context) } } - clearAttached(); + clearFlag(IsAttachedFlag); #ifndef NDEBUG detachingNode = 0; @@ -2490,8 +2464,9 @@ void Node::defaultEventHandler(Event* event) if (dispatchDOMActivateEvent(detail, event)) event->setDefaultHandled(); } else if (eventType == eventNames().contextmenuEvent) { - if (Page* page = document()->page()) - page->contextMenuController().handleContextMenuEvent(event); + if (Frame* frame = document()->frame()) + if (Page* page = frame->page()) + page->contextMenuController()->handleContextMenuEvent(event); } else if (eventType == eventNames().textInputEvent) { if (event->hasInterface(eventNames().interfaceForTextEvent)) if (Frame* frame = document()->frame()) @@ -2648,14 +2623,15 @@ PassRefPtr<NodeList> Node::getDestinationInsertionPoints() document()->updateDistributionForNodeIfNeeded(this); Vector<InsertionPoint*, 8> insertionPoints; collectInsertionPointsWhereNodeIsDistributed(this, insertionPoints); - Vector<RefPtr<Node> > filteredInsertionPoints; for (size_t i = 0; i < insertionPoints.size(); ++i) { InsertionPoint* insertionPoint = insertionPoints[i]; ASSERT(insertionPoint->containingShadowRoot()); - if (insertionPoint->containingShadowRoot()->type() != ShadowRoot::UserAgentShadowRoot) - filteredInsertionPoints.append(insertionPoint); + if (insertionPoint->containingShadowRoot()->type() == ShadowRoot::UserAgentShadowRoot) + return StaticNodeList::createEmpty(); } - return StaticNodeList::adopt(filteredInsertionPoints); + Vector<RefPtr<Node> > asNodes; + asNodes.appendRange(insertionPoints.begin(), insertionPoints.end()); + return StaticNodeList::adopt(asNodes); } void Node::registerScopedHTMLStyleChild() diff --git a/chromium/third_party/WebKit/Source/core/dom/Node.h b/chromium/third_party/WebKit/Source/core/dom/Node.h index 92a02e3713a..a651d060e69 100644 --- a/chromium/third_party/WebKit/Source/core/dom/Node.h +++ b/chromium/third_party/WebKit/Source/core/dom/Node.h @@ -839,9 +839,6 @@ private: void setStyleChange(StyleChangeType); - void detachNode(Node*, const AttachContext&); - void clearAttached() { clearFlag(IsAttachedFlag); } - // Used to share code between lazyAttach and setNeedsStyleRecalc. void markAncestorsWithChildNeedsStyleRecalc(); diff --git a/chromium/third_party/WebKit/Source/core/dom/Node.idl b/chromium/third_party/WebKit/Source/core/dom/Node.idl index 55643f02a63..0c7c5a12526 100644 --- a/chromium/third_party/WebKit/Source/core/dom/Node.idl +++ b/chromium/third_party/WebKit/Source/core/dom/Node.idl @@ -61,11 +61,11 @@ [CustomElementCallbacks=Enable] void normalize(); // Introduced in DOM Level 2: - [MeasureAs=NodeIsSupported] boolean isSupported([Default=Undefined] optional DOMString feature, - [TreatNullAs=NullString,Default=Undefined] optional DOMString version); // Removed in DOM4. + boolean isSupported([Default=Undefined] optional DOMString feature, + [TreatNullAs=NullString,Default=Undefined] optional DOMString version); - [TreatReturnedNullStringAs=Null, PerWorldBindings, MeasureAs=NodeNamespaceURI] readonly attribute DOMString namespaceURI; // Removed from DOM4. - [TreatReturnedNullStringAs=Null, TreatNullAs=NullString, PerWorldBindings, SetterRaisesException, MeasureAs=NodePrefix] attribute DOMString prefix; // Removed from DOM4. + [TreatReturnedNullStringAs=Null, PerWorldBindings] readonly attribute DOMString namespaceURI; + [TreatReturnedNullStringAs=Null, TreatNullAs=NullString, PerWorldBindings, SetterRaisesException] attribute DOMString prefix; [TreatReturnedNullStringAs=Null, PerWorldBindings] readonly attribute DOMString localName; // Introduced in DOM Level 3: @@ -74,7 +74,7 @@ // FIXME: the spec says this can also raise on retrieval. [TreatReturnedNullStringAs=Null, TreatNullAs=NullString, PerWorldBindings, SetterRaisesException, CustomElementCallbacks=Enable] attribute DOMString textContent; - [MeasureAs=NodeIsSameNode] boolean isSameNode([Default=Undefined] optional Node other); // Removed in DOM4. + boolean isSameNode([Default=Undefined] optional Node other); boolean isEqualNode([Default=Undefined] optional Node other); [TreatReturnedNullStringAs=Null] DOMString lookupPrefix([TreatNullAs=NullString,Default=Undefined] optional DOMString namespaceURI); boolean isDefaultNamespace([TreatNullAs=NullString,Default=Undefined] optional DOMString namespaceURI); diff --git a/chromium/third_party/WebKit/Source/core/dom/PendingScript.cpp b/chromium/third_party/WebKit/Source/core/dom/PendingScript.cpp index 6ad05cfed0e..aab3343f3fe 100644 --- a/chromium/third_party/WebKit/Source/core/dom/PendingScript.cpp +++ b/chromium/third_party/WebKit/Source/core/dom/PendingScript.cpp @@ -27,7 +27,7 @@ #include "core/dom/PendingScript.h" #include "core/dom/Element.h" -#include "core/fetch/ScriptResource.h" +#include "core/loader/cache/ScriptResource.h" namespace WebCore { diff --git a/chromium/third_party/WebKit/Source/core/dom/PendingScript.h b/chromium/third_party/WebKit/Source/core/dom/PendingScript.h index 0f169a9cabe..bf902b21987 100644 --- a/chromium/third_party/WebKit/Source/core/dom/PendingScript.h +++ b/chromium/third_party/WebKit/Source/core/dom/PendingScript.h @@ -26,8 +26,8 @@ #ifndef PendingScript_h #define PendingScript_h -#include "core/fetch/ResourceClient.h" -#include "core/fetch/ResourcePtr.h" +#include "core/loader/cache/ResourceClient.h" +#include "core/loader/cache/ResourcePtr.h" #include "wtf/PassRefPtr.h" #include "wtf/RefPtr.h" #include "wtf/text/TextPosition.h" diff --git a/chromium/third_party/WebKit/Source/core/dom/ProcessingInstruction.cpp b/chromium/third_party/WebKit/Source/core/dom/ProcessingInstruction.cpp index cf915dc2dc7..def6f8efa93 100644 --- a/chromium/third_party/WebKit/Source/core/dom/ProcessingInstruction.cpp +++ b/chromium/third_party/WebKit/Source/core/dom/ProcessingInstruction.cpp @@ -27,10 +27,10 @@ #include "core/css/StyleSheetContents.h" #include "core/dom/Document.h" #include "core/dom/DocumentStyleSheetCollection.h" -#include "core/fetch/CSSStyleSheetResource.h" -#include "core/fetch/FetchRequest.h" -#include "core/fetch/ResourceFetcher.h" -#include "core/fetch/XSLStyleSheetResource.h" +#include "core/loader/cache/CSSStyleSheetResource.h" +#include "core/loader/cache/FetchRequest.h" +#include "core/loader/cache/ResourceFetcher.h" +#include "core/loader/cache/XSLStyleSheetResource.h" #include "core/xml/XSLStyleSheet.h" #include "core/xml/parser/XMLDocumentParser.h" // for parseAttributes() @@ -170,7 +170,7 @@ void ProcessingInstruction::checkStyleSheet() else { // The request may have been denied if (for example) the stylesheet is local and the document is remote. m_loading = false; - document()->styleSheetCollection()->removePendingSheet(this); + document()->styleSheetCollection()->removePendingSheet(); } } } @@ -188,7 +188,7 @@ bool ProcessingInstruction::isLoading() const bool ProcessingInstruction::sheetLoaded() { if (!isLoading()) { - document()->styleSheetCollection()->removePendingSheet(this); + document()->styleSheetCollection()->removePendingSheet(); return true; } return false; diff --git a/chromium/third_party/WebKit/Source/core/dom/ProcessingInstruction.h b/chromium/third_party/WebKit/Source/core/dom/ProcessingInstruction.h index d8c837bcff9..1ae797633e1 100644 --- a/chromium/third_party/WebKit/Source/core/dom/ProcessingInstruction.h +++ b/chromium/third_party/WebKit/Source/core/dom/ProcessingInstruction.h @@ -23,8 +23,8 @@ #define ProcessingInstruction_h #include "core/dom/Node.h" -#include "core/fetch/ResourcePtr.h" -#include "core/fetch/StyleSheetResourceClient.h" +#include "core/loader/cache/ResourcePtr.h" +#include "core/loader/cache/StyleSheetResourceClient.h" namespace WebCore { diff --git a/chromium/third_party/WebKit/Source/core/dom/ScriptLoader.cpp b/chromium/third_party/WebKit/Source/core/dom/ScriptLoader.cpp index 55d6844df0d..6d1c06b4b70 100644 --- a/chromium/third_party/WebKit/Source/core/dom/ScriptLoader.cpp +++ b/chromium/third_party/WebKit/Source/core/dom/ScriptLoader.cpp @@ -35,12 +35,12 @@ #include "core/dom/ScriptRunner.h" #include "core/dom/ScriptableDocumentParser.h" #include "core/dom/Text.h" -#include "core/fetch/FetchRequest.h" -#include "core/fetch/ResourceFetcher.h" -#include "core/fetch/ScriptResource.h" #include "core/html/HTMLImport.h" #include "core/html/HTMLScriptElement.h" #include "core/html/parser/HTMLParserIdioms.h" +#include "core/loader/cache/FetchRequest.h" +#include "core/loader/cache/ResourceFetcher.h" +#include "core/loader/cache/ScriptResource.h" #include "core/page/ContentSecurityPolicy.h" #include "core/page/Frame.h" #include "core/platform/MIMETypeRegistry.h" diff --git a/chromium/third_party/WebKit/Source/core/dom/ScriptLoader.h b/chromium/third_party/WebKit/Source/core/dom/ScriptLoader.h index dfa88184585..390d83a2f89 100644 --- a/chromium/third_party/WebKit/Source/core/dom/ScriptLoader.h +++ b/chromium/third_party/WebKit/Source/core/dom/ScriptLoader.h @@ -21,8 +21,8 @@ #ifndef ScriptLoader_h #define ScriptLoader_h -#include "core/fetch/ResourceClient.h" -#include "core/fetch/ResourcePtr.h" +#include "core/loader/cache/ResourceClient.h" +#include "core/loader/cache/ResourcePtr.h" #include "wtf/text/TextPosition.h" #include "wtf/text/WTFString.h" diff --git a/chromium/third_party/WebKit/Source/core/dom/ScriptRunner.cpp b/chromium/third_party/WebKit/Source/core/dom/ScriptRunner.cpp index f63ab5056c0..d25001e0f42 100644 --- a/chromium/third_party/WebKit/Source/core/dom/ScriptRunner.cpp +++ b/chromium/third_party/WebKit/Source/core/dom/ScriptRunner.cpp @@ -30,7 +30,7 @@ #include "core/dom/Element.h" #include "core/dom/PendingScript.h" #include "core/dom/ScriptLoader.h" -#include "core/fetch/ScriptResource.h" +#include "core/loader/cache/ScriptResource.h" namespace WebCore { diff --git a/chromium/third_party/WebKit/Source/core/dom/ScriptRunner.h b/chromium/third_party/WebKit/Source/core/dom/ScriptRunner.h index b793589a8e8..ef9e270b5c9 100644 --- a/chromium/third_party/WebKit/Source/core/dom/ScriptRunner.h +++ b/chromium/third_party/WebKit/Source/core/dom/ScriptRunner.h @@ -26,7 +26,7 @@ #ifndef ScriptRunner_h #define ScriptRunner_h -#include "core/fetch/ResourcePtr.h" +#include "core/loader/cache/ResourcePtr.h" #include "core/platform/Timer.h" #include "wtf/HashMap.h" #include "wtf/Noncopyable.h" diff --git a/chromium/third_party/WebKit/Source/core/dom/ShadowTreeStyleSheetCollection.cpp b/chromium/third_party/WebKit/Source/core/dom/ShadowTreeStyleSheetCollection.cpp deleted file mode 100644 index 2c53a058c09..00000000000 --- a/chromium/third_party/WebKit/Source/core/dom/ShadowTreeStyleSheetCollection.cpp +++ /dev/null @@ -1,132 +0,0 @@ -/* - * Copyright (C) 1999 Lars Knoll (knoll@kde.org) - * (C) 1999 Antti Koivisto (koivisto@kde.org) - * (C) 2001 Dirk Mueller (mueller@kde.org) - * (C) 2006 Alexey Proskuryakov (ap@webkit.org) - * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All rights reserved. - * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/) - * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) - * Copyright (C) 2013 Google Inc. All rights reserved. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this library; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#include "config.h" -#include "core/dom/ShadowTreeStyleSheetCollection.h" - -#include "HTMLNames.h" -#include "core/css/CSSStyleSheet.h" -#include "core/css/resolver/StyleResolver.h" -#include "core/dom/Document.h" -#include "core/dom/DocumentStyleSheetCollection.h" -#include "core/dom/Element.h" -#include "core/dom/shadow/ShadowRoot.h" -#include "core/html/HTMLStyleElement.h" -#include "core/page/Settings.h" - -namespace WebCore { - -using namespace HTMLNames; - -ShadowTreeStyleSheetCollection::ShadowTreeStyleSheetCollection(ShadowRoot* shadowRoot) - : StyleSheetCollection(shadowRoot) -{ -} - -void ShadowTreeStyleSheetCollection::collectStyleSheets(DocumentStyleSheetCollection* collections, Vector<RefPtr<StyleSheet> >& styleSheets, Vector<RefPtr<CSSStyleSheet> >& activeSheets) -{ - if (document()->settings() && !document()->settings()->authorAndUserStylesEnabled()) - return; - - DocumentOrderedList::iterator begin = m_styleSheetCandidateNodes.begin(); - DocumentOrderedList::iterator end = m_styleSheetCandidateNodes.end(); - for (DocumentOrderedList::iterator it = begin; it != end; ++it) { - Node* node = *it; - StyleSheet* sheet = 0; - CSSStyleSheet* activeSheet = 0; - - if (!node->isHTMLElement() || !node->hasTagName(styleTag)) - continue; - - Element* element = toElement(node); - AtomicString title = element->getAttribute(titleAttr); - bool enabledViaScript = false; - - sheet = static_cast<HTMLStyleElement*>(node)->sheet(); - if (sheet && !sheet->disabled() && sheet->isCSSStyleSheet()) - activeSheet = static_cast<CSSStyleSheet*>(sheet); - - // FIXME: clarify how PREFERRED or ALTERNATE works in shadow trees. - // Should we set preferred/selected stylesheets name in shadow trees and - // use the name in document? - AtomicString rel = element->getAttribute(relAttr); - if (!enabledViaScript && sheet && !title.isEmpty()) { - if (collections->preferredStylesheetSetName().isEmpty()) { - if (element->hasLocalName(styleTag) || !rel.contains("alternate")) { - collections->setPreferredStylesheetSetName(title); - collections->setSelectedStylesheetSetName(title); - } - } - if (title != collections->preferredStylesheetSetName()) - activeSheet = 0; - } - - if (rel.contains("alternate") && title.isEmpty()) - activeSheet = 0; - - if (sheet) - styleSheets.append(sheet); - if (activeSheet) - activeSheets.append(activeSheet); - } -} - -bool ShadowTreeStyleSheetCollection::updateActiveStyleSheets(DocumentStyleSheetCollection* collections, StyleResolverUpdateMode updateMode) -{ - Vector<RefPtr<StyleSheet> > styleSheets; - Vector<RefPtr<CSSStyleSheet> > activeCSSStyleSheets; - collectStyleSheets(collections, styleSheets, activeCSSStyleSheets); - - bool requiresFullStyleRecalc = true; - - // If we have already decided to destroy StyleResolver, we don't need to analyze. Reconstruction will take care. - if (StyleResolver* styleResolver = document()->styleResolverIfExists()) { - StyleResolverUpdateType styleResolverUpdateType; - - analyzeStyleSheetChange(updateMode, activeAuthorStyleSheets(), activeCSSStyleSheets, styleResolverUpdateType, requiresFullStyleRecalc); - - // FIXME: We might have already had styles in child treescope. In this case, we cannot use buildScopedStyleTreeInDocumentOrder. - // Need to change "false" to some valid condition. - styleResolver->setBuildScopedStyleTreeInDocumentOrder(false); - if (styleResolverUpdateType == Reset || styleResolverUpdateType == Reconstruct) { - // We should not destroy StyleResolver when we find any stylesheet update in a shadow tree. - // In this case, we will reset rulesets created from style elements in the shadow tree. - resetAllRuleSetsInTreeScope(styleResolver); - styleResolver->appendAuthorStyleSheets(0, activeCSSStyleSheets); - } else { - ASSERT(styleResolverUpdateType == Additive); - styleResolver->appendAuthorStyleSheets(m_activeAuthorStyleSheets.size(), activeCSSStyleSheets); - } - } - m_scopingNodesForStyleScoped.didRemoveScopingNodes(); - m_activeAuthorStyleSheets.swap(activeCSSStyleSheets); - m_styleSheetsForStyleSheetList.swap(styleSheets); - updateUsesRemUnits(); - - return requiresFullStyleRecalc; -} - -} diff --git a/chromium/third_party/WebKit/Source/core/dom/ShadowTreeStyleSheetCollection.h b/chromium/third_party/WebKit/Source/core/dom/ShadowTreeStyleSheetCollection.h deleted file mode 100644 index e3984406ef3..00000000000 --- a/chromium/third_party/WebKit/Source/core/dom/ShadowTreeStyleSheetCollection.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (C) 1999 Lars Knoll (knoll@kde.org) - * (C) 1999 Antti Koivisto (koivisto@kde.org) - * (C) 2001 Dirk Mueller (mueller@kde.org) - * (C) 2006 Alexey Proskuryakov (ap@webkit.org) - * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All rights reserved. - * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/) - * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) - * Copyright (C) 2013 Google Inc. All rights reserved. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this library; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - * - */ - -#ifndef ShadowTreeStyleSheetCollection_h -#define ShadowTreeStyleSheetCollection_h - -#include "core/dom/StyleSheetCollection.h" - -namespace WebCore { - -class CSSStyleSheet; -class DocumentStyleSheetCollection; -class ShadowRoot; -class StyleSheet; -class StyleSheetCollection; - -class ShadowTreeStyleSheetCollection FINAL : public StyleSheetCollection { - WTF_MAKE_NONCOPYABLE(ShadowTreeStyleSheetCollection); WTF_MAKE_FAST_ALLOCATED; -public: - explicit ShadowTreeStyleSheetCollection(ShadowRoot*); - - bool updateActiveStyleSheets(DocumentStyleSheetCollection*, StyleResolverUpdateMode); - -private: - void collectStyleSheets(DocumentStyleSheetCollection*, Vector<RefPtr<StyleSheet> >& styleSheets, Vector<RefPtr<CSSStyleSheet> >& activeSheets); -}; - -} - -#endif - diff --git a/chromium/third_party/WebKit/Source/core/dom/StyleElement.cpp b/chromium/third_party/WebKit/Source/core/dom/StyleElement.cpp index 8f31ee46d6d..0320d1670ee 100644 --- a/chromium/third_party/WebKit/Source/core/dom/StyleElement.cpp +++ b/chromium/third_party/WebKit/Source/core/dom/StyleElement.cpp @@ -127,7 +127,7 @@ void StyleElement::createSheet(Element* e, const String& text) Document* document = e->document(); if (m_sheet) { if (m_sheet->isLoading()) - document->styleSheetCollection()->removePendingSheet(e); + document->styleSheetCollection()->removePendingSheet(); clearSheet(); } @@ -169,7 +169,7 @@ bool StyleElement::sheetLoaded(Document* document) if (isLoading()) return false; - document->styleSheetCollection()->removePendingSheet(m_sheet->ownerNode()); + document->styleSheetCollection()->removePendingSheet(); return true; } diff --git a/chromium/third_party/WebKit/Source/core/dom/StyleSheetCollection.cpp b/chromium/third_party/WebKit/Source/core/dom/StyleSheetCollection.cpp index a665b8074de..80ca3d2a967 100644 --- a/chromium/third_party/WebKit/Source/core/dom/StyleSheetCollection.cpp +++ b/chromium/third_party/WebKit/Source/core/dom/StyleSheetCollection.cpp @@ -37,11 +37,13 @@ #include "core/dom/DocumentStyleSheetCollection.h" #include "core/dom/Element.h" #include "core/dom/ProcessingInstruction.h" -#include "core/dom/shadow/ShadowRoot.h" #include "core/html/HTMLIFrameElement.h" #include "core/html/HTMLLinkElement.h" #include "core/html/HTMLStyleElement.h" +#include "core/page/Page.h" +#include "core/page/PageGroup.h" #include "core/page/Settings.h" +#include "core/page/UserContentURLPattern.h" #include "core/svg/SVGStyleElement.h" namespace WebCore { @@ -84,115 +86,7 @@ void StyleSheetCollection::removeStyleSheetCandidateNode(Node* node, ContainerNo m_scopingNodesForStyleScoped.remove(scopingNode); } -StyleSheetCollection::StyleResolverUpdateType StyleSheetCollection::compareStyleSheets(const Vector<RefPtr<CSSStyleSheet> >& oldStyleSheets, const Vector<RefPtr<CSSStyleSheet> >& newStylesheets, Vector<StyleSheetContents*>& addedSheets) -{ - // Find out which stylesheets are new. - unsigned newStylesheetCount = newStylesheets.size(); - unsigned oldStylesheetCount = oldStyleSheets.size(); - if (newStylesheetCount < oldStylesheetCount) - return Reconstruct; - - unsigned newIndex = 0; - for (unsigned oldIndex = 0; oldIndex < oldStylesheetCount; ++oldIndex) { - if (newIndex >= newStylesheetCount) - return Reconstruct; - while (oldStyleSheets[oldIndex] != newStylesheets[newIndex]) { - addedSheets.append(newStylesheets[newIndex]->contents()); - ++newIndex; - if (newIndex == newStylesheetCount) - return Reconstruct; - } - ++newIndex; - } - bool hasInsertions = !addedSheets.isEmpty(); - while (newIndex < newStylesheetCount) { - addedSheets.append(newStylesheets[newIndex]->contents()); - ++newIndex; - } - // If all new sheets were added at the end of the list we can just add them to existing StyleResolver. - // If there were insertions we need to re-add all the stylesheets so rules are ordered correctly. - return hasInsertions ? Reset : Additive; -} - -bool StyleSheetCollection::activeLoadingStyleSheetLoaded(const Vector<RefPtr<CSSStyleSheet> >& newStyleSheets) -{ - // StyleSheets of <style> elements that @import stylesheets are active but loading. We need to trigger a full recalc when such loads are done. - bool hasActiveLoadingStylesheet = false; - unsigned newStylesheetCount = newStyleSheets.size(); - for (unsigned i = 0; i < newStylesheetCount; ++i) { - if (newStyleSheets[i]->isLoading()) - hasActiveLoadingStylesheet = true; - } - if (m_hadActiveLoadingStylesheet && !hasActiveLoadingStylesheet) { - m_hadActiveLoadingStylesheet = false; - return true; - } - m_hadActiveLoadingStylesheet = hasActiveLoadingStylesheet; - return false; -} - -void StyleSheetCollection::analyzeStyleSheetChange(StyleResolverUpdateMode updateMode, const Vector<RefPtr<CSSStyleSheet> >& oldStyleSheets, const Vector<RefPtr<CSSStyleSheet> >& newStyleSheets, StyleResolverUpdateType& styleResolverUpdateType, bool& requiresFullStyleRecalc) -{ - styleResolverUpdateType = Reconstruct; - requiresFullStyleRecalc = true; - - if (activeLoadingStyleSheetLoaded(newStyleSheets)) - return; - - if (updateMode != AnalyzedStyleUpdate) - return; - if (!document()->styleResolverIfExists()) - return; - - // Find out which stylesheets are new. - Vector<StyleSheetContents*> addedSheets; - styleResolverUpdateType = compareStyleSheets(oldStyleSheets, newStyleSheets, addedSheets); - - // If we are already parsing the body and so may have significant amount of elements, put some effort into trying to avoid style recalcs. - if (!document()->body() || document()->hasNodesWithPlaceholderStyle()) - return; - StyleInvalidationAnalysis invalidationAnalysis(addedSheets); - if (invalidationAnalysis.dirtiesAllStyle()) - return; - invalidationAnalysis.invalidateStyle(document()); - requiresFullStyleRecalc = false; -} - -void StyleSheetCollection::resetAllRuleSetsInTreeScope(StyleResolver* styleResolver) -{ - // FIXME: If many web developers use style scoped, implement reset RuleSets in per-scoping node manner. - if (DocumentOrderedList* styleScopedScopingNodes = scopingNodesForStyleScoped()) { - for (DocumentOrderedList::iterator it = styleScopedScopingNodes->begin(); it != styleScopedScopingNodes->end(); ++it) - styleResolver->resetAuthorStyle(toContainerNode(*it)); - } - if (ListHashSet<Node*, 4>* removedNodes = scopingNodesRemoved()) { - for (ListHashSet<Node*, 4>::iterator it = removedNodes->begin(); it != removedNodes->end(); ++it) - styleResolver->resetAuthorStyle(toContainerNode(*it)); - } - styleResolver->resetAuthorStyle(toContainerNode(m_treeScope->rootNode())); -} - -static bool styleSheetsUseRemUnits(const Vector<RefPtr<CSSStyleSheet> >& sheets) -{ - for (unsigned i = 0; i < sheets.size(); ++i) { - if (sheets[i]->contents()->usesRemUnits()) - return true; - } - return false; -} - -void StyleSheetCollection::updateUsesRemUnits() -{ - m_usesRemUnits = styleSheetsUseRemUnits(m_activeAuthorStyleSheets); -} - -StyleSheetCollectionForDocument::StyleSheetCollectionForDocument(TreeScope* treeScope) - : StyleSheetCollection(treeScope) -{ - ASSERT(treeScope->rootNode() == treeScope->rootNode()->document()); -} - -void StyleSheetCollectionForDocument::collectStyleSheets(DocumentStyleSheetCollection* collections, Vector<RefPtr<StyleSheet> >& styleSheets, Vector<RefPtr<CSSStyleSheet> >& activeSheets) +void StyleSheetCollection::collectStyleSheets(DocumentStyleSheetCollection* collections, Vector<RefPtr<StyleSheet> >& styleSheets, Vector<RefPtr<CSSStyleSheet> >& activeSheets) { if (document()->settings() && !document()->settings()->authorAndUserStylesEnabled()) return; @@ -279,6 +173,80 @@ void StyleSheetCollectionForDocument::collectStyleSheets(DocumentStyleSheetColle } } +StyleSheetCollection::StyleResolverUpdateType StyleSheetCollection::compareStyleSheets(const Vector<RefPtr<CSSStyleSheet> >& oldStyleSheets, const Vector<RefPtr<CSSStyleSheet> >& newStylesheets, Vector<StyleSheetContents*>& addedSheets) +{ + // Find out which stylesheets are new. + unsigned newStylesheetCount = newStylesheets.size(); + unsigned oldStylesheetCount = oldStyleSheets.size(); + if (newStylesheetCount < oldStylesheetCount) + return Reconstruct; + + unsigned newIndex = 0; + for (unsigned oldIndex = 0; oldIndex < oldStylesheetCount; ++oldIndex) { + if (newIndex >= newStylesheetCount) + return Reconstruct; + while (oldStyleSheets[oldIndex] != newStylesheets[newIndex]) { + addedSheets.append(newStylesheets[newIndex]->contents()); + ++newIndex; + if (newIndex == newStylesheetCount) + return Reconstruct; + } + ++newIndex; + } + bool hasInsertions = !addedSheets.isEmpty(); + while (newIndex < newStylesheetCount) { + addedSheets.append(newStylesheets[newIndex]->contents()); + ++newIndex; + } + // If all new sheets were added at the end of the list we can just add them to existing StyleResolver. + // If there were insertions we need to re-add all the stylesheets so rules are ordered correctly. + return hasInsertions ? Reset : Additive; +} + +bool StyleSheetCollection::activeLoadingStyleSheetLoaded(const Vector<RefPtr<CSSStyleSheet> >& newStyleSheets) +{ + // StyleSheets of <style> elements that @import stylesheets are active but loading. We need to trigger a full recalc when such loads are done. + bool hasActiveLoadingStylesheet = false; + unsigned newStylesheetCount = newStyleSheets.size(); + for (unsigned i = 0; i < newStylesheetCount; ++i) { + if (newStyleSheets[i]->isLoading()) + hasActiveLoadingStylesheet = true; + } + if (m_hadActiveLoadingStylesheet && !hasActiveLoadingStylesheet) { + m_hadActiveLoadingStylesheet = false; + return true; + } + m_hadActiveLoadingStylesheet = hasActiveLoadingStylesheet; + return false; +} + +void StyleSheetCollection::analyzeStyleSheetChange(StyleResolverUpdateMode updateMode, const Vector<RefPtr<CSSStyleSheet> >& oldStyleSheets, const Vector<RefPtr<CSSStyleSheet> >& newStyleSheets, StyleResolverUpdateType& styleResolverUpdateType, bool& requiresFullStyleRecalc) +{ + styleResolverUpdateType = Reconstruct; + requiresFullStyleRecalc = true; + + if (activeLoadingStyleSheetLoaded(newStyleSheets)) + return; + + if (updateMode != AnalyzedStyleUpdate) + return; + if (!document()->styleResolverIfExists()) + return; + + // Find out which stylesheets are new. + Vector<StyleSheetContents*> addedSheets; + styleResolverUpdateType = compareStyleSheets(oldStyleSheets, newStyleSheets, addedSheets); + + // If we are already parsing the body and so may have significant amount of elements, put some effort into trying to avoid style recalcs. + if (!document()->body() || document()->hasNodesWithPlaceholderStyle()) + return; + StyleInvalidationAnalysis invalidationAnalysis(addedSheets); + if (invalidationAnalysis.dirtiesAllStyle()) + return; + invalidationAnalysis.invalidateStyle(document()); + requiresFullStyleRecalc = false; +} + static void collectActiveCSSStyleSheetsFromSeamlessParents(Vector<RefPtr<CSSStyleSheet> >& sheets, Document* document) { HTMLIFrameElement* seamlessParentIFrame = document->seamlessParentIFrame(); @@ -287,7 +255,7 @@ static void collectActiveCSSStyleSheetsFromSeamlessParents(Vector<RefPtr<CSSStyl sheets.append(seamlessParentIFrame->document()->styleSheetCollection()->activeAuthorStyleSheets()); } -bool StyleSheetCollectionForDocument::updateActiveStyleSheets(DocumentStyleSheetCollection* collections, StyleResolverUpdateMode updateMode) +bool StyleSheetCollection::updateActiveStyleSheets(DocumentStyleSheetCollection* collections, StyleResolverUpdateMode updateMode, StyleResolverUpdateType& styleResolverUpdateType) { Vector<RefPtr<StyleSheet> > styleSheets; Vector<RefPtr<CSSStyleSheet> > activeCSSStyleSheets; @@ -296,20 +264,25 @@ bool StyleSheetCollectionForDocument::updateActiveStyleSheets(DocumentStyleSheet collectActiveCSSStyleSheetsFromSeamlessParents(activeCSSStyleSheets, document()); collectStyleSheets(collections, styleSheets, activeCSSStyleSheets); - StyleResolverUpdateType styleResolverUpdateType; bool requiresFullStyleRecalc; analyzeStyleSheetChange(updateMode, activeAuthorStyleSheets(), activeCSSStyleSheets, styleResolverUpdateType, requiresFullStyleRecalc); if (styleResolverUpdateType == Reconstruct) { document()->clearStyleResolver(); } else { - StyleResolver* styleResolver = document()->styleResolverIfExists(); - ASSERT(styleResolver); - // FIXME: We might have already had styles in child treescope. In this case, we cannot use buildScopedStyleTreeInDocumentOrder. - // Need to change "false" to some valid condition. - styleResolver->setBuildScopedStyleTreeInDocumentOrder(false); + StyleResolver* styleResolver = document()->styleResolver(); + styleResolver->setBuildScopedStyleTreeInDocumentOrder(!scopingNodesForStyleScoped()); if (styleResolverUpdateType == Reset) { - resetAllRuleSetsInTreeScope(styleResolver); + if (DocumentOrderedList* styleScopedScopingNodes = scopingNodesForStyleScoped()) { + for (DocumentOrderedList::iterator it = styleScopedScopingNodes->begin(); it != styleScopedScopingNodes->end(); ++it) + styleResolver->resetAuthorStyle(toContainerNode(*it)); + } + if (ListHashSet<Node*, 4>* removedNodes = scopingNodesRemoved()) { + for (ListHashSet<Node*, 4>::iterator it = removedNodes->begin(); it != removedNodes->end(); ++it) + styleResolver->resetAuthorStyle(toContainerNode(*it)); + } + ASSERT(m_treeScope->rootNode() == document()); + styleResolver->resetAuthorStyle(toContainerNode(m_treeScope->rootNode())); styleResolver->appendAuthorStyleSheets(0, activeCSSStyleSheets); } else { ASSERT(styleResolverUpdateType == Additive); @@ -319,7 +292,6 @@ bool StyleSheetCollectionForDocument::updateActiveStyleSheets(DocumentStyleSheet m_scopingNodesForStyleScoped.didRemoveScopingNodes(); m_activeAuthorStyleSheets.swap(activeCSSStyleSheets); m_styleSheetsForStyleSheetList.swap(styleSheets); - updateUsesRemUnits(); return requiresFullStyleRecalc; } diff --git a/chromium/third_party/WebKit/Source/core/dom/StyleSheetCollection.h b/chromium/third_party/WebKit/Source/core/dom/StyleSheetCollection.h index ce410343379..91da7850001 100644 --- a/chromium/third_party/WebKit/Source/core/dom/StyleSheetCollection.h +++ b/chromium/third_party/WebKit/Source/core/dom/StyleSheetCollection.h @@ -52,63 +52,47 @@ class StyleSheetList; class StyleSheetCollection { WTF_MAKE_NONCOPYABLE(StyleSheetCollection); WTF_MAKE_FAST_ALLOCATED; public: + explicit StyleSheetCollection(TreeScope*); + void addStyleSheetCandidateNode(Node*, bool createdByParser); void removeStyleSheetCandidateNode(Node*, ContainerNode* scopingNode); - bool hasStyleSheetCandidateNodes() const { return !m_styleSheetCandidateNodes.isEmpty(); } Vector<RefPtr<CSSStyleSheet> >& activeAuthorStyleSheets() { return m_activeAuthorStyleSheets; } Vector<RefPtr<StyleSheet> >& styleSheetsForStyleSheetList() { return m_styleSheetsForStyleSheetList; } const Vector<RefPtr<CSSStyleSheet> >& activeAuthorStyleSheets() const { return m_activeAuthorStyleSheets; } const Vector<RefPtr<StyleSheet> >& styleSheetsForStyleSheetList() const { return m_styleSheetsForStyleSheetList; } - bool usesRemUnits() const { return m_usesRemUnits; } - DocumentOrderedList& styleSheetCandidateNodes() { return m_styleSheetCandidateNodes; } DocumentOrderedList* scopingNodesForStyleScoped() { return m_scopingNodesForStyleScoped.scopingNodes(); } ListHashSet<Node*, 4>* scopingNodesRemoved() { return m_scopingNodesForStyleScoped.scopingNodesRemoved(); } -protected: - explicit StyleSheetCollection(TreeScope*); - - Document* document() { return m_treeScope->documentScope(); } - enum StyleResolverUpdateType { Reconstruct, Reset, Additive }; - void analyzeStyleSheetChange(StyleResolverUpdateMode, const Vector<RefPtr<CSSStyleSheet> >& oldStyleSheets, const Vector<RefPtr<CSSStyleSheet> >& newStylesheets, StyleResolverUpdateType&, bool& requiresFullStyleRecalc); - void resetAllRuleSetsInTreeScope(StyleResolver*); - void updateUsesRemUnits(); + bool updateActiveStyleSheets(DocumentStyleSheetCollection*, StyleResolverUpdateMode, StyleResolverUpdateType&); private: + Document* document() { return m_treeScope->documentScope(); } + + void collectStyleSheets(DocumentStyleSheetCollection* collections, Vector<RefPtr<StyleSheet> >& styleSheets, Vector<RefPtr<CSSStyleSheet> >& activeSheets); + StyleResolverUpdateType compareStyleSheets(const Vector<RefPtr<CSSStyleSheet> >& oldStyleSheets, const Vector<RefPtr<CSSStyleSheet> >& newStylesheets, Vector<StyleSheetContents*>& addedSheets); bool activeLoadingStyleSheetLoaded(const Vector<RefPtr<CSSStyleSheet> >& newStyleSheets); -protected: + void analyzeStyleSheetChange(StyleResolverUpdateMode, const Vector<RefPtr<CSSStyleSheet> >& oldStyleSheets, const Vector<RefPtr<CSSStyleSheet> >& newStylesheets, StyleResolverUpdateType&, bool& requiresFullStyleRecalc); + Vector<RefPtr<StyleSheet> > m_styleSheetsForStyleSheetList; Vector<RefPtr<CSSStyleSheet> > m_activeAuthorStyleSheets; TreeScope* m_treeScope; bool m_hadActiveLoadingStylesheet; - bool m_usesRemUnits; DocumentOrderedList m_styleSheetCandidateNodes; StyleSheetScopingNodeList m_scopingNodesForStyleScoped; }; -// FIXME: rename this class to DocumentStyleSheetCollection. -class StyleSheetCollectionForDocument FINAL : public StyleSheetCollection { - WTF_MAKE_NONCOPYABLE(StyleSheetCollectionForDocument); WTF_MAKE_FAST_ALLOCATED; -public: - explicit StyleSheetCollectionForDocument(TreeScope*); - - bool updateActiveStyleSheets(DocumentStyleSheetCollection*, StyleResolverUpdateMode); - -private: - void collectStyleSheets(DocumentStyleSheetCollection*, Vector<RefPtr<StyleSheet> >& styleSheets, Vector<RefPtr<CSSStyleSheet> >& activeSheets); -}; - } #endif diff --git a/chromium/third_party/WebKit/Source/core/dom/shadow/ContentDistributor.cpp b/chromium/third_party/WebKit/Source/core/dom/shadow/ContentDistributor.cpp index de321d98914..9bbccdc5711 100644 --- a/chromium/third_party/WebKit/Source/core/dom/shadow/ContentDistributor.cpp +++ b/chromium/third_party/WebKit/Source/core/dom/shadow/ContentDistributor.cpp @@ -33,6 +33,7 @@ #include "core/html/shadow/HTMLContentElement.h" #include "core/html/shadow/HTMLShadowElement.h" + namespace WebCore { void ContentDistribution::swap(ContentDistribution& other) @@ -156,6 +157,8 @@ InsertionPoint* ContentDistributor::findInsertionPointFor(const Node* key) const void ContentDistributor::populate(Node* node, Vector<Node*>& pool) { + node->lazyReattachIfAttached(); + if (!isActiveInsertionPoint(node)) { pool.append(node); return; @@ -224,14 +227,6 @@ void ContentDistributor::distribute(Element* host) if (ElementShadow* shadow = shadowOfParentForDistribution(shadowElement)) shadow->setNeedsDistributionRecalc(); } - - // Detach all nodes that were not distributed and have a renderer. - for (size_t i = 0; i < pool.size(); ++i) { - if (distributed[i]) - continue; - if (pool[i]->renderer()) - pool[i]->lazyReattachIfAttached(); - } } void ContentDistributor::distributeSelectionsTo(InsertionPoint* insertionPoint, const Vector<Node*>& pool, Vector<bool>& distributed) @@ -251,6 +246,7 @@ void ContentDistributor::distributeSelectionsTo(InsertionPoint* insertionPoint, distributed[i] = true; } + insertionPoint->lazyReattachIfAttached(); insertionPoint->setDistribution(distribution); } @@ -258,6 +254,7 @@ void ContentDistributor::distributeNodeChildrenTo(InsertionPoint* insertionPoint { ContentDistribution distribution; for (Node* node = containerNode->firstChild(); node; node = node->nextSibling()) { + node->lazyReattachIfAttached(); if (isActiveInsertionPoint(node)) { InsertionPoint* innerInsertionPoint = toInsertionPoint(node); if (innerInsertionPoint->hasDistribution()) { @@ -277,6 +274,7 @@ void ContentDistributor::distributeNodeChildrenTo(InsertionPoint* insertionPoint } } + insertionPoint->lazyReattachIfAttached(); insertionPoint->setDistribution(distribution); } diff --git a/chromium/third_party/WebKit/Source/core/dom/shadow/InsertionPoint.cpp b/chromium/third_party/WebKit/Source/core/dom/shadow/InsertionPoint.cpp index c00c3c90c01..b4626d77409 100644 --- a/chromium/third_party/WebKit/Source/core/dom/shadow/InsertionPoint.cpp +++ b/chromium/third_party/WebKit/Source/core/dom/shadow/InsertionPoint.cpp @@ -52,48 +52,6 @@ InsertionPoint::~InsertionPoint() { } -void InsertionPoint::setDistribution(ContentDistribution& distribution) -{ - if (shouldUseFallbackElements()) { - for (Node* child = firstChild(); child; child = child->nextSibling()) - child->lazyReattachIfAttached(); - } - - // Attempt not to reattach nodes that would be distributed to the exact same - // location by comparing the old and new distributions. - - size_t i = 0; - size_t j = 0; - - for ( ; i < m_distribution.size() && j < distribution.size(); ++i, ++j) { - if (m_distribution.size() < distribution.size()) { - // If the new distribution is larger than the old one, reattach all nodes in - // the new distribution that were inserted. - for ( ; j < distribution.size() && m_distribution.at(i) != distribution.at(j); ++j) - distribution.at(j)->lazyReattachIfAttached(); - } else if (m_distribution.size() > distribution.size()) { - // If the old distribution is larger than the new one, reattach all nodes in - // the old distribution that were removed. - for ( ; i < m_distribution.size() && m_distribution.at(i) != distribution.at(j); ++i) - m_distribution.at(i)->lazyReattachIfAttached(); - } else if (m_distribution.at(i) != distribution.at(j)) { - // If both distributions are the same length reattach both old and new. - m_distribution.at(i)->lazyReattachIfAttached(); - distribution.at(j)->lazyReattachIfAttached(); - } - } - - // If we hit the end of either list above we need to reattach all remaining nodes. - - for ( ; i < m_distribution.size(); ++i) - m_distribution.at(i)->lazyReattachIfAttached(); - - for ( ; j < distribution.size(); ++j) - distribution.at(j)->lazyReattachIfAttached(); - - m_distribution.swap(distribution); -} - void InsertionPoint::attach(const AttachContext& context) { for (size_t i = 0; i < m_distribution.size(); ++i) { diff --git a/chromium/third_party/WebKit/Source/core/dom/shadow/InsertionPoint.h b/chromium/third_party/WebKit/Source/core/dom/shadow/InsertionPoint.h index b7031292e6f..993ea347969 100644 --- a/chromium/third_party/WebKit/Source/core/dom/shadow/InsertionPoint.h +++ b/chromium/third_party/WebKit/Source/core/dom/shadow/InsertionPoint.h @@ -44,7 +44,7 @@ public: virtual ~InsertionPoint(); bool hasDistribution() const { return !m_distribution.isEmpty(); } - void setDistribution(ContentDistribution&); + void setDistribution(ContentDistribution& distribution) { m_distribution.swap(distribution); } void clearDistribution() { m_distribution.clear(); } bool isActive() const; diff --git a/chromium/third_party/WebKit/Source/core/dom/shadow/ShadowRoot.cpp b/chromium/third_party/WebKit/Source/core/dom/shadow/ShadowRoot.cpp index 1385db124da..a218b17f3a8 100644 --- a/chromium/third_party/WebKit/Source/core/dom/shadow/ShadowRoot.cpp +++ b/chromium/third_party/WebKit/Source/core/dom/shadow/ShadowRoot.cpp @@ -29,7 +29,6 @@ #include "bindings/v8/ExceptionState.h" #include "core/css/resolver/StyleResolver.h" -#include "core/dom/DocumentStyleSheetCollection.h" #include "core/dom/Text.h" #include "core/dom/shadow/ContentDistributor.h" #include "core/dom/shadow/ElementShadow.h" @@ -77,8 +76,6 @@ ShadowRoot::~ShadowRoot() ASSERT(!m_prev); ASSERT(!m_next); - documentInternal()->styleSheetCollection()->didRemoveShadowRoot(this); - // We cannot let ContainerNode destructor call willBeDeletedFrom() // for this ShadowRoot instance because TreeScope destructor // clears Node::m_treeScope thus ContainerNode is no longer able diff --git a/chromium/third_party/WebKit/Source/core/dom/shadow/ShadowRoot.h b/chromium/third_party/WebKit/Source/core/dom/shadow/ShadowRoot.h index 993fdb2efd2..3bfcc3dd49f 100644 --- a/chromium/third_party/WebKit/Source/core/dom/shadow/ShadowRoot.h +++ b/chromium/third_party/WebKit/Source/core/dom/shadow/ShadowRoot.h @@ -149,17 +149,6 @@ inline ShadowRoot* toShadowRoot(Node* node) return const_cast<ShadowRoot*>(toShadowRoot(static_cast<const Node*>(node))); } -inline const ShadowRoot* toShadowRoot(const TreeScope* treeScope) -{ - ASSERT_WITH_SECURITY_IMPLICATION(!treeScope || (treeScope->rootNode() && treeScope->rootNode()->isShadowRoot())); - return static_cast<const ShadowRoot*>(treeScope); -} - -inline ShadowRoot* toShadowRoot(TreeScope* treeScope) -{ - return const_cast<ShadowRoot*>(toShadowRoot(static_cast<const TreeScope*>(treeScope))); -} - } // namespace #endif diff --git a/chromium/third_party/WebKit/Source/core/editing/Editor.cpp b/chromium/third_party/WebKit/Source/core/editing/Editor.cpp index 340f11ad0c7..5931025ea9a 100644 --- a/chromium/third_party/WebKit/Source/core/editing/Editor.cpp +++ b/chromium/third_party/WebKit/Source/core/editing/Editor.cpp @@ -60,10 +60,10 @@ #include "core/editing/VisibleUnits.h" #include "core/editing/htmlediting.h" #include "core/editing/markup.h" -#include "core/fetch/ResourceFetcher.h" #include "core/html/HTMLImageElement.h" #include "core/html/HTMLInputElement.h" #include "core/html/HTMLTextAreaElement.h" +#include "core/loader/cache/ResourceFetcher.h" #include "core/page/EditorClient.h" #include "core/page/EventHandler.h" #include "core/page/FocusController.h" diff --git a/chromium/third_party/WebKit/Source/core/features.gypi b/chromium/third_party/WebKit/Source/core/features.gypi index 40a89de7eb2..3ed82e7f0ef 100644 --- a/chromium/third_party/WebKit/Source/core/features.gypi +++ b/chromium/third_party/WebKit/Source/core/features.gypi @@ -63,6 +63,7 @@ 'ENABLE_MEDIA_CAPTURE=1', 'ENABLE_NOTIFICATIONS=0', 'ENABLE_ORIENTATION_EVENTS=1', + 'ENABLE_PRINTING=0', 'ENABLE_NAVIGATOR_CONTENT_UTILS=0', 'WTF_USE_NATIVE_FULLSCREEN_VIDEO=1', ], @@ -77,6 +78,7 @@ 'ENABLE_NAVIGATOR_CONTENT_UTILS=1', 'ENABLE_NOTIFICATIONS=1', 'ENABLE_ORIENTATION_EVENTS=0', + 'ENABLE_PRINTING=1', 'ENABLE_WEB_AUDIO=1', ], }], diff --git a/chromium/third_party/WebKit/Source/core/history/BackForwardClient.h b/chromium/third_party/WebKit/Source/core/history/BackForwardClient.h index 0a3cf738f91..3bbc8bc4032 100644 --- a/chromium/third_party/WebKit/Source/core/history/BackForwardClient.h +++ b/chromium/third_party/WebKit/Source/core/history/BackForwardClient.h @@ -38,9 +38,17 @@ class BackForwardClient { public: virtual ~BackForwardClient() { } - virtual void didAddItem() = 0; + virtual void addItem(PassRefPtr<HistoryItem>) = 0; + + virtual void goToItem(HistoryItem*) = 0; + + virtual HistoryItem* itemAtIndex(int) = 0; virtual int backListCount() = 0; virtual int forwardListCount() = 0; + + virtual bool isActive() = 0; + + virtual void close() = 0; }; } // namespace WebCore diff --git a/chromium/third_party/WebKit/Source/core/history/BackForwardController.cpp b/chromium/third_party/WebKit/Source/core/history/BackForwardController.cpp index 45fde048b80..5e59897c5bd 100644 --- a/chromium/third_party/WebKit/Source/core/history/BackForwardController.cpp +++ b/chromium/third_party/WebKit/Source/core/history/BackForwardController.cpp @@ -28,9 +28,6 @@ #include "core/history/BackForwardClient.h" #include "core/history/HistoryItem.h" -#include "core/loader/FrameLoader.h" -#include "core/loader/FrameLoaderClient.h" -#include "core/page/Frame.h" #include "core/page/Page.h" namespace WebCore { @@ -51,29 +48,58 @@ PassOwnPtr<BackForwardController> BackForwardController::create(Page* page, Back return adoptPtr(new BackForwardController(page, client)); } -bool BackForwardController::goBackOrForward(int distance) +void BackForwardController::goBackOrForward(int distance) { - ASSERT(distance); - if (distance > forwardCount()) - distance = forwardCount(); - else if (distance < -backCount()) - distance = backCount(); - - if (!distance) - return false; - m_page->mainFrame()->loader()->client()->navigateBackForward(distance); - return true; + if (distance == 0) + return; + + HistoryItem* item = itemAtIndex(distance); + if (!item) { + if (distance > 0) { + if (forwardCount()) + item = itemAtIndex(forwardCount()); + } else { + if (backCount()) + item = itemAtIndex(-backCount()); + } + } + + if (!item) + return; + + m_page->goToItem(item); +} + +bool BackForwardController::goBack() +{ + HistoryItem* item = backItem(); + + if (item) { + m_page->goToItem(item); + return true; + } + return false; +} + +bool BackForwardController::goForward() +{ + HistoryItem* item = forwardItem(); + + if (item) { + m_page->goToItem(item); + return true; + } + return false; } void BackForwardController::addItem(PassRefPtr<HistoryItem> item) { - m_currentItem = item; - m_client->didAddItem(); + m_client->addItem(item); } void BackForwardController::setCurrentItem(HistoryItem* item) { - m_currentItem = item; + m_client->goToItem(item); } int BackForwardController::count() const @@ -91,4 +117,19 @@ int BackForwardController::forwardCount() const return m_client->forwardListCount(); } +HistoryItem* BackForwardController::itemAtIndex(int i) +{ + return m_client->itemAtIndex(i); +} + +bool BackForwardController::isActive() +{ + return m_client->isActive(); +} + +void BackForwardController::close() +{ + m_client->close(); +} + } // namespace WebCore diff --git a/chromium/third_party/WebKit/Source/core/history/BackForwardController.h b/chromium/third_party/WebKit/Source/core/history/BackForwardController.h index 79c48a02a5a..d315fd6dfaa 100644 --- a/chromium/third_party/WebKit/Source/core/history/BackForwardController.h +++ b/chromium/third_party/WebKit/Source/core/history/BackForwardController.h @@ -46,26 +46,33 @@ public: BackForwardClient* client() const { return m_client; } - bool goBackOrForward(int distance); - bool goBack() { return goBackOrForward(-1); } - bool goForward() { return goBackOrForward(1); } + void goBackOrForward(int distance); + + bool goBack(); + bool goForward(); void addItem(PassRefPtr<HistoryItem>); void setCurrentItem(HistoryItem*); - HistoryItem* currentItem() { return m_currentItem.get(); } int count() const; int backCount() const; int forwardCount() const; + HistoryItem* itemAtIndex(int); + + bool isActive(); + + void close(); + + HistoryItem* backItem() { return itemAtIndex(-1); } + HistoryItem* currentItem() { return itemAtIndex(0); } + HistoryItem* forwardItem() { return itemAtIndex(1); } + private: BackForwardController(Page*, BackForwardClient*); Page* m_page; BackForwardClient* m_client; - - // FIXME: Ideally, we could derive this from HistoryController, but the rules for setting it are non-obvious. - RefPtr<HistoryItem> m_currentItem; }; } // namespace WebCore diff --git a/chromium/third_party/WebKit/Source/core/history/HistoryItem.cpp b/chromium/third_party/WebKit/Source/core/history/HistoryItem.cpp index 4db012dd42e..1a2c317a1d5 100644 --- a/chromium/third_party/WebKit/Source/core/history/HistoryItem.cpp +++ b/chromium/third_party/WebKit/Source/core/history/HistoryItem.cpp @@ -53,6 +53,18 @@ HistoryItem::HistoryItem() { } +HistoryItem::HistoryItem(const String& urlString) + : m_urlString(urlString) + , m_originalURLString(urlString) + , m_lastVisitedTime(0) + , m_pageScaleFactor(0) + , m_isTargetItem(false) + , m_visitCount(0) + , m_itemSequenceNumber(generateSequenceNumber()) + , m_documentSequenceNumber(generateSequenceNumber()) +{ +} + HistoryItem::~HistoryItem() { } diff --git a/chromium/third_party/WebKit/Source/core/history/HistoryItem.h b/chromium/third_party/WebKit/Source/core/history/HistoryItem.h index 8ac78ab71be..5b7119c6c7a 100644 --- a/chromium/third_party/WebKit/Source/core/history/HistoryItem.h +++ b/chromium/third_party/WebKit/Source/core/history/HistoryItem.h @@ -46,6 +46,10 @@ typedef Vector<RefPtr<HistoryItem> > HistoryItemVector; class HistoryItem : public RefCounted<HistoryItem> { public: static PassRefPtr<HistoryItem> create() { return adoptRef(new HistoryItem); } + static PassRefPtr<HistoryItem> create(const String& urlString) + { + return adoptRef(new HistoryItem(urlString)); + } ~HistoryItem(); @@ -132,6 +136,8 @@ public: private: HistoryItem(); + explicit HistoryItem(const String& urlString); + explicit HistoryItem(const HistoryItem&); void recordVisitAtTime(double); diff --git a/chromium/third_party/WebKit/Source/core/html/BaseMultipleFieldsDateAndTimeInputType.cpp b/chromium/third_party/WebKit/Source/core/html/BaseMultipleFieldsDateAndTimeInputType.cpp index 1c3a2a0ac8c..8ea2d94ce4e 100644 --- a/chromium/third_party/WebKit/Source/core/html/BaseMultipleFieldsDateAndTimeInputType.cpp +++ b/chromium/third_party/WebKit/Source/core/html/BaseMultipleFieldsDateAndTimeInputType.cpp @@ -130,22 +130,22 @@ bool DateTimeFormatValidator::validateFormat(const String& format, const BaseMul DateTimeEditElement* BaseMultipleFieldsDateAndTimeInputType::dateTimeEditElement() const { - return toDateTimeEditElement(element()->userAgentShadowRoot()->getElementById(ShadowElementNames::dateTimeEdit())); + return toDateTimeEditElement(element()->uaShadowElementById(ShadowElementNames::dateTimeEdit())); } SpinButtonElement* BaseMultipleFieldsDateAndTimeInputType::spinButtonElement() const { - return toSpinButtonElement(element()->userAgentShadowRoot()->getElementById(ShadowElementNames::spinButton())); + return toSpinButtonElement(element()->uaShadowElementById(ShadowElementNames::spinButton())); } ClearButtonElement* BaseMultipleFieldsDateAndTimeInputType::clearButtonElement() const { - return toClearButtonElement(element()->userAgentShadowRoot()->getElementById(ShadowElementNames::clearButton())); + return toClearButtonElement(element()->uaShadowElementById(ShadowElementNames::clearButton())); } PickerIndicatorElement* BaseMultipleFieldsDateAndTimeInputType::pickerIndicatorElement() const { - return toPickerIndicatorElement(element()->userAgentShadowRoot()->getElementById(ShadowElementNames::pickerIndicator())); + return toPickerIndicatorElement(element()->uaShadowElementById(ShadowElementNames::pickerIndicator())); } inline bool BaseMultipleFieldsDateAndTimeInputType::containsFocusedShadowElement() const diff --git a/chromium/third_party/WebKit/Source/core/html/DOMURL.cpp b/chromium/third_party/WebKit/Source/core/html/DOMURL.cpp index a7b7f7175cb..360cc2ff526 100644 --- a/chromium/third_party/WebKit/Source/core/html/DOMURL.cpp +++ b/chromium/third_party/WebKit/Source/core/html/DOMURL.cpp @@ -29,10 +29,10 @@ #include "core/html/DOMURL.h" #include "core/dom/ScriptExecutionContext.h" -#include "core/fetch/MemoryCache.h" #include "core/fileapi/Blob.h" #include "core/fileapi/BlobURL.h" #include "core/html/PublicURLManager.h" +#include "core/loader/cache/MemoryCache.h" #include "weborigin/KURL.h" #include "wtf/MainThread.h" diff --git a/chromium/third_party/WebKit/Source/core/html/FormAssociatedElement.cpp b/chromium/third_party/WebKit/Source/core/html/FormAssociatedElement.cpp index 58f6654ae4c..a31e058e88b 100644 --- a/chromium/third_party/WebKit/Source/core/html/FormAssociatedElement.cpp +++ b/chromium/third_party/WebKit/Source/core/html/FormAssociatedElement.cpp @@ -75,9 +75,6 @@ void FormAssociatedElement::didMoveToNewDocument(Document* oldDocument) void FormAssociatedElement::insertedInto(ContainerNode* insertionPoint) { - if (m_form && insertionPoint->highestAncestor() != m_form->highestAncestor()) - setForm(0); - resetFormOwner(); if (!insertionPoint->inDocument()) return; diff --git a/chromium/third_party/WebKit/Source/core/html/HTMLCollection.cpp b/chromium/third_party/WebKit/Source/core/html/HTMLCollection.cpp index f4d175a0bde..613c57a069b 100644 --- a/chromium/third_party/WebKit/Source/core/html/HTMLCollection.cpp +++ b/chromium/third_party/WebKit/Source/core/html/HTMLCollection.cpp @@ -211,7 +211,7 @@ template <> inline bool isMatchingElement(const HTMLCollection* htmlCollection, case MapAreas: return element->hasLocalName(areaTag); case DocApplets: - return element->hasLocalName(appletTag) || (element->hasLocalName(objectTag) && toHTMLObjectElement(element)->containsJavaApplet()); + return element->hasLocalName(appletTag) || (element->hasLocalName(objectTag) && static_cast<HTMLObjectElement*>(element)->containsJavaApplet()); case DocEmbeds: return element->hasLocalName(embedTag); case DocLinks: diff --git a/chromium/third_party/WebKit/Source/core/html/HTMLDocument.h b/chromium/third_party/WebKit/Source/core/html/HTMLDocument.h index 927fdca66d8..993fbc0cb36 100644 --- a/chromium/third_party/WebKit/Source/core/html/HTMLDocument.h +++ b/chromium/third_party/WebKit/Source/core/html/HTMLDocument.h @@ -24,7 +24,7 @@ #define HTMLDocument_h #include "core/dom/Document.h" -#include "core/fetch/ResourceClient.h" +#include "core/loader/cache/ResourceClient.h" #include "wtf/HashCountedSet.h" namespace WebCore { diff --git a/chromium/third_party/WebKit/Source/core/html/HTMLElement.cpp b/chromium/third_party/WebKit/Source/core/html/HTMLElement.cpp index 4e19dd02b72..6692228f53d 100644 --- a/chromium/third_party/WebKit/Source/core/html/HTMLElement.cpp +++ b/chromium/third_party/WebKit/Source/core/html/HTMLElement.cpp @@ -1080,11 +1080,6 @@ void HTMLElement::handleKeypressEvent(KeyboardEvent* event) { if (!document()->settings() || !document()->settings()->spatialNavigationEnabled() || !supportsFocus()) return; - // if the element is a text form control (like <input type=text> or <textarea>) - // or has contentEditable attribute on, we should enter a space or newline - // even in spatial navigation mode instead of handling it as a "click" action. - if (isTextFormControl() || isContentEditable()) - return; int charCode = event->charCode(); if (charCode == '\r' || charCode == ' ') { dispatchSimulatedClick(event); diff --git a/chromium/third_party/WebKit/Source/core/html/HTMLEmbedElement.cpp b/chromium/third_party/WebKit/Source/core/html/HTMLEmbedElement.cpp index a04335ce91b..e0c1e7e4a39 100644 --- a/chromium/third_party/WebKit/Source/core/html/HTMLEmbedElement.cpp +++ b/chromium/third_party/WebKit/Source/core/html/HTMLEmbedElement.cpp @@ -183,7 +183,7 @@ bool HTMLEmbedElement::rendererIsNeeded(const NodeRenderingContext& context) ContainerNode* p = parentNode(); if (p && p->hasTagName(objectTag)) { ASSERT(p->renderer()); - if (!toHTMLObjectElement(p)->useFallbackContent()) { + if (!static_cast<HTMLObjectElement*>(p)->useFallbackContent()) { ASSERT(!p->renderer()->isEmbeddedObject()); return false; } diff --git a/chromium/third_party/WebKit/Source/core/html/HTMLFieldSetElement.cpp b/chromium/third_party/WebKit/Source/core/html/HTMLFieldSetElement.cpp index d9ceedd819f..b3f3e9c8fc6 100644 --- a/chromium/third_party/WebKit/Source/core/html/HTMLFieldSetElement.cpp +++ b/chromium/third_party/WebKit/Source/core/html/HTMLFieldSetElement.cpp @@ -116,7 +116,7 @@ void HTMLFieldSetElement::refreshElementsIfNeeded() const for (Element* element = ElementTraversal::firstWithin(this); element; element = ElementTraversal::next(element, this)) { if (element->hasTagName(objectTag)) { - m_associatedElements.append(toHTMLObjectElement(element)); + m_associatedElements.append(static_cast<HTMLObjectElement*>(element)); continue; } diff --git a/chromium/third_party/WebKit/Source/core/html/HTMLImageElement.cpp b/chromium/third_party/WebKit/Source/core/html/HTMLImageElement.cpp index 2f54b1083fc..571462bafbd 100644 --- a/chromium/third_party/WebKit/Source/core/html/HTMLImageElement.cpp +++ b/chromium/third_party/WebKit/Source/core/html/HTMLImageElement.cpp @@ -28,9 +28,9 @@ #include "bindings/v8/ScriptEventListener.h" #include "core/dom/Attribute.h" #include "core/dom/EventNames.h" -#include "core/fetch/ImageResource.h" #include "core/html/HTMLFormElement.h" #include "core/html/parser/HTMLParserIdioms.h" +#include "core/loader/cache/ImageResource.h" #include "core/rendering/RenderImage.h" using namespace std; @@ -179,11 +179,6 @@ void HTMLImageElement::attach(const AttachContext& context) Node::InsertionNotificationRequest HTMLImageElement::insertedInto(ContainerNode* insertionPoint) { // m_form can be non-null if it was set in constructor. - if (m_form && insertionPoint->highestAncestor() != m_form->highestAncestor()) { - m_form->removeImgElement(this); - m_form = 0; - } - if (!m_form) { m_form = findFormAncestor(); if (m_form) diff --git a/chromium/third_party/WebKit/Source/core/html/HTMLImageLoader.cpp b/chromium/third_party/WebKit/Source/core/html/HTMLImageLoader.cpp index f4954f7ab64..6b966acb800 100644 --- a/chromium/third_party/WebKit/Source/core/html/HTMLImageLoader.cpp +++ b/chromium/third_party/WebKit/Source/core/html/HTMLImageLoader.cpp @@ -26,10 +26,10 @@ #include "core/dom/Element.h" #include "core/dom/Event.h" #include "core/dom/EventNames.h" -#include "core/fetch/ImageResource.h" #include "core/html/HTMLObjectElement.h" #include "core/html/HTMLVideoElement.h" #include "core/html/parser/HTMLParserIdioms.h" +#include "core/loader/cache/ImageResource.h" namespace WebCore { @@ -69,7 +69,7 @@ void HTMLImageLoader::notifyFinished(Resource*) bool loadError = cachedImage->errorOccurred() || cachedImage->response().httpStatusCode() >= 400; if (loadError && element->hasTagName(HTMLNames::objectTag)) - toHTMLObjectElement(element.get())->renderFallbackContent(); + static_cast<HTMLObjectElement*>(element.get())->renderFallbackContent(); } } diff --git a/chromium/third_party/WebKit/Source/core/html/HTMLImportLoader.cpp b/chromium/third_party/WebKit/Source/core/html/HTMLImportLoader.cpp index 7cfbd2924ea..ef2d766d7ee 100644 --- a/chromium/third_party/WebKit/Source/core/html/HTMLImportLoader.cpp +++ b/chromium/third_party/WebKit/Source/core/html/HTMLImportLoader.cpp @@ -32,19 +32,21 @@ #include "core/html/HTMLImportLoader.h" #include "core/dom/Document.h" -#include "core/fetch/ResourceFetcher.h" #include "core/html/HTMLDocument.h" #include "core/html/HTMLImportLoaderClient.h" #include "core/loader/DocumentWriter.h" +#include "core/loader/cache/ResourceFetcher.h" #include "core/page/ContentSecurityPolicyResponseHeaders.h" namespace WebCore { -HTMLImportLoader::HTMLImportLoader(HTMLImport* parent, const KURL& url) +HTMLImportLoader::HTMLImportLoader(HTMLImport* parent, const KURL& url, const ResourcePtr<RawResource>& resource) : m_parent(parent) , m_state(StateLoading) + , m_resource(resource) , m_url(url) { + m_resource->addClient(this); } HTMLImportLoader::~HTMLImportLoader() @@ -56,12 +58,6 @@ HTMLImportLoader::~HTMLImportLoader() m_resource->removeClient(this); } -void HTMLImportLoader::setResource(const ResourcePtr<RawResource>& resource) -{ - m_resource = resource; - m_resource->addClient(this); -} - void HTMLImportLoader::responseReceived(Resource*, const ResourceResponse& response) { setState(startWritingAndParsing(response)); diff --git a/chromium/third_party/WebKit/Source/core/html/HTMLImportLoader.h b/chromium/third_party/WebKit/Source/core/html/HTMLImportLoader.h index 5406049ac84..4b9b3996b2f 100644 --- a/chromium/third_party/WebKit/Source/core/html/HTMLImportLoader.h +++ b/chromium/third_party/WebKit/Source/core/html/HTMLImportLoader.h @@ -31,9 +31,9 @@ #ifndef HTMLImportLoader_h #define HTMLImportLoader_h -#include "core/fetch/RawResource.h" -#include "core/fetch/ResourcePtr.h" #include "core/html/HTMLImport.h" +#include "core/loader/cache/RawResource.h" +#include "core/loader/cache/ResourcePtr.h" #include "weborigin/KURL.h" #include "wtf/RefCounted.h" #include "wtf/Vector.h" @@ -52,13 +52,12 @@ public: StateReady }; - HTMLImportLoader(HTMLImport*, const KURL&); + HTMLImportLoader(HTMLImport*, const KURL&, const ResourcePtr<RawResource>&); virtual ~HTMLImportLoader(); Document* importedDocument() const; const KURL& url() const { return m_url; } - void setResource(const ResourcePtr<RawResource>&); void addClient(HTMLImportLoaderClient*); void removeClient(HTMLImportLoaderClient*); void importDestroyed(); diff --git a/chromium/third_party/WebKit/Source/core/html/HTMLImportsController.cpp b/chromium/third_party/WebKit/Source/core/html/HTMLImportsController.cpp index 9ebaa5c4637..cb2107ab860 100644 --- a/chromium/third_party/WebKit/Source/core/html/HTMLImportsController.cpp +++ b/chromium/third_party/WebKit/Source/core/html/HTMLImportsController.cpp @@ -32,9 +32,9 @@ #include "core/html/HTMLImportsController.h" #include "core/dom/Document.h" -#include "core/fetch/ResourceFetcher.h" #include "core/html/HTMLImportLoader.h" #include "core/html/HTMLImportLoaderClient.h" +#include "core/loader/cache/ResourceFetcher.h" namespace WebCore { @@ -78,14 +78,9 @@ PassRefPtr<HTMLImportLoader> HTMLImportsController::createLoader(HTMLImport* par if (!resource) return 0; - RefPtr<HTMLImportLoader> loader = adoptRef(new HTMLImportLoader(parent, request.url())); + RefPtr<HTMLImportLoader> loader = adoptRef(new HTMLImportLoader(parent, request.url(), resource)); parent->appendChild(loader.get()); m_imports.append(loader); - - // We set resource after the import tree is built since - // Resource::addClient() immediately calls back to feed the bytes when the resource is cached. - loader->setResource(resource); - return loader.release(); } diff --git a/chromium/third_party/WebKit/Source/core/html/HTMLImportsController.h b/chromium/third_party/WebKit/Source/core/html/HTMLImportsController.h index 0a06c4ef1fb..b106d8ac358 100644 --- a/chromium/third_party/WebKit/Source/core/html/HTMLImportsController.h +++ b/chromium/third_party/WebKit/Source/core/html/HTMLImportsController.h @@ -31,9 +31,9 @@ #ifndef HTMLImportsController_h #define HTMLImportsController_h -#include "core/fetch/RawResource.h" #include "core/html/HTMLImport.h" #include "core/html/LinkResource.h" +#include "core/loader/cache/RawResource.h" #include "core/platform/Supplementable.h" #include "core/platform/Timer.h" #include "wtf/FastAllocBase.h" diff --git a/chromium/third_party/WebKit/Source/core/html/HTMLLinkElement.cpp b/chromium/third_party/WebKit/Source/core/html/HTMLLinkElement.cpp index abc47635a06..cf9220a68c4 100644 --- a/chromium/third_party/WebKit/Source/core/html/HTMLLinkElement.cpp +++ b/chromium/third_party/WebKit/Source/core/html/HTMLLinkElement.cpp @@ -37,12 +37,12 @@ #include "core/dom/DocumentStyleSheetCollection.h" #include "core/dom/Event.h" #include "core/dom/EventSender.h" -#include "core/fetch/CSSStyleSheetResource.h" -#include "core/fetch/FetchRequest.h" -#include "core/fetch/ResourceFetcher.h" #include "core/html/LinkImport.h" #include "core/loader/FrameLoader.h" #include "core/loader/FrameLoaderClient.h" +#include "core/loader/cache/CSSStyleSheetResource.h" +#include "core/loader/cache/FetchRequest.h" +#include "core/loader/cache/ResourceFetcher.h" #include "core/page/ContentSecurityPolicy.h" #include "core/page/Frame.h" #include "core/page/FrameView.h" @@ -507,8 +507,6 @@ void LinkStyle::removePendingSheet(RemovePendingSheetNotificationType notificati if (type == None) return; if (type == NonBlocking) { - // Tell StyleSheetCollections to re-compute styleSheets of this m_owner's treescope. - m_owner->document()->styleSheetCollection()->modifiedStyleSheetCandidateNode(m_owner); // Document::removePendingSheet() triggers the style selector recalc for blocking sheets. // FIXME: We don't have enough knowledge at this point to know if we're adding or removing a sheet // so we can't call addedStyleSheet() or removedStyleSheet(). @@ -516,7 +514,7 @@ void LinkStyle::removePendingSheet(RemovePendingSheetNotificationType notificati return; } - m_owner->document()->styleSheetCollection()->removePendingSheet(m_owner, + m_owner->document()->styleSheetCollection()->removePendingSheet( notification == RemovePendingSheetNotifyImmediately ? DocumentStyleSheetCollection::RemovePendingSheetNotifyImmediately : DocumentStyleSheetCollection::RemovePendingSheetNotifyLater); diff --git a/chromium/third_party/WebKit/Source/core/html/HTMLLinkElement.h b/chromium/third_party/WebKit/Source/core/html/HTMLLinkElement.h index 213a40d8c63..9d10b261a86 100644 --- a/chromium/third_party/WebKit/Source/core/html/HTMLLinkElement.h +++ b/chromium/third_party/WebKit/Source/core/html/HTMLLinkElement.h @@ -26,14 +26,14 @@ #include "core/css/CSSStyleSheet.h" #include "core/dom/IconURL.h" -#include "core/fetch/ResourcePtr.h" -#include "core/fetch/StyleSheetResourceClient.h" #include "core/html/DOMSettableTokenList.h" #include "core/html/HTMLElement.h" #include "core/html/LinkRelAttribute.h" #include "core/html/LinkResource.h" #include "core/loader/LinkLoader.h" #include "core/loader/LinkLoaderClient.h" +#include "core/loader/cache/ResourcePtr.h" +#include "core/loader/cache/StyleSheetResourceClient.h" namespace WebCore { diff --git a/chromium/third_party/WebKit/Source/core/html/HTMLNameCollection.cpp b/chromium/third_party/WebKit/Source/core/html/HTMLNameCollection.cpp index f4e5065cfaa..6e637b21300 100644 --- a/chromium/third_party/WebKit/Source/core/html/HTMLNameCollection.cpp +++ b/chromium/third_party/WebKit/Source/core/html/HTMLNameCollection.cpp @@ -87,7 +87,7 @@ Element* HTMLNameCollection::virtualItemAfter(unsigned& offsetInArray, Element* return current; } else if (current->hasTagName(objectTag)) { if ((current->getNameAttribute() == m_name || current->getIdAttribute() == m_name) - && toHTMLObjectElement(current)->isDocNamedItem()) + && static_cast<HTMLObjectElement*>(current)->isDocNamedItem()) return current; } else if (current->hasTagName(imgTag)) { if (current->getNameAttribute() == m_name || (current->getIdAttribute() == m_name && current->hasName())) diff --git a/chromium/third_party/WebKit/Source/core/html/HTMLObjectElement.cpp b/chromium/third_party/WebKit/Source/core/html/HTMLObjectElement.cpp index 3abb23644af..0dd38fd488b 100644 --- a/chromium/third_party/WebKit/Source/core/html/HTMLObjectElement.cpp +++ b/chromium/third_party/WebKit/Source/core/html/HTMLObjectElement.cpp @@ -31,13 +31,13 @@ #include "core/dom/NodeList.h" #include "core/dom/NodeTraversal.h" #include "core/dom/Text.h" -#include "core/fetch/ImageResource.h" #include "core/html/FormDataList.h" #include "core/html/HTMLDocument.h" #include "core/html/HTMLImageLoader.h" #include "core/html/HTMLMetaElement.h" #include "core/html/HTMLParamElement.h" #include "core/html/parser/HTMLParserIdioms.h" +#include "core/loader/cache/ImageResource.h" #include "core/page/Frame.h" #include "core/page/Page.h" #include "core/page/Settings.h" @@ -450,7 +450,8 @@ bool HTMLObjectElement::containsJavaApplet() const && equalIgnoringCase(child->getNameAttribute(), "type") && MIMETypeRegistry::isJavaAppletMIMEType(child->getAttribute(valueAttr).string())) return true; - if (child->hasTagName(objectTag) && toHTMLObjectElement(child)->containsJavaApplet()) + if (child->hasTagName(objectTag) + && static_cast<HTMLObjectElement*>(child)->containsJavaApplet()) return true; if (child->hasTagName(appletTag)) return true; diff --git a/chromium/third_party/WebKit/Source/core/html/HTMLObjectElement.h b/chromium/third_party/WebKit/Source/core/html/HTMLObjectElement.h index 09de9171cd0..5b8d1d2bb40 100644 --- a/chromium/third_party/WebKit/Source/core/html/HTMLObjectElement.h +++ b/chromium/third_party/WebKit/Source/core/html/HTMLObjectElement.h @@ -109,12 +109,6 @@ private: bool m_useFallbackContent : 1; }; -inline HTMLObjectElement* toHTMLObjectElement(Node* node) -{ - ASSERT_WITH_SECURITY_IMPLICATION(!node || node->hasTagName(HTMLNames::objectTag)); - return static_cast<HTMLObjectElement*>(node); -} - } #endif diff --git a/chromium/third_party/WebKit/Source/core/html/ImageDocument.cpp b/chromium/third_party/WebKit/Source/core/html/ImageDocument.cpp index 5015382d88b..64a0dc19c21 100644 --- a/chromium/third_party/WebKit/Source/core/html/ImageDocument.cpp +++ b/chromium/third_party/WebKit/Source/core/html/ImageDocument.cpp @@ -31,7 +31,6 @@ #include "core/dom/EventNames.h" #include "core/dom/MouseEvent.h" #include "core/dom/RawDataDocumentParser.h" -#include "core/fetch/ImageResource.h" #include "core/html/HTMLBodyElement.h" #include "core/html/HTMLHeadElement.h" #include "core/html/HTMLHtmlElement.h" @@ -40,6 +39,7 @@ #include "core/loader/DocumentLoader.h" #include "core/loader/FrameLoader.h" #include "core/loader/FrameLoaderClient.h" +#include "core/loader/cache/ImageResource.h" #include "core/page/Frame.h" #include "core/page/FrameView.h" #include "core/page/Page.h" diff --git a/chromium/third_party/WebKit/Source/core/html/ImageInputType.cpp b/chromium/third_party/WebKit/Source/core/html/ImageInputType.cpp index 85b049e6f3e..2ad3d907af8 100644 --- a/chromium/third_party/WebKit/Source/core/html/ImageInputType.cpp +++ b/chromium/third_party/WebKit/Source/core/html/ImageInputType.cpp @@ -25,13 +25,13 @@ #include "HTMLNames.h" #include "core/dom/MouseEvent.h" -#include "core/fetch/ImageResource.h" #include "core/html/FormDataList.h" #include "core/html/HTMLFormElement.h" #include "core/html/HTMLImageLoader.h" #include "core/html/HTMLInputElement.h" #include "core/html/InputTypeNames.h" #include "core/html/parser/HTMLParserIdioms.h" +#include "core/loader/cache/ImageResource.h" #include "core/rendering/RenderImage.h" #include "wtf/PassOwnPtr.h" diff --git a/chromium/third_party/WebKit/Source/core/html/LinkResource.h b/chromium/third_party/WebKit/Source/core/html/LinkResource.h index b4eeb3d44ad..8c6c84e0fda 100644 --- a/chromium/third_party/WebKit/Source/core/html/LinkResource.h +++ b/chromium/third_party/WebKit/Source/core/html/LinkResource.h @@ -31,7 +31,7 @@ #ifndef LinkResource_h #define LinkResource_h -#include "core/fetch/FetchRequest.h" +#include "core/loader/cache/FetchRequest.h" #include "weborigin/KURL.h" #include "wtf/RefCounted.h" #include "wtf/text/WTFString.h" diff --git a/chromium/third_party/WebKit/Source/core/html/RadioNodeList.cpp b/chromium/third_party/WebKit/Source/core/html/RadioNodeList.cpp index 0522f12ec50..5768dcf135e 100644 --- a/chromium/third_party/WebKit/Source/core/html/RadioNodeList.cpp +++ b/chromium/third_party/WebKit/Source/core/html/RadioNodeList.cpp @@ -90,7 +90,7 @@ bool RadioNodeList::checkElementMatchesRadioNodeListFilter(Element* testElement) if (ownerNode()->hasTagName(formTag)) { HTMLFormElement* formElement = 0; if (testElement->hasTagName(objectTag)) - formElement = toHTMLObjectElement(testElement)->form(); + formElement = static_cast<HTMLObjectElement*>(testElement)->form(); else formElement = toHTMLFormControlElement(testElement)->form(); if (!formElement || formElement != ownerNode()) diff --git a/chromium/third_party/WebKit/Source/core/html/SearchInputType.cpp b/chromium/third_party/WebKit/Source/core/html/SearchInputType.cpp index b68d9a486a6..3982770bd93 100644 --- a/chromium/third_party/WebKit/Source/core/html/SearchInputType.cpp +++ b/chromium/third_party/WebKit/Source/core/html/SearchInputType.cpp @@ -34,7 +34,6 @@ #include "HTMLNames.h" #include "bindings/v8/ExceptionStatePlaceholder.h" #include "core/dom/KeyboardEvent.h" -#include "core/dom/shadow/ShadowRoot.h" #include "core/html/HTMLInputElement.h" #include "core/html/InputTypeNames.h" #include "core/html/shadow/ShadowElementNames.h" @@ -151,7 +150,7 @@ bool SearchInputType::searchEventsShouldBeDispatched() const void SearchInputType::didSetValueByUserEdit(ValueChangeState state) { - if (element()->userAgentShadowRoot()->getElementById(ShadowElementNames::clearButton())) + if (element()->uaShadowElementById(ShadowElementNames::clearButton())) toRenderSearchField(element()->renderer())->updateCancelButtonVisibility(); // If the incremental attribute is set, then dispatch the search event diff --git a/chromium/third_party/WebKit/Source/core/html/canvas/CanvasRenderingContext.cpp b/chromium/third_party/WebKit/Source/core/html/canvas/CanvasRenderingContext.cpp index 4f362bcda9f..71580c98a9f 100644 --- a/chromium/third_party/WebKit/Source/core/html/canvas/CanvasRenderingContext.cpp +++ b/chromium/third_party/WebKit/Source/core/html/canvas/CanvasRenderingContext.cpp @@ -26,11 +26,11 @@ #include "config.h" #include "core/html/canvas/CanvasRenderingContext.h" -#include "core/fetch/ImageResource.h" #include "core/html/HTMLCanvasElement.h" #include "core/html/HTMLImageElement.h" #include "core/html/HTMLVideoElement.h" #include "core/html/canvas/CanvasPattern.h" +#include "core/loader/cache/ImageResource.h" #include "weborigin/SecurityOrigin.h" namespace WebCore { diff --git a/chromium/third_party/WebKit/Source/core/html/canvas/CanvasRenderingContext2D.cpp b/chromium/third_party/WebKit/Source/core/html/canvas/CanvasRenderingContext2D.cpp index 176cb57349a..feff097a1ff 100644 --- a/chromium/third_party/WebKit/Source/core/html/canvas/CanvasRenderingContext2D.cpp +++ b/chromium/third_party/WebKit/Source/core/html/canvas/CanvasRenderingContext2D.cpp @@ -42,7 +42,6 @@ #include "core/css/StylePropertySet.h" #include "core/css/resolver/StyleResolver.h" #include "core/dom/ExceptionCode.h" -#include "core/fetch/ImageResource.h" #include "core/html/HTMLCanvasElement.h" #include "core/html/HTMLImageElement.h" #include "core/html/HTMLMediaElement.h" @@ -54,6 +53,7 @@ #include "core/html/canvas/CanvasPattern.h" #include "core/html/canvas/CanvasStyle.h" #include "core/html/canvas/DOMPath.h" +#include "core/loader/cache/ImageResource.h" #include "core/page/ImageBitmap.h" #include "core/platform/graphics/DrawLooper.h" #include "core/platform/graphics/FloatQuad.h" diff --git a/chromium/third_party/WebKit/Source/core/html/canvas/WebGLRenderingContext.cpp b/chromium/third_party/WebKit/Source/core/html/canvas/WebGLRenderingContext.cpp index 6eaec39cd93..01e667d5559 100644 --- a/chromium/third_party/WebKit/Source/core/html/canvas/WebGLRenderingContext.cpp +++ b/chromium/third_party/WebKit/Source/core/html/canvas/WebGLRenderingContext.cpp @@ -29,7 +29,6 @@ #include "RuntimeEnabledFeatures.h" #include "bindings/v8/ExceptionState.h" #include "core/dom/ExceptionCode.h" -#include "core/fetch/ImageResource.h" #include "core/html/HTMLCanvasElement.h" #include "core/html/HTMLImageElement.h" #include "core/html/HTMLVideoElement.h" @@ -67,6 +66,7 @@ #include "core/inspector/InspectorInstrumentation.h" #include "core/loader/FrameLoader.h" #include "core/loader/FrameLoaderClient.h" +#include "core/loader/cache/ImageResource.h" #include "core/page/Frame.h" #include "core/page/Page.h" #include "core/page/Settings.h" @@ -553,8 +553,6 @@ WebGLRenderingContext::WebGLRenderingContext(HTMLCanvasElement* passedCanvas, Pa , m_numGLErrorsToConsoleAllowed(maxGLErrorsAllowedToConsole) , m_multisamplingAllowed(false) , m_multisamplingObserverRegistered(false) - , m_onePlusMaxEnabledAttribIndex(0) - , m_onePlusMaxNonDefaultTextureUnit(0) { ASSERT(m_context); ScriptWrappable::init(this); @@ -578,31 +576,32 @@ WebGLRenderingContext::WebGLRenderingContext(HTMLCanvasElement* passedCanvas, Pa } // Register extensions. + static const char* unprefixed[] = { "", 0, }; static const char* webkitPrefix[] = { "WEBKIT_", 0, }; static const char* bothPrefixes[] = { "", "WEBKIT_", 0, }; - registerExtension<ANGLEInstancedArrays>(m_angleInstancedArrays); - registerExtension<EXTTextureFilterAnisotropic>(m_extTextureFilterAnisotropic, PrefixedExtension, webkitPrefix); - registerExtension<OESElementIndexUint>(m_oesElementIndexUint); - registerExtension<OESStandardDerivatives>(m_oesStandardDerivatives); - registerExtension<OESTextureFloat>(m_oesTextureFloat); - registerExtension<OESTextureFloatLinear>(m_oesTextureFloatLinear); - registerExtension<OESTextureHalfFloat>(m_oesTextureHalfFloat); - registerExtension<OESTextureHalfFloatLinear>(m_oesTextureHalfFloatLinear); - registerExtension<OESVertexArrayObject>(m_oesVertexArrayObject); - registerExtension<WebGLCompressedTextureATC>(m_webglCompressedTextureATC, PrefixedExtension, webkitPrefix); - registerExtension<WebGLCompressedTexturePVRTC>(m_webglCompressedTexturePVRTC, PrefixedExtension, webkitPrefix); - registerExtension<WebGLCompressedTextureS3TC>(m_webglCompressedTextureS3TC, PrefixedExtension, bothPrefixes); - registerExtension<WebGLDepthTexture>(m_webglDepthTexture, PrefixedExtension, bothPrefixes); - registerExtension<WebGLLoseContext>(m_webglLoseContext, ApprovedExtension, bothPrefixes); + registerExtension<EXTTextureFilterAnisotropic>(m_extTextureFilterAnisotropic, false, false, true, webkitPrefix); + registerExtension<OESElementIndexUint>(m_oesElementIndexUint, false, false, false, unprefixed); + registerExtension<OESStandardDerivatives>(m_oesStandardDerivatives, false, false, false, unprefixed); + registerExtension<OESTextureFloat>(m_oesTextureFloat, false, false, false, unprefixed); + registerExtension<OESTextureFloatLinear>(m_oesTextureFloatLinear, false, false, false, unprefixed); + registerExtension<OESTextureHalfFloat>(m_oesTextureHalfFloat, false, false, false, unprefixed); + registerExtension<OESTextureHalfFloatLinear>(m_oesTextureHalfFloatLinear, false, false, false, unprefixed); + registerExtension<OESVertexArrayObject>(m_oesVertexArrayObject, false, false, false, unprefixed); + registerExtension<WebGLCompressedTextureATC>(m_webglCompressedTextureATC, false, false, true, webkitPrefix); + registerExtension<WebGLCompressedTexturePVRTC>(m_webglCompressedTexturePVRTC, false, false, true, webkitPrefix); + registerExtension<WebGLCompressedTextureS3TC>(m_webglCompressedTextureS3TC, false, false, true, bothPrefixes); + registerExtension<WebGLDepthTexture>(m_webglDepthTexture, false, false, true, bothPrefixes); + registerExtension<WebGLLoseContext>(m_webglLoseContext, false, false, false, bothPrefixes); // Register draft extensions. - registerExtension<EXTFragDepth>(m_extFragDepth, DraftExtension); - registerExtension<WebGLDrawBuffers>(m_webglDrawBuffers, DraftExtension); + registerExtension<ANGLEInstancedArrays>(m_angleInstancedArrays, false, true, false, unprefixed); + registerExtension<EXTFragDepth>(m_extFragDepth, false, true, false, unprefixed); + registerExtension<WebGLDrawBuffers>(m_webglDrawBuffers, false, true, false, unprefixed); // Register privileged extensions. - registerExtension<WebGLDebugRendererInfo>(m_webglDebugRendererInfo, PrivilegedExtension); - registerExtension<WebGLDebugShaders>(m_webglDebugShaders, PrivilegedExtension); + registerExtension<WebGLDebugRendererInfo>(m_webglDebugRendererInfo, true, false, false, unprefixed); + registerExtension<WebGLDebugShaders>(m_webglDebugShaders, true, false, false, unprefixed); } void WebGLRenderingContext::initializeNewContext() @@ -1140,17 +1139,9 @@ void WebGLRenderingContext::bindTexture(GC3Denum target, WebGLTexture* texture) synthesizeGLError(GraphicsContext3D::INVALID_ENUM, "bindTexture", "invalid target"); return; } - m_context->bindTexture(target, objectOrZero(texture)); - if (texture) { + if (texture) texture->setTarget(target, maxLevel); - m_onePlusMaxNonDefaultTextureUnit = max(m_activeTextureUnit + 1, m_onePlusMaxNonDefaultTextureUnit); - } else { - // If the disabled index is the current maximum, trace backwards to find the new max enabled texture index - if (m_onePlusMaxNonDefaultTextureUnit == m_activeTextureUnit + 1) { - findNewMaxNonDefaultTextureUnit(); - } - } // Note: previously we used to automatically set the TEXTURE_WRAP_R // repeat mode to CLAMP_TO_EDGE for cube map textures, because OpenGL @@ -1389,7 +1380,7 @@ void WebGLRenderingContext::compressedTexImage2D(GC3Denum target, GC3Dint level, synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "compressedTexImage2D", "border not 0"); return; } - if (!validateCompressedTexDimensions("compressedTexImage2D", NotTexSubImage2D, target, level, width, height, internalformat)) + if (!validateCompressedTexDimensions("compressedTexImage2D", level, width, height, internalformat)) return; if (!validateCompressedTexFuncData("compressedTexImage2D", width, height, internalformat, data)) return; @@ -1665,27 +1656,17 @@ void WebGLRenderingContext::deleteTexture(WebGLTexture* texture) { if (!deleteObject(texture)) return; - - int maxBoundTextureIndex = -1; - for (size_t i = 0; i < m_onePlusMaxNonDefaultTextureUnit; ++i) { + for (size_t i = 0; i < m_textureUnits.size(); ++i) { if (texture == m_textureUnits[i].m_texture2DBinding) { m_textureUnits[i].m_texture2DBinding = 0; - maxBoundTextureIndex = i; if (!i) m_drawingBuffer->setTexture2DBinding(0); } - if (texture == m_textureUnits[i].m_textureCubeMapBinding) { + if (texture == m_textureUnits[i].m_textureCubeMapBinding) m_textureUnits[i].m_textureCubeMapBinding = 0; - maxBoundTextureIndex = i; - } } if (m_framebufferBinding) m_framebufferBinding->removeAttachmentFromBoundFramebuffer(texture); - - // If the deleted was bound to the the current maximum index, trace backwards to find the new max texture index - if (m_onePlusMaxNonDefaultTextureUnit == maxBoundTextureIndex + 1) { - findNewMaxNonDefaultTextureUnit(); - } } void WebGLRenderingContext::depthFunc(GC3Denum func) @@ -1755,12 +1736,6 @@ void WebGLRenderingContext::disableVertexAttribArray(GC3Duint index) WebGLVertexArrayObjectOES::VertexAttribState& state = m_boundVertexArrayObject->getVertexAttribState(index); state.enabled = false; - - // If the disabled index is the current maximum, trace backwards to find the new max enabled attrib index - if (m_onePlusMaxEnabledAttribIndex == index + 1) { - findNewMaxEnabledAttribIndex(); - } - m_context->disableVertexAttribArray(index); } @@ -1770,7 +1745,7 @@ bool WebGLRenderingContext::validateRenderingState() return false; // Look in each enabled vertex attrib and check if they've been bound to a buffer. - for (unsigned i = 0; i < m_onePlusMaxEnabledAttribIndex; ++i) { + for (unsigned i = 0; i < m_maxVertexAttribs; ++i) { const WebGLVertexArrayObjectOES::VertexAttribState& state = m_boundVertexArrayObject->getVertexAttribState(i); if (state.enabled && (!state.bufferBinding || !state.bufferBinding->object())) @@ -1879,8 +1854,6 @@ void WebGLRenderingContext::enableVertexAttribArray(GC3Duint index) WebGLVertexArrayObjectOES::VertexAttribState& state = m_boundVertexArrayObject->getVertexAttribState(index); state.enabled = true; - m_onePlusMaxEnabledAttribIndex = max(index + 1, m_onePlusMaxEnabledAttribIndex); - m_context->enableVertexAttribArray(index); } @@ -2137,9 +2110,7 @@ GC3Denum WebGLRenderingContext::getError() bool WebGLRenderingContext::ExtensionTracker::matchesNameWithPrefixes(const String& name) const { - static const char* unprefixed[] = { "", 0, }; - - const char** prefixes = m_prefixes ? m_prefixes : unprefixed; + const char** prefixes = m_prefixes; for (; *prefixes; ++prefixes) { String prefixedName = String(*prefixes) + getExtensionName(); if (equalIgnoringCase(prefixedName, name)) { @@ -4307,7 +4278,7 @@ void WebGLRenderingContext::handleTextureCompleteness(const char* functionName, bool resetActiveUnit = false; WebGLTexture::TextureExtensionFlag flag = static_cast<WebGLTexture::TextureExtensionFlag>((m_oesTextureFloatLinear ? WebGLTexture::TextureFloatLinearExtensionEnabled : 0) | (m_oesTextureHalfFloatLinear ? WebGLTexture::TextureHalfFloatLinearExtensionEnabled : 0)); - for (unsigned ii = 0; ii < m_onePlusMaxNonDefaultTextureUnit; ++ii) { + for (unsigned ii = 0; ii < m_textureUnits.size(); ++ii) { if ((m_textureUnits[ii].m_texture2DBinding.get() && m_textureUnits[ii].m_texture2DBinding->needToUseBlackTexture(flag)) || (m_textureUnits[ii].m_textureCubeMapBinding.get() && m_textureUnits[ii].m_textureCubeMapBinding->needToUseBlackTexture(flag))) { if (ii != m_activeTextureUnit) { @@ -4585,7 +4556,7 @@ bool WebGLRenderingContext::validateTexFuncLevel(const char* functionName, GC3De } switch (target) { case GraphicsContext3D::TEXTURE_2D: - if (level >= m_maxTextureLevel) { + if (level > m_maxTextureLevel) { synthesizeGLError(GraphicsContext3D::INVALID_VALUE, functionName, "level out of range"); return false; } @@ -4596,7 +4567,7 @@ bool WebGLRenderingContext::validateTexFuncLevel(const char* functionName, GC3De case GraphicsContext3D::TEXTURE_CUBE_MAP_NEGATIVE_Y: case GraphicsContext3D::TEXTURE_CUBE_MAP_POSITIVE_Z: case GraphicsContext3D::TEXTURE_CUBE_MAP_NEGATIVE_Z: - if (level >= m_maxCubeMapTextureLevel) { + if (level > m_maxCubeMapTextureLevel) { synthesizeGLError(GraphicsContext3D::INVALID_VALUE, functionName, "level out of range"); return false; } @@ -4607,9 +4578,19 @@ bool WebGLRenderingContext::validateTexFuncLevel(const char* functionName, GC3De return true; } -bool WebGLRenderingContext::validateTexFuncDimensions(const char* functionName, TexFuncValidationFunctionType functionType, - GC3Denum target, GC3Dint level, GC3Dsizei width, GC3Dsizei height) +bool WebGLRenderingContext::validateTexFuncParameters(const char* functionName, + TexFuncValidationFunctionType functionType, + GC3Denum target, GC3Dint level, + GC3Denum internalformat, + GC3Dsizei width, GC3Dsizei height, GC3Dint border, + GC3Denum format, GC3Denum type) { + // We absolutely have to validate the format and type combination. + // The texImage2D entry points taking HTMLImage, etc. will produce + // temporary data based on this combination, so it must be legal. + if (!validateTexFuncFormatAndType(functionName, format, type, level) || !validateTexFuncLevel(functionName, target, level)) + return false; + if (width < 0 || height < 0) { synthesizeGLError(GraphicsContext3D::INVALID_VALUE, functionName, "width or height < 0"); return false; @@ -4617,7 +4598,7 @@ bool WebGLRenderingContext::validateTexFuncDimensions(const char* functionName, switch (target) { case GraphicsContext3D::TEXTURE_2D: - if (width > (m_maxTextureSize >> level) || height > (m_maxTextureSize >> level)) { + if (width > m_maxTextureSize || height > m_maxTextureSize) { synthesizeGLError(GraphicsContext3D::INVALID_VALUE, functionName, "width or height out of range"); return false; } @@ -4634,7 +4615,7 @@ bool WebGLRenderingContext::validateTexFuncDimensions(const char* functionName, } // No need to check height here. For texImage width == height. // For texSubImage that will be checked when checking yoffset + height is in range. - if (width > (m_maxCubeMapTextureSize >> level)) { + if (width > m_maxCubeMapTextureSize) { synthesizeGLError(GraphicsContext3D::INVALID_VALUE, functionName, "width or height out of range for cube map"); return false; } @@ -4643,20 +4624,6 @@ bool WebGLRenderingContext::validateTexFuncDimensions(const char* functionName, synthesizeGLError(GraphicsContext3D::INVALID_ENUM, functionName, "invalid target"); return false; } - return true; -} - -bool WebGLRenderingContext::validateTexFuncParameters(const char* functionName, TexFuncValidationFunctionType functionType, GC3Denum target, - GC3Dint level, GC3Denum internalformat, GC3Dsizei width, GC3Dsizei height, GC3Dint border, GC3Denum format, GC3Denum type) -{ - // We absolutely have to validate the format and type combination. - // The texImage2D entry points taking HTMLImage, etc. will produce - // temporary data based on this combination, so it must be legal. - if (!validateTexFuncFormatAndType(functionName, format, type, level) || !validateTexFuncLevel(functionName, target, level)) - return false; - - if (!validateTexFuncDimensions(functionName, functionType, target, level, width, height)) - return false; if (format != internalformat) { synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, functionName, "format != internalformat"); @@ -4823,11 +4790,8 @@ bool WebGLRenderingContext::validateCompressedTexFuncData(const char* functionNa return true; } -bool WebGLRenderingContext::validateCompressedTexDimensions(const char* functionName, TexFuncValidationFunctionType functionType, GC3Denum target, GC3Dint level, GC3Dsizei width, GC3Dsizei height, GC3Denum format) +bool WebGLRenderingContext::validateCompressedTexDimensions(const char* functionName, GC3Dint level, GC3Dsizei width, GC3Dsizei height, GC3Denum format) { - if (!validateTexFuncDimensions(functionName, functionType, target, level, width, height)) - return false; - switch (format) { case Extensions3D::COMPRESSED_RGB_S3TC_DXT1_EXT: case Extensions3D::COMPRESSED_RGBA_S3TC_DXT1_EXT: @@ -4872,7 +4836,7 @@ bool WebGLRenderingContext::validateCompressedTexSubDimensions(const char* funct synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, functionName, "dimensions out of range"); return false; } - return validateCompressedTexDimensions(functionName, TexSubImage2D, target, level, width, height, format); + return validateCompressedTexDimensions(functionName, level, width, height, format); } default: return false; @@ -5233,7 +5197,7 @@ bool WebGLRenderingContext::validateDrawInstanced(const char* functionName, GC3D } // Ensure at least one enabled vertex attrib has a divisor of 0. - for (unsigned i = 0; i < m_onePlusMaxEnabledAttribIndex; ++i) { + for (unsigned i = 0; i < m_maxVertexAttribs; ++i) { const WebGLVertexArrayObjectOES::VertexAttribState& state = m_boundVertexArrayObject->getVertexAttribState(i); if (state.enabled && !state.divisor) return true; @@ -5558,31 +5522,4 @@ void WebGLRenderingContext::multisamplingChanged(bool enabled) } } -void WebGLRenderingContext::findNewMaxEnabledAttribIndex() -{ - // Trace backwards from the current max to find the new max enabled attrib index - int startIndex = m_onePlusMaxEnabledAttribIndex - 1; - for (int i = startIndex; i >= 0; --i) { - if (m_boundVertexArrayObject->getVertexAttribState(i).enabled) { - m_onePlusMaxEnabledAttribIndex = i + 1; - return; - } - } - m_onePlusMaxEnabledAttribIndex = 0; -} - -void WebGLRenderingContext::findNewMaxNonDefaultTextureUnit() -{ - // Trace backwards from the current max to find the new max non-default texture unit - int startIndex = m_onePlusMaxNonDefaultTextureUnit - 1; - for (int i = startIndex; i >= 0; --i) { - if (m_textureUnits[i].m_texture2DBinding - || m_textureUnits[i].m_textureCubeMapBinding) { - m_onePlusMaxNonDefaultTextureUnit = i + 1; - return; - } - } - m_onePlusMaxNonDefaultTextureUnit = 0; -} - } // namespace WebCore diff --git a/chromium/third_party/WebKit/Source/core/html/canvas/WebGLRenderingContext.h b/chromium/third_party/WebKit/Source/core/html/canvas/WebGLRenderingContext.h index 386bb374675..39aeae7a0c7 100644 --- a/chromium/third_party/WebKit/Source/core/html/canvas/WebGLRenderingContext.h +++ b/chromium/third_party/WebKit/Source/core/html/canvas/WebGLRenderingContext.h @@ -506,12 +506,6 @@ public: bool m_synthesizedErrorsToConsole; int m_numGLErrorsToConsoleAllowed; - bool m_multisamplingAllowed; - bool m_multisamplingObserverRegistered; - - GC3Duint m_onePlusMaxEnabledAttribIndex; - unsigned long m_onePlusMaxNonDefaultTextureUnit; - // Enabled extension objects. RefPtr<ANGLEInstancedArrays> m_angleInstancedArrays; RefPtr<EXTFragDepth> m_extFragDepth; @@ -532,19 +526,12 @@ public: RefPtr<WebGLCompressedTextureS3TC> m_webglCompressedTextureS3TC; RefPtr<WebGLDepthTexture> m_webglDepthTexture; - enum ExtensionFlags { - ApprovedExtension = 0x00, - DraftExtension = 0x01, - PrivilegedExtension = 0x02, - PrefixedExtension = 0x04, - }; - class ExtensionTracker { public: - ExtensionTracker(ExtensionFlags flags, const char** prefixes) - : m_privileged(flags & PrivilegedExtension) - , m_draft(flags & DraftExtension) - , m_prefixed(flags & PrefixedExtension) + ExtensionTracker(bool privileged, bool draft, bool prefixed, const char** prefixes) + : m_privileged(privileged) + , m_draft(draft) + , m_prefixed(prefixed) , m_prefixes(prefixes) { } @@ -585,8 +572,8 @@ public: template <typename T> class TypedExtensionTracker : public ExtensionTracker { public: - TypedExtensionTracker(RefPtr<T>& extensionField, ExtensionFlags flags, const char** prefixes) - : ExtensionTracker(flags, prefixes) + TypedExtensionTracker(RefPtr<T>& extensionField, bool privileged, bool draft, bool prefixed, const char** prefixes) + : ExtensionTracker(privileged, draft, prefixed, prefixes) , m_extensionField(extensionField) { } @@ -633,9 +620,9 @@ public: Vector<ExtensionTracker*> m_extensions; template <typename T> - void registerExtension(RefPtr<T>& extensionPtr, ExtensionFlags flags = ApprovedExtension, const char** prefixes = 0) + void registerExtension(RefPtr<T>& extensionPtr, bool privileged, bool draft, bool prefixed, const char** prefixes) { - m_extensions.append(new TypedExtensionTracker<T>(extensionPtr, flags, prefixes)); + m_extensions.append(new TypedExtensionTracker<T>(extensionPtr, privileged, draft, prefixed, prefixes)); } // Errors raised by synthesizeGLError() while the context is lost. @@ -723,11 +710,6 @@ public: bool validateTexFunc(const char* functionName, TexFuncValidationFunctionType, TexFuncValidationSourceType, GC3Denum target, GC3Dint level, GC3Denum internalformat, GC3Dsizei width, GC3Dsizei height, GC3Dint border, GC3Denum format, GC3Denum type, GC3Dint xoffset, GC3Dint yoffset); - // Helper function to check input width and height for functions {copy, compressed}Tex{Sub}Image. - // Generates GL error and returns false if width or height is invalid. - bool validateTexFuncDimensions(const char* functionName, TexFuncValidationFunctionType, - GC3Denum target, GC3Dint level, GC3Dsizei width, GC3Dsizei height); - // Helper function to check input parameters for functions {copy}Tex{Sub}Image. // Generates GL error and returns false if parameters are invalid. bool validateTexFuncParameters(const char* functionName, @@ -768,7 +750,7 @@ public: // Helper function to validate compressed texture dimensions are valid for // the given format. - bool validateCompressedTexDimensions(const char* functionName, TexFuncValidationFunctionType, GC3Denum target, GC3Dint level, GC3Dsizei width, GC3Dsizei height, GC3Denum format); + bool validateCompressedTexDimensions(const char* functionName, GC3Dint level, GC3Dsizei width, GC3Dsizei height, GC3Denum format); // Helper function to validate compressed texture dimensions are valid for // the given format. @@ -891,9 +873,8 @@ public: void restoreCurrentTexture2D(); virtual void multisamplingChanged(bool); - - void findNewMaxEnabledAttribIndex(); - void findNewMaxNonDefaultTextureUnit(); + bool m_multisamplingAllowed; + bool m_multisamplingObserverRegistered; friend class WebGLStateRestorer; friend class WebGLRenderingContextEvictionManager; diff --git a/chromium/third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.h b/chromium/third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.h index a30571440e0..1a1e2d7add1 100644 --- a/chromium/third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.h +++ b/chromium/third_party/WebKit/Source/core/html/parser/HTMLDocumentParser.h @@ -28,7 +28,6 @@ #include "core/dom/ParserContentPolicy.h" #include "core/dom/ScriptableDocumentParser.h" -#include "core/fetch/ResourceClient.h" #include "core/html/parser/BackgroundHTMLInputStream.h" #include "core/html/parser/CompactHTMLToken.h" #include "core/html/parser/HTMLInputStream.h" @@ -41,6 +40,7 @@ #include "core/html/parser/HTMLTreeBuilderSimulator.h" #include "core/html/parser/XSSAuditor.h" #include "core/html/parser/XSSAuditorDelegate.h" +#include "core/loader/cache/ResourceClient.h" #include "core/platform/text/SegmentedString.h" #include "wtf/Deque.h" #include "wtf/OwnPtr.h" diff --git a/chromium/third_party/WebKit/Source/core/html/parser/HTMLResourcePreloader.cpp b/chromium/third_party/WebKit/Source/core/html/parser/HTMLResourcePreloader.cpp index 1d5317c4775..4960d81c30e 100644 --- a/chromium/third_party/WebKit/Source/core/html/parser/HTMLResourcePreloader.cpp +++ b/chromium/third_party/WebKit/Source/core/html/parser/HTMLResourcePreloader.cpp @@ -27,9 +27,9 @@ #include "core/html/parser/HTMLResourcePreloader.h" #include "core/dom/Document.h" -#include "core/fetch/FetchInitiatorInfo.h" -#include "core/fetch/ResourceFetcher.h" #include "core/html/HTMLImport.h" +#include "core/loader/cache/FetchInitiatorInfo.h" +#include "core/loader/cache/ResourceFetcher.h" #include "core/css/MediaList.h" #include "core/css/MediaQueryEvaluator.h" #include "core/platform/HistogramSupport.h" diff --git a/chromium/third_party/WebKit/Source/core/html/parser/HTMLResourcePreloader.h b/chromium/third_party/WebKit/Source/core/html/parser/HTMLResourcePreloader.h index 75c620d86a8..1b94671ccc6 100644 --- a/chromium/third_party/WebKit/Source/core/html/parser/HTMLResourcePreloader.h +++ b/chromium/third_party/WebKit/Source/core/html/parser/HTMLResourcePreloader.h @@ -26,8 +26,8 @@ #ifndef HTMLResourcePreloader_h #define HTMLResourcePreloader_h -#include "core/fetch/FetchRequest.h" -#include "core/fetch/Resource.h" +#include "core/loader/cache/FetchRequest.h" +#include "core/loader/cache/Resource.h" #include "wtf/CurrentTime.h" #include "wtf/text/TextPosition.h" diff --git a/chromium/third_party/WebKit/Source/core/html/parser/HTMLScriptRunner.cpp b/chromium/third_party/WebKit/Source/core/html/parser/HTMLScriptRunner.cpp index 9fd75103758..5141c82a9d6 100644 --- a/chromium/third_party/WebKit/Source/core/html/parser/HTMLScriptRunner.cpp +++ b/chromium/third_party/WebKit/Source/core/html/parser/HTMLScriptRunner.cpp @@ -32,10 +32,10 @@ #include "core/dom/IgnoreDestructiveWriteCountIncrementer.h" #include "core/dom/Microtask.h" #include "core/dom/ScriptLoader.h" -#include "core/fetch/ScriptResource.h" #include "core/html/parser/HTMLInputStream.h" #include "core/html/parser/HTMLScriptRunnerHost.h" #include "core/html/parser/NestingLevelIncrementer.h" +#include "core/loader/cache/ScriptResource.h" #include "core/page/Frame.h" #include "core/platform/NotImplemented.h" diff --git a/chromium/third_party/WebKit/Source/core/html/shadow/DateTimeFieldElements.cpp b/chromium/third_party/WebKit/Source/core/html/shadow/DateTimeFieldElements.cpp index d9b59c6be6c..fda494d7df8 100644 --- a/chromium/third_party/WebKit/Source/core/html/shadow/DateTimeFieldElements.cpp +++ b/chromium/third_party/WebKit/Source/core/html/shadow/DateTimeFieldElements.cpp @@ -141,9 +141,10 @@ void DateTimeHourFieldElementBase::setValueAsDateTimeFieldsState(const DateTimeF return; } - const int hour11 = hour12 == 12 ? 0 : hour12; - const int hour23 = dateTimeFieldsState.ampm() == DateTimeFieldsState::AMPMValuePM ? hour11 + 12 : hour11; - setValueAsInteger(hour23); + if (dateTimeFieldsState.ampm() == DateTimeFieldsState::AMPMValuePM) + setValueAsInteger((hour12 + 12) % 24); + else + setValueAsInteger(hour12 % 12); } // ---------------------------- @@ -255,7 +256,7 @@ void DateTimeHour23FieldElement::populateDateTimeFieldsState(DateTimeFieldsState const int value = valueAsInteger(); - dateTimeFieldsState.setHour(value % 12 ? value % 12 : 12); + dateTimeFieldsState.setHour(value ? value % 12 : 12); dateTimeFieldsState.setAMPM(value >= 12 ? DateTimeFieldsState::AMPMValuePM : DateTimeFieldsState::AMPMValueAM); } diff --git a/chromium/third_party/WebKit/Source/core/html/shadow/PasswordGeneratorButtonElement.cpp b/chromium/third_party/WebKit/Source/core/html/shadow/PasswordGeneratorButtonElement.cpp index 8f6b3c6f85e..81b52fb9bbb 100644 --- a/chromium/third_party/WebKit/Source/core/html/shadow/PasswordGeneratorButtonElement.cpp +++ b/chromium/third_party/WebKit/Source/core/html/shadow/PasswordGeneratorButtonElement.cpp @@ -37,9 +37,9 @@ #include "core/dom/NodeRenderStyle.h" #include "core/dom/shadow/ElementShadow.h" #include "core/dom/shadow/ShadowRoot.h" -#include "core/fetch/ImageResource.h" #include "core/html/HTMLInputElement.h" #include "core/html/shadow/HTMLShadowElement.h" +#include "core/loader/cache/ImageResource.h" #include "core/page/Chrome.h" #include "core/page/ChromeClient.h" #include "core/page/Page.h" diff --git a/chromium/third_party/WebKit/Source/core/html/shadow/PasswordGeneratorButtonElement.h b/chromium/third_party/WebKit/Source/core/html/shadow/PasswordGeneratorButtonElement.h index 3a3d7c1c214..20320345bc4 100644 --- a/chromium/third_party/WebKit/Source/core/html/shadow/PasswordGeneratorButtonElement.h +++ b/chromium/third_party/WebKit/Source/core/html/shadow/PasswordGeneratorButtonElement.h @@ -31,8 +31,8 @@ #ifndef PasswordGeneratorButtonElement_h #define PasswordGeneratorButtonElement_h -#include "core/fetch/ResourcePtr.h" #include "core/html/HTMLDivElement.h" +#include "core/loader/cache/ResourcePtr.h" namespace WebCore { diff --git a/chromium/third_party/WebKit/Source/core/inspector/InjectedScriptCanvasModuleSource.js b/chromium/third_party/WebKit/Source/core/inspector/InjectedScriptCanvasModuleSource.js index 00d50cf82c8..c4bd77f5977 100644 --- a/chromium/third_party/WebKit/Source/core/inspector/InjectedScriptCanvasModuleSource.js +++ b/chromium/third_party/WebKit/Source/core/inspector/InjectedScriptCanvasModuleSource.js @@ -185,16 +185,6 @@ var TypeUtils = { }, /** - * @param {string} property - * @param {!Object} obj - * @return {boolean} - */ - isEnumPropertyName: function(property, obj) - { - return (/^[A-Z][A-Z0-9_]+$/.test(property) && typeof obj[property] === "number"); - }, - - /** * @return {CanvasRenderingContext2D} */ _dummyCanvas2dContext: function() @@ -209,7 +199,7 @@ var TypeUtils = { } } -/** @typedef {{name:string, valueIsEnum:(boolean|undefined), value:*, values:(!Array.<TypeUtils.InternalResourceStateDescriptor>|undefined), isArray:(boolean|undefined)}} */ +/** @typedef {{name: string, value: *, values: (!Array.<TypeUtils.InternalResourceStateDescriptor>|undefined)}} */ TypeUtils.InternalResourceStateDescriptor; /** @@ -495,13 +485,6 @@ Call.prototype = { */ replay: function(replayableCall, cache) { - var replayableResult = replayableCall.result(); - if (replayableResult instanceof ReplayableResource && !cache.has(replayableResult.id())) { - var resource = replayableResult.replay(cache); - console.assert(resource.calls().length > 0, "Expected create* call for the Resource"); - return resource.calls()[0]; - } - var replayObject = ReplayableResource.replay(replayableCall.replayableResource(), cache); var replayArgs = replayableCall.args().map(function(obj) { return ReplayableResource.replay(obj, cache); @@ -514,9 +497,8 @@ Call.prototype = { var replayFunction = replayObject[replayableCall.functionName()]; console.assert(typeof replayFunction === "function", "Expected a function to replay"); replayResult = replayFunction.apply(replayObject, replayArgs); - - if (replayableResult instanceof ReplayableResource) { - var resource = replayableResult.replay(cache); + if (replayableCall.result() instanceof ReplayableResource) { + var resource = replayableCall.result().replay(cache); if (!resource.wrappedObject()) resource.setWrappedObject(replayResult); } @@ -531,11 +513,6 @@ Call.prototype = { var attachments = replayableCall.attachments(); if (attachments) this._attachments = TypeUtils.cloneObject(attachments); - - var thisResource = Resource.forObject(replayObject); - if (thisResource) - thisResource.onCallReplayed(this); - return this; } } @@ -801,7 +778,7 @@ Resource.prototype = { }, /** - * @return {!Array.<!Call>} + * @return {!Array.<Call>} */ calls: function() { @@ -845,7 +822,6 @@ Resource.prototype = { var pname = statePropertyNames[i]; result.push({ name: pname, value: proxyObject[pname] }); } - result.push({ name: "context", value: this.contextResource() }); return result; }, @@ -935,14 +911,6 @@ Resource.prototype = { }, /** - * @param {!Call} call - */ - onCallReplayed: function(call) - { - // Ignore by default. - }, - - /** * @param {!Object} object */ _bindObjectToResource: function(object) @@ -993,7 +961,7 @@ Resource.prototype = { proxy[property] = this._wrapCustomFunction(this, wrappedObject, wrappedObject[property], property, customWrapFunction); else proxy[property] = this._wrapFunction(this, wrappedObject, wrappedObject[property], property); - } else if (TypeUtils.isEnumPropertyName(property, wrappedObject)) { + } else if (/^[A-Z0-9_]+$/.test(property) && typeof wrappedObject[property] === "number") { // Fast access to enums and constants. proxy[property] = wrappedObject[property]; } else { @@ -1389,8 +1357,8 @@ WebGLBoundResource.prototype = { */ pushBinding: function(target, bindMethodName) { - if (this._state.bindTarget !== target) { - this._state.bindTarget = target; + if (this._state.BINDING !== target) { + this._state.BINDING = target; this.pushCall(new Call(WebGLRenderingContextResource.forObject(this), bindMethodName, [target, this])); } }, @@ -1411,66 +1379,6 @@ function WebGLTextureResource(wrappedObject, name) WebGLTextureResource.prototype = { /** - * @override (overrides @return type) - * @return {WebGLTexture} - */ - wrappedObject: function() - { - return this._wrappedObject; - }, - - /** - * @override - * @return {!Array.<TypeUtils.InternalResourceStateDescriptor>} - */ - currentState: function() - { - var result = []; - var glResource = WebGLRenderingContextResource.forObject(this); - var gl = glResource.wrappedObject(); - var texture = this.wrappedObject(); - if (!gl || !texture) - return result; - result.push({ name: "isTexture", value: gl.isTexture(texture) }); - result.push({ name: "context", value: this.contextResource() }); - - var target = this._state.bindTarget; - if (typeof target !== "number") - return result; - - var bindingParameter; - switch (target) { - case gl.TEXTURE_2D: - bindingParameter = gl.TEXTURE_BINDING_2D; - break; - case gl.TEXTURE_CUBE_MAP: - bindingParameter = gl.TEXTURE_BINDING_CUBE_MAP; - break; - default: - console.error("ASSERT_NOT_REACHED: unknown texture target " + target); - return result; - } - result.push({ name: "target", value: target, valueIsEnum: true }); - - var oldTexture = /** @type {WebGLTexture} */ (gl.getParameter(bindingParameter)); - if (oldTexture !== texture) - gl.bindTexture(target, texture); - - var textureParameters = [ - "TEXTURE_MAG_FILTER", - "TEXTURE_MIN_FILTER", - "TEXTURE_WRAP_S", - "TEXTURE_WRAP_T", - "TEXTURE_MAX_ANISOTROPY_EXT" // EXT_texture_filter_anisotropic extension - ]; - glResource.queryStateValues(gl.getTexParameter, target, textureParameters, result); - - if (oldTexture !== texture) - gl.bindTexture(target, oldTexture); - return result; - }, - - /** * @override * @param {!Object} data * @param {!Cache.<Resource>} cache @@ -1572,83 +1480,18 @@ WebGLProgramResource.prototype = { /** * @override - * @return {!Array.<TypeUtils.InternalResourceStateDescriptor>} + * @param {!Object} data + * @param {!Cache.<ReplayableResource>} cache */ - currentState: function() + _populateReplayableData: function(data, cache) { - /** - * @param {!Object} obj - * @param {!Array.<TypeUtils.InternalResourceStateDescriptor>} output - */ - function convertToStateDescriptors(obj, output) - { - for (var pname in obj) - output.push({ name: pname, value: obj[pname], valueIsEnum: (pname === "type") }); - } - - var result = []; - var program = this.wrappedObject(); - if (!program) - return result; var glResource = WebGLRenderingContextResource.forObject(this); var gl = glResource.wrappedObject(); - var programParameters = ["DELETE_STATUS", "LINK_STATUS", "VALIDATE_STATUS"]; - glResource.queryStateValues(gl.getProgramParameter, program, programParameters, result); - result.push({ name: "getProgramInfoLog", value: gl.getProgramInfoLog(program) }); - result.push({ name: "isProgram", value: gl.isProgram(program) }); - result.push({ name: "context", value: this.contextResource() }); - - // ATTACHED_SHADERS - var callFormatter = CallFormatter.forResource(this); - var shaders = gl.getAttachedShaders(program) || []; - var shaderDescriptors = []; - for (var i = 0, n = shaders.length; i < n; ++i) { - var shaderResource = Resource.forObject(shaders[i]); - var pname = callFormatter.enumNameForValue(shaderResource.type()); - shaderDescriptors.push({ name: pname, value: shaderResource }); - } - result.push({ name: "ATTACHED_SHADERS", values: shaderDescriptors, isArray: true }); - - // ACTIVE_UNIFORMS - var uniformDescriptors = []; - var uniforms = this._activeUniforms(true); - for (var i = 0, n = uniforms.length; i < n; ++i) { - var pname = "" + i; - var values = []; - convertToStateDescriptors(uniforms[i], values); - uniformDescriptors.push({ name: pname, values: values }); - } - result.push({ name: "ACTIVE_UNIFORMS", values: uniformDescriptors, isArray: true }); - - // ACTIVE_ATTRIBUTES - var attributesCount = /** @type {number} */ (gl.getProgramParameter(program, gl.ACTIVE_ATTRIBUTES)); - var attributeDescriptors = []; - for (var i = 0; i < attributesCount; ++i) { - var activeInfo = gl.getActiveAttrib(program, i); - if (!activeInfo) - continue; - var pname = "" + i; - var values = []; - convertToStateDescriptors(activeInfo, values); - attributeDescriptors.push({ name: pname, values: values }); - } - result.push({ name: "ACTIVE_ATTRIBUTES", values: attributeDescriptors, isArray: true }); + var program = this.wrappedObject(); - return result; - }, + var originalErrors = glResource.getAllErrors(); - /** - * @param {boolean=} includeAllInfo - * @return {!Array.<{name:string, type:number, value:*, size:(number|undefined)}>} - */ - _activeUniforms: function(includeAllInfo) - { var uniforms = []; - var program = this.wrappedObject(); - if (!program) - return uniforms; - - var gl = WebGLRenderingContextResource.forObject(this).wrappedObject(); var uniformsCount = /** @type {number} */ (gl.getProgramParameter(program, gl.ACTIVE_UNIFORMS)); for (var i = 0; i < uniformsCount; ++i) { var activeInfo = gl.getActiveUniform(program, i); @@ -1658,27 +1501,14 @@ WebGLProgramResource.prototype = { if (!uniformLocation) continue; var value = gl.getUniform(program, uniformLocation); - var item = Object.create(null); - item.name = activeInfo.name; - item.type = activeInfo.type; - item.value = value; - if (includeAllInfo) - item.size = activeInfo.size; - uniforms.push(item); + uniforms.push({ + name: activeInfo.name, + type: activeInfo.type, + value: value + }); } - return uniforms; - }, + data.uniforms = uniforms; - /** - * @override - * @param {!Object} data - * @param {!Cache.<ReplayableResource>} cache - */ - _populateReplayableData: function(data, cache) - { - var glResource = WebGLRenderingContextResource.forObject(this); - var originalErrors = glResource.getAllErrors(); - data.uniforms = this._activeUniforms(); glResource.restoreErrors(originalErrors); }, @@ -1775,15 +1605,6 @@ function WebGLShaderResource(wrappedObject, name) WebGLShaderResource.prototype = { /** - * @override (overrides @return type) - * @return {WebGLShader} - */ - wrappedObject: function() - { - return this._wrappedObject; - }, - - /** * @return {number} */ type: function() @@ -1797,36 +1618,6 @@ WebGLShaderResource.prototype = { /** * @override - * @return {!Array.<TypeUtils.InternalResourceStateDescriptor>} - */ - currentState: function() - { - var result = []; - var shader = this.wrappedObject(); - if (!shader) - return result; - var glResource = WebGLRenderingContextResource.forObject(this); - var gl = glResource.wrappedObject(); - var shaderParameters = ["SHADER_TYPE", "DELETE_STATUS", "COMPILE_STATUS"]; - glResource.queryStateValues(gl.getShaderParameter, shader, shaderParameters, result); - result.push({ name: "getShaderInfoLog", value: gl.getShaderInfoLog(shader) }); - result.push({ name: "getShaderSource", value: gl.getShaderSource(shader) }); - result.push({ name: "isShader", value: gl.isShader(shader) }); - result.push({ name: "context", value: this.contextResource() }); - - // getShaderPrecisionFormat - var shaderType = this.type(); - var precisionValues = []; - var precisionParameters = ["LOW_FLOAT", "MEDIUM_FLOAT", "HIGH_FLOAT", "LOW_INT", "MEDIUM_INT", "HIGH_INT"]; - for (var i = 0, pname; pname = precisionParameters[i]; ++i) - precisionValues.push({ name: pname, value: gl.getShaderPrecisionFormat(shaderType, gl[pname]) }); - result.push({ name: "getShaderPrecisionFormat", values: precisionValues }); - - return result; - }, - - /** - * @override * @param {!Call} call */ pushCall: function(call) @@ -1852,60 +1643,6 @@ function WebGLBufferResource(wrappedObject, name) WebGLBufferResource.prototype = { /** - * @override (overrides @return type) - * @return {WebGLBuffer} - */ - wrappedObject: function() - { - return this._wrappedObject; - }, - - /** - * @override - * @return {!Array.<TypeUtils.InternalResourceStateDescriptor>} - */ - currentState: function() - { - var result = []; - var glResource = WebGLRenderingContextResource.forObject(this); - var gl = glResource.wrappedObject(); - var buffer = this.wrappedObject(); - if (!gl || !buffer) - return result; - result.push({ name: "isBuffer", value: gl.isBuffer(buffer) }); - result.push({ name: "context", value: this.contextResource() }); - - var target = this._state.bindTarget; - if (typeof target !== "number") - return result; - - var bindingParameter; - switch (target) { - case gl.ARRAY_BUFFER: - bindingParameter = gl.ARRAY_BUFFER_BINDING; - break; - case gl.ELEMENT_ARRAY_BUFFER: - bindingParameter = gl.ELEMENT_ARRAY_BUFFER_BINDING; - break; - default: - console.error("ASSERT_NOT_REACHED: unknown buffer target " + target); - return result; - } - result.push({ name: "target", value: target, valueIsEnum: true }); - - var oldBuffer = /** @type {WebGLBuffer} */ (gl.getParameter(bindingParameter)); - if (oldBuffer !== buffer) - gl.bindBuffer(target, buffer); - - var bufferParameters = ["BUFFER_SIZE", "BUFFER_USAGE"]; - glResource.queryStateValues(gl.getBufferParameter, target, bufferParameters, result); - - if (oldBuffer !== buffer) - gl.bindBuffer(target, oldBuffer); - return result; - }, - - /** * @override * @param {!Call} call */ @@ -1932,50 +1669,6 @@ function WebGLFramebufferResource(wrappedObject, name) WebGLFramebufferResource.prototype = { /** - * @override (overrides @return type) - * @return {WebGLFramebuffer} - */ - wrappedObject: function() - { - return this._wrappedObject; - }, - - /** - * @override - * @return {!Array.<TypeUtils.InternalResourceStateDescriptor>} - */ - currentState: function() - { - var result = []; - var framebuffer = this.wrappedObject(); - if (!framebuffer) - return result; - var gl = WebGLRenderingContextResource.forObject(this).wrappedObject(); - - var oldFramebuffer = /** @type {WebGLFramebuffer} */ (gl.getParameter(gl.FRAMEBUFFER_BINDING)); - if (oldFramebuffer !== framebuffer) - gl.bindFramebuffer(gl.FRAMEBUFFER, framebuffer); - - var attachmentParameters = ["COLOR_ATTACHMENT0", "DEPTH_ATTACHMENT", "STENCIL_ATTACHMENT"]; - var framebufferParameters = ["FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE", "FRAMEBUFFER_ATTACHMENT_OBJECT_NAME", "FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL", "FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE"]; - for (var i = 0, attachment; attachment = attachmentParameters[i]; ++i) { - var values = []; - for (var j = 0, pname; pname = framebufferParameters[j]; ++j) { - var value = gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl[attachment], gl[pname]); - value = Resource.forObject(value) || value; - values.push({ name: pname, value: value, valueIsEnum: WebGLRenderingContextResource.GetResultIsEnum[pname] }); - } - result.push({ name: attachment, values: values }); - } - result.push({ name: "isFramebuffer", value: gl.isFramebuffer(framebuffer) }); - result.push({ name: "context", value: this.contextResource() }); - - if (oldFramebuffer !== framebuffer) - gl.bindFramebuffer(gl.FRAMEBUFFER, oldFramebuffer); - return result; - }, - - /** * @override * @param {!Call} call */ @@ -2001,42 +1694,6 @@ function WebGLRenderbufferResource(wrappedObject, name) WebGLRenderbufferResource.prototype = { /** - * @override (overrides @return type) - * @return {WebGLRenderbuffer} - */ - wrappedObject: function() - { - return this._wrappedObject; - }, - - /** - * @override - * @return {!Array.<TypeUtils.InternalResourceStateDescriptor>} - */ - currentState: function() - { - var result = []; - var renderbuffer = this.wrappedObject(); - if (!renderbuffer) - return result; - var glResource = WebGLRenderingContextResource.forObject(this); - var gl = glResource.wrappedObject(); - - var oldRenderbuffer = /** @type {WebGLRenderbuffer} */ (gl.getParameter(gl.RENDERBUFFER_BINDING)); - if (oldRenderbuffer !== renderbuffer) - gl.bindRenderbuffer(gl.RENDERBUFFER, renderbuffer); - - var renderbufferParameters = ["RENDERBUFFER_WIDTH", "RENDERBUFFER_HEIGHT", "RENDERBUFFER_INTERNAL_FORMAT", "RENDERBUFFER_RED_SIZE", "RENDERBUFFER_GREEN_SIZE", "RENDERBUFFER_BLUE_SIZE", "RENDERBUFFER_ALPHA_SIZE", "RENDERBUFFER_DEPTH_SIZE", "RENDERBUFFER_STENCIL_SIZE"]; - glResource.queryStateValues(gl.getRenderbufferParameter, gl.RENDERBUFFER, renderbufferParameters, result); - result.push({ name: "isRenderbuffer", value: gl.isRenderbuffer(renderbuffer) }); - result.push({ name: "context", value: this.contextResource() }); - - if (oldRenderbuffer !== renderbuffer) - gl.bindRenderbuffer(gl.RENDERBUFFER, oldRenderbuffer); - return result; - }, - - /** * @override * @param {!Call} call */ @@ -2051,122 +1708,6 @@ WebGLRenderbufferResource.prototype = { /** * @constructor - * @extends {Resource} - * @param {!Object} wrappedObject - * @param {string} name - */ -function WebGLUniformLocationResource(wrappedObject, name) -{ - Resource.call(this, wrappedObject, name); -} - -WebGLUniformLocationResource.prototype = { - /** - * @override (overrides @return type) - * @return {WebGLUniformLocation} - */ - wrappedObject: function() - { - return this._wrappedObject; - }, - - /** - * @return {WebGLProgramResource} - */ - program: function() - { - var call = this._calls[0]; - if (call && call.functionName() === "getUniformLocation") - return /** @type {WebGLProgramResource} */ (Resource.forObject(call.args()[0])); - console.error("ASSERT_NOT_REACHED: Failed to restore WebGLUniformLocation from the log.", call); - return null; - }, - - /** - * @return {string} - */ - name: function() - { - var call = this._calls[0]; - if (call && call.functionName() === "getUniformLocation") - return call.args()[1]; - console.error("ASSERT_NOT_REACHED: Failed to restore WebGLUniformLocation from the log.", call); - return ""; - }, - - /** - * @override - * @return {!Array.<TypeUtils.InternalResourceStateDescriptor>} - */ - currentState: function() - { - var result = []; - var location = this.wrappedObject(); - if (!location) - return result; - var programResource = this.program(); - var program = programResource && programResource.wrappedObject(); - if (!program) - return result; - var gl = WebGLRenderingContextResource.forObject(this).wrappedObject(); - var uniformValue = gl.getUniform(program, location); - var name = this.name(); - result.push({ name: "name", value: name }); - result.push({ name: "program", value: programResource }); - result.push({ name: "value", value: uniformValue }); - result.push({ name: "context", value: this.contextResource() }); - - if (typeof this._type !== "number") { - var altName = name + "[0]"; - var uniformsCount = /** @type {number} */ (gl.getProgramParameter(program, gl.ACTIVE_UNIFORMS)); - for (var i = 0; i < uniformsCount; ++i) { - var activeInfo = gl.getActiveUniform(program, i); - if (!activeInfo) - continue; - if (activeInfo.name === name || activeInfo.name === altName) { - this._type = activeInfo.type; - this._size = activeInfo.size; - if (activeInfo.name === name) - break; - } - } - } - if (typeof this._type === "number") - result.push({ name: "type", value: this._type, valueIsEnum: true }); - if (typeof this._size === "number") - result.push({ name: "size", value: this._size }); - - return result; - }, - - /** - * @override - * @param {!Object} data - * @param {!Cache.<ReplayableResource>} cache - */ - _populateReplayableData: function(data, cache) - { - data.type = this._type; - data.size = this._size; - }, - - /** - * @override - * @param {!Object} data - * @param {!Cache.<Resource>} cache - */ - _doReplayCalls: function(data, cache) - { - this._type = data.type; - this._size = data.size; - Resource.prototype._doReplayCalls.call(this, data, cache); - }, - - __proto__: Resource.prototype -} - -/** - * @constructor * @extends {ContextResource} * @param {!WebGLRenderingContext} glContext */ @@ -2175,10 +1716,8 @@ function WebGLRenderingContextResource(glContext) ContextResource.call(this, glContext, "WebGLRenderingContext"); /** @type {Object.<number, boolean>} */ this._customErrors = null; - /** @type {!Object.<string, string>} */ + /** @type {!Object.<string, boolean>} */ this._extensions = {}; - /** @type {!Object.<string, number>} */ - this._extensionEnums = {}; } /** @@ -2232,7 +1771,6 @@ WebGLRenderingContextResource.StateParameters = [ "DEPTH_RANGE", "DEPTH_WRITEMASK", "ELEMENT_ARRAY_BUFFER_BINDING", - "FRAGMENT_SHADER_DERIVATIVE_HINT_OES", // OES_standard_derivatives extension "FRAMEBUFFER_BINDING", "FRONT_FACE", "GENERATE_MIPMAP_HINT", @@ -2263,56 +1801,10 @@ WebGLRenderingContextResource.StateParameters = [ "UNPACK_COLORSPACE_CONVERSION_WEBGL", "UNPACK_FLIP_Y_WEBGL", "UNPACK_PREMULTIPLY_ALPHA_WEBGL", - "VERTEX_ARRAY_BINDING_OES", // OES_vertex_array_object extension "VIEWPORT" ]; /** - * True for those enums that return also an enum via a getter API method (e.g. getParameter, getShaderParameter, etc.). - * @const - * @type {!Object.<string, boolean>} - */ -WebGLRenderingContextResource.GetResultIsEnum = TypeUtils.createPrefixedPropertyNamesSet([ - // gl.getParameter() - "ACTIVE_TEXTURE", - "BLEND_DST_ALPHA", - "BLEND_DST_RGB", - "BLEND_EQUATION_ALPHA", - "BLEND_EQUATION_RGB", - "BLEND_SRC_ALPHA", - "BLEND_SRC_RGB", - "CULL_FACE_MODE", - "DEPTH_FUNC", - "FRONT_FACE", - "GENERATE_MIPMAP_HINT", - "FRAGMENT_SHADER_DERIVATIVE_HINT_OES", - "STENCIL_BACK_FAIL", - "STENCIL_BACK_FUNC", - "STENCIL_BACK_PASS_DEPTH_FAIL", - "STENCIL_BACK_PASS_DEPTH_PASS", - "STENCIL_FAIL", - "STENCIL_FUNC", - "STENCIL_PASS_DEPTH_FAIL", - "STENCIL_PASS_DEPTH_PASS", - "UNPACK_COLORSPACE_CONVERSION_WEBGL", - // gl.getBufferParameter() - "BUFFER_USAGE", - // gl.getFramebufferAttachmentParameter() - "FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE", - // gl.getRenderbufferParameter() - "RENDERBUFFER_INTERNAL_FORMAT", - // gl.getTexParameter() - "TEXTURE_MAG_FILTER", - "TEXTURE_MIN_FILTER", - "TEXTURE_WRAP_S", - "TEXTURE_WRAP_T", - // gl.getShaderParameter() - "SHADER_TYPE", - // gl.getVertexAttrib() - "VERTEX_ATTRIB_ARRAY_TYPE" -]); - -/** * @const * @type {!Object.<string, boolean>} */ @@ -2429,51 +1921,11 @@ WebGLRenderingContextResource.prototype = { /** * @param {string} name - * @param {Object} obj */ - registerWebGLExtension: function(name, obj) + addExtension: function(name) { // FIXME: Wrap OES_vertex_array_object extension. - var lowerName = name.toLowerCase(); - if (obj && !this._extensions[lowerName]) { - this._extensions[lowerName] = name; - for (var property in obj) { - if (TypeUtils.isEnumPropertyName(property, obj)) - this._extensionEnums[property] = /** @type {number} */ (obj[property]); - } - } - }, - - /** - * @param {string} name - * @return {number|undefined} - */ - _enumValueForName: function(name) - { - if (typeof this._extensionEnums[name] === "number") - return this._extensionEnums[name]; - var gl = this.wrappedObject(); - return (typeof gl[name] === "number" ? gl[name] : undefined); - }, - - /** - * @param {function(this:WebGLRenderingContext, T, number):*} func - * @param {T} targetOrWebGLObject - * @param {!Array.<string>} pnames - * @param {!Array.<TypeUtils.InternalResourceStateDescriptor>} output - * @template T - */ - queryStateValues: function(func, targetOrWebGLObject, pnames, output) - { - var gl = this.wrappedObject(); - for (var i = 0, pname; pname = pnames[i]; ++i) { - var enumValue = this._enumValueForName(pname); - if (typeof enumValue !== "number") - continue; - var value = func.call(gl, targetOrWebGLObject, enumValue); - value = Resource.forObject(value) || value; - output.push({ name: pname, value: value, valueIsEnum: WebGLRenderingContextResource.GetResultIsEnum[pname] }); - } + this._extensions[name.toLowerCase()] = true; }, /** @@ -2489,10 +1941,9 @@ WebGLRenderingContextResource.prototype = { function convertToStateDescriptors(obj, output) { for (var pname in obj) - output.push({ name: pname, value: obj[pname], valueIsEnum: WebGLRenderingContextResource.GetResultIsEnum[pname] }); + output.push({ name: pname, value: obj[pname] }); } - var gl = this.wrappedObject(); var glState = this._internalCurrentState(null); // VERTEX_ATTRIB_ARRAYS @@ -2517,30 +1968,13 @@ WebGLRenderingContextResource.prototype = { var result = []; convertToStateDescriptors(glState, result); - result.push({ name: "VERTEX_ATTRIB_ARRAYS", values: vertexAttribStates, isArray: true }); - result.push({ name: "TEXTURE_UNITS", values: textureUnits, isArray: true }); - - var textureBindingParameters = ["TEXTURE_BINDING_2D", "TEXTURE_BINDING_CUBE_MAP"]; - for (var i = 0, pname; pname = textureBindingParameters[i]; ++i) { - var value = gl.getParameter(gl[pname]); - value = Resource.forObject(value) || value; - result.push({ name: pname, value: value }); - } - - // ENABLED_EXTENSIONS - var enabledExtensions = []; - for (var lowerName in this._extensions) { - var pname = this._extensions[lowerName]; - var value = gl.getExtension(pname); - value = Resource.forObject(value) || value; - enabledExtensions.push({ name: pname, value: value }); - } - result.push({ name: "ENABLED_EXTENSIONS", values: enabledExtensions, isArray: true }); - + result.push({ name: "VERTEX_ATTRIB_ARRAYS[" + vertexAttribStates.length + "]", values: vertexAttribStates }); + result.push({ name: "TEXTURE_UNITS[" + textureUnits.length + "]", values: textureUnits }); return result; }, /** + * @override * @param {?Cache.<ReplayableResource>} cache * @return {!Object.<string, *>} */ @@ -2563,33 +1997,20 @@ WebGLRenderingContextResource.prototype = { WebGLRenderingContextResource.GLCapabilities.forEach(function(parameter) { glState[parameter] = gl.isEnabled(gl[parameter]); }); - for (var i = 0, pname; pname = WebGLRenderingContextResource.StateParameters[i]; ++i) { - var enumValue = this._enumValueForName(pname); - if (typeof enumValue === "number") - glState[pname] = maybeToReplayable(gl.getParameter(enumValue)); - } + WebGLRenderingContextResource.StateParameters.forEach(function(parameter) { + glState[parameter] = maybeToReplayable(gl.getParameter(gl[parameter])); + }); // VERTEX_ATTRIB_ARRAYS var maxVertexAttribs = /** @type {number} */ (gl.getParameter(gl.MAX_VERTEX_ATTRIBS)); - var vertexAttribParameters = [ - "VERTEX_ATTRIB_ARRAY_BUFFER_BINDING", - "VERTEX_ATTRIB_ARRAY_ENABLED", - "VERTEX_ATTRIB_ARRAY_SIZE", - "VERTEX_ATTRIB_ARRAY_STRIDE", - "VERTEX_ATTRIB_ARRAY_TYPE", - "VERTEX_ATTRIB_ARRAY_NORMALIZED", - "CURRENT_VERTEX_ATTRIB", - "VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE" // ANGLE_instanced_arrays extension - ]; + var vertexAttribParameters = ["VERTEX_ATTRIB_ARRAY_BUFFER_BINDING", "VERTEX_ATTRIB_ARRAY_ENABLED", "VERTEX_ATTRIB_ARRAY_SIZE", "VERTEX_ATTRIB_ARRAY_STRIDE", "VERTEX_ATTRIB_ARRAY_TYPE", "VERTEX_ATTRIB_ARRAY_NORMALIZED", "CURRENT_VERTEX_ATTRIB"]; var vertexAttribStates = []; - for (var index = 0; index < maxVertexAttribs; ++index) { + for (var i = 0; i < maxVertexAttribs; ++i) { var state = Object.create(null); - for (var i = 0, pname; pname = vertexAttribParameters[i]; ++i) { - var enumValue = this._enumValueForName(pname); - if (typeof enumValue === "number") - state[pname] = maybeToReplayable(gl.getVertexAttrib(index, enumValue)); - } - state.VERTEX_ATTRIB_ARRAY_POINTER = gl.getVertexAttribOffset(index, gl.VERTEX_ATTRIB_ARRAY_POINTER); + vertexAttribParameters.forEach(function(attribParameter) { + state[attribParameter] = maybeToReplayable(gl.getVertexAttrib(i, gl[attribParameter])); + }); + state.VERTEX_ATTRIB_ARRAY_POINTER = gl.getVertexAttribOffset(i, gl.VERTEX_ATTRIB_ARRAY_POINTER); vertexAttribStates.push(state); } glState.VERTEX_ATTRIB_ARRAYS = vertexAttribStates; @@ -2623,7 +2044,6 @@ WebGLRenderingContextResource.prototype = { data.originalCanvas = gl.canvas; data.originalContextAttributes = gl.getContextAttributes(); data.extensions = TypeUtils.cloneObject(this._extensions); - data.extensionEnums = TypeUtils.cloneObject(this._extensionEnums); data.glState = this._internalCurrentState(cache); }, @@ -2636,7 +2056,6 @@ WebGLRenderingContextResource.prototype = { { this._customErrors = null; this._extensions = TypeUtils.cloneObject(data.extensions) || {}; - this._extensionEnums = TypeUtils.cloneObject(data.extensionEnums) || {}; var canvas = data.originalCanvas.cloneNode(true); var replayContext = null; @@ -2684,10 +2103,6 @@ WebGLRenderingContextResource.prototype = { gl.hint(gl.GENERATE_MIPMAP_HINT, glState.GENERATE_MIPMAP_HINT); gl.lineWidth(glState.LINE_WIDTH); - var enumValue = this._enumValueForName("FRAGMENT_SHADER_DERIVATIVE_HINT_OES"); - if (typeof enumValue === "number") - gl.hint(enumValue, glState.FRAGMENT_SHADER_DERIVATIVE_HINT_OES); - WebGLRenderingContextResource.PixelStoreParameters.forEach(function(parameter) { gl.pixelStorei(gl[parameter], glState[parameter]); }); @@ -2795,30 +2210,6 @@ WebGLRenderingContextResource.prototype = { /** * @override - * @param {!Call} call - */ - onCallReplayed: function(call) - { - var functionName = call.functionName(); - var args = call.args(); - switch (functionName) { - case "bindBuffer": - case "bindFramebuffer": - case "bindRenderbuffer": - case "bindTexture": - // Update BINDING state for Resources in the replay world. - var resource = Resource.forObject(args[1]); - if (resource) - resource.pushBinding(args[0], functionName); - break; - case "getExtension": - this.registerWebGLExtension(args[0], /** @type {Object} */ (call.result())); - break; - } - }, - - /** - * @override * @return {!Object.<string, Function>} */ _customWrapFunctions: function() @@ -2833,7 +2224,7 @@ WebGLRenderingContextResource.prototype = { wrapFunctions["createTexture"] = Resource.WrapFunction.resourceFactoryMethod(WebGLTextureResource, "WebGLTexture"); wrapFunctions["createFramebuffer"] = Resource.WrapFunction.resourceFactoryMethod(WebGLFramebufferResource, "WebGLFramebuffer"); wrapFunctions["createRenderbuffer"] = Resource.WrapFunction.resourceFactoryMethod(WebGLRenderbufferResource, "WebGLRenderbuffer"); - wrapFunctions["getUniformLocation"] = Resource.WrapFunction.resourceFactoryMethod(WebGLUniformLocationResource, "WebGLUniformLocation"); + wrapFunctions["getUniformLocation"] = Resource.WrapFunction.resourceFactoryMethod(Resource, "WebGLUniformLocation"); /** * @param {string} methodName @@ -2903,7 +2294,7 @@ WebGLRenderingContextResource.prototype = { */ wrapFunctions["getExtension"] = function(name) { - this._resource.registerWebGLExtension(name, this.result()); + this._resource.addExtension(name); } // @@ -2949,7 +2340,6 @@ WebGLRenderingContextResource.prototype = { */ wrapFunctions["bindBuffer"] = wrapFunctions["bindFramebuffer"] = wrapFunctions["bindRenderbuffer"] = function(target, obj) { - this._resource.currentBinding(target); // To call WebGLBoundResource.prototype.pushBinding(). this._resource._registerBoundResource("__bindBuffer_" + target, obj); } /** @@ -2959,7 +2349,6 @@ WebGLRenderingContextResource.prototype = { */ wrapFunctions["bindTexture"] = function(target, obj) { - this._resource.currentBinding(target); // To call WebGLBoundResource.prototype.pushBinding(). var gl = /** @type {WebGLRenderingContext} */ (this._originalObject); var currentTextureBinding = /** @type {number} */ (gl.getParameter(gl.ACTIVE_TEXTURE)); this._resource._registerBoundResource("__bindTexture_" + target + "_" + currentTextureBinding, obj); @@ -3108,7 +2497,6 @@ CanvasRenderingContext2DResource.prototype = { var state = this._internalCurrentState(null); for (var pname in state) result.push({ name: pname, value: state[pname] }); - result.push({ name: "context", value: this.contextResource() }); return result; }, @@ -3428,36 +2816,31 @@ function CallFormatter(drawingMethodNames) CallFormatter.prototype = { /** * @param {!ReplayableCall} replayableCall - * @param {string=} objectGroup * @return {!Object} */ - formatCall: function(replayableCall, objectGroup) + formatCall: function(replayableCall) { var result = {}; var functionName = replayableCall.functionName(); if (functionName) { result.functionName = functionName; - result.arguments = []; - var args = replayableCall.args(); - for (var i = 0, n = args.length; i < n; ++i) - result.arguments.push(this.formatValue(args[i], objectGroup)); + result.arguments = replayableCall.args().map(this.formatValue.bind(this)); if (replayableCall.result() !== undefined) - result.result = this.formatValue(replayableCall.result(), objectGroup); + result.result = this.formatValue(replayableCall.result()); if (this._drawingMethodNames[functionName]) result.isDrawingCall = true; } else { result.property = replayableCall.propertyName(); - result.value = this.formatValue(replayableCall.propertyValue(), objectGroup); + result.value = this.formatValue(replayableCall.propertyValue()); } return result; }, /** * @param {*} value - * @param {string=} objectGroup * @return {!CanvasAgent.CallArgument} */ - formatValue: function(value, objectGroup) + formatValue: function(value) { if (value instanceof Resource || value instanceof ReplayableResource) { return { @@ -3466,70 +2849,31 @@ CallFormatter.prototype = { }; } - var remoteObject = injectedScript.wrapObject(value, objectGroup || "", true, false); - var description = remoteObject.description || ("" + value); - + var remoteObject = injectedScript.wrapObject(value, "", true, false); var result = { - description: description, + description: remoteObject.description || ("" + value), type: /** @type {CanvasAgent.CallArgumentType} */ (remoteObject.type) }; if (remoteObject.subtype) result.subtype = /** @type {CanvasAgent.CallArgumentSubtype} */ (remoteObject.subtype); - if (remoteObject.objectId) { - if (objectGroup) - result.remoteObject = remoteObject; - else - injectedScript.releaseObject(remoteObject.objectId); - } + if (remoteObject.objectId) + injectedScript.releaseObject(remoteObject.objectId); return result; }, /** - * @param {string} name - * @return {?string} - */ - enumValueForName: function(name) - { - return null; - }, - - /** - * @param {number} value - * @param {Array.<string>=} options - * @return {?string} - */ - enumNameForValue: function(value, options) - { - return null; - }, - - /** * @param {!Array.<TypeUtils.InternalResourceStateDescriptor>} descriptors - * @param {string=} objectGroup * @return {!Array.<!CanvasAgent.ResourceStateDescriptor>} */ - formatResourceStateDescriptors: function(descriptors, objectGroup) + convertResourceStateDescriptors: function(descriptors) { var result = []; for (var i = 0, n = descriptors.length; i < n; ++i) { var d = descriptors[i]; - var item; if (d.values) - item = { name: d.name, values: this.formatResourceStateDescriptors(d.values, objectGroup) }; - else { - item = { name: d.name, value: this.formatValue(d.value, objectGroup) }; - if (d.valueIsEnum && typeof d.value === "number") { - var enumName = this.enumNameForValue(d.value); - if (enumName) - item.value.enumName = enumName; - } - } - var enumValue = this.enumValueForName(d.name); - if (enumValue) - item.enumValueForName = enumValue; - if (d.isArray) - item.isArray = true; - result.push(item); + result.push({ name: d.name, values: this.convertResourceStateDescriptors(d.values) }); + else + result.push({ name: d.name, value: this.formatValue(d.value) }); } return result; } @@ -3652,12 +2996,11 @@ WebGLCallFormatter.prototype = { /** * @override * @param {!ReplayableCall} replayableCall - * @param {string=} objectGroup * @return {!Object} */ - formatCall: function(replayableCall, objectGroup) + formatCall: function(replayableCall) { - var result = CallFormatter.prototype.formatCall.call(this, replayableCall, objectGroup); + var result = CallFormatter.prototype.formatCall.call(this, replayableCall); if (!result.functionName) return result; var enumsInfo = this._findEnumsInfo(replayableCall); @@ -3667,52 +3010,23 @@ WebGLCallFormatter.prototype = { for (var i = 0, n = enumArgsIndexes.length; i < n; ++i) { var index = enumArgsIndexes[i]; var callArgument = result.arguments[index]; - this._formatEnumValue(callArgument, enumsInfo["hints"]); + if (callArgument && !isNaN(callArgument.description)) + callArgument.description = this._enumValueToString(+callArgument.description, enumsInfo["hints"]) || callArgument.description; } var bitfieldArgsIndexes = enumsInfo["bitfield"] || []; for (var i = 0, n = bitfieldArgsIndexes.length; i < n; ++i) { var index = bitfieldArgsIndexes[i]; var callArgument = result.arguments[index]; - this._formatEnumBitmaskValue(callArgument, enumsInfo["hints"]); + if (callArgument && !isNaN(callArgument.description)) + callArgument.description = this._enumBitmaskToString(+callArgument.description, enumsInfo["hints"]) || callArgument.description; } - if (enumsInfo.returnType === "enum") - this._formatEnumValue(result.result, enumsInfo["hints"]); - else if (enumsInfo.returnType === "bitfield") - this._formatEnumBitmaskValue(result.result, enumsInfo["hints"]); - return result; - }, - - /** - * @override - * @param {string} name - * @return {?string} - */ - enumValueForName: function(name) - { - this._initialize(); - if (name in this._enumNameToValue) - return "" + this._enumNameToValue[name]; - return null; - }, - - /** - * @override - * @param {number} value - * @param {Array.<string>=} options - * @return {?string} - */ - enumNameForValue: function(value, options) - { - this._initialize(); - options = options || []; - for (var i = 0, n = options.length; i < n; ++i) { - if (this._enumNameToValue[options[i]] === value) - return options[i]; + if (enumsInfo.returnType && result.result) { + if (enumsInfo.returnType === "enum") + result.result.description = this._enumValueToString(+result.result.description, enumsInfo["hints"]) || result.result.description; + else if (enumsInfo.returnType === "bitfield") + result.result.description = this._enumBitmaskToString(+result.result.description, enumsInfo["hints"]) || result.result.description; } - var names = this._enumValueToNames[value]; - if (!names || names.length !== 1) - return null; - return names[0]; + return result; }, /** @@ -3749,30 +3063,34 @@ WebGLCallFormatter.prototype = { }, /** - * @param {?CanvasAgent.CallArgument|undefined} callArgument + * @param {number} value * @param {Array.<string>=} options + * @return {string} */ - _formatEnumValue: function(callArgument, options) + _enumValueToString: function(value, options) { - if (!callArgument || isNaN(callArgument.description)) - return; this._initialize(); - var value = +callArgument.description; - var enumName = this.enumNameForValue(value, options); - if (enumName) - callArgument.enumName = enumName; + options = options || []; + for (var i = 0, n = options.length; i < n; ++i) { + if (this._enumNameToValue[options[i]] === value) + return options[i]; + } + var names = this._enumValueToNames[value]; + if (!names || names.length !== 1) { + console.warn("Ambiguous WebGL enum names for value " + value + ": " + names); + return ""; + } + return names[0]; }, /** - * @param {?CanvasAgent.CallArgument|undefined} callArgument + * @param {number} value * @param {Array.<string>=} options + * @return {string} */ - _formatEnumBitmaskValue: function(callArgument, options) + _enumBitmaskToString: function(value, options) { - if (!callArgument || isNaN(callArgument.description)) - return; this._initialize(); - var value = +callArgument.description; options = options || []; /** @type {!Array.<string>} */ var result = []; @@ -3789,13 +3107,13 @@ WebGLCallFormatter.prototype = { var names = this._enumValueToNames[bitValue]; if (!names || names.length !== 1) { console.warn("Ambiguous WebGL enum names for value " + bitValue + ": " + names); - return; + return ""; } result.push(names[0]); value = nextValue; } result.sort(); - callArgument.enumName = result.join(" | "); + return result.join(" | "); }, _initialize: function() @@ -3817,7 +3135,7 @@ WebGLCallFormatter.prototype = { if (!obj) return; for (var property in obj) { - if (TypeUtils.isEnumPropertyName(property, obj)) { + if (/^[A-Z0-9_]+$/.test(property) && typeof obj[property] === "number") { var value = /** @type {number} */ (obj[property]); this._enumNameToValue[property] = value; var names = this._enumValueToNames[value]; @@ -4253,7 +3571,6 @@ InjectedCanvasModule.prototype = { this._manager.dropTraceLog(traceLog); delete this._traceLogs[id]; delete this._traceLogPlayers[id]; - injectedScript.releaseObjectGroup(id); }, /** @@ -4326,8 +3643,6 @@ InjectedCanvasModule.prototype = { return "Error: Trace log with the given ID not found."; this._traceLogPlayers[traceLogId] = this._traceLogPlayers[traceLogId] || new TraceLogPlayer(traceLog); - injectedScript.releaseObjectGroup(traceLogId); - var beforeTime = TypeUtils.now(); var lastCall = this._traceLogPlayers[traceLogId].stepTo(stepNo); var replayTime = Math.max(0, TypeUtils.now() - beforeTime); @@ -4432,7 +3747,7 @@ InjectedCanvasModule.prototype = { }; if (resource) { result.imageURL = overrideImageURL || resource.toDataURL(); - result.descriptors = CallFormatter.forResource(resource).formatResourceStateDescriptors(resource.currentState(), traceLogId); + result.descriptors = CallFormatter.forResource(resource).convertResourceStateDescriptors(resource.currentState()); } return result; }, diff --git a/chromium/third_party/WebKit/Source/core/inspector/InjectedScriptSource.js b/chromium/third_party/WebKit/Source/core/inspector/InjectedScriptSource.js index 49b35ba0992..437ea48932c 100644 --- a/chromium/third_party/WebKit/Source/core/inspector/InjectedScriptSource.js +++ b/chromium/third_party/WebKit/Source/core/inspector/InjectedScriptSource.js @@ -939,7 +939,7 @@ InjectedScript.RemoteObject.prototype = { * @param {Object} object * @param {Array.<string>=} firstLevelKeys * @param {?Array.<string>=} secondLevelKeys - * @return {!RuntimeAgent.ObjectPreview} preview + * @return {Object} preview */ _generatePreview: function(object, firstLevelKeys, secondLevelKeys) { @@ -956,20 +956,20 @@ InjectedScript.RemoteObject.prototype = { indexes: isTableRowsRequest ? 1000 : Math.max(100, firstLevelKeysCount) }; for (var o = object; injectedScript._isDefined(o); o = o.__proto__) - this._generateProtoPreview(/** @type {!Object} */ (o), preview, propertiesThreshold, firstLevelKeys, secondLevelKeys); + this._generateProtoPreview(o, preview, propertiesThreshold, firstLevelKeys, secondLevelKeys); return preview; }, /** - * @param {!Object} object - * @param {!RuntimeAgent.ObjectPreview} preview - * @param {!Object} propertiesThreshold + * @param {Object} object + * @param {Object} preview + * @param {Object} propertiesThreshold * @param {Array.<string>=} firstLevelKeys * @param {Array.<string>=} secondLevelKeys */ _generateProtoPreview: function(object, preview, propertiesThreshold, firstLevelKeys, secondLevelKeys) { - var propertyNames = firstLevelKeys ? firstLevelKeys : Object.keys(object); + var propertyNames = firstLevelKeys ? firstLevelKeys : Object.keys(/** @type {!Object} */ (object)); try { for (var i = 0; i < propertyNames.length; ++i) { if (!propertiesThreshold.properties || !propertiesThreshold.indexes) { @@ -981,7 +981,7 @@ InjectedScript.RemoteObject.prototype = { if (this.subtype === "array" && name === "length") continue; - var descriptor = Object.getOwnPropertyDescriptor(object, name); + var descriptor = Object.getOwnPropertyDescriptor(/** @type {!Object} */ (object), name); if (!("value" in descriptor) || !descriptor.enumerable) { preview.lossless = false; continue; @@ -1036,9 +1036,9 @@ InjectedScript.RemoteObject.prototype = { }, /** - * @param {!RuntimeAgent.ObjectPreview} preview - * @param {!Object} property - * @param {!Object} propertiesThreshold + * @param {Object} preview + * @param {Object} property + * @param {Object} propertiesThreshold */ _appendPropertyPreview: function(preview, property, propertiesThreshold) { diff --git a/chromium/third_party/WebKit/Source/core/inspector/InspectorController.cpp b/chromium/third_party/WebKit/Source/core/inspector/InspectorController.cpp index fdb31a51c32..a9cb37b199a 100644 --- a/chromium/third_party/WebKit/Source/core/inspector/InspectorController.cpp +++ b/chromium/third_party/WebKit/Source/core/inspector/InspectorController.cpp @@ -322,15 +322,6 @@ Node* InspectorController::highlightedNode() const return m_overlay->highlightedNode(); } -bool InspectorController::handleGestureEvent(Frame* frame, const PlatformGestureEvent& event) -{ - // Overlay should not consume events. - m_overlay->handleGestureEvent(event); - if (InspectorDOMAgent* domAgent = m_instrumentingAgents->inspectorDOMAgent()) - return domAgent->handleGestureEvent(frame, event); - return false; -} - bool InspectorController::handleMouseEvent(Frame* frame, const PlatformMouseEvent& event) { // Overlay should not consume events. diff --git a/chromium/third_party/WebKit/Source/core/inspector/InspectorController.h b/chromium/third_party/WebKit/Source/core/inspector/InspectorController.h index 95f036886a2..42f224add2a 100644 --- a/chromium/third_party/WebKit/Source/core/inspector/InspectorController.h +++ b/chromium/third_party/WebKit/Source/core/inspector/InspectorController.h @@ -55,7 +55,6 @@ class InspectorState; class InstrumentingAgents; class IntSize; class Page; -class PlatformGestureEvent; class PlatformMouseEvent; class PlatformTouchEvent; class PostWorkerNotificationToFrontendTask; @@ -95,7 +94,6 @@ public: void hideHighlight(); Node* highlightedNode() const; - bool handleGestureEvent(Frame*, const PlatformGestureEvent&); bool handleMouseEvent(Frame*, const PlatformMouseEvent&); bool handleTouchEvent(Frame*, const PlatformTouchEvent&); diff --git a/chromium/third_party/WebKit/Source/core/inspector/InspectorDOMAgent.cpp b/chromium/third_party/WebKit/Source/core/inspector/InspectorDOMAgent.cpp index 39976bdf548..a4f32e2453b 100644 --- a/chromium/third_party/WebKit/Source/core/inspector/InspectorDOMAgent.cpp +++ b/chromium/third_party/WebKit/Source/core/inspector/InspectorDOMAgent.cpp @@ -70,7 +70,6 @@ #include "core/page/Frame.h" #include "core/page/FrameTree.h" #include "core/page/Page.h" -#include "core/platform/PlatformGestureEvent.h" #include "core/platform/PlatformMouseEvent.h" #include "core/platform/PlatformTouchEvent.h" #include "core/rendering/HitTestResult.h" @@ -163,11 +162,6 @@ static Node* hoveredNodeForPoint(Frame* frame, const IntPoint& point, bool ignor return node; } -static Node* hoveredNodeForEvent(Frame* frame, const PlatformGestureEvent& event, bool ignorePointerEventsNone) -{ - return hoveredNodeForPoint(frame, event.position(), ignorePointerEventsNone); -} - static Node* hoveredNodeForEvent(Frame* frame, const PlatformMouseEvent& event, bool ignorePointerEventsNone) { return hoveredNodeForPoint(frame, event.position(), ignorePointerEventsNone); @@ -1059,19 +1053,6 @@ bool InspectorDOMAgent::handleMousePress() return false; } -bool InspectorDOMAgent::handleGestureEvent(Frame* frame, const PlatformGestureEvent& event) -{ - if (m_searchingForNode == NotSearching || event.type() != PlatformEvent::GestureTap) - return false; - Node* node = hoveredNodeForEvent(frame, event, false); - if (node && m_inspectModeHighlightConfig) { - m_overlay->highlightNode(node, 0 /* eventTarget */, *m_inspectModeHighlightConfig); - inspect(node); - return true; - } - return false; -} - bool InspectorDOMAgent::handleTouchEvent(Frame* frame, const PlatformTouchEvent& event) { if (m_searchingForNode == NotSearching) diff --git a/chromium/third_party/WebKit/Source/core/inspector/InspectorDOMAgent.h b/chromium/third_party/WebKit/Source/core/inspector/InspectorDOMAgent.h index 6cba33dc2fa..e0a0362425e 100644 --- a/chromium/third_party/WebKit/Source/core/inspector/InspectorDOMAgent.h +++ b/chromium/third_party/WebKit/Source/core/inspector/InspectorDOMAgent.h @@ -60,7 +60,6 @@ class InspectorPageAgent; class InspectorState; class InstrumentingAgents; class Node; -class PlatformGestureEvent; class PlatformTouchEvent; class RevalidateStyleAttributeTask; class ShadowRoot; @@ -181,7 +180,6 @@ public: PassRefPtr<TypeBuilder::Runtime::RemoteObject> resolveNode(Node*, const String& objectGroup); bool handleMousePress(); - bool handleGestureEvent(Frame*, const PlatformGestureEvent&); bool handleTouchEvent(Frame*, const PlatformTouchEvent&); void handleMouseMove(Frame*, const PlatformMouseEvent&); diff --git a/chromium/third_party/WebKit/Source/core/inspector/InspectorDebuggerAgent.cpp b/chromium/third_party/WebKit/Source/core/inspector/InspectorDebuggerAgent.cpp index 19d838035b3..9f260a48355 100644 --- a/chromium/third_party/WebKit/Source/core/inspector/InspectorDebuggerAgent.cpp +++ b/chromium/third_party/WebKit/Source/core/inspector/InspectorDebuggerAgent.cpp @@ -34,7 +34,6 @@ #include "InspectorFrontend.h" #include "bindings/v8/ScriptDebugServer.h" #include "bindings/v8/ScriptObject.h" -#include "core/fetch/Resource.h" #include "core/inspector/ContentSearchUtils.h" #include "core/inspector/InjectedScript.h" #include "core/inspector/InjectedScriptManager.h" @@ -43,6 +42,7 @@ #include "core/inspector/InstrumentingAgents.h" #include "core/inspector/ScriptArguments.h" #include "core/inspector/ScriptCallStack.h" +#include "core/loader/cache/Resource.h" #include "core/platform/JSONValues.h" #include "core/platform/text/RegularExpression.h" #include "wtf/text/WTFString.h" diff --git a/chromium/third_party/WebKit/Source/core/inspector/InspectorFrontendHost.cpp b/chromium/third_party/WebKit/Source/core/inspector/InspectorFrontendHost.cpp index 6f0d3bf04bd..333afc2baca 100644 --- a/chromium/third_party/WebKit/Source/core/inspector/InspectorFrontendHost.cpp +++ b/chromium/third_party/WebKit/Source/core/inspector/InspectorFrontendHost.cpp @@ -247,7 +247,8 @@ void InspectorFrontendHost::showContextMenu(Event* event, const Vector<ContextMe return; } RefPtr<FrontendMenuProvider> menuProvider = FrontendMenuProvider::create(this, frontendApiObject, items); - m_frontendPage->contextMenuController().showContextMenu(event, menuProvider); + ContextMenuController* menuController = m_frontendPage->contextMenuController(); + menuController->showContextMenu(event, menuProvider); m_menuProvider = menuProvider.get(); } diff --git a/chromium/third_party/WebKit/Source/core/inspector/InspectorInstrumentation.cpp b/chromium/third_party/WebKit/Source/core/inspector/InspectorInstrumentation.cpp index 2f16ff13169..5cffed0ac74 100644 --- a/chromium/third_party/WebKit/Source/core/inspector/InspectorInstrumentation.cpp +++ b/chromium/third_party/WebKit/Source/core/inspector/InspectorInstrumentation.cpp @@ -31,7 +31,6 @@ #include "config.h" #include "core/inspector/InspectorInstrumentation.h" -#include "core/fetch/FetchInitiatorInfo.h" #include "core/inspector/InspectorAgent.h" #include "core/inspector/InspectorCSSAgent.h" #include "core/inspector/InspectorConsoleAgent.h" @@ -42,6 +41,7 @@ #include "core/inspector/InspectorTimelineAgent.h" #include "core/inspector/InstrumentingAgents.h" #include "core/inspector/WorkerInspectorController.h" +#include "core/loader/cache/FetchInitiatorInfo.h" #include "core/workers/WorkerGlobalScope.h" namespace WebCore { diff --git a/chromium/third_party/WebKit/Source/core/inspector/InspectorOverlay.cpp b/chromium/third_party/WebKit/Source/core/inspector/InspectorOverlay.cpp index 6ac89394e66..25ea756f3f4 100644 --- a/chromium/third_party/WebKit/Source/core/inspector/InspectorOverlay.cpp +++ b/chromium/third_party/WebKit/Source/core/inspector/InspectorOverlay.cpp @@ -255,14 +255,6 @@ void InspectorOverlay::invalidate() m_client->highlight(); } -bool InspectorOverlay::handleGestureEvent(const PlatformGestureEvent& event) -{ - if (isEmpty()) - return false; - - return overlayPage()->mainFrame()->eventHandler()->handleGestureEvent(event); -} - bool InspectorOverlay::handleMouseEvent(const PlatformMouseEvent& event) { if (isEmpty()) diff --git a/chromium/third_party/WebKit/Source/core/inspector/InspectorOverlay.h b/chromium/third_party/WebKit/Source/core/inspector/InspectorOverlay.h index 2defc500952..a9863eeba81 100644 --- a/chromium/third_party/WebKit/Source/core/inspector/InspectorOverlay.h +++ b/chromium/third_party/WebKit/Source/core/inspector/InspectorOverlay.h @@ -49,7 +49,6 @@ class InspectorOverlayHost; class JSONValue; class Node; class Page; -class PlatformGestureEvent; class PlatformMouseEvent; class PlatformTouchEvent; @@ -127,7 +126,6 @@ public: void drawOutline(GraphicsContext*, const LayoutRect&, const Color&); void getHighlight(Highlight*) const; void resize(const IntSize&); - bool handleGestureEvent(const PlatformGestureEvent&); bool handleMouseEvent(const PlatformMouseEvent&); bool handleTouchEvent(const PlatformTouchEvent&); diff --git a/chromium/third_party/WebKit/Source/core/inspector/InspectorPageAgent.cpp b/chromium/third_party/WebKit/Source/core/inspector/InspectorPageAgent.cpp index a428616881b..9a939cdd47f 100644 --- a/chromium/third_party/WebKit/Source/core/inspector/InspectorPageAgent.cpp +++ b/chromium/third_party/WebKit/Source/core/inspector/InspectorPageAgent.cpp @@ -39,13 +39,6 @@ #include "core/dom/DeviceOrientationController.h" #include "core/dom/Document.h" #include "core/dom/UserGestureIndicator.h" -#include "core/fetch/CSSStyleSheetResource.h" -#include "core/fetch/FontResource.h" -#include "core/fetch/ImageResource.h" -#include "core/fetch/MemoryCache.h" -#include "core/fetch/Resource.h" -#include "core/fetch/ResourceFetcher.h" -#include "core/fetch/ScriptResource.h" #include "core/html/HTMLFrameOwnerElement.h" #include "core/inspector/ContentSearchUtils.h" #include "core/inspector/DOMPatchSupport.h" @@ -61,6 +54,13 @@ #include "core/loader/FrameLoadRequest.h" #include "core/loader/FrameLoader.h" #include "core/loader/TextResourceDecoder.h" +#include "core/loader/cache/CSSStyleSheetResource.h" +#include "core/loader/cache/FontResource.h" +#include "core/loader/cache/ImageResource.h" +#include "core/loader/cache/MemoryCache.h" +#include "core/loader/cache/Resource.h" +#include "core/loader/cache/ResourceFetcher.h" +#include "core/loader/cache/ScriptResource.h" #include "core/page/Frame.h" #include "core/page/FrameView.h" #include "core/page/Page.h" @@ -396,7 +396,7 @@ void InspectorPageAgent::disable(ErrorString*) setShowPaintRects(0, false); setShowDebugBorders(0, false); setShowFPSCounter(0, false); - setEmulatedMedia(0, String()); + setEmulatedMedia(0, ""); setContinuousPaintingEnabled(0, false); setShowScrollBottleneckRects(0, false); setShowViewportSizeOnResize(0, false, 0); @@ -693,7 +693,7 @@ bool InspectorPageAgent::deviceMetricsChanged(int width, int height, double font // These two always fit an int. int currentWidth = static_cast<int>(m_state->getLong(PageAgentState::pageAgentScreenWidthOverride)); int currentHeight = static_cast<int>(m_state->getLong(PageAgentState::pageAgentScreenHeightOverride)); - double currentFontScaleFactor = m_state->getDouble(PageAgentState::pageAgentFontScaleFactorOverride, 1); + double currentFontScaleFactor = m_state->getDouble(PageAgentState::pageAgentFontScaleFactorOverride); bool currentFitWindow = m_state->getBoolean(PageAgentState::pageAgentFitWindow); return width != currentWidth || height != currentHeight || fontScaleFactor != currentFontScaleFactor || fitWindow != currentFitWindow; diff --git a/chromium/third_party/WebKit/Source/core/inspector/InspectorProfilerAgent.cpp b/chromium/third_party/WebKit/Source/core/inspector/InspectorProfilerAgent.cpp index 953542430d8..d0375e75011 100644 --- a/chromium/third_party/WebKit/Source/core/inspector/InspectorProfilerAgent.cpp +++ b/chromium/third_party/WebKit/Source/core/inspector/InspectorProfilerAgent.cpp @@ -162,6 +162,7 @@ void InspectorProfilerAgent::getCPUProfile(ErrorString* errorString, int rawUid, } profileObject = TypeBuilder::Profiler::CPUProfile::create() .setHead(it->value->buildInspectorObjectForHead()) + .setIdleTime(it->value->idleTime()) .setStartTime(it->value->startTime()) .setEndTime(it->value->endTime()); profileObject->setSamples(it->value->buildInspectorObjectForSamples()); @@ -268,7 +269,6 @@ void InspectorProfilerAgent::willProcessTask() { if (!m_profileNameIdleTimeMap || !m_profileNameIdleTimeMap->size()) return; - ScriptProfiler::setIdle(false); if (!m_previousTaskEndTime) return; @@ -284,7 +284,6 @@ void InspectorProfilerAgent::didProcessTask() if (!m_profileNameIdleTimeMap || !m_profileNameIdleTimeMap->size()) return; m_previousTaskEndTime = WTF::monotonicallyIncreasingTime(); - ScriptProfiler::setIdle(true); } } // namespace WebCore diff --git a/chromium/third_party/WebKit/Source/core/inspector/InspectorResourceAgent.cpp b/chromium/third_party/WebKit/Source/core/inspector/InspectorResourceAgent.cpp index 1b6317af76d..14c54bb35a2 100644 --- a/chromium/third_party/WebKit/Source/core/inspector/InspectorResourceAgent.cpp +++ b/chromium/third_party/WebKit/Source/core/inspector/InspectorResourceAgent.cpp @@ -36,10 +36,6 @@ #include "bindings/v8/ScriptCallStackFactory.h" #include "core/dom/Document.h" #include "core/dom/ScriptableDocumentParser.h" -#include "core/fetch/FetchInitiatorInfo.h" -#include "core/fetch/MemoryCache.h" -#include "core/fetch/Resource.h" -#include "core/fetch/ResourceLoader.h" #include "core/inspector/IdentifiersFactory.h" #include "core/inspector/InspectorClient.h" #include "core/inspector/InspectorOverlay.h" @@ -51,8 +47,12 @@ #include "core/loader/DocumentLoader.h" #include "core/loader/DocumentThreadableLoader.h" #include "core/loader/FrameLoader.h" +#include "core/loader/ResourceLoader.h" #include "core/loader/ThreadableLoader.h" #include "core/loader/ThreadableLoaderClient.h" +#include "core/loader/cache/FetchInitiatorInfo.h" +#include "core/loader/cache/MemoryCache.h" +#include "core/loader/cache/Resource.h" #include "core/page/Frame.h" #include "core/page/Page.h" #include "core/platform/JSONValues.h" diff --git a/chromium/third_party/WebKit/Source/core/inspector/InspectorState.cpp b/chromium/third_party/WebKit/Source/core/inspector/InspectorState.cpp index 8e25c288f78..2ed6d20664c 100644 --- a/chromium/third_party/WebKit/Source/core/inspector/InspectorState.cpp +++ b/chromium/third_party/WebKit/Source/core/inspector/InspectorState.cpp @@ -84,14 +84,8 @@ String InspectorState::getString(const String& propertyName) long InspectorState::getLong(const String& propertyName) { - return getLong(propertyName, 0); -} - - -long InspectorState::getLong(const String& propertyName, long defaultValue) -{ JSONObject::iterator it = m_properties->find(propertyName); - long value = defaultValue; + long value = 0; if (it != m_properties->end()) it->value->asNumber(&value); return value; @@ -99,13 +93,8 @@ long InspectorState::getLong(const String& propertyName, long defaultValue) double InspectorState::getDouble(const String& propertyName) { - return getDouble(propertyName, 0); -} - -double InspectorState::getDouble(const String& propertyName, double defaultValue) -{ JSONObject::iterator it = m_properties->find(propertyName); - double value = defaultValue; + double value = 0; if (it != m_properties->end()) it->value->asNumber(&value); return value; diff --git a/chromium/third_party/WebKit/Source/core/inspector/InspectorState.h b/chromium/third_party/WebKit/Source/core/inspector/InspectorState.h index 0679736b33d..7fe1f500d5d 100644 --- a/chromium/third_party/WebKit/Source/core/inspector/InspectorState.h +++ b/chromium/third_party/WebKit/Source/core/inspector/InspectorState.h @@ -60,9 +60,7 @@ public: bool getBoolean(const String& propertyName); String getString(const String& propertyName); long getLong(const String& propertyName); - long getLong(const String& propertyName, long defaultValue); double getDouble(const String& propertyName); - double getDouble(const String& propertyName, double defaultValue); PassRefPtr<JSONObject> getObject(const String& propertyName); void setBoolean(const String& propertyName, bool value) { setValue(propertyName, JSONBasicValue::create(value)); } diff --git a/chromium/third_party/WebKit/Source/core/inspector/NetworkResourcesData.cpp b/chromium/third_party/WebKit/Source/core/inspector/NetworkResourcesData.cpp index f5c8abefe9e..cc210a91a6b 100644 --- a/chromium/third_party/WebKit/Source/core/inspector/NetworkResourcesData.cpp +++ b/chromium/third_party/WebKit/Source/core/inspector/NetworkResourcesData.cpp @@ -30,8 +30,8 @@ #include "core/inspector/NetworkResourcesData.h" #include "core/dom/DOMImplementation.h" -#include "core/fetch/Resource.h" #include "core/loader/TextResourceDecoder.h" +#include "core/loader/cache/Resource.h" #include "core/platform/SharedBuffer.h" #include "core/platform/network/ResourceResponse.h" diff --git a/chromium/third_party/WebKit/Source/core/inspector/ScriptProfile.cpp b/chromium/third_party/WebKit/Source/core/inspector/ScriptProfile.cpp index 5db3af7bf14..513586b69f2 100644 --- a/chromium/third_party/WebKit/Source/core/inspector/ScriptProfile.cpp +++ b/chromium/third_party/WebKit/Source/core/inspector/ScriptProfile.cpp @@ -85,7 +85,7 @@ static PassRefPtr<TypeBuilder::Profiler::CPUProfileNode> buildInspectorObjectFor .setScriptId(String::number(node->GetScriptId())) .setUrl(toWebCoreString(node->GetScriptResourceName())) .setLineNumber(node->GetLineNumber()) - .setHitCount(node->GetHitCount()) + .setHitCount(node->GetSelfSamplesCount()) .setCallUID(node->GetCallUid()) .setChildren(children.release()); result->setId(node->GetNodeId()); diff --git a/chromium/third_party/WebKit/Source/core/loader/CrossOriginAccessControl.cpp b/chromium/third_party/WebKit/Source/core/loader/CrossOriginAccessControl.cpp index edfbb620835..6c4fbf0f83c 100644 --- a/chromium/third_party/WebKit/Source/core/loader/CrossOriginAccessControl.cpp +++ b/chromium/third_party/WebKit/Source/core/loader/CrossOriginAccessControl.cpp @@ -148,24 +148,17 @@ bool passesAccessControlCheck(const ResourceResponse& response, StoredCredential // FIXME: Access-Control-Allow-Origin can contain a list of origins. if (accessControlOriginString != securityOrigin->toString()) { - if (accessControlOriginString == "*") { - errorDescription = "Wildcards cannot be used in the 'Access-Control-Allow-Origin' header when the credentials flag is true. Origin '" + securityOrigin->toString() + "' is therefore not allowed access."; - } else if (accessControlOriginString.isEmpty()) { - errorDescription = "No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin '" + securityOrigin->toString() + "' is therefore not allowed access."; - } else { - KURL headerOrigin(KURL(), accessControlOriginString); - if (!headerOrigin.isValid()) - errorDescription = "The 'Access-Control-Allow-Origin' header contains the invalid value '" + accessControlOriginString + "'. Origin '" + securityOrigin->toString() + "' is therefore not allowed access."; - else - errorDescription = "The 'Access-Control-Allow-Origin' whitelists only '" + accessControlOriginString + "'. Origin '" + securityOrigin->toString() + "' is not in the list, and is therefore not allowed access."; - } + if (accessControlOriginString == "*") + errorDescription = "Cannot use wildcard in Access-Control-Allow-Origin when credentials flag is true."; + else + errorDescription = "Origin " + securityOrigin->toString() + " is not allowed by Access-Control-Allow-Origin."; return false; } if (includeCredentials == AllowStoredCredentials) { const String& accessControlCredentialsString = response.httpHeaderField(accessControlAllowCredentials); if (accessControlCredentialsString != "true") { - errorDescription = "Credentials flag is 'true', but the 'Access-Control-Allow-Credentials' header is '" + accessControlCredentialsString + "'. It must be 'true' to allow credentials."; + errorDescription = "Credentials flag is true, but Access-Control-Allow-Credentials is not \"true\"."; return false; } } diff --git a/chromium/third_party/WebKit/Source/core/loader/CrossOriginAccessControl.h b/chromium/third_party/WebKit/Source/core/loader/CrossOriginAccessControl.h index 0d58400e69c..a660e01f3fc 100644 --- a/chromium/third_party/WebKit/Source/core/loader/CrossOriginAccessControl.h +++ b/chromium/third_party/WebKit/Source/core/loader/CrossOriginAccessControl.h @@ -27,7 +27,7 @@ #ifndef CrossOriginAccessControl_h #define CrossOriginAccessControl_h -#include "core/fetch/ResourceLoaderOptions.h" +#include "core/loader/ResourceLoaderOptions.h" #include "core/platform/network/ResourceRequest.h" #include "wtf/Forward.h" #include "wtf/HashSet.h" diff --git a/chromium/third_party/WebKit/Source/core/loader/CrossOriginPreflightResultCache.h b/chromium/third_party/WebKit/Source/core/loader/CrossOriginPreflightResultCache.h index 3911a2c1373..0006d48b7d8 100644 --- a/chromium/third_party/WebKit/Source/core/loader/CrossOriginPreflightResultCache.h +++ b/chromium/third_party/WebKit/Source/core/loader/CrossOriginPreflightResultCache.h @@ -27,7 +27,7 @@ #ifndef CrossOriginPreflightResultCache_h #define CrossOriginPreflightResultCache_h -#include "core/fetch/ResourceLoaderOptions.h" +#include "core/loader/ResourceLoaderOptions.h" #include "weborigin/KURLHash.h" #include "wtf/HashMap.h" #include "wtf/HashSet.h" diff --git a/chromium/third_party/WebKit/Source/core/loader/DocumentLoader.cpp b/chromium/third_party/WebKit/Source/core/loader/DocumentLoader.cpp index 73f7c6e4040..bb5a31827b3 100644 --- a/chromium/third_party/WebKit/Source/core/loader/DocumentLoader.cpp +++ b/chromium/third_party/WebKit/Source/core/loader/DocumentLoader.cpp @@ -36,20 +36,20 @@ #include "core/dom/Document.h" #include "core/dom/DocumentParser.h" #include "core/dom/Event.h" -#include "core/fetch/MemoryCache.h" -#include "core/fetch/ResourceFetcher.h" -#include "core/fetch/ResourceLoader.h" #include "core/html/HTMLFrameOwnerElement.h" #include "core/inspector/InspectorInstrumentation.h" #include "core/loader/DocumentWriter.h" #include "core/loader/FrameLoader.h" #include "core/loader/FrameLoaderClient.h" +#include "core/loader/ResourceLoader.h" #include "core/loader/SinkDocument.h" #include "core/loader/TextResourceDecoder.h" #include "core/loader/UniqueIdentifier.h" #include "core/loader/appcache/ApplicationCacheHost.h" #include "core/loader/archive/ArchiveResourceCollection.h" #include "core/loader/archive/MHTMLArchive.h" +#include "core/loader/cache/MemoryCache.h" +#include "core/loader/cache/ResourceFetcher.h" #include "core/page/DOMWindow.h" #include "core/page/Frame.h" #include "core/page/FrameTree.h" @@ -240,7 +240,7 @@ void DocumentLoader::stopLoading() Document* doc = m_frame->document(); if (loading || doc->parsing()) - m_frame->loader()->stopLoading(); + m_frame->loader()->stopLoading(UnloadEventPolicyNone); } // Always cancel multipart loaders @@ -807,6 +807,15 @@ bool DocumentLoader::scheduleArchiveLoad(Resource* cachedResource, const Resourc return true; } +void DocumentLoader::setTitle(const StringWithDirection& title) +{ + if (m_pageTitle == title) + return; + + m_pageTitle = title; + frameLoader()->didChangeTitle(this); +} + KURL DocumentLoader::urlForHistory() const { // Return the URL to be used for history and B/F list. diff --git a/chromium/third_party/WebKit/Source/core/loader/DocumentLoader.h b/chromium/third_party/WebKit/Source/core/loader/DocumentLoader.h index 9797bbf56cc..112292e661e 100644 --- a/chromium/third_party/WebKit/Source/core/loader/DocumentLoader.h +++ b/chromium/third_party/WebKit/Source/core/loader/DocumentLoader.h @@ -30,13 +30,13 @@ #ifndef DocumentLoader_h #define DocumentLoader_h -#include "core/fetch/RawResource.h" -#include "core/fetch/ResourceLoaderOptions.h" -#include "core/fetch/ResourcePtr.h" #include "core/loader/DocumentLoadTiming.h" #include "core/loader/DocumentWriter.h" #include "core/loader/NavigationAction.h" +#include "core/loader/ResourceLoaderOptions.h" #include "core/loader/SubstituteData.h" +#include "core/loader/cache/RawResource.h" +#include "core/loader/cache/ResourcePtr.h" #include "core/platform/Timer.h" #include "core/platform/network/ResourceError.h" #include "core/platform/network/ResourceRequest.h" @@ -120,6 +120,7 @@ namespace WebCore { bool replacesCurrentHistoryItem() const { return m_replacesCurrentHistoryItem; } void setReplacesCurrentHistoryItem(bool replacesCurrentHistoryItem) { m_replacesCurrentHistoryItem = replacesCurrentHistoryItem; } bool isLoadingInAPISense() const; + void setTitle(const StringWithDirection&); const String& overrideEncoding() const { return m_overrideEncoding; } bool scheduleArchiveLoad(Resource*, const ResourceRequest&); @@ -134,6 +135,7 @@ namespace WebCore { void setTriggeringAction(const NavigationAction& action) { m_triggeringAction = action; } void setOverrideEncoding(const String& encoding) { m_overrideEncoding = encoding; } + const StringWithDirection& title() const { return m_pageTitle; } KURL urlForHistory() const; @@ -249,6 +251,8 @@ namespace WebCore { bool m_isClientRedirect; bool m_replacesCurrentHistoryItem; + StringWithDirection m_pageTitle; + String m_overrideEncoding; // The action that triggered loading - we keep this around for the diff --git a/chromium/third_party/WebKit/Source/core/loader/DocumentThreadableLoader.cpp b/chromium/third_party/WebKit/Source/core/loader/DocumentThreadableLoader.cpp index f8e5c83c26b..f7e05443729 100644 --- a/chromium/third_party/WebKit/Source/core/loader/DocumentThreadableLoader.cpp +++ b/chromium/third_party/WebKit/Source/core/loader/DocumentThreadableLoader.cpp @@ -33,15 +33,15 @@ #include "core/loader/DocumentThreadableLoader.h" #include "core/dom/Document.h" -#include "core/fetch/FetchRequest.h" -#include "core/fetch/RawResource.h" -#include "core/fetch/ResourceFetcher.h" #include "core/inspector/InspectorInstrumentation.h" #include "core/loader/CrossOriginAccessControl.h" #include "core/loader/CrossOriginPreflightResultCache.h" #include "core/loader/DocumentThreadableLoaderClient.h" #include "core/loader/FrameLoader.h" #include "core/loader/ThreadableLoaderClient.h" +#include "core/loader/cache/FetchRequest.h" +#include "core/loader/cache/RawResource.h" +#include "core/loader/cache/ResourceFetcher.h" #include "core/page/ContentSecurityPolicy.h" #include "core/page/Frame.h" #include "core/platform/network/ResourceError.h" diff --git a/chromium/third_party/WebKit/Source/core/loader/DocumentThreadableLoader.h b/chromium/third_party/WebKit/Source/core/loader/DocumentThreadableLoader.h index 4e44cfb60e6..06e85eb31e7 100644 --- a/chromium/third_party/WebKit/Source/core/loader/DocumentThreadableLoader.h +++ b/chromium/third_party/WebKit/Source/core/loader/DocumentThreadableLoader.h @@ -32,9 +32,9 @@ #ifndef DocumentThreadableLoader_h #define DocumentThreadableLoader_h -#include "core/fetch/RawResource.h" -#include "core/fetch/ResourcePtr.h" #include "core/loader/ThreadableLoader.h" +#include "core/loader/cache/RawResource.h" +#include "core/loader/cache/ResourcePtr.h" #include "core/platform/Timer.h" #include "core/platform/network/ResourceError.h" #include "wtf/Forward.h" diff --git a/chromium/third_party/WebKit/Source/core/loader/EmptyClients.h b/chromium/third_party/WebKit/Source/core/loader/EmptyClients.h index cf92613977b..09da78f3845 100644 --- a/chromium/third_party/WebKit/Source/core/loader/EmptyClients.h +++ b/chromium/third_party/WebKit/Source/core/loader/EmptyClients.h @@ -228,7 +228,8 @@ public: virtual void transitionToCommittedForNewPage() OVERRIDE { } - virtual void navigateBackForward(int offset) const OVERRIDE { } + virtual bool shouldGoToHistoryItem(HistoryItem*) const OVERRIDE { return false; } + virtual bool shouldStopLoadingForHistoryItem(HistoryItem*) const OVERRIDE { return false; } virtual void didDisplayInsecureContent() OVERRIDE { } virtual void didRunInsecureContent(SecurityOrigin*, const KURL&) OVERRIDE { } virtual void didDetectXSS(const KURL&, bool) OVERRIDE { } @@ -323,7 +324,6 @@ public: EmptyContextMenuClient() { } virtual ~EmptyContextMenuClient() { } virtual void showContextMenu(const ContextMenu*) OVERRIDE { } - virtual void clearContextMenu() OVERRIDE { } }; class EmptyDragClient : public DragClient { @@ -360,9 +360,13 @@ public: class EmptyBackForwardClient : public BackForwardClient { public: - virtual void didAddItem() OVERRIDE { } + virtual void addItem(PassRefPtr<HistoryItem>) OVERRIDE { } + virtual void goToItem(HistoryItem*) OVERRIDE { } + virtual HistoryItem* itemAtIndex(int) OVERRIDE { return 0; } virtual int backListCount() OVERRIDE { return 0; } virtual int forwardListCount() OVERRIDE { return 0; } + virtual bool isActive() OVERRIDE { return false; } + virtual void close() OVERRIDE { } }; void fillWithEmptyClients(Page::PageClients&); diff --git a/chromium/third_party/WebKit/Source/core/loader/FrameLoader.cpp b/chromium/third_party/WebKit/Source/core/loader/FrameLoader.cpp index aadc4413c1c..1cfc5ca8cee 100644 --- a/chromium/third_party/WebKit/Source/core/loader/FrameLoader.cpp +++ b/chromium/third_party/WebKit/Source/core/loader/FrameLoader.cpp @@ -39,17 +39,17 @@ #include "bindings/v8/DOMWrapperWorld.h" #include "bindings/v8/ScriptController.h" #include "bindings/v8/SerializedScriptValue.h" +#include "core/dom/BeforeUnloadEvent.h" #include "core/dom/Document.h" #include "core/dom/Element.h" #include "core/dom/Event.h" #include "core/dom/EventNames.h" #include "core/dom/PageTransitionEvent.h" #include "core/editing/Editor.h" -#include "core/fetch/ResourceFetcher.h" -#include "core/fetch/ResourceLoader.h" #include "core/history/BackForwardController.h" #include "core/history/HistoryItem.h" #include "core/html/HTMLFormElement.h" +#include "core/html/HTMLInputElement.h" #include "core/html/HTMLObjectElement.h" #include "core/html/parser/HTMLParserIdioms.h" #include "core/inspector/InspectorController.h" @@ -62,8 +62,10 @@ #include "core/loader/FrameLoaderClient.h" #include "core/loader/IconController.h" #include "core/loader/ProgressTracker.h" +#include "core/loader/ResourceLoader.h" #include "core/loader/UniqueIdentifier.h" #include "core/loader/appcache/ApplicationCacheHost.h" +#include "core/loader/cache/ResourceFetcher.h" #include "core/page/Chrome.h" #include "core/page/ChromeClient.h" #include "core/page/ContentSecurityPolicy.h" @@ -158,6 +160,7 @@ FrameLoader::FrameLoader(Frame* frame, FrameLoaderClient* client) , m_state(FrameStateProvisional) , m_loadType(FrameLoadTypeStandard) , m_inStopAllLoaders(false) + , m_pageDismissalEventBeingDispatched(NoDismissal) , m_isComplete(false) , m_containsPlugins(false) , m_needsClear(false) @@ -170,6 +173,7 @@ FrameLoader::FrameLoader(Frame* frame, FrameLoaderClient* client) , m_suppressOpenerInNewFrame(false) , m_startingClientRedirect(false) , m_forcedSandboxFlags(SandboxNone) + , m_hasAllowedNavigationViaBeforeUnloadConfirmationPanel(false) { } @@ -275,8 +279,58 @@ void FrameLoader::submitForm(PassRefPtr<FormSubmission> submission) targetFrame->navigationScheduler()->scheduleFormSubmission(submission); } -void FrameLoader::stopLoading() -{ +void FrameLoader::stopLoading(UnloadEventPolicy unloadEventPolicy) +{ + if (m_frame->document() && m_frame->document()->parser()) + m_frame->document()->parser()->stopParsing(); + + if (unloadEventPolicy != UnloadEventPolicyNone) { + if (m_frame->document()) { + if (m_frame->document()->unloadEventStillNeeded()) { + m_frame->document()->unloadEventStarted(); + Element* currentFocusedElement = m_frame->document()->focusedElement(); + if (currentFocusedElement && currentFocusedElement->hasTagName(inputTag)) + toHTMLInputElement(currentFocusedElement)->endEditing(); + if (m_pageDismissalEventBeingDispatched == NoDismissal) { + if (unloadEventPolicy == UnloadEventPolicyUnloadAndPageHide) { + m_pageDismissalEventBeingDispatched = PageHideDismissal; + m_frame->domWindow()->dispatchEvent(PageTransitionEvent::create(eventNames().pagehideEvent, false), m_frame->document()); + } + RefPtr<Event> unloadEvent(Event::create(eventNames().unloadEvent, false, false)); + // The DocumentLoader (and thus its DocumentLoadTiming) might get destroyed + // while dispatching the event, so protect it to prevent writing the end + // time into freed memory. + RefPtr<DocumentLoader> documentLoader = m_provisionalDocumentLoader; + m_pageDismissalEventBeingDispatched = UnloadDismissal; + if (documentLoader && !documentLoader->timing()->unloadEventStart() && !documentLoader->timing()->unloadEventEnd()) { + DocumentLoadTiming* timing = documentLoader->timing(); + ASSERT(timing->navigationStart()); + timing->markUnloadEventStart(); + m_frame->domWindow()->dispatchEvent(unloadEvent, m_frame->document()); + timing->markUnloadEventEnd(); + } else { + m_frame->domWindow()->dispatchEvent(unloadEvent, m_frame->document()); + } + } + m_pageDismissalEventBeingDispatched = NoDismissal; + if (m_frame->document()) { + m_frame->document()->updateStyleIfNeeded(); + m_frame->document()->unloadEventWasHandled(); + } + } + } + + // Dispatching the unload event could have made m_frame->document() null. + if (m_frame->document()) { + // Don't remove event listeners from a transitional empty document (see bug 28716 for more information). + bool keepEventListeners = m_stateMachine.isDisplayingInitialEmptyDocument() && m_provisionalDocumentLoader + && m_frame->document()->isSecureTransitionTo(m_provisionalDocumentLoader->url()); + + if (!keepEventListeners) + m_frame->document()->removeAllEventListeners(); + } + } + m_isComplete = true; // to avoid calling completed() in finishedParsing() if (m_frame->document() && m_frame->document()->parsing()) { @@ -314,9 +368,8 @@ bool FrameLoader::closeURL() history()->saveDocumentState(); // Should only send the pagehide event here if the current document exists. - if (m_frame->document()) - m_frame->document()->dispatchUnloadEvents(); - stopLoading(); + Document* currentDocument = m_frame->document(); + stopLoading(currentDocument ? UnloadEventPolicyUnloadAndPageHide : UnloadEventPolicyUnloadOnly); m_frame->editor()->clearUndoRedoOperations(); return true; @@ -403,6 +456,13 @@ void FrameLoader::receivedFirstData() dispatchDidCommitLoad(); dispatchDidClearWindowObjectsInAllWorlds(); + + if (m_documentLoader) { + StringWithDirection ptitle = m_documentLoader->title(); + // If we have a title let the WebView know about it. + if (!ptitle.isNull()) + m_client->dispatchDidReceiveTitle(ptitle); + } } void FrameLoader::setOutgoingReferrer(const KURL& url) @@ -627,7 +687,7 @@ void FrameLoader::handleFallbackContent() HTMLFrameOwnerElement* owner = m_frame->ownerElement(); if (!owner || !owner->hasTagName(objectTag)) return; - toHTMLObjectElement(owner)->renderFallbackContent(); + static_cast<HTMLObjectElement*>(owner)->renderFallbackContent(); } bool FrameLoader::allowPlugins(ReasonForCallingAllowPlugins reason) @@ -673,7 +733,6 @@ void FrameLoader::updateForSameDocumentNavigation(const KURL& newURL, SameDocume m_documentLoader->appendRedirect(newURL); m_client->dispatchDidNavigateWithinPage(); - m_client->dispatchDidReceiveTitle(m_frame->document()->titleWithDirection()); if (m_frame->document()->loadEventFinished()) m_client->postProgressFinishedNotification(); @@ -744,7 +803,10 @@ void FrameLoader::prepareForHistoryNavigation() RefPtr<HistoryItem> currentItem = history()->currentItem(); if (!currentItem) { insertDummyHistoryItem(); + ASSERT(stateMachine()->isDisplayingInitialEmptyDocument()); + stateMachine()->advanceTo(FrameLoaderStateMachine::StartedFirstRealLoad); + stateMachine()->advanceTo(FrameLoaderStateMachine::DisplayingInitialEmptyDocumentPostCommit); stateMachine()->advanceTo(FrameLoaderStateMachine::CommittedFirstRealLoad); } } @@ -922,7 +984,7 @@ void FrameLoader::reload(ReloadPolicy reloadPolicy, const KURL& overrideURL, con void FrameLoader::stopAllLoaders(ClearProvisionalItemPolicy clearProvisionalItemPolicy) { - if (m_frame->document()->pageDismissalEventBeingDispatched() != Document::NoDismissal) + if (m_pageDismissalEventBeingDispatched != NoDismissal) return; // If this method is called from within this method, infinite recursion can occur (3442218). Avoid this. @@ -1013,6 +1075,8 @@ void FrameLoader::commitProvisionalLoad() pdl->timing()->setHasSameOriginAsPreviousDocument(securityOrigin->canRequest(m_frame->document()->url())); } + clearAllowNavigationViaBeforeUnloadConfirmationPanel(); + // The call to closeURL() invokes the unload event handler, which can execute arbitrary // JavaScript. If the script initiates a new load, we need to abandon the current load, // or the two will stomp each other. @@ -1488,7 +1552,7 @@ bool FrameLoader::shouldClose() for (i = 0; i < targetFrames.size(); i++) { if (!targetFrames[i]->tree()->isDescendantOf(m_frame)) continue; - if (!targetFrames[i]->document()->dispatchBeforeUnloadEvent(page->chrome(), m_frame->document())) + if (!targetFrames[i]->loader()->fireBeforeUnloadEvent(page->chrome(), this)) break; } @@ -1502,10 +1566,43 @@ bool FrameLoader::shouldClose() return shouldClose; } +bool FrameLoader::fireBeforeUnloadEvent(Chrome& chrome, FrameLoader* navigatingFrameLoader) +{ + DOMWindow* domWindow = m_frame->domWindow(); + if (!domWindow) + return true; + + RefPtr<Document> document = m_frame->document(); + if (!document->body()) + return true; + + RefPtr<BeforeUnloadEvent> beforeUnloadEvent = BeforeUnloadEvent::create(); + m_pageDismissalEventBeingDispatched = BeforeUnloadDismissal; + domWindow->dispatchEvent(beforeUnloadEvent.get(), domWindow->document()); + m_pageDismissalEventBeingDispatched = NoDismissal; + + if (!beforeUnloadEvent->defaultPrevented()) + document->defaultEventHandler(beforeUnloadEvent.get()); + if (beforeUnloadEvent->result().isNull()) + return true; + + if (navigatingFrameLoader->hasAllowedNavigationViaBeforeUnloadConfirmationPanel()) { + m_frame->document()->addConsoleMessage(JSMessageSource, ErrorMessageLevel, "Blocked attempt to show multiple 'beforeunload' confirmation panels for a single navigation."); + return true; + } + + String text = document->displayStringModifiedByEncoding(beforeUnloadEvent->result()); + if (chrome.runBeforeUnloadConfirmPanel(text, m_frame)) { + navigatingFrameLoader->didAllowNavigationViaBeforeUnloadConfirmationPanel(); + return true; + } + return false; +} + void FrameLoader::loadWithNavigationAction(const ResourceRequest& request, const NavigationAction& action, FrameLoadType type, PassRefPtr<FormState> formState, const SubstituteData& substituteData, const String& overrideEncoding) { ASSERT(m_client->hasWebView()); - if (m_frame->document()->pageDismissalEventBeingDispatched() != Document::NoDismissal) + if (m_pageDismissalEventBeingDispatched != NoDismissal) return; // We skip dispatching the beforeload event on the frame owner if we've already committed a real @@ -1569,7 +1666,7 @@ void FrameLoader::loadWithNavigationAction(const ResourceRequest& request, const void FrameLoader::checkNewWindowPolicyAndContinue(PassRefPtr<FormState> formState, const String& frameName, const NavigationAction& action) { - if (m_frame->document()->pageDismissalEventBeingDispatched() != Document::NoDismissal) + if (m_pageDismissalEventBeingDispatched != NoDismissal) return; if (m_frame->document() && m_frame->document()->isSandboxed(SandboxPopups)) @@ -1819,6 +1916,11 @@ void FrameLoader::insertDummyHistoryItem() frame()->page()->backForward()->setCurrentItem(currentItem.get()); } +void FrameLoader::setTitle(const StringWithDirection& title) +{ + documentLoader()->setTitle(title); +} + String FrameLoader::referrer() const { return m_documentLoader ? m_documentLoader->request().httpReferrer() : ""; @@ -1863,6 +1965,15 @@ SandboxFlags FrameLoader::effectiveSandboxFlags() const return flags; } +void FrameLoader::didChangeTitle(DocumentLoader* loader) +{ + if (loader == m_documentLoader) { + // Must update the entries in the back-forward list too. + history()->setCurrentItemTitle(loader->title()); + m_client->dispatchDidReceiveTitle(loader->title()); + } +} + void FrameLoader::dispatchDidCommitLoad() { m_client->dispatchDidCommitLoad(); diff --git a/chromium/third_party/WebKit/Source/core/loader/FrameLoader.h b/chromium/third_party/WebKit/Source/core/loader/FrameLoader.h index 157ffba8f6c..9fb25273c3e 100644 --- a/chromium/third_party/WebKit/Source/core/loader/FrameLoader.h +++ b/chromium/third_party/WebKit/Source/core/loader/FrameLoader.h @@ -34,13 +34,13 @@ #include "core/dom/IconURL.h" #include "core/dom/SecurityContext.h" -#include "core/fetch/CachePolicy.h" -#include "core/fetch/ResourceLoadNotifier.h" -#include "core/fetch/ResourceLoaderOptions.h" #include "core/loader/FrameLoaderStateMachine.h" #include "core/loader/FrameLoaderTypes.h" #include "core/loader/HistoryController.h" #include "core/loader/MixedContentChecker.h" +#include "core/loader/ResourceLoadNotifier.h" +#include "core/loader/ResourceLoaderOptions.h" +#include "core/loader/cache/CachePolicy.h" #include "core/page/LayoutMilestones.h" #include "core/platform/Timer.h" #include "wtf/Forward.h" @@ -109,7 +109,7 @@ public: void stopAllLoaders(ClearProvisionalItemPolicy = ShouldClearProvisionalItem); void stopForUserCancel(bool deferCheckLoadComplete = false); void stop(); - void stopLoading(); + void stopLoading(UnloadEventPolicy); bool closeURL(); void cancelAndClear(); // FIXME: clear() is trying to do too many things. We should break it down into smaller functions (ideally with fewer raw Boolean parameters). @@ -142,6 +142,7 @@ public: bool isLoadingMainFrame() const; bool subframeIsLoading() const; + void didChangeTitle(DocumentLoader*); bool shouldTreatURLAsSrcdocDocument(const KURL&) const; @@ -201,6 +202,8 @@ public: bool isComplete() const; + void setTitle(const StringWithDirection&); + void commitProvisionalLoad(); FrameLoaderStateMachine* stateMachine() const { return &m_stateMachine; } @@ -224,6 +227,14 @@ public: bool containsPlugins() const { return m_containsPlugins; } bool allowPlugins(ReasonForCallingAllowPlugins); + enum PageDismissalType { + NoDismissal = 0, + BeforeUnloadDismissal = 1, + PageHideDismissal = 2, + UnloadDismissal = 3 + }; + PageDismissalType pageDismissalEventBeingDispatched() const { return m_pageDismissalEventBeingDispatched; } + void updateForSameDocumentNavigation(const KURL&, SameDocumentNavigationSource, PassRefPtr<SerializedScriptValue>, const String& title); private: @@ -241,6 +252,11 @@ private: SubstituteData defaultSubstituteDataForURL(const KURL&); + bool fireBeforeUnloadEvent(Chrome&, FrameLoader*); + bool hasAllowedNavigationViaBeforeUnloadConfirmationPanel() const { return m_hasAllowedNavigationViaBeforeUnloadConfirmationPanel; } + void didAllowNavigationViaBeforeUnloadConfirmationPanel() { m_hasAllowedNavigationViaBeforeUnloadConfirmationPanel = true; } + void clearAllowNavigationViaBeforeUnloadConfirmationPanel() { m_hasAllowedNavigationViaBeforeUnloadConfirmationPanel = false; } + void checkNavigationPolicyAndContinueFragmentScroll(const NavigationAction&, bool isNewNavigation); void checkNewWindowPolicyAndContinue(PassRefPtr<FormState>, const String& frameName, const NavigationAction&); @@ -300,6 +316,7 @@ private: String m_outgoingReferrer; + PageDismissalType m_pageDismissalEventBeingDispatched; bool m_isComplete; bool m_needsClear; @@ -321,6 +338,8 @@ private: SandboxFlags m_forcedSandboxFlags; + bool m_hasAllowedNavigationViaBeforeUnloadConfirmationPanel; + RefPtr<HistoryItem> m_requestedHistoryItem; }; diff --git a/chromium/third_party/WebKit/Source/core/loader/FrameLoaderClient.h b/chromium/third_party/WebKit/Source/core/loader/FrameLoaderClient.h index 8a0924a2b2e..f02a306c464 100644 --- a/chromium/third_party/WebKit/Source/core/loader/FrameLoaderClient.h +++ b/chromium/third_party/WebKit/Source/core/loader/FrameLoaderClient.h @@ -128,7 +128,8 @@ class FetchRequest; virtual void loadURLExternally(const ResourceRequest&, NavigationPolicy, const String& suggestedName = String()) = 0; - virtual void navigateBackForward(int offset) const = 0; + virtual bool shouldGoToHistoryItem(HistoryItem*) const = 0; + virtual bool shouldStopLoadingForHistoryItem(HistoryItem*) const = 0; // Another page has accessed the initial empty document of this frame. // It is no longer safe to display a provisional URL, since a URL spoof diff --git a/chromium/third_party/WebKit/Source/core/loader/FrameLoaderStateMachine.cpp b/chromium/third_party/WebKit/Source/core/loader/FrameLoaderStateMachine.cpp index 52957e41884..4cff5c7794e 100644 --- a/chromium/third_party/WebKit/Source/core/loader/FrameLoaderStateMachine.cpp +++ b/chromium/third_party/WebKit/Source/core/loader/FrameLoaderStateMachine.cpp @@ -61,7 +61,7 @@ bool FrameLoaderStateMachine::isDisplayingInitialEmptyDocument() const void FrameLoaderStateMachine::advanceTo(State state) { - ASSERT(m_state < state); + ASSERT(State(m_state + 1) == state); m_state = state; } diff --git a/chromium/third_party/WebKit/Source/core/loader/FrameLoaderTypes.h b/chromium/third_party/WebKit/Source/core/loader/FrameLoaderTypes.h index 1ef7b5dfddb..a7444ba8409 100644 --- a/chromium/third_party/WebKit/Source/core/loader/FrameLoaderTypes.h +++ b/chromium/third_party/WebKit/Source/core/loader/FrameLoaderTypes.h @@ -71,6 +71,12 @@ namespace WebCore { ObjectContentOtherPlugin }; + enum UnloadEventPolicy { + UnloadEventPolicyNone, + UnloadEventPolicyUnloadOnly, + UnloadEventPolicyUnloadAndPageHide + }; + enum ShouldSendReferrer { MaybeSendReferrer, NeverSendReferrer diff --git a/chromium/third_party/WebKit/Source/core/loader/HistoryController.cpp b/chromium/third_party/WebKit/Source/core/loader/HistoryController.cpp index 7db88749b4e..900765c8a77 100644 --- a/chromium/third_party/WebKit/Source/core/loader/HistoryController.cpp +++ b/chromium/third_party/WebKit/Source/core/loader/HistoryController.cpp @@ -196,8 +196,12 @@ bool HistoryController::shouldStopLoadingForHistoryItem(HistoryItem* targetItem) { if (!m_currentItem) return false; + // Don't abort the current load if we're navigating within the current document. - return !m_currentItem->shouldDoSameDocumentNavigationTo(targetItem); + if (m_currentItem->shouldDoSameDocumentNavigationTo(targetItem)) + return false; + + return m_frame->loader()->client()->shouldStopLoadingForHistoryItem(targetItem); } // Main funnel for navigating to a previous location (back/forward, non-search snap-back) @@ -213,6 +217,8 @@ void HistoryController::goToItem(HistoryItem* targetItem) Page* page = m_frame->page(); if (!page) return; + if (!m_frame->loader()->client()->shouldGoToHistoryItem(targetItem)) + return; if (m_defersLoading) { m_deferredItem = targetItem; return; @@ -245,7 +251,8 @@ void HistoryController::setDefersLoading(bool defer) void HistoryController::updateForBackForwardNavigation() { #if !LOG_DISABLED - LOG(History, "WebCoreHistory: Updating History for back/forward navigation in frame %s", m_frame->document()->title().utf8().data()); + if (m_frame->loader()->documentLoader()) + LOG(History, "WebCoreHistory: Updating History for back/forward navigation in frame %s", m_frame->loader()->documentLoader()->title().string().utf8().data()); #endif saveScrollPositionAndViewStateToItem(m_previousItem.get()); @@ -258,7 +265,8 @@ void HistoryController::updateForBackForwardNavigation() void HistoryController::updateForReload() { #if !LOG_DISABLED - LOG(History, "WebCoreHistory: Updating History for reload in frame %s", m_frame->document()->title().utf8().data()); + if (m_frame->loader()->documentLoader()) + LOG(History, "WebCoreHistory: Updating History for reload in frame %s", m_frame->loader()->documentLoader()->title().string().utf8().data()); #endif if (m_currentItem) { @@ -287,7 +295,7 @@ void HistoryController::updateForStandardLoad() void HistoryController::updateForRedirectWithLockedBackForwardList() { #if !LOG_DISABLED - LOG(History, "WebCoreHistory: Updating History for redirect load in frame %s", m_frame->document()->title().utf8().data()); + LOG(History, "WebCoreHistory: Updating History for redirect load in frame %s", m_frame->loader()->documentLoader()->title().string().utf8().data()); #endif if (!m_currentItem && !m_frame->tree()->parent()) { @@ -309,8 +317,8 @@ void HistoryController::updateForCommit() { FrameLoader* frameLoader = m_frame->loader(); #if !LOG_DISABLED - if (m_frame->document()) - LOG(History, "WebCoreHistory: Updating History for commit in frame %s", m_frame->document()->title().utf8().data()); + if (frameLoader->documentLoader()) + LOG(History, "WebCoreHistory: Updating History for commit in frame %s", frameLoader->documentLoader()->title().string().utf8().data()); #endif FrameLoadType type = frameLoader->loadType(); if (isBackForwardLoadType(type) || (isReloadTypeWithProvisionalItem(type) && !frameLoader->documentLoader()->unreachableURL().isEmpty())) { @@ -487,12 +495,13 @@ void HistoryController::initializeItem(HistoryItem* item) Frame* parentFrame = m_frame->tree()->parent(); String parent = parentFrame ? parentFrame->tree()->uniqueName() : ""; + StringWithDirection title = documentLoader->title(); item->setURL(url); item->setTarget(m_frame->tree()->uniqueName()); item->setParent(parent); // FIXME: should store title directionality in history as well. - item->setTitle(m_frame->document()->title()); + item->setTitle(title.string()); item->setOriginalURLString(originalURL.string()); // Save form state if this is a POST @@ -695,6 +704,7 @@ void HistoryController::pushState(PassRefPtr<SerializedScriptValue> stateObject, m_currentItem->setTitle(title); m_currentItem->setStateObject(stateObject); m_currentItem->setURLString(urlString); + page->backForward()->addItem(topItem.release()); } diff --git a/chromium/third_party/WebKit/Source/core/loader/ImageLoader.cpp b/chromium/third_party/WebKit/Source/core/loader/ImageLoader.cpp index 84132cfbb8b..668cb97f3ec 100644 --- a/chromium/third_party/WebKit/Source/core/loader/ImageLoader.cpp +++ b/chromium/third_party/WebKit/Source/core/loader/ImageLoader.cpp @@ -27,12 +27,12 @@ #include "core/dom/Element.h" #include "core/dom/Event.h" #include "core/dom/EventSender.h" -#include "core/fetch/FetchRequest.h" -#include "core/fetch/ImageResource.h" -#include "core/fetch/ResourceFetcher.h" #include "core/html/HTMLObjectElement.h" #include "core/html/parser/HTMLParserIdioms.h" #include "core/loader/CrossOriginAccessControl.h" +#include "core/loader/cache/FetchRequest.h" +#include "core/loader/cache/ImageResource.h" +#include "core/loader/cache/ResourceFetcher.h" #include "core/page/Frame.h" #include "core/rendering/RenderImage.h" #include "core/rendering/RenderVideo.h" @@ -61,7 +61,8 @@ static ImageEventSender& errorEventSender() static inline bool pageIsBeingDismissed(Document* document) { - return document->pageDismissalEventBeingDispatched() != Document::NoDismissal; + Frame* frame = document->frame(); + return frame && frame->loader()->pageDismissalEventBeingDispatched() != FrameLoader::NoDismissal; } ImageLoader::ImageLoader(Element* element) @@ -394,7 +395,7 @@ void ImageLoader::dispatchPendingBeforeLoadEvent() m_hasPendingLoadEvent = false; if (m_element->hasTagName(HTMLNames::objectTag)) - toHTMLObjectElement(m_element)->renderFallbackContent(); + static_cast<HTMLObjectElement*>(m_element)->renderFallbackContent(); // Only consider updating the protection ref-count of the Element immediately before returning // from this function as doing so might result in the destruction of this ImageLoader. diff --git a/chromium/third_party/WebKit/Source/core/loader/ImageLoader.h b/chromium/third_party/WebKit/Source/core/loader/ImageLoader.h index 6c1274fd3a6..dfb6ad0ddeb 100644 --- a/chromium/third_party/WebKit/Source/core/loader/ImageLoader.h +++ b/chromium/third_party/WebKit/Source/core/loader/ImageLoader.h @@ -23,9 +23,9 @@ #ifndef ImageLoader_h #define ImageLoader_h -#include "core/fetch/ImageResource.h" -#include "core/fetch/ImageResourceClient.h" -#include "core/fetch/ResourcePtr.h" +#include "core/loader/cache/ImageResource.h" +#include "core/loader/cache/ImageResourceClient.h" +#include "core/loader/cache/ResourcePtr.h" #include "wtf/HashSet.h" #include "wtf/text/AtomicString.h" diff --git a/chromium/third_party/WebKit/Source/core/loader/LinkLoader.cpp b/chromium/third_party/WebKit/Source/core/loader/LinkLoader.cpp index c487098ea88..256de17e5a2 100644 --- a/chromium/third_party/WebKit/Source/core/loader/LinkLoader.cpp +++ b/chromium/third_party/WebKit/Source/core/loader/LinkLoader.cpp @@ -34,10 +34,10 @@ #include "FetchInitiatorTypeNames.h" #include "core/dom/Document.h" -#include "core/fetch/FetchRequest.h" -#include "core/fetch/ResourceFetcher.h" #include "core/html/LinkRelAttribute.h" #include "core/loader/Prerenderer.h" +#include "core/loader/cache/FetchRequest.h" +#include "core/loader/cache/ResourceFetcher.h" #include "core/page/Settings.h" #include "core/platform/PrerenderHandle.h" #include "core/platform/network/DNS.h" diff --git a/chromium/third_party/WebKit/Source/core/loader/LinkLoader.h b/chromium/third_party/WebKit/Source/core/loader/LinkLoader.h index 086be49e4bc..21a6281fa09 100644 --- a/chromium/third_party/WebKit/Source/core/loader/LinkLoader.h +++ b/chromium/third_party/WebKit/Source/core/loader/LinkLoader.h @@ -32,9 +32,9 @@ #ifndef LinkLoader_h #define LinkLoader_h -#include "core/fetch/ResourceClient.h" -#include "core/fetch/ResourcePtr.h" #include "core/loader/LinkLoaderClient.h" +#include "core/loader/cache/ResourceClient.h" +#include "core/loader/cache/ResourcePtr.h" #include "core/platform/PrerenderClient.h" #include "core/platform/Timer.h" #include "wtf/RefPtr.h" diff --git a/chromium/third_party/WebKit/Source/core/loader/MixedContentChecker.cpp b/chromium/third_party/WebKit/Source/core/loader/MixedContentChecker.cpp index ac812e0edf8..707de33b695 100644 --- a/chromium/third_party/WebKit/Source/core/loader/MixedContentChecker.cpp +++ b/chromium/third_party/WebKit/Source/core/loader/MixedContentChecker.cpp @@ -91,7 +91,7 @@ bool MixedContentChecker::canRunInsecureContent(SecurityOrigin* securityOrigin, void MixedContentChecker::logWarning(bool allowed, const String& action, const KURL& target) const { - String message = String(allowed ? "" : "[blocked] ") + "The page at '" + m_frame->document()->url().elidedString() + "' was loaded over HTTPS, but " + action + " insecure content from '" + target.elidedString() + "': this content should also be loaded over HTTPS.\n"; + String message = String(allowed ? "" : "[blocked] ") + "The page at " + m_frame->document()->url().elidedString() + " " + action + " insecure content from " + target.elidedString() + ".\n"; m_frame->document()->addConsoleMessage(SecurityMessageSource, WarningMessageLevel, message); } diff --git a/chromium/third_party/WebKit/Source/core/loader/NavigationScheduler.cpp b/chromium/third_party/WebKit/Source/core/loader/NavigationScheduler.cpp index 700d036e14a..9547744fdf6 100644 --- a/chromium/third_party/WebKit/Source/core/loader/NavigationScheduler.cpp +++ b/chromium/third_party/WebKit/Source/core/loader/NavigationScheduler.cpp @@ -437,8 +437,7 @@ void NavigationScheduler::schedule(PassOwnPtr<ScheduledNavigation> redirect) if (redirect->wasDuringLoad()) { if (DocumentLoader* provisionalDocumentLoader = m_frame->loader()->provisionalDocumentLoader()) provisionalDocumentLoader->stopLoading(); - m_frame->document()->dispatchUnloadEvents(); - m_frame->loader()->stopLoading(); + m_frame->loader()->stopLoading(UnloadEventPolicyUnloadAndPageHide); } cancel(); diff --git a/chromium/third_party/WebKit/Source/core/loader/PingLoader.h b/chromium/third_party/WebKit/Source/core/loader/PingLoader.h index 80f7070aef7..a25a5c68eb0 100644 --- a/chromium/third_party/WebKit/Source/core/loader/PingLoader.h +++ b/chromium/third_party/WebKit/Source/core/loader/PingLoader.h @@ -32,7 +32,7 @@ #ifndef PingLoader_h #define PingLoader_h -#include "core/fetch/ResourceLoaderOptions.h" +#include "core/loader/ResourceLoaderOptions.h" #include "core/platform/Timer.h" #include "public/platform/WebURLLoaderClient.h" #include "wtf/Noncopyable.h" diff --git a/chromium/third_party/WebKit/Source/core/fetch/ResourceLoadNotifier.cpp b/chromium/third_party/WebKit/Source/core/loader/ResourceLoadNotifier.cpp index 1aca1a9204d..2804a0d565a 100644 --- a/chromium/third_party/WebKit/Source/core/fetch/ResourceLoadNotifier.cpp +++ b/chromium/third_party/WebKit/Source/core/loader/ResourceLoadNotifier.cpp @@ -29,7 +29,7 @@ */ #include "config.h" -#include "core/fetch/ResourceLoadNotifier.h" +#include "core/loader/ResourceLoadNotifier.h" #include "core/inspector/InspectorInstrumentation.h" #include "core/loader/DocumentLoader.h" diff --git a/chromium/third_party/WebKit/Source/core/fetch/ResourceLoadNotifier.h b/chromium/third_party/WebKit/Source/core/loader/ResourceLoadNotifier.h index 65d0f7b9e99..5e1c5a4dac1 100644 --- a/chromium/third_party/WebKit/Source/core/fetch/ResourceLoadNotifier.h +++ b/chromium/third_party/WebKit/Source/core/loader/ResourceLoadNotifier.h @@ -30,7 +30,7 @@ #ifndef ResourceLoadNotifier_h #define ResourceLoadNotifier_h -#include "core/fetch/FetchInitiatorInfo.h" +#include "core/loader/cache/FetchInitiatorInfo.h" #include "wtf/Noncopyable.h" namespace WebCore { diff --git a/chromium/third_party/WebKit/Source/core/fetch/ResourceLoader.cpp b/chromium/third_party/WebKit/Source/core/loader/ResourceLoader.cpp index 987cbc50b51..389cab47d95 100644 --- a/chromium/third_party/WebKit/Source/core/fetch/ResourceLoader.cpp +++ b/chromium/third_party/WebKit/Source/core/loader/ResourceLoader.cpp @@ -28,11 +28,11 @@ */ #include "config.h" -#include "core/fetch/ResourceLoader.h" +#include "core/loader/ResourceLoader.h" -#include "core/fetch/Resource.h" -#include "core/fetch/ResourceLoaderHost.h" -#include "core/fetch/ResourcePtr.h" +#include "core/loader/ResourceLoaderHost.h" +#include "core/loader/cache/Resource.h" +#include "core/loader/cache/ResourcePtr.h" #include "core/platform/Logging.h" #include "core/platform/SharedBuffer.h" #include "core/platform/chromium/support/WrappedResourceRequest.h" diff --git a/chromium/third_party/WebKit/Source/core/fetch/ResourceLoader.h b/chromium/third_party/WebKit/Source/core/loader/ResourceLoader.h index d298e950ba4..f7615bb2e2e 100644 --- a/chromium/third_party/WebKit/Source/core/fetch/ResourceLoader.h +++ b/chromium/third_party/WebKit/Source/core/loader/ResourceLoader.h @@ -29,7 +29,7 @@ #ifndef ResourceLoader_h #define ResourceLoader_h -#include "core/fetch/ResourceLoaderOptions.h" +#include "core/loader/ResourceLoaderOptions.h" #include "core/platform/network/ResourceRequest.h" #include "public/platform/WebURLLoader.h" #include "public/platform/WebURLLoaderClient.h" diff --git a/chromium/third_party/WebKit/Source/core/fetch/ResourceLoaderHost.h b/chromium/third_party/WebKit/Source/core/loader/ResourceLoaderHost.h index 5860b9650bd..5860b9650bd 100644 --- a/chromium/third_party/WebKit/Source/core/fetch/ResourceLoaderHost.h +++ b/chromium/third_party/WebKit/Source/core/loader/ResourceLoaderHost.h diff --git a/chromium/third_party/WebKit/Source/core/fetch/ResourceLoaderOptions.h b/chromium/third_party/WebKit/Source/core/loader/ResourceLoaderOptions.h index 187efc3ac96..423519b63f4 100644 --- a/chromium/third_party/WebKit/Source/core/fetch/ResourceLoaderOptions.h +++ b/chromium/third_party/WebKit/Source/core/loader/ResourceLoaderOptions.h @@ -31,7 +31,7 @@ #ifndef ResourceLoaderOptions_h #define ResourceLoaderOptions_h -#include "core/fetch/FetchInitiatorInfo.h" +#include "core/loader/cache/FetchInitiatorInfo.h" namespace WebCore { diff --git a/chromium/third_party/WebKit/Source/core/loader/TextTrackLoader.cpp b/chromium/third_party/WebKit/Source/core/loader/TextTrackLoader.cpp index a8e1b70155a..9c548ebb140 100644 --- a/chromium/third_party/WebKit/Source/core/loader/TextTrackLoader.cpp +++ b/chromium/third_party/WebKit/Source/core/loader/TextTrackLoader.cpp @@ -29,11 +29,11 @@ #include "FetchInitiatorTypeNames.h" #include "core/dom/Document.h" -#include "core/fetch/FetchRequest.h" -#include "core/fetch/ResourceFetcher.h" -#include "core/fetch/TextTrackResource.h" #include "core/html/track/WebVTTParser.h" #include "core/loader/CrossOriginAccessControl.h" +#include "core/loader/cache/FetchRequest.h" +#include "core/loader/cache/ResourceFetcher.h" +#include "core/loader/cache/TextTrackResource.h" #include "core/platform/Logging.h" #include "core/platform/SharedBuffer.h" #include "weborigin/SecurityOrigin.h" diff --git a/chromium/third_party/WebKit/Source/core/loader/TextTrackLoader.h b/chromium/third_party/WebKit/Source/core/loader/TextTrackLoader.h index 4eb68a81aa6..dd2feeb8293 100644 --- a/chromium/third_party/WebKit/Source/core/loader/TextTrackLoader.h +++ b/chromium/third_party/WebKit/Source/core/loader/TextTrackLoader.h @@ -26,10 +26,10 @@ #ifndef TextTrackLoader_h #define TextTrackLoader_h -#include "core/fetch/ResourceClient.h" -#include "core/fetch/ResourcePtr.h" -#include "core/fetch/TextTrackResource.h" #include "core/html/track/WebVTTParser.h" +#include "core/loader/cache/ResourceClient.h" +#include "core/loader/cache/ResourcePtr.h" +#include "core/loader/cache/TextTrackResource.h" #include "core/platform/Timer.h" #include "wtf/OwnPtr.h" diff --git a/chromium/third_party/WebKit/Source/core/loader/ThreadableLoader.h b/chromium/third_party/WebKit/Source/core/loader/ThreadableLoader.h index a2afdd11b6b..6df1a5ce0a0 100644 --- a/chromium/third_party/WebKit/Source/core/loader/ThreadableLoader.h +++ b/chromium/third_party/WebKit/Source/core/loader/ThreadableLoader.h @@ -31,7 +31,7 @@ #ifndef ThreadableLoader_h #define ThreadableLoader_h -#include "core/fetch/ResourceLoaderOptions.h" +#include "core/loader/ResourceLoaderOptions.h" #include "weborigin/SecurityOrigin.h" #include "wtf/Noncopyable.h" #include "wtf/PassRefPtr.h" diff --git a/chromium/third_party/WebKit/Source/core/fetch/CSSStyleSheetResource.cpp b/chromium/third_party/WebKit/Source/core/loader/cache/CSSStyleSheetResource.cpp index 20be5179f25..53398a20d92 100644 --- a/chromium/third_party/WebKit/Source/core/fetch/CSSStyleSheetResource.cpp +++ b/chromium/third_party/WebKit/Source/core/loader/cache/CSSStyleSheetResource.cpp @@ -25,12 +25,12 @@ */ #include "config.h" -#include "core/fetch/CSSStyleSheetResource.h" +#include "core/loader/cache/CSSStyleSheetResource.h" #include "core/css/StyleSheetContents.h" -#include "core/fetch/ResourceClientWalker.h" -#include "core/fetch/StyleSheetResourceClient.h" #include "core/loader/TextResourceDecoder.h" +#include "core/loader/cache/ResourceClientWalker.h" +#include "core/loader/cache/StyleSheetResourceClient.h" #include "core/platform/SharedBuffer.h" #include "core/platform/network/HTTPParsers.h" #include "wtf/CurrentTime.h" diff --git a/chromium/third_party/WebKit/Source/core/fetch/CSSStyleSheetResource.h b/chromium/third_party/WebKit/Source/core/loader/cache/CSSStyleSheetResource.h index 3ecf34ba82e..b01fa8667f3 100644 --- a/chromium/third_party/WebKit/Source/core/fetch/CSSStyleSheetResource.h +++ b/chromium/third_party/WebKit/Source/core/loader/cache/CSSStyleSheetResource.h @@ -26,7 +26,7 @@ #ifndef CSSStyleSheetResource_h #define CSSStyleSheetResource_h -#include "core/fetch/Resource.h" +#include "core/loader/cache/Resource.h" namespace WebCore { diff --git a/chromium/third_party/WebKit/Source/core/fetch/CachePolicy.h b/chromium/third_party/WebKit/Source/core/loader/cache/CachePolicy.h index bffddfe1d96..a44c32d26cc 100644 --- a/chromium/third_party/WebKit/Source/core/fetch/CachePolicy.h +++ b/chromium/third_party/WebKit/Source/core/loader/cache/CachePolicy.h @@ -28,13 +28,13 @@ namespace WebCore { -enum CachePolicy { - CachePolicyCache, - CachePolicyVerify, - CachePolicyRevalidate, - CachePolicyReload, - CachePolicyHistoryBuffer -}; + enum CachePolicy { + CachePolicyCache, + CachePolicyVerify, + CachePolicyRevalidate, + CachePolicyReload, + CachePolicyHistoryBuffer + }; } diff --git a/chromium/third_party/WebKit/Source/core/fetch/DocumentResource.cpp b/chromium/third_party/WebKit/Source/core/loader/cache/DocumentResource.cpp index 5c18d847e45..27503416f14 100644 --- a/chromium/third_party/WebKit/Source/core/fetch/DocumentResource.cpp +++ b/chromium/third_party/WebKit/Source/core/loader/cache/DocumentResource.cpp @@ -22,10 +22,10 @@ #include "config.h" -#include "core/fetch/DocumentResource.h" +#include "core/loader/cache/DocumentResource.h" -#include "core/fetch/ResourceClient.h" -#include "core/fetch/ResourcePtr.h" +#include "core/loader/cache/ResourceClient.h" +#include "core/loader/cache/ResourcePtr.h" #include "core/platform/SharedBuffer.h" #include "core/svg/SVGDocument.h" #include "wtf/text/StringBuilder.h" diff --git a/chromium/third_party/WebKit/Source/core/fetch/DocumentResource.h b/chromium/third_party/WebKit/Source/core/loader/cache/DocumentResource.h index 58b8ac0621f..62379d70925 100644 --- a/chromium/third_party/WebKit/Source/core/fetch/DocumentResource.h +++ b/chromium/third_party/WebKit/Source/core/loader/cache/DocumentResource.h @@ -23,10 +23,10 @@ #ifndef DocumentResource_h #define DocumentResource_h -#include "core/fetch/Resource.h" -#include "core/fetch/ResourceClient.h" -#include "core/fetch/ResourcePtr.h" #include "core/loader/TextResourceDecoder.h" +#include "core/loader/cache/Resource.h" +#include "core/loader/cache/ResourceClient.h" +#include "core/loader/cache/ResourcePtr.h" namespace WebCore { diff --git a/chromium/third_party/WebKit/Source/core/fetch/DocumentResourceReference.h b/chromium/third_party/WebKit/Source/core/loader/cache/DocumentResourceReference.h index 9e8433583f9..4d7009cb434 100644 --- a/chromium/third_party/WebKit/Source/core/fetch/DocumentResourceReference.h +++ b/chromium/third_party/WebKit/Source/core/loader/cache/DocumentResourceReference.h @@ -26,8 +26,8 @@ #ifndef DocumentResourceReference_h #define DocumentResourceReference_h -#include "core/fetch/DocumentResource.h" -#include "core/fetch/ResourcePtr.h" +#include "core/loader/cache/DocumentResource.h" +#include "core/loader/cache/ResourcePtr.h" namespace WebCore { diff --git a/chromium/third_party/WebKit/Source/core/fetch/FetchInitiatorInfo.h b/chromium/third_party/WebKit/Source/core/loader/cache/FetchInitiatorInfo.h index c5e9b3a67b8..c5e9b3a67b8 100644 --- a/chromium/third_party/WebKit/Source/core/fetch/FetchInitiatorInfo.h +++ b/chromium/third_party/WebKit/Source/core/loader/cache/FetchInitiatorInfo.h diff --git a/chromium/third_party/WebKit/Source/core/fetch/FetchInitiatorTypeNames.in b/chromium/third_party/WebKit/Source/core/loader/cache/FetchInitiatorTypeNames.in index 7356271ceb4..7356271ceb4 100644 --- a/chromium/third_party/WebKit/Source/core/fetch/FetchInitiatorTypeNames.in +++ b/chromium/third_party/WebKit/Source/core/loader/cache/FetchInitiatorTypeNames.in diff --git a/chromium/third_party/WebKit/Source/core/fetch/FetchRequest.cpp b/chromium/third_party/WebKit/Source/core/loader/cache/FetchRequest.cpp index ba22c78bcb1..57268b2979e 100644 --- a/chromium/third_party/WebKit/Source/core/fetch/FetchRequest.cpp +++ b/chromium/third_party/WebKit/Source/core/loader/cache/FetchRequest.cpp @@ -24,12 +24,12 @@ */ #include "config.h" -#include "core/fetch/FetchRequest.h" +#include "core/loader/cache/FetchRequest.h" #include "core/dom/Element.h" -#include "core/fetch/FetchInitiatorInfo.h" -#include "core/fetch/ResourceFetcher.h" #include "core/loader/CrossOriginAccessControl.h" +#include "core/loader/cache/FetchInitiatorInfo.h" +#include "core/loader/cache/ResourceFetcher.h" namespace WebCore { diff --git a/chromium/third_party/WebKit/Source/core/fetch/FetchRequest.h b/chromium/third_party/WebKit/Source/core/loader/cache/FetchRequest.h index b9d5fec3978..974fff2b36b 100644 --- a/chromium/third_party/WebKit/Source/core/fetch/FetchRequest.h +++ b/chromium/third_party/WebKit/Source/core/loader/cache/FetchRequest.h @@ -27,8 +27,8 @@ #define FetchRequest_h #include "core/dom/Element.h" -#include "core/fetch/FetchInitiatorInfo.h" -#include "core/fetch/ResourceLoaderOptions.h" +#include "core/loader/ResourceLoaderOptions.h" +#include "core/loader/cache/FetchInitiatorInfo.h" #include "core/platform/network/ResourceLoadPriority.h" #include "core/platform/network/ResourceRequest.h" #include "wtf/text/AtomicString.h" diff --git a/chromium/third_party/WebKit/Source/core/fetch/FontResource.cpp b/chromium/third_party/WebKit/Source/core/loader/cache/FontResource.cpp index 7fe82f41691..90b527783bf 100644 --- a/chromium/third_party/WebKit/Source/core/fetch/FontResource.cpp +++ b/chromium/third_party/WebKit/Source/core/loader/cache/FontResource.cpp @@ -25,11 +25,11 @@ */ #include "config.h" -#include "core/fetch/FontResource.h" +#include "core/loader/cache/FontResource.h" -#include "core/fetch/ResourceClient.h" -#include "core/fetch/ResourceClientWalker.h" #include "core/loader/TextResourceDecoder.h" +#include "core/loader/cache/ResourceClient.h" +#include "core/loader/cache/ResourceClientWalker.h" #include "core/platform/SharedBuffer.h" #include "core/platform/graphics/FontCustomPlatformData.h" #include "core/platform/graphics/FontPlatformData.h" diff --git a/chromium/third_party/WebKit/Source/core/fetch/FontResource.h b/chromium/third_party/WebKit/Source/core/loader/cache/FontResource.h index 42b4f7029d5..5997f1e9b98 100644 --- a/chromium/third_party/WebKit/Source/core/fetch/FontResource.h +++ b/chromium/third_party/WebKit/Source/core/loader/cache/FontResource.h @@ -26,8 +26,8 @@ #ifndef FontResource_h #define FontResource_h -#include "core/fetch/Resource.h" -#include "core/fetch/ResourceClient.h" +#include "core/loader/cache/Resource.h" +#include "core/loader/cache/ResourceClient.h" #include "core/platform/graphics/FontOrientation.h" #include "core/platform/graphics/FontWidthVariant.h" #include "wtf/OwnPtr.h" diff --git a/chromium/third_party/WebKit/Source/core/fetch/ImageResource.cpp b/chromium/third_party/WebKit/Source/core/loader/cache/ImageResource.cpp index 1fec3b78035..c07d864d850 100644 --- a/chromium/third_party/WebKit/Source/core/fetch/ImageResource.cpp +++ b/chromium/third_party/WebKit/Source/core/loader/cache/ImageResource.cpp @@ -22,13 +22,13 @@ */ #include "config.h" -#include "core/fetch/ImageResource.h" +#include "core/loader/cache/ImageResource.h" -#include "core/fetch/ImageResourceClient.h" -#include "core/fetch/MemoryCache.h" -#include "core/fetch/ResourceClient.h" -#include "core/fetch/ResourceClientWalker.h" -#include "core/fetch/ResourceFetcher.h" +#include "core/loader/cache/ImageResourceClient.h" +#include "core/loader/cache/MemoryCache.h" +#include "core/loader/cache/ResourceClient.h" +#include "core/loader/cache/ResourceClientWalker.h" +#include "core/loader/cache/ResourceFetcher.h" #include "core/page/FrameView.h" #include "core/platform/SharedBuffer.h" #include "core/platform/graphics/BitmapImage.h" diff --git a/chromium/third_party/WebKit/Source/core/fetch/ImageResource.h b/chromium/third_party/WebKit/Source/core/loader/cache/ImageResource.h index 0ae33ff434e..5bee694c78c 100644 --- a/chromium/third_party/WebKit/Source/core/fetch/ImageResource.h +++ b/chromium/third_party/WebKit/Source/core/loader/cache/ImageResource.h @@ -23,7 +23,7 @@ #ifndef ImageResource_h #define ImageResource_h -#include "core/fetch/Resource.h" +#include "core/loader/cache/Resource.h" #include "core/platform/graphics/ImageObserver.h" #include "core/platform/graphics/IntRect.h" #include "core/platform/graphics/IntSizeHash.h" diff --git a/chromium/third_party/WebKit/Source/core/fetch/ImageResourceClient.h b/chromium/third_party/WebKit/Source/core/loader/cache/ImageResourceClient.h index 900550e618e..4cea375612c 100644 --- a/chromium/third_party/WebKit/Source/core/fetch/ImageResourceClient.h +++ b/chromium/third_party/WebKit/Source/core/loader/cache/ImageResourceClient.h @@ -23,7 +23,7 @@ #ifndef ImageResourceClient_h #define ImageResourceClient_h -#include "core/fetch/ResourceClient.h" +#include "core/loader/cache/ResourceClient.h" namespace WebCore { diff --git a/chromium/third_party/WebKit/Source/core/fetch/ImageResourceTest.cpp b/chromium/third_party/WebKit/Source/core/loader/cache/ImageResourceTest.cpp index f1a269a5478..37d558b8d57 100644 --- a/chromium/third_party/WebKit/Source/core/fetch/ImageResourceTest.cpp +++ b/chromium/third_party/WebKit/Source/core/loader/cache/ImageResourceTest.cpp @@ -29,15 +29,15 @@ */ #include "config.h" -#include "core/fetch/ImageResource.h" +#include "core/loader/cache/ImageResource.h" -#include "core/fetch/ImageResourceClient.h" -#include "core/fetch/MemoryCache.h" -#include "core/fetch/MockImageResourceClient.h" -#include "core/fetch/ResourceFetcher.h" -#include "core/fetch/ResourcePtr.h" #include "core/loader/DocumentLoader.h" #include "core/loader/EmptyClients.h" +#include "core/loader/cache/ImageResourceClient.h" +#include "core/loader/cache/MemoryCache.h" +#include "core/loader/cache/MockImageResourceClient.h" +#include "core/loader/cache/ResourceFetcher.h" +#include "core/loader/cache/ResourcePtr.h" #include "core/page/Frame.h" #include "core/page/FrameView.h" #include "core/page/Page.h" diff --git a/chromium/third_party/WebKit/Source/core/fetch/MemoryCache.cpp b/chromium/third_party/WebKit/Source/core/loader/cache/MemoryCache.cpp index 8024b2073b7..c51f5446e3c 100644 --- a/chromium/third_party/WebKit/Source/core/fetch/MemoryCache.cpp +++ b/chromium/third_party/WebKit/Source/core/loader/cache/MemoryCache.cpp @@ -21,18 +21,19 @@ */ #include "config.h" -#include "core/fetch/MemoryCache.h" +#include "core/loader/cache/MemoryCache.h" +#include <stdio.h> #include "core/dom/CrossThreadTask.h" #include "core/dom/Document.h" -#include "core/fetch/Resource.h" -#include "core/fetch/ResourcePtr.h" +#include "core/loader/cache/Resource.h" +#include "core/loader/cache/ResourcePtr.h" #include "core/page/FrameView.h" #include "core/platform/Logging.h" +#include "core/platform/chromium/TraceEvent.h" #include "core/workers/WorkerGlobalScope.h" #include "core/workers/WorkerLoaderProxy.h" #include "core/workers/WorkerThread.h" -#include "public/platform/Platform.h" #include "weborigin/SecurityOrigin.h" #include "weborigin/SecurityOriginHash.h" #include "wtf/Assertions.h" @@ -40,7 +41,6 @@ #include "wtf/MathExtras.h" #include "wtf/TemporaryChange.h" #include "wtf/text/CString.h" -#include <stdio.h> using namespace std; @@ -297,9 +297,8 @@ void MemoryCache::evict(Resource* resource) removeFromLRUList(resource); removeFromLiveDecodedResourcesList(resource); adjustSize(resource->hasClients(), -static_cast<int>(resource->size())); - } else { + } else ASSERT(m_resources.get(resource->url()) != resource); - } resource->deleteIfPossible(); } @@ -319,7 +318,7 @@ MemoryCache::LRUList* MemoryCache::lruListFor(Resource* resource) void MemoryCache::removeFromLRUList(Resource* resource) { // If we've never been accessed, then we're brand new and not in any list. - if (!resource->accessCount()) + if (resource->accessCount() == 0) return; #if !ASSERT_DISABLED @@ -346,7 +345,7 @@ void MemoryCache::removeFromLRUList(Resource* resource) Resource* next = resource->m_nextInAllResourcesList; Resource* prev = resource->m_prevInAllResourcesList; - if (!next && !prev && list->m_head != resource) + if (next == 0 && prev == 0 && list->m_head != resource) return; resource->m_nextInAllResourcesList = 0; @@ -561,8 +560,7 @@ void MemoryCache::evictResources() void MemoryCache::prune() { - ASSERT(WebKit::Platform::current()); // This method should not be called after WebKit::shutdown(). - + TRACE_EVENT0("renderer", "MemoryCache::prune()"); if (m_liveSize + m_deadSize <= m_capacity && m_maxDeadCapacity && m_deadSize <= m_maxDeadCapacity) // Fast path. return; if (m_inPruneResources) diff --git a/chromium/third_party/WebKit/Source/core/fetch/MemoryCache.h b/chromium/third_party/WebKit/Source/core/loader/cache/MemoryCache.h index d4aad799bbf..f174a11b9bf 100644 --- a/chromium/third_party/WebKit/Source/core/fetch/MemoryCache.h +++ b/chromium/third_party/WebKit/Source/core/loader/cache/MemoryCache.h @@ -22,10 +22,10 @@ pages from the web. It has a memory cache for these objects. */ -#ifndef MemoryCache_h -#define MemoryCache_h +#ifndef Cache_h +#define Cache_h -#include "core/fetch/Resource.h" +#include "core/loader/cache/Resource.h" #include "wtf/HashMap.h" #include "wtf/Noncopyable.h" #include "wtf/Vector.h" @@ -181,7 +181,7 @@ private: unsigned m_liveSize; // The number of bytes currently consumed by "live" resources in the cache. unsigned m_deadSize; // The number of bytes currently consumed by "dead" resources in the cache. - // Size-adjusted and popularity-aware LRU list collection for cache objects. This collection can hold + // Size-adjusted and popularity-aware LRU list collection for cache objects. This collection can hold // more resources than the cached resource map, since it can also hold "stale" multiple versions of objects that are // waiting to die when the clients referencing them go away. Vector<LRUList, 32> m_allResources; diff --git a/chromium/third_party/WebKit/Source/core/fetch/MemoryCacheTest.cpp b/chromium/third_party/WebKit/Source/core/loader/cache/MemoryCacheTest.cpp index 842bddbd928..1a365179772 100644 --- a/chromium/third_party/WebKit/Source/core/fetch/MemoryCacheTest.cpp +++ b/chromium/third_party/WebKit/Source/core/loader/cache/MemoryCacheTest.cpp @@ -29,11 +29,11 @@ */ #include "config.h" -#include "core/fetch/MemoryCache.h" +#include "core/loader/cache/MemoryCache.h" -#include "core/fetch/MockImageResourceClient.h" -#include "core/fetch/RawResource.h" -#include "core/fetch/ResourcePtr.h" +#include "core/loader/cache/MockImageResourceClient.h" +#include "core/loader/cache/RawResource.h" +#include "core/loader/cache/ResourcePtr.h" #include "core/platform/network/ResourceRequest.h" #include "wtf/OwnPtr.h" diff --git a/chromium/third_party/WebKit/Source/core/fetch/MockImageResourceClient.h b/chromium/third_party/WebKit/Source/core/loader/cache/MockImageResourceClient.h index 676c95ac5cf..adaa90f527a 100644 --- a/chromium/third_party/WebKit/Source/core/fetch/MockImageResourceClient.h +++ b/chromium/third_party/WebKit/Source/core/loader/cache/MockImageResourceClient.h @@ -31,7 +31,7 @@ #ifndef MockImageResourceClient_h #define MockImageResourceClient_h -#include "core/fetch/ImageResourceClient.h" +#include "core/loader/cache/ImageResourceClient.h" #include "core/page/Frame.h" #include "core/platform/graphics/Image.h" diff --git a/chromium/third_party/WebKit/Source/core/fetch/RawResource.cpp b/chromium/third_party/WebKit/Source/core/loader/cache/RawResource.cpp index 5745d93c470..a2a0dc4eacd 100644 --- a/chromium/third_party/WebKit/Source/core/fetch/RawResource.cpp +++ b/chromium/third_party/WebKit/Source/core/loader/cache/RawResource.cpp @@ -24,12 +24,12 @@ */ #include "config.h" -#include "core/fetch/RawResource.h" +#include "core/loader/cache/RawResource.h" -#include "core/fetch/ResourceClient.h" -#include "core/fetch/ResourceClientWalker.h" -#include "core/fetch/ResourceFetcher.h" -#include "core/fetch/ResourceLoader.h" +#include "core/loader/ResourceLoader.h" +#include "core/loader/cache/ResourceClient.h" +#include "core/loader/cache/ResourceClientWalker.h" +#include "core/loader/cache/ResourceFetcher.h" #include "core/platform/SharedBuffer.h" namespace WebCore { diff --git a/chromium/third_party/WebKit/Source/core/fetch/RawResource.h b/chromium/third_party/WebKit/Source/core/loader/cache/RawResource.h index 0ed0bc08ce1..05cf3f4d8bf 100644 --- a/chromium/third_party/WebKit/Source/core/fetch/RawResource.h +++ b/chromium/third_party/WebKit/Source/core/loader/cache/RawResource.h @@ -23,8 +23,8 @@ #ifndef RawResource_h #define RawResource_h -#include "core/fetch/Resource.h" -#include "core/fetch/ResourceClient.h" +#include "core/loader/cache/Resource.h" +#include "core/loader/cache/ResourceClient.h" namespace WebCore { class RawResourceCallback; diff --git a/chromium/third_party/WebKit/Source/core/fetch/Resource.cpp b/chromium/third_party/WebKit/Source/core/loader/cache/Resource.cpp index 3c7eaab2a98..ae832e127d3 100644 --- a/chromium/third_party/WebKit/Source/core/fetch/Resource.cpp +++ b/chromium/third_party/WebKit/Source/core/loader/cache/Resource.cpp @@ -22,17 +22,17 @@ */ #include "config.h" -#include "core/fetch/Resource.h" - -#include "core/fetch/MemoryCache.h" -#include "core/fetch/ResourceClient.h" -#include "core/fetch/ResourceClientWalker.h" -#include "core/fetch/ResourceFetcher.h" -#include "core/fetch/ResourceLoader.h" -#include "core/fetch/ResourcePtr.h" +#include "core/loader/cache/Resource.h" + #include "core/inspector/InspectorInstrumentation.h" #include "core/loader/CachedMetadata.h" #include "core/loader/CrossOriginAccessControl.h" +#include "core/loader/ResourceLoader.h" +#include "core/loader/cache/MemoryCache.h" +#include "core/loader/cache/ResourceClient.h" +#include "core/loader/cache/ResourceClientWalker.h" +#include "core/loader/cache/ResourceFetcher.h" +#include "core/loader/cache/ResourcePtr.h" #include "core/platform/Logging.h" #include "core/platform/PurgeableBuffer.h" #include "core/platform/SharedBuffer.h" diff --git a/chromium/third_party/WebKit/Source/core/fetch/Resource.h b/chromium/third_party/WebKit/Source/core/loader/cache/Resource.h index 0f6759218b6..dd092e3e9f9 100644 --- a/chromium/third_party/WebKit/Source/core/fetch/Resource.h +++ b/chromium/third_party/WebKit/Source/core/loader/cache/Resource.h @@ -23,8 +23,8 @@ #ifndef Resource_h #define Resource_h -#include "core/fetch/CachePolicy.h" -#include "core/fetch/ResourceLoaderOptions.h" +#include "core/loader/ResourceLoaderOptions.h" +#include "core/loader/cache/CachePolicy.h" #include "core/platform/Timer.h" #include "core/platform/network/ResourceError.h" #include "core/platform/network/ResourceLoadPriority.h" diff --git a/chromium/third_party/WebKit/Source/core/fetch/ResourceClient.h b/chromium/third_party/WebKit/Source/core/loader/cache/ResourceClient.h index ae7b7bbcf0c..ae7b7bbcf0c 100644 --- a/chromium/third_party/WebKit/Source/core/fetch/ResourceClient.h +++ b/chromium/third_party/WebKit/Source/core/loader/cache/ResourceClient.h diff --git a/chromium/third_party/WebKit/Source/core/fetch/ResourceClientWalker.h b/chromium/third_party/WebKit/Source/core/loader/cache/ResourceClientWalker.h index cd24b821dfe..aff5f1dcd0b 100644 --- a/chromium/third_party/WebKit/Source/core/fetch/ResourceClientWalker.h +++ b/chromium/third_party/WebKit/Source/core/loader/cache/ResourceClientWalker.h @@ -25,7 +25,7 @@ #ifndef ResourceClientWalker_h #define ResourceClientWalker_h -#include "core/fetch/ResourceClient.h" +#include "core/loader/cache/ResourceClient.h" #include "wtf/HashCountedSet.h" #include "wtf/Vector.h" diff --git a/chromium/third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp b/chromium/third_party/WebKit/Source/core/loader/cache/ResourceFetcher.cpp index 65f5e86d0aa..28d7c8ced74 100644 --- a/chromium/third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp +++ b/chromium/third_party/WebKit/Source/core/loader/cache/ResourceFetcher.cpp @@ -25,21 +25,10 @@ */ #include "config.h" -#include "core/fetch/ResourceFetcher.h" +#include "core/loader/cache/ResourceFetcher.h" #include "bindings/v8/ScriptController.h" #include "core/dom/Document.h" -#include "core/fetch/CSSStyleSheetResource.h" -#include "core/fetch/DocumentResource.h" -#include "core/fetch/FetchRequest.h" -#include "core/fetch/FontResource.h" -#include "core/fetch/ImageResource.h" -#include "core/fetch/MemoryCache.h" -#include "core/fetch/RawResource.h" -#include "core/fetch/ScriptResource.h" -#include "core/fetch/ShaderResource.h" -#include "core/fetch/TextTrackResource.h" -#include "core/fetch/XSLStyleSheetResource.h" #include "core/html/HTMLElement.h" #include "core/html/HTMLFrameOwnerElement.h" #include "core/html/HTMLImport.h" @@ -50,6 +39,17 @@ #include "core/loader/PingLoader.h" #include "core/loader/UniqueIdentifier.h" #include "core/loader/appcache/ApplicationCacheHost.h" +#include "core/loader/cache/CSSStyleSheetResource.h" +#include "core/loader/cache/DocumentResource.h" +#include "core/loader/cache/FetchRequest.h" +#include "core/loader/cache/FontResource.h" +#include "core/loader/cache/ImageResource.h" +#include "core/loader/cache/MemoryCache.h" +#include "core/loader/cache/RawResource.h" +#include "core/loader/cache/ScriptResource.h" +#include "core/loader/cache/ShaderResource.h" +#include "core/loader/cache/TextTrackResource.h" +#include "core/loader/cache/XSLStyleSheetResource.h" #include "core/page/ContentSecurityPolicy.h" #include "core/page/DOMWindow.h" #include "core/page/Frame.h" @@ -204,7 +204,7 @@ Frame* ResourceFetcher::frame() const ResourcePtr<ImageResource> ResourceFetcher::requestImage(FetchRequest& request) { if (Frame* f = frame()) { - if (f->document()->pageDismissalEventBeingDispatched() != Document::NoDismissal) { + if (f->loader()->pageDismissalEventBeingDispatched() != FrameLoader::NoDismissal) { KURL requestURL = request.resourceRequest().url(); if (requestURL.isValid() && canRequest(Resource::Image, requestURL, request.options(), request.forPreload())) PingLoader::loadImage(f, requestURL); diff --git a/chromium/third_party/WebKit/Source/core/fetch/ResourceFetcher.h b/chromium/third_party/WebKit/Source/core/loader/cache/ResourceFetcher.h index 4f4671011cf..c2ffa7ade12 100644 --- a/chromium/third_party/WebKit/Source/core/fetch/ResourceFetcher.h +++ b/chromium/third_party/WebKit/Source/core/loader/cache/ResourceFetcher.h @@ -26,12 +26,12 @@ #ifndef ResourceFetcher_h #define ResourceFetcher_h -#include "core/fetch/CachePolicy.h" -#include "core/fetch/FetchInitiatorInfo.h" -#include "core/fetch/FetchRequest.h" -#include "core/fetch/Resource.h" -#include "core/fetch/ResourceLoaderHost.h" -#include "core/fetch/ResourcePtr.h" +#include "core/loader/ResourceLoaderHost.h" +#include "core/loader/cache/CachePolicy.h" +#include "core/loader/cache/FetchInitiatorInfo.h" +#include "core/loader/cache/FetchRequest.h" +#include "core/loader/cache/Resource.h" +#include "core/loader/cache/ResourcePtr.h" #include "core/platform/Timer.h" #include "wtf/Deque.h" #include "wtf/HashMap.h" diff --git a/chromium/third_party/WebKit/Source/core/fetch/ResourceFetcherTest.cpp b/chromium/third_party/WebKit/Source/core/loader/cache/ResourceFetcherTest.cpp index 951dbfb0f16..977f519ee80 100644 --- a/chromium/third_party/WebKit/Source/core/fetch/ResourceFetcherTest.cpp +++ b/chromium/third_party/WebKit/Source/core/loader/cache/ResourceFetcherTest.cpp @@ -29,14 +29,14 @@ */ #include "config.h" -#include "core/fetch/ResourceFetcher.h" +#include "core/loader/cache/ResourceFetcher.h" -#include "core/fetch/FetchInitiatorInfo.h" -#include "core/fetch/FetchRequest.h" -#include "core/fetch/MemoryCache.h" -#include "core/fetch/ResourcePtr.h" #include "core/html/HTMLDocument.h" #include "core/loader/DocumentLoader.h" +#include "core/loader/cache/FetchInitiatorInfo.h" +#include "core/loader/cache/FetchRequest.h" +#include "core/loader/cache/MemoryCache.h" +#include "core/loader/cache/ResourcePtr.h" #include "core/platform/network/ResourceRequest.h" #include <gtest/gtest.h> diff --git a/chromium/third_party/WebKit/Source/core/fetch/ResourcePtr.cpp b/chromium/third_party/WebKit/Source/core/loader/cache/ResourcePtr.cpp index 4ae11a549b6..bbb43520d88 100644 --- a/chromium/third_party/WebKit/Source/core/fetch/ResourcePtr.cpp +++ b/chromium/third_party/WebKit/Source/core/loader/cache/ResourcePtr.cpp @@ -24,7 +24,7 @@ */ #include "config.h" -#include "core/fetch/ResourcePtr.h" +#include "core/loader/cache/ResourcePtr.h" namespace WebCore { diff --git a/chromium/third_party/WebKit/Source/core/fetch/ResourcePtr.h b/chromium/third_party/WebKit/Source/core/loader/cache/ResourcePtr.h index a9bdd5fcd79..dda4d2d748b 100644 --- a/chromium/third_party/WebKit/Source/core/fetch/ResourcePtr.h +++ b/chromium/third_party/WebKit/Source/core/loader/cache/ResourcePtr.h @@ -26,7 +26,7 @@ #ifndef ResourcePtr_h #define ResourcePtr_h -#include "core/fetch/Resource.h" +#include "core/loader/cache/Resource.h" namespace WebCore { diff --git a/chromium/third_party/WebKit/Source/core/fetch/ScriptResource.cpp b/chromium/third_party/WebKit/Source/core/loader/cache/ScriptResource.cpp index 330a1bf5779..b6e9189bc26 100644 --- a/chromium/third_party/WebKit/Source/core/fetch/ScriptResource.cpp +++ b/chromium/third_party/WebKit/Source/core/loader/cache/ScriptResource.cpp @@ -25,7 +25,7 @@ */ #include "config.h" -#include "core/fetch/ScriptResource.h" +#include "core/loader/cache/ScriptResource.h" #include "core/loader/TextResourceDecoder.h" #include "core/platform/MIMETypeRegistry.h" diff --git a/chromium/third_party/WebKit/Source/core/fetch/ScriptResource.h b/chromium/third_party/WebKit/Source/core/loader/cache/ScriptResource.h index 441a3b06099..02d90ca986b 100644 --- a/chromium/third_party/WebKit/Source/core/fetch/ScriptResource.h +++ b/chromium/third_party/WebKit/Source/core/loader/cache/ScriptResource.h @@ -26,7 +26,7 @@ #ifndef ScriptResource_h #define ScriptResource_h -#include "core/fetch/Resource.h" +#include "core/loader/cache/Resource.h" namespace WebCore { diff --git a/chromium/third_party/WebKit/Source/core/fetch/ShaderResource.cpp b/chromium/third_party/WebKit/Source/core/loader/cache/ShaderResource.cpp index bacaef99c9a..ec60ae11bef 100644 --- a/chromium/third_party/WebKit/Source/core/fetch/ShaderResource.cpp +++ b/chromium/third_party/WebKit/Source/core/loader/cache/ShaderResource.cpp @@ -28,7 +28,7 @@ */ #include "config.h" -#include "core/fetch/ShaderResource.h" +#include "core/loader/cache/ShaderResource.h" #include "core/loader/TextResourceDecoder.h" #include "core/platform/SharedBuffer.h" diff --git a/chromium/third_party/WebKit/Source/core/fetch/ShaderResource.h b/chromium/third_party/WebKit/Source/core/loader/cache/ShaderResource.h index 94856638aa8..f7d2ffe7fbb 100644 --- a/chromium/third_party/WebKit/Source/core/fetch/ShaderResource.h +++ b/chromium/third_party/WebKit/Source/core/loader/cache/ShaderResource.h @@ -30,7 +30,7 @@ #ifndef ShaderResource_h #define ShaderResource_h -#include "core/fetch/Resource.h" +#include "core/loader/cache/Resource.h" namespace WebCore { diff --git a/chromium/third_party/WebKit/Source/core/fetch/StyleSheetResourceClient.h b/chromium/third_party/WebKit/Source/core/loader/cache/StyleSheetResourceClient.h index 6c12bf39a0c..02dc5bcabc6 100644 --- a/chromium/third_party/WebKit/Source/core/fetch/StyleSheetResourceClient.h +++ b/chromium/third_party/WebKit/Source/core/loader/cache/StyleSheetResourceClient.h @@ -26,7 +26,7 @@ #ifndef StyleSheetResourceClient_h #define StyleSheetResourceClient_h -#include "core/fetch/ResourceClient.h" +#include "core/loader/cache/ResourceClient.h" #include "weborigin/KURL.h" #include "wtf/Forward.h" diff --git a/chromium/third_party/WebKit/Source/core/fetch/TextTrackResource.cpp b/chromium/third_party/WebKit/Source/core/loader/cache/TextTrackResource.cpp index 5093d7e26d3..cf5e4a13f07 100644 --- a/chromium/third_party/WebKit/Source/core/fetch/TextTrackResource.cpp +++ b/chromium/third_party/WebKit/Source/core/loader/cache/TextTrackResource.cpp @@ -25,10 +25,10 @@ #include "config.h" -#include "core/fetch/TextTrackResource.h" +#include "core/loader/cache/TextTrackResource.h" -#include "core/fetch/ResourceClient.h" -#include "core/fetch/ResourceClientWalker.h" +#include "core/loader/cache/ResourceClient.h" +#include "core/loader/cache/ResourceClientWalker.h" namespace WebCore { diff --git a/chromium/third_party/WebKit/Source/core/fetch/TextTrackResource.h b/chromium/third_party/WebKit/Source/core/loader/cache/TextTrackResource.h index 3599f0bfa4d..c3c0eba0955 100644 --- a/chromium/third_party/WebKit/Source/core/fetch/TextTrackResource.h +++ b/chromium/third_party/WebKit/Source/core/loader/cache/TextTrackResource.h @@ -26,7 +26,7 @@ #ifndef TextTrackResource_h #define TextTrackResource_h -#include "core/fetch/Resource.h" +#include "core/loader/cache/Resource.h" namespace WebCore { diff --git a/chromium/third_party/WebKit/Source/core/fetch/XSLStyleSheetResource.cpp b/chromium/third_party/WebKit/Source/core/loader/cache/XSLStyleSheetResource.cpp index 5787631d1cd..9d9a014b78e 100644 --- a/chromium/third_party/WebKit/Source/core/fetch/XSLStyleSheetResource.cpp +++ b/chromium/third_party/WebKit/Source/core/loader/cache/XSLStyleSheetResource.cpp @@ -25,11 +25,11 @@ */ #include "config.h" -#include "core/fetch/XSLStyleSheetResource.h" +#include "core/loader/cache/XSLStyleSheetResource.h" -#include "core/fetch/ResourceClientWalker.h" -#include "core/fetch/StyleSheetResourceClient.h" #include "core/loader/TextResourceDecoder.h" +#include "core/loader/cache/ResourceClientWalker.h" +#include "core/loader/cache/StyleSheetResourceClient.h" #include "core/platform/SharedBuffer.h" #include "wtf/Vector.h" diff --git a/chromium/third_party/WebKit/Source/core/fetch/XSLStyleSheetResource.h b/chromium/third_party/WebKit/Source/core/loader/cache/XSLStyleSheetResource.h index 52e6814f635..4cab515a463 100644 --- a/chromium/third_party/WebKit/Source/core/fetch/XSLStyleSheetResource.h +++ b/chromium/third_party/WebKit/Source/core/loader/cache/XSLStyleSheetResource.h @@ -26,7 +26,7 @@ #ifndef XSLStyleSheetResource_h #define XSLStyleSheetResource_h -#include "core/fetch/Resource.h" +#include "core/loader/cache/Resource.h" namespace WebCore { diff --git a/chromium/third_party/WebKit/Source/core/page/AutoscrollController.cpp b/chromium/third_party/WebKit/Source/core/page/AutoscrollController.cpp index c7174c11bf0..71f922e4d16 100644 --- a/chromium/third_party/WebKit/Source/core/page/AutoscrollController.cpp +++ b/chromium/third_party/WebKit/Source/core/page/AutoscrollController.cpp @@ -132,14 +132,11 @@ void AutoscrollController::updateAutoscrollRenderer() void AutoscrollController::updateDragAndDrop(Node* dropTargetNode, const IntPoint& eventPosition, double eventTime) { - if (!dropTargetNode || !dropTargetNode->renderer()) { + if (!dropTargetNode) { stopAutoscrollTimer(); return; } - if (m_autoscrollRenderer && m_autoscrollRenderer->frame() != dropTargetNode->renderer()->frame()) - return; - RenderBox* scrollable = RenderBox::findAutoscrollable(dropTargetNode->renderer()); if (!scrollable) { stopAutoscrollTimer(); diff --git a/chromium/third_party/WebKit/Source/core/page/Chrome.cpp b/chromium/third_party/WebKit/Source/core/page/Chrome.cpp index 8c37e2741a0..9fed91c3719 100644 --- a/chromium/third_party/WebKit/Source/core/page/Chrome.cpp +++ b/chromium/third_party/WebKit/Source/core/page/Chrome.cpp @@ -159,8 +159,8 @@ bool Chrome::canRunModal() const static bool canRunModalIfDuringPageDismissal(Page* page, ChromeClient::DialogType dialog, const String& message) { for (Frame* frame = page->mainFrame(); frame; frame = frame->tree()->traverseNext()) { - Document::PageDismissalType dismissal = frame->document()->pageDismissalEventBeingDispatched(); - if (dismissal != Document::NoDismissal) + FrameLoader::PageDismissalType dismissal = frame->loader()->pageDismissalEventBeingDispatched(); + if (dismissal != FrameLoader::NoDismissal) return page->chrome().client()->shouldRunModalDialogDuringPageDismissal(dialog, message, dismissal); } return true; diff --git a/chromium/third_party/WebKit/Source/core/page/ChromeClient.h b/chromium/third_party/WebKit/Source/core/page/ChromeClient.h index 9ae397b19e2..d97cbff82dd 100644 --- a/chromium/third_party/WebKit/Source/core/page/ChromeClient.h +++ b/chromium/third_party/WebKit/Source/core/page/ChromeClient.h @@ -255,7 +255,7 @@ public: PromptDialog = 2, HTMLDialog = 3 }; - virtual bool shouldRunModalDialogDuringPageDismissal(const DialogType&, const String& dialogMessage, Document::PageDismissalType) const { UNUSED_PARAM(dialogMessage); return true; } + virtual bool shouldRunModalDialogDuringPageDismissal(const DialogType&, const String& dialogMessage, FrameLoader::PageDismissalType) const { UNUSED_PARAM(dialogMessage); return true; } virtual void numWheelEventHandlersChanged(unsigned) = 0; diff --git a/chromium/third_party/WebKit/Source/core/page/ContextMenuClient.h b/chromium/third_party/WebKit/Source/core/page/ContextMenuClient.h index 76a2ee46b01..964924ba5fd 100644 --- a/chromium/third_party/WebKit/Source/core/page/ContextMenuClient.h +++ b/chromium/third_party/WebKit/Source/core/page/ContextMenuClient.h @@ -34,7 +34,6 @@ class ContextMenuClient { public: virtual ~ContextMenuClient() { } virtual void showContextMenu(const ContextMenu*) = 0; - virtual void clearContextMenu() = 0; }; } diff --git a/chromium/third_party/WebKit/Source/core/page/ContextMenuController.cpp b/chromium/third_party/WebKit/Source/core/page/ContextMenuController.cpp index 77797e389c8..c12a904cd04 100644 --- a/chromium/third_party/WebKit/Source/core/page/ContextMenuController.cpp +++ b/chromium/third_party/WebKit/Source/core/page/ContextMenuController.cpp @@ -64,17 +64,6 @@ void ContextMenuController::clearContextMenu() if (m_menuProvider) m_menuProvider->contextMenuCleared(); m_menuProvider = 0; - m_hitTestResult = HitTestResult(); - m_client->clearContextMenu(); -} - -void ContextMenuController::documentDetached(Document* document) -{ - if (Node* innerNode = m_hitTestResult.innerNode()) { - // Invalidate the context menu info if its target document is detached. - if (innerNode->document() == document) - clearContextMenu(); - } } void ContextMenuController::handleContextMenuEvent(Event* event) diff --git a/chromium/third_party/WebKit/Source/core/page/ContextMenuController.h b/chromium/third_party/WebKit/Source/core/page/ContextMenuController.h index e36bedbd666..a2b6ae6f6f6 100644 --- a/chromium/third_party/WebKit/Source/core/page/ContextMenuController.h +++ b/chromium/third_party/WebKit/Source/core/page/ContextMenuController.h @@ -38,7 +38,6 @@ namespace WebCore { class ContextMenuClient; class ContextMenuItem; class ContextMenuProvider; - class Document; class Event; class Page; @@ -52,8 +51,6 @@ namespace WebCore { ContextMenu* contextMenu() const { return m_contextMenu.get(); } void clearContextMenu(); - void documentDetached(Document*); - void handleContextMenuEvent(Event*); void showContextMenu(Event*, PassRefPtr<ContextMenuProvider>); diff --git a/chromium/third_party/WebKit/Source/core/page/DOMWindow.cpp b/chromium/third_party/WebKit/Source/core/page/DOMWindow.cpp index 6d15a99982a..aac917c7d46 100644 --- a/chromium/third_party/WebKit/Source/core/page/DOMWindow.cpp +++ b/chromium/third_party/WebKit/Source/core/page/DOMWindow.cpp @@ -70,7 +70,6 @@ #include "core/page/Console.h" #include "core/page/CreateWindow.h" #include "core/page/DOMPoint.h" -#include "core/page/DOMWindowLifecycleNotifier.h" #include "core/page/EventHandler.h" #include "core/page/Frame.h" #include "core/page/FrameTree.h" @@ -639,20 +638,14 @@ Storage* DOMWindow::sessionStorage(ExceptionState& es) const if (!document) return 0; - String accessDeniedMessage = "Access to 'sessionStorage' is denied for this document."; if (!document->securityOrigin()->canAccessLocalStorage()) { - if (document->isSandboxed(SandboxOrigin)) - es.throwDOMException(SecurityError, accessDeniedMessage + " The document is sandboxed and lacks the \"allow-same-origin\" flag."); - else if (document->url().protocolIs("data")) - es.throwDOMException(SecurityError, accessDeniedMessage + " Storage is disabled inside 'data:' URLs."); - else - es.throwDOMException(SecurityError, accessDeniedMessage); + es.throwDOMException(SecurityError); return 0; } if (m_sessionStorage) { if (!m_sessionStorage->area()->canAccessStorage(m_frame)) { - es.throwDOMException(SecurityError, accessDeniedMessage); + es.throwDOMException(SecurityError); return 0; } return m_sessionStorage.get(); @@ -664,7 +657,7 @@ Storage* DOMWindow::sessionStorage(ExceptionState& es) const OwnPtr<StorageArea> storageArea = page->sessionStorage()->storageArea(document->securityOrigin()); if (!storageArea->canAccessStorage(m_frame)) { - es.throwDOMException(SecurityError, accessDeniedMessage); + es.throwDOMException(SecurityError); return 0; } @@ -681,20 +674,14 @@ Storage* DOMWindow::localStorage(ExceptionState& es) const if (!document) return 0; - String accessDeniedMessage = "Access to 'localStorage' is denied for this document."; if (!document->securityOrigin()->canAccessLocalStorage()) { - if (document->isSandboxed(SandboxOrigin)) - es.throwDOMException(SecurityError, accessDeniedMessage + " The document is sandboxed and lacks the \"allow-same-origin\" flag."); - else if (document->url().protocolIs("data")) - es.throwDOMException(SecurityError, accessDeniedMessage + " Storage is disabled inside 'data:' URLs."); - else - es.throwDOMException(SecurityError, accessDeniedMessage); + es.throwDOMException(SecurityError); return 0; } if (m_localStorage) { if (!m_localStorage->area()->canAccessStorage(m_frame)) { - es.throwDOMException(SecurityError, accessDeniedMessage); + es.throwDOMException(SecurityError); return 0; } return m_localStorage.get(); @@ -709,7 +696,7 @@ Storage* DOMWindow::localStorage(ExceptionState& es) const OwnPtr<StorageArea> storageArea = StorageNamespace::localStorageArea(document->securityOrigin()); if (!storageArea->canAccessStorage(m_frame)) { - es.throwDOMException(SecurityError, accessDeniedMessage); + es.throwDOMException(SecurityError); return 0; } @@ -736,7 +723,7 @@ void DOMWindow::postMessage(PassRefPtr<SerializedScriptValue> message, const Mes // It doesn't make sense target a postMessage at a unique origin // because there's no way to represent a unique origin in a string. if (target->isUnique()) { - es.throwDOMException(SyntaxError, "Invalid target origin '" + targetOrigin + "' in a call to 'postMessage'."); + es.throwDOMException(SyntaxError); return; } } @@ -1254,7 +1241,11 @@ double DOMWindow::devicePixelRatio() const if (!m_frame) return 0.0; - return m_frame->devicePixelRatio(); + Page* page = m_frame->page(); + if (!page) + return 0.0; + + return page->deviceScaleFactor(); } void DOMWindow::scrollBy(int x, int y) const @@ -1513,7 +1504,8 @@ void DOMWindow::removeAllEventListeners() { EventTarget::removeAllEventListeners(); - lifecycleNotifier()->notifyRemoveAllEventListeners(); + if (DeviceMotionController* controller = DeviceMotionController::from(document())) + controller->stopUpdating(); if (DeviceOrientationController* controller = DeviceOrientationController::from(page())) controller->removeAllDeviceEventListeners(this); if (Document* document = this->document()) @@ -1738,15 +1730,5 @@ DOMWindow* DOMWindow::anonymousIndexedGetter(uint32_t index) return 0; } -DOMWindowLifecycleNotifier* DOMWindow::lifecycleNotifier() -{ - return static_cast<DOMWindowLifecycleNotifier*>(LifecycleContext::lifecycleNotifier()); -} - -PassOwnPtr<LifecycleNotifier> DOMWindow::createLifecycleNotifier() -{ - return DOMWindowLifecycleNotifier::create(this); -} - } // namespace WebCore diff --git a/chromium/third_party/WebKit/Source/core/page/DOMWindow.h b/chromium/third_party/WebKit/Source/core/page/DOMWindow.h index 8a1df0ed226..ae98cf0a1fb 100644 --- a/chromium/third_party/WebKit/Source/core/page/DOMWindow.h +++ b/chromium/third_party/WebKit/Source/core/page/DOMWindow.h @@ -30,7 +30,6 @@ #include "bindings/v8/ScriptWrappable.h" #include "core/dom/EventTarget.h" #include "core/page/FrameDestructionObserver.h" -#include "core/platform/LifecycleContext.h" #include "core/platform/Supplementable.h" #include "wtf/Forward.h" @@ -48,7 +47,6 @@ namespace WebCore { class Database; class DatabaseCallback; class Document; - class DOMWindowLifecycleNotifier; class Element; class EventListener; class ExceptionState; @@ -81,7 +79,7 @@ namespace WebCore { enum SetLocationLocking { LockHistoryBasedOnGestureState, LockHistoryAndBackForwardList }; - class DOMWindow : public RefCounted<DOMWindow>, public ScriptWrappable, public EventTarget, public FrameDestructionObserver, public Supplementable<DOMWindow>, public LifecycleContext { + class DOMWindow : public RefCounted<DOMWindow>, public ScriptWrappable, public EventTarget, public FrameDestructionObserver, public Supplementable<DOMWindow> { public: static PassRefPtr<DOMWindow> create(Frame* frame) { return adoptRef(new DOMWindow(frame)); } virtual ~DOMWindow(); @@ -374,16 +372,11 @@ namespace WebCore { bool isInsecureScriptAccess(DOMWindow* activeWindow, const String& urlString); - protected: - DOMWindowLifecycleNotifier* lifecycleNotifier(); - private: explicit DOMWindow(Frame*); Page* page(); - virtual PassOwnPtr<LifecycleNotifier> createLifecycleNotifier() OVERRIDE; - virtual void frameDestroyed() OVERRIDE; virtual void willDetachPage() OVERRIDE; diff --git a/chromium/third_party/WebKit/Source/core/page/DOMWindowBase64.cpp b/chromium/third_party/WebKit/Source/core/page/DOMWindowBase64.cpp index 6411d142135..78c0ea1a51a 100644 --- a/chromium/third_party/WebKit/Source/core/page/DOMWindowBase64.cpp +++ b/chromium/third_party/WebKit/Source/core/page/DOMWindowBase64.cpp @@ -65,7 +65,7 @@ String atob(void*, const String& encodedString, ExceptionState& es) } Vector<char> out; - if (!base64Decode(encodedString, out, Base64FailOnInvalidCharacterOrExcessPadding)) { + if (!base64Decode(encodedString, out, Base64FailOnInvalidCharacter, Base64StrictPaddingValidation)) { es.throwDOMException(InvalidCharacterError, "'atob' failed: The string to be decoded is not correctly encoded."); return String(); } diff --git a/chromium/third_party/WebKit/Source/core/page/DOMWindowLifecycleNotifier.cpp b/chromium/third_party/WebKit/Source/core/page/DOMWindowLifecycleNotifier.cpp deleted file mode 100644 index 782198aa503..00000000000 --- a/chromium/third_party/WebKit/Source/core/page/DOMWindowLifecycleNotifier.cpp +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (C) 2013 Google Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -#include "config.h" -#include "core/page/DOMWindowLifecycleNotifier.h" - -namespace WebCore { - -DOMWindowLifecycleNotifier::DOMWindowLifecycleNotifier(LifecycleContext* context) - : LifecycleNotifier(context) -{ -} - -void DOMWindowLifecycleNotifier::addObserver(LifecycleObserver* observer, LifecycleObserver::Type type) -{ - if (type == LifecycleObserver::DOMWindowLifecycleObserverType) { - RELEASE_ASSERT(m_iterating != IteratingOverDOMWindowObservers); - m_windowObservers.add(static_cast<DOMWindowLifecycleObserver*>(observer)); - } - - LifecycleNotifier::addObserver(observer, type); -} - -void DOMWindowLifecycleNotifier::removeObserver(LifecycleObserver* observer, LifecycleObserver::Type type) -{ - if (type == LifecycleObserver::DOMWindowLifecycleObserverType) { - RELEASE_ASSERT(m_iterating != IteratingOverDOMWindowObservers); - m_windowObservers.remove(static_cast<DOMWindowLifecycleObserver*>(observer)); - } - - LifecycleNotifier::removeObserver(observer, type); -} - -} // namespace WebCore diff --git a/chromium/third_party/WebKit/Source/core/page/DOMWindowLifecycleNotifier.h b/chromium/third_party/WebKit/Source/core/page/DOMWindowLifecycleNotifier.h deleted file mode 100644 index 49e1aa04036..00000000000 --- a/chromium/third_party/WebKit/Source/core/page/DOMWindowLifecycleNotifier.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (C) 2013 Google Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef DOMWindowLifecycleNotifier_h -#define DOMWindowLifecycleNotifier_h - -#include "core/page/DOMWindowLifecycleObserver.h" -#include "core/platform/LifecycleNotifier.h" -#include "wtf/PassOwnPtr.h" -#include "wtf/TemporaryChange.h" - -namespace WebCore { - -class DOMWindow; - -class DOMWindowLifecycleNotifier : public LifecycleNotifier { -public: - static PassOwnPtr<DOMWindowLifecycleNotifier> create(LifecycleContext*); - - void notifyRemoveAllEventListeners(); - - virtual void addObserver(LifecycleObserver*, LifecycleObserver::Type) OVERRIDE; - virtual void removeObserver(LifecycleObserver*, LifecycleObserver::Type) OVERRIDE; - -private: - explicit DOMWindowLifecycleNotifier(LifecycleContext*); - - typedef HashSet<DOMWindowLifecycleObserver*> DOMWindowObserverSet; - DOMWindowObserverSet m_windowObservers; -}; - -inline PassOwnPtr<DOMWindowLifecycleNotifier> DOMWindowLifecycleNotifier::create(LifecycleContext* context) -{ - return adoptPtr(new DOMWindowLifecycleNotifier(context)); -} - -inline void DOMWindowLifecycleNotifier::notifyRemoveAllEventListeners() -{ - TemporaryChange<IterationType> scope(this->m_iterating, IteratingOverDOMWindowObservers); - for (DOMWindowObserverSet::iterator it = m_windowObservers.begin(); it != m_windowObservers.end(); ++it) - (*it)->removeAllEventListeners(); -} - -} // namespace WebCore - -#endif // DOMWindowLifecycleNotifier_h diff --git a/chromium/third_party/WebKit/Source/core/page/DOMWindowLifecycleObserver.cpp b/chromium/third_party/WebKit/Source/core/page/DOMWindowLifecycleObserver.cpp deleted file mode 100644 index bd939d2dcc9..00000000000 --- a/chromium/third_party/WebKit/Source/core/page/DOMWindowLifecycleObserver.cpp +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (C) 2013 Google Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -#include "config.h" -#include "core/page/DOMWindowLifecycleObserver.h" - -#include "core/page/DOMWindow.h" - -namespace WebCore { - -DOMWindowLifecycleObserver::DOMWindowLifecycleObserver(DOMWindow* window) - : LifecycleObserver(window, DOMWindowLifecycleObserverType) -{ -} - -DOMWindowLifecycleObserver::~DOMWindowLifecycleObserver() -{ - observeContext(0, DOMWindowLifecycleObserverType); -} - -DOMWindow* DOMWindowLifecycleObserver::window() const -{ - return static_cast<DOMWindow*>(lifecycleContext()); -} - -} // namespace WebCore diff --git a/chromium/third_party/WebKit/Source/core/page/DOMWindowLifecycleObserver.h b/chromium/third_party/WebKit/Source/core/page/DOMWindowLifecycleObserver.h deleted file mode 100644 index 79aa15369d0..00000000000 --- a/chromium/third_party/WebKit/Source/core/page/DOMWindowLifecycleObserver.h +++ /dev/null @@ -1,48 +0,0 @@ - -/* - * Copyright (C) 2013 Google Inc. All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef DOMWindowLifecycleObserver_h -#define DOMWindowLifecycleObserver_h - -#include "core/platform/LifecycleObserver.h" - -namespace WebCore { - -class DOMWindow; - -class DOMWindowLifecycleObserver : public LifecycleObserver { -public: - explicit DOMWindowLifecycleObserver(DOMWindow*); - virtual ~DOMWindowLifecycleObserver(); - - DOMWindow* window() const; - - virtual void removeAllEventListeners() { } -}; - -} // namespace WebCore - -#endif // DOMWindowLifecycleObserver_h diff --git a/chromium/third_party/WebKit/Source/core/page/DragController.cpp b/chromium/third_party/WebKit/Source/core/page/DragController.cpp index b2c61293e7d..bf38105b806 100644 --- a/chromium/third_party/WebKit/Source/core/page/DragController.cpp +++ b/chromium/third_party/WebKit/Source/core/page/DragController.cpp @@ -44,14 +44,14 @@ #include "core/editing/ReplaceSelectionCommand.h" #include "core/editing/htmlediting.h" #include "core/editing/markup.h" -#include "core/fetch/ImageResource.h" -#include "core/fetch/ResourceFetcher.h" #include "core/html/HTMLAnchorElement.h" #include "core/html/HTMLFormElement.h" #include "core/html/HTMLInputElement.h" #include "core/html/HTMLPlugInElement.h" #include "core/loader/FrameLoadRequest.h" #include "core/loader/FrameLoader.h" +#include "core/loader/cache/ImageResource.h" +#include "core/loader/cache/ResourceFetcher.h" #include "core/page/DragActions.h" #include "core/page/DragClient.h" #include "core/page/DragSession.h" diff --git a/chromium/third_party/WebKit/Source/core/page/EventHandler.cpp b/chromium/third_party/WebKit/Source/core/page/EventHandler.cpp index 6adea5a3b6a..8ab18afae21 100644 --- a/chromium/third_party/WebKit/Source/core/page/EventHandler.cpp +++ b/chromium/third_party/WebKit/Source/core/page/EventHandler.cpp @@ -50,12 +50,12 @@ #include "core/editing/FrameSelection.h" #include "core/editing/TextIterator.h" #include "core/editing/htmlediting.h" -#include "core/fetch/ImageResource.h" #include "core/history/BackForwardController.h" #include "core/html/HTMLFrameElementBase.h" #include "core/html/HTMLFrameSetElement.h" #include "core/html/HTMLInputElement.h" #include "core/loader/FrameLoader.h" +#include "core/loader/cache/ImageResource.h" #include "core/page/Chrome.h" #include "core/page/DragController.h" #include "core/page/DragState.h" diff --git a/chromium/third_party/WebKit/Source/core/page/Frame.cpp b/chromium/third_party/WebKit/Source/core/page/Frame.cpp index adbe6d3cb02..a3e42b6f9d5 100644 --- a/chromium/third_party/WebKit/Source/core/page/Frame.cpp +++ b/chromium/third_party/WebKit/Source/core/page/Frame.cpp @@ -39,10 +39,10 @@ #include "core/editing/InputMethodController.h" #include "core/editing/htmlediting.h" #include "core/editing/markup.h" -#include "core/fetch/ResourceFetcher.h" #include "core/html/HTMLFrameElementBase.h" #include "core/loader/FrameLoader.h" #include "core/loader/FrameLoaderClient.h" +#include "core/loader/cache/ResourceFetcher.h" #include "core/page/Chrome.h" #include "core/page/ChromeClient.h" #include "core/page/DOMWindow.h" @@ -709,15 +709,4 @@ PassOwnPtr<DragImage> Frame::dragImageForSelection() return DragImage::create(image.get()); } -double Frame::devicePixelRatio() const -{ - if (!m_page) - return 0; - - double ratio = m_page->deviceScaleFactor(); - if (RuntimeEnabledFeatures::devicePixelRatioIncludesZoomEnabled()) - ratio *= pageZoomFactor(); - return ratio; -} - } // namespace WebCore diff --git a/chromium/third_party/WebKit/Source/core/page/Frame.h b/chromium/third_party/WebKit/Source/core/page/Frame.h index 3590900ccc9..47fdc5a1275 100644 --- a/chromium/third_party/WebKit/Source/core/page/Frame.h +++ b/chromium/third_party/WebKit/Source/core/page/Frame.h @@ -135,7 +135,6 @@ namespace WebCore { void setPageAndTextZoomFactors(float pageZoomFactor, float textZoomFactor); void deviceOrPageScaleFactorChanged(); - double devicePixelRatio() const; #if ENABLE(ORIENTATION_EVENTS) // Orientation is the interface orientation in degrees. Some examples are: diff --git a/chromium/third_party/WebKit/Source/core/page/FrameView.cpp b/chromium/third_party/WebKit/Source/core/page/FrameView.cpp index 8f0cb6b8f1c..72c0b0293a3 100644 --- a/chromium/third_party/WebKit/Source/core/page/FrameView.cpp +++ b/chromium/third_party/WebKit/Source/core/page/FrameView.cpp @@ -36,7 +36,6 @@ #include "core/dom/DocumentMarkerController.h" #include "core/dom/OverflowEvent.h" #include "core/editing/FrameSelection.h" -#include "core/fetch/ResourceFetcher.h" #include "core/html/HTMLFrameElement.h" #include "core/html/HTMLHtmlElement.h" #include "core/html/HTMLPlugInImageElement.h" @@ -44,6 +43,7 @@ #include "core/loader/FrameLoader.h" #include "core/loader/FrameLoaderClient.h" #include "core/loader/TextResourceDecoder.h" +#include "core/loader/cache/ResourceFetcher.h" #include "core/page/Chrome.h" #include "core/page/ChromeClient.h" #include "core/page/EventHandler.h" diff --git a/chromium/third_party/WebKit/Source/core/page/ImageBitmap.cpp b/chromium/third_party/WebKit/Source/core/page/ImageBitmap.cpp index 006594a9c0d..a4301c031e9 100644 --- a/chromium/third_party/WebKit/Source/core/page/ImageBitmap.cpp +++ b/chromium/third_party/WebKit/Source/core/page/ImageBitmap.cpp @@ -124,17 +124,6 @@ ImageBitmap::ImageBitmap(ImageBitmap* bitmap, const IntRect& cropRect) ScriptWrappable::init(this); } -ImageBitmap::ImageBitmap(Image* image, const IntRect& cropRect) - : m_cropRect(cropRect) - , m_imageElement(0) -{ - IntRect srcRect = intersection(cropRect, IntRect(IntPoint(), image->size())); - m_bitmap = cropImage(image, cropRect); - m_bitmapRect = IntRect(IntPoint(max(0, -cropRect.x()), max(0, -cropRect.y())), srcRect.size()); - - ScriptWrappable::init(this); -} - ImageBitmap::~ImageBitmap() { if (m_imageElement) @@ -144,37 +133,36 @@ ImageBitmap::~ImageBitmap() PassRefPtr<ImageBitmap> ImageBitmap::create(HTMLImageElement* image, const IntRect& cropRect) { IntRect normalizedCropRect = normalizeRect(cropRect); - return adoptRef(new ImageBitmap(image, normalizedCropRect)); + RefPtr<ImageBitmap> imageBitmap(adoptRef(new ImageBitmap(image, normalizedCropRect))); + return imageBitmap.release(); } PassRefPtr<ImageBitmap> ImageBitmap::create(HTMLVideoElement* video, const IntRect& cropRect) { IntRect normalizedCropRect = normalizeRect(cropRect); - return adoptRef(new ImageBitmap(video, normalizedCropRect)); + RefPtr<ImageBitmap> imageBitmap(adoptRef(new ImageBitmap(video, normalizedCropRect))); + return imageBitmap.release(); } PassRefPtr<ImageBitmap> ImageBitmap::create(HTMLCanvasElement* canvas, const IntRect& cropRect) { IntRect normalizedCropRect = normalizeRect(cropRect); - return adoptRef(new ImageBitmap(canvas, normalizedCropRect)); + RefPtr<ImageBitmap> imageBitmap(adoptRef(new ImageBitmap(canvas, normalizedCropRect))); + return imageBitmap.release(); } PassRefPtr<ImageBitmap> ImageBitmap::create(ImageData* data, const IntRect& cropRect) { IntRect normalizedCropRect = normalizeRect(cropRect); - return adoptRef(new ImageBitmap(data, normalizedCropRect)); + RefPtr<ImageBitmap> imageBitmap(adoptRef(new ImageBitmap(data, normalizedCropRect))); + return imageBitmap.release(); } PassRefPtr<ImageBitmap> ImageBitmap::create(ImageBitmap* bitmap, const IntRect& cropRect) { IntRect normalizedCropRect = normalizeRect(cropRect); - return adoptRef(new ImageBitmap(bitmap, normalizedCropRect)); -} - -PassRefPtr<ImageBitmap> ImageBitmap::create(Image* image, const IntRect& cropRect) -{ - IntRect normalizedCropRect = normalizeRect(cropRect); - return adoptRef(new ImageBitmap(image, normalizedCropRect)); + RefPtr<ImageBitmap> imageBitmap(adoptRef(new ImageBitmap(bitmap, normalizedCropRect))); + return imageBitmap.release(); } void ImageBitmap::notifyImageSourceChanged() diff --git a/chromium/third_party/WebKit/Source/core/page/ImageBitmap.h b/chromium/third_party/WebKit/Source/core/page/ImageBitmap.h index 2182f166d15..9ad5e765a37 100644 --- a/chromium/third_party/WebKit/Source/core/page/ImageBitmap.h +++ b/chromium/third_party/WebKit/Source/core/page/ImageBitmap.h @@ -27,7 +27,6 @@ public: static PassRefPtr<ImageBitmap> create(HTMLCanvasElement*, const IntRect&); static PassRefPtr<ImageBitmap> create(ImageData*, const IntRect&); static PassRefPtr<ImageBitmap> create(ImageBitmap*, const IntRect&); - static PassRefPtr<ImageBitmap> create(Image*, const IntRect&); PassRefPtr<Image> bitmapImage() const; PassRefPtr<HTMLImageElement> imageElement() const { return m_imageElement; } @@ -47,7 +46,6 @@ private: ImageBitmap(HTMLCanvasElement*, const IntRect&); ImageBitmap(ImageData*, const IntRect&); ImageBitmap(ImageBitmap*, const IntRect&); - ImageBitmap(Image*, const IntRect&); // ImageLoaderClient virtual void notifyImageSourceChanged(); diff --git a/chromium/third_party/WebKit/Source/core/page/ImageBitmapFactories.cpp b/chromium/third_party/WebKit/Source/core/page/ImageBitmapFactories.cpp new file mode 100644 index 00000000000..a68e94e4eae --- /dev/null +++ b/chromium/third_party/WebKit/Source/core/page/ImageBitmapFactories.cpp @@ -0,0 +1,223 @@ +/* + * Copyright (c) 2013, Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "core/page/ImageBitmapFactories.h" + +#include "RuntimeEnabledFeatures.h" +#include "V8ImageBitmap.h" +#include "bindings/v8/ExceptionState.h" +#include "core/dom/ExceptionCode.h" +#include "core/html/HTMLCanvasElement.h" +#include "core/html/HTMLImageElement.h" +#include "core/html/HTMLVideoElement.h" +#include "core/html/ImageData.h" +#include "core/html/canvas/CanvasRenderingContext2D.h" +#include "core/page/DOMWindow.h" +#include "core/page/ImageBitmap.h" + +namespace WebCore { + +namespace ImageBitmapFactories { + +static LayoutSize sizeFor(HTMLImageElement* image) +{ + if (ImageResource* cachedImage = image->cachedImage()) + return cachedImage->imageSizeForRenderer(image->renderer(), 1.0f); // FIXME: Not sure about this. + return IntSize(); +} + +static IntSize sizeFor(HTMLVideoElement* video) +{ + if (MediaPlayer* player = video->player()) + return player->naturalSize(); + return IntSize(); +} + +static ScriptObject resolveImageBitmap(PassRefPtr<ImageBitmap> imageBitmap) +{ + // Promises must be enabled. + ASSERT(RuntimeEnabledFeatures::promiseEnabled()); + + RefPtr<ScriptPromiseResolver> resolver = ScriptPromiseResolver::create(); + resolver->fulfill(imageBitmap); + return resolver->promise(); +} + +ScriptObject createImageBitmap(EventTarget* eventTarget, HTMLImageElement* image, ExceptionState& es) +{ + LayoutSize s = sizeFor(image); + return createImageBitmap(eventTarget, image, 0, 0, s.width(), s.height(), es); +} + +ScriptObject createImageBitmap(EventTarget* eventTarget, HTMLImageElement* image, int sx, int sy, int sw, int sh, ExceptionState& es) +{ + if (!image) { + es.throwTypeError(); + return ScriptObject(); + } + if (!image->cachedImage()) { + es.throwDOMException(InvalidStateError); + return ScriptObject(); + } + if (image->cachedImage()->image()->isSVGImage()) { + es.throwDOMException(InvalidStateError); + return ScriptObject(); + } + if (!sw || !sh) { + es.throwDOMException(IndexSizeError); + return ScriptObject(); + } + if (!image->cachedImage()->image()->hasSingleSecurityOrigin()) { + es.throwDOMException(SecurityError); + return ScriptObject(); + } + if (!image->cachedImage()->passesAccessControlCheck(eventTarget->toDOMWindow()->document()->securityOrigin()) + && eventTarget->toDOMWindow()->document()->securityOrigin()->taintsCanvas(image->src())) { + es.throwDOMException(SecurityError); + return ScriptObject(); + } + // FIXME: make ImageBitmap creation asynchronous crbug.com/258082 + return resolveImageBitmap(ImageBitmap::create(image, IntRect(sx, sy, sw, sh))); +} + +ScriptObject createImageBitmap(EventTarget* eventTarget, HTMLVideoElement* video, ExceptionState& es) +{ + IntSize s = sizeFor(video); + return createImageBitmap(eventTarget, video, 0, 0, s.width(), s.height(), es); +} + +ScriptObject createImageBitmap(EventTarget* eventTarget, HTMLVideoElement* video, int sx, int sy, int sw, int sh, ExceptionState& es) +{ + if (!video) { + es.throwTypeError(); + return ScriptObject(); + } + if (!video->player()) { + es.throwDOMException(InvalidStateError); + return ScriptObject(); + } + if (video->networkState() == HTMLMediaElement::NETWORK_EMPTY) { + es.throwDOMException(InvalidStateError); + return ScriptObject(); + } + if (video->player()->readyState() <= MediaPlayer::HaveMetadata) { + es.throwDOMException(InvalidStateError); + return ScriptObject(); + } + if (!sw || !sh) { + es.throwDOMException(IndexSizeError); + return ScriptObject(); + } + if (!video->hasSingleSecurityOrigin()) { + es.throwDOMException(SecurityError); + return ScriptObject(); + } + if (!video->player()->didPassCORSAccessCheck() && eventTarget->toDOMWindow()->document()->securityOrigin()->taintsCanvas(video->currentSrc())) { + es.throwDOMException(SecurityError); + return ScriptObject(); + } + // FIXME: make ImageBitmap creation asynchronous crbug.com/258082 + return resolveImageBitmap(ImageBitmap::create(video, IntRect(sx, sy, sw, sh))); +} + +ScriptObject createImageBitmap(EventTarget* eventTarget, CanvasRenderingContext2D* context, ExceptionState& es) +{ + return createImageBitmap(eventTarget, context->canvas(), es); +} + +ScriptObject createImageBitmap(EventTarget* eventTarget, CanvasRenderingContext2D* context, int sx, int sy, int sw, int sh, ExceptionState& es) +{ + return createImageBitmap(eventTarget, context->canvas(), sx, sy, sw, sh, es); +} + +ScriptObject createImageBitmap(EventTarget* eventTarget, HTMLCanvasElement* canvas, ExceptionState& es) +{ + return createImageBitmap(eventTarget, canvas, 0, 0, canvas->width(), canvas->height(), es); +} + +ScriptObject createImageBitmap(EventTarget* eventTarget, HTMLCanvasElement* canvas, int sx, int sy, int sw, int sh, ExceptionState& es) +{ + if (!canvas) { + es.throwTypeError(); + return ScriptObject(); + } + if (!canvas->originClean()) { + es.throwDOMException(InvalidStateError); + return ScriptObject(); + } + if (!sw || !sh) { + es.throwDOMException(IndexSizeError); + return ScriptObject(); + } + // FIXME: make ImageBitmap creation asynchronous crbug.com/258082 + return resolveImageBitmap(ImageBitmap::create(canvas, IntRect(sx, sy, sw, sh))); +} + +ScriptObject createImageBitmap(EventTarget* eventTarget, ImageData* data, ExceptionState& es) +{ + return createImageBitmap(eventTarget, data, 0, 0, data->width(), data->height(), es); +} + +ScriptObject createImageBitmap(EventTarget* eventTarget, ImageData* data, int sx, int sy, int sw, int sh, ExceptionState& es) +{ + if (!data) { + es.throwTypeError(); + return ScriptObject(); + } + if (!sw || !sh) { + es.throwDOMException(IndexSizeError); + return ScriptObject(); + } + // FIXME: make ImageBitmap creation asynchronous crbug.com/258082 + return resolveImageBitmap(ImageBitmap::create(data, IntRect(sx, sy, sw, sh))); +} + +ScriptObject createImageBitmap(EventTarget* eventTarget, ImageBitmap* bitmap, ExceptionState& es) +{ + return createImageBitmap(eventTarget, bitmap, 0, 0, bitmap->width(), bitmap->height(), es); +} + +ScriptObject createImageBitmap(EventTarget* eventTarget, ImageBitmap* bitmap, int sx, int sy, int sw, int sh, ExceptionState& es) +{ + if (!bitmap) { + es.throwTypeError(); + return ScriptObject(); + } + if (!sw || !sh) { + es.throwDOMException(IndexSizeError); + return ScriptObject(); + } + // FIXME: make ImageBitmap creation asynchronous crbug.com/258082 + return resolveImageBitmap(ImageBitmap::create(bitmap, IntRect(sx, sy, sw, sh))); +} + +} // namespace ImageBitmapFactories +} // namespace WebCore diff --git a/chromium/third_party/WebKit/Source/core/page/ImageBitmapFactories.h b/chromium/third_party/WebKit/Source/core/page/ImageBitmapFactories.h new file mode 100644 index 00000000000..05feca4ffc1 --- /dev/null +++ b/chromium/third_party/WebKit/Source/core/page/ImageBitmapFactories.h @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2013, Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ImageBitmapFactories_h +#define ImageBitmapFactories_h + +#include "bindings/v8/ScriptPromiseResolver.h" + +namespace WebCore { + +class CanvasRenderingContext2D; +class EventTarget; +class ExceptionState; +class HTMLCanvasElement; +class HTMLImageElement; +class HTMLVideoElement; +class ImageBitmap; +class ImageData; + +namespace ImageBitmapFactories { + +ScriptObject createImageBitmap(EventTarget*, HTMLImageElement*, ExceptionState&); +ScriptObject createImageBitmap(EventTarget*, HTMLImageElement*, int sx, int sy, int sw, int sh, ExceptionState&); +ScriptObject createImageBitmap(EventTarget*, HTMLVideoElement*, ExceptionState&); +ScriptObject createImageBitmap(EventTarget*, HTMLVideoElement*, int sx, int sy, int sw, int sh, ExceptionState&); +ScriptObject createImageBitmap(EventTarget*, CanvasRenderingContext2D*, ExceptionState&); +ScriptObject createImageBitmap(EventTarget*, CanvasRenderingContext2D*, int sx, int sy, int sw, int sh, ExceptionState&); +ScriptObject createImageBitmap(EventTarget*, HTMLCanvasElement*, ExceptionState&); +ScriptObject createImageBitmap(EventTarget*, HTMLCanvasElement*, int sx, int sy, int sw, int sh, ExceptionState&); +ScriptObject createImageBitmap(EventTarget*, ImageData*, ExceptionState&); +ScriptObject createImageBitmap(EventTarget*, ImageData*, int sx, int sy, int sw, int sh, ExceptionState&); +ScriptObject createImageBitmap(EventTarget*, ImageBitmap*, ExceptionState&); +ScriptObject createImageBitmap(EventTarget*, ImageBitmap*, int sx, int sy, int sw, int sh, ExceptionState&); + +} // namesapce ImageBitmapFactories +} // namespace WebCore + +#endif // ImageBitmapFactories_h diff --git a/chromium/third_party/WebKit/Source/modules/imagebitmap/ImageBitmapFactories.idl b/chromium/third_party/WebKit/Source/core/page/ImageBitmapFactories.idl index d704ba00764..65c0dc6c549 100644 --- a/chromium/third_party/WebKit/Source/modules/imagebitmap/ImageBitmapFactories.idl +++ b/chromium/third_party/WebKit/Source/core/page/ImageBitmapFactories.idl @@ -41,8 +41,6 @@ [RaisesException] any createImageBitmap(CanvasRenderingContext2D context, long sx, long sy, long sw, long sh); [RaisesException] any createImageBitmap(HTMLCanvasElement canvas); [RaisesException] any createImageBitmap(HTMLCanvasElement canvas, long sx, long sy, long sw, long sh); - [RaisesException] any createImageBitmap(Blob blob); - [RaisesException] any createImageBitmap(Blob blob, long sx, long sy, long sw, long sh); [RaisesException] any createImageBitmap(ImageData data); [RaisesException] any createImageBitmap(ImageData data, long sx, long sy, long sw, long sh); [RaisesException] any createImageBitmap(ImageBitmap bitmap); diff --git a/chromium/third_party/WebKit/Source/core/page/ImageBitmapTest.cpp b/chromium/third_party/WebKit/Source/core/page/ImageBitmapTest.cpp index ab7c68ba7b4..91b363bd623 100644 --- a/chromium/third_party/WebKit/Source/core/page/ImageBitmapTest.cpp +++ b/chromium/third_party/WebKit/Source/core/page/ImageBitmapTest.cpp @@ -32,8 +32,8 @@ #include "core/page/ImageBitmap.h" #include "core/dom/Document.h" -#include "core/fetch/ImageResource.h" #include "core/html/HTMLImageElement.h" +#include "core/loader/cache/ImageResource.h" #include "core/platform/graphics/BitmapImage.h" #include "core/platform/graphics/skia/NativeImageSkia.h" diff --git a/chromium/third_party/WebKit/Source/core/page/Page.cpp b/chromium/third_party/WebKit/Source/core/page/Page.cpp index 999dd82da33..06315554fb2 100644 --- a/chromium/third_party/WebKit/Source/core/page/Page.cpp +++ b/chromium/third_party/WebKit/Source/core/page/Page.cpp @@ -47,7 +47,6 @@ #include "core/page/PageLifecycleNotifier.h" #include "core/page/PointerLockController.h" #include "core/page/Settings.h" -#include "core/page/ValidationMessageClient.h" #include "core/page/scrolling/ScrollingCoordinator.h" #include "core/platform/network/NetworkStateNotifier.h" #include "core/plugins/PluginData.h" @@ -157,6 +156,8 @@ Page::~Page() if (m_scrollingCoordinator) m_scrollingCoordinator->pageDestroyed(); + backForward()->close(); + #ifndef NDEBUG pageCounter.decrement(); #endif @@ -261,14 +262,6 @@ void Page::setMainFrame(PassRefPtr<Frame> mainFrame) m_mainFrame = mainFrame; } -void Page::documentDetached(Document* document) -{ - m_pointerLockController->documentDetached(document); - m_contextMenuController->documentDetached(document); - if (m_validationMessageClient) - m_validationMessageClient->documentDetached(*document); -} - bool Page::openedByDOM() const { return m_openedByDOM; diff --git a/chromium/third_party/WebKit/Source/core/page/Page.h b/chromium/third_party/WebKit/Source/core/page/Page.h index 10a9a69d09a..2b85d1b4875 100644 --- a/chromium/third_party/WebKit/Source/core/page/Page.h +++ b/chromium/third_party/WebKit/Source/core/page/Page.h @@ -118,8 +118,6 @@ public: void setMainFrame(PassRefPtr<Frame>); Frame* mainFrame() const { return m_mainFrame.get(); } - void documentDetached(Document*); - bool openedByDOM() const; void setOpenedByDOM(); @@ -145,9 +143,9 @@ public: DragCaretController& dragCaretController() const { return *m_dragCaretController; } DragController& dragController() const { return *m_dragController; } FocusController& focusController() const { return *m_focusController; } - ContextMenuController& contextMenuController() const { return *m_contextMenuController; } + ContextMenuController* contextMenuController() const { return m_contextMenuController.get(); } InspectorController* inspectorController() const { return m_inspectorController.get(); } - PointerLockController& pointerLockController() const { return *m_pointerLockController; } + PointerLockController* pointerLockController() const { return m_pointerLockController.get(); } ValidationMessageClient* validationMessageClient() const { return m_validationMessageClient; } void setValidationMessageClient(ValidationMessageClient* client) { m_validationMessageClient = client; } @@ -268,9 +266,9 @@ private: const OwnPtr<DragCaretController> m_dragCaretController; const OwnPtr<DragController> m_dragController; OwnPtr<FocusController> m_focusController; - const OwnPtr<ContextMenuController> m_contextMenuController; + OwnPtr<ContextMenuController> m_contextMenuController; OwnPtr<InspectorController> m_inspectorController; - const OwnPtr<PointerLockController> m_pointerLockController; + OwnPtr<PointerLockController> m_pointerLockController; RefPtr<ScrollingCoordinator> m_scrollingCoordinator; OwnPtr<Settings> m_settings; diff --git a/chromium/third_party/WebKit/Source/core/page/PageSerializer.cpp b/chromium/third_party/WebKit/Source/core/page/PageSerializer.cpp index 730f5fd7d41..16ed1028411 100644 --- a/chromium/third_party/WebKit/Source/core/page/PageSerializer.cpp +++ b/chromium/third_party/WebKit/Source/core/page/PageSerializer.cpp @@ -42,13 +42,13 @@ #include "core/dom/Element.h" #include "core/dom/Text.h" #include "core/editing/MarkupAccumulator.h" -#include "core/fetch/ImageResource.h" #include "core/html/HTMLFrameOwnerElement.h" #include "core/html/HTMLImageElement.h" #include "core/html/HTMLInputElement.h" #include "core/html/HTMLLinkElement.h" #include "core/html/HTMLStyleElement.h" #include "core/html/parser/HTMLMetaCharsetParser.h" +#include "core/loader/cache/ImageResource.h" #include "core/page/Frame.h" #include "core/page/Page.h" #include "core/platform/SerializedResource.h" diff --git a/chromium/third_party/WebKit/Source/core/page/RuntimeEnabledFeatures.in b/chromium/third_party/WebKit/Source/core/page/RuntimeEnabledFeatures.in index 7890c03ab19..85faaec6975 100644 --- a/chromium/third_party/WebKit/Source/core/page/RuntimeEnabledFeatures.in +++ b/chromium/third_party/WebKit/Source/core/page/RuntimeEnabledFeatures.in @@ -19,7 +19,6 @@ AnimatedWebP status=experimental ApplicationCache status=stable AuthorShadowDOMForAnyElement Crypto status=test -CSSAnimationUnprefixed status=experimental CSSCompositing status=experimental CSSExclusions status=experimental CSSGridLayout status=experimental @@ -33,7 +32,6 @@ Database status=stable DataListElement status=stable DeviceMotion status=test DeviceOrientation status=stable -DevicePixelRatioIncludesZoom status=experimental DialogElement status=experimental DirectoryUpload status=stable EncodingAPI status=experimental diff --git a/chromium/third_party/WebKit/Source/core/page/Settings.cpp b/chromium/third_party/WebKit/Source/core/page/Settings.cpp index 52ce9537243..68a69d3e566 100644 --- a/chromium/third_party/WebKit/Source/core/page/Settings.cpp +++ b/chromium/third_party/WebKit/Source/core/page/Settings.cpp @@ -28,8 +28,8 @@ #include <limits> #include "core/dom/Document.h" -#include "core/fetch/ResourceFetcher.h" #include "core/inspector/InspectorInstrumentation.h" +#include "core/loader/cache/ResourceFetcher.h" #include "core/page/Chrome.h" #include "core/page/Frame.h" #include "core/page/FrameTree.h" diff --git a/chromium/third_party/WebKit/Source/core/page/UseCounter.cpp b/chromium/third_party/WebKit/Source/core/page/UseCounter.cpp index 2050d35e832..7737be9df79 100644 --- a/chromium/third_party/WebKit/Source/core/page/UseCounter.cpp +++ b/chromium/third_party/WebKit/Source/core/page/UseCounter.cpp @@ -469,7 +469,9 @@ int UseCounter::mapCSSPropertyIdToCSSSampleIdForHistogram(int id) case CSSPropertyMinZoom: return 407; case CSSPropertyOrientation: return 408; case CSSPropertyUserZoom: return 409; - // CSSPropertyWebkitDashboardRegion was 410. +#if defined(ENABLE_DASHBOARD_SUPPORT) && ENABLE_DASHBOARD_SUPPORT + case CSSPropertyWebkitDashboardRegion: return 410; +#endif // CSSPropertyWebkitOverflowScrolling was 411. case CSSPropertyWebkitAppRegion: return 412; case CSSPropertyWebkitFilter: return 413; @@ -483,15 +485,6 @@ int UseCounter::mapCSSPropertyIdToCSSSampleIdForHistogram(int id) case CSSPropertyTouchAction: return 421; case CSSPropertyGridArea: return 422; case CSSPropertyGridTemplate: return 423; - case CSSPropertyAnimation: return 424; - case CSSPropertyAnimationDelay: return 425; - case CSSPropertyAnimationDirection: return 426; - case CSSPropertyAnimationDuration: return 427; - case CSSPropertyAnimationFillMode: return 428; - case CSSPropertyAnimationIterationCount: return 429; - case CSSPropertyAnimationName: return 430; - case CSSPropertyAnimationPlayState: return 431; - case CSSPropertyAnimationTimingFunction: return 432; // Add new features above this line (don't change the assigned numbers of the existing // items) and update maximumCSSSampleId() with the new maximum value. @@ -506,7 +499,7 @@ int UseCounter::mapCSSPropertyIdToCSSSampleIdForHistogram(int id) return 0; } -static int maximumCSSSampleId() { return 432; } +static int maximumCSSSampleId() { return 423; } UseCounter::UseCounter() { diff --git a/chromium/third_party/WebKit/Source/core/page/UseCounter.h b/chromium/third_party/WebKit/Source/core/page/UseCounter.h index 6045a6fbf13..fdfd8304bba 100644 --- a/chromium/third_party/WebKit/Source/core/page/UseCounter.h +++ b/chromium/third_party/WebKit/Source/core/page/UseCounter.h @@ -163,24 +163,6 @@ public: PrefixedShadowRootConstructor, ConsoleMarkTimeline, CSSPseudoElementUserAgentCustomPseudo, - DocumentTypeEntities, // Removed from DOM4. - DocumentTypeInternalSubset, // Removed from DOM4. - DocumentTypeNotations, // Removed from DOM4. - ElementGetAttributeNode, // Removed from DOM4. - ElementSetAttributeNode, // Removed from DOM4. - ElementRemoveAttributeNode, // Removed from DOM4. - ElementGetAttributeNodeNS, // Removed from DOM4. - DocumentCreateAttribute, // Removed from DOM4. - DocumentCreateAttributeNS, // Removed from DOM4. - DocumentCreateCDATASection, // Removed from DOM4. - DocumentInputEncoding, // Removed from DOM4. - DocumentXMLEncoding, // Removed from DOM4. - DocumentXMLStandalone, // Removed from DOM4. - DocumentXMLVersion, // Removed from DOM4. - NodeIsSameNode, // Removed from DOM4. - NodeIsSupported, // Removed from DOM4. - NodeNamespaceURI, // Removed from DOM4. - NodePrefix, // Removed from DOM4. // Add new features immediately above this line. Don't change assigned // numbers of each items, and don't reuse unused slots. NumberOfFeatures, // This enum value must be last. diff --git a/chromium/third_party/WebKit/Source/core/page/animation/CSSPropertyAnimation.cpp b/chromium/third_party/WebKit/Source/core/page/animation/CSSPropertyAnimation.cpp index a0f8894e81e..5bf3bb667b5 100644 --- a/chromium/third_party/WebKit/Source/core/page/animation/CSSPropertyAnimation.cpp +++ b/chromium/third_party/WebKit/Source/core/page/animation/CSSPropertyAnimation.cpp @@ -36,7 +36,7 @@ #include "core/css/CSSCrossfadeValue.h" #include "core/css/CSSImageValue.h" #include "core/css/CSSPrimitiveValue.h" -#include "core/fetch/ImageResource.h" +#include "core/loader/cache/ImageResource.h" #include "core/page/animation/AnimationBase.h" #include "core/platform/FloatConversion.h" #include "core/rendering/ClipPathOperation.h" diff --git a/chromium/third_party/WebKit/Source/core/page/animation/KeyframeAnimation.cpp b/chromium/third_party/WebKit/Source/core/page/animation/KeyframeAnimation.cpp index ec8ea2e938a..d298f152a8f 100644 --- a/chromium/third_party/WebKit/Source/core/page/animation/KeyframeAnimation.cpp +++ b/chromium/third_party/WebKit/Source/core/page/animation/KeyframeAnimation.cpp @@ -108,7 +108,7 @@ void KeyframeAnimation::fetchIntervalEndpointsForProperty(CSSPropertyID property // Find keyframe that is closest to elapsed time. while (distance > 1) { currentIndex = (lastIndex + firstIndex) >> 1; - double key = m_keyframes[currentIndex].key(); + float key = m_keyframes[currentIndex].key(); distance = lastIndex - currentIndex; if (key < fractionalTime) { diff --git a/chromium/third_party/WebKit/Source/core/page/scrolling/ScrollingCoordinator.cpp b/chromium/third_party/WebKit/Source/core/page/scrolling/ScrollingCoordinator.cpp index d56ef60ceb1..30975d125cc 100644 --- a/chromium/third_party/WebKit/Source/core/page/scrolling/ScrollingCoordinator.cpp +++ b/chromium/third_party/WebKit/Source/core/page/scrolling/ScrollingCoordinator.cpp @@ -366,6 +366,11 @@ void ScrollingCoordinator::setTouchEventTargetRects(const LayerHitTestRects& lay LayerHitTestRects compositorRects; convertLayerRectsToEnclosingCompositedLayer(layerRects, compositorRects); + // Inform any observers (i.e. for testing) of these new rects. + HashSet<TouchEventTargetRectsObserver*>::iterator stop = m_touchEventTargetRectsObservers.end(); + for (HashSet<TouchEventTargetRectsObserver*>::iterator it = m_touchEventTargetRectsObservers.begin(); it != stop; ++it) + (*it)->touchEventTargetRectsChanged(compositorRects); + // Note that ideally we'd clear the touch event handler region on all layers first, // in case there are others that no longer have any handlers. But it's unlikely to // matter much in practice (just makes us more conservative). @@ -493,6 +498,16 @@ Region ScrollingCoordinator::computeShouldHandleScrollGestureOnMainThreadRegion( return shouldHandleScrollGestureOnMainThreadRegion; } +void ScrollingCoordinator::addTouchEventTargetRectsObserver(TouchEventTargetRectsObserver* observer) +{ + m_touchEventTargetRectsObservers.add(observer); +} + +void ScrollingCoordinator::removeTouchEventTargetRectsObserver(TouchEventTargetRectsObserver* observer) +{ + m_touchEventTargetRectsObservers.remove(observer); +} + static void accumulateDocumentTouchEventTargetRects(LayerHitTestRects& rects, const Document* document) { ASSERT(document); diff --git a/chromium/third_party/WebKit/Source/core/page/scrolling/ScrollingCoordinator.h b/chromium/third_party/WebKit/Source/core/page/scrolling/ScrollingCoordinator.h index f5764548e7b..acb13c67a58 100644 --- a/chromium/third_party/WebKit/Source/core/page/scrolling/ScrollingCoordinator.h +++ b/chromium/third_party/WebKit/Source/core/page/scrolling/ScrollingCoordinator.h @@ -102,6 +102,14 @@ public: String mainThreadScrollingReasonsAsText() const; Region computeShouldHandleScrollGestureOnMainThreadRegion(const Frame*, const IntPoint& frameLocation) const; + class TouchEventTargetRectsObserver { + public: + virtual void touchEventTargetRectsChanged(const LayerHitTestRects&) = 0; + }; + + void addTouchEventTargetRectsObserver(TouchEventTargetRectsObserver*); + void removeTouchEventTargetRectsObserver(TouchEventTargetRectsObserver*); + protected: explicit ScrollingCoordinator(Page*); @@ -139,6 +147,8 @@ private: typedef HashMap<ScrollableArea*, OwnPtr<WebKit::WebScrollbarLayer> > ScrollbarMap; ScrollbarMap m_horizontalScrollbars; ScrollbarMap m_verticalScrollbars; + + HashSet<TouchEventTargetRectsObserver*> m_touchEventTargetRectsObservers; }; } // namespace WebCore diff --git a/chromium/third_party/WebKit/Source/core/platform/AsyncFileSystem.h b/chromium/third_party/WebKit/Source/core/platform/AsyncFileSystem.h index d260af8b65d..2a408f80a15 100644 --- a/chromium/third_party/WebKit/Source/core/platform/AsyncFileSystem.h +++ b/chromium/third_party/WebKit/Source/core/platform/AsyncFileSystem.h @@ -54,7 +54,7 @@ public: // Subclass must implement this if it supports synchronous operations. // This should return false if there are no pending operations. - virtual bool waitForOperationToComplete() { return true; } + virtual bool waitForOperationToComplete() { return false; } // Creates and returns a new platform-specific AsyncFileSystem instance if the platform has its own implementation. static PassOwnPtr<AsyncFileSystem> create(); diff --git a/chromium/third_party/WebKit/Source/core/platform/DEPS b/chromium/third_party/WebKit/Source/core/platform/DEPS index cfd697d11ac..f1e4fe8f090 100644 --- a/chromium/third_party/WebKit/Source/core/platform/DEPS +++ b/chromium/third_party/WebKit/Source/core/platform/DEPS @@ -17,7 +17,7 @@ include_rules = [ "!core/fileapi", "!core/html", "!core/inspector", - "!core/fetch", + "!core/loader/cache", "!core/page", "!core/plugins", "!core/rendering", diff --git a/chromium/third_party/WebKit/Source/core/platform/LifecycleNotifier.h b/chromium/third_party/WebKit/Source/core/platform/LifecycleNotifier.h index cc12be21144..fd4835383eb 100644 --- a/chromium/third_party/WebKit/Source/core/platform/LifecycleNotifier.h +++ b/chromium/third_party/WebKit/Source/core/platform/LifecycleNotifier.h @@ -55,8 +55,7 @@ protected: IteratingOverActiveDOMObjects, IteratingOverContextObservers, IteratingOverDocumentObservers, - IteratingOverPageObservers, - IteratingOverDOMWindowObservers + IteratingOverPageObservers }; IterationType m_iterating; diff --git a/chromium/third_party/WebKit/Source/core/platform/LifecycleObserver.h b/chromium/third_party/WebKit/Source/core/platform/LifecycleObserver.h index 3e2d0a47cab..5e3ca2ccc25 100644 --- a/chromium/third_party/WebKit/Source/core/platform/LifecycleObserver.h +++ b/chromium/third_party/WebKit/Source/core/platform/LifecycleObserver.h @@ -37,8 +37,7 @@ public: ActiveDOMObjectType, DocumentLifecycleObserverType, GenericType, - PageLifecycleObserverType, - DOMWindowLifecycleObserverType + PageLifecycleObserverType }; explicit LifecycleObserver(LifecycleContext*, Type = GenericType); diff --git a/chromium/third_party/WebKit/Source/core/platform/animation/CSSAnimationData.h b/chromium/third_party/WebKit/Source/core/platform/animation/CSSAnimationData.h index a8ab4598cbf..f8c441cd5a4 100644 --- a/chromium/third_party/WebKit/Source/core/platform/animation/CSSAnimationData.h +++ b/chromium/third_party/WebKit/Source/core/platform/animation/CSSAnimationData.h @@ -148,7 +148,7 @@ public: private: CSSAnimationData(); - explicit CSSAnimationData(const CSSAnimationData&); + CSSAnimationData(const CSSAnimationData& o); AtomicString m_name; CSSPropertyID m_property; diff --git a/chromium/third_party/WebKit/Source/core/platform/animation/CSSAnimationDataList.h b/chromium/third_party/WebKit/Source/core/platform/animation/CSSAnimationDataList.h index 48d855674f0..bd7d942ae82 100644 --- a/chromium/third_party/WebKit/Source/core/platform/animation/CSSAnimationDataList.h +++ b/chromium/third_party/WebKit/Source/core/platform/animation/CSSAnimationDataList.h @@ -35,7 +35,7 @@ class CSSAnimationDataList { WTF_MAKE_FAST_ALLOCATED; public: CSSAnimationDataList() { } - explicit CSSAnimationDataList(const CSSAnimationDataList&); + CSSAnimationDataList(const CSSAnimationDataList&); void fillUnsetProperties(); bool operator==(const CSSAnimationDataList& o) const; diff --git a/chromium/third_party/WebKit/Source/core/platform/chromium/ChromiumDataObject.cpp b/chromium/third_party/WebKit/Source/core/platform/chromium/ChromiumDataObject.cpp index a9a536dfcfa..2c7fa1601a4 100644 --- a/chromium/third_party/WebKit/Source/core/platform/chromium/ChromiumDataObject.cpp +++ b/chromium/third_party/WebKit/Source/core/platform/chromium/ChromiumDataObject.cpp @@ -90,24 +90,18 @@ void ChromiumDataObject::clearAll() m_itemList.clear(); } -PassRefPtr<ChromiumDataObjectItem> ChromiumDataObject::add(const String& data, const String& type, ExceptionState& es) +void ChromiumDataObject::add(const String& data, const String& type, ExceptionState& es) { - RefPtr<ChromiumDataObjectItem> item = ChromiumDataObjectItem::createFromString(type, data); - if (!internalAddStringItem(item)) { + if (!internalAddStringItem(ChromiumDataObjectItem::createFromString(type, data))) es.throwDOMException(NotSupportedError); - return 0; - } - return item; } -PassRefPtr<ChromiumDataObjectItem> ChromiumDataObject::add(PassRefPtr<File> file, ScriptExecutionContext* context) +void ChromiumDataObject::add(PassRefPtr<File> file, ScriptExecutionContext* context) { if (!file) - return 0; + return; - RefPtr<ChromiumDataObjectItem> item = ChromiumDataObjectItem::createFromFile(file); - m_itemList.append(item); - return item; + m_itemList.append(ChromiumDataObjectItem::createFromFile(file)); } void ChromiumDataObject::clearData(const String& type) diff --git a/chromium/third_party/WebKit/Source/core/platform/chromium/ChromiumDataObject.h b/chromium/third_party/WebKit/Source/core/platform/chromium/ChromiumDataObject.h index dfb9a75d207..04063170119 100644 --- a/chromium/third_party/WebKit/Source/core/platform/chromium/ChromiumDataObject.h +++ b/chromium/third_party/WebKit/Source/core/platform/chromium/ChromiumDataObject.h @@ -62,8 +62,8 @@ public: // FIXME: Implement V8DataTransferItemList::indexedPropertyDeleter to get this called. void deleteItem(unsigned long index); void clearAll(); - PassRefPtr<ChromiumDataObjectItem> add(const String& data, const String& type, ExceptionState&); - PassRefPtr<ChromiumDataObjectItem> add(PassRefPtr<File>, ScriptExecutionContext*); + void add(const String& data, const String& type, ExceptionState&); + void add(PassRefPtr<File>, ScriptExecutionContext*); // WebCore helpers. void clearData(const String& type); diff --git a/chromium/third_party/WebKit/Source/core/platform/chromium/ClipboardChromium.cpp b/chromium/third_party/WebKit/Source/core/platform/chromium/ClipboardChromium.cpp index 48b258c7a0d..50e69e505e9 100644 --- a/chromium/third_party/WebKit/Source/core/platform/chromium/ClipboardChromium.cpp +++ b/chromium/third_party/WebKit/Source/core/platform/chromium/ClipboardChromium.cpp @@ -35,9 +35,9 @@ #include "core/dom/ExceptionCode.h" #include "core/dom/StringCallback.h" #include "core/editing/markup.h" -#include "core/fetch/ImageResource.h" #include "core/fileapi/File.h" #include "core/fileapi/FileList.h" +#include "core/loader/cache/ImageResource.h" #include "core/page/Frame.h" #include "core/platform/DragData.h" #include "core/platform/MIMETypeRegistry.h" @@ -64,8 +64,8 @@ public: virtual PassRefPtr<DataTransferItem> item(unsigned long index) OVERRIDE; virtual void deleteItem(unsigned long index, ExceptionState&) OVERRIDE; virtual void clear() OVERRIDE; - virtual PassRefPtr<DataTransferItem> add(const String& data, const String& type, ExceptionState&) OVERRIDE; - virtual PassRefPtr<DataTransferItem> add(PassRefPtr<File>) OVERRIDE; + virtual void add(const String& data, const String& type, ExceptionState&) OVERRIDE; + virtual void add(PassRefPtr<File>) OVERRIDE; private: DataTransferItemListPolicyWrapper(PassRefPtr<ClipboardChromium>, PassRefPtr<ChromiumDataObject>); @@ -119,24 +119,18 @@ void DataTransferItemListPolicyWrapper::clear() m_dataObject->clearAll(); } -PassRefPtr<DataTransferItem> DataTransferItemListPolicyWrapper::add(const String& data, const String& type, ExceptionState& es) +void DataTransferItemListPolicyWrapper::add(const String& data, const String& type, ExceptionState& es) { if (!m_clipboard->canWriteData()) - return 0; - RefPtr<ChromiumDataObjectItem> item = m_dataObject->add(data, type, es); - if (!item) - return 0; - return DataTransferItemPolicyWrapper::create(m_clipboard, item); + return; + m_dataObject->add(data, type, es); } -PassRefPtr<DataTransferItem> DataTransferItemListPolicyWrapper::add(PassRefPtr<File> file) +void DataTransferItemListPolicyWrapper::add(PassRefPtr<File> file) { if (!m_clipboard->canWriteData()) - return 0; - RefPtr<ChromiumDataObjectItem> item = m_dataObject->add(file, m_clipboard->frame()->document()->scriptExecutionContext()); - if (!item) - return 0; - return DataTransferItemPolicyWrapper::create(m_clipboard, item); + return; + m_dataObject->add(file, m_clipboard->frame()->document()->scriptExecutionContext()); } DataTransferItemListPolicyWrapper::DataTransferItemListPolicyWrapper( diff --git a/chromium/third_party/WebKit/Source/core/platform/chromium/ClipboardChromium.h b/chromium/third_party/WebKit/Source/core/platform/chromium/ClipboardChromium.h index 4cc14168802..980a22dea67 100644 --- a/chromium/third_party/WebKit/Source/core/platform/chromium/ClipboardChromium.h +++ b/chromium/third_party/WebKit/Source/core/platform/chromium/ClipboardChromium.h @@ -32,7 +32,7 @@ #include "core/dom/Clipboard.h" #include "core/dom/DataTransferItem.h" -#include "core/fetch/ImageResourceClient.h" +#include "core/loader/cache/ImageResourceClient.h" #include "core/platform/chromium/ChromiumDataObject.h" namespace WebCore { diff --git a/chromium/third_party/WebKit/Source/core/platform/chromium/PasteboardChromium.cpp b/chromium/third_party/WebKit/Source/core/platform/chromium/PasteboardChromium.cpp index 61c2dc9608a..d06f207a9ef 100644 --- a/chromium/third_party/WebKit/Source/core/platform/chromium/PasteboardChromium.cpp +++ b/chromium/third_party/WebKit/Source/core/platform/chromium/PasteboardChromium.cpp @@ -39,8 +39,8 @@ #include "core/dom/Element.h" #include "core/dom/Range.h" #include "core/editing/markup.h" -#include "core/fetch/ImageResource.h" #include "core/html/parser/HTMLParserIdioms.h" +#include "core/loader/cache/ImageResource.h" #include "core/page/Frame.h" #include "core/platform/chromium/ClipboardChromium.h" #include "core/platform/chromium/ClipboardUtilitiesChromium.h" diff --git a/chromium/third_party/WebKit/Source/core/platform/ScrollbarThemeNonMacCommon.cpp b/chromium/third_party/WebKit/Source/core/platform/chromium/ScrollbarThemeChromium.cpp index 72208ba0493..d44a778a65d 100644 --- a/chromium/third_party/WebKit/Source/core/platform/ScrollbarThemeNonMacCommon.cpp +++ b/chromium/third_party/WebKit/Source/core/platform/chromium/ScrollbarThemeChromium.cpp @@ -25,7 +25,7 @@ */ #include "config.h" -#include "core/platform/ScrollbarThemeNonMacCommon.h" +#include "core/platform/chromium/ScrollbarThemeChromium.h" #include "core/platform/PlatformMouseEvent.h" #include "core/platform/ScrollableArea.h" @@ -33,16 +33,21 @@ #include "core/platform/ScrollbarTheme.h" #include "core/platform/graphics/GraphicsContextStateSaver.h" +// ----------------------------------------------------------------------------- +// This file contains scrollbar theme code that is cross platform. Additional +// members of ScrollbarThemeChromium can be found in the platform specific files +// ----------------------------------------------------------------------------- + namespace WebCore { -bool ScrollbarThemeNonMacCommon::hasThumb(ScrollbarThemeClient* scrollbar) +bool ScrollbarThemeChromium::hasThumb(ScrollbarThemeClient* scrollbar) { // This method is just called as a paint-time optimization to see if - // painting the thumb can be skipped. We don't have to be exact here. + // painting the thumb can be skipped. We don't have to be exact here. return thumbLength(scrollbar) > 0; } -IntRect ScrollbarThemeNonMacCommon::backButtonRect(ScrollbarThemeClient* scrollbar, ScrollbarPart part, bool) +IntRect ScrollbarThemeChromium::backButtonRect(ScrollbarThemeClient* scrollbar, ScrollbarPart part, bool) { // Windows and Linux just have single arrows. if (part == BackButtonEndPart) @@ -52,7 +57,7 @@ IntRect ScrollbarThemeNonMacCommon::backButtonRect(ScrollbarThemeClient* scrollb return IntRect(scrollbar->x(), scrollbar->y(), size.width(), size.height()); } -IntRect ScrollbarThemeNonMacCommon::forwardButtonRect(ScrollbarThemeClient* scrollbar, ScrollbarPart part, bool) +IntRect ScrollbarThemeChromium::forwardButtonRect(ScrollbarThemeClient* scrollbar, ScrollbarPart part, bool) { // Windows and Linux just have single arrows. if (part == ForwardButtonStartPart) @@ -70,7 +75,7 @@ IntRect ScrollbarThemeNonMacCommon::forwardButtonRect(ScrollbarThemeClient* scro return IntRect(x, y, size.width(), size.height()); } -IntRect ScrollbarThemeNonMacCommon::trackRect(ScrollbarThemeClient* scrollbar, bool) +IntRect ScrollbarThemeChromium::trackRect(ScrollbarThemeClient* scrollbar, bool) { IntSize bs = buttonSize(scrollbar); int thickness = scrollbarThickness(scrollbar->controlSize()); @@ -86,20 +91,20 @@ IntRect ScrollbarThemeNonMacCommon::trackRect(ScrollbarThemeClient* scrollbar, b return IntRect(scrollbar->x(), scrollbar->y() + bs.height(), thickness, scrollbar->height() - 2 * bs.height()); } -void ScrollbarThemeNonMacCommon::paintTrackBackground(GraphicsContext* context, ScrollbarThemeClient* scrollbar, const IntRect& rect) +void ScrollbarThemeChromium::paintTrackBackground(GraphicsContext* context, ScrollbarThemeClient* scrollbar, const IntRect& rect) { - // Just assume a forward track part. We only paint the track as a single piece when there is no thumb. + // Just assume a forward track part. We only paint the track as a single piece when there is no thumb. if (!hasThumb(scrollbar)) paintTrackPiece(context, scrollbar, rect, ForwardTrackPart); } -void ScrollbarThemeNonMacCommon::paintTickmarks(GraphicsContext* context, ScrollbarThemeClient* scrollbar, const IntRect& rect) +void ScrollbarThemeChromium::paintTickmarks(GraphicsContext* context, ScrollbarThemeClient* scrollbar, const IntRect& rect) { if (scrollbar->orientation() != VerticalScrollbar) return; if (rect.height() <= 0 || rect.width() <= 0) - return; + return; // nothing to draw on. // Get the tickmarks for the frameview. Vector<IntRect> tickmarks; diff --git a/chromium/third_party/WebKit/Source/core/platform/ScrollbarThemeNonMacCommon.h b/chromium/third_party/WebKit/Source/core/platform/chromium/ScrollbarThemeChromium.h index 3fc76476037..9866a179693 100644 --- a/chromium/third_party/WebKit/Source/core/platform/ScrollbarThemeNonMacCommon.h +++ b/chromium/third_party/WebKit/Source/core/platform/chromium/ScrollbarThemeChromium.h @@ -28,8 +28,8 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef ScrollbarThemeNonMacCommon_h -#define ScrollbarThemeNonMacCommon_h +#ifndef ScrollbarThemeChromium_h +#define ScrollbarThemeChromium_h #include "core/platform/ScrollbarTheme.h" @@ -37,7 +37,9 @@ namespace WebCore { class PlatformMouseEvent; -class ScrollbarThemeNonMacCommon : public ScrollbarTheme { +// This class contains the scrollbar code which is shared between Chromium +// Windows and Linux. +class ScrollbarThemeChromium : public ScrollbarTheme { protected: virtual bool hasButtons(ScrollbarThemeClient*) OVERRIDE { return true; } virtual bool hasThumb(ScrollbarThemeClient*) OVERRIDE; diff --git a/chromium/third_party/WebKit/Source/core/platform/ScrollbarThemeAndroid.cpp b/chromium/third_party/WebKit/Source/core/platform/chromium/ScrollbarThemeChromiumAndroid.cpp index 8ab6b8ca5b6..ca8b507a417 100644 --- a/chromium/third_party/WebKit/Source/core/platform/ScrollbarThemeAndroid.cpp +++ b/chromium/third_party/WebKit/Source/core/platform/chromium/ScrollbarThemeChromiumAndroid.cpp @@ -24,15 +24,16 @@ */ #include "config.h" + #include "core/platform/ScrollbarTheme.h" -#include "core/platform/ScrollbarThemeOverlay.h" +#include "core/platform/chromium/ScrollbarThemeChromiumOverlay.h" namespace WebCore { ScrollbarTheme* ScrollbarTheme::nativeTheme() { - DEFINE_STATIC_LOCAL(ScrollbarThemeOverlay, theme, ()); + DEFINE_STATIC_LOCAL(ScrollbarThemeChromiumOverlay, theme, ()); return &theme; } diff --git a/chromium/third_party/WebKit/Source/core/platform/ScrollbarThemeAuraOrGtk.cpp b/chromium/third_party/WebKit/Source/core/platform/chromium/ScrollbarThemeChromiumDefault.cpp index e3753391115..721870a29c9 100644 --- a/chromium/third_party/WebKit/Source/core/platform/ScrollbarThemeAuraOrGtk.cpp +++ b/chromium/third_party/WebKit/Source/core/platform/chromium/ScrollbarThemeChromiumDefault.cpp @@ -29,38 +29,38 @@ */ #include "config.h" -#include "core/platform/ScrollbarThemeAuraOrGtk.h" +#include "core/platform/chromium/ScrollbarThemeChromiumDefault.h" #include "RuntimeEnabledFeatures.h" #include "core/platform/PlatformMouseEvent.h" #include "core/platform/Scrollbar.h" -#include "core/platform/ScrollbarThemeOverlay.h" +#include "core/platform/chromium/ScrollbarThemeChromiumOverlay.h" #include "core/platform/graphics/GraphicsContext.h" +#include "public/platform/default/WebThemeEngine.h" #include "public/platform/Platform.h" #include "public/platform/WebRect.h" -#include "public/platform/default/WebThemeEngine.h" namespace WebCore { ScrollbarTheme* ScrollbarTheme::nativeTheme() { if (RuntimeEnabledFeatures::overlayScrollbarsEnabled()) { - DEFINE_STATIC_LOCAL(ScrollbarThemeOverlay, theme, ()); + DEFINE_STATIC_LOCAL(ScrollbarThemeChromiumOverlay, theme, ()); return &theme; } - DEFINE_STATIC_LOCAL(ScrollbarThemeAuraOrGtk, theme, ()); + DEFINE_STATIC_LOCAL(ScrollbarThemeChromiumDefault, theme, ()); return &theme; } -int ScrollbarThemeAuraOrGtk::scrollbarThickness(ScrollbarControlSize controlSize) +int ScrollbarThemeChromiumDefault::scrollbarThickness(ScrollbarControlSize controlSize) { // Horiz and Vert scrollbars are the same thickness. IntSize scrollbarSize = WebKit::Platform::current()->themeEngine()->getSize(WebKit::WebThemeEngine::PartScrollbarVerticalTrack); return scrollbarSize.width(); } -void ScrollbarThemeAuraOrGtk::paintTrackPiece(GraphicsContext* gc, ScrollbarThemeClient* scrollbar, const IntRect& rect, ScrollbarPart partType) +void ScrollbarThemeChromiumDefault::paintTrackPiece(GraphicsContext* gc, ScrollbarThemeClient* scrollbar, const IntRect& rect, ScrollbarPart partType) { WebKit::WebThemeEngine::State state = scrollbar->hoveredPart() == partType ? WebKit::WebThemeEngine::StateHover : WebKit::WebThemeEngine::StateNormal; IntRect alignRect = trackRect(scrollbar, false); @@ -73,7 +73,7 @@ void ScrollbarThemeAuraOrGtk::paintTrackPiece(GraphicsContext* gc, ScrollbarThem WebKit::Platform::current()->themeEngine()->paint(canvas, scrollbar->orientation() == HorizontalScrollbar ? WebKit::WebThemeEngine::PartScrollbarHorizontalTrack : WebKit::WebThemeEngine::PartScrollbarVerticalTrack, state, WebKit::WebRect(rect), &extraParams); } -void ScrollbarThemeAuraOrGtk::paintButton(GraphicsContext* gc, ScrollbarThemeClient* scrollbar, const IntRect& rect, ScrollbarPart part) +void ScrollbarThemeChromiumDefault::paintButton(GraphicsContext* gc, ScrollbarThemeClient* scrollbar, const IntRect& rect, ScrollbarPart part) { WebKit::WebThemeEngine::Part paintPart; WebKit::WebThemeEngine::State state = WebKit::WebThemeEngine::StateNormal; @@ -109,7 +109,7 @@ void ScrollbarThemeAuraOrGtk::paintButton(GraphicsContext* gc, ScrollbarThemeCli WebKit::Platform::current()->themeEngine()->paint(canvas, paintPart, state, WebKit::WebRect(rect), 0); } -void ScrollbarThemeAuraOrGtk::paintThumb(GraphicsContext* gc, ScrollbarThemeClient* scrollbar, const IntRect& rect) +void ScrollbarThemeChromiumDefault::paintThumb(GraphicsContext* gc, ScrollbarThemeClient* scrollbar, const IntRect& rect) { WebKit::WebThemeEngine::State state; WebKit::WebCanvas* canvas = gc->canvas(); @@ -122,12 +122,12 @@ void ScrollbarThemeAuraOrGtk::paintThumb(GraphicsContext* gc, ScrollbarThemeClie WebKit::Platform::current()->themeEngine()->paint(canvas, scrollbar->orientation() == HorizontalScrollbar ? WebKit::WebThemeEngine::PartScrollbarHorizontalThumb : WebKit::WebThemeEngine::PartScrollbarVerticalThumb, state, WebKit::WebRect(rect), 0); } -bool ScrollbarThemeAuraOrGtk::shouldCenterOnThumb(ScrollbarThemeClient*, const PlatformMouseEvent& evt) +bool ScrollbarThemeChromiumDefault::shouldCenterOnThumb(ScrollbarThemeClient*, const PlatformMouseEvent& evt) { return (evt.shiftKey() && evt.button() == LeftButton) || (evt.button() == MiddleButton); } -IntSize ScrollbarThemeAuraOrGtk::buttonSize(ScrollbarThemeClient* scrollbar) +IntSize ScrollbarThemeChromiumDefault::buttonSize(ScrollbarThemeClient* scrollbar) { if (scrollbar->orientation() == VerticalScrollbar) { IntSize size = WebKit::Platform::current()->themeEngine()->getSize(WebKit::WebThemeEngine::PartScrollbarUpArrow); @@ -139,7 +139,7 @@ IntSize ScrollbarThemeAuraOrGtk::buttonSize(ScrollbarThemeClient* scrollbar) return IntSize(scrollbar->width() < 2 * size.width() ? scrollbar->width() / 2 : size.width(), size.height()); } -int ScrollbarThemeAuraOrGtk::minimumThumbLength(ScrollbarThemeClient* scrollbar) +int ScrollbarThemeChromiumDefault::minimumThumbLength(ScrollbarThemeClient* scrollbar) { if (scrollbar->orientation() == VerticalScrollbar) { IntSize size = WebKit::Platform::current()->themeEngine()->getSize(WebKit::WebThemeEngine::PartScrollbarVerticalThumb); diff --git a/chromium/third_party/WebKit/Source/core/platform/ScrollbarThemeAuraOrGtk.h b/chromium/third_party/WebKit/Source/core/platform/chromium/ScrollbarThemeChromiumDefault.h index ec37c2c1f78..133dab06edc 100644 --- a/chromium/third_party/WebKit/Source/core/platform/ScrollbarThemeAuraOrGtk.h +++ b/chromium/third_party/WebKit/Source/core/platform/chromium/ScrollbarThemeChromiumDefault.h @@ -28,14 +28,14 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef ScrollbarThemeAuraOrGtk_h -#define ScrollbarThemeAuraOrGtk_h +#ifndef ScrollbarThemeChromiumDefault_h +#define ScrollbarThemeChromiumDefault_h -#include "core/platform/ScrollbarThemeNonMacCommon.h" +#include "core/platform/chromium/ScrollbarThemeChromium.h" namespace WebCore { -class ScrollbarThemeAuraOrGtk : public ScrollbarThemeNonMacCommon { +class ScrollbarThemeChromiumDefault : public ScrollbarThemeChromium { public: virtual int scrollbarThickness(ScrollbarControlSize); diff --git a/chromium/third_party/WebKit/Source/core/platform/ScrollbarThemeOverlay.cpp b/chromium/third_party/WebKit/Source/core/platform/chromium/ScrollbarThemeChromiumOverlay.cpp index 29b44ba4292..c10c89bbd55 100644 --- a/chromium/third_party/WebKit/Source/core/platform/ScrollbarThemeOverlay.cpp +++ b/chromium/third_party/WebKit/Source/core/platform/chromium/ScrollbarThemeChromiumOverlay.cpp @@ -24,7 +24,7 @@ */ #include "config.h" -#include "core/platform/ScrollbarThemeOverlay.h" +#include "core/platform/chromium/ScrollbarThemeChromiumOverlay.h" #include "core/platform/PlatformMouseEvent.h" #include "core/platform/Scrollbar.h" @@ -40,17 +40,17 @@ namespace WebCore { static const int scrollbarWidth = 3; static const int scrollbarMargin = 4; -int ScrollbarThemeOverlay::scrollbarThickness(ScrollbarControlSize controlSize) +int ScrollbarThemeChromiumOverlay::scrollbarThickness(ScrollbarControlSize controlSize) { return scrollbarWidth + scrollbarMargin; } -bool ScrollbarThemeOverlay::usesOverlayScrollbars() const +bool ScrollbarThemeChromiumOverlay::usesOverlayScrollbars() const { return true; } -int ScrollbarThemeOverlay::thumbPosition(ScrollbarThemeClient* scrollbar) +int ScrollbarThemeChromiumOverlay::thumbPosition(ScrollbarThemeClient* scrollbar) { if (!scrollbar->totalSize()) return 0; @@ -60,7 +60,7 @@ int ScrollbarThemeOverlay::thumbPosition(ScrollbarThemeClient* scrollbar) return round(proportion * trackLen); } -int ScrollbarThemeOverlay::thumbLength(ScrollbarThemeClient* scrollbar) +int ScrollbarThemeChromiumOverlay::thumbLength(ScrollbarThemeClient* scrollbar) { int trackLen = trackLength(scrollbar); @@ -73,22 +73,22 @@ int ScrollbarThemeOverlay::thumbLength(ScrollbarThemeClient* scrollbar) return length; } -bool ScrollbarThemeOverlay::hasThumb(ScrollbarThemeClient* scrollbar) +bool ScrollbarThemeChromiumOverlay::hasThumb(ScrollbarThemeClient* scrollbar) { return true; } -IntRect ScrollbarThemeOverlay::backButtonRect(ScrollbarThemeClient*, ScrollbarPart, bool) +IntRect ScrollbarThemeChromiumOverlay::backButtonRect(ScrollbarThemeClient*, ScrollbarPart, bool) { return IntRect(); } -IntRect ScrollbarThemeOverlay::forwardButtonRect(ScrollbarThemeClient*, ScrollbarPart, bool) +IntRect ScrollbarThemeChromiumOverlay::forwardButtonRect(ScrollbarThemeClient*, ScrollbarPart, bool) { return IntRect(); } -IntRect ScrollbarThemeOverlay::trackRect(ScrollbarThemeClient* scrollbar, bool) +IntRect ScrollbarThemeChromiumOverlay::trackRect(ScrollbarThemeClient* scrollbar, bool) { IntRect rect = scrollbar->frameRect(); if (scrollbar->orientation() == HorizontalScrollbar) @@ -98,7 +98,7 @@ IntRect ScrollbarThemeOverlay::trackRect(ScrollbarThemeClient* scrollbar, bool) return rect; } -void ScrollbarThemeOverlay::paintThumb(GraphicsContext* context, ScrollbarThemeClient* scrollbar, const IntRect& rect) +void ScrollbarThemeChromiumOverlay::paintThumb(GraphicsContext* context, ScrollbarThemeClient* scrollbar, const IntRect& rect) { IntRect thumbRect = rect; if (scrollbar->orientation() == HorizontalScrollbar) diff --git a/chromium/third_party/WebKit/Source/core/platform/ScrollbarThemeOverlay.h b/chromium/third_party/WebKit/Source/core/platform/chromium/ScrollbarThemeChromiumOverlay.h index 8a8595916d7..291ef8c9baa 100644 --- a/chromium/third_party/WebKit/Source/core/platform/ScrollbarThemeOverlay.h +++ b/chromium/third_party/WebKit/Source/core/platform/chromium/ScrollbarThemeChromiumOverlay.h @@ -23,8 +23,8 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef ScrollbarThemeOverlay_h -#define ScrollbarThemeOverlay_h +#ifndef ScrollbarThemeChromiumOverlay_h +#define ScrollbarThemeChromiumOverlay_h #include "core/platform/ScrollbarTheme.h" @@ -32,7 +32,7 @@ namespace WebCore { // This scrollbar theme is used to get overlay scrollbar for platforms other // than Mac. Mac's overlay scrollbars are in ScrollbarThemeMac*. -class ScrollbarThemeOverlay : public ScrollbarTheme { +class ScrollbarThemeChromiumOverlay : public ScrollbarTheme { public: virtual int scrollbarThickness(ScrollbarControlSize) OVERRIDE; virtual bool usesOverlayScrollbars() const OVERRIDE; diff --git a/chromium/third_party/WebKit/Source/core/platform/ScrollbarThemeWin.cpp b/chromium/third_party/WebKit/Source/core/platform/chromium/ScrollbarThemeChromiumWin.cpp index d8f51e4e4c0..a41c6b1f524 100644 --- a/chromium/third_party/WebKit/Source/core/platform/ScrollbarThemeWin.cpp +++ b/chromium/third_party/WebKit/Source/core/platform/chromium/ScrollbarThemeChromiumWin.cpp @@ -25,7 +25,7 @@ */ #include "config.h" -#include "core/platform/ScrollbarThemeWin.h" +#include "core/platform/chromium/ScrollbarThemeChromiumWin.h" #include <windows.h> #include <vsstyle.h> @@ -38,27 +38,28 @@ #include "public/platform/Platform.h" #include "public/platform/WebRect.h" #include "public/platform/win/WebThemeEngine.h" + namespace WebCore { ScrollbarTheme* ScrollbarTheme::nativeTheme() { - static ScrollbarThemeWin theme; + static ScrollbarThemeChromiumWin theme; return &theme; } // The scrollbar size in DumpRenderTree on the Mac - so we can match their -// layout results. Entries are for regular, small, and mini scrollbars. +// layout results. Entries are for regular, small, and mini scrollbars. // Metrics obtained using [NSScroller scrollerWidthForControlSize:] static const int kMacScrollbarSize[3] = { 15, 11, 15 }; // Constants used to figure the drag rect outside which we should snap the -// scrollbar thumb back to its origin. These calculations are based on +// scrollbar thumb back to its origin. These calculations are based on // observing the behavior of the MSVC8 main window scrollbar + some // guessing/extrapolation. static const int kOffEndMultiplier = 3; static const int kOffSideMultiplier = 8; -int ScrollbarThemeWin::scrollbarThickness(ScrollbarControlSize controlSize) +int ScrollbarThemeChromiumWin::scrollbarThickness(ScrollbarControlSize controlSize) { static int thickness; if (!thickness) { @@ -69,12 +70,12 @@ int ScrollbarThemeWin::scrollbarThickness(ScrollbarControlSize controlSize) return thickness; } -bool ScrollbarThemeWin::invalidateOnMouseEnterExit() +bool ScrollbarThemeChromiumWin::invalidateOnMouseEnterExit() { return windowsVersion() >= WindowsVista; } -bool ScrollbarThemeWin::shouldSnapBackToDragOrigin(ScrollbarThemeClient* scrollbar, const PlatformMouseEvent& evt) +bool ScrollbarThemeChromiumWin::shouldSnapBackToDragOrigin(ScrollbarThemeClient* scrollbar, const PlatformMouseEvent& evt) { // Find the rect within which we shouldn't snap, by expanding the track rect // in both dimensions. @@ -92,7 +93,7 @@ bool ScrollbarThemeWin::shouldSnapBackToDragOrigin(ScrollbarThemeClient* scrollb return !rect.contains(mousePosition); } -void ScrollbarThemeWin::paintTrackPiece(GraphicsContext* gc, ScrollbarThemeClient* scrollbar, const IntRect& rect, ScrollbarPart partType) +void ScrollbarThemeChromiumWin::paintTrackPiece(GraphicsContext* gc, ScrollbarThemeClient* scrollbar, const IntRect& rect, ScrollbarPart partType) { bool horz = scrollbar->orientation() == HorizontalScrollbar; @@ -109,7 +110,7 @@ void ScrollbarThemeWin::paintTrackPiece(GraphicsContext* gc, ScrollbarThemeClien WebKit::Platform::current()->themeEngine()->paintScrollbarTrack(canvas, partId, getThemeState(scrollbar, partType), getClassicThemeState(scrollbar, partType), WebKit::WebRect(rect), WebKit::WebRect(alignRect)); } -void ScrollbarThemeWin::paintButton(GraphicsContext* gc, ScrollbarThemeClient* scrollbar, const IntRect& rect, ScrollbarPart part) +void ScrollbarThemeChromiumWin::paintButton(GraphicsContext* gc, ScrollbarThemeClient* scrollbar, const IntRect& rect, ScrollbarPart part) { bool horz = scrollbar->orientation() == HorizontalScrollbar; @@ -124,7 +125,7 @@ void ScrollbarThemeWin::paintButton(GraphicsContext* gc, ScrollbarThemeClient* s WebKit::Platform::current()->themeEngine()->paintScrollbarArrow(canvas, getThemeArrowState(scrollbar, part), partId | getClassicThemeState(scrollbar, part), WebKit::WebRect(rect)); } -void ScrollbarThemeWin::paintThumb(GraphicsContext* gc, ScrollbarThemeClient* scrollbar, const IntRect& rect) +void ScrollbarThemeChromiumWin::paintThumb(GraphicsContext* gc, ScrollbarThemeClient* scrollbar, const IntRect& rect) { bool horz = scrollbar->orientation() == HorizontalScrollbar; @@ -136,10 +137,10 @@ void ScrollbarThemeWin::paintThumb(GraphicsContext* gc, ScrollbarThemeClient* sc WebKit::Platform::current()->themeEngine()->paintScrollbarThumb(canvas, horz ? SBP_GRIPPERHORZ : SBP_GRIPPERVERT, getThemeState(scrollbar, ThumbPart), getClassicThemeState(scrollbar, ThumbPart), WebKit::WebRect(rect)); } -int ScrollbarThemeWin::getThemeState(ScrollbarThemeClient* scrollbar, ScrollbarPart part) const +int ScrollbarThemeChromiumWin::getThemeState(ScrollbarThemeClient* scrollbar, ScrollbarPart part) const { // When dragging the thumb, draw thumb pressed and other segments normal - // regardless of where the cursor actually is. See also four places in + // regardless of where the cursor actually is. See also four places in // getThemeArrowState(). if (scrollbar->pressedPart() == ThumbPart) { if (part == ThumbPart) @@ -155,7 +156,7 @@ int ScrollbarThemeWin::getThemeState(ScrollbarThemeClient* scrollbar, ScrollbarP return (scrollbar->pressedPart() == part) ? SCRBS_PRESSED : SCRBS_NORMAL; } -int ScrollbarThemeWin::getThemeArrowState(ScrollbarThemeClient* scrollbar, ScrollbarPart part) const +int ScrollbarThemeChromiumWin::getThemeArrowState(ScrollbarThemeClient* scrollbar, ScrollbarPart part) const { // We could take advantage of knowing the values in the state enum to write // some simpler code, but treating the state enum as a black box seems @@ -205,7 +206,7 @@ int ScrollbarThemeWin::getThemeArrowState(ScrollbarThemeClient* scrollbar, Scrol return (scrollbar->pressedPart() == part) ? ABS_DOWNPRESSED : ABS_DOWNNORMAL; } -int ScrollbarThemeWin::getClassicThemeState(ScrollbarThemeClient* scrollbar, ScrollbarPart part) const +int ScrollbarThemeChromiumWin::getClassicThemeState(ScrollbarThemeClient* scrollbar, ScrollbarPart part) const { // When dragging the thumb, draw the buttons normal even when hovered. if (scrollbar->pressedPart() == ThumbPart) @@ -219,24 +220,24 @@ int ScrollbarThemeWin::getClassicThemeState(ScrollbarThemeClient* scrollbar, Scr return (scrollbar->pressedPart() == part) ? (DFCS_PUSHED | DFCS_FLAT) : 0; } -bool ScrollbarThemeWin::shouldCenterOnThumb(ScrollbarThemeClient*, const PlatformMouseEvent& evt) +bool ScrollbarThemeChromiumWin::shouldCenterOnThumb(ScrollbarThemeClient*, const PlatformMouseEvent& evt) { return evt.shiftKey() && evt.button() == LeftButton; } -IntSize ScrollbarThemeWin::buttonSize(ScrollbarThemeClient* scrollbar) +IntSize ScrollbarThemeChromiumWin::buttonSize(ScrollbarThemeClient* scrollbar) { // Our desired rect is essentially thickness by thickness. // Our actual rect will shrink to half the available space when we have < 2 - // times thickness pixels left. This allows the scrollbar to scale down + // times thickness pixels left. This allows the scrollbar to scale down // and function even at tiny sizes. int thickness = scrollbarThickness(scrollbar->controlSize()); // In layout test mode, we force the button "girth" (i.e., the length of // the button along the axis of the scrollbar) to be a fixed size. - // FIXME: This is retarded! scrollbarThickness is already fixed in layout + // FIXME: This is retarded! scrollbarThickness is already fixed in layout // test mode so that should be enough to result in repeatable results, but // preserving this hack avoids having to rebaseline pixel tests. const int kLayoutTestModeGirth = 17; diff --git a/chromium/third_party/WebKit/Source/core/platform/ScrollbarThemeWin.h b/chromium/third_party/WebKit/Source/core/platform/chromium/ScrollbarThemeChromiumWin.h index 5b5ee6e444a..ba8deafefb7 100644 --- a/chromium/third_party/WebKit/Source/core/platform/ScrollbarThemeWin.h +++ b/chromium/third_party/WebKit/Source/core/platform/chromium/ScrollbarThemeChromiumWin.h @@ -28,14 +28,14 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef ScrollbarThemeWin_h -#define ScrollbarThemeWin_h +#ifndef ScrollbarThemeChromiumWin_h +#define ScrollbarThemeChromiumWin_h -#include "core/platform/ScrollbarThemeNonMacCommon.h" +#include "core/platform/chromium/ScrollbarThemeChromium.h" namespace WebCore { -class ScrollbarThemeWin : public ScrollbarThemeNonMacCommon { +class ScrollbarThemeChromiumWin : public ScrollbarThemeChromium { public: virtual int scrollbarThickness(ScrollbarControlSize) OVERRIDE; virtual bool invalidateOnMouseEnterExit() OVERRIDE; diff --git a/chromium/third_party/WebKit/Source/core/platform/graphics/GraphicsLayer.h b/chromium/third_party/WebKit/Source/core/platform/graphics/GraphicsLayer.h index d9b111b499d..e4bb57822ba 100644 --- a/chromium/third_party/WebKit/Source/core/platform/graphics/GraphicsLayer.h +++ b/chromium/third_party/WebKit/Source/core/platform/graphics/GraphicsLayer.h @@ -71,7 +71,7 @@ class TimingFunction; class AnimationValue { WTF_MAKE_FAST_ALLOCATED; public: - explicit AnimationValue(double keyTime, PassRefPtr<TimingFunction> timingFunction = 0) + explicit AnimationValue(float keyTime, PassRefPtr<TimingFunction> timingFunction = 0) : m_keyTime(keyTime) , m_timingFunction(timingFunction) { @@ -79,12 +79,12 @@ public: virtual ~AnimationValue() { } - double keyTime() const { return m_keyTime; } + float keyTime() const { return m_keyTime; } const TimingFunction* timingFunction() const { return m_timingFunction.get(); } virtual PassOwnPtr<AnimationValue> clone() const = 0; private: - double m_keyTime; + float m_keyTime; RefPtr<TimingFunction> m_timingFunction; }; @@ -92,7 +92,7 @@ private: // FIXME: Should be moved to its own header file. class FloatAnimationValue : public AnimationValue { public: - FloatAnimationValue(double keyTime, float value, PassRefPtr<TimingFunction> timingFunction = 0) + FloatAnimationValue(float keyTime, float value, PassRefPtr<TimingFunction> timingFunction = 0) : AnimationValue(keyTime, timingFunction) , m_value(value) { @@ -109,7 +109,7 @@ private: // FIXME: Should be moved to its own header file. class TransformAnimationValue : public AnimationValue { public: - explicit TransformAnimationValue(double keyTime, const TransformOperations* value = 0, PassRefPtr<TimingFunction> timingFunction = 0) + explicit TransformAnimationValue(float keyTime, const TransformOperations* value = 0, PassRefPtr<TimingFunction> timingFunction = 0) : AnimationValue(keyTime, timingFunction) { if (value) @@ -127,7 +127,7 @@ private: // FIXME: Should be moved to its own header file. class FilterAnimationValue : public AnimationValue { public: - explicit FilterAnimationValue(double keyTime, const FilterOperations* value = 0, PassRefPtr<TimingFunction> timingFunction = 0) + explicit FilterAnimationValue(float keyTime, const FilterOperations* value = 0, PassRefPtr<TimingFunction> timingFunction = 0) : AnimationValue(keyTime, timingFunction) { if (value) diff --git a/chromium/third_party/WebKit/Source/core/platform/graphics/filters/FilterOperation.h b/chromium/third_party/WebKit/Source/core/platform/graphics/filters/FilterOperation.h index 4e4a31a49c5..3473418b1ac 100644 --- a/chromium/third_party/WebKit/Source/core/platform/graphics/filters/FilterOperation.h +++ b/chromium/third_party/WebKit/Source/core/platform/graphics/filters/FilterOperation.h @@ -26,7 +26,7 @@ #ifndef FilterOperation_h #define FilterOperation_h -#include "core/fetch/DocumentResourceReference.h" +#include "core/loader/cache/DocumentResourceReference.h" #include "core/platform/Length.h" #include "core/platform/graphics/Color.h" #include "core/platform/graphics/filters/Filter.h" diff --git a/chromium/third_party/WebKit/Source/core/platform/graphics/transforms/TransformOperations.cpp b/chromium/third_party/WebKit/Source/core/platform/graphics/transforms/TransformOperations.cpp index 3ca3d7f462f..bcca50201e8 100644 --- a/chromium/third_party/WebKit/Source/core/platform/graphics/transforms/TransformOperations.cpp +++ b/chromium/third_party/WebKit/Source/core/platform/graphics/transforms/TransformOperations.cpp @@ -108,12 +108,4 @@ TransformOperations TransformOperations::blend(const TransformOperations& from, return blendByUsingMatrixInterpolation(from, progress); } -TransformOperations TransformOperations::add(const TransformOperations& addend) const -{ - TransformOperations result; - result.m_operations = operations(); - result.m_operations.append(addend.operations()); - return result; -} - } // namespace WebCore diff --git a/chromium/third_party/WebKit/Source/core/platform/graphics/transforms/TransformOperations.h b/chromium/third_party/WebKit/Source/core/platform/graphics/transforms/TransformOperations.h index 2f650126189..f40f77f3ce1 100644 --- a/chromium/third_party/WebKit/Source/core/platform/graphics/transforms/TransformOperations.h +++ b/chromium/third_party/WebKit/Source/core/platform/graphics/transforms/TransformOperations.h @@ -75,7 +75,6 @@ public: TransformOperations blendByMatchingOperations(const TransformOperations& from, const double& progress) const; TransformOperations blendByUsingMatrixInterpolation(const TransformOperations& from, double progress) const; TransformOperations blend(const TransformOperations& from, double progress) const; - TransformOperations add(const TransformOperations& addend) const; private: Vector<RefPtr<TransformOperation> > m_operations; diff --git a/chromium/third_party/WebKit/Source/core/platform/mac/ScrollAnimatorMac.mm b/chromium/third_party/WebKit/Source/core/platform/mac/ScrollAnimatorMac.mm index 9f4dda58b55..a92ab24b9cc 100644 --- a/chromium/third_party/WebKit/Source/core/platform/mac/ScrollAnimatorMac.mm +++ b/chromium/third_party/WebKit/Source/core/platform/mac/ScrollAnimatorMac.mm @@ -32,12 +32,12 @@ #include "core/platform/ScrollView.h" #include "core/platform/ScrollableArea.h" #include "core/platform/ScrollbarTheme.h" -#include "core/platform/ScrollbarThemeMacCommon.h" -#include "core/platform/ScrollbarThemeMacOverlayAPI.h" #include "core/platform/graphics/FloatPoint.h" #include "core/platform/mac/BlockExceptions.h" #include "core/platform/mac/EmptyProtocolDefinitions.h" #include "core/platform/mac/NSScrollerImpDetails.h" +#include "core/platform/mac/ScrollbarThemeMac.h" +#include "core/platform/mac/ScrollbarThemeMacOverlayAPI.h" #include "wtf/MainThread.h" #include "wtf/PassOwnPtr.h" #include "wtf/UnusedParam.h" diff --git a/chromium/third_party/WebKit/Source/core/platform/ScrollbarThemeMacCommon.h b/chromium/third_party/WebKit/Source/core/platform/mac/ScrollbarThemeMac.h index 8a62dd909d2..fac25ecaaf6 100644 --- a/chromium/third_party/WebKit/Source/core/platform/ScrollbarThemeMacCommon.h +++ b/chromium/third_party/WebKit/Source/core/platform/mac/ScrollbarThemeMac.h @@ -23,8 +23,8 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef ScrollbarThemeMacCommon_h -#define ScrollbarThemeMacCommon_h +#ifndef ScrollbarThemeMac_h +#define ScrollbarThemeMac_h #include "core/platform/ScrollbarTheme.h" @@ -63,4 +63,4 @@ protected: } -#endif // ScrollbarThemeMacCommon_h +#endif diff --git a/chromium/third_party/WebKit/Source/core/platform/ScrollbarThemeMacCommon.mm b/chromium/third_party/WebKit/Source/core/platform/mac/ScrollbarThemeMac.mm index 5577f9631bd..6b7975afda3 100644 --- a/chromium/third_party/WebKit/Source/core/platform/ScrollbarThemeMacCommon.mm +++ b/chromium/third_party/WebKit/Source/core/platform/mac/ScrollbarThemeMac.mm @@ -20,18 +20,16 @@ * 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. + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "config.h" -#include "core/platform/ScrollbarThemeMacCommon.h" +#include "core/platform/mac/ScrollbarThemeMac.h" #include <Carbon/Carbon.h> #include "core/page/FrameView.h" #include "core/platform/PlatformMouseEvent.h" #include "core/platform/ScrollView.h" -#include "core/platform/ScrollbarThemeMacNonOverlayAPI.h" -#include "core/platform/ScrollbarThemeMacOverlayAPI.h" #include "core/platform/graphics/Gradient.h" #include "core/platform/graphics/GraphicsContext.h" #include "core/platform/graphics/GraphicsContextStateSaver.h" @@ -41,6 +39,8 @@ #include "core/platform/mac/LocalCurrentGraphicsContext.h" #include "core/platform/mac/NSScrollerImpDetails.h" #include "core/platform/mac/ScrollAnimatorMac.h" +#include "core/platform/mac/ScrollbarThemeMacNonOverlayAPI.h" +#include "core/platform/mac/ScrollbarThemeMacOverlayAPI.h" #include "public/platform/mac/WebThemeEngine.h" #include "public/platform/Platform.h" #include "public/platform/WebRect.h" diff --git a/chromium/third_party/WebKit/Source/core/platform/ScrollbarThemeMacNonOverlayAPI.h b/chromium/third_party/WebKit/Source/core/platform/mac/ScrollbarThemeMacNonOverlayAPI.h index e51380059f4..28066053108 100644 --- a/chromium/third_party/WebKit/Source/core/platform/ScrollbarThemeMacNonOverlayAPI.h +++ b/chromium/third_party/WebKit/Source/core/platform/mac/ScrollbarThemeMacNonOverlayAPI.h @@ -31,7 +31,7 @@ #ifndef ScrollbarThemeMacNonOverlayAPI_h #define ScrollbarThemeMacNonOverlayAPI_h -#include "core/platform/ScrollbarThemeMacCommon.h" +#include "core/platform/mac/ScrollbarThemeMac.h" namespace WebCore { diff --git a/chromium/third_party/WebKit/Source/core/platform/ScrollbarThemeMacNonOverlayAPI.mm b/chromium/third_party/WebKit/Source/core/platform/mac/ScrollbarThemeMacNonOverlayAPI.mm index dc8540053d9..62e2db5c1ef 100644 --- a/chromium/third_party/WebKit/Source/core/platform/ScrollbarThemeMacNonOverlayAPI.mm +++ b/chromium/third_party/WebKit/Source/core/platform/mac/ScrollbarThemeMacNonOverlayAPI.mm @@ -29,7 +29,7 @@ */ #include "config.h" -#include "core/platform/ScrollbarThemeMacNonOverlayAPI.h" +#include "core/platform/mac/ScrollbarThemeMacNonOverlayAPI.h" #include <Carbon/Carbon.h> #include "core/platform/ScrollbarThemeClient.h" diff --git a/chromium/third_party/WebKit/Source/core/platform/ScrollbarThemeMacOverlayAPI.h b/chromium/third_party/WebKit/Source/core/platform/mac/ScrollbarThemeMacOverlayAPI.h index b0c5aef9eb7..f1712a0d144 100644 --- a/chromium/third_party/WebKit/Source/core/platform/ScrollbarThemeMacOverlayAPI.h +++ b/chromium/third_party/WebKit/Source/core/platform/mac/ScrollbarThemeMacOverlayAPI.h @@ -31,7 +31,7 @@ #ifndef ScrollbarThemeMacOverlayAPI_h #define ScrollbarThemeMacOverlayAPI_h -#include "core/platform/ScrollbarThemeMacCommon.h" +#include "core/platform/mac/ScrollbarThemeMac.h" typedef id ScrollbarPainter; diff --git a/chromium/third_party/WebKit/Source/core/platform/ScrollbarThemeMacOverlayAPI.mm b/chromium/third_party/WebKit/Source/core/platform/mac/ScrollbarThemeMacOverlayAPI.mm index cac425ed928..a0ad14f2474 100644 --- a/chromium/third_party/WebKit/Source/core/platform/ScrollbarThemeMacOverlayAPI.mm +++ b/chromium/third_party/WebKit/Source/core/platform/mac/ScrollbarThemeMacOverlayAPI.mm @@ -29,7 +29,7 @@ */ #include "config.h" -#include "core/platform/ScrollbarThemeMacOverlayAPI.h" +#include "core/platform/mac/ScrollbarThemeMacOverlayAPI.h" #include "core/platform/graphics/GraphicsContext.h" #include "core/platform/graphics/GraphicsContextStateSaver.h" diff --git a/chromium/third_party/WebKit/Source/core/rendering/FilterEffectRenderer.cpp b/chromium/third_party/WebKit/Source/core/rendering/FilterEffectRenderer.cpp index f5787226fab..ea8f36eda58 100644 --- a/chromium/third_party/WebKit/Source/core/rendering/FilterEffectRenderer.cpp +++ b/chromium/third_party/WebKit/Source/core/rendering/FilterEffectRenderer.cpp @@ -29,8 +29,8 @@ #include "core/rendering/FilterEffectRenderer.h" #include "core/dom/Document.h" -#include "core/fetch/DocumentResource.h" -#include "core/fetch/DocumentResourceReference.h" +#include "core/loader/cache/DocumentResource.h" +#include "core/loader/cache/DocumentResourceReference.h" #include "core/page/Page.h" #include "core/platform/FloatConversion.h" #include "core/platform/graphics/ColorSpace.h" diff --git a/chromium/third_party/WebKit/Source/core/rendering/HitTestLocation.cpp b/chromium/third_party/WebKit/Source/core/rendering/HitTestLocation.cpp index d09665d7fea..96c55aec951 100644 --- a/chromium/third_party/WebKit/Source/core/rendering/HitTestLocation.cpp +++ b/chromium/third_party/WebKit/Source/core/rendering/HitTestLocation.cpp @@ -27,7 +27,6 @@ #include "XLinkNames.h" #include "core/dom/DocumentMarkerController.h" #include "core/editing/FrameSelection.h" -#include "core/fetch/ImageResource.h" #include "core/html/HTMLAnchorElement.h" #include "core/html/HTMLImageElement.h" #include "core/html/HTMLInputElement.h" @@ -35,6 +34,7 @@ #include "core/html/HTMLPlugInImageElement.h" #include "core/html/HTMLVideoElement.h" #include "core/html/parser/HTMLParserIdioms.h" +#include "core/loader/cache/ImageResource.h" #include "core/page/Frame.h" #include "core/page/FrameTree.h" #include "core/platform/Scrollbar.h" diff --git a/chromium/third_party/WebKit/Source/core/rendering/HitTestResult.cpp b/chromium/third_party/WebKit/Source/core/rendering/HitTestResult.cpp index 58212803b40..393d2cb36dc 100644 --- a/chromium/third_party/WebKit/Source/core/rendering/HitTestResult.cpp +++ b/chromium/third_party/WebKit/Source/core/rendering/HitTestResult.cpp @@ -29,7 +29,6 @@ #include "core/dom/NodeRenderingTraversal.h" #include "core/dom/shadow/ShadowRoot.h" #include "core/editing/FrameSelection.h" -#include "core/fetch/ImageResource.h" #include "core/html/HTMLAnchorElement.h" #include "core/html/HTMLAreaElement.h" #include "core/html/HTMLImageElement.h" @@ -38,6 +37,7 @@ #include "core/html/HTMLTextAreaElement.h" #include "core/html/HTMLVideoElement.h" #include "core/html/parser/HTMLParserIdioms.h" +#include "core/loader/cache/ImageResource.h" #include "core/page/Frame.h" #include "core/page/FrameTree.h" #include "core/platform/Scrollbar.h" diff --git a/chromium/third_party/WebKit/Source/core/rendering/PaintInfo.h b/chromium/third_party/WebKit/Source/core/rendering/PaintInfo.h index 4e348f22380..5ff00c5db8e 100644 --- a/chromium/third_party/WebKit/Source/core/rendering/PaintInfo.h +++ b/chromium/third_party/WebKit/Source/core/rendering/PaintInfo.h @@ -61,7 +61,7 @@ struct PaintInfo { , renderRegion(region) , outlineObjects(newOutlineObjects) , overlapTestRequests(overlapTestRequests) - , m_paintContainer(newPaintContainer) + , paintContainer(newPaintContainer) { } @@ -101,7 +101,6 @@ struct PaintInfo { } static IntRect infiniteRect() { return IntRect(LayoutRect::infiniteRect()); } - const RenderLayerModelObject* paintContainer() const { return m_paintContainer; } // FIXME: Introduce setters/getters at some point. Requires a lot of changes throughout rendering/. GraphicsContext* context; @@ -112,10 +111,7 @@ struct PaintInfo { RenderRegion* renderRegion; ListHashSet<RenderInline*>* outlineObjects; // used to list outlines that should be painted by a block with inline children OverlapTestRequestMap* overlapTestRequests; - -private: - - const RenderLayerModelObject* m_paintContainer; // the layer object that originates the current painting + const RenderLayerModelObject* paintContainer; // the layer object that originates the current painting }; } // namespace WebCore diff --git a/chromium/third_party/WebKit/Source/core/rendering/RenderBlock.cpp b/chromium/third_party/WebKit/Source/core/rendering/RenderBlock.cpp index e94a24f4835..d40b5f2007f 100644 --- a/chromium/third_party/WebKit/Source/core/rendering/RenderBlock.cpp +++ b/chromium/third_party/WebKit/Source/core/rendering/RenderBlock.cpp @@ -224,20 +224,18 @@ static void removeBlockFromDescendantAndContainerMaps(RenderBlock* block, Tracke RenderBlock::~RenderBlock() { + if (m_floatingObjects) + deleteAllValues(m_floatingObjects->set()); + if (hasColumns()) gColumnInfoMap->take(this); + if (gPercentHeightDescendantsMap) removeBlockFromDescendantAndContainerMaps(this, gPercentHeightDescendantsMap, gPercentHeightContainerMap); if (gPositionedDescendantsMap) removeBlockFromDescendantAndContainerMaps(this, gPositionedDescendantsMap, gPositionedContainerMap); } -RenderBlock::FloatingObjects::~FloatingObjects() -{ - // FIXME: m_set should use OwnPtr instead. - deleteAllValues(m_set); -} - RenderBlock* RenderBlock::createAnonymous(Document* document) { RenderBlock* renderer = new RenderBlock(0); @@ -970,20 +968,17 @@ static void getInlineRun(RenderObject* start, RenderObject* boundary, } while (!sawInline); } -void RenderBlock::FloatingObjects::clearLineBoxTreePointers() -{ - // Clear references to originating lines, since the lines are being deleted - FloatingObjectSetIterator end = m_set.end(); - for (FloatingObjectSetIterator it = m_set.begin(); it != end; ++it) { - ASSERT(!((*it)->originatingLine()) || (*it)->originatingLine()->renderer() == m_renderer); - (*it)->setOriginatingLine(0); - } -} - void RenderBlock::deleteLineBoxTree() { - if (containsFloats()) - m_floatingObjects->clearLineBoxTreePointers(); + if (containsFloats()) { + // Clear references to originating lines, since the lines are being deleted + const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set(); + FloatingObjectSetIterator end = floatingObjectSet.end(); + for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end; ++it) { + ASSERT(!((*it)->m_originatingLine) || (*it)->m_originatingLine->renderer() == this); + (*it)->m_originatingLine = 0; + } + } m_lineBoxes.deleteLineBoxTree(); if (AXObjectCache* cache = document()->existingAXObjectCache()) @@ -1420,21 +1415,6 @@ void RenderBlock::layout() invalidateBackgroundObscurationStatus(); } -void RenderBlock::imageChanged(WrappedImagePtr image, const IntRect*) -{ - RenderBox::imageChanged(image); - - if (!parent()) - return; - - ShapeValue* shapeValue = style()->shapeInside(); - if (shapeValue && shapeValue->image() && shapeValue->image()->data() == image) { - ShapeInsideInfo* shapeInsideInfo = ensureShapeInsideInfo(); - shapeInsideInfo->dirtyShapeSize(); - markShapeInsideDescendantsForLayout(); - } -} - void RenderBlock::updateShapeInsideInfoAfterStyleChange(const ShapeValue* shapeInside, const ShapeValue* oldShapeInside) { // FIXME: A future optimization would do a deep comparison for equality. @@ -1803,7 +1783,7 @@ void RenderBlock::addOverflowFromFloats() for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end; ++it) { FloatingObject* r = *it; if (r->isDescendant()) - addOverflowFromChild(r->renderer(), IntSize(xPositionForFloatIncludingMargin(r), yPositionForFloatIncludingMargin(r))); + addOverflowFromChild(r->m_renderer, IntSize(xPositionForFloatIncludingMargin(r), yPositionForFloatIncludingMargin(r))); } } @@ -2733,11 +2713,6 @@ bool RenderBlock::simplifiedLayout() if (needsSimplifiedNormalFlowLayout()) simplifiedNormalFlowLayout(); - // Make sure a forced break is applied after the content if we are a flow thread in a simplified layout. - // This ensures the size information is correctly computed for the last auto-height region receiving content. - if (isRenderFlowThread()) - toRenderFlowThread(this)->applyBreakAfterContent(clientLogicalBottom()); - // Lay out our positioned objects if our positioned child bit is set. // Also, if an absolute position element inside a relative positioned container moves, and the absolute element has a fixed position // child, neither the fixed element nor its container learn of the movement since posChildNeedsLayout() is only marked as far as the @@ -2902,11 +2877,9 @@ void RenderBlock::repaintOverhangingFloats(bool paintAllDescendants) // Only repaint the object if it is overhanging, is not in its own layer, and // is our responsibility to paint (m_shouldPaint is set). When paintAllDescendants is true, the latter // condition is replaced with being a descendant of us. - if (r->logicalBottom(isHorizontalWritingMode()) > logicalHeight() - && !r->renderer()->hasSelfPaintingLayer() - && (r->shouldPaint() || (paintAllDescendants && r->renderer()->isDescendantOf(this)))) { - r->renderer()->repaint(); - r->renderer()->repaintOverhangingFloats(false); + if (logicalBottomForFloat(r) > logicalHeight() && ((paintAllDescendants && r->m_renderer->isDescendantOf(this)) || r->shouldPaint()) && !r->m_renderer->hasSelfPaintingLayer()) { + r->m_renderer->repaint(); + r->m_renderer->repaintOverhangingFloats(false); } } } @@ -3267,21 +3240,20 @@ void RenderBlock::paintFloats(PaintInfo& paintInfo, const LayoutPoint& paintOffs for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end; ++it) { FloatingObject* r = *it; // Only paint the object if our m_shouldPaint flag is set. - if (r->shouldPaint() && !r->renderer()->hasSelfPaintingLayer()) { + if (r->shouldPaint() && !r->m_renderer->hasSelfPaintingLayer()) { PaintInfo currentPaintInfo(paintInfo); currentPaintInfo.phase = preservePhase ? paintInfo.phase : PaintPhaseBlockBackground; - // FIXME: LayoutPoint version of xPositionForFloatIncludingMargin would make this much cleaner. - LayoutPoint childPoint = flipFloatForWritingModeForChild(r, LayoutPoint(paintOffset.x() + xPositionForFloatIncludingMargin(r) - r->renderer()->x(), paintOffset.y() + yPositionForFloatIncludingMargin(r) - r->renderer()->y())); - r->renderer()->paint(currentPaintInfo, childPoint); + LayoutPoint childPoint = flipFloatForWritingModeForChild(r, LayoutPoint(paintOffset.x() + xPositionForFloatIncludingMargin(r) - r->m_renderer->x(), paintOffset.y() + yPositionForFloatIncludingMargin(r) - r->m_renderer->y())); + r->m_renderer->paint(currentPaintInfo, childPoint); if (!preservePhase) { currentPaintInfo.phase = PaintPhaseChildBlockBackgrounds; - r->renderer()->paint(currentPaintInfo, childPoint); + r->m_renderer->paint(currentPaintInfo, childPoint); currentPaintInfo.phase = PaintPhaseFloat; - r->renderer()->paint(currentPaintInfo, childPoint); + r->m_renderer->paint(currentPaintInfo, childPoint); currentPaintInfo.phase = PaintPhaseForeground; - r->renderer()->paint(currentPaintInfo, childPoint); + r->m_renderer->paint(currentPaintInfo, childPoint); currentPaintInfo.phase = PaintPhaseOutline; - r->renderer()->paint(currentPaintInfo, childPoint); + r->m_renderer->paint(currentPaintInfo, childPoint); } } } @@ -3495,7 +3467,7 @@ GapRects RenderBlock::selectionGaps(RenderBlock* rootBlock, const LayoutPoint& r FloatingObject* r = *it; LayoutRect floatBox(offsetFromRootBlock.width() + xPositionForFloatIncludingMargin(r), offsetFromRootBlock.height() + yPositionForFloatIncludingMargin(r), - r->renderer()->width(), r->renderer()->height()); + r->m_renderer->width(), r->m_renderer->height()); rootBlock->flipForWritingMode(floatBox); floatBox.move(rootBlockPhysicalPosition.x(), rootBlockPhysicalPosition.y()); paintInfo->context->clipOut(pixelSnappedIntRect(floatBox)); @@ -3934,14 +3906,14 @@ RenderBlock::FloatingObject* RenderBlock::insertFloatingObject(RenderBox* o) o->computeAndSetBlockDirectionMargins(this); } - newObj->setLogicalWidth(logicalWidthForChild(o) + marginStartForChild(o) + marginEndForChild(o), isHorizontalWritingMode()); + setLogicalWidthForFloat(newObj, logicalWidthForChild(o) + marginStartForChild(o) + marginEndForChild(o)); if (ShapeOutsideInfo* shapeOutside = o->shapeOutsideInfo()) shapeOutside->setShapeSize(logicalWidthForChild(o), logicalHeightForChild(o)); newObj->setShouldPaint(!o->hasSelfPaintingLayer()); // If a layer exists, the float will paint itself. Otherwise someone else will. newObj->setIsDescendant(true); - newObj->setRenderer(o); + newObj->m_renderer = o; m_floatingObjects->add(newObj); @@ -3956,8 +3928,8 @@ void RenderBlock::removeFloatingObject(RenderBox* o) if (it != floatingObjectSet.end()) { FloatingObject* r = *it; if (childrenInline()) { - LayoutUnit logicalTop = r->logicalTop(isHorizontalWritingMode()); - LayoutUnit logicalBottom = r->logicalBottom(isHorizontalWritingMode()); + LayoutUnit logicalTop = logicalTopForFloat(r); + LayoutUnit logicalBottom = logicalBottomForFloat(r); // Fix for https://bugs.webkit.org/show_bug.cgi?id=54995. if (logicalBottom < 0 || logicalBottom < logicalTop || logicalTop == LayoutUnit::max()) @@ -3968,19 +3940,19 @@ void RenderBlock::removeFloatingObject(RenderBox* o) // accomplished by pretending they have a height of 1. logicalBottom = max(logicalBottom, logicalTop + 1); } - if (r->originatingLine()) { + if (r->m_originatingLine) { if (!selfNeedsLayout()) { - ASSERT(r->originatingLine()->renderer() == this); - r->originatingLine()->markDirty(); + ASSERT(r->m_originatingLine->renderer() == this); + r->m_originatingLine->markDirty(); } #if !ASSERT_DISABLED - r->setOriginatingLine(0); + r->m_originatingLine = 0; #endif } markLinesDirtyInBlockRange(0, logicalBottom); } m_floatingObjects->remove(r); - ASSERT(!r->originatingLine()); + ASSERT(!r->m_originatingLine); delete r; } } @@ -3993,9 +3965,9 @@ void RenderBlock::removeFloatingObjectsBelow(FloatingObject* lastFloat, int logi const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set(); FloatingObject* curr = floatingObjectSet.last(); - while (curr != lastFloat && (!curr->isPlaced() || curr->logicalTop(isHorizontalWritingMode()) >= logicalOffset)) { + while (curr != lastFloat && (!curr->isPlaced() || logicalTopForFloat(curr) >= logicalOffset)) { m_floatingObjects->remove(curr); - ASSERT(!curr->originatingLine()); + ASSERT(!curr->m_originatingLine); delete curr; if (floatingObjectSet.isEmpty()) break; @@ -4021,7 +3993,7 @@ LayoutPoint RenderBlock::computeLogicalLocationForFloat(const FloatingObject* fl } else logicalRightOffset = logicalRightOffsetForContent(logicalTopOffset); - LayoutUnit floatLogicalWidth = min(floatingObject->logicalWidth(isHorizontalWritingMode()), logicalRightOffset - logicalLeftOffset); // The width we look for. + LayoutUnit floatLogicalWidth = min(logicalWidthForFloat(floatingObject), logicalRightOffset - logicalLeftOffset); // The width we look for. LayoutUnit floatLogicalLeft; @@ -4038,7 +4010,7 @@ LayoutPoint RenderBlock::computeLogicalLocationForFloat(const FloatingObject* fl // Have to re-evaluate all of our offsets, since they may have changed. logicalRightOffset = logicalRightOffsetForContent(logicalTopOffset); // Constant part of right offset. logicalLeftOffset = logicalLeftOffsetForContent(logicalTopOffset); // Constant part of left offset. - floatLogicalWidth = min(floatingObject->logicalWidth(isHorizontalWritingMode()), logicalRightOffset - logicalLeftOffset); + floatLogicalWidth = min(logicalWidthForFloat(floatingObject), logicalRightOffset - logicalLeftOffset); } } floatLogicalLeft = max(logicalLeftOffset - borderAndPaddingLogicalLeft(), floatLogicalLeft); @@ -4053,10 +4025,10 @@ LayoutPoint RenderBlock::computeLogicalLocationForFloat(const FloatingObject* fl // Have to re-evaluate all of our offsets, since they may have changed. logicalRightOffset = logicalRightOffsetForContent(logicalTopOffset); // Constant part of right offset. logicalLeftOffset = logicalLeftOffsetForContent(logicalTopOffset); // Constant part of left offset. - floatLogicalWidth = min(floatingObject->logicalWidth(isHorizontalWritingMode()), logicalRightOffset - logicalLeftOffset); + floatLogicalWidth = min(logicalWidthForFloat(floatingObject), logicalRightOffset - logicalLeftOffset); } } - floatLogicalLeft -= floatingObject->logicalWidth(isHorizontalWritingMode()); // Use the original width of the float here, since the local variable + floatLogicalLeft -= logicalWidthForFloat(floatingObject); // Use the original width of the float here, since the local variable // |floatLogicalWidth| was capped to the available line width. // See fast/block/float/clamped-right-float.html. } @@ -4097,7 +4069,7 @@ bool RenderBlock::positionNewFloats() // The float cannot start above the top position of the last positioned float. if (lastPlacedFloatingObject) - logicalTop = max(lastPlacedFloatingObject->logicalTop(isHorizontalWritingMode()), logicalTop); + logicalTop = max(logicalTopForFloat(lastPlacedFloatingObject), logicalTop); FloatingObjectSetIterator end = floatingObjectSet.end(); // Now walk through the set of unpositioned floats and place them. @@ -4120,7 +4092,7 @@ bool RenderBlock::positionNewFloats() LayoutPoint floatLogicalLocation = computeLogicalLocationForFloat(floatingObject, logicalTop); - floatingObject->setLogicalLeft(floatLogicalLocation.x(), isHorizontalWritingMode()); + setLogicalLeftForFloat(floatingObject, floatLogicalLocation.x()); setLogicalLeftForChild(childBox, floatLogicalLocation.x() + childLogicalLeftMargin); setLogicalTopForChild(childBox, floatLogicalLocation.y() + marginBeforeForChild(childBox)); @@ -4147,10 +4119,10 @@ bool RenderBlock::positionNewFloats() } if (newLogicalTop != floatLogicalLocation.y()) { - floatingObject->setPaginationStrut(newLogicalTop - floatLogicalLocation.y()); + floatingObject->m_paginationStrut = newLogicalTop - floatLogicalLocation.y(); floatLogicalLocation = computeLogicalLocationForFloat(floatingObject, newLogicalTop); - floatingObject->setLogicalLeft(floatLogicalLocation.x(), isHorizontalWritingMode()); + setLogicalLeftForFloat(floatingObject, floatLogicalLocation.x()); setLogicalLeftForChild(childBox, floatLogicalLocation.x() + childLogicalLeftMargin); setLogicalTopForChild(childBox, floatLogicalLocation.y() + marginBeforeForChild(childBox)); @@ -4161,9 +4133,9 @@ bool RenderBlock::positionNewFloats() } } - floatingObject->setLogicalTop(floatLogicalLocation.y(), isHorizontalWritingMode()); + setLogicalTopForFloat(floatingObject, floatLogicalLocation.y()); - floatingObject->setLogicalHeight(logicalHeightForChild(childBox) + marginBeforeForChild(childBox) + marginAfterForChild(childBox), isHorizontalWritingMode()); + setLogicalHeightForFloat(floatingObject, logicalHeightForChild(childBox) + marginBeforeForChild(childBox) + marginAfterForChild(childBox)); m_floatingObjects->addPlacedObject(floatingObject); @@ -4254,7 +4226,7 @@ void RenderBlock::clearPercentHeightDescendantsFrom(RenderBox* parent) } } -inline static bool rangesIntersect(int floatTop, int floatBottom, int objectTop, int objectBottom) +static bool rangesIntersect(int floatTop, int floatBottom, int objectTop, int objectBottom) { if (objectTop >= floatBottom || objectBottom < floatTop) return false; @@ -4275,48 +4247,41 @@ inline static bool rangesIntersect(int floatTop, int floatBottom, int objectTop, } template<> -inline bool RenderBlock::ComputeFloatOffsetAdapter<RenderBlock::FloatingObject::FloatLeft>::updateOffsetIfNeeded(const FloatingObject* floatingObject) +bool RenderBlock::FloatIntervalSearchAdapter<RenderBlock::FloatingObject::FloatLeft>::updateOffsetIfNeeded(const FloatingObject* floatingObject) const { - LayoutUnit logicalRight = floatingObject->logicalRight(m_renderer->isHorizontalWritingMode()); - if (logicalRight > m_offset) { - m_offset = logicalRight; + if (m_renderer->logicalRightForFloat(floatingObject) > m_offset) { + m_offset = m_renderer->logicalRightForFloat(floatingObject); return true; } return false; } template<> -inline bool RenderBlock::ComputeFloatOffsetAdapter<RenderBlock::FloatingObject::FloatRight>::updateOffsetIfNeeded(const FloatingObject* floatingObject) +bool RenderBlock::FloatIntervalSearchAdapter<RenderBlock::FloatingObject::FloatRight>::updateOffsetIfNeeded(const FloatingObject* floatingObject) const { - LayoutUnit logicalLeft = floatingObject->logicalLeft(m_renderer->isHorizontalWritingMode()); - if (logicalLeft < m_offset) { - m_offset = logicalLeft; + if (m_renderer->logicalLeftForFloat(floatingObject) < m_offset) { + m_offset = m_renderer->logicalLeftForFloat(floatingObject); return true; } return false; } template <RenderBlock::FloatingObject::Type FloatTypeValue> -inline void RenderBlock::ComputeFloatOffsetAdapter<FloatTypeValue>::collectIfNeeded(const IntervalType& interval) +inline void RenderBlock::FloatIntervalSearchAdapter<FloatTypeValue>::collectIfNeeded(const IntervalType& interval) const { const FloatingObject* floatingObject = interval.data(); - if (floatingObject->type() != FloatTypeValue || !rangesIntersect(interval.low(), interval.high(), m_lineTop, m_lineBottom)) + if (floatingObject->type() != FloatTypeValue || !rangesIntersect(interval.low(), interval.high(), m_lowValue, m_highValue)) return; - // Make sure the float hasn't changed since it was added to the placed floats tree. + // All the objects returned from the tree should be already placed. ASSERT(floatingObject->isPlaced()); - ASSERT(interval.low() == floatingObject->pixelSnappedLogicalTop(m_renderer->isHorizontalWritingMode())); - ASSERT(interval.high() == floatingObject->pixelSnappedLogicalBottom(m_renderer->isHorizontalWritingMode())); + ASSERT(rangesIntersect(m_renderer->pixelSnappedLogicalTopForFloat(floatingObject), m_renderer->pixelSnappedLogicalBottomForFloat(floatingObject), m_lowValue, m_highValue)); bool floatIsNewExtreme = updateOffsetIfNeeded(floatingObject); - if (floatIsNewExtreme) - m_outermostFloat = floatingObject; -} + if (floatIsNewExtreme && m_heightRemaining) + *m_heightRemaining = m_renderer->logicalBottomForFloat(floatingObject) - m_lowValue; -template <RenderBlock::FloatingObject::Type FloatTypeValue> -LayoutUnit RenderBlock::ComputeFloatOffsetAdapter<FloatTypeValue>::getHeightRemaining() const -{ - return m_outermostFloat ? m_outermostFloat->logicalBottom(m_renderer->isHorizontalWritingMode()) - m_lineTop : LayoutUnit(1); + m_last = floatingObject; } LayoutUnit RenderBlock::textIndentOffset() const @@ -4353,16 +4318,16 @@ LayoutUnit RenderBlock::logicalLeftFloatOffsetForLine(LayoutUnit logicalTop, Lay { LayoutUnit left = fixedOffset; if (m_floatingObjects && m_floatingObjects->hasLeftObjects()) { - ComputeFloatOffsetAdapter<FloatingObject::FloatLeft> adapter(this, roundToInt(logicalTop), roundToInt(logicalTop + logicalHeight), left); - m_floatingObjects->placedFloatsTree().allOverlapsWithAdapter(adapter); - if (heightRemaining) - *heightRemaining = adapter.getHeightRemaining(); + *heightRemaining = 1; + + FloatIntervalSearchAdapter<FloatingObject::FloatLeft> adapter(this, roundToInt(logicalTop), roundToInt(logicalTop + logicalHeight), left, heightRemaining); + m_floatingObjects->placedFloatsTree().allOverlapsWithAdapter(adapter); - const FloatingObject* outermostFloat = adapter.outermostFloat(); - if (offsetMode == ShapeOutsideFloatShapeOffset && outermostFloat) { - if (ShapeOutsideInfo* shapeOutside = outermostFloat->renderer()->shapeOutsideInfo()) { - shapeOutside->computeSegmentsForContainingBlockLine(logicalTop, outermostFloat->logicalTop(isHorizontalWritingMode()), logicalHeight); + const FloatingObject* lastFloat = adapter.lastFloat(); + if (offsetMode == ShapeOutsideFloatShapeOffset && lastFloat) { + if (ShapeOutsideInfo* shapeOutside = lastFloat->renderer()->shapeOutsideInfo()) { + shapeOutside->computeSegmentsForContainingBlockLine(logicalTop, logicalTopForFloat(lastFloat), logicalHeight); left += shapeOutside->rightSegmentMarginBoxDelta(); } } @@ -4413,17 +4378,17 @@ LayoutUnit RenderBlock::logicalRightFloatOffsetForLine(LayoutUnit logicalTop, La { LayoutUnit right = fixedOffset; if (m_floatingObjects && m_floatingObjects->hasRightObjects()) { + if (heightRemaining) + *heightRemaining = 1; + LayoutUnit rightFloatOffset = fixedOffset; - ComputeFloatOffsetAdapter<FloatingObject::FloatRight> adapter(this, roundToInt(logicalTop), roundToInt(logicalTop + logicalHeight), rightFloatOffset); + FloatIntervalSearchAdapter<FloatingObject::FloatRight> adapter(this, roundToInt(logicalTop), roundToInt(logicalTop + logicalHeight), rightFloatOffset, heightRemaining); m_floatingObjects->placedFloatsTree().allOverlapsWithAdapter(adapter); - if (heightRemaining) - *heightRemaining = adapter.getHeightRemaining(); - - const FloatingObject* outermostFloat = adapter.outermostFloat(); - if (offsetMode == ShapeOutsideFloatShapeOffset && outermostFloat) { - if (ShapeOutsideInfo* shapeOutside = outermostFloat->renderer()->shapeOutsideInfo()) { - shapeOutside->computeSegmentsForContainingBlockLine(logicalTop, outermostFloat->logicalTop(isHorizontalWritingMode()), logicalHeight); + const FloatingObject* lastFloat = adapter.lastFloat(); + if (offsetMode == ShapeOutsideFloatShapeOffset && lastFloat) { + if (ShapeOutsideInfo* shapeOutside = lastFloat->renderer()->shapeOutsideInfo()) { + shapeOutside->computeSegmentsForContainingBlockLine(logicalTop, logicalTopForFloat(lastFloat), logicalHeight); rightFloatOffset += shapeOutside->leftSegmentMarginBoxDelta(); } } @@ -4481,7 +4446,7 @@ LayoutUnit RenderBlock::nextFloatLogicalBottomBelow(LayoutUnit logicalHeight) co FloatingObjectSetIterator end = floatingObjectSet.end(); for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end; ++it) { FloatingObject* r = *it; - LayoutUnit floatBottom = r->logicalBottom(isHorizontalWritingMode()); + LayoutUnit floatBottom = logicalBottomForFloat(r); if (floatBottom > logicalHeight) bottom = min(floatBottom, bottom); } @@ -4499,7 +4464,7 @@ LayoutUnit RenderBlock::lowestFloatLogicalBottom(FloatingObject::Type floatType) for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end; ++it) { FloatingObject* r = *it; if (r->isPlaced() && r->type() & floatType) - lowestFloatBottom = max(lowestFloatBottom, r->logicalBottom(isHorizontalWritingMode())); + lowestFloatBottom = max(lowestFloatBottom, logicalBottomForFloat(r)); } return lowestFloatBottom; } @@ -4534,7 +4499,7 @@ void RenderBlock::clearFloats() for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end; ++it) { FloatingObject* floatingObject = *it; if (!floatingObject->isDescendant()) - oldIntrudingFloatSet.add(floatingObject->renderer()); + oldIntrudingFloatSet.add(floatingObject->m_renderer); } } @@ -4558,7 +4523,7 @@ void RenderBlock::clearFloats() FloatingObjectSetIterator end = floatingObjectSet.end(); for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end; ++it) { FloatingObject* f = *it; - floatMap.add(f->renderer(), f); + floatMap.add(f->m_renderer, f); } } else { deleteAllValues(floatingObjectSet); @@ -4610,11 +4575,11 @@ void RenderBlock::clearFloats() FloatingObjectSetIterator end = floatingObjectSet.end(); for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end; ++it) { FloatingObject* f = *it; - FloatingObject* oldFloatingObject = floatMap.get(f->renderer()); - LayoutUnit logicalBottom = f->logicalBottom(isHorizontalWritingMode()); + FloatingObject* oldFloatingObject = floatMap.get(f->m_renderer); + LayoutUnit logicalBottom = logicalBottomForFloat(f); if (oldFloatingObject) { - LayoutUnit oldLogicalBottom = oldFloatingObject->logicalBottom(isHorizontalWritingMode()); - if (f->logicalWidth(isHorizontalWritingMode()) != oldFloatingObject->logicalWidth(isHorizontalWritingMode()) || f->logicalLeft(isHorizontalWritingMode()) != oldFloatingObject->logicalLeft(isHorizontalWritingMode())) { + LayoutUnit oldLogicalBottom = logicalBottomForFloat(oldFloatingObject); + if (logicalWidthForFloat(f) != logicalWidthForFloat(oldFloatingObject) || logicalLeftForFloat(f) != logicalLeftForFloat(oldFloatingObject)) { changeLogicalTop = 0; changeLogicalBottom = max(changeLogicalBottom, max(logicalBottom, oldLogicalBottom)); } else { @@ -4622,18 +4587,18 @@ void RenderBlock::clearFloats() changeLogicalTop = min(changeLogicalTop, min(logicalBottom, oldLogicalBottom)); changeLogicalBottom = max(changeLogicalBottom, max(logicalBottom, oldLogicalBottom)); } - LayoutUnit logicalTop = f->logicalTop(isHorizontalWritingMode()); - LayoutUnit oldLogicalTop = oldFloatingObject->logicalTop(isHorizontalWritingMode()); + LayoutUnit logicalTop = logicalTopForFloat(f); + LayoutUnit oldLogicalTop = logicalTopForFloat(oldFloatingObject); if (logicalTop != oldLogicalTop) { changeLogicalTop = min(changeLogicalTop, min(logicalTop, oldLogicalTop)); changeLogicalBottom = max(changeLogicalBottom, max(logicalTop, oldLogicalTop)); } } - floatMap.remove(f->renderer()); - if (oldFloatingObject->originatingLine() && !selfNeedsLayout()) { - ASSERT(oldFloatingObject->originatingLine()->renderer() == this); - oldFloatingObject->originatingLine()->markDirty(); + floatMap.remove(f->m_renderer); + if (oldFloatingObject->m_originatingLine && !selfNeedsLayout()) { + ASSERT(oldFloatingObject->m_originatingLine->renderer() == this); + oldFloatingObject->m_originatingLine->markDirty(); } delete oldFloatingObject; } else { @@ -4648,7 +4613,7 @@ void RenderBlock::clearFloats() FloatingObject* floatingObject = (*it).value; if (!floatingObject->isDescendant()) { changeLogicalTop = 0; - changeLogicalBottom = max(changeLogicalBottom, floatingObject->logicalBottom(isHorizontalWritingMode())); + changeLogicalBottom = max(changeLogicalBottom, logicalBottomForFloat(floatingObject)); } } deleteAllValues(floatMap); @@ -4663,7 +4628,7 @@ void RenderBlock::clearFloats() const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set(); FloatingObjectSetIterator end = floatingObjectSet.end(); for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end && !oldIntrudingFloatSet.isEmpty(); ++it) - oldIntrudingFloatSet.remove((*it)->renderer()); + oldIntrudingFloatSet.remove((*it)->m_renderer); if (!oldIntrudingFloatSet.isEmpty()) markAllDescendantsWithFloatsForLayout(); } @@ -4685,22 +4650,22 @@ LayoutUnit RenderBlock::addOverhangingFloats(RenderBlock* child, bool makeChildP FloatingObjectSetIterator childEnd = child->m_floatingObjects->set().end(); for (FloatingObjectSetIterator childIt = child->m_floatingObjects->set().begin(); childIt != childEnd; ++childIt) { FloatingObject* r = *childIt; - LayoutUnit logicalBottomForFloat = min(r->logicalBottom(isHorizontalWritingMode()), LayoutUnit::max() - childLogicalTop); + LayoutUnit logicalBottomForFloat = min(this->logicalBottomForFloat(r), LayoutUnit::max() - childLogicalTop); LayoutUnit logicalBottom = childLogicalTop + logicalBottomForFloat; lowestFloatLogicalBottom = max(lowestFloatLogicalBottom, logicalBottom); if (logicalBottom > logicalHeight()) { // If the object is not in the list, we add it now. - if (!containsFloat(r->renderer())) { + if (!containsFloat(r->m_renderer)) { LayoutSize offset = isHorizontalWritingMode() ? LayoutSize(-childLogicalLeft, -childLogicalTop) : LayoutSize(-childLogicalTop, -childLogicalLeft); FloatingObject* floatingObj = new FloatingObject(r->type(), LayoutRect(r->frameRect().location() - offset, r->frameRect().size())); - floatingObj->setRenderer(r->renderer()); + floatingObj->m_renderer = r->m_renderer; // The nearest enclosing layer always paints the float (so that zindex and stacking // behaves properly). We always want to propagate the desire to paint the float as // far out as we can, to the outermost block that overlaps the float, stopping only // if we hit a self-painting layer boundary. - if (r->renderer()->enclosingFloatPaintingLayer() == enclosingFloatPaintingLayer()) + if (r->m_renderer->enclosingFloatPaintingLayer() == enclosingFloatPaintingLayer()) r->setShouldPaint(false); else floatingObj->setShouldPaint(false); @@ -4713,8 +4678,8 @@ LayoutUnit RenderBlock::addOverhangingFloats(RenderBlock* child, bool makeChildP m_floatingObjects->add(floatingObj); } } else { - if (makeChildPaintOtherFloats && !r->shouldPaint() && !r->renderer()->hasSelfPaintingLayer() - && r->renderer()->isDescendantOf(child) && r->renderer()->enclosingFloatPaintingLayer() == child->enclosingFloatPaintingLayer()) { + if (makeChildPaintOtherFloats && !r->shouldPaint() && !r->m_renderer->hasSelfPaintingLayer() + && r->m_renderer->isDescendantOf(child) && r->m_renderer->enclosingFloatPaintingLayer() == child->enclosingFloatPaintingLayer()) { // The float is not overhanging from this block, so if it is a descendant of the child, the child should // paint it (the other case is that it is intruding into the child), unless it has its own layer or enclosing // layer. @@ -4726,7 +4691,7 @@ LayoutUnit RenderBlock::addOverhangingFloats(RenderBlock* child, bool makeChildP // Since the float doesn't overhang, it didn't get put into our list. We need to go ahead and add its overflow in to the // child now. if (r->isDescendant()) - child->addOverflowFromChild(r->renderer(), LayoutSize(xPositionForFloatIncludingMargin(r), yPositionForFloatIncludingMargin(r))); + child->addOverflowFromChild(r->m_renderer, LayoutSize(xPositionForFloatIncludingMargin(r), yPositionForFloatIncludingMargin(r))); } } return lowestFloatLogicalBottom; @@ -4742,7 +4707,7 @@ bool RenderBlock::hasOverhangingFloat(RenderBox* renderer) if (it == floatingObjectSet.end()) return false; - return (*it)->logicalBottom(isHorizontalWritingMode()) > logicalHeight(); + return logicalBottomForFloat(*it) > logicalHeight(); } void RenderBlock::addIntrudingFloats(RenderBlock* prev, LayoutUnit logicalLeftOffset, LayoutUnit logicalTopOffset) @@ -4759,7 +4724,7 @@ void RenderBlock::addIntrudingFloats(RenderBlock* prev, LayoutUnit logicalLeftOf FloatingObjectSetIterator prevEnd = prevSet.end(); for (FloatingObjectSetIterator prevIt = prevSet.begin(); prevIt != prevEnd; ++prevIt) { FloatingObject* r = *prevIt; - if (r->logicalBottom(isHorizontalWritingMode()) > logicalTopOffset) { + if (logicalBottomForFloat(r) > logicalTopOffset) { if (!m_floatingObjects || !m_floatingObjects->set().contains(r)) { LayoutSize offset = isHorizontalWritingMode() ? LayoutSize(logicalLeftOffset, logicalTopOffset) : LayoutSize(logicalTopOffset, logicalLeftOffset); FloatingObject* floatingObj = new FloatingObject(r->type(), LayoutRect(r->frameRect().location() - offset, r->frameRect().size())); @@ -4777,7 +4742,7 @@ void RenderBlock::addIntrudingFloats(RenderBlock* prev, LayoutUnit logicalLeftOf } floatingObj->setShouldPaint(false); // We are not in the direct inheritance chain for this float. We will never paint it. - floatingObj->setRenderer(r->renderer()); + floatingObj->m_renderer = r->m_renderer; // We create the floating object list lazily. if (!m_floatingObjects) @@ -5031,11 +4996,11 @@ bool RenderBlock::hitTestFloats(const HitTestRequest& request, HitTestResult& re for (FloatingObjectSetIterator it = floatingObjectSet.end(); it != begin;) { --it; FloatingObject* floatingObject = *it; - if (floatingObject->shouldPaint() && !floatingObject->renderer()->hasSelfPaintingLayer()) { - LayoutUnit xOffset = xPositionForFloatIncludingMargin(floatingObject) - floatingObject->renderer()->x(); - LayoutUnit yOffset = yPositionForFloatIncludingMargin(floatingObject) - floatingObject->renderer()->y(); + if (floatingObject->shouldPaint() && !floatingObject->m_renderer->hasSelfPaintingLayer()) { + LayoutUnit xOffset = xPositionForFloatIncludingMargin(floatingObject) - floatingObject->m_renderer->x(); + LayoutUnit yOffset = yPositionForFloatIncludingMargin(floatingObject) - floatingObject->m_renderer->y(); LayoutPoint childPoint = flipFloatForWritingModeForChild(floatingObject, adjustedLocation + LayoutSize(xOffset, yOffset)); - if (floatingObject->renderer()->hitTest(request, result, locationInContainer, childPoint)) { + if (floatingObject->m_renderer->hitTest(request, result, locationInContainer, childPoint)) { updateHitTestResult(result, locationInContainer.point() - toLayoutSize(childPoint)); return true; } @@ -6926,8 +6891,8 @@ void RenderBlock::adjustForBorderFit(LayoutUnit x, LayoutUnit& left, LayoutUnit& FloatingObject* r = *it; // Only examine the object if our m_shouldPaint flag is set. if (r->shouldPaint()) { - LayoutUnit floatLeft = xPositionForFloatIncludingMargin(r) - r->renderer()->x(); - LayoutUnit floatRight = floatLeft + r->renderer()->width(); + LayoutUnit floatLeft = xPositionForFloatIncludingMargin(r) - r->m_renderer->x(); + LayoutUnit floatRight = floatLeft + r->m_renderer->width(); left = min(left, floatLeft); right = max(right, floatRight); } @@ -7695,7 +7660,7 @@ LayoutUnit RenderBlock::offsetFromLogicalTopOfFirstPage() const // FIXME: Sanity check that the renderer in the layout state is ours, since otherwise the computation will be off. // Right now this assert gets hit inside computeLogicalHeight for percentage margins, since they're computed using // widths which can vary in each region. Until we patch that, we can't have this assert. - // ASSERT(layoutState->renderer() == this); + // ASSERT(layoutState->m_renderer == this); LayoutSize offsetDelta = layoutState->m_layoutOffset - layoutState->m_pageOffset; return isHorizontalWritingMode() ? offsetDelta.height() : offsetDelta.width(); @@ -7967,9 +7932,6 @@ void RenderBlock::createFloatingObjects() inline void RenderBlock::FloatingObjects::clear() { - // FIXME: This should call deleteAllValues, except RenderBlock::clearFloats - // like to play fast and loose with ownership of these pointers. - // If we move to OwnPtr that will fix this ownership oddness. m_set.clear(); m_placedFloatsTree.clear(); m_leftObjectsCount = 0; diff --git a/chromium/third_party/WebKit/Source/core/rendering/RenderBlock.h b/chromium/third_party/WebKit/Source/core/rendering/RenderBlock.h index f124d9dac70..06300e892bb 100644 --- a/chromium/third_party/WebKit/Source/core/rendering/RenderBlock.h +++ b/chromium/third_party/WebKit/Source/core/rendering/RenderBlock.h @@ -455,7 +455,6 @@ public: } ShapeInsideInfo* layoutShapeInsideInfo() const; bool allowsShapeInsideInfoSharing() const { return !isInline() && !isFloating(); } - virtual void imageChanged(WrappedImagePtr, const IntRect* = 0) OVERRIDE; protected: virtual void willBeDestroyed(); @@ -655,7 +654,7 @@ private: bool everHadLayout; }; - class FloatingObject { + struct FloatingObject { WTF_MAKE_NONCOPYABLE(FloatingObject); WTF_MAKE_FAST_ALLOCATED; public: // Note that Type uses bits so you can use FloatLeftRight as a mask to query for both left and right. @@ -712,12 +711,12 @@ private: bool isPlaced() const { return m_isPlaced; } void setIsPlaced(bool placed = true) { m_isPlaced = placed; } - LayoutUnit x() const { ASSERT(isPlaced()); return m_frameRect.x(); } - LayoutUnit maxX() const { ASSERT(isPlaced()); return m_frameRect.maxX(); } - LayoutUnit y() const { ASSERT(isPlaced()); return m_frameRect.y(); } - LayoutUnit maxY() const { ASSERT(isPlaced()); return m_frameRect.maxY(); } - LayoutUnit width() const { return m_frameRect.width(); } - LayoutUnit height() const { return m_frameRect.height(); } + inline LayoutUnit x() const { ASSERT(isPlaced()); return m_frameRect.x(); } + inline LayoutUnit maxX() const { ASSERT(isPlaced()); return m_frameRect.maxX(); } + inline LayoutUnit y() const { ASSERT(isPlaced()); return m_frameRect.y(); } + inline LayoutUnit maxY() const { ASSERT(isPlaced()); return m_frameRect.maxY(); } + inline LayoutUnit width() const { return m_frameRect.width(); } + inline LayoutUnit height() const { return m_frameRect.height(); } void setX(LayoutUnit x) { ASSERT(!isInPlacedTree()); m_frameRect.setX(x); } void setY(LayoutUnit y) { ASSERT(!isInPlacedTree()); m_frameRect.setY(y); } @@ -727,9 +726,6 @@ private: const LayoutRect& frameRect() const { ASSERT(isPlaced()); return m_frameRect; } void setFrameRect(const LayoutRect& frameRect) { ASSERT(!isInPlacedTree()); m_frameRect = frameRect; } - int paginationStrut() const { return m_paginationStrut; } - void setPaginationStrut(int strut) { m_paginationStrut = strut; } - #ifndef NDEBUG bool isInPlacedTree() const { return m_isInPlacedTree; } void setIsInPlacedTree(bool value) { m_isInPlacedTree = value; } @@ -740,57 +736,12 @@ private: bool isDescendant() const { return m_isDescendant; } void setIsDescendant(bool isDescendant) { m_isDescendant = isDescendant; } - // FIXME: Callers of these methods are dangerous and should be whitelisted explicitly or removed. - void setRenderer(RenderBox* renderer) { m_renderer = renderer; } - RootInlineBox* originatingLine() const { return m_originatingLine; } - void setOriginatingLine(RootInlineBox* line) { m_originatingLine = line; } - - LayoutUnit logicalTop(bool isHorizontalWritingMode) const { return isHorizontalWritingMode ? y() : x(); } - LayoutUnit logicalBottom(bool isHorizontalWritingMode) const { return isHorizontalWritingMode ? maxY() : maxX(); } - LayoutUnit logicalLeft(bool isHorizontalWritingMode) const { return isHorizontalWritingMode ? x() : y(); } - LayoutUnit logicalRight(bool isHorizontalWritingMode) const { return isHorizontalWritingMode ? maxX() : maxY(); } - LayoutUnit logicalWidth(bool isHorizontalWritingMode) const { return isHorizontalWritingMode ? width() : height(); } - - int pixelSnappedLogicalTop(bool isHorizontalWritingMode) const { return isHorizontalWritingMode ? frameRect().pixelSnappedY() : frameRect().pixelSnappedX(); } - int pixelSnappedLogicalBottom(bool isHorizontalWritingMode) const { return isHorizontalWritingMode ? frameRect().pixelSnappedMaxY() : frameRect().pixelSnappedMaxX(); } - int pixelSnappedLogicalLeft(bool isHorizontalWritingMode) const { return isHorizontalWritingMode ? frameRect().pixelSnappedX() : frameRect().pixelSnappedY(); } - int pixelSnappedLogicalRight(bool isHorizontalWritingMode) const { return isHorizontalWritingMode ? frameRect().pixelSnappedMaxX() : frameRect().pixelSnappedMaxY(); } - - void setLogicalTop(LayoutUnit logicalTop, bool isHorizontalWritingMode) - { - if (isHorizontalWritingMode) - setY(logicalTop); - else - setX(logicalTop); - } - void setLogicalLeft(LayoutUnit logicalLeft, bool isHorizontalWritingMode) - { - if (isHorizontalWritingMode) - setX(logicalLeft); - else - setY(logicalLeft); - } - void setLogicalHeight(LayoutUnit logicalHeight, bool isHorizontalWritingMode) - { - if (isHorizontalWritingMode) - setHeight(logicalHeight); - else - setWidth(logicalHeight); - } - void setLogicalWidth(LayoutUnit logicalWidth, bool isHorizontalWritingMode) - { - if (isHorizontalWritingMode) - setWidth(logicalWidth); - else - setHeight(logicalWidth); - } - - private: RenderBox* m_renderer; RootInlineBox* m_originatingLine; LayoutRect m_frameRect; - int m_paginationStrut; // FIXME: Is this class size-sensitive? Does this need 32-bits? + int m_paginationStrut; + private: unsigned m_type : 2; // Type (left or right aligned) unsigned m_shouldPaint : 1; unsigned m_isDescendant : 1; @@ -802,6 +753,46 @@ private: LayoutPoint flipFloatForWritingModeForChild(const FloatingObject*, const LayoutPoint&) const; + LayoutUnit logicalTopForFloat(const FloatingObject* child) const { return isHorizontalWritingMode() ? child->y() : child->x(); } + LayoutUnit logicalBottomForFloat(const FloatingObject* child) const { return isHorizontalWritingMode() ? child->maxY() : child->maxX(); } + LayoutUnit logicalLeftForFloat(const FloatingObject* child) const { return isHorizontalWritingMode() ? child->x() : child->y(); } + LayoutUnit logicalRightForFloat(const FloatingObject* child) const { return isHorizontalWritingMode() ? child->maxX() : child->maxY(); } + LayoutUnit logicalWidthForFloat(const FloatingObject* child) const { return isHorizontalWritingMode() ? child->width() : child->height(); } + + int pixelSnappedLogicalTopForFloat(const FloatingObject* child) const { return isHorizontalWritingMode() ? child->frameRect().pixelSnappedY() : child->frameRect().pixelSnappedX(); } + int pixelSnappedLogicalBottomForFloat(const FloatingObject* child) const { return isHorizontalWritingMode() ? child->frameRect().pixelSnappedMaxY() : child->frameRect().pixelSnappedMaxX(); } + int pixelSnappedLogicalLeftForFloat(const FloatingObject* child) const { return isHorizontalWritingMode() ? child->frameRect().pixelSnappedX() : child->frameRect().pixelSnappedY(); } + int pixelSnappedLogicalRightForFloat(const FloatingObject* child) const { return isHorizontalWritingMode() ? child->frameRect().pixelSnappedMaxX() : child->frameRect().pixelSnappedMaxY(); } + + void setLogicalTopForFloat(FloatingObject* child, LayoutUnit logicalTop) + { + if (isHorizontalWritingMode()) + child->setY(logicalTop); + else + child->setX(logicalTop); + } + void setLogicalLeftForFloat(FloatingObject* child, LayoutUnit logicalLeft) + { + if (isHorizontalWritingMode()) + child->setX(logicalLeft); + else + child->setY(logicalLeft); + } + void setLogicalHeightForFloat(FloatingObject* child, LayoutUnit logicalHeight) + { + if (isHorizontalWritingMode()) + child->setHeight(logicalHeight); + else + child->setWidth(logicalHeight); + } + void setLogicalWidthForFloat(FloatingObject* child, LayoutUnit logicalWidth) + { + if (isHorizontalWritingMode()) + child->setWidth(logicalWidth); + else + child->setHeight(logicalWidth); + } + LayoutUnit xPositionForFloatIncludingMargin(const FloatingObject* child) const { if (isHorizontalWritingMode()) @@ -1158,13 +1149,13 @@ public: protected: struct FloatingObjectHashFunctions { - static unsigned hash(FloatingObject* key) { return DefaultHash<RenderBox*>::Hash::hash(key->renderer()); } - static bool equal(FloatingObject* a, FloatingObject* b) { return a->renderer() == b->renderer(); } + static unsigned hash(FloatingObject* key) { return DefaultHash<RenderBox*>::Hash::hash(key->m_renderer); } + static bool equal(FloatingObject* a, FloatingObject* b) { return a->m_renderer == b->m_renderer; } static const bool safeToCompareToEmptyOrDeleted = true; }; struct FloatingObjectHashTranslator { static unsigned hash(RenderBox* key) { return DefaultHash<RenderBox*>::Hash::hash(key); } - static bool equal(FloatingObject* a, RenderBox* b) { return a->renderer() == b; } + static bool equal(FloatingObject* a, RenderBox* b) { return a->m_renderer == b; } }; typedef ListHashSet<FloatingObject*, 4, FloatingObjectHashFunctions> FloatingObjectSet; typedef FloatingObjectSet::const_iterator FloatingObjectSetIterator; @@ -1173,39 +1164,46 @@ protected: typedef PODFreeListArena<PODRedBlackTree<FloatingObjectInterval>::Node> IntervalArena; template <FloatingObject::Type FloatTypeValue> - class ComputeFloatOffsetAdapter { + class FloatIntervalSearchAdapter { public: typedef FloatingObjectInterval IntervalType; - ComputeFloatOffsetAdapter(const RenderBlock* renderer, int lineTop, int lineBottom, LayoutUnit& offset) + FloatIntervalSearchAdapter(const RenderBlock* renderer, int lowValue, int highValue, LayoutUnit& offset, LayoutUnit* heightRemaining) : m_renderer(renderer) - , m_lineTop(lineTop) - , m_lineBottom(lineBottom) + , m_lowValue(lowValue) + , m_highValue(highValue) , m_offset(offset) - , m_outermostFloat(0) + , m_heightRemaining(heightRemaining) + , m_last(0) { } - inline int lowValue() const { return m_lineTop; } - inline int highValue() const { return m_lineBottom; } - void collectIfNeeded(const IntervalType&); + inline int lowValue() const { return m_lowValue; } + inline int highValue() const { return m_highValue; } + void collectIfNeeded(const IntervalType&) const; // When computing the offset caused by the floats on a given line, if // the outermost float on that line has a shape-outside, the inline // content that butts up against that float must be positioned using // the contours of the shape, not the margin box of the float. - const FloatingObject* outermostFloat() const { return m_outermostFloat; } - - LayoutUnit getHeightRemaining() const; + // We save the last float encountered so that the offset can be + // computed correctly by the code using this adapter. + const FloatingObject* lastFloat() const { return m_last; } private: - bool updateOffsetIfNeeded(const FloatingObject*); + bool updateOffsetIfNeeded(const FloatingObject*) const; const RenderBlock* m_renderer; - int m_lineTop; - int m_lineBottom; + int m_lowValue; + int m_highValue; LayoutUnit& m_offset; - const FloatingObject* m_outermostFloat; + LayoutUnit* m_heightRemaining; + // This member variable is mutable because the collectIfNeeded method + // is declared as const, even though it doesn't actually respect that + // contract. It modifies other member variables via loopholes in the + // const behavior. Instead of using loopholes, I decided it was better + // to make the fact that this is modified in a const method explicit. + mutable const FloatingObject* m_last; }; void createFloatingObjects(); @@ -1215,8 +1213,6 @@ public: class FloatingObjects { WTF_MAKE_NONCOPYABLE(FloatingObjects); WTF_MAKE_FAST_ALLOCATED; public: - ~FloatingObjects(); - void clear(); void add(FloatingObject*); void remove(FloatingObject*); @@ -1232,7 +1228,6 @@ public: computePlacedFloatsTreeIfNeeded(); return m_placedFloatsTree; } - void clearLineBoxTreePointers(); private: FloatingObjects(const RenderBlock*, bool horizontalWritingMode); void computePlacedFloatsTree(); diff --git a/chromium/third_party/WebKit/Source/core/rendering/RenderBlockLineLayout.cpp b/chromium/third_party/WebKit/Source/core/rendering/RenderBlockLineLayout.cpp index cbe77432e6a..f16fcb63493 100644 --- a/chromium/third_party/WebKit/Source/core/rendering/RenderBlockLineLayout.cpp +++ b/chromium/third_party/WebKit/Source/core/rendering/RenderBlockLineLayout.cpp @@ -161,7 +161,7 @@ inline void LineWidth::updateAvailableWidth(LayoutUnit replacedHeight) inline void LineWidth::shrinkAvailableWidthForNewFloatIfNeeded(RenderBlock::FloatingObject* newFloat) { LayoutUnit height = m_block->logicalHeight(); - if (height < newFloat->logicalTop(m_block->isHorizontalWritingMode()) || height >= newFloat->logicalBottom(m_block->isHorizontalWritingMode())) + if (height < m_block->logicalTopForFloat(newFloat) || height >= m_block->logicalBottomForFloat(newFloat)) return; // When floats with shape outside are stacked, the floats are positioned based on the margin box of the float, @@ -179,7 +179,7 @@ inline void LineWidth::shrinkAvailableWidthForNewFloatIfNeeded(RenderBlock::Floa if (previousFloat != newFloat && previousFloat->type() == newFloat->type()) { previousShapeOutsideInfo = previousFloat->renderer()->shapeOutsideInfo(); if (previousShapeOutsideInfo) { - previousShapeOutsideInfo->computeSegmentsForContainingBlockLine(m_block->logicalHeight(), previousFloat->logicalTop(m_block->isHorizontalWritingMode()), logicalHeightForLine(m_block, m_isFirstLine)); + previousShapeOutsideInfo->computeSegmentsForContainingBlockLine(m_block->logicalHeight(), m_block->logicalTopForFloat(previousFloat), logicalHeightForLine(m_block, m_isFirstLine)); } break; } @@ -187,10 +187,10 @@ inline void LineWidth::shrinkAvailableWidthForNewFloatIfNeeded(RenderBlock::Floa ShapeOutsideInfo* shapeOutsideInfo = newFloat->renderer()->shapeOutsideInfo(); if (shapeOutsideInfo) - shapeOutsideInfo->computeSegmentsForContainingBlockLine(m_block->logicalHeight(), newFloat->logicalTop(m_block->isHorizontalWritingMode()), logicalHeightForLine(m_block, m_isFirstLine)); + shapeOutsideInfo->computeSegmentsForContainingBlockLine(m_block->logicalHeight(), m_block->logicalTopForFloat(newFloat), logicalHeightForLine(m_block, m_isFirstLine)); if (newFloat->type() == RenderBlock::FloatingObject::FloatLeft) { - float newLeft = newFloat->logicalRight(m_block->isHorizontalWritingMode()); + float newLeft = m_block->logicalRightForFloat(newFloat); if (previousShapeOutsideInfo) newLeft -= previousShapeOutsideInfo->rightSegmentMarginBoxDelta(); if (shapeOutsideInfo) @@ -200,7 +200,7 @@ inline void LineWidth::shrinkAvailableWidthForNewFloatIfNeeded(RenderBlock::Floa newLeft += floorToInt(m_block->textIndentOffset()); m_left = max<float>(m_left, newLeft); } else { - float newRight = newFloat->logicalLeft(m_block->isHorizontalWritingMode()); + float newRight = m_block->logicalLeftForFloat(newFloat); if (previousShapeOutsideInfo) newRight -= previousShapeOutsideInfo->leftSegmentMarginBoxDelta(); if (shapeOutsideInfo) @@ -1226,8 +1226,8 @@ inline BidiRun* RenderBlock::handleTrailingSpaces(BidiRunList<BidiRun>& bidiRuns void RenderBlock::appendFloatingObjectToLastLine(FloatingObject* floatingObject) { - ASSERT(!floatingObject->originatingLine()); - floatingObject->setOriginatingLine(lastRootBox()); + ASSERT(!floatingObject->m_originatingLine); + floatingObject->m_originatingLine = lastRootBox(); lastRootBox()->appendFloat(floatingObject->renderer()); } @@ -1881,7 +1881,7 @@ void RenderBlock::layoutRunsAndFloatsInRange(LineLayoutState& layoutState, Inlin for (; it != end; ++it) { FloatingObject* f = *it; appendFloatingObjectToLastLine(f); - ASSERT(f->renderer() == layoutState.floats()[layoutState.floatIndex()].object); + ASSERT(f->m_renderer == layoutState.floats()[layoutState.floatIndex()].object); // If a float's geometry has changed, give up on syncing with clean lines. if (layoutState.floats()[layoutState.floatIndex()].rect != f->frameRect()) checkForEndLineMatch = false; @@ -1975,8 +1975,8 @@ void RenderBlock::linkToEndLineIfNeeded(LineLayoutState& layoutState) Vector<RenderBox*>::iterator end = cleanLineFloats->end(); for (Vector<RenderBox*>::iterator f = cleanLineFloats->begin(); f != end; ++f) { FloatingObject* floatingObject = insertFloatingObject(*f); - ASSERT(!floatingObject->originatingLine()); - floatingObject->setOriginatingLine(line); + ASSERT(!floatingObject->m_originatingLine); + floatingObject->m_originatingLine = line; setLogicalHeight(logicalTopForChild(*f) - marginBeforeForChild(*f) + delta); positionNewFloats(); } @@ -2266,8 +2266,8 @@ RootInlineBox* RenderBlock::determineStartPosition(LineLayoutState& layoutState, Vector<RenderBox*>::iterator end = cleanLineFloats->end(); for (Vector<RenderBox*>::iterator f = cleanLineFloats->begin(); f != end; ++f) { FloatingObject* floatingObject = insertFloatingObject(*f); - ASSERT(!floatingObject->originatingLine()); - floatingObject->setOriginatingLine(line); + ASSERT(!floatingObject->m_originatingLine); + floatingObject->m_originatingLine = line; setLogicalHeight(logicalTopForChild(*f) - marginBeforeForChild(*f)); positionNewFloats(); ASSERT(layoutState.floats()[numCleanFloats].object == *f); @@ -2374,7 +2374,7 @@ bool RenderBlock::checkPaginationAndFloatsAtEndLine(LineLayoutState& layoutState FloatingObjectSetIterator end = floatingObjectSet.end(); for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end; ++it) { FloatingObject* f = *it; - if (f->logicalBottom(isHorizontalWritingMode()) >= logicalTop && f->logicalBottom(isHorizontalWritingMode()) < logicalBottom) + if (logicalBottomForFloat(f) >= logicalTop && logicalBottomForFloat(f) < logicalBottom) return false; } @@ -2832,7 +2832,7 @@ InlineIterator RenderBlock::LineBreaker::nextSegmentBreak(InlineBidiResolver& re // If it does, position it now, otherwise, position // it after moving to next line (in newLine() func) // FIXME: Bug 110372: Properly position multiple stacked floats with non-rectangular shape outside. - if (floatsFitOnLine && width.fitsOnLine(f->logicalWidth(m_block->isHorizontalWritingMode()))) { + if (floatsFitOnLine && width.fitsOnLine(m_block->logicalWidthForFloat(f))) { m_block->positionNewFloatOnLine(f, lastFloatFromPreviousLine, lineInfo, width); if (lBreak.m_obj == current.m_obj) { ASSERT(!lBreak.m_pos); @@ -3401,14 +3401,14 @@ bool RenderBlock::positionNewFloatOnLine(FloatingObject* newFloat, FloatingObjec // We only connect floats to lines for pagination purposes if the floats occur at the start of // the line and the previous line had a hard break (so this line is either the first in the block // or follows a <br>). - if (!newFloat->paginationStrut() || !lineInfo.previousLineBrokeCleanly() || !lineInfo.isEmpty()) + if (!newFloat->m_paginationStrut || !lineInfo.previousLineBrokeCleanly() || !lineInfo.isEmpty()) return true; const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set(); ASSERT(floatingObjectSet.last() == newFloat); - LayoutUnit floatLogicalTop = newFloat->logicalTop(isHorizontalWritingMode()); - int paginationStrut = newFloat->paginationStrut(); + LayoutUnit floatLogicalTop = logicalTopForFloat(newFloat); + int paginationStrut = newFloat->m_paginationStrut; if (floatLogicalTop - paginationStrut != logicalHeight() + lineInfo.floatPaginationStrut()) return true; @@ -3421,18 +3421,18 @@ bool RenderBlock::positionNewFloatOnLine(FloatingObject* newFloat, FloatingObjec FloatingObject* f = *it; if (f == lastFloatFromPreviousLine) break; - if (f->logicalTop(isHorizontalWritingMode()) == logicalHeight() + lineInfo.floatPaginationStrut()) { - f->setPaginationStrut(paginationStrut + f->paginationStrut()); - RenderBox* o = f->renderer(); + if (logicalTopForFloat(f) == logicalHeight() + lineInfo.floatPaginationStrut()) { + f->m_paginationStrut += paginationStrut; + RenderBox* o = f->m_renderer; setLogicalTopForChild(o, logicalTopForChild(o) + marginBeforeForChild(o) + paginationStrut); if (o->isRenderBlock()) toRenderBlock(o)->setChildNeedsLayout(MarkOnlyThis); o->layoutIfNeeded(); // Save the old logical top before calling removePlacedObject which will set // isPlaced to false. Otherwise it will trigger an assert in logicalTopForFloat. - LayoutUnit oldLogicalTop = f->logicalTop(isHorizontalWritingMode()); + LayoutUnit oldLogicalTop = logicalTopForFloat(f); m_floatingObjects->removePlacedObject(f); - f->setLogicalTop(oldLogicalTop + paginationStrut, isHorizontalWritingMode()); + setLogicalTopForFloat(f, oldLogicalTop + paginationStrut); m_floatingObjects->addPlacedObject(f); } } diff --git a/chromium/third_party/WebKit/Source/core/rendering/RenderBox.cpp b/chromium/third_party/WebKit/Source/core/rendering/RenderBox.cpp index 73e76a60597..bb53fd51cde 100644 --- a/chromium/third_party/WebKit/Source/core/rendering/RenderBox.cpp +++ b/chromium/third_party/WebKit/Source/core/rendering/RenderBox.cpp @@ -808,8 +808,6 @@ IntSize RenderBox::calculateAutoscrollDirection(const IntPoint& windowPoint) con IntSize offset; IntPoint point = frameView->windowToContents(windowPoint); IntRect box(absoluteBoundingBoxRect()); - if (isRenderView()) - box.moveBy(frameView->windowToContents(IntPoint())); if (point.x() < box.x() + autoscrollBeltSize) point.move(-autoscrollBeltSize, 0); diff --git a/chromium/third_party/WebKit/Source/core/rendering/RenderGrid.cpp b/chromium/third_party/WebKit/Source/core/rendering/RenderGrid.cpp index 0a753c1dea0..9d0d58990de 100644 --- a/chromium/third_party/WebKit/Source/core/rendering/RenderGrid.cpp +++ b/chromium/third_party/WebKit/Source/core/rendering/RenderGrid.cpp @@ -595,9 +595,6 @@ void RenderGrid::resolveContentBasedTrackSizingFunctionsForItems(TrackSizingDire tracks.append(&track); } - if (tracks.isEmpty()) - return; - LayoutUnit additionalBreadthSpace = (this->*sizingFunction)(gridItem, direction, columnTracks); for (size_t trackIndexForSpace = initialTrackIndex; trackIndexForSpace <= finalTrackIndex; ++trackIndexForSpace) { GridTrack& track = (direction == ForColumns) ? columnTracks[trackIndexForSpace] : rowTracks[trackIndexForSpace]; diff --git a/chromium/third_party/WebKit/Source/core/rendering/RenderImage.cpp b/chromium/third_party/WebKit/Source/core/rendering/RenderImage.cpp index f9be3be4de0..ce48656440e 100644 --- a/chromium/third_party/WebKit/Source/core/rendering/RenderImage.cpp +++ b/chromium/third_party/WebKit/Source/core/rendering/RenderImage.cpp @@ -30,11 +30,11 @@ #include "HTMLNames.h" #include "core/editing/FrameSelection.h" -#include "core/fetch/ImageResource.h" #include "core/html/HTMLAreaElement.h" #include "core/html/HTMLImageElement.h" #include "core/html/HTMLInputElement.h" #include "core/html/HTMLMapElement.h" +#include "core/loader/cache/ImageResource.h" #include "core/page/Frame.h" #include "core/page/Page.h" #include "core/platform/graphics/Font.h" diff --git a/chromium/third_party/WebKit/Source/core/rendering/RenderImageResource.cpp b/chromium/third_party/WebKit/Source/core/rendering/RenderImageResource.cpp index 61301870230..4a38fdd251d 100644 --- a/chromium/third_party/WebKit/Source/core/rendering/RenderImageResource.cpp +++ b/chromium/third_party/WebKit/Source/core/rendering/RenderImageResource.cpp @@ -28,7 +28,7 @@ #include "config.h" #include "core/rendering/RenderImageResource.h" -#include "core/fetch/ImageResource.h" +#include "core/loader/cache/ImageResource.h" #include "core/platform/graphics/Image.h" #include "core/rendering/RenderObject.h" diff --git a/chromium/third_party/WebKit/Source/core/rendering/RenderImageResource.h b/chromium/third_party/WebKit/Source/core/rendering/RenderImageResource.h index 6cffb71841d..d222111e4d2 100644 --- a/chromium/third_party/WebKit/Source/core/rendering/RenderImageResource.h +++ b/chromium/third_party/WebKit/Source/core/rendering/RenderImageResource.h @@ -26,8 +26,8 @@ #ifndef RenderImageResource_h #define RenderImageResource_h -#include "core/fetch/ImageResource.h" -#include "core/fetch/ResourcePtr.h" +#include "core/loader/cache/ImageResource.h" +#include "core/loader/cache/ResourcePtr.h" #include "core/platform/graphics/Image.h" #include "core/platform/graphics/LayoutSize.h" #include "core/rendering/style/StyleImage.h" diff --git a/chromium/third_party/WebKit/Source/core/rendering/RenderImageResourceStyleImage.cpp b/chromium/third_party/WebKit/Source/core/rendering/RenderImageResourceStyleImage.cpp index 9c3b03e8062..ec9023582a4 100644 --- a/chromium/third_party/WebKit/Source/core/rendering/RenderImageResourceStyleImage.cpp +++ b/chromium/third_party/WebKit/Source/core/rendering/RenderImageResourceStyleImage.cpp @@ -28,7 +28,7 @@ #include "config.h" #include "core/rendering/RenderImageResourceStyleImage.h" -#include "core/fetch/ImageResource.h" +#include "core/loader/cache/ImageResource.h" #include "core/rendering/RenderObject.h" #include "core/rendering/style/StyleFetchedImage.h" diff --git a/chromium/third_party/WebKit/Source/core/rendering/RenderLayerBacking.cpp b/chromium/third_party/WebKit/Source/core/rendering/RenderLayerBacking.cpp index 282e6e0568d..c8991f2d933 100644 --- a/chromium/third_party/WebKit/Source/core/rendering/RenderLayerBacking.cpp +++ b/chromium/third_party/WebKit/Source/core/rendering/RenderLayerBacking.cpp @@ -30,11 +30,11 @@ #include "CSSPropertyNames.h" #include "HTMLNames.h" #include "RuntimeEnabledFeatures.h" -#include "core/fetch/ImageResource.h" #include "core/html/HTMLIFrameElement.h" #include "core/html/HTMLMediaElement.h" #include "core/html/canvas/CanvasRenderingContext.h" #include "core/inspector/InspectorInstrumentation.h" +#include "core/loader/cache/ImageResource.h" #include "core/page/Chrome.h" #include "core/page/FrameView.h" #include "core/page/Settings.h" @@ -1708,7 +1708,7 @@ bool RenderLayerBacking::startAnimation(double timeOffset, const CSSAnimationDat for (size_t i = 0; i < numKeyframes; ++i) { const KeyframeValue& currentKeyframe = keyframes[i]; const RenderStyle* keyframeStyle = currentKeyframe.style(); - double key = currentKeyframe.key(); + float key = currentKeyframe.key(); if (!keyframeStyle) continue; diff --git a/chromium/third_party/WebKit/Source/core/rendering/RenderLayerFilterInfo.cpp b/chromium/third_party/WebKit/Source/core/rendering/RenderLayerFilterInfo.cpp index 8a6b4e39b14..abad09d6e25 100644 --- a/chromium/third_party/WebKit/Source/core/rendering/RenderLayerFilterInfo.cpp +++ b/chromium/third_party/WebKit/Source/core/rendering/RenderLayerFilterInfo.cpp @@ -31,8 +31,8 @@ #include "core/rendering/RenderLayerFilterInfo.h" -#include "core/fetch/DocumentResource.h" -#include "core/fetch/DocumentResourceReference.h" +#include "core/loader/cache/DocumentResource.h" +#include "core/loader/cache/DocumentResourceReference.h" #include "core/platform/graphics/filters/custom/CustomFilterOperation.h" #include "core/platform/graphics/filters/custom/CustomFilterProgram.h" #include "core/rendering/FilterEffectRenderer.h" diff --git a/chromium/third_party/WebKit/Source/core/rendering/RenderLayerFilterInfo.h b/chromium/third_party/WebKit/Source/core/rendering/RenderLayerFilterInfo.h index 4e44b3f2f7a..ad29a02d9e2 100644 --- a/chromium/third_party/WebKit/Source/core/rendering/RenderLayerFilterInfo.h +++ b/chromium/third_party/WebKit/Source/core/rendering/RenderLayerFilterInfo.h @@ -31,7 +31,7 @@ #define RenderLayerFilterInfo_h #include "core/dom/Element.h" -#include "core/fetch/DocumentResource.h" +#include "core/loader/cache/DocumentResource.h" #include "core/platform/graphics/LayoutRect.h" #include "core/platform/graphics/filters/FilterOperation.h" #include "core/platform/graphics/filters/custom/CustomFilterProgramClient.h" diff --git a/chromium/third_party/WebKit/Source/core/rendering/RenderListMarker.cpp b/chromium/third_party/WebKit/Source/core/rendering/RenderListMarker.cpp index c2dea3be02e..d63728e4514 100644 --- a/chromium/third_party/WebKit/Source/core/rendering/RenderListMarker.cpp +++ b/chromium/third_party/WebKit/Source/core/rendering/RenderListMarker.cpp @@ -26,7 +26,7 @@ #include "core/rendering/RenderListMarker.h" #include "core/dom/Document.h" -#include "core/fetch/ImageResource.h" +#include "core/loader/cache/ImageResource.h" #include "core/platform/graphics/Font.h" #include "core/platform/graphics/GraphicsContextStateSaver.h" #include "core/rendering/RenderLayer.h" diff --git a/chromium/third_party/WebKit/Source/core/rendering/RenderObject.cpp b/chromium/third_party/WebKit/Source/core/rendering/RenderObject.cpp index 1e4bafeefd2..58bbf327ced 100644 --- a/chromium/third_party/WebKit/Source/core/rendering/RenderObject.cpp +++ b/chromium/third_party/WebKit/Source/core/rendering/RenderObject.cpp @@ -673,11 +673,10 @@ static inline bool objectIsRelayoutBoundary(const RenderObject* object) return true; } -void RenderObject::markContainingBlocksForLayout(bool scheduleRelayout, RenderObject* newRoot, SubtreeLayoutScope* layouter) +void RenderObject::markContainingBlocksForLayout(bool scheduleRelayout, RenderObject* newRoot) { ASSERT(!scheduleRelayout || !newRoot); ASSERT(!isSetNeedsLayoutForbidden()); - ASSERT(!layouter || this != layouter->root()); RenderObject* object = container(); RenderObject* last = this; @@ -723,12 +722,6 @@ void RenderObject::markContainingBlocksForLayout(bool scheduleRelayout, RenderOb ASSERT(!object->isSetNeedsLayoutForbidden()); } - if (layouter) { - layouter->addRendererToLayout(object); - if (object == layouter->root()) - return; - } - if (object == newRoot) return; @@ -1128,7 +1121,7 @@ void RenderObject::drawLineForBoxSide(GraphicsContext* graphicsContext, int x1, void RenderObject::paintFocusRing(PaintInfo& paintInfo, const LayoutPoint& paintOffset, RenderStyle* style) { Vector<IntRect> focusRingRects; - addFocusRingRects(focusRingRects, paintOffset, paintInfo.paintContainer()); + addFocusRingRects(focusRingRects, paintOffset, paintInfo.paintContainer); if (style->outlineStyleIsAuto()) paintInfo.context->drawFocusRing(focusRingRects, style->outlineWidth(), style->outlineOffset(), resolveColor(style, CSSPropertyOutlineColor)); else @@ -1871,8 +1864,6 @@ void RenderObject::setStyle(PassRefPtr<RenderStyle> style) updateImage(oldStyle ? oldStyle->borderImage().image() : 0, m_style ? m_style->borderImage().image() : 0); updateImage(oldStyle ? oldStyle->maskBoxImage().image() : 0, m_style ? m_style->maskBoxImage().image() : 0); - updateShapeImage(oldStyle ? oldStyle->shapeInside() : 0, m_style ? m_style->shapeInside() : 0); - // We need to ensure that view->maximalOutlineSize() is valid for any repaints that happen // during styleDidChange (it's used by clippedOverflowRectForRepaint()). if (m_style->outlineWidth() > 0 && m_style->outlineSize() > maximalOutlineSize(PaintPhaseOutline)) @@ -2114,12 +2105,6 @@ void RenderObject::updateImage(StyleImage* oldImage, StyleImage* newImage) } } -void RenderObject::updateShapeImage(const ShapeValue* oldShapeValue, const ShapeValue* newShapeValue) -{ - if (oldShapeValue || newShapeValue) - updateImage(oldShapeValue ? oldShapeValue->image() : 0, newShapeValue ? newShapeValue->image() : 0); -} - LayoutRect RenderObject::viewRect() const { return view()->viewRect(); @@ -2671,14 +2656,6 @@ void RenderObject::destroyAndCleanupAnonymousWrappers() // WARNING: |this| is deleted here. } -void RenderObject::removeShapeImageClient(ShapeValue* shapeValue) -{ - if (!shapeValue) - return; - if (StyleImage* shapeImage = shapeValue->image()) - shapeImage->removeClient(this); -} - void RenderObject::destroy() { willBeDestroyed(); @@ -2704,8 +2681,6 @@ void RenderObject::postDestroy() if (StyleImage* maskBoxImage = m_style->maskBoxImage().image()) maskBoxImage->removeClient(this); - - removeShapeImageClient(m_style->shapeInside()); } delete this; diff --git a/chromium/third_party/WebKit/Source/core/rendering/RenderObject.h b/chromium/third_party/WebKit/Source/core/rendering/RenderObject.h index 451e9587e61..4d34112f885 100644 --- a/chromium/third_party/WebKit/Source/core/rendering/RenderObject.h +++ b/chromium/third_party/WebKit/Source/core/rendering/RenderObject.h @@ -29,14 +29,13 @@ #include "core/dom/DocumentStyleSheetCollection.h" #include "core/dom/Element.h" #include "core/dom/Position.h" -#include "core/fetch/ImageResourceClient.h" +#include "core/loader/cache/ImageResourceClient.h" #include "core/platform/graphics/FloatQuad.h" #include "core/platform/graphics/LayoutRect.h" #include "core/platform/graphics/transforms/TransformationMatrix.h" #include "core/rendering/PaintPhase.h" #include "core/rendering/RenderObjectChildList.h" #include "core/rendering/ScrollBehavior.h" -#include "core/rendering/SubtreeLayoutScope.h" #include "core/rendering/style/RenderStyle.h" #include "core/rendering/style/StyleInheritedData.h" #include "wtf/HashSet.h" @@ -622,10 +621,10 @@ public: Element* offsetParent() const; - void markContainingBlocksForLayout(bool scheduleRelayout = true, RenderObject* newRoot = 0, SubtreeLayoutScope* = 0); - void setNeedsLayout(MarkingBehavior = MarkContainingBlockChain, SubtreeLayoutScope* = 0); + void markContainingBlocksForLayout(bool scheduleRelayout = true, RenderObject* newRoot = 0); + void setNeedsLayout(MarkingBehavior = MarkContainingBlockChain); void clearNeedsLayout(); - void setChildNeedsLayout(MarkingBehavior = MarkContainingBlockChain, SubtreeLayoutScope* = 0); + void setChildNeedsLayout(MarkingBehavior = MarkContainingBlockChain); void setNeedsPositionedMovementLayout(); void setNeedsSimplifiedNormalFlowLayout(); void setPreferredLogicalWidthsDirty(bool, MarkingBehavior = MarkContainingBlockChain); @@ -664,7 +663,6 @@ public: void updateFillImages(const FillLayer*, const FillLayer*); void updateImage(StyleImage*, StyleImage*); - void updateShapeImage(const ShapeValue*, const ShapeValue*); virtual void paint(PaintInfo&, const LayoutPoint&); @@ -1072,8 +1070,6 @@ private: return styleColor; } - void removeShapeImageClient(ShapeValue*); - #ifndef NDEBUG void checkBlockPositionedObjectsNeedLayout(); #endif @@ -1244,14 +1240,14 @@ inline bool RenderObject::isBeforeOrAfterContent() const return isBeforeContent() || isAfterContent(); } -inline void RenderObject::setNeedsLayout(MarkingBehavior markParents, SubtreeLayoutScope* layouter) +inline void RenderObject::setNeedsLayout(MarkingBehavior markParents) { ASSERT(!isSetNeedsLayoutForbidden()); bool alreadyNeededLayout = m_bitfields.needsLayout(); m_bitfields.setNeedsLayout(true); if (!alreadyNeededLayout) { - if (markParents == MarkContainingBlockChain && (!layouter || layouter->root() != this)) - markContainingBlocksForLayout(true, 0, layouter); + if (markParents == MarkContainingBlockChain) + markContainingBlocksForLayout(); if (hasLayer()) setLayerNeedsFullRepaint(); } @@ -1271,14 +1267,13 @@ inline void RenderObject::clearNeedsLayout() #endif } -inline void RenderObject::setChildNeedsLayout(MarkingBehavior markParents, SubtreeLayoutScope* layouter) +inline void RenderObject::setChildNeedsLayout(MarkingBehavior markParents) { ASSERT(!isSetNeedsLayoutForbidden()); bool alreadyNeededLayout = normalChildNeedsLayout(); setNormalChildNeedsLayout(true); - // FIXME: Replace MarkOnlyThis with the SubtreeLayoutScope code path and remove the MarkingBehavior argument entirely. - if (!alreadyNeededLayout && markParents == MarkContainingBlockChain && (!layouter || layouter->root() != this)) - markContainingBlocksForLayout(true, 0, layouter); + if (!alreadyNeededLayout && markParents == MarkContainingBlockChain) + markContainingBlocksForLayout(); } inline void RenderObject::setNeedsPositionedMovementLayout() diff --git a/chromium/third_party/WebKit/Source/core/rendering/RenderSearchField.cpp b/chromium/third_party/WebKit/Source/core/rendering/RenderSearchField.cpp index ab322b8902a..4e4244c7b7f 100644 --- a/chromium/third_party/WebKit/Source/core/rendering/RenderSearchField.cpp +++ b/chromium/third_party/WebKit/Source/core/rendering/RenderSearchField.cpp @@ -24,7 +24,6 @@ #include "config.h" #include "core/rendering/RenderSearchField.h" -#include "core/dom/shadow/ShadowRoot.h" #include "core/html/HTMLInputElement.h" #include "core/html/shadow/ShadowElementNames.h" @@ -48,12 +47,12 @@ RenderSearchField::~RenderSearchField() inline Element* RenderSearchField::searchDecorationElement() const { - return inputElement()->userAgentShadowRoot()->getElementById(ShadowElementNames::searchDecoration()); + return inputElement()->uaShadowElementById(ShadowElementNames::searchDecoration()); } inline Element* RenderSearchField::cancelButtonElement() const { - return inputElement()->userAgentShadowRoot()->getElementById(ShadowElementNames::clearButton()); + return inputElement()->uaShadowElementById(ShadowElementNames::clearButton()); } LayoutUnit RenderSearchField::computeControlLogicalHeight(LayoutUnit lineHeight, LayoutUnit nonContentHeight) const diff --git a/chromium/third_party/WebKit/Source/core/rendering/RenderTable.cpp b/chromium/third_party/WebKit/Source/core/rendering/RenderTable.cpp index 7ea9fa2f72d..12ea553e69d 100644 --- a/chromium/third_party/WebKit/Source/core/rendering/RenderTable.cpp +++ b/chromium/third_party/WebKit/Source/core/rendering/RenderTable.cpp @@ -40,7 +40,6 @@ #include "core/rendering/RenderTableCol.h" #include "core/rendering/RenderTableSection.h" #include "core/rendering/RenderView.h" -#include "core/rendering/SubtreeLayoutScope.h" #include "core/rendering/style/CollapsedBorderValue.h" #include "core/rendering/style/StyleInheritedData.h" @@ -423,11 +422,9 @@ void RenderTable::layout() LayoutUnit oldLogicalWidth = logicalWidth(); updateLogicalWidth(); - SubtreeLayoutScope layouter(this); - if (logicalWidth() != oldLogicalWidth) { for (unsigned i = 0; i < m_captions.size(); i++) - layouter.setNeedsLayout(m_captions[i]); + m_captions[i]->setNeedsLayout(MarkOnlyThis); } // FIXME: The optimisation below doesn't work since the internal table // layout could have changed. we need to add a flag to the table @@ -447,7 +444,7 @@ void RenderTable::layout() if (child->isTableSection()) { RenderTableSection* section = toRenderTableSection(child); if (m_columnLogicalWidthChanged) - layouter.setChildNeedsLayout(section); + section->setChildNeedsLayout(MarkOnlyThis); section->layoutIfNeeded(); totalSectionLogicalHeight += section->calcRowLogicalHeight(); if (collapsing) diff --git a/chromium/third_party/WebKit/Source/core/rendering/RenderTableCell.cpp b/chromium/third_party/WebKit/Source/core/rendering/RenderTableCell.cpp index 25ae144ebb6..b67203d5d16 100644 --- a/chromium/third_party/WebKit/Source/core/rendering/RenderTableCell.cpp +++ b/chromium/third_party/WebKit/Source/core/rendering/RenderTableCell.cpp @@ -34,7 +34,6 @@ #include "core/rendering/PaintInfo.h" #include "core/rendering/RenderTableCol.h" #include "core/rendering/RenderView.h" -#include "core/rendering/SubtreeLayoutScope.h" #include "core/rendering/style/CollapsedBorderValue.h" using namespace std; @@ -163,7 +162,7 @@ void RenderTableCell::computePreferredLogicalWidths() } } -void RenderTableCell::computeIntrinsicPadding(int rowHeight, SubtreeLayoutScope& layouter) +void RenderTableCell::computeIntrinsicPadding(int rowHeight) { int oldIntrinsicPaddingBefore = intrinsicPaddingBefore(); int oldIntrinsicPaddingAfter = intrinsicPaddingAfter(); @@ -201,19 +200,20 @@ void RenderTableCell::computeIntrinsicPadding(int rowHeight, SubtreeLayoutScope& // FIXME: Changing an intrinsic padding shouldn't trigger a relayout as it only shifts the cell inside the row but // doesn't change the logical height. if (intrinsicPaddingBefore != oldIntrinsicPaddingBefore || intrinsicPaddingAfter != oldIntrinsicPaddingAfter) - layouter.setNeedsLayout(this); + setNeedsLayout(MarkOnlyThis); } void RenderTableCell::updateLogicalWidth() { } -void RenderTableCell::setCellLogicalWidth(int tableLayoutLogicalWidth, SubtreeLayoutScope& layouter) +void RenderTableCell::setCellLogicalWidth(int tableLayoutLogicalWidth) { if (tableLayoutLogicalWidth == logicalWidth()) return; - layouter.setNeedsLayout(this); + setNeedsLayout(MarkOnlyThis); + row()->setChildNeedsLayout(MarkOnlyThis); if (!table()->selfNeedsLayout() && checkForRepaintDuringLayout()) repaint(); @@ -224,8 +224,6 @@ void RenderTableCell::setCellLogicalWidth(int tableLayoutLogicalWidth, SubtreeLa void RenderTableCell::layout() { - ASSERT(needsLayout()); - StackStats::LayoutCheckPoint layoutCheckPoint; updateFirstLetter(); @@ -239,8 +237,7 @@ void RenderTableCell::layout() if (isBaselineAligned() && section()->rowBaseline(rowIndex()) && cellBaselinePosition() > section()->rowBaseline(rowIndex())) { int newIntrinsicPaddingBefore = max<LayoutUnit>(0, intrinsicPaddingBefore() - max<LayoutUnit>(0, cellBaselinePosition() - oldCellBaseline)); setIntrinsicPaddingBefore(newIntrinsicPaddingBefore); - SubtreeLayoutScope layouter(this); - layouter.setNeedsLayout(this); + setNeedsLayout(MarkOnlyThis); layoutBlock(cellWidthChanged()); } diff --git a/chromium/third_party/WebKit/Source/core/rendering/RenderTableCell.h b/chromium/third_party/WebKit/Source/core/rendering/RenderTableCell.h index 9a0da52dfc8..14dac6000f4 100644 --- a/chromium/third_party/WebKit/Source/core/rendering/RenderTableCell.h +++ b/chromium/third_party/WebKit/Source/core/rendering/RenderTableCell.h @@ -35,8 +35,6 @@ static const unsigned maxColumnIndex = 0x1FFFFFFE; // 536,870,910 enum IncludeBorderColorOrNot { DoNotIncludeBorderColor, IncludeBorderColor }; -class SubtreeLayoutScope; - class RenderTableCell FINAL : public RenderBlock { public: explicit RenderTableCell(Element*); @@ -105,7 +103,7 @@ public: } - void setCellLogicalWidth(int constrainedLogicalWidth, SubtreeLayoutScope&); + void setCellLogicalWidth(int constrainedLogicalWidth); virtual int borderLeft() const; virtual int borderRight() const; @@ -133,7 +131,7 @@ public: return va == BASELINE || va == TEXT_BOTTOM || va == TEXT_TOP || va == SUPER || va == SUB || va == LENGTH; } - void computeIntrinsicPadding(int rowHeight, SubtreeLayoutScope&); + void computeIntrinsicPadding(int rowHeight); void clearIntrinsicPadding() { setIntrinsicPadding(0, 0); } int intrinsicPaddingBefore() const { return m_intrinsicPaddingBefore; } diff --git a/chromium/third_party/WebKit/Source/core/rendering/RenderTableCol.cpp b/chromium/third_party/WebKit/Source/core/rendering/RenderTableCol.cpp index 4831a49e1d6..ce0dd03491f 100644 --- a/chromium/third_party/WebKit/Source/core/rendering/RenderTableCol.cpp +++ b/chromium/third_party/WebKit/Source/core/rendering/RenderTableCol.cpp @@ -28,6 +28,7 @@ #include "HTMLNames.h" #include "core/html/HTMLTableColElement.h" +#include "core/loader/cache/ImageResource.h" #include "core/rendering/RenderTable.h" #include "core/rendering/RenderTableCell.h" diff --git a/chromium/third_party/WebKit/Source/core/rendering/RenderTableRow.cpp b/chromium/third_party/WebKit/Source/core/rendering/RenderTableRow.cpp index dc1d16c8f0b..3fae9224901 100644 --- a/chromium/third_party/WebKit/Source/core/rendering/RenderTableRow.cpp +++ b/chromium/third_party/WebKit/Source/core/rendering/RenderTableRow.cpp @@ -27,12 +27,11 @@ #include "HTMLNames.h" #include "core/dom/Document.h" -#include "core/fetch/ImageResource.h" +#include "core/loader/cache/ImageResource.h" #include "core/rendering/HitTestResult.h" #include "core/rendering/PaintInfo.h" #include "core/rendering/RenderTableCell.h" #include "core/rendering/RenderView.h" -#include "core/rendering/SubtreeLayoutScope.h" #include "core/rendering/style/StyleInheritedData.h" namespace WebCore { @@ -85,7 +84,7 @@ void RenderTableRow::styleDidChange(StyleDifference diff, const RenderStyle* old for (RenderBox* childBox = firstChildBox(); childBox; childBox = childBox->nextSiblingBox()) { if (!childBox->isTableCell()) continue; - childBox->setChildNeedsLayout(); + childBox->setChildNeedsLayout(MarkOnlyThis); } } } @@ -166,10 +165,9 @@ void RenderTableRow::layout() for (RenderObject* child = firstChild(); child; child = child->nextSibling()) { if (child->isTableCell()) { - SubtreeLayoutScope layouter(child); RenderTableCell* cell = toRenderTableCell(child); if (!cell->needsLayout() && paginated && view()->layoutState()->pageLogicalHeight() && view()->layoutState()->pageLogicalOffset(cell, cell->logicalTop()) != cell->pageLogicalOffset()) - layouter.setChildNeedsLayout(cell); + cell->setChildNeedsLayout(MarkOnlyThis); if (child->needsLayout()) { cell->computeAndSetBlockDirectionMargins(table()); diff --git a/chromium/third_party/WebKit/Source/core/rendering/RenderTableSection.cpp b/chromium/third_party/WebKit/Source/core/rendering/RenderTableSection.cpp index d55550b194e..80938ccfce4 100644 --- a/chromium/third_party/WebKit/Source/core/rendering/RenderTableSection.cpp +++ b/chromium/third_party/WebKit/Source/core/rendering/RenderTableSection.cpp @@ -35,7 +35,6 @@ #include "core/rendering/RenderTableCol.h" #include "core/rendering/RenderTableRow.h" #include "core/rendering/RenderView.h" -#include "core/rendering/SubtreeLayoutScope.h" #include "wtf/HashSet.h" #include "wtf/Vector.h" @@ -613,7 +612,6 @@ void RenderTableSection::layout() const Vector<int>& columnPos = table()->columnPositions(); - SubtreeLayoutScope layouter(this); for (unsigned r = 0; r < m_grid.size(); ++r) { Row& row = m_grid[r].row; unsigned cols = row.size(); @@ -633,7 +631,7 @@ void RenderTableSection::layout() endCol++; } int tableLayoutLogicalWidth = columnPos[endCol] - columnPos[startColumn] - table()->hBorderSpacing(); - cell->setCellLogicalWidth(tableLayoutLogicalWidth, layouter); + cell->setCellLogicalWidth(tableLayoutLogicalWidth); } if (RenderTableRow* rowRenderer = m_grid[r].rowRenderer) @@ -738,11 +736,6 @@ int RenderTableSection::distributeExtraLogicalHeightToRows(int extraLogicalHeigh return extraLogicalHeight - remainingExtraLogicalHeight; } -static bool shouldFlexCellChild(RenderObject* cellDescendant) -{ - return cellDescendant->isReplaced() || (cellDescendant->isBox() && toRenderBox(cellDescendant)->scrollsOverflow()); -} - void RenderTableSection::layoutRows() { #ifndef NDEBUG @@ -802,24 +795,33 @@ void RenderTableSection::layoutRows() bool flexAllChildren = cell->style()->logicalHeight().isFixed() || (!table()->style()->logicalHeight().isAuto() && rHeight != cell->logicalHeight()); - for (RenderObject* child = cell->firstChild(); child; child = child->nextSibling()) { - if (!child->isText() && child->style()->logicalHeight().isPercent() - && (flexAllChildren || shouldFlexCellChild(child)) - && (!child->isTable() || toRenderTable(child)->hasSections())) { - cellChildrenFlex = true; - break; + for (RenderObject* o = cell->firstChild(); o; o = o->nextSibling()) { + if (!o->isText() && o->style()->logicalHeight().isPercent() && (flexAllChildren || o->isReplaced() || (o->isBox() && toRenderBox(o)->scrollsOverflow()))) { + // Tables with no sections do not flex. + if (!o->isTable() || toRenderTable(o)->hasSections()) { + o->setNeedsLayout(MarkOnlyThis); + cellChildrenFlex = true; + } } } - if (!cellChildrenFlex) { - if (TrackedRendererListHashSet* percentHeightDescendants = cell->percentHeightDescendants()) { - TrackedRendererListHashSet::iterator end = percentHeightDescendants->end(); - for (TrackedRendererListHashSet::iterator it = percentHeightDescendants->begin(); it != end; ++it) { - if (flexAllChildren || shouldFlexCellChild(*it)) { - cellChildrenFlex = true; + if (TrackedRendererListHashSet* percentHeightDescendants = cell->percentHeightDescendants()) { + TrackedRendererListHashSet::iterator end = percentHeightDescendants->end(); + for (TrackedRendererListHashSet::iterator it = percentHeightDescendants->begin(); it != end; ++it) { + RenderBox* box = *it; + if (!box->isReplaced() && !box->scrollsOverflow() && !flexAllChildren) + continue; + + while (box != cell) { + if (box->normalChildNeedsLayout()) + break; + box->setChildNeedsLayout(MarkOnlyThis); + box = box->containingBlock(); + ASSERT(box); + if (!box) break; - } } + cellChildrenFlex = true; } } @@ -838,15 +840,14 @@ void RenderTableSection::layoutRows() } } - SubtreeLayoutScope layouter(cell); - cell->computeIntrinsicPadding(rHeight, layouter); + cell->computeIntrinsicPadding(rHeight); LayoutRect oldCellRect = cell->frameRect(); setLogicalPositionForCell(cell, c); if (!cell->needsLayout() && view()->layoutState()->pageLogicalHeight() && view()->layoutState()->pageLogicalOffset(cell, cell->logicalTop()) != cell->pageLogicalOffset()) - layouter.setChildNeedsLayout(cell); + cell->setChildNeedsLayout(MarkOnlyThis); cell->layoutIfNeeded(); diff --git a/chromium/third_party/WebKit/Source/core/rendering/SubtreeLayoutScope.cpp b/chromium/third_party/WebKit/Source/core/rendering/SubtreeLayoutScope.cpp deleted file mode 100644 index c3bfefe745a..00000000000 --- a/chromium/third_party/WebKit/Source/core/rendering/SubtreeLayoutScope.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (C) 2013 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "core/rendering/SubtreeLayoutScope.h" - -#include "core/page/FrameView.h" -#include "core/rendering/RenderObject.h" - -namespace WebCore { - -SubtreeLayoutScope::SubtreeLayoutScope(RenderObject* root) - : m_root(root) -{ - RELEASE_ASSERT(m_root->document()->view()->isInLayout()); -} - -SubtreeLayoutScope::~SubtreeLayoutScope() -{ - RELEASE_ASSERT(!m_root->needsLayout()); - -#ifndef NDEBUG - for (HashSet<RenderObject*>::iterator it = m_renderersToLayout.begin(); it != m_renderersToLayout.end(); ++it) { - RenderObject* renderer = *it; - // FIXME: Thie patter is really common. Move it into an assertRendererLaidOut function. - if (renderer->needsLayout()) - showRenderTree(renderer); - ASSERT(!renderer->needsLayout()); - } -#endif -} - -void SubtreeLayoutScope::setNeedsLayout(RenderObject* descendant) -{ - ASSERT(descendant->isDescendantOf(m_root)); - descendant->setNeedsLayout(MarkContainingBlockChain, this); -} - -void SubtreeLayoutScope::setChildNeedsLayout(RenderObject* descendant) -{ - ASSERT(descendant->isDescendantOf(m_root)); - descendant->setChildNeedsLayout(MarkContainingBlockChain, this); -} - -void SubtreeLayoutScope::addRendererToLayout(RenderObject* renderer) -{ -#ifndef NDEBUG - m_renderersToLayout.add(renderer); -#endif -} - -} diff --git a/chromium/third_party/WebKit/Source/core/rendering/SubtreeLayoutScope.h b/chromium/third_party/WebKit/Source/core/rendering/SubtreeLayoutScope.h deleted file mode 100644 index 792fb7f6a1b..00000000000 --- a/chromium/third_party/WebKit/Source/core/rendering/SubtreeLayoutScope.h +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (C) 2013 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef SubtreeLayoutScope_h -#define SubtreeLayoutScope_h - -#include "wtf/HashSet.h" - -// This is the way to mark a subtree as needing layout during layout, -// e.g. for the purposes of doing a multipass layout. -// -// It should only be used during layout. Outside of layout, you should -// just call renderer->setNeedsLayout() directly. -// -// It ensures that you don't accidentally mark part of the tree as -// needing layout and not actually lay it out. - -// FIXME: Assert that this is only used during layout and that -// MarkOnlyThis is never used outside of layout. - -namespace WebCore { - -class RenderObject; - -class SubtreeLayoutScope { -public: - SubtreeLayoutScope(RenderObject* root); - ~SubtreeLayoutScope(); - - void setNeedsLayout(RenderObject* descendant); - void setChildNeedsLayout(RenderObject* descendant); - - RenderObject* root() { return m_root; } - void addRendererToLayout(RenderObject* renderer); - -private: - RenderObject* m_root; - -#ifndef NDEBUG - HashSet<RenderObject*> m_renderersToLayout; -#endif -}; - -} - -#endif diff --git a/chromium/third_party/WebKit/Source/core/rendering/shapes/RasterShape.cpp b/chromium/third_party/WebKit/Source/core/rendering/shapes/RasterShape.cpp deleted file mode 100644 index a57958071a0..00000000000 --- a/chromium/third_party/WebKit/Source/core/rendering/shapes/RasterShape.cpp +++ /dev/null @@ -1,154 +0,0 @@ -/* - * Copyright (C) 2013 Adobe Systems Incorporated. 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 THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "core/rendering/shapes/RasterShape.h" - -#include "core/rendering/shapes/ShapeInterval.h" -#include "wtf/MathExtras.h" - -namespace WebCore { - -IntRect RasterShapeIntervals::bounds() const -{ - if (!m_bounds) - m_bounds = adoptPtr(new IntRect(m_region.bounds())); - return *m_bounds; -} - -void RasterShapeIntervals::addInterval(int y, int x1, int x2) -{ - m_region.unite(Region(IntRect(x1, y, x2 - x1, 1))); - m_bounds.clear(); -} - -static inline IntRect alignedRect(IntRect r, int y1, int y2) -{ - return IntRect(r.x(), y1, r.width(), y2 - y1); -} - -void RasterShapeIntervals::getIncludedIntervals(int y1, int y2, SegmentList& result) const -{ - ASSERT(y2 >= y1); - - IntRect lineRect(bounds().x(), y1, bounds().width(), y2 - y1); - Region lineRegion(lineRect); - lineRegion.intersect(m_region); - if (lineRegion.isEmpty()) - return; - - Vector<IntRect> lineRects = lineRegion.rects(); - ASSERT(lineRects.size() > 0); - - Region segmentsRegion(lineRect); - Region intervalsRegion; - - // The loop below uses Regions to compute the intersection of the horizontal - // shape intervals that fall within the line's box. - - int lineY = lineRects[0].y(); - for (unsigned i = 0; i < lineRects.size(); ++i) { - if (lineRects[i].y() != lineY) { - segmentsRegion.intersect(intervalsRegion); - intervalsRegion = Region(); - } - intervalsRegion.unite(Region(alignedRect(lineRects[i], y1, y2))); - lineY = lineRects[i].y(); - } - if (!intervalsRegion.isEmpty()) - segmentsRegion.intersect(intervalsRegion); - - Vector<IntRect> segmentRects = segmentsRegion.rects(); - for (unsigned i = 0; i < segmentRects.size(); ++i) - result.append(LineSegment(segmentRects[i].x(), segmentRects[i].maxX())); -} - -const RasterShapeIntervals& RasterShape::marginIntervals() const -{ - ASSERT(shapeMargin() >= 0); - if (!shapeMargin()) - return *m_intervals; - - // FIXME: add support for non-zero margin, see https://code.google.com/p/chromium/issues/detail?id=252737. - return *m_intervals; -} - -const RasterShapeIntervals& RasterShape::paddingIntervals() const -{ - ASSERT(shapePadding() >= 0); - if (!shapePadding()) - return *m_intervals; - - // FIXME: add support for non-zero padding, see https://code.google.com/p/chromium/issues/detail?id=252737. - return *m_intervals; -} - -void RasterShape::getExcludedIntervals(LayoutUnit, LayoutUnit, SegmentList&) const -{ - // FIXME: this method is only a stub, see https://code.google.com/p/chromium/issues/detail?id=252737. -} - -void RasterShape::getIncludedIntervals(LayoutUnit logicalTop, LayoutUnit logicalHeight, SegmentList& result) const -{ - const RasterShapeIntervals& intervals = paddingIntervals(); - if (intervals.isEmpty()) - return; - - float y1 = logicalTop; - float y2 = logicalTop + logicalHeight; - - if (y1 < intervals.bounds().y() || y2 > intervals.bounds().maxY()) - return; - - intervals.getIncludedIntervals(y1, y2, result); -} - -bool RasterShape::firstIncludedIntervalLogicalTop(LayoutUnit minLogicalIntervalTop, const LayoutSize& minLogicalIntervalSize, LayoutUnit& result) const -{ - float minIntervalTop = minLogicalIntervalTop; - float minIntervalHeight = minLogicalIntervalSize.height(); - float minIntervalWidth = minLogicalIntervalSize.width(); - - const RasterShapeIntervals& intervals = paddingIntervals(); - if (intervals.isEmpty() || minIntervalWidth > intervals.bounds().width()) - return false; - - float minY = std::max<float>(intervals.bounds().y(), minIntervalTop); - float maxY = minY + minIntervalHeight; - - if (maxY > intervals.bounds().maxY()) - return false; - - // FIXME: complete this method, see https://code.google.com/p/chromium/issues/detail?id=252737. - - result = minY; - return true; -} - -} // namespace WebCore diff --git a/chromium/third_party/WebKit/Source/core/rendering/shapes/RasterShape.h b/chromium/third_party/WebKit/Source/core/rendering/shapes/RasterShape.h deleted file mode 100644 index 84bed9cf25d..00000000000 --- a/chromium/third_party/WebKit/Source/core/rendering/shapes/RasterShape.h +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (C) 2013 Adobe Systems Incorporated. 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 THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef RasterShape_h -#define RasterShape_h - -#include "core/platform/graphics/FloatRect.h" -#include "core/platform/graphics/Region.h" -#include "core/rendering/shapes/Shape.h" -#include "wtf/Assertions.h" -#include "wtf/Vector.h" - -namespace WebCore { - -class RasterShapeIntervals { -public: - RasterShapeIntervals() { } - - IntRect bounds() const; - bool isEmpty() const { return m_region.isEmpty(); } - void addInterval(int y, int x1, int x2); - void getIncludedIntervals(int y1, int y2, SegmentList&) const; - -private: - Region m_region; - mutable OwnPtr<IntRect> m_bounds; // Cached value of m_region.bounds(). -}; - -class RasterShape : public Shape { - WTF_MAKE_NONCOPYABLE(RasterShape); -public: - RasterShape(PassOwnPtr<RasterShapeIntervals> intervals) - : Shape() - , m_intervals(intervals) - { - } - - virtual LayoutRect shapeMarginLogicalBoundingBox() const OVERRIDE { return static_cast<LayoutRect>(marginIntervals().bounds()); } - virtual LayoutRect shapePaddingLogicalBoundingBox() const OVERRIDE { return static_cast<LayoutRect>(paddingIntervals().bounds()); } - virtual bool isEmpty() const OVERRIDE { return m_intervals->isEmpty(); } - virtual void getExcludedIntervals(LayoutUnit logicalTop, LayoutUnit logicalHeight, SegmentList&) const OVERRIDE; - virtual void getIncludedIntervals(LayoutUnit logicalTop, LayoutUnit logicalHeight, SegmentList&) const OVERRIDE; - virtual bool firstIncludedIntervalLogicalTop(LayoutUnit minLogicalIntervalTop, const LayoutSize& minLogicalIntervalSize, LayoutUnit&) const OVERRIDE; - -private: - const RasterShapeIntervals& marginIntervals() const; - const RasterShapeIntervals& paddingIntervals() const; - - OwnPtr<RasterShapeIntervals> m_intervals; -}; - -} // namespace WebCore - -#endif // RasterShape_h diff --git a/chromium/third_party/WebKit/Source/core/rendering/shapes/Shape.cpp b/chromium/third_party/WebKit/Source/core/rendering/shapes/Shape.cpp index b325c073aa5..60d003bad86 100644 --- a/chromium/third_party/WebKit/Source/core/rendering/shapes/Shape.cpp +++ b/chromium/third_party/WebKit/Source/core/rendering/shapes/Shape.cpp @@ -31,12 +31,9 @@ #include "core/rendering/shapes/Shape.h" #include "core/css/LengthFunctions.h" -#include "core/fetch/ImageResource.h" #include "core/platform/graphics/FloatSize.h" -#include "core/platform/graphics/ImageBuffer.h" #include "core/platform/graphics/WindRule.h" #include "core/rendering/shapes/PolygonShape.h" -#include "core/rendering/shapes/RasterShape.h" #include "core/rendering/shapes/RectangleShape.h" #include "wtf/MathExtras.h" #include "wtf/OwnPtr.h" @@ -201,45 +198,4 @@ PassOwnPtr<Shape> Shape::createShape(const BasicShape* basicShape, const LayoutS return shape.release(); } -PassOwnPtr<Shape> Shape::createShape(const StyleImage* styleImage, float threshold, const LayoutSize&, WritingMode writingMode, Length margin, Length padding) -{ - ASSERT(styleImage && styleImage->isImageResource() && styleImage->cachedImage() && styleImage->cachedImage()->image()); - - OwnPtr<RasterShapeIntervals> intervals = adoptPtr(new RasterShapeIntervals()); - - Image* image = styleImage->cachedImage()->image(); - const IntSize& imageSize = image->size(); - OwnPtr<ImageBuffer> imageBuffer = ImageBuffer::create(imageSize); - if (imageBuffer) { - GraphicsContext* graphicsContext = imageBuffer->context(); - graphicsContext->drawImage(image, IntPoint()); - - RefPtr<Uint8ClampedArray> pixelArray = imageBuffer->getUnmultipliedImageData(IntRect(IntPoint(), imageSize)); - unsigned pixelArrayLength = pixelArray->length(); - unsigned pixelArrayOffset = 3; // Each pixel is four bytes: RGBA. - uint8_t alphaPixelThreshold = threshold * 255; - - ASSERT(static_cast<unsigned>(imageSize.width() * imageSize.height() * 4) == pixelArrayLength); - - for (int y = 0; y < imageSize.height(); ++y) { - int startX = -1; - for (int x = 0; x < imageSize.width() && pixelArrayOffset < pixelArrayLength; ++x, pixelArrayOffset += 4) { - uint8_t alpha = pixelArray->item(pixelArrayOffset); - if ((startX == -1) && alpha > alphaPixelThreshold) { - startX = x; - } else if (startX != -1 && (alpha <= alphaPixelThreshold || x == imageSize.width() - 1)) { - intervals->addInterval(y, startX, x); - startX = -1; - } - } - } - } - - OwnPtr<RasterShape> rasterShape = adoptPtr(new RasterShape(intervals.release())); - rasterShape->m_writingMode = writingMode; - rasterShape->m_margin = floatValueForLength(margin, 0); - rasterShape->m_padding = floatValueForLength(padding, 0); - return rasterShape.release(); -} - } // namespace WebCore diff --git a/chromium/third_party/WebKit/Source/core/rendering/shapes/Shape.h b/chromium/third_party/WebKit/Source/core/rendering/shapes/Shape.h index b1ea954b3fd..6e257c96e54 100644 --- a/chromium/third_party/WebKit/Source/core/rendering/shapes/Shape.h +++ b/chromium/third_party/WebKit/Source/core/rendering/shapes/Shape.h @@ -33,7 +33,6 @@ #include "core/platform/graphics/LayoutRect.h" #include "core/platform/text/WritingMode.h" #include "core/rendering/style/BasicShapes.h" -#include "core/rendering/style/StyleImage.h" #include "wtf/PassOwnPtr.h" #include "wtf/Vector.h" @@ -61,7 +60,6 @@ typedef Vector<LineSegment> SegmentList; class Shape { public: static PassOwnPtr<Shape> createShape(const BasicShape*, const LayoutSize& logicalBoxSize, WritingMode, Length margin, Length padding); - static PassOwnPtr<Shape> createShape(const StyleImage*, float threshold, const LayoutSize& logicalBoxSize, WritingMode, Length margin, Length padding); virtual ~Shape() { } diff --git a/chromium/third_party/WebKit/Source/core/rendering/shapes/ShapeInfo.cpp b/chromium/third_party/WebKit/Source/core/rendering/shapes/ShapeInfo.cpp index 54f97abf40f..78341a38445 100644 --- a/chromium/third_party/WebKit/Source/core/rendering/shapes/ShapeInfo.cpp +++ b/chromium/third_party/WebKit/Source/core/rendering/shapes/ShapeInfo.cpp @@ -41,26 +41,12 @@ const Shape* ShapeInfo<RenderType, shapeGetter, intervalGetter>::computedShape() if (Shape* shape = m_shape.get()) return shape; - const LayoutSize logicalBoxSize(m_shapeLogicalWidth, m_shapeLogicalHeight); - WritingMode writingMode = m_renderer->style()->writingMode(); - Length margin = m_renderer->style()->shapeMargin(); - Length padding = m_renderer->style()->shapePadding(); - const ShapeValue* shapeValue = (m_renderer->style()->*shapeGetter)(); - ASSERT(shapeValue); + ShapeValue* shapeValue = (m_renderer->style()->*shapeGetter)(); + BasicShape* shape = (shapeValue && shapeValue->type() == ShapeValue::Shape) ? shapeValue->shape() : 0; - switch (shapeValue->type()) { - case ShapeValue::Shape: - ASSERT(shapeValue->shape()); - m_shape = Shape::createShape(shapeValue->shape(), logicalBoxSize, writingMode, margin, padding); - break; - case ShapeValue::Image: - ASSERT(shapeValue->image()); - m_shape = Shape::createShape(shapeValue->image(), 0, logicalBoxSize, writingMode, margin, padding); - break; - default: - ASSERT_NOT_REACHED(); - } + ASSERT(shape); + m_shape = Shape::createShape(shape, LayoutSize(m_shapeLogicalWidth, m_shapeLogicalHeight), m_renderer->style()->writingMode(), m_renderer->style()->shapeMargin(), m_renderer->style()->shapePadding()); ASSERT(m_shape); return m_shape.get(); } diff --git a/chromium/third_party/WebKit/Source/core/rendering/shapes/ShapeInsideInfo.cpp b/chromium/third_party/WebKit/Source/core/rendering/shapes/ShapeInsideInfo.cpp index 8c63f6c4d74..01dff4951f8 100644 --- a/chromium/third_party/WebKit/Source/core/rendering/shapes/ShapeInsideInfo.cpp +++ b/chromium/third_party/WebKit/Source/core/rendering/shapes/ShapeInsideInfo.cpp @@ -44,19 +44,11 @@ LineSegmentRange::LineSegmentRange(const InlineIterator& start, const InlineIter bool ShapeInsideInfo::isEnabledFor(const RenderBlock* renderer) { ShapeValue* shapeValue = renderer->style()->resolvedShapeInside(); - if (!shapeValue) + if (!shapeValue || shapeValue->type() != ShapeValue::Shape) return false; - switch (shapeValue->type()) { - case ShapeValue::Shape: - return shapeValue->shape() && shapeValue->shape()->type() != BasicShape::BasicShapeInsetRectangleType; - case ShapeValue::Image: - return shapeValue->isImageValid(); - case ShapeValue::Outside: - return false; - } - - return false; + BasicShape* shape = shapeValue->shape(); + return shape && shape->type() != BasicShape::BasicShapeInsetRectangleType; } bool ShapeInsideInfo::adjustLogicalLineTop(float minSegmentWidth) diff --git a/chromium/third_party/WebKit/Source/core/rendering/shapes/ShapeOutsideInfo.cpp b/chromium/third_party/WebKit/Source/core/rendering/shapes/ShapeOutsideInfo.cpp index ed58e303568..76f52ddc461 100644 --- a/chromium/third_party/WebKit/Source/core/rendering/shapes/ShapeOutsideInfo.cpp +++ b/chromium/third_party/WebKit/Source/core/rendering/shapes/ShapeOutsideInfo.cpp @@ -35,20 +35,8 @@ namespace WebCore { bool ShapeOutsideInfo::isEnabledFor(const RenderBox* box) { - ShapeValue* shapeValue = box->style()->shapeOutside(); - if (!box->isFloatingWithShapeOutside() || !shapeValue) - return false; - - switch (shapeValue->type()) { - case ShapeValue::Shape: - return shapeValue->shape(); - case ShapeValue::Image: - return false; - case ShapeValue::Outside: - return false; - } - - return false; + ShapeValue* value = box->style()->shapeOutside(); + return box->isFloatingWithShapeOutside() && value->type() == ShapeValue::Shape && value->shape(); } bool ShapeOutsideInfo::computeSegmentsForContainingBlockLine(LayoutUnit lineTop, LayoutUnit floatTop, LayoutUnit lineHeight) diff --git a/chromium/third_party/WebKit/Source/core/rendering/style/KeyframeList.cpp b/chromium/third_party/WebKit/Source/core/rendering/style/KeyframeList.cpp index 093d796b6e7..9d20a1c666a 100644 --- a/chromium/third_party/WebKit/Source/core/rendering/style/KeyframeList.cpp +++ b/chromium/third_party/WebKit/Source/core/rendering/style/KeyframeList.cpp @@ -36,7 +36,7 @@ void KeyframeValue::addProperties(const StylePropertySet* propertySet) CSSPropertyID property = propertySet->propertyAt(i).id(); // Timing-function within keyframes is special, because it is not animated; it just // describes the timing function between this keyframe and the next. - if (property != CSSPropertyWebkitAnimationTimingFunction && property != CSSPropertyAnimationTimingFunction) + if (property != CSSPropertyWebkitAnimationTimingFunction) addProperty(property); } } diff --git a/chromium/third_party/WebKit/Source/core/rendering/style/KeyframeList.h b/chromium/third_party/WebKit/Source/core/rendering/style/KeyframeList.h index 4d5e207317b..5a5cf92ec04 100644 --- a/chromium/third_party/WebKit/Source/core/rendering/style/KeyframeList.h +++ b/chromium/third_party/WebKit/Source/core/rendering/style/KeyframeList.h @@ -40,7 +40,7 @@ class StylePropertySet; class KeyframeValue { public: - KeyframeValue(double key, PassRefPtr<RenderStyle> style) + KeyframeValue(float key, PassRefPtr<RenderStyle> style) : m_key(key) , m_style(style) { @@ -51,14 +51,14 @@ public: bool containsProperty(CSSPropertyID prop) const { return m_properties.contains(prop); } const HashSet<CSSPropertyID>& properties() const { return m_properties; } - double key() const { return m_key; } - void setKey(double key) { m_key = key; } + float key() const { return m_key; } + void setKey(float key) { m_key = key; } const RenderStyle* style() const { return m_style.get(); } void setStyle(PassRefPtr<RenderStyle> style) { m_style = style; } private: - double m_key; + float m_key; HashSet<CSSPropertyID> m_properties; // The properties specified in this keyframe. RefPtr<RenderStyle> m_style; }; diff --git a/chromium/third_party/WebKit/Source/core/rendering/style/SVGRenderStyle.cpp b/chromium/third_party/WebKit/Source/core/rendering/style/SVGRenderStyle.cpp index bc5c3399257..4ec55815a8f 100644 --- a/chromium/third_party/WebKit/Source/core/rendering/style/SVGRenderStyle.cpp +++ b/chromium/third_party/WebKit/Source/core/rendering/style/SVGRenderStyle.cpp @@ -169,10 +169,7 @@ StyleDifference SVGRenderStyle::diff(const SVGRenderStyle* other) const || stroke->paintUri != other->stroke->paintUri || stroke->miterLimit != other->stroke->miterLimit || stroke->dashArray != other->stroke->dashArray - || stroke->dashOffset != other->stroke->dashOffset - || stroke->visitedLinkPaintColor != other->stroke->visitedLinkPaintColor - || stroke->visitedLinkPaintUri != other->stroke->visitedLinkPaintUri - || stroke->visitedLinkPaintType != other->stroke->visitedLinkPaintType) + || stroke->dashOffset != other->stroke->dashOffset) return StyleDifferenceLayout; // Only the stroke-opacity case remains, where we only need a repaint. diff --git a/chromium/third_party/WebKit/Source/core/rendering/style/ShapeValue.h b/chromium/third_party/WebKit/Source/core/rendering/style/ShapeValue.h index bb71dab440a..b72d2518665 100644 --- a/chromium/third_party/WebKit/Source/core/rendering/style/ShapeValue.h +++ b/chromium/third_party/WebKit/Source/core/rendering/style/ShapeValue.h @@ -30,7 +30,6 @@ #ifndef ShapeValue_h #define ShapeValue_h -#include "core/fetch/ImageResource.h" #include "core/rendering/style/BasicShapes.h" #include "core/rendering/style/StyleImage.h" #include "wtf/PassRefPtr.h" @@ -63,12 +62,9 @@ public: ShapeValueType type() const { return m_type; } BasicShape* shape() const { return m_shape.get(); } - StyleImage* image() const { return m_image.get(); } - bool isImageValid() const { return image() && image()->cachedImage() && image()->cachedImage()->hasImage(); } void setImage(PassRefPtr<StyleImage> image) { - ASSERT(type() == Image); if (m_image != image) m_image = image; } diff --git a/chromium/third_party/WebKit/Source/core/rendering/style/StyleCustomFilterProgram.h b/chromium/third_party/WebKit/Source/core/rendering/style/StyleCustomFilterProgram.h index 18be011b566..167821769ac 100644 --- a/chromium/third_party/WebKit/Source/core/rendering/style/StyleCustomFilterProgram.h +++ b/chromium/third_party/WebKit/Source/core/rendering/style/StyleCustomFilterProgram.h @@ -30,9 +30,9 @@ #ifndef StyleCustomFilterProgram_h #define StyleCustomFilterProgram_h -#include "core/fetch/ResourceClient.h" -#include "core/fetch/ResourcePtr.h" -#include "core/fetch/ShaderResource.h" +#include "core/loader/cache/ResourceClient.h" +#include "core/loader/cache/ResourcePtr.h" +#include "core/loader/cache/ShaderResource.h" #include "core/platform/graphics/filters/custom/CustomFilterProgram.h" #include "core/rendering/style/StyleShader.h" #include "weborigin/KURL.h" diff --git a/chromium/third_party/WebKit/Source/core/rendering/style/StyleFetchedImage.cpp b/chromium/third_party/WebKit/Source/core/rendering/style/StyleFetchedImage.cpp index 31dc65a0452..e09447510e2 100644 --- a/chromium/third_party/WebKit/Source/core/rendering/style/StyleFetchedImage.cpp +++ b/chromium/third_party/WebKit/Source/core/rendering/style/StyleFetchedImage.cpp @@ -24,7 +24,7 @@ #include "config.h" #include "core/rendering/style/StyleFetchedImage.h" -#include "core/fetch/ImageResource.h" +#include "core/loader/cache/ImageResource.h" #include "core/rendering/RenderObject.h" namespace WebCore { diff --git a/chromium/third_party/WebKit/Source/core/rendering/style/StyleFetchedImage.h b/chromium/third_party/WebKit/Source/core/rendering/style/StyleFetchedImage.h index 9ea82f51778..b9effd9c2cd 100644 --- a/chromium/third_party/WebKit/Source/core/rendering/style/StyleFetchedImage.h +++ b/chromium/third_party/WebKit/Source/core/rendering/style/StyleFetchedImage.h @@ -24,8 +24,8 @@ #ifndef StyleFetchedImage_h #define StyleFetchedImage_h -#include "core/fetch/ImageResourceClient.h" -#include "core/fetch/ResourcePtr.h" +#include "core/loader/cache/ImageResourceClient.h" +#include "core/loader/cache/ResourcePtr.h" #include "core/rendering/style/StyleImage.h" namespace WebCore { diff --git a/chromium/third_party/WebKit/Source/core/rendering/style/StyleFetchedImageSet.cpp b/chromium/third_party/WebKit/Source/core/rendering/style/StyleFetchedImageSet.cpp index 04a8d9d5961..b9e9d52c190 100644 --- a/chromium/third_party/WebKit/Source/core/rendering/style/StyleFetchedImageSet.cpp +++ b/chromium/third_party/WebKit/Source/core/rendering/style/StyleFetchedImageSet.cpp @@ -27,7 +27,7 @@ #include "core/rendering/style/StyleFetchedImageSet.h" #include "core/css/CSSImageSetValue.h" -#include "core/fetch/ImageResource.h" +#include "core/loader/cache/ImageResource.h" #include "core/rendering/RenderObject.h" namespace WebCore { diff --git a/chromium/third_party/WebKit/Source/core/rendering/style/StyleFetchedImageSet.h b/chromium/third_party/WebKit/Source/core/rendering/style/StyleFetchedImageSet.h index 178ec3c87b0..3e431e23388 100644 --- a/chromium/third_party/WebKit/Source/core/rendering/style/StyleFetchedImageSet.h +++ b/chromium/third_party/WebKit/Source/core/rendering/style/StyleFetchedImageSet.h @@ -26,8 +26,8 @@ #ifndef StyleFetchedImageSet_h #define StyleFetchedImageSet_h -#include "core/fetch/ImageResourceClient.h" -#include "core/fetch/ResourcePtr.h" +#include "core/loader/cache/ImageResourceClient.h" +#include "core/loader/cache/ResourcePtr.h" #include "core/platform/graphics/LayoutSize.h" #include "core/rendering/style/StyleImage.h" diff --git a/chromium/third_party/WebKit/Source/core/rendering/style/StyleFetchedShader.cpp b/chromium/third_party/WebKit/Source/core/rendering/style/StyleFetchedShader.cpp index 13a8b98c36a..2b6c6c24e4e 100644 --- a/chromium/third_party/WebKit/Source/core/rendering/style/StyleFetchedShader.cpp +++ b/chromium/third_party/WebKit/Source/core/rendering/style/StyleFetchedShader.cpp @@ -32,7 +32,7 @@ #include "core/rendering/style/StyleFetchedShader.h" #include "core/css/CSSPrimitiveValue.h" -#include "core/fetch/ShaderResource.h" +#include "core/loader/cache/ShaderResource.h" namespace WebCore { diff --git a/chromium/third_party/WebKit/Source/core/rendering/style/StyleFetchedShader.h b/chromium/third_party/WebKit/Source/core/rendering/style/StyleFetchedShader.h index 104a90cc871..88e54112d14 100644 --- a/chromium/third_party/WebKit/Source/core/rendering/style/StyleFetchedShader.h +++ b/chromium/third_party/WebKit/Source/core/rendering/style/StyleFetchedShader.h @@ -30,7 +30,7 @@ #ifndef StyleFetchedShader_h #define StyleFetchedShader_h -#include "core/fetch/ResourcePtr.h" +#include "core/loader/cache/ResourcePtr.h" #include "core/rendering/style/StyleShader.h" namespace WebCore { diff --git a/chromium/third_party/WebKit/Source/core/rendering/svg/ReferenceFilterBuilder.cpp b/chromium/third_party/WebKit/Source/core/rendering/svg/ReferenceFilterBuilder.cpp index b2a9feb84f3..ab598e38444 100644 --- a/chromium/third_party/WebKit/Source/core/rendering/svg/ReferenceFilterBuilder.cpp +++ b/chromium/third_party/WebKit/Source/core/rendering/svg/ReferenceFilterBuilder.cpp @@ -33,8 +33,8 @@ #include "core/css/CSSPrimitiveValue.h" #include "core/css/CSSPrimitiveValueMappings.h" #include "core/dom/Element.h" -#include "core/fetch/DocumentResource.h" -#include "core/fetch/DocumentResourceReference.h" +#include "core/loader/cache/DocumentResource.h" +#include "core/loader/cache/DocumentResourceReference.h" #include "core/platform/graphics/filters/FilterEffect.h" #include "core/platform/graphics/filters/SourceAlpha.h" #include "core/rendering/svg/RenderSVGResourceFilter.h" diff --git a/chromium/third_party/WebKit/Source/core/rendering/svg/RenderSVGResourceClipper.cpp b/chromium/third_party/WebKit/Source/core/rendering/svg/RenderSVGResourceClipper.cpp index 9da09f9d9f0..92a96dd3949 100644 --- a/chromium/third_party/WebKit/Source/core/rendering/svg/RenderSVGResourceClipper.cpp +++ b/chromium/third_party/WebKit/Source/core/rendering/svg/RenderSVGResourceClipper.cpp @@ -127,7 +127,7 @@ bool RenderSVGResourceClipper::pathOnlyClipping(GraphicsContext* context, const } } // Only one visible shape/path was found. Directly continue clipping and transform the content to userspace if necessary. - if (toSVGClipPathElement(node())->clipPathUnitsCurrentValue() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) { + if (static_cast<SVGClipPathElement*>(node())->clipPathUnitsCurrentValue() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) { AffineTransform transform; transform.translate(objectBoundingBox.x(), objectBoundingBox.y()); transform.scaleNonUniform(objectBoundingBox.width(), objectBoundingBox.height()); @@ -152,7 +152,7 @@ bool RenderSVGResourceClipper::applyClippingToContext(RenderObject* object, cons m_clipper.set(object, new ClipperData); bool shouldCreateClipData = false; - AffineTransform animatedLocalTransform = toSVGClipPathElement(node())->animatedLocalTransform(); + AffineTransform animatedLocalTransform = static_cast<SVGClipPathElement*>(node())->animatedLocalTransform(); ClipperData* clipperData = m_clipper.get(object); if (!clipperData->clipMaskImage) { if (pathOnlyClipping(context, animatedLocalTransform, objectBoundingBox)) @@ -208,7 +208,8 @@ bool RenderSVGResourceClipper::drawContentIntoMaskImage(ClipperData* clipperData ASSERT(maskContext); AffineTransform maskContentTransformation; - if (toSVGClipPathElement(node())->clipPathUnitsCurrentValue() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) { + SVGClipPathElement* clipPath = static_cast<SVGClipPathElement*>(node()); + if (clipPath->clipPathUnitsCurrentValue() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) { maskContentTransformation.translate(objectBoundingBox.x(), objectBoundingBox.y()); maskContentTransformation.scaleNonUniform(objectBoundingBox.width(), objectBoundingBox.height()); maskContext->concatCTM(maskContentTransformation); @@ -276,7 +277,7 @@ void RenderSVGResourceClipper::calculateClipContentRepaintRect() continue; m_clipBoundaries.unite(renderer->localToParentTransform().mapRect(renderer->repaintRectInLocalCoordinates())); } - m_clipBoundaries = toSVGClipPathElement(node())->animatedLocalTransform().mapRect(m_clipBoundaries); + m_clipBoundaries = static_cast<SVGClipPathElement*>(node())->animatedLocalTransform().mapRect(m_clipBoundaries); } bool RenderSVGResourceClipper::hitTestClipContent(const FloatRect& objectBoundingBox, const FloatPoint& nodeAtPoint) @@ -285,7 +286,7 @@ bool RenderSVGResourceClipper::hitTestClipContent(const FloatRect& objectBoundin if (!SVGRenderSupport::pointInClippingArea(this, point)) return false; - SVGClipPathElement* clipPathElement = toSVGClipPathElement(node()); + SVGClipPathElement* clipPathElement = static_cast<SVGClipPathElement*>(node()); if (clipPathElement->clipPathUnitsCurrentValue() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) { AffineTransform transform; transform.translate(objectBoundingBox.x(), objectBoundingBox.y()); @@ -319,7 +320,7 @@ FloatRect RenderSVGResourceClipper::resourceBoundingBox(RenderObject* object) if (m_clipBoundaries.isEmpty()) calculateClipContentRepaintRect(); - if (toSVGClipPathElement(node())->clipPathUnitsCurrentValue() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) { + if (static_cast<SVGClipPathElement*>(node())->clipPathUnitsCurrentValue() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) { FloatRect objectBoundingBox = object->objectBoundingBox(); AffineTransform transform; transform.translate(objectBoundingBox.x(), objectBoundingBox.y()); diff --git a/chromium/third_party/WebKit/Source/core/rendering/svg/RenderSVGResourceClipper.h b/chromium/third_party/WebKit/Source/core/rendering/svg/RenderSVGResourceClipper.h index 69ee9865220..32e4971c9fe 100644 --- a/chromium/third_party/WebKit/Source/core/rendering/svg/RenderSVGResourceClipper.h +++ b/chromium/third_party/WebKit/Source/core/rendering/svg/RenderSVGResourceClipper.h @@ -52,7 +52,7 @@ public: bool hitTestClipContent(const FloatRect&, const FloatPoint&); - SVGUnitTypes::SVGUnitType clipPathUnits() const { return toSVGClipPathElement(node())->clipPathUnitsCurrentValue(); } + SVGUnitTypes::SVGUnitType clipPathUnits() const { return static_cast<SVGClipPathElement*>(node())->clipPathUnitsCurrentValue(); } static RenderSVGResourceType s_resourceType; private: diff --git a/chromium/third_party/WebKit/Source/core/rendering/svg/RenderSVGTextPath.cpp b/chromium/third_party/WebKit/Source/core/rendering/svg/RenderSVGTextPath.cpp index f2068b80ac5..a1fbae363e6 100644 --- a/chromium/third_party/WebKit/Source/core/rendering/svg/RenderSVGTextPath.cpp +++ b/chromium/third_party/WebKit/Source/core/rendering/svg/RenderSVGTextPath.cpp @@ -35,7 +35,7 @@ RenderSVGTextPath::RenderSVGTextPath(Element* element) Path RenderSVGTextPath::layoutPath() const { - SVGTextPathElement* textPathElement = toSVGTextPathElement(node()); + SVGTextPathElement* textPathElement = static_cast<SVGTextPathElement*>(node()); Element* targetElement = SVGURIReference::targetElementFromIRIString(textPathElement->hrefCurrentValue(), textPathElement->document()); if (!targetElement || !targetElement->hasTagName(SVGNames::pathTag)) return Path(); @@ -56,17 +56,17 @@ Path RenderSVGTextPath::layoutPath() const float RenderSVGTextPath::startOffset() const { - return toSVGTextPathElement(node())->startOffsetCurrentValue().valueAsPercentage(); + return static_cast<SVGTextPathElement*>(node())->startOffsetCurrentValue().valueAsPercentage(); } bool RenderSVGTextPath::exactAlignment() const { - return toSVGTextPathElement(node())->spacingCurrentValue() == SVGTextPathSpacingExact; + return static_cast<SVGTextPathElement*>(node())->spacingCurrentValue() == SVGTextPathSpacingExact; } bool RenderSVGTextPath::stretchMethod() const { - return toSVGTextPathElement(node())->methodCurrentValue() == SVGTextPathMethodStretch; + return static_cast<SVGTextPathElement*>(node())->methodCurrentValue() == SVGTextPathMethodStretch; } } diff --git a/chromium/third_party/WebKit/Source/core/scripts/templates/StylePropertyShorthand.h.tmpl b/chromium/third_party/WebKit/Source/core/scripts/templates/StylePropertyShorthand.h.tmpl index 5ef9febce37..2bf03820d62 100644 --- a/chromium/third_party/WebKit/Source/core/scripts/templates/StylePropertyShorthand.h.tmpl +++ b/chromium/third_party/WebKit/Source/core/scripts/templates/StylePropertyShorthand.h.tmpl @@ -70,9 +70,8 @@ private: {%- set camel_case_name = property.camel_case_name %} const StylePropertyShorthand& {{ camel_case_name }}Shorthand(); {%- endfor %} - -// Returns an empty list if the property is not a shorthand, otherwise the list of longhands for parsing. -const StylePropertyShorthand& parsingShorthandForProperty(CSSPropertyID); +const StylePropertyShorthand& borderShorthandForParsing(); +const StylePropertyShorthand& webkitAnimationShorthandForParsing(); // Returns an empty list if the property is not a shorthand. const StylePropertyShorthand& shorthandForProperty(CSSPropertyID); diff --git a/chromium/third_party/WebKit/Source/core/storage/Storage.cpp b/chromium/third_party/WebKit/Source/core/storage/Storage.cpp index c46e9bbdc81..bbeb0a3617b 100644 --- a/chromium/third_party/WebKit/Source/core/storage/Storage.cpp +++ b/chromium/third_party/WebKit/Source/core/storage/Storage.cpp @@ -28,8 +28,8 @@ #include "bindings/v8/ExceptionState.h" #include "wtf/PassOwnPtr.h" -#include "wtf/PassRefPtr.h" -#include "wtf/text/WTFString.h" +#include <wtf/PassRefPtr.h> +#include <wtf/text/WTFString.h> namespace WebCore { diff --git a/chromium/third_party/WebKit/Source/core/storage/Storage.h b/chromium/third_party/WebKit/Source/core/storage/Storage.h index 825dad39357..4ffefd57ebf 100644 --- a/chromium/third_party/WebKit/Source/core/storage/Storage.h +++ b/chromium/third_party/WebKit/Source/core/storage/Storage.h @@ -29,9 +29,9 @@ #include "bindings/v8/ScriptWrappable.h" #include "core/page/DOMWindowProperty.h" #include "core/storage/StorageArea.h" -#include "wtf/Forward.h" -#include "wtf/RefCounted.h" -#include "wtf/RefPtr.h" +#include <wtf/Forward.h> +#include <wtf/RefCounted.h> +#include <wtf/RefPtr.h> namespace WebCore { diff --git a/chromium/third_party/WebKit/Source/core/storage/StorageArea.h b/chromium/third_party/WebKit/Source/core/storage/StorageArea.h index 00114d5146a..00533e505a0 100644 --- a/chromium/third_party/WebKit/Source/core/storage/StorageArea.h +++ b/chromium/third_party/WebKit/Source/core/storage/StorageArea.h @@ -26,8 +26,8 @@ #ifndef StorageArea_h #define StorageArea_h -#include "wtf/Forward.h" -#include "wtf/text/WTFString.h" +#include <wtf/Forward.h> +#include <wtf/text/WTFString.h> namespace WebCore { diff --git a/chromium/third_party/WebKit/Source/core/storage/StorageEvent.h b/chromium/third_party/WebKit/Source/core/storage/StorageEvent.h index a4e8ffc9a3e..c59471e3d24 100644 --- a/chromium/third_party/WebKit/Source/core/storage/StorageEvent.h +++ b/chromium/third_party/WebKit/Source/core/storage/StorageEvent.h @@ -27,7 +27,7 @@ #define StorageEvent_h #include "core/dom/Event.h" -#include "wtf/text/WTFString.h" +#include <wtf/text/WTFString.h> namespace WebCore { diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGAnimationElement.h b/chromium/third_party/WebKit/Source/core/svg/SVGAnimationElement.h index a2d9ac4cd82..9108719e484 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGAnimationElement.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGAnimationElement.h @@ -237,9 +237,6 @@ private: AttributeType m_attributeType; Vector<String> m_values; - // FIXME: We should probably use doubles for this, but there's no point - // making such a change unless all SVG logic for sampling animations is - // changed to use doubles. Vector<float> m_keyTimes; Vector<float> m_keyPoints; Vector<UnitBezier> m_keySplines; diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGClipPathElement.h b/chromium/third_party/WebKit/Source/core/svg/SVGClipPathElement.h index 5667aa7dd16..c5bbb882a8c 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGClipPathElement.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGClipPathElement.h @@ -21,7 +21,6 @@ #ifndef SVGClipPathElement_h #define SVGClipPathElement_h -#include "SVGNames.h" #include "core/svg/SVGAnimatedBoolean.h" #include "core/svg/SVGAnimatedEnumeration.h" #include "core/svg/SVGExternalResourcesRequired.h" @@ -56,12 +55,6 @@ private: END_DECLARE_ANIMATED_PROPERTIES }; -inline SVGClipPathElement* toSVGClipPathElement(Node* node) -{ - ASSERT_WITH_SECURITY_IMPLICATION(!node || node->hasTagName(SVGNames::clipPathTag)); - return static_cast<SVGClipPathElement*>(node); -} - } #endif diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGFEImageElement.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGFEImageElement.cpp index cbf76e8f14f..b67789cbb11 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGFEImageElement.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGFEImageElement.cpp @@ -26,9 +26,9 @@ #include "SVGNames.h" #include "XLinkNames.h" #include "core/dom/Document.h" -#include "core/fetch/FetchRequest.h" -#include "core/fetch/ImageResource.h" -#include "core/fetch/ResourceFetcher.h" +#include "core/loader/cache/FetchRequest.h" +#include "core/loader/cache/ImageResource.h" +#include "core/loader/cache/ResourceFetcher.h" #include "core/platform/graphics/Image.h" #include "core/rendering/svg/RenderSVGResource.h" #include "core/svg/SVGElementInstance.h" @@ -193,8 +193,7 @@ void SVGFEImageElement::notifyFinished(Resource*) if (!parent->hasTagName(SVGNames::filterTag) || !parent->renderer()) return; - if (RenderObject* renderer = this->renderer()) - RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer); + RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer()); } PassRefPtr<FilterEffect> SVGFEImageElement::build(SVGFilterBuilder*, Filter* filter) diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGFEImageElement.h b/chromium/third_party/WebKit/Source/core/svg/SVGFEImageElement.h index 799a8ffb119..64f326ddfef 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGFEImageElement.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGFEImageElement.h @@ -21,8 +21,8 @@ #ifndef SVGFEImageElement_h #define SVGFEImageElement_h -#include "core/fetch/ImageResource.h" -#include "core/fetch/ResourcePtr.h" +#include "core/loader/cache/ImageResource.h" +#include "core/loader/cache/ResourcePtr.h" #include "core/platform/graphics/ImageBuffer.h" #include "core/svg/SVGAnimatedBoolean.h" #include "core/svg/SVGAnimatedPreserveAspectRatio.h" diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGFontFaceUriElement.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGFontFaceUriElement.cpp index d040e432273..569ca30ca0b 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGFontFaceUriElement.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGFontFaceUriElement.cpp @@ -27,9 +27,9 @@ #include "XLinkNames.h" #include "core/css/CSSFontFaceSrcValue.h" #include "core/dom/Document.h" -#include "core/fetch/FetchRequest.h" -#include "core/fetch/FontResource.h" -#include "core/fetch/ResourceFetcher.h" +#include "core/loader/cache/FetchRequest.h" +#include "core/loader/cache/FontResource.h" +#include "core/loader/cache/ResourceFetcher.h" #include "core/svg/SVGFontFaceElement.h" namespace WebCore { diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGFontFaceUriElement.h b/chromium/third_party/WebKit/Source/core/svg/SVGFontFaceUriElement.h index 6101a5c412b..99d10462a30 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGFontFaceUriElement.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGFontFaceUriElement.h @@ -21,8 +21,8 @@ #define SVGFontFaceUriElement_h #if ENABLE(SVG_FONTS) -#include "core/fetch/FontResource.h" -#include "core/fetch/ResourcePtr.h" +#include "core/loader/cache/FontResource.h" +#include "core/loader/cache/ResourcePtr.h" #include "core/svg/SVGElement.h" namespace WebCore { diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGImageLoader.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGImageLoader.cpp index 85c0fbbd74d..75dd0d4e21c 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGImageLoader.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGImageLoader.cpp @@ -24,8 +24,8 @@ #include "core/dom/Event.h" #include "core/dom/EventNames.h" -#include "core/fetch/ImageResource.h" #include "core/html/parser/HTMLParserIdioms.h" +#include "core/loader/cache/ImageResource.h" #include "core/svg/SVGImageElement.h" namespace WebCore { diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGSVGElement.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGSVGElement.cpp index d10c7525957..d6958837e17 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGSVGElement.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGSVGElement.cpp @@ -718,7 +718,7 @@ void SVGSVGElement::setupInitialView(const String& fragmentIdentifier, Element* if (SVGViewElement* viewElement = anchorNode->hasTagName(SVGNames::viewTag) ? static_cast<SVGViewElement*>(anchorNode) : 0) { SVGElement* element = SVGLocatable::nearestViewportElement(viewElement); if (element->hasTagName(SVGNames::svgTag)) { - SVGSVGElement* svg = toSVGSVGElement(element); + SVGSVGElement* svg = static_cast<SVGSVGElement*>(element); svg->inheritViewAttributes(viewElement); if (RenderObject* renderer = svg->renderer()) diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGTextContentElement.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGTextContentElement.cpp index 48c806af588..532b74b7f23 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGTextContentElement.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGTextContentElement.cpp @@ -123,9 +123,6 @@ float SVGTextContentElement::getSubStringLength(unsigned charnum, unsigned nchar return 0.0f; } - if (nchars > numberOfChars - charnum) - nchars = numberOfChars - charnum; - return SVGTextQuery(renderer()).subStringLength(charnum, nchars); } diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGTextContentElement.idl b/chromium/third_party/WebKit/Source/core/svg/SVGTextContentElement.idl index f4ce37dc97d..4d693752940 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGTextContentElement.idl +++ b/chromium/third_party/WebKit/Source/core/svg/SVGTextContentElement.idl @@ -34,13 +34,15 @@ interface SVGTextContentElement : SVGGraphicsElement { long getNumberOfChars(); float getComputedTextLength(); - [RaisesException] float getSubStringLength(unsigned long offset, unsigned long length); - [RaisesException] SVGPoint getStartPositionOfChar(unsigned long offset); - [RaisesException] SVGPoint getEndPositionOfChar(unsigned long offset); - [RaisesException] SVGRect getExtentOfChar(unsigned long offset); - [RaisesException] float getRotationOfChar(unsigned long offset); - long getCharNumAtPosition(SVGPoint point); - [RaisesException] void selectSubString(unsigned long offset, unsigned long length); + [RaisesException] float getSubStringLength([Default=Undefined,IsIndex] optional unsigned long offset, + [Default=Undefined,IsIndex] optional unsigned long length); + [RaisesException] SVGPoint getStartPositionOfChar([Default=Undefined,IsIndex] optional unsigned long offset); + [RaisesException] SVGPoint getEndPositionOfChar([Default=Undefined,IsIndex] optional unsigned long offset); + [RaisesException] SVGRect getExtentOfChar([Default=Undefined,IsIndex] optional unsigned long offset); + [RaisesException] float getRotationOfChar([Default=Undefined,IsIndex] optional unsigned long offset); + long getCharNumAtPosition([Default=Undefined] optional SVGPoint point); + [RaisesException] void selectSubString([Default=Undefined,IsIndex] optional unsigned long offset, + [Default=Undefined,IsIndex] optional unsigned long length); }; // FIXME: SVGTextContentElement is not supposed to implement SVGExternalResourcesRequired. diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGTextPathElement.h b/chromium/third_party/WebKit/Source/core/svg/SVGTextPathElement.h index 0ad3f96f238..ab6bcb9881b 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGTextPathElement.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGTextPathElement.h @@ -20,8 +20,8 @@ #ifndef SVGTextPathElement_h #define SVGTextPathElement_h -#include "SVGNames.h" #include "core/svg/SVGTextContentElement.h" + #include "core/svg/SVGURIReference.h" namespace WebCore { @@ -140,12 +140,6 @@ private: END_DECLARE_ANIMATED_PROPERTIES }; -inline SVGTextPathElement* toSVGTextPathElement(Node* node) -{ - ASSERT_WITH_SECURITY_IMPLICATION(!node || node->hasTagName(SVGNames::textPathTag)); - return static_cast<SVGTextPathElement*>(node); -} - } // namespace WebCore #endif diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGUseElement.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGUseElement.cpp index 9589a9f2b8f..9ea02500f09 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGUseElement.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGUseElement.cpp @@ -34,9 +34,9 @@ #include "core/dom/NodeTraversal.h" #include "core/dom/shadow/ElementShadow.h" #include "core/dom/shadow/ShadowRoot.h" -#include "core/fetch/DocumentResource.h" -#include "core/fetch/FetchRequest.h" -#include "core/fetch/ResourceFetcher.h" +#include "core/loader/cache/DocumentResource.h" +#include "core/loader/cache/FetchRequest.h" +#include "core/loader/cache/ResourceFetcher.h" #include "core/rendering/svg/RenderSVGResource.h" #include "core/rendering/svg/RenderSVGTransformableContainer.h" #include "core/svg/SVGElementInstance.h" diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGUseElement.h b/chromium/third_party/WebKit/Source/core/svg/SVGUseElement.h index 3216a518244..1540588715b 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGUseElement.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGUseElement.h @@ -22,7 +22,7 @@ #define SVGUseElement_h #include "SVGNames.h" -#include "core/fetch/DocumentResource.h" +#include "core/loader/cache/DocumentResource.h" #include "core/svg/SVGAnimatedBoolean.h" #include "core/svg/SVGAnimatedLength.h" #include "core/svg/SVGExternalResourcesRequired.h" diff --git a/chromium/third_party/WebKit/Source/core/svg/graphics/SVGImageCache.cpp b/chromium/third_party/WebKit/Source/core/svg/graphics/SVGImageCache.cpp index 81153b3739e..6b5e5a2f3ed 100644 --- a/chromium/third_party/WebKit/Source/core/svg/graphics/SVGImageCache.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/graphics/SVGImageCache.cpp @@ -21,7 +21,7 @@ #include "config.h" #include "core/svg/graphics/SVGImageCache.h" -#include "core/fetch/ImageResource.h" +#include "core/loader/cache/ImageResource.h" #include "core/page/FrameView.h" #include "core/page/Page.h" #include "core/platform/graphics/GraphicsContext.h" diff --git a/chromium/third_party/WebKit/Source/core/testing/InspectorFrontendClientLocal.cpp b/chromium/third_party/WebKit/Source/core/testing/InspectorFrontendClientLocal.cpp index cec7a00ebe1..a68a070d155 100644 --- a/chromium/third_party/WebKit/Source/core/testing/InspectorFrontendClientLocal.cpp +++ b/chromium/third_party/WebKit/Source/core/testing/InspectorFrontendClientLocal.cpp @@ -39,8 +39,8 @@ #include "core/platform/Timer.h" #include "public/platform/Platform.h" #include "public/platform/WebThread.h" -#include "wtf/Deque.h" -#include "wtf/text/WTFString.h" +#include <wtf/Deque.h> +#include <wtf/text/WTFString.h> namespace WebCore { diff --git a/chromium/third_party/WebKit/Source/core/testing/InspectorFrontendClientLocal.h b/chromium/third_party/WebKit/Source/core/testing/InspectorFrontendClientLocal.h index e92f6f58e76..ef35ebab8dc 100644 --- a/chromium/third_party/WebKit/Source/core/testing/InspectorFrontendClientLocal.h +++ b/chromium/third_party/WebKit/Source/core/testing/InspectorFrontendClientLocal.h @@ -32,9 +32,9 @@ #define InspectorFrontendClientLocal_h #include "core/inspector/InspectorFrontendClient.h" -#include "wtf/Forward.h" -#include "wtf/Noncopyable.h" -#include "wtf/text/WTFString.h" +#include <wtf/Forward.h> +#include <wtf/Noncopyable.h> +#include <wtf/text/WTFString.h> namespace WebCore { diff --git a/chromium/third_party/WebKit/Source/core/testing/Internals.cpp b/chromium/third_party/WebKit/Source/core/testing/Internals.cpp index 63285fab580..dba52a6173c 100644 --- a/chromium/third_party/WebKit/Source/core/testing/Internals.cpp +++ b/chromium/third_party/WebKit/Source/core/testing/Internals.cpp @@ -41,7 +41,6 @@ #include "bindings/v8/ExceptionState.h" #include "bindings/v8/SerializedScriptValue.h" #include "bindings/v8/V8ThrowException.h" -#include "core/animation/DocumentTimeline.h" #include "core/css/StyleSheetContents.h" #include "core/css/resolver/StyleResolver.h" #include "core/css/resolver/ViewportStyleResolver.h" @@ -68,8 +67,6 @@ #include "core/editing/Editor.h" #include "core/editing/SpellChecker.h" #include "core/editing/TextIterator.h" -#include "core/fetch/MemoryCache.h" -#include "core/fetch/ResourceFetcher.h" #include "core/history/BackForwardController.h" #include "core/history/HistoryItem.h" #include "core/html/FormController.h" @@ -87,6 +84,8 @@ #include "core/inspector/InspectorOverlay.h" #include "core/inspector/InstrumentingAgents.h" #include "core/loader/FrameLoader.h" +#include "core/loader/cache/MemoryCache.h" +#include "core/loader/cache/ResourceFetcher.h" #include "core/page/Chrome.h" #include "core/page/ChromeClient.h" #include "core/page/DOMPoint.h" @@ -110,9 +109,7 @@ #include "core/platform/graphics/filters/FilterOperations.h" #include "core/platform/graphics/gpu/SharedGraphicsContext3D.h" #include "core/platform/mock/PlatformSpeechSynthesizerMock.h" -#include "core/rendering/RenderLayer.h" #include "core/rendering/RenderLayerBacking.h" -#include "core/rendering/RenderLayerCompositor.h" #include "core/rendering/RenderMenuList.h" #include "core/rendering/RenderObject.h" #include "core/rendering/RenderTreeAsText.h" @@ -121,7 +118,6 @@ #include "core/workers/WorkerThread.h" #include "modules/speech/DOMWindowSpeechSynthesis.h" #include "modules/speech/SpeechSynthesis.h" -#include "public/platform/WebLayer.h" #include "weborigin/SchemeRegistry.h" #include "wtf/dtoa.h" #include "wtf/text/StringBuffer.h" @@ -186,6 +182,9 @@ PassRefPtr<Internals> Internals::create(Document* document) Internals::~Internals() { + if (m_scrollingCoordinator) { + m_scrollingCoordinator->removeTouchEventTargetRectsObserver(this); + } } void Internals::resetToConsistentState(Page* page) @@ -211,7 +210,11 @@ Internals::Internals(Document* document) : ContextLifecycleObserver(document) , m_runtimeFlags(InternalRuntimeFlags::create()) , m_scrollingCoordinator(document->page()->scrollingCoordinator()) + , m_touchEventTargetRectUpdateCount(0) { + if (m_scrollingCoordinator) { + m_scrollingCoordinator->addTouchEventTargetRectsObserver(this); + } } Document* Internals::contextDocument() const @@ -411,10 +414,10 @@ unsigned short Internals::compareTreeScopePosition(const Node* node1, const Node unsigned Internals::numberOfActiveAnimations() const { Frame* contextFrame = frame(); - if (RuntimeEnabledFeatures::webAnimationsCSSEnabled()) - return frame()->document()->timeline()->numberOfActiveAnimationsForTesting(); - if (AnimationController* controller = contextFrame->animation()) - return controller->numberOfActiveAnimations(contextFrame->document()); + if (!RuntimeEnabledFeatures::webAnimationsCSSEnabled()) { + if (AnimationController* controller = contextFrame->animation()) + return controller->numberOfActiveAnimations(contextFrame->document()); + } return 0; } @@ -457,9 +460,7 @@ void Internals::pauseAnimations(double pauseTime, ExceptionState& es) return; } - if (RuntimeEnabledFeatures::webAnimationsCSSEnabled()) - frame()->document()->timeline()->pauseAnimationsForTesting(pauseTime); - else + if (!RuntimeEnabledFeatures::webAnimationsCSSEnabled()) frame()->animation()->pauseAnimationsForTesting(pauseTime); } @@ -1293,126 +1294,48 @@ unsigned Internals::touchEventHandlerCount(Document* document, ExceptionState& e return count; } -static RenderLayer* findRenderLayerForGraphicsLayer(RenderLayer* searchRoot, GraphicsLayer* graphicsLayer, String* layerType) +LayerRectList* Internals::touchEventTargetLayerRects(Document* document, ExceptionState& es) { - if (searchRoot->backing() && graphicsLayer == searchRoot->backing()->graphicsLayer()) - return searchRoot; - - if (graphicsLayer == searchRoot->layerForScrolling()) { - *layerType = "scrolling"; - return searchRoot; - } - - if (graphicsLayer == searchRoot->layerForHorizontalScrollbar()) { - *layerType = "horizontalScrollbar"; - return searchRoot; - } - - if (graphicsLayer == searchRoot->layerForVerticalScrollbar()) { - *layerType = "verticalScrollbar"; - return searchRoot; - } - - if (graphicsLayer == searchRoot->layerForScrollCorner()) { - *layerType = "scrollCorner"; - return searchRoot; - } - - for (RenderLayer* child = searchRoot->firstChild(); child; child = child->nextSibling()) { - RenderLayer* foundLayer = findRenderLayerForGraphicsLayer(child, graphicsLayer, layerType); - if (foundLayer) - return foundLayer; - } - - return 0; -} - -// Given a vector of rects, merge those that are adjacent, leaving empty rects -// in the place of no longer used slots. This is intended to simplify the list -// of rects returned by an SkRegion (which have been split apart for sorting -// purposes). No attempt is made to do this efficiently (eg. by relying on the -// sort criteria of SkRegion). -static void mergeRects(WebKit::WebVector<WebKit::WebRect>& rects) -{ - for (size_t i = 0; i < rects.size(); ++i) { - if (rects[i].isEmpty()) - continue; - bool updated; - do { - updated = false; - for (size_t j = i+1; j < rects.size(); ++j) { - if (rects[j].isEmpty()) - continue; - // Try to merge rects[j] into rects[i] along the 4 possible edges. - if (rects[i].y == rects[j].y && rects[i].height == rects[j].height) { - if (rects[i].x + rects[i].width == rects[j].x) { - rects[i].width += rects[j].width; - rects[j] = WebKit::WebRect(); - updated = true; - } else if (rects[i].x == rects[j].x + rects[j].width) { - rects[i].x = rects[j].x; - rects[i].width += rects[j].width; - rects[j] = WebKit::WebRect(); - updated = true; - } - } else if (rects[i].x == rects[j].x && rects[i].width == rects[j].width) { - if (rects[i].y + rects[i].height == rects[j].y) { - rects[i].height += rects[j].height; - rects[j] = WebKit::WebRect(); - updated = true; - } else if (rects[i].y == rects[j].y + rects[j].height) { - rects[i].y = rects[j].y; - rects[i].height += rects[j].height; - rects[j] = WebKit::WebRect(); - updated = true; - } - } - } - } while (updated); - } -} - -static void accumulateLayerRectList(RenderLayerCompositor* compositor, GraphicsLayer* graphicsLayer, LayerRectList* rects) -{ - WebKit::WebVector<WebKit::WebRect> layerRects = graphicsLayer->platformLayer()->touchEventHandlerRegion(); - if (!layerRects.isEmpty()) { - mergeRects(layerRects); - String layerType; - RenderLayer* renderLayer = findRenderLayerForGraphicsLayer(compositor->rootRenderLayer(), graphicsLayer, &layerType); - Node* node = renderLayer ? renderLayer->renderer()->node() : 0; - for (size_t i = 0; i < layerRects.size(); ++i) { - if (!layerRects[i].isEmpty()) - rects->append(node, layerType, ClientRect::create(layerRects[i])); - } + if (!document || !document->view() || !document->page() || document != contextDocument()) { + es.throwDOMException(InvalidAccessError); + return 0; } - size_t numChildren = graphicsLayer->children().size(); - for (size_t i = 0; i < numChildren; ++i) - accumulateLayerRectList(compositor, graphicsLayer->children()[i], rects); + // Do any pending layouts (which may call touchEventTargetRectsChange) to ensure this + // really takes any previous changes into account. + document->updateLayout(); + return m_currentTouchEventRects.get(); } -PassRefPtr<LayerRectList> Internals::touchEventTargetLayerRects(Document* document, ExceptionState& es) +unsigned Internals::touchEventTargetLayerRectsUpdateCount(Document* document, ExceptionState& es) { if (!document || !document->view() || !document->page() || document != contextDocument()) { es.throwDOMException(InvalidAccessError); return 0; } - // Do any pending layouts (which may call touchEventTargetRectsChange) to ensure this - // really takes any previous changes into account. + // Do any pending layouts to ensure this really takes any previous changes into account. document->updateLayout(); - if (RenderView* view = document->renderView()) { - if (RenderLayerCompositor* compositor = view->compositor()) { - if (GraphicsLayer* rootLayer = compositor->rootGraphicsLayer()) { - RefPtr<LayerRectList> rects = LayerRectList::create(); - accumulateLayerRectList(compositor, rootLayer, rects.get()); - return rects; - } + return m_touchEventTargetRectUpdateCount; +} + +void Internals::touchEventTargetRectsChanged(const LayerHitTestRects& rects) +{ + // When profiling content_shell, it can be handy to exclude this time (since it's only + // present for testing / debugging). + TRACE_EVENT0("input", "Internals::touchEventTargetRectsChanged"); + + m_touchEventTargetRectUpdateCount++; + + // Since it's not safe to hang onto the pointers in a LayerHitTestRects, we immediately + // copy into a LayerRectList. + m_currentTouchEventRects = LayerRectList::create(); + for (LayerHitTestRects::const_iterator iter = rects.begin(); iter != rects.end(); ++iter) { + for (size_t i = 0; i < iter->value.size(); ++i) { + m_currentTouchEventRects->append(iter->key->renderer()->node(), ClientRect::create(enclosingIntRect(iter->value[i]))); } } - - return 0; } PassRefPtr<NodeList> Internals::nodesFromRect(Document* document, int centerX, int centerY, unsigned topPadding, unsigned rightPadding, diff --git a/chromium/third_party/WebKit/Source/core/testing/Internals.h b/chromium/third_party/WebKit/Source/core/testing/Internals.h index bbba5ffdde4..bde21e22f4e 100644 --- a/chromium/third_party/WebKit/Source/core/testing/Internals.h +++ b/chromium/third_party/WebKit/Source/core/testing/Internals.h @@ -33,10 +33,10 @@ #include "core/dom/ContextLifecycleObserver.h" #include "core/dom/NodeList.h" #include "core/page/scrolling/ScrollingCoordinator.h" -#include "wtf/ArrayBuffer.h" -#include "wtf/PassRefPtr.h" -#include "wtf/RefCounted.h" -#include "wtf/text/WTFString.h" +#include <wtf/ArrayBuffer.h> +#include <wtf/PassRefPtr.h> +#include <wtf/RefCounted.h> +#include <wtf/text/WTFString.h> namespace WebCore { @@ -67,7 +67,8 @@ class ShadowRoot; class TypeConversions; class Internals : public RefCounted<Internals> - , public ContextLifecycleObserver { + , public ContextLifecycleObserver + , public ScrollingCoordinator::TouchEventTargetRectsObserver { public: static PassRefPtr<Internals> create(Document*); virtual ~Internals(); @@ -181,7 +182,9 @@ public: unsigned wheelEventHandlerCount(Document*, ExceptionState&); unsigned touchEventHandlerCount(Document*, ExceptionState&); - PassRefPtr<LayerRectList> touchEventTargetLayerRects(Document*, ExceptionState&); + LayerRectList* touchEventTargetLayerRects(Document*, ExceptionState&); + unsigned touchEventTargetLayerRectsUpdateCount(Document*, ExceptionState&); + virtual void touchEventTargetRectsChanged(const LayerHitTestRects&); // This is used to test rect based hit testing like what's done on touch screens. PassRefPtr<NodeList> nodesFromRect(Document*, int x, int y, unsigned topPadding, unsigned rightPadding, @@ -304,6 +307,8 @@ private: OwnPtr<InspectorFrontendChannelDummy> m_frontendChannel; RefPtr<InternalRuntimeFlags> m_runtimeFlags; RefPtr<ScrollingCoordinator> m_scrollingCoordinator; + int m_touchEventTargetRectUpdateCount; + RefPtr<LayerRectList> m_currentTouchEventRects; RefPtr<InternalProfilers> m_profilers; }; diff --git a/chromium/third_party/WebKit/Source/core/testing/Internals.idl b/chromium/third_party/WebKit/Source/core/testing/Internals.idl index 65a304e81be..d521c04ebe5 100644 --- a/chromium/third_party/WebKit/Source/core/testing/Internals.idl +++ b/chromium/third_party/WebKit/Source/core/testing/Internals.idl @@ -142,7 +142,7 @@ [RaisesException] unsigned long wheelEventHandlerCount(Document document); [RaisesException] unsigned long touchEventHandlerCount(Document document); [RaisesException] LayerRectList touchEventTargetLayerRects(Document document); - + [RaisesException] unsigned long touchEventTargetLayerRectsUpdateCount(Document document); [RaisesException] NodeList nodesFromRect(Document document, long x, long y, unsigned long topPadding, unsigned long rightPadding, unsigned long bottomPadding, unsigned long leftPadding, diff --git a/chromium/third_party/WebKit/Source/core/testing/LayerRect.h b/chromium/third_party/WebKit/Source/core/testing/LayerRect.h index 4827feee4f2..f945681417f 100644 --- a/chromium/third_party/WebKit/Source/core/testing/LayerRect.h +++ b/chromium/third_party/WebKit/Source/core/testing/LayerRect.h @@ -36,7 +36,6 @@ #include "wtf/PassRefPtr.h" #include "wtf/RefCounted.h" #include "wtf/RefPtr.h" -#include "wtf/text/WTFString.h" namespace WebCore { @@ -44,25 +43,22 @@ class Node; class LayerRect : public RefCounted<LayerRect> { public: - static PassRefPtr<LayerRect> create(PassRefPtr<Node> node, const String& layerType, PassRefPtr<ClientRect> rect) + static PassRefPtr<LayerRect> create(PassRefPtr<Node> node, PassRefPtr<ClientRect> rect) { - return adoptRef(new LayerRect(node, layerType, rect)); + return adoptRef(new LayerRect(node, rect)); } Node* layerRootNode() const { return m_layerRootNode.get(); } - String layerType() const { return m_layerType; } ClientRect* layerRelativeRect() const { return m_rect.get(); } private: - LayerRect(PassRefPtr<Node> node, const String& layerName, PassRefPtr<ClientRect> rect) + LayerRect(PassRefPtr<Node> node, PassRefPtr<ClientRect> rect) : m_layerRootNode(node) - , m_layerType(layerName) , m_rect(rect) { } RefPtr<Node> m_layerRootNode; - String m_layerType; RefPtr<ClientRect> m_rect; }; diff --git a/chromium/third_party/WebKit/Source/core/testing/LayerRect.idl b/chromium/third_party/WebKit/Source/core/testing/LayerRect.idl index 8a4d8e17f18..50994ab58e9 100644 --- a/chromium/third_party/WebKit/Source/core/testing/LayerRect.idl +++ b/chromium/third_party/WebKit/Source/core/testing/LayerRect.idl @@ -31,6 +31,5 @@ [ ] interface LayerRect { readonly attribute Node layerRootNode; - readonly attribute DOMString layerType; readonly attribute ClientRect layerRelativeRect; }; diff --git a/chromium/third_party/WebKit/Source/core/testing/LayerRectList.cpp b/chromium/third_party/WebKit/Source/core/testing/LayerRectList.cpp index 4e8b9911983..578b407a6f4 100644 --- a/chromium/third_party/WebKit/Source/core/testing/LayerRectList.cpp +++ b/chromium/third_party/WebKit/Source/core/testing/LayerRectList.cpp @@ -58,9 +58,9 @@ LayerRect* LayerRectList::item(unsigned index) return m_list[index].get(); } -void LayerRectList::append(PassRefPtr<Node> layerRootNode, const String& layerType, PassRefPtr<ClientRect> layerRelativeRect) +void LayerRectList::append(PassRefPtr<Node> layerRootNode, PassRefPtr<ClientRect> layerRelativeRect) { - m_list.append(LayerRect::create(layerRootNode, layerType, layerRelativeRect)); + m_list.append(LayerRect::create(layerRootNode, layerRelativeRect)); } } // namespace WebCore diff --git a/chromium/third_party/WebKit/Source/core/testing/LayerRectList.h b/chromium/third_party/WebKit/Source/core/testing/LayerRectList.h index ec1582b8b99..d46d1dc78b8 100644 --- a/chromium/third_party/WebKit/Source/core/testing/LayerRectList.h +++ b/chromium/third_party/WebKit/Source/core/testing/LayerRectList.h @@ -35,7 +35,6 @@ #include "wtf/PassRefPtr.h" #include "wtf/RefCounted.h" #include "wtf/Vector.h" -#include "wtf/text/WTFString.h" namespace WebCore { @@ -51,7 +50,7 @@ public: unsigned length() const; LayerRect* item(unsigned index); - void append(PassRefPtr<Node> layerRootNode, const String& layerName, PassRefPtr<ClientRect> layerRelativeRect); + void append(PassRefPtr<Node> layerRootNode, PassRefPtr<ClientRect> layerRelativeRect); private: LayerRectList(); diff --git a/chromium/third_party/WebKit/Source/core/testing/MallocStatistics.h b/chromium/third_party/WebKit/Source/core/testing/MallocStatistics.h index bc4da8562ca..3f07bbd9f71 100644 --- a/chromium/third_party/WebKit/Source/core/testing/MallocStatistics.h +++ b/chromium/third_party/WebKit/Source/core/testing/MallocStatistics.h @@ -26,9 +26,9 @@ #ifndef MallocStatistics_h #define MallocStatistics_h -#include "wtf/FastMalloc.h" -#include "wtf/PassRefPtr.h" -#include "wtf/RefCounted.h" +#include <wtf/FastMalloc.h> +#include <wtf/PassRefPtr.h> +#include <wtf/RefCounted.h> namespace WebCore { diff --git a/chromium/third_party/WebKit/Source/core/testing/MockPagePopupDriver.h b/chromium/third_party/WebKit/Source/core/testing/MockPagePopupDriver.h index e1f90aa54d0..154815be362 100644 --- a/chromium/third_party/WebKit/Source/core/testing/MockPagePopupDriver.h +++ b/chromium/third_party/WebKit/Source/core/testing/MockPagePopupDriver.h @@ -28,7 +28,7 @@ #include "core/page/PagePopupClient.h" #include "core/page/PagePopupDriver.h" -#include "wtf/RefPtr.h" +#include <wtf/RefPtr.h> namespace WebCore { diff --git a/chromium/third_party/WebKit/Source/core/testing/TypeConversions.h b/chromium/third_party/WebKit/Source/core/testing/TypeConversions.h index 10f675f42f4..b8cde7bf27a 100644 --- a/chromium/third_party/WebKit/Source/core/testing/TypeConversions.h +++ b/chromium/third_party/WebKit/Source/core/testing/TypeConversions.h @@ -26,9 +26,9 @@ #ifndef TypeConversions_h #define TypeConversions_h -#include "wtf/FastMalloc.h" -#include "wtf/PassRefPtr.h" -#include "wtf/RefCounted.h" +#include <wtf/FastMalloc.h> +#include <wtf/PassRefPtr.h> +#include <wtf/RefCounted.h> namespace WebCore { diff --git a/chromium/third_party/WebKit/Source/core/workers/AbstractWorker.cpp b/chromium/third_party/WebKit/Source/core/workers/AbstractWorker.cpp index 24e9bb88a92..e4b9c7f177f 100644 --- a/chromium/third_party/WebKit/Source/core/workers/AbstractWorker.cpp +++ b/chromium/third_party/WebKit/Source/core/workers/AbstractWorker.cpp @@ -57,24 +57,24 @@ void AbstractWorker::contextDestroyed() KURL AbstractWorker::resolveURL(const String& url, ExceptionState& es) { if (url.isEmpty()) { - es.throwDOMException(SyntaxError, "Failed to create a worker: an empty URL was provided."); + es.throwDOMException(SyntaxError); return KURL(); } // FIXME: This should use the dynamic global scope (bug #27887) KURL scriptURL = scriptExecutionContext()->completeURL(url); if (!scriptURL.isValid()) { - es.throwDOMException(SyntaxError, "Failed to create a worker: '" + url + "' is not a valid URL."); + es.throwDOMException(SyntaxError); return KURL(); } if (!scriptExecutionContext()->securityOrigin()->canRequest(scriptURL)) { - es.throwDOMException(SecurityError, "Failed to create a worker: script with origin '" + SecurityOrigin::create(scriptURL)->toString() + "' cannot be accessed from origin '" + scriptExecutionContext()->securityOrigin()->toString() + "'."); + es.throwDOMException(SecurityError); return KURL(); } if (scriptExecutionContext()->contentSecurityPolicy() && !scriptExecutionContext()->contentSecurityPolicy()->allowScriptFromSource(scriptURL)) { - es.throwDOMException(SecurityError, "Failed to create a worker: access to the script at '" + url + "' is denied by the document's Content Security Policy."); + es.throwDOMException(SecurityError); return KURL(); } diff --git a/chromium/third_party/WebKit/Source/core/workers/AbstractWorker.h b/chromium/third_party/WebKit/Source/core/workers/AbstractWorker.h index de94684d9bd..5805534924f 100644 --- a/chromium/third_party/WebKit/Source/core/workers/AbstractWorker.h +++ b/chromium/third_party/WebKit/Source/core/workers/AbstractWorker.h @@ -36,10 +36,10 @@ #include "core/dom/EventListener.h" #include "core/dom/EventNames.h" #include "core/dom/EventTarget.h" -#include "wtf/PassRefPtr.h" -#include "wtf/RefCounted.h" -#include "wtf/RefPtr.h" -#include "wtf/text/AtomicStringHash.h" +#include <wtf/PassRefPtr.h> +#include <wtf/RefCounted.h> +#include <wtf/RefPtr.h> +#include <wtf/text/AtomicStringHash.h> namespace WebCore { diff --git a/chromium/third_party/WebKit/Source/core/workers/DefaultSharedWorkerRepository.h b/chromium/third_party/WebKit/Source/core/workers/DefaultSharedWorkerRepository.h index 6cf1ee1b450..1237988ab14 100644 --- a/chromium/third_party/WebKit/Source/core/workers/DefaultSharedWorkerRepository.h +++ b/chromium/third_party/WebKit/Source/core/workers/DefaultSharedWorkerRepository.h @@ -32,14 +32,14 @@ #define DefaultSharedWorkerRepository_h #include "core/page/ContentSecurityPolicy.h" -#include "wtf/Forward.h" -#include "wtf/HashMap.h" -#include "wtf/Noncopyable.h" -#include "wtf/PassOwnPtr.h" -#include "wtf/PassRefPtr.h" -#include "wtf/RefPtr.h" -#include "wtf/Threading.h" -#include "wtf/text/StringHash.h" +#include <wtf/Forward.h> +#include <wtf/HashMap.h> +#include <wtf/Noncopyable.h> +#include <wtf/PassOwnPtr.h> +#include <wtf/PassRefPtr.h> +#include <wtf/RefPtr.h> +#include <wtf/text/StringHash.h> +#include <wtf/Threading.h> namespace WebCore { diff --git a/chromium/third_party/WebKit/Source/core/workers/SharedWorker.cpp b/chromium/third_party/WebKit/Source/core/workers/SharedWorker.cpp index 6ccf3e4fd91..55019ec7dc5 100644 --- a/chromium/third_party/WebKit/Source/core/workers/SharedWorker.cpp +++ b/chromium/third_party/WebKit/Source/core/workers/SharedWorker.cpp @@ -65,18 +65,18 @@ PassRefPtr<SharedWorker> SharedWorker::create(ScriptExecutionContext* context, c worker->suspendIfNeeded(); + KURL scriptURL = worker->resolveURL(url, es); + if (scriptURL.isEmpty()) + return 0; + // We don't currently support nested workers, so workers can only be created from documents. ASSERT_WITH_SECURITY_IMPLICATION(context->isDocument()); Document* document = toDocument(context); if (!document->securityOrigin()->canAccessSharedWorkers()) { - es.throwDOMException(SecurityError, "Failed to create 'SharedWorker': access to shared workers is denied to origin '" + document->securityOrigin()->toString() + "'."); + es.throwDOMException(SecurityError); return 0; } - KURL scriptURL = worker->resolveURL(url, es); - if (scriptURL.isEmpty()) - return 0; - SharedWorkerRepository::connect(worker.get(), remotePort.release(), scriptURL, name, es); return worker.release(); diff --git a/chromium/third_party/WebKit/Source/core/workers/SharedWorkerRepository.h b/chromium/third_party/WebKit/Source/core/workers/SharedWorkerRepository.h index 26d15cbf068..6a3927af560 100644 --- a/chromium/third_party/WebKit/Source/core/workers/SharedWorkerRepository.h +++ b/chromium/third_party/WebKit/Source/core/workers/SharedWorkerRepository.h @@ -31,9 +31,9 @@ #ifndef SharedWorkerRepository_h #define SharedWorkerRepository_h -#include "wtf/Forward.h" -#include "wtf/PassOwnPtr.h" -#include "wtf/PassRefPtr.h" +#include <wtf/Forward.h> +#include <wtf/PassOwnPtr.h> +#include <wtf/PassRefPtr.h> namespace WebCore { diff --git a/chromium/third_party/WebKit/Source/core/workers/Worker.cpp b/chromium/third_party/WebKit/Source/core/workers/Worker.cpp index 52d852393ae..c94d08c4e70 100644 --- a/chromium/third_party/WebKit/Source/core/workers/Worker.cpp +++ b/chromium/third_party/WebKit/Source/core/workers/Worker.cpp @@ -33,9 +33,9 @@ #include "core/dom/EventListener.h" #include "core/dom/EventNames.h" #include "core/dom/MessageEvent.h" -#include "core/fetch/ResourceFetcher.h" #include "core/inspector/InspectorInstrumentation.h" #include "core/loader/FrameLoader.h" +#include "core/loader/cache/ResourceFetcher.h" #include "core/page/DOMWindow.h" #include "core/page/Frame.h" #include "core/page/UseCounter.h" diff --git a/chromium/third_party/WebKit/Source/core/workers/Worker.h b/chromium/third_party/WebKit/Source/core/workers/Worker.h index 023578a9f21..3f0eb1a166c 100644 --- a/chromium/third_party/WebKit/Source/core/workers/Worker.h +++ b/chromium/third_party/WebKit/Source/core/workers/Worker.h @@ -34,10 +34,10 @@ #include "core/dom/MessagePort.h" #include "core/workers/AbstractWorker.h" #include "core/workers/WorkerScriptLoaderClient.h" -#include "wtf/Forward.h" -#include "wtf/PassRefPtr.h" -#include "wtf/RefPtr.h" -#include "wtf/text/AtomicStringHash.h" +#include <wtf/Forward.h> +#include <wtf/PassRefPtr.h> +#include <wtf/RefPtr.h> +#include <wtf/text/AtomicStringHash.h> namespace WebCore { diff --git a/chromium/third_party/WebKit/Source/core/workers/WorkerEventQueue.h b/chromium/third_party/WebKit/Source/core/workers/WorkerEventQueue.h index fda0b93eed9..5eb85673b5a 100644 --- a/chromium/third_party/WebKit/Source/core/workers/WorkerEventQueue.h +++ b/chromium/third_party/WebKit/Source/core/workers/WorkerEventQueue.h @@ -28,10 +28,10 @@ #define WorkerEventQueue_h #include "core/dom/EventQueue.h" -#include "wtf/HashMap.h" -#include "wtf/HashSet.h" -#include "wtf/PassOwnPtr.h" -#include "wtf/RefCounted.h" +#include <wtf/HashMap.h> +#include <wtf/HashSet.h> +#include <wtf/PassOwnPtr.h> +#include <wtf/RefCounted.h> namespace WebCore { diff --git a/chromium/third_party/WebKit/Source/core/workers/WorkerGlobalScope.cpp b/chromium/third_party/WebKit/Source/core/workers/WorkerGlobalScope.cpp index 374aa7e4726..f80e1ffce1f 100644 --- a/chromium/third_party/WebKit/Source/core/workers/WorkerGlobalScope.cpp +++ b/chromium/third_party/WebKit/Source/core/workers/WorkerGlobalScope.cpp @@ -194,7 +194,7 @@ void WorkerGlobalScope::importScripts(const Vector<String>& urls, ExceptionState for (Vector<String>::const_iterator it = urls.begin(); it != urlsEnd; ++it) { const KURL& url = scriptExecutionContext()->completeURL(*it); if (!url.isValid()) { - es.throwDOMException(SyntaxError, "Failed to execute 'importScripts': the URL '" + *it + "' is invalid."); + es.throwDOMException(SyntaxError); return; } completedURLs.append(url); @@ -208,7 +208,7 @@ void WorkerGlobalScope::importScripts(const Vector<String>& urls, ExceptionState // If the fetching attempt failed, throw a NetworkError exception and abort all these steps. if (scriptLoader->failed()) { - es.throwDOMException(NetworkError, "Failed to execute 'importScripts': the script at '" + it->elidedString() + "' failed to load."); + es.throwDOMException(NetworkError); return; } diff --git a/chromium/third_party/WebKit/Source/core/workers/WorkerGlobalScope.idl b/chromium/third_party/WebKit/Source/core/workers/WorkerGlobalScope.idl index f7a445e3fd7..87c3594f8f7 100644 --- a/chromium/third_party/WebKit/Source/core/workers/WorkerGlobalScope.idl +++ b/chromium/third_party/WebKit/Source/core/workers/WorkerGlobalScope.idl @@ -37,7 +37,7 @@ attribute EventHandler onerror; // WorkerUtils - [RaisesException] void importScripts(DOMString... urls); + [Custom] void importScripts(/*[Variadic] in DOMString urls */); [Replaceable] readonly attribute WorkerNavigator navigator; // Additional constructors diff --git a/chromium/third_party/WebKit/Source/core/workers/WorkerLoaderProxy.h b/chromium/third_party/WebKit/Source/core/workers/WorkerLoaderProxy.h index f3eed8dc807..3342d900d77 100644 --- a/chromium/third_party/WebKit/Source/core/workers/WorkerLoaderProxy.h +++ b/chromium/third_party/WebKit/Source/core/workers/WorkerLoaderProxy.h @@ -32,8 +32,8 @@ #define WorkerLoaderProxy_h #include "core/dom/ScriptExecutionContext.h" -#include "wtf/Forward.h" -#include "wtf/PassOwnPtr.h" +#include <wtf/Forward.h> +#include <wtf/PassOwnPtr.h> namespace WebKit { class WebWorkerBase; diff --git a/chromium/third_party/WebKit/Source/core/workers/WorkerLocation.cpp b/chromium/third_party/WebKit/Source/core/workers/WorkerLocation.cpp index c93e8d1be15..87b509067c6 100644 --- a/chromium/third_party/WebKit/Source/core/workers/WorkerLocation.cpp +++ b/chromium/third_party/WebKit/Source/core/workers/WorkerLocation.cpp @@ -25,9 +25,10 @@ */ #include "config.h" + #include "core/workers/WorkerLocation.h" -#include "wtf/text/WTFString.h" +#include <wtf/text/WTFString.h> namespace WebCore { diff --git a/chromium/third_party/WebKit/Source/core/workers/WorkerMessagingProxy.cpp b/chromium/third_party/WebKit/Source/core/workers/WorkerMessagingProxy.cpp index 9794ea62322..eb15b16300e 100644 --- a/chromium/third_party/WebKit/Source/core/workers/WorkerMessagingProxy.cpp +++ b/chromium/third_party/WebKit/Source/core/workers/WorkerMessagingProxy.cpp @@ -49,7 +49,7 @@ #include "core/workers/Worker.h" #include "core/workers/WorkerClients.h" #include "core/workers/WorkerThreadStartupData.h" -#include "wtf/MainThread.h" +#include <wtf/MainThread.h> namespace WebCore { diff --git a/chromium/third_party/WebKit/Source/core/workers/WorkerMessagingProxy.h b/chromium/third_party/WebKit/Source/core/workers/WorkerMessagingProxy.h index 26566bfb2b5..9b2113bd4ae 100644 --- a/chromium/third_party/WebKit/Source/core/workers/WorkerMessagingProxy.h +++ b/chromium/third_party/WebKit/Source/core/workers/WorkerMessagingProxy.h @@ -31,12 +31,12 @@ #include "core/workers/WorkerGlobalScopeProxy.h" #include "core/workers/WorkerLoaderProxy.h" #include "core/workers/WorkerObjectProxy.h" -#include "wtf/Forward.h" -#include "wtf/Noncopyable.h" -#include "wtf/PassOwnPtr.h" -#include "wtf/PassRefPtr.h" -#include "wtf/RefPtr.h" -#include "wtf/Vector.h" +#include <wtf/Forward.h> +#include <wtf/Noncopyable.h> +#include <wtf/PassOwnPtr.h> +#include <wtf/PassRefPtr.h> +#include <wtf/RefPtr.h> +#include <wtf/Vector.h> namespace WebCore { diff --git a/chromium/third_party/WebKit/Source/core/workers/WorkerObjectProxy.h b/chromium/third_party/WebKit/Source/core/workers/WorkerObjectProxy.h index d0061f752ac..d4da8699306 100644 --- a/chromium/third_party/WebKit/Source/core/workers/WorkerObjectProxy.h +++ b/chromium/third_party/WebKit/Source/core/workers/WorkerObjectProxy.h @@ -33,7 +33,7 @@ #include "core/dom/MessagePort.h" #include "core/workers/WorkerReportingProxy.h" -#include "wtf/PassOwnPtr.h" +#include <wtf/PassOwnPtr.h> namespace WebCore { diff --git a/chromium/third_party/WebKit/Source/core/workers/WorkerReportingProxy.h b/chromium/third_party/WebKit/Source/core/workers/WorkerReportingProxy.h index daa8f500b45..a42df140dd0 100644 --- a/chromium/third_party/WebKit/Source/core/workers/WorkerReportingProxy.h +++ b/chromium/third_party/WebKit/Source/core/workers/WorkerReportingProxy.h @@ -32,7 +32,7 @@ #define WorkerReportingProxy_h #include "core/page/ConsoleTypes.h" -#include "wtf/Forward.h" +#include <wtf/Forward.h> namespace WebCore { diff --git a/chromium/third_party/WebKit/Source/core/workers/WorkerRunLoop.cpp b/chromium/third_party/WebKit/Source/core/workers/WorkerRunLoop.cpp index e2d2a040f1b..a0744ccebbf 100644 --- a/chromium/third_party/WebKit/Source/core/workers/WorkerRunLoop.cpp +++ b/chromium/third_party/WebKit/Source/core/workers/WorkerRunLoop.cpp @@ -37,7 +37,7 @@ #include "core/platform/ThreadTimers.h" #include "core/workers/WorkerGlobalScope.h" #include "core/workers/WorkerThread.h" -#include "wtf/CurrentTime.h" +#include <wtf/CurrentTime.h> namespace WebCore { diff --git a/chromium/third_party/WebKit/Source/core/workers/WorkerRunLoop.h b/chromium/third_party/WebKit/Source/core/workers/WorkerRunLoop.h index 8ee3e8eadf4..28a7bc5bf82 100644 --- a/chromium/third_party/WebKit/Source/core/workers/WorkerRunLoop.h +++ b/chromium/third_party/WebKit/Source/core/workers/WorkerRunLoop.h @@ -32,9 +32,9 @@ #define WorkerRunLoop_h #include "core/dom/ScriptExecutionContext.h" -#include "wtf/MessageQueue.h" -#include "wtf/OwnPtr.h" -#include "wtf/PassOwnPtr.h" +#include <wtf/MessageQueue.h> +#include <wtf/OwnPtr.h> +#include <wtf/PassOwnPtr.h> namespace WebCore { diff --git a/chromium/third_party/WebKit/Source/core/workers/WorkerScriptLoader.cpp b/chromium/third_party/WebKit/Source/core/workers/WorkerScriptLoader.cpp index 7f6290e683a..9c10f8b70bd 100644 --- a/chromium/third_party/WebKit/Source/core/workers/WorkerScriptLoader.cpp +++ b/chromium/third_party/WebKit/Source/core/workers/WorkerScriptLoader.cpp @@ -26,6 +26,7 @@ */ #include "config.h" + #include "core/workers/WorkerScriptLoader.h" #include "core/dom/ScriptExecutionContext.h" @@ -35,9 +36,9 @@ #include "core/workers/WorkerGlobalScope.h" #include "core/workers/WorkerScriptLoaderClient.h" -#include "wtf/OwnPtr.h" -#include "wtf/RefPtr.h" -#include "wtf/UnusedParam.h" +#include <wtf/OwnPtr.h> +#include <wtf/RefPtr.h> +#include <wtf/UnusedParam.h> namespace WebCore { diff --git a/chromium/third_party/WebKit/Source/core/xml/DOMParser.cpp b/chromium/third_party/WebKit/Source/core/xml/DOMParser.cpp index b923b46ec23..561b34d57a9 100644 --- a/chromium/third_party/WebKit/Source/core/xml/DOMParser.cpp +++ b/chromium/third_party/WebKit/Source/core/xml/DOMParser.cpp @@ -21,7 +21,7 @@ #include "core/dom/DOMImplementation.h" #include "core/dom/Document.h" -#include "wtf/text/WTFString.h" +#include <wtf/text/WTFString.h> namespace WebCore { diff --git a/chromium/third_party/WebKit/Source/core/xml/NativeXPathNSResolver.cpp b/chromium/third_party/WebKit/Source/core/xml/NativeXPathNSResolver.cpp index 8ae8c04db12..e398afd373b 100644 --- a/chromium/third_party/WebKit/Source/core/xml/NativeXPathNSResolver.cpp +++ b/chromium/third_party/WebKit/Source/core/xml/NativeXPathNSResolver.cpp @@ -28,7 +28,7 @@ #include "XMLNames.h" #include "core/dom/Node.h" -#include "wtf/text/WTFString.h" +#include <wtf/text/WTFString.h> namespace WebCore { diff --git a/chromium/third_party/WebKit/Source/core/xml/NativeXPathNSResolver.h b/chromium/third_party/WebKit/Source/core/xml/NativeXPathNSResolver.h index 17a1238ba10..00e04fd839b 100644 --- a/chromium/third_party/WebKit/Source/core/xml/NativeXPathNSResolver.h +++ b/chromium/third_party/WebKit/Source/core/xml/NativeXPathNSResolver.h @@ -27,7 +27,7 @@ #define NativeXPathNSResolver_h #include "core/xml/XPathNSResolver.h" -#include "wtf/RefPtr.h" +#include <wtf/RefPtr.h> namespace WebCore { diff --git a/chromium/third_party/WebKit/Source/core/xml/XMLErrors.cpp b/chromium/third_party/WebKit/Source/core/xml/XMLErrors.cpp index acef59f78ef..2c1bd853564 100644 --- a/chromium/third_party/WebKit/Source/core/xml/XMLErrors.cpp +++ b/chromium/third_party/WebKit/Source/core/xml/XMLErrors.cpp @@ -34,7 +34,7 @@ #include "core/dom/Document.h" #include "core/dom/Element.h" #include "core/dom/Text.h" -#include "wtf/text/WTFString.h" +#include <wtf/text/WTFString.h> namespace WebCore { diff --git a/chromium/third_party/WebKit/Source/core/xml/XMLErrors.h b/chromium/third_party/WebKit/Source/core/xml/XMLErrors.h index 7adfd1e3a7f..d45a25903c5 100644 --- a/chromium/third_party/WebKit/Source/core/xml/XMLErrors.h +++ b/chromium/third_party/WebKit/Source/core/xml/XMLErrors.h @@ -29,8 +29,8 @@ #ifndef XMLErrors_h #define XMLErrors_h -#include "wtf/text/StringBuilder.h" -#include "wtf/text/TextPosition.h" +#include <wtf/text/StringBuilder.h> +#include <wtf/text/TextPosition.h> namespace WebCore { diff --git a/chromium/third_party/WebKit/Source/core/xml/XMLHttpRequest.cpp b/chromium/third_party/WebKit/Source/core/xml/XMLHttpRequest.cpp index 9dc97ee7509..e65a4a720fd 100644 --- a/chromium/third_party/WebKit/Source/core/xml/XMLHttpRequest.cpp +++ b/chromium/third_party/WebKit/Source/core/xml/XMLHttpRequest.cpp @@ -260,10 +260,12 @@ Document* XMLHttpRequest::responseXML(ExceptionState& es) return m_responseDocument.get(); } -Blob* XMLHttpRequest::responseBlob() +Blob* XMLHttpRequest::responseBlob(ExceptionState& es) { - ASSERT(m_responseTypeCode == ResponseTypeBlob); - + if (m_responseTypeCode != ResponseTypeBlob) { + es.throwDOMException(InvalidStateError); + return 0; + } // We always return null before DONE. if (m_error || m_state != DONE) return 0; @@ -293,9 +295,12 @@ Blob* XMLHttpRequest::responseBlob() return m_responseBlob.get(); } -ArrayBuffer* XMLHttpRequest::responseArrayBuffer() +ArrayBuffer* XMLHttpRequest::responseArrayBuffer(ExceptionState& es) { - ASSERT(m_responseTypeCode == ResponseTypeArrayBuffer); + if (m_responseTypeCode != ResponseTypeArrayBuffer) { + es.throwDOMException(InvalidStateError); + return 0; + } if (m_error || m_state != DONE) return 0; diff --git a/chromium/third_party/WebKit/Source/core/xml/XMLHttpRequest.h b/chromium/third_party/WebKit/Source/core/xml/XMLHttpRequest.h index a4316f1cdbe..fde3a84be50 100644 --- a/chromium/third_party/WebKit/Source/core/xml/XMLHttpRequest.h +++ b/chromium/third_party/WebKit/Source/core/xml/XMLHttpRequest.h @@ -108,7 +108,7 @@ public: String getResponseHeader(const AtomicString& name, ExceptionState&) const; ScriptString responseText(ExceptionState&); Document* responseXML(ExceptionState&); - Blob* responseBlob(); + Blob* responseBlob(ExceptionState&); unsigned long timeout() const { return m_timeoutMilliseconds; } void setTimeout(unsigned long timeout, ExceptionState&); @@ -124,7 +124,7 @@ public: ResponseTypeCode responseTypeCode() const { return m_responseTypeCode; } // response attribute has custom getter. - ArrayBuffer* responseArrayBuffer(); + ArrayBuffer* responseArrayBuffer(ExceptionState&); void setLastSendLineNumber(unsigned lineNumber) { m_lastSendLineNumber = lineNumber; } void setLastSendURL(const String& url) { m_lastSendURL = url; } diff --git a/chromium/third_party/WebKit/Source/core/xml/XMLHttpRequestUpload.cpp b/chromium/third_party/WebKit/Source/core/xml/XMLHttpRequestUpload.cpp index 8803da05361..770e4954c7c 100644 --- a/chromium/third_party/WebKit/Source/core/xml/XMLHttpRequestUpload.cpp +++ b/chromium/third_party/WebKit/Source/core/xml/XMLHttpRequestUpload.cpp @@ -30,8 +30,8 @@ #include "core/dom/EventNames.h" #include "core/xml/XMLHttpRequest.h" #include "core/xml/XMLHttpRequestProgressEvent.h" -#include "wtf/Assertions.h" -#include "wtf/text/AtomicString.h" +#include <wtf/Assertions.h> +#include <wtf/text/AtomicString.h> namespace WebCore { diff --git a/chromium/third_party/WebKit/Source/core/xml/XMLSerializer.cpp b/chromium/third_party/WebKit/Source/core/xml/XMLSerializer.cpp index 3b056364981..ad32db4ad5a 100644 --- a/chromium/third_party/WebKit/Source/core/xml/XMLSerializer.cpp +++ b/chromium/third_party/WebKit/Source/core/xml/XMLSerializer.cpp @@ -24,7 +24,7 @@ #include "core/dom/Document.h" #include "core/dom/ExceptionCode.h" #include "core/editing/markup.h" -#include "wtf/text/WTFString.h" +#include <wtf/text/WTFString.h> namespace WebCore { diff --git a/chromium/third_party/WebKit/Source/core/xml/XPathExpression.cpp b/chromium/third_party/WebKit/Source/core/xml/XPathExpression.cpp index 0850a92a65d..0e587e3cc25 100644 --- a/chromium/third_party/WebKit/Source/core/xml/XPathExpression.cpp +++ b/chromium/third_party/WebKit/Source/core/xml/XPathExpression.cpp @@ -34,7 +34,7 @@ #include "core/xml/XPathParser.h" #include "core/xml/XPathResult.h" #include "core/xml/XPathUtil.h" -#include "wtf/text/WTFString.h" +#include <wtf/text/WTFString.h> namespace WebCore { diff --git a/chromium/third_party/WebKit/Source/core/xml/XPathExpressionNode.cpp b/chromium/third_party/WebKit/Source/core/xml/XPathExpressionNode.cpp index 524a48d65d4..a534976e36f 100644 --- a/chromium/third_party/WebKit/Source/core/xml/XPathExpressionNode.cpp +++ b/chromium/third_party/WebKit/Source/core/xml/XPathExpressionNode.cpp @@ -28,7 +28,7 @@ #include "core/xml/XPathExpressionNode.h" #include "core/dom/Node.h" -#include "wtf/StdLibExtras.h" +#include <wtf/StdLibExtras.h> namespace WebCore { namespace XPath { diff --git a/chromium/third_party/WebKit/Source/core/xml/XPathExpressionNode.h b/chromium/third_party/WebKit/Source/core/xml/XPathExpressionNode.h index 7101a562edf..64a930d2737 100644 --- a/chromium/third_party/WebKit/Source/core/xml/XPathExpressionNode.h +++ b/chromium/third_party/WebKit/Source/core/xml/XPathExpressionNode.h @@ -29,9 +29,9 @@ #include "core/dom/Node.h" #include "core/xml/XPathValue.h" -#include "wtf/HashMap.h" -#include "wtf/Vector.h" -#include "wtf/text/StringHash.h" +#include <wtf/HashMap.h> +#include <wtf/text/StringHash.h> +#include <wtf/Vector.h> namespace WebCore { diff --git a/chromium/third_party/WebKit/Source/core/xml/XPathFunctions.cpp b/chromium/third_party/WebKit/Source/core/xml/XPathFunctions.cpp index 0af3a8bbfb3..0e9f977361d 100644 --- a/chromium/third_party/WebKit/Source/core/xml/XPathFunctions.cpp +++ b/chromium/third_party/WebKit/Source/core/xml/XPathFunctions.cpp @@ -34,8 +34,8 @@ #include "core/dom/TreeScope.h" #include "core/xml/XPathUtil.h" #include "core/xml/XPathValue.h" -#include "wtf/MathExtras.h" -#include "wtf/text/StringBuilder.h" +#include <wtf/MathExtras.h> +#include <wtf/text/StringBuilder.h> namespace WebCore { namespace XPath { diff --git a/chromium/third_party/WebKit/Source/core/xml/XPathGrammar.y b/chromium/third_party/WebKit/Source/core/xml/XPathGrammar.y index a4f5b692cff..e2a8c23390d 100644 --- a/chromium/third_party/WebKit/Source/core/xml/XPathGrammar.y +++ b/chromium/third_party/WebKit/Source/core/xml/XPathGrammar.y @@ -36,7 +36,7 @@ #include "core/xml/XPathPredicate.h" #include "core/xml/XPathStep.h" #include "core/xml/XPathVariableReference.h" -#include "wtf/FastMalloc.h" +#include <wtf/FastMalloc.h> #define YYMALLOC fastMalloc #define YYFREE fastFree diff --git a/chromium/third_party/WebKit/Source/core/xml/XPathNodeSet.h b/chromium/third_party/WebKit/Source/core/xml/XPathNodeSet.h index c90e395ded4..488fe8797b6 100644 --- a/chromium/third_party/WebKit/Source/core/xml/XPathNodeSet.h +++ b/chromium/third_party/WebKit/Source/core/xml/XPathNodeSet.h @@ -26,8 +26,8 @@ #ifndef XPathNodeSet_h #define XPathNodeSet_h -#include "wtf/Forward.h" -#include "wtf/Vector.h" +#include <wtf/Forward.h> +#include <wtf/Vector.h> #include "core/dom/Node.h" diff --git a/chromium/third_party/WebKit/Source/core/xml/XPathParser.cpp b/chromium/third_party/WebKit/Source/core/xml/XPathParser.cpp index 3fe9b350ccf..4f2c8b26e2d 100644 --- a/chromium/third_party/WebKit/Source/core/xml/XPathParser.cpp +++ b/chromium/third_party/WebKit/Source/core/xml/XPathParser.cpp @@ -34,8 +34,8 @@ #include "core/xml/XPathNSResolver.h" #include "core/xml/XPathPath.h" #include "core/xml/XPathStep.h" -#include "wtf/StdLibExtras.h" -#include "wtf/text/StringHash.h" +#include <wtf/StdLibExtras.h> +#include <wtf/text/StringHash.h> using namespace WebCore; using namespace WTF; diff --git a/chromium/third_party/WebKit/Source/core/xml/XPathPredicate.cpp b/chromium/third_party/WebKit/Source/core/xml/XPathPredicate.cpp index 963e115a626..3a77f7d0a6c 100644 --- a/chromium/third_party/WebKit/Source/core/xml/XPathPredicate.cpp +++ b/chromium/third_party/WebKit/Source/core/xml/XPathPredicate.cpp @@ -32,7 +32,7 @@ #include "core/xml/XPathFunctions.h" #include "core/xml/XPathUtil.h" #include "core/xml/XPathValue.h" -#include "wtf/MathExtras.h" +#include <wtf/MathExtras.h> namespace WebCore { namespace XPath { diff --git a/chromium/third_party/WebKit/Source/core/xml/XPathUtil.cpp b/chromium/third_party/WebKit/Source/core/xml/XPathUtil.cpp index 5967efa025d..9ee19c8bf91 100644 --- a/chromium/third_party/WebKit/Source/core/xml/XPathUtil.cpp +++ b/chromium/third_party/WebKit/Source/core/xml/XPathUtil.cpp @@ -29,7 +29,7 @@ #include "core/dom/ContainerNode.h" #include "core/dom/NodeTraversal.h" -#include "wtf/text/StringBuilder.h" +#include <wtf/text/StringBuilder.h> namespace WebCore { namespace XPath { diff --git a/chromium/third_party/WebKit/Source/core/xml/XPathUtil.h b/chromium/third_party/WebKit/Source/core/xml/XPathUtil.h index 9db3314ec9d..62b65994e3c 100644 --- a/chromium/third_party/WebKit/Source/core/xml/XPathUtil.h +++ b/chromium/third_party/WebKit/Source/core/xml/XPathUtil.h @@ -27,8 +27,8 @@ #ifndef XPathUtil_h #define XPathUtil_h -#include "wtf/Forward.h" -#include "wtf/Vector.h" +#include <wtf/Forward.h> +#include <wtf/Vector.h> namespace WebCore { diff --git a/chromium/third_party/WebKit/Source/core/xml/XPathValue.cpp b/chromium/third_party/WebKit/Source/core/xml/XPathValue.cpp index 301356cd6ea..2bd56c0d86b 100644 --- a/chromium/third_party/WebKit/Source/core/xml/XPathValue.cpp +++ b/chromium/third_party/WebKit/Source/core/xml/XPathValue.cpp @@ -30,8 +30,8 @@ #include <limits> #include "core/xml/XPathExpressionNode.h" #include "core/xml/XPathUtil.h" -#include "wtf/MathExtras.h" -#include "wtf/StdLibExtras.h" +#include <wtf/MathExtras.h> +#include <wtf/StdLibExtras.h> using std::numeric_limits; diff --git a/chromium/third_party/WebKit/Source/core/xml/XPathValue.h b/chromium/third_party/WebKit/Source/core/xml/XPathValue.h index c21a8dc2b4f..a693e7187f8 100644 --- a/chromium/third_party/WebKit/Source/core/xml/XPathValue.h +++ b/chromium/third_party/WebKit/Source/core/xml/XPathValue.h @@ -28,7 +28,7 @@ #define XPathValue_h #include "core/xml/XPathNodeSet.h" -#include "wtf/text/WTFString.h" +#include <wtf/text/WTFString.h> namespace WebCore { diff --git a/chromium/third_party/WebKit/Source/core/xml/XSLImportRule.cpp b/chromium/third_party/WebKit/Source/core/xml/XSLImportRule.cpp index b6917afa228..242303c2172 100644 --- a/chromium/third_party/WebKit/Source/core/xml/XSLImportRule.cpp +++ b/chromium/third_party/WebKit/Source/core/xml/XSLImportRule.cpp @@ -24,9 +24,9 @@ #include "FetchInitiatorTypeNames.h" #include "core/dom/Document.h" -#include "core/fetch/FetchRequest.h" -#include "core/fetch/ResourceFetcher.h" -#include "core/fetch/XSLStyleSheetResource.h" +#include "core/loader/cache/FetchRequest.h" +#include "core/loader/cache/ResourceFetcher.h" +#include "core/loader/cache/XSLStyleSheetResource.h" #include "core/xml/XSLStyleSheet.h" namespace WebCore { diff --git a/chromium/third_party/WebKit/Source/core/xml/XSLImportRule.h b/chromium/third_party/WebKit/Source/core/xml/XSLImportRule.h index e78fc08585a..63355d1182c 100644 --- a/chromium/third_party/WebKit/Source/core/xml/XSLImportRule.h +++ b/chromium/third_party/WebKit/Source/core/xml/XSLImportRule.h @@ -23,10 +23,10 @@ #ifndef XSLImportRule_h #define XSLImportRule_h -#include "core/fetch/ResourcePtr.h" -#include "core/fetch/StyleSheetResourceClient.h" +#include "core/loader/cache/ResourcePtr.h" +#include "core/loader/cache/StyleSheetResourceClient.h" #include "core/xml/XSLStyleSheet.h" -#include "wtf/PassOwnPtr.h" +#include <wtf/PassOwnPtr.h> namespace WebCore { diff --git a/chromium/third_party/WebKit/Source/core/xml/XSLStyleSheet.h b/chromium/third_party/WebKit/Source/core/xml/XSLStyleSheet.h index 3ca331a7beb..f7b47c53b63 100644 --- a/chromium/third_party/WebKit/Source/core/xml/XSLStyleSheet.h +++ b/chromium/third_party/WebKit/Source/core/xml/XSLStyleSheet.h @@ -27,7 +27,7 @@ #include <libxslt/transform.h> #include "core/css/StyleSheet.h" #include "core/dom/ProcessingInstruction.h" -#include "wtf/PassRefPtr.h" +#include <wtf/PassRefPtr.h> namespace WebCore { diff --git a/chromium/third_party/WebKit/Source/core/xml/XSLTProcessor.cpp b/chromium/third_party/WebKit/Source/core/xml/XSLTProcessor.cpp index d1807cd1cfb..043fd8de7e6 100644 --- a/chromium/third_party/WebKit/Source/core/xml/XSLTProcessor.cpp +++ b/chromium/third_party/WebKit/Source/core/xml/XSLTProcessor.cpp @@ -21,6 +21,7 @@ */ #include "config.h" + #include "core/xml/XSLTProcessor.h" #include "core/dom/DOMImplementation.h" @@ -32,8 +33,9 @@ #include "core/page/Frame.h" #include "core/page/FrameView.h" #include "weborigin/SecurityOrigin.h" -#include "wtf/Assertions.h" -#include "wtf/Vector.h" + +#include <wtf/Assertions.h> +#include <wtf/Vector.h> namespace WebCore { diff --git a/chromium/third_party/WebKit/Source/core/xml/XSLTProcessorLibxslt.cpp b/chromium/third_party/WebKit/Source/core/xml/XSLTProcessorLibxslt.cpp index b9e111b2465..6e3866cd2fc 100644 --- a/chromium/third_party/WebKit/Source/core/xml/XSLTProcessorLibxslt.cpp +++ b/chromium/third_party/WebKit/Source/core/xml/XSLTProcessorLibxslt.cpp @@ -21,12 +21,22 @@ */ #include "config.h" + #include "core/xml/XSLTProcessor.h" +#include <libxslt/imports.h> +#include <libxslt/security.h> +#include <libxslt/variables.h> +#include <libxslt/xsltutils.h> +#include <wtf/Assertions.h> +#include <wtf/text/CString.h> +#include <wtf/text/StringBuffer.h> +#include <wtf/unicode/UTF8.h> +#include <wtf/Vector.h> #include "core/dom/Document.h" #include "core/dom/TransformSource.h" #include "core/editing/markup.h" -#include "core/fetch/ResourceFetcher.h" +#include "core/loader/cache/ResourceFetcher.h" #include "core/page/Frame.h" #include "core/page/Page.h" #include "core/page/PageConsole.h" @@ -38,15 +48,6 @@ #include "core/xml/XSLTUnicodeSort.h" #include "core/xml/parser/XMLDocumentParser.h" #include "weborigin/SecurityOrigin.h" -#include "wtf/Assertions.h" -#include "wtf/Vector.h" -#include "wtf/text/CString.h" -#include "wtf/text/StringBuffer.h" -#include "wtf/unicode/UTF8.h" -#include <libxslt/imports.h> -#include <libxslt/security.h> -#include <libxslt/variables.h> -#include <libxslt/xsltutils.h> namespace WebCore { diff --git a/chromium/third_party/WebKit/Source/core/xml/XSLTUnicodeSort.cpp b/chromium/third_party/WebKit/Source/core/xml/XSLTUnicodeSort.cpp index 83342cb6900..316b5c4817e 100644 --- a/chromium/third_party/WebKit/Source/core/xml/XSLTUnicodeSort.cpp +++ b/chromium/third_party/WebKit/Source/core/xml/XSLTUnicodeSort.cpp @@ -29,10 +29,10 @@ #include "config.h" #include "core/xml/XSLTUnicodeSort.h" -#include "wtf/text/WTFString.h" -#include "wtf/unicode/Collator.h" #include <libxslt/templates.h> #include <libxslt/xsltutils.h> +#include <wtf/text/WTFString.h> +#include <wtf/unicode/Collator.h> namespace WebCore { diff --git a/chromium/third_party/WebKit/Source/core/xml/parser/XMLDocumentParser.cpp b/chromium/third_party/WebKit/Source/core/xml/parser/XMLDocumentParser.cpp index 7f2b90f381d..197868f423f 100644 --- a/chromium/third_party/WebKit/Source/core/xml/parser/XMLDocumentParser.cpp +++ b/chromium/third_party/WebKit/Source/core/xml/parser/XMLDocumentParser.cpp @@ -26,6 +26,15 @@ #include "config.h" #include "core/xml/parser/XMLDocumentParser.h" +#include <libxml/parser.h> +#include <libxml/parserInternals.h> +#include <libxslt/xslt.h> +#include <wtf/StringExtras.h> +#include <wtf/text/CString.h> +#include <wtf/Threading.h> +#include <wtf/unicode/UTF8.h> +#include <wtf/UnusedParam.h> +#include <wtf/Vector.h> #include "HTMLNames.h" #include "XMLNSNames.h" #include "bindings/v8/ExceptionState.h" @@ -40,14 +49,14 @@ #include "core/dom/ProcessingInstruction.h" #include "core/dom/ScriptLoader.h" #include "core/dom/TransformSource.h" -#include "core/fetch/ResourceFetcher.h" -#include "core/fetch/ScriptResource.h" #include "core/html/HTMLHtmlElement.h" #include "core/html/HTMLTemplateElement.h" #include "core/html/parser/HTMLEntityParser.h" #include "core/loader/FrameLoader.h" #include "core/loader/ImageLoader.h" #include "core/loader/TextResourceDecoder.h" +#include "core/loader/cache/ResourceFetcher.h" +#include "core/loader/cache/ScriptResource.h" #include "core/page/Frame.h" #include "core/page/UseCounter.h" #include "core/platform/network/ResourceError.h" @@ -58,16 +67,7 @@ #include "core/xml/parser/XMLDocumentParserScope.h" #include "core/xml/parser/XMLParserInput.h" #include "weborigin/SecurityOrigin.h" -#include "wtf/StringExtras.h" #include "wtf/TemporaryChange.h" -#include "wtf/Threading.h" -#include "wtf/UnusedParam.h" -#include "wtf/Vector.h" -#include "wtf/text/CString.h" -#include "wtf/unicode/UTF8.h" -#include <libxml/parser.h> -#include <libxml/parserInternals.h> -#include <libxslt/xslt.h> using namespace std; diff --git a/chromium/third_party/WebKit/Source/core/xml/parser/XMLDocumentParser.h b/chromium/third_party/WebKit/Source/core/xml/parser/XMLDocumentParser.h index 64b1898eedc..72334821501 100644 --- a/chromium/third_party/WebKit/Source/core/xml/parser/XMLDocumentParser.h +++ b/chromium/third_party/WebKit/Source/core/xml/parser/XMLDocumentParser.h @@ -27,15 +27,15 @@ #include "core/dom/ParserContentPolicy.h" #include "core/dom/ScriptableDocumentParser.h" -#include "core/fetch/ResourceClient.h" -#include "core/fetch/ResourcePtr.h" +#include "core/loader/cache/ResourceClient.h" +#include "core/loader/cache/ResourcePtr.h" #include "core/platform/text/SegmentedString.h" #include "core/xml/XMLErrors.h" -#include "wtf/HashMap.h" -#include "wtf/OwnPtr.h" -#include "wtf/text/CString.h" -#include "wtf/text/StringHash.h" #include <libxml/tree.h> +#include <wtf/HashMap.h> +#include <wtf/OwnPtr.h> +#include <wtf/text/CString.h> +#include <wtf/text/StringHash.h> namespace WebCore { diff --git a/chromium/third_party/WebKit/Source/core/xml/parser/XMLDocumentParserScope.h b/chromium/third_party/WebKit/Source/core/xml/parser/XMLDocumentParserScope.h index 613d165cb27..510c5838a2c 100644 --- a/chromium/third_party/WebKit/Source/core/xml/parser/XMLDocumentParserScope.h +++ b/chromium/third_party/WebKit/Source/core/xml/parser/XMLDocumentParserScope.h @@ -26,7 +26,8 @@ #ifndef XMLDocumentParserScope_h #define XMLDocumentParserScope_h -#include "wtf/Noncopyable.h" +#include <wtf/Noncopyable.h> + #include <libxml/xmlerror.h> namespace WebCore { diff --git a/chromium/third_party/WebKit/Source/devtools/devtools.gyp b/chromium/third_party/WebKit/Source/devtools/devtools.gyp index b458f6e9b58..1eb4103cfc1 100644 --- a/chromium/third_party/WebKit/Source/devtools/devtools.gyp +++ b/chromium/third_party/WebKit/Source/devtools/devtools.gyp @@ -105,7 +105,6 @@ 'front_end/JavaScriptFormatter.js', 'front_end/jsdifflib.js', 'front_end/KeyboardShortcut.js', - 'front_end/LayersPanelDescriptor.js', 'front_end/Linkifier.js', 'front_end/LiveEditSupport.js', 'front_end/NativeBreakpointsSidebarPane.js', @@ -232,7 +231,6 @@ 'front_end/textPrompt.css', 'front_end/timelinePanel.css', 'front_end/canvasProfiler.css', - 'front_end/layersPanel.css', ], 'devtools_elements_js_files': [ 'front_end/CSSNamedFlowCollectionsView.js', @@ -352,7 +350,6 @@ '<@(devtools_timeline_js_files)', '<@(devtools_profiles_js_files)', '<@(devtools_audits_js_files)', - '<@(devtools_layers_js_files)', '<@(devtools_codemirror_js_files)', ], 'devtools_uglifyjs_files': [ @@ -460,14 +457,6 @@ 'front_end/Images/trackHoriz.png', 'front_end/Images/trackVert.png', ], - - 'devtools_layers_js_files': [ - 'front_end/LayersPanel.js', - 'front_end/LayerTreeModel.js', - 'front_end/LayerTree.js', - 'front_end/Layers3DView.js', - ], - 'devtools_extension_api_files': [ 'front_end/ExtensionAPI.js', 'front_end/DevToolsExtensionAPI.js' @@ -492,7 +481,6 @@ 'concatenated_devtools_profiles_js', 'concatenated_devtools_audits_js', 'concatenated_devtools_codemirror_js', - 'concatenated_devtools_layers_js', 'concatenated_heap_snapshot_worker_js', 'concatenated_script_formatter_worker_js', 'concatenated_devtools_css'], @@ -578,7 +566,6 @@ 'concatenated_devtools_profiles_js', 'concatenated_devtools_audits_js', 'concatenated_devtools_codemirror_js', - 'concatenated_devtools_layers_js', 'concatenated_heap_snapshot_worker_js', 'concatenated_script_formatter_worker_js', 'concatenated_devtools_css'], @@ -595,7 +582,6 @@ '<(PRODUCT_DIR)/resources/inspector/TimelinePanel.js', '<(PRODUCT_DIR)/resources/inspector/ProfilesPanel.js', '<(PRODUCT_DIR)/resources/inspector/AuditsPanel.js', - '<(PRODUCT_DIR)/resources/inspector/LayersPanel.js', '<(PRODUCT_DIR)/resources/inspector/CodeMirrorTextEditor.js', '<(PRODUCT_DIR)/resources/inspector/HeapSnapshotWorker.js', '<(PRODUCT_DIR)/resources/inspector/ScriptFormatterWorker.js', @@ -871,22 +857,6 @@ }], }, { - 'target_name': 'concatenated_devtools_layers_js', - 'type': 'none', - 'actions': [{ - 'action_name': 'concatenate_devtools_layers_js', - 'script_name': 'scripts/inline_js_imports.py', - 'input_file': 'front_end/LayersPanel.js', - 'inputs': [ - '<@(_script_name)', - '<@(devtools_layers_js_files)', - ], - 'search_path': 'front_end', - 'outputs': ['<(PRODUCT_DIR)/resources/inspector/LayersPanel.js'], - 'action': ['python', '<@(_script_name)', '<@(_input_file)', '<@(_search_path)', '<@(_outputs)'], - }], - }, - { 'target_name': 'concatenated_devtools_css', 'type': 'none', 'dependencies': [ diff --git a/chromium/third_party/WebKit/Source/devtools/front_end/AuditLauncherView.js b/chromium/third_party/WebKit/Source/devtools/front_end/AuditLauncherView.js index 3ff4e4e9930..b5f777e5295 100644 --- a/chromium/third_party/WebKit/Source/devtools/front_end/AuditLauncherView.js +++ b/chromium/third_party/WebKit/Source/devtools/front_end/AuditLauncherView.js @@ -141,7 +141,7 @@ WebInspector.AuditLauncherView.prototype = { if (this._auditRunning === auditRunning) return; this._auditRunning = auditRunning; - this._launchButton.textContent = this._auditRunning ? WebInspector.UIString("Stop") : WebInspector.UIString("Run"); + this._updateButton(); this._toggleUIComponents(this._auditRunning); if (this._auditRunning) this._startAudit(); @@ -208,6 +208,17 @@ WebInspector.AuditLauncherView.prototype = { _categoryClicked: function() { this._selectedCategoriesUpdated(true); + this._selectAllCheckboxElement.checked = this._checkedCategoriesCount === this._sortedCategories.length; + }, + + _updateCheckedCategoriesCount: function() + { + this._checkedCategoriesCount = 0; + var checkboxes = this._categoriesElement.getElementsByTagName("input"); + for (var i = 0; i < checkboxes.length; ++i) { + if (checkboxes[i].checked) + this._checkedCategoriesCount += 1; + } }, /** @@ -252,6 +263,7 @@ WebInspector.AuditLauncherView.prototype = { this._contentElement.appendChild(categoryElement); this._categoriesElement = this._contentElement.createChild("fieldset", "audit-categories-container"); + this._checkedCategoriesCount = 0; this._contentElement.createChild("div", "flexible-space"); @@ -289,14 +301,7 @@ WebInspector.AuditLauncherView.prototype = { */ _selectedCategoriesUpdated: function(userGesture) { - var checkedCategoriesCount = 0; - var checkboxes = this._categoriesElement.getElementsByTagName("input"); - for (var i = 0; i < checkboxes.length; ++i) { - if (checkboxes[i].checked) - ++checkedCategoriesCount; - } - this._launchButton.disabled = checkedCategoriesCount === 0; - this._selectAllCheckboxElement.checked = checkedCategoriesCount === this._sortedCategories.length; + this._updateCheckedCategoriesCount(); // Save present categories only upon user gesture to clean up junk from past versions and removed extensions. // Do not remove old categories if not handling a user gesture, as there's chance categories will be added @@ -307,6 +312,13 @@ WebInspector.AuditLauncherView.prototype = { selectedCategories[childNodes[i].__displayName] = childNodes[i].firstChild.checked; selectedCategories[WebInspector.AuditLauncherView.AllCategoriesKey] = this._selectAllCheckboxElement.checked; this._selectedCategoriesSetting.set(selectedCategories); + this._updateButton(); + }, + + _updateButton: function() + { + this._launchButton.textContent = this._auditRunning ? WebInspector.UIString("Stop") : WebInspector.UIString("Run"); + this._launchButton.disabled = !this._checkedCategoriesCount; }, __proto__: WebInspector.View.prototype diff --git a/chromium/third_party/WebKit/Source/devtools/front_end/CPUProfileView.js b/chromium/third_party/WebKit/Source/devtools/front_end/CPUProfileView.js index 3a3153bf75a..ff9a152531c 100644 --- a/chromium/third_party/WebKit/Source/devtools/front_end/CPUProfileView.js +++ b/chromium/third_party/WebKit/Source/devtools/front_end/CPUProfileView.js @@ -143,6 +143,9 @@ WebInspector.CPUProfileView.prototype = { this._calculateTimes(profile); + if (profile.idleTime) + this._injectIdleTimeNode(profile); + this._assignParentsInProfile(); if (this.samples) this._buildIdToNodeMap(); @@ -628,6 +631,39 @@ WebInspector.CPUProfileView.prototype = { } }, + /** + * @param {ProfilerAgent.CPUProfile} profile + */ + _injectIdleTimeNode: function(profile) + { + var idleTime = profile.idleTime; + var nodes = profile.head.children; + + var programNode = {selfTime: 0}; + for (var i = nodes.length - 1; i >= 0; --i) { + if (nodes[i].functionName === "(program)") { + programNode = nodes[i]; + break; + } + } + var programTime = programNode.selfTime; + if (idleTime > programTime) + idleTime = programTime; + programTime = programTime - idleTime; + programNode.selfTime = programTime; + programNode.totalTime = programTime; + var idleNode = { + functionName: "(idle)", + url: null, + lineNumber: 0, + totalTime: idleTime, + selfTime: idleTime, + callUID: 0, + children: [] + }; + nodes.push(idleNode); + }, + __proto__: WebInspector.View.prototype } diff --git a/chromium/third_party/WebKit/Source/devtools/front_end/CanvasProfileView.js b/chromium/third_party/WebKit/Source/devtools/front_end/CanvasProfileView.js index 76094be452a..02e7b4d01a6 100644 --- a/chromium/third_party/WebKit/Source/devtools/front_end/CanvasProfileView.js +++ b/chromium/third_party/WebKit/Source/devtools/front_end/CanvasProfileView.js @@ -484,13 +484,12 @@ WebInspector.CanvasProfileView.prototype = { { var element = parentElement.createChild("span", "canvas-call-argument"); element._argumentIndex = -1; - var description = callArgument.enumName || callArgument.description; if (callArgument.type === "string") { const maxStringLength = 150; element.createTextChild("\""); - element.createChild("span", "canvas-formatted-string").textContent = description.trimMiddle(maxStringLength); + element.createChild("span", "canvas-formatted-string").textContent = callArgument.description.trimMiddle(maxStringLength); element.createTextChild("\""); - element._suppressPopover = (description.length <= maxStringLength && !/[\r\n]/.test(description)); + element._suppressPopover = (callArgument.description.length <= maxStringLength && !/[\r\n]/.test(callArgument.description)); } else { var type = callArgument.subtype || callArgument.type; if (type) { @@ -502,11 +501,11 @@ WebInspector.CanvasProfileView.prototype = { element._suppressPopover = true; break; case "number": - element._suppressPopover = !isNaN(description); + element._suppressPopover = !isNaN(callArgument.description); break; } } - element.textContent = description; + element.textContent = callArgument.description; } if (callArgument.resourceId) { element.addStyleClass("canvas-formatted-resource"); diff --git a/chromium/third_party/WebKit/Source/devtools/front_end/CodeMirrorTextEditor.js b/chromium/third_party/WebKit/Source/devtools/front_end/CodeMirrorTextEditor.js index 029f07fe4a4..fa7c6d4323f 100644 --- a/chromium/third_party/WebKit/Source/devtools/front_end/CodeMirrorTextEditor.js +++ b/chromium/third_party/WebKit/Source/devtools/front_end/CodeMirrorTextEditor.js @@ -856,10 +856,6 @@ WebInspector.CodeMirrorTextEditor.prototype = { { }, - /** - * @param {number} width - * @param {number} height - */ _updatePaddingBottom: function(width, height) { var scrollInfo = this._codeMirror.getScrollInfo(); @@ -877,12 +873,9 @@ WebInspector.CodeMirrorTextEditor.prototype = { _resizeEditor: function() { - var parentElement = this.element.parentElement; - if (!parentElement || !this.isShowing()) - return; var scrollInfo = this._codeMirror.getScrollInfo(); - var width = parentElement.offsetWidth; - var height = parentElement.offsetHeight; + var width = this.element.parentElement.offsetWidth; + var height = this.element.parentElement.offsetHeight; this._codeMirror.setSize(width, height); this._updatePaddingBottom(width, height); this._codeMirror.scrollTo(scrollInfo.left, scrollInfo.top); diff --git a/chromium/third_party/WebKit/Source/devtools/front_end/DebuggerModel.js b/chromium/third_party/WebKit/Source/devtools/front_end/DebuggerModel.js index da464fbe3c0..cffad006043 100644 --- a/chromium/third_party/WebKit/Source/devtools/front_end/DebuggerModel.js +++ b/chromium/third_party/WebKit/Source/devtools/front_end/DebuggerModel.js @@ -167,24 +167,6 @@ WebInspector.DebuggerModel.prototype = { /** * @param {WebInspector.DebuggerModel.Location} rawLocation - */ - stepIntoSelection: function(rawLocation) - { - /** - * @param {WebInspector.DebuggerModel.Location} requestedLocation - * @param {?string} error - */ - function callback(requestedLocation, error) - { - if (error) - return; - this._pendingStepIntoLocation = requestedLocation; - }; - DebuggerAgent.continueToLocation(rawLocation, true, callback.bind(this, rawLocation)); - }, - - /** - * @param {WebInspector.DebuggerModel.Location} rawLocation * @param {string} condition * @param {function(?DebuggerAgent.BreakpointId, Array.<WebInspector.DebuggerModel.Location>):void=} callback */ @@ -383,19 +365,6 @@ WebInspector.DebuggerModel.prototype = { */ _pausedScript: function(callFrames, reason, auxData, breakpointIds) { - if (this._pendingStepIntoLocation) { - var requestedLocation = this._pendingStepIntoLocation; - delete this._pendingStepIntoLocation; - - if (callFrames.length > 0) { - var topLocation = callFrames[0].location; - if (topLocation.lineNumber == requestedLocation.lineNumber && topLocation.columnNumber == requestedLocation.columnNumber && topLocation.scriptId == requestedLocation.scriptId) { - DebuggerAgent.stepInto(); - return; - } - } - } - this._setDebuggerPausedDetails(new WebInspector.DebuggerPausedDetails(this, callFrames, reason, auxData, breakpointIds)); }, @@ -505,11 +474,7 @@ WebInspector.DebuggerModel.prototype = { function updateExecutionLine(uiLocation) { - var data = { - uiLocation: uiLocation, - callFrame: callFrame - }; - this.dispatchEventToListeners(WebInspector.DebuggerModel.Events.ExecutionLineChanged, data); + this.dispatchEventToListeners(WebInspector.DebuggerModel.Events.ExecutionLineChanged, uiLocation); } this._executionLineLiveLocation = callFrame.script.createLiveLocation(callFrame.location, updateExecutionLine.bind(this)); }, @@ -849,29 +814,6 @@ WebInspector.DebuggerModel.CallFrame.prototype = { }, /** - * @param {function(Array.<DebuggerAgent.Location>)} callback - */ - getStepIntoLocations: function(callback) - { - if (this._stepInLocations) { - callback(this._stepInLocations.slice(0)); - return; - } - /** - * @param {?string} error - * @param {Array.<DebuggerAgent.Location>=} stepInPositions - */ - function getStepInPositionsCallback(error, stepInPositions) { - if (error) { - return; - } - this._stepInLocations = stepInPositions; - callback(this._stepInLocations.slice(0)); - } - DebuggerAgent.getStepInPositions(this.id, getStepInPositionsCallback.bind(this)); - }, - - /** * @param {function(WebInspector.UILocation):(boolean|undefined)} updateDelegate */ createLiveLocation: function(updateDelegate) diff --git a/chromium/third_party/WebKit/Source/devtools/front_end/JavaScriptSourceFrame.js b/chromium/third_party/WebKit/Source/devtools/front_end/JavaScriptSourceFrame.js index c35d6706a8d..e245d9e2683 100644 --- a/chromium/third_party/WebKit/Source/devtools/front_end/JavaScriptSourceFrame.js +++ b/chromium/third_party/WebKit/Source/devtools/front_end/JavaScriptSourceFrame.js @@ -51,10 +51,6 @@ WebInspector.JavaScriptSourceFrame = function(scriptsPanel, uiSourceCode) this.textEditor.addEventListener(WebInspector.TextEditor.Events.GutterClick, this._handleGutterClick.bind(this), this); - this.textEditor.element.addEventListener("mousedown", this._onMouseDownAndClick.bind(this, true), true); - this.textEditor.element.addEventListener("click", this._onMouseDownAndClick.bind(this, false), true); - - this._breakpointManager.addEventListener(WebInspector.BreakpointManager.Events.BreakpointAdded, this._breakpointAdded, this); this._breakpointManager.addEventListener(WebInspector.BreakpointManager.Events.BreakpointRemoved, this._breakpointRemoved, this); @@ -364,12 +360,6 @@ WebInspector.JavaScriptSourceFrame.prototype = { if (this._popoverHelper.isPopoverVisible()) { this._popoverHelper.hidePopover(); event.consume(); - return; - } - if (this._stepIntoMarkup && WebInspector.KeyboardShortcut.eventHasCtrlOrMeta(event)) { - this._stepIntoMarkup.moveSelectionTo(-1); - event.consume(); - return; } } }, @@ -426,44 +416,23 @@ WebInspector.JavaScriptSourceFrame.prototype = { /** * @param {number} lineNumber - * @param {WebInspector.DebuggerModel.CallFrame} callFrame */ - setExecutionLine: function(lineNumber, callFrame) + setExecutionLine: function(lineNumber) { this._executionLineNumber = lineNumber; - this._executionCallFrame = callFrame; if (this.loaded) { this.textEditor.setExecutionLine(lineNumber); this.revealLine(this._executionLineNumber); if (this.canEditSource()) this.setSelection(WebInspector.TextRange.createFromLocation(lineNumber, 0)); - - /** - * @param {Array.<DebuggerAgent.Location>} locations - */ - function locationsCallback(locations) - { - if (this._executionCallFrame !== callFrame || this._stepIntoMarkup) - return; - this._stepIntoMarkup = WebInspector.JavaScriptSourceFrame.StepIntoMarkup.create(this, locations); - if (this._stepIntoMarkup) - this._stepIntoMarkup.show(); - } - callFrame.getStepIntoLocations(locationsCallback.bind(this)); } }, clearExecutionLine: function() { - if (this._stepIntoMarkup) { - this._stepIntoMarkup.dispose(); - delete this._stepIntoMarkup; - } - if (this.loaded && typeof this._executionLineNumber === "number") this.textEditor.clearExecutionLine(); delete this._executionLineNumber; - delete this._executionCallFrame; }, _lineNumberAfterEditing: function(lineNumber, oldRange, newRange) @@ -487,24 +456,6 @@ WebInspector.JavaScriptSourceFrame.prototype = { return newLineNumber; }, - _onMouseDownAndClick: function(isMouseDown, event) - { - var markup = this._stepIntoMarkup; - if (!markup) - return; - var index = markup.findItemByCoordinates(event.x, event.y); - if (typeof index === "undefined") - return; - - if (isMouseDown) { - // Do not let text editor to spoil 'click' event that is coming for us. - event.consume(); - } else { - var rawLocation = markup.getRawPosition(index); - this._scriptsPanel.doStepIntoSelection(rawLocation); - } - }, - /** * @return {boolean} */ @@ -592,7 +543,7 @@ WebInspector.JavaScriptSourceFrame.prototype = { onTextEditorContentLoaded: function() { if (typeof this._executionLineNumber === "number") - this.setExecutionLine(this._executionLineNumber, this._executionCallFrame); + this.setExecutionLine(this._executionLineNumber); var breakpointLocations = this._breakpointManager.breakpointLocationsForUISourceCode(this._uiSourceCode); for (var i = 0; i < breakpointLocations.length; ++i) @@ -680,14 +631,6 @@ WebInspector.JavaScriptSourceFrame.prototype = { WebInspector.debuggerModel.continueToLocation(rawLocation); }, - /** - * @return {WebInspector.JavaScriptSourceFrame.StepIntoMarkup|undefined} - */ - stepIntoMarkup: function() - { - return this._stepIntoMarkup; - }, - dispose: function() { this._breakpointManager.removeEventListener(WebInspector.BreakpointManager.Events.BreakpointAdded, this._breakpointAdded, this); @@ -703,178 +646,3 @@ WebInspector.JavaScriptSourceFrame.prototype = { __proto__: WebInspector.UISourceCodeFrame.prototype } - -/** - * @constructor - * @param {Array.<DebuggerAgent.Location>} rawPositions - * @param {Array.<WebInspector.TextRange>} editorRanges - * @param {number} firstToExecute - * @param {WebInspector.JavaScriptSourceFrame} sourceFrame - */ -WebInspector.JavaScriptSourceFrame.StepIntoMarkup = function(rawPositions, editorRanges, firstToExecute, sourceFrame) -{ - this._positions = rawPositions; - this._editorRanges = editorRanges; - this._highlightDescriptors = new Array(rawPositions.length); - this._firstToExecute = firstToExecute; - this._currentSelection = firstToExecute; - this._sourceFrame = sourceFrame; -}; - -WebInspector.JavaScriptSourceFrame.StepIntoMarkup.prototype = { - show: function() - { - for (var i = 0; i < this._positions.length; ++i) - this._highlightItem(i, i == this._currentSelection); - }, - - /** - * @param {boolean} backward - */ - iterateSelection: function(backward) - { - var nextSelection = backward ? this._currentSelection - 1 : this._currentSelection + 1; - this.moveSelectionTo(nextSelection); - }, - - selectFirstToExecute: function() - { - this.moveSelectionTo(this._firstToExecute); - }, - - /** - * @param {number} nextSelection - */ - moveSelectionTo: function(nextSelection) - { - var modulo = this._positions.length + 1; - nextSelection = (nextSelection + modulo) % modulo; - this._hideItemHighlight(this._currentSelection); - this._hideItemHighlight(nextSelection); - this._highlightItem(this._currentSelection, false); - this._highlightItem(nextSelection, true); - this._currentSelection = nextSelection; - }, - - /** - * @param {number} position - * @param {boolean} selected - */ - _highlightItem: function(position, selected) - { - if (position === this._positions.length) - return; - var styleName = selected ? "source-frame-stepin-mark-highlighted" : "source-frame-stepin-mark"; - var textEditor = this._sourceFrame.textEditor; - var highlightDescriptor = textEditor.highlightRange(this._editorRanges[position], styleName); - this._highlightDescriptors[position] = highlightDescriptor; - }, - - /** - * @param {number} position - */ - _hideItemHighlight: function(position) - { - if (position === this._positions.length) - return; - var highlightDescriptor = this._highlightDescriptors[position]; - console.assert(highlightDescriptor); - var textEditor = this._sourceFrame.textEditor; - textEditor.removeHighlight(highlightDescriptor); - this._highlightDescriptors[position] = undefined; - }, - - dispose: function() - { - for (var i = 0; i < this._positions.length; ++i) - this._hideItemHighlight(i); - }, - - /** - * @param {number} x - * @param {number} y - * @return {number|undefined} - */ - findItemByCoordinates: function(x, y) - { - var textPosition = this._sourceFrame.textEditor.coordinatesToCursorPosition(x, y); - if (!textPosition) - return; - - var ranges = this._editorRanges; - - for (var i = 0; i < ranges.length; ++i) { - var nextRange = ranges[i]; - if (nextRange.startLine == textPosition.startLine && nextRange.startColumn <= textPosition.startColumn && nextRange.endColumn >= textPosition.startColumn) - return i; - } - }, - - /** - * @return {number|undefined} - */ - getSelectedItemIndex: function() - { - if (this._currentSelection === this._positions.length) - return undefined; - return this._currentSelection; - }, - - /** - * @return {WebInspector.DebuggerModel.Location} - */ - getRawPosition: function(position) - { - return /** @type {WebInspector.DebuggerModel.Location} */ (this._positions[position]); - } - -}; - -/** - * @param {WebInspector.JavaScriptSourceFrame} sourceFrame - * @param {Array.<DebuggerAgent.Location>} stepIntoRawLocations - * @return {?WebInspector.JavaScriptSourceFrame.StepIntoMarkup} - */ -WebInspector.JavaScriptSourceFrame.StepIntoMarkup.create = function(sourceFrame, stepIntoRawLocations) -{ - if (!stepIntoRawLocations.length) - return null; - - var firstToExecute = stepIntoRawLocations[0]; - stepIntoRawLocations.sort(WebInspector.JavaScriptSourceFrame.StepIntoMarkup._Comparator); - var firstToExecuteIndex = stepIntoRawLocations.indexOf(firstToExecute); - - var textEditor = sourceFrame.textEditor; - var uiRanges = []; - for (var i = 0; i < stepIntoRawLocations.length; ++i) { - var uiLocation = WebInspector.debuggerModel.rawLocationToUILocation(/** @type {WebInspector.DebuggerModel.Location} */ (stepIntoRawLocations[i])); - - var token = textEditor.tokenAtTextPosition(uiLocation.lineNumber, uiLocation.columnNumber); - var startColumn; - var endColumn; - if (token) { - startColumn = token.startColumn; - endColumn = token.endColumn; - } else { - startColumn = uiLocation.columnNumber; - endColumn = uiLocation.columnNumber; - } - var range = new WebInspector.TextRange(uiLocation.lineNumber, startColumn, uiLocation.lineNumber, endColumn); - uiRanges.push(range); - } - - return new WebInspector.JavaScriptSourceFrame.StepIntoMarkup(stepIntoRawLocations, uiRanges, firstToExecuteIndex, sourceFrame); -}; - -/** - * @param {DebuggerAgent.Location} locationA - * @param {DebuggerAgent.Location} locationB - * @return {number} - */ -WebInspector.JavaScriptSourceFrame.StepIntoMarkup._Comparator = function(locationA, locationB) -{ - if (locationA.lineNumber === locationB.lineNumber) - return locationA.columnNumber - locationB.columnNumber; - else - return locationA.lineNumber - locationB.lineNumber; -}; diff --git a/chromium/third_party/WebKit/Source/devtools/front_end/KeyboardShortcut.js b/chromium/third_party/WebKit/Source/devtools/front_end/KeyboardShortcut.js index 793c9bd56f3..b3f6f8fb110 100644 --- a/chromium/third_party/WebKit/Source/devtools/front_end/KeyboardShortcut.js +++ b/chromium/third_party/WebKit/Source/devtools/front_end/KeyboardShortcut.js @@ -94,11 +94,6 @@ WebInspector.KeyboardShortcut.Keys = { H: { code: 72, name: "H" }, Ctrl: { code: 17, name: "Ctrl" }, Meta: { code: 91, name: "Meta" }, - get CtrlOrMeta() - { - // "default" command/ctrl key for platform, Command on Mac, Ctrl on other platforms - return WebInspector.isMac() ? this.Meta : this.Ctrl; - }, }; /** diff --git a/chromium/third_party/WebKit/Source/devtools/front_end/LayerTree.js b/chromium/third_party/WebKit/Source/devtools/front_end/LayerTree.js deleted file mode 100644 index a525e6d5b99..00000000000 --- a/chromium/third_party/WebKit/Source/devtools/front_end/LayerTree.js +++ /dev/null @@ -1,131 +0,0 @@ -/* - * Copyright (C) 2013 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/** - * @constructor - * @param {WebInspector.LayerTreeModel} model - * @param {TreeOutline} treeOutline - */ -WebInspector.LayerTree = function(model, treeOutline) -{ - this._model = model; - this._treeOutline = treeOutline; - this._model.addEventListener(WebInspector.LayerTreeModel.Events.LayerTreeChanged, this._update.bind(this)); - this._needsUpdate = true; -} - -WebInspector.LayerTree.prototype = { - /** - * @param {boolean} visible - */ - setVisible: function(visible) - { - if (this._isVisible === visible) - return; - this._isVisible = visible; - if (visible && this._needsUpdate) - this._update(); - }, - - _update: function() - { - if (!this._isVisible) { - this._needsUpdate = true; - return; - } - this._needsUpdate = false; - - var seenLayers = {}; - - /** - * @param {WebInspector.Layer} layer - */ - function updateLayer(layer) - { - var id = layer.id(); - if (seenLayers[id]) - console.assert(false, "Duplicate layer id: " + id); - seenLayers[id] = true; - var node = this._treeOutline.getCachedTreeElement(layer); - var parent = layer.parent() ? this._treeOutline.getCachedTreeElement(layer.parent()) : this._treeOutline; - if (!parent) - console.assert(false, "Parent is not in the tree"); - if (!node) { - node = new WebInspector.LayerTreeElement(layer); - parent.appendChild(node); - } else { - var oldParentId = node.parent.representedObject && node.parent.representedObject.id(); - if (oldParentId !== layer.parentId()) { - (node.parent || this._treeOutline).removeChild(node); - parent.appendChild(node); - } - node._update(); - } - } - this._model.forEachLayer(updateLayer.bind(this)); - // Cleanup layers that don't exist anymore from tree - for (var i = 0; i < this._treeOutline.children.length; ++i) { - for (var node = this._treeOutline.children[i]; node;) { - if (seenLayers[node.representedObject.id()]) { - node = node.traverseNextTreeElement(false); - } else { - var nextNode = node.nextSibling || node.parent; - node.parent.removeChild(node); - node = nextNode; - } - } - } - } - } - -/** - * @constructor - * @param {WebInspector.Layer} layer - * @extends {TreeElement} - */ -WebInspector.LayerTreeElement = function(layer) -{ - TreeElement.call(this, "#" + layer.id(), layer); -} - -WebInspector.LayerTreeElement.prototype = { - onattach: function() - { - var selection = document.createElement("div"); - selection.className = "selection"; - this.listItemElement.insertBefore(selection, this.listItemElement.firstChild); - }, - - _update: function() - { - }, - - __proto__: TreeElement.prototype -} diff --git a/chromium/third_party/WebKit/Source/devtools/front_end/LayerTreeModel.js b/chromium/third_party/WebKit/Source/devtools/front_end/LayerTreeModel.js deleted file mode 100644 index e4922bb1369..00000000000 --- a/chromium/third_party/WebKit/Source/devtools/front_end/LayerTreeModel.js +++ /dev/null @@ -1,278 +0,0 @@ -/* - * Copyright (C) 2013 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/** - * @constructor - * @extends {WebInspector.Object} - */ -WebInspector.LayerTreeModel = function() -{ - this._layersById = {}; - InspectorBackend.registerLayerTreeDispatcher(new WebInspector.LayerTreeDispatcher(this)); - LayerTreeAgent.enable(); -} - -WebInspector.LayerTreeModel.Events = { - LayerTreeChanged: "LayerTreeChanged" -} - -WebInspector.LayerTreeModel.prototype = { - dispose: function() - { - LayerTreeAgent.disable(); - }, - - /** - * @return {WebInspector.Layer} - */ - root: function() - { - return this._root; - }, - - /** - * @param {function(WebInspector.Layer)} callback - * @param {WebInspector.Layer=} root - * @return {boolean} - */ - forEachLayer: function(callback, root) - { - if (!root) { - root = this.root(); - if (!root) - return false; - } - return callback(root) || root.children().some(this.forEachLayer.bind(this, callback)); - }, - - /** - * @param {function()=} callback - */ - requestLayers: function(callback) - { - if (!callback) - callback = function() {} - if (typeof this._root !== "undefined") { - callback(); - return; - } - if (this._pendingRequestLayersCallbacks) { - this._pendingRequestLayersCallbacks.push(callback); - return; - } - this._pendingRequestLayersCallbacks = []; - this._pendingRequestLayersCallbacks.push(callback); - function onGetLayers(error, layers) - { - this._root = null; - if (error) { - console.error("LayerTreeAgent.getLayers(): " + error); - return; - } - this._repopulate(layers); - for (var i = 0; i < this._pendingRequestLayersCallbacks.length; ++i) - this._pendingRequestLayersCallbacks[i](); - delete this._pendingRequestLayersCallbacks; - } - function onDocumentAvailable() - { - LayerTreeAgent.getLayers(undefined, onGetLayers.bind(this)) - } - WebInspector.domAgent.requestDocument(onDocumentAvailable.bind(this)); - }, - - /** - * @param {string} id - * @return {WebInspector.Layer?} - */ - layerById: function(id) - { - return this._layersById[id]; - }, - - /** - * @param{Array.<LayerTreeAgent.Layer>} payload - */ - _repopulate: function(payload) - { - var oldLayersById = this._layersById; - this._layersById = {}; - for (var i = 0; i < payload.length; ++i) { - var layer = oldLayersById[payload[i].layerId]; - if (layer) - layer._reset(payload[i]); - else - layer = new WebInspector.Layer(payload[i]); - this._layersById[layer.id()] = layer; - var parentId = layer.parentId(); - if (parentId) - this._layersById[parentId].addChild(layer); - else { - if (this._root) - console.assert(false, "Multiple root layers"); - this._root = layer; - } - } - this.dispatchEventToListeners(WebInspector.LayerTreeModel.Events.LayerTreeChanged); - }, - - _layerTreeChanged: function() - { - delete this._root; - this.requestLayers(); - }, - - __proto__: WebInspector.Object.prototype -} - -/** - * @constructor - * @param {LayerTreeAgent.Layer} layerPayload - */ -WebInspector.Layer = function(layerPayload) -{ - this._reset(layerPayload); -} - -WebInspector.Layer.prototype = { - /** - * @return {string?} - */ - id: function() - { - return this._layerPayload.layerId; - }, - - /** - * @return {string?} - */ - parentId: function() - { - return this._layerPayload.parentLayerId; - }, - - /** - * @return {WebInspector.Layer} - */ - parent: function() - { - return this._parent; - }, - - isRoot: function() - { - return !!this.parentId(); - }, - - children: function() - { - return this._children; - }, - - /** - * @param {WebInspector.Layer} child - */ - addChild: function(child) - { - if (child._parent) - console.assert(false, "Child already has a parent"); - this._children.push(child); - child._parent = this; - }, - - nodeIdForSelfOrAncestor: function() - { - for (var layer = this; layer; layer = layer._parent) { - var nodeId = layer._layerPayload["nodeId"]; - if (nodeId) - return nodeId; - } - return null; - }, - - /** - * @return {number} - */ - offsetX: function() - { - return this._layerPayload.offsetX; - }, - - /** - * @return {number} - */ - offsetY: function() - { - return this._layerPayload.offsetY; - }, - - /** - * @return {number} - */ - width: function() - { - return this._layerPayload.width; - }, - - /** - * @return {number} - */ - height: function() - { - return this._layerPayload.height; - }, - - /** - * @param {LayerTreeAgent.Layer} layerPayload - */ - _reset: function(layerPayload) - { - this._children = []; - this._parent = null; - this._layerPayload = layerPayload; - } -} - -/** - * @constructor - * @implements {LayerTreeAgent.Dispatcher} - * @param {WebInspector.LayerTreeModel} layerTreeModel - */ -WebInspector.LayerTreeDispatcher = function(layerTreeModel) -{ - this._layerTreeModel = layerTreeModel; -} - -WebInspector.LayerTreeDispatcher.prototype = { - layerTreeDidChange: function() - { - this._layerTreeModel._layerTreeChanged(); - } -} diff --git a/chromium/third_party/WebKit/Source/devtools/front_end/Layers3DView.js b/chromium/third_party/WebKit/Source/devtools/front_end/Layers3DView.js deleted file mode 100644 index a2af860254b..00000000000 --- a/chromium/third_party/WebKit/Source/devtools/front_end/Layers3DView.js +++ /dev/null @@ -1,173 +0,0 @@ -/* - * Copyright (C) 2013 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/** - * @constructor - * @extends {WebInspector.View} - * @param {WebInspector.LayerTreeModel} model - */ -WebInspector.Layers3DView = function(model) -{ - WebInspector.View.call(this); - this.element.classList.add("fill"); - this.element.classList.add("layers-3d-view"); - this._model = model; - this._model.addEventListener(WebInspector.LayerTreeModel.Events.LayerTreeChanged, this._update, this); - this._rotatingContainerElement = this.element.createChild("div", "fill rotating-container"); - this.element.addEventListener("mousemove", this._onMouseMove.bind(this), false); - this.element.addEventListener("mousedown", this._onMouseDown.bind(this), false); - this._elementsByLayerId = {}; - this._rotateX = 0; - this._rotateY = 0; -} - -WebInspector.Layers3DView.prototype = { - onResize: function() - { - this._scale(); - }, - - wasShown: function() - { - if (this._needsUpdate) - this._update(); - }, - - _scale: function() - { - const padding = 40; - var scale = 1; - var root = this._model.root(); - if (!root) - return; - var scaleX = this.element.clientWidth / (root.width() + 2 * padding); - var scaleY = this.element.clientHeight / (root.height() + 2 * padding); - scale = Math.min(scaleX, scaleY); - var element = this._elementForLayer(root); - element.style.webkitTransform = "scale(" + scale + "," + scale +")"; - element.style.webkitTransformOrigin = padding + "px " + padding + "px"; - }, - - _update: function() - { - if (!this.isShowing()) { - this._needsUpdate = true; - return; - } - function updateLayer(layer) - { - var element = this._elementForLayer(layer); - this._updateLayerElement(element); - for (var childElement = element.firstElementChild; childElement;) { - var nextElement = childElement.nextSibling; - if (childElement.__layer && !this._model.layerById(childElement.__layer.id())) - childElement.remove(); - childElement = nextElement; - } - } - this._model.forEachLayer(updateLayer.bind(this)); - this._needsUpdate = false; - this._scale(); - }, - - /** - * @param {WebInspector.Layer} layer - * @return {Element} - */ - _elementForLayer: function(layer) - { - var element = this._elementsByLayerId[layer.id()]; - if (element) - return element; - element = document.createElement("div"); - element.className = "layer-container"; - element.__layer = layer; - ["fill back-wall", "side-wall top", "side-wall right", "side-wall bottom", "side-wall left"].forEach(element.createChild.bind(element, "div")); - this._elementsByLayerId[layer.id()] = element; - return element; - }, - - /** - * @param {Element} element - */ - _updateLayerElement: function(element) - { - var layer = element.__layer; - var style = element.style; - var parentElement = layer.parent() ? this._elementForLayer(layer.parent()) : this._rotatingContainerElement; - element.__depth = (parentElement.__depth || 0) + 1; - style.backgroundColor = this._colorForLayer(layer, element.__depth); - style.left = layer.offsetX() + "px"; - style.top = layer.offsetY() + "px"; - style.width = layer.width() + "px"; - style.height = layer.height() + "px"; - if (parentElement !== element.parentElement) - parentElement.appendChild(element); - }, - - /** - * @param {WebInspector.Layer} layer - * @param {number} depth - * @return {string} - */ - _colorForLayer: function(layer, depth) - { - const base = 144; - var component = base + 20 * ((depth - 1) % 5); - return "rgb(" + component + "," + component + "," + component + ")"; - }, - - /** - * @param {Event} event - */ - _onMouseDown: function(event) - { - if (event.which !== 1) - return; - this._originX = event.clientX; - this._originY = event.clientY; - this._oldRotateX = this._rotateX; - this._oldRotateY = this._rotateY; - }, - - /** - * @param {Event} event - */ - _onMouseMove: function(event) - { - if (event.which !== 1) - return; - this._rotateX = this._oldRotateX + (this._originY - event.clientY) / 2; - this._rotateY = this._oldRotateY - (this._originX - event.clientX) / 4; - this._rotatingContainerElement.style.webkitTransform = "rotateX(" + this._rotateX + "deg) rotateY(" + this._rotateY + "deg)"; - }, - - __proto__: WebInspector.View.prototype -} diff --git a/chromium/third_party/WebKit/Source/devtools/front_end/LayersPanel.js b/chromium/third_party/WebKit/Source/devtools/front_end/LayersPanel.js deleted file mode 100644 index 9b1c5a54f6a..00000000000 --- a/chromium/third_party/WebKit/Source/devtools/front_end/LayersPanel.js +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (C) 2013 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -importScript("LayerTreeModel.js"); -importScript("LayerTree.js"); -importScript("Layers3DView.js"); - -/** - * @constructor - * @extends {WebInspector.Panel} - */ -WebInspector.LayersPanel = function() -{ - WebInspector.Panel.call(this, "layers"); - this.registerRequiredCSS("layersPanel.css"); - - const initialLayerTreeSidebarWidth = 225; - const minimumMainWidthPercent = 0.5; - this.createSidebarViewWithTree(); - this.sidebarElement.addStyleClass("outline-disclosure"); - this.sidebarTreeElement.removeStyleClass("sidebar-tree"); - this._model = new WebInspector.LayerTreeModel(); - this._layerTree = new WebInspector.LayerTree(this._model, this.sidebarTree); - this._layerDetailsSplitView = new WebInspector.SplitView(false, "layerDetailsSplitView"); - this._layerDetailsSplitView.show(this.splitView.mainElement); - this._layers3DView = new WebInspector.Layers3DView(this._model); - this._layers3DView.show(this._layerDetailsSplitView.mainElement); - this._model.requestLayers(); -} - -WebInspector.LayersPanel.prototype = { - wasShown: function() - { - WebInspector.Panel.prototype.wasShown.call(this); - this._layerTree.setVisible(true); - this.sidebarTreeElement.focus(); - }, - - willHide: function() - { - this._layerTree.setVisible(false); - WebInspector.Panel.prototype.willHide.call(this); - }, - - __proto__: WebInspector.Panel.prototype -} diff --git a/chromium/third_party/WebKit/Source/devtools/front_end/LayersPanelDescriptor.js b/chromium/third_party/WebKit/Source/devtools/front_end/LayersPanelDescriptor.js deleted file mode 100644 index 95ad832993c..00000000000 --- a/chromium/third_party/WebKit/Source/devtools/front_end/LayersPanelDescriptor.js +++ /dev/null @@ -1,40 +0,0 @@ -/* - * 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 GOOGLE 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 GOOGLE 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. - */ - -/** - * @constructor - * @extends {WebInspector.PanelDescriptor} - */ -WebInspector.LayersPanelDescriptor = function() -{ - WebInspector.PanelDescriptor.call(this, "layers", WebInspector.UIString("Layers"), "LayersPanel", "LayersPanel.js"); -} - -WebInspector.LayersPanelDescriptor.prototype = { - __proto__: WebInspector.PanelDescriptor.prototype -} diff --git a/chromium/third_party/WebKit/Source/devtools/front_end/OverridesView.js b/chromium/third_party/WebKit/Source/devtools/front_end/OverridesView.js index 9d34d9c934a..efd64e456fa 100644 --- a/chromium/third_party/WebKit/Source/devtools/front_end/OverridesView.js +++ b/chromium/third_party/WebKit/Source/devtools/front_end/OverridesView.js @@ -49,16 +49,37 @@ WebInspector.OverridesView = function() var topContainer = wrapper.createChild("div", "settings-tab help-content"); var enableOptionsContainer = topContainer.createChild("div", "help-block"); - var enableOnStartupField = this._createCheckboxSetting(WebInspector.UIString("Enable on DevTools startup"), WebInspector.settings.enableOverridesOnStartup); - enableOnStartupField.id = "enable-devtools-on-startup"; - this._enableOnStartupField = enableOnStartupField; - var enableLabel = this._createNonPersistedCheckbox(WebInspector.UIString("Enable"), this._setOverridesActive.bind(this)); + /** + * @param {boolean} enabled + */ + function enableClicked(enabled) + { + WebInspector.overridesSupport.setOverridesActive(enabled); + this._mainContainer.disabled = !enabled; + } + var boundEnableClicked = enableClicked.bind(this); + var enableLabel = this._createNonPersistedCheckbox(WebInspector.UIString("Enable"), boundEnableClicked); var enableCheckbox = enableLabel.getElementsByTagName("input")[0]; enableCheckbox.checked = WebInspector.settings.enableOverridesOnStartup.get(); enableOptionsContainer.appendChild(enableLabel); - enableOptionsContainer.appendChild(enableOnStartupField); + var enableOnStartupPara = this._createCheckboxSetting(WebInspector.UIString("Enable on DevTools startup"), WebInspector.settings.enableOverridesOnStartup); + enableOnStartupPara.id = "enable-devtools-on-startup"; + enableOptionsContainer.appendChild(enableOnStartupPara); + + /** + * @param {WebInspector.Event} event + */ + function enableOnStartupClicked(event) + { + var enableOnStartup = /** @type {boolean} */ (event.data); + if (enableOnStartup) { + enableCheckbox.checked = true; + boundEnableClicked(true); + } + } + WebInspector.settings.enableOverridesOnStartup.addChangeListener(enableOnStartupClicked, this); - var mainContainer = topContainer.createChild("fieldset", "help-container"); + var mainContainer = topContainer.createChild("div", "help-container"); this._mainContainer = mainContainer; function appendBlock(contentElements) @@ -75,7 +96,7 @@ WebInspector.OverridesView = function() appendBlock([this._createDeviceOrientationOverrideControl()]); appendBlock([this._createCheckboxSetting(WebInspector.UIString("Emulate touch events"), WebInspector.settings.emulateTouchEvents)]); appendBlock([this._createMediaEmulationElement()]); - this._setOverridesActive(enableCheckbox.checked); + boundEnableClicked(enableCheckbox.checked); this._statusElement = document.createElement("span"); this._statusElement.textContent = WebInspector.UIString("Overrides"); @@ -91,16 +112,6 @@ WebInspector.OverridesView.showInDrawer = function() WebInspector.OverridesView.prototype = { /** - * @param {boolean} active - */ - _setOverridesActive: function(active) - { - WebInspector.overridesSupport.setOverridesActive(active); - this._mainContainer.disabled = !active; - this._enableOnStartupField.disabled = !active; - }, - - /** * @param {string} name * @param {!WebInspector.Setting} setting * @param {function(boolean)=} callback diff --git a/chromium/third_party/WebKit/Source/devtools/front_end/ScriptsPanel.js b/chromium/third_party/WebKit/Source/devtools/front_end/ScriptsPanel.js index e2e3f0dfa51..ead3c9255b5 100644 --- a/chromium/third_party/WebKit/Source/devtools/front_end/ScriptsPanel.js +++ b/chromium/third_party/WebKit/Source/devtools/front_end/ScriptsPanel.js @@ -173,9 +173,6 @@ WebInspector.ScriptsPanel = function(workspaceForTest) WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.GlobalObjectCleared, this._debuggerReset, this); WebInspector.advancedSearchController.registerSearchScope(new WebInspector.ScriptsSearchScope(this._workspace)); - - this._boundOnKeyUp = this._onKeyUp.bind(this); - this._boundOnKeyDown = this._onKeyDown.bind(this); } WebInspector.ScriptsPanel.prototype = { @@ -206,16 +203,10 @@ WebInspector.ScriptsPanel.prototype = { { WebInspector.Panel.prototype.wasShown.call(this); this._navigatorController.wasShown(); - - this.element.addEventListener("keydown", this._boundOnKeyDown, false); - this.element.addEventListener("keyup", this._boundOnKeyUp, false); }, willHide: function() { - this.element.removeEventListener("keydown", this._boundOnKeyDown, false); - this.element.removeEventListener("keyup", this._boundOnKeyUp, false); - WebInspector.Panel.prototype.willHide.call(this); WebInspector.closeViewInDrawer(); }, @@ -521,14 +512,13 @@ WebInspector.ScriptsPanel.prototype = { _executionLineChanged: function(event) { - var uiLocation = event.data.uiLocation; - var callFrame = event.data.callFrame; + var uiLocation = event.data; this._clearCurrentExecutionLine(); if (!uiLocation) return; var sourceFrame = this._getOrCreateSourceFrame(uiLocation.uiSourceCode); - sourceFrame.setExecutionLine(uiLocation.lineNumber, callFrame); + sourceFrame.setExecutionLine(uiLocation.lineNumber); this._executionSourceFrame = sourceFrame; }, @@ -744,34 +734,6 @@ WebInspector.ScriptsPanel.prototype = { * @param {Event=} event * @return {boolean} */ - _stepIntoSelectionClicked: function(event) - { - if (!this._paused) - return true; - - if (this._executionSourceFrame) { - var stepIntoMarkup = this._executionSourceFrame.stepIntoMarkup(); - if (stepIntoMarkup) - stepIntoMarkup.iterateSelection(event.shiftKey); - } - return true; - }, - - doStepIntoSelection: function(rawLocation) - { - if (!this._paused) - return; - - this._paused = false; - this._stepping = true; - this._clearInterface(); - WebInspector.debuggerModel.stepIntoSelection(rawLocation); - }, - - /** - * @param {Event=} event - * @return {boolean} - */ _stepOutClicked: function(event) { if (!this._paused) @@ -839,9 +801,6 @@ WebInspector.ScriptsPanel.prototype = { this._stepIntoButton = this._createButtonAndRegisterShortcuts("scripts-step-into", title, handler, WebInspector.ScriptsPanelDescriptor.ShortcutKeys.StepInto); debugToolbar.appendChild(this._stepIntoButton.element); - // Step into selection (keyboard shortcut only). - this.registerShortcuts(WebInspector.ScriptsPanelDescriptor.ShortcutKeys.StepIntoSelection, this._stepIntoSelectionClicked.bind(this)) - // Step out. title = WebInspector.UIString("Step out of current function (%s)."); handler = this._stepOutClicked.bind(this); @@ -994,35 +953,6 @@ WebInspector.ScriptsPanel.prototype = { view.replaceAllWith(query, text); }, - _onKeyDown: function(event) - { - if (event.keyCode !== WebInspector.KeyboardShortcut.Keys.CtrlOrMeta.code) - return; - if (!this._paused || !this._executionSourceFrame) - return; - var stepIntoMarkup = this._executionSourceFrame.stepIntoMarkup(); - if (stepIntoMarkup) - stepIntoMarkup.moveSelectionTo(-1); - }, - - _onKeyUp: function(event) - { - if (event.keyCode !== WebInspector.KeyboardShortcut.Keys.CtrlOrMeta.code) - return; - if (!this._paused || !this._executionSourceFrame) - return; - var stepIntoMarkup = this._executionSourceFrame.stepIntoMarkup(); - if (!stepIntoMarkup) - return; - var currentPosition = stepIntoMarkup.getSelectedItemIndex(); - if (typeof currentPosition === "undefined") { - stepIntoMarkup.selectFirstToExecute(); - } else { - var rawLocation = stepIntoMarkup.getRawPosition(currentPosition); - this.doStepIntoSelection(rawLocation); - } - }, - _toggleFormatSource: function() { this._toggleFormatSourceButton.toggled = !this._toggleFormatSourceButton.toggled; diff --git a/chromium/third_party/WebKit/Source/devtools/front_end/ScriptsPanelDescriptor.js b/chromium/third_party/WebKit/Source/devtools/front_end/ScriptsPanelDescriptor.js index 4fbb07ef237..68f29c38218 100644 --- a/chromium/third_party/WebKit/Source/devtools/front_end/ScriptsPanelDescriptor.js +++ b/chromium/third_party/WebKit/Source/devtools/front_end/ScriptsPanelDescriptor.js @@ -62,7 +62,6 @@ WebInspector.ScriptsPanelDescriptor.prototype = { section.addAlternateKeys(WebInspector.ScriptsPanelDescriptor.ShortcutKeys.PauseContinue, WebInspector.UIString("Pause/Continue")); section.addAlternateKeys(WebInspector.ScriptsPanelDescriptor.ShortcutKeys.StepOver, WebInspector.UIString("Step over")); section.addAlternateKeys(WebInspector.ScriptsPanelDescriptor.ShortcutKeys.StepInto, WebInspector.UIString("Step into")); - section.addAlternateKeys(WebInspector.ScriptsPanelDescriptor.ShortcutKeys.StepIntoSelection, WebInspector.UIString("Step into selection")); section.addAlternateKeys(WebInspector.ScriptsPanelDescriptor.ShortcutKeys.StepOut, WebInspector.UIString("Step out")); var nextAndPrevFrameKeys = WebInspector.ScriptsPanelDescriptor.ShortcutKeys.NextCallFrame.concat(WebInspector.ScriptsPanelDescriptor.ShortcutKeys.PrevCallFrame); @@ -96,11 +95,6 @@ WebInspector.ScriptsPanelDescriptor.ShortcutKeys = { WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.Semicolon, WebInspector.KeyboardShortcut.Modifiers.CtrlOrMeta) ], - StepIntoSelection: [ - WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.F11, WebInspector.KeyboardShortcut.Modifiers.CtrlOrMeta), - WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.F11, WebInspector.KeyboardShortcut.Modifiers.Shift | WebInspector.KeyboardShortcut.Modifiers.CtrlOrMeta) - ], - StepOut: [ WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.F11, WebInspector.KeyboardShortcut.Modifiers.Shift), WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.Semicolon, WebInspector.KeyboardShortcut.Modifiers.Shift | WebInspector.KeyboardShortcut.Modifiers.CtrlOrMeta) diff --git a/chromium/third_party/WebKit/Source/devtools/front_end/Settings.js b/chromium/third_party/WebKit/Source/devtools/front_end/Settings.js index 8162d32a64e..9e07dbf738d 100644 --- a/chromium/third_party/WebKit/Source/devtools/front_end/Settings.js +++ b/chromium/third_party/WebKit/Source/devtools/front_end/Settings.js @@ -261,7 +261,6 @@ WebInspector.ExperimentsSettings = function() this.frameworksDebuggingSupport = this._createExperiment("frameworksDebuggingSupport", "Enable frameworks debugging support"); this.refreshFileSystemsOnFocus = this._createExperiment("refreshFileSystemsOnFocus", "Refresh file system folders on window focus"); this.scrollBeyondEndOfFile = this._createExperiment("scrollBeyondEndOfFile", "Support scrolling beyond end of file"); - this.layersPanel = this._createExperiment("layersPanel", "Show Layers panel"); this._cleanUpSetting(); } diff --git a/chromium/third_party/WebKit/Source/devtools/front_end/helpScreen.css b/chromium/third_party/WebKit/Source/devtools/front_end/helpScreen.css index 57589149e81..ed1bb8354ed 100644 --- a/chromium/third_party/WebKit/Source/devtools/front_end/helpScreen.css +++ b/chromium/third_party/WebKit/Source/devtools/front_end/helpScreen.css @@ -98,7 +98,7 @@ body.platform-mac .help-window-main .help-window-title { -webkit-column-width: 470px; } -body.platform-mac .settings-tab .help-container { +body.platform-mac .settings-tab.help-container { -webkit-column-width: 430px; } @@ -189,36 +189,31 @@ body.platform-mac .help-key { margin: 0 0.5em; } -.settings-tab fieldset { - margin: 0; - padding: 0; - border: none; -} - -.help-block > fieldset { +.help-content > fieldset { margin: 3px 0; } -.help-block fieldset { +.help-content fieldset { + border: none; margin-left: 7px; padding: 0 initial; } -#general-tab-content .help-block fieldset legend { +#general-tab-content .help-content fieldset legend { font-size: 14px; } -body.platform-mac .settings-tab.help-block fieldset { +body.platform-mac .settings-tab.help-content fieldset { margin-left: 10px; } -.help-block fieldset p, -.help-block fieldset fieldset { +.help-content fieldset p, +.help-content fieldset fieldset { border-left: 1px solid rgb(128,128,128); padding-left: 30px; } -.help-block fieldset label { +.help-content fieldset label { padding-right: 4px; } @@ -431,12 +426,12 @@ body.platform-mac .help-content input[type=radio] { } .settings-tab p, -.settings-tab .help-block fieldset { +.settings-tab fieldset { margin: 12px 0; } -.settings-tab .help-block fieldset p, -.settings-tab .help-block fieldset fieldset { +.settings-tab fieldset p, +.settings-tab fieldset fieldset { border-left: none transparent; } diff --git a/chromium/third_party/WebKit/Source/devtools/front_end/inspector.css b/chromium/third_party/WebKit/Source/devtools/front_end/inspector.css index 98484be958d..49a89fdf7f7 100644 --- a/chromium/third_party/WebKit/Source/devtools/front_end/inspector.css +++ b/chromium/third_party/WebKit/Source/devtools/front_end/inspector.css @@ -2429,16 +2429,6 @@ body.inactive li.selected .bubble.search-matches { background-color: rgb(255, 255, 194); } -.source-frame-stepin-mark { - text-decoration: underline; - background-color: #bfccfe; -} - -.source-frame-stepin-mark-highlighted { - text-decoration: underline; - background-color: #698cfe; -} - .workers-list { list-style: none; margin: 0; diff --git a/chromium/third_party/WebKit/Source/devtools/front_end/inspector.html b/chromium/third_party/WebKit/Source/devtools/front_end/inspector.html index 2dc75042625..aafcd28e7f4 100644 --- a/chromium/third_party/WebKit/Source/devtools/front_end/inspector.html +++ b/chromium/third_party/WebKit/Source/devtools/front_end/inspector.html @@ -185,7 +185,6 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. <script type="text/javascript" src="ProfilesPanelDescriptor.js"></script> <script type="text/javascript" src="ScriptsPanelDescriptor.js"></script> <script type="text/javascript" src="TimelinePanelDescriptor.js"></script> - <script type="text/javascript" src="LayersPanelDescriptor.js"></script> <script type="text/javascript" src="DockController.js"></script> <script type="text/javascript" src="TracingAgent.js"></script> <script type="text/javascript" src="DevToolsExtensionAPI.js"></script> diff --git a/chromium/third_party/WebKit/Source/devtools/front_end/inspector.js b/chromium/third_party/WebKit/Source/devtools/front_end/inspector.js index 5eaee481dd7..25bfe2a5aca 100644 --- a/chromium/third_party/WebKit/Source/devtools/front_end/inspector.js +++ b/chromium/third_party/WebKit/Source/devtools/front_end/inspector.js @@ -46,10 +46,6 @@ var WebInspector = { var audits = new WebInspector.PanelDescriptor("audits", WebInspector.UIString("Audits"), "AuditsPanel", "AuditsPanel.js"); var console = new WebInspector.PanelDescriptor("console", WebInspector.UIString("Console"), "ConsolePanel"); var allDescriptors = [elements, resources, network, scripts, timeline, profiles, audits, console]; - if (WebInspector.experimentsSettings.layersPanel.isEnabled()) { - var layers = new WebInspector.LayersPanelDescriptor(); - allDescriptors.push(layers); - } var allProfilers = [profiles]; if (WebInspector.experimentsSettings.customizableToolbar.isEnabled()) { allProfilers = []; diff --git a/chromium/third_party/WebKit/Source/devtools/front_end/layersPanel.css b/chromium/third_party/WebKit/Source/devtools/front_end/layersPanel.css deleted file mode 100644 index 3763b73962a..00000000000 --- a/chromium/third_party/WebKit/Source/devtools/front_end/layersPanel.css +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright (C) 2013 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -.layers.panel .outline-disclosure { - z-index: 10; -} - -div.outline-disclosure > ol { - margin-left: -12px; -} - -.layers.panel .outline-disclosure ol.children { - padding-left: 12px; -} - -.layers-3d-view { - overflow: hidden; -} - -.layers-3d-view .rotating-container { - -webkit-transform-style: preserve-3d; -} - -.layers-3d-view .layer-container { - position: absolute; - opacity: 0.8; - border: 1px solid rgba(40, 40, 40, 0.8); - -webkit-transform: translateZ(20px); - -webkit-transform-style: preserve-3d; -} - -.layer-container .side-wall { - position: absolute; - background-color: inherit; - top: 0px; - right: 0px; - bottom: 0px; - left: 0px; - height: 4px; - width: 4px; - -webkit-transform-origin: 0 0; - border: solid black 1px; -} - -.layer-container .back-wall { - -webkit-transform: translateZ(-4px); - background-color: inherit; -} - -.layer-container .side-wall.top { - width: auto; - bottom: auto; - -webkit-transform: rotateX(-90deg); -} - -.layer-container .side-wall.bottom { - width: auto; - top: auto; - -webkit-transform: translateY(4px) rotateX(-90deg); -} - -.layer-container .side-wall.left { - height: auto; - right: auto; - -webkit-transform: rotateY(90deg); -} - -.layer-container .side-wall.right { - height: auto; - left: auto; - -webkit-transform: translateX(4px) rotateY(90deg); -} diff --git a/chromium/third_party/WebKit/Source/devtools/protocol.json b/chromium/third_party/WebKit/Source/devtools/protocol.json index 5cb1ddff5b8..6e56eceb79e 100644 --- a/chromium/third_party/WebKit/Source/devtools/protocol.json +++ b/chromium/third_party/WebKit/Source/devtools/protocol.json @@ -3216,6 +3216,7 @@ "description": "Profile.", "properties": [ { "name": "head", "$ref": "CPUProfileNode" }, + { "name": "idleTime", "type": "number", "description": "Idle time in seconds." }, { "name": "startTime", "type": "number", "description": "Profiling start time in seconds." }, { "name": "endTime", "type": "number", "description": "Profiling end time in seconds." }, { "name": "samples", "optional": true, "type": "array", "items": { "type": "integer" }, "description": "Ids of samples top nodes." } @@ -3497,10 +3498,8 @@ "description": "Resource state descriptor.", "properties": [ { "name": "name", "type": "string", "description": "State name." }, - { "name": "enumValueForName", "type": "string", "optional": true, "description": "String representation of the enum value, if <code>name</code> stands for an enum." }, { "name": "value", "$ref": "CallArgument", "optional": true, "description": "The value associated with the particular state." }, - { "name": "values", "type": "array", "items": { "$ref": "ResourceStateDescriptor" }, "optional": true, "description": "Array of values associated with the particular state. Either <code>value</code> or <code>values</code> will be specified." }, - { "name": "isArray", "type": "boolean", "optional": true, "description": "True iff the given <code>values</code> items stand for an array rather than a list of grouped states." } + { "name": "values", "type": "array", "items": { "$ref": "ResourceStateDescriptor" }, "optional": true, "description": "Array of values associated with the particular state. Either <code>value</code> or <code>values</code> will be specified." } ] }, { @@ -3519,11 +3518,9 @@ "type": "object", "properties": [ { "name": "description", "type": "string", "description": "String representation of the object." }, - { "name": "enumName", "type": "string", "optional": true, "description": "Enum name, if any, that stands for the value (for example, a WebGL enum name)." }, { "name": "resourceId", "$ref": "ResourceId", "optional": true, "description": "Resource identifier. Specified for <code>Resource</code> objects only." }, { "name": "type", "type": "string", "optional": true, "enum": ["object", "function", "undefined", "string", "number", "boolean"], "description": "Object type. Specified for non <code>Resource</code> objects only." }, - { "name": "subtype", "type": "string", "optional": true, "enum": ["array", "null", "node", "regexp", "date"], "description": "Object subtype hint. Specified for <code>object</code> type values only." }, - { "name": "remoteObject", "$ref": "Runtime.RemoteObject", "optional": true, "description": "The <code>RemoteObject</code>, if requested." } + { "name": "subtype", "type": "string", "optional": true, "enum": ["array", "null", "node", "regexp", "date"], "description": "Object subtype hint. Specified for <code>object</code> type values only." } ] }, { diff --git a/chromium/third_party/WebKit/Source/devtools/scripts/compile_frontend.py b/chromium/third_party/WebKit/Source/devtools/scripts/compile_frontend.py index 3df42dd6680..01eeb46b746 100755 --- a/chromium/third_party/WebKit/Source/devtools/scripts/compile_frontend.py +++ b/chromium/third_party/WebKit/Source/devtools/scripts/compile_frontend.py @@ -312,16 +312,6 @@ modules = [ ] }, { - "name": "layers", - "dependencies": ["components"], - "sources": [ - "LayerTreeModel.js", - "LayersPanel.js", - "LayerTree.js", - "Layers3DView.js", - ] - }, - { "name": "extensions", "dependencies": ["components"], "sources": [ diff --git a/chromium/third_party/WebKit/Source/modules/device_orientation/DeviceMotionController.cpp b/chromium/third_party/WebKit/Source/modules/device_orientation/DeviceMotionController.cpp index 1d43fa4c34e..4e28bf2f254 100644 --- a/chromium/third_party/WebKit/Source/modules/device_orientation/DeviceMotionController.cpp +++ b/chromium/third_party/WebKit/Source/modules/device_orientation/DeviceMotionController.cpp @@ -35,8 +35,7 @@ namespace WebCore { DeviceMotionController::DeviceMotionController(Document* document) - : DOMWindowLifecycleObserver(document->domWindow()) - , DeviceSensorEventController(document) + : DeviceSensorEventController(document) { } @@ -91,9 +90,4 @@ bool DeviceMotionController::isNullEvent(Event* event) return !motionEvent->deviceMotionData()->canProvideEventData(); } -void DeviceMotionController::removeAllEventListeners() -{ - stopUpdating(); -} - } // namespace WebCore diff --git a/chromium/third_party/WebKit/Source/modules/device_orientation/DeviceMotionController.h b/chromium/third_party/WebKit/Source/modules/device_orientation/DeviceMotionController.h index 207bd52ba31..4bc4d5227c3 100644 --- a/chromium/third_party/WebKit/Source/modules/device_orientation/DeviceMotionController.h +++ b/chromium/third_party/WebKit/Source/modules/device_orientation/DeviceMotionController.h @@ -28,7 +28,6 @@ #define DeviceMotionController_h #include "core/dom/Event.h" -#include "core/page/DOMWindowLifecycleObserver.h" #include "core/platform/Supplementable.h" #include "modules/device_orientation/DeviceSensorEventController.h" @@ -36,7 +35,7 @@ namespace WebCore { class DeviceMotionData; -class DeviceMotionController : public DeviceSensorEventController, public Supplement<ScriptExecutionContext>, public DOMWindowLifecycleObserver { +class DeviceMotionController : public DeviceSensorEventController, public Supplement<ScriptExecutionContext> { public: virtual ~DeviceMotionController(); @@ -46,9 +45,6 @@ public: void didChangeDeviceMotion(DeviceMotionData*); - // Inherited from DOMWindowLifecycleObserver - virtual void removeAllEventListeners() OVERRIDE; - private: explicit DeviceMotionController(Document*); virtual void registerWithDispatcher() OVERRIDE; diff --git a/chromium/third_party/WebKit/Source/modules/encoding/OWNERS b/chromium/third_party/WebKit/Source/modules/encoding/OWNERS deleted file mode 100644 index 6540c735acc..00000000000 --- a/chromium/third_party/WebKit/Source/modules/encoding/OWNERS +++ /dev/null @@ -1,2 +0,0 @@ -jsbell@chromium.org -kbr@chromium.org diff --git a/chromium/third_party/WebKit/Source/modules/filesystem/DOMFileSystemSync.cpp b/chromium/third_party/WebKit/Source/modules/filesystem/DOMFileSystemSync.cpp index 0d4b6f60bfc..861a081be0f 100644 --- a/chromium/third_party/WebKit/Source/modules/filesystem/DOMFileSystemSync.cpp +++ b/chromium/third_party/WebKit/Source/modules/filesystem/DOMFileSystemSync.cpp @@ -135,12 +135,6 @@ public: m_result->m_file = File::createForFileSystemFile(m_url, metadata).get(); } } - - virtual bool shouldBlockUntilCompletion() const OVERRIDE - { - return true; - } - private: CreateFileHelper(PassRefPtr<CreateFileResult> result, const String& name, const KURL& url, FileSystemType type) : m_result(result) diff --git a/chromium/third_party/WebKit/Source/modules/filesystem/DirectoryReaderSync.cpp b/chromium/third_party/WebKit/Source/modules/filesystem/DirectoryReaderSync.cpp index d44420449c0..3532c200b28 100644 --- a/chromium/third_party/WebKit/Source/modules/filesystem/DirectoryReaderSync.cpp +++ b/chromium/third_party/WebKit/Source/modules/filesystem/DirectoryReaderSync.cpp @@ -53,7 +53,7 @@ EntrySyncVector DirectoryReaderSync::readEntries(ExceptionState& es) return EntrySyncVector(); EntriesSyncCallbackHelper helper(m_fileSystem->asyncFileSystem()); - if (!m_fileSystem->readDirectory(this, m_fullPath, helper.successCallback(), helper.errorCallback(), DOMFileSystemBase::Synchronous)) { + if (!m_fileSystem->readDirectory(this, m_fullPath, helper.successCallback(), helper.errorCallback())) { es.throwDOMException(InvalidModificationError); setHasMoreEntries(false); return EntrySyncVector(); diff --git a/chromium/third_party/WebKit/Source/modules/imagebitmap/ImageBitmapFactories.cpp b/chromium/third_party/WebKit/Source/modules/imagebitmap/ImageBitmapFactories.cpp deleted file mode 100644 index 6900a147f48..00000000000 --- a/chromium/third_party/WebKit/Source/modules/imagebitmap/ImageBitmapFactories.cpp +++ /dev/null @@ -1,344 +0,0 @@ -/* - * Copyright (c) 2013, Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "modules/imagebitmap/ImageBitmapFactories.h" - -#include "RuntimeEnabledFeatures.h" -#include "V8ImageBitmap.h" -#include "bindings/v8/ExceptionState.h" -#include "bindings/v8/ScriptScope.h" -#include "bindings/v8/ScriptState.h" -#include "core/html/HTMLCanvasElement.h" -#include "core/html/HTMLImageElement.h" -#include "core/html/HTMLVideoElement.h" -#include "core/html/ImageData.h" -#include "core/html/canvas/CanvasRenderingContext2D.h" -#include "core/page/DOMWindow.h" -#include "core/page/ImageBitmap.h" -#include "core/platform/SharedBuffer.h" -#include "core/platform/graphics/BitmapImage.h" -#include "core/platform/graphics/ImageSource.h" -#include "core/platform/graphics/skia/NativeImageSkia.h" - -namespace WebCore { - -static LayoutSize sizeFor(HTMLImageElement* image) -{ - if (ImageResource* cachedImage = image->cachedImage()) - return cachedImage->imageSizeForRenderer(image->renderer(), 1.0f); // FIXME: Not sure about this. - return IntSize(); -} - -static IntSize sizeFor(HTMLVideoElement* video) -{ - if (MediaPlayer* player = video->player()) - return player->naturalSize(); - return IntSize(); -} - -static ScriptObject fulfillImageBitmap(ScriptExecutionContext* context, PassRefPtr<ImageBitmap> imageBitmap) -{ - // Promises must be enabled. - ASSERT(RuntimeEnabledFeatures::promiseEnabled()); - RefPtr<ScriptPromiseResolver> resolver = ScriptPromiseResolver::create(context); - resolver->fulfill(imageBitmap); - return resolver->promise(); -} - -ScriptObject ImageBitmapFactories::createImageBitmap(EventTarget* eventTarget, HTMLImageElement* image, ExceptionState& es) -{ - LayoutSize s = sizeFor(image); - return createImageBitmap(eventTarget, image, 0, 0, s.width(), s.height(), es); -} - -ScriptObject ImageBitmapFactories::createImageBitmap(EventTarget* eventTarget, HTMLImageElement* image, int sx, int sy, int sw, int sh, ExceptionState& es) -{ - if (!image) { - es.throwTypeError(); - return ScriptObject(); - } - if (!image->cachedImage()) { - es.throwDOMException(InvalidStateError); - return ScriptObject(); - } - if (image->cachedImage()->image()->isSVGImage()) { - es.throwDOMException(InvalidStateError); - return ScriptObject(); - } - if (!sw || !sh) { - es.throwDOMException(IndexSizeError); - return ScriptObject(); - } - if (!image->cachedImage()->image()->hasSingleSecurityOrigin()) { - es.throwDOMException(SecurityError); - return ScriptObject(); - } - if (!image->cachedImage()->passesAccessControlCheck(eventTarget->toDOMWindow()->document()->securityOrigin()) - && eventTarget->toDOMWindow()->document()->securityOrigin()->taintsCanvas(image->src())) { - es.throwDOMException(SecurityError); - return ScriptObject(); - } - // FIXME: make ImageBitmap creation asynchronous crbug.com/258082 - return fulfillImageBitmap(eventTarget->scriptExecutionContext(), ImageBitmap::create(image, IntRect(sx, sy, sw, sh))); -} - -ScriptObject ImageBitmapFactories::createImageBitmap(EventTarget* eventTarget, HTMLVideoElement* video, ExceptionState& es) -{ - IntSize s = sizeFor(video); - return createImageBitmap(eventTarget, video, 0, 0, s.width(), s.height(), es); -} - -ScriptObject ImageBitmapFactories::createImageBitmap(EventTarget* eventTarget, HTMLVideoElement* video, int sx, int sy, int sw, int sh, ExceptionState& es) -{ - if (!video) { - es.throwTypeError(); - return ScriptObject(); - } - if (!video->player()) { - es.throwDOMException(InvalidStateError); - return ScriptObject(); - } - if (video->networkState() == HTMLMediaElement::NETWORK_EMPTY) { - es.throwDOMException(InvalidStateError); - return ScriptObject(); - } - if (video->player()->readyState() <= MediaPlayer::HaveMetadata) { - es.throwDOMException(InvalidStateError); - return ScriptObject(); - } - if (!sw || !sh) { - es.throwDOMException(IndexSizeError); - return ScriptObject(); - } - if (!video->hasSingleSecurityOrigin()) { - es.throwDOMException(SecurityError); - return ScriptObject(); - } - if (!video->player()->didPassCORSAccessCheck() && eventTarget->toDOMWindow()->document()->securityOrigin()->taintsCanvas(video->currentSrc())) { - es.throwDOMException(SecurityError); - return ScriptObject(); - } - // FIXME: make ImageBitmap creation asynchronous crbug.com/258082 - return fulfillImageBitmap(eventTarget->scriptExecutionContext(), ImageBitmap::create(video, IntRect(sx, sy, sw, sh))); -} - -ScriptObject ImageBitmapFactories::createImageBitmap(EventTarget* eventTarget, CanvasRenderingContext2D* context, ExceptionState& es) -{ - return createImageBitmap(eventTarget, context->canvas(), es); -} - -ScriptObject ImageBitmapFactories::createImageBitmap(EventTarget* eventTarget, CanvasRenderingContext2D* context, int sx, int sy, int sw, int sh, ExceptionState& es) -{ - return createImageBitmap(eventTarget, context->canvas(), sx, sy, sw, sh, es); -} - -ScriptObject ImageBitmapFactories::createImageBitmap(EventTarget* eventTarget, HTMLCanvasElement* canvas, ExceptionState& es) -{ - return createImageBitmap(eventTarget, canvas, 0, 0, canvas->width(), canvas->height(), es); -} - -ScriptObject ImageBitmapFactories::createImageBitmap(EventTarget* eventTarget, HTMLCanvasElement* canvas, int sx, int sy, int sw, int sh, ExceptionState& es) -{ - if (!canvas) { - es.throwTypeError(); - return ScriptObject(); - } - if (!canvas->originClean()) { - es.throwDOMException(InvalidStateError); - return ScriptObject(); - } - if (!sw || !sh) { - es.throwDOMException(IndexSizeError); - return ScriptObject(); - } - // FIXME: make ImageBitmap creation asynchronous crbug.com/258082 - return fulfillImageBitmap(eventTarget->scriptExecutionContext(), ImageBitmap::create(canvas, IntRect(sx, sy, sw, sh))); -} - -ScriptObject ImageBitmapFactories::createImageBitmap(EventTarget* eventTarget, Blob* blob, ExceptionState& es) -{ - // Promises must be enabled. - ASSERT(RuntimeEnabledFeatures::promiseEnabled()); - - if (!blob) { - es.throwDOMException(TypeError); - return ScriptObject(); - } - RefPtr<ScriptPromiseResolver> resolver = ScriptPromiseResolver::create(eventTarget->scriptExecutionContext()); - RefPtr<ImageBitmapLoader> loader = ImageBitmapFactories::ImageBitmapLoader::create(from(eventTarget->toDOMWindow()), resolver, IntRect()); - from(eventTarget->toDOMWindow())->addLoader(loader); - loader->loadBlobAsync(eventTarget->scriptExecutionContext(), blob); - return resolver->promise(); -} - -ScriptObject ImageBitmapFactories::createImageBitmap(EventTarget* eventTarget, Blob* blob, int sx, int sy, int sw, int sh, ExceptionState& es) -{ - // Promises must be enabled. - ASSERT(RuntimeEnabledFeatures::promiseEnabled()); - - if (!blob) { - es.throwDOMException(TypeError); - return ScriptObject(); - } - if (!sw || !sh) { - es.throwDOMException(IndexSizeError); - return ScriptObject(); - } - RefPtr<ScriptPromiseResolver> resolver = ScriptPromiseResolver::create(eventTarget->scriptExecutionContext()); - RefPtr<ImageBitmapLoader> loader = ImageBitmapFactories::ImageBitmapLoader::create(from(eventTarget->toDOMWindow()), resolver, IntRect(sx, sy, sw, sh)); - from(eventTarget->toDOMWindow())->addLoader(loader); - loader->loadBlobAsync(eventTarget->scriptExecutionContext(), blob); - return resolver->promise(); -} - -ScriptObject ImageBitmapFactories::createImageBitmap(EventTarget* eventTarget, ImageData* data, ExceptionState& es) -{ - return createImageBitmap(eventTarget, data, 0, 0, data->width(), data->height(), es); -} - -ScriptObject ImageBitmapFactories::createImageBitmap(EventTarget* eventTarget, ImageData* data, int sx, int sy, int sw, int sh, ExceptionState& es) -{ - if (!data) { - es.throwTypeError(); - return ScriptObject(); - } - if (!sw || !sh) { - es.throwDOMException(IndexSizeError); - return ScriptObject(); - } - // FIXME: make ImageBitmap creation asynchronous crbug.com/258082 - return fulfillImageBitmap(eventTarget->scriptExecutionContext(), ImageBitmap::create(data, IntRect(sx, sy, sw, sh))); -} - -ScriptObject ImageBitmapFactories::createImageBitmap(EventTarget* eventTarget, ImageBitmap* bitmap, ExceptionState& es) -{ - return createImageBitmap(eventTarget, bitmap, 0, 0, bitmap->width(), bitmap->height(), es); -} - -ScriptObject ImageBitmapFactories::createImageBitmap(EventTarget* eventTarget, ImageBitmap* bitmap, int sx, int sy, int sw, int sh, ExceptionState& es) -{ - if (!bitmap) { - es.throwTypeError(); - return ScriptObject(); - } - if (!sw || !sh) { - es.throwDOMException(IndexSizeError); - return ScriptObject(); - } - // FIXME: make ImageBitmap creation asynchronous crbug.com/258082 - return fulfillImageBitmap(eventTarget->scriptExecutionContext(), ImageBitmap::create(bitmap, IntRect(sx, sy, sw, sh))); -} - -const char* ImageBitmapFactories::supplementName() -{ - return "ImageBitmapFactories"; -} - -ImageBitmapFactories* ImageBitmapFactories::from(DOMWindow* window) -{ - ImageBitmapFactories* supplement = static_cast<ImageBitmapFactories*>(Supplement<DOMWindow>::from(window, supplementName())); - if (!supplement) { - supplement = new ImageBitmapFactories(); - provideTo(window, supplementName(), adoptPtr(supplement)); - } - return supplement; -} - -void ImageBitmapFactories::addLoader(PassRefPtr<ImageBitmapLoader> loader) -{ - m_pendingLoaders.add(loader); -} - -void ImageBitmapFactories::didFinishLoading(ImageBitmapLoader* loader) -{ - ASSERT(m_pendingLoaders.contains(loader)); - m_pendingLoaders.remove(loader); -} - -ImageBitmapFactories::ImageBitmapLoader::ImageBitmapLoader(ImageBitmapFactories* factory, PassRefPtr<ScriptPromiseResolver> resolver, const IntRect& cropRect) - : m_loader(FileReaderLoader::ReadAsArrayBuffer, this) - , m_scriptState(ScriptState::current()) - , m_factory(factory) - , m_resolver(resolver) - , m_cropRect(cropRect) -{ -} - -void ImageBitmapFactories::ImageBitmapLoader::loadBlobAsync(ScriptExecutionContext* context, Blob* blob) -{ - m_loader.start(context, *blob); -} - -void ImageBitmapFactories::ImageBitmapLoader::rejectPromise() -{ - ScriptScope scope(m_scriptState); - m_resolver->reject(ScriptValue::createNull()); - m_factory->didFinishLoading(this); -} - -void ImageBitmapFactories::ImageBitmapLoader::didFinishLoading() -{ - if (!m_loader.arrayBufferResult()) { - rejectPromise(); - return; - } - RefPtr<SharedBuffer> sharedBuffer = SharedBuffer::create((char*)m_loader.arrayBufferResult()->data(), m_loader.arrayBufferResult()->byteLength()); - - OwnPtr<ImageSource> source = adoptPtr(new ImageSource()); - source->setData(sharedBuffer.get(), true); - RefPtr<NativeImageSkia> imageSkia = source->createFrameAtIndex(0); - if (!imageSkia) { - rejectPromise(); - return; - } - - RefPtr<Image> image = BitmapImage::create(imageSkia); - if (!image->width() || !image->height()) { - rejectPromise(); - return; - } - if (!m_cropRect.width() && !m_cropRect.height()) { - // No cropping variant was called. - m_cropRect = IntRect(IntPoint(), image->size()); - } - - RefPtr<ImageBitmap> imageBitmap = ImageBitmap::create(image.get(), m_cropRect); - ScriptScope scope(m_scriptState); - m_resolver->fulfill(imageBitmap.release()); - m_factory->didFinishLoading(this); -} - -void ImageBitmapFactories::ImageBitmapLoader::didFail(FileError::ErrorCode) -{ - rejectPromise(); -} - -} // namespace WebCore diff --git a/chromium/third_party/WebKit/Source/modules/imagebitmap/ImageBitmapFactories.h b/chromium/third_party/WebKit/Source/modules/imagebitmap/ImageBitmapFactories.h deleted file mode 100644 index b8a7472f5e6..00000000000 --- a/chromium/third_party/WebKit/Source/modules/imagebitmap/ImageBitmapFactories.h +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright (c) 2013, Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef ImageBitmapFactories_h -#define ImageBitmapFactories_h - -#include "bindings/v8/ScriptPromiseResolver.h" -#include "bindings/v8/ScriptState.h" -#include "core/fileapi/FileReaderLoader.h" -#include "core/fileapi/FileReaderLoaderClient.h" -#include "core/platform/Supplementable.h" -#include "core/platform/graphics/IntRect.h" -#include "wtf/Forward.h" -#include "wtf/HashSet.h" - -namespace WebCore { - -class Blob; -class CanvasRenderingContext2D; -class EventTarget; -class ExceptionState; -class HTMLCanvasElement; -class HTMLImageElement; -class HTMLVideoElement; -class ImageBitmap; -class ImageData; -class ScriptExecutionContext; - -class ImageBitmapFactories : public Supplement<DOMWindow> { - -class ImageBitmapLoader; - -public: - static ScriptObject createImageBitmap(EventTarget*, HTMLImageElement*, ExceptionState&); - static ScriptObject createImageBitmap(EventTarget*, HTMLImageElement*, int sx, int sy, int sw, int sh, ExceptionState&); - static ScriptObject createImageBitmap(EventTarget*, HTMLVideoElement*, ExceptionState&); - static ScriptObject createImageBitmap(EventTarget*, HTMLVideoElement*, int sx, int sy, int sw, int sh, ExceptionState&); - static ScriptObject createImageBitmap(EventTarget*, CanvasRenderingContext2D*, ExceptionState&); - static ScriptObject createImageBitmap(EventTarget*, CanvasRenderingContext2D*, int sx, int sy, int sw, int sh, ExceptionState&); - static ScriptObject createImageBitmap(EventTarget*, HTMLCanvasElement*, ExceptionState&); - static ScriptObject createImageBitmap(EventTarget*, HTMLCanvasElement*, int sx, int sy, int sw, int sh, ExceptionState&); - static ScriptObject createImageBitmap(EventTarget*, Blob*, ExceptionState&); - static ScriptObject createImageBitmap(EventTarget*, Blob*, int sx, int sy, int sw, int sh, ExceptionState&); - static ScriptObject createImageBitmap(EventTarget*, ImageData*, ExceptionState&); - static ScriptObject createImageBitmap(EventTarget*, ImageData*, int sx, int sy, int sw, int sh, ExceptionState&); - static ScriptObject createImageBitmap(EventTarget*, ImageBitmap*, ExceptionState&); - static ScriptObject createImageBitmap(EventTarget*, ImageBitmap*, int sx, int sy, int sw, int sh, ExceptionState&); - - void addLoader(PassRefPtr<ImageBitmapLoader>); - void didFinishLoading(ImageBitmapLoader*); - - virtual ~ImageBitmapFactories() { } - static ImageBitmapFactories* from(DOMWindow*); - -private: - class ImageBitmapLoader : public RefCounted<ImageBitmapLoader>, public FileReaderLoaderClient { - public: - static PassRefPtr<ImageBitmapLoader> create(ImageBitmapFactories* factory, PassRefPtr<ScriptPromiseResolver> resolver, const IntRect& cropRect) - { - return adoptRef(new ImageBitmapLoader(factory, resolver, cropRect)); - } - - void loadBlobAsync(ScriptExecutionContext*, Blob*); - - ~ImageBitmapLoader() { } - - private: - ImageBitmapLoader(ImageBitmapFactories*, PassRefPtr<ScriptPromiseResolver>, const IntRect&); - - void rejectPromise(); - - // FileReaderLoaderClient - virtual void didStartLoading() OVERRIDE { } - virtual void didReceiveData() OVERRIDE { } - virtual void didFinishLoading() OVERRIDE; - virtual void didFail(FileError::ErrorCode) OVERRIDE; - - ScriptState* m_scriptState; - FileReaderLoader m_loader; - ImageBitmapFactories* m_factory; - RefPtr<ScriptPromiseResolver> m_resolver; - IntRect m_cropRect; - }; - - static const char* supplementName(); - - HashSet<RefPtr<ImageBitmapLoader> > m_pendingLoaders; -}; - -} // namespace WebCore - -#endif // ImageBitmapFactories_h diff --git a/chromium/third_party/WebKit/Source/modules/imagebitmap/OWNERS b/chromium/third_party/WebKit/Source/modules/imagebitmap/OWNERS deleted file mode 100644 index 9c1707ac0fd..00000000000 --- a/chromium/third_party/WebKit/Source/modules/imagebitmap/OWNERS +++ /dev/null @@ -1,2 +0,0 @@ -arbesfeld@chromium.org -junov@chromium.org
\ No newline at end of file diff --git a/chromium/third_party/WebKit/Source/modules/mediastream/RTCPeerConnection.cpp b/chromium/third_party/WebKit/Source/modules/mediastream/RTCPeerConnection.cpp index 180905749f8..9f99d943409 100644 --- a/chromium/third_party/WebKit/Source/modules/mediastream/RTCPeerConnection.cpp +++ b/chromium/third_party/WebKit/Source/modules/mediastream/RTCPeerConnection.cpp @@ -100,7 +100,7 @@ PassRefPtr<RTCConfiguration> RTCPeerConnection::parseConfiguration(const Diction return 0; } KURL url(KURL(), urlString); - if (!url.isValid() || !(url.protocolIs("turn") || url.protocolIs("turns") || url.protocolIs("stun"))) { + if (!url.isValid() || !(url.protocolIs("turn") || url.protocolIs("stun"))) { es.throwDOMException(TypeMismatchError); return 0; } diff --git a/chromium/third_party/WebKit/Source/modules/modules.gypi b/chromium/third_party/WebKit/Source/modules/modules.gypi index 872b0df2b09..ba24a2ed92a 100644 --- a/chromium/third_party/WebKit/Source/modules/modules.gypi +++ b/chromium/third_party/WebKit/Source/modules/modules.gypi @@ -50,7 +50,6 @@ 'geolocation/Geolocation.idl', 'geolocation/Geoposition.idl', 'geolocation/PositionError.idl', - 'imagebitmap/ImageBitmapFactories.idl', 'indexeddb/IDBAny.idl', 'indexeddb/IDBCursor.idl', 'indexeddb/IDBCursorWithValue.idl', @@ -346,8 +345,6 @@ 'geolocation/GeolocationController.cpp', 'geolocation/NavigatorGeolocation.cpp', 'geolocation/NavigatorGeolocation.h', - 'imagebitmap/ImageBitmapFactories.cpp', - 'imagebitmap/ImageBitmapFactories.h', 'indexeddb/DOMWindowIndexedDatabase.cpp', 'indexeddb/DOMWindowIndexedDatabase.h', 'indexeddb/IDBAny.cpp', diff --git a/chromium/third_party/WebKit/Source/modules/navigatorcontentutils/NavigatorContentUtils.cpp b/chromium/third_party/WebKit/Source/modules/navigatorcontentutils/NavigatorContentUtils.cpp index df33faf653a..865e0f26b8f 100644 --- a/chromium/third_party/WebKit/Source/modules/navigatorcontentutils/NavigatorContentUtils.cpp +++ b/chromium/third_party/WebKit/Source/modules/navigatorcontentutils/NavigatorContentUtils.cpp @@ -62,7 +62,7 @@ static void initProtocolHandlerWhitelist() "tel", "urn", "webcal", - "wtai", + "webtai", "xmpp", }; for (size_t i = 0; i < WTF_ARRAY_LENGTH(protocols); ++i) @@ -106,8 +106,7 @@ static bool isProtocolWhitelisted(const String& scheme) static bool verifyProtocolHandlerScheme(const String& scheme, ExceptionState& es) { if (scheme.startsWith("web+")) { - // The specification requires that the length of scheme is at least five characteres (including 'web+' prefix). - if (scheme.length() >= 5 && isValidProtocol(scheme)) + if (isValidProtocol(scheme)) return true; es.throwDOMException(SecurityError); return false; diff --git a/chromium/third_party/WebKit/Source/web/AssociatedURLLoader.cpp b/chromium/third_party/WebKit/Source/web/AssociatedURLLoader.cpp index 98f9cae4fe2..ccf03cb1737 100644 --- a/chromium/third_party/WebKit/Source/web/AssociatedURLLoader.cpp +++ b/chromium/third_party/WebKit/Source/web/AssociatedURLLoader.cpp @@ -37,6 +37,7 @@ #include "core/loader/CrossOriginAccessControl.h" #include "core/loader/DocumentThreadableLoader.h" #include "core/loader/DocumentThreadableLoaderClient.h" +#include "core/loader/ResourceLoader.h" #include "core/platform/Timer.h" #include "core/platform/chromium/support/WrappedResourceRequest.h" #include "core/platform/chromium/support/WrappedResourceResponse.h" diff --git a/chromium/third_party/WebKit/Source/web/AsyncFileSystemChromium.cpp b/chromium/third_party/WebKit/Source/web/AsyncFileSystemChromium.cpp index 66b37edee11..32d2e4fa808 100644 --- a/chromium/third_party/WebKit/Source/web/AsyncFileSystemChromium.cpp +++ b/chromium/third_party/WebKit/Source/web/AsyncFileSystemChromium.cpp @@ -50,7 +50,9 @@ PassOwnPtr<AsyncFileSystem> AsyncFileSystem::create() } AsyncFileSystemChromium::AsyncFileSystemChromium() + : m_webFileSystem(WebKit::Platform::current()->fileSystem()) { + ASSERT(m_webFileSystem); } AsyncFileSystemChromium::~AsyncFileSystemChromium() @@ -59,52 +61,52 @@ AsyncFileSystemChromium::~AsyncFileSystemChromium() void AsyncFileSystemChromium::move(const KURL& sourcePath, const KURL& destinationPath, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) { - webFileSystem()->move(sourcePath, destinationPath, new WebKit::WebFileSystemCallbacksImpl(callbacks)); + m_webFileSystem->move(sourcePath, destinationPath, new WebKit::WebFileSystemCallbacksImpl(callbacks)); } void AsyncFileSystemChromium::copy(const KURL& sourcePath, const KURL& destinationPath, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) { - webFileSystem()->copy(sourcePath, destinationPath, new WebKit::WebFileSystemCallbacksImpl(callbacks)); + m_webFileSystem->copy(sourcePath, destinationPath, new WebKit::WebFileSystemCallbacksImpl(callbacks)); } void AsyncFileSystemChromium::remove(const KURL& path, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) { - webFileSystem()->remove(path, new WebKit::WebFileSystemCallbacksImpl(callbacks)); + m_webFileSystem->remove(path, new WebKit::WebFileSystemCallbacksImpl(callbacks)); } void AsyncFileSystemChromium::removeRecursively(const KURL& path, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) { - webFileSystem()->removeRecursively(path, new WebKit::WebFileSystemCallbacksImpl(callbacks)); + m_webFileSystem->removeRecursively(path, new WebKit::WebFileSystemCallbacksImpl(callbacks)); } void AsyncFileSystemChromium::readMetadata(const KURL& path, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) { - webFileSystem()->readMetadata(path, new WebKit::WebFileSystemCallbacksImpl(callbacks)); + m_webFileSystem->readMetadata(path, new WebKit::WebFileSystemCallbacksImpl(callbacks)); } void AsyncFileSystemChromium::createFile(const KURL& path, bool exclusive, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) { - webFileSystem()->createFile(path, exclusive, new WebKit::WebFileSystemCallbacksImpl(callbacks)); + m_webFileSystem->createFile(path, exclusive, new WebKit::WebFileSystemCallbacksImpl(callbacks)); } void AsyncFileSystemChromium::createDirectory(const KURL& path, bool exclusive, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) { - webFileSystem()->createDirectory(path, exclusive, new WebKit::WebFileSystemCallbacksImpl(callbacks)); + m_webFileSystem->createDirectory(path, exclusive, new WebKit::WebFileSystemCallbacksImpl(callbacks)); } void AsyncFileSystemChromium::fileExists(const KURL& path, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) { - webFileSystem()->fileExists(path, new WebKit::WebFileSystemCallbacksImpl(callbacks)); + m_webFileSystem->fileExists(path, new WebKit::WebFileSystemCallbacksImpl(callbacks)); } void AsyncFileSystemChromium::directoryExists(const KURL& path, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) { - webFileSystem()->directoryExists(path, new WebKit::WebFileSystemCallbacksImpl(callbacks)); + m_webFileSystem->directoryExists(path, new WebKit::WebFileSystemCallbacksImpl(callbacks)); } void AsyncFileSystemChromium::readDirectory(const KURL& path, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) { - webFileSystem()->readDirectory(path, new WebKit::WebFileSystemCallbacksImpl(callbacks)); + m_webFileSystem->readDirectory(path, new WebKit::WebFileSystemCallbacksImpl(callbacks)); } void AsyncFileSystemChromium::createWriter(AsyncFileWriterClient* client, const KURL& path, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) @@ -112,17 +114,12 @@ void AsyncFileSystemChromium::createWriter(AsyncFileWriterClient* client, const OwnPtr<AsyncFileWriterChromium> asyncFileWriter = AsyncFileWriterChromium::create(client); WebKit::WebFileWriterClient* writerClient = asyncFileWriter.get(); - webFileSystem()->createFileWriter(path, writerClient, new WebKit::WebFileSystemCallbacksImpl(callbacks, asyncFileWriter.release())); + m_webFileSystem->createFileWriter(path, writerClient, new WebKit::WebFileSystemCallbacksImpl(callbacks, asyncFileWriter.release())); } void AsyncFileSystemChromium::createSnapshotFileAndReadMetadata(const KURL& path, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) { - webFileSystem()->createSnapshotFileAndReadMetadata(path, new WebKit::WebFileSystemCallbacksImpl(callbacks)); -} - -WebKit::WebFileSystem* AsyncFileSystemChromium::webFileSystem() -{ - return WebKit::Platform::current()->fileSystem(); + m_webFileSystem->createSnapshotFileAndReadMetadata(path, new WebKit::WebFileSystemCallbacksImpl(callbacks)); } } // namespace WebCore diff --git a/chromium/third_party/WebKit/Source/web/AsyncFileSystemChromium.h b/chromium/third_party/WebKit/Source/web/AsyncFileSystemChromium.h index 1eaa9c2d89e..66496f50f70 100644 --- a/chromium/third_party/WebKit/Source/web/AsyncFileSystemChromium.h +++ b/chromium/third_party/WebKit/Source/web/AsyncFileSystemChromium.h @@ -64,9 +64,10 @@ public: virtual void createWriter(AsyncFileWriterClient*, const KURL& path, PassOwnPtr<AsyncFileSystemCallbacks>); virtual void createSnapshotFileAndReadMetadata(const KURL& path, PassOwnPtr<AsyncFileSystemCallbacks>); -private: +protected: AsyncFileSystemChromium(); - WebKit::WebFileSystem* webFileSystem(); + + WebKit::WebFileSystem* m_webFileSystem; }; } // namespace WebCore diff --git a/chromium/third_party/WebKit/Source/web/BackForwardClientImpl.cpp b/chromium/third_party/WebKit/Source/web/BackForwardClientImpl.cpp index 6e2c17f4bca..1cbbdb177e5 100644 --- a/chromium/third_party/WebKit/Source/web/BackForwardClientImpl.cpp +++ b/chromium/third_party/WebKit/Source/web/BackForwardClientImpl.cpp @@ -33,11 +33,15 @@ #include "WebViewClient.h" #include "WebViewImpl.h" +#include "core/history/HistoryItem.h" +#include "wtf/text/StringConcatenate.h" using namespace WebCore; namespace WebKit { +const char backForwardNavigationScheme[] = "chrome-back-forward"; + BackForwardClientImpl::BackForwardClientImpl(WebViewImpl* webView) : m_webView(webView) { @@ -47,11 +51,49 @@ BackForwardClientImpl::~BackForwardClientImpl() { } -void BackForwardClientImpl::didAddItem() +void BackForwardClientImpl::addItem(PassRefPtr<HistoryItem> item) { + m_currentItem = item; + // If WebCore adds a new HistoryItem, it means this is a new navigation (ie, // not a reload or back/forward). m_webView->observeNewNavigation(); + + if (m_webView->client()) + m_webView->client()->didAddHistoryItem(); +} + +void BackForwardClientImpl::goToItem(HistoryItem* item) +{ + m_currentItem = item; + + if (m_pendingHistoryItem == item) + m_pendingHistoryItem = 0; +} + +HistoryItem* BackForwardClientImpl::itemAtIndex(int index) +{ + if (!m_webView->client()) + return 0; + + if (!index) + return m_currentItem.get(); + + if (index > forwardListCount() || -index > backListCount()) + return 0; + + // Since we don't keep the entire back/forward list, we have no way to + // properly implement this method. We return a dummy entry instead that we + // intercept in our FrameLoaderClient implementation in case WebCore asks + // to navigate to this HistoryItem. + + // FIXME: We should change WebCore to handle history.{back,forward,go} + // differently. It should perhaps just ask the FrameLoaderClient to + // perform those navigations. + + String urlString = String(backForwardNavigationScheme) + "://go/" + String::number(index); + m_pendingHistoryItem = HistoryItem::create(urlString); + return m_pendingHistoryItem.get(); } int BackForwardClientImpl::backListCount() @@ -70,4 +112,15 @@ int BackForwardClientImpl::forwardListCount() return m_webView->client()->historyForwardListCount(); } +bool BackForwardClientImpl::isActive() +{ + return m_webView->client(); +} + +void BackForwardClientImpl::close() +{ + m_currentItem = 0; + m_pendingHistoryItem = 0; +} + } // namespace WebKit diff --git a/chromium/third_party/WebKit/Source/web/BackForwardClientImpl.h b/chromium/third_party/WebKit/Source/web/BackForwardClientImpl.h index 6550a4075ef..c76680948f3 100644 --- a/chromium/third_party/WebKit/Source/web/BackForwardClientImpl.h +++ b/chromium/third_party/WebKit/Source/web/BackForwardClientImpl.h @@ -37,6 +37,8 @@ namespace WebKit { class WebViewImpl; +extern const char backForwardNavigationScheme[]; + class BackForwardClientImpl : public WebCore::BackForwardClient { public: explicit BackForwardClientImpl(WebViewImpl*); @@ -44,11 +46,21 @@ public: private: // WebCore::BackForwardList methods: - virtual void didAddItem(); + virtual void addItem(PassRefPtr<WebCore::HistoryItem>); + virtual void goToItem(WebCore::HistoryItem*); + virtual WebCore::HistoryItem* itemAtIndex(int index); virtual int backListCount(); virtual int forwardListCount(); + virtual bool isActive(); + virtual void close(); WebViewImpl* m_webView; + + RefPtr<WebCore::HistoryItem> m_currentItem; + + // The last history item that was accessed via itemAtIndex(). We keep track + // of this until goToItem() is called, so we can track the navigation. + RefPtr<WebCore::HistoryItem> m_pendingHistoryItem; }; } // namespace WebKit diff --git a/chromium/third_party/WebKit/Source/web/ChromeClientImpl.cpp b/chromium/third_party/WebKit/Source/web/ChromeClientImpl.cpp index a567df5fb45..bea7012f64d 100644 --- a/chromium/third_party/WebKit/Source/web/ChromeClientImpl.cpp +++ b/chromium/third_party/WebKit/Source/web/ChromeClientImpl.cpp @@ -921,7 +921,7 @@ void ChromeClientImpl::openPasswordGenerator(HTMLInputElement* input) m_webView->passwordGeneratorClient()->openPasswordGenerator(webInput); } -bool ChromeClientImpl::shouldRunModalDialogDuringPageDismissal(const DialogType& dialogType, const String& dialogMessage, Document::PageDismissalType dismissalType) const +bool ChromeClientImpl::shouldRunModalDialogDuringPageDismissal(const DialogType& dialogType, const String& dialogMessage, FrameLoader::PageDismissalType dismissalType) const { const char* kDialogs[] = {"alert", "confirm", "prompt", "showModalDialog"}; int dialog = static_cast<int>(dialogType); diff --git a/chromium/third_party/WebKit/Source/web/ChromeClientImpl.h b/chromium/third_party/WebKit/Source/web/ChromeClientImpl.h index 639e9d9550b..71c4ace37ea 100644 --- a/chromium/third_party/WebKit/Source/web/ChromeClientImpl.h +++ b/chromium/third_party/WebKit/Source/web/ChromeClientImpl.h @@ -175,7 +175,7 @@ public: virtual bool isPasswordGenerationEnabled() const OVERRIDE; virtual void openPasswordGenerator(WebCore::HTMLInputElement*) OVERRIDE; - virtual bool shouldRunModalDialogDuringPageDismissal(const DialogType&, const String& dialogMessage, WebCore::Document::PageDismissalType) const; + virtual bool shouldRunModalDialogDuringPageDismissal(const DialogType&, const String& dialogMessage, WebCore::FrameLoader::PageDismissalType) const; virtual bool shouldRubberBandInDirection(WebCore::ScrollDirection) const; virtual void numWheelEventHandlersChanged(unsigned); diff --git a/chromium/third_party/WebKit/Source/web/ContextMenuClientImpl.cpp b/chromium/third_party/WebKit/Source/web/ContextMenuClientImpl.cpp index c8f36925cf7..a44c87d653e 100644 --- a/chromium/third_party/WebKit/Source/web/ContextMenuClientImpl.cpp +++ b/chromium/third_party/WebKit/Source/web/ContextMenuClientImpl.cpp @@ -122,7 +122,7 @@ static String selectMisspelledWord(Frame* selectedFrame) // Selection is empty, so change the selection to the word under the cursor. HitTestResult hitTestResult = selectedFrame->eventHandler()-> - hitTestResultAtPoint(selectedFrame->page()->contextMenuController().hitTestResult().pointInInnerNodeFrame()); + hitTestResultAtPoint(selectedFrame->page()->contextMenuController()->hitTestResult().pointInInnerNodeFrame()); Node* innerNode = hitTestResult.innerNode(); VisiblePosition pos(innerNode->renderer()->positionForPoint( hitTestResult.localPoint())); @@ -184,7 +184,7 @@ void ContextMenuClientImpl::showContextMenu(const WebCore::ContextMenu* defaultM if (!m_webView->contextMenuAllowed()) return; - HitTestResult r = m_webView->page()->contextMenuController().hitTestResult(); + HitTestResult r = m_webView->page()->contextMenuController()->hitTestResult(); Frame* selectedFrame = r.innerNodeFrame(); WebContextMenuData data; @@ -368,12 +368,6 @@ void ContextMenuClientImpl::showContextMenu(const WebCore::ContextMenu* defaultM m_webView->client()->showContextMenu(selected_web_frame, data); } -void ContextMenuClientImpl::clearContextMenu() -{ - if (m_webView->client()) - m_webView->client()->clearContextMenu(); -} - static void populateSubMenuItems(const Vector<ContextMenuItem>& inputMenu, WebVector<WebMenuItemInfo>& subMenuItems) { Vector<WebMenuItemInfo> subItems; diff --git a/chromium/third_party/WebKit/Source/web/ContextMenuClientImpl.h b/chromium/third_party/WebKit/Source/web/ContextMenuClientImpl.h index 5b0875c064a..b44c79add7f 100644 --- a/chromium/third_party/WebKit/Source/web/ContextMenuClientImpl.h +++ b/chromium/third_party/WebKit/Source/web/ContextMenuClientImpl.h @@ -43,7 +43,6 @@ public: ContextMenuClientImpl(WebViewImpl* webView) : m_webView(webView) {} virtual ~ContextMenuClientImpl() {} virtual void showContextMenu(const WebCore::ContextMenu*); - virtual void clearContextMenu(); private: void populateCustomMenuItems(const WebCore::ContextMenu*, WebContextMenuData*); WebViewImpl* m_webView; diff --git a/chromium/third_party/WebKit/Source/web/FrameLoaderClientImpl.cpp b/chromium/third_party/WebKit/Source/web/FrameLoaderClientImpl.cpp index 640bfb2563c..7a5f0c8ad5a 100644 --- a/chromium/third_party/WebKit/Source/web/FrameLoaderClientImpl.cpp +++ b/chromium/third_party/WebKit/Source/web/FrameLoaderClientImpl.cpp @@ -44,6 +44,7 @@ #include "core/loader/FrameLoadRequest.h" #include "core/loader/FrameLoader.h" #include "core/loader/ProgressTracker.h" +#include "core/loader/ResourceLoader.h" #include "core/page/Chrome.h" #include "core/page/EventHandler.h" #include "core/page/FrameView.h" @@ -523,11 +524,36 @@ void FrameLoaderClientImpl::loadURLExternally(const ResourceRequest& request, Na } } -void FrameLoaderClientImpl::navigateBackForward(int offset) const +bool FrameLoaderClientImpl::shouldGoToHistoryItem(HistoryItem* item) const { + const KURL& url = item->url(); + if (!url.protocolIs(backForwardNavigationScheme)) + return true; + + // Else, we'll punt this history navigation to the embedder. It is + // necessary that we intercept this here, well before the FrameLoader + // has made any state changes for this history traversal. + + bool ok; + int offset = url.lastPathComponent().toIntStrict(&ok); + if (!ok) { + ASSERT_NOT_REACHED(); + return false; + } + WebViewImpl* webview = m_webFrame->viewImpl(); if (webview->client()) webview->client()->navigateBackForwardSoon(offset); + + return false; +} + +bool FrameLoaderClientImpl::shouldStopLoadingForHistoryItem(HistoryItem* targetItem) const +{ + // Don't stop loading for pseudo-back-forward URLs, since they will get + // translated and then pass through again. + const KURL& url = targetItem->url(); + return !url.protocolIs(backForwardNavigationScheme); } void FrameLoaderClientImpl::didAccessInitialDocument() diff --git a/chromium/third_party/WebKit/Source/web/FrameLoaderClientImpl.h b/chromium/third_party/WebKit/Source/web/FrameLoaderClientImpl.h index 103567a883c..468c4dc2dfb 100644 --- a/chromium/third_party/WebKit/Source/web/FrameLoaderClientImpl.h +++ b/chromium/third_party/WebKit/Source/web/FrameLoaderClientImpl.h @@ -100,7 +100,8 @@ public: virtual void postProgressEstimateChangedNotification(); virtual void postProgressFinishedNotification(); virtual void loadURLExternally(const WebCore::ResourceRequest&, WebCore::NavigationPolicy, const String& suggestedName = String()); - virtual void navigateBackForward(int offset) const; + virtual bool shouldGoToHistoryItem(WebCore::HistoryItem*) const; + virtual bool shouldStopLoadingForHistoryItem(WebCore::HistoryItem*) const; virtual void didAccessInitialDocument(); virtual void didDisownOpener(); virtual void didDisplayInsecureContent(); diff --git a/chromium/third_party/WebKit/Source/web/PageOverlay.cpp b/chromium/third_party/WebKit/Source/web/PageOverlay.cpp index 9166835f2ca..c0e7911c527 100644 --- a/chromium/third_party/WebKit/Source/web/PageOverlay.cpp +++ b/chromium/third_party/WebKit/Source/web/PageOverlay.cpp @@ -110,15 +110,6 @@ void PageOverlay::update() m_layer = GraphicsLayer::create(m_viewImpl->graphicsLayerFactory(), m_layerClient.get()); m_layer->setName("WebViewImpl page overlay content"); m_layer->setDrawsContent(true); - - // Compositor hit-testing does not know how to deal with layers that may be - // transparent to events (see http://crbug.com/269598). So require - // scrolling and touches on this layer to go to the main thread. - WebLayer* platformLayer = m_layer->platformLayer(); - platformLayer->setShouldScrollOnMainThread(true); - WebVector<WebRect> webRects(static_cast<size_t>(1)); - webRects[0] = WebRect(0, 0, INT_MAX, INT_MAX); - platformLayer->setTouchEventHandlerRegion(webRects); } FloatSize size(m_viewImpl->size()); @@ -131,6 +122,9 @@ void PageOverlay::update() m_viewImpl->setOverlayLayer(m_layer.get()); m_layer->setNeedsDisplay(); + + WebLayer* platformLayer = m_layer->platformLayer(); + platformLayer->setShouldScrollOnMainThread(true); } void PageOverlay::paintWebFrame(GraphicsContext& gc) diff --git a/chromium/third_party/WebKit/Source/web/WebCache.cpp b/chromium/third_party/WebKit/Source/web/WebCache.cpp index c68013d8f7e..8ae3cd6062d 100644 --- a/chromium/third_party/WebKit/Source/web/WebCache.cpp +++ b/chromium/third_party/WebKit/Source/web/WebCache.cpp @@ -31,7 +31,7 @@ #include "config.h" #include "WebCache.h" -#include "core/fetch/MemoryCache.h" +#include "core/loader/cache/MemoryCache.h" using WebCore::MemoryCache; diff --git a/chromium/third_party/WebKit/Source/web/WebCachedURLRequest.cpp b/chromium/third_party/WebKit/Source/web/WebCachedURLRequest.cpp index a1d9eecf30e..4f5d16d0642 100644 --- a/chromium/third_party/WebKit/Source/web/WebCachedURLRequest.cpp +++ b/chromium/third_party/WebKit/Source/web/WebCachedURLRequest.cpp @@ -31,7 +31,7 @@ #include "config.h" #include "WebCachedURLRequest.h" -#include "core/fetch/FetchRequest.h" +#include "core/loader/cache/FetchRequest.h" #include "core/platform/chromium/support/WrappedResourceRequest.h" #include "public/platform/WebURLRequest.h" diff --git a/chromium/third_party/WebKit/Source/web/WebDataSourceImpl.cpp b/chromium/third_party/WebKit/Source/web/WebDataSourceImpl.cpp index 0ed7727edb9..fe987cdadf4 100644 --- a/chromium/third_party/WebKit/Source/web/WebDataSourceImpl.cpp +++ b/chromium/third_party/WebKit/Source/web/WebDataSourceImpl.cpp @@ -32,7 +32,6 @@ #include "WebDataSourceImpl.h" #include "ApplicationCacheHostInternal.h" -#include "core/dom/Document.h" #include "core/loader/FrameLoader.h" #include "public/platform/WebURL.h" #include "public/platform/WebURLError.h" @@ -98,14 +97,12 @@ bool WebDataSourceImpl::replacesCurrentHistoryItem() const WebString WebDataSourceImpl::pageTitle() const { - ASSERT(frame()->loader()->documentLoader() == this); - return frame()->document()->title(); + return title().string(); } WebTextDirection WebDataSourceImpl::pageTitleDirection() const { - ASSERT(frame()->loader()->documentLoader() == this); - return frame()->document()->titleWithDirection().direction() == LTR ? WebTextDirectionLeftToRight : WebTextDirectionRightToLeft; + return title().direction() == LTR ? WebTextDirectionLeftToRight : WebTextDirectionRightToLeft; } WebNavigationType WebDataSourceImpl::navigationType() const diff --git a/chromium/third_party/WebKit/Source/web/WebDevToolsAgentImpl.cpp b/chromium/third_party/WebKit/Source/web/WebDevToolsAgentImpl.cpp index 3ea57461e1f..0f533fbad5e 100644 --- a/chromium/third_party/WebKit/Source/web/WebDevToolsAgentImpl.cpp +++ b/chromium/third_party/WebKit/Source/web/WebDevToolsAgentImpl.cpp @@ -46,9 +46,9 @@ #include "bindings/v8/V8Binding.h" #include "bindings/v8/V8Utilities.h" #include "core/dom/ExceptionCode.h" -#include "core/fetch/MemoryCache.h" #include "core/inspector/InjectedScriptHost.h" #include "core/inspector/InspectorController.h" +#include "core/loader/cache/MemoryCache.h" #include "core/page/Frame.h" #include "core/page/FrameView.h" #include "core/page/Page.h" @@ -464,18 +464,10 @@ void WebDevToolsAgentImpl::webViewResized(const WebSize& size) bool WebDevToolsAgentImpl::handleInputEvent(WebCore::Page* page, const WebInputEvent& inputEvent) { - if (!m_attached) - return false; - InspectorController* ic = inspectorController(); if (!ic) return false; - if (WebInputEvent::isGestureEventType(inputEvent.type) && inputEvent.type == WebInputEvent::GestureTap) { - // Only let GestureTab in (we only need it and we know PlatformGestureEventBuilder supports it). - PlatformGestureEvent gestureEvent = PlatformGestureEventBuilder(page->mainFrame()->view(), *static_cast<const WebGestureEvent*>(&inputEvent)); - return ic->handleGestureEvent(page->mainFrame(), gestureEvent); - } if (WebInputEvent::isMouseEventType(inputEvent.type) && inputEvent.type != WebInputEvent::MouseEnter) { // PlatformMouseEventBuilder does not work with MouseEnter type, so we filter it out manually. PlatformMouseEvent mouseEvent = PlatformMouseEventBuilder(page->mainFrame()->view(), *static_cast<const WebMouseEvent*>(&inputEvent)); diff --git a/chromium/third_party/WebKit/Source/web/WebFileSystemCallbacksImpl.cpp b/chromium/third_party/WebKit/Source/web/WebFileSystemCallbacksImpl.cpp index a882f926a9a..b993b344337 100644 --- a/chromium/third_party/WebKit/Source/web/WebFileSystemCallbacksImpl.cpp +++ b/chromium/third_party/WebKit/Source/web/WebFileSystemCallbacksImpl.cpp @@ -32,6 +32,8 @@ #include "AsyncFileSystemChromium.h" #include "AsyncFileWriterChromium.h" +#include "WorkerAsyncFileSystemChromium.h" +#include "core/dom/ScriptExecutionContext.h" #include "core/platform/AsyncFileSystemCallbacks.h" #include "core/platform/FileMetadata.h" #include "public/platform/WebFileInfo.h" @@ -45,14 +47,17 @@ using namespace WebCore; namespace WebKit { -WebFileSystemCallbacksImpl::WebFileSystemCallbacksImpl(PassOwnPtr<AsyncFileSystemCallbacks> callbacks) +WebFileSystemCallbacksImpl::WebFileSystemCallbacksImpl(PassOwnPtr<AsyncFileSystemCallbacks> callbacks, ScriptExecutionContext* context, FileSystemSynchronousType synchronousType) : m_callbacks(callbacks) + , m_context(context) + , m_synchronousType(synchronousType) { ASSERT(m_callbacks); } WebFileSystemCallbacksImpl::WebFileSystemCallbacksImpl(PassOwnPtr<AsyncFileSystemCallbacks> callbacks, PassOwnPtr<AsyncFileWriterChromium> writer) : m_callbacks(callbacks) + , m_context(0) , m_writer(writer) { ASSERT(m_callbacks); @@ -112,6 +117,11 @@ void WebFileSystemCallbacksImpl::didOpenFileSystem(const WebString& name, const { // This object is intended to delete itself on exit. OwnPtr<WebFileSystemCallbacksImpl> callbacks = adoptPtr(this); + + if (m_context && m_context->isWorkerGlobalScope()) { + m_callbacks->didOpenFileSystem(name, rootURL, WorkerAsyncFileSystemChromium::create(m_context, m_synchronousType)); + return; + } m_callbacks->didOpenFileSystem(name, rootURL, AsyncFileSystemChromium::create()); } diff --git a/chromium/third_party/WebKit/Source/web/WebFileSystemCallbacksImpl.h b/chromium/third_party/WebKit/Source/web/WebFileSystemCallbacksImpl.h index 1522f94af85..06d1f8c137e 100644 --- a/chromium/third_party/WebKit/Source/web/WebFileSystemCallbacksImpl.h +++ b/chromium/third_party/WebKit/Source/web/WebFileSystemCallbacksImpl.h @@ -42,6 +42,7 @@ namespace WebCore { class AsyncFileSystemCallbacks; class AsyncFileWriterChromium; class BlobDataHandle; +class ScriptExecutionContext; } namespace WebKit { @@ -53,7 +54,7 @@ class WebURL; class WebFileSystemCallbacksImpl : public WebFileSystemCallbacks { public: - WebFileSystemCallbacksImpl(PassOwnPtr<WebCore::AsyncFileSystemCallbacks>); + WebFileSystemCallbacksImpl(PassOwnPtr<WebCore::AsyncFileSystemCallbacks>, WebCore::ScriptExecutionContext* = 0, WebCore::FileSystemSynchronousType = WebCore::AsynchronousFileSystem); WebFileSystemCallbacksImpl(PassOwnPtr<WebCore::AsyncFileSystemCallbacks>, PassOwnPtr<WebCore::AsyncFileWriterChromium>); virtual ~WebFileSystemCallbacksImpl(); @@ -74,6 +75,10 @@ public: private: OwnPtr<WebCore::AsyncFileSystemCallbacks> m_callbacks; + // Used for worker's openFileSystem callbacks. + WebCore::ScriptExecutionContext* m_context; + WebCore::FileSystemSynchronousType m_synchronousType; + // Used for createFileWriter callbacks. OwnPtr<WebCore::AsyncFileWriterChromium> m_writer; }; diff --git a/chromium/third_party/WebKit/Source/web/WebFrameImpl.cpp b/chromium/third_party/WebKit/Source/web/WebFrameImpl.cpp index baf06cd1d7a..8526f56e4fe 100644 --- a/chromium/third_party/WebKit/Source/web/WebFrameImpl.cpp +++ b/chromium/third_party/WebKit/Source/web/WebFrameImpl.cpp @@ -984,7 +984,7 @@ void WebFrameImpl::stopLoading() // FIXME: Figure out what we should really do here. It seems like a bug // that FrameLoader::stopLoading doesn't call stopAllLoaders. frame()->loader()->stopAllLoaders(); - frame()->loader()->stopLoading(); + frame()->loader()->stopLoading(UnloadEventPolicyNone); } WebDataSource* WebFrameImpl::provisionalDataSource() const @@ -1368,11 +1368,6 @@ void WebFrameImpl::moveCaretSelection(const WebPoint& point) frame()->selection()->moveTo(position, UserTriggered); } -void WebFrameImpl::setCaretVisible(bool visible) -{ - frame()->selection()->setCaretVisible(visible); -} - VisiblePosition WebFrameImpl::visiblePositionForWindowPoint(const WebPoint& point) { FloatPoint unscaledPoint(point); diff --git a/chromium/third_party/WebKit/Source/web/WebFrameImpl.h b/chromium/third_party/WebKit/Source/web/WebFrameImpl.h index b6e0b419399..d67fc22e083 100644 --- a/chromium/third_party/WebKit/Source/web/WebFrameImpl.h +++ b/chromium/third_party/WebKit/Source/web/WebFrameImpl.h @@ -188,7 +188,6 @@ public: virtual void moveCaretSelectionTowardsWindowPoint(const WebPoint&); virtual void moveRangeSelection(const WebPoint& base, const WebPoint& extent); virtual void moveCaretSelection(const WebPoint&); - virtual void setCaretVisible(bool); virtual int printBegin(const WebPrintParams&, const WebNode& constrainToNode, bool* useBrowserOverlays); diff --git a/chromium/third_party/WebKit/Source/web/WebHelperPluginImpl.cpp b/chromium/third_party/WebKit/Source/web/WebHelperPluginImpl.cpp index 570d4b31050..028f5220005 100644 --- a/chromium/third_party/WebKit/Source/web/WebHelperPluginImpl.cpp +++ b/chromium/third_party/WebKit/Source/web/WebHelperPluginImpl.cpp @@ -131,7 +131,7 @@ void WebHelperPluginImpl::closeHelperPlugin() if (m_page) { m_page->clearPageGroup(); m_page->mainFrame()->loader()->stopAllLoaders(); - m_page->mainFrame()->loader()->stopLoading(); + m_page->mainFrame()->loader()->stopLoading(UnloadEventPolicyNone); } // We must destroy the page now in case the host page is being destroyed, in diff --git a/chromium/third_party/WebKit/Source/web/WebPagePopupImpl.cpp b/chromium/third_party/WebKit/Source/web/WebPagePopupImpl.cpp index c52a116d0b8..b1968204c5b 100644 --- a/chromium/third_party/WebKit/Source/web/WebPagePopupImpl.cpp +++ b/chromium/third_party/WebKit/Source/web/WebPagePopupImpl.cpp @@ -320,7 +320,7 @@ void WebPagePopupImpl::closePopup() if (m_page) { m_page->clearPageGroup(); m_page->mainFrame()->loader()->stopAllLoaders(); - m_page->mainFrame()->loader()->stopLoading(); + m_page->mainFrame()->loader()->stopLoading(UnloadEventPolicyNone); DOMWindowPagePopup::uninstall(m_page->mainFrame()->domWindow()); } m_closing = true; diff --git a/chromium/third_party/WebKit/Source/web/WebViewImpl.cpp b/chromium/third_party/WebKit/Source/web/WebViewImpl.cpp index 2c8e3da8b0b..6674e5e321f 100644 --- a/chromium/third_party/WebKit/Source/web/WebViewImpl.cpp +++ b/chromium/third_party/WebKit/Source/web/WebViewImpl.cpp @@ -567,7 +567,7 @@ void WebViewImpl::mouseContextMenu(const WebMouseEvent& event) if (!mainFrameImpl() || !mainFrameImpl()->frameView()) return; - m_page->contextMenuController().clearContextMenu(); + m_page->contextMenuController()->clearContextMenu(); PlatformMouseEventBuilder pme(mainFrameImpl()->frameView(), event); @@ -760,7 +760,7 @@ bool WebViewImpl::handleGestureEvent(const WebGestureEvent& event) break; m_client->cancelScheduledContentIntents(); - m_page->contextMenuController().clearContextMenu(); + m_page->contextMenuController()->clearContextMenu(); m_contextMenuAllowed = true; eventSwallowed = mainFrameImpl()->frame()->eventHandler()->handleGestureEvent(platformEvent); m_contextMenuAllowed = false; @@ -1356,7 +1356,7 @@ bool WebViewImpl::sendContextMenuEvent(const WebKeyboardEvent& event) // detect if we create a new menu for this event, since we won't create // a new menu if the DOM swallows the event and the defaultEventHandler does // not run. - page()->contextMenuController().clearContextMenu(); + page()->contextMenuController()->clearContextMenu(); m_contextMenuAllowed = true; Frame* focusedFrame = page()->focusController().focusedOrMainFrame(); @@ -2462,19 +2462,19 @@ void WebViewImpl::willCloseLayerTreeView() void WebViewImpl::didAcquirePointerLock() { if (page()) - page()->pointerLockController().didAcquirePointerLock(); + page()->pointerLockController()->didAcquirePointerLock(); } void WebViewImpl::didNotAcquirePointerLock() { if (page()) - page()->pointerLockController().didNotAcquirePointerLock(); + page()->pointerLockController()->didNotAcquirePointerLock(); } void WebViewImpl::didLosePointerLock() { if (page()) - page()->pointerLockController().didLosePointerLock(); + page()->pointerLockController()->didLosePointerLock(); } void WebViewImpl::didChangeWindowResizerRect() @@ -3453,13 +3453,13 @@ void WebViewImpl::performCustomContextMenuAction(unsigned action) { if (!m_page) return; - ContextMenu* menu = m_page->contextMenuController().contextMenu(); + ContextMenu* menu = m_page->contextMenuController()->contextMenu(); if (!menu) return; const ContextMenuItem* item = menu->itemWithAction(static_cast<ContextMenuAction>(ContextMenuItemBaseCustomTag + action)); if (item) - m_page->contextMenuController().contextMenuItemSelected(item); - m_page->contextMenuController().clearContextMenu(); + m_page->contextMenuController()->contextMenuItemSelected(item); + m_page->contextMenuController()->clearContextMenu(); } void WebViewImpl::showContextMenu() @@ -3467,7 +3467,7 @@ void WebViewImpl::showContextMenu() if (!page()) return; - page()->contextMenuController().clearContextMenu(); + page()->contextMenuController()->clearContextMenu(); m_contextMenuAllowed = true; if (Frame* focusedFrame = page()->focusController().focusedOrMainFrame()) focusedFrame->eventHandler()->sendContextMenuEventForKey(); @@ -4071,7 +4071,7 @@ void WebViewImpl::pointerLockMouseEvent(const WebInputEvent& event) const WebMouseEvent& mouseEvent = static_cast<const WebMouseEvent&>(event); if (page()) - page()->pointerLockController().dispatchLockedMouseEvent( + page()->pointerLockController()->dispatchLockedMouseEvent( PlatformMouseEventBuilder(mainFrameImpl()->frameView(), mouseEvent), eventType); } diff --git a/chromium/third_party/WebKit/Source/web/WorkerAsyncFileSystemChromium.cpp b/chromium/third_party/WebKit/Source/web/WorkerAsyncFileSystemChromium.cpp new file mode 100644 index 00000000000..5da01d30c42 --- /dev/null +++ b/chromium/third_party/WebKit/Source/web/WorkerAsyncFileSystemChromium.cpp @@ -0,0 +1,194 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "WorkerAsyncFileSystemChromium.h" + +#include "WebFileSystemCallbacksImpl.h" +#include "WebFileWriter.h" +#include "WorkerAsyncFileWriterChromium.h" +#include "WorkerFileSystemCallbacksBridge.h" +#include "bindings/v8/WorkerScriptController.h" +#include "core/fileapi/BlobURL.h" +#include "core/platform/AsyncFileSystemCallbacks.h" +#include "core/platform/FileMetadata.h" +#include "core/platform/FileSystem.h" +#include "core/platform/NotImplemented.h" +#include "core/workers/WorkerGlobalScope.h" +#include "core/workers/WorkerThread.h" +#include "public/platform/WebFileSystem.h" +#include "wtf/text/CString.h" + +using namespace WebKit; + +namespace WebCore { + +static const char fileSystemOperationsMode[] = "fileSystemOperationsMode"; + +WorkerAsyncFileSystemChromium::WorkerAsyncFileSystemChromium(ScriptExecutionContext* context, FileSystemSynchronousType synchronousType) + : m_scriptExecutionContext(context) + , m_workerGlobalScope(toWorkerGlobalScope(context)) + , m_synchronousType(synchronousType) +{ + ASSERT(m_scriptExecutionContext->isWorkerGlobalScope()); + + m_workerLoaderProxy = &m_workerGlobalScope->thread()->workerLoaderProxy(); +} + +WorkerAsyncFileSystemChromium::~WorkerAsyncFileSystemChromium() +{ +} + +bool WorkerAsyncFileSystemChromium::waitForOperationToComplete() +{ + if (!m_bridgeForCurrentOperation) + return false; + + RefPtr<WorkerFileSystemCallbacksBridge> bridge = m_bridgeForCurrentOperation.release(); + if (m_workerGlobalScope->thread()->runLoop().runInMode(m_workerGlobalScope, m_modeForCurrentOperation) == MessageQueueTerminated) { + bridge->stop(); + return false; + } + return true; +} + +void WorkerAsyncFileSystemChromium::move(const KURL& sourcePath, const KURL& destinationPath, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) +{ + createWorkerFileSystemCallbacksBridge(callbacks)->postMoveToMainThread(m_webFileSystem, sourcePath, destinationPath, m_modeForCurrentOperation); +} + +void WorkerAsyncFileSystemChromium::copy(const KURL& sourcePath, const KURL& destinationPath, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) +{ + createWorkerFileSystemCallbacksBridge(callbacks)->postCopyToMainThread(m_webFileSystem, sourcePath, destinationPath, m_modeForCurrentOperation); +} + +void WorkerAsyncFileSystemChromium::remove(const KURL& path, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) +{ + createWorkerFileSystemCallbacksBridge(callbacks)->postRemoveToMainThread(m_webFileSystem, path, m_modeForCurrentOperation); +} + +void WorkerAsyncFileSystemChromium::removeRecursively(const KURL& path, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) +{ + createWorkerFileSystemCallbacksBridge(callbacks)->postRemoveRecursivelyToMainThread(m_webFileSystem, path, m_modeForCurrentOperation); +} + +void WorkerAsyncFileSystemChromium::readMetadata(const KURL& path, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) +{ + createWorkerFileSystemCallbacksBridge(callbacks)->postReadMetadataToMainThread(m_webFileSystem, path, m_modeForCurrentOperation); +} + +void WorkerAsyncFileSystemChromium::createFile(const KURL& path, bool exclusive, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) +{ + createWorkerFileSystemCallbacksBridge(callbacks)->postCreateFileToMainThread(m_webFileSystem, path, exclusive, m_modeForCurrentOperation); +} + +void WorkerAsyncFileSystemChromium::createDirectory(const KURL& path, bool exclusive, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) +{ + createWorkerFileSystemCallbacksBridge(callbacks)->postCreateDirectoryToMainThread(m_webFileSystem, path, exclusive, m_modeForCurrentOperation); +} + +void WorkerAsyncFileSystemChromium::fileExists(const KURL& path, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) +{ + createWorkerFileSystemCallbacksBridge(callbacks)->postFileExistsToMainThread(m_webFileSystem, path, m_modeForCurrentOperation); +} + +void WorkerAsyncFileSystemChromium::directoryExists(const KURL& path, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) +{ + createWorkerFileSystemCallbacksBridge(callbacks)->postDirectoryExistsToMainThread(m_webFileSystem, path, m_modeForCurrentOperation); +} + +void WorkerAsyncFileSystemChromium::readDirectory(const KURL& path, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) +{ + createWorkerFileSystemCallbacksBridge(callbacks)->postReadDirectoryToMainThread(m_webFileSystem, path, m_modeForCurrentOperation); +} + +class WorkerFileWriterHelperCallbacks : public AsyncFileSystemCallbacks { +public: + static PassOwnPtr<WorkerFileWriterHelperCallbacks> create(AsyncFileWriterClient* client, const WebURL& path, WebKit::WebFileSystem* webFileSystem, PassOwnPtr<WebCore::AsyncFileSystemCallbacks> callbacks, WorkerGlobalScope* workerGlobalScope) + { + return adoptPtr(new WorkerFileWriterHelperCallbacks(client, path, webFileSystem, callbacks, workerGlobalScope)); + } + + virtual void didReadMetadata(const FileMetadata& metadata) + { + ASSERT(m_callbacks); + if (metadata.type != FileMetadata::TypeFile || metadata.length < 0) + m_callbacks->didFail(WebKit::WebFileErrorInvalidState); + else { + OwnPtr<WorkerAsyncFileWriterChromium> asyncFileWriterChromium = WorkerAsyncFileWriterChromium::create(m_webFileSystem, m_path, m_workerGlobalScope, m_client, WorkerAsyncFileWriterChromium::Asynchronous); + m_callbacks->didCreateFileWriter(asyncFileWriterChromium.release(), metadata.length); + } + } + + virtual void didFail(int code) + { + ASSERT(m_callbacks); + m_callbacks->didFail(code); + } + +private: + WorkerFileWriterHelperCallbacks(AsyncFileWriterClient* client, const WebURL& path, WebKit::WebFileSystem* webFileSystem, PassOwnPtr<WebCore::AsyncFileSystemCallbacks> callbacks, WorkerGlobalScope* workerGlobalScope) + : m_client(client) + , m_path(path) + , m_webFileSystem(webFileSystem) + , m_callbacks(callbacks) + , m_workerGlobalScope(workerGlobalScope) + { + } + + AsyncFileWriterClient* m_client; + WebURL m_path; + WebKit::WebFileSystem* m_webFileSystem; + OwnPtr<WebCore::AsyncFileSystemCallbacks> m_callbacks; + WorkerGlobalScope* m_workerGlobalScope; +}; + +void WorkerAsyncFileSystemChromium::createWriter(AsyncFileWriterClient* client, const KURL& path, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) +{ + createWorkerFileSystemCallbacksBridge(WorkerFileWriterHelperCallbacks::create(client, path, m_webFileSystem, callbacks, m_workerGlobalScope))->postReadMetadataToMainThread(m_webFileSystem, path, m_modeForCurrentOperation); +} + +void WorkerAsyncFileSystemChromium::createSnapshotFileAndReadMetadata(const KURL& path, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) +{ + createWorkerFileSystemCallbacksBridge(callbacks)->postCreateSnapshotFileToMainThread(m_webFileSystem, path, m_modeForCurrentOperation); +} + +PassRefPtr<WorkerFileSystemCallbacksBridge> WorkerAsyncFileSystemChromium::createWorkerFileSystemCallbacksBridge(PassOwnPtr<AsyncFileSystemCallbacks> callbacks) +{ + ASSERT_UNUSED(m_synchronousType, m_synchronousType == AsynchronousFileSystem || !m_bridgeForCurrentOperation); + + m_modeForCurrentOperation = fileSystemOperationsMode; + m_modeForCurrentOperation.append(String::number(m_workerGlobalScope->thread()->runLoop().createUniqueId())); + + m_bridgeForCurrentOperation = WorkerFileSystemCallbacksBridge::create(m_workerLoaderProxy, m_scriptExecutionContext, new WebKit::WebFileSystemCallbacksImpl(callbacks)); + return m_bridgeForCurrentOperation; +} + +} // namespace WebCore diff --git a/chromium/third_party/WebKit/Source/web/WorkerAsyncFileSystemChromium.h b/chromium/third_party/WebKit/Source/web/WorkerAsyncFileSystemChromium.h new file mode 100644 index 00000000000..b6675555fb4 --- /dev/null +++ b/chromium/third_party/WebKit/Source/web/WorkerAsyncFileSystemChromium.h @@ -0,0 +1,92 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WorkerAsyncFileSystemChromium_h +#define WorkerAsyncFileSystemChromium_h + +#include "AsyncFileSystemChromium.h" +#include "modules/filesystem/FileSystemType.h" +#include "wtf/PassOwnPtr.h" +#include "wtf/RefPtr.h" + +namespace WebKit { +class WebFileSystem; +class WebURL; +class WorkerFileSystemCallbacksBridge; +} + +namespace WebCore { + +class AsyncFileSystemCallbacks; +class ScriptExecutionContext; +class WorkerGlobalScope; +class WorkerLoaderProxy; + +class WorkerAsyncFileSystemChromium : public AsyncFileSystemChromium { +public: + static PassOwnPtr<AsyncFileSystem> create(ScriptExecutionContext* context, FileSystemSynchronousType synchronousType) + { + return adoptPtr(new WorkerAsyncFileSystemChromium(context, synchronousType)); + } + + virtual ~WorkerAsyncFileSystemChromium(); + + // Runs one pending operation (to wait for completion in the sync-mode). + virtual bool waitForOperationToComplete(); + + virtual void move(const KURL& sourcePath, const KURL& destinationPath, PassOwnPtr<AsyncFileSystemCallbacks>); + virtual void copy(const KURL& sourcePath, const KURL& destinationPath, PassOwnPtr<AsyncFileSystemCallbacks>); + virtual void remove(const KURL& path, PassOwnPtr<AsyncFileSystemCallbacks>); + virtual void removeRecursively(const KURL& path, PassOwnPtr<AsyncFileSystemCallbacks>); + virtual void readMetadata(const KURL& path, PassOwnPtr<AsyncFileSystemCallbacks>); + virtual void createFile(const KURL& path, bool exclusive, PassOwnPtr<AsyncFileSystemCallbacks>); + virtual void createDirectory(const KURL& path, bool exclusive, PassOwnPtr<AsyncFileSystemCallbacks>); + virtual void fileExists(const KURL& path, PassOwnPtr<AsyncFileSystemCallbacks>); + virtual void directoryExists(const KURL& path, PassOwnPtr<AsyncFileSystemCallbacks>); + virtual void readDirectory(const KURL& path, PassOwnPtr<AsyncFileSystemCallbacks>); + virtual void createWriter(AsyncFileWriterClient*, const KURL& path, PassOwnPtr<AsyncFileSystemCallbacks>); + virtual void createSnapshotFileAndReadMetadata(const KURL& path, PassOwnPtr<AsyncFileSystemCallbacks>); + +private: + WorkerAsyncFileSystemChromium(ScriptExecutionContext*, FileSystemSynchronousType); + + PassRefPtr<WebKit::WorkerFileSystemCallbacksBridge> createWorkerFileSystemCallbacksBridge(PassOwnPtr<AsyncFileSystemCallbacks>); + + ScriptExecutionContext* m_scriptExecutionContext; + WorkerLoaderProxy* m_workerLoaderProxy; + WorkerGlobalScope* m_workerGlobalScope; + RefPtr<WebKit::WorkerFileSystemCallbacksBridge> m_bridgeForCurrentOperation; + String m_modeForCurrentOperation; + FileSystemSynchronousType m_synchronousType; +}; + +} // namespace WebCore + +#endif // WorkerAsyncFileSystemChromium_h diff --git a/chromium/third_party/WebKit/Source/web/WorkerAsyncFileWriterChromium.cpp b/chromium/third_party/WebKit/Source/web/WorkerAsyncFileWriterChromium.cpp new file mode 100644 index 00000000000..5e675532300 --- /dev/null +++ b/chromium/third_party/WebKit/Source/web/WorkerAsyncFileWriterChromium.cpp @@ -0,0 +1,84 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "WorkerAsyncFileWriterChromium.h" + +#include "WebFileWriter.h" +#include "WebWorkerBase.h" +#include "WorkerFileWriterCallbacksBridge.h" +#include "core/dom/ScriptExecutionContext.h" +#include "core/fileapi/Blob.h" +#include "core/platform/AsyncFileSystem.h" +#include "core/workers/WorkerGlobalScope.h" +#include "core/workers/WorkerLoaderProxy.h" +#include "core/workers/WorkerThread.h" +#include "public/platform/WebFileSystem.h" +#include "public/platform/WebURL.h" +#include "wtf/Assertions.h" + +using namespace WebKit; + +namespace WebCore { + +WorkerAsyncFileWriterChromium::WorkerAsyncFileWriterChromium(WebFileSystem* webFileSystem, const WebURL& path, WorkerGlobalScope* workerGlobalScope, AsyncFileWriterClient* client, WriterType type) +{ + ASSERT(type == Asynchronous); // Synchronous is not implemented yet. + + WorkerLoaderProxy* proxy = &workerGlobalScope->thread()->workerLoaderProxy(); + m_bridge = WorkerFileWriterCallbacksBridge::create(path, proxy, workerGlobalScope, client); +} + +WorkerAsyncFileWriterChromium::~WorkerAsyncFileWriterChromium() +{ + m_bridge->postShutdownToMainThread(m_bridge); +} + +bool WorkerAsyncFileWriterChromium::waitForOperationToComplete() +{ + return m_bridge->waitForOperationToComplete(); +} + +void WorkerAsyncFileWriterChromium::write(long long position, Blob* data) +{ + m_bridge->postWriteToMainThread(position, data->url()); +} + +void WorkerAsyncFileWriterChromium::truncate(long long length) +{ + m_bridge->postTruncateToMainThread(length); +} + +void WorkerAsyncFileWriterChromium::abort() +{ + m_bridge->postAbortToMainThread(); +} + +} diff --git a/chromium/third_party/WebKit/Source/core/animation/AnimatableTransform.h b/chromium/third_party/WebKit/Source/web/WorkerAsyncFileWriterChromium.h index a0e71dfb61f..96ebd354a65 100644 --- a/chromium/third_party/WebKit/Source/core/animation/AnimatableTransform.h +++ b/chromium/third_party/WebKit/Source/web/WorkerAsyncFileWriterChromium.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2013 Google Inc. All rights reserved. + * Copyright (C) 2010 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 @@ -28,43 +28,57 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef AnimatableTransform_h -#define AnimatableTransform_h +#ifndef WorkerAsyncFileWriterChromium_h +#define WorkerAsyncFileWriterChromium_h -#include "core/animation/AnimatableValue.h" -#include "core/platform/graphics/transforms/TransformOperations.h" +#include "modules/filesystem/AsyncFileWriter.h" +#include "wtf/PassOwnPtr.h" + +namespace WebKit { + class WebFileSystem; + class WebFileWriter; + class WebURL; + class WorkerFileWriterCallbacksBridge; +} + +namespace WTF { + class String; +} +using WTF::String; namespace WebCore { -class AnimatableTransform : public AnimatableValue { +class AsyncFileSystem; +class AsyncFileWriterClient; +class Blob; +class WorkerGlobalScope; + +class WorkerAsyncFileWriterChromium : public AsyncFileWriter { public: - virtual ~AnimatableTransform() { } - static PassRefPtr<AnimatableTransform> create(const TransformOperations&); - const TransformOperations& transformOperations() const + enum WriterType { + Asynchronous, + Synchronous, + }; + + static PassOwnPtr<WorkerAsyncFileWriterChromium> create(WebKit::WebFileSystem* webFileSystem, const WebKit::WebURL& path, WorkerGlobalScope* workerGlobalScope, AsyncFileWriterClient* client, WriterType type) { - return m_transform; + return adoptPtr(new WorkerAsyncFileWriterChromium(webFileSystem, path, workerGlobalScope, client, type)); } + ~WorkerAsyncFileWriterChromium(); -protected: - virtual PassRefPtr<AnimatableValue> interpolateTo(const AnimatableValue*, double fraction) const OVERRIDE; - virtual PassRefPtr<AnimatableValue> addWith(const AnimatableValue*) const OVERRIDE; + bool waitForOperationToComplete(); -private: - explicit AnimatableTransform(const TransformOperations& transform) - : AnimatableValue(TypeTransform) - , m_transform(transform) - { - } - const TransformOperations m_transform; -}; + // FileWriter + virtual void write(long long position, Blob* data); + virtual void truncate(long long length); + virtual void abort(); -inline const AnimatableTransform* toAnimatableTransform(const AnimatableValue* value) -{ - ASSERT_WITH_SECURITY_IMPLICATION(value && value->isTransform()); - return static_cast<const AnimatableTransform*>(value); -} +private: -} // namespace WebCore + WorkerAsyncFileWriterChromium(WebKit::WebFileSystem*, const WebKit::WebURL& path, WorkerGlobalScope*, AsyncFileWriterClient*, WriterType); + RefPtr<WebKit::WorkerFileWriterCallbacksBridge> m_bridge; +}; -#endif // AnimatableTransform_h +} // namespace +#endif // AsyncFileWriterChromium_h diff --git a/chromium/third_party/WebKit/Source/web/WorkerFileSystemClient.cpp b/chromium/third_party/WebKit/Source/web/WorkerFileSystemClient.cpp index 4daa833e9cb..3e3e065f613 100644 --- a/chromium/third_party/WebKit/Source/web/WorkerFileSystemClient.cpp +++ b/chromium/third_party/WebKit/Source/web/WorkerFileSystemClient.cpp @@ -119,7 +119,7 @@ void WorkerFileSystemClient::openFileSystem(ScriptExecutionContext* context, Web String mode = "openFileSystemMode"; mode.append(String::number(runLoop.createUniqueId())); - RefPtr<WorkerFileSystemCallbacksBridge> bridge = WorkerFileSystemCallbacksBridge::create(workerLoaderProxy, workerGlobalScope, new WebFileSystemCallbacksImpl(callbacks)); + RefPtr<WorkerFileSystemCallbacksBridge> bridge = WorkerFileSystemCallbacksBridge::create(workerLoaderProxy, workerGlobalScope, new WebFileSystemCallbacksImpl(callbacks, context, synchronousType)); bridge->postOpenFileSystemToMainThread(webWorker->commonClient(), static_cast<WebFileSystemType>(type), size, openMode == CreateFileSystemIfNotPresent, mode); if (synchronousType == SynchronousFileSystem) { diff --git a/chromium/third_party/WebKit/Source/web/WorkerFileWriterCallbacksBridge.cpp b/chromium/third_party/WebKit/Source/web/WorkerFileWriterCallbacksBridge.cpp new file mode 100644 index 00000000000..96aaa33446a --- /dev/null +++ b/chromium/third_party/WebKit/Source/web/WorkerFileWriterCallbacksBridge.cpp @@ -0,0 +1,228 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "WorkerFileWriterCallbacksBridge.h" + +#include "WebFileWriter.h" +#include "WebWorkerBase.h" +#include "core/dom/CrossThreadTask.h" +#include "core/workers/WorkerGlobalScope.h" +#include "core/workers/WorkerLoaderProxy.h" +#include "core/workers/WorkerThread.h" +#include "modules/filesystem/AsyncFileWriterClient.h" +#include "public/platform/Platform.h" +#include "public/platform/WebCString.h" +#include "public/platform/WebFileSystem.h" +#include "wtf/MainThread.h" +#include "wtf/Threading.h" + +using namespace WebCore; + +namespace WebKit { + +void WorkerFileWriterCallbacksBridge::notifyStop() +{ + ASSERT(m_workerGlobalScope->isContextThread()); + m_clientOnWorkerThread = 0; + { + MutexLocker locker(m_loaderProxyMutex); + m_proxy = 0; + } +} + +void WorkerFileWriterCallbacksBridge::postWriteToMainThread(long long position, const KURL& data) +{ + ASSERT(!m_operationInProgress); + m_operationInProgress = true; + dispatchTaskToMainThread(createCallbackTask(&writeOnMainThread, + this, position, data)); +} + +void WorkerFileWriterCallbacksBridge::postTruncateToMainThread(long long length) +{ + ASSERT(!m_operationInProgress); + m_operationInProgress = true; + dispatchTaskToMainThread(createCallbackTask(&truncateOnMainThread, + this, length)); +} + +void WorkerFileWriterCallbacksBridge::postAbortToMainThread() +{ + ASSERT(m_operationInProgress); + dispatchTaskToMainThread(createCallbackTask(&abortOnMainThread, this)); +} + +void WorkerFileWriterCallbacksBridge::postShutdownToMainThread(PassRefPtr<WorkerFileWriterCallbacksBridge> bridge) +{ + ASSERT(m_workerGlobalScope->isContextThread()); + m_clientOnWorkerThread = 0; + stopObserving(); + dispatchTaskToMainThread(createCallbackTask(&shutdownOnMainThread, bridge)); +} + +void WorkerFileWriterCallbacksBridge::writeOnMainThread(ScriptExecutionContext*, PassRefPtr<WorkerFileWriterCallbacksBridge> bridge, long long position, const KURL& data) +{ + bridge->m_writer->write(position, WebURL(data)); +} + +void WorkerFileWriterCallbacksBridge::truncateOnMainThread(ScriptExecutionContext*, PassRefPtr<WorkerFileWriterCallbacksBridge> bridge, long long length) +{ + bridge->m_writer->truncate(length); +} + +void WorkerFileWriterCallbacksBridge::abortOnMainThread(ScriptExecutionContext*, PassRefPtr<WorkerFileWriterCallbacksBridge> bridge) +{ + bridge->m_writer->cancel(); +} + +void WorkerFileWriterCallbacksBridge::initOnMainThread(ScriptExecutionContext*, PassRefPtr<WorkerFileWriterCallbacksBridge> bridge, const KURL& path) +{ + ASSERT(!bridge->m_writer); + bridge->m_writer = adoptPtr(WebKit::Platform::current()->fileSystem()->createFileWriter(path, bridge.get())); +} + +void WorkerFileWriterCallbacksBridge::shutdownOnMainThread(ScriptExecutionContext*, PassRefPtr<WorkerFileWriterCallbacksBridge> bridge) +{ + bridge->m_writerDeleted = true; + bridge->m_writer.clear(); +} + +void WorkerFileWriterCallbacksBridge::didWrite(long long bytes, bool complete) +{ + dispatchTaskToWorkerThread(createCallbackTask(&didWriteOnWorkerThread, this, bytes, complete)); +} + +void WorkerFileWriterCallbacksBridge::didFail(WebFileError error) +{ + dispatchTaskToWorkerThread(createCallbackTask(&didFailOnWorkerThread, this, error)); +} + +void WorkerFileWriterCallbacksBridge::didTruncate() +{ + dispatchTaskToWorkerThread(createCallbackTask(&didTruncateOnWorkerThread, this)); +} + +static const char fileWriterOperationsMode[] = "fileWriterOperationsMode"; + +WorkerFileWriterCallbacksBridge::WorkerFileWriterCallbacksBridge(const KURL& path, WorkerLoaderProxy* proxy, ScriptExecutionContext* scriptExecutionContext, AsyncFileWriterClient* client) + : WorkerGlobalScope::Observer(toWorkerGlobalScope(scriptExecutionContext)) + , m_proxy(proxy) + , m_workerGlobalScope(scriptExecutionContext) + , m_clientOnWorkerThread(client) + , m_writerDeleted(false) + , m_operationInProgress(false) +{ + ASSERT(m_workerGlobalScope->isContextThread()); + m_mode = fileWriterOperationsMode; + m_mode.append(String::number(toWorkerGlobalScope(scriptExecutionContext)->thread()->runLoop().createUniqueId())); + postInitToMainThread(path); +} + +void WorkerFileWriterCallbacksBridge::postInitToMainThread(const KURL& path) +{ + dispatchTaskToMainThread( + createCallbackTask(&initOnMainThread, this, path)); +} + +WorkerFileWriterCallbacksBridge::~WorkerFileWriterCallbacksBridge() +{ + ASSERT(!m_clientOnWorkerThread); + ASSERT(!m_writer); +} + +// We know m_clientOnWorkerThread is still valid because it is only cleared on the context thread, and because we check in runTaskOnWorkerThread before calling any of these methods. +void WorkerFileWriterCallbacksBridge::didWriteOnWorkerThread(ScriptExecutionContext*, PassRefPtr<WorkerFileWriterCallbacksBridge> bridge, long long length, bool complete) +{ + ASSERT(bridge->m_workerGlobalScope->isContextThread()); + ASSERT(bridge->m_operationInProgress); + if (complete) + bridge->m_operationInProgress = false; + bridge->m_clientOnWorkerThread->didWrite(length, complete); +} + +void WorkerFileWriterCallbacksBridge::didFailOnWorkerThread(ScriptExecutionContext*, PassRefPtr<WorkerFileWriterCallbacksBridge> bridge, WebFileError error) +{ + ASSERT(bridge->m_workerGlobalScope->isContextThread()); + ASSERT(bridge->m_operationInProgress); + bridge->m_operationInProgress = false; + bridge->m_clientOnWorkerThread->didFail(static_cast<FileError::ErrorCode>(error)); +} + +void WorkerFileWriterCallbacksBridge::didTruncateOnWorkerThread(ScriptExecutionContext*, PassRefPtr<WorkerFileWriterCallbacksBridge> bridge) +{ + ASSERT(bridge->m_workerGlobalScope->isContextThread()); + ASSERT(bridge->m_operationInProgress); + bridge->m_operationInProgress = false; + bridge->m_clientOnWorkerThread->didTruncate(); +} + +void WorkerFileWriterCallbacksBridge::runTaskOnMainThread(ScriptExecutionContext* scriptExecutionContext, PassRefPtr<WorkerFileWriterCallbacksBridge> bridge, PassOwnPtr<ScriptExecutionContext::Task> taskToRun) +{ + ASSERT(isMainThread()); + if (!bridge->m_writerDeleted) + taskToRun->performTask(scriptExecutionContext); +} + +void WorkerFileWriterCallbacksBridge::runTaskOnWorkerThread(ScriptExecutionContext* scriptExecutionContext, PassRefPtr<WorkerFileWriterCallbacksBridge> bridge, PassOwnPtr<ScriptExecutionContext::Task> taskToRun) +{ + ASSERT(bridge->m_workerGlobalScope->isContextThread()); + if (bridge->m_clientOnWorkerThread) + taskToRun->performTask(scriptExecutionContext); +} + +void WorkerFileWriterCallbacksBridge::dispatchTaskToMainThread(PassOwnPtr<ScriptExecutionContext::Task> task) +{ + ASSERT(m_workerGlobalScope->isContextThread()); + WebWorkerBase::dispatchTaskToMainThread( + createCallbackTask(&runTaskOnMainThread, this, task)); +} + +void WorkerFileWriterCallbacksBridge::dispatchTaskToWorkerThread(PassOwnPtr<ScriptExecutionContext::Task> task) +{ + ASSERT(isMainThread()); + + MutexLocker locker(m_loaderProxyMutex); + if (m_proxy) + m_proxy->postTaskForModeToWorkerGlobalScope( + createCallbackTask(&runTaskOnWorkerThread, this, task), m_mode); +} + +bool WorkerFileWriterCallbacksBridge::waitForOperationToComplete() +{ + while (m_operationInProgress) { + WorkerGlobalScope* context = toWorkerGlobalScope(m_workerGlobalScope); + if (context->thread()->runLoop().runInMode(context, m_mode) == MessageQueueTerminated) + return false; + } + return true; +} + +} // namespace WebKit diff --git a/chromium/third_party/WebKit/Source/web/WorkerFileWriterCallbacksBridge.h b/chromium/third_party/WebKit/Source/web/WorkerFileWriterCallbacksBridge.h new file mode 100644 index 00000000000..526c47150fd --- /dev/null +++ b/chromium/third_party/WebKit/Source/web/WorkerFileWriterCallbacksBridge.h @@ -0,0 +1,165 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WorkerFileWriterCallbacksBridge_h +#define WorkerFileWriterCallbacksBridge_h + +#include "WebFileWriterClient.h" +#include "core/workers/WorkerGlobalScope.h" +#include "public/platform/WebFileError.h" +#include "wtf/PassOwnPtr.h" +#include "wtf/PassRefPtr.h" +#include "wtf/ThreadSafeRefCounted.h" + +namespace WebCore { + class AsyncFileWriterClient; + class KURL; + class WorkerLoaderProxy; +} + +namespace WTF { + class String; +} +using WTF::String; + +namespace WebKit { + +class WebFileSystem; +class WebFileWriter; +class WebFileWriterClient; +class WebURL; +class WebWorkerBase; + +// This class is used as a mechanism to bridge calls between threads. +// Calls to a WebFileWriter must happen on the main thread, but they come from +// the context thread. The responses through the WebFileWriterClient interface +// start on the main thread, but must be sent via the worker context thread. +// +// A typical flow for write would look like this: +// Bridge::postWriteToMainThread() on WorkerThread +// --> Bridge::writeOnMainThread() is called on MainThread +// --> WebFileWriter::write() +// This makes an IPC; the actual operation is down in the browser. +// --> Bridge::didWrite is called on MainThread +// --> Bridge::didWriteOnWorkerThread is called on WorkerThread +// This calls the original client (m_clientOnWorkerThread). +// +// The bridge object is refcounted, so that it doesn't get deleted while there +// are cross-thread calls in flight. Each CrossThreadTask carries a reference +// to the bridge, which guarantees that the bridge will still be valid when the +// task is executed. In order to shut down the bridge, the WebFileWriterClient +// should call postShutdownToMainThread before dropping its reference to the +// bridge. This ensures that the WebFileWriter will be cleared on the main +// thread and that no further calls to the WebFileWriterClient will be made. +class WorkerFileWriterCallbacksBridge : public ThreadSafeRefCounted<WorkerFileWriterCallbacksBridge>, public WebCore::WorkerGlobalScope::Observer, public WebFileWriterClient { +public: + ~WorkerFileWriterCallbacksBridge(); + + // WorkerGlobalScope::Observer method. + virtual void notifyStop(); + + static PassRefPtr<WorkerFileWriterCallbacksBridge> create(const WebCore::KURL& path, WebCore::WorkerLoaderProxy* proxy, WebCore::ScriptExecutionContext* workerGlobalScope, WebCore::AsyncFileWriterClient* client) + { + return adoptRef(new WorkerFileWriterCallbacksBridge(path, proxy, workerGlobalScope, client)); + } + + // Methods that create an instance and post an initial request task to the main thread. They must be called on the worker thread. + void postWriteToMainThread(long long position, const WebCore::KURL& data); + void postTruncateToMainThread(long long length); + void postAbortToMainThread(); + + // The owning WorkerAsyncFileWriterChromium should call this method before dropping its last reference to the bridge, on the context thread. + // The actual deletion of the WorkerFileWriterCallbacksBridge may happen on either the main or context thread, depending on where the last reference goes away; that's safe as long as this is called first. + void postShutdownToMainThread(PassRefPtr<WorkerFileWriterCallbacksBridge>); + + // Callback methods that are called on the main thread. + // These are the implementation of WebKit::WebFileWriterClient. + void didWrite(long long bytes, bool complete); + void didFail(WebFileError); + void didTruncate(); + + // Call this on the context thread to wait for the current operation to complete. + bool waitForOperationToComplete(); + +private: + WorkerFileWriterCallbacksBridge(const WebCore::KURL& path, WebCore::WorkerLoaderProxy*, WebCore::ScriptExecutionContext*, WebCore::AsyncFileWriterClient*); + + void postInitToMainThread(const WebCore::KURL& path); + + // Methods that are to be called on the main thread. + static void writeOnMainThread(WebCore::ScriptExecutionContext*, PassRefPtr<WorkerFileWriterCallbacksBridge>, long long position, const WebCore::KURL& data); + static void truncateOnMainThread(WebCore::ScriptExecutionContext*, PassRefPtr<WorkerFileWriterCallbacksBridge>, long long length); + static void abortOnMainThread(WebCore::ScriptExecutionContext*, PassRefPtr<WorkerFileWriterCallbacksBridge>); + static void initOnMainThread(WebCore::ScriptExecutionContext*, PassRefPtr<WorkerFileWriterCallbacksBridge>, const WebCore::KURL& path); + static void shutdownOnMainThread(WebCore::ScriptExecutionContext*, PassRefPtr<WorkerFileWriterCallbacksBridge>); + + // Methods that dispatch to AsyncFileWriterClient on the worker threads. + static void didWriteOnWorkerThread(WebCore::ScriptExecutionContext*, PassRefPtr<WorkerFileWriterCallbacksBridge>, long long length, bool complete); + static void didFailOnWorkerThread(WebCore::ScriptExecutionContext*, PassRefPtr<WorkerFileWriterCallbacksBridge>, WebFileError); + static void didTruncateOnWorkerThread(WebCore::ScriptExecutionContext*, PassRefPtr<WorkerFileWriterCallbacksBridge>); + + // Called on the main thread to run the supplied task. + static void runTaskOnMainThread(WebCore::ScriptExecutionContext*, PassRefPtr<WorkerFileWriterCallbacksBridge>, PassOwnPtr<WebCore::ScriptExecutionContext::Task>); + // Called on the worker thread to run the supplied task. + static void runTaskOnWorkerThread(WebCore::ScriptExecutionContext*, PassRefPtr<WorkerFileWriterCallbacksBridge>, PassOwnPtr<WebCore::ScriptExecutionContext::Task>); + + // Called on the worker thread to dispatch to the main thread. + void dispatchTaskToMainThread(PassOwnPtr<WebCore::ScriptExecutionContext::Task>); + // Called on the main thread to dispatch to the worker thread. + void dispatchTaskToWorkerThread(PassOwnPtr<WebCore::ScriptExecutionContext::Task>); + + // Used from the main thread to post tasks to the context thread. + WebCore::WorkerLoaderProxy* m_proxy; + + // Mutex for proxy. + Mutex m_loaderProxyMutex; + + // Used on the context thread, only to check that we're running on the context thread. + WebCore::ScriptExecutionContext* m_workerGlobalScope; + + // Created and destroyed from the main thread. + OwnPtr<WebKit::WebFileWriter> m_writer; + + // Used on the context thread to call back into the client. + WebCore::AsyncFileWriterClient* m_clientOnWorkerThread; + + // Used to indicate that shutdown has started on the main thread, and hence the writer has been deleted. + bool m_writerDeleted; + + // Used by waitForOperationToComplete. + bool m_operationInProgress; + + // Used by postTaskForModeToWorkerGlobalScope and runInMode. + String m_mode; +}; + +} // namespace WebCore + +#endif // WorkerFileWriterCallbacksBridge_h diff --git a/chromium/third_party/WebKit/Source/web/web.gypi b/chromium/third_party/WebKit/Source/web/web.gypi index 05b6fafd052..a010db63007 100644 --- a/chromium/third_party/WebKit/Source/web/web.gypi +++ b/chromium/third_party/WebKit/Source/web/web.gypi @@ -267,10 +267,16 @@ 'WebWorkerRunLoop.cpp', 'WorkerAllowMainThreadBridgeBase.cpp', 'WorkerAllowMainThreadBridgeBase.h', + 'WorkerAsyncFileSystemChromium.cpp', + 'WorkerAsyncFileSystemChromium.h', + 'WorkerAsyncFileWriterChromium.cpp', + 'WorkerAsyncFileWriterChromium.h', 'WorkerFileSystemCallbacksBridge.cpp', 'WorkerFileSystemCallbacksBridge.h', 'WorkerFileSystemClient.cpp', 'WorkerFileSystemClient.h', + 'WorkerFileWriterCallbacksBridge.cpp', + 'WorkerFileWriterCallbacksBridge.h', 'android/WebInputEventFactory.cpp', 'default/WebRenderTheme.cpp', 'gtk/WebInputEventFactory.cpp', diff --git a/chromium/third_party/WebKit/Source/wtf/Assertions.cpp b/chromium/third_party/WebKit/Source/wtf/Assertions.cpp index f7884df4012..acf6be01a63 100644 --- a/chromium/third_party/WebKit/Source/wtf/Assertions.cpp +++ b/chromium/third_party/WebKit/Source/wtf/Assertions.cpp @@ -60,7 +60,6 @@ #if OS(WINDOWS) #include <windows.h> -#define HAVE_ISDEBUGGERPRESENT 1 #endif #if (OS(DARWIN) || (OS(LINUX) && !defined(__UCLIBC__))) && !OS(ANDROID) diff --git a/chromium/third_party/WebKit/Source/wtf/Platform.h b/chromium/third_party/WebKit/Source/wtf/Platform.h index 4d7c4e75186..3d90b0eddbe 100644 --- a/chromium/third_party/WebKit/Source/wtf/Platform.h +++ b/chromium/third_party/WebKit/Source/wtf/Platform.h @@ -162,6 +162,7 @@ #endif /* OS(DARWIN) */ #if OS(WINDOWS) +#define HAVE_ISDEBUGGERPRESENT 1 #define HAVE_VIRTUALALLOC 1 #endif diff --git a/chromium/third_party/WebKit/Source/wtf/text/Base64.cpp b/chromium/third_party/WebKit/Source/wtf/text/Base64.cpp index 876e22565bf..9a31527a225 100644 --- a/chromium/third_party/WebKit/Source/wtf/text/Base64.cpp +++ b/chromium/third_party/WebKit/Source/wtf/text/Base64.cpp @@ -128,7 +128,7 @@ void base64Encode(const char* data, unsigned len, Vector<char>& out, Base64Encod } } -bool base64Decode(const Vector<char>& in, Vector<char>& out, Base64DecodePolicy policy) +bool base64Decode(const Vector<char>& in, Vector<char>& out, Base64InvalidCharactersPolicy charactersPolicy, Base64PaddingValidationPolicy paddingPolicy) { out.clear(); @@ -136,40 +136,48 @@ bool base64Decode(const Vector<char>& in, Vector<char>& out, Base64DecodePolicy if (in.size() > UINT_MAX) return false; - return base64Decode(in.data(), in.size(), out, policy); + return base64Decode(in.data(), in.size(), out, charactersPolicy, paddingPolicy); } template<typename T> -static inline bool base64DecodeInternal(const T* data, unsigned length, Vector<char>& out, Base64DecodePolicy policy) +static inline bool base64DecodeInternal(const T* data, unsigned length, Vector<char>& out, Base64InvalidCharactersPolicy charactersPolicy, Base64PaddingValidationPolicy paddingPolicy) { out.clear(); if (!length) return true; + unsigned dataLength = length; + if (paddingPolicy == Base64StrictPaddingValidation) { + if (!(dataLength % 4)) { + // There may be 2 = padding max. + while (data[dataLength - 1] == '=' && dataLength >= (length - 2)) + --dataLength; + } + if (dataLength % 4 == 1) + return false; + } + out.grow(length); - unsigned equalsSignCount = 0; + bool sawEqualsSign = false; unsigned outLength = 0; for (unsigned idx = 0; idx < length; ++idx) { unsigned ch = data[idx]; if (ch == '=') { - ++equalsSignCount; - // There should be no padding if length is a multiple of 4, and there - // should never be more than 2 padding characters. - if (policy == Base64FailOnInvalidCharacterOrExcessPadding && (length % 4 || equalsSignCount > 2)) + sawEqualsSign = true; + if (paddingPolicy == Base64StrictPaddingValidation && idx < dataLength) return false; } else if (('0' <= ch && ch <= '9') || ('A' <= ch && ch <= 'Z') || ('a' <= ch && ch <= 'z') || ch == '+' || ch == '/') { - if (equalsSignCount) + if (sawEqualsSign) return false; out[outLength] = base64DecMap[ch]; ++outLength; - } else if (policy == Base64FailOnInvalidCharacterOrExcessPadding || policy == Base64FailOnInvalidCharacter || (policy == Base64IgnoreWhitespace && !isSpaceOrNewline(ch))) { + } else if (charactersPolicy == Base64FailOnInvalidCharacter || (charactersPolicy == Base64IgnoreWhitespace && !isSpaceOrNewline(ch))) return false; - } } if (!outLength) - return !equalsSignCount; + return !sawEqualsSign; // Valid data is (n * 4 + [0,2,3]) characters long. if ((outLength % 4) == 1) @@ -204,18 +212,18 @@ static inline bool base64DecodeInternal(const T* data, unsigned length, Vector<c return true; } -bool base64Decode(const char* data, unsigned length, Vector<char>& out, Base64DecodePolicy policy) +bool base64Decode(const char* data, unsigned length, Vector<char>& out, Base64InvalidCharactersPolicy charactersPolicy, Base64PaddingValidationPolicy paddingPolicy) { - return base64DecodeInternal<LChar>(reinterpret_cast<const LChar*>(data), length, out, policy); + return base64DecodeInternal<LChar>(reinterpret_cast<const LChar*>(data), length, out, charactersPolicy, paddingPolicy); } -bool base64Decode(const String& in, Vector<char>& out, Base64DecodePolicy policy) +bool base64Decode(const String& in, Vector<char>& out, Base64InvalidCharactersPolicy charactersPolicy, Base64PaddingValidationPolicy paddingPolicy) { if (in.isEmpty()) - return base64DecodeInternal<LChar>(0, 0, out, policy); + return base64DecodeInternal<LChar>(0, 0, out, charactersPolicy, paddingPolicy); if (in.is8Bit()) - return base64DecodeInternal<LChar>(in.characters8(), in.length(), out, policy); - return base64DecodeInternal<UChar>(in.characters16(), in.length(), out, policy); + return base64DecodeInternal<LChar>(in.characters8(), in.length(), out, charactersPolicy, paddingPolicy); + return base64DecodeInternal<UChar>(in.characters16(), in.length(), out, charactersPolicy, paddingPolicy); } } // namespace WTF diff --git a/chromium/third_party/WebKit/Source/wtf/text/Base64.h b/chromium/third_party/WebKit/Source/wtf/text/Base64.h index 4ebebc82dcb..7ccd8d1c7c8 100644 --- a/chromium/third_party/WebKit/Source/wtf/text/Base64.h +++ b/chromium/third_party/WebKit/Source/wtf/text/Base64.h @@ -39,13 +39,17 @@ enum Base64EncodePolicy { Base64InsertLFs }; -enum Base64DecodePolicy { - Base64FailOnInvalidCharacterOrExcessPadding, +enum Base64InvalidCharactersPolicy { Base64FailOnInvalidCharacter, Base64IgnoreWhitespace, Base64IgnoreInvalidCharacters }; +enum Base64PaddingValidationPolicy { + Base64NoPaddingValidation, + Base64StrictPaddingValidation +}; + WTF_EXPORT void base64Encode(const char*, unsigned, Vector<char>&, Base64EncodePolicy = Base64DoNotInsertLFs); WTF_EXPORT void base64Encode(const Vector<char>&, Vector<char>&, Base64EncodePolicy = Base64DoNotInsertLFs); WTF_EXPORT void base64Encode(const CString&, Vector<char>&, Base64EncodePolicy = Base64DoNotInsertLFs); @@ -53,9 +57,9 @@ WTF_EXPORT String base64Encode(const char*, unsigned, Base64EncodePolicy = Base6 WTF_EXPORT String base64Encode(const Vector<char>&, Base64EncodePolicy = Base64DoNotInsertLFs); WTF_EXPORT String base64Encode(const CString&, Base64EncodePolicy = Base64DoNotInsertLFs); -WTF_EXPORT bool base64Decode(const String&, Vector<char>&, Base64DecodePolicy = Base64FailOnInvalidCharacter); -WTF_EXPORT bool base64Decode(const Vector<char>&, Vector<char>&, Base64DecodePolicy = Base64FailOnInvalidCharacter); -WTF_EXPORT bool base64Decode(const char*, unsigned, Vector<char>&, Base64DecodePolicy = Base64FailOnInvalidCharacter); +WTF_EXPORT bool base64Decode(const String&, Vector<char>&, Base64InvalidCharactersPolicy = Base64FailOnInvalidCharacter, Base64PaddingValidationPolicy = Base64NoPaddingValidation); +WTF_EXPORT bool base64Decode(const Vector<char>&, Vector<char>&, Base64InvalidCharactersPolicy = Base64FailOnInvalidCharacter, Base64PaddingValidationPolicy = Base64NoPaddingValidation); +WTF_EXPORT bool base64Decode(const char*, unsigned, Vector<char>&, Base64InvalidCharactersPolicy = Base64FailOnInvalidCharacter, Base64PaddingValidationPolicy = Base64NoPaddingValidation); inline void base64Encode(const Vector<char>& in, Vector<char>& out, Base64EncodePolicy policy) { @@ -82,11 +86,13 @@ inline String base64Encode(const CString& in, Base64EncodePolicy policy) using WTF::Base64EncodePolicy; using WTF::Base64DoNotInsertLFs; using WTF::Base64InsertLFs; -using WTF::Base64DecodePolicy; -using WTF::Base64FailOnInvalidCharacterOrExcessPadding; +using WTF::Base64InvalidCharactersPolicy; using WTF::Base64FailOnInvalidCharacter; using WTF::Base64IgnoreWhitespace; using WTF::Base64IgnoreInvalidCharacters; +using WTF::Base64PaddingValidationPolicy; +using WTF::Base64NoPaddingValidation; +using WTF::Base64StrictPaddingValidation; using WTF::base64Encode; using WTF::base64Decode; diff --git a/chromium/third_party/WebKit/Tools/RebaselineLogServer/app.yaml b/chromium/third_party/WebKit/Tools/RebaselineLogServer/app.yaml deleted file mode 100644 index 86ab13d7d2e..00000000000 --- a/chromium/third_party/WebKit/Tools/RebaselineLogServer/app.yaml +++ /dev/null @@ -1,9 +0,0 @@ -application: blinkrebaseline -version: 1 -runtime: python27 -api_version: 1 -threadsafe: true - -handlers: -- url: /.* - script: main.app diff --git a/chromium/third_party/WebKit/Tools/RebaselineLogServer/logs.html b/chromium/third_party/WebKit/Tools/RebaselineLogServer/logs.html deleted file mode 100644 index 8f2498d62c5..00000000000 --- a/chromium/third_party/WebKit/Tools/RebaselineLogServer/logs.html +++ /dev/null @@ -1,43 +0,0 @@ -<!DOCTYPE html> -<title>Rebaseline-o-matic logs</title> -<style> -h1 { - font-size: 1em; - margin: 0; - padding: 4px; - background-color: lightgray; -} -pre { - margin: 0; - padding: 4px; -} -.container { - border: 1px dashed; - margin-bottom: 8px; -} -</style> - -{% for log in logs %} -<div class="container"> - <h1> - <script> - // This date format needs to match the format string used in loghandler.py. - lastDateBeforeQueryParameter = '{{ log.date|date:"Y-m-d\TH:i:s" }}Z'; - document.write(new Date('{{ log.date|date:"c" }}').toLocaleString()) - </script> - </h1> - <pre>{% if log.is_no_needs_rebaseline %}No NeedsRebaseline entries in TestExpectations.{% else %}{{ log.content }}{% endif %}</pre> -</div> -{% endfor %} - -{% if not logs %} -No more logs. -{% endif %} - -<script> - var urlBase = location.toString().replace(/\?.*/, ''); - [3, 10, 100].forEach(function(numLogs) { - var url = urlBase + "?{{ before_param }}=" + lastDateBeforeQueryParameter + "&{{ num_logs_param }}=" + numLogs; - document.write('<a href="' + url + '">previous ' + numLogs + '</a> '); - }) -</script> diff --git a/chromium/third_party/WebKit/Tools/RebaselineLogServer/main.py b/chromium/third_party/WebKit/Tools/RebaselineLogServer/main.py deleted file mode 100644 index 9211df34f97..00000000000 --- a/chromium/third_party/WebKit/Tools/RebaselineLogServer/main.py +++ /dev/null @@ -1,143 +0,0 @@ -# Copyright (C) 2013 Google Inc. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following disclaimer -# in the documentation and/or other materials provided with the -# distribution. -# * Neither the name of Google Inc. nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -import datetime -import logging -import webapp2 - -from google.appengine.ext import ndb -from google.appengine.ext.webapp import template - -# A simple log server for rebaseline-o-matic. -# -# Accepts updates to the same log entry and shows a simple status page. -# Has a special state for the case where there are no NeedsRebaseline -# lines in TestExpectations to avoid cluttering the log with useless -# entries every 30 seconds. -# -# Other than that, new updatelog calls append to the most recent log -# entry until they have the newentry parameter, in which case, it -# starts a new log entry. - -LOG_PARAM = "log" -NEW_ENTRY_PARAM = "newentry" -NO_NEEDS_REBASELINE_PARAM = "noneedsrebaseline" -NUM_LOGS_PARAM = "numlogs" -BEFORE_PARAM = "before" - - -class LogEntry(ndb.Model): - content = ndb.TextProperty() - date = ndb.DateTimeProperty(auto_now_add=True) - is_no_needs_rebaseline = ndb.BooleanProperty() - - -def logs_query(): - return LogEntry.query().order(-LogEntry.date) - - -class UpdateLog(webapp2.RequestHandler): - def post(self): - new_log_data = self.request.POST.get(LOG_PARAM) - # This entry is set to on whenever a new auto-rebaseline run is going to - # start logging entries. If this is not on, then the log will get appended - # to the most recent log entry. - new_entry = self.request.POST.get(NEW_ENTRY_PARAM) == "on" - # The case of no NeedsRebaseline lines in TestExpectations is special-cased - # to always overwrite the previous noneedsrebaseline entry in the log to - # avoid cluttering the log with useless empty posts. It just updates the - # date of the entry so that users can see that rebaseline-o-matic is still - # running. - no_needs_rebaseline = self.request.POST.get(NO_NEEDS_REBASELINE_PARAM) == "on" - - out = "Wrote new log entry." - if not new_entry or no_needs_rebaseline: - log_entries = logs_query().fetch(1) - if log_entries: - log_entry = log_entries[0] - log_entry.date = datetime.datetime.now() - if no_needs_rebaseline: - # Don't write out a new log entry for repeated no_needs_rebaseline cases. - # The repeated entries just add noise to the logs. - if log_entry.is_no_needs_rebaseline: - out = "Overwrote existing no needs rebaseline log." - else: - out = "Wrote new no needs rebaseline log." - new_entry = True - new_log_data = "" - elif log_entry.is_no_needs_rebaseline: - out = "Previous entry was a no need rebaseline log. Writing a new log." - new_entry = True - else: - out = "Added to existing log entry." - log_entry.content = log_entry.content + "\n" + new_log_data - - if new_entry or not log_entries: - log_entry = LogEntry(content=new_log_data, is_no_needs_rebaseline=no_needs_rebaseline) - - log_entry.put() - self.response.out.write(out) - - -class UploadForm(webapp2.RequestHandler): - def get(self): - self.response.out.write(template.render("uploadform.html", { - "update_log_url": "/updatelog", - "set_no_needs_rebaseline_url": "/noneedsrebaselines", - "log_param": LOG_PARAM, - "new_entry_param": NEW_ENTRY_PARAM, - "no_needs_rebaseline_param": NO_NEEDS_REBASELINE_PARAM, - })) - - -class ShowLatest(webapp2.RequestHandler): - def get(self): - query = logs_query() - - before = self.request.get(BEFORE_PARAM) - if before: - date = datetime.datetime.strptime(before, "%Y-%m-%dT%H:%M:%SZ") - query = query.filter(LogEntry.date < date) - - num_logs = self.request.get(NUM_LOGS_PARAM) - logs = query.fetch(int(num_logs) if num_logs else 3) - - self.response.out.write(template.render("logs.html", { - "logs": logs, - "num_logs_param": NUM_LOGS_PARAM, - "before_param": BEFORE_PARAM, - })) - - -routes = [ - ('/uploadform', UploadForm), - ('/updatelog', UpdateLog), - ('/', ShowLatest), -] - -app = webapp2.WSGIApplication(routes, debug=True) diff --git a/chromium/third_party/WebKit/Tools/RebaselineLogServer/main_unittest.py b/chromium/third_party/WebKit/Tools/RebaselineLogServer/main_unittest.py deleted file mode 100644 index d3d6e30902a..00000000000 --- a/chromium/third_party/WebKit/Tools/RebaselineLogServer/main_unittest.py +++ /dev/null @@ -1,122 +0,0 @@ -# Copyright (C) 2013 Google Inc. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following disclaimer -# in the documentation and/or other materials provided with the -# distribution. -# * Neither the name of Google Inc. nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -# Usage: PYTHON_PATH=/path/to/appengine_sdk python loghandler_unittest.py. - -import dev_appserver -dev_appserver.fix_sys_path() - -import unittest -import webapp2 - -from google.appengine.ext import testbed - -import main - - -class TestHandlers(unittest.TestCase): - def setUp(self): - self.testbed = testbed.Testbed() - self.testbed.activate() - self.testbed.init_datastore_v3_stub() - self.testbed.init_memcache_stub() - - def test_update_log(self): - request = webapp2.Request.blank('/updatelog') - request.method = 'POST' - request.POST[main.LOG_PARAM] = 'data to log' - request.POST[main.NEW_ENTRY_PARAM] = 'on' - request.POST[main.NO_NEEDS_REBASELINE_PARAM] = 'off' - - response = request.get_response(main.app) - self.assertEqual(response.status_int, 200) - self.assertEqual(response.body, 'Wrote new log entry.') - - response = request.get_response(main.app) - self.assertEqual(response.status_int, 200) - self.assertEqual(response.body, 'Wrote new log entry.') - - request = webapp2.Request.blank('/updatelog') - request.method = 'POST' - request.POST[main.LOG_PARAM] = 'data to log' - request.POST[main.NEW_ENTRY_PARAM] = 'off' - request.POST[main.NO_NEEDS_REBASELINE_PARAM] = 'off' - - response = request.get_response(main.app) - self.assertEqual(response.status_int, 200) - self.assertEqual(response.body, 'Added to existing log entry.') - - request = webapp2.Request.blank('/updatelog') - request.method = 'POST' - request.POST[main.LOG_PARAM] = 'data to log' - request.POST[main.NEW_ENTRY_PARAM] = 'off' - request.POST[main.NO_NEEDS_REBASELINE_PARAM] = 'on' - - response = request.get_response(main.app) - self.assertEqual(response.status_int, 200) - self.assertEqual(response.body, 'Wrote new no needs rebaseline log.') - - response = request.get_response(main.app) - self.assertEqual(response.status_int, 200) - self.assertEqual(response.body, 'Overwrote existing no needs rebaseline log.') - - request = webapp2.Request.blank('/updatelog') - request.method = 'POST' - request.POST[main.LOG_PARAM] = 'data to log' - request.POST[main.NEW_ENTRY_PARAM] = 'off' - request.POST[main.NO_NEEDS_REBASELINE_PARAM] = 'off' - - response = request.get_response(main.app) - self.assertEqual(response.status_int, 200) - self.assertEqual(response.body, 'Previous entry was a no need rebaseline log. Writing a new log.') - - def test_update_log_first_entry_without_new_entry_param(self): - request = webapp2.Request.blank('/updatelog') - request.method = 'POST' - request.POST[main.LOG_PARAM] = 'data to log' - request.POST[main.NEW_ENTRY_PARAM] = 'off' - request.POST[main.NO_NEEDS_REBASELINE_PARAM] = 'off' - - response = request.get_response(main.app) - self.assertEqual(response.status_int, 200) - self.assertEqual(response.body, 'Wrote new log entry.') - - def test_update_log_first_entry_no_needs_rebaseline_param(self): - request = webapp2.Request.blank('/updatelog') - request.method = 'POST' - request.POST[main.LOG_PARAM] = 'data to log' - request.POST[main.NEW_ENTRY_PARAM] = 'off' - request.POST[main.NO_NEEDS_REBASELINE_PARAM] = 'on' - - response = request.get_response(main.app) - self.assertEqual(response.status_int, 200) - self.assertEqual(response.body, 'Wrote new log entry.') - - -if __name__ == '__main__': - unittest.main() diff --git a/chromium/third_party/WebKit/Tools/RebaselineLogServer/uploadform.html b/chromium/third_party/WebKit/Tools/RebaselineLogServer/uploadform.html deleted file mode 100644 index cbc71e5102e..00000000000 --- a/chromium/third_party/WebKit/Tools/RebaselineLogServer/uploadform.html +++ /dev/null @@ -1,25 +0,0 @@ -<!DOCTYPE html> -<title>Update rebaseline logs</title> -<style> -html, body { - height: 100%; -} -body, form { - display: flex; - flex-direction: column; -} -form, textarea { - flex: 1; -} -</style> - -<h1>Update logs</h1> -<p>This page is for manually testing the log server.</p> -<form accept="text/html" action="{{ update_log_url }}" enctype="multipart/form-data" method="post"> - <div> - <label><input name="{{ new_entry_param }}" type="checkbox">Start a new log entry</label> - <label><input name="{{ no_needs_rebaseline_param }}" type="checkbox">No tests need rebaseline</label> - <input class=button type="submit" value="Upload"> - </div> - <textarea name="{{ log_param }}" placeholder="Some logging data..."/></textarea> -</form> diff --git a/chromium/third_party/WebKit/Tools/Scripts/webkitpy/common/net/layouttestresults.py b/chromium/third_party/WebKit/Tools/Scripts/webkitpy/common/net/layouttestresults.py index 2597e0a1401..b3c4367c0b5 100644 --- a/chromium/third_party/WebKit/Tools/Scripts/webkitpy/common/net/layouttestresults.py +++ b/chromium/third_party/WebKit/Tools/Scripts/webkitpy/common/net/layouttestresults.py @@ -103,9 +103,6 @@ class LayoutTestResults(object): def run_was_interrupted(self): return self._results["interrupted"] - def builder_name(self): - return self._results["builder_name"] - def blink_revision(self): return int(self._results["blink_revision"]) diff --git a/chromium/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/builders.py b/chromium/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/builders.py index 99564c6054f..91c7c7a0c8a 100644 --- a/chromium/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/builders.py +++ b/chromium/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/builders.py @@ -41,7 +41,8 @@ from webkitpy.common.memoized import memoized _exact_matches = { "WebKit XP": {"port_name": "win-xp"}, "WebKit Win7": {"port_name": "win-win7"}, - "WebKit Win7 (dbg)": {"port_name": "win-win7"}, + "WebKit Win7 (dbg)(1)": {"port_name": "win-win7"}, + "WebKit Win7 (dbg)(2)": {"port_name": "win-win7"}, "WebKit Linux": {"port_name": "linux-x86_64"}, "WebKit Linux 32": {"port_name": "linux-x86"}, "WebKit Linux (dbg)": {"port_name": "linux-x86_64"}, diff --git a/chromium/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py b/chromium/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py index 087ba5ec543..0d8578a36aa 100644 --- a/chromium/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py +++ b/chromium/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py @@ -236,6 +236,11 @@ def parse_args(args): dest="retry_failures", help="Don't re-try any tests that produce unexpected results."), + # FIXME: Remove this after we remove the flag from the v8 bot. + optparse.make_option("--retry-crashes", action="store_true", + default=False, + help="ignored (we now always retry crashes when we retry failures)."), + optparse.make_option("--max-locked-shards", type="int", default=0, help="Set the maximum number of locked shards"), optparse.make_option("--additional-env-var", type="string", action="append", default=[], diff --git a/chromium/third_party/WebKit/Tools/Scripts/webkitpy/style/checker.py b/chromium/third_party/WebKit/Tools/Scripts/webkitpy/style/checker.py index ee084544f74..c6357da4b7b 100644 --- a/chromium/third_party/WebKit/Tools/Scripts/webkitpy/style/checker.py +++ b/chromium/third_party/WebKit/Tools/Scripts/webkitpy/style/checker.py @@ -38,6 +38,7 @@ import sys from checkers.common import categories as CommonCategories from checkers.common import CarriageReturnChecker from checkers.cpp import CppChecker +from checkers.cmake import CMakeChecker from checkers.jsonchecker import JSONChecker from checkers.png import PNGChecker from checkers.python import PythonChecker @@ -126,7 +127,113 @@ _PATH_RULES_SPECIFIER = [ # discipline as WebCore. ([# There is no clean way to avoid "yy_*" names used by flex. - "Source/core/css/CSSParser-in.cpp"], + "Source/WebCore/css/CSSParser.cpp", + # Qt code uses '_' in some places (such as private slots + # and on test xxx_data methos on tests) + "Source/JavaScriptCore/qt/", + "Source/WebKit/qt/tests/", + "Source/WebKit/qt/declarative/", + "Source/WebKit/qt/examples/"], + ["-readability/naming"]), + + ([# The Qt APIs use Qt declaration style, it puts the * to + # the variable name, not to the class. + "Source/WebKit/qt/Api/", + "Source/WebKit/qt/WidgetApi/"], + ["-readability/naming", + "-whitespace/declaration"]), + + ([# Qt's MiniBrowser has no config.h + "Tools/MiniBrowser/qt", + "Tools/MiniBrowser/qt/raw"], + ["-build/include"]), + + ([# The Qt APIs use Qt/QML naming style, which includes + # naming parameters in h files. + "Source/WebKit2/UIProcess/API/qt"], + ["-readability/parameter_name"]), + + ([# The GTK+ port uses the autotoolsconfig.h header in some C sources + # to serve the same purpose of config.h. + "Tools/GtkLauncher/main.c"], + ["-build/include_order"]), + + ([# The GTK+ APIs use GTK+ naming style, which includes + # lower-cased, underscore-separated values, whitespace before + # parens for function calls, and always having variable names. + # Also, GTK+ allows the use of NULL. + "Source/WebCore/bindings/scripts/test/GObject", + "Source/WebKit/gtk/webkit/", + "Tools/DumpRenderTree/gtk/"], + ["-readability/naming", + "-readability/parameter_name", + "-readability/null", + "-readability/enum_casing", + "-whitespace/parens"]), + + ([# The GTK+ API use upper case, underscore separated, words in + # certain types of enums (e.g. signals, properties). + "Source/WebKit2/UIProcess/API/gtk", + "Source/WebKit2/WebProcess/InjectedBundle/API/gtk"], + ["-readability/enum_casing"]), + + ([# Header files in ForwardingHeaders have no header guards or + # exceptional header guards (e.g., WebCore_FWD_Debugger_h). + "/ForwardingHeaders/"], + ["-build/header_guard"]), + ([# assembler has lots of opcodes that use underscores, so + # we don't check for underscores in that directory. + "Source/JavaScriptCore/assembler/", + "Source/JavaScriptCore/jit/JIT"], + ["-readability/naming/underscores"]), + ([# JITStubs has an usual syntax which causes false alarms for a few checks. + "JavaScriptCore/jit/JITStubs.cpp"], + ["-readability/parameter_name", + "-whitespace/parens"]), + + ([# The EFL APIs use EFL naming style, which includes + # both lower-cased and camel-cased, underscore-sparated + # values. + "Source/WebKit/efl/ewk/", + "Source/WebKit2/UIProcess/API/efl/"], + ["-readability/naming", + "-readability/parameter_name"]), + ([# EWebLauncher and MiniBrowser are EFL simple application. + # They need to use efl coding style and they don't have config.h. + "Tools/EWebLauncher/", + "Tools/MiniBrowser/efl/"], + ["-readability/naming", + "-readability/parameter_name", + "-whitespace/declaration", + "-build/include_order"]), + + # WebKit2 rules: + # WebKit2 and certain directories have idiosyncracies. + ([# NPAPI has function names with underscores. + "Source/WebKit2/WebProcess/Plugins/Netscape"], + ["-readability/naming"]), + ([# The WebKit2 C API has names with underscores and whitespace-aligned + # struct members. Also, we allow unnecessary parameter names in + # WebKit2 APIs because we're matching CF's header style. + # Additionally, we use word which starts with non-capital letter 'k' + # for types of enums. + "Source/WebKit2/UIProcess/API/C/", + "Source/WebKit2/Shared/API/c/", + "Source/WebKit2/WebProcess/InjectedBundle/API/c/"], + ["-readability/enum_casing", + "-readability/naming", + "-readability/parameter_name", + "-whitespace/declaration"]), + ([# These files define GObjects, which implies some definitions of + # variables and functions containing underscores. + "Source/WebCore/platform/graphics/clutter/GraphicsLayerActor.cpp", + "Source/WebCore/platform/graphics/clutter/GraphicsLayerActor.h", + "Source/WebCore/platform/graphics/gstreamer/VideoSinkGStreamer1.cpp", + "Source/WebCore/platform/graphics/gstreamer/VideoSinkGStreamer.cpp", + "Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp", + "Source/WebCore/platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp", + "Source/WebCore/platform/network/soup/ProxyResolverSoup.cpp", + "Source/WebCore/platform/network/soup/ProxyResolverSoup.h"], ["-readability/naming"]), # For third-party Python code, keep only the following checks-- @@ -141,6 +248,22 @@ _PATH_RULES_SPECIFIER = [ "+pep8/W291", # Trailing white space "+whitespace/carriage_return"]), + ([# glu's libtess is third-party code, and doesn't follow WebKit style. + "Source/ThirdParty/glu"], + ["-readability", + "-whitespace", + "-build/header_guard", + "-build/include_order"]), + + ([# There is no way to avoid the symbols __jit_debug_register_code + # and __jit_debug_descriptor when integrating with gdb. + "Source/JavaScriptCore/jit/GDBInterface.cpp"], + ["-readability/naming"]), + + ([# On some systems the trailing CR is causing parser failure. + "Source/JavaScriptCore/parser/Keywords.table"], + ["+whitespace/carriage_return"]), + ([# Jinja templates: files have .cpp or .h extensions, but contain # template code, which can't be handled, so disable tests. "Source/bindings/templates", @@ -160,9 +283,12 @@ _JSON_FILE_EXTENSION = 'json' _PYTHON_FILE_EXTENSION = 'py' _TEXT_FILE_EXTENSIONS = [ + 'ac', 'cc', 'cgi', 'css', + 'exp', + 'flex', 'gyp', 'gypi', 'html', @@ -173,9 +299,13 @@ _TEXT_FILE_EXTENSIONS = [ 'php', 'pl', 'pm', + 'pri', + 'pro', 'rb', 'sh', + 'table', 'txt', + 'wm', 'xhtml', 'y', ] @@ -189,6 +319,8 @@ _XML_FILE_EXTENSIONS = [ _PNG_FILE_EXTENSION = 'png' +_CMAKE_FILE_EXTENSION = 'cmake' + # Files to skip that are less obvious. # # Some files should be skipped when checking style. For example, @@ -383,6 +515,7 @@ class FileType: # WATCHLIST = 7 XML = 8 XCODEPROJ = 9 + CMAKE = 10 class CheckerDispatcher(object): @@ -453,6 +586,8 @@ class CheckerDispatcher(object): return FileType.XCODEPROJ elif file_extension == _PNG_FILE_EXTENSION: return FileType.PNG + elif ((file_extension == _CMAKE_FILE_EXTENSION) or os.path.basename(file_path) == 'CMakeLists.txt'): + return FileType.CMAKE elif ((not file_extension and os.path.join("Tools", "Scripts") in file_path) or file_extension in _TEXT_FILE_EXTENSIONS or os.path.basename(file_path) == 'TestExpectations'): return FileType.TEXT @@ -478,6 +613,8 @@ class CheckerDispatcher(object): checker = XcodeProjectFileChecker(file_path, handle_style_error) elif file_type == FileType.PNG: checker = PNGChecker(file_path, handle_style_error) + elif file_type == FileType.CMAKE: + checker = CMakeChecker(file_path, handle_style_error) elif file_type == FileType.TEXT: basename = os.path.basename(file_path) if basename == 'TestExpectations': diff --git a/chromium/third_party/WebKit/Tools/Scripts/webkitpy/style/checker_unittest.py b/chromium/third_party/WebKit/Tools/Scripts/webkitpy/style/checker_unittest.py index 1c588732051..c19367fc2b9 100644 --- a/chromium/third_party/WebKit/Tools/Scripts/webkitpy/style/checker_unittest.py +++ b/chromium/third_party/WebKit/Tools/Scripts/webkitpy/style/checker_unittest.py @@ -213,7 +213,43 @@ class GlobalVariablesTest(unittest.TestCase): "build/include") assertCheck("random_path.cpp", "readability/naming") - assertNoCheck("Source/core/css/CSSParser-in.cpp", + assertNoCheck("Source/WebKit/gtk/webkit/webkit.h", + "readability/naming") + assertNoCheck("Tools/DumpRenderTree/gtk/DumpRenderTree.cpp", + "readability/null") + assertNoCheck("Source/WebKit/efl/ewk/ewk_view.h", + "readability/naming") + assertNoCheck("Source/WebCore/css/CSSParser.cpp", + "readability/naming") + + # Test if Qt exceptions are indeed working + assertCheck("Source/WebKit/qt/WidgetApi/qwebpage.cpp", + "readability/braces") + assertCheck("Source/WebKit/qt/tests/qwebelement/tst_qwebelement.cpp", + "readability/braces") + assertCheck("Source/WebKit/qt/declarative/platformplugin/WebPlugin.cpp", + "readability/braces") + assertCheck("Source/WebKit/qt/examples/platformplugin/WebPlugin.cpp", + "readability/braces") + assertNoCheck("Source/WebKit/qt/WidgetApi/qwebpage.cpp", + "readability/naming") + assertNoCheck("Source/WebKit/qt/tests/qwebelement/tst_qwebelement.cpp", + "readability/naming") + assertNoCheck("Source/WebKit/qt/declarative/platformplugin/WebPlugin.cpp", + "readability/naming") + assertNoCheck("Source/WebKit/qt/examples/platformplugin/WebPlugin.cpp", + "readability/naming") + + assertNoCheck("Tools/MiniBrowser/qt/UrlLoader.cpp", + "build/include") + + assertNoCheck("Source/WebKit2/UIProcess/API/qt", + "readability/parameter_name") + + assertNoCheck("Source/WebCore/ForwardingHeaders/debugger/Debugger.h", + "build/header_guard") + + assertNoCheck("Source/WebCore/platform/graphics/gstreamer/VideoSinkGStreamer.cpp", "readability/naming") # Third-party Python code: webkitpy/thirdparty @@ -224,6 +260,13 @@ class GlobalVariablesTest(unittest.TestCase): assertCheck(path, "pep8/W291") assertCheck(path, "whitespace/carriage_return") + # Test if the exception for GDBInterface.cpp is in place. + assertNoCheck("Source/JavaScriptCore/jit/GDBInterface.cpp", + "readability/naming") + + # Javascript keywords. + assertCheck("Source/JavaScriptCore/parser/Keywords.table", "whitespace/carriage_return") + def test_max_reports_per_category(self): """Check that _MAX_REPORTS_PER_CATEGORY is valid.""" all_categories = self._all_categories() @@ -456,9 +499,12 @@ class CheckerDispatcherDispatchTest(unittest.TestCase): def test_text_paths(self): """Test paths that should be checked as text.""" paths = [ + "foo.ac", "foo.cc", "foo.cgi", "foo.css", + "foo.exp", + "foo.flex", "foo.gyp", "foo.gypi", "foo.html", @@ -469,9 +515,12 @@ class CheckerDispatcherDispatchTest(unittest.TestCase): "foo.php", "foo.pl", "foo.pm", + "foo.pri", + "foo.pro", "foo.rb", "foo.sh", "foo.txt", + "foo.wm", "foo.xhtml", "foo.y", os.path.join("Source", "WebCore", "inspector", "front-end", "inspector.js"), diff --git a/chromium/third_party/WebKit/Tools/Scripts/webkitpy/style/checkers/cmake.py b/chromium/third_party/WebKit/Tools/Scripts/webkitpy/style/checkers/cmake.py new file mode 100644 index 00000000000..06b8929fab6 --- /dev/null +++ b/chromium/third_party/WebKit/Tools/Scripts/webkitpy/style/checkers/cmake.py @@ -0,0 +1,150 @@ +# Copyright (C) 2012 Intel 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 THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +"""Supports checking WebKit style in cmake files.(.cmake, CMakeLists.txt)""" + +import re + +from common import TabChecker + + +class CMakeChecker(object): + + """Processes CMake lines for checking style.""" + + # NO_SPACE_CMDS list are based on commands section of CMake document. + # Now it is generated from + # http://www.cmake.org/cmake/help/v2.8.10/cmake.html#section_Commands. + # Some commands are from default CMake modules such as pkg_check_modules. + # Please keep list in alphabet order. + # + # For commands in this list, spaces should not be added it and its + # parentheses. For eg, message("testing"), not message ("testing") + # + # The conditional commands like if, else, endif, foreach, endforeach, + # while, endwhile and break are listed in ONE_SPACE_CMDS + NO_SPACE_CMDS = [ + 'add_custom_command', 'add_custom_target', 'add_definitions', + 'add_dependencies', 'add_executable', 'add_library', + 'add_subdirectory', 'add_test', 'aux_source_directory', + 'build_command', + 'cmake_minimum_required', 'cmake_policy', 'configure_file', + 'create_test_sourcelist', + 'define_property', + 'enable_language', 'enable_testing', 'endfunction', 'endmacro', + 'execute_process', 'export', + 'file', 'find_file', 'find_library', 'find_package', 'find_path', + 'find_program', 'fltk_wrap_ui', 'function', + 'get_cmake_property', 'get_directory_property', + 'get_filename_component', 'get_property', 'get_source_file_property', + 'get_target_property', 'get_test_property', + 'include', 'include_directories', 'include_external_msproject', + 'include_regular_expression', 'install', + 'link_directories', 'list', 'load_cache', 'load_command', + 'macro', 'mark_as_advanced', 'math', 'message', + 'option', + #From FindPkgConfig.cmake + 'pkg_check_modules', + 'project', + 'qt_wrap_cpp', 'qt_wrap_ui', + 'remove_definitions', 'return', + 'separate_arguments', 'set', 'set_directory_properties', 'set_property', + 'set_source_files_properties', 'set_target_properties', + 'set_tests_properties', 'site_name', 'source_group', 'string', + 'target_link_libraries', 'try_compile', 'try_run', + 'unset', + 'variable_watch', + ] + + # CMake conditional commands, require one space between command and + # its parentheses, such as "if (", "foreach (", etc. + ONE_SPACE_CMDS = [ + 'if', 'else', 'elseif', 'endif', + 'foreach', 'endforeach', + 'while', 'endwhile', + 'break', + ] + + def __init__(self, file_path, handle_style_error): + self._handle_style_error = handle_style_error + self._tab_checker = TabChecker(file_path, handle_style_error) + + def check(self, lines): + self._tab_checker.check(lines) + self._num_lines = len(lines) + for l in xrange(self._num_lines): + self._process_line(l + 1, lines[l]) + + def _process_line(self, line_number, line_content): + if re.match('(^|\ +)#', line_content): + # ignore comment line + return + l = line_content.expandtabs(4) + # check command like message( "testing") + if re.search('\(\ +', l): + self._handle_style_error(line_number, 'whitespace/parentheses', 5, + 'No space after "("') + # check command like message("testing" ) + if re.search('\ +\)', l) and not re.search('^\ +\)$', l): + self._handle_style_error(line_number, 'whitespace/parentheses', 5, + 'No space before ")"') + self._check_trailing_whitespace(line_number, l) + self._check_no_space_cmds(line_number, l) + self._check_one_space_cmds(line_number, l) + self._check_indent(line_number, line_content) + + def _check_trailing_whitespace(self, line_number, line_content): + line_content = line_content.rstrip('\n') # chr(10), newline + line_content = line_content.rstrip('\r') # chr(13), carriage return + line_content = line_content.rstrip('\x0c') # chr(12), form feed, ^L + stripped = line_content.rstrip() + if line_content != stripped: + self._handle_style_error(line_number, 'whitespace/trailing', 5, + 'No trailing spaces') + + def _check_no_space_cmds(self, line_number, line_content): + # check command like "SET (" or "Set(" + for t in self.NO_SPACE_CMDS: + self._check_non_lowercase_cmd(line_number, line_content, t) + if re.search('(^|\ +)' + t.lower() + '\ +\(', line_content): + msg = 'No space between command "' + t.lower() + '" and its parentheses, should be "' + t + '("' + self._handle_style_error(line_number, 'whitespace/parentheses', 5, msg) + + def _check_one_space_cmds(self, line_number, line_content): + # check command like "IF (" or "if(" or "if (" or "If ()" + for t in self.ONE_SPACE_CMDS: + self._check_non_lowercase_cmd(line_number, line_content, t) + if re.search('(^|\ +)' + t.lower() + '(\(|\ \ +\()', line_content): + msg = 'One space between command "' + t.lower() + '" and its parentheses, should be "' + t + ' ("' + self._handle_style_error(line_number, 'whitespace/parentheses', 5, msg) + + def _check_non_lowercase_cmd(self, line_number, line_content, cmd): + if re.search('(^|\ +)' + cmd + '\ *\(', line_content, flags=re.IGNORECASE) and \ + (not re.search('(^|\ +)' + cmd.lower() + '\ *\(', line_content)): + msg = 'Use lowercase command "' + cmd.lower() + '"' + self._handle_style_error(line_number, 'command/lowercase', 5, msg) + + def _check_indent(self, line_number, line_content): + #TODO (halton): add indent checking + pass diff --git a/chromium/third_party/WebKit/Tools/Scripts/webkitpy/style/checkers/cmake_unittest.py b/chromium/third_party/WebKit/Tools/Scripts/webkitpy/style/checkers/cmake_unittest.py new file mode 100644 index 00000000000..eefc8f7f19f --- /dev/null +++ b/chromium/third_party/WebKit/Tools/Scripts/webkitpy/style/checkers/cmake_unittest.py @@ -0,0 +1,90 @@ +# Copyright (C) 2012 Intel 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. + +"""Unit test for cmake.py.""" + +import webkitpy.thirdparty.unittest2 as unittest + +from cmake import CMakeChecker + + +class CMakeCheckerTest(unittest.TestCase): + + """Tests CMakeChecker class.""" + + def test_init(self): + """Test __init__() method.""" + def _mock_handle_style_error(self): + pass + + checker = CMakeChecker("foo.cmake", _mock_handle_style_error) + self.assertEqual(checker._handle_style_error, _mock_handle_style_error) + + def test_check(self): + """Test check() method.""" + errors = [] + + def _mock_handle_style_error(line_number, category, confidence, + message): + error = (line_number, category, confidence, message) + errors.append(error) + + checker = CMakeChecker("foo.cmake", _mock_handle_style_error) + + lines = [ + '# This file is sample input for cmake_unittest.py and includes below problems:\n', + 'IF ()', + '\tmessage("Error line with Tab")\n', + ' message("Error line with endding spaces") \n', + ' message( "Error line with space after (")\n', + ' message("Error line with space before (" )\n', + ' MESSAGE("Error line with upper case non-condtional command")\n', + ' MESSage("Error line with upper case non-condtional command")\n', + ' message("correct message line")\n', + 'ENDif ()\n', + '\n', + 'if()\n', + 'endif ()\n', + '\n', + 'macro ()\n', + 'ENDMacro()\n', + '\n', + 'function ()\n', + 'endfunction()\n', + ] + checker.check(lines) + + self.maxDiff = None + self.assertEqual(errors, [ + (3, 'whitespace/tab', 5, 'Line contains tab character.'), + (2, 'command/lowercase', 5, 'Use lowercase command "if"'), + (4, 'whitespace/trailing', 5, 'No trailing spaces'), + (5, 'whitespace/parentheses', 5, 'No space after "("'), + (6, 'whitespace/parentheses', 5, 'No space before ")"'), + (7, 'command/lowercase', 5, 'Use lowercase command "message"'), + (8, 'command/lowercase', 5, 'Use lowercase command "message"'), + (10, 'command/lowercase', 5, 'Use lowercase command "endif"'), + (12, 'whitespace/parentheses', 5, 'One space between command "if" and its parentheses, should be "if ("'), + (15, 'whitespace/parentheses', 5, 'No space between command "macro" and its parentheses, should be "macro("'), + (16, 'command/lowercase', 5, 'Use lowercase command "endmacro"'), + (18, 'whitespace/parentheses', 5, 'No space between command "function" and its parentheses, should be "function("'), + ]) diff --git a/chromium/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline.py b/chromium/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline.py index ec55decae82..214395fdd17 100644 --- a/chromium/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline.py +++ b/chromium/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline.py @@ -32,8 +32,6 @@ import optparse import re import sys import time -import traceback -import urllib import urllib2 from webkitpy.common.checkout.baselineoptimizer import BaselineOptimizer @@ -568,74 +566,18 @@ class AutoRebaseline(AbstractParallelRebaselineCommand): self.no_optimize_option, # FIXME: Remove this option. self.results_directory_option, - optparse.make_option("--log-server", help="Server to send logs to.") ]) - def _log_to_server(self, log_server, query): - if not log_server: - return - urllib2.urlopen("http://" + log_server + "/updatelog", data=urllib.urlencode(query)) - - # Logs when there are no NeedsRebaseline lines in TestExpectations. - # These entries overwrite the existing log entry if the existing - # entry is also a noneedsrebaseline entry. This is special cased - # so that the log doesn't get bloated with entries like this - # when there are no tests that needs rebaselining. - def _log_no_needs_rebaseline_lines(self, log_server): - self._log_to_server(log_server, { - "noneedsrebaseline": "on", - }) - - # Uploaded log entries append to the existing entry unless the - # newentry flag is set. In that case it starts a new entry to - # start appending to. So, we need to call this on any fresh run - # that is going to end up logging stuff (i.e. any run that isn't - # a noneedsrebaseline run). - def _start_new_log_entry(self, log_server): - self._log_to_server(log_server, { - "log": "", - "newentry": "on", - }) - - def _configure_logging(self, log_server): - if not log_server: - return - - def _log_alias(query): - self._log_to_server(log_server, query) - - class LogHandler(logging.Handler): - def __init__(self): - logging.Handler.__init__(self) - self._records = [] - - # Since this does not have the newentry flag, it will append - # to the most recent log entry (i.e. the one created by - # _start_new_log_entry. - def emit(self, record): - _log_alias({ - "log": record.getMessage(), - }) - - handler = LogHandler() - _log.setLevel(logging.DEBUG) - handler.setLevel(logging.DEBUG) - _log.addHandler(handler) - - def bot_revision_data(self, log_server): + def latest_revision_processed_on_all_bots(self): revisions = [] for result in self.builder_data().values(): if result.run_was_interrupted(): - self._start_new_log_entry(log_server) - _log.error("Can't rebaseline because the latest run on %s exited early." % result.builder_name()) - return [] - revisions.append({ - "builder": result.builder_name(), - "revision": result.blink_revision(), - }) - return revisions - - def tests_to_rebaseline(self, tool, min_revision, print_revisions, log_server): + _log.error("Can't rebaseline. The latest run on %s did not complete." % builder_name) + return 0 + revisions.append(result.blink_revision()) + return int(min(revisions)) + + def tests_to_rebaseline(self, tool, min_revision, print_revisions): port = tool.port_factory.get() expectations_file_path = port.path_to_generic_test_expectations_file() @@ -643,16 +585,10 @@ class AutoRebaseline(AbstractParallelRebaselineCommand): revision = None author = None bugs = set() - has_any_needs_rebaseline_lines = False for line in tool.scm().blame(expectations_file_path).split("\n"): if "NeedsRebaseline" not in line: continue - - if not has_any_needs_rebaseline_lines: - self._start_new_log_entry(log_server) - has_any_needs_rebaseline_lines = True - parsed_line = re.match("^(\S*)[^(]*\((\S*).*?([^ ]*)\ \[[^[]*$", line) commit_hash = parsed_line.group(1) @@ -679,7 +615,7 @@ class AutoRebaseline(AbstractParallelRebaselineCommand): _log.info("Too many tests to rebaseline in one patch. Doing the first %d." % self.MAX_LINES_TO_REBASELINE) break - return tests, revision, author, bugs, has_any_needs_rebaseline_lines + return tests, revision, author, bugs def link_to_patch(self, revision): return "http://src.chromium.org/viewvc/blink?view=revision&revision=" + str(revision) @@ -727,9 +663,9 @@ class AutoRebaseline(AbstractParallelRebaselineCommand): def tree_status(self): blink_tree_status_url = "http://blink-status.appspot.com/status" status = urllib2.urlopen(blink_tree_status_url).read().lower() - if status.find('closed') != -1 or status == "0": + if status.find('closed') != -1 or status == 0: return 'closed' - elif status.find('open') != -1 or status == "1": + elif status.find('open') != -1 or status == 1: return 'open' return 'unknown' @@ -742,36 +678,25 @@ class AutoRebaseline(AbstractParallelRebaselineCommand): _log.error("Cannot proceed with working directory changes. Clean working directory first.") return - self._configure_logging(options.log_server) - - revision_data = self.bot_revision_data(options.log_server) - if not revision_data: - return - - min_revision = int(min([item["revision"] for item in revision_data])) - tests, revision, author, bugs, has_any_needs_rebaseline_lines = self.tests_to_rebaseline(tool, min_revision, print_revisions=options.verbose, log_server=options.log_server) - - if not has_any_needs_rebaseline_lines: - self._log_no_needs_rebaseline_lines(options.log_server) + min_revision = self.latest_revision_processed_on_all_bots() + if not min_revision: return if options.verbose: - _log.info("Min revision across all bots is %s." % min_revision) - for item in revision_data: - _log.info("%s: r%s" % (item["builder"], item["revision"])) + _log.info("Bot min revision is %s." % min_revision) + + tests, revision, author, bugs = self.tests_to_rebaseline(tool, min_revision, print_revisions=options.verbose) + test_prefix_list, lines_to_remove = self.get_test_prefix_list(tests) if not tests: _log.debug('No tests to rebaseline.') return + _log.info('Rebaselining %s for r%s by %s.' % (list(tests), revision, author)) if self.tree_status() == 'closed': _log.info('Cannot proceed. Tree is closed.') return - _log.info('Rebaselining %s for r%s by %s.' % (list(tests), revision, author)) - - test_prefix_list, lines_to_remove = self.get_test_prefix_list(tests) - try: old_branch_name = tool.scm().current_branch() tool.scm().delete_branch(self.AUTO_REBASELINE_BRANCH_NAME) @@ -787,8 +712,6 @@ class AutoRebaseline(AbstractParallelRebaselineCommand): tool.scm().commit_locally_with_message(self.commit_message(author, revision, bugs)) - # FIXME: Log the upload, pull and dcommit stdout/stderr to the log-server. - # FIXME: It would be nice if we could dcommit the patch without uploading, but still # go through all the precommit hooks. For rebaselines with lots of files, uploading # takes a long time and sometimes fails, but we don't want to commit if, e.g. the @@ -815,14 +738,10 @@ class RebaselineOMatic(AbstractDeclarativeCommand): def execute(self, options, args, tool): while True: - try: - tool.executive.run_command(['git', 'pull']) - rebaseline_command = [tool.filesystem.join(tool.scm().checkout_root, 'Tools', 'Scripts', 'webkit-patch'), 'auto-rebaseline', '--log-server', 'blinkrebaseline.appspot.com'] - if options.verbose: - rebaseline_command.append('--verbose') - # Use call instead of run_command so that stdout doesn't get swallowed. - tool.executive.call(rebaseline_command) - except: - traceback.print_exc(file=sys.stderr) - + tool.executive.run_command(['git', 'pull']) + rebaseline_command = [tool.filesystem.join(tool.scm().checkout_root, 'Tools', 'Scripts', 'webkit-patch'), 'auto-rebaseline'] + if options.verbose: + rebaseline_command.append('--verbose') + # Use call instead of run_command so that stdout doesn't get swallowed. + tool.executive.call(rebaseline_command) time.sleep(self.SLEEP_TIME_IN_SECONDS) diff --git a/chromium/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline_unittest.py b/chromium/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline_unittest.py index 6e981182780..9602cf0bee9 100644 --- a/chromium/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline_unittest.py +++ b/chromium/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline_unittest.py @@ -591,8 +591,7 @@ class TestAutoRebaseline(_BaseTestCase): def setUp(self): super(TestAutoRebaseline, self).setUp() - self.command.latest_revision_processed_on_all_bots = lambda log_server: 9000 - self.command.bot_revision_data = lambda log_server: [{"builder": "Mock builder", "revision": "9000"}] + self.command.latest_revision_processed_on_all_bots = lambda: 9000 def test_tests_to_rebaseline(self): def blame(path): @@ -608,12 +607,11 @@ class TestAutoRebaseline(_BaseTestCase): self.tool.scm().blame = blame min_revision = 9000 - self.assertEqual(self.command.tests_to_rebaseline(self.tool, min_revision, print_revisions=False, log_server=None), ( + self.assertEqual(self.command.tests_to_rebaseline(self.tool, min_revision, print_revisions=False), ( set(['path/to/rebaseline-without-bug-number.html', 'path/to/rebaseline-with-modifiers.html', 'path/to/rebaseline-without-modifiers.html']), 5678, 'foobarbaz1@chromium.org', - set(['24182', '234']), - True)) + set(['24182', '234']))) def test_tests_to_rebaseline_over_limit(self): def blame(path): @@ -628,12 +626,11 @@ class TestAutoRebaseline(_BaseTestCase): expected_list_of_tests.append("path/to/rebaseline-%s.html" % i) min_revision = 9000 - self.assertEqual(self.command.tests_to_rebaseline(self.tool, min_revision, print_revisions=False, log_server=None), ( + self.assertEqual(self.command.tests_to_rebaseline(self.tool, min_revision, print_revisions=False), ( set(expected_list_of_tests), 5678, 'foobarbaz1@chromium.org', - set(['24182']), - True)) + set(['24182']))) def test_commit_message(self): author = "foo@chromium.org" @@ -664,7 +661,7 @@ TBR=foo@chromium.org """ self.tool.scm().blame = blame - self.command.execute(MockOptions(optimize=True, verbose=False, move_overwritten_baselines=False, results_directory=False, log_server=None), [], self.tool) + self.command.execute(MockOptions(optimize=True, verbose=False, move_overwritten_baselines=False, results_directory=False), [], self.tool) self.assertEqual(self.tool.executive.calls, []) def test_execute(self): @@ -741,13 +738,13 @@ crbug.com/24182 path/to/locally-changed-lined.html [ NeedsRebaseline ] } self.command.tree_status = lambda: 'closed' - self.command.execute(MockOptions(optimize=True, verbose=False, move_overwritten_baselines=False, results_directory=False, log_server=None), [], self.tool) + self.command.execute(MockOptions(optimize=True, verbose=False, move_overwritten_baselines=False, results_directory=False), [], self.tool) self.assertEqual(self.tool.executive.calls, []) self.command.tree_status = lambda: 'open' self.tool.executive.calls = [] - self.command.execute(MockOptions(optimize=True, verbose=False, move_overwritten_baselines=False, results_directory=False, log_server=None), [], self.tool) + self.command.execute(MockOptions(optimize=True, verbose=False, move_overwritten_baselines=False, results_directory=False), [], self.tool) self.assertEqual(self.tool.executive.calls, [ [ ['echo', 'copy-existing-baselines-internal', '--suffixes', 'txt,png', '--builder', 'MOCK Leopard', '--test', 'fast/dom/prototype-chocolate.html'], @@ -829,7 +826,7 @@ Bug(foo) fast/dom/prototype-taco.html [ NeedsRebaseline ] } self.command.tree_status = lambda: 'open' - self.command.execute(MockOptions(optimize=True, verbose=False, move_overwritten_baselines=False, results_directory=False, log_server=None), [], self.tool) + self.command.execute(MockOptions(optimize=True, verbose=False, move_overwritten_baselines=False, results_directory=False), [], self.tool) self.assertEqual(self.tool.executive.calls, [ [ ['echo', 'copy-existing-baselines-internal', '--suffixes', 'txt', '--builder', 'MOCK Leopard', '--test', 'fast/dom/prototype-taco.html'], diff --git a/chromium/third_party/WebKit/WATCHLISTS b/chromium/third_party/WebKit/WATCHLISTS index fc38a1e8cce..393c9556e9b 100644 --- a/chromium/third_party/WebKit/WATCHLISTS +++ b/chromium/third_party/WebKit/WATCHLISTS @@ -178,8 +178,7 @@ 'rjwright@chromium.org', 'shans@chromium.org', 'steveblock@chromium.org', - 'timloh@chromium.org', - 'dino@apple.com'], + 'timloh@chromium.org'], 'devtools': [ 'pfeldman+blink@chromium.org', 'aandrey+blink@chromium.org', 'alph+blink@chromium.org', diff --git a/chromium/third_party/WebKit/public/platform/WebCompositorSupport.h b/chromium/third_party/WebKit/public/platform/WebCompositorSupport.h index 32a9e73f532..5f7d9b8d8fd 100644 --- a/chromium/third_party/WebKit/public/platform/WebCompositorSupport.h +++ b/chromium/third_party/WebKit/public/platform/WebCompositorSupport.h @@ -43,7 +43,6 @@ class WebFilterOperations; class WebFloatAnimationCurve; class WebGraphicsContext3D; class WebImageLayer; -class WebNinePatchLayer; class WebLayer; class WebScrollbar; class WebScrollbarLayer; @@ -71,8 +70,6 @@ public: virtual WebImageLayer* createImageLayer() { return 0; } - virtual WebNinePatchLayer* createNinePatchLayer() { return 0; } - virtual WebSolidColorLayer* createSolidColorLayer() { return 0; } virtual WebScrollbarLayer* createScrollbarLayer(WebScrollbar*, WebScrollbarThemePainter, WebScrollbarThemeGeometry*) { return 0; } diff --git a/chromium/third_party/WebKit/public/platform/WebFileSystem.h b/chromium/third_party/WebKit/public/platform/WebFileSystem.h index 8dbea8c9e39..969359124c1 100644 --- a/chromium/third_party/WebKit/public/platform/WebFileSystem.h +++ b/chromium/third_party/WebKit/public/platform/WebFileSystem.h @@ -37,9 +37,6 @@ namespace WebKit { -// FIXME: Delete this flag after we complete switching to the new code. -#define USE_THREADLOCAL_WEBFILESYSTEM - // FIXME: Move these classes into platform. class WebFileSystemCallbacks; class WebFileWriter; diff --git a/chromium/third_party/WebKit/public/platform/WebNinePatchLayer.h b/chromium/third_party/WebKit/public/platform/WebNinePatchLayer.h deleted file mode 100644 index 1279db743cc..00000000000 --- a/chromium/third_party/WebKit/public/platform/WebNinePatchLayer.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (C) 2013 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef WebNinePatchLayer_h -#define WebNinePatchLayer_h - -#include "WebCommon.h" -#include "WebLayer.h" -#include "WebRect.h" -#include "third_party/skia/include/core/SkBitmap.h" - -namespace WebKit { - -class WebNinePatchLayer { -public: - virtual ~WebNinePatchLayer() { } - - virtual WebLayer* layer() = 0; - virtual void setBitmap(SkBitmap, const WebRect& aperture) = 0; -}; - -} // namespace WebKit - -#endif // WebNinePatchLayer_h diff --git a/chromium/third_party/WebKit/public/web/WebFrame.h b/chromium/third_party/WebKit/public/web/WebFrame.h index 211def68aed..68b7440a22d 100644 --- a/chromium/third_party/WebKit/public/web/WebFrame.h +++ b/chromium/third_party/WebKit/public/web/WebFrame.h @@ -456,8 +456,6 @@ public: virtual void moveRangeSelection(const WebPoint& base, const WebPoint& extent) = 0; virtual void moveCaretSelection(const WebPoint&) = 0; - virtual void setCaretVisible(bool) = 0; - // Printing ------------------------------------------------------------ // Reformats the WebFrame for printing. WebPrintParams specifies the printable diff --git a/chromium/third_party/WebKit/public/web/WebViewClient.h b/chromium/third_party/WebKit/public/web/WebViewClient.h index 5014e3405c9..3aeab92416a 100644 --- a/chromium/third_party/WebKit/public/web/WebViewClient.h +++ b/chromium/third_party/WebKit/public/web/WebViewClient.h @@ -259,10 +259,6 @@ public: // the given frame. Additional context data is supplied. virtual void showContextMenu(WebFrame*, const WebContextMenuData&) { } - // Called when the data attached to the currently displayed context menu is - // invalidated. The context menu may be closed if possible. - virtual void clearContextMenu() { } - // Called when a drag-n-drop operation should begin. virtual void startDragging(WebFrame*, const WebDragData&, WebDragOperationsMask, const WebImage&, const WebPoint& dragImageOffset) { } @@ -305,6 +301,9 @@ public: virtual int historyBackListCount() { return 0; } virtual int historyForwardListCount() { return 0; } + // Called to notify the embedder when a new history item is added. + virtual void didAddHistoryItem() { } + // Accessibility ------------------------------------------------------- |