diff options
Diffstat (limited to 'WebCore')
269 files changed, 8574 insertions, 2877 deletions
diff --git a/WebCore/Android.mk b/WebCore/Android.mk index f153c9c..f2d0245 100644 --- a/WebCore/Android.mk +++ b/WebCore/Android.mk @@ -495,6 +495,7 @@ LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \ platform/graphics/skia/SkiaUtils.cpp \ platform/graphics/skia/TransformationMatrixSkia.cpp \ \ + platform/graphics/transforms/AffineTransform.cpp \ platform/graphics/transforms/Matrix3DTransformOperation.cpp \ platform/graphics/transforms/MatrixTransformOperation.cpp \ platform/graphics/transforms/PerspectiveTransformOperation.cpp \ diff --git a/WebCore/Android.v8bindings.mk b/WebCore/Android.v8bindings.mk index 602185c..922e233 100644 --- a/WebCore/Android.v8bindings.mk +++ b/WebCore/Android.v8bindings.mk @@ -97,8 +97,17 @@ LOCAL_SRC_FILES += \ \ bindings/v8/custom/V8AbstractWorkerCustom.cpp \ bindings/v8/custom/V8AttrCustom.cpp \ + bindings/v8/custom/V8BarInfoCustom.cpp \ + bindings/v8/custom/V8CSSRuleCustom.cpp \ bindings/v8/custom/V8CSSStyleDeclarationCustom.cpp \ + bindings/v8/custom/V8CSSStyleSheetCustom.cpp \ + bindings/v8/custom/V8CSSValueCustom.cpp \ bindings/v8/custom/V8CanvasRenderingContext2DCustom.cpp \ +<<<<<<< HEAD +======= + bindings/v8/custom/V8CanvasPixelArrayCustom.cpp \ + bindings/v8/custom/V8ClientRectListCustom.cpp \ +>>>>>>> webkit.org at r54340 bindings/v8/custom/V8ClipboardCustom.cpp \ bindings/v8/custom/V8ConsoleCustom.cpp \ bindings/v8/custom/V8CoordinatesCustom.cpp \ @@ -112,6 +121,7 @@ LOCAL_SRC_FILES += \ bindings/v8/custom/V8CustomSQLTransactionErrorCallback.cpp \ bindings/v8/custom/V8CustomVoidCallback.cpp \ bindings/v8/custom/V8DOMApplicationCacheCustom.cpp \ + bindings/v8/custom/V8DOMSelectionCustom.cpp \ bindings/v8/custom/V8DOMWindowCustom.cpp \ bindings/v8/custom/V8DataGridColumnListCustom.cpp \ bindings/v8/custom/V8DatabaseCustom.cpp \ @@ -130,6 +140,7 @@ LOCAL_SRC_FILES += \ bindings/v8/custom/V8HTMLCollectionCustom.cpp \ bindings/v8/custom/V8HTMLDataGridElementCustom.cpp \ bindings/v8/custom/V8HTMLDocumentCustom.cpp \ + bindings/v8/custom/V8HTMLElementCustom.cpp \ bindings/v8/custom/V8HTMLFormElementCustom.cpp \ bindings/v8/custom/V8HTMLFrameElementCustom.cpp \ bindings/v8/custom/V8HTMLFrameSetElementCustom.cpp \ @@ -151,21 +162,29 @@ LOCAL_SRC_FILES += \ bindings/v8/custom/V8NodeFilterCustom.cpp \ bindings/v8/custom/V8NodeIteratorCustom.cpp \ bindings/v8/custom/V8NodeListCustom.cpp \ +<<<<<<< HEAD bindings/v8/custom/V8PopStateEventCustom.cpp \ +======= + bindings/v8/custom/V8ScreenCustom.cpp \ +>>>>>>> webkit.org at r54340 bindings/v8/custom/V8SQLResultSetRowListCustom.cpp \ bindings/v8/custom/V8SQLTransactionCustom.cpp \ bindings/v8/custom/V8WebSocketCustom.cpp ifeq ($(ENABLE_SVG), true) LOCAL_SRC_FILES += \ + bindings/v8/custom/V8SVGDocumentCustom.cpp \ + bindings/v8/custom/V8SVGElementCustom.cpp \ bindings/v8/custom/V8SVGElementInstanceCustom.cpp \ bindings/v8/custom/V8SVGLengthCustom.cpp \ bindings/v8/custom/V8SVGMatrixCustom.cpp + bindings/v8/custom/V8SVGPathSegCustom.cpp \ endif LOCAL_SRC_FILES += \ bindings/v8/custom/V8SharedWorkerCustom.cpp \ bindings/v8/custom/V8StorageCustom.cpp \ + bindings/v8/custom/V8StyleSheetCustom.cpp \ bindings/v8/custom/V8StyleSheetListCustom.cpp \ bindings/v8/custom/V8TreeWalkerCustom.cpp \ bindings/v8/custom/V8WebKitCSSMatrixConstructor.cpp \ @@ -185,4 +204,8 @@ LOCAL_SRC_FILES += \ bridge/jni/v8/JNIUtilityPrivate.cpp \ bridge/jni/v8/JavaClassV8.cpp \ bridge/jni/v8/JavaInstanceV8.cpp \ +<<<<<<< HEAD bridge/jni/v8/JavaNPObjectV8.cpp +======= + bridge/jni/v8/JavaNPObject.cpp +>>>>>>> webkit.org at r54340 diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog index dfbec52..c738ee0 100644 --- a/WebCore/ChangeLog +++ b/WebCore/ChangeLog @@ -1,3 +1,1315 @@ +<<<<<<< HEAD +======= +2010-02-04 Holger Hans Peter Freyther <zecke@selfish.org> + + Reviewed by Xan Lopez. + + [Gtk] Check if the renderer() exists in textForObject. + + This is fixing a crash in the textForObject method. It can + happen when inspecting AtkObjects in the accerciser, then + navigating to a new page and still inspecting the old tree. + + In this case the AccessibilityObjectWrapperAtk was still + valid but the included renderer() was returning 0. Add a + check for the accObject->renderer() before trying to use + the result. + + * accessibility/gtk/AccessibilityObjectWrapperAtk.cpp: + (textForObject): + +2010-02-04 Yury Semikhatsky <yurys@chromium.org> + + Reviewed by Pavel Feldman. + + Provide strongly typed C++ interface for inspector's injected script. + + https://bugs.webkit.org/show_bug.cgi?id=33616 + + * GNUmakefile.am: + * WebCore.gypi: + * WebCore.pro: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * bindings/js/JSInjectedScriptHostCustom.cpp: + (WebCore::InjectedScriptHost::injectedScriptFor): + * bindings/v8/custom/V8InjectedScriptHostCustom.cpp: + (WebCore::InjectedScriptHost::injectedScriptFor): + * inspector/InjectedScript.cpp: Added. + (WebCore::InjectedScript::InjectedScript): + (WebCore::InjectedScript::dispatch): + (WebCore::InjectedScript::callFrames): + (WebCore::InjectedScript::wrapAndStringifyForConsole): + (WebCore::InjectedScript::releaseWrapperObjectGroup): + * inspector/InjectedScript.h: Added. + (WebCore::InjectedScript::InjectedScript): + (WebCore::InjectedScript::~InjectedScript): + (WebCore::InjectedScript::hasNoValue): + * inspector/InjectedScriptHost.cpp: + (WebCore::InjectedScriptHost::injectedScriptForId): + (WebCore::InjectedScriptHost::releaseWrapperObjectGroup): + * inspector/InjectedScriptHost.h: + * inspector/InspectorBackend.cpp: + (WebCore::InspectorBackend::dispatchOnInjectedScript): + * inspector/InspectorController.cpp: + (WebCore::InspectorController::InspectorController): + (WebCore::InspectorController::~InspectorController): + (WebCore::InspectorController::inspectedPageDestroyed): + (WebCore::InspectorController::windowScriptObjectAvailable): + (WebCore::InspectorController::scriptObjectReady): + (WebCore::InspectorController::setFrontendProxyObject): + (WebCore::InspectorController::close): + (WebCore::InspectorController::getProfile): + (WebCore::InspectorController::enableDebugger): + (WebCore::InspectorController::didPause): + (WebCore::InspectorController::injectedScriptForNodeId): + * inspector/InspectorController.h: + (WebCore::InspectorController::frontendScriptState): + * inspector/InspectorFrontend.cpp: + (WebCore::InspectorFrontend::addConsoleMessage): + * inspector/front-end/InjectedScript.js: + (injectedScriptConstructor): + +2010-02-04 Philippe Normand <pnormand@igalia.com> + + Rubber stamped by Xan Lopez. + + Missing include, build fix after landing of patch from the bug 34435. + + * platform/graphics/gtk/MediaPlayerPrivateGStreamer.cpp: + +2010-02-02 Philippe Normand <pnormand@igalia.com> + + Reviewed by Gustavo Noronha Silva. + + [Gtk] libsoup critical warning in media player http cookies injection code + https://bugs.webkit.org/show_bug.cgi?id=34435 + + Fixed the critical warning and refactored the + User-Agent/Referer/cookies injection code, in that order. Previous + order (cookies first) was wrong because if cookies injection could + not be done neither the User-Agent nor Referer were injected. Also + started a non-JSC-specific, gtk-specific GOwnPtr module. + + * GNUmakefile.am: + * platform/graphics/gtk/MediaPlayerPrivateGStreamer.cpp: + (WebCore::mediaPlayerPrivateSourceChangedCallback): + * platform/gtk/GOwnPtrGtk.cpp: Added. + (WTF::SoupURI): + (WTF::GstElement): + * platform/gtk/GOwnPtrGtk.h: Added. + +2010-02-04 Mikhail Naganov <mnaganov@chromium.org> + + Reviewed by Timothy Hatcher. + + Put JSC-specific debugger & profiler code under "USE(JSC)" defines. + The plan is to enable "JAVASCRIPT_DEBUGGER" in Chromium and then + make this code engine-agnostic. + + https://bugs.webkit.org/show_bug.cgi?id=34531 + + * inspector/InjectedScriptHost.cpp: + * inspector/InjectedScriptHost.h: + * inspector/InspectorBackend.cpp: + * inspector/InspectorBackend.h: + * inspector/InspectorController.cpp: + (WebCore::InspectorController::InspectorController): + (WebCore::InspectorController::setWindowVisible): + (WebCore::InspectorController::scriptObjectReady): + (WebCore::InspectorController::close): + (WebCore::InspectorController::didCommitLoad): + * inspector/InspectorController.h: + * inspector/InspectorFrontend.cpp: + * inspector/InspectorFrontend.h: + * inspector/JavaScriptCallFrame.cpp: + * inspector/JavaScriptCallFrame.h: + * inspector/JavaScriptDebugListener.h: + * inspector/JavaScriptDebugServer.cpp: + * inspector/JavaScriptDebugServer.h: + * inspector/JavaScriptProfile.cpp: + * inspector/JavaScriptProfile.h: + * inspector/JavaScriptProfileNode.cpp: + * inspector/JavaScriptProfileNode.h: + * loader/FrameLoader.cpp: + (WebCore::FrameLoader::continueLoadAfterNavigationPolicy): + * page/Page.cpp: + (WebCore::Page::Page): + +2010-02-03 Nicholas Young <nicholas.young@nokia.com> + + Reviewed by Eric Carlson. + + Defer formatting of times displayed on media controls to the current theme. + https://bugs.webkit.org/show_bug.cgi?id=34405 + + No new tests needed. Refactoring Only. + + * rendering/MediaControlElements.cpp: Removed formatTime() + (WebCore::MediaControlTimeDisplayElement::setCurrentValue): No longer sets inner text + * rendering/MediaControlElements.h: + * rendering/RenderMedia.cpp: + (WebCore::RenderMedia::updateTimeDisplay): Asks the theme to format the time display elements + * rendering/RenderTheme.cpp: + (WebCore::RenderTheme::formatMediaControlsTime): new virtual method + (WebCore::RenderTheme::formatMediaControlsCurrentTime): new virtual method + (WebCore::RenderTheme::formatMediaControlsRemainingTime): new virtual method + * rendering/RenderTheme.h: + +2010-02-03 Steve Falkenburg <sfalken@apple.com> + + Windows Debug_All build fix. + + * platform/graphics/win/WKCACFLayer.cpp: + +2010-02-03 Brady Eidson <beidson@apple.com> + + Reviewed by Alexey Proskuryakov. + + REGRESSION (r51644): WebCore/manual-tests/linkjump-1.html fails + <rdar://problem/7595694> and https://bugs.webkit.org/show_bug.cgi?id=34550 + + Tests: fast/loader/document-with-fragment-url-1.html + fast/loader/document-with-fragment-url-2.html + fast/loader/document-with-fragment-url-3.html + fast/loader/document-with-fragment-url-4.html + + * platform/KURL.cpp: + (WebCore::KURL::init): When resolving new URL from an empty reference relative to an absolute URL, + any fragment identifier from the absolute URL should be removed from the resulting resolution. + +2010-02-03 Kwang Yul Seo <skyul@company100.net> + + Reviewed by Eric Seidel. + + [BREWMP] Port TextBreakIteratorInternalICU + https://bugs.webkit.org/show_bug.cgi?id=34515 + + Port TextBreakIteratorInternalICU. + + * platform/text/brew/TextBreakIteratorInternalICUBrew.cpp: Added. + (WebCore::currentSearchLocaleID): + (WebCore::currentTextBreakLocaleID): + +2010-02-03 Adele Peterson <adele@apple.com> + + Reviewed by Simon Fraser. + + Fix for <rdar://problem/7594212> + https://bugs.webkit.org/show_bug.cgi?id=34549 - CSS counters crash at http://www.w3.org/TR/css3-content/ + CrashTracer: [USER] 20 crashes in Safari at com.apple.WebCore: WebCore::CounterNode::insertAfter + 319 + + Test: fast/css/counters/counter-before-selector-crash.html + + * rendering/RenderCounter.cpp: (WebCore::updateCounters): nil check. + +2010-02-03 Adele Peterson <adele@apple.com> + + Reviewed by Brady Eidson. + + Initialize the variable in the last checkin to false. I didn't realize DRT relies on this being false. + So ports that want visited link tracking need to set that flag. + + * page/PageGroup.cpp: + +2010-02-03 Adele Peterson <adele@apple.com> + + Reviewed by Brady Eidson. + + Fix for https://bugs.webkit.org/show_bug.cgi?id=34547 + static shouldTrackVisitedLinks is not initialized + + For ports that don't call into WebKit to initialize this, + we should initialize to true so they get the visited link behavior by default. + + * page/PageGroup.cpp: + +2010-02-03 Dan Bernstein <mitz@apple.com> + + Reviewed by Simon Fraser. + + <rdar://problem/7577604> Drag and Drop: background elements are bleeding through + https://bugs.webkit.org/show_bug.cgi?id=34546 + + * manual-tests/drag-image-table-part-decorations.html: Added. + * rendering/RenderFieldset.cpp: + (WebCore::RenderFieldset::paintBoxDecorations): Bail out if this object shouldn’t + paint within the current painting root. + * rendering/RenderTable.cpp: + (WebCore::RenderTable::paintBoxDecorations): Ditto. + * rendering/RenderTableCell.cpp: + (WebCore::RenderTableCell::paintBackgroundsBehindCell): Ditto. + (WebCore::RenderTableCell::paintBoxDecorations): Ditto. + +2010-02-03 Nate Chapin <japhet@chromium.org> + + Unreviewed, Chromium mac build fix. + + [V8] Remove unused V8Proxy* variable from generated wrapping code. + + * bindings/scripts/CodeGeneratorV8.pm: + +2010-02-03 Nate Chapin <japhet@chromium.org> + + Reviewed by Dimitri Glazkov. + + [V8] Use toV8() to wrap in the custom bindings, and remove + the old wrapping code from V8DOMWrapper. + + https://bugs.webkit.org/show_bug.cgi?id=32563 + + * bindings/scripts/CodeGeneratorV8.pm: + * bindings/v8/ScriptController.cpp: + * bindings/v8/ScriptObject.cpp: + * bindings/v8/V8AbstractEventListener.cpp: + * bindings/v8/V8Collection.h: + * bindings/v8/V8DOMWindowShell.cpp: + * bindings/v8/V8DOMWrapper.cpp: + * bindings/v8/V8DOMWrapper.h: + * bindings/v8/V8NodeFilterCondition.cpp: + * bindings/v8/V8Proxy.cpp: + * bindings/v8/WorkerContextExecutionProxy.h + * bindings/v8/custom/V8CanvasRenderingContext2DCustom.cpp: + * bindings/v8/custom/V8CustomPositionCallback.cpp: + * bindings/v8/custom/V8CustomPositionErrorCallback.cpp: + * bindings/v8/custom/V8CustomSQLStatementCallback.cpp: + * bindings/v8/custom/V8CustomSQLStatementErrorCallback.cpp: + * bindings/v8/custom/V8CustomSQLTransactionCallback.cpp: + * bindings/v8/custom/V8CustomSQLTransactionErrorCallback.cpp: + * bindings/v8/custom/V8DOMWindowCustom.cpp: + * bindings/v8/custom/V8DataGridColumnListCustom.cpp: + * bindings/v8/custom/V8DocumentCustom.cpp: + * bindings/v8/custom/V8DocumentLocationCustom.cpp: + * bindings/v8/custom/V8ElementCustom.cpp: + * bindings/v8/custom/V8EventCustom.cpp: + * bindings/v8/custom/V8HTMLAllCollectionCustom.cpp: + * bindings/v8/custom/V8HTMLAudioElementConstructor.cpp: + * bindings/v8/custom/V8HTMLCanvasElementCustom.cpp: + * bindings/v8/custom/V8HTMLCollectionCustom.cpp: + * bindings/v8/custom/V8HTMLDocumentCustom.cpp: + * bindings/v8/custom/V8HTMLFormElementCustom.cpp: + * bindings/v8/custom/V8HTMLFrameSetElementCustom.cpp: + * bindings/v8/custom/V8HTMLImageElementConstructor.cpp: + * bindings/v8/custom/V8HTMLOptionsCollectionCustom.cpp: + * bindings/v8/custom/V8HTMLSelectElementCustom.cpp: + * bindings/v8/custom/V8InjectedScriptHostCustom.cpp: + * bindings/v8/custom/V8MessageChannelConstructor.cpp: + * bindings/v8/custom/V8MessageEventCustom.cpp: + * bindings/v8/custom/V8NamedNodeMapCustom.cpp: + * bindings/v8/custom/V8NodeIteratorCustom.cpp: + * bindings/v8/custom/V8NodeListCustom.cpp: + * bindings/v8/custom/V8NotificationCenterCustom.cpp: + * bindings/v8/custom/V8SVGMatrixCustom.cpp: + * bindings/v8/custom/V8StyleSheetListCustom.cpp: + * bindings/v8/custom/V8TreeWalkerCustom.cpp: + * bindings/v8/custom/V8WebGLRenderingContextCustom.cpp: + * bindings/v8/custom/V8XSLTProcessorCustom.cpp: + +2010-02-03 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Fix drawing buttons in viewless WebKit. + + * platform/mac/ThemeMac.mm: + (WebCore::paintButton): If there is no view, make sure to flip the + context so that the button is drawn correctly. + +2010-02-03 Yael Aharon <yael.aharon@nokia.com> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] WebSockets : Buffer the data in WebKit instead of QtNetwork + https://bugs.webkit.org/show_bug.cgi?id=34425 + + Reverting r54279, it was a misunderstanding. + + * platform/network/qt/SocketStreamHandlePrivate.h: + * platform/network/qt/SocketStreamHandleQt.cpp: + (WebCore::SocketStreamHandlePrivate::SocketStreamHandlePrivate): + (WebCore::SocketStreamHandlePrivate::send): + (WebCore::SocketStreamHandlePrivate::close): + +2010-02-03 Drew Wilson <atwilson@chromium.org> + + Reviewed by Alexey Proskuryakov. + + SharedWorkerScriptLoader should not be an ActiveDOMObject + https://bugs.webkit.org/show_bug.cgi?id=34513 + + Test: Existing tests suffice (fixes test downstream in Chrome). + + * workers/DefaultSharedWorkerRepository.cpp: + (WebCore::SharedWorkerScriptLoader::SharedWorkerScriptLoader): + Changed to no longer derive from ActiveDOMObject (handles its own refcounting). + (WebCore::SharedWorkerScriptLoader::load): + Now increments own refcount when a load is pending. + (WebCore::SharedWorkerScriptLoader::notifyFinished): + Changed to decrement refcount when load is complete. + * workers/WorkerScriptLoaderClient.h: + Documentation change about reliability of notifyFinished() when used from worker context. + +2010-02-03 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Timothy Hatcher. + + Web Inspector: Inspector renders blank scripts on reloading the webpage. + + https://bugs.webkit.org/show_bug.cgi?id=34537 + + * inspector/front-end/ResourcesPanel.js: + (WebInspector.ResourcesPanel.prototype.recreateViewForResourceIfNeeded): + +2010-02-03 Yury Semikhatsky <yurys@chromium.org> + + Reviewed by Pavel Feldman. + + Provide strongly typed C++ interface for inspector's injected script. + + https://bugs.webkit.org/show_bug.cgi?id=33616 + + * WebCore.gypi: + * WebCore.pro: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * bindings/js/JSInjectedScriptHostCustom.cpp: + (WebCore::InjectedScriptHost::injectedScriptFor): + * bindings/v8/custom/V8InjectedScriptHostCustom.cpp: + (WebCore::InjectedScriptHost::injectedScriptFor): + * inspector/InjectedScript.cpp: Added. + (WebCore::InjectedScript::InjectedScript): + (WebCore::InjectedScript::dispatch): + (WebCore::InjectedScript::callFrames): + (WebCore::InjectedScript::wrapAndStringify): + (WebCore::InjectedScript::releaseWrapperObjectGroup): + * inspector/InjectedScript.h: Added. + (WebCore::InjectedScript::InjectedScript): + (WebCore::InjectedScript::~InjectedScript): + (WebCore::InjectedScript::hasNoValue): + * inspector/InjectedScriptHost.cpp: + (WebCore::InjectedScriptHost::injectedScriptForId): + (WebCore::InjectedScriptHost::releaseWrapperObjectGroup): + * inspector/InjectedScriptHost.h: + * inspector/InspectorBackend.cpp: + (WebCore::InspectorBackend::dispatchOnInjectedScript): + * inspector/InspectorController.cpp: + (WebCore::InspectorController::InspectorController): + (WebCore::InspectorController::~InspectorController): + (WebCore::InspectorController::inspectedPageDestroyed): + (WebCore::InspectorController::windowScriptObjectAvailable): + (WebCore::InspectorController::scriptObjectReady): + (WebCore::InspectorController::setFrontendProxyObject): + (WebCore::InspectorController::close): + (WebCore::InspectorController::getProfile): + (WebCore::InspectorController::enableDebugger): + (WebCore::InspectorController::didPause): + (WebCore::InspectorController::injectedScriptForNodeId): + * inspector/InspectorController.h: + (WebCore::InspectorController::frontendScriptState): + * inspector/InspectorFrontend.cpp: + (WebCore::InspectorFrontend::addConsoleMessage): + +2010-02-03 Andras Becsi <abecsi@webkit.org> + + Unreviewed build fix. + + [Qt] Roll-out r54281 because it broke the build on the Qt Release bot. + + * platform/graphics/qt/GraphicsLayerQt.cpp: + (WebCore::GraphicsLayerQtImpl::State::State): + (WebCore::GraphicsLayerQtImpl::GraphicsLayerQtImpl): + (WebCore::GraphicsLayerQtImpl::setBaseTransform): + (WebCore::GraphicsLayerQtImpl::drawContents): + (WebCore::GraphicsLayerQtImpl::notifyChange): + (WebCore::GraphicsLayerQtImpl::flushChanges): + (WebCore::GraphicsLayerQt::setNeedsDisplayInRect): + (WebCore::applyTimingFunction): + (WebCore::webkitAnimationToQtAnimationValue): + (WebCore::AnimationQtBase::updateState): + (WebCore::AnimationQt::updateCurrentTime): + (WebCore::TransformAnimationQt::TransformAnimationQt): + (WebCore::TransformAnimationQt::~TransformAnimationQt): + (WebCore::TransformAnimationQt::applyFrame): + (WebCore::TransformAnimationQt::updateState): + (WebCore::OpacityAnimationQt::updateState): + (WebCore::GraphicsLayerQt::pauseAnimation): + +2010-02-02 Bryan Yeung <bryeung@google.com> + + Reviewed by Darin Adler. + + Avoid using an invalidated KURL object in baseURI. + + https://bugs.webkit.org/show_bug.cgi?id=34492 + + This change fixes baseURI for Chromium (where the KURL implementation + does not allow invalid KURLs to carry relative paths). This is + regression tested by + LayoutTests/svg/W3C-SVG-1.1/struct-image-07-t.svg + + This is a re-application of this patch since it was mistakenly identified as + the cause of a big chromium test regression and rolled out in r54264. + + * dom/Element.cpp: + (WebCore::Element::baseURI): + +2010-02-02 Joel Stanley <joel@jms.id.au> + + Reviewed by David Levin. + + [Chromium] Make setCaretBlinkInterval static. + https://bugs.webkit.org/show_bug.cgi?id=31704 + + This is so it can be called from the newly exposed Chromium API setter + method. + + * rendering/RenderThemeChromiumLinux.cpp: + * rendering/RenderThemeChromiumLinux.h: + +2010-02-02 Yael Aharon <yael.aharon@nokia.com> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] WebSockets : Buffer the data in WebKit instead of QtNetwork + https://bugs.webkit.org/show_bug.cgi?id=34425 + + Buffer the sent data in SocketStreamHandlePrivate instead of relying on + the network layer to do it. This is more robust and more consistent with how + Qt's HTTP stack works. + Close the socket in SocketStreamHandlePrivate::close() regardless of its state. + + No new tests, since no new functionality is introduced. + + * platform/network/qt/SocketStreamHandlePrivate.h: + * platform/network/qt/SocketStreamHandleQt.cpp: + (WebCore::SocketStreamHandlePrivate::SocketStreamHandlePrivate): + (WebCore::SocketStreamHandlePrivate::send): + (WebCore::SocketStreamHandlePrivate::close): + (WebCore::SocketStreamHandlePrivate::socketBytesWritten): + +2010-02-03 Shinichiro Hamaji <hamaji@chromium.org> + + Unreviewed revert of r54259 as it seems to break chromium's unit tests. + The tests pass with r54257 but fail with r54260. + As r54258 and r54260 don't touch code, I'm reverting this change. + + [V8] Generate toV8 conversion helpers, a la JSC bindings. + https://bugs.webkit.org/show_bug.cgi?id=32563 + + * bindings/v8/ScriptController.cpp: + (WebCore::ScriptController::processingUserGesture): + (WebCore::createScriptObject): + (WebCore::ScriptController::createScriptObjectForPluginElement): + * bindings/v8/ScriptObject.cpp: + (WebCore::ScriptGlobalObject::set): + * bindings/v8/V8AbstractEventListener.cpp: + (WebCore::V8AbstractEventListener::handleEvent): + * bindings/v8/V8Collection.h: + (WebCore::getV8Object): + (WebCore::toNativeCollection): + (WebCore::getNamedPropertyOfCollection): + (WebCore::collectionNamedPropertyGetter): + (WebCore::getIndexedPropertyOfCollection): + (WebCore::collectionIndexedPropertyGetter): + (WebCore::nodeCollectionIndexedPropertyEnumerator): + (WebCore::collectionIndexedPropertyEnumerator): + (WebCore::collectionStringOrNullIndexedPropertyGetter): + (WebCore::collectionStringIndexedPropertyGetter): + (WebCore::setCollectionIndexedGetter): + (WebCore::setCollectionNamedGetter): + (WebCore::setCollectionStringOrNullIndexedGetter): + (WebCore::setCollectionStringIndexedGetter): + * bindings/v8/V8DOMWindowShell.cpp: + (WebCore::V8DOMWindowShell::updateDocumentWrapperCache): + * bindings/v8/V8DOMWrapper.cpp: + (WebCore::downcastSVGPathSeg): + (WebCore::V8DOMWrapper::convertSVGElementInstanceToV8Object): + (WebCore::V8DOMWrapper::convertSVGObjectWithContextToV8Object): + (WebCore::V8DOMWrapper::convertToV8Object): + (WebCore::V8DOMWrapper::instantiateV8Object): + (WebCore::V8DOMWrapper::isDOMEventWrapper): + (WebCore::V8DOMWrapper::htmlElementType): + (WebCore::V8DOMWrapper::svgElementType): + (WebCore::V8DOMWrapper::convertEventToV8Object): + (WebCore::): + (WebCore::V8DOMWrapper::convertDocumentToV8Object): + (WebCore::V8DOMWrapper::convertNodeToV8Object): + (WebCore::V8DOMWrapper::convertNewNodeToV8Object): + (WebCore::V8DOMWrapper::convertEventListenerToV8Object): + (WebCore::V8DOMWrapper::convertDOMImplementationToV8Object): + (WebCore::V8DOMWrapper::convertStyleSheetToV8Object): + (WebCore::V8DOMWrapper::convertCSSValueToV8Object): + (WebCore::V8DOMWrapper::convertCSSRuleToV8Object): + (WebCore::V8DOMWrapper::convertWindowToV8Object): + (WebCore::V8DOMWrapper::convertNamedNodeMapToV8Object): + * bindings/v8/V8DOMWrapper.h: + (WebCore::V8DOMWrapper::convertToV8Object): + (WebCore::V8DOMWrapper::convertNodeToV8Object): + (WebCore::V8DOMWrapper::convertNewNodeToV8Object): + (WebCore::V8DOMWrapper::convertEventToV8Object): + (WebCore::V8DOMWrapper::convertEventListenerToV8Object): + (WebCore::V8DOMWrapper::instantiateV8Object): + * bindings/v8/V8NodeFilterCondition.cpp: + (WebCore::V8NodeFilterCondition::acceptNode): + * bindings/v8/V8Proxy.cpp: + (WebCore::V8Proxy::setDOMException): + * bindings/v8/custom/V8CanvasRenderingContext2DCustom.cpp: + (WebCore::toV8Object): + (WebCore::V8CanvasRenderingContext2D::createPatternCallback): + * bindings/v8/custom/V8CustomPositionCallback.cpp: + (WebCore::V8CustomPositionCallback::handleEvent): + * bindings/v8/custom/V8CustomPositionErrorCallback.cpp: + (WebCore::V8CustomPositionErrorCallback::handleEvent): + * bindings/v8/custom/V8CustomSQLStatementCallback.cpp: + (WebCore::V8CustomSQLStatementCallback::handleEvent): + * bindings/v8/custom/V8CustomSQLStatementErrorCallback.cpp: + (WebCore::V8CustomSQLStatementErrorCallback::handleEvent): + * bindings/v8/custom/V8CustomSQLTransactionCallback.cpp: + (WebCore::V8CustomSQLTransactionCallback::handleEvent): + * bindings/v8/custom/V8CustomSQLTransactionErrorCallback.cpp: + (WebCore::V8CustomSQLTransactionErrorCallback::handleEvent): + * bindings/v8/custom/V8DOMWindowCustom.cpp: + (WebCore::V8DOMWindow::openCallback): + (WebCore::V8DOMWindow::indexedPropertyGetter): + (WebCore::V8DOMWindow::namedPropertyGetter): + * bindings/v8/custom/V8DataGridColumnListCustom.cpp: + (WebCore::NAMED_PROPERTY_GETTER): + * bindings/v8/custom/V8DocumentCustom.cpp: + (WebCore::V8Document::evaluateCallback): + (WebCore::V8Document::getCSSCanvasContextCallback): + (WebCore::V8Document::implementationAccessorGetter): + * bindings/v8/custom/V8DocumentLocationCustom.cpp: + (WebCore::V8Document::locationAccessorGetter): + * bindings/v8/custom/V8ElementCustom.cpp: + (WebCore::V8Element::setAttributeNodeCallback): + (WebCore::V8Element::setAttributeNodeNSCallback): + * bindings/v8/custom/V8EventCustom.cpp: + (WebCore::V8Event::dataTransferAccessorGetter): + (WebCore::V8Event::clipboardDataAccessorGetter): + * bindings/v8/custom/V8HTMLAllCollectionCustom.cpp: + (WebCore::getNamedItems): + (WebCore::getItem): + (WebCore::V8HTMLAllCollection::callAsFunctionCallback): + * bindings/v8/custom/V8HTMLAudioElementConstructor.cpp: + (WebCore::V8Custom::v8HTMLAudioElementConstructorCallback): + * bindings/v8/custom/V8HTMLCanvasElementCustom.cpp: + (WebCore::V8HTMLCanvasElement::getContextCallback): + * bindings/v8/custom/V8HTMLCollectionCustom.cpp: + (WebCore::getNamedItems): + (WebCore::getItem): + (WebCore::V8HTMLCollection::callAsFunctionCallback): + * bindings/v8/custom/V8HTMLDocumentCustom.cpp: + (WebCore::V8HTMLDocument::namedPropertyGetter): + (WebCore::V8HTMLDocument::allAccessorGetter): + * bindings/v8/custom/V8HTMLFormElementCustom.cpp: + (WebCore::V8HTMLFormElement::indexedPropertyGetter): + (WebCore::V8HTMLFormElement::namedPropertyGetter): + * bindings/v8/custom/V8HTMLFrameSetElementCustom.cpp: + (WebCore::V8HTMLFrameSetElement::namedPropertyGetter): + * bindings/v8/custom/V8HTMLImageElementConstructor.cpp: + (WebCore::V8Custom::v8HTMLImageElementConstructorCallback): + * bindings/v8/custom/V8HTMLOptionsCollectionCustom.cpp: + (WebCore::V8HTMLOptionsCollection::indexedPropertyGetter): + * bindings/v8/custom/V8HTMLSelectElementCustom.cpp: + (WebCore::V8HTMLSelectElement::namedPropertyGetter): + (WebCore::V8HTMLSelectElement::indexedPropertyGetter): + * bindings/v8/custom/V8InjectedScriptHostCustom.cpp: + (WebCore::createInjectedScript): + (WebCore::V8InjectedScriptHost::nodeForIdCallback): + (WebCore::V8InjectedScriptHost::databaseForIdCallback): + * bindings/v8/custom/V8MessageChannelConstructor.cpp: + (WebCore::V8MessageChannel::constructorCallback): + * bindings/v8/custom/V8MessageEventCustom.cpp: + (WebCore::V8MessageEvent::portsAccessorGetter): + * bindings/v8/custom/V8NamedNodeMapCustom.cpp: + (WebCore::V8NamedNodeMap::indexedPropertyGetter): + (WebCore::V8NamedNodeMap::namedPropertyGetter): + * bindings/v8/custom/V8NodeIteratorCustom.cpp: + (WebCore::toV8): + * bindings/v8/custom/V8NodeListCustom.cpp: + (WebCore::V8NodeList::namedPropertyGetter): + (WebCore::V8NodeList::callAsFunctionCallback): + * bindings/v8/custom/V8NotificationCenterCustom.cpp: + (WebCore::V8NotificationCenter::createHTMLNotificationCallback): + (WebCore::V8NotificationCenter::createNotificationCallback): + * bindings/v8/custom/V8SVGMatrixCustom.cpp: + (WebCore::V8SVGMatrix::multiplyCallback): + (WebCore::V8SVGMatrix::inverseCallback): + (WebCore::V8SVGMatrix::rotateFromVectorCallback): + * bindings/v8/custom/V8StyleSheetListCustom.cpp: + (WebCore::V8StyleSheetList::namedPropertyGetter): + * bindings/v8/custom/V8TreeWalkerCustom.cpp: + (WebCore::toV8Object): + * bindings/v8/custom/V8WebGLRenderingContextCustom.cpp: + (WebCore::toV8Object): + * bindings/v8/custom/V8XSLTProcessorCustom.cpp: + (WebCore::V8XSLTProcessor::transformToFragmentCallback): + (WebCore::V8XSLTProcessor::transformToDocumentCallback): + +2010-02-03 Mikhail Naganov <mnaganov@chromium.org> + + Reviewed by Pavel Feldman. + + Start unforking debugger and profiler code. + + Remove custom implementation of Console. + Add 'ScriptProfiler' and 'ScriptProfile' types. + Start migration to engine-neutral types in InspectorController. + + https://bugs.webkit.org/show_bug.cgi?id=34481 + + * GNUmakefile.am: + * WebCore.gypi: + * WebCore.pro: + * WebCore.xcodeproj/project.pbxproj: + * bindings/js/JSBindingsAllInOne.cpp: + * bindings/js/JSConsoleCustom.cpp: + * bindings/js/ScriptProfile.h: Added. + * bindings/js/ScriptProfiler.cpp: Added. + (WebCore::ScriptProfiler::start): + (WebCore::ScriptProfiler::stop): + * bindings/js/ScriptProfiler.h: Added. + * bindings/scripts/CodeGeneratorV8.pm: + * bindings/v8/ScriptProfile.h: Added. + (WebCore::ScriptProfile::create): + (WebCore::ScriptProfile::~ScriptProfile): + (WebCore::ScriptProfile::title): + (WebCore::ScriptProfile::uid): + (WebCore::ScriptProfile::ScriptProfile): + * bindings/v8/ScriptProfiler.cpp: Added. + (WebCore::ScriptProfiler::start): + (WebCore::ScriptProfiler::stop): + * bindings/v8/ScriptProfiler.h: Added. + * bindings/v8/custom/V8ConsoleCustom.cpp: Removed. + * inspector/InspectorController.cpp: + (WebCore::InspectorController::endGroup): + (WebCore::InspectorController::show): + (WebCore::InspectorController::setDOMStorageItem): + (WebCore::InspectorController::addProfile): + (WebCore::InspectorController::addProfileFinishedMessageToConsole): + (WebCore::InspectorController::addStartProfilingMessageToConsole): + (WebCore::InspectorController::createProfileHeader): + (WebCore::InspectorController::getCurrentUserInitiatedProfileName): + (WebCore::InspectorController::startUserInitiatedProfiling): + (WebCore::InspectorController::stopUserInitiatedProfiling): + (WebCore::InspectorController::enableDebugger): + (WebCore::InspectorController::specialPanelForJSName): + * inspector/InspectorController.h: + (WebCore::InspectorController::searchingForNodeInPage): + * page/Console.cpp: + (WebCore::Console::profile): + (WebCore::Console::profileEnd): + * page/Console.h: + (WebCore::): + (WebCore::Console::create): + (WebCore::Console::profiles): + * page/Console.idl: + +2010-02-02 Kent Tamura <tkent@chromium.org> + + Reviewed by Darin Adler. + + Fix a bug that changes for some constraint attributes doesn't + update validation CSS selectors. + https://bugs.webkit.org/show_bug.cgi?id=31716 + + - Rename HTMLFormControlElement::updateValidity() to setNeedsValidityCheck() + - Introduce HTMLFormControlElement::setNeedsWillValidate() + - Introduce HTMLFormControlElement::m_hasName to make willValidate() + work in parseMappedAttribute(). + - We need to call setNeedsValidityCheck() when HTMLInputElement::step or + HTMLTextAreaElement::maxLength is changed. + + * html/HTMLFormControlElement.cpp: + (WebCore::HTMLFormControlElement::HTMLFormControlElement): + (WebCore::HTMLFormControlElement::parseMappedAttribute): + (WebCore::HTMLFormControlElement::insertedIntoTree): + (WebCore::HTMLFormControlElement::removedFromTree): + (WebCore::HTMLFormControlElement::formDestroyed): + (WebCore::HTMLFormControlElement::willValidate): Avoids function calls. + (WebCore::HTMLFormControlElement::setNeedsWillValidateCheck): + (WebCore::HTMLFormControlElement::setNeedsValidityCheck): + * html/HTMLFormControlElement.h: + (WebCore::HTMLFormControlElement::disabled): Move the code from .cpp. + * html/HTMLInputElement.cpp: + (WebCore::HTMLInputElement::setInputType): + (WebCore::HTMLInputElement::parseMappedAttribute): + (WebCore::HTMLInputElement::setValue): + (WebCore::HTMLInputElement::setValueFromRenderer): + (WebCore::HTMLInputElement::setFileListFromRenderer): + * html/HTMLTextAreaElement.cpp: + (WebCore::HTMLTextAreaElement::parseMappedAttribute): + (WebCore::HTMLTextAreaElement::setValue): + * rendering/RenderTextControlMultiLine.cpp: + (WebCore::RenderTextControlMultiLine::subtreeHasChanged): + +2010-02-02 Roland Steiner <rolandsteiner@chromium.org> + + Reviewed by Adele Peterson. + + Bug 34198 - Ruby text should not inherit line-height + (https://bugs.webkit.org/show_bug.cgi?id=34198) + + Resetting line-height to 'normal' in the default UA style sheet. + Adding layout-test to check for this. + + Test: fast/ruby/ruby-line-height.html + + * css/html.css: + +2010-02-02 James Robinson <jamesr@chromium.org> + + Reviewed by Dmitry Titov. + + Add a null check for image, which might be NULL if tileSize is empty + https://bugs.webkit.org/show_bug.cgi?id=34510 + + Test: fast/gradients/crash-on-1px-border.html + + * rendering/RenderBoxModelObject.cpp: + (WebCore::RenderBoxModelScaleObserver::shouldPaintBackgroundAtLowQuality): + +2010-02-02 Kent Tamura <tkent@chromium.org> + + Reviewed by Darin Adler. + + rangeOverflow/rangeUnderflow support for type=datetime, datetime-local, + month, time and week + https://bugs.webkit.org/show_bug.cgi?id=34483 + + Tests: fast/forms/ValidityState-rangeOverflow.html + fast/forms/ValidityState-rangeUnderflow.html + + * html/HTMLInputElement.cpp: + Defines the hard limits for the types as double values. + (WebCore::HTMLInputElement::rangeUnderflow): Supports the types. + (WebCore::HTMLInputElement::rangeOverflow): Supports the types. + (WebCore::HTMLInputElement::minimum): Supports the types. + (WebCore::HTMLInputElement::maximum): Supports the types. + +2010-02-02 Fumitoshi Ukai <ukai@chromium.org> + + Reviewed by Alexey Proskuryakov. + + WebSocket set pending activity to avoid unexpected GC. + https://bugs.webkit.org/show_bug.cgi?id=34014 + + Test: websocket/tests/websocket-pending-activity.html + + * websockets/WebSocket.cpp: + (WebCore::WebSocket::connect): set pending activity until it receives didClose. + (WebCore::WebSocket::contextDestroyed): check socket is already closed. + (WebCore::WebSocket::stop): close the connection and unset pending activity when it stops. + (WebCore::WebSocket::didClose): unset pending activity. + * websockets/WebSocket.h: + * websockets/WebSocketChannel.cpp: + (WebCore::WebSocketChannel::didReceiveData): protect this while it processes received data. + +2010-02-02 Gustavo Noronha Silva <gns@gnome.org> + + No review, rolling out r54261. + http://trac.webkit.org/changeset/54261 + https://bugs.webkit.org/show_bug.cgi?id=34435 + + Causes crashes on release builds + + * GNUmakefile.am: + * platform/graphics/gtk/MediaPlayerPrivateGStreamer.cpp: + (WebCore::mediaPlayerPrivateSourceChangedCallback): + * platform/gtk/GOwnPtrGtk.cpp: Removed. + * platform/gtk/GOwnPtrGtk.h: Removed. + +2010-02-02 David Levin <levin@chromium.org> + + No review, rolling out r54245. + http://trac.webkit.org/changeset/54245 + https://bugs.webkit.org/show_bug.cgi?id=34492 + + This patch seems to have broken thousands of chromium tests on + Windows (and since it was for chromium, I'm rolling it out). + + * dom/Element.cpp: + (WebCore::Element::baseURI): + +2010-02-02 Steve Falkenburg <sfalken@apple.com> + + Reviewed by Darin Adler. + + Copyright year updating for Windows version resources should be automatic + https://bugs.webkit.org/show_bug.cgi?id=34503 + + * WebCore.vcproj/QTMovieWin.rc: + +2010-02-02 Dimitri Glazkov <dglazkov@chromium.org> + + No review, rolling out r54257. + http://trac.webkit.org/changeset/54257 + https://bugs.webkit.org/show_bug.cgi?id=34491 + + [Chromium] broke thousands of Win tests and a few of Linux tests. + + * platform/graphics/skia/GraphicsContextSkia.cpp: + (WebCore::GraphicsContext::beginTransparencyLayer): + * platform/graphics/skia/PlatformContextSkia.cpp: + (PlatformContextSkia::applyAntiAliasedClipPaths): + * platform/graphics/skia/PlatformContextSkia.h: + +2010-02-02 Philippe Normand <pnormand@igalia.com> + + Reviewed by Gustavo Noronha Silva. + + [Gtk] libsoup critical warning in media player http cookies injection code + https://bugs.webkit.org/show_bug.cgi?id=34435 + + Fixed the critical warning and refactored the + User-Agent/Referer/cookies injection code, in that order. Previous + order (cookies first) was wrong because if cookies injection could + not be done neither the User-Agent not Referer were injected. Also + started a non-JSC-specific, gtk-specific GOwnPtr module. + + * GNUmakefile.am: + * platform/graphics/gtk/MediaPlayerPrivateGStreamer.cpp: + (WebCore::mediaPlayerPrivateSourceChangedCallback): + * platform/gtk/GOwnPtrGtk.cpp: Added. + (WTF::SoupURI): + (WTF::GstElement): + * platform/gtk/GOwnPtrGtk.h: Added. + +2010-02-02 Nate Chapin <japhet@chromium.org> + + Reviewed by Dimitri Glazkov. + + [V8] Use toV8() to wrap in the custom bindings, and remove + the old wrapping code from V8DOMWrapper. + + https://bugs.webkit.org/show_bug.cgi?id=32563 + + * bindings/v8/ScriptController.cpp: + * bindings/v8/ScriptObject.cpp: + * bindings/v8/V8AbstractEventListener.cpp: + * bindings/v8/V8Collection.h: + * bindings/v8/V8DOMWindowShell.cpp: + * bindings/v8/V8DOMWrapper.cpp: + * bindings/v8/V8DOMWrapper.h: + * bindings/v8/V8NodeFilterCondition.cpp: + * bindings/v8/V8Proxy.cpp: + * bindings/v8/custom/V8CanvasRenderingContext2DCustom.cpp: + * bindings/v8/custom/V8CustomPositionCallback.cpp: + * bindings/v8/custom/V8CustomPositionErrorCallback.cpp: + * bindings/v8/custom/V8CustomSQLStatementCallback.cpp: + * bindings/v8/custom/V8CustomSQLStatementErrorCallback.cpp: + * bindings/v8/custom/V8CustomSQLTransactionCallback.cpp: + * bindings/v8/custom/V8CustomSQLTransactionErrorCallback.cpp: + * bindings/v8/custom/V8DOMWindowCustom.cpp: + * bindings/v8/custom/V8DataGridColumnListCustom.cpp: + * bindings/v8/custom/V8DocumentCustom.cpp: + * bindings/v8/custom/V8DocumentLocationCustom.cpp: + * bindings/v8/custom/V8ElementCustom.cpp: + * bindings/v8/custom/V8EventCustom.cpp: + * bindings/v8/custom/V8HTMLAllCollectionCustom.cpp: + * bindings/v8/custom/V8HTMLAudioElementConstructor.cpp: + * bindings/v8/custom/V8HTMLCanvasElementCustom.cpp: + * bindings/v8/custom/V8HTMLCollectionCustom.cpp: + * bindings/v8/custom/V8HTMLDocumentCustom.cpp: + * bindings/v8/custom/V8HTMLFormElementCustom.cpp: + * bindings/v8/custom/V8HTMLFrameSetElementCustom.cpp: + * bindings/v8/custom/V8HTMLImageElementConstructor.cpp: + * bindings/v8/custom/V8HTMLOptionsCollectionCustom.cpp: + * bindings/v8/custom/V8HTMLSelectElementCustom.cpp: + * bindings/v8/custom/V8InjectedScriptHostCustom.cpp: + * bindings/v8/custom/V8MessageChannelConstructor.cpp: + * bindings/v8/custom/V8MessageEventCustom.cpp: + * bindings/v8/custom/V8NamedNodeMapCustom.cpp: + * bindings/v8/custom/V8NodeIteratorCustom.cpp: + * bindings/v8/custom/V8NodeListCustom.cpp: + * bindings/v8/custom/V8NotificationCenterCustom.cpp: + * bindings/v8/custom/V8SVGMatrixCustom.cpp: + * bindings/v8/custom/V8StyleSheetListCustom.cpp: + * bindings/v8/custom/V8TreeWalkerCustom.cpp: + * bindings/v8/custom/V8WebGLRenderingContextCustom.cpp: + * bindings/v8/custom/V8XSLTProcessorCustom.cpp: + +2010-02-02 Garret Kelly <gdk@chromium.org> + + Reviewed by David Levin. + + When using the Skia graphics context, the beginTransparencyLayer call + currently creates a new layer, but does not keep the current + compositing mode for use when merging the created layer back onto the + rest of the context. This patch fixes that. + https://bugs.webkit.org/show_bug.cgi?id=34491 + + fast/backgrounds/svg-as-mask.html is affected by this change in Chromium, + but not fixed. This is the first of a series of patches to fix it. + + * platform/graphics/skia/GraphicsContextSkia.cpp: + (WebCore::GraphicsContext::beginTransparencyLayer): + * platform/graphics/skia/PlatformContextSkia.cpp: + (PlatformContextSkia::beginTransparencyLayer): + * platform/graphics/skia/PlatformContextSkia.h: + +2010-02-02 Kwang Yul Seo <skyul@company100.net> + + Reviewed by Eric Seidel. + + Use WTF::getLocalTime instead of localtime_r in FTPDirectoryDocument + https://bugs.webkit.org/show_bug.cgi?id=34409 + + Platform guards for localtime_r are not needed because we already have + WTF::getLocalTime which does the same thing. + + * loader/FTPDirectoryDocument.cpp: + (WebCore::processFileDateString): + * loader/FTPDirectoryParser.cpp: + (WebCore::gmtimeQt): + +2010-02-02 Adam Roben <aroben@apple.com> + + Copy WebCore's bindings generation scripts to the PrivateHeaders + directory on Mac + + This will allow other projects to use these scripts. + + Fixes <http://webkit.org/b/34498>. + + Reviewed by Mark Rowe. + + * WebCore.xcodeproj/project.pbxproj: Added the bindings generation + scripst to the Copy Headers phase, and marked them as Private. + +2010-02-02 Adam Roben <aroben@apple.com> + + Copy WebCore's bindings generation scripts to a more sensible location + + Part of Bug 34496: Clean up WebCore's IDL/script copying + <https://bugs.webkit.org/show_bug.cgi?id=34496> + + Reviewed by Steve Falkenburg. + + * WebCore.vcproj/WebCore.make: + * WebCore.vcproj/WebCoreGenerated.vcproj: + Instead of copying to obj/WebKit/DOMInterfaces, copy to obj/WebCore/scripts. + +2010-02-02 Adam Roben <aroben@apple.com> + + Rename the scripts used to copy WebCore's bindings generation scripts + + Part of Bug 34496: Clean up WebCore's IDL/script copying + <https://bugs.webkit.org/show_bug.cgi?id=34496> + + Reviewed by Steve Falkenburg. + + * WebCore.vcproj/MigrateScripts: Renamed from WebCore/WebCore.vcproj/MigrateIDLAndScripts. + * WebCore.vcproj/migrate-scripts.sh: Renamed from WebCore/WebCore.vcproj/migrate-idls.sh. + + * WebCore.vcproj/WebCoreGenerated.vcproj: Updated for renames. + +2010-02-02 Adam Roben <aroben@apple.com> + + Stop copying IDL files into $(WebKitOutputDir) + + No one uses these anymore (as of r52921). + + Part of Bug 34496: Clean up WebCore's IDL/script copying + <https://bugs.webkit.org/show_bug.cgi?id=34496> + + Reviewed by Steve Falkenburg. + + * WebCore.vcproj/MigrateIDLAndScripts: Don't copy the IDL files + anymore. Keep copying the scripts, though, since other projects + (outside of the WebKit repository) do use those. + +2010-02-02 Bryan Yeung <bryeung@google.com> + + Reviewed by Darin Adler. + + Avoid using an invalidated KURL object in baseURI. + + https://bugs.webkit.org/show_bug.cgi?id=34492 + + This change fixes baseURI for Chromium (where the KURL implementation + does not allow invalid KURLs to carry relative paths). This is + regression tested by + LayoutTests/svg/W3C-SVG-1.1/struct-image-07-t.svg + + * dom/Element.cpp: + (WebCore::Element::baseURI): + +2010-02-02 Alexey Proskuryakov <ap@apple.com> + + Reviewed by Darin Adler. + + https://bugs.webkit.org/show_bug.cgi?id=34076 + <rdar://problem/7594601> Crash in mangleme in WebCore::Element::getAttribute + + Test: fast/forms/misplaced-img-form-registration.html + + * html/HTMLFormElement.cpp: + (WebCore::HTMLFormElement::registerImgElement): Assert that the same image isn't added + to vector again. + (WebCore::HTMLFormElement::removeImgElement): Similarly, assert that we're removing something + that's actually registered. + + * html/HTMLImageElement.cpp: (WebCore::HTMLImageElement::~HTMLImageElement): If parser fails + to insert the image element, then there will be no removed from tree notification either, + need to unregister right away. + +2010-02-02 Alexander Pavlov <apavlov@chromium.org> + + Reviewed by Pavel Feldman. + + Web Inspector: Eliminate some of the platform flavor-specific stylesheet selectors + + Extract OS version into WebInspector.platformFlavor + https://bugs.webkit.org/show_bug.cgi?id=34469 + + * inspector/front-end/InspectorBackendStub.js: + * inspector/front-end/InspectorFrontendHostStub.js: + (.WebInspector.InspectorFrontendHostStub.prototype.platform): + * inspector/front-end/inspector.css: + * inspector/front-end/inspector.js: + (WebInspector.pendingDispatches.0.URLRegExp.i.get platform): + (WebInspector.get platformFlavor): + (WebInspector._detectPlatformFlavor): + (WebInspector.loaded): + (WebInspector.toolbarDragStart): + (WebInspector.isMac): + +2010-02-02 Steve Block <steveblock@google.com> + + Reviewed by Ariya Hidayat. + + Adds utility functions for converting between JavaInstance and NPAPI types + https://bugs.webkit.org/show_bug.cgi?id=34468 + + This is required by Android for injecting objects into V8 JavaScript. + + No new tests, added utility functions only. + + * Android.v8bindings.mk: Modified. Added JavaNPObjectV8.cpp + * bridge/jni/v8/JavaNPObjectV8.cpp: Added. + (JSC::Bindings::AllocJavaNPObject): + (JSC::Bindings::FreeJavaNPObject): + (JSC::Bindings::): + (JSC::Bindings::JavaInstanceToNPObject): + (JSC::Bindings::ExtractJavaInstance): + (JSC::Bindings::JavaNPObjectHasMethod): + (JSC::Bindings::JavaNPObjectInvoke): + (JSC::Bindings::JavaNPObjectHasProperty): + (JSC::Bindings::JavaNPObjectGetProperty): + * bridge/jni/v8/JavaNPObjectV8.h: Added. + +2010-02-02 Benjamin Poulain <benjamin.poulain@nokia.com> + + Reviewed by Ariya Hidayat. + + [Qt] Symbian plugins include a wrong header file for QPixmap + https://bugs.webkit.org/show_bug.cgi?id=34475 + + * plugins/symbian/PluginViewSymbian.cpp: + +2010-02-02 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Timothy Hatcher. + + Web Inspector: URLs are not syntax-higlighted as links in source view. + + This change enables linkifier in the NativeTextViewer. It adds + "linkify" and "a_node" parse states into the highlighter in order + to detect links and distinguish between resource and external ones. + Contains drive-by fix for the webkit-html-* styles and moves them to the + common location. + + https://bugs.webkit.org/show_bug.cgi?id=34364 + + * inspector/front-end/NativeTextViewer.js: + (WebInspector.NativeTextViewer): + (WebInspector.NativeTextViewer.prototype._createSpan): + (WebInspector.NativeTextViewer.prototype._createLink): + (WebInspector.NativeTextViewer.prototype._rewriteHref): + * inspector/front-end/SourceFrame.js: + (WebInspector.SourceFrame.prototype.setContent): + (WebInspector.SourceFrame.prototype._createEditorIfNeeded): + * inspector/front-end/SourceHTMLTokenizer.js: + (WebInspector.SourceHTMLTokenizer): + (WebInspector.SourceHTMLTokenizer.prototype._isExpectingAttribute): + (WebInspector.SourceHTMLTokenizer.prototype._isExpectingAttributeValue): + (WebInspector.SourceHTMLTokenizer.prototype._setExpectingAttribute): + (WebInspector.SourceHTMLTokenizer.prototype._setExpectingAttributeValue): + (WebInspector.SourceHTMLTokenizer.prototype._stringToken): + (WebInspector.SourceHTMLTokenizer.prototype._attrValueTokenType): + (WebInspector.SourceHTMLTokenizer.prototype.nextToken): + * inspector/front-end/SourceHTMLTokenizer.re2js: + * inspector/front-end/SourceView.js: + (WebInspector.SourceView.prototype._contentLoaded): + * inspector/front-end/TextEditorHighlighter.js: + (WebInspector.TextEditorHighlighter): + * inspector/front-end/inspector.css: + * inspector/front-end/inspectorSyntaxHighlight.css: + +2010-02-02 Simon Hausmann <simon.hausmann@nokia.com> + + Reviewed by Ariya Hidayat. + + [Qt] Install libraries and headers in package builds + https://bugs.webkit.org/show_bug.cgi?id=34325 + + Add the QtWebKit libraries to the installable items, except on + Symbian where the libraries are always linked in their final + destination. + + Also include the headers generated by syncqt in the installation. + + * WebCore.pro: + +2010-02-02 Kavita Kanetkar <kkanetkar@chromium.org> + + Reviewed by Dmitry Titov. + + [V8] Raising an exception while setting timeout/interval from a detached frame + https://bugs.webkit.org/show_bug.cgi?id=34453 + This fixes the issue/failing test mentioned in Chromium bug: + http://code.google.com/p/chromium/issues/detail?id=32671 + + + * bindings/v8/custom/V8DOMWindowCustom.cpp: + (WebCore::WindowSetTimeoutImpl): + +2010-02-02 Kwang Yul Seo <skyul@company100.net> + + Reviewed by Eric Seidel. + + [BREWMP] Port Screen + https://bugs.webkit.org/show_bug.cgi?id=34299 + + Get the screen size and depth from the main display bitmap. + + * platform/brew/ScreenBrew.cpp: Added. + (WebCore::getDisplayInfo): + (WebCore::screenRect): + (WebCore::screenAvailableRect): + (WebCore::screenDepth): + (WebCore::screenDepthPerComponent): + (WebCore::screenIsMonochrome): + +2010-02-02 Kwang Yul Seo <skyul@company100.net> + + Reviewed by Eric Seidel. + + [BREWMP] Port LocalizedStrings + https://bugs.webkit.org/show_bug.cgi?id=34257 + + Port LocalizedStrings to BREWMP. + + * platform/brew/LocalizedStringsBrew.cpp: Added. + (WebCore::submitButtonDefaultLabel): + (WebCore::inputElementAltText): + (WebCore::resetButtonDefaultLabel): + (WebCore::defaultLanguage): + (WebCore::searchableIndexIntroduction): + (WebCore::fileButtonChooseFileLabel): + (WebCore::fileButtonNoFileSelectedLabel): + (WebCore::contextMenuItemTagOpenLinkInNewWindow): + (WebCore::contextMenuItemTagDownloadLinkToDisk): + (WebCore::contextMenuItemTagCopyLinkToClipboard): + (WebCore::contextMenuItemTagOpenImageInNewWindow): + (WebCore::contextMenuItemTagDownloadImageToDisk): + (WebCore::contextMenuItemTagCopyImageToClipboard): + (WebCore::contextMenuItemTagOpenFrameInNewWindow): + (WebCore::contextMenuItemTagCopy): + (WebCore::contextMenuItemTagGoBack): + (WebCore::contextMenuItemTagGoForward): + (WebCore::contextMenuItemTagStop): + (WebCore::contextMenuItemTagReload): + (WebCore::contextMenuItemTagCut): + (WebCore::contextMenuItemTagPaste): + (WebCore::contextMenuItemTagNoGuessesFound): + (WebCore::contextMenuItemTagIgnoreSpelling): + (WebCore::contextMenuItemTagLearnSpelling): + (WebCore::contextMenuItemTagSearchWeb): + (WebCore::contextMenuItemTagLookUpInDictionary): + (WebCore::contextMenuItemTagOpenLink): + (WebCore::contextMenuItemTagIgnoreGrammar): + (WebCore::contextMenuItemTagSpellingMenu): + (WebCore::contextMenuItemTagShowSpellingPanel): + (WebCore::contextMenuItemTagCheckSpelling): + (WebCore::contextMenuItemTagCheckSpellingWhileTyping): + (WebCore::contextMenuItemTagCheckGrammarWithSpelling): + (WebCore::contextMenuItemTagFontMenu): + (WebCore::contextMenuItemTagBold): + (WebCore::contextMenuItemTagItalic): + (WebCore::contextMenuItemTagUnderline): + (WebCore::contextMenuItemTagOutline): + (WebCore::contextMenuItemTagWritingDirectionMenu): + (WebCore::contextMenuItemTagDefaultDirection): + (WebCore::contextMenuItemTagLeftToRight): + (WebCore::contextMenuItemTagRightToLeft): + (WebCore::contextMenuItemTagInspectElement): + (WebCore::searchMenuNoRecentSearchesText): + (WebCore::searchMenuRecentSearchesText): + (WebCore::searchMenuClearRecentSearchesText): + (WebCore::unknownFileSizeText): + (WebCore::AXWebAreaText): + (WebCore::AXLinkText): + (WebCore::AXListMarkerText): + (WebCore::AXImageMapText): + (WebCore::AXHeadingText): + (WebCore::imageTitle): + (WebCore::contextMenuItemTagTextDirectionMenu): + (WebCore::AXButtonActionVerb): + (WebCore::AXTextFieldActionVerb): + (WebCore::AXRadioButtonActionVerb): + (WebCore::AXCheckedCheckBoxActionVerb): + (WebCore::AXUncheckedCheckBoxActionVerb): + (WebCore::AXLinkActionVerb): + (WebCore::AXMenuListPopupActionVerb): + (WebCore::AXMenuListActionVerb): + (WebCore::AXDefinitionListTermText): + (WebCore::AXDefinitionListDefinitionText): + (WebCore::validationMessageValueMissingText): + (WebCore::validationMessageTypeMismatchText): + (WebCore::validationMessagePatternMismatchText): + (WebCore::validationMessageTooLongText): + (WebCore::validationMessageRangeUnderflowText): + (WebCore::validationMessageRangeOverflowText): + (WebCore::validationMessageStepMismatchText): + +2010-02-02 Kwang Yul Seo <skyul@company100.net> + + Reviewed by Eric Seidel. + + [BREWMP] Port systemBeep + https://bugs.webkit.org/show_bug.cgi?id=33601 + + Implement systemBeep with IShell_Beep. + + * platform/brew/SoundBrew.cpp: Added. + (WebCore::systemBeep): + +2010-02-02 Shinichiro Hamaji <hamaji@chromium.org> + + Reviewed by Eric Seidel. + + [Win] Utilize PrintContext to share the printing code with other ports + https://bugs.webkit.org/show_bug.cgi?id=34312 + + No new tests as this is just a small refactoring. + +2010-02-02 Kwang Yul Seo <skyul@company100.net> + + Reviewed by Eric Seidel. + + [BREWMP] Add conversions between IntPoint and AEEPoint + https://bugs.webkit.org/show_bug.cgi?id=34194 + + Make it easy to convert between IntPoint and AEEPoint. + + * platform/graphics/IntPoint.h: + * platform/graphics/brew/IntPointBrew.cpp: Added. + (WebCore::IntPoint::IntPoint): + (WebCore::IntPoint::operator AEEPoint): + +>>>>>>> webkit.org at r54340 2010-02-02 Steve Block <steveblock@google.com> Reviewed by Adam Barth. @@ -11,6 +1323,961 @@ (WebCore::AbstractWeakReferenceMap::~AbstractWeakReferenceMap): Added. (WebCore::AbstractWeakReferenceMap::Visitor::~Visitor): Added. +<<<<<<< HEAD +======= +2010-02-02 Avi Drissman <avi@chromium.org> + + Reviewed by Eric Seidel. + + Sync up Chromium Mac render theme to Mac render theme + https://bugs.webkit.org/show_bug.cgi?id=34340 + + Covered by existing layout tests. + + * platform/chromium/ThemeChromiumMac.mm: + (WebCore::updateStates): + (WebCore::checkbox): + (WebCore::paintCheckbox): + (WebCore::radio): + (WebCore::paintRadio): + (WebCore::listButtonSizes): + (WebCore::setupButtonCell): + (WebCore::button): + (WebCore::paintButton): + (WebCore::ThemeChromiumMac::controlSize): + (WebCore::ThemeChromiumMac::minimumControlSize): + (WebCore::ThemeChromiumMac::controlBorder): + (WebCore::ThemeChromiumMac::paint): + * rendering/RenderThemeChromiumMac.h: + * rendering/RenderThemeChromiumMac.mm: + (-[WebCoreRenderThemeNotificationObserver initWithTheme:WebCore::]): + (WebCore::convertNSColorToColor): + (WebCore::RenderThemeChromiumMac::systemColor): + (WebCore::RenderThemeChromiumMac::isControlStyled): + (WebCore::RenderThemeChromiumMac::adjustRepaintRect): + (WebCore::RenderThemeChromiumMac::convertToPaintingRect): + (WebCore::RenderThemeChromiumMac::paintCapsLockIndicator): + (WebCore::RenderThemeChromiumMac::paintMenuList): + (WebCore::RenderThemeChromiumMac::paintMenuListButton): + (WebCore::RenderThemeChromiumMac::adjustMenuListStyle): + (WebCore::RenderThemeChromiumMac::adjustMenuListButtonStyle): + (WebCore::RenderThemeChromiumMac::paintSliderTrack): + (WebCore::RenderThemeChromiumMac::paintSliderThumb): + (WebCore::RenderThemeChromiumMac::paintSearchField): + (WebCore::RenderThemeChromiumMac::setSearchFieldSize): + (WebCore::RenderThemeChromiumMac::adjustSearchFieldStyle): + (WebCore::RenderThemeChromiumMac::paintSearchFieldResultsButton): + (WebCore::RenderThemeChromiumMac::adjustSliderThumbSize): + (WebCore::RenderThemeChromiumMac::popupButton): + (WebCore::RenderThemeChromiumMac::sliderThumbHorizontal): + (WebCore::RenderThemeChromiumMac::sliderThumbVertical): + +2010-02-02 Kwang Yul Seo <skyul@company100.net> + + Reviewed by Eric Seidel. + + [BREWMP] Port Logging + https://bugs.webkit.org/show_bug.cgi?id=34300 + + Log calls to notImplemented() by default. + + * platform/brew/LoggingBrew.cpp: Added. + (WebCore::InitializeLoggingChannelsIfNecessary): + +2010-02-02 Kwang Yul Seo <skyul@company100.net> + + Reviewed by Eric Seidel. + + [BREWMP] Port FileChooser + https://bugs.webkit.org/show_bug.cgi?id=34261 + + Port FileChooser to BREWMP. + + * platform/brew/FileChooserBrew.cpp: Added. + (WebCore::FileChooser::basenameForWidth): + +2010-02-01 Zoltan Horvath <zoltan@webkit.org> + + Reviewed by Darin Adler. + + Allow custom memory allocation control for IconDatabaseClient class + https://bugs.webkit.org/show_bug.cgi?id=33252 + + Inherits the following struct from Noncopyable because it is + instantiated by 'new' and no need to be copyable: + + class name - instantiated at: WebCore/'location' + class IconDatabaseClient - loader/icon/IconDatabase.cpp:89 + + * loader/icon/IconDatabaseClient.h: + +2010-02-01 Kwang Yul Seo <skyul@company100.net> + + Reviewed by Eric Seidel. + + [BREWMP] Port MIMETypeRegistry + https://bugs.webkit.org/show_bug.cgi?id=34220 + + Port MIMETypeRegistry with an extension map as other ports do. + + * platform/brew: Added. + * platform/brew/MIMETypeRegistryBrew.cpp: Added. + (WebCore::): + (WebCore::MIMETypeRegistry::getMIMETypeForExtension): + +2010-02-01 Dmitry Titov <dimich@chromium.org> + + Not reviewed, revert r54194 that fails new test on Qt and Chromium. + https://bugs.webkit.org/show_bug.cgi?id=34382 + + * html/HTMLFrameElementBase.cpp: + (WebCore::HTMLFrameElementBase::setNameAndOpenURL): + (WebCore::HTMLFrameElementBase::insertedIntoDocument): + * html/HTMLFrameElementBase.h: + * page/Frame.cpp: + * page/Frame.h: + +2010-02-01 Shinichiro Hamaji <hamaji@chromium.org> + + Reviewed by Eric Seidel. + + Provide a way to get page number with layoutTestController + https://bugs.webkit.org/show_bug.cgi?id=33840 + + Test: printing/page-break-always.html + + * WebCore.base.exp: + * WebCore.xcodeproj/project.pbxproj: + * page/PrintContext.cpp: + (WebCore::PrintContext::pageRect): Added a getter function. + (WebCore::PrintContext::computePageRects): Move its logic into computePageRectsWithPageSize. + (WebCore::PrintContext::computePageRectsWithPageSize): Factored out from computePageRects for pageNumberForElement. + (WebCore::enclosingBoxModelObject): Added for pageNumberForElement. + (WebCore::PrintContext::pageNumberForElement): Added for testing. + * page/PrintContext.h: + +2010-02-01 Kwang Yul Seo <skyul@company100.net> + + Reviewed by Eric Seidel. + + [BREWMP] Add conversions between IntSize and AEESize + https://bugs.webkit.org/show_bug.cgi?id=34197 + + Make it easy to convert between IntSize and AEESize. + + * platform/graphics/IntSize.h: + * platform/graphics/brew/IntSizeBrew.cpp: Added. + (WebCore::IntSize::IntSize): + (WebCore::IntSize::operator AEESize): + +2010-02-01 Stephen White <senorblanco@chromium.org> + + Reviewed by Eric Seidel. + + Fix for Pattern transformations in Chromium/Skia. This required + reworking Pattern a bit to be more like the Gradient implementation. + In particular, it now holds an m_pattern reference to the + platform-specific implementation, and passes along changes to the + m_patternSpaceTransformation, in the same way that Gradient does for + m_gradientSpaceTransformation. This is necessary since Skia creates the + platform-specific pattern (SkShader) once, rather than recreating it + on each draw. + For platforms other than Skia, m_pattern is unused, they will + continue to use the static createPlatformPattern(), and the new + notification functions are stubbed out. Other platforms can switch to + the new implementation if they so choose. + + https://bugs.webkit.org/show_bug.cgi?id=24534 + + Covered by svg/custom/pattern-y-offset.svg, + svg/custom/pattern-cycle-detection.svg, and many more. + + * platform/graphics/Pattern.cpp: + (WebCore::Pattern::Pattern): + Initializer for m_pattern. + (WebCore::Pattern::~Pattern): + call platformDestroy(). + (WebCore::Pattern::setPatternSpaceTransform): + Pass along the transform via setPlatformPatternSpaceTransform(). + (WebCore::Pattern::platformDestroy): + (WebCore::Pattern::setPlatformPatternSpaceTransform): + Stub implementations for non-skia platforms. + * platform/graphics/Pattern.h: + * platform/graphics/skia/GraphicsContextSkia.cpp: + (WebCore::GraphicsContext::setPlatformFillPattern): + (WebCore::GraphicsContext::setPlatformStrokePattern): + Call platformPattern() instead of static version. + Since Pattern now owns its SkShader, no need to unref here. + * platform/graphics/skia/PatternSkia.cpp: + (WebCore::Pattern::platformDestroy): + Unref the SkShader on destroy. + (WebCore::Pattern::platformPattern): + Create the platform pattern (SkShader) once, and cache it. + (WebCore::Pattern::setPlatformPatternSpaceTransform): + Set the shader's local matrix from the m_patternSpaceTransformation. + +2010-02-01 Daniel Bates <dbates@webkit.org> + + Reviewed by Adam Barth. + + https://bugs.webkit.org/show_bug.cgi?id=27312 + + Implements support for full page blocking via the X-XSS-Protection header. + + Tests: http/tests/security/xssAuditor/full-block-base-href.html + http/tests/security/xssAuditor/full-block-get-from-iframe.html + http/tests/security/xssAuditor/full-block-iframe-javascript-url.html + http/tests/security/xssAuditor/full-block-iframe-no-inherit.php + http/tests/security/xssAuditor/full-block-javascript-link.html + http/tests/security/xssAuditor/full-block-link-onclick.html + http/tests/security/xssAuditor/full-block-object-tag.html + http/tests/security/xssAuditor/full-block-post-from-iframe.html + http/tests/security/xssAuditor/full-block-script-tag-with-source.html + http/tests/security/xssAuditor/full-block-script-tag.html + http/tests/security/xssAuditor/malformed-xss-protection-header.html + + * page/XSSAuditor.cpp: + (WebCore::XSSAuditor::shouldFullPageBlockForXSSProtectionHeader): Added. + (WebCore::XSSAuditor::findInRequest): Modified to call method + XSSAuditor::shouldFullPageBlockForXSSProtectionHeader. + * page/XSSAuditor.h: Defined method shouldFullPageBlockForXSSProtectionHeader + and fixed misspelled words in large comment block. + +2010-02-01 Kwang Yul Seo <skyul@company100.net> + + Reviewed by Eric Seidel. + + [BREWMP] Port SharedTimer with IShell_SetTimerEx. + https://bugs.webkit.org/show_bug.cgi?id=33599 + + As fireTime passed in setSharedTimerFireTime is the absolute time, + we must calcalute the interval by subtracting currentTime() from + fireTime and pass the result to ISHELL_SetTimerEx. + + * platform/brew/SharedTimerBrew.cpp: Added. + (WebCore::invokeCallback): + (WebCore::setSharedTimerFiredFunction): + (WebCore::setSharedTimerFireTime): + (WebCore::stopSharedTimer): + +2010-02-01 Shinichiro Hamaji <hamaji@chromium.org> + + [Chromium] Unreviewed attempt to fix the chromium build. + + Corresponding change: http://trac.webkit.org/changeset/54182 + + * bindings/scripts/CodeGeneratorV8.pm: + * bindings/v8/ScriptController.cpp: + (WebCore::ScriptController::processingUserGesture): + * bindings/v8/ScriptController.h: + +2010-02-01 Dmitry Titov <dimich@chromium.org> + + Reviewed by David Levin. + + When a live iframe element is moved between pages, it still depends on the old page. + https://bugs.webkit.org/show_bug.cgi?id=34382 + + Test: fast/frames/iframe-reparenting-new-page.html + + * html/HTMLFrameElementBase.cpp: + (WebCore::HTMLFrameElementBase::setName): + Move the code setting the frame name into a separate function. + + (WebCore::HTMLFrameElementBase::setNameAndOpenURL): + (WebCore::HTMLFrameElementBase::updateLiveFrame): + Update frame tree, reset page in the contentFrame and re-set the name. + + (WebCore::HTMLFrameElementBase::insertedIntoDocument): + * html/HTMLFrameElementBase.h: + + * page/Frame.cpp: + (WebCore::Frame::setPage): + * page/Frame.h: Add setPage method. It is only currently used when iframe is + moved between pages (so the ASSERT(m_ownerElement). + +2010-02-01 Brady Eidson <beidson@apple.com> + + Reviewed by Tim Hatcher. + + Add common IRC ports to port blocking. + <rdar://problem/7593895> and https://bugs.webkit.org/show_bug.cgi?id=34451 + + * platform/KURL.cpp: + (WebCore::portAllowed): + +2010-01-29 Jeremy Orlow <jorlow@chromium.org> + + Reviewed by Nate Chapin. + + [V8] Add compile time guards for IndexedDB custom functions + https://bugs.webkit.org/show_bug.cgi?id=34368 + + * bindings/v8/custom/V8IDBRequestCustom.cpp: + * bindings/v8/custom/V8IndexedDatabaseRequestCustom.cpp: + +2010-01-29 Gavin Barraclough <barraclough@apple.com> + + Reviewed by Sam Weinig + Oliver Hunt. + + Bug 34346 - With JSC bindings, make processingUserGesture work with events in Isolated Worlds + + Change HTMLMediaElement methods that require checking whether the event is a user gesture to + be passed a boolean. This may be passed from the JSC bindings (where we have an exec state), + or read from the event. Add a Flag to the IDL to mark this information is required. + + * WebCore.Video.exp: + * bindings/js/JSDOMBinding.cpp: + (WebCore::processingUserGesture): + * bindings/js/JSDOMWindowCustom.cpp: + (WebCore::domWindowAllowPopUp): + (WebCore::JSDOMWindow::open): + (WebCore::JSDOMWindow::showModalDialog): + * bindings/js/JSDocumentCustom.cpp: + (WebCore::JSDocument::setLocation): + * bindings/js/ScriptController.cpp: + (WebCore::ScriptController::processingUserGesture): + (WebCore::ScriptController::processingUserGestureEvent): + (WebCore::ScriptController::anyPageIsProcessingUserGesture): + * bindings/js/ScriptController.h: + * bindings/scripts/CodeGeneratorJS.pm: + * dom/Event.cpp: + (WebCore::Event::isUserEvent): + * dom/Event.h: + * html/HTMLMediaElement.cpp: + (WebCore::HTMLMediaElement::removedFromDocument): + (WebCore::HTMLMediaElement::load): + (WebCore::HTMLMediaElement::play): + (WebCore::HTMLMediaElement::pause): + (WebCore::HTMLMediaElement::beginScrubbing): + (WebCore::HTMLMediaElement::documentDidBecomeActive): + (WebCore::HTMLMediaElement::webkitEnterFullScreen): + * html/HTMLMediaElement.h: + * html/HTMLMediaElement.idl: + * loader/FrameLoader.cpp: + (WebCore::FrameLoader::isProcessingUserGesture): + * loader/MediaDocument.cpp: + (WebCore::MediaDocument::defaultEventHandler): + * page/DOMWindow.cpp: + (WebCore::DOMWindow::allowPopUp): + * rendering/MediaControlElements.cpp: + (WebCore::MediaControlSeekButtonElement::defaultEventHandler): + +2010-02-01 Andreas Kling <andreas.kling@nokia.com> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Use the fallback style on Maemo 5 + + https://bugs.webkit.org/show_bug.cgi?id=34376 + + * platform/qt/RenderThemeQt.cpp: + (WebCore::RenderThemeQt::RenderThemeQt): + (WebCore::RenderThemeQt::fallbackStyle): + (WebCore::RenderThemeQt::qStyle): + (WebCore::RenderThemeQt::setPaletteFromPageClientIfExists): + * platform/qt/RenderThemeQt.h: + +2010-02-01 Kavita Kanetkar <kkanetkar@chromium.org> + + Reviewed by Nate Chapin. + + [V8] Making V8 generated classes' GetTemplate() function public + https://bugs.webkit.org/show_bug.cgi?id=34026 + + * bindings/scripts/CodeGeneratorV8.pm: Generated code need not depend on V8CustomBinding.h, made GetTemplate() signature public. + +2010-02-01 Steve Block <steveblock@google.com> + + Reviewed by Ariya Hidayat. + + Adds V8-specific JNI bridge classes + https://bugs.webkit.org/show_bug.cgi?id=34166 + + This is the V8 equivalent of bridge/jni/jsc/JNIBridgeJSC. + + No new tests, build fix only. + + * Android.v8bindings.mk: Modified. Added JNIBridge.cpp and JNIBridgeV8.cpp + * bridge/Bridge.h: Modified. Added missing include for Noncopyable.h + * bridge/jni/v8/JNIBridgeV8.cpp: Added. + (JavaField::JavaField): + * bridge/jni/v8/JNIBridgeV8.h: Added. + (JSC::Bindings::JavaField::name): + (JSC::Bindings::JavaField::type): + (JSC::Bindings::JavaField::getJNIType): + +2010-02-01 Steve Block <steveblock@google.com> + + Reviewed by Ariya Hidayat. + + Adds V8-specific JNI utility functions. + https://bugs.webkit.org/show_bug.cgi?id=33901 + + This is the V8 equivalent of bridge/jni/jsc/JNIUtilityPrivate. + + No new tests, build fix only. + + * Android.v8bindings.mk: Modified. Add JNIUtilityPrivate.cpp + * bridge/jni/v8/JNIUtilityPrivate.cpp: Added. + (JSC::Bindings::convertNPVariantToJValue): + (JSC::Bindings::convertJValueToNPVariant): + * bridge/jni/v8/JNIUtilityPrivate.h: Added. + +2010-02-01 Steve Block <steveblock@google.com> + + Reviewed by Ariya Hidayat. + + Adds V8 version of JavaClass + https://bugs.webkit.org/show_bug.cgi?id=33898 + + This is the V8 equivalent of bridge/jni/jsc/JavaClassJSC + + No new tests, build fix only. + + * Android.v8bindings.mk: Modified. Added JavaClassV8.cpp + * bridge/jni/v8/JavaClassV8.cpp: Added. + (JavaClass::JavaClass): + (JavaClass::~JavaClass): + (JavaClass::methodsNamed): + (JavaClass::fieldNamed): + * bridge/jni/v8/JavaClassV8.h: Added. + +2010-02-01 Steve Block <steveblock@google.com> + + Reviewed by Ariya Hidayat. + + Adds V8 version of JavaInstance + https://bugs.webkit.org/show_bug.cgi?id=33951 + + This is the V8 equivalent of bridge/jni/jsc/JavaInstanceJSC. + Also fixes a typo in a comment in JavaInstanceJSC.cpp. + + No new tests, build fix only. + + * Android.v8bindings.mk: Modified. Added JavaInstanceV8.cpp + * bridge/jni/jsc/JavaInstanceJSC.cpp: Modified. + (JavaInstance::invokeMethod): Modified. Fixed comment + * bridge/jni/v8/JavaInstanceV8.cpp: Added. + (JavaInstance::JavaInstance): + (JavaInstance::~JavaInstance): + (JavaInstance::getClass): + (JavaInstance::invokeMethod): + (JObjectWrapper::JObjectWrapper): + (JObjectWrapper::~JObjectWrapper): + * bridge/jni/v8/JavaInstanceV8.h: Added. + (JSC::Bindings::JObjectWrapper::instance): + (JSC::Bindings::JObjectWrapper::setInstance): + (JSC::Bindings::JObjectWrapper::ref): + (JSC::Bindings::JObjectWrapper::deref): + (JSC::Bindings::JavaInstance::javaInstance): + (JSC::Bindings::JavaInstance::begin): + (JSC::Bindings::JavaInstance::end): + (JSC::Bindings::JavaInstance::virtualBegin): + (JSC::Bindings::JavaInstance::virtualEnd): + +2010-02-01 Dumitru Daniliuc <dumi@chromium.org> + + Reviewed by Eric Seidel. + + Making sure that all in-progress transactions are rolled back on + the database thread before they're destroyed. Otherwise, + SQLiteTransaction's destructor will try to do a rollback and that + would cause an assertion failure, if the object is not destroyed + on the DB thread. + + https://bugs.webkit.org/show_bug.cgi?id=34152 + + * platform/sql/SQLiteTransaction.cpp: + (WebCore::SQLiteTransaction::stop): + * storage/SQLTransaction.cpp: + (WebCore::SQLTransaction::notifyDatabaseThreadIsShuttingDown): + * storage/SQLTransaction.h: + * storage/SQLTransactionCoordinator.cpp: + (WebCore::SQLTransactionCoordinator::shutdown): + +2010-02-01 Sam Weinig <sam@webkit.org> + + Reviewed by Beth Dakin. + + Fix EXPERIMENTAL_SINGLE_VIEW_MODE build. + + * page/EventHandler.h: + * page/mac/EventHandlerMac.mm: + (WebCore::EventHandler::currentNSEvent): + (WebCore::EventHandler::currentKeyboardEvent): + (WebCore::EventHandler::mouseDown): + (WebCore::EventHandler::mouseDragged): + (WebCore::EventHandler::mouseUp): + (WebCore::EventHandler::mouseMoved): + (WebCore::EventHandler::keyEvent): + (WebCore::EventHandler::wheelEvent): + (WebCore::EventHandler::sendContextMenuEvent): + (WebCore::EventHandler::eventMayStartDrag): + (WebCore::EventHandler::sendFakeEventsAfterWidgetTracking): + +2010-02-01 Nate Chapin <japhet@chromium.org> + + Unreviewed, Chromium build fix. + + Failed to properly add new files for http://trac.webkit.org/changeset/54150. + + * bindings/v8/custom/V8BarInfoCustom.cpp: Added. + * bindings/v8/custom/V8CSSRuleCustom.cpp: Added. + * bindings/v8/custom/V8CSSStyleSheetCustom.cpp: Added. + * bindings/v8/custom/V8CSSValueCustom.cpp: Added. + * bindings/v8/custom/V8CanvasPixelArrayCustom.cpp: Added. + * bindings/v8/custom/V8DOMSelectionCustom.cpp: Added. + * bindings/v8/custom/V8HTMLElementCustom.cpp: Added. + * bindings/v8/custom/V8SVGDocumentCustom.cpp: Added. + * bindings/v8/custom/V8SVGElementCustom.cpp: Added. + * bindings/v8/custom/V8SVGPathSegCustom.cpp: Added. + * bindings/v8/custom/V8ScreenCustom.cpp: Added. + * bindings/v8/custom/V8StyleSheetCustom.cpp: Added. + * bindings/v8/custom/V8WebGLArrayCustom.cpp: Added. + +2010-01-27 Matt Perry <mpcomplete@chromium.org> + + Reviewed by Eric Seidel. + + Add support for addUserScript to chromium port. + + * bindings/v8/ScriptController.cpp: + (WebCore::ScriptController::evaluateInWorld): + * bindings/v8/ScriptController.h: + +2010-02-01 Eric Carlson <eric.carlson@apple.com> + + Reviewed by Dan Bernstein. + + https://bugs.webkit.org/show_bug.cgi?id=34448 + <rdar://problem/7598130> + + RenderVideo::intrinsicSizeChanged infinite recursion + + * rendering/RenderImage.h: + (WebCore::RenderImage::intrinsicSizeChanged): Make protected instead of private so it can + be called by RenderVideo. + * rendering/RenderVideo.cpp: + (WebCore::RenderVideo::intrinsicSizeChanged): Call RenderMedia::intrinsicSizeChanged, not + RenderVideo::intrinsicSizeChanged. + (WebCore::RenderVideo::imageChanged): Call RenderMedia::imageChanged instead of + RenderImage::imageChanged. + +2010-02-01 Nate Chapin <japhet@chromium.org> + + Reviewed by Dimitri Glazkov. + + [V8] Generate toV8() converter for most WebCore->V8 conversions, + and defined custom converters in their respective V8<class>Custom.cpp. + + Old converters in V8DOMWrapper will be deleted in a later patch. + + https://bugs.webkit.org/show_bug.cgi?id=32563 + + * Android.v8bindings.mk: + * WebCore.gyp/WebCore.gyp: + * WebCore.gypi: + * bindings/scripts/CodeGeneratorV8.pm: + * bindings/v8/V8Collection.h: + * bindings/v8/V8DOMWrapper.cpp: + * bindings/v8/V8DOMWrapper.h: + * bindings/v8/V8Proxy.h: + * bindings/v8/custom/V8BarInfoCustom.cpp: Added. + * bindings/v8/custom/V8CSSRuleCustom.cpp: Added. + * bindings/v8/custom/V8CSSStyleSheetCustom.cpp: Added. + * bindings/v8/custom/V8CSSValueCustom.cpp: Added. + * bindings/v8/custom/V8CanvasPixelArrayCustom.cpp: Added. + * bindings/v8/custom/V8CanvasRenderingContext2DCustom.cpp: + * bindings/v8/custom/V8ConsoleCustom.cpp: + * bindings/v8/custom/V8DOMSelectionCustom.cpp: Added. + * bindings/v8/custom/V8DOMWindowCustom.cpp: + * bindings/v8/custom/V8DocumentCustom.cpp: + * bindings/v8/custom/V8ElementCustom.cpp: + * bindings/v8/custom/V8EventCustom.cpp: + * bindings/v8/custom/V8HTMLDocumentCustom.cpp: + * bindings/v8/custom/V8HTMLElementCustom.cpp: Added. + * bindings/v8/custom/V8HTMLSelectElementCustom.cpp: + * bindings/v8/custom/V8HistoryCustom.cpp: + * bindings/v8/custom/V8LocationCustom.cpp: + * bindings/v8/custom/V8NamedNodeMapCustom.cpp: + * bindings/v8/custom/V8NavigatorCustom.cpp: + * bindings/v8/custom/V8NodeCustom.cpp: + * bindings/v8/custom/V8SVGDocumentCustom.cpp: Added. + * bindings/v8/custom/V8SVGElementCustom.cpp: Added. + * bindings/v8/custom/V8SVGPathSegCustom.cpp: Added. + * bindings/v8/custom/V8ScreenCustom.cpp: Added. + * bindings/v8/custom/V8StyleSheetCustom.cpp: Added. + * bindings/v8/custom/V8TreeWalkerCustom.cpp: + * bindings/v8/custom/V8WebGLArrayCustom.cpp: Added. + * bindings/v8/custom/V8WebGLByteArrayCustom.cpp: + * bindings/v8/custom/V8WebGLFloatArrayCustom.cpp: + * bindings/v8/custom/V8WebGLIntArrayCustom.cpp: + * bindings/v8/custom/V8WebGLRenderingContextCustom.cpp: + * bindings/v8/custom/V8WebGLShortArrayCustom.cpp: + * bindings/v8/custom/V8WebGLUnsignedByteArrayCustom.cpp: + * bindings/v8/custom/V8WebGLUnsignedIntArrayCustom.cpp: + * bindings/v8/custom/V8WebGLUnsignedShortArrayCustom.cpp: + * dom/make_names.pl: Add options to generate wrapper factory for V8 bindings. + +2010-02-01 Alexander Pavlov <apavlov@chromium.org> + + Reviewed by Pavel Feldman. + + Web Inspector: lazy-load textual resources to avoid UI hangup + https://bugs.webkit.org/show_bug.cgi?id=34332 + + * inspector/front-end/ResourceView.js: + (WebInspector.ResourceView.prototype._innerSelectContentTab): + * inspector/front-end/SourceView.js: + (WebInspector.SourceView.prototype.show): + (WebInspector.SourceView.prototype.contentTabSelected): + +2010-02-01 Brady Eidson <beidson@apple.com> + + Reviewed by Adele Peterson. + + Crash in Safari opening new tabs to "same page" + <rdar://problem/7593857> and https://bugs.webkit.org/show_bug.cgi?id=34444 + + Test: fast/loader/crash-copying-backforwardlist.html + + * loader/FrameLoader.cpp: + (WebCore::FrameLoader::loadItem): Null check currentItem(). + + * page/Page.cpp: + (WebCore::Page::goToItem): Ditto. + +2010-02-01 Kevin Watters <kevinwatters@gmail.com> + + Reviewed by Kevin Ollivier. + + [wx] Remove unused file that doesn't seem to belong to the port. + + https://bugs.webkit.org/show_bug.cgi?id=34445 + + * platform/wx/KeyEventWin.cpp: Removed. + +2010-02-01 Eric Carlson <eric.carlson@apple.com> + + Reviewed by Adele Peterson. + + Fullscreen API should be on HTMLVideoElement + https://bugs.webkit.org/show_bug.cgi?id=34438 + + Move fullscreen DOM APIs from HTMLMediaElement to HTMLVideoElement. + + * html/HTMLMediaElement.cpp: + * html/HTMLMediaElement.h: + * html/HTMLMediaElement.idl: + * html/HTMLVideoElement.cpp: + (WebCore::HTMLVideoElement::paint): Removed outdated FIXME. + (WebCore::HTMLVideoElement::paintCurrentFrameInContext): Ditto. + (WebCore::HTMLVideoElement::webkitEnterFullScreen): Moved from HTMLMediaElement. + (WebCore::HTMLVideoElement::webkitExitFullScreen): Ditto. + (WebCore::HTMLVideoElement::webkitSupportsFullscreen): Ditto. + (WebCore::HTMLVideoElement::webkitDisplayingFullscreen): Ditto. + * html/HTMLVideoElement.h: + * html/HTMLVideoElement.idl: + +2010-02-01 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Timothy Hatcher. + + Web Inspector: Syntax highlighting in source view of + Resources pane stops half-way. + + There were two problems here: (1) styles for html highlighter were not + added into the css file (they used to be injected manually in the + SourceFrame before). (2) 'Tag' needed to be lexer's state, not parser's. + Otherwise unbalanced quotes in the text nodes were matching too match + into the string tokens. + + https://bugs.webkit.org/show_bug.cgi?id=34359 + + * inspector/front-end/NativeTextViewer.js: + (WebInspector.NativeTextViewer.prototype._createLineDivs): + (WebInspector.NativeTextViewer.prototype._lineHeight): + (WebInspector.NativeTextViewer.prototype.initFontMetrics): + * inspector/front-end/SourceFrame.js: + (WebInspector.SourceFrame.prototype._createEditorIfNeeded): + * inspector/front-end/SourceHTMLTokenizer.js: + (WebInspector.SourceHTMLTokenizer): + (WebInspector.SourceHTMLTokenizer.prototype.nextToken): + * inspector/front-end/SourceHTMLTokenizer.re2js: + * inspector/front-end/TextEditor.js: + (WebInspector.TextEditor.prototype.initFontMetrics): + (WebInspector.TextEditor.prototype._registerShortcuts): + * inspector/front-end/inspectorSyntaxHighlight.css: + +2010-02-01 Ben Murdoch <benm@google.com> + + Reviewed by Darin Adler. + + ScriptCallFrame's do not get line numbers/source id's if the caller is unkown. + https://bugs.webkit.org/show_bug.cgi?id=34335 + + * bindings/js/ScriptCallStack.cpp: + (WebCore::ScriptCallStack::ScriptCallStack): If the caller is unknown, the line number and source information is still availble so pass it to the ScriptCallFrame being constructed. + +2010-02-01 Dirk Schulze <krit@webkit.org> + + Reviewed by Simon Fraser. + + Add back an AffineTransform class for use by SVG + https://bugs.webkit.org/show_bug.cgi?id=33750 + + These are the first steps on reimplementing AffineTransform. Unlike + the old affine code, this one is platform independent like TransformationMatrix. + AffineTransform has the benefit, that it stores just 6 doubles instead of + 16 in TransformationMatrix. The calculations of transformations are not that + complex and can improve the memory usage and speed of SVG. + AffineTransform can be used by HTML Canvas3D or SVG, since they are 2D related (at + least for the moment). + HTML Canvas is the first that makes use of the new AffineTransform. Next patches + will introduce the affine code to SVG. + + No new tests. The new AffineTransformation code is tested by fast/canvas. + + * Android.mk: + * GNUmakefile.am: + * WebCore.gypi: + * WebCore.pro: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * html/canvas/CanvasRenderingContext2D.cpp: + (WebCore::CanvasRenderingContext2D::scale): + (WebCore::CanvasRenderingContext2D::rotate): + (WebCore::CanvasRenderingContext2D::translate): + (WebCore::CanvasRenderingContext2D::transform): + (WebCore::CanvasRenderingContext2D::setTransform): + (WebCore::CanvasRenderingContext2D::isPointInPath): + (WebCore::CanvasRenderingContext2D::willDraw): + * html/canvas/CanvasRenderingContext2D.h: + * platform/graphics/GraphicsContext.h: + * platform/graphics/Path.h: + * platform/graphics/cairo/GraphicsContextCairo.cpp: + (WebCore::GraphicsContext::getAffineCTM): + (WebCore::GraphicsContext::concatCTM): + * platform/graphics/cairo/GraphicsContextPlatformPrivateCairo.h: + (WebCore::GraphicsContextPlatformPrivate::concatCTM): + * platform/graphics/cairo/PathCairo.cpp: + (WebCore::Path::transform): + * platform/graphics/cairo/TransformationMatrixCairo.cpp: + (WebCore::AffineTransform::operator cairo_matrix_t): + * platform/graphics/cg/GraphicsContextCG.cpp: + (WebCore::GraphicsContext::concatCTM): + (WebCore::GraphicsContext::getAffineCTM): + * platform/graphics/cg/GraphicsContextPlatformPrivateCG.h: + (WebCore::GraphicsContextPlatformPrivate::concatCTM): + * platform/graphics/cg/PathCG.cpp: + (WebCore::Path::transform): + * platform/graphics/cg/TransformationMatrixCG.cpp: + (WebCore::AffineTransform::operator CGAffineTransform): + * platform/graphics/haiku/GraphicsContextHaiku.cpp: + (WebCore::GraphicsContext::getAffineCTM): + (WebCore::GraphicsContext::concatCTM): + * platform/graphics/haiku/PathHaiku.cpp: + (WebCore::Path::transform): + * platform/graphics/qt/GraphicsContextQt.cpp: + (WebCore::GraphicsContext::getAffineCTM): + (WebCore::GraphicsContext::concatCTM): + * platform/graphics/qt/PathQt.cpp: + (WebCore::Path::transform): + * platform/graphics/qt/TransformationMatrixQt.cpp: + (WebCore::AffineTransform::operator QTransform): + * platform/graphics/skia/GraphicsContextSkia.cpp: + (WebCore::GraphicsContext::concatCTM): + (WebCore::GraphicsContext::getAffineCTM): + * platform/graphics/skia/PathSkia.cpp: + (WebCore::Path::transform): + * platform/graphics/skia/TransformationMatrixSkia.cpp: + (WebCore::AffineTransform::operator SkMatrix): + * platform/graphics/transforms/AffineTransform.cpp: Added. + (WebCore::affineTransformDecompose): + (WebCore::affineTransformCompose): + (WebCore::AffineTransform::AffineTransform): + (WebCore::AffineTransform::reset): + (WebCore::AffineTransform::setMatrix): + (WebCore::AffineTransform::isIdentity): + (WebCore::AffineTransform::det): + (WebCore::AffineTransform::isInvertible): + (WebCore::AffineTransform::inverse): + (WebCore::AffineTransform::multiply): + (WebCore::AffineTransform::multLeft): + (WebCore::AffineTransform::rotate): + (WebCore::AffineTransform::scale): + (WebCore::AffineTransform::translate): + (WebCore::AffineTransform::scaleNonUniform): + (WebCore::AffineTransform::rotateFromVector): + (WebCore::AffineTransform::flipX): + (WebCore::AffineTransform::flipY): + (WebCore::AffineTransform::shear): + (WebCore::AffineTransform::skew): + (WebCore::AffineTransform::skewX): + (WebCore::AffineTransform::skewY): + (WebCore::makeMapBetweenRects): + (WebCore::AffineTransform::map): + (WebCore::AffineTransform::mapPoint): + (WebCore::AffineTransform::mapRect): + (WebCore::AffineTransform::blend): + (WebCore::AffineTransform::toTransformationMatrix): + * platform/graphics/transforms/AffineTransform.h: Added. + (WebCore::AffineTransform::a): + (WebCore::AffineTransform::setA): + (WebCore::AffineTransform::b): + (WebCore::AffineTransform::setB): + (WebCore::AffineTransform::c): + (WebCore::AffineTransform::setC): + (WebCore::AffineTransform::d): + (WebCore::AffineTransform::setD): + (WebCore::AffineTransform::e): + (WebCore::AffineTransform::setE): + (WebCore::AffineTransform::f): + (WebCore::AffineTransform::setF): + (WebCore::AffineTransform::operator== ): + (WebCore::AffineTransform::operator!=): + (WebCore::AffineTransform::operator*=): + (WebCore::AffineTransform::operator*): + (WebCore::AffineTransform::setMatrix): + * platform/graphics/win/GraphicsContextWin.cpp: + (WebCore::GraphicsContextPlatformPrivate::concatCTM): + * platform/graphics/wince/GraphicsContextWince.cpp: + (WebCore::GraphicsContext::concatCTM): + (WebCore::GraphicsContext::getAffineCTM): + * platform/graphics/wx/GraphicsContextWx.cpp: + (WebCore::GraphicsContext::getAffineCTM): + (WebCore::GraphicsContext::concatCTM): + * platform/graphics/wx/PathWx.cpp: + (WebCore::Path::transform): + * platform/graphics/wx/TransformationMatrixWx.cpp: + (WebCore::AffineTransform::operator wxGraphicsMatrix): + +2010-01-29 Philippe Normand <pnormand@igalia.com> + + Reviewed by Eric Carlson. + + [GTK] set playbin mute property depending on volume value + https://bugs.webkit.org/show_bug.cgi?id=31586 + + New API in MediaPlayer for mute control. 3 new methods are + introduced: + + - bool supportsMuting() const; + - bool muted() const; + - void setMuted(bool); + + Platform MediaPlayer implementations can support it easily if the + underlying sound daemon/API supports muting (eg. not only setting + volume to 0) like PulseAudio for instance on Linux. At the moment + the only player supporting this new API is the + MediaPlayerPrivateGStreamer. + + * html/HTMLMediaElement.cpp: + (WebCore::HTMLMediaElement::setMuted): + (WebCore::HTMLMediaElement::mediaPlayerVolumeChanged): + (WebCore::HTMLMediaElement::mediaPlayerMuteChanged): + * html/HTMLMediaElement.h: + * platform/graphics/MediaPlayer.cpp: + (WebCore::NullMediaPlayerPrivate::supportsMuting): + (WebCore::NullMediaPlayerPrivate::setMuted): + (WebCore::MediaPlayer::MediaPlayer): + (WebCore::MediaPlayer::muted): + (WebCore::MediaPlayer::supportsMuting): + (WebCore::MediaPlayer::setMuted): + (WebCore::MediaPlayer::volumeChanged): + (WebCore::MediaPlayer::muteChanged): + * platform/graphics/MediaPlayer.h: + (WebCore::MediaPlayerClient::mediaPlayerMuteChanged): + * platform/graphics/MediaPlayerPrivate.h: + (WebCore::MediaPlayerPrivateInterface::supportsMuting): + (WebCore::MediaPlayerPrivateInterface::setMuted): + * platform/graphics/gtk/MediaPlayerPrivateGStreamer.cpp: + (WebCore::mediaPlayerPrivateVolumeChangedCallback): + (WebCore::notifyVolumeIdleCallback): + (WebCore::mediaPlayerPrivateMuteChangedCallback): + (WebCore::notifyMuteIdleCallback): + (WebCore::MediaPlayerPrivate::MediaPlayerPrivate): + (WebCore::MediaPlayerPrivate::~MediaPlayerPrivate): + (WebCore::MediaPlayerPrivate::volumeChangedCallback): + (WebCore::MediaPlayerPrivate::volumeChanged): + (WebCore::MediaPlayerPrivate::supportsMuting): + (WebCore::MediaPlayerPrivate::setMuted): + (WebCore::MediaPlayerPrivate::muteChangedCallback): + (WebCore::MediaPlayerPrivate::muteChanged): + (WebCore::MediaPlayerPrivate::createGSTPlayBin): + * platform/graphics/gtk/MediaPlayerPrivateGStreamer.h: + +2010-02-01 Henry Haverinen <henry.haverinen@nokia.com> + + Reviewed by Simon Hausmann. + + [Qt] Build without SSL support is broken + + Added missing #ifdefs for OpenSSL support and one null-pointer + check for the socket. + + https://bugs.webkit.org/show_bug.cgi?id=34416 + + * platform/network/qt/SocketStreamHandlePrivate.h: + * platform/network/qt/SocketStreamHandleQt.cpp: + (WebCore::SocketStreamHandlePrivate::SocketStreamHandlePrivate): + (WebCore::SocketStreamHandlePrivate::send): + +2010-02-01 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Timothy Hatcher. + + Web Inspector: Fix rest of the NativeTextViewer (line numbers, + conditional breakpoints, selection). + + * inspector/front-end/NativeTextViewer.js: + (WebInspector.NativeTextViewer): + (WebInspector.NativeTextViewer.prototype._updatePreferredSize): + (WebInspector.NativeTextViewer.prototype._registerMouseListeners): + (WebInspector.NativeTextViewer.prototype._mouseDown): + (WebInspector.NativeTextViewer.prototype._contextMenu): + (WebInspector.NativeTextViewer.prototype._lineForMouseEvent): + (WebInspector.NativeTextViewer.prototype._lineHeight): + * inspector/front-end/TextEditor.js: + (WebInspector.TextEditor): + (WebInspector.TextEditor.prototype._registerMouseListeners): + (WebInspector.TextEditor.prototype._offsetToLine): + (WebInspector.TextEditor.prototype._lineHeight): + (WebInspector.TextEditor.prototype.reveal): + (WebInspector.TextEditor.prototype._paint): + (WebInspector.TextEditor.prototype._updateDivDecorations): + (WebInspector.TextEditor.prototype._paintSelection): + +2010-02-01 Steve Block <steveblock@google.com> + + Reviewed by Ariya Hidayat. + + Adds implementation of JavaString for V8. + https://bugs.webkit.org/show_bug.cgi?id=33953 + + No new tests, build fix only. + + * bridge/jni/JNIBridge.h: Modified. Include JavaStringV8.h for V8 + * bridge/jni/v8: Added. + * bridge/jni/v8/JavaStringV8.h: Added. + (JSC::Bindings::JavaStringImpl::init): + (JSC::Bindings::JavaStringImpl::UTF8String): + (JSC::Bindings::JavaStringImpl::uchars): + (JSC::Bindings::JavaStringImpl::length): + +2010-02-01 Alex Milowski <alex@milowski.com> + + Reviewed by Darin Adler. + + Added compile time debug support for mathml layout (block boundary & baseline) + + * mathml/RenderMathMLBlock.cpp: + (WebCore::RenderMathMLBlock::stretchToHeight): + (WebCore::RenderMathMLBlock::paint): + * mathml/RenderMathMLBlock.h: + +>>>>>>> webkit.org at r54340 2010-02-01 Philippe Normand <pnormand@igalia.com> Rubber stamped by Xan Lopez. diff --git a/WebCore/GNUmakefile.am b/WebCore/GNUmakefile.am index 7afe8d8..f2dacec 100644 --- a/WebCore/GNUmakefile.am +++ b/WebCore/GNUmakefile.am @@ -484,6 +484,9 @@ webcore_sources += \ WebCore/bindings/js/ScriptInstance.h \ WebCore/bindings/js/ScriptObject.cpp \ WebCore/bindings/js/ScriptObject.h \ + WebCore/bindings/js/ScriptProfile.h \ + WebCore/bindings/js/ScriptProfiler.cpp \ + WebCore/bindings/js/ScriptProfiler.h \ WebCore/bindings/js/ScriptSourceCode.h \ WebCore/bindings/js/ScriptSourceProvider.h \ WebCore/bindings/js/ScriptState.cpp \ @@ -1191,6 +1194,8 @@ webcore_sources += \ WebCore/icu/unicode/uversion.h \ WebCore/inspector/ConsoleMessage.cpp \ WebCore/inspector/ConsoleMessage.h \ + WebCore/inspector/InjectedScript.cpp \ + WebCore/inspector/InjectedScript.h \ WebCore/inspector/InjectedScriptHost.cpp \ WebCore/inspector/InjectedScriptHost.h \ WebCore/inspector/InspectorBackend.cpp \ @@ -1601,6 +1606,8 @@ webcore_sources += \ WebCore/platform/graphics/UnitBezier.h \ WebCore/platform/graphics/WidthIterator.cpp \ WebCore/platform/graphics/WidthIterator.h \ + WebCore/platform/graphics/transforms/AffineTransform.cpp \ + WebCore/platform/graphics/transforms/AffineTransform.h \ WebCore/platform/graphics/transforms/IdentityTransformOperation.h \ WebCore/platform/graphics/transforms/MatrixTransformOperation.cpp \ WebCore/platform/graphics/transforms/MatrixTransformOperation.h \ @@ -2004,6 +2011,8 @@ webcoregtk_sources += \ WebCore/platform/gtk/FileSystemGtk.cpp \ WebCore/platform/gtk/GRefPtrGtk.cpp \ WebCore/platform/gtk/GRefPtrGtk.h \ + WebCore/platform/gtk/GOwnPtrGtk.cpp \ + WebCore/platform/gtk/GOwnPtrGtk.h \ WebCore/platform/gtk/GtkPluginWidget.cpp \ WebCore/platform/gtk/GtkPluginWidget.h \ WebCore/platform/gtk/KURLGtk.cpp \ diff --git a/WebCore/WebCore.Video.exp b/WebCore/WebCore.Video.exp index 57619b4..da79150 100644 --- a/WebCore/WebCore.Video.exp +++ b/WebCore/WebCore.Video.exp @@ -3,13 +3,14 @@ __ZN7WebCore16HTMLMediaElement12endScrubbingEv __ZN7WebCore16HTMLMediaElement14beginScrubbingEv __ZN7WebCore16HTMLMediaElement14exitFullscreenEv __ZN7WebCore16HTMLMediaElement14setCurrentTimeEfRi -__ZN7WebCore16HTMLMediaElement4playEv -__ZN7WebCore16HTMLMediaElement5pauseEv +__ZN7WebCore16HTMLMediaElement4playEb +__ZN7WebCore16HTMLMediaElement5pauseEb __ZN7WebCore16HTMLMediaElement6rewindEf __ZN7WebCore16HTMLMediaElement8setMutedEb __ZN7WebCore16HTMLMediaElement9setVolumeEfRi __ZNK7WebCore16HTMLMediaElement11currentTimeEv __ZNK7WebCore16HTMLMediaElement13platformMediaEv +__ZNK7WebCore16HTMLMediaElement21processingUserGestureEv __ZNK7WebCore16HTMLMediaElement5mutedEv __ZNK7WebCore16HTMLMediaElement6volumeEv __ZNK7WebCore16HTMLMediaElement7canPlayEv diff --git a/WebCore/WebCore.base.exp b/WebCore/WebCore.base.exp index 5b013e7..fbab12e 100644 --- a/WebCore/WebCore.base.exp +++ b/WebCore/WebCore.base.exp @@ -249,6 +249,7 @@ __ZN7WebCore12IconDatabase4openERKNS_6StringE __ZN7WebCore12IconDatabase5closeEv __ZN7WebCore12IconDatabase9setClientEPNS_18IconDatabaseClientE __ZN7WebCore12PluginWidget14invalidateRectERKNS_7IntRectE +__ZN7WebCore12PrintContext20pageNumberForElementEPNS_7ElementERKNS_9FloatSizeE __ZN7WebCore12RenderObject16repaintRectangleERKNS_7IntRectEb __ZN7WebCore12RenderWidget19showSubstituteImageEN3WTF10PassRefPtrINS_5ImageEEE __ZN7WebCore12SchedulePairC1EP9NSRunLoopPK10__CFString diff --git a/WebCore/WebCore.gyp/WebCore.gyp b/WebCore/WebCore.gyp/WebCore.gyp index 184990a..e40da56 100644 --- a/WebCore/WebCore.gyp/WebCore.gyp +++ b/WebCore/WebCore.gyp/WebCore.gyp @@ -302,9 +302,8 @@ '<(SHARED_INTERMEDIATE_DIR)/webkit/HTMLNames.cpp', '<(SHARED_INTERMEDIATE_DIR)/webkit/HTMLNames.h', '<(SHARED_INTERMEDIATE_DIR)/webkit/HTMLElementFactory.cpp', - # Pass --wrapperFactory to make_names to get these (JSC build?) - #'<(SHARED_INTERMEDIATE_DIR)/webkit/JSHTMLElementWrapperFactory.cpp', - #'<(SHARED_INTERMEDIATE_DIR)/webkit/JSHTMLElementWrapperFactory.h', + '<(SHARED_INTERMEDIATE_DIR)/webkit/V8HTMLElementWrapperFactory.cpp', + '<(SHARED_INTERMEDIATE_DIR)/webkit/V8HTMLElementWrapperFactory.h', ], 'action': [ 'python', @@ -314,6 +313,7 @@ '<@(_inputs)', '--', '--factory', + '--wrapperFactoryV8', '--extraDefines', '<(feature_defines)' ], }, @@ -329,9 +329,8 @@ '<(SHARED_INTERMEDIATE_DIR)/webkit/SVGNames.h', '<(SHARED_INTERMEDIATE_DIR)/webkit/SVGElementFactory.cpp', '<(SHARED_INTERMEDIATE_DIR)/webkit/SVGElementFactory.h', - # Pass --wrapperFactory to make_names to get these (JSC build?) - #'<(SHARED_INTERMEDIATE_DIR)/webkit/JSSVGElementWrapperFactory.cpp', - #'<(SHARED_INTERMEDIATE_DIR)/webkit/JSSVGElementWrapperFactory.h', + '<(SHARED_INTERMEDIATE_DIR)/webkit/V8SVGElementWrapperFactory.cpp', + '<(SHARED_INTERMEDIATE_DIR)/webkit/V8SVGElementWrapperFactory.h', ], 'action': [ 'python', @@ -341,6 +340,7 @@ '<@(_inputs)', '--', '--factory', + '--wrapperFactoryV8', '--extraDefines', '<(feature_defines)' ], }, @@ -586,6 +586,8 @@ '<(SHARED_INTERMEDIATE_DIR)/webkit/SVGElementFactory.cpp', '<(SHARED_INTERMEDIATE_DIR)/webkit/SVGNames.cpp', '<(SHARED_INTERMEDIATE_DIR)/webkit/UserAgentStyleSheetsData.cpp', + '<(SHARED_INTERMEDIATE_DIR)/webkit/V8HTMLElementWrapperFactory.cpp', + '<(SHARED_INTERMEDIATE_DIR)/webkit/V8SVGElementWrapperFactory.cpp', '<(SHARED_INTERMEDIATE_DIR)/webkit/XLinkNames.cpp', '<(SHARED_INTERMEDIATE_DIR)/webkit/XMLNSNames.cpp', '<(SHARED_INTERMEDIATE_DIR)/webkit/XMLNames.cpp', diff --git a/WebCore/WebCore.gypi b/WebCore/WebCore.gypi index c4f64c7..8291811 100644 --- a/WebCore/WebCore.gypi +++ b/WebCore/WebCore.gypi @@ -654,7 +654,10 @@ 'bindings/v8/ChildThreadDOMData.h', 'bindings/v8/custom/V8AbstractWorkerCustom.cpp', 'bindings/v8/custom/V8AttrCustom.cpp', + 'bindings/v8/custom/V8BarInfoCustom.cpp', + 'bindings/v8/custom/V8CanvasPixelArrayCustom.cpp', 'bindings/v8/custom/V8WebGLArrayCustom.h', + 'bindings/v8/custom/V8WebGLArrayCustom.cpp', 'bindings/v8/custom/V8WebGLArrayBufferCustom.cpp', 'bindings/v8/custom/V8WebGLByteArrayCustom.cpp', 'bindings/v8/custom/V8WebGLIntArrayCustom.cpp', @@ -667,8 +670,10 @@ 'bindings/v8/custom/V8WebGLRenderingContextCustom.cpp', 'bindings/v8/custom/V8ClipboardCustom.cpp', 'bindings/v8/custom/V8CoordinatesCustom.cpp', + 'bindings/v8/custom/V8CSSRuleCustom.cpp', 'bindings/v8/custom/V8CSSStyleDeclarationCustom.cpp', - 'bindings/v8/custom/V8ConsoleCustom.cpp', + 'bindings/v8/custom/V8CSSStyleSheetCustom.cpp', + 'bindings/v8/custom/V8CSSValueCustom.cpp', 'bindings/v8/custom/V8CustomBinding.h', 'bindings/v8/custom/V8CustomEventListener.cpp', 'bindings/v8/custom/V8CustomEventListener.h', @@ -693,6 +698,7 @@ 'bindings/v8/custom/V8DedicatedWorkerContextCustom.cpp', 'bindings/v8/custom/V8DocumentLocationCustom.cpp', 'bindings/v8/custom/V8DOMApplicationCacheCustom.cpp', + 'bindings/v8/custom/V8DOMSelectionCustom.cpp', 'bindings/v8/custom/V8DOMWindowCustom.cpp', 'bindings/v8/custom/V8DocumentCustom.cpp', 'bindings/v8/custom/V8ElementCustom.cpp', @@ -708,6 +714,7 @@ 'bindings/v8/custom/V8HTMLCollectionCustom.cpp', 'bindings/v8/custom/V8HTMLDataGridElementCustom.cpp', 'bindings/v8/custom/V8HTMLDocumentCustom.cpp', + 'bindings/v8/custom/V8HTMLElementCustom.cpp', 'bindings/v8/custom/V8HTMLFormElementCustom.cpp', 'bindings/v8/custom/V8HTMLFrameElementCustom.cpp', 'bindings/v8/custom/V8HTMLFrameSetElementCustom.cpp', @@ -743,10 +750,15 @@ 'bindings/v8/custom/V8StorageCustom.cpp', 'bindings/v8/custom/V8SQLResultSetRowListCustom.cpp', 'bindings/v8/custom/V8SQLTransactionCustom.cpp', + 'bindings/v8/custom/V8SVGDocumentCustom.cpp', + 'bindings/v8/custom/V8SVGElementCustom.cpp', 'bindings/v8/custom/V8SVGElementInstanceCustom.cpp', 'bindings/v8/custom/V8SVGLengthCustom.cpp', 'bindings/v8/custom/V8SVGMatrixCustom.cpp', + 'bindings/v8/custom/V8SVGPathSegCustom.cpp', + 'bindings/v8/custom/V8ScreenCustom.cpp', 'bindings/v8/custom/V8SharedWorkerCustom.cpp', + 'bindings/v8/custom/V8StyleSheetCustom.cpp', 'bindings/v8/custom/V8StyleSheetListCustom.cpp', 'bindings/v8/custom/V8TreeWalkerCustom.cpp', 'bindings/v8/custom/V8WebKitCSSMatrixConstructor.cpp', @@ -797,6 +809,9 @@ 'bindings/v8/ScriptInstance.h', 'bindings/v8/ScriptObject.cpp', 'bindings/v8/ScriptObject.h', + 'bindings/v8/ScriptProfile.h', + 'bindings/v8/ScriptProfiler.cpp', + 'bindings/v8/ScriptProfiler.h', 'bindings/v8/ScriptScope.cpp', 'bindings/v8/ScriptScope.h', 'bindings/v8/ScriptSourceCode.h', @@ -1566,6 +1581,8 @@ 'inspector/InspectorClient.h', 'inspector/ConsoleMessage.cpp', 'inspector/ConsoleMessage.h', + 'inspector/InjectedScript.cpp', + 'inspector/InjectedScript.h', 'inspector/InjectedScriptHost.cpp', 'inspector/InjectedScriptHost.h', 'inspector/InspectorBackend.cpp', @@ -2136,6 +2153,8 @@ 'platform/graphics/skia/SkiaUtils.cpp', 'platform/graphics/skia/SkiaUtils.h', 'platform/graphics/skia/TransformationMatrixSkia.cpp', + 'platform/graphics/transforms/AffineTransform.cpp', + 'platform/graphics/transforms/AffineTransform.h', 'platform/graphics/transforms/IdentityTransformOperation.h', 'platform/graphics/transforms/Matrix3DTransformOperation.cpp', 'platform/graphics/transforms/Matrix3DTransformOperation.h', diff --git a/WebCore/WebCore.pro b/WebCore/WebCore.pro index d7a8c79..be4244d 100644 --- a/WebCore/WebCore.pro +++ b/WebCore/WebCore.pro @@ -346,6 +346,7 @@ SOURCES += \ bindings/js/ScriptEventListener.cpp \ bindings/js/ScriptFunctionCall.cpp \ bindings/js/ScriptObject.cpp \ + bindings/js/ScriptProfiler.cpp \ bindings/js/ScriptState.cpp \ bindings/js/ScriptValue.cpp \ bindings/js/ScheduledAction.cpp \ @@ -663,6 +664,7 @@ SOURCES += \ html/PreloadScanner.cpp \ html/ValidityState.cpp \ inspector/ConsoleMessage.cpp \ + inspector/InjectedScript.cpp \ inspector/InjectedScriptHost.cpp \ inspector/InspectorBackend.cpp \ inspector/InspectorController.cpp \ @@ -804,6 +806,7 @@ SOURCES += \ platform/graphics/Pen.cpp \ platform/graphics/SegmentedFontData.cpp \ platform/graphics/SimpleFontData.cpp \ + platform/graphics/transforms/AffineTransform.cpp \ platform/graphics/transforms/TransformationMatrix.cpp \ platform/graphics/transforms/MatrixTransformOperation.cpp \ platform/graphics/transforms/Matrix3DTransformOperation.cpp \ @@ -1353,6 +1356,7 @@ HEADERS += \ html/TimeRanges.h \ html/ValidityState.h \ inspector/ConsoleMessage.h \ + inspector/InjectedScript.h \ inspector/InjectedScriptHost.h \ inspector/InspectorBackend.h \ inspector/InspectorController.h \ @@ -2660,7 +2664,19 @@ SOURCES += \ include($$PWD/../WebKit/qt/Api/headers.pri) HEADERS += $$WEBKIT_API_HEADERS -!CONFIG(standalone_package) { +CONFIG(standalone_package) { + + !symbian { + target.path = $$[QT_INSTALL_LIBS] + INSTALLS += target + } + + include($$PWD/../include/QtWebKit/headers.pri) + headers.files = $$SYNCQT.HEADER_FILES $$SYNCQT.HEADER_CLASSES + headers.path = $$[QT_INSTALL_HEADERS]/QtWebKit + INSTALLS += headers + +} else { target.path = $$[QT_INSTALL_LIBS] headers.files = $$WEBKIT_API_HEADERS headers.path = $$[QT_INSTALL_HEADERS]/QtWebKit diff --git a/WebCore/WebCore.vcproj/MigrateIDLAndScripts b/WebCore/WebCore.vcproj/MigrateIDLAndScripts deleted file mode 100644 index ee5d02d..0000000 --- a/WebCore/WebCore.vcproj/MigrateIDLAndScripts +++ /dev/null @@ -1,164 +0,0 @@ -# Copyright (C) 2007 Apple Inc. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# 3. Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE 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 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. - -.PHONY : all -all : \ - $(WEBKIT_OUTPUT)/Node.idl \ - $(WEBKIT_OUTPUT)/Attr.idl \ - $(WEBKIT_OUTPUT)/Element.idl \ - $(WEBKIT_OUTPUT)/NodeList.idl \ - $(WEBKIT_OUTPUT)/Document.idl \ - $(WEBKIT_OUTPUT)/CharacterData.idl \ - $(WEBKIT_OUTPUT)/CDATASection.idl \ - $(WEBKIT_OUTPUT)/Comment.idl \ - $(WEBKIT_OUTPUT)/Text.idl \ - $(WEBKIT_OUTPUT)/DocumentFragment.idl \ - $(WEBKIT_OUTPUT)/DocumentType.idl \ - $(WEBKIT_OUTPUT)/DOMImplementation.idl \ - $(WEBKIT_OUTPUT)/Entity.idl \ - $(WEBKIT_OUTPUT)/EntityReference.idl \ - $(WEBKIT_OUTPUT)/NamedNodeMap.idl \ - $(WEBKIT_OUTPUT)/Notation.idl \ - $(WEBKIT_OUTPUT)/ProcessingInstruction.idl \ - \ - $(WEBKIT_OUTPUT)/HTMLAnchorElement.idl \ - $(WEBKIT_OUTPUT)/HTMLAppletElement.idl \ - $(WEBKIT_OUTPUT)/HTMLAreaElement.idl \ - $(WEBKIT_OUTPUT)/HTMLBRElement.idl \ - $(WEBKIT_OUTPUT)/HTMLBaseElement.idl \ - $(WEBKIT_OUTPUT)/HTMLBaseFontElement.idl \ - $(WEBKIT_OUTPUT)/HTMLBlockquoteElement.idl \ - $(WEBKIT_OUTPUT)/HTMLBodyElement.idl \ - $(WEBKIT_OUTPUT)/HTMLButtonElement.idl \ - $(WEBKIT_OUTPUT)/HTMLCollection.idl \ - $(WEBKIT_OUTPUT)/HTMLDListElement.idl \ - $(WEBKIT_OUTPUT)/HTMLDirectoryElement.idl \ - $(WEBKIT_OUTPUT)/HTMLDivElement.idl \ - $(WEBKIT_OUTPUT)/HTMLDocument.idl \ - $(WEBKIT_OUTPUT)/HTMLElement.idl \ - $(WEBKIT_OUTPUT)/HTMLEmbedElement.idl \ - $(WEBKIT_OUTPUT)/HTMLFieldSetElement.idl \ - $(WEBKIT_OUTPUT)/HTMLFontElement.idl \ - $(WEBKIT_OUTPUT)/HTMLFormElement.idl \ - $(WEBKIT_OUTPUT)/HTMLFrameElement.idl \ - $(WEBKIT_OUTPUT)/HTMLFrameSetElement.idl \ - $(WEBKIT_OUTPUT)/HTMLHRElement.idl \ - $(WEBKIT_OUTPUT)/HTMLHeadElement.idl \ - $(WEBKIT_OUTPUT)/HTMLHeadingElement.idl \ - $(WEBKIT_OUTPUT)/HTMLHtmlElement.idl \ - $(WEBKIT_OUTPUT)/HTMLIFrameElement.idl \ - $(WEBKIT_OUTPUT)/HTMLImageElement.idl \ - $(WEBKIT_OUTPUT)/HTMLInputElement.idl \ - $(WEBKIT_OUTPUT)/HTMLIsIndexElement.idl \ - $(WEBKIT_OUTPUT)/HTMLLIElement.idl \ - $(WEBKIT_OUTPUT)/HTMLLabelElement.idl \ - $(WEBKIT_OUTPUT)/HTMLLegendElement.idl \ - $(WEBKIT_OUTPUT)/HTMLLinkElement.idl \ - $(WEBKIT_OUTPUT)/HTMLMapElement.idl \ - $(WEBKIT_OUTPUT)/HTMLMarqueeElement.idl \ - $(WEBKIT_OUTPUT)/HTMLMenuElement.idl \ - $(WEBKIT_OUTPUT)/HTMLMetaElement.idl \ - $(WEBKIT_OUTPUT)/HTMLModElement.idl \ - $(WEBKIT_OUTPUT)/HTMLOListElement.idl \ - $(WEBKIT_OUTPUT)/HTMLObjectElement.idl \ - $(WEBKIT_OUTPUT)/HTMLOptGroupElement.idl \ - $(WEBKIT_OUTPUT)/HTMLOptionElement.idl \ - $(WEBKIT_OUTPUT)/HTMLOptionsCollection.idl \ - $(WEBKIT_OUTPUT)/HTMLParagraphElement.idl \ - $(WEBKIT_OUTPUT)/HTMLParamElement.idl \ - $(WEBKIT_OUTPUT)/HTMLPreElement.idl \ - $(WEBKIT_OUTPUT)/HTMLQuoteElement.idl \ - $(WEBKIT_OUTPUT)/HTMLScriptElement.idl \ - $(WEBKIT_OUTPUT)/HTMLSelectElement.idl \ - $(WEBKIT_OUTPUT)/HTMLStyleElement.idl \ - $(WEBKIT_OUTPUT)/HTMLTableCaptionElement.idl \ - $(WEBKIT_OUTPUT)/HTMLTableCellElement.idl \ - $(WEBKIT_OUTPUT)/HTMLTableColElement.idl \ - $(WEBKIT_OUTPUT)/HTMLTableElement.idl \ - $(WEBKIT_OUTPUT)/HTMLTableRowElement.idl \ - $(WEBKIT_OUTPUT)/HTMLTableSectionElement.idl \ - $(WEBKIT_OUTPUT)/HTMLTextAreaElement.idl \ - $(WEBKIT_OUTPUT)/HTMLTitleElement.idl \ - $(WEBKIT_OUTPUT)/HTMLUListElement.idl \ - \ - $(WEBKIT_OUTPUT)/CSSCharsetRule.idl \ - $(WEBKIT_OUTPUT)/CSSFontFaceRule.idl \ - $(WEBKIT_OUTPUT)/CSSImportRule.idl \ - $(WEBKIT_OUTPUT)/CSSMediaRule.idl \ - $(WEBKIT_OUTPUT)/CSSPageRule.idl \ - $(WEBKIT_OUTPUT)/CSSPrimitiveValue.idl \ - $(WEBKIT_OUTPUT)/CSSRule.idl \ - $(WEBKIT_OUTPUT)/CSSRuleList.idl \ - $(WEBKIT_OUTPUT)/CSSStyleDeclaration.idl \ - $(WEBKIT_OUTPUT)/CSSStyleRule.idl \ - $(WEBKIT_OUTPUT)/CSSStyleSheet.idl \ - $(WEBKIT_OUTPUT)/CSSUnknownRule.idl \ - $(WEBKIT_OUTPUT)/CSSValue.idl \ - $(WEBKIT_OUTPUT)/CSSValueList.idl \ - $(WEBKIT_OUTPUT)/Counter.idl \ - $(WEBKIT_OUTPUT)/MediaList.idl \ - $(WEBKIT_OUTPUT)/Rect.idl \ - $(WEBKIT_OUTPUT)/StyleSheet.idl \ - $(WEBKIT_OUTPUT)/StyleSheetList.idl \ - \ - $(WEBKIT_OUTPUT)/Event.idl \ - $(WEBKIT_OUTPUT)/EventTarget.idl \ - $(WEBKIT_OUTPUT)/EventListener.idl \ - \ - $(WEBKIT_OUTPUT)/CodeGenerator.pm \ - $(WEBKIT_OUTPUT)/IDLParser.pm \ - $(WEBKIT_OUTPUT)/IDLStructure.pm \ - $(WEBKIT_OUTPUT)/generate-bindings.pl \ -# - -# $(WEBKIT_OUTPUT)/CanvasGradient.idl \ -# $(WEBKIT_OUTPUT)/CanvasPattern.idl \ -# $(WEBKIT_OUTPUT)/CanvasRenderingContext2D.idl \ -# $(WEBKIT_OUTPUT)/HTMLCanvasElement.idl \ -# $(WEBKIT_OUTPUT)/RGBColor.idl \ - -MIGRATE_CMD = cp $< $@ - -# Migrate core/event IDLs -$(WEBKIT_OUTPUT)/% : $(WEBCORE)/dom/% - $(MIGRATE_CMD) - -# Migrate html IDLs -$(WEBKIT_OUTPUT)/% : $(WEBCORE)/html/% - $(MIGRATE_CMD) - -# Migrate css IDLs -$(WEBKIT_OUTPUT)/% : $(WEBCORE)/css/% - $(MIGRATE_CMD) - -# Migrate workers IDLs -$(WEBKIT_OUTPUT)/% : $(WEBCORE)/workers/% - $(MIGRATE_CMD) - - -# Migrate generation scripts -$(WEBKIT_OUTPUT)/% : $(WEBCORE)/bindings/scripts/% - $(MIGRATE_CMD) diff --git a/WebCore/WebCore.vcproj/MigrateScripts b/WebCore/WebCore.vcproj/MigrateScripts new file mode 100644 index 0000000..d6df830 --- /dev/null +++ b/WebCore/WebCore.vcproj/MigrateScripts @@ -0,0 +1,39 @@ +# Copyright (C) 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE 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 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. + +.PHONY : all +all : \ + $(WEBKIT_OUTPUT)/CodeGenerator.pm \ + $(WEBKIT_OUTPUT)/IDLParser.pm \ + $(WEBKIT_OUTPUT)/IDLStructure.pm \ + $(WEBKIT_OUTPUT)/generate-bindings.pl \ +# + +MIGRATE_CMD = cp $< $@ + +# Migrate generation scripts +$(WEBKIT_OUTPUT)/% : $(WEBCORE)/bindings/scripts/% + $(MIGRATE_CMD) diff --git a/WebCore/WebCore.vcproj/QTMovieWin.rc b/WebCore/WebCore.vcproj/QTMovieWin.rc index 459679b..ee374e1 100644 --- a/WebCore/WebCore.vcproj/QTMovieWin.rc +++ b/WebCore/WebCore.vcproj/QTMovieWin.rc @@ -34,7 +34,7 @@ BEGIN VALUE "FileVersion", __VERSION_TEXT__ VALUE "CompanyName", "Apple Inc." VALUE "InternalName", "WebKit" - VALUE "LegalCopyright", "Copyright Apple Inc. 2007-2010" + VALUE "LegalCopyright", "Copyright Apple Inc. 2007-" __COPYRIGHT_YEAR_END_TEXT__ VALUE "OriginalFilename", "QTMovieWin.dll" VALUE "ProductName", "WebKit" VALUE "ProductVersion", __VERSION_TEXT__ diff --git a/WebCore/WebCore.vcproj/WebCore.make b/WebCore/WebCore.vcproj/WebCore.make index 3a6d697..26ad54f 100644 --- a/WebCore/WebCore.vcproj/WebCore.make +++ b/WebCore/WebCore.vcproj/WebCore.make @@ -12,6 +12,6 @@ install: xcopy "$(OBJROOT)\include\*" "$(DSTROOT)\AppleInternal\include\" /e/v/i/h/y xcopy "$(OBJROOT)\lib\*" "$(DSTROOT)\AppleInternal\lib\" /e/v/i/h/y xcopy "$(OBJROOT)\bin\WebKit.resources\*" "$(DSTROOT)\AppleInternal\bin\WebKit.resources" /e/v/i/h/y - xcopy "$(OBJROOT)\obj\WebKit\DOMInterfaces\*" "$(DSTROOT)\AppleInternal\obj\WebKit\DOMInterfaces" /e/v/i/h/y + xcopy "$(OBJROOT)\obj\WebCore\scripts\*" "$(DSTROOT)\AppleInternal\obj\WebCore\scripts" /e/v/i/h/y xcopy "$(OBJROOT)\bin\*.pdb" "$(DSTROOT)\AppleInternal\bin\" /e/v/i/h/y xcopy "$(OBJROOT)\bin\*.dll" "$(DSTROOT)\AppleInternal\bin\" /e/v/i/h/y diff --git a/WebCore/WebCore.vcproj/WebCore.vcproj b/WebCore/WebCore.vcproj/WebCore.vcproj index aa2a16a..b46e5c1 100644 --- a/WebCore/WebCore.vcproj/WebCore.vcproj +++ b/WebCore/WebCore.vcproj/WebCore.vcproj @@ -20953,6 +20953,14 @@ >
</File>
<File
+ RelativePath="..\page\PrintContext.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\page\PrintContext.h"
+ >
+ </File>
+ <File
RelativePath="..\page\Screen.cpp"
>
</File>
@@ -24127,6 +24135,14 @@ Name="transforms"
>
<File
+ RelativePath="..\platform\graphics\transforms\AffineTransform.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\platform\graphics\transforms\AffineTransform.h"
+ >
+ </File>
+ <File
RelativePath="..\platform\graphics\transforms\IdentityTransformOperation.h"
>
</File>
@@ -42561,6 +42577,14 @@ >
</File>
<File
+ RelativePath="..\inspector\InjectedScript.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\inspector\InjectedScript.h"
+ >
+ </File>
+ <File
RelativePath="..\inspector\InjectedScriptHost.cpp"
>
</File>
diff --git a/WebCore/WebCore.vcproj/WebCoreGenerated.vcproj b/WebCore/WebCore.vcproj/WebCoreGenerated.vcproj index 744fdd0..4315c52 100644 --- a/WebCore/WebCore.vcproj/WebCoreGenerated.vcproj +++ b/WebCore/WebCore.vcproj/WebCoreGenerated.vcproj @@ -22,9 +22,9 @@ >
<Tool
Name="VCNMakeTool"
- BuildCommandLine="%SystemDrive%\cygwin\bin\which.exe bash
if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%
cmd /c
if exist "$(WebKitOutputDir)\buildfailed" grep XX$(ProjectName)XX "$(WebKitOutputDir)\buildfailed"
if errorlevel 1 exit 1
echo XX$(ProjectName)XX > "$(WebKitOutputDir)\buildfailed"

bash build-generated-files.sh "$(WebKitOutputDir)" "$(WebKitLibrariesDir)" windows
bash migrate-idls.sh "$(WebKitOutputDir)/obj/WebKit/DOMInterfaces"

if exist "$(WebKitOutputDir)\buildfailed" del "$(WebKitOutputDir)\buildfailed"
"
- ReBuildCommandLine="echo XX$(ProjectName)XX > "$(WebKitOutputDir)\buildfailed"

del /s /q "$(WebKitOutputDir)\obj\WebCore\DerivedSources"
del /s /q "$(WebKitOutputDir)\obj\WebKit\DOMInterfaces"
%SystemDrive%\cygwin\bin\which.exe bash
if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%
cmd /c
bash build-generated-files.sh "$(WebKitOutputDir)" "$(WebKitLibrariesDir)" windows
bash migrate-idls.sh "$(WebKitOutputDir)/obj/WebKit/DOMInterfaces"

if exist "$(WebKitOutputDir)\buildfailed" del "$(WebKitOutputDir)\buildfailed"
"
- CleanCommandLine="del /s /q "$(WebKitOutputDir)\obj\WebCore\DerivedSources"
del /s /q "$(WebKitOutputDir)\obj\WebKit\DOMInterfaces"
if exist "$(WebKitOutputDir)\buildfailed" del "$(WebKitOutputDir)\buildfailed"
"
+ BuildCommandLine="%SystemDrive%\cygwin\bin\which.exe bash
if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%
cmd /c
if exist "$(WebKitOutputDir)\buildfailed" grep XX$(ProjectName)XX "$(WebKitOutputDir)\buildfailed"
if errorlevel 1 exit 1
echo XX$(ProjectName)XX > "$(WebKitOutputDir)\buildfailed"

bash build-generated-files.sh "$(WebKitOutputDir)" "$(WebKitLibrariesDir)" windows
bash migrate-scripts.sh "$(WebKitOutputDir)/obj/WebCore/scripts"

if exist "$(WebKitOutputDir)\buildfailed" del "$(WebKitOutputDir)\buildfailed"
"
+ ReBuildCommandLine="echo XX$(ProjectName)XX > "$(WebKitOutputDir)\buildfailed"

del /s /q "$(WebKitOutputDir)\obj\WebCore\DerivedSources"
del /s /q "$(WebKitOutputDir)\obj\WebCore\scripts"
%SystemDrive%\cygwin\bin\which.exe bash
if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%
cmd /c
bash build-generated-files.sh "$(WebKitOutputDir)" "$(WebKitLibrariesDir)" windows
bash migrate-scripts.sh "$(WebKitOutputDir)/obj/WebCore/scripts"

if exist "$(WebKitOutputDir)\buildfailed" del "$(WebKitOutputDir)\buildfailed"
"
+ CleanCommandLine="del /s /q "$(WebKitOutputDir)\obj\WebCore\DerivedSources"
del /s /q "$(WebKitOutputDir)\obj\WebCore\scripts"
if exist "$(WebKitOutputDir)\buildfailed" del "$(WebKitOutputDir)\buildfailed"
"
Output=""
PreprocessorDefinitions=""
IncludeSearchPath=""
@@ -42,9 +42,9 @@ >
<Tool
Name="VCNMakeTool"
- BuildCommandLine="%SystemDrive%\cygwin\bin\which.exe bash
if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%
cmd /c
if exist "$(WebKitOutputDir)\buildfailed" grep XX$(ProjectName)XX "$(WebKitOutputDir)\buildfailed"
if errorlevel 1 exit 1
echo XX$(ProjectName)XX > "$(WebKitOutputDir)\buildfailed"

bash build-generated-files.sh "$(WebKitOutputDir)" "$(WebKitLibrariesDir)" cairo
bash migrate-idls.sh "$(WebKitOutputDir)/obj/WebKit/DOMInterfaces"

if exist "$(WebKitOutputDir)\buildfailed" del "$(WebKitOutputDir)\buildfailed"
"
- ReBuildCommandLine="echo XX$(ProjectName)XX > "$(WebKitOutputDir)\buildfailed"

del /s /q "$(WebKitOutputDir)\obj\WebCore\DerivedSources"
del /s /q "$(WebKitOutputDir)\obj\WebKit\DOMInterfaces"
%SystemDrive%\cygwin\bin\which.exe bash
if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%
cmd /c
bash build-generated-files.sh "$(WebKitOutputDir)" "$(WebKitLibrariesDir)" cairo
bash migrate-idls.sh "$(WebKitOutputDir)/obj/WebKit/DOMInterfaces"

if exist "$(WebKitOutputDir)\buildfailed" del "$(WebKitOutputDir)\buildfailed"
"
- CleanCommandLine="del /s /q "$(WebKitOutputDir)\obj\WebCore\DerivedSources"
del /s /q "$(WebKitOutputDir)\obj\WebKit\DOMInterfaces"
if exist "$(WebKitOutputDir)\buildfailed" del "$(WebKitOutputDir)\buildfailed"
"
+ BuildCommandLine="%SystemDrive%\cygwin\bin\which.exe bash
if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%
cmd /c
if exist "$(WebKitOutputDir)\buildfailed" grep XX$(ProjectName)XX "$(WebKitOutputDir)\buildfailed"
if errorlevel 1 exit 1
echo XX$(ProjectName)XX > "$(WebKitOutputDir)\buildfailed"

bash build-generated-files.sh "$(WebKitOutputDir)" "$(WebKitLibrariesDir)" cairo
bash migrate-scripts.sh "$(WebKitOutputDir)/obj/WebCore/scripts"

if exist "$(WebKitOutputDir)\buildfailed" del "$(WebKitOutputDir)\buildfailed"
"
+ ReBuildCommandLine="echo XX$(ProjectName)XX > "$(WebKitOutputDir)\buildfailed"

del /s /q "$(WebKitOutputDir)\obj\WebCore\DerivedSources"
del /s /q "$(WebKitOutputDir)\obj\WebCore\scripts"
%SystemDrive%\cygwin\bin\which.exe bash
if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%
cmd /c
bash build-generated-files.sh "$(WebKitOutputDir)" "$(WebKitLibrariesDir)" cairo
bash migrate-scripts.sh "$(WebKitOutputDir)/obj/WebCore/scripts"

if exist "$(WebKitOutputDir)\buildfailed" del "$(WebKitOutputDir)\buildfailed"
"
+ CleanCommandLine="del /s /q "$(WebKitOutputDir)\obj\WebCore\DerivedSources"
del /s /q "$(WebKitOutputDir)\obj\WebCore\scripts"
if exist "$(WebKitOutputDir)\buildfailed" del "$(WebKitOutputDir)\buildfailed"
"
Output=""
PreprocessorDefinitions=""
IncludeSearchPath=""
diff --git a/WebCore/WebCore.vcproj/migrate-idls.sh b/WebCore/WebCore.vcproj/migrate-scripts.sh index 651f230..ec59154 100644 --- a/WebCore/WebCore.vcproj/migrate-idls.sh +++ b/WebCore/WebCore.vcproj/migrate-scripts.sh @@ -1,6 +1,6 @@ #!/usr/bin/bash -# Copyright (C) 2007 Apple Inc. All rights reserved. +# Copyright (C) 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -55,4 +55,4 @@ export XDSTROOT export WEBCORE=$XSRCROOT export WEBKIT_OUTPUT=$XDSTROOT -make -f "$WEBCORE/WebCore.vcproj/MigrateIDLandScripts" -j ${NUMCPUS} || exit 1 +make -f "$WEBCORE/WebCore.vcproj/MigrateScripts" -j ${NUMCPUS} || exit 1 diff --git a/WebCore/WebCore.xcodeproj/project.pbxproj b/WebCore/WebCore.xcodeproj/project.pbxproj index 5edb6e7..e54897e 100644 --- a/WebCore/WebCore.xcodeproj/project.pbxproj +++ b/WebCore/WebCore.xcodeproj/project.pbxproj @@ -1315,6 +1315,8 @@ 84A81F3E0FC7DFF000955300 /* SourceAlpha.h in Headers */ = {isa = PBXBuildFile; fileRef = 84A81F3C0FC7DFF000955300 /* SourceAlpha.h */; }; 84A81F410FC7E02700955300 /* SourceGraphic.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 84A81F3F0FC7E02700955300 /* SourceGraphic.cpp */; }; 84A81F420FC7E02700955300 /* SourceGraphic.h in Headers */ = {isa = PBXBuildFile; fileRef = 84A81F400FC7E02700955300 /* SourceGraphic.h */; }; + 84D0C4041115F1D40018AA34 /* AffineTransform.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 84D0C4031115F1D40018AA34 /* AffineTransform.cpp */; }; + 84D0C4061115F1EA0018AA34 /* AffineTransform.h in Headers */ = {isa = PBXBuildFile; fileRef = 84D0C4051115F1EA0018AA34 /* AffineTransform.h */; }; 85004D940ACEEAEF00C438F6 /* DOMSVGDefsElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 85004D880ACEEAEF00C438F6 /* DOMSVGDefsElement.h */; }; 85004D950ACEEAEF00C438F6 /* DOMSVGDefsElement.mm in Sources */ = {isa = PBXBuildFile; fileRef = 85004D890ACEEAEF00C438F6 /* DOMSVGDefsElement.mm */; }; 85004D960ACEEAEF00C438F6 /* DOMSVGDescElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 85004D8A0ACEEAEF00C438F6 /* DOMSVGDescElement.h */; }; @@ -2455,6 +2457,9 @@ 97DD4D860FDF4D6E00ECF9A4 /* XSSAuditor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 97DD4D840FDF4D6D00ECF9A4 /* XSSAuditor.cpp */; }; 97DD4D870FDF4D6E00ECF9A4 /* XSSAuditor.h in Headers */ = {isa = PBXBuildFile; fileRef = 97DD4D850FDF4D6E00ECF9A4 /* XSSAuditor.h */; }; 97EF7DFE107E55B700D7C49C /* ScriptControllerBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 97EF7DFD107E55B700D7C49C /* ScriptControllerBase.cpp */; }; + 9F72304F11184B4100AD0126 /* ScriptProfile.h in Headers */ = {isa = PBXBuildFile; fileRef = 9F72304C11184B4100AD0126 /* ScriptProfile.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 9F72305011184B4100AD0126 /* ScriptProfiler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9F72304D11184B4100AD0126 /* ScriptProfiler.cpp */; }; + 9F72305111184B4100AD0126 /* ScriptProfiler.h in Headers */ = {isa = PBXBuildFile; fileRef = 9F72304E11184B4100AD0126 /* ScriptProfiler.h */; settings = {ATTRIBUTES = (Private, ); }; }; A17C81220F2A5CF7005DAAEB /* HTMLElementFactory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A17C81200F2A5CF7005DAAEB /* HTMLElementFactory.cpp */; }; A17C81230F2A5CF7005DAAEB /* HTMLElementFactory.h in Headers */ = {isa = PBXBuildFile; fileRef = A17C81210F2A5CF7005DAAEB /* HTMLElementFactory.h */; }; A718760E0B2A120100A16ECE /* DragActions.h in Headers */ = {isa = PBXBuildFile; fileRef = A718760D0B2A120100A16ECE /* DragActions.h */; settings = {ATTRIBUTES = (Private, ); }; }; @@ -4100,6 +4105,8 @@ B5A684240FFABEAA00D24689 /* SQLiteFileSystem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B5A684230FFABEAA00D24689 /* SQLiteFileSystem.cpp */; }; B5C1123B102B6C4600096578 /* SQLTransactionCoordinator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B5C11239102B6C4600096578 /* SQLTransactionCoordinator.cpp */; }; B5C1123C102B6C4600096578 /* SQLTransactionCoordinator.h in Headers */ = {isa = PBXBuildFile; fileRef = B5C1123A102B6C4600096578 /* SQLTransactionCoordinator.h */; }; + B71FE6DF11091CB300DAEF77 /* PrintContext.h in Headers */ = {isa = PBXBuildFile; fileRef = B776D43A1104525D00BEB0EC /* PrintContext.h */; settings = {ATTRIBUTES = (Private, ); }; }; + B776D43D1104527500BEB0EC /* PrintContext.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B776D43C1104527500BEB0EC /* PrintContext.cpp */; }; BC00F0040E0A185500FD04E3 /* DOMFile.h in Headers */ = {isa = PBXBuildFile; fileRef = BC00EFFE0E0A185500FD04E3 /* DOMFile.h */; }; BC00F0050E0A185500FD04E3 /* DOMFile.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC00EFFF0E0A185500FD04E3 /* DOMFile.mm */; }; BC00F0060E0A185500FD04E3 /* DOMFileInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = BC00F0000E0A185500FD04E3 /* DOMFileInternal.h */; }; @@ -4616,6 +4623,10 @@ BCFE2F120C1B58380020235F /* JSRect.h in Headers */ = {isa = PBXBuildFile; fileRef = BCFE2F100C1B58370020235F /* JSRect.h */; }; BCFF64910EAD15C200C1D6F7 /* LengthBox.h in Headers */ = {isa = PBXBuildFile; fileRef = BCFF648F0EAD15C200C1D6F7 /* LengthBox.h */; settings = {ATTRIBUTES = (Private, ); }; }; BCFF64920EAD15C200C1D6F7 /* LengthSize.h in Headers */ = {isa = PBXBuildFile; fileRef = BCFF64900EAD15C200C1D6F7 /* LengthSize.h */; settings = {ATTRIBUTES = (Private, ); }; }; + C0C054CB1118C8E400CE2636 /* CodeGenerator.pm in Headers */ = {isa = PBXBuildFile; fileRef = 93F8B3050A300FE100F61AB8 /* CodeGenerator.pm */; settings = {ATTRIBUTES = (Private, ); }; }; + C0C054CC1118C8E400CE2636 /* generate-bindings.pl in Headers */ = {isa = PBXBuildFile; fileRef = 93F8B3070A300FEA00F61AB8 /* generate-bindings.pl */; settings = {ATTRIBUTES = (Private, ); }; }; + C0C054CD1118C8E400CE2636 /* IDLParser.pm in Headers */ = {isa = PBXBuildFile; fileRef = 14813BF309EDF88E00F757E1 /* IDLParser.pm */; settings = {ATTRIBUTES = (Private, ); }; }; + C0C054CE1118C8E400CE2636 /* IDLStructure.pm in Headers */ = {isa = PBXBuildFile; fileRef = 93F8B3080A300FEA00F61AB8 /* IDLStructure.pm */; settings = {ATTRIBUTES = (Private, ); }; }; C0DFC8700DB6841A003EAE7C /* JSConsoleCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C0DFC86F0DB6841A003EAE7C /* JSConsoleCustom.cpp */; }; C105DA620F3AA68F001DD44F /* TextEncodingDetectorICU.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C105DA610F3AA68F001DD44F /* TextEncodingDetectorICU.cpp */; }; C105DA640F3AA6B8001DD44F /* TextEncodingDetector.h in Headers */ = {isa = PBXBuildFile; fileRef = C105DA630F3AA6B8001DD44F /* TextEncodingDetector.h */; }; @@ -4805,6 +4816,8 @@ ED501DC60B249F2900AE18D9 /* EditorMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = ED501DC50B249F2900AE18D9 /* EditorMac.mm */; }; EDE3A5000C7A430600956A37 /* ColorMac.h in Headers */ = {isa = PBXBuildFile; fileRef = EDE3A4FF0C7A430600956A37 /* ColorMac.h */; settings = {ATTRIBUTES = (Private, ); }; }; EDEC98030AED7E170059137F /* WebCorePrefix.h in Headers */ = {isa = PBXBuildFile; fileRef = EDEC98020AED7E170059137F /* WebCorePrefix.h */; }; + F3644AFF1119805900E0D537 /* InjectedScript.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F3644AFD1119805900E0D537 /* InjectedScript.cpp */; }; + F3644B001119805900E0D537 /* InjectedScript.h in Headers */ = {isa = PBXBuildFile; fileRef = F3644AFE1119805900E0D537 /* InjectedScript.h */; }; F4EAF4AE10C742B1009100D3 /* OpenTypeSanitizer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F4EAF4AC10C742B1009100D3 /* OpenTypeSanitizer.cpp */; }; F4EAF4AF10C742B1009100D3 /* OpenTypeSanitizer.h in Headers */ = {isa = PBXBuildFile; fileRef = F4EAF4AD10C742B1009100D3 /* OpenTypeSanitizer.h */; }; F5C041DA0FFCA7CE00839D4A /* HTMLDataListElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F5C041D70FFCA7CE00839D4A /* HTMLDataListElement.cpp */; }; @@ -6720,6 +6733,8 @@ 84B2B1F7056BEF3A00D2B771 /* WebCoreKeyGenerator.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebCoreKeyGenerator.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; 84B2B1F8056BEF3A00D2B771 /* WebCoreKeyGenerator.m */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.objc; path = WebCoreKeyGenerator.m; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; 84B2B24F056BF15F00D2B771 /* SSLKeyGeneratorMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = SSLKeyGeneratorMac.mm; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; + 84D0C4031115F1D40018AA34 /* AffineTransform.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = AffineTransform.cpp; path = transforms/AffineTransform.cpp; sourceTree = "<group>"; }; + 84D0C4051115F1EA0018AA34 /* AffineTransform.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AffineTransform.h; path = transforms/AffineTransform.h; sourceTree = "<group>"; }; 85004D880ACEEAEF00C438F6 /* DOMSVGDefsElement.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = DOMSVGDefsElement.h; sourceTree = "<group>"; }; 85004D890ACEEAEF00C438F6 /* DOMSVGDefsElement.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = DOMSVGDefsElement.mm; sourceTree = "<group>"; }; 85004D8A0ACEEAEF00C438F6 /* DOMSVGDescElement.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = DOMSVGDescElement.h; sourceTree = "<group>"; }; @@ -7783,6 +7798,9 @@ 97DD4D840FDF4D6D00ECF9A4 /* XSSAuditor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XSSAuditor.cpp; sourceTree = "<group>"; }; 97DD4D850FDF4D6E00ECF9A4 /* XSSAuditor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XSSAuditor.h; sourceTree = "<group>"; }; 97EF7DFD107E55B700D7C49C /* ScriptControllerBase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScriptControllerBase.cpp; sourceTree = "<group>"; }; + 9F72304C11184B4100AD0126 /* ScriptProfile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptProfile.h; sourceTree = "<group>"; }; + 9F72304D11184B4100AD0126 /* ScriptProfiler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScriptProfiler.cpp; sourceTree = "<group>"; }; + 9F72304E11184B4100AD0126 /* ScriptProfiler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptProfiler.h; sourceTree = "<group>"; }; A17C81200F2A5CF7005DAAEB /* HTMLElementFactory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLElementFactory.cpp; sourceTree = "<group>"; }; A17C81210F2A5CF7005DAAEB /* HTMLElementFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTMLElementFactory.h; sourceTree = "<group>"; }; A718760D0B2A120100A16ECE /* DragActions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DragActions.h; sourceTree = "<group>"; }; @@ -9322,6 +9340,8 @@ B5A684230FFABEAA00D24689 /* SQLiteFileSystem.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SQLiteFileSystem.cpp; path = sql/SQLiteFileSystem.cpp; sourceTree = "<group>"; }; B5C11239102B6C4600096578 /* SQLTransactionCoordinator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SQLTransactionCoordinator.cpp; sourceTree = "<group>"; }; B5C1123A102B6C4600096578 /* SQLTransactionCoordinator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SQLTransactionCoordinator.h; sourceTree = "<group>"; }; + B776D43A1104525D00BEB0EC /* PrintContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PrintContext.h; sourceTree = "<group>"; }; + B776D43C1104527500BEB0EC /* PrintContext.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PrintContext.cpp; sourceTree = "<group>"; }; BC00EFFE0E0A185500FD04E3 /* DOMFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMFile.h; sourceTree = "<group>"; }; BC00EFFF0E0A185500FD04E3 /* DOMFile.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DOMFile.mm; sourceTree = "<group>"; }; BC00F0000E0A185500FD04E3 /* DOMFileInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMFileInternal.h; sourceTree = "<group>"; }; @@ -10079,6 +10099,8 @@ ED501DC50B249F2900AE18D9 /* EditorMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; name = EditorMac.mm; path = mac/EditorMac.mm; sourceTree = "<group>"; }; EDE3A4FF0C7A430600956A37 /* ColorMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ColorMac.h; sourceTree = "<group>"; }; EDEC98020AED7E170059137F /* WebCorePrefix.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = WebCorePrefix.h; sourceTree = "<group>"; tabWidth = 4; usesTabs = 0; }; + F3644AFD1119805900E0D537 /* InjectedScript.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InjectedScript.cpp; sourceTree = "<group>"; }; + F3644AFE1119805900E0D537 /* InjectedScript.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InjectedScript.h; sourceTree = "<group>"; }; F4EAF4AC10C742B1009100D3 /* OpenTypeSanitizer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = OpenTypeSanitizer.cpp; path = opentype/OpenTypeSanitizer.cpp; sourceTree = "<group>"; }; F4EAF4AD10C742B1009100D3 /* OpenTypeSanitizer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OpenTypeSanitizer.h; path = opentype/OpenTypeSanitizer.h; sourceTree = "<group>"; }; F523D23B02DE4396018635CA /* HTMLDocument.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLDocument.cpp; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; @@ -10578,6 +10600,8 @@ 1C81B9590E97330800266E07 /* front-end */, 41F0618D0F5F069800A07EAC /* ConsoleMessage.cpp */, 41F0618C0F5F069800A07EAC /* ConsoleMessage.h */, + F3644AFD1119805900E0D537 /* InjectedScript.cpp */, + F3644AFE1119805900E0D537 /* InjectedScript.h */, 7A0E76F610BF08ED00A0276E /* InjectedScriptHost.cpp */, 7A0E76F710BF08ED00A0276E /* InjectedScriptHost.h */, 7A0E76F810BF08ED00A0276E /* InjectedScriptHost.idl */, @@ -10903,6 +10927,8 @@ 49E911B20EF86D27009D0CAF /* transforms */ = { isa = PBXGroup; children = ( + 84D0C4051115F1EA0018AA34 /* AffineTransform.h */, + 84D0C4031115F1D40018AA34 /* AffineTransform.cpp */, 49E911B50EF86D47009D0CAF /* IdentityTransformOperation.h */, 49D5DC270F423A73008F20FD /* Matrix3DTransformOperation.cpp */, 49D5DC280F423A73008F20FD /* Matrix3DTransformOperation.h */, @@ -11474,6 +11500,8 @@ FE80D7C00E9C1F25000D6F75 /* PositionError.idl */, FE80D7C10E9C1F25000D6F75 /* PositionErrorCallback.h */, FE80D7C30E9C1F25000D6F75 /* PositionOptions.h */, + B776D43C1104527500BEB0EC /* PrintContext.cpp */, + B776D43A1104525D00BEB0EC /* PrintContext.h */, BCEC01BA0C274DAC009F4EC9 /* Screen.cpp */, BCEC01BB0C274DAC009F4EC9 /* Screen.h */, BCEC01BC0C274DAC009F4EC9 /* Screen.idl */, @@ -14611,6 +14639,9 @@ 934CC1160EDCAC7300A658F2 /* ScriptInstance.h */, 41F066E30F64BCF600A07EAC /* ScriptObject.cpp */, 41F066E20F64BCF600A07EAC /* ScriptObject.h */, + 9F72304C11184B4100AD0126 /* ScriptProfile.h */, + 9F72304D11184B4100AD0126 /* ScriptProfiler.cpp */, + 9F72304E11184B4100AD0126 /* ScriptProfiler.h */, 934CC1090EDB223900A658F2 /* ScriptSourceCode.h */, CE54FD371016D9A6008B44C8 /* ScriptSourceProvider.h */, 4127D5360F8AAB1D00E424F5 /* ScriptState.cpp */, @@ -16133,6 +16164,7 @@ 4B8AF4AA0B1CE02B00687690 /* ClipboardAccessPolicy.h in Headers */, 85031B400A44EFC700F992E0 /* ClipboardEvent.h in Headers */, 93F199E708245E59001E9ABC /* ClipboardMac.h in Headers */, + C0C054CB1118C8E400CE2636 /* CodeGenerator.pm in Headers */, BC5EB5DF0E81B9AB00B25965 /* CollapsedBorderValue.h in Headers */, 93C441F00F813A1A00C1A634 /* CollectionCache.h in Headers */, 93C442000F813AE100C1A634 /* CollectionType.h in Headers */, @@ -17079,6 +17111,7 @@ 51C81B8A0C4422F70019ECE3 /* FTPDirectoryParser.h in Headers */, 935C477509AC4D8E00A6AAB4 /* GapRects.h in Headers */, 1432E8470C51493800B1500F /* GCController.h in Headers */, + C0C054CC1118C8E400CE2636 /* generate-bindings.pl in Headers */, BC23F0DB0DAFF4A4009FDC91 /* GeneratedImage.h in Headers */, BCE04C8A0DAFF7A0007A0F41 /* Generator.h in Headers */, 2E4346440F546A8200B0F1BA /* GenericWorkerTask.h in Headers */, @@ -17212,6 +17245,8 @@ 51E1ECC10C91C90400DC255B /* IconRecord.h in Headers */, 1A71D57C0F33819000F9CE4E /* IdentifierRep.h in Headers */, 49E911C50EF86D47009D0CAF /* IdentityTransformOperation.h in Headers */, + C0C054CD1118C8E400CE2636 /* IDLParser.pm in Headers */, + C0C054CE1118C8E400CE2636 /* IDLStructure.pm in Headers */, B27535700B053814002CE64F /* Image.h in Headers */, B2A10B920B3818BD00099AA4 /* ImageBuffer.h in Headers */, A779791A0D6B9D0C003851B9 /* ImageData.h in Headers */, @@ -18470,8 +18505,16 @@ E1F1E8300C3C2BB9006DB391 /* XSLTExtensions.h in Headers */, 93F199ED08245E59001E9ABC /* XSLTProcessor.h in Headers */, E1BE512E0CF6C512002EA959 /* XSLTUnicodeSort.h in Headers */, + F3644B001119805900E0D537 /* InjectedScript.h in Headers */, 97DD4D870FDF4D6E00ECF9A4 /* XSSAuditor.h in Headers */, +<<<<<<< HEAD 599ABBC91119762B0083897F /* GeolocationPositionCache.h in Headers */, +======= + 84D0C4061115F1EA0018AA34 /* AffineTransform.h in Headers */, + B71FE6DF11091CB300DAEF77 /* PrintContext.h in Headers */, + 9F72304F11184B4100AD0126 /* ScriptProfile.h in Headers */, + 9F72305111184B4100AD0126 /* ScriptProfiler.h in Headers */, +>>>>>>> webkit.org at r54340 ); runOnlyForDeploymentPostprocessing = 0; }; @@ -20643,10 +20686,17 @@ 93F19B0308245E59001E9ABC /* XSLStyleSheetLibxslt.cpp in Sources */, E1F1E82F0C3C2BB9006DB391 /* XSLTExtensions.cpp in Sources */, 93F19B0408245E59001E9ABC /* XSLTProcessor.cpp in Sources */, + F3644AFF1119805900E0D537 /* InjectedScript.cpp in Sources */, 93F19B0508245E59001E9ABC /* XSLTProcessorLibxslt.cpp in Sources */, E1BE512D0CF6C512002EA959 /* XSLTUnicodeSort.cpp in Sources */, 97DD4D860FDF4D6E00ECF9A4 /* XSSAuditor.cpp in Sources */, +<<<<<<< HEAD 599ABBC51119761C0083897F /* GeolocationPositionCache.cpp in Sources */, +======= + 84D0C4041115F1D40018AA34 /* AffineTransform.cpp in Sources */, + B776D43D1104527500BEB0EC /* PrintContext.cpp in Sources */, + 9F72305011184B4100AD0126 /* ScriptProfiler.cpp in Sources */, +>>>>>>> webkit.org at r54340 ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/WebCore/accessibility/gtk/AccessibilityObjectWrapperAtk.cpp b/WebCore/accessibility/gtk/AccessibilityObjectWrapperAtk.cpp index 87070cd..a4d1638 100644 --- a/WebCore/accessibility/gtk/AccessibilityObjectWrapperAtk.cpp +++ b/WebCore/accessibility/gtk/AccessibilityObjectWrapperAtk.cpp @@ -876,7 +876,7 @@ gchar* textForObject(AccessibilityRenderObject* accObject) g_string_append(str, "\n"); range = accObject->doAXRangeForLine(++lineNumber); } - } else { + } else if (accObject->renderer()) { // For RenderBlocks, piece together the text from the RenderText objects they contain. for (RenderObject* obj = accObject->renderer()->firstChild(); obj; obj = obj->nextSibling()) { if (obj->isBR()) { diff --git a/WebCore/bindings/js/JSBindingsAllInOne.cpp b/WebCore/bindings/js/JSBindingsAllInOne.cpp index e539042..8a918a3 100644 --- a/WebCore/bindings/js/JSBindingsAllInOne.cpp +++ b/WebCore/bindings/js/JSBindingsAllInOne.cpp @@ -142,6 +142,7 @@ #include "ScriptControllerWin.cpp" #include "ScriptEventListener.cpp" #include "ScriptFunctionCall.cpp" +#include "ScriptProfiler.cpp" #include "ScriptState.cpp" #include "SerializedScriptValue.cpp" #include "WorkerScriptController.cpp" diff --git a/WebCore/bindings/js/JSConsoleCustom.cpp b/WebCore/bindings/js/JSConsoleCustom.cpp index 8366b39..b631cdd 100644 --- a/WebCore/bindings/js/JSConsoleCustom.cpp +++ b/WebCore/bindings/js/JSConsoleCustom.cpp @@ -24,13 +24,14 @@ */ #include "config.h" + #include "JSConsole.h" + +#include "Console.h" #include "JavaScriptProfile.h" #include "ScriptCallStack.h" #include <runtime/JSArray.h> -#include "Console.h" - using namespace JSC; namespace WebCore { @@ -51,22 +52,6 @@ JSValue JSConsole::profiles(ExecState* exec) const return constructArray(exec, list); } -JSValue JSConsole::profile(ExecState* exec, const ArgList& args) -{ - ScriptCallStack callStack(exec, args, 1); - const UString title = valueToStringWithUndefinedOrNullCheck(exec, args.at(0)); - impl()->profile(title, &callStack); - return jsUndefined(); -} - -JSValue JSConsole::profileEnd(ExecState* exec, const ArgList& args) -{ - ScriptCallStack callStack(exec, args, 1); - const UString title = valueToStringWithUndefinedOrNullCheck(exec, args.at(0)); - impl()->profileEnd(title, &callStack); - return jsUndefined(); -} - #endif } // namespace WebCore diff --git a/WebCore/bindings/js/JSDOMBinding.cpp b/WebCore/bindings/js/JSDOMBinding.cpp index 04b6dc9..abba405 100644 --- a/WebCore/bindings/js/JSDOMBinding.cpp +++ b/WebCore/bindings/js/JSDOMBinding.cpp @@ -776,7 +776,7 @@ Frame* toDynamicFrame(ExecState* exec) bool processingUserGesture(ExecState* exec) { Frame* frame = toDynamicFrame(exec); - return frame && frame->script()->processingUserGesture(); + return frame && frame->script()->processingUserGesture(currentWorld(exec)); } KURL completeURL(ExecState* exec, const String& relativeURL) diff --git a/WebCore/bindings/js/JSDOMWindowCustom.cpp b/WebCore/bindings/js/JSDOMWindowCustom.cpp index 1da5af2..f7be2c5 100644 --- a/WebCore/bindings/js/JSDOMWindowCustom.cpp +++ b/WebCore/bindings/js/JSDOMWindowCustom.cpp @@ -716,6 +716,14 @@ static Frame* createWindow(ExecState* exec, Frame* lexicalFrame, Frame* dynamicF return newFrame; } +static bool domWindowAllowPopUp(Frame* activeFrame, ExecState* exec) +{ + ASSERT(activeFrame); + if (activeFrame->script()->processingUserGesture(currentWorld(exec))) + return true; + return DOMWindow::allowPopUp(activeFrame); +} + JSValue JSDOMWindow::open(ExecState* exec, const ArgList& args) { String urlString = valueToStringWithUndefinedOrNullCheck(exec, args.at(0)); @@ -736,7 +744,7 @@ JSValue JSDOMWindow::open(ExecState* exec, const ArgList& args) // Because FrameTree::find() returns true for empty strings, we must check for empty framenames. // Otherwise, illegitimate window.open() calls with no name will pass right through the popup blocker. - if (!DOMWindow::allowPopUp(dynamicFrame) && (frameName.isEmpty() || !frame->tree()->find(frameName))) + if (!domWindowAllowPopUp(dynamicFrame, exec) && (frameName.isEmpty() || !frame->tree()->find(frameName))) return jsUndefined(); // Get the target frame for the special cases of _top and _parent. In those @@ -806,7 +814,7 @@ JSValue JSDOMWindow::showModalDialog(ExecState* exec, const ArgList& args) if (!dynamicFrame) return jsUndefined(); - if (!DOMWindow::canShowModalDialogNow(frame) || !DOMWindow::allowPopUp(dynamicFrame)) + if (!DOMWindow::canShowModalDialogNow(frame) || !domWindowAllowPopUp(dynamicFrame, exec)) return jsUndefined(); HashMap<String, String> features; diff --git a/WebCore/bindings/js/JSDocumentCustom.cpp b/WebCore/bindings/js/JSDocumentCustom.cpp index 9366399..eda153e 100644 --- a/WebCore/bindings/js/JSDocumentCustom.cpp +++ b/WebCore/bindings/js/JSDocumentCustom.cpp @@ -87,7 +87,7 @@ void JSDocument::setLocation(ExecState* exec, JSValue value) if (activeFrame) str = activeFrame->document()->completeURL(str).string(); - bool userGesture = activeFrame->script()->processingUserGesture(); + bool userGesture = activeFrame->script()->processingUserGesture(currentWorld(exec)); frame->redirectScheduler()->scheduleLocationChange(str, activeFrame->loader()->outgoingReferrer(), !activeFrame->script()->anyPageIsProcessingUserGesture(), false, userGesture); } diff --git a/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp b/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp index d38d8ee..96c5c43 100644 --- a/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp +++ b/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp @@ -43,6 +43,7 @@ #include "ExceptionCode.h" #include "Frame.h" #include "FrameLoader.h" +#include "InjectedScript.h" #include "InjectedScriptHost.h" #include "InspectorController.h" #include "InspectorResource.h" @@ -194,20 +195,21 @@ JSValue JSInjectedScriptHost::selectDOMStorage(ExecState*, const ArgList& args) } #endif -ScriptObject InjectedScriptHost::injectedScriptFor(ScriptState* scriptState) +InjectedScript InjectedScriptHost::injectedScriptFor(ScriptState* scriptState) { JSLock lock(SilenceAssertionsOnly); JSDOMGlobalObject* globalObject = static_cast<JSDOMGlobalObject*>(scriptState->lexicalGlobalObject()); JSObject* injectedScript = globalObject->injectedScript(); if (injectedScript) - return ScriptObject(scriptState, injectedScript); + return InjectedScript(ScriptObject(scriptState, injectedScript)); ASSERT(!m_injectedScriptSource.isEmpty()); ScriptObject injectedScriptObject = createInjectedScript(m_injectedScriptSource, this, scriptState, m_nextInjectedScriptId); globalObject->setInjectedScript(injectedScriptObject.jsObject()); - m_idToInjectedScript.set(m_nextInjectedScriptId, injectedScriptObject); + InjectedScript result(injectedScriptObject); + m_idToInjectedScript.set(m_nextInjectedScriptId, result); m_nextInjectedScriptId++; - return injectedScriptObject; + return result; } } // namespace WebCore diff --git a/WebCore/bindings/js/ScriptController.cpp b/WebCore/bindings/js/ScriptController.cpp index 083e931..bd36689 100644 --- a/WebCore/bindings/js/ScriptController.cpp +++ b/WebCore/bindings/js/ScriptController.cpp @@ -222,39 +222,19 @@ JSDOMWindowShell* ScriptController::initScript(DOMWrapperWorld* world) return windowShell; } -bool ScriptController::processingUserGesture() const +bool ScriptController::processingUserGesture(DOMWrapperWorld* world) const { - return m_allowPopupsFromPlugin || processingUserGestureEvent() || isJavaScriptAnchorNavigation(); + return m_allowPopupsFromPlugin || processingUserGestureEvent(world) || isJavaScriptAnchorNavigation(); } -bool ScriptController::processingUserGestureEvent() const +bool ScriptController::processingUserGestureEvent(DOMWrapperWorld* world) const { - JSDOMWindowShell* shell = existingWindowShell(mainThreadNormalWorld()); + JSDOMWindowShell* shell = existingWindowShell(world); if (!shell) return false; - if (Event* event = shell->window()->currentEvent()) { - if (event->createdByDOM()) - return false; - - const AtomicString& type = event->type(); - if ( // mouse events - type == eventNames().clickEvent || type == eventNames().mousedownEvent - || type == eventNames().mouseupEvent || type == eventNames().dblclickEvent - // keyboard events - || type == eventNames().keydownEvent || type == eventNames().keypressEvent - || type == eventNames().keyupEvent -#if ENABLE(TOUCH_EVENTS) - // touch events - || type == eventNames().touchstartEvent || type == eventNames().touchmoveEvent - || type == eventNames().touchendEvent || type == eventNames().touchcancelEvent -#endif - // other accepted events - || type == eventNames().selectEvent || type == eventNames().changeEvent - || type == eventNames().focusEvent || type == eventNames().blurEvent - || type == eventNames().submitEvent) - return true; - } + if (Event* event = shell->window()->currentEvent()) + return event->fromUserGesture(); return false; } @@ -280,7 +260,20 @@ bool ScriptController::anyPageIsProcessingUserGesture() const HashSet<Page*>::const_iterator end = pages.end(); for (HashSet<Page*>::const_iterator it = pages.begin(); it != end; ++it) { for (Frame* frame = page->mainFrame(); frame; frame = frame->tree()->traverseNext()) { - if (frame->script()->processingUserGesture()) + ScriptController* script = frame->script(); + + if (script->m_allowPopupsFromPlugin) + return true; + + const ShellMap::const_iterator iterEnd = m_windowShells.end(); + for (ShellMap::const_iterator iter = m_windowShells.begin(); iter != iterEnd; ++iter) { + JSDOMWindowShell* shell = iter->second.get(); + Event* event = shell->window()->currentEvent(); + if (event && event->fromUserGesture()) + return true; + } + + if (isJavaScriptAnchorNavigation()) return true; } } diff --git a/WebCore/bindings/js/ScriptController.h b/WebCore/bindings/js/ScriptController.h index f3e5adf..1cbb56d 100644 --- a/WebCore/bindings/js/ScriptController.h +++ b/WebCore/bindings/js/ScriptController.h @@ -107,7 +107,7 @@ public: int eventHandlerLineNumber() { return m_handlerLineNumber; } void setProcessingTimerCallback(bool b) { m_processingTimerCallback = b; } - bool processingUserGesture() const; + bool processingUserGesture(DOMWrapperWorld*) const; bool anyPageIsProcessingUserGesture() const; bool canExecuteScripts(); @@ -164,7 +164,7 @@ private: void disconnectPlatformScriptObjects(); - bool processingUserGestureEvent() const; + bool processingUserGestureEvent(DOMWrapperWorld*) const; bool isJavaScriptAnchorNavigation() const; ShellMap m_windowShells; diff --git a/WebCore/bindings/js/ScriptProfile.h b/WebCore/bindings/js/ScriptProfile.h new file mode 100644 index 0000000..32095e3 --- /dev/null +++ b/WebCore/bindings/js/ScriptProfile.h @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2010 Apple 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 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 COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ScriptProfile_h +#define ScriptProfile_h + +#if ENABLE(JAVASCRIPT_DEBUGGER) +#include <profiler/Profile.h> + +namespace WebCore { + +typedef JSC::Profile ScriptProfile; + +} // namespace WebCore + +#endif // ENABLE(JAVASCRIPT_DEBUGGER) + +#endif // ScriptProfile_h diff --git a/WebCore/bindings/js/ScriptProfiler.cpp b/WebCore/bindings/js/ScriptProfiler.cpp new file mode 100644 index 0000000..789e3d3 --- /dev/null +++ b/WebCore/bindings/js/ScriptProfiler.cpp @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2010 Apple 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 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 COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" + +#if ENABLE(JAVASCRIPT_DEBUGGER) + +#include "ScriptProfiler.h" + +#include <profiler/Profiler.h> + +namespace WebCore { + +void ScriptProfiler::start(ScriptState* state, const String& title) +{ + JSC::Profiler::profiler()->startProfiling(state, title); +} + +PassRefPtr<ScriptProfile> ScriptProfiler::stop(ScriptState* state, const String& title) +{ + return JSC::Profiler::profiler()->stopProfiling(state, title); +} + +} // namespace WebCore + +#endif // ENABLE(JAVASCRIPT_DEBUGGER) diff --git a/WebCore/bindings/js/ScriptProfiler.h b/WebCore/bindings/js/ScriptProfiler.h new file mode 100644 index 0000000..a86bcfb --- /dev/null +++ b/WebCore/bindings/js/ScriptProfiler.h @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2010 Apple 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 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 COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ScriptProfiler_h +#define ScriptProfiler_h + +#if ENABLE(JAVASCRIPT_DEBUGGER) +#include "ScriptProfile.h" +#include "ScriptState.h" + +#include <wtf/Noncopyable.h> + +namespace WebCore { + +class ScriptProfiler : public Noncopyable { +public: + static void start(ScriptState* state, const String& title); + static PassRefPtr<ScriptProfile> stop(ScriptState* state, const String& title); +}; + +} // namespace WebCore + +#endif // ENABLE(JAVASCRIPT_DEBUGGER) + +#endif // ScriptProfiler_h diff --git a/WebCore/bindings/scripts/CodeGeneratorJS.pm b/WebCore/bindings/scripts/CodeGeneratorJS.pm index 7a55a3d..c774a57 100644 --- a/WebCore/bindings/scripts/CodeGeneratorJS.pm +++ b/WebCore/bindings/scripts/CodeGeneratorJS.pm @@ -1676,7 +1676,12 @@ sub GenerateImplementation } else { $functionString .= $name; } + $paramIndex++; + } + if ($function->signature->extendedAttributes->{"NeedsUserGestureCheck"}) { + $functionString .= ", " if $paramIndex; + $functionString .= "processingUserGesture(exec)"; $paramIndex++; } diff --git a/WebCore/bindings/scripts/CodeGeneratorV8.pm b/WebCore/bindings/scripts/CodeGeneratorV8.pm index 305fdfd..cb4d04a 100644 --- a/WebCore/bindings/scripts/CodeGeneratorV8.pm +++ b/WebCore/bindings/scripts/CodeGeneratorV8.pm @@ -156,14 +156,15 @@ sub AddIncludesForType # When we're finished with the one-file-per-class # reorganization, we won't need these special cases. - if ($codeGenerator->IsPrimitiveType($type) or AvoidInclusionOfType($type)) { - } elsif ($type =~ /SVGPathSeg/) { - $joinedName = $type; - $joinedName =~ s/Abs|Rel//; - $implIncludes{"${joinedName}.h"} = 1; - } else { + if (!$codeGenerator->IsPrimitiveType($type) and !AvoidInclusionOfType($type) and $type ne "Date") { # default, include the same named file - $implIncludes{GetImplementationFileName(${type})} = 1; + $implIncludes{GetV8HeaderName(${type})} = 1; + + if ($type =~ /SVGPathSeg/) { + $joinedName = $type; + $joinedName =~ s/Abs|Rel//; + $implIncludes{"${joinedName}.h"} = 1; + } } # additional includes (things needed to compile the bindings but not the header) @@ -210,17 +211,6 @@ sub AddClassForwardIfNeeded push(@headerContent, "class $implClassName;\n\n") unless $codeGenerator->IsSVGAnimatedType($implClassName); } -sub GetImplementationFileName -{ - my $iface = shift; - return "Event.h" if $iface eq "DOMTimeStamp"; - return "NamedAttrMap.h" if $iface eq "NamedNodeMap"; - return "NameNodeList.h" if $iface eq "NodeList"; - return "XMLHttpRequest.h" if $iface eq "XMLHttpRequest"; - - return "${iface}.h"; -} - # If the node has a [Conditional=XXX] attribute, returns an "ENABLE(XXX)" string for use in an #if. sub GenerateConditionalString { @@ -258,7 +248,6 @@ sub GenerateHeader # Get correct pass/store types respecting PODType flag my $podType = $dataNode->extendedAttributes->{"PODType"}; - my $passType = $podType ? "JSSVGPODTypeWrapper<$podType>*" : "$implClassName*"; push(@headerContent, "#include \"$podType.h\"\n") if $podType and ($podType ne "double" and $podType ne "float" and $podType ne "RGBA32"); @@ -268,15 +257,23 @@ sub GenerateHeader push(@headerContent, "#include \"V8Index.h\"\n"); push(@headerContent, GetHeaderClassInclude($implClassName)); push(@headerContent, "\nnamespace WebCore {\n"); + if ($podType) { + push(@headerContent, "\ntemplate<typename PODType> class V8SVGPODTypeWrapper;\n"); + } push(@headerContent, "\nclass $className {\n"); - - my $toNativeReturnType = GetReturnTypeForToNative($interfaceName); + + my $nativeType = GetNativeTypeForConversions($interfaceName); + if ($podType) { + $nativeType = "V8SVGPODTypeWrapper<${nativeType} >"; + } + my $forceNewObjectParameter = IsDOMNodeType($interfaceName) ? ", bool forceNewObject = false" : ""; push(@headerContent, <<END); public: static bool HasInstance(v8::Handle<v8::Value> value); static v8::Persistent<v8::FunctionTemplate> GetRawTemplate(); - static ${toNativeReturnType}* toNative(v8::Handle<v8::Object>); + static ${nativeType}* toNative(v8::Handle<v8::Object>); + static v8::Handle<v8::Object> wrap(${nativeType}*${forceNewObjectParameter}); END if ($implClassName eq "DOMWindow") { @@ -346,7 +343,13 @@ END friend class V8ClassIndex; }; + v8::Handle<v8::Value> toV8(${nativeType}*${forceNewObjectParameter}); +END + if (IsRefPtrType($implClassName)) { + push(@headerContent, <<END); + v8::Handle<v8::Value> toV8(PassRefPtr<${nativeType} >${forceNewObjectParameter}); END + } push(@headerContent, "}\n\n"); push(@headerContent, "#endif // $className" . "_H\n"); @@ -665,7 +668,7 @@ sub GenerateNormalAttrGetter $attrIsPodType = 0; } - my $getterStringUsesImp = $implClassName ne "double"; + my $getterStringUsesImp = $implClassName ne "float"; # Getter push(@implContentDecls, <<END); @@ -821,13 +824,16 @@ END push(@implContentDecls, GenerateSVGContextAssignment($implClassName, "wrapper.get()", " ")); } else { push(@implContentDecls, GenerateSVGContextRetrieval($implClassName, " ")); - $result = "V8Proxy::withSVGContext($result, context)"; + # The templating associated with passing withSVGContext()'s return value directly into toV8 can get compilers confused, + # so just manually set the return value to a PassRefPtr of the expected type. + push(@implContentDecls, " PassRefPtr<$attrType> resultAsPassRefPtr = V8Proxy::withSVGContext($result, context);\n"); + $result = "resultAsPassRefPtr"; } } if ($attrIsPodType) { - my $classIndex = uc($attrType); - push(@implContentDecls, " return V8DOMWrapper::convertToV8Object(V8ClassIndex::$classIndex, wrapper.release());\n"); + $implIncludes{"V8${attrType}.h"} = 1; + push(@implContentDecls, " return toV8(wrapper.release().get());\n"); } else { push(@implContentDecls, " " . ReturnNativeToJSValue($attribute->signature, $result, " ").";\n"); } @@ -943,7 +949,7 @@ END push(@implContentDecls, " ExceptionCode ec = 0;\n"); } - if ($implClassName eq "double") { + if ($implClassName eq "float") { push(@implContentDecls, " *imp = $result;\n"); } else { my $implSetterFunctionName = $codeGenerator->WK_ucfirst($attrName); @@ -956,7 +962,6 @@ END push(@implContentDecls, " imp->setAttribute(${namespace}::${contentAttributeName}Attr, $result"); } elsif ($attribute->signature->type eq "EventListener") { $implIncludes{"V8AbstractEventListener.h"} = 1; - $implIncludes{"V8CustomBinding.h"} = 1; push(@implContentDecls, " transferHiddenDependency(info.Holder(), imp->$attrName(), value, V8${interfaceName}::cacheIndex);\n"); push(@implContentDecls, " imp->set$implSetterFunctionName(V8DOMWrapper::getEventListener(imp, value, true, ListenerFindOrCreate)"); } else { @@ -1472,7 +1477,9 @@ sub GenerateImplementation "#include \"config.h\"\n" . "#include \"V8Proxy.h\"\n" . "#include \"V8Binding.h\"\n" . - "#include \"V8BindingState.h\"\n\n" . + "#include \"V8BindingState.h\"\n" . + "#include \"V8DOMWrapper.h\"\n" . + "#include \"V8IsolatedContext.h\"\n\n" . "#undef LOG\n\n"); push(@implFixedHeader, "\n#if ${conditionalString}\n\n") if $conditionalString; @@ -1498,10 +1505,8 @@ sub GenerateImplementation # Generate special code for the constructor attributes. if ($attrType =~ /Constructor$/) { - if ($attribute->signature->extendedAttributes->{"CustomGetter"} || - $attribute->signature->extendedAttributes->{"V8CustomGetter"}) { - $implIncludes{"V8CustomBinding.h"} = 1; - } else { + if (!($attribute->signature->extendedAttributes->{"CustomGetter"} || + $attribute->signature->extendedAttributes->{"V8CustomGetter"})) { $hasConstructors = 1; } next; @@ -1516,25 +1521,22 @@ sub GenerateImplementation # implementation. if ($attribute->signature->extendedAttributes->{"Custom"} || $attribute->signature->extendedAttributes->{"V8Custom"}) { - $implIncludes{"V8CustomBinding.h"} = 1; next; } # Generate the accessor. - if ($attribute->signature->extendedAttributes->{"CustomGetter"} || - $attribute->signature->extendedAttributes->{"V8CustomGetter"}) { - $implIncludes{"V8CustomBinding.h"} = 1; - } else { + if (!($attribute->signature->extendedAttributes->{"CustomGetter"} || + $attribute->signature->extendedAttributes->{"V8CustomGetter"})) { GenerateNormalAttrGetter($attribute, $dataNode, $classIndex, $implClassName, $interfaceName); } - if ($attribute->signature->extendedAttributes->{"CustomSetter"} || - $attribute->signature->extendedAttributes->{"V8CustomSetter"}) { - $implIncludes{"V8CustomBinding.h"} = 1; - } elsif ($attribute->signature->extendedAttributes->{"Replaceable"}) { - $dataNode->extendedAttributes->{"ExtendsDOMGlobalObject"} || die "Replaceable attribute can only be used in interface that defines ExtendsDOMGlobalObject attribute!"; - # GenerateReplaceableAttrSetter($implClassName); - } elsif ($attribute->type !~ /^readonly/ && !$attribute->signature->extendedAttributes->{"V8ReadOnly"}) { - GenerateNormalAttrSetter($attribute, $dataNode, $classIndex, $implClassName, $interfaceName); + if (!($attribute->signature->extendedAttributes->{"CustomSetter"} || + $attribute->signature->extendedAttributes->{"V8CustomSetter"})) { + if ($attribute->signature->extendedAttributes->{"Replaceable"}) { + $dataNode->extendedAttributes->{"ExtendsDOMGlobalObject"} || die "Replaceable attribute can only be used in interface that defines ExtendsDOMGlobalObject attribute!"; + # GenerateReplaceableAttrSetter($implClassName); + } elsif ($attribute->type !~ /^readonly/ && !$attribute->signature->extendedAttributes->{"V8ReadOnly"}) { + GenerateNormalAttrSetter($attribute, $dataNode, $classIndex, $implClassName, $interfaceName); + } } } @@ -1548,9 +1550,7 @@ sub GenerateImplementation foreach my $function (@{$dataNode->functions}) { # hack for addEventListener/RemoveEventListener # FIXME: avoid naming conflict - if ($function->signature->extendedAttributes->{"Custom"} || $function->signature->extendedAttributes->{"V8Custom"}) { - $implIncludes{"V8CustomBinding.h"} = 1; - } else { + if (!($function->signature->extendedAttributes->{"Custom"} || $function->signature->extendedAttributes->{"V8Custom"})) { GenerateFunctionCallback($function, $dataNode, $classIndex, $implClassName); } @@ -1888,7 +1888,10 @@ END END } - $toNativeReturnType = GetReturnTypeForToNative($interfaceName); + my $nativeType = GetNativeTypeForConversions($interfaceName); + if ($dataNode->extendedAttributes->{"PODType"}) { + $nativeType = "V8SVGPODTypeWrapper<${nativeType}>"; + } push(@implContent, <<END); // Custom toString template @@ -1906,8 +1909,8 @@ v8::Persistent<v8::FunctionTemplate> ${className}::GetTemplate() { return ${className}_cache_; } -${toNativeReturnType}* ${className}::toNative(v8::Handle<v8::Object> object) { - return reinterpret_cast<${toNativeReturnType}*>(object->GetPointerFromInternalField(v8DOMWrapperObjectIndex)); +${nativeType}* ${className}::toNative(v8::Handle<v8::Object> object) { + return reinterpret_cast<${nativeType}*>(object->GetPointerFromInternalField(v8DOMWrapperObjectIndex)); } bool ${className}::HasInstance(v8::Handle<v8::Value> value) { @@ -1928,6 +1931,8 @@ v8::Persistent<v8::ObjectTemplate> V8DOMWindow::GetShadowObjectTemplate() { } END } + + GenerateToV8Converters($dataNode, $interfaceName, $className, $nativeType); push(@implContent, <<END); } // namespace WebCore @@ -1936,7 +1941,194 @@ END push(@implContent, "\n#endif // ${conditionalString}\n") if $conditionalString; } -sub GetReturnTypeForToNative +sub GenerateToV8Converters +{ + my $dataNode = shift; + my $interfaceName = shift; + my $className = shift; + my $nativeType = shift; + + my $wrapperType = "V8ClassIndex::" . uc($interfaceName); + my $domMapFunction = GetDomMapFunction($dataNode, $interfaceName); + my $forceNewObjectInput = IsDOMNodeType($interfaceName) ? ", bool forceNewObject" : ""; + my $forceNewObjectCall = IsDOMNodeType($interfaceName) ? ", forceNewObject" : ""; + + push(@implContent, <<END); + +v8::Handle<v8::Object> ${className}::wrap(${nativeType}* impl${forceNewObjectInput}) { + v8::Handle<v8::Object> wrapper; +END + if (!NeedsWorkerContextExecutionProxyToV8($interfaceName)) { + push(@implContent, <<END); + V8Proxy* proxy = 0; +END + } + + if (IsNodeSubType($dataNode)) { + push(@implContent, <<END); + if (impl->document()) { + proxy = V8Proxy::retrieve(impl->document()->frame()); + if (proxy && static_cast<Node*>(impl->document()) == static_cast<Node*>(impl)) + proxy->windowShell()->initContextIfNeeded(); + } + +END + } + + if ($domMapFunction) { + push(@implContent, " if (!forceNewObject) {\n") if IsDOMNodeType($interfaceName); + if (IsNodeSubType($dataNode)) { + push(@implContent, " wrapper = V8DOMWrapper::getWrapper(impl);\n"); + } else { + push(@implContent, " wrapper = ${domMapFunction}.get(impl);\n"); + } + push(@implContent, <<END); + if (!wrapper.IsEmpty()) + return wrapper; +END + push(@implContent, " }\n") if IsDOMNodeType($interfaceName); + } + if (IsNodeSubType($dataNode)) { + push(@implContent, <<END); + + v8::Handle<v8::Context> context; + if (proxy) + context = proxy->context(); + + // Enter the node's context and create the wrapper in that context. + if (!context.IsEmpty()) + context->Enter(); +END + } + + if (NeedsWorkerContextExecutionProxyToV8($interfaceName)) { + $implIncludes{"WorkerContextExecutionProxy.h"} = 1; + push(@implContent, <<END); + wrapper = WorkerContextExecutionProxy::toV8(${wrapperType}, impl); +END + } else { + push(@implContent, <<END); + wrapper = V8DOMWrapper::instantiateV8Object(proxy, ${wrapperType}, impl); +END + } + + if (IsNodeSubType($dataNode)) { + push(@implContent, <<END); + // Exit the node's context if it was entered. + if (!context.IsEmpty()) + context->Exit(); +END + } + + push(@implContent, <<END); + if (wrapper.IsEmpty()) + return wrapper; +END + push(@implContent, "\n impl->ref();\n") if IsRefPtrType($interfaceName); + + if ($domMapFunction) { + push(@implContent, <<END); + ${domMapFunction}.set(impl, v8::Persistent<v8::Object>::New(wrapper)); +END + } + + push(@implContent, <<END); + return wrapper; +} +END + + if (IsRefPtrType($interfaceName)) { + push(@implContent, <<END); + +v8::Handle<v8::Value> toV8(PassRefPtr<${nativeType} > impl${forceNewObjectInput}) { + return toV8(impl.get()${forceNewObjectCall}); +} +END + } + + if (!HasCustomToV8Implementation($dataNode, $interfaceName)) { + push(@implContent, <<END); + +v8::Handle<v8::Value> toV8(${nativeType}* impl${forceNewObjectInput}) { + if (!impl) + return v8::Null(); + return ${className}::wrap(impl${forceNewObjectCall}); +} +END + } +} + +sub NeedsWorkerContextExecutionProxyToV8 { + # These objects can be constructed under WorkerContextExecutionProxy. They need special + # handling, since if we call V8Proxy::retrieve(), we will crash. + # FIXME: websocket? + $interfaceName = shift; + return 1 if $interfaceName eq "DOMCoreException"; + return 1 if $interfaceName eq "EventException"; + return 1 if $interfaceName eq "RangeException"; + return 1 if $interfaceName eq "XMLHttpRequestException"; + return 1 if $interfaceName eq "MessagePort"; + return 0; +} + +sub HasCustomToV8Implementation { + # FIXME: This subroutine is lame. Probably should be an .idl attribute (CustomToV8)? + $dataNode = shift; + $interfaceName = shift; + + # We generate a custom converter (but JSC doesn't) for the following: + return 1 if $interfaceName eq "BarInfo"; + return 1 if $interfaceName eq "CSSStyleSheet"; + return 1 if $interfaceName eq "CanvasPixelArray"; + return 1 if $interfaceName eq "DOMSelection"; + return 1 if $interfaceName eq "DOMWindow"; + return 1 if $interfaceName eq "Element"; + return 1 if $interfaceName eq "Location"; + return 1 if $interfaceName eq "HTMLDocument"; + return 1 if $interfaceName eq "HTMLElement"; + return 1 if $interfaceName eq "History"; + return 1 if $interfaceName eq "NamedNodeMap"; + return 1 if $interfaceName eq "Navigator"; + return 1 if $interfaceName eq "SVGDocument"; + return 1 if $interfaceName eq "SVGElement"; + return 1 if $interfaceName eq "Screen"; + + # We don't generate a custom converter (but JSC does) for the following: + return 0 if $interfaceName eq "AbstractWorker"; + return 0 if $interfaceName eq "CanvasRenderingContext"; + return 0 if $interfaceName eq "ImageData"; + return 0 if $interfaceName eq "SVGElementInstance"; + + # For everything else, do what JSC does. + return $dataNode->extendedAttributes->{"CustomToJS"}; +} + +sub GetDomMapFunction +{ + my $dataNode = shift; + my $type = shift; + return "getDOMSVGElementInstanceMap()" if $type eq "SVGElementInstance"; + return "getDOMNodeMap()" if IsNodeSubType($dataNode); + # Only use getDOMSVGObjectWithContextMap() for non-node svg objects + return "getDOMSVGObjectWithContextMap()" if $type =~ /SVG/; + return "" if $type eq "DOMImplementation"; + return "getActiveDOMObjectMap()" if IsActiveDomType($type); + return "getDOMObjectMap()"; +} + +sub IsActiveDomType +{ + # FIXME: Consider making this an .idl attribute. + my $type = shift; + return 1 if $type eq "MessagePort"; + return 1 if $type eq "XMLHttpRequest"; + return 1 if $type eq "WebSocket"; + return 1 if $type eq "Worker"; + return 1 if $type eq "SharedWorker"; + return 0; +} + +sub GetNativeTypeForConversions { my $type = shift; return "FloatRect" if $type eq "SVGRect"; @@ -1991,7 +2183,6 @@ sub GenerateFunctionCallString() my $first = 1; my $index = 0; - my $nodeToReturn = 0; foreach my $parameter (@{$function->parameters}) { if ($index eq $numberOfParameters) { @@ -2013,10 +2204,6 @@ sub GenerateFunctionCallString() } else { $functionString .= $paramName; } - - if ($parameter->extendedAttributes->{"Return"}) { - $nodeToReturn = $parameter->name; - } $index++; } @@ -2026,6 +2213,14 @@ sub GenerateFunctionCallString() if ($first) { $first = 0; } } + if ($function->signature->extendedAttributes->{"NeedsUserGestureCheck"}) { + $functionString .= ", " if not $first; + # FIXME: We need to pass DOMWrapperWorld as a parameter. + # See http://trac.webkit.org/changeset/54182 + $functionString .= "processingUserGesture()"; + if ($first) { $first = 0; } + } + if (@{$function->raisesExceptions}) { $functionString .= ", " if not $first; $functionString .= "ec"; @@ -2035,19 +2230,7 @@ sub GenerateFunctionCallString() my $return = "result"; my $returnIsRef = IsRefPtrType($returnType); - if ($nodeToReturn) { - # Special case for insertBefore, replaceChild, removeChild and - # appendChild functions from Node. - $result .= $indent . "bool success = $functionString;\n"; - if (@{$function->raisesExceptions}) { - $result .= $indent . "if (UNLIKELY(ec)) goto fail;\n"; - } - $result .= $indent . "if (success)\n"; - $result .= $indent . " " . - "return V8DOMWrapper::convertNodeToV8Object($nodeToReturn);\n"; - $result .= $indent . "return v8::Null();\n"; - return $result; - } elsif ($returnType eq "void") { + if ($returnType eq "void") { $result .= $indent . "$functionString;\n"; } elsif ($copyFirst) { $result .= @@ -2106,8 +2289,8 @@ sub GenerateFunctionCallString() } if ($returnsPodType) { - my $classIndex = uc($returnType); - $result .= $indent . "return V8DOMWrapper::convertToV8Object(V8ClassIndex::$classIndex, wrapper.release());\n"; + $implIncludes{"V8${returnType}.h"} = 1; + $result .= $indent . "return toV8(wrapper.release());\n"; } else { $return .= ".release()" if ($returnIsRef); $result .= $indent . ReturnNativeToJSValue($function->signature, $return, $indent) . ";\n"; @@ -2167,6 +2350,7 @@ sub IsRefPtrType return 0 if $type eq "unsigned"; return 0 if $type eq "unsigned long"; return 0 if $type eq "unsigned short"; + return 0 if $type eq "SVGAnimatedPoints"; return 1; } @@ -2207,7 +2391,7 @@ sub GetNativeType return "SVGTransform" if $type eq "SVGTransform"; return "SVGLength" if $type eq "SVGLength"; return "SVGAngle" if $type eq "SVGAngle"; - return "double" if $type eq "SVGNumber"; + return "float" if $type eq "SVGNumber"; return "SVGPreserveAspectRatio" if $type eq "SVGPreserveAspectRatio"; return "SVGPaint::SVGPaintType" if $type eq "SVGPaintType"; return "DOMTimeStamp" if $type eq "DOMTimeStamp"; @@ -2423,7 +2607,11 @@ sub JSValueToNative sub GetV8HeaderName { my $type = shift; - return "V8" . GetImplementationFileName($type); + return "V8Event.h" if $type eq "DOMTimeStamp"; + return "EventListener.h" if $type eq "EventListener"; + return "EventTarget.h" if $type eq "EventTarget"; + return "SerializedScriptValue.h" if $type eq "SerializedScriptValue"; + return "V8${type}.h"; } @@ -2548,7 +2736,6 @@ sub ReturnNativeToJSValue my $value = shift; my $indent = shift; my $type = GetTypeFromSignature($signature); - my $className= "V8$type"; return "return v8::Date::New(static_cast<double>($value))" if $type eq "DOMTimeStamp"; return "return v8Boolean($value)" if $type eq "boolean"; @@ -2575,29 +2762,20 @@ sub ReturnNativeToJSValue return "return v8String($value)"; } - # V8 specific. - my $implClassName = $type; AddIncludesForType($type); # special case for non-DOM node interfaces if (IsDOMNodeType($type)) { - if ($signature->extendedAttributes->{"ReturnsNew"}) { - return "return V8DOMWrapper::convertNewNodeToV8Object($value)"; - } else { - return "return V8DOMWrapper::convertNodeToV8Object($value)"; - } + return "return toV8(${value}" . ($signature->extendedAttributes->{"ReturnsNew"} ? ", true)" : ")"); } - if ($type eq "EventTarget" or $type eq "SVGElementInstance") { + if ($type eq "EventTarget") { return "return V8DOMWrapper::convertEventTargetToV8Object($value)"; } - if ($type eq "Event") { - return "return V8DOMWrapper::convertEventToV8Object($value)"; - } - if ($type eq "EventListener") { - return "return V8DOMWrapper::convertEventListenerToV8Object(imp->scriptExecutionContext(), $value)"; + $implIncludes{"V8AbstractEventListener.h"} = 1; + return "return ${value} ? v8::Handle<v8::Value>(static_cast<V8AbstractEventListener*>(${value})->getListenerObject(imp->scriptExecutionContext())) : v8::Handle<v8::Value>(v8::Null())"; } if ($type eq "SerializedScriptValue") { @@ -2617,18 +2795,15 @@ sub ReturnNativeToJSValue return "return WorkerContextExecutionProxy::convertToV8Object(V8ClassIndex::$classIndex, $value)"; } - else { - $implIncludes{"wtf/RefCounted.h"} = 1; - $implIncludes{"wtf/RefPtr.h"} = 1; - $implIncludes{"wtf/GetPtr.h"} = 1; - my $classIndex = uc($type); + $implIncludes{"wtf/RefCounted.h"} = 1; + $implIncludes{"wtf/RefPtr.h"} = 1; + $implIncludes{"wtf/GetPtr.h"} = 1; - if (IsPodType($type)) { - $value = GenerateSVGStaticPodTypeWrapper($type, $value); - } - - return "return V8DOMWrapper::convertToV8Object(V8ClassIndex::$classIndex, $value)"; + if (IsPodType($type)) { + $value = GenerateSVGStaticPodTypeWrapper($type, $value) . ".get()"; } + + return "return toV8($value)"; } sub GenerateSVGStaticPodTypeWrapper { diff --git a/WebCore/bindings/v8/ScriptController.cpp b/WebCore/bindings/v8/ScriptController.cpp index 8db55a1..e2b886d 100644 --- a/WebCore/bindings/v8/ScriptController.cpp +++ b/WebCore/bindings/v8/ScriptController.cpp @@ -50,7 +50,9 @@ #include "Settings.h" #include "V8Binding.h" #include "V8BindingState.h" +#include "V8DOMWindow.h" #include "V8Event.h" +#include "V8HTMLEmbedElement.h" #include "V8IsolatedContext.h" #include "V8NPObject.h" #include "V8Proxy.h" @@ -148,7 +150,7 @@ void ScriptController::updatePlatformScriptObjects() notImplemented(); } -bool ScriptController::processingUserGesture() const +bool ScriptController::processingUserGesture(DOMWrapperWorld*) const { Frame* activeFrame = V8Proxy::retrieveFrameForEnteredContext(); // No script is running, so it must be run by users. @@ -169,7 +171,7 @@ bool ScriptController::processingUserGesture() const v8::Handle<v8::Object> global = v8Context->Global(); v8::Handle<v8::Value> jsEvent = global->Get(v8::String::NewSymbol("event")); - Event* event = V8DOMWrapper::isDOMEventWrapper(jsEvent) ? V8Event::toNative(v8::Handle<v8::Object>::Cast(jsEvent)) : 0; + Event* event = (!jsEvent.IsEmpty() && jsEvent->IsObject()) ? V8Event::toNative(v8::Handle<v8::Object>::Cast(jsEvent)) : 0; // Based on code from kjs_bindings.cpp. // Note: This is more liberal than Firefox's implementation. @@ -353,6 +355,15 @@ void ScriptController::getAllWorlds(Vector<DOMWrapperWorld*>& worlds) worlds.append(mainThreadNormalWorld()); } +void ScriptController::evaluateInWorld(const ScriptSourceCode& source, + DOMWrapperWorld* world) +{ + Vector<ScriptSourceCode> sources; + sources.append(source); + // FIXME: Get an ID from the world param. + evaluateInIsolatedWorld(0, sources); +} + static NPObject* createNoScriptObject() { notImplemented(); @@ -368,7 +379,7 @@ static NPObject* createScriptObject(Frame* frame) v8::Context::Scope scope(v8Context); DOMWindow* window = frame->domWindow(); - v8::Handle<v8::Value> global = V8DOMWrapper::convertToV8Object(V8ClassIndex::DOMWINDOW, window); + v8::Handle<v8::Value> global = toV8(window); ASSERT(global->IsObject()); return npCreateV8ScriptObject(0, v8::Handle<v8::Object>::Cast(global), window); } @@ -405,7 +416,7 @@ NPObject* ScriptController::createScriptObjectForPluginElement(HTMLPlugInElement v8::Context::Scope scope(v8Context); DOMWindow* window = m_frame->domWindow(); - v8::Handle<v8::Value> v8plugin = V8DOMWrapper::convertToV8Object(V8ClassIndex::HTMLEMBEDELEMENT, plugin); + v8::Handle<v8::Value> v8plugin = toV8(static_cast<HTMLEmbedElement*>(plugin)); if (!v8plugin->IsObject()) return createNoScriptObject(); diff --git a/WebCore/bindings/v8/ScriptController.h b/WebCore/bindings/v8/ScriptController.h index b45bdef..b3995b2 100644 --- a/WebCore/bindings/v8/ScriptController.h +++ b/WebCore/bindings/v8/ScriptController.h @@ -143,7 +143,9 @@ public: void setEventHandlerLineNumber(int lineNumber); void setProcessingTimerCallback(bool processingTimerCallback) { m_processingTimerCallback = processingTimerCallback; } - bool processingUserGesture() const; + // FIXME: Currently we don't use the parameter world at all. + // See http://trac.webkit.org/changeset/54182 + bool processingUserGesture(DOMWrapperWorld* world = 0) const; bool anyPageIsProcessingUserGesture() const; void setPaused(bool paused) { m_paused = paused; } @@ -165,7 +167,7 @@ public: #endif // Dummy method to avoid a bunch of ifdef's in WebCore. - void evaluateInWorld(const ScriptSourceCode&, DOMWrapperWorld*) { } + void evaluateInWorld(const ScriptSourceCode&, DOMWrapperWorld*); static void getAllWorlds(Vector<DOMWrapperWorld*>& worlds); private: diff --git a/WebCore/bindings/v8/ScriptObject.cpp b/WebCore/bindings/v8/ScriptObject.cpp index 8d80d34..0fcd16f 100644 --- a/WebCore/bindings/v8/ScriptObject.cpp +++ b/WebCore/bindings/v8/ScriptObject.cpp @@ -36,9 +36,10 @@ #include "Document.h" #include "Frame.h" -#include "InspectorBackend.h" -#include "InspectorFrontendHost.h" #include "V8Binding.h" +#include "V8InjectedScriptHost.h" +#include "V8InspectorBackend.h" +#include "V8InspectorFrontendHost.h" #include "V8Proxy.h" #include <v8.h> @@ -144,21 +145,21 @@ bool ScriptGlobalObject::set(ScriptState* scriptState, const char* name, const S bool ScriptGlobalObject::set(ScriptState* scriptState, const char* name, InspectorBackend* value) { ScriptScope scope(scriptState); - scope.global()->Set(v8::String::New(name), V8DOMWrapper::convertToV8Object(V8ClassIndex::INSPECTORBACKEND, value)); + scope.global()->Set(v8::String::New(name), toV8(value)); return scope.success(); } bool ScriptGlobalObject::set(ScriptState* scriptState, const char* name, InspectorFrontendHost* value) { ScriptScope scope(scriptState); - scope.global()->Set(v8::String::New(name), V8DOMWrapper::convertToV8Object(V8ClassIndex::INSPECTORFRONTENDHOST, value)); + scope.global()->Set(v8::String::New(name), toV8(value)); return scope.success(); } bool ScriptGlobalObject::set(ScriptState* scriptState, const char* name, InjectedScriptHost* value) { ScriptScope scope(scriptState); - scope.global()->Set(v8::String::New(name), V8DOMWrapper::convertToV8Object(V8ClassIndex::INJECTEDSCRIPTHOST, value)); + scope.global()->Set(v8::String::New(name), toV8(value)); return scope.success(); } #endif diff --git a/WebCore/bindings/v8/ScriptProfile.h b/WebCore/bindings/v8/ScriptProfile.h new file mode 100644 index 0000000..1a4d677 --- /dev/null +++ b/WebCore/bindings/v8/ScriptProfile.h @@ -0,0 +1,62 @@ +/* + * 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 ScriptProfile_h +#define ScriptProfile_h + +#include "PlatformString.h" + +namespace WebCore { + +class ScriptProfile : public RefCounted<ScriptProfile> { +public: + static PassRefPtr<ScriptProfile> create(const String& title, unsigned uid) + { + return adoptRef(new ScriptProfile(title, uid)); + } + virtual ~ScriptProfile() {} + + String title() const { return m_title; } + unsigned int uid() const { return m_uid; } + +protected: + ScriptProfile(const String& title, unsigned uid) + : m_title(title) + , m_uid(uid) + {} + +private: + String m_title; + unsigned int m_uid; +}; + +} // namespace WebCore + +#endif // ScriptProfile_h diff --git a/WebCore/bindings/v8/custom/V8ConsoleCustom.cpp b/WebCore/bindings/v8/ScriptProfiler.cpp index 0dbdcd7..f238f6f 100644 --- a/WebCore/bindings/v8/custom/V8ConsoleCustom.cpp +++ b/WebCore/bindings/v8/ScriptProfiler.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009 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 @@ -29,29 +29,22 @@ */ #include "config.h" -#include "V8Console.h" -#include "V8Binding.h" -#include "V8CustomBinding.h" -#include "V8Proxy.h" -#include <v8.h> +#include "ScriptProfiler.h" namespace WebCore { -v8::Handle<v8::Value> V8Console::profileCallback(const v8::Arguments& args) +void ScriptProfiler::start(ScriptState* state, const String& title) { - INC_STATS("console.profile()"); v8::HandleScope scope; - v8::Context::Scope context_scope(v8::Context::GetCurrent()); + v8::Context::Scope contextScope(v8::Context::GetCurrent()); v8::V8::ResumeProfiler(); - return v8::Undefined(); } -v8::Handle<v8::Value> V8Console::profileEndCallback(const v8::Arguments& args) +PassRefPtr<ScriptProfile> ScriptProfiler::stop(ScriptState* state, const String& title) { - INC_STATS("console.profileEnd()"); v8::V8::PauseProfiler(); - return v8::Undefined(); + return 0; } } // namespace WebCore diff --git a/WebCore/bindings/v8/ScriptProfiler.h b/WebCore/bindings/v8/ScriptProfiler.h new file mode 100644 index 0000000..c02cc32 --- /dev/null +++ b/WebCore/bindings/v8/ScriptProfiler.h @@ -0,0 +1,50 @@ +/* + * 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 ScriptProfiler_h +#define ScriptProfiler_h + +#include "PlatformString.h" +#include "ScriptProfile.h" +#include "ScriptState.h" + +#include <wtf/Noncopyable.h> + +namespace WebCore { + +class ScriptProfiler : public Noncopyable { +public: + static void start(ScriptState* state, const String& title); + static PassRefPtr<ScriptProfile> stop(ScriptState* state, const String& title); +}; + +} // namespace WebCore + +#endif // ScriptProfiler_h diff --git a/WebCore/bindings/v8/V8AbstractEventListener.cpp b/WebCore/bindings/v8/V8AbstractEventListener.cpp index 0f5b5c8..944fd57 100644 --- a/WebCore/bindings/v8/V8AbstractEventListener.cpp +++ b/WebCore/bindings/v8/V8AbstractEventListener.cpp @@ -36,6 +36,7 @@ #include "Event.h" #include "Frame.h" #include "V8Binding.h" +#include "V8Event.h" #include "V8EventListenerList.h" #include "V8Proxy.h" #include "V8Utilities.h" @@ -84,7 +85,7 @@ void V8AbstractEventListener::handleEvent(ScriptExecutionContext* context, Event v8::Context::Scope scope(v8Context); // Get the V8 wrapper for the event object. - v8::Handle<v8::Value> jsEvent = V8DOMWrapper::convertEventToV8Object(event); + v8::Handle<v8::Value> jsEvent = toV8(event); invokeEventHandler(context, event, jsEvent); diff --git a/WebCore/bindings/v8/V8Collection.h b/WebCore/bindings/v8/V8Collection.h index 84150d8..9611571 100644 --- a/WebCore/bindings/v8/V8Collection.h +++ b/WebCore/bindings/v8/V8Collection.h @@ -38,155 +38,149 @@ #include <v8.h> namespace WebCore { - // FIXME: These functions should be named using to* since they return the item (get* is used for method that take a ref param). - // See https://bugs.webkit.org/show_bug.cgi?id=24664. - - inline v8::Handle<v8::Value> getV8Object(void* implementation, v8::Local<v8::Value> implementationType) - { - if (!implementation) - return v8::Handle<v8::Value>(); - V8ClassIndex::V8WrapperType type = V8ClassIndex::FromInt(implementationType->Int32Value()); - if (type == V8ClassIndex::NODE) - return V8DOMWrapper::convertNodeToV8Object(static_cast<Node*>(implementation)); - return V8DOMWrapper::convertToV8Object(type, implementation); +// FIXME: These functions should be named using to* since they return the item (get* is used for method that take a ref param). +// See https://bugs.webkit.org/show_bug.cgi?id=24664. + +template<class T> static v8::Handle<v8::Value> getV8Object(T* implementation) +{ + if (!implementation) + return v8::Handle<v8::Value>(); + return toV8(implementation); +} + +template<class Collection> static Collection* toNativeCollection(v8::Local<v8::Object> object) +{ + return reinterpret_cast<Collection*>(object->GetPointerFromInternalField(v8DOMWrapperObjectIndex)); +} + +template<class T> static v8::Handle<v8::Value> getV8Object(PassRefPtr<T> implementation) +{ + return getV8Object(implementation.get()); +} + +// Returns named property of a collection. +template<class Collection, class ItemType> static v8::Handle<v8::Value> getNamedPropertyOfCollection(v8::Local<v8::String> name, v8::Local<v8::Object> object) +{ + // FIXME: assert object is a collection type + ASSERT(V8DOMWrapper::maybeDOMWrapper(object)); + ASSERT(V8DOMWrapper::domWrapperType(object) != V8ClassIndex::NODE); + Collection* collection = toNativeCollection<Collection>(object); + AtomicString propertyName = toAtomicWebCoreStringWithNullCheck(name); + return getV8Object<ItemType>(collection->namedItem(propertyName)); +} + +// A template of named property accessor of collections. +template<class Collection, class ItemType> static v8::Handle<v8::Value> collectionNamedPropertyGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) +{ + v8::Handle<v8::Value> value = info.Holder()->GetRealNamedPropertyInPrototypeChain(name); + + if (!value.IsEmpty()) + return value; + + // Search local callback properties next to find IDL defined + // properties. + if (info.Holder()->HasRealNamedCallbackProperty(name)) + return notHandledByInterceptor(); + return getNamedPropertyOfCollection<Collection, ItemType>(name, info.Holder()); +} + +// Returns the property at the index of a collection. +template<class Collection, class ItemType> static v8::Handle<v8::Value> getIndexedPropertyOfCollection(uint32_t index, v8::Local<v8::Object> object) +{ + // FIXME: Assert that object must be a collection type. + ASSERT(V8DOMWrapper::maybeDOMWrapper(object)); + ASSERT(V8DOMWrapper::domWrapperType(object) != V8ClassIndex::NODE); + Collection* collection = toNativeCollection<Collection>(object); + return getV8Object<ItemType>(collection->item(index)); +} + +// A template of index interceptor of collections. +template<class Collection, class ItemType> static v8::Handle<v8::Value> collectionIndexedPropertyGetter(uint32_t index, const v8::AccessorInfo& info) +{ + return getIndexedPropertyOfCollection<Collection, ItemType>(index, info.Holder()); +} + +// Get an array containing the names of indexed properties of HTMLSelectElement and HTMLFormElement. +template<class Collection> static v8::Handle<v8::Array> nodeCollectionIndexedPropertyEnumerator(const v8::AccessorInfo& info) +{ + ASSERT(V8DOMWrapper::maybeDOMWrapper(info.Holder())); + Collection* collection = toNativeCollection<Collection>(info.Holder()); + int length = collection->length(); + v8::Handle<v8::Array> properties = v8::Array::New(length); + for (int i = 0; i < length; ++i) { + // FIXME: Do we need to check that the item function returns a non-null value for this index? + v8::Handle<v8::Integer> integer = v8::Integer::New(i); + properties->Set(integer, integer); } - - template<class Collection> static Collection* toNativeCollection(v8::Local<v8::Object> object) - { - return reinterpret_cast<Collection*>(object->GetPointerFromInternalField(v8DOMWrapperObjectIndex)); - } - - template<class T> static v8::Handle<v8::Value> getV8Object(PassRefPtr<T> implementation, v8::Local<v8::Value> implementationType) - { - return getV8Object(implementation.get(), implementationType); - } - - // Returns named property of a collection. - template<class Collection, class ItemType> static v8::Handle<v8::Value> getNamedPropertyOfCollection(v8::Local<v8::String> name, v8::Local<v8::Object> object, - v8::Local<v8::Value> implementationType) - { - // FIXME: assert object is a collection type - ASSERT(V8DOMWrapper::maybeDOMWrapper(object)); - ASSERT(V8DOMWrapper::domWrapperType(object) != V8ClassIndex::NODE); - Collection* collection = toNativeCollection<Collection>(object); - AtomicString propertyName = toAtomicWebCoreStringWithNullCheck(name); - return getV8Object<ItemType>(collection->namedItem(propertyName), implementationType); - } - - // A template of named property accessor of collections. - template<class Collection, class ItemType> static v8::Handle<v8::Value> collectionNamedPropertyGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) - { - v8::Handle<v8::Value> value = info.Holder()->GetRealNamedPropertyInPrototypeChain(name); - - if (!value.IsEmpty()) - return value; - - // Search local callback properties next to find IDL defined - // properties. - if (info.Holder()->HasRealNamedCallbackProperty(name)) - return notHandledByInterceptor(); - return getNamedPropertyOfCollection<Collection, ItemType>(name, info.Holder(), info.Data()); + return properties; +} + +// Get an array containing the names of indexed properties in a collection. +template<class Collection> static v8::Handle<v8::Array> collectionIndexedPropertyEnumerator(const v8::AccessorInfo& info) +{ + ASSERT(V8DOMWrapper::maybeDOMWrapper(info.Holder())); + Collection* collection = toNativeCollection<Collection>(info.Holder()); + int length = collection->length(); + v8::Handle<v8::Array> properties = v8::Array::New(length); + for (int i = 0; i < length; ++i) { + // FIXME: Do we need to check that the item function returns a non-null value for this index? + v8::Handle<v8::Integer> integer = v8::Integer::New(i); + properties->Set(integer, integer); } - - // Returns the property at the index of a collection. - template<class Collection, class ItemType> static v8::Handle<v8::Value> getIndexedPropertyOfCollection(uint32_t index, v8::Local<v8::Object> object, - v8::Local<v8::Value> implementationType) - { - // FIXME: Assert that object must be a collection type. - ASSERT(V8DOMWrapper::maybeDOMWrapper(object)); - ASSERT(V8DOMWrapper::domWrapperType(object) != V8ClassIndex::NODE); - Collection* collection = toNativeCollection<Collection>(object); - return getV8Object<ItemType>(collection->item(index), implementationType); - } - - // A template of index interceptor of collections. - template<class Collection, class ItemType> static v8::Handle<v8::Value> collectionIndexedPropertyGetter(uint32_t index, const v8::AccessorInfo& info) - { - return getIndexedPropertyOfCollection<Collection, ItemType>(index, info.Holder(), info.Data()); - } - - // Get an array containing the names of indexed properties of HTMLSelectElement and HTMLFormElement. - template<class Collection> static v8::Handle<v8::Array> nodeCollectionIndexedPropertyEnumerator(const v8::AccessorInfo& info) - { - ASSERT(V8DOMWrapper::maybeDOMWrapper(info.Holder())); - ASSERT(V8DOMWrapper::domWrapperType(info.Holder()) == V8ClassIndex::NODE); - Collection* collection = toNativeCollection<Collection>(info.Holder()); - int length = collection->length(); - v8::Handle<v8::Array> properties = v8::Array::New(length); - for (int i = 0; i < length; ++i) { - // FIXME: Do we need to check that the item function returns a non-null value for this index? - v8::Handle<v8::Integer> integer = v8::Integer::New(i); - properties->Set(integer, integer); - } - return properties; - } - - // Get an array containing the names of indexed properties in a collection. - template<class Collection> static v8::Handle<v8::Array> collectionIndexedPropertyEnumerator(const v8::AccessorInfo& info) - { - ASSERT(V8DOMWrapper::maybeDOMWrapper(info.Holder())); - Collection* collection = toNativeCollection<Collection>(info.Holder()); - int length = collection->length(); - v8::Handle<v8::Array> properties = v8::Array::New(length); - for (int i = 0; i < length; ++i) { - // FIXME: Do we need to check that the item function returns a non-null value for this index? - v8::Handle<v8::Integer> integer = v8::Integer::New(i); - properties->Set(integer, integer); - } - return properties; - } - - - // A template for indexed getters on collections of strings that should return null if the resulting string is a null string. - template<class Collection> static v8::Handle<v8::Value> collectionStringOrNullIndexedPropertyGetter(uint32_t index, const v8::AccessorInfo& info) - { - // FIXME: assert that object must be a collection type - ASSERT(V8DOMWrapper::maybeDOMWrapper(info.Holder())); - Collection* collection = toNativeCollection<Collection>(info.Holder()); - String result = collection->item(index); - return v8StringOrNull(result); - } - - - // A template for indexed getters on collections of strings. - template<class Collection> static v8::Handle<v8::Value> collectionStringIndexedPropertyGetter(uint32_t index, const v8::AccessorInfo& info) - { - // FIXME: assert that object must be a collection type - ASSERT(V8DOMWrapper::maybeDOMWrapper(info.Holder())); - Collection* collection = toNativeCollection<Collection>(info.Holder()); - String result = collection->item(index); - return v8String(result); - } - - - // Add indexed getter to the function template for a collection. - template<class Collection, class ItemType> static void setCollectionIndexedGetter(v8::Handle<v8::FunctionTemplate> desc, V8ClassIndex::V8WrapperType type) - { - desc->InstanceTemplate()->SetIndexedPropertyHandler(collectionIndexedPropertyGetter<Collection, ItemType>, 0, 0, 0, collectionIndexedPropertyEnumerator<Collection>, - v8::Integer::New(V8ClassIndex::ToInt(type))); - } - - - // Add named getter to the function template for a collection. - template<class Collection, class ItemType> static void setCollectionNamedGetter(v8::Handle<v8::FunctionTemplate> desc, V8ClassIndex::V8WrapperType type) - { - desc->InstanceTemplate()->SetNamedPropertyHandler(collectionNamedPropertyGetter<Collection, ItemType>, 0, 0, 0, 0, v8::Integer::New(V8ClassIndex::ToInt(type))); - } - - // Add indexed getter returning a string or null to a function template for a collection. - template<class Collection> static void setCollectionStringOrNullIndexedGetter(v8::Handle<v8::FunctionTemplate> desc) - { - desc->InstanceTemplate()->SetIndexedPropertyHandler(collectionStringOrNullIndexedPropertyGetter<Collection>, 0, 0, 0, collectionIndexedPropertyEnumerator<Collection>); - } - - - // Add indexed getter returning a string to a function template for a collection. - template<class Collection> static void setCollectionStringIndexedGetter(v8::Handle<v8::FunctionTemplate> desc) - { - desc->InstanceTemplate()->SetIndexedPropertyHandler(collectionStringIndexedPropertyGetter<Collection>, 0, 0, 0, collectionIndexedPropertyEnumerator<Collection>); - } - - v8::Handle<v8::Value> toOptionsCollectionSetter(uint32_t index, v8::Handle<v8::Value>, HTMLSelectElement*); + return properties; +} + + +// A template for indexed getters on collections of strings that should return null if the resulting string is a null string. +template<class Collection> static v8::Handle<v8::Value> collectionStringOrNullIndexedPropertyGetter(uint32_t index, const v8::AccessorInfo& info) +{ + // FIXME: assert that object must be a collection type + ASSERT(V8DOMWrapper::maybeDOMWrapper(info.Holder())); + Collection* collection = toNativeCollection<Collection>(info.Holder()); + String result = collection->item(index); + return v8StringOrNull(result); +} + + +// A template for indexed getters on collections of strings. +template<class Collection> static v8::Handle<v8::Value> collectionStringIndexedPropertyGetter(uint32_t index, const v8::AccessorInfo& info) +{ + // FIXME: assert that object must be a collection type + ASSERT(V8DOMWrapper::maybeDOMWrapper(info.Holder())); + Collection* collection = toNativeCollection<Collection>(info.Holder()); + String result = collection->item(index); + return v8String(result); +} + + +// Add indexed getter to the function template for a collection. +template<class Collection, class ItemType> static void setCollectionIndexedGetter(v8::Handle<v8::FunctionTemplate> desc, V8ClassIndex::V8WrapperType type) +{ + desc->InstanceTemplate()->SetIndexedPropertyHandler(collectionIndexedPropertyGetter<Collection, ItemType>, 0, 0, 0, collectionIndexedPropertyEnumerator<Collection>, + v8::Integer::New(V8ClassIndex::ToInt(type))); +} + + +// Add named getter to the function template for a collection. +template<class Collection, class ItemType> static void setCollectionNamedGetter(v8::Handle<v8::FunctionTemplate> desc, V8ClassIndex::V8WrapperType type) +{ + desc->InstanceTemplate()->SetNamedPropertyHandler(collectionNamedPropertyGetter<Collection, ItemType>, 0, 0, 0, 0, v8::Integer::New(V8ClassIndex::ToInt(type))); +} + +// Add indexed getter returning a string or null to a function template for a collection. +template<class Collection> static void setCollectionStringOrNullIndexedGetter(v8::Handle<v8::FunctionTemplate> desc) +{ + desc->InstanceTemplate()->SetIndexedPropertyHandler(collectionStringOrNullIndexedPropertyGetter<Collection>, 0, 0, 0, collectionIndexedPropertyEnumerator<Collection>); +} + + +// Add indexed getter returning a string to a function template for a collection. +template<class Collection> static void setCollectionStringIndexedGetter(v8::Handle<v8::FunctionTemplate> desc) +{ + desc->InstanceTemplate()->SetIndexedPropertyHandler(collectionStringIndexedPropertyGetter<Collection>, 0, 0, 0, collectionIndexedPropertyEnumerator<Collection>); +} + +v8::Handle<v8::Value> toOptionsCollectionSetter(uint32_t index, v8::Handle<v8::Value>, HTMLSelectElement*); } // namespace WebCore diff --git a/WebCore/bindings/v8/V8DOMWindowShell.cpp b/WebCore/bindings/v8/V8DOMWindowShell.cpp index 7e1452b..683fea5 100644 --- a/WebCore/bindings/v8/V8DOMWindowShell.cpp +++ b/WebCore/bindings/v8/V8DOMWindowShell.cpp @@ -48,9 +48,9 @@ #include "V8BindingState.h" #include "V8Collection.h" #include "V8ConsoleMessage.h" -#include "V8CustomBinding.h" #include "V8DOMMap.h" #include "V8DOMWindow.h" +#include "V8Document.h" #include "V8HiddenPropertyName.h" #include "V8History.h" #include "V8Index.h" @@ -430,7 +430,7 @@ void V8DOMWindowShell::updateDocumentWrapperCache() return; } - v8::Handle<v8::Value> documentWrapper = V8DOMWrapper::convertNodeToV8Object(m_frame->document()); + v8::Handle<v8::Value> documentWrapper = toV8(m_frame->document()); // If instantiation of the document wrapper fails, clear the cache // and let the DOMWindow accessor handle access to the document. diff --git a/WebCore/bindings/v8/V8DOMWrapper.cpp b/WebCore/bindings/v8/V8DOMWrapper.cpp index a24742d..fd0edc5 100644 --- a/WebCore/bindings/v8/V8DOMWrapper.cpp +++ b/WebCore/bindings/v8/V8DOMWrapper.cpp @@ -43,8 +43,8 @@ #include "V8AbstractEventListener.h" #include "V8Binding.h" #include "V8Collection.h" -#include "V8CustomBinding.h" #include "V8CustomEventListener.h" +#include "V8DOMApplicationCache.h" #include "V8DOMMap.h" #include "V8DOMWindow.h" #include "V8EventListenerList.h" @@ -52,12 +52,18 @@ #include "V8HTMLDocument.h" #include "V8Index.h" #include "V8IsolatedContext.h" -#include "V8MessageChannel.h" #include "V8Location.h" +#include "V8MessageChannel.h" #include "V8NamedNodeMap.h" +#include "V8Node.h" #include "V8NodeList.h" +#include "V8Notification.h" #include "V8Proxy.h" +#include "V8SVGElementInstance.h" +#include "V8SharedWorker.h" #include "V8StyleSheet.h" +#include "V8WebSocket.h" +#include "V8Worker.h" #include "WebGLArray.h" #include "WebGLContextAttributes.h" #include "WebGLUniformLocation.h" @@ -77,93 +83,6 @@ namespace WebCore { typedef HashMap<Node*, v8::Object*> DOMNodeMap; typedef HashMap<void*, v8::Object*> DOMObjectMap; -#if ENABLE(SVG) - -static V8ClassIndex::V8WrapperType downcastSVGPathSeg(void* pathSeg) -{ - SVGPathSeg* realPathSeg = reinterpret_cast<SVGPathSeg*>(pathSeg); - - switch (realPathSeg->pathSegType()) { - case SVGPathSeg::PATHSEG_CLOSEPATH: return V8ClassIndex::SVGPATHSEGCLOSEPATH; - case SVGPathSeg::PATHSEG_MOVETO_ABS: return V8ClassIndex::SVGPATHSEGMOVETOABS; - case SVGPathSeg::PATHSEG_MOVETO_REL: return V8ClassIndex::SVGPATHSEGMOVETOREL; - case SVGPathSeg::PATHSEG_LINETO_ABS: return V8ClassIndex::SVGPATHSEGLINETOABS; - case SVGPathSeg::PATHSEG_LINETO_REL: return V8ClassIndex::SVGPATHSEGLINETOREL; - case SVGPathSeg::PATHSEG_CURVETO_CUBIC_ABS: return V8ClassIndex::SVGPATHSEGCURVETOCUBICABS; - case SVGPathSeg::PATHSEG_CURVETO_CUBIC_REL: return V8ClassIndex::SVGPATHSEGCURVETOCUBICREL; - case SVGPathSeg::PATHSEG_CURVETO_QUADRATIC_ABS: return V8ClassIndex::SVGPATHSEGCURVETOQUADRATICABS; - case SVGPathSeg::PATHSEG_CURVETO_QUADRATIC_REL: return V8ClassIndex::SVGPATHSEGCURVETOQUADRATICREL; - case SVGPathSeg::PATHSEG_ARC_ABS: return V8ClassIndex::SVGPATHSEGARCABS; - case SVGPathSeg::PATHSEG_ARC_REL: return V8ClassIndex::SVGPATHSEGARCREL; - case SVGPathSeg::PATHSEG_LINETO_HORIZONTAL_ABS: return V8ClassIndex::SVGPATHSEGLINETOHORIZONTALABS; - case SVGPathSeg::PATHSEG_LINETO_HORIZONTAL_REL: return V8ClassIndex::SVGPATHSEGLINETOHORIZONTALREL; - case SVGPathSeg::PATHSEG_LINETO_VERTICAL_ABS: return V8ClassIndex::SVGPATHSEGLINETOVERTICALABS; - case SVGPathSeg::PATHSEG_LINETO_VERTICAL_REL: return V8ClassIndex::SVGPATHSEGLINETOVERTICALREL; - case SVGPathSeg::PATHSEG_CURVETO_CUBIC_SMOOTH_ABS: return V8ClassIndex::SVGPATHSEGCURVETOCUBICSMOOTHABS; - case SVGPathSeg::PATHSEG_CURVETO_CUBIC_SMOOTH_REL: return V8ClassIndex::SVGPATHSEGCURVETOCUBICSMOOTHREL; - case SVGPathSeg::PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS: return V8ClassIndex::SVGPATHSEGCURVETOQUADRATICSMOOTHABS; - case SVGPathSeg::PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL: return V8ClassIndex::SVGPATHSEGCURVETOQUADRATICSMOOTHREL; - default: return V8ClassIndex::INVALID_CLASS_INDEX; - } -} - -v8::Handle<v8::Value> V8DOMWrapper::convertSVGElementInstanceToV8Object(SVGElementInstance* instance) -{ - if (!instance) - return v8::Null(); - - v8::Handle<v8::Object> existingInstance = getDOMSVGElementInstanceMap().get(instance); - if (!existingInstance.IsEmpty()) - return existingInstance; - - instance->ref(); - - // Instantiate the V8 object and remember it - v8::Handle<v8::Object> result = instantiateV8Object(V8ClassIndex::SVGELEMENTINSTANCE, V8ClassIndex::SVGELEMENTINSTANCE, instance); - if (!result.IsEmpty()) { - // Only update the DOM SVG element map if the result is non-empty. - getDOMSVGElementInstanceMap().set(instance, v8::Persistent<v8::Object>::New(result)); - } - return result; -} - -v8::Handle<v8::Value> V8DOMWrapper::convertSVGObjectWithContextToV8Object(V8ClassIndex::V8WrapperType type, void* object) -{ - if (!object) - return v8::Null(); - - v8::Persistent<v8::Object> result = getDOMSVGObjectWithContextMap().get(object); - if (!result.IsEmpty()) - return result; - - // Special case: SVGPathSegs need to be downcast to their real type - if (type == V8ClassIndex::SVGPATHSEG) - type = downcastSVGPathSeg(object); - - v8::Local<v8::Object> v8Object = instantiateV8Object(type, type, object); - if (!v8Object.IsEmpty()) { - result = v8::Persistent<v8::Object>::New(v8Object); - switch (type) { -#define MAKE_CASE(TYPE, NAME) \ - case V8ClassIndex::TYPE: static_cast<NAME*>(object)->ref(); break; - SVG_OBJECT_TYPES(MAKE_CASE) -#undef MAKE_CASE -#define MAKE_CASE(TYPE, NAME) \ - case V8ClassIndex::TYPE: \ - static_cast<V8SVGPODTypeWrapper<NAME>*>(object)->ref(); break; - SVG_POD_NATIVE_TYPES(MAKE_CASE) -#undef MAKE_CASE - default: - ASSERT_NOT_REACHED(); - } - getDOMSVGObjectWithContextMap().set(object, result); - } - - return result; -} - -#endif // ENABLE(SVG) - #if ENABLE(3D_CANVAS) void V8DOMWrapper::setIndexedPropertiesToExternalArray(v8::Handle<v8::Object> wrapper, int index, @@ -317,188 +236,6 @@ v8::Local<v8::Function> V8DOMWrapper::getConstructor(V8ClassIndex::V8WrapperType return getConstructorForContext(type, context); } -v8::Handle<v8::Value> V8DOMWrapper::convertToV8Object(V8ClassIndex::V8WrapperType type, void* impl) -{ - ASSERT(type != V8ClassIndex::EVENTLISTENER); - ASSERT(type != V8ClassIndex::EVENTTARGET); - ASSERT(type != V8ClassIndex::EVENT); - - // These objects can be constructed under WorkerContextExecutionProxy. They need special - // handling, since if we proceed below V8Proxy::retrieve() will get called and will crash. - // TODO(ukai): websocket? - if ((type == V8ClassIndex::DOMCOREEXCEPTION - || type == V8ClassIndex::RANGEEXCEPTION - || type == V8ClassIndex::EVENTEXCEPTION - || type == V8ClassIndex::XMLHTTPREQUESTEXCEPTION - || type == V8ClassIndex::MESSAGEPORT) - && WorkerContextExecutionProxy::retrieve()) { - return WorkerContextExecutionProxy::convertToV8Object(type, impl); - } - - bool isActiveDomObject = false; - switch (type) { -#define MAKE_CASE(TYPE, NAME) case V8ClassIndex::TYPE: - DOM_NODE_TYPES(MAKE_CASE) -#if ENABLE(SVG) - SVG_NODE_TYPES(MAKE_CASE) -#endif - return convertNodeToV8Object(static_cast<Node*>(impl)); - case V8ClassIndex::CSSVALUE: - return convertCSSValueToV8Object(static_cast<CSSValue*>(impl)); - case V8ClassIndex::CSSRULE: - return convertCSSRuleToV8Object(static_cast<CSSRule*>(impl)); - case V8ClassIndex::STYLESHEET: - return convertStyleSheetToV8Object(static_cast<StyleSheet*>(impl)); - case V8ClassIndex::DOMWINDOW: - return convertWindowToV8Object(static_cast<DOMWindow*>(impl)); - case V8ClassIndex::NAMEDNODEMAP: - return convertNamedNodeMapToV8Object(static_cast<NamedNodeMap*>(impl)); -#if ENABLE(SVG) - SVG_NONNODE_TYPES(MAKE_CASE) - if (type == V8ClassIndex::SVGELEMENTINSTANCE) - return convertSVGElementInstanceToV8Object(static_cast<SVGElementInstance*>(impl)); - return convertSVGObjectWithContextToV8Object(type, impl); -#endif - - ACTIVE_DOM_OBJECT_TYPES(MAKE_CASE) - isActiveDomObject = true; - break; - default: - break; - } - -#undef MAKE_CASE - - if (!impl) - return v8::Null(); - - // Non DOM node - v8::Persistent<v8::Object> result = isActiveDomObject ? getActiveDOMObjectMap().get(impl) : getDOMObjectMap().get(impl); - if (result.IsEmpty()) { -#if ENABLE(3D_CANVAS) - if (type == V8ClassIndex::WEBGLARRAY && impl) { - // Determine which subclass we are wrapping. - WebGLArray* array = reinterpret_cast<WebGLArray*>(impl); - if (array->isByteArray()) - type = V8ClassIndex::WEBGLBYTEARRAY; - else if (array->isFloatArray()) - type = V8ClassIndex::WEBGLFLOATARRAY; - else if (array->isIntArray()) - type = V8ClassIndex::WEBGLINTARRAY; - else if (array->isShortArray()) - type = V8ClassIndex::WEBGLSHORTARRAY; - else if (array->isUnsignedByteArray()) - type = V8ClassIndex::WEBGLUNSIGNEDBYTEARRAY; - else if (array->isUnsignedIntArray()) - type = V8ClassIndex::WEBGLUNSIGNEDINTARRAY; - else if (array->isUnsignedShortArray()) - type = V8ClassIndex::WEBGLUNSIGNEDSHORTARRAY; - } -#endif - - v8::Local<v8::Object> v8Object = instantiateV8Object(type, type, impl); - if (!v8Object.IsEmpty()) { - // Go through big switch statement, it has some duplications - // that were handled by code above (such as CSSVALUE, CSSRULE, etc). - switch (type) { -#define MAKE_CASE(TYPE, NAME) \ - case V8ClassIndex::TYPE: static_cast<NAME*>(impl)->ref(); break; - DOM_OBJECT_TYPES(MAKE_CASE) -#undef MAKE_CASE - default: - ASSERT_NOT_REACHED(); - } - result = v8::Persistent<v8::Object>::New(v8Object); - if (isActiveDomObject) - setJSWrapperForActiveDOMObject(impl, result); - else - setJSWrapperForDOMObject(impl, result); - - if (type == V8ClassIndex::CANVASPIXELARRAY) { - CanvasPixelArray* pixels = reinterpret_cast<CanvasPixelArray*>(impl); - result->SetIndexedPropertiesToPixelData(pixels->data()->data(), pixels->length()); - } - -#if ENABLE(3D_CANVAS) - // Set up WebGLArray subclasses' accesses similarly. - switch (type) { - case V8ClassIndex::WEBGLBYTEARRAY: - case V8ClassIndex::WEBGLUNSIGNEDBYTEARRAY: - case V8ClassIndex::WEBGLSHORTARRAY: - case V8ClassIndex::WEBGLUNSIGNEDSHORTARRAY: - case V8ClassIndex::WEBGLINTARRAY: - case V8ClassIndex::WEBGLUNSIGNEDINTARRAY: - case V8ClassIndex::WEBGLFLOATARRAY: { - WebGLArray* array = reinterpret_cast<WebGLArray*>(impl); - setIndexedPropertiesToExternalArray(result, - V8ClassIndex::ToInt(type), - array->baseAddress(), - array->length()); - break; - } - default: - break; - } -#endif - - // Special case for non-node objects associated with a - // DOMWindow. Both Safari and FF let the JS wrappers for these - // objects survive GC. To mimic their behavior, V8 creates - // hidden references from the DOMWindow to these wrapper - // objects. These references get cleared when the DOMWindow is - // reused by a new page. - switch (type) { - case V8ClassIndex::CONSOLE: - setHiddenWindowReference(static_cast<Console*>(impl)->frame(), V8DOMWindow::consoleIndex, result); - break; - case V8ClassIndex::HISTORY: - setHiddenWindowReference(static_cast<History*>(impl)->frame(), V8DOMWindow::historyIndex, result); - break; - case V8ClassIndex::NAVIGATOR: - setHiddenWindowReference(static_cast<Navigator*>(impl)->frame(), V8DOMWindow::navigatorIndex, result); - break; - case V8ClassIndex::SCREEN: - setHiddenWindowReference(static_cast<Screen*>(impl)->frame(), V8DOMWindow::screenIndex, result); - break; - case V8ClassIndex::LOCATION: - setHiddenWindowReference(static_cast<Location*>(impl)->frame(), V8DOMWindow::locationIndex, result); - break; - case V8ClassIndex::DOMSELECTION: - setHiddenWindowReference(static_cast<DOMSelection*>(impl)->frame(), V8DOMWindow::domSelectionIndex, result); - break; - case V8ClassIndex::BARINFO: { - BarInfo* barInfo = static_cast<BarInfo*>(impl); - Frame* frame = barInfo->frame(); - switch (barInfo->type()) { - case BarInfo::Locationbar: - setHiddenWindowReference(frame, V8DOMWindow::locationbarIndex, result); - break; - case BarInfo::Menubar: - setHiddenWindowReference(frame, V8DOMWindow::menubarIndex, result); - break; - case BarInfo::Personalbar: - setHiddenWindowReference(frame, V8DOMWindow::personalbarIndex, result); - break; - case BarInfo::Scrollbars: - setHiddenWindowReference(frame, V8DOMWindow::scrollbarsIndex, result); - break; - case BarInfo::Statusbar: - setHiddenWindowReference(frame, V8DOMWindow::statusbarIndex, result); - break; - case BarInfo::Toolbar: - setHiddenWindowReference(frame, V8DOMWindow::toolbarIndex, result); - break; - } - break; - } - default: - break; - } - } - } - return result; -} - void V8DOMWrapper::setHiddenWindowReference(Frame* frame, const int internalIndex, v8::Handle<v8::Object> jsObject) { // Get DOMWindow @@ -542,12 +279,8 @@ PassRefPtr<NodeFilter> V8DOMWrapper::wrapNativeNodeFilter(v8::Handle<v8::Value> return NodeFilter::create(condition); } -v8::Local<v8::Object> V8DOMWrapper::instantiateV8Object(V8Proxy* proxy, V8ClassIndex::V8WrapperType descriptorType, V8ClassIndex::V8WrapperType cptrType, void* impl) +v8::Local<v8::Object> V8DOMWrapper::instantiateV8Object(V8Proxy* proxy, V8ClassIndex::V8WrapperType type, void* impl) { - // Make a special case for document.all - if (descriptorType == V8ClassIndex::HTMLCOLLECTION && static_cast<HTMLCollection*>(impl)->type() == DocAll) - descriptorType = V8ClassIndex::HTMLALLCOLLECTION; - if (V8IsolatedContext::getEntered()) { // This effectively disables the wrapper cache for isolated worlds. proxy = 0; @@ -560,14 +293,14 @@ v8::Local<v8::Object> V8DOMWrapper::instantiateV8Object(V8Proxy* proxy, V8ClassI v8::Local<v8::Object> instance; if (proxy) // FIXME: Fix this to work properly with isolated worlds (see above). - instance = proxy->windowShell()->createWrapperFromCache(descriptorType); + instance = proxy->windowShell()->createWrapperFromCache(type); else { - v8::Local<v8::Function> function = getTemplate(descriptorType)->GetFunction(); + v8::Local<v8::Function> function = getTemplate(type)->GetFunction(); instance = SafeAllocation::newInstance(function); } if (!instance.IsEmpty()) { // Avoid setting the DOM wrapper for failed allocations. - setDOMWrapper(instance, V8ClassIndex::ToInt(cptrType), impl); + setDOMWrapper(instance, V8ClassIndex::ToInt(type), impl); } return instance; } @@ -595,13 +328,6 @@ bool V8DOMWrapper::maybeDOMWrapper(v8::Handle<v8::Value> value) } #endif -bool V8DOMWrapper::isDOMEventWrapper(v8::Handle<v8::Value> value) -{ - // All kinds of events use EVENT as dom type in JS wrappers. - // See EventToV8Object - return isWrapperOfType(value, V8ClassIndex::EVENT); -} - bool V8DOMWrapper::isWrapperOfType(v8::Handle<v8::Value> value, V8ClassIndex::V8WrapperType classType) { if (value.IsEmpty() || !value->IsObject()) @@ -623,6 +349,7 @@ bool V8DOMWrapper::isWrapperOfType(v8::Handle<v8::Value> value, V8ClassIndex::V8 return V8ClassIndex::FromInt(type->Int32Value()) == classType; } +<<<<<<< HEAD #if ENABLE(VIDEO) #define FOR_EACH_VIDEO_TAG(macro) \ macro(audio, AUDIO) \ @@ -982,13 +709,16 @@ v8::Handle<v8::Value> V8DOMWrapper::convertDocumentToV8Object(Document* document } static v8::Handle<v8::Value> getWrapper(Node* node) +======= +v8::Handle<v8::Object> V8DOMWrapper::getWrapper(Node* node) +>>>>>>> webkit.org at r54340 { ASSERT(WTF::isMainThread()); V8IsolatedContext* context = V8IsolatedContext::getEntered(); if (LIKELY(!context)) { v8::Persistent<v8::Object>* wrapper = node->wrapper(); if (!wrapper) - return v8::Handle<v8::Value>(); + return v8::Handle<v8::Object>(); return *wrapper; } @@ -996,101 +726,6 @@ static v8::Handle<v8::Value> getWrapper(Node* node) return domNodeMap.get(node); } -v8::Handle<v8::Value> V8DOMWrapper::convertNodeToV8Object(Node* node) -{ - if (!node) - return v8::Null(); - - v8::Handle<v8::Value> wrapper = getWrapper(node); - if (!wrapper.IsEmpty()) - return wrapper; - - Document* document = node->document(); - if (node == document) - return convertDocumentToV8Object(document); - - return convertNewNodeToV8Object(node, 0, getDOMNodeMap()); -} - -// Caller checks node is not null. -v8::Handle<v8::Value> V8DOMWrapper::convertNewNodeToV8Object(Node* node, V8Proxy* proxy, DOMNodeMapping& domNodeMap) -{ - if (!proxy && node->document()) - proxy = V8Proxy::retrieve(node->document()->frame()); - - bool isDocument = false; // document type node has special handling - V8ClassIndex::V8WrapperType type; - - Node::NodeType nodeType = node->nodeType(); - if (nodeType == Node::ELEMENT_NODE) { - if (node->isHTMLElement()) - type = htmlElementType(static_cast<HTMLElement*>(node)); -#if ENABLE(SVG) - else if (node->isSVGElement()) - type = svgElementType(static_cast<SVGElement*>(node)); -#endif - else - type = V8ClassIndex::ELEMENT; - } else if (nodeType == Node::DOCUMENT_NODE) { - isDocument = true; - Document* document = static_cast<Document*>(node); - if (document->isHTMLDocument()) - type = V8ClassIndex::HTMLDOCUMENT; -#if ENABLE(SVG) - else if (document->isSVGDocument()) - type = V8ClassIndex::SVGDOCUMENT; -#endif - else - type = V8ClassIndex::DOCUMENT; - } else { - ASSERT(nodeType < static_cast<int>(sizeof(mapping)/sizeof(mapping[0]))); - type = mapping[nodeType]; - ASSERT(type != V8ClassIndex::INVALID_CLASS_INDEX); - } - - v8::Handle<v8::Context> context; - if (proxy) - context = proxy->context(); - - // Enter the node's context and create the wrapper in that context. - if (!context.IsEmpty()) - context->Enter(); - - v8::Local<v8::Object> result = instantiateV8Object(proxy, type, V8ClassIndex::NODE, node); - - // Exit the node's context if it was entered. - if (!context.IsEmpty()) - context->Exit(); - - if (result.IsEmpty()) { - // If instantiation failed it's important not to add the result - // to the DOM node map. Instead we return an empty handle, which - // should already be handled by callers of this function in case - // the node is NULL. - return result; - } - - node->ref(); - domNodeMap.set(node, v8::Persistent<v8::Object>::New(result)); - - if (isDocument) { - if (proxy) - proxy->windowShell()->updateDocumentWrapper(result); - - if (type == V8ClassIndex::HTMLDOCUMENT) { - // Create marker object and insert it in two internal fields. - // This is used to implement temporary shadowing of - // document.all. - ASSERT(result->InternalFieldCount() == V8HTMLDocument::internalFieldCount); - v8::Local<v8::Object> marker = v8::Object::New(); - result->SetInternalField(V8HTMLDocument::markerIndex, marker); - result->SetInternalField(V8HTMLDocument::shadowIndex, marker); - } - } - - return result; -} - // A JS object of type EventTarget is limited to a small number of possible classes. // Check EventTarget.h for new type conversion methods v8::Handle<v8::Value> V8DOMWrapper::convertEventTargetToV8Object(EventTarget* target) @@ -1099,91 +734,70 @@ v8::Handle<v8::Value> V8DOMWrapper::convertEventTargetToV8Object(EventTarget* ta return v8::Null(); #if ENABLE(SVG) - SVGElementInstance* instance = target->toSVGElementInstance(); - if (instance) - return convertToV8Object(V8ClassIndex::SVGELEMENTINSTANCE, instance); + if (SVGElementInstance* instance = target->toSVGElementInstance()) + return toV8(instance); #endif #if ENABLE(WORKERS) - Worker* worker = target->toWorker(); - if (worker) - return convertToV8Object(V8ClassIndex::WORKER, worker); + if (Worker* worker = target->toWorker()) + return toV8(worker); #endif // WORKERS #if ENABLE(SHARED_WORKERS) - SharedWorker* sharedWorker = target->toSharedWorker(); - if (sharedWorker) - return convertToV8Object(V8ClassIndex::SHAREDWORKER, sharedWorker); + if (SharedWorker* sharedWorker = target->toSharedWorker()) + return toV8(sharedWorker); #endif // SHARED_WORKERS #if ENABLE(NOTIFICATIONS) - Notification* notification = target->toNotification(); - if (notification) - return convertToV8Object(V8ClassIndex::NOTIFICATION, notification); + if (Notification* notification = target->toNotification()) + return toV8(notification); #endif #if ENABLE(WEB_SOCKETS) - WebSocket* webSocket = target->toWebSocket(); - if (webSocket) - return convertToV8Object(V8ClassIndex::WEBSOCKET, webSocket); + if (WebSocket* webSocket = target->toWebSocket()) + return toV8(webSocket); #endif - Node* node = target->toNode(); - if (node) - return convertNodeToV8Object(node); + if (Node* node = target->toNode()) + return toV8(node); if (DOMWindow* domWindow = target->toDOMWindow()) - return convertToV8Object(V8ClassIndex::DOMWINDOW, domWindow); + return toV8(domWindow); // XMLHttpRequest is created within its JS counterpart. - XMLHttpRequest* xmlHttpRequest = target->toXMLHttpRequest(); - if (xmlHttpRequest) { + if (XMLHttpRequest* xmlHttpRequest = target->toXMLHttpRequest()) { v8::Handle<v8::Object> wrapper = getActiveDOMObjectMap().get(xmlHttpRequest); ASSERT(!wrapper.IsEmpty()); return wrapper; } // MessagePort is created within its JS counterpart - MessagePort* port = target->toMessagePort(); - if (port) { + if (MessagePort* port = target->toMessagePort()) { v8::Handle<v8::Object> wrapper = getActiveDOMObjectMap().get(port); ASSERT(!wrapper.IsEmpty()); return wrapper; } - XMLHttpRequestUpload* upload = target->toXMLHttpRequestUpload(); - if (upload) { + if (XMLHttpRequestUpload* upload = target->toXMLHttpRequestUpload()) { v8::Handle<v8::Object> wrapper = getDOMObjectMap().get(upload); ASSERT(!wrapper.IsEmpty()); return wrapper; } #if ENABLE(OFFLINE_WEB_APPLICATIONS) - DOMApplicationCache* domAppCache = target->toDOMApplicationCache(); - if (domAppCache) - return convertToV8Object(V8ClassIndex::DOMAPPLICATIONCACHE, domAppCache); + if (DOMApplicationCache* domAppCache = target->toDOMApplicationCache()) + return toV8(domAppCache); #endif #if ENABLE(EVENTSOURCE) - EventSource* eventSource = target->toEventSource(); - if (eventSource) - return convertToV8Object(V8ClassIndex::EVENTSOURCE, eventSource); + if (EventSource* eventSource = target->toEventSource()) + return toV8(eventSource); #endif ASSERT(0); return notHandledByInterceptor(); } -v8::Handle<v8::Value> V8DOMWrapper::convertEventListenerToV8Object(ScriptExecutionContext* context, EventListener* listener) -{ - if (!listener) - return v8::Null(); - - // FIXME: can a user take a lazy event listener and set to other places? - V8AbstractEventListener* v8listener = static_cast<V8AbstractEventListener*>(listener); - return v8listener->getListenerObject(context); -} - PassRefPtr<EventListener> V8DOMWrapper::getEventListener(Node* node, v8::Local<v8::Value> value, bool isAttribute, ListenerLookupType lookup) { return (lookup == ListenerFindOnly) ? V8EventListenerList::findWrapper(value, isAttribute) : V8EventListenerList::findOrCreateWrapper<V8EventListener>(value, isAttribute); @@ -1269,193 +883,4 @@ PassRefPtr<EventListener> V8DOMWrapper::getEventListener(V8Proxy* proxy, v8::Loc return (lookup == ListenerFindOnly) ? V8EventListenerList::findWrapper(value, isAttribute) : V8EventListenerList::findOrCreateWrapper<V8EventListener>(value, isAttribute); } -v8::Handle<v8::Value> V8DOMWrapper::convertDOMImplementationToV8Object(DOMImplementation* impl) -{ - v8::Handle<v8::Object> result = instantiateV8Object(V8ClassIndex::DOMIMPLEMENTATION, V8ClassIndex::DOMIMPLEMENTATION, impl); - if (result.IsEmpty()) { - // If the instantiation failed, we ignore it and return null instead - // of returning an empty handle. - return v8::Null(); - } - return result; -} - -v8::Handle<v8::Value> V8DOMWrapper::convertStyleSheetToV8Object(StyleSheet* sheet) -{ - if (!sheet) - return v8::Null(); - - v8::Handle<v8::Object> wrapper = getDOMObjectMap().get(sheet); - if (!wrapper.IsEmpty()) - return wrapper; - - V8ClassIndex::V8WrapperType type = V8ClassIndex::STYLESHEET; - if (sheet->isCSSStyleSheet()) - type = V8ClassIndex::CSSSTYLESHEET; - - v8::Handle<v8::Object> result = instantiateV8Object(type, V8ClassIndex::STYLESHEET, sheet); - if (!result.IsEmpty()) { - // Only update the DOM object map if the result is non-empty. - sheet->ref(); - setJSWrapperForDOMObject(sheet, v8::Persistent<v8::Object>::New(result)); - } - - // Add a hidden reference from stylesheet object to its owner node. - Node* ownerNode = sheet->ownerNode(); - if (ownerNode) { - v8::Handle<v8::Object> owner = v8::Handle<v8::Object>::Cast(convertNodeToV8Object(ownerNode)); - result->SetInternalField(V8StyleSheet::ownerNodeIndex, owner); - } - - return result; -} - -v8::Handle<v8::Value> V8DOMWrapper::convertCSSValueToV8Object(CSSValue* value) -{ - if (!value) - return v8::Null(); - - v8::Handle<v8::Object> wrapper = getDOMObjectMap().get(value); - if (!wrapper.IsEmpty()) - return wrapper; - - V8ClassIndex::V8WrapperType type; - - if (value->isWebKitCSSTransformValue()) - type = V8ClassIndex::WEBKITCSSTRANSFORMVALUE; - else if (value->isValueList()) - type = V8ClassIndex::CSSVALUELIST; - else if (value->isPrimitiveValue()) - type = V8ClassIndex::CSSPRIMITIVEVALUE; -#if ENABLE(SVG) - else if (value->isSVGPaint()) - type = V8ClassIndex::SVGPAINT; - else if (value->isSVGColor()) - type = V8ClassIndex::SVGCOLOR; -#endif - else - type = V8ClassIndex::CSSVALUE; - - v8::Handle<v8::Object> result = instantiateV8Object(type, V8ClassIndex::CSSVALUE, value); - if (!result.IsEmpty()) { - // Only update the DOM object map if the result is non-empty. - value->ref(); - setJSWrapperForDOMObject(value, v8::Persistent<v8::Object>::New(result)); - } - - return result; -} - -v8::Handle<v8::Value> V8DOMWrapper::convertCSSRuleToV8Object(CSSRule* rule) -{ - if (!rule) - return v8::Null(); - - v8::Handle<v8::Object> wrapper = getDOMObjectMap().get(rule); - if (!wrapper.IsEmpty()) - return wrapper; - - V8ClassIndex::V8WrapperType type; - - switch (rule->type()) { - case CSSRule::STYLE_RULE: - type = V8ClassIndex::CSSSTYLERULE; - break; - case CSSRule::CHARSET_RULE: - type = V8ClassIndex::CSSCHARSETRULE; - break; - case CSSRule::IMPORT_RULE: - type = V8ClassIndex::CSSIMPORTRULE; - break; - case CSSRule::MEDIA_RULE: - type = V8ClassIndex::CSSMEDIARULE; - break; - case CSSRule::FONT_FACE_RULE: - type = V8ClassIndex::CSSFONTFACERULE; - break; - case CSSRule::PAGE_RULE: - type = V8ClassIndex::CSSPAGERULE; - break; - case CSSRule::VARIABLES_RULE: - type = V8ClassIndex::CSSVARIABLESRULE; - break; - case CSSRule::WEBKIT_KEYFRAME_RULE: - type = V8ClassIndex::WEBKITCSSKEYFRAMERULE; - break; - case CSSRule::WEBKIT_KEYFRAMES_RULE: - type = V8ClassIndex::WEBKITCSSKEYFRAMESRULE; - break; - default: // CSSRule::UNKNOWN_RULE - type = V8ClassIndex::CSSRULE; - break; - } - - v8::Handle<v8::Object> result = instantiateV8Object(type, V8ClassIndex::CSSRULE, rule); - if (!result.IsEmpty()) { - // Only update the DOM object map if the result is non-empty. - rule->ref(); - setJSWrapperForDOMObject(rule, v8::Persistent<v8::Object>::New(result)); - } - return result; -} - -v8::Handle<v8::Value> V8DOMWrapper::convertWindowToV8Object(DOMWindow* window) -{ - if (!window) - return v8::Null(); - // Initializes environment of a frame, and return the global object - // of the frame. - Frame* frame = window->frame(); - if (!frame) - return v8::Handle<v8::Object>(); - - // Special case: Because of evaluateInIsolatedWorld() one DOMWindow can have - // multiple contexts and multiple global objects associated with it. When - // code running in one of those contexts accesses the window object, we - // want to return the global object associated with that context, not - // necessarily the first global object associated with that DOMWindow. - v8::Handle<v8::Context> currentContext = v8::Context::GetCurrent(); - v8::Handle<v8::Object> currentGlobal = currentContext->Global(); - v8::Handle<v8::Object> windowWrapper = V8DOMWrapper::lookupDOMWrapper(V8ClassIndex::DOMWINDOW, currentGlobal); - if (!windowWrapper.IsEmpty()) { - if (V8DOMWindow::toNative(windowWrapper) == window) - return currentGlobal; - } - - // Otherwise, return the global object associated with this frame. - v8::Handle<v8::Context> context = V8Proxy::context(frame); - if (context.IsEmpty()) - return v8::Handle<v8::Object>(); - - v8::Handle<v8::Object> global = context->Global(); - ASSERT(!global.IsEmpty()); - return global; -} - -v8::Handle<v8::Value> V8DOMWrapper::convertNamedNodeMapToV8Object(NamedNodeMap* map) -{ - if (!map) - return v8::Null(); - - v8::Handle<v8::Object> wrapper = getDOMObjectMap().get(map); - if (!wrapper.IsEmpty()) - return wrapper; - - v8::Handle<v8::Object> result = instantiateV8Object(V8ClassIndex::NAMEDNODEMAP, V8ClassIndex::NAMEDNODEMAP, map); - if (result.IsEmpty()) - return result; - - // Only update the DOM object map if the result is non-empty. - map->ref(); - setJSWrapperForDOMObject(map, v8::Persistent<v8::Object>::New(result)); - - // Add a hidden reference from named node map to its owner node. - if (Element* element = map->element()) { - v8::Handle<v8::Object> owner = v8::Handle<v8::Object>::Cast(convertNodeToV8Object(element)); - result->SetInternalField(V8NamedNodeMap::ownerNodeIndex, owner); - } - - return result; -} - } // namespace WebCore diff --git a/WebCore/bindings/v8/V8DOMWrapper.h b/WebCore/bindings/v8/V8DOMWrapper.h index 3cff691..51abff7 100644 --- a/WebCore/bindings/v8/V8DOMWrapper.h +++ b/WebCore/bindings/v8/V8DOMWrapper.h @@ -36,7 +36,6 @@ #include "Node.h" #include "NodeFilter.h" #include "PlatformString.h" // for WebCore::String -#include "V8CustomBinding.h" #include "V8CustomXPathNSResolver.h" #include "V8DOMMap.h" #include "V8Event.h" @@ -123,45 +122,8 @@ namespace WebCore { return object.IsEmpty() ? object : object->FindInstanceInPrototypeChain(getTemplate(type)); } - template<typename T> - static v8::Handle<v8::Value> convertToV8Object(V8ClassIndex::V8WrapperType type, PassRefPtr<T> imp) - { - return convertToV8Object(type, imp.get()); - } - - static v8::Handle<v8::Value> convertToV8Object(V8ClassIndex::V8WrapperType, void*); - - // Fast-path for Node objects. - static v8::Handle<v8::Value> convertNodeToV8Object(PassRefPtr<Node> node) - { - return convertNodeToV8Object(node.get()); - } - - static v8::Handle<v8::Value> convertNodeToV8Object(Node*); - - static v8::Handle<v8::Value> convertDocumentToV8Object(Document*); - - static v8::Handle<v8::Value> convertNewNodeToV8Object(PassRefPtr<Node> node) - { - return convertNewNodeToV8Object(node.get()); - } - - static v8::Handle<v8::Value> convertNewNodeToV8Object(Node* node) - { - return convertNewNodeToV8Object(node, 0, getDOMNodeMap()); - } - - static v8::Handle<v8::Value> convertNewNodeToV8Object(Node*, V8Proxy*, DOMNodeMapping&); - static V8ClassIndex::V8WrapperType domWrapperType(v8::Handle<v8::Object>); - static v8::Handle<v8::Value> convertEventToV8Object(PassRefPtr<Event> event) - { - return convertEventToV8Object(event.get()); - } - - static v8::Handle<v8::Value> convertEventToV8Object(Event*); - static v8::Handle<v8::Value> convertEventTargetToV8Object(PassRefPtr<EventTarget> eventTarget) { return convertEventTargetToV8Object(eventTarget.get()); @@ -169,14 +131,6 @@ namespace WebCore { static v8::Handle<v8::Value> convertEventTargetToV8Object(EventTarget*); - // Wrap and unwrap JS event listeners. - static v8::Handle<v8::Value> convertEventListenerToV8Object(ScriptExecutionContext* context, PassRefPtr<EventListener> eventListener) - { - return convertEventListenerToV8Object(context, eventListener.get()); - } - - static v8::Handle<v8::Value> convertEventListenerToV8Object(ScriptExecutionContext*, EventListener*); - static PassRefPtr<EventListener> getEventListener(Node* node, v8::Local<v8::Value> value, bool isAttribute, ListenerLookupType lookup); static PassRefPtr<EventListener> getEventListener(SVGElementInstance* element, v8::Local<v8::Value> value, bool isAttribute, ListenerLookupType lookup); @@ -211,10 +165,6 @@ namespace WebCore { return resolver; } #endif - // DOMImplementation is a singleton and it is handled in a special - // way. A wrapper is generated per document and stored in an - // internal field of the document. - static v8::Handle<v8::Value> convertDOMImplementationToV8Object(DOMImplementation*); // Wrap JS node filter in C++. static PassRefPtr<NodeFilter> wrapNativeNodeFilter(v8::Handle<v8::Value>); @@ -233,50 +183,18 @@ namespace WebCore { // Check whether a V8 value is a wrapper of type |classType|. static bool isWrapperOfType(v8::Handle<v8::Value>, V8ClassIndex::V8WrapperType); - // Check whether a V8 value is a DOM Event wrapper. - static bool isDOMEventWrapper(v8::Handle<v8::Value>); - - static v8::Handle<v8::Value> convertStyleSheetToV8Object(StyleSheet*); - static v8::Handle<v8::Value> convertCSSValueToV8Object(CSSValue*); - static v8::Handle<v8::Value> convertCSSRuleToV8Object(CSSRule*); - // Returns the JS wrapper of a window object, initializes the environment - // of the window frame if needed. - static v8::Handle<v8::Value> convertWindowToV8Object(DOMWindow*); - static v8::Handle<v8::Value> convertNamedNodeMapToV8Object(NamedNodeMap*); - -#if ENABLE(SVG) - static v8::Handle<v8::Value> convertSVGElementInstanceToV8Object(SVGElementInstance*); - static v8::Handle<v8::Value> convertSVGObjectWithContextToV8Object(V8ClassIndex::V8WrapperType, void*); -#endif - #if ENABLE(3D_CANVAS) static void setIndexedPropertiesToExternalArray(v8::Handle<v8::Object>, int, void*, int); #endif - - private: // Set hidden references in a DOMWindow object of a frame. static void setHiddenWindowReference(Frame*, const int internalIndex, v8::Handle<v8::Object>); - static V8ClassIndex::V8WrapperType htmlElementType(HTMLElement*); -#if ENABLE(SVG) - static V8ClassIndex::V8WrapperType svgElementType(SVGElement*); -#endif - - // The first V8WrapperType specifies the function descriptor - // used to create JS object. The second V8WrapperType specifies - // the actual type of the void* for type casting. - // For example, a HTML element has HTMLELEMENT for the first V8WrapperType, but always - // use NODE as the second V8WrapperType. JS wrapper stores the second - // V8WrapperType and the void* as internal fields. - static v8::Local<v8::Object> instantiateV8Object(V8ClassIndex::V8WrapperType descType, V8ClassIndex::V8WrapperType cptrType, void* impl) - { - return instantiateV8Object(NULL, descType, cptrType, impl); - } + static v8::Local<v8::Object> instantiateV8Object(V8Proxy* proxy, V8ClassIndex::V8WrapperType type, void* impl); - static v8::Local<v8::Object> instantiateV8Object(V8Proxy*, V8ClassIndex::V8WrapperType, V8ClassIndex::V8WrapperType, void*); + static v8::Handle<v8::Object> getWrapper(Node*); }; } diff --git a/WebCore/bindings/v8/V8NodeFilterCondition.cpp b/WebCore/bindings/v8/V8NodeFilterCondition.cpp index 9f57a44..a8868b5 100644 --- a/WebCore/bindings/v8/V8NodeFilterCondition.cpp +++ b/WebCore/bindings/v8/V8NodeFilterCondition.cpp @@ -34,6 +34,7 @@ #include "Node.h" #include "NodeFilter.h" #include "ScriptState.h" +#include "V8Node.h" #include "V8Proxy.h" #include <wtf/OwnArrayPtr.h> @@ -69,7 +70,7 @@ short V8NodeFilterCondition::acceptNode(ScriptState* state, Node* node) const v8::Handle<v8::Object> object = v8::Context::GetCurrent()->Global(); v8::Handle<v8::Function> callback = v8::Handle<v8::Function>::Cast(m_filter); OwnArrayPtr<v8::Handle<v8::Value> > args(new v8::Handle<v8::Value>[1]); - args[0] = V8DOMWrapper::convertToV8Object(V8ClassIndex::NODE, node); + args[0] = toV8(node); V8Proxy* proxy = V8Proxy::retrieve(); ASSERT(proxy); diff --git a/WebCore/bindings/v8/V8Proxy.cpp b/WebCore/bindings/v8/V8Proxy.cpp index 7ed1c46..b0a47b8 100644 --- a/WebCore/bindings/v8/V8Proxy.cpp +++ b/WebCore/bindings/v8/V8Proxy.cpp @@ -45,12 +45,17 @@ #include "V8BindingState.h" #include "V8Collection.h" #include "V8ConsoleMessage.h" -#include "V8CustomBinding.h" +#include "V8DOMCoreException.h" #include "V8DOMMap.h" #include "V8DOMWindow.h" +#include "V8EventException.h" #include "V8HiddenPropertyName.h" #include "V8Index.h" #include "V8IsolatedContext.h" +#include "V8RangeException.h" +#include "V8SVGException.h" +#include "V8XMLHttpRequestException.h" +#include "V8XPathException.h" #include "WorkerContextExecutionProxy.h" #include <algorithm> @@ -656,25 +661,25 @@ void V8Proxy::setDOMException(int exceptionCode) v8::Handle<v8::Value> exception; switch (description.type) { case DOMExceptionType: - exception = V8DOMWrapper::convertToV8Object(V8ClassIndex::DOMCOREEXCEPTION, DOMCoreException::create(description)); + exception = toV8(DOMCoreException::create(description)); break; case RangeExceptionType: - exception = V8DOMWrapper::convertToV8Object(V8ClassIndex::RANGEEXCEPTION, RangeException::create(description)); + exception = toV8(RangeException::create(description)); break; case EventExceptionType: - exception = V8DOMWrapper::convertToV8Object(V8ClassIndex::EVENTEXCEPTION, EventException::create(description)); + exception = toV8(EventException::create(description)); break; case XMLHttpRequestExceptionType: - exception = V8DOMWrapper::convertToV8Object(V8ClassIndex::XMLHTTPREQUESTEXCEPTION, XMLHttpRequestException::create(description)); + exception = toV8(XMLHttpRequestException::create(description)); break; #if ENABLE(SVG) case SVGExceptionType: - exception = V8DOMWrapper::convertToV8Object(V8ClassIndex::SVGEXCEPTION, SVGException::create(description)); + exception = toV8(SVGException::create(description)); break; #endif #if ENABLE(XPATH) case XPathExceptionType: - exception = V8DOMWrapper::convertToV8Object(V8ClassIndex::XPATHEXCEPTION, XPathException::create(description)); + exception = toV8(XPathException::create(description)); break; #endif } diff --git a/WebCore/bindings/v8/V8Proxy.h b/WebCore/bindings/v8/V8Proxy.h index 6f6470e..9aba723 100644 --- a/WebCore/bindings/v8/V8Proxy.h +++ b/WebCore/bindings/v8/V8Proxy.h @@ -191,7 +191,9 @@ namespace WebCore { setSVGContext(object.get(), context); return object; } - static void* withSVGContext(void* object, SVGElement* context) + + template <typename T> + static T* withSVGContext(T* object, SVGElement* context) { setSVGContext(object, context); return object; diff --git a/WebCore/bindings/v8/WorkerContextExecutionProxy.h b/WebCore/bindings/v8/WorkerContextExecutionProxy.h index 3b8ab9e..b5e6afb 100644 --- a/WebCore/bindings/v8/WorkerContextExecutionProxy.h +++ b/WebCore/bindings/v8/WorkerContextExecutionProxy.h @@ -95,6 +95,11 @@ namespace WebCore { static v8::Handle<v8::Value> convertEventTargetToV8Object(EventTarget*); static v8::Handle<v8::Value> convertWorkerContextToV8Object(WorkerContext*); + static v8::Local<v8::Object> toV8(V8ClassIndex::V8WrapperType type, void* impl) + { + return toV8(type, type, impl); + } + private: void initV8IfNeeded(); void initContextIfNeeded(); diff --git a/WebCore/bindings/v8/custom/V8BarInfoCustom.cpp b/WebCore/bindings/v8/custom/V8BarInfoCustom.cpp new file mode 100644 index 0000000..44f0b62 --- /dev/null +++ b/WebCore/bindings/v8/custom/V8BarInfoCustom.cpp @@ -0,0 +1,73 @@ +/* + * 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 "V8BarInfo.h" + +#include "V8DOMWindow.h" +#include "V8DOMWrapper.h" + +namespace WebCore { + +v8::Handle<v8::Value> toV8(BarInfo* impl) +{ + if (!impl) + return v8::Null(); + v8::Handle<v8::Object> wrapper = getDOMObjectMap().get(impl); + if (wrapper.IsEmpty()) { + wrapper = V8BarInfo::wrap(impl); + if (!wrapper.IsEmpty()) { + Frame* frame = impl->frame(); + switch (impl->type()) { + case BarInfo::Locationbar: + V8DOMWrapper::setHiddenWindowReference(frame, V8DOMWindow::locationbarIndex, wrapper); + break; + case BarInfo::Menubar: + V8DOMWrapper::setHiddenWindowReference(frame, V8DOMWindow::menubarIndex, wrapper); + break; + case BarInfo::Personalbar: + V8DOMWrapper::setHiddenWindowReference(frame, V8DOMWindow::personalbarIndex, wrapper); + break; + case BarInfo::Scrollbars: + V8DOMWrapper::setHiddenWindowReference(frame, V8DOMWindow::scrollbarsIndex, wrapper); + break; + case BarInfo::Statusbar: + V8DOMWrapper::setHiddenWindowReference(frame, V8DOMWindow::statusbarIndex, wrapper); + break; + case BarInfo::Toolbar: + V8DOMWrapper::setHiddenWindowReference(frame, V8DOMWindow::toolbarIndex, wrapper); + break; + } + } + } + return wrapper; +} + +} // namespace WebCore diff --git a/WebCore/bindings/v8/custom/V8CSSRuleCustom.cpp b/WebCore/bindings/v8/custom/V8CSSRuleCustom.cpp new file mode 100644 index 0000000..90a111c --- /dev/null +++ b/WebCore/bindings/v8/custom/V8CSSRuleCustom.cpp @@ -0,0 +1,73 @@ +/* + * 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 "V8CSSRule.h" + +#include "V8CSSCharsetRule.h" +#include "V8CSSFontFaceRule.h" +#include "V8CSSImportRule.h" +#include "V8CSSMediaRule.h" +#include "V8CSSPageRule.h" +#include "V8CSSStyleRule.h" +#include "V8CSSVariablesRule.h" +#include "V8WebKitCSSKeyframeRule.h" +#include "V8WebKitCSSKeyframesRule.h" + +namespace WebCore { + +v8::Handle<v8::Value> toV8(CSSRule* impl) +{ + if (!impl) + return v8::Null(); + switch (impl->type()) { + case CSSRule::STYLE_RULE: + return toV8(static_cast<CSSStyleRule*>(impl)); + case CSSRule::CHARSET_RULE: + return toV8(static_cast<CSSCharsetRule*>(impl)); + case CSSRule::IMPORT_RULE: + return toV8(static_cast<CSSImportRule*>(impl)); + case CSSRule::MEDIA_RULE: + return toV8(static_cast<CSSMediaRule*>(impl)); + case CSSRule::FONT_FACE_RULE: + return toV8(static_cast<CSSFontFaceRule*>(impl)); + case CSSRule::PAGE_RULE: + return toV8(static_cast<CSSPageRule*>(impl)); + case CSSRule::VARIABLES_RULE: + return toV8(static_cast<CSSVariablesRule*>(impl)); + case CSSRule::WEBKIT_KEYFRAME_RULE: + return toV8(static_cast<WebKitCSSKeyframeRule*>(impl)); + case CSSRule::WEBKIT_KEYFRAMES_RULE: + return toV8(static_cast<WebKitCSSKeyframesRule*>(impl)); + } + return V8CSSRule::wrap(impl); +} + +} // namespace WebCore diff --git a/WebCore/bindings/v8/custom/V8CSSStyleSheetCustom.cpp b/WebCore/bindings/v8/custom/V8CSSStyleSheetCustom.cpp new file mode 100644 index 0000000..5dcc966 --- /dev/null +++ b/WebCore/bindings/v8/custom/V8CSSStyleSheetCustom.cpp @@ -0,0 +1,50 @@ +/* + * 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 "V8CSSStyleSheet.h" + +#include "V8Node.h" + +namespace WebCore { + +v8::Handle<v8::Value> toV8(CSSStyleSheet* impl) +{ + if (!impl) + return v8::Null(); + v8::Handle<v8::Object> wrapper = V8CSSStyleSheet::wrap(impl); + // Add a hidden reference from stylesheet object to its owner node. + Node* ownerNode = impl->ownerNode(); + if (ownerNode && !wrapper.IsEmpty()) + wrapper->SetInternalField(V8CSSStyleSheet::ownerNodeIndex, toV8(ownerNode)); + return wrapper; +} + +} // namespace WebCore diff --git a/WebCore/bindings/v8/custom/V8CSSValueCustom.cpp b/WebCore/bindings/v8/custom/V8CSSValueCustom.cpp new file mode 100644 index 0000000..9e692ad --- /dev/null +++ b/WebCore/bindings/v8/custom/V8CSSValueCustom.cpp @@ -0,0 +1,59 @@ +/* + * 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 "V8CSSValue.h" + +#include "V8CSSPrimitiveValue.h" +#include "V8CSSValueList.h" +#include "V8SVGColor.h" +#include "V8SVGPaint.h" +#include "V8WebKitCSSTransformValue.h" + +namespace WebCore { + +v8::Handle<v8::Value> toV8(CSSValue* impl) +{ + if (!impl) + return v8::Null(); + if (impl->isWebKitCSSTransformValue()) + return toV8(static_cast<WebKitCSSTransformValue*>(impl)); + if (impl->isValueList()) + return toV8(static_cast<CSSValueList*>(impl)); + if (impl->isPrimitiveValue()) + return toV8(static_cast<CSSPrimitiveValue*>(impl)); + if (impl->isSVGPaint()) + return toV8(static_cast<SVGPaint*>(impl)); + if (impl->isSVGColor()) + return toV8(static_cast<SVGColor*>(impl)); + return V8CSSValue::wrap(impl); +} + +} // namespace WebCore diff --git a/WebCore/bindings/v8/custom/V8CanvasPixelArrayCustom.cpp b/WebCore/bindings/v8/custom/V8CanvasPixelArrayCustom.cpp new file mode 100644 index 0000000..cd638ce --- /dev/null +++ b/WebCore/bindings/v8/custom/V8CanvasPixelArrayCustom.cpp @@ -0,0 +1,46 @@ +/* + * 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 "V8CanvasPixelArray.h" + +namespace WebCore { + +v8::Handle<v8::Value> toV8(CanvasPixelArray* impl) +{ + if (!impl) + return v8::Null(); + v8::Handle<v8::Object> wrapper = V8CanvasPixelArray::wrap(impl); + if (!wrapper.IsEmpty()) + wrapper->SetIndexedPropertiesToPixelData(impl->data()->data(), impl->length()); + return wrapper; +} + +} // namespace WebCore diff --git a/WebCore/bindings/v8/custom/V8CanvasRenderingContext2DCustom.cpp b/WebCore/bindings/v8/custom/V8CanvasRenderingContext2DCustom.cpp index b45ef35..70be193 100644 --- a/WebCore/bindings/v8/custom/V8CanvasRenderingContext2DCustom.cpp +++ b/WebCore/bindings/v8/custom/V8CanvasRenderingContext2DCustom.cpp @@ -50,13 +50,13 @@ namespace WebCore { -static v8::Handle<v8::Value> toV8(CanvasStyle* style) +static v8::Handle<v8::Value> toV8Object(CanvasStyle* style) { if (style->canvasGradient()) - return V8DOMWrapper::convertToV8Object(V8ClassIndex::CANVASGRADIENT, style->canvasGradient()); + return toV8(style->canvasGradient()); if (style->canvasPattern()) - return V8DOMWrapper::convertToV8Object(V8ClassIndex::CANVASPATTERN, style->canvasPattern()); + return toV8(style->canvasPattern()); return v8String(style->color()); } @@ -78,7 +78,7 @@ static PassRefPtr<CanvasStyle> toCanvasStyle(v8::Handle<v8::Value> value) v8::Handle<v8::Value> V8CanvasRenderingContext2D::strokeStyleAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) { CanvasRenderingContext2D* impl = V8CanvasRenderingContext2D::toNative(info.Holder()); - return toV8(impl->strokeStyle()); + return toV8Object(impl->strokeStyle()); } void V8CanvasRenderingContext2D::strokeStyleAccessorSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info) @@ -90,7 +90,7 @@ void V8CanvasRenderingContext2D::strokeStyleAccessorSetter(v8::Local<v8::String> v8::Handle<v8::Value> V8CanvasRenderingContext2D::fillStyleAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) { CanvasRenderingContext2D* impl = V8CanvasRenderingContext2D::toNative(info.Holder()); - return toV8(impl->fillStyle()); + return toV8Object(impl->fillStyle()); } void V8CanvasRenderingContext2D::fillStyleAccessorSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info) @@ -348,7 +348,7 @@ v8::Handle<v8::Value> V8CanvasRenderingContext2D::createPatternCallback(const v8 V8Proxy::setDOMException(ec); return notHandledByInterceptor(); } - return V8DOMWrapper::convertToV8Object(V8ClassIndex::CANVASPATTERN, pattern.release()); + return toV8(pattern.release()); } if (V8HTMLCanvasElement::HasInstance(arg)) { @@ -359,7 +359,7 @@ v8::Handle<v8::Value> V8CanvasRenderingContext2D::createPatternCallback(const v8 V8Proxy::setDOMException(ec); return notHandledByInterceptor(); } - return V8DOMWrapper::convertToV8Object(V8ClassIndex::CANVASPATTERN, pattern.release()); + return toV8(pattern.release()); } V8Proxy::setDOMException(TYPE_MISMATCH_ERR); diff --git a/WebCore/bindings/v8/custom/V8CustomPositionCallback.cpp b/WebCore/bindings/v8/custom/V8CustomPositionCallback.cpp index 5e9a8f2..19300b0 100644 --- a/WebCore/bindings/v8/custom/V8CustomPositionCallback.cpp +++ b/WebCore/bindings/v8/custom/V8CustomPositionCallback.cpp @@ -28,6 +28,7 @@ #include "Frame.h" #include "V8CustomVoidCallback.h" // For invokeCallback +#include "V8Geoposition.h" namespace WebCore { @@ -53,7 +54,7 @@ void V8CustomPositionCallback::handleEvent(Geoposition* position) v8::Context::Scope scope(context); v8::Handle<v8::Value> argv[] = { - V8DOMWrapper::convertToV8Object(V8ClassIndex::GEOPOSITION, position) + toV8(position) }; // Protect the frame until the callback returns. diff --git a/WebCore/bindings/v8/custom/V8CustomPositionErrorCallback.cpp b/WebCore/bindings/v8/custom/V8CustomPositionErrorCallback.cpp index 117f374..c6c632b 100644 --- a/WebCore/bindings/v8/custom/V8CustomPositionErrorCallback.cpp +++ b/WebCore/bindings/v8/custom/V8CustomPositionErrorCallback.cpp @@ -28,6 +28,7 @@ #include "Frame.h" #include "V8CustomVoidCallback.h" // For invokeCallback +#include "V8PositionError.h" namespace WebCore { @@ -53,7 +54,7 @@ void V8CustomPositionErrorCallback::handleEvent(PositionError* error) v8::Context::Scope scope(context); v8::Handle<v8::Value> argv[] = { - V8DOMWrapper::convertToV8Object(V8ClassIndex::POSITIONERROR, error) + toV8(error) }; // Protect the frame until the callback returns. diff --git a/WebCore/bindings/v8/custom/V8CustomSQLStatementCallback.cpp b/WebCore/bindings/v8/custom/V8CustomSQLStatementCallback.cpp index 64abdc4..d30b95a 100644 --- a/WebCore/bindings/v8/custom/V8CustomSQLStatementCallback.cpp +++ b/WebCore/bindings/v8/custom/V8CustomSQLStatementCallback.cpp @@ -36,6 +36,8 @@ #include "Frame.h" #include "V8CustomVoidCallback.h" +#include "V8SQLResultSet.h" +#include "V8SQLTransaction.h" namespace WebCore { @@ -61,8 +63,8 @@ void V8CustomSQLStatementCallback::handleEvent(SQLTransaction* transaction, SQLR v8::Context::Scope scope(context); v8::Handle<v8::Value> argv[] = { - V8DOMWrapper::convertToV8Object(V8ClassIndex::SQLTRANSACTION, transaction), - V8DOMWrapper::convertToV8Object(V8ClassIndex::SQLRESULTSET, resultSet) + toV8(transaction), + toV8(resultSet) }; // Protect the frame until the callback returns. diff --git a/WebCore/bindings/v8/custom/V8CustomSQLStatementErrorCallback.cpp b/WebCore/bindings/v8/custom/V8CustomSQLStatementErrorCallback.cpp index 1af3562..84a3b96 100644 --- a/WebCore/bindings/v8/custom/V8CustomSQLStatementErrorCallback.cpp +++ b/WebCore/bindings/v8/custom/V8CustomSQLStatementErrorCallback.cpp @@ -36,6 +36,8 @@ #include "Frame.h" #include "V8CustomVoidCallback.h" +#include "V8SQLError.h" +#include "V8SQLTransaction.h" namespace WebCore { @@ -61,8 +63,8 @@ bool V8CustomSQLStatementErrorCallback::handleEvent(SQLTransaction* transaction, v8::Context::Scope scope(context); v8::Handle<v8::Value> argv[] = { - V8DOMWrapper::convertToV8Object(V8ClassIndex::SQLTRANSACTION, transaction), - V8DOMWrapper::convertToV8Object(V8ClassIndex::SQLERROR, error) + toV8(transaction), + toV8(error) }; // Protect the frame until the callback returns. diff --git a/WebCore/bindings/v8/custom/V8CustomSQLTransactionCallback.cpp b/WebCore/bindings/v8/custom/V8CustomSQLTransactionCallback.cpp index 2cef6b3..68002d7 100644 --- a/WebCore/bindings/v8/custom/V8CustomSQLTransactionCallback.cpp +++ b/WebCore/bindings/v8/custom/V8CustomSQLTransactionCallback.cpp @@ -36,6 +36,7 @@ #include "Frame.h" #include "V8CustomVoidCallback.h" +#include "V8SQLTransaction.h" namespace WebCore { @@ -62,7 +63,7 @@ void V8CustomSQLTransactionCallback::handleEvent(SQLTransaction* transaction, bo v8::Context::Scope scope(context); v8::Handle<v8::Value> argv[] = { - V8DOMWrapper::convertToV8Object(V8ClassIndex::SQLTRANSACTION, transaction) + toV8(transaction) }; // Protect the frame until the callback returns. diff --git a/WebCore/bindings/v8/custom/V8CustomSQLTransactionErrorCallback.cpp b/WebCore/bindings/v8/custom/V8CustomSQLTransactionErrorCallback.cpp index 1a0939d..cf5a0ef 100644 --- a/WebCore/bindings/v8/custom/V8CustomSQLTransactionErrorCallback.cpp +++ b/WebCore/bindings/v8/custom/V8CustomSQLTransactionErrorCallback.cpp @@ -36,6 +36,7 @@ #include "Frame.h" #include "V8CustomVoidCallback.h" +#include "V8SQLError.h" namespace WebCore { @@ -61,7 +62,7 @@ void V8CustomSQLTransactionErrorCallback::handleEvent(SQLError* error) v8::Context::Scope scope(context); v8::Handle<v8::Value> argv[] = { - V8DOMWrapper::convertToV8Object(V8ClassIndex::SQLERROR, error) + toV8(error) }; // Protect the frame until the callback returns. diff --git a/WebCore/bindings/v8/custom/V8DOMSelectionCustom.cpp b/WebCore/bindings/v8/custom/V8DOMSelectionCustom.cpp new file mode 100644 index 0000000..0c9e745 --- /dev/null +++ b/WebCore/bindings/v8/custom/V8DOMSelectionCustom.cpp @@ -0,0 +1,51 @@ +/* + * 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 "V8DOMSelection.h" + +#include "V8DOMWindow.h" +#include "V8DOMWrapper.h" + +namespace WebCore { + +v8::Handle<v8::Value> toV8(DOMSelection* impl) +{ + if (!impl) + return v8::Null(); + v8::Handle<v8::Object> wrapper = getDOMObjectMap().get(impl); + if (wrapper.IsEmpty()) { + wrapper = V8DOMSelection::wrap(impl); + V8DOMWrapper::setHiddenWindowReference(impl->frame(), V8DOMWindow::domSelectionIndex, wrapper); + } + return wrapper; +} + +} // namespace WebCore diff --git a/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp b/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp index 2933b4d..ba6c738 100644 --- a/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp +++ b/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp @@ -57,7 +57,9 @@ #include "V8BindingState.h" #include "V8CustomBinding.h" #include "V8CustomEventListener.h" +#include "V8HTMLCollection.h" #include "V8MessagePortCustom.h" +#include "V8Node.h" #include "V8Proxy.h" #include "V8Utilities.h" #if ENABLE(WEB_SOCKETS) @@ -78,8 +80,15 @@ v8::Handle<v8::Value> WindowSetTimeoutImpl(const v8::Arguments& args, bool singl if (argumentCount < 1) return v8::Undefined(); - v8::Handle<v8::Value> function = args[0]; + DOMWindow* imp = V8DOMWindow::toNative(args.Holder()); + ScriptExecutionContext* scriptContext = static_cast<ScriptExecutionContext*>(imp->document()); + + if (!scriptContext) { + V8Proxy::setDOMException(INVALID_ACCESS_ERR); + return v8::Undefined(); + } + v8::Handle<v8::Value> function = args[0]; WebCore::String functionString; if (!function->IsFunction()) { if (function->IsString()) @@ -104,16 +113,9 @@ v8::Handle<v8::Value> WindowSetTimeoutImpl(const v8::Arguments& args, bool singl if (argumentCount >= 2) timeout = args[1]->Int32Value(); - DOMWindow* imp = V8DOMWindow::toNative(args.Holder()); - if (!V8BindingSecurity::canAccessFrame(V8BindingState::Only(), imp->frame(), true)) return v8::Undefined(); - ScriptExecutionContext* scriptContext = static_cast<ScriptExecutionContext*>(imp->document()); - - if (!scriptContext) - return v8::Undefined(); - int id; if (function->IsFunction()) { int paramCount = argumentCount >= 2 ? argumentCount - 2 : 0; @@ -708,7 +710,7 @@ v8::Handle<v8::Value> V8DOMWindow::openCallback(const v8::Arguments& args) frame->redirectScheduler()->scheduleLocationChange(completedUrl, referrer, false, userGesture); } - return V8DOMWrapper::convertToV8Object(V8ClassIndex::DOMWINDOW, frame->domWindow()); + return toV8(frame->domWindow()); } // In the case of a named frame or a new window, we'll use the @@ -768,7 +770,7 @@ v8::Handle<v8::Value> V8DOMWindow::openCallback(const v8::Arguments& args) if (!frame) return v8::Undefined(); - return V8DOMWrapper::convertToV8Object(V8ClassIndex::DOMWINDOW, frame->domWindow()); + return toV8(frame->domWindow()); } @@ -786,7 +788,7 @@ v8::Handle<v8::Value> V8DOMWindow::indexedPropertyGetter(uint32_t index, const v Frame* child = frame->tree()->child(index); if (child) - return V8DOMWrapper::convertToV8Object(V8ClassIndex::DOMWINDOW, child->domWindow()); + return toV8(child->domWindow()); return notHandledByInterceptor(); } @@ -809,7 +811,7 @@ v8::Handle<v8::Value> V8DOMWindow::namedPropertyGetter(v8::Local<v8::String> nam AtomicString propName = v8StringToAtomicWebCoreString(name); Frame* child = frame->tree()->child(propName); if (child) - return V8DOMWrapper::convertToV8Object(V8ClassIndex::DOMWINDOW, child->domWindow()); + return toV8(child->domWindow()); // Search IDL functions defined in the prototype v8::Handle<v8::Value> result = info.Holder()->GetRealNamedProperty(name); @@ -824,8 +826,8 @@ v8::Handle<v8::Value> V8DOMWindow::namedPropertyGetter(v8::Local<v8::String> nam RefPtr<HTMLCollection> items = doc->windowNamedItems(propName); if (items->length() >= 1) { if (items->length() == 1) - return V8DOMWrapper::convertNodeToV8Object(items->firstItem()); - return V8DOMWrapper::convertToV8Object(V8ClassIndex::HTMLCOLLECTION, items.release()); + return toV8(items->firstItem()); + return toV8(items.release()); } } } @@ -925,4 +927,37 @@ bool V8DOMWindow::indexedSecurityCheck(v8::Local<v8::Object> host, uint32_t inde return V8BindingSecurity::canAccessFrame(V8BindingState::Only(), target, false); } +v8::Handle<v8::Value> toV8(DOMWindow* window) +{ + if (!window) + return v8::Null(); + // Initializes environment of a frame, and return the global object + // of the frame. + Frame* frame = window->frame(); + if (!frame) + return v8::Handle<v8::Object>(); + + // Special case: Because of evaluateInIsolatedWorld() one DOMWindow can have + // multiple contexts and multiple global objects associated with it. When + // code running in one of those contexts accesses the window object, we + // want to return the global object associated with that context, not + // necessarily the first global object associated with that DOMWindow. + v8::Handle<v8::Context> currentContext = v8::Context::GetCurrent(); + v8::Handle<v8::Object> currentGlobal = currentContext->Global(); + v8::Handle<v8::Object> windowWrapper = V8DOMWrapper::lookupDOMWrapper(V8ClassIndex::DOMWINDOW, currentGlobal); + if (!windowWrapper.IsEmpty()) { + if (V8DOMWindow::toNative(windowWrapper) == window) + return currentGlobal; + } + + // Otherwise, return the global object associated with this frame. + v8::Handle<v8::Context> context = V8Proxy::context(frame); + if (context.IsEmpty()) + return v8::Handle<v8::Object>(); + + v8::Handle<v8::Object> global = context->Global(); + ASSERT(!global.IsEmpty()); + return global; +} + } // namespace WebCore diff --git a/WebCore/bindings/v8/custom/V8DataGridColumnListCustom.cpp b/WebCore/bindings/v8/custom/V8DataGridColumnListCustom.cpp index 8980cfe..58e5d01 100644 --- a/WebCore/bindings/v8/custom/V8DataGridColumnListCustom.cpp +++ b/WebCore/bindings/v8/custom/V8DataGridColumnListCustom.cpp @@ -57,7 +57,7 @@ NAMED_PROPERTY_GETTER(DataGridColumnList) DataGridColumn* result = imp->itemWithName(toWebCoreString(name)); if (!result) return notHandledByInterceptor(); - return V8DOMWrapper::convertToV8Object(V8ClassIndex::DATAGRIDCOLUMN, result); + return toV8(result); } } // namespace WebCore diff --git a/WebCore/bindings/v8/custom/V8DocumentCustom.cpp b/WebCore/bindings/v8/custom/V8DocumentCustom.cpp index 9cb8ae1..d8dde7a 100644 --- a/WebCore/bindings/v8/custom/V8DocumentCustom.cpp +++ b/WebCore/bindings/v8/custom/V8DocumentCustom.cpp @@ -37,16 +37,23 @@ #include "Node.h" #include "XPathNSResolver.h" #include "XPathResult.h" -#include "CanvasRenderingContext.h" #include "V8Binding.h" -#include "V8CustomBinding.h" +#include "V8CanvasRenderingContext2D.h" #include "V8CustomXPathNSResolver.h" +#include "V8DOMImplementation.h" +#include "V8HTMLDocument.h" +#include "V8IsolatedContext.h" #include "V8Node.h" #include "V8Proxy.h" +<<<<<<< HEAD // ANDROID // TODO: Upstream to webkit.org #if ENABLE(XPATH) +======= +#include "V8SVGDocument.h" +#include "V8WebGLRenderingContext.h" +>>>>>>> webkit.org at r54340 #include "V8XPathNSResolver.h" #include "V8XPathResult.h" #endif @@ -86,7 +93,7 @@ v8::Handle<v8::Value> V8Document::evaluateCallback(const v8::Arguments& args) if (ec) return throwError(ec); - return V8DOMWrapper::convertToV8Object(V8ClassIndex::XPATHRESULT, result.release()); + return toV8(result.release()); } #endif @@ -103,10 +110,10 @@ v8::Handle<v8::Value> V8Document::getCSSCanvasContextCallback(const v8::Argument if (!result) return v8::Undefined(); if (result->is2d()) - return V8DOMWrapper::convertToV8Object(V8ClassIndex::CANVASRENDERINGCONTEXT2D, result); + return toV8(static_cast<CanvasRenderingContext2D*>(result)); #if ENABLE(3D_CANVAS) else if (result->is3d()) - return V8DOMWrapper::convertToV8Object(V8ClassIndex::WEBGLRENDERINGCONTEXT, result); + return toV8(static_cast<WebGLRenderingContext*>(result)); #endif // ENABLE(3D_CANVAS) ASSERT_NOT_REACHED(); return v8::Undefined(); @@ -132,7 +139,7 @@ v8::Handle<v8::Value> V8Document::implementationAccessorGetter(v8::Local<v8::Str // Generate a wrapper. Document* document = V8Document::toNative(info.Holder()); - v8::Handle<v8::Value> wrapper = V8DOMWrapper::convertDOMImplementationToV8Object(document->implementation()); + v8::Handle<v8::Value> wrapper = toV8(document->implementation()); // Store the wrapper in the internal field. info.Holder()->SetInternalField(implementationIndex, wrapper); @@ -140,4 +147,20 @@ v8::Handle<v8::Value> V8Document::implementationAccessorGetter(v8::Local<v8::Str return wrapper; } +v8::Handle<v8::Value> toV8(Document* impl, bool forceNewObject) +{ + if (!impl) + return v8::Null(); + if (impl->isHTMLDocument()) + return toV8(static_cast<HTMLDocument*>(impl), forceNewObject); + if (impl->isSVGDocument()) + return toV8(static_cast<SVGDocument*>(impl), forceNewObject); + v8::Handle<v8::Value> wrapper = V8Document::wrap(impl, forceNewObject); + if (!V8IsolatedContext::getEntered()) { + if (V8Proxy* proxy = V8Proxy::retrieve(impl->frame())) + proxy->windowShell()->updateDocumentWrapper(wrapper); + } + return wrapper; +} + } // namespace WebCore diff --git a/WebCore/bindings/v8/custom/V8DocumentLocationCustom.cpp b/WebCore/bindings/v8/custom/V8DocumentLocationCustom.cpp index 8dc4672..f86054b 100644 --- a/WebCore/bindings/v8/custom/V8DocumentLocationCustom.cpp +++ b/WebCore/bindings/v8/custom/V8DocumentLocationCustom.cpp @@ -27,8 +27,7 @@ #include "DOMWindow.h" #include "Frame.h" #include "V8Binding.h" -#include "V8CustomBinding.h" -#include "V8Document.h" +#include "V8Location.h" #include "V8Proxy.h" namespace WebCore { @@ -40,7 +39,7 @@ v8::Handle<v8::Value> V8Document::locationAccessorGetter(v8::Local<v8::String> n return v8::Null(); DOMWindow* window = document->frame()->domWindow(); - return V8DOMWrapper::convertToV8Object(V8ClassIndex::LOCATION, window->location()); + return toV8(window->location()); } void V8Document::locationAccessorSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info) diff --git a/WebCore/bindings/v8/custom/V8ElementCustom.cpp b/WebCore/bindings/v8/custom/V8ElementCustom.cpp index 0f13f9d..b420f6a 100644 --- a/WebCore/bindings/v8/custom/V8ElementCustom.cpp +++ b/WebCore/bindings/v8/custom/V8ElementCustom.cpp @@ -44,7 +44,9 @@ #include "V8Binding.h" #include "V8BindingState.h" #include "V8CustomBinding.h" +#include "V8HTMLElement.h" #include "V8Proxy.h" +#include "V8SVGElement.h" #include <wtf/RefPtr.h> @@ -85,7 +87,7 @@ v8::Handle<v8::Value> V8Element::setAttributeNodeCallback(const v8::Arguments& a if (ec) throwError(ec); - return V8DOMWrapper::convertNodeToV8Object(result.release()); + return toV8(result.release()); } v8::Handle<v8::Value> V8Element::setAttributeNSCallback(const v8::Arguments& args) @@ -124,7 +126,17 @@ v8::Handle<v8::Value> V8Element::setAttributeNodeNSCallback(const v8::Arguments& if (ec) throwError(ec); - return V8DOMWrapper::convertNodeToV8Object(result.release()); + return toV8(result.release()); } +v8::Handle<v8::Value> toV8(Element* impl, bool forceNewObject) +{ + if (!impl) + return v8::Null(); + if (impl->isHTMLElement()) + return toV8(static_cast<HTMLElement*>(impl), forceNewObject); + if (impl->isSVGElement()) + return toV8(static_cast<SVGElement*>(impl), forceNewObject); + return V8Element::wrap(impl, forceNewObject); +} } // namespace WebCore diff --git a/WebCore/bindings/v8/custom/V8EventCustom.cpp b/WebCore/bindings/v8/custom/V8EventCustom.cpp index 65cd41e..a13603e 100644 --- a/WebCore/bindings/v8/custom/V8EventCustom.cpp +++ b/WebCore/bindings/v8/custom/V8EventCustom.cpp @@ -34,10 +34,28 @@ #include "Clipboard.h" #include "ClipboardEvent.h" #include "Event.h" -#include "MouseEvent.h" +#include "V8BeforeLoadEvent.h" #include "V8Binding.h" -#include "V8CustomBinding.h" +#include "V8Clipboard.h" +#include "V8CompositionEvent.h" +#include "V8ErrorEvent.h" +#include "V8KeyboardEvent.h" +#include "V8MessageEvent.h" +#include "V8MouseEvent.h" +#include "V8MutationEvent.h" +#include "V8OverflowEvent.h" +#include "V8PageTransitionEvent.h" +#include "V8PopStateEvent.h" +#include "V8ProgressEvent.h" #include "V8Proxy.h" +#include "V8SVGZoomEvent.h" +#include "V8StorageEvent.h" +#include "V8TextEvent.h" +#include "V8UIEvent.h" +#include "V8WebKitAnimationEvent.h" +#include "V8WebKitTransitionEvent.h" +#include "V8WheelEvent.h" +#include "V8XMLHttpRequestProgressEvent.h" namespace WebCore { @@ -52,7 +70,7 @@ v8::Handle<v8::Value> V8Event::dataTransferAccessorGetter(v8::Local<v8::String> Event* event = V8Event::toNative(info.Holder()); if (event->isDragEvent()) - return V8DOMWrapper::convertToV8Object(V8ClassIndex::CLIPBOARD, static_cast<MouseEvent*>(event)->clipboard()); + return toV8(static_cast<MouseEvent*>(event)->clipboard()); return v8::Undefined(); } @@ -62,9 +80,61 @@ v8::Handle<v8::Value> V8Event::clipboardDataAccessorGetter(v8::Local<v8::String> Event* event = V8Event::toNative(info.Holder()); if (event->isClipboardEvent()) - return V8DOMWrapper::convertToV8Object(V8ClassIndex::CLIPBOARD, static_cast<ClipboardEvent*>(event)->clipboard()); + return toV8(static_cast<ClipboardEvent*>(event)->clipboard()); return v8::Undefined(); } +v8::Handle<v8::Value> toV8(Event* impl) +{ + if (!impl) + return v8::Null(); + if (impl->isUIEvent()) { + if (impl->isKeyboardEvent()) + return toV8(static_cast<KeyboardEvent*>(impl)); + if (impl->isTextEvent()) + return toV8(static_cast<TextEvent*>(impl)); + if (impl->isMouseEvent()) + return toV8(static_cast<MouseEvent*>(impl)); + if (impl->isWheelEvent()) + return toV8(static_cast<WheelEvent*>(impl)); +#if ENABLE(SVG) + if (impl->isSVGZoomEvent()) + return toV8(static_cast<SVGZoomEvent*>(impl)); +#endif + if (impl->isCompositionEvent()) + return toV8(static_cast<CompositionEvent*>(impl)); + return toV8(static_cast<UIEvent*>(impl)); + } + if (impl->isMutationEvent()) + return toV8(static_cast<MutationEvent*>(impl)); + if (impl->isOverflowEvent()) + return toV8(static_cast<OverflowEvent*>(impl)); + if (impl->isMessageEvent()) + return toV8(static_cast<MessageEvent*>(impl)); + if (impl->isPageTransitionEvent()) + return toV8(static_cast<PageTransitionEvent*>(impl)); + if (impl->isPopStateEvent()) + return toV8(static_cast<PopStateEvent*>(impl)); + if (impl->isProgressEvent()) { + if (impl->isXMLHttpRequestProgressEvent()) + return toV8(static_cast<XMLHttpRequestProgressEvent*>(impl)); + return toV8(static_cast<ProgressEvent*>(impl)); + } + if (impl->isWebKitAnimationEvent()) + return toV8(static_cast<WebKitAnimationEvent*>(impl)); + if (impl->isWebKitTransitionEvent()) + return toV8(static_cast<WebKitTransitionEvent*>(impl)); +#if ENABLE(WORKERS) + if (impl->isErrorEvent()) + return toV8(static_cast<ErrorEvent*>(impl)); +#endif +#if ENABLE(DOM_STORAGE) + if (impl->isStorageEvent()) + return toV8(static_cast<StorageEvent*>(impl)); +#endif + if (impl->isBeforeLoadEvent()) + return toV8(static_cast<BeforeLoadEvent*>(impl)); + return V8Event::wrap(impl); +} } // namespace WebCore diff --git a/WebCore/bindings/v8/custom/V8HTMLAllCollectionCustom.cpp b/WebCore/bindings/v8/custom/V8HTMLAllCollectionCustom.cpp index c34d9e7..88b3a9d 100644 --- a/WebCore/bindings/v8/custom/V8HTMLAllCollectionCustom.cpp +++ b/WebCore/bindings/v8/custom/V8HTMLAllCollectionCustom.cpp @@ -36,6 +36,8 @@ #include "V8Binding.h" #include "V8CustomBinding.h" #include "V8NamedNodesCollection.h" +#include "V8Node.h" +#include "V8NodeList.h" #include "V8Proxy.h" namespace WebCore { @@ -49,10 +51,10 @@ static v8::Handle<v8::Value> getNamedItems(HTMLAllCollection* collection, Atomic return v8::Handle<v8::Value>(); if (namedItems.size() == 1) - return V8DOMWrapper::convertNodeToV8Object(namedItems.at(0).release()); + return toV8(namedItems.at(0).release()); NodeList* list = new V8NamedNodesCollection(namedItems); - return V8DOMWrapper::convertToV8Object(V8ClassIndex::NODELIST, list); + return toV8(list); } static v8::Handle<v8::Value> getItem(HTMLAllCollection* collection, v8::Handle<v8::Value> argument) @@ -68,7 +70,7 @@ static v8::Handle<v8::Value> getItem(HTMLAllCollection* collection, v8::Handle<v } RefPtr<Node> result = collection->item(index->Uint32Value()); - return V8DOMWrapper::convertNodeToV8Object(result.release()); + return toV8(result.release()); } v8::Handle<v8::Value> V8HTMLAllCollection::namedPropertyGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) @@ -130,7 +132,7 @@ v8::Handle<v8::Value> V8HTMLAllCollection::callAsFunctionCallback(const v8::Argu Node* node = imp->namedItem(name); while (node) { if (!current) - return V8DOMWrapper::convertNodeToV8Object(node); + return toV8(node); node = imp->nextNamedItem(name); current--; diff --git a/WebCore/bindings/v8/custom/V8HTMLAudioElementConstructor.cpp b/WebCore/bindings/v8/custom/V8HTMLAudioElementConstructor.cpp index e634003..28b0a99 100644 --- a/WebCore/bindings/v8/custom/V8HTMLAudioElementConstructor.cpp +++ b/WebCore/bindings/v8/custom/V8HTMLAudioElementConstructor.cpp @@ -36,6 +36,7 @@ #include "Frame.h" #include "HTMLNames.h" #include "V8Binding.h" +#include "V8Document.h" #include "V8HTMLAudioElement.h" #include "V8Proxy.h" @@ -78,7 +79,7 @@ v8::Handle<v8::Value> V8Custom::v8HTMLAudioElementConstructorCallback(const v8:: // Make sure the document is added to the DOM Node map. Otherwise, the HTMLAudioElement instance // may end up being the only node in the map and get garbage-ccollected prematurely. - V8DOMWrapper::convertNodeToV8Object(document); + toV8(document); RefPtr<HTMLAudioElement> audio = new HTMLAudioElement(HTMLNames::audioTag, document); audio->setAutobuffer(true); diff --git a/WebCore/bindings/v8/custom/V8HTMLCanvasElementCustom.cpp b/WebCore/bindings/v8/custom/V8HTMLCanvasElementCustom.cpp index 0d1ff44..54a003c 100644 --- a/WebCore/bindings/v8/custom/V8HTMLCanvasElementCustom.cpp +++ b/WebCore/bindings/v8/custom/V8HTMLCanvasElementCustom.cpp @@ -36,9 +36,10 @@ #include "HTMLCanvasElement.h" #include "WebGLContextAttributes.h" #include "V8Binding.h" -#include "V8CustomBinding.h" +#include "V8CanvasRenderingContext2D.h" #include "V8Node.h" #include "V8Proxy.h" +#include "V8WebGLRenderingContext.h" namespace WebCore { @@ -77,10 +78,10 @@ v8::Handle<v8::Value> V8HTMLCanvasElement::getContextCallback(const v8::Argument if (!result) return v8::Undefined(); if (result->is2d()) - return V8DOMWrapper::convertToV8Object(V8ClassIndex::CANVASRENDERINGCONTEXT2D, result); + return toV8(static_cast<CanvasRenderingContext2D*>(result)); #if ENABLE(3D_CANVAS) else if (result->is3d()) - return V8DOMWrapper::convertToV8Object(V8ClassIndex::WEBGLRENDERINGCONTEXT, result); + return toV8(static_cast<WebGLRenderingContext*>(result)); #endif ASSERT_NOT_REACHED(); return v8::Undefined(); diff --git a/WebCore/bindings/v8/custom/V8HTMLCollectionCustom.cpp b/WebCore/bindings/v8/custom/V8HTMLCollectionCustom.cpp index 8bb3c3a..29ff6eb 100644 --- a/WebCore/bindings/v8/custom/V8HTMLCollectionCustom.cpp +++ b/WebCore/bindings/v8/custom/V8HTMLCollectionCustom.cpp @@ -34,7 +34,10 @@ #include "HTMLCollection.h" #include "V8Binding.h" #include "V8CustomBinding.h" +#include "V8HTMLAllCollection.h" #include "V8NamedNodesCollection.h" +#include "V8Node.h" +#include "V8NodeList.h" #include "V8Proxy.h" namespace WebCore { @@ -48,10 +51,10 @@ static v8::Handle<v8::Value> getNamedItems(HTMLCollection* collection, AtomicStr return v8::Handle<v8::Value>(); if (namedItems.size() == 1) - return V8DOMWrapper::convertNodeToV8Object(namedItems.at(0).release()); + return toV8(namedItems.at(0).release()); NodeList* list = new V8NamedNodesCollection(namedItems); - return V8DOMWrapper::convertToV8Object(V8ClassIndex::NODELIST, list); + return toV8(list); } static v8::Handle<v8::Value> getItem(HTMLCollection* collection, v8::Handle<v8::Value> argument) @@ -67,7 +70,7 @@ static v8::Handle<v8::Value> getItem(HTMLCollection* collection, v8::Handle<v8:: } RefPtr<Node> result = collection->item(index->Uint32Value()); - return V8DOMWrapper::convertNodeToV8Object(result.release()); + return toV8(result.release()); } v8::Handle<v8::Value> V8HTMLCollection::namedPropertyGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) @@ -129,7 +132,7 @@ v8::Handle<v8::Value> V8HTMLCollection::callAsFunctionCallback(const v8::Argumen Node* node = imp->namedItem(name); while (node) { if (!current) - return V8DOMWrapper::convertNodeToV8Object(node); + return toV8(node); node = imp->nextNamedItem(name); current--; @@ -138,4 +141,11 @@ v8::Handle<v8::Value> V8HTMLCollection::callAsFunctionCallback(const v8::Argumen return v8::Undefined(); } +v8::Handle<v8::Value> toV8(HTMLCollection* impl) +{ + if (impl->type() == DocAll) + return toV8(static_cast<HTMLAllCollection*>(impl)); + return V8HTMLCollection::wrap(impl); +} + } // namespace WebCore diff --git a/WebCore/bindings/v8/custom/V8HTMLDocumentCustom.cpp b/WebCore/bindings/v8/custom/V8HTMLDocumentCustom.cpp index 13243ef..6478e07 100644 --- a/WebCore/bindings/v8/custom/V8HTMLDocumentCustom.cpp +++ b/WebCore/bindings/v8/custom/V8HTMLDocumentCustom.cpp @@ -38,6 +38,11 @@ #include "HTMLIFrameElement.h" #include "HTMLNames.h" #include "V8Binding.h" +#include "V8DOMWindow.h" +#include "V8HTMLAllCollection.h" +#include "V8HTMLCollection.h" +#include "V8IsolatedContext.h" +#include "V8Node.h" #include "V8Proxy.h" #include <wtf/RefPtr.h> #include <wtf/StdLibExtras.h> @@ -91,12 +96,12 @@ v8::Handle<v8::Value> V8HTMLDocument::namedPropertyGetter(v8::Local<v8::String> Node* node = items->firstItem(); Frame* frame = 0; if (node->hasTagName(HTMLNames::iframeTag) && (frame = static_cast<HTMLIFrameElement*>(node)->contentFrame())) - return V8DOMWrapper::convertToV8Object(V8ClassIndex::DOMWINDOW, frame->domWindow()); + return toV8(frame->domWindow()); - return V8DOMWrapper::convertNodeToV8Object(node); + return toV8(node); } - return V8DOMWrapper::convertToV8Object(V8ClassIndex::HTMLCOLLECTION, items.release()); + return toV8(items.release()); } v8::Handle<v8::Value> V8HTMLDocument::indexedPropertyGetter(uint32_t index, const v8::AccessorInfo &info) @@ -181,10 +186,9 @@ v8::Handle<v8::Value> V8HTMLDocument::openCallback(const v8::Arguments& args) v8::Handle<v8::Value> V8HTMLDocument::allAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) { INC_STATS("DOM.HTMLDocument.all._get"); - v8::HandleScope scope; v8::Handle<v8::Object> holder = info.Holder(); HTMLDocument* htmlDocument = V8HTMLDocument::toNative(holder); - return V8DOMWrapper::convertToV8Object(V8ClassIndex::HTMLCOLLECTION, htmlDocument->all()); + return toV8(htmlDocument->all()); } void V8HTMLDocument::allAccessorSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info) @@ -195,4 +199,22 @@ void V8HTMLDocument::allAccessorSetter(v8::Local<v8::String> name, v8::Local<v8: info.Holder()->SetInternalField(V8HTMLDocument::shadowIndex, value); } +v8::Handle<v8::Value> toV8(HTMLDocument* impl, bool forceNewObject) +{ + if (!impl) + return v8::Null(); + v8::Handle<v8::Object> wrapper = V8HTMLDocument::wrap(impl, forceNewObject); + if (!V8IsolatedContext::getEntered()) { + if (V8Proxy* proxy = V8Proxy::retrieve(impl->frame())) + proxy->windowShell()->updateDocumentWrapper(wrapper); + } + // Create marker object and insert it in two internal fields. + // This is used to implement temporary shadowing of document.all. + ASSERT(wrapper->InternalFieldCount() == V8HTMLDocument::internalFieldCount); + v8::Local<v8::Object> marker = v8::Object::New(); + wrapper->SetInternalField(V8HTMLDocument::markerIndex, marker); + wrapper->SetInternalField(V8HTMLDocument::shadowIndex, marker); + return wrapper; +} + } // namespace WebCore diff --git a/WebCore/bindings/v8/custom/V8HTMLElementCustom.cpp b/WebCore/bindings/v8/custom/V8HTMLElementCustom.cpp new file mode 100644 index 0000000..0eb55e9 --- /dev/null +++ b/WebCore/bindings/v8/custom/V8HTMLElementCustom.cpp @@ -0,0 +1,45 @@ +/* + * 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 "V8HTMLElement.h" + +#include "V8HTMLElementWrapperFactory.h" + +namespace WebCore { + +v8::Handle<v8::Value> toV8(HTMLElement* impl, bool forceNewObject) +{ + if (!impl) + return v8::Null(); + return createV8HTMLWrapper(impl, forceNewObject); +} + +} // namespace WebCore diff --git a/WebCore/bindings/v8/custom/V8HTMLFormElementCustom.cpp b/WebCore/bindings/v8/custom/V8HTMLFormElementCustom.cpp index d819e9b..0a9e8dd 100644 --- a/WebCore/bindings/v8/custom/V8HTMLFormElementCustom.cpp +++ b/WebCore/bindings/v8/custom/V8HTMLFormElementCustom.cpp @@ -34,8 +34,9 @@ #include "HTMLCollection.h" #include "HTMLFormElement.h" #include "V8Binding.h" -#include "V8CustomBinding.h" #include "V8NamedNodesCollection.h" +#include "V8Node.h" +#include "V8NodeList.h" #include "V8Proxy.h" namespace WebCore { @@ -48,7 +49,7 @@ v8::Handle<v8::Value> V8HTMLFormElement::indexedPropertyGetter(uint32_t index, c RefPtr<Node> formElement = form->elements()->item(index); if (!formElement) return notHandledByInterceptor(); - return V8DOMWrapper::convertNodeToV8Object(formElement.release()); + return toV8(formElement.release()); } v8::Handle<v8::Value> V8HTMLFormElement::namedPropertyGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) @@ -74,10 +75,10 @@ v8::Handle<v8::Value> V8HTMLFormElement::namedPropertyGetter(v8::Local<v8::Strin ASSERT(!elements.isEmpty()); if (elements.size() == 1) - return V8DOMWrapper::convertNodeToV8Object(elements.at(0).release()); + return toV8(elements.at(0).release()); NodeList* collection = new V8NamedNodesCollection(elements); - return V8DOMWrapper::convertToV8Object(V8ClassIndex::NODELIST, collection); + return toV8(collection); } v8::Handle<v8::Value> V8HTMLFormElement::submitCallback(const v8::Arguments& args) diff --git a/WebCore/bindings/v8/custom/V8HTMLFrameSetElementCustom.cpp b/WebCore/bindings/v8/custom/V8HTMLFrameSetElementCustom.cpp index 214b11e..6a45be7 100644 --- a/WebCore/bindings/v8/custom/V8HTMLFrameSetElementCustom.cpp +++ b/WebCore/bindings/v8/custom/V8HTMLFrameSetElementCustom.cpp @@ -40,7 +40,7 @@ #include "Node.h" #include "V8Binding.h" -#include "V8CustomBinding.h" +#include "V8DOMWindow.h" #include "V8Proxy.h" namespace WebCore { @@ -55,7 +55,7 @@ v8::Handle<v8::Value> V8HTMLFrameSetElement::namedPropertyGetter(v8::Local<v8::S if (!doc) return v8::Undefined(); if (Frame* frame = doc->frame()) - return V8DOMWrapper::convertToV8Object(V8ClassIndex::DOMWINDOW, frame->domWindow()); + return toV8(frame->domWindow()); } return notHandledByInterceptor(); } diff --git a/WebCore/bindings/v8/custom/V8HTMLImageElementConstructor.cpp b/WebCore/bindings/v8/custom/V8HTMLImageElementConstructor.cpp index 57efa34..2c28fa5 100644 --- a/WebCore/bindings/v8/custom/V8HTMLImageElementConstructor.cpp +++ b/WebCore/bindings/v8/custom/V8HTMLImageElementConstructor.cpp @@ -36,6 +36,7 @@ #include "Frame.h" #include "HTMLNames.h" #include "V8Binding.h" +#include "V8Document.h" #include "V8HTMLImageElement.h" #include "V8Proxy.h" @@ -78,7 +79,7 @@ v8::Handle<v8::Value> V8Custom::v8HTMLImageElementConstructorCallback(const v8:: // Make sure the document is added to the DOM Node map. Otherwise, the HTMLImageElement instance // may end up being the only node in the map and get garbage-ccollected prematurely. - V8DOMWrapper::convertNodeToV8Object(document); + toV8(document); RefPtr<HTMLImageElement> image = new HTMLImageElement(HTMLNames::imgTag, document); if (args.Length() > 0) { diff --git a/WebCore/bindings/v8/custom/V8HTMLOptionsCollectionCustom.cpp b/WebCore/bindings/v8/custom/V8HTMLOptionsCollectionCustom.cpp index c060df7..81bc287 100644 --- a/WebCore/bindings/v8/custom/V8HTMLOptionsCollectionCustom.cpp +++ b/WebCore/bindings/v8/custom/V8HTMLOptionsCollectionCustom.cpp @@ -37,9 +37,9 @@ #include "V8Binding.h" #include "V8Collection.h" -#include "V8CustomBinding.h" #include "V8HTMLOptionElement.h" #include "V8HTMLSelectElementCustom.h" +#include "V8Node.h" #include "V8Proxy.h" namespace WebCore { @@ -123,7 +123,7 @@ v8::Handle<v8::Value> V8HTMLOptionsCollection::indexedPropertyGetter(uint32_t in if (!result) return notHandledByInterceptor(); - return V8DOMWrapper::convertNodeToV8Object(result.release()); + return toV8(result.release()); } v8::Handle<v8::Value> V8HTMLOptionsCollection::indexedPropertySetter(uint32_t index, v8::Local<v8::Value> value, const v8::AccessorInfo& info) diff --git a/WebCore/bindings/v8/custom/V8HTMLSelectElementCustom.cpp b/WebCore/bindings/v8/custom/V8HTMLSelectElementCustom.cpp index 0904b3e..d0d8dac 100644 --- a/WebCore/bindings/v8/custom/V8HTMLSelectElementCustom.cpp +++ b/WebCore/bindings/v8/custom/V8HTMLSelectElementCustom.cpp @@ -37,10 +37,11 @@ #include "V8Binding.h" #include "V8Collection.h" -#include "V8CustomBinding.h" #include "V8HTMLOptionElement.h" #include "V8HTMLSelectElement.h" #include "V8NamedNodesCollection.h" +#include "V8Node.h" +#include "V8NodeList.h" #include "V8Proxy.h" namespace WebCore { @@ -67,21 +68,20 @@ v8::Handle<v8::Value> V8HTMLSelectElement::namedPropertyGetter(v8::Local<v8::Str return notHandledByInterceptor(); if (items.size() == 1) - return V8DOMWrapper::convertNodeToV8Object(items.at(0).release()); + return toV8(items.at(0).release()); NodeList* list = new V8NamedNodesCollection(items); - return V8DOMWrapper::convertToV8Object(V8ClassIndex::NODELIST, list); + return toV8(list); } v8::Handle<v8::Value> V8HTMLSelectElement::indexedPropertyGetter(uint32_t index, const v8::AccessorInfo& info) { ASSERT(V8DOMWrapper::maybeDOMWrapper(info.Holder())); - ASSERT(V8DOMWrapper::domWrapperType(info.Holder()) == V8ClassIndex::NODE); RefPtr<Node> result = V8HTMLSelectElement::toNative(info.Holder())->item(index); if (!result) return notHandledByInterceptor(); - return V8DOMWrapper::convertNodeToV8Object(result.release()); + return toV8(result.release()); } v8::Handle<v8::Value> V8HTMLSelectElement::indexedPropertySetter(uint32_t index, v8::Local<v8::Value> value, const v8::AccessorInfo& info) diff --git a/WebCore/bindings/v8/custom/V8HistoryCustom.cpp b/WebCore/bindings/v8/custom/V8HistoryCustom.cpp index b857d6e..5e9c7c8 100644 --- a/WebCore/bindings/v8/custom/V8HistoryCustom.cpp +++ b/WebCore/bindings/v8/custom/V8HistoryCustom.cpp @@ -37,6 +37,7 @@ #include "V8Binding.h" #include "V8BindingState.h" #include "V8CustomBinding.h" +#include "V8DOMWindow.h" #include "V8Proxy.h" namespace WebCore { @@ -99,4 +100,17 @@ bool V8History::namedSecurityCheck(v8::Local<v8::Object> host, v8::Local<v8::Val return V8BindingSecurity::canAccessFrame(V8BindingState::Only(), history->frame(), false); } +v8::Handle<v8::Value> toV8(History* impl) +{ + if (!impl) + return v8::Null(); + v8::Handle<v8::Object> wrapper = getDOMObjectMap().get(impl); + if (wrapper.IsEmpty()) { + wrapper = V8History::wrap(impl); + if (!wrapper.IsEmpty()) + V8DOMWrapper::setHiddenWindowReference(impl->frame(), V8DOMWindow::historyIndex, wrapper); + } + return wrapper; +} + } // namespace WebCore diff --git a/WebCore/bindings/v8/custom/V8IDBRequestCustom.cpp b/WebCore/bindings/v8/custom/V8IDBRequestCustom.cpp index 5ee9542..ccf4d0e 100644 --- a/WebCore/bindings/v8/custom/V8IDBRequestCustom.cpp +++ b/WebCore/bindings/v8/custom/V8IDBRequestCustom.cpp @@ -29,6 +29,8 @@ */ #include "config.h" + +#if ENABLE(INDEXED_DATABASE) #include "V8IDBRequest.h" #include "SerializedScriptValue.h" @@ -47,3 +49,5 @@ v8::Handle<v8::Value> V8IDBRequest::resultAccessorGetter(v8::Local<v8::String> n } } // namespace WebCore + +#endif diff --git a/WebCore/bindings/v8/custom/V8IndexedDatabaseRequestCustom.cpp b/WebCore/bindings/v8/custom/V8IndexedDatabaseRequestCustom.cpp index 66220ea..0fd182c 100644 --- a/WebCore/bindings/v8/custom/V8IndexedDatabaseRequestCustom.cpp +++ b/WebCore/bindings/v8/custom/V8IndexedDatabaseRequestCustom.cpp @@ -29,6 +29,8 @@ */ #include "config.h" + +#if ENABLE(INDEXED_DATABASE) #include "V8IndexedDatabaseRequest.h" #include "V8Binding.h" @@ -55,3 +57,5 @@ v8::Handle<v8::Value> V8IndexedDatabaseRequest::openCallback(const v8::Arguments } } // namespace WebCore + +#endif diff --git a/WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp b/WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp index 0ddcf97..ad4ed01 100644 --- a/WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp +++ b/WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp @@ -34,13 +34,13 @@ #include "DOMWindow.h" #include "Database.h" #include "Frame.h" +#include "InjectedScript.h" #include "InjectedScriptHost.h" #include "InspectorController.h" #include "Node.h" #include "Page.h" #include "V8Binding.h" -#include "V8CustomBinding.h" #include "V8Database.h" #include "V8Node.h" #include "V8Proxy.h" @@ -85,7 +85,7 @@ static ScriptObject createInjectedScript(const String& scriptSource, InjectedScr v8::Context::Scope contextScope(inspectedContext); // Call custom code to create InjectedScripHost wrapper specific for the context - // instead of calling V8DOMWrapper::convertToV8Object that would create the + // instead of calling toV8() that would create the // wrapper in the current context. // FIXME: make it possible to use generic bindings factory for InjectedScriptHost. v8::Local<v8::Object> scriptHostWrapper = createInjectedScriptHostV8Wrapper(injectedScriptHost); @@ -130,7 +130,7 @@ v8::Handle<v8::Value> V8InjectedScriptHost::nodeForIdCallback(const v8::Argument if (!ic) return v8::Undefined(); - return V8DOMWrapper::convertToV8Object(V8ClassIndex::NODE, node); + return toV8(node); } v8::Handle<v8::Value> V8InjectedScriptHost::pushNodePathToFrontendCallback(const v8::Arguments& args) @@ -160,7 +160,7 @@ v8::Handle<v8::Value> V8InjectedScriptHost::databaseForIdCallback(const v8::Argu Database* database = host->databaseForId(args[0]->ToInt32()->Value()); if (!database) return v8::Undefined(); - return V8DOMWrapper::convertToV8Object<Database>(V8ClassIndex::DATABASE, database); + return toV8(database); } v8::Handle<v8::Value> V8InjectedScriptHost::selectDatabaseCallback(const v8::Arguments& args) @@ -194,7 +194,7 @@ v8::Handle<v8::Value> V8InjectedScriptHost::selectDOMStorageCallback(const v8::A } #endif -ScriptObject InjectedScriptHost::injectedScriptFor(ScriptState* inspectedScriptState) +InjectedScript InjectedScriptHost::injectedScriptFor(ScriptState* inspectedScriptState) { v8::HandleScope handleScope; v8::Local<v8::Context> context = inspectedScriptState->context(); @@ -208,14 +208,15 @@ ScriptObject InjectedScriptHost::injectedScriptFor(ScriptState* inspectedScriptS v8::Local<v8::String> key = v8::String::New("Devtools_InjectedScript"); v8::Local<v8::Value> val = global->GetHiddenValue(key); if (!val.IsEmpty() && val->IsObject()) - return ScriptObject(inspectedScriptState, v8::Local<v8::Object>::Cast(val)); + return InjectedScript(ScriptObject(inspectedScriptState, v8::Local<v8::Object>::Cast(val))); ASSERT(!m_injectedScriptSource.isEmpty()); ScriptObject injectedScriptObject = createInjectedScript(m_injectedScriptSource, this, inspectedScriptState, m_nextInjectedScriptId); - m_idToInjectedScript.set(m_nextInjectedScriptId, injectedScriptObject); + InjectedScript result(injectedScriptObject); + m_idToInjectedScript.set(m_nextInjectedScriptId, result); ++m_nextInjectedScriptId; global->SetHiddenValue(key, injectedScriptObject.v8Object()); - return injectedScriptObject; + return result; } } // namespace WebCore diff --git a/WebCore/bindings/v8/custom/V8LocationCustom.cpp b/WebCore/bindings/v8/custom/V8LocationCustom.cpp index ce816b6..7c9c529 100644 --- a/WebCore/bindings/v8/custom/V8LocationCustom.cpp +++ b/WebCore/bindings/v8/custom/V8LocationCustom.cpp @@ -43,6 +43,7 @@ #include "V8BindingState.h" #include "V8CustomBinding.h" #include "V8CustomEventListener.h" +#include "V8DOMWindow.h" #include "V8Location.h" #include "V8Utilities.h" #include "V8Proxy.h" @@ -358,5 +359,18 @@ bool V8Location::namedSecurityCheck(v8::Local<v8::Object> host, v8::Local<v8::Va return V8BindingSecurity::canAccessFrame(V8BindingState::Only(), imp->frame(), false); } +v8::Handle<v8::Value> toV8(Location* impl) +{ + if (!impl) + return v8::Null(); + v8::Handle<v8::Object> wrapper = getDOMObjectMap().get(impl); + if (wrapper.IsEmpty()) { + wrapper = V8Location::wrap(impl); + if (!wrapper.IsEmpty()) + V8DOMWrapper::setHiddenWindowReference(impl->frame(), V8DOMWindow::locationIndex, wrapper); + } + return wrapper; +} + } // namespace WebCore diff --git a/WebCore/bindings/v8/custom/V8MessageChannelConstructor.cpp b/WebCore/bindings/v8/custom/V8MessageChannelConstructor.cpp index 3ea8e26..4fb82ba 100644 --- a/WebCore/bindings/v8/custom/V8MessageChannelConstructor.cpp +++ b/WebCore/bindings/v8/custom/V8MessageChannelConstructor.cpp @@ -35,6 +35,7 @@ #include "Frame.h" #include "MessageChannel.h" #include "V8Binding.h" +#include "V8MessagePort.h" #include "V8Proxy.h" #include "V8Utilities.h" #include "WorkerContext.h" @@ -66,8 +67,8 @@ v8::Handle<v8::Value> V8MessageChannel::constructorCallback(const v8::Arguments& // Create references from the MessageChannel wrapper to the two // MessagePort wrappers to make sure that the MessagePort wrappers // stay alive as long as the MessageChannel wrapper is around. - messageChannel->SetInternalField(V8MessageChannel::port1Index, V8DOMWrapper::convertToV8Object(V8ClassIndex::MESSAGEPORT, obj->port1())); - messageChannel->SetInternalField(V8MessageChannel::port2Index, V8DOMWrapper::convertToV8Object(V8ClassIndex::MESSAGEPORT, obj->port2())); + messageChannel->SetInternalField(V8MessageChannel::port1Index, toV8(obj->port1())); + messageChannel->SetInternalField(V8MessageChannel::port2Index, toV8(obj->port2())); // Setup the standard wrapper object internal fields. V8DOMWrapper::setDOMWrapper(messageChannel, V8ClassIndex::MESSAGECHANNEL, obj.get()); diff --git a/WebCore/bindings/v8/custom/V8MessageEventCustom.cpp b/WebCore/bindings/v8/custom/V8MessageEventCustom.cpp index 9e40855..9f2c080 100644 --- a/WebCore/bindings/v8/custom/V8MessageEventCustom.cpp +++ b/WebCore/bindings/v8/custom/V8MessageEventCustom.cpp @@ -35,8 +35,8 @@ #include "SerializedScriptValue.h" #include "V8Binding.h" -#include "V8CustomBinding.h" #include "V8DOMWindow.h" +#include "V8MessagePort.h" #include "V8MessagePortCustom.h" #include "V8Proxy.h" @@ -53,7 +53,7 @@ v8::Handle<v8::Value> V8MessageEvent::portsAccessorGetter(v8::Local<v8::String> v8::Local<v8::Array> portArray = v8::Array::New(ports->size()); for (size_t i = 0; i < ports->size(); ++i) - portArray->Set(v8::Integer::New(i), V8DOMWrapper::convertToV8Object(V8ClassIndex::MESSAGEPORT, (*ports)[i].get())); + portArray->Set(v8::Integer::New(i), toV8((*ports)[i].get())); return portArray; } diff --git a/WebCore/bindings/v8/custom/V8NamedNodeMapCustom.cpp b/WebCore/bindings/v8/custom/V8NamedNodeMapCustom.cpp index c7fff5a..611ab94 100644 --- a/WebCore/bindings/v8/custom/V8NamedNodeMapCustom.cpp +++ b/WebCore/bindings/v8/custom/V8NamedNodeMapCustom.cpp @@ -33,7 +33,8 @@ #include "NamedNodeMap.h" #include "V8Binding.h" -#include "V8CustomBinding.h" +#include "V8Element.h" +#include "V8Node.h" #include "V8Proxy.h" #include <wtf/RefPtr.h> @@ -48,7 +49,7 @@ v8::Handle<v8::Value> V8NamedNodeMap::indexedPropertyGetter(uint32_t index, cons if (!result) return notHandledByInterceptor(); - return V8DOMWrapper::convertNodeToV8Object(result.release()); + return toV8(result.release()); } v8::Handle<v8::Value> V8NamedNodeMap::namedPropertyGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) @@ -69,7 +70,21 @@ v8::Handle<v8::Value> V8NamedNodeMap::namedPropertyGetter(v8::Local<v8::String> if (!result) return notHandledByInterceptor(); - return V8DOMWrapper::convertNodeToV8Object(result.release()); + return toV8(result.release()); +} + +v8::Handle<v8::Value> toV8(NamedNodeMap* impl) +{ + if (!impl) + return v8::Null(); + v8::Handle<v8::Object> wrapper = V8NamedNodeMap::wrap(impl); + // Add a hidden reference from named node map to its owner node. + Element* element = impl->element(); + if (!wrapper.IsEmpty() && element) { + v8::Handle<v8::Value> owner = toV8(element); + wrapper->SetInternalField(V8NamedNodeMap::ownerNodeIndex, owner); + } + return wrapper; } } // namespace WebCore diff --git a/WebCore/bindings/v8/custom/V8NavigatorCustom.cpp b/WebCore/bindings/v8/custom/V8NavigatorCustom.cpp index ec5c1dc..22e84c9 100644 --- a/WebCore/bindings/v8/custom/V8NavigatorCustom.cpp +++ b/WebCore/bindings/v8/custom/V8NavigatorCustom.cpp @@ -33,12 +33,17 @@ #include "ExceptionCode.h" #include "RuntimeEnabledFeatures.h" +<<<<<<< HEAD #include "V8Binding.h" #include "V8Proxy.h" #if PLATFORM(ANDROID) #include "V8CustomApplicationInstalledCallback.h" #endif +======= +#include "V8DOMWindow.h" +#include "V8DOMWrapper.h" +>>>>>>> webkit.org at r54340 namespace WebCore { @@ -49,6 +54,7 @@ bool V8Navigator::GeolocationEnabled() } #endif +<<<<<<< HEAD #if PLATFORM(ANDROID) && ENABLE(APPLICATION_INSTALLED) static PassRefPtr<ApplicationInstalledCallback> createApplicationInstalledCallback( @@ -93,4 +99,19 @@ v8::Handle<v8::Value> V8Navigator::isApplicationInstalledCallback(const v8::Argu #endif // PLATFORM(ANDROID) && ENABLE(APPLICATION_INSTALLED) +======= +v8::Handle<v8::Value> toV8(Navigator* impl) +{ + if (!impl) + return v8::Null(); + v8::Handle<v8::Object> wrapper = getDOMObjectMap().get(impl); + if (wrapper.IsEmpty()) { + wrapper = V8Navigator::wrap(impl); + if (!wrapper.IsEmpty()) + V8DOMWrapper::setHiddenWindowReference(impl->frame(), V8DOMWindow::navigatorIndex, wrapper); + } + return wrapper; +} + +>>>>>>> webkit.org at r54340 } // namespace WebCore diff --git a/WebCore/bindings/v8/custom/V8NodeCustom.cpp b/WebCore/bindings/v8/custom/V8NodeCustom.cpp index 79afbe8..06489fd 100644 --- a/WebCore/bindings/v8/custom/V8NodeCustom.cpp +++ b/WebCore/bindings/v8/custom/V8NodeCustom.cpp @@ -35,11 +35,23 @@ #include "EventListener.h" #include "V8AbstractEventListener.h" +#include "V8Attr.h" #include "V8Binding.h" +#include "V8CDATASection.h" +#include "V8Comment.h" #include "V8CustomBinding.h" #include "V8CustomEventListener.h" +#include "V8Document.h" +#include "V8DocumentFragment.h" +#include "V8DocumentType.h" +#include "V8Element.h" +#include "V8Entity.h" +#include "V8EntityReference.h" #include "V8Node.h" +#include "V8Notation.h" +#include "V8ProcessingInstruction.h" #include "V8Proxy.h" +#include "V8Text.h" #include <wtf/RefPtr.h> @@ -152,4 +164,43 @@ v8::Handle<v8::Value> V8Node::appendChildCallback(const v8::Arguments& args) return v8::Null(); } +v8::Handle<v8::Value> toV8(Node* impl, bool forceNewObject) +{ + if (!impl) + return v8::Null(); + + if (!forceNewObject) { + v8::Handle<v8::Value> wrapper = V8DOMWrapper::getWrapper(impl); + if (!wrapper.IsEmpty()) + return wrapper; + } + switch (impl->nodeType()) { + case Node::ELEMENT_NODE: + return toV8(static_cast<Element*>(impl), forceNewObject); + case Node::ATTRIBUTE_NODE: + return toV8(static_cast<Attr*>(impl), forceNewObject); + case Node::TEXT_NODE: + return toV8(static_cast<Text*>(impl), forceNewObject); + case Node::CDATA_SECTION_NODE: + return toV8(static_cast<CDATASection*>(impl), forceNewObject); + case Node::ENTITY_REFERENCE_NODE: + return toV8(static_cast<EntityReference*>(impl), forceNewObject); + case Node::ENTITY_NODE: + return toV8(static_cast<Entity*>(impl), forceNewObject); + case Node::PROCESSING_INSTRUCTION_NODE: + return toV8(static_cast<ProcessingInstruction*>(impl), forceNewObject); + case Node::COMMENT_NODE: + return toV8(static_cast<Comment*>(impl), forceNewObject); + case Node::DOCUMENT_NODE: + return toV8(static_cast<Document*>(impl), forceNewObject); + case Node::DOCUMENT_TYPE_NODE: + return toV8(static_cast<DocumentType*>(impl), forceNewObject); + case Node::DOCUMENT_FRAGMENT_NODE: + return toV8(static_cast<DocumentFragment*>(impl), forceNewObject); + case Node::NOTATION_NODE: + return toV8(static_cast<Notation*>(impl), forceNewObject); + default: break; // XPATH_NAMESPACE_NODE + } + return V8Node::wrap(impl, forceNewObject); +} } // namespace WebCore diff --git a/WebCore/bindings/v8/custom/V8NodeIteratorCustom.cpp b/WebCore/bindings/v8/custom/V8NodeIteratorCustom.cpp index 074eac3..728b3dc 100644 --- a/WebCore/bindings/v8/custom/V8NodeIteratorCustom.cpp +++ b/WebCore/bindings/v8/custom/V8NodeIteratorCustom.cpp @@ -35,7 +35,7 @@ #include "ScriptState.h" #include "V8Binding.h" -#include "V8CustomBinding.h" +#include "V8Node.h" #include "V8Proxy.h" #include <wtf/PassRefPtr.h> @@ -54,7 +54,7 @@ static inline v8::Handle<v8::Value> toV8(PassRefPtr<Node> object, ExceptionCode if (!object) return v8::Null(); - return V8DOMWrapper::convertNodeToV8Object(object); + return toV8(object); } v8::Handle<v8::Value> V8NodeIterator::nextNodeCallback(const v8::Arguments& args) diff --git a/WebCore/bindings/v8/custom/V8NodeListCustom.cpp b/WebCore/bindings/v8/custom/V8NodeListCustom.cpp index 5721a7e..20a5471 100644 --- a/WebCore/bindings/v8/custom/V8NodeListCustom.cpp +++ b/WebCore/bindings/v8/custom/V8NodeListCustom.cpp @@ -32,9 +32,8 @@ #include "V8NodeList.h" #include "NodeList.h" - #include "V8Binding.h" -#include "V8CustomBinding.h" +#include "V8Node.h" #include "V8Proxy.h" #include <wtf/RefPtr.h> @@ -57,7 +56,7 @@ v8::Handle<v8::Value> V8NodeList::namedPropertyGetter(v8::Local<v8::String> name if (!result) return notHandledByInterceptor(); - return V8DOMWrapper::convertNodeToV8Object(result.release()); + return toV8(result.release()); } // Need to support call so that list(0) works. @@ -75,7 +74,7 @@ v8::Handle<v8::Value> V8NodeList::callAsFunctionCallback(const v8::Arguments& ar return v8::Undefined(); RefPtr<Node> result = list->item(index->Uint32Value()); - return V8DOMWrapper::convertNodeToV8Object(result.release()); + return toV8(result.release()); } } // namespace WebCore diff --git a/WebCore/bindings/v8/custom/V8NotificationCenterCustom.cpp b/WebCore/bindings/v8/custom/V8NotificationCenterCustom.cpp index 1cb4554..5531b48 100644 --- a/WebCore/bindings/v8/custom/V8NotificationCenterCustom.cpp +++ b/WebCore/bindings/v8/custom/V8NotificationCenterCustom.cpp @@ -37,7 +37,6 @@ #include "Notification.h" #include "NotificationCenter.h" #include "V8Binding.h" -#include "V8CustomBinding.h" #include "V8CustomEventListener.h" #include "V8CustomVoidCallback.h" #include "V8Notification.h" @@ -95,7 +94,7 @@ v8::Handle<v8::Value> V8NotificationCenter::createHTMLNotificationCallback(const if (notificationCenter->context()->isWorkerContext()) return WorkerContextExecutionProxy::convertToV8Object(V8ClassIndex::NOTIFICATION, notification.get()); - return V8DOMWrapper::convertToV8Object(V8ClassIndex::NOTIFICATION, notification.get()); + return toV8(notification.get()); } v8::Handle<v8::Value> V8NotificationCenter::createNotificationCallback(const v8::Arguments& args) @@ -112,7 +111,7 @@ v8::Handle<v8::Value> V8NotificationCenter::createNotificationCallback(const v8: if (notificationCenter->context()->isWorkerContext()) return WorkerContextExecutionProxy::convertToV8Object(V8ClassIndex::NOTIFICATION, notification.get()); - return V8DOMWrapper::convertToV8Object(V8ClassIndex::NOTIFICATION, notification.get()); + return toV8(notification.get()); } v8::Handle<v8::Value> V8NotificationCenter::requestPermissionCallback(const v8::Arguments& args) diff --git a/WebCore/bindings/v8/custom/V8SVGDocumentCustom.cpp b/WebCore/bindings/v8/custom/V8SVGDocumentCustom.cpp new file mode 100644 index 0000000..4cefc0e --- /dev/null +++ b/WebCore/bindings/v8/custom/V8SVGDocumentCustom.cpp @@ -0,0 +1,51 @@ +/* + * 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 "V8SVGDocument.h" + +#include "V8IsolatedContext.h" +#include "V8Proxy.h" + +namespace WebCore { + +v8::Handle<v8::Value> toV8(SVGDocument* impl, bool forceNewObject) +{ + if (!impl) + return v8::Null(); + v8::Handle<v8::Object> wrapper = V8SVGDocument::wrap(impl, forceNewObject); + if (!V8IsolatedContext::getEntered()) { + if (V8Proxy* proxy = V8Proxy::retrieve(impl->frame())) + proxy->windowShell()->updateDocumentWrapper(wrapper); + } + return wrapper; +} + +} // namespace WebCore diff --git a/WebCore/bindings/v8/custom/V8SVGElementCustom.cpp b/WebCore/bindings/v8/custom/V8SVGElementCustom.cpp new file mode 100644 index 0000000..0ce48ce --- /dev/null +++ b/WebCore/bindings/v8/custom/V8SVGElementCustom.cpp @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms") return toV8(static_cast<SVGwith or without + * modification") return toV8(static_cast<SVGare permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice") return toV8(static_cast<SVGthis list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice") return toV8(static_cast<SVGthis 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") return toV8(static_cast<SVGINCLUDING") return toV8(static_cast<SVGBUT NOT + * LIMITED TO") return toV8(static_cast<SVGTHE 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") return toV8(static_cast<SVGINDIRECT") return toV8(static_cast<SVGINCIDENTAL, + * SPECIAL") return toV8(static_cast<SVGEXEMPLARY") return toV8(static_cast<SVGOR CONSEQUENTIAL DAMAGES (INCLUDING") return toV8(static_cast<SVGBUT NOT + * LIMITED TO") return toV8(static_cast<SVGPROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA") return toV8(static_cast<SVGOR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY") return toV8(static_cast<SVGWHETHER IN CONTRACT") return toV8(static_cast<SVGSTRICT LIABILITY") return toV8(static_cast<SVGOR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE") return toV8(static_cast<SVGEVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "V8SVGElement.h" + +#if ENABLE(SVG) + +#include "V8SVGElementWrapperFactory.h" + +namespace WebCore { + +v8::Handle<v8::Value> toV8(SVGElement* impl, bool forceNewObject) +{ + if (!impl) + return v8::Null(); + return createV8SVGWrapper(impl, forceNewObject); +} + +} // namespace WebCore + +#endif // ENABLE(SVG) diff --git a/WebCore/bindings/v8/custom/V8SVGMatrixCustom.cpp b/WebCore/bindings/v8/custom/V8SVGMatrixCustom.cpp index 78284cd..0a75c9f 100644 --- a/WebCore/bindings/v8/custom/V8SVGMatrixCustom.cpp +++ b/WebCore/bindings/v8/custom/V8SVGMatrixCustom.cpp @@ -31,16 +31,13 @@ #include <config.h> #if ENABLE(SVG) - #include "TransformationMatrix.h" #include "SVGException.h" - #include "V8Binding.h" -#include "V8CustomBinding.h" +#include "V8Proxy.h" #include "V8SVGMatrix.h" #include "V8SVGPODTypeWrapper.h" -#include "V8Proxy.h" namespace WebCore { @@ -56,7 +53,8 @@ v8::Handle<v8::Value> V8SVGMatrix::multiplyCallback(const v8::Arguments& args) TransformationMatrix m1 = *V8SVGPODTypeWrapper<TransformationMatrix>::toNative(args.Holder()); TransformationMatrix m2 = *V8SVGPODTypeWrapper<TransformationMatrix>::toNative(v8::Handle<v8::Object>::Cast(args[0])); - return V8DOMWrapper::convertToV8Object(V8ClassIndex::SVGMATRIX, V8SVGStaticPODTypeWrapper<TransformationMatrix>::create(m1.multLeft(m2))); + RefPtr<V8SVGStaticPODTypeWrapper<TransformationMatrix> > wrapper = V8SVGStaticPODTypeWrapper<TransformationMatrix>::create(m1.multLeft(m2)); + return toV8(wrapper.get()); } v8::Handle<v8::Value> V8SVGMatrix::inverseCallback(const v8::Arguments& args) @@ -74,7 +72,8 @@ v8::Handle<v8::Value> V8SVGMatrix::inverseCallback(const v8::Arguments& args) return v8::Handle<v8::Value>(); } - return V8DOMWrapper::convertToV8Object(V8ClassIndex::SVGMATRIX, V8SVGStaticPODTypeWrapper<TransformationMatrix>::create(result)); + RefPtr<V8SVGStaticPODTypeWrapper<TransformationMatrix> > wrapper = V8SVGStaticPODTypeWrapper<TransformationMatrix>::create(result); + return toV8(wrapper.get()); } v8::Handle<v8::Value> V8SVGMatrix::rotateFromVectorCallback(const v8::Arguments& args) @@ -94,7 +93,8 @@ v8::Handle<v8::Value> V8SVGMatrix::rotateFromVectorCallback(const v8::Arguments& return v8::Handle<v8::Value>(); } - return V8DOMWrapper::convertToV8Object(V8ClassIndex::SVGMATRIX, V8SVGStaticPODTypeWrapper<TransformationMatrix>::create(result)); + RefPtr<V8SVGStaticPODTypeWrapper<TransformationMatrix> > wrapper = V8SVGStaticPODTypeWrapper<TransformationMatrix>::create(result); + return toV8(wrapper.get()); } } // namespace WebCore diff --git a/WebCore/bindings/v8/custom/V8SVGPathSegCustom.cpp b/WebCore/bindings/v8/custom/V8SVGPathSegCustom.cpp new file mode 100644 index 0000000..a96d55e --- /dev/null +++ b/WebCore/bindings/v8/custom/V8SVGPathSegCustom.cpp @@ -0,0 +1,106 @@ +/* + * 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 "V8SVGPathSeg.h" + +#include "V8DOMWindow.h" +#include "V8DOMWrapper.h" +#include "V8SVGPathSegArcAbs.h" +#include "V8SVGPathSegArcRel.h" +#include "V8SVGPathSegClosePath.h" +#include "V8SVGPathSegCurvetoCubicAbs.h" +#include "V8SVGPathSegCurvetoCubicRel.h" +#include "V8SVGPathSegCurvetoCubicSmoothAbs.h" +#include "V8SVGPathSegCurvetoCubicSmoothRel.h" +#include "V8SVGPathSegCurvetoQuadraticAbs.h" +#include "V8SVGPathSegCurvetoQuadraticRel.h" +#include "V8SVGPathSegCurvetoQuadraticSmoothAbs.h" +#include "V8SVGPathSegCurvetoQuadraticSmoothRel.h" +#include "V8SVGPathSegLinetoAbs.h" +#include "V8SVGPathSegLinetoHorizontalAbs.h" +#include "V8SVGPathSegLinetoHorizontalRel.h" +#include "V8SVGPathSegLinetoRel.h" +#include "V8SVGPathSegLinetoVerticalAbs.h" +#include "V8SVGPathSegLinetoVerticalRel.h" +#include "V8SVGPathSegMovetoAbs.h" +#include "V8SVGPathSegMovetoRel.h" + +namespace WebCore { + +v8::Handle<v8::Value> toV8(SVGPathSeg* impl) +{ + if (!impl) + return v8::Null(); + switch (impl->pathSegType()) { + case SVGPathSeg::PATHSEG_CLOSEPATH: + return toV8(static_cast<SVGPathSegClosePath*>(impl)); + case SVGPathSeg::PATHSEG_MOVETO_ABS: + return toV8(static_cast<SVGPathSegMovetoAbs*>(impl)); + case SVGPathSeg::PATHSEG_MOVETO_REL: + return toV8(static_cast<SVGPathSegMovetoRel*>(impl)); + case SVGPathSeg::PATHSEG_LINETO_ABS: + return toV8(static_cast<SVGPathSegLinetoAbs*>(impl)); + case SVGPathSeg::PATHSEG_LINETO_REL: + return toV8(static_cast<SVGPathSegLinetoRel*>(impl)); + case SVGPathSeg::PATHSEG_CURVETO_CUBIC_ABS: + return toV8(static_cast<SVGPathSegCurvetoCubicAbs*>(impl)); + case SVGPathSeg::PATHSEG_CURVETO_CUBIC_REL: + return toV8(static_cast<SVGPathSegCurvetoCubicRel*>(impl)); + case SVGPathSeg::PATHSEG_CURVETO_QUADRATIC_ABS: + return toV8(static_cast<SVGPathSegCurvetoQuadraticAbs*>(impl)); + case SVGPathSeg::PATHSEG_CURVETO_QUADRATIC_REL: + return toV8(static_cast<SVGPathSegCurvetoQuadraticRel*>(impl)); + case SVGPathSeg::PATHSEG_ARC_ABS: + return toV8(static_cast<SVGPathSegArcAbs*>(impl)); + case SVGPathSeg::PATHSEG_ARC_REL: + return toV8(static_cast<SVGPathSegArcRel*>(impl)); + case SVGPathSeg::PATHSEG_LINETO_HORIZONTAL_ABS: + return toV8(static_cast<SVGPathSegLinetoHorizontalAbs*>(impl)); + case SVGPathSeg::PATHSEG_LINETO_HORIZONTAL_REL: + return toV8(static_cast<SVGPathSegLinetoHorizontalRel*>(impl)); + case SVGPathSeg::PATHSEG_LINETO_VERTICAL_ABS: + return toV8(static_cast<SVGPathSegLinetoVerticalAbs*>(impl)); + case SVGPathSeg::PATHSEG_LINETO_VERTICAL_REL: + return toV8(static_cast<SVGPathSegLinetoVerticalRel*>(impl)); + case SVGPathSeg::PATHSEG_CURVETO_CUBIC_SMOOTH_ABS: + return toV8(static_cast<SVGPathSegCurvetoCubicSmoothAbs*>(impl)); + case SVGPathSeg::PATHSEG_CURVETO_CUBIC_SMOOTH_REL: + return toV8(static_cast<SVGPathSegCurvetoCubicSmoothRel*>(impl)); + case SVGPathSeg::PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS: + return toV8(static_cast<SVGPathSegCurvetoQuadraticSmoothAbs*>(impl)); + case SVGPathSeg::PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL: + return toV8(static_cast<SVGPathSegCurvetoQuadraticSmoothRel*>(impl)); + } + ASSERT_NOT_REACHED(); + return V8SVGPathSeg::wrap(impl); +} + +} // namespace WebCore diff --git a/WebCore/bindings/v8/custom/V8ScreenCustom.cpp b/WebCore/bindings/v8/custom/V8ScreenCustom.cpp new file mode 100644 index 0000000..98d9dd7 --- /dev/null +++ b/WebCore/bindings/v8/custom/V8ScreenCustom.cpp @@ -0,0 +1,52 @@ +/* + * 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 "V8Screen.h" + +#include "V8DOMWindow.h" +#include "V8DOMWrapper.h" + +namespace WebCore { + +v8::Handle<v8::Value> toV8(Screen* impl) +{ + if (!impl) + return v8::Null(); + v8::Handle<v8::Object> wrapper = getDOMObjectMap().get(impl); + if (wrapper.IsEmpty()) { + wrapper = V8Screen::wrap(impl); + if (!wrapper.IsEmpty()) + V8DOMWrapper::setHiddenWindowReference(impl->frame(), V8DOMWindow::screenIndex, wrapper); + } + return wrapper; +} + +} // namespace WebCore diff --git a/WebCore/bindings/v8/custom/V8StyleSheetCustom.cpp b/WebCore/bindings/v8/custom/V8StyleSheetCustom.cpp new file mode 100644 index 0000000..b062cdc --- /dev/null +++ b/WebCore/bindings/v8/custom/V8StyleSheetCustom.cpp @@ -0,0 +1,55 @@ +/* + * 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 "V8StyleSheet.h" + +#include "V8CSSStyleSheet.h" +#include "V8Node.h" + +namespace WebCore { + +v8::Handle<v8::Value> toV8(StyleSheet* impl) +{ + if (!impl) + return v8::Null(); + if (impl->isCSSStyleSheet()) + return toV8(static_cast<CSSStyleSheet*>(impl)); + v8::Handle<v8::Object> wrapper = V8StyleSheet::wrap(impl); + // Add a hidden reference from stylesheet object to its owner node. + Node* ownerNode = impl->ownerNode(); + if (ownerNode && !wrapper.IsEmpty()) { + v8::Handle<v8::Object> owner = v8::Handle<v8::Object>::Cast(toV8(ownerNode)); + wrapper->SetInternalField(V8StyleSheet::ownerNodeIndex, owner); + } + return wrapper; +} + +} // namespace WebCore diff --git a/WebCore/bindings/v8/custom/V8StyleSheetListCustom.cpp b/WebCore/bindings/v8/custom/V8StyleSheetListCustom.cpp index a718451..cee1838 100644 --- a/WebCore/bindings/v8/custom/V8StyleSheetListCustom.cpp +++ b/WebCore/bindings/v8/custom/V8StyleSheetListCustom.cpp @@ -34,8 +34,8 @@ #include "HTMLStyleElement.h" #include "StyleSheetList.h" #include "V8Binding.h" -#include "V8CustomBinding.h" #include "V8Proxy.h" +#include "V8StyleSheet.h" namespace WebCore { @@ -52,7 +52,7 @@ v8::Handle<v8::Value> V8StyleSheetList::namedPropertyGetter(v8::Local<v8::String if (!item) return notHandledByInterceptor(); - return V8DOMWrapper::convertToV8Object(V8ClassIndex::STYLESHEET, item->sheet()); + return toV8(item->sheet()); } } // namespace WebCore diff --git a/WebCore/bindings/v8/custom/V8TreeWalkerCustom.cpp b/WebCore/bindings/v8/custom/V8TreeWalkerCustom.cpp index b848197..37087df 100644 --- a/WebCore/bindings/v8/custom/V8TreeWalkerCustom.cpp +++ b/WebCore/bindings/v8/custom/V8TreeWalkerCustom.cpp @@ -36,7 +36,7 @@ #include "TreeWalker.h" #include "V8Binding.h" -#include "V8CustomBinding.h" +#include "V8Node.h" #include "V8Proxy.h" #include <wtf/PassRefPtr.h> @@ -44,7 +44,7 @@ namespace WebCore { -static inline v8::Handle<v8::Value> toV8(PassRefPtr<Node> object, ScriptState* state) +static inline v8::Handle<v8::Value> toV8Object(PassRefPtr<Node> object, ScriptState* state) { if (state->hadException()) return throwError(state->exception()); @@ -52,7 +52,7 @@ static inline v8::Handle<v8::Value> toV8(PassRefPtr<Node> object, ScriptState* s if (!object) return v8::Null(); - return V8DOMWrapper::convertNodeToV8Object(object); + return toV8(object); } v8::Handle<v8::Value> V8TreeWalker::parentNodeCallback(const v8::Arguments& args) @@ -62,7 +62,7 @@ v8::Handle<v8::Value> V8TreeWalker::parentNodeCallback(const v8::Arguments& args EmptyScriptState state; RefPtr<Node> result = treeWalker->parentNode(&state); - return toV8(result.release(), &state); + return toV8Object(result.release(), &state); } v8::Handle<v8::Value> V8TreeWalker::firstChildCallback(const v8::Arguments& args) @@ -72,7 +72,7 @@ v8::Handle<v8::Value> V8TreeWalker::firstChildCallback(const v8::Arguments& args EmptyScriptState state; RefPtr<Node> result = treeWalker->firstChild(&state); - return toV8(result.release(), &state); + return toV8Object(result.release(), &state); } v8::Handle<v8::Value> V8TreeWalker::lastChildCallback(const v8::Arguments& args) @@ -82,7 +82,7 @@ v8::Handle<v8::Value> V8TreeWalker::lastChildCallback(const v8::Arguments& args) EmptyScriptState state; RefPtr<Node> result = treeWalker->lastChild(&state); - return toV8(result.release(), &state); + return toV8Object(result.release(), &state); } v8::Handle<v8::Value> V8TreeWalker::nextNodeCallback(const v8::Arguments& args) @@ -92,7 +92,7 @@ v8::Handle<v8::Value> V8TreeWalker::nextNodeCallback(const v8::Arguments& args) EmptyScriptState state; RefPtr<Node> result = treeWalker->nextNode(&state); - return toV8(result.release(), &state); + return toV8Object(result.release(), &state); } v8::Handle<v8::Value> V8TreeWalker::previousNodeCallback(const v8::Arguments& args) @@ -102,7 +102,7 @@ v8::Handle<v8::Value> V8TreeWalker::previousNodeCallback(const v8::Arguments& ar EmptyScriptState state; RefPtr<Node> result = treeWalker->previousNode(&state); - return toV8(result.release(), &state); + return toV8Object(result.release(), &state); } v8::Handle<v8::Value> V8TreeWalker::nextSiblingCallback(const v8::Arguments& args) @@ -112,7 +112,7 @@ v8::Handle<v8::Value> V8TreeWalker::nextSiblingCallback(const v8::Arguments& arg EmptyScriptState state; RefPtr<Node> result = treeWalker->nextSibling(&state); - return toV8(result.release(), &state); + return toV8Object(result.release(), &state); } v8::Handle<v8::Value> V8TreeWalker::previousSiblingCallback(const v8::Arguments& args) @@ -122,7 +122,7 @@ v8::Handle<v8::Value> V8TreeWalker::previousSiblingCallback(const v8::Arguments& EmptyScriptState state; RefPtr<Node> result = treeWalker->previousSibling(&state); - return toV8(result.release(), &state); + return toV8Object(result.release(), &state); } } // namespace WebCore diff --git a/WebCore/bindings/v8/custom/V8WebGLArrayCustom.cpp b/WebCore/bindings/v8/custom/V8WebGLArrayCustom.cpp new file mode 100644 index 0000000..a92e4f2 --- /dev/null +++ b/WebCore/bindings/v8/custom/V8WebGLArrayCustom.cpp @@ -0,0 +1,69 @@ +/* + * Copyright (C) 2009 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" + +#if ENABLE(3D_CANVAS) +#include "V8WebGLArray.h" + +#include "V8WebGLByteArray.h" +#include "V8WebGLFloatArray.h" +#include "V8WebGLIntArray.h" +#include "V8WebGLShortArray.h" +#include "V8WebGLUnsignedByteArray.h" +#include "V8WebGLUnsignedIntArray.h" +#include "V8WebGLUnsignedShortArray.h" + +namespace WebCore { + +v8::Handle<v8::Value> toV8(WebGLArray* impl) +{ + if (!impl) + return v8::Null(); + if (impl->isByteArray()) + return toV8(static_cast<WebGLByteArray*>(impl)); + if (impl->isFloatArray()) + return toV8(static_cast<WebGLFloatArray*>(impl)); + if (impl->isIntArray()) + return toV8(static_cast<WebGLIntArray*>(impl)); + if (impl->isShortArray()) + return toV8(static_cast<WebGLShortArray*>(impl)); + if (impl->isUnsignedByteArray()) + return toV8(static_cast<WebGLUnsignedByteArray*>(impl)); + if (impl->isUnsignedIntArray()) + return toV8(static_cast<WebGLUnsignedIntArray*>(impl)); + if (impl->isUnsignedShortArray()) + return toV8(static_cast<WebGLUnsignedShortArray*>(impl)); + return v8::Handle<v8::Value>(); +} + +} // namespace WebCore + +#endif // ENABLE(3D_CANVAS) diff --git a/WebCore/bindings/v8/custom/V8WebGLByteArrayCustom.cpp b/WebCore/bindings/v8/custom/V8WebGLByteArrayCustom.cpp index 6d52c83..95f6879 100644 --- a/WebCore/bindings/v8/custom/V8WebGLByteArrayCustom.cpp +++ b/WebCore/bindings/v8/custom/V8WebGLByteArrayCustom.cpp @@ -63,6 +63,16 @@ v8::Handle<v8::Value> V8WebGLByteArray::setCallback(const v8::Arguments& args) return setWebGLArray<WebGLByteArray, V8WebGLByteArray>(args, V8ClassIndex::WEBGLBYTEARRAY); } +v8::Handle<v8::Value> toV8(WebGLByteArray* impl) +{ + if (!impl) + return v8::Null(); + v8::Handle<v8::Object> wrapper = V8WebGLByteArray::wrap(impl); + if (!wrapper.IsEmpty()) + wrapper->SetIndexedPropertiesToExternalArrayData(impl->baseAddress(), v8::kExternalByteArray, impl->length()); + return wrapper; +} + } // namespace WebCore #endif // ENABLE(3D_CANVAS) diff --git a/WebCore/bindings/v8/custom/V8WebGLFloatArrayCustom.cpp b/WebCore/bindings/v8/custom/V8WebGLFloatArrayCustom.cpp index 4d4b0e2..5882450 100644 --- a/WebCore/bindings/v8/custom/V8WebGLFloatArrayCustom.cpp +++ b/WebCore/bindings/v8/custom/V8WebGLFloatArrayCustom.cpp @@ -63,6 +63,16 @@ v8::Handle<v8::Value> V8WebGLFloatArray::setCallback(const v8::Arguments& args) return setWebGLArray<WebGLFloatArray, V8WebGLFloatArray>(args, V8ClassIndex::WEBGLFLOATARRAY); } +v8::Handle<v8::Value> toV8(WebGLFloatArray* impl) +{ + if (!impl) + return v8::Null(); + v8::Handle<v8::Object> wrapper = V8WebGLFloatArray::wrap(impl); + if (!wrapper.IsEmpty()) + wrapper->SetIndexedPropertiesToExternalArrayData(impl->baseAddress(), v8::kExternalFloatArray, impl->length()); + return wrapper; +} + } // namespace WebCore #endif // ENABLE(3D_CANVAS) diff --git a/WebCore/bindings/v8/custom/V8WebGLIntArrayCustom.cpp b/WebCore/bindings/v8/custom/V8WebGLIntArrayCustom.cpp index 7dde0a0..7e2f2ed 100644 --- a/WebCore/bindings/v8/custom/V8WebGLIntArrayCustom.cpp +++ b/WebCore/bindings/v8/custom/V8WebGLIntArrayCustom.cpp @@ -63,6 +63,16 @@ v8::Handle<v8::Value> V8WebGLIntArray::setCallback(const v8::Arguments& args) return setWebGLArray<WebGLIntArray, V8WebGLIntArray>(args, V8ClassIndex::WEBGLINTARRAY); } +v8::Handle<v8::Value> toV8(WebGLIntArray* impl) +{ + if (!impl) + return v8::Null(); + v8::Handle<v8::Object> wrapper = V8WebGLIntArray::wrap(impl); + if (!wrapper.IsEmpty()) + wrapper->SetIndexedPropertiesToExternalArrayData(impl->baseAddress(), v8::kExternalIntArray, impl->length()); + return wrapper; +} + } // namespace WebCore #endif // ENABLE(3D_CANVAS) diff --git a/WebCore/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp b/WebCore/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp index 19b73d4..78de5e6 100644 --- a/WebCore/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp +++ b/WebCore/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp @@ -42,12 +42,16 @@ #include "V8Binding.h" #include "V8WebGLArray.h" +#include "V8WebGLBuffer.h" #include "V8WebGLByteArray.h" #include "V8WebGLFloatArray.h" +#include "V8WebGLFramebuffer.h" #include "V8WebGLIntArray.h" #include "V8WebGLProgram.h" +#include "V8WebGLRenderbuffer.h" #include "V8WebGLShader.h" #include "V8WebGLShortArray.h" +#include "V8WebGLTexture.h" #include "V8WebGLUniformLocation.h" #include "V8WebGLUnsignedByteArray.h" #include "V8WebGLUnsignedIntArray.h" @@ -175,7 +179,7 @@ v8::Handle<v8::Value> V8WebGLRenderingContext::bufferSubDataCallback(const v8::A return v8::Undefined(); } -static v8::Handle<v8::Value> toV8(const WebGLGetInfo& info) +static v8::Handle<v8::Value> toV8Object(const WebGLGetInfo& info) { switch (info.getType()) { case WebGLGetInfo::kTypeBool: @@ -191,23 +195,23 @@ static v8::Handle<v8::Value> toV8(const WebGLGetInfo& info) case WebGLGetInfo::kTypeUnsignedLong: return v8::Integer::NewFromUnsigned(info.getUnsignedLong()); case WebGLGetInfo::kTypeWebGLBuffer: - return V8DOMWrapper::convertToV8Object(V8ClassIndex::WEBGLBUFFER, info.getWebGLBuffer()); + return toV8(info.getWebGLBuffer()); case WebGLGetInfo::kTypeWebGLFloatArray: - return V8DOMWrapper::convertToV8Object(V8ClassIndex::WEBGLFLOATARRAY, info.getWebGLFloatArray()); + return toV8(info.getWebGLFloatArray()); case WebGLGetInfo::kTypeWebGLFramebuffer: - return V8DOMWrapper::convertToV8Object(V8ClassIndex::WEBGLFRAMEBUFFER, info.getWebGLFramebuffer()); + return toV8(info.getWebGLFramebuffer()); case WebGLGetInfo::kTypeWebGLIntArray: - return V8DOMWrapper::convertToV8Object(V8ClassIndex::WEBGLINTARRAY, info.getWebGLIntArray()); + return toV8(info.getWebGLIntArray()); // FIXME: implement WebGLObjectArray // case WebGLGetInfo::kTypeWebGLObjectArray: case WebGLGetInfo::kTypeWebGLProgram: - return V8DOMWrapper::convertToV8Object(V8ClassIndex::WEBGLPROGRAM, info.getWebGLProgram()); + return toV8(info.getWebGLProgram()); case WebGLGetInfo::kTypeWebGLRenderbuffer: - return V8DOMWrapper::convertToV8Object(V8ClassIndex::WEBGLRENDERBUFFER, info.getWebGLRenderbuffer()); + return toV8(info.getWebGLRenderbuffer()); case WebGLGetInfo::kTypeWebGLTexture: - return V8DOMWrapper::convertToV8Object(V8ClassIndex::WEBGLTEXTURE, info.getWebGLTexture()); + return toV8(info.getWebGLTexture()); case WebGLGetInfo::kTypeWebGLUnsignedByteArray: - return V8DOMWrapper::convertToV8Object(V8ClassIndex::WEBGLUNSIGNEDBYTEARRAY, info.getWebGLUnsignedByteArray()); + return toV8(info.getWebGLUnsignedByteArray()); default: notImplemented(); return v8::Undefined(); @@ -261,7 +265,7 @@ static v8::Handle<v8::Value> getObjectParameter(const v8::Arguments& args, Objec V8Proxy::setDOMException(ec); return v8::Undefined(); } - return toV8(info); + return toV8Object(info); } static WebGLUniformLocation* toWebGLUniformLocation(v8::Handle<v8::Value> value, bool& ok) @@ -317,7 +321,7 @@ v8::Handle<v8::Value> V8WebGLRenderingContext::getFramebufferAttachmentParameter V8Proxy::setDOMException(ec); return v8::Undefined(); } - return toV8(info); + return toV8Object(info); } v8::Handle<v8::Value> V8WebGLRenderingContext::getParameterCallback(const v8::Arguments& args) @@ -342,7 +346,7 @@ v8::Handle<v8::Value> V8WebGLRenderingContext::getParameterCallback(const v8::Ar V8Proxy::setDOMException(ec); return v8::Undefined(); } - return toV8(info); + return toV8Object(info); } v8::Handle<v8::Value> V8WebGLRenderingContext::getProgramParameterCallback(const v8::Arguments& args) @@ -368,7 +372,7 @@ v8::Handle<v8::Value> V8WebGLRenderingContext::getProgramParameterCallback(const V8Proxy::setDOMException(ec); return v8::Undefined(); } - return toV8(info); + return toV8Object(info); } v8::Handle<v8::Value> V8WebGLRenderingContext::getRenderbufferParameterCallback(const v8::Arguments& args) @@ -400,7 +404,7 @@ v8::Handle<v8::Value> V8WebGLRenderingContext::getShaderParameterCallback(const V8Proxy::setDOMException(ec); return v8::Undefined(); } - return toV8(info); + return toV8Object(info); } v8::Handle<v8::Value> V8WebGLRenderingContext::getTexParameterCallback(const v8::Arguments& args) @@ -434,7 +438,7 @@ v8::Handle<v8::Value> V8WebGLRenderingContext::getUniformCallback(const v8::Argu V8Proxy::setDOMException(ec); return v8::Undefined(); } - return toV8(info); + return toV8Object(info); } v8::Handle<v8::Value> V8WebGLRenderingContext::getVertexAttribCallback(const v8::Arguments& args) diff --git a/WebCore/bindings/v8/custom/V8WebGLShortArrayCustom.cpp b/WebCore/bindings/v8/custom/V8WebGLShortArrayCustom.cpp index 9d3b478..4cbccf5 100644 --- a/WebCore/bindings/v8/custom/V8WebGLShortArrayCustom.cpp +++ b/WebCore/bindings/v8/custom/V8WebGLShortArrayCustom.cpp @@ -63,6 +63,16 @@ v8::Handle<v8::Value> V8WebGLShortArray::setCallback(const v8::Arguments& args) return setWebGLArray<WebGLShortArray, V8WebGLShortArray>(args, V8ClassIndex::WEBGLSHORTARRAY); } +v8::Handle<v8::Value> toV8(WebGLShortArray* impl) +{ + if (!impl) + return v8::Null(); + v8::Handle<v8::Object> wrapper = V8WebGLShortArray::wrap(impl); + if (!wrapper.IsEmpty()) + wrapper->SetIndexedPropertiesToExternalArrayData(impl->baseAddress(), v8::kExternalShortArray, impl->length()); + return wrapper; +} + } // namespace WebCore #endif // ENABLE(3D_CANVAS) diff --git a/WebCore/bindings/v8/custom/V8WebGLUnsignedByteArrayCustom.cpp b/WebCore/bindings/v8/custom/V8WebGLUnsignedByteArrayCustom.cpp index 3cc658a..962e390 100644 --- a/WebCore/bindings/v8/custom/V8WebGLUnsignedByteArrayCustom.cpp +++ b/WebCore/bindings/v8/custom/V8WebGLUnsignedByteArrayCustom.cpp @@ -63,6 +63,16 @@ v8::Handle<v8::Value> V8WebGLUnsignedByteArray::setCallback(const v8::Arguments& return setWebGLArray<WebGLUnsignedByteArray, V8WebGLUnsignedByteArray>(args, V8ClassIndex::WEBGLUNSIGNEDBYTEARRAY); } +v8::Handle<v8::Value> toV8(WebGLUnsignedByteArray* impl) +{ + if (!impl) + return v8::Null(); + v8::Handle<v8::Object> wrapper = V8WebGLUnsignedByteArray::wrap(impl); + if (!wrapper.IsEmpty()) + wrapper->SetIndexedPropertiesToExternalArrayData(impl->baseAddress(), v8::kExternalUnsignedByteArray, impl->length()); + return wrapper; +} + } // namespace WebCore #endif // ENABLE(3D_CANVAS) diff --git a/WebCore/bindings/v8/custom/V8WebGLUnsignedIntArrayCustom.cpp b/WebCore/bindings/v8/custom/V8WebGLUnsignedIntArrayCustom.cpp index 93ccbd4..eb0b7cf 100644 --- a/WebCore/bindings/v8/custom/V8WebGLUnsignedIntArrayCustom.cpp +++ b/WebCore/bindings/v8/custom/V8WebGLUnsignedIntArrayCustom.cpp @@ -63,6 +63,16 @@ v8::Handle<v8::Value> V8WebGLUnsignedIntArray::setCallback(const v8::Arguments& return setWebGLArray<WebGLUnsignedIntArray, V8WebGLUnsignedIntArray>(args, V8ClassIndex::WEBGLUNSIGNEDINTARRAY); } +v8::Handle<v8::Value> toV8(WebGLUnsignedIntArray* impl) +{ + if (!impl) + return v8::Null(); + v8::Handle<v8::Object> wrapper = V8WebGLUnsignedIntArray::wrap(impl); + if (!wrapper.IsEmpty()) + wrapper->SetIndexedPropertiesToExternalArrayData(impl->baseAddress(), v8::kExternalUnsignedIntArray, impl->length()); + return wrapper; +} + } // namespace WebCore #endif // ENABLE(3D_CANVAS) diff --git a/WebCore/bindings/v8/custom/V8WebGLUnsignedShortArrayCustom.cpp b/WebCore/bindings/v8/custom/V8WebGLUnsignedShortArrayCustom.cpp index d9e47cd..5f30de3 100644 --- a/WebCore/bindings/v8/custom/V8WebGLUnsignedShortArrayCustom.cpp +++ b/WebCore/bindings/v8/custom/V8WebGLUnsignedShortArrayCustom.cpp @@ -63,6 +63,16 @@ v8::Handle<v8::Value> V8WebGLUnsignedShortArray::setCallback(const v8::Arguments return setWebGLArray<WebGLUnsignedShortArray, V8WebGLUnsignedShortArray>(args, V8ClassIndex::WEBGLUNSIGNEDSHORTARRAY); } +v8::Handle<v8::Value> toV8(WebGLUnsignedShortArray* impl) +{ + if (!impl) + return v8::Null(); + v8::Handle<v8::Object> wrapper = V8WebGLUnsignedShortArray::wrap(impl); + if (!wrapper.IsEmpty()) + wrapper->SetIndexedPropertiesToExternalArrayData(impl->baseAddress(), v8::kExternalUnsignedShortArray, impl->length()); + return wrapper; +} + } // namespace WebCore #endif // ENABLE(3D_CANVAS) diff --git a/WebCore/bindings/v8/custom/V8XSLTProcessorCustom.cpp b/WebCore/bindings/v8/custom/V8XSLTProcessorCustom.cpp index fd0305a..89f804c 100644 --- a/WebCore/bindings/v8/custom/V8XSLTProcessorCustom.cpp +++ b/WebCore/bindings/v8/custom/V8XSLTProcessorCustom.cpp @@ -36,8 +36,8 @@ #include "Node.h" #include "V8Binding.h" -#include "V8CustomBinding.h" #include "V8Document.h" +#include "V8DocumentFragment.h" #include "V8Node.h" #include "V8Proxy.h" #include "XSLTProcessor.h" @@ -78,7 +78,7 @@ v8::Handle<v8::Value> V8XSLTProcessor::transformToFragmentCallback(const v8::Arg Node* source = V8Node::toNative(v8::Handle<v8::Object>::Cast(args[0])); Document* owner = V8Document::toNative(v8::Handle<v8::Object>::Cast(args[1])); RefPtr<DocumentFragment> result = imp->transformToFragment(source, owner); - return V8DOMWrapper::convertNodeToV8Object(result.release()); + return toV8(result.release()); } @@ -99,7 +99,7 @@ v8::Handle<v8::Value> V8XSLTProcessor::transformToDocumentCallback(const v8::Arg if (!result) return v8::Undefined(); - return V8DOMWrapper::convertNodeToV8Object(result.release()); + return toV8(result.release()); } diff --git a/WebCore/bridge/jni/v8/JNIUtilityPrivate.cpp b/WebCore/bridge/jni/v8/JNIUtilityPrivate.cpp index 9352983..1944108 100644 --- a/WebCore/bridge/jni/v8/JNIUtilityPrivate.cpp +++ b/WebCore/bridge/jni/v8/JNIUtilityPrivate.cpp @@ -134,9 +134,15 @@ jvalue convertNPVariantToJValue(NPVariant value, JNIType jniType, const char* ja case float_type: { if (type == NPVariantType_Int32) +<<<<<<< HEAD result.f = static_cast<jfloat>(NPVARIANT_TO_INT32(value)); else if (type == NPVariantType_Double) result.f = static_cast<jfloat>(NPVARIANT_TO_DOUBLE(value)); +======= + result.j = static_cast<jfloat>(NPVARIANT_TO_INT32(value)); + else if (type == NPVariantType_Double) + result.j = static_cast<jfloat>(NPVARIANT_TO_DOUBLE(value)); +>>>>>>> webkit.org at r54340 else bzero(&result, sizeof(jvalue)); } @@ -145,9 +151,15 @@ jvalue convertNPVariantToJValue(NPVariant value, JNIType jniType, const char* ja case double_type: { if (type == NPVariantType_Int32) +<<<<<<< HEAD result.d = static_cast<jdouble>(NPVARIANT_TO_INT32(value)); else if (type == NPVariantType_Double) result.d = static_cast<jdouble>(NPVARIANT_TO_DOUBLE(value)); +======= + result.j = static_cast<jdouble>(NPVARIANT_TO_INT32(value)); + else if (type == NPVariantType_Double) + result.j = static_cast<jdouble>(NPVARIANT_TO_DOUBLE(value)); +>>>>>>> webkit.org at r54340 else bzero(&result, sizeof(jvalue)); } diff --git a/WebCore/css/html.css b/WebCore/css/html.css index 913dbe5..9d9225c 100644 --- a/WebCore/css/html.css +++ b/WebCore/css/html.css @@ -621,7 +621,8 @@ a:-webkit-any-link:active { /* HTML5 ruby elements */ ruby, rt { - text-indent: 0; /* blocks used for ruby rendering should not trigger this */ + text-indent: 0; /* blocks used for ruby rendering should not trigger this */ + line-height: normal; } ruby > rt { diff --git a/WebCore/dom/Element.cpp b/WebCore/dom/Element.cpp index ac4fdb3..729ec8d 100644 --- a/WebCore/dom/Element.cpp +++ b/WebCore/dom/Element.cpp @@ -702,7 +702,8 @@ void Element::setPrefix(const AtomicString& prefix, ExceptionCode& ec) KURL Element::baseURI() const { - KURL base(KURL(), getAttribute(baseAttr)); + const AtomicString& baseAttribute = getAttribute(baseAttr); + KURL base(KURL(), baseAttribute); if (!base.protocol().isEmpty()) return base; @@ -714,7 +715,7 @@ KURL Element::baseURI() const if (parentBase.isNull()) return base; - return KURL(parentBase, base.string()); + return KURL(parentBase, baseAttribute); } void Element::createAttributeMap() const diff --git a/WebCore/dom/Event.cpp b/WebCore/dom/Event.cpp index be2b37b..b6abb2a 100644 --- a/WebCore/dom/Event.cpp +++ b/WebCore/dom/Event.cpp @@ -194,6 +194,30 @@ bool Event::isTouchEvent() const } #endif +bool Event::fromUserGesture() +{ + if (createdByDOM()) + return false; + + const AtomicString& type = this->type(); + return + // mouse events + type == eventNames().clickEvent || type == eventNames().mousedownEvent + || type == eventNames().mouseupEvent || type == eventNames().dblclickEvent + // keyboard events + || type == eventNames().keydownEvent || type == eventNames().keypressEvent + || type == eventNames().keyupEvent +#if ENABLE(TOUCH_EVENTS) + // touch events + || type == eventNames().touchstartEvent || type == eventNames().touchmoveEvent + || type == eventNames().touchendEvent || type == eventNames().touchcancelEvent +#endif + // other accepted events + || type == eventNames().selectEvent || type == eventNames().changeEvent + || type == eventNames().focusEvent || type == eventNames().blurEvent + || type == eventNames().submitEvent; +} + bool Event::storesResultAsString() const { return false; diff --git a/WebCore/dom/Event.h b/WebCore/dom/Event.h index 9b55bb8..1ba5e3d 100644 --- a/WebCore/dom/Event.h +++ b/WebCore/dom/Event.h @@ -129,6 +129,7 @@ namespace WebCore { #if ENABLE(TOUCH_EVENTS) virtual bool isTouchEvent() const; #endif + bool fromUserGesture(); bool propagationStopped() const { return m_propagationStopped; } diff --git a/WebCore/dom/make_names.pl b/WebCore/dom/make_names.pl index daf45ef..083e309 100755 --- a/WebCore/dom/make_names.pl +++ b/WebCore/dom/make_names.pl @@ -38,7 +38,8 @@ use InFilesParser; use Switch; my $printFactory = 0; -my $printWrapperFactory = 0; +my $printWrapperFactory = 0; +my $printWrapperFactoryV8 = 0; my $tagsFile = ""; my $attrsFile = ""; my $outputDir = "."; @@ -55,7 +56,8 @@ GetOptions( 'outputDir=s' => \$outputDir, 'extraDefines=s' => \$extraDefines, 'preprocessor=s' => \$preprocessor, - 'wrapperFactory' => \$printWrapperFactory + 'wrapperFactory' => \$printWrapperFactory, + 'wrapperFactoryV8' => \$printWrapperFactoryV8 ); die "You must specify at least one of --tags <file> or --attrs <file>" unless (length($tagsFile) || length($attrsFile)); @@ -71,7 +73,7 @@ $parameters{namespacePrefix} = $parameters{namespace} unless $parameters{namespa mkpath($outputDir); my $namesBasePath = "$outputDir/$parameters{namespace}Names"; my $factoryBasePath = "$outputDir/$parameters{namespace}ElementFactory"; -my $wrapperFactoryBasePath = "$outputDir/JS$parameters{namespace}ElementWrapperFactory"; +my $wrapperFactoryFileName = "$parameters{namespace}ElementWrapperFactory"; printNamesHeaderFile("$namesBasePath.h"); printNamesCppFile("$namesBasePath.cpp"); @@ -81,9 +83,17 @@ if ($printFactory) { printFactoryHeaderFile("$factoryBasePath.h"); } +die "You cannot specify both --wrapperFactory and --wrapperFactoryV8" if $printWrapperFactory && $printWrapperFactoryV8; +my $wrapperFactoryType = ""; if ($printWrapperFactory) { - printWrapperFactoryCppFile("$wrapperFactoryBasePath.cpp"); - printWrapperFactoryHeaderFile("$wrapperFactoryBasePath.h"); + $wrapperFactoryType = "JS"; +} elsif ($printWrapperFactoryV8) { + $wrapperFactoryType = "V8"; +} + +if ($wrapperFactoryType) { + printWrapperFactoryCppFile($outputDir, $wrapperFactoryType, $wrapperFactoryFileName); + printWrapperFactoryHeaderFile($outputDir, $wrapperFactoryType, $wrapperFactoryFileName); } ### Hash initialization @@ -555,6 +565,7 @@ print F "\nvoid init() sub printJSElementIncludes { my $F = shift; + my $wrapperFactoryType = shift; my %tagsSeen; for my $tagName (sort keys %tags) { @@ -562,7 +573,7 @@ sub printJSElementIncludes next if defined($tagsSeen{$JSInterfaceName}) || usesDefaultJSWrapper($tagName); $tagsSeen{$JSInterfaceName} = 1; - print F "#include \"JS${JSInterfaceName}.h\"\n"; + print F "#include \"${wrapperFactoryType}${JSInterfaceName}.h\"\n"; } } @@ -799,6 +810,7 @@ sub usesDefaultJSWrapper sub printWrapperFunctions { my $F = shift; + my $wrapperFactoryType = shift; my %tagsSeen; for my $tagName (sort keys %tags) { @@ -813,10 +825,11 @@ sub printWrapperFunctions print F "#if ${conditionalString}\n\n"; } - # Hack for the media tags - # FIXME: This should have been done via a CustomWrapper attribute and a separate *Custom file. - if ($tags{$tagName}{wrapperOnlyIfMediaIsAvailable}) { - print F <<END + if ($wrapperFactoryType eq "JS") { + # Hack for the media tags + # FIXME: This should have been done via a CustomWrapper attribute and a separate *Custom file. + if ($tags{$tagName}{wrapperOnlyIfMediaIsAvailable}) { + print F <<END static JSNode* create${JSInterfaceName}Wrapper(ExecState* exec, JSDOMGlobalObject* globalObject, PassRefPtr<$parameters{namespace}Element> element) { if (!MediaPlayer::isAvailable()) @@ -826,8 +839,8 @@ static JSNode* create${JSInterfaceName}Wrapper(ExecState* exec, JSDOMGlobalObjec END ; - } else { - print F <<END + } else { + print F <<END static JSNode* create${JSInterfaceName}Wrapper(ExecState* exec, JSDOMGlobalObject* globalObject, PassRefPtr<$parameters{namespace}Element> element) { return CREATE_DOM_NODE_WRAPPER(exec, globalObject, ${JSInterfaceName}, element.get()); @@ -835,6 +848,16 @@ static JSNode* create${JSInterfaceName}Wrapper(ExecState* exec, JSDOMGlobalObjec END ; + } + } elsif ($wrapperFactoryType eq "V8") { + print F <<END +static v8::Handle<v8::Value> create${JSInterfaceName}Wrapper($parameters{namespace}Element* element) +{ + return toV8(static_cast<${JSInterfaceName}*>(element)); +} + +END +; } if ($conditional) { @@ -845,9 +868,11 @@ END sub printWrapperFactoryCppFile { - my $cppPath = shift; + my $outputDir = shift; + my $wrapperFactoryType = shift; + my $wrapperFactoryFileName = shift; my $F; - open F, ">$cppPath"; + open F, ">" . $outputDir . "/" . $wrapperFactoryType . $wrapperFactoryFileName . ".cpp"; printLicenseHeader($F); @@ -855,38 +880,73 @@ sub printWrapperFactoryCppFile print F "#if $parameters{guardFactoryWith}\n\n" if $parameters{guardFactoryWith}; - print F "#include \"JS$parameters{namespace}ElementWrapperFactory.h\"\n"; + print F "#include \"$wrapperFactoryType$parameters{namespace}ElementWrapperFactory.h\"\n"; - printJSElementIncludes($F); + printJSElementIncludes($F, $wrapperFactoryType); print F "\n#include \"$parameters{namespace}Names.h\"\n\n"; printElementIncludes($F); print F "\n#include <wtf/StdLibExtras.h>\n\n"; - - print F <<END + + if ($wrapperFactoryType eq "JS") { + print F <<END using namespace JSC; +END +; + } elsif ($wrapperFactoryType eq "V8") { + print F <<END +#include "V8$parameters{namespace}Element.h" + +#include <v8.h> +END +; + } + + print F <<END namespace WebCore { using namespace $parameters{namespace}Names; +END +; + if ($wrapperFactoryType eq "JS") { + print F <<END typedef JSNode* (*Create$parameters{namespace}ElementWrapperFunction)(ExecState*, JSDOMGlobalObject*, PassRefPtr<$parameters{namespace}Element>); END ; + } elsif ($wrapperFactoryType eq "V8") { + print F <<END +typedef v8::Handle<v8::Value> (*Create$parameters{namespace}ElementWrapperFunction)($parameters{namespace}Element*); + +END +; + } - printWrapperFunctions($F); + printWrapperFunctions($F, $wrapperFactoryType); - print F <<END + if ($wrapperFactoryType eq "JS") { + print F <<END JSNode* createJS$parameters{namespace}Wrapper(ExecState* exec, JSDOMGlobalObject* globalObject, PassRefPtr<$parameters{namespace}Element> element) -{ +{ + typedef HashMap<WebCore::AtomicStringImpl*, Create$parameters{namespace}ElementWrapperFunction> FunctionMap; + DEFINE_STATIC_LOCAL(FunctionMap, map, ()); + if (map.isEmpty()) { +END +; + } elsif ($wrapperFactoryType eq "V8") { + print F <<END +v8::Handle<v8::Value> createV8$parameters{namespace}Wrapper($parameters{namespace}Element* element, bool forceNewObject) +{ typedef HashMap<WebCore::AtomicStringImpl*, Create$parameters{namespace}ElementWrapperFunction> FunctionMap; DEFINE_STATIC_LOCAL(FunctionMap, map, ()); if (map.isEmpty()) { END ; + } for my $tag (sort keys %tags) { # Do not add the name to the map if it does not have a JS wrapper constructor or uses the default wrapper. @@ -910,8 +970,22 @@ END } Create$parameters{namespace}ElementWrapperFunction createWrapperFunction = map.get(element->localName().impl()); if (createWrapperFunction) +END +; + if ($wrapperFactoryType eq "JS") { + print F <<END return createWrapperFunction(exec, globalObject, element); return CREATE_DOM_NODE_WRAPPER(exec, globalObject, $parameters{namespace}Element, element.get()); +END +; + } elsif ($wrapperFactoryType eq "V8") { + print F <<END + return createWrapperFunction(element); + return V8$parameters{namespace}Element::wrap(element, forceNewObject); +END +; + } + print F <<END } } @@ -926,18 +1000,21 @@ END sub printWrapperFactoryHeaderFile { - my $headerPath = shift; + my $outputDir = shift; + my $wrapperFactoryType = shift; + my $wrapperFactoryFileName = shift; my $F; - open F, ">$headerPath"; + open F, ">" . $outputDir . "/" . $wrapperFactoryType . $wrapperFactoryFileName . ".h"; printLicenseHeader($F); - print F "#ifndef JS$parameters{namespace}ElementWrapperFactory_h\n"; - print F "#define JS$parameters{namespace}ElementWrapperFactory_h\n\n"; + print F "#ifndef $wrapperFactoryType$parameters{namespace}ElementWrapperFactory_h\n"; + print F "#define $wrapperFactoryType$parameters{namespace}ElementWrapperFactory_h\n\n"; print F "#if $parameters{guardFactoryWith}\n" if $parameters{guardFactoryWith}; - print F <<END + if ($wrapperFactoryType eq "JS") { + print F <<END #include <wtf/Forward.h> namespace JSC { @@ -956,10 +1033,23 @@ namespace WebCore { END ; + } elsif ($wrapperFactoryType eq "V8") { + print F <<END +#include <v8.h> + +namespace WebCore { + + class $parameters{namespace}Element; + + v8::Handle<v8::Value> createV8$parameters{namespace}Wrapper($parameters{namespace}Element*, bool); +} +END +; + } print F "#endif // $parameters{guardFactoryWith}\n\n" if $parameters{guardFactoryWith}; - print F "#endif // JS$parameters{namespace}ElementWrapperFactory_h\n"; + print F "#endif // $wrapperFactoryType$parameters{namespace}ElementWrapperFactory_h\n"; close F; } diff --git a/WebCore/html/HTMLFormControlElement.cpp b/WebCore/html/HTMLFormControlElement.cpp index eb25c40..6f24e0c 100644 --- a/WebCore/html/HTMLFormControlElement.cpp +++ b/WebCore/html/HTMLFormControlElement.cpp @@ -52,6 +52,7 @@ using namespace HTMLNames; HTMLFormControlElement::HTMLFormControlElement(const QualifiedName& tagName, Document* doc, HTMLFormElement* f) : HTMLElement(tagName, doc) , m_form(f) + , m_hasName(false) , m_disabled(false) , m_readOnly(false) , m_required(false) @@ -89,8 +90,9 @@ ValidityState* HTMLFormControlElement::validity() void HTMLFormControlElement::parseMappedAttribute(MappedAttribute *attr) { + bool oldWillValidate = willValidate(); if (attr->name() == nameAttr) - setNeedsStyleRecalc(); + m_hasName = !attr->isEmpty(); else if (attr->name() == disabledAttr) { bool oldDisabled = m_disabled; m_disabled = !attr->isNull(); @@ -114,6 +116,8 @@ void HTMLFormControlElement::parseMappedAttribute(MappedAttribute *attr) setNeedsStyleRecalc(); } else HTMLElement::parseMappedAttribute(attr); + if (oldWillValidate != willValidate()) + setNeedsWillValidateCheck(); } void HTMLFormControlElement::attach() @@ -149,9 +153,10 @@ void HTMLFormControlElement::insertedIntoTree(bool deep) // setting a form, we will already have a non-null value for m_form, // and so we don't need to do anything. m_form = findFormAncestor(); - if (m_form) + if (m_form) { m_form->registerFormElement(this); - else + setNeedsWillValidateCheck(); + } else document()->checkedRadioButtons().addButton(this); } @@ -178,11 +183,19 @@ void HTMLFormControlElement::removedFromTree(bool deep) if (m_form && !(parser && parser->isHandlingResidualStyleAcrossBlocks()) && findRoot(this) != findRoot(m_form)) { m_form->removeFormElement(this); m_form = 0; + setNeedsWillValidateCheck(); } HTMLElement::removedFromTree(deep); } +void HTMLFormControlElement::formDestroyed() +{ + if (m_form) + setNeedsWillValidateCheck(); + m_form = 0; +} + const AtomicString& HTMLFormControlElement::formControlName() const { const AtomicString& n = getAttribute(nameAttr); @@ -199,11 +212,6 @@ void HTMLFormControlElement::dispatchFormControlChangeEvent() dispatchEvent(Event::create(eventNames().changeEvent, true, false)); } -bool HTMLFormControlElement::disabled() const -{ - return m_disabled; -} - void HTMLFormControlElement::setDisabled(bool b) { setAttribute(disabledAttr, b ? "" : 0); @@ -297,7 +305,7 @@ bool HTMLFormControlElement::willValidate() const // The control does not have a repetition template as an ancestor. // The control does not have a datalist element as an ancestor. // The control is not an output element. - return form() && !name().isEmpty() && !disabled() && !isReadOnlyFormControl(); + return m_form && m_hasName && !m_disabled && !m_readOnly; } String HTMLFormControlElement::validationMessage() @@ -305,6 +313,12 @@ String HTMLFormControlElement::validationMessage() return validity()->validationMessage(); } +void HTMLFormControlElement::setNeedsWillValidateCheck() +{ + setNeedsStyleRecalc(); + // FIXME: Show/hide a validation message. +} + bool HTMLFormControlElement::checkValidity() { if (willValidate() && !isValidFormControlElement()) { @@ -315,12 +329,13 @@ bool HTMLFormControlElement::checkValidity() return true; } -void HTMLFormControlElement::updateValidity() +void HTMLFormControlElement::setNeedsValidityCheck() { if (willValidate()) { // Update style for pseudo classes such as :valid :invalid. setNeedsStyleRecalc(); } + // FIXME: show/hide a validation message. } void HTMLFormControlElement::setCustomValidity(const String& error) diff --git a/WebCore/html/HTMLFormControlElement.h b/WebCore/html/HTMLFormControlElement.h index 358546b..117087b 100644 --- a/WebCore/html/HTMLFormControlElement.h +++ b/WebCore/html/HTMLFormControlElement.h @@ -63,7 +63,7 @@ public: virtual void dispatchFormControlChangeEvent(); - bool disabled() const; + bool disabled() const { return m_disabled; } void setDisabled(bool); virtual bool supportsFocus() const; @@ -109,19 +109,22 @@ public: virtual bool willValidate() const; String validationMessage(); bool checkValidity(); - void updateValidity(); + // This must be called when a validation constraint or control value is changed. + void setNeedsValidityCheck(); void setCustomValidity(const String&); virtual bool valueMissing() const { return false; } virtual bool patternMismatch() const { return false; } virtual bool tooLong() const { return false; } - void formDestroyed() { m_form = 0; } + void formDestroyed(); virtual void dispatchFocusEvent(); virtual void dispatchBlurEvent(); protected: void removeFromForm(); + // This must be called any time the result of willValidate() has changed. + void setNeedsWillValidateCheck(); private: virtual HTMLFormElement* virtualForm() const; @@ -130,6 +133,7 @@ private: HTMLFormElement* m_form; OwnPtr<ValidityState> m_validityState; + bool m_hasName : 1; bool m_disabled : 1; bool m_readOnly : 1; bool m_required : 1; diff --git a/WebCore/html/HTMLFormElement.cpp b/WebCore/html/HTMLFormElement.cpp index bf25bf6..2f88894 100644 --- a/WebCore/html/HTMLFormElement.cpp +++ b/WebCore/html/HTMLFormElement.cpp @@ -524,11 +524,13 @@ bool HTMLFormElement::isURLAttribute(Attribute* attr) const void HTMLFormElement::registerImgElement(HTMLImageElement* e) { + ASSERT(imgElements.find(e) == notFound); imgElements.append(e); } void HTMLFormElement::removeImgElement(HTMLImageElement* e) { + ASSERT(imgElements.find(e) != notFound); removeFromVector(imgElements, e); } diff --git a/WebCore/html/HTMLImageElement.cpp b/WebCore/html/HTMLImageElement.cpp index 34646ad..4592461 100644 --- a/WebCore/html/HTMLImageElement.cpp +++ b/WebCore/html/HTMLImageElement.cpp @@ -54,6 +54,8 @@ HTMLImageElement::HTMLImageElement(const QualifiedName& tagName, Document* doc, HTMLImageElement::~HTMLImageElement() { + if (m_form) + m_form->removeImgElement(this); } bool HTMLImageElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const diff --git a/WebCore/html/HTMLInputElement.cpp b/WebCore/html/HTMLInputElement.cpp index 5567fe2..79f8c14 100644 --- a/WebCore/html/HTMLInputElement.cpp +++ b/WebCore/html/HTMLInputElement.cpp @@ -83,12 +83,20 @@ static const double numberDefaultStep = 1.0; static const double numberStepScaleFactor = 1.0; // Constant values for minimum(). static const double dateDefaultMinimum = -12219292800000.0; // This means 1582-10-15T00:00Z. +static const double dateTimeDefaultMinimum = -12219292800000.0; // ditto. +static const double monthDefaultMinimum = (1582.0 - 1970) * 12 + 10 - 1; // 1582-10 static const double numberDefaultMinimum = -DBL_MAX; static const double rangeDefaultMinimum = 0.0; +static const double timeDefaultMinimum = 0.0; // 00:00:00.000 +static const double weekDefaultMinimum = -12212380800000.0; // 1583-01-03, the first Monday of 1583. // Constant values for maximum(). static const double dateDefaultMaximum = DBL_MAX; +static const double dateTimeDefaultMaximum = DBL_MAX; +static const double monthDefaultMaximum = DBL_MAX; static const double numberDefaultMaximum = DBL_MAX; static const double rangeDefaultMaximum = 100.0; +static const double timeDefaultMaximum = 86399999.0; // 23:59:59.999 +static const double weekDefaultMaximum = DBL_MAX; HTMLInputElement::HTMLInputElement(const QualifiedName& tagName, Document* doc, HTMLFormElement* f) : HTMLTextFormControlElement(tagName, doc, f) @@ -274,22 +282,24 @@ bool HTMLInputElement::rangeUnderflow() const const double nan = numeric_limits<double>::quiet_NaN(); switch (inputType()) { case DATE: + case DATETIME: + case DATETIMELOCAL: + case MONTH: case NUMBER: - case RANGE: { + case RANGE: + case TIME: + case WEEK: { double doubleValue = parseToDouble(value(), nan); return isfinite(doubleValue) && doubleValue < minimum(); } case BUTTON: case CHECKBOX: case COLOR: - case DATETIME: - case DATETIMELOCAL: case EMAIL: case FILE: case HIDDEN: case IMAGE: case ISINDEX: - case MONTH: case PASSWORD: case RADIO: case RESET: @@ -297,9 +307,7 @@ bool HTMLInputElement::rangeUnderflow() const case SUBMIT: case TELEPHONE: case TEXT: - case TIME: case URL: - case WEEK: break; } return false; @@ -310,22 +318,24 @@ bool HTMLInputElement::rangeOverflow() const const double nan = numeric_limits<double>::quiet_NaN(); switch (inputType()) { case DATE: + case DATETIME: + case DATETIMELOCAL: + case MONTH: case NUMBER: - case RANGE: { + case RANGE: + case TIME: + case WEEK: { double doubleValue = parseToDouble(value(), nan); return isfinite(doubleValue) && doubleValue > maximum(); } case BUTTON: case CHECKBOX: case COLOR: - case DATETIME: - case DATETIMELOCAL: case EMAIL: case FILE: case HIDDEN: case IMAGE: case ISINDEX: - case MONTH: case PASSWORD: case RADIO: case RESET: @@ -333,9 +343,7 @@ bool HTMLInputElement::rangeOverflow() const case SUBMIT: case TELEPHONE: case TEXT: - case TIME: case URL: - case WEEK: break; } return false; @@ -346,21 +354,27 @@ double HTMLInputElement::minimum() const switch (inputType()) { case DATE: return parseToDouble(getAttribute(minAttr), dateDefaultMinimum); + case DATETIME: + case DATETIMELOCAL: + return parseToDouble(getAttribute(minAttr), dateTimeDefaultMinimum); + case MONTH: + return parseToDouble(getAttribute(minAttr), monthDefaultMinimum); case NUMBER: return parseToDouble(getAttribute(minAttr), numberDefaultMinimum); case RANGE: return parseToDouble(getAttribute(minAttr), rangeDefaultMinimum); + case TIME: + return parseToDouble(getAttribute(minAttr), timeDefaultMinimum); + case WEEK: + return parseToDouble(getAttribute(minAttr), weekDefaultMinimum); case BUTTON: case CHECKBOX: case COLOR: - case DATETIME: - case DATETIMELOCAL: case EMAIL: case FILE: case HIDDEN: case IMAGE: case ISINDEX: - case MONTH: case PASSWORD: case RADIO: case RESET: @@ -368,9 +382,7 @@ double HTMLInputElement::minimum() const case SUBMIT: case TELEPHONE: case TEXT: - case TIME: case URL: - case WEEK: break; } ASSERT_NOT_REACHED(); @@ -382,6 +394,11 @@ double HTMLInputElement::maximum() const switch (inputType()) { case DATE: return parseToDouble(getAttribute(maxAttr), dateDefaultMaximum); + case DATETIME: + case DATETIMELOCAL: + return parseToDouble(getAttribute(maxAttr), dateTimeDefaultMaximum); + case MONTH: + return parseToDouble(getAttribute(maxAttr), monthDefaultMaximum); case NUMBER: return parseToDouble(getAttribute(maxAttr), numberDefaultMaximum); case RANGE: { @@ -393,17 +410,18 @@ double HTMLInputElement::maximum() const max = std::max(min, rangeDefaultMaximum); return max; } + case TIME: + return parseToDouble(getAttribute(maxAttr), timeDefaultMaximum); + case WEEK: + return parseToDouble(getAttribute(maxAttr), weekDefaultMaximum); case BUTTON: case CHECKBOX: case COLOR: - case DATETIME: - case DATETIMELOCAL: case EMAIL: case FILE: case HIDDEN: case IMAGE: case ISINDEX: - case MONTH: case PASSWORD: case RADIO: case RESET: @@ -411,9 +429,7 @@ double HTMLInputElement::maximum() const case SUBMIT: case TELEPHONE: case TEXT: - case TIME: case URL: - case WEEK: break; } ASSERT_NOT_REACHED(); @@ -704,6 +720,7 @@ void HTMLInputElement::setInputType(const String& t) // type change, otherwise a JavaScript programmer would be able to set a text // field's value to something like /etc/passwd and then change it to a file field. if (inputType() != newType) { + bool oldWillValidate = willValidate(); if (newType == FILE && m_haveType) // Set the attribute back to the old value. // Useful in case we were called from inside parseMappedAttribute. @@ -760,8 +777,10 @@ void HTMLInputElement::setInputType(const String& t) checkedRadioButtons(this).addButton(this); } + setNeedsValidityCheck(); + if (oldWillValidate != willValidate()) + setNeedsWillValidateCheck(); InputElement::notifyFormStateChanged(this); - updateValidity(); } m_haveType = true; @@ -983,17 +1002,18 @@ void HTMLInputElement::parseMappedAttribute(MappedAttribute *attr) if (m_data.value().isNull()) setNeedsStyleRecalc(); setFormControlValueMatchesRenderer(false); - updateValidity(); + setNeedsValidityCheck(); } else if (attr->name() == checkedAttr) { m_defaultChecked = !attr->isNull(); if (m_useDefaultChecked) { setChecked(m_defaultChecked); m_useDefaultChecked = true; } - updateValidity(); - } else if (attr->name() == maxlengthAttr) + setNeedsValidityCheck(); + } else if (attr->name() == maxlengthAttr) { InputElement::parseMaxLengthAttribute(m_data, this, this, attr); - else if (attr->name() == sizeAttr) + setNeedsValidityCheck(); + } else if (attr->name() == sizeAttr) InputElement::parseSizeAttribute(m_data, this, attr); else if (attr->name() == altAttr) { if (renderer() && inputType() == IMAGE) @@ -1037,15 +1057,16 @@ void HTMLInputElement::parseMappedAttribute(MappedAttribute *attr) attach(); } setNeedsStyleRecalc(); - } else if (attr->name() == autosaveAttr || - attr->name() == incrementalAttr || - attr->name() == minAttr || - attr->name() == maxAttr || - attr->name() == multipleAttr || - attr->name() == precisionAttr) + } else if (attr->name() == autosaveAttr + || attr->name() == incrementalAttr) setNeedsStyleRecalc(); - else if (attr->name() == patternAttr) - updateValidity(); + else if (attr->name() == minAttr + || attr->name() == maxAttr + || attr->name() == multipleAttr + || attr->name() == patternAttr + || attr->name() == precisionAttr + || attr->name() == stepAttr) + setNeedsValidityCheck(); #if ENABLE(DATALIST) else if (attr->name() == listAttr) m_hasNonEmptyList = !attr->isEmpty(); @@ -1491,7 +1512,7 @@ void HTMLInputElement::setValue(const String& value, bool sendChangeEvent) dispatchFormControlChangeEvent(); InputElement::notifyFormStateChanged(this); - updateValidity(); + setNeedsValidityCheck(); } double HTMLInputElement::parseToDouble(const String& src, double defaultValue) const @@ -1765,7 +1786,7 @@ void HTMLInputElement::setValueFromRenderer(const String& value) m_data.setSuggestedValue(String()); updatePlaceholderVisibility(false); InputElement::setValueFromRenderer(m_data, this, this, value); - updateValidity(); + setNeedsValidityCheck(); } void HTMLInputElement::setFileListFromRenderer(const Vector<String>& paths) @@ -1777,7 +1798,7 @@ void HTMLInputElement::setFileListFromRenderer(const Vector<String>& paths) setFormControlValueMatchesRenderer(true); InputElement::notifyFormStateChanged(this); - updateValidity(); + setNeedsValidityCheck(); } bool HTMLInputElement::storesValueSeparateFromAttribute() const diff --git a/WebCore/html/HTMLMediaElement.cpp b/WebCore/html/HTMLMediaElement.cpp index 5cd0157..279aac7 100644 --- a/WebCore/html/HTMLMediaElement.cpp +++ b/WebCore/html/HTMLMediaElement.cpp @@ -270,7 +270,7 @@ void HTMLMediaElement::insertedIntoDocument() void HTMLMediaElement::removedFromDocument() { if (m_networkState > NETWORK_EMPTY) - pause(); + pause(processingUserGesture()); if (m_isFullscreen) exitFullscreen(); HTMLElement::removedFromDocument(); @@ -421,9 +421,9 @@ String HTMLMediaElement::canPlayType(const String& mimeType) const return canPlay; } -void HTMLMediaElement::load(ExceptionCode& ec) +void HTMLMediaElement::load(bool isUserGesture, ExceptionCode& ec) { - if (m_restrictions & RequireUserGestureForLoadRestriction && !processingUserGesture()) + if (m_restrictions & RequireUserGestureForLoadRestriction && !isUserGesture) ec = INVALID_STATE_ERR; else { prepareForLoad(); @@ -1120,9 +1120,9 @@ void HTMLMediaElement::setAutobuffer(bool b) setBooleanAttribute(autobufferAttr, b); } -void HTMLMediaElement::play() +void HTMLMediaElement::play(bool isUserGesture) { - if (m_restrictions & RequireUserGestureForRateChangeRestriction && !processingUserGesture()) + if (m_restrictions & RequireUserGestureForRateChangeRestriction && !isUserGesture) return; playInternal(); @@ -1155,9 +1155,9 @@ void HTMLMediaElement::playInternal() updatePlayState(); } -void HTMLMediaElement::pause() +void HTMLMediaElement::pause(bool isUserGesture) { - if (m_restrictions & RequireUserGestureForRateChangeRestriction && !processingUserGesture()) + if (m_restrictions & RequireUserGestureForRateChangeRestriction && !isUserGesture) return; pauseInternal(); @@ -1235,7 +1235,15 @@ void HTMLMediaElement::setMuted(bool muted) { if (m_muted != muted) { m_muted = muted; - updateVolume(); + // Avoid recursion when the player reports volume changes. + if (!processingMediaPlayerCallback()) { + if (m_player && m_player->supportsMuting()) { + m_player->setMuted(m_muted); + if (renderer()) + renderer()->updateFromElement(); + } else + updateVolume(); + } scheduleEvent(eventNames().volumechangeEvent); } } @@ -1257,7 +1265,7 @@ void HTMLMediaElement::beginScrubbing() // Because a media element stays in non-paused state when it reaches end, playback resumes // when the slider is dragged from the end to another position unless we pause first. Do // a "hard pause" so an event is generated, since we want to stay paused after scrubbing finishes. - pause(); + pause(processingUserGesture()); } else { // Not at the end but we still want to pause playback so the media engine doesn't try to // continue playing during scrubbing. Pause without generating an event as we will @@ -1444,10 +1452,20 @@ void HTMLMediaElement::mediaPlayerTimeChanged(MediaPlayer*) void HTMLMediaElement::mediaPlayerVolumeChanged(MediaPlayer*) { beginProcessingMediaPlayerCallback(); + if (m_player) + m_volume = m_player->volume(); updateVolume(); endProcessingMediaPlayerCallback(); } +void HTMLMediaElement::mediaPlayerMuteChanged(MediaPlayer*) +{ + beginProcessingMediaPlayerCallback(); + if (m_player) + setMuted(m_player->muted()); + endProcessingMediaPlayerCallback(); +} + void HTMLMediaElement::mediaPlayerDurationChanged(MediaPlayer*) { beginProcessingMediaPlayerCallback(); @@ -1743,7 +1761,7 @@ void HTMLMediaElement::documentDidBecomeActive() // MEDIA_ERR_ABORTED while the abortEvent is being sent, but cleared immediately afterwards). // This behavior is not specified but it seems like a sensible thing to do. ExceptionCode ec; - load(ec); + load(processingUserGesture(), ec); } if (renderer()) @@ -1860,37 +1878,6 @@ PlatformMedia HTMLMediaElement::platformMedia() const return m_player ? m_player->platformMedia() : NoPlatformMedia; } -void HTMLMediaElement::webkitEnterFullScreen(ExceptionCode& ec) -{ - if (m_isFullscreen) - return; - - // Generate an exception if this isn't called in response to a user gesture, or if the - // element does not support fullscreen. - if (!processingUserGesture() || !supportsFullscreen()) { - ec = INVALID_STATE_ERR; - return; - } - - enterFullscreen(); -} - -void HTMLMediaElement::webkitExitFullScreen() -{ - if (m_isFullscreen) - exitFullscreen(); -} - -bool HTMLMediaElement::webkitSupportsFullscreen() -{ - return supportsFullscreen(); -} - -bool HTMLMediaElement::webkitDisplayingFullscreen() -{ - return m_isFullscreen; -} - bool HTMLMediaElement::hasClosedCaptions() const { return m_player && m_player->hasClosedCaptions(); diff --git a/WebCore/html/HTMLMediaElement.h b/WebCore/html/HTMLMediaElement.h index 9ee2c25..45a41c6 100644 --- a/WebCore/html/HTMLMediaElement.h +++ b/WebCore/html/HTMLMediaElement.h @@ -102,7 +102,7 @@ public: void setAutobuffer(bool); PassRefPtr<TimeRanges> buffered() const; - void load(ExceptionCode&); + void load(bool isUserGesture, ExceptionCode&); String canPlayType(const String& mimeType) const; // ready state @@ -129,14 +129,8 @@ public: void setAutoplay(bool b); bool loop() const; void setLoop(bool b); - void play(); - void pause(); - -// fullscreen - void webkitEnterFullScreen(ExceptionCode&); - void webkitExitFullScreen(); - bool webkitSupportsFullscreen(); - bool webkitDisplayingFullscreen(); + void play(bool isUserGesture); + void pause(bool isUserGesture); // captions bool webkitHasClosedCaptions() const; @@ -177,6 +171,8 @@ public: bool closedCaptionsVisible() const; void setClosedCaptionsVisible(bool); + bool processingUserGesture() const; + protected: float getTimeOffsetAttribute(const QualifiedName&, float valueOnError) const; void setTimeOffsetAttribute(const QualifiedName&, float value); @@ -196,6 +192,7 @@ private: // MediaPlayerClient virtual void mediaPlayerReadyStateChanged(MediaPlayer*); virtual void mediaPlayerTimeChanged(MediaPlayer*); virtual void mediaPlayerVolumeChanged(MediaPlayer*); + virtual void mediaPlayerMuteChanged(MediaPlayer*); virtual void mediaPlayerDurationChanged(MediaPlayer*); virtual void mediaPlayerRateChanged(MediaPlayer*); virtual void mediaPlayerSawUnsupportedTracks(MediaPlayer*); @@ -246,7 +243,6 @@ private: void prepareForLoad(); - bool processingUserGesture() const; bool processingMediaPlayerCallback() const { return m_processingMediaPlayerCallback > 0; } void beginProcessingMediaPlayerCallback() { ++m_processingMediaPlayerCallback; } void endProcessingMediaPlayerCallback() { ASSERT(m_processingMediaPlayerCallback); --m_processingMediaPlayerCallback; } diff --git a/WebCore/html/HTMLMediaElement.idl b/WebCore/html/HTMLMediaElement.idl index 1097e55..46a2b86 100644 --- a/WebCore/html/HTMLMediaElement.idl +++ b/WebCore/html/HTMLMediaElement.idl @@ -42,7 +42,7 @@ interface [Conditional=VIDEO] HTMLMediaElement : HTMLElement { attribute boolean autobuffer; readonly attribute TimeRanges buffered; - void load() + [NeedsUserGestureCheck] void load() raises (DOMException); DOMString canPlayType(in DOMString type); @@ -68,8 +68,8 @@ interface [Conditional=VIDEO] HTMLMediaElement : HTMLElement { readonly attribute boolean ended; attribute boolean autoplay; attribute boolean loop; - void play(); - void pause(); + [NeedsUserGestureCheck] void play(); + [NeedsUserGestureCheck] void pause(); // controls attribute boolean controls; @@ -80,13 +80,6 @@ interface [Conditional=VIDEO] HTMLMediaElement : HTMLElement { // WebKit extensions attribute boolean webkitPreservesPitch; - readonly attribute boolean webkitSupportsFullscreen; - readonly attribute boolean webkitDisplayingFullscreen; - - void webkitEnterFullScreen() - raises (DOMException); - void webkitExitFullScreen(); - readonly attribute boolean webkitHasClosedCaptions; attribute boolean webkitClosedCaptionsVisible; }; diff --git a/WebCore/html/HTMLTextAreaElement.cpp b/WebCore/html/HTMLTextAreaElement.cpp index 7159cc7..f74040d 100644 --- a/WebCore/html/HTMLTextAreaElement.cpp +++ b/WebCore/html/HTMLTextAreaElement.cpp @@ -154,7 +154,9 @@ void HTMLTextAreaElement::parseMappedAttribute(MappedAttribute* attr) } else if (attr->name() == alignAttr) { // Don't map 'align' attribute. This matches what Firefox, Opera and IE do. // See http://bugs.webkit.org/show_bug.cgi?id=7075 - } else + } else if (attr->name() == maxlengthAttr) + setNeedsValidityCheck(); + else HTMLTextFormControlElement::parseMappedAttribute(attr); } @@ -305,9 +307,8 @@ void HTMLTextAreaElement::setValue(const String& value) setSelectionRange(endOfString, endOfString); } - setNeedsStyleRecalc(); + setNeedsValidityCheck(); notifyFormStateChanged(this); - updateValidity(); } String HTMLTextAreaElement::defaultValue() const diff --git a/WebCore/html/HTMLVideoElement.cpp b/WebCore/html/HTMLVideoElement.cpp index 1fae354..be8f884 100644 --- a/WebCore/html/HTMLVideoElement.cpp +++ b/WebCore/html/HTMLVideoElement.cpp @@ -33,6 +33,7 @@ #include "CSSHelper.h" #include "CSSPropertyNames.h" #include "Document.h" +#include "ExceptionCode.h" #include "HTMLImageLoader.h" #include "HTMLNames.h" #include "MappedAttribute.h" @@ -197,8 +198,6 @@ void HTMLVideoElement::updatePosterImage() void HTMLVideoElement::paint(GraphicsContext* context, const IntRect& destRect) { - // FIXME: We should also be able to paint the poster image. - MediaPlayer* player = HTMLMediaElement::player(); if (!player) return; @@ -209,8 +208,6 @@ void HTMLVideoElement::paint(GraphicsContext* context, const IntRect& destRect) void HTMLVideoElement::paintCurrentFrameInContext(GraphicsContext* context, const IntRect& destRect) { - // FIXME: We should also be able to paint the poster image. - MediaPlayer* player = HTMLMediaElement::player(); if (!player) return; @@ -227,5 +224,37 @@ bool HTMLVideoElement::hasAvailableVideoFrame() const return m_player->hasAvailableVideoFrame(); } +void HTMLVideoElement::webkitEnterFullScreen(bool isUserGesture, ExceptionCode& ec) +{ + if (m_isFullscreen) + return; + + // Generate an exception if this isn't called in response to a user gesture, or if the + // element does not support fullscreen. + if (!isUserGesture || !supportsFullscreen()) { + ec = INVALID_STATE_ERR; + return; + } + + enterFullscreen(); +} + +void HTMLVideoElement::webkitExitFullScreen() +{ + if (m_isFullscreen) + exitFullscreen(); +} + +bool HTMLVideoElement::webkitSupportsFullscreen() +{ + return supportsFullscreen(); +} + +bool HTMLVideoElement::webkitDisplayingFullscreen() +{ + return m_isFullscreen; +} + + } #endif diff --git a/WebCore/html/HTMLVideoElement.h b/WebCore/html/HTMLVideoElement.h index 834ec4c..a5c005c 100644 --- a/WebCore/html/HTMLVideoElement.h +++ b/WebCore/html/HTMLVideoElement.h @@ -64,6 +64,12 @@ public: const KURL& poster() const { return m_posterURL; } void setPoster(const String&); +// fullscreen + void webkitEnterFullScreen(bool isUserGesture, ExceptionCode&); + void webkitExitFullScreen(); + bool webkitSupportsFullscreen(); + bool webkitDisplayingFullscreen(); + void updatePosterImage(); bool shouldDisplayPosterImage() const { return m_shouldDisplayPosterImage; } diff --git a/WebCore/html/HTMLVideoElement.idl b/WebCore/html/HTMLVideoElement.idl index f43bf82..c4764ac 100644 --- a/WebCore/html/HTMLVideoElement.idl +++ b/WebCore/html/HTMLVideoElement.idl @@ -30,5 +30,13 @@ module html { readonly attribute unsigned long videoWidth; readonly attribute unsigned long videoHeight; attribute [ConvertNullToNullString] DOMString poster; + + readonly attribute boolean webkitSupportsFullscreen; + readonly attribute boolean webkitDisplayingFullscreen; + + [NeedsUserGestureCheck] void webkitEnterFullScreen() + raises (DOMException); + void webkitExitFullScreen(); + }; } diff --git a/WebCore/html/canvas/CanvasRenderingContext2D.cpp b/WebCore/html/canvas/CanvasRenderingContext2D.cpp index 1e09534..8add19c 100644 --- a/WebCore/html/canvas/CanvasRenderingContext2D.cpp +++ b/WebCore/html/canvas/CanvasRenderingContext2D.cpp @@ -30,7 +30,7 @@ #include "config.h" #include "CanvasRenderingContext2D.h" -#include "TransformationMatrix.h" +#include "AffineTransform.h" #include "CSSParser.h" #include "CachedImage.h" #include "CanvasGradient.h" @@ -357,7 +357,7 @@ void CanvasRenderingContext2D::scale(float sx, float sy) if (!isfinite(sx) | !isfinite(sy)) return; - TransformationMatrix newTransform = state().m_transform; + AffineTransform newTransform = state().m_transform; newTransform.scaleNonUniform(sx, sy); if (!newTransform.isInvertible()) { state().m_invertibleCTM = false; @@ -366,7 +366,7 @@ void CanvasRenderingContext2D::scale(float sx, float sy) state().m_transform = newTransform; c->scale(FloatSize(sx, sy)); - m_path.transform(TransformationMatrix().scaleNonUniform(1.0/sx, 1.0/sy)); + m_path.transform(AffineTransform().scaleNonUniform(1.0 / sx, 1.0 / sy)); } void CanvasRenderingContext2D::rotate(float angleInRadians) @@ -380,7 +380,7 @@ void CanvasRenderingContext2D::rotate(float angleInRadians) if (!isfinite(angleInRadians)) return; - TransformationMatrix newTransform = state().m_transform; + AffineTransform newTransform = state().m_transform; newTransform.rotate(angleInRadians / piDouble * 180.0); if (!newTransform.isInvertible()) { state().m_invertibleCTM = false; @@ -389,7 +389,7 @@ void CanvasRenderingContext2D::rotate(float angleInRadians) state().m_transform = newTransform; c->rotate(angleInRadians); - m_path.transform(TransformationMatrix().rotate(-angleInRadians / piDouble * 180.0)); + m_path.transform(AffineTransform().rotate(-angleInRadians / piDouble * 180.0)); } void CanvasRenderingContext2D::translate(float tx, float ty) @@ -403,7 +403,7 @@ void CanvasRenderingContext2D::translate(float tx, float ty) if (!isfinite(tx) | !isfinite(ty)) return; - TransformationMatrix newTransform = state().m_transform; + AffineTransform newTransform = state().m_transform; newTransform.translate(tx, ty); if (!newTransform.isInvertible()) { state().m_invertibleCTM = false; @@ -412,7 +412,7 @@ void CanvasRenderingContext2D::translate(float tx, float ty) state().m_transform = newTransform; c->translate(tx, ty); - m_path.transform(TransformationMatrix().translate(-tx, -ty)); + m_path.transform(AffineTransform().translate(-tx, -ty)); } void CanvasRenderingContext2D::transform(float m11, float m12, float m21, float m22, float dx, float dy) @@ -427,8 +427,8 @@ void CanvasRenderingContext2D::transform(float m11, float m12, float m21, float !isfinite(m12) | !isfinite(m22) | !isfinite(dy)) return; - TransformationMatrix transform(m11, m12, m21, m22, dx, dy); - TransformationMatrix newTransform = transform * state().m_transform; + AffineTransform transform(m11, m12, m21, m22, dx, dy); + AffineTransform newTransform = transform * state().m_transform; if (!newTransform.isInvertible()) { state().m_invertibleCTM = false; return; @@ -449,7 +449,7 @@ void CanvasRenderingContext2D::setTransform(float m11, float m12, float m21, flo !isfinite(m12) | !isfinite(m22) | !isfinite(dy)) return; - TransformationMatrix ctm = state().m_transform; + AffineTransform ctm = state().m_transform; if (!ctm.isInvertible()) return; c->concatCTM(c->getCTM().inverse()); @@ -708,7 +708,7 @@ bool CanvasRenderingContext2D::isPointInPath(const float x, const float y) return false; FloatPoint point(x, y); - TransformationMatrix ctm = state().m_transform; + AffineTransform ctm = state().m_transform; FloatPoint transformedPoint = ctm.inverse().mapPoint(point); return m_path.contains(transformedPoint); } @@ -1241,7 +1241,7 @@ void CanvasRenderingContext2D::willDraw(const FloatRect& r, unsigned options) FloatRect dirtyRect = r; if (options & CanvasWillDrawApplyTransform) { - TransformationMatrix ctm = state().m_transform; + AffineTransform ctm = state().m_transform; dirtyRect = ctm.mapRect(r); } diff --git a/WebCore/html/canvas/CanvasRenderingContext2D.h b/WebCore/html/canvas/CanvasRenderingContext2D.h index 283f92c..553ffd2 100644 --- a/WebCore/html/canvas/CanvasRenderingContext2D.h +++ b/WebCore/html/canvas/CanvasRenderingContext2D.h @@ -26,8 +26,8 @@ #ifndef CanvasRenderingContext2D_h #define CanvasRenderingContext2D_h +#include "AffineTransform.h" #include "CanvasRenderingContext.h" -#include "TransformationMatrix.h" #include "FloatSize.h" #include "Font.h" #include "GraphicsTypes.h" @@ -218,7 +218,7 @@ namespace WebCore { String m_shadowColor; float m_globalAlpha; CompositeOperator m_globalComposite; - TransformationMatrix m_transform; + AffineTransform m_transform; bool m_invertibleCTM; // Text state. diff --git a/WebCore/inspector/InjectedScript.cpp b/WebCore/inspector/InjectedScript.cpp new file mode 100644 index 0000000..5525877 --- /dev/null +++ b/WebCore/inspector/InjectedScript.cpp @@ -0,0 +1,96 @@ +/* + * 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 "InjectedScript.h" + +#if ENABLE(INSPECTOR) + +#include "PlatformString.h" +#include "ScriptFunctionCall.h" + +namespace WebCore { + +InjectedScript::InjectedScript(ScriptObject injectedScriptObject) + : m_injectedScriptObject(injectedScriptObject) +{ +} + +void InjectedScript::dispatch(long callId, const String& methodName, const String& arguments, bool async, String* result, bool* hadException) +{ + ASSERT(!hasNoValue()); + ScriptState* scriptState = m_injectedScriptObject.scriptState(); + ScriptFunctionCall function(scriptState, m_injectedScriptObject, "dispatch"); + function.appendArgument(methodName); + function.appendArgument(arguments); + if (async) + function.appendArgument(callId); + *hadException = false; + ScriptValue resultValue = function.call(*hadException); + if (!*hadException) + *result = resultValue.toString(scriptState); +} + +#if ENABLE(JAVASCRIPT_DEBUGGER) +String InjectedScript::callFrames() +{ + ASSERT(!hasNoValue()); + ScriptState* scriptState = m_injectedScriptObject.scriptState(); + ScriptFunctionCall function(scriptState, m_injectedScriptObject, "callFrames"); + ScriptValue callFramesValue = function.call(); + return callFramesValue.toString(scriptState); +} +#endif + +String InjectedScript::wrapAndStringifyForConsole(ScriptValue value) +{ + ASSERT(!hasNoValue()); + ScriptState* scriptState = m_injectedScriptObject.scriptState(); + ScriptFunctionCall wrapFunction(scriptState, m_injectedScriptObject, "wrapAndStringifyObject"); + wrapFunction.appendArgument(value); + wrapFunction.appendArgument("console"); + ScriptValue r = wrapFunction.call(); + if (r.hasNoValue()) + return ""; + return r.toString(scriptState); +} + +void InjectedScript::releaseWrapperObjectGroup(const String& objectGroup) +{ + ASSERT(!hasNoValue()); + ScriptState* scriptState = m_injectedScriptObject.scriptState(); + ScriptFunctionCall releaseFunction(scriptState, m_injectedScriptObject, "releaseWrapperObjectGroup"); + releaseFunction.appendArgument(objectGroup); + releaseFunction.call(); +} + +} // namespace WebCore + +#endif // ENABLE(INSPECTOR) diff --git a/WebCore/inspector/InjectedScript.h b/WebCore/inspector/InjectedScript.h new file mode 100644 index 0000000..b70ee39 --- /dev/null +++ b/WebCore/inspector/InjectedScript.h @@ -0,0 +1,64 @@ +/* + * 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 InjectedScript_h +#define InjectedScript_h + +#include "InjectedScriptHost.h" +#include "ScriptObject.h" +#include <wtf/Noncopyable.h> + +namespace WebCore { + +class String; + +class InjectedScript { +public: + InjectedScript() { } + ~InjectedScript() { } + + bool hasNoValue() const { return m_injectedScriptObject.hasNoValue(); } + + void dispatch(long callId, const String& methodName, const String& arguments, bool async, String* result, bool* hadException); +#if ENABLE(JAVASCRIPT_DEBUGGER) + String callFrames(); +#endif + String wrapAndStringifyForConsole(ScriptValue); + void releaseWrapperObjectGroup(const String&); + +private: + friend InjectedScript InjectedScriptHost::injectedScriptFor(ScriptState*); + explicit InjectedScript(ScriptObject); + ScriptObject m_injectedScriptObject; +}; + +} // namespace WebCore + +#endif diff --git a/WebCore/inspector/InjectedScriptHost.cpp b/WebCore/inspector/InjectedScriptHost.cpp index d5bbd1c..13e156a 100644 --- a/WebCore/inspector/InjectedScriptHost.cpp +++ b/WebCore/inspector/InjectedScriptHost.cpp @@ -38,6 +38,7 @@ #include "Frame.h" #include "FrameLoader.h" #include "HTMLFrameOwnerElement.h" +#include "InjectedScript.h" #include "InspectorClient.h" #include "InspectorController.h" #include "InspectorDOMAgent.h" @@ -47,7 +48,7 @@ #include "ScriptArray.h" #include "ScriptFunctionCall.h" -#if ENABLE(JAVASCRIPT_DEBUGGER) +#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC) #include "JavaScriptCallFrame.h" #include "JavaScriptDebugServer.h" using namespace JSC; @@ -131,7 +132,7 @@ long InjectedScriptHost::pushNodeByPathToFrontend(const String& path) return domAgent->pushNodePathToFrontend(node); } -#if ENABLE(JAVASCRIPT_DEBUGGER) +#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC) JavaScriptCallFrame* InjectedScriptHost::currentCallFrame() const { return JavaScriptDebugServer::shared().currentCallFrame(); @@ -167,7 +168,7 @@ void InjectedScriptHost::reportDidDispatchOnInjectedScript(long callId, const St frontend->didDispatchOnInjectedScript(callId, result, isException); } -ScriptObject InjectedScriptHost::injectedScriptForId(long id) +InjectedScript InjectedScriptHost::injectedScriptForId(long id) { return m_idToInjectedScript.get(id); } @@ -180,13 +181,13 @@ void InjectedScriptHost::discardInjectedScripts() void InjectedScriptHost::releaseWrapperObjectGroup(long injectedScriptId, const String& objectGroup) { if (injectedScriptId) { - ScriptObject injectedScript = m_idToInjectedScript.get(injectedScriptId); + InjectedScript injectedScript = m_idToInjectedScript.get(injectedScriptId); if (!injectedScript.hasNoValue()) - releaseWrapperObjectGroup(injectedScript, objectGroup); + injectedScript.releaseWrapperObjectGroup(objectGroup); } else { // Iterate over all injected scripts if injectedScriptId is not specified. for (IdToInjectedScriptMap::iterator it = m_idToInjectedScript.begin(); it != m_idToInjectedScript.end(); ++it) - releaseWrapperObjectGroup(it->second, objectGroup); + it->second.releaseWrapperObjectGroup(objectGroup); } } @@ -204,13 +205,6 @@ InspectorFrontend* InjectedScriptHost::inspectorFrontend() return m_inspectorController->m_frontend.get(); } -void InjectedScriptHost::releaseWrapperObjectGroup(const ScriptObject& injectedScript, const String& objectGroup) -{ - ScriptFunctionCall releaseFunction(injectedScript.scriptState(), injectedScript, "releaseWrapperObjectGroup"); - releaseFunction.appendArgument(objectGroup); - releaseFunction.call(); -} - } // namespace WebCore #endif // ENABLE(INSPECTOR) diff --git a/WebCore/inspector/InjectedScriptHost.h b/WebCore/inspector/InjectedScriptHost.h index d91c8e2..901472c 100644 --- a/WebCore/inspector/InjectedScriptHost.h +++ b/WebCore/inspector/InjectedScriptHost.h @@ -41,6 +41,7 @@ namespace WebCore { class Database; +class InjectedScript; class InspectorDOMAgent; class InspectorFrontend; class JavaScriptCallFrame; @@ -71,7 +72,7 @@ public: void addNodesToSearchResult(const String& nodeIds); long pushNodeByPathToFrontend(const String& path); -#if ENABLE(JAVASCRIPT_DEBUGGER) +#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC) JavaScriptCallFrame* currentCallFrame() const; #endif #if ENABLE(DATABASE) @@ -83,8 +84,8 @@ public: #endif void reportDidDispatchOnInjectedScript(long callId, const String& result, bool isException); - ScriptObject injectedScriptFor(ScriptState*); - ScriptObject injectedScriptForId(long); + InjectedScript injectedScriptFor(ScriptState*); + InjectedScript injectedScriptForId(long); void discardInjectedScripts(); void releaseWrapperObjectGroup(long injectedScriptId, const String& objectGroup); @@ -93,12 +94,10 @@ private: InspectorDOMAgent* inspectorDOMAgent(); InspectorFrontend* inspectorFrontend(); - void releaseWrapperObjectGroup(const ScriptObject& injectedScript, const String& objectGroup); - InspectorController* m_inspectorController; String m_injectedScriptSource; long m_nextInjectedScriptId; - typedef HashMap<long, ScriptObject> IdToInjectedScriptMap; + typedef HashMap<long, InjectedScript> IdToInjectedScriptMap; IdToInjectedScriptMap m_idToInjectedScript; }; diff --git a/WebCore/inspector/InspectorBackend.cpp b/WebCore/inspector/InspectorBackend.cpp index 999a4b7..1ce0e69 100644 --- a/WebCore/inspector/InspectorBackend.cpp +++ b/WebCore/inspector/InspectorBackend.cpp @@ -40,6 +40,7 @@ #include "Frame.h" #include "FrameLoader.h" #include "HTMLFrameOwnerElement.h" +#include "InjectedScript.h" #include "InjectedScriptHost.h" #include "InspectorClient.h" #include "InspectorController.h" @@ -54,7 +55,7 @@ #include "Storage.h" #endif -#if ENABLE(JAVASCRIPT_DEBUGGER) +#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC) #include "JavaScriptCallFrame.h" #include "JavaScriptDebugServer.h" using namespace JSC; @@ -147,7 +148,7 @@ void InspectorBackend::stopTimelineProfiler() m_inspectorController->stopTimelineProfiler(); } -#if ENABLE(JAVASCRIPT_DEBUGGER) +#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC) bool InspectorBackend::debuggerEnabled() const { if (m_inspectorController) @@ -285,7 +286,7 @@ void InspectorBackend::dispatchOnInjectedScript(long callId, long injectedScript // FIXME: explicitly pass injectedScriptId along with node id to the frontend. bool injectedScriptIdIsNodeId = injectedScriptId <= 0; - ScriptObject injectedScript; + InjectedScript injectedScript; if (injectedScriptIdIsNodeId) injectedScript = m_inspectorController->injectedScriptForNodeId(-injectedScriptId); else @@ -294,19 +295,12 @@ void InspectorBackend::dispatchOnInjectedScript(long callId, long injectedScript if (injectedScript.hasNoValue()) return; - ScriptFunctionCall function(injectedScript.scriptState(), injectedScript, "dispatch"); - function.appendArgument(methodName); - function.appendArgument(arguments); - if (async) - function.appendArgument(callId); + String result; bool hadException = false; - ScriptValue result = function.call(hadException); + injectedScript.dispatch(callId, methodName, arguments, async, &result, &hadException); if (async) return; // InjectedScript will return result asynchronously by means of ::reportDidDispatchOnInjectedScript. - if (hadException) - frontend->didDispatchOnInjectedScript(callId, "", true); - else - frontend->didDispatchOnInjectedScript(callId, result.toString(injectedScript.scriptState()), false); + frontend->didDispatchOnInjectedScript(callId, result, hadException); } void InspectorBackend::getChildNodes(long callId, long nodeId) diff --git a/WebCore/inspector/InspectorBackend.h b/WebCore/inspector/InspectorBackend.h index 81c1f2d..7c9644f 100644 --- a/WebCore/inspector/InspectorBackend.h +++ b/WebCore/inspector/InspectorBackend.h @@ -73,7 +73,7 @@ public: void startTimelineProfiler(); void stopTimelineProfiler(); -#if ENABLE(JAVASCRIPT_DEBUGGER) +#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC) bool debuggerEnabled() const; void enableDebugger(bool always); void disableDebugger(bool always); diff --git a/WebCore/inspector/InspectorController.cpp b/WebCore/inspector/InspectorController.cpp index 5ab1354..1dbb898 100644 --- a/WebCore/inspector/InspectorController.cpp +++ b/WebCore/inspector/InspectorController.cpp @@ -39,9 +39,9 @@ #include "ConsoleMessage.h" #include "Cookie.h" #include "CookieJar.h" +#include "DOMWindow.h" #include "Document.h" #include "DocumentLoader.h" -#include "DOMWindow.h" #include "Element.h" #include "FloatConversion.h" #include "FloatQuad.h" @@ -53,16 +53,17 @@ #include "GraphicsContext.h" #include "HTMLFrameOwnerElement.h" #include "HitTestResult.h" -#include "InspectorBackend.h" #include "InjectedScriptHost.h" +#include "InjectedScript.h" +#include "InspectorBackend.h" #include "InspectorClient.h" -#include "InspectorFrontend.h" -#include "InspectorFrontendHost.h" -#include "InspectorDatabaseResource.h" #include "InspectorDOMAgent.h" #include "InspectorDOMStorageResource.h" -#include "InspectorTimelineAgent.h" +#include "InspectorDatabaseResource.h" +#include "InspectorFrontend.h" +#include "InspectorFrontendHost.h" #include "InspectorResource.h" +#include "InspectorTimelineAgent.h" #include "JavaScriptProfile.h" #include "Page.h" #include "ProgressTracker.h" @@ -73,6 +74,8 @@ #include "ScriptCallStack.h" #include "ScriptFunctionCall.h" #include "ScriptObject.h" +#include "ScriptProfile.h" +#include "ScriptProfiler.h" #include "ScriptString.h" #include "SecurityOrigin.h" #include "Settings.h" @@ -93,15 +96,12 @@ #include "StorageArea.h" #endif -#if ENABLE(JAVASCRIPT_DEBUGGER) +#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC) +#include "JSJavaScriptCallFrame.h" #include "JavaScriptCallFrame.h" #include "JavaScriptDebugServer.h" -#include "JSJavaScriptCallFrame.h" -#include <profiler/Profile.h> -#include <profiler/Profiler.h> #include <runtime/JSLock.h> -#include <runtime/StringBuilder.h> #include <runtime/UString.h> using namespace JSC; @@ -132,7 +132,7 @@ InspectorController::InspectorController(Page* page, InspectorClient* client) , m_client(client) , m_page(0) , m_expiredConsoleMessageCount(0) - , m_scriptState(0) + , m_frontendScriptState(0) , m_windowVisible(false) , m_showAfterVisible(CurrentPanel) , m_groupLevel(0) @@ -143,7 +143,7 @@ InspectorController::InspectorController(Page* page, InspectorClient* client) , m_inspectorBackend(InspectorBackend::create(this)) , m_inspectorFrontendHost(InspectorFrontendHost::create(this, client)) , m_injectedScriptHost(InjectedScriptHost::create(this)) -#if ENABLE(JAVASCRIPT_DEBUGGER) +#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC) , m_debuggerEnabled(false) , m_attachDebuggerWhenShown(false) , m_profilerEnabled(false) @@ -162,7 +162,7 @@ InspectorController::~InspectorController() { // These should have been cleared in inspectedPageDestroyed(). ASSERT(!m_client); - ASSERT(!m_scriptState); + ASSERT(!m_frontendScriptState); ASSERT(!m_inspectedPage); ASSERT(!m_page || (m_page && !m_page->parentInspectorController())); @@ -183,10 +183,9 @@ void InspectorController::inspectedPageDestroyed() { close(); - if (m_scriptState) { - ScriptGlobalObject::remove(m_scriptState, "InspectorBackend"); - ScriptGlobalObject::remove(m_scriptState, "InspectorFrontendHost"); - ScriptGlobalObject::remove(m_scriptState, "InjectedScriptHost"); + if (m_frontendScriptState) { + ScriptGlobalObject::remove(m_frontendScriptState, "InspectorBackend"); + ScriptGlobalObject::remove(m_frontendScriptState, "InspectorFrontendHost"); } ASSERT(m_inspectedPage); m_inspectedPage = 0; @@ -303,13 +302,13 @@ void InspectorController::setWindowVisible(bool visible, bool attached) if (m_nodeToFocus) focusNode(); -#if ENABLE(JAVASCRIPT_DEBUGGER) +#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC) if (m_attachDebuggerWhenShown) enableDebugger(); #endif showPanel(m_showAfterVisible); } else { -#if ENABLE(JAVASCRIPT_DEBUGGER) +#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC) // If the window is being closed with the debugger enabled, // remember this state to re-enable debugger on the next window // opening. @@ -390,7 +389,7 @@ void InspectorController::startGroup(MessageSource source, ScriptCallStack* call void InspectorController::endGroup(MessageSource source, unsigned lineNumber, const String& sourceURL) { - if (m_groupLevel == 0) + if (!m_groupLevel) return; --m_groupLevel; @@ -509,24 +508,23 @@ void InspectorController::windowScriptObjectAvailable() // Grant the inspector the ability to script the inspected page. m_page->mainFrame()->document()->securityOrigin()->grantUniversalAccess(); - m_scriptState = scriptStateFromPage(debuggerWorld(), m_page); - ScriptGlobalObject::set(m_scriptState, "InspectorBackend", m_inspectorBackend.get()); - ScriptGlobalObject::set(m_scriptState, "InspectorFrontendHost", m_inspectorFrontendHost.get()); + m_frontendScriptState = scriptStateFromPage(debuggerWorld(), m_page); + ScriptGlobalObject::set(m_frontendScriptState, "InspectorBackend", m_inspectorBackend.get()); + ScriptGlobalObject::set(m_frontendScriptState, "InspectorFrontendHost", m_inspectorFrontendHost.get()); } void InspectorController::scriptObjectReady() { - ASSERT(m_scriptState); - if (!m_scriptState) + ASSERT(m_frontendScriptState); + if (!m_frontendScriptState) return; ScriptObject webInspectorObj; - if (!ScriptGlobalObject::get(m_scriptState, "WebInspector", webInspectorObj)) + if (!ScriptGlobalObject::get(m_frontendScriptState, "WebInspector", webInspectorObj)) return; - ScriptObject injectedScriptObj; - setFrontendProxyObject(m_scriptState, webInspectorObj, injectedScriptObj); + setFrontendProxyObject(m_frontendScriptState, webInspectorObj); -#if ENABLE(JAVASCRIPT_DEBUGGER) +#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC) String debuggerEnabled = setting(debuggerEnabledSettingName); if (debuggerEnabled == "true") enableDebugger(); @@ -543,7 +541,7 @@ void InspectorController::scriptObjectReady() void InspectorController::setFrontendProxyObject(ScriptState* scriptState, ScriptObject webInspectorObj, ScriptObject) { - m_scriptState = scriptState; + m_frontendScriptState = scriptState; m_frontend.set(new InspectorFrontend(this, scriptState, webInspectorObj)); releaseDOMAgent(); m_domAgent = InspectorDOMAgent::create(m_frontend.get()); @@ -558,7 +556,7 @@ void InspectorController::show() if (!m_page) { if (m_frontend) - return; // We are using custom frontend - no need to create page. + return; // We are using custom frontend - no need to create page. m_page = m_client->createPage(); if (!m_page) @@ -595,7 +593,7 @@ void InspectorController::close() if (!enabled()) return; -#if ENABLE(JAVASCRIPT_DEBUGGER) +#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC) stopUserInitiatedProfiling(); disableDebugger(); #endif @@ -604,7 +602,7 @@ void InspectorController::close() releaseDOMAgent(); m_frontend.set(0); m_timelineAgent = 0; - m_scriptState = 0; + m_frontendScriptState = 0; if (m_page) { if (!m_page->mainFrame() || !m_page->mainFrame()->loader() || !m_page->mainFrame()->loader()->isLoading()) { m_page->setParentInspectorController(0); @@ -745,7 +743,7 @@ void InspectorController::didCommitLoad(DocumentLoader* loader) m_times.clear(); m_counts.clear(); -#if ENABLE(JAVASCRIPT_DEBUGGER) +#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC) m_profiles.clear(); m_currentUserInitiatedProfileNumber = 1; m_nextUserInitiatedProfileNumber = 1; @@ -1306,7 +1304,7 @@ void InspectorController::setDOMStorageItem(long callId, long storageId, const S if (storageResource) { ExceptionCode exception = 0; storageResource->domStorage()->setItem(key, value, exception); - success = (exception == 0); + success = !exception; } m_frontend->didSetDOMStorageItem(callId, success); } @@ -1344,13 +1342,13 @@ void InspectorController::moveWindowBy(float x, float y) const m_page->chrome()->setWindowRect(frameRect); } -#if ENABLE(JAVASCRIPT_DEBUGGER) -void InspectorController::addProfile(PassRefPtr<Profile> prpProfile, unsigned lineNumber, const UString& sourceURL) +#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC) +void InspectorController::addProfile(PassRefPtr<ScriptProfile> prpProfile, unsigned lineNumber, const String& sourceURL) { if (!enabled()) return; - RefPtr<Profile> profile = prpProfile; + RefPtr<ScriptProfile> profile = prpProfile; m_profiles.add(profile->uid(), profile); if (m_frontend) { @@ -1361,30 +1359,18 @@ void InspectorController::addProfile(PassRefPtr<Profile> prpProfile, unsigned li addProfileFinishedMessageToConsole(profile, lineNumber, sourceURL); } -void InspectorController::addProfileFinishedMessageToConsole(PassRefPtr<Profile> prpProfile, unsigned lineNumber, const UString& sourceURL) +void InspectorController::addProfileFinishedMessageToConsole(PassRefPtr<ScriptProfile> prpProfile, unsigned lineNumber, const String& sourceURL) { - RefPtr<Profile> profile = prpProfile; + RefPtr<ScriptProfile> profile = prpProfile; - JSC::StringBuilder message; - message.append("Profile \"webkit-profile://"); - message.append((UString)encodeWithURLEscapeSequences(CPUProfileType)); - message.append("/"); - message.append((UString)encodeWithURLEscapeSequences(profile->title())); - message.append("#"); - message.append(UString::from(profile->uid())); - message.append("\" finished."); - addMessageToConsole(JSMessageSource, LogMessageType, LogMessageLevel, message.release(), lineNumber, sourceURL); + String message = String::format("Profile \"webkit-profile://%s/%s#%d\" finished.", CPUProfileType, encodeWithURLEscapeSequences(profile->title()).utf8().data(), profile->uid()); + addMessageToConsole(JSMessageSource, LogMessageType, LogMessageLevel, message, lineNumber, sourceURL); } -void InspectorController::addStartProfilingMessageToConsole(const UString& title, unsigned lineNumber, const UString& sourceURL) +void InspectorController::addStartProfilingMessageToConsole(const String& title, unsigned lineNumber, const String& sourceURL) { - JSC::StringBuilder message; - message.append("Profile \"webkit-profile://"); - message.append(encodeWithURLEscapeSequences(CPUProfileType)); - message.append("/"); - message.append(encodeWithURLEscapeSequences(title)); - message.append("#0\" started."); - addMessageToConsole(JSMessageSource, LogMessageType, LogMessageLevel, message.release(), lineNumber, sourceURL); + String message = String::format("Profile \"webkit-profile://%s/%s#0\" started.", CPUProfileType, encodeWithURLEscapeSequences(title).utf8().data()); + addMessageToConsole(JSMessageSource, LogMessageType, LogMessageLevel, message, lineNumber, sourceURL); } void InspectorController::getProfileHeaders(long callId) @@ -1405,29 +1391,24 @@ void InspectorController::getProfile(long callId, unsigned uid) return; ProfilesMap::iterator it = m_profiles.find(uid); if (it != m_profiles.end()) - m_frontend->didGetProfile(callId, toJS(m_scriptState, it->second.get())); + m_frontend->didGetProfile(callId, toJS(m_frontendScriptState, it->second.get())); } -ScriptObject InspectorController::createProfileHeader(const JSC::Profile& profile) +ScriptObject InspectorController::createProfileHeader(const ScriptProfile& profile) { ScriptObject header = m_frontend->newScriptObject(); header.set("title", profile.title()); header.set("uid", profile.uid()); - header.set("typeId", UString(CPUProfileType)); + header.set("typeId", String(CPUProfileType)); return header; } -UString InspectorController::getCurrentUserInitiatedProfileName(bool incrementProfileNumber = false) +String InspectorController::getCurrentUserInitiatedProfileName(bool incrementProfileNumber = false) { if (incrementProfileNumber) m_currentUserInitiatedProfileNumber = m_nextUserInitiatedProfileNumber++; - JSC::StringBuilder title; - title.append(UserInitiatedProfileName); - title.append("."); - title.append(UString::from(m_currentUserInitiatedProfileNumber)); - - return title.release(); + return String::format("%s.%d", UserInitiatedProfileName, m_currentUserInitiatedProfileNumber); } void InspectorController::startUserInitiatedProfilingSoon() @@ -1447,12 +1428,12 @@ void InspectorController::startUserInitiatedProfiling(Timer<InspectorController> m_recordingUserInitiatedProfile = true; - UString title = getCurrentUserInitiatedProfileName(true); + String title = getCurrentUserInitiatedProfileName(true); ExecState* scriptState = toJSDOMWindow(m_inspectedPage->mainFrame(), debuggerWorld())->globalExec(); - Profiler::profiler()->startProfiling(scriptState, title); + ScriptProfiler::start(scriptState, title); - addStartProfilingMessageToConsole(title, 0, UString()); + addStartProfilingMessageToConsole(title, 0, String()); toggleRecordButton(true); } @@ -1464,12 +1445,12 @@ void InspectorController::stopUserInitiatedProfiling() m_recordingUserInitiatedProfile = false; - UString title = getCurrentUserInitiatedProfileName(); + String title = getCurrentUserInitiatedProfileName(); ExecState* scriptState = toJSDOMWindow(m_inspectedPage->mainFrame(), debuggerWorld())->globalExec(); - RefPtr<Profile> profile = Profiler::profiler()->stopProfiling(scriptState, title); + RefPtr<ScriptProfile> profile = ScriptProfiler::stop(scriptState, title); if (profile) - addProfile(profile, 0, UString()); + addProfile(profile, 0, String()); toggleRecordButton(false); } @@ -1536,9 +1517,9 @@ void InspectorController::enableDebugger() if (m_debuggerEnabled) return; - if (!m_scriptState || !m_frontend) { + if (!m_frontendScriptState || !m_frontend) m_attachDebuggerWhenShown = true; - } else { + else { m_frontend->attachDebuggerWhenShown(); m_attachDebuggerWhenShown = false; } @@ -1587,11 +1568,8 @@ void InspectorController::didPause() JavaScriptCallFrame* callFrame = m_injectedScriptHost->currentCallFrame(); ScriptState* scriptState = callFrame->scopeChain()->globalObject->globalExec(); ASSERT(scriptState); - ScriptObject injectedScriptObj = m_injectedScriptHost->injectedScriptFor(scriptState); - ScriptFunctionCall function(scriptState, injectedScriptObj, "getCallFrames"); - ScriptValue callFramesValue = function.call(); - String callFrames = callFramesValue.toString(scriptState); - + InjectedScript injectedScript = m_injectedScriptHost->injectedScriptFor(scriptState); + String callFrames = injectedScript.callFrames(); m_frontend->pausedScript(callFrames); } @@ -1803,20 +1781,19 @@ InspectorController::SpecialPanels InspectorController::specialPanelForJSName(co { if (panelName == "elements") return ElementsPanel; - else if (panelName == "resources") + if (panelName == "resources") return ResourcesPanel; - else if (panelName == "scripts") + if (panelName == "scripts") return ScriptsPanel; - else if (panelName == "timeline") + if (panelName == "timeline") return TimelinePanel; - else if (panelName == "profiles") + if (panelName == "profiles") return ProfilesPanel; - else if (panelName == "storage" || panelName == "databases") + if (panelName == "storage" || panelName == "databases") return StoragePanel; - else if (panelName == "console") + if (panelName == "console") return ConsolePanel; - else - return ElementsPanel; + return ElementsPanel; } void InspectorController::deleteCookie(const String& cookieName, const String& domain) @@ -1829,7 +1806,7 @@ void InspectorController::deleteCookie(const String& cookieName, const String& d } } -ScriptObject InspectorController::injectedScriptForNodeId(long id) +InjectedScript InspectorController::injectedScriptForNodeId(long id) { Frame* frame = 0; @@ -1847,7 +1824,7 @@ ScriptObject InspectorController::injectedScriptForNodeId(long id) if (frame) return m_injectedScriptHost->injectedScriptFor(mainWorldScriptState(frame)); - return ScriptObject(); + return InjectedScript(); } } // namespace WebCore diff --git a/WebCore/inspector/InspectorController.h b/WebCore/inspector/InspectorController.h index 860bf49..6904380 100644 --- a/WebCore/inspector/InspectorController.h +++ b/WebCore/inspector/InspectorController.h @@ -35,6 +35,7 @@ #include "PlatformString.h" #include "ScriptArray.h" #include "ScriptObject.h" +#include "ScriptProfile.h" #include "ScriptState.h" #include "ScriptValue.h" #include "StringHash.h" @@ -46,12 +47,11 @@ #include <wtf/RefCounted.h> #include <wtf/Vector.h> -#if ENABLE(JAVASCRIPT_DEBUGGER) +#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC) #include "JavaScriptDebugListener.h" namespace JSC { - class Profile; - class UString; +class UString; } #endif @@ -64,6 +64,7 @@ class DocumentLoader; class Element; class GraphicsContext; class HitTestResult; +class InjectedScript; class InjectedScriptHost; class InspectorBackend; class InspectorClient; @@ -89,7 +90,7 @@ class InspectorDOMStorageResource; class InspectorResource; class InspectorController -#if ENABLE(JAVASCRIPT_DEBUGGER) +#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC) : JavaScriptDebugListener, public Noncopyable #else : public Noncopyable @@ -149,7 +150,7 @@ public: void detachWindow(); void toggleSearchForNodeInPage(); - bool searchingForNodeInPage() { return m_searchingForNode; }; + bool searchingForNodeInPage() const { return m_searchingForNode; } void mouseDidMoveOverElement(const HitTestResult&, unsigned modifierFlags); void handleMousePressOnNode(Node*); @@ -157,7 +158,7 @@ public: void windowScriptObjectAvailable(); void setFrontendProxyObject(ScriptState* state, ScriptObject webInspectorObj, ScriptObject injectedScriptObj = ScriptObject()); - ScriptState* frontendScriptState() const { return m_scriptState; } + ScriptState* frontendScriptState() const { return m_frontendScriptState; } void populateScriptObjects(); void resetScriptObjects(); @@ -219,14 +220,14 @@ public: void markTimeline(const String& message); -#if ENABLE(JAVASCRIPT_DEBUGGER) - void addProfile(PassRefPtr<JSC::Profile>, unsigned lineNumber, const JSC::UString& sourceURL); - void addProfileFinishedMessageToConsole(PassRefPtr<JSC::Profile>, unsigned lineNumber, const JSC::UString& sourceURL); - void addStartProfilingMessageToConsole(const JSC::UString& title, unsigned lineNumber, const JSC::UString& sourceURL); +#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC) + void addProfile(PassRefPtr<ScriptProfile>, unsigned lineNumber, const String& sourceURL); + void addProfileFinishedMessageToConsole(PassRefPtr<ScriptProfile>, unsigned lineNumber, const String& sourceURL); + void addStartProfilingMessageToConsole(const String& title, unsigned lineNumber, const String& sourceURL); bool isRecordingUserInitiatedProfile() const { return m_recordingUserInitiatedProfile; } - JSC::UString getCurrentUserInitiatedProfileName(bool incrementProfileNumber); + String getCurrentUserInitiatedProfileName(bool incrementProfileNumber); void startUserInitiatedProfiling(Timer<InspectorController>* = 0); void stopUserInitiatedProfiling(); @@ -248,7 +249,7 @@ public: void evaluateForTestInFrontend(long callId, const String& script); - ScriptObject injectedScriptForNodeId(long id); + InjectedScript injectedScriptForNodeId(long id); private: static const char* const FrontendSettingsSettingName; @@ -267,15 +268,15 @@ private: void deleteCookie(const String& cookieName, const String& domain); -#if ENABLE(JAVASCRIPT_DEBUGGER) - typedef HashMap<unsigned int, RefPtr<JSC::Profile> > ProfilesMap; +#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC) + typedef HashMap<unsigned int, RefPtr<ScriptProfile> > ProfilesMap; void startUserInitiatedProfilingSoon(); void toggleRecordButton(bool); void enableDebuggerFromFrontend(bool always); void getProfileHeaders(long callId); void getProfile(long callId, unsigned uid); - ScriptObject createProfileHeader(const JSC::Profile& profile); + ScriptObject createProfileHeader(const ScriptProfile& profile); #endif #if ENABLE(DATABASE) void selectDatabase(Database* database); @@ -328,7 +329,7 @@ private: #if ENABLE(DOM_STORAGE) DOMStorageResourcesMap m_domStorageResources; #endif - ScriptState* m_scriptState; + ScriptState* m_frontendScriptState; bool m_windowVisible; SpecialPanels m_showAfterVisible; RefPtr<Node> m_highlightedNode; @@ -345,7 +346,7 @@ private: mutable Settings m_settings; Vector<pair<long, String> > m_pendingEvaluateTestCommands; -#if ENABLE(JAVASCRIPT_DEBUGGER) +#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC) bool m_debuggerEnabled; bool m_attachDebuggerWhenShown; bool m_profilerEnabled; diff --git a/WebCore/inspector/InspectorFrontend.cpp b/WebCore/inspector/InspectorFrontend.cpp index d5c817d..c3bf1b4 100644 --- a/WebCore/inspector/InspectorFrontend.cpp +++ b/WebCore/inspector/InspectorFrontend.cpp @@ -34,6 +34,7 @@ #include "ConsoleMessage.h" #include "Frame.h" +#include "InjectedScript.h" #include "InjectedScriptHost.h" #include "InspectorController.h" #include "Node.h" @@ -43,7 +44,7 @@ #include "ScriptString.h" #include <wtf/OwnPtr.h> -#if ENABLE(JAVASCRIPT_DEBUGGER) +#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC) #include <parser/SourceCode.h> #include <runtime/JSValue.h> #include <runtime/UString.h> @@ -105,15 +106,9 @@ void InspectorFrontend::addConsoleMessage(const ScriptObject& messageObj, const function.appendArgument(frames[i]); } else if (!arguments.isEmpty()) { function.appendArgument(true); - ScriptObject injectedScript = m_inspectorController->injectedScriptHost()->injectedScriptFor(scriptState); + InjectedScript injectedScript = m_inspectorController->injectedScriptHost()->injectedScriptFor(scriptState); for (unsigned i = 0; i < arguments.size(); ++i) { - ScriptFunctionCall wrapFunction(scriptState, injectedScript, "wrapAndStringifyObject"); - wrapFunction.appendArgument(arguments[i]); - wrapFunction.appendArgument("console"); - ScriptValue r = wrapFunction.call(); - if (r.hasNoValue()) - return; - String s = r.toString(scriptState); + String s = injectedScript.wrapAndStringifyForConsole(arguments[i]); function.appendArgument(s); } } else { @@ -252,7 +247,7 @@ void InspectorFrontend::addRecordToTimeline(const ScriptObject& record) function.call(); } -#if ENABLE(JAVASCRIPT_DEBUGGER) +#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC) void InspectorFrontend::attachDebuggerWhenShown() { callSimpleFunction("attachDebuggerWhenShown"); diff --git a/WebCore/inspector/InspectorFrontend.h b/WebCore/inspector/InspectorFrontend.h index 0b52566..a36a323 100644 --- a/WebCore/inspector/InspectorFrontend.h +++ b/WebCore/inspector/InspectorFrontend.h @@ -35,7 +35,7 @@ #include "ScriptState.h" #include <wtf/PassOwnPtr.h> -#if ENABLE(JAVASCRIPT_DEBUGGER) +#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC) namespace JSC { class JSValue; class SourceCode; @@ -84,7 +84,7 @@ namespace WebCore { void resourceTrackingWasEnabled(); void resourceTrackingWasDisabled(); -#if ENABLE(JAVASCRIPT_DEBUGGER) +#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC) void attachDebuggerWhenShown(); void debuggerWasEnabled(); void debuggerWasDisabled(); diff --git a/WebCore/inspector/JavaScriptCallFrame.cpp b/WebCore/inspector/JavaScriptCallFrame.cpp index cbc5314..e6f75b8 100644 --- a/WebCore/inspector/JavaScriptCallFrame.cpp +++ b/WebCore/inspector/JavaScriptCallFrame.cpp @@ -27,7 +27,7 @@ #include "JavaScriptCallFrame.h" #include "JSDOMBinding.h" -#if ENABLE(JAVASCRIPT_DEBUGGER) +#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC) #include "PlatformString.h" #include <debugger/DebuggerCallFrame.h> diff --git a/WebCore/inspector/JavaScriptCallFrame.h b/WebCore/inspector/JavaScriptCallFrame.h index 47cdac2..bf61c4b 100644 --- a/WebCore/inspector/JavaScriptCallFrame.h +++ b/WebCore/inspector/JavaScriptCallFrame.h @@ -26,7 +26,7 @@ #ifndef JavaScriptCallFrame_h #define JavaScriptCallFrame_h -#if ENABLE(JAVASCRIPT_DEBUGGER) +#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC) #include <interpreter/CallFrame.h> #include <wtf/PassRefPtr.h> diff --git a/WebCore/inspector/JavaScriptDebugListener.h b/WebCore/inspector/JavaScriptDebugListener.h index 912a751..6570065 100644 --- a/WebCore/inspector/JavaScriptDebugListener.h +++ b/WebCore/inspector/JavaScriptDebugListener.h @@ -29,7 +29,7 @@ #ifndef JavaScriptDebugListener_h #define JavaScriptDebugListener_h -#if ENABLE(JAVASCRIPT_DEBUGGER) +#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC) namespace JSC { class ExecState; diff --git a/WebCore/inspector/JavaScriptDebugServer.cpp b/WebCore/inspector/JavaScriptDebugServer.cpp index 4aab347..03c3577 100644 --- a/WebCore/inspector/JavaScriptDebugServer.cpp +++ b/WebCore/inspector/JavaScriptDebugServer.cpp @@ -29,7 +29,7 @@ #include "config.h" #include "JavaScriptDebugServer.h" -#if ENABLE(JAVASCRIPT_DEBUGGER) +#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC) #include "DOMWindow.h" #include "EventLoop.h" diff --git a/WebCore/inspector/JavaScriptDebugServer.h b/WebCore/inspector/JavaScriptDebugServer.h index b5b713d..d7c23bc 100644 --- a/WebCore/inspector/JavaScriptDebugServer.h +++ b/WebCore/inspector/JavaScriptDebugServer.h @@ -29,7 +29,7 @@ #ifndef JavaScriptDebugServer_h #define JavaScriptDebugServer_h -#if ENABLE(JAVASCRIPT_DEBUGGER) +#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC) #include "Timer.h" #include <debugger/Debugger.h> diff --git a/WebCore/inspector/JavaScriptProfile.cpp b/WebCore/inspector/JavaScriptProfile.cpp index 3a65fb8..2203f0b 100644 --- a/WebCore/inspector/JavaScriptProfile.cpp +++ b/WebCore/inspector/JavaScriptProfile.cpp @@ -26,7 +26,7 @@ #include "config.h" #include "JavaScriptProfile.h" -#if ENABLE(JAVASCRIPT_DEBUGGER) +#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC) #include "JavaScriptProfileNode.h" #include <profiler/Profile.h> diff --git a/WebCore/inspector/JavaScriptProfile.h b/WebCore/inspector/JavaScriptProfile.h index 28fd3e4..2500881 100644 --- a/WebCore/inspector/JavaScriptProfile.h +++ b/WebCore/inspector/JavaScriptProfile.h @@ -26,7 +26,7 @@ #ifndef JavaScriptProfile_h #define JavaScriptProfile_h -#if ENABLE(JAVASCRIPT_DEBUGGER) +#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC) #include <runtime/JSValue.h> diff --git a/WebCore/inspector/JavaScriptProfileNode.cpp b/WebCore/inspector/JavaScriptProfileNode.cpp index 2d462f6..6387c85 100644 --- a/WebCore/inspector/JavaScriptProfileNode.cpp +++ b/WebCore/inspector/JavaScriptProfileNode.cpp @@ -26,7 +26,7 @@ #include "config.h" #include "JavaScriptProfileNode.h" -#if ENABLE(JAVASCRIPT_DEBUGGER) +#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC) #include "JSDOMBinding.h" #include <profiler/ProfileNode.h> diff --git a/WebCore/inspector/JavaScriptProfileNode.h b/WebCore/inspector/JavaScriptProfileNode.h index ad72b71..2685ac6 100644 --- a/WebCore/inspector/JavaScriptProfileNode.h +++ b/WebCore/inspector/JavaScriptProfileNode.h @@ -26,7 +26,7 @@ #ifndef JavaScriptProfileNode_h #define JavaScriptProfileNode_h -#if ENABLE(JAVASCRIPT_DEBUGGER) +#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC) #include <runtime/JSValue.h> #include <JavaScriptCore/JSBase.h> diff --git a/WebCore/inspector/front-end/ElementsTreeOutline.js b/WebCore/inspector/front-end/ElementsTreeOutline.js index d38a7bb..8d8d5db 100644 --- a/WebCore/inspector/front-end/ElementsTreeOutline.js +++ b/WebCore/inspector/front-end/ElementsTreeOutline.js @@ -898,29 +898,18 @@ WebInspector.ElementsTreeElement.prototype = { if (!hrefValue || hrefValue.indexOf("://") > 0) return hrefValue; - var match; - var documentURL; for (var frameOwnerCandidate = node; frameOwnerCandidate; frameOwnerCandidate = frameOwnerCandidate.parentNode) { if (frameOwnerCandidate.documentURL) { - documentURL = frameOwnerCandidate.documentURL; + var result = WebInspector.completeURL(frameOwnerCandidate.documentURL, hrefValue); + if (result) + return result; break; } } - if (documentURL) { - match = documentURL.match(WebInspector.URLRegExp); - if (match) { - var path = hrefValue; - if (path.charAt(0) !== "/") { - var documentPath = match[4] || "/"; - path = documentPath.substring(0, documentPath.lastIndexOf("/")) + "/" + path; - } - return match[1] + "://" + match[2] + (match[3] ? (":" + match[3]) : "") + path; - } - } // documentURL not found or has bad value for (var url in WebInspector.resourceURLMap) { - match = url.match(WebInspector.URLRegExp); + var match = url.match(WebInspector.URLRegExp); if (match && match[4] === hrefValue) return url; } diff --git a/WebCore/inspector/front-end/InjectedScript.js b/WebCore/inspector/front-end/InjectedScript.js index 9389117..337628f 100644 --- a/WebCore/inspector/front-end/InjectedScript.js +++ b/WebCore/inspector/front-end/InjectedScript.js @@ -923,7 +923,7 @@ InjectedScript.openInInspectedWindow = function(url) return true; } -InjectedScript.getCallFrames = function() +InjectedScript.callFrames = function() { var callFrame = InjectedScriptHost.currentCallFrame(); if (!callFrame) diff --git a/WebCore/inspector/front-end/InspectorBackendStub.js b/WebCore/inspector/front-end/InspectorBackendStub.js index 5ddb74a..ed03f73 100644 --- a/WebCore/inspector/front-end/InspectorBackendStub.js +++ b/WebCore/inspector/front-end/InspectorBackendStub.js @@ -46,17 +46,6 @@ WebInspector.InspectorBackendStub.prototype = { return func; }, - platform: function() - { - return "mac-leopard"; - }, - - port: function() - { - return "unknown"; - }, - - closeWindow: function() { this._windowVisible = false; diff --git a/WebCore/inspector/front-end/InspectorFrontendHostStub.js b/WebCore/inspector/front-end/InspectorFrontendHostStub.js index dc7da61..f1decb6 100644 --- a/WebCore/inspector/front-end/InspectorFrontendHostStub.js +++ b/WebCore/inspector/front-end/InspectorFrontendHostStub.js @@ -35,10 +35,12 @@ WebInspector.InspectorFrontendHostStub = function() this._attachedWindowHeight = 0; } +WebInspector._platformFlavor = WebInspector.PlatformFlavor.MacLeopard; + WebInspector.InspectorFrontendHostStub.prototype = { platform: function() { - return "mac-leopard"; + return "mac"; }, port: function() diff --git a/WebCore/inspector/front-end/NativeTextViewer.js b/WebCore/inspector/front-end/NativeTextViewer.js index 53b213d..5e7db27 100644 --- a/WebCore/inspector/front-end/NativeTextViewer.js +++ b/WebCore/inspector/front-end/NativeTextViewer.js @@ -28,13 +28,14 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -WebInspector.NativeTextViewer = function(textModel, platform) +WebInspector.NativeTextViewer = function(textModel, platform, url) { WebInspector.TextEditor.call(this, textModel, platform); - this._sheet.className = "monospace"; this._sheet.tabIndex = 0; this._canvas.style.zIndex = 0; this._createLineDivs(); + this._url = url; + this._selectionColor = "rgb(241, 234, 0)"; } WebInspector.NativeTextViewer.prototype = { @@ -52,9 +53,13 @@ WebInspector.NativeTextViewer.prototype = { for (var i = 0; i < this._textModel.linesCount; ++i) { var lineDiv = document.createElement("div"); lineDiv.className = "native-text-editor-line"; - lineDiv.textContent = this._textModel.line(i); + var text = this._textModel.line(i); + lineDiv.textContent = text; + if (!text) + lineDiv.style.minHeight = this._textLineHeight + "px"; this._sheet.appendChild(lineDiv); this._textModel.setAttribute(i, "line-div", lineDiv); + this._textModel.removeAttribute(i, "div-highlighted"); } this._container.appendChild(this._sheet); }, @@ -68,7 +73,7 @@ WebInspector.NativeTextViewer.prototype = { var newLineNumberDigits = this._decimalDigits(this._textModel.linesCount); this._lineNumberWidth = (newLineNumberDigits + 2) * this._digitWidth; - this._sheet.style.paddingLeft = this._textWidth + this._lineNumberWidth + "px"; + this._container.style.left = this._lineNumberWidth + "px"; this._lineNumberDigits = newLineNumberDigits; this.repaintAll(); @@ -86,7 +91,8 @@ WebInspector.NativeTextViewer.prototype = { _registerMouseListeners: function() { - this._sheet.addEventListener("mousedown", this._mouseDown.bind(this), false); + this.element.addEventListener("contextmenu", this._contextMenu.bind(this), false); + this.element.addEventListener("mousedown", this._mouseDown.bind(this), false); }, _registerKeyboardListeners: function() @@ -99,44 +105,48 @@ WebInspector.NativeTextViewer.prototype = { // Noop - let browser take care of this. }, - _paintSelection: function() + _positionDivDecoration: function() { - // Noop - let browser take care of this. + // Div decorations have fixed positions in our case. }, - _positionDivDecoration: function() + _registerShortcuts: function() { - // Div decorations have fixed positions in our case. + // Noop. }, _mouseDown: function(e) { - if (e.offsetX + e.target.offsetTop >= this._lineNumberWidth && this._lineNumberDecorator) - return; - - if (e.button === 2 || (this._isMac && e.ctrlKey)) + if (e.target !== this.element || e.button === 2 || (this._isMac && e.ctrlKey)) return; - - var location = this._caretForMouseEvent(e); - this._lineNumberDecorator.mouseDown(location.line, e); + this._lineNumberDecorator.mouseDown(this._lineForMouseEvent(e), e); }, _contextMenu: function(e) { - // Override editor's implementation to add the line's offsets. - if (e.offsetX + e.target.offsetTop >= this._lineNumberWidth && this._lineNumberDecorator) + if (e.target !== this.element) return; + this._lineNumberDecorator.contextMenu(this._lineForMouseEvent(e), e); + }, - var location = this._caretForMouseEvent(e); - this._lineNumberDecorator.contextMenu(location.line, e); + _lineForMouseEvent: function(e) + { + return Math.max(0, this._offsetToLine(e.offsetY + this._scrollTop) - 1); }, - _caretForMouseEvent: function(e) + _lineHeight: function(lineNumber) { - // Override editor's implementation to add the line's offsets. - var lineNumber = Math.max(0, this._offsetToLine(e.offsetY + e.target.offsetTop) - 1); - var offset = e.offsetX + e.target.offsetLeft + this._scrollLeft - this._lineNumberWidth; - return { line: lineNumber, column: this._columnForOffset(lineNumber, offset) }; + // Use cached value first. + if (this._lineOffsetsCache[lineNumber + 1]) + return this._lineOffsetsCache[lineNumber + 1] - this._lineOffsetsCache[lineNumber]; + + // Get metrics from the browser. + var element = this._textModel.getAttribute(lineNumber, "line-div"); + if (lineNumber + 1 < this._textModel.linesCount) { + var nextElement = this._textModel.getAttribute(lineNumber + 1, "line-div"); + return nextElement.offsetTop - element.offsetTop; + } + return element.parentElement.offsetHeight - element.offsetTop; }, _paintLine: function(lineNumber, lineOffset) @@ -181,12 +191,41 @@ WebInspector.NativeTextViewer.prototype = { _createSpan: function(content, className) { + if (className === "html-resource-link" || className === "html-external-link") + return this._createLink(content, className === "html-external-link"); + var span = document.createElement("span"); span.className = "webkit-" + className; span.appendChild(document.createTextNode(content)); return span; }, + _createLink: function(content, isExternal) + { + var quote = content.charAt(0); + if (content.length > 1 && (quote === "\"" || quote === "'")) + content = content.substring(1, content.length - 1); + else + quote = null; + + var a = WebInspector.linkifyURLAsNode(this._rewriteHref(content), content, null, isExternal); + var span = document.createElement("span"); + span.className = "webkit-html-attribute-value"; + if (quote) + span.appendChild(document.createTextNode(quote)); + span.appendChild(a); + if (quote) + span.appendChild(document.createTextNode(quote)); + return span; + }, + + _rewriteHref: function(hrefValue, isExternal) + { + if (!this._url || !hrefValue || hrefValue.indexOf("://") > 0) + return hrefValue; + return WebInspector.completeURL(this._url, hrefValue); + }, + setDivDecoration: function(lineNumber, element) { var existingElement = this._textModel.getAttribute(lineNumber, "div-decoration"); @@ -203,6 +242,16 @@ WebInspector.NativeTextViewer.prototype = { this._textModel.setAttribute(lineNumber, "div-decoration", element); } this.revalidateDecorationsAndPaint(); + }, + + initFontMetrics: function() + { + WebInspector.TextEditor.prototype.initFontMetrics.call(this); + for (var i = 0; i < this._textModel.linesCount; ++i) { + var lineDiv = this._textModel.getAttribute(i, "line-div"); + if (!this._textModel.line(i)) + lineDiv.style.minHeight = this._textLineHeight + "px"; + } } } diff --git a/WebCore/inspector/front-end/ResourceView.js b/WebCore/inspector/front-end/ResourceView.js index 334847e..b7b01ac 100644 --- a/WebCore/inspector/front-end/ResourceView.js +++ b/WebCore/inspector/front-end/ResourceView.js @@ -183,6 +183,8 @@ WebInspector.ResourceView.prototype = { this.headersElement.addStyleClass("hidden"); if ("resize" in this) this.resize(); + if ("contentTabSelected" in this) + this.contentTabSelected(); }, _refreshURL: function() diff --git a/WebCore/inspector/front-end/ResourcesPanel.js b/WebCore/inspector/front-end/ResourcesPanel.js index e0c5521..40a380c 100644 --- a/WebCore/inspector/front-end/ResourcesPanel.js +++ b/WebCore/inspector/front-end/ResourcesPanel.js @@ -429,7 +429,7 @@ WebInspector.ResourcesPanel.prototype = { return; var newView = this._createResourceView(resource); - if (newView.prototype === resource._resourcesView.prototype) + if (newView.__proto__ === resource._resourcesView.__proto__) return; resource.warnings = 0; @@ -439,6 +439,7 @@ WebInspector.ResourcesPanel.prototype = { resource._itemsTreeElement.updateErrorsAndWarnings(); var oldView = resource._resourcesView; + var oldViewParentNode = oldView.visible ? oldView.element.parentNode : null; resource._resourcesView.detach(); delete resource._resourcesView; @@ -447,8 +448,8 @@ WebInspector.ResourcesPanel.prototype = { newView.headersVisible = oldView.headersVisible; - if (oldView.visible && oldView.element.parentNode) - newView.show(oldView.element.parentNode); + if (oldViewParentNode) + newView.show(oldViewParentNode); }, canShowSourceLineForURL: function(url) diff --git a/WebCore/inspector/front-end/Settings.js b/WebCore/inspector/front-end/Settings.js index 1838068..bc0daa5 100644 --- a/WebCore/inspector/front-end/Settings.js +++ b/WebCore/inspector/front-end/Settings.js @@ -39,7 +39,7 @@ var Preferences = { showMissingLocalizedStrings: false, samplingCPUProfiler: false, showColorNicknames: true, - useCanvasBasedEditor: true + useCanvasBasedEditor: false } WebInspector.populateFrontendSettings = function(settingsString) diff --git a/WebCore/inspector/front-end/SourceFrame.js b/WebCore/inspector/front-end/SourceFrame.js index 1e1bd0c..e30dbdb 100644 --- a/WebCore/inspector/front-end/SourceFrame.js +++ b/WebCore/inspector/front-end/SourceFrame.js @@ -123,11 +123,12 @@ WebInspector.SourceFrame.prototype = { this._editor.revalidateDecorationsAndPaint(); }, - setContent: function(mimeType, content) + setContent: function(mimeType, content, url) { this._loaded = true; this._textModel.setText(null, content); this._mimeType = mimeType; + this._url = url; this._createEditorIfNeeded(); }, @@ -137,13 +138,14 @@ WebInspector.SourceFrame.prototype = { return; var editorConstructor = Preferences.useCanvasBasedEditor ? WebInspector.TextEditor : WebInspector.NativeTextViewer; - this._editor = new editorConstructor(this._textModel, WebInspector.platform); + this._editor = new editorConstructor(this._textModel, WebInspector.platform, this._url); this._editor.lineNumberDecorator = new WebInspector.BreakpointLineNumberDecorator(this, this._editor.textModel); this._editor.lineDecorator = new WebInspector.ExecutionLineDecorator(this); this._editor.readOnly = true; this._element = this._editor.element; this._element.addEventListener("keydown", this._keyDown.bind(this), true); this._parentElement.appendChild(this._element); + this._editor.initFontMetrics(); this._editor.mimeType = this._mimeType; diff --git a/WebCore/inspector/front-end/SourceHTMLTokenizer.js b/WebCore/inspector/front-end/SourceHTMLTokenizer.js index 1212ffe..8856ff5 100644 --- a/WebCore/inspector/front-end/SourceHTMLTokenizer.js +++ b/WebCore/inspector/front-end/SourceHTMLTokenizer.js @@ -1,4 +1,4 @@ -/* Generated by re2c 0.13.5 on Thu Jan 28 20:49:22 2010 */ +/* Generated by re2c 0.13.5 on Tue Feb 2 00:44:38 2010 */ /* * Copyright (C) 2009 Google Inc. All rights reserved. * @@ -45,72 +45,81 @@ WebInspector.SourceHTMLTokenizer = function() { WebInspector.SourceTokenizer.call(this); + // The order is determined by the generated code. this._lexConditions = { INITIAL: 0, COMMENT: 1, - DSTRING: 2, - SSTRING: 3 + DOCTYPE: 2, + TAG: 3, + DSTRING: 4, + SSTRING: 5 }; + this.case_INITIAL = 1000; + this.case_COMMENT = 1001; + this.case_DOCTYPE = 1002; + this.case_TAG = 1003; + this.case_DSTRING = 1004; + this.case_SSTRING = 1005; this._parseConditions = { INITIAL: 0, - TAG: 1, - ATTRIBUTE: 2, - ATTRIBUTE_VALUE: 3, - SCRIPT: 4, - SCRIPT_ATTRIBUTE: 5, - SCRIPT_ATTRIBUTE_VALUE: 6, - DOCTYPE: 7 + ATTRIBUTE: 1, + ATTRIBUTE_VALUE: 2, + LINKIFY: 4, + A_NODE: 8, + SCRIPT: 16 }; - this.case_INITIAL = 1000; - this.case_COMMENT = 1001; - this.case_DSTRING = 1002; - this.case_SSTRING = 1003; - this.initialCondition = { lexCondition: this._lexConditions.INITIAL, parseCondition: this._parseConditions.INITIAL }; } WebInspector.SourceHTMLTokenizer.prototype = { - _isAttribute: function() + _isExpectingAttribute: function() { - return this._parseCondition === this._parseConditions.ATTRIBUTE || this._parseCondition === this._parseConditions.SCRIPT_ATTRIBUTE; + return this._parseCondition & this._parseConditions.ATTRIBUTE; }, - _isAttributeValue: function() + _isExpectingAttributeValue: function() { - return this._parseCondition === this._parseConditions.ATTRIBUTE_VALUE || this._parseCondition === this._parseConditions.SCRIPT_ATTRIBUTE_VALUE; + return this._parseCondition & this._parseConditions.ATTRIBUTE_VALUE; }, - _setAttributeValue: function() + _setExpectingAttribute: function() { - if (this._parseCondition === this._parseConditions.ATTRIBUTE) - this._parseCondition = this._parseConditions.ATTRIBUTE_VALUE; - else if (this._parseCondition === this._parseConditions.SCRIPT_ATTRIBUTE) - this._parseCondition = this._parseConditions.SCRIPT_ATTRIBUTE_VALUE; + if (this._isExpectingAttributeValue()) + this._parseCondition ^= this._parseConditions.ATTRIBUTE_VALUE; + this._parseCondition |= this._parseConditions.ATTRIBUTE; }, - _setAttribute: function() + _setExpectingAttributeValue: function() { - if (this._parseCondition === this._parseConditions.ATTRIBUTE_VALUE) - this._parseCondition = this._parseConditions.ATTRIBUTE; - else if (this._parseCondition === this._parseConditions.SCRIPT_ATTRIBUTE_VALUE) - this._parseCondition = this._parseConditions.SCRIPT_ATTRIBUTE; + if (this._isExpectingAttribute()) + this._parseCondition ^= this._parseConditions.ATTRIBUTE; + this._parseCondition |= this._parseConditions.ATTRIBUTE_VALUE; }, _stringToken: function(cursor, stringEnds) { - if (this._isAttributeValue()) { - this.tokenType = "html-attr-value"; - if (stringEnds) - this._setAttribute(); - } else if (this._parseCondition === this._parseConditions.DOCTYPE) - this.tokenType = "html-doctype"; - else + if (!this._isExpectingAttributeValue()) { this.tokenType = null; + return cursor; + } + this.tokenType = this._attrValueTokenType(); + if (stringEnds) + this._setExpectingAttribute(); return cursor; }, + _attrValueTokenType: function() + { + if (this._parseCondition & this._parseConditions.LINKIFY) { + if (this._parseCondition & this._parseConditions.A_NODE) + return "html-external-link"; + return "html-resource-link"; + } + return "html-attribute-value"; + }, + nextToken: function(cursor) { var cursorOnEnter = cursor; @@ -122,17 +131,25 @@ WebInspector.SourceHTMLTokenizer.prototype = { { case 1: var yych; var yyaccept = 0; - if (this.getLexCondition() < 2) { + if (this.getLexCondition() < 3) { if (this.getLexCondition() < 1) { { gotoCase = this.case_INITIAL; continue; }; } else { - { gotoCase = this.case_COMMENT; continue; }; + if (this.getLexCondition() < 2) { + { gotoCase = this.case_COMMENT; continue; }; + } else { + { gotoCase = this.case_DOCTYPE; continue; }; + } } } else { - if (this.getLexCondition() < 3) { - { gotoCase = this.case_DSTRING; continue; }; + if (this.getLexCondition() < 4) { + { gotoCase = this.case_TAG; continue; }; } else { - { gotoCase = this.case_SSTRING; continue; }; + if (this.getLexCondition() < 5) { + { gotoCase = this.case_DSTRING; continue; }; + } else { + { gotoCase = this.case_SSTRING; continue; }; + } } } /* *********************************** */ @@ -193,393 +210,438 @@ case 12: { gotoCase = 5; continue; }; } /* *********************************** */ -case this.case_DSTRING: +case this.case_DOCTYPE: yych = this._charAt(cursor); if (yych <= '\f') { if (yych == '\n') { gotoCase = 18; continue; }; { gotoCase = 17; continue; }; } else { if (yych <= '\r') { gotoCase = 18; continue; }; - if (yych == '"') { gotoCase = 20; continue; }; + if (yych == '>') { gotoCase = 20; continue; }; { gotoCase = 17; continue; }; } case 16: - { return this._stringToken(cursor); } + { this.tokenType = "html-doctype"; return cursor; } case 17: yych = this._charAt(++cursor); - { gotoCase = 24; continue; }; + { gotoCase = 23; continue; }; case 18: ++cursor; { this.tokenType = null; return cursor; } case 20: ++cursor; -case 21: this.setLexCondition(this._lexConditions.INITIAL); - { return this._stringToken(cursor, true); } + { this.tokenType = "html-doctype"; return cursor; } case 22: - yych = this._charAt(++cursor); - { gotoCase = 21; continue; }; -case 23: ++cursor; yych = this._charAt(cursor); -case 24: +case 23: if (yych <= '\f') { if (yych == '\n') { gotoCase = 16; continue; }; - { gotoCase = 23; continue; }; + { gotoCase = 22; continue; }; } else { if (yych <= '\r') { gotoCase = 16; continue; }; - if (yych == '"') { gotoCase = 22; continue; }; - { gotoCase = 23; continue; }; + if (yych == '>') { gotoCase = 16; continue; }; + { gotoCase = 22; continue; }; } /* *********************************** */ -case this.case_INITIAL: +case this.case_DSTRING: yych = this._charAt(cursor); - if (yych <= '=') { - if (yych <= '\'') { - if (yych == '"') { gotoCase = 29; continue; }; - if (yych >= '\'') { gotoCase = 30; continue; }; - } else { - if (yych <= '9') { - if (yych >= '0') { gotoCase = 31; continue; }; - } else { - if (yych <= ';') { gotoCase = 27; continue; }; - if (yych <= '<') { gotoCase = 33; continue; }; - { gotoCase = 35; continue; }; - } - } + if (yych <= '\f') { + if (yych == '\n') { gotoCase = 28; continue; }; + { gotoCase = 27; continue; }; } else { - if (yych <= '^') { - if (yych <= '>') { gotoCase = 37; continue; }; - if (yych <= '@') { gotoCase = 27; continue; }; - if (yych <= 'Z') { gotoCase = 31; continue; }; - } else { - if (yych <= '`') { - if (yych <= '_') { gotoCase = 31; continue; }; - } else { - if (yych <= 'z') { gotoCase = 31; continue; }; - if (yych >= 0x80) { gotoCase = 31; continue; }; - } - } + if (yych <= '\r') { gotoCase = 28; continue; }; + if (yych == '"') { gotoCase = 30; continue; }; + { gotoCase = 27; continue; }; } +case 26: + { return this._stringToken(cursor); } case 27: - ++cursor; + yych = this._charAt(++cursor); + { gotoCase = 34; continue; }; case 28: + ++cursor; { this.tokenType = null; return cursor; } -case 29: - yyaccept = 0; - yych = this._charAt(YYMARKER = ++cursor); - { gotoCase = 82; continue; }; case 30: - yyaccept = 0; - yych = this._charAt(YYMARKER = ++cursor); - { gotoCase = 76; continue; }; -case 31: ++cursor; - yych = this._charAt(cursor); - { gotoCase = 74; continue; }; +case 31: + this.setLexCondition(this._lexConditions.TAG); + { return this._stringToken(cursor, true); } case 32: - { - if (this._parseCondition === this._parseConditions.SCRIPT) { - this.tokenType = null; - return cursor; - } - - if (this._parseCondition === this._parseConditions.TAG) { - this.tokenType = "html-tag"; - this._parseCondition = this._parseConditions.ATTRIBUTE; - } else if (this._isAttribute()) - this.tokenType = "html-attr-name"; - else if (this._isAttributeValue()) - this.tokenType = "html-attr-value"; - else if (this._parseCondition === this._parseConditions.DOCTYPE) - this.tokenType = "html-doctype"; - else - this.tokenType = null; - return cursor; - } + yych = this._charAt(++cursor); + { gotoCase = 31; continue; }; case 33: - yyaccept = 1; + ++cursor; + yych = this._charAt(cursor); +case 34: + if (yych <= '\f') { + if (yych == '\n') { gotoCase = 26; continue; }; + { gotoCase = 33; continue; }; + } else { + if (yych <= '\r') { gotoCase = 26; continue; }; + if (yych == '"') { gotoCase = 32; continue; }; + { gotoCase = 33; continue; }; + } +/* *********************************** */ +case this.case_INITIAL: + yych = this._charAt(cursor); + if (yych == '<') { gotoCase = 39; continue; }; + ++cursor; + { this.tokenType = null; return cursor; } +case 39: + yyaccept = 0; yych = this._charAt(YYMARKER = ++cursor); if (yych <= '/') { - if (yych == '!') { gotoCase = 42; continue; }; - if (yych >= '/') { gotoCase = 39; continue; }; + if (yych == '!') { gotoCase = 44; continue; }; + if (yych >= '/') { gotoCase = 41; continue; }; } else { if (yych <= 'S') { - if (yych >= 'S') { gotoCase = 40; continue; }; + if (yych >= 'S') { gotoCase = 42; continue; }; } else { - if (yych == 's') { gotoCase = 40; continue; }; + if (yych == 's') { gotoCase = 42; continue; }; } } -case 34: +case 40: + this.setLexCondition(this._lexConditions.TAG); { - if (this._parseCondition === this._parseConditions.SCRIPT) { + if (this._parseCondition & this._parseConditions.SCRIPT) { + // Do not tokenize script tag contents, keep lexer state although processing "<". + this.setLexCondition(this._lexConditions.INITIAL); this.tokenType = null; return cursor; } + this._parseCondition = this._parseConditions.INITIAL; this.tokenType = "html-tag"; - this._parseCondition = this._parseConditions.TAG; - return cursor; - } -case 35: - ++cursor; - { - if (this._isAttribute()) { - this.tokenType = null; - this._setAttributeValue(); - } else if (this._parseCondition === this._parseConditions.DOCTYPE) - this.tokenType = "html-doctype"; - else - this.tokenType = null; - return cursor; - } -case 37: - ++cursor; - { - if (this._parseCondition === this._parseConditions.SCRIPT) { - this.tokenType = null; - return cursor; - } - - if (this._parseCondition === this._parseConditions.DOCTYPE) - this.tokenType = "html-doctype"; - else - this.tokenType = "html-tag"; - - if (this._parseCondition === this._parseConditions.SCRIPT_ATTRIBUTE) - this._parseCondition = this._parseConditions.SCRIPT; - else - this._parseCondition = this._parseConditions.INITIAL; return cursor; } -case 39: - yyaccept = 1; +case 41: + yyaccept = 0; yych = this._charAt(YYMARKER = ++cursor); - if (yych == 'S') { gotoCase = 66; continue; }; - if (yych == 's') { gotoCase = 66; continue; }; - { gotoCase = 34; continue; }; -case 40: + if (yych == 'S') { gotoCase = 68; continue; }; + if (yych == 's') { gotoCase = 68; continue; }; + { gotoCase = 40; continue; }; +case 42: yych = this._charAt(++cursor); - if (yych == 'C') { gotoCase = 60; continue; }; - if (yych == 'c') { gotoCase = 60; continue; }; -case 41: + if (yych == 'C') { gotoCase = 62; continue; }; + if (yych == 'c') { gotoCase = 62; continue; }; +case 43: cursor = YYMARKER; - if (yyaccept <= 0) { - { gotoCase = 28; continue; }; - } else { - { gotoCase = 34; continue; }; - } -case 42: + { gotoCase = 40; continue; }; +case 44: yych = this._charAt(++cursor); if (yych <= 'C') { - if (yych != '-') { gotoCase = 41; continue; }; + if (yych != '-') { gotoCase = 43; continue; }; } else { - if (yych <= 'D') { gotoCase = 44; continue; }; - if (yych == 'd') { gotoCase = 44; continue; }; - { gotoCase = 41; continue; }; + if (yych <= 'D') { gotoCase = 46; continue; }; + if (yych == 'd') { gotoCase = 46; continue; }; + { gotoCase = 43; continue; }; } yych = this._charAt(++cursor); - if (yych == '-') { gotoCase = 52; continue; }; - { gotoCase = 41; continue; }; -case 44: - yych = this._charAt(++cursor); - if (yych == 'O') { gotoCase = 45; continue; }; - if (yych != 'o') { gotoCase = 41; continue; }; -case 45: - yych = this._charAt(++cursor); - if (yych == 'C') { gotoCase = 46; continue; }; - if (yych != 'c') { gotoCase = 41; continue; }; + if (yych == '-') { gotoCase = 54; continue; }; + { gotoCase = 43; continue; }; case 46: yych = this._charAt(++cursor); - if (yych == 'T') { gotoCase = 47; continue; }; - if (yych != 't') { gotoCase = 41; continue; }; + if (yych == 'O') { gotoCase = 47; continue; }; + if (yych != 'o') { gotoCase = 43; continue; }; case 47: yych = this._charAt(++cursor); - if (yych == 'Y') { gotoCase = 48; continue; }; - if (yych != 'y') { gotoCase = 41; continue; }; + if (yych == 'C') { gotoCase = 48; continue; }; + if (yych != 'c') { gotoCase = 43; continue; }; case 48: yych = this._charAt(++cursor); - if (yych == 'P') { gotoCase = 49; continue; }; - if (yych != 'p') { gotoCase = 41; continue; }; + if (yych == 'T') { gotoCase = 49; continue; }; + if (yych != 't') { gotoCase = 43; continue; }; case 49: yych = this._charAt(++cursor); - if (yych == 'E') { gotoCase = 50; continue; }; - if (yych != 'e') { gotoCase = 41; continue; }; + if (yych == 'Y') { gotoCase = 50; continue; }; + if (yych != 'y') { gotoCase = 43; continue; }; case 50: - ++cursor; - { - this.tokenType = "html-doctype"; - this._parseCondition = this._parseConditions.DOCTYPE; - return cursor; - } + yych = this._charAt(++cursor); + if (yych == 'P') { gotoCase = 51; continue; }; + if (yych != 'p') { gotoCase = 43; continue; }; +case 51: + yych = this._charAt(++cursor); + if (yych == 'E') { gotoCase = 52; continue; }; + if (yych != 'e') { gotoCase = 43; continue; }; case 52: ++cursor; + this.setLexCondition(this._lexConditions.DOCTYPE); + { this.tokenType = "html-doctype"; return cursor; } +case 54: + ++cursor; yych = this._charAt(cursor); if (yych <= '\f') { - if (yych == '\n') { gotoCase = 55; continue; }; - { gotoCase = 52; continue; }; + if (yych == '\n') { gotoCase = 57; continue; }; + { gotoCase = 54; continue; }; } else { - if (yych <= '\r') { gotoCase = 55; continue; }; - if (yych != '-') { gotoCase = 52; continue; }; + if (yych <= '\r') { gotoCase = 57; continue; }; + if (yych != '-') { gotoCase = 54; continue; }; } ++cursor; yych = this._charAt(cursor); - if (yych == '-') { gotoCase = 57; continue; }; - { gotoCase = 41; continue; }; -case 55: + if (yych == '-') { gotoCase = 59; continue; }; + { gotoCase = 43; continue; }; +case 57: ++cursor; this.setLexCondition(this._lexConditions.COMMENT); { this.tokenType = "html-comment"; return cursor; } -case 57: +case 59: ++cursor; yych = this._charAt(cursor); - if (yych != '>') { gotoCase = 52; continue; }; + if (yych != '>') { gotoCase = 54; continue; }; ++cursor; { this.tokenType = "html-comment"; return cursor; } -case 60: - yych = this._charAt(++cursor); - if (yych == 'R') { gotoCase = 61; continue; }; - if (yych != 'r') { gotoCase = 41; continue; }; -case 61: - yych = this._charAt(++cursor); - if (yych == 'I') { gotoCase = 62; continue; }; - if (yych != 'i') { gotoCase = 41; continue; }; case 62: yych = this._charAt(++cursor); - if (yych == 'P') { gotoCase = 63; continue; }; - if (yych != 'p') { gotoCase = 41; continue; }; + if (yych == 'R') { gotoCase = 63; continue; }; + if (yych != 'r') { gotoCase = 43; continue; }; case 63: yych = this._charAt(++cursor); - if (yych == 'T') { gotoCase = 64; continue; }; - if (yych != 't') { gotoCase = 41; continue; }; + if (yych == 'I') { gotoCase = 64; continue; }; + if (yych != 'i') { gotoCase = 43; continue; }; case 64: + yych = this._charAt(++cursor); + if (yych == 'P') { gotoCase = 65; continue; }; + if (yych != 'p') { gotoCase = 43; continue; }; +case 65: + yych = this._charAt(++cursor); + if (yych == 'T') { gotoCase = 66; continue; }; + if (yych != 't') { gotoCase = 43; continue; }; +case 66: ++cursor; + this.setLexCondition(this._lexConditions.TAG); { this.tokenType = "html-tag"; - this._parseCondition = this._parseConditions.SCRIPT_ATTRIBUTE; + this._parseCondition = this._parseConditions.SCRIPT; + this._setExpectingAttribute(); return cursor; } -case 66: - yych = this._charAt(++cursor); - if (yych == 'C') { gotoCase = 67; continue; }; - if (yych != 'c') { gotoCase = 41; continue; }; -case 67: - yych = this._charAt(++cursor); - if (yych == 'R') { gotoCase = 68; continue; }; - if (yych != 'r') { gotoCase = 41; continue; }; case 68: yych = this._charAt(++cursor); - if (yych == 'I') { gotoCase = 69; continue; }; - if (yych != 'i') { gotoCase = 41; continue; }; + if (yych == 'C') { gotoCase = 69; continue; }; + if (yych != 'c') { gotoCase = 43; continue; }; case 69: yych = this._charAt(++cursor); - if (yych == 'P') { gotoCase = 70; continue; }; - if (yych != 'p') { gotoCase = 41; continue; }; + if (yych == 'R') { gotoCase = 70; continue; }; + if (yych != 'r') { gotoCase = 43; continue; }; case 70: yych = this._charAt(++cursor); - if (yych == 'T') { gotoCase = 71; continue; }; - if (yych != 't') { gotoCase = 41; continue; }; + if (yych == 'I') { gotoCase = 71; continue; }; + if (yych != 'i') { gotoCase = 43; continue; }; case 71: + yych = this._charAt(++cursor); + if (yych == 'P') { gotoCase = 72; continue; }; + if (yych != 'p') { gotoCase = 43; continue; }; +case 72: + yych = this._charAt(++cursor); + if (yych == 'T') { gotoCase = 73; continue; }; + if (yych != 't') { gotoCase = 43; continue; }; +case 73: ++cursor; + this.setLexCondition(this._lexConditions.TAG); { this.tokenType = "html-tag"; this._parseCondition = this._parseConditions.INITIAL; return cursor; } -case 73: +/* *********************************** */ +case this.case_SSTRING: + yych = this._charAt(cursor); + if (yych <= '\f') { + if (yych == '\n') { gotoCase = 79; continue; }; + { gotoCase = 78; continue; }; + } else { + if (yych <= '\r') { gotoCase = 79; continue; }; + if (yych == '\'') { gotoCase = 81; continue; }; + { gotoCase = 78; continue; }; + } +case 77: + { return this._stringToken(cursor); } +case 78: + yych = this._charAt(++cursor); + { gotoCase = 85; continue; }; +case 79: + ++cursor; + { this.tokenType = null; return cursor; } +case 81: + ++cursor; +case 82: + this.setLexCondition(this._lexConditions.TAG); + { return this._stringToken(cursor, true); } +case 83: + yych = this._charAt(++cursor); + { gotoCase = 82; continue; }; +case 84: ++cursor; yych = this._charAt(cursor); -case 74: - if (yych <= '^') { - if (yych <= '9') { - if (yych <= '/') { gotoCase = 32; continue; }; - { gotoCase = 73; continue; }; +case 85: + if (yych <= '\f') { + if (yych == '\n') { gotoCase = 77; continue; }; + { gotoCase = 84; continue; }; + } else { + if (yych <= '\r') { gotoCase = 77; continue; }; + if (yych == '\'') { gotoCase = 83; continue; }; + { gotoCase = 84; continue; }; + } +/* *********************************** */ +case this.case_TAG: + yych = this._charAt(cursor); + if (yych <= '&') { + if (yych <= '\r') { + if (yych == '\n') { gotoCase = 90; continue; }; + if (yych >= '\r') { gotoCase = 90; continue; }; } else { - if (yych <= '@') { gotoCase = 32; continue; }; - if (yych <= 'Z') { gotoCase = 73; continue; }; - { gotoCase = 32; continue; }; + if (yych <= ' ') { + if (yych >= ' ') { gotoCase = 90; continue; }; + } else { + if (yych == '"') { gotoCase = 92; continue; }; + } } } else { - if (yych <= '`') { - if (yych <= '_') { gotoCase = 73; continue; }; - { gotoCase = 32; continue; }; + if (yych <= '>') { + if (yych <= ';') { + if (yych <= '\'') { gotoCase = 93; continue; }; + } else { + if (yych <= '<') { gotoCase = 90; continue; }; + if (yych <= '=') { gotoCase = 94; continue; }; + { gotoCase = 96; continue; }; + } } else { - if (yych <= 'z') { gotoCase = 73; continue; }; - if (yych <= 0x7F) { gotoCase = 32; continue; }; - { gotoCase = 73; continue; }; + if (yych <= '[') { + if (yych >= '[') { gotoCase = 90; continue; }; + } else { + if (yych == ']') { gotoCase = 90; continue; }; + } } } -case 75: ++cursor; yych = this._charAt(cursor); -case 76: + { gotoCase = 109; continue; }; +case 89: + { + if (this._parseCondition === this._parseConditions.SCRIPT) { + // Fall through if expecting attributes. + this.tokenType = null; + return cursor; + } + + if (this._parseCondition === this._parseConditions.INITIAL) { + this.tokenType = "html-tag"; + this._setExpectingAttribute(); + var token = this._line.substring(cursorOnEnter, cursor); + if (token === "a") + this._parseCondition |= this._parseConditions.A_NODE; + else if (this._parseCondition & this._parseConditions.A_NODE) + this._parseCondition ^= this._parseConditions.A_NODE; + } else if (this._isExpectingAttribute()) { + var token = this._line.substring(cursorOnEnter, cursor); + if (token === "href" || token === "src") + this._parseCondition |= this._parseConditions.LINKIFY; + else if (this._parseCondition |= this._parseConditions.LINKIFY) + this._parseCondition ^= this._parseConditions.LINKIFY; + this.tokenType = "html-attribute-name"; + } else if (this._isExpectingAttributeValue()) + this.tokenType = this._attrValueTokenType(); + else + this.tokenType = null; + return cursor; + } +case 90: + ++cursor; + { this.tokenType = null; return cursor; } +case 92: + yyaccept = 0; + yych = this._charAt(YYMARKER = ++cursor); + { gotoCase = 105; continue; }; +case 93: + yyaccept = 0; + yych = this._charAt(YYMARKER = ++cursor); + { gotoCase = 99; continue; }; +case 94: + ++cursor; + { + if (this._isExpectingAttribute()) + this._setExpectingAttributeValue(); + this.tokenType = null; + return cursor; + } +case 96: + ++cursor; + this.setLexCondition(this._lexConditions.INITIAL); + { + if (this._parseCondition & this._parseConditions.SCRIPT) { + // Do not tokenize script tag contents. + this.tokenType = null; + return cursor; + } + + this._parseCondition = this._parseConditions.INITIAL; + this.tokenType = "html-tag"; + return cursor; + } +case 98: + ++cursor; + yych = this._charAt(cursor); +case 99: if (yych <= '\f') { - if (yych != '\n') { gotoCase = 75; continue; }; + if (yych != '\n') { gotoCase = 98; continue; }; } else { - if (yych <= '\r') { gotoCase = 77; continue; }; - if (yych == '\'') { gotoCase = 79; continue; }; - { gotoCase = 75; continue; }; + if (yych <= '\r') { gotoCase = 100; continue; }; + if (yych == '\'') { gotoCase = 102; continue; }; + { gotoCase = 98; continue; }; } -case 77: +case 100: ++cursor; this.setLexCondition(this._lexConditions.SSTRING); { return this._stringToken(cursor); } -case 79: +case 102: ++cursor; { return this._stringToken(cursor, true); } -case 81: +case 104: ++cursor; yych = this._charAt(cursor); -case 82: +case 105: if (yych <= '\f') { - if (yych != '\n') { gotoCase = 81; continue; }; + if (yych != '\n') { gotoCase = 104; continue; }; } else { - if (yych <= '\r') { gotoCase = 83; continue; }; - if (yych == '"') { gotoCase = 79; continue; }; - { gotoCase = 81; continue; }; + if (yych <= '\r') { gotoCase = 106; continue; }; + if (yych == '"') { gotoCase = 102; continue; }; + { gotoCase = 104; continue; }; } -case 83: +case 106: ++cursor; this.setLexCondition(this._lexConditions.DSTRING); { return this._stringToken(cursor); } -/* *********************************** */ -case this.case_SSTRING: - yych = this._charAt(cursor); - if (yych <= '\f') { - if (yych == '\n') { gotoCase = 89; continue; }; - { gotoCase = 88; continue; }; - } else { - if (yych <= '\r') { gotoCase = 89; continue; }; - if (yych == '\'') { gotoCase = 91; continue; }; - { gotoCase = 88; continue; }; - } -case 87: - { return this._stringToken(cursor); } -case 88: - yych = this._charAt(++cursor); - { gotoCase = 95; continue; }; -case 89: - ++cursor; - { this.tokenType = null; return cursor; } -case 91: - ++cursor; -case 92: - this.setLexCondition(this._lexConditions.INITIAL); - { return this._stringToken(cursor, true); } -case 93: - yych = this._charAt(++cursor); - { gotoCase = 92; continue; }; -case 94: +case 108: ++cursor; yych = this._charAt(cursor); -case 95: - if (yych <= '\f') { - if (yych == '\n') { gotoCase = 87; continue; }; - { gotoCase = 94; continue; }; +case 109: + if (yych <= '"') { + if (yych <= '\r') { + if (yych == '\n') { gotoCase = 89; continue; }; + if (yych <= '\f') { gotoCase = 108; continue; }; + { gotoCase = 89; continue; }; + } else { + if (yych == ' ') { gotoCase = 89; continue; }; + if (yych <= '!') { gotoCase = 108; continue; }; + { gotoCase = 89; continue; }; + } } else { - if (yych <= '\r') { gotoCase = 87; continue; }; - if (yych == '\'') { gotoCase = 93; continue; }; - { gotoCase = 94; continue; }; + if (yych <= '>') { + if (yych == '\'') { gotoCase = 89; continue; }; + if (yych <= ';') { gotoCase = 108; continue; }; + { gotoCase = 89; continue; }; + } else { + if (yych <= '[') { + if (yych <= 'Z') { gotoCase = 108; continue; }; + { gotoCase = 89; continue; }; + } else { + if (yych == ']') { gotoCase = 89; continue; }; + { gotoCase = 108; continue; }; + } + } } } diff --git a/WebCore/inspector/front-end/SourceHTMLTokenizer.re2js b/WebCore/inspector/front-end/SourceHTMLTokenizer.re2js index e56f3ff..89c535a 100644 --- a/WebCore/inspector/front-end/SourceHTMLTokenizer.re2js +++ b/WebCore/inspector/front-end/SourceHTMLTokenizer.re2js @@ -44,72 +44,81 @@ WebInspector.SourceHTMLTokenizer = function() { WebInspector.SourceTokenizer.call(this); + // The order is determined by the generated code. this._lexConditions = { INITIAL: 0, COMMENT: 1, - DSTRING: 2, - SSTRING: 3 + DOCTYPE: 2, + TAG: 3, + DSTRING: 4, + SSTRING: 5 }; + this.case_INITIAL = 1000; + this.case_COMMENT = 1001; + this.case_DOCTYPE = 1002; + this.case_TAG = 1003; + this.case_DSTRING = 1004; + this.case_SSTRING = 1005; this._parseConditions = { INITIAL: 0, - TAG: 1, - ATTRIBUTE: 2, - ATTRIBUTE_VALUE: 3, - SCRIPT: 4, - SCRIPT_ATTRIBUTE: 5, - SCRIPT_ATTRIBUTE_VALUE: 6, - DOCTYPE: 7 + ATTRIBUTE: 1, + ATTRIBUTE_VALUE: 2, + LINKIFY: 4, + A_NODE: 8, + SCRIPT: 16 }; - this.case_INITIAL = 1000; - this.case_COMMENT = 1001; - this.case_DSTRING = 1002; - this.case_SSTRING = 1003; - this.initialCondition = { lexCondition: this._lexConditions.INITIAL, parseCondition: this._parseConditions.INITIAL }; } WebInspector.SourceHTMLTokenizer.prototype = { - _isAttribute: function() + _isExpectingAttribute: function() { - return this._parseCondition === this._parseConditions.ATTRIBUTE || this._parseCondition === this._parseConditions.SCRIPT_ATTRIBUTE; + return this._parseCondition & this._parseConditions.ATTRIBUTE; }, - _isAttributeValue: function() + _isExpectingAttributeValue: function() { - return this._parseCondition === this._parseConditions.ATTRIBUTE_VALUE || this._parseCondition === this._parseConditions.SCRIPT_ATTRIBUTE_VALUE; + return this._parseCondition & this._parseConditions.ATTRIBUTE_VALUE; }, - _setAttributeValue: function() + _setExpectingAttribute: function() { - if (this._parseCondition === this._parseConditions.ATTRIBUTE) - this._parseCondition = this._parseConditions.ATTRIBUTE_VALUE; - else if (this._parseCondition === this._parseConditions.SCRIPT_ATTRIBUTE) - this._parseCondition = this._parseConditions.SCRIPT_ATTRIBUTE_VALUE; + if (this._isExpectingAttributeValue()) + this._parseCondition ^= this._parseConditions.ATTRIBUTE_VALUE; + this._parseCondition |= this._parseConditions.ATTRIBUTE; }, - _setAttribute: function() + _setExpectingAttributeValue: function() { - if (this._parseCondition === this._parseConditions.ATTRIBUTE_VALUE) - this._parseCondition = this._parseConditions.ATTRIBUTE; - else if (this._parseCondition === this._parseConditions.SCRIPT_ATTRIBUTE_VALUE) - this._parseCondition = this._parseConditions.SCRIPT_ATTRIBUTE; + if (this._isExpectingAttribute()) + this._parseCondition ^= this._parseConditions.ATTRIBUTE; + this._parseCondition |= this._parseConditions.ATTRIBUTE_VALUE; }, _stringToken: function(cursor, stringEnds) { - if (this._isAttributeValue()) { - this.tokenType = "html-attr-value"; - if (stringEnds) - this._setAttribute(); - } else if (this._parseCondition === this._parseConditions.DOCTYPE) - this.tokenType = "html-doctype"; - else + if (!this._isExpectingAttributeValue()) { this.tokenType = null; + return cursor; + } + this.tokenType = this._attrValueTokenType(); + if (stringEnds) + this._setExpectingAttribute(); return cursor; }, + _attrValueTokenType: function() + { + if (this._parseCondition & this._parseConditions.LINKIFY) { + if (this._parseCondition & this._parseConditions.A_NODE) + return "html-external-link"; + return "html-resource-link"; + } + return "html-attribute-value"; + }, + nextToken: function(cursor) { var cursorOnEnter = cursor; @@ -134,7 +143,9 @@ WebInspector.SourceHTMLTokenizer.prototype = { CommentStart = "<!--" CommentContent [\r\n]; CommentEnd = CommentContent "-->"; - DocTypeLT = "<!" [Dd] [Oo] [Cc] [Tt] [Yy] [Pp] [Ee]; + DocTypeStart = "<!" [Dd] [Oo] [Cc] [Tt] [Yy] [Pp] [Ee]; + DocTypeContent = [^\r\n>]*; + ScriptStart = "<" [Ss] [Cc] [Rr] [Ii] [Pp] [Tt]; ScriptEnd = "</" [Ss] [Cc] [Rr] [Ii] [Pp] [Tt]; @@ -150,101 +161,100 @@ WebInspector.SourceHTMLTokenizer.prototype = { SingleStringStart = "'" SingleStringContent [\r\n]; SingleStringEnd = SingleStringContent "'"; - Identifier = [_a-zA-Z0-9\x80-\xFF]+; + Identifier = [^ \r\n"'<>\[\]=]+; <INITIAL> Comment { this.tokenType = "html-comment"; return cursor; } <INITIAL> CommentStart => COMMENT { this.tokenType = "html-comment"; return cursor; } <COMMENT> CommentContent => COMMENT { this.tokenType = "html-comment"; return cursor; } <COMMENT> CommentEnd => INITIAL { this.tokenType = "html-comment"; return cursor; } - <INITIAL> DocTypeLT => INITIAL - { - this.tokenType = "html-doctype"; - this._parseCondition = this._parseConditions.DOCTYPE; - return cursor; - } + <INITIAL> DocTypeStart => DOCTYPE { this.tokenType = "html-doctype"; return cursor; } + <DOCTYPE> DocTypeContent => DOCTYPE { this.tokenType = "html-doctype"; return cursor; } + <DOCTYPE> GT => INITIAL { this.tokenType = "html-doctype"; return cursor; } - <INITIAL> ScriptStart => INITIAL + <INITIAL> ScriptStart => TAG { this.tokenType = "html-tag"; - this._parseCondition = this._parseConditions.SCRIPT_ATTRIBUTE; + this._parseCondition = this._parseConditions.SCRIPT; + this._setExpectingAttribute(); return cursor; } - <INITIAL> ScriptEnd => INITIAL + <INITIAL> ScriptEnd => TAG { this.tokenType = "html-tag"; this._parseCondition = this._parseConditions.INITIAL; return cursor; } - <INITIAL> LT => INITIAL + <INITIAL> LT => TAG { - if (this._parseCondition === this._parseConditions.SCRIPT) { + if (this._parseCondition & this._parseConditions.SCRIPT) { + // Do not tokenize script tag contents, keep lexer state although processing "<". + this.setLexCondition(this._lexConditions.INITIAL); this.tokenType = null; return cursor; } + this._parseCondition = this._parseConditions.INITIAL; this.tokenType = "html-tag"; - this._parseCondition = this._parseConditions.TAG; return cursor; } - <INITIAL> GT => INITIAL + <TAG> GT => INITIAL { - if (this._parseCondition === this._parseConditions.SCRIPT) { + if (this._parseCondition & this._parseConditions.SCRIPT) { + // Do not tokenize script tag contents. this.tokenType = null; return cursor; } - if (this._parseCondition === this._parseConditions.DOCTYPE) - this.tokenType = "html-doctype"; - else - this.tokenType = "html-tag"; - - if (this._parseCondition === this._parseConditions.SCRIPT_ATTRIBUTE) - this._parseCondition = this._parseConditions.SCRIPT; - else - this._parseCondition = this._parseConditions.INITIAL; + this._parseCondition = this._parseConditions.INITIAL; + this.tokenType = "html-tag"; return cursor; } - <INITIAL> StringLiteral { return this._stringToken(cursor, true); } - <INITIAL> DoubleStringStart => DSTRING { return this._stringToken(cursor); } + <TAG> StringLiteral { return this._stringToken(cursor, true); } + <TAG> DoubleStringStart => DSTRING { return this._stringToken(cursor); } <DSTRING> DoubleStringContent => DSTRING { return this._stringToken(cursor); } - <DSTRING> DoubleStringEnd => INITIAL { return this._stringToken(cursor, true); } - <INITIAL> SingleStringStart => SSTRING { return this._stringToken(cursor); } + <DSTRING> DoubleStringEnd => TAG { return this._stringToken(cursor, true); } + <TAG> SingleStringStart => SSTRING { return this._stringToken(cursor); } <SSTRING> SingleStringContent => SSTRING { return this._stringToken(cursor); } - <SSTRING> SingleStringEnd => INITIAL { return this._stringToken(cursor, true); } + <SSTRING> SingleStringEnd => TAG { return this._stringToken(cursor, true); } - <INITIAL> EqualSign => INITIAL + <TAG> EqualSign => TAG { - if (this._isAttribute()) { - this.tokenType = null; - this._setAttributeValue(); - } else if (this._parseCondition === this._parseConditions.DOCTYPE) - this.tokenType = "html-doctype"; - else - this.tokenType = null; + if (this._isExpectingAttribute()) + this._setExpectingAttributeValue(); + this.tokenType = null; return cursor; } - <INITIAL> Identifier + <TAG> Identifier { if (this._parseCondition === this._parseConditions.SCRIPT) { + // Fall through if expecting attributes. this.tokenType = null; return cursor; } - if (this._parseCondition === this._parseConditions.TAG) { + if (this._parseCondition === this._parseConditions.INITIAL) { this.tokenType = "html-tag"; - this._parseCondition = this._parseConditions.ATTRIBUTE; - } else if (this._isAttribute()) - this.tokenType = "html-attr-name"; - else if (this._isAttributeValue()) - this.tokenType = "html-attr-value"; - else if (this._parseCondition === this._parseConditions.DOCTYPE) - this.tokenType = "html-doctype"; + this._setExpectingAttribute(); + var token = this._line.substring(cursorOnEnter, cursor); + if (token === "a") + this._parseCondition |= this._parseConditions.A_NODE; + else if (this._parseCondition & this._parseConditions.A_NODE) + this._parseCondition ^= this._parseConditions.A_NODE; + } else if (this._isExpectingAttribute()) { + var token = this._line.substring(cursorOnEnter, cursor); + if (token === "href" || token === "src") + this._parseCondition |= this._parseConditions.LINKIFY; + else if (this._parseCondition |= this._parseConditions.LINKIFY) + this._parseCondition ^= this._parseConditions.LINKIFY; + this.tokenType = "html-attribute-name"; + } else if (this._isExpectingAttributeValue()) + this.tokenType = this._attrValueTokenType(); else this.tokenType = null; return cursor; diff --git a/WebCore/inspector/front-end/SourceView.js b/WebCore/inspector/front-end/SourceView.js index 292b8af..7fc8499 100644 --- a/WebCore/inspector/front-end/SourceView.js +++ b/WebCore/inspector/front-end/SourceView.js @@ -41,7 +41,6 @@ WebInspector.SourceView.prototype = { show: function(parentElement) { WebInspector.ResourceView.prototype.show.call(this, parentElement); - this.setupSourceFrameIfNeeded(); this.sourceFrame.visible = true; this.resize(); }, @@ -79,10 +78,15 @@ WebInspector.SourceView.prototype = { delete this._frameNeedsSetup; WebInspector.getResourceContent(this.resource.identifier, this._contentLoaded.bind(this)); }, - + + contentTabSelected: function() + { + this.setupSourceFrameIfNeeded(); + }, + _contentLoaded: function(content) { - this.sourceFrame.setContent(this.resource.mimeType, content); + this.sourceFrame.setContent(this.resource.mimeType, content, this.resource.url); this._sourceFrameSetupFinished(); }, diff --git a/WebCore/inspector/front-end/TextEditor.js b/WebCore/inspector/front-end/TextEditor.js index afa97c1..9268280 100644 --- a/WebCore/inspector/front-end/TextEditor.js +++ b/WebCore/inspector/front-end/TextEditor.js @@ -35,7 +35,8 @@ WebInspector.TextEditor = function(textModel, platform) this._highlighter = new WebInspector.TextEditorHighlighter(this._textModel, this._highlightChanged.bind(this)); this.element = document.createElement("div"); - this.element.className = "text-editor"; + this.element.className = "text-editor monospace"; + this.element.tabIndex = 0; this._canvas = document.createElement("canvas"); this._canvas.className = "text-editor-canvas"; @@ -43,7 +44,6 @@ WebInspector.TextEditor = function(textModel, platform) this._container = document.createElement("div"); this._container.className = "text-editor-container"; - this._container.tabIndex = 0; this.element.appendChild(this._container); this._sheet = document.createElement("div"); @@ -55,7 +55,6 @@ WebInspector.TextEditor = function(textModel, platform) this._cursor = new WebInspector.TextCursor(cursorElement); this._container.addEventListener("scroll", this._scroll.bind(this), false); - this._sheet.addEventListener("contextmenu", this._contextMenu.bind(this), false); this._registerMouseListeners(); this._registerKeyboardListeners(); @@ -69,9 +68,6 @@ WebInspector.TextEditor = function(textModel, platform) this._selection = new WebInspector.TextSelectionModel(this._selectionChanged.bind(this)); this._isMac = platform && (platform.indexOf("mac") === 0); - - this._initFont(); - this._paintCoalescingLevel = 0; this._registerShortcuts(); @@ -84,6 +80,7 @@ WebInspector.TextEditor = function(textModel, platform) this._lineOffsetsCache = [0]; this._readOnly = false; + this._selectionColor = "rgb(181, 213, 255)"; } WebInspector.TextEditor.prototype = { @@ -152,11 +149,12 @@ WebInspector.TextEditor.prototype = { _registerMouseListeners: function() { - this._sheet.addEventListener("mouseup", this._mouseUp.bind(this), false); - this._sheet.addEventListener("mousedown", this._mouseDown.bind(this), false); - this._sheet.addEventListener("mousemove", this._mouseMove.bind(this), false); - this._sheet.addEventListener("mouseout", this._mouseOut.bind(this), false); - this._sheet.addEventListener("dblclick", this._dblClick.bind(this), false); + this.element.addEventListener("contextmenu", this._contextMenu.bind(this), false); + this.element.addEventListener("mouseup", this._mouseUp.bind(this), false); + this.element.addEventListener("mousedown", this._mouseDown.bind(this), false); + this.element.addEventListener("mousemove", this._mouseMove.bind(this), false); + this.element.addEventListener("mouseout", this._mouseOut.bind(this), false); + this.element.addEventListener("dblclick", this._dblClick.bind(this), false); }, _registerKeyboardListeners: function() @@ -180,7 +178,7 @@ WebInspector.TextEditor.prototype = { if (offset > this._lineOffsetsCache[this._lineOffsetsCache.length - 1]) { // Seeking outside cached area. Fill the cache. var lineNumber = this._lineOffsetsCache.length; - while (this._lineToOffset(lineNumber) < offset) + while (lineNumber < this._textModel.linesCount && this._lineToOffset(lineNumber) < offset) lineNumber++; return lineNumber; } @@ -217,6 +215,10 @@ WebInspector.TextEditor.prototype = { _lineHeight: function(lineNumber) { + // Use cached value first. + if (this._lineOffsetsCache[lineNumber + 1]) + return this._lineOffsetsCache[lineNumber + 1] - this._lineOffsetsCache[lineNumber]; + var element = this._textModel.getAttribute(lineNumber, "div-decoration"); if (element) return 2 * this._textLineHeight + element.clientHeight; @@ -225,6 +227,9 @@ WebInspector.TextEditor.prototype = { reveal: function(line, column) { + this._scrollTop = this._container.scrollTop; + this._scrollLeft = this._container.scrollLeft; + var maxScrollTop = this._lineToOffset(line); var minScrollTop = maxScrollTop + this._lineHeight(line) - this._canvas.height; if (this._scrollTop > maxScrollTop) @@ -237,8 +242,10 @@ WebInspector.TextEditor.prototype = { var minScrollLeft = maxScrollLeft - this._container.clientWidth + this._lineNumberWidth; if (this._scrollLeft < minScrollLeft) this._container.scrollLeft = minScrollLeft + 100; - if (this._scrollLeft > maxScrollLeft) + else if (this._scrollLeft > maxScrollLeft) this._container.scrollLeft = maxScrollLeft; + else if (minScrollLeft < 0 && maxScrollLeft > 0) + this._container.scrollLeft = 0; }, // WebInspector.TextModel listener @@ -326,8 +333,9 @@ WebInspector.TextEditor.prototype = { var newLineNumberDigits = this._decimalDigits(this._textModel.linesCount); this._lineNumberWidth = (newLineNumberDigits + 2) * this._digitWidth; + this._container.style.left = this._lineNumberWidth + "px"; - var newWidth = this._textWidth + this._lineNumberWidth + "px"; + var newWidth = this._textWidth + "px"; var newHeight = this._lineToOffset(this._textModel.linesCount) + "px"; this._sheet.style.width = newWidth; this._sheet.style.height = newHeight; @@ -345,7 +353,7 @@ WebInspector.TextEditor.prototype = { resize: function() { if (this._canvas.width !== this._container.clientWidth || this._canvas.height !== this._container.clientHeight) { - this._canvas.width = this._container.clientWidth; + this._canvas.width = this._container.clientWidth + this._lineNumberWidth; this._canvas.height = this._container.clientHeight; this.repaintAll(); } @@ -376,16 +384,20 @@ WebInspector.TextEditor.prototype = { _paint: function() { + this._scrollTop = this._container.scrollTop; + this._scrollLeft = this._container.scrollLeft; + if (this._paintCoalescingLevel) return; + this._updateDivDecorations(); + this.paintLineNumbers(); for (var i = 0; this._damage && i < this._damage.length; ++i) this._paintLines(this._damage[i].startLine, this._damage[i].endLine); delete this._damage; - this._updateDivDecorations(); this._updateCursor(this._selection.endLine, this._selection.endColumn); }, @@ -556,7 +568,7 @@ WebInspector.TextEditor.prototype = { var location = this._caretForMouseEvent(e); - if (e.offsetX < this._lineNumberWidth && this._lineNumberDecorator) { + if (e.target === this.element && this._lineNumberDecorator) { if (this._lineNumberDecorator.mouseDown(location.line, e)) return; } @@ -590,7 +602,7 @@ WebInspector.TextEditor.prototype = { _contextMenu: function(e) { - if (e.offsetX < this._lineNumberWidth && this._lineNumberDecorator) { + if (e.target === this.element && this._lineNumberDecorator) { var location = this._caretForMouseEvent(e); if (this._lineNumberDecorator.contextMenu(location.line, e)) return; @@ -607,8 +619,8 @@ WebInspector.TextEditor.prototype = { _caretForMouseEvent: function(e) { - var lineNumber = Math.max(0, this._offsetToLine(e.offsetY) - 1); - var offset = e.offsetX + this._scrollLeft - this._lineNumberWidth; + var lineNumber = Math.max(0, this._offsetToLine(e.offsetY + (e.target === this.element ? this._scrollTop : 0)) - 1); + var offset = e.offsetX + this._scrollLeft; return { line: lineNumber, column: this._columnForOffset(lineNumber, offset) }; }, @@ -811,8 +823,10 @@ WebInspector.TextEditor.prototype = { var linesCount = this._textModel.linesCount; for (var i = 0; i < linesCount; ++i) { var element = this._textModel.getAttribute(i, "div-decoration"); - if (element) + if (element) { + this._lineOffsetsCache.length = Math.min(this._lineOffsetsCache.length, i + 1); this._positionDivDecoration(i, element, i > firstLine && i < lastLine); + } } }, @@ -848,7 +862,7 @@ WebInspector.TextEditor.prototype = { if (this._selection.isEmpty()) return; var range = this._selection.range(); - this._ctx.fillStyle = "rgb(181, 213, 255)"; + this._ctx.fillStyle = this._selectionColor; firstLine = Math.max(firstLine, range.startLine); endLine = Math.min(lastLine, range.endLine + 1); @@ -962,34 +976,14 @@ WebInspector.TextEditor.prototype = { this._updateCursor(this._selection.endLine, this._selection.endColumn); }, - _initFont: function(sansSerif) + initFontMetrics: function() { - if (!WebInspector.TextEditor.PlatformFonts) { - WebInspector.TextEditor.PlatformFonts = {}; - WebInspector.TextEditor.PlatformFonts[WebInspector.OS.Windows] = {size: 12, face: "Lucida Console"}; - WebInspector.TextEditor.PlatformFonts[WebInspector.OS.WindowsVistaOrLater] = {size: 12, face: "Courier"}; - WebInspector.TextEditor.PlatformFonts[WebInspector.OS.MacSnowLeopard] = {size: 11, face: "Menlo"}; - WebInspector.TextEditor.PlatformFonts[WebInspector.OS.MacLeopard] = {size: 10, face: "Monaco"}; - WebInspector.TextEditor.PlatformFonts[WebInspector.OS.MacTiger] = {size: 10, face: "Monaco"}; - } - - if (sansSerif) { - this._isMonospace = false; - this._fontSize = 11; - this._font = this._fontSize + "px sans-serif"; - } else { - this._isMonospace = true; - const platform = WebInspector.platform; - const fontInfo = WebInspector.TextEditor.PlatformFonts[platform] || {size: 10, face: "monospace"}; - this._fontSize = fontInfo.size; - this._font = this._fontSize + "px " + fontInfo.face; - } + var computedStyle = window.getComputedStyle(this.element); + this._font = computedStyle.fontSize + " " + computedStyle.fontFamily; this._ctx.font = this._font; this._digitWidth = this._ctx.measureText("0").width; - - this._textLineHeight = Math.floor(this._fontSize * 1.4); + this._textLineHeight = Math.floor(parseInt(this._ctx.font) * 1.4); this._cursor.setTextLineHeight(this._textLineHeight); - this._lineOffsetsCache = [0]; }, _registerShortcuts: function() @@ -999,15 +993,11 @@ WebInspector.TextEditor.prototype = { this._shortcuts[WebInspector.KeyboardShortcut.makeKey("z", this._isMac ? modifiers.Meta : modifiers.Ctrl)] = this._handleUndo.bind(this); this._shortcuts[WebInspector.KeyboardShortcut.makeKey("z", modifiers.Shift | (this._isMac ? modifiers.Meta : modifiers.Ctrl))] = this._handleRedo.bind(this); this._shortcuts[WebInspector.KeyboardShortcut.makeKey("a", this._isMac ? modifiers.Meta : modifiers.Ctrl)] = this._selectAll.bind(this); - this._shortcuts[WebInspector.KeyboardShortcut.makeKey(WebInspector.KeyboardShortcut.KeyCodes.Plus, this._isMac ? modifiers.Meta : modifiers.Ctrl)] = this._handleZoomIn.bind(this); - this._shortcuts[WebInspector.KeyboardShortcut.makeKey(WebInspector.KeyboardShortcut.KeyCodes.Minus, this._isMac ? modifiers.Meta : modifiers.Ctrl)] = this._handleZoomOut.bind(this); - this._shortcuts[WebInspector.KeyboardShortcut.makeKey(WebInspector.KeyboardShortcut.KeyCodes.Zero, this._isMac ? modifiers.Meta : modifiers.Ctrl)] = this._handleZoomReset.bind(this); if (this._isMac) this._shortcuts[WebInspector.KeyboardShortcut.makeKey("d", modifiers.Ctrl)] = this._handleDeleteKey.bind(this); this._shortcuts[WebInspector.KeyboardShortcut.makeKey("d", modifiers.Ctrl | modifiers.Alt)] = this._handleToggleDebugMode.bind(this); this._shortcuts[WebInspector.KeyboardShortcut.makeKey("h", modifiers.Ctrl | modifiers.Alt)] = this._handleToggleHighlightMode.bind(this); - this._shortcuts[WebInspector.KeyboardShortcut.makeKey("m", modifiers.Ctrl | modifiers.Alt)] = this._handleToggleMonospaceMode.bind(this); }, _handleUndo: function() @@ -1065,34 +1055,6 @@ WebInspector.TextEditor.prototype = { this._debugMode = !this._debugMode; }, - _handleZoomIn: function() - { - if (this._fontSize < 25) - this._changeFont(!this._isMonospace, this._fontSize + 1); - }, - - _handleZoomOut: function() - { - if (this._fontSize > 1) - this._changeFont(!this._isMonospace, this._fontSize - 1); - }, - - _handleZoomReset: function() - { - this._changeFont(!this._isMonospace); - }, - - _handleToggleMonospaceMode: function() - { - this._changeFont(this._isMonospace, this._fontSize); - }, - - _changeFont: function(sansSerif, fontSize) { - this._initFont(sansSerif, fontSize); - this._updatePreferredSize(0, this._textModel.linesCount); - this.repaintAll(); - }, - _handleToggleHighlightMode: function() { this._highlightingEnabled = !this._highlightingEnabled; diff --git a/WebCore/inspector/front-end/TextEditorHighlighter.js b/WebCore/inspector/front-end/TextEditorHighlighter.js index 9a7a050..c73e036 100644 --- a/WebCore/inspector/front-end/TextEditorHighlighter.js +++ b/WebCore/inspector/front-end/TextEditorHighlighter.js @@ -47,10 +47,12 @@ WebInspector.TextEditorHighlighter = function(textModel, damageCallback) /* Keep this in sync with inspector.css and view-source.css */ this._styles["html-tag"] = "rgb(136, 18, 128)"; - this._styles["html-attr-name"] = "rgb(153, 69, 0)"; - this._styles["html-attr-value"] = "rgb(26, 26, 166)"; + this._styles["html-attribute-name"] = "rgb(153, 69, 0)"; + this._styles["html-attribute-value"] = "rgb(26, 26, 166)"; this._styles["html-comment"] = "rgb(35, 110, 37)"; this._styles["html-doctype"] = "rgb(192, 192, 192)"; + this._styles["html-external-link"] = "#00e"; + this._styles["html-resource-link"] = "#00e"; this._styles["javascript-comment"] = "rgb(0, 116, 0)"; this._styles["javascript-string"] = "rgb(196, 26, 22)"; diff --git a/WebCore/inspector/front-end/inspector.css b/WebCore/inspector/front-end/inspector.css index 501915d..45b8ec3 100644 --- a/WebCore/inspector/front-end/inspector.css +++ b/WebCore/inspector/front-end/inspector.css @@ -246,13 +246,11 @@ body.attached.port-qt .toolbar-item.close-left, body.attached.port-qt .toolbar-i display: none; } -body.platform-mac-tiger .toolbar-item.close-right, -body.platform-mac-leopard .toolbar-item.close-right, -body.platform-mac-snowleopard .toolbar-item.close-right { +body.platform-mac .toolbar-item.close-right { display: none; } -body:not(.platform-mac-tiger):not(.platform-mac-leopard):not(.platform-mac-snowleopard) .toolbar-item.close-left { +body:not(.platform-mac) .toolbar-item.close-left { display: none; } @@ -503,20 +501,18 @@ body.drawer-visible #drawer { font-family: monospace; } -body.platform-mac-tiger .monospace, body.platform-mac-leopard .monospace, -body.platform-mac-tiger .source-code, body.platform-mac-leopard .source-code { - font-size: 10px; +body.platform-mac .monospace, body.platform-mac .source-code { font-family: Monaco, monospace; } -body.platform-mac-snowleopard .monospace, -body.platform-mac-snowleopard .source-code { +/* Keep .platform-mac to make the rule more specific than the general one above. */ +body.platform-mac.platform-mac-snowleopard .monospace, +body.platform-mac.platform-mac-snowleopard .source-code { font-size: 11px; font-family: Menlo, monospace; } -body.platform-windows .monospace, body.platform-windows-vista-or-later .monospace, -body.platform-windows .source-code, body.platform-windows-vista-or-later .source-code { +body.platform-windows .monospace, body.platform-windows .source-code { font-size: 12px; font-family: Consolas, Lucida Console, monospace; } @@ -1188,46 +1184,6 @@ body.platform-windows .source-code, body.platform-windows-vista-or-later .source display: block; } -.webkit-html-comment { - /* Keep this in sync with view-source.css (.webkit-html-comment) */ - color: rgb(35, 110, 37); -} - -.webkit-html-tag { - /* Keep this in sync with view-source.css (.webkit-html-tag) */ - color: rgb(136, 18, 128); -} - -.webkit-html-doctype { - /* Keep this in sync with view-source.css (.webkit-html-doctype) */ - color: rgb(192, 192, 192); -} - -.webkit-html-attribute-name { - /* Keep this in sync with view-source.css (.webkit-html-attribute-name) */ - color: rgb(153, 69, 0); -} - -.webkit-html-attribute-value { - /* Keep this in sync with view-source.css (.webkit-html-attribute-value) */ - color: rgb(26, 26, 166); -} - -.webkit-html-external-link, .webkit-html-resource-link { - /* Keep this in sync with view-source.css (.webkit-html-external-link, .webkit-html-resource-link) */ - color: #00e; -} - -.webkit-html-external-link { - /* Keep this in sync with view-source.css (.webkit-html-external-link) */ - text-decoration: none; -} - -.webkit-html-external-link:hover { - /* Keep this in sync with view-source.css (.webkit-html-external-link:hover) */ - text-decoration: underline; -} - .add-attribute { margin-left: 1px; margin-right: 1px; diff --git a/WebCore/inspector/front-end/inspector.js b/WebCore/inspector/front-end/inspector.js index c637f37..de20739 100644 --- a/WebCore/inspector/front-end/inspector.js +++ b/WebCore/inspector/front-end/inspector.js @@ -67,37 +67,44 @@ var WebInspector = { get platform() { if (!("_platform" in this)) - this._platform = this._detectPlatform(); + this._platform = InspectorFrontendHost.platform(); return this._platform; }, - _detectPlatform: function() + get platformFlavor() + { + if (!("_platformFlavor" in this)) + this._platformFlavor = this._detectPlatformFlavor(); + + return this._platformFlavor; + }, + + _detectPlatformFlavor: function() { const userAgent = navigator.userAgent; - var nativePlatform = InspectorFrontendHost.platform(); - if (nativePlatform === "windows") { + if (this.platform === "windows") { var match = userAgent.match(/Windows NT (\d+)\.(?:\d+)/); if (match && match[1] >= 6) - return WebInspector.OS.WindowsVistaOrLater; - return WebInspector.OS.Windows; - } else if (nativePlatform === "mac") { + return WebInspector.PlatformFlavor.WindowsVista; + return null; + } else if (this.platform === "mac") { var match = userAgent.match(/Mac OS X\s*(?:(\d+)_(\d+))?/); if (!match || match[1] != 10) - return WebInspector.OS.MacSnowLeopard; + return WebInspector.PlatformFlavor.MacSnowLeopard; switch (Number(match[2])) { case 4: - return WebInspector.OS.MacTiger; + return WebInspector.PlatformFlavor.MacTiger; case 5: - return WebInspector.OS.MacLeopard; + return WebInspector.PlatformFlavor.MacLeopard; case 6: default: - return WebInspector.OS.MacSnowLeopard; + return WebInspector.PlatformFlavor.MacSnowLeopard; } } - return nativePlatform; + return null; }, get port() @@ -415,9 +422,8 @@ var WebInspector = { } } -WebInspector.OS = { - Windows: "windows", - WindowsVistaOrLater: "windows-vista-or-later", +WebInspector.PlatformFlavor = { + WindowsVista: "windows-vista", MacTiger: "mac-tiger", MacLeopard: "mac-leopard", MacSnowLeopard: "mac-snowleopard" @@ -429,6 +435,9 @@ WebInspector.loaded = function() var platform = WebInspector.platform; document.body.addStyleClass("platform-" + platform); + var flavor = WebInspector.platformFlavor; + if (flavor) + document.body.addStyleClass("platform-" + flavor); var port = WebInspector.port; document.body.addStyleClass("port-" + port); @@ -871,7 +880,7 @@ WebInspector.toggleAttach = function() WebInspector.toolbarDragStart = function(event) { - if ((!WebInspector.attached && WebInspector.platform !== "mac-leopard") || WebInspector.port == "qt") + if ((!WebInspector.attached && WebInspector.platformFlavor !== WebInspector.PlatformFlavor.MacLeopard && WebInspector.platformFlavor !== WebInspector.PlatformFlavor.MacSnowLeopard) || WebInspector.port == "qt") return; var target = event.target; @@ -1528,6 +1537,20 @@ WebInspector.linkifyURL = function(url, linkText, classes, isExternal, tooltipTe return WebInspector.linkifyURLAsNode(url, linkText, classes, isExternal, tooltipText).outerHTML; } +WebInspector.completeURL = function(baseURL, href) +{ + var match = baseURL.match(WebInspector.URLRegExp); + if (match) { + var path = href; + if (path.charAt(0) !== "/") { + var basePath = match[4] || "/"; + path = basePath.substring(0, basePath.lastIndexOf("/")) + "/" + path; + } + return match[1] + "://" + match[2] + (match[3] ? (":" + match[3]) : "") + path; + } + return null; +} + WebInspector.addMainEventListeners = function(doc) { doc.defaultView.addEventListener("focus", this.windowFocused.bind(this), false); @@ -1685,7 +1708,7 @@ WebInspector.UIString = function(string) WebInspector.isMac = function() { if (!("_isMac" in this)) - this._isMac = WebInspector.platform.indexOf("mac-") === 0; + this._isMac = WebInspector.platform === "mac"; return this._isMac; } diff --git a/WebCore/inspector/front-end/inspectorSyntaxHighlight.css b/WebCore/inspector/front-end/inspectorSyntaxHighlight.css index e3e3074..1292f00 100644 --- a/WebCore/inspector/front-end/inspectorSyntaxHighlight.css +++ b/WebCore/inspector/front-end/inspectorSyntaxHighlight.css @@ -65,3 +65,43 @@ .webkit-javascript-string, .webkit-javascript-regexp { color: rgb(196, 26, 22); } + +.webkit-html-comment { + /* Keep this in sync with view-source.css (.webkit-html-comment) */ + color: rgb(35, 110, 37); +} + +.webkit-html-tag { + /* Keep this in sync with view-source.css (.webkit-html-tag) */ + color: rgb(136, 18, 128); +} + +.webkit-html-doctype { + /* Keep this in sync with view-source.css (.webkit-html-doctype) */ + color: rgb(192, 192, 192); +} + +.webkit-html-attribute-name { + /* Keep this in sync with view-source.css (.webkit-html-attribute-name) */ + color: rgb(153, 69, 0); +} + +.webkit-html-attribute-value { + /* Keep this in sync with view-source.css (.webkit-html-attribute-value) */ + color: rgb(26, 26, 166); +} + +.webkit-html-external-link, .webkit-html-resource-link { + /* Keep this in sync with view-source.css (.webkit-html-external-link, .webkit-html-resource-link) */ + color: #00e; +} + +.webkit-html-external-link { + /* Keep this in sync with view-source.css (.webkit-html-external-link) */ + text-decoration: none; +} + +.webkit-html-external-link:hover { + /* Keep this in sync with view-source.css (.webkit-html-external-link:hover) */ + text-decoration: underline; +} diff --git a/WebCore/inspector/front-end/textEditor.css b/WebCore/inspector/front-end/textEditor.css index 9629a07..93495f2 100644 --- a/WebCore/inspector/front-end/textEditor.css +++ b/WebCore/inspector/front-end/textEditor.css @@ -45,7 +45,6 @@ } .native-text-editor-line { - height: 14px; white-space: pre; } diff --git a/WebCore/loader/FTPDirectoryDocument.cpp b/WebCore/loader/FTPDirectoryDocument.cpp index 7a71d02..62173f5 100644 --- a/WebCore/loader/FTPDirectoryDocument.cpp +++ b/WebCore/loader/FTPDirectoryDocument.cpp @@ -38,14 +38,9 @@ #include "Settings.h" #include "SharedBuffer.h" #include "Text.h" -#include <wtf/StdLibExtras.h> -#if PLATFORM(QT) -#include <QDateTime> -// On Windows, use the threadsafe *_r functions provided by pthread. -#elif OS(WINDOWS) && (USE(PTHREADS) || HAVE(PTHREAD_H)) -#include <pthread.h> -#endif +#include <wtf/CurrentTime.h> +#include <wtf/StdLibExtras.h> using namespace std; @@ -200,48 +195,6 @@ static bool wasLastDayOfMonth(int year, int month, int day) return lastDays[month] == day; } -#if PLATFORM(QT) - -/*! - Replacement for localtime_r() which is not available on MinGW. - - We use this on all of Qt's platforms for portability. - */ -struct tm gmtimeQt(const QDateTime &input) -{ - tm result; - - const QDate date(input.date()); - result.tm_year = date.year() - 1900; - result.tm_mon = date.month(); - result.tm_mday = date.day(); - result.tm_wday = date.dayOfWeek(); - result.tm_yday = date.dayOfYear(); - - const QTime time(input.time()); - result.tm_sec = time.second(); - result.tm_min = time.minute(); - result.tm_hour = time.hour(); - - return result; -} - -static struct tm *localTimeQt(const time_t *const timep, struct tm *result) -{ - const QDateTime dt(QDateTime::fromTime_t(*timep)); - *result = WebCore::gmtimeQt(dt.toLocalTime()); - return result; -} - -#define localtime_r(x, y) localTimeQt(x, y) -#elif OS(WINDOWS) && !defined(localtime_r) -#if defined(_MSC_VER) && (_MSC_VER >= 1400) -#define localtime_r(x, y) localtime_s((y), (x)) -#else /* !_MSC_VER */ -#define localtime_r(x,y) (localtime(x)?(*(y)=*localtime(x),(y)):0) -#endif -#endif - static String processFileDateString(const FTPTime& fileTime) { // FIXME: Need to localize this string? @@ -267,7 +220,7 @@ static String processFileDateString(const FTPTime& fileTime) // If it was today or yesterday, lets just do that - but we have to compare to the current time struct tm now; time_t now_t = time(NULL); - localtime_r(&now_t, &now); + getLocalTime(&now_t, &now); // localtime does "year = current year - 1900", compensate for that for readability and comparison purposes now.tm_year += 1900; diff --git a/WebCore/loader/FTPDirectoryParser.cpp b/WebCore/loader/FTPDirectoryParser.cpp index 34c19a4..142f2a3 100644 --- a/WebCore/loader/FTPDirectoryParser.cpp +++ b/WebCore/loader/FTPDirectoryParser.cpp @@ -38,8 +38,27 @@ using namespace WTF; namespace WebCore { #if PLATFORM(QT) && defined(Q_WS_WIN32) -// Defined in FTPDirectoryDocument.cpp. -struct tm gmtimeQt(const QDateTime &input); + +// Replacement for gmtime_r() which is not available on MinGW. +// We use this on Win32 Qt platform for portability. +struct tm gmtimeQt(const QDateTime& input) +{ + tm result; + + QDate date(input.date()); + result.tm_year = date.year() - 1900; + result.tm_mon = date.month(); + result.tm_mday = date.day(); + result.tm_wday = date.dayOfWeek(); + result.tm_yday = date.dayOfYear(); + + QTime time(input.time()); + result.tm_sec = time.second(); + result.tm_min = time.minute(); + result.tm_hour = time.hour(); + + return result; +} static struct tm *gmtimeQt(const time_t *const timep, struct tm *result) { diff --git a/WebCore/loader/FrameLoader.cpp b/WebCore/loader/FrameLoader.cpp index 6422535..9e264b5 100644 --- a/WebCore/loader/FrameLoader.cpp +++ b/WebCore/loader/FrameLoader.cpp @@ -1501,7 +1501,7 @@ bool FrameLoader::isProcessingUserGesture() Frame* frame = m_frame->tree()->top(); if (!frame->script()->canExecuteScripts()) return true; // If JavaScript is disabled, a user gesture must have initiated the navigation. - return frame->script()->processingUserGesture(); // FIXME: Use pageIsProcessingUserGesture. + return frame->script()->processingUserGesture(mainThreadNormalWorld()); // FIXME: Use pageIsProcessingUserGesture. } void FrameLoader::resetMultipleFormSubmissionProtection() @@ -3579,7 +3579,7 @@ void FrameLoader::continueLoadAfterNavigationPolicy(const ResourceRequest&, Pass if (!m_frame->page()) return; -#if ENABLE(JAVASCRIPT_DEBUGGER) && ENABLE(INSPECTOR) +#if ENABLE(JAVASCRIPT_DEBUGGER) && ENABLE(INSPECTOR) && USE(JSC) if (Page* page = m_frame->page()) { if (page->mainFrame() == m_frame) page->inspectorController()->resumeDebugger(); @@ -3900,7 +3900,9 @@ void FrameLoader::loadItem(HistoryItem* item, FrameLoadType loadType) // - The HistoryItem has a history state object // - Navigating to an anchor within the page, with no form data stored on the target item or the current history entry, // and the URLs in the frame tree match the history item for fragment scrolling. - bool sameDocumentNavigation = (!item->formData() && !(history()->currentItem() && history()->currentItem()->formData()) && history()->urlsMatchItem(item)) || item->documentSequenceNumber() == history()->currentItem()->documentSequenceNumber(); + HistoryItem* currentItem = history()->currentItem(); + bool sameDocumentNavigation = (!item->formData() && !(currentItem && currentItem->formData()) && history()->urlsMatchItem(item)) + || (currentItem && item->documentSequenceNumber() == currentItem->documentSequenceNumber()); #if ENABLE(WML) // All WML decks should go through the real load mechanism, not the scroll-to-anchor code diff --git a/WebCore/loader/MediaDocument.cpp b/WebCore/loader/MediaDocument.cpp index 656d0a0..a2d6276 100644 --- a/WebCore/loader/MediaDocument.cpp +++ b/WebCore/loader/MediaDocument.cpp @@ -159,12 +159,12 @@ void MediaDocument::defaultEventHandler(Event* event) HTMLVideoElement* video = static_cast<HTMLVideoElement*>(targetNode); if (event->type() == eventNames().clickEvent) { if (!video->canPlay()) { - video->pause(); + video->pause(event->fromUserGesture()); event->setDefaultHandled(); } } else if (event->type() == eventNames().dblclickEvent) { if (video->canPlay()) { - video->play(); + video->play(event->fromUserGesture()); event->setDefaultHandled(); } } @@ -186,9 +186,9 @@ void MediaDocument::defaultEventHandler(Event* event) if (keyboardEvent->keyIdentifier() == "U+0020") { // space if (video->paused()) { if (video->canPlay()) - video->play(); + video->play(event->fromUserGesture()); } else - video->pause(); + video->pause(event->fromUserGesture()); event->setDefaultHandled(); } } diff --git a/WebCore/loader/icon/IconDatabaseClient.h b/WebCore/loader/icon/IconDatabaseClient.h index 8806406..1811214 100644 --- a/WebCore/loader/icon/IconDatabaseClient.h +++ b/WebCore/loader/icon/IconDatabaseClient.h @@ -29,6 +29,8 @@ #ifndef IconDatabaseClient_h #define IconDatabaseClient_h +#include <wtf/Noncopyable.h> + // All of these client methods will be called from a non-main thread // Take appropriate measures @@ -36,7 +38,7 @@ namespace WebCore { class String; -class IconDatabaseClient { +class IconDatabaseClient : public Noncopyable { public: virtual ~IconDatabaseClient() { } virtual bool performImport() { return true; } diff --git a/WebCore/manual-tests/drag-image-table-part-decorations.html b/WebCore/manual-tests/drag-image-table-part-decorations.html new file mode 100644 index 0000000..467cc54 --- /dev/null +++ b/WebCore/manual-tests/drag-image-table-part-decorations.html @@ -0,0 +1,16 @@ +<!DOCTYPE HTML> +<p> + When dragging each of the black squares below, the drag image should include + only the hollow black square, and no blue background. +</p> +<div style="background-color: blue; display: table; height: 100px; width: 100px;"></div> +<div style="width: 94px; height: 94px; border: solid; -webkit-user-drag: element; margin-top: -50px; margin-bottom: 10px;"></div> + +<div style="background-color: blue; display: table-row; height: 100px;"><div style="width: 100px"></div></div> +<div style="width: 94px; height: 94px; border: solid; -webkit-user-drag: element; margin-top: -50px; margin-bottom: 10px;"></div> + +<div style="background-color: blue; display: table-cell; height: 100px; width: 100px;"></div> +<div style="width: 94px; height: 94px; border: solid; -webkit-user-drag: element; margin-top: -50px; margin-bottom: 10px;"></div> + +<fieldset style="background-color: blue; border: none; height: 100px; width: 100px;"><legend></legend></fieldset> +<div style="width: 94px; height: 94px; border: solid; -webkit-user-drag: element; margin-top: -50px; "></div> diff --git a/WebCore/mathml/RenderMathMLBlock.cpp b/WebCore/mathml/RenderMathMLBlock.cpp index 249c136..a897ff5 100644 --- a/WebCore/mathml/RenderMathMLBlock.cpp +++ b/WebCore/mathml/RenderMathMLBlock.cpp @@ -30,6 +30,7 @@ #include "RenderMathMLBlock.h" #include "FontSelector.h" +#include "GraphicsContext.h" #include "MathMLNames.h" #include "RenderInline.h" #include "RenderText.h" @@ -73,6 +74,39 @@ void RenderMathMLBlock::stretchToHeight(int height) } } +#if ENABLE(DEBUG_MATH_LAYOUT) +void RenderMathMLBlock::paint(PaintInfo& info, int tx, int ty) +{ + RenderBlock::paint(info, tx, ty); + + if (info.context->paintingDisabled() || info.phase != PaintPhaseForeground) + return; + + tx += x(); + ty += y(); + + info.context->save(); + + info.context->setStrokeThickness(1.0f); + info.context->setStrokeStyle(SolidStroke); + info.context->setStrokeColor(Color(0, 0, 255), sRGBColorSpace); + + info.context->drawLine(IntPoint(tx, ty), IntPoint(tx + offsetWidth(), ty)); + info.context->drawLine(IntPoint(tx + offsetWidth(), ty), IntPoint(tx + offsetWidth(), ty + offsetHeight())); + info.context->drawLine(IntPoint(tx, ty + offsetHeight()), IntPoint(tx + offsetWidth(), ty + offsetHeight())); + info.context->drawLine(IntPoint(tx, ty), IntPoint(tx, ty + offsetHeight())); + + int baseline = baselinePosition(true); + + info.context->setStrokeColor(Color(255, 0, 0), sRGBColorSpace); + + info.context->drawLine(IntPoint(tx, ty + baseline), IntPoint(tx + offsetWidth(), ty + baseline)); + + info.context->restore(); + +} +#endif // ENABLE(DEBUG_MATH_LAYOUT) + } diff --git a/WebCore/mathml/RenderMathMLBlock.h b/WebCore/mathml/RenderMathMLBlock.h index b274a69..e01a325 100644 --- a/WebCore/mathml/RenderMathMLBlock.h +++ b/WebCore/mathml/RenderMathMLBlock.h @@ -30,6 +30,8 @@ #include "RenderBlock.h" +#define ENABLE_DEBUG_MATH_LAYOUT 0 + namespace WebCore { class RenderMathMLBlock : public RenderBlock { @@ -44,6 +46,10 @@ public: virtual bool hasBase() const { return false; } virtual int nonOperatorHeight() const; virtual void stretchToHeight(int height); + +#if ENABLE(DEBUG_MATH_LAYOUT) + virtual void paint(PaintInfo&, int tx, int ty); +#endif protected: virtual PassRefPtr<RenderStyle> makeBlockStyle(); diff --git a/WebCore/page/Console.cpp b/WebCore/page/Console.cpp index 2273a5e..8f55c78 100644 --- a/WebCore/page/Console.cpp +++ b/WebCore/page/Console.cpp @@ -41,11 +41,9 @@ #include "PageGroup.h" #include "PlatformString.h" -#if ENABLE(JAVASCRIPT_DEBUGGER) -#include <profiler/Profiler.h> -#endif - #include "ScriptCallStack.h" +#include "ScriptProfile.h" +#include "ScriptProfiler.h" #include <stdio.h> #include <wtf/UnusedParam.h> @@ -314,38 +312,40 @@ String Console::lastWMLErrorMessage() const } #endif -#if ENABLE(JAVASCRIPT_DEBUGGER) +// FIXME: "USE(V8)" and "USE(JSC)" below are temporary measures until JAVASCRIPT_DEBUGGER is +// enabled when building Chromium. +#if ENABLE(JAVASCRIPT_DEBUGGER) || USE(V8) -void Console::profile(const JSC::UString& title, ScriptCallStack* callStack) +void Console::profile(const String& title, ScriptCallStack* callStack) { Page* page = this->page(); if (!page) return; -#if ENABLE(INSPECTOR) +#if ENABLE(INSPECTOR) && USE(JSC) InspectorController* controller = page->inspectorController(); // FIXME: log a console message when profiling is disabled. if (!controller->profilerEnabled()) return; #endif - JSC::UString resolvedTitle = title; - if (title.isNull()) // no title so give it the next user initiated profile title. -#if ENABLE(INSPECTOR) + String resolvedTitle = title; + if (title.isNull()) // no title so give it the next user initiated profile title. +#if ENABLE(INSPECTOR) && USE(JSC) resolvedTitle = controller->getCurrentUserInitiatedProfileName(true); #else resolvedTitle = ""; #endif - JSC::Profiler::profiler()->startProfiling(callStack->state(), resolvedTitle); + ScriptProfiler::start(callStack->state(), resolvedTitle); -#if ENABLE(INSPECTOR) +#if ENABLE(INSPECTOR) && USE(JSC) const ScriptCallFrame& lastCaller = callStack->at(0); controller->addStartProfilingMessageToConsole(resolvedTitle, lastCaller.lineNumber(), lastCaller.sourceURL()); #endif } -void Console::profileEnd(const JSC::UString& title, ScriptCallStack* callStack) +void Console::profileEnd(const String& title, ScriptCallStack* callStack) { Page* page = this->page(); if (!page) @@ -354,19 +354,19 @@ void Console::profileEnd(const JSC::UString& title, ScriptCallStack* callStack) if (!this->page()) return; -#if ENABLE(INSPECTOR) +#if ENABLE(INSPECTOR) && USE(JSC) InspectorController* controller = page->inspectorController(); if (!controller->profilerEnabled()) return; #endif - RefPtr<JSC::Profile> profile = JSC::Profiler::profiler()->stopProfiling(callStack->state(), title); + RefPtr<ScriptProfile> profile = ScriptProfiler::stop(callStack->state(), title); if (!profile) return; m_profiles.append(profile); -#if ENABLE(INSPECTOR) +#if ENABLE(INSPECTOR) && USE(JSC) const ScriptCallFrame& lastCaller = callStack->at(0); controller->addProfile(profile, lastCaller.lineNumber(), lastCaller.sourceURL()); #endif diff --git a/WebCore/page/Console.h b/WebCore/page/Console.h index ea3a161..bbf2ac7 100644 --- a/WebCore/page/Console.h +++ b/WebCore/page/Console.h @@ -31,101 +31,101 @@ #include "PlatformString.h" -#if ENABLE(JAVASCRIPT_DEBUGGER) -#include <profiler/Profile.h> -#endif +#include "ScriptProfile.h" -#include <wtf/RefCounted.h> #include <wtf/PassRefPtr.h> +#include <wtf/RefCounted.h> namespace WebCore { -#if ENABLE(JAVASCRIPT_DEBUGGER) - typedef Vector<RefPtr<JSC::Profile> > ProfilesArray; +// FIXME: "USE(V8)" and "USE(JSC)" below are temporary measures until JAVASCRIPT_DEBUGGER is +// enabled when building Chromium. +#if ENABLE(JAVASCRIPT_DEBUGGER) || USE(V8) +typedef Vector<RefPtr<ScriptProfile> > ProfilesArray; #endif - class Frame; - class Page; - class String; - class ScriptCallStack; - - // Keep in sync with inspector/front-end/Console.js - enum MessageSource { - HTMLMessageSource, - WMLMessageSource, - XMLMessageSource, - JSMessageSource, - CSSMessageSource, - OtherMessageSource - }; - - enum MessageType { - LogMessageType, - ObjectMessageType, - TraceMessageType, - StartGroupMessageType, - EndGroupMessageType, - AssertMessageType - }; - - enum MessageLevel { - TipMessageLevel, - LogMessageLevel, - WarningMessageLevel, - ErrorMessageLevel, - DebugMessageLevel - }; - - class Console : public RefCounted<Console> { - public: - static PassRefPtr<Console> create(Frame* frame) { return adoptRef(new Console(frame)); } - - Frame* frame() const; - void disconnectFrame(); - - void addMessage(MessageSource, MessageType, MessageLevel, const String& message, unsigned lineNumber, const String& sourceURL); - - void debug(ScriptCallStack*); - void error(ScriptCallStack*); - void info(ScriptCallStack*); - void log(ScriptCallStack*); - void warn(ScriptCallStack*); - void dir(ScriptCallStack*); - void dirxml(ScriptCallStack*); - void trace(ScriptCallStack*); - void assertCondition(bool condition, ScriptCallStack*); - void count(ScriptCallStack*); - void markTimeline(ScriptCallStack*); +class Frame; +class Page; +class String; +class ScriptCallStack; + +// Keep in sync with inspector/front-end/Console.js +enum MessageSource { + HTMLMessageSource, + WMLMessageSource, + XMLMessageSource, + JSMessageSource, + CSSMessageSource, + OtherMessageSource +}; + +enum MessageType { + LogMessageType, + ObjectMessageType, + TraceMessageType, + StartGroupMessageType, + EndGroupMessageType, + AssertMessageType +}; + +enum MessageLevel { + TipMessageLevel, + LogMessageLevel, + WarningMessageLevel, + ErrorMessageLevel, + DebugMessageLevel +}; + +class Console : public RefCounted<Console> { +public: + static PassRefPtr<Console> create(Frame* frame) { return adoptRef(new Console(frame)); } + + Frame* frame() const; + void disconnectFrame(); + + void addMessage(MessageSource, MessageType, MessageLevel, const String& message, unsigned lineNumber, const String& sourceURL); + + void debug(ScriptCallStack*); + void error(ScriptCallStack*); + void info(ScriptCallStack*); + void log(ScriptCallStack*); + void warn(ScriptCallStack*); + void dir(ScriptCallStack*); + void dirxml(ScriptCallStack*); + void trace(ScriptCallStack*); + void assertCondition(bool condition, ScriptCallStack*); + void count(ScriptCallStack*); + void markTimeline(ScriptCallStack*); #if ENABLE(WML) - String lastWMLErrorMessage() const; + String lastWMLErrorMessage() const; #endif -#if ENABLE(JAVASCRIPT_DEBUGGER) - void profile(const JSC::UString&, ScriptCallStack*); - void profileEnd(const JSC::UString&, ScriptCallStack*); +#if ENABLE(JAVASCRIPT_DEBUGGER) || USE(V8) + void profile(const String&, ScriptCallStack*); + void profileEnd(const String&, ScriptCallStack*); #endif - void time(const String&); - void timeEnd(const String&, ScriptCallStack*); - void group(ScriptCallStack*); - void groupEnd(); + void time(const String&); + void timeEnd(const String&, ScriptCallStack*); + void group(ScriptCallStack*); + void groupEnd(); - static bool shouldPrintExceptions(); - static void setShouldPrintExceptions(bool); + static bool shouldPrintExceptions(); + static void setShouldPrintExceptions(bool); #if ENABLE(JAVASCRIPT_DEBUGGER) - const ProfilesArray& profiles() const { return m_profiles; } + const ProfilesArray& profiles() const { return m_profiles; } #endif - private: - inline Page* page() const; - void addMessage(MessageType, MessageLevel, ScriptCallStack*, bool acceptNoArguments = false); +private: + inline Page* page() const; + void addMessage(MessageType, MessageLevel, ScriptCallStack*, bool acceptNoArguments = false); - Console(Frame*); + Console(Frame*); - Frame* m_frame; -#if ENABLE(JAVASCRIPT_DEBUGGER) - ProfilesArray m_profiles; + Frame* m_frame; +#if ENABLE(JAVASCRIPT_DEBUGGER) || USE(V8) + ProfilesArray m_profiles; #endif - }; +}; } // namespace WebCore diff --git a/WebCore/page/Console.idl b/WebCore/page/Console.idl index b9c0a57..290235b 100644 --- a/WebCore/page/Console.idl +++ b/WebCore/page/Console.idl @@ -51,8 +51,8 @@ module window { #endif #if defined(ENABLE_JAVASCRIPT_DEBUGGER) && ENABLE_JAVASCRIPT_DEBUGGER || defined(V8_BINDING) && V8_BINDING - [Custom] void profile(in [ConvertUndefinedOrNullToNullString] DOMString title); - [Custom] void profileEnd(in [ConvertUndefinedOrNullToNullString] DOMString title); + [CustomArgumentHandling] void profile(in [ConvertUndefinedOrNullToNullString] DOMString title); + [CustomArgumentHandling] void profileEnd(in [ConvertUndefinedOrNullToNullString] DOMString title); #endif void time(in [ConvertUndefinedOrNullToNullString] DOMString title); diff --git a/WebCore/page/DOMWindow.cpp b/WebCore/page/DOMWindow.cpp index 3eb2b8e..2f0f84f 100644 --- a/WebCore/page/DOMWindow.cpp +++ b/WebCore/page/DOMWindow.cpp @@ -342,8 +342,6 @@ void DOMWindow::parseModalDialogFeatures(const String& featuresArg, HashMap<Stri bool DOMWindow::allowPopUp(Frame* activeFrame) { ASSERT(activeFrame); - if (activeFrame->script()->processingUserGesture()) - return true; Settings* settings = activeFrame->settings(); return settings && settings->javaScriptCanOpenWindowsAutomatically(); } diff --git a/WebCore/page/EventHandler.h b/WebCore/page/EventHandler.h index f267ef5..861dce9 100644 --- a/WebCore/page/EventHandler.h +++ b/WebCore/page/EventHandler.h @@ -33,7 +33,7 @@ #include <wtf/Forward.h> #include <wtf/RefPtr.h> -#if PLATFORM(MAC) && !defined(__OBJC__) && !ENABLE(EXPERIMENTAL_SINGLE_VIEW_MODE) +#if PLATFORM(MAC) && !defined(__OBJC__) class NSView; #endif @@ -183,7 +183,7 @@ public: void sendResizeEvent(); void sendScrollEvent(); -#if PLATFORM(MAC) && defined(__OBJC__) && !ENABLE(EXPERIMENTAL_SINGLE_VIEW_MODE) +#if PLATFORM(MAC) && defined(__OBJC__) PassRefPtr<KeyboardEvent> currentKeyboardEvent() const; void mouseDown(NSEvent *); @@ -415,9 +415,11 @@ private: RefPtr<Node> m_previousWheelScrolledNode; -#if PLATFORM(MAC) && !ENABLE(EXPERIMENTAL_SINGLE_VIEW_MODE) +#if PLATFORM(MAC) +#if !ENABLE(EXPERIMENTAL_SINGLE_VIEW_MODE) NSView *m_mouseDownView; bool m_sendingEventToSubview; +#endif int m_activationEventNumber; #endif #if ENABLE(TOUCH_EVENTS) diff --git a/WebCore/page/Page.cpp b/WebCore/page/Page.cpp index b685e59..a3e89b5 100644 --- a/WebCore/page/Page.cpp +++ b/WebCore/page/Page.cpp @@ -69,7 +69,7 @@ #include "StorageNamespace.h" #endif -#if ENABLE(JAVASCRIPT_DEBUGGER) +#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC) #include "JavaScriptDebugServer.h" #endif @@ -191,7 +191,7 @@ Page::Page(ChromeClient* chromeClient, ContextMenuClient* contextMenuClient, Edi m_pluginHalter->setPluginAllowedRunTime(m_settings->pluginAllowedRunTime()); } -#if ENABLE(JAVASCRIPT_DEBUGGER) +#if ENABLE(JAVASCRIPT_DEBUGGER) && USE(JSC) JavaScriptDebugServer::shared().pageCreated(this); #endif @@ -308,7 +308,8 @@ void Page::goBackOrForward(int distance) void Page::goToItem(HistoryItem* item, FrameLoadType type) { // Abort any current load unless we're navigating the current document to a new state object - if (!item->stateObject() || item->documentSequenceNumber() != m_mainFrame->loader()->history()->currentItem()->documentSequenceNumber()) { + HistoryItem* currentItem = m_mainFrame->loader()->history()->currentItem(); + if (!item->stateObject() || !currentItem || item->documentSequenceNumber() != currentItem->documentSequenceNumber()) { // Define what to do with any open database connections. By default we stop them and terminate the database thread. DatabasePolicy databasePolicy = DatabasePolicyStop; diff --git a/WebCore/page/PageGroup.cpp b/WebCore/page/PageGroup.cpp index 0ebbfba..f376d52 100644 --- a/WebCore/page/PageGroup.cpp +++ b/WebCore/page/PageGroup.cpp @@ -51,7 +51,7 @@ static unsigned getUniqueIdentifier() // -------- -static bool shouldTrackVisitedLinks; +static bool shouldTrackVisitedLinks = false; PageGroup::PageGroup(const String& name) : m_name(name) diff --git a/WebCore/page/PrintContext.cpp b/WebCore/page/PrintContext.cpp index 4d3a839..4c902a9 100644 --- a/WebCore/page/PrintContext.cpp +++ b/WebCore/page/PrintContext.cpp @@ -45,6 +45,11 @@ int PrintContext::pageCount() const return m_pageRects.size(); } +const IntRect& PrintContext::pageRect(int pageNumber) const +{ + return m_pageRects[pageNumber]; +} + void PrintContext::computePageRects(const FloatRect& printRect, float headerHeight, float footerHeight, float userScaleFactor, float& outPageHeight) { m_pageRects.clear(); @@ -60,11 +65,6 @@ void PrintContext::computePageRects(const FloatRect& printRect, float headerHeig return; } - if (userScaleFactor <= 0) { - LOG_ERROR("userScaleFactor has bad value %.2f", userScaleFactor); - return; - } - float ratio = printRect.height() / printRect.width(); float pageWidth = (float)root->rightLayoutOverflow(); @@ -77,14 +77,31 @@ void PrintContext::computePageRects(const FloatRect& printRect, float headerHeig return; } - float currPageHeight = pageHeight / userScaleFactor; + computePageRectsWithPageSize(FloatSize(pageWidth, pageHeight), userScaleFactor); +} + +void PrintContext::computePageRectsWithPageSize(const FloatSize& pageSizeInPixels, float userScaleFactor) +{ + RenderView* root = toRenderView(m_frame->document()->renderer()); + + if (!root) { + LOG_ERROR("document to be printed has no renderer"); + return; + } + + if (userScaleFactor <= 0) { + LOG_ERROR("userScaleFactor has bad value %.2f", userScaleFactor); + return; + } + + float currPageHeight = pageSizeInPixels.height() / userScaleFactor; float docHeight = root->layer()->height(); - float currPageWidth = pageWidth / userScaleFactor; + float currPageWidth = pageSizeInPixels.width() / userScaleFactor; // always return at least one page, since empty files should print a blank page - float printedPagesHeight = 0.0; + float printedPagesHeight = 0; do { - float proposedBottom = std::min(docHeight, printedPagesHeight + pageHeight); + float proposedBottom = std::min(docHeight, printedPagesHeight + pageSizeInPixels.height()); m_frame->view()->adjustPageHeight(&proposedBottom, printedPagesHeight, proposedBottom, printedPagesHeight); currPageHeight = max(1.0f, proposedBottom - printedPagesHeight); @@ -134,4 +151,40 @@ void PrintContext::end() m_frame->setPrinting(false, 0, 0, true); } +static RenderBoxModelObject* enclosingBoxModelObject(RenderObject* object) +{ + + while (object && !object->isBoxModelObject()) + object = object->parent(); + if (!object) + return 0; + return toRenderBoxModelObject(object); +} + +int PrintContext::pageNumberForElement(Element* element, const FloatSize& pageSizeInPixels) +{ + // Make sure the element is not freed during the layout. + RefPtr<Element> elementRef(element); + element->document()->updateLayout(); + + RenderBoxModelObject* box = enclosingBoxModelObject(element->renderer()); + if (!box) + return -1; + + Frame* frame = element->document()->frame(); + FloatRect pageRect(FloatPoint(0, 0), pageSizeInPixels); + PrintContext printContext(frame); + printContext.begin(pageRect.width()); + printContext.computePageRectsWithPageSize(pageSizeInPixels, 1); + + int top = box->offsetTop(); + int left = box->offsetLeft(); + for (int pageNumber = 0; pageNumber < printContext.pageCount(); pageNumber++) { + const IntRect& page = printContext.pageRect(pageNumber); + if (page.x() <= left && left < page.right() && page.y() <= top && top < page.bottom()) + return pageNumber; + } + return -1; +} + } diff --git a/WebCore/page/PrintContext.h b/WebCore/page/PrintContext.h index 0b3b303..38b28c4 100644 --- a/WebCore/page/PrintContext.h +++ b/WebCore/page/PrintContext.h @@ -25,8 +25,10 @@ namespace WebCore { +class Element; class Frame; class FloatRect; +class FloatSize; class GraphicsContext; class IntRect; @@ -36,6 +38,8 @@ public: ~PrintContext(); int pageCount() const; + const IntRect& pageRect(int pageNumber) const; + const Vector<IntRect>& pageRects() const { return m_pageRects; } void computePageRects(const FloatRect& printRect, float headerHeight, float footerHeight, float userScaleFactor, float& outPageHeight); @@ -47,7 +51,12 @@ public: void end(); + // Used by layout tests. + static int pageNumberForElement(Element*, const FloatSize& pageSizeInPixels); + protected: + void computePageRectsWithPageSize(const FloatSize& pageSizeInPixels, float userScaleFactor); + Frame* m_frame; Vector<IntRect> m_pageRects; }; diff --git a/WebCore/page/XSSAuditor.cpp b/WebCore/page/XSSAuditor.cpp index 0129b52..b71fa49 100644 --- a/WebCore/page/XSSAuditor.cpp +++ b/WebCore/page/XSSAuditor.cpp @@ -290,14 +290,38 @@ bool XSSAuditor::isSameOriginResource(const String& url) const return (m_frame->document()->url().host() == resourceURL.host() && resourceURL.query().isEmpty()); } +bool XSSAuditor::shouldFullPageBlockForXSSProtectionHeader() const +{ + // If we detect an XSS attack and find the HTTP header "X-XSS-Protection: 12" then + // we will stop loading the page as opposed to ignoring the script. The value "12" + // came from a personal communication, see <https://bugs.webkit.org/show_bug.cgi?id=27312> + // for more details. + DEFINE_STATIC_LOCAL(String, XSSProtectionHeader, ("X-XSS-Protection")); + + Frame* frame = m_frame; + if (frame->document()->url() == blankURL()) + frame = m_frame->tree()->parent(); + + // We strip any whitespace characters to conform to the behavior in Internet Explorer. + String xssProtectionValue = frame->loader()->documentLoader()->response().httpHeaderField(XSSProtectionHeader).stripWhiteSpace(); + return (xssProtectionValue.length() >= 2 && xssProtectionValue[0] == '1' && xssProtectionValue[1] == '2'); +} + bool XSSAuditor::findInRequest(const FindTask& task) const { bool result = false; Frame* parentFrame = m_frame->tree()->parent(); + Frame* blockFrame = parentFrame; if (parentFrame && m_frame->document()->url() == blankURL()) result = findInRequest(parentFrame, task); - if (!result) + if (!result) { result = findInRequest(m_frame, task); + blockFrame = m_frame; + } + if (result && blockFrame && shouldFullPageBlockForXSSProtectionHeader()) { + blockFrame->loader()->stopAllLoaders(); + blockFrame->redirectScheduler()->scheduleLocationChange(blankURL(), String()); + } return result; } diff --git a/WebCore/page/XSSAuditor.h b/WebCore/page/XSSAuditor.h index d976f52..3ad50a1 100644 --- a/WebCore/page/XSSAuditor.h +++ b/WebCore/page/XSSAuditor.h @@ -36,7 +36,7 @@ namespace WebCore { class ScriptSourceCode; // The XSSAuditor class is used to prevent type 1 cross-site scripting - // vulnerabilites (also known as reflected vulnerabilities). + // vulnerabilities (also known as reflected vulnerabilities). // // More specifically, the XSSAuditor class decides whether the execution of // a script is to be allowed or denied based on the content of any @@ -53,7 +53,7 @@ namespace WebCore { // // Bindings // - // An XSSAuditor is instantiated within the contructor of a + // An XSSAuditor is instantiated within the constructor of a // ScriptController object and passed the Frame the script originated. The // ScriptController calls back to the XSSAuditor to determine whether a // JavaScript script is safe to execute before executing it. The following @@ -144,6 +144,8 @@ namespace WebCore { bool findInRequest(const FindTask&) const; bool findInRequest(Frame*, const FindTask&) const; + bool shouldFullPageBlockForXSSProtectionHeader() const; + // The frame to audit. Frame* m_frame; diff --git a/WebCore/page/mac/EventHandlerMac.mm b/WebCore/page/mac/EventHandlerMac.mm index 91a2018..650c0e1 100644 --- a/WebCore/page/mac/EventHandlerMac.mm +++ b/WebCore/page/mac/EventHandlerMac.mm @@ -663,6 +663,11 @@ bool EventHandler::eventActivatedView(const PlatformMouseEvent& event) const #else // ENABLE(EXPERIMENTAL_SINGLE_VIEW_MODE) +NSEvent *EventHandler::currentNSEvent() +{ + return 0; +} + bool EventHandler::passMousePressEventToSubframe(MouseEventWithHitTestResults& mev, Frame* subframe) { subframe->eventHandler()->handleMousePressEvent(mev.event()); @@ -711,6 +716,62 @@ bool EventHandler::eventActivatedView(const PlatformMouseEvent&) const return false; } +PassRefPtr<KeyboardEvent> EventHandler::currentKeyboardEvent() const +{ + return 0; +} + +void EventHandler::mouseDown(NSEvent *) +{ + notImplemented(); +} + +void EventHandler::mouseDragged(NSEvent *) +{ + notImplemented(); +} + +void EventHandler::mouseUp(NSEvent *) +{ + notImplemented(); +} + +void EventHandler::mouseMoved(NSEvent *) +{ + notImplemented(); +} + +bool EventHandler::keyEvent(NSEvent *) +{ + notImplemented(); + return false; +} + +bool EventHandler::wheelEvent(NSEvent *) +{ + notImplemented(); + return false; +} + +#if ENABLE(CONTEXT_MENUS) +bool EventHandler::sendContextMenuEvent(NSEvent *) +{ + notImplemented(); + return false; +} +#endif + +bool EventHandler::eventMayStartDrag(NSEvent *) +{ + notImplemented(); + return false; +} + +void EventHandler::sendFakeEventsAfterWidgetTracking(NSEvent *) +{ +} + + #endif #if ENABLE(DRAG_SUPPORT) diff --git a/WebCore/page/win/FrameWin.cpp b/WebCore/page/win/FrameWin.cpp index 8440a80..2b5435d 100644 --- a/WebCore/page/win/FrameWin.cpp +++ b/WebCore/page/win/FrameWin.cpp @@ -29,64 +29,20 @@ #include "Bridge.h" #include "Document.h" #include "FloatRect.h" +#include "PrintContext.h" #include "RenderView.h" #include "Settings.h" #include "TransformationMatrix.h" -using std::min; - namespace WebCore { -void computePageRectsForFrame(Frame* frame, const IntRect& printRect, float headerHeight, float footerHeight, float userScaleFactor, Vector<IntRect>& pages, int& outPageHeight) +void computePageRectsForFrame(Frame* frame, const IntRect& printRect, float headerHeight, float footerHeight, float userScaleFactor, Vector<IntRect>& outPages, int& outPageHeight) { - ASSERT(frame); - - pages.clear(); - outPageHeight = 0; - - if (!frame->document() || !frame->view() || !frame->document()->renderer()) - return; - - RenderView* root = toRenderView(frame->document()->renderer()); - - if (!root) { - LOG_ERROR("document to be printed has no renderer"); - return; - } - - if (userScaleFactor <= 0) { - LOG_ERROR("userScaleFactor has bad value %.2f", userScaleFactor); - return; - } - - float ratio = static_cast<float>(printRect.height()) / static_cast<float>(printRect.width()); - - float pageWidth = static_cast<float>(root->rightLayoutOverflow()); - float pageHeight = pageWidth * ratio; - outPageHeight = static_cast<int>(pageHeight); // this is the height of the page adjusted by margins - pageHeight -= (headerHeight + footerHeight); - - if (pageHeight <= 0) { - LOG_ERROR("pageHeight has bad value %.2f", pageHeight); - return; - } - - float currPageHeight = pageHeight / userScaleFactor; - float docHeight = root->layer()->height(); - float docWidth = root->layer()->width(); - float currPageWidth = pageWidth / userScaleFactor; - - - // always return at least one page, since empty files should print a blank page - float printedPagesHeight = 0.0f; - do { - float proposedBottom = min(docHeight, printedPagesHeight + pageHeight); - frame->view()->adjustPageHeight(&proposedBottom, printedPagesHeight, proposedBottom, printedPagesHeight); - currPageHeight = max(1.0f, proposedBottom - printedPagesHeight); - - pages.append(IntRect(0, printedPagesHeight, currPageWidth, currPageHeight)); - printedPagesHeight += currPageHeight; - } while (printedPagesHeight < docHeight); + PrintContext printContext(frame); + float pageHeight = 0; + printContext.computePageRects(printRect, headerHeight, footerHeight, userScaleFactor, pageHeight); + outPageHeight = static_cast<int>(pageHeight); + outPages = printContext.pageRects(); } DragImageRef Frame::dragImageForSelection() diff --git a/WebCore/page/win/FrameWin.h b/WebCore/page/win/FrameWin.h index 9cf9683..4c274b7 100644 --- a/WebCore/page/win/FrameWin.h +++ b/WebCore/page/win/FrameWin.h @@ -37,7 +37,7 @@ namespace WebCore { class IntRect; HBITMAP imageFromSelection(Frame* frame, bool forceWhiteText); - void computePageRectsForFrame(Frame*, const IntRect& printRect, float headerHeight, float footerHeight, float userScaleFactor, Vector<IntRect>& pages, int& pageHeight); + void computePageRectsForFrame(Frame*, const IntRect& printRect, float headerHeight, float footerHeight, float userScaleFactor, Vector<IntRect>& outPages, int& outPageHeight); } diff --git a/WebCore/platform/KURL.cpp b/WebCore/platform/KURL.cpp index 9783bd8..79bb6e2 100644 --- a/WebCore/platform/KURL.cpp +++ b/WebCore/platform/KURL.cpp @@ -422,9 +422,9 @@ void KURL::init(const KURL& base, const String& relative, const TextEncoding& en switch (str[0]) { case '\0': - // the reference must be empty - the RFC says this is a - // reference to the same document + // The reference is empty, so this is a reference to the same document with any fragment identifier removed. *this = base; + removeFragmentIdentifier(); break; case '#': { // must be fragment-only reference @@ -1752,6 +1752,12 @@ bool portAllowed(const KURL& url) 3659, // apple-sasl / PasswordServer [Apple addition] 4045, // lockd 6000, // X11 + 6665, // Alternate IRC [Apple addition] + 6666, // Alternate IRC [Apple addition] + 6667, // Standard IRC [Apple addition] + 6668, // Alternate IRC [Apple addition] + 6669, // Alternate IRC [Apple addition] + }; const unsigned short* const blockedPortListEnd = blockedPortList + sizeof(blockedPortList) / sizeof(blockedPortList[0]); diff --git a/WebCore/platform/brew/FileChooserBrew.cpp b/WebCore/platform/brew/FileChooserBrew.cpp new file mode 100644 index 0000000..79755bb --- /dev/null +++ b/WebCore/platform/brew/FileChooserBrew.cpp @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. + * Copyright (C) 2007-2009 Torch Mobile, Inc. + * Copyright (C) 2009 Company 100 Inc. + * + * 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 COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "FileChooser.h" + +#include "FileSystem.h" +#include "LocalizedStrings.h" +#include "StringTruncator.h" + +namespace WebCore { + +String FileChooser::basenameForWidth(const Font& font, int width) const +{ + if (width <= 0) + return String(); + + String string; + if (m_filenames.isEmpty()) + string = fileButtonNoFileSelectedLabel(); + else if (m_filenames.size() == 1) + string = pathGetFileName(m_filenames[0]); + else + return StringTruncator::rightTruncate(String::number(m_filenames.size()) + " files", width, font, false); + + return StringTruncator::centerTruncate(string, width, font, false); +} + +} diff --git a/WebCore/platform/brew/LocalizedStringsBrew.cpp b/WebCore/platform/brew/LocalizedStringsBrew.cpp new file mode 100644 index 0000000..4588f0f --- /dev/null +++ b/WebCore/platform/brew/LocalizedStringsBrew.cpp @@ -0,0 +1,397 @@ +/* + * Copyright (C) 2009 Company 100, 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 COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "LocalizedStrings.h" + +#include "NotImplemented.h" +#include "PlatformString.h" + +namespace WebCore { + +String submitButtonDefaultLabel() +{ + return "Submit"; +} + +String inputElementAltText() +{ + return String(); +} + +String resetButtonDefaultLabel() +{ + return "Reset"; +} + +String defaultLanguage() +{ + return "en"; +} + +String searchableIndexIntroduction() +{ + return "Searchable Index"; +} + +String fileButtonChooseFileLabel() +{ + return "Choose File"; +} + +String fileButtonNoFileSelectedLabel() +{ + return "No file selected"; +} + +String contextMenuItemTagOpenLinkInNewWindow() +{ + return "Open in new tab"; +} + +String contextMenuItemTagDownloadLinkToDisk() +{ + return "Download link to disk"; +} + +String contextMenuItemTagCopyLinkToClipboard() +{ + return "Copy link to clipboard"; +} + +String contextMenuItemTagOpenImageInNewWindow() +{ + return "Open image in new window"; +} + +String contextMenuItemTagDownloadImageToDisk() +{ + return "Download image to disk"; +} + +String contextMenuItemTagCopyImageToClipboard() +{ + return "Copy image to clipboard"; +} + +String contextMenuItemTagOpenFrameInNewWindow() +{ + return "Open frame in new window"; +} + +String contextMenuItemTagCopy() +{ + return "Copy"; +} + +String contextMenuItemTagGoBack() +{ + return "Go back"; +} + +String contextMenuItemTagGoForward() +{ + return "Go forward"; +} + +String contextMenuItemTagStop() +{ + return "Stop"; +} + +String contextMenuItemTagReload() +{ + return "Reload"; +} + +String contextMenuItemTagCut() +{ + return "Cut"; +} + +String contextMenuItemTagPaste() +{ + return "Paste"; +} + +String contextMenuItemTagNoGuessesFound() +{ + return "No guesses found"; +} + +String contextMenuItemTagIgnoreSpelling() +{ + return "Ignore spelling"; +} + +String contextMenuItemTagLearnSpelling() +{ + return "Learn spelling"; +} + +String contextMenuItemTagSearchWeb() +{ + return "Search web"; +} + +String contextMenuItemTagLookUpInDictionary() +{ + return "Lookup in dictionary"; +} + +String contextMenuItemTagOpenLink() +{ + return "Open link"; +} + +String contextMenuItemTagIgnoreGrammar() +{ + return "Ignore grammar"; +} + +String contextMenuItemTagSpellingMenu() +{ + return "Spelling menu"; +} + +String contextMenuItemTagShowSpellingPanel(bool show) +{ + return "Show spelling panel"; +} + +String contextMenuItemTagCheckSpelling() +{ + return "Check spelling"; +} + +String contextMenuItemTagCheckSpellingWhileTyping() +{ + return "Check spelling while typing"; +} + +String contextMenuItemTagCheckGrammarWithSpelling() +{ + return "Check for grammar with spelling"; +} + +String contextMenuItemTagFontMenu() +{ + return "Font menu"; +} + +String contextMenuItemTagBold() +{ + return "Bold"; +} + +String contextMenuItemTagItalic() +{ + return "Italic"; +} + +String contextMenuItemTagUnderline() +{ + return "Underline"; +} + +String contextMenuItemTagOutline() +{ + return "Outline"; +} + +String contextMenuItemTagWritingDirectionMenu() +{ + return "Writing direction menu"; +} + +String contextMenuItemTagDefaultDirection() +{ + return "Default direction"; +} + +String contextMenuItemTagLeftToRight() +{ + return "Left to right"; +} + +String contextMenuItemTagRightToLeft() +{ + return "Right to left"; +} + +String contextMenuItemTagInspectElement() +{ + return "Inspect"; +} + +String searchMenuNoRecentSearchesText() +{ + return "No recent text searches"; +} + +String searchMenuRecentSearchesText() +{ + return "Recent text searches"; +} + +String searchMenuClearRecentSearchesText() +{ + return "Clear recent text searches"; +} + +String unknownFileSizeText() +{ + return "Unknown"; +} + +String AXWebAreaText() +{ + return String(); +} + +String AXLinkText() +{ + return String(); +} + +String AXListMarkerText() +{ + return String(); +} + +String AXImageMapText() +{ + return String(); +} + +String AXHeadingText() +{ + return String(); +} + +String imageTitle(const String& filename, const IntSize& size) +{ + return String(filename); +} + +String contextMenuItemTagTextDirectionMenu() +{ + return String(); +} + +String AXButtonActionVerb() +{ + return String(); +} + +String AXTextFieldActionVerb() +{ + return String(); +} + +String AXRadioButtonActionVerb() +{ + return String(); +} + +String AXCheckedCheckBoxActionVerb() +{ + return String(); +} + +String AXUncheckedCheckBoxActionVerb() +{ + return String(); +} + +String AXLinkActionVerb() +{ + return String(); +} + +String AXMenuListPopupActionVerb() +{ + return String(); +} + +String AXMenuListActionVerb() +{ + return String(); +} + +String AXDefinitionListTermText() +{ + return String(); +} + +String AXDefinitionListDefinitionText() +{ + return String(); +} + +String validationMessageValueMissingText() +{ + notImplemented(); + return String(); +} + +String validationMessageTypeMismatchText() +{ + notImplemented(); + return String(); +} + +String validationMessagePatternMismatchText() +{ + notImplemented(); + return String(); +} + +String validationMessageTooLongText() +{ + notImplemented(); + return String(); +} + +String validationMessageRangeUnderflowText() +{ + notImplemented(); + return String(); +} + +String validationMessageRangeOverflowText() +{ + notImplemented(); + return String(); +} + +String validationMessageStepMismatchText() +{ + notImplemented(); + return String(); +} + +} // namespace WebCore + diff --git a/WebCore/platform/brew/LoggingBrew.cpp b/WebCore/platform/brew/LoggingBrew.cpp new file mode 100644 index 0000000..e8f79f7 --- /dev/null +++ b/WebCore/platform/brew/LoggingBrew.cpp @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2009 Company 100, Inc. + * + * 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 COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "Logging.h" + +namespace WebCore { + +void InitializeLoggingChannelsIfNecessary() +{ + // FIXME: Should read the logging channels from a file. + static bool haveInitializedLoggingChannels = false; + if (haveInitializedLoggingChannels) + return; + + haveInitializedLoggingChannels = true; + + // By default we log calls to notImplemented(). + LogNotYetImplemented.state = WTFLogChannelOn; +} + +} // namespace WebCore + diff --git a/WebCore/platform/brew/MIMETypeRegistryBrew.cpp b/WebCore/platform/brew/MIMETypeRegistryBrew.cpp new file mode 100644 index 0000000..d194116 --- /dev/null +++ b/WebCore/platform/brew/MIMETypeRegistryBrew.cpp @@ -0,0 +1,80 @@ +/* + * Copyright (C) 2006 Zack Rusin <zack@kde.org> + * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2007 Trolltech ASA + * Copyright (C) 2009 Company 100, Inc. + * + * 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 COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "MIMETypeRegistry.h" + +#include "PlatformString.h" + +namespace WebCore { + +struct ExtensionMap { + const char* extension; + const char* mimeType; +}; + +static const ExtensionMap extensionMap[] = { + { "bmp", "image/bmp" }, + { "css", "text/css" }, + { "gif", "image/gif" }, + { "html", "text/html" }, + { "htm", "text/html" }, + { "ico", "image/x-icon" }, + { "jpeg", "image/jpeg" }, + { "jpg", "image/jpeg" }, + { "js", "application/x-javascript" }, + { "pdf", "application/pdf" }, + { "png", "image/png" }, + { "rss", "application/rss+xml" }, + { "svg", "image/svg+xml" }, + { "text", "text/plain" }, + { "txt", "text/plain" }, + { "xbm", "image/x-xbitmap" }, + { "xml", "text/xml" }, + { "xsl", "text/xsl" }, + { "xhtml", "application/xhtml+xml" }, + { 0, 0 } +}; + +String MIMETypeRegistry::getMIMETypeForExtension(const String &ext) +{ + String str = ext.lower(); + + const ExtensionMap* e = extensionMap; + while (e->extension) { + if (str == e->extension) + return e->mimeType; + ++e; + } + + // unknown, let's just assume plain text + return "text/plain"; +} + +} // namespace WebCore + diff --git a/WebCore/platform/brew/ScreenBrew.cpp b/WebCore/platform/brew/ScreenBrew.cpp new file mode 100644 index 0000000..b141b34 --- /dev/null +++ b/WebCore/platform/brew/ScreenBrew.cpp @@ -0,0 +1,96 @@ +/* + * Copyright (C) 2009 Company 100, 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 COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "Screen.h" + +#include "FloatRect.h" +#include "Frame.h" +#include "FrameView.h" +#include "IntRect.h" +#include "NotImplemented.h" +#include "Page.h" +#include "Widget.h" + +#include <AEEAppGen.h> +#include <AEEStdLib.h> + +namespace WebCore { + +struct DisplayInfo { + int width; + int height; + int depth; +}; + +static void getDisplayInfo(DisplayInfo& info) +{ + IDisplay* display = reinterpret_cast<AEEApplet*>(GETAPPINSTANCE())->m_pIDisplay; + IBitmap* bitmap = IDisplay_GetDestination(display); + ASSERT(bitmap); + + AEEBitmapInfo bitmapInfo; + IBitmap_GetInfo(bitmap, &bitmapInfo, sizeof(AEEBitmapInfo)); + + info.width = bitmapInfo.cx; + info.height = bitmapInfo.cy; + info.depth = bitmapInfo.nDepth; + + IBitmap_Release(bitmap); +} + +FloatRect screenRect(Widget*) +{ + DisplayInfo info; + getDisplayInfo(info); + + return FloatRect(0, 0, info.width, info.height); +} + +FloatRect screenAvailableRect(Widget* widget) +{ + return screenRect(widget); +} + +int screenDepth(Widget*) +{ + DisplayInfo info; + getDisplayInfo(info); + + return info.depth; +} + +int screenDepthPerComponent(Widget* widget) +{ + return screenDepth(widget); +} + +bool screenIsMonochrome(Widget*) +{ + return false; +} + +} // namespace WebCore + diff --git a/WebCore/platform/brew/SharedTimerBrew.cpp b/WebCore/platform/brew/SharedTimerBrew.cpp new file mode 100644 index 0000000..d20fe48 --- /dev/null +++ b/WebCore/platform/brew/SharedTimerBrew.cpp @@ -0,0 +1,80 @@ +/* + * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2009 Company 100, Inc. + * + * 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 COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "SharedTimer.h" + +#include <AEEAppGen.h> +#include <AEEStdLib.h> + +#include <wtf/CurrentTime.h> + +namespace WebCore { + +static void (*sharedTimerFiredFunction)(); + +static AEECallback sharedTimerCallback; + +static void invokeCallback(void*) +{ + sharedTimerFiredFunction(); +} + +void setSharedTimerFiredFunction(void (*f)()) +{ + sharedTimerFiredFunction = f; +} + +void setSharedTimerFireTime(double fireTime) +{ + ASSERT(sharedTimerFiredFunction); + + CALLBACK_Cancel(&sharedTimerCallback); + + double interval = fireTime - currentTime(); + int intervalInMS; + + if (interval < 0) + intervalInMS = 0; + else { + interval *= 1000; + intervalInMS = static_cast<int>(interval); + } + + sharedTimerCallback.pfnCancel = 0; + sharedTimerCallback.pfnNotify = invokeCallback; + sharedTimerCallback.pNotifyData = 0; + + IShell* shell = reinterpret_cast<AEEApplet*>(GETAPPINSTANCE())->m_pIShell; + ISHELL_SetTimerEx(shell, intervalInMS, &sharedTimerCallback); +} + +void stopSharedTimer() +{ + CALLBACK_Cancel(&sharedTimerCallback); +} + +} diff --git a/WebCore/platform/brew/SoundBrew.cpp b/WebCore/platform/brew/SoundBrew.cpp new file mode 100644 index 0000000..a616943 --- /dev/null +++ b/WebCore/platform/brew/SoundBrew.cpp @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2009 Company 100, 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 COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "Sound.h" + +#include <AEEAppGen.h> +#include <AEEStdLib.h> + +namespace WebCore { + +void systemBeep() +{ + // systemBeep is used by Editor to notify errors when a user cuts or pastes + // where these operations are not permitted. + // Use BEEP_ERROR with loud volume. + IShell* shell = reinterpret_cast<AEEApplet*>(GETAPPINSTANCE())->m_pIShell; + ISHELL_Beep(shell, BEEP_ERROR, TRUE); +} + +} // namespace WebCore + diff --git a/WebCore/platform/chromium/ThemeChromiumMac.mm b/WebCore/platform/chromium/ThemeChromiumMac.mm index 3c97428..1c14207 100644 --- a/WebCore/platform/chromium/ThemeChromiumMac.mm +++ b/WebCore/platform/chromium/ThemeChromiumMac.mm @@ -21,7 +21,7 @@ * 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. */ #import "config.h" @@ -115,19 +115,19 @@ static void setControlSize(NSCell* cell, const IntSize* sizes, const IntSize& mi static void updateStates(NSCell* cell, ControlStates states) { // Hover state is not supported by Aqua. - + // Pressed state bool oldPressed = [cell isHighlighted]; bool pressed = states & PressedState; if (pressed != oldPressed) [cell setHighlighted:pressed]; - + // Enabled state bool oldEnabled = [cell isEnabled]; bool enabled = states & EnabledState; if (enabled != oldEnabled) [cell setEnabled:enabled]; - + // Focused state bool oldFocused = [cell showsFirstResponder]; bool focused = states & FocusState; @@ -141,7 +141,7 @@ static void updateStates(NSCell* cell, ControlStates states) bool oldChecked = [cell state] == NSOnState; if (oldIndeterminate != indeterminate || checked != oldChecked) [cell setState:indeterminate ? NSMixedState : (checked ? NSOnState : NSOffState)]; - + // Window Inactive state NSControlTint oldTint = [cell controlTint]; bool windowInactive = (states & WindowInactiveState); @@ -197,9 +197,9 @@ static LengthSize checkboxSize(const Font& font, const LengthSize& zoomedSize, f return sizeFromFont(font, zoomedSize, zoomFactor, checkboxSizes()); } -static NSButtonCell* checkbox(ControlStates states, const IntRect& zoomedRect, float zoomFactor) +static NSButtonCell *checkbox(ControlStates states, const IntRect& zoomedRect, float zoomFactor) { - static NSButtonCell* checkboxCell; + static NSButtonCell *checkboxCell; if (!checkboxCell) { checkboxCell = [[NSButtonCell alloc] init]; [checkboxCell setButtonType:NSSwitchButton]; @@ -207,13 +207,13 @@ static NSButtonCell* checkbox(ControlStates states, const IntRect& zoomedRect, f [checkboxCell setAllowsMixedState:YES]; [checkboxCell setFocusRingType:NSFocusRingTypeExterior]; } - + // Set the control size based off the rectangle we're painting into. setControlSize(checkboxCell, checkboxSizes(), zoomedRect.size(), zoomFactor); // Update the various states we respond to. updateStates(checkboxCell, states); - + return checkboxCell; } @@ -223,7 +223,7 @@ static void paintCheckbox(ControlStates states, GraphicsContext* context, const BEGIN_BLOCK_OBJC_EXCEPTIONS // Determine the width and height needed for the control and prepare the cell for painting. - NSButtonCell* checkboxCell = checkbox(states, zoomedRect, zoomFactor); + NSButtonCell *checkboxCell = checkbox(states, zoomedRect, zoomFactor); context->save(); @@ -232,7 +232,7 @@ static void paintCheckbox(ControlStates states, GraphicsContext* context, const zoomedSize.setWidth(zoomedSize.width() * zoomFactor); zoomedSize.setHeight(zoomedSize.height() * zoomFactor); IntRect inflatedRect = inflateRect(zoomedRect, zoomedSize, checkboxMargins(controlSize), zoomFactor); - + if (zoomFactor != 1.0f) { inflatedRect.setWidth(inflatedRect.width() / zoomFactor); inflatedRect.setHeight(inflatedRect.height() / zoomFactor); @@ -240,12 +240,12 @@ static void paintCheckbox(ControlStates states, GraphicsContext* context, const context->scale(FloatSize(zoomFactor, zoomFactor)); context->translate(-inflatedRect.x(), -inflatedRect.y()); } - + [checkboxCell drawWithFrame:NSRect(inflatedRect) inView:FlippedView()]; [checkboxCell setControlView:nil]; context->restore(); - + END_BLOCK_OBJC_EXCEPTIONS } @@ -278,29 +278,29 @@ static LengthSize radioSize(const Font& font, const LengthSize& zoomedSize, floa return sizeFromFont(font, zoomedSize, zoomFactor, radioSizes()); } -static NSButtonCell* radio(ControlStates states, const IntRect& zoomedRect, float zoomFactor) +static NSButtonCell *radio(ControlStates states, const IntRect& zoomedRect, float zoomFactor) { - static NSButtonCell* radioCell; + static NSButtonCell *radioCell; if (!radioCell) { radioCell = [[NSButtonCell alloc] init]; [radioCell setButtonType:NSRadioButton]; [radioCell setTitle:nil]; [radioCell setFocusRingType:NSFocusRingTypeExterior]; } - + // Set the control size based off the rectangle we're painting into. setControlSize(radioCell, radioSizes(), zoomedRect.size(), zoomFactor); // Update the various states we respond to. updateStates(radioCell, states); - + return radioCell; } static void paintRadio(ControlStates states, GraphicsContext* context, const IntRect& zoomedRect, float zoomFactor, ScrollView* scrollView) { // Determine the width and height needed for the control and prepare the cell for painting. - NSButtonCell* radioCell = radio(states, zoomedRect, zoomFactor); + NSButtonCell *radioCell = radio(states, zoomedRect, zoomFactor); context->save(); @@ -309,7 +309,7 @@ static void paintRadio(ControlStates states, GraphicsContext* context, const Int zoomedSize.setWidth(zoomedSize.width() * zoomFactor); zoomedSize.setHeight(zoomedSize.height() * zoomFactor); IntRect inflatedRect = inflateRect(zoomedRect, zoomedSize, radioMargins(controlSize), zoomFactor); - + if (zoomFactor != 1.0f) { inflatedRect.setWidth(inflatedRect.width() / zoomFactor); inflatedRect.setHeight(inflatedRect.height() / zoomFactor); @@ -317,7 +317,7 @@ static void paintRadio(ControlStates states, GraphicsContext* context, const Int context->scale(FloatSize(zoomFactor, zoomFactor)); context->translate(-inflatedRect.x(), -inflatedRect.y()); } - + BEGIN_BLOCK_OBJC_EXCEPTIONS [radioCell drawWithFrame:NSRect(inflatedRect) inView:FlippedView()]; [radioCell setControlView:nil]; @@ -335,6 +335,14 @@ static const IntSize* buttonSizes() return sizes; } +#if ENABLE(DATALIST) +static const IntSize* listButtonSizes() +{ + static const IntSize sizes[3] = { IntSize(21, 21), IntSize(19, 18), IntSize(17, 16) }; + return sizes; +} +#endif + static const int* buttonMargins(NSControlSize controlSize) { static const int margins[3][4] = @@ -346,17 +354,24 @@ static const int* buttonMargins(NSControlSize controlSize) return margins[controlSize]; } -static NSButtonCell* button(ControlPart part, ControlStates states, const IntRect& zoomedRect, float zoomFactor) +static void setupButtonCell(NSButtonCell *&buttonCell, ControlPart part, ControlStates states, const IntRect& zoomedRect, float zoomFactor) { - static NSButtonCell *buttonCell; - static bool defaultButton; if (!buttonCell) { buttonCell = [[NSButtonCell alloc] init]; [buttonCell setTitle:nil]; [buttonCell setButtonType:NSMomentaryPushInButton]; + if (states & DefaultState) + [buttonCell setKeyEquivalent:@"\r"]; } // Set the control size based off the rectangle we're painting into. + const IntSize* sizes = buttonSizes(); +#if ENABLE(DATALIST) + if (part == ListButtonPart) { + [buttonCell setBezelStyle:NSRoundedDisclosureBezelStyle]; + sizes = listButtonSizes(); + } else +#endif if (part == SquareButtonPart || zoomedRect.height() > buttonSizes()[NSRegularControlSize].height() * zoomFactor) { // Use the square button if ([buttonCell bezelStyle] != NSShadowlessSquareBezelStyle) @@ -364,29 +379,34 @@ static NSButtonCell* button(ControlPart part, ControlStates states, const IntRec } else if ([buttonCell bezelStyle] != NSRoundedBezelStyle) [buttonCell setBezelStyle:NSRoundedBezelStyle]; - setControlSize(buttonCell, buttonSizes(), zoomedRect.size(), zoomFactor); - - if (defaultButton != (states & DefaultState)) { - defaultButton = !defaultButton; - [buttonCell setKeyEquivalent:(defaultButton ? @"\r" : @"")]; - } + setControlSize(buttonCell, sizes, zoomedRect.size(), zoomFactor); // Update the various states we respond to. updateStates(buttonCell, states); - - return buttonCell; +} + +static NSButtonCell *button(ControlPart part, ControlStates states, const IntRect& zoomedRect, float zoomFactor) +{ + bool isDefault = states & DefaultState; + static NSButtonCell *cells[2]; + setupButtonCell(cells[isDefault], part, states, zoomedRect, zoomFactor); + return cells[isDefault]; } static void paintButton(ControlPart part, ControlStates states, GraphicsContext* context, const IntRect& zoomedRect, float zoomFactor, ScrollView* scrollView) { BEGIN_BLOCK_OBJC_EXCEPTIONS - + // Determine the width and height needed for the control and prepare the cell for painting. NSButtonCell *buttonCell = button(part, states, zoomedRect, zoomFactor); LocalCurrentGraphicsContext localContext(context); NSControlSize controlSize = [buttonCell controlSize]; +#if ENABLE(DATALIST) + IntSize zoomedSize = (part == ListButtonPart ? listButtonSizes() : buttonSizes())[controlSize]; +#else IntSize zoomedSize = buttonSizes()[controlSize]; +#endif zoomedSize.setWidth(zoomedRect.width()); // Buttons don't ever constrain width, so the zoomed width can just be honored. zoomedSize.setHeight(zoomedSize.height() * zoomFactor); IntRect inflatedRect = zoomedRect; @@ -407,7 +427,7 @@ static void paintButton(ControlPart part, ControlStates states, GraphicsContext* context->scale(FloatSize(zoomFactor, zoomFactor)); context->translate(-inflatedRect.x(), -inflatedRect.y()); } - } + } [buttonCell drawWithFrame:NSRect(inflatedRect) inView:FlippedView()]; [buttonCell setControlView:nil]; @@ -453,6 +473,10 @@ LengthSize ThemeChromiumMac::controlSize(ControlPart part, const Font& font, con case PushButtonPart: // Height is reset to auto so that specified heights can be ignored. return sizeFromFont(font, LengthSize(zoomedSize.width(), Length()), zoomFactor, buttonSizes()); +#if ENABLE(DATALIST) + case ListButtonPart: + return sizeFromFont(font, LengthSize(zoomedSize.width(), Length()), zoomFactor, listButtonSizes()); +#endif default: return zoomedSize; } @@ -464,6 +488,7 @@ LengthSize ThemeChromiumMac::minimumControlSize(ControlPart part, const Font& fo case SquareButtonPart: case DefaultButtonPart: case ButtonPart: + case ListButtonPart: return LengthSize(Length(0, Fixed), Length(static_cast<int>(15 * zoomFactor), Fixed)); default: return Theme::minimumControlSize(part, font, zoomFactor); @@ -476,6 +501,7 @@ LengthBox ThemeChromiumMac::controlBorder(ControlPart part, const Font& font, co case SquareButtonPart: case DefaultButtonPart: case ButtonPart: + case ListButtonPart: return LengthBox(0, zoomedBox.right().value(), 0, zoomedBox.left().value()); default: return Theme::controlBorder(part, font, zoomedBox, zoomFactor); @@ -559,6 +585,7 @@ void ThemeChromiumMac::paint(ControlPart part, ControlStates states, GraphicsCon case DefaultButtonPart: case ButtonPart: case SquareButtonPart: + case ListButtonPart: paintButton(part, states, context, zoomedRect, zoomFactor, scrollView); break; default: diff --git a/WebCore/platform/graphics/GraphicsContext.h b/WebCore/platform/graphics/GraphicsContext.h index 063c490..5199d93 100644 --- a/WebCore/platform/graphics/GraphicsContext.h +++ b/WebCore/platform/graphics/GraphicsContext.h @@ -119,6 +119,7 @@ namespace WebCore { const int cMisspellingLinePatternWidth = 4; const int cMisspellingLinePatternGapWidth = 1; + class AffineTransform; class Font; class Generator; class Gradient; @@ -339,7 +340,9 @@ namespace WebCore { void setURLForRect(const KURL&, const IntRect&); void concatCTM(const TransformationMatrix&); + void concatCTM(const AffineTransform&); TransformationMatrix getCTM() const; + AffineTransform getAffineCTM() const; #if OS(WINCE) && !PLATFORM(QT) void setBitmap(PassRefPtr<SharedBitmap>); diff --git a/WebCore/platform/graphics/IntPoint.h b/WebCore/platform/graphics/IntPoint.h index ab5f3ec..5137485 100644 --- a/WebCore/platform/graphics/IntPoint.h +++ b/WebCore/platform/graphics/IntPoint.h @@ -63,6 +63,10 @@ class BPoint; class wxPoint; #endif +#if PLATFORM(BREWMP) +typedef struct _point AEEPoint; +#endif + #if PLATFORM(SKIA) struct SkPoint; struct SkIPoint; @@ -133,6 +137,11 @@ public: operator wxPoint() const; #endif +#if PLATFORM(BREWMP) + IntPoint(const AEEPoint&); + operator AEEPoint() const; +#endif + #if PLATFORM(SKIA) IntPoint(const SkIPoint&); operator SkIPoint() const; diff --git a/WebCore/platform/graphics/IntSize.h b/WebCore/platform/graphics/IntSize.h index 13d9e22..6938afd 100644 --- a/WebCore/platform/graphics/IntSize.h +++ b/WebCore/platform/graphics/IntSize.h @@ -55,6 +55,10 @@ class BSize; class wxSize; #endif +#if PLATFORM(BREWMP) +typedef struct AEESize AEESize; +#endif + namespace WebCore { class IntSize { @@ -130,6 +134,11 @@ public: operator wxSize() const; #endif +#if PLATFORM(BREWMP) + IntSize(const AEESize&); + operator AEESize() const; +#endif + private: int m_width, m_height; }; diff --git a/WebCore/platform/graphics/MediaPlayer.cpp b/WebCore/platform/graphics/MediaPlayer.cpp index aed9c95..2b09885 100644 --- a/WebCore/platform/graphics/MediaPlayer.cpp +++ b/WebCore/platform/graphics/MediaPlayer.cpp @@ -89,6 +89,9 @@ public: virtual void setVolume(float) { } + virtual bool supportsMuting() const { return false; } + virtual void setMuted(bool) { } + virtual bool hasClosedCaptions() const { return false; } virtual void setClosedCaptionsVisible(bool) { }; @@ -195,6 +198,7 @@ MediaPlayer::MediaPlayer(MediaPlayerClient* client) , m_visible(false) , m_rate(1.0f) , m_volume(1.0f) + , m_muted(false) , m_preservesPitch(true) , m_autobuffer(false) #if ENABLE(PLUGIN_PROXY_FOR_VIDEO) @@ -381,6 +385,22 @@ void MediaPlayer::setVolume(float volume) m_private->setVolume(volume); } +bool MediaPlayer::muted() const +{ + return m_muted; +} + +bool MediaPlayer::supportsMuting() const +{ + return m_private->supportsMuting(); +} + +void MediaPlayer::setMuted(bool muted) +{ + m_muted = muted; + m_private->setMuted(muted); +} + bool MediaPlayer::hasClosedCaptions() const { return m_private->hasClosedCaptions(); @@ -544,12 +564,20 @@ void MediaPlayer::readyStateChanged() m_mediaPlayerClient->mediaPlayerReadyStateChanged(this); } -void MediaPlayer::volumeChanged() +void MediaPlayer::volumeChanged(float newVolume) { + m_volume = newVolume; if (m_mediaPlayerClient) m_mediaPlayerClient->mediaPlayerVolumeChanged(this); } +void MediaPlayer::muteChanged(bool newMuted) +{ + m_muted = newMuted; + if (m_mediaPlayerClient) + m_mediaPlayerClient->mediaPlayerMuteChanged(this); +} + void MediaPlayer::timeChanged() { if (m_mediaPlayerClient) diff --git a/WebCore/platform/graphics/MediaPlayer.h b/WebCore/platform/graphics/MediaPlayer.h index fa85cfd..40ed8ae 100644 --- a/WebCore/platform/graphics/MediaPlayer.h +++ b/WebCore/platform/graphics/MediaPlayer.h @@ -81,9 +81,12 @@ public: // the ready state has changed virtual void mediaPlayerReadyStateChanged(MediaPlayer*) { } - // the volume or muted state has changed + // the volume state has changed virtual void mediaPlayerVolumeChanged(MediaPlayer*) { } + // the mute state has changed + virtual void mediaPlayerMuteChanged(MediaPlayer*) { } + // time has jumped, eg. not as a result of normal playback virtual void mediaPlayerTimeChanged(MediaPlayer*) { } @@ -177,6 +180,10 @@ public: float volume() const; void setVolume(float); + bool supportsMuting() const; + bool muted() const; + void setMuted(bool); + bool hasClosedCaptions() const; void setClosedCaptionsVisible(bool closedCaptionsVisible); @@ -197,7 +204,8 @@ public: void networkStateChanged(); void readyStateChanged(); - void volumeChanged(); + void volumeChanged(float); + void muteChanged(bool); void timeChanged(); void sizeChanged(); void rateChanged(); @@ -239,6 +247,7 @@ private: bool m_visible; float m_rate; float m_volume; + bool m_muted; bool m_preservesPitch; bool m_autobuffer; #if ENABLE(PLUGIN_PROXY_FOR_VIDEO) diff --git a/WebCore/platform/graphics/MediaPlayerPrivate.h b/WebCore/platform/graphics/MediaPlayerPrivate.h index 6cf12ba..3b7c4d4 100644 --- a/WebCore/platform/graphics/MediaPlayerPrivate.h +++ b/WebCore/platform/graphics/MediaPlayerPrivate.h @@ -74,6 +74,9 @@ public: virtual void setVolume(float) = 0; + virtual bool supportsMuting() const { return false; } + virtual void setMuted(bool) { } + virtual bool hasClosedCaptions() const { return false; } virtual void setClosedCaptionsVisible(bool) { } diff --git a/WebCore/platform/graphics/Path.h b/WebCore/platform/graphics/Path.h index 79d6cc4..aad6f3e 100644 --- a/WebCore/platform/graphics/Path.h +++ b/WebCore/platform/graphics/Path.h @@ -67,6 +67,7 @@ typedef PlatformPath* PlatformPathPtr; namespace WebCore { + class AffineTransform; class FloatPoint; class FloatRect; class FloatSize; @@ -145,6 +146,7 @@ namespace WebCore { static Path createLine(const FloatPoint&, const FloatPoint&); void apply(void* info, PathApplierFunction) const; + void transform(const AffineTransform&); void transform(const TransformationMatrix&); private: diff --git a/WebCore/platform/graphics/Pattern.cpp b/WebCore/platform/graphics/Pattern.cpp index d388bd7..3409d16 100644 --- a/WebCore/platform/graphics/Pattern.cpp +++ b/WebCore/platform/graphics/Pattern.cpp @@ -35,12 +35,32 @@ Pattern::Pattern(Image* image, bool repeatX, bool repeatY) : m_tileImage(image) , m_repeatX(repeatX) , m_repeatY(repeatY) +#if PLATFORM(SKIA) + , m_pattern(0) +#endif { ASSERT(image); } Pattern::~Pattern() { + platformDestroy(); } +void Pattern::setPatternSpaceTransform(const TransformationMatrix& patternSpaceTransformation) +{ + m_patternSpaceTransformation = patternSpaceTransformation; + setPlatformPatternSpaceTransform(); +} + +#if !PLATFORM(SKIA) +void Pattern::platformDestroy() +{ +} + +void Pattern::setPlatformPatternSpaceTransform() +{ +} +#endif + } diff --git a/WebCore/platform/graphics/Pattern.h b/WebCore/platform/graphics/Pattern.h index f7f612a..b0188b9 100644 --- a/WebCore/platform/graphics/Pattern.h +++ b/WebCore/platform/graphics/Pattern.h @@ -74,9 +74,16 @@ namespace WebCore { Image* tileImage() const { return m_tileImage.get(); } + void platformDestroy(); + // Pattern space is an abstract space that maps to the default user space by the transformation 'userSpaceTransformation' +#if PLATFORM(SKIA) + PlatformPatternPtr platformPattern(const TransformationMatrix& userSpaceTransformation); +#else PlatformPatternPtr createPlatformPattern(const TransformationMatrix& userSpaceTransformation) const; - void setPatternSpaceTransform(const TransformationMatrix& patternSpaceTransformation) { m_patternSpaceTransformation = patternSpaceTransformation; } +#endif + void setPatternSpaceTransform(const TransformationMatrix& patternSpaceTransformation); + void setPlatformPatternSpaceTransform(); private: Pattern(Image*, bool repeatX, bool repeatY); @@ -85,6 +92,7 @@ namespace WebCore { bool m_repeatX; bool m_repeatY; TransformationMatrix m_patternSpaceTransformation; + PlatformPatternPtr m_pattern; }; } //namespace diff --git a/WebCore/platform/graphics/brew/IntPointBrew.cpp b/WebCore/platform/graphics/brew/IntPointBrew.cpp new file mode 100644 index 0000000..8792b1d --- /dev/null +++ b/WebCore/platform/graphics/brew/IntPointBrew.cpp @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2009 Company 100, 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 COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "IntPoint.h" + +#include <AEEPoint.h> + +namespace WebCore { + +IntPoint::IntPoint(const AEEPoint& point) + : m_x(point.x) + , m_y(point.y) +{ +} + +IntPoint::operator AEEPoint() const +{ + AEEPoint point; + point.x = static_cast<int16>(m_x); + point.y = static_cast<int16>(m_y); + return point; +} + +} // namespace WebCore + diff --git a/WebCore/platform/graphics/brew/IntSizeBrew.cpp b/WebCore/platform/graphics/brew/IntSizeBrew.cpp new file mode 100644 index 0000000..01c3365 --- /dev/null +++ b/WebCore/platform/graphics/brew/IntSizeBrew.cpp @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2009 Company 100, 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 COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "IntSize.h" + +#include <AEE.h> + +namespace WebCore { + +IntSize::IntSize(const AEESize& size) + : m_width(size.cx) + , m_height(size.cy) +{ +} + +IntSize::operator AEESize() const +{ + AEESize size; + size.cx = width(); + size.cy = height(); + return size; +} + +} // namespace WebCore + diff --git a/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp b/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp index d866b6c..ccbbf3b 100644 --- a/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp +++ b/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp @@ -32,6 +32,7 @@ #if PLATFORM(CAIRO) +#include "AffineTransform.h" #include "CairoPath.h" #include "FEGaussianBlur.h" #include "FloatRect.h" @@ -216,6 +217,14 @@ TransformationMatrix GraphicsContext::getCTM() const return TransformationMatrix(m.xx, m.yx, m.xy, m.yy, m.x0, m.y0); } +AffineTransform GraphicsContext::getAffineCTM() const +{ + cairo_t* cr = platformContext(); + cairo_matrix_t m; + cairo_get_matrix(cr, &m); + return AffineTransform(m.xx, m.yx, m.xy, m.yy, m.x0, m.y0); +} + cairo_t* GraphicsContext::platformContext() const { return m_data->cr; @@ -802,6 +811,17 @@ void GraphicsContext::concatCTM(const TransformationMatrix& transform) m_data->concatCTM(transform); } +void GraphicsContext::concatCTM(const AffineTransform& transform) +{ + if (paintingDisabled()) + return; + + cairo_t* cr = m_data->cr; + const cairo_matrix_t matrix = cairo_matrix_t(transform); + cairo_transform(cr, &matrix); + m_data->concatCTM(transform); +} + void GraphicsContext::addInnerRoundedRectClip(const IntRect& rect, int thickness) { if (paintingDisabled()) diff --git a/WebCore/platform/graphics/cairo/GraphicsContextPlatformPrivateCairo.h b/WebCore/platform/graphics/cairo/GraphicsContextPlatformPrivateCairo.h index cedc684..5e38832 100644 --- a/WebCore/platform/graphics/cairo/GraphicsContextPlatformPrivateCairo.h +++ b/WebCore/platform/graphics/cairo/GraphicsContextPlatformPrivateCairo.h @@ -71,6 +71,7 @@ public: void scale(const FloatSize&); void rotate(float); void translate(float, float); + void concatCTM(const AffineTransform&); void concatCTM(const TransformationMatrix&); void beginTransparencyLayer() { m_transparencyCount++; } void endTransparencyLayer() { m_transparencyCount--; } @@ -85,6 +86,7 @@ public: void scale(const FloatSize&) {} void rotate(float) {} void translate(float, float) {} + void concatCTM(const AffineTransform&) {} void concatCTM(const TransformationMatrix&) {} void beginTransparencyLayer() {} void endTransparencyLayer() {} diff --git a/WebCore/platform/graphics/cairo/PathCairo.cpp b/WebCore/platform/graphics/cairo/PathCairo.cpp index 8bde57e..a265937 100644 --- a/WebCore/platform/graphics/cairo/PathCairo.cpp +++ b/WebCore/platform/graphics/cairo/PathCairo.cpp @@ -25,6 +25,7 @@ #include "config.h" #include "Path.h" +#include "AffineTransform.h" #include "TransformationMatrix.h" #include "CairoPath.h" #include "FloatRect.h" @@ -326,6 +327,14 @@ void Path::apply(void* info, PathApplierFunction function) const cairo_path_destroy(path); } +void Path::transform(const AffineTransform& trans) +{ + cairo_t* m_cr = platformPath()->m_cr; + cairo_matrix_t c_matrix = cairo_matrix_t(trans); + cairo_matrix_invert(&c_matrix); + cairo_transform(m_cr, &c_matrix); +} + void Path::transform(const TransformationMatrix& trans) { cairo_t* m_cr = platformPath()->m_cr; diff --git a/WebCore/platform/graphics/cairo/TransformationMatrixCairo.cpp b/WebCore/platform/graphics/cairo/TransformationMatrixCairo.cpp index 1b83a29..c73dd02 100644 --- a/WebCore/platform/graphics/cairo/TransformationMatrixCairo.cpp +++ b/WebCore/platform/graphics/cairo/TransformationMatrixCairo.cpp @@ -23,6 +23,7 @@ */ #include "config.h" +#include "AffineTransform.h" #include "TransformationMatrix.h" #include "IntRect.h" @@ -46,6 +47,20 @@ TransformationMatrix::operator cairo_matrix_t() const return m; } +AffineTransform::operator cairo_matrix_t() const +{ + cairo_matrix_t m; + + cairo_matrix_init (&m, + a(), + b(), + c(), + d(), + e(), + f()); + return m; +} + } // vim: ts=4 sw=4 et diff --git a/WebCore/platform/graphics/cg/GraphicsContextCG.cpp b/WebCore/platform/graphics/cg/GraphicsContextCG.cpp index b11ba66..a339982 100644 --- a/WebCore/platform/graphics/cg/GraphicsContextCG.cpp +++ b/WebCore/platform/graphics/cg/GraphicsContextCG.cpp @@ -28,6 +28,7 @@ #include "config.h" #include "GraphicsContext.h" +#include "AffineTransform.h" #include "FloatConversion.h" #include "GraphicsContextPlatformPrivateCG.h" #include "GraphicsContextPrivate.h" @@ -958,6 +959,15 @@ void GraphicsContext::translate(float x, float y) m_data->m_userToDeviceTransformKnownToBeIdentity = false; } +void GraphicsContext::concatCTM(const AffineTransform& transform) +{ + if (paintingDisabled()) + return; + CGContextConcatCTM(platformContext(), transform); + m_data->concatCTM(transform); + m_data->m_userToDeviceTransformKnownToBeIdentity = false; +} + void GraphicsContext::concatCTM(const TransformationMatrix& transform) { if (paintingDisabled()) @@ -967,6 +977,12 @@ void GraphicsContext::concatCTM(const TransformationMatrix& transform) m_data->m_userToDeviceTransformKnownToBeIdentity = false; } +AffineTransform GraphicsContext::getAffineCTM() const +{ + CGAffineTransform t = CGContextGetCTM(platformContext()); + return AffineTransform(t.a, t.b, t.c, t.d, t.tx, t.ty); +} + TransformationMatrix GraphicsContext::getCTM() const { CGAffineTransform t = CGContextGetCTM(platformContext()); diff --git a/WebCore/platform/graphics/cg/GraphicsContextPlatformPrivateCG.h b/WebCore/platform/graphics/cg/GraphicsContextPlatformPrivateCG.h index ff1816f..7b80d5b 100644 --- a/WebCore/platform/graphics/cg/GraphicsContextPlatformPrivateCG.h +++ b/WebCore/platform/graphics/cg/GraphicsContextPlatformPrivateCG.h @@ -73,6 +73,7 @@ public: void scale(const FloatSize&) {} void rotate(float) {} void translate(float, float) {} + void concatCTM(const AffineTransform&) {} void concatCTM(const TransformationMatrix&) {} void beginTransparencyLayer() {} void endTransparencyLayer() {} @@ -88,6 +89,7 @@ public: void scale(const FloatSize&); void rotate(float); void translate(float, float); + void concatCTM(const AffineTransform&); void concatCTM(const TransformationMatrix&); void beginTransparencyLayer() { m_transparencyCount++; } void endTransparencyLayer() { m_transparencyCount--; } diff --git a/WebCore/platform/graphics/cg/PathCG.cpp b/WebCore/platform/graphics/cg/PathCG.cpp index 3b05641..01680df 100644 --- a/WebCore/platform/graphics/cg/PathCG.cpp +++ b/WebCore/platform/graphics/cg/PathCG.cpp @@ -29,6 +29,7 @@ #if PLATFORM(CG) +#include "AffineTransform.h" #include "TransformationMatrix.h" #include <ApplicationServices/ApplicationServices.h> #include "FloatRect.h" @@ -346,6 +347,15 @@ void Path::apply(void* info, PathApplierFunction function) const CGPathApply(m_path, &pinfo, CGPathApplierToPathApplier); } +void Path::transform(const AffineTransform& transform) +{ + CGMutablePathRef path = CGPathCreateMutable(); + CGAffineTransform transformCG = transform; + CGPathAddPath(path, &transformCG, m_path); + CGPathRelease(m_path); + m_path = path; +} + void Path::transform(const TransformationMatrix& transform) { CGMutablePathRef path = CGPathCreateMutable(); diff --git a/WebCore/platform/graphics/cg/TransformationMatrixCG.cpp b/WebCore/platform/graphics/cg/TransformationMatrixCG.cpp index 568a6b3..5fe2122 100644 --- a/WebCore/platform/graphics/cg/TransformationMatrixCG.cpp +++ b/WebCore/platform/graphics/cg/TransformationMatrixCG.cpp @@ -24,6 +24,7 @@ */ #include "config.h" +#include "AffineTransform.h" #include "TransformationMatrix.h" #if PLATFORM(CG) @@ -43,6 +44,16 @@ TransformationMatrix::operator CGAffineTransform() const narrowPrecisionToCGFloat(f())); } +AffineTransform::operator CGAffineTransform() const +{ + return CGAffineTransformMake(narrowPrecisionToCGFloat(a()), + narrowPrecisionToCGFloat(b()), + narrowPrecisionToCGFloat(c()), + narrowPrecisionToCGFloat(d()), + narrowPrecisionToCGFloat(e()), + narrowPrecisionToCGFloat(f())); +} + } #endif // PLATFORM(CG) diff --git a/WebCore/platform/graphics/gtk/MediaPlayerPrivateGStreamer.cpp b/WebCore/platform/graphics/gtk/MediaPlayerPrivateGStreamer.cpp index 41f90f0..0372021 100644 --- a/WebCore/platform/graphics/gtk/MediaPlayerPrivateGStreamer.cpp +++ b/WebCore/platform/graphics/gtk/MediaPlayerPrivateGStreamer.cpp @@ -32,6 +32,7 @@ #include "Document.h" #include "Frame.h" #include "FrameView.h" +#include "GOwnPtrGtk.h" #include "GraphicsContext.h" #include "IntRect.h" #include "KURL.h" @@ -131,63 +132,87 @@ gboolean mediaPlayerPrivateMessageCallback(GstBus* bus, GstMessage* message, gpo void mediaPlayerPrivateSourceChangedCallback(GObject *object, GParamSpec *pspec, gpointer data) { MediaPlayerPrivate* mp = reinterpret_cast<MediaPlayerPrivate*>(data); - GstElement* element; + GOwnPtr<GstElement> element; - g_object_get(mp->m_playBin, "source", &element, NULL); - gst_object_replace((GstObject**) &mp->m_source, (GstObject*) element); + g_object_get(mp->m_playBin, "source", &element.outPtr(), NULL); + gst_object_replace((GstObject**) &mp->m_source, (GstObject*) element.get()); - if (element) { - GParamSpec* pspec = g_object_class_find_property(G_OBJECT_GET_CLASS(element), "cookies"); + if (!element) + return; - // First check if the source element has a cookies property - // of the format we expect - if (!pspec || pspec->value_type != G_TYPE_STRV) - return; + GOwnPtr<char> location; + g_object_get(element.get(), "location", &location.outPtr(), NULL); - // Then get the cookies for the URI and set them - SoupSession* session = webkit_get_default_session(); - SoupCookieJar* cookieJar = SOUP_COOKIE_JAR(soup_session_get_feature(session, SOUP_TYPE_COOKIE_JAR)); + // Do injection only for elements dealing with uris. + if (!gst_uri_is_valid(location.get())) + return; - char* location; - g_object_get(element, "location", &location, NULL); + GOwnPtr<SoupURI> uri(soup_uri_new(location.get())); - SoupURI* uri = soup_uri_new(location); - g_free(location); + // Do injection only for http(s) uris. + if (!SOUP_URI_VALID_FOR_HTTP(uri)) + return; - // Let Apple web servers know we want to access their nice movie trailers. - if (g_str_equal(uri->host, "movies.apple.com")) - g_object_set(element, "user-agent", "Quicktime/7.2.0", NULL); + // Let Apple web servers know we want to access their nice movie trailers. + if (g_str_equal(uri->host, "movies.apple.com")) + g_object_set(element.get(), "user-agent", "Quicktime/7.2.0", NULL); + + // Set the HTTP referer. + Frame* frame = mp->m_player->frameView() ? mp->m_player->frameView()->frame() : 0; + Document* document = frame ? frame->document() : 0; + if (document) { + GstStructure* extraHeaders = gst_structure_new("extra-headers", + "Referer", G_TYPE_STRING, + document->documentURI().utf8().data(), 0); + g_object_set(element.get(), "extra-headers", extraHeaders, NULL); + gst_structure_free(extraHeaders); + } - char* cookies = soup_cookie_jar_get_cookies(cookieJar, uri, FALSE); - soup_uri_free(uri); + // Deal with the cookies from now on. + GParamSpec* cookiesParamSpec = g_object_class_find_property(G_OBJECT_GET_CLASS(element.get()), "cookies"); - char* cookiesStrv[] = {cookies, NULL}; - g_object_set(element, "cookies", cookiesStrv, NULL); - g_free(cookies); + // First check if the source element has a cookies property + // of the format we expect + if (!cookiesParamSpec || cookiesParamSpec->value_type != G_TYPE_STRV) + return; - Frame* frame = mp->m_player->frameView() ? mp->m_player->frameView()->frame() : 0; - Document* document = frame ? frame->document() : 0; - if (document) { - GstStructure* extraHeaders = gst_structure_new("extra-headers", - "Referer", G_TYPE_STRING, - document->documentURI().utf8().data(), 0); - g_object_set(element, "extra-headers", extraHeaders, NULL); - gst_structure_free(extraHeaders); - } - } + // Then get the cookies for the URI and set them + SoupSession* session = webkit_get_default_session(); + SoupSessionFeature* cookieJarFeature = soup_session_get_feature(session, SOUP_TYPE_COOKIE_JAR); + if (!cookieJarFeature) + return; - gst_object_unref(element); + SoupCookieJar* cookieJar = SOUP_COOKIE_JAR(cookieJarFeature); + GOwnPtr<char> cookies(soup_cookie_jar_get_cookies(cookieJar, uri.get(), FALSE)); + char* cookiesStrv[] = {cookies.get(), 0}; + g_object_set(element.get(), "cookies", cookiesStrv, NULL); } void mediaPlayerPrivateVolumeChangedCallback(GObject *element, GParamSpec *pspec, gpointer data) { + // This is called when playbin receives the notify::volume signal. MediaPlayerPrivate* mp = reinterpret_cast<MediaPlayerPrivate*>(data); mp->volumeChanged(); } -gboolean notifyVolumeIdleCallback(MediaPlayer* mp) +gboolean notifyVolumeIdleCallback(gpointer data) { - mp->volumeChanged(); + MediaPlayerPrivate* mp = reinterpret_cast<MediaPlayerPrivate*>(data); + mp->volumeChangedCallback(); + return FALSE; +} + +void mediaPlayerPrivateMuteChangedCallback(GObject *element, GParamSpec *pspec, gpointer data) +{ + // This is called when playbin receives the notify::mute signal. + MediaPlayerPrivate* mp = reinterpret_cast<MediaPlayerPrivate*>(data); + mp->muteChanged(); +} + +gboolean notifyMuteIdleCallback(gpointer data) +{ + MediaPlayerPrivate* mp = reinterpret_cast<MediaPlayerPrivate*>(data); + mp->muteChangedCallback(); return FALSE; } @@ -291,8 +316,9 @@ MediaPlayerPrivate::MediaPlayerPrivate(MediaPlayer* player) , m_seeking(false) , m_playbackRate(1) , m_errorOccured(false) - , m_volumeIdleId(-1) + , m_volumeIdleId(0) , m_mediaDuration(0.0) + , m_muteIdleId(0) { doGstInit(); } @@ -301,7 +327,12 @@ MediaPlayerPrivate::~MediaPlayerPrivate() { if (m_volumeIdleId) { g_source_remove(m_volumeIdleId); - m_volumeIdleId = -1; + m_volumeIdleId = 0; + } + + if (m_muteIdleId) { + g_source_remove(m_muteIdleId); + m_muteIdleId = 0; } if (m_buffer) @@ -532,16 +563,20 @@ void MediaPlayerPrivate::setVolume(float volume) g_object_set(m_playBin, "volume", static_cast<double>(volume), NULL); } +void MediaPlayerPrivate::volumeChangedCallback() +{ + double volume; + g_object_get(m_playBin, "volume", &volume, NULL); + m_player->volumeChanged(static_cast<float>(volume)); +} + void MediaPlayerPrivate::volumeChanged() { - if (m_volumeIdleId) { + if (m_volumeIdleId) g_source_remove(m_volumeIdleId); - m_volumeIdleId = -1; - } - m_volumeIdleId = g_idle_add((GSourceFunc) notifyVolumeIdleCallback, m_player); + m_volumeIdleId = g_idle_add((GSourceFunc) notifyVolumeIdleCallback, this); } - void MediaPlayerPrivate::setRate(float rate) { // Avoid useless playback rate update. @@ -922,6 +957,34 @@ void MediaPlayerPrivate::durationChanged() m_player->durationChanged(); } +bool MediaPlayerPrivate::supportsMuting() const +{ + return true; +} + +void MediaPlayerPrivate::setMuted(bool muted) +{ + if (!m_playBin) + return; + + g_object_set(m_playBin, "mute", muted, NULL); +} + +void MediaPlayerPrivate::muteChangedCallback() +{ + gboolean muted; + g_object_get(m_playBin, "mute", &muted, NULL); + m_player->muteChanged(static_cast<bool>(muted)); +} + +void MediaPlayerPrivate::muteChanged() +{ + if (m_muteIdleId) + g_source_remove(m_muteIdleId); + + m_muteIdleId = g_idle_add((GSourceFunc) notifyMuteIdleCallback, this); +} + void MediaPlayerPrivate::loadingFailed(MediaPlayer::NetworkState error) { m_errorOccured = true; @@ -1140,6 +1203,7 @@ void MediaPlayerPrivate::createGSTPlayBin(String url) g_signal_connect(m_playBin, "notify::volume", G_CALLBACK(mediaPlayerPrivateVolumeChangedCallback), this); g_signal_connect(m_playBin, "notify::source", G_CALLBACK(mediaPlayerPrivateSourceChangedCallback), this); + g_signal_connect(m_playBin, "notify::mute", G_CALLBACK(mediaPlayerPrivateMuteChangedCallback), this); m_videoSink = webkit_video_sink_new(); diff --git a/WebCore/platform/graphics/gtk/MediaPlayerPrivateGStreamer.h b/WebCore/platform/graphics/gtk/MediaPlayerPrivateGStreamer.h index ec55b29..34257ca 100644 --- a/WebCore/platform/graphics/gtk/MediaPlayerPrivateGStreamer.h +++ b/WebCore/platform/graphics/gtk/MediaPlayerPrivateGStreamer.h @@ -76,8 +76,15 @@ class MediaPlayerPrivate : public MediaPlayerPrivateInterface { void seek(float); void setRate(float); + void setVolume(float); void volumeChanged(); + void volumeChangedCallback(); + + bool supportsMuting() const; + void setMuted(bool); + void muteChanged(); + void muteChangedCallback(); MediaPlayer::NetworkState networkState() const; MediaPlayer::ReadyState readyState() const; @@ -149,6 +156,7 @@ class MediaPlayerPrivate : public MediaPlayerPrivateInterface { bool m_errorOccured; guint m_volumeIdleId; gfloat m_mediaDuration; + guint m_muteIdleId; }; } diff --git a/WebCore/platform/graphics/haiku/GraphicsContextHaiku.cpp b/WebCore/platform/graphics/haiku/GraphicsContextHaiku.cpp index 6038c6a..3970ebc 100644 --- a/WebCore/platform/graphics/haiku/GraphicsContextHaiku.cpp +++ b/WebCore/platform/graphics/haiku/GraphicsContextHaiku.cpp @@ -28,6 +28,7 @@ #include "config.h" #include "GraphicsContext.h" +#include "AffineTransform.h" #include "CString.h" #include "Color.h" #include "Font.h" @@ -391,6 +392,12 @@ void GraphicsContext::clipToImageBuffer(const FloatRect&, const ImageBuffer*) notImplemented(); } +AffineTransform GraphicsContext::getAffineCTM() const +{ + notImplemented(); + return AffineTransform(); +} + TransformationMatrix GraphicsContext::getCTM() const { notImplemented(); @@ -451,6 +458,14 @@ void GraphicsContext::addInnerRoundedRectClip(const IntRect& rect, int thickness notImplemented(); } +void GraphicsContext::concatCTM(const AffineTransform& transform) +{ + if (paintingDisabled()) + return; + + notImplemented(); +} + void GraphicsContext::concatCTM(const TransformationMatrix& transform) { if (paintingDisabled()) diff --git a/WebCore/platform/graphics/haiku/PathHaiku.cpp b/WebCore/platform/graphics/haiku/PathHaiku.cpp index d0da025..70dad29 100644 --- a/WebCore/platform/graphics/haiku/PathHaiku.cpp +++ b/WebCore/platform/graphics/haiku/PathHaiku.cpp @@ -28,6 +28,7 @@ #include "config.h" #include "Path.h" +#include "AffineTransform.h" #include "FloatRect.h" #include "NotImplemented.h" #include "PlatformString.h" @@ -146,6 +147,11 @@ void Path::apply(void* info, PathApplierFunction function) const notImplemented(); } +void Path::transform(const AffineTransform& transform) +{ + notImplemented(); +} + void Path::transform(const TransformationMatrix& transform) { notImplemented(); diff --git a/WebCore/platform/graphics/qt/GraphicsContextQt.cpp b/WebCore/platform/graphics/qt/GraphicsContextQt.cpp index b78a6e8..9046449 100644 --- a/WebCore/platform/graphics/qt/GraphicsContextQt.cpp +++ b/WebCore/platform/graphics/qt/GraphicsContextQt.cpp @@ -40,6 +40,7 @@ #include <windows.h> #endif +#include "AffineTransform.h" #include "Color.h" #include "FloatConversion.h" #include "Font.h" @@ -275,6 +276,13 @@ PlatformGraphicsContext* GraphicsContext::platformContext() const return m_data->p(); } +AffineTransform GraphicsContext::getAffineCTM() const +{ + QTransform matrix(platformContext()->combinedTransform()); + return AffineTransform(matrix.m11(), matrix.m12(), matrix.m21(), + matrix.m22(), matrix.dx(), matrix.dy()); +} + TransformationMatrix GraphicsContext::getCTM() const { QTransform matrix(platformContext()->combinedTransform()); @@ -1188,6 +1196,24 @@ void GraphicsContext::addInnerRoundedRectClip(const IntRect& rect, p->setRenderHint(QPainter::Antialiasing, antiAlias); } +void GraphicsContext::concatCTM(const AffineTransform& transform) +{ + if (paintingDisabled()) + return; + + m_data->p()->setWorldTransform(transform, true); + + // Transformations to the context shouldn't transform the currentPath. + // We have to undo every change made to the context from the currentPath + // to avoid wrong drawings. + if (!m_data->currentPath.isEmpty() && transform.isInvertible()) { + QTransform matrix = transform.inverse(); + m_data->currentPath = m_data->currentPath * matrix; + m_common->state.pathTransform.multiply(transform.toTransformationMatrix()); + } +} + + void GraphicsContext::concatCTM(const TransformationMatrix& transform) { if (paintingDisabled()) diff --git a/WebCore/platform/graphics/qt/PathQt.cpp b/WebCore/platform/graphics/qt/PathQt.cpp index 4716d32..2721984 100644 --- a/WebCore/platform/graphics/qt/PathQt.cpp +++ b/WebCore/platform/graphics/qt/PathQt.cpp @@ -1,7 +1,7 @@ /* * Copyright (C) 2006 Zack Rusin <zack@kde.org> * 2006 Rob Buis <buis@kde.org> - * 2009 Dirk Schulze <krit@webkit.org> + * 2009, 2010 Dirk Schulze <krit@webkit.org> * * All rights reserved. * @@ -30,12 +30,13 @@ #include "config.h" #include "Path.h" -#include "TransformationMatrix.h" +#include "AffineTransform.h" #include "FloatRect.h" #include "GraphicsContext.h" #include "ImageBuffer.h" #include "PlatformString.h" #include "StrokeStyleApplier.h" +#include "TransformationMatrix.h" #include <QPainterPath> #include <QTransform> #include <QString> @@ -379,6 +380,11 @@ void Path::apply(void* info, PathApplierFunction function) const } } +void Path::transform(const AffineTransform& transform) +{ + m_path = QTransform(transform).map(m_path); +} + void Path::transform(const TransformationMatrix& transform) { m_path = QTransform(transform).map(m_path); diff --git a/WebCore/platform/graphics/qt/TransformationMatrixQt.cpp b/WebCore/platform/graphics/qt/TransformationMatrixQt.cpp index 37b86f3..a5bc3c3 100644 --- a/WebCore/platform/graphics/qt/TransformationMatrixQt.cpp +++ b/WebCore/platform/graphics/qt/TransformationMatrixQt.cpp @@ -24,6 +24,7 @@ */ #include "config.h" +#include "AffineTransform.h" #include "TransformationMatrix.h" #include "IntRect.h" @@ -36,6 +37,11 @@ TransformationMatrix::operator QTransform() const return QTransform(m11(), m12(), m14(), m21(), m22(), m24(), m41(), m42(), m44()); } +AffineTransform::operator QTransform() const +{ + return QTransform(a(), b(), c(), d(), e(), f()); +} + } // vim: ts=4 sw=4 et diff --git a/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp b/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp index 985442c..bd97ca2 100644 --- a/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp +++ b/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp @@ -31,6 +31,7 @@ #include "config.h" #include "GraphicsContext.h" +#include "AffineTransform.h" #include "Color.h" #include "FloatRect.h" #include "Gradient.h" @@ -439,6 +440,13 @@ void GraphicsContext::clipToImageBuffer(const FloatRect& rect, #endif } +void GraphicsContext::concatCTM(const AffineTransform& affine) +{ + if (paintingDisabled()) + return; + platformContext()->canvas()->concat(affine); +} + void GraphicsContext::concatCTM(const TransformationMatrix& xform) { if (paintingDisabled()) @@ -805,6 +813,17 @@ void GraphicsContext::fillRoundedRect(const IntRect& rect, platformContext()->canvas()->drawPath(path, paint); } +AffineTransform GraphicsContext::getAffineCTM() const +{ + const SkMatrix& m = platformContext()->canvas()->getTotalMatrix(); + return AffineTransform(SkScalarToDouble(m.getScaleX()), // a + SkScalarToDouble(m.getSkewY()), // b + SkScalarToDouble(m.getSkewX()), // c + SkScalarToDouble(m.getScaleY()), // d + SkScalarToDouble(m.getTranslateX()), // e + SkScalarToDouble(m.getTranslateY())); // f +} + TransformationMatrix GraphicsContext::getCTM() const { const SkMatrix& m = platformContext()->canvas()->getTotalMatrix(); @@ -978,9 +997,7 @@ void GraphicsContext::setPlatformFillPattern(Pattern* pattern) if (paintingDisabled()) return; - SkShader* pat = pattern->createPlatformPattern(getCTM()); - platformContext()->setFillShader(pat); - pat->safeUnref(); + platformContext()->setFillShader(pattern->platformPattern(getCTM())); } void GraphicsContext::setPlatformShadow(const IntSize& size, @@ -1065,9 +1082,7 @@ void GraphicsContext::setPlatformStrokePattern(Pattern* pattern) if (paintingDisabled()) return; - SkShader* pat = pattern->createPlatformPattern(getCTM()); - platformContext()->setStrokeShader(pat); - pat->safeUnref(); + platformContext()->setStrokeShader(pattern->platformPattern(getCTM())); } void GraphicsContext::setPlatformTextDrawingMode(int mode) diff --git a/WebCore/platform/graphics/skia/PathSkia.cpp b/WebCore/platform/graphics/skia/PathSkia.cpp index 2cbb759..fe4c3d0 100644 --- a/WebCore/platform/graphics/skia/PathSkia.cpp +++ b/WebCore/platform/graphics/skia/PathSkia.cpp @@ -30,6 +30,7 @@ #include "config.h" #include "Path.h" +#include "AffineTransform.h" #include "FloatRect.h" #include "ImageBuffer.h" #include "StrokeStyleApplier.h" @@ -214,6 +215,11 @@ void Path::apply(void* info, PathApplierFunction function) const } } +void Path::transform(const AffineTransform& xform) +{ + m_path->transform(xform); +} + void Path::transform(const TransformationMatrix& xform) { m_path->transform(xform); diff --git a/WebCore/platform/graphics/skia/PatternSkia.cpp b/WebCore/platform/graphics/skia/PatternSkia.cpp index 11b5cf1..b98825b 100644 --- a/WebCore/platform/graphics/skia/PatternSkia.cpp +++ b/WebCore/platform/graphics/skia/PatternSkia.cpp @@ -40,8 +40,17 @@ namespace WebCore { -PlatformPatternPtr Pattern::createPlatformPattern(const TransformationMatrix& patternTransform) const +void Pattern::platformDestroy() { + m_pattern->safeUnref(); + m_pattern = 0; +} + +PlatformPatternPtr Pattern::platformPattern(const TransformationMatrix& patternTransform) +{ + if (m_pattern) + return m_pattern; + // Note: patternTransform is ignored since it seems to be applied elsewhere // (when the pattern is used?). Applying it to the pattern (i.e. // shader->setLocalMatrix) results in a double transformation. This can be @@ -53,31 +62,42 @@ PlatformPatternPtr Pattern::createPlatformPattern(const TransformationMatrix& pa SkBitmap* bm = m_tileImage->nativeImageForCurrentFrame(); // If we don't have a bitmap, return a transparent shader. if (!bm) - return new SkColorShader(SkColorSetARGB(0, 0, 0, 0)); + m_pattern = new SkColorShader(SkColorSetARGB(0, 0, 0, 0)); - if (m_repeatX && m_repeatY) - return SkShader::CreateBitmapShader(*bm, SkShader::kRepeat_TileMode, SkShader::kRepeat_TileMode); + else if (m_repeatX && m_repeatY) + m_pattern = SkShader::CreateBitmapShader(*bm, SkShader::kRepeat_TileMode, SkShader::kRepeat_TileMode); - // Skia does not have a "draw the tile only once" option. Clamp_TileMode - // repeats the last line of the image after drawing one tile. To avoid - // filling the space with arbitrary pixels, this workaround forces the - // image to have a line of transparent pixels on the "repeated" edge(s), - // thus causing extra space to be transparent filled. - SkShader::TileMode tileModeX = m_repeatX ? SkShader::kRepeat_TileMode : SkShader::kClamp_TileMode; - SkShader::TileMode tileModeY = m_repeatY ? SkShader::kRepeat_TileMode : SkShader::kClamp_TileMode; - int expandW = m_repeatX ? 0 : 1; - int expandH = m_repeatY ? 0 : 1; + else { - // Create a transparent bitmap 1 pixel wider and/or taller than the - // original, then copy the orignal into it. - // FIXME: Is there a better way to pad (not scale) an image in skia? - SkBitmap bm2; - bm2.setConfig(bm->config(), bm->width() + expandW, bm->height() + expandH); - bm2.allocPixels(); - bm2.eraseARGB(0x00, 0x00, 0x00, 0x00); - SkCanvas canvas(bm2); - canvas.drawBitmap(*bm, 0, 0); - return SkShader::CreateBitmapShader(bm2, tileModeX, tileModeY); + // Skia does not have a "draw the tile only once" option. Clamp_TileMode + // repeats the last line of the image after drawing one tile. To avoid + // filling the space with arbitrary pixels, this workaround forces the + // image to have a line of transparent pixels on the "repeated" edge(s), + // thus causing extra space to be transparent filled. + SkShader::TileMode tileModeX = m_repeatX ? SkShader::kRepeat_TileMode : SkShader::kClamp_TileMode; + SkShader::TileMode tileModeY = m_repeatY ? SkShader::kRepeat_TileMode : SkShader::kClamp_TileMode; + int expandW = m_repeatX ? 0 : 1; + int expandH = m_repeatY ? 0 : 1; + + // Create a transparent bitmap 1 pixel wider and/or taller than the + // original, then copy the orignal into it. + // FIXME: Is there a better way to pad (not scale) an image in skia? + SkBitmap bm2; + bm2.setConfig(bm->config(), bm->width() + expandW, bm->height() + expandH); + bm2.allocPixels(); + bm2.eraseARGB(0x00, 0x00, 0x00, 0x00); + SkCanvas canvas(bm2); + canvas.drawBitmap(*bm, 0, 0); + m_pattern = SkShader::CreateBitmapShader(bm2, tileModeX, tileModeY); + } + m_pattern->setLocalMatrix(m_patternSpaceTransformation); + return m_pattern; +} + +void Pattern::setPlatformPatternSpaceTransform() +{ + if (m_pattern) + m_pattern->setLocalMatrix(m_patternSpaceTransformation); } } // namespace WebCore diff --git a/WebCore/platform/graphics/skia/TransformationMatrixSkia.cpp b/WebCore/platform/graphics/skia/TransformationMatrixSkia.cpp index 2d0f9f8..dc610d7 100644 --- a/WebCore/platform/graphics/skia/TransformationMatrixSkia.cpp +++ b/WebCore/platform/graphics/skia/TransformationMatrixSkia.cpp @@ -28,6 +28,7 @@ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "config.h" +#include "AffineTransform.h" #include "TransformationMatrix.h" #include "SkiaUtils.h" @@ -54,4 +55,24 @@ TransformationMatrix::operator SkMatrix() const return result; } +AffineTransform::operator SkMatrix() const +{ + SkMatrix result; + + result.setScaleX(WebCoreDoubleToSkScalar(a())); + result.setSkewX(WebCoreDoubleToSkScalar(c())); + result.setTranslateX(WebCoreDoubleToSkScalar(e())); + + result.setScaleY(WebCoreDoubleToSkScalar(d())); + result.setSkewY(WebCoreDoubleToSkScalar(b())); + result.setTranslateY(WebCoreDoubleToSkScalar(f())); + + // FIXME: Set perspective properly. + result.setPerspX(0); + result.setPerspY(0); + result.set(SkMatrix::kMPersp2, SK_Scalar1); + + return result; +} + } // namespace WebCore diff --git a/WebCore/platform/graphics/transforms/AffineTransform.cpp b/WebCore/platform/graphics/transforms/AffineTransform.cpp new file mode 100644 index 0000000..f26bcb7 --- /dev/null +++ b/WebCore/platform/graphics/transforms/AffineTransform.cpp @@ -0,0 +1,325 @@ +/* + * Copyright (C) 2005, 2006 Apple Computer, Inc. All rights reserved. + * 2010 Dirk Schulze <krit@webkit.org> + * + * 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 COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "AffineTransform.h" + +#include "FloatConversion.h" +#include "FloatQuad.h" +#include "FloatRect.h" +#include "IntRect.h" + +#include <wtf/MathExtras.h> + +namespace WebCore { + +static void affineTransformDecompose(const AffineTransform& matrix, double sr[9]) +{ + AffineTransform m(matrix); + + // Compute scaling factors + double sx = sqrt(m.a() * m.a() + m.b() * m.b()); + double sy = sqrt(m.c() * m.c() + m.d() * m.d()); + + // Compute cross product of transformed unit vectors. If negative, + // one axis was flipped. + if (m.a() * m.d() - m.c() * m.b() < 0.0) { + // Flip axis with minimum unit vector dot product + if (m.a() < m.d()) + sx = -sx; + else + sy = -sy; + } + + // Remove scale from matrix + m.scale(1.0 / sx, 1.0 / sy); + + // Compute rotation + double angle = atan2(m.b(), m.a()); + + // Remove rotation from matrix + m.rotate(rad2deg(-angle)); + + // Return results + sr[0] = sx; + sr[1] = sy; + sr[2] = angle; + sr[3] = m.a(); + sr[4] = m.b(); + sr[5] = m.c(); + sr[6] = m.d(); + sr[7] = m.e(); + sr[8] = m.f(); +} + +static void affineTransformCompose(AffineTransform& m, const double sr[9]) +{ + m.setA(sr[3]); + m.setB(sr[4]); + m.setC(sr[5]); + m.setD(sr[6]); + m.setE(sr[7]); + m.setF(sr[8]); + m.rotate(rad2deg(sr[2])); + m.scale(sr[0], sr[1]); +} + +AffineTransform::AffineTransform() +{ + setMatrix(1, 0, 0, 1, 0, 0); +} + +AffineTransform::AffineTransform(double a, double b, double c, double d, double e, double f) +{ + setMatrix(a, b, c, d, e, f); +} + +void AffineTransform::reset() +{ + setMatrix(1, 0, 0, 1, 0, 0); +} + +void AffineTransform::setMatrix(double a, double b, double c, double d, double e, double f) +{ + m_transform[0] = a; + m_transform[1] = b; + m_transform[2] = c; + m_transform[3] = d; + m_transform[4] = e; + m_transform[5] = f; +} + +bool AffineTransform::isIdentity() const +{ + return (m_transform[0] == 1 && m_transform[1] == 0 + && m_transform[2] == 0 && m_transform[3] == 1 + && m_transform[4] == 0 && m_transform[5] == 0); +} + +double AffineTransform::det() const +{ + return m_transform[0] * m_transform[3] - m_transform[1] * m_transform[2]; +} + +bool AffineTransform::isInvertible() const +{ + return det() != 0.0; +} + +AffineTransform AffineTransform::inverse() const +{ + double determinant = det(); + if (determinant == 0.0) + return AffineTransform(); + + AffineTransform result; + result.m_transform[0] = m_transform[3] / determinant; + result.m_transform[1] = -m_transform[1] / determinant; + result.m_transform[2] = -m_transform[2] / determinant; + result.m_transform[3] = m_transform[0] / determinant; + result.m_transform[4] = (m_transform[2] * m_transform[5] + - m_transform[3] * m_transform[4]) / determinant; + result.m_transform[5] = (m_transform[1] * m_transform[4] + - m_transform[0] * m_transform[5]) / determinant; + + return result; +} + +AffineTransform& AffineTransform::multiply(const AffineTransform& other) +{ + return (*this) *= other; +} + +AffineTransform& AffineTransform::multLeft(const AffineTransform& other) +{ + AffineTransform trans; + + trans.m_transform[0] = other.m_transform[0] * m_transform[0] + other.m_transform[1] * m_transform[2]; + trans.m_transform[1] = other.m_transform[0] * m_transform[1] + other.m_transform[1] * m_transform[3]; + trans.m_transform[2] = other.m_transform[2] * m_transform[0] + other.m_transform[3] * m_transform[2]; + trans.m_transform[3] = other.m_transform[2] * m_transform[1] + other.m_transform[3] * m_transform[3]; + trans.m_transform[4] = other.m_transform[4] * m_transform[0] + other.m_transform[5] * m_transform[2] + m_transform[4]; + trans.m_transform[5] = other.m_transform[4] * m_transform[1] + other.m_transform[5] * m_transform[3] + m_transform[5]; + + setMatrix(trans.m_transform); + return *this; +} + +AffineTransform& AffineTransform::rotate(double a) +{ + // angle is in degree. Switch to radian + a = deg2rad(a); + double cosAngle = cos(a); + double sinAngle = sin(a); + AffineTransform rot(cosAngle, sinAngle, -sinAngle, cosAngle, 0, 0); + + multLeft(rot); + return *this; +} + +AffineTransform& AffineTransform::scale(double s) +{ + return scale(s, s); +} + +AffineTransform& AffineTransform::scale(double sx, double sy) +{ + m_transform[0] *= sx; + m_transform[3] *= sy; + return *this; +} + +AffineTransform& AffineTransform::translate(double tx, double ty) +{ + m_transform[4] += tx; + m_transform[5] += ty; + return *this; +} + +AffineTransform& AffineTransform::scaleNonUniform(double sx, double sy) +{ + return scale(sx, sy); +} + +AffineTransform& AffineTransform::rotateFromVector(double x, double y) +{ + return rotate(rad2deg(atan2(y, x))); +} + +AffineTransform& AffineTransform::flipX() +{ + return scale(-1, 1); +} + +AffineTransform& AffineTransform::flipY() +{ + return scale(1, -1); +} + +AffineTransform& AffineTransform::shear(double sx, double sy) +{ + AffineTransform shear(1, sy, sx, 1, 0, 0); + + multLeft(shear); + return *this; +} + +AffineTransform& AffineTransform::skew(double angleX, double angleY) +{ + return shear(tan(deg2rad(angleX)), tan(deg2rad(angleY))); +} + +AffineTransform& AffineTransform::skewX(double angle) +{ + return shear(tan(deg2rad(angle)), 0); +} + +AffineTransform& AffineTransform::skewY(double angle) +{ + return shear(0, tan(deg2rad(angle))); +} + +AffineTransform makeMapBetweenRects(const FloatRect& source, const FloatRect& dest) +{ + AffineTransform transform; + transform.translate(dest.x() - source.x(), dest.y() - source.y()); + transform.scale(dest.width() / source.width(), dest.height() / source.height()); + return transform; +} + +void AffineTransform::map(double x, double y, double* x2, double* y2) const +{ + *x2 = (m_transform[0] * x + m_transform[2] * y + m_transform[4]); + *y2 = (m_transform[1] * x + m_transform[3] * y + m_transform[5]); +} + +IntPoint AffineTransform::mapPoint(const IntPoint& point) const +{ + double x2, y2; + map(point.x(), point.y(), &x2, &y2); + + // Round the point. + return IntPoint(lround(x2), lround(y2)); +} + +FloatPoint AffineTransform::mapPoint(const FloatPoint& point) const +{ + double x2, y2; + map(point.x(), point.y(), &x2, &y2); + + return FloatPoint(narrowPrecisionToFloat(x2), narrowPrecisionToFloat(y2)); +} + +FloatRect AffineTransform::mapRect(const FloatRect& rect) const +{ + FloatQuad q(rect); + + FloatQuad result; + result.setP1(mapPoint(q.p1())); + result.setP2(mapPoint(q.p2())); + result.setP3(mapPoint(q.p3())); + result.setP4(mapPoint(q.p4())); + return result.boundingBox(); +} + +void AffineTransform::blend(const AffineTransform& from, double progress) +{ + double srA[9], srB[9]; + + affineTransformDecompose(from, srA); + affineTransformDecompose(*this, srB); + + // If x-axis of one is flipped, and y-axis of the other, convert to an unflipped rotation. + if ((srA[0] < 0 && srB[1] < 0) || (srA[1] < 0 && srB[0] < 0)) { + srA[0] = -srA[0]; + srA[1] = -srA[1]; + srA[2] += srA[2] < 0 ? piDouble : -piDouble; + } + + // Don't rotate the long way around. + srA[2] = fmod(srA[2], 2.0 * piDouble); + srB[2] = fmod(srB[2], 2.0 * piDouble); + + if (fabs(srA[2] - srB[2]) > piDouble) { + if (srA[2] > srB[2]) + srA[2] -= piDouble * 2.0; + else + srB[2] -= piDouble * 2.0; + } + + for (int i = 0; i < 9; i++) + srA[i] = srA[i] + progress * (srB[i] - srA[i]); + + affineTransformCompose(*this, srA); +} + +TransformationMatrix AffineTransform::toTransformationMatrix() const +{ + return TransformationMatrix(m_transform[0], m_transform[1], m_transform[2], + m_transform[3], m_transform[4], m_transform[5]); +} + +} diff --git a/WebCore/platform/graphics/transforms/AffineTransform.h b/WebCore/platform/graphics/transforms/AffineTransform.h new file mode 100644 index 0000000..49add18 --- /dev/null +++ b/WebCore/platform/graphics/transforms/AffineTransform.h @@ -0,0 +1,170 @@ +/* + * Copyright (C) 2005, 2006 Apple Computer, Inc. All rights reserved. + * 2010 Dirk Schulze <krit@webkit.org> + * + * 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 COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef AffineTransform_h +#define AffineTransform_h + +#include "TransformationMatrix.h" + +#include <string.h> // for memcpy +#include <wtf/FastAllocBase.h> + +#if PLATFORM(CG) +#include <CoreGraphics/CGAffineTransform.h> +#elif PLATFORM(CAIRO) +#include <cairo.h> +#elif PLATFORM(QT) +#include <QTransform> +#elif PLATFORM(SKIA) +#include <SkMatrix.h> +#elif PLATFORM(WX) && USE(WXGC) +#include <wx/graphics.h> +#endif + +namespace WebCore { + +class FloatPoint; +class FloatQuad; +class FloatRect; +class IntPoint; +class IntRect; + +class AffineTransform : public FastAllocBase { +public: + typedef double Transform[6]; + + AffineTransform(); + AffineTransform(double a, double b, double c, double d, double e, double f); + + void setMatrix(double a, double b, double c, double d, double e, double f); + + void map(double x, double y, double* x2, double* y2) const; + + // Rounds the mapped point to the nearest integer value. + IntPoint mapPoint(const IntPoint&) const; + + FloatPoint mapPoint(const FloatPoint&) const; + + // Rounds the resulting mapped rectangle out. This is helpful for bounding + // box computations but may not be what is wanted in other contexts. + IntRect mapRect(const IntRect&) const; + + FloatRect mapRect(const FloatRect&) const; + + bool isIdentity() const; + + double a() const { return m_transform[0]; } + void setA(double a) { m_transform[0] = a; } + double b() const { return m_transform[1]; } + void setB(double b) { m_transform[1] = b; } + double c() const { return m_transform[2]; } + void setC(double c) { m_transform[2] = c; } + double d() const { return m_transform[3]; } + void setD(double d) { m_transform[3] = d; } + double e() const { return m_transform[4]; } + void setE(double e) { m_transform[4] = e; } + double f() const { return m_transform[5]; } + void setF(double f) { m_transform[5] = f; } + + void reset(); + + AffineTransform& multiply(const AffineTransform&); + AffineTransform& multLeft(const AffineTransform&); + AffineTransform& scale(double); + AffineTransform& scale(double sx, double sy); + AffineTransform& scaleNonUniform(double sx, double sy); + AffineTransform& rotate(double d); + AffineTransform& rotateFromVector(double x, double y); + AffineTransform& translate(double tx, double ty); + AffineTransform& shear(double sx, double sy); + AffineTransform& flipX(); + AffineTransform& flipY(); + AffineTransform& skew(double angleX, double angleY); + AffineTransform& skewX(double angle); + AffineTransform& skewY(double angle); + + double det() const; + bool isInvertible() const; + AffineTransform inverse() const; + + void blend(const AffineTransform& from, double progress); + + TransformationMatrix toTransformationMatrix() const; + + bool operator== (const AffineTransform& m2) const + { + return (m_transform[0] == m2.m_transform[0] + && m_transform[1] == m2.m_transform[1] + && m_transform[2] == m2.m_transform[2] + && m_transform[3] == m2.m_transform[3] + && m_transform[4] == m2.m_transform[4] + && m_transform[5] == m2.m_transform[5]); + } + + bool operator!=(const AffineTransform& other) const { return !(*this == other); } + + // *this = *this * t (i.e., a multRight) + AffineTransform& operator*=(const AffineTransform& t) + { + *this = *this * t; + return *this; + } + + // result = *this * t (i.e., a multRight) + AffineTransform operator*(const AffineTransform& t) const + { + AffineTransform result = t; + result.multLeft(*this); + return result; + } + +#if PLATFORM(CG) + operator CGAffineTransform() const; +#elif PLATFORM(CAIRO) + operator cairo_matrix_t() const; +#elif PLATFORM(QT) + operator QTransform() const; +#elif PLATFORM(SKIA) + operator SkMatrix() const; +#elif PLATFORM(WX) && USE(WXGC) + operator wxGraphicsMatrix() const; +#endif + +private: + void setMatrix(const Transform m) + { + if (m && m != m_transform) + memcpy(m_transform, m, sizeof(Transform)); + } + + Transform m_transform; +}; + +AffineTransform makeMapBetweenRects(const FloatRect& source, const FloatRect& dest); + +} + +#endif diff --git a/WebCore/platform/graphics/win/GraphicsContextWin.cpp b/WebCore/platform/graphics/win/GraphicsContextWin.cpp index 54b0cb2..68c12d1 100644 --- a/WebCore/platform/graphics/win/GraphicsContextWin.cpp +++ b/WebCore/platform/graphics/win/GraphicsContextWin.cpp @@ -32,6 +32,7 @@ #include "GraphicsContextPlatformPrivateCairo.h" #endif +#include "AffineTransform.h" #include "BitmapInfo.h" #include "TransformationMatrix.h" #include "NotImplemented.h" @@ -189,6 +190,16 @@ void GraphicsContextPlatformPrivate::translate(float x , float y) ModifyWorldTransform(m_hdc, &xform, MWT_LEFTMULTIPLY); } +void GraphicsContextPlatformPrivate::concatCTM(const AffineTransform& transform) +{ + if (!m_hdc) + return; + + XFORM xform = TransformationMatrix(transform.a(), transform.b(), transform.c(), + transform.d(), transform.e(), transform.f()); + ModifyWorldTransform(m_hdc, &xform, MWT_LEFTMULTIPLY); +} + void GraphicsContextPlatformPrivate::concatCTM(const TransformationMatrix& transform) { if (!m_hdc) diff --git a/WebCore/platform/graphics/win/WKCACFLayer.cpp b/WebCore/platform/graphics/win/WKCACFLayer.cpp index ad1fc85..e97fac9 100644 --- a/WebCore/platform/graphics/win/WKCACFLayer.cpp +++ b/WebCore/platform/graphics/win/WKCACFLayer.cpp @@ -39,10 +39,11 @@ #ifdef DEBUG_ALL #pragma comment(lib, "QuartzCore_debug") +#pragma comment(lib, "QuartzCoreInterface_debug") #else #pragma comment(lib, "QuartzCore") -#endif #pragma comment(lib, "QuartzCoreInterface") +#endif namespace WebCore { diff --git a/WebCore/platform/graphics/wince/GraphicsContextWince.cpp b/WebCore/platform/graphics/wince/GraphicsContextWince.cpp index 0e387f5..410aeb1 100644 --- a/WebCore/platform/graphics/wince/GraphicsContextWince.cpp +++ b/WebCore/platform/graphics/wince/GraphicsContextWince.cpp @@ -21,6 +21,7 @@ #include "config.h" #include "GraphicsContext.h" +#include "AffineTransform.h" #include "CharacterNames.h" #include "GlyphBuffer.h" #include "Gradient.h" @@ -1143,6 +1144,11 @@ void GraphicsContext::endTransparencyLayer() m_data->restore(); } +void GraphicsContext::concatCTM(const AffineTransform& transform) +{ + m_data->concatCTM(transform); +} + void GraphicsContext::concatCTM(const TransformationMatrix& transform) { m_data->concatCTM(transform); @@ -1531,6 +1537,11 @@ void GraphicsContext::fillRect(const FloatRect& r, const Gradient* gradient) GradientFill(dc, tv.data(), tv.size(), mesh.data(), mesh.size(), vertical ? GRADIENT_FILL_RECT_V : GRADIENT_FILL_RECT_H); } +AffineTransform GraphicsContext::getAffineCTM() const +{ + return m_data->m_transform; +} + TransformationMatrix GraphicsContext::getCTM() const { return m_data->m_transform; diff --git a/WebCore/platform/graphics/wx/GraphicsContextWx.cpp b/WebCore/platform/graphics/wx/GraphicsContextWx.cpp index 839bc59..e35334e 100644 --- a/WebCore/platform/graphics/wx/GraphicsContextWx.cpp +++ b/WebCore/platform/graphics/wx/GraphicsContextWx.cpp @@ -26,6 +26,7 @@ #include "config.h" #include "GraphicsContext.h" +#include "AffineTransform.h" #include "TransformationMatrix.h" #include "FloatRect.h" #include "Font.h" @@ -359,6 +360,12 @@ void GraphicsContext::clipToImageBuffer(const FloatRect&, const ImageBuffer*) notImplemented(); } +AffineTransform GraphicsContext::getAffineCTM() const +{ + notImplemented(); + return AffineTransform(); +} + TransformationMatrix GraphicsContext::getCTM() const { notImplemented(); @@ -471,6 +478,15 @@ void GraphicsContext::setPlatformFillColor(const Color& color, ColorSpace colorS m_data->context->SetBrush(wxBrush(color)); } +void GraphicsContext::concatCTM(const AffineTransform& transform) +{ + if (paintingDisabled()) + return; + + notImplemented(); + return; +} + void GraphicsContext::concatCTM(const TransformationMatrix& transform) { if (paintingDisabled()) diff --git a/WebCore/platform/graphics/wx/PathWx.cpp b/WebCore/platform/graphics/wx/PathWx.cpp index cebc05a..21693c9 100644 --- a/WebCore/platform/graphics/wx/PathWx.cpp +++ b/WebCore/platform/graphics/wx/PathWx.cpp @@ -26,6 +26,7 @@ #include "config.h" #include "Path.h" +#include "AffineTransform.h" #include "TransformationMatrix.h" #include "FloatPoint.h" #include "FloatRect.h" @@ -202,6 +203,14 @@ void Path::addEllipse(const FloatRect& rect) #endif } +void Path::transform(const AffineTransform& transform) +{ +#if USE(WXGC) + if (m_path) + m_path->Transform(transform); +#endif +} + void Path::transform(const TransformationMatrix& transform) { #if USE(WXGC) diff --git a/WebCore/platform/graphics/wx/TransformationMatrixWx.cpp b/WebCore/platform/graphics/wx/TransformationMatrixWx.cpp index 9684a3c..1937986 100644 --- a/WebCore/platform/graphics/wx/TransformationMatrixWx.cpp +++ b/WebCore/platform/graphics/wx/TransformationMatrixWx.cpp @@ -24,6 +24,7 @@ */ #include "config.h" +#include "AffineTransform.h" #include "TransformationMatrix.h" #include "Assertions.h" @@ -45,6 +46,15 @@ TransformationMatrix::operator wxGraphicsMatrix() const wxGraphicsMatrix matrix = renderer->CreateMatrix(a(), b(), c(), d(), e(), f()); return matrix; } + +AffineTransform::operator wxGraphicsMatrix() const +{ + wxGraphicsRenderer* renderer = wxGraphicsRenderer::GetDefaultRenderer(); + ASSERT(renderer); + + wxGraphicsMatrix matrix = renderer->CreateMatrix(a(), b(), c(), d(), e(), f()); + return matrix; +} #endif } diff --git a/WebCore/platform/gtk/GOwnPtrGtk.cpp b/WebCore/platform/gtk/GOwnPtrGtk.cpp new file mode 100644 index 0000000..3bb1335 --- /dev/null +++ b/WebCore/platform/gtk/GOwnPtrGtk.cpp @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2010 Igalia S.L + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +#include "config.h" +#include "GOwnPtrGtk.h" + +#include <gst/gstelement.h> +#include <libsoup/soup-uri.h> + +namespace WTF { + +template <> void freeOwnedGPtr<SoupURI>(SoupURI* ptr) +{ + if (ptr) + soup_uri_free(ptr); +} + +template <> void freeOwnedGPtr<GstElement>(GstElement* ptr) +{ + if (ptr) + gst_object_unref(ptr); +} + +} diff --git a/WebCore/platform/gtk/GOwnPtrGtk.h b/WebCore/platform/gtk/GOwnPtrGtk.h new file mode 100644 index 0000000..c585002 --- /dev/null +++ b/WebCore/platform/gtk/GOwnPtrGtk.h @@ -0,0 +1,35 @@ +/* + * Copyright (C) 2010 Igalia S.L + * + * 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 GOwnPtrGtk_h +#define GOwnPtrGtk_h + +#include "GOwnPtr.h" + +typedef struct _SoupURI SoupURI; +typedef struct _GstElement GstElement; + +namespace WTF { + +template<> void freeOwnedGPtr<SoupURI>(SoupURI* ptr); +template<> void freeOwnedGPtr<GstElement>(GstElement* ptr); + +} + +#endif diff --git a/WebCore/platform/mac/ThemeMac.mm b/WebCore/platform/mac/ThemeMac.mm index 2812607..b71a651 100644 --- a/WebCore/platform/mac/ThemeMac.mm +++ b/WebCore/platform/mac/ThemeMac.mm @@ -415,9 +415,20 @@ static void paintButton(ControlPart part, ControlStates states, GraphicsContext* } else if ([previousDefaultButtonCell isEqual:buttonCell]) [window setDefaultButtonCell:nil]; + if (!view) { + context->save(); + context->translate(inflatedRect.x(), inflatedRect.y()); + context->scale(FloatSize(1, -1)); + context->translate(0, -inflatedRect.height()); + inflatedRect.setLocation(IntPoint()); + } + [buttonCell drawWithFrame:NSRect(inflatedRect) inView:view]; [buttonCell setControlView:nil]; + if (!view) + context->restore(); + if (![previousDefaultButtonCell isEqual:buttonCell]) [window setDefaultButtonCell:previousDefaultButtonCell]; diff --git a/WebCore/platform/network/qt/SocketStreamHandlePrivate.h b/WebCore/platform/network/qt/SocketStreamHandlePrivate.h index 9433d3f..235f1b1 100644 --- a/WebCore/platform/network/qt/SocketStreamHandlePrivate.h +++ b/WebCore/platform/network/qt/SocketStreamHandlePrivate.h @@ -59,7 +59,9 @@ public slots: void socketError(QAbstractSocket::SocketError); void socketClosedCallback(); void socketErrorCallback(int); +#ifndef QT_NO_OPENSSL void socketSslErrors(const QList<QSslError>&); +#endif public: QTcpSocket* m_socket; SocketStreamHandle* m_streamHandle; diff --git a/WebCore/platform/network/qt/SocketStreamHandleQt.cpp b/WebCore/platform/network/qt/SocketStreamHandleQt.cpp index d61d901..e666ff7 100644 --- a/WebCore/platform/network/qt/SocketStreamHandleQt.cpp +++ b/WebCore/platform/network/qt/SocketStreamHandleQt.cpp @@ -45,10 +45,17 @@ SocketStreamHandlePrivate::SocketStreamHandlePrivate(SocketStreamHandle* streamH m_streamHandle = streamHandle; m_socket = 0; bool isSecure = url.protocolIs("wss"); - if (isSecure) + + if (isSecure) { +#ifndef QT_NO_OPENSSL m_socket = new QSslSocket(this); - else +#endif + } else m_socket = new QTcpSocket(this); + + if (!m_socket) + return; + connect(m_socket, SIGNAL(connected()), this, SLOT(socketConnected())); connect(m_socket, SIGNAL(readyRead()), this, SLOT(socketReadyRead())); connect(m_socket, SIGNAL(disconnected()), this, SLOT(socketClosed())); @@ -59,9 +66,11 @@ SocketStreamHandlePrivate::SocketStreamHandlePrivate(SocketStreamHandle* streamH unsigned int port = url.hasPort() ? url.port() : (isSecure ? 443 : 80); QString host = url.host(); - if (isSecure) + if (isSecure) { +#ifndef QT_NO_OPENSSL static_cast<QSslSocket*>(m_socket)->connectToHostEncrypted(host, port); - else +#endif + } else m_socket->connectToHost(host, port); } @@ -88,7 +97,7 @@ void SocketStreamHandlePrivate::socketReadyRead() int SocketStreamHandlePrivate::send(const char* data, int len) { - if (m_socket->state() != QAbstractSocket::ConnectedState) + if (!m_socket || m_socket->state() != QAbstractSocket::ConnectedState) return 0; quint64 sentSize = m_socket->write(data, len); QMetaObject::invokeMethod(this, "socketSentData", Qt::QueuedConnection); @@ -138,6 +147,7 @@ void SocketStreamHandlePrivate::socketErrorCallback(int error) } } +#ifndef QT_NO_OPENSSL void SocketStreamHandlePrivate::socketSslErrors(const QList<QSslError>&) { // FIXME: based on http://tools.ietf.org/html/draft-hixie-thewebsocketprotocol-68#page-15 @@ -145,6 +155,8 @@ void SocketStreamHandlePrivate::socketSslErrors(const QList<QSslError>&) // We don't abort while this is still work in progress. static_cast<QSslSocket*>(m_socket)->ignoreSslErrors(); } +#endif + SocketStreamHandle::SocketStreamHandle(const KURL& url, SocketStreamHandleClient* client) : SocketStreamHandleBase(url, client) { diff --git a/WebCore/platform/qt/RenderThemeQt.cpp b/WebCore/platform/qt/RenderThemeQt.cpp index 83e3746..271c11a 100644 --- a/WebCore/platform/qt/RenderThemeQt.cpp +++ b/WebCore/platform/qt/RenderThemeQt.cpp @@ -129,7 +129,6 @@ PassRefPtr<RenderTheme> RenderTheme::themeForPage(Page* page) RenderThemeQt::RenderThemeQt(Page* page) : RenderTheme() , m_page(page) - , m_fallbackStyle(0) { QPushButton button; button.setAttribute(Qt::WA_MacSmallSize); @@ -139,6 +138,8 @@ RenderThemeQt::RenderThemeQt(Page* page) #ifdef Q_WS_MAC m_buttonFontPixelSize = fontInfo.pixelSize(); #endif + + m_fallbackStyle = QStyleFactory::create(QLatin1String("windows")); } RenderThemeQt::~RenderThemeQt() @@ -147,19 +148,17 @@ RenderThemeQt::~RenderThemeQt() } // for some widget painting, we need to fallback to Windows style -QStyle* RenderThemeQt::fallbackStyle() +QStyle* RenderThemeQt::fallbackStyle() const { - if (!m_fallbackStyle) - m_fallbackStyle = QStyleFactory::create(QLatin1String("windows")); - - if (!m_fallbackStyle) - m_fallbackStyle = QApplication::style(); - - return m_fallbackStyle; + return (m_fallbackStyle) ? m_fallbackStyle : QApplication::style(); } QStyle* RenderThemeQt::qStyle() const { +#ifdef Q_WS_MAEMO_5 + return fallbackStyle(); +#endif + if (m_page) { QWebPageClient* pageClient = m_page->chrome()->client()->platformPageClient(); @@ -773,6 +772,11 @@ bool RenderThemeQt::supportsFocus(ControlPart appearance) const void RenderThemeQt::setPaletteFromPageClientIfExists(QPalette& palette) const { +#ifdef Q_WS_MAEMO_5 + static QPalette lightGrayPalette(Qt::lightGray); + palette = lightGrayPalette; + return; +#endif // If the webview has a custom palette, use it if (!m_page) return; diff --git a/WebCore/platform/qt/RenderThemeQt.h b/WebCore/platform/qt/RenderThemeQt.h index e6bab7e..5385881 100644 --- a/WebCore/platform/qt/RenderThemeQt.h +++ b/WebCore/platform/qt/RenderThemeQt.h @@ -145,7 +145,7 @@ private: void setPaletteFromPageClientIfExists(QPalette&) const; - QStyle* fallbackStyle(); + QStyle* fallbackStyle() const; Page* m_page; diff --git a/WebCore/platform/sql/SQLiteTransaction.cpp b/WebCore/platform/sql/SQLiteTransaction.cpp index a4b2ac8..a34613f 100644 --- a/WebCore/platform/sql/SQLiteTransaction.cpp +++ b/WebCore/platform/sql/SQLiteTransaction.cpp @@ -64,6 +64,11 @@ void SQLiteTransaction::begin() void SQLiteTransaction::commit() { + // FIXME: this code is buggy; it assumes that COMMIT always succeeds which is not the case: + // the transaction could've been silently rolled back before getting to the COMMIT statement + // (https://bugs.webkit.org/show_bug.cgi?id=34280). However, the rest of the code does not + // know how to deal with a premature rollback and a failed COMMIT at this moment, so until + // we figure out what to do with bug 34280, it's better to leave this code as it is. if (m_inProgress) { ASSERT(m_db.m_transactionInProgress); m_db.executeCommand("COMMIT;"); @@ -84,8 +89,10 @@ void SQLiteTransaction::rollback() void SQLiteTransaction::stop() { - m_inProgress = false; - m_db.m_transactionInProgress = false; + if (m_inProgress) { + m_inProgress = false; + m_db.m_transactionInProgress = false; + } } } // namespace WebCore diff --git a/WebCore/platform/text/brew/TextBreakIteratorInternalICUBrew.cpp b/WebCore/platform/text/brew/TextBreakIteratorInternalICUBrew.cpp new file mode 100644 index 0000000..4384411 --- /dev/null +++ b/WebCore/platform/text/brew/TextBreakIteratorInternalICUBrew.cpp @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2010 Company 100, Inc. + * + * 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., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + * + */ + +#include "config.h" +#include "TextBreakIteratorInternalICU.h" + +#include "NotImplemented.h" + +namespace WebCore { + +const char* currentSearchLocaleID() +{ + notImplemented(); + return ""; +} + +const char* currentTextBreakLocaleID() +{ + notImplemented(); + return "en_us"; +} + +} // namespace WebCore + diff --git a/WebCore/platform/wx/KeyEventWin.cpp b/WebCore/platform/wx/KeyEventWin.cpp index f8f0155..e69de29 100644 --- a/WebCore/platform/wx/KeyEventWin.cpp +++ b/WebCore/platform/wx/KeyEventWin.cpp @@ -1,157 +0,0 @@ -/* - * Copyright (C) 2006 Apple Computer, 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 COMPUTER, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "PlatformKeyboardEvent.h" -#include <windows.h> - -#define REPEAT_COUNT_MASK 0x0000FFFF -#define NEW_RELEASE_STATE_MASK 0x80000000 -#define PREVIOUS_DOWN_STATE_MASK 0x40000000 -#define ALT_KEY_DOWN_MASK 0x20000000 - -#define HIGH_BIT_MASK_SHORT 0x8000 - -namespace WebCore { - -// FIXME: This is incomplete. We should change this to mirror -// more like what Firefox does, and generate these switch statements -// at build time. -static String keyIdentifierForWindowsKeyCode(short keyCode) -{ - switch (keyCode) { - case VK_MENU: - return "Alt"; - case VK_CLEAR: - return "Clear"; - case VK_DOWN: - return "Down"; - // "End" - case VK_END: - return "End"; - // "Enter" - case VK_RETURN: - return "Enter"; - case VK_EXECUTE: - return "Execute"; - case VK_F1: - return "F1"; - case VK_F2: - return "F2"; - case VK_F3: - return "F3"; - case VK_F4: - return "F4"; - case VK_F5: - return "F5"; - case VK_F6: - return "F6"; - case VK_F7: - return "F7"; - case VK_F8: - return "F8"; - case VK_F9: - return "F9"; - case VK_F10: - return "F11"; - case VK_F12: - return "F12"; - case VK_F13: - return "F13"; - case VK_F14: - return "F14"; - case VK_F15: - return "F15"; - case VK_F16: - return "F16"; - case VK_F17: - return "F17"; - case VK_F18: - return "F18"; - case VK_F19: - return "F19"; - case VK_F20: - return "F20"; - case VK_F21: - return "F21"; - case VK_F22: - return "F22"; - case VK_F23: - return "F23"; - case VK_F24: - return "F24"; - case VK_HELP: - return "Help"; - case VK_HOME: - return "Home"; - case VK_INSERT: - return "Insert"; - case VK_LEFT: - return "Left"; - case VK_NEXT: - return "PageDown"; - case VK_PRIOR: - return "PageUp"; - case VK_PAUSE: - return "Pause"; - case VK_SNAPSHOT: - return "PrintScreen"; - case VK_RIGHT: - return "Right"; - case VK_SCROLL: - return "Scroll"; - case VK_SELECT: - return "Select"; - case VK_UP: - return "Up"; - // Standard says that DEL becomes U+007F. - case VK_DELETE: - return "U+007F"; - default: - return String::sprintf("U+%04X", toupper(keyCode)); - } -} - -static String singleCharacterString(UChar c) { return String(&c, 1); } - -PlatformKeyboardEvent::PlatformKeyboardEvent(HWND hWnd, WPARAM wParam, LPARAM lParam) - : m_text(singleCharacterString(wParam)) - , m_unmodifiedText(singleCharacterString(wParam)) - , m_keyIdentifier(keyIdentifierForWindowsKeyCode(wParam)) - , m_isKeyUp((lParam & NEW_RELEASE_STATE_MASK)) - , m_autoRepeat(lParam & REPEAT_COUNT_MASK) - , m_WindowsKeyCode(wParam) - , m_isKeypad(false) // FIXME - , m_shiftKey(GetAsyncKeyState(VK_SHIFT) & HIGH_BIT_MASK_SHORT) - , m_ctrlKey(GetAsyncKeyState(VK_CONTROL) & HIGH_BIT_MASK_SHORT) - , m_altKey(lParam & ALT_KEY_DOWN_MASK) - , m_metaKey(lParam & ALT_KEY_DOWN_MASK) // FIXME: Is this right? - , m_isModifierKeyPress(false) -{ - if (!m_shiftKey) - m_text = String(singleCharacterString(tolower(wParam))); -} - -} diff --git a/WebCore/plugins/symbian/PluginViewSymbian.cpp b/WebCore/plugins/symbian/PluginViewSymbian.cpp index 4a93e45..3492868 100644 --- a/WebCore/plugins/symbian/PluginViewSymbian.cpp +++ b/WebCore/plugins/symbian/PluginViewSymbian.cpp @@ -54,7 +54,7 @@ #include "npruntime_impl.h" #include "runtime_root.h" #include <QKeyEvent> -#include <QPixmap.h> +#include <QPixmap> #include <QRegion> #include <QVector> #include <QWidget> diff --git a/WebCore/rendering/MediaControlElements.cpp b/WebCore/rendering/MediaControlElements.cpp index 9c56756..2b7a8c8 100644 --- a/WebCore/rendering/MediaControlElements.cpp +++ b/WebCore/rendering/MediaControlElements.cpp @@ -504,7 +504,7 @@ void MediaControlSeekButtonElement::defaultEventHandler(Event* event) m_capturing = true; frame->eventHandler()->setCapturingMouseEventsNode(this); } - m_mediaElement->pause(); + m_mediaElement->pause(event->fromUserGesture()); m_seekTimer.startRepeating(cSeekRepeatDelay); event->setDefaultHandled(); } else if (event->type() == eventNames().mouseupEvent) { @@ -731,30 +731,9 @@ void MediaControlTimeDisplayElement::setVisible(bool visible) renderer()->setStyle(style.get()); } -String MediaControlTimeDisplayElement::formatTime(float time) -{ - if (!isfinite(time)) - time = 0; - int seconds = (int)fabsf(time); - int hours = seconds / (60 * 60); - int minutes = (seconds / 60) % 60; - seconds %= 60; - if (hours) { - if (hours > 9) - return String::format("%s%02d:%02d:%02d", (time < 0 ? "-" : ""), hours, minutes, seconds); - - return String::format("%s%01d:%02d:%02d", (time < 0 ? "-" : ""), hours, minutes, seconds); - } - - return String::format("%s%02d:%02d", (time < 0 ? "-" : ""), minutes, seconds); -} - void MediaControlTimeDisplayElement::setCurrentValue(float time) { m_currentValue = time; - - ExceptionCode ec; - setInnerText(formatTime(m_currentValue), ec); } diff --git a/WebCore/rendering/MediaControlElements.h b/WebCore/rendering/MediaControlElements.h index 0ba4aba..21831ce 100644 --- a/WebCore/rendering/MediaControlElements.h +++ b/WebCore/rendering/MediaControlElements.h @@ -268,8 +268,6 @@ public: float currentValue() const { return m_currentValue; } private: - String formatTime(float time); - float m_currentValue; bool m_isVisible; }; diff --git a/WebCore/rendering/RenderBoxModelObject.cpp b/WebCore/rendering/RenderBoxModelObject.cpp index f2cd9bd..a68c930 100644 --- a/WebCore/rendering/RenderBoxModelObject.cpp +++ b/WebCore/rendering/RenderBoxModelObject.cpp @@ -118,7 +118,7 @@ bool RenderBoxModelScaleObserver::shouldPaintBackgroundAtLowQuality(GraphicsCont { // If the image is not a bitmap image, then none of this is relevant and we just paint at high // quality. - if (!image->isBitmapImage()) + if (!image || !image->isBitmapImage()) return false; // Make sure to use the unzoomed image size, since if a full page zoom is in effect, the image diff --git a/WebCore/rendering/RenderCounter.cpp b/WebCore/rendering/RenderCounter.cpp index 46bf9f4..3cb9a07 100644 --- a/WebCore/rendering/RenderCounter.cpp +++ b/WebCore/rendering/RenderCounter.cpp @@ -430,7 +430,8 @@ static void updateCounters(RenderObject* renderer) continue; if (parent) parent->removeChild(node, it->first.get()); - newParent->insertAfter(node, newPreviousSibling, it->first.get()); + if (newParent) + newParent->insertAfter(node, newPreviousSibling, it->first.get()); } } diff --git a/WebCore/rendering/RenderFieldset.cpp b/WebCore/rendering/RenderFieldset.cpp index 1f2b371..889b0bc 100644 --- a/WebCore/rendering/RenderFieldset.cpp +++ b/WebCore/rendering/RenderFieldset.cpp @@ -119,6 +119,9 @@ RenderBox* RenderFieldset::findLegend() const void RenderFieldset::paintBoxDecorations(PaintInfo& paintInfo, int tx, int ty) { + if (!shouldPaintWithinRoot(paintInfo)) + return; + int w = width(); int h = height(); RenderBox* legend = findLegend(); diff --git a/WebCore/rendering/RenderImage.h b/WebCore/rendering/RenderImage.h index bc5e2d8..b89a652 100644 --- a/WebCore/rendering/RenderImage.h +++ b/WebCore/rendering/RenderImage.h @@ -64,6 +64,8 @@ protected: bool isWidthSpecified() const; bool isHeightSpecified() const; + virtual void intrinsicSizeChanged() { imageChanged(imagePtr()); } + private: virtual const char* renderName() const { return "RenderImage"; } @@ -89,8 +91,6 @@ private: virtual IntSize imageSize(float multiplier) const { return m_cachedImage ? m_cachedImage->imageSize(multiplier) : IntSize(); } virtual WrappedImagePtr imagePtr() const { return m_cachedImage.get(); } - virtual void intrinsicSizeChanged() { imageChanged(imagePtr()); } - int calcAspectRatioWidth() const; int calcAspectRatioHeight() const; diff --git a/WebCore/rendering/RenderMedia.cpp b/WebCore/rendering/RenderMedia.cpp index 8acebfb..7100435 100644 --- a/WebCore/rendering/RenderMedia.cpp +++ b/WebCore/rendering/RenderMedia.cpp @@ -412,10 +412,15 @@ void RenderMedia::updateTimeDisplay() { if (!m_currentTimeDisplay || !m_currentTimeDisplay->renderer() || m_currentTimeDisplay->renderer()->style()->display() == NONE || style()->visibility() != VISIBLE) return; + float now = mediaElement()->currentTime(); float duration = mediaElement()->duration(); + // Allow the theme to format the time + ExceptionCode ec; + m_currentTimeDisplay->setInnerText(theme()->formatMediaControlsCurrentTime(now, duration), ec); m_currentTimeDisplay->setCurrentValue(now); + m_timeRemainingDisplay->setInnerText(theme()->formatMediaControlsRemainingTime(now, duration), ec); m_timeRemainingDisplay->setCurrentValue(now - duration); } diff --git a/WebCore/rendering/RenderTable.cpp b/WebCore/rendering/RenderTable.cpp index 677851e..61e05ad 100644 --- a/WebCore/rendering/RenderTable.cpp +++ b/WebCore/rendering/RenderTable.cpp @@ -552,6 +552,9 @@ void RenderTable::paintObject(PaintInfo& paintInfo, int tx, int ty) void RenderTable::paintBoxDecorations(PaintInfo& paintInfo, int tx, int ty) { + if (!shouldPaintWithinRoot(paintInfo)) + return; + int w = width(); int h = height(); diff --git a/WebCore/rendering/RenderTableCell.cpp b/WebCore/rendering/RenderTableCell.cpp index 2395527..39a821f 100644 --- a/WebCore/rendering/RenderTableCell.cpp +++ b/WebCore/rendering/RenderTableCell.cpp @@ -814,6 +814,9 @@ void RenderTableCell::paintCollapsedBorder(GraphicsContext* graphicsContext, int void RenderTableCell::paintBackgroundsBehindCell(PaintInfo& paintInfo, int tx, int ty, RenderObject* backgroundObject) { + if (!shouldPaintWithinRoot(paintInfo)) + return; + if (!backgroundObject) return; @@ -853,6 +856,9 @@ void RenderTableCell::paintBackgroundsBehindCell(PaintInfo& paintInfo, int tx, i void RenderTableCell::paintBoxDecorations(PaintInfo& paintInfo, int tx, int ty) { + if (!shouldPaintWithinRoot(paintInfo)) + return; + RenderTable* tableElt = table(); if (!tableElt->collapseBorders() && style()->emptyCells() == HIDE && !firstChild()) return; diff --git a/WebCore/rendering/RenderTextControlMultiLine.cpp b/WebCore/rendering/RenderTextControlMultiLine.cpp index afc3edd..0b4c7a7 100644 --- a/WebCore/rendering/RenderTextControlMultiLine.cpp +++ b/WebCore/rendering/RenderTextControlMultiLine.cpp @@ -50,7 +50,7 @@ void RenderTextControlMultiLine::subtreeHasChanged() RenderTextControl::subtreeHasChanged(); HTMLTextAreaElement* textArea = static_cast<HTMLTextAreaElement*>(node()); textArea->setFormControlValueMatchesRenderer(false); - textArea->updateValidity(); + textArea->setNeedsValidityCheck(); if (!node()->focused()) return; diff --git a/WebCore/rendering/RenderTheme.cpp b/WebCore/rendering/RenderTheme.cpp index af92465..f1e564b 100644 --- a/WebCore/rendering/RenderTheme.cpp +++ b/WebCore/rendering/RenderTheme.cpp @@ -440,6 +440,35 @@ bool RenderTheme::shouldRenderMediaControlPart(ControlPart part, Element* e) return true; } } + +String RenderTheme::formatMediaControlsTime(float time) const +{ + if (!isfinite(time)) + time = 0; + int seconds = (int)fabsf(time); + int hours = seconds / (60 * 60); + int minutes = (seconds / 60) % 60; + seconds %= 60; + if (hours) { + if (hours > 9) + return String::format("%s%02d:%02d:%02d", (time < 0 ? "-" : ""), hours, minutes, seconds); + + return String::format("%s%01d:%02d:%02d", (time < 0 ? "-" : ""), hours, minutes, seconds); + } + + return String::format("%s%02d:%02d", (time < 0 ? "-" : ""), minutes, seconds); +} + +String RenderTheme::formatMediaControlsCurrentTime(float currentTime, float /*duration*/) const +{ + return formatMediaControlsTime(currentTime); +} + +String RenderTheme::formatMediaControlsRemainingTime(float currentTime, float duration) const +{ + return formatMediaControlsTime(currentTime - duration); +} + #endif Color RenderTheme::activeSelectionBackgroundColor() const diff --git a/WebCore/rendering/RenderTheme.h b/WebCore/rendering/RenderTheme.h index a7c6e13..32ae5e5 100644 --- a/WebCore/rendering/RenderTheme.h +++ b/WebCore/rendering/RenderTheme.h @@ -175,6 +175,9 @@ public: virtual bool shouldRenderMediaControlPart(ControlPart, Element*); virtual double mediaControlsFadeInDuration() { return 0.1; } virtual double mediaControlsFadeOutDuration() { return 0.3; } + virtual String formatMediaControlsTime(float time) const; + virtual String formatMediaControlsCurrentTime(float currentTime, float duration) const; + virtual String formatMediaControlsRemainingTime(float currentTime, float duration) const; #endif protected: diff --git a/WebCore/rendering/RenderThemeChromiumLinux.cpp b/WebCore/rendering/RenderThemeChromiumLinux.cpp index f972a12..13c9cd6 100644 --- a/WebCore/rendering/RenderThemeChromiumLinux.cpp +++ b/WebCore/rendering/RenderThemeChromiumLinux.cpp @@ -25,8 +25,8 @@ #include "config.h" #include "RenderThemeChromiumLinux.h" -#include "Color.h" #include "CSSValueKeywords.h" +#include "Color.h" #include "RenderObject.h" #include "UserAgentStyleSheets.h" @@ -44,6 +44,8 @@ unsigned RenderThemeChromiumLinux::m_inactiveSelectionBackgroundColor = unsigned RenderThemeChromiumLinux::m_inactiveSelectionForegroundColor = 0xff323232; +double RenderThemeChromiumLinux::m_caretBlinkInterval; + PassRefPtr<RenderTheme> RenderThemeChromiumLinux::create() { return adoptRef(new RenderThemeChromiumLinux()); diff --git a/WebCore/rendering/RenderThemeChromiumLinux.h b/WebCore/rendering/RenderThemeChromiumLinux.h index 90b043d..c60dec3 100644 --- a/WebCore/rendering/RenderThemeChromiumLinux.h +++ b/WebCore/rendering/RenderThemeChromiumLinux.h @@ -56,7 +56,7 @@ namespace WebCore { virtual void adjustSliderThumbSize(RenderObject*) const; - void setCaretBlinkInterval(double interval); + static void setCaretBlinkInterval(double interval); virtual double caretBlinkIntervalInternal() const; static void setSelectionColors(unsigned activeBackgroundColor, @@ -78,7 +78,7 @@ namespace WebCore { // A general method asking if any control tinting is supported at all. virtual bool supportsControlTints() const; - double m_caretBlinkInterval; + static double m_caretBlinkInterval; static unsigned m_activeSelectionBackgroundColor; static unsigned m_activeSelectionForegroundColor; diff --git a/WebCore/rendering/RenderThemeChromiumMac.h b/WebCore/rendering/RenderThemeChromiumMac.h index 61b5e8f..8101038 100644 --- a/WebCore/rendering/RenderThemeChromiumMac.h +++ b/WebCore/rendering/RenderThemeChromiumMac.h @@ -191,7 +191,6 @@ private: mutable HashMap<int, RGBA32> m_systemColorCache; RetainPtr<WebCoreRenderThemeNotificationObserver> m_notificationObserver; - bool paintMediaButtonInternal(GraphicsContext*, const IntRect&, Image*); }; } // namespace WebCore diff --git a/WebCore/rendering/RenderThemeChromiumMac.mm b/WebCore/rendering/RenderThemeChromiumMac.mm index 4e57cb5..e274b05 100644 --- a/WebCore/rendering/RenderThemeChromiumMac.mm +++ b/WebCore/rendering/RenderThemeChromiumMac.mm @@ -41,7 +41,7 @@ #import "RenderSlider.h" #import "RenderView.h" #import "SharedBuffer.h" -#import "UserAgentStyleSheets.h" +#import "TimeRanges.h" #import "WebCoreSystemInterface.h" #import "UserAgentStyleSheets.h" #import <Carbon/Carbon.h> @@ -78,7 +78,7 @@ using std::min; // The methods in this file are specific to the Mac OS X platform. -// FIXME: The platform-independent code in this class should be factored out and merged with RenderThemeSafari. +// FIXME: The platform-independent code in this class should be factored out and merged with RenderThemeSafari. @interface WebCoreRenderThemeNotificationObserver : NSObject { @@ -96,7 +96,7 @@ using std::min; { [super init]; _theme = theme; - + return self; } @@ -322,7 +322,7 @@ static RGBA32 convertNSColorToColor(NSColor *color) static_cast<int>(scaleFactor * [colorInColorSpace blueComponent])); } - // This conversion above can fail if the NSColor in question is an NSPatternColor + // This conversion above can fail if the NSColor in question is an NSPatternColor // (as many system colors are). These colors are actually a repeating pattern // not just a solid color. To work around this we simply draw a 1x1 image of // the color and use that pixel's color. It might be better to use an average of @@ -390,7 +390,7 @@ Color RenderThemeChromiumMac::systemColor(int cssValueId) const { if (m_systemColorCache.contains(cssValueId)) return m_systemColorCache.get(cssValueId); - + Color color; switch (cssValueId) { case CSSValueActiveborder: @@ -504,7 +504,7 @@ bool RenderThemeChromiumMac::isControlStyled(const RenderStyle* style, const Bor { if (style->appearance() == TextFieldPart || style->appearance() == TextAreaPart || style->appearance() == ListboxPart) return style->border() != border; - + // FIXME: This is horrible, but there is not much else that can be done. Menu lists cannot draw properly when // scaled. They can't really draw properly when transformed either. We can't detect the transform case at style // adjustment time so that will just have to stay broken. We can however detect that we're zooming. If zooming @@ -518,13 +518,14 @@ bool RenderThemeChromiumMac::isControlStyled(const RenderStyle* style, const Bor void RenderThemeChromiumMac::adjustRepaintRect(const RenderObject* o, IntRect& r) { ControlPart part = o->style()->appearance(); - + #if USE(NEW_THEME) switch (part) { case CheckboxPart: case RadioPart: case PushButtonPart: case SquareButtonPart: + case ListButtonPart: case DefaultButtonPart: case ButtonPart: return RenderTheme::adjustRepaintRect(o, r); @@ -565,7 +566,7 @@ IntRect RenderThemeChromiumMac::inflateRect(const IntRect& r, const IntSize& siz FloatRect RenderThemeChromiumMac::convertToPaintingRect(const RenderObject* inputRenderer, const RenderObject* partRenderer, const FloatRect& inputRect, const IntRect& r) const { FloatRect partRect(inputRect); - + // Compute an offset between the part renderer and the input renderer FloatSize offsetFromInputRenderer; const RenderObject* renderer = partRenderer; @@ -760,7 +761,7 @@ bool RenderThemeChromiumMac::paintCapsLockIndicator(RenderObject*, const RenderO LocalCurrentGraphicsContext localContext(paintInfo.context); wkDrawCapsLockIndicator(paintInfo.context->platformContext(), r); - + return false; } @@ -820,7 +821,7 @@ bool RenderThemeChromiumMac::paintMenuList(RenderObject* o, const RenderObject:: inflatedRect = inflateRect(inflatedRect, size, popupButtonMargins(), zoomLevel); paintInfo.context->save(); - + #ifndef BUILDING_ON_TIGER // On Leopard, the cell will draw outside of the given rect, so we have to clip to the rect paintInfo.context->clip(inflatedRect); @@ -980,10 +981,10 @@ bool RenderThemeChromiumMac::paintMenuListButton(RenderObject* o, const RenderOb if (bounds.width() < arrowWidth + arrowPaddingLeft * o->style()->effectiveZoom()) return false; - + paintInfo.context->save(); - paintInfo.context->setFillColor(o->style()->color(), DeviceColorSpace); + paintInfo.context->setFillColor(o->style()->color(), o->style()->colorSpace()); paintInfo.context->setStrokeStyle(NoStroke); FloatPoint arrow1[3]; @@ -1036,7 +1037,7 @@ void RenderThemeChromiumMac::adjustMenuListStyle(CSSStyleSelector* selector, Ren style->resetBorder(); style->resetPadding(); - + // Height is locked to auto. style->setHeight(Length(Auto)); @@ -1106,7 +1107,7 @@ void RenderThemeChromiumMac::adjustMenuListButtonStyle(CSSStyleSelector*, Render const int minHeight = 15; style->setMinHeight(Length(minHeight, Fixed)); - + style->setLineHeight(RenderStyle::initialLineHeight()); } @@ -1136,6 +1137,9 @@ int RenderThemeChromiumMac::minimumMenuListSize(RenderStyle* style) const return sizeForSystemFont(style, menuListSizes()).width(); } +const int trackWidth = 5; +const int trackRadius = 2; + void RenderThemeChromiumMac::adjustSliderTrackStyle(CSSStyleSelector*, RenderStyle* style, Element*) const { style->setBoxShadow(0); @@ -1143,9 +1147,6 @@ void RenderThemeChromiumMac::adjustSliderTrackStyle(CSSStyleSelector*, RenderSty bool RenderThemeChromiumMac::paintSliderTrack(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r) { - static const int trackWidth = 5; - static const int trackRadius = 2; - IntRect bounds = r; float zoomLevel = o->style()->effectiveZoom(); float zoomedTrackWidth = trackWidth * zoomLevel; @@ -1179,7 +1180,7 @@ bool RenderThemeChromiumMac::paintSliderTrack(RenderObject* o, const RenderObjec radius, radius); CGContextDrawShading(context, mainShading.get()); paintInfo.context->restore(); - + return false; } @@ -1201,7 +1202,7 @@ bool RenderThemeChromiumMac::paintSliderThumb(RenderObject* o, const RenderObjec LocalCurrentGraphicsContext localContext(paintInfo.context); // Update the various states we respond to. - updateActiveState(sliderThumbCell, o); + updateActiveState(sliderThumbCell, o->parent()); updateEnabledState(sliderThumbCell, o->parent()); updateFocusedState(sliderThumbCell, o->parent()); @@ -1233,7 +1234,7 @@ bool RenderThemeChromiumMac::paintSliderThumb(RenderObject* o, const RenderObjec paintInfo.context->save(); float zoomLevel = o->style()->effectiveZoom(); - + FloatRect unzoomedRect = bounds; if (zoomLevel != 1.0f) { unzoomedRect.setWidth(unzoomedRect.width() / zoomLevel); @@ -1251,22 +1252,6 @@ bool RenderThemeChromiumMac::paintSliderThumb(RenderObject* o, const RenderObjec return false; } -void RenderThemeChromiumMac::adjustSliderThumbSize(RenderObject* o) const -{ - static const int sliderThumbWidth = 15; - static const int sliderThumbHeight = 15; - - float zoomLevel = o->style()->effectiveZoom(); - if (o->style()->appearance() == SliderThumbHorizontalPart || o->style()->appearance() == SliderThumbVerticalPart) { - o->style()->setWidth(Length(static_cast<int>(sliderThumbWidth * zoomLevel), Fixed)); - o->style()->setHeight(Length(static_cast<int>(sliderThumbHeight * zoomLevel), Fixed)); - } - -#if ENABLE(VIDEO) - RenderMediaControlsChromium::adjustMediaSliderThumbSize(o); -#endif -} - bool RenderThemeChromiumMac::paintSearchField(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r) { NSSearchFieldCell* search = this->search(); @@ -1279,7 +1264,7 @@ bool RenderThemeChromiumMac::paintSearchField(RenderObject* o, const RenderObjec float zoomLevel = o->style()->effectiveZoom(); IntRect unzoomedRect = r; - + if (zoomLevel != 1.0f) { unzoomedRect.setWidth(unzoomedRect.width() / zoomLevel); unzoomedRect.setHeight(unzoomedRect.height() / zoomLevel); @@ -1328,7 +1313,7 @@ void RenderThemeChromiumMac::setSearchFieldSize(RenderStyle* style) const // If the width and height are both specified, then we have nothing to do. if (!style->width().isIntrinsicOrAuto() && !style->height().isAuto()) return; - + // Use the font size to determine the intrinsic width of the control. setSizeFromFont(style, searchFieldSizes()); } @@ -1345,19 +1330,19 @@ void RenderThemeChromiumMac::adjustSearchFieldStyle(CSSStyleSelector* selector, style->setBorderBottomWidth(borderWidth); style->setBorderBottomStyle(INSET); style->setBorderTopWidth(borderWidth); - style->setBorderTopStyle(INSET); - + style->setBorderTopStyle(INSET); + // Override height. style->setHeight(Length(Auto)); setSearchFieldSize(style); - + // Override padding size to match AppKit text positioning. const int padding = 1 * style->effectiveZoom(); style->setPaddingLeft(Length(padding, Fixed)); style->setPaddingRight(Length(padding, Fixed)); style->setPaddingTop(Length(padding, Fixed)); style->setPaddingBottom(Length(padding, Fixed)); - + NSControlSize controlSize = controlSizeForFont(style); setFontFromControlSize(selector, style, controlSize); @@ -1495,7 +1480,7 @@ bool RenderThemeChromiumMac::paintSearchFieldResultsButton(RenderObject* o, cons FloatRect localBounds = [search searchButtonRectForBounds:NSRect(input->renderBox()->borderBoxRect())]; localBounds = convertToPaintingRect(input->renderer(), o, localBounds, r); - + IntRect unzoomedRect(localBounds); if (zoomLevel != 1.0f) { unzoomedRect.setWidth(unzoomedRect.width() / zoomLevel); @@ -1507,12 +1492,28 @@ bool RenderThemeChromiumMac::paintSearchFieldResultsButton(RenderObject* o, cons [[search searchButtonCell] drawWithFrame:unzoomedRect inView:FlippedView()]; [[search searchButtonCell] setControlView:nil]; - + paintInfo.context->restore(); return false; } +const int sliderThumbWidth = 15; +const int sliderThumbHeight = 15; + +void RenderThemeChromiumMac::adjustSliderThumbSize(RenderObject* o) const +{ + float zoomLevel = o->style()->effectiveZoom(); + if (o->style()->appearance() == SliderThumbHorizontalPart || o->style()->appearance() == SliderThumbVerticalPart) { + o->style()->setWidth(Length(static_cast<int>(sliderThumbWidth * zoomLevel), Fixed)); + o->style()->setHeight(Length(static_cast<int>(sliderThumbHeight * zoomLevel), Fixed)); + } + +#if ENABLE(VIDEO) + RenderMediaControlsChromium::adjustMediaSliderThumbSize(o); +#endif +} + #if ENABLE(VIDEO) bool RenderThemeChromiumMac::shouldRenderMediaControlPart(ControlPart part, Element* e) { @@ -1553,7 +1554,7 @@ bool RenderThemeChromiumMac::paintMediaControlsBackground(RenderObject* object, { return RenderMediaControlsChromium::paintMediaControlsPart(MediaTimelineContainer, object, paintInfo, rect); } - + String RenderThemeChromiumMac::extraMediaControlsStyleSheet() { return String(mediaControlsChromiumUserAgentStyleSheet, sizeof(mediaControlsChromiumUserAgentStyleSheet)); @@ -1568,7 +1569,7 @@ NSPopUpButtonCell* RenderThemeChromiumMac::popupButton() const [m_popupButton.get() setUsesItemFromMenu:NO]; [m_popupButton.get() setFocusRingType:NSFocusRingTypeExterior]; } - + return m_popupButton.get(); } @@ -1602,7 +1603,7 @@ NSSliderCell* RenderThemeChromiumMac::sliderThumbHorizontal() const [m_sliderThumbHorizontal.get() setControlSize:NSSmallControlSize]; [m_sliderThumbHorizontal.get() setFocusRingType:NSFocusRingTypeExterior]; } - + return m_sliderThumbHorizontal.get(); } @@ -1615,7 +1616,7 @@ NSSliderCell* RenderThemeChromiumMac::sliderThumbVertical() const [m_sliderThumbVertical.get() setControlSize:NSSmallControlSize]; [m_sliderThumbVertical.get() setFocusRingType:NSFocusRingTypeExterior]; } - + return m_sliderThumbVertical.get(); } diff --git a/WebCore/rendering/RenderVideo.cpp b/WebCore/rendering/RenderVideo.cpp index d2a9620..813f2ef 100644 --- a/WebCore/rendering/RenderVideo.cpp +++ b/WebCore/rendering/RenderVideo.cpp @@ -85,7 +85,7 @@ RenderVideo::~RenderVideo() void RenderVideo::intrinsicSizeChanged() { if (videoElement()->shouldDisplayPosterImage()) - RenderVideo::intrinsicSizeChanged(); + RenderMedia::intrinsicSizeChanged(); videoSizeChanged(); } @@ -104,7 +104,7 @@ void RenderVideo::videoSizeChanged() void RenderVideo::imageChanged(WrappedImagePtr newImage, const IntRect* rect) { - RenderImage::imageChanged(newImage, rect); + RenderMedia::imageChanged(newImage, rect); // Cache the image intrinsic size so we can continue to use it to draw the image correctly // even after we know the video intrisic size but aren't able to draw video frames yet diff --git a/WebCore/storage/SQLTransaction.cpp b/WebCore/storage/SQLTransaction.cpp index de615ca..db25e1a 100644 --- a/WebCore/storage/SQLTransaction.cpp +++ b/WebCore/storage/SQLTransaction.cpp @@ -35,6 +35,7 @@ #include "Database.h" #include "DatabaseAuthorizer.h" #include "DatabaseDetails.h" +#include "DatabaseThread.h" #include "ExceptionCode.h" #include "Logging.h" #include "Page.h" @@ -83,6 +84,7 @@ SQLTransaction::SQLTransaction(Database* db, PassRefPtr<SQLTransactionCallback> SQLTransaction::~SQLTransaction() { + ASSERT(!m_sqliteTransaction); } void SQLTransaction::executeSQL(const String& sqlStatement, const Vector<SQLValue>& arguments, PassRefPtr<SQLStatementCallback> callback, PassRefPtr<SQLStatementErrorCallback> callbackError, ExceptionCode& e) @@ -203,6 +205,16 @@ void SQLTransaction::performPendingCallback() (this->*m_nextStep)(); } +void SQLTransaction::notifyDatabaseThreadIsShuttingDown() +{ + ASSERT(currentThread() == database()->scriptExecutionContext()->databaseThread()->getThreadID()); + + // If the transaction is in progress, we should roll it back here, since this is our last + // oportunity to do something related to this transaction on the DB thread. + // Clearing m_sqliteTransaction invokes SQLiteTransaction's destructor which does just that. + m_sqliteTransaction.clear(); +} + void SQLTransaction::acquireLock() { m_database->transactionCoordinator()->acquireLock(this); @@ -491,6 +503,7 @@ void SQLTransaction::cleanupAfterSuccessCallback() // There is no next step LOG(StorageAPI, "Transaction %p is complete\n", this); ASSERT(!m_database->m_sqliteDatabase.transactionInProgress()); + m_sqliteTransaction.clear(); m_nextStep = 0; // Release the lock on this database diff --git a/WebCore/storage/SQLTransaction.h b/WebCore/storage/SQLTransaction.h index 6d6a8d7..1b02d01 100644 --- a/WebCore/storage/SQLTransaction.h +++ b/WebCore/storage/SQLTransaction.h @@ -80,6 +80,7 @@ public: Database* database() { return m_database.get(); } bool isReadOnly() { return m_readOnly; } + void notifyDatabaseThreadIsShuttingDown(); private: SQLTransaction(Database*, PassRefPtr<SQLTransactionCallback>, PassRefPtr<SQLTransactionErrorCallback>, diff --git a/WebCore/storage/SQLTransactionCoordinator.cpp b/WebCore/storage/SQLTransactionCoordinator.cpp index efdcd1d..0fe5bda 100644 --- a/WebCore/storage/SQLTransactionCoordinator.cpp +++ b/WebCore/storage/SQLTransactionCoordinator.cpp @@ -109,6 +109,20 @@ void SQLTransactionCoordinator::releaseLock(SQLTransaction* transaction) void SQLTransactionCoordinator::shutdown() { + // Notify all transactions in progress that the database thread is shutting down + for (CoordinationInfoMap::iterator coordinationInfoIterator = m_coordinationInfoMap.begin(); + coordinationInfoIterator != m_coordinationInfoMap.end(); ++coordinationInfoIterator) { + CoordinationInfo& info = coordinationInfoIterator->second; + if (info.activeWriteTransaction) + info.activeWriteTransaction->notifyDatabaseThreadIsShuttingDown(); + for (HashSet<RefPtr<SQLTransaction> >::iterator activeReadTransactionsIterator = + info.activeReadTransactions.begin(); + activeReadTransactionsIterator != info.activeReadTransactions.end(); + ++activeReadTransactionsIterator) { + (*activeReadTransactionsIterator)->notifyDatabaseThreadIsShuttingDown(); + } + } + // Clean up all pending transactions for all databases m_coordinationInfoMap.clear(); } diff --git a/WebCore/websockets/WebSocket.cpp b/WebCore/websockets/WebSocket.cpp index 0435490..f50dc5c 100644 --- a/WebCore/websockets/WebSocket.cpp +++ b/WebCore/websockets/WebSocket.cpp @@ -151,6 +151,7 @@ void WebSocket::connect(const KURL& url, const String& protocol, ExceptionCode& m_channel = ThreadableWebSocketChannel::create(scriptExecutionContext(), this, m_url, m_protocol); m_channel->connect(); + ActiveDOMObject::setPendingActivity(this); } bool WebSocket::send(const String& message, ExceptionCode& ec) @@ -198,6 +199,26 @@ ScriptExecutionContext* WebSocket::scriptExecutionContext() const return ActiveDOMObject::scriptExecutionContext(); } +void WebSocket::contextDestroyed() +{ + LOG(Network, "WebSocket %p scriptExecutionContext destroyed", this); + ASSERT(!m_channel); + ASSERT(m_state == CLOSED); + ActiveDOMObject::contextDestroyed(); +} + +void WebSocket::stop() +{ + bool pending = hasPendingActivity(); + if (m_channel) + m_channel->disconnect(); + m_channel = 0; + m_state = CLOSED; + ActiveDOMObject::stop(); + if (pending) + ActiveDOMObject::unsetPendingActivity(this); +} + void WebSocket::didConnect() { LOG(Network, "WebSocket %p didConnect", this); @@ -224,6 +245,9 @@ void WebSocket::didClose() LOG(Network, "WebSocket %p didClose", this); m_state = CLOSED; dispatchEvent(Event::create(eventNames().closeEvent, false, false)); + m_channel = 0; + if (hasPendingActivity()) + ActiveDOMObject::unsetPendingActivity(this); } EventTargetData* WebSocket::eventTargetData() diff --git a/WebCore/websockets/WebSocket.h b/WebCore/websockets/WebSocket.h index 18e2b25..c72dbbd 100644 --- a/WebCore/websockets/WebSocket.h +++ b/WebCore/websockets/WebSocket.h @@ -82,6 +82,8 @@ namespace WebCore { virtual WebSocket* toWebSocket() { return this; } virtual ScriptExecutionContext* scriptExecutionContext() const; + virtual void contextDestroyed(); + virtual void stop(); using RefCounted<WebSocket>::ref; using RefCounted<WebSocket>::deref; diff --git a/WebCore/websockets/WebSocketChannel.cpp b/WebCore/websockets/WebSocketChannel.cpp index 5c0f4c3..df66c14 100644 --- a/WebCore/websockets/WebSocketChannel.cpp +++ b/WebCore/websockets/WebSocketChannel.cpp @@ -141,6 +141,7 @@ void WebSocketChannel::didClose(SocketStreamHandle* handle) void WebSocketChannel::didReceiveData(SocketStreamHandle* handle, const char* data, int len) { LOG(Network, "WebSocketChannel %p didReceiveData %d", this, len); + RefPtr<WebSocketChannel> protect(this); // The client can close the channel, potentially removing the last reference. ASSERT(handle == m_handle); if (!appendToBuffer(data, len)) { handle->close(); diff --git a/WebCore/workers/DefaultSharedWorkerRepository.cpp b/WebCore/workers/DefaultSharedWorkerRepository.cpp index 655b90e..e4fa5d3 100644 --- a/WebCore/workers/DefaultSharedWorkerRepository.cpp +++ b/WebCore/workers/DefaultSharedWorkerRepository.cpp @@ -248,7 +248,7 @@ private: }; // Loads the script on behalf of a worker. -class SharedWorkerScriptLoader : public RefCounted<SharedWorkerScriptLoader>, public ActiveDOMObject, private WorkerScriptLoaderClient { +class SharedWorkerScriptLoader : public RefCounted<SharedWorkerScriptLoader>, private WorkerScriptLoaderClient { public: SharedWorkerScriptLoader(PassRefPtr<SharedWorker>, PassOwnPtr<MessagePortChannel>, PassRefPtr<SharedWorkerProxy>); void load(const KURL&); @@ -264,8 +264,7 @@ private: }; SharedWorkerScriptLoader::SharedWorkerScriptLoader(PassRefPtr<SharedWorker> worker, PassOwnPtr<MessagePortChannel> port, PassRefPtr<SharedWorkerProxy> proxy) - : ActiveDOMObject(worker->scriptExecutionContext(), this) - , m_worker(worker) + : m_worker(worker) , m_port(port) , m_proxy(proxy) { @@ -274,25 +273,27 @@ SharedWorkerScriptLoader::SharedWorkerScriptLoader(PassRefPtr<SharedWorker> work void SharedWorkerScriptLoader::load(const KURL& url) { // Mark this object as active for the duration of the load. - ASSERT(!hasPendingActivity()); m_scriptLoader = new WorkerScriptLoader(); - m_scriptLoader->loadAsynchronously(scriptExecutionContext(), url, DenyCrossOriginRequests, this); + m_scriptLoader->loadAsynchronously(m_worker->scriptExecutionContext(), url, DenyCrossOriginRequests, this); - // Stay alive until the load finishes. - setPendingActivity(this); + // Stay alive (and keep the SharedWorker and JS wrapper alive) until the load finishes. + this->ref(); m_worker->setPendingActivity(m_worker.get()); } void SharedWorkerScriptLoader::notifyFinished() { + // FIXME: This method is not guaranteed to be invoked if we are loading from WorkerContext (see comment for WorkerScriptLoaderClient::notifyFinished()). + // We need to address this before supporting nested workers. + // Hand off the just-loaded code to the repository to start up the worker thread. if (m_scriptLoader->failed()) m_worker->dispatchEvent(Event::create(eventNames().errorEvent, false, true)); else - DefaultSharedWorkerRepository::instance().workerScriptLoaded(*m_proxy, scriptExecutionContext()->userAgent(m_scriptLoader->url()), m_scriptLoader->script(), m_port.release()); + DefaultSharedWorkerRepository::instance().workerScriptLoaded(*m_proxy, m_worker->scriptExecutionContext()->userAgent(m_scriptLoader->url()), m_scriptLoader->script(), m_port.release()); m_worker->unsetPendingActivity(m_worker.get()); - unsetPendingActivity(this); // This frees this object - must be the last action in this function. + this->deref(); // This frees this object - must be the last action in this function. } DefaultSharedWorkerRepository& DefaultSharedWorkerRepository::instance() diff --git a/WebCore/workers/WorkerScriptLoaderClient.h b/WebCore/workers/WorkerScriptLoaderClient.h index e3903c0..7dc3a1e 100644 --- a/WebCore/workers/WorkerScriptLoaderClient.h +++ b/WebCore/workers/WorkerScriptLoaderClient.h @@ -34,8 +34,10 @@ namespace WebCore { class WorkerScriptLoaderClient { public: + // FIXME: notifyFinished() is not currently guaranteed to be invoked if used from worker context and the worker shuts down in the middle of an operation. + // This will cause leaks when we support nested workers. virtual void notifyFinished() { } - + protected: virtual ~WorkerScriptLoaderClient() { } }; |