diff options
author | Ben Murdoch <benm@google.com> | 2011-05-16 16:25:10 +0100 |
---|---|---|
committer | Ben Murdoch <benm@google.com> | 2011-05-23 18:54:14 +0100 |
commit | ab9e7a118cf1ea2e3a93dce683b2ded3e7291ddb (patch) | |
tree | db769fadd053248f85db67434a5b275224defef7 /Source/WebCore | |
parent | 52e2557aeb8477967e97fd24f20f8f407a10fa15 (diff) | |
download | external_webkit-ab9e7a118cf1ea2e3a93dce683b2ded3e7291ddb.zip external_webkit-ab9e7a118cf1ea2e3a93dce683b2ded3e7291ddb.tar.gz external_webkit-ab9e7a118cf1ea2e3a93dce683b2ded3e7291ddb.tar.bz2 |
Merge WebKit at r76408: Initial merge by git.
Change-Id: I5b91decbd693ccbf5c1b8354b37cd68cc9a1ea53
Diffstat (limited to 'Source/WebCore')
831 files changed, 18151 insertions, 6770 deletions
diff --git a/Source/WebCore/Android.jscbindings.mk b/Source/WebCore/Android.jscbindings.mk index 697f5ef..281425c 100644 --- a/Source/WebCore/Android.jscbindings.mk +++ b/Source/WebCore/Android.jscbindings.mk @@ -113,7 +113,11 @@ LOCAL_SRC_FILES += \ bindings/js/JSDirectoryEntrySyncCustom.cpp \ bindings/js/JSDocumentCustom.cpp \ bindings/js/JSElementCustom.cpp \ +<<<<<<< HEAD bindings/js/JSEntrySyncCustom.cpp \ +======= + bindings/js/JSErrorHandler.cpp \ +>>>>>>> WebKit.org at r76408 bindings/js/JSEventCustom.cpp \ bindings/js/JSEventListener.cpp \ bindings/js/JSEventTarget.cpp \ @@ -187,7 +191,6 @@ LOCAL_SRC_FILES += \ bindings/js/JSWebKitPointCustom.cpp \ bindings/js/JSWorkerContextBase.cpp \ bindings/js/JSWorkerContextCustom.cpp \ - bindings/js/JSWorkerContextErrorHandler.cpp \ bindings/js/JSWorkerCustom.cpp \ bindings/js/JSXMLHttpRequestCustom.cpp \ bindings/js/JSXMLHttpRequestUploadCustom.cpp \ diff --git a/Source/WebCore/Android.mk b/Source/WebCore/Android.mk index 102b401..a3e6d09 100644 --- a/Source/WebCore/Android.mk +++ b/Source/WebCore/Android.mk @@ -597,6 +597,7 @@ LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \ platform/graphics/Path.cpp \ platform/graphics/PathTraversalState.cpp \ platform/graphics/Pattern.cpp \ + platform/graphics/RoundedIntRect.cpp \ platform/graphics/SegmentedFontData.cpp \ platform/graphics/SimpleFontData.cpp \ platform/graphics/StringTruncator.cpp \ diff --git a/Source/WebCore/CMakeLists.txt b/Source/WebCore/CMakeLists.txt index 8050b48..95d8790 100644 --- a/Source/WebCore/CMakeLists.txt +++ b/Source/WebCore/CMakeLists.txt @@ -237,6 +237,7 @@ SET(WebCore_IDL_FILES html/HTMLImageElement.idl html/HTMLInputElement.idl html/HTMLIsIndexElement.idl + html/HTMLKeygenElement.idl html/HTMLLabelElement.idl html/HTMLLegendElement.idl html/HTMLLIElement.idl @@ -291,6 +292,7 @@ SET(WebCore_IDL_FILES html/canvas/Int16Array.idl html/canvas/Int32Array.idl html/canvas/Int8Array.idl + html/canvas/OESStandardDerivatives.idl html/canvas/OESTextureFloat.idl html/canvas/Uint16Array.idl html/canvas/Uint32Array.idl @@ -637,6 +639,7 @@ SET(WebCore_SOURCES bindings/js/JSDeviceOrientationEventCustom.cpp bindings/js/JSDocumentCustom.cpp bindings/js/JSElementCustom.cpp + bindings/js/JSErrorHandler.cpp bindings/js/JSEventCustom.cpp bindings/js/JSEventListener.cpp bindings/js/JSEventSourceCustom.cpp @@ -705,7 +708,6 @@ SET(WebCore_SOURCES bindings/js/JSWebSocketCustom.cpp bindings/js/JSWorkerContextBase.cpp bindings/js/JSWorkerContextCustom.cpp - bindings/js/JSWorkerContextErrorHandler.cpp bindings/js/JSWorkerCustom.cpp bindings/js/JSXMLHttpRequestCustom.cpp bindings/js/JSXMLHttpRequestUploadCustom.cpp @@ -1169,6 +1171,7 @@ SET(WebCore_SOURCES inspector/InspectorInstrumentation.cpp inspector/InspectorProfilerAgent.cpp inspector/InspectorResourceAgent.cpp + inspector/InspectorRuntimeAgent.cpp inspector/InspectorSettings.cpp inspector/InspectorState.cpp inspector/InspectorStyleSheet.cpp @@ -1308,8 +1311,8 @@ SET(WebCore_SOURCES platform/Logging.cpp platform/MIMETypeRegistry.cpp platform/ScrollAnimator.cpp + platform/ScrollableArea.cpp platform/Scrollbar.cpp - platform/ScrollbarClient.cpp platform/ScrollbarThemeComposite.cpp platform/ScrollView.cpp platform/SharedBuffer.cpp @@ -1350,6 +1353,7 @@ SET(WebCore_SOURCES platform/graphics/Path.cpp platform/graphics/PathTraversalState.cpp platform/graphics/Pattern.cpp + platform/graphics/RoundedIntRect.cpp platform/graphics/SegmentedFontData.cpp platform/graphics/SimpleFontData.cpp platform/graphics/StringTruncator.cpp diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog index e8fe2cd..d523cdb 100644 --- a/Source/WebCore/ChangeLog +++ b/Source/WebCore/ChangeLog @@ -1,3 +1,5053 @@ +2011-01-21 Charlie Reis <creis@chromium.org> + + Reviewed by Darin Fisher. + + Crash in WebCore::HistoryController::itemsAreClones + https://bugs.webkit.org/show_bug.cgi?id=52819 + + Adds sanity checks to help diagnose the crash. + + * loader/HistoryController.cpp: + +2011-01-21 Andreas Kling <kling@webkit.org> + + Reviewed by Ariya Hidayat. + + [Qt] Let QPainter decide whether a composition mode is supported or not + + Lacking Porter-Duff support in the paint engine shouldn't exclude the + Source and Source-Over modes (and has nothing to do with the blend + and raster-op modes.) + + Delegate this decision to QPainter instead (this will cause warnings + if an unsupported mode is used, but that's a good thing.) + + * platform/graphics/qt/GraphicsContextQt.cpp: + (WebCore::GraphicsContext::clearRect): + (WebCore::GraphicsContext::setPlatformCompositeOperation): + * platform/graphics/qt/TransparencyLayer.h: + (WebCore::TransparencyLayer::TransparencyLayer): + +2011-01-21 Chris Rogers <crogers@google.com> + + Reviewed by Kenneth Russell. + + fix audio build: header file should be "Noncopyable.h" and not "NonCopyable.h" + https://bugs.webkit.org/show_bug.cgi?id=52933 + + No new tests since this just fixes the build + + * webaudio/RealtimeAnalyser.h: + +2011-01-21 Chris Rogers <crogers@google.com> + + Reviewed by Kenneth Russell. + + Fix audio build: change ChromiumBridge to PlatformBridge + https://bugs.webkit.org/show_bug.cgi?id=52928 + + No new tests since audio API is not yet implemented. + + * platform/audio/chromium/AudioBusChromium.cpp: + (WebCore::AudioBus::loadPlatformResource): + +2011-01-21 Chris Rogers <crogers@google.com> + + Reviewed by Kenneth Russell. + + Add FFTFrameStub to avoid link errors during bringup on platforms without an FFT implementation + https://bugs.webkit.org/show_bug.cgi?id=52922 + + No new tests since audio API is not yet implemented. + + * WebCore.gypi: + * platform/audio/FFTFrameStub.cpp: Added. + (WebCore::FFTFrame::FFTFrame): + (WebCore::FFTFrame::~FFTFrame): + (WebCore::FFTFrame::multiply): + (WebCore::FFTFrame::doFFT): + (WebCore::FFTFrame::doInverseFFT): + (WebCore::FFTFrame::cleanup): + (WebCore::FFTFrame::realData): + (WebCore::FFTFrame::imagData): + +2011-01-21 Tony Chang <tony@chromium.org> + + Reviewed by Sam Weinig. + + reduce number of FrameLoaderClient::didChangeScrollOffset calls + https://bugs.webkit.org/show_bug.cgi?id=52915 + + Only notify of changes in scroll offset when there actually is a change. + This regressed in r76291. + + Covered by Chromium browser_tests. + + * platform/ScrollAnimator.cpp: + (WebCore::ScrollAnimator::scrollToOffsetWithoutAnimation): + +2011-01-21 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Yury Semikhatsky. + + Web Inspector: ~InspectorResourceAgent crashes on closing inspected page. + https://bugs.webkit.org/show_bug.cgi?id=52900 + + * inspector/InspectorController.cpp: + (WebCore::InspectorController::~InspectorController): + (WebCore::InspectorController::inspectedPageDestroyed): + +2011-01-21 Chris Rogers <crogers@google.com> + + Reviewed by Darin Fisher. + + Add run-time enable support for the web audio API + https://bugs.webkit.org/show_bug.cgi?id=52741 + + No new tests since audio API is not yet implemented. + + * WebCore.exp.in: + * bindings/generic/RuntimeEnabledFeatures.cpp: + * bindings/generic/RuntimeEnabledFeatures.h: + (WebCore::RuntimeEnabledFeatures::setWebkitAudioContextEnabled): + (WebCore::RuntimeEnabledFeatures::webkitAudioContextEnabled): + * page/DOMWindow.idl: + * page/Settings.cpp: + (WebCore::Settings::Settings): + (WebCore::Settings::setWebAudioEnabled): + * page/Settings.h: + (WebCore::Settings::webAudioEnabled): + +2011-01-21 Martin Robinson <mrobinson@igalia.com> + + Reviewed by Xan Lopez. + + [GTK] Menulist text often collides with separator + https://bugs.webkit.org/show_bug.cgi?id=51155 + + Move menulist rendering to RenderThemeGtk and correct padding code + for separators in menulists. + + * platform/gtk/RenderThemeGtk.cpp: + (WebCore::RenderThemeGtk::RenderThemeGtk): Initialize new widget members. + (WebCore::RenderThemeGtk::getComboBoxSeparatorWidth): Added. + (WebCore::RenderThemeGtk::comboBoxArrowSize): Added. + (WebCore::getButtonInnerBorder): Added. + (WebCore::RenderThemeGtk::getComboBoxPadding): Do this manually instead of using + Mozilla code. + (WebCore::RenderThemeGtk::paintMenuList): Ditto. + (WebCore::setupWidget): Abstracted this part of the setupWidgetAndAddToContainer + out to handle child widgets of comboboxes. + (WebCore::RenderThemeGtk::setupWidgetAndAddToContainer): Abstracted out setupWidget. + (WebCore::RenderThemeGtk::gtkContainer): Added. + (WebCore::getGtkComboBoxButton): Added. + (WebCore::getGtkComboBoxPieces): Added. + (WebCore::RenderThemeGtk::gtkComboBox): Call setupWidget here. + (WebCore::RenderThemeGtk::refreshComboBoxChildren): Added. + (WebCore::RenderThemeGtk::gtkComboBoxButton): Added. + (WebCore::RenderThemeGtk::gtkComboBoxArrow): Added. + (WebCore::RenderThemeGtk::gtkComboBoxSeparator): Added. + * platform/gtk/RenderThemeGtk.h: Added new members and methods. + * platform/gtk/WidgetRenderingContext.h: Added new members and methods. + * platform/gtk/WidgetRenderingContextGtk2.cpp: + (WebCore::WidgetRenderingContext::gtkPaintArrow): + (WebCore::WidgetRenderingContext::gtkPaintVLine): + * platform/gtk/WidgetRenderingContextGtk3.cpp: + (WebCore::WidgetRenderingContext::gtkPaintArrow): + (WebCore::WidgetRenderingContext::gtkPaintVLine): + * platform/gtk/gtk2drawing.c: Removed code for drawing menulists and buttons. + (moz_gtk_init): + (moz_gtk_get_widget_border): + (moz_gtk_widget_paint): + * platform/gtk/gtk3drawing.c: + (moz_gtk_init): + (moz_gtk_get_widget_border): + (moz_gtk_widget_paint): + * platform/gtk/gtkdrawing.h: + +2011-01-21 Sam Weinig <sam@webkit.org> + + Fix chromium mac build. + + * platform/chromium/ScrollbarThemeChromiumMac.mm: + (WebCore::scrollbarStateToThemeState): + (WebCore::ScrollbarThemeChromiumMac::paint): + +2011-01-21 Sam Weinig <sam@webkit.org> + + Fix the windows build. + + * platform/ScrollbarThemeComposite.cpp: + (WebCore::ScrollbarThemeComposite::paint): + +2011-01-21 Chris Rogers <crogers@google.com> + + Reviewed by Kenneth Russell. + + Add chromium bundled audio spatialization resources to WebAudio.grd + https://bugs.webkit.org/show_bug.cgi?id=52651 + + No new tests since audio API is not yet implemented. + + * WebCore.gyp/WebCore.gyp: + * platform/audio/chromium/AudioBusChromium.cpp: + (WebCore::AudioBus::loadPlatformResource): + +2011-01-21 Xiyuan Xia <xiyuan@chromium.org> + + Reviewed by Tony Chang. + + Use WebThemeEngine for relevant RenderTheme parts for chromium/linux. + https://bugs.webkit.org/show_bug.cgi?id=52826 + + * platform/chromium/ChromiumBridge.h: + * rendering/RenderThemeChromiumLinux.cpp: + (WebCore::getWebThemeState): + (WebCore::RenderThemeChromiumLinux::adjustSliderThumbSize): + (WebCore::RenderThemeChromiumLinux::paintCheckbox): + (WebCore::RenderThemeChromiumLinux::setCheckboxSize): + (WebCore::RenderThemeChromiumLinux::paintRadio): + (WebCore::RenderThemeChromiumLinux::setRadioSize): + (WebCore::RenderThemeChromiumLinux::paintButton): + (WebCore::RenderThemeChromiumLinux::paintTextField): + (WebCore::RenderThemeChromiumLinux::paintMenuList): + (WebCore::RenderThemeChromiumLinux::paintSliderTrack): + (WebCore::RenderThemeChromiumLinux::paintSliderThumb): + (WebCore::RenderThemeChromiumLinux::adjustInnerSpinButtonStyle): + (WebCore::RenderThemeChromiumLinux::paintInnerSpinButton): + (WebCore::RenderThemeChromiumLinux::paintProgressBar): + * rendering/RenderThemeChromiumLinux.h: + * rendering/RenderThemeChromiumSkia.cpp: + (WebCore::RenderThemeChromiumSkia::setCheckboxSize): + (WebCore::RenderThemeChromiumSkia::setSizeIfAuto): + (WebCore::RenderThemeChromiumSkia::indeterminateProgressValueRectFor): + * rendering/RenderThemeChromiumSkia.h: + +2011-01-21 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Part 2 of "Cleanup Scrollbar/ScrollbarClient relationship" + https://bugs.webkit.org/show_bug.cgi?id=52779 + + Rename ScrollbarClient -> ScrollableArea. + + - Also replaces Scrollbar::setClient with Scrollbar::disconnectFromScrollableArea + since that was its only use case. + + * CMakeLists.txt: + * GNUmakefile.am: + * WebCore.gypi: + * WebCore.pro: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * accessibility/AccessibilityScrollbar.cpp: + (WebCore::AccessibilityScrollbar::setValue): + * css/CSSStyleSelector.cpp: + (WebCore::CSSStyleSelector::SelectorChecker::checkScrollbarPseudoClass): + * page/FrameView.h: + * platform/PopupMenuClient.h: + * platform/ScrollAnimator.cpp: + (WebCore::ScrollAnimator::create): + (WebCore::ScrollAnimator::ScrollAnimator): + (WebCore::ScrollAnimator::scroll): + (WebCore::ScrollAnimator::notityPositionChanged): + * platform/ScrollAnimator.h: + * platform/ScrollAnimatorWin.cpp: + (WebCore::ScrollAnimator::create): + (WebCore::ScrollAnimatorWin::ScrollAnimatorWin): + (WebCore::ScrollAnimatorWin::scroll): + * platform/ScrollAnimatorWin.h: + * platform/ScrollView.cpp: + (WebCore::ScrollView::scroll): + (WebCore::ScrollView::updateScrollbars): + (WebCore::ScrollView::wheelEvent): + * platform/ScrollView.h: + * platform/ScrollableArea.cpp: Copied from WebCore/platform/ScrollbarClient.cpp. + (WebCore::ScrollableArea::ScrollableArea): + (WebCore::ScrollableArea::~ScrollableArea): + (WebCore::ScrollableArea::scroll): + (WebCore::ScrollableArea::scrollToOffsetWithoutAnimation): + (WebCore::ScrollableArea::scrollToXOffsetWithoutAnimation): + (WebCore::ScrollableArea::scrollToYOffsetWithoutAnimation): + (WebCore::ScrollableArea::setScrollOffsetFromAnimation): + * platform/ScrollableArea.h: Copied from WebCore/platform/ScrollbarClient.h. + * platform/Scrollbar.cpp: + (WebCore::Scrollbar::createNativeScrollbar): + (WebCore::Scrollbar::Scrollbar): + (WebCore::Scrollbar::offsetDidChange): + (WebCore::Scrollbar::autoscrollPressedPart): + (WebCore::Scrollbar::moveThumb): + (WebCore::Scrollbar::mouseMoved): + (WebCore::Scrollbar::isWindowActive): + (WebCore::Scrollbar::invalidateRect): + (WebCore::Scrollbar::convertToContainingView): + (WebCore::Scrollbar::convertFromContainingView): + * platform/Scrollbar.h: + (WebCore::Scrollbar::disconnectFromScrollableArea): + (WebCore::Scrollbar::scrollableArea): + * platform/ScrollbarClient.cpp: Removed. + * platform/ScrollbarClient.h: Removed. + * platform/ScrollbarThemeComposite.cpp: + * platform/chromium/FramelessScrollView.h: + * platform/chromium/ScrollbarThemeChromium.cpp: + (WebCore::ScrollbarThemeChromium::paintTickmarks): + * platform/efl/ScrollbarEfl.cpp: + (Scrollbar::createNativeScrollbar): + (ScrollbarEfl::ScrollbarEfl): + (scrollbarEflEdjeMessage): + * platform/efl/ScrollbarEfl.h: + * platform/gtk/MainFrameScrollbarGtk.cpp: + (MainFrameScrollbarGtk::create): + (MainFrameScrollbarGtk::MainFrameScrollbarGtk): + (MainFrameScrollbarGtk::gtkValueChanged): + * platform/gtk/MainFrameScrollbarGtk.h: + * platform/mac/ScrollAnimatorMac.h: + * platform/mac/ScrollAnimatorMac.mm: + (WebCore::ScrollAnimator::create): + (WebCore::ScrollAnimatorMac::ScrollAnimatorMac): + (WebCore::ScrollAnimatorMac::scroll): + * platform/mac/ScrollbarThemeMac.mm: + (WebCore::ScrollbarThemeMac::paint): + * platform/qt/ScrollbarQt.cpp: + (WebCore::Scrollbar::contextMenu): + * platform/win/PopupMenuWin.cpp: + (WebCore::PopupMenuWin::scrollToRevealSelection): + (WebCore::PopupMenuWin::wndProc): + * platform/win/PopupMenuWin.h: + * platform/win/ScrollbarThemeSafari.cpp: + (WebCore::ScrollbarThemeSafari::paintTrackBackground): + (WebCore::ScrollbarThemeSafari::paintButton): + (WebCore::ScrollbarThemeSafari::paintThumb): + * platform/wx/ScrollbarThemeWx.cpp: + (WebCore::ScrollbarThemeWx::paint): + * rendering/RenderDataGrid.h: + * rendering/RenderLayer.cpp: + (WebCore::RenderLayer::scrollToOffset): + (WebCore::RenderLayer::destroyScrollbar): + (WebCore::RenderLayer::scroll): + * rendering/RenderLayer.h: + * rendering/RenderListBox.cpp: + (WebCore::RenderListBox::scrollToRevealElementAtListIndex): + (WebCore::RenderListBox::scroll): + (WebCore::RenderListBox::logicalScroll): + (WebCore::RenderListBox::setScrollTop): + (WebCore::RenderListBox::destroyScrollbar): + * rendering/RenderListBox.h: + * rendering/RenderMenuList.cpp: + (WebCore::RenderMenuList::createScrollbar): + * rendering/RenderMenuList.h: + * rendering/RenderScrollbar.cpp: + (WebCore::RenderScrollbar::createCustomScrollbar): + (WebCore::RenderScrollbar::RenderScrollbar): + * rendering/RenderScrollbar.h: + * rendering/RenderTextControlSingleLine.cpp: + (WebCore::RenderTextControlSingleLine::createScrollbar): + * rendering/RenderTextControlSingleLine.h: + +2011-01-21 Darin Adler <darin@apple.com> + + Fix Leopard build. + + * rendering/mathml/RenderMathMLFraction.cpp: + (WebCore::RenderMathMLFraction::layout): Use ceilf instead of ceil. + +2011-01-21 Anton Muhin <antonm@chromium.org> + + Reviewed by Nate Chapin. + + [v8] Properly deal with the case when conversion to string throws an exception for HTMLCollection accessors + https://bugs.webkit.org/show_bug.cgi?id=52901 + + Test: fast/dom/htmlcollection-conversion-throws-exception.html + + * bindings/v8/custom/V8HTMLCollectionCustom.cpp: + (WebCore::getItem): + +2011-01-21 Adam Roben <aroben@apple.com> + + Separate flushing layer changes from rendering in CACFLayerTreeHost + + Old model: + 1) A change is made to a GraphicsLayer. + 2) CACFLayerTreeHost::flushPendingGraphicsLayerChangesSoon is called, which schedules the + render timer. + 3) The timer fires, which calls through to CACFLayerTreeHost::render, which performs the + flush and then renders. + + New model: + 1) A change is made to a GraphicsLayer. + 2) CACFLayerTreeHost::flushPendingGraphicsLayerChangesSoon is called, which tells the new + LayerChangesFlusher singleton that this host has changes that need to be flushed. + 3) LayerChangesFlusher sets up a Windows hook that will get called on the next iteration + of the message loop. + 4) LayerChangesFlusher's hook is called, which calls through to + CACFLayerTreeHost::flushPendingLayerChangesNow. + 5) CACFLayerTreeHost::flushPendingLayerChangesNow schedules the render timer so the changes + that were just flushed to the context will be rendered. + + When a change is made to a PlatformCALayer that doesn't have a corresponding GraphicsLayer + (e.g., for rendering <video>), CACFLayerTreeHost::layerTreeDidChange takes care of + scheduling the flush. + + This change has three advantages: + 1) Whenever we flush layer changes, we first update layout. This can cause the page to + leave compositing mode, which in turn can cause all references to the CACFLayerTreeHost + to be dropped. By separating flushing (and thus updating layout) from rendering, we no + longer have to worry about this happen during rendering. + 2) The new model is much more similar to how things work on the Mac, so will hopefully + reduce the number of platform-specific bugs. + 3) CACFLayerTreeHost::shouldRender, which was used to make sure we didn't render while a + layout was pending, is no longer needed. It actually hasn't been needed since at least + r75987, but removing it before now would have resulted in a crash whenever a page came + out of compositing mode due to (1). + + Fixes <http://webkit.org/b/52852> Flushing layer changes and rendering are intertwined in + CACFLayerTreeHost, but shouldn't be + + Reviewed by Simon Fraser. + + * WebCore.vcproj/WebCore.vcproj: Added LayerChangesFlusher. + + * platform/graphics/ca/win/CACFLayerTreeHost.cpp: Added new #include, sorted existing + #includes. + (WebCore::CACFLayerTreeHost::CACFLayerTreeHost): Initialize new member. + (WebCore::CACFLayerTreeHost::layerTreeDidChange): If we aren't already flushing changes, + schedule a flush. Removed the call to renderSoon(), which now happens when the flush is + finished. + (WebCore::CACFLayerTreeHost::destroyRenderer): Cancel any pending flush we had scheduled. Also + fixed a bug where we'd fail to clear the context's layer. + (WebCore::CACFLayerTreeHost::render): Removed code to ask the client if we should render, which + is no longer needed. Moved code to flush layer changes from here to + flushPendingLayerChangesNow, which is called via the above-described mechanism. + (WebCore::CACFLayerTreeHost::flushPendingGraphicsLayerChangesSoon): Schedule a flush. Removed + code to schedule a render, which now happens after we've flushed. + (WebCore::CACFLayerTreeHost::flushPendingLayerChangesNow): Added. Some of this code came from + render(). First we flush GraphicsLayer changes from GraphicsLayers to their underlying + PlatformCALayers, then we flush changes from PlatformCALayers to the context, then we + schedule a render so that the changes will be rendered to the screen. + + * platform/graphics/ca/win/CACFLayerTreeHost.h: Removed + CACFLayerTreeHostClient::shouldRender. Added flushPendingLayerChangesNow and + m_isFlushingLayerChanges. + + * platform/graphics/ca/win/LayerChangesFlusher.cpp: Added. + (WebCore::LayerChangesFlusher::shared): + (WebCore::LayerChangesFlusher::LayerChangesFlusher): + (WebCore::LayerChangesFlusher::flushPendingLayerChangesSoon): + (WebCore::LayerChangesFlusher::cancelPendingFlush): + (WebCore::LayerChangesFlusher::hookCallback): + (WebCore::LayerChangesFlusher::hookFired): + (WebCore::LayerChangesFlusher::setHook): + (WebCore::LayerChangesFlusher::removeHook): + + * platform/graphics/ca/win/LayerChangesFlusher.cpp: Added. + (WebCore::LayerChangesFlusher::shared): Returns the singleton. + (WebCore::LayerChangesFlusher::LayerChangesFlusher): Initialize our members. + (WebCore::LayerChangesFlusher::flushPendingLayerChangesSoon): Add the host to the set of + hosts with changes that need to be flushed, and set up our hook if we haven't already. + (WebCore::LayerChangesFlusher::cancelPendingFlush): Remove the host from the set of hosts + with changes that need to be flushed. If we have no more such hosts, remove our hook, unless + we're currently in the process of calling out to our hosts, in which case we'll take care of + the hook once we're done calling out. + (WebCore::LayerChangesFlusher::hookCallback): This is the function that Windows calls when + our hook fires. Just calls through to hookFired on the singleton. + (WebCore::LayerChangesFlusher::hookFired): Tell all the hosts with changes that needed to be + flushed that it's time to flush. If no hosts re-added themselves to our set during this + process, remove our hook. + (WebCore::LayerChangesFlusher::setHook): Calls through to ::SetWindowsHookExW. + (WebCore::LayerChangesFlusher::removeHook): Calls through to ::UnhookWindowsHookEx. + + * platform/graphics/ca/win/LayerChangesFlusher.h: Added. + +2011-01-21 Simon Fraser <simon.fraser@apple.com> + + Reviewed by Sam Weinig. + + GraphicsLayer should be non-copyable + https://bugs.webkit.org/show_bug.cgi?id=52909 + + Use WTF_MAKE_NONCOPYABLE on GraphicsLayer, and WTF_MAKE_FAST_ALLOCATED + on that and KeyframeValueList. + + * platform/graphics/GraphicsLayer.h: + +2011-01-21 Simon Fraser <simon.fraser@apple.com> + + Reviewed by Sam Weinig. + + Report the sized used by canvases and types arrays + https://bugs.webkit.org/show_bug.cgi?id=52856 + + Report the memory cost associated with canvas elements, + and typed arrays to JavaScript as extraCost, so that it + can figure this into its GC behavior. + + * bindings/js/JSArrayBufferViewHelper.h: + (WebCore::toJSArrayBufferView): New templatized function, similar + to getDOMObjectWrapper() but calls reportExtraMemoryCost() with + the byteLength of the array. + + * bindings/js/JSFloat32ArrayCustom.cpp: + (WebCore::toJS): Use toJSArrayBufferView. + * bindings/js/JSInt16ArrayCustom.cpp: + (WebCore::toJS): Use toJSArrayBufferView. + * bindings/js/JSInt32ArrayCustom.cpp: + (WebCore::toJS): Use toJSArrayBufferView. + * bindings/js/JSInt8ArrayCustom.cpp: + (WebCore::toJS): Use toJSArrayBufferView. + * bindings/js/JSUint16ArrayCustom.cpp: + (WebCore::toJS): Use toJSArrayBufferView. + * bindings/js/JSUint32ArrayCustom.cpp: + (WebCore::toJS): Use toJSArrayBufferView. + * bindings/js/JSUint8ArrayCustom.cpp: + (WebCore::toJS): Use toJSArrayBufferView. + + * html/HTMLCanvasElement.cpp: + (WebCore::HTMLCanvasElement::createImageBuffer): Call heap.reportExtraMemoryCost() + with the size of the canvas backing store. + + * html/canvas/TypedArrayBase.h: + (WebCore::TypedArrayBase::byteLength): byteLength needs to + be public. + + * platform/graphics/ImageBuffer.h: Add dataSize() method. + + * platform/graphics/cairo/ImageBufferCairo.cpp: + (WebCore::ImageBuffer::dataSize): Implement dataSize(). + * platform/graphics/cg/ImageBufferCG.cpp: + (WebCore::ImageBuffer::dataSize): Implement dataSize(). + * platform/graphics/haiku/ImageBufferHaiku.cpp: + (WebCore::ImageBuffer::dataSize): Implement dataSize(). + * platform/graphics/qt/ImageBufferQt.cpp: + (WebCore::ImageBuffer::dataSize): Implement dataSize(). + * platform/graphics/skia/ImageBufferSkia.cpp: + (WebCore::ImageBuffer::dataSize): Implement dataSize(). + * platform/graphics/wince/ImageBufferWinCE.cpp: + (WebCore::ImageBuffer::dataSize): Implement dataSize(). + * platform/graphics/wx/ImageBufferWx.cpp: + (WebCore::ImageBuffer::dataSize): Implement dataSize(). + +2011-01-21 Adam Roben <aroben@apple.com> + + Rename WKCACFLayerRenderer[Client] to CACFLayerTreeHost[Client] + + Also renamed a few functions and data members to match. + + Fixes <http://webkit.org/b/52898> WKCACFLayerRenderer sounds like a render object, but isn't + + Reviewed by Simon Fraser. + + * WebCore.vcproj/WebCore.vcproj: Updated files' names and paths. + + * WebCore.vcproj/WebCoreQuartzCore.vsprops: Added platform/graphics/ca/win to the include + path. + + * WebCore.vcproj/copyForwardingHeaders.cmd: Copy headers from platform/graphics/ca/win, too. + + * platform/graphics/ca/win/CACFLayerTreeHost.cpp: Renamed from Source/WebCore/platform/graphics/win/WKCACFLayerRenderer.cpp. + * platform/graphics/ca/win/CACFLayerTreeHost.h: Renamed from Source/WebCore/platform/graphics/win/WKCACFLayerRenderer.h. + + * platform/graphics/ca/win/PlatformCALayerWin.cpp: + * platform/graphics/win/MediaPlayerPrivateFullscreenWindow.cpp: + * platform/graphics/win/MediaPlayerPrivateFullscreenWindow.h: + Updated for renames. + +2011-01-21 Patrick Gansterer <paroga@paroga.com> + + Original patch from François Sausset <sausset@gmail.com> + + Reviewed by Darin Adler. + + Code cleaning in rendering/mathml/RenderMathMLFraction.cpp + https://bugs.webkit.org/show_bug.cgi?id=52201 + + Replace unneeded doubles by floats and remove unneeded casts. + + * rendering/mathml/RenderMathMLFraction.cpp: + (WebCore::RenderMathMLFraction::paint): + * rendering/mathml/RenderMathMLFraction.h: + +2011-01-21 Dimitri Glazkov <dglazkov@chromium.org> + + Reviewed by Darin Adler. + + REGRESSION(r73618): Clicking on a search input causes a crash. + https://bugs.webkit.org/show_bug.cgi?id=52905 + + The problem is caused by TextControlInnerElement being used both as + shadow root and an element in a shadow subtree. The code assumed it is + only used as a shadow root. + + Since this code is all just workaround for in-progress conversion to + new shadow DOM, I am just adding a check. This code will disappear + completely once bug 52788 is fixed. + + Test: fast/dom/search-shadow-host-crash.html + + * dom/Node.cpp: + (WebCore::Node::setShadowHost): Added an ASSERT for early detection + of attempting to stomp on the parentNode. + * rendering/TextControlInnerElements.cpp: + (WebCore::TextControlInnerElement::detach): Added a check to only + clear shadow host if we have one. + +2011-01-21 Adam Roben <aroben@apple.com> + + Replace some "sync compositing state" terminology with "flush pending GraphicsLayer changes" + + This seems to be the direction in which our code is moving. I chose "GraphicsLayer" as + opposed to just "layer" because there are cases where we flush changes to CACFLayers that + don't have a corresponding GraphicsLayer. + + Fixes <http://webkit.org/b/52894> "Sync compositing state" terminology in + WKCACFLayerRenderer and friends is confusing + + Reviewed by Simon Fraser. + + * platform/graphics/win/WKCACFLayerRenderer.cpp: + (WebCore::WKCACFLayerRenderer::WKCACFLayerRenderer): + (WebCore::WKCACFLayerRenderer::render): + Updated for renames. + + (WebCore::WKCACFLayerRenderer::flushPendingGraphicsLayerChangesSoon): Renamed from + syncCompositingStateSoon, and updated for other renames. + + * platform/graphics/win/WKCACFLayerRenderer.h: Renamed m_syncLayerChanges to + * m_shouldFlushPendingGraphicsLayerChanges. + (WebCore::WKCACFLayerRendererClient::flushPendingGraphicsLayerChanges): Renamed from + syncCompositingState. + +2011-01-21 Adam Roben <aroben@apple.com> + + Clean up PlatformCAAnimationWin + + Fixes <http://webkit.org/b/52904> PlatformCAAnimationWin is leaky and inefficient + + Reviewed by Simon Fraser. + + * platform/graphics/ca/win/PlatformCAAnimationWin.cpp: + (toCACFFillModeType): + (fromCACFFillModeType): + (toCACFValueFunctionType): + (fromCACFValueFunctionType): + Changed to take and return CFStringRefs. There's no need to convert to WebCore::String just + so we can later convert back to CFStringRef. + + (toCACFTimingFunction): Fixed leaks by changing this to return a RetainPtr and adopting the + results of CACFTimingFunctionCreate. + (PlatformCAAnimation::PlatformCAAnimation): Changed not to needlessly roundtrip through + WebCore::String. Also changed an ASSERT(0) to ASSERT_NOT_REACHED(). + + (PlatformCAAnimation::setFillMode): + (PlatformCAAnimation::setTimingFunction): + (PlatformCAAnimation::setValueFunction): + (PlatformCAAnimation::setTimingFunctions): + Updated for changes to the above conversion functions. + +2011-01-21 Charlie Reis <creis@chromium.org> + + Reviewed by Darin Fisher. + + FrameLoader::checkLoadCompleteForThisFrame uses wrong history item + https://bugs.webkit.org/show_bug.cgi?id=48812 + + Most calls to stopAllLoaders now clear the history's provisional item(s). + We can now avoid resetting the back/forward state if a new navigation + is in progress. + + Test: http/tests/navigation/back-twice-without-commit.html + Test: http/tests/navigation/forward-and-cancel.html + + * loader/FrameLoader.cpp: + * loader/FrameLoader.h: + * loader/FrameLoaderTypes.h: + * WebCore.exp.in: Update stopAllLoaders signature. + +2011-01-21 Carlos Garcia Campos <cgarcia@igalia.com> + + Reviewed by Martin Robinson. + + [GTK] Show caps lock indicator in password fields + https://bugs.webkit.org/show_bug.cgi?id=52878 + + Test: manual-tests/password-caps-lock.html + + * platform/gtk/KeyEventGtk.cpp: + (WebCore::PlatformKeyboardEvent::currentCapsLockState): Implement + currentCapsLockState() using GDK API. + * platform/gtk/RenderThemeGtk.cpp: + (WebCore::RenderThemeGtk::paintCapsLockIndicator): Paint an icon + in the password field when the caps lock modifier is locked. + * platform/gtk/RenderThemeGtk.h: + +2011-01-21 Pavel Podivilov <podivilov@chromium.org> + + Reviewed by Pavel Feldman. + + Web Inspector: move sticky breakpoints management from InspectorController to InspectorBrowserDebuggerAgent. + https://bugs.webkit.org/show_bug.cgi?id=52874 + + This is the first step of debugger api refactoring (see bug 52879). + JavaScript breakpoints are still in the same list as native breakpoints and are restored by InspectorBrowserDebuggerAgent. + The second step will be to move sticky JavaScript breakpoints to InspectorDebuggerAgent. + + * inspector/Inspector.idl: + * inspector/InspectorBrowserDebuggerAgent.cpp: + (WebCore::InspectorBrowserDebuggerAgent::setAllBrowserBreakpoints): + (WebCore::InspectorBrowserDebuggerAgent::inspectedURLChanged): + (WebCore::InspectorBrowserDebuggerAgent::restoreStickyBreakpoint): + (WebCore::InspectorBrowserDebuggerAgent::discardBindings): + (WebCore::InspectorBrowserDebuggerAgent::didInsertDOMNode): + (WebCore::InspectorBrowserDebuggerAgent::didRemoveDOMNode): + (WebCore::InspectorBrowserDebuggerAgent::setDOMBreakpoint): + (WebCore::InspectorBrowserDebuggerAgent::removeDOMBreakpoint): + (WebCore::InspectorBrowserDebuggerAgent::descriptionForDOMEvent): + (WebCore::InspectorBrowserDebuggerAgent::hasBreakpoint): + (WebCore::InspectorBrowserDebuggerAgent::updateSubtreeBreakpoints): + * inspector/InspectorBrowserDebuggerAgent.h: + * inspector/InspectorController.cpp: + (WebCore::InspectorController::restoreInspectorStateFromCookie): + (WebCore::InspectorController::connectFrontend): + (WebCore::InspectorController::didCommitLoad): + (WebCore::InspectorController::enableDebugger): + (WebCore::InspectorController::resume): + (WebCore::InspectorController::inspectedURL): + * inspector/InspectorController.h: + * inspector/InspectorState.cpp: + (WebCore::InspectorState::InspectorState): + * inspector/InspectorState.h: + * inspector/front-end/BreakpointManager.js: + (WebInspector.BreakpointManager): + (WebInspector.BreakpointManager.prototype._saveBreakpoints): + +2011-01-21 John Knottenbelt <jknotten@chromium.org> + + Reviewed by Jeremy Orlow. + + Turn off uninitialized errors for ARM linux build. + https://bugs.webkit.org/show_bug.cgi?id=52893 + + Fix ARM compiler breakage. + + * WebCore.gyp/WebCore.gyp: + +2011-01-21 Mikhail Naganov <mnaganov@chromium.org> + + Reviewed by Yury Semikhatsky. + + Web Inspector: [Chromium] REGRESSION: Using the "Back" button + while profiling causes renderer crash. + + https://bugs.webkit.org/show_bug.cgi?id=52808 + + * inspector/InspectorProfilerAgent.cpp: + (WebCore::InspectorProfilerAgent::addProfileFinishedMessageToConsole): + (WebCore::InspectorProfilerAgent::addStartProfilingMessageToConsole): + +2011-01-20 Ilya Tikhonovsky <loislo@chromium.org> + + Reviewed by Pavel Feldman. + + Web Inspector: switch page/Console implementation from InspectorController to InspectorInstrumentation. + + There are some places in WebCore where we still using direct InspectorController calls. + The idea is to pass all the Inspector related calls via InspectorInstrumentaion which is the + Inspector facade for WebCore. + + https://bugs.webkit.org/show_bug.cgi?id=52869 + + * inspector/InspectorController.cpp: + * inspector/InspectorController.h: + * inspector/InspectorInstrumentation.cpp: + (WebCore::InspectorInstrumentation::addProfileImpl): + (WebCore::InspectorInstrumentation::profilerEnabledImpl): + (WebCore::InspectorInstrumentation::getCurrentUserInitiatedProfileNameImpl): + * inspector/InspectorInstrumentation.h: + (WebCore::InspectorInstrumentation::addProfile): + (WebCore::InspectorInstrumentation::profilerEnabled): + (WebCore::InspectorInstrumentation::getCurrentUserInitiatedProfileName): + * page/Console.cpp: + (WebCore::Console::profile): + (WebCore::Console::profileEnd): + +2011-01-12 Pavel Podivilov <podivilov@chromium.org> + + Reviewed by Pavel Feldman. + + Web Inspector: breakpoints are restored incorrectly when reverting live edit. + https://bugs.webkit.org/show_bug.cgi?id=52300 + + Fix breakpoints restoring when reverting to old revision by using text diff. + Move live edit logic from ScriptsPanel to DebuggerModel. + Eliminate unnecessary editLine delegate in TextViewer. + + * inspector/front-end/DebuggerModel.js: + (WebInspector.DebuggerModel): + (WebInspector.DebuggerModel.prototype.reset): + (WebInspector.DebuggerModel.prototype.editScriptSource): + (WebInspector.DebuggerModel.prototype._updateScriptSource): + (WebInspector.DebuggerModel.prototype.get callFrames): + (WebInspector.DebuggerModel.prototype.pausedScript): + (WebInspector.DebuggerModel.prototype.resumedScript): + * inspector/front-end/Script.js: + (WebInspector.Script.prototype.get source): + * inspector/front-end/ScriptView.js: + (WebInspector.ScriptView): + * inspector/front-end/ScriptsPanel.js: + (WebInspector.ScriptsPanel): + (WebInspector.ScriptsPanel.prototype._scriptSourceChanged): + * inspector/front-end/SourceFrame.js: + (WebInspector.SourceFrame): + (WebInspector.SourceFrame.prototype._createViewerIfNeeded): + (WebInspector.SourceFrame.prototype._doubleClick.didEditLine): + (WebInspector.SourceFrame.prototype._doubleClick): + * inspector/front-end/SourceView.js: + (WebInspector.SourceView): + * inspector/front-end/TextViewer.js: + (WebInspector.TextViewer): + (WebInspector.TextViewer.prototype._handleKeyDown): + (WebInspector.TextViewer.prototype.editLine.finishEditing): + (WebInspector.TextViewer.prototype.editLine): + (WebInspector.TextChunk.prototype._createRow): + +2011-01-21 Adam Klein <adamk@chromium.org> + + Reviewed by Eric Seidel. + + [chromium] Rename ChromiumBridge to PlatformBridge + https://bugs.webkit.org/show_bug.cgi?id=52471 + + No tests added as this is a rename; no change in behavior. + + * WebCore.gypi: + * bindings/v8/V8DOMWindowShell.cpp: + (WebCore::reportFatalErrorInV8): + * page/PageGroup.cpp: + (WebCore::PageGroup::isLinkVisited): + * platform/android/PlatformBridge.h: + * platform/audio/chromium/AudioBusChromium.cpp: + (WebCore::createBusFromInMemoryAudioFile): + * platform/chromium/ChromiumBridge.h: Removed. + * platform/chromium/ChromiumDataObjectLegacy.cpp: + (WebCore::ChromiumDataObjectLegacy::getData): + * platform/chromium/DragDataChromium.cpp: + (WebCore::DragData::asURL): + * platform/chromium/FileSystemChromium.cpp: + (WebCore::deleteFile): + (WebCore::deleteEmptyDirectory): + (WebCore::getFileSize): + (WebCore::getFileModificationTime): + (WebCore::revealFolderInOS): + (WebCore::directoryName): + (WebCore::pathByAppendingComponent): + (WebCore::makeAllDirectories): + (WebCore::fileExists): + (WebCore::openFile): + (WebCore::closeFile): + (WebCore::seekFile): + (WebCore::truncateFile): + (WebCore::readFromFile): + (WebCore::writeToFile): + * platform/chromium/LanguageChromium.cpp: + (WebCore::platformDefaultLanguage): + * platform/chromium/LinkHashChromium.cpp: + (WebCore::visitedLinkHash): + * platform/chromium/MIMETypeRegistryChromium.cpp: + (WebCore::MIMETypeRegistry::getMIMETypeForExtension): + (WebCore::MIMETypeRegistry::getPreferredExtensionForMIMEType): + (WebCore::MIMETypeRegistry::isSupportedImageMIMEType): + (WebCore::MIMETypeRegistry::isSupportedJavaScriptMIMEType): + (WebCore::MIMETypeRegistry::isSupportedNonImageMIMEType): + * platform/chromium/PasteboardChromium.cpp: + (WebCore::Pasteboard::writeSelection): + (WebCore::Pasteboard::writePlainText): + (WebCore::Pasteboard::writeURL): + (WebCore::Pasteboard::writeImage): + (WebCore::Pasteboard::canSmartReplace): + (WebCore::Pasteboard::plainText): + (WebCore::Pasteboard::documentFragment): + * platform/chromium/PlatformBridge.h: + * platform/chromium/PlatformScreenChromium.cpp: + (WebCore::screenDepth): + (WebCore::screenDepthPerComponent): + (WebCore::screenIsMonochrome): + (WebCore::screenRect): + (WebCore::screenAvailableRect): + * platform/chromium/ReadableDataObject.cpp: + (WebCore::ReadableDataObject::getData): + (WebCore::ReadableDataObject::urlTitle): + (WebCore::ReadableDataObject::htmlBaseUrl): + (WebCore::ReadableDataObject::filenames): + (WebCore::ReadableDataObject::ensureTypeCacheInitialized): + * platform/chromium/SSLKeyGeneratorChromium.cpp: + (WebCore::signedPublicKeyAndChallengeString): + * platform/chromium/ScrollbarThemeChromium.cpp: + * platform/chromium/ScrollbarThemeChromiumLinux.cpp: + (WebCore::ScrollbarThemeChromiumLinux::scrollbarThickness): + (WebCore::ScrollbarThemeChromiumLinux::paintTrackPiece): + (WebCore::ScrollbarThemeChromiumLinux::paintButton): + (WebCore::ScrollbarThemeChromiumLinux::paintThumb): + (WebCore::ScrollbarThemeChromiumLinux::buttonSize): + (WebCore::ScrollbarThemeChromiumLinux::minimumThumbLength): + * platform/chromium/ScrollbarThemeChromiumMac.mm: + (WebCore::scrollbarStateToThemeState): + (WebCore::ScrollbarThemeChromiumMac::paint): + * platform/chromium/ScrollbarThemeChromiumWin.cpp: + (WebCore::ScrollbarThemeChromiumWin::scrollbarThickness): + (WebCore::ScrollbarThemeChromiumWin::paintTrackPiece): + (WebCore::ScrollbarThemeChromiumWin::paintButton): + (WebCore::ScrollbarThemeChromiumWin::paintThumb): + (WebCore::ScrollbarThemeChromiumWin::buttonSize): + * platform/chromium/SharedTimerChromium.cpp: + (WebCore::setSharedTimerFiredFunction): + (WebCore::setSharedTimerFireTime): + (WebCore::stopSharedTimer): + * platform/chromium/SuddenTerminationChromium.cpp: + (WebCore::disableSuddenTermination): + (WebCore::enableSuddenTermination): + * platform/chromium/SystemTimeChromium.cpp: + (WebCore::currentTime): + * platform/chromium/WritableDataObject.cpp: + (WebCore::WritableDataObject::setData): + * platform/graphics/chromium/CrossProcessFontLoading.mm: + * platform/graphics/chromium/FontCacheChromiumWin.cpp: + (WebCore::fontContainsCharacter): + (WebCore::FillLogFont): + * platform/graphics/chromium/FontCacheLinux.cpp: + (WebCore::FontCache::getFontDataForCharacters): + * platform/graphics/chromium/FontChromiumWin.cpp: + (WebCore::Font::drawGlyphs): + * platform/graphics/chromium/FontPlatformDataChromiumWin.cpp: + (WebCore::FontPlatformData::scriptFontProperties): + * platform/graphics/chromium/FontPlatformDataLinux.cpp: + (WebCore::FontPlatformData::querySystemForRenderStyle): + * platform/graphics/chromium/GlyphPageTreeNodeChromiumWin.cpp: + (WebCore::fillBMPGlyphs): + * platform/graphics/chromium/ImageChromium.cpp: + (WebCore::Image::loadPlatformResource): + * platform/graphics/chromium/ImageChromiumMac.mm: + (WebCore::Image::loadPlatformResource): + * platform/graphics/chromium/SimpleFontDataChromiumWin.cpp: + (WebCore::SimpleFontData::platformInit): + (WebCore::SimpleFontData::determinePitch): + (WebCore::SimpleFontData::platformWidthForGlyph): + * platform/graphics/chromium/UniscribeHelperTextRun.cpp: + (WebCore::UniscribeHelperTextRun::tryToPreloadFont): + * platform/graphics/skia/FontCustomPlatformData.cpp: + (WebCore::FontCustomPlatformData::fontPlatformData): + * platform/network/chromium/CookieJarChromium.cpp: + (WebCore::setCookies): + (WebCore::cookies): + (WebCore::cookieRequestHeaderFieldValue): + (WebCore::cookiesEnabled): + (WebCore::getRawCookies): + (WebCore::deleteCookie): + * platform/network/chromium/DNSChromium.cpp: + (WebCore::prefetchDNS): + * platform/qt/PlatformBridge.h: + * platform/sql/chromium/SQLiteFileSystemChromium.cpp: + (WebCore::SQLiteFileSystem::deleteDatabaseFile): + (WebCore::SQLiteFileSystem::getDatabaseFileSize): + * platform/sql/chromium/SQLiteFileSystemChromiumPosix.cpp: + (chromiumOpen): + (chromiumDelete): + (chromiumAccess): + * platform/sql/chromium/SQLiteFileSystemChromiumWin.cpp: + * plugins/chromium/PluginDataChromium.cpp: + (WebCore::PluginCache::plugins): + * rendering/RenderThemeChromiumMac.mm: + (WebCore::RenderThemeChromiumMac::usesTestModeFocusRingColor): + * rendering/RenderThemeChromiumSkia.cpp: + (WebCore::RenderThemeChromiumSkia::caretBlinkInterval): + * rendering/RenderThemeChromiumWin.cpp: + (WebCore::RenderThemeChromiumWin::platformActiveSelectionBackgroundColor): + (WebCore::RenderThemeChromiumWin::platformInactiveSelectionBackgroundColor): + (WebCore::RenderThemeChromiumWin::platformActiveSelectionForegroundColor): + (WebCore::RenderThemeChromiumWin::systemColor): + (WebCore::RenderThemeChromiumWin::paintButton): + (WebCore::RenderThemeChromiumWin::paintSliderTrack): + (WebCore::menuListButtonWidth): + (WebCore::RenderThemeChromiumWin::paintMenuList): + (WebCore::RenderThemeChromiumWin::paintTextFieldInternal): + (WebCore::RenderThemeChromiumWin::paintInnerSpinButton): + (WebCore::RenderThemeChromiumWin::paintProgressBar): + * storage/chromium/IDBFactoryBackendInterface.cpp: + (WebCore::IDBFactoryBackendInterface::create): + (WebCore::IDBFactoryBackendInterface::~IDBFactoryBackendInterface): + * storage/chromium/IDBKeyPathBackendImpl.cpp: + (WebCore::IDBKeyPathBackendImpl::createIDBKeysFromSerializedValuesAndKeyPath): + +2011-01-21 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r76335. + http://trac.webkit.org/changeset/76335 + https://bugs.webkit.org/show_bug.cgi?id=52875 + + profiler tests were broken (Requested by loislo on #webkit). + + * inspector/InspectorController.cpp: + (WebCore::InspectorController::addProfile): + (WebCore::InspectorController::getCurrentUserInitiatedProfileName): + * inspector/InspectorController.h: + * inspector/InspectorInstrumentation.cpp: + (WebCore::InspectorInstrumentation::addStartProfilingMessageToConsoleImpl): + * inspector/InspectorInstrumentation.h: + (WebCore::InspectorInstrumentation::addStartProfilingMessageToConsole): + (WebCore::InspectorInstrumentation::inspectorControllerWithFrontendForPage): + * page/Console.cpp: + (WebCore::Console::profile): + (WebCore::Console::profileEnd): + +2011-01-21 Ilya Tikhonovsky <loislo@chromium.org> + + Reviewed by Yury Semikhatsky. + + Web Inspector: switch page/Console implementation from InspectorController to InspectorInstrumentation. + + There are some places in WebCore where we still using direct InspectorController calls. + The idea is to pass all the Inspector related calls via InspectorInstrumentaion which is the + Inspector facade for WebCore. + + https://bugs.webkit.org/show_bug.cgi?id=52869 + + * inspector/InspectorController.cpp: + * inspector/InspectorController.h: + * inspector/InspectorInstrumentation.cpp: + (WebCore::InspectorInstrumentation::addProfileImpl): + (WebCore::InspectorInstrumentation::profilerEnabledImpl): + (WebCore::InspectorInstrumentation::getCurrentUserInitiatedProfileNameImpl): + * inspector/InspectorInstrumentation.h: + (WebCore::InspectorInstrumentation::addProfile): + (WebCore::InspectorInstrumentation::profilerEnabled): + (WebCore::InspectorInstrumentation::getCurrentUserInitiatedProfileName): + * page/Console.cpp: + (WebCore::Console::profile): + (WebCore::Console::profileEnd): + +2011-01-20 Sam Weinig <sam@webkit.org> + + Reviewed by Gavin Barraclough. + + Fix failing tests from r76291. + + * platform/ScrollView.cpp: + (WebCore::ScrollView::scrollPosition): + (WebCore::ScrollView::updateScrollbars): + Take the scroll origin into account in more places. + +2011-01-20 Kent Tamura <tkent@chromium.org> + + Unreviewed, sorting an Xcode project file. + + * WebCore.xcodeproj/project.pbxproj: + +2011-01-20 Ben Vanik <ben.vanik@gmail.com> + + Reviewed by Kenneth Russell. + + Implementation of the OES_standard_derivatives WebGL extension. + https://bugs.webkit.org/show_bug.cgi?id=51678 + + Changes are modeled off of the existing OESTextureFloat extension. New files, + extension retrieval, etc all match the existing code. + + Changed ANGLEWebKitBridge to allow for multiple sets of the ANGLE shader compiler + options. This supports the enabling of the standard derivatives flag when the + extension is enabled. Refactored the cleanup code to make the destruction of the + compilers (if they had been created) cleaner. + + Tested with the WebGL conformance test: + https://cvs.khronos.org/svn/repos/registry/trunk/public/webgl/sdk/tests/conformance/oes-standard-derivatives.html + Passes on WebKit/OSX, Chromium/OSX, and Chromium/Windows. + + * CMakeLists.txt: + * DerivedSources.make: + * GNUmakefile.am: + * WebCore.gypi: + * WebCore.pri: + * WebCore.pro: + * WebCore.xcodeproj/project.pbxproj: + * bindings/js/JSWebGLRenderingContextCustom.cpp: + (WebCore::toJS): + * bindings/v8/custom/V8WebGLRenderingContextCustom.cpp: + (WebCore::toV8Object): + * html/canvas/OESStandardDerivatives.cpp: Added. + (WebCore::OESStandardDerivatives::OESStandardDerivatives): + (WebCore::OESStandardDerivatives::~OESStandardDerivatives): + (WebCore::OESStandardDerivatives::getName): + (WebCore::OESStandardDerivatives::create): + * html/canvas/OESStandardDerivatives.h: Added. + * html/canvas/OESStandardDerivatives.idl: Added. + * html/canvas/WebGLExtension.h: + * html/canvas/WebGLRenderingContext.cpp: + (WebCore::WebGLRenderingContext::getExtension): Enable and return the new extension. + (WebCore::WebGLRenderingContext::getParameter): Support extension enum when enabled. + (WebCore::WebGLRenderingContext::getSupportedExtensions): + (WebCore::WebGLRenderingContext::hint): Validate extension enum when enabled. + (WebCore::WebGLRenderingContext::getNumberOfExtensions): + (WebCore::WebGLRenderingContext::getExtensionNumber): + * html/canvas/WebGLRenderingContext.h: + * platform/graphics/ANGLEWebKitBridge.cpp: + (WebCore::ANGLEWebKitBridge::~ANGLEWebKitBridge): Cleaned up compiler cleanup. + (WebCore::ANGLEWebKitBridge::cleanupCompilers): Destruct compilers. + (WebCore::ANGLEWebKitBridge::setResources): Cleanup existing compilers when changing + ANGLE settings. + (WebCore::ANGLEWebKitBridge::validateShaderSource): Cleaned up compiler cleanup on error. + * platform/graphics/ANGLEWebKitBridge.h: + (WebCore::ANGLEWebKitBridge::getResources): + * platform/graphics/Extensions3D.h: Added enumeration for the extension. + * platform/graphics/GraphicsContext3D.h: lumbing for GraphicsContext3D. + * platform/graphics/opengl/Extensions3DOpenGL.cpp: + (WebCore::Extensions3DOpenGL::Extensions3DOpenGL): Plumbed through a pointer to the + GraphicsContext3D to handle resetting the shader compilers. + (WebCore::Extensions3DOpenGL::supports): Desktop GL always supports this extension, + so always return true. + (WebCore::Extensions3DOpenGL::ensureEnabled): Reset shader compilers as required. + * platform/graphics/opengl/Extensions3DOpenGL.h: Plumbing for GraphicsContext3D. + * platform/graphics/opengl/GraphicsContext3DOpenGL.cpp: + (WebCore::GraphicsContext3D::getExtensions): Plumbing for GraphicsContext3D to + Extensions3DOpenGL. + +2011-01-20 Xiaomei Ji <xji@chromium.org> + + Reviewed by Dan Bernstein. + + Fix regression(r71566): PDF in RTL block might messes up text directionality. + https://bugs.webkit.org/show_bug.cgi?id=52776 + + Test: fast/dom/52776.html + + * platform/text/BidiResolver.h: + (WebCore::::checkDirectionInLowerRaiseEmbeddingLevel): + (WebCore::::lowerExplicitEmbeddingLevel): + (WebCore::::raiseExplicitEmbeddingLevel): + (WebCore::::createBidiRunsForLine): + +2011-01-20 Beth Dakin <bdakin@apple.com> + + Reviewed by Anders Carlsson. + + Follow-on for <rdar://problem/8890255> + + This fixes a painting error with ScrollbarPainter scrollers + and the new drawing area code path. + * platform/mac/ScrollbarThemeMac.mm: + (WebCore::updateArrowPlacement): + +2011-01-20 Levi Weintraub <leviw@chromium.org> + + Unreviewed. + + Fixing build breakage. + + * editing/SelectionController.cpp: + (WebCore::SelectionController::willBeModified): + +2011-01-20 Levi Weintraub <leviw@chromium.org> + + Reviewed by Ryosuke Niwa. + + RTL: Caret goes to the opposite direction when pressing an arrow key after selection is made + https://bugs.webkit.org/show_bug.cgi?id=49511 + + Test: editing/selection/rtl-move-selection-right-left.html + + * editing/SelectionController.cpp: + (WebCore::SelectionController::willBeModified): + Respecting the direction of the containing block when switching selection base and extent in + RTL content. + + (WebCore::SelectionController::modifyMovingRight): + (WebCore::SelectionController::modifyMovingLeft): + Using directionOfEnclosingBlock when deciding to use the selection start or end to do the + correct thing for RTL. + +2011-01-20 Nate Chapin <japhet@chromium.org> + + Reviewed by Adam Barth. + + Null-check m_frame in DOMWindow::setLocation(), since it's + possible to reach this point without it having been checked + already. + https://bugs.webkit.org/show_bug.cgi?id=52769 + + Test: fast/dom/Window/Location/set-location-after-close.html + + * page/DOMWindow.cpp: + (WebCore::DOMWindow::setLocation): + +2011-01-20 Chang Shu <chang.shu@nokia.com> + + Reviewed by Darin Adler. + + setContentEditable with invalid string should throw exception. + https://bugs.webkit.org/show_bug.cgi?id=52057 + + Implemented exception throwing for setContentEditable according to the following spec: + http://www.whatwg.org/specs/web-apps/current-work/multipage/editing.html#attr-contenteditable + Related quotas: "On setting, if the new value is an ASCII case-insensitive match for the + string 'inherit' then the content attribute must be removed, if the new value is an ASCII + case-insensitive match for the string 'true' then the content attribute must be set to the + string 'true', if the new value is an ASCII case-insensitive match for the string 'false' + then the content attribute must be set to the string 'false', and otherwise the attribute + setter must raise a SYNTAX_ERR exception." + + * html/HTMLElement.cpp: + (WebCore::HTMLElement::setContentEditable): Throw exception on invalid input strings; Make setting values case-insensitive and also convert them to lower cases according to the spec. + * html/HTMLElement.h: Add additional parameter ExceptionCode& for function setContentEditable. + * html/HTMLElement.idl: Add exception throwing support for contentEditable setter. + +2011-01-19 Adrienne Walker <enne@google.com> + + Reviewed by James Robinson. + + [chromium] Composited render surfaces should allow writes to alpha channel. + https://bugs.webkit.org/show_bug.cgi?id=52766 + + Test: LayoutTests/platform/chromium/compositing + + * platform/graphics/chromium/LayerRendererChromium.cpp: + (WebCore::LayerRendererChromium::drawLayers): + +2011-01-14 Jer Noble <jer.noble@apple.com> + + Reviewed by Eric Carlson. + + REGRESSION (r71842): Compass video is not playing in Safari welcome page + https://bugs.webkit.org/show_bug.cgi?id=52506 + + New test: LayoutTests/media/video-currentTime-delay.html + + Call invalidateCachedTime() every time one of the cached property dependencies changes, + i.e. m_paused and m_playbackRate. + + * html/HTMLMediaElement.cpp: + (WebCore::HTMLMediaElement::prepareForLoad): + (WebCore::HTMLMediaElement::setReadyState): + (WebCore::HTMLMediaElement::setPlaybackRate): + (WebCore::HTMLMediaElement::mediaPlayerRateChanged): + +2011-01-20 Beth Dakin <bdakin@apple.com> + + Reviewed by Geoffrey Garen. + + Fix for <rdar://problem/8890255> + + Allow WebKitSystemInterface to draw scrollbars + when appropriate. + * WebCore.exp.in: + * platform/mac/ScrollbarThemeMac.mm: + (WebCore::scrollbarMap): + (+[ScrollbarPrefsObserver appearancePrefsChanged:]): + (WebCore::ScrollbarThemeMac::registerScrollbar): + (WebCore::ScrollbarThemeMac::unregisterScrollbar): + (WebCore::ScrollbarThemeMac::paint): + * platform/mac/WebCoreSystemInterface.h: + * platform/mac/WebCoreSystemInterface.mm: + +2011-01-20 Sam Weinig <sam@webkit.org> + + Reviewed by Dave Hyatt. + + Cleanup Scrollbar/ScrollbarClient relationship + https://bugs.webkit.org/show_bug.cgi?id=52779 + + Pipe all scrolling through the ScrollbarClient/ScrollAnimator + rather than through the Scrollbar. The Scrollbar now is just + a "view" on the scroll position of the scrollable area it is + attached to. + + There are now two ways to scroll a scrollable area: + - ScrollbarClient::scroll() + - ScrollbarClient::scrollToOffsetWithoutAnimation() + + Both of these go through the ScrollAnimator (updating its state + or starting an animation). The ScrollAnimator, in turn, now calls + ScrollbarClient::setScrollOffsetFromAnimation, which tells the + Scrollbars to pull a new offset (via Scrollbar::offsetDidChange) + and tells the class that derives from ScrollbarClient to scroll + its contents (via ScrollbarClient::setScrollOffset). + + * WebCore.xcodeproj/project.pbxproj: + Move Scrollbar.cpp to the right place. + + * accessibility/AccessibilityScrollbar.cpp: + (WebCore::AccessibilityScrollbar::setValue): + Initiate the scroll through the scrollbar client, rather than the + scrollbar itself. + + * page/FrameView.cpp: + (WebCore::FrameView::scrollTo): + * page/FrameView.h: + Condense the two valueChanged overrides to a single override of the + scrollTo function. + + * platform/ScrollAnimator.cpp: + (WebCore::ScrollAnimator::scroll): + (WebCore::ScrollAnimator::scrollToOffsetWithoutAnimation): + (WebCore::ScrollAnimator::currentPosition): + (WebCore::ScrollAnimator::notityPositionChanged): + * platform/ScrollAnimator.h: + * platform/ScrollAnimatorWin.cpp: + (WebCore::ScrollAnimatorWin::scrollToOffsetWithoutAnimation): + (WebCore::ScrollAnimatorWin::animateScroll): + * platform/ScrollAnimatorWin.h: + * platform/mac/ScrollAnimatorMac.h: + * platform/mac/ScrollAnimatorMac.mm: + (WebCore::ScrollAnimatorMac::scrollToOffsetWithoutAnimation): + (WebCore::ScrollAnimatorMac::immediateScrollToPoint): + Change setScrollPositionAndStopAnimation to scrollToOffsetWithoutAnimation + and bottleneck all client notification of changed position through a new + notityPositionChanged() function. + + * platform/ScrollView.cpp: + (WebCore::ScrollView::setScrollOffset): + (WebCore::ScrollView::scrollTo): + (WebCore::ScrollView::scrollPosition): + (WebCore::ScrollView::scroll): + (WebCore::ScrollView::updateScrollbars): + (WebCore::ScrollView::wheelEvent): + * platform/ScrollView.h: + (WebCore::ScrollView::horizontalScrollbar): + (WebCore::ScrollView::verticalScrollbar): + Update to scroll via the ScrollbarClient rather than the Scrollbar. + + * platform/Scrollbar.cpp: + (WebCore::Scrollbar::offsetDidChange): + (WebCore::Scrollbar::autoscrollPressedPart): + (WebCore::Scrollbar::moveThumb): + (WebCore::Scrollbar::mouseMoved): + * platform/Scrollbar.h: + (WebCore::Scrollbar::setPressedPos): + Change the scrollbar to only updates its offset in response to + an offsetDidChange call. + + * platform/ScrollbarClient.cpp: + (WebCore::ScrollbarClient::scroll): + (WebCore::ScrollbarClient::scrollToOffsetWithoutAnimation): + (WebCore::ScrollbarClient::scrollToXOffsetWithoutAnimation): + (WebCore::ScrollbarClient::scrollToYOffsetWithoutAnimation): + (WebCore::ScrollbarClient::setScrollOffsetFromAnimation): + * platform/ScrollbarClient.h: + (WebCore::ScrollbarClient::horizontalScrollbar): + (WebCore::ScrollbarClient::verticalScrollbar): + Make the increasingly misnamed ScrollbarClient responsible for + scrolling. + + * platform/efl/ScrollbarEfl.cpp: + (scrollbarEflEdjeMessage): + * platform/gtk/MainFrameScrollbarGtk.cpp: + (MainFrameScrollbarGtk::gtkValueChanged): + * platform/qt/ScrollbarQt.cpp: + (WebCore::Scrollbar::contextMenu): + Update to move scrolling through the client. + + * platform/win/PopupMenuWin.cpp: + (WebCore::PopupMenuWin::scrollToRevealSelection): + (WebCore::PopupMenuWin::scrollPosition): + (WebCore::PopupMenuWin::setScrollOffset): + (WebCore::PopupMenuWin::scrollTo): + (WebCore::PopupMenuWin::wndProc): + * platform/win/PopupMenuWin.h: + (WebCore::PopupMenuWin::verticalScrollbar): + * rendering/RenderLayer.cpp: + (WebCore::RenderLayer::scrollToOffset): + (WebCore::RenderLayer::scrollTo): + (WebCore::RenderLayer::setScrollOffset): + (WebCore::RenderLayer::scrollPosition): + (WebCore::RenderLayer::updateScrollInfoAfterLayout): + (WebCore::RenderLayer::scroll): + * rendering/RenderLayer.h: + * rendering/RenderListBox.cpp: + (WebCore::RenderListBox::scrollToRevealElementAtListIndex): + (WebCore::RenderListBox::scroll): + (WebCore::RenderListBox::logicalScroll): + (WebCore::RenderListBox::scrollPosition): + (WebCore::RenderListBox::setScrollOffset): + (WebCore::RenderListBox::scrollTo): + (WebCore::RenderListBox::setScrollTop): + * rendering/RenderListBox.h: + (WebCore::RenderListBox::verticalScrollbar): + Update to scroll via the ScrollbarClient rather than the Scrollbar. + + * rendering/RenderMarquee.cpp: + (WebCore::RenderMarquee::start): + Simplify initial paint to just do an immediate scroll to the position. + +2011-01-20 Patrick Gansterer <paroga@webkit.org> + + Unreviewed WinCE build fix for r76170. + + * platform/graphics/wince/FontWinCE.cpp: Added a missing include. + * platform/graphics/wince/ImageBufferData.h: Added a missing include and fixed style. + +2011-01-20 James Robinson <jamesr@chromium.org> + + Reviewed by Darin Fisher. + + Implement mozilla's requestAnimationFrame API + https://bugs.webkit.org/show_bug.cgi?id=51218 + + This implements mozilla's proposed requestAnimationFrame API. The idea with this API is that + an author driving an animation from script could use window.requestAnimationFrame(callback) + instead of window.setTimeout(callback, 0) to schedule their update logic and let the browser + decide when to update the animations. This avoids doing unnecessary work when the page content + is offscreen or is being displayed at a different framerate than what the page author expects. + + Mozilla's proposal is here: https://developer.mozilla.org/en/DOM/window.mozRequestAnimationFrame + This implements window.mozRequestAnimationFrame as window.webkitRequestAnimationFrame with the + following changes: + *) Only the callback syntax is supported, there is no before paint event + *) webkitRequestAnimationFrame supports a second parameter Element to let the author indicate + what content they intend to animate. That way if the page is being displayed but the element + in question is offscreen, we can avoid invoking the callback. + *) No timestamp is provided to the caller and there is no window.animationStartTime property + (see https://bugs.webkit.org/show_bug.cgi?id=51952 for discussion of this property) + *) window.webkitRequestAnimationFrame returns a numerical id that can be used to cancel the callback + using window.cancelWebkitRequestAnimationFrame, to parallel window.setTimeout()/window.clearTime(). + + The implementation depends on the embedder scheduling the callbacks since the callback invocation + depends on the page's visibility and the embedder's paint scheduling, neither of which are exposed + to WebCore. The expectation for the embedder is that at some point Chrome::scheduleAnimation() is + called FrameView::serviceScriptedAnimations() should be called for the associated Page's main frame. + Ideally serviceScriptedAnimations() would be called prior to rendering - although in practice the + embedder has to rate limit callbacks and may not be able to tie the callback directly to the + rendering loop. + + Tests: fast/animation/request-animation-frame-cancel.html + fast/animation/request-animation-frame-cancel2.html + fast/animation/request-animation-frame-display.html + fast/animation/request-animation-frame-within-callback.html + fast/animation/request-animation-frame.html + + * WebCore.gypi: + * dom/Document.cpp: + (WebCore::Document::Document): + (WebCore::Document::webkitRequestAnimationFrame): + (WebCore::Document::webkitCancelRequestAnimationFrame): + (WebCore::Document::serviceScriptedAnimations): + * dom/Document.h: + * dom/RequestAnimationFrameCallback.h: Added. + (WebCore::RequestAnimationFrameCallback::~RequestAnimationFrameCallback): + * dom/RequestAnimationFrameCallback.idl: Added. + * loader/EmptyClients.h: + (WebCore::EmptyChromeClient::scheduleAnimation): + * page/Chrome.cpp: + (WebCore::Chrome::scheduleAnimation): + * page/Chrome.h: + * page/ChromeClient.h: + * page/DOMWindow.cpp: + (WebCore::DOMWindow::webkitRequestAnimationFrame): + (WebCore::DOMWindow::webkitCancelRequestAnimationFrame): + * page/DOMWindow.h: + * page/DOMWindow.idl: + * page/FrameView.cpp: + (WebCore::FrameView::scheduleAnimation): + (WebCore::FrameView::serviceScriptedAnimations): + * page/FrameView.h: + * platform/HostWindow.h: + +2011-01-20 James Robinson <jamesr@chromium.org> + + Reviewed by Nate Chapin. + + [v8] CodeGeneratorV8 generates incorrect code for callbacks with no parameters + https://bugs.webkit.org/show_bug.cgi?id=52837 + + When generating code to invoke a callback with no parameters CodeGeneratorV8.pm was generating the following: + v8::Handle<v8::Value> argv[] = {}; which does not compile in visual studio. Instead, if the argument count + is 0, we can just pass a NULL pointer for the argv parameter. + + Test added to bindings/scripts/test/TestCallback.idl and covered by run-bindings-tests. This + patch also includes some spurious changes to the bindings tests golden files (mostly GObject) + because the old golden files were out of date. + + * bindings/scripts/CodeGeneratorV8.pm: + * bindings/scripts/test/CPP/WebDOMTestCallback.cpp: + (WebDOMTestCallback::callbackWithNoParam): + * bindings/scripts/test/CPP/WebDOMTestCallback.h: + * bindings/scripts/test/GObject/WebKitDOMTestCallback.cpp: + (webkit_dom_test_callback_callback_with_no_param): + * bindings/scripts/test/GObject/WebKitDOMTestCallback.h: + * bindings/scripts/test/GObject/WebKitDOMTestInterface.cpp: + * bindings/scripts/test/GObject/WebKitDOMTestMediaQueryListListener.cpp: + * bindings/scripts/test/GObject/WebKitDOMTestObj.cpp: + * bindings/scripts/test/JS/JSTestCallback.cpp: + (WebCore::JSTestCallback::callbackWithNoParam): + * bindings/scripts/test/JS/JSTestCallback.h: + * bindings/scripts/test/JS/JSTestInterface.cpp: + * bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp: + * bindings/scripts/test/JS/JSTestObj.cpp: + * bindings/scripts/test/ObjC/DOMTestCallback.h: + * bindings/scripts/test/ObjC/DOMTestCallback.mm: + (-[DOMTestCallback callbackWithNoParam]): + * bindings/scripts/test/TestCallback.idl: + * bindings/scripts/test/V8/V8TestCallback.cpp: + (WebCore::V8TestCallback::callbackWithNoParam): + * bindings/scripts/test/V8/V8TestCallback.h: + * bindings/scripts/test/V8/V8TestObj.cpp: + (WebCore::TestObjInternal::reflectedUnsignedIntegralAttrAttrGetter): + +2011-01-20 James Robinson <jamesr@chromium.org> + + Reviewed by Eric "Baller" Seidel. + + RenderTableSection's setNeedsCellRecalc needs to null check table() + https://bugs.webkit.org/show_bug.cgi?id=52770 + + Null checks table() before deferencing it in RenderTableSection::setNeedsCellRecalc. + This can be null during detach(). Test constructed by Eric Seidel. + + Test: fast/css-generated-content/table-with-scrollbar-corner.html + + * rendering/RenderTableSection.cpp: + (WebCore::RenderTableSection::setNeedsCellRecalc): + * rendering/RenderTableSection.h: + +2011-01-20 Dirk Schulze <krit@webkit.org> + + Reviewed by Rob Buis. + + SVG Pattern doesn't take preserveAspectRatio of references Pattern + https://bugs.webkit.org/show_bug.cgi?id=52802 + + SVGPattern didn't take preserveAspectRatio of a referenced SVGPattern into account. Store preserveAspectRatio + in PatternAttributes as well, if the attribute was set on the referenced SVGPattern element. + + Test: svg/custom/pattern-referencing-preserve-aspect-ratio.svg + + * rendering/svg/RenderSVGResourcePattern.cpp: + (WebCore::RenderSVGResourcePattern::buildTileImageTransform): + * svg/PatternAttributes.h: + (WebCore::PatternAttributes::PatternAttributes): + (WebCore::PatternAttributes::preserveAspectRatio): + (WebCore::PatternAttributes::setPreserveAspectRatio): + (WebCore::PatternAttributes::hasPreserveAspectRatio): + * svg/SVGPatternElement.cpp: + (WebCore::SVGPatternElement::collectPatternAttributes): + +2011-01-20 Dan Bernstein <mitz@apple.com> + + Reviewed by Adele Peterson. + + <rdar://problem/8765498> REGRESSION (r72141): Cannot order prints with Aperture 3.1 + + <rdar://problem/8884648> REGRESSION (r72141): Safari hangs when visiting a page on www.bfmtv.com + https://bugs.webkit.org/show_bug.cgi?id=52765 + + <rdar://problem/8890909> REGRESSION (r72141): Very Slow Rendering With Certain Markup + https://bugs.webkit.org/show_bug.cgi?id=52265 + + Test: fast/block/line-layout/negative-max-height.html + + Integer overflow detection led to a block having a huge height. This manifested as broken layout + in the first bug and as extreme slowness in the latter bugs because of + https://bugs.webkit.org/show_bug.cgi?id=52832 + + * rendering/RootInlineBox.cpp: + (WebCore::RootInlineBox::alignBoxesInBlockDirection): Clamp maxHeight to 0 so the next line + cannot start above this line. The negative maxHeight also caused the integer overflow detection + logic to give the block a huge height. + +2011-01-20 Yi Shen <yi.4.shen@nokia.com> + + Reviewed by Eric Carlson. + + Clean up the Media Controls CSS for Qt + https://bugs.webkit.org/show_bug.cgi?id=52822 + + Split the audio::-webkit-media-xxx and video::-webkit-media-xxx rules + in mediaControlsQt.css, and remove the duplicate audio::-webkit-media-xxx + rules from mediaControlsQtFullscreen.css. + + * css/mediaControlsQt.css: + (audio::-webkit-media-controls-panel): + (video::-webkit-media-controls-panel): + (audio::-webkit-media-controls-mute-button): + (video::-webkit-media-controls-mute-button): + (audio::-webkit-media-controls-play-button): + (video::-webkit-media-controls-play-button): + (audio::-webkit-media-controls-timeline-container): + (video::-webkit-media-controls-timeline-container): + (audio::-webkit-media-controls-current-time-display): + (video::-webkit-media-controls-current-time-display): + (audio::-webkit-media-controls-time-remaining-display): + (video::-webkit-media-controls-time-remaining-display): + (audio::-webkit-media-controls-timeline): + (video::-webkit-media-controls-timeline): + (audio::-webkit-media-controls-volume-slider-container): + (video::-webkit-media-controls-volume-slider-container): + (audio::-webkit-media-controls-volume-slider): + (video::-webkit-media-controls-volume-slider): + (audio::-webkit-media-controls-seek-back-button): + (video::-webkit-media-controls-seek-back-button): + (audio::-webkit-media-controls-seek-forward-button): + (video::-webkit-media-controls-seek-forward-button): + (audio::-webkit-media-controls-fullscreen-button): + (video::-webkit-media-controls-fullscreen-button): + (audio::-webkit-media-controls-rewind-button): + (video::-webkit-media-controls-rewind-button): + (audio::-webkit-media-controls-return-to-realtime-button): + (video::-webkit-media-controls-return-to-realtime-button): + (audio::-webkit-media-controls-toggle-closed-captions-button): + (video::-webkit-media-controls-toggle-closed-captions-button): + * css/mediaControlsQtFullscreen.css: + (video::-webkit-media-controls-time-remaining-display): + (video::-webkit-media-controls-seek-back-button): + (video::-webkit-media-controls-seek-forward-button): + (video::-webkit-media-controls-rewind-button): + (video::-webkit-media-controls-return-to-realtime-button): + (video::-webkit-media-controls-toggle-closed-captions-button): + +2011-01-20 Alexander Pavlov <apavlov@chromium.org> + + Reviewed by Pavel Feldman. + + Web Inspector: [REGRESSION] Canceling of CSS numeric values increment/decrement is broken + https://bugs.webkit.org/show_bug.cgi?id=52816 + + * inspector/front-end/StylesSidebarPane.js: + (WebInspector.StylePropertyTreeElement.prototype): + +2011-01-20 Dawit Alemayehu <adawit@kde.org> + + Reviewed by Andreas Kling. + + [Qt] Fix Layering violation in MediaPlayerPrivateQt. + https://bugs.webkit.org/show_bug.cgi?id=52733 + + No new tests. no behavioral change. + + * platform/graphics/qt/MediaPlayerPrivateQt.cpp: + (WebCore::MediaPlayerPrivateQt::commitLoad): + +2011-01-20 Nate Chapin <japhet@chromium.org> + + Reviewed by Darin Fisher. + + [V8] Call malloc and memcpy directly instead of + of strdup in convertV8ObjectToNPVariant() when + converting strings. If there is a null character + in the string, our use of strdup causes us to allocate + too little memory, leading to out of bounds reads. + + https://bugs.webkit.org/show_bug.cgi?id=52631 + + * bindings/v8/V8NPUtils.cpp: + (WebCore::convertV8ObjectToNPVariant): + +2011-01-20 Andreas Kling <kling@webkit.org> + + Reviewed by Ariya Hidayat. + + [Qt] Fill shadow scratch buffer with proper transparent pixels + + QImage::fill() has no Qt::GlobalColor overload in Qt 4.7 (coming in 4.8) + so doing QImage::fill(Qt::transparent) will actually fill all pixels with + the RGBA value 0x00000013. + + * platform/graphics/qt/ContextShadowQt.cpp: + (WebCore::ShadowBuffer::scratchImage): + +2011-01-19 Adam Roben <aroben@apple.com> + + Remove WKCACFContextFlusher + + It wasn't doing anything. + + Fixes <http://webkit.org/b/52752> WKCACFContextFlusher is unused + + Reviewed by Simon Fraser. + + * WebCore.vcproj/WebCore.vcproj: Removed WKCACFContextFlusher. Also let VS have its way with + the file. + + * platform/graphics/win/WKCACFContextFlusher.cpp: Removed. + * platform/graphics/win/WKCACFContextFlusher.h: Removed. + + * platform/graphics/win/WKCACFLayerRenderer.cpp: + (WebCore::WKCACFLayerRenderer::~WKCACFLayerRenderer): + (WebCore::WKCACFLayerRenderer::layerTreeDidChange): + Stop telling WKCACFContextFlusher about our context, since it never did anything with it. + +2011-01-19 Adam Roben <aroben@apple.com> + + Only flush our own context when we get resized + + Fixes <http://webkit.org/b/52751> All WKCACFContexts with uncommitted + changes get flushed whenever any composited page is resized + + Reviewed by Simon Fraser. + + * platform/graphics/win/WKCACFLayerRenderer.cpp: + (WebCore::WKCACFLayerRenderer::resize): Just flush our own context, not all contexts + WKCACFContextFlusher knows about. After all, ours is the only one that just got resized! + +2011-01-19 Adam Roben <aroben@apple.com> + + Make WKCACFLayerRenderer ref-counted + + This will be needed to handle cases where the client might release its reference to us while + we're calling out to it. + + WKCACFLayerRenderer now has a setClient function, which is used rather than passing the + client to create(). This allows clients to null out the client pointer when they're done + with the renderer. + + Fixes <http://webkit.org/b/52749> WKCACFLayerRenderer should be + ref-counted + + Reviewed by Simon Fraser. + + * platform/graphics/win/MediaPlayerPrivateFullscreenWindow.cpp: + (WebCore::MediaPlayerPrivateFullscreenWindow::MediaPlayerPrivateFullscreenWindow): + * platform/graphics/win/MediaPlayerPrivateFullscreenWindow.h: + Updated for WKCACFLayerRenderer changes. + + * platform/graphics/win/WKCACFLayerRenderer.cpp: + (WebCore::WKCACFLayerRenderer::acceleratedCompositingAvailable): Updated for changes to + create(). + (WebCore::WKCACFLayerRenderer::create): No longer takes a WKCACFLayerRendererClient. Now + returns a PassOwnPtr. + (WebCore::WKCACFLayerRenderer::WKCACFLayerRenderer): No longer takes a + WKCACFLayerRendererClient. + + * platform/graphics/win/WKCACFLayerRenderer.h: Made WKCACFLayerRenderer inherit from + RefCounted. + (WebCore::WKCACFLayerRenderer::setClient): Added this simple setter. + +2011-01-20 Csaba Osztrogonác <ossy@webkit.org> + + [Qt][V8] Unreviewed buildfix after r76248. + + * bindings/v8/ScriptCachedFrameData.h: Add missing include. + +2011-01-20 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Yury Semikhatsky. + + Web Inspector: enable resource agent upon request. + https://bugs.webkit.org/show_bug.cgi?id=52815 + + We should not send network-related notifications unless front-end + is interested. + + * inspector/Inspector.idl: + * inspector/InspectorController.cpp: + (WebCore::InspectorController::restoreInspectorStateFromCookie): + (WebCore::InspectorController::connectFrontend): + (WebCore::InspectorController::resourceAgent): + * inspector/InspectorController.h: + (WebCore::InspectorController::consoleAgent): + (WebCore::InspectorController::cssAgent): + (WebCore::InspectorController::domAgent): + (WebCore::InspectorController::injectedScriptAgent): + (WebCore::InspectorController::runtimeAgent): + (WebCore::InspectorController::databaseAgent): + (WebCore::InspectorController::domStorageAgent): + (WebCore::InspectorController::fileSystemAgent): + * inspector/InspectorInstrumentation.cpp: + (WebCore::InspectorInstrumentation::retrieveResourceAgent): + * inspector/InspectorResourceAgent.cpp: + (WebCore::InspectorResourceAgent::restore): + (WebCore::InspectorResourceAgent::~InspectorResourceAgent): + (WebCore::InspectorResourceAgent::InspectorResourceAgent): + * inspector/InspectorResourceAgent.h: + (WebCore::InspectorResourceAgent::create): + * inspector/InspectorState.cpp: + (WebCore::InspectorState::InspectorState): + * inspector/InspectorState.h: + +2011-01-20 Zoltan Horvath <zoltan@webkit.org> + + Reviewed by Csaba Osztrogonác. + + Refactoring of the custom allocation framework + https://bugs.webkit.org/show_bug.cgi?id=49897 + + Inheriting from FastAllocBase can result in objects getting larger (bug #33896, #46589). + The modification replaces Noncopyable and FastAllocBase classes and these inherits with their + equivalent macro implementation at the necessary places. + +2011-01-20 Mikhail Naganov <mnaganov@chromium.org> + + Reviewed by Pavel Feldman. + + Web Inspector: [Chromium] CPU Profiles are cleared when navigating back and forth. + + Profiles are now not cleared unless renderer instance was changed. + + https://bugs.webkit.org/show_bug.cgi?id=52807 + + * inspector/InspectorController.cpp: + (WebCore::InspectorController::restoreProfiler): + * inspector/InspectorProfilerAgent.cpp: + (WebCore::InspectorProfilerAgent::resetState): + (WebCore::InspectorProfilerAgent::resetFrontendProfiles): + * inspector/InspectorProfilerAgent.h: + +2011-01-20 Alexander Pavlov <apavlov@chromium.org> + + Unreviewed, add new JS file refs missing from r76116. + + * WebCore.gypi: + * WebCore.vcproj/WebCore.vcproj: + * inspector/front-end/WebKit.qrc: + +2011-01-20 Alexander Pavlov <apavlov@chromium.org> + + Reviewed by Pavel Feldman. + + Web Inspector: Crash when adding a rule for an ImageDocument + https://bugs.webkit.org/show_bug.cgi?id=52811 + + * inspector/InspectorCSSAgent.cpp: + (WebCore::InspectorCSSAgent::addRule2): + (WebCore::InspectorCSSAgent::viaInspectorStyleSheet): + +2011-01-20 Ilya Tikhonovsky <loislo@chromium.org> + + Reviewed by Pavel Feldman. + + Web Inspector: cleanup InspectorController's friends list. + We have a plan to extract InspectorAgent from InspectorController. + InspectorAgent will be accessible only from InspectorController. + As result we can simply made some methods public and remove long + friends list. + + https://bugs.webkit.org/show_bug.cgi?id=52806 + + * inspector/InjectedScriptHost.cpp: + (WebCore::InjectedScriptHost::databaseForId): + (WebCore::InjectedScriptHost::selectDatabase): + (WebCore::InjectedScriptHost::selectDOMStorage): + (WebCore::InjectedScriptHost::inspectorDOMAgent): + (WebCore::InjectedScriptHost::frontend): + * inspector/InspectorBrowserDebuggerAgent.cpp: + (WebCore::InspectorBrowserDebuggerAgent::setDOMBreakpoint): + (WebCore::InspectorBrowserDebuggerAgent::removeDOMBreakpoint): + (WebCore::InspectorBrowserDebuggerAgent::willInsertDOMNode): + (WebCore::InspectorBrowserDebuggerAgent::willRemoveDOMNode): + (WebCore::InspectorBrowserDebuggerAgent::willModifyDOMAttr): + (WebCore::InspectorBrowserDebuggerAgent::descriptionForDOMEvent): + (WebCore::InspectorBrowserDebuggerAgent::pauseOnNativeEventIfNeeded): + (WebCore::InspectorBrowserDebuggerAgent::willSendXMLHttpRequest): + * inspector/InspectorController.h: + (WebCore::InspectorController::frontend): + * inspector/InspectorInstrumentation.cpp: + (WebCore::InspectorInstrumentation::willInsertDOMNodeImpl): + (WebCore::InspectorInstrumentation::didInsertDOMNodeImpl): + (WebCore::InspectorInstrumentation::willRemoveDOMNodeImpl): + (WebCore::InspectorInstrumentation::didRemoveDOMNodeImpl): + (WebCore::InspectorInstrumentation::willModifyDOMAttrImpl): + (WebCore::InspectorInstrumentation::didModifyDOMAttrImpl): + (WebCore::InspectorInstrumentation::characterDataModifiedImpl): + (WebCore::InspectorInstrumentation::willSendXMLHttpRequestImpl): + (WebCore::InspectorInstrumentation::didReceiveResourceResponseImpl): + (WebCore::InspectorInstrumentation::didFailLoadingImpl): + (WebCore::InspectorInstrumentation::resourceRetrievedByXMLHttpRequestImpl): + (WebCore::InspectorInstrumentation::addStartProfilingMessageToConsoleImpl): + (WebCore::InspectorInstrumentation::pauseOnNativeEventIfNeeded): + (WebCore::InspectorInstrumentation::cancelPauseOnNativeEvent): + (WebCore::InspectorInstrumentation::retrieveTimelineAgent): + (WebCore::InspectorInstrumentation::retrieveResourceAgent): + +2011-01-19 Pavel Podivilov <podivilov@chromium.org> + + Reviewed by Yury Semikhatsky. + + Web Inspector: implement JavaScriptBreakpointsSidebarPane based on events from debugger model. + https://bugs.webkit.org/show_bug.cgi?id=52723 + + Extract all breakpoints-related presentation code from debugger model to JavaScriptBreakpointSidebarPane. + + * inspector/front-end/Breakpoint.js: + (WebInspector.Breakpoint): + (WebInspector.Breakpoint.prototype.get data): + (WebInspector.Breakpoint.prototype.remove): + * inspector/front-end/BreakpointsSidebarPane.js: + (WebInspector.JavaScriptBreakpointsSidebarPane): + (WebInspector.JavaScriptBreakpointsSidebarPane.prototype._breakpointAdded): + (WebInspector.JavaScriptBreakpointsSidebarPane.prototype._breakpointRemoved): + (WebInspector.JavaScriptBreakpointsSidebarPane.prototype._breakpointEnableChanged): + (WebInspector.JavaScriptBreakpointsSidebarPane.prototype._breakpointItemCheckboxClicked): + (WebInspector.JavaScriptBreakpointsSidebarPane.prototype._contextMenuEventFired): + (WebInspector.JavaScriptBreakpointsSidebarPane.prototype._debuggerPaused): + (WebInspector.JavaScriptBreakpointsSidebarPane.prototype._debuggerResumed): + (WebInspector.JavaScriptBreakpointsSidebarPane.prototype._addListElement): + (WebInspector.JavaScriptBreakpointsSidebarPane.prototype._removeListElement): + (WebInspector.JavaScriptBreakpointsSidebarPane.prototype._projectChanged): + (WebInspector.JavaScriptBreakpointsSidebarPane.prototype._compare): + (WebInspector.JavaScriptBreakpointsSidebarPane.prototype._compareBreakpoints): + (WebInspector.JavaScriptBreakpointsSidebarPane.prototype._setupBreakpointElement.didGetSourceLine): + (WebInspector.JavaScriptBreakpointsSidebarPane.prototype._setupBreakpointElement): + (WebInspector.JavaScriptBreakpointsSidebarPane.prototype._breakpointIdForDebuggerPausedEvent): + (WebInspector.JavaScriptBreakpointsSidebarPane.prototype._setBreakpointEnabled): + (WebInspector.JavaScriptBreakpointsSidebarPane.prototype._removeBreakpoint): + (WebInspector.NativeBreakpointsSidebarPane): + (WebInspector.XHRBreakpointsSidebarPane.prototype.addBreakpointItem): + * inspector/front-end/DebuggerModel.js: + (WebInspector.DebuggerModel.prototype.removeBreakpoint): + (WebInspector.DebuggerModel.prototype.breakpointForId): + (WebInspector.DebuggerModel.prototype._pausedScript): + (WebInspector.DebuggerModel.prototype._resumedScript): + * inspector/front-end/ScriptsPanel.js: + (WebInspector.ScriptsPanel): + * inspector/front-end/inspector.js: + +2011-01-20 Dirk Schulze <krit@webkit.org> + + Reviewed by Andreas Kling. + + SVG Pattern doesn't take the viewBox of a referenced Pattern + https://bugs.webkit.org/show_bug.cgi?id=52804 + + SVGPattern element didn't use the viewBox of another SVGPattern element, referenced + by xlink:href. Modified PatternAttributes, to take the value of the viewBox of the + SVGPattern element as well, if the attribute was set. + This gets checked by a W3C SVG test case. + + Test: svg/W3C-SVG-1.1-SE/pservers-pattern-04-f.svg + + * rendering/svg/RenderSVGResourcePattern.cpp: + (WebCore::RenderSVGResourcePattern::buildTileImageTransform): + * svg/PatternAttributes.h: + (WebCore::PatternAttributes::PatternAttributes): + (WebCore::PatternAttributes::viewBox): + (WebCore::PatternAttributes::setViewBox): + (WebCore::PatternAttributes::hasViewBox): + * svg/SVGPatternElement.cpp: + (WebCore::SVGPatternElement::collectPatternAttributes): + +2011-01-19 Stephen White <senorblanco@chromium.org> + + [Re-land of r76159 with a compile fix for the Chromium linux shlib + build.] + + Reviewed by James Robinson. + + Implement accelerated path drawing and clipping for the Canvas2D GPU + path. + https://bugs.webkit.org/show_bug.cgi?id=52627 + + This is done with a simple curve interpolator and the GLU tesselator, + which is good enough for a 3-5X speedup on + http://ie.microsoft.com/testdrive/Performance/Galactic/Default.html. + + Covered by canvas/philip/2d.path.clip.basic.html, and many, many more. + All tests canvas/philip and fast/canvas paths pass with no + regressions, although two have minor pixel differences which require + rebaselining. + + * WebCore.gyp/WebCore.gyp: + Add internal_glu include path to chromium build. + * WebCore.gypi: + Add internal_glu files to chromium build. + * html/canvas/CanvasRenderingContext2D.cpp: + (WebCore::CanvasRenderingContext2D::reset): + (WebCore::CanvasRenderingContext2D::platformLayer): + Make CanvasRenderingContext2D more robust against failure to create + a DrawingBuffer. + * platform/graphics/chromium/DrawingBufferChromium.cpp: + (WebCore::DrawingBuffer::DrawingBuffer): + As in DrawingBufferMac.cpp, call reset() from the constructor. + Also initialize size to (-1, -1), so reset() doesn't early-out. + Add initializers for depthBuffer and stencilBuffer, and remove + multisampleDepthStencilBuffer. + * platform/graphics/chromium/GLES2Canvas.cpp: + Remove some unused #includes. + (WebCore::GLES2Canvas::State::State): + Add clipping state, and implement save/restore via the copy constructor. + (WebCore::operator*): + (WebCore::Quadratic::Quadratic): + (WebCore::Quadratic::fromBezier): + (WebCore::Quadratic::evaluate): + Quadratic Bezier curve class. + (WebCore::Cubic::Cubic): + (WebCore::Cubic::fromBezier): + (WebCore::Cubic::evaluate): + Cubic Bezier curve class. + (WebCore::GLES2Canvas::clearRect): + Add clipping support to clearRect(). + (WebCore::GLES2Canvas::fillPath): + Implement fillPath(). + (WebCore::GLES2Canvas::fillRect): + Add clipping support to fillRect(). + (WebCore::GLES2Canvas::clipPath): + Implement clipPath(). + (WebCore::GLES2Canvas::clipOut): + Stub out clipOut() (not called by Canvas 2D). + (WebCore::GLES2Canvas::restore): + When restoring, draw any remaining clipping paths to the stencil buffer. + (WebCore::GLES2Canvas::drawTexturedRect): + Add clipping support. + (WebCore::interpolateQuadratic): + (WebCore::interpolateCubic): + Simple curve interpolation, using the Cubic and Quadratic classes. + (WebCore::PolygonData::PolygonData): + A struct to hold the tesselation data for callbacks. + (WebCore::beginData): + (WebCore::edgeFlagData): + (WebCore::vertexData): + (WebCore::endData): + (WebCore::combineData): + internal_glu tesselation callbacks. + (WebCore::GLES2Canvas::createVertexBufferFromPath): + Build an interpolated, tesselated vertex buffer and element array buffer from a given path, suitable for filling. + (WebCore::GLES2Canvas::beginStencilDraw): + Enable stencilling, and disable draws to the color buffer. + (WebCore::GLES2Canvas::applyClipping): + If clipping is enabled, set the appropriate GL state. + * platform/graphics/chromium/GLES2Canvas.h: + Document the flavours of drawTexturedRect() a bit, so I don't get confused. + * platform/graphics/gpu/DrawingBuffer.cpp: + (WebCore::DrawingBuffer::clear): + (WebCore::DrawingBuffer::createSecondaryBuffers): + (WebCore::DrawingBuffer::resizeDepthStencil): + (WebCore::DrawingBuffer::reset): + * platform/graphics/gpu/DrawingBuffer.h: + Unify m_multisampleDepthStencilBuffer with m_depthStencilBuffer. + Implement separate depth and stencil buffers for when + OES_packed_depth_stencil is not available. Refactor creation of + multisampled and non-multisampled depth and stencil buffers into + resizeDepthStencil(). + * platform/graphics/gpu/SharedGraphicsContext3D.cpp: + (WebCore::SharedGraphicsContext3D::create): + Turn on stencil, turn off depth, turn off antialiasing (for now). + (WebCore::SharedGraphicsContext3D::enableStencil): + * platform/graphics/gpu/SharedGraphicsContext3D.h: + Implement stencil enable/disable. + * platform/graphics/gpu/mac/DrawingBufferMac.mm: + (WebCore::DrawingBuffer::DrawingBuffer): + Remove m_multisampleDepthStencilBuffer. Set the size to (-1, -1) + on creation, so reset() doesn't early-out. Initialize m_depthBuffer + and m_stencilBuffer. + * platform/graphics/skia/GraphicsContextSkia.cpp: + (WebCore::GraphicsContext::canvasClip): + (WebCore::GraphicsContext::clipOut): + (WebCore::GraphicsContext::clipPath): + (WebCore::GraphicsContext::fillPath): + Put in GPU hooks for path clipping, and path drawing. + * platform/graphics/skia/PlatformContextSkia.cpp: + (WebCore::PlatformContextSkia::canAccelerate): + Don't check for clipping paths in canAccelerate() (since we can + now accelerate them). + (WebCore::PlatformContextSkia::uploadSoftwareToHardware): + Don't do clipping when uploading software draws to hardware. + * thirdparty/glu/README.webkit: + * thirdparty/glu/gluos.h: + #undef MIN and MAX, to fix warnings-as-errors in Chrome/Mac build. + * thirdparty/glu/libtess/geom.c: + * thirdparty/glu/libtess/priorityq.c: + * thirdparty/glu/libtess/render.c: + Use do{}while(0) instead of if(1)else construct in macro. + * thirdparty/glu/libtess/sweep.c: + (IsWindingInside): + (DoneEdgeDict): + Fix some warnings treated as errors for the Linux Release build. + + +2011-01-20 Pavel Feldman <pfeldman@chromium.org> + + Web Inspector: move releaseObjectGroup to the new Runtime agent. + https://bugs.webkit.org/show_bug.cgi?id=52803 + (accedentally landed as r76231) + + * inspector/InspectorContorller.h: + * inspector/InspectorContorller.cpp: + * inspector/InspectorRuntimeAgent.h: + * inspector/InspectorRuntimeAgent.cpp: + +2011-01-20 Pavel Feldman <pfeldman@chromium.org> + + Not reviewed: build fix. + + * inspector/InspectorState.h: + (WebCore::InspectorState::setBoolean): + (WebCore::InspectorState::setString): + (WebCore::InspectorState::setLong): + +2011-01-20 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Yury Semikhatsky. + + Web Inspector: further simplify InspectorState. + https://bugs.webkit.org/show_bug.cgi?id=52731 + + This change moves XHR logging flag into console agent, + removes InspectorState pushing to the front-end. + + * inspector/Inspector.idl: + * inspector/InspectorConsoleAgent.cpp: + (WebCore::InspectorConsoleAgent::InspectorConsoleAgent): + (WebCore::InspectorConsoleAgent::resourceRetrievedByXMLHttpRequest): + (WebCore::InspectorConsoleAgent::setMonitoringXHREnabled): + (WebCore::InspectorConsoleAgent::setConsoleMessagesEnabled): + (WebCore::InspectorConsoleAgent::addConsoleMessage): + * inspector/InspectorConsoleAgent.h: + * inspector/InspectorController.cpp: + (WebCore::InspectorController::InspectorController): + * inspector/InspectorController.h: + (WebCore::InspectorController::state): + (WebCore::InspectorController::settings): + * inspector/InspectorState.cpp: + (WebCore::InspectorState::InspectorState): + (WebCore::InspectorState::registerBoolean): + (WebCore::InspectorState::registerString): + (WebCore::InspectorState::registerLong): + (WebCore::InspectorState::registerObject): + (WebCore::InspectorState::Property::create): + * inspector/InspectorState.h: + * inspector/front-end/ConsoleView.js: + (WebInspector.ConsoleView.prototype._registerConsoleDomainDispatcher.dispatcher.consoleMessagesCleared): + (WebInspector.ConsoleView.prototype._registerConsoleDomainDispatcher.dispatcher.monitoringXHRStateChanged): + (WebInspector.ConsoleView.prototype._registerConsoleDomainDispatcher): + (WebInspector.ConsoleView.prototype._handleContextMenuEvent): + * inspector/front-end/inspector.js: + +2011-01-20 Csaba Osztrogonác <ossy@webkit.org> + + Unreviewed buildfix. + + [Qt][V8] Remove unnecessary files after r76224. + + * WebCore.pro: + +2011-01-20 Ilya Tikhonovsky <loislo@chromium.org> + + Reviewed by Yury Semikhatsky. + + Web Inspector: prepare for extracting InspectorAgent from InspectorController. + https://bugs.webkit.org/show_bug.cgi?id=52797 + + * inspector/CodeGeneratorInspector.pm: + * inspector/InspectorController.h: + (WebCore::InspectorController::inspectorAgent): + (WebCore::InspectorController::cssAgent): + (WebCore::InspectorController::injectedScriptAgent): + (WebCore::InspectorController::resourceAgent): + (WebCore::InspectorController::runtimeAgent): + (WebCore::InspectorController::timelineAgent): + (WebCore::InspectorController::databaseAgent): + (WebCore::InspectorController::domStorageAgent): + (WebCore::InspectorController::fileSystemAgent): + (WebCore::InspectorController::browserDebuggerAgent): + (WebCore::InspectorController::debuggerAgent): + (WebCore::InspectorController::profilerAgent): + (WebCore::InspectorController::applicationCacheAgent): + +2011-01-20 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r76215. + http://trac.webkit.org/changeset/76215 + https://bugs.webkit.org/show_bug.cgi?id=52799 + + Caused regressions in Chromium; morrita is going to look at it + tomrorow (Requested by jorlow on #webkit). + + * dom/TextEvent.h: + * dom/TextEventInputType.h: + * editing/CompositeEditCommand.cpp: + (WebCore::CompositeEditCommand::rebalanceWhitespaceAt): + * editing/CompositeEditCommand.h: + * editing/Editor.cpp: + (WebCore::Editor::insertTextWithoutSendingTextEvent): + (WebCore::Editor::confirmComposition): + (WebCore::Editor::setComposition): + * editing/Editor.h: + * editing/InsertTextCommand.cpp: + (WebCore::InsertTextCommand::input): + * editing/InsertTextCommand.h: + * editing/TypingCommand.cpp: + (WebCore::TypingCommand::TypingCommand): + (WebCore::TypingCommand::insertText): + (WebCore::TypingCommand::insertTextRunWithoutNewlines): + * editing/TypingCommand.h: + (WebCore::TypingCommand::create): + +2010-12-14 Yury Semikhatsky <yurys@chromium.org> + + Reviewed by Adam Barth. + + [V8] Get rid of delayed exception reporting in V8ConsoleMessage.cpp + https://bugs.webkit.org/show_bug.cgi?id=51044 + + * WebCore.gypi: + * bindings/v8/V8ConsoleMessage.cpp: Removed. + * bindings/v8/V8ConsoleMessage.h: Removed. + * bindings/v8/V8DOMWindowShell.cpp: + (WebCore::v8UncaughtExceptionHandler): + (WebCore::reportUnsafeJavaScriptAccess): + (WebCore::V8DOMWindowShell::initContextIfNeeded): + * bindings/v8/V8Proxy.cpp: + (WebCore::addMessageToConsole): + (WebCore::logInfo): + (WebCore::V8Proxy::reportUnsafeAccessTo): + (WebCore::V8Proxy::runScript): + (WebCore::V8Proxy::callFunction): + (WebCore::V8Proxy::newInstance): + * bindings/v8/V8Proxy.h: + * bindings/v8/WorkerContextExecutionProxy.cpp: + * bindings/v8/specialization/V8BindingState.cpp: + (WebCore::::immediatelyReportUnsafeAccessTo): + +2011-01-19 MORITA Hajime <morrita@google.com> + + Reviewed by Eric Seidel. + + ShadowElement::m_shadowParent should be removed + https://bugs.webkit.org/show_bug.cgi?id=52558 + + No new tests. No behavioral change. + + * rendering/ShadowElement.h: + (WebCore::ShadowElement::ShadowElement): + +2011-01-20 Hans Wennborg <hans@chromium.org> + + Reviewed by Jeremy Orlow. + + IndexedDB: IDBObjectStore.get should fire onsuccess rather than onerror + https://bugs.webkit.org/show_bug.cgi?id=52725 + + Let IDBObjectStore.get() fire the onsuccess handler with the value + 'undefined' for when an object does not exist in the store. + + Update SerializedScriptValue to provide such an undefined value. + + * bindings/v8/SerializedScriptValue.cpp: + (WebCore::SerializedScriptValue::nullValue): + (WebCore::SerializedScriptValue::undefinedValue): + * bindings/v8/SerializedScriptValue.h: + * storage/IDBObjectStoreBackendImpl.cpp: + (WebCore::IDBObjectStoreBackendImpl::getInternal): + +2010-12-27 Yury Semikhatsky <yurys@chromium.org> + + Reviewed by Pavel Feldman. + + WebCore doesn't fire window.onerror event when uncaught JavaScript exceptions are thrown + https://bugs.webkit.org/show_bug.cgi?id=8519 + + Uncaught exceptions are propagated to window.onerror hander if one is present. + The handler is expected to be a function accepting three arguments: error message, + resource url and line number where the exception occured. + + It was decided to dispatch ErrorEvent to all listeners/handlers no matter if they + were created in the same isolated world where the exception occured or not. + + Tests: fast/events/window-onerror1.html + fast/events/window-onerror10.html + fast/events/window-onerror11.html + fast/events/window-onerror12.html + fast/events/window-onerror2.html + fast/events/window-onerror3.html + fast/events/window-onerror4.html + fast/events/window-onerror5.html + fast/events/window-onerror6.html + fast/events/window-onerror7.html + fast/events/window-onerror8.html + fast/events/window-onerror9.html + http/tests/security/window-onerror-exception-in-iframe.html + userscripts/window-onerror-for-isolated-world-1.html + userscripts/window-onerror-for-isolated-world-2.html + + * Android.jscbindings.mk: + * CMakeLists.txt: + * GNUmakefile.am: + * WebCore.gypi: + * WebCore.order: + * WebCore.pro: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * bindings/js/JSBindingsAllInOne.cpp: + * bindings/js/JSDOMBinding.cpp: + (WebCore::reportException): + * bindings/js/JSErrorHandler.cpp: Renamed from WebCore/bindings/js/JSWorkerContextErrorHandler.cpp. + (WebCore::JSErrorHandler::JSErrorHandler): + (WebCore::JSErrorHandler::~JSErrorHandler): + (WebCore::JSErrorHandler::handleEvent): + * bindings/js/JSErrorHandler.h: Copied from WebCore/bindings/js/JSWorkerContextErrorHandler.h. + (WebCore::JSErrorHandler::create): + (WebCore::createJSErrorHandler): + * bindings/js/JSEventListener.h: + * bindings/scripts/CodeGeneratorJS.pm: + * bindings/scripts/CodeGeneratorV8.pm: + * bindings/v8/V8ConsoleMessage.cpp: + (WebCore::V8ConsoleMessage::dispatchNow): + (WebCore::V8ConsoleMessage::handler): the method was changed to use generic WebCore exception + reporting mechanism which is also used by JSC bindings. + * bindings/v8/V8ConsoleMessage.h: + * bindings/v8/V8EventListener.h: + * bindings/v8/V8WindowErrorHandler.cpp: Renamed from WebCore/bindings/js/JSWorkerContextErrorHandler.h. + (WebCore::V8WindowErrorHandler::V8WindowErrorHandler): + (WebCore::V8WindowErrorHandler::callListenerFunction): + * bindings/v8/V8WindowErrorHandler.h: Copied from WebCore/dom/ErrorEvent.cpp. + (WebCore::V8WindowErrorHandler::create): + * bindings/v8/WorkerContextExecutionProxy.cpp: + (WebCore::v8MessageHandler): + * bindings/v8/WorkerScriptController.cpp: + (WebCore::WorkerScriptController::evaluate): + * dom/Document.cpp: + (WebCore::Document::errorEventTarget): + (WebCore::Document::logExceptionToConsole): + (WebCore::Document::addMessage): + * dom/Document.h: + * dom/ErrorEvent.cpp: + * dom/ErrorEvent.h: + * dom/Event.cpp: + (WebCore::Event::isErrorEvent): + * dom/Event.h: + * dom/ScriptExecutionContext.cpp: + (WebCore::ScriptExecutionContext::PendingException::PendingException): + (WebCore::ScriptExecutionContext::ScriptExecutionContext): + (WebCore::ScriptExecutionContext::reportException): this method is not virtual anymore to + ensure that error event dispatching algorithm is the same in WorkerContext and in Document. + (WebCore::ScriptExecutionContext::dispatchErrorEvent): + * dom/ScriptExecutionContext.h: + * websockets/WebSocket.cpp: + (WebCore::WebSocket::connect): + * websockets/WebSocketChannel.cpp: + (WebCore::WebSocketChannel::didOpen): + (WebCore::WebSocketChannel::didFail): + (WebCore::WebSocketChannel::appendToBuffer): + * websockets/WebSocketHandshake.cpp: + (WebCore::WebSocketHandshake::readServerHandshake): + (WebCore::WebSocketHandshake::readStatusLine): + (WebCore::WebSocketHandshake::readHTTPHeaders): + (WebCore::WebSocketHandshake::checkResponseHeaders): + * workers/DefaultSharedWorkerRepository.cpp: + (WebCore::postExceptionTask): + (WebCore::postConsoleMessageTask): + * workers/WorkerContext.cpp: + (WebCore::WorkerContext::WorkerContext): + (WebCore::WorkerContext::errorEventTarget): + (WebCore::WorkerContext::logExceptionToConsole): + (WebCore::WorkerContext::addMessage): + * workers/WorkerContext.h: + * workers/WorkerMessagingProxy.cpp: + (WebCore::WorkerExceptionTask::performTask): + (WebCore::postConsoleMessageTask): + * xml/XMLHttpRequest.cpp: + (WebCore::reportUnsafeUsage): + +2011-01-19 MORITA Hajime <morrita@google.com> + + Reviewed by Ryosuke Niwa. + + Space and tab characters "sent" by an input method give totally different results than typing them directly + https://bugs.webkit.org/show_bug.cgi?id=5241 + + * Introduced TextEvent::InputTypeComposition and TypingCommand::TextCompositionType to + distinguish text input which is originated by composition. + * Generalized rebalanceWhitespaceAt() to rebalanceWhitespaceOnTextSubstring() to rebalancing + range of string on text node, instead of surrounding part of that. + + Test: editing/inserting/insert-composition-whitespace.html + + * dom/TextEvent.h: + (WebCore::TextEvent::isComposition): + * dom/TextEventInputType.h: Added TextEventInputComposition as a member of TextEvent::InputType + * editing/CompositeEditCommand.cpp: + (WebCore::containsOnlyWhitespace): + (WebCore::CompositeEditCommand::shouldRebalanceLeadingWhitespaceFor): + (WebCore::CompositeEditCommand::canRebalance): + (WebCore::CompositeEditCommand::rebalanceWhitespaceAt): + (WebCore::CompositeEditCommand::rebalanceWhitespaceOnTextSubstring): Added: A generalized version of rebalanceWhitespaceAt(), which takes a range inside Text string. + * editing/CompositeEditCommand.h: + * editing/Editor.cpp: + (WebCore::Editor::insertTextForConfirmedComposition): Added. + (WebCore::Editor::insertTextWithoutSendingTextEvent): + (WebCore::Editor::confirmComposition): Now uses insertTextForConfirmedComposition(). + (WebCore::Editor::setComposition): + * editing/Editor.h: + * editing/InsertTextCommand.cpp: + (WebCore::InsertTextCommand::input): + * editing/InsertTextCommand.h: + * editing/TypingCommand.cpp: + (WebCore::TypingCommand::TypingCommand): + (WebCore::TypingCommand::insertText): + (WebCore::TypingCommand::insertTextRunWithoutNewlines): + * editing/TypingCommand.h: Added TypingCommand::m_compositionType and TypingCommand::TextCompositionType + (WebCore::TypingCommand::setCompositionType): Added. + (WebCore::TypingCommand::create): + +2011-01-19 Dominic Cooney <dominicc@google.com> + + Reviewed by Kent Tamura. + + Make <keygen> no longer appear to be a <select> element to script. + https://bugs.webkit.org/show_bug.cgi?id=52557 + + The intent is to put <keygen> options into shadow DOM. This change + takes the first step by hiding the <select> element from + JavaScript. + + Test: fast/dom/HTMLKeygenElement/keygen.html + + * CMakeLists.txt: Adds new IDL-derived wrapper. + * DerivedSources.cpp: + * DerivedSources.make: + * GNUmakefile.am: + * WebCore.gypi: + * WebCore.pri: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * bindings/gobject/GNUmakefile.am: + * bindings/gobject/WebKitHTMLElementWrapperFactory.cpp: + (WebKit::createKeygenWrapper): + (WebKit::createHTMLElementWrapper): + * bindings/objc/DOM.mm: + (WebCore::createElementClassMap): Keygen no longer DOMHTMLSelectElement + * html/HTMLKeygenElement.h: + (WebCore::HTMLKeygenElement::willValidate): Now public. + * html/HTMLKeygenElement.idl: Added. + * html/HTMLTagNames.in: Keygen's wrapper is HTMLKeygenElement. + * page/DOMWindow.idl: Add HTMLKeygenElement constructor. + +2011-01-19 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r76203. + http://trac.webkit.org/changeset/76203 + https://bugs.webkit.org/show_bug.cgi?id=52784 + + Broke Win compile on Chromium bots (Requested by dimich on + #webkit). + + * WebCore.gypi: + * bindings/v8/V8DOMWindowShell.cpp: + (WebCore::reportFatalErrorInV8): + * page/PageGroup.cpp: + (WebCore::PageGroup::isLinkVisited): + * platform/android/PlatformBridge.h: + * platform/audio/chromium/AudioBusChromium.cpp: + (WebCore::createBusFromInMemoryAudioFile): + * platform/chromium/ChromiumBridge.h: Added. + * platform/chromium/ChromiumDataObjectLegacy.cpp: + (WebCore::ChromiumDataObjectLegacy::getData): + * platform/chromium/DragDataChromium.cpp: + (WebCore::DragData::asURL): + * platform/chromium/FileSystemChromium.cpp: + (WebCore::deleteFile): + (WebCore::deleteEmptyDirectory): + (WebCore::getFileSize): + (WebCore::getFileModificationTime): + (WebCore::revealFolderInOS): + (WebCore::directoryName): + (WebCore::pathByAppendingComponent): + (WebCore::makeAllDirectories): + (WebCore::fileExists): + (WebCore::openFile): + (WebCore::closeFile): + (WebCore::seekFile): + (WebCore::truncateFile): + (WebCore::readFromFile): + (WebCore::writeToFile): + * platform/chromium/LanguageChromium.cpp: + (WebCore::platformDefaultLanguage): + * platform/chromium/LinkHashChromium.cpp: + (WebCore::visitedLinkHash): + * platform/chromium/MIMETypeRegistryChromium.cpp: + (WebCore::MIMETypeRegistry::getMIMETypeForExtension): + (WebCore::MIMETypeRegistry::getPreferredExtensionForMIMEType): + (WebCore::MIMETypeRegistry::isSupportedImageMIMEType): + (WebCore::MIMETypeRegistry::isSupportedJavaScriptMIMEType): + (WebCore::MIMETypeRegistry::isSupportedNonImageMIMEType): + * platform/chromium/PasteboardChromium.cpp: + (WebCore::Pasteboard::writeSelection): + (WebCore::Pasteboard::writePlainText): + (WebCore::Pasteboard::writeURL): + (WebCore::Pasteboard::writeImage): + (WebCore::Pasteboard::canSmartReplace): + (WebCore::Pasteboard::plainText): + (WebCore::Pasteboard::documentFragment): + * platform/chromium/PlatformBridge.h: + * platform/chromium/PlatformScreenChromium.cpp: + (WebCore::screenDepth): + (WebCore::screenDepthPerComponent): + (WebCore::screenIsMonochrome): + (WebCore::screenRect): + (WebCore::screenAvailableRect): + * platform/chromium/ReadableDataObject.cpp: + (WebCore::ReadableDataObject::getData): + (WebCore::ReadableDataObject::urlTitle): + (WebCore::ReadableDataObject::htmlBaseUrl): + (WebCore::ReadableDataObject::filenames): + (WebCore::ReadableDataObject::ensureTypeCacheInitialized): + * platform/chromium/SSLKeyGeneratorChromium.cpp: + (WebCore::signedPublicKeyAndChallengeString): + * platform/chromium/ScrollbarThemeChromium.cpp: + * platform/chromium/ScrollbarThemeChromiumLinux.cpp: + (WebCore::ScrollbarThemeChromiumLinux::scrollbarThickness): + (WebCore::ScrollbarThemeChromiumLinux::paintTrackPiece): + (WebCore::ScrollbarThemeChromiumLinux::paintButton): + (WebCore::ScrollbarThemeChromiumLinux::paintThumb): + (WebCore::ScrollbarThemeChromiumLinux::buttonSize): + (WebCore::ScrollbarThemeChromiumLinux::minimumThumbLength): + * platform/chromium/ScrollbarThemeChromiumMac.mm: + (WebCore::scrollbarStateToThemeState): + (WebCore::ScrollbarThemeChromiumMac::paint): + * platform/chromium/ScrollbarThemeChromiumWin.cpp: + (WebCore::ScrollbarThemeChromiumWin::scrollbarThickness): + (WebCore::ScrollbarThemeChromiumWin::paintTrackPiece): + (WebCore::ScrollbarThemeChromiumWin::paintButton): + (WebCore::ScrollbarThemeChromiumWin::paintThumb): + (WebCore::ScrollbarThemeChromiumWin::buttonSize): + * platform/chromium/SharedTimerChromium.cpp: + (WebCore::setSharedTimerFiredFunction): + (WebCore::setSharedTimerFireTime): + (WebCore::stopSharedTimer): + * platform/chromium/SuddenTerminationChromium.cpp: + (WebCore::disableSuddenTermination): + (WebCore::enableSuddenTermination): + * platform/chromium/SystemTimeChromium.cpp: + (WebCore::currentTime): + * platform/chromium/WritableDataObject.cpp: + (WebCore::WritableDataObject::setData): + * platform/graphics/chromium/CrossProcessFontLoading.mm: + * platform/graphics/chromium/FontCacheChromiumWin.cpp: + (WebCore::fontContainsCharacter): + (WebCore::FillLogFont): + * platform/graphics/chromium/FontCacheLinux.cpp: + (WebCore::FontCache::getFontDataForCharacters): + * platform/graphics/chromium/FontChromiumWin.cpp: + (WebCore::Font::drawGlyphs): + * platform/graphics/chromium/FontPlatformDataChromiumWin.cpp: + (WebCore::FontPlatformData::scriptFontProperties): + * platform/graphics/chromium/FontPlatformDataLinux.cpp: + (WebCore::FontPlatformData::querySystemForRenderStyle): + * platform/graphics/chromium/GlyphPageTreeNodeChromiumWin.cpp: + (WebCore::fillBMPGlyphs): + * platform/graphics/chromium/ImageChromium.cpp: + (WebCore::Image::loadPlatformResource): + * platform/graphics/chromium/ImageChromiumMac.mm: + (WebCore::Image::loadPlatformResource): + * platform/graphics/chromium/SimpleFontDataChromiumWin.cpp: + (WebCore::SimpleFontData::platformInit): + (WebCore::SimpleFontData::determinePitch): + (WebCore::SimpleFontData::platformWidthForGlyph): + * platform/graphics/chromium/UniscribeHelperTextRun.cpp: + (WebCore::UniscribeHelperTextRun::tryToPreloadFont): + * platform/graphics/skia/FontCustomPlatformData.cpp: + (WebCore::FontCustomPlatformData::fontPlatformData): + * platform/network/chromium/CookieJarChromium.cpp: + (WebCore::setCookies): + (WebCore::cookies): + (WebCore::cookieRequestHeaderFieldValue): + (WebCore::cookiesEnabled): + (WebCore::getRawCookies): + (WebCore::deleteCookie): + * platform/network/chromium/DNSChromium.cpp: + (WebCore::prefetchDNS): + * platform/qt/PlatformBridge.h: + * platform/sql/chromium/SQLiteFileSystemChromium.cpp: + (WebCore::SQLiteFileSystem::deleteDatabaseFile): + (WebCore::SQLiteFileSystem::getDatabaseFileSize): + * platform/sql/chromium/SQLiteFileSystemChromiumPosix.cpp: + (chromiumOpen): + (chromiumDelete): + (chromiumAccess): + * platform/sql/chromium/SQLiteFileSystemChromiumWin.cpp: + * plugins/chromium/PluginDataChromium.cpp: + (WebCore::PluginCache::plugins): + * rendering/RenderThemeChromiumMac.mm: + (WebCore::RenderThemeChromiumMac::usesTestModeFocusRingColor): + * rendering/RenderThemeChromiumSkia.cpp: + (WebCore::RenderThemeChromiumSkia::caretBlinkInterval): + * rendering/RenderThemeChromiumWin.cpp: + (WebCore::RenderThemeChromiumWin::platformActiveSelectionBackgroundColor): + (WebCore::RenderThemeChromiumWin::platformInactiveSelectionBackgroundColor): + (WebCore::RenderThemeChromiumWin::platformActiveSelectionForegroundColor): + (WebCore::RenderThemeChromiumWin::systemColor): + (WebCore::RenderThemeChromiumWin::paintButton): + (WebCore::RenderThemeChromiumWin::paintSliderTrack): + (WebCore::menuListButtonWidth): + (WebCore::RenderThemeChromiumWin::paintMenuList): + (WebCore::RenderThemeChromiumWin::paintTextFieldInternal): + (WebCore::RenderThemeChromiumWin::paintInnerSpinButton): + (WebCore::RenderThemeChromiumWin::paintProgressBar): + * storage/chromium/IDBFactoryBackendInterface.cpp: + (WebCore::IDBFactoryBackendInterface::create): + (WebCore::IDBFactoryBackendInterface::~IDBFactoryBackendInterface): + * storage/chromium/IDBKeyPathBackendImpl.cpp: + (WebCore::IDBKeyPathBackendImpl::createIDBKeysFromSerializedValuesAndKeyPath): + +2011-01-19 Helder Correia <helder@sencha.com> + + Reviewed by Andreas Kling. + + [Qt] GraphicsContext::strokePath() paints solid shadows with incorrect alpha + https://bugs.webkit.org/show_bug.cgi?id=52705 + + This is related to bug 52611. The shadow color alpha must be multiplied + by the context pen alpha. Fixing this results in correct behavior for + Canvas path stroke() and strokeRect() [which relies on stroke()]. + + Tests: fast/canvas/canvas-strokePath-alpha-shadow.html + fast/canvas/canvas-strokeRect-alpha-shadow.html + + * platform/graphics/qt/GraphicsContextQt.cpp: + (WebCore::GraphicsContext::strokePath): + +2011-01-19 Darin Fisher <darin@chromium.org> + + Reviewed by Mihai Parparita. + + Re-initialize the HistoryItem fully when navigating to a HistoryItem, + or replacing a HistoryItem, results in a different URL. + + https://bugs.webkit.org/show_bug.cgi?id=49654 + + This patch also forces all HistoryItems to record the post-redirect + URL. Previously, frames would remember the pre-redirect URL. This is + problematic since other members of the HistoryItem correspond to the + post-redirect URL. + + Tests: fast/history/history-replace-updates-current-item.html + http/tests/navigation/redirect-on-back-updates-history-item.html + http/tests/navigation/redirect-on-reload-updates-history-item.html + + * history/HistoryItem.cpp: + (WebCore::HistoryItem::HistoryItem): + (WebCore::HistoryItem::reset): + * history/HistoryItem.h: + * loader/HistoryController.cpp: + (WebCore::HistoryController::updateForBackForwardNavigation): + (WebCore::HistoryController::updateForReload): + (WebCore::HistoryController::updateForStandardLoad): + (WebCore::HistoryController::updateForRedirectWithLockedBackForwardList): + (WebCore::HistoryController::initializeItem): + (WebCore::HistoryController::createItem): + (WebCore::HistoryController::createItemTree): + (WebCore::HistoryController::updateCurrentItem): + * loader/HistoryController.h: + +2011-01-19 Adam Klein <adamk@chromium.org> + + Reviewed by Darin Fisher. + + [chromium] Rename ChromiumBridge to PlatformBridge + https://bugs.webkit.org/show_bug.cgi?id=52471 + + No tests added as this is a rename; no change in behavior. + + * WebCore.gypi: + * bindings/v8/V8DOMWindowShell.cpp: + (WebCore::reportFatalErrorInV8): + * page/PageGroup.cpp: + (WebCore::PageGroup::isLinkVisited): + * platform/android/PlatformBridge.h: + * platform/audio/chromium/AudioBusChromium.cpp: + (WebCore::createBusFromInMemoryAudioFile): + * platform/chromium/ChromiumBridge.h: Removed. + * platform/chromium/ChromiumDataObjectLegacy.cpp: + (WebCore::ChromiumDataObjectLegacy::getData): + * platform/chromium/DragDataChromium.cpp: + (WebCore::DragData::asURL): + * platform/chromium/FileSystemChromium.cpp: + (WebCore::deleteFile): + (WebCore::deleteEmptyDirectory): + (WebCore::getFileSize): + (WebCore::getFileModificationTime): + (WebCore::revealFolderInOS): + (WebCore::directoryName): + (WebCore::pathByAppendingComponent): + (WebCore::makeAllDirectories): + (WebCore::fileExists): + (WebCore::openFile): + (WebCore::closeFile): + (WebCore::seekFile): + (WebCore::truncateFile): + (WebCore::readFromFile): + (WebCore::writeToFile): + * platform/chromium/LanguageChromium.cpp: + (WebCore::platformDefaultLanguage): + * platform/chromium/LinkHashChromium.cpp: + (WebCore::visitedLinkHash): + * platform/chromium/MIMETypeRegistryChromium.cpp: + (WebCore::MIMETypeRegistry::getMIMETypeForExtension): + (WebCore::MIMETypeRegistry::getPreferredExtensionForMIMEType): + (WebCore::MIMETypeRegistry::isSupportedImageMIMEType): + (WebCore::MIMETypeRegistry::isSupportedJavaScriptMIMEType): + (WebCore::MIMETypeRegistry::isSupportedNonImageMIMEType): + * platform/chromium/PasteboardChromium.cpp: + (WebCore::Pasteboard::writeSelection): + (WebCore::Pasteboard::writePlainText): + (WebCore::Pasteboard::writeURL): + (WebCore::Pasteboard::writeImage): + (WebCore::Pasteboard::canSmartReplace): + (WebCore::Pasteboard::plainText): + (WebCore::Pasteboard::documentFragment): + * platform/chromium/PlatformBridge.h: + * platform/chromium/PlatformScreenChromium.cpp: + (WebCore::screenDepth): + (WebCore::screenDepthPerComponent): + (WebCore::screenIsMonochrome): + (WebCore::screenRect): + (WebCore::screenAvailableRect): + * platform/chromium/ReadableDataObject.cpp: + (WebCore::ReadableDataObject::getData): + (WebCore::ReadableDataObject::urlTitle): + (WebCore::ReadableDataObject::htmlBaseUrl): + (WebCore::ReadableDataObject::filenames): + (WebCore::ReadableDataObject::ensureTypeCacheInitialized): + * platform/chromium/SSLKeyGeneratorChromium.cpp: + (WebCore::signedPublicKeyAndChallengeString): + * platform/chromium/ScrollbarThemeChromium.cpp: + * platform/chromium/ScrollbarThemeChromiumLinux.cpp: + (WebCore::ScrollbarThemeChromiumLinux::scrollbarThickness): + (WebCore::ScrollbarThemeChromiumLinux::paintTrackPiece): + (WebCore::ScrollbarThemeChromiumLinux::paintButton): + (WebCore::ScrollbarThemeChromiumLinux::paintThumb): + (WebCore::ScrollbarThemeChromiumLinux::buttonSize): + (WebCore::ScrollbarThemeChromiumLinux::minimumThumbLength): + * platform/chromium/ScrollbarThemeChromiumMac.mm: + (WebCore::scrollbarStateToThemeState): + (WebCore::ScrollbarThemeChromiumMac::paint): + * platform/chromium/ScrollbarThemeChromiumWin.cpp: + (WebCore::ScrollbarThemeChromiumWin::scrollbarThickness): + (WebCore::ScrollbarThemeChromiumWin::paintTrackPiece): + (WebCore::ScrollbarThemeChromiumWin::paintButton): + (WebCore::ScrollbarThemeChromiumWin::paintThumb): + (WebCore::ScrollbarThemeChromiumWin::buttonSize): + * platform/chromium/SharedTimerChromium.cpp: + (WebCore::setSharedTimerFiredFunction): + (WebCore::setSharedTimerFireTime): + (WebCore::stopSharedTimer): + * platform/chromium/SuddenTerminationChromium.cpp: + (WebCore::disableSuddenTermination): + (WebCore::enableSuddenTermination): + * platform/chromium/SystemTimeChromium.cpp: + (WebCore::currentTime): + * platform/chromium/WritableDataObject.cpp: + (WebCore::WritableDataObject::setData): + * platform/graphics/chromium/CrossProcessFontLoading.mm: + * platform/graphics/chromium/FontCacheChromiumWin.cpp: + (WebCore::fontContainsCharacter): + (WebCore::FillLogFont): + * platform/graphics/chromium/FontCacheLinux.cpp: + (WebCore::FontCache::getFontDataForCharacters): + * platform/graphics/chromium/FontChromiumWin.cpp: + (WebCore::Font::drawGlyphs): + * platform/graphics/chromium/FontPlatformDataChromiumWin.cpp: + (WebCore::FontPlatformData::scriptFontProperties): + * platform/graphics/chromium/FontPlatformDataLinux.cpp: + (WebCore::FontPlatformData::querySystemForRenderStyle): + * platform/graphics/chromium/GlyphPageTreeNodeChromiumWin.cpp: + (WebCore::fillBMPGlyphs): + * platform/graphics/chromium/ImageChromium.cpp: + (WebCore::Image::loadPlatformResource): + * platform/graphics/chromium/ImageChromiumMac.mm: + (WebCore::Image::loadPlatformResource): + * platform/graphics/chromium/SimpleFontDataChromiumWin.cpp: + (WebCore::SimpleFontData::platformInit): + (WebCore::SimpleFontData::determinePitch): + (WebCore::SimpleFontData::platformWidthForGlyph): + * platform/graphics/chromium/UniscribeHelperTextRun.cpp: + (WebCore::UniscribeHelperTextRun::tryToPreloadFont): + * platform/graphics/skia/FontCustomPlatformData.cpp: + (WebCore::FontCustomPlatformData::fontPlatformData): + * platform/network/chromium/CookieJarChromium.cpp: + (WebCore::setCookies): + (WebCore::cookies): + (WebCore::cookieRequestHeaderFieldValue): + (WebCore::cookiesEnabled): + (WebCore::getRawCookies): + (WebCore::deleteCookie): + * platform/network/chromium/DNSChromium.cpp: + (WebCore::prefetchDNS): + * platform/qt/PlatformBridge.h: + * platform/sql/chromium/SQLiteFileSystemChromium.cpp: + (WebCore::SQLiteFileSystem::deleteDatabaseFile): + (WebCore::SQLiteFileSystem::getDatabaseFileSize): + * platform/sql/chromium/SQLiteFileSystemChromiumPosix.cpp: + (chromiumOpen): + (chromiumDelete): + (chromiumAccess): + * platform/sql/chromium/SQLiteFileSystemChromiumWin.cpp: + * plugins/chromium/PluginDataChromium.cpp: + (WebCore::PluginCache::plugins): + * rendering/RenderThemeChromiumMac.mm: + (WebCore::RenderThemeChromiumMac::usesTestModeFocusRingColor): + * rendering/RenderThemeChromiumSkia.cpp: + (WebCore::RenderThemeChromiumSkia::caretBlinkInterval): + * rendering/RenderThemeChromiumWin.cpp: + (WebCore::RenderThemeChromiumWin::platformActiveSelectionBackgroundColor): + (WebCore::RenderThemeChromiumWin::platformInactiveSelectionBackgroundColor): + (WebCore::RenderThemeChromiumWin::platformActiveSelectionForegroundColor): + (WebCore::RenderThemeChromiumWin::systemColor): + (WebCore::RenderThemeChromiumWin::paintButton): + (WebCore::RenderThemeChromiumWin::paintSliderTrack): + (WebCore::menuListButtonWidth): + (WebCore::RenderThemeChromiumWin::paintMenuList): + (WebCore::RenderThemeChromiumWin::paintTextFieldInternal): + (WebCore::RenderThemeChromiumWin::paintInnerSpinButton): + (WebCore::RenderThemeChromiumWin::paintProgressBar): + * storage/chromium/IDBFactoryBackendInterface.cpp: + (WebCore::IDBFactoryBackendInterface::create): + (WebCore::IDBFactoryBackendInterface::~IDBFactoryBackendInterface): + * storage/chromium/IDBKeyPathBackendImpl.cpp: + (WebCore::IDBKeyPathBackendImpl::createIDBKeysFromSerializedValuesAndKeyPath): + +2011-01-19 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r76187. + http://trac.webkit.org/changeset/76187 + https://bugs.webkit.org/show_bug.cgi?id=52778 + + Broke caret-showing tests on SnowLeopard and Chromium + (Requested by dimich on #webkit). + + * rendering/RenderText.cpp: + (WebCore::RenderText::localCaretRect): + +2011-01-19 Yuzo Fujishima <yuzo@google.com> + + Reviewed by Kent Tamura. + + Fix for Bug 52279 - WebCore::RenderBlock::updateFirstLetter crashes for anonymous blocks + https://bugs.webkit.org/show_bug.cgi?id=52279 + + In constructing text fragments to handle first-letter rule, first add + the text for the non-first letters and then remove the original text, + rather than the other way around. Otherwise, the text can be added to + an anoymous block that is different from the original one. This breaks + the assumption that a first letter render object has a non-null sibling + for the non-first letters and causes a crash. + + Test: fast/css/first-letter-anonymous-block-crash.html + + * rendering/RenderBlock.cpp: + (WebCore::RenderBlock::updateFirstLetter): + +2011-01-19 James Robinson <jamesr@chromium.org> + + Unreviewed, rolling out r76194. + http://trac.webkit.org/changeset/76194 + https://bugs.webkit.org/show_bug.cgi?id=51218 + + Caused mysterious compile failure on the chromium win + build.webkit.org bots + + * WebCore.gypi: + * dom/Document.cpp: + (WebCore::Document::Document): + * dom/Document.h: + * dom/RequestAnimationFrameCallback.h: Removed. + * dom/RequestAnimationFrameCallback.idl: Removed. + * loader/EmptyClients.h: + * page/Chrome.cpp: + * page/Chrome.h: + * page/ChromeClient.h: + * page/DOMWindow.cpp: + * page/DOMWindow.h: + * page/DOMWindow.idl: + * page/FrameView.cpp: + * page/FrameView.h: + * platform/HostWindow.h: + +2011-01-19 Simon Fraser <simon.fraser@apple.com> + + Reviewed by Sam Weinig. + + GraphicsLayers in subframes can get sync'd multiple times + https://bugs.webkit.org/show_bug.cgi?id=52489 + + Some cleanup that will work towards fixing this bug. + + Tested by existing iframe compositing tests. + + * WebCore.exp.in: syncCompositingStateRecursive() + was renamed to syncCompositingStateIncludingSubframes(). + + * page/FrameView.h: + * page/FrameView.cpp: + (WebCore::FrameView::syncCompositingStateForThisFrame): Some + code cleanup: do all the word we need to do for this frame, + including the needsLayout() check. + (WebCore::FrameView::syncCompositingStateIncludingSubframes): + This is no longer recursive; instead, it iterates over descendant + frames via the frame tree, calling syncCompositingStateForThisFrame() + on each Frame's view. + + * rendering/RenderLayerCompositor.h: + (WebCore::RenderLayerCompositor::isFlushingLayers): Getter for the flag. + * rendering/RenderLayerCompositor.cpp: + (WebCore::RenderLayerCompositor::RenderLayerCompositor): + (WebCore::RenderLayerCompositor::flushPendingLayerChanges): Maintain + a flag to say if we're flushing, which allows us to assert on re-entrant flushes. + (WebCore::RenderLayerCompositor::enclosingCompositorFlushingLayers): + Add the ability to get the rootmost compositor that is in the middle + of a flush. + +2011-01-19 James Robinson <jamesr@chromium.org> + + Reviewed by Darin Fisher. + + Implement mozilla's requestAnimationFrame API + https://bugs.webkit.org/show_bug.cgi?id=51218 + + This implements mozilla's proposed requestAnimationFrame API. The idea with this API is that + an author driving an animation from script could use window.requestAnimationFrame(callback) + instead of window.setTimeout(callback, 0) to schedule their update logic and let the browser + decide when to update the animations. This avoids doing unnecessary work when the page content + is offscreen or is being displayed at a different framerate than what the page author expects. + + Mozilla's proposal is here: https://developer.mozilla.org/en/DOM/window.mozRequestAnimationFrame + This implements window.mozRequestAnimationFrame as window.webkitRequestAnimationFrame with the + following changes: + *) Only the callback syntax is supported, there is no before paint event + *) webkitRequestAnimationFrame supports a second parameter Element to let the author indicate + what content they intend to animate. That way if the page is being displayed but the element + in question is offscreen, we can avoid invoking the callback. + *) No timestamp is provided to the caller and there is no window.animationStartTime property + (see https://bugs.webkit.org/show_bug.cgi?id=51952 for discussion of this property) + *) window.webkitRequestAnimationFrame returns a numerical id that can be used to cancel the callback + using window.cancelWebkitRequestAnimationFrame, to parallel window.setTimeout()/window.clearTime(). + + The implementation depends on the embedder scheduling the callbacks since the callback invocation + depends on the page's visibility and the embedder's paint scheduling, neither of which are exposed + to WebCore. The expectation for the embedder is that at some point Chrome::scheduleAnimation() is + called FrameView::serviceScriptedAnimations() should be called for the associated Page's main frame. + Ideally serviceScriptedAnimations() would be called prior to rendering - although in practice the + embedder has to rate limit callbacks and may not be able to tie the callback directly to the + rendering loop. + + Tests: fast/animation/request-animation-frame-cancel.html + fast/animation/request-animation-frame-cancel2.html + fast/animation/request-animation-frame-display.html + fast/animation/request-animation-frame-within-callback.html + fast/animation/request-animation-frame.html + + * WebCore.gypi: + * dom/Document.cpp: + (WebCore::Document::Document): + (WebCore::Document::webkitRequestAnimationFrame): + (WebCore::Document::webkitCancelRequestAnimationFrame): + (WebCore::Document::serviceScriptedAnimations): + * dom/Document.h: + * dom/RequestAnimationFrameCallback.h: Added. + (WebCore::RequestAnimationFrameCallback::~RequestAnimationFrameCallback): + * dom/RequestAnimationFrameCallback.idl: Added. + * loader/EmptyClients.h: + (WebCore::EmptyChromeClient::scheduleAnimation): + * page/Chrome.cpp: + (WebCore::Chrome::scheduleAnimation): + * page/Chrome.h: + * page/ChromeClient.h: + * page/DOMWindow.cpp: + (WebCore::DOMWindow::webkitRequestAnimationFrame): + (WebCore::DOMWindow::webkitCancelRequestAnimationFrame): + * page/DOMWindow.h: + * page/DOMWindow.idl: + * page/FrameView.cpp: + (WebCore::FrameView::scheduleAnimation): + (WebCore::FrameView::serviceScriptedAnimations): + * page/FrameView.h: + * platform/HostWindow.h: + +2011-01-13 Martin Robinson <mrobinson@igalia.com> + + Reviewed by Daniel Bates. + + [GTK] Move progress bar painting out of gtk2drawing.c + https://bugs.webkit.org/show_bug.cgi?id=52385 + + Move progress bar painting to RenderThemeGtk2 and share some animation + logic between the GTK+ 2.x and GTK+ 3.x port. + + No new tests. This should not change functionality. + + * platform/gtk/RenderThemeGtk.cpp: + (WebCore::RenderThemeGtk::animationRepeatIntervalForProgressBar): Moved from RenderThemeGtk3. + (WebCore::RenderThemeGtk::animationDurationForProgressBar): Ditto. + (WebCore::RenderThemeGtk::calculateProgressRect): Calculate the proper rectangle for the + progress indicator given the rect for the maximum size of the indicator. + * platform/gtk/RenderThemeGtk.h: Added calculateProgressRect declaration and + a new widget member for GTK+ 2.x + * platform/gtk/RenderThemeGtk2.cpp: + (WebCore::RenderThemeGtk::platformInit): Added initialization for the new widget member. + (WebCore::RenderThemeGtk::paintProgressBar): Paint the progress bar manually instead of + calling the old Mozilla code. + (WebCore::RenderThemeGtk::gtkProgressBar): Added. + * platform/gtk/RenderThemeGtk3.cpp: + (WebCore::RenderThemeGtk::paintProgressBar): Call calculateProgressRect now to get + the area of the progress indicator. + * platform/gtk/gtk2drawing.c: Remove unused code. + (moz_gtk_get_widget_border): + (moz_gtk_widget_paint): + * platform/gtk/gtkdrawing.h: Ditto. + +2011-01-19 Dmitry Titov <dimich@chromium.org> + + [Chromium] Not reviewed, reverts the following changes: + http://trac.webkit.org/changeset/76164 (build fix) + http://trac.webkit.org/changeset/76159 (main change) + + The change broke Chromium Linux-shlib build. + + Original issue: + Accelerated canvas2D has bad clipping performance. + https://bugs.webkit.org/show_bug.cgi?id=52627 + + * WebCore.gyp/WebCore.gyp: + * WebCore.gypi: + * html/canvas/CanvasRenderingContext2D.cpp: + (WebCore::CanvasRenderingContext2D::reset): + (WebCore::CanvasRenderingContext2D::platformLayer): + * platform/graphics/chromium/DrawingBufferChromium.cpp: + (WebCore::DrawingBuffer::DrawingBuffer): + * platform/graphics/chromium/GLES2Canvas.cpp: + (WebCore::GLES2Canvas::State::State): + (WebCore::GLES2Canvas::clearRect): + (WebCore::GLES2Canvas::fillRect): + (WebCore::GLES2Canvas::restore): + (WebCore::GLES2Canvas::drawTexturedRect): + * platform/graphics/chromium/GLES2Canvas.h: + * platform/graphics/gpu/DrawingBuffer.cpp: + (WebCore::DrawingBuffer::clear): + (WebCore::DrawingBuffer::createSecondaryBuffers): + (WebCore::DrawingBuffer::reset): + * platform/graphics/gpu/DrawingBuffer.h: + * platform/graphics/gpu/SharedGraphicsContext3D.cpp: + (WebCore::SharedGraphicsContext3D::create): + * platform/graphics/gpu/SharedGraphicsContext3D.h: + * platform/graphics/gpu/mac/DrawingBufferMac.mm: + (WebCore::DrawingBuffer::DrawingBuffer): + * platform/graphics/skia/GraphicsContextSkia.cpp: + (WebCore::GraphicsContext::canvasClip): + (WebCore::GraphicsContext::clipOut): + (WebCore::GraphicsContext::clipPath): + (WebCore::GraphicsContext::fillPath): + * platform/graphics/skia/PlatformContextSkia.cpp: + (WebCore::PlatformContextSkia::canAccelerate): + (WebCore::PlatformContextSkia::uploadSoftwareToHardware): + * thirdparty/glu/README.webkit: + * thirdparty/glu/gluos.h: + * thirdparty/glu/libtess/geom.c: + * thirdparty/glu/libtess/priorityq.c: + * thirdparty/glu/libtess/render.c: + * thirdparty/glu/libtess/sweep.c: + (IsWindingInside): + (DoneEdgeDict): + +2011-01-19 Levi Weintraub <leviw@google.com> + + Reviewed by Darin Adler. + + Re-committing this with the proper expected results. + + Changing RenderText::localCaretRect to clip to its containing block's logicalLeft and + logicalRightLayoutOverflow instead of simply using logicalLeft and logicalRight, as this + resulted in the caret being placed incorrectly in overflowing editable IFrame content. + + Long lines in non-white-space-pre editable documents show cursor in wrong place + https://bugs.webkit.org/show_bug.cgi?id=48132 + + Test: editing/selection/caret-painting-in-overflowing-autowrap-content.html + + * rendering/RenderText.cpp: + (WebCore::RenderText::localCaretRect): + +2011-01-18 MORITA Hajime <morrita@google.com> + + Reviewed by David Levin. + + ElementRareData::m_shadowRoot should not be RefPtr. + https://bugs.webkit.org/show_bug.cgi?id=51914 + + Makes ElementRareData::m_shadowRoot a raw pointer because + ElementRareData::m_shadowRoot should be like a + ContaineNode::m_firstChild, which is also a raw pointer. + pointer. Which also means that both the shadow root and the shadow + host reference each other as a parent-and-child relationship, via + a raw pointer. + + Note that it is safe not to manipulate the ref-count of + m_shadowRoot because Node::m_parent of the shadow root points its + shadow host, and the object isn't deleted even if the refcount is + zero, as long as the node has non-null m_parent. (See TreeShared.) + + The shadow root node is finally destroyed inside + removeShadowRoot(), where we store the root node into a local + RefPtr, then make the node's m_parent null, which results the + destroy the node, at the end of the function, by RefPtr::~RefPtr. + + No new tests. No behavioral change. + + * dom/Element.cpp: + (WebCore::Element::~Element): + (WebCore::Element::shadowRoot): + (WebCore::Element::setShadowRoot): + (WebCore::Element::removeShadowRoot): + * dom/ElementRareData.h: + (WebCore::ElementRareData::ElementRareData): + (WebCore::ElementRareData::~ElementRareData): + +2011-01-12 Martin Robinson <mrobinson@igalia.com> + + Reviewed by Gustavo Noronha Silva. + + [GTK] Move text field painting out of gtk2drawing.c + https://bugs.webkit.org/show_bug.cgi?id=52327 + + No new tests. This should not change behavior. + + * platform/gtk/RenderThemeGtk2.cpp: + (WebCore::RenderThemeGtk::paintButton): Use the setWidgetHasFocus helper. + (WebCore::RenderThemeGtk::paintTextField): Do this manually now instead + of calling into the Mozilla code. + * platform/gtk/WidgetRenderingContext.cpp: Added a couple more wrappers + for GTK+ theme functions. + (WebCore::WidgetRenderingContext::gtkPaintFlatBox): + (WebCore::WidgetRenderingContext::gtkPaintShadow): + * platform/gtk/WidgetRenderingContext.h: Added new method declarations. + * platform/gtk/gtk2drawing.c: Remove unused code. + (moz_gtk_get_widget_border): + (moz_gtk_widget_paint): + * platform/gtk/gtkdrawing.h: + +2011-01-19 Antti Koivisto <antti@apple.com> + + Reviewed by Oliver Hunt. + + Cache function offsets to speed up javascript parsing + https://bugs.webkit.org/show_bug.cgi?id=52622 + + Use cache to save function offsets and some other info. + This avoids quite a bit of work when reparsing the source. + + * bindings/js/CachedScriptSourceProvider.h: + (WebCore::CachedScriptSourceProvider::cache): + (WebCore::CachedScriptSourceProvider::cacheSizeChanged): + (WebCore::CachedScriptSourceProvider::CachedScriptSourceProvider): + * bindings/js/ScriptSourceProvider.h: + (WebCore::ScriptSourceProvider::ScriptSourceProvider): + * loader/cache/CachedScript.cpp: + (WebCore::CachedScript::destroyDecodedData): + (WebCore::CachedScript::sourceProviderCache): + (WebCore::CachedScript::sourceProviderCacheSizeChanged): + * loader/cache/CachedScript.h: + +2011-01-11 Martin Robinson <mrobinson@igalia.com> + + Reviewed by Gustavo Noronha Silva. + + [GTK] Move toggle button rendering out of gtk2drawing.c + https://bugs.webkit.org/show_bug.cgi?id=52258 + + * platform/gtk/RenderThemeGtk.h: + * platform/gtk/RenderThemeGtk2.cpp: + (WebCore::RenderThemeGtk::platformInit): Initialize new button members. + (WebCore::adjustRectForFocus): Added this function which inflates a rect based + on a widget's exterior focus. + (WebCore::RenderThemeGtk::adjustRepaintRect): Account for exterior focus. + (WebCore::setToggleSize): Only listen to indicator-size to properly size + checkboxes and radio buttons. + (WebCore::RenderThemeGtk::setCheckboxSize): Call new setToggleSize properly. + (WebCore::paintToggle): Added. + (WebCore::RenderThemeGtk::paintCheckbox): Call paintToggle. + (WebCore::RenderThemeGtk::setRadioSize): Call new setToggleSize properly. + (WebCore::RenderThemeGtk::paintRadio): Call paintToggle. + (WebCore::RenderThemeGtk::gtkRadioButton): Added. + (WebCore::RenderThemeGtk::gtkCheckButton): Added. + * platform/gtk/WidgetRenderingContext.cpp: + (WebCore::WidgetRenderingContext::WidgetRenderingContext): Use a static extra space + variable. This is good enough for all themes that I've tested and prevents having to + pass information from RenderThemeGtk about every single type of widget. + (WebCore::WidgetRenderingContext::gtkPaintFocus): Use the paintRect + to draw instead of m_paintRect. This is important when we're painting + something that isn't the size of the total rect. + (WebCore::WidgetRenderingContext::gtkPaintCheck): Added. + (WebCore::WidgetRenderingContext::gtkPaintOption): Added. + * platform/gtk/WidgetRenderingContext.h: Updated to reflect new methods. + * platform/gtk/gtkdrawing.h: Remove newly unused code. + * platform/gtk/gtk2drawing.c: Ditto. + +2011-01-19 Tony Gentilcore <tonyg@chromium.org> + + Unreviewed build fix. + + Build fix for r76170 + https://bugs.webkit.org/show_bug.cgi?id=52758 + + * platform/graphics/chromium/UniscribeHelperTextRun.cpp: + +2011-01-19 David D. Kilzer <ddkilzer@apple.com> + + <http://webkit.org/b/52687> Clean up FrameLoader methods for PLUGIN_PROXY_FOR_VIDEO + + Reviewed by Eric Carlson. + + * loader/FrameLoader.cpp: Declare the methods here. + (WebCore::FrameLoader::hideMediaPlayerProxyPlugin): + (WebCore::FrameLoader::showMediaPlayerProxyPlugin): + * loader/FrameLoader.cpp: Moved methods to here... + (WebCore::FrameLoader::hideMediaPlayerProxyPlugin): + (WebCore::FrameLoader::showMediaPlayerProxyPlugin): + * loader/SubframeLoader.cpp: ...from here. + (WebCore::FrameLoader::hideMediaPlayerProxyPlugin): + (WebCore::FrameLoader::showMediaPlayerProxyPlugin): + +2011-01-19 Tony Gentilcore <tonyg@chromium.org> + + Reviewed by Mihai Parparita. + + Perform some forward declaration + https://bugs.webkit.org/show_bug.cgi?id=52522 + + No new tests because no new functionality. + + * accessibility/AccessibilityObject.h: + * css/WebKitCSSMatrix.cpp: + * html/HTMLAreaElement.cpp: + * html/canvas/CanvasRenderingContext2D.cpp: + * inspector/InspectorController.cpp: + * platform/graphics/FloatPoint.cpp: + * platform/graphics/Font.cpp: + * platform/graphics/Font.h: + * platform/graphics/FontFastPath.cpp: + * platform/graphics/GraphicsContext.cpp: + * platform/graphics/ImageBuffer.h: + * platform/graphics/StringTruncator.cpp: + * platform/graphics/WidthIterator.cpp: + * platform/graphics/mac/ComplexTextController.cpp: + * platform/graphics/mac/ComplexTextControllerCoreText.cpp: + * platform/graphics/mac/FontComplexTextMac.cpp: + * platform/graphics/transforms/TransformationMatrix.cpp: + * platform/graphics/transforms/TransformationMatrix.h: + * rendering/EllipsisBox.cpp: + * rendering/InlineTextBox.cpp: + * rendering/RenderBlock.cpp: + * rendering/RenderBlockLineLayout.cpp: + * rendering/RenderEmbeddedObject.cpp: + * rendering/RenderFileUploadControl.cpp: + * rendering/RenderFlexibleBox.cpp: + * rendering/RenderImage.cpp: + * rendering/RenderListBox.cpp: + * rendering/RenderListMarker.cpp: + * rendering/RenderMenuList.cpp: + * rendering/RenderObject.h: + * rendering/RenderText.cpp: + * rendering/RenderTextControl.cpp: + * rendering/svg/SVGInlineTextBox.cpp: + * rendering/svg/SVGMarkerLayoutInfo.h: + * rendering/svg/SVGTextMetrics.cpp: + * svg/SVGFont.cpp: + +2011-01-19 Adrienne Walker <enne@google.com> + + Reviewed by Kenneth Russell. + + [chromium] Tiled compositor should use texture manager + https://bugs.webkit.org/show_bug.cgi?id=52418 + + Test: compositing/ + + * platform/graphics/chromium/LayerRendererChromium.cpp: + (WebCore::LayerRendererChromium::~LayerRendererChromium): + (WebCore::LayerRendererChromium::cleanupSharedObjects): + * platform/graphics/chromium/LayerTilerChromium.cpp: + (WebCore::LayerTilerChromium::LayerTilerChromium): + (WebCore::LayerTilerChromium::reset): + (WebCore::LayerTilerChromium::createTile): + (WebCore::LayerTilerChromium::update): + (WebCore::LayerTilerChromium::draw): + * platform/graphics/chromium/LayerTilerChromium.h: + (WebCore::LayerTilerChromium::Tile::Tile): + (WebCore::LayerTilerChromium::Tile::texture): + +2011-01-19 Stephen White <senorblanco@chromium.org> + + Unreviewed; build fix for chromium. + + * platform/graphics/chromium/GLES2Canvas.cpp: + (WebCore::GLES2Canvas::fillPath): + +2011-01-18 Stephen White <senorblanco@chromium.org> + + Reviewed by James Robinson. + + Implement accelerated path drawing and clipping for the Canvas2D GPU + path. + https://bugs.webkit.org/show_bug.cgi?id=52627 + + This is done with a simple curve interpolator and the GLU tesselator, + which is good enough for a 3-5X speedup on + http://ie.microsoft.com/testdrive/Performance/Galactic/Default.html. + + Covered by canvas/philip/2d.path.clip.basic.html, and many, many more. + All tests canvas/philip and fast/canvas paths pass with no + regressions, although two have minor pixel differences which require + rebaselining. + + * WebCore.gyp/WebCore.gyp: + Add internal_glu include path to chromium build. + * WebCore.gypi: + Add internal_glu files to chromium build. + * html/canvas/CanvasRenderingContext2D.cpp: + (WebCore::CanvasRenderingContext2D::reset): + (WebCore::CanvasRenderingContext2D::platformLayer): + Make CanvasRenderingContext2D more robust against failure to create + a DrawingBuffer. + * platform/graphics/chromium/DrawingBufferChromium.cpp: + (WebCore::DrawingBuffer::DrawingBuffer): + As in DrawingBufferMac.cpp, call reset() from the constructor. + Also initialize size to (-1, -1), so reset() doesn't early-out. + Add initializers for depthBuffer and stencilBuffer, and remove + multisampleDepthStencilBuffer. + * platform/graphics/chromium/GLES2Canvas.cpp: + Remove some unused #includes. + (WebCore::GLES2Canvas::State::State): + Add clipping state, and implement save/restore via the copy constructor. + (WebCore::operator*): + (WebCore::Quadratic::Quadratic): + (WebCore::Quadratic::fromBezier): + (WebCore::Quadratic::evaluate): + Quadratic Bezier curve class. + (WebCore::Cubic::Cubic): + (WebCore::Cubic::fromBezier): + (WebCore::Cubic::evaluate): + Cubic Bezier curve class. + (WebCore::GLES2Canvas::clearRect): + Add clipping support to clearRect(). + (WebCore::GLES2Canvas::fillPath): + Implement fillPath(). + (WebCore::GLES2Canvas::fillRect): + Add clipping support to fillRect(). + (WebCore::GLES2Canvas::clipPath): + Implement clipPath(). + (WebCore::GLES2Canvas::clipOut): + Stub out clipOut() (not called by Canvas 2D). + (WebCore::GLES2Canvas::restore): + When restoring, draw any remaining clipping paths to the stencil buffer. + (WebCore::GLES2Canvas::drawTexturedRect): + Add clipping support. + (WebCore::interpolateQuadratic): + (WebCore::interpolateCubic): + Simple curve interpolation, using the Cubic and Quadratic classes. + (WebCore::PolygonData::PolygonData): + A struct to hold the tesselation data for callbacks. + (WebCore::beginData): + (WebCore::edgeFlagData): + (WebCore::vertexData): + (WebCore::endData): + (WebCore::combineData): + internal_glu tesselation callbacks. + (WebCore::GLES2Canvas::createVertexBufferFromPath): + Build an interpolated, tesselated vertex buffer and element array buffer from a given path, suitable for filling. + (WebCore::GLES2Canvas::beginStencilDraw): + Enable stencilling, and disable draws to the color buffer. + (WebCore::GLES2Canvas::applyClipping): + If clipping is enabled, set the appropriate GL state. + * platform/graphics/chromium/GLES2Canvas.h: + Document the flavours of drawTexturedRect() a bit, so I don't get confused. + * platform/graphics/gpu/DrawingBuffer.cpp: + (WebCore::DrawingBuffer::clear): + (WebCore::DrawingBuffer::createSecondaryBuffers): + (WebCore::DrawingBuffer::resizeDepthStencil): + (WebCore::DrawingBuffer::reset): + * platform/graphics/gpu/DrawingBuffer.h: + Unify m_multisampleDepthStencilBuffer with m_depthStencilBuffer. + Implement separate depth and stencil buffers for when + OES_packed_depth_stencil is not available. Refactor creation of + multisampled and non-multisampled depth and stencil buffers into + resizeDepthStencil(). + * platform/graphics/gpu/SharedGraphicsContext3D.cpp: + (WebCore::SharedGraphicsContext3D::create): + Turn on stencil, turn off depth, turn off antialiasing (for now). + (WebCore::SharedGraphicsContext3D::enableStencil): + * platform/graphics/gpu/SharedGraphicsContext3D.h: + Implement stencil enable/disable. + * platform/graphics/gpu/mac/DrawingBufferMac.mm: + (WebCore::DrawingBuffer::DrawingBuffer): + Remove m_multisampleDepthStencilBuffer. Set the size to (-1, -1) + on creation, so reset() doesn't early-out. Initialize m_depthBuffer + and m_stencilBuffer. + * platform/graphics/skia/GraphicsContextSkia.cpp: + (WebCore::GraphicsContext::canvasClip): + (WebCore::GraphicsContext::clipOut): + (WebCore::GraphicsContext::clipPath): + (WebCore::GraphicsContext::fillPath): + Put in GPU hooks for path clipping, and path drawing. + * platform/graphics/skia/PlatformContextSkia.cpp: + (WebCore::PlatformContextSkia::canAccelerate): + Don't check for clipping paths in canAccelerate() (since we can + now accelerate them). + (WebCore::PlatformContextSkia::uploadSoftwareToHardware): + Don't do clipping when uploading software draws to hardware. + * thirdparty/glu/README.webkit: + * thirdparty/glu/gluos.h: + #undef MIN and MAX, to fix warnings-as-errors in Chrome/Mac build. + * thirdparty/glu/libtess/geom.c: + * thirdparty/glu/libtess/priorityq.c: + * thirdparty/glu/libtess/render.c: + Use do{}while(0) instead of if(1)else construct in macro. + * thirdparty/glu/libtess/sweep.c: + (IsWindingInside): + (DoneEdgeDict): + Fix some warnings treated as errors for the Linux Release build. + +2011-01-19 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r76144. + http://trac.webkit.org/changeset/76144 + https://bugs.webkit.org/show_bug.cgi?id=52737 + + Broke tests on multiple bots, mostly Chromium Canaries + (Requested by dimich on #webkit). + + * rendering/RenderText.cpp: + (WebCore::RenderText::localCaretRect): + +2011-01-19 Simon Fraser <simon.fraser@apple.com> + + Reviewed by Adam Roben. + + [CSS Gradients] Crash due to out-of-memory with repeating-linear-gradient and latter stop positioned before former + https://bugs.webkit.org/show_bug.cgi?id=52732 + + When repeating gradient stops, make sure that the first and last stops are not at the same + place, otherwise we'll add stops indefinitely and run out of memory. + + Test: fast/gradients/zero-range-repeating-gradient-hang.html + + * css/CSSGradientValue.cpp: + (WebCore::CSSGradientValue::addStops): + +2011-01-14 Dimitri Glazkov <dglazkov@chromium.org> + + Reviewed by Darin Adler. + + Remove event forwarding logic from input[type=range], simplify event flow and thumb positioning logic. + https://bugs.webkit.org/show_bug.cgi?id=52464 + + This change has two parts: + + 1) Utilize shadow DOM event retargeting to get rid of forwarding events + via render tree; + 2) Move thumb positioning logic from RenderSlider to SliderThumbElement. + + These two are highly co-dependent. It looked ugly when I tried to + separate them. + + No change in behavior, covered by existing tests. + + * html/HTMLInputElement.cpp: + (WebCore::HTMLInputElement::defaultEventHandler): Added invocation of + InputType::handleMouseDownEvent. + * html/InputType.cpp: + (WebCore::InputType::handleMouseDownEvent): Added empty decl. + * html/InputType.h: Added def. + * html/RangeInputType.cpp: + (WebCore::RangeInputType::handleMouseDownEvent): Added to handle the case + when the user clicks on the track of the slider. Also removed the + forwardEvent method. + * html/RangeInputType.h: Added/removed defs. + * html/shadow/SliderThumbElement.cpp: + (WebCore::SliderThumbElement::dragFrom): Added a helper method to start + dragging from any position. + (WebCore::SliderThumbElement::dragTo): Added a helper method to drag to + specified position. + (WebCore::SliderThumbElement::setPosition): Collapsed most of the positioning + logic in RenderSlider into this method, which is now a simple calculation + and adjusting of thumb position based on supplied coordinates. + (WebCore::SliderThumbElement::startDragging): Added. + (WebCore::SliderThumbElement::stopDragging): Added. + (WebCore::SliderThumbElement::defaultEventHandler): Removed most of the + old position-sniffing logic and replaced with simple calls to start, + stop, and drag the thumb. + * html/shadow/SliderThumbElement.h: Added defs. + * rendering/RenderSlider.cpp: Removed a bunch of code that is no longer + necessary. + * rendering/RenderSlider.h: Removed defs, removed now-unnecessary friendliness. + +2011-01-19 Shane Stephens <shanestephens@google.com> + + Reviewed by Chris Marrin. + + Make AffineTransform and TransformationMatrix do matrix multiplication in the correct order (Column Major) + https://bugs.webkit.org/show_bug.cgi?id=48031 + + Fixed reversal, renamed matrix methods to be clearer, found all examples of operator* and + operator*= usage and switched operand order. + + No new tests as this refactor doesn't add functionality. + + * html/HTMLCanvasElement.cpp: + (WebCore::HTMLCanvasElement::baseTransform): + * html/canvas/CanvasRenderingContext2D.cpp: + (WebCore::CanvasRenderingContext2D::transform): + (WebCore::CanvasRenderingContext2D::setTransform): + * platform/graphics/cg/PatternCG.cpp: + (WebCore::Pattern::createPlatformPattern): + * platform/graphics/chromium/GLES2Canvas.cpp: + (WebCore::GLES2Canvas::fillRect): + (WebCore::GLES2Canvas::concatCTM): + (WebCore::GLES2Canvas::drawQuad): + * platform/graphics/chromium/TransparencyWin.cpp: + (WebCore::TransparencyWin::setupLayerForOpaqueCompositeLayer): + (WebCore::TransparencyWin::setupTransformForKeepTransform): + * platform/graphics/transforms/AffineTransform.cpp: + (WebCore::AffineTransform::multiply): + (WebCore::AffineTransform::rotate): + * platform/graphics/transforms/AffineTransform.h: + (WebCore::AffineTransform::operator*=): + (WebCore::AffineTransform::operator*): + * platform/graphics/wince/GraphicsContextWinCE.cpp: + (WebCore::GraphicsContextPlatformPrivate::concatCTM): + * platform/graphics/wince/SharedBitmap.cpp: + (WebCore::SharedBitmap::drawPattern): + * rendering/svg/RenderSVGResourceContainer.cpp: + (WebCore::RenderSVGResourceContainer::transformOnNonScalingStroke): + * rendering/svg/RenderSVGResourceGradient.cpp: + (WebCore::clipToTextMask): + (WebCore::RenderSVGResourceGradient::applyResource): + * rendering/svg/RenderSVGResourcePattern.cpp: + (WebCore::RenderSVGResourcePattern::applyResource): + * rendering/svg/RenderSVGRoot.cpp: + (WebCore::RenderSVGRoot::localToBorderBoxTransform): + * rendering/svg/SVGImageBufferTools.cpp: + (WebCore::SVGImageBufferTools::calculateTransformationToOutermostSVGCoordinateSystem): + (WebCore::SVGImageBufferTools::renderSubtreeToImageBuffer): + * rendering/svg/SVGTextLayoutEngine.cpp: + (WebCore::SVGTextLayoutEngine::finalizeTransformMatrices): + * svg/SVGLocatable.cpp: + (WebCore::SVGLocatable::computeCTM): + (WebCore::SVGLocatable::getTransformToElement): + * svg/SVGMatrix.h: + (WebCore::SVGMatrix::multiply): + * svg/SVGSVGElement.cpp: + (WebCore::SVGSVGElement::localCoordinateSpaceTransform): + (WebCore::SVGSVGElement::viewBoxToViewTransform): + * svg/SVGStyledTransformableElement.cpp: + (WebCore::SVGStyledTransformableElement::animatedLocalTransform): + * svg/SVGTextElement.cpp: + (WebCore::SVGTextElement::animatedLocalTransform): + * svg/SVGTransformList.cpp: + (WebCore::SVGTransformList::concatenate): + +2011-01-19 Chang Shu <chang.shu@nokia.com> + + Reviewed by Darin Adler. + + The return value of contentEditable() function should depend on the DOM attribute + instead of render style userModify. The code change fixed test cases in the bug + and partially fixed test cases in other contentEditable bugs; + + https://bugs.webkit.org/show_bug.cgi?id=52056 + + * html/HTMLElement.cpp: + (WebCore::HTMLElement::contentEditable): + +2011-01-19 Levi Weintraub <leviw@chromium.org> + + Reviewed by Darin Adler. + + Changing RenderText::localCaretRect to clip to its containing block's logicalLeft and + logicalRightLayoutOverflow instead of simply using logicalLeft and logicalRight, as this + resulted in the caret being placed incorrectly in overflowing editable IFrame content. + + Long lines in non-white-space-pre editable documents show cursor in wrong place + https://bugs.webkit.org/show_bug.cgi?id=48132 + + Test: editing/selection/caret-painting-in-overflowing-autowrap-content.html + + * rendering/RenderText.cpp: + (WebCore::RenderText::localCaretRect): + +2011-01-19 Chris Marrin <cmarrin@apple.com> + + Reviewed by Simon Fraser. + + WK2 - Multiple crashes in PlatformCALayer::replaceSublayer + https://bugs.webkit.org/show_bug.cgi?id=52695 + + Added ASSERTs to the places we assume a non-null superlayer. + + * platform/graphics/ca/GraphicsLayerCA.cpp: + (WebCore::GraphicsLayerCA::ensureStructuralLayer): + (WebCore::GraphicsLayerCA::swapFromOrToTiledLayer): + +2011-01-18 Beth Dakin <bdakin@apple.com> + + Reviewed by Maciej Stachowiak. + + Fix for <rdar://problem/8882916> Overlay scrollers require + content to layout underneath the scrollbar area + + The render tree should not include scrollbar size for + overlay scrollers. This patch will allow scrollers on + the WebView to behave like overflow:overlay. + + Treat overlay scrollers the same way as the !includeScrollbars + case. + * platform/ScrollView.cpp: + (WebCore::ScrollView::visibleContentRect): + + No corner rect for overlay scrollers. + (WebCore::ScrollView::scrollCornerRect): + + usesOverlayScrollbars() currently always returns no. + * platform/ScrollbarTheme.h: + (WebCore::ScrollbarTheme::usesOverlayScrollbars): + * platform/mac/ScrollbarThemeMac.h: + * platform/mac/ScrollbarThemeMac.mm: + (WebCore::ScrollbarThemeMac::usesOverlayScrollbars): + + includeVerticalScrollbarSize() and includeHorizontalScrollbarSize() + should return false for overlay scrollers. They already return + false for overflow:overlay. + * rendering/RenderBox.cpp: + (WebCore::RenderBox::includeVerticalScrollbarSize): + (WebCore::RenderBox::includeHorizontalScrollbarSize): + * rendering/RenderBox.h: + + In the render tree, always treat overlay scrollers like + they have a width and height of 0. + * rendering/RenderLayer.cpp: + (WebCore::RenderLayer::verticalScrollbarWidth): + (WebCore::RenderLayer::horizontalScrollbarHeight): + * rendering/RenderListBox.cpp: + (WebCore::RenderListBox::verticalScrollbarWidth): + +2011-01-18 Evan Martin <evan@chromium.org> + + Reviewed by Tony Chang. + + [chromium] simplify complex text code, fixing a handful of layout tests + https://bugs.webkit.org/show_bug.cgi?id=52661 + + Change ComplexTextControllerLinux to lay out RTL text to the left from + the starting point. (Previously it always went to the right.) This allows + us to map pixel offsets more directly into offsets within the text runs, + simplifying a few of the text-fiddling functions (they no longer need to + track the current position, as ComplexTextController now does it). + + * platform/graphics/chromium/ComplexTextControllerLinux.cpp: + (WebCore::ComplexTextController::ComplexTextController): + (WebCore::ComplexTextController::reset): + (WebCore::ComplexTextController::setGlyphXPositions): + * platform/graphics/chromium/ComplexTextControllerLinux.h: + (WebCore::ComplexTextController::offsetX): + * platform/graphics/chromium/FontLinux.cpp: + (WebCore::Font::drawComplexText): + (WebCore::Font::floatWidthForComplexText): + (WebCore::glyphIndexForXPositionInScriptRun): + (WebCore::Font::offsetForPositionForComplexText): + (WebCore::Font::selectionRectForComplexText): + +2011-01-19 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Yury Semikhatsky. + + Web Inspector: move methods from InjectedScript domain into DOM, + Runtime and Debugger domains. Introduce InspectorRuntimeAgent. + https://bugs.webkit.org/show_bug.cgi?id=52717 + + * CMakeLists.txt: + * GNUmakefile.am: + * WebCore.gypi: + * WebCore.pro: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * inspector/CodeGeneratorInspector.pm: + * inspector/InjectedScript.cpp: + (WebCore::InjectedScript::evaluateOnCallFrame): + (WebCore::InjectedScript::getCompletions): + (WebCore::InjectedScript::getCompletionsOnCallFrame): + * inspector/InjectedScript.h: + * inspector/InjectedScriptHost.cpp: + (WebCore::InjectedScriptHost::injectedScriptForMainWorld): + * inspector/InjectedScriptHost.h: + * inspector/InjectedScriptSource.js: + (.): + (): + * inspector/Inspector.idl: + * inspector/InspectorController.cpp: + (WebCore::InspectorController::connectFrontend): + (WebCore::InspectorController::releaseFrontendLifetimeAgents): + * inspector/InspectorController.h: + * inspector/InspectorDOMAgent.cpp: + (WebCore::InspectorDOMAgent::InspectorDOMAgent): + (WebCore::InspectorDOMAgent::resolveNode): + (WebCore::InspectorDOMAgent::getNodeProperties): + (WebCore::InspectorDOMAgent::getNodePrototypes): + (WebCore::InspectorDOMAgent::injectedScriptForNodeId): + * inspector/InspectorDOMAgent.h: + (WebCore::EventListenerInfo::EventListenerInfo): + (WebCore::InspectorDOMAgent::DOMListener::~DOMListener): + (WebCore::InspectorDOMAgent::create): + (WebCore::InspectorDOMAgent::cast): + (WebCore::InspectorDOMAgent::documents): + * inspector/InspectorDebuggerAgent.cpp: + (WebCore::InspectorDebuggerAgent::evaluateOnCallFrame): + (WebCore::InspectorDebuggerAgent::getCompletionsOnCallFrame): + (WebCore::InspectorDebuggerAgent::injectedScriptForCallFrameId): + * inspector/InspectorDebuggerAgent.h: + * inspector/InspectorRuntimeAgent.cpp: Added. + (WebCore::InspectorRuntimeAgent::InspectorRuntimeAgent): + (WebCore::InspectorRuntimeAgent::~InspectorRuntimeAgent): + (WebCore::InspectorRuntimeAgent::evaluate): + (WebCore::InspectorRuntimeAgent::getCompletions): + (WebCore::InspectorRuntimeAgent::getProperties): + (WebCore::InspectorRuntimeAgent::setPropertyValue): + (WebCore::InspectorRuntimeAgent::pushNodeToFrontend): + (WebCore::InspectorRuntimeAgent::injectedScriptForObjectId): + * inspector/InspectorRuntimeAgent.h: Copied from Source/WebCore/inspector/InjectedScript.h. + (WebCore::InspectorRuntimeAgent::create): + * inspector/front-end/ConsoleView.js: + (WebInspector.ConsoleView.prototype.completions): + * inspector/front-end/ScriptsPanel.js: + (WebInspector.ScriptsPanel.prototype.doEvalInCallFrame): + +2011-01-18 Pavel Podivilov <podivilov@chromium.org> + + Reviewed by Yury Semikhatsky. + + Web Inspector: add UglifyJS parser and formatter files + https://bugs.webkit.org/show_bug.cgi?id=51702 + + * WebCore.gypi: + * WebCore.vcproj/WebCore.vcproj: + * inspector/front-end/ScriptFormatter.js: + (WebInspector.ScriptFormatter.positionToLocation): + (WebInspector.ScriptFormatter.prototype.format.messageHandler): + (WebInspector.ScriptFormatter.prototype.format): + (WebInspector.ScriptFormatter.prototype._buildMapping): + (WebInspector.ScriptFormatter.prototype._convertPosition): + * inspector/front-end/SourceFrame.js: + (WebInspector.SourceFrame.prototype.formatSource.didFormat): + (WebInspector.SourceFrame.prototype.formatSource): + * inspector/front-end/WebKit.qrc: + * inspector/front-end/parse-js.js: Added. UglifyJS parser. + * inspector/front-end/process.js: Added. UglifyJS formatter. + * inspector/front-end/scriptFormatterWorker.js: Added. Worker script that wraps UglifyJS code. + (onmessage): + (beautify): + (loadModule): + (require): + * inspector/front-end/utilities.js: + (): + +2011-01-19 Pavel Podivilov <podivilov@chromium.org> + + Reviewed by Yury Semikhatsky. + + Web Inspector: [JSC] scripts have incorrect starting line (always 1). + https://bugs.webkit.org/show_bug.cgi?id=52721 + + Test: inspector/debugger-scripts.html + + * bindings/js/ScriptDebugServer.cpp: + (WebCore::ScriptDebugServer::dispatchDidParseSource): + (WebCore::ScriptDebugServer::dispatchFailedToParseSource): + (WebCore::ScriptDebugServer::sourceParsed): + * bindings/js/ScriptDebugServer.h: + * bindings/js/ScriptSourceCode.h: + (WebCore::ScriptSourceCode::ScriptSourceCode): + * bindings/js/StringSourceProvider.h: + (WebCore::StringSourceProvider::create): + (WebCore::StringSourceProvider::startPosition): + (WebCore::StringSourceProvider::StringSourceProvider): + +2011-01-19 Satish Sampath <satish@chromium.org> + + Reviewed by Jeremy Orlow. + + Send origin/url as part of speech input requests to the embedder. + https://bugs.webkit.org/show_bug.cgi?id=52718 + + * page/SpeechInput.cpp: + (WebCore::SpeechInput::startRecognition): Pass up additional origin parameter. + * page/SpeechInput.h: + * page/SpeechInputClient.h: + * platform/mock/SpeechInputClientMock.cpp: + (WebCore::SpeechInputClientMock::startRecognition): Updated prototype. + * platform/mock/SpeechInputClientMock.h: + * rendering/TextControlInnerElements.cpp: + (WebCore::InputFieldSpeechButtonElement::defaultEventHandler): Pass the frame origin to speech input request. + +2011-01-19 Hans Wennborg <hans@chromium.org> + + Reviewed by Jeremy Orlow. + + IndexedDB: Support auto-increment keys + https://bugs.webkit.org/show_bug.cgi?id=52576 + + Add support for auto-increment keys. + + Test: storage/indexeddb/objectstore-autoincrement.html + + * storage/IDBDatabase.cpp: + (WebCore::IDBDatabase::createObjectStore): + * storage/IDBObjectStoreBackendImpl.cpp: + (WebCore::genAutoIncrementKey): + (WebCore::IDBObjectStoreBackendImpl::putInternal): + +2011-01-19 Csaba Osztrogonác <ossy@webkit.org> + + Reviewed by Laszlo Gombos and Tor Arne Vestbø. + + [Qt] Remove unnecessary "../Source" from paths + after moving source files into Source is finished. + + * WebCore.pri: + * WebCore.pro: + +2011-01-19 Alexander Pavlov <apavlov@chromium.org> + + Reviewed by Pavel Feldman. + + Web Inspector: Employ TextPrompt for CSS property name/value autocompletion + https://bugs.webkit.org/show_bug.cgi?id=52212 + + WebInspector.CSSKeywordCompletions contains a hand-written list of accepted CSS property value keywords + for each property. WebInspector.TextPrompt is used to suggest both the name and value keywords while + editing styles, in place of the old custom suggestion code. + + * inspector/front-end/CSSCompletions.js: + (WebInspector.CSSCompletions.prototype.startsWith): Fix array-out-of-bounds error. + * inspector/front-end/CSSKeywordCompletions.js: Added. + (WebInspector.CSSKeywordCompletions.forProperty): + * inspector/front-end/StylesSidebarPane.js: + (WebInspector.StylePropertyTreeElement.prototype.updateTitle): + (WebInspector.StylePropertyTreeElement.prototype): + (): + * inspector/front-end/TextPrompt.js: + (WebInspector.TextPrompt): + (WebInspector.TextPrompt.prototype.removeFromElement): + (WebInspector.TextPrompt.prototype._onKeyDown): + (WebInspector.TextPrompt.prototype.tabKeyPressed): + (WebInspector.TextPrompt.prototype.upKeyPressed): + (WebInspector.TextPrompt.prototype.downKeyPressed): + (WebInspector.TextPrompt.prototype._moveBackInHistory): + (WebInspector.TextPrompt.prototype._moveForwardInHistory): + * inspector/front-end/inspector.css: + (.auto-complete-text, .editing .auto-complete-text): + * inspector/front-end/inspector.html: + +2011-01-19 Dai Mikurube <dmikurube@google.com> + + Reviewed by Kent Tamura. + + Implement onformchange and onforminput event handlers + https://bugs.webkit.org/show_bug.cgi?id=26141 + + Tests: fast/forms/formchange-event.html + fast/forms/forminput-event.html + + * bindings/scripts/CodeGeneratorGObject.pm: Added event names. + * dom/Document.h: Added event definitions. + * dom/Document.idl: Added event definitions. + * dom/Element.h: Added event definitions. + * dom/Element.idl: Added event definitions. + * dom/Event.cpp: + (WebCore::Event::fromUserGesture): Added a condition for a formchange event in handling user gestures. + * dom/EventNames.h: Added event definitions. + * dom/InputElement.cpp: + (WebCore::InputElement::setValueFromRenderer): Replaced a direct dispatchEvent() call into dispatchInputEvents(), a virtual function which broadcasts forminput events for HTML elements. + * dom/Node.cpp: + (WebCore::Node::dispatchInputEvents): Defined basic dispatchInputEvents() described above. + (WebCore::Node::dispatchChangeEvents): Defined basic dispatchChangeEvents() described above. + (WebCore::Node::defaultEventHandler): Replaced a direct dispatchEvent() call into dispatchInputEvents(). + * dom/Node.h: + * html/FormAssociatedElement.h: Added isResettable() to check the element is resettable or not. + * html/HTMLAttributeNames.in: Added event names. + * html/HTMLElement.cpp: + (WebCore::HTMLElement::parseMappedAttribute): Added event handling. + (WebCore::HTMLElement::shadowAncestorOwnerForm): Added to get an ancestor <form> element from a shadow element. + (WebCore::HTMLElement::dispatchChangeEvents): Defined dispatchChangeEvents() for HTML elements described above. + (WebCore::HTMLElement::dispatchInputEvents): Defined dispatchInputEvents() for HTML elements described above. + * html/HTMLElement.h: + * html/HTMLFormControlElement.cpp: + (WebCore::HTMLFormControlElement::dispatchFormControlChangeEvent): Added calling dispatchFormChange() to broadcast formchange events. + (WebCore::HTMLFormControlElement::dispatchFormControlInputEvent): Defined newly to dispatch an input event with broadcasting forminput events. + * html/HTMLFormControlElement.h: Added isResettable(). + * html/HTMLFormElement.cpp: + (WebCore::HTMLFormElement::broadcastFormEvent): Added to broadcast forminput or formchange events. + (WebCore::HTMLFormElement::dispatchFormInput): Defined newly to broadcast forminput events. + (WebCore::HTMLFormElement::dispatchFormChange): Defined newly to broadcast formchange events. + * html/HTMLFormElement.h: + * html/HTMLFormElement.idl: Added dispatchFormInput() and dispatchFormChange() DOM API definitions. + * html/HTMLInputElement.cpp: + (WebCore::HTMLInputElement::stepUpFromRenderer): Replaced a direct dispatchEvent() call into dispatchInputEvents(). + * html/HTMLInputElement.h: Added isResettable(). + * html/HTMLKeygenElement.h: Added isResettable(). + * html/HTMLObjectElement.h: Added isResettable(). + * html/HTMLOutputElement.h: Added isResettable(). + * html/HTMLSelectElement.h: Added isResettable(). + * html/HTMLTextAreaElement.h: Added isResettable(). + * page/DOMWindow.h: Added event definitions. + * page/DOMWindow.idl: Added event definitions. + * rendering/TextControlInnerElements.cpp: + (WebCore::SearchFieldCancelButtonElement::defaultEventHandler): Replaced a direct dispatchEvent() call into dispatchInputEvents(). + +2011-01-19 Andrey Kosyakov <caseq@chromium.org> + + Reviewed by Pavel Feldman. + + Web Inspector: [Extensions API] delete pending callback from callback map before invoking it + https://bugs.webkit.org/show_bug.cgi?id=52707 + + * inspector/front-end/ExtensionAPI.js: + (WebInspector.injectedExtensionAPI.ExtensionServerClient.prototype._onCallback): + +2011-01-19 Levi Weintraub <leviw@google.com> + + Reviewed by Ryosuke Niwa. + + Replaced rangeCompliantEquivalent with Position::parentAnchoredEquivalent + and simplified the logic a bit. Unfortunately, Tables and some legacy + editing positions still need to be handled specifically. + + remove rangeCompliantEquivalent and replace it with Position methods + https://bugs.webkit.org/show_bug.cgi?id=25057 + + No new tests as this is a refactor that doesn't change behavior. + + * WebCore.exp.in: + * dom/Document.cpp: + (WebCore::Document::caretRangeFromPoint): + * dom/Position.cpp: + (WebCore::Position::parentAnchoredEquivalent): + * dom/Position.h: + * editing/ApplyStyleCommand.cpp: + (WebCore::ApplyStyleCommand::applyBlockStyle): + * editing/CompositeEditCommand.cpp: + (WebCore::CompositeEditCommand::insertNodeAt): + (WebCore::CompositeEditCommand::moveParagraphs): + * editing/DeleteSelectionCommand.cpp: + (WebCore::DeleteSelectionCommand::initializePositionData): + (WebCore::DeleteSelectionCommand::mergeParagraphs): + * editing/Editor.cpp: + (WebCore::Editor::textDirectionForSelection): + (WebCore::Editor::advanceToNextMisspelling): + * editing/InsertLineBreakCommand.cpp: + (WebCore::InsertLineBreakCommand::shouldUseBreakElement): + * editing/InsertParagraphSeparatorCommand.cpp: + (WebCore::InsertParagraphSeparatorCommand::doApply): + * editing/ReplaceSelectionCommand.cpp: + (WebCore::handleStyleSpansBeforeInsertion): + * editing/VisiblePosition.cpp: + (WebCore::makeRange): + (WebCore::setStart): + (WebCore::setEnd): + * editing/VisibleSelection.cpp: + (WebCore::VisibleSelection::firstRange): + (WebCore::VisibleSelection::toNormalizedRange): + (WebCore::makeSearchRange): + * editing/htmlediting.cpp: + (WebCore::indexForVisiblePosition): + * editing/htmlediting.h: + * editing/visible_units.cpp: + (WebCore::previousBoundary): + (WebCore::nextBoundary): + * page/DOMSelection.cpp: + (WebCore::anchorPosition): + (WebCore::focusPosition): + (WebCore::basePosition): + (WebCore::extentPosition): + +2011-01-19 Peter Rybin <peter.rybin@gmail.com> + + Reviewed by Yury Semikhatsky. + + Web Inspector: script column offset is incorrect + https://bugs.webkit.org/show_bug.cgi?id=52580 + + Column is updated in 3 places, 2 less probable places contained error. + Fixed now. + + * platform/text/SegmentedString.cpp: + (WebCore::SegmentedString::advanceSlowCase): + * platform/text/SegmentedString.h: + (WebCore::SegmentedString::advancePastNewline): + +2011-01-18 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Yury Semikhatsky. + + Web Inspector: make InjectedScriptAccess API a part of Web Inspector protocol. + https://bugs.webkit.org/show_bug.cgi?id=52652 + + Calls served by the InjectedScript should be first class protocol + citizens, not dispatched via single protocol message. + + * WebCore.gypi: + * WebCore.vcproj/WebCore.vcproj: + * inspector/CodeGeneratorInspector.pm: + * inspector/InjectedScript.cpp: + (WebCore::InjectedScript::evaluate): + (WebCore::InjectedScript::evaluateInCallFrame): + (WebCore::InjectedScript::evaluateOnSelf): + (WebCore::InjectedScript::getCompletions): + (WebCore::InjectedScript::getProperties): + (WebCore::InjectedScript::pushNodeToFrontend): + (WebCore::InjectedScript::resolveNode): + (WebCore::InjectedScript::getNodeProperties): + (WebCore::InjectedScript::getNodePrototypes): + (WebCore::InjectedScript::setPropertyValue): + (WebCore::InjectedScript::makeCall): + * inspector/InjectedScript.h: + * inspector/InjectedScriptHost.cpp: + (WebCore::InjectedScriptHost::evaluate): + (WebCore::InjectedScriptHost::evaluateInCallFrame): + (WebCore::InjectedScriptHost::evaluateOnSelf): + (WebCore::InjectedScriptHost::getCompletions): + (WebCore::InjectedScriptHost::getProperties): + (WebCore::InjectedScriptHost::pushNodeToFrontend): + (WebCore::InjectedScriptHost::resolveNode): + (WebCore::InjectedScriptHost::getNodeProperties): + (WebCore::InjectedScriptHost::getNodePrototypes): + (WebCore::InjectedScriptHost::setPropertyValue): + (WebCore::InjectedScriptHost::injectedScriptForObjectId): + (WebCore::InjectedScriptHost::injectedScriptForNodeId): + (WebCore::InjectedScriptHost::injectedScriptForMainWorld): + * inspector/InjectedScriptHost.h: + * inspector/InjectedScriptSource.js: + (.): + * inspector/Inspector.idl: + * inspector/InspectorController.cpp: + * inspector/InspectorController.h: + * inspector/InspectorValues.cpp: + (WebCore::InspectorObject::getNumber): + * inspector/InspectorValues.h: + * inspector/front-end/AuditRules.js: + (WebInspector.AuditRules.evaluateInTargetWindow): + * inspector/front-end/ConsoleView.js: + (WebInspector.ConsoleView.prototype.completions): + (WebInspector.ConsoleView.prototype.doEvalInWindow): + * inspector/front-end/ElementsTreeOutline.js: + (WebInspector.ElementsTreeElement.prototype._createTooltipForNode): + * inspector/front-end/ExtensionPanel.js: + (WebInspector.ExtensionWatchSidebarPane.prototype.setExpression): + * inspector/front-end/ExtensionServer.js: + (WebInspector.ExtensionServer.prototype._onEvaluateOnInspectedPage): + * inspector/front-end/InjectedScriptAccess.js: Removed. + * inspector/front-end/PropertiesSidebarPane.js: + (WebInspector.PropertiesSidebarPane.prototype.update.callback): + (WebInspector.PropertiesSidebarPane.prototype.update): + * inspector/front-end/RemoteObject.js: + (WebInspector.RemoteObject.resolveNode): + (WebInspector.RemoteObject.prototype.getProperties): + (WebInspector.RemoteObject.prototype.setPropertyValue): + (WebInspector.RemoteObject.prototype.pushNodeToFrontend): + * inspector/front-end/ScriptsPanel.js: + (WebInspector.ScriptsPanel.prototype.doEvalInCallFrame): + * inspector/front-end/WebKit.qrc: + * inspector/front-end/inspector.html: + +2011-01-18 Anton Muhin <antonm@chromium.org> + + Reviewed by Adam Barth. + + [v8] Minor cleanup: make 2nd argument of removeIfPresnt accept only a value type stored in the DOM map + https://bugs.webkit.org/show_bug.cgi?id=51683 + + Covered by the existing tests. + + * bindings/v8/DOMDataStore.cpp: + (WebCore::DOMDataStore::weakNodeCallback): + (WebCore::DOMDataStore::IntrusiveDOMWrapperMap::removeIfPresent): + * bindings/v8/DOMDataStore.h: + * bindings/v8/V8DOMMap.h: + (WebCore::WeakReferenceMap::removeIfPresent): + +2011-01-18 MORITA Hajime <morrita@google.com> + + Reviewed by Ryosuke Niwa. + + Refactoring: EventHandler::handleTextInputEvent should accept an enum instead of bools. + https://bugs.webkit.org/show_bug.cgi?id=52608 + + No new tests. no behavioral change. + + * GNUmakefile.am: + * WebCore.gypi: + * WebCore.pro: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * dom/TextEvent.cpp: + (WebCore::TextEvent::create): + (WebCore::TextEvent::createForDrop): + (WebCore::TextEvent::TextEvent): + * dom/TextEvent.h: + (WebCore::TextEvent::isLineBreak): + (WebCore::TextEvent::isBackTab): + (WebCore::TextEvent::isPaste): + (WebCore::TextEvent::isDrop): + * dom/TextEventInputType.h: Added. Extracted from TextEvent::TextInputType. + * editing/EditorCommand.cpp: + (WebCore::executeInsertBacktab): + (WebCore::executeInsertLineBreak): + (WebCore::executeInsertNewline): + (WebCore::executeInsertTab): + * page/EventHandler.cpp: + (WebCore::EventHandler::handleTextInputEvent): + * page/EventHandler.h: + +2011-01-18 Ben Vanik <ben.vanik@gmail.com> + + Reviewed by Kenneth Russell. + + Updating ANGLE in WebKit to r533. + https://bugs.webkit.org/show_bug.cgi?id=47194 + + * platform/graphics/ANGLEWebKitBridge.cpp: + (WebCore::ANGLEWebKitBridge::ANGLEWebKitBridge): + (WebCore::ANGLEWebKitBridge::~ANGLEWebKitBridge): + (WebCore::ANGLEWebKitBridge::validateShaderSource): + Update to new ANGLE API for shader validation. + * platform/graphics/ANGLEWebKitBridge.h: + (WebCore::ANGLEWebKitBridge::setResources): + Renaming types to new names. + * platform/graphics/mac/GraphicsContext3DMac.mm: + (WebCore::GraphicsContext3D::GraphicsContext3D): + Initialize ANGLEResources with ANGLE init call to prevent uninitialized variables. + +2011-01-18 MORITA Hajime <morrita@google.com> + + Reviewed by Simon Fraser. + + Refactoring: Extract RoundedIntRect class + https://bugs.webkit.org/show_bug.cgi?id=51664 + + RoundedIntRect is a pair of rect and four IntSize objects which represent + corner radii of the rectangle. IntSize is grouped into RoundedIntRect::Radii. + Now RenderStyle::getRoundedBorderFor() and RenderStyle::getRoundedInnerBorderWithBorderWidths() + return RoundedIntRect and GraphicsContext::addRoundedRectClip(), GraphicsContext::fillRoundedRect() + and other functions accept RoundedIntRect as an argument. + + * Android.mk: + * CMakeLists.txt: + * GNUmakefile.am: + * WebCore.gypi: + * WebCore.pro: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * platform/graphics/GraphicsContext.cpp: + (WebCore::GraphicsContext::addRoundedRectClip): + (WebCore::GraphicsContext::clipOutRoundedRect): + (WebCore::GraphicsContext::fillRoundedRect): + * platform/graphics/GraphicsContext.h: + * platform/graphics/RoundedIntRect.cpp: Added. + (WebCore::RoundedIntRect::Radii::isZero): + (WebCore::RoundedIntRect::Radii::scale): + (WebCore::RoundedIntRect::Radii::expand): + (WebCore::RoundedIntRect::Radii::includeLogicalEdges): + (WebCore::RoundedIntRect::Radii::excludeLogicalEdges): + (WebCore::RoundedIntRect::RoundedIntRect): + (WebCore::RoundedIntRect::includeLogicalEdges): + (WebCore::RoundedIntRect::excludeLogicalEdges): + * platform/graphics/RoundedIntRect.h: Added. + (WebCore::RoundedIntRect::Radii::Radii): + (WebCore::RoundedIntRect::Radii::setTopLeft): + (WebCore::RoundedIntRect::Radii::setTopRight): + (WebCore::RoundedIntRect::Radii::setBottomLeft): + (WebCore::RoundedIntRect::Radii::setBottomRight): + (WebCore::RoundedIntRect::Radii::topLeft): + (WebCore::RoundedIntRect::Radii::topRight): + (WebCore::RoundedIntRect::Radii::bottomLeft): + (WebCore::RoundedIntRect::Radii::bottomRight): + (WebCore::RoundedIntRect::Radii::expand): + (WebCore::RoundedIntRect::Radii::shrink): + (WebCore::RoundedIntRect::rect): + (WebCore::RoundedIntRect::radii): + (WebCore::RoundedIntRect::isRounded): + (WebCore::RoundedIntRect::isEmpty): + (WebCore::RoundedIntRect::setRect): + (WebCore::RoundedIntRect::setRadii): + (WebCore::RoundedIntRect::move): + (WebCore::RoundedIntRect::inflate): + (WebCore::RoundedIntRect::inflateWithRadii): + (WebCore::RoundedIntRect::expandRadii): + (WebCore::RoundedIntRect::shrinkRadii): + * rendering/RenderBox.cpp: + (WebCore::RenderBox::pushContentsClip): + * rendering/RenderBoxModelObject.cpp: + (WebCore::RenderBoxModelObject::paintFillLayerExtended): + (WebCore::RenderBoxModelObject::paintBorder): + (WebCore::RenderBoxModelObject::clipBorderSidePolygon): + (WebCore::RenderBoxModelObject::paintBoxShadow): + * rendering/RenderBoxModelObject.h: + * rendering/RenderObject.cpp: + (WebCore::RenderObject::drawBoxSideFromPath): + * rendering/RenderReplaced.cpp: + (WebCore::RenderReplaced::paint): + * rendering/RenderThemeChromiumWin.cpp: + (WebCore::RenderThemeChromiumWin::paintTextFieldInternal): + * rendering/RenderThemeMac.mm: + (WebCore::RenderThemeMac::paintMenuListButtonGradients): + (WebCore::RenderThemeMac::paintSliderTrack): + * rendering/RenderThemeSafari.cpp: + (WebCore::RenderThemeSafari::paintMenuListButtonGradients): + (WebCore::RenderThemeSafari::paintSliderTrack): + * rendering/RenderThemeWinCE.cpp: + (WebCore::RenderThemeWinCE::paintSearchFieldCancelButton): + * rendering/RenderWidget.cpp: + (WebCore::RenderWidget::paint): + * rendering/style/BorderData.h: + * rendering/style/RenderStyle.cpp: + (WebCore::calcRadiiFor): + (WebCore::calcConstraintScaleFor): + (WebCore::RenderStyle::getRoundedBorderFor): + (WebCore::RenderStyle::getRoundedInnerBorderWithBorderWidths): + * rendering/style/RenderStyle.h: + (WebCore::InheritedFlags::setBorderRadius): + +2011-01-18 MORITA Hajime <morrita@google.com> + + Reviewed by Simon Fraser. + + Refactoring: Extract RoundedIntRect class + https://bugs.webkit.org/show_bug.cgi?id=51664 + + RoundedIntRect is a pair of rect and four IntSize objects which represent + corner radii of the rectangle. IntSize is grouped into RoundedIntRect::Radii. + Now RenderStyle::getRoundedBorderFor() and RenderStyle::getRoundedInnerBorderWithBorderWidths() + return RoundedIntRect and GraphicsContext::addRoundedRectClip(), GraphicsContext::fillRoundedRect() + and other functions accept RoundedIntRect as an argument. + + No new tests. No behavioral change. + + * Android.mk: + * CMakeLists.txt: + * WebCore.gypi: + * WebCore.pro: + * WebCore.xcodeproj/project.pbxproj: + * platform/graphics/GraphicsContext.cpp: + (WebCore::GraphicsContext::addRoundedRectClip): + (WebCore::GraphicsContext::clipOutRoundedRect): + (WebCore::GraphicsContext::fillRoundedRect): + * platform/graphics/GraphicsContext.h: + * platform/graphics/RoundedIntRect.cpp: Added. + (WebCore::RoundedIntRect::Radii::isZero): + (WebCore::RoundedIntRect::Radii::scale): + (WebCore::RoundedIntRect::Radii::expand): + (WebCore::RoundedIntRect::Radii::includeLogicalEdges): + (WebCore::RoundedIntRect::Radii::excludeLogicalEdges): + (WebCore::RoundedIntRect::RoundedIntRect): + (WebCore::RoundedIntRect::includeLogicalEdges): + (WebCore::RoundedIntRect::excludeLogicalEdges): + * platform/graphics/RoundedIntRect.h: Added. + (WebCore::RoundedIntRect::Radii::Radii): + (WebCore::RoundedIntRect::Radii::setTopLeft): + (WebCore::RoundedIntRect::Radii::setTopRight): + (WebCore::RoundedIntRect::Radii::setBottomLeft): + (WebCore::RoundedIntRect::Radii::setBottomRight): + (WebCore::RoundedIntRect::Radii::topLeft): + (WebCore::RoundedIntRect::Radii::topRight): + (WebCore::RoundedIntRect::Radii::bottomLeft): + (WebCore::RoundedIntRect::Radii::bottomRight): + (WebCore::RoundedIntRect::Radii::expand): + (WebCore::RoundedIntRect::Radii::shrink): + (WebCore::RoundedIntRect::rect): + (WebCore::RoundedIntRect::radii): + (WebCore::RoundedIntRect::isRounded): + (WebCore::RoundedIntRect::isEmpty): + (WebCore::RoundedIntRect::setRect): + (WebCore::RoundedIntRect::setRadii): + (WebCore::RoundedIntRect::move): + (WebCore::RoundedIntRect::inflate): + (WebCore::RoundedIntRect::inflateWithRadii): + (WebCore::RoundedIntRect::expandRadii): + (WebCore::RoundedIntRect::shrinkRadii): + * rendering/RenderBox.cpp: + (WebCore::RenderBox::pushContentsClip): + * rendering/RenderBoxModelObject.cpp: + (WebCore::RenderBoxModelObject::paintFillLayerExtended): + (WebCore::RenderBoxModelObject::paintBorder): + (WebCore::RenderBoxModelObject::clipBorderSidePolygon): + (WebCore::RenderBoxModelObject::paintBoxShadow): + * rendering/RenderBoxModelObject.h: + * rendering/RenderObject.cpp: + (WebCore::RenderObject::drawBoxSideFromPath): + * rendering/RenderReplaced.cpp: + (WebCore::RenderReplaced::paint): + * rendering/RenderThemeChromiumWin.cpp: + (WebCore::RenderThemeChromiumWin::paintTextFieldInternal): + * rendering/RenderThemeMac.mm: + (WebCore::RenderThemeMac::paintMenuListButtonGradients): + (WebCore::RenderThemeMac::paintSliderTrack): + * rendering/RenderThemeSafari.cpp: + (WebCore::RenderThemeSafari::paintMenuListButtonGradients): + (WebCore::RenderThemeSafari::paintSliderTrack): + * rendering/RenderThemeWinCE.cpp: + (WebCore::RenderThemeWinCE::paintSearchFieldCancelButton): + * rendering/RenderWidget.cpp: + (WebCore::RenderWidget::paint): + * rendering/style/BorderData.h: + * rendering/style/RenderStyle.cpp: + (WebCore::calcRadiiFor): + (WebCore::calcConstraintScaleFor): + (WebCore::RenderStyle::getRoundedBorderFor): + (WebCore::RenderStyle::getRoundedInnerBorderWithBorderWidths): + * rendering/style/RenderStyle.h: + (WebCore::InheritedFlags::setBorderRadius): + +2011-01-18 Victoria Kirst <vrk@chromium.org> + + Reviewed by Kenneth Russell. + + [chromium] Adding support for YV16 video frame formats. + https://bugs.webkit.org/show_bug.cgi?id=52345 + + * platform/graphics/chromium/VideoLayerChromium.cpp: + (WebCore::VideoLayerChromium::determineTextureFormat): + (WebCore::VideoLayerChromium::draw): + +2011-01-18 David Hyatt <hyatt@apple.com> + + Reviewed by Dan Bernstein. + + <rdar://problem/8479998> REGRESSION (r67660): broken button layout at devforums.apple.com + + Exclude floating objects from shrinking to avoid floats. They should never do this. Timing-related bugs could + occur as a result of this mistake, and the change to rewrite pagination to defer layout of floats until they + got encountered on the correct line exposed this issue. + + Added /fast/block/float/float-overflow-hidden-containing-block-width.html. + + * rendering/RenderBox.cpp: + (WebCore::RenderBox::shrinkToAvoidFloats): + +2011-01-18 Zhenyao Mo <zmo@google.com> + + Reviewed by Kenneth Russell. + + Make CheckedInt<long> and CheckedInt<unsigned long> work + https://bugs.webkit.org/show_bug.cgi?id=52401 + + * html/canvas/CheckedInt.h: + (WebCore::CheckedInt::CheckedInt): Merge with the patch provided by Benoit Jacob. + * html/canvas/WebGLBuffer.cpp: + (WebCore::WebGLBuffer::associateBufferDataImpl): Use CheckedInt<long> instead of CheckedInt<int>. + (WebCore::WebGLBuffer::associateBufferSubDataImpl): Ditto. + +2011-01-18 Kenneth Russell <kbr@google.com> + + Reviewed by David Levin. + + Must strip comments from WebGL shaders before enforcing character set + https://bugs.webkit.org/show_bug.cgi?id=52390 + + Strip comments from incoming shaders, preserving line numbers, + before validating that they conform to the ESSL character set. + Revert changes from http://trac.webkit.org/changeset/75735 which + allowed invalid characters to be passed to certain APIs. + + Tested with WebGL layout tests, conformance test suite and several + WebGL demos in both Safari and Chromium. + + * html/canvas/WebGLRenderingContext.cpp: + (WebCore::StripComments::StripComments::process): + (WebCore::WebGLRenderingContext::shaderSource): + +2011-01-18 Ryosuke Niwa <rniwa@webkit.org> + + Reviewed by Eric Seidel. + + Stop instantiating legacy editing positions in DeleteSelectionCommand, IndentOudentCommand, + InsertLineBreakCommand, InsertListCOmmand.cpp, InsertParagraphSeparatorCommand, and htmlediting.cpp + https://bugs.webkit.org/show_bug.cgi?id=52644 + + This is a cleanup to stop instantiating legacy editing positions in the following tests. + firstDeepEditingPositionForNode and lastDeepEditingPositionForNode in htmlediting.h are not updated + because doing so requires significant code changes. They are tracked on the bug 52642. + + * editing/DeleteSelectionCommand.cpp: + (WebCore::DeleteSelectionCommand::initializeStartEnd): + (WebCore::updatePositionForNodeRemoval): + (WebCore::DeleteSelectionCommand::removeNode): + (WebCore::updatePositionForTextRemoval): + (WebCore::DeleteSelectionCommand::handleGeneralDelete): + * editing/IndentOutdentCommand.cpp: + (WebCore::IndentOutdentCommand::outdentParagraph): + * editing/InsertLineBreakCommand.cpp: + (WebCore::InsertLineBreakCommand::doApply): + * editing/InsertListCommand.cpp: + (WebCore::InsertListCommand::doApplyForSingleParagraph): + (WebCore::InsertListCommand::unlistifyParagraph): + (WebCore::InsertListCommand::listifyParagraph): + * editing/InsertParagraphSeparatorCommand.cpp: + (WebCore::InsertParagraphSeparatorCommand::doApply): + * editing/htmlediting.cpp: + (WebCore::enclosingBlock): + (WebCore::enclosingList): + (WebCore::enclosingListChild): + (WebCore::indexForVisiblePosition): + (WebCore::isNodeVisiblyContainedWithin): + (WebCore::avoidIntersectionWithNode): + +2011-01-18 Benjamin Kalman <kalman@chromium.org> + + Reviewed by Ryosuke Niwa. + + Tweak style in visible_units.cpp and TextIterator.cpp in preparation for another patch + https://bugs.webkit.org/show_bug.cgi?id=52610 + + This is a purely aesthetic change. + + * editing/TextIterator.cpp: + (WebCore::SimplifiedBackwardsTextIterator::advance): + * editing/visible_units.cpp: + (WebCore::previousBoundary): + +2011-01-18 Adam Klein <adamk@chromium.org> + + Reviewed by Darin Fisher. + + [Chromium] Replace ChromiumBridge::widgetSetCursor with ChromeClient::setCursor + https://bugs.webkit.org/show_bug.cgi?id=42236 + + * platform/chromium/ChromiumBridge.h: + * platform/chromium/WidgetChromium.cpp: + (WebCore::Widget::setCursor): + +2011-01-18 Chris Fleizach <cfleizach@apple.com> + + Reviewed by Darin Adler. + + REGRESSION: A problem with Voiceover and finding links + https://bugs.webkit.org/show_bug.cgi?id=52324 + + Fallout from recent change to make WebCore return its own scroll view. + 1) There were two scroll views in the hierarchy, one which no needed to be ignored. + 2) Hit tests for sub frames needed to be offset. + 3) The check for whether an attachment is ignored must happen earlier than using + the helpText to determine if an element should be ignored. + + Test: platform/mac/accessibility/iframe-with-title-correct-hierarchy.html + + * accessibility/AccessibilityObject.cpp: + (WebCore::AccessibilityObject::elementAccessibilityHitTest): + * accessibility/AccessibilityRenderObject.cpp: + (WebCore::AccessibilityRenderObject::accessibilityIsIgnored): + * accessibility/mac/AccessibilityObjectWrapper.mm: + (-[AccessibilityObjectWrapper scrollViewParent]): + +2011-01-18 Adam Roben <aroben@apple.com> + + Call alternate CFHTTPCookie functions if available + + Fixes <http://webkit.org/b/52637> <rdar://problem/8878984>. + + Reviewed by Darin Adler. + + * platform/network/cf/CookieJarCFNet.cpp: Added soft-linking macros to + pull in the alternate CFHTTPCookie functions. + + (WebCore::cookieDomain): + (WebCore::cookieExpirationTime): + (WebCore::cookieName): + (WebCore::cookiePath): + (WebCore::cookieValue): + Added these wrappers around the CFHTTPCookie functions. We call the + alternate functions if they exist, otherwise fall back to the current + functions. + + (WebCore::filterCookies): + (WebCore::getRawCookies): + (WebCore::deleteCookie): + Changed to use the wrapper functions. + +2011-01-18 Martin Robinson <mrobinson@igalia.com> + + Reviewed by Eric Seidel. + + [GTK] Filenames are converted to URLs during edit drags + https://bugs.webkit.org/show_bug.cgi?id=52096 + + * platform/gtk/DragDataGtk.cpp: Only advertise and deliver filenames as URLs if the + conversion policy allows it. + (WebCore::DragData::containsURL): Ditto. + (WebCore::DragData::asURL): Ditto. + +2011-01-18 Helder Correia <helder@sencha.com> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Incorrect shadow alpha with semi-transparent solid fillStyle + https://bugs.webkit.org/show_bug.cgi?id=52611 + + This is related to bug 52559. The shadow color alpha must be multiplied + by the context brush alpha. + + Test: fast/canvas/canvas-fillPath-alpha-shadow.html + + * platform/graphics/qt/GraphicsContextQt.cpp: + (WebCore::GraphicsContext::fillPath): + +2011-01-18 Andrey Kosyakov <caseq@chromium.org> + + Reviewed by Yury Semikhatsky. + + Web Inspector: fail resource.requestContent() immediately for WebSocket resources + https://bugs.webkit.org/show_bug.cgi?id=52628 + + * English.lproj/localizedStrings.js: Rename WebSocket -> WebSockets in resource catetegories (rest are in plural, too) + * inspector/front-end/ExtensionServer.js: Do not expose webInspector.resources.Types in extensions API (obsolete) + (WebInspector.ExtensionServer.prototype._buildExtensionAPIInjectedScript): + * inspector/front-end/Resource.js: + (WebInspector.Resource.Type.toUIString): Remove ResourceType.Media as it's not used. + (WebInspector.Resource.Type.toString): ditto. + (WebInspector.Resource.prototype.requestContent): Fail immediately for WebSocket resources. + * inspector/front-end/inspector.js: Rename WebSocket -> WebSockets in resource catetegories (rest are in plural, too) + +2011-01-18 Helder Correia <helder@sencha.com> + + Reviewed by Dirk Schulze. + + REGRESSION(75139): SVG gradients are not applied to texts + https://bugs.webkit.org/show_bug.cgi?id=52531 + + r75139 caused a problem with filling and stroking text with a gradient + fill in SVG. The order of CGContextConcatCTM and CGContextClipToRect + was mixed up. + + Test: svg/css/text-gradient-shadow.svg + + * platform/graphics/cg/GraphicsContextCG.cpp: + (WebCore::GraphicsContext::fillRect): + +2011-01-18 Leo Yang <leo.yang@torchmobile.com.cn> + + Reviewed by Nikolas Zimmermann. + + Unable to indirectly animate visibility of SVGUseElement + https://bugs.webkit.org/show_bug.cgi?id=50240 + + SVGUseElement::recalcStyle should take care of its shadow + tree's style recalculation when it is called with change >= Inherit + or when childNeedsStyleRecalc() is true because in these two + cases needStyleRecalc() may not be true. + + Test: svg/custom/use-inherit-style.svg + + * svg/SVGUseElement.cpp: + (WebCore::SVGUseElement::recalcStyle): + +2011-01-18 Pavel Podivilov <podivilov@chromium.org> + + Reviewed by Yury Semikhatsky. + + Web Inspector: provide script length to frontend. + https://bugs.webkit.org/show_bug.cgi?id=52620 + + * inspector/Inspector.idl: + * inspector/InspectorDebuggerAgent.cpp: + (WebCore::InspectorDebuggerAgent::didParseSource): + * inspector/front-end/DebuggerModel.js: + (WebInspector.DebuggerModel.prototype._parsedScriptSource): + (WebInspector.DebuggerDispatcher.prototype.parsedScriptSource): + * inspector/front-end/Script.js: + (WebInspector.Script): + +2011-01-18 Zoltan Herczeg <zherczeg@webkit.org> + + Rubber-stamped by Csaba Osztrogonác + + Fixing ChangeLog + + Removing a line introduced by + http://trac.webkit.org/changeset/75743/trunk/Source/WebCore/ChangeLog + Removing an unnecessary space before a time stamp. + +2011-01-17 Andrey Kosyakov <caseq@chromium.org> + + Reviewed by Yury Semikhatsky. + + Web Inspector: [refactoring] use events to notify NetworkManager clients + https://bugs.webkit.org/show_bug.cgi?id=52588 + + * inspector/front-end/AuditLauncherView.js: + (WebInspector.AuditLauncherView): Do not expose public interface to resource count. Do not reset resource count upon reset(). + (WebInspector.AuditLauncherView.prototype._resetResourceCount): + (WebInspector.AuditLauncherView.prototype._onResourceStarted): + (WebInspector.AuditLauncherView.prototype._onResourceFinished): + * inspector/front-end/AuditsPanel.js: Do not expose public interface to resource start/finish events. + * inspector/front-end/ExtensionServer.js: + (WebInspector.ExtensionServer): + (WebInspector.ExtensionServer.prototype._notifyResourceFinished): + (WebInspector.ExtensionServer.prototype.initExtensions): + * inspector/front-end/NetworkManager.js: Dispatch events rather than directly call clients. + (WebInspector.NetworkManager): + (WebInspector.NetworkManager.prototype.willSendRequest): + (WebInspector.NetworkManager.prototype.markResourceAsCached): + (WebInspector.NetworkManager.prototype.didReceiveResponse): + (WebInspector.NetworkManager.prototype.didReceiveContentLength): + (WebInspector.NetworkManager.prototype.setInitialContent): + (WebInspector.NetworkManager.prototype.didCommitLoadForFrame): + (WebInspector.NetworkManager.prototype.willSendWebSocketHandshakeRequest): + (WebInspector.NetworkManager.prototype.didReceiveWebSocketHandshakeResponse): + (WebInspector.NetworkManager.prototype._startResource): + (WebInspector.NetworkManager.prototype._finishResource): + * inspector/front-end/NetworkPanel.js: + (WebInspector.NetworkPanel): + (WebInspector.NetworkPanel.prototype._onResourceStarted): + (WebInspector.NetworkPanel.prototype._appendResource): + (WebInspector.NetworkPanel.prototype._onResourceUpdated): + (WebInspector.NetworkPanel.prototype._refreshResource): + (WebInspector.NetworkPanel.prototype._onMainResourceChanged): + * inspector/front-end/ResourcesPanel.js: + (WebInspector.ResourcesPanel): + (WebInspector.ResourcesPanel.prototype._refreshResource): + +2011-01-18 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Yury Semikhatsky. + + Web Inspector: preserve pause on exception state in settings. + https://bugs.webkit.org/show_bug.cgi?id=52619 + + * inspector/InspectorController.cpp: + (WebCore::InspectorController::getInspectorState): + * inspector/InspectorDebuggerAgent.cpp: + (WebCore::InspectorDebuggerAgent::setPauseOnExceptionsState): + * inspector/InspectorDebuggerAgent.h: + * inspector/front-end/ScriptsPanel.js: + (WebInspector.ScriptsPanel): + (WebInspector.ScriptsPanel.prototype.debuggerWasEnabled): + (WebInspector.ScriptsPanel.prototype._updatePauseOnExceptionsState): + (WebInspector.ScriptsPanel.prototype._togglePauseOnExceptions): + (WebInspector.ScriptsPanel.prototype._setPauseOnExceptions): + * inspector/front-end/Settings.js: + (WebInspector.Settings): + * inspector/front-end/inspector.js: + (WebInspector.doLoadedDone.populateInspectorState): + +2011-01-18 Pavel Podivilov <podivilov@chromium.org> + + Reviewed by Yury Semikhatsky. + + Web Inspector: [REGRESSION] JavaScript exceptions aren't shown in source frame. + https://bugs.webkit.org/show_bug.cgi?id=52623 + + * inspector/front-end/ConsoleView.js: + (WebInspector.ConsoleMessage): + (WebInspector.ConsoleMessage.prototype._formatMessage): + +2011-01-18 Pavel Feldman <pfeldman@chromium.org> + + Revert r76017. No need to guard InspectorInstrumentation:: in WebCore. + + * page/Page.cpp: + (WebCore::networkStateChanged): + +2011-01-18 Konstantin Tokarev <annulen@yandex.ru> + + Reviewed by Kent Tamura. + + Fixed compilation when Inspector is disabled + https://bugs.webkit.org/show_bug.cgi?id=52564 + + * page/Page.cpp: + (WebCore::networkStateChanged): Added ENABLE(INSPECTOR) guard + +2011-01-18 MORITA Hajime <morrita@google.com> + + Unreviewed, rolling out r76004, r76005, r76007, and r76011. + http://trac.webkit.org/changeset/76004 + http://trac.webkit.org/changeset/76005 + http://trac.webkit.org/changeset/76007 + http://trac.webkit.org/changeset/76011 + https://bugs.webkit.org/show_bug.cgi?id=51664 + + The r76004 broke pixel tests. + (The failure was missed due to the tolerance.) + + * Android.mk: + * CMakeLists.txt: + * GNUmakefile.am: + * WebCore.gypi: + * WebCore.pro: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * platform/graphics/GraphicsContext.cpp: + (WebCore::GraphicsContext::addRoundedRectClip): + (WebCore::GraphicsContext::clipOutRoundedRect): + * platform/graphics/GraphicsContext.h: + * platform/graphics/RoundedIntRect.cpp: Removed. + * platform/graphics/RoundedIntRect.h: Removed. + * rendering/RenderBox.cpp: + (WebCore::RenderBox::pushContentsClip): + * rendering/RenderBoxModelObject.cpp: + (WebCore::RenderBoxModelObject::paintFillLayerExtended): + (WebCore::RenderBoxModelObject::paintBorder): + (WebCore::RenderBoxModelObject::clipBorderSidePolygon): + (WebCore::uniformlyExpandBorderRadii): + (WebCore::RenderBoxModelObject::paintBoxShadow): + * rendering/RenderBoxModelObject.h: + * rendering/RenderObject.cpp: + (WebCore::RenderObject::drawBoxSideFromPath): + * rendering/RenderReplaced.cpp: + (WebCore::RenderReplaced::paint): + * rendering/RenderThemeChromiumWin.cpp: + (WebCore::RenderThemeChromiumWin::paintTextFieldInternal): + * rendering/RenderThemeMac.mm: + (WebCore::RenderThemeMac::paintMenuListButtonGradients): + (WebCore::RenderThemeMac::paintSliderTrack): + * rendering/RenderThemeSafari.cpp: + (WebCore::RenderThemeSafari::paintMenuListButtonGradients): + (WebCore::RenderThemeSafari::paintSliderTrack): + * rendering/RenderThemeWinCE.cpp: + (WebCore::RenderThemeWinCE::paintSearchFieldCancelButton): + * rendering/RenderWidget.cpp: + (WebCore::RenderWidget::paint): + * rendering/style/BorderData.h: + * rendering/style/RenderStyle.cpp: + (WebCore::constrainCornerRadiiForRect): + (WebCore::RenderStyle::getBorderRadiiForRect): + (WebCore::RenderStyle::getInnerBorderRadiiForRectWithBorderWidths): + * rendering/style/RenderStyle.h: + +2011-01-17 Pavel Podivilov <podivilov@chromium.org> + + Reviewed by Yury Semikhatsky. + + Web Inspector: add source column field to debugger call frames. + https://bugs.webkit.org/show_bug.cgi?id=52443 + + * bindings/js/JavaScriptCallFrame.cpp: + (WebCore::JavaScriptCallFrame::JavaScriptCallFrame): + * bindings/js/JavaScriptCallFrame.h: + (WebCore::JavaScriptCallFrame::create): + (WebCore::JavaScriptCallFrame::line): + (WebCore::JavaScriptCallFrame::column): + (WebCore::JavaScriptCallFrame::update): + * bindings/js/ScriptDebugServer.cpp: + (WebCore::ScriptDebugServer::createCallFrameAndPauseIfNeeded): + (WebCore::ScriptDebugServer::updateCallFrameAndPauseIfNeeded): + (WebCore::ScriptDebugServer::callEvent): + (WebCore::ScriptDebugServer::atStatement): + (WebCore::ScriptDebugServer::returnEvent): + (WebCore::ScriptDebugServer::exception): + (WebCore::ScriptDebugServer::willExecuteProgram): + (WebCore::ScriptDebugServer::didExecuteProgram): + (WebCore::ScriptDebugServer::didReachBreakpoint): + * bindings/js/ScriptDebugServer.h: + * bindings/v8/DebuggerScript.js: + (): + * bindings/v8/JavaScriptCallFrame.cpp: + (WebCore::JavaScriptCallFrame::column): + * bindings/v8/JavaScriptCallFrame.h: + * inspector/InjectedScriptSource.js: + (): + * inspector/JavaScriptCallFrame.idl: + +2011-01-18 Antti Koivisto <antti@apple.com> + + Reviewed by Dave Hyatt. + + https://bugs.webkit.org/show_bug.cgi?id=52370 + <rdar://problem/8856808> + Style sharing optimization no longer works on major web sites + + The code in CSSStyleSelector::locateSharedStyle() that tries to share style information between element has been defeated + by widespread use of certain CSS selectors (:first-child pseudo class and similar). The current implementation disables + the sharing optimization for the whole page if one of these constructs is seen in any style sheet used by the page. + + This patch gets the style sharing back to 25-40% range on most web sites. + + * css/CSSMutableStyleDeclaration.h: + (WebCore::CSSMutableStyleDeclaration::propertiesEqual): + + Needed to improve equality checking in NamedNodeMap::mappedMapsEquivalent. + + * css/CSSSelector.h: + (WebCore::CSSSelector::isSiblingSelector): + + Test for selectors that are affected by the sibling elements. + + * css/CSSStyleSelector.cpp: + (WebCore::elementCanUseSimpleDefaultStyle): + (WebCore::collectSiblingRulesInDefaultStyle): + (WebCore::assertNoSiblingRulesInDefaultStyle): + + Extract sibling rules from the MathML default stylesheet. + Assert that no other default stylesheet has them. + + (WebCore::CSSStyleSelector::CSSStyleSelector): + (WebCore::CSSStyleSelector::locateCousinList): + (WebCore::CSSStyleSelector::matchesSiblingRules): + (WebCore::CSSStyleSelector::canShareStyleWithElement): + (WebCore::CSSStyleSelector::locateSharedStyle): + (WebCore::CSSStyleSelector::styleForElement): + (WebCore::collectIdsAndSiblingRulesFromList): + (WebCore::CSSRuleSet::collectIdsAndSiblingRules): + + Track sibling rules and ids used in the stylesheets to allow much more fine-grained rejection of cases + where style sharing can't be used. + + * css/CSSStyleSelector.h: + * dom/NamedNodeMap.cpp: + (WebCore::NamedNodeMap::mappedMapsEquivalent): + + Check also for CSSValue mutation from DOM. + + * mathml/MathMLMathElement.cpp: + (WebCore::MathMLMathElement::insertedIntoDocument): + * mathml/MathMLMathElement.h: + + MathML default style sheet has sibling rules which don't get noticed by the normal document + stylesheet parsing. + + * rendering/style/RenderStyle.h: + (WebCore::InheritedFlags::setFirstChildState): + (WebCore::InheritedFlags::setLastChildState): + (WebCore::InheritedFlags::setChildIndex): + + These all make style non-shareable (unique). + +2011-01-18 MORITA Hajime <morrita@google.com> + + Unreviewed crash fix on release builds. + + * rendering/RenderBoxModelObject.cpp: + (WebCore::RenderBoxModelObject::paintFillLayerExtended): + +2011-01-18 Pavel Podivilov <podivilov@chromium.org> + + Unreviewed, update localizedStrings.js. + + * English.lproj/localizedStrings.js: + +2011-01-11 Pavel Podivilov <podivilov@chromium.org> + + Reviewed by Pavel Feldman. + + Web Inspector: implement script beautifier prototype. + https://bugs.webkit.org/show_bug.cgi?id=51588 + + * WebCore.gypi: + * WebCore.vcproj/WebCore.vcproj: + * inspector/front-end/ScriptFormatter.js: Added. + (WebInspector.ScriptFormatter): Implements JavaScript source beautification and conversion between original and + formatted line numbers + (WebInspector.ScriptFormatter.findLineEndings): + (WebInspector.ScriptFormatter.locationToPosition): + (WebInspector.ScriptFormatter.positionToLocation): + (WebInspector.ScriptFormatter.upperBound): + (WebInspector.ScriptFormatter.prototype.format): + (WebInspector.ScriptFormatter.prototype.originalLineNumberToFormattedLineNumber): + (WebInspector.ScriptFormatter.prototype.formattedLineNumberToOriginalLineNumber): + (WebInspector.ScriptFormatter.prototype.originalPositionToFormattedLineNumber): + (WebInspector.ScriptFormatter.prototype.formattedLineNumberToOriginalPosition): + (WebInspector.ScriptFormatter.prototype._convertPosition): + * inspector/front-end/ScriptsPanel.js: + (WebInspector.ScriptsPanel): + (WebInspector.ScriptsPanel.prototype._clearCurrentExecutionLine): + (WebInspector.ScriptsPanel.prototype._callFrameSelected): + (WebInspector.ScriptsPanel.prototype._formatScript): + * inspector/front-end/SourceFrame.js: Convert original line numbers to UI line numbers and vice versa + * inspector/front-end/WebKit.qrc: + * inspector/front-end/inspector.html: + +2011-01-18 Philippe Normand <pnormand@igalia.com> + + Unreviewed, GTK build fix as follow-up of r76004. + + * GNUmakefile.am: Include RoundedIntRect files in the build + +2011-01-18 Philippe Normand <pnormand@igalia.com> + + Unreviewed, rolling out r76002. + http://trac.webkit.org/changeset/76002 + https://bugs.webkit.org/show_bug.cgi?id=49790 + + breaks a bunch of fast/forms tests on mac and GTK + + * html/HTMLOptionElement.cpp: + (WebCore::HTMLOptionElement::setRenderStyle): + +2011-01-18 MORITA Hajime <morrita@google.com> + + Unreviewed windows build fix. + + * WebCore.vcproj/WebCore.vcproj: + +2011-01-17 MORITA Hajime <morrita@google.com> + + Reviewed by Simon Fraser. + + Refactoring: Extract RoundedIntRect class + https://bugs.webkit.org/show_bug.cgi?id=51664 + + RoundedIntRect is a pair of rect and four IntSize objects which represent + corner radii of the rectangle. IntSize is grouped into RoundedIntRect::Radii. + Now RenderStyle::getRoundedBorderFor() and RenderStyle::getRoundedInnerBorderWithBorderWidths() + return RoundedIntRect and GraphicsContext::addRoundedRectClip(), GraphicsContext::fillRoundedRect() + and other functions accept RoundedIntRect as an argument. + + No new tests. No behavioral change. + + * Android.mk: + * CMakeLists.txt: + * WebCore.gypi: + * WebCore.pro: + * WebCore.xcodeproj/project.pbxproj: + * platform/graphics/GraphicsContext.cpp: + (WebCore::GraphicsContext::addRoundedRectClip): + (WebCore::GraphicsContext::clipOutRoundedRect): + (WebCore::GraphicsContext::fillRoundedRect): + * platform/graphics/GraphicsContext.h: + * platform/graphics/RoundedIntRect.cpp: Added. + (WebCore::RoundedIntRect::Radii::isZero): + (WebCore::RoundedIntRect::Radii::scale): + (WebCore::RoundedIntRect::Radii::expand): + (WebCore::RoundedIntRect::Radii::includeLogicalEdges): + (WebCore::RoundedIntRect::Radii::excludeLogicalEdges): + (WebCore::RoundedIntRect::RoundedIntRect): + (WebCore::RoundedIntRect::includeLogicalEdges): + (WebCore::RoundedIntRect::excludeLogicalEdges): + * platform/graphics/RoundedIntRect.h: Added. + (WebCore::RoundedIntRect::Radii::Radii): + (WebCore::RoundedIntRect::Radii::setTopLeft): + (WebCore::RoundedIntRect::Radii::setTopRight): + (WebCore::RoundedIntRect::Radii::setBottomLeft): + (WebCore::RoundedIntRect::Radii::setBottomRight): + (WebCore::RoundedIntRect::Radii::topLeft): + (WebCore::RoundedIntRect::Radii::topRight): + (WebCore::RoundedIntRect::Radii::bottomLeft): + (WebCore::RoundedIntRect::Radii::bottomRight): + (WebCore::RoundedIntRect::Radii::expand): + (WebCore::RoundedIntRect::Radii::shrink): + (WebCore::RoundedIntRect::location): + (WebCore::RoundedIntRect::size): + (WebCore::RoundedIntRect::x): + (WebCore::RoundedIntRect::y): + (WebCore::RoundedIntRect::width): + (WebCore::RoundedIntRect::height): + (WebCore::RoundedIntRect::right): + (WebCore::RoundedIntRect::bottom): + (WebCore::RoundedIntRect::rect): + (WebCore::RoundedIntRect::radii): + (WebCore::RoundedIntRect::isRounded): + (WebCore::RoundedIntRect::isEmpty): + (WebCore::RoundedIntRect::setRect): + (WebCore::RoundedIntRect::setRadii): + (WebCore::RoundedIntRect::move): + (WebCore::RoundedIntRect::inflate): + (WebCore::RoundedIntRect::inflateWithRadii): + (WebCore::RoundedIntRect::expandRadii): + (WebCore::RoundedIntRect::shrinkRadii): + * rendering/RenderBox.cpp: + (WebCore::RenderBox::pushContentsClip): + * rendering/RenderBoxModelObject.cpp: + (WebCore::RenderBoxModelObject::paintFillLayerExtended): + (WebCore::RenderBoxModelObject::paintBorder): + (WebCore::RenderBoxModelObject::clipBorderSidePolygon): + (WebCore::RenderBoxModelObject::paintBoxShadow): + * rendering/RenderBoxModelObject.h: + * rendering/RenderObject.cpp: + (WebCore::RenderObject::drawBoxSideFromPath): + * rendering/RenderReplaced.cpp: + (WebCore::RenderReplaced::paint): + * rendering/RenderThemeChromiumWin.cpp: + (WebCore::RenderThemeChromiumWin::paintTextFieldInternal): + * rendering/RenderThemeMac.mm: + (WebCore::RenderThemeMac::paintMenuListButtonGradients): + (WebCore::RenderThemeMac::paintSliderTrack): + * rendering/RenderThemeSafari.cpp: + (WebCore::RenderThemeSafari::paintMenuListButtonGradients): + (WebCore::RenderThemeSafari::paintSliderTrack): + * rendering/RenderThemeWinCE.cpp: + (WebCore::RenderThemeWinCE::paintSearchFieldCancelButton): + * rendering/RenderWidget.cpp: + (WebCore::RenderWidget::paint): + * rendering/style/BorderData.h: + * rendering/style/RenderStyle.cpp: + (WebCore::calcRadiiFor): + (WebCore::calcConstraintScaleFor): + (WebCore::RenderStyle::getRoundedBorderFor): + (WebCore::RenderStyle::getRoundedInnerBorderWithBorderWidths): + * rendering/style/RenderStyle.h: + (WebCore::InheritedFlags::setBorderRadius): + +2011-01-17 Rob Buis <rwlbuis@gmail.com> + + Reviewed by Kent Tamura. + + Color changes to option elements in a select multiple aren't drawn immediately + https://bugs.webkit.org/show_bug.cgi?id=49790 + + Redirect style changes on <option> element to the owner <select> element. + + Tests: fast/forms/select-option-background-color-change.html + fast/forms/select-option-color-change.html + fast/forms/select-option-visibility-change.html + + * html/HTMLOptionElement.cpp: + (WebCore::HTMLOptionElement::setRenderStyle): + +2011-01-17 MORITA Hajime <morrita@google.com> + + Unreviewed, rolling out r75995. + http://trac.webkit.org/changeset/75995 + https://bugs.webkit.org/show_bug.cgi?id=51914 + + Causes assertion failures. + + * dom/Element.cpp: + (WebCore::Element::shadowRoot): + (WebCore::Element::setShadowRoot): + (WebCore::Element::removeShadowRoot): + * dom/ElementRareData.h: + (WebCore::ElementRareData::ElementRareData): + +2011-01-17 MORITA Hajime <morrita@google.com> + + Unreviewed, rolling out r75999. + http://trac.webkit.org/changeset/75999 + + * dom/Element.cpp: + (WebCore::Element::removeShadowRoot): + +2011-01-17 MORITA Hajime <morrita@google.com> + + Unreviewed crash fix, which introduced at r75995 + + * dom/Element.cpp: + (WebCore::Element::removeShadowRoot): + +2011-01-17 MORITA Hajime <morrita@google.com> + + Reviewed by Dimitri Glazkov. + + ElementRareData::m_shadowRoot should not be RefPtr. + https://bugs.webkit.org/show_bug.cgi?id=51914 + + This change makes m_shadowRoot a raw pointer, as Node::m_parent is. + This change is safe because shadow host pointer is stored as TreeShared::m_parent + which prevents deletion unless set to null. + + No test, no behavioral change. + + * dom/Element.cpp: + (WebCore::Element::shadowRoot): + (WebCore::Element::setShadowRoot): + (WebCore::Element::removeShadowRoot): + * dom/ElementRareData.h: + (WebCore::ElementRareData::ElementRareData): + +2011-01-17 Maciej Stachowiak <mjs@apple.com> + + Reviewed by Dan Bernstein. + + Some WebKit2 layout tests crash due to focus being on a frame in the page cache + https://bugs.webkit.org/show_bug.cgi?id=52607 + + No new tests. Existing tests crash in WebKit2 without this fix. + + I suspect there are other consequences besides the WebKit2 crash, but I + was unable to identify any for certain. + + * history/CachedFrame.cpp: + (WebCore::CachedFrame::CachedFrame): If a frame still has focus when its page + goes in the page cache, reset focus to the main frame. + 2011-01-17 Adam Roben <aroben@apple.com> Simplify WKCACFLayerRenderer's API @@ -2759,7 +7809,6 @@ * html/canvas/WebGLRenderingContext.cpp: ->>>>>>> .r75740 2011-01-13 Adrienne Walker <enne@google.com> Reviewed by Kenneth Russell. diff --git a/Source/WebCore/DerivedSources.cpp b/Source/WebCore/DerivedSources.cpp index 1be63f3..21271ea 100644 --- a/Source/WebCore/DerivedSources.cpp +++ b/Source/WebCore/DerivedSources.cpp @@ -167,6 +167,7 @@ #include "JSHTMLImageElement.cpp" #include "JSHTMLInputElement.cpp" #include "JSHTMLIsIndexElement.cpp" +#include "JSHTMLKeygenElement.cpp" #include "JSHTMLLabelElement.cpp" #include "JSHTMLLegendElement.cpp" #include "JSHTMLLIElement.cpp" diff --git a/Source/WebCore/DerivedSources.make b/Source/WebCore/DerivedSources.make index e1b4db4..ef2dc2f 100644 --- a/Source/WebCore/DerivedSources.make +++ b/Source/WebCore/DerivedSources.make @@ -234,6 +234,7 @@ DOM_CLASSES = \ HTMLImageElement \ HTMLInputElement \ HTMLIsIndexElement \ + HTMLKeygenElement \ HTMLLIElement \ HTMLLabelElement \ HTMLLegendElement \ @@ -311,6 +312,7 @@ DOM_CLASSES = \ Notation \ Notification \ NotificationCenter \ + OESStandardDerivatives \ OESTextureFloat \ OverflowEvent \ PageTransitionEvent \ diff --git a/Source/WebCore/English.lproj/localizedStrings.js b/Source/WebCore/English.lproj/localizedStrings.js Binary files differindex 0d8edc2..7bd3da8 100644 --- a/Source/WebCore/English.lproj/localizedStrings.js +++ b/Source/WebCore/English.lproj/localizedStrings.js diff --git a/Source/WebCore/GNUmakefile.am b/Source/WebCore/GNUmakefile.am index efbbb70..0975094 100644 --- a/Source/WebCore/GNUmakefile.am +++ b/Source/WebCore/GNUmakefile.am @@ -354,6 +354,8 @@ webcore_built_sources += \ DerivedSources/WebCore/JSHTMLInputElement.h \ DerivedSources/WebCore/JSHTMLIsIndexElement.cpp \ DerivedSources/WebCore/JSHTMLIsIndexElement.h \ + DerivedSources/WebCore/JSHTMLKeygenElement.cpp \ + DerivedSources/WebCore/JSHTMLKeygenElement.h \ DerivedSources/WebCore/JSHTMLLabelElement.cpp \ DerivedSources/WebCore/JSHTMLLabelElement.h \ DerivedSources/WebCore/JSHTMLLegendElement.cpp \ @@ -480,6 +482,8 @@ webcore_built_sources += \ DerivedSources/WebCore/JSNotificationCenter.h \ DerivedSources/WebCore/JSNotification.cpp \ DerivedSources/WebCore/JSNotification.h \ + DerivedSources/WebCore/JSOESStandardDerivatives.cpp \ + DerivedSources/WebCore/JSOESStandardDerivatives.h \ DerivedSources/WebCore/JSOESTextureFloat.cpp \ DerivedSources/WebCore/JSOESTextureFloat.h \ DerivedSources/WebCore/JSOverflowEvent.cpp \ @@ -775,6 +779,8 @@ webcore_sources += \ Source/WebCore/bindings/js/JSEventSourceCustom.cpp \ Source/WebCore/bindings/js/JSEventTarget.cpp \ Source/WebCore/bindings/js/JSEventTarget.h \ + Source/WebCore/bindings/js/JSErrorHandler.cpp \ + Source/WebCore/bindings/js/JSErrorHandler.h \ Source/WebCore/bindings/js/JSExceptionBase.cpp \ Source/WebCore/bindings/js/JSExceptionBase.h \ Source/WebCore/bindings/js/JSFileReaderCustom.cpp \ @@ -866,8 +872,6 @@ webcore_sources += \ Source/WebCore/bindings/js/JSWorkerContextBase.cpp \ Source/WebCore/bindings/js/JSWorkerContextBase.h \ Source/WebCore/bindings/js/JSWorkerContextCustom.cpp \ - Source/WebCore/bindings/js/JSWorkerContextErrorHandler.cpp \ - Source/WebCore/bindings/js/JSWorkerContextErrorHandler.h \ Source/WebCore/bindings/js/JSWorkerCustom.cpp \ Source/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp \ Source/WebCore/bindings/js/JSXMLHttpRequestUploadCustom.cpp \ @@ -1300,6 +1304,7 @@ webcore_sources += \ Source/WebCore/dom/Text.cpp \ Source/WebCore/dom/TextEvent.cpp \ Source/WebCore/dom/TextEvent.h \ + Source/WebCore/dom/TextEventInputType.h \ Source/WebCore/dom/Text.h \ Source/WebCore/dom/TouchList.h \ Source/WebCore/dom/TransformSource.h \ @@ -1579,6 +1584,8 @@ webcore_sources += \ Source/WebCore/html/canvas/Int8Array.cpp \ Source/WebCore/html/canvas/Int8Array.h \ Source/WebCore/html/canvas/IntegralTypedArrayBase.h \ + Source/WebCore/html/canvas/OESStandardDerivatives.cpp \ + Source/WebCore/html/canvas/OESStandardDerivatives.h \ Source/WebCore/html/canvas/OESTextureFloat.cpp \ Source/WebCore/html/canvas/OESTextureFloat.h \ Source/WebCore/html/canvas/TypedArrayBase.h \ @@ -1981,6 +1988,8 @@ webcore_sources += \ Source/WebCore/inspector/InspectorProfilerAgent.h \ Source/WebCore/inspector/InspectorResourceAgent.cpp \ Source/WebCore/inspector/InspectorResourceAgent.h \ + Source/WebCore/inspector/InspectorRuntimeAgent.cpp \ + Source/WebCore/inspector/InspectorRuntimeAgent.h \ Source/WebCore/inspector/InspectorSettings.cpp \ Source/WebCore/inspector/InspectorSettings.h \ Source/WebCore/inspector/InspectorState.cpp \ @@ -2435,6 +2444,8 @@ webcore_sources += \ Source/WebCore/platform/graphics/PathTraversalState.h \ Source/WebCore/platform/graphics/Pattern.cpp \ Source/WebCore/platform/graphics/Pattern.h \ + Source/WebCore/platform/graphics/RoundedIntRect.cpp \ + Source/WebCore/platform/graphics/RoundedIntRect.h \ Source/WebCore/platform/graphics/SegmentedFontData.cpp \ Source/WebCore/platform/graphics/SegmentedFontData.h \ Source/WebCore/platform/graphics/SimpleFontData.cpp \ @@ -2563,8 +2574,8 @@ webcore_sources += \ Source/WebCore/platform/SchemeRegistry.h \ Source/WebCore/platform/ScrollAnimator.cpp \ Source/WebCore/platform/ScrollAnimator.h \ - Source/WebCore/platform/ScrollbarClient.cpp \ - Source/WebCore/platform/ScrollbarClient.h \ + Source/WebCore/platform/ScrollableArea.cpp \ + Source/WebCore/platform/ScrollableArea.h \ Source/WebCore/platform/Scrollbar.cpp \ Source/WebCore/platform/Scrollbar.h \ Source/WebCore/platform/ScrollbarThemeComposite.cpp \ diff --git a/Source/WebCore/WebCore.exp.in b/Source/WebCore/WebCore.exp.in index a3132f5..250b629 100644 --- a/Source/WebCore/WebCore.exp.in +++ b/Source/WebCore/WebCore.exp.in @@ -163,7 +163,7 @@ __ZN7WebCore11FrameLoader11shouldCloseEv __ZN7WebCore11FrameLoader11urlSelectedERKNS_4KURLERKN3WTF6StringENS4_10PassRefPtrINS_5EventEEEbbNS_14ReferrerPolicyE __ZN7WebCore11FrameLoader12shouldReloadERKNS_4KURLES3_ __ZN7WebCore11FrameLoader14detachChildrenEv -__ZN7WebCore11FrameLoader14stopAllLoadersENS_14DatabasePolicyE +__ZN7WebCore11FrameLoader14stopAllLoadersENS_14DatabasePolicyENS_26ClearProvisionalItemPolicyE __ZN7WebCore11FrameLoader16detachFromParentEv __ZN7WebCore11FrameLoader16loadFrameRequestERKNS_16FrameLoadRequestEbbN3WTF10PassRefPtrINS_5EventEEENS5_INS_9FormStateEEENS_14ReferrerPolicyE __ZN7WebCore11FrameLoader17stopForUserCancelEb @@ -545,7 +545,6 @@ __ZN7WebCore24createFragmentFromMarkupEPNS_8DocumentERKN3WTF6StringES5_NS_27Frag __ZN7WebCore24decodeURLEscapeSequencesERKN3WTF6StringE __ZN7WebCore24fileSystemRepresentationERKN3WTF6StringE __ZN7WebCore24notifyHistoryItemChangedE -__ZN7WebCore24rangeCompliantEquivalentERKNS_8PositionE __ZN7WebCore25HistoryPropertyListWriter11releaseDataEv __ZN7WebCore25HistoryPropertyListWriter12writeObjectsERNS_30BinaryPropertyListObjectStreamE __ZN7WebCore25HistoryPropertyListWriter16writeHistoryItemERNS_30BinaryPropertyListObjectStreamEPNS_11HistoryItemE @@ -782,6 +781,7 @@ __ZN7WebCore8GradientC1ERKNS_10FloatPointES3_ __ZN7WebCore8IntPointC1ERK8_NSPoint __ZN7WebCore8PositionC1EN3WTF10PassRefPtrINS_4NodeEEEi __ZN7WebCore8Settings14setJavaEnabledEb +__ZN7WebCore8Settings18setWebAudioEnabledEb __ZN7WebCore8Settings15setWebGLEnabledEb __ZN7WebCore8Settings16setUsesPageCacheEb __ZN7WebCore8Settings17setPluginsEnabledEb @@ -875,7 +875,7 @@ __ZN7WebCore9FrameView23updateCanHaveScrollbarsEv __ZN7WebCore9FrameView24forceLayoutForPaginationERKNS_9FloatSizeEfNS_5Frame19AdjustViewSizeOrNotE __ZN7WebCore9FrameView26adjustPageHeightDeprecatedEPffff __ZN7WebCore9FrameView29setShouldUpdateWhileOffscreenEb -__ZN7WebCore9FrameView29syncCompositingStateRecursiveEv +__ZN7WebCore9FrameView38syncCompositingStateIncludingSubframesEv __ZN7WebCore9FrameView37updateLayoutAndStyleIfNeededRecursiveEv __ZN7WebCore9FrameView38scrollPositionChangedViaPlatformWidgetEv __ZN7WebCore9FrameView6createEPNS_5FrameE @@ -1195,6 +1195,7 @@ __ZNK7WebCore8Document6domainEv __ZNK7WebCore8IntPointcv7CGPointEv __ZNK7WebCore8IntPointcv8_NSPointEv __ZNK7WebCore8Position10downstreamENS_27EditingBoundaryCrossingRuleE +__ZNK7WebCore8Position24parentAnchoredEquivalentEv __ZNK7WebCore8Position25leadingWhitespacePositionENS_9EAffinityEb __ZNK7WebCore8Position26trailingWhitespacePositionENS_9EAffinityEb __ZNK7WebCore8Position8upstreamENS_27EditingBoundaryCrossingRuleE @@ -1288,6 +1289,8 @@ _wkSignalCFReadStreamHasBytes _wkCreateCTTypesetterWithUniCharProviderAndOptions _wkIOSurfaceContextCreate _wkIOSurfaceContextCreateImage +_wkMakeScrollbarPainter +_wkScrollbarPainterPaint #endif #if ENABLE(3D_RENDERING) diff --git a/Source/WebCore/WebCore.gyp/WebCore.gyp b/Source/WebCore/WebCore.gyp/WebCore.gyp index 34066f7..f96753c 100644 --- a/Source/WebCore/WebCore.gyp/WebCore.gyp +++ b/Source/WebCore/WebCore.gyp/WebCore.gyp @@ -185,6 +185,7 @@ '../svg/graphics', '../svg/graphics/filters', '../svg/properties', + '../thirdparty/glu', '../webaudio', '../websockets', '../workers', @@ -1117,6 +1118,8 @@ # Use LinkHashChromium.cpp instead ['exclude', 'platform/LinkHash\\.cpp$'], + + ['include', 'thirdparty/glu/libtess/'], ], 'conditions': [ ['OS=="linux" or OS=="freebsd"', { @@ -1133,6 +1136,10 @@ '<(chromium_src_dir)/third_party/harfbuzz/harfbuzz.gyp:harfbuzz', ], }], + ['OS=="linux" and target_arch=="arm"', { + # Due to a bug in gcc arm, we get warnings about uninitialized timesNewRoman.unstatic.3258 + 'cflags': ['-Wno-uninitialized'], + }], ['OS=="mac"', { # Necessary for Mac .mm stuff. 'include_dirs': [ @@ -1173,9 +1180,7 @@ ['include', 'platform/(graphics/)?mac/[^/]*Font[^/]*\\.(cpp|mm?)$'], ['include', 'platform/graphics/mac/ComplexText[^/]*\\.(cpp|h)$'], - # AudioBusMac is necessary for web audio API bringup on Chrome. - # It will later be replaced with chromium-specific code. - ['include', 'platform/audio/mac/AudioBusMac\\.mm$'], + # We can use this for the fast Accelerate.framework FFT. ['include', 'platform/audio/mac/FFTFrameMac\\.cpp$'], # Cherry-pick some files that can't be included by broader regexps. diff --git a/Source/WebCore/WebCore.gypi b/Source/WebCore/WebCore.gypi index f4a239f..ca52804 100644 --- a/Source/WebCore/WebCore.gypi +++ b/Source/WebCore/WebCore.gypi @@ -75,6 +75,7 @@ 'dom/ProgressEvent.idl', 'dom/Range.idl', 'dom/RangeException.idl', + 'dom/RequestAnimationFrameCallback.idl', 'dom/Text.idl', 'dom/TextEvent.idl', 'dom/Touch.idl', @@ -160,6 +161,7 @@ 'html/HTMLImageElement.idl', 'html/HTMLInputElement.idl', 'html/HTMLIsIndexElement.idl', + 'html/HTMLKeygenElement.idl', 'html/HTMLLIElement.idl', 'html/HTMLLabelElement.idl', 'html/HTMLLegendElement.idl', @@ -214,6 +216,7 @@ 'html/canvas/Int16Array.idl', 'html/canvas/Int32Array.idl', 'html/canvas/Int8Array.idl', + 'html/canvas/OESStandardDerivatives.idl', 'html/canvas/OESTextureFloat.idl', 'html/canvas/Uint16Array.idl', 'html/canvas/Uint32Array.idl', @@ -625,6 +628,8 @@ 'bindings/js/JSElementCustom.cpp', 'bindings/js/JSEntryCustom.cpp', 'bindings/js/JSEntrySyncCustom.cpp', + 'bindings/js/JSErrorHandler.cpp', + 'bindings/js/JSErrorHandler.h', 'bindings/js/JSEventCustom.cpp', 'bindings/js/JSEventListener.cpp', 'bindings/js/JSEventListener.h', @@ -722,8 +727,6 @@ 'bindings/js/JSWorkerContextBase.cpp', 'bindings/js/JSWorkerContextBase.h', 'bindings/js/JSWorkerContextCustom.cpp', - 'bindings/js/JSWorkerContextErrorHandler.cpp', - 'bindings/js/JSWorkerContextErrorHandler.h', 'bindings/js/JSWorkerCustom.cpp', 'bindings/js/JSXMLHttpRequestCustom.cpp', 'bindings/js/JSXMLHttpRequestUploadCustom.cpp', @@ -948,8 +951,6 @@ 'bindings/v8/V8Binding.h', 'bindings/v8/V8Collection.cpp', 'bindings/v8/V8Collection.h', - 'bindings/v8/V8ConsoleMessage.cpp', - 'bindings/v8/V8ConsoleMessage.h', 'bindings/v8/V8DataGridDataSource.cpp', 'bindings/v8/V8DataGridDataSource.h', 'bindings/v8/V8DOMMap.cpp', @@ -984,6 +985,8 @@ 'bindings/v8/V8Proxy.h', 'bindings/v8/V8Utilities.cpp', 'bindings/v8/V8Utilities.h', + 'bindings/v8/V8WindowErrorHandler.cpp', + 'bindings/v8/V8WindowErrorHandler.h', 'bindings/v8/V8WorkerContextErrorHandler.cpp', 'bindings/v8/V8WorkerContextErrorHandler.h', 'bindings/v8/V8WorkerContextEventListener.cpp', @@ -1315,6 +1318,7 @@ 'dom/Range.h', 'dom/RangeBoundaryPoint.h', 'dom/RangeException.h', + 'dom/RequestAnimationFrameCallback.h', 'dom/RawDataDocumentParser.h', 'dom/RegisteredEventListener.cpp', 'dom/RegisteredEventListener.h', @@ -1348,6 +1352,7 @@ 'dom/Text.h', 'dom/TextEvent.cpp', 'dom/TextEvent.h', + 'dom/TextEventInputType.h', 'dom/Touch.cpp', 'dom/Touch.h', 'dom/TouchEvent.cpp', @@ -1916,6 +1921,8 @@ 'html/canvas/Int8Array.cpp', 'html/canvas/Int8Array.h', 'html/canvas/IntegralTypedArrayBase.h', + 'html/canvas/OESStandardDerivatives.cpp', + 'html/canvas/OESStandardDerivatives.h', 'html/canvas/OESTextureFloat.cpp', 'html/canvas/OESTextureFloat.h', 'html/canvas/TypedArrayBase.h', @@ -2034,6 +2041,8 @@ 'inspector/InspectorProfilerAgent.h', 'inspector/InspectorResourceAgent.cpp', 'inspector/InspectorResourceAgent.h', + 'inspector/InspectorRuntimeAgent.cpp', + 'inspector/InspectorRuntimeAgent.h', 'inspector/InspectorState.cpp', 'inspector/InspectorSettings.h', 'inspector/InspectorSettings.cpp', @@ -2396,6 +2405,7 @@ 'platform/audio/FFTConvolver.cpp', 'platform/audio/FFTFrame.h', 'platform/audio/FFTFrame.cpp', + 'platform/audio/FFTFrameStub.cpp', 'platform/audio/HRTFDatabase.h', 'platform/audio/HRTFDatabase.cpp', 'platform/audio/HRTFDatabaseLoader.h', @@ -2437,7 +2447,6 @@ 'platform/cf/SchedulePair.cpp', 'platform/cf/SchedulePair.h', 'platform/cf/SharedBufferCF.cpp', - 'platform/chromium/ChromiumBridge.h', 'platform/chromium/ChromiumDataObject.cpp', 'platform/chromium/ChromiumDataObject.h', 'platform/chromium/ChromiumDataObjectLegacy.cpp', @@ -2474,6 +2483,7 @@ 'platform/chromium/MIMETypeRegistryChromium.cpp', 'platform/chromium/PasteboardChromium.cpp', 'platform/chromium/PasteboardPrivate.h', + 'platform/chromium/PlatformBridge.h', 'platform/chromium/PlatformCursor.h', 'platform/chromium/PlatformKeyboardEventChromium.cpp', 'platform/chromium/PlatformScreenChromium.cpp', @@ -2942,6 +2952,8 @@ 'platform/graphics/PathTraversalState.h', 'platform/graphics/Pattern.cpp', 'platform/graphics/Pattern.h', + 'platform/graphics/RoundedIntRect.cpp', + 'platform/graphics/RoundedIntRect.h', 'platform/graphics/SegmentedFontData.cpp', 'platform/graphics/SegmentedFontData.h', 'platform/graphics/SimpleFontData.cpp', @@ -3501,10 +3513,10 @@ 'platform/ScrollView.h', 'platform/SchemeRegistry.cpp', 'platform/SchemeRegistry.h', + 'platform/ScrollableArea.cpp', + 'platform/ScrollableArea.h', 'platform/Scrollbar.cpp', 'platform/Scrollbar.h', - 'platform/ScrollbarClient.cpp', - 'platform/ScrollbarClient.h', 'platform/ScrollbarTheme.h', 'platform/ScrollbarThemeComposite.cpp', 'platform/ScrollbarThemeComposite.h', @@ -4433,6 +4445,29 @@ 'svg/SVGZoomAndPan.h', 'svg/SVGZoomEvent.cpp', 'svg/SVGZoomEvent.h', + 'thirdparty/glu/libtess/dict.h', + 'thirdparty/glu/libtess/dict-list.h', + 'thirdparty/glu/libtess/geom.h', + 'thirdparty/glu/libtess/memalloc.h', + 'thirdparty/glu/libtess/mesh.h', + 'thirdparty/glu/libtess/normal.h', + 'thirdparty/glu/libtess/priorityq-heap.h', + 'thirdparty/glu/libtess/priorityq-sort.h', + 'thirdparty/glu/libtess/priorityq.h', + 'thirdparty/glu/libtess/render.h', + 'thirdparty/glu/libtess/sweep.h', + 'thirdparty/glu/libtess/tess.h', + 'thirdparty/glu/libtess/tessmono.h', + 'thirdparty/glu/libtess/dict.c', + 'thirdparty/glu/libtess/geom.c', + 'thirdparty/glu/libtess/memalloc.c', + 'thirdparty/glu/libtess/mesh.c', + 'thirdparty/glu/libtess/normal.c', + 'thirdparty/glu/libtess/priorityq.c', + 'thirdparty/glu/libtess/render.c', + 'thirdparty/glu/libtess/sweep.c', + 'thirdparty/glu/libtess/tess.c', + 'thirdparty/glu/libtess/tessmono.c', 'webaudio/AudioBasicProcessorNode.cpp', 'webaudio/AudioBasicProcessorNode.h', 'webaudio/AudioBuffer.h', @@ -4617,6 +4652,7 @@ 'inspector/front-end/CookieParser.js', 'inspector/front-end/CookiesTable.js', 'inspector/front-end/CSSCompletions.js', + 'inspector/front-end/CSSKeywordCompletions.js', 'inspector/front-end/CSSStyleModel.js', 'inspector/front-end/Database.js', 'inspector/front-end/DatabaseQueryView.js', @@ -4646,7 +4682,6 @@ 'inspector/front-end/ImageView.js', 'inspector/front-end/InspectorFrontendHostStub.js', 'inspector/front-end/InjectedFakeWorker.js', - 'inspector/front-end/InjectedScriptAccess.js', 'inspector/front-end/inspector.js', 'inspector/front-end/KeyboardShortcut.js', 'inspector/front-end/MetricsSidebarPane.js', @@ -4675,6 +4710,8 @@ 'inspector/front-end/ResourcesPanel.js', 'inspector/front-end/ScopeChainSidebarPane.js', 'inspector/front-end/Script.js', + 'inspector/front-end/ScriptFormatter.js', + 'inspector/front-end/ScriptFormatterWorker.js', 'inspector/front-end/ScriptsPanel.js', 'inspector/front-end/ScriptView.js', 'inspector/front-end/ShortcutsHelp.js', @@ -4708,6 +4745,8 @@ 'inspector/front-end/WatchExpressionsSidebarPane.js', 'inspector/front-end/WelcomeView.js', 'inspector/front-end/WorkersSidebarPane.js', + 'inspector/front-end/UglifyJS/parse-js.js', + 'inspector/front-end/UglifyJS/process.js', 'inspector/front-end/audits.css', 'inspector/front-end/goToLineDialog.css', 'inspector/front-end/heapProfiler.css', diff --git a/Source/WebCore/WebCore.order b/Source/WebCore/WebCore.order index e88c444..136a34d 100644 --- a/Source/WebCore/WebCore.order +++ b/Source/WebCore/WebCore.order @@ -25208,13 +25208,9 @@ __ZN7WebCore15JSWorkerContext10setTimeoutEPN3JSC9ExecStateERKNS1_7ArgListE __ZN7WebCore13WorkerContext10setTimeoutEPNS_15ScheduledActionEi __ZN7WebCore17WorkerSharedTimer11setFireTimeEd __ZN7WebCore15ScheduledAction7executeEPNS_13WorkerContextE -__ZN7WebCore27JSWorkerContextErrorHandlerC1EPN3JSC8JSObjectES3_bPNS_15DOMWrapperWorldE -__ZN7WebCore27JSWorkerContextErrorHandlerC2EPN3JSC8JSObjectES3_bPNS_15DOMWrapperWorldE __ZN7WebCore10ErrorEventC1ERKNS_6StringES3_j __ZN7WebCore10ErrorEventC2ERKNS_6StringES3_j -__ZN7WebCore27JSWorkerContextErrorHandler11handleEventEPNS_22ScriptExecutionContextEPNS_5EventE __ZN7WebCore10ErrorEventD0Ev -__ZN7WebCore27JSWorkerContextErrorHandlerD0Ev __ZN7WebCore17jsWorkerOnmessageEPN3JSC9ExecStateENS0_7JSValueERKNS0_10IdentifierE __ZN7WebCore34jsWorkerPrototypeFunctionTerminateEPN3JSC9ExecStateEPNS0_8JSObjectENS0_7JSValueERKNS0_7ArgListE __ZThn8_N7WebCore20WorkerMessagingProxy19workerContextClosedEv diff --git a/Source/WebCore/WebCore.pri b/Source/WebCore/WebCore.pri index 736d534..ad1835f 100644 --- a/Source/WebCore/WebCore.pri +++ b/Source/WebCore/WebCore.pri @@ -193,6 +193,7 @@ IDL_BINDINGS += \ html/canvas/CanvasPattern.idl \ html/canvas/CanvasRenderingContext.idl \ html/canvas/CanvasRenderingContext2D.idl \ + html/canvas/OESStandardDerivatives.idl \ html/canvas/OESTextureFloat.idl \ html/canvas/WebGLActiveInfo.idl \ html/canvas/WebGLBuffer.idl \ @@ -253,6 +254,7 @@ IDL_BINDINGS += \ html/HTMLImageElement.idl \ html/HTMLInputElement.idl \ html/HTMLIsIndexElement.idl \ + html/HTMLKeygenElement.idl \ html/HTMLLabelElement.idl \ html/HTMLLegendElement.idl \ html/HTMLLIElement.idl \ @@ -747,10 +749,10 @@ addExtraCompiler(xpathbison) # GENERATOR 11: WebKit Version # The appropriate Apple-maintained Version.xcconfig file for WebKit version information is in Source/WebKit/mac/Configurations/. -webkitversion.wkScript = $$PWD/../../Source/WebKit/scripts/generate-webkitversion.pl +webkitversion.wkScript = $$PWD/../WebKit/scripts/generate-webkitversion.pl webkitversion.output = $${WC_GENERATED_SOURCES_DIR}/WebKitVersion.h webkitversion.input = webkitversion.wkScript -webkitversion.commands = perl $$webkitversion.wkScript --config $$PWD/../../Source/WebKit/mac/Configurations/Version.xcconfig --outputDir $${WC_GENERATED_SOURCES_DIR}/ +webkitversion.commands = perl $$webkitversion.wkScript --config $$PWD/../WebKit/mac/Configurations/Version.xcconfig --outputDir $${WC_GENERATED_SOURCES_DIR}/ webkitversion.clean = ${QMAKE_VAR_WC_GENERATED_SOURCES_DIR}/WebKitVersion.h webkitversion.wkAddOutputToSources = false addExtraCompiler(webkitversion) diff --git a/Source/WebCore/WebCore.pro b/Source/WebCore/WebCore.pro index d37cdc7..7b953f3 100644 --- a/Source/WebCore/WebCore.pro +++ b/Source/WebCore/WebCore.pro @@ -52,12 +52,12 @@ symbian: { " " webkitlibs.pkg_prerules = vendorinfo - webkitbackup.sources = ../../Source/WebKit/qt/symbian/backup_registration.xml + webkitbackup.sources = ../WebKit/qt/symbian/backup_registration.xml webkitbackup.path = /private/10202D56/import/packages/$$replace(TARGET.UID3, 0x,) contains(QT_CONFIG, declarative) { declarativeImport.sources = $$QT_BUILD_TREE/imports/QtWebKit/qmlwebkitplugin$${QT_LIBINFIX}.dll - declarativeImport.sources += ../../Source/WebKit/qt/declarative/qmldir + declarativeImport.sources += ../WebKit/qt/declarative/qmldir declarativeImport.path = c:$$QT_IMPORTS_BASE_DIR/QtWebKit DEPLOYMENT += declarativeImport } @@ -90,7 +90,7 @@ CONFIG(standalone_package) { isEmpty(WC_GENERATED_SOURCES_DIR):WC_GENERATED_SOURCES_DIR = $$PWD/generated isEmpty(JSC_GENERATED_SOURCES_DIR):JSC_GENERATED_SOURCES_DIR = $$PWD/../JavaScriptCore/generated - PRECOMPILED_HEADER = $$PWD/../../Source/WebKit/qt/WebKit_pch.h + PRECOMPILED_HEADER = $$PWD/../WebKit/qt/WebKit_pch.h } else { isEmpty(WC_GENERATED_SOURCES_DIR):WC_GENERATED_SOURCES_DIR = generated isEmpty(JSC_GENERATED_SOURCES_DIR):JSC_GENERATED_SOURCES_DIR = ../JavaScriptCore/generated @@ -110,7 +110,7 @@ CONFIG(QTDIR_build) { !static: DEFINES += QT_MAKEDLL symbian: TARGET =$$TARGET$${QT_LIBINFIX} } -moduleFile=$$PWD/../../Source/WebKit/qt/qt_webkit_version.pri +moduleFile=$$PWD/../WebKit/qt/qt_webkit_version.pri isEmpty(QT_BUILD_TREE):include($$moduleFile) VERSION = $${QT_WEBKIT_MAJOR_VERSION}.$${QT_WEBKIT_MINOR_VERSION}.$${QT_WEBKIT_PATCH_VERSION} @@ -181,8 +181,8 @@ include($$PWD/../JavaScriptCore/JavaScriptCore.pri) !v8: addJavaScriptCoreLib(../JavaScriptCore) webkit2 { - include($$PWD/../../Source/WebKit2/WebKit2.pri) - addWebKit2LibWholeArchive(../../Source/WebKit2) + include($$PWD/../WebKit2/WebKit2.pri) + addWebKit2LibWholeArchive(../WebKit2) } # Extract sources to build from the generator definitions @@ -285,8 +285,8 @@ WEBCORE_INCLUDEPATH = \ $$PWD/platform/graphics/qt \ $$PWD/platform/network/qt \ $$PWD/platform/qt \ - $$PWD/../../Source/WebKit/qt/Api \ - $$PWD/../../Source/WebKit/qt/WebCoreSupport \ + $$PWD/../WebKit/qt/Api \ + $$PWD/../WebKit/qt/WebCoreSupport \ $$WEBCORE_INCLUDEPATH symbian { @@ -390,7 +390,6 @@ v8 { bindings/v8/V8AbstractEventListener.cpp \ bindings/v8/V8Binding.cpp \ bindings/v8/V8Collection.cpp \ - bindings/v8/V8ConsoleMessage.cpp \ bindings/v8/V8DOMMap.cpp \ bindings/v8/V8DOMWrapper.cpp \ bindings/v8/V8DataGridDataSource.cpp \ @@ -407,6 +406,7 @@ v8 { bindings/v8/V8NodeFilterCondition.cpp \ bindings/v8/V8Proxy.cpp \ bindings/v8/V8Utilities.cpp \ + bindings/v8/V8WindowErrorHandler.cpp \ bindings/v8/V8WorkerContextEventListener.cpp \ bindings/v8/WorkerContextExecutionProxy.cpp \ bindings/v8/WorkerScriptController.cpp \ @@ -548,6 +548,7 @@ v8 { bindings/js/JSDeviceOrientationEventCustom.cpp \ bindings/js/JSDocumentCustom.cpp \ bindings/js/JSElementCustom.cpp \ + bindings/js/JSErrorHandler.cpp \ bindings/js/JSEventCustom.cpp \ bindings/js/JSEventListener.cpp \ bindings/js/JSEventSourceCustom.cpp \ @@ -606,7 +607,6 @@ v8 { bindings/js/JSWebKitCSSKeyframesRuleCustom.cpp \ bindings/js/JSWebKitCSSMatrixCustom.cpp \ bindings/js/JSWebKitPointCustom.cpp \ - bindings/js/JSWorkerContextErrorHandler.cpp \ bindings/js/JSXMLHttpRequestCustom.cpp \ bindings/js/JSXMLHttpRequestUploadCustom.cpp \ bindings/js/ScheduledAction.cpp \ @@ -1060,6 +1060,7 @@ SOURCES += \ inspector/InspectorInstrumentation.cpp \ inspector/InspectorProfilerAgent.cpp \ inspector/InspectorResourceAgent.cpp \ + inspector/InspectorRuntimeAgent.cpp \ inspector/InspectorSettings.cpp \ inspector/InspectorState.cpp \ inspector/InspectorStyleSheet.cpp \ @@ -1210,6 +1211,7 @@ SOURCES += \ platform/graphics/Path.cpp \ platform/graphics/PathTraversalState.cpp \ platform/graphics/Pattern.cpp \ + platform/graphics/RoundedIntRect.cpp \ platform/graphics/SegmentedFontData.cpp \ platform/graphics/SimpleFontData.cpp \ platform/graphics/TiledBackingStore.cpp \ @@ -1253,9 +1255,9 @@ SOURCES += \ platform/network/ResourceResponseBase.cpp \ platform/text/RegularExpression.cpp \ platform/SchemeRegistry.cpp \ + platform/ScrollableArea.cpp \ platform/ScrollAnimator.cpp \ platform/Scrollbar.cpp \ - platform/ScrollbarClient.cpp \ platform/ScrollbarThemeComposite.cpp \ platform/ScrollView.cpp \ platform/text/SegmentedString.cpp \ @@ -1463,7 +1465,6 @@ v8 { bindings/v8/V8AbstractEventListener.h \ bindings/v8/V8Binding.h \ bindings/v8/V8Collection.h \ - bindings/v8/V8ConsoleMessage.h \ bindings/v8/V8DataGridDataSource.h \ bindings/v8/V8DOMMap.h \ bindings/v8/V8DOMWindowShell.h \ @@ -1480,6 +1481,7 @@ v8 { bindings/v8/V8NPUtils.h \ bindings/v8/V8Proxy.h \ bindings/v8/V8Utilities.h \ + bindings/v8/V8WindowErrorHandler.h \ bindings/v8/V8WorkerContextEventListener.h \ bindings/v8/WorkerContextExecutionProxy.h \ bindings/v8/WorkerScriptController.h \ @@ -1506,6 +1508,7 @@ v8 { bindings/js/JSDOMWindowCustom.h \ bindings/js/JSDOMWindowShell.h \ bindings/js/JSDOMWrapper.h \ + bindings/js/JSErrorHandler.h \ bindings/js/JSEventListener.h \ bindings/js/JSEventTarget.h \ bindings/js/JSHistoryCustom.h \ @@ -1523,7 +1526,6 @@ v8 { bindings/js/JSPluginElementFunctions.h \ bindings/js/JSStorageCustom.h \ bindings/js/JSWorkerContextBase.h \ - bindings/js/JSWorkerContextErrorHandler.h \ bindings/js/JavaScriptCallFrame.h \ bindings/js/ScheduledAction.h \ bindings/js/ScriptCachedFrameData.h \ @@ -1713,6 +1715,7 @@ HEADERS += \ dom/StyleElement.h \ dom/TagNodeList.h \ dom/TextEvent.h \ + dom/TextEventInputType.h \ dom/Text.h \ dom/Touch.h \ dom/TouchEvent.h \ @@ -1954,6 +1957,7 @@ HEADERS += \ inspector/InspectorInstrumentation.h \ inspector/InspectorProfilerAgent.h \ inspector/InspectorResourceAgent.h \ + inspector/InspectorRuntimeAgent.h \ inspector/InspectorSettings.h \ inspector/InspectorState.h \ inspector/InspectorStyleSheet.h \ @@ -2129,6 +2133,7 @@ HEADERS += \ platform/graphics/Path.h \ platform/graphics/PathTraversalState.h \ platform/graphics/Pattern.h \ + platform/graphics/RoundedIntRect.h \ platform/graphics/qt/FontCustomPlatformData.h \ platform/graphics/qt/ImageDecoderQt.h \ platform/graphics/qt/StillImageQt.h \ @@ -2189,9 +2194,9 @@ HEADERS += \ platform/qt/QtStyleOptionWebComboBox.h \ platform/qt/RenderThemeQt.h \ platform/qt/ScrollbarThemeQt.h \ + platform/ScrollableArea.h \ platform/ScrollAnimator.h \ platform/Scrollbar.h \ - platform/ScrollbarClient.h \ platform/ScrollbarThemeComposite.h \ platform/ScrollView.h \ platform/SearchPopupMenu.h \ @@ -2655,18 +2660,18 @@ HEADERS += \ xml/XSLTExtensions.h \ xml/XSLTProcessor.h \ xml/XSLTUnicodeSort.h \ - $$PWD/../../Source/WebKit/qt/Api/qwebplugindatabase_p.h \ - $$PWD/../../Source/WebKit/qt/WebCoreSupport/InspectorServerQt.h \ - $$PWD/../../Source/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.h \ - $$PWD/../../Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h \ - $$PWD/../../Source/WebKit/qt/WebCoreSupport/FrameNetworkingContextQt.h \ - $$PWD/../../Source/WebKit/qt/WebCoreSupport/GeolocationPermissionClientQt.h \ - $$PWD/../../Source/WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.h \ - $$PWD/../../Source/WebKit/qt/WebCoreSupport/PageClientQt.h \ - $$PWD/../../Source/WebKit/qt/WebCoreSupport/QtPlatformPlugin.h \ - $$PWD/../../Source/WebKit/qt/WebCoreSupport/PopupMenuQt.h \ - $$PWD/../../Source/WebKit/qt/WebCoreSupport/SearchPopupMenuQt.h \ - $$PWD/../../Source/WebKit/qt/WebCoreSupport/WebPlatformStrategies.h \ + $$PWD/../WebKit/qt/Api/qwebplugindatabase_p.h \ + $$PWD/../WebKit/qt/WebCoreSupport/InspectorServerQt.h \ + $$PWD/../WebKit/qt/WebCoreSupport/QtFallbackWebPopup.h \ + $$PWD/../WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h \ + $$PWD/../WebKit/qt/WebCoreSupport/FrameNetworkingContextQt.h \ + $$PWD/../WebKit/qt/WebCoreSupport/GeolocationPermissionClientQt.h \ + $$PWD/../WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.h \ + $$PWD/../WebKit/qt/WebCoreSupport/PageClientQt.h \ + $$PWD/../WebKit/qt/WebCoreSupport/QtPlatformPlugin.h \ + $$PWD/../WebKit/qt/WebCoreSupport/PopupMenuQt.h \ + $$PWD/../WebKit/qt/WebCoreSupport/SearchPopupMenuQt.h \ + $$PWD/../WebKit/qt/WebCoreSupport/WebPlatformStrategies.h \ $$PWD/platform/network/qt/DnsPrefetchHelper.h v8 { @@ -2754,39 +2759,39 @@ SOURCES += \ platform/text/qt/TextCodecQt.cpp \ platform/qt/WheelEventQt.cpp \ platform/qt/WidgetQt.cpp \ - ../../Source/WebKit/qt/WebCoreSupport/QtFallbackWebPopup.cpp \ - ../../Source/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp \ - ../../Source/WebKit/qt/WebCoreSupport/ContextMenuClientQt.cpp \ - ../../Source/WebKit/qt/WebCoreSupport/DragClientQt.cpp \ - ../../Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp \ - ../../Source/WebKit/qt/WebCoreSupport/EditorClientQt.cpp \ - ../../Source/WebKit/qt/WebCoreSupport/EditCommandQt.cpp \ - ../../Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp \ - ../../Source/WebKit/qt/WebCoreSupport/FrameNetworkingContextQt.cpp \ - ../../Source/WebKit/qt/WebCoreSupport/GeolocationPermissionClientQt.cpp \ - ../../Source/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp \ - ../../Source/WebKit/qt/WebCoreSupport/InspectorServerQt.cpp \ - ../../Source/WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.cpp \ - ../../Source/WebKit/qt/WebCoreSupport/PageClientQt.cpp \ - ../../Source/WebKit/qt/WebCoreSupport/PopupMenuQt.cpp \ - ../../Source/WebKit/qt/WebCoreSupport/QtPlatformPlugin.cpp \ - ../../Source/WebKit/qt/WebCoreSupport/SearchPopupMenuQt.cpp \ - ../../Source/WebKit/qt/WebCoreSupport/WebPlatformStrategies.cpp \ - ../../Source/WebKit/qt/Api/qwebframe.cpp \ - ../../Source/WebKit/qt/Api/qgraphicswebview.cpp \ - ../../Source/WebKit/qt/Api/qwebpage.cpp \ - ../../Source/WebKit/qt/Api/qwebview.cpp \ - ../../Source/WebKit/qt/Api/qwebelement.cpp \ - ../../Source/WebKit/qt/Api/qwebhistory.cpp \ - ../../Source/WebKit/qt/Api/qwebsettings.cpp \ - ../../Source/WebKit/qt/Api/qwebhistoryinterface.cpp \ - ../../Source/WebKit/qt/Api/qwebplugindatabase.cpp \ - ../../Source/WebKit/qt/Api/qwebpluginfactory.cpp \ - ../../Source/WebKit/qt/Api/qwebsecurityorigin.cpp \ - ../../Source/WebKit/qt/Api/qwebscriptworld.cpp \ - ../../Source/WebKit/qt/Api/qwebdatabase.cpp \ - ../../Source/WebKit/qt/Api/qwebinspector.cpp \ - ../../Source/WebKit/qt/Api/qwebkitversion.cpp + ../WebKit/qt/WebCoreSupport/QtFallbackWebPopup.cpp \ + ../WebKit/qt/WebCoreSupport/ChromeClientQt.cpp \ + ../WebKit/qt/WebCoreSupport/ContextMenuClientQt.cpp \ + ../WebKit/qt/WebCoreSupport/DragClientQt.cpp \ + ../WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp \ + ../WebKit/qt/WebCoreSupport/EditorClientQt.cpp \ + ../WebKit/qt/WebCoreSupport/EditCommandQt.cpp \ + ../WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp \ + ../WebKit/qt/WebCoreSupport/FrameNetworkingContextQt.cpp \ + ../WebKit/qt/WebCoreSupport/GeolocationPermissionClientQt.cpp \ + ../WebKit/qt/WebCoreSupport/InspectorClientQt.cpp \ + ../WebKit/qt/WebCoreSupport/InspectorServerQt.cpp \ + ../WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.cpp \ + ../WebKit/qt/WebCoreSupport/PageClientQt.cpp \ + ../WebKit/qt/WebCoreSupport/PopupMenuQt.cpp \ + ../WebKit/qt/WebCoreSupport/QtPlatformPlugin.cpp \ + ../WebKit/qt/WebCoreSupport/SearchPopupMenuQt.cpp \ + ../WebKit/qt/WebCoreSupport/WebPlatformStrategies.cpp \ + ../WebKit/qt/Api/qwebframe.cpp \ + ../WebKit/qt/Api/qgraphicswebview.cpp \ + ../WebKit/qt/Api/qwebpage.cpp \ + ../WebKit/qt/Api/qwebview.cpp \ + ../WebKit/qt/Api/qwebelement.cpp \ + ../WebKit/qt/Api/qwebhistory.cpp \ + ../WebKit/qt/Api/qwebsettings.cpp \ + ../WebKit/qt/Api/qwebhistoryinterface.cpp \ + ../WebKit/qt/Api/qwebplugindatabase.cpp \ + ../WebKit/qt/Api/qwebpluginfactory.cpp \ + ../WebKit/qt/Api/qwebsecurityorigin.cpp \ + ../WebKit/qt/Api/qwebscriptworld.cpp \ + ../WebKit/qt/Api/qwebdatabase.cpp \ + ../WebKit/qt/Api/qwebinspector.cpp \ + ../WebKit/qt/Api/qwebkitversion.cpp contains(DEFINES, WTF_USE_QT_MOBILE_THEME=1) { HEADERS += platform/qt/QtMobileWebStyle.h @@ -2794,8 +2799,8 @@ contains(DEFINES, WTF_USE_QT_MOBILE_THEME=1) { } maemo5 { - HEADERS += ../../Source/WebKit/qt/WebCoreSupport/QtMaemoWebPopup.h - SOURCES += ../../Source/WebKit/qt/WebCoreSupport/QtMaemoWebPopup.cpp + HEADERS += ../WebKit/qt/WebCoreSupport/QtMaemoWebPopup.h + SOURCES += ../WebKit/qt/WebCoreSupport/QtMaemoWebPopup.cpp } contains(DEFINES, ENABLE_SMOOTH_SCROLLING=1) { @@ -3259,11 +3264,11 @@ contains(DEFINES, ENABLE_VIDEO=1) { } else:contains(MOBILITY_CONFIG, multimedia) { HEADERS += \ platform/graphics/qt/MediaPlayerPrivateQt.h \ - $$PWD/../../Source/WebKit/qt/WebCoreSupport/FullScreenVideoQt.h + $$PWD/../WebKit/qt/WebCoreSupport/FullScreenVideoQt.h SOURCES += \ platform/graphics/qt/MediaPlayerPrivateQt.cpp \ - $$PWD/../../Source/WebKit/qt/WebCoreSupport/FullScreenVideoQt.cpp + $$PWD/../WebKit/qt/WebCoreSupport/FullScreenVideoQt.cpp CONFIG *= mobility MOBILITY += multimedia @@ -3449,18 +3454,18 @@ contains(DEFINES, ENABLE_GEOLOCATION=1) { contains(DEFINES, ENABLE_DEVICE_ORIENTATION=1) { HEADERS += \ - ../../Source/WebKit/qt/WebCoreSupport/DeviceMotionClientQt.h \ - ../../Source/WebKit/qt/WebCoreSupport/DeviceMotionProviderQt.h \ - ../../Source/WebKit/qt/WebCoreSupport/DeviceOrientationClientQt.h \ - ../../Source/WebKit/qt/WebCoreSupport/DeviceOrientationClientMockQt.h \ - ../../Source/WebKit/qt/WebCoreSupport/DeviceOrientationProviderQt.h + ../WebKit/qt/WebCoreSupport/DeviceMotionClientQt.h \ + ../WebKit/qt/WebCoreSupport/DeviceMotionProviderQt.h \ + ../WebKit/qt/WebCoreSupport/DeviceOrientationClientQt.h \ + ../WebKit/qt/WebCoreSupport/DeviceOrientationClientMockQt.h \ + ../WebKit/qt/WebCoreSupport/DeviceOrientationProviderQt.h SOURCES += \ - ../../Source/WebKit/qt/WebCoreSupport/DeviceMotionClientQt.cpp \ - ../../Source/WebKit/qt/WebCoreSupport/DeviceMotionProviderQt.cpp \ - ../../Source/WebKit/qt/WebCoreSupport/DeviceOrientationClientQt.cpp \ - ../../Source/WebKit/qt/WebCoreSupport/DeviceOrientationClientMockQt.cpp \ - ../../Source/WebKit/qt/WebCoreSupport/DeviceOrientationProviderQt.cpp + ../WebKit/qt/WebCoreSupport/DeviceMotionClientQt.cpp \ + ../WebKit/qt/WebCoreSupport/DeviceMotionProviderQt.cpp \ + ../WebKit/qt/WebCoreSupport/DeviceOrientationClientQt.cpp \ + ../WebKit/qt/WebCoreSupport/DeviceOrientationClientMockQt.cpp \ + ../WebKit/qt/WebCoreSupport/DeviceOrientationProviderQt.cpp CONFIG += mobility MOBILITY += sensors @@ -3805,6 +3810,7 @@ contains(DEFINES, ENABLE_3D_CANVAS=1) { html/canvas/WebGLRenderbuffer.h \ html/canvas/WebGLRenderingContext.h \ html/canvas/WebGLShader.h \ + html/canvas/OESStandardDerivatives.h \ html/canvas/OESTextureFloat.h \ html/canvas/WebGLTexture.h \ html/canvas/WebGLUniformLocation.h \ @@ -3829,6 +3835,7 @@ contains(DEFINES, ENABLE_3D_CANVAS=1) { html/canvas/WebGLRenderbuffer.cpp \ html/canvas/WebGLRenderingContext.cpp \ html/canvas/WebGLShader.cpp \ + html/canvas/OESStandardDerivatives.cpp \ html/canvas/OESTextureFloat.cpp \ html/canvas/WebGLTexture.cpp \ html/canvas/WebGLUniformLocation.cpp \ @@ -3865,7 +3872,7 @@ contains(DEFINES, ENABLE_SYMBIAN_DIALOG_PROVIDERS) { QMAKE_EXTRA_TARGETS += install } -include($$PWD/../../Source/WebKit/qt/Api/headers.pri) +include($$PWD/../WebKit/qt/Api/headers.pri) HEADERS += $$WEBKIT_API_HEADERS @@ -3993,9 +4000,9 @@ contains(CONFIG, texmap) { symbian { shared { contains(CONFIG, def_files) { - DEF_FILE=../../Source/WebKit/qt/symbian + DEF_FILE=../WebKit/qt/symbian # defFilePath is for Qt4.6 compatibility - defFilePath=../../Source/WebKit/qt/symbian + defFilePath=../WebKit/qt/symbian } else { MMP_RULES += EXPORTUNFROZEN } diff --git a/Source/WebCore/WebCore.vcproj/WebCore.vcproj b/Source/WebCore/WebCore.vcproj/WebCore.vcproj index 39671a0..f1da922 100755 --- a/Source/WebCore/WebCore.vcproj/WebCore.vcproj +++ b/Source/WebCore/WebCore.vcproj/WebCore.vcproj @@ -558,6 +558,10 @@ > </File> <File + RelativePath="$(ConfigurationBuildDir)\obj\$(ProjectName)\DerivedSources\InjectedScriptSource.h" + > + </File> + <File RelativePath="$(ConfigurationBuildDir)\obj\$(ProjectName)\DerivedSources\InspectorBackendDispatcher.cpp" > </File> @@ -574,10 +578,6 @@ > </File> <File - RelativePath="$(ConfigurationBuildDir)\obj\$(ProjectName)\DerivedSources\InjectedScriptSource.h" - > - </File> - <File RelativePath="$(ConfigurationBuildDir)\obj\WebCore\DerivedSources\JSAbstractWorker.cpp" > <FileConfiguration @@ -7726,6 +7726,62 @@ > </File> <File + RelativePath="$(ConfigurationBuildDir)\obj\$(ProjectName)\DerivedSources\JSHTMLKeygenElement.cpp" + > + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Cairo_CFLite|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release_Cairo_CFLite|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_All|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release_LTCG|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + </File> + <File + RelativePath="$(ConfigurationBuildDir)\obj\$(ProjectName)\DerivedSources\JSHTMLKeygenElement.h" + > + </File> + <File RelativePath="$(ConfigurationBuildDir)\obj\$(ProjectName)\DerivedSources\JSHTMLLabelElement.cpp" > <FileConfiguration @@ -24842,10 +24898,6 @@ Name="loader" > <File - RelativePath="..\loader\ResourceLoadScheduler.h" - > - </File> - <File RelativePath="..\loader\CrossOriginAccessControl.cpp" > </File> @@ -25074,6 +25126,10 @@ > </File> <File + RelativePath="..\loader\ResourceLoadScheduler.h" + > + </File> + <File RelativePath="..\loader\SinkDocument.cpp" > </File> @@ -25421,7 +25477,7 @@ RelativePath="..\platform\ContentType.h" > </File> - <File + <File RelativePath="..\platform\ContextMenu.cpp" > </File> @@ -25429,7 +25485,7 @@ RelativePath="..\platform\ContextMenu.h" > </File> - <File + <File RelativePath="..\platform\ContextMenuItem.cpp" > </File> @@ -25698,19 +25754,19 @@ > </File> <File - RelativePath="..\platform\Scrollbar.cpp" + RelativePath="..\platform\ScrollableArea.cpp" > </File> <File - RelativePath="..\platform\Scrollbar.h" + RelativePath="..\platform\ScrollableArea.h" > </File> <File - RelativePath="..\platform\ScrollbarClient.cpp" + RelativePath="..\platform\Scrollbar.cpp" > </File> <File - RelativePath="..\platform\ScrollbarClient.h" + RelativePath="..\platform\Scrollbar.h" > </File> <File @@ -26693,6 +26749,14 @@ > </File> <File + RelativePath="..\platform\graphics\RoundedIntRect.cpp" + > + </File> + <File + RelativePath="..\platform\graphics\RoundedIntRect.h" + > + </File> + <File RelativePath="..\platform\graphics\SegmentedFontData.cpp" > </File> @@ -27332,86 +27396,6 @@ > </File> <File - RelativePath="..\platform\graphics\win\WKCACFContextFlusher.cpp" - > - <FileConfiguration - Name="Debug_Cairo_CFLite|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="Release_Cairo_CFLite|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - </File> - <File - RelativePath="..\platform\graphics\win\WKCACFContextFlusher.h" - > - <FileConfiguration - Name="Debug_Cairo_CFLite|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCustomBuildTool" - /> - </FileConfiguration> - <FileConfiguration - Name="Release_Cairo_CFLite|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCustomBuildTool" - /> - </FileConfiguration> - </File> - <File - RelativePath="..\platform\graphics\win\WKCACFLayerRenderer.cpp" - > - <FileConfiguration - Name="Debug_Cairo_CFLite|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="Release_Cairo_CFLite|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - </File> - <File - RelativePath="..\platform\graphics\win\WKCACFLayerRenderer.h" - > - <FileConfiguration - Name="Debug_Cairo_CFLite|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCustomBuildTool" - /> - </FileConfiguration> - <FileConfiguration - Name="Release_Cairo_CFLite|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCustomBuildTool" - /> - </FileConfiguration> - </File> - <File RelativePath="..\platform\graphics\win\WKCAImageQueue.cpp" > <FileConfiguration @@ -28871,6 +28855,86 @@ Name="win" > <File + RelativePath="..\platform\graphics\ca\win\CACFLayerTreeHost.cpp" + > + <FileConfiguration + Name="Debug_Cairo_CFLite|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release_Cairo_CFLite|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\platform\graphics\ca\win\CACFLayerTreeHost.h" + > + <FileConfiguration + Name="Debug_Cairo_CFLite|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release_Cairo_CFLite|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\platform\graphics\ca\win\LayerChangesFlusher.cpp" + > + <FileConfiguration + Name="Debug_Cairo_CFLite|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release_Cairo_CFLite|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\platform\graphics\ca\win\LayerChangesFlusher.h" + > + <FileConfiguration + Name="Debug_Cairo_CFLite|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release_Cairo_CFLite|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCustomBuildTool" + /> + </FileConfiguration> + </File> + <File RelativePath="..\platform\graphics\ca\win\PlatformCAAnimationWin.cpp" > </File> @@ -28888,7 +28952,7 @@ </File> </Filter> </Filter> - </Filter> + </Filter> <Filter Name="network" > @@ -38464,88 +38528,88 @@ > </File> <Filter - Name="mathml" - > - <File - RelativePath="..\rendering\mathml\RenderMathMLBlock.cpp" - > - </File> - <File - RelativePath="..\rendering\mathml\RenderMathMLBlock.h" - > - </File> - <File - RelativePath="..\rendering\mathml\RenderMathMLFenced.cpp" - > - </File> - <File - RelativePath="..\rendering\mathml\RenderMathMLFenced.h" - > - </File> - <File - RelativePath="..\rendering\mathml\RenderMathMLFraction.cpp" - > - </File> - <File - RelativePath="..\rendering\mathml\RenderMathMLFraction.h" - > - </File> - <File - RelativePath="..\rendering\mathml\RenderMathMLMath.cpp" - > - </File> - <File - RelativePath="..\rendering\mathml\RenderMathMLMath.h" - > - </File> - <File - RelativePath="..\rendering\mathml\RenderMathMLOperator.cpp" - > - </File> - <File - RelativePath="..\rendering\mathml\RenderMathMLOperator.h" - > - </File> - <File - RelativePath="..\rendering\mathml\RenderMathMLRoot.cpp" - > - </File> - <File - RelativePath="..\rendering\mathml\RenderMathMLRoot.h" - > - </File> - <File - RelativePath="..\rendering\mathml\RenderMathMLRow.cpp" - > - </File> - <File - RelativePath="..\rendering\mathml\RenderMathMLRow.h" - > - </File> - <File - RelativePath="..\rendering\mathml\RenderMathMLSquareRoot.cpp" - > - </File> - <File - RelativePath="..\rendering\mathml\RenderMathMLSquareRoot.h" - > - </File> - <File - RelativePath="..\rendering\mathml\RenderMathMLSubSup.cpp" - > - </File> - <File - RelativePath="..\rendering\mathml\RenderMathMLSubSup.h" - > - </File> - <File - RelativePath="..\rendering\mathml\RenderMathMLUnderOver.cpp" - > - </File> - <File - RelativePath="..\rendering\mathml\RenderMathMLUnderOver.h" - > - </File> + Name="mathml" + > + <File + RelativePath="..\rendering\mathml\RenderMathMLBlock.cpp" + > + </File> + <File + RelativePath="..\rendering\mathml\RenderMathMLBlock.h" + > + </File> + <File + RelativePath="..\rendering\mathml\RenderMathMLFenced.cpp" + > + </File> + <File + RelativePath="..\rendering\mathml\RenderMathMLFenced.h" + > + </File> + <File + RelativePath="..\rendering\mathml\RenderMathMLFraction.cpp" + > + </File> + <File + RelativePath="..\rendering\mathml\RenderMathMLFraction.h" + > + </File> + <File + RelativePath="..\rendering\mathml\RenderMathMLMath.cpp" + > + </File> + <File + RelativePath="..\rendering\mathml\RenderMathMLMath.h" + > + </File> + <File + RelativePath="..\rendering\mathml\RenderMathMLOperator.cpp" + > + </File> + <File + RelativePath="..\rendering\mathml\RenderMathMLOperator.h" + > + </File> + <File + RelativePath="..\rendering\mathml\RenderMathMLRoot.cpp" + > + </File> + <File + RelativePath="..\rendering\mathml\RenderMathMLRoot.h" + > + </File> + <File + RelativePath="..\rendering\mathml\RenderMathMLRow.cpp" + > + </File> + <File + RelativePath="..\rendering\mathml\RenderMathMLRow.h" + > + </File> + <File + RelativePath="..\rendering\mathml\RenderMathMLSquareRoot.cpp" + > + </File> + <File + RelativePath="..\rendering\mathml\RenderMathMLSquareRoot.h" + > + </File> + <File + RelativePath="..\rendering\mathml\RenderMathMLSubSup.cpp" + > + </File> + <File + RelativePath="..\rendering\mathml\RenderMathMLSubSup.h" + > + </File> + <File + RelativePath="..\rendering\mathml\RenderMathMLUnderOver.cpp" + > + </File> + <File + RelativePath="..\rendering\mathml\RenderMathMLUnderOver.h" + > + </File> </Filter> <Filter Name="style" @@ -43633,7 +43697,7 @@ /> </FileConfiguration> <FileConfiguration - Name="Debug_Cairo_CFLite|Win32" + Name="Debug_All|Win32" ExcludedFromBuild="true" > <Tool @@ -43641,7 +43705,7 @@ /> </FileConfiguration> <FileConfiguration - Name="Release_Cairo_CFLite|Win32" + Name="Debug_Cairo_CFLite|Win32" ExcludedFromBuild="true" > <Tool @@ -43649,7 +43713,7 @@ /> </FileConfiguration> <FileConfiguration - Name="Debug_All|Win32" + Name="Release_Cairo_CFLite|Win32" ExcludedFromBuild="true" > <Tool @@ -43657,7 +43721,7 @@ /> </FileConfiguration> <FileConfiguration - Name="Release_LTCG|Win32" + Name="Debug_All|Win32" ExcludedFromBuild="true" > <Tool @@ -43670,7 +43734,7 @@ > </File> <File - RelativePath="..\dom\EventTarget.cpp" + RelativePath="..\dom\EventQueue.cpp" > <FileConfiguration Name="Debug|Win32" @@ -43705,7 +43769,7 @@ /> </FileConfiguration> <FileConfiguration - Name="Debug_All|Win32" + Name="Release_LTCG|Win32" ExcludedFromBuild="true" > <Tool @@ -43725,8 +43789,8 @@ RelativePath="..\dom\EventTarget.h" > </File> - <File - RelativePath="..\dom\EventQueue.cpp" + <File + RelativePath="..\dom\EventTarget.cpp" > <FileConfiguration Name="Debug|Win32" @@ -46186,6 +46250,10 @@ > </File> <File + RelativePath="..\dom\TextEventInputType.h" + > + </File> + <File RelativePath="..\dom\TransformSource.h" > </File> @@ -58133,6 +58201,62 @@ > </File> <File + RelativePath="..\bindings\js\JSErrorHandler.cpp" + > + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Cairo_CFLite|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release_Cairo_CFLite|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_All|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release_LTCG|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\bindings\js\JSErrorHandler.h" + > + </File> + <File RelativePath="..\bindings\js\JSEventCustom.cpp" > <FileConfiguration @@ -61649,62 +61773,6 @@ </FileConfiguration> </File> <File - RelativePath="..\bindings\js\JSWorkerContextErrorHandler.cpp" - > - <FileConfiguration - Name="Debug|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="Release|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="Debug_Cairo_CFLite|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="Release_Cairo_CFLite|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="Debug_All|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="Release_LTCG|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - </File> - <File - RelativePath="..\bindings\js\JSWorkerContextErrorHandler.h" - > - </File> - <File RelativePath="..\bindings\js\JSWorkerCustom.cpp" > <FileConfiguration @@ -65150,6 +65218,14 @@ > </File> <File + RelativePath="..\inspector\InspectorRuntimeAgent.cpp" + > + </File> + <File + RelativePath="..\inspector\InspectorRuntimeAgent.h" + > + </File> + <File RelativePath="..\inspector\InspectorSettings.cpp" > </File> @@ -65333,6 +65409,14 @@ > </File> <File + RelativePath="..\inspector\front-end\CSSCompletions.js" + > + </File> + <File + RelativePath="..\inspector\front-end\CSSKeywordCompletions.js" + > + </File> + <File RelativePath="..\inspector\front-end\CSSStyleModel.js" > </File> @@ -65457,10 +65541,6 @@ > </File> <File - RelativePath="..\inspector\front-end\InjectedScriptAccess.js" - > - </File> - <File RelativePath="..\inspector\front-end\inspector.css" > </File> @@ -65589,6 +65669,14 @@ > </File> <File + RelativePath="..\inspector\front-end\ScriptFormatter.js" + > + </File> + <File + RelativePath="..\inspector\front-end\scriptFormatterWorker.js" + > + </File> + <File RelativePath="..\inspector\front-end\ScriptsPanel.js" > </File> @@ -65724,6 +65812,14 @@ RelativePath="..\inspector\front-end\WorkersSidebarPane.js" > </File> + <File + RelativePath="..\inspector\front-end\UglifyJS\parse-js.js" + > + </File> + <File + RelativePath="..\inspector\front-end\UglifyJS\process.js" + > + </File> </Filter> </Filter> <Filter diff --git a/Source/WebCore/WebCore.vcproj/WebCoreQuartzCore.vsprops b/Source/WebCore/WebCore.vcproj/WebCoreQuartzCore.vsprops index a9866d9..48328c9 100644 --- a/Source/WebCore/WebCore.vcproj/WebCoreQuartzCore.vsprops +++ b/Source/WebCore/WebCore.vcproj/WebCoreQuartzCore.vsprops @@ -6,7 +6,7 @@ > <Tool Name="VCCLCompilerTool" - AdditionalIncludeDirectories=""$(DXSDK_DIR)\Include"" + AdditionalIncludeDirectories=""$(ProjectDir)\..\platform\graphics\ca\win";"$(DXSDK_DIR)\Include"" PreprocessorDefinitions="QUARTZCORE_DLL" /> </VisualStudioPropertySheet> diff --git a/Source/WebCore/WebCore.vcproj/copyForwardingHeaders.cmd b/Source/WebCore/WebCore.vcproj/copyForwardingHeaders.cmd index 7393d34..b3f19c6 100755 --- a/Source/WebCore/WebCore.vcproj/copyForwardingHeaders.cmd +++ b/Source/WebCore/WebCore.vcproj/copyForwardingHeaders.cmd @@ -39,6 +39,7 @@ xcopy /y /d "%ProjectDir%..\platform\graphics\*.h" "%CONFIGURATIONBUILDDIR%\incl xcopy /y /d "%ProjectDir%..\platform\graphics\%1\*.h" "%CONFIGURATIONBUILDDIR%\include\WebCore" xcopy /y /d "%ProjectDir%..\platform\graphics\transforms\*.h" "%CONFIGURATIONBUILDDIR%\include\WebCore" xcopy /y /d "%ProjectDir%..\platform\graphics\ca\*.h" "%CONFIGURATIONBUILDDIR%\include\WebCore" +xcopy /y /d "%ProjectDir%..\platform\graphics\ca\win\*.h" "%CONFIGURATIONBUILDDIR%\include\WebCore" xcopy /y /d "%ProjectDir%..\platform\graphics\win\*.h" "%CONFIGURATIONBUILDDIR%\include\WebCore" xcopy /y /d "%ProjectDir%..\platform\graphics\win\%1\*.h" "%CONFIGURATIONBUILDDIR%\include\WebCore" xcopy /y /d "%ProjectDir%..\platform\graphics\opentype\*.h" "%CONFIGURATIONBUILDDIR%\include\WebCore" diff --git a/Source/WebCore/WebCore.xcodeproj/project.pbxproj b/Source/WebCore/WebCore.xcodeproj/project.pbxproj index ed86c67..4f01530 100644 --- a/Source/WebCore/WebCore.xcodeproj/project.pbxproj +++ b/Source/WebCore/WebCore.xcodeproj/project.pbxproj @@ -1664,9 +1664,11 @@ 7A74ECBA101839A600BF939E /* InspectorDOMStorageAgent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7A74ECB8101839A500BF939E /* InspectorDOMStorageAgent.cpp */; }; 7A74ECBB101839A600BF939E /* InspectorDOMStorageAgent.h in Headers */ = {isa = PBXBuildFile; fileRef = 7A74ECB9101839A600BF939E /* InspectorDOMStorageAgent.h */; }; 7A74ECBD101839DA00BF939E /* JSInspectorFrontendHostCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7A74ECBC101839DA00BF939E /* JSInspectorFrontendHostCustom.cpp */; }; + 7AA365EE12E7265400DCA242 /* InspectorRuntimeAgent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7AA365ED12E7265400DCA242 /* InspectorRuntimeAgent.cpp */; }; 7AB0B1C01211A62200A76940 /* InspectorDatabaseAgent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7AB0B1BE1211A62200A76940 /* InspectorDatabaseAgent.cpp */; }; 7AB0B1C11211A62200A76940 /* InspectorDatabaseAgent.h in Headers */ = {isa = PBXBuildFile; fileRef = 7AB0B1BF1211A62200A76940 /* InspectorDatabaseAgent.h */; }; 7ADE722610CBBB9B006B3B3A /* ContextMenuProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 7ADE722510CBBB9B006B3B3A /* ContextMenuProvider.h */; }; + 7AF11A5A12E727490061F23C /* InspectorRuntimeAgent.h in Headers */ = {isa = PBXBuildFile; fileRef = 7AF11A5912E727490061F23C /* InspectorRuntimeAgent.h */; }; 7AFD4A8B1131C2760035B883 /* ScriptBreakpoint.h in Headers */ = {isa = PBXBuildFile; fileRef = 7AFD4A8A1131C2760035B883 /* ScriptBreakpoint.h */; settings = {ATTRIBUTES = (Private, ); }; }; 7AFD4FF4113277B60035B883 /* ScriptDebugListener.h in Headers */ = {isa = PBXBuildFile; fileRef = 7AFD4FF3113277B60035B883 /* ScriptDebugListener.h */; settings = {ATTRIBUTES = (Private, ); }; }; 7E33CD01127F340D00BE8F17 /* PurgePriority.h in Headers */ = {isa = PBXBuildFile; fileRef = 7E33CD00127F340D00BE8F17 /* PurgePriority.h */; settings = {ATTRIBUTES = (Private, ); }; }; @@ -2758,6 +2760,11 @@ 8F67561B1288B17B0047ACA3 /* EventQueue.h in Headers */ = {isa = PBXBuildFile; fileRef = 8F6756191288B17B0047ACA3 /* EventQueue.h */; }; 8F67561C1288B17B0047ACA3 /* EventQueue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8F67561A1288B17B0047ACA3 /* EventQueue.cpp */; }; 8FAC774D119872CB0015AE94 /* JSMainThreadExecState.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8F934D841189F1EE00508D5D /* JSMainThreadExecState.cpp */; }; + 9001774012E0347800648462 /* OESStandardDerivatives.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9001773D12E0347800648462 /* OESStandardDerivatives.cpp */; }; + 9001774112E0347800648462 /* OESStandardDerivatives.h in Headers */ = {isa = PBXBuildFile; fileRef = 9001773E12E0347800648462 /* OESStandardDerivatives.h */; }; + 9001774212E0347800648462 /* OESStandardDerivatives.idl in Resources */ = {isa = PBXBuildFile; fileRef = 9001773F12E0347800648462 /* OESStandardDerivatives.idl */; }; + 9001788012E0370700648462 /* JSOESStandardDerivatives.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9001787E12E0370700648462 /* JSOESStandardDerivatives.cpp */; }; + 9001788112E0370700648462 /* JSOESStandardDerivatives.h in Headers */ = {isa = PBXBuildFile; fileRef = 9001787F12E0370700648462 /* JSOESStandardDerivatives.h */; }; 9302B0BD0D79F82900C7EE83 /* PageGroup.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9302B0BC0D79F82900C7EE83 /* PageGroup.cpp */; }; 9302B0BF0D79F82C00C7EE83 /* PageGroup.h in Headers */ = {isa = PBXBuildFile; fileRef = 9302B0BE0D79F82C00C7EE83 /* PageGroup.h */; settings = {ATTRIBUTES = (Private, ); }; }; 9305B24D098F1B6B00C28855 /* Timer.h in Headers */ = {isa = PBXBuildFile; fileRef = 9305B24C098F1B6B00C28855 /* Timer.h */; settings = {ATTRIBUTES = (Private, ); }; }; @@ -3157,12 +3164,19 @@ A59E3C1F11580F510072928E /* KeyEventIPhone.mm in Sources */ = {isa = PBXBuildFile; fileRef = A59E3C1D11580F510072928E /* KeyEventIPhone.mm */; }; A5AFB34F115151A700B045CB /* StepRange.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A5AFB34D115151A700B045CB /* StepRange.cpp */; }; A5AFB350115151A700B045CB /* StepRange.h in Headers */ = {isa = PBXBuildFile; fileRef = A5AFB34E115151A700B045CB /* StepRange.h */; }; + A6148A6212E41D3A0044A784 /* DOMHTMLKeygenElementInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = A6148A6112E41D3A0044A784 /* DOMHTMLKeygenElementInternal.h */; }; + A6148A6712E41D940044A784 /* DOMHTMLKeygenElement.h in Headers */ = {isa = PBXBuildFile; fileRef = A6148A6512E41D940044A784 /* DOMHTMLKeygenElement.h */; }; + A6148A6812E41D940044A784 /* DOMHTMLKeygenElement.mm in Sources */ = {isa = PBXBuildFile; fileRef = A6148A6612E41D940044A784 /* DOMHTMLKeygenElement.mm */; }; + A6148A7812E41E3B0044A784 /* JSHTMLKeygenElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A6148A7612E41E3B0044A784 /* JSHTMLKeygenElement.cpp */; }; + A6148A7912E41E3B0044A784 /* JSHTMLKeygenElement.h in Headers */ = {isa = PBXBuildFile; fileRef = A6148A7712E41E3B0044A784 /* JSHTMLKeygenElement.h */; }; A622A8FB122C44A600A785B3 /* BindingSecurity.h in Headers */ = {isa = PBXBuildFile; fileRef = A622A8F5122C44A600A785B3 /* BindingSecurity.h */; }; A622A8FC122C44A600A785B3 /* BindingSecurityBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A622A8F6122C44A600A785B3 /* BindingSecurityBase.cpp */; }; A622A8FD122C44A600A785B3 /* BindingSecurityBase.h in Headers */ = {isa = PBXBuildFile; fileRef = A622A8F7122C44A600A785B3 /* BindingSecurityBase.h */; }; A622A8FF122C44A600A785B3 /* GenericBinding.h in Headers */ = {isa = PBXBuildFile; fileRef = A622A8F9122C44A600A785B3 /* GenericBinding.h */; }; A718760E0B2A120100A16ECE /* DragActions.h in Headers */ = {isa = PBXBuildFile; fileRef = A718760D0B2A120100A16ECE /* DragActions.h */; settings = {ATTRIBUTES = (Private, ); }; }; A71878900B2D04AC00A16ECE /* DragControllerMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = A718788F0B2D04AC00A16ECE /* DragControllerMac.mm */; }; + A73F95FE12C97BFE0031AAF9 /* RoundedIntRect.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A73F95FC12C97BFE0031AAF9 /* RoundedIntRect.cpp */; }; + A73F95FF12C97BFE0031AAF9 /* RoundedIntRect.h in Headers */ = {isa = PBXBuildFile; fileRef = A73F95FD12C97BFE0031AAF9 /* RoundedIntRect.h */; settings = {ATTRIBUTES = (Private, ); }; }; A75E497610752ACB00C9B896 /* SerializedScriptValue.h in Headers */ = {isa = PBXBuildFile; fileRef = A75E497410752ACB00C9B896 /* SerializedScriptValue.h */; settings = {ATTRIBUTES = (Private, ); }; }; A75E497710752ACB00C9B896 /* SerializedScriptValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A75E497510752ACB00C9B896 /* SerializedScriptValue.cpp */; }; A75E8B880E1DE2D6007F2481 /* FEBlend.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A75E8B800E1DE2D6007F2481 /* FEBlend.cpp */; }; @@ -3177,6 +3191,7 @@ A779791A0D6B9D0C003851B9 /* ImageData.h in Headers */ = {isa = PBXBuildFile; fileRef = A77979140D6B9D0C003851B9 /* ImageData.h */; }; A77979280D6B9E64003851B9 /* JSImageData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A77979240D6B9E64003851B9 /* JSImageData.cpp */; }; A77979290D6B9E64003851B9 /* JSImageData.h in Headers */ = {isa = PBXBuildFile; fileRef = A77979250D6B9E64003851B9 /* JSImageData.h */; }; + A77B41A012E675A90054343D /* TextEventInputType.h in Headers */ = {isa = PBXBuildFile; fileRef = A77B419F12E675A90054343D /* TextEventInputType.h */; settings = {ATTRIBUTES = (Private, ); }; }; A784941B0B5FE507001E237A /* Clipboard.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A784941A0B5FE507001E237A /* Clipboard.cpp */; }; A78FE13B12366B1000ACE8D0 /* SpellChecker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A78FE13912366B1000ACE8D0 /* SpellChecker.cpp */; }; A78FE13C12366B1000ACE8D0 /* SpellChecker.h in Headers */ = {isa = PBXBuildFile; fileRef = A78FE13A12366B1000ACE8D0 /* SpellChecker.h */; settings = {ATTRIBUTES = (Private, ); }; }; @@ -5044,6 +5059,8 @@ BC82432A0D0CE8A200460C8F /* JSSQLTransaction.h in Headers */ = {isa = PBXBuildFile; fileRef = BC8243260D0CE8A200460C8F /* JSSQLTransaction.h */; }; BC8243E80D0CFD7500460C8F /* WindowFeatures.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC8243E60D0CFD7500460C8F /* WindowFeatures.cpp */; }; BC8243E90D0CFD7500460C8F /* WindowFeatures.h in Headers */ = {isa = PBXBuildFile; fileRef = BC8243E70D0CFD7500460C8F /* WindowFeatures.h */; settings = {ATTRIBUTES = (Private, ); }; }; + BC8AE34E12EA096A00EB3AE6 /* ScrollableArea.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC8AE34C12EA096A00EB3AE6 /* ScrollableArea.cpp */; }; + BC8AE34F12EA096A00EB3AE6 /* ScrollableArea.h in Headers */ = {isa = PBXBuildFile; fileRef = BC8AE34D12EA096A00EB3AE6 /* ScrollableArea.h */; settings = {ATTRIBUTES = (Private, ); }; }; BC8B853E0E7C7F1100AB6984 /* ScrollbarThemeMac.h in Headers */ = {isa = PBXBuildFile; fileRef = BC8B853C0E7C7F1100AB6984 /* ScrollbarThemeMac.h */; }; BC8B854B0E7C7F5600AB6984 /* ScrollbarTheme.h in Headers */ = {isa = PBXBuildFile; fileRef = BC8B854A0E7C7F5600AB6984 /* ScrollbarTheme.h */; settings = {ATTRIBUTES = (Private, ); }; }; BC8BF151105813BF00A40A07 /* UserStyleSheet.h in Headers */ = {isa = PBXBuildFile; fileRef = BC8BF150105813BF00A40A07 /* UserStyleSheet.h */; settings = {ATTRIBUTES = (Private, ); }; }; @@ -5078,8 +5095,6 @@ BC99812E0DBE807A008CE9EF /* DOMAbstractViewFrame.h in Headers */ = {isa = PBXBuildFile; fileRef = BC99812D0DBE807A008CE9EF /* DOMAbstractViewFrame.h */; }; BC9ADD230CC4032600098C4C /* WebKitCSSTransformValue.h in Headers */ = {isa = PBXBuildFile; fileRef = BC9ADD220CC4032600098C4C /* WebKitCSSTransformValue.h */; settings = {ATTRIBUTES = (Private, ); }; }; BC9ADD800CC4092200098C4C /* WebKitCSSTransformValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC9ADD7F0CC4092200098C4C /* WebKitCSSTransformValue.cpp */; }; - BC9BC64D0E7C4889008B9849 /* ScrollbarClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC9BC64B0E7C4889008B9849 /* ScrollbarClient.cpp */; settings = {ATTRIBUTES = (Private, ); }; }; - BC9BC64E0E7C4889008B9849 /* ScrollbarClient.h in Headers */ = {isa = PBXBuildFile; fileRef = BC9BC64C0E7C4889008B9849 /* ScrollbarClient.h */; settings = {ATTRIBUTES = (Private, ); }; }; BCA169A20BFD55B40019CA76 /* JSHTMLTableCaptionElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCA169A00BFD55B40019CA76 /* JSHTMLTableCaptionElement.cpp */; }; BCA169A30BFD55B40019CA76 /* JSHTMLTableCaptionElement.h in Headers */ = {isa = PBXBuildFile; fileRef = BCA169A10BFD55B40019CA76 /* JSHTMLTableCaptionElement.h */; }; BCA257151293C010007A263D /* VerticalPositionCache.h in Headers */ = {isa = PBXBuildFile; fileRef = BCA257141293C010007A263D /* VerticalPositionCache.h */; }; @@ -5609,8 +5624,8 @@ F392249D126F11AE00A926D9 /* ScriptCallStackFactory.h in Headers */ = {isa = PBXBuildFile; fileRef = F392249B126F11AE00A926D9 /* ScriptCallStackFactory.h */; }; F39BE95B12673BF400E0A674 /* ScriptArguments.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F39BE95912673BF400E0A674 /* ScriptArguments.cpp */; }; F39BE95C12673BF400E0A674 /* ScriptArguments.h in Headers */ = {isa = PBXBuildFile; fileRef = F39BE95A12673BF400E0A674 /* ScriptArguments.h */; }; - F3D461481161D53200CA0D09 /* JSWorkerContextErrorHandler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F3D461461161D53200CA0D09 /* JSWorkerContextErrorHandler.cpp */; }; - F3D461491161D53200CA0D09 /* JSWorkerContextErrorHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = F3D461471161D53200CA0D09 /* JSWorkerContextErrorHandler.h */; }; + F3D461481161D53200CA0D09 /* JSErrorHandler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F3D461461161D53200CA0D09 /* JSErrorHandler.cpp */; }; + F3D461491161D53200CA0D09 /* JSErrorHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = F3D461471161D53200CA0D09 /* JSErrorHandler.h */; }; F3D4C47812E07663003DA150 /* InspectorBrowserDebuggerAgent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F3D4C47612E07663003DA150 /* InspectorBrowserDebuggerAgent.cpp */; }; F3D4C47912E07663003DA150 /* InspectorBrowserDebuggerAgent.h in Headers */ = {isa = PBXBuildFile; fileRef = F3D4C47712E07663003DA150 /* InspectorBrowserDebuggerAgent.h */; }; F4EAF4AE10C742B1009100D3 /* OpenTypeSanitizer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F4EAF4AC10C742B1009100D3 /* OpenTypeSanitizer.cpp */; }; @@ -8086,9 +8101,11 @@ 7A74ECB8101839A500BF939E /* InspectorDOMStorageAgent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorDOMStorageAgent.cpp; sourceTree = "<group>"; }; 7A74ECB9101839A600BF939E /* InspectorDOMStorageAgent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorDOMStorageAgent.h; sourceTree = "<group>"; }; 7A74ECBC101839DA00BF939E /* JSInspectorFrontendHostCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSInspectorFrontendHostCustom.cpp; sourceTree = "<group>"; }; + 7AA365ED12E7265400DCA242 /* InspectorRuntimeAgent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorRuntimeAgent.cpp; sourceTree = "<group>"; }; 7AB0B1BE1211A62200A76940 /* InspectorDatabaseAgent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorDatabaseAgent.cpp; sourceTree = "<group>"; }; 7AB0B1BF1211A62200A76940 /* InspectorDatabaseAgent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorDatabaseAgent.h; sourceTree = "<group>"; }; 7ADE722510CBBB9B006B3B3A /* ContextMenuProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ContextMenuProvider.h; sourceTree = "<group>"; }; + 7AF11A5912E727490061F23C /* InspectorRuntimeAgent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorRuntimeAgent.h; sourceTree = "<group>"; }; 7AFD4A8A1131C2760035B883 /* ScriptBreakpoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptBreakpoint.h; sourceTree = "<group>"; }; 7AFD4FF3113277B60035B883 /* ScriptDebugListener.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptDebugListener.h; sourceTree = "<group>"; }; 7E33CD00127F340D00BE8F17 /* PurgePriority.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PurgePriority.h; sourceTree = "<group>"; }; @@ -9135,6 +9152,11 @@ 8F67561A1288B17B0047ACA3 /* EventQueue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EventQueue.cpp; sourceTree = "<group>"; }; 8F934D831189F1EE00508D5D /* JSMainThreadExecState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSMainThreadExecState.h; sourceTree = "<group>"; }; 8F934D841189F1EE00508D5D /* JSMainThreadExecState.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSMainThreadExecState.cpp; sourceTree = "<group>"; }; + 9001773D12E0347800648462 /* OESStandardDerivatives.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = OESStandardDerivatives.cpp; path = canvas/OESStandardDerivatives.cpp; sourceTree = "<group>"; }; + 9001773E12E0347800648462 /* OESStandardDerivatives.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OESStandardDerivatives.h; path = canvas/OESStandardDerivatives.h; sourceTree = "<group>"; }; + 9001773F12E0347800648462 /* OESStandardDerivatives.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = OESStandardDerivatives.idl; path = canvas/OESStandardDerivatives.idl; sourceTree = "<group>"; }; + 9001787E12E0370700648462 /* JSOESStandardDerivatives.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSOESStandardDerivatives.cpp; sourceTree = "<group>"; }; + 9001787F12E0370700648462 /* JSOESStandardDerivatives.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSOESStandardDerivatives.h; sourceTree = "<group>"; }; 9302B0BC0D79F82900C7EE83 /* PageGroup.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PageGroup.cpp; sourceTree = "<group>"; }; 9302B0BE0D79F82C00C7EE83 /* PageGroup.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PageGroup.h; sourceTree = "<group>"; }; 9305B24C098F1B6B00C28855 /* Timer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Timer.h; sourceTree = "<group>"; }; @@ -9526,6 +9548,12 @@ A5AFB34E115151A700B045CB /* StepRange.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StepRange.h; sourceTree = "<group>"; }; A5C974CF11485FF10066F2AB /* KeyEventCocoa.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = KeyEventCocoa.h; path = cocoa/KeyEventCocoa.h; sourceTree = "<group>"; }; A5C974D011485FF10066F2AB /* KeyEventCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = KeyEventCocoa.mm; path = cocoa/KeyEventCocoa.mm; sourceTree = "<group>"; }; + A6148A6112E41D3A0044A784 /* DOMHTMLKeygenElementInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMHTMLKeygenElementInternal.h; sourceTree = "<group>"; }; + A6148A6512E41D940044A784 /* DOMHTMLKeygenElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMHTMLKeygenElement.h; sourceTree = "<group>"; }; + A6148A6612E41D940044A784 /* DOMHTMLKeygenElement.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DOMHTMLKeygenElement.mm; sourceTree = "<group>"; }; + A6148A7612E41E3B0044A784 /* JSHTMLKeygenElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLKeygenElement.cpp; sourceTree = "<group>"; }; + A6148A7712E41E3B0044A784 /* JSHTMLKeygenElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSHTMLKeygenElement.h; sourceTree = "<group>"; }; + A6148A7F12E41ED10044A784 /* HTMLKeygenElement.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = HTMLKeygenElement.idl; sourceTree = "<group>"; }; A622A8F5122C44A600A785B3 /* BindingSecurity.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BindingSecurity.h; path = generic/BindingSecurity.h; sourceTree = "<group>"; }; A622A8F6122C44A600A785B3 /* BindingSecurityBase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = BindingSecurityBase.cpp; path = generic/BindingSecurityBase.cpp; sourceTree = "<group>"; }; A622A8F7122C44A600A785B3 /* BindingSecurityBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BindingSecurityBase.h; path = generic/BindingSecurityBase.h; sourceTree = "<group>"; }; @@ -9533,6 +9561,8 @@ A718760D0B2A120100A16ECE /* DragActions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DragActions.h; sourceTree = "<group>"; }; A718788F0B2D04AC00A16ECE /* DragControllerMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DragControllerMac.mm; sourceTree = "<group>"; }; A71A70C911AFB02000989D6D /* HTMLMeterElement.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = HTMLMeterElement.idl; sourceTree = "<group>"; }; + A73F95FC12C97BFE0031AAF9 /* RoundedIntRect.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RoundedIntRect.cpp; sourceTree = "<group>"; }; + A73F95FD12C97BFE0031AAF9 /* RoundedIntRect.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RoundedIntRect.h; sourceTree = "<group>"; }; A75E497410752ACB00C9B896 /* SerializedScriptValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SerializedScriptValue.h; sourceTree = "<group>"; }; A75E497510752ACB00C9B896 /* SerializedScriptValue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SerializedScriptValue.cpp; sourceTree = "<group>"; }; A75E8B800E1DE2D6007F2481 /* FEBlend.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = FEBlend.cpp; path = filters/FEBlend.cpp; sourceTree = "<group>"; }; @@ -9548,6 +9578,7 @@ A77979150D6B9D0C003851B9 /* ImageData.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ImageData.idl; sourceTree = "<group>"; }; A77979240D6B9E64003851B9 /* JSImageData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSImageData.cpp; sourceTree = "<group>"; }; A77979250D6B9E64003851B9 /* JSImageData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSImageData.h; sourceTree = "<group>"; }; + A77B419F12E675A90054343D /* TextEventInputType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextEventInputType.h; sourceTree = "<group>"; }; A784941A0B5FE507001E237A /* Clipboard.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Clipboard.cpp; sourceTree = "<group>"; }; A78FE13912366B1000ACE8D0 /* SpellChecker.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SpellChecker.cpp; sourceTree = "<group>"; }; A78FE13A12366B1000ACE8D0 /* SpellChecker.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; fileEncoding = 4; path = SpellChecker.h; sourceTree = "<group>"; }; @@ -11336,6 +11367,8 @@ BC8243260D0CE8A200460C8F /* JSSQLTransaction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSSQLTransaction.h; sourceTree = "<group>"; }; BC8243E60D0CFD7500460C8F /* WindowFeatures.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WindowFeatures.cpp; sourceTree = "<group>"; }; BC8243E70D0CFD7500460C8F /* WindowFeatures.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WindowFeatures.h; sourceTree = "<group>"; }; + BC8AE34C12EA096A00EB3AE6 /* ScrollableArea.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScrollableArea.cpp; sourceTree = "<group>"; }; + BC8AE34D12EA096A00EB3AE6 /* ScrollableArea.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScrollableArea.h; sourceTree = "<group>"; }; BC8B853C0E7C7F1100AB6984 /* ScrollbarThemeMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScrollbarThemeMac.h; sourceTree = "<group>"; }; BC8B854A0E7C7F5600AB6984 /* ScrollbarTheme.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScrollbarTheme.h; sourceTree = "<group>"; }; BC8BF150105813BF00A40A07 /* UserStyleSheet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UserStyleSheet.h; sourceTree = "<group>"; }; @@ -11373,8 +11406,6 @@ BC99812D0DBE807A008CE9EF /* DOMAbstractViewFrame.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMAbstractViewFrame.h; sourceTree = "<group>"; }; BC9ADD220CC4032600098C4C /* WebKitCSSTransformValue.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = WebKitCSSTransformValue.h; sourceTree = "<group>"; }; BC9ADD7F0CC4092200098C4C /* WebKitCSSTransformValue.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = WebKitCSSTransformValue.cpp; sourceTree = "<group>"; }; - BC9BC64B0E7C4889008B9849 /* ScrollbarClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScrollbarClient.cpp; sourceTree = "<group>"; }; - BC9BC64C0E7C4889008B9849 /* ScrollbarClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScrollbarClient.h; sourceTree = "<group>"; }; BCA169A00BFD55B40019CA76 /* JSHTMLTableCaptionElement.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLTableCaptionElement.cpp; sourceTree = "<group>"; }; BCA169A10BFD55B40019CA76 /* JSHTMLTableCaptionElement.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSHTMLTableCaptionElement.h; sourceTree = "<group>"; }; BCA257141293C010007A263D /* VerticalPositionCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VerticalPositionCache.h; sourceTree = "<group>"; }; @@ -11394,7 +11425,7 @@ BCA8CA5D11E4E6D100812FB7 /* BackForwardListImpl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BackForwardListImpl.cpp; sourceTree = "<group>"; }; BCA8CA5E11E4E6D100812FB7 /* BackForwardListImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BackForwardListImpl.h; sourceTree = "<group>"; }; BCA979161215D055005C485C /* ImageBufferData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageBufferData.h; sourceTree = "<group>"; }; - BCAA90C20A7EBA60008B1229 /* Scrollbar.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = Scrollbar.cpp; path = platform/Scrollbar.cpp; sourceTree = SOURCE_ROOT; }; + BCAA90C20A7EBA60008B1229 /* Scrollbar.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Scrollbar.cpp; sourceTree = "<group>"; }; BCACF3BA1072921A00C0C8A3 /* UserContentURLPattern.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UserContentURLPattern.cpp; sourceTree = "<group>"; }; BCACF3BB1072921A00C0C8A3 /* UserContentURLPattern.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UserContentURLPattern.h; sourceTree = "<group>"; }; BCAE1FA512939DB7004CB026 /* ScrollAnimatorMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScrollAnimatorMac.h; sourceTree = "<group>"; }; @@ -11953,8 +11984,8 @@ F392249B126F11AE00A926D9 /* ScriptCallStackFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptCallStackFactory.h; sourceTree = "<group>"; }; F39BE95912673BF400E0A674 /* ScriptArguments.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScriptArguments.cpp; sourceTree = "<group>"; }; F39BE95A12673BF400E0A674 /* ScriptArguments.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptArguments.h; sourceTree = "<group>"; }; - F3D461461161D53200CA0D09 /* JSWorkerContextErrorHandler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWorkerContextErrorHandler.cpp; sourceTree = "<group>"; }; - F3D461471161D53200CA0D09 /* JSWorkerContextErrorHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSWorkerContextErrorHandler.h; sourceTree = "<group>"; }; + F3D461461161D53200CA0D09 /* JSErrorHandler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSErrorHandler.cpp; sourceTree = "<group>"; }; + F3D461471161D53200CA0D09 /* JSErrorHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSErrorHandler.h; sourceTree = "<group>"; }; F3D4C47612E07663003DA150 /* InspectorBrowserDebuggerAgent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorBrowserDebuggerAgent.cpp; sourceTree = "<group>"; }; F3D4C47712E07663003DA150 /* InspectorBrowserDebuggerAgent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorBrowserDebuggerAgent.h; sourceTree = "<group>"; }; F4EAF4AC10C742B1009100D3 /* OpenTypeSanitizer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = OpenTypeSanitizer.cpp; path = opentype/OpenTypeSanitizer.cpp; sourceTree = "<group>"; }; @@ -12936,8 +12967,6 @@ 7A0E76F710BF08ED00A0276E /* InjectedScriptHost.h */, 7A0E76F810BF08ED00A0276E /* InjectedScriptHost.idl */, 7A563F9512DF5C9100F4536D /* InjectedScriptSource.js */, - 7A5640BD12DF9E5E00F4536D /* InspectorSettings.cpp */, - 7A5640BE12DF9E5E00F4536D /* InspectorSettings.h */, B885E8D211E06DD2009FFBF4 /* InspectorApplicationCacheAgent.cpp */, B885E8D311E06DD2009FFBF4 /* InspectorApplicationCacheAgent.h */, F3D4C47612E07663003DA150 /* InspectorBrowserDebuggerAgent.cpp */, @@ -12976,6 +13005,10 @@ 9F0D6B2D121BFEBA006C0288 /* InspectorProfilerAgent.h */, 82AB1771125C826700C5069D /* InspectorResourceAgent.cpp */, 82AB1772125C826700C5069D /* InspectorResourceAgent.h */, + 7AA365ED12E7265400DCA242 /* InspectorRuntimeAgent.cpp */, + 7AF11A5912E727490061F23C /* InspectorRuntimeAgent.h */, + 7A5640BD12DF9E5E00F4536D /* InspectorSettings.cpp */, + 7A5640BE12DF9E5E00F4536D /* InspectorSettings.h */, 4FA3B908125CD12100300BAD /* InspectorState.cpp */, 4FA3B909125CD12200300BAD /* InspectorState.h */, 82AB176F125C826700C5069D /* InspectorStyleSheet.cpp */, @@ -13267,6 +13300,9 @@ 49C7B9AC1042D32E0009D447 /* Int8Array.h */, 49C7B9AD1042D32E0009D447 /* Int8Array.idl */, 6E96BB1A11986EE1007D94CD /* IntegralTypedArrayBase.h */, + 9001773D12E0347800648462 /* OESStandardDerivatives.cpp */, + 9001773E12E0347800648462 /* OESStandardDerivatives.h */, + 9001773F12E0347800648462 /* OESStandardDerivatives.idl */, 6EBF0E4512A8926100DB1709 /* OESTextureFloat.cpp */, 6EBF0E4612A8926100DB1709 /* OESTextureFloat.h */, 6EBF0E4712A8926100DB1709 /* OESTextureFloat.idl */, @@ -13867,7 +13903,6 @@ 1CE24F960D7CAF0E007E04C2 /* SchedulePairMac.mm */, BCAE1FA512939DB7004CB026 /* ScrollAnimatorMac.h */, BC51156D12B1749C00C96754 /* ScrollAnimatorMac.mm */, - BCAA90C20A7EBA60008B1229 /* Scrollbar.cpp */, BC8B853C0E7C7F1100AB6984 /* ScrollbarThemeMac.h */, BCEF869E0E844E9D00A85CD5 /* ScrollbarThemeMac.mm */, 9353676A09AED88B00D35CD6 /* ScrollViewMac.mm */, @@ -14828,6 +14863,8 @@ 1CCA732110ADD43E00FD440D /* DOMHTMLInputElementPrivate.h */, 859A9C410AA5E3BD00B694B2 /* DOMHTMLIsIndexElement.h */, 859A9C420AA5E3BD00B694B2 /* DOMHTMLIsIndexElement.mm */, + A6148A6512E41D940044A784 /* DOMHTMLKeygenElement.h */, + A6148A6612E41D940044A784 /* DOMHTMLKeygenElement.mm */, 85BA4CD90AA6861B0088052D /* DOMHTMLLabelElement.h */, 85BA4CDA0AA6861B0088052D /* DOMHTMLLabelElement.mm */, 85BA4CDB0AA6861B0088052D /* DOMHTMLLegendElement.h */, @@ -14963,6 +15000,7 @@ 85E711630AC5D5350053270F /* DOMHTMLImageElementInternal.h */, 85E711640AC5D5350053270F /* DOMHTMLInputElementInternal.h */, 85E711650AC5D5350053270F /* DOMHTMLIsIndexElementInternal.h */, + A6148A6112E41D3A0044A784 /* DOMHTMLKeygenElementInternal.h */, 85E711660AC5D5350053270F /* DOMHTMLLabelElementInternal.h */, 85E711670AC5D5350053270F /* DOMHTMLLegendElementInternal.h */, 85E711680AC5D5350053270F /* DOMHTMLLIElementInternal.h */, @@ -15576,6 +15614,7 @@ 1AE2AA850A1CDCCE00B42B25 /* HTMLIsIndexElement.idl */, A81369C9097374F600D74463 /* HTMLKeygenElement.cpp */, A81369C8097374F500D74463 /* HTMLKeygenElement.h */, + A6148A7F12E41ED10044A784 /* HTMLKeygenElement.idl */, A81369C7097374F500D74463 /* HTMLLabelElement.cpp */, A81369C6097374F500D74463 /* HTMLLabelElement.h */, 1AE2AABE0A1CDD8300B42B25 /* HTMLLabelElement.idl */, @@ -16082,6 +16121,8 @@ A80E7E8D0A1A83E3007FB8C5 /* JSHTMLInputElement.h */, 1AE2AA950A1CDD2D00B42B25 /* JSHTMLIsIndexElement.cpp */, 1AE2AA960A1CDD2D00B42B25 /* JSHTMLIsIndexElement.h */, + A6148A7612E41E3B0044A784 /* JSHTMLKeygenElement.cpp */, + A6148A7712E41E3B0044A784 /* JSHTMLKeygenElement.h */, 1AE2AB170A1CE63B00B42B25 /* JSHTMLLabelElement.cpp */, 1AE2AB180A1CE63B00B42B25 /* JSHTMLLabelElement.h */, 1AE2AB190A1CE63B00B42B25 /* JSHTMLLegendElement.cpp */, @@ -16164,6 +16205,8 @@ 49C7B9831042D2D30009D447 /* JSInt8Array.h */, E44614100CD6826900FADA75 /* JSMediaError.cpp */, E44614110CD6826900FADA75 /* JSMediaError.h */, + 9001787E12E0370700648462 /* JSOESStandardDerivatives.cpp */, + 9001787F12E0370700648462 /* JSOESStandardDerivatives.h */, 6EBF0E7412A9868800DB1709 /* JSOESTextureFloat.cpp */, 6EBF0E7512A9868800DB1709 /* JSOESTextureFloat.h */, BCEF45F30E687B5C001C1287 /* JSTextMetrics.cpp */, @@ -17460,6 +17503,8 @@ A88DD4860B4629A300C02990 /* PathTraversalState.h */, A8FA6E5C0E4CFDED00D5CF49 /* Pattern.cpp */, A8FA6E5B0E4CFDED00D5CF49 /* Pattern.h */, + A73F95FC12C97BFE0031AAF9 /* RoundedIntRect.cpp */, + A73F95FD12C97BFE0031AAF9 /* RoundedIntRect.h */, 371F4FFB0D25E7F300ECE0D5 /* SegmentedFontData.cpp */, 371F4FFA0D25E7F300ECE0D5 /* SegmentedFontData.h */, B2C3DA530D006CD600EF6F26 /* SimpleFontData.cpp */, @@ -17675,6 +17720,8 @@ BCBFB53B0DCD29CF0019B3E5 /* JSDOMWindowShell.h */, BC53DAC611433064000D817E /* JSDOMWrapper.cpp */, 65E0E9431133C89F00B4CB10 /* JSDOMWrapper.h */, + F3D461461161D53200CA0D09 /* JSErrorHandler.cpp */, + F3D461471161D53200CA0D09 /* JSErrorHandler.h */, BC60901E0E91B8EC000C68B5 /* JSEventTarget.cpp */, BC60901D0E91B8EC000C68B5 /* JSEventTarget.h */, 3314ACE910892086000F0E56 /* JSExceptionBase.cpp */, @@ -17686,8 +17733,6 @@ 14CD8D81106B529000A46D23 /* JSSharedWorkerCustom.cpp */, E1C36D320EB0A094007410BC /* JSWorkerContextBase.cpp */, E1C36D330EB0A094007410BC /* JSWorkerContextBase.h */, - F3D461461161D53200CA0D09 /* JSWorkerContextErrorHandler.cpp */, - F3D461471161D53200CA0D09 /* JSWorkerContextErrorHandler.h */, BCA378BA0D15F64200B793D6 /* ScheduledAction.cpp */, BCA378BB0D15F64200B793D6 /* ScheduledAction.h */, 41F1D21E0EF35C2A00DA8753 /* ScriptCachedFrameData.cpp */, @@ -18245,11 +18290,12 @@ 1C63A2460F71646600C09D5A /* RunLoopTimer.h */, 5162C7F211F77EFA00612EFE /* SchemeRegistry.cpp */, 5162C7F311F77EFB00612EFE /* SchemeRegistry.h */, + BC8AE34C12EA096A00EB3AE6 /* ScrollableArea.cpp */, + BC8AE34D12EA096A00EB3AE6 /* ScrollableArea.h */, CA3BF67B10D99BAE00E6CE53 /* ScrollAnimator.cpp */, CA3BF67D10D99BAE00E6CE53 /* ScrollAnimator.h */, + BCAA90C20A7EBA60008B1229 /* Scrollbar.cpp */, BC7B2AF80450824100A8000F /* Scrollbar.h */, - BC9BC64B0E7C4889008B9849 /* ScrollbarClient.cpp */, - BC9BC64C0E7C4889008B9849 /* ScrollbarClient.h */, BC8B854A0E7C7F5600AB6984 /* ScrollbarTheme.h */, BC1402880E83680800319717 /* ScrollbarThemeComposite.cpp */, BC1402890E83680800319717 /* ScrollbarThemeComposite.h */, @@ -19079,6 +19125,7 @@ 933A142B0B7D188600A53FFD /* TextEvent.cpp */, 933A142D0B7D188600A53FFD /* TextEvent.h */, 933A142C0B7D188600A53FFD /* TextEvent.idl */, + A77B419F12E675A90054343D /* TextEventInputType.h */, 5DB1BC6810715A6400EFAA49 /* TransformSource.h */, 5DB1BC6910715A6400EFAA49 /* TransformSourceLibxslt.cpp */, 854FE72C0A2297BE0058D7AD /* Traversal.cpp */, @@ -19855,6 +19902,8 @@ 85E711B30AC5D5350053270F /* DOMHTMLInputElementInternal.h in Headers */, 859A9C4B0AA5E3BD00B694B2 /* DOMHTMLIsIndexElement.h in Headers */, 85E711B40AC5D5350053270F /* DOMHTMLIsIndexElementInternal.h in Headers */, + A6148A6712E41D940044A784 /* DOMHTMLKeygenElement.h in Headers */, + A6148A6212E41D3A0044A784 /* DOMHTMLKeygenElementInternal.h in Headers */, 85BA4CE10AA6861B0088052D /* DOMHTMLLabelElement.h in Headers */, 85E711B50AC5D5350053270F /* DOMHTMLLabelElementInternal.h in Headers */, 85BA4CE30AA6861B0088052D /* DOMHTMLLegendElement.h in Headers */, @@ -20434,6 +20483,7 @@ 850B41C30AD9E7E700A6ED4F /* DOMTreeWalkerInternal.h in Headers */, 85C7F4910AAF79DC004014DD /* DOMUIEvent.h in Headers */, 85989DD00ACC8BBD00A0BC51 /* DOMUIEventInternal.h in Headers */, + 2E37DFDB12DBAFB800A6B233 /* DOMURL.h in Headers */, 15C770A6100D41CD005BA267 /* DOMValidityState.h in Headers */, BC1A37C0097C715F0019F3D8 /* DOMViews.h in Headers */, 31C0FF490E4CEFDD007D6FE5 /* DOMWebKitAnimationEvent.h in Headers */, @@ -20833,6 +20883,7 @@ 93309DF2099E64920056E581 /* InsertTextCommand.h in Headers */, B885E8D511E06DD2009FFBF4 /* InspectorApplicationCacheAgent.h in Headers */, 4F707A9A11EF679400ACDA69 /* InspectorBackendDispatcher.h in Headers */, + F3D4C47912E07663003DA150 /* InspectorBrowserDebuggerAgent.h in Headers */, 1C81B95C0E97330800266E07 /* InspectorClient.h in Headers */, F3335BF912E07DC300D33011 /* InspectorConsoleAgent.h in Headers */, 1C81B95A0E97330800266E07 /* InspectorController.h in Headers */, @@ -20850,6 +20901,8 @@ 20D629271253690B00081543 /* InspectorInstrumentation.h in Headers */, 9F0D6B2F121BFEBA006C0288 /* InspectorProfilerAgent.h in Headers */, 82AB1776125C826700C5069D /* InspectorResourceAgent.h in Headers */, + 7AF11A5A12E727490061F23C /* InspectorRuntimeAgent.h in Headers */, + 7A5640C012DF9E5E00F4536D /* InspectorSettings.h in Headers */, 4FA3B90B125CD12200300BAD /* InspectorState.h in Headers */, 82AB1774125C826700C5069D /* InspectorStyleSheet.h in Headers */, 754133A8102E00E800075D00 /* InspectorTimelineAgent.h in Headers */, @@ -20973,6 +21026,7 @@ C5137CF311A58378004ADB99 /* JSDOMStringList.h in Headers */, BC64649811D82349006455B0 /* JSDOMStringMap.h in Headers */, 7694563D1214D97C0007CBAE /* JSDOMTokenList.h in Headers */, + 2E37E00612DBC5A400A6B233 /* JSDOMURL.h in Headers */, BC6932740D7E293900AE44D1 /* JSDOMWindowBase.h in Headers */, 652FBBBC0DE27CB60001D386 /* JSDOMWindowCustom.h in Headers */, BCBFB53D0DCD29CF0019B3E5 /* JSDOMWindowShell.h in Headers */, @@ -20988,6 +21042,7 @@ 893C483B12495472002B3D86 /* JSEntrySync.h in Headers */, 898785AF122CA2A7003AABDA /* JSErrorCallback.h in Headers */, 2ECF7ADD10162B3800427DE7 /* JSErrorEvent.h in Headers */, + F3D461491161D53200CA0D09 /* JSErrorHandler.h in Headers */, 14E8378E09F85D4F00B85AE4 /* JSEvent.h in Headers */, BC60D9C00D2A269A00B9918F /* JSEventException.h in Headers */, 93B70D6A09EB0C7C009D8468 /* JSEventListener.h in Headers */, @@ -21055,6 +21110,7 @@ A80E7E970A1A83E3007FB8C5 /* JSHTMLInputElement.h in Headers */, E1AD14231295EA7F00ACA989 /* JSHTMLInputElementCustom.h in Headers */, 1AE2AA9A0A1CDD2D00B42B25 /* JSHTMLIsIndexElement.h in Headers */, + A6148A7912E41E3B0044A784 /* JSHTMLKeygenElement.h in Headers */, 1AE2AB220A1CE63B00B42B25 /* JSHTMLLabelElement.h in Headers */, 1AE2AB240A1CE63B00B42B25 /* JSHTMLLegendElement.h in Headers */, 1AE2AB260A1CE63B00B42B25 /* JSHTMLLIElement.h in Headers */, @@ -21143,6 +21199,7 @@ 65DF31FE09D1CC60000BE325 /* JSNotation.h in Headers */, 33503CA410179AD7003B47E1 /* JSNotification.h in Headers */, 33503CA610179AD7003B47E1 /* JSNotificationCenter.h in Headers */, + 9001788112E0370700648462 /* JSOESStandardDerivatives.h in Headers */, 6EBF0E7712A9868800DB1709 /* JSOESTextureFloat.h in Headers */, A826E8AE0A1A8F2300CD1BB6 /* JSOptionConstructor.h in Headers */, 1A0D57410A5C7867007EDD4C /* JSOverflowEvent.h in Headers */, @@ -21352,7 +21409,6 @@ E1CAA5C60E8BD23600A73ECA /* JSWorker.h in Headers */, E18256900EF2B02D00933242 /* JSWorkerContext.h in Headers */, E1C36D350EB0A094007410BC /* JSWorkerContextBase.h in Headers */, - F3D461491161D53200CA0D09 /* JSWorkerContextErrorHandler.h in Headers */, E1C362EF0EAF2AA9007410BC /* JSWorkerLocation.h in Headers */, E1271A580EEECDE400F61213 /* JSWorkerNavigator.h in Headers */, BC348BD40DB7F804004ABAB9 /* JSXMLHttpRequest.h in Headers */, @@ -21487,6 +21543,7 @@ 1CF6BDFA0E9BB26A0025E1CD /* ObjCEventListener.h in Headers */, 1CF6BE150E9BB4670025E1CD /* ObjCNodeFilterCondition.h in Headers */, E16982551134629D00894115 /* ObjCRuntimeObject.h in Headers */, + 9001774112E0347800648462 /* OESStandardDerivatives.h in Headers */, 6EBF0E4912A8926100DB1709 /* OESTextureFloat.h in Headers */, F4EAF4AF10C742B1009100D3 /* OpenTypeSanitizer.h in Headers */, 087281560F26B9B600AFC596 /* OptionElement.h in Headers */, @@ -21726,6 +21783,7 @@ BC74DA371013F3F7007987AD /* RGBColor.h in Headers */, A8CFF5E10A155A05000A4234 /* RootInlineBox.h in Headers */, 49E911C90EF86D47009D0CAF /* RotateTransformOperation.h in Headers */, + A73F95FF12C97BFE0031AAF9 /* RoundedIntRect.h in Headers */, 1C63A2480F71646600C09D5A /* RunLoopTimer.h in Headers */, 1A569D1F0D7E2B82007C3983 /* runtime_array.h in Headers */, 1A569D210D7E2B82007C3983 /* runtime_method.h in Headers */, @@ -21769,7 +21827,6 @@ CA3BF67E10D99BAE00E6CE53 /* ScrollAnimator.h in Headers */, BCAE1FA712939DB7004CB026 /* ScrollAnimatorMac.h in Headers */, 93F199B808245E59001E9ABC /* Scrollbar.h in Headers */, - BC9BC64E0E7C4889008B9849 /* ScrollbarClient.h in Headers */, BC8B854B0E7C7F5600AB6984 /* ScrollbarTheme.h in Headers */, BC14028B0E83680800319717 /* ScrollbarThemeComposite.h in Headers */, BC8B853E0E7C7F1100AB6984 /* ScrollbarThemeMac.h in Headers */, @@ -22138,6 +22195,7 @@ C105DA640F3AA6B8001DD44F /* TextEncodingDetector.h in Headers */, B2C3DA490D006C1D00EF6F26 /* TextEncodingRegistry.h in Headers */, 933A14300B7D188600A53FFD /* TextEvent.h in Headers */, + A77B41A012E675A90054343D /* TextEventInputType.h in Headers */, F55B3DD81251F12D003EF269 /* TextFieldInputType.h in Headers */, 93309E18099E64920056E581 /* TextGranularity.h in Headers */, F55B3DDA1251F12D003EF269 /* TextInputType.h in Headers */, @@ -22352,10 +22410,7 @@ 93F199ED08245E59001E9ABC /* XSLTProcessor.h in Headers */, E1BE512E0CF6C512002EA959 /* XSLTUnicodeSort.h in Headers */, 97DD4D870FDF4D6E00ECF9A4 /* XSSAuditor.h in Headers */, - 2E37DFDB12DBAFB800A6B233 /* DOMURL.h in Headers */, - 2E37E00612DBC5A400A6B233 /* JSDOMURL.h in Headers */, - 7A5640C012DF9E5E00F4536D /* InspectorSettings.h in Headers */, - F3D4C47912E07663003DA150 /* InspectorBrowserDebuggerAgent.h in Headers */, + BC8AE34F12EA096A00EB3AE6 /* ScrollableArea.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -22468,6 +22523,7 @@ 85136CA20AED665900F90A3D /* northWestResizeCursor.png in Resources */, 85136CA30AED665900F90A3D /* northWestSouthEastResizeCursor.png in Resources */, 464EA2740B8A350B00A8E6E3 /* notAllowedCursor.png in Resources */, + 9001774212E0347800648462 /* OESStandardDerivatives.idl in Resources */, 46F9D5DF0B0D60170028EE36 /* progressCursor.png in Resources */, 85136CA40AED665900F90A3D /* southEastResizeCursor.png in Resources */, 85136CA50AED665900F90A3D /* southResizeCursor.png in Resources */, @@ -23020,6 +23076,7 @@ 85DF812A0AA7787200486AD7 /* DOMHTMLImageElement.mm in Sources */, 85F32AED0AA63B8700FF3184 /* DOMHTMLInputElement.mm in Sources */, 859A9C4C0AA5E3BD00B694B2 /* DOMHTMLIsIndexElement.mm in Sources */, + A6148A6812E41D940044A784 /* DOMHTMLKeygenElement.mm in Sources */, 85BA4CE20AA6861B0088052D /* DOMHTMLLabelElement.mm in Sources */, 85BA4CE40AA6861B0088052D /* DOMHTMLLegendElement.mm in Sources */, 85BA4D120AA688680088052D /* DOMHTMLLIElement.mm in Sources */, @@ -23227,6 +23284,7 @@ 76FC2B0B12370DA0006A991A /* DOMTokenList.cpp in Sources */, 85526CD30AB0B7DA000302EA /* DOMTreeWalker.mm in Sources */, 85C7F4920AAF79DC004014DD /* DOMUIEvent.mm in Sources */, + 2E37DFDA12DBAFB800A6B233 /* DOMURL.cpp in Sources */, BC1A37BF097C715F0019F3D8 /* DOMUtility.mm in Sources */, 15C770A5100D41CD005BA267 /* DOMValidityState.mm in Sources */, 31C0FF4A0E4CEFDD007D6FE5 /* DOMWebKitAnimationEvent.mm in Sources */, @@ -23566,6 +23624,7 @@ 93309DF1099E64920056E581 /* InsertTextCommand.cpp in Sources */, B885E8D411E06DD2009FFBF4 /* InspectorApplicationCacheAgent.cpp in Sources */, 4F707A9911EF679400ACDA69 /* InspectorBackendDispatcher.cpp in Sources */, + F3D4C47812E07663003DA150 /* InspectorBrowserDebuggerAgent.cpp in Sources */, 7A1F2B52126C61B20006A7E6 /* InspectorClient.cpp in Sources */, F3335BF812E07DC300D33011 /* InspectorConsoleAgent.cpp in Sources */, 1C81B95B0E97330800266E07 /* InspectorController.cpp in Sources */, @@ -23583,6 +23642,8 @@ 20D629261253690B00081543 /* InspectorInstrumentation.cpp in Sources */, 9F0D6B2E121BFEBA006C0288 /* InspectorProfilerAgent.cpp in Sources */, 82AB1775125C826700C5069D /* InspectorResourceAgent.cpp in Sources */, + 7AA365EE12E7265400DCA242 /* InspectorRuntimeAgent.cpp in Sources */, + 7A5640BF12DF9E5E00F4536D /* InspectorSettings.cpp in Sources */, 4FA3B90A125CD12200300BAD /* InspectorState.cpp in Sources */, 82AB1773125C826700C5069D /* InspectorStyleSheet.cpp in Sources */, 754133AA102E00F400075D00 /* InspectorTimelineAgent.cpp in Sources */, @@ -23742,6 +23803,7 @@ BC64649711D82349006455B0 /* JSDOMStringMap.cpp in Sources */, BC64649C11D8238C006455B0 /* JSDOMStringMapCustom.cpp in Sources */, 7694563C1214D97C0007CBAE /* JSDOMTokenList.cpp in Sources */, + 2E37E00512DBC5A400A6B233 /* JSDOMURL.cpp in Sources */, 1403BA0C09EB18C700797C7F /* JSDOMWindow.cpp in Sources */, BC6932730D7E293900AE44D1 /* JSDOMWindowBase.cpp in Sources */, BCD9C2620C17AA67005C90A2 /* JSDOMWindowCustom.cpp in Sources */, @@ -23761,6 +23823,7 @@ 893C485312499B06002B3D86 /* JSEntrySyncCustom.cpp in Sources */, 898785AE122CA2A7003AABDA /* JSErrorCallback.cpp in Sources */, 2ECF7ADC10162B3800427DE7 /* JSErrorEvent.cpp in Sources */, + F3D461481161D53200CA0D09 /* JSErrorHandler.cpp in Sources */, 14E8378409F85D1C00B85AE4 /* JSEvent.cpp in Sources */, BCEFAF4E0C317E6900FA81F6 /* JSEventCustom.cpp in Sources */, BC60D9BF0D2A269A00B9918F /* JSEventException.cpp in Sources */, @@ -23843,6 +23906,7 @@ A80E7E980A1A83E3007FB8C5 /* JSHTMLInputElement.cpp in Sources */, BCC438780E886CC700533DD5 /* JSHTMLInputElementCustom.cpp in Sources */, 1AE2AA990A1CDD2D00B42B25 /* JSHTMLIsIndexElement.cpp in Sources */, + A6148A7812E41E3B0044A784 /* JSHTMLKeygenElement.cpp in Sources */, 1AE2AB210A1CE63B00B42B25 /* JSHTMLLabelElement.cpp in Sources */, 1AE2AB230A1CE63B00B42B25 /* JSHTMLLegendElement.cpp in Sources */, 1AE2AB250A1CE63B00B42B25 /* JSHTMLLIElement.cpp in Sources */, @@ -23955,6 +24019,7 @@ 65DF31FD09D1CC60000BE325 /* JSNotation.cpp in Sources */, 33503CA310179AD7003B47E1 /* JSNotification.cpp in Sources */, 33503CA510179AD7003B47E1 /* JSNotificationCenter.cpp in Sources */, + 9001788012E0370700648462 /* JSOESStandardDerivatives.cpp in Sources */, 6EBF0E7612A9868800DB1709 /* JSOESTextureFloat.cpp in Sources */, A826EC480A1B0CBE00CD1BB6 /* JSOptionConstructor.cpp in Sources */, 1A0D57400A5C7867007EDD4C /* JSOverflowEvent.cpp in Sources */, @@ -24189,7 +24254,6 @@ E182568F0EF2B02D00933242 /* JSWorkerContext.cpp in Sources */, E1C36D340EB0A094007410BC /* JSWorkerContextBase.cpp in Sources */, E18258AC0EF3CD7000933242 /* JSWorkerContextCustom.cpp in Sources */, - F3D461481161D53200CA0D09 /* JSWorkerContextErrorHandler.cpp in Sources */, E1CA5CBC0E8CDCAF00E8EF90 /* JSWorkerCustom.cpp in Sources */, E1C362F00EAF2AA9007410BC /* JSWorkerLocation.cpp in Sources */, E1271A590EEECDE400F61213 /* JSWorkerNavigator.cpp in Sources */, @@ -24309,6 +24373,7 @@ 1CF6BDFB0E9BB26A0025E1CD /* ObjCEventListener.mm in Sources */, 1CF6BE140E9BB4670025E1CD /* ObjCNodeFilterCondition.mm in Sources */, E16982601134636A00894115 /* ObjCRuntimeObject.mm in Sources */, + 9001774012E0347800648462 /* OESStandardDerivatives.cpp in Sources */, 6EBF0E4812A8926100DB1709 /* OESTextureFloat.cpp in Sources */, F4EAF4AE10C742B1009100D3 /* OpenTypeSanitizer.cpp in Sources */, 087281550F26B9B600AFC596 /* OptionElement.cpp in Sources */, @@ -24517,6 +24582,7 @@ BC74DA381013F3F7007987AD /* RGBColor.cpp in Sources */, A8CFF5E70A155A05000A4234 /* RootInlineBox.cpp in Sources */, 49E911C80EF86D47009D0CAF /* RotateTransformOperation.cpp in Sources */, + A73F95FE12C97BFE0031AAF9 /* RoundedIntRect.cpp in Sources */, 1C63A2490F71646600C09D5A /* RunLoopTimerCF.cpp in Sources */, 1A569D1E0D7E2B82007C3983 /* runtime_array.cpp in Sources */, 1A569D200D7E2B82007C3983 /* runtime_method.cpp in Sources */, @@ -24555,7 +24621,6 @@ CA3BF67C10D99BAE00E6CE53 /* ScrollAnimator.cpp in Sources */, BC51156E12B1749C00C96754 /* ScrollAnimatorMac.mm in Sources */, BCAA90C30A7EBA60008B1229 /* Scrollbar.cpp in Sources */, - BC9BC64D0E7C4889008B9849 /* ScrollbarClient.cpp in Sources */, BC14028A0E83680800319717 /* ScrollbarThemeComposite.cpp in Sources */, BCEF869F0E844E9D00A85CD5 /* ScrollbarThemeMac.mm in Sources */, 5D925B670F64D4DD00B847F0 /* ScrollBehavior.cpp in Sources */, @@ -25040,10 +25105,7 @@ 93F19B0508245E59001E9ABC /* XSLTProcessorLibxslt.cpp in Sources */, E1BE512D0CF6C512002EA959 /* XSLTUnicodeSort.cpp in Sources */, 97DD4D860FDF4D6E00ECF9A4 /* XSSAuditor.cpp in Sources */, - 2E37DFDA12DBAFB800A6B233 /* DOMURL.cpp in Sources */, - 2E37E00512DBC5A400A6B233 /* JSDOMURL.cpp in Sources */, - 7A5640BF12DF9E5E00F4536D /* InspectorSettings.cpp in Sources */, - F3D4C47812E07663003DA150 /* InspectorBrowserDebuggerAgent.cpp in Sources */, + BC8AE34E12EA096A00EB3AE6 /* ScrollableArea.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/Source/WebCore/accessibility/AXObjectCache.h b/Source/WebCore/accessibility/AXObjectCache.h index 670d6e0..00e7fbc 100644 --- a/Source/WebCore/accessibility/AXObjectCache.h +++ b/Source/WebCore/accessibility/AXObjectCache.h @@ -60,7 +60,8 @@ struct TextMarkerData { enum PostType { PostSynchronously, PostAsynchronously }; -class AXObjectCache : public Noncopyable { +class AXObjectCache { + WTF_MAKE_NONCOPYABLE(AXObjectCache); WTF_MAKE_FAST_ALLOCATED; public: AXObjectCache(const Document*); ~AXObjectCache(); diff --git a/Source/WebCore/accessibility/AccessibilityObject.cpp b/Source/WebCore/accessibility/AccessibilityObject.cpp index 511bd3f..f2a2d7d 100644 --- a/Source/WebCore/accessibility/AccessibilityObject.cpp +++ b/Source/WebCore/accessibility/AccessibilityObject.cpp @@ -1013,8 +1013,9 @@ AccessibilityObject* AccessibilityObject::elementAccessibilityHitTest(const IntP // Send the hit test back into the sub-frame if necessary. if (isAttachment()) { Widget* widget = widgetForAttachmentView(); + // Normalize the point for the widget's bounds. if (widget && widget->isFrameView()) - return axObjectCache()->getOrCreate(static_cast<ScrollView*>(widget))->accessibilityHitTest(point); + return axObjectCache()->getOrCreate(widget)->accessibilityHitTest(IntPoint(point - widget->frameRect().location())); } return const_cast<AccessibilityObject*>(this); diff --git a/Source/WebCore/accessibility/AccessibilityObject.h b/Source/WebCore/accessibility/AccessibilityObject.h index 45b54fc..c8d887b 100644 --- a/Source/WebCore/accessibility/AccessibilityObject.h +++ b/Source/WebCore/accessibility/AccessibilityObject.h @@ -31,7 +31,6 @@ #define AccessibilityObject_h #include "IntRect.h" -#include "Range.h" #include "VisiblePosition.h" #include "VisibleSelection.h" #include <wtf/Forward.h> diff --git a/Source/WebCore/accessibility/AccessibilityRenderObject.cpp b/Source/WebCore/accessibility/AccessibilityRenderObject.cpp index 8b0c5ca..ca8d4a7 100644 --- a/Source/WebCore/accessibility/AccessibilityRenderObject.cpp +++ b/Source/WebCore/accessibility/AccessibilityRenderObject.cpp @@ -1772,6 +1772,10 @@ bool AccessibilityRenderObject::accessibilityIsIgnored() const if (!isAllowedChildOfTree()) return true; + // Allow the platform to decide if the attachment is ignored or not. + if (isAttachment()) + return accessibilityIgnoreAttachment(); + // ignore popup menu items because AppKit does for (RenderObject* parent = m_renderer->parent(); parent; parent = parent->parent()) { if (parent->isBoxModelObject() && toRenderBoxModelObject(parent)->isMenuList()) @@ -1817,9 +1821,6 @@ bool AccessibilityRenderObject::accessibilityIsIgnored() const if (ariaRoleAttribute() != UnknownRole) return false; - if (!helpText().isEmpty()) - return false; - // don't ignore labels, because they serve as TitleUIElements Node* node = m_renderer->node(); if (node && node->hasTagName(labelTag)) @@ -1877,11 +1878,17 @@ bool AccessibilityRenderObject::accessibilityIsIgnored() const return false; } - // make a platform-specific decision - if (isAttachment()) - return accessibilityIgnoreAttachment(); + if (isWebArea() || m_renderer->isListMarker()) + return false; + + // Using the help text to decide an element's visibility is not as definitive + // as previous checks, so this should remain as one of the last. + if (!helpText().isEmpty()) + return false; - return !m_renderer->isListMarker() && !isWebArea(); + // By default, objects should be ignored so that the AX hierarchy is not + // filled with unnecessary items. + return true; } bool AccessibilityRenderObject::isLoaded() const diff --git a/Source/WebCore/accessibility/AccessibilityScrollbar.cpp b/Source/WebCore/accessibility/AccessibilityScrollbar.cpp index 865797a..b225af8 100644 --- a/Source/WebCore/accessibility/AccessibilityScrollbar.cpp +++ b/Source/WebCore/accessibility/AccessibilityScrollbar.cpp @@ -97,9 +97,11 @@ void AccessibilityScrollbar::setValue(float value) if (!m_scrollbar) return; + if (!m_scrollbar->scrollableArea()) + return; + float newValue = value * m_scrollbar->maximum(); - - m_scrollbar->setValue(newValue, Scrollbar::NotFromScrollAnimator); + m_scrollbar->scrollableArea()->scrollToOffsetWithoutAnimation(m_scrollbar->orientation(), newValue); } } // namespace WebCore diff --git a/Source/WebCore/accessibility/mac/AccessibilityObjectWrapper.mm b/Source/WebCore/accessibility/mac/AccessibilityObjectWrapper.mm index f3b388b..c2e3724 100644 --- a/Source/WebCore/accessibility/mac/AccessibilityObjectWrapper.mm +++ b/Source/WebCore/accessibility/mac/AccessibilityObjectWrapper.mm @@ -1455,7 +1455,7 @@ static NSString* roleValueToNSString(AccessibilityRole value) return nil; if (scroll->platformWidget()) - return scroll->platformWidget(); + return NSAccessibilityUnignoredAncestor(scroll->platformWidget()); return [self remoteAccessibilityParentObject]; } diff --git a/Source/WebCore/bindings/generic/RuntimeEnabledFeatures.cpp b/Source/WebCore/bindings/generic/RuntimeEnabledFeatures.cpp index 9a96f22..dadcc1c 100644 --- a/Source/WebCore/bindings/generic/RuntimeEnabledFeatures.cpp +++ b/Source/WebCore/bindings/generic/RuntimeEnabledFeatures.cpp @@ -48,6 +48,7 @@ bool RuntimeEnabledFeatures::isWebkitNotificationsEnabled = false; bool RuntimeEnabledFeatures::isApplicationCacheEnabled = true; bool RuntimeEnabledFeatures::isGeolocationEnabled = true; bool RuntimeEnabledFeatures::isIndexedDBEnabled = false; +bool RuntimeEnabledFeatures::isWebAudioEnabled = false; bool RuntimeEnabledFeatures::isWebGLEnabled = false; bool RuntimeEnabledFeatures::isPushStateEnabled = false; bool RuntimeEnabledFeatures::isTouchEnabled = true; diff --git a/Source/WebCore/bindings/generic/RuntimeEnabledFeatures.h b/Source/WebCore/bindings/generic/RuntimeEnabledFeatures.h index 343c535..c1b9b8a 100644 --- a/Source/WebCore/bindings/generic/RuntimeEnabledFeatures.h +++ b/Source/WebCore/bindings/generic/RuntimeEnabledFeatures.h @@ -92,6 +92,11 @@ public: static bool openDatabaseSyncEnabled(); #endif +#if ENABLE(WEB_AUDIO) + static void setWebkitAudioContextEnabled(bool isEnabled) { isWebAudioEnabled = isEnabled; } + static bool webkitAudioContextEnabled() { return isWebAudioEnabled; } +#endif + #if ENABLE(3D_CANVAS) || ENABLE(BLOB) static void setWebGLEnabled(bool isEnabled) { isWebGLEnabled = isEnabled; } static bool arrayBufferEnabled() { return isWebGLEnabled; } @@ -174,6 +179,7 @@ private: static bool isApplicationCacheEnabled; static bool isGeolocationEnabled; static bool isIndexedDBEnabled; + static bool isWebAudioEnabled; static bool isWebGLEnabled; static bool isPushStateEnabled; static bool isTouchEnabled; diff --git a/Source/WebCore/bindings/gobject/GNUmakefile.am b/Source/WebCore/bindings/gobject/GNUmakefile.am index b4f98d1..4067dbc 100644 --- a/Source/WebCore/bindings/gobject/GNUmakefile.am +++ b/Source/WebCore/bindings/gobject/GNUmakefile.am @@ -130,6 +130,8 @@ webkitgtk_gdom_built_sources += \ DerivedSources/webkit/WebKitDOMHTMLInputElementPrivate.h \ DerivedSources/webkit/WebKitDOMHTMLIsIndexElement.cpp \ DerivedSources/webkit/WebKitDOMHTMLIsIndexElementPrivate.h \ + DerivedSources/webkit/WebKitDOMHTMLKeygenElement.cpp \ + DerivedSources/webkit/WebKitDOMHTMLKeygenElementPrivate.h \ DerivedSources/webkit/WebKitDOMHTMLLabelElement.cpp \ DerivedSources/webkit/WebKitDOMHTMLLabelElementPrivate.h \ DerivedSources/webkit/WebKitDOMHTMLLegendElement.cpp \ @@ -323,6 +325,7 @@ webkitgtk_built_h_api += \ DerivedSources/webkit/WebKitDOMHTMLImageElement.h \ DerivedSources/webkit/WebKitDOMHTMLInputElement.h \ DerivedSources/webkit/WebKitDOMHTMLIsIndexElement.h \ + DerivedSources/webkit/WebKitDOMHTMLKeygenElement.h \ DerivedSources/webkit/WebKitDOMHTMLLabelElement.h \ DerivedSources/webkit/WebKitDOMHTMLLegendElement.h \ DerivedSources/webkit/WebKitDOMHTMLLIElement.h \ diff --git a/Source/WebCore/bindings/gobject/WebKitHTMLElementWrapperFactory.cpp b/Source/WebCore/bindings/gobject/WebKitHTMLElementWrapperFactory.cpp index da420ae..3ac13d1 100644 --- a/Source/WebCore/bindings/gobject/WebKitHTMLElementWrapperFactory.cpp +++ b/Source/WebCore/bindings/gobject/WebKitHTMLElementWrapperFactory.cpp @@ -62,6 +62,7 @@ #include "HTMLImageElement.h" #include "HTMLInputElement.h" #include "HTMLIsIndexElement.h" +#include "HTMLKeygenElement.h" #include "HTMLLIElement.h" #include "HTMLLabelElement.h" #include "HTMLLegendElement.h" @@ -121,6 +122,7 @@ #include "webkit/WebKitDOMHTMLImageElementPrivate.h" #include "webkit/WebKitDOMHTMLInputElementPrivate.h" #include "webkit/WebKitDOMHTMLIsIndexElementPrivate.h" +#include "webkit/WebKitDOMHTMLKeygenElementPrivate.h" #include "webkit/WebKitDOMHTMLLIElementPrivate.h" #include "webkit/WebKitDOMHTMLLabelElementPrivate.h" #include "webkit/WebKitDOMHTMLLegendElementPrivate.h" @@ -322,6 +324,11 @@ static gpointer createIsIndexWrapper(PassRefPtr<HTMLElement> element) return wrapHTMLIsIndexElement(static_cast<HTMLIsIndexElement*>(element.get())); } +static gpointer createKeygenWrapper(PassRefPtr<HTMLElement> element) +{ + return wrapHTMLKeygenElement(static_cast<HTMLKeygenElement*>(element.get())); +} + static gpointer createLabelWrapper(PassRefPtr<HTMLElement> element) { return wrapHTMLLabelElement(static_cast<HTMLLabelElement*>(element.get())); @@ -523,7 +530,7 @@ gpointer createHTMLElementWrapper(PassRefPtr<WebCore::HTMLElement> element) map.set(h6Tag.localName().impl(), createHeadingWrapper); map.set(imageTag.localName().impl(), createImageWrapper); map.set(insTag.localName().impl(), createModWrapper); - map.set(keygenTag.localName().impl(), createSelectWrapper); + map.set(keygenTag.localName().impl(), createKeygenWrapper); map.set(listingTag.localName().impl(), createPreWrapper); map.set(tfootTag.localName().impl(), createTableSectionWrapper); map.set(thTag.localName().impl(), createTableCellWrapper); diff --git a/Source/WebCore/bindings/js/CachedScriptSourceProvider.h b/Source/WebCore/bindings/js/CachedScriptSourceProvider.h index 809a488..9bae8ca 100644 --- a/Source/WebCore/bindings/js/CachedScriptSourceProvider.h +++ b/Source/WebCore/bindings/js/CachedScriptSourceProvider.h @@ -36,6 +36,7 @@ namespace WebCore { class CachedScriptSourceProvider : public ScriptSourceProvider, public CachedResourceClient { + WTF_MAKE_FAST_ALLOCATED; public: static PassRefPtr<CachedScriptSourceProvider> create(CachedScript* cachedScript) { return adoptRef(new CachedScriptSourceProvider(cachedScript)); } @@ -49,9 +50,14 @@ namespace WebCore { int length() const { return m_cachedScript->script().length(); } const String& source() const { return m_cachedScript->script(); } + virtual void cacheSizeChanged(int delta) + { + m_cachedScript->sourceProviderCacheSizeChanged(delta); + } + private: CachedScriptSourceProvider(CachedScript* cachedScript) - : ScriptSourceProvider(stringToUString(cachedScript->url())) + : ScriptSourceProvider(stringToUString(cachedScript->url()), cachedScript->sourceProviderCache()) , m_cachedScript(cachedScript) { m_cachedScript->addClient(this); diff --git a/Source/WebCore/bindings/js/GCController.h b/Source/WebCore/bindings/js/GCController.h index 4c25407..91f1e4c 100644 --- a/Source/WebCore/bindings/js/GCController.h +++ b/Source/WebCore/bindings/js/GCController.h @@ -26,12 +26,12 @@ #ifndef GCController_h #define GCController_h -#include <wtf/Noncopyable.h> #include "Timer.h" namespace WebCore { - class GCController : public Noncopyable { + class GCController { + WTF_MAKE_NONCOPYABLE(GCController); WTF_MAKE_FAST_ALLOCATED; friend GCController& gcController(); public: diff --git a/Source/WebCore/bindings/js/JSArrayBufferViewHelper.h b/Source/WebCore/bindings/js/JSArrayBufferViewHelper.h index e010406..73229da 100644 --- a/Source/WebCore/bindings/js/JSArrayBufferViewHelper.h +++ b/Source/WebCore/bindings/js/JSArrayBufferViewHelper.h @@ -181,6 +181,19 @@ PassRefPtr<C> constructArrayBufferView(JSC::ExecState* exec) return result; } +template <typename JSType, typename WebCoreType> +static JSC::JSValue toJSArrayBufferView(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, WebCoreType* object) +{ + if (!object) + return JSC::jsNull(); + + if (DOMObject* wrapper = getCachedDOMObjectWrapper(exec, object)) + return wrapper; + + exec->heap()->reportExtraMemoryCost(object->byteLength()); + return createDOMObjectWrapper<JSType>(exec, globalObject, object); +} + } // namespace WebCore #endif // JSArrayBufferViewHelper_h diff --git a/Source/WebCore/bindings/js/JSBindingsAllInOne.cpp b/Source/WebCore/bindings/js/JSBindingsAllInOne.cpp index 853e2ef..af74e8c 100644 --- a/Source/WebCore/bindings/js/JSBindingsAllInOne.cpp +++ b/Source/WebCore/bindings/js/JSBindingsAllInOne.cpp @@ -71,6 +71,7 @@ #include "JSDeviceOrientationEventCustom.cpp" #include "JSDocumentCustom.cpp" #include "JSElementCustom.cpp" +#include "JSErrorHandler.cpp" #include "JSEventCustom.cpp" #include "JSEventListener.cpp" #include "JSEventSourceCustom.cpp" @@ -139,7 +140,6 @@ #include "JSWebSocketCustom.cpp" #include "JSWorkerContextBase.cpp" #include "JSWorkerContextCustom.cpp" -#include "JSWorkerContextErrorHandler.cpp" #include "JSWorkerCustom.cpp" #include "JSXMLHttpRequestCustom.cpp" #include "JSXMLHttpRequestUploadCustom.cpp" diff --git a/Source/WebCore/bindings/js/JSDOMBinding.cpp b/Source/WebCore/bindings/js/JSDOMBinding.cpp index 72c7cd6..e53dcfb 100644 --- a/Source/WebCore/bindings/js/JSDOMBinding.cpp +++ b/Source/WebCore/bindings/js/JSDOMBinding.cpp @@ -53,6 +53,7 @@ #include "ProcessingInstruction.h" #include "RangeException.h" #include "ScriptCachedFrameData.h" +#include "ScriptCallStack.h" #include "ScriptController.h" #include "Settings.h" #include "WebCoreJSClientData.h" @@ -589,7 +590,7 @@ void reportException(ExecState* exec, JSValue exception) if (!scriptExecutionContext) return; - scriptExecutionContext->reportException(ustringToString(errorMessage), lineNumber, ustringToString(exceptionSourceURL)); + scriptExecutionContext->reportException(ustringToString(errorMessage), lineNumber, ustringToString(exceptionSourceURL), 0); } void reportCurrentException(ExecState* exec) diff --git a/Source/WebCore/bindings/js/JSDebugWrapperSet.h b/Source/WebCore/bindings/js/JSDebugWrapperSet.h index 94b6f78..e1138ed 100644 --- a/Source/WebCore/bindings/js/JSDebugWrapperSet.h +++ b/Source/WebCore/bindings/js/JSDebugWrapperSet.h @@ -37,7 +37,8 @@ namespace WebCore { // - wrappers being deleted without being removed from the cache // - wrappers being cached twice -class JSDebugWrapperSet : public Noncopyable { +class JSDebugWrapperSet { + WTF_MAKE_NONCOPYABLE(JSDebugWrapperSet); friend class WTF::ThreadSpecific<JSDebugWrapperSet>; public: static JSDebugWrapperSet& shared(); diff --git a/Source/WebCore/bindings/js/JSWorkerContextErrorHandler.cpp b/Source/WebCore/bindings/js/JSErrorHandler.cpp index f7d2b02..ae8e363 100644 --- a/Source/WebCore/bindings/js/JSWorkerContextErrorHandler.cpp +++ b/Source/WebCore/bindings/js/JSErrorHandler.cpp @@ -30,9 +30,7 @@ #include "config.h" -#if ENABLE(WORKERS) - -#include "JSWorkerContextErrorHandler.h" +#include "JSErrorHandler.h" #include "ErrorEvent.h" #include "Event.h" @@ -43,21 +41,26 @@ using namespace JSC; namespace WebCore { -JSWorkerContextErrorHandler::JSWorkerContextErrorHandler(JSObject* function, JSObject* wrapper, bool isAttribute, DOMWrapperWorld* isolatedWorld) +JSErrorHandler::JSErrorHandler(JSObject* function, JSObject* wrapper, bool isAttribute, DOMWrapperWorld* isolatedWorld) : JSEventListener(function, wrapper, isAttribute, isolatedWorld) { } -JSWorkerContextErrorHandler::~JSWorkerContextErrorHandler() +JSErrorHandler::~JSErrorHandler() { } -void JSWorkerContextErrorHandler::handleEvent(ScriptExecutionContext* scriptExecutionContext, Event* event) +void JSErrorHandler::handleEvent(ScriptExecutionContext* scriptExecutionContext, Event* event) { + if (!event->isErrorEvent()) + return JSEventListener::handleEvent(scriptExecutionContext, event); + ASSERT(scriptExecutionContext); if (!scriptExecutionContext) return; + ErrorEvent* errorEvent = static_cast<ErrorEvent*>(event); + JSLock lock(SilenceAssertionsOnly); JSObject* jsFunction = this->jsFunction(scriptExecutionContext); @@ -74,15 +77,11 @@ void JSWorkerContextErrorHandler::handleEvent(ScriptExecutionContext* scriptExec CallType callType = jsFunction->getCallData(callData); if (callType != CallTypeNone) { - - ref(); + RefPtr<JSErrorHandler> protectedctor(this); Event* savedEvent = globalObject->currentEvent(); globalObject->setCurrentEvent(event); - ASSERT(event->isErrorEvent()); - ErrorEvent* errorEvent = static_cast<ErrorEvent*>(event); - MarkedArgumentBuffer args; args.append(jsString(exec, errorEvent->message())); args.append(jsString(exec, errorEvent->filename())); @@ -106,11 +105,7 @@ void JSWorkerContextErrorHandler::handleEvent(ScriptExecutionContext* scriptExec if (returnValue.getBoolean(retvalbool) && !retvalbool) event->preventDefault(); } - - deref(); } } } // namespace WebCore - -#endif // ENABLE(WORKERS) diff --git a/Source/WebCore/bindings/js/JSWorkerContextErrorHandler.h b/Source/WebCore/bindings/js/JSErrorHandler.h index a188299..957fd81 100644 --- a/Source/WebCore/bindings/js/JSWorkerContextErrorHandler.h +++ b/Source/WebCore/bindings/js/JSErrorHandler.h @@ -28,37 +28,37 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef JSWorkerContextErrorHandler_h -#define JSWorkerContextErrorHandler_h +#ifndef JSErrorHandler_h +#define JSErrorHandler_h #include "JSEventListener.h" namespace WebCore { -class JSWorkerContextErrorHandler : public JSEventListener { +class JSErrorHandler : public JSEventListener { public: - static PassRefPtr<JSWorkerContextErrorHandler> create(JSC::JSObject* listener, JSC::JSObject* wrapper, bool isAttribute, DOMWrapperWorld* isolatedWorld) + static PassRefPtr<JSErrorHandler> create(JSC::JSObject* listener, JSC::JSObject* wrapper, bool isAttribute, DOMWrapperWorld* isolatedWorld) { - return adoptRef(new JSWorkerContextErrorHandler(listener, wrapper, isAttribute, isolatedWorld)); + return adoptRef(new JSErrorHandler(listener, wrapper, isAttribute, isolatedWorld)); } - virtual ~JSWorkerContextErrorHandler(); + virtual ~JSErrorHandler(); private: - JSWorkerContextErrorHandler(JSC::JSObject* function, JSC::JSObject* wrapper, bool isAttribute, DOMWrapperWorld* isolatedWorld); + JSErrorHandler(JSC::JSObject* function, JSC::JSObject* wrapper, bool isAttribute, DOMWrapperWorld* isolatedWorld); virtual void handleEvent(ScriptExecutionContext*, Event*); }; // Creates a JS EventListener for "onerror" event handler in worker context. It has custom implementation because // unlike other event listeners it accepts three parameters. -inline PassRefPtr<JSWorkerContextErrorHandler> createJSWorkerContextErrorHandler(JSC::ExecState* exec, JSC::JSValue listener, JSC::JSObject* wrapper) +inline PassRefPtr<JSErrorHandler> createJSErrorHandler(JSC::ExecState* exec, JSC::JSValue listener, JSC::JSObject* wrapper) { if (!listener.isObject()) return 0; - return JSWorkerContextErrorHandler::create(asObject(listener), wrapper, true, currentWorld(exec)); + return JSErrorHandler::create(asObject(listener), wrapper, true, currentWorld(exec)); } } // namespace WebCore -#endif // JSWorkerContextErrorHandler_h +#endif // JSErrorHandler_h diff --git a/Source/WebCore/bindings/js/JSEventListener.h b/Source/WebCore/bindings/js/JSEventListener.h index b15c589..83d0d2e 100644 --- a/Source/WebCore/bindings/js/JSEventListener.h +++ b/Source/WebCore/bindings/js/JSEventListener.h @@ -59,11 +59,11 @@ namespace WebCore { virtual JSC::JSObject* initializeJSFunction(ScriptExecutionContext*) const; virtual void markJSFunction(JSC::MarkStack&); virtual void invalidateJSFunction(JSC::JSObject*); - virtual void handleEvent(ScriptExecutionContext*, Event*); virtual bool virtualisAttribute() const; protected: JSEventListener(JSC::JSObject* function, JSC::JSObject* wrapper, bool isAttribute, DOMWrapperWorld* isolatedWorld); + virtual void handleEvent(ScriptExecutionContext*, Event*); private: mutable JSC::JSObject* m_jsFunction; diff --git a/Source/WebCore/bindings/js/JSFloat32ArrayCustom.cpp b/Source/WebCore/bindings/js/JSFloat32ArrayCustom.cpp index 880d68c..eb4608c 100644 --- a/Source/WebCore/bindings/js/JSFloat32ArrayCustom.cpp +++ b/Source/WebCore/bindings/js/JSFloat32ArrayCustom.cpp @@ -43,7 +43,7 @@ void JSFloat32Array::indexSetter(JSC::ExecState* exec, unsigned index, JSC::JSVa JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, Float32Array* object) { - return getDOMObjectWrapper<JSFloat32Array>(exec, globalObject, object); + return toJSArrayBufferView<JSFloat32Array>(exec, globalObject, object); } JSC::JSValue JSFloat32Array::set(JSC::ExecState* exec) diff --git a/Source/WebCore/bindings/js/JSInt16ArrayCustom.cpp b/Source/WebCore/bindings/js/JSInt16ArrayCustom.cpp index e08da8a..2e56d0b 100644 --- a/Source/WebCore/bindings/js/JSInt16ArrayCustom.cpp +++ b/Source/WebCore/bindings/js/JSInt16ArrayCustom.cpp @@ -43,7 +43,7 @@ void JSInt16Array::indexSetter(JSC::ExecState* exec, unsigned index, JSC::JSValu JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, Int16Array* object) { - return getDOMObjectWrapper<JSInt16Array>(exec, globalObject, object); + return toJSArrayBufferView<JSInt16Array>(exec, globalObject, object); } JSC::JSValue JSInt16Array::set(JSC::ExecState* exec) diff --git a/Source/WebCore/bindings/js/JSInt32ArrayCustom.cpp b/Source/WebCore/bindings/js/JSInt32ArrayCustom.cpp index 5aa64bb..eaf474a 100644 --- a/Source/WebCore/bindings/js/JSInt32ArrayCustom.cpp +++ b/Source/WebCore/bindings/js/JSInt32ArrayCustom.cpp @@ -43,7 +43,7 @@ void JSInt32Array::indexSetter(JSC::ExecState* exec, unsigned index, JSC::JSValu JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, Int32Array* object) { - return getDOMObjectWrapper<JSInt32Array>(exec, globalObject, object); + return toJSArrayBufferView<JSInt32Array>(exec, globalObject, object); } JSC::JSValue JSInt32Array::set(JSC::ExecState* exec) diff --git a/Source/WebCore/bindings/js/JSInt8ArrayCustom.cpp b/Source/WebCore/bindings/js/JSInt8ArrayCustom.cpp index b63de54..c4bd007 100644 --- a/Source/WebCore/bindings/js/JSInt8ArrayCustom.cpp +++ b/Source/WebCore/bindings/js/JSInt8ArrayCustom.cpp @@ -44,7 +44,7 @@ void JSInt8Array::indexSetter(JSC::ExecState* exec, unsigned index, JSC::JSValue JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, Int8Array* object) { - return getDOMObjectWrapper<JSInt8Array>(exec, globalObject, object); + return toJSArrayBufferView<JSInt8Array>(exec, globalObject, object); } JSC::JSValue JSInt8Array::set(JSC::ExecState* exec) diff --git a/Source/WebCore/bindings/js/JSMainThreadExecState.h b/Source/WebCore/bindings/js/JSMainThreadExecState.h index 8193d7c..349dc14 100644 --- a/Source/WebCore/bindings/js/JSMainThreadExecState.h +++ b/Source/WebCore/bindings/js/JSMainThreadExecState.h @@ -30,11 +30,11 @@ #ifndef NDEBUG #include <wtf/MainThread.h> #endif -#include <wtf/Noncopyable.h> namespace WebCore { -class JSMainThreadExecState : public Noncopyable { +class JSMainThreadExecState { + WTF_MAKE_NONCOPYABLE(JSMainThreadExecState); public: static JSC::ExecState* currentState() { diff --git a/Source/WebCore/bindings/js/JSUint16ArrayCustom.cpp b/Source/WebCore/bindings/js/JSUint16ArrayCustom.cpp index 6a024ee..9e476f2 100644 --- a/Source/WebCore/bindings/js/JSUint16ArrayCustom.cpp +++ b/Source/WebCore/bindings/js/JSUint16ArrayCustom.cpp @@ -43,7 +43,7 @@ void JSUint16Array::indexSetter(JSC::ExecState* exec, unsigned index, JSC::JSVal JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, Uint16Array* object) { - return getDOMObjectWrapper<JSUint16Array>(exec, globalObject, object); + return toJSArrayBufferView<JSUint16Array>(exec, globalObject, object); } JSC::JSValue JSUint16Array::set(JSC::ExecState* exec) diff --git a/Source/WebCore/bindings/js/JSUint32ArrayCustom.cpp b/Source/WebCore/bindings/js/JSUint32ArrayCustom.cpp index 34eb8de..d221c2a 100644 --- a/Source/WebCore/bindings/js/JSUint32ArrayCustom.cpp +++ b/Source/WebCore/bindings/js/JSUint32ArrayCustom.cpp @@ -43,7 +43,7 @@ void JSUint32Array::indexSetter(JSC::ExecState* exec, unsigned index, JSC::JSVal JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, Uint32Array* object) { - return getDOMObjectWrapper<JSUint32Array>(exec, globalObject, object); + return toJSArrayBufferView<JSUint32Array>(exec, globalObject, object); } JSC::JSValue JSUint32Array::set(JSC::ExecState* exec) diff --git a/Source/WebCore/bindings/js/JSUint8ArrayCustom.cpp b/Source/WebCore/bindings/js/JSUint8ArrayCustom.cpp index a9ed73f..b37eea8 100644 --- a/Source/WebCore/bindings/js/JSUint8ArrayCustom.cpp +++ b/Source/WebCore/bindings/js/JSUint8ArrayCustom.cpp @@ -43,7 +43,7 @@ void JSUint8Array::indexSetter(JSC::ExecState* exec, unsigned index, JSC::JSValu JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, Uint8Array* object) { - return getDOMObjectWrapper<JSUint8Array>(exec, globalObject, object); + return toJSArrayBufferView<JSUint8Array>(exec, globalObject, object); } JSC::JSValue JSUint8Array::set(JSC::ExecState* exec) diff --git a/Source/WebCore/bindings/js/JSWebGLRenderingContextCustom.cpp b/Source/WebCore/bindings/js/JSWebGLRenderingContextCustom.cpp index ed4a9ca..dc32d5f 100644 --- a/Source/WebCore/bindings/js/JSWebGLRenderingContextCustom.cpp +++ b/Source/WebCore/bindings/js/JSWebGLRenderingContextCustom.cpp @@ -37,6 +37,7 @@ #include "JSHTMLCanvasElement.h" #include "JSHTMLImageElement.h" #include "JSImageData.h" +#include "JSOESStandardDerivatives.h" #include "JSOESTextureFloat.h" #include "JSWebGLBuffer.h" #include "JSFloat32Array.h" @@ -50,6 +51,7 @@ #include "JSUint8Array.h" #include "JSWebKitCSSMatrix.h" #include "NotImplemented.h" +#include "OESStandardDerivatives.h" #include "OESTextureFloat.h" #include "WebGLBuffer.h" #include "Float32Array.h" @@ -173,6 +175,8 @@ static JSValue toJS(ExecState* exec, JSDOMGlobalObject* globalObject, WebGLExten switch (extension->getName()) { case WebGLExtension::WebKitLoseContextName: return toJS(exec, globalObject, static_cast<WebKitLoseContext*>(extension)); + case WebGLExtension::OESStandardDerivativesName: + return toJS(exec, globalObject, static_cast<OESStandardDerivatives*>(extension)); case WebGLExtension::OESTextureFloatName: return toJS(exec, globalObject, static_cast<OESTextureFloat*>(extension)); } diff --git a/Source/WebCore/bindings/js/JavaScriptCallFrame.cpp b/Source/WebCore/bindings/js/JavaScriptCallFrame.cpp index c280d98..cc6986a 100644 --- a/Source/WebCore/bindings/js/JavaScriptCallFrame.cpp +++ b/Source/WebCore/bindings/js/JavaScriptCallFrame.cpp @@ -42,11 +42,11 @@ using namespace JSC; namespace WebCore { -JavaScriptCallFrame::JavaScriptCallFrame(const DebuggerCallFrame& debuggerCallFrame, PassRefPtr<JavaScriptCallFrame> caller, intptr_t sourceID, int line) +JavaScriptCallFrame::JavaScriptCallFrame(const DebuggerCallFrame& debuggerCallFrame, PassRefPtr<JavaScriptCallFrame> caller, intptr_t sourceID, const TextPosition1& textPosition) : m_debuggerCallFrame(debuggerCallFrame) , m_caller(caller) , m_sourceID(sourceID) - , m_line(line) + , m_textPosition(textPosition) , m_isValid(true) { } diff --git a/Source/WebCore/bindings/js/JavaScriptCallFrame.h b/Source/WebCore/bindings/js/JavaScriptCallFrame.h index c23a43d..74e0a70 100644 --- a/Source/WebCore/bindings/js/JavaScriptCallFrame.h +++ b/Source/WebCore/bindings/js/JavaScriptCallFrame.h @@ -33,14 +33,15 @@ #include <wtf/Forward.h> #include <wtf/PassRefPtr.h> #include <wtf/RefCounted.h> +#include <wtf/text/TextPosition.h> namespace WebCore { class JavaScriptCallFrame : public RefCounted<JavaScriptCallFrame> { public: - static PassRefPtr<JavaScriptCallFrame> create(const JSC::DebuggerCallFrame& debuggerCallFrame, PassRefPtr<JavaScriptCallFrame> caller, intptr_t sourceID, int line) + static PassRefPtr<JavaScriptCallFrame> create(const JSC::DebuggerCallFrame& debuggerCallFrame, PassRefPtr<JavaScriptCallFrame> caller, intptr_t sourceID, const TextPosition1& textPosition) { - return adoptRef(new JavaScriptCallFrame(debuggerCallFrame, caller, sourceID, line)); + return adoptRef(new JavaScriptCallFrame(debuggerCallFrame, caller, sourceID, textPosition)); } void invalidate() @@ -54,11 +55,13 @@ public: JavaScriptCallFrame* caller(); intptr_t sourceID() const { return m_sourceID; } - int line() const { return m_line; } - void update(const JSC::DebuggerCallFrame& debuggerCallFrame, intptr_t sourceID, int line) + int line() const { return m_textPosition.m_line.oneBasedInt(); } + int column() const { return m_textPosition.m_column.oneBasedInt(); } + + void update(const JSC::DebuggerCallFrame& debuggerCallFrame, intptr_t sourceID, const TextPosition1& textPosition) { m_debuggerCallFrame = debuggerCallFrame; - m_line = line; + m_textPosition = textPosition; m_sourceID = sourceID; m_isValid = true; } @@ -72,12 +75,12 @@ public: JSC::JSValue evaluate(const JSC::UString& script, JSC::JSValue& exception) const; private: - JavaScriptCallFrame(const JSC::DebuggerCallFrame&, PassRefPtr<JavaScriptCallFrame> caller, intptr_t sourceID, int line); + JavaScriptCallFrame(const JSC::DebuggerCallFrame&, PassRefPtr<JavaScriptCallFrame> caller, intptr_t sourceID, const TextPosition1&); JSC::DebuggerCallFrame m_debuggerCallFrame; RefPtr<JavaScriptCallFrame> m_caller; intptr_t m_sourceID; - int m_line; + TextPosition1 m_textPosition; bool m_isValid; }; diff --git a/Source/WebCore/bindings/js/ScheduledAction.h b/Source/WebCore/bindings/js/ScheduledAction.h index 6c9d0ba..59ad6fc 100644 --- a/Source/WebCore/bindings/js/ScheduledAction.h +++ b/Source/WebCore/bindings/js/ScheduledAction.h @@ -41,7 +41,8 @@ namespace WebCore { * time interval, either once or repeatedly. Used for window.setTimeout() * and window.setInterval() */ - class ScheduledAction : public Noncopyable { + class ScheduledAction { + WTF_MAKE_NONCOPYABLE(ScheduledAction); WTF_MAKE_FAST_ALLOCATED; public: static PassOwnPtr<ScheduledAction> create(JSC::ExecState*, DOMWrapperWorld* isolatedWorld); diff --git a/Source/WebCore/bindings/js/ScriptCachedFrameData.h b/Source/WebCore/bindings/js/ScriptCachedFrameData.h index 15c23c5..5f691d9 100644 --- a/Source/WebCore/bindings/js/ScriptCachedFrameData.h +++ b/Source/WebCore/bindings/js/ScriptCachedFrameData.h @@ -40,7 +40,8 @@ namespace WebCore { class DOMWindow; class DOMWrapperWorld; - class ScriptCachedFrameData : public Noncopyable { + class ScriptCachedFrameData { + WTF_MAKE_NONCOPYABLE(ScriptCachedFrameData); WTF_MAKE_FAST_ALLOCATED; typedef HashMap< RefPtr<DOMWrapperWorld>, JSC::ProtectedPtr<JSDOMWindow> > JSDOMWindowSet; public: diff --git a/Source/WebCore/bindings/js/ScriptDebugServer.cpp b/Source/WebCore/bindings/js/ScriptDebugServer.cpp index 9845277..b516f6d 100644 --- a/Source/WebCore/bindings/js/ScriptDebugServer.cpp +++ b/Source/WebCore/bindings/js/ScriptDebugServer.cpp @@ -48,7 +48,7 @@ #include "ScrollView.h" #include "Widget.h" #include <debugger/DebuggerCallFrame.h> -#include <parser/SourceCode.h> +#include <parser/SourceProvider.h> #include <runtime/JSLock.h> #include <wtf/text/StringConcatenate.h> #include <wtf/MainThread.h> @@ -282,23 +282,25 @@ void ScriptDebugServer::dispatchDidContinue(ScriptDebugListener* listener) listener->didContinue(); } -void ScriptDebugServer::dispatchDidParseSource(const ListenerSet& listeners, const JSC::SourceCode& source, ScriptWorldType worldType) +void ScriptDebugServer::dispatchDidParseSource(const ListenerSet& listeners, SourceProvider* sourceProvider, ScriptWorldType worldType) { - String sourceID = ustringToString(JSC::UString::number(source.provider()->asID())); - String url = ustringToString(source.provider()->url()); - String data = ustringToString(JSC::UString(source.data(), source.length())); + String sourceID = ustringToString(JSC::UString::number(sourceProvider->asID())); + String url = ustringToString(sourceProvider->url()); + String data = ustringToString(JSC::UString(sourceProvider->data(), sourceProvider->length())); + int lineOffset = sourceProvider->startPosition().m_line.convertAsZeroBasedInt(); + int columnOffset = sourceProvider->startPosition().m_column.convertAsZeroBasedInt(); Vector<ScriptDebugListener*> copy; copyToVector(listeners, copy); for (size_t i = 0; i < copy.size(); ++i) - copy[i]->didParseSource(sourceID, url, data, source.firstLine() - 1, source.firstColumn() - 1, worldType); + copy[i]->didParseSource(sourceID, url, data, lineOffset, columnOffset, worldType); } -void ScriptDebugServer::dispatchFailedToParseSource(const ListenerSet& listeners, const SourceCode& source, int errorLine, const String& errorMessage) +void ScriptDebugServer::dispatchFailedToParseSource(const ListenerSet& listeners, SourceProvider* sourceProvider, int errorLine, const String& errorMessage) { - String url = ustringToString(source.provider()->url()); - String data = ustringToString(JSC::UString(source.data(), source.length())); - int firstLine = source.firstLine(); + String url = ustringToString(sourceProvider->url()); + String data = ustringToString(JSC::UString(sourceProvider->data(), sourceProvider->length())); + int firstLine = sourceProvider->startPosition().m_line.oneBasedInt(); Vector<ScriptDebugListener*> copy; copyToVector(listeners, copy); @@ -335,7 +337,7 @@ void ScriptDebugServer::detach(JSGlobalObject* globalObject) Debugger::detach(globalObject); } -void ScriptDebugServer::sourceParsed(ExecState* exec, const SourceCode& source, int errorLine, const UString& errorMessage) +void ScriptDebugServer::sourceParsed(ExecState* exec, SourceProvider* sourceProvider, int errorLine, const UString& errorMessage) { if (m_callingListeners) return; @@ -353,9 +355,9 @@ void ScriptDebugServer::sourceParsed(ExecState* exec, const SourceCode& source, if (ListenerSet* pageListeners = m_pageListenersMap.get(page)) { ASSERT(!pageListeners->isEmpty()); if (isError) - dispatchFailedToParseSource(*pageListeners, source, errorLine, ustringToString(errorMessage)); + dispatchFailedToParseSource(*pageListeners, sourceProvider, errorLine, ustringToString(errorMessage)); else - dispatchDidParseSource(*pageListeners, source, worldType); + dispatchDidParseSource(*pageListeners, sourceProvider, worldType); } m_callingListeners = false; @@ -440,6 +442,24 @@ void ScriptDebugServer::setJavaScriptPaused(FrameView* view, bool paused) } } +void ScriptDebugServer::createCallFrameAndPauseIfNeeded(const DebuggerCallFrame& debuggerCallFrame, intptr_t sourceID, int lineNumber) +{ + TextPosition1 textPosition(WTF::OneBasedNumber::fromOneBasedInt(lineNumber), WTF::OneBasedNumber::base()); + m_currentCallFrame = JavaScriptCallFrame::create(debuggerCallFrame, m_currentCallFrame, sourceID, textPosition); + pauseIfNeeded(toPage(debuggerCallFrame.dynamicGlobalObject())); +} + +void ScriptDebugServer::updateCallFrameAndPauseIfNeeded(const DebuggerCallFrame& debuggerCallFrame, intptr_t sourceID, int lineNumber) +{ + ASSERT(m_currentCallFrame); + if (!m_currentCallFrame) + return; + + TextPosition1 textPosition(WTF::OneBasedNumber::fromOneBasedInt(lineNumber), WTF::OneBasedNumber::base()); + m_currentCallFrame->update(debuggerCallFrame, sourceID, textPosition); + pauseIfNeeded(toPage(debuggerCallFrame.dynamicGlobalObject())); +} + void ScriptDebugServer::pauseIfNeeded(Page* page) { if (m_paused) @@ -480,24 +500,14 @@ void ScriptDebugServer::pauseIfNeeded(Page* page) void ScriptDebugServer::callEvent(const DebuggerCallFrame& debuggerCallFrame, intptr_t sourceID, int lineNumber) { - if (m_paused) - return; - - m_currentCallFrame = JavaScriptCallFrame::create(debuggerCallFrame, m_currentCallFrame, sourceID, lineNumber); - pauseIfNeeded(toPage(debuggerCallFrame.dynamicGlobalObject())); + if (!m_paused) + createCallFrameAndPauseIfNeeded(debuggerCallFrame, sourceID, lineNumber); } void ScriptDebugServer::atStatement(const DebuggerCallFrame& debuggerCallFrame, intptr_t sourceID, int lineNumber) { - if (m_paused) - return; - - ASSERT(m_currentCallFrame); - if (!m_currentCallFrame) - return; - - m_currentCallFrame->update(debuggerCallFrame, sourceID, lineNumber); - pauseIfNeeded(toPage(debuggerCallFrame.dynamicGlobalObject())); + if (!m_paused) + updateCallFrameAndPauseIfNeeded(debuggerCallFrame, sourceID, lineNumber); } void ScriptDebugServer::returnEvent(const DebuggerCallFrame& debuggerCallFrame, intptr_t sourceID, int lineNumber) @@ -505,12 +515,7 @@ void ScriptDebugServer::returnEvent(const DebuggerCallFrame& debuggerCallFrame, if (m_paused) return; - ASSERT(m_currentCallFrame); - if (!m_currentCallFrame) - return; - - m_currentCallFrame->update(debuggerCallFrame, sourceID, lineNumber); - pauseIfNeeded(toPage(debuggerCallFrame.dynamicGlobalObject())); + updateCallFrameAndPauseIfNeeded(debuggerCallFrame, sourceID, lineNumber); // detach may have been called during pauseIfNeeded if (!m_currentCallFrame) @@ -527,24 +532,16 @@ void ScriptDebugServer::exception(const DebuggerCallFrame& debuggerCallFrame, in if (m_paused) return; - ASSERT(m_currentCallFrame); - if (!m_currentCallFrame) - return; - if (m_pauseOnExceptionsState == PauseOnAllExceptions || (m_pauseOnExceptionsState == PauseOnUncaughtExceptions && !hasHandler)) m_pauseOnNextStatement = true; - m_currentCallFrame->update(debuggerCallFrame, sourceID, lineNumber); - pauseIfNeeded(toPage(debuggerCallFrame.dynamicGlobalObject())); + updateCallFrameAndPauseIfNeeded(debuggerCallFrame, sourceID, lineNumber); } void ScriptDebugServer::willExecuteProgram(const DebuggerCallFrame& debuggerCallFrame, intptr_t sourceID, int lineNumber) { - if (m_paused) - return; - - m_currentCallFrame = JavaScriptCallFrame::create(debuggerCallFrame, m_currentCallFrame, sourceID, lineNumber); - pauseIfNeeded(toPage(debuggerCallFrame.dynamicGlobalObject())); + if (!m_paused) + createCallFrameAndPauseIfNeeded(debuggerCallFrame, sourceID, lineNumber); } void ScriptDebugServer::didExecuteProgram(const DebuggerCallFrame& debuggerCallFrame, intptr_t sourceID, int lineNumber) @@ -552,12 +549,7 @@ void ScriptDebugServer::didExecuteProgram(const DebuggerCallFrame& debuggerCallF if (m_paused) return; - ASSERT(m_currentCallFrame); - if (!m_currentCallFrame) - return; - - m_currentCallFrame->update(debuggerCallFrame, sourceID, lineNumber); - pauseIfNeeded(toPage(debuggerCallFrame.dynamicGlobalObject())); + updateCallFrameAndPauseIfNeeded(debuggerCallFrame, sourceID, lineNumber); // Treat stepping over the end of a program like stepping out. if (m_currentCallFrame == m_pauseOnCallFrame) @@ -570,13 +562,8 @@ void ScriptDebugServer::didReachBreakpoint(const DebuggerCallFrame& debuggerCall if (m_paused) return; - ASSERT(m_currentCallFrame); - if (!m_currentCallFrame) - return; - m_pauseOnNextStatement = true; - m_currentCallFrame->update(debuggerCallFrame, sourceID, lineNumber); - pauseIfNeeded(toPage(debuggerCallFrame.dynamicGlobalObject())); + updateCallFrameAndPauseIfNeeded(debuggerCallFrame, sourceID, lineNumber); } void ScriptDebugServer::recompileAllJSFunctionsSoon() diff --git a/Source/WebCore/bindings/js/ScriptDebugServer.h b/Source/WebCore/bindings/js/ScriptDebugServer.h index 81cd9ac..bde4736 100644 --- a/Source/WebCore/bindings/js/ScriptDebugServer.h +++ b/Source/WebCore/bindings/js/ScriptDebugServer.h @@ -56,7 +56,8 @@ class PageGroup; class ScriptDebugListener; class JavaScriptCallFrame; -class ScriptDebugServer : JSC::Debugger, public Noncopyable { +class ScriptDebugServer : JSC::Debugger { + WTF_MAKE_NONCOPYABLE(ScriptDebugServer); WTF_MAKE_FAST_ALLOCATED; public: static ScriptDebugServer& shared(); @@ -115,14 +116,16 @@ private: void dispatchFunctionToListeners(const ListenerSet& listeners, JavaScriptExecutionCallback callback); void dispatchDidPause(ScriptDebugListener*); void dispatchDidContinue(ScriptDebugListener*); - void dispatchDidParseSource(const ListenerSet& listeners, const JSC::SourceCode& source, enum ScriptWorldType); - void dispatchFailedToParseSource(const ListenerSet& listeners, const JSC::SourceCode& source, int errorLine, const String& errorMessage); + void dispatchDidParseSource(const ListenerSet& listeners, JSC::SourceProvider*, enum ScriptWorldType); + void dispatchFailedToParseSource(const ListenerSet& listeners, JSC::SourceProvider*, int errorLine, const String& errorMessage); + void createCallFrameAndPauseIfNeeded(const JSC::DebuggerCallFrame&, intptr_t sourceID, int lineNumber); + void updateCallFrameAndPauseIfNeeded(const JSC::DebuggerCallFrame&, intptr_t sourceID, int lineNumber); void pauseIfNeeded(Page*); virtual void detach(JSC::JSGlobalObject*); - virtual void sourceParsed(JSC::ExecState*, const JSC::SourceCode&, int errorLine, const JSC::UString& errorMsg); + virtual void sourceParsed(JSC::ExecState*, JSC::SourceProvider*, int errorLine, const JSC::UString& errorMsg); virtual void callEvent(const JSC::DebuggerCallFrame&, intptr_t sourceID, int lineNumber); virtual void atStatement(const JSC::DebuggerCallFrame&, intptr_t sourceID, int firstLine); virtual void returnEvent(const JSC::DebuggerCallFrame&, intptr_t sourceID, int lineNumber); diff --git a/Source/WebCore/bindings/js/ScriptProfiler.h b/Source/WebCore/bindings/js/ScriptProfiler.h index 05e7a25..d4dd606 100644 --- a/Source/WebCore/bindings/js/ScriptProfiler.h +++ b/Source/WebCore/bindings/js/ScriptProfiler.h @@ -32,11 +32,11 @@ #include "ScriptProfile.h" #include "ScriptState.h" -#include <wtf/Noncopyable.h> namespace WebCore { -class ScriptProfiler : public Noncopyable { +class ScriptProfiler { + WTF_MAKE_NONCOPYABLE(ScriptProfiler); public: static void start(ScriptState* state, const String& title); static PassRefPtr<ScriptProfile> stop(ScriptState* state, const String& title); diff --git a/Source/WebCore/bindings/js/ScriptSourceCode.h b/Source/WebCore/bindings/js/ScriptSourceCode.h index 6cf3987..373db31 100644 --- a/Source/WebCore/bindings/js/ScriptSourceCode.h +++ b/Source/WebCore/bindings/js/ScriptSourceCode.h @@ -43,8 +43,8 @@ namespace WebCore { class ScriptSourceCode { public: ScriptSourceCode(const String& source, const KURL& url = KURL(), const TextPosition1& startPosition = TextPosition1::minimumPosition()) - : m_provider(StringSourceProvider::create(source, url.isNull() ? String() : url.string())) - , m_code(m_provider, startPosition) + : m_provider(StringSourceProvider::create(source, url.isNull() ? String() : url.string(), startPosition)) + , m_code(m_provider, startPosition.m_line.oneBasedInt()) , m_url(url) { } diff --git a/Source/WebCore/bindings/js/ScriptSourceProvider.h b/Source/WebCore/bindings/js/ScriptSourceProvider.h index de4e307..3a5d579 100644 --- a/Source/WebCore/bindings/js/ScriptSourceProvider.h +++ b/Source/WebCore/bindings/js/ScriptSourceProvider.h @@ -34,8 +34,8 @@ namespace WebCore { class ScriptSourceProvider : public JSC::SourceProvider { public: - ScriptSourceProvider(const JSC::UString& url) - : SourceProvider(url) + ScriptSourceProvider(const JSC::UString& url, JSC::SourceProviderCache* cache = 0) + : SourceProvider(url, cache) { } diff --git a/Source/WebCore/bindings/js/ScriptState.h b/Source/WebCore/bindings/js/ScriptState.h index 0c08611..e19c0c8 100644 --- a/Source/WebCore/bindings/js/ScriptState.h +++ b/Source/WebCore/bindings/js/ScriptState.h @@ -52,7 +52,8 @@ class Page; // For now, the separation is purely by convention. typedef JSC::ExecState ScriptState; -class ScriptStateProtectedPtr : public Noncopyable { +class ScriptStateProtectedPtr { + WTF_MAKE_NONCOPYABLE(ScriptStateProtectedPtr); public: explicit ScriptStateProtectedPtr(ScriptState*); ~ScriptStateProtectedPtr(); diff --git a/Source/WebCore/bindings/js/StringSourceProvider.h b/Source/WebCore/bindings/js/StringSourceProvider.h index 478c1d1..e23fe5c 100644 --- a/Source/WebCore/bindings/js/StringSourceProvider.h +++ b/Source/WebCore/bindings/js/StringSourceProvider.h @@ -37,20 +37,26 @@ namespace WebCore { class StringSourceProvider : public ScriptSourceProvider { public: - static PassRefPtr<StringSourceProvider> create(const String& source, const String& url) { return adoptRef(new StringSourceProvider(source, url)); } + static PassRefPtr<StringSourceProvider> create(const String& source, const String& url, const TextPosition1& startPosition = TextPosition1::minimumPosition()) + { + return adoptRef(new StringSourceProvider(source, url, startPosition)); + } + virtual TextPosition1 startPosition() const { return m_startPosition; } JSC::UString getRange(int start, int end) const { return JSC::UString(m_source.characters() + start, end - start); } const UChar* data() const { return m_source.characters(); } int length() const { return m_source.length(); } const String& source() const { return m_source; } private: - StringSourceProvider(const String& source, const String& url) + StringSourceProvider(const String& source, const String& url, const TextPosition1& startPosition) : ScriptSourceProvider(stringToUString(url)) + , m_startPosition(startPosition) , m_source(source) { } + TextPosition1 m_startPosition; String m_source; }; diff --git a/Source/WebCore/bindings/js/WebCoreJSClientData.h b/Source/WebCore/bindings/js/WebCoreJSClientData.h index 5d03328..6e2d7be 100644 --- a/Source/WebCore/bindings/js/WebCoreJSClientData.h +++ b/Source/WebCore/bindings/js/WebCoreJSClientData.h @@ -24,17 +24,18 @@ #include "DOMWrapperWorld.h" #include "DOMObjectHashTableMap.h" -#include <wtf/Noncopyable.h> #include <wtf/HashSet.h> #include <wtf/RefPtr.h> namespace WebCore { -class WebCoreJSClientData : public JSC::JSGlobalData::ClientData, public Noncopyable { +class WebCoreJSClientData : public JSC::JSGlobalData::ClientData { + WTF_MAKE_NONCOPYABLE(WebCoreJSClientData); WTF_MAKE_FAST_ALLOCATED; friend class JSGlobalDataWorldIterator; friend void initNormalWorldClientData(JSC::JSGlobalData*); public: + WebCoreJSClientData() { } virtual ~WebCoreJSClientData() { ASSERT(m_worldSet.contains(m_normalWorld.get())); diff --git a/Source/WebCore/bindings/js/WorkerScriptController.h b/Source/WebCore/bindings/js/WorkerScriptController.h index be7da4d..4578913 100644 --- a/Source/WebCore/bindings/js/WorkerScriptController.h +++ b/Source/WebCore/bindings/js/WorkerScriptController.h @@ -31,7 +31,6 @@ #include <runtime/Protect.h> #include <wtf/Forward.h> -#include <wtf/Noncopyable.h> #include <wtf/Threading.h> namespace JSC { @@ -45,7 +44,8 @@ namespace WebCore { class ScriptValue; class WorkerContext; - class WorkerScriptController : public Noncopyable { + class WorkerScriptController { + WTF_MAKE_NONCOPYABLE(WorkerScriptController); WTF_MAKE_FAST_ALLOCATED; public: WorkerScriptController(WorkerContext*); ~WorkerScriptController(); diff --git a/Source/WebCore/bindings/objc/DOM.mm b/Source/WebCore/bindings/objc/DOM.mm index 44bd653..1c24de6 100644 --- a/Source/WebCore/bindings/objc/DOM.mm +++ b/Source/WebCore/bindings/objc/DOM.mm @@ -131,7 +131,6 @@ static void createElementClassMap() addElementClass(HTMLNames::preTag, [DOMHTMLPreElement class]); addElementClass(HTMLNames::qTag, [DOMHTMLQuoteElement class]); addElementClass(HTMLNames::scriptTag, [DOMHTMLScriptElement class]); - addElementClass(HTMLNames::keygenTag, [DOMHTMLSelectElement class]); addElementClass(HTMLNames::selectTag, [DOMHTMLSelectElement class]); addElementClass(HTMLNames::styleTag, [DOMHTMLStyleElement class]); addElementClass(HTMLNames::tableTag, [DOMHTMLTableElement class]); diff --git a/Source/WebCore/bindings/scripts/CodeGeneratorGObject.pm b/Source/WebCore/bindings/scripts/CodeGeneratorGObject.pm index 1863d8f..ed76d08 100644 --- a/Source/WebCore/bindings/scripts/CodeGeneratorGObject.pm +++ b/Source/WebCore/bindings/scripts/CodeGeneratorGObject.pm @@ -518,7 +518,7 @@ my @eventSignalNames = ( # User Interface Event types "focus", "blur", # Basic Event types - "load", "unload", "abort", "error", "select", "change", "submit", "reset", + "load", "unload", "abort", "error", "select", "change", "formchange", "submit", "reset", "resize", "scroll", # Mouse Event types "click", "dblclick", "mousedown", "mouseup", @@ -540,7 +540,7 @@ my @eventSignalNames = ( # Animations "webkitanimationend", "webkitanimationstart", "webkitanimationiteration", # Other - "contextmenu", "input", "invalid", "search", "selectstart"); + "contextmenu", "input", "forminput", "invalid", "search", "selectstart"); sub GenerateProperties { my ($object, $interfaceName, $dataNode) = @_; diff --git a/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm b/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm index cff51e9..abef04e 100644 --- a/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm +++ b/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm @@ -1721,9 +1721,9 @@ sub GenerateImplementation push(@implContent, " JSDOMGlobalObject* globalObject = castedThis->globalObject();\n"); } push(@implContent, " $implClassName* imp = static_cast<$implClassName*>(static_cast<$className*>(thisObject)->impl());\n"); - if ($interfaceName eq "WorkerContext" and $name eq "onerror") { - $implIncludes{"JSWorkerContextErrorHandler.h"} = 1; - push(@implContent, " imp->set$implSetterFunctionName(createJSWorkerContextErrorHandler(exec, value, thisObject));\n"); + if ((($interfaceName eq "DOMWindow") or ($interfaceName eq "WorkerContext")) and $name eq "onerror") { + $implIncludes{"JSErrorHandler.h"} = 1; + push(@implContent, " imp->set$implSetterFunctionName(createJSErrorHandler(exec, value, thisObject));\n"); } else { push(@implContent, GenerateAttributeEventListenerCall($className, $implSetterFunctionName, $windowEventListener)); } diff --git a/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm b/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm index f50e74a..7d36db1 100644 --- a/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm +++ b/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm @@ -1001,6 +1001,10 @@ END $implIncludes{"V8EventListenerList.h"} = 1; $implIncludes{"V8WorkerContextErrorHandler.h"} = 1; push(@implContentDecls, " imp->set$implSetterFunctionName(V8EventListenerList::findOrCreateWrapper<V8WorkerContextErrorHandler>(value, true)"); + } elsif ($interfaceName eq "DOMWindow" and $attribute->signature->name eq "onerror") { + $implIncludes{"V8EventListenerList.h"} = 1; + $implIncludes{"V8WindowErrorHandler.h"} = 1; + push(@implContentDecls, " imp->set$implSetterFunctionName(V8EventListenerList::findOrCreateWrapper<V8WindowErrorHandler>(value, true)"); } else { push(@implContentDecls, " imp->set$implSetterFunctionName(V8DOMWrapper::getEventListener(value, true, ListenerFindOrCreate)"); } @@ -2397,9 +2401,13 @@ END push(@args, " ${paramName}Handle"); } - push(@implContent, "\n v8::Handle<v8::Value> argv[] = {\n"); - push(@implContent, join(",\n", @args)); - push(@implContent, "\n };\n\n"); + if (scalar(@args) > 0) { + push(@implContent, "\n v8::Handle<v8::Value> argv[] = {\n"); + push(@implContent, join(",\n", @args)); + push(@implContent, "\n };\n\n"); + } else { + push(@implContent, "\n v8::Handle<v8::Value> *argv = 0;\n\n"); + } push(@implContent, " bool callbackReturnValue = false;\n"); push(@implContent, " return !invokeCallback(m_callback, " . scalar(@params) . ", argv, callbackReturnValue, scriptExecutionContext());\n"); push(@implContent, "}\n"); diff --git a/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestCallback.cpp b/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestCallback.cpp index a58da40..62ebc3c 100644 --- a/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestCallback.cpp +++ b/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestCallback.cpp @@ -83,6 +83,14 @@ WebDOMTestCallback::~WebDOMTestCallback() m_impl = 0; } +bool WebDOMTestCallback::callbackWithNoParam() +{ + if (!impl()) + return false; + + return impl()->callbackWithNoParam(); +} + bool WebDOMTestCallback::callbackWithClass1Param(const WebDOMClass1& class1Param) { if (!impl()) diff --git a/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestCallback.h b/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestCallback.h index 91ff787..7a077e2 100644 --- a/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestCallback.h +++ b/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestCallback.h @@ -46,6 +46,7 @@ public: WebDOMTestCallback& operator=(const WebDOMTestCallback&); virtual ~WebDOMTestCallback(); + bool callbackWithNoParam(); bool callbackWithClass1Param(const WebDOMClass1& class1Param); bool callbackWithClass2Param(const WebDOMClass2& class2Param, const WebDOMString& strArg); int callbackWithNonBoolReturnType(const WebDOMClass3& class3Param); diff --git a/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestCallback.cpp b/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestCallback.cpp index 9c8fa59..054dc38 100644 --- a/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestCallback.cpp +++ b/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestCallback.cpp @@ -39,8 +39,9 @@ #include "webkit/WebKitDOMClass3Private.h" #include "webkit/WebKitDOMTestCallback.h" #include "webkit/WebKitDOMTestCallbackPrivate.h" +#include "webkitdefines.h" +#include "webkitglobalsprivate.h" #include "webkitmarshal.h" -#include "webkitprivate.h" namespace WebKit { @@ -57,6 +58,16 @@ WebKitDOMTestCallback* kit(WebCore::TestCallback* obj) } // namespace WebKit // gboolean +webkit_dom_test_callback_callback_with_no_param(WebKitDOMTestCallback* self) +{ + g_return_val_if_fail(self, 0); + WebCore::JSMainThreadNullState state; + WebCore::TestCallback * item = WebKit::core(self); + gboolean res = item->callbackWithNoParam(); + return res; +} + +gboolean webkit_dom_test_callback_callback_with_class1param(WebKitDOMTestCallback* self, WebKitDOMClass1* class1param) { g_return_val_if_fail(self, 0); diff --git a/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestCallback.h b/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestCallback.h index 4f0ac91..6049c79 100644 --- a/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestCallback.h +++ b/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestCallback.h @@ -47,6 +47,9 @@ WEBKIT_API GType webkit_dom_test_callback_get_type (void); WEBKIT_API gboolean +webkit_dom_test_callback_callback_with_no_param(WebKitDOMTestCallback* self); + +WEBKIT_API gboolean webkit_dom_test_callback_callback_with_class1param(WebKitDOMTestCallback* self, WebKitDOMClass1* class1param); WEBKIT_API gboolean diff --git a/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestInterface.cpp b/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestInterface.cpp index b68340b..7086c80 100644 --- a/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestInterface.cpp +++ b/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestInterface.cpp @@ -33,8 +33,9 @@ #include "gobject/ConvertToUTF8String.h" #include "webkit/WebKitDOMTestInterface.h" #include "webkit/WebKitDOMTestInterfacePrivate.h" +#include "webkitdefines.h" +#include "webkitglobalsprivate.h" #include "webkitmarshal.h" -#include "webkitprivate.h" namespace WebKit { diff --git a/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestMediaQueryListListener.cpp b/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestMediaQueryListListener.cpp index 93d0bde..5946ec0 100644 --- a/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestMediaQueryListListener.cpp +++ b/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestMediaQueryListListener.cpp @@ -31,8 +31,9 @@ #include "gobject/ConvertToUTF8String.h" #include "webkit/WebKitDOMTestMediaQueryListListener.h" #include "webkit/WebKitDOMTestMediaQueryListListenerPrivate.h" +#include "webkitdefines.h" +#include "webkitglobalsprivate.h" #include "webkitmarshal.h" -#include "webkitprivate.h" namespace WebKit { diff --git a/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp b/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp index 6c94d94..44d58d4 100644 --- a/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp +++ b/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp @@ -38,8 +38,9 @@ #include "webkit/WebKitDOMSerializedScriptValuePrivate.h" #include "webkit/WebKitDOMTestObj.h" #include "webkit/WebKitDOMTestObjPrivate.h" +#include "webkitdefines.h" +#include "webkitglobalsprivate.h" #include "webkitmarshal.h" -#include "webkitprivate.h" namespace WebKit { diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestCallback.cpp b/Source/WebCore/bindings/scripts/test/JS/JSTestCallback.cpp index 069b8ae..1f48ee9 100644 --- a/Source/WebCore/bindings/scripts/test/JS/JSTestCallback.cpp +++ b/Source/WebCore/bindings/scripts/test/JS/JSTestCallback.cpp @@ -56,6 +56,23 @@ JSTestCallback::~JSTestCallback() // Functions +bool JSTestCallback::callbackWithNoParam() +{ + if (!canInvokeCallback()) + return true; + + RefPtr<JSTestCallback> protect(this); + + JSLock lock(SilenceAssertionsOnly); + + ExecState* exec = m_data->globalObject()->globalExec(); + MarkedArgumentBuffer args; + + bool raisedException = false; + m_data->invokeCallback(args, &raisedException); + return !raisedException; +} + bool JSTestCallback::callbackWithClass1Param(Class1* class1Param) { if (!canInvokeCallback()) diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestCallback.h b/Source/WebCore/bindings/scripts/test/JS/JSTestCallback.h index ae91a6c..ba3559c 100644 --- a/Source/WebCore/bindings/scripts/test/JS/JSTestCallback.h +++ b/Source/WebCore/bindings/scripts/test/JS/JSTestCallback.h @@ -40,6 +40,7 @@ public: virtual ~JSTestCallback(); // Functions + virtual bool callbackWithNoParam(); virtual bool callbackWithClass1Param(Class1* class1Param); virtual bool callbackWithClass2Param(Class2* class2Param, const String& strArg); COMPILE_ASSERT(false) virtual int callbackWithNonBoolReturnType(Class3* class3Param); diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp b/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp index 8e71df1..684f587 100644 --- a/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp +++ b/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp @@ -166,6 +166,7 @@ JSValue jsTestInterfaceConstructor(ExecState* exec, JSValue slotBase, const Iden JSTestInterface* domObject = static_cast<JSTestInterface*>(asObject(slotBase)); return JSTestInterface::getConstructor(exec, domObject->globalObject()); } + JSValue JSTestInterface::getConstructor(ExecState* exec, JSGlobalObject* globalObject) { return getDOMConstructor<JSTestInterfaceConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject)); diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp b/Source/WebCore/bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp index e505ed2..f1c09b5 100644 --- a/Source/WebCore/bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp +++ b/Source/WebCore/bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp @@ -162,6 +162,7 @@ JSValue jsTestMediaQueryListListenerConstructor(ExecState* exec, JSValue slotBas JSTestMediaQueryListListener* domObject = static_cast<JSTestMediaQueryListListener*>(asObject(slotBase)); return JSTestMediaQueryListListener::getConstructor(exec, domObject->globalObject()); } + JSValue JSTestMediaQueryListListener::getConstructor(ExecState* exec, JSGlobalObject* globalObject) { return getDOMConstructor<JSTestMediaQueryListListenerConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject)); diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp b/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp index c4c77ee..9d446a2 100644 --- a/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp +++ b/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp @@ -607,6 +607,7 @@ JSValue jsTestObjConstructor(ExecState* exec, JSValue slotBase, const Identifier JSTestObj* domObject = static_cast<JSTestObj*>(asObject(slotBase)); return JSTestObj::getConstructor(exec, domObject->globalObject()); } + void JSTestObj::put(ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot) { lookupPut<JSTestObj, Base>(exec, propertyName, value, &JSTestObjTable, this, slot); diff --git a/Source/WebCore/bindings/scripts/test/ObjC/DOMTestCallback.h b/Source/WebCore/bindings/scripts/test/ObjC/DOMTestCallback.h index 1213c6f..08c30b7 100644 --- a/Source/WebCore/bindings/scripts/test/ObjC/DOMTestCallback.h +++ b/Source/WebCore/bindings/scripts/test/ObjC/DOMTestCallback.h @@ -36,6 +36,7 @@ @class NSString; @interface DOMTestCallback : DOMObject +- (BOOL)callbackWithNoParam; - (BOOL)callbackWithClass1Param:(DOMClass1 *)class1Param; - (BOOL)callbackWithClass2Param:(DOMClass2 *)class2Param strArg:(NSString *)strArg; - (int)callbackWithNonBoolReturnType:(DOMClass3 *)class3Param; diff --git a/Source/WebCore/bindings/scripts/test/ObjC/DOMTestCallback.mm b/Source/WebCore/bindings/scripts/test/ObjC/DOMTestCallback.mm index e941eda..c4be39d 100644 --- a/Source/WebCore/bindings/scripts/test/ObjC/DOMTestCallback.mm +++ b/Source/WebCore/bindings/scripts/test/ObjC/DOMTestCallback.mm @@ -79,6 +79,12 @@ [super finalize]; } +- (BOOL)callbackWithNoParam +{ + WebCore::JSMainThreadNullState state; + return IMPL->callbackWithNoParam(); +} + - (BOOL)callbackWithClass1Param:(DOMClass1 *)class1Param { WebCore::JSMainThreadNullState state; diff --git a/Source/WebCore/bindings/scripts/test/TestCallback.idl b/Source/WebCore/bindings/scripts/test/TestCallback.idl index 25db4c6..9679a5a 100644 --- a/Source/WebCore/bindings/scripts/test/TestCallback.idl +++ b/Source/WebCore/bindings/scripts/test/TestCallback.idl @@ -33,6 +33,7 @@ module test { Conditional=DATABASE, Callback ] TestCallback { + boolean callbackWithNoParam(); boolean callbackWithClass1Param(in Class1 class1Param); boolean callbackWithClass2Param(in Class2 class2Param, in DOMString strArg); long callbackWithNonBoolReturnType(in Class3 class3Param); diff --git a/Source/WebCore/bindings/scripts/test/V8/V8TestCallback.cpp b/Source/WebCore/bindings/scripts/test/V8/V8TestCallback.cpp index c286c24..36a5ca2 100644 --- a/Source/WebCore/bindings/scripts/test/V8/V8TestCallback.cpp +++ b/Source/WebCore/bindings/scripts/test/V8/V8TestCallback.cpp @@ -48,6 +48,26 @@ V8TestCallback::~V8TestCallback() // Functions +bool V8TestCallback::callbackWithNoParam() +{ + if (!canInvokeCallback()) + return true; + + v8::HandleScope handleScope; + + v8::Handle<v8::Context> v8Context = toV8Context(scriptExecutionContext(), m_worldContext); + if (v8Context.IsEmpty()) + return true; + + v8::Context::Scope scope(v8Context); + + + v8::Handle<v8::Value> *argv = 0; + + bool callbackReturnValue = false; + return !invokeCallback(m_callback, 0, argv, callbackReturnValue, scriptExecutionContext()); +} + bool V8TestCallback::callbackWithClass1Param(Class1* class1Param) { if (!canInvokeCallback()) diff --git a/Source/WebCore/bindings/scripts/test/V8/V8TestCallback.h b/Source/WebCore/bindings/scripts/test/V8/V8TestCallback.h index a105d75..8ff8c26 100644 --- a/Source/WebCore/bindings/scripts/test/V8/V8TestCallback.h +++ b/Source/WebCore/bindings/scripts/test/V8/V8TestCallback.h @@ -45,6 +45,7 @@ public: virtual ~V8TestCallback(); // Functions + virtual bool callbackWithNoParam(); virtual bool callbackWithClass1Param(Class1* class1Param); virtual bool callbackWithClass2Param(Class2* class2Param, const String& strArg); COMPILE_ASSERT(false) virtual int callbackWithNonBoolReturnType(Class3* class3Param); diff --git a/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp b/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp index 7a759a3..4298756 100644 --- a/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp +++ b/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp @@ -260,7 +260,7 @@ static v8::Handle<v8::Value> reflectedUnsignedIntegralAttrAttrGetter(v8::Local<v { INC_STATS("DOM.TestObj.reflectedUnsignedIntegralAttr._get"); TestObj* imp = V8TestObj::toNative(info.Holder()); - return v8::Integer::NewFromUnsigned(imp->getUnsignedIntegralAttribute(WebCore::HTMLNames::reflectedunsignedintegralattrAttr)); + return v8::Integer::NewFromUnsigned(std::max(0, imp->getIntegralAttribute(WebCore::HTMLNames::reflectedunsignedintegralattrAttr))); } static void reflectedUnsignedIntegralAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info) diff --git a/Source/WebCore/bindings/v8/DOMData.h b/Source/WebCore/bindings/v8/DOMData.h index 78edf92..b042606 100644 --- a/Source/WebCore/bindings/v8/DOMData.h +++ b/Source/WebCore/bindings/v8/DOMData.h @@ -43,7 +43,8 @@ namespace WebCore { // thread. The DOMData for the main thread and the DOMData for child threads // use different subclasses. // - class DOMData : public Noncopyable { + class DOMData { + WTF_MAKE_NONCOPYABLE(DOMData); public: DOMData(); virtual ~DOMData(); diff --git a/Source/WebCore/bindings/v8/DOMDataStore.cpp b/Source/WebCore/bindings/v8/DOMDataStore.cpp index 0d37dc0..5393bd9 100644 --- a/Source/WebCore/bindings/v8/DOMDataStore.cpp +++ b/Source/WebCore/bindings/v8/DOMDataStore.cpp @@ -148,11 +148,13 @@ void DOMDataStore::weakActiveDOMObjectCallback(v8::Persistent<v8::Value> v8Objec DOMData::handleWeakObject(DOMDataStore::ActiveDOMObjectMap, v8::Persistent<v8::Object>::Cast(v8Object), domObject); } -void DOMDataStore::weakNodeCallback(v8::Persistent<v8::Value> v8Object, void* domObject) +void DOMDataStore::weakNodeCallback(v8::Persistent<v8::Value> value, void* domObject) { ASSERT(WTF::isMainThread()); Node* node = static_cast<Node*>(domObject); + // Node wrappers must be JS objects. + v8::Persistent<v8::Object> v8Object = v8::Persistent<v8::Object>::Cast(value); WTF::MutexLocker locker(DOMDataStore::allStoresMutex()); DOMDataList& list = DOMDataStore::allStores(); @@ -171,7 +173,7 @@ void DOMDataStore::weakNodeCallback(v8::Persistent<v8::Value> v8Object, void* do node->deref(); // Nobody overrides Node::deref so it's safe } -bool DOMDataStore::IntrusiveDOMWrapperMap::removeIfPresent(Node* obj, v8::Persistent<v8::Data> value) +bool DOMDataStore::IntrusiveDOMWrapperMap::removeIfPresent(Node* obj, v8::Persistent<v8::Object> value) { ASSERT(obj); v8::Persistent<v8::Object>* entry = obj->wrapper(); diff --git a/Source/WebCore/bindings/v8/DOMDataStore.h b/Source/WebCore/bindings/v8/DOMDataStore.h index a1051dd..dbead9c 100644 --- a/Source/WebCore/bindings/v8/DOMDataStore.h +++ b/Source/WebCore/bindings/v8/DOMDataStore.h @@ -149,7 +149,8 @@ namespace WebCore { // This class doesn't manage the lifetime of the store. The data store // lifetime is managed by subclasses. // - class DOMDataStore : public Noncopyable { + class DOMDataStore { + WTF_MAKE_NONCOPYABLE(DOMDataStore); public: enum DOMWrapperMapType { DOMNodeMap, @@ -190,7 +191,7 @@ namespace WebCore { m_table.visit(store, visitor); } - virtual bool removeIfPresent(Node* key, v8::Persistent<v8::Data> value); + virtual bool removeIfPresent(Node*, v8::Persistent<v8::Object>); virtual void clear() { diff --git a/Source/WebCore/bindings/v8/DebuggerScript.js b/Source/WebCore/bindings/v8/DebuggerScript.js index 8c9d98e..eb9de2f 100644 --- a/Source/WebCore/bindings/v8/DebuggerScript.js +++ b/Source/WebCore/bindings/v8/DebuggerScript.js @@ -201,8 +201,10 @@ DebuggerScript._frameMirrorToJSCallFrame = function(frameMirror, callerFrame) var script = func.script(); var sourceID = script && script.id(); - // Get line number. - var line = DebuggerScript._v8ToWebkitLineNumber(frameMirror.sourceLine()); + // Get location. + var location = frameMirror.sourceLocation(); + var line = DebuggerScript._v8ToWebkitLineNumber(location.line); + var column = DebuggerScript._v8ToWebkitLineNumber(location.column); // Get this object. var thisObject = frameMirror.details_.receiver(); @@ -250,6 +252,7 @@ DebuggerScript._frameMirrorToJSCallFrame = function(frameMirror, callerFrame) return { "sourceID": sourceID, "line": line, + "column": column, "functionName": functionName, "type": "function", "thisObject": thisObject, diff --git a/Source/WebCore/bindings/v8/JavaScriptCallFrame.cpp b/Source/WebCore/bindings/v8/JavaScriptCallFrame.cpp index 20bf378..5bb436f 100644 --- a/Source/WebCore/bindings/v8/JavaScriptCallFrame.cpp +++ b/Source/WebCore/bindings/v8/JavaScriptCallFrame.cpp @@ -80,6 +80,16 @@ int JavaScriptCallFrame::line() const return 0; } +int JavaScriptCallFrame::column() const +{ + v8::HandleScope handleScope; + v8::Context::Scope contextScope(m_debuggerContext.get()); + v8::Handle<v8::Value> result = m_callFrame.get()->Get(v8String("column")); + if (result->IsInt32()) + return result->Int32Value(); + return 0; +} + String JavaScriptCallFrame::functionName() const { v8::HandleScope handleScope; diff --git a/Source/WebCore/bindings/v8/JavaScriptCallFrame.h b/Source/WebCore/bindings/v8/JavaScriptCallFrame.h index 95a0510..2d14593 100644 --- a/Source/WebCore/bindings/v8/JavaScriptCallFrame.h +++ b/Source/WebCore/bindings/v8/JavaScriptCallFrame.h @@ -51,6 +51,7 @@ public: int sourceID() const; int line() const; + int column() const; String functionName() const; v8::Handle<v8::Value> scopeChain() const; diff --git a/Source/WebCore/bindings/v8/ScriptCachedFrameData.h b/Source/WebCore/bindings/v8/ScriptCachedFrameData.h index 1aa1f62..f08265b 100644 --- a/Source/WebCore/bindings/v8/ScriptCachedFrameData.h +++ b/Source/WebCore/bindings/v8/ScriptCachedFrameData.h @@ -67,7 +67,8 @@ namespace WebCore { class Frame; class DOMWindow; -class ScriptCachedFrameData : public Noncopyable { +class ScriptCachedFrameData { + WTF_MAKE_NONCOPYABLE(ScriptCachedFrameData); public: ScriptCachedFrameData(Frame*); ~ScriptCachedFrameData() { } diff --git a/Source/WebCore/bindings/v8/ScriptDebugServer.h b/Source/WebCore/bindings/v8/ScriptDebugServer.h index 40dd5fc..8fa723f 100644 --- a/Source/WebCore/bindings/v8/ScriptDebugServer.h +++ b/Source/WebCore/bindings/v8/ScriptDebugServer.h @@ -48,7 +48,8 @@ namespace WebCore { class Page; class ScriptDebugListener; -class ScriptDebugServer : public Noncopyable { +class ScriptDebugServer { + WTF_MAKE_NONCOPYABLE(ScriptDebugServer); public: static ScriptDebugServer& shared(); diff --git a/Source/WebCore/bindings/v8/ScriptProfiler.h b/Source/WebCore/bindings/v8/ScriptProfiler.h index b75a054..e0969e1 100644 --- a/Source/WebCore/bindings/v8/ScriptProfiler.h +++ b/Source/WebCore/bindings/v8/ScriptProfiler.h @@ -36,13 +36,13 @@ #include "ScriptProfile.h" #include "ScriptState.h" -#include <wtf/Noncopyable.h> namespace WebCore { class InspectorObject; -class ScriptProfiler : public Noncopyable { +class ScriptProfiler { + WTF_MAKE_NONCOPYABLE(ScriptProfiler); public: static void start(ScriptState* state, const String& title); static PassRefPtr<ScriptProfile> stop(ScriptState* state, const String& title); diff --git a/Source/WebCore/bindings/v8/ScriptState.h b/Source/WebCore/bindings/v8/ScriptState.h index 11813b0..0fecee8 100644 --- a/Source/WebCore/bindings/v8/ScriptState.h +++ b/Source/WebCore/bindings/v8/ScriptState.h @@ -42,7 +42,8 @@ class Frame; class Node; class Page; -class ScriptState : public Noncopyable { +class ScriptState { + WTF_MAKE_NONCOPYABLE(ScriptState); public: bool hadException() { return !m_exception.IsEmpty(); } void setException(v8::Local<v8::Value> exception) @@ -79,7 +80,8 @@ public: ~EmptyScriptState() { } }; -class ScriptStateProtectedPtr : public Noncopyable { +class ScriptStateProtectedPtr { + WTF_MAKE_NONCOPYABLE(ScriptStateProtectedPtr); public: ScriptStateProtectedPtr() : m_scriptState(0) { } ScriptStateProtectedPtr(ScriptState* scriptState) : m_scriptState(scriptState) diff --git a/Source/WebCore/bindings/v8/SerializedScriptValue.cpp b/Source/WebCore/bindings/v8/SerializedScriptValue.cpp index 6ac4a65..666e619 100644 --- a/Source/WebCore/bindings/v8/SerializedScriptValue.cpp +++ b/Source/WebCore/bindings/v8/SerializedScriptValue.cpp @@ -128,7 +128,8 @@ private: // Writer is responsible for serializing primitive types and storing // information used to reconstruct composite types. -class Writer : Noncopyable { +class Writer { + WTF_MAKE_NONCOPYABLE(Writer); public: Writer() : m_position(0) @@ -377,7 +378,8 @@ public: } private: - class StateBase : public Noncopyable { + class StateBase { + WTF_MAKE_NONCOPYABLE(StateBase); public: virtual ~StateBase() { } @@ -1129,12 +1131,18 @@ PassRefPtr<SerializedScriptValue> SerializedScriptValue::create() return adoptRef(new SerializedScriptValue()); } -SerializedScriptValue* SerializedScriptValue::nullValue() +SerializedScriptValue* SerializedScriptValue::nullValue() { DEFINE_STATIC_LOCAL(RefPtr<SerializedScriptValue>, nullValue, (SerializedScriptValue::create())); return nullValue.get(); } +SerializedScriptValue* SerializedScriptValue::undefinedValue() +{ + DEFINE_STATIC_LOCAL(RefPtr<SerializedScriptValue>, undefinedValue, (SerializedScriptValue::create(v8::Undefined()))); + return undefinedValue.get(); +} + PassRefPtr<SerializedScriptValue> SerializedScriptValue::release() { RefPtr<SerializedScriptValue> result = adoptRef(new SerializedScriptValue(m_data, WireData)); diff --git a/Source/WebCore/bindings/v8/SerializedScriptValue.h b/Source/WebCore/bindings/v8/SerializedScriptValue.h index b534a57..ead9511 100644 --- a/Source/WebCore/bindings/v8/SerializedScriptValue.h +++ b/Source/WebCore/bindings/v8/SerializedScriptValue.h @@ -52,8 +52,9 @@ public: static PassRefPtr<SerializedScriptValue> createFromWire(String data); static PassRefPtr<SerializedScriptValue> create(String data); static PassRefPtr<SerializedScriptValue> create(); - - static SerializedScriptValue* nullValue(); + + static SerializedScriptValue* nullValue(); + static SerializedScriptValue* undefinedValue(); PassRefPtr<SerializedScriptValue> release(); diff --git a/Source/WebCore/bindings/v8/V8ConsoleMessage.cpp b/Source/WebCore/bindings/v8/V8ConsoleMessage.cpp deleted file mode 100644 index e6871fd..0000000 --- a/Source/WebCore/bindings/v8/V8ConsoleMessage.cpp +++ /dev/null @@ -1,142 +0,0 @@ -/* - * 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" -#include "V8ConsoleMessage.h" - -#include "Console.h" -#include "DOMWindow.h" -#include "Frame.h" -#include "OwnPtr.h" -#include "Page.h" -#include "ScriptCallStack.h" -#include "ScriptCallStackFactory.h" -#include "V8Binding.h" -#include "V8Proxy.h" - -namespace WebCore { - -Vector<V8ConsoleMessage>* V8ConsoleMessage::m_delayedMessages = 0; - -V8ConsoleMessage::V8ConsoleMessage(const String& string, const String& sourceID, unsigned lineNumber) - : m_string(string) - , m_sourceID(sourceID) - , m_lineNumber(lineNumber) -{ -} - -void V8ConsoleMessage::dispatchNow(Page* page) -{ - dispatchNow(page, 0); -} - -void V8ConsoleMessage::dispatchLater() -{ - if (!m_delayedMessages) { - // Allocate a vector for the delayed messages. Will be - // deallocated when the delayed messages are processed - // in processDelayed(). - m_delayedMessages = new Vector<V8ConsoleMessage>(); - } - - m_delayedMessages->append(*this); -} - -void V8ConsoleMessage::processDelayed() -{ - if (!m_delayedMessages) - return; - - // Take ownership of the delayed vector to avoid re-entrancy issues. - OwnPtr<Vector<V8ConsoleMessage> > delayedMessages(m_delayedMessages); - m_delayedMessages = 0; - - // If we have a delayed vector it cannot be empty. - ASSERT(!delayedMessages->isEmpty()); - - // Add the delayed messages to the page of the active - // context. If that for some bizarre reason does not - // exist, we clear the list of delayed messages to avoid - // posting messages. We still deallocate the vector. - Frame* frame = V8Proxy::retrieveFrameForEnteredContext(); - if (!frame) - return; - Page* page = frame->page(); - if (!page) - return; - - // Iterate through all the delayed messages and add them - // to the console. - const int size = delayedMessages->size(); - for (int i = 0; i < size; ++i) - delayedMessages->at(i).dispatchNow(page); -} - -void V8ConsoleMessage::handler(v8::Handle<v8::Message> message, v8::Handle<v8::Value> data) -{ - // Use the frame where JavaScript is called from. - Frame* frame = V8Proxy::retrieveFrameForEnteredContext(); - if (!frame) - return; - Page* page = frame->page(); - if (!page) - return; - - v8::Handle<v8::String> errorMessageString = message->Get(); - ASSERT(!errorMessageString.IsEmpty()); - String errorMessage = toWebCoreString(errorMessageString); - - v8::Handle<v8::StackTrace> stackTrace = message->GetStackTrace(); - RefPtr<ScriptCallStack> callStack; - // Currently stack trace is only collected when inspector is open. - if (!stackTrace.IsEmpty() && stackTrace->GetFrameCount() > 0) - callStack = createScriptCallStack(stackTrace, ScriptCallStack::maxCallStackSizeToCapture); - - v8::Handle<v8::Value> resourceName = message->GetScriptResourceName(); - bool useURL = resourceName.IsEmpty() || !resourceName->IsString(); - String resourceNameString = useURL ? frame->document()->url() : toWebCoreString(resourceName); - V8ConsoleMessage consoleMessage(errorMessage, resourceNameString, message->GetLineNumber()); - consoleMessage.dispatchNow(page, callStack); -} - -void V8ConsoleMessage::dispatchNow(Page* page, PassRefPtr<ScriptCallStack> callStack) -{ - ASSERT(page); - - // Process any delayed messages to make sure that messages - // appear in the right order in the console. - processDelayed(); - - Console* console = page->mainFrame()->domWindow()->console(); - MessageType messageType = callStack ? UncaughtExceptionMessageType : LogMessageType; - console->addMessage(JSMessageSource, messageType, ErrorMessageLevel, m_string, m_lineNumber, m_sourceID, callStack); -} - -} // namespace WebCore diff --git a/Source/WebCore/bindings/v8/V8ConsoleMessage.h b/Source/WebCore/bindings/v8/V8ConsoleMessage.h deleted file mode 100644 index 97de24f..0000000 --- a/Source/WebCore/bindings/v8/V8ConsoleMessage.h +++ /dev/null @@ -1,94 +0,0 @@ -/* - * 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. - */ - -#ifndef V8ConsoleMessage_h -#define V8ConsoleMessage_h - -#include "PlatformString.h" -#include <v8.h> -#include <wtf/PassOwnPtr.h> -#include <wtf/Vector.h> - -namespace WebCore { - - class Page; - class ScriptCallStack; - - // V8ConsoleMessage encapsulates everything needed to - // log messages originating from JavaScript to the console. - class V8ConsoleMessage { - public: - V8ConsoleMessage(const String& string, const String& sourceID, unsigned lineNumber); - - // Add a message to the console. May end up calling JavaScript code - // indirectly through the inspector so only call this function when - // it is safe to do allocations. - void dispatchNow(Page*); - - // Add a message to the console but delay the reporting until it - // is safe to do so: Either when we leave JavaScript execution or - // when adding other console messages. The primary purpose of this - // method is to avoid calling into V8 to handle console messages - // when the VM is in a state that does not support GCs or allocations. - // Delayed messages are always reported in the page corresponding - // to the active context. - void dispatchLater(); - - // Process any delayed messages. May end up calling JavaScript code - // indirectly through the inspector so only call this function when - // it is safe to do allocations. - static void processDelayed(); - - // Convenience class for ensuring that delayed messages in the - // ConsoleMessageManager are processed quickly. - class Scope { - public: - Scope() { V8ConsoleMessage::processDelayed(); } - ~Scope() { V8ConsoleMessage::processDelayed(); } - }; - - // Callback from V8. - static void handler(v8::Handle<v8::Message>, v8::Handle<v8::Value> data); - - private: - const String m_string; - const String m_sourceID; - const unsigned m_lineNumber; - - void dispatchNow(Page*, PassRefPtr<ScriptCallStack>); - - // All delayed messages are stored in this vector. If the vector - // is 0, there are no delayed messages. - static Vector<V8ConsoleMessage>* m_delayedMessages; - }; - -} // namespace WebCore - -#endif // V8ConsoleMessage_h diff --git a/Source/WebCore/bindings/v8/V8DOMMap.h b/Source/WebCore/bindings/v8/V8DOMMap.h index c2b5a9d..51d933a 100644 --- a/Source/WebCore/bindings/v8/V8DOMMap.h +++ b/Source/WebCore/bindings/v8/V8DOMMap.h @@ -60,7 +60,7 @@ namespace WebCore { virtual void set(KeyType* obj, v8::Persistent<ValueType> wrapper) = 0; virtual bool contains(KeyType* obj) = 0; virtual void visit(DOMDataStore* store, Visitor* visitor) = 0; - virtual bool removeIfPresent(KeyType* key, v8::Persistent<v8::Data> value) = 0; + virtual bool removeIfPresent(KeyType*, v8::Persistent<ValueType>) = 0; virtual void clear() = 0; v8::WeakReferenceCallback weakReferenceCallback() { return m_weakReferenceCallback; } @@ -105,7 +105,7 @@ namespace WebCore { handle.Clear(); } - bool removeIfPresent(KeyType* key, v8::Persistent<v8::Data> value) + bool removeIfPresent(KeyType* key, v8::Persistent<ValueType> value) { typename HashMap<KeyType*, ValueType*>::iterator it = m_map.find(key); if (it == m_map.end() || it->second != *value) diff --git a/Source/WebCore/bindings/v8/V8DOMWindowShell.cpp b/Source/WebCore/bindings/v8/V8DOMWindowShell.cpp index 9918577..f53e1b7 100644 --- a/Source/WebCore/bindings/v8/V8DOMWindowShell.cpp +++ b/Source/WebCore/bindings/v8/V8DOMWindowShell.cpp @@ -39,12 +39,13 @@ #include "FrameLoaderClient.h" #include "Page.h" #include "PageGroup.h" +#include "ScriptCallStack.h" +#include "ScriptCallStackFactory.h" #include "ScriptController.h" #include "StorageNamespace.h" #include "V8Binding.h" #include "V8BindingState.h" #include "V8Collection.h" -#include "V8ConsoleMessage.h" #include "V8DOMMap.h" #include "V8DOMWindow.h" #include "V8Document.h" @@ -88,12 +89,36 @@ static void reportFatalErrorInV8(const char* location, const char* message) // FIXME: clean up V8Proxy and disable JavaScript. int memoryUsageMB = -1; #if PLATFORM(CHROMIUM) - memoryUsageMB = ChromiumBridge::actualMemoryUsageMB(); + memoryUsageMB = PlatformBridge::actualMemoryUsageMB(); #endif printf("V8 error: %s (%s). Current memory usage: %d MB\n", message, location, memoryUsageMB); handleFatalErrorInV8(); } +static void v8UncaughtExceptionHandler(v8::Handle<v8::Message> message, v8::Handle<v8::Value> data) +{ + // Use the frame where JavaScript is called from. + Frame* frame = V8Proxy::retrieveFrameForEnteredContext(); + if (!frame) + return; + + v8::Handle<v8::String> errorMessageString = message->Get(); + ASSERT(!errorMessageString.IsEmpty()); + String errorMessage = toWebCoreString(errorMessageString); + + v8::Handle<v8::StackTrace> stackTrace = message->GetStackTrace(); + RefPtr<ScriptCallStack> callStack; + // Currently stack trace is only collected when inspector is open. + if (!stackTrace.IsEmpty() && stackTrace->GetFrameCount() > 0) + callStack = createScriptCallStack(stackTrace, ScriptCallStack::maxCallStackSizeToCapture); + + v8::Handle<v8::Value> resourceName = message->GetScriptResourceName(); + bool useURL = resourceName.IsEmpty() || !resourceName->IsString(); + Document* document = frame->document(); + String resourceNameString = useURL ? document->url() : toWebCoreString(resourceName); + document->reportException(errorMessage, message->GetLineNumber(), resourceNameString, callStack); +} + // Returns the owner frame pointer of a DOM wrapper object. It only works for // these DOM objects requiring cross-domain access check. static Frame* getTargetFrame(v8::Local<v8::Object> host, v8::Local<v8::Value> data) @@ -121,7 +146,7 @@ static void reportUnsafeJavaScriptAccess(v8::Local<v8::Object> host, v8::AccessT { Frame* target = getTargetFrame(host, data); if (target) - V8Proxy::reportUnsafeAccessTo(target, V8Proxy::ReportLater); + V8Proxy::reportUnsafeAccessTo(target); } PassRefPtr<V8DOMWindowShell> V8DOMWindowShell::create(Frame* frame) @@ -270,7 +295,7 @@ bool V8DOMWindowShell::initContextIfNeeded() v8::V8::SetGlobalGCPrologueCallback(&V8GCController::gcPrologue); v8::V8::SetGlobalGCEpilogueCallback(&V8GCController::gcEpilogue); - v8::V8::AddMessageListener(&V8ConsoleMessage::handler); + v8::V8::AddMessageListener(&v8UncaughtExceptionHandler); v8::V8::SetFailedAccessCheckCallbackFunction(reportUnsafeJavaScriptAccess); diff --git a/Source/WebCore/bindings/v8/V8EventListener.h b/Source/WebCore/bindings/v8/V8EventListener.h index fb6c0bc..bcf7213 100644 --- a/Source/WebCore/bindings/v8/V8EventListener.h +++ b/Source/WebCore/bindings/v8/V8EventListener.h @@ -54,8 +54,7 @@ namespace WebCore { v8::Local<v8::Function> getListenerFunction(ScriptExecutionContext*); - private: - virtual v8::Local<v8::Value> callListenerFunction(ScriptExecutionContext*, v8::Handle<v8::Value> jsEvent, Event*); + virtual v8::Local<v8::Value> callListenerFunction(ScriptExecutionContext*, v8::Handle<v8::Value> jsEvent, Event*); }; } // namespace WebCore diff --git a/Source/WebCore/bindings/v8/V8NPUtils.cpp b/Source/WebCore/bindings/v8/V8NPUtils.cpp index 250ee5b..dccdb15 100644 --- a/Source/WebCore/bindings/v8/V8NPUtils.cpp +++ b/Source/WebCore/bindings/v8/V8NPUtils.cpp @@ -63,9 +63,14 @@ void convertV8ObjectToNPVariant(v8::Local<v8::Value> object, NPObject* owner, NP VOID_TO_NPVARIANT(*result); else if (object->IsString()) { v8::String::Utf8Value utf8(object); +<<<<<<< HEAD int length = utf8.length() + 1; char* utf8Chars = reinterpret_cast<char*>(malloc(length)); memcpy(utf8Chars, *utf8, length); +======= + char* utf8Chars = reinterpret_cast<char*>(malloc(utf8.length())); + memcpy(utf8Chars, *utf8, utf8.length()); +>>>>>>> WebKit.org at r76408 STRINGN_TO_NPVARIANT(utf8Chars, utf8.length(), *result); } else if (object->IsObject()) { DOMWindow* window = V8Proxy::retrieveWindow(V8Proxy::currentContext()); diff --git a/Source/WebCore/bindings/v8/V8Proxy.cpp b/Source/WebCore/bindings/v8/V8Proxy.cpp index 5eaba00..831a6ef 100644 --- a/Source/WebCore/bindings/v8/V8Proxy.cpp +++ b/Source/WebCore/bindings/v8/V8Proxy.cpp @@ -50,7 +50,6 @@ #include "V8Binding.h" #include "V8BindingState.h" #include "V8Collection.h" -#include "V8ConsoleMessage.h" #include "V8DOMCoreException.h" #include "V8DOMMap.h" #include "V8DOMWindow.h" @@ -139,21 +138,22 @@ typedef HashMap<int, v8::FunctionTemplate*> FunctionTemplateMap; bool AllowAllocation::m_current = false; +static void addMessageToConsole(Page* page, const String& message, const String& sourceID, unsigned lineNumber) +{ + ASSERT(page); + Console* console = page->mainFrame()->domWindow()->console(); + console->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, message, lineNumber, sourceID); +} + void logInfo(Frame* frame, const String& message, const String& url) { Page* page = frame->page(); if (!page) return; - V8ConsoleMessage consoleMessage(message, url, 0); - consoleMessage.dispatchNow(page); + addMessageToConsole(page, message, url, 0); } -enum DelayReporting { - ReportLater, - ReportNow -}; - -void V8Proxy::reportUnsafeAccessTo(Frame* target, DelayReporting delay) +void V8Proxy::reportUnsafeAccessTo(Frame* target) { ASSERT(target); Document* targetDocument = target->document(); @@ -174,20 +174,11 @@ void V8Proxy::reportUnsafeAccessTo(Frame* target, DelayReporting delay) // Build a console message with fake source ID and line number. const String kSourceID = ""; const int kLineNumber = 1; - V8ConsoleMessage message(str, kSourceID, kLineNumber); - if (delay == ReportNow) { - // NOTE: Safari prints the message in the target page, but it seems like - // it should be in the source page. Even for delayed messages, we put it in - // the source page; see V8ConsoleMessage::processDelayed(). - message.dispatchNow(source->page()); - } else { - ASSERT(delay == ReportLater); - // We cannot safely report the message eagerly, because this may cause - // allocations and GCs internally in V8 and we cannot handle that at this - // point. Therefore we delay the reporting. - message.dispatchLater(); - } + // NOTE: Safari prints the message in the target page, but it seems like + // it should be in the source page. Even for delayed messages, we put it in + // the source page. + addMessageToConsole(source->page(), str, kSourceID, kLineNumber); } static void handleFatalErrorInV8() @@ -440,8 +431,6 @@ v8::Local<v8::Value> V8Proxy::runScriptInternal(v8::Handle<v8::Script> script, b // Run the script and keep track of the current recursion depth. v8::Local<v8::Value> result; { - V8ConsoleMessage::Scope scope; - // See comment in V8Proxy::callFunction. m_frame->keepAlive(); @@ -477,8 +466,6 @@ v8::Local<v8::Value> V8Proxy::callFunction(v8::Handle<v8::Function> function, v8 V8GCController::checkMemoryUsage(); v8::Local<v8::Value> result; { - V8ConsoleMessage::Scope scope; - if (m_recursion >= kMaxRecursionDepth) { v8::Local<v8::String> code = v8::String::New("throw new RangeError('Maximum call stack size exceeded.')"); if (code.IsEmpty()) @@ -545,8 +532,6 @@ v8::Local<v8::Value> V8Proxy::newInstance(v8::Handle<v8::Function> constructor, // V8Proxy::callFunction. v8::Local<v8::Value> result; { - V8ConsoleMessage::Scope scope; - // See comment in V8Proxy::callFunction. m_frame->keepAlive(); @@ -808,11 +793,6 @@ v8::Handle<v8::Value> V8Proxy::checkNewLegal(const v8::Arguments& args) return args.This(); } -void V8Proxy::processConsoleMessages() -{ - V8ConsoleMessage::processDelayed(); -} - void V8Proxy::registerExtensionWithV8(v8::Extension* extension) { // If the extension exists in our list, it was already registered with V8. diff --git a/Source/WebCore/bindings/v8/V8Proxy.h b/Source/WebCore/bindings/v8/V8Proxy.h index 34e80e1..746d8f8 100644 --- a/Source/WebCore/bindings/v8/V8Proxy.h +++ b/Source/WebCore/bindings/v8/V8Proxy.h @@ -132,12 +132,6 @@ namespace WebCore { GeneralError }; - // When to report errors. - enum DelayReporting { - ReportLater, - ReportNow - }; - explicit V8Proxy(Frame*); ~V8Proxy(); @@ -271,9 +265,6 @@ namespace WebCore { template <typename T> static v8::Handle<v8::Value> constructDOMObjectWithScriptExecutionContext(const v8::Arguments&, WrapperTypeInfo*); - // Process any pending JavaScript console messages. - static void processConsoleMessages(); - v8::Local<v8::Context> context(); v8::Local<v8::Context> mainWorldContext(); @@ -294,7 +285,7 @@ namespace WebCore { static const V8Extensions& extensions() { return m_extensions; } // Report an unsafe attempt to access the given frame on the console. - static void reportUnsafeAccessTo(Frame* target, DelayReporting delay); + static void reportUnsafeAccessTo(Frame* target); private: void didLeaveScriptContext(); diff --git a/Source/WebCore/bindings/v8/V8WindowErrorHandler.cpp b/Source/WebCore/bindings/v8/V8WindowErrorHandler.cpp new file mode 100644 index 0000000..4203ad5 --- /dev/null +++ b/Source/WebCore/bindings/v8/V8WindowErrorHandler.cpp @@ -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. + */ + +#include "config.h" + +#include "V8WindowErrorHandler.h" + +#include "ErrorEvent.h" +#include "V8Binding.h" + +namespace WebCore { + +V8WindowErrorHandler::V8WindowErrorHandler(v8::Local<v8::Object> listener, bool isInline, const WorldContextHandle& worldContext) + : V8EventListener(listener, isInline, worldContext) +{ +} + +v8::Local<v8::Value> V8WindowErrorHandler::callListenerFunction(ScriptExecutionContext* context, v8::Handle<v8::Value> jsEvent, Event* event) +{ + if (!event->isErrorEvent()) + return V8EventListener::callListenerFunction(context, jsEvent, event); + + ErrorEvent* errorEvent = static_cast<ErrorEvent*>(event); + v8::Local<v8::Object> listener = getListenerObject(context); + v8::Local<v8::Value> returnValue; + if (!listener.IsEmpty() && listener->IsFunction()) { + v8::Local<v8::Function> callFunction = v8::Local<v8::Function>::Cast(listener); + v8::Local<v8::Object> thisValue = v8::Context::GetCurrent()->Global(); + v8::Handle<v8::Value> parameters[3] = { v8String(errorEvent->message()), v8String(errorEvent->filename()), v8::Integer::New(errorEvent->lineno()) }; + returnValue = callFunction->Call(thisValue, 3, parameters); + if (!returnValue.IsEmpty() && returnValue->IsBoolean() && !returnValue->BooleanValue()) + event->preventDefault(); + } + return returnValue; +} + +} // namespace WebCore diff --git a/Source/WebCore/bindings/v8/V8WindowErrorHandler.h b/Source/WebCore/bindings/v8/V8WindowErrorHandler.h new file mode 100644 index 0000000..493a9bf --- /dev/null +++ b/Source/WebCore/bindings/v8/V8WindowErrorHandler.h @@ -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. + */ + +#ifndef V8WindowErrorHandler_h +#define V8WindowErrorHandler_h + +#include "V8EventListener.h" +#include <v8.h> +#include <wtf/PassRefPtr.h> + +namespace WebCore { + +class V8WindowErrorHandler : public V8EventListener { +public: + static PassRefPtr<V8WindowErrorHandler> create(v8::Local<v8::Object> listener, bool isInline, const WorldContextHandle& worldContext) + { + return adoptRef(new V8WindowErrorHandler(listener, isInline, worldContext)); + } + +private: + V8WindowErrorHandler(v8::Local<v8::Object> listener, bool isInline, const WorldContextHandle& worldContext); + + virtual v8::Local<v8::Value> callListenerFunction(ScriptExecutionContext*, v8::Handle<v8::Value> jsEvent, Event*); +}; + +} // namespace WebCore + +#endif // V8WindowErrorHandler_h diff --git a/Source/WebCore/bindings/v8/WorkerContextExecutionProxy.cpp b/Source/WebCore/bindings/v8/WorkerContextExecutionProxy.cpp index cefb2fa..aef892a 100644 --- a/Source/WebCore/bindings/v8/WorkerContextExecutionProxy.cpp +++ b/Source/WebCore/bindings/v8/WorkerContextExecutionProxy.cpp @@ -37,10 +37,10 @@ #include "DedicatedWorkerContext.h" #include "Event.h" +#include "ScriptCallStack.h" #include "SharedWorker.h" #include "SharedWorkerContext.h" #include "V8Binding.h" -#include "V8ConsoleMessage.h" #include "V8DOMMap.h" #include "V8DedicatedWorkerContext.h" #include "V8Proxy.h" @@ -72,7 +72,7 @@ static void v8MessageHandler(v8::Handle<v8::Message> message, v8::Handle<v8::Val String errorMessage = toWebCoreString(message->Get()); int lineNumber = message->GetLineNumber(); String sourceURL = toWebCoreString(message->GetScriptResourceName()); - context->reportException(errorMessage, lineNumber, sourceURL); + context->reportException(errorMessage, lineNumber, sourceURL, 0); } isReportingException = false; diff --git a/Source/WebCore/bindings/v8/WorkerScriptController.cpp b/Source/WebCore/bindings/v8/WorkerScriptController.cpp index b56d383..42e02e6 100644 --- a/Source/WebCore/bindings/v8/WorkerScriptController.cpp +++ b/Source/WebCore/bindings/v8/WorkerScriptController.cpp @@ -34,11 +34,10 @@ #include "WorkerScriptController.h" -#include <v8.h> - +#include "DOMTimer.h" +#include "ScriptCallStack.h" #include "ScriptSourceCode.h" #include "ScriptValue.h" -#include "DOMTimer.h" #include "V8DOMMap.h" #include "V8Proxy.h" #include "V8WorkerContext.h" @@ -46,6 +45,7 @@ #include "WorkerContextExecutionProxy.h" #include "WorkerObjectProxy.h" #include "WorkerThread.h" +#include <v8.h> namespace WebCore { @@ -80,7 +80,7 @@ ScriptValue WorkerScriptController::evaluate(const ScriptSourceCode& sourceCode, if (exception) *exception = state.exception; else - m_workerContext->reportException(state.errorMessage, state.lineNumber, state.sourceURL); + m_workerContext->reportException(state.errorMessage, state.lineNumber, state.sourceURL, 0); } return result; diff --git a/Source/WebCore/bindings/v8/custom/V8HTMLCollectionCustom.cpp b/Source/WebCore/bindings/v8/custom/V8HTMLCollectionCustom.cpp index 9e89ce8..3d64edd 100644 --- a/Source/WebCore/bindings/v8/custom/V8HTMLCollectionCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8HTMLCollectionCustom.cpp @@ -59,7 +59,10 @@ static v8::Handle<v8::Value> getItem(HTMLCollection* collection, v8::Handle<v8:: { v8::Local<v8::Uint32> index = argument->ToArrayIndex(); if (index.IsEmpty()) { - v8::Handle<v8::Value> result = getNamedItems(collection, toWebCoreString(argument->ToString())); + v8::Local<v8::String> asString = argument->ToString(); + if (asString.IsEmpty()) + return v8::Handle<v8::Value>(); + v8::Handle<v8::Value> result = getNamedItems(collection, toWebCoreString(asString)); if (result.IsEmpty()) return v8::Undefined(); diff --git a/Source/WebCore/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp b/Source/WebCore/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp index 70df7c1..7fdfc55 100644 --- a/Source/WebCore/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp @@ -48,6 +48,7 @@ #include "V8Int16Array.h" #include "V8Int32Array.h" #include "V8Int8Array.h" +#include "V8OESStandardDerivatives.h" #include "V8OESTextureFloat.h" #include "V8Proxy.h" #include "V8Uint16Array.h" @@ -160,6 +161,9 @@ static v8::Handle<v8::Value> toV8Object(WebGLExtension* extension, v8::Handle<v8 case WebGLExtension::WebKitLoseContextName: extensionObject = toV8(static_cast<WebKitLoseContext*>(extension)); break; + case WebGLExtension::OESStandardDerivativesName: + extensionObject = toV8(static_cast<OESStandardDerivatives*>(extension)); + break; case WebGLExtension::OESTextureFloatName: extensionObject = toV8(static_cast<OESTextureFloat*>(extension)); break; diff --git a/Source/WebCore/bindings/v8/specialization/V8BindingState.cpp b/Source/WebCore/bindings/v8/specialization/V8BindingState.cpp index 891272c..e00e35b 100644 --- a/Source/WebCore/bindings/v8/specialization/V8BindingState.cpp +++ b/Source/WebCore/bindings/v8/specialization/V8BindingState.cpp @@ -81,7 +81,7 @@ Frame* State<V8Binding>::firstFrame() void State<V8Binding>::immediatelyReportUnsafeAccessTo(Frame* target) { - V8Proxy::reportUnsafeAccessTo(target, V8Proxy::ReportNow); + V8Proxy::reportUnsafeAccessTo(target); } bool State<V8Binding>::processingUserGesture() diff --git a/Source/WebCore/bridge/Bridge.h b/Source/WebCore/bridge/Bridge.h index 50efc64..00d6f36 100644 --- a/Source/WebCore/bridge/Bridge.h +++ b/Source/WebCore/bridge/Bridge.h @@ -28,14 +28,15 @@ #define Bridge_h #include "BridgeJSC.h" -#include <wtf/Noncopyable.h> namespace JSC { namespace Bindings { -class Method : public Noncopyable { +class Method { + WTF_MAKE_NONCOPYABLE(Method); WTF_MAKE_FAST_ALLOCATED; public: + Method() { } virtual int numParameters() const = 0; virtual ~Method() { } diff --git a/Source/WebCore/bridge/IdentifierRep.h b/Source/WebCore/bridge/IdentifierRep.h index 99bae0b..8646e92 100644 --- a/Source/WebCore/bridge/IdentifierRep.h +++ b/Source/WebCore/bridge/IdentifierRep.h @@ -33,7 +33,8 @@ namespace WebCore { -class IdentifierRep : public FastAllocBase { +class IdentifierRep { + WTF_MAKE_FAST_ALLOCATED; public: static IdentifierRep* get(int); static IdentifierRep* get(const char*); diff --git a/Source/WebCore/bridge/jsc/BridgeJSC.h b/Source/WebCore/bridge/jsc/BridgeJSC.h index 96974d9..ebcfaad 100644 --- a/Source/WebCore/bridge/jsc/BridgeJSC.h +++ b/Source/WebCore/bridge/jsc/BridgeJSC.h @@ -59,8 +59,10 @@ public: virtual ~Field() { } }; -class Class : public Noncopyable { +class Class { + WTF_MAKE_NONCOPYABLE(Class); WTF_MAKE_FAST_ALLOCATED; public: + Class() { } virtual MethodList methodsNamed(const Identifier&, Instance*) const = 0; virtual Field* fieldNamed(const Identifier&, Instance*) const = 0; virtual JSValue fallbackObject(ExecState*, Instance*, const Identifier&) { return jsUndefined(); } @@ -125,7 +127,8 @@ private: WeakGCPtr<RuntimeObject> m_runtimeObject; }; -class Array : public Noncopyable { +class Array { + WTF_MAKE_NONCOPYABLE(Array); public: Array(PassRefPtr<RootObject>); virtual ~Array(); diff --git a/Source/WebCore/css/CSSGradientValue.cpp b/Source/WebCore/css/CSSGradientValue.cpp index fde4a4e..b6b9ebe 100644 --- a/Source/WebCore/css/CSSGradientValue.cpp +++ b/Source/WebCore/css/CSSGradientValue.cpp @@ -230,58 +230,68 @@ void CSSGradientValue::addStops(Gradient* gradient, RenderObject* renderer, Rend // We can't just push this logic down into the platform-specific Gradient code, // because we have to know the extent of the gradient, and possible move the end points. if (m_repeating && numStops > 1) { - float maxExtent = 1; - - // Radial gradients may need to extend further than the endpoints, because they have - // to repeat out to the corners of the box. - if (isRadialGradient()) { - if (!computedGradientLength) { - FloatSize gradientSize(gradientStart - gradientEnd); - gradientLength = gradientSize.diagonalLength(); - } - - if (maxLengthForRepeat > gradientLength) - maxExtent = maxLengthForRepeat / gradientLength; - } + // If the difference in the positions of the first and last color-stops is 0, + // the gradient defines a solid-color image with the color of the last color-stop in the rule. + float gradientRange = stops[numStops - 1].offset - stops[0].offset; + if (!gradientRange) { + stops.first().offset = 0; + stops.first().color = stops.last().color; + stops.shrink(1); + numStops = 1; + } else { + float maxExtent = 1; - size_t originalNumStops = numStops; - size_t originalFirstStopIndex = 0; + // Radial gradients may need to extend further than the endpoints, because they have + // to repeat out to the corners of the box. + if (isRadialGradient()) { + if (!computedGradientLength) { + FloatSize gradientSize(gradientStart - gradientEnd); + gradientLength = gradientSize.diagonalLength(); + } + + if (maxLengthForRepeat > gradientLength) + maxExtent = maxLengthForRepeat / gradientLength; + } - // Work backwards from the first, adding stops until we get one before 0. - float firstOffset = stops[0].offset; - if (firstOffset > 0) { - float currOffset = firstOffset; - size_t srcStopOrdinal = originalNumStops - 1; - - while (true) { - GradientStop newStop = stops[originalFirstStopIndex + srcStopOrdinal]; - newStop.offset = currOffset; - stops.prepend(newStop); - ++originalFirstStopIndex; - if (currOffset < 0) - break; + size_t originalNumStops = numStops; + size_t originalFirstStopIndex = 0; - if (srcStopOrdinal) - currOffset -= stops[originalFirstStopIndex + srcStopOrdinal].offset - stops[originalFirstStopIndex + srcStopOrdinal - 1].offset; - srcStopOrdinal = (srcStopOrdinal + originalNumStops - 1) % originalNumStops; + // Work backwards from the first, adding stops until we get one before 0. + float firstOffset = stops[0].offset; + if (firstOffset > 0) { + float currOffset = firstOffset; + size_t srcStopOrdinal = originalNumStops - 1; + + while (true) { + GradientStop newStop = stops[originalFirstStopIndex + srcStopOrdinal]; + newStop.offset = currOffset; + stops.prepend(newStop); + ++originalFirstStopIndex; + if (currOffset < 0) + break; + + if (srcStopOrdinal) + currOffset -= stops[originalFirstStopIndex + srcStopOrdinal].offset - stops[originalFirstStopIndex + srcStopOrdinal - 1].offset; + srcStopOrdinal = (srcStopOrdinal + originalNumStops - 1) % originalNumStops; + } } - } - - // Work forwards from the end, adding stops until we get one after 1. - float lastOffset = stops[stops.size() - 1].offset; - if (lastOffset < maxExtent) { - float currOffset = lastOffset; - size_t srcStopOrdinal = 0; - - while (true) { - GradientStop newStop = stops[srcStopOrdinal]; - newStop.offset = currOffset; - stops.append(newStop); - if (currOffset > maxExtent) - break; - if (srcStopOrdinal < originalNumStops - 1) - currOffset += stops[originalFirstStopIndex + srcStopOrdinal + 1].offset - stops[originalFirstStopIndex + srcStopOrdinal].offset; - srcStopOrdinal = (srcStopOrdinal + 1) % originalNumStops; + + // Work forwards from the end, adding stops until we get one after 1. + float lastOffset = stops[stops.size() - 1].offset; + if (lastOffset < maxExtent) { + float currOffset = lastOffset; + size_t srcStopOrdinal = 0; + + while (true) { + GradientStop newStop = stops[srcStopOrdinal]; + newStop.offset = currOffset; + stops.append(newStop); + if (currOffset > maxExtent) + break; + if (srcStopOrdinal < originalNumStops - 1) + currOffset += stops[originalFirstStopIndex + srcStopOrdinal + 1].offset - stops[originalFirstStopIndex + srcStopOrdinal].offset; + srcStopOrdinal = (srcStopOrdinal + 1) % originalNumStops; + } } } } diff --git a/Source/WebCore/css/CSSImageValue.h b/Source/WebCore/css/CSSImageValue.h index 833d7fe..174f1ed 100644 --- a/Source/WebCore/css/CSSImageValue.h +++ b/Source/WebCore/css/CSSImageValue.h @@ -32,6 +32,7 @@ class StyleCachedImage; class StyleImage; class CSSImageValue : public CSSPrimitiveValue, private CachedResourceClient { + WTF_MAKE_FAST_ALLOCATED; public: static PassRefPtr<CSSImageValue> create() { return adoptRef(new CSSImageValue); } static PassRefPtr<CSSImageValue> create(const String& url) { return adoptRef(new CSSImageValue(url)); } diff --git a/Source/WebCore/css/CSSImportRule.h b/Source/WebCore/css/CSSImportRule.h index 943d53e..3f44f5b 100644 --- a/Source/WebCore/css/CSSImportRule.h +++ b/Source/WebCore/css/CSSImportRule.h @@ -34,6 +34,7 @@ class CachedCSSStyleSheet; class MediaList; class CSSImportRule : public CSSRule, private CachedResourceClient { + WTF_MAKE_FAST_ALLOCATED; public: static PassRefPtr<CSSImportRule> create(CSSStyleSheet* parent, const String& href, PassRefPtr<MediaList> media) { diff --git a/Source/WebCore/css/CSSMutableStyleDeclaration.h b/Source/WebCore/css/CSSMutableStyleDeclaration.h index f7d8ca9..35f1cc4 100644 --- a/Source/WebCore/css/CSSMutableStyleDeclaration.h +++ b/Source/WebCore/css/CSSMutableStyleDeclaration.h @@ -135,6 +135,8 @@ public: bool useStrictParsing() const { return m_strictParsing; } void addSubresourceStyleURLs(ListHashSet<KURL>&); + + bool propertiesEqual(const CSSMutableStyleDeclaration* o) const { return m_properties == o->m_properties; } protected: CSSMutableStyleDeclaration(CSSRule* parentRule); diff --git a/Source/WebCore/css/CSSNamespace.h b/Source/WebCore/css/CSSNamespace.h index 6225c36..92638f2 100644 --- a/Source/WebCore/css/CSSNamespace.h +++ b/Source/WebCore/css/CSSNamespace.h @@ -26,7 +26,9 @@ namespace WebCore { - struct CSSNamespace : Noncopyable { + struct CSSNamespace { + WTF_MAKE_NONCOPYABLE(CSSNamespace); WTF_MAKE_FAST_ALLOCATED; + public: AtomicString prefix; AtomicString uri; OwnPtr<CSSNamespace> parent; diff --git a/Source/WebCore/css/CSSParser.cpp b/Source/WebCore/css/CSSParser.cpp index fd5841f..9142e67 100644 --- a/Source/WebCore/css/CSSParser.cpp +++ b/Source/WebCore/css/CSSParser.cpp @@ -1965,7 +1965,8 @@ void CSSParser::addFillValue(RefPtr<CSSValue>& lval, PassRefPtr<CSSValue> rval) static bool parseBackgroundClip(CSSParserValue* parserValue, RefPtr<CSSValue>& cssValue) { - if (parserValue->id == CSSValueBorderBox || parserValue->id == CSSValuePaddingBox || parserValue->id == CSSValueWebkitText) { + if (parserValue->id == CSSValueBorderBox || parserValue->id == CSSValuePaddingBox + || parserValue->id == CSSValueContentBox || parserValue->id == CSSValueWebkitText) { cssValue = CSSPrimitiveValue::createIdentifier(parserValue->id); return true; } diff --git a/Source/WebCore/css/CSSParser.h b/Source/WebCore/css/CSSParser.h index 496a21a..d326812 100644 --- a/Source/WebCore/css/CSSParser.h +++ b/Source/WebCore/css/CSSParser.h @@ -340,7 +340,8 @@ namespace WebCore { int cssPropertyID(const String&); int cssValueKeywordID(const CSSParserString&); - class ShorthandScope : public FastAllocBase { + class ShorthandScope { + WTF_MAKE_FAST_ALLOCATED; public: ShorthandScope(CSSParser* parser, int propId) : m_parser(parser) { diff --git a/Source/WebCore/css/CSSParserValues.h b/Source/WebCore/css/CSSParserValues.h index 993ae28..996e783 100644 --- a/Source/WebCore/css/CSSParserValues.h +++ b/Source/WebCore/css/CSSParserValues.h @@ -59,7 +59,8 @@ struct CSSParserValue { PassRefPtr<CSSValue> createCSSValue(); }; -class CSSParserValueList : public FastAllocBase { +class CSSParserValueList { + WTF_MAKE_FAST_ALLOCATED; public: CSSParserValueList() : m_current(0) @@ -83,7 +84,9 @@ private: Vector<CSSParserValue, 4> m_values; }; -struct CSSParserFunction : FastAllocBase { +struct CSSParserFunction { + WTF_MAKE_FAST_ALLOCATED; +public: CSSParserString name; OwnPtr<CSSParserValueList> args; }; diff --git a/Source/WebCore/css/CSSProperty.h b/Source/WebCore/css/CSSProperty.h index 106171d..10e593c 100644 --- a/Source/WebCore/css/CSSProperty.h +++ b/Source/WebCore/css/CSSProperty.h @@ -29,7 +29,8 @@ namespace WebCore { -class CSSProperty : public FastAllocBase { +class CSSProperty { + WTF_MAKE_FAST_ALLOCATED; public: CSSProperty(int propID, PassRefPtr<CSSValue> value, bool important = false, int shorthandID = 0, bool implicit = false) : m_id(propID) diff --git a/Source/WebCore/css/CSSSelector.cpp b/Source/WebCore/css/CSSSelector.cpp index 400dd40..ca3814a 100644 --- a/Source/WebCore/css/CSSSelector.cpp +++ b/Source/WebCore/css/CSSSelector.cpp @@ -37,8 +37,10 @@ namespace WebCore { using namespace HTMLNames; -class CSSSelectorBag : public Noncopyable { +class CSSSelectorBag { + WTF_MAKE_NONCOPYABLE(CSSSelectorBag); public: + CSSSelectorBag() { } ~CSSSelectorBag() { ASSERT(isEmpty()); diff --git a/Source/WebCore/css/CSSSelector.h b/Source/WebCore/css/CSSSelector.h index 1101eed..b930353 100644 --- a/Source/WebCore/css/CSSSelector.h +++ b/Source/WebCore/css/CSSSelector.h @@ -33,7 +33,8 @@ namespace WebCore { class CSSSelectorBag; // this class represents a selector for a StyleRule - class CSSSelector : public Noncopyable { + class CSSSelector { + WTF_MAKE_NONCOPYABLE(CSSSelector); WTF_MAKE_FAST_ALLOCATED; public: CSSSelector() : m_relation(Descendant) @@ -278,6 +279,7 @@ namespace WebCore { return m_match == PseudoElement; } bool isUnknownPseudoElement() const; + bool isSiblingSelector() const; Relation relation() const { return static_cast<Relation>(m_relation); } @@ -305,7 +307,9 @@ namespace WebCore { unsigned specificityForPage() const; void extractPseudoType() const; - struct RareData : Noncopyable { + struct RareData { + WTF_MAKE_NONCOPYABLE(RareData); WTF_MAKE_FAST_ALLOCATED; + public: RareData(PassOwnPtr<CSSSelector> tagHistory) : m_a(0) , m_b(0) @@ -350,6 +354,24 @@ inline bool CSSSelector::isUnknownPseudoElement() const return m_match == PseudoElement && m_pseudoType == PseudoUnknown; } +inline bool CSSSelector::isSiblingSelector() const +{ + PseudoType type = pseudoType(); + return m_relation == DirectAdjacent + || m_relation == IndirectAdjacent + || type == PseudoEmpty + || type == PseudoFirstChild + || type == PseudoFirstOfType + || type == PseudoLastChild + || type == PseudoLastOfType + || type == PseudoOnlyChild + || type == PseudoOnlyOfType + || type == PseudoNthChild + || type == PseudoNthOfType + || type == PseudoNthLastChild + || type == PseudoNthLastOfType; +} + } // namespace WebCore #endif // CSSSelector_h diff --git a/Source/WebCore/css/CSSSelectorList.h b/Source/WebCore/css/CSSSelectorList.h index 7adc6b9..abd9bc8 100644 --- a/Source/WebCore/css/CSSSelectorList.h +++ b/Source/WebCore/css/CSSSelectorList.h @@ -27,11 +27,11 @@ #define CSSSelectorList_h #include "CSSSelector.h" -#include <wtf/Noncopyable.h> namespace WebCore { -class CSSSelectorList : public Noncopyable { +class CSSSelectorList { + WTF_MAKE_NONCOPYABLE(CSSSelectorList); WTF_MAKE_FAST_ALLOCATED; public: CSSSelectorList() : m_selectorArray(0) { } ~CSSSelectorList(); diff --git a/Source/WebCore/css/CSSStyleSelector.cpp b/Source/WebCore/css/CSSStyleSelector.cpp index b98b90d..5a21615 100644 --- a/Source/WebCore/css/CSSStyleSelector.cpp +++ b/Source/WebCore/css/CSSStyleSelector.cpp @@ -352,7 +352,8 @@ if (id == propID) { \ return; \ } -class CSSRuleData : public Noncopyable { +class CSSRuleData { + WTF_MAKE_NONCOPYABLE(CSSRuleData); public: CSSRuleData(unsigned pos, CSSStyleRule* r, CSSSelector* sel, CSSRuleData* prev = 0) : m_position(pos) @@ -380,7 +381,8 @@ private: CSSRuleData* m_next; }; -class CSSRuleDataList : public Noncopyable { +class CSSRuleDataList { + WTF_MAKE_NONCOPYABLE(CSSRuleDataList); public: CSSRuleDataList(unsigned pos, CSSStyleRule* rule, CSSSelector* sel) : m_first(new CSSRuleData(pos, rule, sel)) @@ -400,8 +402,8 @@ public: } } - CSSRuleData* first() { return m_first; } - CSSRuleData* last() { return m_last; } + CSSRuleData* first() const { return m_first; } + CSSRuleData* last() const { return m_last; } void append(unsigned pos, CSSStyleRule* rule, CSSSelector* sel) { m_last = new CSSRuleData(pos, rule, sel, m_last); } @@ -410,7 +412,8 @@ private: CSSRuleData* m_last; }; -class CSSRuleSet : public Noncopyable { +class CSSRuleSet { + WTF_MAKE_NONCOPYABLE(CSSRuleSet); public: CSSRuleSet(); ~CSSRuleSet(); @@ -425,6 +428,8 @@ public: void addToRuleSet(AtomicStringImpl* key, AtomRuleMap& map, CSSStyleRule* rule, CSSSelector* sel); + void collectIdsAndSiblingRules(HashSet<AtomicStringImpl*>& ids, OwnPtr<CSSRuleSet>& siblingRules) const; + CSSRuleDataList* getIDRules(AtomicStringImpl* key) { return m_idRules.get(key); } CSSRuleDataList* getClassRules(AtomicStringImpl* key) { return m_classRules.get(key); } CSSRuleDataList* getTagRules(AtomicStringImpl* key) { return m_tagRules.get(key); } @@ -448,6 +453,8 @@ static CSSRuleSet* defaultQuirksStyle; static CSSRuleSet* defaultPrintStyle; static CSSRuleSet* defaultViewSourceStyle; static CSSStyleSheet* simpleDefaultStyleSheet; + +static CSSRuleSet* siblingRulesInDefaultStyle; RenderStyle* CSSStyleSelector::s_styleNotYetAvailable; @@ -459,11 +466,31 @@ static void loadSimpleDefaultStyle(); // FIXME: It would be nice to use some mechanism that guarantees this is in sync with the real UA stylesheet. static const char* simpleUserAgentStyleSheet = "html,body,div{display:block}body{margin:8px}div:focus,span:focus{outline:auto 5px -webkit-focus-ring-color}a:-webkit-any-link{color:-webkit-link;text-decoration:underline}a:-webkit-any-link:active{color:-webkit-activelink}"; -static bool elementCanUseSimpleDefaultStyle(Element* e) +static inline bool elementCanUseSimpleDefaultStyle(Element* e) { return e->hasTagName(htmlTag) || e->hasTagName(bodyTag) || e->hasTagName(divTag) || e->hasTagName(spanTag) || e->hasTagName(brTag) || e->hasTagName(aTag); } +static inline void collectSiblingRulesInDefaultStyle() +{ + OwnPtr<CSSRuleSet> siblingRules; + HashSet<AtomicStringImpl*> ids; + defaultStyle->collectIdsAndSiblingRules(ids, siblingRules); + ASSERT(ids.isEmpty()); + delete siblingRulesInDefaultStyle; + siblingRulesInDefaultStyle = siblingRules.leakPtr(); +} + +static inline void assertNoSiblingRulesInDefaultStyle() +{ +#ifndef NDEBUG + if (siblingRulesInDefaultStyle) + return; + collectSiblingRulesInDefaultStyle(); + ASSERT(!siblingRulesInDefaultStyle); +#endif +} + static const MediaQueryEvaluator& screenEval() { DEFINE_STATIC_LOCAL(const MediaQueryEvaluator, staticScreenEval, ("screen")); @@ -549,6 +576,16 @@ CSSStyleSelector::CSSStyleSelector(Document* document, StyleSheetList* styleShee if (sheet->isCSSStyleSheet() && !sheet->disabled()) m_authorStyle->addRulesFromSheet(static_cast<CSSStyleSheet*>(sheet), *m_medium, this); } + + // Collect all ids and rules using sibling selectors (:first-child and similar) + // in the current set of stylesheets. Style sharing code uses this information to reject + // sharing candidates. + // Usually there are no sibling rules in the default style but the MathML sheet has some. + if (siblingRulesInDefaultStyle) + siblingRulesInDefaultStyle->collectIdsAndSiblingRules(m_idsInRules, m_siblingRules); + m_authorStyle->collectIdsAndSiblingRules(m_idsInRules, m_siblingRules); + if (m_userStyle) + m_userStyle->collectIdsAndSiblingRules(m_idsInRules, m_siblingRules); if (document->renderer() && document->renderer()->style()) document->renderer()->style()->font().update(fontSelector()); @@ -944,40 +981,52 @@ static const unsigned cStyleSearchThreshold = 10; Node* CSSStyleSelector::locateCousinList(Element* parent, unsigned depth) const { - if (parent && parent->isStyledElement()) { - StyledElement* p = static_cast<StyledElement*>(parent); - if (!p->inlineStyleDecl() && !p->hasID()) { - Node* r = p->previousSibling(); - unsigned subcount = 0; - RenderStyle* st = p->renderStyle(); - while (r) { - if (r->renderStyle() == st) - return r->lastChild(); - if (subcount++ == cStyleSearchThreshold) - return 0; - r = r->previousSibling(); - } - if (!r && depth < cStyleSearchThreshold) - r = locateCousinList(parent->parentElement(), depth + 1); - while (r) { - if (r->renderStyle() == st) - return r->lastChild(); - if (subcount++ == cStyleSearchThreshold) - return 0; - r = r->previousSibling(); - } - } + if (!parent || !parent->isStyledElement()) + return 0; + StyledElement* p = static_cast<StyledElement*>(parent); + if (p->inlineStyleDecl()) + return 0; + if (p->hasID() && m_idsInRules.contains(p->idForStyleResolution().impl())) + return 0; + Node* r = p->previousSibling(); + unsigned subcount = 0; + RenderStyle* st = p->renderStyle(); + while (r) { + if (r->renderStyle() == st) + return r->lastChild(); + if (subcount++ == cStyleSearchThreshold) + return 0; + r = r->previousSibling(); + } + if (!r && depth < cStyleSearchThreshold) + r = locateCousinList(parent->parentElement(), depth + 1); + while (r) { + if (r->renderStyle() == st) + return r->lastChild(); + if (subcount++ == cStyleSearchThreshold) + return 0; + r = r->previousSibling(); } return 0; } +bool CSSStyleSelector::matchesSiblingRules() +{ + int firstSiblingRule = -1, lastSiblingRule = -1; + matchRules(m_siblingRules.get(), firstSiblingRule, lastSiblingRule, false); + if (m_matchedDecls.isEmpty()) + return false; + m_matchedDecls.clear(); + return true; +} + bool CSSStyleSelector::canShareStyleWithElement(Node* n) const { if (n->isStyledElement()) { StyledElement* s = static_cast<StyledElement*>(n); RenderStyle* style = s->renderStyle(); if (style && !style->unique() && - (s->tagQName() == m_element->tagQName()) && !s->hasID() && + (s->tagQName() == m_element->tagQName()) && (s->hasClass() == m_element->hasClass()) && !s->inlineStyleDecl() && (s->hasMappedAttributes() == m_styledElement->hasMappedAttributes()) && (s->isLink() == m_element->isLink()) && @@ -992,6 +1041,10 @@ bool CSSStyleSelector::canShareStyleWithElement(Node* n) const (s->fastGetAttribute(langAttr) == m_element->fastGetAttribute(langAttr)) && (s->fastGetAttribute(readonlyAttr) == m_element->fastGetAttribute(readonlyAttr)) && (s->fastGetAttribute(cellpaddingAttr) == m_element->fastGetAttribute(cellpaddingAttr))) { + + if (s->hasID() && m_idsInRules.contains(s->idForStyleResolution().impl())) + return 0; + bool isControl = s->isFormControlElement(); if (isControl != m_element->isFormControlElement()) return false; @@ -1062,32 +1115,46 @@ bool CSSStyleSelector::canShareStyleWithElement(Node* n) const } return false; } - -ALWAYS_INLINE RenderStyle* CSSStyleSelector::locateSharedStyle() const + +inline Node* CSSStyleSelector::findSiblingForStyleSharing(Node* node, unsigned& count) const { - if (m_styledElement && !m_styledElement->inlineStyleDecl() && !m_styledElement->hasID() && !m_styledElement->document()->usesSiblingRules()) { - // Check previous siblings. - unsigned count = 0; - Node* n; - for (n = m_element->previousSibling(); n && !n->isElementNode(); n = n->previousSibling()) { } - while (n) { - if (canShareStyleWithElement(n)) - return n->renderStyle(); - if (count++ == cStyleSearchThreshold) - return 0; - for (n = n->previousSibling(); n && !n->isElementNode(); n = n->previousSibling()) { } - } - if (!n) - n = locateCousinList(m_element->parentElement()); - while (n) { - if (canShareStyleWithElement(n)) - return n->renderStyle(); - if (count++ == cStyleSearchThreshold) - return 0; - for (n = n->previousSibling(); n && !n->isElementNode(); n = n->previousSibling()) { } - } + for (; node; node = node->previousSibling()) { + if (!node->isElementNode()) + continue; + if (canShareStyleWithElement(node)) + break; + if (count++ == cStyleSearchThreshold) + return 0; } - return 0; + return node; +} + +ALWAYS_INLINE RenderStyle* CSSStyleSelector::locateSharedStyle() +{ + if (!m_styledElement || !m_parentStyle) + return 0; + // If the element has inline style it is probably unique. + if (m_styledElement->inlineStyleDecl()) + return 0; + // Ids stop style sharing if they show up in the stylesheets. + if (m_styledElement->hasID() && m_idsInRules.contains(m_styledElement->idForStyleResolution().impl())) + return 0; + // Check previous siblings. + unsigned count = 0; + Node* shareNode = findSiblingForStyleSharing(m_styledElement->previousSibling(), count); + if (!shareNode) { + Node* cousinList = locateCousinList(m_styledElement->parentElement()); + shareNode = findSiblingForStyleSharing(cousinList, count); + if (!shareNode) + return 0; + } + // Can't share if sibling rules apply. This is checked at the end as it should rarely fail. + if (matchesSiblingRules()) + return 0; + // Tracking child index requires unique style for each node. This may get set by the sibling rule match above. + if (m_parentStyle->childrenAffectedByPositionalRules()) + return 0; + return shareNode->renderStyle(); } void CSSStyleSelector::matchUARules(int& firstUARule, int& lastUARule) @@ -1180,12 +1247,12 @@ PassRefPtr<RenderStyle> CSSStyleSelector::styleForElement(Element* e, RenderStyl } initElement(e); + initForStyleResolve(e, defaultParent); if (allowSharing) { RenderStyle* sharedStyle = locateSharedStyle(); if (sharedStyle) return sharedStyle; } - initForStyleResolve(e, defaultParent); // Compute our style allowing :visited to match first. RefPtr<RenderStyle> visitedStyle; @@ -1227,6 +1294,7 @@ PassRefPtr<RenderStyle> CSSStyleSelector::styleForElement(Element* e, RenderStyl #if ENABLE(FULLSCREEN_API) loadFullScreenRulesIfNeeded(e->document()); #endif + assertNoSiblingRulesInDefaultStyle(); } #if ENABLE(SVG) @@ -1237,6 +1305,7 @@ PassRefPtr<RenderStyle> CSSStyleSelector::styleForElement(Element* e, RenderStyl CSSStyleSheet* svgSheet = parseUASheet(svgUserAgentStyleSheet, sizeof(svgUserAgentStyleSheet)); defaultStyle->addRulesFromSheet(svgSheet, screenEval()); defaultPrintStyle->addRulesFromSheet(svgSheet, printEval()); + assertNoSiblingRulesInDefaultStyle(); } #endif @@ -1248,6 +1317,8 @@ PassRefPtr<RenderStyle> CSSStyleSelector::styleForElement(Element* e, RenderStyl CSSStyleSheet* mathMLSheet = parseUASheet(mathmlUserAgentStyleSheet, sizeof(mathmlUserAgentStyleSheet)); defaultStyle->addRulesFromSheet(mathMLSheet, screenEval()); defaultPrintStyle->addRulesFromSheet(mathMLSheet, printEval()); + // There are some sibling rules here. + collectSiblingRulesInDefaultStyle(); } #endif @@ -1259,6 +1330,7 @@ PassRefPtr<RenderStyle> CSSStyleSelector::styleForElement(Element* e, RenderStyl CSSStyleSheet* wmlSheet = parseUASheet(wmlUserAgentStyleSheet, sizeof(wmlUserAgentStyleSheet)); defaultStyle->addRulesFromSheet(wmlSheet, screenEval()); defaultPrintStyle->addRulesFromSheet(wmlSheet, printEval()); + assertNoSiblingRulesInDefaultStyle(); } #endif @@ -1270,6 +1342,7 @@ PassRefPtr<RenderStyle> CSSStyleSelector::styleForElement(Element* e, RenderStyl CSSStyleSheet* mediaControlsSheet = parseUASheet(mediaRules); defaultStyle->addRulesFromSheet(mediaControlsSheet, screenEval()); defaultPrintStyle->addRulesFromSheet(mediaControlsSheet, printEval()); + assertNoSiblingRulesInDefaultStyle(); } #endif @@ -2794,7 +2867,7 @@ bool CSSStyleSelector::SelectorChecker::checkScrollbarPseudoClass(CSSSelector* s return false; } case CSSSelector::PseudoCornerPresent: - return scrollbar->client()->scrollbarCornerPresent(); + return scrollbar->scrollableArea()->scrollbarCornerPresent(); default: return false; } @@ -2927,6 +3000,47 @@ void CSSRuleSet::addStyleRule(CSSStyleRule* rule) } } +static void collectIdsAndSiblingRulesFromList(HashSet<AtomicStringImpl*>& ids, OwnPtr<CSSRuleSet>& siblingRules, const CSSRuleDataList* rules) +{ + for (CSSRuleData* data = rules->first(); data; data = data->next()) { + bool foundSiblingSelector = false; + for (CSSSelector* selector = data->selector(); selector; selector = selector->tagHistory()) { + if (selector->m_match == CSSSelector::Id && !selector->m_value.isEmpty()) + ids.add(selector->m_value.impl()); + if (CSSSelector* simpleSelector = selector->simpleSelector()) { + ASSERT(!simpleSelector->simpleSelector()); + if (simpleSelector->m_match == CSSSelector::Id && !simpleSelector->m_value.isEmpty()) + ids.add(simpleSelector->m_value.impl()); + } + if (selector->isSiblingSelector()) + foundSiblingSelector = true; + } + if (foundSiblingSelector) { + if (!siblingRules) + siblingRules = adoptPtr(new CSSRuleSet); + siblingRules->addRule(data->rule(), data->selector()); + } + } +} + +void CSSRuleSet::collectIdsAndSiblingRules(HashSet<AtomicStringImpl*>& ids, OwnPtr<CSSRuleSet>& siblingRules) const +{ + AtomRuleMap::const_iterator end = m_idRules.end(); + for (AtomRuleMap::const_iterator it = m_idRules.begin(); it != end; ++it) + collectIdsAndSiblingRulesFromList(ids, siblingRules, it->second); + end = m_classRules.end(); + for (AtomRuleMap::const_iterator it = m_classRules.begin(); it != end; ++it) + collectIdsAndSiblingRulesFromList(ids, siblingRules, it->second); + end = m_tagRules.end(); + for (AtomRuleMap::const_iterator it = m_tagRules.begin(); it != end; ++it) + collectIdsAndSiblingRulesFromList(ids, siblingRules, it->second); + end = m_pseudoRules.end(); + for (AtomRuleMap::const_iterator it = m_pseudoRules.begin(); it != end; ++it) + collectIdsAndSiblingRulesFromList(ids, siblingRules, it->second); + if (m_universalRules) + collectIdsAndSiblingRulesFromList(ids, siblingRules, m_universalRules.get()); +} + // ------------------------------------------------------------------------------------- // this is mostly boring stuff on how to apply a certain rule to the renderstyle... diff --git a/Source/WebCore/css/CSSStyleSelector.h b/Source/WebCore/css/CSSStyleSelector.h index b57ba13..e035af2 100644 --- a/Source/WebCore/css/CSSStyleSelector.h +++ b/Source/WebCore/css/CSSStyleSelector.h @@ -69,7 +69,8 @@ class StyledElement; class WebKitCSSKeyframeRule; class WebKitCSSKeyframesRule; -class MediaQueryResult : public Noncopyable { +class MediaQueryResult { + WTF_MAKE_NONCOPYABLE(MediaQueryResult); WTF_MAKE_FAST_ALLOCATED; public: MediaQueryResult(const MediaQueryExp& expr, bool result) : m_expression(expr) @@ -82,7 +83,8 @@ public: }; // This class selects a RenderStyle for a given element based on a collection of stylesheets. - class CSSStyleSelector : public Noncopyable { + class CSSStyleSelector { + WTF_MAKE_NONCOPYABLE(CSSStyleSelector); WTF_MAKE_FAST_ALLOCATED; public: CSSStyleSelector(Document*, StyleSheetList* authorSheets, CSSStyleSheet* mappedElementSheet, CSSStyleSheet* pageUserSheet, const Vector<RefPtr<CSSStyleSheet> >* pageGroupUserSheets, @@ -108,8 +110,10 @@ public: private: void initForStyleResolve(Element*, RenderStyle* parentStyle = 0, PseudoId = NOPSEUDO); void initElement(Element*); - ALWAYS_INLINE RenderStyle* locateSharedStyle() const; + RenderStyle* locateSharedStyle(); + bool matchesSiblingRules(); Node* locateCousinList(Element* parent, unsigned depth = 1) const; + Node* findSiblingForStyleSharing(Node*, unsigned& count) const; bool canShareStyleWithElement(Node*) const; RenderStyle* style() const { return m_style.get(); } @@ -197,6 +201,9 @@ public: OwnPtr<CSSRuleSet> m_authorStyle; OwnPtr<CSSRuleSet> m_userStyle; + + OwnPtr<CSSRuleSet> m_siblingRules; + HashSet<AtomicStringImpl*> m_idsInRules; bool m_hasUAAppearance; BorderData m_borderData; @@ -209,7 +216,8 @@ public: public: static RenderStyle* styleNotYetAvailable() { return s_styleNotYetAvailable; } - class SelectorChecker : public Noncopyable { + class SelectorChecker { + WTF_MAKE_NONCOPYABLE(SelectorChecker); public: SelectorChecker(Document*, bool strictParsing); diff --git a/Source/WebCore/css/MediaQuery.h b/Source/WebCore/css/MediaQuery.h index 281009b..a638ac9 100644 --- a/Source/WebCore/css/MediaQuery.h +++ b/Source/WebCore/css/MediaQuery.h @@ -37,7 +37,8 @@ namespace WebCore { class MediaQueryExp; -class MediaQuery : public Noncopyable { +class MediaQuery { + WTF_MAKE_NONCOPYABLE(MediaQuery); WTF_MAKE_FAST_ALLOCATED; public: enum Restrictor { Only, Not, None diff --git a/Source/WebCore/css/MediaQueryEvaluator.h b/Source/WebCore/css/MediaQueryEvaluator.h index 00ac394..07c4d0d 100644 --- a/Source/WebCore/css/MediaQueryEvaluator.h +++ b/Source/WebCore/css/MediaQueryEvaluator.h @@ -49,7 +49,8 @@ class MediaQueryExp; * the device characteristics are not known. This can be used to prune the loading * of stylesheets to only those which are probable to match. */ -class MediaQueryEvaluator : public Noncopyable { +class MediaQueryEvaluator { + WTF_MAKE_NONCOPYABLE(MediaQueryEvaluator); WTF_MAKE_FAST_ALLOCATED; public: /** Creates evaluator which evaluates only simple media queries * Evaluator returns true for "all", and returns value of \mediaFeatureResult diff --git a/Source/WebCore/css/MediaQueryExp.h b/Source/WebCore/css/MediaQueryExp.h index 72d3fff..7e4d477 100644 --- a/Source/WebCore/css/MediaQueryExp.h +++ b/Source/WebCore/css/MediaQueryExp.h @@ -38,7 +38,8 @@ namespace WebCore { class CSSParserValueList; -class MediaQueryExp : public FastAllocBase { +class MediaQueryExp { + WTF_MAKE_FAST_ALLOCATED; public: static PassOwnPtr<MediaQueryExp> create(const AtomicString& mediaFeature, CSSParserValueList* values); ~MediaQueryExp(); diff --git a/Source/WebCore/css/WebKitCSSMatrix.cpp b/Source/WebCore/css/WebKitCSSMatrix.cpp index 7d60f8c..14f6b4e 100644 --- a/Source/WebCore/css/WebKitCSSMatrix.cpp +++ b/Source/WebCore/css/WebKitCSSMatrix.cpp @@ -32,7 +32,6 @@ #include "CSSPropertyNames.h" #include "CSSValueKeywords.h" #include "ExceptionCode.h" -#include "RenderStyle.h" #include <wtf/MathExtras.h> namespace WebCore { diff --git a/Source/WebCore/css/mediaControlsQt.css b/Source/WebCore/css/mediaControlsQt.css index 4ea444c..871a5b8 100644 --- a/Source/WebCore/css/mediaControlsQt.css +++ b/Source/WebCore/css/mediaControlsQt.css @@ -32,7 +32,21 @@ audio { width: 400px; } -audio::-webkit-media-controls-panel, video::-webkit-media-controls-panel { +audio::-webkit-media-controls-panel { + display: -webkit-box; + -webkit-box-orient: horizontal; + -webkit-box-align: end; + -webkit-user-select: none; + position: absolute; + bottom: 0; + width: 100%; + z-index: 0; + overflow: visible; + height: 100%; + text-align: right; +} + +video::-webkit-media-controls-panel { display: -webkit-box; -webkit-box-orient: horizontal; -webkit-box-align: end; @@ -50,25 +64,61 @@ video:-webkit-full-page-media::-webkit-media-controls-panel { bottom: 0px; } -audio::-webkit-media-controls-mute-button, video::-webkit-media-controls-mute-button { +audio::-webkit-media-controls-mute-button { width: 12px; height: 12px; padding: 6px; margin: 5px 5px 5px 3px; } -audio::-webkit-media-controls-play-button, video::-webkit-media-controls-play-button { +video::-webkit-media-controls-mute-button { + width: 12px; + height: 12px; + padding: 6px; + margin: 5px 5px 5px 3px; +} + +audio::-webkit-media-controls-play-button { width: 9px; height: 12px; padding: 6px 12px 6px 11px; margin: 5px 3px 5px 5px; } -audio::-webkit-media-controls-timeline-container, video::-webkit-media-controls-timeline-container { +video::-webkit-media-controls-play-button { + width: 9px; + height: 12px; + padding: 6px 12px 6px 11px; + margin: 5px 3px 5px 5px; +} + +audio::-webkit-media-controls-timeline-container { + height: 34px; +} + +video::-webkit-media-controls-timeline-container { height: 34px; } -audio::-webkit-media-controls-current-time-display, video::-webkit-media-controls-current-time-display { +audio::-webkit-media-controls-current-time-display { + -webkit-appearance: media-current-time-display; + -webkit-user-select: none; + display: inline-block; + height: 12px; + padding: 6px; + margin: 5px 3px; + + overflow: hidden; + cursor: default; + + text-align: center; + font-size: 10px; + font-family: Verdana; + font-weight: bold; + color: white; +} + +video::-webkit-media-controls-current-time-display { -webkit-appearance: media-current-time-display; -webkit-user-select: none; display: inline-block; @@ -86,24 +136,41 @@ audio::-webkit-media-controls-current-time-display, video::-webkit-media-control color: white; } -audio::-webkit-media-controls-time-remaining-display, video::-webkit-media-controls-time-remaining-display { +audio::-webkit-media-controls-time-remaining-display { + display: none; +} + +video::-webkit-media-controls-time-remaining-display { display: none; } -audio::-webkit-media-controls-timeline, video::-webkit-media-controls-timeline { +audio::-webkit-media-controls-timeline { height: 12px; padding: 6px 8px; margin: 5px 3px; } -audio::-webkit-media-controls-volume-slider-container, video::-webkit-media-controls-volume-slider-container { +video::-webkit-media-controls-timeline { + height: 12px; + padding: 6px 8px; + margin: 5px 3px; +} + +audio::-webkit-media-controls-volume-slider-container { + -webkit-appearance: media-volume-slider-container; + position: absolute; + height: 103px; + width: 24px; +} + +video::-webkit-media-controls-volume-slider-container { -webkit-appearance: media-volume-slider-container; position: absolute; height: 103px; width: 24px; } -audio::-webkit-media-controls-volume-slider, video::-webkit-media-controls-volume-slider { +audio::-webkit-media-controls-volume-slider { -webkit-appearance: media-volume-slider; display: inline; position: absolute; @@ -114,27 +181,62 @@ audio::-webkit-media-controls-volume-slider, video::-webkit-media-controls-volum margin: 0 0 3px 0; } -audio::-webkit-media-controls-seek-back-button, video::-webkit-media-controls-seek-back-button { +video::-webkit-media-controls-volume-slider { + -webkit-appearance: media-volume-slider; + display: inline; + position: absolute; + + width: 12px; + padding: 6px; + height: 88px; + margin: 0 0 3px 0; +} + +audio::-webkit-media-controls-seek-back-button { + display: none; +} + +video::-webkit-media-controls-seek-back-button { + display: none; +} + +audio::-webkit-media-controls-seek-forward-button { + display: none; +} + +video::-webkit-media-controls-seek-forward-button { + display: none; +} + +audio::-webkit-media-controls-fullscreen-button { + display: none; +} + +video::-webkit-media-controls-fullscreen-button { + display: none; +} + +audio::-webkit-media-controls-rewind-button { display: none; } -audio::-webkit-media-controls-seek-forward-button, video::-webkit-media-controls-seek-forward-button { +video::-webkit-media-controls-rewind-button { display: none; } -audio::-webkit-media-controls-fullscreen-button, video::-webkit-media-controls-fullscreen-button { +audio::-webkit-media-controls-return-to-realtime-button { display: none; } -audio::-webkit-media-controls-rewind-button, video::-webkit-media-controls-rewind-button { +video::-webkit-media-controls-return-to-realtime-button { display: none; } -audio::-webkit-media-controls-return-to-realtime-button, video::-webkit-media-controls-return-to-realtime-button { +audio::-webkit-media-controls-toggle-closed-captions-button { display: none; } -audio::-webkit-media-controls-toggle-closed-captions-button, video::-webkit-media-controls-toggle-closed-captions-button { +video::-webkit-media-controls-toggle-closed-captions-button { display: none; } diff --git a/Source/WebCore/css/mediaControlsQtFullscreen.css b/Source/WebCore/css/mediaControlsQtFullscreen.css index d191331..35cbf75 100644 --- a/Source/WebCore/css/mediaControlsQtFullscreen.css +++ b/Source/WebCore/css/mediaControlsQtFullscreen.css @@ -21,26 +21,6 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - -audio { - height: 34px; - width: 400px; -} - -audio::-webkit-media-controls-panel { - display: -webkit-box; - -webkit-box-orient: horizontal; - -webkit-box-align: end; - -webkit-user-select: none; - position: absolute; - bottom: 0; - width: 100%; - z-index: 0; - overflow: visible; - height: 100%; - text-align: right; -} - video::-webkit-media-controls-panel { /* The control panel is only play button for full screen */ display: -webkit-box; @@ -54,24 +34,10 @@ video:-webkit-full-page-media::-webkit-media-controls-panel { display: none; } -audio::-webkit-media-controls-mute-button { - width: 12px; - height: 12px; - padding: 6px; - margin: 5px 5px 5px 3px; -} - video::-webkit-media-controls-mute-button { display: none; } -audio::-webkit-media-controls-play-button { - width: 9px; - height: 12px; - padding: 6px 12px 6px 11px; - margin: 5px 3px 5px 5px; -} - video::-webkit-media-controls-play-button { display: -webkit-box; -webkit-box-align: center; @@ -81,110 +47,55 @@ video::-webkit-media-controls-play-button { padding: 20px; } -audio::-webkit-media-controls-timeline-container { - height: 34px; -} - video::-webkit-media-controls-timeline-container { display: none; } -audio::-webkit-media-controls-current-time-display { - -webkit-appearance: media-current-time-display; - -webkit-user-select: none; - display: inline-block; - height: 12px; - padding: 6px; - margin: 5px 3px; - - overflow: hidden; - cursor: default; - - text-align: center; - font-size: 10px; - font-family: Verdana; - font-weight: bold; - color: white; -} - video::-webkit-media-controls-current-time-display { -webkit-appearance: media-current-time-display; -webkit-user-select: none; display: none; } -audio::-webkit-media-controls-time-remaining-display, video::-webkit-media-controls-time-remaining-display { +video::-webkit-media-controls-time-remaining-display { display: none; } -audio::-webkit-media-controls-timeline { - height: 12px; - padding: 6px 8px; - margin: 5px 3px; -} - video::-webkit-media-controls-timeline { display: none; } -audio::-webkit-media-controls-volume-slider-container { - -webkit-appearance: media-volume-slider-container; - position: absolute; - height: 103px; - width: 24px; -} - video::-webkit-media-controls-volume-slider-container { -webkit-appearance: media-volume-slider-container; display: none; } -audio::-webkit-media-controls-volume-slider { - -webkit-appearance: media-volume-slider; - display: inline; - position: absolute; - - width: 12px; - padding: 6px; - height: 88px; - margin: 0 0 3px 0; -} - video::-webkit-media-controls-volume-slider { -webkit-appearance: media-volume-slider; display: none; } -audio::-webkit-media-controls-seek-back-button, video::-webkit-media-controls-seek-back-button { +video::-webkit-media-controls-seek-back-button { display: none; } -audio::-webkit-media-controls-seek-forward-button, video::-webkit-media-controls-seek-forward-button { +video::-webkit-media-controls-seek-forward-button { display: none; } -audio::-webkit-media-controls-fullscreen-button { - position: absolute; - top: 0px; - right: 0px; - width: 12px; - height: 12px; - padding: 6px; - margin: 5px 5px 5px 3px; -} - video::-webkit-media-controls-fullscreen-button { display: none; } -audio::-webkit-media-controls-rewind-button, video::-webkit-media-controls-rewind-button { +video::-webkit-media-controls-rewind-button { display: none; } -audio::-webkit-media-controls-return-to-realtime-button, video::-webkit-media-controls-return-to-realtime-button { +video::-webkit-media-controls-return-to-realtime-button { display: none; } -audio::-webkit-media-controls-toggle-closed-captions-button, video::-webkit-media-controls-toggle-closed-captions-button { +video::-webkit-media-controls-toggle-closed-captions-button { display: none; } + diff --git a/Source/WebCore/dom/AsyncScriptRunner.h b/Source/WebCore/dom/AsyncScriptRunner.h index 2326f67..6a75323 100644 --- a/Source/WebCore/dom/AsyncScriptRunner.h +++ b/Source/WebCore/dom/AsyncScriptRunner.h @@ -39,7 +39,8 @@ class Document; class PendingScript; class ScriptElement; -class AsyncScriptRunner : public Noncopyable { +class AsyncScriptRunner { + WTF_MAKE_NONCOPYABLE(AsyncScriptRunner); WTF_MAKE_FAST_ALLOCATED; public: static PassOwnPtr<AsyncScriptRunner> create(Document* document) { return new AsyncScriptRunner(document); } ~AsyncScriptRunner(); diff --git a/Source/WebCore/dom/DOMStringMap.h b/Source/WebCore/dom/DOMStringMap.h index 86a22b0..772a700 100644 --- a/Source/WebCore/dom/DOMStringMap.h +++ b/Source/WebCore/dom/DOMStringMap.h @@ -35,7 +35,8 @@ namespace WebCore { class Element; typedef int ExceptionCode; -class DOMStringMap : public Noncopyable { +class DOMStringMap { + WTF_MAKE_NONCOPYABLE(DOMStringMap); WTF_MAKE_FAST_ALLOCATED; public: virtual ~DOMStringMap(); diff --git a/Source/WebCore/dom/Document.cpp b/Source/WebCore/dom/Document.cpp index 1787b52..0bdd603 100644 --- a/Source/WebCore/dom/Document.cpp +++ b/Source/WebCore/dom/Document.cpp @@ -119,6 +119,7 @@ #include "RenderTextControl.h" #include "RenderView.h" #include "RenderWidget.h" +#include "ScriptCallStack.h" #include "ScriptController.h" #include "ScriptElement.h" #include "ScriptEventListener.h" @@ -220,6 +221,10 @@ #include "RenderFullScreen.h" #endif +#if ENABLE(REQUEST_ANIMATION_FRAME) +#include "RequestAnimationFrameCallback.h" +#endif + using namespace std; using namespace WTF; using namespace Unicode; @@ -441,6 +446,9 @@ Document::Document(Frame* frame, const KURL& url, bool isXHTML, bool isHTML, con , m_loadEventDelayTimer(this, &Document::loadEventDelayTimerFired) , m_directionSetOnDocumentElement(false) , m_writingModeSetOnDocumentElement(false) +#if ENABLE(REQUEST_ANIMATION_FRAME) + , m_nextRequestAnimationFrameCallbackId(0) +#endif { m_document = this; @@ -1330,7 +1338,7 @@ PassRefPtr<Range> Document::caretRangeFromPoint(int x, int y) if (visiblePosition.isNull()) return 0; - Position rangeCompliantPosition = rangeCompliantEquivalent(visiblePosition); + Position rangeCompliantPosition = visiblePosition.deepEquivalent().parentAnchoredEquivalent(); return Range::create(this, rangeCompliantPosition, rangeCompliantPosition); } @@ -2347,6 +2355,17 @@ KURL Document::virtualCompleteURL(const String& url) const return completeURL(url); } +EventTarget* Document::errorEventTarget() +{ + return domWindow(); +} + +void Document::logExceptionToConsole(const String& errorMessage, int lineNumber, const String& sourceURL, PassRefPtr<ScriptCallStack> callStack) +{ + MessageType messageType = callStack ? UncaughtExceptionMessageType : LogMessageType; + addMessage(JSMessageSource, messageType, ErrorMessageLevel, errorMessage, lineNumber, sourceURL, callStack); +} + void Document::setURL(const KURL& url) { const KURL& newURL = url.isEmpty() ? blankURL() : url; @@ -4735,18 +4754,15 @@ void Document::parseDNSPrefetchControlHeader(const String& dnsPrefetchControl) m_haveExplicitlyDisabledDNSPrefetch = true; } -void Document::reportException(const String& errorMessage, int lineNumber, const String& sourceURL) -{ - addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, errorMessage, lineNumber, sourceURL); -} - -void Document::addMessage(MessageSource source, MessageType type, MessageLevel level, const String& message, unsigned lineNumber, const String& sourceURL) +void Document::addMessage(MessageSource source, MessageType type, MessageLevel level, const String& message, unsigned lineNumber, const String& sourceURL, PassRefPtr<ScriptCallStack> callStack) { if (DOMWindow* window = domWindow()) - window->console()->addMessage(source, type, level, message, lineNumber, sourceURL); + window->console()->addMessage(source, type, level, message, lineNumber, sourceURL, callStack); } -struct PerformTaskContext : Noncopyable { +struct PerformTaskContext { + WTF_MAKE_NONCOPYABLE(PerformTaskContext); WTF_MAKE_FAST_ALLOCATED; +public: PerformTaskContext(PassRefPtr<DocumentWeakReference> documentReference, PassOwnPtr<ScriptExecutionContext::Task> task) : documentReference(documentReference) , task(task) @@ -5004,6 +5020,86 @@ void Document::loadEventDelayTimerFired(Timer<Document>*) frame()->loader()->checkCompleted(); } +#if ENABLE(REQUEST_ANIMATION_FRAME) +int Document::webkitRequestAnimationFrame(PassRefPtr<RequestAnimationFrameCallback> callback, Element* e) +{ + if (!m_requestAnimationFrameCallbacks) + m_requestAnimationFrameCallbacks = new RequestAnimationFrameCallbackList; + int id = m_nextRequestAnimationFrameCallbackId++; + callback->m_firedOrCancelled = false; + callback->m_id = id; + callback->m_element = e; + m_requestAnimationFrameCallbacks->append(callback); + if (FrameView* v = view()) + v->scheduleAnimation(); + return id; +} + +void Document::webkitCancelRequestAnimationFrame(int id) +{ + if (!m_requestAnimationFrameCallbacks) + return; + for (size_t i = 0; i < m_requestAnimationFrameCallbacks->size(); ++i) { + if (m_requestAnimationFrameCallbacks->at(i)->m_id == id) { + m_requestAnimationFrameCallbacks->at(i)->m_firedOrCancelled = true; + m_requestAnimationFrameCallbacks->remove(i); + return; + } + } +} + +void Document::serviceScriptedAnimations() +{ + if (!m_requestAnimationFrameCallbacks) + return; + // We want to run the callback for all elements in the document that have registered + // for a callback and that are visible. Running the callbacks can cause new callbacks + // to be registered, existing callbacks to be cancelled, and elements to gain or lose + // visibility so this code has to iterate carefully. + + // FIXME: Currently, this code doesn't do any visibility tests beyond checking display: + + // First, generate a list of callbacks to consider. Callbacks registered from this point + // on are considered only for the "next" frame, not this one. + RequestAnimationFrameCallbackList callbacks(*m_requestAnimationFrameCallbacks); + + // Firing the callback may cause the visibility of other elements to change. To avoid + // missing any callbacks, we keep iterating through the list of candiate callbacks and firing + // them until nothing new becomes visible. + bool firedCallback; + do { + firedCallback = false; + // A previous iteration may have invalidated style (or layout). Update styles for each iteration + // for now since all we check is the existence of a renderer. + updateStyleIfNeeded(); + for (size_t i = 0; i < callbacks.size(); ++i) { + RequestAnimationFrameCallback* callback = callbacks[i].get(); + if (!callback->m_firedOrCancelled && (!callback->m_element || callback->m_element->renderer())) { + callback->m_firedOrCancelled = true; + callback->handleEvent(); + firedCallback = true; + callbacks.remove(i); + break; + } + } + } while (firedCallback); + + // Remove any callbacks we fired from the list of pending callbacks. + for (size_t i = 0; i < m_requestAnimationFrameCallbacks->size();) { + if (m_requestAnimationFrameCallbacks->at(i)->m_firedOrCancelled) + m_requestAnimationFrameCallbacks->remove(i); + else + ++i; + } + + // In most cases we expect this list to be empty, so no need to keep around the vector's inline buffer. + if (!m_requestAnimationFrameCallbacks->size()) + m_requestAnimationFrameCallbacks.clear(); + else if (FrameView* v = view()) + v->scheduleAnimation(); +} +#endif + #if ENABLE(TOUCH_EVENTS) PassRefPtr<Touch> Document::createTouch(DOMWindow* window, EventTarget* target, int identifier, int pageX, int pageY, int screenX, int screenY, ExceptionCode&) const { diff --git a/Source/WebCore/dom/Document.h b/Source/WebCore/dom/Document.h index e70063a..c9c8d38 100644 --- a/Source/WebCore/dom/Document.h +++ b/Source/WebCore/dom/Document.h @@ -146,6 +146,10 @@ class Touch; class TouchList; #endif +#if ENABLE(REQUEST_ANIMATION_FRAME) +class RequestAnimationFrameCallback; +#endif + typedef int ExceptionCode; class FormElementKey { @@ -249,6 +253,8 @@ public: DEFINE_ATTRIBUTE_EVENT_LISTENER(dragstart); DEFINE_ATTRIBUTE_EVENT_LISTENER(drag); DEFINE_ATTRIBUTE_EVENT_LISTENER(dragend); + DEFINE_ATTRIBUTE_EVENT_LISTENER(formchange); + DEFINE_ATTRIBUTE_EVENT_LISTENER(forminput); DEFINE_ATTRIBUTE_EVENT_LISTENER(input); DEFINE_ATTRIBUTE_EVENT_LISTENER(invalid); DEFINE_ATTRIBUTE_EVENT_LISTENER(keydown); @@ -942,8 +948,7 @@ public: bool isDNSPrefetchEnabled() const { return m_isDNSPrefetchEnabled; } void parseDNSPrefetchControlHeader(const String&); - virtual void reportException(const String& errorMessage, int lineNumber, const String& sourceURL); - virtual void addMessage(MessageSource, MessageType, MessageLevel, const String& message, unsigned lineNumber, const String& sourceURL); + virtual void addMessage(MessageSource, MessageType, MessageLevel, const String& message, unsigned lineNumber, const String& sourceURL, PassRefPtr<ScriptCallStack>); virtual void postTask(PassOwnPtr<Task>); // Executes the task on context's thread asynchronously. #if USE(JSC) @@ -1083,8 +1088,17 @@ public: const DocumentTiming* timing() const { return &m_documentTiming; } +#if ENABLE(REQUEST_ANIMATION_FRAME) + int webkitRequestAnimationFrame(PassRefPtr<RequestAnimationFrameCallback>, Element*); + void webkitCancelRequestAnimationFrame(int id); + void serviceScriptedAnimations(); +#endif + bool mayCauseFlashOfUnstyledContent() const; + virtual EventTarget* errorEventTarget(); + virtual void logExceptionToConsole(const String& errorMessage, int lineNumber, const String& sourceURL, PassRefPtr<ScriptCallStack>); + void initDNSPrefetch(); protected: @@ -1408,6 +1422,12 @@ private: DocumentTiming m_documentTiming; RefPtr<MediaQueryMatcher> m_mediaQueryMatcher; + +#if ENABLE(REQUEST_ANIMATION_FRAME) + typedef Vector<RefPtr<RequestAnimationFrameCallback> > RequestAnimationFrameCallbackList; + OwnPtr<RequestAnimationFrameCallbackList> m_requestAnimationFrameCallbacks; + int m_nextRequestAnimationFrameCallbackId; +#endif }; inline bool Document::DocumentOrderedMap::contains(AtomicStringImpl* id) const diff --git a/Source/WebCore/dom/Document.idl b/Source/WebCore/dom/Document.idl index 8d7a71b..c215df0 100644 --- a/Source/WebCore/dom/Document.idl +++ b/Source/WebCore/dom/Document.idl @@ -266,6 +266,8 @@ module core { attribute [DontEnum] EventListener ondrop; attribute [DontEnum] EventListener onerror; attribute [DontEnum] EventListener onfocus; + attribute [DontEnum] EventListener onformchange; + attribute [DontEnum] EventListener onforminput; attribute [DontEnum] EventListener oninput; attribute [DontEnum] EventListener oninvalid; attribute [DontEnum] EventListener onkeydown; @@ -288,8 +290,6 @@ module core { // attribute [DontEnum] EventListener ondurationchange; // attribute [DontEnum] EventListener onemptied; // attribute [DontEnum] EventListener onended; - // attribute [DontEnum] EventListener onformchange; - // attribute [DontEnum] EventListener onforminput; // attribute [DontEnum] EventListener onloadeddata; // attribute [DontEnum] EventListener onloadedmetadata; // attribute [DontEnum] EventListener onloadstart; diff --git a/Source/WebCore/dom/DocumentMarkerController.h b/Source/WebCore/dom/DocumentMarkerController.h index 83177fc..2dc2b9e 100644 --- a/Source/WebCore/dom/DocumentMarkerController.h +++ b/Source/WebCore/dom/DocumentMarkerController.h @@ -38,8 +38,10 @@ class IntRect; class Node; class Range; -class DocumentMarkerController : public Noncopyable { +class DocumentMarkerController { + WTF_MAKE_NONCOPYABLE(DocumentMarkerController); WTF_MAKE_FAST_ALLOCATED; public: + DocumentMarkerController() { } ~DocumentMarkerController() { detach(); } void detach(); diff --git a/Source/WebCore/dom/Element.cpp b/Source/WebCore/dom/Element.cpp index 5d91db7..276a409 100644 --- a/Source/WebCore/dom/Element.cpp +++ b/Source/WebCore/dom/Element.cpp @@ -75,6 +75,7 @@ PassRefPtr<Element> Element::create(const QualifiedName& tagName, Document* docu Element::~Element() { + removeShadowRoot(); if (m_attributeMap) m_attributeMap->detachFromElement(); } @@ -1100,7 +1101,7 @@ void Element::recalcStyle(StyleChange change) Node* Element::shadowRoot() { - return hasRareData() ? rareData()->m_shadowRoot.get() : 0; + return hasRareData() ? rareData()->m_shadowRoot : 0; } void Element::setShadowRoot(PassRefPtr<Node> node) @@ -1109,11 +1110,12 @@ void Element::setShadowRoot(PassRefPtr<Node> node) // about compromising DOM tree integrity (eg. node being a parent of this). However, // once we implement XBL2, we will have to add integrity checks here. removeShadowRoot(); + RefPtr<Node> newRoot = node; if (!newRoot) return; - ensureRareData()->m_shadowRoot = newRoot; + ensureRareData()->m_shadowRoot = newRoot.get(); newRoot->setShadowHost(this); } @@ -1122,7 +1124,9 @@ void Element::removeShadowRoot() if (!hasRareData()) return; - if (RefPtr<Node> oldRoot = rareData()->m_shadowRoot.release()) { + ElementRareData* data = rareData(); + if (RefPtr<Node> oldRoot = data->m_shadowRoot) { + data->m_shadowRoot = 0; document()->removeFocusedNodeOfSubtree(oldRoot.get()); oldRoot->setShadowHost(0); if (oldRoot->inDocument()) diff --git a/Source/WebCore/dom/Element.h b/Source/WebCore/dom/Element.h index 5e6c047..4510478 100644 --- a/Source/WebCore/dom/Element.h +++ b/Source/WebCore/dom/Element.h @@ -63,6 +63,8 @@ public: DEFINE_ATTRIBUTE_EVENT_LISTENER(dragstart); DEFINE_ATTRIBUTE_EVENT_LISTENER(drag); DEFINE_ATTRIBUTE_EVENT_LISTENER(dragend); + DEFINE_ATTRIBUTE_EVENT_LISTENER(formchange); + DEFINE_ATTRIBUTE_EVENT_LISTENER(forminput); DEFINE_ATTRIBUTE_EVENT_LISTENER(input); DEFINE_ATTRIBUTE_EVENT_LISTENER(invalid); DEFINE_ATTRIBUTE_EVENT_LISTENER(keydown); diff --git a/Source/WebCore/dom/Element.idl b/Source/WebCore/dom/Element.idl index 7cb63c2..652a75b 100644 --- a/Source/WebCore/dom/Element.idl +++ b/Source/WebCore/dom/Element.idl @@ -153,6 +153,8 @@ module core { attribute [DontEnum] EventListener ondrop; attribute [DontEnum] EventListener onerror; attribute [DontEnum] EventListener onfocus; + attribute [DontEnum] EventListener onformchange; + attribute [DontEnum] EventListener onforminput; attribute [DontEnum] EventListener oninput; attribute [DontEnum] EventListener oninvalid; attribute [DontEnum] EventListener onkeydown; @@ -174,8 +176,6 @@ module core { // attribute [DontEnum] EventListener ondurationchange; // attribute [DontEnum] EventListener onemptied; // attribute [DontEnum] EventListener onended; - // attribute [DontEnum] EventListener onformchange; - // attribute [DontEnum] EventListener onforminput; // attribute [DontEnum] EventListener onloadeddata; // attribute [DontEnum] EventListener onloadedmetadata; // attribute [DontEnum] EventListener onloadstart; diff --git a/Source/WebCore/dom/ElementRareData.h b/Source/WebCore/dom/ElementRareData.h index f7f30bb..818a2c2 100644 --- a/Source/WebCore/dom/ElementRareData.h +++ b/Source/WebCore/dom/ElementRareData.h @@ -33,6 +33,7 @@ namespace WebCore { class ElementRareData : public NodeRareData { public: ElementRareData(); + virtual ~ElementRareData(); void resetComputedStyle(); @@ -41,7 +42,7 @@ public: IntSize m_minimumSizeForResizing; RefPtr<RenderStyle> m_computedStyle; - RefPtr<Node> m_shadowRoot; + Node* m_shadowRoot; OwnPtr<DatasetDOMStringMap> m_datasetDOMStringMap; OwnPtr<ClassList> m_classList; @@ -54,9 +55,15 @@ inline IntSize defaultMinimumSizeForResizing() inline ElementRareData::ElementRareData() : m_minimumSizeForResizing(defaultMinimumSizeForResizing()) + , m_shadowRoot(0) { } +inline ElementRareData::~ElementRareData() +{ + ASSERT(!m_shadowRoot); +} + inline void ElementRareData::resetComputedStyle() { m_computedStyle.clear(); diff --git a/Source/WebCore/dom/ErrorEvent.cpp b/Source/WebCore/dom/ErrorEvent.cpp index 2627d01..c598836 100644 --- a/Source/WebCore/dom/ErrorEvent.cpp +++ b/Source/WebCore/dom/ErrorEvent.cpp @@ -30,8 +30,6 @@ #include "config.h" -#if ENABLE(WORKERS) - #include "ErrorEvent.h" #include "EventNames.h" @@ -72,5 +70,3 @@ bool ErrorEvent::isErrorEvent() const } } // namespace WebCore - -#endif // ENABLE(WORKERS) diff --git a/Source/WebCore/dom/ErrorEvent.h b/Source/WebCore/dom/ErrorEvent.h index f81530a..719ca2d 100644 --- a/Source/WebCore/dom/ErrorEvent.h +++ b/Source/WebCore/dom/ErrorEvent.h @@ -31,8 +31,6 @@ #ifndef ErrorEvent_h #define ErrorEvent_h -#if ENABLE(WORKERS) - #include "Event.h" #include "PlatformString.h" @@ -69,6 +67,4 @@ namespace WebCore { } // namespace WebCore -#endif // ENABLE(WORKERS) - #endif // ErrorEvent_h diff --git a/Source/WebCore/dom/Event.cpp b/Source/WebCore/dom/Event.cpp index 0a1538b..0e11c69 100644 --- a/Source/WebCore/dom/Event.cpp +++ b/Source/WebCore/dom/Event.cpp @@ -204,12 +204,10 @@ bool Event::isIDBSuccessEvent() const } #endif -#if ENABLE(WORKERS) bool Event::isErrorEvent() const { return false; } -#endif #if ENABLE(TOUCH_EVENTS) bool Event::isTouchEvent() const @@ -265,7 +263,7 @@ bool Event::fromUserGesture() // other accepted events || type == eventNames().selectEvent || type == eventNames().changeEvent || type == eventNames().focusEvent || type == eventNames().blurEvent - || type == eventNames().submitEvent; + || type == eventNames().submitEvent || type == eventNames().formchangeEvent; } bool Event::storesResultAsString() const diff --git a/Source/WebCore/dom/Event.h b/Source/WebCore/dom/Event.h index 8562cad..45b879d 100644 --- a/Source/WebCore/dom/Event.h +++ b/Source/WebCore/dom/Event.h @@ -24,13 +24,13 @@ #ifndef Event_h #define Event_h +#include "Clipboard.h" #include "DOMTimeStamp.h" #include <wtf/RefCounted.h> #include <wtf/text/AtomicString.h> namespace WebCore { - class Clipboard; class EventTarget; class Event : public RefCounted<Event> { @@ -132,9 +132,7 @@ namespace WebCore { #if ENABLE(WEB_AUDIO) virtual bool isAudioProcessingEvent() const; #endif -#if ENABLE(WORKERS) virtual bool isErrorEvent() const; -#endif #if ENABLE(TOUCH_EVENTS) virtual bool isTouchEvent() const; #endif diff --git a/Source/WebCore/dom/EventNames.h b/Source/WebCore/dom/EventNames.h index d19f043..3b52838 100644 --- a/Source/WebCore/dom/EventNames.h +++ b/Source/WebCore/dom/EventNames.h @@ -66,6 +66,8 @@ namespace WebCore { macro(focus) \ macro(focusin) \ macro(focusout) \ + macro(formchange) \ + macro(forminput) \ macro(hashchange) \ macro(input) \ macro(invalid) \ @@ -182,7 +184,8 @@ namespace WebCore { \ // end of DOM_EVENT_NAMES_FOR_EACH - class EventNames : public Noncopyable { + class EventNames { + WTF_MAKE_NONCOPYABLE(EventNames); WTF_MAKE_FAST_ALLOCATED; int dummy; // Needed to make initialization macro work. // Private to prevent accidental call to EventNames() instead of eventNames() EventNames(); diff --git a/Source/WebCore/dom/EventTarget.h b/Source/WebCore/dom/EventTarget.h index ddcb663..81eeb7f 100644 --- a/Source/WebCore/dom/EventTarget.h +++ b/Source/WebCore/dom/EventTarget.h @@ -83,7 +83,9 @@ namespace WebCore { typedef Vector<RegisteredEventListener, 1> EventListenerVector; typedef HashMap<AtomicString, EventListenerVector*> EventListenerMap; - struct EventTargetData : Noncopyable { + struct EventTargetData { + WTF_MAKE_NONCOPYABLE(EventTargetData); WTF_MAKE_FAST_ALLOCATED; + public: EventTargetData(); ~EventTargetData(); diff --git a/Source/WebCore/dom/IgnoreDestructiveWriteCountIncrementer.h b/Source/WebCore/dom/IgnoreDestructiveWriteCountIncrementer.h index 9d1835a..26f7fd0 100644 --- a/Source/WebCore/dom/IgnoreDestructiveWriteCountIncrementer.h +++ b/Source/WebCore/dom/IgnoreDestructiveWriteCountIncrementer.h @@ -27,11 +27,11 @@ #define IgnoreDestructiveWriteCountIncrementer_h #include "Document.h" -#include <wtf/Noncopyable.h> namespace WebCore { -class IgnoreDestructiveWriteCountIncrementer : public Noncopyable { +class IgnoreDestructiveWriteCountIncrementer { + WTF_MAKE_NONCOPYABLE(IgnoreDestructiveWriteCountIncrementer); public: explicit IgnoreDestructiveWriteCountIncrementer(Document* document) : m_count(document ? &document->m_ignoreDestructiveWriteCount : 0) diff --git a/Source/WebCore/dom/InputElement.cpp b/Source/WebCore/dom/InputElement.cpp index 37211d8..db89c16 100644 --- a/Source/WebCore/dom/InputElement.cpp +++ b/Source/WebCore/dom/InputElement.cpp @@ -140,7 +140,7 @@ void InputElement::setValueFromRenderer(InputElementData& data, InputElement* in // Input event is fired by the Node::defaultEventHandler for editable controls. if (!inputElement->isTextField()) - element->dispatchEvent(Event::create(eventNames().inputEvent, true, false)); + element->dispatchInputEvents(); notifyFormStateChanged(element); } diff --git a/Source/WebCore/dom/MessagePortChannel.h b/Source/WebCore/dom/MessagePortChannel.h index f308a29..07668a4 100644 --- a/Source/WebCore/dom/MessagePortChannel.h +++ b/Source/WebCore/dom/MessagePortChannel.h @@ -55,7 +55,8 @@ namespace WebCore { // MessagePortChannel is a platform-independent interface to the remote side of a message channel. // It acts as a wrapper around the platform-dependent PlatformMessagePortChannel implementation which ensures that the platform-dependent close() method is invoked before destruction. - class MessagePortChannel : public Noncopyable { + class MessagePortChannel { + WTF_MAKE_NONCOPYABLE(MessagePortChannel); WTF_MAKE_FAST_ALLOCATED; public: static void createChannel(PassRefPtr<MessagePort>, PassRefPtr<MessagePort>); @@ -78,7 +79,8 @@ namespace WebCore { // Returns true if the proxy currently contains messages for this port. bool hasPendingActivity(); - class EventData : public Noncopyable { + class EventData { + WTF_MAKE_NONCOPYABLE(EventData); WTF_MAKE_FAST_ALLOCATED; public: static PassOwnPtr<EventData> create(PassRefPtr<SerializedScriptValue>, PassOwnPtr<MessagePortChannelArray>); diff --git a/Source/WebCore/dom/NamedNodeMap.cpp b/Source/WebCore/dom/NamedNodeMap.cpp index bc56f7e..0e2861e 100644 --- a/Source/WebCore/dom/NamedNodeMap.cpp +++ b/Source/WebCore/dom/NamedNodeMap.cpp @@ -359,6 +359,8 @@ bool NamedNodeMap::mappedMapsEquivalent(const NamedNodeMap* otherMap) const Attribute* otherAttr = otherMap->getAttributeItem(attr->name()); if (!otherAttr || attr->value() != otherAttr->value()) return false; + if (!attr->decl()->propertiesEqual(otherAttr->decl())) + return false; } } return true; diff --git a/Source/WebCore/dom/Node.cpp b/Source/WebCore/dom/Node.cpp index 1998c8c..275e370 100644 --- a/Source/WebCore/dom/Node.cpp +++ b/Source/WebCore/dom/Node.cpp @@ -497,6 +497,7 @@ Element* Node::shadowHost() const void Node::setShadowHost(Element* host) { + ASSERT(!parentNode()); if (host) setFlag(IsShadowRootFlag); else @@ -3037,6 +3038,16 @@ void Node::dispatchBlurEvent() dispatchEvent(Event::create(eventNames().blurEvent, false, false)); } +void Node::dispatchChangeEvents() +{ + dispatchEvent(Event::create(eventNames().changeEvent, true, false)); +} + +void Node::dispatchInputEvents() +{ + dispatchEvent(Event::create(eventNames().inputEvent, true, false)); +} + bool Node::disabled() const { return false; @@ -3094,7 +3105,7 @@ void Node::defaultEventHandler(Event* event) if (Frame* frame = document()->frame()) frame->eventHandler()->defaultWheelEventHandler(startNode, wheelEvent); } else if (event->type() == eventNames().webkitEditableContentChangedEvent) { - dispatchEvent(Event::create(eventNames().inputEvent, true, false)); + dispatchInputEvents(); } } diff --git a/Source/WebCore/dom/Node.h b/Source/WebCore/dom/Node.h index bc33e22..546b223 100644 --- a/Source/WebCore/dom/Node.h +++ b/Source/WebCore/dom/Node.h @@ -553,6 +553,8 @@ public: virtual void dispatchFocusEvent(); virtual void dispatchBlurEvent(); + virtual void dispatchChangeEvents(); + virtual void dispatchInputEvents(); // Perform the default action for an event. virtual void defaultEventHandler(Event*); diff --git a/Source/WebCore/dom/NodeRareData.h b/Source/WebCore/dom/NodeRareData.h index ab208d2..7350f80 100644 --- a/Source/WebCore/dom/NodeRareData.h +++ b/Source/WebCore/dom/NodeRareData.h @@ -34,7 +34,9 @@ namespace WebCore { -struct NodeListsNodeData : Noncopyable { +struct NodeListsNodeData { + WTF_MAKE_NONCOPYABLE(NodeListsNodeData); WTF_MAKE_FAST_ALLOCATED; +public: typedef HashSet<DynamicNodeList*> NodeListSet; NodeListSet m_listsWithCaches; @@ -67,7 +69,8 @@ private: } }; -class NodeRareData : public Noncopyable { +class NodeRareData { + WTF_MAKE_NONCOPYABLE(NodeRareData); WTF_MAKE_FAST_ALLOCATED; public: NodeRareData() : m_tabIndex(0) diff --git a/Source/WebCore/dom/Position.cpp b/Source/WebCore/dom/Position.cpp index be175aa..6749ca9 100644 --- a/Source/WebCore/dom/Position.cpp +++ b/Source/WebCore/dom/Position.cpp @@ -146,6 +146,27 @@ int Position::computeOffsetInContainerNode() const return 0; } +// Neighbor-anchored positions are invalid DOM positions, so they need to be +// fixed up before handing them off to the Range object. +Position Position::parentAnchoredEquivalent() const +{ + if (!m_anchorNode) + return Position(); + + // FIXME: This should only be necessary for legacy positions, but is also needed for positions before and after Tables + if (m_offset <= 0) { + if (m_anchorNode->parentNode() && (editingIgnoresContent(m_anchorNode.get()) || isTableElement(m_anchorNode.get()))) + return positionInParentBeforeNode(m_anchorNode.get()); + return Position(m_anchorNode, 0, PositionIsOffsetInAnchor); + } + if (!m_anchorNode->offsetInCharacters() && static_cast<unsigned>(m_offset) == m_anchorNode->childNodeCount() + && (editingIgnoresContent(m_anchorNode.get()) || isTableElement(m_anchorNode.get()))) { + return positionInParentAfterNode(m_anchorNode.get()); + } + + return Position(containerNode(), computeOffsetInContainerNode(), PositionIsOffsetInAnchor); +} + Node* Position::computeNodeBeforePosition() const { if (!m_anchorNode) diff --git a/Source/WebCore/dom/Position.h b/Source/WebCore/dom/Position.h index 4d3b5fe..8b41736 100644 --- a/Source/WebCore/dom/Position.h +++ b/Source/WebCore/dom/Position.h @@ -80,6 +80,7 @@ public: // will return img->parentNode() and img->nodeIndex() from these functions. Node* containerNode() const; // NULL for a before/after position anchored to a node with no parent int computeOffsetInContainerNode() const; // O(n) for before/after-anchored positions, O(1) for parent-anchored positions + Position parentAnchoredEquivalent() const; // Convenience method for DOM positions that also fixes up some positions for editing // Inline O(1) access for Positions which callers know to be parent-anchored int offsetInContainerNode() const @@ -179,7 +180,7 @@ private: RefPtr<Node> m_anchorNode; // m_offset can be the offset inside m_anchorNode, or if editingIgnoresContent(m_anchorNode) // returns true, then other places in editing will treat m_offset == 0 as "before the anchor" - // and m_offset > 0 as "after the anchor node". See rangeCompliantEquivalent for more info. + // and m_offset > 0 as "after the anchor node". See parentAnchoredEquivalent for more info. int m_offset; unsigned m_anchorType : 2; bool m_isLegacyEditingPosition : 1; diff --git a/Source/WebCore/dom/QualifiedName.h b/Source/WebCore/dom/QualifiedName.h index 34fc069..cb95f20 100644 --- a/Source/WebCore/dom/QualifiedName.h +++ b/Source/WebCore/dom/QualifiedName.h @@ -32,7 +32,8 @@ struct QualifiedNameComponents { StringImpl* m_namespace; }; -class QualifiedName : public FastAllocBase { +class QualifiedName { + WTF_MAKE_FAST_ALLOCATED; public: class QualifiedNameImpl : public RefCounted<QualifiedNameImpl> { public: diff --git a/Source/WebCore/platform/ScrollbarClient.cpp b/Source/WebCore/dom/RequestAnimationFrameCallback.h index 2f81a93..819e495 100644 --- a/Source/WebCore/platform/ScrollbarClient.cpp +++ b/Source/WebCore/dom/RequestAnimationFrameCallback.h @@ -1,10 +1,10 @@ /* - * Copyright (c) 2010, Google Inc. All rights reserved. - * + * Copyright (C) 2011 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 @@ -14,7 +14,7 @@ * * 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 @@ -28,30 +28,26 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "config.h" -#include "ScrollbarClient.h" +#ifndef RequestAnimationFrameCallback_h +#define RequestAnimationFrameCallback_h -#include "ScrollAnimator.h" +#include "Element.h" +#include <wtf/PassRefPtr.h> +#include <wtf/RefCounted.h> namespace WebCore { -ScrollbarClient::ScrollbarClient() - : m_scrollAnimator(ScrollAnimator::create(this)) -{ -} +class RequestAnimationFrameCallback : public RefCounted<RequestAnimationFrameCallback> { +public: + virtual ~RequestAnimationFrameCallback() { } + virtual bool handleEvent() = 0; -ScrollbarClient::~ScrollbarClient() -{ -} + RefPtr<Element> m_element; + int m_id; + bool m_firedOrCancelled; +}; -bool ScrollbarClient::scroll(ScrollbarOrientation orientation, ScrollGranularity granularity, float step, float multiplier) -{ - return m_scrollAnimator->scroll(orientation, granularity, step, multiplier); } -void ScrollbarClient::setScrollPositionAndStopAnimation(ScrollbarOrientation orientation, float pos) -{ - m_scrollAnimator->setScrollPositionAndStopAnimation(orientation, pos); -} +#endif // RequestAnimationFrameCallback_h -} // namespace WebCore diff --git a/Source/WebCore/dom/RequestAnimationFrameCallback.idl b/Source/WebCore/dom/RequestAnimationFrameCallback.idl new file mode 100644 index 0000000..8d232e5 --- /dev/null +++ b/Source/WebCore/dom/RequestAnimationFrameCallback.idl @@ -0,0 +1,37 @@ +/* + * 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. + */ + +module core { + interface [ + Callback=FunctionOnly,Conditional=REQUEST_ANIMATION_FRAME + ] RequestAnimationFrameCallback{ + boolean handleEvent(); + }; +} diff --git a/Source/WebCore/dom/ScriptElement.h b/Source/WebCore/dom/ScriptElement.h index 07c59db..5250f3e 100644 --- a/Source/WebCore/dom/ScriptElement.h +++ b/Source/WebCore/dom/ScriptElement.h @@ -32,6 +32,7 @@ class ScriptElement; class ScriptSourceCode; class ScriptElement : private CachedResourceClient { + WTF_MAKE_FAST_ALLOCATED; public: ScriptElement(Element*, bool createdByParser, bool isEvaluated); virtual ~ScriptElement(); diff --git a/Source/WebCore/dom/ScriptExecutionContext.cpp b/Source/WebCore/dom/ScriptExecutionContext.cpp index bfda17b..9fdf85e 100644 --- a/Source/WebCore/dom/ScriptExecutionContext.cpp +++ b/Source/WebCore/dom/ScriptExecutionContext.cpp @@ -33,14 +33,19 @@ #include "Database.h" #include "DatabaseTask.h" #include "DatabaseThread.h" +#include "ErrorEvent.h" +#include "EventListener.h" +#include "EventTarget.h" #include "FileThread.h" #include "MessagePort.h" +#include "ScriptCallStack.h" #include "SecurityOrigin.h" #include "ThreadableBlobRegistry.h" #include "WorkerContext.h" #include "WorkerThread.h" #include <wtf/MainThread.h> #include <wtf/PassRefPtr.h> +#include <wtf/Vector.h> #if USE(JSC) #include "JSDOMWindow.h" @@ -61,9 +66,26 @@ public: } }; +class ScriptExecutionContext::PendingException { + WTF_MAKE_NONCOPYABLE(PendingException); +public: + PendingException(const String& errorMessage, int lineNumber, const String& sourceURL, PassRefPtr<ScriptCallStack> callStack) + : m_errorMessage(errorMessage) + , m_lineNumber(lineNumber) + , m_sourceURL(sourceURL) + , m_callStack(callStack) + { + } + String m_errorMessage; + int m_lineNumber; + String m_sourceURL; + RefPtr<ScriptCallStack> m_callStack; +}; + ScriptExecutionContext::ScriptExecutionContext() + : m_inDispatchErrorEvent(false) #if ENABLE(DATABASE) - : m_hasOpenDatabases(false) + , m_hasOpenDatabases(false) #endif { } @@ -243,6 +265,43 @@ void ScriptExecutionContext::setSecurityOrigin(PassRefPtr<SecurityOrigin> securi m_securityOrigin = securityOrigin; } +void ScriptExecutionContext::reportException(const String& errorMessage, int lineNumber, const String& sourceURL, PassRefPtr<ScriptCallStack> callStack) +{ + if (m_inDispatchErrorEvent) { + if (!m_pendingExceptions) + m_pendingExceptions = adoptPtr(new Vector<OwnPtr<PendingException> >()); + m_pendingExceptions->append(adoptPtr(new PendingException(errorMessage, lineNumber, sourceURL, callStack))); + return; + } + + // First report the original exception and only then all the nested ones. + if (!dispatchErrorEvent(errorMessage, lineNumber, sourceURL)) + logExceptionToConsole(errorMessage, lineNumber, sourceURL, callStack); + + if (!m_pendingExceptions) + return; + + for (size_t i = 0; i < m_pendingExceptions->size(); i++) { + PendingException* e = m_pendingExceptions->at(i).get(); + logExceptionToConsole(e->m_errorMessage, e->m_lineNumber, e->m_sourceURL, e->m_callStack); + } + m_pendingExceptions.clear(); +} + +bool ScriptExecutionContext::dispatchErrorEvent(const String& errorMessage, int lineNumber, const String& sourceURL) +{ + EventTarget* target = errorEventTarget(); + if (!target) + return false; + + ASSERT(!m_inDispatchErrorEvent); + m_inDispatchErrorEvent = true; + RefPtr<ErrorEvent> errorEvent = ErrorEvent::create(errorMessage, sourceURL, lineNumber); + target->dispatchEvent(errorEvent); + m_inDispatchErrorEvent = false; + return errorEvent->defaultPrevented(); +} + void ScriptExecutionContext::addTimeout(int timeoutId, DOMTimer* timer) { ASSERT(!m_timeouts.contains(timeoutId)); diff --git a/Source/WebCore/dom/ScriptExecutionContext.h b/Source/WebCore/dom/ScriptExecutionContext.h index e473a4b..b57b75a 100644 --- a/Source/WebCore/dom/ScriptExecutionContext.h +++ b/Source/WebCore/dom/ScriptExecutionContext.h @@ -33,6 +33,8 @@ #include <wtf/Forward.h> #include <wtf/HashMap.h> #include <wtf/HashSet.h> +#include <wtf/Noncopyable.h> +#include <wtf/OwnPtr.h> #include <wtf/PassOwnPtr.h> #include <wtf/PassRefPtr.h> #include <wtf/RefPtr.h> @@ -52,11 +54,14 @@ namespace WebCore { class DatabaseThread; #endif class DOMTimer; + class EventListener; + class EventTarget; #if ENABLE(BLOB) || ENABLE(FILE_SYSTEM) class FileThread; #endif class MessagePort; class SecurityOrigin; + class ScriptCallStack; class ScriptExecutionContext { public: @@ -85,8 +90,8 @@ namespace WebCore { SecurityOrigin* securityOrigin() const { return m_securityOrigin.get(); } - virtual void reportException(const String& errorMessage, int lineNumber, const String& sourceURL) = 0; - virtual void addMessage(MessageSource, MessageType, MessageLevel, const String& message, unsigned lineNumber, const String& sourceURL) = 0; + void reportException(const String& errorMessage, int lineNumber, const String& sourceURL, PassRefPtr<ScriptCallStack>); + virtual void addMessage(MessageSource, MessageType, MessageLevel, const String& message, unsigned lineNumber, const String& sourceURL, PassRefPtr<ScriptCallStack>) = 0; // Active objects are not garbage collected even if inaccessible, e.g. because their activity may result in callbacks being invoked. bool canSuspendActiveDOMObjects(); @@ -110,8 +115,10 @@ namespace WebCore { void ref() { refScriptExecutionContext(); } void deref() { derefScriptExecutionContext(); } - class Task : public Noncopyable { + class Task { + WTF_MAKE_NONCOPYABLE(Task); WTF_MAKE_FAST_ALLOCATED; public: + Task() { } virtual ~Task(); virtual void performTask(ScriptExecutionContext*) = 0; // Certain tasks get marked specially so that they aren't discarded, and are executed, when the context is shutting down its message queue. @@ -148,6 +155,10 @@ namespace WebCore { virtual const KURL& virtualURL() const = 0; virtual KURL virtualCompleteURL(const String&) const = 0; + virtual EventTarget* errorEventTarget() = 0; + virtual void logExceptionToConsole(const String& errorMessage, int lineNumber, const String& sourceURL, PassRefPtr<ScriptCallStack>) = 0; + bool dispatchErrorEvent(const String& errorMessage, int lineNumber, const String& sourceURL); + void closeMessagePorts(); RefPtr<SecurityOrigin> m_securityOrigin; @@ -165,6 +176,10 @@ namespace WebCore { virtual void refScriptExecutionContext() = 0; virtual void derefScriptExecutionContext() = 0; + bool m_inDispatchErrorEvent; + class PendingException; + OwnPtr<Vector<OwnPtr<PendingException> > > m_pendingExceptions; + #if ENABLE(DATABASE) RefPtr<DatabaseThread> m_databaseThread; bool m_hasOpenDatabases; // This never changes back to false, even after the database thread is closed. diff --git a/Source/WebCore/dom/SpaceSplitString.h b/Source/WebCore/dom/SpaceSplitString.h index 826e6bd..6eb893c 100644 --- a/Source/WebCore/dom/SpaceSplitString.h +++ b/Source/WebCore/dom/SpaceSplitString.h @@ -28,7 +28,8 @@ namespace WebCore { - class SpaceSplitStringData : public Noncopyable { + class SpaceSplitStringData { + WTF_MAKE_NONCOPYABLE(SpaceSplitStringData); WTF_MAKE_FAST_ALLOCATED; public: SpaceSplitStringData(const String& string, bool shouldFoldCase) : m_string(string), m_shouldFoldCase(shouldFoldCase), m_createdVector(false) diff --git a/Source/WebCore/dom/TextEvent.cpp b/Source/WebCore/dom/TextEvent.cpp index 68ed4b2..b7bd1c8 100644 --- a/Source/WebCore/dom/TextEvent.cpp +++ b/Source/WebCore/dom/TextEvent.cpp @@ -31,21 +31,12 @@ namespace WebCore { -TextEvent::InputType TextEvent::selectInputType(bool isLineBreak, bool isBackTab) -{ - if (isLineBreak) - return TextEvent::InputTypeLineBreak; - if (isBackTab) - return TextEvent::InputTypeBackTab; - return TextEvent::InputTypeKeyboard; -} - PassRefPtr<TextEvent> TextEvent::create() { return adoptRef(new TextEvent); } -PassRefPtr<TextEvent> TextEvent::create(PassRefPtr<AbstractView> view, const String& data, TextEvent::InputType inputType) +PassRefPtr<TextEvent> TextEvent::create(PassRefPtr<AbstractView> view, const String& data, TextEventInputType inputType) { return adoptRef(new TextEvent(view, data, inputType)); } @@ -62,17 +53,17 @@ PassRefPtr<TextEvent> TextEvent::createForFragmentPaste(PassRefPtr<AbstractView> PassRefPtr<TextEvent> TextEvent::createForDrop(PassRefPtr<AbstractView> view, const String& data) { - return adoptRef(new TextEvent(view, data, TextEvent::InputTypeDrop)); + return adoptRef(new TextEvent(view, data, TextEventInputDrop)); } TextEvent::TextEvent() - : m_inputType(TextEvent::InputTypeKeyboard) + : m_inputType(TextEventInputKeyboard) , m_shouldSmartReplace(false) , m_shouldMatchStyle(false) { } -TextEvent::TextEvent(PassRefPtr<AbstractView> view, const String& data, InputType inputType) +TextEvent::TextEvent(PassRefPtr<AbstractView> view, const String& data, TextEventInputType inputType) : UIEvent(eventNames().textInputEvent, true, true, view, 0) , m_inputType(inputType) , m_data(data) @@ -85,7 +76,7 @@ TextEvent::TextEvent(PassRefPtr<AbstractView> view, const String& data, InputTyp TextEvent::TextEvent(PassRefPtr<AbstractView> view, const String& data, PassRefPtr<DocumentFragment> pastingFragment, bool shouldSmartReplace, bool shouldMatchStyle) : UIEvent(eventNames().textInputEvent, true, true, view, 0) - , m_inputType(TextEvent::InputTypePaste) + , m_inputType(TextEventInputPaste) , m_data(data) , m_pastingFragment(pastingFragment) , m_shouldSmartReplace(shouldSmartReplace) diff --git a/Source/WebCore/dom/TextEvent.h b/Source/WebCore/dom/TextEvent.h index f1d24e9..d770d38 100644 --- a/Source/WebCore/dom/TextEvent.h +++ b/Source/WebCore/dom/TextEvent.h @@ -28,23 +28,16 @@ #define TextEvent_h #include "DocumentFragment.h" +#include "TextEventInputType.h" #include "UIEvent.h" namespace WebCore { class TextEvent : public UIEvent { public: - enum InputType { - InputTypeKeyboard, // any newline characters in the text are line breaks only, not paragraph separators. - InputTypeLineBreak, // any tab characters in the text are backtabs. - InputTypeBackTab, - InputTypePaste, - InputTypeDrop, - }; - static InputType selectInputType(bool isLineBreak, bool isBackTab); static PassRefPtr<TextEvent> create(); - static PassRefPtr<TextEvent> create(PassRefPtr<AbstractView> view, const String& data, InputType = InputTypeKeyboard); + static PassRefPtr<TextEvent> create(PassRefPtr<AbstractView>, const String& data, TextEventInputType = TextEventInputKeyboard); static PassRefPtr<TextEvent> createForPlainTextPaste(PassRefPtr<AbstractView> view, const String& data, bool shouldSmartReplace); static PassRefPtr<TextEvent> createForFragmentPaste(PassRefPtr<AbstractView> view, PassRefPtr<DocumentFragment> data, bool shouldSmartReplace, bool shouldMatchStyle); static PassRefPtr<TextEvent> createForDrop(PassRefPtr<AbstractView> view, const String& data); @@ -57,10 +50,10 @@ namespace WebCore { virtual bool isTextEvent() const; - bool isLineBreak() const { return m_inputType == InputTypeLineBreak; } - bool isBackTab() const { return m_inputType == InputTypeBackTab; } - bool isPaste() const { return m_inputType == InputTypePaste; } - bool isDrop() const { return m_inputType == InputTypeDrop; } + bool isLineBreak() const { return m_inputType == TextEventInputLineBreak; } + bool isBackTab() const { return m_inputType == TextEventInputBackTab; } + bool isPaste() const { return m_inputType == TextEventInputPaste; } + bool isDrop() const { return m_inputType == TextEventInputDrop; } bool shouldSmartReplace() const { return m_shouldSmartReplace; } bool shouldMatchStyle() const { return m_shouldMatchStyle; } @@ -69,11 +62,11 @@ namespace WebCore { private: TextEvent(); - TextEvent(PassRefPtr<AbstractView>, const String& data, InputType = InputTypeKeyboard); + TextEvent(PassRefPtr<AbstractView>, const String& data, TextEventInputType = TextEventInputKeyboard); TextEvent(PassRefPtr<AbstractView>, const String& data, PassRefPtr<DocumentFragment>, bool shouldSmartReplace, bool shouldMatchStyle); - InputType m_inputType; + TextEventInputType m_inputType; String m_data; RefPtr<DocumentFragment> m_pastingFragment; diff --git a/Source/WebCore/dom/TextEventInputType.h b/Source/WebCore/dom/TextEventInputType.h new file mode 100644 index 0000000..2522ec4 --- /dev/null +++ b/Source/WebCore/dom/TextEventInputType.h @@ -0,0 +1,41 @@ +/* + * 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 INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef TextEventInputType_h +#define TextEventInputType_h + +namespace WebCore { + +enum TextEventInputType { + TextEventInputKeyboard, // any newline characters in the text are line breaks only, not paragraph separators. + TextEventInputLineBreak, // any tab characters in the text are backtabs. + TextEventInputBackTab, + TextEventInputPaste, + TextEventInputDrop, +}; + +} // namespace WebCore + +#endif // TextEventInputType_h diff --git a/Source/WebCore/dom/TransformSource.h b/Source/WebCore/dom/TransformSource.h index f97afcf..63dc78a 100644 --- a/Source/WebCore/dom/TransformSource.h +++ b/Source/WebCore/dom/TransformSource.h @@ -33,7 +33,8 @@ namespace WebCore { typedef void* PlatformTransformSource; #endif - class TransformSource : public Noncopyable { + class TransformSource { + WTF_MAKE_NONCOPYABLE(TransformSource); WTF_MAKE_FAST_ALLOCATED; public: TransformSource(const PlatformTransformSource& source); ~TransformSource(); diff --git a/Source/WebCore/dom/UserGestureIndicator.h b/Source/WebCore/dom/UserGestureIndicator.h index 17ea319..b1ed96b 100644 --- a/Source/WebCore/dom/UserGestureIndicator.h +++ b/Source/WebCore/dom/UserGestureIndicator.h @@ -36,7 +36,8 @@ enum ProcessingUserGestureState { DefinitelyNotProcessingUserGesture }; -class UserGestureIndicator : public Noncopyable { +class UserGestureIndicator { + WTF_MAKE_NONCOPYABLE(UserGestureIndicator); public: static bool processingUserGesture() { return s_processingUserGesture == DefinitelyProcessingUserGesture; } static ProcessingUserGestureState getUserGestureState() { return s_processingUserGesture; } diff --git a/Source/WebCore/dom/UserTypingGestureIndicator.h b/Source/WebCore/dom/UserTypingGestureIndicator.h index 6c71079..21f4c7e 100644 --- a/Source/WebCore/dom/UserTypingGestureIndicator.h +++ b/Source/WebCore/dom/UserTypingGestureIndicator.h @@ -34,7 +34,8 @@ namespace WebCore { class Frame; class Node; -class UserTypingGestureIndicator : public Noncopyable { +class UserTypingGestureIndicator { + WTF_MAKE_NONCOPYABLE(UserTypingGestureIndicator); public: static bool processingUserTypingGesture(); static Node* focusedElementAtGestureStart(); diff --git a/Source/WebCore/dom/XMLDocumentParser.h b/Source/WebCore/dom/XMLDocumentParser.h index 70628ed..2e305c8 100644 --- a/Source/WebCore/dom/XMLDocumentParser.h +++ b/Source/WebCore/dom/XMLDocumentParser.h @@ -180,6 +180,7 @@ namespace WebCore { #endif class XMLDocumentParser : public ScriptableDocumentParser, public CachedResourceClient { + WTF_MAKE_FAST_ALLOCATED; public: static PassRefPtr<XMLDocumentParser> create(Document* document, FrameView* view) { diff --git a/Source/WebCore/dom/XMLDocumentParserLibxml2.cpp b/Source/WebCore/dom/XMLDocumentParserLibxml2.cpp index 0f6b4b4..10d6e0d 100644 --- a/Source/WebCore/dom/XMLDocumentParserLibxml2.cpp +++ b/Source/WebCore/dom/XMLDocumentParserLibxml2.cpp @@ -75,8 +75,10 @@ using namespace std; namespace WebCore { -class PendingCallbacks : public Noncopyable { +class PendingCallbacks { + WTF_MAKE_NONCOPYABLE(PendingCallbacks); public: + PendingCallbacks() { } ~PendingCallbacks() { deleteAllValues(m_callbacks); diff --git a/Source/WebCore/dom/XMLDocumentParserScope.h b/Source/WebCore/dom/XMLDocumentParserScope.h index 58e8a6b..f60471b 100644 --- a/Source/WebCore/dom/XMLDocumentParserScope.h +++ b/Source/WebCore/dom/XMLDocumentParserScope.h @@ -36,7 +36,8 @@ namespace WebCore { class CachedResourceLoader; - class XMLDocumentParserScope : public Noncopyable { + class XMLDocumentParserScope { + WTF_MAKE_NONCOPYABLE(XMLDocumentParserScope); public: XMLDocumentParserScope(CachedResourceLoader* cachedResourceLoader); ~XMLDocumentParserScope(); diff --git a/Source/WebCore/editing/ApplyStyleCommand.cpp b/Source/WebCore/editing/ApplyStyleCommand.cpp index 7227d7b..39350b9 100644 --- a/Source/WebCore/editing/ApplyStyleCommand.cpp +++ b/Source/WebCore/editing/ApplyStyleCommand.cpp @@ -569,8 +569,8 @@ void ApplyStyleCommand::applyBlockStyle(CSSMutableStyleDeclaration *style) // addBlockStyleIfNeeded may moveParagraphs, which can remove these endpoints. // Calculate start and end indices from the start of the tree that they're in. Node* scope = highestAncestor(visibleStart.deepEquivalent().node()); - RefPtr<Range> startRange = Range::create(document(), firstPositionInNode(scope), rangeCompliantEquivalent(visibleStart.deepEquivalent())); - RefPtr<Range> endRange = Range::create(document(), firstPositionInNode(scope), rangeCompliantEquivalent(visibleEnd.deepEquivalent())); + RefPtr<Range> startRange = Range::create(document(), firstPositionInNode(scope), visibleStart.deepEquivalent().parentAnchoredEquivalent()); + RefPtr<Range> endRange = Range::create(document(), firstPositionInNode(scope), visibleEnd.deepEquivalent().parentAnchoredEquivalent()); int startIndex = TextIterator::rangeLength(startRange.get(), true); int endIndex = TextIterator::rangeLength(endRange.get(), true); diff --git a/Source/WebCore/editing/CompositeEditCommand.cpp b/Source/WebCore/editing/CompositeEditCommand.cpp index 9e1dfca..552ed79 100644 --- a/Source/WebCore/editing/CompositeEditCommand.cpp +++ b/Source/WebCore/editing/CompositeEditCommand.cpp @@ -159,7 +159,7 @@ void CompositeEditCommand::insertNodeAt(PassRefPtr<Node> insertChild, const Posi ASSERT(isEditablePosition(editingPosition)); // For editing positions like [table, 0], insert before the table, // likewise for replaced elements, brs, etc. - Position p = rangeCompliantEquivalent(editingPosition); + Position p = editingPosition.parentAnchoredEquivalent(); Node* refChild = p.node(); int offset = p.deprecatedEditingOffset(); @@ -905,13 +905,13 @@ void CompositeEditCommand::moveParagraphs(const VisiblePosition& startOfParagrap startIndex = 0; if (startInParagraph) { - RefPtr<Range> startRange = Range::create(document(), rangeCompliantEquivalent(startOfParagraphToMove.deepEquivalent()), rangeCompliantEquivalent(visibleStart.deepEquivalent())); + RefPtr<Range> startRange = Range::create(document(), startOfParagraphToMove.deepEquivalent().parentAnchoredEquivalent(), visibleStart.deepEquivalent().parentAnchoredEquivalent()); startIndex = TextIterator::rangeLength(startRange.get(), true); } endIndex = 0; if (endInParagraph) { - RefPtr<Range> endRange = Range::create(document(), rangeCompliantEquivalent(startOfParagraphToMove.deepEquivalent()), rangeCompliantEquivalent(visibleEnd.deepEquivalent())); + RefPtr<Range> endRange = Range::create(document(), startOfParagraphToMove.deepEquivalent().parentAnchoredEquivalent(), visibleEnd.deepEquivalent().parentAnchoredEquivalent()); endIndex = TextIterator::rangeLength(endRange.get(), true); } } @@ -926,8 +926,8 @@ void CompositeEditCommand::moveParagraphs(const VisiblePosition& startOfParagrap Position end = endOfParagraphToMove.deepEquivalent().upstream(); // start and end can't be used directly to create a Range; they are "editing positions" - Position startRangeCompliant = rangeCompliantEquivalent(start); - Position endRangeCompliant = rangeCompliantEquivalent(end); + Position startRangeCompliant = start.parentAnchoredEquivalent(); + Position endRangeCompliant = end.parentAnchoredEquivalent(); RefPtr<Range> range = Range::create(document(), startRangeCompliant.node(), startRangeCompliant.deprecatedEditingOffset(), endRangeCompliant.node(), endRangeCompliant.deprecatedEditingOffset()); // FIXME: This is an inefficient way to preserve style on nodes in the paragraph to move. It @@ -974,7 +974,7 @@ void CompositeEditCommand::moveParagraphs(const VisiblePosition& startOfParagrap updateLayout(); } - RefPtr<Range> startToDestinationRange(Range::create(document(), firstPositionInNode(document()->documentElement()), rangeCompliantEquivalent(destination.deepEquivalent()))); + RefPtr<Range> startToDestinationRange(Range::create(document(), firstPositionInNode(document()->documentElement()), destination.deepEquivalent().parentAnchoredEquivalent())); destinationIndex = TextIterator::rangeLength(startToDestinationRange.get(), true); setEndingSelection(destination); diff --git a/Source/WebCore/editing/DeleteButtonController.h b/Source/WebCore/editing/DeleteButtonController.h index 1286c07..4d928c7 100644 --- a/Source/WebCore/editing/DeleteButtonController.h +++ b/Source/WebCore/editing/DeleteButtonController.h @@ -36,7 +36,8 @@ class HTMLElement; class RenderObject; class VisibleSelection; -class DeleteButtonController : public Noncopyable { +class DeleteButtonController { + WTF_MAKE_NONCOPYABLE(DeleteButtonController); WTF_MAKE_FAST_ALLOCATED; public: DeleteButtonController(Frame*); diff --git a/Source/WebCore/editing/DeleteSelectionCommand.cpp b/Source/WebCore/editing/DeleteSelectionCommand.cpp index 24c1968..3ba5ae9 100644 --- a/Source/WebCore/editing/DeleteSelectionCommand.cpp +++ b/Source/WebCore/editing/DeleteSelectionCommand.cpp @@ -111,9 +111,9 @@ void DeleteSelectionCommand::initializeStartEnd(Position& start, Position& end) // For HRs, we'll get a position at (HR,1) when hitting delete from the beginning of the previous line, or (HR,0) when forward deleting, // but in these cases, we want to delete it, so manually expand the selection if (start.node()->hasTagName(hrTag)) - start = Position(start.node(), 0); + start = positionBeforeNode(start.node()); else if (end.node()->hasTagName(hrTag)) - end = Position(end.node(), 1); + end = positionAfterNode(end.node()); // FIXME: This is only used so that moveParagraphs can avoid the bugs in special element expansion. if (!m_expandForSpecialElements) @@ -256,14 +256,14 @@ void DeleteSelectionCommand::initializePositionData() } } - // We must pass the positions through rangeCompliantEquivalent, since some editing positions + // We must pass call parentAnchoredEquivalent on the positions since some editing positions // that appear inside their nodes aren't really inside them. [hr, 0] is one example. - // FIXME: rangeComplaintEquivalent should eventually be moved into enclosing element getters + // FIXME: parentAnchoredEquivalent should eventually be moved into enclosing element getters // like the one below, since editing functions should obviously accept editing positions. // FIXME: Passing false to enclosingNodeOfType tells it that it's OK to return a non-editable // node. This was done to match existing behavior, but it seems wrong. - m_startBlock = enclosingNodeOfType(rangeCompliantEquivalent(m_downstreamStart), &isBlock, false); - m_endBlock = enclosingNodeOfType(rangeCompliantEquivalent(m_upstreamEnd), &isBlock, false); + m_startBlock = enclosingNodeOfType(m_downstreamStart.parentAnchoredEquivalent(), &isBlock, false); + m_endBlock = enclosingNodeOfType(m_upstreamEnd.parentAnchoredEquivalent(), &isBlock, false); } void DeleteSelectionCommand::saveTypingStyleState() @@ -315,10 +315,22 @@ static void updatePositionForNodeRemoval(Node* node, Position& position) { if (position.isNull()) return; - if (node->parentNode() == position.node() && node->nodeIndex() < (unsigned)position.deprecatedEditingOffset()) - position = Position(position.node(), position.deprecatedEditingOffset() - 1); - if (position.node() == node || position.node()->isDescendantOf(node)) - position = positionInParentBeforeNode(node); + switch (position.anchorType()) { + case Position::PositionIsOffsetInAnchor: + if (position.containerNode() == node->parentNode() && static_cast<unsigned>(position.offsetInContainerNode()) > node->nodeIndex()) + position.moveToOffset(position.offsetInContainerNode() - 1); + else if (node->contains(position.containerNode())) + position = positionInParentBeforeNode(node); + break; + case Position::PositionIsAfterAnchor: + if (node->contains(position.anchorNode())) + position = positionInParentAfterNode(node); + break; + case Position::PositionIsBeforeAnchor: + if (node->contains(position.anchorNode())) + position = positionInParentBeforeNode(node); + break; + } } void DeleteSelectionCommand::removeNode(PassRefPtr<Node> node) @@ -362,7 +374,7 @@ void DeleteSelectionCommand::removeNode(PassRefPtr<Node> node) updateLayout(); RenderObject *r = node->renderer(); if (r && r->isTableCell() && toRenderTableCell(r)->contentHeight() <= 0) - insertBlockPlaceholder(Position(node, 0)); + insertBlockPlaceholder(firstPositionInNode(node.get())); return; } @@ -381,12 +393,13 @@ void DeleteSelectionCommand::removeNode(PassRefPtr<Node> node) static void updatePositionForTextRemoval(Node* node, int offset, int count, Position& position) { - if (position.node() == node) { - if (position.deprecatedEditingOffset() > offset + count) - position = Position(position.node(), position.deprecatedEditingOffset() - count); - else if (position.deprecatedEditingOffset() > offset) - position = Position(position.node(), offset); - } + if (position.anchorType() != Position::PositionIsOffsetInAnchor || position.containerNode() != node) + return; + + if (position.offsetInContainerNode() > offset + count) + position.moveToOffset(position.offsetInContainerNode() - count); + else if (position.offsetInContainerNode() > offset) + position.moveToOffset(offset); } void DeleteSelectionCommand::deleteTextFromNode(PassRefPtr<Text> node, unsigned offset, unsigned count) @@ -463,7 +476,7 @@ void DeleteSelectionCommand::handleGeneralDelete() // handle deleting all nodes that are completely selected while (node && node != m_downstreamEnd.node()) { - if (comparePositions(Position(node.get(), 0), m_downstreamEnd) >= 0) { + if (comparePositions(firstPositionInOrBeforeNode(node.get()), m_downstreamEnd) >= 0) { // traverseNextSibling just blew past the end position, so stop deleting node = 0; } else if (!m_downstreamEnd.node()->isDescendantOf(node.get())) { @@ -471,8 +484,9 @@ void DeleteSelectionCommand::handleGeneralDelete() // if we just removed a node from the end container, update end position so the // check above will work if (node->parentNode() == m_downstreamEnd.node()) { + ASSERT(m_downstreamEnd.deprecatedEditingOffset()); ASSERT(node->nodeIndex() < (unsigned)m_downstreamEnd.deprecatedEditingOffset()); - m_downstreamEnd = Position(m_downstreamEnd.node(), m_downstreamEnd.deprecatedEditingOffset() - 1); + m_downstreamEnd.moveToOffset(m_downstreamEnd.deprecatedEditingOffset() - 1); } removeNode(node.get()); node = nextNode.get(); @@ -513,7 +527,7 @@ void DeleteSelectionCommand::handleGeneralDelete() offset = n->nodeIndex() + 1; } removeChildrenInRange(m_downstreamEnd.node(), offset, m_downstreamEnd.deprecatedEditingOffset()); - m_downstreamEnd = Position(m_downstreamEnd.node(), offset); + m_downstreamEnd.moveToOffset(offset); } } } @@ -609,8 +623,8 @@ void DeleteSelectionCommand::mergeParagraphs() return; } - RefPtr<Range> range = Range::create(document(), rangeCompliantEquivalent(startOfParagraphToMove.deepEquivalent()), rangeCompliantEquivalent(endOfParagraphToMove.deepEquivalent())); - RefPtr<Range> rangeToBeReplaced = Range::create(document(), rangeCompliantEquivalent(mergeDestination.deepEquivalent()), rangeCompliantEquivalent(mergeDestination.deepEquivalent())); + RefPtr<Range> range = Range::create(document(), startOfParagraphToMove.deepEquivalent().parentAnchoredEquivalent(), endOfParagraphToMove.deepEquivalent().parentAnchoredEquivalent()); + RefPtr<Range> rangeToBeReplaced = Range::create(document(), mergeDestination.deepEquivalent().parentAnchoredEquivalent(), mergeDestination.deepEquivalent().parentAnchoredEquivalent()); if (!document()->frame()->editor()->client()->shouldMoveRangeAfterDelete(range.get(), rangeToBeReplaced.get())) return; diff --git a/Source/WebCore/editing/Editor.cpp b/Source/WebCore/editing/Editor.cpp index bea74d9..23b41ce 100644 --- a/Source/WebCore/editing/Editor.cpp +++ b/Source/WebCore/editing/Editor.cpp @@ -643,7 +643,7 @@ WritingDirection Editor::textDirectionForSelection(bool& hasNestedOrMultipleEmbe if (m_frame->selection()->isRange()) { end = m_frame->selection()->selection().end().upstream(); - Node* pastLast = Range::create(m_frame->document(), rangeCompliantEquivalent(position), rangeCompliantEquivalent(end))->pastLastNode(); + Node* pastLast = Range::create(m_frame->document(), position.parentAnchoredEquivalent(), end.parentAnchoredEquivalent())->pastLastNode(); for (Node* n = node; n && n != pastLast; n = n->traverseNextNode()) { if (!n->isStyledElement()) continue; @@ -1783,7 +1783,7 @@ void Editor::advanceToNextMisspelling(bool startBeforeSelection) if (position.isNull()) return; - Position rangeCompliantPosition = rangeCompliantEquivalent(position); + Position rangeCompliantPosition = position.parentAnchoredEquivalent(); spellingSearchRange->setStart(rangeCompliantPosition.node(), rangeCompliantPosition.deprecatedEditingOffset(), ec); startedWithSelection = false; // won't need to wrap } diff --git a/Source/WebCore/editing/EditorCommand.cpp b/Source/WebCore/editing/EditorCommand.cpp index 64993d5..9e5bf9f 100644 --- a/Source/WebCore/editing/EditorCommand.cpp +++ b/Source/WebCore/editing/EditorCommand.cpp @@ -477,7 +477,7 @@ static bool executeIndent(Frame* frame, Event*, EditorCommandSource, const Strin static bool executeInsertBacktab(Frame* frame, Event* event, EditorCommandSource, const String&) { - return targetFrame(frame, event)->eventHandler()->handleTextInputEvent("\t", event, false, true); + return targetFrame(frame, event)->eventHandler()->handleTextInputEvent("\t", event, TextEventInputBackTab); } static bool executeInsertHorizontalRule(Frame* frame, Event*, EditorCommandSource, const String& value) @@ -505,7 +505,7 @@ static bool executeInsertLineBreak(Frame* frame, Event* event, EditorCommandSour { switch (source) { case CommandFromMenuOrKeyBinding: - return targetFrame(frame, event)->eventHandler()->handleTextInputEvent("\n", event, true); + return targetFrame(frame, event)->eventHandler()->handleTextInputEvent("\n", event, TextEventInputLineBreak); case CommandFromDOM: case CommandFromDOMWithUserInterface: // Doesn't scroll to make the selection visible, or modify the kill ring. @@ -521,7 +521,7 @@ static bool executeInsertLineBreak(Frame* frame, Event* event, EditorCommandSour static bool executeInsertNewline(Frame* frame, Event* event, EditorCommandSource, const String&) { Frame* targetFrame = WebCore::targetFrame(frame, event); - return targetFrame->eventHandler()->handleTextInputEvent("\n", event, !targetFrame->editor()->canEditRichly()); + return targetFrame->eventHandler()->handleTextInputEvent("\n", event, targetFrame->editor()->canEditRichly() ? TextEventInputKeyboard : TextEventInputLineBreak); } static bool executeInsertNewlineInQuotedContent(Frame* frame, Event*, EditorCommandSource, const String&) @@ -544,7 +544,7 @@ static bool executeInsertParagraph(Frame* frame, Event*, EditorCommandSource, co static bool executeInsertTab(Frame* frame, Event* event, EditorCommandSource, const String&) { - return targetFrame(frame, event)->eventHandler()->handleTextInputEvent("\t", event, false, false); + return targetFrame(frame, event)->eventHandler()->handleTextInputEvent("\t", event); } static bool executeInsertText(Frame* frame, Event*, EditorCommandSource, const String& value) diff --git a/Source/WebCore/editing/IndentOutdentCommand.cpp b/Source/WebCore/editing/IndentOutdentCommand.cpp index 13d0f88..9d1adc1 100644 --- a/Source/WebCore/editing/IndentOutdentCommand.cpp +++ b/Source/WebCore/editing/IndentOutdentCommand.cpp @@ -134,11 +134,11 @@ void IndentOutdentCommand::outdentParagraph() } // The selection is inside a blockquote i.e. enclosingNode is a blockquote - VisiblePosition positionInEnclosingBlock = VisiblePosition(Position(enclosingNode, 0)); + VisiblePosition positionInEnclosingBlock = VisiblePosition(firstPositionInNode(enclosingNode)); // If the blockquote is inline, the start of the enclosing block coincides with // positionInEnclosingBlock. VisiblePosition startOfEnclosingBlock = (enclosingNode->renderer() && enclosingNode->renderer()->isInline()) ? positionInEnclosingBlock : startOfBlock(positionInEnclosingBlock); - VisiblePosition lastPositionInEnclosingBlock = VisiblePosition(Position(enclosingNode, enclosingNode->childNodeCount())); + VisiblePosition lastPositionInEnclosingBlock = VisiblePosition(lastPositionInNode(enclosingNode)); VisiblePosition endOfEnclosingBlock = endOfBlock(lastPositionInEnclosingBlock); if (visibleStartOfParagraph == startOfEnclosingBlock && visibleEndOfParagraph == endOfEnclosingBlock) { @@ -176,7 +176,7 @@ void IndentOutdentCommand::outdentParagraph() } RefPtr<Node> placeholder = createBreakElement(document()); insertNodeBefore(placeholder, splitBlockquoteNode); - moveParagraph(startOfParagraph(visibleStartOfParagraph), endOfParagraph(visibleEndOfParagraph), VisiblePosition(Position(placeholder.get(), 0)), true); + moveParagraph(startOfParagraph(visibleStartOfParagraph), endOfParagraph(visibleEndOfParagraph), positionBeforeNode(placeholder.get()), true); } // FIXME: We should merge this function with ApplyBlockElementCommand::formatSelection diff --git a/Source/WebCore/editing/InsertLineBreakCommand.cpp b/Source/WebCore/editing/InsertLineBreakCommand.cpp index 3070edf..af8f2fc 100644 --- a/Source/WebCore/editing/InsertLineBreakCommand.cpp +++ b/Source/WebCore/editing/InsertLineBreakCommand.cpp @@ -82,7 +82,7 @@ bool InsertLineBreakCommand::shouldUseBreakElement(const Position& insertionPos) // An editing position like [input, 0] actually refers to the position before // the input element, and in that case we need to check the input element's // parent's renderer. - Position p(rangeCompliantEquivalent(insertionPos)); + Position p(insertionPos.parentAnchoredEquivalent()); return p.node()->renderer() && !p.node()->renderer()->style()->preserveNewline(); } @@ -121,13 +121,13 @@ void InsertLineBreakCommand::doApply() if (needExtraLineBreak) insertNodeBefore(nodeToInsert->cloneNode(false), nodeToInsert); - VisiblePosition endingPosition(Position(nodeToInsert.get(), 0)); + VisiblePosition endingPosition(positionBeforeNode(nodeToInsert.get())); setEndingSelection(VisibleSelection(endingPosition)); } else if (pos.deprecatedEditingOffset() <= caretMinOffset(pos.node())) { insertNodeAt(nodeToInsert.get(), pos); // Insert an extra br or '\n' if the just inserted one collapsed. - if (!isStartOfParagraph(VisiblePosition(Position(nodeToInsert.get(), 0)))) + if (!isStartOfParagraph(positionBeforeNode(nodeToInsert.get()))) insertNodeBefore(nodeToInsert->cloneNode(false).get(), nodeToInsert.get()); setEndingSelection(VisibleSelection(positionInParentAfterNode(nodeToInsert.get()), DOWNSTREAM)); @@ -141,7 +141,7 @@ void InsertLineBreakCommand::doApply() Text* textNode = static_cast<Text*>(pos.node()); splitTextNode(textNode, pos.deprecatedEditingOffset()); insertNodeBefore(nodeToInsert, textNode); - Position endingPosition = Position(textNode, 0); + Position endingPosition = firstPositionInNode(textNode); // Handle whitespace that occurs after the split updateLayout(); @@ -156,7 +156,7 @@ void InsertLineBreakCommand::doApply() else { RefPtr<Text> nbspNode = document()->createTextNode(nonBreakingSpaceString()); insertNodeAt(nbspNode.get(), positionBeforeTextNode); - endingPosition = Position(nbspNode.get(), 0); + endingPosition = firstPositionInNode(nbspNode.get()); } } diff --git a/Source/WebCore/editing/InsertListCommand.cpp b/Source/WebCore/editing/InsertListCommand.cpp index bb3cd93..9348786 100644 --- a/Source/WebCore/editing/InsertListCommand.cpp +++ b/Source/WebCore/editing/InsertListCommand.cpp @@ -217,7 +217,7 @@ void InsertListCommand::doApplyForSingleParagraph(bool forceCreateList, const Qu RefPtr<HTMLElement> newList = createHTMLElement(document(), listTag); insertNodeBefore(newList, listNode); - Node* firstChildInList = enclosingListChild(VisiblePosition(Position(listNode, 0)).deepEquivalent().node(), listNode.get()); + Node* firstChildInList = enclosingListChild(VisiblePosition(firstPositionInNode(listNode.get())).deepEquivalent().node(), listNode.get()); Node* outerBlock = firstChildInList->isBlockFlow() ? firstChildInList : listNode.get(); moveParagraphWithClones(firstPositionInNode(listNode.get()), lastPositionInNode(listNode.get()), newList.get(), outerBlock); @@ -302,7 +302,7 @@ void InsertListCommand::unlistifyParagraph(const VisiblePosition& originalStart, } else insertNodeAfter(nodeToInsert, listNode); - VisiblePosition insertionPoint = VisiblePosition(Position(placeholder.get(), 0)); + VisiblePosition insertionPoint = VisiblePosition(positionBeforeNode(placeholder.get())); moveParagraphs(start, end, insertionPoint, true); } @@ -345,7 +345,7 @@ PassRefPtr<HTMLElement> InsertListCommand::listifyParagraph(const VisiblePositio if (previousList) appendNode(listItemElement, previousList); else if (nextList) - insertNodeAt(listItemElement, Position(nextList, 0)); + insertNodeAt(listItemElement, positionBeforeNode(nextList)); else { // Create the list. listElement = createHTMLElement(document(), listTag); @@ -356,7 +356,7 @@ PassRefPtr<HTMLElement> InsertListCommand::listifyParagraph(const VisiblePositio // by a br or a '\n', will invalidate start and end. Insert // a placeholder and then recompute start and end. RefPtr<Node> placeholder = insertBlockPlaceholder(start.deepEquivalent()); - start = VisiblePosition(Position(placeholder.get(), 0)); + start = positionBeforeNode(placeholder.get()); end = start; } @@ -379,7 +379,7 @@ PassRefPtr<HTMLElement> InsertListCommand::listifyParagraph(const VisiblePositio start = startOfParagraph(originalStart); } - moveParagraph(start, end, VisiblePosition(Position(placeholder.get(), 0)), true); + moveParagraph(start, end, positionBeforeNode(placeholder.get()), true); if (listElement) return mergeWithNeighboringLists(listElement); diff --git a/Source/WebCore/editing/InsertParagraphSeparatorCommand.cpp b/Source/WebCore/editing/InsertParagraphSeparatorCommand.cpp index 1838382..1d50851 100644 --- a/Source/WebCore/editing/InsertParagraphSeparatorCommand.cpp +++ b/Source/WebCore/editing/InsertParagraphSeparatorCommand.cpp @@ -159,8 +159,8 @@ void InsertParagraphSeparatorCommand::doApply() affinity = endingSelection().affinity(); } - // FIXME: The rangeCompliantEquivalent conversion needs to be moved into enclosingBlock. - Node* startBlockNode = enclosingBlock(rangeCompliantEquivalent(insertionPosition).node()); + // FIXME: The parentAnchoredEquivalent conversion needs to be moved into enclosingBlock. + Node* startBlockNode = enclosingBlock(insertionPosition.parentAnchoredEquivalent().containerNode()); Position canonicalPos = VisiblePosition(insertionPosition).deepEquivalent(); Element* startBlock = static_cast<Element*>(startBlockNode); if (!startBlockNode @@ -242,7 +242,7 @@ void InsertParagraphSeparatorCommand::doApply() appendBlockPlaceholder(parent); - setEndingSelection(VisibleSelection(Position(parent.get(), 0), DOWNSTREAM)); + setEndingSelection(VisibleSelection(firstPositionInNode(parent.get()), DOWNSTREAM)); return; } @@ -378,7 +378,8 @@ void InsertParagraphSeparatorCommand::doApply() // Handle whitespace that occurs after the split if (splitText) { updateLayout(); - insertionPosition = Position(insertionPosition.node(), 0); + if (insertionPosition.anchorType() == Position::PositionIsOffsetInAnchor) + insertionPosition.moveToOffset(0); if (!insertionPosition.isRenderedCharacter()) { // Clear out all whitespace and insert one non-breaking space ASSERT(!insertionPosition.node()->renderer() || insertionPosition.node()->renderer()->style()->collapseWhiteSpace()); @@ -388,7 +389,7 @@ void InsertParagraphSeparatorCommand::doApply() } } - setEndingSelection(VisibleSelection(Position(blockToInsert.get(), 0), DOWNSTREAM)); + setEndingSelection(VisibleSelection(firstPositionInNode(blockToInsert.get()), DOWNSTREAM)); applyStyleAfterInsertion(startBlock); } diff --git a/Source/WebCore/editing/ReplaceSelectionCommand.cpp b/Source/WebCore/editing/ReplaceSelectionCommand.cpp index 044ce63..f47cb4e 100644 --- a/Source/WebCore/editing/ReplaceSelectionCommand.cpp +++ b/Source/WebCore/editing/ReplaceSelectionCommand.cpp @@ -62,7 +62,8 @@ enum EFragmentType { EmptyFragment, SingleTextNodeFragment, TreeFragment }; // --- ReplacementFragment helper class -class ReplacementFragment : public Noncopyable { +class ReplacementFragment { + WTF_MAKE_NONCOPYABLE(ReplacementFragment); public: ReplacementFragment(Document*, DocumentFragment*, bool matchStyle, const VisibleSelection&); @@ -568,7 +569,7 @@ static bool handleStyleSpansBeforeInsertion(ReplacementFragment& fragment, const Node* sourceDocumentStyleSpan = topNode; RefPtr<Node> copiedRangeStyleSpan = sourceDocumentStyleSpan->firstChild(); - RefPtr<EditingStyle> styleAtInsertionPos = EditingStyle::create(rangeCompliantEquivalent(insertionPos)); + RefPtr<EditingStyle> styleAtInsertionPos = EditingStyle::create(insertionPos.parentAnchoredEquivalent()); String styleText = styleAtInsertionPos->style()->cssText(); // FIXME: This string comparison is a naive way of comparing two styles. diff --git a/Source/WebCore/editing/SelectionController.cpp b/Source/WebCore/editing/SelectionController.cpp index eca0711..fa0c32d 100644 --- a/Source/WebCore/editing/SelectionController.cpp +++ b/Source/WebCore/editing/SelectionController.cpp @@ -316,32 +316,45 @@ void SelectionController::willBeModified(EAlteration alter, SelectionDirection d Position start = m_selection.start(); Position end = m_selection.end(); + bool baseIsStart = true; + if (m_isDirectional) { // Make base and extent match start and end so we extend the user-visible selection. // This only matters for cases where base and extend point to different positions than // start and end (e.g. after a double-click to select a word). - if (m_selection.isBaseFirst()) { - m_selection.setBase(start); - m_selection.setExtent(end); - } else { - m_selection.setBase(end); - m_selection.setExtent(start); - } + if (m_selection.isBaseFirst()) + baseIsStart = true; + else + baseIsStart = false; } else { - // FIXME: This is probably not correct for right and left when the direction is RTL. switch (direction) { case DirectionRight: + if (directionOfEnclosingBlock() == LTR) + baseIsStart = true; + else + baseIsStart = false; + break; case DirectionForward: - m_selection.setBase(start); - m_selection.setExtent(end); + baseIsStart = true; break; case DirectionLeft: + if (directionOfEnclosingBlock() == LTR) + baseIsStart = false; + else + baseIsStart = true; + break; case DirectionBackward: - m_selection.setBase(end); - m_selection.setExtent(start); + baseIsStart = false; break; } } + if (baseIsStart) { + m_selection.setBase(start); + m_selection.setExtent(end); + } else { + m_selection.setBase(end); + m_selection.setExtent(start); + } } TextDirection SelectionController::directionOfEnclosingBlock() @@ -458,9 +471,12 @@ VisiblePosition SelectionController::modifyMovingRight(TextGranularity granulari VisiblePosition pos; switch (granularity) { case CharacterGranularity: - if (isRange()) - pos = VisiblePosition(m_selection.end(), m_selection.affinity()); - else + if (isRange()) { + if (directionOfEnclosingBlock() == LTR) + pos = VisiblePosition(m_selection.end(), m_selection.affinity()); + else + pos = VisiblePosition(m_selection.start(), m_selection.affinity()); + } else pos = VisiblePosition(m_selection.extent(), m_selection.affinity()).right(true); break; case WordGranularity: @@ -612,7 +628,10 @@ VisiblePosition SelectionController::modifyMovingLeft(TextGranularity granularit switch (granularity) { case CharacterGranularity: if (isRange()) - pos = VisiblePosition(m_selection.start(), m_selection.affinity()); + if (directionOfEnclosingBlock() == LTR) + pos = VisiblePosition(m_selection.start(), m_selection.affinity()); + else + pos = VisiblePosition(m_selection.end(), m_selection.affinity()); else pos = VisiblePosition(m_selection.extent(), m_selection.affinity()).left(true); break; diff --git a/Source/WebCore/editing/SelectionController.h b/Source/WebCore/editing/SelectionController.h index ee52187..3f805d3 100644 --- a/Source/WebCore/editing/SelectionController.h +++ b/Source/WebCore/editing/SelectionController.h @@ -48,7 +48,8 @@ class VisiblePosition; enum DirectionalityPolicy { MakeNonDirectionalSelection, MakeDirectionalSelection }; -class SelectionController : public Noncopyable { +class SelectionController { + WTF_MAKE_NONCOPYABLE(SelectionController); WTF_MAKE_FAST_ALLOCATED; public: enum EAlteration { AlterationMove, AlterationExtend }; enum CursorAlignOnScroll { AlignCursorOnScrollIfNeeded, diff --git a/Source/WebCore/editing/SpellChecker.h b/Source/WebCore/editing/SpellChecker.h index f6215d2..81bb519 100644 --- a/Source/WebCore/editing/SpellChecker.h +++ b/Source/WebCore/editing/SpellChecker.h @@ -54,7 +54,8 @@ private: int m_length; }; -class SpellChecker : public Noncopyable { +class SpellChecker { + WTF_MAKE_NONCOPYABLE(SpellChecker); public: explicit SpellChecker(Frame*, EditorClient*); ~SpellChecker(); diff --git a/Source/WebCore/editing/TextCheckingHelper.h b/Source/WebCore/editing/TextCheckingHelper.h index 227530f..8b5c691 100644 --- a/Source/WebCore/editing/TextCheckingHelper.h +++ b/Source/WebCore/editing/TextCheckingHelper.h @@ -72,7 +72,8 @@ private: mutable int m_checkingLength; }; -class TextCheckingHelper : public Noncopyable { +class TextCheckingHelper { + WTF_MAKE_NONCOPYABLE(TextCheckingHelper); public: TextCheckingHelper(EditorClient*, PassRefPtr<Range>); ~TextCheckingHelper(); diff --git a/Source/WebCore/editing/TextIterator.cpp b/Source/WebCore/editing/TextIterator.cpp index 7e41420..1fc7606 100644 --- a/Source/WebCore/editing/TextIterator.cpp +++ b/Source/WebCore/editing/TextIterator.cpp @@ -61,7 +61,8 @@ using namespace HTMLNames; // Case folding is also done if the CaseInsensitive option is specified. // Matches are further filtered if the AtWordStarts option is specified, although some // matches inside a word are permitted if TreatMedialCapitalAsWordStart is specified as well. -class SearchBuffer : public Noncopyable { +class SearchBuffer { + WTF_MAKE_NONCOPYABLE(SearchBuffer); public: SearchBuffer(const String& target, FindOptions); ~SearchBuffer(); @@ -1128,10 +1129,10 @@ void SimplifiedBackwardsTextIterator::advance() if (!next) { // Exit empty containers as we pass over them or containers // where [container, 0] is where we started iterating. - if (!m_handledNode && - canHaveChildrenForEditing(m_node) && - m_node->parentNode() && - (!m_node->lastChild() || (m_node == m_endNode && m_endOffset == 0))) { + if (!m_handledNode + && canHaveChildrenForEditing(m_node) + && m_node->parentNode() + && (!m_node->lastChild() || (m_node == m_endNode && !m_endOffset))) { exitNode(); if (m_positionNode) { m_handledNode = true; diff --git a/Source/WebCore/editing/VisiblePosition.cpp b/Source/WebCore/editing/VisiblePosition.cpp index adfead1..5999fa6 100644 --- a/Source/WebCore/editing/VisiblePosition.cpp +++ b/Source/WebCore/editing/VisiblePosition.cpp @@ -597,8 +597,8 @@ PassRefPtr<Range> makeRange(const VisiblePosition &start, const VisiblePosition if (start.isNull() || end.isNull()) return 0; - Position s = rangeCompliantEquivalent(start); - Position e = rangeCompliantEquivalent(end); + Position s = start.deepEquivalent().parentAnchoredEquivalent(); + Position e = end.deepEquivalent().parentAnchoredEquivalent(); return Range::create(s.node()->document(), s.node(), s.deprecatedEditingOffset(), e.node(), e.deprecatedEditingOffset()); } @@ -618,7 +618,7 @@ bool setStart(Range *r, const VisiblePosition &visiblePosition) { if (!r) return false; - Position p = rangeCompliantEquivalent(visiblePosition); + Position p = visiblePosition.deepEquivalent().parentAnchoredEquivalent(); int code = 0; r->setStart(p.node(), p.deprecatedEditingOffset(), code); return code == 0; @@ -628,7 +628,7 @@ bool setEnd(Range *r, const VisiblePosition &visiblePosition) { if (!r) return false; - Position p = rangeCompliantEquivalent(visiblePosition); + Position p = visiblePosition.deepEquivalent().parentAnchoredEquivalent(); int code = 0; r->setEnd(p.node(), p.deprecatedEditingOffset(), code); return code == 0; diff --git a/Source/WebCore/editing/VisibleSelection.cpp b/Source/WebCore/editing/VisibleSelection.cpp index 4037670..035afb8 100644 --- a/Source/WebCore/editing/VisibleSelection.cpp +++ b/Source/WebCore/editing/VisibleSelection.cpp @@ -121,8 +121,8 @@ PassRefPtr<Range> VisibleSelection::firstRange() const { if (isNone()) return 0; - Position start = rangeCompliantEquivalent(m_start); - Position end = rangeCompliantEquivalent(m_end); + Position start = m_start.parentAnchoredEquivalent(); + Position end = m_end.parentAnchoredEquivalent(); return Range::create(start.node()->document(), start, end); } @@ -146,7 +146,7 @@ PassRefPtr<Range> VisibleSelection::toNormalizedRange() const // If the selection is a caret, move the range start upstream. This helps us match // the conventions of text editors tested, which make style determinations based // on the character before the caret, if any. - s = rangeCompliantEquivalent(m_start.upstream()); + s = m_start.upstream().parentAnchoredEquivalent(); e = s; } else { // If the selection is a range, select the minimum range that encompasses the selection. @@ -170,8 +170,8 @@ PassRefPtr<Range> VisibleSelection::toNormalizedRange() const s = e; e = tmp; } - s = rangeCompliantEquivalent(s); - e = rangeCompliantEquivalent(e); + s = s.parentAnchoredEquivalent(); + e = e.parentAnchoredEquivalent(); } // VisibleSelections are supposed to always be valid. This constructor will ASSERT @@ -204,7 +204,7 @@ static PassRefPtr<Range> makeSearchRange(const Position& pos) RefPtr<Range> searchRange(Range::create(d)); ExceptionCode ec = 0; - Position start(rangeCompliantEquivalent(pos)); + Position start(pos.parentAnchoredEquivalent()); searchRange->selectNodeContents(boundary, ec); searchRange->setStart(start.node(), start.deprecatedEditingOffset(), ec); diff --git a/Source/WebCore/editing/htmlediting.cpp b/Source/WebCore/editing/htmlediting.cpp index d08ac2e..90db3ef 100644 --- a/Source/WebCore/editing/htmlediting.cpp +++ b/Source/WebCore/editing/htmlediting.cpp @@ -329,60 +329,12 @@ bool isBlock(const Node* node) // knowing about these kinds of special cases. Node* enclosingBlock(Node* node) { - return static_cast<Element*>(enclosingNodeOfType(Position(node, 0), isBlock)); -} - -// Internally editing uses "invalid" positions for historical reasons. For -// example, in <div><img /></div>, Editing might use (img, 1) for the position -// after <img>, but we have to convert that to (div, 1) before handing the -// position to a Range object. Ideally all internal positions should -// be "range compliant" for simplicity. -Position rangeCompliantEquivalent(const Position& pos) -{ - if (pos.isNull()) - return Position(); - - Node* node = pos.node(); - - if (pos.deprecatedEditingOffset() <= 0) { - if (node->parentNode() && (editingIgnoresContent(node) || isTableElement(node))) - return positionInParentBeforeNode(node); - return Position(node, 0); - } - - if (node->offsetInCharacters()) - return Position(node, min(node->maxCharacterOffset(), pos.deprecatedEditingOffset())); - - int maxCompliantOffset = node->childNodeCount(); - if (pos.deprecatedEditingOffset() > maxCompliantOffset) { - if (node->parentNode()) - return positionInParentAfterNode(node); - - // there is no other option at this point than to - // use the highest allowed position in the node - return Position(node, maxCompliantOffset); - } - - // Editing should never generate positions like this. - if ((pos.deprecatedEditingOffset() < maxCompliantOffset) && editingIgnoresContent(node)) { - ASSERT_NOT_REACHED(); - return node->parentNode() ? positionInParentBeforeNode(node) : Position(node, 0); - } - - if (pos.deprecatedEditingOffset() == maxCompliantOffset && (editingIgnoresContent(node) || isTableElement(node))) - return positionInParentAfterNode(node); - - return Position(pos); -} - -Position rangeCompliantEquivalent(const VisiblePosition& vpos) -{ - return rangeCompliantEquivalent(vpos.deepEquivalent()); + return static_cast<Element*>(enclosingNodeOfType(firstPositionInOrBeforeNode(node), isBlock)); } // This method is used to create positions in the DOM. It returns the maximum valid offset // in a node. It returns 1 for some elements even though they do not have children, which -// creates technically invalid DOM Positions. Be sure to call rangeCompliantEquivalent +// creates technically invalid DOM Positions. Be sure to call parentAnchoredEquivalent // on a Position before using it to create a DOM Range, or an exception will be thrown. int lastOffsetForEditing(const Node* node) { @@ -704,7 +656,7 @@ HTMLElement* enclosingList(Node* node) if (!node) return 0; - Node* root = highestEditableRoot(Position(node, 0)); + Node* root = highestEditableRoot(firstPositionInOrBeforeNode(node)); for (ContainerNode* n = node->parentNode(); n; n = n->parentNode()) { if (n->hasTagName(ulTag) || n->hasTagName(olTag)) @@ -722,7 +674,7 @@ HTMLElement* enclosingListChild(Node *node) return 0; // Check for a list item element, or for a node whose parent is a list element. Such a node // will appear visually as a list item (but without a list marker) - Node* root = highestEditableRoot(Position(node, 0)); + Node* root = highestEditableRoot(firstPositionInOrBeforeNode(node)); // FIXME: This function is inappropriately named if it starts with node instead of node->parentNode() for (Node* n = node; n && n->parentNode(); n = n->parentNode()) { @@ -1081,7 +1033,8 @@ int indexForVisiblePosition(const VisiblePosition& visiblePosition) if (visiblePosition.isNull()) return 0; Position p(visiblePosition.deepEquivalent()); - RefPtr<Range> range = Range::create(p.node()->document(), Position(p.node()->document(), 0), rangeCompliantEquivalent(p)); + RefPtr<Range> range = Range::create(p.node()->document(), firstPositionInNode(p.anchorNode()->document()->documentElement()), + p.parentAnchoredEquivalent()); return TextIterator::rangeLength(range.get(), true); } @@ -1104,11 +1057,11 @@ bool isNodeVisiblyContainedWithin(Node* node, const Range* selectedRange) return true; bool startIsVisuallySame = visiblePositionBeforeNode(node) == selectedRange->startPosition(); - if (startIsVisuallySame && comparePositions(Position(node->parentNode(), node->nodeIndex()+1), selectedRange->endPosition()) < 0) + if (startIsVisuallySame && comparePositions(positionInParentAfterNode(node), selectedRange->endPosition()) < 0) return true; bool endIsVisuallySame = visiblePositionAfterNode(node) == selectedRange->endPosition(); - if (endIsVisuallySame && comparePositions(selectedRange->startPosition(), Position(node->parentNode(), node->nodeIndex())) < 0) + if (endIsVisuallySame && comparePositions(selectedRange->startPosition(), positionInParentBeforeNode(node)) < 0) return true; return startIsVisuallySame && endIsVisuallySame; @@ -1157,23 +1110,23 @@ VisibleSelection avoidIntersectionWithNode(const VisibleSelection& selection, No { if (selection.isNone()) return VisibleSelection(selection); - + VisibleSelection updatedSelection(selection); Node* base = selection.base().node(); Node* extent = selection.extent().node(); ASSERT(base); ASSERT(extent); - + if (base == node || base->isDescendantOf(node)) { ASSERT(node->parentNode()); - updatedSelection.setBase(Position(node->parentNode(), node->nodeIndex())); + updatedSelection.setBase(positionInParentBeforeNode(node)); } - + if (extent == node || extent->isDescendantOf(node)) { ASSERT(node->parentNode()); - updatedSelection.setExtent(Position(node->parentNode(), node->nodeIndex())); + updatedSelection.setExtent(positionInParentBeforeNode(node)); } - + return updatedSelection; } diff --git a/Source/WebCore/editing/htmlediting.h b/Source/WebCore/editing/htmlediting.h index 1f6b986..0208dfb 100644 --- a/Source/WebCore/editing/htmlediting.h +++ b/Source/WebCore/editing/htmlediting.h @@ -101,9 +101,6 @@ bool isNodeInTextFormControl(Node* node); // Functions returning Position -Position rangeCompliantEquivalent(const Position&); -Position rangeCompliantEquivalent(const VisiblePosition&); - Position nextCandidate(const Position&); Position previousCandidate(const Position&); diff --git a/Source/WebCore/editing/visible_units.cpp b/Source/WebCore/editing/visible_units.cpp index 7bb1515..3582aa9 100644 --- a/Source/WebCore/editing/visible_units.cpp +++ b/Source/WebCore/editing/visible_units.cpp @@ -57,8 +57,8 @@ static VisiblePosition previousBoundary(const VisiblePosition& c, BoundarySearch return VisiblePosition(); Document* d = boundary->document(); - Position start = rangeCompliantEquivalent(Position(boundary, 0)); - Position end = rangeCompliantEquivalent(pos); + Position start = Position(boundary, 0).parentAnchoredEquivalent(); + Position end = pos.parentAnchoredEquivalent(); RefPtr<Range> searchRange = Range::create(d); Vector<UChar, 1024> string; @@ -115,22 +115,18 @@ static VisiblePosition previousBoundary(const VisiblePosition& c, BoundarySearch ASSERT(!needMoreContext); } - if (it.atEnd() && next == 0) { - pos = it.range()->startPosition(); - } else if (next != 0) { - Node *node = it.range()->startContainer(ec); - if ((node->isTextNode() && static_cast<int>(next) <= node->maxCharacterOffset()) || (node->renderer() && node->renderer()->isBR() && !next)) - // The next variable contains a usable index into a text node - pos = Position(node, next); - else { - // Use the character iterator to translate the next value into a DOM position. - BackwardsCharacterIterator charIt(searchRange.get(), TextIteratorEndsAtEditingBoundary); - charIt.advance(string.size() - suffixLength - next); - pos = charIt.range()->endPosition(); - } - } + if (!next) + return VisiblePosition(it.atEnd() ? it.range()->startPosition() : pos, DOWNSTREAM); + + Node* node = it.range()->startContainer(ec); + if ((node->isTextNode() && static_cast<int>(next) <= node->maxCharacterOffset()) || (node->renderer() && node->renderer()->isBR() && !next)) + // The next variable contains a usable index into a text node + return VisiblePosition(Position(node, next), DOWNSTREAM); - return VisiblePosition(pos, DOWNSTREAM); + // Use the character iterator to translate the next value into a DOM position. + BackwardsCharacterIterator charIt(searchRange.get(), TextIteratorEndsAtEditingBoundary); + charIt.advance(string.size() - suffixLength - next); + return VisiblePosition(charIt.range()->endPosition(), DOWNSTREAM); } static VisiblePosition nextBoundary(const VisiblePosition& c, BoundarySearchFunction searchFunction) @@ -142,7 +138,7 @@ static VisiblePosition nextBoundary(const VisiblePosition& c, BoundarySearchFunc Document* d = boundary->document(); RefPtr<Range> searchRange(d->createRange()); - Position start(rangeCompliantEquivalent(pos)); + Position start(pos.parentAnchoredEquivalent()); Vector<UChar, 1024> string; unsigned prefixLength = 0; diff --git a/Source/WebCore/fileapi/FileThread.h b/Source/WebCore/fileapi/FileThread.h index d7aabf7..45205c4 100644 --- a/Source/WebCore/fileapi/FileThread.h +++ b/Source/WebCore/fileapi/FileThread.h @@ -54,7 +54,8 @@ public: bool start(); void stop(); - class Task : public Noncopyable { + class Task { + WTF_MAKE_NONCOPYABLE(Task); public: virtual ~Task() { } virtual void performTask() = 0; diff --git a/Source/WebCore/fileapi/LocalFileSystem.h b/Source/WebCore/fileapi/LocalFileSystem.h index b779a5f..12a7012 100644 --- a/Source/WebCore/fileapi/LocalFileSystem.h +++ b/Source/WebCore/fileapi/LocalFileSystem.h @@ -45,7 +45,8 @@ class FileSystemCallback; class ScriptExecutionContext; // Keeps per-process information and provides an entry point to open a file system. -class LocalFileSystem : public Noncopyable { +class LocalFileSystem { + WTF_MAKE_NONCOPYABLE(LocalFileSystem); public: // Returns a per-process instance of LocalFileSystem. // Note that LocalFileSystem::initializeLocalFileSystem must be called before diff --git a/Source/WebCore/fileapi/SyncCallbackHelper.h b/Source/WebCore/fileapi/SyncCallbackHelper.h index 25e6739..020ac49 100644 --- a/Source/WebCore/fileapi/SyncCallbackHelper.h +++ b/Source/WebCore/fileapi/SyncCallbackHelper.h @@ -58,7 +58,8 @@ class FileEntrySync; // A helper template for FileSystemSync implementation. template <typename SuccessCallback, typename ObserverType, typename CallbackArg, typename ResultType> -class SyncCallbackHelper : public Noncopyable { +class SyncCallbackHelper { + WTF_MAKE_NONCOPYABLE(SyncCallbackHelper); public: typedef SyncCallbackHelper<SuccessCallback, ObserverType, CallbackArg, ResultType> HelperType; SyncCallbackHelper(ObserverType* observer = 0) diff --git a/Source/WebCore/history/BackForwardController.h b/Source/WebCore/history/BackForwardController.h index e89e32b..12884ea 100644 --- a/Source/WebCore/history/BackForwardController.h +++ b/Source/WebCore/history/BackForwardController.h @@ -36,7 +36,8 @@ class BackForwardList; class HistoryItem; class Page; -class BackForwardController : public Noncopyable { +class BackForwardController { + WTF_MAKE_NONCOPYABLE(BackForwardController); WTF_MAKE_FAST_ALLOCATED; public: BackForwardController(Page*, PassRefPtr<BackForwardList>); ~BackForwardController(); diff --git a/Source/WebCore/history/CachedFrame.cpp b/Source/WebCore/history/CachedFrame.cpp index d21f958..ab6b4d6 100644 --- a/Source/WebCore/history/CachedFrame.cpp +++ b/Source/WebCore/history/CachedFrame.cpp @@ -30,6 +30,7 @@ #include "DocumentLoader.h" #include "ExceptionCode.h" #include "EventNames.h" +#include "FocusController.h" #include "Frame.h" #include "FrameLoaderClient.h" #include "FrameView.h" @@ -131,6 +132,9 @@ CachedFrame::CachedFrame(Frame* frame) ASSERT(m_documentLoader); ASSERT(m_view); + if (frame->page()->focusController()->focusedFrame() == frame) + frame->page()->focusController()->setFocusedFrame(frame->page()->mainFrame()); + // Active DOM objects must be suspended before we cached the frame script data m_document->suspendActiveDOMObjects(ActiveDOMObject::DocumentWillBecomeInactive); m_cachedFrameScriptData = adoptPtr(new ScriptCachedFrameData(frame)); diff --git a/Source/WebCore/history/HistoryItem.cpp b/Source/WebCore/history/HistoryItem.cpp index f9e6c96..805d5aa 100644 --- a/Source/WebCore/history/HistoryItem.cpp +++ b/Source/WebCore/history/HistoryItem.cpp @@ -65,6 +65,8 @@ HistoryItem::HistoryItem() , m_visitCount(0) , m_itemSequenceNumber(generateSequenceNumber()) , m_documentSequenceNumber(generateSequenceNumber()) + , m_next(0) + , m_prev(0) { } @@ -80,6 +82,8 @@ HistoryItem::HistoryItem(const String& urlString, const String& title, double ti , m_visitCount(0) , m_itemSequenceNumber(generateSequenceNumber()) , m_documentSequenceNumber(generateSequenceNumber()) + , m_next(0) + , m_prev(0) { iconDatabase()->retainIconForPageURL(m_urlString); } @@ -97,6 +101,8 @@ HistoryItem::HistoryItem(const String& urlString, const String& title, const Str , m_visitCount(0) , m_itemSequenceNumber(generateSequenceNumber()) , m_documentSequenceNumber(generateSequenceNumber()) + , m_next(0) + , m_prev(0) { iconDatabase()->retainIconForPageURL(m_urlString); } @@ -115,6 +121,8 @@ HistoryItem::HistoryItem(const KURL& url, const String& target, const String& pa , m_visitCount(0) , m_itemSequenceNumber(generateSequenceNumber()) , m_documentSequenceNumber(generateSequenceNumber()) + , m_next(0) + , m_prev(0) { iconDatabase()->retainIconForPageURL(m_urlString); } @@ -168,6 +176,38 @@ PassRefPtr<HistoryItem> HistoryItem::copy() const return adoptRef(new HistoryItem(*this)); } +void HistoryItem::reset() +{ + iconDatabase()->releaseIconForPageURL(m_urlString); + + m_urlString = String(); + m_originalURLString = String(); + m_referrer = String(); + m_target = String(); + m_parent = String(); + m_title = String(); + m_displayTitle = String(); + + m_lastVisitedTime = 0; + m_lastVisitWasHTTPNonGet = false; + + m_lastVisitWasFailure = false; + m_isTargetItem = false; + m_visitCount = 0; + m_dailyVisitCounts.clear(); + m_weeklyVisitCounts.clear(); + + m_redirectURLs.clear(); + + m_itemSequenceNumber = generateSequenceNumber(); + + m_stateObject = 0; + m_documentSequenceNumber = generateSequenceNumber(); + + m_formData = 0; + m_formContentType = String(); +} + const String& HistoryItem::urlString() const { return m_urlString; diff --git a/Source/WebCore/history/HistoryItem.h b/Source/WebCore/history/HistoryItem.h index a4622c0..526cae2 100644 --- a/Source/WebCore/history/HistoryItem.h +++ b/Source/WebCore/history/HistoryItem.h @@ -88,6 +88,9 @@ public: PassRefPtr<HistoryItem> copy() const; + // Resets the HistoryItem to its initial state, as returned by create(). + void reset(); + void encodeBackForwardTree(Encoder&) const; static PassRefPtr<HistoryItem> decodeBackForwardTree(const String& urlString, const String& title, const String& originalURLString, Decoder&); @@ -148,7 +151,7 @@ public: void setDocumentSequenceNumber(long long number) { m_documentSequenceNumber = number; } long long documentSequenceNumber() const { return m_documentSequenceNumber; } - + void setFormInfoFromRequest(const ResourceRequest&); void setFormData(PassRefPtr<FormData>); void setFormContentType(const String&); @@ -262,11 +265,19 @@ private: OwnPtr<Vector<String> > m_redirectURLs; + // If two HistoryItems have the same item sequence number, then they are + // clones of one another. Traversing history from one such HistoryItem to + // another is a no-op. HistoryItem clones are created for parent and + // sibling frames when only a subframe navigates. int64_t m_itemSequenceNumber; + // If two HistoryItems have the same document sequence number, then they + // refer to the same instance of a document. Traversing history from one + // such HistoryItem to another preserves the document. + int64_t m_documentSequenceNumber; + // Support for HTML5 History RefPtr<SerializedScriptValue> m_stateObject; - int64_t m_documentSequenceNumber; // info used to repost form data RefPtr<FormData> m_formData; diff --git a/Source/WebCore/history/PageCache.h b/Source/WebCore/history/PageCache.h index 71ae5ad..912bd65 100644 --- a/Source/WebCore/history/PageCache.h +++ b/Source/WebCore/history/PageCache.h @@ -39,7 +39,8 @@ namespace WebCore { class HistoryItem; class Page; - class PageCache : public Noncopyable { + class PageCache { + WTF_MAKE_NONCOPYABLE(PageCache); WTF_MAKE_FAST_ALLOCATED; public: friend PageCache* pageCache(); diff --git a/Source/WebCore/html/CollectionCache.h b/Source/WebCore/html/CollectionCache.h index df1d1fa..8e4a066 100644 --- a/Source/WebCore/html/CollectionCache.h +++ b/Source/WebCore/html/CollectionCache.h @@ -29,7 +29,9 @@ namespace WebCore { class Element; -struct CollectionCache : FastAllocBase { +struct CollectionCache { + WTF_MAKE_FAST_ALLOCATED; +public: CollectionCache(); CollectionCache(const CollectionCache&); CollectionCache& operator=(const CollectionCache& other) diff --git a/Source/WebCore/html/DOMSettableTokenList.h b/Source/WebCore/html/DOMSettableTokenList.h index 2b711b4..8f6fd4e 100644 --- a/Source/WebCore/html/DOMSettableTokenList.h +++ b/Source/WebCore/html/DOMSettableTokenList.h @@ -35,6 +35,7 @@ namespace WebCore { class DOMSettableTokenList : public DOMTokenList, public RefCounted<DOMSettableTokenList> { + WTF_MAKE_FAST_ALLOCATED; public: static PassRefPtr<DOMSettableTokenList> create() { diff --git a/Source/WebCore/html/DOMTokenList.h b/Source/WebCore/html/DOMTokenList.h index 5df2ede..0b75b66 100644 --- a/Source/WebCore/html/DOMTokenList.h +++ b/Source/WebCore/html/DOMTokenList.h @@ -27,15 +27,16 @@ #include "ExceptionCode.h" #include <wtf/text/AtomicString.h> -#include <wtf/Noncopyable.h> #include <wtf/Vector.h> namespace WebCore { class Element; -class DOMTokenList : public Noncopyable { +class DOMTokenList { + WTF_MAKE_NONCOPYABLE(DOMTokenList); WTF_MAKE_FAST_ALLOCATED; public: + DOMTokenList() { } virtual ~DOMTokenList() {}; virtual void ref() = 0; diff --git a/Source/WebCore/html/FormAssociatedElement.h b/Source/WebCore/html/FormAssociatedElement.h index 873bdf4..ebefdc6 100644 --- a/Source/WebCore/html/FormAssociatedElement.h +++ b/Source/WebCore/html/FormAssociatedElement.h @@ -46,6 +46,7 @@ public: virtual bool isFormControlElement() const = 0; virtual bool isEnumeratable() const = 0; + virtual bool isResettable() const = 0; const AtomicString& name() const { return formControlName(); } diff --git a/Source/WebCore/html/HTMLAreaElement.cpp b/Source/WebCore/html/HTMLAreaElement.cpp index dc87ef6..ac4c865 100644 --- a/Source/WebCore/html/HTMLAreaElement.cpp +++ b/Source/WebCore/html/HTMLAreaElement.cpp @@ -22,6 +22,7 @@ #include "config.h" #include "HTMLAreaElement.h" +#include "AffineTransform.h" #include "Attribute.h" #include "Frame.h" #include "HTMLImageElement.h" diff --git a/Source/WebCore/html/HTMLAttributeNames.in b/Source/WebCore/html/HTMLAttributeNames.in index 513e44f..eac9a73 100644 --- a/Source/WebCore/html/HTMLAttributeNames.in +++ b/Source/WebCore/html/HTMLAttributeNames.in @@ -177,6 +177,8 @@ onerror onfocus onfocusin onfocusout +onformchange +onforminput onhashchange oninput oninvalid diff --git a/Source/WebCore/html/HTMLCanvasElement.cpp b/Source/WebCore/html/HTMLCanvasElement.cpp index f286749..0fdb7b2 100644 --- a/Source/WebCore/html/HTMLCanvasElement.cpp +++ b/Source/WebCore/html/HTMLCanvasElement.cpp @@ -406,6 +406,11 @@ void HTMLCanvasElement::createImageBuffer() const m_imageBuffer->context()->scale(FloatSize(size.width() / unscaledSize.width(), size.height() / unscaledSize.height())); m_imageBuffer->context()->setShadowsIgnoreTransforms(true); m_imageBuffer->context()->setImageInterpolationQuality(DefaultInterpolationQuality); + +#if USE(JSC) + if (hasCachedDOMNodeWrapperUnchecked(document(), const_cast<HTMLCanvasElement*>(this))) + scriptExecutionContext()->globalData()->heap.reportExtraMemoryCost(m_imageBuffer->dataSize()); +#endif } GraphicsContext* HTMLCanvasElement::drawingContext() const @@ -446,8 +451,7 @@ AffineTransform HTMLCanvasElement::baseTransform() const AffineTransform transform; if (size.width() && size.height()) transform.scaleNonUniform(size.width() / unscaledSize.width(), size.height() / unscaledSize.height()); - transform.multiply(m_imageBuffer->baseTransform()); - return transform; + return m_imageBuffer->baseTransform() * transform; } } diff --git a/Source/WebCore/html/HTMLElement.cpp b/Source/WebCore/html/HTMLElement.cpp index af3115c..b7eca06 100644 --- a/Source/WebCore/html/HTMLElement.cpp +++ b/Source/WebCore/html/HTMLElement.cpp @@ -190,6 +190,10 @@ void HTMLElement::parseMappedAttribute(Attribute* attr) setAttributeEventListener(eventNames().focusinEvent, createAttributeEventListener(this, attr)); } else if (attr->name() == onfocusoutAttr) { setAttributeEventListener(eventNames().focusoutEvent, createAttributeEventListener(this, attr)); + } else if (attr->name() == onformchangeAttr) { + setAttributeEventListener(eventNames().formchangeEvent, createAttributeEventListener(this, attr)); + } else if (attr->name() == onforminputAttr) { + setAttributeEventListener(eventNames().forminputEvent, createAttributeEventListener(this, attr)); } else if (attr->name() == onblurAttr) { setAttributeEventListener(eventNames().blurEvent, createAttributeEventListener(this, attr)); } else if (attr->name() == onkeydownAttr) { @@ -685,19 +689,18 @@ bool HTMLElement::isContentRichlyEditable() const String HTMLElement::contentEditable() const { - if (!renderer()) - return "false"; - - switch (renderer()->style()->userModify()) { - case READ_WRITE: - return "true"; - case READ_ONLY: - return "false"; - case READ_WRITE_PLAINTEXT_ONLY: - return "plaintext-only"; - default: - return "inherit"; - } + const AtomicString& value = fastGetAttribute(contenteditableAttr); + + if (value.isNull()) + return "inherit"; + if (value.isEmpty() || equalIgnoringCase(value, "true")) + return "true"; + if (equalIgnoringCase(value, "false")) + return "false"; + if (equalIgnoringCase(value, "plaintext-only")) + return "plaintext-only"; + + return "inherit"; } void HTMLElement::setContentEditable(Attribute* attr) @@ -726,14 +729,16 @@ void HTMLElement::setContentEditable(Attribute* attr) } } -void HTMLElement::setContentEditable(const String &enabled) +void HTMLElement::setContentEditable(const String& enabled, ExceptionCode& ec) { - if (enabled == "inherit") { - ExceptionCode ec; + if (equalIgnoringCase(enabled, "true")) + setAttribute(contenteditableAttr, "true", ec); + else if (equalIgnoringCase(enabled, "false")) + setAttribute(contenteditableAttr, "false", ec); + else if (equalIgnoringCase(enabled, "inherit")) removeAttribute(contenteditableAttr, ec); - } else - setAttribute(contenteditableAttr, enabled.isEmpty() ? "true" : enabled); + ec = SYNTAX_ERR; } bool HTMLElement::draggable() const @@ -837,6 +842,40 @@ HTMLFormElement* HTMLElement::virtualForm() const return findFormAncestor(); } +HTMLFormElement* HTMLElement::shadowAncestorOwnerForm() +{ + Node* ancestorNode = shadowAncestorNode(); + if (!ancestorNode) + return form(); + + if (!ancestorNode->isHTMLElement()) + return 0; + HTMLElement* ancestorHTML = static_cast<HTMLElement*>(ancestorNode); + if (!ancestorHTML) + return 0; + return ancestorHTML->form(); +} + +void HTMLElement::dispatchChangeEvents() +{ + RefPtr<HTMLElement> protector(this); + RefPtr<HTMLFormElement> ownerForm(shadowAncestorOwnerForm()); + + Node::dispatchChangeEvents(); + if (ownerForm) + ownerForm->dispatchFormChange(); +} + +void HTMLElement::dispatchInputEvents() +{ + RefPtr<HTMLElement> protector(this); + RefPtr<HTMLFormElement> ownerForm(shadowAncestorOwnerForm()); + + Node::dispatchInputEvents(); + if (ownerForm) + ownerForm->dispatchFormInput(); +} + } // namespace WebCore #ifndef NDEBUG diff --git a/Source/WebCore/html/HTMLElement.h b/Source/WebCore/html/HTMLElement.h index a64db2c..ad84f5d 100644 --- a/Source/WebCore/html/HTMLElement.h +++ b/Source/WebCore/html/HTMLElement.h @@ -61,7 +61,7 @@ public: virtual bool isContentRichlyEditable() const; String contentEditable() const; - void setContentEditable(const String&); + void setContentEditable(const String&, ExceptionCode&); virtual bool draggable() const; void setDraggable(bool); @@ -84,6 +84,9 @@ public: HTMLFormElement* findFormAncestor() const; + virtual void dispatchChangeEvents(); + virtual void dispatchInputEvents(); + protected: HTMLElement(const QualifiedName& tagName, Document*); @@ -101,6 +104,8 @@ private: Node* insertAdjacent(const String& where, Node* newChild, ExceptionCode&); PassRefPtr<DocumentFragment> textToFragment(const String&, ExceptionCode&); + + HTMLFormElement* shadowAncestorOwnerForm(); }; inline HTMLElement::HTMLElement(const QualifiedName& tagName, Document* document) diff --git a/Source/WebCore/html/HTMLElement.idl b/Source/WebCore/html/HTMLElement.idl index 77423fc..cd400c4 100644 --- a/Source/WebCore/html/HTMLElement.idl +++ b/Source/WebCore/html/HTMLElement.idl @@ -59,7 +59,8 @@ module html { readonly attribute HTMLCollection children; - attribute [ConvertNullToNullString] DOMString contentEditable; + attribute [ConvertNullToNullString] DOMString contentEditable + setter raises(DOMException); readonly attribute boolean isContentEditable; attribute boolean spellcheck; diff --git a/Source/WebCore/html/HTMLFormControlElement.cpp b/Source/WebCore/html/HTMLFormControlElement.cpp index b3ad7c8..bb42dfd 100644 --- a/Source/WebCore/html/HTMLFormControlElement.cpp +++ b/Source/WebCore/html/HTMLFormControlElement.cpp @@ -178,7 +178,12 @@ void HTMLFormControlElement::setName(const AtomicString& value) void HTMLFormControlElement::dispatchFormControlChangeEvent() { - dispatchEvent(Event::create(eventNames().changeEvent, true, false)); + HTMLElement::dispatchChangeEvents(); +} + +void HTMLFormControlElement::dispatchFormControlInputEvent() +{ + HTMLElement::dispatchInputEvents(); } void HTMLFormControlElement::setDisabled(bool b) diff --git a/Source/WebCore/html/HTMLFormControlElement.h b/Source/WebCore/html/HTMLFormControlElement.h index 8403b84..c88905c 100644 --- a/Source/WebCore/html/HTMLFormControlElement.h +++ b/Source/WebCore/html/HTMLFormControlElement.h @@ -53,12 +53,14 @@ public: virtual void setFormControlValueMatchesRenderer(bool b) { m_valueMatchesRenderer = b; } virtual void dispatchFormControlChangeEvent(); + virtual void dispatchFormControlInputEvent(); virtual bool disabled() const { return m_disabled; } void setDisabled(bool); virtual bool isFocusable() const; virtual bool isEnumeratable() const { return false; } + virtual bool isResettable() const { return false; } // Determines whether or not a control will be automatically focused. virtual bool autofocus() const; diff --git a/Source/WebCore/html/HTMLFormElement.cpp b/Source/WebCore/html/HTMLFormElement.cpp index c896bbf..d778601 100644 --- a/Source/WebCore/html/HTMLFormElement.cpp +++ b/Source/WebCore/html/HTMLFormElement.cpp @@ -590,6 +590,39 @@ bool HTMLFormElement::checkValidity() return controls.isEmpty(); } +void HTMLFormElement::broadcastFormEvent(const AtomicString& eventName) +{ + RefPtr<HTMLFormElement> protector(this); + // Copy m_associatedElements because event handlers called from + // formElement->dispatchEvent() might change m_associatedElements. + Vector<RefPtr<FormAssociatedElement> > elements; + elements.reserveCapacity(m_associatedElements.size()); + for (unsigned i = 0; i < m_associatedElements.size(); ++i) { + if (!m_associatedElements[i]->isResettable()) + continue; + elements.append(m_associatedElements[i]); + } + + for (unsigned i = 0; i < elements.size(); ++i) { + // We can assume a resettable control is always a HTMLFormControlElement. + // FIXME: We should handle resettable non-HTMLFormControlElements maybe in the future. + ASSERT(elements[i]->isFormControlElement()); + HTMLFormControlElement* formElement = static_cast<HTMLFormControlElement*>(elements[i].get()); + if (!formElement->dispatchEvent(Event::create(eventName, false, false))) + continue; + } +} + +void HTMLFormElement::dispatchFormInput() +{ + broadcastFormEvent(eventNames().forminputEvent); +} + +void HTMLFormElement::dispatchFormChange() +{ + broadcastFormEvent(eventNames().formchangeEvent); +} + void HTMLFormElement::collectUnhandledInvalidControls(Vector<RefPtr<FormAssociatedElement> >& unhandledInvalidControls) { RefPtr<HTMLFormElement> protector(this); diff --git a/Source/WebCore/html/HTMLFormElement.h b/Source/WebCore/html/HTMLFormElement.h index bd087b8..7d7f4f8 100644 --- a/Source/WebCore/html/HTMLFormElement.h +++ b/Source/WebCore/html/HTMLFormElement.h @@ -114,6 +114,9 @@ public: const Vector<FormAssociatedElement*>& associatedElements() const { return m_associatedElements; } + void dispatchFormInput(); + void dispatchFormChange(); + private: HTMLFormElement(const QualifiedName&, Document*); @@ -144,6 +147,8 @@ private: // event was not canceled to the specified vector. void collectUnhandledInvalidControls(Vector<RefPtr<FormAssociatedElement> >&); + void broadcastFormEvent(const AtomicString&); + friend class HTMLFormCollection; typedef HashMap<RefPtr<AtomicStringImpl>, RefPtr<HTMLFormControlElement> > AliasMap; diff --git a/Source/WebCore/html/HTMLFormElement.idl b/Source/WebCore/html/HTMLFormElement.idl index e9759e2..3e9e46d 100644 --- a/Source/WebCore/html/HTMLFormElement.idl +++ b/Source/WebCore/html/HTMLFormElement.idl @@ -43,6 +43,9 @@ module html { #endif void reset(); boolean checkValidity(); + + void dispatchFormInput(); + void dispatchFormChange(); }; } diff --git a/Source/WebCore/html/HTMLInputElement.cpp b/Source/WebCore/html/HTMLInputElement.cpp index c7a1a86..637e831 100644 --- a/Source/WebCore/html/HTMLInputElement.cpp +++ b/Source/WebCore/html/HTMLInputElement.cpp @@ -1048,6 +1048,12 @@ void HTMLInputElement::defaultEventHandler(Event* evt) return; } + if (evt->isMouseEvent() && evt->type() == eventNames().mousedownEvent) { + m_inputType->handleMouseDownEvent(static_cast<MouseEvent*>(evt)); + if (evt->defaultHandled()) + return; + } + m_inputType->forwardEvent(evt); if (!callBaseClassEarly && !evt->defaultHandled()) @@ -1391,7 +1397,7 @@ void HTMLInputElement::stepUpFromRenderer(int n) if (m_inputType->isRangeControl()) dispatchFormControlChangeEvent(); else - dispatchEvent(Event::create(eventNames().inputEvent, true, false)); + dispatchFormControlInputEvent(); } } diff --git a/Source/WebCore/html/HTMLInputElement.h b/Source/WebCore/html/HTMLInputElement.h index eb30de0..403248c 100644 --- a/Source/WebCore/html/HTMLInputElement.h +++ b/Source/WebCore/html/HTMLInputElement.h @@ -211,6 +211,7 @@ private: virtual bool isKeyboardFocusable(KeyboardEvent*) const; virtual bool isMouseFocusable() const; virtual bool isEnumeratable() const; + virtual bool isResettable() const { return true; } virtual void updateFocusAppearance(bool restorePreviousSelection); virtual void aboutToUnload(); virtual bool shouldUseInputMethod() const; diff --git a/Source/WebCore/html/HTMLKeygenElement.h b/Source/WebCore/html/HTMLKeygenElement.h index 80f94b5..3dc4ad2 100644 --- a/Source/WebCore/html/HTMLKeygenElement.h +++ b/Source/WebCore/html/HTMLKeygenElement.h @@ -32,14 +32,16 @@ class HTMLKeygenElement : public HTMLSelectElement { public: static PassRefPtr<HTMLKeygenElement> create(const QualifiedName&, Document*, HTMLFormElement*); + virtual bool willValidate() const { return false; } + private: HTMLKeygenElement(const QualifiedName&, Document*, HTMLFormElement*); + virtual bool isResettable() const { return true; } + virtual const AtomicString& formControlType() const; virtual void parseMappedAttribute(Attribute*); virtual bool appendFormData(FormDataList&, bool); - - virtual bool willValidate() const { return false; } virtual bool isOptionalFormControl() const { return false; } AtomicString m_challenge; diff --git a/Source/WebCore/html/HTMLKeygenElement.idl b/Source/WebCore/html/HTMLKeygenElement.idl new file mode 100644 index 0000000..c34a925 --- /dev/null +++ b/Source/WebCore/html/HTMLKeygenElement.idl @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2011 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. + */ + +module html { + + interface HTMLKeygenElement : HTMLElement { + attribute [Reflect] boolean autofocus; + attribute [Reflect] DOMString challenge; + attribute [Reflect] boolean disabled; + readonly attribute HTMLFormElement form; + attribute [Reflect] DOMString keytype; + attribute DOMString name; + + readonly attribute DOMString type; + + readonly attribute boolean willValidate; + readonly attribute ValidityState validity; + readonly attribute DOMString validationMessage; + boolean checkValidity(); + void setCustomValidity(in [ConvertUndefinedOrNullToNullString] DOMString error); + + readonly attribute NodeList labels; + }; + +} diff --git a/Source/WebCore/html/HTMLMediaElement.cpp b/Source/WebCore/html/HTMLMediaElement.cpp index 43d53f5..be478b3 100644 --- a/Source/WebCore/html/HTMLMediaElement.cpp +++ b/Source/WebCore/html/HTMLMediaElement.cpp @@ -544,6 +544,7 @@ void HTMLMediaElement::prepareForLoad() refreshCachedTime(); m_paused = true; m_seeking = false; + invalidateCachedTime(); scheduleEvent(eventNames().emptiedEvent); } @@ -1001,6 +1002,7 @@ void HTMLMediaElement::setReadyState(MediaPlayer::ReadyState state) if (m_autoplaying && m_paused && autoplay()) { m_paused = false; + invalidateCachedTime(); scheduleEvent(eventNames().playEvent); scheduleEvent(eventNames().playingEvent); } @@ -1310,6 +1312,7 @@ void HTMLMediaElement::setPlaybackRate(float rate) if (m_playbackRate != rate) { m_playbackRate = rate; + invalidateCachedTime(); scheduleEvent(eventNames().ratechangeEvent); } if (m_player && potentiallyPlaying() && m_player->rate() != rate) @@ -1414,6 +1417,7 @@ void HTMLMediaElement::playInternal() if (m_paused) { m_paused = false; + invalidateCachedTime(); scheduleEvent(eventNames().playEvent); if (m_readyState <= HAVE_CURRENT_DATA) @@ -1901,6 +1905,7 @@ void HTMLMediaElement::mediaPlayerRateChanged(MediaPlayer*) // Stash the rate in case the one we tried to set isn't what the engine is // using (eg. it can't handle the rate we set) m_playbackRate = m_player->rate(); + invalidateCachedTime(); endProcessingMediaPlayerCallback(); } diff --git a/Source/WebCore/html/HTMLObjectElement.h b/Source/WebCore/html/HTMLObjectElement.h index ff773f1..cc8a03c 100644 --- a/Source/WebCore/html/HTMLObjectElement.h +++ b/Source/WebCore/html/HTMLObjectElement.h @@ -50,6 +50,7 @@ public: virtual bool isFormControlElement() const { return false; } virtual bool isEnumeratable() const { return true; } + virtual bool isResettable() const { return false; } virtual bool appendFormData(FormDataList&, bool); // Implementations of constraint validation API. diff --git a/Source/WebCore/html/HTMLOutputElement.h b/Source/WebCore/html/HTMLOutputElement.h index 83ecee2..4c5c684 100644 --- a/Source/WebCore/html/HTMLOutputElement.h +++ b/Source/WebCore/html/HTMLOutputElement.h @@ -56,6 +56,7 @@ private: virtual void parseMappedAttribute(Attribute*); virtual const AtomicString& formControlType() const; virtual bool isEnumeratable() const { return true; } + virtual bool isResettable() const { return true; } virtual void childrenChanged(bool createdByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0); virtual void reset(); diff --git a/Source/WebCore/html/HTMLParserQuirks.h b/Source/WebCore/html/HTMLParserQuirks.h index 50de710..3bf22a4 100644 --- a/Source/WebCore/html/HTMLParserQuirks.h +++ b/Source/WebCore/html/HTMLParserQuirks.h @@ -27,13 +27,13 @@ #define HTMLParserQuirks_h #include <wtf/Forward.h> -#include <wtf/Noncopyable.h> namespace WebCore { class Node; -class HTMLParserQuirks : public Noncopyable { +class HTMLParserQuirks { + WTF_MAKE_NONCOPYABLE(HTMLParserQuirks); public: HTMLParserQuirks() { } virtual ~HTMLParserQuirks() { } diff --git a/Source/WebCore/html/HTMLSelectElement.h b/Source/WebCore/html/HTMLSelectElement.h index a22df02..42e8963 100644 --- a/Source/WebCore/html/HTMLSelectElement.h +++ b/Source/WebCore/html/HTMLSelectElement.h @@ -107,6 +107,7 @@ private: virtual bool canStartSelection() const { return false; } virtual bool isEnumeratable() const { return true; } + virtual bool isResettable() const { return true; } virtual bool saveFormControlState(String& value) const; virtual void restoreFormControlState(const String&); diff --git a/Source/WebCore/html/HTMLTagNames.in b/Source/WebCore/html/HTMLTagNames.in index 4153f5c..f5ff077 100644 --- a/Source/WebCore/html/HTMLTagNames.in +++ b/Source/WebCore/html/HTMLTagNames.in @@ -71,7 +71,7 @@ input constructorNeedsFormElement ins interfaceName=HTMLModElement isindex interfaceName=HTMLIsIndexElement, constructorNeedsFormElement kbd interfaceName=HTMLElement -keygen JSInterfaceName=HTMLSelectElement, constructorNeedsFormElement +keygen constructorNeedsFormElement label layer interfaceName=HTMLElement legend constructorNeedsFormElement diff --git a/Source/WebCore/html/HTMLTextAreaElement.h b/Source/WebCore/html/HTMLTextAreaElement.h index 669fcd8..21b5880 100644 --- a/Source/WebCore/html/HTMLTextAreaElement.h +++ b/Source/WebCore/html/HTMLTextAreaElement.h @@ -80,6 +80,7 @@ private: virtual void defaultEventHandler(Event*); virtual bool isEnumeratable() const { return true; } + virtual bool isResettable() const { return true; } virtual const AtomicString& formControlType() const; diff --git a/Source/WebCore/html/InputType.cpp b/Source/WebCore/html/InputType.cpp index 729f204..2f8d414 100644 --- a/Source/WebCore/html/InputType.cpp +++ b/Source/WebCore/html/InputType.cpp @@ -305,6 +305,10 @@ void InputType::handleClickEvent(MouseEvent*) { } +void InputType::handleMouseDownEvent(MouseEvent*) +{ +} + void InputType::handleDOMActivateEvent(Event*) { } diff --git a/Source/WebCore/html/InputType.h b/Source/WebCore/html/InputType.h index 0d1f6b8..e6ceb96 100644 --- a/Source/WebCore/html/InputType.h +++ b/Source/WebCore/html/InputType.h @@ -33,6 +33,7 @@ #define InputType_h #include <wtf/Forward.h> +#include <wtf/FastAllocBase.h> #include <wtf/Noncopyable.h> #include <wtf/RefPtr.h> #include <wtf/Vector.h> @@ -56,17 +57,18 @@ class WheelEvent; typedef int ExceptionCode; struct ClickHandlingState { + WTF_MAKE_FAST_ALLOCATED; +public: bool checked; bool indeterminate; RefPtr<HTMLInputElement> checkedRadioButton; - - WTF_MAKE_FAST_ALLOCATED }; // An InputType object represents the type-specific part of an HTMLInputElement. // Do not expose instances of InputType and classes derived from it to classes // other than HTMLInputElement. -class InputType : public Noncopyable { +class InputType { + WTF_MAKE_NONCOPYABLE(InputType); WTF_MAKE_FAST_ALLOCATED; public: static PassOwnPtr<InputType> create(HTMLInputElement*, const String&); static PassOwnPtr<InputType> createText(HTMLInputElement*); @@ -153,6 +155,7 @@ public: // Event handlers virtual void handleClickEvent(MouseEvent*); + virtual void handleMouseDownEvent(MouseEvent*); virtual PassOwnPtr<ClickHandlingState> willDispatchClick(); virtual void didDispatchClick(Event*, const ClickHandlingState&); virtual void handleDOMActivateEvent(Event*); diff --git a/Source/WebCore/html/RangeInputType.cpp b/Source/WebCore/html/RangeInputType.cpp index 7d0a38c..e9ac295 100644 --- a/Source/WebCore/html/RangeInputType.cpp +++ b/Source/WebCore/html/RangeInputType.cpp @@ -36,6 +36,8 @@ #include "HTMLNames.h" #include "HTMLParserIdioms.h" #include "KeyboardEvent.h" +#include "MouseEvent.h" +#include "PlatformMouseEvent.h" #include "RenderSlider.h" #include "SliderThumbElement.h" #include "StepRange.h" @@ -141,6 +143,15 @@ double RangeInputType::stepScaleFactor() const return rangeStepScaleFactor; } +void RangeInputType::handleMouseDownEvent(MouseEvent* event) +{ + if (event->button() != LeftButton || event->target() != element()) + return; + + if (SliderThumbElement* thumb = toSliderThumbElement(element()->shadowRoot())) + thumb->dragFrom(event->absoluteLocation()); +} + void RangeInputType::handleKeydownEvent(KeyboardEvent* event) { const String& key = event->keyIdentifier(); @@ -181,6 +192,7 @@ void RangeInputType::handleKeydownEvent(KeyboardEvent* event) event->setDefaultHandled(); } +<<<<<<< HEAD void RangeInputType::forwardEvent(Event* event) { if (element()->renderer() @@ -193,6 +205,8 @@ void RangeInputType::forwardEvent(Event* event) toRenderSlider(element()->renderer())->forwardEvent(event); } +======= +>>>>>>> WebKit.org at r76408 void RangeInputType::createShadowSubtree() { element()->setShadowRoot(SliderThumbElement::create(element()->document())); diff --git a/Source/WebCore/html/RangeInputType.h b/Source/WebCore/html/RangeInputType.h index 57eb299..15d224d 100644 --- a/Source/WebCore/html/RangeInputType.h +++ b/Source/WebCore/html/RangeInputType.h @@ -55,8 +55,8 @@ private: virtual double stepBase() const; virtual double defaultStep() const; virtual double stepScaleFactor() const; + virtual void handleMouseDownEvent(MouseEvent*); virtual void handleKeydownEvent(KeyboardEvent*); - virtual void forwardEvent(Event*); virtual RenderObject* createRenderer(RenderArena*, RenderStyle*) const; virtual void createShadowSubtree(); virtual double parseToDouble(const String&, double) const; diff --git a/Source/WebCore/html/StepRange.h b/Source/WebCore/html/StepRange.h index ce044ea..2fa1393 100644 --- a/Source/WebCore/html/StepRange.h +++ b/Source/WebCore/html/StepRange.h @@ -28,7 +28,8 @@ namespace WebCore { class HTMLInputElement; -class StepRange : public Noncopyable { +class StepRange { + WTF_MAKE_NONCOPYABLE(StepRange); public: bool hasStep; double step; diff --git a/Source/WebCore/html/ValidationMessage.h b/Source/WebCore/html/ValidationMessage.h index 5fa1f96..7cd0cbb 100644 --- a/Source/WebCore/html/ValidationMessage.h +++ b/Source/WebCore/html/ValidationMessage.h @@ -42,7 +42,8 @@ namespace WebCore { class FormAssociatedElement; class HTMLElement; -class ValidationMessage : public Noncopyable { +class ValidationMessage { + WTF_MAKE_NONCOPYABLE(ValidationMessage); public: static PassOwnPtr<ValidationMessage> create(FormAssociatedElement*); ~ValidationMessage(); diff --git a/Source/WebCore/html/ValidityState.h b/Source/WebCore/html/ValidityState.h index e140c49..4a96488 100644 --- a/Source/WebCore/html/ValidityState.h +++ b/Source/WebCore/html/ValidityState.h @@ -29,7 +29,8 @@ namespace WebCore { -class ValidityState : public Noncopyable { +class ValidityState { + WTF_MAKE_NONCOPYABLE(ValidityState); WTF_MAKE_FAST_ALLOCATED; public: static PassOwnPtr<ValidityState> create(FormAssociatedElement* control) { diff --git a/Source/WebCore/html/canvas/CanvasRenderingContext.h b/Source/WebCore/html/canvas/CanvasRenderingContext.h index a25e8a1..a143596 100644 --- a/Source/WebCore/html/canvas/CanvasRenderingContext.h +++ b/Source/WebCore/html/canvas/CanvasRenderingContext.h @@ -41,7 +41,8 @@ class HTMLVideoElement; class KURL; class WebGLObject; -class CanvasRenderingContext : public Noncopyable { +class CanvasRenderingContext { + WTF_MAKE_NONCOPYABLE(CanvasRenderingContext); WTF_MAKE_FAST_ALLOCATED; public: CanvasRenderingContext(HTMLCanvasElement*); virtual ~CanvasRenderingContext() { } diff --git a/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp b/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp index 62c5793..e029128 100644 --- a/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp +++ b/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp @@ -57,6 +57,7 @@ #include "Settings.h" #include "StrokeStyleApplier.h" #include "TextMetrics.h" +#include "TextRun.h" #if ENABLE(ACCELERATED_2D_CANVAS) #include "Chrome.h" @@ -170,7 +171,7 @@ void CanvasRenderingContext2D::reset() m_path.clear(); #if ENABLE(ACCELERATED_2D_CANVAS) if (GraphicsContext* c = drawingContext()) { - if (m_context3D) { + if (m_context3D && m_drawingBuffer) { m_drawingBuffer->reset(IntSize(canvas()->width(), canvas()->height())); c->setSharedGraphicsContext3D(m_context3D.get(), m_drawingBuffer.get(), IntSize(canvas()->width(), canvas()->height())); } @@ -537,7 +538,7 @@ void CanvasRenderingContext2D::transform(float m11, float m12, float m21, float return; AffineTransform transform(m11, m12, m21, m22, dx, dy); - AffineTransform newTransform = transform * state().m_transform; + AffineTransform newTransform = state().m_transform * transform; if (!newTransform.isInvertible()) { state().m_invertibleCTM = false; return; @@ -562,7 +563,7 @@ void CanvasRenderingContext2D::setTransform(float m11, float m12, float m21, flo return; c->concatCTM(c->getCTM().inverse()); c->concatCTM(canvas()->baseTransform()); - state().m_transform.multiply(ctm.inverse()); + state().m_transform = ctm.inverse() * state().m_transform; m_path.transform(ctm); state().m_invertibleCTM = true; @@ -1895,7 +1896,7 @@ void CanvasRenderingContext2D::paintRenderingResultsToCanvas() #if ENABLE(ACCELERATED_2D_CANVAS) && USE(ACCELERATED_COMPOSITING) PlatformLayer* CanvasRenderingContext2D::platformLayer() const { - return m_drawingBuffer->platformLayer(); + return m_drawingBuffer ? m_drawingBuffer->platformLayer() : 0; } #endif diff --git a/Source/WebCore/html/canvas/CheckedInt.h b/Source/WebCore/html/canvas/CheckedInt.h index 861e8e6..b83ac19 100644 --- a/Source/WebCore/html/canvas/CheckedInt.h +++ b/Source/WebCore/html/canvas/CheckedInt.h @@ -60,29 +60,93 @@ namespace CheckedInt_internal { struct unsupported_type {}; -template<typename T> struct integer_type_manually_recorded_info -{ - enum { is_supported = 0 }; - typedef unsupported_type twice_bigger_type; -}; +template<typename T> struct integer_type_manually_recorded_info; -#define CHECKEDINT_REGISTER_SUPPORTED_TYPE(T,_twice_bigger_type) \ +#define CHECKEDINT_REGISTER_SUPPORTED_TYPE(T,_twice_bigger_type,_unsigned_type) \ template<> struct integer_type_manually_recorded_info<T> \ { \ enum { is_supported = 1 }; \ typedef _twice_bigger_type twice_bigger_type; \ - static void TYPE_NOT_SUPPORTED_BY_CheckedInt() {} \ + typedef _unsigned_type unsigned_type; \ }; -CHECKEDINT_REGISTER_SUPPORTED_TYPE(int8_t, int16_t) -CHECKEDINT_REGISTER_SUPPORTED_TYPE(uint8_t, uint16_t) -CHECKEDINT_REGISTER_SUPPORTED_TYPE(int16_t, int32_t) -CHECKEDINT_REGISTER_SUPPORTED_TYPE(uint16_t, uint32_t) -CHECKEDINT_REGISTER_SUPPORTED_TYPE(int32_t, int64_t) -CHECKEDINT_REGISTER_SUPPORTED_TYPE(uint32_t, uint64_t) -CHECKEDINT_REGISTER_SUPPORTED_TYPE(int64_t, unsupported_type) -CHECKEDINT_REGISTER_SUPPORTED_TYPE(uint64_t, unsupported_type) +// Type Twice Bigger Type Unsigned Type +CHECKEDINT_REGISTER_SUPPORTED_TYPE(int8_t, int16_t, uint8_t) +CHECKEDINT_REGISTER_SUPPORTED_TYPE(uint8_t, uint16_t, uint8_t) +CHECKEDINT_REGISTER_SUPPORTED_TYPE(int16_t, int32_t, uint16_t) +CHECKEDINT_REGISTER_SUPPORTED_TYPE(uint16_t, uint32_t, uint16_t) +CHECKEDINT_REGISTER_SUPPORTED_TYPE(int32_t, int64_t, uint32_t) +CHECKEDINT_REGISTER_SUPPORTED_TYPE(uint32_t, uint64_t, uint32_t) +CHECKEDINT_REGISTER_SUPPORTED_TYPE(int64_t, unsupported_type, uint64_t) +CHECKEDINT_REGISTER_SUPPORTED_TYPE(uint64_t, unsupported_type, uint64_t) + +// now implement the fallback for standard types like int, long, ... +// the difficulty is that they may or may not be equal to one of the above types, and/or +// to each other. This is why any attempt to handle at once PRInt8... types and standard types +// is bound to fail. +template<typename T> +struct is_standard_integer_type { enum { value = 0 }; }; + +template<> +struct is_standard_integer_type<char> { enum { value = 1 }; }; +template<> +struct is_standard_integer_type<unsigned char> { enum { value = 1 }; }; +template<> +struct is_standard_integer_type<short> { enum { value = 1 }; }; +template<> +struct is_standard_integer_type<unsigned short> { enum { value = 1 }; }; +template<> +struct is_standard_integer_type<int> { enum { value = 1 }; }; +template<> +struct is_standard_integer_type<unsigned int> { enum { value = 1 }; }; +template<> +struct is_standard_integer_type<long> { enum { value = 1 }; }; +template<> +struct is_standard_integer_type<unsigned long> { enum { value = 1 }; }; +template<> +struct is_standard_integer_type<long long> { enum { value = 1 }; }; +template<> +struct is_standard_integer_type<unsigned long long> { enum { value = 1 }; }; + +template<int size, bool is_signed> +struct explicitly_sized_integer_type {}; + +template<> +struct explicitly_sized_integer_type<1, true> { typedef int8_t type; }; +template<> +struct explicitly_sized_integer_type<1, false> { typedef uint8_t type; }; +template<> +struct explicitly_sized_integer_type<2, true> { typedef int16_t type; }; +template<> +struct explicitly_sized_integer_type<2, false> { typedef uint16_t type; }; +template<> +struct explicitly_sized_integer_type<4, true> { typedef int32_t type; }; +template<> +struct explicitly_sized_integer_type<4, false> { typedef uint32_t type; }; +template<> +struct explicitly_sized_integer_type<8, true> { typedef int64_t type; }; +template<> +struct explicitly_sized_integer_type<8, false> { typedef uint64_t type; }; + +template<typename T> struct integer_type_manually_recorded_info +{ + enum { + is_supported = is_standard_integer_type<T>::value, + size = sizeof(T), + is_signed = (T(-1) > T(0)) ? 0 : 1 + }; + typedef typename explicitly_sized_integer_type<size, is_signed>::type explicit_sized_type; + typedef integer_type_manually_recorded_info<explicit_sized_type> base; + typedef typename base::twice_bigger_type twice_bigger_type; + typedef typename base::unsigned_type unsigned_type; +}; + +template<typename T, bool is_supported = integer_type_manually_recorded_info<T>::is_supported> +struct TYPE_NOT_SUPPORTED_BY_CheckedInt {}; + +template<typename T> +struct TYPE_NOT_SUPPORTED_BY_CheckedInt<T, true> { static void run() {} }; /*** Step 2: record some info about a given integer type, @@ -348,8 +412,7 @@ protected: template<typename U> CheckedInt(const U& value, bool isValid) : mValue(value), mIsValid(isValid) { - CheckedInt_internal::integer_type_manually_recorded_info<T> - ::TYPE_NOT_SUPPORTED_BY_CheckedInt(); + CheckedInt_internal::TYPE_NOT_SUPPORTED_BY_CheckedInt<T>::run(); } public: @@ -366,15 +429,13 @@ public: : mValue(value), mIsValid(CheckedInt_internal::is_in_range<T>(value)) { - CheckedInt_internal::integer_type_manually_recorded_info<T> - ::TYPE_NOT_SUPPORTED_BY_CheckedInt(); + CheckedInt_internal::TYPE_NOT_SUPPORTED_BY_CheckedInt<T>::run(); } /** Constructs a valid checked integer with uninitialized value */ CheckedInt() : mIsValid(1) { - CheckedInt_internal::integer_type_manually_recorded_info<T> - ::TYPE_NOT_SUPPORTED_BY_CheckedInt(); + CheckedInt_internal::TYPE_NOT_SUPPORTED_BY_CheckedInt<T>::run(); } /** \returns the actual value */ diff --git a/Source/WebCore/html/canvas/OESStandardDerivatives.cpp b/Source/WebCore/html/canvas/OESStandardDerivatives.cpp new file mode 100644 index 0000000..25aae2f --- /dev/null +++ b/Source/WebCore/html/canvas/OESStandardDerivatives.cpp @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2011 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 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. + */ + +#include "config.h" + +#if ENABLE(3D_CANVAS) + +#include "OESStandardDerivatives.h" + +namespace WebCore { + +OESStandardDerivatives::OESStandardDerivatives() : WebGLExtension() +{ +} + +OESStandardDerivatives::~OESStandardDerivatives() +{ +} + +WebGLExtension::ExtensionName OESStandardDerivatives::getName() const +{ + return OESStandardDerivativesName; +} + +PassRefPtr<OESStandardDerivatives> OESStandardDerivatives::create() +{ + return adoptRef(new OESStandardDerivatives); +} + +} // namespace WebCore + +#endif // ENABLE(3D_CANVAS) diff --git a/Source/WebCore/html/canvas/OESStandardDerivatives.h b/Source/WebCore/html/canvas/OESStandardDerivatives.h new file mode 100644 index 0000000..c74e24f --- /dev/null +++ b/Source/WebCore/html/canvas/OESStandardDerivatives.h @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2011 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 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. + */ + +#ifndef OESStandardDerivatives_h +#define OESStandardDerivatives_h + +#include "WebGLExtension.h" +#include <wtf/PassRefPtr.h> +#include <wtf/RefCounted.h> + +namespace WebCore { + +class OESStandardDerivatives : public WebGLExtension { +public: + static PassRefPtr<OESStandardDerivatives> create(); + + virtual ~OESStandardDerivatives(); + virtual ExtensionName getName() const; + +private: + OESStandardDerivatives(); +}; + +} // namespace WebCore + +#endif // OESStandardDerivatives_h diff --git a/Source/WebCore/html/canvas/OESStandardDerivatives.idl b/Source/WebCore/html/canvas/OESStandardDerivatives.idl new file mode 100644 index 0000000..a9d1dd6 --- /dev/null +++ b/Source/WebCore/html/canvas/OESStandardDerivatives.idl @@ -0,0 +1,30 @@ +/* + * Copyright (C) 2011 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 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. + */ + +module html { + interface [Conditional=3D_CANVAS, OmitConstructor, DontCheckEnums] OESStandardDerivatives { + const unsigned int FRAGMENT_SHADER_DERIVATIVE_HINT_OES = 0x8B8B; + }; +} diff --git a/Source/WebCore/html/canvas/TypedArrayBase.h b/Source/WebCore/html/canvas/TypedArrayBase.h index 2bef6f0..a828620 100644 --- a/Source/WebCore/html/canvas/TypedArrayBase.h +++ b/Source/WebCore/html/canvas/TypedArrayBase.h @@ -60,7 +60,12 @@ class TypedArrayBase : public ArrayBufferView { return m_length; } - protected: + virtual unsigned byteLength() const + { + return m_length * sizeof(T); + } + +protected: TypedArrayBase(PassRefPtr<ArrayBuffer> buffer, unsigned byteOffset, unsigned length) : ArrayBufferView(buffer, byteOffset) , m_length(length) @@ -110,13 +115,6 @@ class TypedArrayBase : public ArrayBufferView { // We do not want to have to access this via a virtual function in subclasses, // which is why it is protected rather than private. unsigned m_length; - - private: - // Overridden from ArrayBufferView. - virtual unsigned byteLength() const - { - return m_length * sizeof(T); - } }; } // namespace WebCore diff --git a/Source/WebCore/html/canvas/WebGLBuffer.cpp b/Source/WebCore/html/canvas/WebGLBuffer.cpp index 4566bfa..849472b 100644 --- a/Source/WebCore/html/canvas/WebGLBuffer.cpp +++ b/Source/WebCore/html/canvas/WebGLBuffer.cpp @@ -61,9 +61,9 @@ bool WebGLBuffer::associateBufferDataImpl(ArrayBuffer* array, GC3Dintptr byteOff return false; if (array && byteLength) { - CheckedInt<int32_t> checkedOffset(byteOffset); - CheckedInt<int32_t> checkedLength(byteLength); - CheckedInt<int32_t> checkedMax = checkedOffset + checkedLength; + CheckedInt<GC3Dintptr> checkedOffset(byteOffset); + CheckedInt<GC3Dsizeiptr> checkedLength(byteLength); + CheckedInt<GC3Dintptr> checkedMax = checkedOffset + checkedLength; if (!checkedMax.valid() || checkedMax.value() > static_cast<int32_t>(array->byteLength())) return false; } @@ -124,11 +124,11 @@ bool WebGLBuffer::associateBufferSubDataImpl(GC3Dintptr offset, ArrayBuffer* arr return false; if (byteLength) { - CheckedInt<int32_t> checkedBufferOffset(offset); - CheckedInt<int32_t> checkedArrayOffset(arrayByteOffset); - CheckedInt<int32_t> checkedLength(byteLength); - CheckedInt<int32_t> checkedArrayMax = checkedArrayOffset + checkedLength; - CheckedInt<int32_t> checkedBufferMax = checkedBufferOffset + checkedLength; + CheckedInt<GC3Dintptr> checkedBufferOffset(offset); + CheckedInt<GC3Dintptr> checkedArrayOffset(arrayByteOffset); + CheckedInt<GC3Dsizeiptr> checkedLength(byteLength); + CheckedInt<GC3Dintptr> checkedArrayMax = checkedArrayOffset + checkedLength; + CheckedInt<GC3Dintptr> checkedBufferMax = checkedBufferOffset + checkedLength; if (!checkedArrayMax.valid() || checkedArrayMax.value() > static_cast<int32_t>(array->byteLength()) || !checkedBufferMax.valid() || checkedBufferMax.value() > m_byteLength) return false; } diff --git a/Source/WebCore/html/canvas/WebGLExtension.h b/Source/WebCore/html/canvas/WebGLExtension.h index f2d6b7b..d135c18 100644 --- a/Source/WebCore/html/canvas/WebGLExtension.h +++ b/Source/WebCore/html/canvas/WebGLExtension.h @@ -36,6 +36,7 @@ public: enum ExtensionName { WebKitLoseContextName, OESTextureFloatName, + OESStandardDerivativesName, }; virtual ~WebGLExtension(); diff --git a/Source/WebCore/html/canvas/WebGLRenderingContext.cpp b/Source/WebCore/html/canvas/WebGLRenderingContext.cpp index c445e2b..a3b9699 100644 --- a/Source/WebCore/html/canvas/WebGLRenderingContext.cpp +++ b/Source/WebCore/html/canvas/WebGLRenderingContext.cpp @@ -44,6 +44,7 @@ #include "ImageData.h" #include "IntSize.h" #include "NotImplemented.h" +#include "OESStandardDerivatives.h" #include "OESTextureFloat.h" #include "RenderBox.h" #include "RenderLayer.h" @@ -62,6 +63,7 @@ #include <wtf/ByteArray.h> #include <wtf/OwnArrayPtr.h> #include <wtf/PassOwnArrayPtr.h> +#include <wtf/text/StringBuilder.h> namespace WebCore { @@ -101,12 +103,11 @@ namespace { // Return true if a character belongs to the ASCII subset as defined in // GLSL ES 1.0 spec section 3.1. - // We make exceptions for " ' `. bool validateCharacter(unsigned char c) { // Printing characters are valid except " $ ` @ \ ' DEL. if (c >= 32 && c <= 126 - && c != '$' && c != '@' && c != '\\') + && c != '"' && c != '$' && c != '`' && c != '@' && c != '\\' && c != '\'') return true; // Horizontal tab, line feed, vertical tab, form feed, carriage return // are also valid. @@ -115,6 +116,189 @@ namespace { return false; } + // Strips comments from shader text. This allows non-ASCII characters + // to be used in comments without potentially breaking OpenGL + // implementations not expecting characters outside the GLSL ES set. + class StripComments { + public: + StripComments(const String& str) + : m_parseState(BeginningOfLine) + , m_sourceString(str) + , m_length(str.length()) + , m_position(0) + { + parse(); + } + + String result() + { + return m_builder.toString(); + } + + private: + bool hasMoreCharacters() + { + return (m_position < m_length); + } + + void parse() + { + while (hasMoreCharacters()) { + process(current()); + // process() might advance the position. + if (hasMoreCharacters()) + advance(); + } + } + + void process(UChar); + + bool peek(UChar& character) + { + if (m_position + 1 >= m_length) + return false; + character = m_sourceString[m_position + 1]; + return true; + } + + UChar current() + { + ASSERT(m_position < m_length); + return m_sourceString[m_position]; + } + + void advance() + { + ++m_position; + } + + bool isNewline(UChar character) + { + // Don't attempt to canonicalize newline related characters. + return (character == '\n' || character == '\r'); + } + + void emit(UChar character) + { + m_builder.append(character); + } + + enum ParseState { + // Have not seen an ASCII non-whitespace character yet on + // this line. Possible that we might see a preprocessor + // directive. + BeginningOfLine, + + // Have seen at least one ASCII non-whitespace character + // on this line. + MiddleOfLine, + + // Handling a preprocessor directive. Passes through all + // characters up to the end of the line. Disables comment + // processing. + InPreprocessorDirective, + + // Handling a single-line comment. The comment text is + // replaced with a single space. + InSingleLineComment, + + // Handling a multi-line comment. Newlines are passed + // through to preserve line numbers. + InMultiLineComment + }; + + ParseState m_parseState; + String m_sourceString; + unsigned m_length; + unsigned m_position; + StringBuilder m_builder; + }; + + void StripComments::process(UChar c) + { + if (isNewline(c)) { + // No matter what state we are in, pass through newlines + // so we preserve line numbers. + emit(c); + + if (m_parseState != InMultiLineComment) + m_parseState = BeginningOfLine; + + return; + } + + UChar temp = 0; + switch (m_parseState) { + case BeginningOfLine: + if (WTF::isASCIISpace(c)) { + emit(c); + break; + } + + if (c == '#') { + m_parseState = InPreprocessorDirective; + emit(c); + break; + } + + // Transition to normal state and re-handle character. + m_parseState = MiddleOfLine; + process(c); + break; + + case MiddleOfLine: + if (c == '/' && peek(temp)) { + if (temp == '/') { + m_parseState = InSingleLineComment; + emit(' '); + advance(); + break; + } + + if (temp == '*') { + m_parseState = InMultiLineComment; + // Emit the comment start in case the user has + // an unclosed comment and we want to later + // signal an error. + emit('/'); + emit('*'); + advance(); + break; + } + } + + emit(c); + break; + + case InPreprocessorDirective: + // No matter what the character is, just pass it + // through. Do not parse comments in this state. This + // might not be the right thing to do long term, but it + // should handle the #error preprocessor directive. + emit(c); + break; + + case InSingleLineComment: + // The newline code at the top of this function takes care + // of resetting our state when we get out of the + // single-line comment. Swallow all other characters. + break; + + case InMultiLineComment: + if (c == '*' && peek(temp) && temp == '/') { + emit('*'); + emit('/'); + m_parseState = MiddleOfLine; + advance(); + break; + } + + // Swallow all other characters. Unclear whether we may + // want or need to just emit a space per character to try + // to preserve column numbers for debugging purposes. + break; + } + } } // namespace anonymous class WebGLStateRestorer { @@ -1574,6 +1758,14 @@ WebGLExtension* WebGLRenderingContext::getExtension(const String& name) if (isContextLost()) return 0; + if (equalIgnoringCase(name, "OES_standard_derivatives") + && m_context->getExtensions()->supports("GL_OES_standard_derivatives")) { + if (!m_oesStandardDerivatives) { + m_context->getExtensions()->ensureEnabled("GL_OES_standard_derivatives"); + m_oesStandardDerivatives = OESStandardDerivatives::create(); + } + return m_oesStandardDerivatives.get(); + } if (equalIgnoringCase(name, "OES_texture_float") && m_context->getExtensions()->supports("GL_OES_texture_float")) { if (!m_oesTextureFloat) { @@ -1581,7 +1773,8 @@ WebGLExtension* WebGLRenderingContext::getExtension(const String& name) m_oesTextureFloat = OESTextureFloat::create(); } return m_oesTextureFloat.get(); - } else if (equalIgnoringCase(name, "WEBKIT_lose_context")) { + } + if (equalIgnoringCase(name, "WEBKIT_lose_context")) { if (!m_webkitLoseContext) m_webkitLoseContext = WebKitLoseContext::create(this); return m_webkitLoseContext.get(); @@ -1823,6 +2016,11 @@ WebGLGetInfo WebGLRenderingContext::getParameter(GC3Denum pname, ExceptionCode& return WebGLGetInfo("WebGL 1.0 (" + m_context->getString(GraphicsContext3D::VERSION) + ")"); case GraphicsContext3D::VIEWPORT: return getWebGLIntArrayParameter(pname); + case Extensions3D::FRAGMENT_SHADER_DERIVATIVE_HINT_OES: // OES_standard_derivatives + if (m_oesStandardDerivatives) + return getUnsignedLongParameter(Extensions3D::FRAGMENT_SHADER_DERIVATIVE_HINT_OES); + m_context->synthesizeGLError(GraphicsContext3D::INVALID_ENUM); + return WebGLGetInfo(); default: m_context->synthesizeGLError(GraphicsContext3D::INVALID_ENUM); return WebGLGetInfo(); @@ -1990,6 +2188,8 @@ Vector<String> WebGLRenderingContext::getSupportedExtensions() Vector<String> result; if (m_context->getExtensions()->supports("GL_OES_texture_float")) result.append("OES_texture_float"); + if (m_context->getExtensions()->supports("GL_OES_standard_derivatives")) + result.append("OES_standard_derivatives"); result.append("WEBKIT_lose_context"); return result; } @@ -2234,7 +2434,17 @@ void WebGLRenderingContext::hint(GC3Denum target, GC3Denum mode) { if (isContextLost()) return; - if (target != GraphicsContext3D::GENERATE_MIPMAP_HINT) { + bool isValid = false; + switch (target) { + case GraphicsContext3D::GENERATE_MIPMAP_HINT: + isValid = true; + break; + case Extensions3D::FRAGMENT_SHADER_DERIVATIVE_HINT_OES: // OES_standard_derivatives + if (m_oesStandardDerivatives) + isValid = true; + break; + } + if (!isValid) { m_context->synthesizeGLError(GraphicsContext3D::INVALID_ENUM); return; } @@ -2547,9 +2757,10 @@ void WebGLRenderingContext::shaderSource(WebGLShader* shader, const String& stri UNUSED_PARAM(ec); if (isContextLost() || !validateWebGLObject(shader)) return; - if (!validateString(string)) + String stringWithoutComments = StripComments(string).result(); + if (!validateString(stringWithoutComments)) return; - m_context->shaderSource(objectOrZero(shader), string); + m_context->shaderSource(objectOrZero(shader), stringWithoutComments); cleanupAfterGraphicsCall(false); } @@ -4352,11 +4563,16 @@ void WebGLRenderingContext::restoreStatesAfterVertexAttrib0Simulation() int WebGLRenderingContext::getNumberOfExtensions() { - return (m_webkitLoseContext ? 1 : 0) + (m_oesTextureFloat ? 1 : 0); + return (m_oesStandardDerivatives ? 1 : 0) + (m_webkitLoseContext ? 1 : 0) + (m_oesTextureFloat ? 1 : 0); } WebGLExtension* WebGLRenderingContext::getExtensionNumber(int i) { + if (m_oesStandardDerivatives) { + if (!i) + return m_oesStandardDerivatives.get(); + --i; + } if (m_webkitLoseContext) { if (!i) return m_webkitLoseContext.get(); diff --git a/Source/WebCore/html/canvas/WebGLRenderingContext.h b/Source/WebCore/html/canvas/WebGLRenderingContext.h index d9b738c..01b5438 100644 --- a/Source/WebCore/html/canvas/WebGLRenderingContext.h +++ b/Source/WebCore/html/canvas/WebGLRenderingContext.h @@ -57,6 +57,7 @@ class HTMLVideoElement; class ImageBuffer; class ImageData; class IntSize; +class OESStandardDerivatives; class OESTextureFloat; class WebGLRenderingContext : public CanvasRenderingContext { @@ -452,6 +453,7 @@ public: // Enabled extension objects. RefPtr<OESTextureFloat> m_oesTextureFloat; + RefPtr<OESStandardDerivatives> m_oesStandardDerivatives; RefPtr<WebKitLoseContext> m_webkitLoseContext; // Helpers for getParameter and others diff --git a/Source/WebCore/html/parser/CSSPreloadScanner.h b/Source/WebCore/html/parser/CSSPreloadScanner.h index 7ac282f..fae95a1 100644 --- a/Source/WebCore/html/parser/CSSPreloadScanner.h +++ b/Source/WebCore/html/parser/CSSPreloadScanner.h @@ -35,7 +35,8 @@ namespace WebCore { class Document; class HTMLToken; -class CSSPreloadScanner : public Noncopyable { +class CSSPreloadScanner { + WTF_MAKE_NONCOPYABLE(CSSPreloadScanner); public: CSSPreloadScanner(Document*); diff --git a/Source/WebCore/html/parser/HTMLConstructionSite.h b/Source/WebCore/html/parser/HTMLConstructionSite.h index 8b09bf5..5a4a65d 100644 --- a/Source/WebCore/html/parser/HTMLConstructionSite.h +++ b/Source/WebCore/html/parser/HTMLConstructionSite.h @@ -40,7 +40,8 @@ class AtomicHTMLToken; class Document; class Element; -class HTMLConstructionSite : public Noncopyable { +class HTMLConstructionSite { + WTF_MAKE_NONCOPYABLE(HTMLConstructionSite); public: HTMLConstructionSite(Document*, FragmentScriptingPermission, bool isParsingFragment); ~HTMLConstructionSite(); @@ -89,7 +90,8 @@ public: HTMLFormElement* form() const { return m_form.get(); } PassRefPtr<HTMLFormElement> takeForm(); - class RedirectToFosterParentGuard : public Noncopyable { + class RedirectToFosterParentGuard { + WTF_MAKE_NONCOPYABLE(RedirectToFosterParentGuard); public: RedirectToFosterParentGuard(HTMLConstructionSite& tree) : m_tree(tree) diff --git a/Source/WebCore/html/parser/HTMLDocumentParser.h b/Source/WebCore/html/parser/HTMLDocumentParser.h index 80ca727..f925269 100644 --- a/Source/WebCore/html/parser/HTMLDocumentParser.h +++ b/Source/WebCore/html/parser/HTMLDocumentParser.h @@ -50,6 +50,7 @@ class ScriptController; class ScriptSourceCode; class HTMLDocumentParser : public ScriptableDocumentParser, HTMLScriptRunnerHost, CachedResourceClient { + WTF_MAKE_FAST_ALLOCATED; public: static PassRefPtr<HTMLDocumentParser> create(HTMLDocument* document, bool reportErrors) { diff --git a/Source/WebCore/html/parser/HTMLElementStack.h b/Source/WebCore/html/parser/HTMLElementStack.h index 8a8e160..ad8b941 100644 --- a/Source/WebCore/html/parser/HTMLElementStack.h +++ b/Source/WebCore/html/parser/HTMLElementStack.h @@ -39,12 +39,14 @@ class QualifiedName; // NOTE: The HTML5 spec uses a backwards (grows downward) stack. We're using // more standard (grows upwards) stack terminology here. -class HTMLElementStack : public Noncopyable { +class HTMLElementStack { + WTF_MAKE_NONCOPYABLE(HTMLElementStack); WTF_MAKE_FAST_ALLOCATED; public: HTMLElementStack(); ~HTMLElementStack(); - class ElementRecord : public Noncopyable { + class ElementRecord { + WTF_MAKE_NONCOPYABLE(ElementRecord); public: ~ElementRecord(); // Public for ~PassOwnPtr() diff --git a/Source/WebCore/html/parser/HTMLFormattingElementList.h b/Source/WebCore/html/parser/HTMLFormattingElementList.h index aca05bb..f75fa50 100644 --- a/Source/WebCore/html/parser/HTMLFormattingElementList.h +++ b/Source/WebCore/html/parser/HTMLFormattingElementList.h @@ -35,7 +35,8 @@ namespace WebCore { class Element; // This may end up merged into HTMLElementStack. -class HTMLFormattingElementList : public Noncopyable { +class HTMLFormattingElementList { + WTF_MAKE_NONCOPYABLE(HTMLFormattingElementList); public: HTMLFormattingElementList(); ~HTMLFormattingElementList(); diff --git a/Source/WebCore/html/parser/HTMLInputStream.h b/Source/WebCore/html/parser/HTMLInputStream.h index 1bfbaf9..d95ec31 100644 --- a/Source/WebCore/html/parser/HTMLInputStream.h +++ b/Source/WebCore/html/parser/HTMLInputStream.h @@ -47,7 +47,8 @@ namespace WebCore { // m_last is a pointer to the last of the afterInsertionPoint strings. // The network adds data at the end of the InputStream, which appends // them to the "last" string. -class HTMLInputStream : public Noncopyable { +class HTMLInputStream { + WTF_MAKE_NONCOPYABLE(HTMLInputStream); public: HTMLInputStream() : m_last(&m_first) @@ -129,7 +130,8 @@ private: SegmentedString* m_last; }; -class InsertionPointRecord : public Noncopyable { +class InsertionPointRecord { + WTF_MAKE_NONCOPYABLE(InsertionPointRecord); public: explicit InsertionPointRecord(HTMLInputStream& inputStream) : m_inputStream(&inputStream) diff --git a/Source/WebCore/html/parser/HTMLMetaCharsetParser.h b/Source/WebCore/html/parser/HTMLMetaCharsetParser.h index c3136f5..45fbaf7 100644 --- a/Source/WebCore/html/parser/HTMLMetaCharsetParser.h +++ b/Source/WebCore/html/parser/HTMLMetaCharsetParser.h @@ -36,7 +36,8 @@ namespace WebCore { class HTMLTokenizer; class TextCodec; -class HTMLMetaCharsetParser : public Noncopyable { +class HTMLMetaCharsetParser { + WTF_MAKE_NONCOPYABLE(HTMLMetaCharsetParser); public: static PassOwnPtr<HTMLMetaCharsetParser> create() { return adoptPtr(new HTMLMetaCharsetParser()); } diff --git a/Source/WebCore/html/parser/HTMLParserScheduler.h b/Source/WebCore/html/parser/HTMLParserScheduler.h index 3a20b2b..c415c62 100644 --- a/Source/WebCore/html/parser/HTMLParserScheduler.h +++ b/Source/WebCore/html/parser/HTMLParserScheduler.h @@ -28,14 +28,14 @@ #include "Timer.h" #include <wtf/CurrentTime.h> -#include <wtf/Noncopyable.h> #include <wtf/PassOwnPtr.h> namespace WebCore { class HTMLDocumentParser; -class HTMLParserScheduler : public Noncopyable { +class HTMLParserScheduler { + WTF_MAKE_NONCOPYABLE(HTMLParserScheduler); WTF_MAKE_FAST_ALLOCATED; public: static PassOwnPtr<HTMLParserScheduler> create(HTMLDocumentParser* parser) { diff --git a/Source/WebCore/html/parser/HTMLPreloadScanner.h b/Source/WebCore/html/parser/HTMLPreloadScanner.h index 94a90e6..bed77fe 100644 --- a/Source/WebCore/html/parser/HTMLPreloadScanner.h +++ b/Source/WebCore/html/parser/HTMLPreloadScanner.h @@ -30,7 +30,6 @@ #include "CSSPreloadScanner.h" #include "HTMLToken.h" #include "SegmentedString.h" -#include <wtf/Noncopyable.h> namespace WebCore { @@ -39,7 +38,8 @@ class HTMLToken; class HTMLTokenizer; class SegmentedString; -class HTMLPreloadScanner : public Noncopyable { +class HTMLPreloadScanner { + WTF_MAKE_NONCOPYABLE(HTMLPreloadScanner); WTF_MAKE_FAST_ALLOCATED; public: HTMLPreloadScanner(Document*); diff --git a/Source/WebCore/html/parser/HTMLScriptRunner.h b/Source/WebCore/html/parser/HTMLScriptRunner.h index 6cf74d8..986f7bd 100644 --- a/Source/WebCore/html/parser/HTMLScriptRunner.h +++ b/Source/WebCore/html/parser/HTMLScriptRunner.h @@ -29,7 +29,6 @@ #include "PendingScript.h" #include <wtf/Deque.h> #include <wtf/text/TextPosition.h> -#include <wtf/Noncopyable.h> #include <wtf/PassRefPtr.h> namespace WebCore { @@ -42,7 +41,8 @@ class Frame; class HTMLScriptRunnerHost; class ScriptSourceCode; -class HTMLScriptRunner : public Noncopyable { +class HTMLScriptRunner { + WTF_MAKE_NONCOPYABLE(HTMLScriptRunner); WTF_MAKE_FAST_ALLOCATED; public: static PassOwnPtr<HTMLScriptRunner> create(Document* document, HTMLScriptRunnerHost* host) { diff --git a/Source/WebCore/html/parser/HTMLToken.h b/Source/WebCore/html/parser/HTMLToken.h index 42cddb8..1cbc151 100644 --- a/Source/WebCore/html/parser/HTMLToken.h +++ b/Source/WebCore/html/parser/HTMLToken.h @@ -27,13 +27,13 @@ #define HTMLToken_h #include "NamedNodeMap.h" -#include <wtf/Noncopyable.h> #include <wtf/PassOwnPtr.h> #include <wtf/Vector.h> namespace WebCore { -class HTMLToken : public Noncopyable { +class HTMLToken { + WTF_MAKE_NONCOPYABLE(HTMLToken); WTF_MAKE_FAST_ALLOCATED; public: enum Type { Uninitialized, @@ -313,7 +313,8 @@ private: // want to end up with a cleaner interface between the two classes. friend class AtomicHTMLToken; - class DoctypeData : public Noncopyable { + class DoctypeData { + WTF_MAKE_NONCOPYABLE(DoctypeData); public: DoctypeData() : m_hasPublicIdentifier(false) @@ -352,7 +353,8 @@ private: // FIXME: This class should eventually be named HTMLToken once we move the // exiting HTMLToken to be internal to the HTMLTokenizer. -class AtomicHTMLToken : public Noncopyable { +class AtomicHTMLToken { + WTF_MAKE_NONCOPYABLE(AtomicHTMLToken); public: AtomicHTMLToken(HTMLToken& token) : m_type(token.type()) diff --git a/Source/WebCore/html/parser/HTMLTokenizer.h b/Source/WebCore/html/parser/HTMLTokenizer.h index f16b049..fa45cb2 100644 --- a/Source/WebCore/html/parser/HTMLTokenizer.h +++ b/Source/WebCore/html/parser/HTMLTokenizer.h @@ -39,7 +39,8 @@ class Element; class Frame; class HTMLToken; -class HTMLTokenizer : public Noncopyable { +class HTMLTokenizer { + WTF_MAKE_NONCOPYABLE(HTMLTokenizer); WTF_MAKE_FAST_ALLOCATED; public: enum State { DataState, @@ -172,7 +173,8 @@ public: private: // http://www.whatwg.org/specs/web-apps/current-work/#preprocessing-the-input-stream - class InputStreamPreprocessor : public Noncopyable { + class InputStreamPreprocessor { + WTF_MAKE_NONCOPYABLE(InputStreamPreprocessor); public: InputStreamPreprocessor(HTMLTokenizer* tokenizer) : m_tokenizer(tokenizer) diff --git a/Source/WebCore/html/parser/HTMLTreeBuilder.cpp b/Source/WebCore/html/parser/HTMLTreeBuilder.cpp index 02713e5..97cee13 100644 --- a/Source/WebCore/html/parser/HTMLTreeBuilder.cpp +++ b/Source/WebCore/html/parser/HTMLTreeBuilder.cpp @@ -241,7 +241,8 @@ HTMLFormElement* closestFormAncestor(Element* element) } // namespace -class HTMLTreeBuilder::ExternalCharacterTokenBuffer : public Noncopyable { +class HTMLTreeBuilder::ExternalCharacterTokenBuffer { + WTF_MAKE_NONCOPYABLE(ExternalCharacterTokenBuffer); public: explicit ExternalCharacterTokenBuffer(AtomicHTMLToken& token) : m_current(token.characters().data()) @@ -2342,7 +2343,8 @@ void HTMLTreeBuilder::reprocessEndTag(AtomicHTMLToken& token) processEndTag(token); } -class HTMLTreeBuilder::FakeInsertionMode : public Noncopyable { +class HTMLTreeBuilder::FakeInsertionMode { + WTF_MAKE_NONCOPYABLE(FakeInsertionMode); public: FakeInsertionMode(HTMLTreeBuilder* treeBuilder, InsertionMode mode) : m_treeBuilder(treeBuilder) diff --git a/Source/WebCore/html/parser/HTMLTreeBuilder.h b/Source/WebCore/html/parser/HTMLTreeBuilder.h index 17b77b7..309ac6f 100644 --- a/Source/WebCore/html/parser/HTMLTreeBuilder.h +++ b/Source/WebCore/html/parser/HTMLTreeBuilder.h @@ -51,7 +51,8 @@ class HTMLDocument; class Node; class HTMLDocumentParser; -class HTMLTreeBuilder : public Noncopyable { +class HTMLTreeBuilder { + WTF_MAKE_NONCOPYABLE(HTMLTreeBuilder); WTF_MAKE_FAST_ALLOCATED; public: static PassOwnPtr<HTMLTreeBuilder> create(HTMLDocumentParser* parser, HTMLDocument* document, bool reportErrors, bool usePreHTML5ParserQuirks) { @@ -204,7 +205,8 @@ private: void processForeignContentUsingInBodyModeAndResetMode(AtomicHTMLToken& token); void resetForeignInsertionMode(); - class FragmentParsingContext : public Noncopyable { + class FragmentParsingContext { + WTF_MAKE_NONCOPYABLE(FragmentParsingContext); public: FragmentParsingContext(); FragmentParsingContext(DocumentFragment*, Element* contextElement, FragmentScriptingPermission); diff --git a/Source/WebCore/html/parser/NestingLevelIncrementer.h b/Source/WebCore/html/parser/NestingLevelIncrementer.h index c597876..8155635 100644 --- a/Source/WebCore/html/parser/NestingLevelIncrementer.h +++ b/Source/WebCore/html/parser/NestingLevelIncrementer.h @@ -28,7 +28,8 @@ namespace WebCore { -class NestingLevelIncrementer : public Noncopyable { +class NestingLevelIncrementer { + WTF_MAKE_NONCOPYABLE(NestingLevelIncrementer); public: explicit NestingLevelIncrementer(unsigned& nestingLevel) : m_nestingLevel(&nestingLevel) diff --git a/Source/WebCore/html/shadow/SliderThumbElement.cpp b/Source/WebCore/html/shadow/SliderThumbElement.cpp index d598da9..ad93261 100644 --- a/Source/WebCore/html/shadow/SliderThumbElement.cpp +++ b/Source/WebCore/html/shadow/SliderThumbElement.cpp @@ -35,9 +35,15 @@ #include "Event.h" #include "Frame.h" +#include "HTMLInputElement.h" +#include "HTMLParserIdioms.h" #include "MouseEvent.h" #include "RenderSlider.h" #include "RenderTheme.h" +#include "StepRange.h" +#include <wtf/MathExtras.h> + +using namespace std; #if PLATFORM(ANDROID) && ENABLE(TOUCH_EVENTS) #include "TouchEvent.h" @@ -52,7 +58,6 @@ public: virtual void layout(); }; - RenderSliderThumb::RenderSliderThumb(Node* node) : RenderBlock(node) { @@ -84,6 +89,70 @@ RenderObject* SliderThumbElement::createRenderer(RenderArena* arena, RenderStyle return new (arena) RenderSliderThumb(this); } +void SliderThumbElement::dragFrom(const IntPoint& point) +{ + setPosition(point); + startDragging(); +} + +void SliderThumbElement::setPosition(const IntPoint& point) +{ + HTMLInputElement* input = static_cast<HTMLInputElement*>(shadowHost()); + ASSERT(input); + + if (!input->renderer() || !renderer()) + return; + + IntPoint offset = roundedIntPoint(input->renderer()->absoluteToLocal(point, false, true)); + RenderStyle* sliderStyle = input->renderer()->style(); + bool isVertical = sliderStyle->appearance() == SliderVerticalPart || sliderStyle->appearance() == MediaVolumeSliderPart; + + int trackSize; + int position; + int currentPosition; + if (isVertical) { + trackSize = input->renderBox()->contentHeight() - renderBox()->height(); + position = offset.y() - renderBox()->height() / 2; + currentPosition = renderBox()->y() - input->renderBox()->contentBoxRect().y(); + } else { + trackSize = input->renderBox()->contentWidth() - renderBox()->width(); + position = offset.x() - renderBox()->width() / 2; + currentPosition = renderBox()->x() - input->renderBox()->contentBoxRect().x(); + } + position = max(0, min(position, trackSize)); + if (position == currentPosition) + return; + + StepRange range(input); + double fraction = static_cast<double>(position) / trackSize; + if (isVertical) + fraction = 1 - fraction; + double value = range.clampValue(range.valueFromProportion(fraction)); + + // FIXME: This is no longer being set from renderer. Consider updating the method name. + input->setValueFromRenderer(serializeForNumberType(value)); + renderer()->setNeedsLayout(true); + input->dispatchFormControlChangeEvent(); +} + +void SliderThumbElement::startDragging() +{ + if (Frame* frame = document()->frame()) { + frame->eventHandler()->setCapturingMouseEventsNode(this); + m_inDragMode = true; + } +} + +void SliderThumbElement::stopDragging() +{ + if (!m_inDragMode) + return; + + if (Frame* frame = document()->frame()) + frame->eventHandler()->setCapturingMouseEventsNode(0); + m_inDragMode = false; +} + void SliderThumbElement::defaultEventHandler(Event* event) { if (!event->isMouseEvent() @@ -99,6 +168,7 @@ void SliderThumbElement::defaultEventHandler(Event* event) bool isLeftButton = mouseEvent->button() == LeftButton; const AtomicString& eventType = event->type(); +<<<<<<< HEAD if (eventType == eventNames().mousedownEvent && isLeftButton #if PLATFORM(ANDROID) && ENABLE(TOUCH_EVENTS) || eventType == eventNames().touchstartEvent @@ -164,6 +234,18 @@ void SliderThumbElement::defaultEventHandler(Event* event) return; } } +======= + if (eventType == eventNames().mousedownEvent && isLeftButton) { + startDragging(); + return; + } else if (eventType == eventNames().mouseupEvent && isLeftButton) { + stopDragging(); + return; + } else if (eventType == eventNames().mousemoveEvent) { + if (m_inDragMode) + setPosition(mouseEvent->absoluteLocation()); + return; +>>>>>>> WebKit.org at r76408 } HTMLDivElement::defaultEventHandler(event); diff --git a/Source/WebCore/html/shadow/SliderThumbElement.h b/Source/WebCore/html/shadow/SliderThumbElement.h index 7219186..1f1c869 100644 --- a/Source/WebCore/html/shadow/SliderThumbElement.h +++ b/Source/WebCore/html/shadow/SliderThumbElement.h @@ -50,6 +50,7 @@ public: bool inDragMode() const { return m_inDragMode; } + void dragFrom(const IntPoint&); virtual void defaultEventHandler(Event*); virtual void detach(); virtual AtomicString shadowPseudoId() const; @@ -57,6 +58,9 @@ public: private: SliderThumbElement(Document*); virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); + void startDragging(); + void stopDragging(); + void setPosition(const IntPoint&); FloatPoint m_offsetToThumb; bool m_inDragMode; diff --git a/Source/WebCore/inspector/CodeGeneratorInspector.pm b/Source/WebCore/inspector/CodeGeneratorInspector.pm index b7be15e..e215a91 100644 --- a/Source/WebCore/inspector/CodeGeneratorInspector.pm +++ b/Source/WebCore/inspector/CodeGeneratorInspector.pm @@ -13,61 +13,70 @@ my %typeTransform; $typeTransform{"ApplicationCache"} = { "forward" => "InspectorApplicationCacheAgent", "header" => "InspectorApplicationCacheAgent.h", - "domainAccessor" => "m_inspectorController->m_applicationCacheAgent", + "domainAccessor" => "m_inspectorAgent->applicationCacheAgent()", }; $typeTransform{"CSS"} = { "forward" => "InspectorCSSAgent", "header" => "InspectorCSSAgent.h", - "domainAccessor" => "m_inspectorController->m_cssAgent", + "domainAccessor" => "m_inspectorAgent->cssAgent()", }; $typeTransform{"Console"} = { "forward" => "InspectorConsoleAgent", "header" => "InspectorConsoleAgent.h", - "domainAccessor" => "m_inspectorController->m_consoleAgent", + "domainAccessor" => "m_inspectorAgent->consoleAgent()", }; $typeTransform{"Debugger"} = { "forward" => "InspectorDebuggerAgent", "header" => "InspectorDebuggerAgent.h", - "domainAccessor" => "m_inspectorController->m_debuggerAgent", + "domainAccessor" => "m_inspectorAgent->debuggerAgent()", }; $typeTransform{"BrowserDebugger"} = { "forward" => "InspectorBrowserDebuggerAgent", "header" => "InspectorBrowserDebuggerAgent.h", - "domainAccessor" => "m_inspectorController->m_browserDebuggerAgent", + "domainAccessor" => "m_inspectorAgent->browserDebuggerAgent()", }; $typeTransform{"Database"} = { "forward" => "InspectorDatabaseAgent", "header" => "InspectorDatabaseAgent.h", - "domainAccessor" => "m_inspectorController->m_databaseAgent", + "domainAccessor" => "m_inspectorAgent->databaseAgent()", }; $typeTransform{"DOM"} = { "forward" => "InspectorDOMAgent", "header" => "InspectorDOMAgent.h", - "domainAccessor" => "m_inspectorController->m_domAgent", + "domainAccessor" => "m_inspectorAgent->domAgent()", }; $typeTransform{"DOMStorage"} = { "forward" => "InspectorDOMStorageAgent", "header" => "InspectorDOMStorageAgent.h", - "domainAccessor" => "m_inspectorController->m_domStorageAgent", + "domainAccessor" => "m_inspectorAgent->domStorageAgent()", }; $typeTransform{"FileSystem"} = { "forward" => "InspectorFileSystemAgent", "header" => "InspectorFileSystemAgent.h", - "domainAccessor" => "m_inspectorController->m_fileSystemAgent", + "domainAccessor" => "m_inspectorAgent->fileSystemAgent()", +}; +$typeTransform{"InjectedScript"} = { + "forwardHeader" => "InjectedScriptHost.h", + "domainAccessor" => "m_inspectorAgent->injectedScriptAgent()", }; $typeTransform{"Inspector"} = { - "forwardHeader" => "InspectorController.h", - "domainAccessor" => "m_inspectorController", + "forwardHeader" => "InspectorController.h", # FIXME: Temporary solution until extracting the real InspectorAgent from InspectorController. + "domainAccessor" => "m_inspectorAgent", }; $typeTransform{"Network"} = { "forward" => "InspectorResourceAgent", "header" => "InspectorResourceAgent.h", - "domainAccessor" => "m_inspectorController->m_resourceAgent", + "domainAccessor" => "m_inspectorAgent->resourceAgent()", }; $typeTransform{"Profiler"} = { "forward" => "InspectorProfilerAgent", "header" => "InspectorProfilerAgent.h", - "domainAccessor" => "m_inspectorController->m_profilerAgent", + "domainAccessor" => "m_inspectorAgent->profilerAgent()", +}; +$typeTransform{"Runtime"} = { + "forward" => "InspectorRuntimeAgent", + "header" => "InspectorRuntimeAgent.h", + "domainAccessor" => "m_inspectorAgent->runtimeAgent()", }; $typeTransform{"Frontend"} = { @@ -87,7 +96,8 @@ $typeTransform{"Object"} = { "defaultValue" => "InspectorObject::create()", "forward" => "InspectorObject", "header" => "InspectorValues.h", - "JSONType" => "Object" + "JSONType" => "Object", + "JSType" => "object" }; $typeTransform{"Array"} = { "param" => "PassRefPtr<InspectorArray>", @@ -95,7 +105,8 @@ $typeTransform{"Array"} = { "defaultValue" => "InspectorArray::create()", "forward" => "InspectorArray", "header" => "InspectorValues.h", - "JSONType" => "Array" + "JSONType" => "Array", + "JSType" => "object" }; $typeTransform{"Value"} = { "param" => "PassRefPtr<InspectorValue>", @@ -103,16 +114,18 @@ $typeTransform{"Value"} = { "defaultValue" => "InspectorValue::null()", "forward" => "InspectorValue", "header" => "InspectorValues.h", - "JSONType" => "Value" + "JSONType" => "Value", + "JSType" => "" }; $typeTransform{"String"} = { "param" => "const String&", "variable" => "String", "return" => "String", "defaultValue" => "\"\"", - "forwardHeader" => "wtf/Forward.h", + "forwardHeader" => "PlatformString.h", "header" => "PlatformString.h", - "JSONType" => "String" + "JSONType" => "String", + "JSType" => "string" }; $typeTransform{"long"} = { "param" => "long", @@ -120,7 +133,8 @@ $typeTransform{"long"} = { "defaultValue" => "0", "forward" => "", "header" => "", - "JSONType" => "Number" + "JSONType" => "Number", + "JSType" => "number" }; $typeTransform{"int"} = { "param" => "int", @@ -129,6 +143,7 @@ $typeTransform{"int"} = { "forward" => "", "header" => "", "JSONType" => "Number", + "JSType" => "number" }; $typeTransform{"unsigned long"} = { "param" => "unsigned long", @@ -136,7 +151,8 @@ $typeTransform{"unsigned long"} = { "defaultValue" => "0u", "forward" => "", "header" => "", - "JSONType" => "Number" + "JSONType" => "Number", + "JSType" => "number" }; $typeTransform{"unsigned int"} = { "param" => "unsigned int", @@ -144,7 +160,8 @@ $typeTransform{"unsigned int"} = { "defaultValue" => "0u", "forward" => "", "header" => "", - "JSONType" => "Number" + "JSONType" => "Number", + "JSType" => "number" }; $typeTransform{"double"} = { "param" => "double", @@ -152,7 +169,8 @@ $typeTransform{"double"} = { "defaultValue" => "0.0", "forward" => "", "header" => "", - "JSONType" => "Number" + "JSONType" => "Number", + "JSType" => "number" }; $typeTransform{"boolean"} = { "param" => "bool", @@ -160,7 +178,8 @@ $typeTransform{"boolean"} = { "defaultValue" => "false", "forward" => "", "header" => "", - "JSONType" => "Boolean" + "JSONType" => "Boolean", + "JSType" => "boolean" }; $typeTransform{"void"} = { "forward" => "", @@ -250,12 +269,13 @@ sub GenerateInterface $backendClassName = $className . "BackendDispatcher"; $backendJSStubName = $className . "BackendStub"; my @backendHead; - push(@backendHead, " ${backendClassName}(InspectorController* inspectorController) : m_inspectorController(inspectorController) { }"); + push(@backendHead, " typedef InspectorController InspectorAgent;"); # FIXME: Temporary substitution until extracting InspectorAgent from InspectorController. + push(@backendHead, " ${backendClassName}(InspectorAgent* inspectorAgent) : m_inspectorAgent(inspectorAgent) { }"); push(@backendHead, " void reportProtocolError(const long callId, const String& errorText) const;"); push(@backendHead, " void dispatch(const String& message);"); push(@backendHead, " static bool getCommandName(const String& message, String* result);"); $backendConstructor = join("\n", @backendHead); - $backendFooter = " InspectorController* m_inspectorController;"; + $backendFooter = " InspectorAgent* m_inspectorAgent;"; $backendTypes{"Inspector"} = 1; $backendTypes{"InspectorClient"} = 1; $backendTypes{"PassRefPtr"} = 1; @@ -392,7 +412,7 @@ sub generateBackendFunction } push(@function, " // use InspectorFrontend as a marker of WebInspector availability"); - push(@function, " if ((callId || protocolErrors->length()) && m_inspectorController->hasFrontend()) {"); + push(@function, " if ((callId || protocolErrors->length()) && m_inspectorAgent->hasFrontend()) {"); push(@function, " RefPtr<InspectorObject> responseMessage = InspectorObject::create();"); push(@function, " responseMessage->setNumber(\"seq\", callId);"); push(@function, " responseMessage->setString(\"domain\", \"$domain\");"); @@ -407,7 +427,7 @@ sub generateBackendFunction push(@function, " responseMessage->setObject(\"data\", responseData);"); push(@function, " }"); } - push(@function, " m_inspectorController->inspectorClient()->sendMessageToFrontend(responseMessage->toJSONString());"); + push(@function, " m_inspectorAgent->inspectorClient()->sendMessageToFrontend(responseMessage->toJSONString());"); push(@function, " }"); @@ -428,7 +448,7 @@ void ${backendClassName}::reportProtocolError(const long callId, const String& e RefPtr<InspectorArray> errors = InspectorArray::create(); errors->pushString(errorText); message->setArray("errors", errors); - m_inspectorController->inspectorClient()->sendMessageToFrontend(message->toJSONString()); + m_inspectorAgent->inspectorClient()->sendMessageToFrontend(message->toJSONString()); } EOF return split("\n", $reportProtocolError); @@ -567,7 +587,7 @@ sub generateBackendStubJS foreach my $function (@backendFunctions) { my $name = $function->signature->name; my $domain = $function->signature->extendedAttributes->{"domain"}; - my $argumentNames = join(",", map("\"" . $_->name . "\": \"" . lc($typeTransform{$_->type}->{"JSONType"}) . "\"", grep($_->direction eq "in", @{$function->parameters}))); + my $argumentNames = join(",", map("\"" . $_->name . "\": \"" . $typeTransform{$_->type}->{"JSType"} . "\"", grep($_->direction eq "in", @{$function->parameters}))); push(@JSStubs, " this._registerDelegate('{" . "\"seq\": 0, " . "\"domain\": \"$domain\", " . @@ -625,7 +645,7 @@ InspectorBackendStub.prototype = { return; } var value = args.shift(); - if (typeof value !== request.arguments[key]) { + if (request.arguments[key] && typeof value !== request.arguments[key]) { console.error("Protocol Error: Invalid type of argument '%s' for 'InspectorBackend.%s' call. It should be '%s' but it is '%s'.", key, request.command, request.arguments[key], typeof value); return; } diff --git a/Source/WebCore/inspector/ConsoleMessage.h b/Source/WebCore/inspector/ConsoleMessage.h index 310aa8e..7c3348b 100644 --- a/Source/WebCore/inspector/ConsoleMessage.h +++ b/Source/WebCore/inspector/ConsoleMessage.h @@ -46,7 +46,8 @@ class ScriptCallFrame; class ScriptCallStack; class ScriptValue; -class ConsoleMessage : public Noncopyable { +class ConsoleMessage { + WTF_MAKE_NONCOPYABLE(ConsoleMessage); WTF_MAKE_FAST_ALLOCATED; public: ConsoleMessage(MessageSource, MessageType, MessageLevel, const String& m, unsigned li, const String& u); ConsoleMessage(MessageSource, MessageType, MessageLevel, const String& m, PassRefPtr<ScriptArguments>, PassRefPtr<ScriptCallStack>); diff --git a/Source/WebCore/inspector/InjectedScript.cpp b/Source/WebCore/inspector/InjectedScript.cpp index 3f4d819..1969f34 100644 --- a/Source/WebCore/inspector/InjectedScript.cpp +++ b/Source/WebCore/inspector/InjectedScript.cpp @@ -44,21 +44,94 @@ InjectedScript::InjectedScript(ScriptObject injectedScriptObject) { } -void InjectedScript::dispatch(const String& methodName, const String& arguments, RefPtr<InspectorValue>* result, bool* hadException) +void InjectedScript::evaluate(const String& expression, const String& objectGroup, RefPtr<InspectorValue>* result) { - ASSERT(!hasNoValue()); - if (!canAccessInspectedWindow()) { - *hadException = true; - return; - } + ScriptFunctionCall function(m_injectedScriptObject, "evaluate"); + function.appendArgument(expression); + function.appendArgument(objectGroup); + makeCall(function, result); +} - ScriptFunctionCall function(m_injectedScriptObject, "dispatch"); - function.appendArgument(methodName); - function.appendArgument(arguments); - *hadException = false; - ScriptValue resultValue = function.call(*hadException); - if (!*hadException) - *result = resultValue.toInspectorValue(m_injectedScriptObject.scriptState()); +void InjectedScript::evaluateOnCallFrame(PassRefPtr<InspectorObject> callFrameId, const String& expression, const String& objectGroup, RefPtr<InspectorValue>* result) +{ + ScriptFunctionCall function(m_injectedScriptObject, "evaluateOnCallFrame"); + function.appendArgument(callFrameId->toJSONString()); + function.appendArgument(expression); + function.appendArgument(objectGroup); + makeCall(function, result); +} + +void InjectedScript::evaluateOnSelf(const String& functionBody, PassRefPtr<InspectorArray> argumentsArray, RefPtr<InspectorValue>* result) +{ + ScriptFunctionCall function(m_injectedScriptObject, "evaluateOnSelf"); + function.appendArgument(functionBody); + function.appendArgument(argumentsArray->toJSONString()); + makeCall(function, result); +} + +void InjectedScript::getCompletions(const String& expression, bool includeInspectorCommandLineAPI, RefPtr<InspectorValue>* result) +{ + ScriptFunctionCall function(m_injectedScriptObject, "getCompletions"); + function.appendArgument(expression); + function.appendArgument(includeInspectorCommandLineAPI); + makeCall(function, result); +} + +void InjectedScript::getCompletionsOnCallFrame(PassRefPtr<InspectorObject> callFrameId, const String& expression, bool includeInspectorCommandLineAPI, RefPtr<InspectorValue>* result) +{ + ScriptFunctionCall function(m_injectedScriptObject, "getCompletionsOnCallFrame"); + function.appendArgument(callFrameId->toJSONString()); + function.appendArgument(expression); + function.appendArgument(includeInspectorCommandLineAPI); + makeCall(function, result); +} + +void InjectedScript::getProperties(PassRefPtr<InspectorObject> objectId, bool ignoreHasOwnProperty, bool abbreviate, RefPtr<InspectorValue>* result) +{ + ScriptFunctionCall function(m_injectedScriptObject, "getProperties"); + String objectIdString = objectId->toJSONString(); + function.appendArgument(objectIdString); + function.appendArgument(ignoreHasOwnProperty); + function.appendArgument(abbreviate); + makeCall(function, result); +} + +void InjectedScript::pushNodeToFrontend(PassRefPtr<InspectorObject> objectId, RefPtr<InspectorValue>* result) +{ + ScriptFunctionCall function(m_injectedScriptObject, "pushNodeToFrontend"); + function.appendArgument(objectId->toJSONString()); + makeCall(function, result); +} + +void InjectedScript::resolveNode(long nodeId, RefPtr<InspectorValue>* result) +{ + ScriptFunctionCall function(m_injectedScriptObject, "resolveNode"); + function.appendArgument(nodeId); + makeCall(function, result); +} + +void InjectedScript::getNodeProperties(long nodeId, PassRefPtr<InspectorArray> propertiesArray, RefPtr<InspectorValue>* result) +{ + ScriptFunctionCall function(m_injectedScriptObject, "getNodeProperties"); + function.appendArgument(nodeId); + function.appendArgument(propertiesArray->toJSONString()); + makeCall(function, result); +} + +void InjectedScript::getNodePrototypes(long nodeId, RefPtr<InspectorValue>* result) +{ + ScriptFunctionCall function(m_injectedScriptObject, "getNodePrototypes"); + function.appendArgument(nodeId); + makeCall(function, result); +} + +void InjectedScript::setPropertyValue(PassRefPtr<InspectorObject> objectId, const String& propertyName, const String& expression, RefPtr<InspectorValue>* result) +{ + ScriptFunctionCall function(m_injectedScriptObject, "getNodeProperties"); + function.appendArgument(objectId->toJSONString()); + function.appendArgument(propertyName); + function.appendArgument(expression); + makeCall(function, result); } #if ENABLE(JAVASCRIPT_DEBUGGER) @@ -91,11 +164,29 @@ void InjectedScript::releaseWrapperObjectGroup(const String& objectGroup) releaseFunction.appendArgument(objectGroup); releaseFunction.call(); } + bool InjectedScript::canAccessInspectedWindow() { return InjectedScriptHost::canAccessInspectedWindow(m_injectedScriptObject.scriptState()); } +void InjectedScript::makeCall(ScriptFunctionCall& function, RefPtr<InspectorValue>* result) +{ + if (hasNoValue() || !canAccessInspectedWindow()) { + *result = InspectorValue::null(); + return; + } + + bool hadException = false; + ScriptValue resultValue = function.call(hadException); + + ASSERT(!hadException); + if (!hadException) + *result = resultValue.toInspectorValue(m_injectedScriptObject.scriptState()); + else + *result = InspectorValue::null(); +} + } // namespace WebCore #endif // ENABLE(INSPECTOR) diff --git a/Source/WebCore/inspector/InjectedScript.h b/Source/WebCore/inspector/InjectedScript.h index f80cfb4..0a3f24b 100644 --- a/Source/WebCore/inspector/InjectedScript.h +++ b/Source/WebCore/inspector/InjectedScript.h @@ -36,10 +36,12 @@ #include <wtf/Forward.h> #include <wtf/Noncopyable.h> #include <wtf/PassRefPtr.h> +#include <wtf/RefPtr.h> namespace WebCore { class InspectorValue; +class ScriptFunctionCall; class InjectedScript { public: @@ -48,10 +50,22 @@ public: bool hasNoValue() const { return m_injectedScriptObject.hasNoValue(); } - void dispatch(const String& methodName, const String& arguments, RefPtr<InspectorValue>* result, bool* hadException); + void evaluate(const String& expression, const String& objectGroup, RefPtr<InspectorValue>* result); + void evaluateOnCallFrame(PassRefPtr<InspectorObject> callFrameId, const String& expression, const String& objectGroup, RefPtr<InspectorValue>* result); + void evaluateOnSelf(const String& functionBody, PassRefPtr<InspectorArray> argumentsArray, RefPtr<InspectorValue>* result); + void getCompletions(const String& expression, bool includeInspectorCommandLineAPI, RefPtr<InspectorValue>* result); + void getCompletionsOnCallFrame(PassRefPtr<InspectorObject> callFrameId, const String& expression, bool includeInspectorCommandLineAPI, RefPtr<InspectorValue>* result); + void getProperties(PassRefPtr<InspectorObject> objectId, bool ignoreHasOwnProperty, bool abbreviate, RefPtr<InspectorValue>* result); + void pushNodeToFrontend(PassRefPtr<InspectorObject> objectId, RefPtr<InspectorValue>* result); + void resolveNode(long nodeId, RefPtr<InspectorValue>* result); + void getNodeProperties(long nodeId, PassRefPtr<InspectorArray> propertiesArray, RefPtr<InspectorValue>* result); + void getNodePrototypes(long nodeId, RefPtr<InspectorValue>* result); + void setPropertyValue(PassRefPtr<InspectorObject> objectId, const String& propertyName, const String& expression, RefPtr<InspectorValue>* result); + #if ENABLE(JAVASCRIPT_DEBUGGER) PassRefPtr<InspectorValue> callFrames(); #endif + PassRefPtr<InspectorValue> wrapForConsole(ScriptValue); void releaseWrapperObjectGroup(const String&); ScriptState* scriptState() const { return m_injectedScriptObject.scriptState(); } @@ -60,6 +74,9 @@ private: friend InjectedScript InjectedScriptHost::injectedScriptFor(ScriptState*); explicit InjectedScript(ScriptObject); bool canAccessInspectedWindow(); + + void makeCall(ScriptFunctionCall&, RefPtr<InspectorValue>* result); + ScriptObject m_injectedScriptObject; }; diff --git a/Source/WebCore/inspector/InjectedScriptHost.cpp b/Source/WebCore/inspector/InjectedScriptHost.cpp index 3fd70e4..d67adaf 100644 --- a/Source/WebCore/inspector/InjectedScriptHost.cpp +++ b/Source/WebCore/inspector/InjectedScriptHost.cpp @@ -30,22 +30,21 @@ #include "config.h" #include "InjectedScriptHost.h" -#include "InjectedScriptSource.h" -#include "InspectorDatabaseAgent.h" -#include "InspectorDOMStorageAgent.h" #if ENABLE(INSPECTOR) - #include "Element.h" #include "Frame.h" #include "FrameLoader.h" #include "HTMLFrameOwnerElement.h" #include "InjectedScript.h" +#include "InjectedScriptSource.h" #include "InspectorClient.h" #include "InspectorConsoleAgent.h" #include "InspectorController.h" #include "InspectorDOMAgent.h" +#include "InspectorDOMStorageAgent.h" +#include "InspectorDatabaseAgent.h" #include "InspectorFrontend.h" #include "Pasteboard.h" @@ -81,6 +80,13 @@ InjectedScriptHost::~InjectedScriptHost() { } +void InjectedScriptHost::evaluateOnSelf(const String& functionBody, PassRefPtr<InspectorArray> argumentsArray, RefPtr<InspectorValue>* result) +{ + InjectedScript injectedScript = injectedScriptForMainFrame(); + if (!injectedScript.hasNoValue()) + injectedScript.evaluateOnSelf(functionBody, argumentsArray, result); +} + void InjectedScriptHost::clearConsoleMessages() { if (m_inspectorController) @@ -124,23 +130,23 @@ long InjectedScriptHost::inspectedNode(unsigned long num) #if ENABLE(DATABASE) Database* InjectedScriptHost::databaseForId(long databaseId) { - if (m_inspectorController && m_inspectorController->m_databaseAgent) - return m_inspectorController->m_databaseAgent->databaseForId(databaseId); + if (m_inspectorController && m_inspectorController->databaseAgent()) + return m_inspectorController->databaseAgent()->databaseForId(databaseId); return 0; } void InjectedScriptHost::selectDatabase(Database* database) { - if (m_inspectorController && m_inspectorController->m_databaseAgent) - m_inspectorController->m_databaseAgent->selectDatabase(database); + if (m_inspectorController && m_inspectorController->databaseAgent()) + m_inspectorController->databaseAgent()->selectDatabase(database); } #endif #if ENABLE(DOM_STORAGE) void InjectedScriptHost::selectDOMStorage(Storage* storage) { - if (m_inspectorController && m_inspectorController->m_domStorageAgent) - m_inspectorController->m_domStorageAgent->selectDOMStorage(storage); + if (m_inspectorController && m_inspectorController->domStorageAgent()) + m_inspectorController->domStorageAgent()->selectDOMStorage(storage); } #endif @@ -149,6 +155,20 @@ InjectedScript InjectedScriptHost::injectedScriptForId(long id) return m_idToInjectedScript.get(id); } +InjectedScript InjectedScriptHost::injectedScriptForObjectId(InspectorObject* objectId) +{ + long injectedScriptId = 0; + bool success = objectId->getNumber("injectedScriptId", &injectedScriptId); + if (success) + return injectedScriptForId(injectedScriptId); + return InjectedScript(); +} + +InjectedScript InjectedScriptHost::injectedScriptForMainFrame() +{ + return injectedScriptFor(mainWorldScriptState(m_inspectorController->inspectedPage()->mainFrame())); +} + void InjectedScriptHost::discardInjectedScripts() { IdToInjectedScriptMap::iterator end = m_idToInjectedScript.end(); @@ -174,14 +194,14 @@ InspectorDOMAgent* InjectedScriptHost::inspectorDOMAgent() { if (!m_inspectorController) return 0; - return m_inspectorController->m_domAgent.get(); + return m_inspectorController->domAgent(); } InspectorFrontend* InjectedScriptHost::frontend() { if (!m_inspectorController) return 0; - return m_inspectorController->m_frontend.get(); + return m_inspectorController->frontend(); } String InjectedScriptHost::injectedScriptSource() diff --git a/Source/WebCore/inspector/InjectedScriptHost.h b/Source/WebCore/inspector/InjectedScriptHost.h index e9c09aa..108f118 100644 --- a/Source/WebCore/inspector/InjectedScriptHost.h +++ b/Source/WebCore/inspector/InjectedScriptHost.h @@ -44,6 +44,7 @@ class Database; class InjectedScript; class InspectorDOMAgent; class InspectorFrontend; +class InspectorObject; class Node; class ScriptObject; class Storage; @@ -58,6 +59,9 @@ public: ~InjectedScriptHost(); + // Part of the protocol. + void evaluateOnSelf(const String& functionBody, PassRefPtr<InspectorArray> argumentsArray, RefPtr<InspectorValue>* result); + InspectorController* inspectorController() { return m_inspectorController; } void disconnectController() { m_inspectorController = 0; } @@ -84,6 +88,8 @@ public: pair<long, ScriptObject> injectScript(const String& source, ScriptState*); InjectedScript injectedScriptFor(ScriptState*); InjectedScript injectedScriptForId(long); + InjectedScript injectedScriptForObjectId(InspectorObject* objectId); + InjectedScript injectedScriptForMainFrame(); void discardInjectedScripts(); void releaseWrapperObjectGroup(long injectedScriptId, const String& objectGroup); diff --git a/Source/WebCore/inspector/InjectedScriptSource.js b/Source/WebCore/inspector/InjectedScriptSource.js index 90797fb..3aa24a6 100644 --- a/Source/WebCore/inspector/InjectedScriptSource.js +++ b/Source/WebCore/inspector/InjectedScriptSource.js @@ -60,7 +60,9 @@ InjectedScript.prototype = { this._objectGroups[objectGroupName] = group; } group.push(id); - objectId = this._serializeObjectId(id, objectGroupName); + objectId = { injectedScriptId: injectedScriptId, + id: id, + groupName: objectGroupName }; } return InjectedScript.RemoteObject.fromObject(object, objectId, abbreviate); } catch (e) { @@ -68,18 +70,9 @@ InjectedScript.prototype = { } }, - _serializeObjectId: function(id, groupName) - { - return injectedScriptId + ":" + id + ":" + groupName; - }, - _parseObjectId: function(objectId) { - var tokens = objectId.split(":"); - var parsedObjectId = {}; - parsedObjectId.id = parseInt(tokens[1]); - parsedObjectId.groupName = tokens[2]; - return parsedObjectId; + return eval("(" + objectId + ")"); }, releaseWrapperObjectGroup: function(objectGroupName) @@ -103,26 +96,11 @@ InjectedScript.prototype = { return result; }, - getPrototypes: function(nodeId) - { - this.releaseWrapperObjectGroup("prototypes"); - var node = this._nodeForId(nodeId); - if (!node) - return false; - - var result = []; - var prototype = node; - do { - result.push(this._wrapObject(prototype, "prototypes")); - prototype = prototype.__proto__; - } while (prototype) - return result; - }, - getProperties: function(objectId, ignoreHasOwnProperty, abbreviate) { var parsedObjectId = this._parseObjectId(objectId); var object = this._objectForId(parsedObjectId); + if (!this._isDefined(object)) return false; var properties = []; @@ -208,29 +186,14 @@ InjectedScript.prototype = { return Object.keys(propertyNameSet); }, - getCompletions: function(expression, includeInspectorCommandLineAPI, callFrameId) + getCompletions: function(expression, includeInspectorCommandLineAPI) { var props = {}; try { - var expressionResult; - // Evaluate on call frame if call frame id is available. - if (typeof callFrameId === "number") { - var callFrame = this._callFrameForId(callFrameId); - if (!callFrame) - return props; - if (expression) - expressionResult = this._evaluateOn(callFrame.evaluate, callFrame, expression, true); - else { - // Evaluate into properties in scope of the selected call frame. - var scopeChain = callFrame.scopeChain; - for (var i = 0; i < scopeChain.length; ++i) - this._populatePropertyNames(scopeChain[i], props); - } - } else { - if (!expression) - expression = "this"; - expressionResult = this._evaluateOn(inspectedWindow.eval, inspectedWindow, expression, false); - } + if (!expression) + expression = "this"; + var expressionResult = this._evaluateOn(inspectedWindow.eval, inspectedWindow, expression, false); + if (typeof expressionResult === "object") this._populatePropertyNames(expressionResult, props); @@ -243,6 +206,34 @@ InjectedScript.prototype = { return props; }, + getCompletionsOnCallFrame: function(callFrameId, expression, includeInspectorCommandLineAPI) + { + var props = {}; + try { + var callFrame = this._callFrameForId(callFrameId); + if (!callFrame) + return props; + + if (expression) { + var expressionResult = this._evaluateOn(callFrame.evaluate, callFrame, expression, true); + if (typeof expressionResult === "object") + this._populatePropertyNames(expressionResult, props); + } else { + // Evaluate into properties in scope of the selected call frame. + var scopeChain = callFrame.scopeChain; + for (var i = 0; i < scopeChain.length; ++i) + this._populatePropertyNames(scopeChain[i], props); + } + + if (includeInspectorCommandLineAPI) { + for (var prop in this._commandLineAPI) + props[prop] = true; + } + } catch(e) { + } + return props; + }, + evaluate: function(expression, objectGroup) { return this._evaluateAndWrap(inspectedWindow.eval, inspectedWindow, expression, objectGroup, false); @@ -300,7 +291,7 @@ InjectedScript.prototype = { return result; }, - evaluateInCallFrame: function(callFrameId, code, objectGroup) + evaluateOnCallFrame: function(callFrameId, code, objectGroup) { var callFrame = this._callFrameForId(callFrameId); if (!callFrame) @@ -308,10 +299,12 @@ InjectedScript.prototype = { return this._evaluateAndWrap(callFrame.evaluate, callFrame, code, objectGroup, true); }, - _callFrameForId: function(id) + _callFrameForId: function(callFrameId) { + var parsedCallFrameId = eval("(" + callFrameId + ")"); + var ordinal = parsedCallFrameId.ordinal; var callFrame = InjectedScriptHost.currentCallFrame(); - while (--id >= 0 && callFrame) + while (--ordinal >= 0 && callFrame) callFrame = callFrame.caller; return callFrame; }, @@ -323,9 +316,9 @@ InjectedScript.prototype = { return InjectedScriptHost.nodeForId(nodeId); }, - _objectForId: function(parsedObjectId) + _objectForId: function(objectId) { - return this._idToWrappedObject[parsedObjectId.id]; + return this._idToWrappedObject[objectId.id]; }, resolveNode: function(nodeId) @@ -342,12 +335,29 @@ InjectedScript.prototype = { var node = this._nodeForId(nodeId); if (!node) return false; + properties = eval("(" + properties + ")"); var result = {}; for (var i = 0; i < properties.length; ++i) result[properties[i]] = node[properties[i]]; return result; }, + getNodePrototypes: function(nodeId) + { + this.releaseWrapperObjectGroup("prototypes"); + var node = this._nodeForId(nodeId); + if (!node) + return false; + + var result = []; + var prototype = node; + do { + result.push(this._wrapObject(prototype, "prototypes")); + prototype = prototype.__proto__; + } while (prototype) + return result; + }, + pushNodeToFrontend: function(objectId) { var parsedObjectId = this._parseObjectId(objectId); @@ -359,8 +369,8 @@ InjectedScript.prototype = { evaluateOnSelf: function(funcBody, args) { - var func = window.eval("(" + funcBody + ")"); - return func.apply(this, args || []); + var func = eval("(" + funcBody + ")"); + return func.apply(this, eval("(" + args + ")") || []); }, _isDefined: function(object) @@ -536,15 +546,15 @@ InjectedScript.RemoteObject.fromObject = function(object, objectId, abbreviate) } } -InjectedScript.CallFrameProxy = function(id, callFrame) +InjectedScript.CallFrameProxy = function(ordinal, callFrame) { - this.id = id; + this.id = { ordinal: ordinal, injectedScriptId: injectedScriptId }; this.type = callFrame.type; this.functionName = (this.type === "function" ? callFrame.functionName : ""); this.sourceID = callFrame.sourceID; this.line = callFrame.line; + this.column = callFrame.column; this.scopeChain = this._wrapScopeChain(callFrame); - this.worldId = injectedScriptId; } InjectedScript.CallFrameProxy.prototype = { diff --git a/Source/WebCore/inspector/Inspector.idl b/Source/WebCore/inspector/Inspector.idl index 6c2cc2e..79b33f6 100644 --- a/Source/WebCore/inspector/Inspector.idl +++ b/Source/WebCore/inspector/Inspector.idl @@ -36,13 +36,8 @@ module core { // generic Inspector's methods /////////////////////////////////////////////////////////////////////// - // HUGE FIXME: we need to expose InjectedScript methods here. Or document InjectedScript capabilities. - [domain=Inspector] void dispatchOnInjectedScript(in long injectedScriptId, in String methodName, in String arguments, out Value result, out boolean isException); [domain=Inspector] void addScriptToEvaluateOnLoad(in String scriptSource); [domain=Inspector] void removeAllScriptsToEvaluateOnLoad(); - [domain=Inspector] void releaseWrapperObjectGroup(in long injectedScriptId, in String objectGroup); - [domain=Inspector] void getInspectorState(out Object state); - [domain=Inspector] void setMonitoringXHREnabled(in boolean enable, out boolean newState); [domain=Inspector] void reloadPage(); [domain=Inspector] void populateScriptObjects(); @@ -73,6 +68,22 @@ module core { [domain=Inspector] void deleteCookie(in String cookieName, in String domain); /////////////////////////////////////////////////////////////////////// + // Runtime + /////////////////////////////////////////////////////////////////////// + + [domain=Runtime] void evaluate(in String expression, in String objectGroup, out Value result); + [domain=Runtime] void getCompletions(in String expression, in boolean includeInspectorCommandLineAPI, out Value result); + [domain=Runtime] void getProperties(in Object objectId, in boolean ignoreHasOwnProperty, in boolean abbreviate, out Value result); + [domain=Runtime] void setPropertyValue(in Object objectId, in String propertyName, in String expression, out Value result); + [domain=Runtime] void releaseWrapperObjectGroup(in long injectedScriptId, in String objectGroup); + + /////////////////////////////////////////////////////////////////////// + // Injected Script + /////////////////////////////////////////////////////////////////////// + + [domain=InjectedScript] void evaluateOnSelf(in String functionBody, in Array argumentsArray, out Value result); + + /////////////////////////////////////////////////////////////////////// // Console API /////////////////////////////////////////////////////////////////////// @@ -82,6 +93,8 @@ module core { [notify, domain=Console] void updateConsoleMessageRepeatCount(out unsigned long count); [domain=Console] void clearConsoleMessages(); [notify, domain=Console] void consoleMessagesCleared(); + [domain=Console] void setMonitoringXHREnabled(in boolean enabled); + [notify, domain=Console] void monitoringXHRStateChanged(out boolean enabled); /////////////////////////////////////////////////////////////////////// // Network API @@ -89,8 +102,8 @@ module core { [domain=Network] void cachedResources(out Object resources); [domain=Network] void resourceContent(in unsigned long frameId, in String url, in boolean base64Encode, out String content); - [notify, domain=Network] void frameDetachedFromParent(out unsigned long frameId); + [notify, domain=Network] void frameDetachedFromParent(out unsigned long frameId); [notify, domain=Network] void identifierForInitialRequest(out long identifier, out String url, out Object loader, out Value callStack); [notify, domain=Network] void willSendRequest(out long identifier, out double time, out Object request, out Object redirectResponse); [notify, domain=Network] void markResourceAsCached(out long identifier); @@ -112,10 +125,11 @@ module core { // Database API /////////////////////////////////////////////////////////////////////// - [notify, domain=Database] void addDatabase(out Object database); - [notify, domain=Database] void selectDatabase(out int databaseId); [domain=Database] void getDatabaseTableNames(in long databaseId, out Array tableNames); [domain=Database] void executeSQL(in long databaseId, in String query, out boolean success, out long transactionId); + + [notify, domain=Database] void addDatabase(out Object database); + [notify, domain=Database] void selectDatabase(out int databaseId); [notify, domain=Database] void sqlTransactionSucceeded(out long transactionId, out Value columnNames, out Value values); [notify, domain=Database] void sqlTransactionFailed(out long transactionId, out Value sqlError); #endif @@ -177,6 +191,10 @@ module core { [domain=DOM] void performSearch(in String query, in boolean runSynchronously); [domain=DOM] void searchCanceled(); [domain=DOM] void pushNodeByPathToFrontend(in String path, out long nodeId); + [domain=DOM] void resolveNode(in long nodeId, out Value result); + [domain=DOM] void getNodeProperties(in long nodeId, in Array propertiesArray, out Value result); + [domain=DOM] void getNodePrototypes(in long nodeId, out Value result); + [domain=DOM] void pushNodeToFrontend(in Object objectId, out Value result); [notify, domain=DOM] void setDocument(out Value root); // FIXME: should be requested from the front-end as getDocument. [notify, domain=DOM] void attributesUpdated(out long id, out Array attributes); @@ -224,12 +242,12 @@ module core { [domain=Inspector] void enableDebugger(in boolean always); [domain=Inspector] void disableDebugger(in boolean always); - [domain=Inspector] void setStickyBreakpoints(in Object breakpoints); + [domain=Inspector] void setAllBrowserBreakpoints(in Object breakpoints); [notify, domain=Debugger] void debuggerWasEnabled(); [notify, domain=Debugger] void debuggerWasDisabled(); - [notify, domain=Debugger] void parsedScriptSource(out String sourceID, out String url, out int lineOffset, out int columnOffset, out int scriptWorldType); + [notify, domain=Debugger] void parsedScriptSource(out String sourceID, out String url, out int lineOffset, out int columnOffset, out int length, out int scriptWorldType); [notify, domain=Debugger] void failedToParseScriptSource(out String url, out String data, out int firstLine, out int errorLine, out String errorMessage); [domain=Debugger] void activateBreakpoints(); @@ -251,13 +269,16 @@ module core { [domain=Debugger] void pause(); [notify, domain=Debugger] void pausedScript(out Object details); [domain=Debugger] void resume(); - [notify, domain=Debugger] void resumedScript(); // FIXME: Make this out parameter fo resume if possible. - - [domain=Debugger] void setPauseOnExceptionsState(in long pauseOnExceptionsState, out long newState); + [notify, domain=Debugger] void resumedScript(); // FIXME: Make this out parameter of resume if possible. [domain=Debugger] void editScriptSource(in String sourceID, in String newContent, out boolean success, out String result, out Value newCallFrames); [domain=Debugger] void getScriptSource(in String sourceID, out String scriptSource); + [domain=Debugger] void setPauseOnExceptionsState(in long pauseOnExceptionsState, out long newState); + + [domain=Debugger] void evaluateOnCallFrame(in Object callFrameId, in String expression, in String objectGroup, out Value result); + [domain=Debugger] void getCompletionsOnCallFrame(in Object callFrameId, in String expression, in boolean includeInspectorCommandLineAPI, out Value result); + [notify, domain=Debugger] void breakpointResolved(out String breakpointId, out String sourceID, out unsigned int lineNumber, out String condition, out boolean enabled, out unsigned int originalLineNumber); #if defined(ENABLE_WORKERS) && ENABLE_WORKERS @@ -269,7 +290,7 @@ module core { // Profiler API /////////////////////////////////////////////////////////////////////// - [domain=Inspector] void enableProfiler(in boolean always); // FIXME: preferrable with Inspector domain, dispatched on backend. + [domain=Inspector] void enableProfiler(in boolean always); [domain=Inspector] void disableProfiler(in boolean always); [notify, domain=Profiler] void profilerWasEnabled(); [notify, domain=Profiler] void profilerWasDisabled(); diff --git a/Source/WebCore/inspector/InspectorApplicationCacheAgent.h b/Source/WebCore/inspector/InspectorApplicationCacheAgent.h index 3d9e494..ac0acbf 100644 --- a/Source/WebCore/inspector/InspectorApplicationCacheAgent.h +++ b/Source/WebCore/inspector/InspectorApplicationCacheAgent.h @@ -41,7 +41,8 @@ class InspectorObject; class InspectorValue; class ResourceResponse; -class InspectorApplicationCacheAgent : public Noncopyable { +class InspectorApplicationCacheAgent { + WTF_MAKE_NONCOPYABLE(InspectorApplicationCacheAgent); WTF_MAKE_FAST_ALLOCATED; public: InspectorApplicationCacheAgent(InspectorController* inspectorController, InspectorFrontend* frontend); ~InspectorApplicationCacheAgent() { } diff --git a/Source/WebCore/inspector/InspectorBrowserDebuggerAgent.cpp b/Source/WebCore/inspector/InspectorBrowserDebuggerAgent.cpp index a33bacc..023dc49 100644 --- a/Source/WebCore/inspector/InspectorBrowserDebuggerAgent.cpp +++ b/Source/WebCore/inspector/InspectorBrowserDebuggerAgent.cpp @@ -71,9 +71,71 @@ InspectorBrowserDebuggerAgent::~InspectorBrowserDebuggerAgent() { } +void InspectorBrowserDebuggerAgent::inspectedURLChanged(const KURL& url) +{ + m_eventListenerBreakpoints.clear(); + m_XHRBreakpoints.clear(); + m_hasXHRBreakpointWithEmptyURL = false; + + RefPtr<InspectorObject> allBreakpoints = m_inspectorController->state()->getObject(InspectorState::browserBreakpoints); + KURL urlCopy = url; + urlCopy.removeFragmentIdentifier(); + RefPtr<InspectorArray> breakpoints = allBreakpoints->getArray(urlCopy); + if (!breakpoints) + return; + for (unsigned i = 0; i < breakpoints->length(); ++i) + restoreStickyBreakpoint(breakpoints->get(i)->asObject()); +} + +void InspectorBrowserDebuggerAgent::restoreStickyBreakpoint(PassRefPtr<InspectorObject> breakpoint) +{ + DEFINE_STATIC_LOCAL(String, eventListenerBreakpointType, ("EventListener")); + DEFINE_STATIC_LOCAL(String, javaScriptBreakpointType, ("JS")); + DEFINE_STATIC_LOCAL(String, xhrBreakpointType, ("XHR")); + + if (!breakpoint) + return; + String type; + if (!breakpoint->getString("type", &type)) + return; + bool enabled; + if (!breakpoint->getBoolean("enabled", &enabled)) + return; + RefPtr<InspectorObject> condition = breakpoint->getObject("condition"); + if (!condition) + return; + + if (type == eventListenerBreakpointType) { + if (!enabled) + return; + String eventName; + if (!condition->getString("eventName", &eventName)) + return; + setEventListenerBreakpoint(eventName); + } else if (type == javaScriptBreakpointType && m_inspectorController->debuggerAgent()) { + String url; + if (!condition->getString("url", &url)) + return; + double lineNumber; + if (!condition->getNumber("lineNumber", &lineNumber)) + return; + String javaScriptCondition; + if (!condition->getString("condition", &javaScriptCondition)) + return; + m_inspectorController->debuggerAgent()->setStickyBreakpoint(url, static_cast<unsigned>(lineNumber), javaScriptCondition, enabled); + } else if (type == xhrBreakpointType) { + if (!enabled) + return; + String url; + if (!condition->getString("url", &url)) + return; + setXHRBreakpoint(url); + } +} + void InspectorBrowserDebuggerAgent::discardBindings() { - m_breakpoints.clear(); + m_domBreakpoints.clear(); } void InspectorBrowserDebuggerAgent::setEventListenerBreakpoint(const String& eventName) @@ -88,8 +150,8 @@ void InspectorBrowserDebuggerAgent::removeEventListenerBreakpoint(const String& void InspectorBrowserDebuggerAgent::didInsertDOMNode(Node* node) { - if (m_breakpoints.size()) { - uint32_t mask = m_breakpoints.get(InspectorDOMAgent::innerParentNode(node)); + if (m_domBreakpoints.size()) { + uint32_t mask = m_domBreakpoints.get(InspectorDOMAgent::innerParentNode(node)); uint32_t inheritableTypesMask = (mask | (mask >> domBreakpointDerivedTypeShift)) & inheritableDOMBreakpointTypesMask; if (inheritableTypesMask) updateSubtreeBreakpoints(node, inheritableTypesMask, true); @@ -98,16 +160,16 @@ void InspectorBrowserDebuggerAgent::didInsertDOMNode(Node* node) void InspectorBrowserDebuggerAgent::didRemoveDOMNode(Node* node) { - if (m_breakpoints.size()) { + if (m_domBreakpoints.size()) { // Remove subtree breakpoints. - m_breakpoints.remove(node); + m_domBreakpoints.remove(node); Vector<Node*> stack(1, InspectorDOMAgent::innerFirstChild(node)); do { Node* node = stack.last(); stack.removeLast(); if (!node) continue; - m_breakpoints.remove(node); + m_domBreakpoints.remove(node); stack.append(InspectorDOMAgent::innerFirstChild(node)); stack.append(InspectorDOMAgent::innerNextSibling(node)); } while (!stack.isEmpty()); @@ -116,12 +178,12 @@ void InspectorBrowserDebuggerAgent::didRemoveDOMNode(Node* node) void InspectorBrowserDebuggerAgent::setDOMBreakpoint(long nodeId, long type) { - Node* node = m_inspectorController->m_domAgent->nodeForId(nodeId); + Node* node = m_inspectorController->domAgent()->nodeForId(nodeId); if (!node) return; uint32_t rootBit = 1 << type; - m_breakpoints.set(node, m_breakpoints.get(node) | rootBit); + m_domBreakpoints.set(node, m_domBreakpoints.get(node) | rootBit); if (rootBit & inheritableDOMBreakpointTypesMask) { for (Node* child = InspectorDOMAgent::innerFirstChild(node); child; child = InspectorDOMAgent::innerNextSibling(child)) updateSubtreeBreakpoints(child, rootBit, true); @@ -130,16 +192,16 @@ void InspectorBrowserDebuggerAgent::setDOMBreakpoint(long nodeId, long type) void InspectorBrowserDebuggerAgent::removeDOMBreakpoint(long nodeId, long type) { - Node* node = m_inspectorController->m_domAgent->nodeForId(nodeId); + Node* node = m_inspectorController->domAgent()->nodeForId(nodeId); if (!node) return; uint32_t rootBit = 1 << type; - uint32_t mask = m_breakpoints.get(node) & ~rootBit; + uint32_t mask = m_domBreakpoints.get(node) & ~rootBit; if (mask) - m_breakpoints.set(node, mask); + m_domBreakpoints.set(node, mask); else - m_breakpoints.remove(node); + m_domBreakpoints.remove(node); if ((rootBit & inheritableDOMBreakpointTypesMask) && !(mask & (rootBit << domBreakpointDerivedTypeShift))) { for (Node* child = InspectorDOMAgent::innerFirstChild(node); child; child = InspectorDOMAgent::innerNextSibling(child)) @@ -149,7 +211,7 @@ void InspectorBrowserDebuggerAgent::removeDOMBreakpoint(long nodeId, long type) void InspectorBrowserDebuggerAgent::willInsertDOMNode(Node*, Node* parent) { - InspectorDebuggerAgent* debuggerAgent = m_inspectorController->m_debuggerAgent.get(); + InspectorDebuggerAgent* debuggerAgent = m_inspectorController->debuggerAgent(); if (!debuggerAgent) return; @@ -163,7 +225,7 @@ void InspectorBrowserDebuggerAgent::willInsertDOMNode(Node*, Node* parent) void InspectorBrowserDebuggerAgent::willRemoveDOMNode(Node* node) { - InspectorDebuggerAgent* debuggerAgent = m_inspectorController->m_debuggerAgent.get(); + InspectorDebuggerAgent* debuggerAgent = m_inspectorController->debuggerAgent(); if (!debuggerAgent) return; @@ -182,7 +244,7 @@ void InspectorBrowserDebuggerAgent::willRemoveDOMNode(Node* node) void InspectorBrowserDebuggerAgent::willModifyDOMAttr(Element* element) { - InspectorDebuggerAgent* debuggerAgent = m_inspectorController->m_debuggerAgent.get(); + InspectorDebuggerAgent* debuggerAgent = m_inspectorController->debuggerAgent(); if (!debuggerAgent) return; @@ -202,7 +264,7 @@ void InspectorBrowserDebuggerAgent::descriptionForDOMEvent(Node* target, long br if ((1 << breakpointType) & inheritableDOMBreakpointTypesMask) { // For inheritable breakpoint types, target node isn't always the same as the node that owns a breakpoint. // Target node may be unknown to frontend, so we need to push it first. - long targetNodeId = m_inspectorController->m_domAgent->pushNodePathToFrontend(target); + long targetNodeId = m_inspectorController->domAgent()->pushNodePathToFrontend(target); ASSERT(targetNodeId); description->setNumber("targetNodeId", targetNodeId); @@ -210,7 +272,7 @@ void InspectorBrowserDebuggerAgent::descriptionForDOMEvent(Node* target, long br if (!insertion) breakpointOwner = InspectorDOMAgent::innerParentNode(target); ASSERT(breakpointOwner); - while (!(m_breakpoints.get(breakpointOwner) & (1 << breakpointType))) { + while (!(m_domBreakpoints.get(breakpointOwner) & (1 << breakpointType))) { breakpointOwner = InspectorDOMAgent::innerParentNode(breakpointOwner); ASSERT(breakpointOwner); } @@ -219,7 +281,7 @@ void InspectorBrowserDebuggerAgent::descriptionForDOMEvent(Node* target, long br description->setBoolean("insertion", insertion); } - long breakpointOwnerNodeId = m_inspectorController->m_domAgent->pushNodePathToFrontend(breakpointOwner); + long breakpointOwnerNodeId = m_inspectorController->domAgent()->pushNodePathToFrontend(breakpointOwner); ASSERT(breakpointOwnerNodeId); description->setNumber("nodeId", breakpointOwnerNodeId); description->setNumber("type", breakpointType); @@ -229,18 +291,18 @@ bool InspectorBrowserDebuggerAgent::hasBreakpoint(Node* node, long type) { uint32_t rootBit = 1 << type; uint32_t derivedBit = rootBit << domBreakpointDerivedTypeShift; - return m_breakpoints.get(node) & (rootBit | derivedBit); + return m_domBreakpoints.get(node) & (rootBit | derivedBit); } void InspectorBrowserDebuggerAgent::updateSubtreeBreakpoints(Node* node, uint32_t rootMask, bool set) { - uint32_t oldMask = m_breakpoints.get(node); + uint32_t oldMask = m_domBreakpoints.get(node); uint32_t derivedMask = rootMask << domBreakpointDerivedTypeShift; uint32_t newMask = set ? oldMask | derivedMask : oldMask & ~derivedMask; if (newMask) - m_breakpoints.set(node, newMask); + m_domBreakpoints.set(node, newMask); else - m_breakpoints.remove(node); + m_domBreakpoints.remove(node); uint32_t newRootMask = rootMask & ~newMask; if (!newRootMask) @@ -252,7 +314,7 @@ void InspectorBrowserDebuggerAgent::updateSubtreeBreakpoints(Node* node, uint32_ void InspectorBrowserDebuggerAgent::pauseOnNativeEventIfNeeded(const String& categoryType, const String& eventName, bool synchronous) { - InspectorDebuggerAgent* debuggerAgent = m_inspectorController->m_debuggerAgent.get(); + InspectorDebuggerAgent* debuggerAgent = m_inspectorController->debuggerAgent(); if (!debuggerAgent) return; @@ -287,7 +349,7 @@ void InspectorBrowserDebuggerAgent::removeXHRBreakpoint(const String& url) void InspectorBrowserDebuggerAgent::willSendXMLHttpRequest(const String& url) { - InspectorDebuggerAgent* debuggerAgent = m_inspectorController->m_debuggerAgent.get(); + InspectorDebuggerAgent* debuggerAgent = m_inspectorController->debuggerAgent(); if (!debuggerAgent) return; @@ -313,13 +375,6 @@ void InspectorBrowserDebuggerAgent::willSendXMLHttpRequest(const String& url) debuggerAgent->breakProgram(NativeBreakpointDebuggerEventType, eventData.release()); } -void InspectorBrowserDebuggerAgent::clearForPageNavigation() -{ - m_eventListenerBreakpoints.clear(); - m_XHRBreakpoints.clear(); - m_hasXHRBreakpointWithEmptyURL = false; -} - } // namespace WebCore #endif // ENABLE(INSPECTOR) && ENABLE(JAVASCRIPT_DEBUGGER) diff --git a/Source/WebCore/inspector/InspectorBrowserDebuggerAgent.h b/Source/WebCore/inspector/InspectorBrowserDebuggerAgent.h index 537bda1..0ffa85c 100644 --- a/Source/WebCore/inspector/InspectorBrowserDebuggerAgent.h +++ b/Source/WebCore/inspector/InspectorBrowserDebuggerAgent.h @@ -46,9 +46,11 @@ namespace WebCore { class Element; class InspectorController; class InspectorObject; +class KURL; class Node; -class InspectorBrowserDebuggerAgent : public Noncopyable { +class InspectorBrowserDebuggerAgent { + WTF_MAKE_NONCOPYABLE(InspectorBrowserDebuggerAgent); public: static PassOwnPtr<InspectorBrowserDebuggerAgent> create(InspectorController* inspectorController) { @@ -57,6 +59,8 @@ public: virtual ~InspectorBrowserDebuggerAgent(); + void inspectedURLChanged(const KURL&); + // BrowserDebugger API for InspectorFrontend void setXHRBreakpoint(const String& url); void removeXHRBreakpoint(const String& url); @@ -74,17 +78,18 @@ public: void willSendXMLHttpRequest(const String& url); void pauseOnNativeEventIfNeeded(const String& categoryType, const String& eventName, bool synchronous); - void clearForPageNavigation(); private: InspectorBrowserDebuggerAgent(InspectorController*); + void restoreStickyBreakpoint(PassRefPtr<InspectorObject> breakpoint); + void descriptionForDOMEvent(Node* target, long breakpointType, bool insertion, InspectorObject* description); void updateSubtreeBreakpoints(Node*, uint32_t rootMask, bool set); bool hasBreakpoint(Node*, long type); void discardBindings(); InspectorController* m_inspectorController; - HashMap<Node*, uint32_t> m_breakpoints; + HashMap<Node*, uint32_t> m_domBreakpoints; HashSet<String> m_eventListenerBreakpoints; HashSet<String> m_XHRBreakpoints; bool m_hasXHRBreakpointWithEmptyURL; diff --git a/Source/WebCore/inspector/InspectorCSSAgent.cpp b/Source/WebCore/inspector/InspectorCSSAgent.cpp index 725a26d..bacf741 100644 --- a/Source/WebCore/inspector/InspectorCSSAgent.cpp +++ b/Source/WebCore/inspector/InspectorCSSAgent.cpp @@ -349,6 +349,8 @@ void InspectorCSSAgent::addRule2(const long contextNodeId, const String& selecto return; InspectorStyleSheet* inspectorStyleSheet = viaInspectorStyleSheet(node->document(), true); + if (!inspectorStyleSheet) + return; CSSStyleRule* newRule = inspectorStyleSheet->addRule(selector); if (!newRule) return; @@ -447,8 +449,17 @@ InspectorStyleSheet* InspectorCSSAgent::viaInspectorStyleSheet(Document* documen RefPtr<Element> styleElement = document->createElement("style", ec); if (!ec) styleElement->setAttribute("type", "text/css", ec); - if (!ec) - document->head()->appendChild(styleElement, ec); + if (!ec) { + ContainerNode* targetNode; + // HEAD is absent in ImageDocuments, for example. + if (document->head()) + targetNode = document->head(); + else if (document->body()) + targetNode = document->body(); + else + return 0; + targetNode->appendChild(styleElement, ec); + } if (ec) return 0; StyleSheetList* styleSheets = document->styleSheets(); diff --git a/Source/WebCore/inspector/InspectorConsoleAgent.cpp b/Source/WebCore/inspector/InspectorConsoleAgent.cpp index a543cb2..2c837f3 100644 --- a/Source/WebCore/inspector/InspectorConsoleAgent.cpp +++ b/Source/WebCore/inspector/InspectorConsoleAgent.cpp @@ -33,6 +33,7 @@ #include "InspectorController.h" #include "InspectorDOMAgent.h" #include "InspectorFrontend.h" +#include "InspectorSettings.h" #include "InspectorState.h" #include "ResourceError.h" #include "ResourceResponse.h" @@ -49,9 +50,8 @@ namespace WebCore { static const unsigned maximumConsoleMessages = 1000; static const unsigned expireConsoleMessagesStep = 100; -InspectorConsoleAgent::InspectorConsoleAgent(InspectorController* inspectorController, InspectorState* state) +InspectorConsoleAgent::InspectorConsoleAgent(InspectorController* inspectorController) : m_inspectorController(inspectorController) - , m_state(state) , m_frontend(0) , m_previousMessage(0) , m_expiredConsoleMessageCount(0) @@ -165,7 +165,7 @@ void InspectorConsoleAgent::resourceRetrievedByXMLHttpRequest(const String& url, { if (!m_inspectorController->enabled()) return; - if (m_state->getBoolean(InspectorState::monitoringXHR)) + if (m_inspectorController->state()->getBoolean(InspectorState::monitoringXHR)) addMessageToConsole(JSMessageSource, LogMessageType, LogMessageLevel, "XHR finished loading: \"" + url + "\".", sendLineNumber, sendURL); } @@ -191,11 +191,21 @@ void InspectorConsoleAgent::didFailLoading(unsigned long identifier, const Resou addConsoleMessage(new ConsoleMessage(OtherMessageSource, NetworkErrorMessageType, ErrorMessageLevel, message, error.failingURL(), identifier)); } +void InspectorConsoleAgent::setMonitoringXHREnabled(bool enabled) +{ + m_inspectorController->state()->setBoolean(InspectorState::monitoringXHR, enabled); + m_inspectorController->settings()->setBoolean(InspectorSettings::MonitoringXHREnabled, enabled); + if (m_frontend) + m_frontend->monitoringXHRStateChanged(enabled); +} + void InspectorConsoleAgent::setConsoleMessagesEnabled(bool enabled) { - m_state->setBoolean(InspectorState::consoleMessagesEnabled, enabled); - if (!m_inspectorController->enabled()) + m_inspectorController->state()->setBoolean(InspectorState::consoleMessagesEnabled, enabled); + if (!enabled || !m_frontend) return; + + m_frontend->monitoringXHRStateChanged(m_inspectorController->state()->getBoolean(InspectorState::monitoringXHR)); if (m_expiredConsoleMessageCount) m_frontend->updateConsoleMessageExpiredCount(m_expiredConsoleMessageCount); unsigned messageCount = m_consoleMessages.size(); @@ -210,12 +220,12 @@ void InspectorConsoleAgent::addConsoleMessage(PassOwnPtr<ConsoleMessage> console if (m_previousMessage && m_previousMessage->isEqual(consoleMessage.get())) { m_previousMessage->incrementCount(); - if (m_state->getBoolean(InspectorState::consoleMessagesEnabled) && m_frontend) + if (m_inspectorController->state()->getBoolean(InspectorState::consoleMessagesEnabled) && m_frontend) m_previousMessage->updateRepeatCountInConsole(m_frontend); } else { m_previousMessage = consoleMessage.get(); m_consoleMessages.append(consoleMessage); - if (m_state->getBoolean(InspectorState::consoleMessagesEnabled) && m_frontend) + if (m_inspectorController->state()->getBoolean(InspectorState::consoleMessagesEnabled) && m_frontend) m_previousMessage->addToFrontend(m_frontend, m_inspectorController->injectedScriptHost()); } diff --git a/Source/WebCore/inspector/InspectorConsoleAgent.h b/Source/WebCore/inspector/InspectorConsoleAgent.h index 97fcb3f..411f709 100644 --- a/Source/WebCore/inspector/InspectorConsoleAgent.h +++ b/Source/WebCore/inspector/InspectorConsoleAgent.h @@ -46,9 +46,10 @@ class ScriptArguments; class ScriptCallStack; class ScriptProfile; -class InspectorConsoleAgent : public Noncopyable { +class InspectorConsoleAgent { + WTF_MAKE_NONCOPYABLE(InspectorConsoleAgent); public: - InspectorConsoleAgent(InspectorController*, InspectorState*); + InspectorConsoleAgent(InspectorController*); ~InspectorConsoleAgent(); void setConsoleMessagesEnabled(bool enabled, bool* newState); @@ -70,13 +71,13 @@ public: void addProfileFinishedMessageToConsole(PassRefPtr<ScriptProfile>, unsigned lineNumber, const String& sourceURL); void addStartProfilingMessageToConsole(const String& title, unsigned lineNumber, const String& sourceURL); #endif + void setMonitoringXHREnabled(bool enabled); private: void setConsoleMessagesEnabled(bool); void addConsoleMessage(PassOwnPtr<ConsoleMessage>); InspectorController* m_inspectorController; - InspectorState* m_state; InspectorFrontend* m_frontend; ConsoleMessage* m_previousMessage; Vector<OwnPtr<ConsoleMessage> > m_consoleMessages; diff --git a/Source/WebCore/inspector/InspectorController.cpp b/Source/WebCore/inspector/InspectorController.cpp index 5a139b6..8533a5f 100644 --- a/Source/WebCore/inspector/InspectorController.cpp +++ b/Source/WebCore/inspector/InspectorController.cpp @@ -70,6 +70,7 @@ #include "InspectorInstrumentation.h" #include "InspectorProfilerAgent.h" #include "InspectorResourceAgent.h" +#include "InspectorRuntimeAgent.h" #include "InspectorSettings.h" #include "InspectorState.h" #include "InspectorTimelineAgent.h" @@ -95,6 +96,7 @@ #include "SharedBuffer.h" #include "TextEncoding.h" #include "TextIterator.h" +#include "TextRun.h" #include "UserGestureIndicator.h" #include "WindowFeatures.h" #include <wtf/text/StringConcatenate.h> @@ -140,7 +142,7 @@ InspectorController::InspectorController(Page* page, InspectorClient* client) , m_state(new InspectorState(client)) , m_inspectorBackendDispatcher(new InspectorBackendDispatcher(this)) , m_injectedScriptHost(InjectedScriptHost::create(this)) - , m_consoleAgent(new InspectorConsoleAgent(this, m_state.get())) + , m_consoleAgent(new InspectorConsoleAgent(this)) #if ENABLE(JAVASCRIPT_DEBUGGER) , m_attachDebuggerWhenShown(false) , m_profilerAgent(InspectorProfilerAgent::create(this)) @@ -156,10 +158,6 @@ InspectorController::~InspectorController() ASSERT(!m_client); ASSERT(!m_inspectedPage); ASSERT(!m_highlightedNode); - - releaseFrontendLifetimeAgents(); - - m_injectedScriptHost->disconnectController(); } void InspectorController::inspectedPageDestroyed() @@ -177,6 +175,9 @@ void InspectorController::inspectedPageDestroyed() ASSERT(m_inspectedPage); m_inspectedPage = 0; + releaseFrontendLifetimeAgents(); + m_injectedScriptHost->disconnectController(); + m_client->inspectorDestroyed(); m_client = 0; } @@ -213,15 +214,6 @@ bool InspectorController::searchingForNodeInPage() const return m_state->getBoolean(InspectorState::searchingForNode); } -void InspectorController::getInspectorState(RefPtr<InspectorObject>* state) -{ -#if ENABLE(JAVASCRIPT_DEBUGGER) - if (m_debuggerAgent) - m_state->setLong(InspectorState::pauseOnExceptionsState, m_debuggerAgent->pauseOnExceptionsState()); -#endif - *state = m_state->generateStateObjectForFrontend(); -} - void InspectorController::restoreInspectorStateFromCookie(const String& inspectorStateCookie) { m_state->restoreFromInspectorCookie(inspectorStateCookie); @@ -229,11 +221,13 @@ void InspectorController::restoreInspectorStateFromCookie(const String& inspecto if (!m_frontend) { connectFrontend(); m_frontend->frontendReused(); - m_frontend->inspectedURLChanged(m_inspectedPage->mainFrame()->loader()->url().string()); + m_frontend->inspectedURLChanged(inspectedURL().string()); m_domAgent->setDocument(m_inspectedPage->mainFrame()->document()); pushDataCollectedOffline(); } + m_resourceAgent = InspectorResourceAgent::restore(m_inspectedPage, m_state.get(), m_frontend.get()); + if (m_state->getBoolean(InspectorState::timelineProfilerEnabled)) startTimelineProfiler(); @@ -381,21 +375,13 @@ void InspectorController::setSearchingForNode(bool enabled, bool* newState) setSearchingForNode(enabled); } -void InspectorController::setMonitoringXHREnabled(bool enabled, bool* newState) -{ - *newState = enabled; - m_state->setBoolean(InspectorState::monitoringXHR, enabled); - m_settings->setBoolean(InspectorSettings::MonitoringXHREnabled, enabled); -} - void InspectorController::connectFrontend() { m_openingFrontend = false; releaseFrontendLifetimeAgents(); m_frontend = new InspectorFrontend(m_client); - m_domAgent = InspectorDOMAgent::create(m_frontend.get()); - m_resourceAgent = InspectorResourceAgent::create(m_inspectedPage, m_frontend.get()); - + m_domAgent = InspectorDOMAgent::create(m_injectedScriptHost.get(), m_frontend.get()); + m_runtimeAgent = InspectorRuntimeAgent::create(m_injectedScriptHost.get()); m_cssAgent->setDOMAgent(m_domAgent.get()); #if ENABLE(DATABASE) @@ -412,7 +398,7 @@ void InspectorController::connectFrontend() m_consoleAgent->setFrontend(m_frontend.get()); // Initialize Web Inspector title. - m_frontend->inspectedURLChanged(m_inspectedPage->mainFrame()->loader()->url().string()); + m_frontend->inspectedURLChanged(inspectedURL().string()); #if ENABLE(OFFLINE_WEB_APPLICATIONS) m_applicationCacheAgent = new InspectorApplicationCacheAgent(this, m_frontend.get()); @@ -501,9 +487,17 @@ void InspectorController::disconnectFrontend() m_extraHeaders.clear(); } +InspectorResourceAgent* InspectorController::resourceAgent() +{ + if (!m_resourceAgent && m_frontend) + m_resourceAgent = InspectorResourceAgent::create(m_inspectedPage, m_state.get(), m_frontend.get()); + return m_resourceAgent.get(); +} + void InspectorController::releaseFrontendLifetimeAgents() { m_resourceAgent.clear(); + m_runtimeAgent.clear(); // This should be invoked prior to m_domAgent destruction. m_cssAgent->setDOMAgent(0); @@ -607,7 +601,7 @@ void InspectorController::restoreProfiler(ProfilerRestoreAction action) if (!ScriptProfiler::isProfilerAlwaysEnabled() && m_settings->getBoolean(InspectorSettings::ProfilerAlwaysEnabled)) enableProfiler(); if (action == ProfilerRestoreResetAgent) - m_profilerAgent->resetState(); + m_profilerAgent->resetFrontendProfiles(); #endif } @@ -648,8 +642,7 @@ void InspectorController::didCommitLoad(DocumentLoader* loader) if (m_debuggerAgent) { m_debuggerAgent->clearForPageNavigation(); if (m_browserDebuggerAgent) - m_browserDebuggerAgent->clearForPageNavigation(); - restoreStickyBreakpoints(); + m_browserDebuggerAgent->inspectedURLChanged(inspectedURL()); } #endif @@ -988,23 +981,11 @@ void InspectorController::didCloseWebSocket(unsigned long identifier) #endif // ENABLE(WEB_SOCKETS) #if ENABLE(JAVASCRIPT_DEBUGGER) -void InspectorController::addProfile(PassRefPtr<ScriptProfile> prpProfile, unsigned lineNumber, const String& sourceURL) -{ - if (!enabled()) - return; - m_profilerAgent->addProfile(prpProfile, lineNumber, sourceURL); -} - bool InspectorController::isRecordingUserInitiatedProfile() const { return m_profilerAgent->isRecordingUserInitiatedProfile(); } -String InspectorController::getCurrentUserInitiatedProfileName(bool incrementProfileNumber) -{ - return m_profilerAgent->getCurrentUserInitiatedProfileName(incrementProfileNumber); -} - void InspectorController::startUserInitiatedProfiling() { if (!enabled()) @@ -1067,7 +1048,7 @@ void InspectorController::enableDebugger(bool always) m_debuggerAgent = InspectorDebuggerAgent::create(this, m_frontend.get()); m_browserDebuggerAgent = InspectorBrowserDebuggerAgent::create(this); - restoreStickyBreakpoints(); + m_browserDebuggerAgent->inspectedURLChanged(inspectedURL()); m_frontend->debuggerWasEnabled(); } @@ -1097,95 +1078,12 @@ void InspectorController::resume() m_debuggerAgent->resume(); } -void InspectorController::setStickyBreakpoints(PassRefPtr<InspectorObject> breakpoints) +void InspectorController::setAllBrowserBreakpoints(PassRefPtr<InspectorObject> breakpoints) { - m_state->setObject(InspectorState::stickyBreakpoints, breakpoints); -} - -void InspectorController::restoreStickyBreakpoints() -{ - RefPtr<InspectorObject> allBreakpoints = m_state->getObject(InspectorState::stickyBreakpoints); - KURL url = m_inspectedPage->mainFrame()->loader()->url(); - url.removeFragmentIdentifier(); - RefPtr<InspectorArray> breakpoints = allBreakpoints->getArray(url); - if (!breakpoints) - return; - for (unsigned i = 0; i < breakpoints->length(); ++i) - restoreStickyBreakpoint(breakpoints->get(i)->asObject()); -} - -void InspectorController::restoreStickyBreakpoint(PassRefPtr<InspectorObject> breakpoint) -{ - DEFINE_STATIC_LOCAL(String, eventListenerBreakpointType, ("EventListener")); - DEFINE_STATIC_LOCAL(String, javaScriptBreakpointType, ("JS")); - DEFINE_STATIC_LOCAL(String, xhrBreakpointType, ("XHR")); - - if (!breakpoint) - return; - String type; - if (!breakpoint->getString("type", &type)) - return; - bool enabled; - if (!breakpoint->getBoolean("enabled", &enabled)) - return; - RefPtr<InspectorObject> condition = breakpoint->getObject("condition"); - if (!condition) - return; - - if (type == eventListenerBreakpointType && m_browserDebuggerAgent) { - if (!enabled) - return; - String eventName; - if (!condition->getString("eventName", &eventName)) - return; - m_browserDebuggerAgent->setEventListenerBreakpoint(eventName); - } else if (type == javaScriptBreakpointType && m_debuggerAgent) { - String url; - if (!condition->getString("url", &url)) - return; - double lineNumber; - if (!condition->getNumber("lineNumber", &lineNumber)) - return; - String javaScriptCondition; - if (!condition->getString("condition", &javaScriptCondition)) - return; - m_debuggerAgent->setStickyBreakpoint(url, static_cast<unsigned>(lineNumber), javaScriptCondition, enabled); - } else if (type == xhrBreakpointType && m_browserDebuggerAgent) { - if (!enabled) - return; - String url; - if (!condition->getString("url", &url)) - return; - m_browserDebuggerAgent->setXHRBreakpoint(url); - } + m_state->setObject(InspectorState::browserBreakpoints, breakpoints); } #endif -void InspectorController::dispatchOnInjectedScript(long injectedScriptId, const String& methodName, const String& arguments, RefPtr<InspectorValue>* result, bool* hadException) -{ - if (!m_frontend) - return; - - // FIXME: explicitly pass injectedScriptId along with node id to the frontend. - bool injectedScriptIdIsNodeId = injectedScriptId <= 0; - - InjectedScript injectedScript; - if (injectedScriptIdIsNodeId) - injectedScript = injectedScriptForNodeId(-injectedScriptId); - else - injectedScript = injectedScriptHost()->injectedScriptForId(injectedScriptId); - - if (injectedScript.hasNoValue()) - return; - - injectedScript.dispatch(methodName, arguments, result, hadException); -} - -void InspectorController::releaseWrapperObjectGroup(long injectedScriptId, const String& objectGroup) -{ - injectedScriptHost()->releaseWrapperObjectGroup(injectedScriptId, objectGroup); -} - void InspectorController::evaluateForTestInFrontend(long callId, const String& script) { if (m_frontend) @@ -1468,27 +1366,6 @@ void InspectorController::openInInspectedWindow(const String& url) newFrame->loader()->changeLocation(mainFrame->document()->securityOrigin(), newFrame->loader()->completeURL(url), "", false, false); } -InjectedScript InspectorController::injectedScriptForNodeId(long id) -{ - - Frame* frame = 0; - if (id) { - ASSERT(m_domAgent); - Node* node = m_domAgent->nodeForId(id); - if (node) { - Document* document = node->ownerDocument(); - if (document) - frame = document->frame(); - } - } else - frame = m_inspectedPage->mainFrame(); - - if (frame) - return m_injectedScriptHost->injectedScriptFor(mainWorldScriptState(frame)); - - return InjectedScript(); -} - void InspectorController::addScriptToEvaluateOnLoad(const String& source) { m_scriptsToEvaluateOnLoad.append(source); @@ -1504,6 +1381,11 @@ void InspectorController::setInspectorExtensionAPI(const String& source) m_inspectorExtensionAPI = source; } +KURL InspectorController::inspectedURL() const +{ + return m_inspectedPage->mainFrame()->loader()->url(); +} + void InspectorController::reloadPage() { // FIXME: Why do we set the user gesture indicator here? diff --git a/Source/WebCore/inspector/InspectorController.h b/Source/WebCore/inspector/InspectorController.h index 9cddc56..90a0300 100644 --- a/Source/WebCore/inspector/InspectorController.h +++ b/Source/WebCore/inspector/InspectorController.h @@ -72,6 +72,7 @@ class InspectorFrontendClient; class InspectorObject; class InspectorProfilerAgent; class InspectorResourceAgent; +class InspectorRuntimeAgent; class InspectorSettings; class InspectorState; class InspectorStorageAgent; @@ -104,7 +105,8 @@ class WebSocketHandshakeRequest; class WebSocketHandshakeResponse; #endif -class InspectorController : public Noncopyable { +class InspectorController { + WTF_MAKE_NONCOPYABLE(InspectorController); WTF_MAKE_FAST_ALLOCATED; public: static const char* const ConsolePanel; static const char* const ElementsPanel; @@ -123,6 +125,7 @@ public: bool enabled() const; Page* inspectedPage() const { return m_inspectedPage; } + KURL inspectedURL() const; void reloadPage(); void restoreInspectorStateFromCookie(const String& inspectorCookie); @@ -143,9 +146,35 @@ public: void connectFrontend(); void reuseFrontend(); void disconnectFrontend(); + InspectorFrontend* frontend() const { return m_frontend.get(); } + + InspectorResourceAgent* resourceAgent(); + + InspectorController* inspectorAgent() { return this; } + InspectorConsoleAgent* consoleAgent() { return m_consoleAgent.get(); } + InspectorCSSAgent* cssAgent() { return m_cssAgent.get(); } + InspectorDOMAgent* domAgent() { return m_domAgent.get(); } + InjectedScriptHost* injectedScriptAgent() { return m_injectedScriptHost.get(); } + InspectorRuntimeAgent* runtimeAgent() { return m_runtimeAgent.get(); } + InspectorTimelineAgent* timelineAgent() { return m_timelineAgent.get(); } +#if ENABLE(DATABASE) + InspectorDatabaseAgent* databaseAgent() { return m_databaseAgent.get(); } +#endif +#if ENABLE(DOM_STORAGE) + InspectorDOMStorageAgent* domStorageAgent() { return m_domStorageAgent.get(); } +#endif +#if ENABLE(FILE_SYSTEM) + InspectorFileSystemAgent* fileSystemAgent() { return m_fileSystemAgent.get(); } +#endif +#if ENABLE(JAVASCRIPT_DEBUGGER) + InspectorBrowserDebuggerAgent* browserDebuggerAgent() const { return m_browserDebuggerAgent.get(); } + InspectorDebuggerAgent* debuggerAgent() const { return m_debuggerAgent.get(); } + InspectorProfilerAgent* profilerAgent() const { return m_profilerAgent.get(); } +#endif +#if ENABLE(OFFLINE_WEB_APPLICATIONS) + InspectorApplicationCacheAgent* applicationCacheAgent() { return m_applicationCacheAgent.get(); } +#endif - InspectorConsoleAgent* consoleAgent() const { return m_consoleAgent.get(); } - InspectorDOMAgent* domAgent() const { return m_domAgent.get(); } bool searchingForNodeInPage() const; void mouseDidMoveOverElement(const HitTestResult&, unsigned modifierFlags); @@ -162,15 +191,10 @@ public: void startTimelineProfiler(); void stopTimelineProfiler(); - InspectorTimelineAgent* timelineAgent() { return m_timelineAgent.get(); } void getCookies(RefPtr<InspectorArray>* cookies, WTF::String* cookiesString); void deleteCookie(const String& cookieName, const String& domain); -#if ENABLE(OFFLINE_WEB_APPLICATIONS) - InspectorApplicationCacheAgent* applicationCacheAgent() { return m_applicationCacheAgent.get(); } -#endif - void mainResourceFiredLoadEvent(DocumentLoader*, const KURL&); void mainResourceFiredDOMContentEvent(DocumentLoader*, const KURL&); @@ -204,9 +228,7 @@ public: void drawElementTitle(GraphicsContext&, const IntRect& boundingBox, const FloatRect& overlayRect, WebCore::Settings*) const; #if ENABLE(JAVASCRIPT_DEBUGGER) - void addProfile(PassRefPtr<ScriptProfile>, unsigned lineNumber, const String& sourceURL); bool isRecordingUserInitiatedProfile() const; - String getCurrentUserInitiatedProfileName(bool incrementProfileNumber = false); void startProfiling() { startUserInitiatedProfiling(); } void startUserInitiatedProfiling(); void stopProfiling() { stopUserInitiatedProfiling(); } @@ -221,19 +243,12 @@ public: bool debuggerEnabled() const { return m_debuggerAgent; } void resume(); - void setStickyBreakpoints(PassRefPtr<InspectorObject> breakpoints); + void setAllBrowserBreakpoints(PassRefPtr<InspectorObject>); #endif - void setInjectedScriptSource(const String& source); - void dispatchOnInjectedScript(long injectedScriptId, const String& methodName, const String& arguments, RefPtr<InspectorValue>* result, bool* hadException); - // Generic code called from custom implementations. - void releaseWrapperObjectGroup(long injectedScriptId, const String& objectGroup); - void evaluateForTestInFrontend(long testCallId, const String& script); - InjectedScript injectedScriptForNodeId(long id); - void addScriptToEvaluateOnLoad(const String& source); void removeAllScriptsToEvaluateOnLoad(); void setInspectorExtensionAPI(const String& source); @@ -243,20 +258,22 @@ public: void setInspectorAttachedHeight(long height); long inspectorAttachedHeight() const; -private: - friend class InspectorBackend; - friend class InspectorBackendDispatcher; - friend class InspectorBrowserDebuggerAgent; - friend class InspectorInstrumentation; - friend class InjectedScriptHost; + InspectorState* state() { return m_state.get(); } + InspectorSettings* settings() { return m_settings.get(); } - void willSendRequest(ResourceRequest&); + // InspectorAgent API + void getInspectorState(RefPtr<InspectorObject>* state); + void setMonitoringXHREnabled(bool enabled, bool* newState); + void populateScriptObjects(); + // Following are used from InspectorBackend and internally. + void setSearchingForNode(bool enabled, bool* newState); + void didEvaluateForTestInFrontend(long callId, const String& jsonResult); + // InspectorInstrumentation API void ensureSettingsLoaded(); + void willSendRequest(ResourceRequest&); - void getInspectorState(RefPtr<InspectorObject>* state); - - void populateScriptObjects(); +private: void pushDataCollectedOffline(); void restoreDebugger(); enum ProfilerRestoreAction { @@ -267,27 +284,18 @@ private: void unbindAllResources(); void setSearchingForNode(bool enabled); - // Following are used from InspectorBackend and internally. - void setSearchingForNode(bool enabled, bool* newState); - - void setMonitoringXHREnabled(bool enabled, bool* newState); void releaseFrontendLifetimeAgents(); #if ENABLE(JAVASCRIPT_DEBUGGER) void toggleRecordButton(bool); - void restoreStickyBreakpoints(); - void restoreStickyBreakpoint(PassRefPtr<InspectorObject> breakpoint); #endif PassRefPtr<InspectorObject> buildObjectForCookie(const Cookie&); PassRefPtr<InspectorArray> buildArrayForCookies(ListHashSet<Cookie>&); void focusNode(); - bool isMainResourceLoader(DocumentLoader* loader, const KURL& requestUrl); - void didEvaluateForTestInFrontend(long callId, const String& jsonResult); - Page* m_inspectedPage; InspectorClient* m_client; OwnPtr<InspectorFrontendClient> m_inspectorFrontendClient; @@ -318,6 +326,7 @@ private: RefPtr<Node> m_nodeToFocus; RefPtr<InspectorResourceAgent> m_resourceAgent; + OwnPtr<InspectorRuntimeAgent> m_runtimeAgent; #if ENABLE(DATABASE) typedef HashMap<int, RefPtr<InspectorDatabaseResource> > DatabaseResourcesMap; @@ -341,7 +350,6 @@ private: bool m_attachDebuggerWhenShown; OwnPtr<InspectorDebuggerAgent> m_debuggerAgent; OwnPtr<InspectorBrowserDebuggerAgent> m_browserDebuggerAgent; - OwnPtr<InspectorProfilerAgent> m_profilerAgent; #endif OwnPtr<HTTPHeaderMap> m_extraHeaders; diff --git a/Source/WebCore/inspector/InspectorDOMAgent.cpp b/Source/WebCore/inspector/InspectorDOMAgent.cpp index 19ae30d..6e10f09 100644 --- a/Source/WebCore/inspector/InspectorDOMAgent.cpp +++ b/Source/WebCore/inspector/InspectorDOMAgent.cpp @@ -59,6 +59,7 @@ #include "FrameTree.h" #include "HTMLElement.h" #include "HTMLFrameOwnerElement.h" +#include "InjectedScriptHost.h" #include "InspectorFrontend.h" #include "MutationEvent.h" #include "Node.h" @@ -206,8 +207,9 @@ public: } -InspectorDOMAgent::InspectorDOMAgent(InspectorFrontend* frontend) +InspectorDOMAgent::InspectorDOMAgent(InjectedScriptHost* injectedScriptHost, InspectorFrontend* frontend) : EventListener(InspectorDOMAgentType) + , m_injectedScriptHost(injectedScriptHost) , m_frontend(frontend) , m_domListener(0) , m_lastNodeId(1) @@ -758,6 +760,34 @@ void InspectorDOMAgent::searchCanceled() m_searchResults.clear(); } +void InspectorDOMAgent::resolveNode(long nodeId, RefPtr<InspectorValue>* result) +{ + InjectedScript injectedScript = injectedScriptForNodeId(nodeId); + if (!injectedScript.hasNoValue()) + injectedScript.resolveNode(nodeId, result); +} + +void InspectorDOMAgent::getNodeProperties(long nodeId, PassRefPtr<InspectorArray> propertiesArray, RefPtr<InspectorValue>* result) +{ + InjectedScript injectedScript = injectedScriptForNodeId(nodeId); + if (!injectedScript.hasNoValue()) + injectedScript.getNodeProperties(nodeId, propertiesArray, result); +} + +void InspectorDOMAgent::getNodePrototypes(long nodeId, RefPtr<InspectorValue>* result) +{ + InjectedScript injectedScript = injectedScriptForNodeId(nodeId); + if (!injectedScript.hasNoValue()) + injectedScript.getNodePrototypes(nodeId, result); +} + +void InspectorDOMAgent::pushNodeToFrontend(PassRefPtr<InspectorObject> objectId, RefPtr<InspectorValue>* result) +{ + InjectedScript injectedScript = m_injectedScriptHost->injectedScriptForObjectId(objectId.get()); + if (!injectedScript.hasNoValue()) + injectedScript.pushNodeToFrontend(objectId, result); +} + String InspectorDOMAgent::documentURLString(Document* document) const { if (!document || document->url().isNull()) @@ -1112,6 +1142,26 @@ void InspectorDOMAgent::pushNodeByPathToFrontend(const String& path, long* nodeI *nodeId = pushNodePathToFrontend(node); } +InjectedScript InspectorDOMAgent::injectedScriptForNodeId(long nodeId) +{ + Frame* frame = 0; + if (nodeId) { + Node* node = nodeForId(nodeId); + if (node) { + Document* document = node->ownerDocument(); + if (document) + frame = document->frame(); + } + } else + frame = mainFrameDocument()->frame(); + + if (frame) + return m_injectedScriptHost->injectedScriptFor(mainWorldScriptState(frame)); + + return InjectedScript(); +} + + } // namespace WebCore #endif // ENABLE(INSPECTOR) diff --git a/Source/WebCore/inspector/InspectorDOMAgent.h b/Source/WebCore/inspector/InspectorDOMAgent.h index 97175fe..e4edf5d 100644 --- a/Source/WebCore/inspector/InspectorDOMAgent.h +++ b/Source/WebCore/inspector/InspectorDOMAgent.h @@ -32,6 +32,8 @@ #include "EventListener.h" #include "EventTarget.h" +#include "InjectedScript.h" +#include "InjectedScriptHost.h" #include "InspectorValues.h" #include "NodeList.h" #include "Timer.h" @@ -45,164 +47,168 @@ #include <wtf/text/AtomicString.h> namespace WebCore { - class ContainerNode; - class CSSRule; - class CSSRuleList; - class CSSStyleDeclaration; - class CSSStyleRule; - class CSSStyleSheet; - class CharacterData; - class Document; - class Element; - class Event; - class InspectorDOMAgent; - class InspectorFrontend; - class MatchJob; - class NameNodeMap; - class Node; - class Page; +class ContainerNode; +class CSSRule; +class CSSRuleList; +class CSSStyleDeclaration; +class CSSStyleRule; +class CSSStyleSheet; +class CharacterData; +class Document; +class Element; +class Event; +class InspectorDOMAgent; +class InspectorFrontend; +class MatchJob; +class NameNodeMap; +class Node; +class Page; #if ENABLE(INSPECTOR) - struct EventListenerInfo { - EventListenerInfo(Node* node, const AtomicString& eventType, const EventListenerVector& eventListenerVector) - : node(node) - , eventType(eventType) - , eventListenerVector(eventListenerVector) +struct EventListenerInfo { + EventListenerInfo(Node* node, const AtomicString& eventType, const EventListenerVector& eventListenerVector) + : node(node) + , eventType(eventType) + , eventListenerVector(eventListenerVector) + { + } + + Node* node; + const AtomicString eventType; + const EventListenerVector eventListenerVector; +}; + +class InspectorDOMAgent : public EventListener { +public: + struct DOMListener { + virtual ~DOMListener() { } - - Node* node; - const AtomicString eventType; - const EventListenerVector eventListenerVector; - }; - - class InspectorDOMAgent : public EventListener { - public: - struct DOMListener { - virtual ~DOMListener() - { - } - virtual void didRemoveDocument(Document*) = 0; - virtual void didRemoveDOMNode(Node*) = 0; - virtual void didModifyDOMAttr(Element*) = 0; - }; - - static PassRefPtr<InspectorDOMAgent> create(InspectorFrontend* frontend) - { - return adoptRef(new InspectorDOMAgent(frontend)); - } - - static const InspectorDOMAgent* cast(const EventListener* listener) - { - return listener->type() == InspectorDOMAgentType - ? static_cast<const InspectorDOMAgent*>(listener) - : 0; - } - - InspectorDOMAgent(InspectorFrontend* frontend); - ~InspectorDOMAgent(); - - void reset(); - - virtual bool operator==(const EventListener& other); - - // Methods called from the frontend for DOM nodes inspection. - void getChildNodes(long nodeId); - void setAttribute(long elementId, const String& name, const String& value, bool* success); - void removeAttribute(long elementId, const String& name, bool* success); - void removeNode(long nodeId, long* outNodeId); - void changeTagName(long nodeId, const String& tagName, long* newId); - void getOuterHTML(long nodeId, WTF::String* outerHTML); - void setOuterHTML(long nodeId, const String& outerHTML, long* newId); - void setTextNodeValue(long nodeId, const String& value, bool* success); - void getEventListenersForNode(long nodeId, long* outNodeId, RefPtr<InspectorArray>* listenersArray); - void addInspectedNode(long nodeId); - void performSearch(const String& whitespaceTrimmedQuery, bool runSynchronously); - void searchCanceled(); - bool shouldBreakOnNodeInsertion(Node* node, Node* parent, PassRefPtr<InspectorObject> details); - bool shouldBreakOnNodeRemoval(Node* node, PassRefPtr<InspectorObject> details); - bool shouldBreakOnAttributeModification(Element* element, PassRefPtr<InspectorObject> details); - - // Methods called from the InspectorInstrumentation. - void setDocument(Document* document); - void releaseDanglingNodes(); - - void didInsertDOMNode(Node*); - void didRemoveDOMNode(Node*); - void didModifyDOMAttr(Element*); - void characterDataModified(CharacterData*); - - Node* nodeForId(long nodeId); - long pushNodePathToFrontend(Node* node); - void pushChildNodesToFrontend(long nodeId); - void pushNodeByPathToFrontend(const String& path, long* nodeId); - long inspectedNode(unsigned long num); - void copyNode(long nodeId); - const ListHashSet<RefPtr<Document> >& documents() { return m_documents; } - void setDOMListener(DOMListener*); - - String documentURLString(Document* document) const; - - // We represent embedded doms as a part of the same hierarchy. Hence we treat children of frame owners differently. - // We also skip whitespace text nodes conditionally. Following methods encapsulate these specifics. - static Node* innerFirstChild(Node*); - static Node* innerNextSibling(Node*); - static Node* innerPreviousSibling(Node*); - static unsigned innerChildNodeCount(Node*); - static Node* innerParentNode(Node*); - static bool isWhitespace(Node*); - - private: - void startListeningFrameDocument(Node* frameOwnerNode); - void startListening(Document* document); - void stopListening(Document* document); - - virtual void handleEvent(ScriptExecutionContext*, Event* event); - - // Node-related methods. - typedef HashMap<RefPtr<Node>, long> NodeToIdMap; - long bind(Node* node, NodeToIdMap* nodesMap); - void unbind(Node* node, NodeToIdMap* nodesMap); - - bool pushDocumentToFrontend(); - - bool hasBreakpoint(Node* node, long type); - void updateSubtreeBreakpoints(Node* root, uint32_t rootMask, bool value); - void descriptionForDOMEvent(Node* target, long breakpointType, bool insertion, PassRefPtr<InspectorObject> description); - - PassRefPtr<InspectorObject> buildObjectForNode(Node* node, int depth, NodeToIdMap* nodesMap); - PassRefPtr<InspectorArray> buildArrayForElementAttributes(Element* element); - PassRefPtr<InspectorArray> buildArrayForContainerChildren(Node* container, int depth, NodeToIdMap* nodesMap); - PassRefPtr<InspectorObject> buildObjectForEventListener(const RegisteredEventListener& registeredEventListener, const AtomicString& eventType, Node* node); - - Document* mainFrameDocument() const; - - void onMatchJobsTimer(Timer<InspectorDOMAgent>*); - void reportNodesAsSearchResults(ListHashSet<Node*>& resultCollector); - - Node* nodeForPath(const String& path); - PassRefPtr<InspectorArray> toArray(const Vector<String>& data); - - void discardBindings(); - - InspectorFrontend* m_frontend; - DOMListener* m_domListener; - NodeToIdMap m_documentNodeToIdMap; - // Owns node mappings for dangling nodes. - Vector<NodeToIdMap*> m_danglingNodeToIdMaps; - HashMap<long, Node*> m_idToNode; - HashMap<long, NodeToIdMap*> m_idToNodesMap; - HashSet<long> m_childrenRequested; - long m_lastNodeId; - ListHashSet<RefPtr<Document> > m_documents; - Deque<MatchJob*> m_pendingMatchJobs; - Timer<InspectorDOMAgent> m_matchJobsTimer; - HashSet<RefPtr<Node> > m_searchResults; - Vector<long> m_inspectedNodes; + virtual void didRemoveDocument(Document*) = 0; + virtual void didRemoveDOMNode(Node*) = 0; + virtual void didModifyDOMAttr(Element*) = 0; }; -#endif + static PassRefPtr<InspectorDOMAgent> create(InjectedScriptHost* injectedScriptHost, InspectorFrontend* frontend) + { + return adoptRef(new InspectorDOMAgent(injectedScriptHost, frontend)); + } + + static const InspectorDOMAgent* cast(const EventListener* listener) + { + return listener->type() == InspectorDOMAgentType + ? static_cast<const InspectorDOMAgent*>(listener) + : 0; + } + + InspectorDOMAgent(InjectedScriptHost*, InspectorFrontend*); + ~InspectorDOMAgent(); + + void reset(); + + virtual bool operator==(const EventListener& other); + + // Methods called from the frontend for DOM nodes inspection. + void getChildNodes(long nodeId); + void setAttribute(long elementId, const String& name, const String& value, bool* success); + void removeAttribute(long elementId, const String& name, bool* success); + void removeNode(long nodeId, long* outNodeId); + void changeTagName(long nodeId, const String& tagName, long* newId); + void getOuterHTML(long nodeId, WTF::String* outerHTML); + void setOuterHTML(long nodeId, const String& outerHTML, long* newId); + void setTextNodeValue(long nodeId, const String& value, bool* success); + void getEventListenersForNode(long nodeId, long* outNodeId, RefPtr<InspectorArray>* listenersArray); + void addInspectedNode(long nodeId); + void performSearch(const String& whitespaceTrimmedQuery, bool runSynchronously); + void searchCanceled(); + void resolveNode(long nodeId, RefPtr<InspectorValue>* result); + void getNodeProperties(long nodeId, PassRefPtr<InspectorArray> propertiesArray, RefPtr<InspectorValue>* result); + void getNodePrototypes(long nodeId, RefPtr<InspectorValue>* result); + void pushNodeToFrontend(PassRefPtr<InspectorObject> objectId, RefPtr<InspectorValue>* result); + + // Methods called from the InspectorInstrumentation. + void setDocument(Document*); + void releaseDanglingNodes(); + + void didInsertDOMNode(Node*); + void didRemoveDOMNode(Node*); + void didModifyDOMAttr(Element*); + void characterDataModified(CharacterData*); + + Node* nodeForId(long nodeId); + long pushNodePathToFrontend(Node*); + void pushChildNodesToFrontend(long nodeId); + void pushNodeByPathToFrontend(const String& path, long* nodeId); + long inspectedNode(unsigned long num); + void copyNode(long nodeId); + const ListHashSet<RefPtr<Document> >& documents() { return m_documents; } + void setDOMListener(DOMListener*); + + String documentURLString(Document*) const; + + // We represent embedded doms as a part of the same hierarchy. Hence we treat children of frame owners differently. + // We also skip whitespace text nodes conditionally. Following methods encapsulate these specifics. + static Node* innerFirstChild(Node*); + static Node* innerNextSibling(Node*); + static Node* innerPreviousSibling(Node*); + static unsigned innerChildNodeCount(Node*); + static Node* innerParentNode(Node*); + static bool isWhitespace(Node*); + +private: + void startListeningFrameDocument(Node* frameOwnerNode); + void startListening(Document*); + void stopListening(Document*); + + virtual void handleEvent(ScriptExecutionContext*, Event*); + + // Node-related methods. + typedef HashMap<RefPtr<Node>, long> NodeToIdMap; + long bind(Node*, NodeToIdMap*); + void unbind(Node*, NodeToIdMap*); + + bool pushDocumentToFrontend(); + + bool hasBreakpoint(Node*, long type); + void updateSubtreeBreakpoints(Node* root, uint32_t rootMask, bool value); + void descriptionForDOMEvent(Node* target, long breakpointType, bool insertion, PassRefPtr<InspectorObject> description); + + PassRefPtr<InspectorObject> buildObjectForNode(Node*, int depth, NodeToIdMap*); + PassRefPtr<InspectorArray> buildArrayForElementAttributes(Element*); + PassRefPtr<InspectorArray> buildArrayForContainerChildren(Node* container, int depth, NodeToIdMap* nodesMap); + PassRefPtr<InspectorObject> buildObjectForEventListener(const RegisteredEventListener&, const AtomicString& eventType, Node*); + + Document* mainFrameDocument() const; + + void onMatchJobsTimer(Timer<InspectorDOMAgent>*); + void reportNodesAsSearchResults(ListHashSet<Node*>& resultCollector); + + Node* nodeForPath(const String& path); + PassRefPtr<InspectorArray> toArray(const Vector<String>& data); + + void discardBindings(); + + InjectedScript injectedScriptForNodeId(long nodeId); + + InjectedScriptHost* m_injectedScriptHost; + InspectorFrontend* m_frontend; + DOMListener* m_domListener; + NodeToIdMap m_documentNodeToIdMap; + // Owns node mappings for dangling nodes. + Vector<NodeToIdMap*> m_danglingNodeToIdMaps; + HashMap<long, Node*> m_idToNode; + HashMap<long, NodeToIdMap*> m_idToNodesMap; + HashSet<long> m_childrenRequested; + long m_lastNodeId; + ListHashSet<RefPtr<Document> > m_documents; + Deque<MatchJob*> m_pendingMatchJobs; + Timer<InspectorDOMAgent> m_matchJobsTimer; + HashSet<RefPtr<Node> > m_searchResults; + Vector<long> m_inspectedNodes; +}; + +#endif // ENABLE(INSPECTOR) } // namespace WebCore diff --git a/Source/WebCore/inspector/InspectorDebuggerAgent.cpp b/Source/WebCore/inspector/InspectorDebuggerAgent.cpp index 82c250a..acfbb6e 100644 --- a/Source/WebCore/inspector/InspectorDebuggerAgent.cpp +++ b/Source/WebCore/inspector/InspectorDebuggerAgent.cpp @@ -173,9 +173,18 @@ void InspectorDebuggerAgent::setPauseOnExceptionsState(long pauseState, long* ne *newState = ScriptDebugServer::shared().pauseOnExceptionsState(); } -long InspectorDebuggerAgent::pauseOnExceptionsState() +void InspectorDebuggerAgent::evaluateOnCallFrame(PassRefPtr<InspectorObject> callFrameId, const String& expression, const String& objectGroup, RefPtr<InspectorValue>* result) { - return ScriptDebugServer::shared().pauseOnExceptionsState(); + InjectedScript injectedScript = m_inspectorController->injectedScriptHost()->injectedScriptForObjectId(callFrameId.get()); + if (!injectedScript.hasNoValue()) + injectedScript.evaluateOnCallFrame(callFrameId, expression, objectGroup, result); +} + +void InspectorDebuggerAgent::getCompletionsOnCallFrame(PassRefPtr<InspectorObject> callFrameId, const String& expression, bool includeInspectorCommandLineAPI, RefPtr<InspectorValue>* result) +{ + InjectedScript injectedScript = m_inspectorController->injectedScriptHost()->injectedScriptForObjectId(callFrameId.get()); + if (!injectedScript.hasNoValue()) + injectedScript.getCompletionsOnCallFrame(callFrameId, expression, includeInspectorCommandLineAPI, result); } void InspectorDebuggerAgent::clearForPageNavigation() @@ -202,7 +211,7 @@ PassRefPtr<InspectorValue> InspectorDebuggerAgent::currentCallFrames() void InspectorDebuggerAgent::didParseSource(const String& sourceID, const String& url, const String& data, int lineOffset, int columnOffset, ScriptWorldType worldType) { // Don't send script content to the front end until it's really needed. - m_frontend->parsedScriptSource(sourceID, url, lineOffset, columnOffset, worldType); + m_frontend->parsedScriptSource(sourceID, url, lineOffset, columnOffset, data.length(), worldType); m_scriptIDToContent.set(sourceID, data); diff --git a/Source/WebCore/inspector/InspectorDebuggerAgent.h b/Source/WebCore/inspector/InspectorDebuggerAgent.h index 07d2ab9..4cb9f9c 100644 --- a/Source/WebCore/inspector/InspectorDebuggerAgent.h +++ b/Source/WebCore/inspector/InspectorDebuggerAgent.h @@ -31,6 +31,7 @@ #define InspectorDebuggerAgent_h #if ENABLE(JAVASCRIPT_DEBUGGER) && ENABLE(INSPECTOR) +#include "InjectedScript.h" #include "ScriptDebugListener.h" #include "ScriptState.h" #include <wtf/Forward.h> @@ -52,22 +53,22 @@ enum DebuggerEventType { NativeBreakpointDebuggerEventType }; -class InspectorDebuggerAgent : public ScriptDebugListener, public Noncopyable { +class InspectorDebuggerAgent : public ScriptDebugListener { + WTF_MAKE_NONCOPYABLE(InspectorDebuggerAgent); WTF_MAKE_FAST_ALLOCATED; public: static PassOwnPtr<InspectorDebuggerAgent> create(InspectorController*, InspectorFrontend*); virtual ~InspectorDebuggerAgent(); static bool isDebuggerAlwaysEnabled(); + // Part of the protocol. void activateBreakpoints(); void deactivateBreakpoints(); void setStickyBreakpoint(const String& url, unsigned lineNumber, const String& condition, bool enabled); void setBreakpoint(const String& sourceID, unsigned lineNumber, const String& condition, bool enabled, String* breakpointId, unsigned int* actualLineNumber); void removeBreakpoint(const String& breakpointId); - void editScriptSource(const String& sourceID, const String& newContent, bool* success, String* result, RefPtr<InspectorValue>* newCallFrames); void getScriptSource(const String& sourceID, String* scriptSource); - void schedulePauseOnNextStatement(DebuggerEventType type, PassRefPtr<InspectorValue> data); void cancelPauseOnNextStatement(); void breakProgram(DebuggerEventType type, PassRefPtr<InspectorValue> data); @@ -76,9 +77,9 @@ public: void stepOver(); void stepInto(); void stepOut(); - void setPauseOnExceptionsState(long pauseState, long* newState); - long pauseOnExceptionsState(); + void evaluateOnCallFrame(PassRefPtr<InspectorObject> callFrameId, const String& expression, const String& objectGroup, RefPtr<InspectorValue>* result); + void getCompletionsOnCallFrame(PassRefPtr<InspectorObject> callFrameId, const String& expression, bool includeInspectorCommandLineAPI, RefPtr<InspectorValue>* result); void clearForPageNavigation(); diff --git a/Source/WebCore/inspector/InspectorFrontendClientLocal.h b/Source/WebCore/inspector/InspectorFrontendClientLocal.h index 9dcaa5a..19f6ad1 100644 --- a/Source/WebCore/inspector/InspectorFrontendClientLocal.h +++ b/Source/WebCore/inspector/InspectorFrontendClientLocal.h @@ -41,7 +41,8 @@ class InspectorController; class InspectorFrontendHost; class Page; -class InspectorFrontendClientLocal : public InspectorFrontendClient, public Noncopyable { +class InspectorFrontendClientLocal : public InspectorFrontendClient { + WTF_MAKE_NONCOPYABLE(InspectorFrontendClientLocal); WTF_MAKE_FAST_ALLOCATED; public: InspectorFrontendClientLocal(InspectorController*, Page*); virtual ~InspectorFrontendClientLocal(); diff --git a/Source/WebCore/inspector/InspectorInstrumentation.cpp b/Source/WebCore/inspector/InspectorInstrumentation.cpp index aa941df..9ae97be 100644 --- a/Source/WebCore/inspector/InspectorInstrumentation.cpp +++ b/Source/WebCore/inspector/InspectorInstrumentation.cpp @@ -93,17 +93,17 @@ void InspectorInstrumentation::inspectedPageDestroyedImpl(InspectorController* i void InspectorInstrumentation::willInsertDOMNodeImpl(InspectorController* inspectorController, Node* node, Node* parent) { #if ENABLE(JAVASCRIPT_DEBUGGER) - if (InspectorBrowserDebuggerAgent* browserDebuggerAgent = inspectorController->m_browserDebuggerAgent.get()) + if (InspectorBrowserDebuggerAgent* browserDebuggerAgent = inspectorController->browserDebuggerAgent()) browserDebuggerAgent->willInsertDOMNode(node, parent); #endif } void InspectorInstrumentation::didInsertDOMNodeImpl(InspectorController* inspectorController, Node* node) { - if (InspectorDOMAgent* domAgent = inspectorController->m_domAgent.get()) + if (InspectorDOMAgent* domAgent = inspectorController->domAgent()) domAgent->didInsertDOMNode(node); #if ENABLE(JAVASCRIPT_DEBUGGER) - if (InspectorBrowserDebuggerAgent* browserDebuggerAgent = inspectorController->m_browserDebuggerAgent.get()) + if (InspectorBrowserDebuggerAgent* browserDebuggerAgent = inspectorController->browserDebuggerAgent()) browserDebuggerAgent->didInsertDOMNode(node); #endif } @@ -111,7 +111,7 @@ void InspectorInstrumentation::didInsertDOMNodeImpl(InspectorController* inspect void InspectorInstrumentation::willRemoveDOMNodeImpl(InspectorController* inspectorController, Node* node) { #if ENABLE(JAVASCRIPT_DEBUGGER) - if (InspectorBrowserDebuggerAgent* browserDebuggerAgent = inspectorController->m_browserDebuggerAgent.get()) + if (InspectorBrowserDebuggerAgent* browserDebuggerAgent = inspectorController->browserDebuggerAgent()) browserDebuggerAgent->willRemoveDOMNode(node); #endif } @@ -119,24 +119,24 @@ void InspectorInstrumentation::willRemoveDOMNodeImpl(InspectorController* inspec void InspectorInstrumentation::didRemoveDOMNodeImpl(InspectorController* inspectorController, Node* node) { #if ENABLE(JAVASCRIPT_DEBUGGER) - if (InspectorBrowserDebuggerAgent* browserDebuggerAgent = inspectorController->m_browserDebuggerAgent.get()) + if (InspectorBrowserDebuggerAgent* browserDebuggerAgent = inspectorController->browserDebuggerAgent()) browserDebuggerAgent->didRemoveDOMNode(node); #endif - if (InspectorDOMAgent* domAgent = inspectorController->m_domAgent.get()) + if (InspectorDOMAgent* domAgent = inspectorController->domAgent()) domAgent->didRemoveDOMNode(node); } void InspectorInstrumentation::willModifyDOMAttrImpl(InspectorController* inspectorController, Element* element) { #if ENABLE(JAVASCRIPT_DEBUGGER) - if (InspectorBrowserDebuggerAgent* browserDebuggerAgent = inspectorController->m_browserDebuggerAgent.get()) + if (InspectorBrowserDebuggerAgent* browserDebuggerAgent = inspectorController->browserDebuggerAgent()) browserDebuggerAgent->willModifyDOMAttr(element); #endif } void InspectorInstrumentation::didModifyDOMAttrImpl(InspectorController* inspectorController, Element* element) { - if (InspectorDOMAgent* domAgent = inspectorController->m_domAgent.get()) + if (InspectorDOMAgent* domAgent = inspectorController->domAgent()) domAgent->didModifyDOMAttr(element); } @@ -152,14 +152,14 @@ bool InspectorInstrumentation::handleMousePressImpl(InspectorController* inspect void InspectorInstrumentation::characterDataModifiedImpl(InspectorController* inspectorController, CharacterData* characterData) { - if (InspectorDOMAgent* domAgent = inspectorController->m_domAgent.get()) + if (InspectorDOMAgent* domAgent = inspectorController->domAgent()) domAgent->characterDataModified(characterData); } void InspectorInstrumentation::willSendXMLHttpRequestImpl(InspectorController* inspectorController, const String& url) { #if ENABLE(JAVASCRIPT_DEBUGGER) - if (InspectorBrowserDebuggerAgent* browserDebuggerAgent = inspectorController->m_browserDebuggerAgent.get()) + if (InspectorBrowserDebuggerAgent* browserDebuggerAgent = inspectorController->browserDebuggerAgent()) browserDebuggerAgent->willSendXMLHttpRequest(url); #endif } @@ -433,7 +433,7 @@ void InspectorInstrumentation::didReceiveResourceResponseImpl(const InspectorIns InspectorController* ic = cookie.first; if (InspectorResourceAgent* resourceAgent = retrieveResourceAgent(ic)) resourceAgent->didReceiveResponse(identifier, loader, response); - ic->m_consoleAgent->didReceiveResponse(identifier, response); + ic->consoleAgent()->didReceiveResponse(identifier, response); if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(cookie)) timelineAgent->didReceiveResourceResponse(); } @@ -454,7 +454,7 @@ void InspectorInstrumentation::didFinishLoadingImpl(InspectorController* ic, uns void InspectorInstrumentation::didFailLoadingImpl(InspectorController* ic, unsigned long identifier, const ResourceError& error) { - ic->m_consoleAgent->didFailLoading(identifier, error); + ic->consoleAgent()->didFailLoading(identifier, error); if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(ic)) timelineAgent->didFinishLoadingResource(identifier, true, 0); if (InspectorResourceAgent* resourceAgent = retrieveResourceAgent(ic)) @@ -463,7 +463,7 @@ void InspectorInstrumentation::didFailLoadingImpl(InspectorController* ic, unsig void InspectorInstrumentation::resourceRetrievedByXMLHttpRequestImpl(InspectorController* ic, unsigned long identifier, const String& sourceString, const String& url, const String& sendURL, unsigned sendLineNumber) { - ic->m_consoleAgent->resourceRetrievedByXMLHttpRequest(url, sendURL, sendLineNumber); + ic->consoleAgent()->resourceRetrievedByXMLHttpRequest(url, sendURL, sendLineNumber); if (InspectorResourceAgent* resourceAgent = retrieveResourceAgent(ic)) resourceAgent->setInitialContent(identifier, sourceString, "XHR"); } @@ -549,9 +549,36 @@ void InspectorInstrumentation::consoleMarkTimelineImpl(InspectorController* insp #if ENABLE(JAVASCRIPT_DEBUGGER) void InspectorInstrumentation::addStartProfilingMessageToConsoleImpl(InspectorController* inspectorController, const String& title, unsigned lineNumber, const String& sourceURL) { - if (InspectorProfilerAgent* profilerAgent = inspectorController->m_profilerAgent.get()) + if (InspectorProfilerAgent* profilerAgent = inspectorController->profilerAgent()) profilerAgent->addStartProfilingMessageToConsole(title, lineNumber, sourceURL); } + +void InspectorInstrumentation::addProfileImpl(InspectorController* inspectorController, RefPtr<ScriptProfile> profile, ScriptCallStack* callStack) +{ + if (InspectorProfilerAgent* profilerAgent = inspectorController->profilerAgent()) { + const ScriptCallFrame& lastCaller = callStack->at(0); + profilerAgent->addProfile(profile, lastCaller.lineNumber(), lastCaller.sourceURL()); + } +} + +bool InspectorInstrumentation::profilerEnabledImpl(InspectorController* inspectorController) +{ + if (!inspectorController->enabled()) + return false; + + InspectorProfilerAgent* profilerAgent = inspectorController->profilerAgent(); + if (!profilerAgent) + return false; + + return profilerAgent->enabled(); +} + +String InspectorInstrumentation::getCurrentUserInitiatedProfileNameImpl(InspectorController* inspectorController, bool incrementProfileNumber) +{ + if (InspectorProfilerAgent* profilerAgent = inspectorController->profilerAgent()) + return profilerAgent->getCurrentUserInitiatedProfileName(incrementProfileNumber); + return ""; +} #endif #if ENABLE(DATABASE) @@ -624,7 +651,7 @@ bool InspectorInstrumentation::hasFrontend(InspectorController* inspectorControl void InspectorInstrumentation::pauseOnNativeEventIfNeeded(InspectorController* inspectorController, const String& categoryType, const String& eventName, bool synchronous) { #if ENABLE(JAVASCRIPT_DEBUGGER) - if (InspectorBrowserDebuggerAgent* browserDebuggerAgent = inspectorController->m_browserDebuggerAgent.get()) + if (InspectorBrowserDebuggerAgent* browserDebuggerAgent = inspectorController->browserDebuggerAgent()) browserDebuggerAgent->pauseOnNativeEventIfNeeded(categoryType, eventName, synchronous); #endif } @@ -632,14 +659,14 @@ void InspectorInstrumentation::pauseOnNativeEventIfNeeded(InspectorController* i void InspectorInstrumentation::cancelPauseOnNativeEvent(InspectorController* inspectorController) { #if ENABLE(JAVASCRIPT_DEBUGGER) - if (InspectorDebuggerAgent* debuggerAgent = inspectorController->m_debuggerAgent.get()) + if (InspectorDebuggerAgent* debuggerAgent = inspectorController->debuggerAgent()) debuggerAgent->cancelPauseOnNextStatement(); #endif } InspectorTimelineAgent* InspectorInstrumentation::retrieveTimelineAgent(InspectorController* inspectorController) { - return inspectorController->m_timelineAgent.get(); + return inspectorController->timelineAgent(); } InspectorTimelineAgent* InspectorInstrumentation::retrieveTimelineAgent(const InspectorInstrumentationCookie& cookie) @@ -652,7 +679,7 @@ InspectorTimelineAgent* InspectorInstrumentation::retrieveTimelineAgent(const In InspectorResourceAgent* InspectorInstrumentation::retrieveResourceAgent(InspectorController* ic) { - return ic->m_resourceAgent.get(); + return ic->resourceAgent(); } } // namespace WebCore diff --git a/Source/WebCore/inspector/InspectorInstrumentation.h b/Source/WebCore/inspector/InspectorInstrumentation.h index 28867cb..7a7ee43 100644 --- a/Source/WebCore/inspector/InspectorInstrumentation.h +++ b/Source/WebCore/inspector/InspectorInstrumentation.h @@ -139,6 +139,9 @@ public: #if ENABLE(JAVASCRIPT_DEBUGGER) static void addStartProfilingMessageToConsole(Page*, const String& title, unsigned lineNumber, const String& sourceURL); + static void addProfile(Page*, RefPtr<ScriptProfile>, ScriptCallStack*); + static bool profilerEnabled(Page*); + static String getCurrentUserInitiatedProfileName(Page*, bool incrementProfileNumber); #endif #if ENABLE(DATABASE) @@ -246,6 +249,9 @@ private: #if ENABLE(JAVASCRIPT_DEBUGGER) static void addStartProfilingMessageToConsoleImpl(InspectorController*, const String& title, unsigned lineNumber, const String& sourceURL); + static void addProfileImpl(InspectorController*, RefPtr<ScriptProfile>, ScriptCallStack*); + static bool profilerEnabledImpl(InspectorController*); + static String getCurrentUserInitiatedProfileNameImpl(InspectorController*, bool incrementProfileNumber); #endif #if ENABLE(DATABASE) @@ -881,6 +887,32 @@ inline void InspectorInstrumentation::addStartProfilingMessageToConsole(Page* pa addStartProfilingMessageToConsoleImpl(inspectorController, title, lineNumber, sourceURL); #endif } + +inline void InspectorInstrumentation::addProfile(Page* page, RefPtr<ScriptProfile> profile, ScriptCallStack* callStack) +{ +#if ENABLE(INSPECTOR) + if (InspectorController* inspectorController = inspectorControllerForPage(page)) + addProfileImpl(inspectorController, profile, callStack); +#endif +} + +inline bool InspectorInstrumentation::profilerEnabled(Page* page) +{ +#if ENABLE(INSPECTOR) + if (InspectorController* inspectorController = inspectorControllerForPage(page)) + return profilerEnabledImpl(inspectorController); +#endif + return false; +} + +inline String InspectorInstrumentation::getCurrentUserInitiatedProfileName(Page* page, bool incrementProfileNumber) +{ +#if ENABLE(INSPECTOR) + if (InspectorController* inspectorController = inspectorControllerForPage(page)) + return InspectorInstrumentation::getCurrentUserInitiatedProfileNameImpl(inspectorController, incrementProfileNumber); +#endif + return ""; +} #endif #if ENABLE(INSPECTOR) @@ -936,6 +968,7 @@ inline InspectorController* InspectorInstrumentation::inspectorControllerWithFro } return 0; } + #endif } // namespace WebCore diff --git a/Source/WebCore/inspector/InspectorProfilerAgent.cpp b/Source/WebCore/inspector/InspectorProfilerAgent.cpp index da9b67d..8c4f28f 100644 --- a/Source/WebCore/inspector/InspectorProfilerAgent.cpp +++ b/Source/WebCore/inspector/InspectorProfilerAgent.cpp @@ -88,6 +88,8 @@ void InspectorProfilerAgent::addProfile(PassRefPtr<ScriptProfile> prpProfile, un void InspectorProfilerAgent::addProfileFinishedMessageToConsole(PassRefPtr<ScriptProfile> prpProfile, unsigned lineNumber, const String& sourceURL) { + if (!m_frontend) + return; RefPtr<ScriptProfile> profile = prpProfile; String title = profile->title(); String message = makeString("Profile \"webkit-profile://", CPUProfileType, '/', encodeWithURLEscapeSequences(title), '#', String::number(profile->uid()), "\" finished."); @@ -96,6 +98,8 @@ void InspectorProfilerAgent::addProfileFinishedMessageToConsole(PassRefPtr<Scrip void InspectorProfilerAgent::addStartProfilingMessageToConsole(const String& title, unsigned lineNumber, const String& sourceURL) { + if (!m_frontend) + return; String message = makeString("Profile \"webkit-profile://", CPUProfileType, '/', encodeWithURLEscapeSequences(title), "#0\" started."); m_inspectorController->consoleAgent()->addMessageToConsole(JSMessageSource, LogMessageType, LogMessageLevel, message, lineNumber, sourceURL); } @@ -211,7 +215,12 @@ void InspectorProfilerAgent::resetState() m_currentUserInitiatedProfileNumber = 1; m_nextUserInitiatedProfileNumber = 1; m_nextUserInitiatedHeapSnapshotNumber = 1; - if (m_frontend) + resetFrontendProfiles(); +} + +void InspectorProfilerAgent::resetFrontendProfiles() +{ + if (m_frontend && m_profiles.begin() == m_profiles.end()) m_frontend->resetProfiles(); } diff --git a/Source/WebCore/inspector/InspectorProfilerAgent.h b/Source/WebCore/inspector/InspectorProfilerAgent.h index e67848d..436ae51 100644 --- a/Source/WebCore/inspector/InspectorProfilerAgent.h +++ b/Source/WebCore/inspector/InspectorProfilerAgent.h @@ -47,7 +47,8 @@ class InspectorObject; class ScriptHeapSnapshot; class ScriptProfile; -class InspectorProfilerAgent : public Noncopyable { +class InspectorProfilerAgent { + WTF_MAKE_NONCOPYABLE(InspectorProfilerAgent); WTF_MAKE_FAST_ALLOCATED; public: static PassOwnPtr<InspectorProfilerAgent> create(InspectorController*); virtual ~InspectorProfilerAgent(); @@ -65,6 +66,7 @@ public: bool isRecordingUserInitiatedProfile() { return m_recordingUserInitiatedProfile; } void removeProfile(const String& type, unsigned uid); void resetState(); + void resetFrontendProfiles(); void setFrontend(InspectorFrontend* frontend) { m_frontend = frontend; } void startUserInitiatedProfiling(); void stopUserInitiatedProfiling(bool ignoreProfile = false); diff --git a/Source/WebCore/inspector/InspectorResourceAgent.cpp b/Source/WebCore/inspector/InspectorResourceAgent.cpp index 6779790..029c79d 100644 --- a/Source/WebCore/inspector/InspectorResourceAgent.cpp +++ b/Source/WebCore/inspector/InspectorResourceAgent.cpp @@ -45,6 +45,7 @@ #include "HTMLNames.h" #include "HTTPHeaderMap.h" #include "InspectorFrontend.h" +#include "InspectorState.h" #include "InspectorValues.h" #include "KURL.h" #include "Page.h" @@ -66,6 +67,13 @@ namespace WebCore { +PassRefPtr<InspectorResourceAgent> InspectorResourceAgent::restore(Page* page, InspectorState* state, InspectorFrontend* frontend) +{ + if (state->getBoolean(InspectorState::resourceAgentEnabled)) + return create(page, state, frontend); + return 0; +} + bool InspectorResourceAgent::resourceContent(Frame* frame, const KURL& url, String* result) { if (!frame) @@ -281,6 +289,7 @@ static void populateObjectWithFrameResources(Frame* frame, PassRefPtr<InspectorO InspectorResourceAgent::~InspectorResourceAgent() { + m_state->setBoolean(InspectorState::resourceAgentEnabled, false); } void InspectorResourceAgent::identifierForInitialRequest(unsigned long identifier, const KURL& url, DocumentLoader* loader) @@ -476,10 +485,12 @@ void InspectorResourceAgent::resourceContent(unsigned long id, const String& url } } -InspectorResourceAgent::InspectorResourceAgent(Page* page, InspectorFrontend* frontend) +InspectorResourceAgent::InspectorResourceAgent(Page* page, InspectorState* state, InspectorFrontend* frontend) : m_page(page) + , m_state(state) , m_frontend(frontend) { + m_state->setBoolean(InspectorState::resourceAgentEnabled, true); } } // namespace WebCore diff --git a/Source/WebCore/inspector/InspectorResourceAgent.h b/Source/WebCore/inspector/InspectorResourceAgent.h index 1e77d58..6c2df24 100644 --- a/Source/WebCore/inspector/InspectorResourceAgent.h +++ b/Source/WebCore/inspector/InspectorResourceAgent.h @@ -49,8 +49,9 @@ class Document; class DocumentLoader; class Frame; class InspectorArray; -class InspectorObject; class InspectorFrontend; +class InspectorObject; +class InspectorState; class KURL; class Page; class ResourceError; @@ -65,11 +66,13 @@ class WebSocketHandshakeResponse; class InspectorResourceAgent : public RefCounted<InspectorResourceAgent> { public: - static PassRefPtr<InspectorResourceAgent> create(Page* page, InspectorFrontend* frontend) + static PassRefPtr<InspectorResourceAgent> create(Page* page, InspectorState* state, InspectorFrontend* frontend) { - return adoptRef(new InspectorResourceAgent(page, frontend)); + return adoptRef(new InspectorResourceAgent(page, state, frontend)); } + static PassRefPtr<InspectorResourceAgent> restore(Page*, InspectorState*, InspectorFrontend*); + static bool resourceContent(Frame*, const KURL&, String* result); static bool resourceContentBase64(Frame*, const KURL&, String* result); static PassRefPtr<SharedBuffer> resourceData(Frame*, const KURL&, String* textEncodingName); @@ -103,9 +106,10 @@ public: void resourceContent(unsigned long frameID, const String& url, bool base64Encode, String* content); private: - InspectorResourceAgent(Page* page, InspectorFrontend* frontend); + InspectorResourceAgent(Page* page, InspectorState*, InspectorFrontend* frontend); Page* m_page; + InspectorState* m_state; InspectorFrontend* m_frontend; }; diff --git a/Source/WebCore/inspector/InspectorRuntimeAgent.cpp b/Source/WebCore/inspector/InspectorRuntimeAgent.cpp new file mode 100644 index 0000000..0502437 --- /dev/null +++ b/Source/WebCore/inspector/InspectorRuntimeAgent.cpp @@ -0,0 +1,83 @@ +/* + * Copyright (C) 2011 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 "InspectorRuntimeAgent.h" + +#if ENABLE(INSPECTOR) + +#include "InjectedScriptHost.h" +#include "InspectorValues.h" + +namespace WebCore { + +InspectorRuntimeAgent::InspectorRuntimeAgent(InjectedScriptHost* injectedScriptHost) + : m_injectedScriptHost(injectedScriptHost) +{ +} + +InspectorRuntimeAgent::~InspectorRuntimeAgent() { } + +void InspectorRuntimeAgent::evaluate(const String& expression, const String& objectGroup, RefPtr<InspectorValue>* result) +{ + InjectedScript injectedScript = m_injectedScriptHost->injectedScriptForMainFrame(); + if (!injectedScript.hasNoValue()) + injectedScript.evaluate(expression, objectGroup, result); +} + +void InspectorRuntimeAgent::getCompletions(const String& expression, bool includeInspectorCommandLineAPI, RefPtr<InspectorValue>* result) +{ + InjectedScript injectedScript = m_injectedScriptHost->injectedScriptForMainFrame(); + if (!injectedScript.hasNoValue()) + injectedScript.getCompletions(expression, includeInspectorCommandLineAPI, result); +} + +void InspectorRuntimeAgent::getProperties(PassRefPtr<InspectorObject> objectId, bool ignoreHasOwnProperty, bool abbreviate, RefPtr<InspectorValue>* result) +{ + InjectedScript injectedScript = m_injectedScriptHost->injectedScriptForObjectId(objectId.get()); + if (!injectedScript.hasNoValue()) + injectedScript.getProperties(objectId, ignoreHasOwnProperty, abbreviate, result); +} + +void InspectorRuntimeAgent::setPropertyValue(PassRefPtr<InspectorObject> objectId, const String& propertyName, const String& expression, RefPtr<InspectorValue>* result) +{ + InjectedScript injectedScript = m_injectedScriptHost->injectedScriptForObjectId(objectId.get()); + if (!injectedScript.hasNoValue()) + injectedScript.setPropertyValue(objectId, propertyName, expression, result); +} + +void InspectorRuntimeAgent::releaseWrapperObjectGroup(long injectedScriptId, const String& objectGroup) +{ + m_injectedScriptHost->releaseWrapperObjectGroup(injectedScriptId, objectGroup); +} + +} // namespace WebCore + +#endif // ENABLE(INSPECTOR) diff --git a/Source/WebCore/inspector/InspectorRuntimeAgent.h b/Source/WebCore/inspector/InspectorRuntimeAgent.h new file mode 100644 index 0000000..3ac2eed --- /dev/null +++ b/Source/WebCore/inspector/InspectorRuntimeAgent.h @@ -0,0 +1,75 @@ +/* + * Copyright (C) 2011 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 InspectorRuntimeAgent_h +#define InspectorRuntimeAgent_h + +#if ENABLE(INSPECTOR) + +#include "InjectedScript.h" +#include "PlatformString.h" + +#include <wtf/Noncopyable.h> +#include <wtf/PassOwnPtr.h> +#include <wtf/PassRefPtr.h> + +namespace WebCore { + +class InjectedScriptHost; +class InspectorObject; +class InspectorValue; + +class InspectorRuntimeAgent { + WTF_MAKE_NONCOPYABLE(InspectorRuntimeAgent); +public: + static PassOwnPtr<InspectorRuntimeAgent> create(InjectedScriptHost* injectedScriptHost) + { + return adoptPtr(new InspectorRuntimeAgent(injectedScriptHost)); + } + + ~InspectorRuntimeAgent(); + + // Part of the protocol. + void evaluate(const String& expression, const String& objectGroup, RefPtr<InspectorValue>* result); + void getCompletions(const String& expression, bool includeInspectorCommandLineAPI, RefPtr<InspectorValue>* result); + void getProperties(PassRefPtr<InspectorObject> objectId, bool ignoreHasOwnProperty, bool abbreviate, RefPtr<InspectorValue>* result); + void setPropertyValue(PassRefPtr<InspectorObject> objectId, const String& propertyName, const String& expression, RefPtr<InspectorValue>* result); + void releaseWrapperObjectGroup(long injectedScriptId, const String& objectGroup); + +private: + InspectorRuntimeAgent(InjectedScriptHost*); + + InjectedScriptHost* m_injectedScriptHost; +}; + +} // namespace WebCore + +#endif // ENABLE(INSPECTOR) +#endif // InspectorRuntimeAgent_h diff --git a/Source/WebCore/inspector/InspectorState.cpp b/Source/WebCore/inspector/InspectorState.cpp index 1b74518..dba9e4d 100644 --- a/Source/WebCore/inspector/InspectorState.cpp +++ b/Source/WebCore/inspector/InspectorState.cpp @@ -39,15 +39,13 @@ InspectorState::InspectorState(InspectorClient* client) : m_client(client) { // Pure reload state - registerBoolean(userInitiatedProfiling, false, String()); - registerBoolean(timelineProfilerEnabled, false, String()); - registerBoolean(searchingForNode, false, String()); - registerObject(stickyBreakpoints, String()); - - // Should go away - registerBoolean(consoleMessagesEnabled, false, "consoleMessagesEnabled"); - registerBoolean(monitoringXHR, false, "monitoringXHREnabled"); - registerLong(pauseOnExceptionsState, 0, "pauseOnExceptionsState"); + registerBoolean(userInitiatedProfiling, false); + registerBoolean(timelineProfilerEnabled, false); + registerBoolean(searchingForNode, false); + registerObject(browserBreakpoints); + registerBoolean(consoleMessagesEnabled, false); + registerBoolean(monitoringXHR, false); + registerBoolean(resourceAgentEnabled, false); } void InspectorState::restoreFromInspectorCookie(const String& json) @@ -70,16 +68,6 @@ void InspectorState::restoreFromInspectorCookie(const String& json) } } -PassRefPtr<InspectorObject> InspectorState::generateStateObjectForFrontend() -{ - RefPtr<InspectorObject> stateObject = InspectorObject::create(); - for (PropertyMap::iterator i = m_properties.begin(); i != m_properties.end(); ++i) { - if (i->second.m_frontendAlias.length()) - stateObject->setValue(i->second.m_frontendAlias, i->second.m_value); - } - return stateObject.release(); -} - void InspectorState::updateCookie() { RefPtr<InspectorObject> cookieObject = InspectorObject::create(); @@ -139,31 +127,30 @@ void InspectorState::setObject(InspectorPropertyId id, PassRefPtr<InspectorObjec updateCookie(); } -void InspectorState::registerBoolean(InspectorPropertyId propertyId, bool value, const String& frontendAlias) +void InspectorState::registerBoolean(InspectorPropertyId propertyId, bool value) { - m_properties.set(propertyId, Property::create(InspectorBasicValue::create(value), frontendAlias)); + m_properties.set(propertyId, Property::create(InspectorBasicValue::create(value))); } -void InspectorState::registerString(InspectorPropertyId propertyId, const String& value, const String& frontendAlias) +void InspectorState::registerString(InspectorPropertyId propertyId, const String& value) { - m_properties.set(propertyId, Property::create(InspectorString::create(value), frontendAlias)); + m_properties.set(propertyId, Property::create(InspectorString::create(value))); } -void InspectorState::registerLong(InspectorPropertyId propertyId, long value, const String& frontendAlias) +void InspectorState::registerLong(InspectorPropertyId propertyId, long value) { - m_properties.set(propertyId, Property::create(InspectorBasicValue::create((double)value), frontendAlias)); + m_properties.set(propertyId, Property::create(InspectorBasicValue::create((double)value))); } -void InspectorState::registerObject(InspectorPropertyId propertyId, const String& frontendAlias) +void InspectorState::registerObject(InspectorPropertyId propertyId) { - m_properties.set(propertyId, Property::create(InspectorObject::create(), frontendAlias)); + m_properties.set(propertyId, Property::create(InspectorObject::create())); } -InspectorState::Property InspectorState::Property::create(PassRefPtr<InspectorValue> value, const String& frontendAlias) +InspectorState::Property InspectorState::Property::create(PassRefPtr<InspectorValue> value) { Property property; property.m_value = value; - property.m_frontendAlias = frontendAlias; return property; } diff --git a/Source/WebCore/inspector/InspectorState.h b/Source/WebCore/inspector/InspectorState.h index 3142c92..6e12673 100644 --- a/Source/WebCore/inspector/InspectorState.h +++ b/Source/WebCore/inspector/InspectorState.h @@ -47,45 +47,42 @@ public: monitoringXHR = 1, timelineProfilerEnabled, searchingForNode, - pauseOnExceptionsState, consoleMessagesEnabled, userInitiatedProfiling, - stickyBreakpoints, + browserBreakpoints, + resourceAgentEnabled, lastPropertyId }; InspectorState(InspectorClient* client); - PassRefPtr<InspectorObject> generateStateObjectForFrontend(); void restoreFromInspectorCookie(const String& jsonString); - String getFrontendAlias(InspectorPropertyId propertyId); - bool getBoolean(InspectorPropertyId propertyId); - String getString(InspectorPropertyId propertyId); - long getLong(InspectorPropertyId propertyId); - PassRefPtr<InspectorObject> getObject(InspectorPropertyId id); + bool getBoolean(InspectorPropertyId); + String getString(InspectorPropertyId); + long getLong(InspectorPropertyId); + PassRefPtr<InspectorObject> getObject(InspectorPropertyId); void setBoolean(InspectorPropertyId propertyId, bool value) { setValue(propertyId, InspectorBasicValue::create(value)); } void setString(InspectorPropertyId propertyId, const String& value) { setValue(propertyId, InspectorString::create(value)); } void setLong(InspectorPropertyId propertyId, long value) { setValue(propertyId, InspectorBasicValue::create((double)value)); } - void setObject(InspectorPropertyId propertyId, PassRefPtr<InspectorObject> value); + void setObject(InspectorPropertyId, PassRefPtr<InspectorObject> value); private: void updateCookie(); - void setValue(InspectorPropertyId propertyId, PassRefPtr<InspectorValue> value); + void setValue(InspectorPropertyId, PassRefPtr<InspectorValue>); struct Property { - static Property create(PassRefPtr<InspectorValue> value, const String& frontendAlias); - String m_frontendAlias; + static Property create(PassRefPtr<InspectorValue> value); RefPtr<InspectorValue> m_value; }; typedef HashMap<long, Property> PropertyMap; PropertyMap m_properties; - void registerBoolean(InspectorPropertyId propertyId, bool value, const String& frontendAlias); - void registerString(InspectorPropertyId propertyId, const String& value, const String& frontendAlias); - void registerLong(InspectorPropertyId propertyId, long value, const String& frontendAlias); - void registerObject(InspectorPropertyId propertyId, const String& frontendAlias); + void registerBoolean(InspectorPropertyId, bool value); + void registerString(InspectorPropertyId, const String& value); + void registerLong(InspectorPropertyId, long value); + void registerObject(InspectorPropertyId); InspectorClient* m_client; }; diff --git a/Source/WebCore/inspector/InspectorTimelineAgent.h b/Source/WebCore/inspector/InspectorTimelineAgent.h index 33e2737..cae5aad 100644 --- a/Source/WebCore/inspector/InspectorTimelineAgent.h +++ b/Source/WebCore/inspector/InspectorTimelineAgent.h @@ -70,7 +70,8 @@ enum TimelineRecordType { ScheduleResourceRequestTimelineRecordType = 20 }; -class InspectorTimelineAgent : ScriptGCEventListener, public Noncopyable { +class InspectorTimelineAgent : ScriptGCEventListener { + WTF_MAKE_NONCOPYABLE(InspectorTimelineAgent); WTF_MAKE_FAST_ALLOCATED; public: InspectorTimelineAgent(InspectorFrontend* frontend); ~InspectorTimelineAgent(); diff --git a/Source/WebCore/inspector/InspectorValues.cpp b/Source/WebCore/inspector/InspectorValues.cpp index 89e9b7c..d1b8093 100644 --- a/Source/WebCore/inspector/InspectorValues.cpp +++ b/Source/WebCore/inspector/InspectorValues.cpp @@ -647,6 +647,14 @@ bool InspectorObject::getBoolean(const String& name, bool* output) const return value->asBoolean(output); } +bool InspectorObject::getNumber(const String& name, long* output) const +{ + RefPtr<InspectorValue> value = get(name); + if (!value) + return false; + return value->asNumber(output); +} + bool InspectorObject::getNumber(const String& name, double* output) const { RefPtr<InspectorValue> value = get(name); diff --git a/Source/WebCore/inspector/InspectorValues.h b/Source/WebCore/inspector/InspectorValues.h index 391372e..843f369 100644 --- a/Source/WebCore/inspector/InspectorValues.h +++ b/Source/WebCore/inspector/InspectorValues.h @@ -180,6 +180,7 @@ public: const_iterator find(const String& name) const; bool getBoolean(const String& name, bool* output) const; + bool getNumber(const String& name, long* output) const; bool getNumber(const String& name, double* output) const; bool getString(const String& name, String* output) const; PassRefPtr<InspectorObject> getObject(const String& name) const; diff --git a/Source/WebCore/inspector/JavaScriptCallFrame.idl b/Source/WebCore/inspector/JavaScriptCallFrame.idl index 225059d..db0e0a6 100644 --- a/Source/WebCore/inspector/JavaScriptCallFrame.idl +++ b/Source/WebCore/inspector/JavaScriptCallFrame.idl @@ -43,6 +43,7 @@ module inspector { readonly attribute JavaScriptCallFrame caller; readonly attribute long sourceID; readonly attribute long line; + readonly attribute long column; readonly attribute [CustomGetter] Array scopeChain; [Custom] unsigned short scopeType(in int scopeIndex); readonly attribute [CustomGetter] Object thisObject; diff --git a/Source/WebCore/inspector/front-end/AuditLauncherView.js b/Source/WebCore/inspector/front-end/AuditLauncherView.js index c140589..df16a41 100644 --- a/Source/WebCore/inspector/front-end/AuditLauncherView.js +++ b/Source/WebCore/inspector/front-end/AuditLauncherView.js @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009 Google Inc. All rights reserved. + * Copyright (C) 2011 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 @@ -50,60 +50,38 @@ WebInspector.AuditLauncherView = function(runnerCallback) this._headerElement.className = "no-audits"; this._headerElement.textContent = WebInspector.UIString("No audits to run"); this._contentElement.appendChild(this._headerElement); + + WebInspector.networkManager.addEventListener(WebInspector.NetworkManager.EventTypes.ResourceStarted, this._onResourceStarted, this); + WebInspector.networkManager.addEventListener(WebInspector.NetworkManager.EventTypes.ResourceFinished, this._onResourceFinished, this); } WebInspector.AuditLauncherView.prototype = { - get totalResources() + _resetResourceCount: function() { - return this._totalResources; + this._loadedResources = 0; + this._totalResources = 0; }, - set totalResources(x) + _onResourceStarted: function(event) { - if (this._totalResources === x) + var resource = event.data; + // Ignore long-living WebSockets for the sake of progress indicator, as we won't be waiting them anyway. + if (resource.type === WebInspector.Resource.Type.WebSocket) return; - this._totalResources = x; + ++this._totalResources; this._updateResourceProgress(); }, - get loadedResources() - { - return this._loadedResources; - }, - - set loadedResources(x) + _onResourceFinished: function(event) { - if (this._loadedResources === x) + var resource = event.data; + // See resorceStarted for details. + if (resource.type === WebInspector.Resource.Type.WebSocket) return; - this._loadedResources = x; + ++this._loadedResources; this._updateResourceProgress(); }, - _resetResourceCount: function() - { - this.loadedResources = 0; - this.totalResources = 0; - }, - - resourceStarted: function(resource) - { - // Ignore long-living WebSockets for the sake of progress indicator, as we won't be waiting them anyway. - if (resource.type !== WebInspector.Resource.Type.WebSocket) - ++this.totalResources; - }, - - resourceFinished: function(resource) - { - // See resorceStarted for details. - if (resource.type !== WebInspector.Resource.Type.WebSocket) - ++this.loadedResources; - }, - - reset: function() - { - this._resetResourceCount(); - }, - addCategory: function(category) { if (!this._sortedCategories.length) @@ -264,7 +242,7 @@ WebInspector.AuditLauncherView.prototype = { this._resourceProgressContainer.addStyleClass("hidden"); } else this._resourceProgressContainer.removeStyleClass("hidden"); - this._resourceProgressTextElement.textContent = WebInspector.UIString("Loading (%d of %d)", this.loadedResources, this.totalResources); + this._resourceProgressTextElement.textContent = WebInspector.UIString("Loading (%d of %d)", this._loadedResources, this._totalResources); }, _updateButton: function() diff --git a/Source/WebCore/inspector/front-end/AuditRules.js b/Source/WebCore/inspector/front-end/AuditRules.js index 7aa891f..c2bbcbb 100644 --- a/Source/WebCore/inspector/front-end/AuditRules.js +++ b/Source/WebCore/inspector/front-end/AuditRules.js @@ -65,7 +65,7 @@ WebInspector.AuditRules.getDomainToResourcesMap = function(resources, types, nee WebInspector.AuditRules.evaluateInTargetWindow = function(func, args, callback) { - InjectedScriptAccess.getDefault().evaluateOnSelf(func.toString(), args, callback); + InspectorBackend.evaluateOnSelf(func.toString(), args, callback); } @@ -721,7 +721,7 @@ WebInspector.AuditRules.ImageDimensionsRule.prototype = { return nodeIds; } - WebInspector.AuditRules.evaluateInTargetWindow(pushImageNodes, null, receivedImages); + WebInspector.AuditRules.evaluateInTargetWindow(pushImageNodes, [], receivedImages); } } @@ -797,7 +797,7 @@ WebInspector.AuditRules.CssInHeadRule.prototype = { return found ? urlToViolationsArray : null; } - WebInspector.AuditRules.evaluateInTargetWindow(routine, null, evalCallback); + WebInspector.AuditRules.evaluateInTargetWindow(routine, [], evalCallback); } } @@ -844,7 +844,7 @@ WebInspector.AuditRules.StylesScriptsOrderRule.prototype = { return [ lateStyleUrls, cssBeforeInlineCount ]; } - WebInspector.AuditRules.evaluateInTargetWindow(routine, null, evalCallback.bind(this)); + WebInspector.AuditRules.evaluateInTargetWindow(routine, [], evalCallback.bind(this)); } } diff --git a/Source/WebCore/inspector/front-end/AuditsPanel.js b/Source/WebCore/inspector/front-end/AuditsPanel.js index c639f47..f3cbfa7 100644 --- a/Source/WebCore/inspector/front-end/AuditsPanel.js +++ b/Source/WebCore/inspector/front-end/AuditsPanel.js @@ -96,16 +96,6 @@ WebInspector.AuditsPanel.prototype = { return this._auditCategoriesById; }, - resourceStarted: function(resource) - { - this._launcherView.resourceStarted(resource); - }, - - resourceFinished: function(resource) - { - this._launcherView.resourceFinished(resource); - }, - addCategory: function(category) { this.categoriesById[category.id] = category; @@ -246,11 +236,6 @@ WebInspector.AuditsPanel.prototype = { x.show(this.viewsContainerElement); }, - reset: function() - { - this._launcherView.reset(); - }, - attach: function() { WebInspector.Panel.prototype.attach.call(this); diff --git a/Source/WebCore/inspector/front-end/Breakpoint.js b/Source/WebCore/inspector/front-end/Breakpoint.js index e5e1768..aa600a7 100644 --- a/Source/WebCore/inspector/front-end/Breakpoint.js +++ b/Source/WebCore/inspector/front-end/Breakpoint.js @@ -37,7 +37,6 @@ WebInspector.Breakpoint = function(debuggerModel, breakpointId, sourceID, url, l this.sourceID = sourceID; this._enabled = enabled; this._condition = condition || ""; - this._hit = false; this._debuggerModel = debuggerModel; } @@ -60,52 +59,14 @@ WebInspector.Breakpoint.prototype = { return this._condition; }, - get hit() + get data() { - return this._hit; - }, - - set hit(hit) - { - this._hit = hit; - this.dispatchEventToListeners("hit-state-changed"); - }, - - click: function(event) - { - WebInspector.panels.scripts.showSourceLine(this.url, this.line); - }, - - compareTo: function(other) - { - if (this.url != other.url) - return this.url < other.url ? -1 : 1; - if (this.line != other.line) - return this.line < other.line ? -1 : 1; - return 0; - }, - - populateLabelElement: function(element) - { - function didGetSourceLine(text) - { - var displayName = this.url ? WebInspector.displayNameForURL(this.url) : WebInspector.UIString("(program)"); - var labelElement = document.createTextNode(displayName + ":" + this.line); - element.appendChild(labelElement); - - var sourceTextElement = document.createElement("div"); - sourceTextElement.textContent = text; - sourceTextElement.className = "source-text monospace"; - element.appendChild(sourceTextElement); - } - var script = this._debuggerModel.scriptForSourceID(this.sourceID); - script.sourceLine(this.line, didGetSourceLine.bind(this)); + return { id: this.id, url: this.url, sourceID: this.sourceID, lineNumber: this.line, condition: this.condition }; }, remove: function() { this._debuggerModel.removeBreakpoint(this.id); - this.dispatchEventToListeners("removed"); this.removeAllListeners(); delete this._debuggerModel; } diff --git a/Source/WebCore/inspector/front-end/BreakpointManager.js b/Source/WebCore/inspector/front-end/BreakpointManager.js index 67ef112..d943d5b 100644 --- a/Source/WebCore/inspector/front-end/BreakpointManager.js +++ b/Source/WebCore/inspector/front-end/BreakpointManager.js @@ -34,7 +34,7 @@ WebInspector.BreakpointManager = function() var breakpoints = WebInspector.settings.findSettingForAllProjects("nativeBreakpoints"); for (var projectId in breakpoints) this._stickyBreakpoints[projectId] = this._validateBreakpoints(breakpoints[projectId]); - InspectorBackend.setStickyBreakpoints(this._stickyBreakpoints); + InspectorBackend.setAllBrowserBreakpoints(this._stickyBreakpoints); this._breakpoints = {}; this._domBreakpointsRestored = false; @@ -303,7 +303,7 @@ WebInspector.BreakpointManager.prototype = { WebInspector.settings.nativeBreakpoints = breakpoints; this._stickyBreakpoints[WebInspector.settings.projectId] = breakpoints; - InspectorBackend.setStickyBreakpoints(this._stickyBreakpoints); + InspectorBackend.setAllBrowserBreakpoints(this._stickyBreakpoints); }, _validateBreakpoints: function(persistentBreakpoints) diff --git a/Source/WebCore/inspector/front-end/BreakpointsSidebarPane.js b/Source/WebCore/inspector/front-end/BreakpointsSidebarPane.js index 408c5ba..b237ca2 100644 --- a/Source/WebCore/inspector/front-end/BreakpointsSidebarPane.js +++ b/Source/WebCore/inspector/front-end/BreakpointsSidebarPane.js @@ -23,7 +23,213 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -WebInspector.BreakpointsSidebarPane = function(title) +WebInspector.JavaScriptBreakpointsSidebarPane = function(title) +{ + WebInspector.SidebarPane.call(this, WebInspector.UIString("Breakpoints")); + + this.listElement = document.createElement("ol"); + this.listElement.className = "breakpoint-list"; + + this.emptyElement = document.createElement("div"); + this.emptyElement.className = "info"; + this.emptyElement.textContent = WebInspector.UIString("No Breakpoints"); + + this.bodyElement.appendChild(this.emptyElement); + + this._items = {}; + + WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.BreakpointAdded, this._breakpointAdded, this); + WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.BreakpointRemoved, this._breakpointRemoved, this); + WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.DebuggerPaused, this._debuggerPaused, this); + WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.DebuggerResumed, this._debuggerResumed, this); + WebInspector.breakpointManager.addEventListener(WebInspector.BreakpointManager.Events.ProjectChanged, this._projectChanged, this); +} + +WebInspector.JavaScriptBreakpointsSidebarPane.prototype = { + _breakpointAdded: function(event) + { + var breakpoint = event.data; + var breakpointId = breakpoint.id; + var data = breakpoint.data; + + var element = document.createElement("li"); + + var checkbox = document.createElement("input"); + checkbox.className = "checkbox-elem"; + checkbox.type = "checkbox"; + checkbox.checked = breakpoint.enabled; + checkbox.addEventListener("click", this._breakpointItemCheckboxClicked.bind(this, breakpointId), false); + element.appendChild(checkbox); + + var label = document.createElement("span"); + element.appendChild(label); + + element._data = data; + var currentElement = this.listElement.firstChild; + while (currentElement) { + if (currentElement._data && this._compareBreakpoints(currentElement._data, element._data) > 0) + break; + currentElement = currentElement.nextSibling; + } + this._addListElement(element, currentElement); + + element.addEventListener("contextmenu", this._contextMenuEventFired.bind(this, breakpointId), true); + + this._setupBreakpointElement(data, element); + + var breakpointItem = {}; + breakpointItem.data = data; + breakpointItem.element = element; + breakpointItem.checkbox = checkbox; + this._items[breakpointId] = breakpointItem; + + if (!this.expanded) + this.expanded = true; + }, + + _breakpointRemoved: function(event) + { + var breakpointId = event.data; + var breakpointItem = this._items[breakpointId]; + if (breakpointItem) { + delete this._items[breakpointId]; + this._removeListElement(breakpointItem.element); + } + }, + + _breakpointEnableChanged: function(enabled, event) + { + var breakpointId = event.data; + var breakpointItem = this._items[breakpointId]; + if (breakpointItem) + breakpointItem.checkbox.checked = enabled; + }, + + _breakpointItemCheckboxClicked: function(breakpointId, event) + { + this._setBreakpointEnabled(breakpointId, event.target.checked); + + // Breakpoint element may have it's own click handler. + event.stopPropagation(); + }, + + _contextMenuEventFired: function(breakpointId, event) + { + var contextMenu = new WebInspector.ContextMenu(); + contextMenu.appendItem(WebInspector.UIString("Remove Breakpoint"), this._removeBreakpoint.bind(this, breakpointId)); + contextMenu.show(event); + }, + + _debuggerPaused: function(event) + { + var breakpointId = this._breakpointIdForDebuggerPausedEvent(event.data); + if (!breakpointId) + return; + var breakpointItem = this._items[breakpointId]; + if (!breakpointItem) + return; + breakpointItem.element.addStyleClass("breakpoint-hit"); + this._lastHitBreakpointItem = breakpointItem; + }, + + _debuggerResumed: function() + { + if (this._lastHitBreakpointItem) { + this._lastHitBreakpointItem.element.removeStyleClass("breakpoint-hit"); + delete this._lastHitBreakpointItem; + } + }, + + _addListElement: function(element, beforeElement) + { + if (beforeElement) + this.listElement.insertBefore(element, beforeElement); + else { + if (!this.listElement.firstChild) { + this.bodyElement.removeChild(this.emptyElement); + this.bodyElement.appendChild(this.listElement); + } + this.listElement.appendChild(element); + } + }, + + _removeListElement: function(element) + { + this.listElement.removeChild(element); + if (!this.listElement.firstChild) { + this.bodyElement.removeChild(this.listElement); + this.bodyElement.appendChild(this.emptyElement); + } + }, + + _projectChanged: function() + { + this.listElement.removeChildren(); + if (this.listElement.parentElement) { + this.bodyElement.removeChild(this.listElement); + this.bodyElement.appendChild(this.emptyElement); + } + this._items = {}; + }, + + _compare: function(x, y) + { + if (x !== y) + return x < y ? -1 : 1; + return 0; + }, + + _compareBreakpoints: function(b1, b2) + { + return this._compare(b1.url, b2.url) || this._compare(b1.lineNumber, b2.lineNumber); + }, + + _setupBreakpointElement: function(data, element) + { + var displayName = data.url ? WebInspector.displayNameForURL(data.url) : WebInspector.UIString("(program)"); + var labelElement = document.createTextNode(displayName + ":" + data.lineNumber); + element.appendChild(labelElement); + + var sourceTextElement = document.createElement("div"); + sourceTextElement.className = "source-text monospace"; + element.appendChild(sourceTextElement); + + function didGetSourceLine(text) + { + sourceTextElement.textContent = text; + } + var script = WebInspector.debuggerModel.scriptForSourceID(data.sourceID); + script.sourceLine(data.lineNumber, didGetSourceLine.bind(this)); + + element.addStyleClass("cursor-pointer"); + var clickHandler = WebInspector.panels.scripts.showSourceLine.bind(WebInspector.panels.scripts, data.url, data.lineNumber); + element.addEventListener("click", clickHandler, false); + }, + + _breakpointIdForDebuggerPausedEvent: function(details) + { + var callFrame = details.callFrames[0]; + var breakpoint = WebInspector.debuggerModel.findBreakpoint(callFrame.sourceID, callFrame.line); + if (breakpoint) + return breakpoint.id; + }, + + _setBreakpointEnabled: function(breakpointId, enabled) + { + var breakpoint = WebInspector.debuggerModel.breakpointForId(breakpointId); + WebInspector.debuggerModel.removeBreakpoint(breakpointId); + WebInspector.debuggerModel.setBreakpoint(breakpoint.sourceID, breakpoint.line, enabled, breakpoint.condition); + }, + + _removeBreakpoint: function(breakpointId) + { + WebInspector.debuggerModel.removeBreakpoint(breakpointId); + } +} + +WebInspector.JavaScriptBreakpointsSidebarPane.prototype.__proto__ = WebInspector.SidebarPane.prototype; + +WebInspector.NativeBreakpointsSidebarPane = function(title) { WebInspector.SidebarPane.call(this, title); @@ -39,7 +245,7 @@ WebInspector.BreakpointsSidebarPane = function(title) WebInspector.breakpointManager.addEventListener(WebInspector.BreakpointManager.Events.ProjectChanged, this._projectChanged, this); } -WebInspector.BreakpointsSidebarPane.prototype = { +WebInspector.NativeBreakpointsSidebarPane.prototype = { addBreakpointItem: function(breakpointItem) { var element = breakpointItem.element; @@ -102,11 +308,11 @@ WebInspector.BreakpointsSidebarPane.prototype = { } } -WebInspector.BreakpointsSidebarPane.prototype.__proto__ = WebInspector.SidebarPane.prototype; +WebInspector.NativeBreakpointsSidebarPane.prototype.__proto__ = WebInspector.SidebarPane.prototype; WebInspector.XHRBreakpointsSidebarPane = function() { - WebInspector.BreakpointsSidebarPane.call(this, WebInspector.UIString("XHR Breakpoints")); + WebInspector.NativeBreakpointsSidebarPane.call(this, WebInspector.UIString("XHR Breakpoints")); function addButtonClicked(event) { @@ -123,7 +329,7 @@ WebInspector.XHRBreakpointsSidebarPane = function() WebInspector.XHRBreakpointsSidebarPane.prototype = { addBreakpointItem: function(breakpointItem) { - WebInspector.BreakpointsSidebarPane.prototype.addBreakpointItem.call(this, breakpointItem); + WebInspector.NativeBreakpointsSidebarPane.prototype.addBreakpointItem.call(this, breakpointItem); breakpointItem._labelElement.addEventListener("dblclick", this._startEditingBreakpoint.bind(this, breakpointItem), false); }, @@ -166,7 +372,7 @@ WebInspector.XHRBreakpointsSidebarPane.prototype = { } } -WebInspector.XHRBreakpointsSidebarPane.prototype.__proto__ = WebInspector.BreakpointsSidebarPane.prototype; +WebInspector.XHRBreakpointsSidebarPane.prototype.__proto__ = WebInspector.NativeBreakpointsSidebarPane.prototype; WebInspector.BreakpointItem = function(breakpoint) { diff --git a/Source/WebCore/inspector/front-end/CSSCompletions.js b/Source/WebCore/inspector/front-end/CSSCompletions.js index e8d7556..f60c297 100644 --- a/Source/WebCore/inspector/front-end/CSSCompletions.js +++ b/Source/WebCore/inspector/front-end/CSSCompletions.js @@ -44,7 +44,7 @@ WebInspector.CSSCompletions.prototype = { return []; var results = []; - while (this._values[firstIndex].indexOf(prefix) === 0) + while (firstIndex < this._values.length && this._values[firstIndex].indexOf(prefix) === 0) results.push(this._values[firstIndex++]); return results; }, diff --git a/Source/WebCore/inspector/front-end/CSSKeywordCompletions.js b/Source/WebCore/inspector/front-end/CSSKeywordCompletions.js new file mode 100755 index 0000000..ac62aff --- /dev/null +++ b/Source/WebCore/inspector/front-end/CSSKeywordCompletions.js @@ -0,0 +1,438 @@ +/* + * Copyright (C) 2011 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. + */ + +WebInspector.CSSKeywordCompletions = { + forProperty: function(propertyName) + { + var acceptedKeywords = ["initial"]; + if (propertyName in this._propertyKeywordMap) + acceptedKeywords = acceptedKeywords.concat(this._propertyKeywordMap[propertyName]); + if (propertyName in this._colorAwareProperties) + acceptedKeywords = acceptedKeywords.concat(WebInspector.CSSKeywordCompletions._colors); + if (propertyName in WebInspector.StylesSidebarPane.InheritedProperties) + acceptedKeywords.push("inherit"); + return new WebInspector.CSSCompletions(acceptedKeywords); + } +}; + +WebInspector.CSSKeywordCompletions._colors = [ + "aqua", "black", "blue", "fuchsia", "gray", "green", "lime", "maroon", "navy", "olive", "orange", "purple", "red", + "silver", "teal", "white", "yellow", "transparent", "currentcolor", "grey", "aliceblue", "antiquewhite", + "aquamarine", "azure", "beige", "bisque", "blanchedalmond", "blueviolet", "brown", "burlywood", "cadetblue", + "chartreuse", "chocolate", "coral", "cornflowerblue", "cornsilk", "crimson", "cyan", "darkblue", "darkcyan", + "darkgoldenrod", "darkgray", "darkgreen", "darkgrey", "darkkhaki", "darkmagenta", "darkolivegreen", "darkorange", + "darkorchid", "darkred", "darksalmon", "darkseagreen", "darkslateblue", "darkslategray", "darkslategrey", + "darkturquoise", "darkviolet", "deeppink", "deepskyblue", "dimgray", "dimgrey", "dodgerblue", "firebrick", + "floralwhite", "forestgreen", "gainsboro", "ghostwhite", "gold", "goldenrod", "greenyellow", "honeydew", "hotpink", + "indianred", "indigo", "ivory", "khaki", "lavender", "lavenderblush", "lawngreen", "lemonchiffon", "lightblue", + "lightcoral", "lightcyan", "lightgoldenrodyellow", "lightgray", "lightgreen", "lightgrey", "lightpink", + "lightsalmon", "lightseagreen", "lightskyblue", "lightslategray", "lightslategrey", "lightsteelblue", "lightyellow", + "limegreen", "linen", "magenta", "mediumaquamarine", "mediumblue", "mediumorchid", "mediumpurple", "mediumseagreen", + "mediumslateblue", "mediumspringgreen", "mediumturquoise", "mediumvioletred", "midnightblue", "mintcream", + "mistyrose", "moccasin", "navajowhite", "oldlace", "olivedrab", "orangered", "orchid", "palegoldenrod", "palegreen", + "paleturquoise", "palevioletred", "papayawhip", "peachpuff", "peru", "pink", "plum", "powderblue", "rosybrown", + "royalblue", "saddlebrown", "salmon", "sandybrown", "seagreen", "seashell", "sienna", "skyblue", "slateblue", + "slategray", "slategrey", "snow", "springgreen", "steelblue", "tan", "thistle", "tomato", "turquoise", "violet", + "wheat", "whitesmoke", "yellowgreen" +], + +WebInspector.CSSKeywordCompletions._colorAwareProperties = [ + "background", "background-color", "border", "border-color", "border-top", "border-right", "border-bottom", + "border-left", "border-top-color", "border-right-color", "border-bottom-color", "border-left-color", "color", + "outline", "outline-color", "text-line-through", "text-line-through-color", "text-overline", "text-overline-color", + "text-shadow", "text-underline", "text-underline-color", "-webkit-text-emphasis", "-webkit-text-emphasis-color" +].keySet(); + +WebInspector.CSSKeywordCompletions._propertyKeywordMap = { + "table-layout": [ + "auto", "fixed" + ], + "visibility": [ + "hidden", "visible", "collapse" + ], + "background-repeat": [ + "repeat", "repeat-x", "repeat-y", "no-repeat", "space", "round" + ], + "text-underline": [ + "none", "dotted", "dashed", "solid", "double", "dot-dash", "dot-dot-dash", "wave" + ], + "content": [ + "list-item", "close-quote", "no-close-quote", "no-open-quote", "open-quote" + ], + "list-style-image": [ + "none" + ], + "clear": [ + "none", "left", "right", "both" + ], + "text-underline-mode": [ + "continuous", "skip-white-space" + ], + "overflow-x": [ + "hidden", "auto", "visible", "overlay", "scroll" + ], + "stroke-linejoin": [ + "round", "miter", "bevel" + ], + "baseline-shift": [ + "baseline", "sub", "super" + ], + "border-bottom-width": [ + "medium", "thick", "thin" + ], + "marquee-speed": [ + "normal", "slow", "fast" + ], + "margin-top-collapse": [ + "collapse", "separate", "discard" + ], + "max-height": [ + "none" + ], + "box-orient": [ + "horizontal", "vertical", "inline-axis", "block-axis" + ], + "font-stretch": [ + "normal", "wider", "narrower", "ultra-condensed", "extra-condensed", "condensed", "semi-condensed", + "semi-expanded", "expanded", "extra-expanded", "ultra-expanded" + ], + "-webkit-color-correction": [ + "default", "srgb" + ], + "text-underline-style": [ + "none", "dotted", "dashed", "solid", "double", "dot-dash", "dot-dot-dash", "wave" + ], + "text-overline-mode": [ + "continuous", "skip-white-space" + ], + "-webkit-background-composite": [ + "highlight", "clear", "copy", "source-over", "source-in", "source-out", "source-atop", "destination-over", + "destination-in", "destination-out", "destination-atop", "xor", "plus-darker", "plus-lighter" + ], + "border-left-width": [ + "medium", "thick", "thin" + ], + "-webkit-writing-mode": [ + "lr", "rl", "tb", "lr-tb", "rl-tb", "tb-rl", "horizontal-tb", "vertical-rl", "vertical-lr", "horizontal-bt" + ], + "text-line-through-mode": [ + "continuous", "skip-white-space" + ], + "border-collapse": [ + "collapse", "separate" + ], + "page-break-inside": [ + "auto", "avoid" + ], + "border-top-width": [ + "medium", "thick", "thin" + ], + "outline-color": [ + "invert" + ], + "text-line-through-style": [ + "none", "dotted", "dashed", "solid", "double", "dot-dash", "dot-dot-dash", "wave" + ], + "outline-style": [ + "none", "hidden", "inset", "groove", "ridge", "outset", "dotted", "dashed", "solid", "double" + ], + "cursor": [ + "none", "copy", "auto", "crosshair", "default", "pointer", "move", "vertical-text", "cell", "context-menu", + "alias", "progress", "no-drop", "not-allowed", "-webkit-zoom-in", "-webkit-zoom-out", "e-resize", "ne-resize", + "nw-resize", "n-resize", "se-resize", "sw-resize", "s-resize", "w-resize", "ew-resize", "ns-resize", + "nesw-resize", "nwse-resize", "col-resize", "row-resize", "text", "wait", "help", "all-scroll", "-webkit-grab", + "-webkit-grabbing" + ], + "border-width": [ + "medium", "thick", "thin" + ], + "size": [ + "a3", "a4", "a5", "b4", "b5", "landscape", "ledger", "legal", "letter", "portrait" + ], + "background-size": [ + "contain", "cover" + ], + "direction": [ + "ltr", "rtl" + ], + "marquee-direction": [ + "left", "right", "auto", "reverse", "forwards", "backwards", "ahead", "up", "down" + ], + "enable-background": [ + "accumulate", "new" + ], + "float": [ + "none", "left", "right" + ], + "overflow-y": [ + "hidden", "auto", "visible", "overlay", "scroll" + ], + "margin-bottom-collapse": [ + "collapse", "separate", "discard" + ], + "box-reflect": [ + "left", "right", "above", "below" + ], + "overflow": [ + "hidden", "auto", "visible", "overlay", "scroll" + ], + "text-rendering": [ + "auto", "optimizespeed", "optimizelegibility", "geometricprecision" + ], + "text-align": [ + "-webkit-auto", "left", "right", "center", "justify", "-webkit-left", "-webkit-right", "-webkit-center" + ], + "list-style-position": [ + "outside", "inside" + ], + "margin-bottom": [ + "auto" + ], + "color-interpolation": [ + "linearrgb" + ], + "background-origin": [ + "border-box", "content-box", "padding-box" + ], + "word-wrap": [ + "normal", "break-word" + ], + "font-weight": [ + "normal", "bold", "bolder", "lighter", "100", "200", "300", "400", "500", "600", "700", "800", "900" + ], + "margin-before-collapse": [ + "collapse", "separate", "discard" + ], + "text-overline-width": [ + "normal", "medium", "auto", "thick", "thin" + ], + "text-transform": [ + "none", "capitalize", "uppercase", "lowercase" + ], + "border-right-style": [ + "none", "hidden", "inset", "groove", "ridge", "outset", "dotted", "dashed", "solid", "double" + ], + "border-left-style": [ + "none", "hidden", "inset", "groove", "ridge", "outset", "dotted", "dashed", "solid", "double" + ], + "-webkit-text-emphasis": [ + "circle", "filled", "open", "dot", "double-circle", "triangle", "sesame" + ], + "font-style": [ + "italic", "oblique", "normal" + ], + "speak": [ + "none", "normal", "spell-out", "digits", "literal-punctuation", "no-punctuation" + ], + "text-line-through": [ + "none", "dotted", "dashed", "solid", "double", "dot-dash", "dot-dot-dash", "wave", "continuous", + "skip-white-space" + ], + "color-rendering": [ + "auto", "optimizespeed", "optimizequality" + ], + "list-style-type": [ + "none", "disc", "circle", "square", "decimal", "decimal-leading-zero", "arabic-indic", "binary", "bengali", + "cambodian", "khmer", "devanagari", "gujarati", "gurmukhi", "kannada", "lower-hexadecimal", "lao", "malayalam", + "mongolian", "myanmar", "octal", "oriya", "persian", "urdu", "telugu", "tibetan", "thai", "upper-hexadecimal", + "lower-roman", "upper-roman", "lower-greek", "lower-alpha", "lower-latin", "upper-alpha", "upper-latin", "afar", + "ethiopic-halehame-aa-et", "ethiopic-halehame-aa-er", "amharic", "ethiopic-halehame-am-et", "amharic-abegede", + "ethiopic-abegede-am-et", "cjk-earthly-branch", "cjk-heavenly-stem", "ethiopic", "ethiopic-halehame-gez", + "ethiopic-abegede", "ethiopic-abegede-gez", "hangul-consonant", "hangul", "lower-norwegian", "oromo", + "ethiopic-halehame-om-et", "sidama", "ethiopic-halehame-sid-et", "somali", "ethiopic-halehame-so-et", "tigre", + "ethiopic-halehame-tig", "tigrinya-er", "ethiopic-halehame-ti-er", "tigrinya-er-abegede", + "ethiopic-abegede-ti-er", "tigrinya-et", "ethiopic-halehame-ti-et", "tigrinya-et-abegede", + "ethiopic-abegede-ti-et", "upper-greek", "upper-norwegian", "asterisks", "footnotes", "hebrew", "armenian", + "lower-armenian", "upper-armenian", "georgian", "cjk-ideographic", "hiragana", "katakana", "hiragana-iroha", + "katakana-iroha" + ], + "-webkit-text-combine": [ + "none", "horizontal" + ], + "outline": [ + "none", "hidden", "inset", "groove", "ridge", "outset", "dotted", "dashed", "solid", "double" + ], + "font": [ + "caption", "icon", "menu", "message-box", "small-caption", "-webkit-mini-control", "-webkit-small-control", + "-webkit-control", "status-bar", "italic", "oblique", "small-caps", "normal", "bold", "bolder", "lighter", + "100", "200", "300", "400", "500", "600", "700", "800", "900", "xx-small", "x-small", "small", "medium", + "large", "x-large", "xx-large", "-webkit-xxx-large", "smaller", "larger", "serif", "sans-serif", "cursive", + "fantasy", "monospace", "-webkit-body" + ], + "dominant-baseline": [ + "middle", "auto", "central", "text-before-edge", "text-after-edge", "ideographic", "alphabetic", "hanging", + "mathematical", "use-script", "no-change", "reset-size" + ], + "display": [ + "none", "inline", "block", "list-item", "run-in", "compact", "inline-block", "table", "inline-table", + "table-row-group", "table-header-group", "table-footer-group", "table-row", "table-column-group", + "table-column", "table-cell", "table-caption", "-webkit-box", "-webkit-inline-box", "-wap-marquee" + ], + "-webkit-text-emphasis-position": [ + "over", "under" + ], + "image-rendering": [ + "auto", "optimizespeed", "optimizequality" + ], + "alignment-baseline": [ + "baseline", "middle", "auto", "before-edge", "after-edge", "central", "text-before-edge", "text-after-edge", + "ideographic", "alphabetic", "hanging", "mathematical" + ], + "outline-width": [ + "medium", "thick", "thin" + ], + "text-line-through-width": [ + "normal", "medium", "auto", "thick", "thin" + ], + "box-align": [ + "baseline", "center", "stretch", "start", "end" + ], + "border-right-width": [ + "medium", "thick", "thin" + ], + "border-top-style": [ + "none", "hidden", "inset", "groove", "ridge", "outset", "dotted", "dashed", "solid", "double" + ], + "line-height": [ + "normal" + ], + "text-overflow": [ + "clip", "ellipsis" + ], + "box-direction": [ + "normal", "reverse" + ], + "margin-after-collapse": [ + "collapse", "separate", "discard" + ], + "page-break-before": [ + "left", "right", "auto", "always", "avoid" + ], + "-webkit-hyphens": [ + "none", "auto", "manual" + ], + "border-image": [ + "repeat", "stretch" + ], + "text-decoration": [ + "blink", "line-through", "overline", "underline" + ], + "position": [ + "absolute", "fixed", "relative", "static" + ], + "font-family": [ + "serif", "sans-serif", "cursive", "fantasy", "monospace", "-webkit-body" + ], + "text-overflow-mode": [ + "clip", "ellipsis" + ], + "border-bottom-style": [ + "none", "hidden", "inset", "groove", "ridge", "outset", "dotted", "dashed", "solid", "double" + ], + "unicode-bidi": [ + "normal", "bidi-override", "embed" + ], + "clip-rule": [ + "nonzero", "evenodd" + ], + "margin-left": [ + "auto" + ], + "margin-top": [ + "auto" + ], + "zoom": [ + "document", "reset" + ], + "text-overline-style": [ + "none", "dotted", "dashed", "solid", "double", "dot-dash", "dot-dot-dash", "wave" + ], + "max-width": [ + "none" + ], + "empty-cells": [ + "hide", "show" + ], + "pointer-events": [ + "none", "all", "auto", "visible", "visiblepainted", "visiblefill", "visiblestroke", "painted", "fill", "stroke" + ], + "letter-spacing": [ + "normal" + ], + "background-clip": [ + "border-box", "content-box", "padding-box" + ], + "-webkit-font-smoothing": [ + "none", "auto", "antialiased", "subpixel-antialiased" + ], + "border": [ + "none", "hidden", "inset", "groove", "ridge", "outset", "dotted", "dashed", "solid", "double" + ], + "font-size": [ + "xx-small", "x-small", "small", "medium", "large", "x-large", "xx-large", "-webkit-xxx-large", "smaller", + "larger" + ], + "font-variant": [ + "small-caps", "normal" + ], + "vertical-align": [ + "baseline", "middle", "sub", "super", "text-top", "text-bottom", "top", "bottom", "-webkit-baseline-middle" + ], + "marquee-style": [ + "none", "scroll", "slide", "alternate" + ], + "white-space": [ + "normal", "nowrap", "pre", "pre-line", "pre-wrap" + ], + "text-underline-width": [ + "normal", "medium", "auto", "thick", "thin" + ], + "box-lines": [ + "single", "multiple" + ], + "page-break-after": [ + "left", "right", "auto", "always", "avoid" + ], + "clip-path": [ + "none" + ], + "margin": [ + "auto" + ], + "marquee-repetition": [ + "infinite" + ], + "margin-right": [ + "auto" + ], + "-webkit-text-emphasis-style": [ + "circle", "filled", "open", "dot", "double-circle", "triangle", "sesame" + ] +} diff --git a/Source/WebCore/inspector/front-end/ConsoleView.js b/Source/WebCore/inspector/front-end/ConsoleView.js index a40030e..bd08e60 100644 --- a/Source/WebCore/inspector/front-end/ConsoleView.js +++ b/Source/WebCore/inspector/front-end/ConsoleView.js @@ -149,6 +149,11 @@ WebInspector.ConsoleView.prototype = { consoleMessagesCleared: function() { console.clearMessages(); + }, + + monitoringXHRStateChanged: function(enabled) + { + console._monitoringXHREnabled = enabled; } } InspectorBackend.registerDomainDispatcher("Console", dispatcher); @@ -355,14 +360,11 @@ WebInspector.ConsoleView.prototype = { // Collect comma separated object properties for the completion. var includeInspectorCommandLineAPI = (!dotNotation && !bracketNotation); - var callFrameId = WebInspector.panels.scripts.selectedCallFrameId(); var injectedScriptAccess; - if (WebInspector.panels.scripts && WebInspector.panels.scripts.paused) { - var selectedCallFrame = WebInspector.panels.scripts.sidebarPanes.callstack.selectedCallFrame; - injectedScriptAccess = InjectedScriptAccess.get(selectedCallFrame.worldId); - } else - injectedScriptAccess = InjectedScriptAccess.getDefault(); - injectedScriptAccess.getCompletions(expressionString, includeInspectorCommandLineAPI, callFrameId, reportCompletions); + if (WebInspector.panels.scripts && WebInspector.panels.scripts.paused) + InspectorBackend.getCompletionsOnCallFrame(WebInspector.panels.scripts.selectedCallFrameId(), expressionString, includeInspectorCommandLineAPI, reportCompletions); + else + InspectorBackend.getCompletions(expressionString, includeInspectorCommandLineAPI, reportCompletions); }, _reportCompletions: function(bestMatchOnly, completionsReadyCallback, dotNotation, bracketNotation, prefix, result, isException) { @@ -416,14 +418,9 @@ WebInspector.ConsoleView.prototype = { return; } + var itemAction = InspectorBackend.setMonitoringXHREnabled.bind(InspectorBackend, !this._monitoringXHREnabled); var contextMenu = new WebInspector.ContextMenu(); - - function monitoringXHRWasChanged(newState) - { - WebInspector.monitoringXHREnabled = newState; - } - var itemAction = InspectorBackend.setMonitoringXHREnabled.bind(InspectorBackend, !WebInspector.monitoringXHREnabled, monitoringXHRWasChanged); - contextMenu.appendCheckboxItem(WebInspector.UIString("XMLHttpRequest logging"), itemAction, WebInspector.monitoringXHREnabled); + contextMenu.appendCheckboxItem(WebInspector.UIString("XMLHttpRequest logging"), itemAction, this._monitoringXHREnabled); contextMenu.appendItem(WebInspector.UIString("Clear Console"), this.requestClearMessages.bind(this)); contextMenu.show(event); }, @@ -532,8 +529,8 @@ WebInspector.ConsoleView.prototype = { function evalCallback(result) { callback(WebInspector.RemoteObject.fromPayload(result)); - }; - InjectedScriptAccess.getDefault().evaluate(expression, objectGroup, evalCallback); + } + InspectorBackend.evaluate(expression, objectGroup, evalCallback); }, _enterKeyPressed: function(event) @@ -681,6 +678,15 @@ WebInspector.ConsoleMessage = function(source, type, level, line, url, repeatCou this._parameters = parameters; this._stackTrace = stackTrace; this._requestId = requestId; + + if (stackTrace && stackTrace.length) { + var topCallFrame = stackTrace[0]; + if (!this.url) + this.url = topCallFrame.scriptName; + if (!this.line) + this.line = topCallFrame.lineNumber; + } + this._formatMessage(); } @@ -737,17 +743,8 @@ WebInspector.ConsoleMessage.prototype = { this._formattedMessage = document.createElement("span"); this._formattedMessage.className = "console-message-text source-code"; - if (stackTrace && stackTrace.length) { - var topCallFrame = stackTrace[0]; - var sourceName = topCallFrame.scriptName; - var sourceLine = topCallFrame.lineNumber; - } else { - var sourceName = this.url; - var sourceLine = this.line; - } - - if (sourceName && sourceName !== "undefined") { - var urlElement = WebInspector.linkifyResourceAsNode(sourceName, "scripts", sourceLine, "console-message-url"); + if (this.url && this.url !== "undefined") { + var urlElement = WebInspector.linkifyResourceAsNode(this.url, "scripts", this.line, "console-message-url"); this._formattedMessage.appendChild(urlElement); } diff --git a/Source/WebCore/inspector/front-end/DebuggerModel.js b/Source/WebCore/inspector/front-end/DebuggerModel.js index 8f5bcf7..717486c 100644 --- a/Source/WebCore/inspector/front-end/DebuggerModel.js +++ b/Source/WebCore/inspector/front-end/DebuggerModel.js @@ -31,6 +31,7 @@ WebInspector.DebuggerModel = function() { this._paused = false; + this._callFrames = []; this._breakpoints = {}; this._sourceIDAndLineToBreakpointId = {}; this._scripts = {}; @@ -43,6 +44,7 @@ WebInspector.DebuggerModel.Events = { DebuggerResumed: "debugger-resumed", ParsedScriptSource: "parsed-script-source", FailedToParseScriptSource: "failed-to-parse-script-source", + ScriptSourceChanged: "script-source-changed", BreakpointAdded: "breakpoint-added", BreakpointRemoved: "breakpoint-removed" } @@ -84,6 +86,7 @@ WebInspector.DebuggerModel.prototype = { delete this._breakpoints[breakpointId]; delete this._sourceIDAndLineToBreakpointId[this._encodeSourceIDAndLine(breakpoint.sourceID, breakpoint.line)]; this.dispatchEventToListeners(WebInspector.DebuggerModel.Events.BreakpointRemoved, breakpointId); + breakpoint.dispatchEventToListeners("removed"); }, _breakpointSetOnBackend: function(breakpointId, sourceID, lineNumber, condition, enabled, originalLineNumber, restored) @@ -103,6 +106,11 @@ WebInspector.DebuggerModel.prototype = { this.dispatchEventToListeners(WebInspector.DebuggerModel.Events.BreakpointAdded, breakpoint); }, + breakpointForId: function(breakpointId) + { + return this._breakpoints[breakpointId]; + }, + queryBreakpoints: function(filter) { var breakpoints = []; @@ -129,6 +137,7 @@ WebInspector.DebuggerModel.prototype = { reset: function() { this._paused = false; + this._callFrames = []; this._breakpoints = {}; delete this._oneTimeBreakpoint; this._sourceIDAndLineToBreakpointId = {}; @@ -156,39 +165,81 @@ WebInspector.DebuggerModel.prototype = { return scripts; }, + editScriptSource: function(sourceID, scriptSource) + { + function didEditScriptSource(success, newBodyOrErrorMessage, callFrames) + { + if (success) { + if (callFrames && callFrames.length) + this._callFrames = callFrames; + this._updateScriptSource(sourceID, newBodyOrErrorMessage); + } else + WebInspector.log(newBodyOrErrorMessage, WebInspector.ConsoleMessage.MessageLevel.Warning); + } + InspectorBackend.editScriptSource(sourceID, scriptSource, didEditScriptSource.bind(this)); + }, + + _updateScriptSource: function(sourceID, scriptSource) + { + var script = this._scripts[sourceID]; + var oldSource = script.source; + script.source = scriptSource; + + // Clear and re-create breakpoints according to text diff. + var diff = Array.diff(oldSource.split("\n"), script.source.split("\n")); + for (var id in this._breakpoints) { + var breakpoint = this._breakpoints[id]; + if (breakpoint.sourceID !== sourceID) + continue; + breakpoint.remove(); + var lineNumber = breakpoint.line - 1; + var newLineNumber = diff.left[lineNumber].row; + if (newLineNumber === undefined) { + for (var i = lineNumber - 1; i >= 0; --i) { + if (diff.left[i].row === undefined) + continue; + var shiftedLineNumber = diff.left[i].row + lineNumber - i; + if (shiftedLineNumber < diff.right.length) { + var originalLineNumber = diff.right[shiftedLineNumber].row; + if (originalLineNumber === lineNumber || originalLineNumber === undefined) + newLineNumber = shiftedLineNumber; + } + break; + } + } + if (newLineNumber !== undefined) + this.setBreakpoint(sourceID, newLineNumber + 1, breakpoint.enabled, breakpoint.condition); + } + + this.dispatchEventToListeners(WebInspector.DebuggerModel.Events.ScriptSourceChanged, { sourceID: sourceID, oldSource: oldSource }); + }, + + get callFrames() + { + return this._callFrames; + }, + _pausedScript: function(details) { this._paused = true; + this._callFrames = details.callFrames; if ("_continueToLineBreakpointId" in this) { InspectorBackend.removeBreakpoint(this._continueToLineBreakpointId); delete this._continueToLineBreakpointId; } this.dispatchEventToListeners(WebInspector.DebuggerModel.Events.DebuggerPaused, details); - - if (details.eventType === WebInspector.DebuggerEventTypes.JavaScriptPause || details.eventType === WebInspector.DebuggerEventTypes.NativeBreakpoint) - return; - - var breakpoint = this.findBreakpoint(details.callFrames[0].sourceID, details.callFrames[0].line); - if (!breakpoint) - return; - breakpoint.hit = true; - this._lastHitBreakpoint = breakpoint; }, _resumedScript: function() { this._paused = false; + this._callFrames = []; this.dispatchEventToListeners(WebInspector.DebuggerModel.Events.DebuggerResumed); - - if (!this._lastHitBreakpoint) - return; - this._lastHitBreakpoint.hit = false; - delete this._lastHitBreakpoint; }, - _parsedScriptSource: function(sourceID, sourceURL, lineOffset, columnOffset, scriptWorldType) + _parsedScriptSource: function(sourceID, sourceURL, lineOffset, columnOffset, length, scriptWorldType) { - var script = new WebInspector.Script(sourceID, sourceURL, "", lineOffset, columnOffset, undefined, undefined, scriptWorldType); + var script = new WebInspector.Script(sourceID, sourceURL, "", lineOffset, columnOffset, length, undefined, undefined, scriptWorldType); this._scripts[sourceID] = script; this.dispatchEventToListeners(WebInspector.DebuggerModel.Events.ParsedScriptSource, sourceID); }, @@ -234,9 +285,9 @@ WebInspector.DebuggerDispatcher.prototype = { WebInspector.panels.scripts.debuggerWasDisabled(); }, - parsedScriptSource: function(sourceID, sourceURL, lineOffset, columnOffset, scriptWorldType) + parsedScriptSource: function(sourceID, sourceURL, lineOffset, columnOffset, length, scriptWorldType) { - this._debuggerModel._parsedScriptSource(sourceID, sourceURL, lineOffset, columnOffset, scriptWorldType); + this._debuggerModel._parsedScriptSource(sourceID, sourceURL, lineOffset, columnOffset, length, scriptWorldType); }, failedToParseScriptSource: function(sourceURL, source, startingLine, errorLine, errorMessage) diff --git a/Source/WebCore/inspector/front-end/ElementsTreeOutline.js b/Source/WebCore/inspector/front-end/ElementsTreeOutline.js index 67d34b2..722c028 100644 --- a/Source/WebCore/inspector/front-end/ElementsTreeOutline.js +++ b/Source/WebCore/inspector/front-end/ElementsTreeOutline.js @@ -411,8 +411,7 @@ WebInspector.ElementsTreeElement.prototype = { else this.tooltip = WebInspector.UIString("%d × %d pixels (Natural: %d × %d pixels)", properties.offsetWidth, properties.offsetHeight, properties.naturalWidth, properties.naturalHeight); } - - InjectedScriptAccess.getForNode(node).getNodeProperties(node.id, ["naturalHeight", "naturalWidth", "offsetHeight", "offsetWidth"], setTooltip.bind(this)); + InspectorBackend.getNodeProperties(node.id, ["naturalHeight", "naturalWidth", "offsetHeight", "offsetWidth"], setTooltip.bind(this)); }, updateSelection: function() diff --git a/Source/WebCore/inspector/front-end/ExtensionAPI.js b/Source/WebCore/inspector/front-end/ExtensionAPI.js index a9a2423..b10452d 100644 --- a/Source/WebCore/inspector/front-end/ExtensionAPI.js +++ b/Source/WebCore/inspector/front-end/ExtensionAPI.js @@ -450,8 +450,9 @@ ExtensionServerClient.prototype = { _onCallback: function(request) { if (request.requestId in this._callbacks) { - this._callbacks[request.requestId](request.result); + var callback = this._callbacks[request.requestId]; delete this._callbacks[request.requestId]; + callback(request.result); } }, diff --git a/Source/WebCore/inspector/front-end/ExtensionPanel.js b/Source/WebCore/inspector/front-end/ExtensionPanel.js index 4b42e68..fb98350 100644 --- a/Source/WebCore/inspector/front-end/ExtensionPanel.js +++ b/Source/WebCore/inspector/front-end/ExtensionPanel.js @@ -95,7 +95,7 @@ WebInspector.ExtensionWatchSidebarPane.prototype = { setExpression: function(expression, title) { - InjectedScriptAccess.getDefault().evaluate(expression, this._onEvaluate.bind(this, title)); + InspectorBackend.evaluate(expression, "extension-watch", this._onEvaluate.bind(this, title)); }, _onEvaluate: function(title, result) diff --git a/Source/WebCore/inspector/front-end/ExtensionServer.js b/Source/WebCore/inspector/front-end/ExtensionServer.js index 1320efb..0924106 100644 --- a/Source/WebCore/inspector/front-end/ExtensionServer.js +++ b/Source/WebCore/inspector/front-end/ExtensionServer.js @@ -53,7 +53,6 @@ WebInspector.ExtensionServer = function() this._registerHandler("subscribe", this._onSubscribe.bind(this)); this._registerHandler("unsubscribe", this._onUnsubscribe.bind(this)); - window.addEventListener("message", this._onWindowMessage.bind(this), false); } @@ -68,11 +67,6 @@ WebInspector.ExtensionServer.prototype = { this._postNotification("panel-objectSelected-" + panelId, objectId); }, - notifyResourceFinished: function(resource) - { - this._postNotification("resource-finished", resource.identifier, (new WebInspector.HAREntry(resource)).build()); - }, - notifySearchAction: function(panelId, action, searchString) { this._postNotification("panel-search-" + panelId, action, searchString); @@ -114,6 +108,12 @@ WebInspector.ExtensionServer.prototype = { delete this._clientObjects[auditRun.id]; }, + _notifyResourceFinished: function(event) + { + var resource = event.data; + this._postNotification("resource-finished", resource.identifier, (new WebInspector.HAREntry(resource)).build()); + }, + _postNotification: function(type, details) { var subscribers = this._subscribers[type]; @@ -272,7 +272,7 @@ WebInspector.ExtensionServer.prototype = { var evalExpression = "JSON.stringify(eval('" + "with (window.console._commandLineAPI) with (window) {' + unescape('" + escape(message.expression) + "') + '}'));"; - InjectedScriptAccess.getDefault().evaluate(evalExpression, callback.bind(this)); + InspectorBackend.evaluate(evalExpression, "none", callback.bind(this)); }, _onRevealAndSelect: function(message) @@ -356,6 +356,9 @@ WebInspector.ExtensionServer.prototype = { initExtensions: function() { + // The networkManager is normally created after the ExtensionServer is constructed, but before initExtensions() is called. + WebInspector.networkManager.addEventListener(WebInspector.NetworkManager.EventTypes.ResourceFinished, this._notifyResourceFinished, this); + InspectorExtensionRegistry.getExtensionsAsync(); }, @@ -393,7 +396,6 @@ WebInspector.ExtensionServer.prototype = { "var apiPrivate = {};" + "(" + WebInspector.commonExtensionSymbols.toString() + ")(apiPrivate);" + "(" + WebInspector.injectedExtensionAPI.toString() + ").apply(this, arguments);" + - "webInspector.resources.Types = " + JSON.stringify(resourceTypes) + ";" + platformAPI + "})"; }, diff --git a/Source/WebCore/inspector/front-end/InjectedScriptAccess.js b/Source/WebCore/inspector/front-end/InjectedScriptAccess.js deleted file mode 100644 index cb3c2b8..0000000 --- a/Source/WebCore/inspector/front-end/InjectedScriptAccess.js +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright (C) 2009 Google Inc. All rights reserved. - * Copyright (C) 2009 Joseph Pecoraro - * - * 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. - */ - -function InjectedScriptAccess(worldId) { - this._worldId = worldId; -} - -InjectedScriptAccess.get = function(worldId) -{ - if (typeof worldId === "number") - return new InjectedScriptAccess(worldId); - - console.assert(false, "Access to injected script with no id"); -} - -InjectedScriptAccess.getForNode = function(node) -{ - // FIXME: do something. - return InjectedScriptAccess.get(-node.id); -} - -InjectedScriptAccess.getForObjectId = function(objectId) -{ - // FIXME: move to native layer. - var tokens = objectId.split(":"); - return InjectedScriptAccess.get(parseInt(tokens[0])); -} - -InjectedScriptAccess.getDefault = function() -{ - return InjectedScriptAccess.get(0); -} - -InjectedScriptAccess.prototype = {}; - -InjectedScriptAccess._installHandler = function(methodName, async) -{ - InjectedScriptAccess.prototype[methodName] = function() - { - var allArgs = Array.prototype.slice.call(arguments); - var callback = allArgs[allArgs.length - 1]; - var argsString = JSON.stringify(Array.prototype.slice.call(allArgs, 0, allArgs.length - 1)); - - function myCallback(result, isException) - { - if (!isException) - callback(result); - else - WebInspector.console.addMessage(WebInspector.ConsoleMessage.createTextMessage("Error dispatching: " + methodName)); - } - InspectorBackend.dispatchOnInjectedScript(this._worldId, methodName, argsString, myCallback); - }; -} - -// InjectedScriptAccess message forwarding puts some constraints on the way methods are implemented and called: -// - Make sure corresponding methods in InjectedScript return non-null and non-undefined values, -// - Make sure last parameter of all the InjectedSriptAccess.* calls is a callback function. -// We keep these sorted. -InjectedScriptAccess._installHandler("evaluate"); -InjectedScriptAccess._installHandler("evaluateInCallFrame"); -InjectedScriptAccess._installHandler("evaluateOnSelf"); -InjectedScriptAccess._installHandler("getCompletions"); -InjectedScriptAccess._installHandler("getProperties"); -InjectedScriptAccess._installHandler("getPrototypes"); -InjectedScriptAccess._installHandler("pushNodeToFrontend"); -InjectedScriptAccess._installHandler("resolveNode"); -InjectedScriptAccess._installHandler("getNodeProperties"); -InjectedScriptAccess._installHandler("setPropertyValue"); diff --git a/Source/WebCore/inspector/front-end/NetworkManager.js b/Source/WebCore/inspector/front-end/NetworkManager.js index a657377..ed4309e 100644 --- a/Source/WebCore/inspector/front-end/NetworkManager.js +++ b/Source/WebCore/inspector/front-end/NetworkManager.js @@ -30,6 +30,8 @@ WebInspector.NetworkManager = function(resourceTreeModel) { + WebInspector.Object.call(this); + this._inflightResources = {}; this._resourceTreeModel = resourceTreeModel; this._lastIdentifierForCachedResource = 0; @@ -86,6 +88,13 @@ WebInspector.NetworkManager.updateResourceWithCachedResource = function(resource WebInspector.NetworkManager.updateResourceWithResponse(resource, cachedResource.response); } +WebInspector.NetworkManager.EventTypes = { + ResourceStarted: "ResourceStarted", + ResourceUpdated: "ResourceUpdated", + ResourceFinished: "ResourceFinished", + MainResourceCommitLoad: "MainResourceCommitLoad" +} + WebInspector.NetworkManager.prototype = { reset: function() { @@ -119,7 +128,7 @@ WebInspector.NetworkManager.prototype = { if (isRedirect) this._startResource(resource); else - WebInspector.panels.network.refreshResource(resource); + this._updateResource(resource); }, markResourceAsCached: function(identifier) @@ -129,7 +138,7 @@ WebInspector.NetworkManager.prototype = { return; resource.cached = true; - WebInspector.panels.network.refreshResource(resource); + this._updateResource(resource); }, didReceiveResponse: function(identifier, time, resourceType, response) @@ -143,7 +152,7 @@ WebInspector.NetworkManager.prototype = { WebInspector.NetworkManager.updateResourceWithResponse(resource, response); - WebInspector.panels.network.refreshResource(resource); + this._updateResource(resource); this._resourceTreeModel.addResourceToFrame(resource.loader.frameId, resource); }, @@ -156,7 +165,7 @@ WebInspector.NetworkManager.prototype = { resource.resourceSize += lengthReceived; resource.endTime = time; - WebInspector.panels.network.refreshResource(resource); + this._updateResource(resource); }, didFinishLoading: function(identifier, finishTime) @@ -204,8 +213,7 @@ WebInspector.NetworkManager.prototype = { resource.type = WebInspector.Resource.Type[type]; resource.setInitialContent(sourceString); - WebInspector.panels.resources.refreshResource(resource); - WebInspector.panels.network.refreshResource(resource); + this._updateResource(resource); }, didCommitLoadForFrame: function(frame, loader) @@ -216,7 +224,7 @@ WebInspector.NetworkManager.prototype = { if (mainResource) { WebInspector.mainResource = mainResource; mainResource.isMainResource = true; - WebInspector.panels.network.mainResourceChanged(); + this.dispatchEventToListeners(WebInspector.NetworkManager.EventTypes.MainResourceCommitLoad, mainResource); } } }, @@ -239,7 +247,7 @@ WebInspector.NetworkManager.prototype = { resource.webSocketRequestKey3 = request.webSocketRequestKey3; resource.startTime = time; - WebInspector.panels.network.refreshResource(resource); + this._updateResource(resource); }, didReceiveWebSocketHandshakeResponse: function(identifier, time, response) @@ -254,7 +262,7 @@ WebInspector.NetworkManager.prototype = { resource.webSocketChallengeResponse = response.webSocketChallengeResponse; resource.responseReceivedTime = time; - WebInspector.panels.network.refreshResource(resource); + this._updateResource(resource); }, didCloseWebSocket: function(identifier, time) @@ -283,20 +291,24 @@ WebInspector.NetworkManager.prototype = { return newResource; }, - _startResource: function(resource, skipRefresh) + _startResource: function(resource) { this._inflightResources[resource.identifier] = resource; - WebInspector.panels.network.appendResource(resource, skipRefresh); - WebInspector.panels.audits.resourceStarted(resource); + this.dispatchEventToListeners(WebInspector.NetworkManager.EventTypes.ResourceStarted, resource); + }, + + _updateResource: function(resource) + { + this.dispatchEventToListeners(WebInspector.NetworkManager.EventTypes.ResourceUpdated, resource); }, _finishResource: function(resource, finishTime) { resource.endTime = finishTime; resource.finished = true; - WebInspector.panels.network.refreshResource(resource); - WebInspector.panels.audits.resourceFinished(resource); - WebInspector.extensionServer.notifyResourceFinished(resource); + this.dispatchEventToListeners(WebInspector.NetworkManager.EventTypes.ResourceFinished, resource); delete this._inflightResources[resource.identifier]; } } + +WebInspector.NetworkManager.prototype.__proto__ = WebInspector.Object.prototype; diff --git a/Source/WebCore/inspector/front-end/NetworkPanel.js b/Source/WebCore/inspector/front-end/NetworkPanel.js index 28cbd36..943ee7f 100644 --- a/Source/WebCore/inspector/front-end/NetworkPanel.js +++ b/Source/WebCore/inspector/front-end/NetworkPanel.js @@ -78,6 +78,11 @@ WebInspector.NetworkPanel = function() this._filter(this._filterAllElement, false); this._toggleGridMode(); + + WebInspector.networkManager.addEventListener(WebInspector.NetworkManager.EventTypes.ResourceStarted, this._onResourceStarted, this); + WebInspector.networkManager.addEventListener(WebInspector.NetworkManager.EventTypes.ResourceUpdated, this._onResourceUpdated, this); + WebInspector.networkManager.addEventListener(WebInspector.NetworkManager.EventTypes.ResourceFinished, this._onResourceUpdated, this); + WebInspector.networkManager.addEventListener(WebInspector.NetworkManager.EventTypes.MainResourceCommitLoad, this._onMainResourceCommitLoad, this); } WebInspector.NetworkPanel.prototype = { @@ -772,7 +777,12 @@ WebInspector.NetworkPanel.prototype = { return this._resourcesById[id]; }, - appendResource: function(resource) + _onResourceStarted: function(event) + { + this._appendResource(event.data); + }, + + _appendResource: function(resource) { this._resources.push(resource); this._resourcesById[resource.identifier] = resource; @@ -781,13 +791,18 @@ WebInspector.NetworkPanel.prototype = { // Pull all the redirects of the main resource upon commit load. if (resource.redirects) { for (var i = 0; i < resource.redirects.length; ++i) - this.refreshResource(resource.redirects[i]); + this._refreshResource(resource.redirects[i]); } - this.refreshResource(resource); + this._refreshResource(resource); + }, + + _onResourceUpdated: function(event) + { + this._refreshResource(event.data); }, - refreshResource: function(resource) + _refreshResource: function(resource) { this._staleResources.push(resource); this._scheduleRefresh(); @@ -811,7 +826,7 @@ WebInspector.NetworkPanel.prototype = { this._reset(); }, - mainResourceChanged: function() + _onMainResourceCommitLoad: function() { if (this._preserveLogToggle.toggled) return; @@ -819,7 +834,7 @@ WebInspector.NetworkPanel.prototype = { this._reset(); // Now resurrect the main resource along with all redirects that lead to it. var resourcesToAppend = (WebInspector.mainResource.redirects || []).concat(WebInspector.mainResource); - resourcesToAppend.forEach(this.appendResource, this); + resourcesToAppend.forEach(this._appendResource, this); }, canShowSourceLine: function(url, line) diff --git a/Source/WebCore/inspector/front-end/PropertiesSidebarPane.js b/Source/WebCore/inspector/front-end/PropertiesSidebarPane.js index b9c212a..a1e37bc 100644 --- a/Source/WebCore/inspector/front-end/PropertiesSidebarPane.js +++ b/Source/WebCore/inspector/front-end/PropertiesSidebarPane.js @@ -42,11 +42,11 @@ WebInspector.PropertiesSidebarPane.prototype = { return; } - var self = this; - var callback = function(prototypes) { - var body = self.bodyElement; + function callback(prototypes) + { + var body = this.bodyElement; body.removeChildren(); - self.sections = []; + this.sections = []; // Get array of prototype user-friendly names. for (var i = 0; i < prototypes.length; ++i) { @@ -55,11 +55,11 @@ WebInspector.PropertiesSidebarPane.prototype = { if (title.match(/Prototype$/)) title = title.replace(/Prototype$/, ""); var section = new WebInspector.ObjectPropertiesSection(prototype, title); - self.sections.push(section); + this.sections.push(section); body.appendChild(section.element); } - }; - InjectedScriptAccess.getForNode(node).getPrototypes(node.id, callback); + } + InspectorBackend.getNodePrototypes(node.id, callback.bind(this)); } } diff --git a/Source/WebCore/inspector/front-end/RemoteObject.js b/Source/WebCore/inspector/front-end/RemoteObject.js index 4d6736c..10af2e3 100644 --- a/Source/WebCore/inspector/front-end/RemoteObject.js +++ b/Source/WebCore/inspector/front-end/RemoteObject.js @@ -52,7 +52,7 @@ WebInspector.RemoteObject.resolveNode = function(node, callback) { callback(object ? WebInspector.RemoteObject.fromPayload(object) : null); } - InjectedScriptAccess.getForNode(node).resolveNode(node.id, mycallback); + InspectorBackend.resolveNode(node.id, mycallback); } WebInspector.RemoteObject.fromPayload = function(payload) @@ -118,7 +118,7 @@ WebInspector.RemoteObject.prototype = { properties[i].value = WebInspector.RemoteObject.fromPayload(properties[i].value); callback(properties); } - InjectedScriptAccess.getForObjectId(this._objectId).getProperties(this._objectId, ignoreHasOwnProperty, abbreviate, remoteObjectBinder); + InspectorBackend.getProperties(this._objectId, !!ignoreHasOwnProperty, abbreviate, remoteObjectBinder); }, setPropertyValue: function(name, value, callback) @@ -127,12 +127,12 @@ WebInspector.RemoteObject.prototype = { callback(false); return; } - InjectedScriptAccess.getForObjectId(this._objectId).setPropertyValue(this._objectId, name, value, callback); + InspectorBackend.setPropertyValue(this._objectId, name, value, callback); }, pushNodeToFrontend: function(callback) { - InjectedScriptAccess.getForObjectId(this._objectId).pushNodeToFrontend(this._objectId, callback); + InspectorBackend.pushNodeToFrontend(this._objectId, callback); } } diff --git a/Source/WebCore/inspector/front-end/Resource.js b/Source/WebCore/inspector/front-end/Resource.js index 7340645..00c1fb9 100644 --- a/Source/WebCore/inspector/front-end/Resource.js +++ b/Source/WebCore/inspector/front-end/Resource.js @@ -44,7 +44,6 @@ WebInspector.Resource.Type = { Font: 3, Script: 4, XHR: 5, - Media: 6, WebSocket: 7, Other: 8, @@ -68,8 +67,6 @@ WebInspector.Resource.Type = { return WebInspector.UIString("Script"); case this.XHR: return WebInspector.UIString("XHR"); - case this.Media: - return WebInspector.UIString("Media"); case this.WebSocket: return WebInspector.UIString("WebSocket"); case this.Other: @@ -95,8 +92,6 @@ WebInspector.Resource.Type = { return "script"; case this.XHR: return "xhr"; - case this.Media: - return "media"; case this.WebSocket: return "websocket"; case this.Other: @@ -669,6 +664,13 @@ WebInspector.Resource.prototype = { requestContent: function(callback) { + // We do not support content retrieval for WebSockets at the moment. + // Since WebSockets are potentially long-living, fail requests immediately + // to prevent caller blocking until resource is marked as finished. + if (this.type === WebInspector.Resource.Type.WebSocket) { + callback(null, null); + return; + } if (this._content) { callback(this._content, this._contentEncoded); return; diff --git a/Source/WebCore/inspector/front-end/ResourcesPanel.js b/Source/WebCore/inspector/front-end/ResourcesPanel.js index d96989b..7e1fcc0 100644 --- a/Source/WebCore/inspector/front-end/ResourcesPanel.js +++ b/Source/WebCore/inspector/front-end/ResourcesPanel.js @@ -78,6 +78,8 @@ WebInspector.ResourcesPanel = function(database) this.sidebarElement.addEventListener("mousemove", this._onmousemove.bind(this), false); this.sidebarElement.addEventListener("mouseout", this._onmouseout.bind(this), false); + + WebInspector.networkManager.addEventListener(WebInspector.NetworkManager.EventTypes.ResourceUpdated, this._refreshResource, this); } WebInspector.ResourcesPanel.prototype = { @@ -253,8 +255,9 @@ WebInspector.ResourcesPanel.prototype = { frameTreeElement.removeChildren(); }, - refreshResource: function(resource) + _refreshResource: function(event) { + var resource = event.data; // FIXME: do not add XHR in the first place based on the native instrumentation. if (resource.type === WebInspector.Resource.Type.XHR) { var resourceTreeElement = this._findTreeElementForResource(resource); diff --git a/Source/WebCore/inspector/front-end/Script.js b/Source/WebCore/inspector/front-end/Script.js index 89b2121..6e3b18d 100644 --- a/Source/WebCore/inspector/front-end/Script.js +++ b/Source/WebCore/inspector/front-end/Script.js @@ -23,13 +23,14 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -WebInspector.Script = function(sourceID, sourceURL, source, lineOffset, columnOffset, errorLine, errorMessage, worldType) +WebInspector.Script = function(sourceID, sourceURL, source, lineOffset, columnOffset, length, errorLine, errorMessage, worldType) { this.sourceID = sourceID; this.sourceURL = sourceURL; this._source = source; this.lineOffset = lineOffset; this.columnOffset = columnOffset; + this.length = length; this.errorLine = errorLine; this.errorMessage = errorMessage; this.worldType = worldType; @@ -96,12 +97,15 @@ WebInspector.Script.prototype = { get source() { + if (!this._source && this.resource) + this._source = this.resource.content; return this._source; }, set source(source) { this._source = source; + delete this._lineEndings; }, requestSource: function(callback) diff --git a/Source/WebCore/inspector/front-end/ScriptFormatter.js b/Source/WebCore/inspector/front-end/ScriptFormatter.js new file mode 100644 index 0000000..69ffb74 --- /dev/null +++ b/Source/WebCore/inspector/front-end/ScriptFormatter.js @@ -0,0 +1,134 @@ +/* + * Copyright (C) 2011 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. + */ + +WebInspector.ScriptFormatter = function(source) +{ + this._originalSource = source; + this._originalLineEndings = source.findAll("\n"); + this._originalLineEndings.push(source.length); +} + +WebInspector.ScriptFormatter.locationToPosition = function(lineEndings, location) +{ + var position = location.line ? lineEndings[location.line - 1] + 1 : 0; + return position + location.column; +} + +WebInspector.ScriptFormatter.positionToLocation = function(lineEndings, position) +{ + var location = {}; + location.line = lineEndings.upperBound(position - 1); + if (!location.line) + location.column = position; + else + location.column = position - lineEndings[location.line - 1] - 1; + return location; +} + +WebInspector.ScriptFormatter.prototype = { + format: function(callback) + { + var worker = new Worker("scriptFormatterWorker.js"); + function messageHandler(event) + { + var formattedSource = event.data; + this._formatted = true; + this._formattedSource = formattedSource; + this._formattedLineEndings = formattedSource.findAll("\n"); + this._formattedLineEndings.push(formattedSource.length); + this._buildMapping(); + callback(formattedSource); + } + worker.onmessage = messageHandler.bind(this); + worker.postMessage(this._originalSource); + }, + + _buildMapping: function() + { + this._originalSymbolPositions = []; + this._formattedSymbolPositions = []; + var lastCodePosition = 0; + var regexp = /[\$\.\w]+|{|}|;/g; + while (true) { + var match = regexp.exec(this._formattedSource); + if (!match) + break; + var position = this._originalSource.indexOf(match[0], lastCodePosition); + if (position === -1) + continue; + this._originalSymbolPositions.push(position); + this._formattedSymbolPositions.push(match.index); + lastCodePosition = position + match[0].length; + } + this._originalSymbolPositions.push(this._originalSource.length); + this._formattedSymbolPositions.push(this._formattedSource.length); + }, + + originalLineNumberToFormattedLineNumber: function(originalLineNumber) + { + if (!this._formatted) + return originalLineNumber; + var originalPosition = WebInspector.ScriptFormatter.locationToPosition(this._originalLineEndings, { line: originalLineNumber, column: 0 }); + return this.originalPositionToFormattedLineNumber(originalPosition); + }, + + formattedLineNumberToOriginalLineNumber: function(formattedLineNumber) + { + if (!this._formatted) + return formattedLineNumber; + var originalPosition = this.formattedLineNumberToOriginalPosition(formattedLineNumber); + return WebInspector.ScriptFormatter.positionToLocation(this._originalLineEndings, originalPosition).line; + }, + + originalPositionToFormattedLineNumber: function(originalPosition) + { + var lineEndings = this._formatted ? this._formattedLineEndings : this._originalLineEndings; + if (this._formatted) + formattedPosition = this._convertPosition(this._originalSymbolPositions, this._formattedSymbolPositions, originalPosition); + return WebInspector.ScriptFormatter.positionToLocation(lineEndings, formattedPosition).line; + }, + + formattedLineNumberToOriginalPosition: function(formattedLineNumber) + { + var lineEndings = this._formatted ? this._formattedLineEndings : this._originalLineEndings; + var formattedPosition = WebInspector.ScriptFormatter.locationToPosition(lineEndings, { line: formattedLineNumber, column: 0 }); + if (!this._formatted) + return formattedPosition; + return this._convertPosition(this._formattedSymbolPositions, this._originalSymbolPositions, formattedPosition); + }, + + _convertPosition: function(symbolPositions1, symbolPositions2, position) + { + var index = symbolPositions1.upperBound(position); + if (index === symbolPositions2.length - 1) + return symbolPositions2[index] - 1; + return symbolPositions2[index]; + } +} diff --git a/Source/WebCore/inspector/front-end/ScriptFormatterWorker.js b/Source/WebCore/inspector/front-end/ScriptFormatterWorker.js new file mode 100644 index 0000000..e900317 --- /dev/null +++ b/Source/WebCore/inspector/front-end/ScriptFormatterWorker.js @@ -0,0 +1,64 @@ +/* + * Copyright (C) 2011 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. + */ + +var parse = loadModule("parse-js.js"); +var process = loadModule("process.js"); + +onmessage = function(event) { + postMessage(beautify(event.data)); +}; + +function beautify(source) +{ + var ast = parse.parse(source); + var beautifyOptions = { + indent_level: 4, + indent_start: 0, + quote_keys: false, + space_colon: false + }; + return process.gen_code(ast, beautifyOptions); +} + +function loadModule(src) +{ + var request = new XMLHttpRequest(); + request.open("GET", src, false); + request.send(); + + var exports = {}; + eval(request.responseText); + return exports; +} + +function require() +{ + return parse; +} diff --git a/Source/WebCore/inspector/front-end/ScriptView.js b/Source/WebCore/inspector/front-end/ScriptView.js index d6c1c59..f631fcc 100644 --- a/Source/WebCore/inspector/front-end/ScriptView.js +++ b/Source/WebCore/inspector/front-end/ScriptView.js @@ -30,7 +30,7 @@ WebInspector.ScriptView = function(script) this.element.addStyleClass("script-view"); var contentProvider = new WebInspector.SourceFrameContentProviderForScript(script); - this.sourceFrame = new WebInspector.SourceFrame(this.element, contentProvider, "", WebInspector.panels.scripts.canEditScripts()); + this.sourceFrame = new WebInspector.SourceFrame(this.element, contentProvider, "", true); } WebInspector.ScriptView.prototype = { diff --git a/Source/WebCore/inspector/front-end/ScriptsPanel.js b/Source/WebCore/inspector/front-end/ScriptsPanel.js index 32212d4..a74f80d 100644 --- a/Source/WebCore/inspector/front-end/ScriptsPanel.js +++ b/Source/WebCore/inspector/front-end/ScriptsPanel.js @@ -63,6 +63,15 @@ WebInspector.ScriptsPanel = function() // FIXME: append the functions select element to the top status bar when it is implemented. // this.topStatusBar.appendChild(this.functionsSelectElement); + this.formatButton = document.createElement("button"); + this.formatButton.className = "status-bar-item"; + this.formatButton.id = "format-script"; + this.formatButton.title = WebInspector.UIString("Format script."); + this.formatButton.appendChild(document.createElement("img")); + this.formatButton.addEventListener("click", this._formatScript.bind(this), false); + if (Preferences.debugMode) + this.topStatusBar.appendChild(this.formatButton); + this.sidebarButtonsElement = document.createElement("div"); this.sidebarButtonsElement.id = "scripts-sidebar-buttons"; this.topStatusBar.appendChild(this.sidebarButtonsElement); @@ -131,7 +140,7 @@ WebInspector.ScriptsPanel = function() this.sidebarPanes.watchExpressions = new WebInspector.WatchExpressionsSidebarPane(); this.sidebarPanes.callstack = new WebInspector.CallStackSidebarPane(); this.sidebarPanes.scopechain = new WebInspector.ScopeChainSidebarPane(); - this.sidebarPanes.jsBreakpoints = WebInspector.createJSBreakpointsSidebarPane(); + this.sidebarPanes.jsBreakpoints = new WebInspector.JavaScriptBreakpointsSidebarPane(); if (Preferences.nativeInstrumentationEnabled) { this.sidebarPanes.domBreakpoints = WebInspector.createDOMBreakpointsSidebarPane(); this.sidebarPanes.xhrBreakpoints = WebInspector.createXHRBreakpointsSidebarPane(); @@ -168,8 +177,6 @@ WebInspector.ScriptsPanel = function() this._pauseOnExceptionButton = new WebInspector.StatusBarButton("", "scripts-pause-on-exceptions-status-bar-item", 3); this._pauseOnExceptionButton.addEventListener("click", this._togglePauseOnExceptions.bind(this), false); - this._pauseOnExceptionButton.state = WebInspector.ScriptsPanel.PauseOnExceptionsState.DontPauseOnExceptions; - this._pauseOnExceptionButton.title = WebInspector.UIString("Don't pause on exceptions.\nClick to Pause on all exceptions."); this._registerShortcuts(); @@ -179,6 +186,7 @@ WebInspector.ScriptsPanel = function() WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.ParsedScriptSource, this._parsedScriptSource, this); WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.FailedToParseScriptSource, this._failedToParseScriptSource, this); + WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.ScriptSourceChanged, this._scriptSourceChanged, this); WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.DebuggerPaused, this._debuggerPaused, this); WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.DebuggerResumed, this._debuggerResumed, this); } @@ -244,6 +252,27 @@ WebInspector.ScriptsPanel.prototype = { this._addScript(event.data); }, + _scriptSourceChanged: function(event) + { + var sourceID = event.data.sourceID; + var oldSource = event.data.oldSource; + + var script = WebInspector.debuggerModel.scriptForSourceID(sourceID); + var oldView = script._scriptView; + if (oldView) { + script._scriptView = new WebInspector.ScriptView(script); + this.viewRecreated(oldView, script._scriptView); + } + if (script.resource) { + var revertHandle = WebInspector.debuggerModel.editScriptSource.bind(WebInspector.debuggerModel, sourceID, oldSource); + script.resource.setContent(script.source, revertHandle); + } + + var callFrames = WebInspector.debuggerModel.callFrames; + if (callFrames.length) + this._debuggerPaused({ data: { callFrames: callFrames } }); + }, + _addScript: function(script) { var resource = WebInspector.resourceForURL(script.sourceURL); @@ -279,52 +308,6 @@ WebInspector.ScriptsPanel.prototype = { delete resource._scriptsPendingResourceLoad; }, - canEditScripts: function() - { - return Preferences.canEditScriptSource; - }, - - editScriptSource: function(editData, revertEditingCallback, cancelEditingCallback) - { - if (!this.canEditScripts()) - return; - - // Need to clear breakpoints and re-create them later when editing source. - var breakpoints = WebInspector.debuggerModel.queryBreakpoints(function(b) { return b.sourceID === editData.sourceID }); - for (var i = 0; i < breakpoints.length; ++i) - breakpoints[i].remove(); - - function mycallback(success, newBodyOrErrorMessage, callFrames) - { - if (success) { - var script = WebInspector.debuggerModel.scriptForSourceID(editData.sourceID); - script.source = newBodyOrErrorMessage; - var oldView = script._scriptView - if (oldView) { - script._scriptView = new WebInspector.ScriptView(script); - this.viewRecreated(oldView, script._scriptView); - } - if (script.resource) - script.resource.setContent(newBodyOrErrorMessage, revertEditingCallback); - - if (callFrames && callFrames.length) - this._debuggerPaused({ data: { callFrames: callFrames } }); - } else { - if (cancelEditingCallback) - cancelEditingCallback(); - WebInspector.log(newBodyOrErrorMessage, WebInspector.ConsoleMessage.MessageLevel.Warning); - } - for (var i = 0; i < breakpoints.length; ++i) { - var breakpoint = breakpoints[i]; - var newLine = breakpoint.line; - if (success && breakpoint.line >= editData.line) - newLine += editData.linesCountToShift; - WebInspector.debuggerModel.setBreakpoint(editData.sourceID, newLine, breakpoint.enabled, breakpoint.condition); - } - }; - InspectorBackend.editScriptSource(editData.sourceID, editData.content, mycallback.bind(this)); - }, - selectedCallFrameId: function() { var selectedCallFrame = this.sidebarPanes.callstack.selectedCallFrame; @@ -359,7 +342,7 @@ WebInspector.ScriptsPanel.prototype = { if (result) callback(WebInspector.RemoteObject.fromPayload(result)); } - InjectedScriptAccess.get(callFrame.worldId).evaluateInCallFrame(callFrame.id, code, objectGroup, evalCallback); + InspectorBackend.evaluateOnCallFrame(callFrame.id, code, objectGroup, evalCallback); }, _debuggerPaused: function(event) @@ -392,9 +375,10 @@ WebInspector.ScriptsPanel.prototype = { debuggerWasEnabled: function() { + this._setPauseOnExceptions(WebInspector.settings.pauseOnExceptionState); + if (this._debuggerEnabled) return; - this._debuggerEnabled = true; this.reset(true); }, @@ -677,7 +661,7 @@ WebInspector.ScriptsPanel.prototype = { _clearCurrentExecutionLine: function() { if (this._executionSourceFrame) - this._executionSourceFrame.executionLine = 0; + this._executionSourceFrame.clearExecutionLine(); delete this._executionSourceFrame; }, @@ -699,7 +683,7 @@ WebInspector.ScriptsPanel.prototype = { this._executionSourceFrame = this._sourceFrameForScriptOrResource(scriptOrResource); if (this._executionSourceFrame) - this._executionSourceFrame.executionLine = currentFrame.line; + this._executionSourceFrame.setExecutionLine(currentFrame.line); }, _changeVisibleFile: function(event) @@ -744,16 +728,21 @@ WebInspector.ScriptsPanel.prototype = { this.resize(); }, - updatePauseOnExceptionsState: function(pauseOnExceptionsState) + _setPauseOnExceptions: function(pauseOnExceptionsState) { - if (pauseOnExceptionsState == WebInspector.ScriptsPanel.PauseOnExceptionsState.DontPauseOnExceptions) - this._pauseOnExceptionButton.title = WebInspector.UIString("Don't pause on exceptions.\nClick to Pause on all exceptions."); - else if (pauseOnExceptionsState == WebInspector.ScriptsPanel.PauseOnExceptionsState.PauseOnAllExceptions) - this._pauseOnExceptionButton.title = WebInspector.UIString("Pause on all exceptions.\nClick to Pause on uncaught exceptions."); - else if (pauseOnExceptionsState == WebInspector.ScriptsPanel.PauseOnExceptionsState.PauseOnUncaughtExceptions) - this._pauseOnExceptionButton.title = WebInspector.UIString("Pause on uncaught exceptions.\nClick to Not pause on exceptions."); - - this._pauseOnExceptionButton.state = pauseOnExceptionsState; + function callback(pauseOnExceptionsState) + { + if (pauseOnExceptionsState == WebInspector.ScriptsPanel.PauseOnExceptionsState.DontPauseOnExceptions) + this._pauseOnExceptionButton.title = WebInspector.UIString("Don't pause on exceptions.\nClick to Pause on all exceptions."); + else if (pauseOnExceptionsState == WebInspector.ScriptsPanel.PauseOnExceptionsState.PauseOnAllExceptions) + this._pauseOnExceptionButton.title = WebInspector.UIString("Pause on all exceptions.\nClick to Pause on uncaught exceptions."); + else if (pauseOnExceptionsState == WebInspector.ScriptsPanel.PauseOnExceptionsState.PauseOnUncaughtExceptions) + this._pauseOnExceptionButton.title = WebInspector.UIString("Pause on uncaught exceptions.\nClick to Not pause on exceptions."); + + this._pauseOnExceptionButton.state = pauseOnExceptionsState; + WebInspector.settings.pauseOnExceptionState = pauseOnExceptionsState; + } + InspectorBackend.setPauseOnExceptionsState(pauseOnExceptionsState, callback.bind(this)); }, _updateDebuggerButtons: function() @@ -833,6 +822,12 @@ WebInspector.ScriptsPanel.prototype = { this._updateBackAndForwardButtons(); }, + _formatScript: function() + { + if (this.visibleView && this.visibleView.sourceFrame) + this.visibleView.sourceFrame.formatSource(); + }, + _enableDebugging: function() { if (this._debuggerEnabled) @@ -854,7 +849,7 @@ WebInspector.ScriptsPanel.prototype = { _togglePauseOnExceptions: function() { - InspectorBackend.setPauseOnExceptionsState((this._pauseOnExceptionButton.state + 1) % this._pauseOnExceptionButton.states, this.updatePauseOnExceptionsState.bind(this)); + this._setPauseOnExceptions((this._pauseOnExceptionButton.state + 1) % this._pauseOnExceptionButton.states); }, _togglePause: function() diff --git a/Source/WebCore/inspector/front-end/Settings.js b/Source/WebCore/inspector/front-end/Settings.js index bc50ce9..e26b1d7 100644 --- a/Source/WebCore/inspector/front-end/Settings.js +++ b/Source/WebCore/inspector/front-end/Settings.js @@ -65,6 +65,7 @@ WebInspector.Settings = function() this.installApplicationSetting("showUserAgentStyles", true); this.installApplicationSetting("watchExpressions", []); this.installApplicationSetting("lastActivePanel", "elements"); + this.installApplicationSetting("pauseOnExceptionState", WebInspector.ScriptsPanel.PauseOnExceptionsState.DontPauseOnExceptions); this.installProjectSetting("breakpoints", {}); this.installProjectSetting("nativeBreakpoints", []); diff --git a/Source/WebCore/inspector/front-end/SourceFrame.js b/Source/WebCore/inspector/front-end/SourceFrame.js index af10f1e..eb89f24 100644 --- a/Source/WebCore/inspector/front-end/SourceFrame.js +++ b/Source/WebCore/inspector/front-end/SourceFrame.js @@ -28,12 +28,13 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -WebInspector.SourceFrame = function(parentElement, contentProvider, url, canEditScripts) +WebInspector.SourceFrame = function(parentElement, contentProvider, url, isScript) { this._parentElement = parentElement; this._contentProvider = contentProvider; this._url = url; - this._canEditScripts = canEditScripts; + this._isScript = isScript; + this._textModel = new WebInspector.TextEditorModel(); this._textModel.replaceTabsWithSpaces = true; @@ -71,23 +72,6 @@ WebInspector.SourceFrame.prototype = { } }, - get executionLine() - { - return this._executionLine; - }, - - set executionLine(x) - { - if (this._executionLine === x) - return; - - var previousLine = this._executionLine; - this._executionLine = x; - - if (this._textViewer) - this._updateExecutionLine(previousLine); - }, - markDiff: function(diffData) { if (this._diffLines && this._textViewer) @@ -172,6 +156,7 @@ WebInspector.SourceFrame.prototype = { { this._content = content; this._textModel.setText(null, content); + this._formatter = new WebInspector.ScriptFormatter(content); this._textViewer = new WebInspector.TextViewer(this._textModel, WebInspector.platform, this._url); var element = this._textViewer.element; @@ -179,15 +164,13 @@ WebInspector.SourceFrame.prototype = { element.addEventListener("mousedown", this._mouseDown.bind(this), true); element.addEventListener("mousemove", this._mouseMove.bind(this), true); element.addEventListener("scroll", this._scroll.bind(this), true); + element.addEventListener("dblclick", this._doubleClick.bind(this), true); this._parentElement.appendChild(element); this._textViewer.beginUpdates(); this._textViewer.mimeType = mimeType; - this._addExistingMessagesToSource(); - this._updateExecutionLine(); - this._updateDiffDecorations(); - this._textViewer.resize(); + this._setTextViewerDecorations(); if (this._lineNumberToReveal) { this.revealLine(this._lineNumberToReveal); @@ -210,15 +193,34 @@ WebInspector.SourceFrame.prototype = { delete this._delayedFindSearchMatches; } + this._textViewer.endUpdates(); + + WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.BreakpointAdded, this._breakpointAdded, this); + + if (this._canEditScripts) + this._textViewer.editCallback = this._editLine.bind(this); + }, + + _setTextViewerDecorations: function() + { + this._rowMessages = {}; + this._messageBubbles = {}; + + this._textViewer.beginUpdates(); + + this._addExistingMessagesToSource(); + this._updateDiffDecorations(); + + if (this._executionLine) + this.setExecutionLine(this._executionLine); + var breakpoints = this._breakpoints(); for (var i = 0; i < breakpoints.length; ++i) this._addBreakpoint(breakpoints[i]); - WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.BreakpointAdded, this._breakpointAdded, this); - this._textViewer.endUpdates(); + this._textViewer.resize(); - if (this._canEditScripts) - this._textViewer.editCallback = this._editLine.bind(this); + this._textViewer.endUpdates(); }, findSearchMatches: function(query, finishedCallback) @@ -300,18 +302,22 @@ WebInspector.SourceFrame.prototype = { msg._resourceMessageRepeatCountElement.textContent = WebInspector.UIString(" (repeated %d times)", msg.repeatCount); }, - _updateExecutionLine: function(previousLine) + setExecutionLine: function(lineNumber) { - if (previousLine) { - if (previousLine - 1 < this._textModel.linesCount) - this._textViewer.removeDecoration(previousLine - 1, "webkit-execution-line"); - } - - if (!this._executionLine) + this._executionLine = lineNumber; + if (!this._textViewer) return; + var textViewerLineNumber = this._formatter.originalLineNumberToFormattedLineNumber(this._executionLine - 1); + this._textViewer.addDecoration(textViewerLineNumber, "webkit-execution-line"); + }, - if (this._executionLine < this._textModel.linesCount) - this._textViewer.addDecoration(this._executionLine - 1, "webkit-execution-line"); + clearExecutionLine: function() + { + if (!this._textViewer) + return; + var textViewerLineNumber = this._formatter.originalLineNumberToFormattedLineNumber(this._executionLine - 1); + this._textViewer.removeDecoration(textViewerLineNumber, "webkit-execution-line"); + delete this._executionLine; }, _updateDiffDecorations: function() @@ -412,14 +418,15 @@ WebInspector.SourceFrame.prototype = { _addBreakpoint: function(breakpoint) { - if (breakpoint.line > this._textModel.linesCount) + var textViewerLineNumber = this._formatter.originalLineNumberToFormattedLineNumber(breakpoint.line - 1); + if (textViewerLineNumber >= this._textModel.linesCount) return; breakpoint.addEventListener("enable-changed", this._breakpointChanged, this); breakpoint.addEventListener("condition-changed", this._breakpointChanged, this); breakpoint.addEventListener("removed", this._breakpointRemoved, this); - this._setBreakpointDecoration(breakpoint.line, breakpoint.enabled, !!breakpoint.condition); + this._setBreakpointDecoration(textViewerLineNumber, breakpoint.enabled, !!breakpoint.condition); }, _breakpointRemoved: function(event) @@ -430,18 +437,19 @@ WebInspector.SourceFrame.prototype = { breakpoint.removeEventListener("condition-changed", null, this); breakpoint.removeEventListener("removed", null, this); - this._removeBreakpointDecoration(breakpoint.line); + var textViewerLineNumber = this._formatter.originalLineNumberToFormattedLineNumber(breakpoint.line - 1); + this._removeBreakpointDecoration(textViewerLineNumber); }, _breakpointChanged: function(event) { var breakpoint = event.target; - this._setBreakpointDecoration(breakpoint.line, breakpoint.enabled, !!breakpoint.condition); + var textViewerLineNumber = this._formatter.originalLineNumberToFormattedLineNumber(breakpoint.line - 1); + this._setBreakpointDecoration(textViewerLineNumber, breakpoint.enabled, !!breakpoint.condition); }, _setBreakpointDecoration: function(lineNumber, enabled, hasCondition) { - lineNumber -= 1; this._textViewer.beginUpdates(); this._textViewer.addDecoration(lineNumber, "webkit-breakpoint"); if (enabled) @@ -457,7 +465,6 @@ WebInspector.SourceFrame.prototype = { _removeBreakpointDecoration: function(lineNumber) { - lineNumber -= 1; this._textViewer.beginUpdates(); this._textViewer.removeDecoration(lineNumber, "webkit-breakpoint"); this._textViewer.removeDecoration(lineNumber, "webkit-breakpoint-disabled"); @@ -473,27 +480,28 @@ WebInspector.SourceFrame.prototype = { var target = event.target.enclosingNodeOrSelfWithClass("webkit-line-number"); if (!target) return; - var lineNumber = target.parentElement.lineNumber + 1; + var textViewerLineNumber = target.parentElement.lineNumber; + var originalLineNumber = this._formatter.formattedLineNumberToOriginalLineNumber(textViewerLineNumber); var contextMenu = new WebInspector.ContextMenu(); - contextMenu.appendItem(WebInspector.UIString("Continue to Here"), this._continueToLine.bind(this, lineNumber)); + contextMenu.appendItem(WebInspector.UIString("Continue to Here"), this._continueToLine.bind(this, originalLineNumber)); - var breakpoint = this._findBreakpoint(lineNumber); + var breakpoint = this._findBreakpoint(originalLineNumber); if (!breakpoint) { // This row doesn't have a breakpoint: We want to show Add Breakpoint and Add and Edit Breakpoint. - contextMenu.appendItem(WebInspector.UIString("Add Breakpoint"), this._setBreakpoint.bind(this, lineNumber, "", true)); + contextMenu.appendItem(WebInspector.UIString("Add Breakpoint"), this._setBreakpoint.bind(this, originalLineNumber, "", true)); function addConditionalBreakpoint() { - this._setBreakpointDecoration(lineNumber, true, true); + this._setBreakpointDecoration(textViewerLineNumber, true, true); function didEditBreakpointCondition(committed, condition) { - this._removeBreakpointDecoration(lineNumber); + this._removeBreakpointDecoration(textViewerLineNumber); if (committed) - this._setBreakpoint(lineNumber, true, condition); + this._setBreakpoint(originalLineNumber, true, condition); } - this._editBreakpointCondition(lineNumber, "", didEditBreakpointCondition.bind(this)); + this._editBreakpointCondition(textViewerLineNumber, "", didEditBreakpointCondition.bind(this)); } contextMenu.appendItem(WebInspector.UIString("Add Conditional Breakpoint…"), addConditionalBreakpoint.bind(this)); } else { @@ -505,16 +513,16 @@ WebInspector.SourceFrame.prototype = { { if (committed) { breakpoint.remove(); - this._setBreakpoint(breakpoint.line, breakpoint.enabled, condition); + this._setBreakpoint(originalLineNumber, breakpoint.enabled, condition); } } - this._editBreakpointCondition(lineNumber, breakpoint.condition, didEditBreakpointCondition.bind(this)); + this._editBreakpointCondition(textViewerLineNumber, breakpoint.condition, didEditBreakpointCondition.bind(this)); } contextMenu.appendItem(WebInspector.UIString("Edit Breakpoint…"), editBreakpointCondition.bind(this)); function setBreakpointEnabled(enabled) { breakpoint.remove(); - this._setBreakpoint(breakpoint.line, enabled, breakpoint.condition); + this._setBreakpoint(originalLineNumber, enabled, breakpoint.condition); } if (breakpoint.enabled) contextMenu.appendItem(WebInspector.UIString("Disable Breakpoint"), setBreakpointEnabled.bind(this, false)); @@ -538,15 +546,15 @@ WebInspector.SourceFrame.prototype = { var target = event.target.enclosingNodeOrSelfWithClass("webkit-line-number"); if (!target) return; - var lineNumber = target.parentElement.lineNumber + 1; + var originalLineNumber = this._formatter.formattedLineNumberToOriginalLineNumber(target.parentElement.lineNumber); - var breakpoint = this._findBreakpoint(lineNumber); + var breakpoint = this._findBreakpoint(originalLineNumber); if (breakpoint) { breakpoint.remove(); if (event.shiftKey) - this._setBreakpoint(breakpoint.line, !breakpoint.enabled, breakpoint.condition); + this._setBreakpoint(originalLineNumber, !breakpoint.enabled, breakpoint.condition); } else - this._setBreakpoint(lineNumber, true, ""); + this._setBreakpoint(originalLineNumber, true, ""); event.preventDefault(); }, @@ -710,7 +718,6 @@ WebInspector.SourceFrame.prototype = { _editBreakpointCondition: function(lineNumber, condition, callback) { - lineNumber -= 1; this._conditionElement = this._createConditionElement(lineNumber); this._textViewer.addDecoration(lineNumber, this._conditionElement); @@ -776,49 +783,55 @@ WebInspector.SourceFrame.prototype = { this._textViewer.resize(); }, + formatSource: function() + { + if (!this._formatter) + return; + + function didFormat(source) + { + this._textModel.setText(null, source); + this._setTextViewerDecorations(); + } + this._formatter.format(didFormat.bind(this)); + }, + _continueToLine: function(lineNumber) { var sourceID = this._sourceIDForLine(lineNumber); if (!sourceID) return; - WebInspector.debuggerModel.continueToLine(sourceID, lineNumber); + WebInspector.debuggerModel.continueToLine(sourceID, lineNumber + 1); }, - _editLine: function(lineNumber, newContent, cancelEditingCallback) + _doubleClick: function(event) { - lineNumber += 1; - - var lines = []; - var oldLines = this._content.split('\n'); - for (var i = 0; i < oldLines.length; ++i) { - if (i === lineNumber - 1) - lines.push(newContent); - else - lines.push(oldLines[i]); - } + if (!Preferences.canEditScriptSource || !this._isScript) + return; - var editData = {}; - editData.sourceID = this._sourceIDForLine(lineNumber); - editData.content = lines.join("\n"); - editData.line = lineNumber; - editData.linesCountToShift = newContent.split("\n").length - 1; - this._doEditLine(editData, cancelEditingCallback); - }, + var target = event.target.enclosingNodeOrSelfWithNodeName("TD"); + if (!target || target.parentElement.firstChild === target) + return; // Do not trigger editing from line numbers. - _revertEditLine: function(editData, contentToRevertTo) - { - var newEditData = {}; - newEditData.sourceID = editData.sourceID; - newEditData.content = contentToRevertTo; - newEditData.line = editData.line; - newEditData.linesCountToShift = -editData.linesCountToShift; - this._doEditLine(newEditData); - }, + var lineRow = target.parentElement; + var lineNumber = lineRow.lineNumber; + var sourceID = this._sourceIDForLine(lineNumber); + if (!sourceID) + return; - _doEditLine: function(editData, cancelEditingCallback) - { - var revertEditingCallback = this._revertEditLine.bind(this, editData); - WebInspector.panels.scripts.editScriptSource(editData, revertEditingCallback, cancelEditingCallback); + function didEditLine(newContent) + { + var lines = []; + var oldLines = this._content.split('\n'); + for (var i = 0; i < oldLines.length; ++i) { + if (i === lineNumber) + lines.push(newContent); + else + lines.push(oldLines[i]); + } + WebInspector.debuggerModel.editScriptSource(sourceID, lines.join("\n")); + } + this._textViewer.editLine(lineRow, didEditLine.bind(this)); }, _setBreakpoint: function(lineNumber, enabled, condition) @@ -826,7 +839,7 @@ WebInspector.SourceFrame.prototype = { var sourceID = this._sourceIDForLine(lineNumber); if (!sourceID) return; - WebInspector.debuggerModel.setBreakpoint(sourceID, lineNumber, enabled, condition); + WebInspector.debuggerModel.setBreakpoint(sourceID, lineNumber + 1, enabled, condition); if (!WebInspector.panels.scripts.breakpointsActivated) WebInspector.panels.scripts.toggleBreakpointsClicked(); }, @@ -840,7 +853,7 @@ WebInspector.SourceFrame.prototype = { _findBreakpoint: function(lineNumber) { var sourceID = this._sourceIDForLine(lineNumber); - return WebInspector.debuggerModel.findBreakpoint(sourceID, lineNumber); + return WebInspector.debuggerModel.findBreakpoint(sourceID, lineNumber + 1); }, _sourceIDForLine: function(lineNumber) @@ -849,9 +862,9 @@ WebInspector.SourceFrame.prototype = { var closestStartingLine = 0; var scripts = this._contentProvider.scripts(); for (var i = 0; i < scripts.length; ++i) { - var startingLine = scripts[i].startingLine; - if (startingLine <= lineNumber && startingLine >= closestStartingLine) { - closestStartingLine = startingLine; + var lineOffset = scripts[i].lineOffset; + if (lineOffset <= lineNumber && lineOffset >= closestStartingLine) { + closestStartingLine = lineOffset; sourceIDForLine = scripts[i].sourceID; } } diff --git a/Source/WebCore/inspector/front-end/SourceView.js b/Source/WebCore/inspector/front-end/SourceView.js index e78ff94..37caabb 100644 --- a/Source/WebCore/inspector/front-end/SourceView.js +++ b/Source/WebCore/inspector/front-end/SourceView.js @@ -33,8 +33,8 @@ WebInspector.SourceView = function(resource) this.element.addStyleClass("source"); var contentProvider = new WebInspector.SourceFrameContentProviderForResource(resource); - var canEditScripts = WebInspector.panels.scripts.canEditScripts() && resource.type === WebInspector.Resource.Type.Script; - this.sourceFrame = new WebInspector.SourceFrame(this.element, contentProvider, resource.url, canEditScripts); + var isScript = resource.type === WebInspector.Resource.Type.Script; + this.sourceFrame = new WebInspector.SourceFrame(this.element, contentProvider, resource.url, isScript); } WebInspector.SourceView.prototype = { diff --git a/Source/WebCore/inspector/front-end/StylesSidebarPane.js b/Source/WebCore/inspector/front-end/StylesSidebarPane.js index d646829..9880adc 100644 --- a/Source/WebCore/inspector/front-end/StylesSidebarPane.js +++ b/Source/WebCore/inspector/front-end/StylesSidebarPane.js @@ -81,6 +81,8 @@ WebInspector.StylesSidebarPane = function(computedStylePane) this.element.addEventListener("contextmenu", this._contextMenuEventFired.bind(this), true); } +WebInspector.StylesSidebarPane.StyleValueDelimiters = " \t\n\"':;,/()"; + // Taken from http://www.w3.org/TR/CSS21/propidx.html. WebInspector.StylesSidebarPane.InheritedProperties = [ "azimuth", "border-collapse", "border-spacing", "caption-side", "color", "cursor", "direction", "elevation", @@ -1379,6 +1381,8 @@ WebInspector.StylePropertyTreeElement.prototype = { } this.listItemElement.removeChildren(); + nameElement.normalize(); + valueElement.normalize(); if (!this.treeOutline) return; @@ -1529,16 +1533,15 @@ WebInspector.StylePropertyTreeElement.prototype = { var context = { expanded: this.expanded, hasChildren: this.hasChildren, - keyDownListener: isEditingName ? this.editingNameKeyDown.bind(this) : this.editingValueKeyDown.bind(this), - keyPressListener: isEditingName ? this.editingNameKeyPress.bind(this) : this.editingValueKeyPress.bind(this), + keyDownListener: isEditingName ? null : this.editingValueKeyDown.bind(this), isEditingName: isEditingName, }; // Lie about our children to prevent expanding on double click and to collapse shorthands. this.hasChildren = false; - selectElement.addEventListener("keydown", context.keyDownListener, false); - selectElement.addEventListener("keypress", context.keyPressListener, false); + if (!isEditingName) + selectElement.addEventListener("keydown", context.keyDownListener, false); if (selectElement.parentElement) selectElement.parentElement.addStyleClass("child-editing"); selectElement.textContent = selectElement.textContent; // remove color swatch and the like @@ -1613,76 +1616,15 @@ WebInspector.StylePropertyTreeElement.prototype = { customFinishHandler: nameValueFinishHandler.bind(this, context, isEditingName), pasteHandler: isEditingName ? pasteHandler.bind(this, context) : null }); - window.getSelection().setBaseAndExtent(selectElement, 0, selectElement, 1); - }, - - editingNameKeyPress: function(event) - { - // Complete property names. - var character = event.data.toLowerCase(); - if (character && /[a-z-]/.test(character)) { - var selection = window.getSelection(); - var prefix = selection.anchorNode.textContent.substring(0, selection.anchorOffset); - var property = WebInspector.cssNameCompletions.firstStartsWith(prefix + character); - if (!selection.isCollapsed) - selection.deleteFromDocument(); - - this.restoreNameElement(); - - if (property) { - if (property !== this.nameElement.textContent) - this.nameElement.textContent = property; - this.nameElement.firstChild.select(prefix.length + 1); - event.preventDefault(); - } - } - }, - - editingValueKeyPress: function(event) - { - // FIXME: This should complete property values. - }, - - editingNameKeyDown: function(event) - { - var showNext; - if (event.keyIdentifier === "Up") - showNext = false; - else if (event.keyIdentifier === "Down") - showNext = true; - else - return; - - var selection = window.getSelection(); - if (!selection.rangeCount) - return; - - var selectionRange = selection.getRangeAt(0); - if (selectionRange.commonAncestorContainer !== this.nameElement && !selectionRange.commonAncestorContainer.isDescendant(this.nameElement)) - return; - - const styleValueDelimeters = " \t\n\"':;,/()"; - var wordRange = selectionRange.startContainer.rangeOfWord(selectionRange.startOffset, styleValueDelimeters, this.nameElement); - var wordString = wordRange.toString(); - var cursorPosition = selectionRange.startOffset != selectionRange.endOffset ? selectionRange.startOffset : 0; - var prefix = selectionRange.startContainer.textContent.substring(0, cursorPosition); - var property; - - if (showNext) - property = WebInspector.cssNameCompletions.next(wordString, prefix); - else - property = WebInspector.cssNameCompletions.previous(wordString, prefix); - - if (property) { - this.nameElement.textContent = property; - this.nameElement.firstChild.select(cursorPosition); - } - event.preventDefault(); + this._prompt = new WebInspector.StylesSidebarPane.CSSPropertyPrompt(selectElement, isEditingName ? WebInspector.cssNameCompletions : WebInspector.CSSKeywordCompletions.forProperty(this.nameElement.textContent)); + window.getSelection().setBaseAndExtent(selectElement, 0, selectElement, 1); }, editingValueKeyDown: function(event) { + if (event.handled) + return; var arrowKeyPressed = (event.keyIdentifier === "Up" || event.keyIdentifier === "Down"); var pageKeyPressed = (event.keyIdentifier === "PageUp" || event.keyIdentifier === "PageDown"); if (!arrowKeyPressed && !pageKeyPressed) @@ -1696,8 +1638,7 @@ WebInspector.StylePropertyTreeElement.prototype = { if (selectionRange.commonAncestorContainer !== this.valueElement && !selectionRange.commonAncestorContainer.isDescendant(this.valueElement)) return; - const styleValueDelimeters = " \t\n\"':;,/()"; - var wordRange = selectionRange.startContainer.rangeOfWord(selectionRange.startOffset, styleValueDelimeters, this.valueElement); + var wordRange = selectionRange.startContainer.rangeOfWord(selectionRange.startOffset, WebInspector.StylesSidebarPane.StyleValueDelimiters, this.valueElement); var wordString = wordRange.toString(); var replacementString = wordString; @@ -1739,42 +1680,45 @@ WebInspector.StylePropertyTreeElement.prototype = { } replacementString = prefix + number + suffix; - } else { - // FIXME: this should cycle through known keywords for the current property value. - } - var replacementTextNode = document.createTextNode(replacementString); + var replacementTextNode = document.createTextNode(replacementString); - wordRange.deleteContents(); - wordRange.insertNode(replacementTextNode); + wordRange.deleteContents(); + wordRange.insertNode(replacementTextNode); - var finalSelectionRange = document.createRange(); - finalSelectionRange.setStart(replacementTextNode, 0); - finalSelectionRange.setEnd(replacementTextNode, replacementString.length); + var finalSelectionRange = document.createRange(); + finalSelectionRange.setStart(replacementTextNode, 0); + finalSelectionRange.setEnd(replacementTextNode, replacementString.length); - selection.removeAllRanges(); - selection.addRange(finalSelectionRange); + selection.removeAllRanges(); + selection.addRange(finalSelectionRange); - event.preventDefault(); + event.handled = true; + event.preventDefault(); - if (!("originalPropertyText" in this)) { - // Remember the rule's original CSS text on [Page](Up|Down), so it can be restored - // if the editing is canceled. - this.originalPropertyText = this.property.propertyText; - } + if (!("originalPropertyText" in this)) { + // Remember the rule's original CSS text on [Page](Up|Down), so it can be restored + // if the editing is canceled. + this.originalPropertyText = this.property.propertyText; + } - // Synthesize property text disregarding any comments, custom whitespace etc. - this.applyStyleText(this.nameElement.textContent + ": " + this.valueElement.textContent); + // Synthesize property text disregarding any comments, custom whitespace etc. + this.applyStyleText(this.nameElement.textContent + ": " + this.valueElement.textContent); + } }, editingEnded: function(context) { + if (this._prompt) { + this._prompt.removeFromElement(); + delete this._prompt; + } this.hasChildren = context.hasChildren; if (context.expanded) this.expand(); var editedElement = context.isEditingName ? this.nameElement : this.valueElement; - editedElement.removeEventListener("keydown", context.keyDownListener, false); - editedElement.removeEventListener("keypress", context.keyPressListener, false); + if (!context.isEditingName) + editedElement.removeEventListener("keydown", context.keyDownListener, false); if (editedElement.parentElement) editedElement.parentElement.removeStyleClass("child-editing"); @@ -1791,6 +1735,8 @@ WebInspector.StylePropertyTreeElement.prototype = { else this.updateTitle(); } + + // This should happen last, as it clears the info necessary to restore the property value after [Page]Up/Down changes. this.editingEnded(context); }, @@ -1948,3 +1894,57 @@ WebInspector.StylePropertyTreeElement.prototype = { } WebInspector.StylePropertyTreeElement.prototype.__proto__ = TreeElement.prototype; + +WebInspector.StylesSidebarPane.CSSPropertyPrompt = function(element, cssCompletions) +{ + WebInspector.TextPrompt.call(this, element, this._buildPropertyCompletions.bind(this), WebInspector.StylesSidebarPane.StyleValueDelimiters, true); + this._cssCompletions = cssCompletions; +} + +WebInspector.StylesSidebarPane.CSSPropertyPrompt.prototype = { + upKeyPressed: function(event) + { + this._handleNameOrValueUpDown(event); + }, + + downKeyPressed: function(event) + { + this._handleNameOrValueUpDown(event); + }, + + tabKeyPressed: function(event) + { + this.acceptAutoComplete(); + }, + + _handleNameOrValueUpDown: function(event) + { + var reverse = event.keyIdentifier === "Up"; + if (this.autoCompleteElement) + this.complete(false, reverse); // Accept the current suggestion, if any. + this.complete(false, reverse); // Actually increment/decrement the suggestion. + event.handled = true; + }, + + _buildPropertyCompletions: function(wordRange, bestMatchOnly, completionsReadyCallback) + { + var prefix = wordRange.toString().toLowerCase(); + if (!prefix.length) + return; + + var results; + if (bestMatchOnly) { + results = []; + var firstMatch = this._cssCompletions.firstStartsWith(prefix); + if (firstMatch) + results.push(firstMatch); + return completionsReadyCallback(results); + } + + results = this._cssCompletions.startsWith(prefix); + if (results) + completionsReadyCallback(results); + } +} + +WebInspector.StylesSidebarPane.CSSPropertyPrompt.prototype.__proto__ = WebInspector.TextPrompt.prototype; diff --git a/Source/WebCore/inspector/front-end/TextPrompt.js b/Source/WebCore/inspector/front-end/TextPrompt.js index 21a5bde..ac54d8c 100644 --- a/Source/WebCore/inspector/front-end/TextPrompt.js +++ b/Source/WebCore/inspector/front-end/TextPrompt.js @@ -26,15 +26,18 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -WebInspector.TextPrompt = function(element, completions, stopCharacters) +WebInspector.TextPrompt = function(element, completions, stopCharacters, omitHistory) { this.element = element; this.element.addStyleClass("text-prompt"); this.completions = completions; this.completionStopCharacters = stopCharacters; - this.history = []; - this.historyOffset = 0; - this.element.addEventListener("keydown", this._onKeyDown.bind(this), true); + if (!omitHistory) { + this.history = []; + this.historyOffset = 0; + } + this._boundOnKeyDown = this._onKeyDown.bind(this); + this.element.addEventListener("keydown", this._boundOnKeyDown, true); } WebInspector.TextPrompt.prototype = { @@ -55,6 +58,12 @@ WebInspector.TextPrompt.prototype = { this.moveCaretToEndOfPrompt(); }, + removeFromElement: function() + { + this.clearAutoComplete(true); + this.element.removeEventListener("keydown", this._boundOnKeyDown, true); + }, + _onKeyDown: function(event) { function defaultAction() @@ -63,16 +72,20 @@ WebInspector.TextPrompt.prototype = { this.autoCompleteSoon(); } + if (event.handled) + return; + var handled = false; + switch (event.keyIdentifier) { case "Up": - this._upKeyPressed(event); + this.upKeyPressed(event); break; case "Down": - this._downKeyPressed(event); + this.downKeyPressed(event); break; case "U+0009": // Tab - this._tabKeyPressed(event); + this.tabKeyPressed(event); break; case "Right": case "End": @@ -85,7 +98,7 @@ WebInspector.TextPrompt.prototype = { case "Control": break; case "U+0050": // Ctrl+P = Previous - if (WebInspector.isMac() && event.ctrlKey && !event.metaKey && !event.altKey && !event.shiftKey) { + if (this.history && WebInspector.isMac() && event.ctrlKey && !event.metaKey && !event.altKey && !event.shiftKey) { handled = true; this._moveBackInHistory(); break; @@ -93,7 +106,7 @@ WebInspector.TextPrompt.prototype = { defaultAction.call(this); break; case "U+004E": // Ctrl+N = Next - if (WebInspector.isMac() && event.ctrlKey && !event.metaKey && !event.altKey && !event.shiftKey) { + if (this.history && WebInspector.isMac() && event.ctrlKey && !event.metaKey && !event.altKey && !event.shiftKey) { handled = true; this._moveForwardInHistory(); break; @@ -105,7 +118,9 @@ WebInspector.TextPrompt.prototype = { break; } + handled |= event.handled; if (handled) { + event.handled = true; event.preventDefault(); event.stopPropagation(); } @@ -376,39 +391,33 @@ WebInspector.TextPrompt.prototype = { selection.addRange(selectionRange); }, - _tabKeyPressed: function(event) + tabKeyPressed: function(event) { - event.preventDefault(); - event.stopPropagation(); - + event.handled = true; this.complete(false, event.shiftKey); }, - _upKeyPressed: function(event) + upKeyPressed: function(event) { if (!this.isCaretOnFirstLine()) return; - event.preventDefault(); - event.stopPropagation(); - + event.handled = true; this._moveBackInHistory(); }, - _downKeyPressed: function(event) + downKeyPressed: function(event) { if (!this.isCaretOnLastLine()) return; - event.preventDefault(); - event.stopPropagation(); - + event.handled = true; this._moveForwardInHistory(); }, _moveBackInHistory: function() { - if (this.historyOffset == this.history.length) + if (!this.history || this.historyOffset == this.history.length) return; this.clearAutoComplete(true); @@ -437,7 +446,7 @@ WebInspector.TextPrompt.prototype = { _moveForwardInHistory: function() { - if (this.historyOffset === 0) + if (!this.history || this.historyOffset === 0) return; this.clearAutoComplete(true); diff --git a/Source/WebCore/inspector/front-end/TextViewer.js b/Source/WebCore/inspector/front-end/TextViewer.js index f116dea..ea36513 100644 --- a/Source/WebCore/inspector/front-end/TextViewer.js +++ b/Source/WebCore/inspector/front-end/TextViewer.js @@ -43,7 +43,6 @@ WebInspector.TextViewer = function(textModel, platform, url) this.element.addEventListener("keydown", this._handleKeyDown.bind(this), false); this.element.addEventListener("beforecopy", this._beforeCopy.bind(this), false); this.element.addEventListener("copy", this._copy.bind(this), false); - this.element.addEventListener("dblclick", this._handleDoubleClick.bind(this), false); this._url = url; @@ -80,11 +79,6 @@ WebInspector.TextViewer.prototype = { chunk.element.scrollIntoViewIfNeeded(); }, - set editCallback(editCallback) - { - this._editCallback = editCallback; - }, - addDecoration: function(lineNumber, decoration) { var chunk = this._makeLineAChunk(lineNumber); @@ -231,20 +225,20 @@ WebInspector.TextViewer.prototype = { scrollValue = -1; else if (event.keyCode == WebInspector.KeyboardShortcut.Keys.Down.code) scrollValue = 1; - + if (scrollValue) { event.preventDefault(); event.stopPropagation(); this.element.scrollByLines(scrollValue); return; } - + scrollValue = 0; if (event.keyCode === WebInspector.KeyboardShortcut.Keys.Left.code) scrollValue = -40; else if (event.keyCode == WebInspector.KeyboardShortcut.Keys.Right.code) scrollValue = 40; - + if (scrollValue) { event.preventDefault(); event.stopPropagation(); @@ -252,42 +246,25 @@ WebInspector.TextViewer.prototype = { } }, - _handleDoubleClick: function(e) + editLine: function(lineRow, callback) { - if (!this._editCallback) - return; - - var cell = e.target.enclosingNodeOrSelfWithNodeName("TD"); - if (!cell) - return; - - var lineRow = cell.parentElement; - if (lineRow.firstChild === cell) - return; // Do not trigger editing from line numbers. - - var oldContent = lineRow.lastChild.innerHTML; - var cancelEditingCallback = this._cancelEditingLine.bind(this, lineRow.lastChild, oldContent); - var commitEditingCallback = this._commitEditingLine.bind(this, lineRow.lineNumber, lineRow.lastChild, cancelEditingCallback); - this._editingLine = WebInspector.startEditing(lineRow.lastChild, { + var element = lineRow.lastChild; + var oldContent = element.innerHTML; + function finishEditing(committed, e, newContent) + { + if (committed) + callback(newContent); + element.innerHTML = oldContent; + delete this._editingLine; + } + this._editingLine = WebInspector.startEditing(element, { context: null, - commitHandler: commitEditingCallback, - cancelHandler: cancelEditingCallback, + commitHandler: finishEditing.bind(this, true), + cancelHandler: finishEditing.bind(this, false), multiline: true }); }, - _commitEditingLine: function(lineNumber, element, cancelEditingCallback) - { - this._editCallback(lineNumber, element.textContent, cancelEditingCallback); - delete this._editingLine; - }, - - _cancelEditingLine: function(element, oldContent, e) - { - element.innerHTML = oldContent; - delete this._editingLine; - }, - _beforeCopy: function(e) { e.preventDefault(); @@ -786,7 +763,7 @@ WebInspector.TextChunk.prototype = { var lineContentElement = document.createElement("td"); lineContentElement.className = "webkit-line-content"; - lineRow.appendChild(lineContentElement); + lineRow.appendChild(lineContentElement); } lineRow.lineNumber = lineNumber; lineNumberElement.textContent = lineNumber + 1; diff --git a/Source/WebCore/inspector/front-end/UglifyJS/parse-js.js b/Source/WebCore/inspector/front-end/UglifyJS/parse-js.js new file mode 100644 index 0000000..a218c01 --- /dev/null +++ b/Source/WebCore/inspector/front-end/UglifyJS/parse-js.js @@ -0,0 +1,1233 @@ +/*********************************************************************** + + A JavaScript tokenizer / parser / beautifier / compressor. + + This version is suitable for Node.js. With minimal changes (the + exports stuff) it should work on any JS platform. + + This file contains the tokenizer/parser. It is a port to JavaScript + of parse-js [1], a JavaScript parser library written in Common Lisp + by Marijn Haverbeke. Thank you Marijn! + + [1] http://marijn.haverbeke.nl/parse-js/ + + Exported functions: + + - tokenizer(code) -- returns a function. Call the returned + function to fetch the next token. + + - parse(code) -- returns an AST of the given JavaScript code. + + -------------------------------- (C) --------------------------------- + + Author: Mihai Bazon + <mihai.bazon@gmail.com> + http://mihai.bazon.net/blog + + Distributed under the BSD license: + + Copyright 2010 (c) Mihai Bazon <mihai.bazon@gmail.com> + Based on parse-js (http://marijn.haverbeke.nl/parse-js/). + + 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. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER “AS IS” AND ANY + EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 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. + + ***********************************************************************/ + +/* -----[ Tokenizer (constants) ]----- */ + +var KEYWORDS = array_to_hash([ + "break", + "case", + "catch", + "const", + "continue", + "default", + "delete", + "do", + "else", + "finally", + "for", + "function", + "if", + "in", + "instanceof", + "new", + "return", + "switch", + "throw", + "try", + "typeof", + "var", + "void", + "while", + "with" +]); + +var RESERVED_WORDS = array_to_hash([ + "abstract", + "boolean", + "byte", + "char", + "class", + "debugger", + "double", + "enum", + "export", + "extends", + "final", + "float", + "goto", + "implements", + "import", + "int", + "interface", + "long", + "native", + "package", + "private", + "protected", + "public", + "short", + "static", + "super", + "synchronized", + "throws", + "transient", + "volatile" +]); + +var KEYWORDS_BEFORE_EXPRESSION = array_to_hash([ + "return", + "new", + "delete", + "throw", + "else", + "case" +]); + +var KEYWORDS_ATOM = array_to_hash([ + "false", + "null", + "true", + "undefined" +]); + +var OPERATOR_CHARS = array_to_hash(characters("+-*&%=<>!?|~^")); + +var RE_HEX_NUMBER = /^0x[0-9a-f]+$/i; +var RE_OCT_NUMBER = /^0[0-7]+$/; +var RE_DEC_NUMBER = /^\d*\.?\d*(?:e[+-]?\d*(?:\d\.?|\.?\d)\d*)?$/i; + +var OPERATORS = array_to_hash([ + "in", + "instanceof", + "typeof", + "new", + "void", + "delete", + "++", + "--", + "+", + "-", + "!", + "~", + "&", + "|", + "^", + "*", + "/", + "%", + ">>", + "<<", + ">>>", + "<", + ">", + "<=", + ">=", + "==", + "===", + "!=", + "!==", + "?", + "=", + "+=", + "-=", + "/=", + "*=", + "%=", + ">>=", + "<<=", + ">>>=", + "~=", + "%=", + "|=", + "^=", + "&=", + "&&", + "||" +]); + +var WHITESPACE_CHARS = array_to_hash(characters(" \n\r\t")); + +var PUNC_BEFORE_EXPRESSION = array_to_hash(characters("[{}(,.;:")); + +var PUNC_CHARS = array_to_hash(characters("[]{}(),;:")); + +var REGEXP_MODIFIERS = array_to_hash(characters("gmsiy")); + +/* -----[ Tokenizer ]----- */ + +function is_alphanumeric_char(ch) { + ch = ch.charCodeAt(0); + return (ch >= 48 && ch <= 57) || + (ch >= 65 && ch <= 90) || + (ch >= 97 && ch <= 122); +}; + +function is_identifier_char(ch) { + return is_alphanumeric_char(ch) || ch == "$" || ch == "_"; +}; + +function is_digit(ch) { + ch = ch.charCodeAt(0); + return ch >= 48 && ch <= 57; +}; + +function parse_js_number(num) { + if (RE_HEX_NUMBER.test(num)) { + return parseInt(num.substr(2), 16); + } else if (RE_OCT_NUMBER.test(num)) { + return parseInt(num.substr(1), 8); + } else if (RE_DEC_NUMBER.test(num)) { + return parseFloat(num); + } +}; + +function JS_Parse_Error(message, line, col, pos) { + this.message = message; + this.line = line; + this.col = col; + this.pos = pos; + try { + ({})(); + } catch(ex) { + this.stack = ex.stack; + }; +}; + +JS_Parse_Error.prototype.toString = function() { + return this.message + " (line: " + this.line + ", col: " + this.col + ", pos: " + this.pos + ")" + "\n\n" + this.stack; +}; + +function js_error(message, line, col, pos) { + throw new JS_Parse_Error(message, line, col, pos); +}; + +function is_token(token, type, val) { + return token.type == type && (val == null || token.value == val); +}; + +var EX_EOF = {}; + +function tokenizer($TEXT, skip_comments) { + + var S = { + text : $TEXT.replace(/\r\n?|[\n\u2028\u2029]/g, "\n").replace(/^\uFEFF/, ''), + pos : 0, + tokpos : 0, + line : 0, + tokline : 0, + col : 0, + tokcol : 0, + newline_before : false, + regex_allowed : false + }; + + function peek() { return S.text.charAt(S.pos); }; + + function next(signal_eof) { + var ch = S.text.charAt(S.pos++); + if (signal_eof && !ch) + throw EX_EOF; + if (ch == "\n") { + S.newline_before = true; + ++S.line; + S.col = 0; + } else { + ++S.col; + } + return ch; + }; + + function eof() { + return !S.peek(); + }; + + function find(what, signal_eof) { + var pos = S.text.indexOf(what, S.pos); + if (signal_eof && pos == -1) throw EX_EOF; + return pos; + }; + + function start_token() { + S.tokline = S.line; + S.tokcol = S.col; + S.tokpos = S.pos; + }; + + function token(type, value) { + S.regex_allowed = ((type == "operator" && !HOP(UNARY_POSTFIX, value)) || + (type == "keyword" && HOP(KEYWORDS_BEFORE_EXPRESSION, value)) || + (type == "punc" && HOP(PUNC_BEFORE_EXPRESSION, value))); + var ret = { + type : type, + value : value, + line : S.tokline, + col : S.tokcol, + pos : S.tokpos, + nlb : S.newline_before + }; + S.newline_before = false; + return ret; + }; + + function skip_whitespace() { + while (HOP(WHITESPACE_CHARS, peek())) + next(); + }; + + function read_while(pred) { + var ret = "", ch = peek(), i = 0; + while (ch && pred(ch, i++)) { + ret += next(); + ch = peek(); + } + return ret; + }; + + function parse_error(err) { + js_error(err, S.tokline, S.tokcol, S.tokpos); + }; + + function read_num(prefix) { + var has_e = false, after_e = false, has_x = false; + var num = read_while(function(ch, i){ + if (ch == "x" || ch == "X") { + if (has_x) return false; + return has_x = true; + } + if (!has_x && (ch == "E" || ch == "e")) { + if (has_e) return false; + return has_e = after_e = true; + } + if (ch == "-") { + if (after_e || (i == 0 && !prefix)) return true; + return false; + } + if (ch == "+") return after_e; + after_e = false; + return is_alphanumeric_char(ch) || ch == "."; + }); + if (prefix) + num = prefix + num; + var valid = parse_js_number(num); + if (!isNaN(valid)) { + return token("num", valid); + } else { + parse_error("Invalid syntax: " + num); + } + }; + + function read_escaped_char() { + var ch = next(true); + switch (ch) { + case "n" : return "\n"; + case "r" : return "\r"; + case "t" : return "\t"; + case "b" : return "\b"; + case "v" : return "\v"; + case "f" : return "\f"; + case "0" : return "\0"; + case "x" : return String.fromCharCode(hex_bytes(2)); + case "u" : return String.fromCharCode(hex_bytes(4)); + default : return ch; + } + }; + + function hex_bytes(n) { + var num = 0; + for (; n > 0; --n) { + var digit = parseInt(next(true), 16); + if (isNaN(digit)) + parse_error("Invalid hex-character pattern in string"); + num = (num << 4) | digit; + } + return num; + }; + + function read_string() { + return with_eof_error("Unterminated string constant", function(){ + var quote = next(), ret = ""; + for (;;) { + var ch = next(true); + if (ch == "\\") ch = read_escaped_char(); + else if (ch == quote) break; + ret += ch; + } + return token("string", ret); + }); + }; + + function read_line_comment() { + next(); + var i = find("\n"), ret; + if (i == -1) { + ret = S.text.substr(S.pos); + S.pos = S.text.length; + } else { + ret = S.text.substring(S.pos, i); + S.pos = i; + } + return token("comment1", ret); + }; + + function read_multiline_comment() { + next(); + return with_eof_error("Unterminated multiline comment", function(){ + var i = find("*/", true), + text = S.text.substring(S.pos, i), + tok = token("comment2", text); + S.pos = i + 2; + S.newline_before = text.indexOf("\n") >= 0; + return tok; + }); + }; + + function read_regexp() { + return with_eof_error("Unterminated regular expression", function(){ + var prev_backslash = false, regexp = "", ch, in_class = false; + while ((ch = next(true))) if (prev_backslash) { + regexp += "\\" + ch; + prev_backslash = false; + } else if (ch == "[") { + in_class = true; + regexp += ch; + } else if (ch == "]" && in_class) { + in_class = false; + regexp += ch; + } else if (ch == "/" && !in_class) { + break; + } else if (ch == "\\") { + prev_backslash = true; + } else { + regexp += ch; + } + var mods = read_while(function(ch){ + return HOP(REGEXP_MODIFIERS, ch); + }); + return token("regexp", [ regexp, mods ]); + }); + }; + + function read_operator(prefix) { + function grow(op) { + var bigger = op + peek(); + if (HOP(OPERATORS, bigger)) { + next(); + return grow(bigger); + } else { + return op; + } + }; + return token("operator", grow(prefix || next())); + }; + + var handle_slash = skip_comments ? function() { + next(); + var regex_allowed = S.regex_allowed; + switch (peek()) { + case "/": read_line_comment(); S.regex_allowed = regex_allowed; return next_token(); + case "*": read_multiline_comment(); S.regex_allowed = regex_allowed; return next_token(); + } + return S.regex_allowed ? read_regexp() : read_operator("/"); + } : function() { + next(); + switch (peek()) { + case "/": return read_line_comment(); + case "*": return read_multiline_comment(); + } + return S.regex_allowed ? read_regexp() : read_operator("/"); + }; + + function handle_dot() { + next(); + return is_digit(peek()) + ? read_num(".") + : token("punc", "."); + }; + + function read_word() { + var word = read_while(is_identifier_char); + return !HOP(KEYWORDS, word) + ? token("name", word) + : HOP(OPERATORS, word) + ? token("operator", word) + : HOP(KEYWORDS_ATOM, word) + ? token("atom", word) + : token("keyword", word); + }; + + function with_eof_error(eof_error, cont) { + try { + return cont(); + } catch(ex) { + if (ex === EX_EOF) parse_error(eof_error); + else throw ex; + } + }; + + function next_token(force_regexp) { + if (force_regexp) + return read_regexp(); + skip_whitespace(); + start_token(); + var ch = peek(); + if (!ch) return token("eof"); + if (is_digit(ch)) return read_num(); + if (ch == '"' || ch == "'") return read_string(); + if (HOP(PUNC_CHARS, ch)) return token("punc", next()); + if (ch == ".") return handle_dot(); + if (ch == "/") return handle_slash(); + if (HOP(OPERATOR_CHARS, ch)) return read_operator(); + if (is_identifier_char(ch)) return read_word(); + parse_error("Unexpected character '" + ch + "'"); + }; + + next_token.context = function(nc) { + if (nc) S = nc; + return S; + }; + + return next_token; + +}; + +/* -----[ Parser (constants) ]----- */ + +var UNARY_PREFIX = array_to_hash([ + "typeof", + "void", + "delete", + "--", + "++", + "!", + "~", + "-", + "+" +]); + +var UNARY_POSTFIX = array_to_hash([ "--", "++" ]); + +var ASSIGNMENT = (function(a, ret, i){ + while (i < a.length) { + ret[a[i]] = a[i].substr(0, a[i].length - 1); + i++; + } + return ret; +})( + ["+=", "-=", "/=", "*=", "%=", ">>=", "<<=", ">>>=", "~=", "%=", "|=", "^=", "&="], + { "=": true }, + 0 +); + +var PRECEDENCE = (function(a, ret){ + for (var i = 0, n = 1; i < a.length; ++i, ++n) { + var b = a[i]; + for (var j = 0; j < b.length; ++j) { + ret[b[j]] = n; + } + } + return ret; +})( + [ + ["||"], + ["&&"], + ["|"], + ["^"], + ["&"], + ["==", "===", "!=", "!=="], + ["<", ">", "<=", ">=", "in", "instanceof"], + [">>", "<<", ">>>"], + ["+", "-"], + ["*", "/", "%"] + ], + {} +); + +var STATEMENTS_WITH_LABELS = array_to_hash([ "for", "do", "while", "switch" ]); + +var ATOMIC_START_TOKEN = array_to_hash([ "atom", "num", "string", "regexp", "name" ]); + +/* -----[ Parser ]----- */ + +function NodeWithToken(str, start, end) { + this.name = str; + this.start = start; + this.end = end; +}; + +NodeWithToken.prototype.toString = function() { return this.name; }; + +function parse($TEXT, strict_mode, embed_tokens) { + + var S = { + input: tokenizer($TEXT, true), + token: null, + prev: null, + peeked: null, + in_function: 0, + in_loop: 0, + labels: [] + }; + + S.token = next(); + + function is(type, value) { + return is_token(S.token, type, value); + }; + + function peek() { return S.peeked || (S.peeked = S.input()); }; + + function next() { + S.prev = S.token; + if (S.peeked) { + S.token = S.peeked; + S.peeked = null; + } else { + S.token = S.input(); + } + return S.token; + }; + + function prev() { + return S.prev; + }; + + function croak(msg, line, col, pos) { + var ctx = S.input.context(); + js_error(msg, + line != null ? line : ctx.tokline, + col != null ? col : ctx.tokcol, + pos != null ? pos : ctx.tokpos); + }; + + function token_error(token, msg) { + croak(msg, token.line, token.col); + }; + + function unexpected(token) { + if (token == null) + token = S.token; + token_error(token, "Unexpected token: " + token.type + " (" + token.value + ")"); + }; + + function expect_token(type, val) { + if (is(type, val)) { + return next(); + } + token_error(S.token, "Unexpected token " + S.token.type + ", expected " + type); + }; + + function expect(punc) { return expect_token("punc", punc); }; + + function can_insert_semicolon() { + return !strict_mode && ( + S.token.nlb || is("eof") || is("punc", "}") + ); + }; + + function semicolon() { + if (is("punc", ";")) next(); + else if (!can_insert_semicolon()) unexpected(); + }; + + function as() { + return slice(arguments); + }; + + function parenthesised() { + expect("("); + var ex = expression(); + expect(")"); + return ex; + }; + + function add_tokens(str, start, end) { + return new NodeWithToken(str, start, end); + }; + + var statement = embed_tokens ? function() { + var start = S.token; + var stmt = $statement(); + stmt[0] = add_tokens(stmt[0], start, prev()); + return stmt; + } : $statement; + + function $statement() { + if (is("operator", "/")) { + S.peeked = null; + S.token = S.input(true); // force regexp + } + switch (S.token.type) { + case "num": + case "string": + case "regexp": + case "operator": + case "atom": + return simple_statement(); + + case "name": + return is_token(peek(), "punc", ":") + ? labeled_statement(prog1(S.token.value, next, next)) + : simple_statement(); + + case "punc": + switch (S.token.value) { + case "{": + return as("block", block_()); + case "[": + case "(": + return simple_statement(); + case ";": + next(); + return as("block"); + default: + unexpected(); + } + + case "keyword": + switch (prog1(S.token.value, next)) { + case "break": + return break_cont("break"); + + case "continue": + return break_cont("continue"); + + case "debugger": + semicolon(); + return as("debugger"); + + case "do": + return (function(body){ + expect_token("keyword", "while"); + return as("do", prog1(parenthesised, semicolon), body); + })(in_loop(statement)); + + case "for": + return for_(); + + case "function": + return function_(true); + + case "if": + return if_(); + + case "return": + if (S.in_function == 0) + croak("'return' outside of function"); + return as("return", + is("punc", ";") + ? (next(), null) + : can_insert_semicolon() + ? null + : prog1(expression, semicolon)); + + case "switch": + return as("switch", parenthesised(), switch_block_()); + + case "throw": + return as("throw", prog1(expression, semicolon)); + + case "try": + return try_(); + + case "var": + return prog1(var_, semicolon); + + case "const": + return prog1(const_, semicolon); + + case "while": + return as("while", parenthesised(), in_loop(statement)); + + case "with": + return as("with", parenthesised(), statement()); + + default: + unexpected(); + } + } + }; + + function labeled_statement(label) { + S.labels.push(label); + var start = S.token, stat = statement(); + if (strict_mode && !HOP(STATEMENTS_WITH_LABELS, stat[0])) + unexpected(start); + S.labels.pop(); + return as("label", label, stat); + }; + + function simple_statement() { + return as("stat", prog1(expression, semicolon)); + }; + + function break_cont(type) { + var name = is("name") ? S.token.value : null; + if (name != null) { + next(); + if (!member(name, S.labels)) + croak("Label " + name + " without matching loop or statement"); + } + else if (S.in_loop == 0) + croak(type + " not inside a loop or switch"); + semicolon(); + return as(type, name); + }; + + function for_() { + expect("("); + var has_var = is("keyword", "var"); + if (has_var) + next(); + if (is("name") && is_token(peek(), "operator", "in")) { + // for (i in foo) + var name = S.token.value; + next(); next(); + var obj = expression(); + expect(")"); + return as("for-in", has_var, name, obj, in_loop(statement)); + } else { + // classic for + var init = is("punc", ";") ? null : has_var ? var_() : expression(); + expect(";"); + var test = is("punc", ";") ? null : expression(); + expect(";"); + var step = is("punc", ")") ? null : expression(); + expect(")"); + return as("for", init, test, step, in_loop(statement)); + } + }; + + function function_(in_statement) { + var name = is("name") ? prog1(S.token.value, next) : null; + if (in_statement && !name) + unexpected(); + expect("("); + return as(in_statement ? "defun" : "function", + name, + // arguments + (function(first, a){ + while (!is("punc", ")")) { + if (first) first = false; else expect(","); + if (!is("name")) unexpected(); + a.push(S.token.value); + next(); + } + next(); + return a; + })(true, []), + // body + (function(){ + ++S.in_function; + var loop = S.in_loop; + S.in_loop = 0; + var a = block_(); + --S.in_function; + S.in_loop = loop; + return a; + })()); + }; + + function if_() { + var cond = parenthesised(), body = statement(), belse; + if (is("keyword", "else")) { + next(); + belse = statement(); + } + return as("if", cond, body, belse); + }; + + function block_() { + expect("{"); + var a = []; + while (!is("punc", "}")) { + if (is("eof")) unexpected(); + a.push(statement()); + } + next(); + return a; + }; + + var switch_block_ = curry(in_loop, function(){ + expect("{"); + var a = [], cur = null; + while (!is("punc", "}")) { + if (is("eof")) unexpected(); + if (is("keyword", "case")) { + next(); + cur = []; + a.push([ expression(), cur ]); + expect(":"); + } + else if (is("keyword", "default")) { + next(); + expect(":"); + cur = []; + a.push([ null, cur ]); + } + else { + if (!cur) unexpected(); + cur.push(statement()); + } + } + next(); + return a; + }); + + function try_() { + var body = block_(), bcatch, bfinally; + if (is("keyword", "catch")) { + next(); + expect("("); + if (!is("name")) + croak("Name expected"); + var name = S.token.value; + next(); + expect(")"); + bcatch = [ name, block_() ]; + } + if (is("keyword", "finally")) { + next(); + bfinally = block_(); + } + if (!bcatch && !bfinally) + croak("Missing catch/finally blocks"); + return as("try", body, bcatch, bfinally); + }; + + function vardefs() { + var a = []; + for (;;) { + if (!is("name")) + unexpected(); + var name = S.token.value; + next(); + if (is("operator", "=")) { + next(); + a.push([ name, expression(false) ]); + } else { + a.push([ name ]); + } + if (!is("punc", ",")) + break; + next(); + } + return a; + }; + + function var_() { + return as("var", vardefs()); + }; + + function const_() { + return as("const", vardefs()); + }; + + function new_() { + var newexp = expr_atom(false), args; + if (is("punc", "(")) { + next(); + args = expr_list(")"); + } else { + args = []; + } + return subscripts(as("new", newexp, args), true); + }; + + function expr_atom(allow_calls) { + if (is("operator", "new")) { + next(); + return new_(); + } + if (is("operator") && HOP(UNARY_PREFIX, S.token.value)) { + return make_unary("unary-prefix", + prog1(S.token.value, next), + expr_atom(allow_calls)); + } + if (is("punc")) { + switch (S.token.value) { + case "(": + next(); + return subscripts(prog1(expression, curry(expect, ")")), allow_calls); + case "[": + next(); + return subscripts(array_(), allow_calls); + case "{": + next(); + return subscripts(object_(), allow_calls); + } + unexpected(); + } + if (is("keyword", "function")) { + next(); + return subscripts(function_(false), allow_calls); + } + if (HOP(ATOMIC_START_TOKEN, S.token.type)) { + var atom = S.token.type == "regexp" + ? as("regexp", S.token.value[0], S.token.value[1]) + : as(S.token.type, S.token.value); + return subscripts(prog1(atom, next), allow_calls); + } + unexpected(); + }; + + function expr_list(closing, allow_trailing_comma) { + var first = true, a = []; + while (!is("punc", closing)) { + if (first) first = false; else expect(","); + if (allow_trailing_comma && is("punc", closing)) + break; + a.push(expression(false)); + } + next(); + return a; + }; + + function array_() { + return as("array", expr_list("]", !strict_mode)); + }; + + function object_() { + var first = true, a = []; + while (!is("punc", "}")) { + if (first) first = false; else expect(","); + if (!strict_mode && is("punc", "}")) + // allow trailing comma + break; + var type = S.token.type; + var name = as_property_name(); + if (type == "name" && (name == "get" || name == "set") && !is("punc", ":")) { + a.push([ as_name(), function_(false), name ]); + } else { + expect(":"); + a.push([ name, expression(false) ]); + } + } + next(); + return as("object", a); + }; + + function as_property_name() { + switch (S.token.type) { + case "num": + case "string": + return prog1(S.token.value, next); + } + return as_name(); + }; + + function as_name() { + switch (S.token.type) { + case "name": + case "operator": + case "keyword": + case "atom": + return prog1(S.token.value, next); + default: + unexpected(); + } + }; + + function subscripts(expr, allow_calls) { + if (is("punc", ".")) { + next(); + return subscripts(as("dot", expr, as_name()), allow_calls); + } + if (is("punc", "[")) { + next(); + return subscripts(as("sub", expr, prog1(expression, curry(expect, "]"))), allow_calls); + } + if (allow_calls && is("punc", "(")) { + next(); + return subscripts(as("call", expr, expr_list(")")), true); + } + if (allow_calls && is("operator") && HOP(UNARY_POSTFIX, S.token.value)) { + return prog1(curry(make_unary, "unary-postfix", S.token.value, expr), + next); + } + return expr; + }; + + function make_unary(tag, op, expr) { + if ((op == "++" || op == "--") && !is_assignable(expr)) + croak("Invalid use of " + op + " operator"); + return as(tag, op, expr); + }; + + function expr_op(left, min_prec) { + var op = is("operator") ? S.token.value : null; + var prec = op != null ? PRECEDENCE[op] : null; + if (prec != null && prec > min_prec) { + next(); + var right = expr_op(expr_atom(true), prec); + return expr_op(as("binary", op, left, right), min_prec); + } + return left; + }; + + function expr_ops() { + return expr_op(expr_atom(true), 0); + }; + + function maybe_conditional() { + var expr = expr_ops(); + if (is("operator", "?")) { + next(); + var yes = expression(false); + expect(":"); + return as("conditional", expr, yes, expression(false)); + } + return expr; + }; + + function is_assignable(expr) { + switch (expr[0]) { + case "dot": + case "sub": + return true; + case "name": + return expr[1] != "this"; + } + }; + + function maybe_assign() { + var left = maybe_conditional(), val = S.token.value; + if (is("operator") && HOP(ASSIGNMENT, val)) { + if (is_assignable(left)) { + next(); + return as("assign", ASSIGNMENT[val], left, maybe_assign()); + } + croak("Invalid assignment"); + } + return left; + }; + + function expression(commas) { + if (arguments.length == 0) + commas = true; + var expr = maybe_assign(); + if (commas && is("punc", ",")) { + next(); + return as("seq", expr, expression()); + } + return expr; + }; + + function in_loop(cont) { + try { + ++S.in_loop; + return cont(); + } finally { + --S.in_loop; + } + }; + + return as("toplevel", (function(a){ + while (!is("eof")) + a.push(statement()); + return a; + })([])); + +}; + +/* -----[ Utilities ]----- */ + +function curry(f) { + var args = slice(arguments, 1); + return function() { return f.apply(this, args.concat(slice(arguments))); }; +}; + +function prog1(ret) { + if (ret instanceof Function) + ret = ret(); + for (var i = 1, n = arguments.length; --n > 0; ++i) + arguments[i](); + return ret; +}; + +function array_to_hash(a) { + var ret = {}; + for (var i = 0; i < a.length; ++i) + ret[a[i]] = true; + return ret; +}; + +function slice(a, start) { + return Array.prototype.slice.call(a, start == null ? 0 : start); +}; + +function characters(str) { + return str.split(""); +}; + +function member(name, array) { + for (var i = array.length; --i >= 0;) + if (array[i] === name) + return true; + return false; +}; + +function HOP(obj, prop) { + return Object.prototype.hasOwnProperty.call(obj, prop); +}; + +/* -----[ Exports ]----- */ + +exports.tokenizer = tokenizer; +exports.parse = parse; +exports.slice = slice; +exports.curry = curry; +exports.member = member; +exports.array_to_hash = array_to_hash; +exports.PRECEDENCE = PRECEDENCE; +exports.KEYWORDS_ATOM = KEYWORDS_ATOM; +exports.RESERVED_WORDS = RESERVED_WORDS; +exports.KEYWORDS = KEYWORDS; +exports.ATOMIC_START_TOKEN = ATOMIC_START_TOKEN; +exports.OPERATORS = OPERATORS; +exports.is_alphanumeric_char = is_alphanumeric_char; diff --git a/Source/WebCore/inspector/front-end/UglifyJS/process.js b/Source/WebCore/inspector/front-end/UglifyJS/process.js new file mode 100755 index 0000000..65dbc0e --- /dev/null +++ b/Source/WebCore/inspector/front-end/UglifyJS/process.js @@ -0,0 +1,1560 @@ +/*********************************************************************** + + A JavaScript tokenizer / parser / beautifier / compressor. + + This version is suitable for Node.js. With minimal changes (the + exports stuff) it should work on any JS platform. + + This file implements some AST processors. They work on data built + by parse-js. + + Exported functions: + + - ast_mangle(ast, include_toplevel) -- mangles the + variable/function names in the AST. Returns an AST. Pass true + as second argument to mangle toplevel names too. + + - ast_squeeze(ast) -- employs various optimizations to make the + final generated code even smaller. Returns an AST. + + - gen_code(ast, beautify) -- generates JS code from the AST. Pass + true (or an object, see the code for some options) as second + argument to get "pretty" (indented) code. + + -------------------------------- (C) --------------------------------- + + Author: Mihai Bazon + <mihai.bazon@gmail.com> + http://mihai.bazon.net/blog + + Distributed under the BSD license: + + Copyright 2010 (c) Mihai Bazon <mihai.bazon@gmail.com> + + 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. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER “AS IS” AND ANY + EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 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. + + ***********************************************************************/ + +var jsp = require("./parse-js"), + slice = jsp.slice, + member = jsp.member, + PRECEDENCE = jsp.PRECEDENCE, + OPERATORS = jsp.OPERATORS; + +/* -----[ helper for AST traversal ]----- */ + +function ast_walker(ast) { + function _vardefs(defs) { + return MAP(defs, function(def){ + var a = [ def[0] ]; + if (def.length > 1) + a[1] = walk(def[1]); + return a; + }); + }; + var walkers = { + "string": function(str) { + return [ "string", str ]; + }, + "num": function(num) { + return [ "num", num ]; + }, + "name": function(name) { + return [ "name", name ]; + }, + "toplevel": function(statements) { + return [ "toplevel", MAP(statements, walk) ]; + }, + "block": function(statements) { + var out = [ "block" ]; + if (statements != null) + out.push(MAP(statements, walk)); + return out; + }, + "var": function(defs) { + return [ "var", _vardefs(defs) ]; + }, + "const": function(defs) { + return [ "const", _vardefs(defs) ]; + }, + "try": function(t, c, f) { + return [ + "try", + MAP(t, walk), + c != null ? [ c[0], MAP(c[1], walk) ] : null, + f != null ? MAP(f, walk) : null + ]; + }, + "throw": function(expr) { + return [ "throw", walk(expr) ]; + }, + "new": function(ctor, args) { + return [ "new", walk(ctor), MAP(args, walk) ]; + }, + "switch": function(expr, body) { + return [ "switch", walk(expr), MAP(body, function(branch){ + return [ branch[0] ? walk(branch[0]) : null, + MAP(branch[1], walk) ]; + }) ]; + }, + "break": function(label) { + return [ "break", label ]; + }, + "continue": function(label) { + return [ "continue", label ]; + }, + "conditional": function(cond, t, e) { + return [ "conditional", walk(cond), walk(t), walk(e) ]; + }, + "assign": function(op, lvalue, rvalue) { + return [ "assign", op, walk(lvalue), walk(rvalue) ]; + }, + "dot": function(expr) { + return [ "dot", walk(expr) ].concat(slice(arguments, 1)); + }, + "call": function(expr, args) { + return [ "call", walk(expr), MAP(args, walk) ]; + }, + "function": function(name, args, body) { + return [ "function", name, args.slice(), MAP(body, walk) ]; + }, + "defun": function(name, args, body) { + return [ "defun", name, args.slice(), MAP(body, walk) ]; + }, + "if": function(conditional, t, e) { + return [ "if", walk(conditional), walk(t), walk(e) ]; + }, + "for": function(init, cond, step, block) { + return [ "for", walk(init), walk(cond), walk(step), walk(block) ]; + }, + "for-in": function(has_var, key, hash, block) { + return [ "for-in", has_var, key, walk(hash), walk(block) ]; + }, + "while": function(cond, block) { + return [ "while", walk(cond), walk(block) ]; + }, + "do": function(cond, block) { + return [ "do", walk(cond), walk(block) ]; + }, + "return": function(expr) { + return [ "return", walk(expr) ]; + }, + "binary": function(op, left, right) { + return [ "binary", op, walk(left), walk(right) ]; + }, + "unary-prefix": function(op, expr) { + return [ "unary-prefix", op, walk(expr) ]; + }, + "unary-postfix": function(op, expr) { + return [ "unary-postfix", op, walk(expr) ]; + }, + "sub": function(expr, subscript) { + return [ "sub", walk(expr), walk(subscript) ]; + }, + "object": function(props) { + return [ "object", MAP(props, function(p){ + return p.length == 2 + ? [ p[0], walk(p[1]) ] + : [ p[0], walk(p[1]), p[2] ]; // get/set-ter + }) ]; + }, + "regexp": function(rx, mods) { + return [ "regexp", rx, mods ]; + }, + "array": function(elements) { + return [ "array", MAP(elements, walk) ]; + }, + "stat": function(stat) { + return [ "stat", walk(stat) ]; + }, + "seq": function() { + return [ "seq" ].concat(MAP(slice(arguments), walk)); + }, + "label": function(name, block) { + return [ "label", name, walk(block) ]; + }, + "with": function(expr, block) { + return [ "with", walk(expr), walk(block) ]; + }, + "atom": function(name) { + return [ "atom", name ]; + } + }; + + var user = {}; + var stack = []; + function walk(ast) { + if (ast == null) + return null; + try { + stack.push(ast); + var type = ast[0]; + var gen = user[type]; + if (gen) { + var ret = gen.apply(ast, ast.slice(1)); + if (ret != null) + return ret; + } + gen = walkers[type]; + return gen.apply(ast, ast.slice(1)); + } finally { + stack.pop(); + } + }; + + function with_walkers(walkers, cont){ + var save = {}, i; + for (i in walkers) if (HOP(walkers, i)) { + save[i] = user[i]; + user[i] = walkers[i]; + } + var ret = cont(); + for (i in save) if (HOP(save, i)) { + if (!save[i]) delete user[i]; + else user[i] = save[i]; + } + return ret; + }; + + return { + walk: walk, + with_walkers: with_walkers, + parent: function() { + return stack[stack.length - 2]; // last one is current node + }, + stack: function() { + return stack; + } + }; +}; + +/* -----[ Scope and mangling ]----- */ + +function Scope(parent) { + this.names = {}; // names defined in this scope + this.mangled = {}; // mangled names (orig.name => mangled) + this.rev_mangled = {}; // reverse lookup (mangled => orig.name) + this.cname = -1; // current mangled name + this.refs = {}; // names referenced from this scope + this.uses_with = false; // will become TRUE if eval() is detected in this or any subscopes + this.uses_eval = false; // will become TRUE if with() is detected in this or any subscopes + this.parent = parent; // parent scope + this.children = []; // sub-scopes + if (parent) { + this.level = parent.level + 1; + parent.children.push(this); + } else { + this.level = 0; + } +}; + +var base54 = (function(){ + var DIGITS = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_"; + return function(num) { + var ret = ""; + do { + ret = DIGITS.charAt(num % 54) + ret; + num = Math.floor(num / 54); + } while (num > 0); + return ret; + }; +})(); + +Scope.prototype = { + has: function(name) { + for (var s = this; s; s = s.parent) + if (HOP(s.names, name)) + return s; + }, + has_mangled: function(mname) { + for (var s = this; s; s = s.parent) + if (HOP(s.rev_mangled, mname)) + return s; + }, + toJSON: function() { + return { + names: this.names, + uses_eval: this.uses_eval, + uses_with: this.uses_with + }; + }, + + next_mangled: function() { + // we must be careful that the new mangled name: + // + // 1. doesn't shadow a mangled name from a parent + // scope, unless we don't reference the original + // name from this scope OR from any sub-scopes! + // This will get slow. + // + // 2. doesn't shadow an original name from a parent + // scope, in the event that the name is not mangled + // in the parent scope and we reference that name + // here OR IN ANY SUBSCOPES! + // + // 3. doesn't shadow a name that is referenced but not + // defined (possibly global defined elsewhere). + for (;;) { + var m = base54(++this.cname), prior; + + // case 1. + prior = this.has_mangled(m); + if (prior && this.refs[prior.rev_mangled[m]] === prior) + continue; + + // case 2. + prior = this.has(m); + if (prior && prior !== this && this.refs[m] === prior && !prior.has_mangled(m)) + continue; + + // case 3. + if (HOP(this.refs, m) && this.refs[m] == null) + continue; + + // I got "do" once. :-/ + if (!is_identifier(m)) + continue; + + return m; + } + }, + get_mangled: function(name, newMangle) { + if (this.uses_eval || this.uses_with) return name; // no mangle if eval or with is in use + var s = this.has(name); + if (!s) return name; // not in visible scope, no mangle + if (HOP(s.mangled, name)) return s.mangled[name]; // already mangled in this scope + if (!newMangle) return name; // not found and no mangling requested + + var m = s.next_mangled(); + s.rev_mangled[m] = name; + return s.mangled[name] = m; + }, + define: function(name) { + if (name != null) + return this.names[name] = name; + } +}; + +function ast_add_scope(ast) { + + var current_scope = null; + var w = ast_walker(), walk = w.walk; + var having_eval = []; + + function with_new_scope(cont) { + current_scope = new Scope(current_scope); + var ret = current_scope.body = cont(); + ret.scope = current_scope; + current_scope = current_scope.parent; + return ret; + }; + + function define(name) { + return current_scope.define(name); + }; + + function reference(name) { + current_scope.refs[name] = true; + }; + + function _lambda(name, args, body) { + return [ this[0], define(name), args, with_new_scope(function(){ + MAP(args, define); + return MAP(body, walk); + })]; + }; + + return with_new_scope(function(){ + // process AST + var ret = w.with_walkers({ + "function": _lambda, + "defun": _lambda, + "with": function(expr, block) { + for (var s = current_scope; s; s = s.parent) + s.uses_with = true; + }, + "var": function(defs) { + MAP(defs, function(d){ define(d[0]) }); + }, + "const": function(defs) { + MAP(defs, function(d){ define(d[0]) }); + }, + "try": function(t, c, f) { + if (c != null) return [ + "try", + MAP(t, walk), + [ define(c[0]), MAP(c[1], walk) ], + f != null ? MAP(f, walk) : null + ]; + }, + "name": function(name) { + if (name == "eval") + having_eval.push(current_scope); + reference(name); + }, + "for-in": function(has_var, name) { + if (has_var) define(name); + else reference(name); + } + }, function(){ + return walk(ast); + }); + + // the reason why we need an additional pass here is + // that names can be used prior to their definition. + + // scopes where eval was detected and their parents + // are marked with uses_eval, unless they define the + // "eval" name. + MAP(having_eval, function(scope){ + if (!scope.has("eval")) while (scope) { + scope.uses_eval = true; + scope = scope.parent; + } + }); + + // for referenced names it might be useful to know + // their origin scope. current_scope here is the + // toplevel one. + function fixrefs(scope, i) { + // do children first; order shouldn't matter + for (i = scope.children.length; --i >= 0;) + fixrefs(scope.children[i]); + for (i in scope.refs) if (HOP(scope.refs, i)) { + // find origin scope and propagate the reference to origin + for (var origin = scope.has(i), s = scope; s; s = s.parent) { + s.refs[i] = origin; + if (s === origin) break; + } + } + }; + fixrefs(current_scope); + + return ret; + }); + +}; + +/* -----[ mangle names ]----- */ + +function ast_mangle(ast, do_toplevel) { + var w = ast_walker(), walk = w.walk, scope; + + function get_mangled(name, newMangle) { + if (!do_toplevel && !scope.parent) return name; // don't mangle toplevel + return scope.get_mangled(name, newMangle); + }; + + function _lambda(name, args, body) { + if (name) name = get_mangled(name); + body = with_scope(body.scope, function(){ + args = MAP(args, function(name){ return get_mangled(name) }); + return MAP(body, walk); + }); + return [ this[0], name, args, body ]; + }; + + function with_scope(s, cont) { + var _scope = scope; + scope = s; + for (var i in s.names) if (HOP(s.names, i)) { + get_mangled(i, true); + } + var ret = cont(); + ret.scope = s; + scope = _scope; + return ret; + }; + + function _vardefs(defs) { + return MAP(defs, function(d){ + return [ get_mangled(d[0]), walk(d[1]) ]; + }); + }; + + return w.with_walkers({ + "function": _lambda, + "defun": function() { + // move function declarations to the top when + // they are not in some block. + var ast = _lambda.apply(this, arguments); + switch (w.parent()[0]) { + case "toplevel": + case "function": + case "defun": + return MAP.at_top(ast); + } + return ast; + }, + "var": function(defs) { + return [ "var", _vardefs(defs) ]; + }, + "const": function(defs) { + return [ "const", _vardefs(defs) ]; + }, + "name": function(name) { + return [ "name", get_mangled(name) ]; + }, + "try": function(t, c, f) { + return [ "try", + MAP(t, walk), + c != null ? [ get_mangled(c[0]), MAP(c[1], walk) ] : null, + f != null ? MAP(f, walk) : null ]; + }, + "toplevel": function(body) { + return with_scope(this.scope, function(){ + return [ "toplevel", MAP(body, walk) ]; + }); + }, + "for-in": function(has_var, name, obj, stat) { + return [ "for-in", has_var, get_mangled(name), walk(obj), walk(stat) ]; + } + }, function() { + return walk(ast_add_scope(ast)); + }); +}; + +/* -----[ + - compress foo["bar"] into foo.bar, + - remove block brackets {} where possible + - join consecutive var declarations + - various optimizations for IFs: + - if (cond) foo(); else bar(); ==> cond?foo():bar(); + - if (cond) foo(); ==> cond&&foo(); + - if (foo) return bar(); else return baz(); ==> return foo?bar():baz(); // also for throw + - if (foo) return bar(); else something(); ==> {if(foo)return bar();something()} + ]----- */ + +var warn = function(){}; + +function best_of(ast1, ast2) { + return gen_code(ast1).length > gen_code(ast2[0] == "stat" ? ast2[1] : ast2).length ? ast2 : ast1; +}; + +function last_stat(b) { + if (b[0] == "block" && b[1] && b[1].length > 0) + return b[1][b[1].length - 1]; + return b; +} + +function aborts(t) { + if (t) { + t = last_stat(t); + if (t[0] == "return" || t[0] == "break" || t[0] == "continue" || t[0] == "throw") + return true; + } +}; + +function negate(c) { + var not_c = [ "unary-prefix", "!", c ]; + switch (c[0]) { + case "unary-prefix": + return c[1] == "!" ? c[2] : not_c; + case "binary": + var op = c[1], left = c[2], right = c[3]; + switch (op) { + case "<=": return [ "binary", ">", left, right ]; + case "<": return [ "binary", ">=", left, right ]; + case ">=": return [ "binary", "<", left, right ]; + case ">": return [ "binary", "<=", left, right ]; + case "==": return [ "binary", "!=", left, right ]; + case "!=": return [ "binary", "==", left, right ]; + case "===": return [ "binary", "!==", left, right ]; + case "!==": return [ "binary", "===", left, right ]; + case "&&": return best_of(not_c, [ "binary", "||", negate(left), negate(right) ]); + case "||": return best_of(not_c, [ "binary", "&&", negate(left), negate(right) ]); + } + break; + } + return not_c; +}; + +function make_conditional(c, t, e) { + if (c[0] == "unary-prefix" && c[1] == "!") { + return e ? [ "conditional", c[2], e, t ] : [ "binary", "||", c[2], t ]; + } else { + return e ? [ "conditional", c, t, e ] : [ "binary", "&&", c, t ]; + } +}; + +function empty(b) { + return !b || (b[0] == "block" && (!b[1] || b[1].length == 0)); +}; + +function ast_squeeze(ast, options) { + options = defaults(options, { + make_seqs : true, + dead_code : true, + no_warnings : false, + extra : false + }); + + var w = ast_walker(), walk = w.walk, scope; + + function with_scope(s, cont) { + var _scope = scope; + scope = s; + var ret = cont(); + ret.scope = s; + scope = _scope; + return ret; + }; + + function is_constant(node) { + return node[0] == "string" || node[0] == "num"; + }; + + function find_first_execute(node) { + if (!node) + return false; + + switch (node[0]) { + case "num": + case "string": + case "name": + return node; + case "call": + case "conditional": + case "for": + case "if": + case "new": + case "return": + case "stat": + case "switch": + case "throw": + return find_first_execute(node[1]); + case "binary": + return find_first_execute(node[2]); + case "assign": + if (node[1] === true) + return find_first_execute(node[3]); + break; + case "var": + if (node[1][0].length > 1) + return find_first_execute(node[1][0][1]); + break; + } + return null; + } + + function find_assign_recursive(p, v) { + if (p[0] == "assign" && p[1] != true || p[0] == "unary-prefix") { + if (p[2][0] == "name" && v[0] == "name" && p[2][1] == v[1]) + return true; + return false; + } + + if (p[0] != "assign" || p[1] !== true) + return false; + + if ((is_constant(p[3]) && p[3][0] == v[0] && p[3][1] == v[1]) || + (p[3][0] == "name" && v[0] == "name" && p[3][1] == v[1]) || + (p[2][0] == "name" && v[0] == "name" && p[2][1] == v[1])) + return true; + + return find_assign_recursive(p[3], v); + }; + + function rmblock(block) { + if (block != null && block[0] == "block" && block[1] && block[1].length == 1) + block = block[1][0]; + return block; + }; + + function clone(obj) { + if (obj && obj.constructor == Array) + return MAP(obj, clone); + return obj; + }; + + function make_seq_to_statements(node) { + if (node[0] != "seq") { + switch (node[0]) { + case "var": + case "const": + return [ node ]; + default: + return [ [ "stat", node ] ]; + } + } + + var ret = []; + for (var i = 1; i < node.length; i++) + ret.push.apply(ret, make_seq_to_statements(node[i])); + + return ret; + }; + + function _lambda(name, args, body) { + return [ this[0], name, args, with_scope(body.scope, function(){ + return tighten(MAP(body, walk), "lambda"); + }) ]; + }; + + // we get here for blocks that have been already transformed. + // this function does a few things: + // 1. discard useless blocks + // 2. join consecutive var declarations + // 3. remove obviously dead code + // 4. transform consecutive statements using the comma operator + // 5. if block_type == "lambda" and it detects constructs like if(foo) return ... - rewrite like if (!foo) { ... } + function tighten(statements, block_type) { + statements = statements.reduce(function(a, stat){ + if (stat[0] == "block") { + if (stat[1]) { + a.push.apply(a, stat[1]); + } + } else { + a.push(stat); + } + return a; + }, []); + + if (options.extra) { + // Detightening things. We do this because then we can assume that the + // statements are structured in a specific way. + statements = (function(a, prev) { + statements.forEach(function(cur) { + switch (cur[0]) { + case "for": + if (cur[1] != null) { + a.push.apply(a, make_seq_to_statements(cur[1])); + cur[1] = null; + } + a.push(cur); + break; + case "stat": + var stats = make_seq_to_statements(cur[1]); + stats.forEach(function(s) { + if (s[1][0] == "unary-postfix") + s[1][0] = "unary-prefix"; + }); + a.push.apply(a, stats); + break; + default: + a.push(cur); + } + }); + return a; + })([]); + + statements = (function(a, prev) { + statements.forEach(function(cur) { + if (!(prev && prev[0] == "stat")) { + a.push(cur); + prev = cur; + return; + } + + var p = prev[1]; + var c = find_first_execute(cur); + if (c && find_assign_recursive(p, c)) { + var old_cur = clone(cur); + c.splice(0, c.length); + c.push.apply(c, p); + var tmp_cur = best_of(cur, [ "toplevel", [ prev, old_cur ] ]); + if (tmp_cur == cur) { + a[a.length -1] = cur; + } else { + cur = old_cur; + a.push(cur); + } + } else { + a.push(cur); + } + prev = cur; + }); + return a; + })([]); + } + + statements = (function(a, prev){ + statements.forEach(function(cur){ + if (prev && ((cur[0] == "var" && prev[0] == "var") || + (cur[0] == "const" && prev[0] == "const"))) { + prev[1] = prev[1].concat(cur[1]); + } else { + a.push(cur); + prev = cur; + } + }); + return a; + })([]); + + if (options.dead_code) statements = (function(a, has_quit){ + statements.forEach(function(st){ + if (has_quit) { + if (member(st[0], [ "function", "defun" , "var", "const" ])) { + a.push(st); + } + else if (!options.no_warnings) + warn("Removing unreachable code: " + gen_code(st, true)); + } + else { + a.push(st); + if (member(st[0], [ "return", "throw", "break", "continue" ])) + has_quit = true; + } + }); + return a; + })([]); + + if (options.make_seqs) statements = (function(a, prev) { + statements.forEach(function(cur){ + if (prev && prev[0] == "stat" && cur[0] == "stat") { + prev[1] = [ "seq", prev[1], cur[1] ]; + } else { + a.push(cur); + prev = cur; + } + }); + return a; + })([]); + + if (options.extra) { + statements = (function(a, prev){ + statements.forEach(function(cur){ + var replaced = false; + if (prev && cur[0] == "for" && cur[1] == null && (prev[0] == "var" || prev[0] == "const" || prev[0] == "stat")) { + cur[1] = prev; + a[a.length - 1] = cur; + } else { + a.push(cur); + } + prev = cur; + }); + return a; + })([]); + } + + if (block_type == "lambda") statements = (function(i, a, stat){ + while (i < statements.length) { + stat = statements[i++]; + if (stat[0] == "if" && !stat[3]) { + if (stat[2][0] == "return" && stat[2][1] == null) { + a.push(make_if(negate(stat[1]), [ "block", statements.slice(i) ])); + break; + } + var last = last_stat(stat[2]); + if (last[0] == "return" && last[1] == null) { + a.push(make_if(stat[1], [ "block", stat[2][1].slice(0, -1) ], [ "block", statements.slice(i) ])); + break; + } + } + a.push(stat); + } + return a; + })(0, []); + + return statements; + }; + + function make_if(c, t, e) { + c = walk(c); + t = walk(t); + e = walk(e); + + if (empty(t)) { + c = negate(c); + t = e; + e = null; + } else if (empty(e)) { + e = null; + } else { + // if we have both else and then, maybe it makes sense to switch them? + (function(){ + var a = gen_code(c); + var n = negate(c); + var b = gen_code(n); + if (b.length < a.length) { + var tmp = t; + t = e; + e = tmp; + c = n; + } + })(); + } + if (empty(e) && empty(t)) + return [ "stat", c ]; + var ret = [ "if", c, t, e ]; + if (t[0] == "stat") { + if (e) { + if (e[0] == "stat") { + ret = best_of(ret, [ "stat", make_conditional(c, t[1], e[1]) ]); + } + } + else { + ret = best_of(ret, [ "stat", make_conditional(c, t[1]) ]); + } + } + else if (e && t[0] == e[0] && (t[0] == "return" || t[0] == "throw")) { + ret = best_of(ret, [ t[0], make_conditional(c, t[1], e[1] ) ]); + } + else if (e && aborts(t)) { + ret = [ [ "if", c, t ] ]; + if (e[0] == "block") { + if (e[1]) ret = ret.concat(e[1]); + } + else { + ret.push(e); + } + ret = walk([ "block", ret ]); + } + else if (t && aborts(e)) { + ret = [ [ "if", negate(c), e ] ]; + if (t[0] == "block") { + if (t[1]) ret = ret.concat(t[1]); + } else { + ret.push(t); + } + ret = walk([ "block", ret ]); + } + return ret; + }; + + return w.with_walkers({ + "sub": function(expr, subscript) { + if (subscript[0] == "string") { + var name = subscript[1]; + if (is_identifier(name)) { + return [ "dot", walk(expr), name ]; + } + } + }, + "if": make_if, + "toplevel": function(body) { + return [ "toplevel", with_scope(this.scope, function(){ + return tighten(MAP(body, walk)); + }) ]; + }, + "switch": function(expr, body) { + var last = body.length - 1; + return [ "switch", walk(expr), MAP(body, function(branch, i){ + var block = tighten(MAP(branch[1], walk)); + if (i == last && block.length > 0) { + var node = block[block.length - 1]; + if (node[0] == "break" && !node[1]) + block.pop(); + } + return [ branch[0] ? walk(branch[0]) : null, block ]; + }) ]; + }, + "function": _lambda, + "defun": _lambda, + "block": function(body) { + if (body) return rmblock([ "block", tighten(MAP(body, walk)) ]); + }, + "binary": function(op, left, right) { + left = walk(left); + right = walk(right); + var best = [ "binary", op, left, right ]; + if (is_constant(right)) { + if (is_constant(left)) { + var val = null; + switch (op) { + case "+": val = left[1] + right[1]; break; + case "*": val = left[1] * right[1]; break; + case "/": val = left[1] / right[1]; break; + case "-": val = left[1] - right[1]; break; + case "<<": val = left[1] << right[1]; break; + case ">>": val = left[1] >> right[1]; break; + case ">>>": val = left[1] >>> right[1]; break; + } + if (val != null) { + best = best_of(best, [ typeof val == "string" ? "string" : "num", val ]); + } + } else if (left[0] == "binary" && left[1] == "+" && left[3][0] == "string") { + best = best_of(best, [ "binary", "+", left[2], [ "string", left[3][1] + right[1] ] ]); + } + } + return best; + }, + "conditional": function(c, t, e) { + return make_conditional(walk(c), walk(t), walk(e)); + }, + "try": function(t, c, f) { + return [ + "try", + tighten(MAP(t, walk)), + c != null ? [ c[0], tighten(MAP(c[1], walk)) ] : null, + f != null ? tighten(MAP(f, walk)) : null + ]; + }, + "unary-prefix": function(op, cond) { + if (op == "!") { + cond = walk(cond); + if (cond[0] == "unary-prefix" && cond[1] == "!") { + var p = w.parent(); + if (p[0] == "unary-prefix" && p[1] == "!") + return cond[2]; + return [ "unary-prefix", "!", cond ]; + } + return best_of(this, negate(cond)); + } + }, + "name": function(name) { + switch (name) { + case "true": return [ "unary-prefix", "!", [ "num", 0 ]]; + case "false": return [ "unary-prefix", "!", [ "num", 1 ]]; + } + }, + "new": function(ctor, args) { + if (ctor[0] == "name" && ctor[1] == "Array" && !scope.has("Array")) { + if (args.length != 1) { + return [ "array", args ]; + } else { + return [ "call", [ "name", "Array" ], args ]; + } + } + }, + "call": function(expr, args) { + if (expr[0] == "name" && expr[1] == "Array" && args.length != 1 && !scope.has("Array")) { + return [ "array", args ]; + } + } + }, function() { + return walk(ast_add_scope(ast)); + }); +}; + +/* -----[ re-generate code from the AST ]----- */ + +var DOT_CALL_NO_PARENS = jsp.array_to_hash([ + "name", + "array", + "string", + "dot", + "sub", + "call", + "regexp" +]); + +function make_string(str) { + var dq = 0, sq = 0; + str = str.replace(/[\\\b\f\n\r\t\x22\x27]/g, function(s){ + switch (s) { + case "\\": return "\\\\"; + case "\b": return "\\b"; + case "\f": return "\\f"; + case "\n": return "\\n"; + case "\r": return "\\r"; + case "\t": return "\\t"; + case '"': ++dq; return '"'; + case "'": ++sq; return "'"; + } + return s; + }); + if (dq > sq) { + return "'" + str.replace(/\x27/g, "\\'") + "'"; + } else { + return '"' + str.replace(/\x22/g, '\\"') + '"'; + } +}; + +function gen_code(ast, beautify) { + if (beautify) beautify = defaults(beautify, { + indent_start : 0, + indent_level : 4, + quote_keys : false, + space_colon : false + }); + var indentation = 0, + newline = beautify ? "\n" : "", + space = beautify ? " " : ""; + + function indent(line) { + if (line == null) + line = ""; + if (beautify) + line = repeat_string(" ", beautify.indent_start + indentation * beautify.indent_level) + line; + return line; + }; + + function with_indent(cont, incr) { + if (incr == null) incr = 1; + indentation += incr; + try { return cont.apply(null, slice(arguments, 1)); } + finally { indentation -= incr; } + }; + + function add_spaces(a) { + if (beautify) + return a.join(" "); + var b = []; + for (var i = 0; i < a.length; ++i) { + var next = a[i + 1]; + b.push(a[i]); + if (next && + ((/[a-z0-9_\x24]$/i.test(a[i].toString()) && /^[a-z0-9_\x24]/i.test(next.toString())) || + (/[\+\-]$/.test(a[i].toString()) && /^[\+\-]/.test(next.toString())))) { + b.push(" "); + } + } + return b.join(""); + }; + + function add_commas(a) { + return a.join("," + space); + }; + + function parenthesize(expr) { + var gen = make(expr); + for (var i = 1; i < arguments.length; ++i) { + var el = arguments[i]; + if ((el instanceof Function && el(expr)) || expr[0] == el) + return "(" + gen + ")"; + } + return gen; + }; + + function best_of(a) { + if (a.length == 1) { + return a[0]; + } + if (a.length == 2) { + var b = a[1]; + a = a[0]; + return a.length <= b.length ? a : b; + } + return best_of([ a[0], best_of(a.slice(1)) ]); + }; + + function needs_parens(expr) { + if (expr[0] == "function") { + // dot/call on a literal function requires the + // function literal itself to be parenthesized + // only if it's the first "thing" in a + // statement. This means that the parent is + // "stat", but it could also be a "seq" and + // we're the first in this "seq" and the + // parent is "stat", and so on. Messy stuff, + // but it worths the trouble. + var a = slice($stack), self = a.pop(), p = a.pop(); + while (p) { + if (p[0] == "stat") return true; + if ((p[0] == "seq" && p[1] === self) || + (p[0] == "call" && p[1] === self) || + (p[0] == "binary" && p[2] === self)) { + self = p; + p = a.pop(); + } else { + return false; + } + } + } + return !HOP(DOT_CALL_NO_PARENS, expr[0]); + }; + + function make_num(num) { + var str = num.toString(10), a = [ str.replace(/^0\./, ".") ], m; + if (Math.floor(num) === num) { + a.push("0x" + num.toString(16).toLowerCase(), // probably pointless + "0" + num.toString(8)); // same. + if ((m = /^(.*?)(0+)$/.exec(num))) { + a.push(m[1] + "e" + m[2].length); + } + } else if ((m = /^0?\.(0+)(.*)$/.exec(num))) { + a.push(m[2] + "e-" + (m[1].length + m[2].length), + str.substr(str.indexOf("."))); + } + return best_of(a); + }; + + var generators = { + "string": make_string, + "num": make_num, + "name": make_name, + "toplevel": function(statements) { + return make_block_statements(statements) + .join(newline + newline); + }, + "block": make_block, + "var": function(defs) { + return "var " + add_commas(MAP(defs, make_1vardef)) + ";"; + }, + "const": function(defs) { + return "const " + add_commas(MAP(defs, make_1vardef)) + ";"; + }, + "try": function(tr, ca, fi) { + var out = [ "try", make_block(tr) ]; + if (ca) out.push("catch", "(" + ca[0] + ")", make_block(ca[1])); + if (fi) out.push("finally", make_block(fi)); + return add_spaces(out); + }, + "throw": function(expr) { + return add_spaces([ "throw", make(expr) ]) + ";"; + }, + "new": function(ctor, args) { + args = args.length > 0 ? "(" + add_commas(MAP(args, make)) + ")" : ""; + return add_spaces([ "new", parenthesize(ctor, "seq", "binary", "conditional", "assign", function(expr){ + var w = ast_walker(), has_call = {}; + try { + w.with_walkers({ + "call": function() { throw has_call }, + "function": function() { return this } + }, function(){ + w.walk(expr); + }); + } catch(ex) { + if (ex === has_call) + return true; + throw ex; + } + }) + args ]); + }, + "switch": function(expr, body) { + return add_spaces([ "switch", "(" + make(expr) + ")", make_switch_block(body) ]); + }, + "break": function(label) { + var out = "break"; + if (label != null) + out += " " + make_name(label); + return out + ";"; + }, + "continue": function(label) { + var out = "continue"; + if (label != null) + out += " " + make_name(label); + return out + ";"; + }, + "conditional": function(co, th, el) { + return add_spaces([ parenthesize(co, "assign", "seq", "conditional"), "?", + parenthesize(th, "seq"), ":", + parenthesize(el, "seq") ]); + }, + "assign": function(op, lvalue, rvalue) { + if (op && op !== true) op += "="; + else op = "="; + return add_spaces([ make(lvalue), op, parenthesize(rvalue, "seq") ]); + }, + "dot": function(expr) { + var out = make(expr), i = 1; + if (needs_parens(expr)) + out = "(" + out + ")"; + while (i < arguments.length) + out += "." + make_name(arguments[i++]); + return out; + }, + "call": function(func, args) { + var f = make(func); + if (needs_parens(func)) + f = "(" + f + ")"; + return f + "(" + add_commas(MAP(args, function(expr){ + return parenthesize(expr, "seq"); + })) + ")"; + }, + "function": make_function, + "defun": make_function, + "if": function(co, th, el) { + var out = [ "if", "(" + make(co) + ")", el ? make_then(th) : make(th) ]; + if (el) { + out.push("else", make(el)); + } + return add_spaces(out); + }, + "for": function(init, cond, step, block) { + var out = [ "for" ]; + init = (init != null ? make(init) : "").replace(/;*\s*$/, ";" + space); + cond = (cond != null ? make(cond) : "").replace(/;*\s*$/, ";" + space); + step = (step != null ? make(step) : "").replace(/;*\s*$/, ""); + var args = init + cond + step; + if (args == "; ; ") args = ";;"; + out.push("(" + args + ")", make(block)); + return add_spaces(out); + }, + "for-in": function(has_var, key, hash, block) { + var out = add_spaces([ "for", "(" ]); + if (has_var) + out += "var "; + out += add_spaces([ make_name(key) + " in " + make(hash) + ")", make(block) ]); + return out; + }, + "while": function(condition, block) { + return add_spaces([ "while", "(" + make(condition) + ")", make(block) ]); + }, + "do": function(condition, block) { + return add_spaces([ "do", make(block), "while", "(" + make(condition) + ")" ]) + ";"; + }, + "return": function(expr) { + var out = [ "return" ]; + if (expr != null) out.push(make(expr)); + return add_spaces(out) + ";"; + }, + "binary": function(operator, lvalue, rvalue) { + var left = make(lvalue), right = make(rvalue); + // XXX: I'm pretty sure other cases will bite here. + // we need to be smarter. + // adding parens all the time is the safest bet. + if (member(lvalue[0], [ "assign", "conditional", "seq" ]) || + lvalue[0] == "binary" && PRECEDENCE[operator] > PRECEDENCE[lvalue[1]]) { + left = "(" + left + ")"; + } + if (member(rvalue[0], [ "assign", "conditional", "seq" ]) || + rvalue[0] == "binary" && PRECEDENCE[operator] >= PRECEDENCE[rvalue[1]]) { + right = "(" + right + ")"; + } + return add_spaces([ left, operator, right ]); + }, + "unary-prefix": function(operator, expr) { + var val = make(expr); + if (!(expr[0] == "num" || (expr[0] == "unary-prefix" && !HOP(OPERATORS, operator + expr[1])) || !needs_parens(expr))) + val = "(" + val + ")"; + return operator + (jsp.is_alphanumeric_char(operator.charAt(0)) ? " " : "") + val; + }, + "unary-postfix": function(operator, expr) { + var val = make(expr); + if (!(expr[0] == "num" || (expr[0] == "unary-postfix" && !HOP(OPERATORS, operator + expr[1])) || !needs_parens(expr))) + val = "(" + val + ")"; + return val + operator; + }, + "sub": function(expr, subscript) { + var hash = make(expr); + if (needs_parens(expr)) + hash = "(" + hash + ")"; + return hash + "[" + make(subscript) + "]"; + }, + "object": function(props) { + if (props.length == 0) + return "{}"; + return "{" + newline + with_indent(function(){ + return MAP(props, function(p){ + if (p.length == 3) { + // getter/setter. The name is in p[0], the arg.list in p[1][2], the + // body in p[1][3] and type ("get" / "set") in p[2]. + return indent(make_function(p[0], p[1][2], p[1][3], p[2])); + } + var key = p[0], val = make(p[1]); + if (beautify && beautify.quote_keys) { + key = make_string(key); + } else if (typeof key == "number" || !beautify && +key + "" == key) { + key = make_num(+key); + } else if (!is_identifier(key)) { + key = make_string(key); + } + return indent(add_spaces(beautify && beautify.space_colon + ? [ key, ":", val ] + : [ key + ":", val ])); + }).join("," + newline); + }) + newline + indent("}"); + }, + "regexp": function(rx, mods) { + return "/" + rx + "/" + mods; + }, + "array": function(elements) { + if (elements.length == 0) return "[]"; + return add_spaces([ "[", add_commas(MAP(elements, function(el){ + return parenthesize(el, "seq"); + })), "]" ]); + }, + "stat": function(stmt) { + return make(stmt).replace(/;*\s*$/, ";"); + }, + "seq": function() { + return add_commas(MAP(slice(arguments), make)); + }, + "label": function(name, block) { + return add_spaces([ make_name(name), ":", make(block) ]); + }, + "with": function(expr, block) { + return add_spaces([ "with", "(" + make(expr) + ")", make(block) ]); + }, + "atom": function(name) { + return make_name(name); + }, + "comment1": function(text) { + return "//" + text + "\n"; + }, + "comment2": function(text) { + return "/*" + text + "*/"; + } + }; + + // The squeezer replaces "block"-s that contain only a single + // statement with the statement itself; technically, the AST + // is correct, but this can create problems when we output an + // IF having an ELSE clause where the THEN clause ends in an + // IF *without* an ELSE block (then the outer ELSE would refer + // to the inner IF). This function checks for this case and + // adds the block brackets if needed. + function make_then(th) { + if (th[0] == "do") { + // https://github.com/mishoo/UglifyJS/issues/#issue/57 + // IE croaks with "syntax error" on code like this: + // if (foo) do ... while(cond); else ... + // we need block brackets around do/while + return make([ "block", [ th ]]); + } + var b = th; + while (true) { + var type = b[0]; + if (type == "if") { + if (!b[3]) + // no else, we must add the block + return make([ "block", [ th ]]); + b = b[3]; + } + else if (type == "while" || type == "do") b = b[2]; + else if (type == "for" || type == "for-in") b = b[4]; + else break; + } + return make(th); + }; + + function make_function(name, args, body, keyword) { + var out = keyword || "function"; + if (name) { + out += " " + make_name(name); + } + out += "(" + add_commas(MAP(args, make_name)) + ")"; + return add_spaces([ out, make_block(body) ]); + }; + + function make_name(name) { + return name.toString(); + }; + + function make_block_statements(statements) { + for (var a = [], last = statements.length - 1, i = 0; i <= last; ++i) { + var stat = statements[i]; + var code = make(stat); + if (code != ";") { + if (!beautify && i == last) + code = code.replace(/;+\s*$/, ""); + a.push(code); + } + } + return MAP(a, indent); + }; + + function make_switch_block(body) { + var n = body.length; + if (n == 0) return "{}"; + return "{" + newline + MAP(body, function(branch, i){ + var has_body = branch[1].length > 0, code = with_indent(function(){ + return indent(branch[0] + ? add_spaces([ "case", make(branch[0]) + ":" ]) + : "default:"); + }, 0.5) + (has_body ? newline + with_indent(function(){ + return make_block_statements(branch[1]).join(newline); + }) : ""); + if (!beautify && has_body && i < n - 1) + code += ";"; + return code; + }).join(newline) + newline + indent("}"); + }; + + function make_block(statements) { + if (!statements) return ";"; + if (statements.length == 0) return "{}"; + return "{" + newline + with_indent(function(){ + return make_block_statements(statements).join(newline); + }) + newline + indent("}"); + }; + + function make_1vardef(def) { + var name = def[0], val = def[1]; + if (val != null) + name = add_spaces([ name, "=", make(val) ]); + return name; + }; + + var $stack = []; + + function make(node) { + var type = node[0]; + var gen = generators[type]; + if (!gen) + throw new Error("Can't find generator for \"" + type + "\""); + $stack.push(node); + var ret = gen.apply(type, node.slice(1)); + $stack.pop(); + return ret; + }; + + return make(ast); +}; + +/* -----[ Utilities ]----- */ + +function repeat_string(str, i) { + if (i <= 0) return ""; + if (i == 1) return str; + var d = repeat_string(str, i >> 1); + d += d; + if (i & 1) d += str; + return d; +}; + +function defaults(args, defs) { + var ret = {}; + if (args === true) + args = {}; + for (var i in defs) if (HOP(defs, i)) { + ret[i] = (args && HOP(args, i)) ? args[i] : defs[i]; + } + return ret; +}; + +function is_identifier(name) { + return /^[a-z_$][a-z0-9_$]*$/i.test(name) + && name != "this" + && !HOP(jsp.KEYWORDS_ATOM, name) + && !HOP(jsp.RESERVED_WORDS, name) + && !HOP(jsp.KEYWORDS, name); +}; + +function HOP(obj, prop) { + return Object.prototype.hasOwnProperty.call(obj, prop); +}; + +// some utilities + +var MAP; + +(function(){ + MAP = function(a, f, o) { + var ret = []; + for (var i = 0; i < a.length; ++i) { + var val = f.call(o, a[i], i); + if (val instanceof AtTop) ret.unshift(val.v); + else ret.push(val); + } + return ret; + }; + MAP.at_top = function(val) { return new AtTop(val) }; + function AtTop(val) { this.v = val }; +})(); + +/* -----[ Exports ]----- */ + +exports.ast_walker = ast_walker; +exports.ast_mangle = ast_mangle; +exports.ast_squeeze = ast_squeeze; +exports.gen_code = gen_code; +exports.ast_add_scope = ast_add_scope; +exports.ast_squeeze_more = require("./squeeze-more").ast_squeeze_more; +exports.set_logger = function(logger) { warn = logger }; diff --git a/Source/WebCore/inspector/front-end/WebKit.qrc b/Source/WebCore/inspector/front-end/WebKit.qrc index 80a6533..edc1861 100644 --- a/Source/WebCore/inspector/front-end/WebKit.qrc +++ b/Source/WebCore/inspector/front-end/WebKit.qrc @@ -23,6 +23,7 @@ <file>CookieParser.js</file> <file>CookiesTable.js</file> <file>CSSCompletions.js</file> + <file>CSSKeywordCompletions.js</file> <file>CSSStyleModel.js</file> <file>Database.js</file> <file>DatabaseQueryView.js</file> @@ -51,7 +52,6 @@ <file>HelpScreen.js</file> <file>ImageView.js</file> <file>InjectedFakeWorker.js</file> - <file>InjectedScriptAccess.js</file> <file>inspector.js</file> <file>InspectorFrontendHostStub.js</file> <file>KeyboardShortcut.js</file> @@ -81,6 +81,8 @@ <file>ResourcesPanel.js</file> <file>ScopeChainSidebarPane.js</file> <file>Script.js</file> + <file>ScriptFormatter.js</file> + <file>ScriptFormatterWorker.js</file> <file>ScriptsPanel.js</file> <file>ScriptView.js</file> <file>Section.js</file> @@ -114,6 +116,8 @@ <file>WatchExpressionsSidebarPane.js</file> <file>WelcomeView.js</file> <file>WorkersSidebarPane.js</file> + <file>UglifyJS/parse-js.js</file> + <file>UglifyJS/process.js</file> <file>audits.css</file> <file>goToLineDialog.css</file> <file>heapProfiler.css</file> diff --git a/Source/WebCore/inspector/front-end/inspector.css b/Source/WebCore/inspector/front-end/inspector.css index c908427..f629d12 100644 --- a/Source/WebCore/inspector/front-end/inspector.css +++ b/Source/WebCore/inspector/front-end/inspector.css @@ -778,8 +778,8 @@ body.platform-linux .monospace, body.platform-linux .source-code { color: red; } -.auto-complete-text { - color: rgb(128, 128, 128); +.auto-complete-text, .editing .auto-complete-text { + color: rgb(128, 128, 128) !important; -webkit-user-select: none; -webkit-user-modify: read-only; } diff --git a/Source/WebCore/inspector/front-end/inspector.html b/Source/WebCore/inspector/front-end/inspector.html index 44f096f..0e0b9e9 100644 --- a/Source/WebCore/inspector/front-end/inspector.html +++ b/Source/WebCore/inspector/front-end/inspector.html @@ -92,6 +92,7 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. <script type="text/javascript" src="EventListenersSidebarPane.js"></script> <script type="text/javascript" src="Color.js"></script> <script type="text/javascript" src="CSSCompletions.js"></script> + <script type="text/javascript" src="CSSKeywordCompletions.js"></script> <script type="text/javascript" src="StylesSidebarPane.js"></script> <script type="text/javascript" src="PanelEnablerView.js"></script> <script type="text/javascript" src="WelcomeView.js"></script> @@ -121,6 +122,7 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. <script type="text/javascript" src="NetworkItemView.js"></script> <script type="text/javascript" src="ResourceView.js"></script> <script type="text/javascript" src="SourceFrame.js"></script> + <script type="text/javascript" src="ScriptFormatter.js"></script> <script type="text/javascript" src="DOMSyntaxHighlighter.js"></script> <script type="text/javascript" src="TextEditorModel.js"></script> <script type="text/javascript" src="TextEditorHighlighter.js"></script> @@ -142,7 +144,6 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. <script type="text/javascript" src="HeapSnapshotView.js"></script> <script type="text/javascript" src="DebuggerModel.js"></script> <script type="text/javascript" src="DOMAgent.js"></script> - <script type="text/javascript" src="InjectedScriptAccess.js"></script> <script type="text/javascript" src="TimelineAgent.js"></script> <script type="text/javascript" src="TimelinePanel.js"></script> <script type="text/javascript" src="TimelineOverviewPane.js"></script> diff --git a/Source/WebCore/inspector/front-end/inspector.js b/Source/WebCore/inspector/front-end/inspector.js index d8a93b1..77abe78 100644 --- a/Source/WebCore/inspector/front-end/inspector.js +++ b/Source/WebCore/inspector/front-end/inspector.js @@ -185,20 +185,9 @@ var WebInspector = { } }, - createJSBreakpointsSidebarPane: function() - { - var pane = new WebInspector.BreakpointsSidebarPane(WebInspector.UIString("Breakpoints")); - function breakpointAdded(event) - { - pane.addBreakpointItem(new WebInspector.BreakpointItem(event.data)); - } - WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.BreakpointAdded, breakpointAdded); - return pane; - }, - createDOMBreakpointsSidebarPane: function() { - var pane = new WebInspector.BreakpointsSidebarPane(WebInspector.UIString("DOM Breakpoints")); + var pane = new WebInspector.NativeBreakpointsSidebarPane(WebInspector.UIString("DOM Breakpoints")); function breakpointAdded(event) { pane.addBreakpointItem(new WebInspector.BreakpointItem(event.data)); @@ -534,7 +523,7 @@ WebInspector.doLoadedDone = function() scripts: new WebInspector.ResourceCategory("scripts", WebInspector.UIString("Scripts"), "rgb(255,121,0)"), xhr: new WebInspector.ResourceCategory("xhr", WebInspector.UIString("XHR"), "rgb(231,231,10)"), fonts: new WebInspector.ResourceCategory("fonts", WebInspector.UIString("Fonts"), "rgb(255,82,62)"), - websockets: new WebInspector.ResourceCategory("websockets", WebInspector.UIString("WebSocket"), "rgb(186,186,186)"), // FIXME: Decide the color. + websockets: new WebInspector.ResourceCategory("websockets", WebInspector.UIString("WebSockets"), "rgb(186,186,186)"), // FIXME: Decide the color. other: new WebInspector.ResourceCategory("other", WebInspector.UIString("Other"), "rgb(186,186,186)") }; @@ -601,14 +590,6 @@ WebInspector.doLoadedDone = function() this.extensionServer.initExtensions(); - function populateInspectorState(inspectorState) - { - WebInspector.monitoringXHREnabled = inspectorState.monitoringXHREnabled; - if ("pauseOnExceptionsState" in inspectorState) - WebInspector.panels.scripts.updatePauseOnExceptionsState(inspectorState.pauseOnExceptionsState); - } - InspectorBackend.getInspectorState(populateInspectorState); - function onPopulateScriptObjects() { if (!WebInspector.currentPanel) diff --git a/Source/WebCore/inspector/front-end/utilities.js b/Source/WebCore/inspector/front-end/utilities.js index 4320ba8..5ed9a8c 100644 --- a/Source/WebCore/inspector/front-end/utilities.js +++ b/Source/WebCore/inspector/front-end/utilities.js @@ -745,6 +745,22 @@ Object.defineProperty(Array.prototype, "keySet", { value: function() return keys; }}); +Object.defineProperty(Array.prototype, "upperBound", { value: function(value) +{ + var first = 0; + var count = this.length; + while (count > 0) { + var step = count >> 1; + var middle = first + step; + if (value >= this[middle]) { + first = middle + 1; + count -= step + 1; + } else + count = step; + } + return first; +}}); + Array.diff = function(left, right) { var o = left; diff --git a/Source/WebCore/loader/CrossOriginPreflightResultCache.h b/Source/WebCore/loader/CrossOriginPreflightResultCache.h index 1016aed..ddd5070 100644 --- a/Source/WebCore/loader/CrossOriginPreflightResultCache.h +++ b/Source/WebCore/loader/CrossOriginPreflightResultCache.h @@ -38,7 +38,8 @@ namespace WebCore { class HTTPHeaderMap; class ResourceResponse; - class CrossOriginPreflightResultCacheItem : public Noncopyable { + class CrossOriginPreflightResultCacheItem { + WTF_MAKE_NONCOPYABLE(CrossOriginPreflightResultCacheItem); WTF_MAKE_FAST_ALLOCATED; public: CrossOriginPreflightResultCacheItem(bool credentials) : m_absoluteExpiryTime(0) @@ -63,7 +64,8 @@ namespace WebCore { HeadersSet m_headers; }; - class CrossOriginPreflightResultCache : public Noncopyable { + class CrossOriginPreflightResultCache { + WTF_MAKE_NONCOPYABLE(CrossOriginPreflightResultCache); WTF_MAKE_FAST_ALLOCATED; public: static CrossOriginPreflightResultCache& shared(); diff --git a/Source/WebCore/loader/DocumentThreadableLoader.h b/Source/WebCore/loader/DocumentThreadableLoader.h index ebf3a25..3a3cc64 100644 --- a/Source/WebCore/loader/DocumentThreadableLoader.h +++ b/Source/WebCore/loader/DocumentThreadableLoader.h @@ -47,6 +47,7 @@ namespace WebCore { class ThreadableLoaderClient; class DocumentThreadableLoader : public RefCounted<DocumentThreadableLoader>, public ThreadableLoader, private SubresourceLoaderClient { + WTF_MAKE_FAST_ALLOCATED; public: static void loadResourceSynchronously(Document*, const ResourceRequest&, ThreadableLoaderClient&, const ThreadableLoaderOptions&); static PassRefPtr<DocumentThreadableLoader> create(Document*, ThreadableLoaderClient*, const ResourceRequest&, const ThreadableLoaderOptions&); diff --git a/Source/WebCore/loader/DocumentWriter.h b/Source/WebCore/loader/DocumentWriter.h index 5fb3dc1..fb93606 100644 --- a/Source/WebCore/loader/DocumentWriter.h +++ b/Source/WebCore/loader/DocumentWriter.h @@ -39,7 +39,8 @@ class Frame; class SecurityOrigin; class TextResourceDecoder; -class DocumentWriter : public Noncopyable { +class DocumentWriter { + WTF_MAKE_NONCOPYABLE(DocumentWriter); public: DocumentWriter(Frame*); diff --git a/Source/WebCore/loader/EmptyClients.h b/Source/WebCore/loader/EmptyClients.h index e04d22d..d0a4350 100644 --- a/Source/WebCore/loader/EmptyClients.h +++ b/Source/WebCore/loader/EmptyClients.h @@ -161,6 +161,9 @@ public: #if ENABLE(TILED_BACKING_STORE) virtual void delegatedScrollRequested(const IntSize&) { } #endif +#if ENABLE(REQUEST_ANIMATION_FRAME) + virtual void scheduleAnimation() { } +#endif virtual IntPoint screenToWindow(const IntPoint& p) const { return p; } virtual IntRect windowToScreen(const IntRect& r) const { return r; } @@ -218,8 +221,10 @@ public: #endif }; -class EmptyFrameLoaderClient : public FrameLoaderClient, public Noncopyable { +class EmptyFrameLoaderClient : public FrameLoaderClient { + WTF_MAKE_NONCOPYABLE(EmptyFrameLoaderClient); WTF_MAKE_FAST_ALLOCATED; public: + EmptyFrameLoaderClient() { } virtual ~EmptyFrameLoaderClient() { } virtual void frameLoaderDestroyed() { } @@ -395,8 +400,10 @@ public: virtual PassRefPtr<FrameNetworkingContext> createNetworkingContext() { return PassRefPtr<FrameNetworkingContext>(); } }; -class EmptyEditorClient : public EditorClient, public Noncopyable { +class EmptyEditorClient : public EditorClient { + WTF_MAKE_NONCOPYABLE(EmptyEditorClient); WTF_MAKE_FAST_ALLOCATED; public: + EmptyEditorClient() { } virtual ~EmptyEditorClient() { } virtual void pageDestroyed() { } @@ -509,8 +516,10 @@ public: }; #if ENABLE(CONTEXT_MENUS) -class EmptyContextMenuClient : public ContextMenuClient, public Noncopyable { +class EmptyContextMenuClient : public ContextMenuClient { + WTF_MAKE_NONCOPYABLE(EmptyContextMenuClient); WTF_MAKE_FAST_ALLOCATED; public: + EmptyContextMenuClient() { } virtual ~EmptyContextMenuClient() { } virtual void contextMenuDestroyed() { } @@ -536,8 +545,10 @@ public: #endif // ENABLE(CONTEXT_MENUS) #if ENABLE(DRAG_SUPPORT) -class EmptyDragClient : public DragClient, public Noncopyable { +class EmptyDragClient : public DragClient { + WTF_MAKE_NONCOPYABLE(EmptyDragClient); WTF_MAKE_FAST_ALLOCATED; public: + EmptyDragClient() { } virtual ~EmptyDragClient() {} virtual void willPerformDragDestinationAction(DragDestinationAction, DragData*) { } virtual void willPerformDragSourceAction(DragSourceAction, const IntPoint&, Clipboard*) { } @@ -549,8 +560,10 @@ public: }; #endif // ENABLE(DRAG_SUPPORT) -class EmptyInspectorClient : public InspectorClient, public Noncopyable { +class EmptyInspectorClient : public InspectorClient { + WTF_MAKE_NONCOPYABLE(EmptyInspectorClient); WTF_MAKE_FAST_ALLOCATED; public: + EmptyInspectorClient() { } virtual ~EmptyInspectorClient() { } virtual void inspectorDestroyed() { } diff --git a/Source/WebCore/loader/FormSubmission.h b/Source/WebCore/loader/FormSubmission.h index d724835..7f58f91 100644 --- a/Source/WebCore/loader/FormSubmission.h +++ b/Source/WebCore/loader/FormSubmission.h @@ -47,7 +47,8 @@ class FormSubmission : public RefCounted<FormSubmission> { public: enum Method { GetMethod, PostMethod }; - class Attributes : public Noncopyable { + class Attributes { + WTF_MAKE_NONCOPYABLE(Attributes); public: Attributes() : m_method(GetMethod) diff --git a/Source/WebCore/loader/FrameLoader.cpp b/Source/WebCore/loader/FrameLoader.cpp index 9c6257b..3a19791 100644 --- a/Source/WebCore/loader/FrameLoader.cpp +++ b/Source/WebCore/loader/FrameLoader.cpp @@ -101,10 +101,6 @@ #include <wtf/text/CString.h> #include <wtf/text/StringConcatenate.h> -#if ENABLE(PLUGIN_PROXY_FOR_VIDEO) -#include "HTMLMediaElement.h" -#endif - #if ENABLE(SHARED_WORKERS) #include "SharedWorkerRepository.h" #endif @@ -1003,6 +999,18 @@ ObjectContentType FrameLoader::defaultObjectContentType(const KURL& url, const S return WebCore::ObjectContentNone; } +#if ENABLE(PLUGIN_PROXY_FOR_VIDEO) +void FrameLoader::hideMediaPlayerProxyPlugin(Widget* widget) +{ + m_client->hideMediaPlayerProxyPlugin(widget); +} + +void FrameLoader::showMediaPlayerProxyPlugin(Widget* widget) +{ + m_client->showMediaPlayerProxyPlugin(widget); +} +#endif // ENABLE(PLUGIN_PROXY_FOR_VIDEO) + String FrameLoader::outgoingReferrer() const { return m_outgoingReferrer; @@ -1692,13 +1700,13 @@ bool FrameLoader::shouldAllowNavigation(Frame* targetFrame) const return false; } -void FrameLoader::stopLoadingSubframes() +void FrameLoader::stopLoadingSubframes(DatabasePolicy databasePolicy, ClearProvisionalItemPolicy clearProvisionalItemPolicy) { for (RefPtr<Frame> child = m_frame->tree()->firstChild(); child; child = child->tree()->nextSibling()) - child->loader()->stopAllLoaders(); + child->loader()->stopAllLoaders(databasePolicy, clearProvisionalItemPolicy); } -void FrameLoader::stopAllLoaders(DatabasePolicy databasePolicy) +void FrameLoader::stopAllLoaders(DatabasePolicy databasePolicy, ClearProvisionalItemPolicy clearProvisionalItemPolicy) { ASSERT(!m_frame->document() || !m_frame->document()->inPageCache()); if (m_pageDismissalEventBeingDispatched) @@ -1712,7 +1720,12 @@ void FrameLoader::stopAllLoaders(DatabasePolicy databasePolicy) policyChecker()->stopCheck(); - stopLoadingSubframes(); + // If no new load is in progress, we should clear the provisional item from history + // before we call stopLoading. + if (clearProvisionalItemPolicy == ShouldClearProvisionalItem) + history()->setProvisionalItem(0); + + stopLoadingSubframes(databasePolicy, clearProvisionalItemPolicy); if (m_provisionalDocumentLoader) m_provisionalDocumentLoader->stopLoading(databasePolicy); if (m_documentLoader) @@ -2370,7 +2383,8 @@ void FrameLoader::checkLoadCompleteForThisFrame() // Reset the back forward list to the last committed history item at the top level. item = page->mainFrame()->loader()->history()->currentItem(); - bool shouldReset = true; + // Only reset if we aren't already going to a new provisional item. + bool shouldReset = !history()->provisionalItem(); if (!(pdl->isLoadingInAPISense() && !pdl->isStopping())) { m_delegateIsHandlingProvisionalLoadError = true; m_client->dispatchDidFailProvisionalLoad(error); @@ -2379,7 +2393,7 @@ void FrameLoader::checkLoadCompleteForThisFrame() // FIXME: can stopping loading here possibly have any effect, if isLoading is false, // which it must be to be in this branch of the if? And is it OK to just do a full-on // stopAllLoaders instead of stopLoadingSubframes? - stopLoadingSubframes(); + stopLoadingSubframes(DatabasePolicyStop, ShouldNotClearProvisionalItem); pdl->stopLoading(); // If we're in the middle of loading multipart data, we need to restore the document loader. @@ -2987,7 +3001,8 @@ void FrameLoader::continueLoadAfterNavigationPolicy(const ResourceRequest&, Pass } FrameLoadType type = policyChecker()->loadType(); - stopAllLoaders(); + // A new navigation is in progress, so don't clear the history's provisional item. + stopAllLoaders(DatabasePolicyStop, ShouldNotClearProvisionalItem); // <rdar://problem/6250856> - In certain circumstances on pages with multiple frames, stopAllLoaders() // might detach the current FrameLoader, in which case we should bail on this newly defunct load. diff --git a/Source/WebCore/loader/FrameLoader.h b/Source/WebCore/loader/FrameLoader.h index 12afbdd..b9eac9d 100644 --- a/Source/WebCore/loader/FrameLoader.h +++ b/Source/WebCore/loader/FrameLoader.h @@ -86,7 +86,8 @@ struct WindowFeatures; bool isBackForwardLoadType(FrameLoadType); -class FrameLoader : public Noncopyable { +class FrameLoader { + WTF_MAKE_NONCOPYABLE(FrameLoader); public: FrameLoader(Frame*, FrameLoaderClient*); ~FrameLoader(); @@ -129,7 +130,7 @@ public: bool canHandleRequest(const ResourceRequest&); // Also not cool. - void stopAllLoaders(DatabasePolicy = DatabasePolicyStop); + void stopAllLoaders(DatabasePolicy = DatabasePolicyStop, ClearProvisionalItemPolicy = ShouldClearProvisionalItem); void stopForUserCancel(bool deferCheckLoadComplete = false); bool isLoadingMainResource() const { return m_isLoadingMainResource; } @@ -306,6 +307,11 @@ public: void open(CachedFrameBase&); +#if ENABLE(PLUGIN_PROXY_FOR_VIDEO) + void hideMediaPlayerProxyPlugin(Widget*); + void showMediaPlayerProxyPlugin(Widget*); +#endif + // FIXME: Should these really be public? void completed(); bool allAncestorsAreComplete() const; // including this @@ -351,7 +357,7 @@ private: void addExtraFieldsToRequest(ResourceRequest&, FrameLoadType loadType, bool isMainResource, bool cookiePolicyURLFromRequest); // Also not cool. - void stopLoadingSubframes(); + void stopLoadingSubframes(DatabasePolicy, ClearProvisionalItemPolicy); void clearProvisionalLoad(); void markLoadComplete(); diff --git a/Source/WebCore/loader/FrameLoaderStateMachine.h b/Source/WebCore/loader/FrameLoaderStateMachine.h index c3408c2..fe37ece 100644 --- a/Source/WebCore/loader/FrameLoaderStateMachine.h +++ b/Source/WebCore/loader/FrameLoaderStateMachine.h @@ -35,7 +35,8 @@ namespace WebCore { // Encapsulates a state machine for FrameLoader. Note that this is different from FrameState, // which stores the state of the current load that FrameLoader is executing. -class FrameLoaderStateMachine : public Noncopyable { +class FrameLoaderStateMachine { + WTF_MAKE_NONCOPYABLE(FrameLoaderStateMachine); public: FrameLoaderStateMachine(); diff --git a/Source/WebCore/loader/FrameLoaderTypes.h b/Source/WebCore/loader/FrameLoaderTypes.h index 016de19..9f63c44 100644 --- a/Source/WebCore/loader/FrameLoaderTypes.h +++ b/Source/WebCore/loader/FrameLoaderTypes.h @@ -73,6 +73,11 @@ namespace WebCore { DatabasePolicyStop, // The database thread should be stopped and database connections closed. DatabasePolicyContinue }; + + enum ClearProvisionalItemPolicy { + ShouldClearProvisionalItem, + ShouldNotClearProvisionalItem + }; enum ObjectContentType { ObjectContentNone, diff --git a/Source/WebCore/loader/HistoryController.cpp b/Source/WebCore/loader/HistoryController.cpp index dda4e56..7c0fc97 100644 --- a/Source/WebCore/loader/HistoryController.cpp +++ b/Source/WebCore/loader/HistoryController.cpp @@ -260,6 +260,10 @@ void HistoryController::updateForBackForwardNavigation() // Must grab the current scroll position before disturbing it if (!m_frameLoadComplete) saveScrollPositionAndViewStateToItem(m_previousItem.get()); + + // When traversing history, we may end up redirecting to a different URL + // this time (e.g., due to cookies). See http://webkit.org/b/49654. + updateCurrentItem(); } void HistoryController::updateForReload() @@ -274,11 +278,11 @@ void HistoryController::updateForReload() if (m_frame->loader()->loadType() == FrameLoadTypeReload || m_frame->loader()->loadType() == FrameLoadTypeReloadFromOrigin) saveScrollPositionAndViewStateToItem(m_currentItem.get()); - - // Sometimes loading a page again leads to a different result because of cookies. Bugzilla 4072 - if (m_frame->loader()->documentLoader()->unreachableURL().isEmpty()) - m_currentItem->setURL(m_frame->loader()->documentLoader()->requestURL()); } + + // When reloading the page, we may end up redirecting to a different URL + // this time (e.g., due to cookies). See http://webkit.org/b/4072. + updateCurrentItem(); } // There are 3 things you might think of as "history", all of which are handled by these functions. @@ -310,9 +314,9 @@ void HistoryController::updateForStandardLoad(HistoryUpdateType updateType) if (Page* page = m_frame->page()) page->setGlobalHistoryItem(needPrivacy ? 0 : page->backForward()->currentItem()); } - } else if (frameLoader->documentLoader()->unreachableURL().isEmpty() && m_currentItem) { - m_currentItem->setURL(frameLoader->documentLoader()->url()); - m_currentItem->setFormInfoFromRequest(frameLoader->documentLoader()->request()); + } else { + // The client redirect replaces the current history item. + updateCurrentItem(); } if (!historyURL.isEmpty() && !needPrivacy) { @@ -349,14 +353,12 @@ void HistoryController::updateForRedirectWithLockedBackForwardList() page->setGlobalHistoryItem(needPrivacy ? 0 : page->backForward()->currentItem()); } } - if (m_currentItem) { - m_currentItem->setURL(m_frame->loader()->documentLoader()->url()); - m_currentItem->setFormInfoFromRequest(m_frame->loader()->documentLoader()->request()); - } + // The client redirect replaces the current history item. + updateCurrentItem(); } else { Frame* parentFrame = m_frame->tree()->parent(); if (parentFrame && parentFrame->loader()->history()->m_currentItem) - parentFrame->loader()->history()->m_currentItem->setChildItem(createItem(true)); + parentFrame->loader()->history()->m_currentItem->setChildItem(createItem()); } if (!historyURL.isEmpty() && !needPrivacy) { @@ -506,12 +508,13 @@ void HistoryController::setProvisionalItem(HistoryItem* item) m_provisionalItem = item; } -PassRefPtr<HistoryItem> HistoryController::createItem(bool useOriginal) +void HistoryController::initializeItem(HistoryItem* item) { DocumentLoader* documentLoader = m_frame->loader()->documentLoader(); - - KURL unreachableURL = documentLoader ? documentLoader->unreachableURL() : KURL(); - + ASSERT(documentLoader); + + KURL unreachableURL = documentLoader->unreachableURL(); + KURL url; KURL originalURL; @@ -519,15 +522,10 @@ PassRefPtr<HistoryItem> HistoryController::createItem(bool useOriginal) url = unreachableURL; originalURL = unreachableURL; } else { - originalURL = documentLoader ? documentLoader->originalURL() : KURL(); - if (useOriginal) - url = originalURL; - else if (documentLoader) - url = documentLoader->requestURL(); + url = documentLoader->url(); + originalURL = documentLoader->originalURL(); } - LOG(History, "WebCoreHistory: Creating item for %s", url.string().ascii().data()); - // Frames that have never successfully loaded any content // may have no URL at all. Currently our history code can't // deal with such things, so we nip that in the bud here. @@ -540,21 +538,25 @@ PassRefPtr<HistoryItem> HistoryController::createItem(bool useOriginal) Frame* parentFrame = m_frame->tree()->parent(); String parent = parentFrame ? parentFrame->tree()->uniqueName() : ""; - String title = documentLoader ? documentLoader->title() : ""; + String title = documentLoader->title(); - RefPtr<HistoryItem> item = HistoryItem::create(url, m_frame->tree()->uniqueName(), parent, title); + item->setURL(url); + item->setTarget(m_frame->tree()->uniqueName()); + item->setParent(parent); + item->setTitle(title); item->setOriginalURLString(originalURL.string()); - if (!unreachableURL.isEmpty() || !documentLoader || documentLoader->response().httpStatusCode() >= 400) + if (!unreachableURL.isEmpty() || documentLoader->response().httpStatusCode() >= 400) item->setLastVisitWasFailure(true); // Save form state if this is a POST - if (documentLoader) { - if (useOriginal) - item->setFormInfoFromRequest(documentLoader->originalRequest()); - else - item->setFormInfoFromRequest(documentLoader->request()); - } + item->setFormInfoFromRequest(documentLoader->request()); +} + +PassRefPtr<HistoryItem> HistoryController::createItem() +{ + RefPtr<HistoryItem> item = HistoryItem::create(); + initializeItem(item.get()); // Set the item for which we will save document state m_frameLoadComplete = false; @@ -566,7 +568,7 @@ PassRefPtr<HistoryItem> HistoryController::createItem(bool useOriginal) PassRefPtr<HistoryItem> HistoryController::createItemTree(Frame* targetFrame, bool clipAtTarget) { - RefPtr<HistoryItem> bfItem = createItem(m_frame->tree()->parent() ? true : false); + RefPtr<HistoryItem> bfItem = createItem(); if (!m_frameLoadComplete) saveScrollPositionAndViewStateToItem(m_previousItem.get()); @@ -656,6 +658,14 @@ void HistoryController::recursiveGoToItem(HistoryItem* item, HistoryItem* fromIt bool HistoryController::itemsAreClones(HistoryItem* item1, HistoryItem* item2) const { + // It appears that one of the items can be null in release builds, leading + // to the crashes seen in http://webkit.org/b/52819. For now, try to + // narrow it down with a more specific crash. + if (!item1) + CRASH(); + if (!item2) + CRASH(); + // If the item we're going to is a clone of the item we're at, then we do // not need to load it again. The current frame tree and the frame tree // snapshot in the item have to match. @@ -713,6 +723,31 @@ void HistoryController::updateBackForwardListClippedAtTarget(bool doClip) page->backForward()->addItem(topItem.release()); } +void HistoryController::updateCurrentItem() +{ + if (!m_currentItem) + return; + + DocumentLoader* documentLoader = m_frame->loader()->documentLoader(); + + if (!documentLoader->unreachableURL().isEmpty()) + return; + + if (m_currentItem->url() != documentLoader->url()) { + // We ended up on a completely different URL this time, so the HistoryItem + // needs to be re-initialized. Preserve the isTargetItem flag as it is a + // property of how this HistoryItem was originally created and is not + // dependent on the document. + bool isTargetItem = m_currentItem->isTargetItem(); + m_currentItem->reset(); + initializeItem(m_currentItem.get()); + m_currentItem->setIsTargetItem(isTargetItem); + } else { + // Even if the final URL didn't change, the form data may have changed. + m_currentItem->setFormInfoFromRequest(documentLoader->request()); + } +} + void HistoryController::pushState(PassRefPtr<SerializedScriptValue> stateObject, const String& title, const String& urlString) { if (!m_currentItem) diff --git a/Source/WebCore/loader/HistoryController.h b/Source/WebCore/loader/HistoryController.h index 9923179..061f235 100644 --- a/Source/WebCore/loader/HistoryController.h +++ b/Source/WebCore/loader/HistoryController.h @@ -41,7 +41,8 @@ class Frame; class HistoryItem; class SerializedScriptValue; -class HistoryController : public Noncopyable { +class HistoryController { + WTF_MAKE_NONCOPYABLE(HistoryController); public: enum HistoryUpdateType { UpdateAll, UpdateAllExceptBackForwardList }; @@ -84,7 +85,8 @@ public: void replaceState(PassRefPtr<SerializedScriptValue>, const String& title, const String& url); private: - PassRefPtr<HistoryItem> createItem(bool useOriginal); + void initializeItem(HistoryItem*); + PassRefPtr<HistoryItem> createItem(); PassRefPtr<HistoryItem> createItemTree(Frame* targetFrame, bool clipAtTarget); void recursiveSetProvisionalItem(HistoryItem*, HistoryItem*, FrameLoadType); @@ -93,6 +95,7 @@ private: bool itemsAreClones(HistoryItem*, HistoryItem*) const; bool currentFramesMatchItem(HistoryItem*) const; void updateBackForwardListClippedAtTarget(bool doClip); + void updateCurrentItem(); Frame* m_frame; diff --git a/Source/WebCore/loader/ImageLoader.cpp b/Source/WebCore/loader/ImageLoader.cpp index a77e8c0..069b40e 100644 --- a/Source/WebCore/loader/ImageLoader.cpp +++ b/Source/WebCore/loader/ImageLoader.cpp @@ -57,7 +57,8 @@ template<> struct ValueCheck<WebCore::ImageLoader*> { namespace WebCore { -class ImageEventSender : public Noncopyable { +class ImageEventSender { + WTF_MAKE_NONCOPYABLE(ImageEventSender); WTF_MAKE_FAST_ALLOCATED; public: ImageEventSender(const AtomicString& eventType); diff --git a/Source/WebCore/loader/NavigationScheduler.cpp b/Source/WebCore/loader/NavigationScheduler.cpp index 175219c..d51575b 100644 --- a/Source/WebCore/loader/NavigationScheduler.cpp +++ b/Source/WebCore/loader/NavigationScheduler.cpp @@ -53,7 +53,8 @@ namespace WebCore { unsigned NavigationDisablerForBeforeUnload::s_navigationDisableCount = 0; -class ScheduledNavigation : public Noncopyable { +class ScheduledNavigation { + WTF_MAKE_NONCOPYABLE(ScheduledNavigation); WTF_MAKE_FAST_ALLOCATED; public: ScheduledNavigation(double delay, bool lockHistory, bool lockBackForwardList, bool wasDuringLoad, bool isLocationChange) : m_delay(delay) diff --git a/Source/WebCore/loader/PingLoader.h b/Source/WebCore/loader/PingLoader.h index 3a076fb..5988b60 100644 --- a/Source/WebCore/loader/PingLoader.h +++ b/Source/WebCore/loader/PingLoader.h @@ -50,7 +50,8 @@ class ResourceResponse; // to allow the load to live long enough to ensure the message was actually sent. // Therefore, as soon as a callback is received from the ResourceHandle, this class // will cancel the load and delete itself. -class PingLoader : private ResourceHandleClient, public Noncopyable { +class PingLoader : private ResourceHandleClient { + WTF_MAKE_NONCOPYABLE(PingLoader); WTF_MAKE_FAST_ALLOCATED; public: static void loadImage(Frame*, const KURL& url); static void sendPing(Frame*, const KURL& pingURL, const KURL& destinationURL); diff --git a/Source/WebCore/loader/PolicyChecker.h b/Source/WebCore/loader/PolicyChecker.h index 541729c..3118dae 100644 --- a/Source/WebCore/loader/PolicyChecker.h +++ b/Source/WebCore/loader/PolicyChecker.h @@ -45,7 +45,8 @@ class NavigationAction; class ResourceError; class ResourceResponse; -class PolicyChecker : public Noncopyable { +class PolicyChecker { + WTF_MAKE_NONCOPYABLE(PolicyChecker); public: PolicyChecker(Frame*); diff --git a/Source/WebCore/loader/ProgressTracker.cpp b/Source/WebCore/loader/ProgressTracker.cpp index cd15433..65dd1c5 100644 --- a/Source/WebCore/loader/ProgressTracker.cpp +++ b/Source/WebCore/loader/ProgressTracker.cpp @@ -50,7 +50,9 @@ static const double finalProgressValue = 0.9; // 1.0 - initialProgressValue static const int progressItemDefaultEstimatedLength = 1024 * 16; -struct ProgressItem : Noncopyable { +struct ProgressItem { + WTF_MAKE_NONCOPYABLE(ProgressItem); WTF_MAKE_FAST_ALLOCATED; +public: ProgressItem(long long length) : bytesReceived(0) , estimatedLength(length) { } diff --git a/Source/WebCore/loader/ProgressTracker.h b/Source/WebCore/loader/ProgressTracker.h index 5d5b6b2..ea5f7f9 100644 --- a/Source/WebCore/loader/ProgressTracker.h +++ b/Source/WebCore/loader/ProgressTracker.h @@ -36,7 +36,8 @@ class Frame; class ResourceResponse; struct ProgressItem; -class ProgressTracker : public Noncopyable { +class ProgressTracker { + WTF_MAKE_NONCOPYABLE(ProgressTracker); WTF_MAKE_FAST_ALLOCATED; public: ProgressTracker(); ~ProgressTracker(); diff --git a/Source/WebCore/loader/ResourceLoadNotifier.h b/Source/WebCore/loader/ResourceLoadNotifier.h index 2f10856..a6d92fb 100644 --- a/Source/WebCore/loader/ResourceLoadNotifier.h +++ b/Source/WebCore/loader/ResourceLoadNotifier.h @@ -43,7 +43,8 @@ class ResourceLoader; class ResourceResponse; class ResourceRequest; -class ResourceLoadNotifier : public Noncopyable { +class ResourceLoadNotifier { + WTF_MAKE_NONCOPYABLE(ResourceLoadNotifier); public: ResourceLoadNotifier(Frame*); diff --git a/Source/WebCore/loader/ResourceLoadScheduler.h b/Source/WebCore/loader/ResourceLoadScheduler.h index 163b67e..f2e627f 100644 --- a/Source/WebCore/loader/ResourceLoadScheduler.h +++ b/Source/WebCore/loader/ResourceLoadScheduler.h @@ -44,7 +44,8 @@ class ResourceRequest; class SubresourceLoader; class SubresourceLoaderClient; -class ResourceLoadScheduler : public Noncopyable { +class ResourceLoadScheduler { + WTF_MAKE_NONCOPYABLE(ResourceLoadScheduler); public: friend ResourceLoadScheduler* resourceLoadScheduler(); @@ -69,7 +70,8 @@ private: void scheduleServePendingRequests(); void requestTimerFired(Timer<ResourceLoadScheduler>*); - class HostInformation : public Noncopyable { + class HostInformation { + WTF_MAKE_NONCOPYABLE(HostInformation); public: HostInformation(const String&, unsigned); ~HostInformation(); diff --git a/Source/WebCore/loader/SubframeLoader.cpp b/Source/WebCore/loader/SubframeLoader.cpp index eba3173..ae8ce98 100644 --- a/Source/WebCore/loader/SubframeLoader.cpp +++ b/Source/WebCore/loader/SubframeLoader.cpp @@ -184,17 +184,6 @@ PassRefPtr<Widget> SubframeLoader::loadMediaPlayerProxyPlugin(Node* node, const return widget ? widget.release() : 0; } - -void FrameLoader::hideMediaPlayerProxyPlugin(Widget* widget) -{ - m_client->hideMediaPlayerProxyPlugin(widget); -} - -void FrameLoader::showMediaPlayerProxyPlugin(Widget* widget) -{ - m_client->showMediaPlayerProxyPlugin(widget); -} - #endif // ENABLE(PLUGIN_PROXY_FOR_VIDEO) PassRefPtr<Widget> SubframeLoader::createJavaAppletWidget(const IntSize& size, HTMLAppletElement* element, const HashMap<String, String>& args) diff --git a/Source/WebCore/loader/SubframeLoader.h b/Source/WebCore/loader/SubframeLoader.h index a573045..ba63a5c 100644 --- a/Source/WebCore/loader/SubframeLoader.h +++ b/Source/WebCore/loader/SubframeLoader.h @@ -54,7 +54,8 @@ class Node; class Widget; // This is a slight misnomer. It handles the higher level logic of loading both subframes and plugins. -class SubframeLoader : public Noncopyable { +class SubframeLoader { + WTF_MAKE_NONCOPYABLE(SubframeLoader); public: SubframeLoader(Frame*); diff --git a/Source/WebCore/loader/ThreadableLoader.h b/Source/WebCore/loader/ThreadableLoader.h index f41a774..f574c94 100644 --- a/Source/WebCore/loader/ThreadableLoader.h +++ b/Source/WebCore/loader/ThreadableLoader.h @@ -65,7 +65,8 @@ namespace WebCore { // Useful for doing loader operations from any thread (not threadsafe, // just able to run on threads other than the main thread). - class ThreadableLoader : public Noncopyable { + class ThreadableLoader { + WTF_MAKE_NONCOPYABLE(ThreadableLoader); public: static void loadResourceSynchronously(ScriptExecutionContext*, const ResourceRequest&, ThreadableLoaderClient&, const ThreadableLoaderOptions&); static PassRefPtr<ThreadableLoader> create(ScriptExecutionContext*, ThreadableLoaderClient*, const ResourceRequest&, const ThreadableLoaderOptions&); @@ -75,6 +76,7 @@ namespace WebCore { void deref() { derefThreadableLoader(); } protected: + ThreadableLoader() { } virtual ~ThreadableLoader() { } virtual void refThreadableLoader() = 0; virtual void derefThreadableLoader() = 0; diff --git a/Source/WebCore/loader/ThreadableLoaderClient.h b/Source/WebCore/loader/ThreadableLoaderClient.h index bcf68be..cea8b0f 100644 --- a/Source/WebCore/loader/ThreadableLoaderClient.h +++ b/Source/WebCore/loader/ThreadableLoaderClient.h @@ -31,14 +31,14 @@ #ifndef ThreadableLoaderClient_h #define ThreadableLoaderClient_h -#include <wtf/Noncopyable.h> namespace WebCore { class ResourceError; class ResourceResponse; - class ThreadableLoaderClient : public Noncopyable { + class ThreadableLoaderClient { + WTF_MAKE_NONCOPYABLE(ThreadableLoaderClient); WTF_MAKE_FAST_ALLOCATED; public: virtual void didSendData(unsigned long long /*bytesSent*/, unsigned long long /*totalBytesToBeSent*/) { } @@ -51,6 +51,7 @@ namespace WebCore { virtual void didReceiveAuthenticationCancellation(const ResourceResponse&) { } protected: + ThreadableLoaderClient() { } virtual ~ThreadableLoaderClient() { } }; diff --git a/Source/WebCore/loader/WorkerThreadableLoader.h b/Source/WebCore/loader/WorkerThreadableLoader.h index 81da2e0..65cc637 100644 --- a/Source/WebCore/loader/WorkerThreadableLoader.h +++ b/Source/WebCore/loader/WorkerThreadableLoader.h @@ -54,6 +54,7 @@ namespace WebCore { struct CrossThreadResourceRequestData; class WorkerThreadableLoader : public RefCounted<WorkerThreadableLoader>, public ThreadableLoader { + WTF_MAKE_FAST_ALLOCATED; public: static void loadResourceSynchronously(WorkerContext*, const ResourceRequest&, ThreadableLoaderClient&, const ThreadableLoaderOptions&); static PassRefPtr<WorkerThreadableLoader> create(WorkerContext* workerContext, ThreadableLoaderClient* client, const String& taskMode, const ResourceRequest& request, const ThreadableLoaderOptions& options) diff --git a/Source/WebCore/loader/appcache/ApplicationCacheGroup.h b/Source/WebCore/loader/appcache/ApplicationCacheGroup.h index 2d8b83e..f3a117e 100644 --- a/Source/WebCore/loader/appcache/ApplicationCacheGroup.h +++ b/Source/WebCore/loader/appcache/ApplicationCacheGroup.h @@ -53,7 +53,8 @@ enum ApplicationCacheUpdateOption { ApplicationCacheUpdateWithoutBrowsingContext }; -class ApplicationCacheGroup : public Noncopyable, ResourceHandleClient { +class ApplicationCacheGroup : ResourceHandleClient { + WTF_MAKE_NONCOPYABLE(ApplicationCacheGroup); WTF_MAKE_FAST_ALLOCATED; public: ApplicationCacheGroup(const KURL& manifestURL, bool isCopy = false); ~ApplicationCacheGroup(); diff --git a/Source/WebCore/loader/appcache/ApplicationCacheHost.h b/Source/WebCore/loader/appcache/ApplicationCacheHost.h index 8ac5357..a1f2841 100644 --- a/Source/WebCore/loader/appcache/ApplicationCacheHost.h +++ b/Source/WebCore/loader/appcache/ApplicationCacheHost.h @@ -58,7 +58,8 @@ namespace WebCore { class ApplicationCacheStorage; #endif - class ApplicationCacheHost : public Noncopyable { + class ApplicationCacheHost { + WTF_MAKE_NONCOPYABLE(ApplicationCacheHost); WTF_MAKE_FAST_ALLOCATED; public: // The Status numeric values are specified in the HTML5 spec. enum Status { diff --git a/Source/WebCore/loader/appcache/ApplicationCacheStorage.h b/Source/WebCore/loader/appcache/ApplicationCacheStorage.h index 7db34e6..8bfdf13 100644 --- a/Source/WebCore/loader/appcache/ApplicationCacheStorage.h +++ b/Source/WebCore/loader/appcache/ApplicationCacheStorage.h @@ -44,7 +44,8 @@ template <class T> class StorageIDJournal; class SecurityOrigin; -class ApplicationCacheStorage : public Noncopyable { +class ApplicationCacheStorage { + WTF_MAKE_NONCOPYABLE(ApplicationCacheStorage); WTF_MAKE_FAST_ALLOCATED; public: enum FailureReason { OriginQuotaReached, diff --git a/Source/WebCore/loader/archive/ArchiveResourceCollection.h b/Source/WebCore/loader/archive/ArchiveResourceCollection.h index 9d630d1..fd2ddbf 100644 --- a/Source/WebCore/loader/archive/ArchiveResourceCollection.h +++ b/Source/WebCore/loader/archive/ArchiveResourceCollection.h @@ -39,7 +39,8 @@ namespace WebCore { -class ArchiveResourceCollection : public Noncopyable { +class ArchiveResourceCollection { + WTF_MAKE_NONCOPYABLE(ArchiveResourceCollection); WTF_MAKE_FAST_ALLOCATED; public: ArchiveResourceCollection(); diff --git a/Source/WebCore/loader/cache/CachedResource.h b/Source/WebCore/loader/cache/CachedResource.h index 3600a02..5c8b38f 100644 --- a/Source/WebCore/loader/cache/CachedResource.h +++ b/Source/WebCore/loader/cache/CachedResource.h @@ -50,7 +50,8 @@ class PurgeableBuffer; // A resource that is held in the cache. Classes who want to use this object should derive // from CachedResourceClient, to get the function calls in case the requested data has arrived. // This class also does the actual communication with the loader to obtain the resource from the network. -class CachedResource : public Noncopyable { +class CachedResource { + WTF_MAKE_NONCOPYABLE(CachedResource); WTF_MAKE_FAST_ALLOCATED; friend class MemoryCache; friend class InspectorResource; diff --git a/Source/WebCore/loader/cache/CachedResourceClient.h b/Source/WebCore/loader/cache/CachedResourceClient.h index 275d331..1c56f13 100644 --- a/Source/WebCore/loader/cache/CachedResourceClient.h +++ b/Source/WebCore/loader/cache/CachedResourceClient.h @@ -45,8 +45,8 @@ namespace WebCore { * inherit from this class and overload one of the 3 functions * */ - class CachedResourceClient : public FastAllocBase - { + class CachedResourceClient { + WTF_MAKE_FAST_ALLOCATED; public: virtual ~CachedResourceClient() { } diff --git a/Source/WebCore/loader/cache/CachedResourceLoader.h b/Source/WebCore/loader/cache/CachedResourceLoader.h index bc351ce..4f67e72 100644 --- a/Source/WebCore/loader/cache/CachedResourceLoader.h +++ b/Source/WebCore/loader/cache/CachedResourceLoader.h @@ -49,7 +49,8 @@ class ImageLoader; class KURL; // The CachedResourceLoader manages the loading of scripts/images/stylesheets for a single document. -class CachedResourceLoader : public Noncopyable { +class CachedResourceLoader { + WTF_MAKE_NONCOPYABLE(CachedResourceLoader); WTF_MAKE_FAST_ALLOCATED; friend class ImageLoader; public: diff --git a/Source/WebCore/loader/cache/CachedScript.cpp b/Source/WebCore/loader/cache/CachedScript.cpp index 54b4503..8950ddb 100644 --- a/Source/WebCore/loader/cache/CachedScript.cpp +++ b/Source/WebCore/loader/cache/CachedScript.cpp @@ -34,6 +34,10 @@ #include "TextResourceDecoder.h" #include <wtf/Vector.h> +#if USE(JSC) +#include <parser/SourceProvider.h> +#endif + namespace WebCore { CachedScript::CachedScript(const String& url, const String& charset) @@ -111,7 +115,12 @@ void CachedScript::error(CachedResource::Status status) void CachedScript::destroyDecodedData() { m_script = String(); - setDecodedSize(0); + unsigned extraSize = 0; +#if USE(JSC) + // FIXME: SourceInfoCache should be wiped out too but not this easily. + extraSize = m_sourceProviderCache ? m_sourceProviderCache->byteSize() : 0; +#endif + setDecodedSize(extraSize); if (!MemoryCache::shouldMakeResourcePurgeableOnEviction() && isSafeToMakePurgeable()) makePurgeable(true); } @@ -121,4 +130,18 @@ void CachedScript::decodedDataDeletionTimerFired(Timer<CachedScript>*) destroyDecodedData(); } +#if USE(JSC) +JSC::SourceProviderCache* CachedScript::sourceProviderCache() const +{ + if (!m_sourceProviderCache) + m_sourceProviderCache = adoptPtr(new JSC::SourceProviderCache); + return m_sourceProviderCache.get(); +} + +void CachedScript::sourceProviderCacheSizeChanged(int delta) +{ + setDecodedSize(decodedSize() + delta); +} +#endif + } // namespace WebCore diff --git a/Source/WebCore/loader/cache/CachedScript.h b/Source/WebCore/loader/cache/CachedScript.h index 30fcb1e..14294f2 100644 --- a/Source/WebCore/loader/cache/CachedScript.h +++ b/Source/WebCore/loader/cache/CachedScript.h @@ -29,6 +29,12 @@ #include "CachedResource.h" #include "Timer.h" +#if USE(JSC) +namespace JSC { + class SourceProviderCache; +} +#endif + namespace WebCore { class CachedResourceLoader; @@ -51,7 +57,11 @@ namespace WebCore { void checkNotify(); virtual void destroyDecodedData(); - +#if USE(JSC) + // Allows JSC to cache additional information about the source. + JSC::SourceProviderCache* sourceProviderCache() const; + void sourceProviderCacheSizeChanged(int delta); +#endif private: void decodedDataDeletionTimerFired(Timer<CachedScript>*); virtual PurgePriority purgePriority() const { return PurgeLast; } @@ -59,6 +69,9 @@ namespace WebCore { String m_script; RefPtr<TextResourceDecoder> m_decoder; Timer<CachedScript> m_decodedDataDeletionTimer; +#if USE(JSC) + mutable OwnPtr<JSC::SourceProviderCache> m_sourceProviderCache; +#endif }; } diff --git a/Source/WebCore/loader/cache/MemoryCache.h b/Source/WebCore/loader/cache/MemoryCache.h index 7a567ea..12452c1 100644 --- a/Source/WebCore/loader/cache/MemoryCache.h +++ b/Source/WebCore/loader/cache/MemoryCache.h @@ -70,7 +70,8 @@ class KURL; // its member variables) are allocated in non-purgeable TC-malloc'd memory so we would see slightly // more memory use due to this. -class MemoryCache : public Noncopyable { +class MemoryCache { + WTF_MAKE_NONCOPYABLE(MemoryCache); WTF_MAKE_FAST_ALLOCATED; public: friend MemoryCache* memoryCache(); diff --git a/Source/WebCore/loader/icon/IconDatabase.h b/Source/WebCore/loader/icon/IconDatabase.h index 6146aa6..e08dcd4 100644 --- a/Source/WebCore/loader/icon/IconDatabase.h +++ b/Source/WebCore/loader/icon/IconDatabase.h @@ -62,8 +62,8 @@ enum IconLoadDecision { IconLoadUnknown }; -class IconDatabase : public Noncopyable { - +class IconDatabase { + WTF_MAKE_NONCOPYABLE(IconDatabase); WTF_MAKE_FAST_ALLOCATED; // *** Main Thread Only *** public: void setClient(IconDatabaseClient*); diff --git a/Source/WebCore/loader/icon/IconDatabaseClient.h b/Source/WebCore/loader/icon/IconDatabaseClient.h index c210d7d..f97a2a8 100644 --- a/Source/WebCore/loader/icon/IconDatabaseClient.h +++ b/Source/WebCore/loader/icon/IconDatabaseClient.h @@ -29,6 +29,7 @@ #ifndef IconDatabaseClient_h #define IconDatabaseClient_h +#include <wtf/FastAllocBase.h> #include <wtf/Forward.h> #include <wtf/Noncopyable.h> @@ -37,8 +38,10 @@ namespace WebCore { -class IconDatabaseClient : public Noncopyable { +class IconDatabaseClient { + WTF_MAKE_NONCOPYABLE(IconDatabaseClient); WTF_MAKE_FAST_ALLOCATED; public: + IconDatabaseClient() { } virtual ~IconDatabaseClient() { } virtual bool performImport() { return true; } virtual void dispatchDidRemoveAllIcons() { } diff --git a/Source/WebCore/loader/icon/IconLoader.h b/Source/WebCore/loader/icon/IconLoader.h index 1ebac48..2985393 100644 --- a/Source/WebCore/loader/icon/IconLoader.h +++ b/Source/WebCore/loader/icon/IconLoader.h @@ -37,7 +37,8 @@ class Frame; class KURL; class SharedBuffer; -class IconLoader : private SubresourceLoaderClient, public Noncopyable { +class IconLoader : private SubresourceLoaderClient { + WTF_MAKE_NONCOPYABLE(IconLoader); WTF_MAKE_FAST_ALLOCATED; public: static PassOwnPtr<IconLoader> create(Frame*); ~IconLoader(); diff --git a/Source/WebCore/loader/icon/PageURLRecord.h b/Source/WebCore/loader/icon/PageURLRecord.h index f7ccb8f..7935dc9 100644 --- a/Source/WebCore/loader/icon/PageURLRecord.h +++ b/Source/WebCore/loader/icon/PageURLRecord.h @@ -51,7 +51,8 @@ public: String iconURL; }; -class PageURLRecord : public Noncopyable { +class PageURLRecord { + WTF_MAKE_NONCOPYABLE(PageURLRecord); WTF_MAKE_FAST_ALLOCATED; public: PageURLRecord(const String& pageURL); ~PageURLRecord(); diff --git a/Source/WebCore/mathml/MathMLMathElement.cpp b/Source/WebCore/mathml/MathMLMathElement.cpp index 6c5c3c6..ae74b52 100644 --- a/Source/WebCore/mathml/MathMLMathElement.cpp +++ b/Source/WebCore/mathml/MathMLMathElement.cpp @@ -44,6 +44,14 @@ PassRefPtr<MathMLMathElement> MathMLMathElement::create(const QualifiedName& tag return adoptRef(new MathMLMathElement(tagName, document)); } +void MathMLMathElement::insertedIntoDocument() +{ + // There are sibling rules in the MathML default style. + document()->setUsesSiblingRules(true); + + MathMLInlineContainerElement::insertedIntoDocument(); +} + RenderObject* MathMLMathElement::createRenderer(RenderArena* arena, RenderStyle*) { return new (arena) RenderMathMLMath(this); diff --git a/Source/WebCore/mathml/MathMLMathElement.h b/Source/WebCore/mathml/MathMLMathElement.h index d31d548..81f161b 100644 --- a/Source/WebCore/mathml/MathMLMathElement.h +++ b/Source/WebCore/mathml/MathMLMathElement.h @@ -39,6 +39,7 @@ public: private: MathMLMathElement(const QualifiedName& tagName, Document*); + virtual void insertedIntoDocument(); virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); }; diff --git a/Source/WebCore/notifications/Notification.h b/Source/WebCore/notifications/Notification.h index f14a302..73131e5 100644 --- a/Source/WebCore/notifications/Notification.h +++ b/Source/WebCore/notifications/Notification.h @@ -59,6 +59,7 @@ namespace WebCore { class WorkerContext; class Notification : public RefCounted<Notification>, public ActiveDOMObject, public ThreadableLoaderClient, public EventTarget { + WTF_MAKE_FAST_ALLOCATED; public: static PassRefPtr<Notification> create(const KURL& url, ScriptExecutionContext* context, ExceptionCode& ec, PassRefPtr<NotificationCenter> provider); static PassRefPtr<Notification> create(const NotificationContents& contents, ScriptExecutionContext* context, ExceptionCode& ec, PassRefPtr<NotificationCenter> provider); diff --git a/Source/WebCore/page/Chrome.cpp b/Source/WebCore/page/Chrome.cpp index 0405408..d96b6c9 100644 --- a/Source/WebCore/page/Chrome.cpp +++ b/Source/WebCore/page/Chrome.cpp @@ -445,6 +445,13 @@ void Chrome::setCursor(const Cursor& cursor) m_client->setCursor(cursor); } +#if ENABLE(REQUEST_ANIMATION_FRAME) +void Chrome::scheduleAnimation() +{ + m_client->scheduleAnimation(); +} +#endif + #if ENABLE(NOTIFICATIONS) NotificationPresenter* Chrome::notificationPresenter() const { diff --git a/Source/WebCore/page/Chrome.h b/Source/WebCore/page/Chrome.h index 93b8c4a..0afd807 100644 --- a/Source/WebCore/page/Chrome.h +++ b/Source/WebCore/page/Chrome.h @@ -78,6 +78,9 @@ namespace WebCore { virtual PlatformPageClient platformPageClient() const; virtual void scrollbarsModeDidChange() const; virtual void setCursor(const Cursor&); +#if ENABLE(REQUEST_ANIMATION_FRAME) + virtual void scheduleAnimation(); +#endif void scrollRectIntoView(const IntRect&) const; diff --git a/Source/WebCore/page/ChromeClient.h b/Source/WebCore/page/ChromeClient.h index 51c8959..98b56da 100644 --- a/Source/WebCore/page/ChromeClient.h +++ b/Source/WebCore/page/ChromeClient.h @@ -151,6 +151,9 @@ namespace WebCore { virtual PlatformPageClient platformPageClient() const = 0; virtual void scrollbarsModeDidChange() const = 0; virtual void setCursor(const Cursor&) = 0; +#if ENABLE(REQUEST_ANIMATION_FRAME) + virtual void scheduleAnimation() = 0; +#endif // End methods used by HostWindow. virtual void dispatchViewportDataDidChange(const ViewportArguments&) const { } diff --git a/Source/WebCore/page/Console.cpp b/Source/WebCore/page/Console.cpp index d4aed41..0c19421 100644 --- a/Source/WebCore/page/Console.cpp +++ b/Source/WebCore/page/Console.cpp @@ -262,20 +262,13 @@ void Console::profile(const String& title, ScriptState* state, PassRefPtr<Script if (!page) return; -#if ENABLE(INSPECTOR) - InspectorController* controller = page->inspectorController(); // FIXME: log a console message when profiling is disabled. - if (!controller->profilerEnabled()) + if (!InspectorInstrumentation::profilerEnabled(page)) return; -#endif String resolvedTitle = title; if (title.isNull()) // no title so give it the next user initiated profile title. -#if ENABLE(INSPECTOR) - resolvedTitle = controller->getCurrentUserInitiatedProfileName(true); -#else - resolvedTitle = ""; -#endif + resolvedTitle = InspectorInstrumentation::getCurrentUserInitiatedProfileName(page, true); ScriptProfiler::start(state, resolvedTitle); @@ -289,22 +282,15 @@ void Console::profileEnd(const String& title, ScriptState* state, PassRefPtr<Scr if (!page) return; -#if ENABLE(INSPECTOR) - InspectorController* controller = page->inspectorController(); - if (!controller->profilerEnabled()) + if (!InspectorInstrumentation::profilerEnabled(page)) return; -#endif RefPtr<ScriptProfile> profile = ScriptProfiler::stop(state, title); if (!profile) return; m_profiles.append(profile); - -#if ENABLE(INSPECTOR) - const ScriptCallFrame& lastCaller = callStack->at(0); - controller->addProfile(profile, lastCaller.lineNumber(), lastCaller.sourceURL()); -#endif + InspectorInstrumentation::addProfile(page, profile, callStack.get()); } #endif diff --git a/Source/WebCore/page/ContextMenuController.h b/Source/WebCore/page/ContextMenuController.h index ab92796..e6a0a00 100644 --- a/Source/WebCore/page/ContextMenuController.h +++ b/Source/WebCore/page/ContextMenuController.h @@ -41,7 +41,8 @@ namespace WebCore { class Event; class Page; - class ContextMenuController : public Noncopyable { + class ContextMenuController { + WTF_MAKE_NONCOPYABLE(ContextMenuController); WTF_MAKE_FAST_ALLOCATED; public: ContextMenuController(Page*, ContextMenuClient*); ~ContextMenuController(); diff --git a/Source/WebCore/page/DOMSelection.cpp b/Source/WebCore/page/DOMSelection.cpp index 7691da4..dbb0944 100644 --- a/Source/WebCore/page/DOMSelection.cpp +++ b/Source/WebCore/page/DOMSelection.cpp @@ -76,23 +76,23 @@ const VisibleSelection& DOMSelection::visibleSelection() const static Position anchorPosition(const VisibleSelection& selection) { Position anchor = selection.isBaseFirst() ? selection.start() : selection.end(); - return rangeCompliantEquivalent(anchor); + return anchor.parentAnchoredEquivalent(); } static Position focusPosition(const VisibleSelection& selection) { Position focus = selection.isBaseFirst() ? selection.end() : selection.start(); - return rangeCompliantEquivalent(focus); + return focus.parentAnchoredEquivalent(); } static Position basePosition(const VisibleSelection& selection) { - return rangeCompliantEquivalent(selection.base()); + return selection.base().parentAnchoredEquivalent(); } static Position extentPosition(const VisibleSelection& selection) { - return rangeCompliantEquivalent(selection.extent()); + return selection.extent().parentAnchoredEquivalent(); } Node* DOMSelection::anchorNode() const diff --git a/Source/WebCore/page/DOMWindow.cpp b/Source/WebCore/page/DOMWindow.cpp index 9c29071..0860d65 100644 --- a/Source/WebCore/page/DOMWindow.cpp +++ b/Source/WebCore/page/DOMWindow.cpp @@ -105,6 +105,10 @@ #include "LocalFileSystem.h" #endif +#if ENABLE(REQUEST_ANIMATION_FRAME) +#include "RequestAnimationFrameCallback.h" +#endif + using std::min; using std::max; @@ -1476,6 +1480,21 @@ void DOMWindow::clearInterval(int timeoutId) DOMTimer::removeById(context, timeoutId); } +#if ENABLE(REQUEST_ANIMATION_FRAME) +int DOMWindow::webkitRequestAnimationFrame(PassRefPtr<RequestAnimationFrameCallback> callback, Element* e) +{ + if (Document* d = document()) + return d->webkitRequestAnimationFrame(callback, e); + return 0; +} + +void DOMWindow::webkitCancelRequestAnimationFrame(int id) +{ + if (Document* d = document()) + d->webkitCancelRequestAnimationFrame(id); +} +#endif + bool DOMWindow::addEventListener(const AtomicString& eventType, PassRefPtr<EventListener> listener, bool useCapture) { if (!EventTarget::addEventListener(eventType, listener, useCapture)) @@ -1627,6 +1646,9 @@ void DOMWindow::clearDOMStorage() void DOMWindow::setLocation(const String& urlString, DOMWindow* activeWindow, DOMWindow* firstWindow, SetLocationLocking locking) { + if (!m_frame) + return; + Frame* activeFrame = activeWindow->frame(); if (!activeFrame) return; diff --git a/Source/WebCore/page/DOMWindow.h b/Source/WebCore/page/DOMWindow.h index 3614627..f02a7ac 100644 --- a/Source/WebCore/page/DOMWindow.h +++ b/Source/WebCore/page/DOMWindow.h @@ -64,6 +64,10 @@ namespace WebCore { class StyleMedia; class WebKitPoint; +#if ENABLE(REQUEST_ANIMATION_FRAME) + class RequestAnimationFrameCallback; +#endif + struct WindowFeatures; typedef int ExceptionCode; @@ -237,6 +241,12 @@ namespace WebCore { int setInterval(PassOwnPtr<ScheduledAction>, int timeout, ExceptionCode&); void clearInterval(int timeoutId); + // WebKit animation extensions +#if ENABLE(REQUEST_ANIMATION_FRAME) + int webkitRequestAnimationFrame(PassRefPtr<RequestAnimationFrameCallback>, Element*); + void webkitCancelRequestAnimationFrame(int id); +#endif + // Events // EventTarget API virtual bool addEventListener(const AtomicString& eventType, PassRefPtr<EventListener>, bool useCapture); @@ -269,6 +279,8 @@ namespace WebCore { DEFINE_ATTRIBUTE_EVENT_LISTENER(ended); DEFINE_ATTRIBUTE_EVENT_LISTENER(error); DEFINE_ATTRIBUTE_EVENT_LISTENER(focus); + DEFINE_ATTRIBUTE_EVENT_LISTENER(formchange); + DEFINE_ATTRIBUTE_EVENT_LISTENER(forminput); DEFINE_ATTRIBUTE_EVENT_LISTENER(hashchange); DEFINE_ATTRIBUTE_EVENT_LISTENER(input); DEFINE_ATTRIBUTE_EVENT_LISTENER(invalid); diff --git a/Source/WebCore/page/DOMWindow.idl b/Source/WebCore/page/DOMWindow.idl index 77ffe41..a814558 100644 --- a/Source/WebCore/page/DOMWindow.idl +++ b/Source/WebCore/page/DOMWindow.idl @@ -235,6 +235,12 @@ module window { // [Custom] long setInterval(in DOMString code, in long timeout); void clearInterval(in long handle); +#if defined(ENABLE_REQUEST_ANIMATION_FRAME) + // WebKit animation extensions + long webkitRequestAnimationFrame(in [Callback] RequestAnimationFrameCallback callback, in Element element); + void webkitCancelRequestAnimationFrame(in long id); +#endif + // Base64 DOMString atob(in [ConvertNullToNullString] DOMString string) raises(DOMException); @@ -264,6 +270,8 @@ module window { attribute EventListener onended; attribute EventListener onerror; attribute EventListener onfocus; + attribute EventListener onformchange; + attribute EventListener onforminput; attribute EventListener onhashchange; attribute EventListener oninput; attribute EventListener oninvalid; @@ -308,8 +316,6 @@ module window { // Not implemented yet. // attribute EventListener onafterprint; // attribute EventListener onbeforeprint; - // attribute EventListener onformchange; - // attribute EventListener onforminput; // attribute EventListener onreadystatechange; // attribute EventListener onredo; // attribute EventListener onshow; @@ -439,6 +445,7 @@ module window { attribute HTMLImageElementConstructor HTMLImageElement; attribute HTMLInputElementConstructor HTMLInputElement; attribute HTMLIsIndexElementConstructor HTMLIsIndexElement; + attribute HTMLKeygenElementConstructor HTMLKeygenElement; attribute HTMLLIElementConstructor HTMLLIElement; attribute HTMLLabelElementConstructor HTMLLabelElement; attribute HTMLLegendElementConstructor HTMLLegendElement; @@ -509,7 +516,7 @@ module window { attribute [JSCCustomGetter,Conditional=3D_CANVAS|BLOB,EnabledAtRuntime] Float32ArrayConstructor Float32Array; // Usable with new operator attribute [JSCCustomGetter,Conditional=3D_CANVAS|BLOB,EnabledAtRuntime] DataViewConstructor DataView; // Usable with new operator - attribute [JSCCustomGetter,Conditional=WEB_AUDIO] AudioContextConstructor webkitAudioContext; // Usable with new operator + attribute [JSCCustomGetter,Conditional=WEB_AUDIO,EnabledAtRuntime] AudioContextConstructor webkitAudioContext; // Usable with new operator attribute [Conditional=WEB_AUDIO] AudioPannerNodeConstructor webkitAudioPannerNode; // Needed for panning model constants attribute EventConstructor Event; diff --git a/Source/WebCore/page/DragController.h b/Source/WebCore/page/DragController.h index 10bb5f8..0f176b1 100644 --- a/Source/WebCore/page/DragController.h +++ b/Source/WebCore/page/DragController.h @@ -47,7 +47,8 @@ namespace WebCore { class Range; class SelectionController; - class DragController : public Noncopyable { + class DragController { + WTF_MAKE_NONCOPYABLE(DragController); WTF_MAKE_FAST_ALLOCATED; public: DragController(Page*, DragClient*); ~DragController(); diff --git a/Source/WebCore/page/EventHandler.cpp b/Source/WebCore/page/EventHandler.cpp index 942f032..476921e 100644 --- a/Source/WebCore/page/EventHandler.cpp +++ b/Source/WebCore/page/EventHandler.cpp @@ -2674,12 +2674,11 @@ cleanupDrag: } #endif // ENABLE(DRAG_SUPPORT) -bool EventHandler::handleTextInputEvent(const String& text, Event* underlyingEvent, bool isLineBreak, bool isBackTab) +bool EventHandler::handleTextInputEvent(const String& text, Event* underlyingEvent, TextEventInputType inputType) { // Platforms should differentiate real commands like selectAll from text input in disguise (like insertNewline), // and avoid dispatching text input events from keydown default handlers. ASSERT(!underlyingEvent || !underlyingEvent->isKeyboardEvent() || static_cast<KeyboardEvent*>(underlyingEvent)->type() == eventNames().keypressEvent); - ASSERT(!(isLineBreak && isBackTab)); if (!m_frame) return false; @@ -2695,7 +2694,7 @@ bool EventHandler::handleTextInputEvent(const String& text, Event* underlyingEve if (FrameView* view = m_frame->view()) view->resetDeferredRepaintDelay(); - RefPtr<TextEvent> event = TextEvent::create(m_frame->domWindow(), text, TextEvent::selectInputType(isLineBreak, isBackTab)); + RefPtr<TextEvent> event = TextEvent::create(m_frame->domWindow(), text, inputType); event->setUnderlyingEvent(underlyingEvent); ExceptionCode ec; diff --git a/Source/WebCore/page/EventHandler.h b/Source/WebCore/page/EventHandler.h index 65695c2..d12a56e 100644 --- a/Source/WebCore/page/EventHandler.h +++ b/Source/WebCore/page/EventHandler.h @@ -31,6 +31,7 @@ #include "HitTestRequest.h" #include "PlatformMouseEvent.h" #include "ScrollTypes.h" +#include "TextEventInputType.h" #include "Timer.h" #include <wtf/Forward.h> #include <wtf/RefPtr.h> @@ -80,7 +81,8 @@ extern const int GeneralDragHysteresis; enum HitTestScrollbars { ShouldHitTestScrollbars, DontHitTestScrollbars }; -class EventHandler : public Noncopyable { +class EventHandler { + WTF_MAKE_NONCOPYABLE(EventHandler); public: EventHandler(Frame*); ~EventHandler(); @@ -173,8 +175,7 @@ public: bool keyEvent(const PlatformKeyboardEvent&); void defaultKeyboardEventHandler(KeyboardEvent*); - bool handleTextInputEvent(const String& text, Event* underlyingEvent = 0, - bool isLineBreak = false, bool isBackTab = false); + bool handleTextInputEvent(const String& text, Event* underlyingEvent = 0, TextEventInputType = TextEventInputKeyboard); void defaultTextInputEventHandler(TextEvent*); #if ENABLE(DRAG_SUPPORT) @@ -224,7 +225,10 @@ private: PerformDragAndDrop }; - struct EventHandlerDragState : Noncopyable { + struct EventHandlerDragState { + WTF_MAKE_NONCOPYABLE(EventHandlerDragState); WTF_MAKE_FAST_ALLOCATED; + public: + EventHandlerDragState() { } RefPtr<Node> m_dragSrc; // element that may be a drag source, for the current mouse gesture bool m_dragSrcIsLink; bool m_dragSrcIsImage; diff --git a/Source/WebCore/page/EventSource.h b/Source/WebCore/page/EventSource.h index ffed592..10ad6ba 100644 --- a/Source/WebCore/page/EventSource.h +++ b/Source/WebCore/page/EventSource.h @@ -51,6 +51,7 @@ namespace WebCore { class ThreadableLoader; class EventSource : public RefCounted<EventSource>, public EventTarget, private ThreadableLoaderClient, public ActiveDOMObject { + WTF_MAKE_FAST_ALLOCATED; public: static PassRefPtr<EventSource> create(const String& url, ScriptExecutionContext*, ExceptionCode&); virtual ~EventSource(); diff --git a/Source/WebCore/page/FocusController.h b/Source/WebCore/page/FocusController.h index be51c77..50fa2ea 100644 --- a/Source/WebCore/page/FocusController.h +++ b/Source/WebCore/page/FocusController.h @@ -40,7 +40,8 @@ class KeyboardEvent; class Node; class Page; -class FocusController : public Noncopyable { +class FocusController { + WTF_MAKE_NONCOPYABLE(FocusController); WTF_MAKE_FAST_ALLOCATED; public: FocusController(Page*); diff --git a/Source/WebCore/page/FrameTree.h b/Source/WebCore/page/FrameTree.h index 94b8d16..bac5475 100644 --- a/Source/WebCore/page/FrameTree.h +++ b/Source/WebCore/page/FrameTree.h @@ -26,7 +26,8 @@ namespace WebCore { class Frame; - class FrameTree : public Noncopyable { + class FrameTree { + WTF_MAKE_NONCOPYABLE(FrameTree); public: FrameTree(Frame* thisFrame, Frame* parentFrame) : m_thisFrame(thisFrame) diff --git a/Source/WebCore/page/FrameView.cpp b/Source/WebCore/page/FrameView.cpp index fdf01ec..7546270 100644 --- a/Source/WebCore/page/FrameView.cpp +++ b/Source/WebCore/page/FrameView.cpp @@ -117,7 +117,10 @@ double FrameView::s_deferredRepaintDelayIncrementDuringLoading = 0; // The maximum number of updateWidgets iterations that should be done before returning. static const unsigned maxUpdateWidgetsIterations = 2; -struct ScheduledEvent : Noncopyable { +struct ScheduledEvent { + WTF_MAKE_NONCOPYABLE(ScheduledEvent); WTF_MAKE_FAST_ALLOCATED; +public: + ScheduledEvent() { } RefPtr<Event> m_event; RefPtr<Node> m_eventTarget; }; @@ -354,6 +357,14 @@ void FrameView::setFrameRect(const IntRect& newRect) #endif } +#if ENABLE(REQUEST_ANIMATION_FRAME) +void FrameView::scheduleAnimation() +{ + if (hostWindow()) + hostWindow()->scheduleAnimation(); +} +#endif + void FrameView::setMarginWidth(int w) { // make it update the rendering area when set @@ -566,10 +577,19 @@ void FrameView::updateCompositingLayers() #endif } -void FrameView::syncCompositingStateForThisFrame() +bool FrameView::syncCompositingStateForThisFrame() { - if (RenderView* view = m_frame->contentRenderer()) - view->compositor()->flushPendingLayerChanges(); + ASSERT(m_frame->view() == this); + RenderView* view = m_frame->contentRenderer(); + if (!view) + return true; // We don't want to keep trying to update layers if we have no renderer. + + // If we sync compositing layers when a layout is pending, we may cause painting of compositing + // layer content to occur before layout has happened, which will cause paintContents() to bail. + if (needsLayout()) + return false; + + view->compositor()->flushPendingLayerChanges(); #if ENABLE(FULLSCREEN_API) // The fullScreenRenderer's graphicsLayer has been re-parented, and the above recursive syncCompositingState @@ -581,7 +601,8 @@ void FrameView::syncCompositingStateForThisFrame() if (GraphicsLayer* fullScreenLayer = backing->graphicsLayer()) fullScreenLayer->syncCompositingState(); } -#endif +#endif + return true; } void FrameView::setNeedsOneShotDrawingSynchronization() @@ -660,32 +681,16 @@ bool FrameView::isEnclosedInCompositingLayer() const return false; } -bool FrameView::syncCompositingStateRecursive() +bool FrameView::syncCompositingStateIncludingSubframes() { #if USE(ACCELERATED_COMPOSITING) - ASSERT(m_frame->view() == this); - RenderView* contentRenderer = m_frame->contentRenderer(); - if (!contentRenderer) - return true; // We don't want to keep trying to update layers if we have no renderer. - - // If we sync compositing layers when a layout is pending, we may cause painting of compositing - // layer content to occur before layout has happened, which will cause paintContents() to bail. - if (needsLayout()) - return false; + bool allFramesSynced = syncCompositingStateForThisFrame(); - syncCompositingStateForThisFrame(); - - bool allSubframesSynced = true; - const HashSet<RefPtr<Widget> >* viewChildren = children(); - HashSet<RefPtr<Widget> >::const_iterator end = viewChildren->end(); - for (HashSet<RefPtr<Widget> >::const_iterator current = viewChildren->begin(); current != end; ++current) { - Widget* widget = (*current).get(); - if (widget->isFrameView()) { - bool synced = static_cast<FrameView*>(widget)->syncCompositingStateRecursive(); - allSubframesSynced &= synced; - } + for (Frame* child = m_frame->tree()->firstChild(); child; child = child->tree()->traverseNext(m_frame.get())) { + bool synced = child->view()->syncCompositingStateForThisFrame(); + allFramesSynced &= synced; } - return allSubframesSynced; + return allFramesSynced; #else // USE(ACCELERATED_COMPOSITING) return true; #endif @@ -1721,6 +1726,14 @@ void FrameView::unscheduleRelayout() m_delayedLayout = false; } +#if ENABLE(REQUEST_ANIMATION_FRAME) +void FrameView::serviceScriptedAnimations() +{ + for (Frame* frame = m_frame.get(); frame; frame = frame->tree()->traverseNext()) + frame->document()->serviceScriptedAnimations(); +} +#endif + bool FrameView::isTransparent() const { return m_isTransparent; @@ -2020,23 +2033,15 @@ bool FrameView::isActive() const return page && page->focusController()->isActive(); } -void FrameView::valueChanged(Scrollbar* bar) +void FrameView::scrollTo(const IntSize& newOffset) { - // Figure out if we really moved. IntSize offset = scrollOffset(); - ScrollView::valueChanged(bar); + ScrollView::scrollTo(newOffset); if (offset != scrollOffset()) scrollPositionChanged(); frame()->loader()->client()->didChangeScrollOffset(); } -void FrameView::valueChanged(const IntSize& scrollDelta) -{ - ScrollView::valueChanged(scrollDelta); - frame()->eventHandler()->sendScrollEvent(); - frame()->loader()->client()->didChangeScrollOffset(); -} - void FrameView::invalidateScrollbarRect(Scrollbar* scrollbar, const IntRect& rect) { // Add in our offset within the FrameView. diff --git a/Source/WebCore/page/FrameView.h b/Source/WebCore/page/FrameView.h index bdeab90..c75aab8 100644 --- a/Source/WebCore/page/FrameView.h +++ b/Source/WebCore/page/FrameView.h @@ -62,6 +62,9 @@ public: virtual void invalidateRect(const IntRect&); virtual void setFrameRect(const IntRect&); +#if ENABLE(REQUEST_ANIMATION_FRAME) + void scheduleAnimation(); +#endif Frame* frame() const { return m_frame.get(); } void clearFrame(); @@ -97,13 +100,18 @@ public: bool needsFullRepaint() const { return m_doFullRepaint; } +<<<<<<< HEAD #if PLATFORM(ANDROID) void updatePositionedObjects(); +======= +#if ENABLE(REQUEST_ANIMATION_FRAME) + void serviceScriptedAnimations(); +>>>>>>> WebKit.org at r76408 #endif #if USE(ACCELERATED_COMPOSITING) void updateCompositingLayers(); - void syncCompositingStateForThisFrame(); + bool syncCompositingStateForThisFrame(); // Called when changes to the GraphicsLayer hierarchy have to be synchronized with // content rendered via the normal painting path. @@ -121,7 +129,7 @@ public: // Only used with accelerated compositing, but outside the #ifdef to make linkage easier. // Returns true if the sync was completed. - bool syncCompositingStateRecursive(); + bool syncCompositingStateIncludingSubframes(); // Returns true when a paint with the PaintBehaviorFlattenCompositingLayers flag set gives // a faithful representation of the content. @@ -294,13 +302,13 @@ private: virtual IntPoint convertToContainingView(const IntPoint&) const; virtual IntPoint convertFromContainingView(const IntPoint&) const; - // ScrollBarClient interface - virtual void valueChanged(Scrollbar*); - virtual void valueChanged(const IntSize&); + // ScrollableArea interface virtual void invalidateScrollbarRect(Scrollbar*, const IntRect&); virtual bool isActive() const; virtual void getTickmarks(Vector<IntRect>&) const; + virtual void scrollTo(const IntSize&); + void deferredRepaintTimerFired(Timer<FrameView>*); void doDeferredRepaints(); void updateDeferredRepaintDelay(); diff --git a/Source/WebCore/page/GeolocationController.h b/Source/WebCore/page/GeolocationController.h index 7db1951..1a2ce69 100644 --- a/Source/WebCore/page/GeolocationController.h +++ b/Source/WebCore/page/GeolocationController.h @@ -40,7 +40,8 @@ class GeolocationError; class GeolocationPosition; class Page; -class GeolocationController : public Noncopyable { +class GeolocationController { + WTF_MAKE_NONCOPYABLE(GeolocationController); public: GeolocationController(Page*, GeolocationClient*); ~GeolocationController(); diff --git a/Source/WebCore/page/GroupSettings.h b/Source/WebCore/page/GroupSettings.h index fb6f6b5..1bbad2b 100644 --- a/Source/WebCore/page/GroupSettings.h +++ b/Source/WebCore/page/GroupSettings.h @@ -33,7 +33,8 @@ namespace WebCore { class PageGroup; -class GroupSettings : public Noncopyable { +class GroupSettings { + WTF_MAKE_NONCOPYABLE(GroupSettings); WTF_MAKE_FAST_ALLOCATED; public: static PassOwnPtr<GroupSettings> create() { diff --git a/Source/WebCore/page/Page.h b/Source/WebCore/page/Page.h index 7413bb6..071b142 100644 --- a/Source/WebCore/page/Page.h +++ b/Source/WebCore/page/Page.h @@ -90,12 +90,15 @@ namespace WebCore { enum FindDirection { FindDirectionForward, FindDirectionBackward }; - class Page : public Noncopyable { + class Page { + WTF_MAKE_NONCOPYABLE(Page); public: static void scheduleForcedStyleRecalcForAllPages(); // It is up to the platform to ensure that non-null clients are provided where required. - struct PageClients : Noncopyable { + struct PageClients { + WTF_MAKE_NONCOPYABLE(PageClients); WTF_MAKE_FAST_ALLOCATED; + public: PageClients(); ~PageClients(); diff --git a/Source/WebCore/page/PageGroup.cpp b/Source/WebCore/page/PageGroup.cpp index 746cd04..96e7301 100644 --- a/Source/WebCore/page/PageGroup.cpp +++ b/Source/WebCore/page/PageGroup.cpp @@ -37,7 +37,7 @@ #include "StorageNamespace.h" #if PLATFORM(CHROMIUM) -#include "ChromiumBridge.h" +#include "PlatformBridge.h" #endif #ifdef ANDROID @@ -218,7 +218,7 @@ bool PageGroup::isLinkVisited(LinkHash visitedLinkHash) { #if PLATFORM(CHROMIUM) // Use Chromium's built-in visited link database. - return ChromiumBridge::isLinkVisited(visitedLinkHash); + return PlatformBridge::isLinkVisited(visitedLinkHash); #else if (!m_visitedLinksPopulated) { m_visitedLinksPopulated = true; diff --git a/Source/WebCore/page/PageGroup.h b/Source/WebCore/page/PageGroup.h index 0c4b26f..aa600a5 100644 --- a/Source/WebCore/page/PageGroup.h +++ b/Source/WebCore/page/PageGroup.h @@ -41,7 +41,8 @@ namespace WebCore { class Page; class StorageNamespace; - class PageGroup : public Noncopyable { + class PageGroup { + WTF_MAKE_NONCOPYABLE(PageGroup); WTF_MAKE_FAST_ALLOCATED; public: PageGroup(const String& name); PageGroup(Page*); diff --git a/Source/WebCore/page/PageGroupLoadDeferrer.h b/Source/WebCore/page/PageGroupLoadDeferrer.h index d443ebd..f7956c4 100644 --- a/Source/WebCore/page/PageGroupLoadDeferrer.h +++ b/Source/WebCore/page/PageGroupLoadDeferrer.h @@ -28,7 +28,8 @@ namespace WebCore { class Frame; class Page; - class PageGroupLoadDeferrer : public Noncopyable { + class PageGroupLoadDeferrer { + WTF_MAKE_NONCOPYABLE(PageGroupLoadDeferrer); public: PageGroupLoadDeferrer(Page*, bool deferSelf); ~PageGroupLoadDeferrer(); diff --git a/Source/WebCore/page/PluginHalter.h b/Source/WebCore/page/PluginHalter.h index af8b31e..5b96d19 100644 --- a/Source/WebCore/page/PluginHalter.h +++ b/Source/WebCore/page/PluginHalter.h @@ -35,7 +35,8 @@ namespace WebCore { class HaltablePlugin; -class PluginHalter : public Noncopyable { +class PluginHalter { + WTF_MAKE_NONCOPYABLE(PluginHalter); WTF_MAKE_FAST_ALLOCATED; public: PluginHalter(PluginHalterClient*); diff --git a/Source/WebCore/page/Settings.cpp b/Source/WebCore/page/Settings.cpp index 8b174be..a88ca6b 100644 --- a/Source/WebCore/page/Settings.cpp +++ b/Source/WebCore/page/Settings.cpp @@ -168,6 +168,7 @@ Settings::Settings(Page* page) , m_showRepaintCounter(false) , m_experimentalNotificationsEnabled(false) , m_webGLEnabled(false) + , m_webAudioEnabled(false) , m_acceleratedCanvas2dEnabled(false) , m_loadDeferringEnabled(true) , m_tiledBackingStoreEnabled(false) @@ -857,6 +858,11 @@ void Settings::setShouldUseHighResolutionTimers(bool shouldUseHighResolutionTime } #endif +void Settings::setWebAudioEnabled(bool enabled) +{ + m_webAudioEnabled = enabled; +} + void Settings::setWebGLEnabled(bool enabled) { m_webGLEnabled = enabled; diff --git a/Source/WebCore/page/Settings.h b/Source/WebCore/page/Settings.h index f6b2e2d..9f0982a 100644 --- a/Source/WebCore/page/Settings.h +++ b/Source/WebCore/page/Settings.h @@ -50,7 +50,8 @@ namespace WebCore { TextDirectionSubmenuAlwaysIncluded }; - class Settings : public Noncopyable { + class Settings { + WTF_MAKE_NONCOPYABLE(Settings); WTF_MAKE_FAST_ALLOCATED; public: Settings(Page*); @@ -379,6 +380,9 @@ namespace WebCore { void setPluginAllowedRunTime(unsigned); unsigned pluginAllowedRunTime() const { return m_pluginAllowedRunTime; } + void setWebAudioEnabled(bool); + bool webAudioEnabled() const { return m_webAudioEnabled; } + void setWebGLEnabled(bool); bool webGLEnabled() const { return m_webGLEnabled; } @@ -544,6 +548,7 @@ namespace WebCore { bool m_showRepaintCounter : 1; bool m_experimentalNotificationsEnabled : 1; bool m_webGLEnabled : 1; + bool m_webAudioEnabled : 1; bool m_acceleratedCanvas2dEnabled : 1; bool m_loadDeferringEnabled : 1; bool m_tiledBackingStoreEnabled : 1; diff --git a/Source/WebCore/page/SpeechInput.cpp b/Source/WebCore/page/SpeechInput.cpp index f36ed4d..9605dd3 100644 --- a/Source/WebCore/page/SpeechInput.cpp +++ b/Source/WebCore/page/SpeechInput.cpp @@ -33,7 +33,7 @@ #if ENABLE(INPUT_SPEECH) -#include "Frame.h" +#include "SecurityOrigin.h" #include "SpeechInputClient.h" #include "SpeechInputListener.h" @@ -93,10 +93,10 @@ void SpeechInput::setRecognitionResult(int listenerId, const SpeechInputResultAr m_listeners.get(listenerId)->setRecognitionResult(listenerId, result); } -bool SpeechInput::startRecognition(int listenerId, const IntRect& elementRect, const AtomicString& language, const String& grammar) +bool SpeechInput::startRecognition(int listenerId, const IntRect& elementRect, const AtomicString& language, const String& grammar, SecurityOrigin* origin) { ASSERT(m_listeners.contains(listenerId)); - return m_client->startRecognition(listenerId, elementRect, language, grammar); + return m_client->startRecognition(listenerId, elementRect, language, grammar, origin); } void SpeechInput::stopRecording(int listenerId) diff --git a/Source/WebCore/page/SpeechInput.h b/Source/WebCore/page/SpeechInput.h index 4532d49..52d6c03 100644 --- a/Source/WebCore/page/SpeechInput.h +++ b/Source/WebCore/page/SpeechInput.h @@ -36,18 +36,19 @@ #include "SpeechInputListener.h" #include <wtf/Forward.h> #include <wtf/HashMap.h> -#include <wtf/Noncopyable.h> namespace WebCore { class IntRect; +class SecurityOrigin; class SpeechInputClient; class SpeechInputListener; // This class connects the input elements requiring speech input with the platform specific // speech recognition engine. It provides methods for the input elements to activate speech // recognition and methods for the speech recognition engine to return back the results. -class SpeechInput : public Noncopyable, public SpeechInputListener { +class SpeechInput : public SpeechInputListener { + WTF_MAKE_NONCOPYABLE(SpeechInput); public: SpeechInput(SpeechInputClient*); virtual ~SpeechInput(); @@ -61,7 +62,7 @@ public: void unregisterListener(int); // Methods invoked by the input elements. - bool startRecognition(int listenerId, const IntRect& elementRect, const AtomicString& language, const String& grammar); + bool startRecognition(int listenerId, const IntRect& elementRect, const AtomicString& language, const String& grammar, SecurityOrigin*); void stopRecording(int); void cancelRecognition(int); diff --git a/Source/WebCore/page/SpeechInputClient.h b/Source/WebCore/page/SpeechInputClient.h index 2a2e160..4f8fd5e 100644 --- a/Source/WebCore/page/SpeechInputClient.h +++ b/Source/WebCore/page/SpeechInputClient.h @@ -38,6 +38,7 @@ namespace WebCore { class IntRect; +class SecurityOrigin; class SpeechInputListener; // Provides an interface for SpeechInput to call into the embedder. @@ -50,7 +51,7 @@ public: virtual void setListener(SpeechInputListener*) = 0; // Starts speech recognition and audio recording. - virtual bool startRecognition(int requestId, const IntRect& elementRect, const AtomicString& language, const String& grammar) = 0; + virtual bool startRecognition(int requestId, const IntRect& elementRect, const AtomicString& language, const String& grammar, SecurityOrigin*) = 0; // Stops audio recording and performs recognition with the audio recorded until now // (does not discard audio). diff --git a/Source/WebCore/page/UserScript.h b/Source/WebCore/page/UserScript.h index 0652439..0514090 100644 --- a/Source/WebCore/page/UserScript.h +++ b/Source/WebCore/page/UserScript.h @@ -35,7 +35,8 @@ namespace WebCore { -class UserScript : public Noncopyable { +class UserScript { + WTF_MAKE_NONCOPYABLE(UserScript); WTF_MAKE_FAST_ALLOCATED; public: UserScript(const String& source, const KURL& url, PassOwnPtr<Vector<String> > whitelist, PassOwnPtr<Vector<String> > blacklist, diff --git a/Source/WebCore/page/UserStyleSheet.h b/Source/WebCore/page/UserStyleSheet.h index fa42e2c..068df1e 100644 --- a/Source/WebCore/page/UserStyleSheet.h +++ b/Source/WebCore/page/UserStyleSheet.h @@ -35,7 +35,8 @@ namespace WebCore { -class UserStyleSheet : public Noncopyable { +class UserStyleSheet { + WTF_MAKE_NONCOPYABLE(UserStyleSheet); WTF_MAKE_FAST_ALLOCATED; public: UserStyleSheet(const String& source, const KURL& url, PassOwnPtr<Vector<String> > whitelist, PassOwnPtr<Vector<String> > blacklist, diff --git a/Source/WebCore/page/XSSAuditor.h b/Source/WebCore/page/XSSAuditor.h index 2b781f1..5beed61 100644 --- a/Source/WebCore/page/XSSAuditor.h +++ b/Source/WebCore/page/XSSAuditor.h @@ -69,7 +69,8 @@ namespace WebCore { // * HTMLDocumentParser::shouldLoadExternalScriptFromSrc - used to load external JavaScript scripts. // * SubframeLoader::requestObject - used to load <object>/<embed> elements. // - class XSSAuditor : public Noncopyable { + class XSSAuditor { + WTF_MAKE_NONCOPYABLE(XSSAuditor); WTF_MAKE_FAST_ALLOCATED; public: XSSAuditor(Frame*); ~XSSAuditor(); diff --git a/Source/WebCore/page/animation/AnimationBase.cpp b/Source/WebCore/page/animation/AnimationBase.cpp index 14a44d2..9a906e2 100644 --- a/Source/WebCore/page/animation/AnimationBase.cpp +++ b/Source/WebCore/page/animation/AnimationBase.cpp @@ -223,7 +223,8 @@ class PropertyWrapperBase; static void addShorthandProperties(); static PropertyWrapperBase* wrapperForProperty(int propertyID); -class PropertyWrapperBase : public Noncopyable { +class PropertyWrapperBase { + WTF_MAKE_NONCOPYABLE(PropertyWrapperBase); WTF_MAKE_FAST_ALLOCATED; public: PropertyWrapperBase(int prop) : m_prop(prop) @@ -446,7 +447,8 @@ public: }; template <typename T> -class FillLayerPropertyWrapperGetter : public FillLayerPropertyWrapperBase, public Noncopyable { +class FillLayerPropertyWrapperGetter : public FillLayerPropertyWrapperBase { + WTF_MAKE_NONCOPYABLE(FillLayerPropertyWrapperGetter); public: FillLayerPropertyWrapperGetter(T (FillLayer::*getter)() const) : m_getter(getter) diff --git a/Source/WebCore/page/animation/AnimationControllerPrivate.h b/Source/WebCore/page/animation/AnimationControllerPrivate.h index 6812e09..186dd7d 100644 --- a/Source/WebCore/page/animation/AnimationControllerPrivate.h +++ b/Source/WebCore/page/animation/AnimationControllerPrivate.h @@ -49,7 +49,8 @@ class Node; class RenderObject; class RenderStyle; -class AnimationControllerPrivate : public Noncopyable { +class AnimationControllerPrivate { + WTF_MAKE_NONCOPYABLE(AnimationControllerPrivate); WTF_MAKE_FAST_ALLOCATED; public: AnimationControllerPrivate(Frame*); ~AnimationControllerPrivate(); diff --git a/Source/WebCore/page/mac/EventHandlerMac.mm b/Source/WebCore/page/mac/EventHandlerMac.mm index 2d4d86b..6011859 100644 --- a/Source/WebCore/page/mac/EventHandlerMac.mm +++ b/Source/WebCore/page/mac/EventHandlerMac.mm @@ -77,7 +77,8 @@ NSEvent *EventHandler::currentNSEvent() return currentNSEventSlot().get(); } -class CurrentEventScope : public Noncopyable { +class CurrentEventScope { + WTF_MAKE_NONCOPYABLE(CurrentEventScope); public: CurrentEventScope(NSEvent *); ~CurrentEventScope(); diff --git a/Source/WebCore/platform/AsyncFileSystem.h b/Source/WebCore/platform/AsyncFileSystem.h index d96c1ad..c34a644 100644 --- a/Source/WebCore/platform/AsyncFileSystem.h +++ b/Source/WebCore/platform/AsyncFileSystem.h @@ -44,7 +44,8 @@ class AsyncFileSystemCallbacks; class AsyncFileWriterClient; // This class provides async interface for platform-specific file system implementation. Note that all the methods take platform paths. -class AsyncFileSystem : public Noncopyable { +class AsyncFileSystem { + WTF_MAKE_NONCOPYABLE(AsyncFileSystem); public: virtual ~AsyncFileSystem() { } diff --git a/Source/WebCore/platform/AsyncFileSystemCallbacks.h b/Source/WebCore/platform/AsyncFileSystemCallbacks.h index 290a669..cee8d90 100644 --- a/Source/WebCore/platform/AsyncFileSystemCallbacks.h +++ b/Source/WebCore/platform/AsyncFileSystemCallbacks.h @@ -41,8 +41,11 @@ class AsyncFileSystem; class AsyncFileWriter; struct FileMetadata; -class AsyncFileSystemCallbacks : public Noncopyable { +class AsyncFileSystemCallbacks { + WTF_MAKE_NONCOPYABLE(AsyncFileSystemCallbacks); public: + AsyncFileSystemCallbacks() { } + // Called when a requested operation is completed successfully. virtual void didSucceed() = 0; diff --git a/Source/WebCore/platform/AutodrainedPool.h b/Source/WebCore/platform/AutodrainedPool.h index d44ee1e..f03ec81 100644 --- a/Source/WebCore/platform/AutodrainedPool.h +++ b/Source/WebCore/platform/AutodrainedPool.h @@ -39,7 +39,8 @@ class NSAutoreleasePool; namespace WebCore { -class AutodrainedPool : public Noncopyable { +class AutodrainedPool { + WTF_MAKE_NONCOPYABLE(AutodrainedPool); public: AutodrainedPool(int iterationLimit = 1); ~AutodrainedPool(); diff --git a/Source/WebCore/platform/ContextMenu.h b/Source/WebCore/platform/ContextMenu.h index 575c86d..2977749 100644 --- a/Source/WebCore/platform/ContextMenu.h +++ b/Source/WebCore/platform/ContextMenu.h @@ -41,8 +41,8 @@ namespace WebCore { class ContextMenuController; - class ContextMenu : public Noncopyable - { + class ContextMenu { + WTF_MAKE_NONCOPYABLE(ContextMenu); WTF_MAKE_FAST_ALLOCATED; public: ContextMenu(); diff --git a/Source/WebCore/platform/ContextMenuItem.h b/Source/WebCore/platform/ContextMenuItem.h index 145d795..6e84131 100644 --- a/Source/WebCore/platform/ContextMenuItem.h +++ b/Source/WebCore/platform/ContextMenuItem.h @@ -223,7 +223,8 @@ namespace WebCore { typedef void* PlatformMenuItemDescription; #endif - class ContextMenuItem : public FastAllocBase { + class ContextMenuItem { + WTF_MAKE_FAST_ALLOCATED; public: ContextMenuItem(ContextMenuItemType, ContextMenuAction, const String&, ContextMenu* subMenu = 0); ContextMenuItem(ContextMenuItemType, ContextMenuAction, const String&, bool enabled, bool checked); diff --git a/Source/WebCore/platform/DeprecatedPtrList.h b/Source/WebCore/platform/DeprecatedPtrList.h index 47cd538..c07d173 100644 --- a/Source/WebCore/platform/DeprecatedPtrList.h +++ b/Source/WebCore/platform/DeprecatedPtrList.h @@ -33,7 +33,8 @@ namespace WebCore { template <class T> class DeprecatedPtrListIterator; -template <class T> class DeprecatedPtrList : public FastAllocBase { +template <class T> class DeprecatedPtrList { + WTF_MAKE_FAST_ALLOCATED; public: DeprecatedPtrList() : impl(deleteFunc), del_item(false) { } ~DeprecatedPtrList() { impl.clear(del_item); } diff --git a/Source/WebCore/platform/DeprecatedPtrListImpl.cpp b/Source/WebCore/platform/DeprecatedPtrListImpl.cpp index 96fd513..c633741 100644 --- a/Source/WebCore/platform/DeprecatedPtrListImpl.cpp +++ b/Source/WebCore/platform/DeprecatedPtrListImpl.cpp @@ -29,12 +29,13 @@ #include <cstddef> #include <algorithm> #include <wtf/Assertions.h> +#include <wtf/FastAllocBase.h> #include <wtf/Noncopyable.h> namespace WebCore { -class DeprecatedListNode : public Noncopyable -{ +class DeprecatedListNode { + WTF_MAKE_NONCOPYABLE(DeprecatedListNode); WTF_MAKE_FAST_ALLOCATED; public: DeprecatedListNode(void *d) : data(d), next(0), prev(0) { } diff --git a/Source/WebCore/platform/EventLoop.h b/Source/WebCore/platform/EventLoop.h index b0507f7..128e92b 100644 --- a/Source/WebCore/platform/EventLoop.h +++ b/Source/WebCore/platform/EventLoop.h @@ -30,7 +30,8 @@ namespace WebCore { - class EventLoop : public Noncopyable { + class EventLoop { + WTF_MAKE_NONCOPYABLE(EventLoop); public: EventLoop() : m_ended(false) diff --git a/Source/WebCore/platform/GeolocationService.h b/Source/WebCore/platform/GeolocationService.h index 2cb70f2..cf51b1e 100644 --- a/Source/WebCore/platform/GeolocationService.h +++ b/Source/WebCore/platform/GeolocationService.h @@ -42,7 +42,8 @@ public: virtual void geolocationServiceErrorOccurred(GeolocationService*) = 0; }; -class GeolocationService : public Noncopyable { +class GeolocationService { + WTF_MAKE_NONCOPYABLE(GeolocationService); public: static GeolocationService* create(GeolocationServiceClient*); virtual ~GeolocationService() { } diff --git a/Source/WebCore/platform/HostWindow.h b/Source/WebCore/platform/HostWindow.h index 7882d48..0d19356 100644 --- a/Source/WebCore/platform/HostWindow.h +++ b/Source/WebCore/platform/HostWindow.h @@ -26,15 +26,16 @@ #ifndef HostWindow_h #define HostWindow_h -#include <wtf/Noncopyable.h> #include "Widget.h" namespace WebCore { class Cursor; -class HostWindow : public Noncopyable { +class HostWindow { + WTF_MAKE_NONCOPYABLE(HostWindow); WTF_MAKE_FAST_ALLOCATED; public: + HostWindow() { } virtual ~HostWindow() { } // Requests the host invalidate the window, not the contents. If immediate is true do so synchronously, otherwise async. @@ -66,6 +67,10 @@ public: // Request that the cursor change. virtual void setCursor(const Cursor&) = 0; + +#if ENABLE(REQUEST_ANIMATION_FRAME) + virtual void scheduleAnimation() = 0; +#endif }; } // namespace WebCore diff --git a/Source/WebCore/platform/KillRing.h b/Source/WebCore/platform/KillRing.h index 8e27350..b687274 100644 --- a/Source/WebCore/platform/KillRing.h +++ b/Source/WebCore/platform/KillRing.h @@ -31,6 +31,7 @@ namespace WebCore { class KillRing { + WTF_MAKE_FAST_ALLOCATED; public: void append(const String&); void prepend(const String&); diff --git a/Source/WebCore/platform/Length.h b/Source/WebCore/platform/Length.h index 7dd875e..9da71c7 100644 --- a/Source/WebCore/platform/Length.h +++ b/Source/WebCore/platform/Length.h @@ -35,7 +35,9 @@ const int intMinForLength = (-0x7ffffff - 1); // min value for a 28-bit int enum LengthType { Auto, Relative, Percent, Fixed, Static, Intrinsic, MinIntrinsic }; -struct Length : FastAllocBase { +struct Length { + WTF_MAKE_FAST_ALLOCATED; +public: Length() : m_value(0) { diff --git a/Source/WebCore/platform/Pasteboard.h b/Source/WebCore/platform/Pasteboard.h index 78a40b3..50a9cb6 100644 --- a/Source/WebCore/platform/Pasteboard.h +++ b/Source/WebCore/platform/Pasteboard.h @@ -81,7 +81,8 @@ class Node; class Range; class ArchiveResource; -class Pasteboard : public Noncopyable { +class Pasteboard { + WTF_MAKE_NONCOPYABLE(Pasteboard); WTF_MAKE_FAST_ALLOCATED; public: #if PLATFORM(MAC) //Helper functions to allow Clipboard to share code diff --git a/Source/WebCore/platform/PlatformKeyboardEvent.h b/Source/WebCore/platform/PlatformKeyboardEvent.h index 7ce7017..eb144f7 100644 --- a/Source/WebCore/platform/PlatformKeyboardEvent.h +++ b/Source/WebCore/platform/PlatformKeyboardEvent.h @@ -75,7 +75,8 @@ typedef unsigned long int uint32; namespace WebCore { - class PlatformKeyboardEvent : public FastAllocBase { + class PlatformKeyboardEvent { + WTF_MAKE_FAST_ALLOCATED; public: enum Type { // KeyDown is sent by platforms such as Mac OS X, gtk and Qt, and has information about both physical pressed key, and its translation. diff --git a/Source/WebCore/platform/PopupMenuClient.h b/Source/WebCore/platform/PopupMenuClient.h index 45912a1..f33b9e2 100644 --- a/Source/WebCore/platform/PopupMenuClient.h +++ b/Source/WebCore/platform/PopupMenuClient.h @@ -32,7 +32,7 @@ class Color; class FontSelector; class HostWindow; class Scrollbar; -class ScrollbarClient; +class ScrollableArea; class PopupMenuClient { public: @@ -66,7 +66,7 @@ public: virtual FontSelector* fontSelector() const = 0; virtual HostWindow* hostWindow() const = 0; - virtual PassRefPtr<Scrollbar> createScrollbar(ScrollbarClient*, ScrollbarOrientation, ScrollbarControlSize) = 0; + virtual PassRefPtr<Scrollbar> createScrollbar(ScrollableArea*, ScrollbarOrientation, ScrollbarControlSize) = 0; }; #if ENABLE(NO_LISTBOX_RENDERING) diff --git a/Source/WebCore/platform/PurgeableBuffer.h b/Source/WebCore/platform/PurgeableBuffer.h index 9bda2d5..44136c2 100644 --- a/Source/WebCore/platform/PurgeableBuffer.h +++ b/Source/WebCore/platform/PurgeableBuffer.h @@ -27,13 +27,13 @@ #define PurgeableBuffer_h #include "PurgePriority.h" -#include <wtf/Noncopyable.h> #include <wtf/PassOwnPtr.h> #include <wtf/Vector.h> namespace WebCore { - class PurgeableBuffer : public Noncopyable { + class PurgeableBuffer { + WTF_MAKE_NONCOPYABLE(PurgeableBuffer); public: static PassOwnPtr<PurgeableBuffer> create(const char* data, size_t); diff --git a/Source/WebCore/platform/RunLoopTimer.h b/Source/WebCore/platform/RunLoopTimer.h index 65f253e..f8c529f 100644 --- a/Source/WebCore/platform/RunLoopTimer.h +++ b/Source/WebCore/platform/RunLoopTimer.h @@ -30,15 +30,16 @@ #define RunLoopTimer_h #include "SchedulePair.h" -#include <wtf/Noncopyable.h> #include <wtf/RetainPtr.h> namespace WebCore { // Time intervals are all in seconds. -class RunLoopTimerBase : public Noncopyable { +class RunLoopTimerBase { + WTF_MAKE_NONCOPYABLE(RunLoopTimerBase); public: + RunLoopTimerBase() { } virtual ~RunLoopTimerBase(); void schedule(const SchedulePair*); diff --git a/Source/WebCore/platform/ScrollAnimator.cpp b/Source/WebCore/platform/ScrollAnimator.cpp index 583e833..428a79d 100644 --- a/Source/WebCore/platform/ScrollAnimator.cpp +++ b/Source/WebCore/platform/ScrollAnimator.cpp @@ -31,20 +31,22 @@ #include "config.h" #include "ScrollAnimator.h" -#include "ScrollbarClient.h" +#include "FloatPoint.h" +#include "ScrollableArea.h" #include <algorithm> +#include <wtf/PassOwnPtr.h> namespace WebCore { #if !ENABLE(SMOOTH_SCROLLING) -ScrollAnimator* ScrollAnimator::create(ScrollbarClient* client) +PassOwnPtr<ScrollAnimator> ScrollAnimator::create(ScrollableArea* scrollableArea) { - return new ScrollAnimator(client); + return adoptPtr(new ScrollAnimator(scrollableArea)); } #endif -ScrollAnimator::ScrollAnimator(ScrollbarClient* client) - : m_client(client) +ScrollAnimator::ScrollAnimator(ScrollableArea* scrollableArea) + : m_scrollableArea(scrollableArea) , m_currentPosX(0) , m_currentPosY(0) { @@ -57,20 +59,33 @@ ScrollAnimator::~ScrollAnimator() bool ScrollAnimator::scroll(ScrollbarOrientation orientation, ScrollGranularity, float step, float multiplier) { float* currentPos = (orientation == HorizontalScrollbar) ? &m_currentPosX : &m_currentPosY; - float newPos = std::max(std::min(*currentPos + (step * multiplier), static_cast<float>(m_client->scrollSize(orientation))), 0.0f); + float newPos = std::max(std::min(*currentPos + (step * multiplier), static_cast<float>(m_scrollableArea->scrollSize(orientation))), 0.0f); if (*currentPos == newPos) return false; *currentPos = newPos; - m_client->setScrollOffsetFromAnimation(IntPoint(m_currentPosX, m_currentPosY)); + + notityPositionChanged(); + return true; } -void ScrollAnimator::setScrollPositionAndStopAnimation(ScrollbarOrientation orientation, float pos) +void ScrollAnimator::scrollToOffsetWithoutAnimation(const FloatPoint& offset) +{ + if (m_currentPosX != offset.x() || m_currentPosY != offset.y()) { + m_currentPosX = offset.x(); + m_currentPosY = offset.y(); + notityPositionChanged(); + } +} + +FloatPoint ScrollAnimator::currentPosition() const +{ + return FloatPoint(m_currentPosX, m_currentPosY); +} + +void ScrollAnimator::notityPositionChanged() { - if (orientation == HorizontalScrollbar) - m_currentPosX = pos; - else - m_currentPosY = pos; + m_scrollableArea->setScrollOffsetFromAnimation(IntPoint(m_currentPosX, m_currentPosY)); } } // namespace WebCore diff --git a/Source/WebCore/platform/ScrollAnimator.h b/Source/WebCore/platform/ScrollAnimator.h index e674339..155c6e5 100644 --- a/Source/WebCore/platform/ScrollAnimator.h +++ b/Source/WebCore/platform/ScrollAnimator.h @@ -32,16 +32,17 @@ #define ScrollAnimator_h #include "ScrollTypes.h" +#include <wtf/Forward.h> namespace WebCore { -class ScrollbarClient; +class FloatPoint; +class ScrollableArea; class ScrollAnimator { public: - static ScrollAnimator* create(ScrollbarClient*); + static PassOwnPtr<ScrollAnimator> create(ScrollableArea*); - ScrollAnimator(ScrollbarClient* client); virtual ~ScrollAnimator(); // Computes a scroll destination for the given parameters. Returns false if @@ -50,16 +51,20 @@ public: // The base class implementation always scrolls immediately, never animates. virtual bool scroll(ScrollbarOrientation, ScrollGranularity, float step, float multiplier); - // Stops any animation in the given direction and updates the ScrollAnimator - // with the current scroll position. This does not cause a callback to the - // ScrollbarClient. - virtual void setScrollPositionAndStopAnimation(ScrollbarOrientation, float); + virtual void scrollToOffsetWithoutAnimation(const FloatPoint&); + + FloatPoint currentPosition() const; protected: - ScrollbarClient* m_client; + ScrollAnimator(ScrollableArea*); + + void notityPositionChanged(); + + ScrollableArea* m_scrollableArea; float m_currentPosX; // We avoid using a FloatPoint in order to reduce float m_currentPosY; // subclass code complexity. }; } // namespace WebCore -#endif + +#endif // ScrollAnimator_h diff --git a/Source/WebCore/platform/ScrollAnimatorWin.cpp b/Source/WebCore/platform/ScrollAnimatorWin.cpp index 025aa71..47a00cb 100644 --- a/Source/WebCore/platform/ScrollAnimatorWin.cpp +++ b/Source/WebCore/platform/ScrollAnimatorWin.cpp @@ -34,17 +34,18 @@ #include "ScrollAnimatorWin.h" -#include "ScrollbarClient.h" +#include "FloatPoint.h" +#include "ScrollableArea.h" #include "ScrollbarTheme.h" #include <algorithm> #include <wtf/CurrentTime.h> +#include <wtf/PassOwnPtr.h> namespace WebCore { -// static -ScrollAnimator* ScrollAnimator::create(ScrollbarClient* client) +PassOwnPtr<ScrollAnimator> ScrollAnimator::create(ScrollableArea* scrollableArea) { - return new ScrollAnimatorWin(client); + return adoptPtr(new ScrollAnimatorWin(scrollableArea)); } const double ScrollAnimatorWin::animationTimerDelay = 0.01; @@ -60,8 +61,8 @@ ScrollAnimatorWin::PerAxisData::PerAxisData(ScrollAnimatorWin* parent, float* cu } -ScrollAnimatorWin::ScrollAnimatorWin(ScrollbarClient* client) - : ScrollAnimator(client) +ScrollAnimatorWin::ScrollAnimatorWin(ScrollableArea* scrollableArea) + : ScrollAnimator(scrollableArea) , m_horizontalData(this, &m_currentPosX) , m_verticalData(this, &m_currentPosY) { @@ -81,7 +82,7 @@ bool ScrollAnimatorWin::scroll(ScrollbarOrientation orientation, ScrollGranulari // This is an animatable scroll. Calculate the scroll delta. PerAxisData* data = (orientation == VerticalScrollbar) ? &m_verticalData : &m_horizontalData; - float newPos = std::max(std::min(data->m_desiredPos + (step * multiplier), static_cast<float>(m_client->scrollSize(orientation))), 0.0f); + float newPos = std::max(std::min(data->m_desiredPos + (step * multiplier), static_cast<float>(m_scrollableArea->scrollSize(orientation))), 0.0f); if (newPos == data->m_desiredPos) return false; data->m_desiredPos = newPos; @@ -177,17 +178,24 @@ bool ScrollAnimatorWin::scroll(ScrollbarOrientation orientation, ScrollGranulari return true; } -void ScrollAnimatorWin::setScrollPositionAndStopAnimation(ScrollbarOrientation orientation, float pos) +void ScrollAnimatorWin::scrollToOffsetWithoutAnimation(const FloatPoint& offset) { - PerAxisData* data = (orientation == HorizontalScrollbar) ? &m_horizontalData : &m_verticalData; - stopAnimationTimerIfNeeded(data); - *data->m_currentPos = pos; - data->m_desiredPos = pos; - data->m_currentVelocity = 0; - data->m_desiredVelocity = 0; + stopAnimationTimerIfNeeded(&m_horizontalData); + stopAnimationTimerIfNeeded(&m_verticalData); + + *m_horizontalData.m_currentPos = offset.x(); + m_horizontalData.m_desiredPos = offset.x(); + m_horizontalData.m_currentVelocity = 0; + m_horizontalData.m_desiredVelocity = 0; + + *m_verticalData.m_currentPos = offset.y(); + m_verticalData.m_desiredPos = offset.y(); + m_verticalData.m_currentVelocity = 0; + m_verticalData.m_desiredVelocity = 0; + + notityPositionChanged(); } -// static double ScrollAnimatorWin::accelerationTime() { // We elect to use ScrollbarTheme::nativeTheme()->autoscrollTimerDelay() as @@ -293,7 +301,8 @@ void ScrollAnimatorWin::animateScroll(PerAxisData* data) data->m_animationTimer.startOneShot(animationTimerDelay); data->m_lastAnimationTime = WTF::currentTime(); } - m_client->setScrollOffsetFromAnimation(IntPoint(*m_horizontalData.m_currentPos, *m_verticalData.m_currentPos)); + + notityPositionChanged(); } } // namespace WebCore diff --git a/Source/WebCore/platform/ScrollAnimatorWin.h b/Source/WebCore/platform/ScrollAnimatorWin.h index 7043634..6f87e58 100644 --- a/Source/WebCore/platform/ScrollAnimatorWin.h +++ b/Source/WebCore/platform/ScrollAnimatorWin.h @@ -40,11 +40,11 @@ namespace WebCore { class ScrollAnimatorWin : public ScrollAnimator { public: - ScrollAnimatorWin(ScrollbarClient*); + ScrollAnimatorWin(ScrollableArea*); virtual ~ScrollAnimatorWin(); virtual bool scroll(ScrollbarOrientation, ScrollGranularity, float step, float multiplier); - virtual void setScrollPositionAndStopAnimation(ScrollbarOrientation, float); + virtual void scrollToOffsetWithoutAnimation(const FloatPoint&); private: struct PerAxisData { @@ -69,8 +69,8 @@ private: PerAxisData m_verticalData; }; -} +} // namespace WebCore #endif // ENABLE(SMOOTH_SCROLLING) -#endif +#endif // ScrollAnimatorWin_h diff --git a/Source/WebCore/platform/ScrollView.cpp b/Source/WebCore/platform/ScrollView.cpp index 6ea60df..b07c743 100644 --- a/Source/WebCore/platform/ScrollView.cpp +++ b/Source/WebCore/platform/ScrollView.cpp @@ -229,9 +229,15 @@ IntRect ScrollView::visibleContentRect(bool includeScrollbars) const if (paintsEntireContents()) return IntRect(IntPoint(0, 0), contentsSize()); + bool hasOverlayScrollbars = ScrollbarTheme::nativeTheme()->usesOverlayScrollbars(); + int verticalScrollbarWidth = verticalScrollbar() && !hasOverlayScrollbars && !includeScrollbars + ? verticalScrollbar()->width() : 0; + int horizontalScrollbarHeight = horizontalScrollbar() && !hasOverlayScrollbars && !includeScrollbars + ? horizontalScrollbar()->height() : 0; + return IntRect(IntPoint(m_scrollOffset.width(), m_scrollOffset.height()), - IntSize(max(0, width() - (verticalScrollbar() && !includeScrollbars ? verticalScrollbar()->width() : 0)), - max(0, height() - (horizontalScrollbar() && !includeScrollbars ? horizontalScrollbar()->height() : 0)))); + IntSize(max(0, width() - verticalScrollbarWidth), + max(0, height() - horizontalScrollbarHeight))); } #endif @@ -344,25 +350,20 @@ int ScrollView::scrollSize(ScrollbarOrientation orientation) const return scrollbar ? (scrollbar->totalSize() - scrollbar->visibleSize()) : 0; } -void ScrollView::setScrollOffsetFromAnimation(const IntPoint& offset) +void ScrollView::setScrollOffset(const IntPoint& offset) { - if (m_horizontalScrollbar) - m_horizontalScrollbar->setValue(offset.x(), Scrollbar::FromScrollAnimator); - if (m_verticalScrollbar) - m_verticalScrollbar->setValue(offset.y(), Scrollbar::FromScrollAnimator); -} + int horizontalOffset = std::max(std::min(offset.x(), contentsWidth() - visibleWidth()), 0); + int verticalOffset = std::max(std::min(offset.y(), contentsHeight() - visibleHeight()), 0); -void ScrollView::valueChanged(Scrollbar* scrollbar) -{ - // Figure out if we really moved. IntSize newOffset = m_scrollOffset; - if (scrollbar) { - if (scrollbar->orientation() == HorizontalScrollbar) - newOffset.setWidth(scrollbar->value() - m_scrollOrigin.x()); - else if (scrollbar->orientation() == VerticalScrollbar) - newOffset.setHeight(scrollbar->value() - m_scrollOrigin.y()); - } + newOffset.setWidth(horizontalOffset - m_scrollOrigin.x()); + newOffset.setHeight(verticalOffset - m_scrollOrigin.y()); + + scrollTo(newOffset); +} +void ScrollView::scrollTo(const IntSize& newOffset) +{ IntSize scrollDelta = newOffset - m_scrollOffset; if (scrollDelta == IntSize()) return; @@ -375,13 +376,13 @@ void ScrollView::valueChanged(Scrollbar* scrollbar) scrollContents(scrollDelta); } -void ScrollView::valueChanged(const IntSize& scrollDelta) +int ScrollView::scrollPosition(Scrollbar* scrollbar) const { - if (scrollbarsSuppressed()) - return; - - repaintFixedElementsAfterScrolling(); - scrollContents(scrollDelta); + if (scrollbar->orientation() == HorizontalScrollbar) + return scrollPosition().x() + m_scrollOrigin.x(); + if (scrollbar->orientation() == VerticalScrollbar) + return scrollPosition().y() + m_scrollOrigin.y(); + return 0; } void ScrollView::setScrollPosition(const IntPoint& scrollPoint) @@ -415,15 +416,8 @@ bool ScrollView::scroll(ScrollDirection direction, ScrollGranularity granularity { if (platformWidget()) return platformScroll(direction, granularity); - - if (direction == ScrollUp || direction == ScrollDown) { - if (m_verticalScrollbar) - return m_verticalScrollbar->scroll(direction, granularity); - } else { - if (m_horizontalScrollbar) - return m_horizontalScrollbar->scroll(direction, granularity); - } - return false; + + return ScrollableArea::scroll(direction, granularity); } bool ScrollView::logicalScroll(ScrollLogicalDirection direction, ScrollGranularity granularity) @@ -554,7 +548,6 @@ void ScrollView::updateScrollbars(const IntSize& desiredOffset) m_horizontalScrollbar->setSuppressInvalidation(true); m_horizontalScrollbar->setSteps(Scrollbar::pixelsPerLineStep(), pageStep); m_horizontalScrollbar->setProportion(clientWidth, contentsWidth()); - m_horizontalScrollbar->setValue(scroll.width() + m_scrollOrigin.x(), Scrollbar::NotFromScrollAnimator); if (m_scrollbarsSuppressed) m_horizontalScrollbar->setSuppressInvalidation(false); } @@ -576,7 +569,6 @@ void ScrollView::updateScrollbars(const IntSize& desiredOffset) m_verticalScrollbar->setSuppressInvalidation(true); m_verticalScrollbar->setSteps(Scrollbar::pixelsPerLineStep(), pageStep); m_verticalScrollbar->setProportion(clientHeight, contentsHeight()); - m_verticalScrollbar->setValue(scroll.height() + m_scrollOrigin.y(), Scrollbar::NotFromScrollAnimator); if (m_scrollbarsSuppressed) m_verticalScrollbar->setSuppressInvalidation(false); } @@ -586,15 +578,7 @@ void ScrollView::updateScrollbars(const IntSize& desiredOffset) updateScrollCorner(); } - // See if our offset has changed in a situation where we might not have scrollbars. - // This can happen when editing a body with overflow:hidden and scrolling to reveal selection. - // It can also happen when maximizing a window that has scrollbars (but the new maximized result - // does not). - IntSize scrollDelta = scroll - m_scrollOffset; - if (scrollDelta != IntSize()) { - m_scrollOffset = scroll; - valueChanged(scrollDelta); - } + ScrollableArea::scrollToOffsetWithoutAnimation(FloatPoint(scroll.width() + m_scrollOrigin.x(), scroll.height() + m_scrollOrigin.y())); m_inUpdateScrollbars = false; } @@ -781,6 +765,7 @@ void ScrollView::wheelEvent(PlatformWheelEvent& e) // scroll any further. float deltaX = m_horizontalScrollbar ? e.deltaX() : 0; float deltaY = m_verticalScrollbar ? e.deltaY() : 0; + IntSize maxForwardScrollDelta = maximumScrollPosition() - scrollPosition(); IntSize maxBackwardScrollDelta = scrollPosition() - minimumScrollPosition(); if ((deltaX < 0 && maxForwardScrollDelta.width() > 0) @@ -797,9 +782,9 @@ void ScrollView::wheelEvent(PlatformWheelEvent& e) } if (deltaY) - m_verticalScrollbar->scroll(ScrollUp, ScrollByPixel, deltaY); + ScrollableArea::scroll(ScrollUp, ScrollByPixel, deltaY); if (deltaX) - m_horizontalScrollbar->scroll(ScrollLeft, ScrollByPixel, deltaX); + ScrollableArea::scroll(ScrollLeft, ScrollByPixel, deltaX); } } @@ -857,7 +842,10 @@ void ScrollView::repaintContentRectangle(const IntRect& rect, bool now) IntRect ScrollView::scrollCornerRect() const { IntRect cornerRect; - + + if (ScrollbarTheme::nativeTheme()->usesOverlayScrollbars()) + return cornerRect; + if (m_horizontalScrollbar && width() - m_horizontalScrollbar->width() > 0) { cornerRect.unite(IntRect(m_horizontalScrollbar->width(), height() - m_horizontalScrollbar->height(), diff --git a/Source/WebCore/platform/ScrollView.h b/Source/WebCore/platform/ScrollView.h index 97b2c47..cb895f6 100644 --- a/Source/WebCore/platform/ScrollView.h +++ b/Source/WebCore/platform/ScrollView.h @@ -29,7 +29,7 @@ #include "IntRect.h" #include "Scrollbar.h" -#include "ScrollbarClient.h" +#include "ScrollableArea.h" #include "ScrollTypes.h" #include "Widget.h" @@ -54,16 +54,18 @@ class HostWindow; class PlatformWheelEvent; class Scrollbar; -class ScrollView : public Widget, public ScrollbarClient { +class ScrollView : public Widget, public ScrollableArea { public: ~ScrollView(); - // ScrollbarClient functions. FrameView overrides the others. + // ScrollableArea functions. FrameView overrides the others. virtual int scrollSize(ScrollbarOrientation orientation) const; - virtual void setScrollOffsetFromAnimation(const IntPoint&); - virtual void valueChanged(Scrollbar*); - virtual void valueChanged(const IntSize&); + virtual int scrollPosition(Scrollbar*) const; + virtual void setScrollOffset(const IntPoint&); + // NOTE: This should only be called by the overriden setScrollOffset from ScrollableArea. + virtual void scrollTo(const IntSize& newOffset); + // The window thats hosts the ScrollView. The ScrollView will communicate scrolls and repaints to the // host window in the window's coordinate space. virtual HostWindow* hostWindow() const = 0; @@ -78,8 +80,8 @@ public: // If the scroll view does not use a native widget, then it will have cross-platform Scrollbars. These functions // can be used to obtain those scrollbars. - Scrollbar* horizontalScrollbar() const { return m_horizontalScrollbar.get(); } - Scrollbar* verticalScrollbar() const { return m_verticalScrollbar.get(); } + virtual Scrollbar* horizontalScrollbar() const { return m_horizontalScrollbar.get(); } + virtual Scrollbar* verticalScrollbar() const { return m_verticalScrollbar.get(); } bool isScrollViewScrollbar(const Widget* child) const { return horizontalScrollbar() == child || verticalScrollbar() == child; } // Functions for setting and retrieving the scrolling mode in each axis (horizontal/vertical). The mode has values of diff --git a/Source/WebCore/platform/ScrollableArea.cpp b/Source/WebCore/platform/ScrollableArea.cpp new file mode 100644 index 0000000..176cb7e --- /dev/null +++ b/Source/WebCore/platform/ScrollableArea.cpp @@ -0,0 +1,123 @@ +/* + * Copyright (c) 2010, Google Inc. All rights reserved. + * Copyright (C) 2008, 2011 Apple Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions 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 "ScrollableArea.h" + +#include "FloatPoint.h" +#include "PlatformWheelEvent.h" +#include "ScrollAnimator.h" +#include <wtf/PassOwnPtr.h> + +namespace WebCore { + +ScrollableArea::ScrollableArea() + : m_scrollAnimator(ScrollAnimator::create(this)) +{ +} + +ScrollableArea::~ScrollableArea() +{ +} + +bool ScrollableArea::scroll(ScrollDirection direction, ScrollGranularity granularity, float multiplier) +{ + ScrollbarOrientation orientation; + Scrollbar* scrollbar; + if (direction == ScrollUp || direction == ScrollDown) { + orientation = VerticalScrollbar; + scrollbar = verticalScrollbar(); + } else { + orientation = HorizontalScrollbar; + scrollbar = horizontalScrollbar(); + } + + if (!scrollbar) + return false; + + float step = 0; + switch (granularity) { + case ScrollByLine: + step = scrollbar->lineStep(); + break; + case ScrollByPage: + step = scrollbar->pageStep(); + break; + case ScrollByDocument: + step = scrollbar->totalSize(); + break; + case ScrollByPixel: + step = scrollbar->pixelStep(); + break; + } + + if (direction == ScrollUp || direction == ScrollLeft) + multiplier = -multiplier; + + return m_scrollAnimator->scroll(orientation, granularity, step, multiplier); +} + +void ScrollableArea::scrollToOffsetWithoutAnimation(const FloatPoint& offset) +{ + m_scrollAnimator->scrollToOffsetWithoutAnimation(offset); +} + +void ScrollableArea::scrollToOffsetWithoutAnimation(ScrollbarOrientation orientation, float offset) +{ + if (orientation == HorizontalScrollbar) + scrollToXOffsetWithoutAnimation(offset); + else + scrollToYOffsetWithoutAnimation(offset); +} + +void ScrollableArea::scrollToXOffsetWithoutAnimation(float x) +{ + scrollToOffsetWithoutAnimation(FloatPoint(x, m_scrollAnimator->currentPosition().y())); +} + +void ScrollableArea::scrollToYOffsetWithoutAnimation(float y) +{ + scrollToOffsetWithoutAnimation(FloatPoint(m_scrollAnimator->currentPosition().x(), y)); +} + +void ScrollableArea::setScrollOffsetFromAnimation(const IntPoint& offset) +{ + // Tell the derived class to scroll its contents. + setScrollOffset(offset); + + // Tell the scrollbars to update their thumb postions. + if (Scrollbar* horizontalScrollbar = this->horizontalScrollbar()) + horizontalScrollbar->offsetDidChange(); + if (Scrollbar* verticalScrollbar = this->verticalScrollbar()) + verticalScrollbar->offsetDidChange(); +} + +} // namespace WebCore diff --git a/Source/WebCore/platform/ScrollbarClient.h b/Source/WebCore/platform/ScrollableArea.h index ab3b10e..148ecdb 100644 --- a/Source/WebCore/platform/ScrollbarClient.h +++ b/Source/WebCore/platform/ScrollableArea.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008 Apple Inc. All Rights Reserved. + * Copyright (C) 2008, 2011 Apple Inc. All Rights Reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -23,35 +23,42 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef ScrollbarClient_h -#define ScrollbarClient_h +#ifndef ScrollableArea_h +#define ScrollableArea_h -#include "IntPoint.h" #include "IntRect.h" #include "Scrollbar.h" #include <wtf/Vector.h> namespace WebCore { +class FloatPoint; +class PlatformWheelEvent; class ScrollAnimator; -class ScrollbarClient { +class ScrollableArea { public: - ScrollbarClient(); - virtual ~ScrollbarClient(); + ScrollableArea(); + virtual ~ScrollableArea(); - bool scroll(ScrollbarOrientation orientation, ScrollGranularity granularity, float step, float multiplier); - void setScrollPositionAndStopAnimation(ScrollbarOrientation orientation, float pos); + bool scroll(ScrollDirection, ScrollGranularity, float multiplier = 1); + void scrollToOffsetWithoutAnimation(const FloatPoint&); + void scrollToOffsetWithoutAnimation(ScrollbarOrientation, float offset); + void scrollToXOffsetWithoutAnimation(float x); + void scrollToYOffsetWithoutAnimation(float x); - virtual int scrollSize(ScrollbarOrientation orientation) const = 0; - virtual void setScrollOffsetFromAnimation(const IntPoint&) = 0; - virtual void valueChanged(Scrollbar*) = 0; + virtual int scrollSize(ScrollbarOrientation) const = 0; + virtual int scrollPosition(Scrollbar*) const = 0; virtual void invalidateScrollbarRect(Scrollbar*, const IntRect&) = 0; virtual bool isActive() const = 0; virtual bool scrollbarCornerPresent() const = 0; - virtual void getTickmarks(Vector<IntRect>&) const { } + // This function should be overriden by subclasses to perform the actual + // scroll of the content. + virtual void setScrollOffset(const IntPoint&) = 0; + + // Convert points and rects between the scrollbar and its containing view. // The client needs to implement these in order to be aware of layout effects // like CSS transforms. @@ -72,9 +79,17 @@ public: return scrollbar->Widget::convertFromContainingView(parentPoint); } + virtual Scrollbar* horizontalScrollbar() const { return 0; } + virtual Scrollbar* verticalScrollbar() const { return 0; } + private: + // NOTE: Only called from the ScrollAnimator. + friend class ScrollAnimator; + void setScrollOffsetFromAnimation(const IntPoint&); + OwnPtr<ScrollAnimator> m_scrollAnimator; }; -} -#endif +} // namespace WebCore + +#endif // ScrollableArea_h diff --git a/Source/WebCore/platform/Scrollbar.cpp b/Source/WebCore/platform/Scrollbar.cpp index 7fd2651..4c625f4 100644 --- a/Source/WebCore/platform/Scrollbar.cpp +++ b/Source/WebCore/platform/Scrollbar.cpp @@ -26,14 +26,14 @@ #include "config.h" #include "Scrollbar.h" -#include "AccessibilityScrollbar.h" #include "AXObjectCache.h" +#include "AccessibilityScrollbar.h" #include "EventHandler.h" #include "Frame.h" #include "FrameView.h" #include "GraphicsContext.h" #include "PlatformMouseEvent.h" -#include "ScrollbarClient.h" +#include "ScrollableArea.h" #include "ScrollbarTheme.h" #include <algorithm> @@ -49,9 +49,9 @@ using namespace std; namespace WebCore { #if !PLATFORM(EFL) -PassRefPtr<Scrollbar> Scrollbar::createNativeScrollbar(ScrollbarClient* client, ScrollbarOrientation orientation, ScrollbarControlSize size) +PassRefPtr<Scrollbar> Scrollbar::createNativeScrollbar(ScrollableArea* scrollableArea, ScrollbarOrientation orientation, ScrollbarControlSize size) { - return adoptRef(new Scrollbar(client, orientation, size)); + return adoptRef(new Scrollbar(scrollableArea, orientation, size)); } #endif @@ -61,9 +61,9 @@ int Scrollbar::maxOverlapBetweenPages() return maxOverlapBetweenPages; } -Scrollbar::Scrollbar(ScrollbarClient* client, ScrollbarOrientation orientation, ScrollbarControlSize controlSize, +Scrollbar::Scrollbar(ScrollableArea* scrollableArea, ScrollbarOrientation orientation, ScrollbarControlSize controlSize, ScrollbarTheme* theme) - : m_client(client) + : m_scrollableArea(scrollableArea) , m_orientation(orientation) , m_controlSize(controlSize) , m_theme(theme) @@ -104,13 +104,19 @@ Scrollbar::~Scrollbar() m_theme->unregisterScrollbar(this); } -bool Scrollbar::setValue(int v, ScrollSource source) +void Scrollbar::offsetDidChange() { - v = max(min(v, m_totalSize - m_visibleSize), 0); - if (value() == v) - return false; // Our value stayed the same. - setCurrentPos(v, source); - return true; + ASSERT(m_scrollableArea); + + float position = static_cast<float>(m_scrollableArea->scrollPosition(this)); + if (position == m_currentPos) + return; + + int oldThumbPosition = theme()->thumbPosition(this); + m_currentPos = position; + updateThumbPosition(); + if (m_pressedPart == ThumbPart) + setPressedPos(m_pressedPos + theme()->thumbPosition(this) - oldThumbPosition); } void Scrollbar::setProportion(int visibleSize, int totalSize) @@ -131,31 +137,6 @@ void Scrollbar::setSteps(int lineStep, int pageStep, int pixelsPerStep) m_pixelStep = 1.0f / pixelsPerStep; } -bool Scrollbar::scroll(ScrollDirection direction, ScrollGranularity granularity, float multiplier) -{ -#if HAVE(ACCESSIBILITY) - if (AXObjectCache::accessibilityEnabled() && axObjectCache()) - axObjectCache()->postNotification(axObjectCache()->getOrCreate(this), 0, AXObjectCache::AXValueChanged, true); -#endif - - // Ignore perpendicular scrolls. - if ((m_orientation == HorizontalScrollbar) ? (direction == ScrollUp || direction == ScrollDown) : (direction == ScrollLeft || direction == ScrollRight)) - return false; - float step = 0; - switch (granularity) { - case ScrollByLine: step = m_lineStep; break; - case ScrollByPage: step = m_pageStep; break; - case ScrollByDocument: step = m_totalSize; break; - case ScrollByPixel: step = m_pixelStep; break; - } - if (direction == ScrollUp || direction == ScrollLeft) - multiplier = -multiplier; - if (client()) - return client()->scroll(m_orientation, granularity, step, multiplier); - - return setCurrentPos(max(min(m_currentPos + (step * multiplier), static_cast<float>(m_totalSize - m_visibleSize)), 0.0f), NotFromScrollAnimator); -} - void Scrollbar::updateThumb() { #ifdef THUMB_POSITION_AFFECTS_BUTTONS @@ -215,7 +196,7 @@ void Scrollbar::autoscrollPressedPart(double delay) } // Handle the arrows and track. - if (scroll(pressedPartScrollDirection(), pressedPartScrollGranularity())) + if (scrollableArea()->scroll(pressedPartScrollDirection(), pressedPartScrollGranularity())) startTimerIfNeeded(delay); } @@ -284,28 +265,11 @@ void Scrollbar::moveThumb(int pos) delta = min(maxPos - thumbPos, delta); else if (delta < 0) delta = max(-thumbPos, delta); - if (delta) - setCurrentPos(static_cast<float>(thumbPos + delta) * maximum() / (trackLen - thumbLen), NotFromScrollAnimator); -} - -bool Scrollbar::setCurrentPos(float pos, ScrollSource source) -{ - if ((source != FromScrollAnimator) && client()) - client()->setScrollPositionAndStopAnimation(m_orientation, pos); - - if (pos == m_currentPos) - return false; - - int oldValue = value(); - int oldThumbPos = theme()->thumbPosition(this); - m_currentPos = pos; - updateThumbPosition(); - if (m_pressedPart == ThumbPart) - setPressedPos(m_pressedPos + theme()->thumbPosition(this) - oldThumbPos); - - if (value() != oldValue && client()) - client()->valueChanged(this); - return true; + + if (delta) { + float newPosition = static_cast<float>(thumbPos + delta) * maximum() / (trackLen - thumbLen); + scrollableArea()->scrollToOffsetWithoutAnimation(m_orientation, newPosition); + } } void Scrollbar::setHoveredPart(ScrollbarPart part) @@ -337,7 +301,7 @@ bool Scrollbar::mouseMoved(const PlatformMouseEvent& evt) { if (m_pressedPart == ThumbPart) { if (theme()->shouldSnapBackToDragOrigin(this, evt)) - setCurrentPos(m_dragOrigin, NotFromScrollAnimator); + scrollableArea()->scrollToOffsetWithoutAnimation(m_orientation, m_dragOrigin); else { moveThumb(m_orientation == HorizontalScrollbar ? convertFromContainingWindow(evt.pos()).x() : @@ -469,7 +433,7 @@ void Scrollbar::setEnabled(bool e) bool Scrollbar::isWindowActive() const { - return m_client && m_client->isActive(); + return m_scrollableArea && m_scrollableArea->isActive(); } AXObjectCache* Scrollbar::axObjectCache() const @@ -485,40 +449,40 @@ void Scrollbar::invalidateRect(const IntRect& rect) { if (suppressInvalidation()) return; - if (m_client) - m_client->invalidateScrollbarRect(this, rect); + if (m_scrollableArea) + m_scrollableArea->invalidateScrollbarRect(this, rect); } IntRect Scrollbar::convertToContainingView(const IntRect& localRect) const { - if (m_client) - return m_client->convertFromScrollbarToContainingView(this, localRect); + if (m_scrollableArea) + return m_scrollableArea->convertFromScrollbarToContainingView(this, localRect); return Widget::convertToContainingView(localRect); } IntRect Scrollbar::convertFromContainingView(const IntRect& parentRect) const { - if (m_client) - return m_client->convertFromContainingViewToScrollbar(this, parentRect); + if (m_scrollableArea) + return m_scrollableArea->convertFromContainingViewToScrollbar(this, parentRect); return Widget::convertFromContainingView(parentRect); } IntPoint Scrollbar::convertToContainingView(const IntPoint& localPoint) const { - if (m_client) - return m_client->convertFromScrollbarToContainingView(this, localPoint); + if (m_scrollableArea) + return m_scrollableArea->convertFromScrollbarToContainingView(this, localPoint); return Widget::convertToContainingView(localPoint); } IntPoint Scrollbar::convertFromContainingView(const IntPoint& parentPoint) const { - if (m_client) - return m_client->convertFromContainingViewToScrollbar(this, parentPoint); + if (m_scrollableArea) + return m_scrollableArea->convertFromContainingViewToScrollbar(this, parentPoint); return Widget::convertFromContainingView(parentPoint); } -} +} // namespace WebCore diff --git a/Source/WebCore/platform/Scrollbar.h b/Source/WebCore/platform/Scrollbar.h index 69e94a1..5db191a 100644 --- a/Source/WebCore/platform/Scrollbar.h +++ b/Source/WebCore/platform/Scrollbar.h @@ -36,32 +36,30 @@ namespace WebCore { class GraphicsContext; class IntRect; -class ScrollbarClient; -class ScrollbarTheme; class PlatformMouseEvent; +class ScrollableArea; +class ScrollbarTheme; class Scrollbar : public Widget { public: - enum ScrollSource { - FromScrollAnimator, - NotFromScrollAnimator, - }; + // Must be implemented by platforms that can't simply use the Scrollbar base class. Right now the only platform that is not using the base class is GTK. + static PassRefPtr<Scrollbar> createNativeScrollbar(ScrollableArea*, ScrollbarOrientation orientation, ScrollbarControlSize size); virtual ~Scrollbar(); - // Must be implemented by platforms that can't simply use the Scrollbar base class. Right now the only platform that is not using the base class is GTK. - static PassRefPtr<Scrollbar> createNativeScrollbar(ScrollbarClient* client, ScrollbarOrientation orientation, ScrollbarControlSize size); + // Called by the ScrollableArea when the scroll offset changes. + void offsetDidChange(); static int pixelsPerLineStep() { return 40; } static float minFractionToStepWhenPaging() { return 0.875f; } static int maxOverlapBetweenPages(); - void setClient(ScrollbarClient* client) { m_client = client; } - ScrollbarClient* client() const { return m_client; } + void disconnectFromScrollableArea() { m_scrollableArea = 0; } + ScrollableArea* scrollableArea() const { return m_scrollableArea; } virtual bool isCustomScrollbar() const { return false; } ScrollbarOrientation orientation() const { return m_orientation; } - + int value() const { return lroundf(m_currentPos); } float currentPos() const { return m_currentPos; } int pressedPos() const { return m_pressedPos; } @@ -73,18 +71,15 @@ public: int lineStep() const { return m_lineStep; } int pageStep() const { return m_pageStep; } float pixelStep() const { return m_pixelStep; } - + ScrollbarPart pressedPart() const { return m_pressedPart; } ScrollbarPart hoveredPart() const { return m_hoveredPart; } virtual void setHoveredPart(ScrollbarPart); virtual void setPressedPart(ScrollbarPart); void setSteps(int lineStep, int pageStep, int pixelsPerStep = 1); - bool setValue(int, ScrollSource source); void setProportion(int visibleSize, int totalSize); void setPressedPos(int p) { m_pressedPos = p; } - - bool scroll(ScrollDirection, ScrollGranularity, float multiplier = 1); virtual void paint(GraphicsContext*, const IntRect& damageRect); @@ -130,7 +125,7 @@ public: virtual IntPoint convertFromContainingView(const IntPoint&) const; protected: - Scrollbar(ScrollbarClient*, ScrollbarOrientation, ScrollbarControlSize, ScrollbarTheme* = 0); + Scrollbar(ScrollableArea*, ScrollbarOrientation, ScrollbarControlSize, ScrollbarTheme* = 0); void updateThumb(); virtual void updateThumbPosition(); @@ -145,7 +140,7 @@ protected: void moveThumb(int pos); - ScrollbarClient* m_client; + ScrollableArea* m_scrollableArea; ScrollbarOrientation m_orientation; ScrollbarControlSize m_controlSize; ScrollbarTheme* m_theme; @@ -172,10 +167,8 @@ protected: private: virtual bool isScrollbar() const { return true; } virtual AXObjectCache* axObjectCache() const; - - bool setCurrentPos(float pos, ScrollSource source); }; -} +} // namespace WebCore -#endif +#endif // Scrollbar_h diff --git a/Source/WebCore/platform/ScrollbarTheme.h b/Source/WebCore/platform/ScrollbarTheme.h index 0efaf7a..ef52b0d 100644 --- a/Source/WebCore/platform/ScrollbarTheme.h +++ b/Source/WebCore/platform/ScrollbarTheme.h @@ -36,8 +36,10 @@ class PlatformMouseEvent; class Scrollbar; class ScrollView; -class ScrollbarTheme : public Noncopyable { +class ScrollbarTheme { + WTF_MAKE_NONCOPYABLE(ScrollbarTheme); WTF_MAKE_FAST_ALLOCATED; public: + ScrollbarTheme() { } virtual ~ScrollbarTheme() {}; virtual bool paint(Scrollbar*, GraphicsContext*, const IntRect& /*damageRect*/) { return false; } @@ -48,6 +50,7 @@ public: virtual ScrollbarButtonsPlacement buttonsPlacement() const { return ScrollbarButtonsSingle; } virtual bool supportsControlTints() const { return false; } + virtual bool usesOverlayScrollbars() const { return false; } virtual void themeChanged() {} diff --git a/Source/WebCore/platform/ScrollbarThemeComposite.cpp b/Source/WebCore/platform/ScrollbarThemeComposite.cpp index bf00ebb..7bc266f 100644 --- a/Source/WebCore/platform/ScrollbarThemeComposite.cpp +++ b/Source/WebCore/platform/ScrollbarThemeComposite.cpp @@ -34,7 +34,7 @@ #include "Page.h" #include "PlatformMouseEvent.h" #include "Scrollbar.h" -#include "ScrollbarClient.h" +#include "ScrollableArea.h" #include "Settings.h" namespace WebCore { @@ -104,7 +104,7 @@ bool ScrollbarThemeComposite::paint(Scrollbar* scrollbar, GraphicsContext* graph float proportion = static_cast<float>(scrollbar->visibleSize()) / scrollbar->totalSize(); float value = scrollbar->currentPos() / static_cast<float>(scrollbar->maximum()); ScrollbarControlState s = 0; - if (scrollbar->client()->isActive()) + if (scrollbar->scrollableArea()->isActive()) s |= ActiveScrollbarState; if (scrollbar->enabled()) s |= EnabledScrollbarState; diff --git a/Source/WebCore/platform/SharedTimer.h b/Source/WebCore/platform/SharedTimer.h index 5b5cd14..16e0d0b 100644 --- a/Source/WebCore/platform/SharedTimer.h +++ b/Source/WebCore/platform/SharedTimer.h @@ -26,6 +26,7 @@ #ifndef SharedTimer_h #define SharedTimer_h +#include <wtf/FastAllocBase.h> #include <wtf/Noncopyable.h> namespace WebCore { @@ -33,8 +34,10 @@ namespace WebCore { // Each thread has its own single instance of shared timer, which implements this interface. // This instance is shared by all timers in the thread. // Not intended to be used directly; use the Timer class instead. - class SharedTimer : public Noncopyable { + class SharedTimer { + WTF_MAKE_NONCOPYABLE(SharedTimer); WTF_MAKE_FAST_ALLOCATED; public: + SharedTimer() { } virtual ~SharedTimer() {} virtual void setFiredFunction(void (*)()) = 0; diff --git a/Source/WebCore/platform/ThreadGlobalData.h b/Source/WebCore/platform/ThreadGlobalData.h index 9f57f00..76377b4 100644 --- a/Source/WebCore/platform/ThreadGlobalData.h +++ b/Source/WebCore/platform/ThreadGlobalData.h @@ -45,7 +45,8 @@ namespace WebCore { struct TECConverterWrapper; class ThreadTimers; - class ThreadGlobalData : public Noncopyable { + class ThreadGlobalData { + WTF_MAKE_NONCOPYABLE(ThreadGlobalData); public: ThreadGlobalData(); ~ThreadGlobalData(); diff --git a/Source/WebCore/platform/ThreadTimers.h b/Source/WebCore/platform/ThreadTimers.h index ab42598..3d7b5f9 100644 --- a/Source/WebCore/platform/ThreadTimers.h +++ b/Source/WebCore/platform/ThreadTimers.h @@ -37,7 +37,8 @@ namespace WebCore { class TimerBase; // A collection of timers per thread. Kept in ThreadGlobalData. - class ThreadTimers : public Noncopyable { + class ThreadTimers { + WTF_MAKE_NONCOPYABLE(ThreadTimers); WTF_MAKE_FAST_ALLOCATED; public: ThreadTimers(); diff --git a/Source/WebCore/platform/Timer.h b/Source/WebCore/platform/Timer.h index c4443da..c331e3d 100644 --- a/Source/WebCore/platform/Timer.h +++ b/Source/WebCore/platform/Timer.h @@ -35,7 +35,8 @@ namespace WebCore { class TimerHeapElement; -class TimerBase : public Noncopyable { +class TimerBase { + WTF_MAKE_NONCOPYABLE(TimerBase); WTF_MAKE_FAST_ALLOCATED; public: TimerBase(); virtual ~TimerBase(); diff --git a/Source/WebCore/platform/TreeShared.h b/Source/WebCore/platform/TreeShared.h index 9d9ac1f..9e27c5e 100644 --- a/Source/WebCore/platform/TreeShared.h +++ b/Source/WebCore/platform/TreeShared.h @@ -32,7 +32,8 @@ template<typename T> class TreeShared; template<typename T> void adopted(TreeShared<T>*); #endif -template<typename T> class TreeShared : public Noncopyable { +template<typename T> class TreeShared { + WTF_MAKE_NONCOPYABLE(TreeShared); public: TreeShared() : m_refCount(1) diff --git a/Source/WebCore/platform/android/PlatformBridge.h b/Source/WebCore/platform/android/PlatformBridge.h index faa823e..f20a001 100644 --- a/Source/WebCore/platform/android/PlatformBridge.h +++ b/Source/WebCore/platform/android/PlatformBridge.h @@ -90,7 +90,7 @@ class Widget; // An interface to the embedding layer, which has the ability to answer // questions about the system and so on... -// This is very similar to ChromiumBridge and the two are likely to converge +// This is very similar to chromium/PlatformBridge and the two are likely to converge // in the future. // // The methods in this class all need to reach across a JNI layer to the Java VM diff --git a/Source/WebCore/platform/animation/AnimationList.h b/Source/WebCore/platform/animation/AnimationList.h index 9a334ca..bf8ff9f 100644 --- a/Source/WebCore/platform/animation/AnimationList.h +++ b/Source/WebCore/platform/animation/AnimationList.h @@ -31,7 +31,8 @@ namespace WebCore { -class AnimationList : public FastAllocBase { +class AnimationList { + WTF_MAKE_FAST_ALLOCATED; public: AnimationList() { } AnimationList(const AnimationList&); diff --git a/Source/WebCore/platform/audio/AudioBus.h b/Source/WebCore/platform/audio/AudioBus.h index 4318b81..888f6bf 100644 --- a/Source/WebCore/platform/audio/AudioBus.h +++ b/Source/WebCore/platform/audio/AudioBus.h @@ -39,7 +39,8 @@ namespace WebCore { // An AudioBus represents a collection of one or more AudioChannels. // The data layout is "planar" as opposed to "interleaved". // An AudioBus with one channel is mono, an AudioBus with two channels is stereo, etc. -class AudioBus : public Noncopyable { +class AudioBus { + WTF_MAKE_NONCOPYABLE(AudioBus); public: enum { ChannelLeft = 0, diff --git a/Source/WebCore/platform/audio/AudioChannel.h b/Source/WebCore/platform/audio/AudioChannel.h index 6816830..7325e9f 100644 --- a/Source/WebCore/platform/audio/AudioChannel.h +++ b/Source/WebCore/platform/audio/AudioChannel.h @@ -30,14 +30,14 @@ #define AudioChannel_h #include "AudioArray.h" -#include <wtf/Noncopyable.h> #include <wtf/PassOwnPtr.h> namespace WebCore { // An AudioChannel represents a buffer of non-interleaved floating-point audio samples. // The PCM samples are normally assumed to be in a nominal range -1.0 -> +1.0 -class AudioChannel : public Noncopyable { +class AudioChannel { + WTF_MAKE_NONCOPYABLE(AudioChannel); public: // Memory can be externally referenced, or can be internally allocated with an AudioFloatArray. diff --git a/Source/WebCore/platform/audio/FFTFrameStub.cpp b/Source/WebCore/platform/audio/FFTFrameStub.cpp new file mode 100644 index 0000000..17405c9 --- /dev/null +++ b/Source/WebCore/platform/audio/FFTFrameStub.cpp @@ -0,0 +1,103 @@ +/* + * Copyright (C) 2011 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 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. + */ + +// FFTFrame stub implementation to avoid link errors during bringup + +#include "config.h" + +#if ENABLE(WEB_AUDIO) + +#if !OS(DARWIN) && !USE(WEBAUDIO_MKL) && !USE(WEBAUDIO_FFTW) + +#include "FFTFrame.h" + +namespace WebCore { + +// Normal constructor: allocates for a given fftSize. +FFTFrame::FFTFrame(unsigned fftSize) + : m_FFTSize(fftSize) + , m_log2FFTSize(static_cast<unsigned>(log2(fftSize))) +{ + ASSERT_NOT_REACHED(); +} + +// Creates a blank/empty frame (interpolate() must later be called). +FFTFrame::FFTFrame() + : m_FFTSize(0) + , m_log2FFTSize(0) +{ + ASSERT_NOT_REACHED(); +} + +// Copy constructor. +FFTFrame::FFTFrame(const FFTFrame& frame) + : m_FFTSize(frame.m_FFTSize) + , m_log2FFTSize(frame.m_log2FFTSize) +{ + ASSERT_NOT_REACHED(); +} + +FFTFrame::~FFTFrame() +{ + ASSERT_NOT_REACHED(); +} + +void FFTFrame::multiply(const FFTFrame& frame) +{ + ASSERT_NOT_REACHED(); +} + +void FFTFrame::doFFT(float* data) +{ + ASSERT_NOT_REACHED(); +} + +void FFTFrame::doInverseFFT(float* data) +{ + ASSERT_NOT_REACHED(); +} + +void FFTFrame::cleanup() +{ + ASSERT_NOT_REACHED(); +} + +float* FFTFrame::realData() const +{ + ASSERT_NOT_REACHED(); + return 0; +} + +float* FFTFrame::imagData() const +{ + ASSERT_NOT_REACHED(); + return 0; +} + +} // namespace WebCore + +#endif // !OS(DARWIN) && !USE(WEBAUDIO_MKL) && !USE(WEBAUDIO_FFTW) + +#endif // ENABLE(WEB_AUDIO) diff --git a/Source/WebCore/platform/audio/HRTFDatabase.h b/Source/WebCore/platform/audio/HRTFDatabase.h index c33b38f..bf13a3a 100644 --- a/Source/WebCore/platform/audio/HRTFDatabase.h +++ b/Source/WebCore/platform/audio/HRTFDatabase.h @@ -43,7 +43,8 @@ namespace WebCore { class HRTFKernel; -class HRTFDatabase : public Noncopyable { +class HRTFDatabase { + WTF_MAKE_NONCOPYABLE(HRTFDatabase); public: static PassOwnPtr<HRTFDatabase> create(double sampleRate); diff --git a/Source/WebCore/platform/audio/HRTFElevation.h b/Source/WebCore/platform/audio/HRTFElevation.h index b388b34..24b7822 100644 --- a/Source/WebCore/platform/audio/HRTFElevation.h +++ b/Source/WebCore/platform/audio/HRTFElevation.h @@ -43,7 +43,8 @@ namespace WebCore { // HRTFElevation contains all of the HRTFKernels (one left ear and one right ear per azimuth angle) for a particular elevation. -class HRTFElevation : public Noncopyable { +class HRTFElevation { + WTF_MAKE_NONCOPYABLE(HRTFElevation); public: // Loads and returns an HRTFElevation with the given HRTF database subject name and elevation from browser (or WebKit.framework) resources. // Normally, there will only be a single HRTF database set, but this API supports the possibility of multiple ones with different names. diff --git a/Source/WebCore/platform/audio/chromium/AudioBusChromium.cpp b/Source/WebCore/platform/audio/chromium/AudioBusChromium.cpp index a93703d..83ab9bf 100644 --- a/Source/WebCore/platform/audio/chromium/AudioBusChromium.cpp +++ b/Source/WebCore/platform/audio/chromium/AudioBusChromium.cpp @@ -29,21 +29,19 @@ #include "AudioBus.h" #include "AudioFileReader.h" -#include "ChromiumBridge.h" +#include "PlatformBridge.h" #include <wtf/PassOwnPtr.h> namespace WebCore { -// We will use this version of loadPlatformResource() once the resources are checked into Chromium. - -// PassOwnPtr<AudioBus> AudioBus::loadPlatformResource(const char* name, double sampleRate) -// { -// return ChromiumBridge::loadPlatformAudioResource(name, sampleRate); -// } +PassOwnPtr<AudioBus> AudioBus::loadPlatformResource(const char* name, double sampleRate) +{ + return PlatformBridge::loadPlatformAudioResource(name, sampleRate); +} PassOwnPtr<AudioBus> createBusFromInMemoryAudioFile(const void* data, size_t dataSize, bool mixToMono, double sampleRate) { - OwnPtr<AudioBus> audioBus = ChromiumBridge::decodeAudioFileData(static_cast<const char*>(data), dataSize, sampleRate); + OwnPtr<AudioBus> audioBus = PlatformBridge::decodeAudioFileData(static_cast<const char*>(data), dataSize, sampleRate); if (audioBus->numberOfChannels() == 2 && mixToMono) { OwnPtr<AudioBus> monoAudioBus = adoptPtr(new AudioBus(1, audioBus->length())); diff --git a/Source/WebCore/platform/chromium/ChromiumBridge.h b/Source/WebCore/platform/chromium/ChromiumBridge.h deleted file mode 100644 index d3b8528..0000000 --- a/Source/WebCore/platform/chromium/ChromiumBridge.h +++ /dev/null @@ -1,356 +0,0 @@ -/* - * 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 ChromiumBridge_h -#define ChromiumBridge_h - -#if ENABLE(WEB_AUDIO) -#include "AudioBus.h" -#endif - -#include "FileSystem.h" -#include "ImageSource.h" -#include "LinkHash.h" -#include "PassRefPtr.h" -#include "PasteboardPrivate.h" -#include "PluginData.h" - -#include <wtf/Forward.h> -#include <wtf/HashSet.h> -#include <wtf/Vector.h> - -typedef struct NPObject NPObject; -typedef struct _NPP NPP_t; -typedef NPP_t* NPP; - -#if OS(DARWIN) -typedef struct CGFont* CGFontRef; -typedef uintptr_t ATSFontContainerRef; -#ifdef __OBJC__ -@class NSFont; -#else -class NSFont; -#endif -#endif // OS(DARWIN) - -#if OS(WINDOWS) -typedef struct HFONT__* HFONT; -#endif - -namespace WebCore { - - class ClipboardData; - class Color; - class Cursor; - class Document; - class Frame; - class GeolocationServiceBridge; - class GeolocationServiceChromium; - class GraphicsContext; - class Image; - class IDBFactoryBackendInterface; - class IDBKey; - class IntRect; - class KURL; - class SerializedScriptValue; - class Widget; - - struct Cookie; - struct FontRenderStyle; - - // An interface to the embedding layer, which has the ability to answer - // questions about the system and so on... - - class ChromiumBridge { - public: - // Cache -------------------------------------------------------------- - static void cacheMetadata(const KURL& url, double responseTime, const Vector<char>&); - - // Clipboard ---------------------------------------------------------- - static bool clipboardIsFormatAvailable(PasteboardPrivate::ClipboardFormat, PasteboardPrivate::ClipboardBuffer); - - static String clipboardReadPlainText(PasteboardPrivate::ClipboardBuffer); - static void clipboardReadHTML(PasteboardPrivate::ClipboardBuffer, String*, KURL*); - - // Only the clipboardRead functions take a buffer argument because - // Chromium currently uses a different technique to write to alternate - // clipboard buffers. - static void clipboardWriteSelection(const String&, const KURL&, const String&, bool); - static void clipboardWritePlainText(const String&); - static void clipboardWriteURL(const KURL&, const String&); - static void clipboardWriteImage(NativeImagePtr, const KURL&, const String&); - static void clipboardWriteData(const String& type, const String& data, const String& metadata); - - // Interface for handling copy and paste, drag and drop, and selection copy. - static HashSet<String> clipboardReadAvailableTypes(PasteboardPrivate::ClipboardBuffer, bool* containsFilenames); - static bool clipboardReadData(PasteboardPrivate::ClipboardBuffer, const String& type, String& data, String& metadata); - static Vector<String> clipboardReadFilenames(PasteboardPrivate::ClipboardBuffer); - - // Cookies ------------------------------------------------------------ - static void setCookies(const Document*, const KURL&, const String& value); - static String cookies(const Document*, const KURL&); - static String cookieRequestHeaderFieldValue(const Document*, const KURL&); - static bool rawCookies(const Document*, const KURL& url, Vector<Cookie>&); - static void deleteCookie(const Document*, const KURL& url, const String& cookieName); - static bool cookiesEnabled(const Document*); - - // DNS ---------------------------------------------------------------- - static void prefetchDNS(const String& hostname); - - // File --------------------------------------------------------------- - static void revealFolderInOS(const String&); - static bool fileExists(const String&); - static bool deleteFile(const String&); - static bool deleteEmptyDirectory(const String&); - static bool getFileSize(const String&, long long& result); - static bool getFileModificationTime(const String&, time_t& result); - static String directoryName(const String& path); - static String pathByAppendingComponent(const String& path, const String& component); - static bool makeAllDirectories(const String& path); - static String getAbsolutePath(const String&); - static bool isDirectory(const String&); - static KURL filePathToURL(const String&); - static PlatformFileHandle openFile(const String& path, FileOpenMode); - static void closeFile(PlatformFileHandle&); - static long long seekFile(PlatformFileHandle, long long offset, FileSeekOrigin); - static bool truncateFile(PlatformFileHandle, long long offset); - static int readFromFile(PlatformFileHandle, char* data, int length); - static int writeToFile(PlatformFileHandle, const char* data, int length); - - // Font --------------------------------------------------------------- -#if OS(WINDOWS) - static bool ensureFontLoaded(HFONT font); -#endif -#if OS(LINUX) || OS(FREEBSD) - static void getRenderStyleForStrike(const char* family, int sizeAndStyle, FontRenderStyle* result); - static String getFontFamilyForCharacters(const UChar*, size_t numCharacters); -#endif -#if OS(DARWIN) - static bool loadFont(NSFont* srcFont, ATSFontContainerRef* out); -#endif - - // Forms -------------------------------------------------------------- - static void notifyFormStateChanged(const Document*); - - // Databases ---------------------------------------------------------- - // Returns a handle to the DB file and ooptionally a handle to its containing directory - static PlatformFileHandle databaseOpenFile(const String& vfsFleName, int desiredFlags); - // Returns a SQLite code (SQLITE_OK = 0, on success) - static int databaseDeleteFile(const String& vfsFileName, bool syncDir = false); - // Returns the attributes of the DB file - static long databaseGetFileAttributes(const String& vfsFileName); - // Returns the size of the DB file - static long long databaseGetFileSize(const String& vfsFileName); - - // IndexedDB ---------------------------------------------------------- - static PassRefPtr<IDBFactoryBackendInterface> idbFactory(); - static void idbShutdown(); - // Extracts keyPath from values and returns the corresponding keys. - static void createIDBKeysFromSerializedValuesAndKeyPath(const Vector<RefPtr<SerializedScriptValue> >& values, const String& keyPath, Vector<RefPtr<IDBKey> >& keys); - - // JavaScript --------------------------------------------------------- - static void notifyJSOutOfMemory(Frame*); - static bool allowScriptDespiteSettings(const KURL& documentURL); - - // Keygen ------------------------------------------------------------- - static String signedPublicKeyAndChallengeString(unsigned keySizeIndex, const String& challenge, const KURL& url); - - // Language ----------------------------------------------------------- - static String computedDefaultLanguage(); - - // LayoutTestMode ----------------------------------------------------- - static bool layoutTestMode(); - - // Memory ------------------------------------------------------------- - // Returns the current space allocated for the pagefile, in MB. - // That is committed size for Windows and virtual memory size for POSIX - static int memoryUsageMB(); - - // Same as above, but always returns actual value, without any caches. - static int actualMemoryUsageMB(); - - // MimeType ----------------------------------------------------------- - static bool isSupportedImageMIMEType(const String& mimeType); - static bool isSupportedJavaScriptMIMEType(const String& mimeType); - static bool isSupportedNonImageMIMEType(const String& mimeType); - static String mimeTypeForExtension(const String& fileExtension); - static String mimeTypeFromFile(const String& filePath); - static String preferredExtensionForMIMEType(const String& mimeType); - - // Plugin ------------------------------------------------------------- - static bool plugins(bool refresh, Vector<PluginInfo>*); - static NPObject* pluginScriptableObject(Widget*); - static bool popupsAllowed(NPP); - - // Resources ---------------------------------------------------------- - static PassRefPtr<Image> loadPlatformImageResource(const char* name); - -#if ENABLE(WEB_AUDIO) - static PassOwnPtr<AudioBus> loadPlatformAudioResource(const char* name, double sampleRate); - static PassOwnPtr<AudioBus> decodeAudioFileData(const char* data, size_t size, double sampleRate); -#endif - - // Sandbox ------------------------------------------------------------ - static bool sandboxEnabled(); - - // Screen ------------------------------------------------------------- - static int screenDepth(Widget*); - static int screenDepthPerComponent(Widget*); - static bool screenIsMonochrome(Widget*); - static IntRect screenRect(Widget*); - static IntRect screenAvailableRect(Widget*); - - // SharedTimers ------------------------------------------------------- - static void setSharedTimerFiredFunction(void (*func)()); - static void setSharedTimerFireTime(double fireTime); - static void stopSharedTimer(); - - // StatsCounters ------------------------------------------------------ - static void decrementStatsCounter(const char* name); - static void incrementStatsCounter(const char* name); - static void histogramCustomCounts(const char* name, int sample, int min, int max, int bucketCount); - static void histogramEnumeration(const char* name, int sample, int boundaryValue); - - // Sudden Termination - static void suddenTerminationChanged(bool enabled); - - // SystemTime --------------------------------------------------------- - static double currentTime(); - - // Theming ------------------------------------------------------------ -#if OS(WINDOWS) - static void paintButton( - GraphicsContext*, int part, int state, int classicState, const IntRect&); - static void paintMenuList( - GraphicsContext*, int part, int state, int classicState, const IntRect&); - static void paintScrollbarArrow( - GraphicsContext*, int state, int classicState, const IntRect&); - static void paintScrollbarThumb( - GraphicsContext*, int part, int state, int classicState, const IntRect&); - static void paintScrollbarTrack( - GraphicsContext*, int part, int state, int classicState, const IntRect&, const IntRect& alignRect); - static void paintSpinButton( - GraphicsContext*, int part, int state, int classicState, const IntRect&); - static void paintTextField( - GraphicsContext*, int part, int state, int classicState, const IntRect&, const Color&, bool fillContentArea, bool drawEdges); - static void paintTrackbar( - GraphicsContext*, int part, int state, int classicState, const IntRect&); - static void paintProgressBar( - GraphicsContext*, const IntRect& barRect, const IntRect& valueRect, bool determinate, double animatedSeconds); -#elif OS(LINUX) - // The UI part which is being accessed. - enum ThemePart { - PartScrollbarDownArrow, - PartScrollbarLeftArrow, - PartScrollbarRightArrow, - PartScrollbarUpArrow, - PartScrollbarHorizontalThumb, - PartScrollbarVerticalThumb, - PartScrollbarHorizontalTrack, - PartScrollbarVerticalTrack, - }; - - // The current state of the associated Part. - enum ThemePaintState { - StateDisabled, - StateHover, - StateNormal, - StatePressed, - }; - - struct ScrollbarTrackExtraParams { - // The bounds of the entire track, as opposed to the part being painted. - int trackX; - int trackY; - int trackWidth; - int trackHeight; - }; - - union ThemePaintExtraParams { - ScrollbarTrackExtraParams scrollbarTrack; - }; - - // Gets the size of the given theme part. For variable sized items - // like vertical scrollbar thumbs, the width will be the required width of - // the track while the height will be the minimum height. - static IntSize getThemePartSize(ThemePart); - // Paint the given the given theme part. - static void paintThemePart(GraphicsContext*, ThemePart, ThemePaintState, const IntRect&, const ThemePaintExtraParams*); -#elif OS(DARWIN) - enum ThemePaintState { - StateDisabled, - StateInactive, - StateActive, - StatePressed, - }; - - enum ThemePaintSize { - SizeRegular, - SizeSmall, - }; - - enum ThemePaintScrollbarOrientation { - ScrollbarOrientationHorizontal, - ScrollbarOrientationVertical, - }; - - enum ThemePaintScrollbarParent { - ScrollbarParentScrollView, - ScrollbarParentRenderLayer, - }; - - struct ThemePaintScrollbarInfo { - ThemePaintScrollbarOrientation orientation; - ThemePaintScrollbarParent parent; - int maxValue; - int currentValue; - int visibleSize; - int totalSize; - }; - - static void paintScrollbarThumb(GraphicsContext*, ThemePaintState, ThemePaintSize, const IntRect&, const ThemePaintScrollbarInfo&); -#endif - - // Trace Event -------------------------------------------------------- - static void traceEventBegin(const char* name, void* id, const char* extra); - static void traceEventEnd(const char* name, void* id, const char* extra); - - // Visited links ------------------------------------------------------ - static LinkHash visitedLinkHash(const UChar* url, unsigned length); - static LinkHash visitedLinkHash(const KURL& base, const AtomicString& attributeURL); - static bool isLinkVisited(LinkHash); - - // Widget ------------------------------------------------------------- - static void widgetSetCursor(Widget*, const Cursor&); - }; - -} // namespace WebCore - -#endif diff --git a/Source/WebCore/platform/chromium/ChromiumDataObjectLegacy.cpp b/Source/WebCore/platform/chromium/ChromiumDataObjectLegacy.cpp index a2952c0..82e47e2 100644 --- a/Source/WebCore/platform/chromium/ChromiumDataObjectLegacy.cpp +++ b/Source/WebCore/platform/chromium/ChromiumDataObjectLegacy.cpp @@ -31,9 +31,9 @@ #include "config.h" #include "ChromiumDataObjectLegacy.h" -#include "ChromiumBridge.h" #include "ClipboardMimeTypes.h" #include "Pasteboard.h" +#include "PlatformBridge.h" namespace WebCore { @@ -132,7 +132,7 @@ String ChromiumDataObjectLegacy::getData(const String& type, bool& success) Pasteboard::generalPasteboard()->isSelectionMode() ? PasteboardPrivate::SelectionBuffer : PasteboardPrivate::StandardBuffer; - String text = ChromiumBridge::clipboardReadPlainText(buffer); + String text = PlatformBridge::clipboardReadPlainText(buffer); success = !text.isEmpty(); return text; } @@ -158,7 +158,7 @@ String ChromiumDataObjectLegacy::getData(const String& type, bool& success) PasteboardPrivate::StandardBuffer; String htmlText; KURL sourceURL; - ChromiumBridge::clipboardReadHTML(buffer, &htmlText, &sourceURL); + PlatformBridge::clipboardReadHTML(buffer, &htmlText, &sourceURL); success = !htmlText.isEmpty(); return htmlText; } diff --git a/Source/WebCore/platform/chromium/ClipboardChromium.h b/Source/WebCore/platform/chromium/ClipboardChromium.h index 1d69921..d5ada14 100644 --- a/Source/WebCore/platform/chromium/ClipboardChromium.h +++ b/Source/WebCore/platform/chromium/ClipboardChromium.h @@ -42,6 +42,7 @@ namespace WebCore { class IntPoint; class ClipboardChromium : public Clipboard, public CachedResourceClient { + WTF_MAKE_FAST_ALLOCATED; public: ~ClipboardChromium() {} diff --git a/Source/WebCore/platform/chromium/DragDataChromium.cpp b/Source/WebCore/platform/chromium/DragDataChromium.cpp index 8c20a00..9312505 100644 --- a/Source/WebCore/platform/chromium/DragDataChromium.cpp +++ b/Source/WebCore/platform/chromium/DragDataChromium.cpp @@ -30,16 +30,16 @@ #include "config.h" #include "DragData.h" -#include "ChromiumBridge.h" #include "ChromiumDataObject.h" #include "ClipboardMimeTypes.h" #include "DocumentFragment.h" #include "FileSystem.h" #include "Frame.h" #include "KURL.h" -#include "markup.h" #include "NotImplemented.h" +#include "PlatformBridge.h" #include "PlatformString.h" +#include "markup.h" namespace WebCore { @@ -63,7 +63,7 @@ String DragData::asURL(Frame*, FilenameConversionPolicy filenamePolicy, String* if (title) *title = m_platformDragData->urlTitle(); } else if (filenamePolicy == ConvertFilenames && containsFiles()) { - url = ChromiumBridge::filePathToURL(ChromiumBridge::getAbsolutePath(m_platformDragData->filenames()[0])); + url = PlatformBridge::filePathToURL(PlatformBridge::getAbsolutePath(m_platformDragData->filenames()[0])); } return url; } diff --git a/Source/WebCore/platform/chromium/FileSystemChromium.cpp b/Source/WebCore/platform/chromium/FileSystemChromium.cpp index d8a1e3f..faf5e92 100644 --- a/Source/WebCore/platform/chromium/FileSystemChromium.cpp +++ b/Source/WebCore/platform/chromium/FileSystemChromium.cpp @@ -31,85 +31,85 @@ #include "config.h" #include "FileSystem.h" -#include "ChromiumBridge.h" #include "NotImplemented.h" +#include "PlatformBridge.h" #include "PlatformString.h" namespace WebCore { bool deleteFile(const String& path) { - return ChromiumBridge::deleteFile(path); + return PlatformBridge::deleteFile(path); } bool deleteEmptyDirectory(const String& path) { - return ChromiumBridge::deleteEmptyDirectory(path); + return PlatformBridge::deleteEmptyDirectory(path); } bool getFileSize(const String& path, long long& result) { - return ChromiumBridge::getFileSize(path, result); + return PlatformBridge::getFileSize(path, result); } bool getFileModificationTime(const String& path, time_t& result) { - return ChromiumBridge::getFileModificationTime(path, result); + return PlatformBridge::getFileModificationTime(path, result); } void revealFolderInOS(const String& path) { - ChromiumBridge::revealFolderInOS(path); + PlatformBridge::revealFolderInOS(path); } String directoryName(const String& path) { - return ChromiumBridge::directoryName(path); + return PlatformBridge::directoryName(path); } String pathByAppendingComponent(const String& path, const String& component) { - return ChromiumBridge::pathByAppendingComponent(path, component); + return PlatformBridge::pathByAppendingComponent(path, component); } bool makeAllDirectories(const String& path) { - return ChromiumBridge::makeAllDirectories(path); + return PlatformBridge::makeAllDirectories(path); } bool fileExists(const String& path) { - return ChromiumBridge::fileExists(path); + return PlatformBridge::fileExists(path); } PlatformFileHandle openFile(const String& path, FileOpenMode mode) { - return ChromiumBridge::openFile(path, mode); + return PlatformBridge::openFile(path, mode); } void closeFile(PlatformFileHandle& handle) { - return ChromiumBridge::closeFile(handle); + return PlatformBridge::closeFile(handle); } long long seekFile(PlatformFileHandle handle, long long offset, FileSeekOrigin origin) { - return ChromiumBridge::seekFile(handle, offset, origin); + return PlatformBridge::seekFile(handle, offset, origin); } bool truncateFile(PlatformFileHandle handle, long long offset) { - return ChromiumBridge::truncateFile(handle, offset); + return PlatformBridge::truncateFile(handle, offset); } int readFromFile(PlatformFileHandle handle, char* data, int length) { - return ChromiumBridge::readFromFile(handle, data, length); + return PlatformBridge::readFromFile(handle, data, length); } int writeToFile(PlatformFileHandle handle, const char* data, int length) { - return ChromiumBridge::writeToFile(handle, data, length); + return PlatformBridge::writeToFile(handle, data, length); } } // namespace WebCore diff --git a/Source/WebCore/platform/chromium/FramelessScrollView.h b/Source/WebCore/platform/chromium/FramelessScrollView.h index 300f418..033d953 100644 --- a/Source/WebCore/platform/chromium/FramelessScrollView.h +++ b/Source/WebCore/platform/chromium/FramelessScrollView.h @@ -61,7 +61,7 @@ namespace WebCore { virtual bool handleWheelEvent(const PlatformWheelEvent&) = 0; virtual bool handleKeyEvent(const PlatformKeyboardEvent&) = 0; - // ScrollbarClient public methods: + // ScrollableArea public methods: virtual void invalidateScrollbarRect(Scrollbar*, const IntRect&); virtual bool isActive() const; diff --git a/Source/WebCore/platform/chromium/LanguageChromium.cpp b/Source/WebCore/platform/chromium/LanguageChromium.cpp index 69fe372..fedc4d5 100644 --- a/Source/WebCore/platform/chromium/LanguageChromium.cpp +++ b/Source/WebCore/platform/chromium/LanguageChromium.cpp @@ -31,7 +31,7 @@ #include "config.h" #include "Language.h" -#include "ChromiumBridge.h" +#include "PlatformBridge.h" #include "PlatformString.h" namespace WebCore { @@ -40,7 +40,7 @@ String platformDefaultLanguage() { static String computedDefaultLanguage; if (computedDefaultLanguage.isEmpty()) - computedDefaultLanguage = ChromiumBridge::computedDefaultLanguage(); + computedDefaultLanguage = PlatformBridge::computedDefaultLanguage(); return computedDefaultLanguage; } diff --git a/Source/WebCore/platform/chromium/LinkHashChromium.cpp b/Source/WebCore/platform/chromium/LinkHashChromium.cpp index 9cb93ea..5e1ffa4 100644 --- a/Source/WebCore/platform/chromium/LinkHashChromium.cpp +++ b/Source/WebCore/platform/chromium/LinkHashChromium.cpp @@ -31,18 +31,18 @@ #include "config.h" #include "LinkHash.h" -#include "ChromiumBridge.h" +#include "PlatformBridge.h" namespace WebCore { LinkHash visitedLinkHash(const UChar* url, unsigned length) { - return ChromiumBridge::visitedLinkHash(url, length); + return PlatformBridge::visitedLinkHash(url, length); } LinkHash visitedLinkHash(const KURL& base, const AtomicString& attributeURL) { - return ChromiumBridge::visitedLinkHash(base, attributeURL); + return PlatformBridge::visitedLinkHash(base, attributeURL); } } // namespace WebCore diff --git a/Source/WebCore/platform/chromium/MIMETypeRegistryChromium.cpp b/Source/WebCore/platform/chromium/MIMETypeRegistryChromium.cpp index 9df8847..fec0e9b 100644 --- a/Source/WebCore/platform/chromium/MIMETypeRegistryChromium.cpp +++ b/Source/WebCore/platform/chromium/MIMETypeRegistryChromium.cpp @@ -31,20 +31,20 @@ #include "config.h" #include "MIMETypeRegistry.h" -#include "ChromiumBridge.h" #include "MediaPlayer.h" +#include "PlatformBridge.h" #include "PluginDataChromium.h" #include <wtf/text/CString.h> // NOTE: Unlike other ports, we don't use the shared implementation bits in // MIMETypeRegistry.cpp. Instead, we need to route most functions via the -// ChromiumBridge to the embedder. +// PlatformBridge to the embedder. namespace WebCore { String MIMETypeRegistry::getMIMETypeForExtension(const String &ext) { - return ChromiumBridge::mimeTypeForExtension(ext); + return PlatformBridge::mimeTypeForExtension(ext); } // Returns the file extension if one is found. Does not include the dot in the @@ -55,7 +55,7 @@ String MIMETypeRegistry::getPreferredExtensionForMIMEType(const String& type) // FIXME: Is this really necessary?? String mimeType = type.substring(0, static_cast<unsigned>(type.find(';'))); - String ext = ChromiumBridge::preferredExtensionForMIMEType(type); + String ext = PlatformBridge::preferredExtensionForMIMEType(type); if (!ext.isEmpty() && ext[0] == '.') ext = ext.substring(1); @@ -81,7 +81,7 @@ String MIMETypeRegistry::getMIMETypeForPath(const String& path) bool MIMETypeRegistry::isSupportedImageMIMEType(const String& mimeType) { - return ChromiumBridge::isSupportedImageMIMEType(mimeType); + return PlatformBridge::isSupportedImageMIMEType(mimeType); } bool MIMETypeRegistry::isSupportedImageResourceMIMEType(const String& mimeType) @@ -96,12 +96,12 @@ bool MIMETypeRegistry::isSupportedImageMIMETypeForEncoding(const String& mimeTyp bool MIMETypeRegistry::isSupportedJavaScriptMIMEType(const String& mimeType) { - return ChromiumBridge::isSupportedJavaScriptMIMEType(mimeType); + return PlatformBridge::isSupportedJavaScriptMIMEType(mimeType); } bool MIMETypeRegistry::isSupportedNonImageMIMEType(const String& mimeType) { - return ChromiumBridge::isSupportedNonImageMIMEType(mimeType); + return PlatformBridge::isSupportedNonImageMIMEType(mimeType); } bool MIMETypeRegistry::isSupportedMediaMIMEType(const String& mimeType) diff --git a/Source/WebCore/platform/chromium/PasteboardChromium.cpp b/Source/WebCore/platform/chromium/PasteboardChromium.cpp index 907a4b9..6beb017 100644 --- a/Source/WebCore/platform/chromium/PasteboardChromium.cpp +++ b/Source/WebCore/platform/chromium/PasteboardChromium.cpp @@ -31,20 +31,20 @@ #include "config.h" #include "Pasteboard.h" -#include "ChromiumBridge.h" #include "ClipboardUtilitiesChromium.h" -#include "DocumentFragment.h" #include "Document.h" +#include "DocumentFragment.h" #include "Element.h" #include "Frame.h" #include "HTMLNames.h" #include "HTMLParserIdioms.h" #include "Image.h" #include "KURL.h" -#include "markup.h" #include "NativeImageSkia.h" +#include "PlatformBridge.h" #include "Range.h" #include "RenderImage.h" +#include "markup.h" #if ENABLE(SVG) #include "SVGNames.h" @@ -91,7 +91,7 @@ void Pasteboard::writeSelection(Range* selectedRange, bool canSmartCopyOrDelete, #endif replaceNBSPWithSpace(plainText); - ChromiumBridge::clipboardWriteSelection(html, url, plainText, canSmartCopyOrDelete); + PlatformBridge::clipboardWriteSelection(html, url, plainText, canSmartCopyOrDelete); } void Pasteboard::writePlainText(const String& text) @@ -99,9 +99,9 @@ void Pasteboard::writePlainText(const String& text) #if OS(WINDOWS) String plainText(text); replaceNewlinesWithWindowsStyleNewlines(plainText); - ChromiumBridge::clipboardWritePlainText(plainText); + PlatformBridge::clipboardWritePlainText(plainText); #else - ChromiumBridge::clipboardWritePlainText(text); + PlatformBridge::clipboardWritePlainText(text); #endif } @@ -116,7 +116,7 @@ void Pasteboard::writeURL(const KURL& url, const String& titleStr, Frame* frame) title = url.host(); } - ChromiumBridge::clipboardWriteURL(url, title); + PlatformBridge::clipboardWriteURL(url, title); } void Pasteboard::writeImage(Node* node, const KURL&, const String& title) @@ -150,17 +150,17 @@ void Pasteboard::writeImage(Node* node, const KURL&, const String& title) } KURL url = urlString.isEmpty() ? KURL() : node->document()->completeURL(stripLeadingAndTrailingHTMLSpaces(urlString)); - ChromiumBridge::clipboardWriteImage(bitmap, url, title); + PlatformBridge::clipboardWriteImage(bitmap, url, title); } bool Pasteboard::canSmartReplace() { - return ChromiumBridge::clipboardIsFormatAvailable(PasteboardPrivate::WebSmartPasteFormat, m_selectionMode ? PasteboardPrivate::SelectionBuffer : PasteboardPrivate::StandardBuffer); + return PlatformBridge::clipboardIsFormatAvailable(PasteboardPrivate::WebSmartPasteFormat, m_selectionMode ? PasteboardPrivate::SelectionBuffer : PasteboardPrivate::StandardBuffer); } String Pasteboard::plainText(Frame* frame) { - return ChromiumBridge::clipboardReadPlainText(m_selectionMode ? PasteboardPrivate::SelectionBuffer : PasteboardPrivate::StandardBuffer); + return PlatformBridge::clipboardReadPlainText(m_selectionMode ? PasteboardPrivate::SelectionBuffer : PasteboardPrivate::StandardBuffer); } PassRefPtr<DocumentFragment> Pasteboard::documentFragment(Frame* frame, PassRefPtr<Range> context, bool allowPlainText, bool& chosePlainText) @@ -168,10 +168,10 @@ PassRefPtr<DocumentFragment> Pasteboard::documentFragment(Frame* frame, PassRefP chosePlainText = false; PasteboardPrivate::ClipboardBuffer buffer = m_selectionMode ? PasteboardPrivate::SelectionBuffer : PasteboardPrivate::StandardBuffer; - if (ChromiumBridge::clipboardIsFormatAvailable(PasteboardPrivate::HTMLFormat, buffer)) { + if (PlatformBridge::clipboardIsFormatAvailable(PasteboardPrivate::HTMLFormat, buffer)) { String markup; KURL srcURL; - ChromiumBridge::clipboardReadHTML(buffer, &markup, &srcURL); + PlatformBridge::clipboardReadHTML(buffer, &markup, &srcURL); RefPtr<DocumentFragment> fragment = createFragmentFromMarkup(frame->document(), markup, srcURL, FragmentScriptingNotAllowed); @@ -180,7 +180,7 @@ PassRefPtr<DocumentFragment> Pasteboard::documentFragment(Frame* frame, PassRefP } if (allowPlainText) { - String markup = ChromiumBridge::clipboardReadPlainText(buffer); + String markup = PlatformBridge::clipboardReadPlainText(buffer); if (!markup.isEmpty()) { chosePlainText = true; diff --git a/Source/WebCore/platform/chromium/PlatformBridge.h b/Source/WebCore/platform/chromium/PlatformBridge.h index ecb7b45..f6a2564 100644 --- a/Source/WebCore/platform/chromium/PlatformBridge.h +++ b/Source/WebCore/platform/chromium/PlatformBridge.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010 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 @@ -31,17 +31,378 @@ #ifndef PlatformBridge_h #define PlatformBridge_h -#include "ChromiumBridge.h" +#if ENABLE(WEB_AUDIO) +#include "AudioBus.h" +#endif + +#include "FileSystem.h" +#include "ImageSource.h" +#include "LinkHash.h" +#include "PassRefPtr.h" +#include "PasteboardPrivate.h" +#include "PluginData.h" + +#include <wtf/Forward.h> +#include <wtf/HashSet.h> +#include <wtf/Vector.h> + +typedef struct NPObject NPObject; +typedef struct _NPP NPP_t; +typedef NPP_t* NPP; + +#if OS(DARWIN) +typedef struct CGFont* CGFontRef; +typedef uintptr_t ATSFontContainerRef; +#ifdef __OBJC__ +@class NSFont; +#else +class NSFont; +#endif +#endif // OS(DARWIN) + +#if OS(WINDOWS) +typedef struct HFONT__* HFONT; +#endif namespace WebCore { -// FIXME: A better name for ChromiumBridge is PlatformBridge. Android already -// uses PlatformBridge so the code that is shared among the Android and Chromium -// ports is gradually moving towards using PlatformBridge. Once the Android -// unforking is done, we will change the name of ChromiumBridge to PlatformBridge -// and merge the two classes into one that will be shared by both ports. -typedef ChromiumBridge PlatformBridge; +class ClipboardData; +class Color; +class Cursor; +class Document; +class Frame; +class GeolocationServiceBridge; +class GeolocationServiceChromium; +class GraphicsContext; +class Image; +class IDBFactoryBackendInterface; +class IDBKey; +class IntRect; +class KURL; +class SerializedScriptValue; +class Widget; + +struct Cookie; +struct FontRenderStyle; + +// An interface to the embedding layer, which has the ability to answer +// questions about the system and so on... + +class PlatformBridge { +public: + // Cache -------------------------------------------------------------- + static void cacheMetadata(const KURL&, double responseTime, const Vector<char>&); + + // Clipboard ---------------------------------------------------------- + static bool clipboardIsFormatAvailable(PasteboardPrivate::ClipboardFormat, PasteboardPrivate::ClipboardBuffer); + + static String clipboardReadPlainText(PasteboardPrivate::ClipboardBuffer); + static void clipboardReadHTML(PasteboardPrivate::ClipboardBuffer, String*, KURL*); + + // Only the clipboardRead functions take a buffer argument because + // Chromium currently uses a different technique to write to alternate + // clipboard buffers. + static void clipboardWriteSelection(const String&, const KURL&, const String&, bool); + static void clipboardWritePlainText(const String&); + static void clipboardWriteURL(const KURL&, const String&); + static void clipboardWriteImage(NativeImagePtr, const KURL&, const String&); + static void clipboardWriteData(const String& type, const String& data, const String& metadata); + + // Interface for handling copy and paste, drag and drop, and selection copy. + static HashSet<String> clipboardReadAvailableTypes(PasteboardPrivate::ClipboardBuffer, bool* containsFilenames); + static bool clipboardReadData(PasteboardPrivate::ClipboardBuffer, const String& type, String& data, String& metadata); + static Vector<String> clipboardReadFilenames(PasteboardPrivate::ClipboardBuffer); + + // Cookies ------------------------------------------------------------ + static void setCookies(const Document*, const KURL&, const String& value); + static String cookies(const Document*, const KURL&); + static String cookieRequestHeaderFieldValue(const Document*, const KURL&); + static bool rawCookies(const Document*, const KURL&, Vector<Cookie>&); + static void deleteCookie(const Document*, const KURL&, const String& cookieName); + static bool cookiesEnabled(const Document*); + + // DNS ---------------------------------------------------------------- + static void prefetchDNS(const String& hostname); + + // File --------------------------------------------------------------- + static void revealFolderInOS(const String&); + static bool fileExists(const String&); + static bool deleteFile(const String&); + static bool deleteEmptyDirectory(const String&); + static bool getFileSize(const String&, long long& result); + static bool getFileModificationTime(const String&, time_t& result); + static String directoryName(const String& path); + static String pathByAppendingComponent(const String& path, const String& component); + static bool makeAllDirectories(const String& path); + static String getAbsolutePath(const String&); + static bool isDirectory(const String&); + static KURL filePathToURL(const String&); + static PlatformFileHandle openFile(const String& path, FileOpenMode); + static void closeFile(PlatformFileHandle&); + static long long seekFile(PlatformFileHandle, long long offset, FileSeekOrigin); + static bool truncateFile(PlatformFileHandle, long long offset); + static int readFromFile(PlatformFileHandle, char* data, int length); + static int writeToFile(PlatformFileHandle, const char* data, int length); + + // Font --------------------------------------------------------------- +#if OS(WINDOWS) + static bool ensureFontLoaded(HFONT); +#endif +#if OS(LINUX) || OS(FREEBSD) + static void getRenderStyleForStrike(const char* family, int sizeAndStyle, FontRenderStyle* result); + static String getFontFamilyForCharacters(const UChar*, size_t numCharacters); +#endif +#if OS(DARWIN) + static bool loadFont(NSFont* srcFont, ATSFontContainerRef* out); +#endif + + // Forms -------------------------------------------------------------- + static void notifyFormStateChanged(const Document*); + + // Databases ---------------------------------------------------------- + // Returns a handle to the DB file and ooptionally a handle to its containing directory + static PlatformFileHandle databaseOpenFile(const String& vfsFleName, int desiredFlags); + // Returns a SQLite code (SQLITE_OK = 0, on success) + static int databaseDeleteFile(const String& vfsFileName, bool syncDir = false); + // Returns the attributes of the DB file + static long databaseGetFileAttributes(const String& vfsFileName); + // Returns the size of the DB file + static long long databaseGetFileSize(const String& vfsFileName); + + // IndexedDB ---------------------------------------------------------- + static PassRefPtr<IDBFactoryBackendInterface> idbFactory(); + static void idbShutdown(); + // Extracts keyPath from values and returns the corresponding keys. + static void createIDBKeysFromSerializedValuesAndKeyPath(const Vector<RefPtr<SerializedScriptValue> >& values, const String& keyPath, Vector<RefPtr<IDBKey> >& keys); + + // JavaScript --------------------------------------------------------- + static void notifyJSOutOfMemory(Frame*); + static bool allowScriptDespiteSettings(const KURL& documentURL); + + // Keygen ------------------------------------------------------------- + static String signedPublicKeyAndChallengeString(unsigned keySizeIndex, const String& challenge, const KURL&); + + // Language ----------------------------------------------------------- + static String computedDefaultLanguage(); + + // LayoutTestMode ----------------------------------------------------- + static bool layoutTestMode(); + + // Memory ------------------------------------------------------------- + // Returns the current space allocated for the pagefile, in MB. + // That is committed size for Windows and virtual memory size for POSIX + static int memoryUsageMB(); + + // Same as above, but always returns actual value, without any caches. + static int actualMemoryUsageMB(); + + // MimeType ----------------------------------------------------------- + static bool isSupportedImageMIMEType(const String& mimeType); + static bool isSupportedJavaScriptMIMEType(const String& mimeType); + static bool isSupportedNonImageMIMEType(const String& mimeType); + static String mimeTypeForExtension(const String& fileExtension); + static String mimeTypeFromFile(const String& filePath); + static String preferredExtensionForMIMEType(const String& mimeType); + + // Plugin ------------------------------------------------------------- + static bool plugins(bool refresh, Vector<PluginInfo>*); + static NPObject* pluginScriptableObject(Widget*); + static bool popupsAllowed(NPP); + + // Resources ---------------------------------------------------------- + static PassRefPtr<Image> loadPlatformImageResource(const char* name); + +#if ENABLE(WEB_AUDIO) + static PassOwnPtr<AudioBus> loadPlatformAudioResource(const char* name, double sampleRate); + static PassOwnPtr<AudioBus> decodeAudioFileData(const char* data, size_t, double sampleRate); +#endif + + // Sandbox ------------------------------------------------------------ + static bool sandboxEnabled(); + + // Screen ------------------------------------------------------------- + static int screenDepth(Widget*); + static int screenDepthPerComponent(Widget*); + static bool screenIsMonochrome(Widget*); + static IntRect screenRect(Widget*); + static IntRect screenAvailableRect(Widget*); + + // SharedTimers ------------------------------------------------------- + static void setSharedTimerFiredFunction(void (*func)()); + static void setSharedTimerFireTime(double); + static void stopSharedTimer(); + + // StatsCounters ------------------------------------------------------ + static void decrementStatsCounter(const char* name); + static void incrementStatsCounter(const char* name); + static void histogramCustomCounts(const char* name, int sample, int min, int max, int bucketCount); + static void histogramEnumeration(const char* name, int sample, int boundaryValue); + + // Sudden Termination + static void suddenTerminationChanged(bool enabled); + + // SystemTime --------------------------------------------------------- + static double currentTime(); + + // Theming ------------------------------------------------------------ +#if OS(WINDOWS) + static void paintButton( + GraphicsContext*, int part, int state, int classicState, const IntRect&); + static void paintMenuList( + GraphicsContext*, int part, int state, int classicState, const IntRect&); + static void paintScrollbarArrow( + GraphicsContext*, int state, int classicState, const IntRect&); + static void paintScrollbarThumb( + GraphicsContext*, int part, int state, int classicState, const IntRect&); + static void paintScrollbarTrack( + GraphicsContext*, int part, int state, int classicState, const IntRect&, const IntRect& alignRect); + static void paintSpinButton( + GraphicsContext*, int part, int state, int classicState, const IntRect&); + static void paintTextField( + GraphicsContext*, int part, int state, int classicState, const IntRect&, const Color&, bool fillContentArea, bool drawEdges); + static void paintTrackbar( + GraphicsContext*, int part, int state, int classicState, const IntRect&); + static void paintProgressBar( + GraphicsContext*, const IntRect& barRect, const IntRect& valueRect, bool determinate, double animatedSeconds); +#elif OS(LINUX) + // The UI part which is being accessed. + enum ThemePart { + // ScrollbarTheme parts + PartScrollbarDownArrow, + PartScrollbarLeftArrow, + PartScrollbarRightArrow, + PartScrollbarUpArrow, + PartScrollbarHorizontalThumb, + PartScrollbarVerticalThumb, + PartScrollbarHorizontalTrack, + PartScrollbarVerticalTrack, + + // RenderTheme parts + PartCheckbox, + PartRadio, + PartButton, + PartTextField, + PartMenuList, + PartSliderTrack, + PartSliderThumb, + PartInnerSpinButton, + PartProgressBar + }; + + // The current state of the associated Part. + enum ThemePaintState { + StateDisabled, + StateHover, + StateNormal, + StatePressed + }; + + struct ScrollbarTrackExtraParams { + // The bounds of the entire track, as opposed to the part being painted. + int trackX; + int trackY; + int trackWidth; + int trackHeight; + }; + + struct ButtonExtraParams { + bool checked; + bool indeterminate; // Whether the button state is indeterminate. + bool isDefault; // Whether the button is default button. + unsigned backgroundColor; + }; + + struct TextFieldExtraParams { + bool isTextArea; + bool isListbox; + unsigned backgroundColor; + }; + + struct MenuListExtraParams { + int arrowX; + int arrowY; + unsigned backgroundColor; + }; + + struct SliderExtraParams { + bool vertical; + bool inDrag; + }; + + struct InnerSpinButtonExtraParams { + bool spinUp; + bool readOnly; + }; + + struct ProgressBarExtraParams { + bool determinate; + int valueRectX; + int valueRectY; + int valueRectWidth; + int valueRectHeight; + }; + + union ThemePaintExtraParams { + ScrollbarTrackExtraParams scrollbarTrack; + ButtonExtraParams button; + TextFieldExtraParams textField; + MenuListExtraParams menuList; + SliderExtraParams slider; + InnerSpinButtonExtraParams innerSpin; + ProgressBarExtraParams progressBar; + }; + + // Gets the size of the given theme part. For variable sized items + // like vertical scrollbar thumbs, the width will be the required width of + // the track while the height will be the minimum height. + static IntSize getThemePartSize(ThemePart); + // Paint the given the given theme part. + static void paintThemePart(GraphicsContext*, ThemePart, ThemePaintState, const IntRect&, const ThemePaintExtraParams*); +#elif OS(DARWIN) + enum ThemePaintState { + StateDisabled, + StateInactive, + StateActive, + StatePressed, + }; + + enum ThemePaintSize { + SizeRegular, + SizeSmall, + }; + + enum ThemePaintScrollbarOrientation { + ScrollbarOrientationHorizontal, + ScrollbarOrientationVertical, + }; + + enum ThemePaintScrollbarParent { + ScrollbarParentScrollView, + ScrollbarParentRenderLayer, + }; + + struct ThemePaintScrollbarInfo { + ThemePaintScrollbarOrientation orientation; + ThemePaintScrollbarParent parent; + int maxValue; + int currentValue; + int visibleSize; + int totalSize; + }; + + static void paintScrollbarThumb(GraphicsContext*, ThemePaintState, ThemePaintSize, const IntRect&, const ThemePaintScrollbarInfo&); +#endif + + // Trace Event -------------------------------------------------------- + static void traceEventBegin(const char* name, void*, const char* extra); + static void traceEventEnd(const char* name, void*, const char* extra); + + // Visited links ------------------------------------------------------ + static LinkHash visitedLinkHash(const UChar* url, unsigned length); + static LinkHash visitedLinkHash(const KURL& base, const AtomicString& attributeURL); + static bool isLinkVisited(LinkHash); +}; } // namespace WebCore -#endif // PlatformBridge_h +#endif diff --git a/Source/WebCore/platform/chromium/PlatformScreenChromium.cpp b/Source/WebCore/platform/chromium/PlatformScreenChromium.cpp index e659ef5..35d5018 100644 --- a/Source/WebCore/platform/chromium/PlatformScreenChromium.cpp +++ b/Source/WebCore/platform/chromium/PlatformScreenChromium.cpp @@ -31,34 +31,34 @@ #include "config.h" #include "PlatformScreen.h" -#include "ChromiumBridge.h" #include "IntRect.h" +#include "PlatformBridge.h" namespace WebCore { int screenDepth(Widget* widget) { - return ChromiumBridge::screenDepth(widget); + return PlatformBridge::screenDepth(widget); } int screenDepthPerComponent(Widget* widget) { - return ChromiumBridge::screenDepthPerComponent(widget); + return PlatformBridge::screenDepthPerComponent(widget); } bool screenIsMonochrome(Widget* widget) { - return ChromiumBridge::screenIsMonochrome(widget); + return PlatformBridge::screenIsMonochrome(widget); } FloatRect screenRect(Widget* widget) { - return ChromiumBridge::screenRect(widget); + return PlatformBridge::screenRect(widget); } FloatRect screenAvailableRect(Widget* widget) { - return ChromiumBridge::screenAvailableRect(widget); + return PlatformBridge::screenAvailableRect(widget); } } // namespace WebCore diff --git a/Source/WebCore/platform/chromium/PopupMenuChromium.cpp b/Source/WebCore/platform/chromium/PopupMenuChromium.cpp index bb45e79..075cef0 100644 --- a/Source/WebCore/platform/chromium/PopupMenuChromium.cpp +++ b/Source/WebCore/platform/chromium/PopupMenuChromium.cpp @@ -54,6 +54,7 @@ #include "ScrollbarTheme.h" #include "StringTruncator.h" #include "SystemTime.h" +#include "TextRun.h" #include "UserGestureIndicator.h" #include <wtf/CurrentTime.h> diff --git a/Source/WebCore/platform/chromium/ReadableDataObject.cpp b/Source/WebCore/platform/chromium/ReadableDataObject.cpp index 97c481b..dbf4739 100644 --- a/Source/WebCore/platform/chromium/ReadableDataObject.cpp +++ b/Source/WebCore/platform/chromium/ReadableDataObject.cpp @@ -31,10 +31,10 @@ #include "config.h" #include "ReadableDataObject.h" -#include "ChromiumBridge.h" #include "ClipboardMimeTypes.h" #include "Pasteboard.h" #include "PasteboardPrivate.h" +#include "PlatformBridge.h" namespace WebCore { @@ -80,19 +80,19 @@ String ReadableDataObject::getData(const String& type, bool& succeeded) const Pasteboard::generalPasteboard()->isSelectionMode() ? PasteboardPrivate::SelectionBuffer : PasteboardPrivate::StandardBuffer; - data = ChromiumBridge::clipboardReadPlainText(buffer); + data = PlatformBridge::clipboardReadPlainText(buffer); } else if (type == mimeTypeTextHTML) { PasteboardPrivate::ClipboardBuffer buffer = Pasteboard::generalPasteboard()->isSelectionMode() ? PasteboardPrivate::SelectionBuffer : PasteboardPrivate::StandardBuffer; KURL ignoredSourceURL; - ChromiumBridge::clipboardReadHTML(buffer, &data, &ignoredSourceURL); + PlatformBridge::clipboardReadHTML(buffer, &data, &ignoredSourceURL); } succeeded = !data.isEmpty(); return data; } - succeeded = ChromiumBridge::clipboardReadData( + succeeded = PlatformBridge::clipboardReadData( clipboardBuffer(m_clipboardType), type, data, ignoredMetadata); return data; } @@ -101,7 +101,7 @@ String ReadableDataObject::urlTitle() const { String ignoredData; String urlTitle; - ChromiumBridge::clipboardReadData( + PlatformBridge::clipboardReadData( clipboardBuffer(m_clipboardType), mimeTypeTextURIList, ignoredData, urlTitle); return urlTitle; } @@ -110,7 +110,7 @@ KURL ReadableDataObject::htmlBaseUrl() const { String ignoredData; String htmlBaseUrl; - ChromiumBridge::clipboardReadData( + PlatformBridge::clipboardReadData( clipboardBuffer(m_clipboardType), mimeTypeTextHTML, ignoredData, htmlBaseUrl); return KURL(ParsedURLString, htmlBaseUrl); } @@ -123,7 +123,7 @@ bool ReadableDataObject::containsFilenames() const Vector<String> ReadableDataObject::filenames() const { - return ChromiumBridge::clipboardReadFilenames(clipboardBuffer(m_clipboardType)); + return PlatformBridge::clipboardReadFilenames(clipboardBuffer(m_clipboardType)); } void ReadableDataObject::ensureTypeCacheInitialized() const @@ -131,7 +131,7 @@ void ReadableDataObject::ensureTypeCacheInitialized() const if (m_isTypeCacheInitialized) return; - m_types = ChromiumBridge::clipboardReadAvailableTypes( + m_types = PlatformBridge::clipboardReadAvailableTypes( clipboardBuffer(m_clipboardType), &m_containsFilenames); m_isTypeCacheInitialized = true; } diff --git a/Source/WebCore/platform/chromium/SSLKeyGeneratorChromium.cpp b/Source/WebCore/platform/chromium/SSLKeyGeneratorChromium.cpp index 49d9517..6467764 100644 --- a/Source/WebCore/platform/chromium/SSLKeyGeneratorChromium.cpp +++ b/Source/WebCore/platform/chromium/SSLKeyGeneratorChromium.cpp @@ -31,7 +31,7 @@ #include "config.h" #include "SSLKeyGenerator.h" -#include "ChromiumBridge.h" +#include "PlatformBridge.h" #include "PlatformString.h" namespace WebCore { @@ -51,7 +51,7 @@ String signedPublicKeyAndChallengeString(unsigned keySizeIndex, const String& challengeString, const KURL& url) { - return ChromiumBridge::signedPublicKeyAndChallengeString(keySizeIndex, + return PlatformBridge::signedPublicKeyAndChallengeString(keySizeIndex, challengeString, url); } diff --git a/Source/WebCore/platform/chromium/ScrollbarThemeChromium.cpp b/Source/WebCore/platform/chromium/ScrollbarThemeChromium.cpp index 234d0ee..b23e625 100644 --- a/Source/WebCore/platform/chromium/ScrollbarThemeChromium.cpp +++ b/Source/WebCore/platform/chromium/ScrollbarThemeChromium.cpp @@ -27,10 +27,10 @@ #include "config.h" #include "ScrollbarThemeChromium.h" -#include "ChromiumBridge.h" +#include "PlatformBridge.h" #include "PlatformMouseEvent.h" +#include "ScrollableArea.h" #include "Scrollbar.h" -#include "ScrollbarClient.h" #include "ScrollbarThemeComposite.h" // ----------------------------------------------------------------------------- @@ -110,7 +110,7 @@ void ScrollbarThemeChromium::paintTickmarks(GraphicsContext* context, Scrollbar* // Get the tickmarks for the frameview. Vector<IntRect> tickmarks; - scrollbar->client()->getTickmarks(tickmarks); + scrollbar->scrollableArea()->getTickmarks(tickmarks); if (!tickmarks.size()) return; diff --git a/Source/WebCore/platform/chromium/ScrollbarThemeChromiumLinux.cpp b/Source/WebCore/platform/chromium/ScrollbarThemeChromiumLinux.cpp index ba10953..e173dff 100644 --- a/Source/WebCore/platform/chromium/ScrollbarThemeChromiumLinux.cpp +++ b/Source/WebCore/platform/chromium/ScrollbarThemeChromiumLinux.cpp @@ -31,7 +31,7 @@ #include "config.h" #include "ScrollbarThemeChromiumLinux.h" -#include "ChromiumBridge.h" +#include "PlatformBridge.h" #include "PlatformMouseEvent.h" #include "Scrollbar.h" @@ -46,22 +46,22 @@ ScrollbarTheme* ScrollbarTheme::nativeTheme() int ScrollbarThemeChromiumLinux::scrollbarThickness(ScrollbarControlSize controlSize) { // Horiz and Vert scrollbars are the same thickness. - IntSize scrollbarSize = ChromiumBridge::getThemePartSize(ChromiumBridge::PartScrollbarVerticalTrack); + IntSize scrollbarSize = PlatformBridge::getThemePartSize(PlatformBridge::PartScrollbarVerticalTrack); return scrollbarSize.width(); } void ScrollbarThemeChromiumLinux::paintTrackPiece(GraphicsContext* gc, Scrollbar* scrollbar, const IntRect& rect, ScrollbarPart partType) { - ChromiumBridge::ThemePaintState state = scrollbar->hoveredPart() == partType ? ChromiumBridge::StateHover : ChromiumBridge::StateNormal; + PlatformBridge::ThemePaintState state = scrollbar->hoveredPart() == partType ? PlatformBridge::StateHover : PlatformBridge::StateNormal; IntRect alignRect = trackRect(scrollbar, false); - ChromiumBridge::ThemePaintExtraParams extraParams; + PlatformBridge::ThemePaintExtraParams extraParams; extraParams.scrollbarTrack.trackX = alignRect.x(); extraParams.scrollbarTrack.trackY = alignRect.y(); extraParams.scrollbarTrack.trackWidth = alignRect.width(); extraParams.scrollbarTrack.trackHeight = alignRect.height(); - ChromiumBridge::paintThemePart( + PlatformBridge::paintThemePart( gc, - scrollbar->orientation() == HorizontalScrollbar ? ChromiumBridge::PartScrollbarHorizontalTrack : ChromiumBridge::PartScrollbarVerticalTrack, + scrollbar->orientation() == HorizontalScrollbar ? PlatformBridge::PartScrollbarHorizontalTrack : PlatformBridge::PartScrollbarVerticalTrack, state, rect, &extraParams); @@ -69,52 +69,52 @@ void ScrollbarThemeChromiumLinux::paintTrackPiece(GraphicsContext* gc, Scrollbar void ScrollbarThemeChromiumLinux::paintButton(GraphicsContext* gc, Scrollbar* scrollbar, const IntRect& rect, ScrollbarPart part) { - ChromiumBridge::ThemePart paintPart; - ChromiumBridge::ThemePaintState state = ChromiumBridge::StateNormal; + PlatformBridge::ThemePart paintPart; + PlatformBridge::ThemePaintState state = PlatformBridge::StateNormal; bool checkMin = false; bool checkMax = false; if (scrollbar->orientation() == HorizontalScrollbar) { if (part == BackButtonStartPart) { - paintPart = ChromiumBridge::PartScrollbarLeftArrow; + paintPart = PlatformBridge::PartScrollbarLeftArrow; checkMin = true; } else { - paintPart = ChromiumBridge::PartScrollbarRightArrow; + paintPart = PlatformBridge::PartScrollbarRightArrow; checkMax = true; } } else { if (part == BackButtonStartPart) { - paintPart = ChromiumBridge::PartScrollbarUpArrow; + paintPart = PlatformBridge::PartScrollbarUpArrow; checkMin = true; } else { - paintPart = ChromiumBridge::PartScrollbarDownArrow; + paintPart = PlatformBridge::PartScrollbarDownArrow; checkMax = true; } } if ((checkMin && (scrollbar->currentPos() <= 0)) || (checkMax && scrollbar->currentPos() == scrollbar->maximum())) { - state = ChromiumBridge::StateDisabled; + state = PlatformBridge::StateDisabled; } else { if (part == scrollbar->pressedPart()) - state = ChromiumBridge::StatePressed; + state = PlatformBridge::StatePressed; else if (part == scrollbar->hoveredPart()) - state = ChromiumBridge::StateHover; + state = PlatformBridge::StateHover; } - ChromiumBridge::paintThemePart(gc, paintPart, state, rect, 0); + PlatformBridge::paintThemePart(gc, paintPart, state, rect, 0); } void ScrollbarThemeChromiumLinux::paintThumb(GraphicsContext* gc, Scrollbar* scrollbar, const IntRect& rect) { - ChromiumBridge::ThemePaintState state; + PlatformBridge::ThemePaintState state; if (scrollbar->pressedPart() == ThumbPart) - state = ChromiumBridge::StatePressed; + state = PlatformBridge::StatePressed; else if (scrollbar->hoveredPart() == ThumbPart) - state = ChromiumBridge::StateHover; + state = PlatformBridge::StateHover; else - state = ChromiumBridge::StateNormal; - ChromiumBridge::paintThemePart( + state = PlatformBridge::StateNormal; + PlatformBridge::paintThemePart( gc, - scrollbar->orientation() == HorizontalScrollbar ? ChromiumBridge::PartScrollbarHorizontalThumb : ChromiumBridge::PartScrollbarVerticalThumb, + scrollbar->orientation() == HorizontalScrollbar ? PlatformBridge::PartScrollbarHorizontalThumb : PlatformBridge::PartScrollbarVerticalThumb, state, rect, 0); @@ -128,23 +128,23 @@ bool ScrollbarThemeChromiumLinux::shouldCenterOnThumb(Scrollbar*, const Platform IntSize ScrollbarThemeChromiumLinux::buttonSize(Scrollbar* scrollbar) { if (scrollbar->orientation() == VerticalScrollbar) { - IntSize size = ChromiumBridge::getThemePartSize(ChromiumBridge::PartScrollbarUpArrow); + IntSize size = PlatformBridge::getThemePartSize(PlatformBridge::PartScrollbarUpArrow); return IntSize(size.width(), scrollbar->height() < 2 * size.height() ? scrollbar->height() / 2 : size.height()); } // HorizontalScrollbar - IntSize size = ChromiumBridge::getThemePartSize(ChromiumBridge::PartScrollbarLeftArrow); + IntSize size = PlatformBridge::getThemePartSize(PlatformBridge::PartScrollbarLeftArrow); return IntSize(scrollbar->width() < 2 * size.width() ? scrollbar->width() / 2 : size.width(), size.height()); } int ScrollbarThemeChromiumLinux::minimumThumbLength(Scrollbar* scrollbar) { if (scrollbar->orientation() == VerticalScrollbar) { - IntSize size = ChromiumBridge::getThemePartSize(ChromiumBridge::PartScrollbarVerticalThumb); + IntSize size = PlatformBridge::getThemePartSize(PlatformBridge::PartScrollbarVerticalThumb); return size.height(); } - IntSize size = ChromiumBridge::getThemePartSize(ChromiumBridge::PartScrollbarHorizontalThumb); + IntSize size = PlatformBridge::getThemePartSize(PlatformBridge::PartScrollbarHorizontalThumb); return size.width(); } diff --git a/Source/WebCore/platform/chromium/ScrollbarThemeChromiumMac.mm b/Source/WebCore/platform/chromium/ScrollbarThemeChromiumMac.mm index 0aa3e10..fe1a422 100644 --- a/Source/WebCore/platform/chromium/ScrollbarThemeChromiumMac.mm +++ b/Source/WebCore/platform/chromium/ScrollbarThemeChromiumMac.mm @@ -27,9 +27,9 @@ #include "config.h" #include "ScrollbarThemeChromiumMac.h" -#include "ChromiumBridge.h" #include "FrameView.h" #include "ImageBuffer.h" +#include "PlatformBridge.h" #include "PlatformMouseEvent.h" #include "ScrollView.h" #include <Carbon/Carbon.h> @@ -370,15 +370,15 @@ static int scrollbarPartToHIPressedState(ScrollbarPart part) } } -static ChromiumBridge::ThemePaintState scrollbarStateToThemeState(Scrollbar* scrollbar) { +static PlatformBridge::ThemePaintState scrollbarStateToThemeState(Scrollbar* scrollbar) { if (!scrollbar->enabled()) - return ChromiumBridge::StateDisabled; - if (!scrollbar->client()->isActive()) - return ChromiumBridge::StateInactive; + return PlatformBridge::StateDisabled; + if (!scrollbar->scrollableArea()->isActive()) + return PlatformBridge::StateInactive; if (scrollbar->pressedPart() == ThumbPart) - return ChromiumBridge::StatePressed; + return PlatformBridge::StatePressed; - return ChromiumBridge::StateActive; + return PlatformBridge::StateActive; } bool ScrollbarThemeChromiumMac::paint(Scrollbar* scrollbar, GraphicsContext* context, const IntRect& damageRect) @@ -398,7 +398,7 @@ bool ScrollbarThemeChromiumMac::paint(Scrollbar* scrollbar, GraphicsContext* con if (!scrollbar->enabled()) trackInfo.enableState = kThemeTrackDisabled; else - trackInfo.enableState = scrollbar->client()->isActive() ? kThemeTrackActive : kThemeTrackInactive; + trackInfo.enableState = scrollbar->scrollableArea()->isActive() ? kThemeTrackActive : kThemeTrackInactive; if (!hasButtons(scrollbar)) trackInfo.enableState = kThemeTrackNothingToScroll; @@ -428,7 +428,7 @@ bool ScrollbarThemeChromiumMac::paint(Scrollbar* scrollbar, GraphicsContext* con HIThemeDrawTrack(&trackInfo, 0, drawingContext->platformContext(), kHIThemeOrientationNormal); Vector<IntRect> tickmarks; - scrollbar->client()->getTickmarks(tickmarks); + scrollbar->scrollableArea()->getTickmarks(tickmarks); if (scrollbar->orientation() == VerticalScrollbar && tickmarks.size()) { drawingContext->save(); drawingContext->setShouldAntialias(false); @@ -463,18 +463,18 @@ bool ScrollbarThemeChromiumMac::paint(Scrollbar* scrollbar, GraphicsContext* con } if (hasThumb(scrollbar)) { - ChromiumBridge::ThemePaintScrollbarInfo scrollbarInfo; - scrollbarInfo.orientation = scrollbar->orientation() == HorizontalScrollbar ? ChromiumBridge::ScrollbarOrientationHorizontal : ChromiumBridge::ScrollbarOrientationVertical; - scrollbarInfo.parent = scrollbar->parent() && scrollbar->parent()->isFrameView() && static_cast<FrameView*>(scrollbar->parent())->isScrollViewScrollbar(scrollbar) ? ChromiumBridge::ScrollbarParentScrollView : ChromiumBridge::ScrollbarParentRenderLayer; + PlatformBridge::ThemePaintScrollbarInfo scrollbarInfo; + scrollbarInfo.orientation = scrollbar->orientation() == HorizontalScrollbar ? PlatformBridge::ScrollbarOrientationHorizontal : PlatformBridge::ScrollbarOrientationVertical; + scrollbarInfo.parent = scrollbar->parent() && scrollbar->parent()->isFrameView() && static_cast<FrameView*>(scrollbar->parent())->isScrollViewScrollbar(scrollbar) ? PlatformBridge::ScrollbarParentScrollView : PlatformBridge::ScrollbarParentRenderLayer; scrollbarInfo.maxValue = scrollbar->maximum(); scrollbarInfo.currentValue = scrollbar->currentPos(); scrollbarInfo.visibleSize = scrollbar->visibleSize(); scrollbarInfo.totalSize = scrollbar->totalSize(); - ChromiumBridge::paintScrollbarThumb( + PlatformBridge::paintScrollbarThumb( drawingContext, scrollbarStateToThemeState(scrollbar), - scrollbar->controlSize() == RegularScrollbar ? ChromiumBridge::SizeRegular : ChromiumBridge::SizeSmall, + scrollbar->controlSize() == RegularScrollbar ? PlatformBridge::SizeRegular : PlatformBridge::SizeSmall, scrollbar->frameRect(), scrollbarInfo); } diff --git a/Source/WebCore/platform/chromium/ScrollbarThemeChromiumWin.cpp b/Source/WebCore/platform/chromium/ScrollbarThemeChromiumWin.cpp index ba7e97b..29e8b44 100644 --- a/Source/WebCore/platform/chromium/ScrollbarThemeChromiumWin.cpp +++ b/Source/WebCore/platform/chromium/ScrollbarThemeChromiumWin.cpp @@ -30,8 +30,8 @@ #include <windows.h> #include <vsstyle.h> -#include "ChromiumBridge.h" #include "GraphicsContext.h" +#include "PlatformBridge.h" #include "PlatformContextSkia.h" #include "PlatformMouseEvent.h" #include "Scrollbar.h" @@ -61,7 +61,7 @@ int ScrollbarThemeChromiumWin::scrollbarThickness(ScrollbarControlSize controlSi { static int thickness; if (!thickness) { - if (ChromiumBridge::layoutTestMode()) + if (PlatformBridge::layoutTestMode()) return kMacScrollbarSize[controlSize]; thickness = GetSystemMetrics(SM_CXVSCROLL); } @@ -104,7 +104,7 @@ void ScrollbarThemeChromiumWin::paintTrackPiece(GraphicsContext* gc, Scrollbar* IntRect alignRect = trackRect(scrollbar, false); // Draw the track area before/after the thumb on the scroll bar. - ChromiumBridge::paintScrollbarTrack( + PlatformBridge::paintScrollbarTrack( gc, partId, getThemeState(scrollbar, partType), @@ -124,7 +124,7 @@ void ScrollbarThemeChromiumWin::paintButton(GraphicsContext* gc, Scrollbar* scro partId = horz ? DFCS_SCROLLRIGHT : DFCS_SCROLLDOWN; // Draw the thumb (the box you drag in the scroll bar to scroll). - ChromiumBridge::paintScrollbarArrow( + PlatformBridge::paintScrollbarArrow( gc, getThemeArrowState(scrollbar, part), partId | getClassicThemeState(scrollbar, part), @@ -136,7 +136,7 @@ void ScrollbarThemeChromiumWin::paintThumb(GraphicsContext* gc, Scrollbar* scrol bool horz = scrollbar->orientation() == HorizontalScrollbar; // Draw the thumb (the box you drag in the scroll bar to scroll). - ChromiumBridge::paintScrollbarThumb( + PlatformBridge::paintScrollbarThumb( gc, horz ? SBP_THUMBBTNHORZ : SBP_THUMBBTNVERT, getThemeState(scrollbar, ThumbPart), @@ -144,7 +144,7 @@ void ScrollbarThemeChromiumWin::paintThumb(GraphicsContext* gc, Scrollbar* scrol rect); // Draw the gripper (the three little lines on the thumb). - ChromiumBridge::paintScrollbarThumb( + PlatformBridge::paintScrollbarThumb( gc, horz ? SBP_GRIPPERHORZ : SBP_GRIPPERVERT, getThemeState(scrollbar, ThumbPart), @@ -256,7 +256,7 @@ IntSize ScrollbarThemeChromiumWin::buttonSize(Scrollbar* scrollbar) // test mode so that should be enough to result in repeatable results, but // preserving this hack avoids having to rebaseline pixel tests. const int kLayoutTestModeGirth = 17; - int girth = ChromiumBridge::layoutTestMode() ? kLayoutTestModeGirth : thickness; + int girth = PlatformBridge::layoutTestMode() ? kLayoutTestModeGirth : thickness; if (scrollbar->orientation() == HorizontalScrollbar) { int width = scrollbar->width() < 2 * girth ? scrollbar->width() / 2 : girth; diff --git a/Source/WebCore/platform/chromium/SharedTimerChromium.cpp b/Source/WebCore/platform/chromium/SharedTimerChromium.cpp index 5a6a000..5acb253 100644 --- a/Source/WebCore/platform/chromium/SharedTimerChromium.cpp +++ b/Source/WebCore/platform/chromium/SharedTimerChromium.cpp @@ -26,23 +26,23 @@ #include "config.h" #include "SharedTimer.h" -#include "ChromiumBridge.h" +#include "PlatformBridge.h" namespace WebCore { void setSharedTimerFiredFunction(void (*f)()) { - ChromiumBridge::setSharedTimerFiredFunction(f); + PlatformBridge::setSharedTimerFiredFunction(f); } void setSharedTimerFireTime(double fireTime) { - ChromiumBridge::setSharedTimerFireTime(fireTime); + PlatformBridge::setSharedTimerFireTime(fireTime); } void stopSharedTimer() { - ChromiumBridge::stopSharedTimer(); + PlatformBridge::stopSharedTimer(); } } // namespace WebCore diff --git a/Source/WebCore/platform/chromium/SuddenTerminationChromium.cpp b/Source/WebCore/platform/chromium/SuddenTerminationChromium.cpp index 54b8304..06cc738 100644 --- a/Source/WebCore/platform/chromium/SuddenTerminationChromium.cpp +++ b/Source/WebCore/platform/chromium/SuddenTerminationChromium.cpp @@ -1,48 +1,48 @@ -/*
- * 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"
-#include "SuddenTermination.h"
-
-#include "ChromiumBridge.h"
-
-namespace WebCore {
-
-void disableSuddenTermination()
-{
- ChromiumBridge::suddenTerminationChanged(false);
-}
-
-void enableSuddenTermination()
-{
- ChromiumBridge::suddenTerminationChanged(true);
-}
-
-} // namespace WebCore
+/* + * 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" +#include "SuddenTermination.h" + +#include "PlatformBridge.h" + +namespace WebCore { + +void disableSuddenTermination() +{ + PlatformBridge::suddenTerminationChanged(false); +} + +void enableSuddenTermination() +{ + PlatformBridge::suddenTerminationChanged(true); +} + +} // namespace WebCore diff --git a/Source/WebCore/platform/chromium/SystemTimeChromium.cpp b/Source/WebCore/platform/chromium/SystemTimeChromium.cpp index 52ac262..93ac8b1 100644 --- a/Source/WebCore/platform/chromium/SystemTimeChromium.cpp +++ b/Source/WebCore/platform/chromium/SystemTimeChromium.cpp @@ -31,15 +31,15 @@ #include "config.h" #include "SystemTime.h" -#include "ChromiumBridge.h" #include "NotImplemented.h" +#include "PlatformBridge.h" namespace WebCore { // Get the current time in seconds since epoch. double currentTime() { - return ChromiumBridge::currentTime(); + return PlatformBridge::currentTime(); } float userIdleTime() diff --git a/Source/WebCore/platform/chromium/WidgetChromium.cpp b/Source/WebCore/platform/chromium/WidgetChromium.cpp index 1b7fef4..ac52244 100644 --- a/Source/WebCore/platform/chromium/WidgetChromium.cpp +++ b/Source/WebCore/platform/chromium/WidgetChromium.cpp @@ -32,7 +32,8 @@ #include "Widget.h" #include "Assertions.h" -#include "ChromiumBridge.h" +#include "HostWindow.h" +#include "ScrollView.h" namespace WebCore { @@ -56,7 +57,9 @@ void Widget::hide() void Widget::setCursor(const Cursor& cursor) { - ChromiumBridge::widgetSetCursor(this, cursor); + ScrollView* view = root(); + if (view) + view->hostWindow()->setCursor(cursor); } void Widget::paint(GraphicsContext*, const IntRect&) diff --git a/Source/WebCore/platform/chromium/WritableDataObject.cpp b/Source/WebCore/platform/chromium/WritableDataObject.cpp index 7cbf42c..a1ac7d9 100644 --- a/Source/WebCore/platform/chromium/WritableDataObject.cpp +++ b/Source/WebCore/platform/chromium/WritableDataObject.cpp @@ -31,8 +31,8 @@ #include "config.h" #include "WritableDataObject.h" -#include "ChromiumBridge.h" #include "ClipboardMimeTypes.h" +#include "PlatformBridge.h" namespace WebCore { @@ -80,7 +80,7 @@ bool WritableDataObject::setData(const String& type, const String& data) // FIXME: This is currently unimplemented on the Chromium-side. This is // "okay" for now since the original implementation didn't support it // anyway. Going forward, this is something we'll need to fix though. - ChromiumBridge::clipboardWriteData(type, data, ""); + PlatformBridge::clipboardWriteData(type, data, ""); return true; } m_dataMap.set(type, data); diff --git a/Source/WebCore/platform/efl/ScrollbarEfl.cpp b/Source/WebCore/platform/efl/ScrollbarEfl.cpp index 282ca7c..e71d1e3 100644 --- a/Source/WebCore/platform/efl/ScrollbarEfl.cpp +++ b/Source/WebCore/platform/efl/ScrollbarEfl.cpp @@ -42,13 +42,13 @@ using namespace std; using namespace WebCore; -PassRefPtr<Scrollbar> Scrollbar::createNativeScrollbar(ScrollbarClient* client, ScrollbarOrientation orientation, ScrollbarControlSize size) +PassRefPtr<Scrollbar> Scrollbar::createNativeScrollbar(ScrollableArea* scrollableArea, ScrollbarOrientation orientation, ScrollbarControlSize size) { - return adoptRef(new ScrollbarEfl(client, orientation, size)); + return adoptRef(new ScrollbarEfl(scrollableArea, orientation, size)); } -ScrollbarEfl::ScrollbarEfl(ScrollbarClient* client, ScrollbarOrientation orientation, ScrollbarControlSize controlSize) - : Scrollbar(client, orientation, controlSize) +ScrollbarEfl::ScrollbarEfl(ScrollableArea* scrollableArea, ScrollbarOrientation orientation, ScrollbarControlSize controlSize) + : Scrollbar(scrollableArea, orientation, controlSize) , m_lastPos(0) , m_lastTotalSize(0) , m_lastVisibleSize(0) @@ -84,7 +84,7 @@ static void scrollbarEflEdjeMessage(void* data, Evas_Object* o, Edje_Message_Typ m = static_cast<Edje_Message_Float*>(msg); v = m->val * (that->totalSize() - that->visibleSize()); - that->setValue(v, Scrollbar::NotFromScrollAnimator); + that->scrollableArea()->scrollToOffsetWithoutAnimation(that->orientation(), v); } void ScrollbarEfl::setParent(ScrollView* view) diff --git a/Source/WebCore/platform/efl/ScrollbarEfl.h b/Source/WebCore/platform/efl/ScrollbarEfl.h index 35375a6..09dc64f 100644 --- a/Source/WebCore/platform/efl/ScrollbarEfl.h +++ b/Source/WebCore/platform/efl/ScrollbarEfl.h @@ -52,7 +52,7 @@ public: virtual void paint(GraphicsContext* context, const IntRect& damageRect); protected: - ScrollbarEfl(ScrollbarClient*, ScrollbarOrientation, ScrollbarControlSize); + ScrollbarEfl(ScrollableArea*, ScrollbarOrientation, ScrollbarControlSize); virtual void updateThumbPositionAndProportion(); virtual void updateThumbPosition(); diff --git a/Source/WebCore/platform/graphics/ANGLEWebKitBridge.cpp b/Source/WebCore/platform/graphics/ANGLEWebKitBridge.cpp index 64f19c4..f416b47 100644 --- a/Source/WebCore/platform/graphics/ANGLEWebKitBridge.cpp +++ b/Source/WebCore/platform/graphics/ANGLEWebKitBridge.cpp @@ -28,29 +28,53 @@ #if ENABLE(3D_CANVAS) #include "ANGLEWebKitBridge.h" +#include <wtf/OwnArrayPtr.h> namespace WebCore { ANGLEWebKitBridge::ANGLEWebKitBridge() : - builtCompilers(false) + builtCompilers(false), + m_fragmentCompiler(0), + m_vertexCompiler(0) { ShInitialize(); } ANGLEWebKitBridge::~ANGLEWebKitBridge() { - if (builtCompilers) { + cleanupCompilers(); +} + +void ANGLEWebKitBridge::cleanupCompilers() +{ + if (m_fragmentCompiler) ShDestruct(m_fragmentCompiler); + m_fragmentCompiler = 0; + if (m_vertexCompiler) ShDestruct(m_vertexCompiler); - } + m_vertexCompiler = 0; + + builtCompilers = false; +} + +void ANGLEWebKitBridge::setResources(ShBuiltInResources resources) +{ + // Resources are (possibly) changing - cleanup compilers if we had them already + cleanupCompilers(); + + m_resources = resources; } bool ANGLEWebKitBridge::validateShaderSource(const char* shaderSource, ANGLEShaderType shaderType, String& translatedShaderSource, String& shaderValidationLog) { if (!builtCompilers) { - m_fragmentCompiler = ShConstructCompiler(EShLangFragment, EShSpecWebGL, &m_resources); - m_vertexCompiler = ShConstructCompiler(EShLangVertex, EShSpecWebGL, &m_resources); + m_fragmentCompiler = ShConstructCompiler(SH_FRAGMENT_SHADER, SH_WEBGL_SPEC, &m_resources); + m_vertexCompiler = ShConstructCompiler(SH_VERTEX_SHADER, SH_WEBGL_SPEC, &m_resources); + if (!m_fragmentCompiler || !m_vertexCompiler) { + cleanupCompilers(); + return false; + } builtCompilers = true; } @@ -64,12 +88,31 @@ bool ANGLEWebKitBridge::validateShaderSource(const char* shaderSource, ANGLEShad const char* const shaderSourceStrings[] = { shaderSource }; - bool validateSuccess = ShCompile(compiler, shaderSourceStrings, 1, EShOptNone, EDebugOpIntermediate); + bool validateSuccess = ShCompile(compiler, shaderSourceStrings, 1, SH_OBJECT_CODE); + if (!validateSuccess) { + int logSize = 0; + ShGetInfo(compiler, SH_INFO_LOG_LENGTH, &logSize); + if (logSize > 1) { + OwnArrayPtr<char> logBuffer(new char[logSize]); + if (logBuffer) { + ShGetInfoLog(compiler, logBuffer.get()); + shaderValidationLog = logBuffer.get(); + } + } + return false; + } - translatedShaderSource = ShGetObjectCode(compiler); - shaderValidationLog = ShGetInfoLog(compiler); + int translationLength = 0; + ShGetInfo(compiler, SH_OBJECT_CODE_LENGTH, &translationLength); + if (translationLength > 1) { + OwnArrayPtr<char> translationBuffer(new char[translationLength]); + if (!translationBuffer) + return false; + ShGetObjectCode(compiler, translationBuffer.get()); + translatedShaderSource = translationBuffer.get(); + } - return validateSuccess; + return true; } } diff --git a/Source/WebCore/platform/graphics/ANGLEWebKitBridge.h b/Source/WebCore/platform/graphics/ANGLEWebKitBridge.h index d01de8f..7bddbf4 100644 --- a/Source/WebCore/platform/graphics/ANGLEWebKitBridge.h +++ b/Source/WebCore/platform/graphics/ANGLEWebKitBridge.h @@ -34,8 +34,8 @@ namespace WebCore { enum ANGLEShaderType { - SHADER_TYPE_VERTEX = EShLangVertex, - SHADER_TYPE_FRAGMENT = EShLangFragment + SHADER_TYPE_VERTEX = SH_VERTEX_SHADER, + SHADER_TYPE_FRAGMENT = SH_FRAGMENT_SHADER, }; class ANGLEWebKitBridge { @@ -44,18 +44,21 @@ public: ANGLEWebKitBridge(); ~ANGLEWebKitBridge(); - void setResources(TBuiltInResource resources) { m_resources = resources; } + ShBuiltInResources getResources() { return m_resources; } + void setResources(ShBuiltInResources); bool validateShaderSource(const char* shaderSource, ANGLEShaderType shaderType, String& translatedShaderSource, String& shaderValidationLog); private: - ShHandle m_fragmentCompiler; - ShHandle m_vertexCompiler; + void cleanupCompilers(); bool builtCompilers; + + ShHandle m_fragmentCompiler; + ShHandle m_vertexCompiler; - TBuiltInResource m_resources; + ShBuiltInResources m_resources; }; } // namespace WebCore diff --git a/Source/WebCore/platform/graphics/BitmapImage.h b/Source/WebCore/platform/graphics/BitmapImage.h index 72f3092..93fc464 100644 --- a/Source/WebCore/platform/graphics/BitmapImage.h +++ b/Source/WebCore/platform/graphics/BitmapImage.h @@ -68,7 +68,9 @@ template <typename T> class Timer; // FrameData Class // ================================================ -struct FrameData : Noncopyable { +struct FrameData { + WTF_MAKE_NONCOPYABLE(FrameData); +public: FrameData() : m_frame(0) , m_haveMetadata(false) diff --git a/Source/WebCore/platform/graphics/Color.h b/Source/WebCore/platform/graphics/Color.h index fa37d32..2a03238 100644 --- a/Source/WebCore/platform/graphics/Color.h +++ b/Source/WebCore/platform/graphics/Color.h @@ -78,7 +78,8 @@ inline int greenChannel(RGBA32 color) { return (color >> 8) & 0xFF; } inline int blueChannel(RGBA32 color) { return color & 0xFF; } inline int alphaChannel(RGBA32 color) { return (color >> 24) & 0xFF; } -class Color : public FastAllocBase { +class Color { + WTF_MAKE_FAST_ALLOCATED; public: Color() : m_color(0), m_valid(false) { } Color(RGBA32 col) : m_color(col), m_valid(true) { } diff --git a/Source/WebCore/platform/graphics/Extensions3D.h b/Source/WebCore/platform/graphics/Extensions3D.h index 0363a48..1a2b7a1 100644 --- a/Source/WebCore/platform/graphics/Extensions3D.h +++ b/Source/WebCore/platform/graphics/Extensions3D.h @@ -51,6 +51,7 @@ public: // GL_EXT_packed_depth_stencil / GL_OES_packed_depth_stencil // GL_ANGLE_framebuffer_blit / GL_ANGLE_framebuffer_multisample // GL_OES_texture_float + // GL_OES_standard_derivatives // Takes full name of extension; for example, // "GL_EXT_texture_format_BGRA8888". @@ -82,7 +83,10 @@ public: // GL_ANGLE_framebuffer_multisample names RENDERBUFFER_SAMPLES = 0x8CAB, FRAMEBUFFER_INCOMPLETE_MULTISAMPLE = 0x8D56, - MAX_SAMPLES = 0x8D57 + MAX_SAMPLES = 0x8D57, + + // GL_OES_standard_derivatives names + FRAGMENT_SHADER_DERIVATIVE_HINT_OES = 0x8B8B, }; // GL_ARB_robustness diff --git a/Source/WebCore/platform/graphics/FloatPoint.cpp b/Source/WebCore/platform/graphics/FloatPoint.cpp index 7e85b52..226ae71 100644 --- a/Source/WebCore/platform/graphics/FloatPoint.cpp +++ b/Source/WebCore/platform/graphics/FloatPoint.cpp @@ -27,6 +27,7 @@ #include "config.h" #include "FloatPoint.h" +#include "AffineTransform.h" #include "TransformationMatrix.h" #include "FloatConversion.h" #include "IntPoint.h" diff --git a/Source/WebCore/platform/graphics/Font.cpp b/Source/WebCore/platform/graphics/Font.cpp index 887e21d..394de35 100644 --- a/Source/WebCore/platform/graphics/Font.cpp +++ b/Source/WebCore/platform/graphics/Font.cpp @@ -29,6 +29,7 @@ #include "FontTranscoder.h" #include "IntPoint.h" #include "GlyphBuffer.h" +#include "TextRun.h" #include "WidthIterator.h" #include <wtf/MathExtras.h> #include <wtf/UnusedParam.h> diff --git a/Source/WebCore/platform/graphics/Font.h b/Source/WebCore/platform/graphics/Font.h index 40a8828..2957c0a 100644 --- a/Source/WebCore/platform/graphics/Font.h +++ b/Source/WebCore/platform/graphics/Font.h @@ -29,7 +29,6 @@ #include "FontDescription.h" #include "FontFallbackList.h" #include "SimpleFontData.h" -#include "TextRun.h" #include "TypesettingFeatures.h" #include <wtf/HashMap.h> #include <wtf/HashSet.h> @@ -51,6 +50,7 @@ class GlyphBuffer; class GlyphPageTreeNode; class GraphicsContext; class SVGFontElement; +class TextRun; struct GlyphData; diff --git a/Source/WebCore/platform/graphics/FontCache.cpp b/Source/WebCore/platform/graphics/FontCache.cpp index 149ea79..cfca980 100644 --- a/Source/WebCore/platform/graphics/FontCache.cpp +++ b/Source/WebCore/platform/graphics/FontCache.cpp @@ -53,7 +53,9 @@ FontCache::FontCache() { } -struct FontPlatformDataCacheKey : FastAllocBase { +struct FontPlatformDataCacheKey { + WTF_MAKE_FAST_ALLOCATED; +public: FontPlatformDataCacheKey(const AtomicString& family = AtomicString(), unsigned size = 0, unsigned weight = 0, bool italic = false, bool isPrinterFont = false, FontRenderingMode renderingMode = NormalRenderingMode, FontOrientation orientation = Horizontal) : m_size(size) diff --git a/Source/WebCore/platform/graphics/FontCache.h b/Source/WebCore/platform/graphics/FontCache.h index e6845d9..86f8c67 100644 --- a/Source/WebCore/platform/graphics/FontCache.h +++ b/Source/WebCore/platform/graphics/FontCache.h @@ -50,7 +50,8 @@ class FontDescription; class FontSelector; class SimpleFontData; -class FontCache : public Noncopyable { +class FontCache { + WTF_MAKE_NONCOPYABLE(FontCache); WTF_MAKE_FAST_ALLOCATED; public: friend FontCache* fontCache(); diff --git a/Source/WebCore/platform/graphics/FontData.h b/Source/WebCore/platform/graphics/FontData.h index ee94a98..3d35d2a 100644 --- a/Source/WebCore/platform/graphics/FontData.h +++ b/Source/WebCore/platform/graphics/FontData.h @@ -26,6 +26,7 @@ #ifndef FontData_h #define FontData_h +#include <wtf/FastAllocBase.h> #include <wtf/Forward.h> #include <wtf/Noncopyable.h> #include <wtf/unicode/Unicode.h> @@ -34,7 +35,8 @@ namespace WebCore { class SimpleFontData; -class FontData : public Noncopyable { +class FontData { + WTF_MAKE_NONCOPYABLE(FontData); WTF_MAKE_FAST_ALLOCATED; public: FontData() : m_maxGlyphPageTreeLevel(0) diff --git a/Source/WebCore/platform/graphics/FontFastPath.cpp b/Source/WebCore/platform/graphics/FontFastPath.cpp index 367c8a2..f927c13 100644 --- a/Source/WebCore/platform/graphics/FontFastPath.cpp +++ b/Source/WebCore/platform/graphics/FontFastPath.cpp @@ -30,6 +30,7 @@ #include "GlyphBuffer.h" #include "GlyphPageTreeNode.h" #include "SimpleFontData.h" +#include "TextRun.h" #include "WidthIterator.h" #include <wtf/MathExtras.h> diff --git a/Source/WebCore/platform/graphics/GlyphMetricsMap.h b/Source/WebCore/platform/graphics/GlyphMetricsMap.h index fa85bcc..3e13fbb 100644 --- a/Source/WebCore/platform/graphics/GlyphMetricsMap.h +++ b/Source/WebCore/platform/graphics/GlyphMetricsMap.h @@ -40,7 +40,8 @@ typedef unsigned short Glyph; const float cGlyphSizeUnknown = -1; -template<class T> class GlyphMetricsMap : public Noncopyable { +template<class T> class GlyphMetricsMap { + WTF_MAKE_NONCOPYABLE(GlyphMetricsMap); public: GlyphMetricsMap() : m_filledPrimaryPage(false) { } ~GlyphMetricsMap() diff --git a/Source/WebCore/platform/graphics/GraphicsContext.cpp b/Source/WebCore/platform/graphics/GraphicsContext.cpp index c9c1f63..9f94ac9 100644 --- a/Source/WebCore/platform/graphics/GraphicsContext.cpp +++ b/Source/WebCore/platform/graphics/GraphicsContext.cpp @@ -31,6 +31,8 @@ #include "Generator.h" #include "ImageBuffer.h" #include "IntRect.h" +#include "RoundedIntRect.h" +#include "TextRun.h" using namespace std; @@ -536,25 +538,23 @@ void GraphicsContext::drawImageBuffer(ImageBuffer* image, ColorSpace styleColorS image->draw(this, styleColorSpace, dest, src, op, useLowQualityScale); } -void GraphicsContext::addRoundedRectClip(const IntRect& rect, const IntSize& topLeft, const IntSize& topRight, - const IntSize& bottomLeft, const IntSize& bottomRight) +void GraphicsContext::addRoundedRectClip(const RoundedIntRect& rect) { if (paintingDisabled()) return; Path path; - path.addRoundedRect(rect, topLeft, topRight, bottomLeft, bottomRight); + path.addRoundedRect(rect.rect(), rect.radii().topLeft(), rect.radii().topRight(), rect.radii().bottomLeft(), rect.radii().bottomRight()); clip(path); } -void GraphicsContext::clipOutRoundedRect(const IntRect& rect, const IntSize& topLeft, const IntSize& topRight, - const IntSize& bottomLeft, const IntSize& bottomRight) +void GraphicsContext::clipOutRoundedRect(const RoundedIntRect& rect) { if (paintingDisabled()) return; Path path; - path.addRoundedRect(rect, topLeft, topRight, bottomLeft, bottomRight); + path.addRoundedRect(rect.rect(), rect.radii().topLeft(), rect.radii().topRight(), rect.radii().bottomLeft(), rect.radii().bottomRight()); clipOut(path); } @@ -585,6 +585,11 @@ void GraphicsContext::fillRect(const FloatRect& rect, Generator& generator) generator.fill(this, rect); } +void GraphicsContext::fillRoundedRect(const RoundedIntRect& rect, const Color& color, ColorSpace colorSpace) +{ + fillRoundedRect(rect.rect(), rect.radii().topLeft(), rect.radii().topRight(), rect.radii().bottomLeft(), rect.radii().bottomRight(), color, colorSpace); +} + void GraphicsContext::setCompositeOperation(CompositeOperator compositeOperation) { m_state.compositeOperator = compositeOperation; diff --git a/Source/WebCore/platform/graphics/GraphicsContext.h b/Source/WebCore/platform/graphics/GraphicsContext.h index a648680..77321e2 100644 --- a/Source/WebCore/platform/graphics/GraphicsContext.h +++ b/Source/WebCore/platform/graphics/GraphicsContext.h @@ -128,6 +128,7 @@ namespace WebCore { class GraphicsContextPlatformPrivate; class ImageBuffer; class IntRect; + class RoundedIntRect; class KURL; class SharedGraphicsContext3D; class TextRun; @@ -213,7 +214,8 @@ namespace WebCore { bool shadowsIgnoreTransforms : 1; }; - class GraphicsContext : public Noncopyable { + class GraphicsContext { + WTF_MAKE_NONCOPYABLE(GraphicsContext); WTF_MAKE_FAST_ALLOCATED; public: GraphicsContext(PlatformGraphicsContext*); ~GraphicsContext(); @@ -317,6 +319,7 @@ namespace WebCore { void fillRect(const FloatRect&, const Color&, ColorSpace); void fillRect(const FloatRect&, Generator&); void fillRoundedRect(const IntRect&, const IntSize& topLeft, const IntSize& topRight, const IntSize& bottomLeft, const IntSize& bottomRight, const Color&, ColorSpace); + void fillRoundedRect(const RoundedIntRect&, const Color&, ColorSpace); void clearRect(const FloatRect&); @@ -345,10 +348,10 @@ namespace WebCore { InterpolationQuality imageInterpolationQuality() const; void clip(const FloatRect&); - void addRoundedRectClip(const IntRect&, const IntSize& topLeft, const IntSize& topRight, const IntSize& bottomLeft, const IntSize& bottomRight); + void addRoundedRectClip(const RoundedIntRect&); void addInnerRoundedRectClip(const IntRect&, int thickness); void clipOut(const IntRect&); - void clipOutRoundedRect(const IntRect&, const IntSize& topLeft, const IntSize& topRight, const IntSize& bottomLeft, const IntSize& bottomRight); + void clipOutRoundedRect(const RoundedIntRect&); void clipPath(const Path&, WindRule); void clipConvexPolygon(size_t numPoints, const FloatPoint*, bool antialias = true); void clipToImageBuffer(ImageBuffer*, const FloatRect&); @@ -457,7 +460,8 @@ namespace WebCore { void setShouldIncludeChildWindows(bool); bool shouldIncludeChildWindows() const; - class WindowsBitmap : public Noncopyable { + class WindowsBitmap { + WTF_MAKE_NONCOPYABLE(WindowsBitmap); public: WindowsBitmap(HDC, IntSize); ~WindowsBitmap(); diff --git a/Source/WebCore/platform/graphics/GraphicsContext3D.h b/Source/WebCore/platform/graphics/GraphicsContext3D.h index 10aa0d7..24827e5 100644 --- a/Source/WebCore/platform/graphics/GraphicsContext3D.h +++ b/Source/WebCore/platform/graphics/GraphicsContext3D.h @@ -883,6 +883,7 @@ public: } ShaderSourceEntry; HashMap<Platform3DObject, ShaderSourceEntry> m_shaderSourceMap; + friend class Extensions3DOpenGL; ANGLEWebKitBridge m_compiler; OwnPtr<Extensions3DOpenGL> m_extensions; diff --git a/Source/WebCore/platform/graphics/GraphicsLayer.h b/Source/WebCore/platform/graphics/GraphicsLayer.h index 8943f6c..e3a62b6 100644 --- a/Source/WebCore/platform/graphics/GraphicsLayer.h +++ b/Source/WebCore/platform/graphics/GraphicsLayer.h @@ -100,7 +100,8 @@ class TimingFunction; // Base class for animation values (also used for transitions). Here to // represent values for properties being animated via the GraphicsLayer, // without pulling in style-related data from outside of the platform directory. -class AnimationValue : public Noncopyable { +class AnimationValue { + WTF_MAKE_NONCOPYABLE(AnimationValue); WTF_MAKE_FAST_ALLOCATED; public: AnimationValue(float keyTime, PassRefPtr<TimingFunction> timingFunction = 0) : m_keyTime(keyTime) @@ -152,7 +153,8 @@ private: // Used to store a series of values in a keyframe list. Values will all be of the same type, // which can be inferred from the property. -class KeyframeValueList : public Noncopyable { +class KeyframeValueList { + WTF_MAKE_NONCOPYABLE(KeyframeValueList); WTF_MAKE_FAST_ALLOCATED; public: KeyframeValueList(AnimatedPropertyID property) @@ -184,8 +186,8 @@ protected: // which may have associated transformation and animations. class GraphicsLayer { + WTF_MAKE_NONCOPYABLE(GraphicsLayer); WTF_MAKE_FAST_ALLOCATED; public: - static PassOwnPtr<GraphicsLayer> create(GraphicsLayerClient*); virtual ~GraphicsLayer(); diff --git a/Source/WebCore/platform/graphics/ImageBuffer.h b/Source/WebCore/platform/graphics/ImageBuffer.h index 338e3f8..48878da 100644 --- a/Source/WebCore/platform/graphics/ImageBuffer.h +++ b/Source/WebCore/platform/graphics/ImageBuffer.h @@ -31,7 +31,7 @@ #include "AffineTransform.h" #include "ColorSpace.h" #include "FloatRect.h" -#include "Image.h" +#include "GraphicsTypes.h" #include "IntSize.h" #include "ImageBufferData.h" #include <wtf/ByteArray.h> @@ -39,6 +39,7 @@ #include <wtf/OwnPtr.h> #include <wtf/PassOwnPtr.h> #include <wtf/PassRefPtr.h> +#include <wtf/Vector.h> #if (PLATFORM(MAC) && PLATFORM(CA) && !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)) #define WTF_USE_IOSURFACE_CANVAS_BACKING_STORE 1 @@ -47,6 +48,7 @@ namespace WebCore { class GraphicsContext; + class Image; class ImageData; class IntPoint; class IntRect; @@ -61,7 +63,8 @@ namespace WebCore { Accelerated }; - class ImageBuffer : public Noncopyable { + class ImageBuffer { + WTF_MAKE_NONCOPYABLE(ImageBuffer); WTF_MAKE_FAST_ALLOCATED; public: // Will return a null pointer on allocation failure. static PassOwnPtr<ImageBuffer> create(const IntSize& size, ColorSpace colorSpace = ColorSpaceDeviceRGB, RenderingMode renderingMode = Unaccelerated) @@ -79,6 +82,8 @@ namespace WebCore { int width() const { return m_size.width(); } int height() const { return m_size.height(); } + size_t dataSize() const; + GraphicsContext* context() const; bool drawsUsingCopy() const; // If the image buffer has to render using a copied image, it will return true. diff --git a/Source/WebCore/platform/graphics/ImageSource.h b/Source/WebCore/platform/graphics/ImageSource.h index 1452b71..70b2cf5 100644 --- a/Source/WebCore/platform/graphics/ImageSource.h +++ b/Source/WebCore/platform/graphics/ImageSource.h @@ -136,7 +136,8 @@ const int cAnimationLoopOnce = 0; const int cAnimationLoopInfinite = -1; const int cAnimationNone = -2; -class ImageSource : public Noncopyable { +class ImageSource { + WTF_MAKE_NONCOPYABLE(ImageSource); public: enum AlphaOption { AlphaPremultiplied, diff --git a/Source/WebCore/platform/graphics/MediaPlayer.cpp b/Source/WebCore/platform/graphics/MediaPlayer.cpp index 4a39e9e..60f55a5 100644 --- a/Source/WebCore/platform/graphics/MediaPlayer.cpp +++ b/Source/WebCore/platform/graphics/MediaPlayer.cpp @@ -150,7 +150,9 @@ static MediaPlayerPrivateInterface* createNullMediaPlayer(MediaPlayer* player) // engine support -struct MediaPlayerFactory : Noncopyable { +struct MediaPlayerFactory { + WTF_MAKE_NONCOPYABLE(MediaPlayerFactory); WTF_MAKE_FAST_ALLOCATED; +public: MediaPlayerFactory(CreateMediaEnginePlayer constructor, MediaEngineSupportedTypes getSupportedTypes, MediaEngineSupportsType supportsTypeAndCodecs) : constructor(constructor) , getSupportedTypes(getSupportedTypes) diff --git a/Source/WebCore/platform/graphics/MediaPlayer.h b/Source/WebCore/platform/graphics/MediaPlayer.h index 6525ca6..ef0b3eb 100644 --- a/Source/WebCore/platform/graphics/MediaPlayer.h +++ b/Source/WebCore/platform/graphics/MediaPlayer.h @@ -149,7 +149,8 @@ public: #endif }; -class MediaPlayer : public Noncopyable { +class MediaPlayer { + WTF_MAKE_NONCOPYABLE(MediaPlayer); WTF_MAKE_FAST_ALLOCATED; public: static PassOwnPtr<MediaPlayer> create(MediaPlayerClient* client) diff --git a/Source/WebCore/platform/graphics/MediaPlayerPrivate.h b/Source/WebCore/platform/graphics/MediaPlayerPrivate.h index d956286..6abe258 100644 --- a/Source/WebCore/platform/graphics/MediaPlayerPrivate.h +++ b/Source/WebCore/platform/graphics/MediaPlayerPrivate.h @@ -36,8 +36,10 @@ namespace WebCore { class IntRect; class IntSize; -class MediaPlayerPrivateInterface : public Noncopyable { +class MediaPlayerPrivateInterface { + WTF_MAKE_NONCOPYABLE(MediaPlayerPrivateInterface); WTF_MAKE_FAST_ALLOCATED; public: + MediaPlayerPrivateInterface() { } virtual ~MediaPlayerPrivateInterface() { } virtual void load(const String& url) = 0; diff --git a/Source/WebCore/platform/graphics/Path.h b/Source/WebCore/platform/graphics/Path.h index 423a792..852d88e 100644 --- a/Source/WebCore/platform/graphics/Path.h +++ b/Source/WebCore/platform/graphics/Path.h @@ -100,7 +100,8 @@ namespace WebCore { typedef void (*PathApplierFunction)(void* info, const PathElement*); - class Path : public FastAllocBase { + class Path { + WTF_MAKE_FAST_ALLOCATED; public: Path(); ~Path(); diff --git a/Source/WebCore/platform/graphics/RoundedIntRect.cpp b/Source/WebCore/platform/graphics/RoundedIntRect.cpp new file mode 100644 index 0000000..4e80c9a --- /dev/null +++ b/Source/WebCore/platform/graphics/RoundedIntRect.cpp @@ -0,0 +1,141 @@ +/* + * Copyright (C) 2003, 2006, 2009 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 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. + */ + +#include "config.h" +#include "RoundedIntRect.h" + +#include "IntRect.h" +#include <algorithm> + +namespace WebCore { + +bool RoundedIntRect::Radii::isZero() const +{ + return m_topLeft.isZero() && m_topRight.isZero() && m_bottomLeft.isZero() && m_bottomRight.isZero(); +} + +void RoundedIntRect::Radii::scale(float factor) +{ + if (factor == 1) + return; + + // If either radius on a corner becomes zero, reset both radii on that corner. + m_topLeft.scale(factor); + if (!m_topLeft.width() || !m_topLeft.height()) + m_topLeft = IntSize(); + m_topRight.scale(factor); + if (!m_topRight.width() || !m_topRight.height()) + m_topRight = IntSize(); + m_bottomLeft.scale(factor); + if (!m_bottomLeft.width() || !m_bottomLeft.height()) + m_bottomLeft = IntSize(); + m_bottomRight.scale(factor); + if (!m_bottomRight.width() || !m_bottomRight.height()) + m_bottomRight = IntSize(); + +} + +void RoundedIntRect::Radii::expand(int topWidth, int bottomWidth, int leftWidth, int rightWidth) +{ + m_topLeft.setWidth(std::max(0, m_topLeft.width() + leftWidth)); + m_topLeft.setHeight(std::max(0, m_topLeft.height() + topWidth)); + + m_topRight.setWidth(std::max(0, m_topRight.width() + rightWidth)); + m_topRight.setHeight(std::max(0, m_topRight.height() + topWidth)); + + m_bottomLeft.setWidth(std::max(0, m_bottomLeft.width() + leftWidth)); + m_bottomLeft.setHeight(std::max(0, m_bottomLeft.height() + bottomWidth)); + + m_bottomRight.setWidth(std::max(0, m_bottomRight.width() + rightWidth)); + m_bottomRight.setHeight(std::max(0, m_bottomRight.height() + bottomWidth)); +} + +void RoundedIntRect::Radii::includeLogicalEdges(const RoundedIntRect::Radii& edges, bool isHorizontal, bool includeLogicalLeftEdge, bool includeLogicalRightEdge) +{ + if (includeLogicalLeftEdge) { + if (isHorizontal) + m_bottomLeft = edges.bottomLeft(); + else + m_topRight = edges.topRight(); + m_topLeft = edges.topLeft(); + } + + if (includeLogicalRightEdge) { + if (isHorizontal) + m_topRight = edges.topRight(); + else + m_bottomLeft = edges.bottomLeft(); + m_bottomRight = edges.bottomRight(); + } +} + +void RoundedIntRect::Radii::excludeLogicalEdges(bool isHorizontal, bool excludeLogicalLeftEdge, bool excludeLogicalRightEdge) +{ + if (excludeLogicalLeftEdge) { + if (isHorizontal) + m_bottomLeft = IntSize(); + else + m_topRight = IntSize(); + m_topLeft = IntSize(); + } + + if (excludeLogicalRightEdge) { + if (isHorizontal) + m_topRight = IntSize(); + else + m_bottomLeft = IntSize(); + m_bottomRight = IntSize(); + } +} + +RoundedIntRect::RoundedIntRect(int x, int y, int width, int height) + : m_rect(x, y, width, height) +{ +} + +RoundedIntRect::RoundedIntRect(const IntRect& rect, const Radii& radii) + : m_rect(rect) + , m_radii(radii) +{ +} + +RoundedIntRect::RoundedIntRect(const IntRect& rect, const IntSize& topLeft, const IntSize& topRight, const IntSize& bottomLeft, const IntSize& bottomRight) + : m_rect(rect) + , m_radii(topLeft, topRight, bottomLeft, bottomRight) +{ +} + +void RoundedIntRect::includeLogicalEdges(const Radii& edges, bool isHorizontal, bool includeLogicalLeftEdge, bool includeLogicalRightEdge) +{ + m_radii.includeLogicalEdges(edges, isHorizontal, includeLogicalLeftEdge, includeLogicalRightEdge); +} + +void RoundedIntRect::excludeLogicalEdges(bool isHorizontal, bool excludeLogicalLeftEdge, bool excludeLogicalRightEdge) +{ + m_radii.excludeLogicalEdges(isHorizontal, excludeLogicalLeftEdge, excludeLogicalRightEdge); +} + +} // namespace WebCore diff --git a/Source/WebCore/platform/graphics/RoundedIntRect.h b/Source/WebCore/platform/graphics/RoundedIntRect.h new file mode 100644 index 0000000..c3c972f --- /dev/null +++ b/Source/WebCore/platform/graphics/RoundedIntRect.h @@ -0,0 +1,103 @@ +/* + * Copyright (C) 2003, 2006, 2009 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 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. + */ + +#ifndef RoundedIntRect_h +#define RoundedIntRect_h + +#include "IntRect.h" + +namespace WebCore { + + +class RoundedIntRect { +public: + class Radii { + public: + Radii() {} + Radii(const IntSize& topLeft, const IntSize& topRight, const IntSize& bottomLeft, const IntSize& bottomRight) + : m_topLeft(topLeft) + , m_topRight(topRight) + , m_bottomLeft(bottomLeft) + , m_bottomRight(bottomRight) + { + } + + void setTopLeft(const IntSize& size) { m_topLeft = size; } + void setTopRight(const IntSize& size) { m_topRight = size; } + void setBottomLeft(const IntSize& size) { m_bottomLeft = size; } + void setBottomRight(const IntSize& size) { m_bottomRight = size; } + const IntSize& topLeft() const { return m_topLeft; } + const IntSize& topRight() const { return m_topRight; } + const IntSize& bottomLeft() const { return m_bottomLeft; } + const IntSize& bottomRight() const { return m_bottomRight; } + + bool isZero() const; + + void includeLogicalEdges(const Radii& edges, bool isHorizontal, bool includeLogicalLeftEdge, bool includeLogicalRightEdge); + void excludeLogicalEdges(bool isHorizontal, bool excludeLogicalLeftEdge, bool excludeLogicalRightEdge); + + void scale(float factor); + void expand(int topWidth, int bottomWidth, int leftWidth, int rightWidth); + void expand(int size) { expand(size, size, size, size); } + void shrink(int topWidth, int bottomWidth, int leftWidth, int rightWidth) { expand(-topWidth, -bottomWidth, -leftWidth, -rightWidth); } + void shrink(int size) { shrink(size, size, size, size); } + + private: + IntSize m_topLeft; + IntSize m_topRight; + IntSize m_bottomLeft; + IntSize m_bottomRight; + }; + + explicit RoundedIntRect(const IntRect&, const Radii& = Radii()); + RoundedIntRect(int x, int y, int width, int height); + RoundedIntRect(const IntRect&, const IntSize& topLeft, const IntSize& topRight, const IntSize& bottomLeft, const IntSize& bottomRight); + + const IntRect& rect() const { return m_rect; } + const Radii& radii() const { return m_radii; } + bool isRounded() const { return !m_radii.isZero(); } + bool isEmpty() const { return m_rect.isEmpty(); } + + void setRect(const IntRect& rect) { m_rect = rect; } + void setRadii(const Radii& radii) { m_radii = radii; } + + void move(const IntSize& size) { m_rect.move(size); } + void inflate(int size) { m_rect.inflate(size); } + void inflateWithRadii(int size) { m_rect.inflate(size); m_radii.expand(size); } + void expandRadii(int size) { m_radii.expand(size); } + void shrinkRadii(int size) { m_radii.shrink(size); } + + void includeLogicalEdges(const Radii& edges, bool isHorizontal, bool includeLogicalLeftEdge, bool includeLogicalRightEdge); + void excludeLogicalEdges(bool isHorizontal, bool excludeLogicalLeftEdge, bool excludeLogicalRightEdge); + +private: + IntRect m_rect; + Radii m_radii; +}; + +} // namespace WebCore + +#endif // RoundedIntRect_h diff --git a/Source/WebCore/platform/graphics/StringTruncator.cpp b/Source/WebCore/platform/graphics/StringTruncator.cpp index b6c86ce..65325f0 100644 --- a/Source/WebCore/platform/graphics/StringTruncator.cpp +++ b/Source/WebCore/platform/graphics/StringTruncator.cpp @@ -32,6 +32,7 @@ #include "CharacterNames.h" #include "Font.h" #include "TextBreakIterator.h" +#include "TextRun.h" #include <wtf/Assertions.h> #include <wtf/Vector.h> diff --git a/Source/WebCore/platform/graphics/TiledBackingStore.h b/Source/WebCore/platform/graphics/TiledBackingStore.h index 58477db..06c7fe1 100644 --- a/Source/WebCore/platform/graphics/TiledBackingStore.h +++ b/Source/WebCore/platform/graphics/TiledBackingStore.h @@ -36,7 +36,8 @@ namespace WebCore { class GraphicsContext; class TiledBackingStoreClient; -class TiledBackingStore : public Noncopyable { +class TiledBackingStore { + WTF_MAKE_NONCOPYABLE(TiledBackingStore); WTF_MAKE_FAST_ALLOCATED; public: TiledBackingStore(TiledBackingStoreClient*); ~TiledBackingStore(); diff --git a/Source/WebCore/platform/graphics/WidthIterator.cpp b/Source/WebCore/platform/graphics/WidthIterator.cpp index 2a951e8..412c86e 100644 --- a/Source/WebCore/platform/graphics/WidthIterator.cpp +++ b/Source/WebCore/platform/graphics/WidthIterator.cpp @@ -25,6 +25,7 @@ #include "Font.h" #include "GlyphBuffer.h" #include "SimpleFontData.h" +#include "TextRun.h" #include <wtf/MathExtras.h> #if USE(ICU_UNICODE) diff --git a/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp b/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp index b72d761..01e25e9 100644 --- a/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp +++ b/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp @@ -1105,6 +1105,10 @@ void GraphicsLayerCA::ensureStructuralLayer(StructuralLayerPurpose purpose) if (m_structuralLayer) { // Replace the transformLayer in the parent with this layer. m_layer->removeFromSuperlayer(); + + // If m_layer doesn't have a parent, it means it's the root layer and + // is likely hosted by something that is not expecting to be changed + ASSERT(m_structuralLayer->superlayer()); m_structuralLayer->superlayer()->replaceSublayer(m_structuralLayer.get(), m_layer.get()); moveOrCopyAnimationsForProperty(Move, AnimatedPropertyWebkitTransform, m_structuralLayer.get(), m_layer.get()); @@ -1178,6 +1182,9 @@ void GraphicsLayerCA::ensureStructuralLayer(StructuralLayerPurpose purpose) } // Move this layer to be a child of the transform layer. + // If m_layer doesn't have a parent, it means it's the root layer and + // is likely hosted by something that is not expecting to be changed + ASSERT(m_layer->superlayer()); m_layer->superlayer()->replaceSublayer(m_layer.get(), m_structuralLayer.get()); m_structuralLayer->appendSublayer(m_layer.get()); @@ -2013,6 +2020,9 @@ void GraphicsLayerCA::swapFromOrToTiledLayer(bool useTiledLayer) m_layer->adoptSublayers(oldLayer.get()); + // If m_layer doesn't have a parent, it means it's the root layer and + // is likely hosted by something that is not expecting to be changed + ASSERT(oldLayer->superlayer()); oldLayer->superlayer()->replaceSublayer(oldLayer.get(), m_layer.get()); updateContentsTransform(); diff --git a/Source/WebCore/platform/graphics/win/WKCACFLayerRenderer.cpp b/Source/WebCore/platform/graphics/ca/win/CACFLayerTreeHost.cpp index 7c83f86..1d27608 100644 --- a/Source/WebCore/platform/graphics/win/WKCACFLayerRenderer.cpp +++ b/Source/WebCore/platform/graphics/ca/win/CACFLayerTreeHost.cpp @@ -24,17 +24,12 @@ */ #include "config.h" +#include "CACFLayerTreeHost.h" #if USE(ACCELERATED_COMPOSITING) -#ifndef NDEBUG -#define D3D_DEBUG_INFO -#endif - -#include "WKCACFLayerRenderer.h" - +#include "LayerChangesFlusher.h" #include "PlatformCALayer.h" -#include "WKCACFContextFlusher.h" #include "WebCoreInstanceHandle.h" #include <WebKitSystemInterface/WebKitSystemInterface.h> #include <limits.h> @@ -44,6 +39,11 @@ #include <wtf/OwnPtr.h> #include <wtf/PassOwnPtr.h> #include <wtf/StdLibExtras.h> + +#ifndef NDEBUG +#define D3D_DEBUG_INFO +#endif + #include <d3d9.h> #include <d3dx9.h> @@ -117,7 +117,7 @@ static bool hardwareCapabilitiesIndicateCoreAnimationSupport(const D3DCAPS9& cap return true; } -bool WKCACFLayerRenderer::acceleratedCompositingAvailable() +bool CACFLayerTreeHost::acceleratedCompositingAvailable() { static bool available; static bool tested; @@ -165,30 +165,31 @@ bool WKCACFLayerRenderer::acceleratedCompositingAvailable() return available; } - OwnPtr<WKCACFLayerRenderer> testLayerRenderer = WKCACFLayerRenderer::create(0); - testLayerRenderer->setHostWindow(testWindow); - available = testLayerRenderer->createRenderer(); + RefPtr<CACFLayerTreeHost> host = CACFLayerTreeHost::create(); + host->setWindow(testWindow); + available = host->createRenderer(); ::DestroyWindow(testWindow); return available; } -PassOwnPtr<WKCACFLayerRenderer> WKCACFLayerRenderer::create(WKCACFLayerRendererClient* client) +PassRefPtr<CACFLayerTreeHost> CACFLayerTreeHost::create() { if (!acceleratedCompositingAvailable()) return 0; - return new WKCACFLayerRenderer(client); + return adoptRef(new CACFLayerTreeHost()); } -WKCACFLayerRenderer::WKCACFLayerRenderer(WKCACFLayerRendererClient* client) - : m_client(client) +CACFLayerTreeHost::CACFLayerTreeHost() + : m_client(0) , m_mightBeAbleToCreateDeviceLater(true) , m_rootLayer(PlatformCALayer::create(PlatformCALayer::LayerTypeRootLayer, 0)) , m_context(wkCACFContextCreate()) - , m_hostWindow(0) - , m_renderTimer(this, &WKCACFLayerRenderer::renderTimerFired) + , m_window(0) + , m_renderTimer(this, &CACFLayerTreeHost::renderTimerFired) , m_mustResetLostDeviceBeforeRendering(false) - , m_syncLayerChanges(false) + , m_shouldFlushPendingGraphicsLayerChanges(false) + , m_isFlushingLayerChanges(false) { // Point the CACFContext to this wkCACFContextSetUserData(m_context, this); @@ -202,7 +203,7 @@ WKCACFLayerRenderer::WKCACFLayerRenderer(WKCACFLayerRendererClient* client) // cause any repositioning. // Scrolling will affect only the position of the scroll layer without affecting the bounds. - m_rootLayer->setName("WKCACFLayerRenderer rootLayer"); + m_rootLayer->setName("CACFLayerTreeHost rootLayer"); m_rootLayer->setAnchorPoint(FloatPoint3D(0, 0, 0)); m_rootLayer->setGeometryFlipped(true); @@ -221,38 +222,37 @@ WKCACFLayerRenderer::WKCACFLayerRenderer(WKCACFLayerRendererClient* client) #endif } -WKCACFLayerRenderer::~WKCACFLayerRenderer() +CACFLayerTreeHost::~CACFLayerTreeHost() { - setHostWindow(0); - WKCACFContextFlusher::shared().removeContext(m_context); + setWindow(0); wkCACFContextDestroy(m_context); } -void WKCACFLayerRenderer::setHostWindow(HWND window) +void CACFLayerTreeHost::setWindow(HWND window) { - if (window == m_hostWindow) + if (window == m_window) return; - if (m_hostWindow) + if (m_window) destroyRenderer(); - m_hostWindow = window; + m_window = window; - if (m_hostWindow) + if (m_window) createRenderer(); } -PlatformCALayer* WKCACFLayerRenderer::rootLayer() const +PlatformCALayer* CACFLayerTreeHost::rootLayer() const { return m_rootLayer.get(); } -void WKCACFLayerRenderer::addPendingAnimatedLayer(PassRefPtr<PlatformCALayer> layer) +void CACFLayerTreeHost::addPendingAnimatedLayer(PassRefPtr<PlatformCALayer> layer) { m_pendingAnimatedLayers.add(layer); } -void WKCACFLayerRenderer::setRootChildLayer(PlatformCALayer* layer) +void CACFLayerTreeHost::setRootChildLayer(PlatformCALayer* layer) { m_rootLayer->removeAllSublayers(); m_rootChildLayer = layer; @@ -260,13 +260,22 @@ void WKCACFLayerRenderer::setRootChildLayer(PlatformCALayer* layer) m_rootLayer->appendSublayer(m_rootChildLayer.get()); } -void WKCACFLayerRenderer::layerTreeDidChange() +void CACFLayerTreeHost::layerTreeDidChange() { - WKCACFContextFlusher::shared().addContext(m_context); - renderSoon(); + if (m_isFlushingLayerChanges) { + // The layer tree is changing as a result of flushing GraphicsLayer changes to their + // underlying PlatformCALayers. We'll flush those changes to the context as part of that + // process, so there's no need to schedule another flush here. + return; + } + + // The layer tree is changing as a result of someone modifying a PlatformCALayer that doesn't + // have a corresponding GraphicsLayer. Schedule a flush since we won't schedule one through the + // normal GraphicsLayer mechanisms. + LayerChangesFlusher::shared().flushPendingLayerChangesSoon(this); } -bool WKCACFLayerRenderer::createRenderer() +bool CACFLayerTreeHost::createRenderer() { if (m_d3dDevice || !m_mightBeAbleToCreateDeviceLater) return m_d3dDevice; @@ -274,14 +283,14 @@ bool WKCACFLayerRenderer::createRenderer() m_mightBeAbleToCreateDeviceLater = false; D3DPRESENT_PARAMETERS parameters = initialPresentationParameters(); - if (!d3d() || !::IsWindow(m_hostWindow)) + if (!d3d() || !::IsWindow(m_window)) return false; // D3D doesn't like to make back buffers for 0 size windows. We skirt this problem if we make the // passed backbuffer width and height non-zero. The window will necessarily get set to a non-zero // size eventually, and then the backbuffer size will get reset. RECT rect; - GetClientRect(m_hostWindow, &rect); + GetClientRect(m_window, &rect); if (rect.left-rect.right == 0 || rect.bottom-rect.top == 0) { parameters.BackBufferWidth = 1; @@ -299,7 +308,7 @@ bool WKCACFLayerRenderer::createRenderer() behaviorFlags |= D3DCREATE_SOFTWARE_VERTEXPROCESSING; COMPtr<IDirect3DDevice9> device; - if (FAILED(d3d()->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, m_hostWindow, behaviorFlags, ¶meters, &device))) { + if (FAILED(d3d()->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, m_window, behaviorFlags, ¶meters, &device))) { // In certain situations (e.g., shortly after waking from sleep), Direct3DCreate9() will // return an IDirect3D9 for which IDirect3D9::CreateDevice will always fail. In case we // have one of these bad IDirect3D9s, get rid of it so we'll fetch a new one the next time @@ -332,15 +341,17 @@ bool WKCACFLayerRenderer::createRenderer() wkCACFContextSetD3DDevice(m_context, m_d3dDevice.get()); - if (IsWindow(m_hostWindow)) + if (IsWindow(m_window)) m_rootLayer->setBounds(bounds()); return true; } -void WKCACFLayerRenderer::destroyRenderer() +void CACFLayerTreeHost::destroyRenderer() { - wkCACFContextSetLayer(m_context, m_rootLayer->platformLayer()); + LayerChangesFlusher::shared().cancelPendingFlush(this); + + wkCACFContextSetLayer(m_context, 0); wkCACFContextSetD3DDevice(m_context, 0); m_d3dDevice = 0; @@ -354,7 +365,7 @@ void WKCACFLayerRenderer::destroyRenderer() m_mightBeAbleToCreateDeviceLater = true; } -void WKCACFLayerRenderer::resize() +void CACFLayerTreeHost::resize() { if (!m_d3dDevice) return; @@ -365,7 +376,7 @@ void WKCACFLayerRenderer::resize() if (m_rootLayer) { m_rootLayer->setBounds(bounds()); - WKCACFContextFlusher::shared().flushAllContexts(); + wkCACFContextFlush(m_context); } } @@ -399,12 +410,12 @@ static void getDirtyRects(HWND window, Vector<CGRect>& outRects) outRects[i] = winRectToCGRect(*rect, clientRect); } -void WKCACFLayerRenderer::renderTimerFired(Timer<WKCACFLayerRenderer>*) +void CACFLayerTreeHost::renderTimerFired(Timer<CACFLayerTreeHost>*) { paint(); } -void WKCACFLayerRenderer::paint() +void CACFLayerTreeHost::paint() { createRenderer(); if (!m_d3dDevice) { @@ -414,11 +425,11 @@ void WKCACFLayerRenderer::paint() } Vector<CGRect> dirtyRects; - getDirtyRects(m_hostWindow, dirtyRects); + getDirtyRects(m_window, dirtyRects); render(dirtyRects); } -void WKCACFLayerRenderer::render(const Vector<CGRect>& windowDirtyRects) +void CACFLayerTreeHost::render(const Vector<CGRect>& windowDirtyRects) { ASSERT(m_d3dDevice); @@ -428,20 +439,6 @@ void WKCACFLayerRenderer::render(const Vector<CGRect>& windowDirtyRects) return; } - if (m_client && !m_client->shouldRender()) { - renderSoon(); - return; - } - - // Sync the layer if needed - if (m_syncLayerChanges) { - m_client->syncCompositingState(); - m_syncLayerChanges = false; - } - - // Flush the root layer to the render tree. - wkCACFContextFlush(m_context); - // All pending animations will have been started with the flush. Fire the animationStarted calls double currentTime = WTF::currentTime(); double currentMediaTime = CACurrentMediaTime(); @@ -521,27 +518,49 @@ void WKCACFLayerRenderer::render(const Vector<CGRect>& windowDirtyRects) renderSoon(); } -void WKCACFLayerRenderer::renderSoon() +void CACFLayerTreeHost::renderSoon() { if (!m_renderTimer.isActive()) m_renderTimer.startOneShot(0); } -void WKCACFLayerRenderer::syncCompositingStateSoon() +void CACFLayerTreeHost::flushPendingGraphicsLayerChangesSoon() +{ + m_shouldFlushPendingGraphicsLayerChanges = true; + LayerChangesFlusher::shared().flushPendingLayerChangesSoon(this); +} + +void CACFLayerTreeHost::flushPendingLayerChangesNow() { - m_syncLayerChanges = true; + // Calling out to the client could cause our last reference to go away. + RefPtr<CACFLayerTreeHost> protector(this); + + m_isFlushingLayerChanges = true; + + // Flush changes stored up in GraphicsLayers to their underlying PlatformCALayers, if + // requested. + if (m_client && m_shouldFlushPendingGraphicsLayerChanges) { + m_shouldFlushPendingGraphicsLayerChanges = false; + m_client->flushPendingGraphicsLayerChanges(); + } + + // Flush changes stored up in PlatformCALayers to the context so they will be rendered. + wkCACFContextFlush(m_context); + renderSoon(); + + m_isFlushingLayerChanges = false; } -CGRect WKCACFLayerRenderer::bounds() const +CGRect CACFLayerTreeHost::bounds() const { RECT clientRect; - GetClientRect(m_hostWindow, &clientRect); + GetClientRect(m_window, &clientRect); return winRectToCGRect(clientRect); } -void WKCACFLayerRenderer::initD3DGeometry() +void CACFLayerTreeHost::initD3DGeometry() { ASSERT(m_d3dDevice); @@ -558,7 +577,7 @@ void WKCACFLayerRenderer::initD3DGeometry() m_d3dDevice->SetTransform(D3DTS_PROJECTION, &projection); } -bool WKCACFLayerRenderer::resetDevice(ResetReason reason) +bool CACFLayerTreeHost::resetDevice(ResetReason reason) { ASSERT(m_d3dDevice); ASSERT(m_context); diff --git a/Source/WebCore/platform/graphics/win/WKCACFLayerRenderer.h b/Source/WebCore/platform/graphics/ca/win/CACFLayerTreeHost.h index 02cdbdb..fc61f39 100644 --- a/Source/WebCore/platform/graphics/win/WKCACFLayerRenderer.h +++ b/Source/WebCore/platform/graphics/ca/win/CACFLayerTreeHost.h @@ -23,8 +23,8 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef WKCACFLayerRenderer_h -#define WKCACFLayerRenderer_h +#ifndef CACFLayerTreeHost_h +#define CACFLayerTreeHost_h #if USE(ACCELERATED_COMPOSITING) @@ -32,9 +32,8 @@ #include "Timer.h" #include <wtf/HashSet.h> -#include <wtf/Noncopyable.h> -#include <wtf/PassOwnPtr.h> #include <wtf/PassRefPtr.h> +#include <wtf/RefCounted.h> #include <wtf/RefPtr.h> #include <wtf/RetainPtr.h> #include <wtf/Vector.h> @@ -50,43 +49,45 @@ namespace WebCore { class PlatformCALayer; -class WKCACFLayerRendererClient { +class CACFLayerTreeHostClient { public: - virtual ~WKCACFLayerRendererClient() { } - virtual bool shouldRender() const = 0; - virtual void syncCompositingState() { } + virtual ~CACFLayerTreeHostClient() { } + virtual void flushPendingGraphicsLayerChanges() { } }; -// FIXME: Currently there is a WKCACFLayerRenderer for each WebView and each +// FIXME: Currently there is a CACFLayerTreeHost for each WebView and each // has its own CARenderOGLContext and Direct3DDevice9, which is inefficient. // (https://bugs.webkit.org/show_bug.cgi?id=31855) -class WKCACFLayerRenderer : public Noncopyable { +class CACFLayerTreeHost : public RefCounted<CACFLayerTreeHost> { friend PlatformCALayer; public: - static PassOwnPtr<WKCACFLayerRenderer> create(WKCACFLayerRendererClient*); - ~WKCACFLayerRenderer(); + static PassRefPtr<CACFLayerTreeHost> create(); + ~CACFLayerTreeHost(); static bool acceleratedCompositingAvailable(); + void setClient(CACFLayerTreeHostClient* client) { m_client = client; } + void setRootChildLayer(PlatformCALayer*); void layerTreeDidChange(); - void setHostWindow(HWND); + void setWindow(HWND); void paint(); void resize(); - void syncCompositingStateSoon(); + void flushPendingGraphicsLayerChangesSoon(); + void flushPendingLayerChangesNow(); protected: PlatformCALayer* rootLayer() const; void addPendingAnimatedLayer(PassRefPtr<PlatformCALayer>); private: - WKCACFLayerRenderer(WKCACFLayerRendererClient*); + CACFLayerTreeHost(); bool createRenderer(); void destroyRenderer(); void renderSoon(); - void renderTimerFired(Timer<WKCACFLayerRenderer>*); + void renderTimerFired(Timer<CACFLayerTreeHost>*); CGRect bounds() const; @@ -100,16 +101,17 @@ private: void render(const Vector<CGRect>& dirtyRects = Vector<CGRect>()); - WKCACFLayerRendererClient* m_client; + CACFLayerTreeHostClient* m_client; bool m_mightBeAbleToCreateDeviceLater; COMPtr<IDirect3DDevice9> m_d3dDevice; RefPtr<PlatformCALayer> m_rootLayer; RefPtr<PlatformCALayer> m_rootChildLayer; WKCACFContext* m_context; - HWND m_hostWindow; - Timer<WKCACFLayerRenderer> m_renderTimer; + HWND m_window; + Timer<CACFLayerTreeHost> m_renderTimer; bool m_mustResetLostDeviceBeforeRendering; - bool m_syncLayerChanges; + bool m_shouldFlushPendingGraphicsLayerChanges; + bool m_isFlushingLayerChanges; HashSet<RefPtr<PlatformCALayer> > m_pendingAnimatedLayers; #ifndef NDEBUG @@ -121,4 +123,4 @@ private: #endif // USE(ACCELERATED_COMPOSITING) -#endif // WKCACFLayerRenderer_h +#endif // CACFLayerTreeHost_h diff --git a/Source/WebCore/platform/graphics/ca/win/LayerChangesFlusher.cpp b/Source/WebCore/platform/graphics/ca/win/LayerChangesFlusher.cpp new file mode 100644 index 0000000..3fd857b --- /dev/null +++ b/Source/WebCore/platform/graphics/ca/win/LayerChangesFlusher.cpp @@ -0,0 +1,132 @@ +/* + * Copyright (C) 2011 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "LayerChangesFlusher.h" + +#if USE(ACCELERATED_COMPOSITING) + +#include "CACFLayerTreeHost.h" +#include "WebCoreInstanceHandle.h" +#include <wtf/StdLibExtras.h> +#include <wtf/Vector.h> + +namespace WebCore { + +LayerChangesFlusher& LayerChangesFlusher::shared() +{ + DEFINE_STATIC_LOCAL(LayerChangesFlusher, flusher, ()); + return flusher; +} + +LayerChangesFlusher::LayerChangesFlusher() + : m_hook(0) + , m_isCallingHosts(false) +{ +} + +void LayerChangesFlusher::flushPendingLayerChangesSoon(CACFLayerTreeHost* host) +{ + if (!m_hostsWithChangesToFlush.add(host).second || m_hook) + return; + + setHook(); +} + +void LayerChangesFlusher::cancelPendingFlush(CACFLayerTreeHost* host) +{ + m_hostsWithChangesToFlush.remove(host); + + if (!m_hostsWithChangesToFlush.isEmpty() || !m_hook) + return; + + // We handle removing the hook when we finish calling out to the hosts, so we shouldn't + // mess with it while we're in the process of calling them. + if (m_isCallingHosts) + return; + + removeHook(); +} + +LRESULT LayerChangesFlusher::hookCallback(int code, WPARAM wParam, LPARAM lParam) +{ + return shared().hookFired(code, wParam, lParam); +} + +LRESULT LayerChangesFlusher::hookFired(int code, WPARAM wParam, LPARAM lParam) +{ + ASSERT(m_hook); + + // Calling out to the hosts can cause m_hostsWithChangesToFlush to be modified, so we copy it + // into a Vector first. We have to hold a reference to them because otherwise they could be + // destroyed while we're calling out to them. + Vector<RefPtr<CACFLayerTreeHost> > hosts; + copyToVector(m_hostsWithChangesToFlush, hosts); + m_hostsWithChangesToFlush.clear(); + + m_isCallingHosts = true; + for (size_t i = 0; i < hosts.size(); ++i) + hosts[i]->flushPendingLayerChangesNow(); + m_isCallingHosts = false; + + LRESULT result = ::CallNextHookEx(m_hook, code, wParam, lParam); + + if (m_hostsWithChangesToFlush.isEmpty()) { + // We won't have any work to do next time around, so just remove our hook. + removeHook(); + } + + return result; +} + +void LayerChangesFlusher::setHook() +{ + ASSERT(!m_hook); + ASSERT(!m_isCallingHosts); + + DWORD threadID = ::GetCurrentThreadId(); + + m_hook = ::SetWindowsHookExW(WH_GETMESSAGE, hookCallback, instanceHandle(), threadID); + ASSERT_WITH_MESSAGE(m_hook, "::SetWindowsHookExW failed with error %lu", ::GetLastError()); + + // Post a message to the message queue to prevent ::GetMessage from blocking, which will ensure + // our hook is called soon. + ::PostThreadMessageW(threadID, WM_NULL, 0, 0); +} + +void LayerChangesFlusher::removeHook() +{ + ASSERT(m_hook); + ASSERT(!m_isCallingHosts); + + if (!::UnhookWindowsHookEx(m_hook)) + ASSERT_WITH_MESSAGE(false, "::UnhookWindowsHookEx failed with error %lu", ::GetLastError()); + + m_hook = 0; +} + +} // namespace WebCore + +#endif // USE(ACCELERATED_COMPOSITING) diff --git a/Source/WebCore/platform/graphics/win/WKCACFContextFlusher.h b/Source/WebCore/platform/graphics/ca/win/LayerChangesFlusher.h index 17ec41d..6a98a99 100644 --- a/Source/WebCore/platform/graphics/win/WKCACFContextFlusher.h +++ b/Source/WebCore/platform/graphics/ca/win/LayerChangesFlusher.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009 Apple Inc. All rights reserved. + * Copyright (C) 2011 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -20,41 +20,46 @@ * 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. */ -#ifndef WKCACFContextFlusher_h -#define WKCACFContextFlusher_h +#ifndef LayerChangesFlusher_h +#define LayerChangesFlusher_h #if USE(ACCELERATED_COMPOSITING) -#include <wtf/Noncopyable.h> - +#include <windows.h> #include <wtf/HashSet.h> - -struct WKCACFContext; +#include <wtf/Noncopyable.h> namespace WebCore { -class WKCACFContextFlusher : public Noncopyable { -public: - static WKCACFContextFlusher& shared(); +class CACFLayerTreeHost; - void addContext(WKCACFContext*); - void removeContext(WKCACFContext*); +class LayerChangesFlusher { + WTF_MAKE_NONCOPYABLE(LayerChangesFlusher); +public: + static LayerChangesFlusher& shared(); - void flushAllContexts(); + void flushPendingLayerChangesSoon(CACFLayerTreeHost*); + void cancelPendingFlush(CACFLayerTreeHost*); private: - WKCACFContextFlusher(); - ~WKCACFContextFlusher(); + LayerChangesFlusher(); + ~LayerChangesFlusher(); + + static LRESULT CALLBACK hookCallback(int code, WPARAM, LPARAM); + LRESULT hookFired(int code, WPARAM, LPARAM); + void setHook(); + void removeHook(); - typedef HashSet<WKCACFContext*> ContextSet; - ContextSet m_contexts; + HashSet<CACFLayerTreeHost*> m_hostsWithChangesToFlush; + HHOOK m_hook; + bool m_isCallingHosts; }; -} +} // namespace WebCore #endif // USE(ACCELERATED_COMPOSITING) -#endif // WKCACFContextFlusher_h +#endif // LayerChangesFlusher_h diff --git a/Source/WebCore/platform/graphics/ca/win/PlatformCAAnimationWin.cpp b/Source/WebCore/platform/graphics/ca/win/PlatformCAAnimationWin.cpp index 7230cfc..228bb01 100644 --- a/Source/WebCore/platform/graphics/ca/win/PlatformCAAnimationWin.cpp +++ b/Source/WebCore/platform/graphics/ca/win/PlatformCAAnimationWin.cpp @@ -41,7 +41,7 @@ using namespace WebCore; -static String toCACFFillModeType(PlatformCAAnimation::FillModeType type) +static CFStringRef toCACFFillModeType(PlatformCAAnimation::FillModeType type) { switch (type) { case PlatformCAAnimation::NoFillMode: @@ -49,10 +49,11 @@ static String toCACFFillModeType(PlatformCAAnimation::FillModeType type) case PlatformCAAnimation::Backwards: return kCACFFillModeBackwards; case PlatformCAAnimation::Both: return kCACFFillModeBoth; } - return ""; + ASSERT_NOT_REACHED(); + return 0; } -static PlatformCAAnimation::FillModeType fromCACFFillModeType(const String& string) +static PlatformCAAnimation::FillModeType fromCACFFillModeType(CFStringRef string) { if (string == kCACFFillModeBackwards) return PlatformCAAnimation::Backwards; @@ -63,10 +64,10 @@ static PlatformCAAnimation::FillModeType fromCACFFillModeType(const String& stri return PlatformCAAnimation::Forwards; } -static String toCACFValueFunctionType(PlatformCAAnimation::ValueFunctionType type) +static CFStringRef toCACFValueFunctionType(PlatformCAAnimation::ValueFunctionType type) { switch (type) { - case PlatformCAAnimation::NoValueFunction: return ""; + case PlatformCAAnimation::NoValueFunction: return 0; case PlatformCAAnimation::RotateX: return kCACFValueFunctionRotateX; case PlatformCAAnimation::RotateY: return kCACFValueFunctionRotateY; case PlatformCAAnimation::RotateZ: return kCACFValueFunctionRotateZ; @@ -79,10 +80,11 @@ static String toCACFValueFunctionType(PlatformCAAnimation::ValueFunctionType typ case PlatformCAAnimation::TranslateZ: return kCACFValueFunctionTranslateZ; case PlatformCAAnimation::Translate: return kCACFValueFunctionTranslate; } - return ""; + ASSERT_NOT_REACHED(); + return 0; } -static PlatformCAAnimation::ValueFunctionType fromCACFValueFunctionType(const String string) +static PlatformCAAnimation::ValueFunctionType fromCACFValueFunctionType(CFStringRef string) { if (string == kCACFValueFunctionRotateX) return PlatformCAAnimation::RotateX; @@ -120,14 +122,14 @@ static PlatformCAAnimation::ValueFunctionType fromCACFValueFunctionType(const St return PlatformCAAnimation::NoValueFunction; } -static CACFTimingFunctionRef toCACFTimingFunction(const TimingFunction* timingFunction) +static RetainPtr<CACFTimingFunctionRef> toCACFTimingFunction(const TimingFunction* timingFunction) { if (!timingFunction) - return CACFTimingFunctionCreate(0.25f, 0.1f, 0.25f, 0.1f); + return RetainPtr<CACFTimingFunctionRef>(AdoptCF, CACFTimingFunctionCreate(0.25f, 0.1f, 0.25f, 0.1f)); if (timingFunction->isCubicBezierTimingFunction()) { const CubicBezierTimingFunction* ctf = static_cast<const CubicBezierTimingFunction*>(timingFunction); - return CACFTimingFunctionCreate(static_cast<float>(ctf->x1()), static_cast<float>(ctf->y1()), static_cast<float>(ctf->x2()), static_cast<float>(ctf->y2())); + return RetainPtr<CACFTimingFunctionRef>(AdoptCF, CACFTimingFunctionCreate(static_cast<float>(ctf->x1()), static_cast<float>(ctf->y1()), static_cast<float>(ctf->x2()), static_cast<float>(ctf->y2()))); } return CACFTimingFunctionGetFunctionWithName(kCACFTimingFunctionLinear); @@ -162,12 +164,12 @@ PlatformCAAnimation::PlatformCAAnimation(AnimationType type, const String& keyPa PlatformCAAnimation::PlatformCAAnimation(PlatformAnimationRef animation) { - if (String(CACFAnimationGetClass(animation)) == kCACFBasicAnimation) + if (CACFAnimationGetClass(animation) == kCACFBasicAnimation) m_type = Basic; - else if (String(CACFAnimationGetClass(animation)) == kCACFKeyframeAnimation) + else if (CACFAnimationGetClass(animation) == kCACFKeyframeAnimation) m_type = Keyframe; else { - ASSERT(0); + ASSERT_NOT_REACHED(); return; } @@ -289,13 +291,12 @@ PlatformCAAnimation::FillModeType PlatformCAAnimation::fillMode() const void PlatformCAAnimation::setFillMode(FillModeType value) { - RetainPtr<CFStringRef> keyPath(AdoptCF, toCACFFillModeType(value).createCFString()); - CACFAnimationSetFillMode(m_animation.get(), keyPath.get()); + CACFAnimationSetFillMode(m_animation.get(), toCACFFillModeType(value)); } void PlatformCAAnimation::setTimingFunction(const TimingFunction* value) { - CACFAnimationSetTimingFunction(m_animation.get(), toCACFTimingFunction(value)); + CACFAnimationSetTimingFunction(m_animation.get(), toCACFTimingFunction(value).get()); } void PlatformCAAnimation::copyTimingFunctionFrom(const PlatformCAAnimation* value) @@ -330,8 +331,7 @@ PlatformCAAnimation::ValueFunctionType PlatformCAAnimation::valueFunction() cons void PlatformCAAnimation::setValueFunction(ValueFunctionType value) { - RetainPtr<CFStringRef> keyPath(AdoptCF, toCACFValueFunctionType(value).createCFString()); - CACFAnimationSetValueFunction(m_animation.get(), CACFValueFunctionGetFunctionWithName(keyPath.get())); + CACFAnimationSetValueFunction(m_animation.get(), CACFValueFunctionGetFunctionWithName(toCACFValueFunctionType(value))); } void PlatformCAAnimation::setFromValue(float value) @@ -524,7 +524,7 @@ void PlatformCAAnimation::setTimingFunctions(const Vector<const TimingFunction*> RetainPtr<CFMutableArrayRef> array(AdoptCF, CFArrayCreateMutable(0, value.size(), &kCFTypeArrayCallBacks)); for (size_t i = 0; i < value.size(); ++i) { RetainPtr<CFNumberRef> v(AdoptCF, CFNumberCreate(0, kCFNumberFloatType, &value[i])); - CFArrayAppendValue(array.get(), toCACFTimingFunction(value[i])); + CFArrayAppendValue(array.get(), toCACFTimingFunction(value[i]).get()); } CACFAnimationSetTimingFunctions(m_animation.get(), array.get()); diff --git a/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.cpp b/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.cpp index 66d0732..b5a26f4 100644 --- a/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.cpp +++ b/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.cpp @@ -29,10 +29,10 @@ #include "PlatformCALayer.h" +#include "CACFLayerTreeHost.h" #include "Font.h" #include "GraphicsContext.h" #include "PlatformCALayerWinInternal.h" -#include "WKCACFLayerRenderer.h" #include <QuartzCore/CoreAnimationCF.h> #include <WebKitSystemInterface/WebKitSystemInterface.h> #include <wtf/CurrentTime.h> @@ -65,14 +65,14 @@ static CFStringRef toCACFFilterType(PlatformCALayer::FilterType type) } } -static WKCACFLayerRenderer* rendererForLayer(const PlatformCALayer* layer) +static CACFLayerTreeHost* layerTreeHostForLayer(const PlatformCALayer* layer) { - // We need the WKCACFLayerRenderer associated with this layer, which is stored in the UserData of the CACFContext + // We need the CACFLayerTreeHost associated with this layer, which is stored in the UserData of the CACFContext void* userData = wkCACFLayerGetContextUserData(layer->platformLayer()); if (!userData) return 0; - return static_cast<WKCACFLayerRenderer*>(userData); + return static_cast<CACFLayerTreeHost*>(userData); } static PlatformCALayerWinInternal* intern(const PlatformCALayer* layer) @@ -156,8 +156,8 @@ PlatformLayer* PlatformCALayer::platformLayer() const PlatformCALayer* PlatformCALayer::rootLayer() const { - WKCACFLayerRenderer* renderer = rendererForLayer(this); - return renderer ? renderer->rootLayer() : 0; + CACFLayerTreeHost* host = layerTreeHostForLayer(this); + return host ? host->rootLayer() : 0; } void PlatformCALayer::setNeedsDisplay(const FloatRect* dirtyRect) @@ -167,9 +167,9 @@ void PlatformCALayer::setNeedsDisplay(const FloatRect* dirtyRect) void PlatformCALayer::setNeedsCommit() { - WKCACFLayerRenderer* renderer = rendererForLayer(this); - if (renderer) - renderer->layerTreeDidChange(); + CACFLayerTreeHost* host = layerTreeHostForLayer(this); + if (host) + host->layerTreeDidChange(); } void PlatformCALayer::setContentsChanged() @@ -269,10 +269,10 @@ void PlatformCALayer::addAnimationForKey(const String& key, PlatformCAAnimation* CACFLayerAddAnimation(m_layer.get(), s.get(), animation->platformAnimation()); setNeedsCommit(); - // Tell the renderer about it so we can fire the start animation event - WKCACFLayerRenderer* renderer = rendererForLayer(this); - if (renderer) - renderer->addPendingAnimatedLayer(this); + // Tell the host about it so we can fire the start animation event + CACFLayerTreeHost* host = layerTreeHostForLayer(this); + if (host) + host->addPendingAnimatedLayer(this); } void PlatformCALayer::removeAnimationForKey(const String& key) @@ -283,7 +283,7 @@ void PlatformCALayer::removeAnimationForKey(const String& key) RetainPtr<CFStringRef> s(AdoptCF, key.createCFString()); CACFLayerRemoveAnimation(m_layer.get(), s.get()); - // We don't "remove" a layer from WKCACFLayerRenderer when it loses an animation. + // We don't "remove" a layer from CACFLayerTreeHost when it loses an animation. // There may be other active animations on the layer and if an animation // callback is fired on a layer without any animations no harm is done. diff --git a/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWinInternal.cpp b/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWinInternal.cpp index cdf90db..1697122 100644 --- a/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWinInternal.cpp +++ b/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWinInternal.cpp @@ -31,6 +31,7 @@ #include "Font.h" #include "PlatformCALayer.h" +#include "TextRun.h" #include <QuartzCore/CACFLayer.h> using namespace std; diff --git a/Source/WebCore/platform/graphics/cairo/FontCustomPlatformData.h b/Source/WebCore/platform/graphics/cairo/FontCustomPlatformData.h index dac31f8..50ea00f 100644 --- a/Source/WebCore/platform/graphics/cairo/FontCustomPlatformData.h +++ b/Source/WebCore/platform/graphics/cairo/FontCustomPlatformData.h @@ -35,7 +35,8 @@ namespace WebCore { class FontPlatformData; class SharedBuffer; -struct FontCustomPlatformData : Noncopyable { +struct FontCustomPlatformData { + WTF_MAKE_NONCOPYABLE(FontCustomPlatformData); public: FontCustomPlatformData(FT_Face, SharedBuffer*); ~FontCustomPlatformData(); diff --git a/Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp b/Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp index ac5da3d..51b5ee6 100644 --- a/Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp +++ b/Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp @@ -91,6 +91,11 @@ ImageBuffer::~ImageBuffer() cairo_surface_destroy(m_data.m_surface); } +size_t ImageBuffer::dataSize() const +{ + return m_size.width() * m_size.height() * 4; +} + GraphicsContext* ImageBuffer::context() const { return m_context.get(); diff --git a/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp b/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp index eddf735..bcfc37b 100644 --- a/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp +++ b/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp @@ -625,8 +625,8 @@ void GraphicsContext::fillRect(const FloatRect& rect) if (m_state.fillGradient) { CGContextSaveGState(context); - CGContextConcatCTM(context, m_state.fillGradient->gradientSpaceTransform()); if (hasShadow()) { + CGContextConcatCTM(context, m_state.fillGradient->gradientSpaceTransform()); CGLayerRef layer = CGLayerCreateWithContext(context, CGSizeMake(rect.width(), rect.height()), 0); CGContextRef layerContext = CGLayerGetContext(layer); m_state.fillGradient->paint(layerContext); @@ -634,6 +634,7 @@ void GraphicsContext::fillRect(const FloatRect& rect) CGLayerRelease(layer); } else { CGContextClipToRect(context, rect); + CGContextConcatCTM(context, m_state.fillGradient->gradientSpaceTransform()); m_state.fillGradient->paint(this); } CGContextRestoreGState(context); diff --git a/Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp b/Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp index 023d098..295f632 100644 --- a/Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp +++ b/Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp @@ -173,6 +173,11 @@ ImageBuffer::~ImageBuffer() { } +size_t ImageBuffer::dataSize() const +{ + return m_size.height() * m_data.m_bytesPerRow; +} + GraphicsContext* ImageBuffer::context() const { return m_context.get(); diff --git a/Source/WebCore/platform/graphics/cg/PatternCG.cpp b/Source/WebCore/platform/graphics/cg/PatternCG.cpp index 94f37b2..cfac15c 100644 --- a/Source/WebCore/platform/graphics/cg/PatternCG.cpp +++ b/Source/WebCore/platform/graphics/cg/PatternCG.cpp @@ -54,8 +54,7 @@ CGPatternRef Pattern::createPlatformPattern(const AffineTransform& userSpaceTran { IntRect tileRect = tileImage()->rect(); - AffineTransform patternTransform = m_patternSpaceTransformation; - patternTransform.multiply(userSpaceTransformation); + AffineTransform patternTransform = userSpaceTransformation * m_patternSpaceTransformation; patternTransform.scaleNonUniform(1, -1); patternTransform.translate(0, -tileRect.height()); diff --git a/Source/WebCore/platform/graphics/chromium/ComplexTextControllerLinux.cpp b/Source/WebCore/platform/graphics/chromium/ComplexTextControllerLinux.cpp index 99159e6..92861fc 100644 --- a/Source/WebCore/platform/graphics/chromium/ComplexTextControllerLinux.cpp +++ b/Source/WebCore/platform/graphics/chromium/ComplexTextControllerLinux.cpp @@ -32,6 +32,7 @@ #include "ComplexTextControllerLinux.h" #include "Font.h" +#include "TextRun.h" #include <unicode/normlzr.h> @@ -47,8 +48,6 @@ static int truncateFixedPointToInteger(HB_Fixed value) ComplexTextController::ComplexTextController(const TextRun& run, unsigned startingX, const Font* font) : m_font(font) - , m_startingX(startingX) - , m_offsetX(m_startingX) , m_run(getNormalizedTextRun(run, m_normalizedRun, m_normalizedBuffer)) , m_wordSpacingAdjustment(0) , m_padding(0) @@ -75,7 +74,7 @@ ComplexTextController::ComplexTextController(const TextRun& run, unsigned starti m_item.string = m_run.characters(); m_item.stringLength = m_run.length(); - reset(); + reset(startingX); } ComplexTextController::~ComplexTextController() @@ -137,10 +136,10 @@ void ComplexTextController::setPadding(int padding) m_padPerWordBreak = 0; } -void ComplexTextController::reset() +void ComplexTextController::reset(unsigned offset) { m_indexOfNextScriptRun = 0; - m_offsetX = m_startingX; + m_offsetX = offset; } // Advance to the next script run, returning false when the end of the @@ -277,8 +276,7 @@ void ComplexTextController::setGlyphXPositions(bool isRTL) int logClustersIndex = 0; // Iterate through the glyphs in logical order, flipping for RTL where necessary. - // In RTL mode all variables are positive except m_xPositions, which starts from m_offsetX and runs negative. - // It is fixed up in a second pass below. + // Glyphs are positioned starting from m_offsetX; in RTL mode they go leftwards from there. for (size_t i = 0; i < m_item.num_glyphs; ++i) { while (static_cast<unsigned>(logClustersIndex) < m_item.item.length && logClusters()[logClustersIndex] < i) logClustersIndex++; @@ -303,16 +301,8 @@ void ComplexTextController::setGlyphXPositions(bool isRTL) position += advance; } - const double width = position; - - // Now that we've computed the total width, do another pass to fix positioning for RTL. - if (isRTL) { - for (size_t i = 0; i < m_item.num_glyphs; ++i) - m_xPositions[i] += width; - } - - m_pixelWidth = std::max(width, 0.0); - m_offsetX += m_pixelWidth; + m_pixelWidth = std::max(position, 0.0); + m_offsetX += m_pixelWidth * rtlFlip; } void ComplexTextController::normalizeSpacesAndMirrorChars(const UChar* source, bool rtl, UChar* destination, int length) diff --git a/Source/WebCore/platform/graphics/chromium/ComplexTextControllerLinux.h b/Source/WebCore/platform/graphics/chromium/ComplexTextControllerLinux.h index e264b99..a2aea60 100644 --- a/Source/WebCore/platform/graphics/chromium/ComplexTextControllerLinux.h +++ b/Source/WebCore/platform/graphics/chromium/ComplexTextControllerLinux.h @@ -68,7 +68,7 @@ public: // setPadding sets a number of pixels to be distributed across the TextRun. // WebKit uses this to justify text. void setPadding(int); - void reset(); + void reset(unsigned offset); // Advance to the next script run, returning false when the end of the // TextRun has been reached. bool nextScriptRun(); @@ -86,7 +86,6 @@ public: // Set the x offset for the next script run. This affects the values in // |xPositions| - void setXOffsetToZero() { m_offsetX = 0; } bool rtl() const { return m_run.rtl(); } const uint16_t* glyphs() const { return m_glyphs16; } @@ -114,6 +113,9 @@ public: // return the number of code points in the current script run const unsigned numCodePoints() const { return m_numCodePoints; } + // Return the current pixel position of the controller. + const unsigned offsetX() const { return m_offsetX; } + const FontPlatformData* fontPlatformDataForScriptRun() { return reinterpret_cast<FontPlatformData*>(m_item.font->userData); } private: @@ -137,7 +139,6 @@ private: uint16_t* m_glyphs16; // A vector of 16-bit glyph ids. SkScalar* m_xPositions; // A vector of x positions for each glyph. ssize_t m_indexOfNextScriptRun; // Indexes the script run in |m_run|. - const unsigned m_startingX; // Offset in pixels of the first script run. unsigned m_offsetX; // Offset in pixels to the start of the next script run. unsigned m_pixelWidth; // Width (in px) of the current script run. unsigned m_numCodePoints; // Code points in current script run. diff --git a/Source/WebCore/platform/graphics/chromium/CrossProcessFontLoading.mm b/Source/WebCore/platform/graphics/chromium/CrossProcessFontLoading.mm index 72e3369..227fbe4 100644 --- a/Source/WebCore/platform/graphics/chromium/CrossProcessFontLoading.mm +++ b/Source/WebCore/platform/graphics/chromium/CrossProcessFontLoading.mm @@ -30,7 +30,7 @@ #import "CrossProcessFontLoading.h" #import "../graphics/cocoa/FontPlatformData.h" -#import "ChromiumBridge.h" +#import "PlatformBridge.h" #import <AppKit/NSFont.h> #import <wtf/HashMap.h> @@ -87,7 +87,7 @@ PassRefPtr<MemoryActivatedFont> loadFontFromBrowserProcess(NSFont* nsFont) { ATSFontContainerRef container; // Send cross-process request to load font. - if (!ChromiumBridge::loadFont(nsFont, &container)) + if (!PlatformBridge::loadFont(nsFont, &container)) return 0; ATSFontContainerRef srcFontContainerRef = fontContainerRefFromNSFont(nsFont); diff --git a/Source/WebCore/platform/graphics/chromium/DrawingBufferChromium.cpp b/Source/WebCore/platform/graphics/chromium/DrawingBufferChromium.cpp index 569dff4..2d4ca41 100644 --- a/Source/WebCore/platform/graphics/chromium/DrawingBufferChromium.cpp +++ b/Source/WebCore/platform/graphics/chromium/DrawingBufferChromium.cpp @@ -72,15 +72,16 @@ DrawingBuffer::DrawingBuffer(GraphicsContext3D* context, bool multisampleExtensionSupported, bool packedDepthStencilExtensionSupported) : m_context(context) - , m_size(size) + , m_size(-1, -1) , m_multisampleExtensionSupported(multisampleExtensionSupported) , m_packedDepthStencilExtensionSupported(packedDepthStencilExtensionSupported) , m_fbo(0) , m_colorBuffer(0) , m_depthStencilBuffer(0) + , m_depthBuffer(0) + , m_stencilBuffer(0) , m_multisampleFBO(0) , m_multisampleColorBuffer(0) - , m_multisampleDepthStencilBuffer(0) , m_internal(new DrawingBufferInternal) { if (!m_context->getExtensions()->supports("GL_CHROMIUM_copy_texture_to_parent_texture")) { @@ -91,6 +92,7 @@ DrawingBuffer::DrawingBuffer(GraphicsContext3D* context, context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_fbo); m_colorBuffer = generateColorTexture(context, size); createSecondaryBuffers(); + reset(size); } DrawingBuffer::~DrawingBuffer() diff --git a/Source/WebCore/platform/graphics/chromium/FontCacheChromiumWin.cpp b/Source/WebCore/platform/graphics/chromium/FontCacheChromiumWin.cpp index 2c79815..f4c0dee 100644 --- a/Source/WebCore/platform/graphics/chromium/FontCacheChromiumWin.cpp +++ b/Source/WebCore/platform/graphics/chromium/FontCacheChromiumWin.cpp @@ -32,11 +32,11 @@ #include "config.h" #include "FontCache.h" -#include "ChromiumBridge.h" #include "Font.h" #include "FontUtilsChromiumWin.h" #include "HashMap.h" #include "HashSet.h" +#include "PlatformBridge.h" #include "SimpleFontData.h" #include <unicode/uniset.h> #include <wtf/text/StringHash.h> @@ -288,9 +288,9 @@ static bool fontContainsCharacter(const FontPlatformData* fontData, HDC hdc = GetDC(0); HGDIOBJ oldFont = static_cast<HFONT>(SelectObject(hdc, hfont)); int count = GetFontUnicodeRanges(hdc, 0); - if (count == 0 && ChromiumBridge::ensureFontLoaded(hfont)) + if (!count && PlatformBridge::ensureFontLoaded(hfont)) count = GetFontUnicodeRanges(hdc, 0); - if (count == 0) { + if (!count) { LOG_ERROR("Unable to get the font unicode range after second attempt"); SelectObject(hdc, oldFont); ReleaseDC(0, hdc); @@ -362,7 +362,7 @@ static void FillLogFont(const FontDescription& fontDescription, LOGFONT* winfont winfont->lfStrikeOut = false; winfont->lfCharSet = DEFAULT_CHARSET; winfont->lfOutPrecision = OUT_TT_ONLY_PRECIS; - winfont->lfQuality = ChromiumBridge::layoutTestMode() ? NONANTIALIASED_QUALITY : DEFAULT_QUALITY; // Honor user's desktop settings. + winfont->lfQuality = PlatformBridge::layoutTestMode() ? NONANTIALIASED_QUALITY : DEFAULT_QUALITY; // Honor user's desktop settings. winfont->lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE; winfont->lfItalic = fontDescription.italic(); winfont->lfWeight = toGDIFontWeight(fontDescription.weight()); diff --git a/Source/WebCore/platform/graphics/chromium/FontCacheLinux.cpp b/Source/WebCore/platform/graphics/chromium/FontCacheLinux.cpp index bd33927..a849a6c 100644 --- a/Source/WebCore/platform/graphics/chromium/FontCacheLinux.cpp +++ b/Source/WebCore/platform/graphics/chromium/FontCacheLinux.cpp @@ -31,12 +31,12 @@ #include "config.h" #include "FontCache.h" -#include "ChromiumBridge.h" #include "Font.h" #include "FontDescription.h" #include "FontPlatformData.h" #include "Logging.h" #include "NotImplemented.h" +#include "PlatformBridge.h" #include "SimpleFontData.h" #include "SkPaint.h" @@ -57,7 +57,7 @@ const SimpleFontData* FontCache::getFontDataForCharacters(const Font& font, const UChar* characters, int length) { - String family = ChromiumBridge::getFontFamilyForCharacters(characters, length); + String family = PlatformBridge::getFontFamilyForCharacters(characters, length); if (family.isEmpty()) return 0; diff --git a/Source/WebCore/platform/graphics/chromium/FontChromiumWin.cpp b/Source/WebCore/platform/graphics/chromium/FontChromiumWin.cpp index 1a00833..5da4d5a 100644 --- a/Source/WebCore/platform/graphics/chromium/FontChromiumWin.cpp +++ b/Source/WebCore/platform/graphics/chromium/FontChromiumWin.cpp @@ -32,10 +32,10 @@ #include "config.h" #include "Font.h" -#include "ChromiumBridge.h" #include "FontFallbackList.h" #include "GlyphBuffer.h" #include "NotImplemented.h" +#include "PlatformBridge.h" #include "PlatformContextSkia.h" #include "SimpleFontData.h" #include "SkiaFontWin.h" @@ -424,7 +424,7 @@ void Font::drawGlyphs(GraphicsContext* graphicsContext, success = painter.drawGlyphs(curLen, &glyphs[0], &advances[0], curAdvance); if (!success && executions == 0) { // Ask the browser to load the font for us and retry. - ChromiumBridge::ensureFontLoaded(font->platformData().hfont()); + PlatformBridge::ensureFontLoaded(font->platformData().hfont()); continue; } break; diff --git a/Source/WebCore/platform/graphics/chromium/FontLinux.cpp b/Source/WebCore/platform/graphics/chromium/FontLinux.cpp index f1eadf2..822bbbb 100644 --- a/Source/WebCore/platform/graphics/chromium/FontLinux.cpp +++ b/Source/WebCore/platform/graphics/chromium/FontLinux.cpp @@ -206,6 +206,16 @@ void Font::drawComplexText(GraphicsContext* gc, const TextRun& run, controller.setLetterSpacingAdjustment(letterSpacing()); controller.setPadding(run.padding()); + if (run.rtl()) { + // FIXME: this causes us to shape the text twice -- once to compute the width and then again + // below when actually rendering. Change ComplexTextController to match platform/mac and + // platform/chromium/win by having it store the shaped runs, so we can reuse the results. + controller.reset(point.x() + controller.widthOfFullRun()); + // We need to set the padding again because ComplexTextController layout consumed the value. + // Fixing the above problem would help here too. + controller.setPadding(run.padding()); + } + while (controller.nextScriptRun()) { if (fill) { controller.fontPlatformDataForScriptRun()->setupPaint(&fillPaint); @@ -231,6 +241,7 @@ float Font::floatWidthForComplexText(const TextRun& run, HashSet<const SimpleFon ComplexTextController controller(run, 0, this); controller.setWordSpacingAdjustment(wordSpacing()); controller.setLetterSpacingAdjustment(letterSpacing()); + controller.setPadding(run.padding()); return controller.widthOfFullRun(); } @@ -239,7 +250,7 @@ static int glyphIndexForXPositionInScriptRun(const ComplexTextController& contro // Iterate through the glyphs in logical order, seeing whether targetX falls between the previous // position and halfway through the current glyph. // FIXME: this code probably belongs in ComplexTextController. - int lastX = controller.rtl() ? controller.width() : 0; + int lastX = controller.offsetX() - (controller.rtl() ? -controller.width() : controller.width()); for (int glyphIndex = 0; static_cast<unsigned>(glyphIndex) < controller.length(); ++glyphIndex) { int advance = truncateFixedPointToInteger(controller.advances()[glyphIndex]); int nextX = static_cast<int>(controller.xPositions()[glyphIndex]) + advance / 2; @@ -257,53 +268,29 @@ int Font::offsetForPositionForComplexText(const TextRun& run, float xFloat, { // FIXME: This truncation is not a problem for HTML, but only affects SVG, which passes floating-point numbers // to Font::offsetForPosition(). Bug http://webkit.org/b/40673 tracks fixing this problem. - int x = static_cast<int>(xFloat); + int targetX = static_cast<int>(xFloat); // (Mac code ignores includePartialGlyphs, and they don't know what it's // supposed to do, so we just ignore it as well.) ComplexTextController controller(run, 0, this); controller.setWordSpacingAdjustment(wordSpacing()); controller.setLetterSpacingAdjustment(letterSpacing()); - - // If this is RTL text, the first glyph from the left is actually the last - // code point. So we need to know how many code points there are total in - // order to subtract. This is different from the length of the TextRun - // because UTF-16 surrogate pairs are a single code point, but 32-bits long. - // In LTR we leave this as 0 so that we get the correct value for - // |basePosition|, below. - unsigned totalCodePoints = 0; - if (controller.rtl()) { - ssize_t offset = 0; - while (offset < run.length()) { - utf16_to_code_point(run.characters(), run.length(), &offset); - totalCodePoints++; - } + controller.setPadding(run.padding()); + if (run.rtl()) { + // See FIXME in drawComplexText. + controller.reset(controller.widthOfFullRun()); + controller.setPadding(run.padding()); } - unsigned basePosition = totalCodePoints; - - // For RTL: - // code-point order: abcd efg hijkl - // on screen: lkjih gfe dcba - // ^ ^ - // | | - // basePosition--| | - // totalCodePoints----| - // Since basePosition is currently the total number of code-points, the - // first thing we do is decrement it so that it's pointing to the start of - // the current script-run. - // - // For LTR, basePosition is zero so it already points to the start of the - // first script run. + unsigned basePosition = 0; + + int x = controller.offsetX(); while (controller.nextScriptRun()) { - if (controller.rtl()) - basePosition -= controller.numCodePoints(); + int nextX = controller.offsetX(); - if (x >= 0 && static_cast<unsigned>(x) < controller.width()) { - // The x value in question is within this script run. We consider - // each glyph in presentation order and stop when we find the one - // covering this position. - const int glyphIndex = glyphIndexForXPositionInScriptRun(controller, x); + if (std::min(x, nextX) <= targetX && targetX <= std::max(x, nextX)) { + // The x value in question is within this script run. + const int glyphIndex = glyphIndexForXPositionInScriptRun(controller, targetX); // Now that we have a glyph index, we have to turn that into a // code-point index. Because of ligatures, several code-points may @@ -324,10 +311,7 @@ int Font::offsetForPositionForComplexText(const TextRun& run, float xFloat, return basePosition + controller.numCodePoints() - 1; } - x -= controller.width(); - - if (!controller.rtl()) - basePosition += controller.numCodePoints(); + basePosition += controller.numCodePoints(); } return basePosition; @@ -342,27 +326,21 @@ FloatRect Font::selectionRectForComplexText(const TextRun& run, ComplexTextController controller(run, 0, this); controller.setWordSpacingAdjustment(wordSpacing()); controller.setLetterSpacingAdjustment(letterSpacing()); + controller.setPadding(run.padding()); + if (run.rtl()) { + // See FIXME in drawComplexText. + controller.reset(controller.widthOfFullRun()); + controller.setPadding(run.padding()); + } - // Base will point to the x offset for the start of the current script run. Note that, in - // the LTR case, width will be 0. - int base = controller.rtl() ? controller.widthOfFullRun() : 0; - - controller.reset(); + // Iterate through the script runs in logical order, searching for the run covering the positions of interest. while (controller.nextScriptRun() && (fromX == -1 || toX == -1)) { - // ComplexTextController will helpfully accululate the x offsets for different - // script runs for us. For this code, however, we always want the x offsets - // to start from zero so we call this before each script run. - controller.setXOffsetToZero(); - - if (controller.rtl()) - base -= controller.width(); - if (fromX == -1 && from >= 0 && static_cast<unsigned>(from) < controller.numCodePoints()) { // |from| is within this script run. So we index the clusters log to // find which glyph this code-point contributed to and find its x // position. int glyph = controller.logClusters()[from]; - fromX = base + controller.xPositions()[glyph]; + fromX = controller.xPositions()[glyph]; if (controller.rtl()) fromX += truncateFixedPointToInteger(controller.advances()[glyph]); } else @@ -370,22 +348,18 @@ FloatRect Font::selectionRectForComplexText(const TextRun& run, if (toX == -1 && to >= 0 && static_cast<unsigned>(to) < controller.numCodePoints()) { int glyph = controller.logClusters()[to]; - toX = base + controller.xPositions()[glyph]; + toX = controller.xPositions()[glyph]; if (controller.rtl()) toX += truncateFixedPointToInteger(controller.advances()[glyph]); } else to -= controller.numCodePoints(); - - if (!controller.rtl()) - base += controller.width(); } // The position in question might be just after the text. - const int endEdge = base; - if (fromX == -1 && !from) - fromX = endEdge; - if (toX == -1 && !to) - toX = endEdge; + if (fromX == -1) + fromX = controller.offsetX(); + if (toX == -1) + toX = controller.offsetX(); ASSERT(fromX != -1 && toX != -1); diff --git a/Source/WebCore/platform/graphics/chromium/FontPlatformDataChromiumWin.cpp b/Source/WebCore/platform/graphics/chromium/FontPlatformDataChromiumWin.cpp index d6c83ec..1022a9f 100644 --- a/Source/WebCore/platform/graphics/chromium/FontPlatformDataChromiumWin.cpp +++ b/Source/WebCore/platform/graphics/chromium/FontPlatformDataChromiumWin.cpp @@ -36,7 +36,7 @@ #include <objidl.h> #include <mlang.h> -#include "ChromiumBridge.h" +#include "PlatformBridge.h" #include "SkiaFontWin.h" namespace WebCore { @@ -136,7 +136,7 @@ SCRIPT_FONTPROPERTIES* FontPlatformData::scriptFontProperties() const HRESULT hr = ScriptGetFontProperties(dc, scriptCache(), m_scriptFontProperties); if (S_OK != hr) { - if (ChromiumBridge::ensureFontLoaded(hfont())) { + if (PlatformBridge::ensureFontLoaded(hfont())) { // FIXME: Handle gracefully the error if this call also fails. hr = ScriptGetFontProperties(dc, scriptCache(), m_scriptFontProperties); diff --git a/Source/WebCore/platform/graphics/chromium/FontPlatformDataLinux.cpp b/Source/WebCore/platform/graphics/chromium/FontPlatformDataLinux.cpp index 42942cc..a1ea012 100644 --- a/Source/WebCore/platform/graphics/chromium/FontPlatformDataLinux.cpp +++ b/Source/WebCore/platform/graphics/chromium/FontPlatformDataLinux.cpp @@ -31,9 +31,9 @@ #include "config.h" #include "FontPlatformData.h" -#include "ChromiumBridge.h" #include "HarfbuzzSkia.h" #include "NotImplemented.h" +#include "PlatformBridge.h" #include "PlatformString.h" #include "SkPaint.h" @@ -229,7 +229,7 @@ void FontPlatformData::querySystemForRenderStyle() return; } - ChromiumBridge::getRenderStyleForStrike(m_family.data(), (((int)m_textSize) << 2) | (m_typeface->style() & 3), &m_style); + PlatformBridge::getRenderStyleForStrike(m_family.data(), (((int)m_textSize) << 2) | (m_typeface->style() & 3), &m_style); } } // namespace WebCore diff --git a/Source/WebCore/platform/graphics/chromium/GLES2Canvas.cpp b/Source/WebCore/platform/graphics/chromium/GLES2Canvas.cpp index 697cf5e..4393f97 100644 --- a/Source/WebCore/platform/graphics/chromium/GLES2Canvas.cpp +++ b/Source/WebCore/platform/graphics/chromium/GLES2Canvas.cpp @@ -34,12 +34,16 @@ #include "DrawingBuffer.h" #include "FloatRect.h" +#include "FloatSize.h" #include "GraphicsContext3D.h" +#include "internal_glu.h" #include "IntRect.h" +#include "Path.h" #include "PlatformString.h" #include "SharedGraphicsContext3D.h" -#include "SolidFillShader.h" -#include "TexShader.h" +#if PLATFORM(SKIA) +#include "SkPath.h" +#endif #include "Texture.h" #define _USE_MATH_DEFINES @@ -50,17 +54,99 @@ namespace WebCore { +// Number of line segments used to approximate bezier curves. +const int pathTesselation = 30; +typedef void (GLAPIENTRY *TESSCB)(); +typedef WTF::Vector<float> FloatVector; +typedef WTF::Vector<double> DoubleVector; + struct GLES2Canvas::State { State() : m_fillColor(0, 0, 0, 255) , m_alpha(1.0f) , m_compositeOp(CompositeSourceOver) + , m_clippingEnabled(false) + { + } + State(const State& other) + : m_fillColor(other.m_fillColor) + , m_alpha(other.m_alpha) + , m_compositeOp(other.m_compositeOp) + , m_ctm(other.m_ctm) + , m_clippingPaths() // Don't copy; clipping paths are tracked per-state. + , m_clippingEnabled(other.m_clippingEnabled) { } Color m_fillColor; float m_alpha; CompositeOperator m_compositeOp; AffineTransform m_ctm; + WTF::Vector<Path> m_clippingPaths; + bool m_clippingEnabled; +}; + +static inline FloatPoint operator*(const FloatPoint& f, float scale) +{ + return FloatPoint(f.x() * scale, f.y() * scale); +} + +static inline FloatPoint operator*(float scale, const FloatPoint& f) +{ + return FloatPoint(f.x() * scale, f.y() * scale); +} + +static inline FloatSize operator*(const FloatSize& f, float scale) +{ + return FloatSize(f.width() * scale, f.height() * scale); +} + +static inline FloatSize operator*(float scale, const FloatSize& f) +{ + return FloatSize(f.width() * scale, f.height() * scale); +} + +class Quadratic { + public: + Quadratic(FloatPoint a, FloatPoint b, FloatPoint c) : + m_a(a), m_b(b), m_c(c) + { + } + static Quadratic fromBezier(FloatPoint p0, FloatPoint p1, FloatPoint p2) + { + FloatSize p1s(p1.x(), p1.y()); + FloatSize p2s(p2.x(), p2.y()); + FloatPoint b = -2.0f * p0 + 2.0f * p1s; + FloatPoint c = p0 - 2.0f * p1s + p2s; + return Quadratic(p0, b, c); + } + inline FloatPoint evaluate(float t) + { + return m_a + t * (m_b + t * m_c); + } + FloatPoint m_a, m_b, m_c, m_d; +}; + +class Cubic { + public: + Cubic(FloatPoint a, FloatPoint b, FloatPoint c, FloatPoint d) : + m_a(a), m_b(b), m_c(c), m_d(d) + { + } + static Cubic fromBezier(FloatPoint p0, FloatPoint p1, FloatPoint p2, FloatPoint p3) + { + FloatSize p1s(p1.x(), p1.y()); + FloatSize p2s(p2.x(), p2.y()); + FloatSize p3s(p3.x(), p3.y()); + FloatPoint b = -3.0f * p0 + 3.0f * p1s; + FloatPoint c = 3.0f * p0 - 6.0f * p1s + 3.0f * p2s; + FloatPoint d = -1.0f * p0 + 3.0f * p1s - 3.0f * p2s + p3s; + return Cubic(p0, b, c, d); + } + FloatPoint evaluate(float t) + { + return m_a + t * (m_b + t * (m_c + t * m_d)); + } + FloatPoint m_a, m_b, m_c, m_d; }; GLES2Canvas::GLES2Canvas(SharedGraphicsContext3D* context, DrawingBuffer* drawingBuffer, const IntSize& size) @@ -88,7 +174,7 @@ void GLES2Canvas::bindFramebuffer() void GLES2Canvas::clearRect(const FloatRect& rect) { bindFramebuffer(); - if (m_state->m_ctm.isIdentity()) { + if (m_state->m_ctm.isIdentity() && !m_state->m_clippingEnabled) { m_context->scissor(rect); m_context->enable(GraphicsContext3D::SCISSOR_TEST); m_context->clearColor(Color(RGBA32(0))); @@ -102,13 +188,21 @@ void GLES2Canvas::clearRect(const FloatRect& rect) } } +void GLES2Canvas::fillPath(const Path& path) +{ + m_context->applyCompositeOperator(m_state->m_compositeOp); + applyClipping(m_state->m_clippingEnabled); + fillPath(path, m_state->m_fillColor); +} + void GLES2Canvas::fillRect(const FloatRect& rect, const Color& color, ColorSpace colorSpace) { m_context->applyCompositeOperator(m_state->m_compositeOp); + applyClipping(m_state->m_clippingEnabled); m_context->useQuadVertices(); AffineTransform matrix(m_flipMatrix); - matrix.multLeft(m_state->m_ctm); + matrix *= m_state->m_ctm; matrix.translate(rect.x(), rect.y()); matrix.scale(rect.width(), rect.height()); @@ -150,7 +244,24 @@ void GLES2Canvas::scale(const FloatSize& size) void GLES2Canvas::concatCTM(const AffineTransform& affine) { - m_state->m_ctm.multLeft(affine); + m_state->m_ctm *= affine; +} + +void GLES2Canvas::clipPath(const Path& path) +{ + bindFramebuffer(); + checkGLError("bindFramebuffer"); + beginStencilDraw(); + // Red is used so we can see it if it ends up in the color buffer. + Color red(255, 0, 0, 255); + fillPath(path, red); + m_state->m_clippingPaths.append(path); + m_state->m_clippingEnabled = true; +} + +void GLES2Canvas::clipOut(const Path& path) +{ + ASSERT(!"clipOut is unsupported in GLES2Canvas.\n"); } void GLES2Canvas::save() @@ -162,13 +273,30 @@ void GLES2Canvas::save() void GLES2Canvas::restore() { ASSERT(!m_stateStack.isEmpty()); + bool hadClippingPaths = !m_state->m_clippingPaths.isEmpty(); m_stateStack.removeLast(); m_state = &m_stateStack.last(); + if (hadClippingPaths) { + m_context->clear(GraphicsContext3D::STENCIL_BUFFER_BIT); + beginStencilDraw(); + StateVector::const_iterator iter; + for (iter = m_stateStack.begin(); iter < m_stateStack.end(); ++iter) { + const State& state = *iter; + const Vector<Path>& clippingPaths = state.m_clippingPaths; + Vector<Path>::const_iterator pathIter; + for (pathIter = clippingPaths.begin(); pathIter < clippingPaths.end(); ++pathIter) { + // Red is used so we can see it if it ends up in the color buffer. + Color red(255, 0, 0, 255); + fillPath(*pathIter, red); + } + } + } } void GLES2Canvas::drawTexturedRect(unsigned texture, const IntSize& textureSize, const FloatRect& srcRect, const FloatRect& dstRect, ColorSpace colorSpace, CompositeOperator compositeOp) { m_context->applyCompositeOperator(compositeOp); + applyClipping(false); m_context->useQuadVertices(); m_context->setActiveTexture(GraphicsContext3D::TEXTURE0); @@ -180,13 +308,14 @@ void GLES2Canvas::drawTexturedRect(unsigned texture, const IntSize& textureSize, void GLES2Canvas::drawTexturedRect(Texture* texture, const FloatRect& srcRect, const FloatRect& dstRect, ColorSpace colorSpace, CompositeOperator compositeOp) { - drawTexturedRect(texture, srcRect, dstRect, m_state->m_ctm, m_state->m_alpha, colorSpace, compositeOp); + drawTexturedRect(texture, srcRect, dstRect, m_state->m_ctm, m_state->m_alpha, colorSpace, compositeOp, m_state->m_clippingEnabled); } -void GLES2Canvas::drawTexturedRect(Texture* texture, const FloatRect& srcRect, const FloatRect& dstRect, const AffineTransform& transform, float alpha, ColorSpace colorSpace, CompositeOperator compositeOp) +void GLES2Canvas::drawTexturedRect(Texture* texture, const FloatRect& srcRect, const FloatRect& dstRect, const AffineTransform& transform, float alpha, ColorSpace colorSpace, CompositeOperator compositeOp, bool clip) { m_context->applyCompositeOperator(compositeOp); + applyClipping(clip); const TilingData& tiles = texture->tiles(); IntRect tileIdxRect = tiles.overlappedTileIndices(srcRect); @@ -220,7 +349,7 @@ void GLES2Canvas::drawTexturedRectTile(Texture* texture, int tile, const FloatRe void GLES2Canvas::drawQuad(const IntSize& textureSize, const FloatRect& srcRect, const FloatRect& dstRect, const AffineTransform& transform, float alpha) { AffineTransform matrix(m_flipMatrix); - matrix.multLeft(transform); + matrix *= transform; matrix.translate(dstRect.x(), dstRect.y()); matrix.scale(dstRect.width(), dstRect.height()); @@ -251,6 +380,214 @@ Texture* GLES2Canvas::getTexture(NativeImagePtr ptr) return m_context->getTexture(ptr); } +#if PLATFORM(SKIA) +// This is actually cross-platform code, but since its only caller is inside a +// PLATFORM(SKIA), it will cause a warning-as-error on Chrome/Mac. +static void interpolateQuadratic(DoubleVector* vertices, const FloatPoint& p0, const FloatPoint& p1, const FloatPoint& p2) +{ + float tIncrement = 1.0f / pathTesselation, t = tIncrement; + Quadratic c = Quadratic::fromBezier(p0, p1, p2); + for (int i = 0; i < pathTesselation; ++i, t += tIncrement) { + FloatPoint p = c.evaluate(t); + vertices->append(p.x()); + vertices->append(p.y()); + vertices->append(1.0); + } +} + +static void interpolateCubic(DoubleVector* vertices, const FloatPoint& p0, const FloatPoint& p1, const FloatPoint& p2, const FloatPoint& p3) +{ + float tIncrement = 1.0f / pathTesselation, t = tIncrement; + Cubic c = Cubic::fromBezier(p0, p1, p2, p3); + for (int i = 0; i < pathTesselation; ++i, t += tIncrement) { + FloatPoint p = c.evaluate(t); + vertices->append(p.x()); + vertices->append(p.y()); + vertices->append(1.0); + } +} +#endif + +struct PolygonData { + PolygonData(FloatVector* vertices, WTF::Vector<short>* indices) + : m_vertices(vertices) + , m_indices(indices) + { + } + FloatVector* m_vertices; + WTF::Vector<short>* m_indices; +}; + +static void beginData(GLenum type, void* data) +{ + ASSERT(type == GL_TRIANGLES); +} + +static void edgeFlagData(GLboolean flag, void* data) +{ +} + +static void vertexData(void* vertexData, void* data) +{ + static_cast<PolygonData*>(data)->m_indices->append(reinterpret_cast<long>(vertexData)); +} + +static void endData(void* data) +{ +} + +static void combineData(GLdouble coords[3], void* vertexData[4], + GLfloat weight[4], void **outData, void* data) +{ + PolygonData* polygonData = static_cast<PolygonData*>(data); + int index = polygonData->m_vertices->size() / 3; + polygonData->m_vertices->append(static_cast<float>(coords[0])); + polygonData->m_vertices->append(static_cast<float>(coords[1])); + polygonData->m_vertices->append(1.0f); + *outData = reinterpret_cast<void*>(index); +} + +typedef void (*TESSCB)(); + +void GLES2Canvas::createVertexBufferFromPath(const Path& path, int* count, unsigned* vertexBuffer, unsigned* indexBuffer) +{ + *vertexBuffer = m_context->graphicsContext3D()->createBuffer(); + checkGLError("createVertexBufferFromPath, createBuffer"); + *indexBuffer = m_context->graphicsContext3D()->createBuffer(); + checkGLError("createVertexBufferFromPath, createBuffer"); + DoubleVector inVertices; + WTF::Vector<size_t> contours; +#if PLATFORM(SKIA) + const SkPath* skPath = path.platformPath(); + SkPoint pts[4]; + SkPath::Iter iter(*skPath, true); + SkPath::Verb verb; + while ((verb = iter.next(pts)) != SkPath::kDone_Verb) { + switch (verb) { + case SkPath::kMove_Verb: + inVertices.append(pts[0].fX); + inVertices.append(pts[0].fY); + inVertices.append(1.0); + break; + case SkPath::kLine_Verb: + inVertices.append(pts[1].fX); + inVertices.append(pts[1].fY); + inVertices.append(1.0); + break; + case SkPath::kQuad_Verb: + interpolateQuadratic(&inVertices, pts[0], pts[1], pts[2]); + break; + case SkPath::kCubic_Verb: + interpolateCubic(&inVertices, pts[0], pts[1], pts[2], pts[3]); + break; + case SkPath::kClose_Verb: + contours.append(inVertices.size() / 3); + break; + case SkPath::kDone_Verb: + break; + } + } +#else + ASSERT(!"Path extraction not implemented on this platform."); +#endif + + GLUtesselator* tess = internal_gluNewTess(); + internal_gluTessProperty(tess, GLU_TESS_WINDING_RULE, GLU_TESS_WINDING_NONZERO); + internal_gluTessCallback(tess, GLU_TESS_BEGIN_DATA, (TESSCB) &beginData); + internal_gluTessCallback(tess, GLU_TESS_VERTEX_DATA, (TESSCB) &vertexData); + internal_gluTessCallback(tess, GLU_TESS_END_DATA, (TESSCB) &endData); + internal_gluTessCallback(tess, GLU_TESS_EDGE_FLAG_DATA, (TESSCB) &edgeFlagData); + internal_gluTessCallback(tess, GLU_TESS_COMBINE_DATA, (TESSCB) &combineData); + WTF::Vector<short> indices; + FloatVector vertices; + vertices.reserveInitialCapacity(inVertices.size()); + PolygonData data(&vertices, &indices); + internal_gluTessBeginPolygon(tess, &data); + WTF::Vector<size_t>::const_iterator contour; + size_t i = 0; + for (contour = contours.begin(); contour != contours.end(); ++contour) { + internal_gluTessBeginContour(tess); + for (; i < *contour; ++i) { + vertices.append(inVertices[i * 3]); + vertices.append(inVertices[i * 3 + 1]); + vertices.append(1.0f); + internal_gluTessVertex(tess, &inVertices[i * 3], reinterpret_cast<void*>(i)); + } + internal_gluTessEndContour(tess); + } + internal_gluTessEndPolygon(tess); + internal_gluDeleteTess(tess); + + m_context->graphicsContext3D()->bindBuffer(GraphicsContext3D::ARRAY_BUFFER, *vertexBuffer); + checkGLError("createVertexBufferFromPath, bindBuffer ARRAY_BUFFER"); + m_context->graphicsContext3D()->bufferData(GraphicsContext3D::ARRAY_BUFFER, vertices.size() * sizeof(float), vertices.data(), GraphicsContext3D::STREAM_DRAW); + checkGLError("createVertexBufferFromPath, bufferData ARRAY_BUFFER"); + + m_context->graphicsContext3D()->bindBuffer(GraphicsContext3D::ELEMENT_ARRAY_BUFFER, *indexBuffer); + checkGLError("createVertexBufferFromPath, bindBuffer ELEMENT_ARRAY_BUFFER"); + m_context->graphicsContext3D()->bufferData(GraphicsContext3D::ELEMENT_ARRAY_BUFFER, indices.size() * sizeof(short), indices.data(), GraphicsContext3D::STREAM_DRAW); + checkGLError("createVertexBufferFromPath, bufferData ELEMENT_ARRAY_BUFFER"); + *count = indices.size(); +} + +void GLES2Canvas::fillPath(const Path& path, const Color& color) +{ + int count; + unsigned vertexBuffer, indexBuffer; + createVertexBufferFromPath(path, &count, &vertexBuffer, &indexBuffer); + m_context->graphicsContext3D()->bindBuffer(GraphicsContext3D::ARRAY_BUFFER, vertexBuffer); + checkGLError("bindBuffer"); + m_context->graphicsContext3D()->bindBuffer(GraphicsContext3D::ELEMENT_ARRAY_BUFFER, indexBuffer); + checkGLError("bindBuffer"); + + AffineTransform matrix(m_flipMatrix); + matrix *= m_state->m_ctm; + + m_context->useFillSolidProgram(matrix, color); + checkGLError("useFillSolidProgram"); + + m_context->graphicsContext3D()->drawElements(GraphicsContext3D::TRIANGLES, count, GraphicsContext3D::UNSIGNED_SHORT, 0); + checkGLError("drawArrays"); + + m_context->graphicsContext3D()->deleteBuffer(vertexBuffer); + checkGLError("deleteBuffer"); + + m_context->graphicsContext3D()->deleteBuffer(indexBuffer); + checkGLError("deleteBuffer"); +} + +void GLES2Canvas::beginStencilDraw() +{ + // Turn on stencil test. + m_context->enableStencil(true); + checkGLError("enable STENCIL_TEST"); + + // Stencil test never passes, so colorbuffer is not drawn. + m_context->graphicsContext3D()->stencilFunc(GraphicsContext3D::NEVER, 1, 1); + checkGLError("stencilFunc"); + + // All writes incremement the stencil buffer. + m_context->graphicsContext3D()->stencilOp(GraphicsContext3D::INCR, + GraphicsContext3D::INCR, + GraphicsContext3D::INCR); + checkGLError("stencilOp"); +} + +void GLES2Canvas::applyClipping(bool enable) +{ + m_context->enableStencil(enable); + if (enable) { + // Enable drawing only where stencil is non-zero. + m_context->graphicsContext3D()->stencilFunc(GraphicsContext3D::EQUAL, m_state->m_clippingPaths.size() % 256, 1); + checkGLError("stencilFunc"); + // Keep all stencil values the same. + m_context->graphicsContext3D()->stencilOp(GraphicsContext3D::KEEP, + GraphicsContext3D::KEEP, + GraphicsContext3D::KEEP); + checkGLError("stencilOp"); + } +} + void GLES2Canvas::checkGLError(const char* header) { #ifndef NDEBUG @@ -283,4 +620,3 @@ void GLES2Canvas::checkGLError(const char* header) } } - diff --git a/Source/WebCore/platform/graphics/chromium/GLES2Canvas.h b/Source/WebCore/platform/graphics/chromium/GLES2Canvas.h index 6fc1a0e..605f86f 100644 --- a/Source/WebCore/platform/graphics/chromium/GLES2Canvas.h +++ b/Source/WebCore/platform/graphics/chromium/GLES2Canvas.h @@ -48,13 +48,16 @@ class Color; class DrawingBuffer; class FloatRect; class GraphicsContext3D; +class Path; class SharedGraphicsContext3D; -class GLES2Canvas : public Noncopyable { +class GLES2Canvas { + WTF_MAKE_NONCOPYABLE(GLES2Canvas); public: GLES2Canvas(SharedGraphicsContext3D*, DrawingBuffer*, const IntSize&); ~GLES2Canvas(); + void fillPath(const Path&); void fillRect(const FloatRect&, const Color&, ColorSpace); void fillRect(const FloatRect&); void clearRect(const FloatRect&); @@ -65,6 +68,8 @@ public: void rotate(float angleInRadians); void scale(const FloatSize&); void concatCTM(const AffineTransform&); + void clipPath(const Path&); + void clipOut(const Path&); void save(); void restore(); @@ -72,9 +77,13 @@ public: // non-standard functions // These are not standard GraphicsContext functions, and should be pushed // down into a PlatformContextGLES2 at some point. + + // This version is called by the canvas->canvas draws. void drawTexturedRect(unsigned texture, const IntSize& textureSize, const FloatRect& srcRect, const FloatRect& dstRect, ColorSpace, CompositeOperator); - void drawTexturedRect(Texture*, const FloatRect& srcRect, const FloatRect& dstRect, const AffineTransform&, float alpha, ColorSpace, CompositeOperator); + // This version is called by BitmapImage::draw(). void drawTexturedRect(Texture*, const FloatRect& srcRect, const FloatRect& dstRect, ColorSpace, CompositeOperator); + // This version is called by the above, and by the software->hardware uploads. + void drawTexturedRect(Texture*, const FloatRect& srcRect, const FloatRect& dstRect, const AffineTransform&, float alpha, ColorSpace, CompositeOperator, bool clip); Texture* createTexture(NativeImagePtr, Texture::Format, int width, int height); Texture* getTexture(NativeImagePtr); @@ -88,6 +97,10 @@ private: void drawTexturedRectTile(Texture* texture, int tile, const FloatRect& srcRect, const FloatRect& dstRect, const AffineTransform&, float alpha); void drawQuad(const IntSize& textureSize, const FloatRect& srcRect, const FloatRect& dstRect, const AffineTransform&, float alpha); void applyCompositeOperator(CompositeOperator); + void createVertexBufferFromPath(const Path&, int* count, unsigned* vertexBuffer, unsigned* indexBuffer); + void fillPath(const Path&, const Color&); + void beginStencilDraw(); + void applyClipping(bool enable); void checkGLError(const char* header); IntSize m_size; @@ -96,7 +109,8 @@ private: DrawingBuffer* m_drawingBuffer; struct State; - WTF::Vector<State> m_stateStack; + typedef WTF::Vector<State> StateVector; + StateVector m_stateStack; State* m_state; AffineTransform m_flipMatrix; }; diff --git a/Source/WebCore/platform/graphics/chromium/GlyphPageTreeNodeChromiumWin.cpp b/Source/WebCore/platform/graphics/chromium/GlyphPageTreeNodeChromiumWin.cpp index e71f66a..ee2b5ab 100644 --- a/Source/WebCore/platform/graphics/chromium/GlyphPageTreeNodeChromiumWin.cpp +++ b/Source/WebCore/platform/graphics/chromium/GlyphPageTreeNodeChromiumWin.cpp @@ -32,9 +32,9 @@ #include <windows.h> #include <vector> -#include "ChromiumBridge.h" #include "Font.h" #include "GlyphPageTreeNode.h" +#include "PlatformBridge.h" #include "SimpleFontData.h" #include "UniscribeHelperTextRun.h" #include "WindowsVersion.h" @@ -80,12 +80,11 @@ static bool fillBMPGlyphs(unsigned offset, ReleaseDC(0, dc); if (recurse) { - if (ChromiumBridge::ensureFontLoaded(fontData->platformData().hfont())) + if (PlatformBridge::ensureFontLoaded(fontData->platformData().hfont())) return fillBMPGlyphs(offset, length, buffer, page, fontData, false); - else { - fillEmptyGlyphs(page); - return false; - } + + fillEmptyGlyphs(page); + return false; } else { // FIXME: Handle gracefully the error if this call also fails. // See http://crbug.com/6401 diff --git a/Source/WebCore/platform/graphics/chromium/ImageChromium.cpp b/Source/WebCore/platform/graphics/chromium/ImageChromium.cpp index e90d566..e2b6f7a 100644 --- a/Source/WebCore/platform/graphics/chromium/ImageChromium.cpp +++ b/Source/WebCore/platform/graphics/chromium/ImageChromium.cpp @@ -31,7 +31,7 @@ #include "config.h" #include "Image.h" -#include "ChromiumBridge.h" +#include "PlatformBridge.h" namespace WebCore { @@ -39,7 +39,7 @@ namespace WebCore { PassRefPtr<Image> Image::loadPlatformResource(const char *name) { - return ChromiumBridge::loadPlatformImageResource(name); + return PlatformBridge::loadPlatformImageResource(name); } } // namespace WebCore diff --git a/Source/WebCore/platform/graphics/chromium/ImageChromiumMac.mm b/Source/WebCore/platform/graphics/chromium/ImageChromiumMac.mm index 073a409..f003894 100644 --- a/Source/WebCore/platform/graphics/chromium/ImageChromiumMac.mm +++ b/Source/WebCore/platform/graphics/chromium/ImageChromiumMac.mm @@ -33,14 +33,14 @@ #include "config.h" #include "BitmapImage.h" -#include "ChromiumBridge.h" #include "Image.h" +#include "PlatformBridge.h" namespace WebCore { PassRefPtr<Image> Image::loadPlatformResource(const char* name) { - return ChromiumBridge::loadPlatformImageResource(name); + return PlatformBridge::loadPlatformImageResource(name); } // FIXME: These are temporary stubs, we need real implementations which diff --git a/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp b/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp index 8d77bea..90eac74 100644 --- a/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp +++ b/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp @@ -119,12 +119,6 @@ LayerRendererChromium::LayerRendererChromium(PassRefPtr<GraphicsContext3D> conte LayerRendererChromium::~LayerRendererChromium() { cleanupSharedObjects(); - - // Because the tilers need to clean up textures, clean them up explicitly - // before the GraphicsContext3D is destroyed. - m_rootLayerTiler.clear(); - m_horizontalScrollbarTiler.clear(); - m_verticalScrollbarTiler.clear(); } GraphicsContext3D* LayerRendererChromium::context() @@ -269,6 +263,9 @@ void LayerRendererChromium::drawLayers(const IntRect& visibleRect, const IntRect updateAndDrawRootLayer(tilePaint, scrollbarPaint, visibleRect, contentRect); + // Re-enable color writes to layers, which may be partially transparent. + m_context->colorMask(true, true, true, true); + // Set the root visible/content rects --- used by subsequent drawLayers calls. m_rootVisibleRect = visibleRect; m_rootContentRect = contentRect; @@ -795,6 +792,11 @@ void LayerRendererChromium::cleanupSharedObjects() if (m_offscreenFramebufferId) GLC(m_context.get(), m_context->deleteFramebuffer(m_offscreenFramebufferId)); + // Clear tilers before the texture manager, as they have references to textures. + m_rootLayerTiler.clear(); + m_horizontalScrollbarTiler.clear(); + m_verticalScrollbarTiler.clear(); + m_textureManager.clear(); } diff --git a/Source/WebCore/platform/graphics/chromium/LayerTexture.h b/Source/WebCore/platform/graphics/chromium/LayerTexture.h index 711e687..b60dff2 100644 --- a/Source/WebCore/platform/graphics/chromium/LayerTexture.h +++ b/Source/WebCore/platform/graphics/chromium/LayerTexture.h @@ -28,6 +28,7 @@ #include "IntSize.h" #include "TextureManager.h" +#include <wtf/FastAllocBase.h> #include <wtf/Noncopyable.h> #include <wtf/PassOwnPtr.h> #include <wtf/RefPtr.h> @@ -37,7 +38,8 @@ namespace WebCore { class GraphicsContext3D; class TextureManager; -class LayerTexture : public Noncopyable { +class LayerTexture { + WTF_MAKE_NONCOPYABLE(LayerTexture); WTF_MAKE_FAST_ALLOCATED; public: static PassOwnPtr<LayerTexture> create(GraphicsContext3D* context, TextureManager* manager) { diff --git a/Source/WebCore/platform/graphics/chromium/LayerTilerChromium.cpp b/Source/WebCore/platform/graphics/chromium/LayerTilerChromium.cpp index b4b4a72..6b65e66 100644 --- a/Source/WebCore/platform/graphics/chromium/LayerTilerChromium.cpp +++ b/Source/WebCore/platform/graphics/chromium/LayerTilerChromium.cpp @@ -33,6 +33,7 @@ #include "GraphicsContext.h" #include "GraphicsContext3D.h" #include "LayerRendererChromium.h" +#include "LayerTexture.h" #if PLATFORM(SKIA) #include "NativeImageSkia.h" @@ -54,7 +55,8 @@ PassOwnPtr<LayerTilerChromium> LayerTilerChromium::create(LayerRendererChromium* } LayerTilerChromium::LayerTilerChromium(LayerRendererChromium* layerRenderer, const IntSize& tileSize) - : m_layerRenderer(layerRenderer) + : m_skipsDraw(false) + , m_layerRenderer(layerRenderer) { setTileSize(tileSize); } @@ -83,17 +85,7 @@ void LayerTilerChromium::setTileSize(const IntSize& size) void LayerTilerChromium::reset() { - for (size_t i = 0; i < m_tiles.size(); ++i) { - if (!m_tiles[i]) - continue; - layerRenderer()->deleteLayerTexture(m_tiles[i]->releaseTextureId()); - } m_tiles.clear(); - for (size_t i = 0; i < m_unusedTiles.size(); ++i) { - if (!m_unusedTiles[i]) - continue; - layerRenderer()->deleteLayerTexture(m_unusedTiles[i]->releaseTextureId()); - } m_unusedTiles.clear(); m_layerSize = IntSize(); @@ -110,12 +102,9 @@ LayerTilerChromium::Tile* LayerTilerChromium::createTile(int i, int j) m_tiles[index] = m_unusedTiles.last().release(); m_unusedTiles.removeLast(); } else { - const unsigned int textureId = layerRenderer()->createLayerTexture(); - OwnPtr<Tile> tile = adoptPtr(new Tile(textureId)); - GraphicsContext3D* context = layerRendererContext(); - GLC(context, context->texImage2DResourceSafe(GraphicsContext3D::TEXTURE_2D, 0, GraphicsContext3D::RGBA, m_tileSize.width(), m_tileSize.height(), 0, GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE)); - + TextureManager* manager = layerRenderer()->textureManager(); + OwnPtr<Tile> tile = adoptPtr(new Tile(LayerTexture::create(context, manager))); m_tiles[index] = tile.release(); } @@ -238,6 +227,9 @@ void LayerTilerChromium::invalidateEntireLayer() void LayerTilerChromium::update(TilePaintInterface& painter, const IntRect& contentRect) { + if (m_skipsDraw) + return; + // Invalidate old tiles that were previously used but aren't in use this // frame so that they can get reused for new tiles. IntRect layerRect = contentRectToLayerRect(contentRect); @@ -256,6 +248,8 @@ void LayerTilerChromium::update(TilePaintInterface& painter, const IntRect& cont Tile* tile = m_tiles[tileIndex(i, j)].get(); if (!tile) tile = createTile(i, j); + if (!tile->texture()->isValid(m_tileSize, GraphicsContext3D::RGBA)) + tile->m_dirtyLayerRect = tileLayerRect(i, j); dirtyLayerRect.unite(tile->m_dirtyLayerRect); } } @@ -318,6 +312,12 @@ void LayerTilerChromium::update(TilePaintInterface& painter, const IntRect& cont if (sourceRect.isEmpty()) continue; + if (!tile->texture()->reserve(m_tileSize, GraphicsContext3D::RGBA)) { + m_skipsDraw = true; + reset(); + return; + } + // Calculate tile-space rectangle to upload into. IntRect destRect(IntPoint(sourceRect.x() - anchor.x(), sourceRect.y() - anchor.y()), sourceRect.size()); ASSERT(destRect.x() >= 0); @@ -342,7 +342,7 @@ void LayerTilerChromium::update(TilePaintInterface& painter, const IntRect& cont pixelSource = &m_tilePixels[0]; } - GLC(context, context->bindTexture(GraphicsContext3D::TEXTURE_2D, tile->textureId())); + tile->texture()->bindTexture(); GLC(context, context->texSubImage2D(GraphicsContext3D::TEXTURE_2D, 0, destRect.x(), destRect.y(), destRect.width(), destRect.height(), GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, pixelSource)); tile->clearDirty(); @@ -357,6 +357,9 @@ void LayerTilerChromium::setLayerPosition(const IntPoint& layerPosition) void LayerTilerChromium::draw(const IntRect& contentRect) { + if (m_skipsDraw) + return; + // We reuse the shader program used by ContentLayerChromium. GraphicsContext3D* context = layerRendererContext(); const ContentLayerChromium::SharedValues* contentLayerValues = layerRenderer()->contentLayerSharedValues(); @@ -370,13 +373,15 @@ void LayerTilerChromium::draw(const IntRect& contentRect) Tile* tile = m_tiles[tileIndex(i, j)].get(); ASSERT(tile); - GLC(context, context->bindTexture(GraphicsContext3D::TEXTURE_2D, tile->textureId())); + tile->texture()->bindTexture(); TransformationMatrix tileMatrix; IntRect tileRect = tileContentRect(i, j); tileMatrix.translate3d(tileRect.x() - contentRect.x() + tileRect.width() / 2.0, tileRect.y() - contentRect.y() + tileRect.height() / 2.0, 0); LayerChromium::drawTexturedQuad(context, layerRenderer()->projectionMatrix(), tileMatrix, m_tileSize.width(), m_tileSize.height(), 1, contentLayerValues->shaderMatrixLocation(), contentLayerValues->shaderAlphaLocation()); + + tile->texture()->unreserve(); } } } @@ -410,21 +415,6 @@ void LayerTilerChromium::growLayerToContain(const IntRect& contentRect) resizeLayer(newSize); } -LayerTilerChromium::Tile::~Tile() -{ - // Each tile doesn't have a reference to the context, so can't clean up - // its own texture. If this assert is hit, then the LayerTilerChromium - // destructor didn't clean this up. - ASSERT(!m_textureId); -} - -unsigned int LayerTilerChromium::Tile::releaseTextureId() -{ - unsigned int id = m_textureId; - m_textureId = 0; - return id; -} - } // namespace WebCore #endif // USE(ACCELERATED_COMPOSITING) diff --git a/Source/WebCore/platform/graphics/chromium/LayerTilerChromium.h b/Source/WebCore/platform/graphics/chromium/LayerTilerChromium.h index c066fdf..e09693d 100644 --- a/Source/WebCore/platform/graphics/chromium/LayerTilerChromium.h +++ b/Source/WebCore/platform/graphics/chromium/LayerTilerChromium.h @@ -30,6 +30,7 @@ #if USE(ACCELERATED_COMPOSITING) #include "LayerChromium.h" +#include "LayerTexture.h" #include <wtf/OwnArrayPtr.h> namespace WebCore { @@ -42,7 +43,8 @@ public: virtual void paint(GraphicsContext& context, const IntRect& contentRect) = 0; }; -class LayerTilerChromium : public Noncopyable { +class LayerTilerChromium { + WTF_MAKE_NONCOPYABLE(LayerTilerChromium); public: static PassOwnPtr<LayerTilerChromium> create(LayerRendererChromium* layerRenderer, const IntSize& tileSize); @@ -62,12 +64,11 @@ private: LayerTilerChromium(LayerRendererChromium* layerRenderer, const IntSize& tileSize); class Tile { + WTF_MAKE_NONCOPYABLE(Tile); public: - explicit Tile(unsigned int textureId) : m_textureId(textureId) { } - ~Tile(); + explicit Tile(PassOwnPtr<LayerTexture> tex) : m_tex(tex) {} - unsigned int textureId() const { return m_textureId; } - unsigned int releaseTextureId(); + LayerTexture* texture() { return m_tex.get(); } bool dirty() const { return !m_dirtyLayerRect.isEmpty(); } void clearDirty() { m_dirtyLayerRect = IntRect(); } @@ -75,7 +76,7 @@ private: // Layer-space dirty rectangle that needs to be repainted. IntRect m_dirtyLayerRect; private: - unsigned int m_textureId; + OwnPtr<LayerTexture> m_tex; }; void resizeLayer(const IntSize& size); @@ -105,6 +106,8 @@ private: IntRect m_lastUpdateLayerRect; IntPoint m_layerPosition; + bool m_skipsDraw; + // Logical 2D array of tiles (dimensions of m_layerTileSize) Vector<OwnPtr<Tile> > m_tiles; // Linear array of unused tiles. diff --git a/Source/WebCore/platform/graphics/chromium/RenderSurfaceChromium.h b/Source/WebCore/platform/graphics/chromium/RenderSurfaceChromium.h index a93218f..689a6eb 100644 --- a/Source/WebCore/platform/graphics/chromium/RenderSurfaceChromium.h +++ b/Source/WebCore/platform/graphics/chromium/RenderSurfaceChromium.h @@ -41,7 +41,8 @@ class LayerChromium; class LayerRendererChromium; class LayerTexture; -class RenderSurfaceChromium : public Noncopyable { +class RenderSurfaceChromium { + WTF_MAKE_NONCOPYABLE(RenderSurfaceChromium); friend class LayerRendererChromium; public: explicit RenderSurfaceChromium(LayerChromium*); diff --git a/Source/WebCore/platform/graphics/chromium/SimpleFontDataChromiumWin.cpp b/Source/WebCore/platform/graphics/chromium/SimpleFontDataChromiumWin.cpp index 204c565..c23c586 100644 --- a/Source/WebCore/platform/graphics/chromium/SimpleFontDataChromiumWin.cpp +++ b/Source/WebCore/platform/graphics/chromium/SimpleFontDataChromiumWin.cpp @@ -32,11 +32,11 @@ #include "config.h" #include "SimpleFontData.h" -#include "ChromiumBridge.h" +#include "FloatRect.h" #include "Font.h" #include "FontCache.h" -#include "FloatRect.h" #include "FontDescription.h" +#include "PlatformBridge.h" #include <wtf/MathExtras.h> #include <unicode/uchar.h> @@ -70,7 +70,7 @@ void SimpleFontData::platformInit() TEXTMETRIC textMetric = {0}; if (!GetTextMetrics(dc, &textMetric)) { - if (ChromiumBridge::ensureFontLoaded(m_platformData.hfont())) { + if (PlatformBridge::ensureFontLoaded(m_platformData.hfont())) { // Retry GetTextMetrics. // FIXME: Handle gracefully the error if this call also fails. // See http://crbug.com/6401. @@ -159,7 +159,7 @@ void SimpleFontData::determinePitch() // is *not* fixed pitch. Unbelievable but true. TEXTMETRIC textMetric = {0}; if (!GetTextMetrics(dc, &textMetric)) { - if (ChromiumBridge::ensureFontLoaded(m_platformData.hfont())) { + if (PlatformBridge::ensureFontLoaded(m_platformData.hfont())) { // Retry GetTextMetrics. // FIXME: Handle gracefully the error if this call also fails. // See http://crbug.com/6401. @@ -190,7 +190,7 @@ float SimpleFontData::platformWidthForGlyph(Glyph glyph) const int width = 0; if (!GetCharWidthI(dc, glyph, 1, 0, &width)) { // Ask the browser to preload the font and retry. - if (ChromiumBridge::ensureFontLoaded(m_platformData.hfont())) { + if (PlatformBridge::ensureFontLoaded(m_platformData.hfont())) { // FIXME: Handle gracefully the error if this call also fails. // See http://crbug.com/6401. if (!GetCharWidthI(dc, glyph, 1, 0, &width)) diff --git a/Source/WebCore/platform/graphics/chromium/TextureManager.h b/Source/WebCore/platform/graphics/chromium/TextureManager.h index 4891cc7..83104a9 100644 --- a/Source/WebCore/platform/graphics/chromium/TextureManager.h +++ b/Source/WebCore/platform/graphics/chromium/TextureManager.h @@ -29,6 +29,7 @@ #include "IntRect.h" #include "IntSize.h" +#include <wtf/FastAllocBase.h> #include <wtf/HashMap.h> #include <wtf/ListHashSet.h> @@ -36,7 +37,8 @@ namespace WebCore { typedef int TextureToken; -class TextureManager : public Noncopyable { +class TextureManager { + WTF_MAKE_NONCOPYABLE(TextureManager); public: static PassOwnPtr<TextureManager> create(GraphicsContext3D* context, size_t memoryLimitBytes, int maxTextureSize) { diff --git a/Source/WebCore/platform/graphics/chromium/TransparencyWin.cpp b/Source/WebCore/platform/graphics/chromium/TransparencyWin.cpp index 4dc2157..ba66eae 100644 --- a/Source/WebCore/platform/graphics/chromium/TransparencyWin.cpp +++ b/Source/WebCore/platform/graphics/chromium/TransparencyWin.cpp @@ -252,7 +252,7 @@ void TransparencyWin::setupLayerForOpaqueCompositeLayer() if (m_transformMode == Untransform){ // Compute the inverse mapping from the canvas space to the // coordinate space of our bitmap. - mapping = m_orgTransform.inverse() * mapping; + mapping *= m_orgTransform.inverse(); } compositeToCopy(*m_destContext, *m_drawContext, mapping); @@ -313,7 +313,7 @@ void TransparencyWin::setupTransformForKeepTransform(const IntRect& region) // We're making a layer, so apply the old transform to the new one // so it's maintained. We know the new layer has the identity // transform now, we we can just multiply it. - xform = m_orgTransform * xform; + xform *= m_orgTransform; m_drawContext->concatCTM(xform); } m_drawRect = m_sourceRect; diff --git a/Source/WebCore/platform/graphics/chromium/TransparencyWin.h b/Source/WebCore/platform/graphics/chromium/TransparencyWin.h index b6bef91..535cbaa 100644 --- a/Source/WebCore/platform/graphics/chromium/TransparencyWin.h +++ b/Source/WebCore/platform/graphics/chromium/TransparencyWin.h @@ -54,7 +54,8 @@ class TransparencyWin_OpaqueCompositeLayer_Test; // that is composited later manually. This is to get around Windows' inability // to handle the alpha channel, semitransparent text, and transformed form // controls. -class TransparencyWin : public Noncopyable { +class TransparencyWin { + WTF_MAKE_NONCOPYABLE(TransparencyWin); public: enum LayerMode { // No extra layer is created. Drawing will happen to the source. diff --git a/Source/WebCore/platform/graphics/chromium/UniscribeHelperTextRun.cpp b/Source/WebCore/platform/graphics/chromium/UniscribeHelperTextRun.cpp index f801c13..aa18b4a 100644 --- a/Source/WebCore/platform/graphics/chromium/UniscribeHelperTextRun.cpp +++ b/Source/WebCore/platform/graphics/chromium/UniscribeHelperTextRun.cpp @@ -31,9 +31,10 @@ #include "config.h" #include "UniscribeHelperTextRun.h" -#include "ChromiumBridge.h" #include "Font.h" +#include "PlatformBridge.h" #include "SimpleFontData.h" +#include "TextRun.h" namespace WebCore { @@ -79,7 +80,7 @@ void UniscribeHelperTextRun::tryToPreloadFont(HFONT font) // Ask the browser to get the font metrics for this font. // That will preload the font and it should now be accessible // from the renderer. - ChromiumBridge::ensureFontLoaded(font); + PlatformBridge::ensureFontLoaded(font); } bool UniscribeHelperTextRun::nextWinFontData( diff --git a/Source/WebCore/platform/graphics/chromium/VideoLayerChromium.cpp b/Source/WebCore/platform/graphics/chromium/VideoLayerChromium.cpp index 81264b3..776b83f 100644 --- a/Source/WebCore/platform/graphics/chromium/VideoLayerChromium.cpp +++ b/Source/WebCore/platform/graphics/chromium/VideoLayerChromium.cpp @@ -264,6 +264,7 @@ unsigned VideoLayerChromium::determineTextureFormat(VideoFrameChromium* frame) { switch (frame->format()) { case VideoFrameChromium::YV12: + case VideoFrameChromium::YV16: return GraphicsContext3D::LUMINANCE; case VideoFrameChromium::RGBA: return GraphicsContext3D::RGBA; @@ -330,6 +331,7 @@ void VideoLayerChromium::draw() switch (m_frameFormat) { case VideoFrameChromium::YV12: + case VideoFrameChromium::YV16: drawYUV(sv); break; case VideoFrameChromium::RGBA: diff --git a/Source/WebCore/platform/graphics/gpu/DrawingBuffer.cpp b/Source/WebCore/platform/graphics/gpu/DrawingBuffer.cpp index c283068..dae83a2 100644 --- a/Source/WebCore/platform/graphics/gpu/DrawingBuffer.cpp +++ b/Source/WebCore/platform/graphics/gpu/DrawingBuffer.cpp @@ -67,16 +67,21 @@ void DrawingBuffer::clear() m_multisampleColorBuffer = 0; } - if (m_multisampleDepthStencilBuffer) { - m_context->deleteRenderbuffer(m_multisampleDepthStencilBuffer); - m_multisampleDepthStencilBuffer = 0; - } - if (m_depthStencilBuffer) { m_context->deleteRenderbuffer(m_depthStencilBuffer); m_depthStencilBuffer = 0; } + if (m_depthBuffer) { + m_context->deleteRenderbuffer(m_depthBuffer); + m_depthBuffer = 0; + } + + if (m_stencilBuffer) { + m_context->deleteRenderbuffer(m_stencilBuffer); + m_stencilBuffer = 0; + } + if (m_multisampleFBO) { m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_multisampleFBO); m_context->deleteFramebuffer(m_multisampleFBO); @@ -92,22 +97,52 @@ void DrawingBuffer::clear() void DrawingBuffer::createSecondaryBuffers() { - const GraphicsContext3D::Attributes& attributes = m_context->getContextAttributes(); - - // Create the stencil and depth buffer if needed - if (!multisample() && (attributes.stencil || attributes.depth)) - m_depthStencilBuffer = m_context->createRenderbuffer(); - // create a multisample FBO if (multisample()) { m_multisampleFBO = m_context->createFramebuffer(); m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_multisampleFBO); m_multisampleColorBuffer = m_context->createRenderbuffer(); - if (attributes.stencil || attributes.depth) - m_multisampleDepthStencilBuffer = m_context->createRenderbuffer(); } } +void DrawingBuffer::resizeDepthStencil(int sampleCount) +{ + const GraphicsContext3D::Attributes& attributes = m_context->getContextAttributes(); + if (attributes.depth && attributes.stencil && m_packedDepthStencilExtensionSupported) { + if (!m_depthStencilBuffer) + m_depthStencilBuffer = m_context->createRenderbuffer(); + m_context->bindRenderbuffer(GraphicsContext3D::RENDERBUFFER, m_depthStencilBuffer); + if (multisample()) + m_context->getExtensions()->renderbufferStorageMultisample(GraphicsContext3D::RENDERBUFFER, sampleCount, Extensions3D::DEPTH24_STENCIL8, m_size.width(), m_size.height()); + else + m_context->renderbufferStorage(GraphicsContext3D::RENDERBUFFER, Extensions3D::DEPTH24_STENCIL8, m_size.width(), m_size.height()); + m_context->framebufferRenderbuffer(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::STENCIL_ATTACHMENT, GraphicsContext3D::RENDERBUFFER, m_depthStencilBuffer); + m_context->framebufferRenderbuffer(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::DEPTH_ATTACHMENT, GraphicsContext3D::RENDERBUFFER, m_depthStencilBuffer); + } else { + if (attributes.depth) { + if (!m_depthBuffer) + m_depthBuffer = m_context->createRenderbuffer(); + m_context->bindRenderbuffer(GraphicsContext3D::RENDERBUFFER, m_depthBuffer); + if (multisample()) + m_context->getExtensions()->renderbufferStorageMultisample(GraphicsContext3D::RENDERBUFFER, sampleCount, GraphicsContext3D::DEPTH_COMPONENT16, m_size.width(), m_size.height()); + else + m_context->renderbufferStorage(GraphicsContext3D::RENDERBUFFER, GraphicsContext3D::DEPTH_COMPONENT16, m_size.width(), m_size.height()); + m_context->framebufferRenderbuffer(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::DEPTH_ATTACHMENT, GraphicsContext3D::RENDERBUFFER, m_depthBuffer); + } + if (attributes.stencil) { + if (!m_stencilBuffer) + m_stencilBuffer = m_context->createRenderbuffer(); + m_context->bindRenderbuffer(GraphicsContext3D::RENDERBUFFER, m_stencilBuffer); + if (multisample()) + m_context->getExtensions()->renderbufferStorageMultisample(GraphicsContext3D::RENDERBUFFER, sampleCount, GraphicsContext3D::STENCIL_INDEX8, m_size.width(), m_size.height()); + else + m_context->renderbufferStorage(GraphicsContext3D::RENDERBUFFER, GraphicsContext3D::STENCIL_INDEX8, m_size.width(), m_size.height()); + m_context->framebufferRenderbuffer(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::STENCIL_ATTACHMENT, GraphicsContext3D::RENDERBUFFER, m_stencilBuffer); + } + } + m_context->bindRenderbuffer(GraphicsContext3D::RENDERBUFFER, 0); +} + void DrawingBuffer::reset(const IntSize& newSize) { if (m_size == newSize) @@ -120,7 +155,7 @@ void DrawingBuffer::reset(const IntSize& newSize) m_context->makeContextCurrent(); const GraphicsContext3D::Attributes& attributes = m_context->getContextAttributes(); - unsigned long internalColorFormat, colorFormat, internalDepthStencilFormat = 0; + unsigned long internalColorFormat, colorFormat; if (attributes.alpha) { internalColorFormat = GraphicsContext3D::RGBA; colorFormat = GraphicsContext3D::RGBA; @@ -128,17 +163,7 @@ void DrawingBuffer::reset(const IntSize& newSize) internalColorFormat = GraphicsContext3D::RGB; colorFormat = GraphicsContext3D::RGB; } - if (attributes.stencil || attributes.depth) { - // We don't allow the logic where stencil is required and depth is not. - // See GraphicsContext3D constructor. - // FIXME: If packed depth/stencil is not supported, we should - // create separate renderbuffers for depth and stencil. - if (attributes.stencil && attributes.depth && m_packedDepthStencilExtensionSupported) - internalDepthStencilFormat = Extensions3D::DEPTH24_STENCIL8; - else - internalDepthStencilFormat = GraphicsContext3D::DEPTH_COMPONENT16; - } // resize multisample FBO if (multisample()) { @@ -152,15 +177,7 @@ void DrawingBuffer::reset(const IntSize& newSize) m_context->bindRenderbuffer(GraphicsContext3D::RENDERBUFFER, m_multisampleColorBuffer); m_context->getExtensions()->renderbufferStorageMultisample(GraphicsContext3D::RENDERBUFFER, sampleCount, internalColorFormat, m_size.width(), m_size.height()); m_context->framebufferRenderbuffer(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::COLOR_ATTACHMENT0, GraphicsContext3D::RENDERBUFFER, m_multisampleColorBuffer); - if (attributes.stencil || attributes.depth) { - m_context->bindRenderbuffer(GraphicsContext3D::RENDERBUFFER, m_multisampleDepthStencilBuffer); - m_context->getExtensions()->renderbufferStorageMultisample(GraphicsContext3D::RENDERBUFFER, sampleCount, internalDepthStencilFormat, m_size.width(), m_size.height()); - if (attributes.stencil) - m_context->framebufferRenderbuffer(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::STENCIL_ATTACHMENT, GraphicsContext3D::RENDERBUFFER, m_multisampleDepthStencilBuffer); - if (attributes.depth) - m_context->framebufferRenderbuffer(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::DEPTH_ATTACHMENT, GraphicsContext3D::RENDERBUFFER, m_multisampleDepthStencilBuffer); - } - m_context->bindRenderbuffer(GraphicsContext3D::RENDERBUFFER, 0); + resizeDepthStencil(sampleCount); if (m_context->checkFramebufferStatus(GraphicsContext3D::FRAMEBUFFER) != GraphicsContext3D::FRAMEBUFFER_COMPLETE) { // Cleanup clear(); @@ -175,15 +192,7 @@ void DrawingBuffer::reset(const IntSize& newSize) m_context->texImage2DResourceSafe(GraphicsContext3D::TEXTURE_2D, 0, internalColorFormat, m_size.width(), m_size.height(), 0, colorFormat, GraphicsContext3D::UNSIGNED_BYTE); m_context->framebufferTexture2D(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::COLOR_ATTACHMENT0, GraphicsContext3D::TEXTURE_2D, m_colorBuffer, 0); m_context->bindTexture(GraphicsContext3D::TEXTURE_2D, 0); - if (!multisample() && (attributes.stencil || attributes.depth)) { - m_context->bindRenderbuffer(GraphicsContext3D::RENDERBUFFER, m_depthStencilBuffer); - m_context->renderbufferStorage(GraphicsContext3D::RENDERBUFFER, internalDepthStencilFormat, m_size.width(), m_size.height()); - if (attributes.stencil) - m_context->framebufferRenderbuffer(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::STENCIL_ATTACHMENT, GraphicsContext3D::RENDERBUFFER, m_depthStencilBuffer); - if (attributes.depth) - m_context->framebufferRenderbuffer(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::DEPTH_ATTACHMENT, GraphicsContext3D::RENDERBUFFER, m_depthStencilBuffer); - m_context->bindRenderbuffer(GraphicsContext3D::RENDERBUFFER, 0); - } + resizeDepthStencil(0); if (m_context->checkFramebufferStatus(GraphicsContext3D::FRAMEBUFFER) != GraphicsContext3D::FRAMEBUFFER_COMPLETE) { // Cleanup clear(); diff --git a/Source/WebCore/platform/graphics/gpu/DrawingBuffer.h b/Source/WebCore/platform/graphics/gpu/DrawingBuffer.h index e0e0ee1..49ae114 100644 --- a/Source/WebCore/platform/graphics/gpu/DrawingBuffer.h +++ b/Source/WebCore/platform/graphics/gpu/DrawingBuffer.h @@ -67,6 +67,8 @@ public: // Create the depth/stencil and multisample buffers, if needed. void createSecondaryBuffers(); + void resizeDepthStencil(int sampleCount); + // Copies the multisample color buffer to the normal color buffer and leaves m_fbo bound void commit(long x = 0, long y = 0, long width = -1, long height = -1); @@ -80,8 +82,10 @@ public: #endif #if PLATFORM(CHROMIUM) - class WillPublishCallback : public Noncopyable { + class WillPublishCallback { + WTF_MAKE_NONCOPYABLE(WillPublishCallback); public: + WillPublishCallback() { } virtual ~WillPublishCallback() { } virtual void willPublish() = 0; @@ -106,13 +110,18 @@ private: bool m_packedDepthStencilExtensionSupported; Platform3DObject m_fbo; Platform3DObject m_colorBuffer; + + // This is used when we have OES_packed_depth_stencil. Platform3DObject m_depthStencilBuffer; + // These are used when we don't. + Platform3DObject m_depthBuffer; + Platform3DObject m_stencilBuffer; + // For multisampling Platform3DObject m_multisampleFBO; Platform3DObject m_multisampleColorBuffer; - Platform3DObject m_multisampleDepthStencilBuffer; - + #if PLATFORM(CHROMIUM) OwnPtr<WillPublishCallback> m_callback; OwnPtr<DrawingBufferInternal> m_internal; diff --git a/Source/WebCore/platform/graphics/gpu/LoopBlinnClassifier.h b/Source/WebCore/platform/graphics/gpu/LoopBlinnClassifier.h index c665844..1bd67b8 100644 --- a/Source/WebCore/platform/graphics/gpu/LoopBlinnClassifier.h +++ b/Source/WebCore/platform/graphics/gpu/LoopBlinnClassifier.h @@ -30,14 +30,14 @@ #ifndef LoopBlinnClassifier_h #define LoopBlinnClassifier_h -#include <wtf/Noncopyable.h> namespace WebCore { class FloatPoint; // Classifies cubic curves into specific types. -class LoopBlinnClassifier : public Noncopyable { +class LoopBlinnClassifier { + WTF_MAKE_NONCOPYABLE(LoopBlinnClassifier); public: // The types of cubic curves. enum CurveType { diff --git a/Source/WebCore/platform/graphics/gpu/LoopBlinnLocalTriangulator.h b/Source/WebCore/platform/graphics/gpu/LoopBlinnLocalTriangulator.h index ea3d7e3..d01e6c9 100644 --- a/Source/WebCore/platform/graphics/gpu/LoopBlinnLocalTriangulator.h +++ b/Source/WebCore/platform/graphics/gpu/LoopBlinnLocalTriangulator.h @@ -30,19 +30,20 @@ #include "FloatPoint3D.h" #include "LoopBlinnConstants.h" #include <wtf/Assertions.h> -#include <wtf/Noncopyable.h> namespace WebCore { // Performs a localized triangulation of the triangle mesh // corresponding to the four control point vertices of a cubic curve // segment. -class LoopBlinnLocalTriangulator : public Noncopyable { +class LoopBlinnLocalTriangulator { + WTF_MAKE_NONCOPYABLE(LoopBlinnLocalTriangulator); public: // The vertices that the triangulator operates upon, containing both // the position information as well as the cubic texture // coordinates. - class Vertex : public Noncopyable { + class Vertex { + WTF_MAKE_NONCOPYABLE(Vertex); public: Vertex() { diff --git a/Source/WebCore/platform/graphics/gpu/PODArena.h b/Source/WebCore/platform/graphics/gpu/PODArena.h index f68baef..6edc1db 100644 --- a/Source/WebCore/platform/graphics/gpu/PODArena.h +++ b/Source/WebCore/platform/graphics/gpu/PODArena.h @@ -158,7 +158,8 @@ private: } // Manages a chunk of memory and individual allocations out of it. - class Chunk : public Noncopyable { + class Chunk { + WTF_MAKE_NONCOPYABLE(Chunk); public: // Allocates a block of memory of the given size from the passed // Allocator. diff --git a/Source/WebCore/platform/graphics/gpu/PODIntervalTree.h b/Source/WebCore/platform/graphics/gpu/PODIntervalTree.h index 320ce60..5bf3de0 100644 --- a/Source/WebCore/platform/graphics/gpu/PODIntervalTree.h +++ b/Source/WebCore/platform/graphics/gpu/PODIntervalTree.h @@ -44,8 +44,8 @@ struct ValueToString; // supports efficient (O(lg n)) insertion, removal and querying of // intervals in the tree. template<class T, class UserData = void*> -class PODIntervalTree : public Noncopyable, - public PODRedBlackTree<PODInterval<T, UserData> > { +class PODIntervalTree : public PODRedBlackTree<PODInterval<T, UserData> > { + WTF_MAKE_NONCOPYABLE(PODIntervalTree); public: // Typedef to reduce typing when declaring intervals to be stored in // this tree. diff --git a/Source/WebCore/platform/graphics/gpu/PODRedBlackTree.h b/Source/WebCore/platform/graphics/gpu/PODRedBlackTree.h index 6d5954c..bd08988 100644 --- a/Source/WebCore/platform/graphics/gpu/PODRedBlackTree.h +++ b/Source/WebCore/platform/graphics/gpu/PODRedBlackTree.h @@ -198,7 +198,8 @@ protected: // The base Node class which is stored in the tree. Nodes are only // an internal concept; users of the tree deal only with the data // they store in it. - class Node : public Noncopyable { + class Node { + WTF_MAKE_NONCOPYABLE(Node); public: // Constructor. Newly-created nodes are colored red. explicit Node(const T& data) @@ -659,7 +660,8 @@ private: // Helper class for size() // A Visitor which simply counts the number of visited elements. - class Counter : public Visitor, public Noncopyable { + class Counter : public Visitor { + WTF_MAKE_NONCOPYABLE(Counter); public: Counter() : m_count(0) { } diff --git a/Source/WebCore/platform/graphics/gpu/Shader.h b/Source/WebCore/platform/graphics/gpu/Shader.h index e5bd8de..4f62ca9 100644 --- a/Source/WebCore/platform/graphics/gpu/Shader.h +++ b/Source/WebCore/platform/graphics/gpu/Shader.h @@ -40,7 +40,8 @@ class AffineTransform; class GraphicsContext3D; class Color; -class Shader : public Noncopyable { +class Shader { + WTF_MAKE_NONCOPYABLE(Shader); protected: Shader(GraphicsContext3D*, unsigned program); ~Shader(); diff --git a/Source/WebCore/platform/graphics/gpu/SharedGraphicsContext3D.cpp b/Source/WebCore/platform/graphics/gpu/SharedGraphicsContext3D.cpp index 9d1298f..9c59077 100644 --- a/Source/WebCore/platform/graphics/gpu/SharedGraphicsContext3D.cpp +++ b/Source/WebCore/platform/graphics/gpu/SharedGraphicsContext3D.cpp @@ -51,6 +51,9 @@ namespace WebCore { PassRefPtr<SharedGraphicsContext3D> SharedGraphicsContext3D::create(HostWindow* hostWindow) { GraphicsContext3D::Attributes attr; + attr.depth = false; + attr.stencil = true; + attr.antialias = false; attr.canRecoverFromContextLoss = false; // Canvas contexts can not handle lost contexts. RefPtr<GraphicsContext3D> context = GraphicsContext3D::create(attr, hostWindow); if (!context) @@ -293,6 +296,14 @@ void SharedGraphicsContext3D::applyCompositeOperator(CompositeOperator op) } } +void SharedGraphicsContext3D::enableStencil(bool enable) +{ + if (enable) + m_context->enable(GraphicsContext3D::STENCIL_TEST); + else + m_context->disable(GraphicsContext3D::STENCIL_TEST); +} + void SharedGraphicsContext3D::useQuadVertices() { if (!m_quadVertices) { diff --git a/Source/WebCore/platform/graphics/gpu/SharedGraphicsContext3D.h b/Source/WebCore/platform/graphics/gpu/SharedGraphicsContext3D.h index ea1810d..1e032d7 100644 --- a/Source/WebCore/platform/graphics/gpu/SharedGraphicsContext3D.h +++ b/Source/WebCore/platform/graphics/gpu/SharedGraphicsContext3D.h @@ -90,6 +90,7 @@ public: // Shared logic for canvas 2d void applyCompositeOperator(CompositeOperator); + void enableStencil(bool enable); void useQuadVertices(); void useFillSolidProgram(const AffineTransform&, const Color&); diff --git a/Source/WebCore/platform/graphics/gpu/TilingData.h b/Source/WebCore/platform/graphics/gpu/TilingData.h index 1bdc51a..d1140bd 100644 --- a/Source/WebCore/platform/graphics/gpu/TilingData.h +++ b/Source/WebCore/platform/graphics/gpu/TilingData.h @@ -38,7 +38,8 @@ namespace WebCore { class FloatRect; class IntRect; -class TilingData : public Noncopyable { +class TilingData { + WTF_MAKE_NONCOPYABLE(TilingData); public: TilingData(int maxTextureSize, int totalSizeX, int totalSizeY, bool hasBorderTexels); int maxTextureSize() const { return m_maxTextureSize; } diff --git a/Source/WebCore/platform/graphics/gpu/mac/DrawingBufferMac.mm b/Source/WebCore/platform/graphics/gpu/mac/DrawingBufferMac.mm index 601454e..e6dfdb8 100644 --- a/Source/WebCore/platform/graphics/gpu/mac/DrawingBufferMac.mm +++ b/Source/WebCore/platform/graphics/gpu/mac/DrawingBufferMac.mm @@ -41,15 +41,16 @@ DrawingBuffer::DrawingBuffer(GraphicsContext3D* context, bool multisampleExtensionSupported, bool packedDepthStencilExtensionSupported) : m_context(context) - , m_size(size) + , m_size(-1, -1) , m_multisampleExtensionSupported(multisampleExtensionSupported) , m_packedDepthStencilExtensionSupported(packedDepthStencilExtensionSupported) , m_fbo(context->createFramebuffer()) , m_colorBuffer(0) , m_depthStencilBuffer(0) + , m_depthBuffer(0) + , m_stencilBuffer(0) , m_multisampleFBO(0) , m_multisampleColorBuffer(0) - , m_multisampleDepthStencilBuffer(0) { ASSERT(m_fbo); if (!m_fbo) { diff --git a/Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp b/Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp index e10e61f..36b49df 100644 --- a/Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp +++ b/Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp @@ -36,7 +36,8 @@ using namespace WebCore; -class StreamingClient : public Noncopyable, public ResourceHandleClient { +class StreamingClient : public ResourceHandleClient { + WTF_MAKE_NONCOPYABLE(StreamingClient); public: StreamingClient(WebKitWebSrc*); virtual ~StreamingClient(); diff --git a/Source/WebCore/platform/graphics/gtk/FontGtk.cpp b/Source/WebCore/platform/graphics/gtk/FontGtk.cpp index fdf91db..4d6f509 100644 --- a/Source/WebCore/platform/graphics/gtk/FontGtk.cpp +++ b/Source/WebCore/platform/graphics/gtk/FontGtk.cpp @@ -38,6 +38,7 @@ #include "GraphicsContext.h" #include "NotImplemented.h" #include "SimpleFontData.h" +#include "TextRun.h" #include <cairo.h> #include <gdk/gdk.h> #include <pango/pango.h> diff --git a/Source/WebCore/platform/graphics/haiku/FontCustomPlatformData.h b/Source/WebCore/platform/graphics/haiku/FontCustomPlatformData.h index cc348e3..86f99b2 100644 --- a/Source/WebCore/platform/graphics/haiku/FontCustomPlatformData.h +++ b/Source/WebCore/platform/graphics/haiku/FontCustomPlatformData.h @@ -24,14 +24,14 @@ #include "FontOrientation.h" #include "FontRenderingMode.h" #include <wtf/Forward.h> -#include <wtf/Noncopyable.h> namespace WebCore { class FontPlatformData; class SharedBuffer; - struct FontCustomPlatformData : Noncopyable { + struct FontCustomPlatformData { + WTF_MAKE_NONCOPYABLE(FontCustomPlatformData); public: FontCustomPlatformData() { } ~FontCustomPlatformData(); diff --git a/Source/WebCore/platform/graphics/haiku/ImageBufferHaiku.cpp b/Source/WebCore/platform/graphics/haiku/ImageBufferHaiku.cpp index bdad6a0..7a7c88b 100644 --- a/Source/WebCore/platform/graphics/haiku/ImageBufferHaiku.cpp +++ b/Source/WebCore/platform/graphics/haiku/ImageBufferHaiku.cpp @@ -78,6 +78,11 @@ ImageBuffer::~ImageBuffer() { } +size_t ImageBuffer::dataSize() const +{ + return m_size.width() * m_size.height() * 4; +} + GraphicsContext* ImageBuffer::context() const { ASSERT(m_data.m_view.Window()); diff --git a/Source/WebCore/platform/graphics/mac/ComplexTextController.cpp b/Source/WebCore/platform/graphics/mac/ComplexTextController.cpp index 206fd5f..86f6bec 100644 --- a/Source/WebCore/platform/graphics/mac/ComplexTextController.cpp +++ b/Source/WebCore/platform/graphics/mac/ComplexTextController.cpp @@ -30,6 +30,7 @@ #include "FloatSize.h" #include "Font.h" #include "TextBreakIterator.h" +#include "TextRun.h" #include <wtf/StdLibExtras.h> diff --git a/Source/WebCore/platform/graphics/mac/ComplexTextControllerATSUI.cpp b/Source/WebCore/platform/graphics/mac/ComplexTextControllerATSUI.cpp index c24a914..9c2ab6b 100644 --- a/Source/WebCore/platform/graphics/mac/ComplexTextControllerATSUI.cpp +++ b/Source/WebCore/platform/graphics/mac/ComplexTextControllerATSUI.cpp @@ -28,6 +28,7 @@ #include "CharacterNames.h" #include "Font.h" #include "ShapeArabic.h" +#include "TextRun.h" #ifdef __LP64__ // ATSUTextInserted() is SPI in 64-bit. diff --git a/Source/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.cpp b/Source/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.cpp index 42e7897..07fb153 100644 --- a/Source/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.cpp +++ b/Source/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.cpp @@ -24,6 +24,7 @@ #include "config.h" #include "ComplexTextController.h" +#include "TextRun.h" #include "WebCoreSystemInterface.h" #if USE(CORE_TEXT) diff --git a/Source/WebCore/platform/graphics/mac/FontComplexTextMac.cpp b/Source/WebCore/platform/graphics/mac/FontComplexTextMac.cpp index ca006d9..02bac9c 100644 --- a/Source/WebCore/platform/graphics/mac/FontComplexTextMac.cpp +++ b/Source/WebCore/platform/graphics/mac/FontComplexTextMac.cpp @@ -31,6 +31,7 @@ #include "GraphicsContext.h" #include "IntRect.h" #include "SimpleFontData.h" +#include "TextRun.h" #include <wtf/MathExtras.h> using namespace std; diff --git a/Source/WebCore/platform/graphics/mac/FontCustomPlatformData.h b/Source/WebCore/platform/graphics/mac/FontCustomPlatformData.h index c11858c..7043d7e 100644 --- a/Source/WebCore/platform/graphics/mac/FontCustomPlatformData.h +++ b/Source/WebCore/platform/graphics/mac/FontCustomPlatformData.h @@ -36,7 +36,9 @@ namespace WebCore { class FontPlatformData; class SharedBuffer; -struct FontCustomPlatformData : Noncopyable { +struct FontCustomPlatformData { + WTF_MAKE_NONCOPYABLE(FontCustomPlatformData); +public: FontCustomPlatformData(ATSFontContainerRef container, CGFontRef cgFont) : m_atsContainer(container) , m_cgFont(cgFont) diff --git a/Source/WebCore/platform/graphics/mac/GraphicsContext3DMac.mm b/Source/WebCore/platform/graphics/mac/GraphicsContext3DMac.mm index 321d0ef..21eb59d 100644 --- a/Source/WebCore/platform/graphics/mac/GraphicsContext3DMac.mm +++ b/Source/WebCore/platform/graphics/mac/GraphicsContext3DMac.mm @@ -188,21 +188,15 @@ GraphicsContext3D::GraphicsContext3D(GraphicsContext3D::Attributes attrs, HostWi // ANGLE initialization. - TBuiltInResource ANGLEResources; + ShBuiltInResources ANGLEResources; + ShInitBuiltInResources(&ANGLEResources); - ANGLEResources.MaxVertexAttribs = 0; getIntegerv(GraphicsContext3D::MAX_VERTEX_ATTRIBS, &ANGLEResources.MaxVertexAttribs); - ANGLEResources.MaxVertexUniformVectors = 0; getIntegerv(GraphicsContext3D::MAX_VERTEX_UNIFORM_VECTORS, &ANGLEResources.MaxVertexUniformVectors); - ANGLEResources.MaxVaryingVectors = 0; getIntegerv(GraphicsContext3D::MAX_VARYING_VECTORS, &ANGLEResources.MaxVaryingVectors); - ANGLEResources.MaxVertexTextureImageUnits = 0; getIntegerv(GraphicsContext3D::MAX_VERTEX_TEXTURE_IMAGE_UNITS, &ANGLEResources.MaxVertexTextureImageUnits); - ANGLEResources.MaxCombinedTextureImageUnits = 0; getIntegerv(GraphicsContext3D::MAX_COMBINED_TEXTURE_IMAGE_UNITS, &ANGLEResources.MaxCombinedTextureImageUnits); - ANGLEResources.MaxTextureImageUnits = 0; getIntegerv(GraphicsContext3D::MAX_TEXTURE_IMAGE_UNITS, &ANGLEResources.MaxTextureImageUnits); - ANGLEResources.MaxFragmentUniformVectors = 0; getIntegerv(GraphicsContext3D::MAX_FRAGMENT_UNIFORM_VECTORS, &ANGLEResources.MaxFragmentUniformVectors); // Always set to 1 for OpenGL ES. diff --git a/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGL.cpp b/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGL.cpp index 4215d12..3eb5196 100644 --- a/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGL.cpp +++ b/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGL.cpp @@ -33,13 +33,15 @@ #include <wtf/Vector.h> #if PLATFORM(MAC) +#include "ANGLE/ShaderLang.h" #include <OpenGL/gl.h> #endif namespace WebCore { -Extensions3DOpenGL::Extensions3DOpenGL() +Extensions3DOpenGL::Extensions3DOpenGL(GraphicsContext3D* context) : m_initializedAvailableExtensions(false) + , m_context(context) { } @@ -82,12 +84,28 @@ bool Extensions3DOpenGL::supports(const String& name) if (name == "GL_OES_texture_float" || name == "GL_OES_texture_half_float") return m_availableExtensions.contains("GL_ARB_texture_float"); + // Desktop GL always supports the standard derivative functions + if (name == "GL_OES_standard_derivatives") + return true; + return m_availableExtensions.contains(name); } void Extensions3DOpenGL::ensureEnabled(const String& name) { +#if PLATFORM(MAC) + if (name == "GL_OES_standard_derivatives") { + // Enable support in ANGLE (if not enabled already) + ANGLEWebKitBridge& compiler = m_context->m_compiler; + ShBuiltInResources ANGLEResources = compiler.getResources(); + if (!ANGLEResources.OES_standard_derivatives) { + ANGLEResources.OES_standard_derivatives = 1; + compiler.setResources(ANGLEResources); + } + } +#else ASSERT_UNUSED(name, supports(name)); +#endif } int Extensions3DOpenGL::getGraphicsResetStatusARB() diff --git a/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGL.h b/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGL.h index 59f8180..1941a42 100644 --- a/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGL.h +++ b/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGL.h @@ -48,10 +48,13 @@ public: private: // This class only needs to be instantiated by GraphicsContext3D implementations. friend class GraphicsContext3D; - Extensions3DOpenGL(); + Extensions3DOpenGL(GraphicsContext3D*); bool m_initializedAvailableExtensions; HashSet<String> m_availableExtensions; + + // Weak pointer back to GraphicsContext3D + GraphicsContext3D* m_context; }; } // namespace WebCore diff --git a/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGL.cpp b/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGL.cpp index 221ee11..7c103f3 100644 --- a/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGL.cpp +++ b/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGL.cpp @@ -1467,7 +1467,7 @@ void GraphicsContext3D::synthesizeGLError(GC3Denum error) Extensions3D* GraphicsContext3D::getExtensions() { if (!m_extensions) - m_extensions = adoptPtr(new Extensions3DOpenGL); + m_extensions = adoptPtr(new Extensions3DOpenGL(this)); return m_extensions.get(); } diff --git a/Source/WebCore/platform/graphics/openvg/PainterOpenVG.h b/Source/WebCore/platform/graphics/openvg/PainterOpenVG.h index 32f1fe5..3f1494e 100644 --- a/Source/WebCore/platform/graphics/openvg/PainterOpenVG.h +++ b/Source/WebCore/platform/graphics/openvg/PainterOpenVG.h @@ -41,7 +41,8 @@ class TiledImageOpenVG; struct PlatformPainterState; -class PainterOpenVG : public Noncopyable { +class PainterOpenVG { + WTF_MAKE_NONCOPYABLE(PainterOpenVG); public: friend class SurfaceOpenVG; friend struct PlatformPainterState; diff --git a/Source/WebCore/platform/graphics/openvg/SurfaceOpenVG.h b/Source/WebCore/platform/graphics/openvg/SurfaceOpenVG.h index 46d1646..19d95d8 100644 --- a/Source/WebCore/platform/graphics/openvg/SurfaceOpenVG.h +++ b/Source/WebCore/platform/graphics/openvg/SurfaceOpenVG.h @@ -42,7 +42,8 @@ class IntSize; * of #ifdefs and should make it easy to add different surface/context * implementations than EGL. */ -class SurfaceOpenVG : public Noncopyable { +class SurfaceOpenVG { + WTF_MAKE_NONCOPYABLE(SurfaceOpenVG); public: enum MakeCurrentMode { ApplyPainterStateOnSurfaceSwitch, diff --git a/Source/WebCore/platform/graphics/qt/ContextShadowQt.cpp b/Source/WebCore/platform/graphics/qt/ContextShadowQt.cpp index 834ca62..37d6b44 100644 --- a/Source/WebCore/platform/graphics/qt/ContextShadowQt.cpp +++ b/Source/WebCore/platform/graphics/qt/ContextShadowQt.cpp @@ -72,7 +72,7 @@ QImage* ShadowBuffer::scratchImage(const QSize& size) // keep too many allocated pixels for too long. if (!image.isNull() && (image.width() > width) && (image.height() > height)) if (((2 * width) > image.width()) && ((2 * height) > image.height())) { - image.fill(Qt::transparent); + image.fill(0); return ℑ } @@ -82,7 +82,7 @@ QImage* ShadowBuffer::scratchImage(const QSize& size) height = (1 + (height >> 5)) << 5; image = QImage(width, height, QImage::Format_ARGB32_Premultiplied); - image.fill(Qt::transparent); + image.fill(0); return ℑ } diff --git a/Source/WebCore/platform/graphics/qt/FontCustomPlatformData.h b/Source/WebCore/platform/graphics/qt/FontCustomPlatformData.h index 6c41d47..54fa679 100644 --- a/Source/WebCore/platform/graphics/qt/FontCustomPlatformData.h +++ b/Source/WebCore/platform/graphics/qt/FontCustomPlatformData.h @@ -24,6 +24,7 @@ #include "FontOrientation.h" #include "FontRenderingMode.h" +#include <wtf/FastAllocBase.h> #include <wtf/Forward.h> #include <wtf/Noncopyable.h> @@ -32,7 +33,10 @@ namespace WebCore { class FontPlatformData; class SharedBuffer; -struct FontCustomPlatformData : Noncopyable { +struct FontCustomPlatformData { + WTF_MAKE_NONCOPYABLE(FontCustomPlatformData); WTF_MAKE_FAST_ALLOCATED; +public: + FontCustomPlatformData() { } ~FontCustomPlatformData(); // for use with QFontDatabase::addApplicationFont/removeApplicationFont diff --git a/Source/WebCore/platform/graphics/qt/FontPlatformData.h b/Source/WebCore/platform/graphics/qt/FontPlatformData.h index 1c57e29..f268370 100644 --- a/Source/WebCore/platform/graphics/qt/FontPlatformData.h +++ b/Source/WebCore/platform/graphics/qt/FontPlatformData.h @@ -32,7 +32,8 @@ namespace WebCore { -class FontPlatformDataPrivate : public Noncopyable { +class FontPlatformDataPrivate { + WTF_MAKE_NONCOPYABLE(FontPlatformDataPrivate); WTF_MAKE_FAST_ALLOCATED; public: FontPlatformDataPrivate() : refCount(1) @@ -62,8 +63,10 @@ public: -class FontPlatformData : public FastAllocBase { +class FontPlatformData { + WTF_MAKE_FAST_ALLOCATED; public: + FontPlatformData() { } FontPlatformData(float size, bool bold, bool oblique); FontPlatformData(const FontPlatformData &); FontPlatformData(const FontDescription&, const AtomicString& familyName, int wordSpacing = 0, int letterSpacing = 0); diff --git a/Source/WebCore/platform/graphics/qt/FontQt.cpp b/Source/WebCore/platform/graphics/qt/FontQt.cpp index f1ced2b..778a13f 100644 --- a/Source/WebCore/platform/graphics/qt/FontQt.cpp +++ b/Source/WebCore/platform/graphics/qt/FontQt.cpp @@ -31,6 +31,7 @@ #include "GraphicsContext.h" #include "NotImplemented.h" #include "Pattern.h" +#include "TextRun.h" #include <QBrush> #include <QFontInfo> diff --git a/Source/WebCore/platform/graphics/qt/GraphicsContextQt.cpp b/Source/WebCore/platform/graphics/qt/GraphicsContextQt.cpp index 253cd84..4dabe09 100644 --- a/Source/WebCore/platform/graphics/qt/GraphicsContextQt.cpp +++ b/Source/WebCore/platform/graphics/qt/GraphicsContextQt.cpp @@ -8,7 +8,7 @@ * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies). * Copyright (C) 2008 Dirk Schulze <vbs85@gmx.de> - * Copyright (C) 2010 Sencha, Inc. + * Copyright (C) 2010, 2011 Sencha, Inc. * * All rights reserved. * @@ -174,7 +174,8 @@ static inline Qt::FillRule toQtFillRule(WindRule rule) return Qt::OddEvenFill; } -class GraphicsContextPlatformPrivate : public Noncopyable { +class GraphicsContextPlatformPrivate { + WTF_MAKE_NONCOPYABLE(GraphicsContextPlatformPrivate); WTF_MAKE_FAST_ALLOCATED; public: GraphicsContextPlatformPrivate(QPainter*, const QColor& initialSolidColor); ~GraphicsContextPlatformPrivate(); @@ -505,14 +506,19 @@ void GraphicsContext::fillPath(const Path& path) brush.setTransform(m_state.fillGradient->gradientSpaceTransform()); shadowPainter->setOpacity(static_cast<qreal>(shadow->m_color.alpha()) / 255); shadowPainter->fillPath(platformPath, brush); - } else - shadowPainter->fillPath(platformPath, QColor(shadow->m_color)); + } else { + QColor shadowColor = shadow->m_color; + shadowColor.setAlphaF(shadowColor.alphaF() * p->brush().color().alphaF()); + shadowPainter->fillPath(platformPath, shadowColor); + } shadow->endShadowLayer(this); } } else { QPointF offset = shadow->offset(); p->translate(offset); - p->fillPath(platformPath, QColor(shadow->m_color)); + QColor shadowColor = shadow->m_color; + shadowColor.setAlphaF(shadowColor.alphaF() * p->brush().color().alphaF()); + p->fillPath(platformPath, shadowColor); p->translate(-offset); } } @@ -550,10 +556,12 @@ void GraphicsContext::strokePath(const Path& path) shadow->endShadowLayer(this); } } else { - QPen shadowPen(pen); - shadowPen.setColor(m_data->shadow.m_color); QPointF offset = shadow->offset(); p->translate(offset); + QColor shadowColor = shadow->m_color; + shadowColor.setAlphaF(shadowColor.alphaF() * pen.color().alphaF()); + QPen shadowPen(pen); + shadowPen.setColor(shadowColor); p->strokePath(platformPath, shadowPen); p->translate(-offset); } @@ -983,11 +991,9 @@ void GraphicsContext::clearRect(const FloatRect& rect) QPainter* p = m_data->p(); QPainter::CompositionMode currentCompositionMode = p->compositionMode(); - if (p->paintEngine()->hasFeature(QPaintEngine::PorterDuff)) - p->setCompositionMode(QPainter::CompositionMode_Source); + p->setCompositionMode(QPainter::CompositionMode_Source); p->fillRect(rect, Qt::transparent); - if (p->paintEngine()->hasFeature(QPaintEngine::PorterDuff)) - p->setCompositionMode(currentCompositionMode); + p->setCompositionMode(currentCompositionMode); } void GraphicsContext::strokeRect(const FloatRect& rect, float lineWidth) @@ -1077,12 +1083,7 @@ void GraphicsContext::setPlatformCompositeOperation(CompositeOperator op) if (paintingDisabled()) return; - QPainter* painter = m_data->p(); - - if (!painter->paintEngine()->hasFeature(QPaintEngine::PorterDuff)) - return; - - painter->setCompositionMode(toQtCompositionMode(op)); + m_data->p()->setCompositionMode(toQtCompositionMode(op)); } void GraphicsContext::clip(const Path& path) diff --git a/Source/WebCore/platform/graphics/qt/ImageBufferQt.cpp b/Source/WebCore/platform/graphics/qt/ImageBufferQt.cpp index f56603d..d1567ec 100644 --- a/Source/WebCore/platform/graphics/qt/ImageBufferQt.cpp +++ b/Source/WebCore/platform/graphics/qt/ImageBufferQt.cpp @@ -95,6 +95,11 @@ ImageBuffer::~ImageBuffer() { } +size_t ImageBuffer::dataSize() const +{ + return m_size.width() * m_size.height() * 4; +} + GraphicsContext* ImageBuffer::context() const { ASSERT(m_data.m_painter->isActive()); diff --git a/Source/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.cpp b/Source/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.cpp index be6f732..0a4c0f6 100644 --- a/Source/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.cpp +++ b/Source/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.cpp @@ -20,7 +20,6 @@ #include "config.h" #include "MediaPlayerPrivateQt.h" -#include "FrameLoaderClientQt.h" #include "FrameView.h" #include "GraphicsContext.h" #include "HTMLMediaElement.h" @@ -205,10 +204,10 @@ void MediaPlayerPrivateQt::commitLoad(const String& url) // Grab the frame and network manager Frame* frame = document ? document->frame() : 0; - QNetworkAccessManager* manager = frame ? frame->loader()->networkingContext()->networkAccessManager() : 0; - FrameLoaderClientQt* frameLoader = frame ? static_cast<FrameLoaderClientQt*>(frame->loader()->client()) : 0; + FrameLoader* frameLoader = frame ? frame->loader() : 0; + QNetworkAccessManager* manager = frameLoader ? frameLoader->networkingContext()->networkAccessManager() : 0; - if (document && manager) { + if (manager) { // Set the cookies QtNAMThreadSafeProxy managerProxy(manager); QList<QNetworkCookie> cookies = managerProxy.cookiesForUrl(rUrl); diff --git a/Source/WebCore/platform/graphics/qt/TransparencyLayer.h b/Source/WebCore/platform/graphics/qt/TransparencyLayer.h index 5b2f8b2..ff9ef20 100644 --- a/Source/WebCore/platform/graphics/qt/TransparencyLayer.h +++ b/Source/WebCore/platform/graphics/qt/TransparencyLayer.h @@ -42,7 +42,9 @@ namespace WebCore { -struct TransparencyLayer : FastAllocBase { +struct TransparencyLayer { + WTF_MAKE_FAST_ALLOCATED; +public: TransparencyLayer(const QPainter* p, const QRect &rect, qreal opacity, QPixmap& alphaMask) : pixmap(rect.width(), rect.height()) , opacity(opacity) @@ -59,8 +61,7 @@ struct TransparencyLayer : FastAllocBase { painter.setTransform(p->transform(), true); painter.setOpacity(p->opacity()); painter.setFont(p->font()); - if (painter.paintEngine()->hasFeature(QPaintEngine::PorterDuff)) - painter.setCompositionMode(p->compositionMode()); + painter.setCompositionMode(p->compositionMode()); } TransparencyLayer() diff --git a/Source/WebCore/platform/graphics/skia/FontCustomPlatformData.cpp b/Source/WebCore/platform/graphics/skia/FontCustomPlatformData.cpp index e94c417..0b31dfa 100644 --- a/Source/WebCore/platform/graphics/skia/FontCustomPlatformData.cpp +++ b/Source/WebCore/platform/graphics/skia/FontCustomPlatformData.cpp @@ -35,8 +35,8 @@ #if OS(WINDOWS) #include "Base64.h" -#include "ChromiumBridge.h" #include "OpenTypeUtilities.h" +#include "PlatformBridge.h" #elif OS(LINUX) || OS(FREEBSD) || PLATFORM(BREWMP) #include "SkStream.h" #endif @@ -91,7 +91,7 @@ FontPlatformData FontCustomPlatformData::fontPlatformData(int size, bool bold, b logFont.lfStrikeOut = false; logFont.lfCharSet = DEFAULT_CHARSET; logFont.lfOutPrecision = OUT_TT_ONLY_PRECIS; - logFont.lfQuality = ChromiumBridge::layoutTestMode() ? + logFont.lfQuality = PlatformBridge::layoutTestMode() ? NONANTIALIASED_QUALITY : DEFAULT_QUALITY; // Honor user's desktop settings. logFont.lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE; diff --git a/Source/WebCore/platform/graphics/skia/FontCustomPlatformData.h b/Source/WebCore/platform/graphics/skia/FontCustomPlatformData.h index e51b6b6..4228b40 100644 --- a/Source/WebCore/platform/graphics/skia/FontCustomPlatformData.h +++ b/Source/WebCore/platform/graphics/skia/FontCustomPlatformData.h @@ -49,7 +49,9 @@ namespace WebCore { class FontPlatformData; class SharedBuffer; -struct FontCustomPlatformData : Noncopyable { +struct FontCustomPlatformData { + WTF_MAKE_NONCOPYABLE(FontCustomPlatformData); +public: #if OS(WINDOWS) FontCustomPlatformData(HANDLE fontReference, const String& name) : m_fontReference(fontReference) diff --git a/Source/WebCore/platform/graphics/skia/GraphicsContextPlatformPrivate.h b/Source/WebCore/platform/graphics/skia/GraphicsContextPlatformPrivate.h index 5e12ad6..44835a4 100644 --- a/Source/WebCore/platform/graphics/skia/GraphicsContextPlatformPrivate.h +++ b/Source/WebCore/platform/graphics/skia/GraphicsContextPlatformPrivate.h @@ -31,14 +31,14 @@ #ifndef GraphicsContextPlatformPrivate_h #define GraphicsContextPlatformPrivate_h -#include <wtf/Noncopyable.h> class PlatformContextSkia; namespace WebCore { // This class just holds onto a PlatformContextSkia for GraphicsContext. -class GraphicsContextPlatformPrivate : public Noncopyable { +class GraphicsContextPlatformPrivate { + WTF_MAKE_NONCOPYABLE(GraphicsContextPlatformPrivate); public: GraphicsContextPlatformPrivate(PlatformContextSkia* platformContext) : m_context(platformContext) { } diff --git a/Source/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp b/Source/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp index 51e2477..1a7112b 100644 --- a/Source/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp +++ b/Source/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp @@ -386,6 +386,9 @@ void GraphicsContext::canvasClip(const Path& path) if (paintingDisabled()) return; + if (platformContext()->useGPU()) + platformContext()->gpuCanvas()->clipPath(path); + const SkPath& p = *path.platformPath(); if (!isPathSkiaSafe(getCTM(), p)) return; @@ -410,6 +413,9 @@ void GraphicsContext::clipOut(const Path& p) if (paintingDisabled()) return; + if (platformContext()->useGPU()) + platformContext()->gpuCanvas()->clipOut(p); + const SkPath& path = *p.platformPath(); if (!isPathSkiaSafe(getCTM(), path)) return; @@ -422,6 +428,9 @@ void GraphicsContext::clipPath(const Path& pathToClip, WindRule clipRule) if (paintingDisabled()) return; + if (platformContext()->useGPU()) + platformContext()->gpuCanvas()->clipPath(pathToClip); + // FIXME: Be smarter about this. beginPath(); addPath(pathToClip); @@ -733,6 +742,12 @@ void GraphicsContext::fillPath(const Path& pathToFill) beginPath(); addPath(pathToFill); + if (platformContext()->useGPU() && platformContext()->canAccelerate()) { + platformContext()->prepareForHardwareDraw(); + platformContext()->gpuCanvas()->fillPath(pathToFill); + return; + } + SkPath path = platformContext()->currentPathInLocalCoordinates(); if (!isPathSkiaSafe(getCTM(), path)) return; diff --git a/Source/WebCore/platform/graphics/skia/ImageBufferSkia.cpp b/Source/WebCore/platform/graphics/skia/ImageBufferSkia.cpp index b65b5bd..2c489ef 100644 --- a/Source/WebCore/platform/graphics/skia/ImageBufferSkia.cpp +++ b/Source/WebCore/platform/graphics/skia/ImageBufferSkia.cpp @@ -91,6 +91,11 @@ GraphicsContext* ImageBuffer::context() const return m_context.get(); } +size_t ImageBuffer::dataSize() const +{ + return m_size.width() * m_size.height() * 4; +} + bool ImageBuffer::drawsUsingCopy() const { return false; diff --git a/Source/WebCore/platform/graphics/skia/PlatformContextSkia.cpp b/Source/WebCore/platform/graphics/skia/PlatformContextSkia.cpp index d3c0e00..d852e9b 100644 --- a/Source/WebCore/platform/graphics/skia/PlatformContextSkia.cpp +++ b/Source/WebCore/platform/graphics/skia/PlatformContextSkia.cpp @@ -702,8 +702,7 @@ void PlatformContextSkia::applyAntiAliasedClipPaths(WTF::Vector<SkPath>& paths) bool PlatformContextSkia::canAccelerate() const { return !m_state->m_fillShader // Can't accelerate with a fill gradient or pattern. - && !m_state->m_looper // Can't accelerate with a shadow. - && !m_state->m_canvasClipApplied; // Can't accelerate with a clip to path applied. + && !m_state->m_looper; // Can't accelerate with a shadow. } bool PlatformContextSkia::canvasClipApplied() const @@ -848,7 +847,7 @@ void PlatformContextSkia::uploadSoftwareToHardware(CompositeOperator op) const m_uploadTexture->updateSubRect(bitmap.getPixels(), m_softwareDirtyRect); AffineTransform identity; - gpuCanvas()->drawTexturedRect(m_uploadTexture.get(), m_softwareDirtyRect, m_softwareDirtyRect, identity, 1.0, ColorSpaceDeviceRGB, op); + gpuCanvas()->drawTexturedRect(m_uploadTexture.get(), m_softwareDirtyRect, m_softwareDirtyRect, identity, 1.0, ColorSpaceDeviceRGB, op, false); // Clear out the region of the software canvas we just uploaded. m_canvas->save(); m_canvas->resetMatrix(); diff --git a/Source/WebCore/platform/graphics/skia/PlatformContextSkia.h b/Source/WebCore/platform/graphics/skia/PlatformContextSkia.h index 11b311a..0304486 100644 --- a/Source/WebCore/platform/graphics/skia/PlatformContextSkia.h +++ b/Source/WebCore/platform/graphics/skia/PlatformContextSkia.h @@ -67,7 +67,8 @@ class Texture; // responsible for managing the painting state which is store in separate // SkPaint objects. This class provides the adaptor that allows the painting // state to be pushed and popped along with the bitmap. -class PlatformContextSkia : public Noncopyable { +class PlatformContextSkia { + WTF_MAKE_NONCOPYABLE(PlatformContextSkia); public: // For printing, there shouldn't be any canvas. canvas can be NULL. If you // supply a NULL canvas, you can also call setCanvas later. diff --git a/Source/WebCore/platform/graphics/transforms/AffineTransform.cpp b/Source/WebCore/platform/graphics/transforms/AffineTransform.cpp index f275526..3f88140 100644 --- a/Source/WebCore/platform/graphics/transforms/AffineTransform.cpp +++ b/Source/WebCore/platform/graphics/transforms/AffineTransform.cpp @@ -164,12 +164,10 @@ AffineTransform AffineTransform::inverse() const return result; } -AffineTransform& AffineTransform::multiply(const AffineTransform& other) -{ - return (*this) *= other; -} -AffineTransform& AffineTransform::multLeft(const AffineTransform& other) +// Multiplies this AffineTransform by the provided AffineTransform - i.e. +// this = this * other; +AffineTransform& AffineTransform::multiply(const AffineTransform& other) { AffineTransform trans; @@ -192,7 +190,7 @@ AffineTransform& AffineTransform::rotate(double a) double sinAngle = sin(a); AffineTransform rot(cosAngle, sinAngle, -sinAngle, cosAngle, 0, 0); - multLeft(rot); + multiply(rot); return *this; } diff --git a/Source/WebCore/platform/graphics/transforms/AffineTransform.h b/Source/WebCore/platform/graphics/transforms/AffineTransform.h index baee102..50d0655 100644 --- a/Source/WebCore/platform/graphics/transforms/AffineTransform.h +++ b/Source/WebCore/platform/graphics/transforms/AffineTransform.h @@ -55,7 +55,8 @@ class IntPoint; class IntRect; class TransformationMatrix; -class AffineTransform : public FastAllocBase { +class AffineTransform { + WTF_MAKE_FAST_ALLOCATED; public: typedef double Transform[6]; @@ -95,8 +96,7 @@ public: void makeIdentity(); - AffineTransform& multiply(const AffineTransform&); - AffineTransform& multLeft(const AffineTransform&); + AffineTransform& multiply(const AffineTransform& other); AffineTransform& scale(double); AffineTransform& scale(double sx, double sy); AffineTransform& scaleNonUniform(double sx, double sy); @@ -147,15 +147,14 @@ public: // *this = *this * t (i.e., a multRight) AffineTransform& operator*=(const AffineTransform& t) { - *this = *this * t; - return *this; + return multiply(t); } // result = *this * t (i.e., a multRight) AffineTransform operator*(const AffineTransform& t) const { - AffineTransform result = t; - result.multLeft(*this); + AffineTransform result = *this; + result *= t; return result; } diff --git a/Source/WebCore/platform/graphics/transforms/TransformOperations.h b/Source/WebCore/platform/graphics/transforms/TransformOperations.h index c0da377..981e1f6 100644 --- a/Source/WebCore/platform/graphics/transforms/TransformOperations.h +++ b/Source/WebCore/platform/graphics/transforms/TransformOperations.h @@ -31,7 +31,8 @@ namespace WebCore { -class TransformOperations : public FastAllocBase { +class TransformOperations { + WTF_MAKE_FAST_ALLOCATED; public: TransformOperations(bool makeIdentity = false); diff --git a/Source/WebCore/platform/graphics/transforms/TransformationMatrix.cpp b/Source/WebCore/platform/graphics/transforms/TransformationMatrix.cpp index 10c7f70..357a140 100644 --- a/Source/WebCore/platform/graphics/transforms/TransformationMatrix.cpp +++ b/Source/WebCore/platform/graphics/transforms/TransformationMatrix.cpp @@ -27,6 +27,7 @@ #include "config.h" #include "TransformationMatrix.h" +#include "AffineTransform.h" #include "FloatPoint3D.h" #include "FloatRect.h" #include "FloatQuad.h" diff --git a/Source/WebCore/platform/graphics/transforms/TransformationMatrix.h b/Source/WebCore/platform/graphics/transforms/TransformationMatrix.h index f13bcc1..c883675 100644 --- a/Source/WebCore/platform/graphics/transforms/TransformationMatrix.h +++ b/Source/WebCore/platform/graphics/transforms/TransformationMatrix.h @@ -26,7 +26,6 @@ #ifndef TransformationMatrix_h #define TransformationMatrix_h -#include "AffineTransform.h" #include "FloatPoint.h" #include "IntPoint.h" #include <string.h> //for memcpy @@ -65,7 +64,8 @@ class FloatPoint3D; class FloatRect; class FloatQuad; -class TransformationMatrix : public FastAllocBase { +class TransformationMatrix { + WTF_MAKE_FAST_ALLOCATED; public: typedef double Matrix4[4][4]; diff --git a/Source/WebCore/platform/graphics/win/FontCustomPlatformData.h b/Source/WebCore/platform/graphics/win/FontCustomPlatformData.h index 1bdf270..de33c63 100644 --- a/Source/WebCore/platform/graphics/win/FontCustomPlatformData.h +++ b/Source/WebCore/platform/graphics/win/FontCustomPlatformData.h @@ -34,7 +34,9 @@ namespace WebCore { class FontPlatformData; class SharedBuffer; -struct FontCustomPlatformData : Noncopyable { +struct FontCustomPlatformData { + WTF_MAKE_NONCOPYABLE(FontCustomPlatformData); +public: FontCustomPlatformData(HANDLE fontReference, const String& name) : m_fontReference(fontReference) , m_name(name) diff --git a/Source/WebCore/platform/graphics/win/FontCustomPlatformDataCairo.h b/Source/WebCore/platform/graphics/win/FontCustomPlatformDataCairo.h index 3ab52b8..9c67037 100644 --- a/Source/WebCore/platform/graphics/win/FontCustomPlatformDataCairo.h +++ b/Source/WebCore/platform/graphics/win/FontCustomPlatformDataCairo.h @@ -33,7 +33,9 @@ namespace WebCore { class FontPlatformData; class SharedBuffer; -struct FontCustomPlatformData : Noncopyable { +struct FontCustomPlatformData { + WTF_MAKE_NONCOPYABLE(FontCustomPlatformData); +public: FontCustomPlatformData(cairo_font_face_t* fontFace) : m_fontFace(fontFace) { diff --git a/Source/WebCore/platform/graphics/win/FontWin.cpp b/Source/WebCore/platform/graphics/win/FontWin.cpp index 2170954..2ed9eb3 100644 --- a/Source/WebCore/platform/graphics/win/FontWin.cpp +++ b/Source/WebCore/platform/graphics/win/FontWin.cpp @@ -32,6 +32,7 @@ #include "IntRect.h" #include "Logging.h" #include "SimpleFontData.h" +#include "TextRun.h" #include "UniscribeController.h" #include <wtf/MathExtras.h> diff --git a/Source/WebCore/platform/graphics/win/LocalWindowsContext.h b/Source/WebCore/platform/graphics/win/LocalWindowsContext.h index c216140..5951e49 100644 --- a/Source/WebCore/platform/graphics/win/LocalWindowsContext.h +++ b/Source/WebCore/platform/graphics/win/LocalWindowsContext.h @@ -31,7 +31,8 @@ namespace WebCore { -class LocalWindowsContext : public Noncopyable { +class LocalWindowsContext { + WTF_MAKE_NONCOPYABLE(LocalWindowsContext); public: LocalWindowsContext(GraphicsContext* graphicsContext, const IntRect& rect, bool supportAlphaBlend = true, bool mayCreateBitmap = true) : m_graphicsContext(graphicsContext) diff --git a/Source/WebCore/platform/graphics/win/MediaPlayerPrivateFullscreenWindow.cpp b/Source/WebCore/platform/graphics/win/MediaPlayerPrivateFullscreenWindow.cpp index 7abe2eb..01db7f2 100644 --- a/Source/WebCore/platform/graphics/win/MediaPlayerPrivateFullscreenWindow.cpp +++ b/Source/WebCore/platform/graphics/win/MediaPlayerPrivateFullscreenWindow.cpp @@ -40,7 +40,7 @@ MediaPlayerPrivateFullscreenWindow::MediaPlayerPrivateFullscreenWindow(MediaPlay : m_client(client) , m_hwnd(0) #if USE(ACCELERATED_COMPOSITING) - , m_layerRenderer(WKCACFLayerRenderer::create(0)) + , m_layerTreeHost(CACFLayerTreeHost::create()) #endif { } @@ -81,7 +81,7 @@ void MediaPlayerPrivateFullscreenWindow::createWindow(HWND parentHwnd) ASSERT(IsWindow(m_hwnd)); #if USE(ACCELERATED_COMPOSITING) - m_layerRenderer->setHostWindow(m_hwnd); + m_layerTreeHost->setWindow(m_hwnd); #endif ::SetFocus(m_hwnd); @@ -107,7 +107,7 @@ void MediaPlayerPrivateFullscreenWindow::setRootChildLayer(PassRefPtr<PlatformCA if (!m_rootChild) return; - m_layerRenderer->setRootChildLayer(m_rootChild.get()); + m_layerTreeHost->setRootChildLayer(m_rootChild.get()); PlatformCALayer* rootLayer = m_rootChild->rootLayer(); CGRect rootBounds = m_rootChild->rootLayer()->bounds(); m_rootChild->setFrame(rootBounds); @@ -147,7 +147,7 @@ LRESULT MediaPlayerPrivateFullscreenWindow::wndProc(HWND hWnd, UINT message, WPA case WM_DESTROY: m_hwnd = 0; #if USE(ACCELERATED_COMPOSITING) - m_layerRenderer->setHostWindow(0); + m_layerTreeHost->setWindow(0); #endif break; case WM_WINDOWPOSCHANGED: @@ -156,7 +156,7 @@ LRESULT MediaPlayerPrivateFullscreenWindow::wndProc(HWND hWnd, UINT message, WPA if (wp->flags & SWP_NOSIZE) break; #if USE(ACCELERATED_COMPOSITING) - m_layerRenderer->resize(); + m_layerTreeHost->resize(); PlatformCALayer* rootLayer = m_rootChild->rootLayer(); CGRect rootBounds = m_rootChild->rootLayer()->bounds(); m_rootChild->setFrame(rootBounds); @@ -166,7 +166,7 @@ LRESULT MediaPlayerPrivateFullscreenWindow::wndProc(HWND hWnd, UINT message, WPA break; case WM_PAINT: #if USE(ACCELERATED_COMPOSITING) - m_layerRenderer->paint(); + m_layerTreeHost->paint(); ::ValidateRect(m_hwnd, 0); #endif break; diff --git a/Source/WebCore/platform/graphics/win/MediaPlayerPrivateFullscreenWindow.h b/Source/WebCore/platform/graphics/win/MediaPlayerPrivateFullscreenWindow.h index a18f0cc..c1ae762 100644 --- a/Source/WebCore/platform/graphics/win/MediaPlayerPrivateFullscreenWindow.h +++ b/Source/WebCore/platform/graphics/win/MediaPlayerPrivateFullscreenWindow.h @@ -27,10 +27,9 @@ #define MediaPlayerPrivateFullscreenWindow_h #if USE(ACCELERATED_COMPOSITING) +#include "CACFLayerTreeHost.h" #include "PlatformCALayer.h" -#include "WKCACFLayerRenderer.h" #endif -#include <wtf/OwnPtr.h> typedef unsigned WPARAM; typedef long LPARAM; @@ -59,7 +58,7 @@ public: HWND hwnd() const { return m_hwnd; } #if USE(ACCELERATED_COMPOSITING) - WKCACFLayerRenderer* layerRenderer() const { return m_layerRenderer.get(); } + CACFLayerTreeHost* layerView() const { return m_layerTreeHost.get(); } PlatformCALayer* rootChildLayer() const { return m_rootChild.get(); } void setRootChildLayer(PassRefPtr<PlatformCALayer>); @@ -71,7 +70,7 @@ private: MediaPlayerPrivateFullscreenClient* m_client; #if USE(ACCELERATED_COMPOSITING) - OwnPtr<WKCACFLayerRenderer> m_layerRenderer; + RefPtr<CACFLayerTreeHost> m_layerTreeHost; RefPtr<PlatformCALayer> m_rootChild; #endif HWND m_hwnd; diff --git a/Source/WebCore/platform/graphics/win/QTMovie.cpp b/Source/WebCore/platform/graphics/win/QTMovie.cpp index efaf218..dfa1d36 100644 --- a/Source/WebCore/platform/graphics/win/QTMovie.cpp +++ b/Source/WebCore/platform/graphics/win/QTMovie.cpp @@ -63,7 +63,8 @@ union UppParam { static Vector<CFStringRef>* gSupportedTypes = 0; static SInt32 quickTimeVersion = 0; -class QTMoviePrivate : public Noncopyable, public QTMovieTaskClient { +class QTMoviePrivate : public QTMovieTaskClient { + WTF_MAKE_NONCOPYABLE(QTMoviePrivate); public: QTMoviePrivate(); ~QTMoviePrivate(); diff --git a/Source/WebCore/platform/graphics/win/QTTrack.cpp b/Source/WebCore/platform/graphics/win/QTTrack.cpp index 09142bc..bf80a81 100644 --- a/Source/WebCore/platform/graphics/win/QTTrack.cpp +++ b/Source/WebCore/platform/graphics/win/QTTrack.cpp @@ -31,7 +31,8 @@ using namespace std; -class QTTrackPrivate : public Noncopyable { +class QTTrackPrivate { + WTF_MAKE_NONCOPYABLE(QTTrackPrivate); public: QTTrackPrivate(); ~QTTrackPrivate(); diff --git a/Source/WebCore/platform/graphics/win/UniscribeController.cpp b/Source/WebCore/platform/graphics/win/UniscribeController.cpp index ab32150..dac6c3e 100644 --- a/Source/WebCore/platform/graphics/win/UniscribeController.cpp +++ b/Source/WebCore/platform/graphics/win/UniscribeController.cpp @@ -27,6 +27,7 @@ #include "UniscribeController.h" #include "Font.h" #include "SimpleFontData.h" +#include "TextRun.h" #include <wtf/MathExtras.h> using namespace std; diff --git a/Source/WebCore/platform/graphics/win/WKCACFContextFlusher.cpp b/Source/WebCore/platform/graphics/win/WKCACFContextFlusher.cpp deleted file mode 100644 index d75c854..0000000 --- a/Source/WebCore/platform/graphics/win/WKCACFContextFlusher.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (C) 2009 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``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 USE(ACCELERATED_COMPOSITING) - -#include "WKCACFContextFlusher.h" - -#include <WebKitSystemInterface/WebKitSystemInterface.h> -#include <wtf/StdLibExtras.h> - -namespace WebCore { - -WKCACFContextFlusher& WKCACFContextFlusher::shared() -{ - DEFINE_STATIC_LOCAL(WKCACFContextFlusher, flusher, ()); - return flusher; -} - -WKCACFContextFlusher::WKCACFContextFlusher() -{ -} - -WKCACFContextFlusher::~WKCACFContextFlusher() -{ -} - -void WKCACFContextFlusher::addContext(WKCACFContext* context) -{ - ASSERT(context); - - m_contexts.add(context); -} - -void WKCACFContextFlusher::removeContext(WKCACFContext* context) -{ - ASSERT(context); - - m_contexts.remove(context); -} - -void WKCACFContextFlusher::flushAllContexts() -{ - // addContext might get called beneath CACFContextFlush, and we don't want m_contexts to change while - // we're iterating over it, so we move the contexts into a local ContextSet and iterate over that instead. - ContextSet contextsToFlush; - contextsToFlush.swap(m_contexts); - - ContextSet::const_iterator end = contextsToFlush.end(); - for (ContextSet::const_iterator it = contextsToFlush.begin(); it != end; ++it) - wkCACFContextFlush(*it); -} - -} - -#endif // USE(ACCELERATED_COMPOSITING) diff --git a/Source/WebCore/platform/graphics/wince/FontCustomPlatformData.h b/Source/WebCore/platform/graphics/wince/FontCustomPlatformData.h index abdc0f2..0508246 100644 --- a/Source/WebCore/platform/graphics/wince/FontCustomPlatformData.h +++ b/Source/WebCore/platform/graphics/wince/FontCustomPlatformData.h @@ -37,7 +37,9 @@ namespace WebCore { virtual void unregisterFont(const String& fontName) = 0; }; - struct FontCustomPlatformData : Noncopyable { + struct FontCustomPlatformData { + WTF_MAKE_NONCOPYABLE(FontCustomPlatformData); + public: FontCustomPlatformData(const String& name) : m_name(name) { diff --git a/Source/WebCore/platform/graphics/wince/FontWinCE.cpp b/Source/WebCore/platform/graphics/wince/FontWinCE.cpp index d636517..5a4c8da 100644 --- a/Source/WebCore/platform/graphics/wince/FontWinCE.cpp +++ b/Source/WebCore/platform/graphics/wince/FontWinCE.cpp @@ -38,6 +38,7 @@ #include "GraphicsContext.h" #include "IntRect.h" #include "NotImplemented.h" +#include "TextRun.h" #include "WidthIterator.h" #include <wtf/MathExtras.h> #include <wtf/OwnPtr.h> diff --git a/Source/WebCore/platform/graphics/wince/GraphicsContextWinCE.cpp b/Source/WebCore/platform/graphics/wince/GraphicsContextWinCE.cpp index 2def6ab..9b672d2 100644 --- a/Source/WebCore/platform/graphics/wince/GraphicsContextWinCE.cpp +++ b/Source/WebCore/platform/graphics/wince/GraphicsContextWinCE.cpp @@ -209,7 +209,7 @@ public: void concatCTM(const AffineTransform& transform) { - m_transform = transform * m_transform; + m_transform *= transform; } IntRect mapRect(const IntRect& rect) const @@ -438,7 +438,8 @@ static void rotateBitmap(SharedBitmap* destBmp, const SharedBitmap* sourceBmp, c _rotateBitmap<unsigned, false>(destBmp, sourceBmp, transform); } -class TransparentLayerDC : Noncopyable { +class TransparentLayerDC { + WTF_MAKE_NONCOPYABLE(TransparentLayerDC); public: TransparentLayerDC(GraphicsContextPlatformPrivate* data, IntRect& origRect, const IntRect* rectBeforeTransform = 0, int alpha = 255, bool paintImage = false); ~TransparentLayerDC(); @@ -558,7 +559,8 @@ void TransparentLayerDC::fillAlphaChannel() } } -class ScopeDCProvider : Noncopyable { +class ScopeDCProvider { + WTF_MAKE_NONCOPYABLE(ScopeDCProvider); public: explicit ScopeDCProvider(GraphicsContextPlatformPrivate* data) : m_data(data) diff --git a/Source/WebCore/platform/graphics/wince/ImageBufferData.h b/Source/WebCore/platform/graphics/wince/ImageBufferData.h index 01b7d06..cbd49dc 100644 --- a/Source/WebCore/platform/graphics/wince/ImageBufferData.h +++ b/Source/WebCore/platform/graphics/wince/ImageBufferData.h @@ -20,15 +20,18 @@ #ifndef ImageBufferData_h #define ImageBufferData_h +#include "SharedBitmap.h" + namespace WebCore { - class IntSize; - class ImageBufferData { - public: - ImageBufferData(const IntSize& size); - RefPtr<SharedBitmap> m_bitmap; - }; +class IntSize; + +class ImageBufferData { +public: + ImageBufferData(const IntSize&); + RefPtr<SharedBitmap> m_bitmap; +}; -} // namespace WebCore +} // namespace WebCore -#endif // ImageBufferData_h +#endif // ImageBufferData_h diff --git a/Source/WebCore/platform/graphics/wince/ImageBufferWinCE.cpp b/Source/WebCore/platform/graphics/wince/ImageBufferWinCE.cpp index 537d27d..b5118f6 100644 --- a/Source/WebCore/platform/graphics/wince/ImageBufferWinCE.cpp +++ b/Source/WebCore/platform/graphics/wince/ImageBufferWinCE.cpp @@ -88,6 +88,11 @@ ImageBuffer::~ImageBuffer() { } +size_t ImageBuffer::dataSize() const +{ + return m_size.width() * m_size.height() * 4; +} + GraphicsContext* ImageBuffer::context() const { return m_context.get(); diff --git a/Source/WebCore/platform/graphics/wince/SharedBitmap.cpp b/Source/WebCore/platform/graphics/wince/SharedBitmap.cpp index 05d1535..168a5e2 100644 --- a/Source/WebCore/platform/graphics/wince/SharedBitmap.cpp +++ b/Source/WebCore/platform/graphics/wince/SharedBitmap.cpp @@ -445,8 +445,7 @@ void SharedBitmap::drawPattern(HDC hdc, const AffineTransform& transform, const bmpHeight = tileRect.height(); } - AffineTransform tf = transform; - tf *= patternTransform; + AffineTransform tf = patternTransform * transform; FloatRect trRect = tf.mapRect(destRect); diff --git a/Source/WebCore/platform/graphics/wx/FontCustomPlatformData.h b/Source/WebCore/platform/graphics/wx/FontCustomPlatformData.h index cc348e3..86f99b2 100644 --- a/Source/WebCore/platform/graphics/wx/FontCustomPlatformData.h +++ b/Source/WebCore/platform/graphics/wx/FontCustomPlatformData.h @@ -24,14 +24,14 @@ #include "FontOrientation.h" #include "FontRenderingMode.h" #include <wtf/Forward.h> -#include <wtf/Noncopyable.h> namespace WebCore { class FontPlatformData; class SharedBuffer; - struct FontCustomPlatformData : Noncopyable { + struct FontCustomPlatformData { + WTF_MAKE_NONCOPYABLE(FontCustomPlatformData); public: FontCustomPlatformData() { } ~FontCustomPlatformData(); diff --git a/Source/WebCore/platform/graphics/wx/ImageBufferWx.cpp b/Source/WebCore/platform/graphics/wx/ImageBufferWx.cpp index ba33287..b603a60 100644 --- a/Source/WebCore/platform/graphics/wx/ImageBufferWx.cpp +++ b/Source/WebCore/platform/graphics/wx/ImageBufferWx.cpp @@ -48,6 +48,12 @@ ImageBuffer::~ImageBuffer() { } +size_t ImageBuffer::dataSize() const +{ + notImplemented(); + return 0; +} + GraphicsContext* ImageBuffer::context() const { notImplemented(); diff --git a/Source/WebCore/platform/gtk/ClipboardGtk.h b/Source/WebCore/platform/gtk/ClipboardGtk.h index e14a583..0c07c07 100644 --- a/Source/WebCore/platform/gtk/ClipboardGtk.h +++ b/Source/WebCore/platform/gtk/ClipboardGtk.h @@ -39,6 +39,7 @@ namespace WebCore { // State available during IE's events for drag and drop and copy/paste // Created from the EventHandlerGtk to be used by the dom class ClipboardGtk : public Clipboard, public CachedResourceClient { + WTF_MAKE_FAST_ALLOCATED; public: static PassRefPtr<ClipboardGtk> create(ClipboardAccessPolicy policy, GtkClipboard* clipboard, Frame* frame) { diff --git a/Source/WebCore/platform/gtk/DragDataGtk.cpp b/Source/WebCore/platform/gtk/DragDataGtk.cpp index 3a1daf1..cc9a208 100644 --- a/Source/WebCore/platform/gtk/DragDataGtk.cpp +++ b/Source/WebCore/platform/gtk/DragDataGtk.cpp @@ -66,13 +66,21 @@ bool DragData::containsCompatibleContent() const return containsPlainText() || containsURL(0) || m_platformDragData->hasMarkup() || containsColor() || containsFiles(); } -bool DragData::containsURL(Frame*, FilenameConversionPolicy filenamePolicy) const +bool DragData::containsURL(Frame* frame, FilenameConversionPolicy filenamePolicy) const { - return m_platformDragData->hasURL(); + return !asURL(frame, filenamePolicy).isEmpty(); } String DragData::asURL(Frame*, FilenameConversionPolicy filenamePolicy, String* title) const { + if (!m_platformDragData->hasURL()) + return String(); + if (filenamePolicy != ConvertFilenames) { + KURL url(KURL(), m_platformDragData->url()); + if (url.isLocalFile()) + return String(); + } + String url(m_platformDragData->url()); if (title) *title = m_platformDragData->urlLabel(); diff --git a/Source/WebCore/platform/gtk/KeyEventGtk.cpp b/Source/WebCore/platform/gtk/KeyEventGtk.cpp index 50dfa4c..5a034d6 100644 --- a/Source/WebCore/platform/gtk/KeyEventGtk.cpp +++ b/Source/WebCore/platform/gtk/KeyEventGtk.cpp @@ -583,8 +583,7 @@ void PlatformKeyboardEvent::disambiguateKeyDownEvent(Type type, bool backwardCom bool PlatformKeyboardEvent::currentCapsLockState() { - notImplemented(); - return false; + return gdk_keymap_get_caps_lock_state(gdk_keymap_get_default()); } void PlatformKeyboardEvent::getCurrentModifierState(bool& shiftKey, bool& ctrlKey, bool& altKey, bool& metaKey) diff --git a/Source/WebCore/platform/gtk/MainFrameScrollbarGtk.cpp b/Source/WebCore/platform/gtk/MainFrameScrollbarGtk.cpp index c2e24e0..d1571a5 100644 --- a/Source/WebCore/platform/gtk/MainFrameScrollbarGtk.cpp +++ b/Source/WebCore/platform/gtk/MainFrameScrollbarGtk.cpp @@ -25,13 +25,14 @@ #include "GraphicsContext.h" #include "GtkVersioning.h" #include "IntRect.h" +#include "ScrollableArea.h" #include <gtk/gtk.h> using namespace WebCore; -PassRefPtr<MainFrameScrollbarGtk> MainFrameScrollbarGtk::create(ScrollbarClient* client, ScrollbarOrientation orientation, GtkAdjustment* adj) +PassRefPtr<MainFrameScrollbarGtk> MainFrameScrollbarGtk::create(ScrollableArea* scrollableArea, ScrollbarOrientation orientation, GtkAdjustment* adj) { - return adoptRef(new MainFrameScrollbarGtk(client, orientation, adj)); + return adoptRef(new MainFrameScrollbarGtk(scrollableArea, orientation, adj)); } // Main frame scrollbars are slaves to a GtkAdjustment. If a main frame @@ -41,8 +42,8 @@ PassRefPtr<MainFrameScrollbarGtk> MainFrameScrollbarGtk::create(ScrollbarClient* // state. These scrollbars are never painted, as the container takes care of // that. They exist only to shuttle data from the GtkWidget container into // WebCore and vice-versa. -MainFrameScrollbarGtk::MainFrameScrollbarGtk(ScrollbarClient* client, ScrollbarOrientation orientation, GtkAdjustment* adjustment) - : Scrollbar(client, orientation, RegularScrollbar) +MainFrameScrollbarGtk::MainFrameScrollbarGtk(ScrollableArea* scrollableArea, ScrollbarOrientation orientation, GtkAdjustment* adjustment) + : Scrollbar(scrollableArea, orientation, RegularScrollbar) , m_adjustment(0) { attachAdjustment(adjustment); @@ -108,7 +109,7 @@ void MainFrameScrollbarGtk::updateThumbProportion() void MainFrameScrollbarGtk::gtkValueChanged(GtkAdjustment*, MainFrameScrollbarGtk* that) { - that->setValue(static_cast<int>(gtk_adjustment_get_value(that->m_adjustment.get())), NotFromScrollAnimator); + that->scrollableArea()->scrollToOffsetWithoutAnimation(that->orientation(), static_cast<int>(gtk_adjustment_get_value(that->m_adjustment.get()))); } void MainFrameScrollbarGtk::paint(GraphicsContext* context, const IntRect& rect) diff --git a/Source/WebCore/platform/gtk/MainFrameScrollbarGtk.h b/Source/WebCore/platform/gtk/MainFrameScrollbarGtk.h index f184425..f104f81 100644 --- a/Source/WebCore/platform/gtk/MainFrameScrollbarGtk.h +++ b/Source/WebCore/platform/gtk/MainFrameScrollbarGtk.h @@ -30,18 +30,19 @@ namespace WebCore { class MainFrameScrollbarGtk : public Scrollbar { public: + static PassRefPtr<MainFrameScrollbarGtk> create(ScrollableArea*, ScrollbarOrientation, GtkAdjustment*); + ~MainFrameScrollbarGtk(); virtual void paint(GraphicsContext*, const IntRect&); void detachAdjustment(); void attachAdjustment(GtkAdjustment*); - static PassRefPtr<MainFrameScrollbarGtk> create(ScrollbarClient*, ScrollbarOrientation, GtkAdjustment*); protected: virtual void updateThumbPosition(); virtual void updateThumbProportion(); private: - MainFrameScrollbarGtk(ScrollbarClient*, ScrollbarOrientation, GtkAdjustment*); + MainFrameScrollbarGtk(ScrollableArea*, ScrollbarOrientation, GtkAdjustment*); static void gtkValueChanged(GtkAdjustment*, MainFrameScrollbarGtk*); GRefPtr<GtkAdjustment> m_adjustment; diff --git a/Source/WebCore/platform/gtk/RenderThemeGtk.cpp b/Source/WebCore/platform/gtk/RenderThemeGtk.cpp index 97c966d..bfe3901 100644 --- a/Source/WebCore/platform/gtk/RenderThemeGtk.cpp +++ b/Source/WebCore/platform/gtk/RenderThemeGtk.cpp @@ -41,6 +41,10 @@ #include <gdk/gdk.h> #include <gtk/gtk.h> +#if ENABLE(PROGRESS_TAG) +#include "RenderProgress.h" +#endif + namespace WebCore { using namespace HTMLNames; @@ -305,6 +309,24 @@ bool RenderThemeGtk::paintSearchField(RenderObject* o, const PaintInfo& i, const return paintTextField(o, i, rect); } +bool RenderThemeGtk::paintCapsLockIndicator(RenderObject* renderObject, const PaintInfo& paintInfo, const IntRect& rect) +{ + // The other paint methods don't need to check whether painting is disabled because RenderTheme already checks it + // before calling them, but paintCapsLockIndicator() is called by RenderTextControlSingleLine which doesn't check it. + if (paintInfo.context->paintingDisabled()) + return true; + + GRefPtr<GdkPixbuf> icon = getStockIcon(GTK_TYPE_ENTRY, GTK_STOCK_CAPS_LOCK_WARNING, + gtkTextDirection(renderObject->style()->direction()), + gtkIconState(this, renderObject), GTK_ICON_SIZE_MENU); + + // GTK+ locates the icon right aligned in the entry. The given rectangle is already + // centered vertically by RenderTextControlSingleLine. + IntPoint iconPosition(rect.x() + rect.width() - gdk_pixbuf_get_width(icon.get()), rect.y()); + paintGdkPixbuf(paintInfo.context, icon.get(), iconPosition); + return true; +} + void RenderThemeGtk::adjustSliderTrackStyle(CSSStyleSelector*, RenderStyle* style, Element*) const { style->setBoxShadow(0); @@ -330,7 +352,7 @@ double RenderThemeGtk::caretBlinkInterval() const return time / 2000.; } -static double getScreenDPI() +double RenderThemeGtk::getScreenDPI() { // FIXME: Really this should be the widget's screen. GdkScreen* screen = gdk_screen_get_default(); @@ -543,6 +565,50 @@ void RenderThemeGtk::adjustProgressBarStyle(CSSStyleSelector*, RenderStyle* styl { style->setBoxShadow(0); } + +// These values have been copied from RenderThemeChromiumSkia.cpp +static const int progressActivityBlocks = 5; +static const int progressAnimationFrames = 10; +static const double progressAnimationInterval = 0.125; +double RenderThemeGtk::animationRepeatIntervalForProgressBar(RenderProgress*) const +{ + return progressAnimationInterval; +} + +double RenderThemeGtk::animationDurationForProgressBar(RenderProgress*) const +{ + return progressAnimationInterval * progressAnimationFrames * 2; // "2" for back and forth; +} + +IntRect RenderThemeGtk::calculateProgressRect(RenderObject* renderObject, const IntRect& fullBarRect) +{ + IntRect progressRect(fullBarRect); + RenderProgress* renderProgress = toRenderProgress(renderObject); + if (renderProgress->isDeterminate()) { + int progressWidth = progressRect.width() * renderProgress->position(); + if (renderObject->style()->direction() == RTL) + progressRect.setX(progressRect.x() + progressRect.width() - progressWidth); + progressRect.setWidth(progressWidth); + return progressRect; + } + + double animationProgress = renderProgress->animationProgress(); + + // Never let the progress rect shrink smaller than 2 pixels. + int newWidth = max(2, progressRect.width() / progressActivityBlocks); + int movableWidth = progressRect.width() - newWidth; + progressRect.setWidth(newWidth); + + // We want the first 0.5 units of the animation progress to represent the + // forward motion and the second 0.5 units to represent the backward motion, + // thus we multiply by two here to get the full sweep of the progress bar with + // each direction. + if (animationProgress < 0.5) + progressRect.setX(progressRect.x() + (animationProgress * 2 * movableWidth)); + else + progressRect.setX(progressRect.x() + ((1.0 - animationProgress) * 2 * movableWidth)); + return progressRect; +} #endif } diff --git a/Source/WebCore/platform/gtk/RenderThemeGtk.h b/Source/WebCore/platform/gtk/RenderThemeGtk.h index 90113e5..5765782 100644 --- a/Source/WebCore/platform/gtk/RenderThemeGtk.h +++ b/Source/WebCore/platform/gtk/RenderThemeGtk.h @@ -169,13 +169,21 @@ protected: virtual bool paintProgressBar(RenderObject*, const PaintInfo&, const IntRect&); #endif + virtual bool paintCapsLockIndicator(RenderObject*, const PaintInfo&, const IntRect&); + private: void platformInit(); + static void setTextInputBorders(RenderStyle*); + GRefPtr<GdkPixbuf> getStockIcon(GType, const char* iconName, gint direction, gint state, gint iconSize); + static double getScreenDPI(); + #if ENABLE(VIDEO) bool paintMediaButton(RenderObject*, GraphicsContext*, const IntRect&, const char* iconName); #endif - static void setTextInputBorders(RenderStyle*); - GRefPtr<GdkPixbuf> getStockIcon(GType, const char* iconName, gint direction, gint state, gint iconSize); + +#if ENABLE(PROGRESS_TAG) + static IntRect calculateProgressRect(RenderObject*, const IntRect&); +#endif mutable Color m_panelColor; mutable Color m_sliderColor; @@ -188,13 +196,26 @@ private: #ifdef GTK_API_VERSION_2 void setupWidgetAndAddToContainer(GtkWidget*, GtkWidget*) const; bool paintRenderObject(GtkThemeWidgetType, RenderObject*, GraphicsContext*, const IntRect&, int flags = 0); + void refreshComboBoxChildren() const; + void getComboBoxPadding(RenderStyle*, int& left, int& top, int& right, int& bottom) const; + int getComboBoxSeparatorWidth() const; + int comboBoxArrowSize(RenderStyle*) const; GtkThemeParts m_themeParts; + GtkWidget* gtkButton() const; GtkWidget* gtkEntry() const; GtkWidget* gtkTreeView() const; GtkWidget* gtkVScale() const; GtkWidget* gtkHScale() const; GtkWidget* gtkContainer() const; + GtkWidget* gtkRadioButton() const; + GtkWidget* gtkCheckButton() const; + GtkWidget* gtkProgressBar() const; + GtkWidget* gtkComboBox() const; + GtkWidget* gtkComboBoxButton() const; + GtkWidget* gtkComboBoxArrow() const; + GtkWidget* gtkComboBoxSeparator() const; + mutable GtkWidget* m_gtkWindow; mutable GtkWidget* m_gtkContainer; mutable GtkWidget* m_gtkButton; @@ -202,6 +223,13 @@ private: mutable GtkWidget* m_gtkTreeView; mutable GtkWidget* m_gtkVScale; mutable GtkWidget* m_gtkHScale; + mutable GtkWidget* m_gtkRadioButton; + mutable GtkWidget* m_gtkCheckButton; + mutable GtkWidget* m_gtkProgressBar; + mutable GtkWidget* m_gtkComboBox; + mutable GtkWidget* m_gtkComboBoxButton; + mutable GtkWidget* m_gtkComboBoxArrow; + mutable GtkWidget* m_gtkComboBoxSeparator; bool m_themePartsHaveRGBAColormap; friend class WidgetRenderingContext; #endif diff --git a/Source/WebCore/platform/gtk/RenderThemeGtk2.cpp b/Source/WebCore/platform/gtk/RenderThemeGtk2.cpp index e01508e..de4195d 100644 --- a/Source/WebCore/platform/gtk/RenderThemeGtk2.cpp +++ b/Source/WebCore/platform/gtk/RenderThemeGtk2.cpp @@ -27,6 +27,10 @@ #ifdef GTK_API_VERSION_2 +// We need this to allow building while using GTK_WIDGET_SET_FLAGS. It's deprecated +// but some theme engines require it to ensure proper rendering of focus indicators. +#undef GTK_DISABLE_DEPRECATED + #include "CSSValueKeywords.h" #include "GraphicsContext.h" #include "GtkVersioning.h" @@ -41,10 +45,6 @@ #include <gdk/gdk.h> #include <gtk/gtk.h> -#if ENABLE(PROGRESS_TAG) -#include "RenderProgress.h" -#endif - namespace WebCore { // This is not a static method, because we want to avoid having GTK+ headers in RenderThemeGtk.h. @@ -61,6 +61,13 @@ void RenderThemeGtk::platformInit() m_gtkTreeView = 0; m_gtkVScale = 0; m_gtkHScale = 0; + m_gtkRadioButton = 0; + m_gtkCheckButton = 0; + m_gtkProgressBar = 0; + m_gtkComboBox = 0; + m_gtkComboBoxButton = 0; + m_gtkComboBoxArrow = 0; + m_gtkComboBoxSeparator = 0; memset(&m_themeParts, 0, sizeof(GtkThemeParts)); GdkColormap* colormap = gdk_screen_get_rgba_colormap(gdk_screen_get_default()); @@ -99,8 +106,34 @@ void RenderThemeGtk::initMediaColors() } #endif -void RenderThemeGtk::adjustRepaintRect(const RenderObject*, IntRect&) +static void adjustRectForFocus(GtkWidget* widget, IntRect& rect, bool ignoreInteriorFocusProperty = false) +{ + gint focusWidth, focusPad; + gboolean interiorFocus = 0; + gtk_widget_style_get(widget, + "interior-focus", &interiorFocus, + "focus-line-width", &focusWidth, + "focus-padding", &focusPad, NULL); + if (!ignoreInteriorFocusProperty && interiorFocus) + return; + rect.inflate(focusWidth + focusPad); +} + +void RenderThemeGtk::adjustRepaintRect(const RenderObject* renderObject, IntRect& rect) { + ControlPart part = renderObject->style()->appearance(); + switch (part) { + case CheckboxPart: + case RadioPart: { + // We ignore the interior focus property and always expand the focus rect. In GTK+, the + // focus indicator is usually on the text next to a checkbox or radio button, but that doesn't + // happen in WebCore. By expanding the focus rectangle unconditionally we increase its prominence. + adjustRectForFocus(part == CheckboxPart ? gtkCheckButton() : gtkRadioButton(), rect, true); + return; + } + default: + return; + } } static GtkStateType getGtkStateType(RenderThemeGtk* theme, RenderObject* object) @@ -142,56 +175,89 @@ bool RenderThemeGtk::paintRenderObject(GtkThemeWidgetType type, RenderObject* re gtkTextDirection(renderObject->style()->direction())); } -void RenderThemeGtk::getIndicatorMetrics(ControlPart part, int& indicatorSize, int& indicatorSpacing) +static void setToggleSize(const RenderThemeGtk* theme, RenderStyle* style, GtkWidget* widget) { - ASSERT(part == CheckboxPart || part == RadioPart); - if (part == CheckboxPart) { - moz_gtk_checkbox_get_metrics(&indicatorSize, &indicatorSpacing); + // The width and height are both specified, so we shouldn't change them. + if (!style->width().isIntrinsicOrAuto() && !style->height().isAuto()) return; - } - // RadioPart - moz_gtk_radio_get_metrics(&indicatorSize, &indicatorSpacing); + gint indicatorSize; + gtk_widget_style_get(widget, "indicator-size", &indicatorSize, NULL); + if (style->width().isIntrinsicOrAuto()) + style->setWidth(Length(indicatorSize, Fixed)); + if (style->height().isAuto()) + style->setHeight(Length(indicatorSize, Fixed)); } -static void setToggleSize(const RenderThemeGtk* theme, RenderStyle* style, ControlPart appearance) +static void paintToggle(RenderThemeGtk* theme, RenderObject* renderObject, const PaintInfo& info, const IntRect& rect, GtkWidget* widget) { - // The width and height are both specified, so we shouldn't change them. - if (!style->width().isIntrinsicOrAuto() && !style->height().isAuto()) - return; + // We do not call gtk_toggle_button_set_active here, because some themes begin a series of + // animation frames in a "toggled" signal handler. This puts some checkboxes in a half-way + // checked state. Every GTK+ theme I tested merely looks at the shadow type (and not the + // 'active' property) to determine whether or not to draw the check. + gtk_widget_set_sensitive(widget, theme->isEnabled(renderObject) && !theme->isReadOnlyControl(renderObject)); + gtk_widget_set_direction(widget, gtkTextDirection(renderObject->style()->direction())); - // FIXME: This is probably not correct use of indicatorSize and indicatorSpacing. - gint indicatorSize, indicatorSpacing; - RenderThemeGtk::getIndicatorMetrics(appearance, indicatorSize, indicatorSpacing); + bool indeterminate = theme->isIndeterminate(renderObject); + gtk_toggle_button_set_inconsistent(GTK_TOGGLE_BUTTON(widget), indeterminate); - // Other ports hard-code this to 13, but GTK+ users tend to demand the native look. - // It could be made a configuration option values other than 13 actually break site compatibility. - int length = indicatorSize + indicatorSpacing; - if (style->width().isIntrinsicOrAuto()) - style->setWidth(Length(length, Fixed)); + GtkShadowType shadowType = GTK_SHADOW_OUT; + if (indeterminate) // This originates from the Mozilla code. + shadowType = GTK_SHADOW_ETCHED_IN; + else if (theme->isChecked(renderObject)) + shadowType = GTK_SHADOW_IN; - if (style->height().isAuto()) - style->setHeight(Length(length, Fixed)); + WidgetRenderingContext widgetContext(info.context, rect); + IntRect buttonRect(IntPoint(), rect.size()); + GtkStateType toggleState = getGtkStateType(theme, renderObject); + const char* detail = 0; + if (GTK_IS_RADIO_BUTTON(widget)) { + detail = "radiobutton"; + widgetContext.gtkPaintOption(buttonRect, widget, toggleState, shadowType, detail); + } else { + detail = "checkbutton"; + widgetContext.gtkPaintCheck(buttonRect, widget, toggleState, shadowType, detail); + } + + if (theme->isFocused(renderObject)) { + IntRect focusRect(buttonRect); + adjustRectForFocus(widget, focusRect, true); + widgetContext.gtkPaintFocus(focusRect, widget, toggleState, detail); + } } void RenderThemeGtk::setCheckboxSize(RenderStyle* style) const { - setToggleSize(this, style, RadioPart); + setToggleSize(this, style, gtkCheckButton()); } -bool RenderThemeGtk::paintCheckbox(RenderObject* object, const PaintInfo& info, const IntRect& rect) +bool RenderThemeGtk::paintCheckbox(RenderObject* renderObject, const PaintInfo& info, const IntRect& rect) { - return paintRenderObject(MOZ_GTK_CHECKBUTTON, object, info.context, rect, isChecked(object)); + paintToggle(this, renderObject, info, rect, gtkCheckButton()); + return false; } void RenderThemeGtk::setRadioSize(RenderStyle* style) const { - setToggleSize(this, style, RadioPart); + setToggleSize(this, style, gtkRadioButton()); +} + +bool RenderThemeGtk::paintRadio(RenderObject* renderObject, const PaintInfo& info, const IntRect& rect) +{ + paintToggle(this, renderObject, info, rect, gtkRadioButton()); + return false; } -bool RenderThemeGtk::paintRadio(RenderObject* object, const PaintInfo& info, const IntRect& rect) +static void setWidgetHasFocus(GtkWidget* widget, gboolean hasFocus) { - return paintRenderObject(MOZ_GTK_RADIOBUTTON, object, info.context, rect, isChecked(object)); + g_object_set(widget, "has-focus", hasFocus, NULL); + + // These functions are deprecated in GTK+ 2.22, yet theme engines still look + // at these flags when determining if a widget has focus, so we must use them. + if (hasFocus) + GTK_WIDGET_SET_FLAGS(widget, GTK_HAS_FOCUS); + else + GTK_WIDGET_UNSET_FLAGS(widget, GTK_HAS_FOCUS); } bool RenderThemeGtk::paintButton(RenderObject* object, const PaintInfo& info, const IntRect& rect) @@ -208,12 +274,7 @@ bool RenderThemeGtk::paintButton(RenderObject* object, const PaintInfo& info, co gtk_widget_set_direction(widget, gtkTextDirection(object->style()->direction())); if (isFocused(object)) { - if (isEnabled(object)) { -#if !GTK_CHECK_VERSION(2, 22, 0) - GTK_WIDGET_SET_FLAGS(widget, GTK_HAS_FOCUS); -#endif - g_object_set(widget, "has-focus", TRUE, NULL); - } + setWidgetHasFocus(widget, TRUE); gboolean interiorFocus = 0, focusWidth = 0, focusPadding = 0; gtk_widget_style_get(widget, @@ -239,21 +300,74 @@ bool RenderThemeGtk::paintButton(RenderObject* object, const PaintInfo& info, co if (isFocused(object)) widgetContext.gtkPaintFocus(focusRect, widget, state, "button"); -#if !GTK_CHECK_VERSION(2, 22, 0) - GTK_WIDGET_UNSET_FLAGS(widget, GTK_HAS_FOCUS); -#endif - g_object_set(widget, "has-focus", FALSE, NULL); + setWidgetHasFocus(widget, FALSE); return false; } -static void getComboBoxPadding(RenderStyle* style, int& left, int& top, int& right, int& bottom) +int RenderThemeGtk::getComboBoxSeparatorWidth() const +{ + GtkWidget* separator = gtkComboBoxSeparator(); + if (!separator) + return 0; + + gboolean hasWideSeparators = FALSE; + gint separatorWidth = 0; + gtk_widget_style_get(separator, + "wide-separators", &hasWideSeparators, + "separator-width", &separatorWidth, + NULL); + if (hasWideSeparators) + return separatorWidth; + return gtk_widget_get_style(separator)->xthickness; +} + +int RenderThemeGtk::comboBoxArrowSize(RenderStyle* style) const +{ + // Taking the font size and reversing the DPI conversion seems to match + // GTK+ rendering as closely as possible. + return style->font().size() * (72.0 / RenderThemeGtk::getScreenDPI()); +} + +static void getButtonInnerBorder(GtkWidget* button, int& left, int& top, int& right, int& bottom) +{ + GtkStyle* style = gtk_widget_get_style(button); + int outerBorder = gtk_container_get_border_width(GTK_CONTAINER(button)); + static GtkBorder defaultInnerBorder = {1, 1, 1, 1}; + GtkBorder* innerBorder; + gtk_widget_style_get(button, "inner-border", &innerBorder, NULL); + if (!innerBorder) + innerBorder = &defaultInnerBorder; + + left = outerBorder + innerBorder->left + style->xthickness; + right = outerBorder + innerBorder->right + style->xthickness; + top = outerBorder + innerBorder->top + style->ythickness; + bottom = outerBorder + innerBorder->bottom + style->ythickness; + + if (innerBorder != &defaultInnerBorder) + gtk_border_free(innerBorder); +} + + +void RenderThemeGtk::getComboBoxPadding(RenderStyle* style, int& left, int& top, int& right, int& bottom) const { // If this menu list button isn't drawn using the native theme, we // don't add any extra padding beyond what WebCore already uses. if (style->appearance() == NoControlPart) return; - moz_gtk_get_widget_border(MOZ_GTK_DROPDOWN, &left, &top, &right, &bottom, - gtkTextDirection(style->direction()), TRUE); + + // A combo box button is a button with widgets packed into it. + GtkStyle* buttonWidgetStyle = gtk_widget_get_style(gtkComboBoxButton()); + getButtonInnerBorder(gtkComboBoxButton(), left, top, right, bottom); + + // Add xthickness amount of padding for each side of the separator. This ensures + // that the text does not bump up against the separator. + int arrowAndSeperatorLength = comboBoxArrowSize(style) + + getComboBoxSeparatorWidth() + (3 * buttonWidgetStyle->xthickness); + + if (style->direction() == RTL) + left += arrowAndSeperatorLength; + else + right += arrowAndSeperatorLength; } int RenderThemeGtk::popupInternalPaddingLeft(RenderStyle* style) const @@ -286,12 +400,102 @@ int RenderThemeGtk::popupInternalPaddingBottom(RenderStyle* style) const bool RenderThemeGtk::paintMenuList(RenderObject* object, const PaintInfo& info, const IntRect& rect) { - return paintRenderObject(MOZ_GTK_DROPDOWN, object, info.context, rect); + if (paintButton(object, info, rect)) + return true; + + // Menu list button painting strategy. + // For buttons with appears-as-list set to false (having a separator): + // | left border | Button text | xthickness | vseparator | xthickness | arrow | xthickness | right border | + // For buttons with appears-as-list set to true (not having a separator): + // | left border | Button text | arrow | xthickness | right border | + + int leftBorder = 0, rightBorder = 0, bottomBorder = 0, topBorder = 0; + getButtonInnerBorder(gtkComboBoxButton(), leftBorder, topBorder, rightBorder, bottomBorder); + RenderStyle* style = object->style(); + int arrowSize = comboBoxArrowSize(style); + GtkStyle* buttonStyle = gtk_widget_get_style(gtkComboBoxButton()); + + IntRect arrowRect(0, (rect.height() - arrowSize) / 2, arrowSize, arrowSize); + if (style->direction() == RTL) + arrowRect.setX(leftBorder + buttonStyle->xthickness); + else + arrowRect.setX(rect.width() - rightBorder - buttonStyle->xthickness - arrowSize); + GtkShadowType shadowType = isPressed(object) ? GTK_SHADOW_IN : GTK_SHADOW_OUT; + + WidgetRenderingContext widgetContext(info.context, rect); + GtkStateType stateType = getGtkStateType(this, object); + widgetContext.gtkPaintArrow(arrowRect, gtkComboBoxArrow(), stateType, shadowType, GTK_ARROW_DOWN, "arrow"); + + // Some combo boxes do not have a separator. + GtkWidget* separator = gtkComboBoxSeparator(); + if (!separator) + return false; + + // We want to decrease the height of the separator based on the focus padding of the button. + gint focusPadding = 0, focusWidth = 0; + gtk_widget_style_get(gtkComboBoxButton(), + "focus-line-width", &focusWidth, + "focus-padding", &focusPadding, NULL); + topBorder += focusPadding + focusWidth; + bottomBorder += focusPadding + focusWidth; + int separatorWidth = getComboBoxSeparatorWidth(); + IntRect separatorRect(0, topBorder, separatorWidth, rect.height() - topBorder - bottomBorder); + if (style->direction() == RTL) + separatorRect.setX(arrowRect.x() + arrowRect.width() + buttonStyle->xthickness + separatorWidth); + else + separatorRect.setX(arrowRect.x() - buttonStyle->xthickness - separatorWidth); + + gboolean hasWideSeparators = FALSE; + gtk_widget_style_get(separator, "wide-separators", &hasWideSeparators, NULL); + if (hasWideSeparators) + widgetContext.gtkPaintBox(separatorRect, separator, GTK_STATE_NORMAL, GTK_SHADOW_ETCHED_OUT, "vseparator"); + else + widgetContext.gtkPaintVLine(separatorRect, separator, GTK_STATE_NORMAL, "vseparator"); + + return false; } -bool RenderThemeGtk::paintTextField(RenderObject* object, const PaintInfo& info, const IntRect& rect) +bool RenderThemeGtk::paintTextField(RenderObject* renderObject, const PaintInfo& info, const IntRect& rect) { - return paintRenderObject(MOZ_GTK_ENTRY, object, info.context, rect); + GtkWidget* widget = gtkEntry(); + + bool enabled = isEnabled(renderObject) && !isReadOnlyControl(renderObject); + GtkStateType backgroundState = enabled ? GTK_STATE_NORMAL : GTK_STATE_INSENSITIVE; + gtk_widget_set_sensitive(widget, enabled); + gtk_widget_set_direction(widget, gtkTextDirection(renderObject->style()->direction())); + setWidgetHasFocus(widget, isFocused(renderObject)); + + WidgetRenderingContext widgetContext(info.context, rect); + IntRect textFieldRect(IntPoint(), rect.size()); + + // The entry background is only painted over the interior part of the GTK+ entry, not + // the entire frame. This happens in the Mozilla theme drawing code as well. + IntRect interiorRect(textFieldRect); + GtkStyle* style = gtk_widget_get_style(widget); + interiorRect.inflateX(-style->xthickness); + interiorRect.inflateY(-style->ythickness); + widgetContext.gtkPaintFlatBox(interiorRect, widget, backgroundState, GTK_SHADOW_NONE, "entry_bg"); + + // This is responsible for drawing the actual frame. + widgetContext.gtkPaintShadow(textFieldRect, widget, GTK_STATE_NORMAL, GTK_SHADOW_IN, "entry"); + + gboolean interiorFocus; + gint focusWidth; + gtk_widget_style_get(widget, + "interior-focus", &interiorFocus, + "focus-line-width", &focusWidth, NULL); + if (isFocused(renderObject) && !interiorFocus) { + // When GTK+ paints a text entry with focus, it shrinks the size of the frame area by the + // focus width and paints over the previously unfocused text entry. We need to emulate that + // by drawing both the unfocused frame above and the focused frame here. + IntRect shadowRect(textFieldRect); + shadowRect.inflate(-focusWidth); + widgetContext.gtkPaintShadow(shadowRect, widget, GTK_STATE_NORMAL, GTK_SHADOW_IN, "entry"); + + widgetContext.gtkPaintFocus(textFieldRect, widget, GTK_STATE_NORMAL, "entry"); + } + + return false; } bool RenderThemeGtk::paintSliderTrack(RenderObject* object, const PaintInfo& info, const IntRect& rect) @@ -382,45 +586,25 @@ void RenderThemeGtk::adjustSliderThumbSize(RenderObject* o) const } #if ENABLE(PROGRESS_TAG) -double RenderThemeGtk::animationRepeatIntervalForProgressBar(RenderProgress*) const -{ - // FIXME: It doesn't look like there is a good way yet to support animated - // progress bars with the Mozilla theme drawing code. - return 0; -} - -double RenderThemeGtk::animationDurationForProgressBar(RenderProgress*) const -{ - // FIXME: It doesn't look like there is a good way yet to support animated - // progress bars with the Mozilla theme drawing code. - return 0; -} - bool RenderThemeGtk::paintProgressBar(RenderObject* renderObject, const PaintInfo& paintInfo, const IntRect& rect) { - if (!renderObject->isProgress()) - return true; + GtkWidget* widget = gtkProgressBar(); + gtk_widget_set_direction(widget, gtkTextDirection(renderObject->style()->direction())); - GtkWidget* progressBarWidget = moz_gtk_get_progress_widget(); - if (!progressBarWidget) - return true; + WidgetRenderingContext widgetContext(paintInfo.context, rect); + IntRect fullProgressBarRect(IntPoint(), rect.size()); + widgetContext.gtkPaintBox(fullProgressBarRect, widget, GTK_STATE_NORMAL, GTK_SHADOW_IN, "trough"); - if (paintRenderObject(MOZ_GTK_PROGRESSBAR, renderObject, paintInfo.context, rect)) - return true; + GtkStyle* style = gtk_widget_get_style(widget); + IntRect progressRect(fullProgressBarRect); + progressRect.inflateX(-style->xthickness); + progressRect.inflateY(-style->ythickness); + progressRect = RenderThemeGtk::calculateProgressRect(renderObject, progressRect); - IntRect chunkRect(rect); - RenderProgress* renderProgress = toRenderProgress(renderObject); + if (!progressRect.isEmpty()) + widgetContext.gtkPaintBox(progressRect, widget, GTK_STATE_PRELIGHT, GTK_SHADOW_OUT, "bar"); - GtkStyle* style = gtk_widget_get_style(progressBarWidget); - chunkRect.setHeight(chunkRect.height() - (2 * style->ythickness)); - chunkRect.setY(chunkRect.y() + style->ythickness); - chunkRect.setWidth((chunkRect.width() - (2 * style->xthickness)) * renderProgress->position()); - if (renderObject->style()->direction() == RTL) - chunkRect.setX(rect.x() + rect.width() - chunkRect.width() - style->xthickness); - else - chunkRect.setX(chunkRect.x() + style->xthickness); - - return paintRenderObject(MOZ_GTK_PROGRESS_CHUNK, renderObject, paintInfo.context, chunkRect); + return false; } #endif @@ -503,11 +687,16 @@ static void gtkStyleSetCallback(GtkWidget* widget, GtkStyle* previous, RenderThe renderTheme->platformColorsDidChange(); } -void RenderThemeGtk::setupWidgetAndAddToContainer(GtkWidget* widget, GtkWidget* window) const +static void setupWidget(GtkWidget* widget) { - gtk_container_add(GTK_CONTAINER(window), widget); gtk_widget_realize(widget); g_object_set_data(G_OBJECT(widget), "transparent-bg-hint", GINT_TO_POINTER(TRUE)); +} + +void RenderThemeGtk::setupWidgetAndAddToContainer(GtkWidget* widget, GtkWidget* window) const +{ + gtk_container_add(GTK_CONTAINER(window), widget); + setupWidget(widget); // FIXME: Perhaps this should only be called for the containing window or parent container. g_signal_connect(widget, "style-set", G_CALLBACK(gtkStyleSetCallback), const_cast<RenderThemeGtk*>(this)); @@ -520,7 +709,7 @@ GtkWidget* RenderThemeGtk::gtkContainer() const m_gtkWindow = gtk_window_new(GTK_WINDOW_POPUP); gtk_widget_set_colormap(m_gtkWindow, m_themeParts.colormap); - gtk_widget_realize(m_gtkWindow); + setupWidget(m_gtkWindow); gtk_widget_set_name(m_gtkWindow, "MozillaGtkWidget"); m_gtkContainer = gtk_fixed_new(); @@ -573,6 +762,126 @@ GtkWidget* RenderThemeGtk::gtkHScale() const return m_gtkHScale; } +GtkWidget* RenderThemeGtk::gtkRadioButton() const +{ + if (m_gtkRadioButton) + return m_gtkRadioButton; + m_gtkRadioButton = gtk_radio_button_new(0); + setupWidgetAndAddToContainer(m_gtkRadioButton, gtkContainer()); + return m_gtkRadioButton; +} + +GtkWidget* RenderThemeGtk::gtkCheckButton() const +{ + if (m_gtkCheckButton) + return m_gtkCheckButton; + m_gtkCheckButton = gtk_check_button_new(); + setupWidgetAndAddToContainer(m_gtkCheckButton, gtkContainer()); + return m_gtkCheckButton; +} + +GtkWidget* RenderThemeGtk::gtkProgressBar() const +{ + if (m_gtkProgressBar) + return m_gtkProgressBar; + m_gtkProgressBar = gtk_progress_bar_new(); + setupWidgetAndAddToContainer(m_gtkProgressBar, gtkContainer()); + return m_gtkProgressBar; +} + +static void getGtkComboBoxButton(GtkWidget* widget, gpointer target) +{ + if (!GTK_IS_TOGGLE_BUTTON(widget)) + return; + GtkWidget** widgetTarget = static_cast<GtkWidget**>(target); + *widgetTarget = widget; +} + +typedef struct { + GtkWidget* arrow; + GtkWidget* separator; +} ComboBoxWidgetPieces; + +static void getGtkComboBoxPieces(GtkWidget* widget, gpointer data) +{ + if (GTK_IS_ARROW(widget)) { + static_cast<ComboBoxWidgetPieces*>(data)->arrow = widget; + return; + } + if (GTK_IS_SEPARATOR(widget)) + static_cast<ComboBoxWidgetPieces*>(data)->separator = widget; +} + +GtkWidget* RenderThemeGtk::gtkComboBox() const +{ + if (m_gtkComboBox) + return m_gtkComboBox; + m_gtkComboBox = gtk_combo_box_new(); + setupWidgetAndAddToContainer(m_gtkComboBox, gtkContainer()); + return m_gtkComboBox; +} + +void RenderThemeGtk::refreshComboBoxChildren() const +{ + gtkComboBox(); // Ensure that we've initialized the combo box. + + // Some themes look at widget ancestry to determine how to render widgets, so + // get the GtkButton that is the actual child of the combo box. + gtk_container_forall(GTK_CONTAINER(m_gtkComboBox), getGtkComboBoxButton, &m_gtkComboBoxButton); + ASSERT(m_gtkComboBoxButton); + setupWidget(m_gtkComboBoxButton); + g_object_add_weak_pointer(G_OBJECT(m_gtkComboBoxButton), reinterpret_cast<gpointer*>(&m_gtkComboBoxButton)); + + ComboBoxWidgetPieces pieces = { 0, 0 }; + GtkWidget* buttonChild = gtk_bin_get_child(GTK_BIN(gtkComboBoxButton())); + if (GTK_IS_HBOX(buttonChild)) + gtk_container_forall(GTK_CONTAINER(buttonChild), getGtkComboBoxPieces, &pieces); + else if (GTK_IS_ARROW(buttonChild)) + pieces.arrow = buttonChild; + + ASSERT(pieces.arrow); + m_gtkComboBoxArrow = pieces.arrow; + setupWidget(m_gtkComboBoxArrow); + // When the style changes, the combo box may destroy its children. + g_object_add_weak_pointer(G_OBJECT(m_gtkComboBoxArrow), reinterpret_cast<gpointer*>(&m_gtkComboBoxArrow)); + + m_gtkComboBoxSeparator = pieces.separator; + if (m_gtkComboBoxSeparator) { + setupWidget(m_gtkComboBoxSeparator); + // When the style changes, the combo box may destroy its children. + g_object_add_weak_pointer(G_OBJECT(m_gtkComboBoxSeparator), reinterpret_cast<gpointer*>(&m_gtkComboBoxSeparator)); + } +} + +GtkWidget* RenderThemeGtk::gtkComboBoxButton() const +{ + if (m_gtkComboBoxButton) + return m_gtkComboBoxButton; + refreshComboBoxChildren(); + ASSERT(m_gtkComboBoxButton); + return m_gtkComboBoxButton; +} + +GtkWidget* RenderThemeGtk::gtkComboBoxArrow() const +{ + if (m_gtkComboBoxArrow) + return m_gtkComboBoxArrow; + refreshComboBoxChildren(); + ASSERT(m_gtkComboBoxArrow); + return m_gtkComboBoxArrow; +} + +GtkWidget* RenderThemeGtk::gtkComboBoxSeparator() const +{ + // m_gtkComboBoxSeparator may be null either because we haven't initialized the combo box + // or because the combo boxes in this theme don't have separators. If m_gtkComboBoxArrow + // arrow isn't null, we definitely have initialized the combo box. + if (m_gtkComboBoxArrow || m_gtkComboBoxButton) + return m_gtkComboBoxSeparator; + refreshComboBoxChildren(); + return m_gtkComboBoxSeparator; +} + GtkWidget* RenderThemeGtk::gtkScrollbar() { return moz_gtk_get_scrollbar_widget(); diff --git a/Source/WebCore/platform/gtk/RenderThemeGtk3.cpp b/Source/WebCore/platform/gtk/RenderThemeGtk3.cpp index 212e29d..1a9f445 100644 --- a/Source/WebCore/platform/gtk/RenderThemeGtk3.cpp +++ b/Source/WebCore/platform/gtk/RenderThemeGtk3.cpp @@ -41,10 +41,6 @@ #include <gdk/gdk.h> #include <gtk/gtk.h> -#if ENABLE(PROGRESS_TAG) -#include "RenderProgress.h" -#endif - namespace WebCore { // This is the default value defined by GTK+, where it was defined as MIN_ARROW_SIZE in gtkarrow.c. @@ -690,20 +686,6 @@ void RenderThemeGtk::adjustSliderThumbSize(RenderObject* renderObject) const } #if ENABLE(PROGRESS_TAG) -// These values have been copied from RenderThemeChromiumSkia.cpp -static const int progressActivityBlocks = 5; -static const int progressAnimationFrames = 10; -static const double progressAnimationInterval = 0.125; -double RenderThemeGtk::animationRepeatIntervalForProgressBar(RenderProgress*) const -{ - return progressAnimationInterval; -} - -double RenderThemeGtk::animationDurationForProgressBar(RenderProgress*) const -{ - return progressAnimationInterval * progressAnimationFrames * 2; // "2" for back and forth; -} - bool RenderThemeGtk::paintProgressBar(RenderObject* renderObject, const PaintInfo& paintInfo, const IntRect& rect) { if (!renderObject->isProgress()) @@ -722,34 +704,18 @@ bool RenderThemeGtk::paintProgressBar(RenderObject* renderObject, const PaintInf gtk_style_context_save(context); gtk_style_context_add_class(context, GTK_STYLE_CLASS_PROGRESSBAR); - RenderProgress* renderProgress = toRenderProgress(renderObject); GtkBorder padding; gtk_style_context_get_padding(context, static_cast<GtkStateFlags>(0), &padding); IntRect progressRect(rect.x() + padding.left, rect.y() + padding.top, rect.width() - (padding.left + padding.right), rect.height() - (padding.top + padding.bottom)); - - if (renderProgress->isDeterminate()) { - progressRect.setWidth(progressRect.width() * renderProgress->position()); - if (renderObject->style()->direction() == RTL) - progressRect.setX(rect.x() + rect.width() - progressRect.width() - padding.right); - } else { - double animationProgress = renderProgress->animationProgress(); - - progressRect.setWidth(max(2, progressRect.width() / progressActivityBlocks)); - int movableWidth = rect.width() - progressRect.width(); - if (animationProgress < 0.5) - progressRect.setX(progressRect.x() + (animationProgress * 2 * movableWidth)); - else - progressRect.setX(progressRect.x() + ((1.0 - animationProgress) * 2 * movableWidth)); - } + progressRect = RenderThemeGtk::calculateProgressRect(renderObject, progressRect); if (!progressRect.isEmpty()) gtk_render_activity(context, paintInfo.context->platformContext(), progressRect.x(), progressRect.y(), progressRect.width(), progressRect.height()); gtk_style_context_restore(context); - return false; } #endif diff --git a/Source/WebCore/platform/gtk/WidgetRenderingContext.cpp b/Source/WebCore/platform/gtk/WidgetRenderingContext.cpp index 6d1be31..51b32ea 100644 --- a/Source/WebCore/platform/gtk/WidgetRenderingContext.cpp +++ b/Source/WebCore/platform/gtk/WidgetRenderingContext.cpp @@ -65,21 +65,6 @@ static void scheduleScratchBufferPurge() purgeScratchBufferTimer.startOneShot(2); } -static IntSize getExtraSpaceForWidget(RenderThemeGtk* theme) -{ - // Checkboxes and scrollbar thumbs often draw outside their boundaries. Here we figure out - // the maximum amount of space we need for any type of widget and use that to increase the - // size of the scratch buffer, while preserving the final widget position. - - // The checkbox extra space is calculated by looking at the widget style. - int indicatorSize, indicatorSpacing; - theme->getIndicatorMetrics(CheckboxPart, indicatorSize, indicatorSpacing); - IntSize extraSpace(indicatorSpacing, indicatorSpacing); - - // Scrollbar thumbs need at least an extra pixel along their movement axis. - return extraSpace.expandedTo(IntSize(1, 1)); -} - WidgetRenderingContext::WidgetRenderingContext(GraphicsContext* graphicsContext, const IntRect& targetRect) : m_graphicsContext(graphicsContext) , m_targetRect(targetRect) @@ -96,8 +81,9 @@ WidgetRenderingContext::WidgetRenderingContext(GraphicsContext* graphicsContext, return; } - // Some widgets render outside their rectangles. We need to account for this. - m_extraSpace = getExtraSpaceForWidget(theme); + // Widgets sometimes need to draw outside their boundaries for things such as + // exterior focus. We want to allocate a some extra pixels in our surface for this. + m_extraSpace = IntSize(15, 15); // Offset the target rectangle so that the extra space is within the boundaries of the scratch buffer. m_paintRect = IntRect(IntPoint(m_extraSpace.width(), m_extraSpace.height()), @@ -173,10 +159,17 @@ void WidgetRenderingContext::gtkPaintBox(const IntRect& rect, GtkWidget* widget, widget, detail, paintRect.x, paintRect.y, paintRect.width, paintRect.height); } +void WidgetRenderingContext::gtkPaintFlatBox(const IntRect& rect, GtkWidget* widget, GtkStateType stateType, GtkShadowType shadowType, const gchar* detail) +{ + GdkRectangle paintRect = { m_paintRect.x + rect.x(), m_paintRect.y + rect.y(), rect.width(), rect.height() }; + gtk_paint_flat_box(gtk_widget_get_style(widget), m_target, stateType, shadowType, &paintRect, + widget, detail, paintRect.x, paintRect.y, paintRect.width, paintRect.height); +} + void WidgetRenderingContext::gtkPaintFocus(const IntRect& rect, GtkWidget* widget, GtkStateType stateType, const gchar* detail) { GdkRectangle paintRect = { m_paintRect.x + rect.x(), m_paintRect.y + rect.y(), rect.width(), rect.height() }; - gtk_paint_focus(gtk_widget_get_style(widget), m_target, stateType, &m_paintRect, widget, + gtk_paint_focus(gtk_widget_get_style(widget), m_target, stateType, &paintRect, widget, detail, paintRect.x, paintRect.y, paintRect.width, paintRect.height); } @@ -187,6 +180,42 @@ void WidgetRenderingContext::gtkPaintSlider(const IntRect& rect, GtkWidget* widg detail, paintRect.x, paintRect.y, paintRect.width, paintRect.height, orientation); } +void WidgetRenderingContext::gtkPaintCheck(const IntRect& rect, GtkWidget* widget, GtkStateType stateType, GtkShadowType shadowType, const gchar* detail) +{ + GdkRectangle paintRect = { m_paintRect.x + rect.x(), m_paintRect.y + rect.y(), rect.width(), rect.height() }; + gtk_paint_check(gtk_widget_get_style(widget), m_target, stateType, shadowType, &paintRect, widget, + detail, paintRect.x, paintRect.y, paintRect.width, paintRect.height); +} + +void WidgetRenderingContext::gtkPaintOption(const IntRect& rect, GtkWidget* widget, GtkStateType stateType, GtkShadowType shadowType, const gchar* detail) +{ + GdkRectangle paintRect = { m_paintRect.x + rect.x(), m_paintRect.y + rect.y(), rect.width(), rect.height() }; + gtk_paint_option(gtk_widget_get_style(widget), m_target, stateType, shadowType, &paintRect, widget, + detail, paintRect.x, paintRect.y, paintRect.width, paintRect.height); +} + +void WidgetRenderingContext::gtkPaintShadow(const IntRect& rect, GtkWidget* widget, GtkStateType stateType, GtkShadowType shadowType, const gchar* detail) +{ + GdkRectangle paintRect = { m_paintRect.x + rect.x(), m_paintRect.y + rect.y(), rect.width(), rect.height() }; + gtk_paint_shadow(gtk_widget_get_style(widget), m_target, stateType, shadowType, &paintRect, widget, + detail, paintRect.x, paintRect.y, paintRect.width, paintRect.height); +} + +void WidgetRenderingContext::gtkPaintArrow(const IntRect& rect, GtkWidget* widget, GtkStateType stateType, GtkShadowType shadowType, int arrowDirection, const gchar* detail) +{ + GdkRectangle paintRect = { m_paintRect.x + rect.x(), m_paintRect.y + rect.y(), rect.width(), rect.height() }; + gtk_paint_arrow(gtk_widget_get_style(widget), m_target, stateType, shadowType, &paintRect, widget, detail, + static_cast<GtkArrowType>(arrowDirection), TRUE, paintRect.x, paintRect.y, paintRect.width, paintRect.height); +} + +void WidgetRenderingContext::gtkPaintVLine(const IntRect& rect, GtkWidget* widget, GtkStateType stateType, const gchar* detail) +{ + GdkRectangle paintRect = { m_paintRect.x + rect.x(), m_paintRect.y + rect.y(), rect.width(), rect.height() }; + gtk_paint_vline(gtk_widget_get_style(widget), m_target, stateType, &paintRect, widget, detail, + paintRect.y, paintRect.y + paintRect.height, paintRect.x); + +} + } #endif // GTK_API_VERSION_2 diff --git a/Source/WebCore/platform/gtk/WidgetRenderingContext.h b/Source/WebCore/platform/gtk/WidgetRenderingContext.h index 8b2a0e2..e248f04 100644 --- a/Source/WebCore/platform/gtk/WidgetRenderingContext.h +++ b/Source/WebCore/platform/gtk/WidgetRenderingContext.h @@ -39,8 +39,14 @@ public: bool paintMozillaWidget(GtkThemeWidgetType, GtkWidgetState*, int flags, GtkTextDirection = GTK_TEXT_DIR_NONE); void gtkPaintBox(const IntRect&, GtkWidget*, GtkStateType, GtkShadowType, const gchar*); + void gtkPaintFlatBox(const IntRect&, GtkWidget*, GtkStateType, GtkShadowType, const gchar*); void gtkPaintFocus(const IntRect&, GtkWidget*, GtkStateType, const gchar*); void gtkPaintSlider(const IntRect&, GtkWidget*, GtkStateType, GtkShadowType, const gchar*, GtkOrientation); + void gtkPaintCheck(const IntRect&, GtkWidget*, GtkStateType, GtkShadowType, const gchar*); + void gtkPaintOption(const IntRect&, GtkWidget*, GtkStateType, GtkShadowType, const gchar*); + void gtkPaintShadow(const IntRect&, GtkWidget*, GtkStateType, GtkShadowType, const gchar*); + void gtkPaintArrow(const IntRect&, GtkWidget*, GtkStateType, GtkShadowType, int arrowDirection, const gchar*); + void gtkPaintVLine(const IntRect&, GtkWidget*, GtkStateType, const gchar*); private: GraphicsContext* m_graphicsContext; diff --git a/Source/WebCore/platform/gtk/gtk2drawing.c b/Source/WebCore/platform/gtk/gtk2drawing.c index 3ebd332..3979b7f 100644 --- a/Source/WebCore/platform/gtk/gtk2drawing.c +++ b/Source/WebCore/platform/gtk/gtk2drawing.c @@ -60,7 +60,6 @@ static GtkThemeParts *gParts = NULL; static style_prop_t style_prop_func; -static gboolean have_arrow_scaling; static gboolean is_initialized; void @@ -116,61 +115,6 @@ setup_widget_prototype(GtkWidget* widget) } static gint -ensure_button_widget() -{ - if (!gParts->buttonWidget) { - gParts->buttonWidget = gtk_button_new_with_label("M"); - setup_widget_prototype(gParts->buttonWidget); - } - return MOZ_GTK_SUCCESS; -} - -static gint -ensure_toggle_button_widget() -{ - if (!gParts->toggleButtonWidget) { - gParts->toggleButtonWidget = gtk_toggle_button_new(); - setup_widget_prototype(gParts->toggleButtonWidget); - /* toggle button must be set active to get the right style on hover. */ - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(gParts->toggleButtonWidget), TRUE); - } - return MOZ_GTK_SUCCESS; -} - -static gint -ensure_button_arrow_widget() -{ - if (!gParts->buttonArrowWidget) { - ensure_toggle_button_widget(); - - gParts->buttonArrowWidget = gtk_arrow_new(GTK_ARROW_DOWN, GTK_SHADOW_OUT); - gtk_container_add(GTK_CONTAINER(gParts->toggleButtonWidget), gParts->buttonArrowWidget); - gtk_widget_realize(gParts->buttonArrowWidget); - } - return MOZ_GTK_SUCCESS; -} - -static gint -ensure_checkbox_widget() -{ - if (!gParts->checkboxWidget) { - gParts->checkboxWidget = gtk_check_button_new_with_label("M"); - setup_widget_prototype(gParts->checkboxWidget); - } - return MOZ_GTK_SUCCESS; -} - -static gint -ensure_radiobutton_widget() -{ - if (!gParts->radiobuttonWidget) { - gParts->radiobuttonWidget = gtk_radio_button_new_with_label(NULL, "M"); - setup_widget_prototype(gParts->radiobuttonWidget); - } - return MOZ_GTK_SUCCESS; -} - -static gint ensure_scrollbar_widget() { if (!gParts->vertScrollbarWidget) { @@ -185,129 +129,6 @@ ensure_scrollbar_widget() } static gint -ensure_entry_widget() -{ - if (!gParts->entryWidget) { - gParts->entryWidget = gtk_entry_new(); - setup_widget_prototype(gParts->entryWidget); - } - return MOZ_GTK_SUCCESS; -} - -/* We need to have pointers to the inner widgets (button, separator, arrow) - * of the ComboBox to get the correct rendering from theme engines which - * special cases their look. Since the inner layout can change, we ask GTK - * to NULL our pointers when they are about to become invalid because the - * corresponding widgets don't exist anymore. It's the role of - * g_object_add_weak_pointer(). - * Note that if we don't find the inner widgets (which shouldn't happen), we - * fallback to use generic "non-inner" widgets, and they don't need that kind - * of weak pointer since they are explicit children of gParts->protoWindow and as - * such GTK holds a strong reference to them. */ -static void -moz_gtk_get_combo_box_inner_button(GtkWidget *widget, gpointer client_data) -{ - if (GTK_IS_TOGGLE_BUTTON(widget)) { - gParts->comboBoxButtonWidget = widget; - g_object_add_weak_pointer(G_OBJECT(widget), - (gpointer) &gParts->comboBoxButtonWidget); - gtk_widget_realize(widget); - g_object_set_data(G_OBJECT(widget), "transparent-bg-hint", GINT_TO_POINTER(TRUE)); - } -} - -static void -moz_gtk_get_combo_box_button_inner_widgets(GtkWidget *widget, - gpointer client_data) -{ - if (GTK_IS_SEPARATOR(widget)) { - gParts->comboBoxSeparatorWidget = widget; - g_object_add_weak_pointer(G_OBJECT(widget), - (gpointer) &gParts->comboBoxSeparatorWidget); - } else if (GTK_IS_ARROW(widget)) { - gParts->comboBoxArrowWidget = widget; - g_object_add_weak_pointer(G_OBJECT(widget), - (gpointer) &gParts->comboBoxArrowWidget); - } else - return; - gtk_widget_realize(widget); - g_object_set_data(G_OBJECT(widget), "transparent-bg-hint", GINT_TO_POINTER(TRUE)); -} - -static gint -ensure_combo_box_widgets() -{ - GtkWidget* buttonChild; - - if (gParts->comboBoxButtonWidget && gParts->comboBoxArrowWidget) - return MOZ_GTK_SUCCESS; - - /* Create a ComboBox if needed */ - if (!gParts->comboBoxWidget) { - gParts->comboBoxWidget = gtk_combo_box_new(); - setup_widget_prototype(gParts->comboBoxWidget); - } - - /* Get its inner Button */ - gtk_container_forall(GTK_CONTAINER(gParts->comboBoxWidget), - moz_gtk_get_combo_box_inner_button, - NULL); - - if (gParts->comboBoxButtonWidget) { - /* Get the widgets inside the Button */ - buttonChild = gtk_bin_get_child(GTK_BIN(gParts->comboBoxButtonWidget)); - if (GTK_IS_HBOX(buttonChild)) { - /* appears-as-list = FALSE, cell-view = TRUE; the button - * contains an hbox. This hbox is there because the ComboBox - * needs to place a cell renderer, a separator, and an arrow in - * the button when appears-as-list is FALSE. */ - gtk_container_forall(GTK_CONTAINER(buttonChild), - moz_gtk_get_combo_box_button_inner_widgets, - NULL); - } else if(GTK_IS_ARROW(buttonChild)) { - /* appears-as-list = TRUE, or cell-view = FALSE; - * the button only contains an arrow */ - gParts->comboBoxArrowWidget = buttonChild; - g_object_add_weak_pointer(G_OBJECT(buttonChild), (gpointer) - &gParts->comboBoxArrowWidget); - gtk_widget_realize(gParts->comboBoxArrowWidget); - g_object_set_data(G_OBJECT(gParts->comboBoxArrowWidget), - "transparent-bg-hint", GINT_TO_POINTER(TRUE)); - } - } else { - /* Shouldn't be reached with current internal gtk implementation; we - * use a generic toggle button as last resort fallback to avoid - * crashing. */ - ensure_toggle_button_widget(); - gParts->comboBoxButtonWidget = gParts->toggleButtonWidget; - } - - if (!gParts->comboBoxArrowWidget) { - /* Shouldn't be reached with current internal gtk implementation; - * we gParts->buttonArrowWidget as last resort fallback to avoid - * crashing. */ - ensure_button_arrow_widget(); - gParts->comboBoxArrowWidget = gParts->buttonArrowWidget; - } - - /* We don't test the validity of gParts->comboBoxSeparatorWidget since there - * is none when "appears-as-list" = TRUE or "cell-view" = FALSE; if it - * is invalid we just won't paint it. */ - - return MOZ_GTK_SUCCESS; -} - -static gint -ensure_progress_widget() -{ - if (!gParts->progresWidget) { - gParts->progresWidget = gtk_progress_bar_new(); - setup_widget_prototype(gParts->progresWidget); - } - return MOZ_GTK_SUCCESS; -} - -static gint ensure_scrolled_window_widget() { if (!gParts->scrolledWindowWidget) { @@ -355,93 +176,12 @@ TSOffsetStyleGCs(GtkStyle* style, gint xorigin, gint yorigin) return MOZ_GTK_SUCCESS; } -static gint -moz_gtk_button_paint(GdkDrawable* drawable, GdkRectangle* rect, - GdkRectangle* cliprect, GtkWidgetState* state, - GtkReliefStyle relief, GtkWidget* widget, - GtkTextDirection direction) -{ - GtkShadowType shadow_type; - GtkStyle* style = gtk_widget_get_style(widget); - GtkStateType button_state = ConvertGtkState(state); - gint x = rect->x, y=rect->y, width=rect->width, height=rect->height; - - gboolean interior_focus; - gint focus_width, focus_pad; - - moz_gtk_widget_get_focus(widget, &interior_focus, &focus_width, &focus_pad); - - gtk_widget_set_state(widget, button_state); - gtk_widget_set_direction(widget, direction); - - if (state->isDefault) - GTK_WIDGET_SET_FLAGS(widget, GTK_HAS_DEFAULT); - - gtk_button_set_relief(GTK_BUTTON(widget), relief); - - /* Some theme engines love to cause us pain in that gtk_paint_focus is a - no-op on buttons and button-like widgets. They only listen to this flag. */ - if (state->focused && !state->disabled) - GTK_WIDGET_SET_FLAGS(widget, GTK_HAS_FOCUS); - - if (!interior_focus && state->focused) { - x += focus_width + focus_pad; - y += focus_width + focus_pad; - width -= 2 * (focus_width + focus_pad); - height -= 2 * (focus_width + focus_pad); - } - - shadow_type = button_state == GTK_STATE_ACTIVE || - state->depressed ? GTK_SHADOW_IN : GTK_SHADOW_OUT; - - if (state->isDefault && relief == GTK_RELIEF_NORMAL) { - gtk_paint_box(style, drawable, button_state, shadow_type, cliprect, - widget, "buttondefault", x, y, width, height); - } - - if (relief != GTK_RELIEF_NONE || state->depressed || - (button_state != GTK_STATE_NORMAL && - button_state != GTK_STATE_INSENSITIVE)) { - TSOffsetStyleGCs(style, x, y); - /* the following line can trigger an assertion (Crux theme) - file ../../gdk/gdkwindow.c: line 1846 (gdk_window_clear_area): - assertion `GDK_IS_WINDOW (window)' failed */ - gtk_paint_box(style, drawable, button_state, shadow_type, cliprect, - widget, "button", x, y, width, height); - } - - if (state->focused) { - if (interior_focus) { - GtkStyle* style = gtk_widget_get_style(widget); - x += style->xthickness + focus_pad; - y += style->ythickness + focus_pad; - width -= 2 * (style->xthickness + focus_pad); - height -= 2 * (style->ythickness + focus_pad); - } else { - x -= focus_width + focus_pad; - y -= focus_width + focus_pad; - width += 2 * (focus_width + focus_pad); - height += 2 * (focus_width + focus_pad); - } - - TSOffsetStyleGCs(style, x, y); - gtk_paint_focus(style, drawable, button_state, cliprect, - widget, "button", x, y, width, height); - } - - GTK_WIDGET_UNSET_FLAGS(widget, GTK_HAS_DEFAULT); - GTK_WIDGET_UNSET_FLAGS(widget, GTK_HAS_FOCUS); - return MOZ_GTK_SUCCESS; -} - gint moz_gtk_init() { GtkWidgetClass *entry_class; is_initialized = TRUE; - have_arrow_scaling = (gtk_major_version > 2 || - (gtk_major_version == 2 && gtk_minor_version >= 12)); /* Add style property to GtkEntry. * Adding the style property to the normal GtkEntry class means that it @@ -457,215 +197,6 @@ moz_gtk_init() return MOZ_GTK_SUCCESS; } -gint -moz_gtk_checkbox_get_metrics(gint* indicator_size, gint* indicator_spacing) -{ - ensure_checkbox_widget(); - - gtk_widget_style_get (gParts->checkboxWidget, - "indicator_size", indicator_size, - "indicator_spacing", indicator_spacing, - NULL); - - return MOZ_GTK_SUCCESS; -} - -gint -moz_gtk_radio_get_metrics(gint* indicator_size, gint* indicator_spacing) -{ - ensure_radiobutton_widget(); - - gtk_widget_style_get (gParts->radiobuttonWidget, - "indicator_size", indicator_size, - "indicator_spacing", indicator_spacing, - NULL); - - return MOZ_GTK_SUCCESS; -} - -gint -moz_gtk_widget_get_focus(GtkWidget* widget, gboolean* interior_focus, - gint* focus_width, gint* focus_pad) -{ - gtk_widget_style_get (widget, - "interior-focus", interior_focus, - "focus-line-width", focus_width, - "focus-padding", focus_pad, - NULL); - - return MOZ_GTK_SUCCESS; -} - -gint -moz_gtk_button_get_inner_border(GtkWidget* widget, GtkBorder* inner_border) -{ - static const GtkBorder default_inner_border = { 1, 1, 1, 1 }; - GtkBorder *tmp_border; - - gtk_widget_style_get (widget, "inner-border", &tmp_border, NULL); - - if (tmp_border) { - *inner_border = *tmp_border; - gtk_border_free(tmp_border); - } - else - *inner_border = default_inner_border; - - return MOZ_GTK_SUCCESS; -} - -static gint -moz_gtk_toggle_paint(GdkDrawable* drawable, GdkRectangle* rect, - GdkRectangle* cliprect, GtkWidgetState* state, - gboolean selected, gboolean inconsistent, - gboolean isradio, GtkTextDirection direction) -{ - GtkStateType state_type = ConvertGtkState(state); - GtkShadowType shadow_type = (selected)?GTK_SHADOW_IN:GTK_SHADOW_OUT; - gint indicator_size, indicator_spacing; - gint x, y, width, height; - gint focus_x, focus_y, focus_width, focus_height; - GtkWidget *w; - GtkStyle *style; - - if (isradio) { - moz_gtk_radio_get_metrics(&indicator_size, &indicator_spacing); - w = gParts->radiobuttonWidget; - } else { - moz_gtk_checkbox_get_metrics(&indicator_size, &indicator_spacing); - w = gParts->checkboxWidget; - } - - // "GetMinimumWidgetSize was ignored" - // FIXME: This assert causes a build failure in WebKitGTK+ debug - // builds, because it uses 'false' in its definition. We may want - // to force this file to be built with g++, by renaming it. - // ASSERT(rect->width == indicator_size); - - /* - * vertically center in the box, since XUL sometimes ignores our - * GetMinimumWidgetSize in the vertical dimension - */ - x = rect->x; - y = rect->y + (rect->height - indicator_size) / 2; - width = indicator_size; - height = indicator_size; - - focus_x = x - indicator_spacing; - focus_y = y - indicator_spacing; - focus_width = width + 2 * indicator_spacing; - focus_height = height + 2 * indicator_spacing; - - style = gtk_widget_get_style(w); - TSOffsetStyleGCs(style, x, y); - - gtk_widget_set_sensitive(w, !state->disabled); - gtk_widget_set_direction(w, direction); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w), selected); - - if (isradio) { - gtk_paint_option(style, drawable, state_type, shadow_type, cliprect, - gParts->radiobuttonWidget, "radiobutton", x, y, - width, height); - if (state->focused) { - gtk_paint_focus(style, drawable, GTK_STATE_ACTIVE, cliprect, - gParts->radiobuttonWidget, "radiobutton", focus_x, focus_y, - focus_width, focus_height); - } - } - else { - /* - * 'indeterminate' type on checkboxes. In GTK, the shadow type - * must also be changed for the state to be drawn. - */ - if (inconsistent) { - gtk_toggle_button_set_inconsistent(GTK_TOGGLE_BUTTON(gParts->checkboxWidget), TRUE); - shadow_type = GTK_SHADOW_ETCHED_IN; - } else { - gtk_toggle_button_set_inconsistent(GTK_TOGGLE_BUTTON(gParts->checkboxWidget), FALSE); - } - - gtk_paint_check(style, drawable, state_type, shadow_type, cliprect, - gParts->checkboxWidget, "checkbutton", x, y, width, height); - if (state->focused) { - gtk_paint_focus(style, drawable, GTK_STATE_ACTIVE, cliprect, - gParts->checkboxWidget, "checkbutton", focus_x, focus_y, - focus_width, focus_height); - } - } - - return MOZ_GTK_SUCCESS; -} - -static gint -calculate_button_inner_rect(GtkWidget* button, GdkRectangle* rect, - GdkRectangle* inner_rect, - GtkTextDirection direction, - gboolean ignore_focus) -{ - GtkBorder inner_border; - gboolean interior_focus; - gint focus_width, focus_pad; - GtkStyle* style; - - style = gtk_widget_get_style(button); - - /* This mirrors gtkbutton's child positioning */ - moz_gtk_button_get_inner_border(button, &inner_border); - moz_gtk_widget_get_focus(button, &interior_focus, - &focus_width, &focus_pad); - - if (ignore_focus) - focus_width = focus_pad = 0; - - inner_rect->x = rect->x + XTHICKNESS(style) + focus_width + focus_pad; - inner_rect->x += direction == GTK_TEXT_DIR_LTR ? - inner_border.left : inner_border.right; - inner_rect->y = rect->y + inner_border.top + YTHICKNESS(style) + - focus_width + focus_pad; - inner_rect->width = MAX(1, rect->width - inner_border.left - - inner_border.right - (XTHICKNESS(style) + focus_pad + focus_width) * 2); - inner_rect->height = MAX(1, rect->height - inner_border.top - - inner_border.bottom - (YTHICKNESS(style) + focus_pad + focus_width) * 2); - - return MOZ_GTK_SUCCESS; -} - - -static gint -calculate_arrow_rect(GtkWidget* arrow, GdkRectangle* rect, - GdkRectangle* arrow_rect, GtkTextDirection direction) -{ - /* defined in gtkarrow.c */ - gfloat arrow_scaling = 0.7; - gfloat xalign, xpad; - gint extent; - GtkMisc* misc = GTK_MISC(arrow); - gfloat misc_xalign, misc_yalign; - gint misc_xpad, misc_ypad; - - if (have_arrow_scaling) - gtk_widget_style_get(arrow, "arrow_scaling", &arrow_scaling, NULL); - - gtk_misc_get_padding(misc, &misc_xpad, &misc_ypad); - gtk_misc_get_alignment(misc, &misc_xalign, &misc_yalign); - - extent = MIN((rect->width - misc_xpad * 2), - (rect->height - misc_ypad * 2)) * arrow_scaling; - - xalign = direction == GTK_TEXT_DIR_LTR ? misc_xalign : 1.0 - misc_xalign; - xpad = misc_xpad + (rect->width - extent) * xalign; - - arrow_rect->x = direction == GTK_TEXT_DIR_LTR ? - floor(rect->x + xpad) : ceil(rect->x + xpad); - arrow_rect->y = floor(rect->y + misc_ypad + - ((rect->height - extent) * misc_yalign)); - - arrow_rect->width = arrow_rect->height = extent; - - return MOZ_GTK_SUCCESS; -} - static gint moz_gtk_scrolled_window_paint(GdkDrawable* drawable, GdkRectangle* rect, GdkRectangle* cliprect, GtkWidgetState* state) @@ -906,226 +437,6 @@ moz_gtk_scrollbar_thumb_paint(GtkThemeWidgetType widget, return MOZ_GTK_SUCCESS; } -static gint -moz_gtk_entry_paint(GdkDrawable* drawable, GdkRectangle* rect, - GdkRectangle* cliprect, GtkWidgetState* state, - GtkWidget* widget, GtkTextDirection direction) -{ - GtkStateType bg_state = state->disabled ? - GTK_STATE_INSENSITIVE : GTK_STATE_NORMAL; - gint x, y, width = rect->width, height = rect->height; - GtkStyle* style; - gboolean interior_focus; - gboolean theme_honors_transparency = FALSE; - gint focus_width; - - gtk_widget_set_direction(widget, direction); - - style = gtk_widget_get_style(widget); - - gtk_widget_style_get(widget, - "interior-focus", &interior_focus, - "focus-line-width", &focus_width, - "honors-transparent-bg-hint", &theme_honors_transparency, - NULL); - - /* gtkentry.c uses two windows, one for the entire widget and one for the - * text area inside it. The background of both windows is set to the "base" - * color of the new state in gtk_entry_state_changed, but only the inner - * textarea window uses gtk_paint_flat_box when exposed */ - - TSOffsetStyleGCs(style, rect->x, rect->y); - - /* This gets us a lovely greyish disabledish look */ - gtk_widget_set_sensitive(widget, !state->disabled); - - /* GTK fills the outer widget window with the base color before drawing the widget. - * Some older themes rely on this behavior, but many themes nowadays use rounded - * corners on their widgets. While most GTK apps are blissfully unaware of this - * problem due to their use of the default window background, we render widgets on - * many kinds of backgrounds on the web. - * If the theme is able to cope with transparency, then we can skip pre-filling - * and notify the theme it will paint directly on the canvas. */ - if (theme_honors_transparency) { - g_object_set_data(G_OBJECT(widget), "transparent-bg-hint", GINT_TO_POINTER(TRUE)); - } else { - gdk_draw_rectangle(drawable, style->base_gc[bg_state], TRUE, - cliprect->x, cliprect->y, cliprect->width, cliprect->height); - g_object_set_data(G_OBJECT(widget), "transparent-bg-hint", GINT_TO_POINTER(FALSE)); - } - - /* Get the position of the inner window, see _gtk_entry_get_borders */ - x = XTHICKNESS(style); - y = YTHICKNESS(style); - - if (!interior_focus) { - x += focus_width; - y += focus_width; - } - - /* Simulate an expose of the inner window */ - gtk_paint_flat_box(style, drawable, bg_state, GTK_SHADOW_NONE, - cliprect, widget, "entry_bg", rect->x + x, - rect->y + y, rect->width - 2*x, rect->height - 2*y); - - /* Now paint the shadow and focus border. - * We do like in gtk_entry_draw_frame, we first draw the shadow, a tad - * smaller when focused if the focus is not interior, then the focus. */ - x = rect->x; - y = rect->y; - - if (state->focused && !state->disabled) { - /* This will get us the lit borders that focused textboxes enjoy on - * some themes. */ - GTK_WIDGET_SET_FLAGS(widget, GTK_HAS_FOCUS); - - if (!interior_focus) { - /* Indent the border a little bit if we have exterior focus - (this is what GTK does to draw native entries) */ - x += focus_width; - y += focus_width; - width -= 2 * focus_width; - height -= 2 * focus_width; - } - } - - gtk_paint_shadow(style, drawable, GTK_STATE_NORMAL, GTK_SHADOW_IN, - cliprect, widget, "entry", x, y, width, height); - - if (state->focused && !state->disabled) { - if (!interior_focus) { - gtk_paint_focus(style, drawable, GTK_STATE_NORMAL, cliprect, - widget, "entry", - rect->x, rect->y, rect->width, rect->height); - } - - /* Now unset the focus flag. We don't want other entries to look - * like they're focused too! */ - GTK_WIDGET_UNSET_FLAGS(widget, GTK_HAS_FOCUS); - } - - return MOZ_GTK_SUCCESS; -} - -static gint -moz_gtk_combo_box_paint(GdkDrawable* drawable, GdkRectangle* rect, - GdkRectangle* cliprect, GtkWidgetState* state, - gboolean ishtml, GtkTextDirection direction) -{ - GdkRectangle arrow_rect, real_arrow_rect; - gint /* arrow_size, */ separator_width; - gboolean wide_separators; - GtkStateType state_type = ConvertGtkState(state); - GtkShadowType shadow_type = state->active ? GTK_SHADOW_IN : GTK_SHADOW_OUT; - GtkStyle* style; - GtkRequisition arrow_req; - - ensure_combo_box_widgets(); - - /* Also sets the direction on gParts->comboBoxButtonWidget, which is then - * inherited by the separator and arrow */ - moz_gtk_button_paint(drawable, rect, cliprect, state, GTK_RELIEF_NORMAL, - gParts->comboBoxButtonWidget, direction); - - calculate_button_inner_rect(gParts->comboBoxButtonWidget, - rect, &arrow_rect, direction, ishtml); - /* Now arrow_rect contains the inner rect ; we want to correct the width - * to what the arrow needs (see gtk_combo_box_size_allocate) */ - gtk_widget_size_request(gParts->comboBoxArrowWidget, &arrow_req); - if (direction == GTK_TEXT_DIR_LTR) - arrow_rect.x += arrow_rect.width - arrow_req.width; - arrow_rect.width = arrow_req.width; - - calculate_arrow_rect(gParts->comboBoxArrowWidget, - &arrow_rect, &real_arrow_rect, direction); - - style = gtk_widget_get_style(gParts->comboBoxArrowWidget); - TSOffsetStyleGCs(style, rect->x, rect->y); - - gtk_widget_size_allocate(gParts->comboBoxWidget, rect); - - gtk_paint_arrow(style, drawable, state_type, shadow_type, cliprect, - gParts->comboBoxArrowWidget, "arrow", GTK_ARROW_DOWN, TRUE, - real_arrow_rect.x, real_arrow_rect.y, - real_arrow_rect.width, real_arrow_rect.height); - - - /* If there is no separator in the theme, there's nothing left to do. */ - if (!gParts->comboBoxSeparatorWidget) - return MOZ_GTK_SUCCESS; - - style = gtk_widget_get_style(gParts->comboBoxSeparatorWidget); - TSOffsetStyleGCs(style, rect->x, rect->y); - - gtk_widget_style_get(gParts->comboBoxSeparatorWidget, - "wide-separators", &wide_separators, - "separator-width", &separator_width, - NULL); - - if (wide_separators) { - if (direction == GTK_TEXT_DIR_LTR) - arrow_rect.x -= separator_width; - else - arrow_rect.x += arrow_rect.width; - - gtk_paint_box(style, drawable, - GTK_STATE_NORMAL, GTK_SHADOW_ETCHED_OUT, - cliprect, gParts->comboBoxSeparatorWidget, "vseparator", - arrow_rect.x, arrow_rect.y, - separator_width, arrow_rect.height); - } else { - if (direction == GTK_TEXT_DIR_LTR) - arrow_rect.x -= XTHICKNESS(style); - else - arrow_rect.x += arrow_rect.width; - - gtk_paint_vline(style, drawable, GTK_STATE_NORMAL, cliprect, - gParts->comboBoxSeparatorWidget, "vseparator", - arrow_rect.y, arrow_rect.y + arrow_rect.height, - arrow_rect.x); - } - - return MOZ_GTK_SUCCESS; -} - -static gint -moz_gtk_progressbar_paint(GdkDrawable* drawable, GdkRectangle* rect, - GdkRectangle* cliprect, GtkTextDirection direction) -{ - GtkStyle* style; - - ensure_progress_widget(); - gtk_widget_set_direction(gParts->progresWidget, direction); - - style = gtk_widget_get_style(gParts->progresWidget); - - TSOffsetStyleGCs(style, rect->x, rect->y); - gtk_paint_box(style, drawable, GTK_STATE_NORMAL, GTK_SHADOW_IN, - cliprect, gParts->progresWidget, "trough", rect->x, rect->y, - rect->width, rect->height); - - return MOZ_GTK_SUCCESS; -} - -static gint -moz_gtk_progress_chunk_paint(GdkDrawable* drawable, GdkRectangle* rect, - GdkRectangle* cliprect, GtkTextDirection direction) -{ - GtkStyle* style; - - ensure_progress_widget(); - gtk_widget_set_direction(gParts->progresWidget, direction); - - style = gtk_widget_get_style(gParts->progresWidget); - - TSOffsetStyleGCs(style, rect->x, rect->y); - gtk_paint_box(style, drawable, GTK_STATE_PRELIGHT, GTK_SHADOW_OUT, - cliprect, gParts->progresWidget, "bar", rect->x, rect->y, - rect->width, rect->height); - - return MOZ_GTK_SUCCESS; -} - gint moz_gtk_get_widget_border(GtkThemeWidgetType widget, gint* left, gint* top, gint* right, gint* bottom, GtkTextDirection direction, @@ -1135,99 +446,12 @@ moz_gtk_get_widget_border(GtkThemeWidgetType widget, gint* left, gint* top, GtkStyle *style; switch (widget) { - case MOZ_GTK_BUTTON: - { - GtkBorder inner_border; - gboolean interior_focus; - gint focus_width, focus_pad; - GtkStyle *style; - - ensure_button_widget(); - *left = *top = *right = *bottom = gtk_container_get_border_width(GTK_CONTAINER(gParts->buttonWidget)); - - /* Don't add this padding in HTML, otherwise the buttons will - become too big and stuff the layout. */ - if (!inhtml) { - moz_gtk_widget_get_focus(gParts->buttonWidget, &interior_focus, &focus_width, &focus_pad); - moz_gtk_button_get_inner_border(gParts->buttonWidget, &inner_border); - *left += focus_width + focus_pad + inner_border.left; - *right += focus_width + focus_pad + inner_border.right; - *top += focus_width + focus_pad + inner_border.top; - *bottom += focus_width + focus_pad + inner_border.bottom; - } - - style = gtk_widget_get_style(gParts->buttonWidget); - *left += style->xthickness; - *right += style->xthickness; - *top += style->ythickness; - *bottom += style->ythickness; - return MOZ_GTK_SUCCESS; - } - case MOZ_GTK_ENTRY: - ensure_entry_widget(); - w = gParts->entryWidget; - break; - case MOZ_GTK_DROPDOWN: - { - /* We need to account for the arrow on the dropdown, so text - * doesn't come too close to the arrow, or in some cases spill - * into the arrow. */ - gboolean ignored_interior_focus, wide_separators; - gint focus_width, focus_pad, separator_width; - GtkRequisition arrow_req; - GtkStyle* style; - - ensure_combo_box_widgets(); - - *left = gtk_container_get_border_width(GTK_CONTAINER(gParts->comboBoxButtonWidget)); - - if (!inhtml) { - moz_gtk_widget_get_focus(gParts->comboBoxButtonWidget, - &ignored_interior_focus, - &focus_width, &focus_pad); - *left += focus_width + focus_pad; - } - - style = gtk_widget_get_style(gParts->comboBoxButtonWidget); - *top = *left + style->ythickness; - *left += style->xthickness; - - *right = *left; *bottom = *top; - - /* If there is no separator, don't try to count its width. */ - separator_width = 0; - if (gParts->comboBoxSeparatorWidget) { - gtk_widget_style_get(gParts->comboBoxSeparatorWidget, - "wide-separators", &wide_separators, - "separator-width", &separator_width, - NULL); - - if (!wide_separators) - separator_width = - XTHICKNESS(style); - } - - gtk_widget_size_request(gParts->comboBoxArrowWidget, &arrow_req); - if (direction == GTK_TEXT_DIR_RTL) - *left += separator_width + arrow_req.width; - else - *right += separator_width + arrow_req.width; - - return MOZ_GTK_SUCCESS; - } - case MOZ_GTK_PROGRESSBAR: - ensure_progress_widget(); - w = gParts->progresWidget; - break; /* These widgets have no borders, since they are not containers. */ - case MOZ_GTK_CHECKBUTTON: - case MOZ_GTK_RADIOBUTTON: case MOZ_GTK_SCROLLBAR_BUTTON: case MOZ_GTK_SCROLLBAR_TRACK_HORIZONTAL: case MOZ_GTK_SCROLLBAR_TRACK_VERTICAL: case MOZ_GTK_SCROLLBAR_THUMB_HORIZONTAL: case MOZ_GTK_SCROLLBAR_THUMB_VERTICAL: - case MOZ_GTK_PROGRESS_CHUNK: *left = *top = *right = *bottom = 0; return MOZ_GTK_SUCCESS; default: @@ -1269,26 +493,6 @@ moz_gtk_widget_paint(GtkThemeWidgetType widget, GdkDrawable* drawable, GtkTextDirection direction) { switch (widget) { - case MOZ_GTK_BUTTON: - if (state->depressed) { - ensure_toggle_button_widget(); - return moz_gtk_button_paint(drawable, rect, cliprect, state, - (GtkReliefStyle) flags, - gParts->toggleButtonWidget, direction); - } - ensure_button_widget(); - return moz_gtk_button_paint(drawable, rect, cliprect, state, - (GtkReliefStyle) flags, gParts->buttonWidget, - direction); - break; - case MOZ_GTK_CHECKBUTTON: - case MOZ_GTK_RADIOBUTTON: - return moz_gtk_toggle_paint(drawable, rect, cliprect, state, - !!(flags & MOZ_GTK_WIDGET_CHECKED), - !!(flags & MOZ_GTK_WIDGET_INCONSISTENT), - (widget == MOZ_GTK_RADIOBUTTON), - direction); - break; case MOZ_GTK_SCROLLBAR_BUTTON: return moz_gtk_scrollbar_button_paint(drawable, rect, cliprect, state, (GtkScrollbarButtonFlags) flags, @@ -1307,22 +511,6 @@ moz_gtk_widget_paint(GtkThemeWidgetType widget, GdkDrawable* drawable, case MOZ_GTK_SCROLLED_WINDOW: return moz_gtk_scrolled_window_paint(drawable, rect, cliprect, state); break; - case MOZ_GTK_ENTRY: - ensure_entry_widget(); - return moz_gtk_entry_paint(drawable, rect, cliprect, state, - gParts->entryWidget, direction); - break; - case MOZ_GTK_DROPDOWN: - return moz_gtk_combo_box_paint(drawable, rect, cliprect, state, - (gboolean) flags, direction); - break; - case MOZ_GTK_PROGRESSBAR: - return moz_gtk_progressbar_paint(drawable, rect, cliprect, direction); - break; - case MOZ_GTK_PROGRESS_CHUNK: - return moz_gtk_progress_chunk_paint(drawable, rect, cliprect, - direction); - break; default: g_warning("Unknown widget type: %d", widget); } @@ -1361,12 +549,4 @@ void moz_gtk_destroy_theme_parts_widgets(GtkThemeParts* parts) } } -GtkWidget* moz_gtk_get_progress_widget() -{ - if (!is_initialized) - return NULL; - ensure_progress_widget(); - return gParts->progresWidget; -} - #endif // GTK_API_VERSION_2 diff --git a/Source/WebCore/platform/gtk/gtkdrawing.h b/Source/WebCore/platform/gtk/gtkdrawing.h index 412a1f7..cdb343c 100644 --- a/Source/WebCore/platform/gtk/gtkdrawing.h +++ b/Source/WebCore/platform/gtk/gtkdrawing.h @@ -48,6 +48,8 @@ #ifndef _GTK_DRAWING_H_ #define _GTK_DRAWING_H_ +#undef GTK_DISABLE_DEPRECATED + #include <gtk/gtk.h> #ifdef __cplusplus @@ -84,23 +86,8 @@ typedef struct _GtkThemeParts { GdkColormap* colormap; GtkWidget* protoWindow; GtkWidget* protoLayout; - GtkWidget* buttonWidget; - GtkWidget* toggleButtonWidget; - GtkWidget* buttonArrowWidget; - GtkWidget* checkboxWidget; - GtkWidget* radiobuttonWidget; GtkWidget* horizScrollbarWidget; GtkWidget* vertScrollbarWidget; - GtkWidget* entryWidget; - GtkWidget* comboBoxWidget; - GtkWidget* comboBoxButtonWidget; - GtkWidget* comboBoxArrowWidget; - GtkWidget* comboBoxSeparatorWidget; - GtkWidget* comboBoxEntryWidget; - GtkWidget* comboBoxEntryTextareaWidget; - GtkWidget* comboBoxEntryButtonWidget; - GtkWidget* comboBoxEntryArrowWidget; - GtkWidget* progresWidget; GtkWidget* scrolledWindowWidget; } GtkThemeParts; @@ -118,18 +105,10 @@ typedef gint (*style_prop_t)(GtkStyle*, const gchar*, gint); #define MOZ_GTK_UNKNOWN_WIDGET -1 #define MOZ_GTK_UNSAFE_THEME -2 -/*** checkbox/radio flags ***/ -#define MOZ_GTK_WIDGET_CHECKED 1 -#define MOZ_GTK_WIDGET_INCONSISTENT (1 << 1) - /*** widget type constants ***/ typedef enum { /* Paints a GtkButton. flags is a GtkReliefStyle. */ MOZ_GTK_BUTTON, - /* Paints a GtkCheckButton. flags is a boolean, 1=checked, 0=not checked. */ - MOZ_GTK_CHECKBUTTON, - /* Paints a GtkRadioButton. flags is a boolean, 1=checked, 0=not checked. */ - MOZ_GTK_RADIOBUTTON, /** * Paints the button of a GtkScrollbar. flags is a GtkArrowType giving * the arrow direction. @@ -143,13 +122,6 @@ typedef enum { MOZ_GTK_SCROLLBAR_THUMB_VERTICAL, /* Paints the background of a scrolled window */ MOZ_GTK_SCROLLED_WINDOW, - MOZ_GTK_ENTRY, - /* Paints a GtkOptionMenu. */ - MOZ_GTK_DROPDOWN, - /* Paints a GtkProgressBar. */ - MOZ_GTK_PROGRESSBAR, - /* Paints a progress chunk of a GtkProgressBar. */ - MOZ_GTK_PROGRESS_CHUNK } GtkThemeWidgetType; /*** General library functions ***/ @@ -223,42 +195,6 @@ moz_gtk_widget_paint(GtkThemeWidgetType widget, GdkDrawable* drawable, gint moz_gtk_get_widget_border(GtkThemeWidgetType widget, gint* left, gint* top, gint* right, gint* bottom, GtkTextDirection direction, gboolean inhtml); - -/** - * Get the desired size of a GtkCheckButton - * indicator_size: [OUT] the indicator size - * indicator_spacing: [OUT] the spacing between the indicator and its - * container - * - * returns: MOZ_GTK_SUCCESS if there was no error, an error code otherwise - */ -gint -moz_gtk_checkbox_get_metrics(gint* indicator_size, gint* indicator_spacing); - -/** - * Get the desired size of a GtkRadioButton - * indicator_size: [OUT] the indicator size - * indicator_spacing: [OUT] the spacing between the indicator and its - * container - * - * returns: MOZ_GTK_SUCCESS if there was no error, an error code otherwise - */ -gint -moz_gtk_radio_get_metrics(gint* indicator_size, gint* indicator_spacing); - -/** Get the focus metrics for a treeheadercell, button, checkbox, or radio button. - * widget: [IN] the widget to get the focus metrics for - * interior_focus: [OUT] whether the focus is drawn around the - * label (TRUE) or around the whole container (FALSE) - * focus_width: [OUT] the width of the focus line - * focus_pad: [OUT] the padding between the focus line and children - * - * returns: MOZ_GTK_SUCCESS if there was no error, an error code otherwise - */ -gint -moz_gtk_widget_get_focus(GtkWidget* widget, gboolean* interior_focus, - gint* focus_width, gint* focus_pad); - /** * Get the desired metrics for a GtkScrollbar * metrics: [IN] struct which will contain the metrics @@ -274,12 +210,6 @@ moz_gtk_get_scrollbar_metrics(MozGtkScrollbarMetrics* metrics); */ GtkWidget* moz_gtk_get_scrollbar_widget(void); -/** - * Retrieve an actual GTK progress bar widget for style analysis. It will not - * be modified. - */ -GtkWidget* moz_gtk_get_progress_widget(void); - #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/Source/WebCore/platform/image-decoders/ImageDecoder.h b/Source/WebCore/platform/image-decoders/ImageDecoder.h index 13069de..c581ba1 100644 --- a/Source/WebCore/platform/image-decoders/ImageDecoder.h +++ b/Source/WebCore/platform/image-decoders/ImageDecoder.h @@ -231,7 +231,8 @@ namespace WebCore { // setMaxNumPixels() to specify the biggest size that decoded images can // have. Image decoders will deflate those images that are bigger than // m_maxNumPixels. (Not supported by all image decoders yet) - class ImageDecoder : public Noncopyable { + class ImageDecoder { + WTF_MAKE_NONCOPYABLE(ImageDecoder); WTF_MAKE_FAST_ALLOCATED; public: ImageDecoder(ImageSource::AlphaOption alphaOption, ImageSource::GammaAndColorProfileOption gammaAndColorProfileOption) : m_scaled(false) diff --git a/Source/WebCore/platform/mac/ClipboardMac.h b/Source/WebCore/platform/mac/ClipboardMac.h index 7187ecf..39eadda 100644 --- a/Source/WebCore/platform/mac/ClipboardMac.h +++ b/Source/WebCore/platform/mac/ClipboardMac.h @@ -44,6 +44,7 @@ class Frame; class FileList; class ClipboardMac : public Clipboard, public CachedResourceClient { + WTF_MAKE_FAST_ALLOCATED; public: static PassRefPtr<ClipboardMac> create(ClipboardType clipboardType, NSPasteboard *pasteboard, ClipboardAccessPolicy policy, Frame* frame) { diff --git a/Source/WebCore/platform/mac/LocalCurrentGraphicsContext.h b/Source/WebCore/platform/mac/LocalCurrentGraphicsContext.h index 90beb40..8fde2cf 100644 --- a/Source/WebCore/platform/mac/LocalCurrentGraphicsContext.h +++ b/Source/WebCore/platform/mac/LocalCurrentGraphicsContext.h @@ -31,7 +31,8 @@ class GraphicsContext; // This class automatically saves and restores the current NSGraphicsContext for // functions which call out into AppKit and rely on the currentContext being set -class LocalCurrentGraphicsContext : public Noncopyable { +class LocalCurrentGraphicsContext { + WTF_MAKE_NONCOPYABLE(LocalCurrentGraphicsContext); public: LocalCurrentGraphicsContext(GraphicsContext* graphicsContext); ~LocalCurrentGraphicsContext(); diff --git a/Source/WebCore/platform/mac/ScrollAnimatorMac.h b/Source/WebCore/platform/mac/ScrollAnimatorMac.h index 234e43c..f05db40 100644 --- a/Source/WebCore/platform/mac/ScrollAnimatorMac.h +++ b/Source/WebCore/platform/mac/ScrollAnimatorMac.h @@ -28,7 +28,6 @@ #if ENABLE(SMOOTH_SCROLLING) -#include "FloatPoint.h" #include "ScrollAnimator.h" #include <wtf/RetainPtr.h> @@ -42,14 +41,13 @@ namespace WebCore { class ScrollAnimatorMac : public ScrollAnimator { public: - ScrollAnimatorMac(ScrollbarClient*); + ScrollAnimatorMac(ScrollableArea*); virtual ~ScrollAnimatorMac(); virtual bool scroll(ScrollbarOrientation, ScrollGranularity, float step, float multiplier); - virtual void setScrollPositionAndStopAnimation(ScrollbarOrientation, float position); + virtual void scrollToOffsetWithoutAnimation(const FloatPoint&); // Called by the ScrollAnimationHelperDelegate. - FloatPoint currentPosition() const; void immediateScrollToPoint(const FloatPoint& newPosition); private: diff --git a/Source/WebCore/platform/mac/ScrollAnimatorMac.mm b/Source/WebCore/platform/mac/ScrollAnimatorMac.mm index ca71bd3..59b333b 100644 --- a/Source/WebCore/platform/mac/ScrollAnimatorMac.mm +++ b/Source/WebCore/platform/mac/ScrollAnimatorMac.mm @@ -28,7 +28,10 @@ #if ENABLE(SMOOTH_SCROLLING) #include "ScrollAnimatorMac.h" -#include "ScrollbarClient.h" + +#include "FloatPoint.h" +#include "ScrollableArea.h" +#include <wtf/PassOwnPtr.h> @interface NSObject (NSScrollAnimationHelperDetails) - (id)initWithDelegate:(id)delegate; @@ -121,13 +124,13 @@ static NSSize abs(NSSize size) namespace WebCore { -ScrollAnimator* ScrollAnimator::create(ScrollbarClient* client) +PassOwnPtr<ScrollAnimator> ScrollAnimator::create(ScrollableArea* scrollableArea) { - return new ScrollAnimatorMac(client); + return adoptPtr(new ScrollAnimatorMac(scrollableArea)); } -ScrollAnimatorMac::ScrollAnimatorMac(ScrollbarClient* client) - : ScrollAnimator(client) +ScrollAnimatorMac::ScrollAnimatorMac(ScrollableArea* scrollableArea) + : ScrollAnimator(scrollableArea) { m_scrollAnimationHelperDelegate.adoptNS([[ScrollAnimationHelperDelegate alloc] initWithScrollAnimator:this]); m_scrollAnimationHelper.adoptNS([[NSClassFromString(@"NSScrollAnimationHelper") alloc] initWithDelegate:m_scrollAnimationHelperDelegate.get()]); @@ -146,7 +149,7 @@ bool ScrollAnimatorMac::scroll(ScrollbarOrientation orientation, ScrollGranulari return ScrollAnimator::scroll(orientation, granularity, step, multiplier); float currentPos = orientation == HorizontalScrollbar ? m_currentPosX : m_currentPosY; - float newPos = std::max<float>(std::min<float>(currentPos + (step * multiplier), static_cast<float>(m_client->scrollSize(orientation))), 0); + float newPos = std::max<float>(std::min<float>(currentPos + (step * multiplier), static_cast<float>(m_scrollableArea->scrollSize(orientation))), 0); if (currentPos == newPos) return false; @@ -161,23 +164,17 @@ bool ScrollAnimatorMac::scroll(ScrollbarOrientation orientation, ScrollGranulari return true; } -void ScrollAnimatorMac::setScrollPositionAndStopAnimation(ScrollbarOrientation orientation, float pos) +void ScrollAnimatorMac::scrollToOffsetWithoutAnimation(const FloatPoint& offset) { [m_scrollAnimationHelper.get() _stopRun]; - ScrollAnimator::setScrollPositionAndStopAnimation(orientation, pos); -} - -FloatPoint ScrollAnimatorMac::currentPosition() const -{ - return FloatPoint(m_currentPosX, m_currentPosY); + ScrollAnimator::scrollToOffsetWithoutAnimation(offset); } void ScrollAnimatorMac::immediateScrollToPoint(const FloatPoint& newPosition) { m_currentPosX = newPosition.x(); m_currentPosY = newPosition.y(); - - m_client->setScrollOffsetFromAnimation(IntPoint(m_currentPosX, m_currentPosY)); + notityPositionChanged(); } } // namespace WebCore diff --git a/Source/WebCore/platform/mac/ScrollbarThemeMac.h b/Source/WebCore/platform/mac/ScrollbarThemeMac.h index c833ee7..8b5412d 100644 --- a/Source/WebCore/platform/mac/ScrollbarThemeMac.h +++ b/Source/WebCore/platform/mac/ScrollbarThemeMac.h @@ -40,6 +40,7 @@ public: virtual int scrollbarThickness(ScrollbarControlSize = RegularScrollbar); virtual bool supportsControlTints() const { return true; } + virtual bool usesOverlayScrollbars() const; virtual double initialAutoscrollTimerDelay(); virtual double autoscrollTimerDelay(); diff --git a/Source/WebCore/platform/mac/ScrollbarThemeMac.mm b/Source/WebCore/platform/mac/ScrollbarThemeMac.mm index ce3be1a..032d9f3 100644 --- a/Source/WebCore/platform/mac/ScrollbarThemeMac.mm +++ b/Source/WebCore/platform/mac/ScrollbarThemeMac.mm @@ -27,18 +27,39 @@ #include "ScrollbarThemeMac.h" #include "ImageBuffer.h" +#include "LocalCurrentGraphicsContext.h" #include "PlatformMouseEvent.h" #include "ScrollView.h" +#include "WebCoreSystemInterface.h" #include <Carbon/Carbon.h> +#include <wtf/HashMap.h> #include <wtf/StdLibExtras.h> #include <wtf/UnusedParam.h> +#if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#define USE_WK_SCROLLBAR_PAINTER +#endif + // FIXME: There are repainting problems due to Aqua scroll bar buttons' visual overflow. using namespace std; using namespace WebCore; -static HashSet<Scrollbar*>* gScrollbars; +namespace WebCore { + +#if defined(USE_WK_SCROLLBAR_PAINTER) +typedef HashMap<Scrollbar*, RetainPtr<WKScrollbarPainterRef> > ScrollbarPainterMap; +#else +typedef HashSet<Scrollbar*> ScrollbarPainterMap; +#endif + +static ScrollbarPainterMap* scrollbarMap() +{ + static ScrollbarPainterMap* map = new ScrollbarPainterMap; + return map; +} + +} @interface ScrollbarPrefsObserver : NSObject { @@ -58,12 +79,17 @@ static HashSet<Scrollbar*>* gScrollbars; UNUSED_PARAM(unusedNotification); static_cast<ScrollbarThemeMac*>(ScrollbarTheme::nativeTheme())->preferencesChanged(); - if (!gScrollbars) + if (scrollbarMap()->isEmpty()) return; - HashSet<Scrollbar*>::iterator end = gScrollbars->end(); - for (HashSet<Scrollbar*>::iterator it = gScrollbars->begin(); it != end; ++it) { + ScrollbarPainterMap::iterator end = scrollbarMap()->end(); + for (ScrollbarPainterMap::iterator it = scrollbarMap()->begin(); it != end; ++it) { +#if defined(USE_WK_SCROLLBAR_PAINTER) + it->first->styleChanged(); + it->first->invalidate(); +#else (*it)->styleChanged(); (*it)->invalidate(); +#endif } } @@ -109,6 +135,9 @@ static ScrollbarButtonsPlacement gButtonPlacement = ScrollbarButtonsDoubleEnd; static void updateArrowPlacement() { +#if defined(USE_WK_SCROLLBAR_PAINTER) + gButtonPlacement = ScrollbarButtonsNone; +#else NSString *buttonPlacement = [[NSUserDefaults standardUserDefaults] objectForKey:@"AppleScrollBarVariant"]; if ([buttonPlacement isEqualToString:@"Single"]) gButtonPlacement = ScrollbarButtonsSingle; @@ -118,22 +147,23 @@ static void updateArrowPlacement() gButtonPlacement = ScrollbarButtonsDoubleBoth; else gButtonPlacement = ScrollbarButtonsDoubleEnd; // The default is ScrollbarButtonsDoubleEnd. +#endif } void ScrollbarThemeMac::registerScrollbar(Scrollbar* scrollbar) { - if (!gScrollbars) - gScrollbars = new HashSet<Scrollbar*>; - gScrollbars->add(scrollbar); +#if defined(USE_WK_SCROLLBAR_PAINTER) + WKScrollbarPainterRef scrollbarPainter = wkMakeScrollbarPainter(scrollbar->controlSize(), + scrollbar->orientation() == HorizontalScrollbar); + scrollbarMap()->add(scrollbar, scrollbarPainter); +#else + scrollbarMap()->add(scrollbar); +#endif } void ScrollbarThemeMac::unregisterScrollbar(Scrollbar* scrollbar) { - gScrollbars->remove(scrollbar); - if (gScrollbars->isEmpty()) { - delete gScrollbars; - gScrollbars = 0; - } + scrollbarMap()->remove(scrollbar); } ScrollbarThemeMac::ScrollbarThemeMac() @@ -165,6 +195,12 @@ int ScrollbarThemeMac::scrollbarThickness(ScrollbarControlSize controlSize) return cScrollbarThickness[controlSize]; } +bool ScrollbarThemeMac::usesOverlayScrollbars() const +{ + // FIXME: This should be enabled when <rdar://problem/8492788> is resolved. + return false; +} + double ScrollbarThemeMac::initialAutoscrollTimerDelay() { return gInitialButtonDelay; @@ -355,6 +391,20 @@ static int scrollbarPartToHIPressedState(ScrollbarPart part) bool ScrollbarThemeMac::paint(Scrollbar* scrollbar, GraphicsContext* context, const IntRect& damageRect) { +#if defined(USE_WK_SCROLLBAR_PAINTER) + context->save(); + context->clip(damageRect); + context->translate(scrollbar->frameRect().x(), scrollbar->frameRect().y()); + LocalCurrentGraphicsContext localContext(context); + wkScrollbarPainterPaint(scrollbarMap()->get(scrollbar).get(), + scrollbar->enabled(), + scrollbar->currentPos() / scrollbar->maximum(), + static_cast<CGFloat>(scrollbar->visibleSize()) / scrollbar->totalSize(), + scrollbar->frameRect()); + context->restore(); + return true; +#endif + HIThemeTrackDrawInfo trackInfo; trackInfo.version = 0; trackInfo.kind = scrollbar->controlSize() == RegularScrollbar ? kThemeMediumScrollBar : kThemeSmallScrollBar; @@ -370,7 +420,7 @@ bool ScrollbarThemeMac::paint(Scrollbar* scrollbar, GraphicsContext* context, co if (!scrollbar->enabled()) trackInfo.enableState = kThemeTrackDisabled; else - trackInfo.enableState = scrollbar->client()->isActive() ? kThemeTrackActive : kThemeTrackInactive; + trackInfo.enableState = scrollbar->scrollableArea()->isActive() ? kThemeTrackActive : kThemeTrackInactive; if (hasThumb(scrollbar)) trackInfo.attributes |= kThemeTrackShowThumb; diff --git a/Source/WebCore/platform/mac/WebCoreSystemInterface.h b/Source/WebCore/platform/mac/WebCoreSystemInterface.h index 0c78c23..045864a 100644 --- a/Source/WebCore/platform/mac/WebCoreSystemInterface.h +++ b/Source/WebCore/platform/mac/WebCoreSystemInterface.h @@ -186,6 +186,10 @@ extern CTTypesetterRef (*wkCreateCTTypesetterWithUniCharProviderAndOptions)(cons extern CGContextRef (*wkIOSurfaceContextCreate)(IOSurfaceRef surface, unsigned width, unsigned height, CGColorSpaceRef colorSpace); extern CGImageRef (*wkIOSurfaceContextCreateImage)(CGContextRef context); + +typedef struct __WKScrollbarPainter *WKScrollbarPainterRef; +extern WKScrollbarPainterRef (*wkMakeScrollbarPainter)(int controlSize, bool isHorizontal); +extern void (*wkScrollbarPainterPaint)(WKScrollbarPainterRef, bool enabled, double value, CGFloat proportion, CGRect frameRect); #endif } diff --git a/Source/WebCore/platform/mac/WebCoreSystemInterface.mm b/Source/WebCore/platform/mac/WebCoreSystemInterface.mm index df3c77c..047827f 100644 --- a/Source/WebCore/platform/mac/WebCoreSystemInterface.mm +++ b/Source/WebCore/platform/mac/WebCoreSystemInterface.mm @@ -125,4 +125,7 @@ CTTypesetterRef (*wkCreateCTTypesetterWithUniCharProviderAndOptions)(const UniCh CGContextRef (*wkIOSurfaceContextCreate)(IOSurfaceRef surface, unsigned width, unsigned height, CGColorSpaceRef colorSpace); CGImageRef (*wkIOSurfaceContextCreateImage)(CGContextRef context); + +WKScrollbarPainterRef (*wkMakeScrollbarPainter)(int controlSize, bool isHorizontal); +void (*wkScrollbarPainterPaint)(WKScrollbarPainterRef, bool enabled, double value, CGFloat proportion, CGRect frameRect); #endif diff --git a/Source/WebCore/platform/mock/SpeechInputClientMock.cpp b/Source/WebCore/platform/mock/SpeechInputClientMock.cpp index 16a7c76..9aa3113 100644 --- a/Source/WebCore/platform/mock/SpeechInputClientMock.cpp +++ b/Source/WebCore/platform/mock/SpeechInputClientMock.cpp @@ -33,6 +33,7 @@ #if ENABLE(INPUT_SPEECH) +#include "SecurityOrigin.h" #include "SpeechInputListener.h" namespace WebCore { @@ -50,7 +51,7 @@ void SpeechInputClientMock::setListener(SpeechInputListener* listener) m_listener = listener; } -bool SpeechInputClientMock::startRecognition(int requestId, const IntRect& elementRect, const AtomicString& language, const String& grammar) +bool SpeechInputClientMock::startRecognition(int requestId, const IntRect& elementRect, const AtomicString& language, const String& grammar, SecurityOrigin* origin) { if (m_timer.isActive()) return false; diff --git a/Source/WebCore/platform/mock/SpeechInputClientMock.h b/Source/WebCore/platform/mock/SpeechInputClientMock.h index 6f72191..4e13242 100644 --- a/Source/WebCore/platform/mock/SpeechInputClientMock.h +++ b/Source/WebCore/platform/mock/SpeechInputClientMock.h @@ -54,7 +54,7 @@ public: // SpeechInputClient methods. void setListener(SpeechInputListener*); - bool startRecognition(int requestId, const IntRect& elementRect, const AtomicString& language, const String& grammar); + bool startRecognition(int requestId, const IntRect& elementRect, const AtomicString& language, const String& grammar, SecurityOrigin*); void stopRecording(int); void cancelRecognition(int); diff --git a/Source/WebCore/platform/network/BlobData.h b/Source/WebCore/platform/network/BlobData.h index 1ff6344..c1f5522 100644 --- a/Source/WebCore/platform/network/BlobData.h +++ b/Source/WebCore/platform/network/BlobData.h @@ -145,6 +145,7 @@ private: typedef Vector<BlobDataItem> BlobDataItemList; class BlobData { + WTF_MAKE_FAST_ALLOCATED; public: static PassOwnPtr<BlobData> create(); diff --git a/Source/WebCore/platform/network/FormDataBuilder.h b/Source/WebCore/platform/network/FormDataBuilder.h index 87d0ef3..112e315 100644 --- a/Source/WebCore/platform/network/FormDataBuilder.h +++ b/Source/WebCore/platform/network/FormDataBuilder.h @@ -23,14 +23,14 @@ #include "PlatformString.h" #include <wtf/Forward.h> -#include <wtf/Noncopyable.h> namespace WebCore { class Document; class TextEncoding; -class FormDataBuilder : public Noncopyable { +class FormDataBuilder { + WTF_MAKE_NONCOPYABLE(FormDataBuilder); public: static TextEncoding encodingFromAcceptCharset(const String& acceptCharset, Document* document); diff --git a/Source/WebCore/platform/network/NetworkStateNotifier.h b/Source/WebCore/platform/network/NetworkStateNotifier.h index 21d0067..08ab0bd 100644 --- a/Source/WebCore/platform/network/NetworkStateNotifier.h +++ b/Source/WebCore/platform/network/NetworkStateNotifier.h @@ -26,6 +26,7 @@ #ifndef NetworkStateNotifier_h #define NetworkStateNotifier_h +#include <wtf/FastAllocBase.h> #include <wtf/Noncopyable.h> #if PLATFORM(ANDROID) // TODO: Upstream to webkit.org @@ -65,7 +66,8 @@ namespace WebCore { class NetworkStateNotifierPrivate; #endif -class NetworkStateNotifier : public Noncopyable { +class NetworkStateNotifier { + WTF_MAKE_NONCOPYABLE(NetworkStateNotifier); WTF_MAKE_FAST_ALLOCATED; public: NetworkStateNotifier(); void setNetworkStateChangedFunction(void (*)()); diff --git a/Source/WebCore/platform/network/ResourceHandleInternal.h b/Source/WebCore/platform/network/ResourceHandleInternal.h index d833e32..ed66944 100644 --- a/Source/WebCore/platform/network/ResourceHandleInternal.h +++ b/Source/WebCore/platform/network/ResourceHandleInternal.h @@ -80,7 +80,8 @@ class NSURLConnection; namespace WebCore { class ResourceHandleClient; - class ResourceHandleInternal : public Noncopyable { + class ResourceHandleInternal { + WTF_MAKE_NONCOPYABLE(ResourceHandleInternal); WTF_MAKE_FAST_ALLOCATED; public: ResourceHandleInternal(ResourceHandle* loader, const ResourceRequest& request, ResourceHandleClient* c, bool defersLoading, bool shouldContentSniff) : m_client(c) diff --git a/Source/WebCore/platform/network/ResourceRequestBase.h b/Source/WebCore/platform/network/ResourceRequestBase.h index 5cb7ee3..dce33db 100644 --- a/Source/WebCore/platform/network/ResourceRequestBase.h +++ b/Source/WebCore/platform/network/ResourceRequestBase.h @@ -49,7 +49,8 @@ namespace WebCore { struct CrossThreadResourceRequestData; // Do not use this type directly. Use ResourceRequest instead. - class ResourceRequestBase : public FastAllocBase { + class ResourceRequestBase { + WTF_MAKE_FAST_ALLOCATED; public: // The type of this ResourceRequest, based on how the resource will be used. enum TargetType { @@ -207,7 +208,10 @@ namespace WebCore { inline bool operator==(const ResourceRequest& a, const ResourceRequest& b) { return ResourceRequestBase::compare(a, b); } inline bool operator!=(ResourceRequest& a, const ResourceRequest& b) { return !(a == b); } - struct CrossThreadResourceRequestDataBase : Noncopyable { + struct CrossThreadResourceRequestDataBase { + WTF_MAKE_NONCOPYABLE(CrossThreadResourceRequestDataBase); WTF_MAKE_FAST_ALLOCATED; + public: + CrossThreadResourceRequestDataBase() { } KURL m_url; ResourceRequestCachePolicy m_cachePolicy; diff --git a/Source/WebCore/platform/network/ResourceResponseBase.h b/Source/WebCore/platform/network/ResourceResponseBase.h index 9c54bab..e0774c2 100644 --- a/Source/WebCore/platform/network/ResourceResponseBase.h +++ b/Source/WebCore/platform/network/ResourceResponseBase.h @@ -41,7 +41,8 @@ class ResourceResponse; struct CrossThreadResourceResponseData; // Do not use this class directly, use the class ResponseResponse instead -class ResourceResponseBase : public FastAllocBase { +class ResourceResponseBase { + WTF_MAKE_FAST_ALLOCATED; public: static PassOwnPtr<ResourceResponse> adopt(PassOwnPtr<CrossThreadResourceResponseData>); @@ -175,7 +176,10 @@ private: inline bool operator==(const ResourceResponse& a, const ResourceResponse& b) { return ResourceResponseBase::compare(a, b); } inline bool operator!=(const ResourceResponse& a, const ResourceResponse& b) { return !(a == b); } -struct CrossThreadResourceResponseDataBase : Noncopyable { +struct CrossThreadResourceResponseDataBase { + WTF_MAKE_NONCOPYABLE(CrossThreadResourceResponseDataBase); +public: + CrossThreadResourceResponseDataBase() { } KURL m_url; String m_mimeType; long long m_expectedContentLength; diff --git a/Source/WebCore/platform/network/cf/CookieJarCFNet.cpp b/Source/WebCore/platform/network/cf/CookieJarCFNet.cpp index 659b719..c6d513a 100644 --- a/Source/WebCore/platform/network/cf/CookieJarCFNet.cpp +++ b/Source/WebCore/platform/network/cf/CookieJarCFNet.cpp @@ -34,6 +34,7 @@ #include "KURL.h" #include "PlatformString.h" #include "ResourceHandle.h" +#include "SoftLinking.h" #include <CFNetwork/CFHTTPCookiesPriv.h> #include <CoreFoundation/CoreFoundation.h> #include <WebKitSystemInterface/WebKitSystemInterface.h> @@ -44,6 +45,53 @@ namespace WebCore { static const CFStringRef s_setCookieKeyCF = CFSTR("Set-Cookie"); static const CFStringRef s_cookieCF = CFSTR("Cookie"); +#ifdef DEBUG_ALL +SOFT_LINK_DEBUG_LIBRARY(CFNetwork) +#else +SOFT_LINK_LIBRARY(CFNetwork) +#endif + +SOFT_LINK_OPTIONAL(CFNetwork, CFHTTPCookieCopyDomain, CFStringRef, __cdecl, (CFHTTPCookieRef)) +SOFT_LINK_OPTIONAL(CFNetwork, CFHTTPCookieGetExpirationTime, CFAbsoluteTime, __cdecl, (CFHTTPCookieRef)) +SOFT_LINK_OPTIONAL(CFNetwork, CFHTTPCookieCopyName, CFStringRef, __cdecl, (CFHTTPCookieRef)) +SOFT_LINK_OPTIONAL(CFNetwork, CFHTTPCookieCopyPath, CFStringRef, __cdecl, (CFHTTPCookieRef)) +SOFT_LINK_OPTIONAL(CFNetwork, CFHTTPCookieCopyValue, CFStringRef, __cdecl, (CFHTTPCookieRef)) + +static inline RetainPtr<CFStringRef> cookieDomain(CFHTTPCookieRef cookie) +{ + if (CFHTTPCookieCopyDomainPtr()) + return RetainPtr<CFStringRef>(AdoptCF, CFHTTPCookieCopyDomainPtr()(cookie)); + return CFHTTPCookieGetDomain(cookie); +} + +static inline CFAbsoluteTime cookieExpirationTime(CFHTTPCookieRef cookie) +{ + if (CFHTTPCookieGetExpirationTimePtr()) + return CFHTTPCookieGetExpirationTimePtr()(cookie); + return CFDateGetAbsoluteTime(CFHTTPCookieGetExpiratonDate(cookie)); +} + +static inline RetainPtr<CFStringRef> cookieName(CFHTTPCookieRef cookie) +{ + if (CFHTTPCookieCopyNamePtr()) + return RetainPtr<CFStringRef>(AdoptCF, CFHTTPCookieCopyNamePtr()(cookie)); + return CFHTTPCookieGetName(cookie); +} + +static inline RetainPtr<CFStringRef> cookiePath(CFHTTPCookieRef cookie) +{ + if (CFHTTPCookieCopyPathPtr()) + return RetainPtr<CFStringRef>(AdoptCF, CFHTTPCookieCopyPathPtr()(cookie)); + return CFHTTPCookieGetPath(cookie); +} + +static inline RetainPtr<CFStringRef> cookieValue(CFHTTPCookieRef cookie) +{ + if (CFHTTPCookieCopyValuePtr()) + return RetainPtr<CFStringRef>(AdoptCF, CFHTTPCookieCopyValuePtr()(cookie)); + return CFHTTPCookieGetValue(cookie); +} + static RetainPtr<CFArrayRef> filterCookies(CFArrayRef unfilteredCookies) { CFIndex count = CFArrayGetCount(unfilteredCookies); @@ -55,7 +103,7 @@ static RetainPtr<CFArrayRef> filterCookies(CFArrayRef unfilteredCookies) // which would be sent as "Cookie: =". We have a workaround in setCookies() to prevent // that, but we also need to avoid sending cookies that were previously stored, and // there's no harm to doing this check because such a cookie is never valid. - if (!CFStringGetLength(CFHTTPCookieGetName(cookie))) + if (!CFStringGetLength(cookieName(cookie).get())) continue; if (CFHTTPCookieIsHTTPOnly(cookie)) @@ -147,12 +195,12 @@ bool getRawCookies(const Document*, const KURL& url, Vector<Cookie>& rawCookies) for (CFIndex i = 0; i < count; i++) { CFHTTPCookieRef cookie = (CFHTTPCookieRef)CFArrayGetValueAtIndex(cookiesCF.get(), i); - String name = CFHTTPCookieGetName(cookie); - String value = CFHTTPCookieGetValue(cookie); - String domain = CFHTTPCookieGetDomain(cookie); - String path = CFHTTPCookieGetPath(cookie); + String name = cookieName(cookie).get(); + String value = cookieValue(cookie).get(); + String domain = cookieDomain(cookie).get(); + String path = cookiePath(cookie).get(); - double expires = (CFDateGetAbsoluteTime(CFHTTPCookieGetExpiratonDate(cookie)) + kCFAbsoluteTimeIntervalSince1970) * 1000; + double expires = (cookieExpirationTime(cookie) + kCFAbsoluteTimeIntervalSince1970) * 1000; bool httpOnly = CFHTTPCookieIsHTTPOnly(cookie); bool secure = CFHTTPCookieIsSecure(cookie); @@ -178,8 +226,7 @@ void deleteCookie(const Document*, const KURL& url, const String& name) CFIndex count = CFArrayGetCount(cookiesCF.get()); for (CFIndex i = 0; i < count; i++) { CFHTTPCookieRef cookie = (CFHTTPCookieRef)CFArrayGetValueAtIndex(cookiesCF.get(), i); - String cookieName = CFHTTPCookieGetName(cookie); - if (cookieName == name) { + if (String(cookieName(cookie).get()) == name) { CFHTTPCookieStorageDeleteCookie(cookieStorage, cookie); break; } diff --git a/Source/WebCore/platform/network/chromium/CookieJarChromium.cpp b/Source/WebCore/platform/network/chromium/CookieJarChromium.cpp index e17816a..2f2489b 100644 --- a/Source/WebCore/platform/network/chromium/CookieJarChromium.cpp +++ b/Source/WebCore/platform/network/chromium/CookieJarChromium.cpp @@ -32,39 +32,39 @@ #include "CookieJar.h" #include "Cookie.h" -#include "ChromiumBridge.h" #include "Document.h" +#include "PlatformBridge.h" namespace WebCore { void setCookies(Document* document, const KURL& url, const String& value) { - ChromiumBridge::setCookies(document, url, value); + PlatformBridge::setCookies(document, url, value); } String cookies(const Document* document, const KURL& url) { - return ChromiumBridge::cookies(document, url); + return PlatformBridge::cookies(document, url); } String cookieRequestHeaderFieldValue(const Document* document, const KURL& url) { - return ChromiumBridge::cookieRequestHeaderFieldValue(document, url); + return PlatformBridge::cookieRequestHeaderFieldValue(document, url); } bool cookiesEnabled(const Document* document) { - return ChromiumBridge::cookiesEnabled(document); + return PlatformBridge::cookiesEnabled(document); } bool getRawCookies(const Document* document, const KURL& url, Vector<Cookie>& rawCookies) { - return ChromiumBridge::rawCookies(document, url, rawCookies); + return PlatformBridge::rawCookies(document, url, rawCookies); } void deleteCookie(const Document* document, const KURL& url, const String& cookieName) { - return ChromiumBridge::deleteCookie(document, url, cookieName); + return PlatformBridge::deleteCookie(document, url, cookieName); } } // namespace WebCore diff --git a/Source/WebCore/platform/network/chromium/DNSChromium.cpp b/Source/WebCore/platform/network/chromium/DNSChromium.cpp index 21fcd46..7b9eac5 100644 --- a/Source/WebCore/platform/network/chromium/DNSChromium.cpp +++ b/Source/WebCore/platform/network/chromium/DNSChromium.cpp @@ -26,14 +26,14 @@ #include "config.h" #include "DNS.h" -#include "ChromiumBridge.h" +#include "PlatformBridge.h" #include "ResourceHandle.h" namespace WebCore { void prefetchDNS(const String& hostname) { - ChromiumBridge::prefetchDNS(hostname); + PlatformBridge::prefetchDNS(hostname); } void ResourceHandle::prepareForURL(const KURL& url) diff --git a/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp b/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp index ebb6c5f..a7170fe 100644 --- a/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp +++ b/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp @@ -60,7 +60,8 @@ namespace WebCore { #define READ_BUFFER_SIZE 8192 -class WebCoreSynchronousLoader : public ResourceHandleClient, public Noncopyable { +class WebCoreSynchronousLoader : public ResourceHandleClient { + WTF_MAKE_NONCOPYABLE(WebCoreSynchronousLoader); public: WebCoreSynchronousLoader(ResourceError&, ResourceResponse &, Vector<char>&); ~WebCoreSynchronousLoader(); diff --git a/Source/WebCore/platform/network/win/ResourceHandleWin.cpp b/Source/WebCore/platform/network/win/ResourceHandleWin.cpp index 38d9cd1..f50540c 100644 --- a/Source/WebCore/platform/network/win/ResourceHandleWin.cpp +++ b/Source/WebCore/platform/network/win/ResourceHandleWin.cpp @@ -76,7 +76,8 @@ static String queryHTTPHeader(HINTERNET requestHandle, DWORD infoLevel) } -class WebCoreSynchronousLoader : public ResourceHandleClient, public Noncopyable { +class WebCoreSynchronousLoader : public ResourceHandleClient { + WTF_MAKE_NONCOPYABLE(WebCoreSynchronousLoader); public: WebCoreSynchronousLoader(ResourceError&, ResourceResponse&, Vector<char>&, const String& userAgent); ~WebCoreSynchronousLoader(); diff --git a/Source/WebCore/platform/qt/ClipboardQt.h b/Source/WebCore/platform/qt/ClipboardQt.h index 5aca1a6..fb5abef 100644 --- a/Source/WebCore/platform/qt/ClipboardQt.h +++ b/Source/WebCore/platform/qt/ClipboardQt.h @@ -39,6 +39,7 @@ namespace WebCore { // State available during IE's events for drag and drop and copy/paste class ClipboardQt : public Clipboard, public CachedResourceClient { + WTF_MAKE_FAST_ALLOCATED; public: static PassRefPtr<ClipboardQt> create(ClipboardAccessPolicy policy, const QMimeData* readableClipboard) { diff --git a/Source/WebCore/platform/qt/PlatformBridge.h b/Source/WebCore/platform/qt/PlatformBridge.h index e478d8f..9647507 100644 --- a/Source/WebCore/platform/qt/PlatformBridge.h +++ b/Source/WebCore/platform/qt/PlatformBridge.h @@ -86,7 +86,7 @@ class Widget; // An interface to the embedding layer, which has the ability to answer // questions about the system and so on... -// This is very similar to ChromiumBridge and the two are likely to converge +// This is very similar to chromium/PlatformBridge and the two are likely to converge // in the future. class PlatformBridge { public: diff --git a/Source/WebCore/platform/qt/ScrollbarQt.cpp b/Source/WebCore/platform/qt/ScrollbarQt.cpp index a517064..dda82e9 100644 --- a/Source/WebCore/platform/qt/ScrollbarQt.cpp +++ b/Source/WebCore/platform/qt/ScrollbarQt.cpp @@ -34,6 +34,7 @@ #include "GraphicsContext.h" #include "IntRect.h" #include "PlatformMouseEvent.h" +#include "ScrollableArea.h" #include "ScrollbarTheme.h" #include <QApplication> @@ -76,17 +77,17 @@ bool Scrollbar::contextMenu(const PlatformMouseEvent& event) const QPoint pos = convertFromContainingWindow(event.pos()); moveThumb(horizontal ? pos.x() : pos.y()); } else if (actionSelected == actScrollTop) - scroll(horizontal ? ScrollLeft : ScrollUp, ScrollByDocument); + scrollableArea()->scroll(horizontal ? ScrollLeft : ScrollUp, ScrollByDocument); else if (actionSelected == actScrollBottom) - scroll(horizontal ? ScrollRight : ScrollDown, ScrollByDocument); + scrollableArea()->scroll(horizontal ? ScrollRight : ScrollDown, ScrollByDocument); else if (actionSelected == actPageUp) - scroll(horizontal ? ScrollLeft : ScrollUp, ScrollByPage); + scrollableArea()->scroll(horizontal ? ScrollLeft : ScrollUp, ScrollByPage); else if (actionSelected == actPageDown) - scroll(horizontal ? ScrollRight : ScrollDown, ScrollByPage); + scrollableArea()->scroll(horizontal ? ScrollRight : ScrollDown, ScrollByPage); else if (actionSelected == actScrollUp) - scroll(horizontal ? ScrollLeft : ScrollUp, ScrollByLine); + scrollableArea()->scroll(horizontal ? ScrollLeft : ScrollUp, ScrollByLine); else if (actionSelected == actScrollDown) - scroll(horizontal ? ScrollRight : ScrollDown, ScrollByLine); + scrollableArea()->scroll(horizontal ? ScrollRight : ScrollDown, ScrollByLine); #endif // QT_NO_CONTEXTMENU return true; } diff --git a/Source/WebCore/platform/sql/SQLiteDatabase.h b/Source/WebCore/platform/sql/SQLiteDatabase.h index c329273..da53acc 100644 --- a/Source/WebCore/platform/sql/SQLiteDatabase.h +++ b/Source/WebCore/platform/sql/SQLiteDatabase.h @@ -50,7 +50,8 @@ extern const int SQLResultSchema; extern const int SQLResultFull; extern const int SQLResultInterrupt; -class SQLiteDatabase : public Noncopyable { +class SQLiteDatabase { + WTF_MAKE_NONCOPYABLE(SQLiteDatabase); friend class SQLiteTransaction; public: SQLiteDatabase(); diff --git a/Source/WebCore/platform/sql/SQLiteStatement.h b/Source/WebCore/platform/sql/SQLiteStatement.h index 1444f0e..fd1abfb 100644 --- a/Source/WebCore/platform/sql/SQLiteStatement.h +++ b/Source/WebCore/platform/sql/SQLiteStatement.h @@ -34,7 +34,8 @@ namespace WebCore { class SQLValue; -class SQLiteStatement : public Noncopyable { +class SQLiteStatement { + WTF_MAKE_NONCOPYABLE(SQLiteStatement); WTF_MAKE_FAST_ALLOCATED; public: SQLiteStatement(SQLiteDatabase&, const String&); ~SQLiteStatement(); diff --git a/Source/WebCore/platform/sql/SQLiteTransaction.h b/Source/WebCore/platform/sql/SQLiteTransaction.h index 924241f..ba686ba 100644 --- a/Source/WebCore/platform/sql/SQLiteTransaction.h +++ b/Source/WebCore/platform/sql/SQLiteTransaction.h @@ -26,14 +26,15 @@ #ifndef SQLiteTransaction_h #define SQLiteTransaction_h +#include <wtf/FastAllocBase.h> #include <wtf/Noncopyable.h> namespace WebCore { class SQLiteDatabase; -class SQLiteTransaction : public Noncopyable -{ +class SQLiteTransaction { + WTF_MAKE_NONCOPYABLE(SQLiteTransaction); WTF_MAKE_FAST_ALLOCATED; public: SQLiteTransaction(SQLiteDatabase& db, bool readOnly = false); ~SQLiteTransaction(); diff --git a/Source/WebCore/platform/sql/chromium/SQLiteFileSystemChromium.cpp b/Source/WebCore/platform/sql/chromium/SQLiteFileSystemChromium.cpp index 0a09888..b79eb1a 100644 --- a/Source/WebCore/platform/sql/chromium/SQLiteFileSystemChromium.cpp +++ b/Source/WebCore/platform/sql/chromium/SQLiteFileSystemChromium.cpp @@ -31,7 +31,7 @@ #include "config.h" #include "SQLiteFileSystem.h" -#include "ChromiumBridge.h" +#include "PlatformBridge.h" #include "SQLiteDatabase.h" #include <sqlite3.h> #include <wtf/text/CString.h> @@ -92,12 +92,12 @@ bool SQLiteFileSystem::deleteEmptyDatabaseDirectory(const String&) bool SQLiteFileSystem::deleteDatabaseFile(const String& fileName) { - return (ChromiumBridge::databaseDeleteFile(fileName) == SQLITE_OK); + return (PlatformBridge::databaseDeleteFile(fileName) == SQLITE_OK); } long long SQLiteFileSystem::getDatabaseFileSize(const String& fileName) { - return ChromiumBridge::databaseGetFileSize(fileName); + return PlatformBridge::databaseGetFileSize(fileName); } } // namespace WebCore diff --git a/Source/WebCore/platform/sql/chromium/SQLiteFileSystemChromiumPosix.cpp b/Source/WebCore/platform/sql/chromium/SQLiteFileSystemChromiumPosix.cpp index 1102df5..37f96be 100644 --- a/Source/WebCore/platform/sql/chromium/SQLiteFileSystemChromiumPosix.cpp +++ b/Source/WebCore/platform/sql/chromium/SQLiteFileSystemChromiumPosix.cpp @@ -31,7 +31,7 @@ #include "config.h" #include "SQLiteFileSystem.h" -#include "ChromiumBridge.h" +#include "PlatformBridge.h" #include <sqlite3.h> #include <errno.h> @@ -996,10 +996,10 @@ static int chromiumOpen(sqlite3_vfs* vfs, const char* fileName, } if (fd < 0) { - fd = ChromiumBridge::databaseOpenFile(fileName, desiredFlags); + fd = PlatformBridge::databaseOpenFile(fileName, desiredFlags); if ((fd < 0) && (desiredFlags & SQLITE_OPEN_READWRITE)) { int newFlags = (desiredFlags & ~(SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE)) | SQLITE_OPEN_READONLY; - fd = ChromiumBridge::databaseOpenFile(fileName, newFlags); + fd = PlatformBridge::databaseOpenFile(fileName, newFlags); } } if (fd < 0) { @@ -1031,7 +1031,7 @@ static int chromiumOpen(sqlite3_vfs* vfs, const char* fileName, // should be synched after the file is deleted. static int chromiumDelete(sqlite3_vfs*, const char* fileName, int syncDir) { - return ChromiumBridge::databaseDeleteFile(fileName, syncDir); + return PlatformBridge::databaseDeleteFile(fileName, syncDir); } // Check the existance and status of the given file. @@ -1042,7 +1042,7 @@ static int chromiumDelete(sqlite3_vfs*, const char* fileName, int syncDir) // res - the result. static int chromiumAccess(sqlite3_vfs*, const char* fileName, int flag, int* res) { - int attr = static_cast<int>(ChromiumBridge::databaseGetFileAttributes(fileName)); + int attr = static_cast<int>(PlatformBridge::databaseGetFileAttributes(fileName)); if (attr < 0) { *res = 0; return SQLITE_OK; diff --git a/Source/WebCore/platform/sql/chromium/SQLiteFileSystemChromiumWin.cpp b/Source/WebCore/platform/sql/chromium/SQLiteFileSystemChromiumWin.cpp index d846af7..47e01d0 100644 --- a/Source/WebCore/platform/sql/chromium/SQLiteFileSystemChromiumWin.cpp +++ b/Source/WebCore/platform/sql/chromium/SQLiteFileSystemChromiumWin.cpp @@ -31,7 +31,7 @@ #include "config.h" #include "SQLiteFileSystem.h" -#include "ChromiumBridge.h" +#include "PlatformBridge.h" #include <sqlite3.h> #include <windows.h> @@ -55,7 +55,7 @@ namespace { int chromiumOpen(sqlite3_vfs*, const char* fileName, sqlite3_file* id, int desiredFlags, int* usedFlags) { - HANDLE h = ChromiumBridge::databaseOpenFile(fileName, desiredFlags); + HANDLE h = PlatformBridge::databaseOpenFile(fileName, desiredFlags); if (h == INVALID_HANDLE_VALUE) { if (desiredFlags & SQLITE_OPEN_READWRITE) { int newFlags = (desiredFlags | SQLITE_OPEN_READONLY) & ~SQLITE_OPEN_READWRITE; @@ -82,7 +82,7 @@ int chromiumOpen(sqlite3_vfs*, const char* fileName, // should be synched after the file is deleted. int chromiumDelete(sqlite3_vfs*, const char* fileName, int) { - return ChromiumBridge::databaseDeleteFile(fileName); + return PlatformBridge::databaseDeleteFile(fileName); } // Check the existance and status of the given file. @@ -93,7 +93,7 @@ int chromiumDelete(sqlite3_vfs*, const char* fileName, int) // res - the result. int chromiumAccess(sqlite3_vfs*, const char* fileName, int flag, int* res) { - DWORD attr = ChromiumBridge::databaseGetFileAttributes(fileName); + DWORD attr = PlatformBridge::databaseGetFileAttributes(fileName); switch (flag) { case SQLITE_ACCESS_READ: case SQLITE_ACCESS_EXISTS: diff --git a/Source/WebCore/platform/text/BidiResolver.h b/Source/WebCore/platform/text/BidiResolver.h index 1f87115..8abd698 100644 --- a/Source/WebCore/platform/text/BidiResolver.h +++ b/Source/WebCore/platform/text/BidiResolver.h @@ -126,7 +126,8 @@ struct BidiCharacterRun { BidiCharacterRun* m_next; }; -template <class Iterator, class Run> class BidiResolver : public Noncopyable { +template <class Iterator, class Run> class BidiResolver { + WTF_MAKE_NONCOPYABLE(BidiResolver); public : BidiResolver() : m_direction(WTF::Unicode::OtherNeutral) @@ -314,23 +315,13 @@ void BidiResolver<Iterator, Run>::checkDirectionInLowerRaiseEmbeddingLevel() using namespace WTF::Unicode; ASSERT(m_status.eor != OtherNeutral || eor.atEnd()); - // bidi.sor ... bidi.eor ... bidi.last eor; need to append the bidi.sor-bidi.eor run or extend it through bidi.last - // Bidi control characters are included into BidiRun, so last direction - // could be one of the bidi embeddings when there are nested embeddings. - // For example: "‪‫....." - ASSERT(m_status.last == EuropeanNumberSeparator - || m_status.last == EuropeanNumberTerminator - || m_status.last == CommonNumberSeparator - || m_status.last == BoundaryNeutral - || m_status.last == BlockSeparator - || m_status.last == SegmentSeparator - || m_status.last == WhiteSpaceNeutral - || m_status.last == OtherNeutral - || m_status.last == RightToLeftEmbedding - || m_status.last == LeftToRightEmbedding - || m_status.last == RightToLeftOverride - || m_status.last == LeftToRightOverride - || m_status.last == PopDirectionalFormat); + ASSERT(m_status.last != NonSpacingMark + && m_status.last != BoundaryNeutral + && m_status.last != RightToLeftEmbedding + && m_status.last != LeftToRightEmbedding + && m_status.last != RightToLeftOverride + && m_status.last != LeftToRightOverride + && m_status.last != PopDirectionalFormat); if (m_direction == OtherNeutral) m_direction = m_status.lastStrong == LeftToRight ? LeftToRight : RightToLeft; } @@ -342,6 +333,7 @@ void BidiResolver<Iterator, Run>::lowerExplicitEmbeddingLevel(WTF::Unicode::Dire if (!emptyRun && eor != last) { checkDirectionInLowerRaiseEmbeddingLevel(); + // bidi.sor ... bidi.eor ... bidi.last eor; need to append the bidi.sor-bidi.eor run or extend it through bidi.last if (from == LeftToRight) { // bidi.sor ... bidi.eor ... bidi.last L if (m_status.eor == EuropeanNumber) { @@ -377,6 +369,7 @@ void BidiResolver<Iterator, Run>::raiseExplicitEmbeddingLevel(WTF::Unicode::Dire if (!emptyRun && eor != last) { checkDirectionInLowerRaiseEmbeddingLevel(); + // bidi.sor ... bidi.eor ... bidi.last eor; need to append the bidi.sor-bidi.eor run or extend it through bidi.last if (to == LeftToRight) { // bidi.sor ... bidi.eor ... bidi.last L if (m_status.eor == EuropeanNumber) { @@ -866,6 +859,11 @@ void BidiResolver<Iterator, Run>::createBidiRunsForLine(const Iterator& end, boo break; case NonSpacingMark: case BoundaryNeutral: + case RightToLeftEmbedding: + case LeftToRightEmbedding: + case RightToLeftOverride: + case LeftToRightOverride: + case PopDirectionalFormat: // ignore these break; case EuropeanNumber: diff --git a/Source/WebCore/platform/text/RegularExpression.h b/Source/WebCore/platform/text/RegularExpression.h index f1611e5..536ed48 100644 --- a/Source/WebCore/platform/text/RegularExpression.h +++ b/Source/WebCore/platform/text/RegularExpression.h @@ -30,7 +30,8 @@ namespace WebCore { -class RegularExpression : public FastAllocBase { +class RegularExpression { + WTF_MAKE_FAST_ALLOCATED; public: RegularExpression(const String&, TextCaseSensitivity); ~RegularExpression(); diff --git a/Source/WebCore/platform/text/SegmentedString.cpp b/Source/WebCore/platform/text/SegmentedString.cpp index a371582..5e9755b 100644 --- a/Source/WebCore/platform/text/SegmentedString.cpp +++ b/Source/WebCore/platform/text/SegmentedString.cpp @@ -246,7 +246,8 @@ void SegmentedString::advanceSlowCase(int& lineNumber) if (*m_currentString.m_current++ == '\n' && m_currentString.doNotExcludeLineNumbers()) { ++lineNumber; ++m_currentLine; - m_numberOfCharactersConsumedPriorToCurrentLine = numberOfCharactersConsumed(); + // Plus 1 because numberOfCharactersConsumed value hasn't incremented yet; it does with m_length decrement below. + m_numberOfCharactersConsumedPriorToCurrentLine = numberOfCharactersConsumed() + 1; } if (--m_currentString.m_length == 0) advanceSubstring(); diff --git a/Source/WebCore/platform/text/SegmentedString.h b/Source/WebCore/platform/text/SegmentedString.h index 5f548c7..30c899d 100644 --- a/Source/WebCore/platform/text/SegmentedString.h +++ b/Source/WebCore/platform/text/SegmentedString.h @@ -164,7 +164,7 @@ public: lineNumber += newLineFlag; m_currentLine += newLineFlag; if (newLineFlag) - m_numberOfCharactersConsumedPriorToCurrentLine = numberOfCharactersConsumed(); + m_numberOfCharactersConsumedPriorToCurrentLine = numberOfCharactersConsumed() + 1; --m_currentString.m_length; m_currentChar = ++m_currentString.m_current; return; diff --git a/Source/WebCore/platform/text/TextCodec.h b/Source/WebCore/platform/text/TextCodec.h index c6af38a..35229a3 100644 --- a/Source/WebCore/platform/text/TextCodec.h +++ b/Source/WebCore/platform/text/TextCodec.h @@ -57,8 +57,10 @@ namespace WebCore { typedef char UnencodableReplacementArray[32]; - class TextCodec : public Noncopyable { + class TextCodec { + WTF_MAKE_NONCOPYABLE(TextCodec); WTF_MAKE_FAST_ALLOCATED; public: + TextCodec() { } virtual ~TextCodec(); String decode(const char* str, size_t length, bool flush = false) diff --git a/Source/WebCore/platform/text/transcoder/FontTranscoder.h b/Source/WebCore/platform/text/transcoder/FontTranscoder.h index 67db977..6990a10 100644 --- a/Source/WebCore/platform/text/transcoder/FontTranscoder.h +++ b/Source/WebCore/platform/text/transcoder/FontTranscoder.h @@ -40,7 +40,8 @@ namespace WebCore { class FontDescription; class TextEncoding; -class FontTranscoder : public Noncopyable { +class FontTranscoder { + WTF_MAKE_NONCOPYABLE(FontTranscoder); WTF_MAKE_FAST_ALLOCATED; public: void convert(String& text, const FontDescription&, const TextEncoding* = 0) const; bool needsTranscoding(const FontDescription&, const TextEncoding* = 0) const; diff --git a/Source/WebCore/platform/win/ClipboardWin.h b/Source/WebCore/platform/win/ClipboardWin.h index ce64b85..779da26 100644 --- a/Source/WebCore/platform/win/ClipboardWin.h +++ b/Source/WebCore/platform/win/ClipboardWin.h @@ -41,6 +41,7 @@ class WCDataObject; // State available during IE's events for drag and drop and copy/paste class ClipboardWin : public Clipboard, public CachedResourceClient { + WTF_MAKE_FAST_ALLOCATED; public: static PassRefPtr<ClipboardWin> create(ClipboardType clipboardType, IDataObject* dataObject, ClipboardAccessPolicy policy, Frame* frame) { diff --git a/Source/WebCore/platform/win/PopupMenuWin.cpp b/Source/WebCore/platform/win/PopupMenuWin.cpp index e86aef9..15871e6 100644 --- a/Source/WebCore/platform/win/PopupMenuWin.cpp +++ b/Source/WebCore/platform/win/PopupMenuWin.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2006, 2007, 2008, 2011 Apple Inc. All rights reserved. * Copyright (C) 2007-2009 Torch Mobile Inc. * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). * @@ -40,6 +40,7 @@ #include "Scrollbar.h" #include "ScrollbarTheme.h" #include "SimpleFontData.h" +#include "TextRun.h" #include "WebCoreInstanceHandle.h" #include <tchar.h> #include <windows.h> @@ -531,12 +532,12 @@ bool PopupMenuWin::scrollToRevealSelection() int index = focusedIndex(); if (index < m_scrollOffset) { - m_scrollbar->setValue(index, Scrollbar::NotFromScrollAnimator); + ScrollableArea::scrollToYOffsetWithoutAnimation(index); return true; } if (index >= m_scrollOffset + visibleItems()) { - m_scrollbar->setValue(index - visibleItems() + 1, Scrollbar::NotFromScrollAnimator); + ScrollableArea::scrollToYOffsetWithoutAnimation(index - visibleItems() + 1); return true; } @@ -669,21 +670,23 @@ int PopupMenuWin::scrollSize(ScrollbarOrientation orientation) const return ((orientation == VerticalScrollbar) && m_scrollbar) ? (m_scrollbar->totalSize() - m_scrollbar->visibleSize()) : 0; } -void PopupMenuWin::setScrollOffsetFromAnimation(const IntPoint& offset) +int PopupMenuWin::scrollPosition(Scrollbar*) const { - if (m_scrollbar) - m_scrollbar->setValue(offset.y(), Scrollbar::FromScrollAnimator); + return m_scrollOffset; +} + +void PopupMenuWin::setScrollOffset(const IntPoint& offset) +{ + scrollTo(offset.y()); } -void PopupMenuWin::valueChanged(Scrollbar* scrollBar) +void PopupMenuWin::scrollTo(int offset) { ASSERT(m_scrollbar); if (!m_popup) return; - int offset = scrollBar->value(); - if (m_scrollOffset == offset) return; @@ -990,7 +993,8 @@ LRESULT PopupMenuWin::wndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa else --i; } - scrollbar()->scroll(i > 0 ? ScrollUp : ScrollDown, ScrollByLine, abs(i)); + + ScrollableArea::scroll(i > 0 ? ScrollUp : ScrollDown, ScrollByLine, abs(i)); break; } diff --git a/Source/WebCore/platform/win/PopupMenuWin.h b/Source/WebCore/platform/win/PopupMenuWin.h index bfec7aa..0d7630c 100644 --- a/Source/WebCore/platform/win/PopupMenuWin.h +++ b/Source/WebCore/platform/win/PopupMenuWin.h @@ -1,4 +1,5 @@ /* + * Copyright (C) 2011 Apple Inc. All rights reserved. * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). * * This library is free software; you can redistribute it and/or @@ -23,8 +24,8 @@ #include "IntRect.h" #include "PopupMenu.h" #include "PopupMenuClient.h" +#include "ScrollableArea.h" #include "Scrollbar.h" -#include "ScrollbarClient.h" #include <wtf/PassRefPtr.h> #include <wtf/RefCounted.h> #include <wtf/RefPtr.h> @@ -38,7 +39,7 @@ namespace WebCore { class FrameView; class Scrollbar; -class PopupMenuWin : public PopupMenu, private ScrollbarClient { +class PopupMenuWin : public PopupMenu, private ScrollableArea { public: PopupMenuWin(PopupMenuClient*); ~PopupMenuWin(); @@ -78,7 +79,6 @@ private: void setWasClicked(bool b = true) { m_wasClicked = b; } bool wasClicked() const { return m_wasClicked; } - void setScrollOffset(int offset) { m_scrollOffset = offset; } int scrollOffset() const { return m_scrollOffset; } bool scrollToRevealSelection(); @@ -90,13 +90,17 @@ private: bool scrollbarCapturingMouse() const { return m_scrollbarCapturingMouse; } void setScrollbarCapturingMouse(bool b) { m_scrollbarCapturingMouse = b; } - // ScrollBarClient + // ScrollableArea virtual int scrollSize(ScrollbarOrientation orientation) const; - virtual void setScrollOffsetFromAnimation(const IntPoint&); - virtual void valueChanged(Scrollbar*); + virtual int scrollPosition(Scrollbar*) const; + virtual void setScrollOffset(const IntPoint&); virtual void invalidateScrollbarRect(Scrollbar*, const IntRect&); virtual bool isActive() const { return true; } virtual bool scrollbarCornerPresent() const { return false; } + virtual Scrollbar* verticalScrollbar() const { return m_scrollbar.get(); } + + // NOTE: This should only be called by the overriden setScrollOffset from ScrollableArea. + void scrollTo(int offset); void calculatePositionAndSize(const IntRect&, FrameView*); void invalidateItem(int index); @@ -120,6 +124,6 @@ private: bool m_showPopup; }; -} +} // namespace WebCore #endif // PopupMenuWin_h diff --git a/Source/WebCore/platform/win/ScrollbarThemeSafari.cpp b/Source/WebCore/platform/win/ScrollbarThemeSafari.cpp index 4e979f2..343bbb2 100644 --- a/Source/WebCore/platform/win/ScrollbarThemeSafari.cpp +++ b/Source/WebCore/platform/win/ScrollbarThemeSafari.cpp @@ -32,8 +32,8 @@ #include "IntRect.h" #include "Page.h" #include "PlatformMouseEvent.h" +#include "ScrollableArea.h" #include "Scrollbar.h" -#include "ScrollbarClient.h" #include "ScrollbarThemeWin.h" #include "Settings.h" #include "SoftLinking.h" @@ -209,7 +209,7 @@ void ScrollbarThemeSafari::paintTrackBackground(GraphicsContext* graphicsContext return; NSControlSize size = scrollbar->controlSize() == SmallScrollbar ? NSSmallControlSize : NSRegularControlSize; ThemeControlState state = 0; - if (scrollbar->client()->isActive()) + if (scrollbar->scrollableArea()->isActive()) state |= ActiveState; if (hasButtons(scrollbar)) state |= EnabledState; @@ -222,7 +222,7 @@ void ScrollbarThemeSafari::paintButton(GraphicsContext* graphicsContext, Scrollb return; NSControlSize size = scrollbar->controlSize() == SmallScrollbar ? NSSmallControlSize : NSRegularControlSize; ThemeControlState state = 0; - if (scrollbar->client()->isActive()) + if (scrollbar->scrollableArea()->isActive()) state |= ActiveState; if (hasButtons(scrollbar)) state |= EnabledState; @@ -242,7 +242,7 @@ void ScrollbarThemeSafari::paintThumb(GraphicsContext* graphicsContext, Scrollba return; NSControlSize size = scrollbar->controlSize() == SmallScrollbar ? NSSmallControlSize : NSRegularControlSize; ThemeControlState state = 0; - if (scrollbar->client()->isActive()) + if (scrollbar->scrollableArea()->isActive()) state |= ActiveState; if (hasThumb(scrollbar)) state |= EnabledState; diff --git a/Source/WebCore/platform/win/WebCoreTextRenderer.cpp b/Source/WebCore/platform/win/WebCoreTextRenderer.cpp index a32fa4f..e96ba31 100644 --- a/Source/WebCore/platform/win/WebCoreTextRenderer.cpp +++ b/Source/WebCore/platform/win/WebCoreTextRenderer.cpp @@ -29,6 +29,7 @@ #include "FontDescription.h" #include "GraphicsContext.h" #include "StringTruncator.h" +#include "TextRun.h" #include <wtf/unicode/Unicode.h> namespace WebCore { diff --git a/Source/WebCore/platform/win/WindowMessageBroadcaster.h b/Source/WebCore/platform/win/WindowMessageBroadcaster.h index e7856e7..d36c233 100644 --- a/Source/WebCore/platform/win/WindowMessageBroadcaster.h +++ b/Source/WebCore/platform/win/WindowMessageBroadcaster.h @@ -31,13 +31,13 @@ #include <wtf/HashMap.h> #include <wtf/HashSet.h> -#include <wtf/Noncopyable.h> namespace WebCore { class WindowMessageListener; - class WindowMessageBroadcaster : public Noncopyable { + class WindowMessageBroadcaster { + WTF_MAKE_NONCOPYABLE(WindowMessageBroadcaster); public: static void addListener(HWND, WindowMessageListener*); static void removeListener(HWND, WindowMessageListener*); diff --git a/Source/WebCore/platform/wx/ScrollbarThemeWx.cpp b/Source/WebCore/platform/wx/ScrollbarThemeWx.cpp index 82e4a15..957f958 100644 --- a/Source/WebCore/platform/wx/ScrollbarThemeWx.cpp +++ b/Source/WebCore/platform/wx/ScrollbarThemeWx.cpp @@ -29,8 +29,8 @@ #include "HostWindow.h" #include "NotImplemented.h" #include "PlatformMouseEvent.h" +#include "ScrollableArea.h" #include "Scrollbar.h" -#include "ScrollbarClient.h" #include "scrollbar_render.h" #include "ScrollbarThemeComposite.h" #include "ScrollView.h" @@ -185,7 +185,7 @@ bool ScrollbarThemeWx::paint(Scrollbar* scrollbar, GraphicsContext* context, con { wxOrientation orientation = (scrollbar->orientation() == HorizontalScrollbar) ? wxHORIZONTAL : wxVERTICAL; int flags = 0; - if (scrollbar->client()->isActive()) + if (scrollbar->scrollableArea()->isActive()) flags |= wxCONTROL_FOCUSED; if (!scrollbar->enabled()) diff --git a/Source/WebCore/plugins/PluginDatabase.h b/Source/WebCore/plugins/PluginDatabase.h index b1e1525..275e47f 100644 --- a/Source/WebCore/plugins/PluginDatabase.h +++ b/Source/WebCore/plugins/PluginDatabase.h @@ -50,7 +50,8 @@ namespace WebCore { typedef HashSet<RefPtr<PluginPackage>, PluginPackageHash> PluginSet; - class PluginDatabase : public Noncopyable { + class PluginDatabase { + WTF_MAKE_NONCOPYABLE(PluginDatabase); WTF_MAKE_FAST_ALLOCATED; public: PluginDatabase(); diff --git a/Source/WebCore/plugins/PluginMainThreadScheduler.h b/Source/WebCore/plugins/PluginMainThreadScheduler.h index 610e89c..29bc4e6 100644 --- a/Source/WebCore/plugins/PluginMainThreadScheduler.h +++ b/Source/WebCore/plugins/PluginMainThreadScheduler.h @@ -36,7 +36,8 @@ typedef NPP_t* NPP; namespace WebCore { -class PluginMainThreadScheduler : public Noncopyable { +class PluginMainThreadScheduler { + WTF_MAKE_NONCOPYABLE(PluginMainThreadScheduler); WTF_MAKE_FAST_ALLOCATED; public: typedef void MainThreadFunction(void*); diff --git a/Source/WebCore/plugins/PluginView.h b/Source/WebCore/plugins/PluginView.h index a58d217..03e7189 100644 --- a/Source/WebCore/plugins/PluginView.h +++ b/Source/WebCore/plugins/PluginView.h @@ -108,7 +108,8 @@ namespace WebCore { PluginStatusLoadedSuccessfully }; - class PluginRequest : public Noncopyable { + class PluginRequest { + WTF_MAKE_NONCOPYABLE(PluginRequest); WTF_MAKE_FAST_ALLOCATED; public: PluginRequest(const FrameLoadRequest& frameLoadRequest, bool sendNotification, void* notifyData, bool shouldAllowPopups) : m_frameLoadRequest(frameLoadRequest) diff --git a/Source/WebCore/plugins/chromium/PluginDataChromium.cpp b/Source/WebCore/plugins/chromium/PluginDataChromium.cpp index c924063..77cdbbf 100644 --- a/Source/WebCore/plugins/chromium/PluginDataChromium.cpp +++ b/Source/WebCore/plugins/chromium/PluginDataChromium.cpp @@ -31,7 +31,7 @@ #include "config.h" #include "PluginDataChromium.h" -#include "ChromiumBridge.h" +#include "PlatformBridge.h" namespace WebCore { @@ -50,7 +50,7 @@ public: const Vector<PluginInfo>& plugins() { if (!m_loaded) { - ChromiumBridge::plugins(m_refresh, &m_plugins); + PlatformBridge::plugins(m_refresh, &m_plugins); m_loaded = true; m_refresh = false; } diff --git a/Source/WebCore/rendering/ColumnInfo.h b/Source/WebCore/rendering/ColumnInfo.h index 5e6f619..d77d6ca 100644 --- a/Source/WebCore/rendering/ColumnInfo.h +++ b/Source/WebCore/rendering/ColumnInfo.h @@ -31,7 +31,8 @@ namespace WebCore { -class ColumnInfo : public Noncopyable { +class ColumnInfo { + WTF_MAKE_NONCOPYABLE(ColumnInfo); WTF_MAKE_FAST_ALLOCATED; public: ColumnInfo() : m_desiredColumnWidth(0) diff --git a/Source/WebCore/rendering/EllipsisBox.cpp b/Source/WebCore/rendering/EllipsisBox.cpp index 39fa205..d367c07 100644 --- a/Source/WebCore/rendering/EllipsisBox.cpp +++ b/Source/WebCore/rendering/EllipsisBox.cpp @@ -25,6 +25,7 @@ #include "HitTestResult.h" #include "PaintInfo.h" #include "RootInlineBox.h" +#include "TextRun.h" namespace WebCore { diff --git a/Source/WebCore/rendering/InlineTextBox.cpp b/Source/WebCore/rendering/InlineTextBox.cpp index ae5be0f..8992964 100644 --- a/Source/WebCore/rendering/InlineTextBox.cpp +++ b/Source/WebCore/rendering/InlineTextBox.cpp @@ -40,6 +40,7 @@ #include "RenderRubyText.h" #include "RenderTheme.h" #include "Text.h" +#include "TextRun.h" #include "break_lines.h" #include <wtf/AlwaysInline.h> diff --git a/Source/WebCore/rendering/LayoutState.h b/Source/WebCore/rendering/LayoutState.h index 0d06cb1..c499435 100644 --- a/Source/WebCore/rendering/LayoutState.h +++ b/Source/WebCore/rendering/LayoutState.h @@ -37,7 +37,8 @@ class RenderArena; class RenderBox; class RenderObject; -class LayoutState : public Noncopyable { +class LayoutState { + WTF_MAKE_NONCOPYABLE(LayoutState); public: LayoutState() : m_clipped(false) diff --git a/Source/WebCore/rendering/RenderArena.h b/Source/WebCore/rendering/RenderArena.h index edf052a..5d2559a 100644 --- a/Source/WebCore/rendering/RenderArena.h +++ b/Source/WebCore/rendering/RenderArena.h @@ -36,13 +36,15 @@ #define RenderArena_h #include "Arena.h" +#include <wtf/FastAllocBase.h> #include <wtf/Noncopyable.h> namespace WebCore { static const size_t gMaxRecycledSize = 400; -class RenderArena : public Noncopyable { +class RenderArena { + WTF_MAKE_NONCOPYABLE(RenderArena); WTF_MAKE_FAST_ALLOCATED; public: RenderArena(unsigned arenaSize = 4096); ~RenderArena(); diff --git a/Source/WebCore/rendering/RenderBlock.cpp b/Source/WebCore/rendering/RenderBlock.cpp index 794bafc..7275461 100644 --- a/Source/WebCore/rendering/RenderBlock.cpp +++ b/Source/WebCore/rendering/RenderBlock.cpp @@ -48,6 +48,7 @@ #include "RenderView.h" #include "SelectionController.h" #include "Settings.h" +#include "TextRun.h" #include "TransformState.h" #include <wtf/StdLibExtras.h> @@ -5265,9 +5266,8 @@ void RenderBlock::updateFirstLetter() if (remainingText->node()) remainingText->node()->setRenderer(remainingText); - RenderObject* nextObj = textObj->nextSibling(); + firstLetterContainer->addChild(remainingText, textObj); firstLetterContainer->removeChild(textObj); - firstLetterContainer->addChild(remainingText, nextObj); remainingText->setFirstLetter(firstLetter); // construct text fragment for the first letter diff --git a/Source/WebCore/rendering/RenderBlock.h b/Source/WebCore/rendering/RenderBlock.h index 9529bd6..f8829ee 100644 --- a/Source/WebCore/rendering/RenderBlock.h +++ b/Source/WebCore/rendering/RenderBlock.h @@ -360,7 +360,9 @@ private: bool everHadLayout; }; - struct FloatingObject : Noncopyable { + struct FloatingObject { + WTF_MAKE_NONCOPYABLE(FloatingObject); WTF_MAKE_FAST_ALLOCATED; + public: // Note that Type uses bits so you can use FloatBoth as a mask to query for both left and right. enum Type { FloatLeft = 1, FloatRight = 2, FloatBoth = 3 }; @@ -678,7 +680,9 @@ private: PositionedObjectsListHashSet* m_positionedObjects; // Allocated only when some of these fields have non-default values - struct RenderBlockRareData : Noncopyable { + struct RenderBlockRareData { + WTF_MAKE_NONCOPYABLE(RenderBlockRareData); WTF_MAKE_FAST_ALLOCATED; + public: RenderBlockRareData(const RenderBlock* block) : m_margins(positiveMarginBeforeDefault(block), negativeMarginBeforeDefault(block), positiveMarginAfterDefault(block), negativeMarginAfterDefault(block)) , m_paginationStrut(0) diff --git a/Source/WebCore/rendering/RenderBlockLineLayout.cpp b/Source/WebCore/rendering/RenderBlockLineLayout.cpp index 1d909a3..5e16931 100644 --- a/Source/WebCore/rendering/RenderBlockLineLayout.cpp +++ b/Source/WebCore/rendering/RenderBlockLineLayout.cpp @@ -34,6 +34,7 @@ #include "RenderListMarker.h" #include "RenderView.h" #include "Settings.h" +#include "TextRun.h" #include "TrailingFloatsRootInlineBox.h" #include "VerticalPositionCache.h" #include "break_lines.h" diff --git a/Source/WebCore/rendering/RenderBox.cpp b/Source/WebCore/rendering/RenderBox.cpp index e218d85..265c46a 100644 --- a/Source/WebCore/rendering/RenderBox.cpp +++ b/Source/WebCore/rendering/RenderBox.cpp @@ -50,6 +50,7 @@ #include "Settings.h" #endif #include "RenderView.h" +#include "ScrollbarTheme.h" #include "TransformState.h" #include <algorithm> #include <math.h> @@ -573,6 +574,18 @@ IntRect RenderBox::reflectedRect(const IntRect& r) const return result; } +bool RenderBox::includeVerticalScrollbarSize() const +{ + return !ScrollbarTheme::nativeTheme()->usesOverlayScrollbars() + && hasOverflowClip() && (style()->overflowY() == OSCROLL || style()->overflowY() == OAUTO); +} + +bool RenderBox::includeHorizontalScrollbarSize() const +{ + return !ScrollbarTheme::nativeTheme()->usesOverlayScrollbars() + && hasOverflowClip() && (style()->overflowX() == OSCROLL || style()->overflowX() == OAUTO); +} + int RenderBox::verticalScrollbarWidth() const { return includeVerticalScrollbarSize() ? layer()->verticalScrollbarWidth() : 0; @@ -1078,14 +1091,8 @@ bool RenderBox::pushContentsClip(PaintInfo& paintInfo, int tx, int ty) } IntRect clipRect(isControlClip ? controlClipRect(tx, ty) : overflowClipRect(tx, ty)); paintInfo.context->save(); - if (style()->hasBorderRadius()) { - IntSize topLeft, topRight, bottomLeft, bottomRight; - IntRect borderRect = IntRect(tx, ty, width(), height()); - style()->getBorderRadiiForRect(borderRect, topLeft, topRight, bottomLeft, bottomRight); - - paintInfo.context->addRoundedRectClip(borderRect, topLeft, topRight, bottomLeft, bottomRight); - } - + if (style()->hasBorderRadius()) + paintInfo.context->addRoundedRectClip(style()->getRoundedBorderFor(IntRect(tx, ty, width(), height()))); paintInfo.context->clip(clipRect); return true; } @@ -3164,14 +3171,12 @@ VisiblePosition RenderBox::positionForPoint(const IntPoint& point) bool RenderBox::shrinkToAvoidFloats() const { - // FIXME: Technically we should be able to shrink replaced elements on a line, but this is difficult to accomplish, since this - // involves doing a relayout during findNextLineBreak and somehow overriding the containingBlockWidth method to return the - // current remaining width on a line. - if ((isInline() && !isHTMLMarquee()) || !avoidsFloats()) + // Floating objects don't shrink. Objects that don't avoid floats don't shrink. Marquees don't shrink. + if ((isInline() && !isHTMLMarquee()) || !avoidsFloats() || isFloating()) return false; // All auto-width objects that avoid floats should always use lineWidth. - return style()->width().isAuto(); + return style()->width().isAuto(); } bool RenderBox::avoidsFloats() const diff --git a/Source/WebCore/rendering/RenderBox.h b/Source/WebCore/rendering/RenderBox.h index 0a7b175..acbcc29 100644 --- a/Source/WebCore/rendering/RenderBox.h +++ b/Source/WebCore/rendering/RenderBox.h @@ -414,8 +414,8 @@ protected: virtual void mapAbsoluteToLocalPoint(bool fixed, bool useTransforms, TransformState&) const; private: - bool includeVerticalScrollbarSize() const { return hasOverflowClip() && (style()->overflowY() == OSCROLL || style()->overflowY() == OAUTO); } - bool includeHorizontalScrollbarSize() const { return hasOverflowClip() && (style()->overflowX() == OSCROLL || style()->overflowX() == OAUTO); } + bool includeVerticalScrollbarSize() const; + bool includeHorizontalScrollbarSize() const; void paintRootBoxDecorations(PaintInfo&, int tx, int ty); // Returns true if we did a full repaint diff --git a/Source/WebCore/rendering/RenderBoxModelObject.cpp b/Source/WebCore/rendering/RenderBoxModelObject.cpp index 5098306..f2412a1 100644 --- a/Source/WebCore/rendering/RenderBoxModelObject.cpp +++ b/Source/WebCore/rendering/RenderBoxModelObject.cpp @@ -63,7 +63,8 @@ typedef HashMap<LastPaintSizeMapKey, IntSize> LastPaintSizeMap; typedef HashMap<const RenderBoxModelObject*, RenderBoxModelObject*> ContinuationMap; static ContinuationMap* continuationMap = 0; -class ImageQualityController : public Noncopyable { +class ImageQualityController { + WTF_MAKE_NONCOPYABLE(ImageQualityController); WTF_MAKE_FAST_ALLOCATED; public: ImageQualityController(); bool shouldPaintAtLowQuality(GraphicsContext*, RenderBoxModelObject*, Image*, const void* layer, const IntSize&); @@ -547,26 +548,9 @@ void RenderBoxModelObject::paintFillLayerExtended(const PaintInfo& paintInfo, co context->save(); - IntSize topLeft, topRight, bottomLeft, bottomRight; - style()->getBorderRadiiForRect(borderRect, topLeft, topRight, bottomLeft, bottomRight); - - if (!includeLeftEdge) { - topLeft = IntSize(); - if (box->isHorizontal()) - bottomLeft = IntSize(); - else - topRight = IntSize(); - } - - if (!includeRightEdge) { - if (box->isHorizontal()) - topRight = IntSize(); - else - bottomLeft = IntSize(); - bottomRight = IntSize(); - } - - context->addRoundedRectClip(borderRect, topLeft, topRight, bottomLeft, bottomRight); + RoundedIntRect border = style()->getRoundedBorderFor(borderRect); + border.excludeLogicalEdges(box && box->isHorizontal(), !includeLeftEdge, !includeRightEdge); + context->addRoundedRectClip(border); clippedToBorderRadius = true; } @@ -1024,62 +1008,32 @@ void RenderBoxModelObject::paintBorder(GraphicsContext* graphicsContext, int tx, bool renderRight = rightStyle > BHIDDEN && !rightTransparent && (!horizontal || includeLogicalRightEdge); bool renderBottom = bottomStyle > BHIDDEN && !bottomTransparent && (horizontal || includeLogicalRightEdge); - bool renderRadii = false; Path roundedPath; - IntSize topLeft, topRight, bottomLeft, bottomRight; - IntRect borderRect(tx, ty, w, h); + RoundedIntRect border(tx, ty, w, h); if (style->hasBorderRadius()) { - IntSize topLeftRadius, topRightRadius, bottomLeftRadius, bottomRightRadius; - style->getBorderRadiiForRect(borderRect, topLeftRadius, topRightRadius, bottomLeftRadius, bottomRightRadius); + border.includeLogicalEdges(style->getRoundedBorderFor(border.rect()).radii(), + horizontal, includeLogicalLeftEdge, includeLogicalRightEdge); int leftWidth = (!horizontal || includeLogicalLeftEdge) ? style->borderLeftWidth() : 0; int rightWidth = (!horizontal || includeLogicalRightEdge) ? style->borderRightWidth() : 0; int topWidth = (horizontal || includeLogicalLeftEdge) ? style->borderTopWidth() : 0; int bottomWidth = (horizontal || includeLogicalRightEdge) ? style->borderBottomWidth() : 0; - IntRect innerBorderRect = borderInnerRect(borderRect, topWidth, bottomWidth, leftWidth, rightWidth); - IntSize innerTopLeftRadius, innerTopRightRadius, innerBottomLeftRadius, innerBottomRightRadius; - - style->getInnerBorderRadiiForRectWithBorderWidths(innerBorderRect, topWidth, bottomWidth, leftWidth, rightWidth, innerTopLeftRadius, innerTopRightRadius, innerBottomLeftRadius, innerBottomRightRadius); - - IntSize innerTopLeft, innerTopRight, innerBottomLeft, innerBottomRight; - - if (includeLogicalLeftEdge) { - topLeft = topLeftRadius; - innerTopLeft = innerTopLeftRadius; - if (horizontal) { - bottomLeft = bottomLeftRadius; - innerBottomLeft = innerBottomLeftRadius; - } else { - topRight = topRightRadius; - innerTopRight = innerTopRightRadius; - } - } - - if (includeLogicalRightEdge) { - if (horizontal) { - topRight = topRightRadius; - innerTopRight = innerTopRightRadius; - } else { - bottomLeft = bottomLeftRadius; - innerBottomLeft = innerBottomLeftRadius; - } - bottomRight = bottomRightRadius; - innerBottomRight = innerBottomRightRadius; - } + RoundedIntRect inner(borderInnerRect(border.rect(), topWidth, bottomWidth, leftWidth, rightWidth)); + inner.includeLogicalEdges(style->getRoundedInnerBorderWithBorderWidths(inner.rect(), topWidth, bottomWidth, leftWidth, rightWidth).radii(), + horizontal, includeLogicalLeftEdge, includeLogicalRightEdge); - renderRadii = !topLeft.isZero() || !topRight.isZero() || !bottomLeft.isZero() || !bottomRight.isZero(); - - if (renderRadii) { + if (border.isRounded()) { // Clip to the inner and outer radii rects. graphicsContext->save(); - graphicsContext->addRoundedRectClip(borderRect, topLeft, topRight, bottomLeft, bottomRight); - graphicsContext->clipOutRoundedRect(innerBorderRect, innerTopLeft, innerTopRight, innerBottomLeft, innerBottomRight); - roundedPath.addRoundedRect(borderRect, topLeft, topRight, bottomLeft, bottomRight); + graphicsContext->addRoundedRectClip(border); + graphicsContext->clipOutRoundedRect(inner); + roundedPath.addRoundedRect(border.rect(), border.radii().topLeft(), border.radii().topRight(), border.radii().bottomLeft(), border.radii().bottomRight()); } } + bool renderRadii = border.isRounded(); bool upperLeftBorderStylesMatch = renderLeft && (topStyle == leftStyle) && (topColor == leftColor); bool upperRightBorderStylesMatch = renderRight && (topStyle == rightStyle) && (topColor == rightColor) && (topStyle != OUTSET) && (topStyle != RIDGE) && (topStyle != INSET) && (topStyle != GROOVE); bool lowerLeftBorderStylesMatch = renderLeft && (bottomStyle == leftStyle) && (bottomColor == leftColor) && (bottomStyle != OUTSET) && (bottomStyle != RIDGE) && (bottomStyle != INSET) && (bottomStyle != GROOVE); @@ -1089,11 +1043,11 @@ void RenderBoxModelObject::paintBorder(GraphicsContext* graphicsContext, int tx, int x = tx; int x2 = tx + w; - if (renderRadii && borderWillArcInnerEdge(topLeft, topRight, style->borderLeftWidth(), style->borderRightWidth(), style->borderTopWidth())) { + if (renderRadii && borderWillArcInnerEdge(border.radii().topLeft(), border.radii().topRight(), style->borderLeftWidth(), style->borderRightWidth(), style->borderTopWidth())) { graphicsContext->save(); - clipBorderSidePolygon(graphicsContext, borderRect, topLeft, topRight, bottomLeft, bottomRight, BSTop, upperLeftBorderStylesMatch, upperRightBorderStylesMatch, style, includeLogicalLeftEdge, includeLogicalRightEdge); + clipBorderSidePolygon(graphicsContext, border, BSTop, upperLeftBorderStylesMatch, upperRightBorderStylesMatch, style, includeLogicalLeftEdge, includeLogicalRightEdge); float thickness = max(max(style->borderTopWidth(), style->borderLeftWidth()), style->borderRightWidth()); - drawBoxSideFromPath(graphicsContext, borderRect, roundedPath, style->borderTopWidth(), thickness, BSTop, style, topColor, topStyle); + drawBoxSideFromPath(graphicsContext, border.rect(), roundedPath, style->borderTopWidth(), thickness, BSTop, style, topColor, topStyle); graphicsContext->restore(); } else { bool ignoreLeft = (topColor == leftColor && topTransparent == leftTransparent && topStyle >= OUTSET @@ -1110,11 +1064,11 @@ void RenderBoxModelObject::paintBorder(GraphicsContext* graphicsContext, int tx, int x = tx; int x2 = tx + w; - if (renderRadii && borderWillArcInnerEdge(bottomLeft, bottomRight, style->borderLeftWidth(), style->borderRightWidth(), style->borderBottomWidth())) { + if (renderRadii && borderWillArcInnerEdge(border.radii().bottomLeft(), border.radii().bottomRight(), style->borderLeftWidth(), style->borderRightWidth(), style->borderBottomWidth())) { graphicsContext->save(); - clipBorderSidePolygon(graphicsContext, borderRect, topLeft, topRight, bottomLeft, bottomRight, BSBottom, lowerLeftBorderStylesMatch, lowerRightBorderStylesMatch, style, includeLogicalLeftEdge, includeLogicalRightEdge); + clipBorderSidePolygon(graphicsContext, border, BSBottom, lowerLeftBorderStylesMatch, lowerRightBorderStylesMatch, style, includeLogicalLeftEdge, includeLogicalRightEdge); float thickness = max(max(style->borderBottomWidth(), style->borderLeftWidth()), style->borderRightWidth()); - drawBoxSideFromPath(graphicsContext, borderRect, roundedPath, style->borderBottomWidth(), thickness, BSBottom, style, bottomColor, bottomStyle); + drawBoxSideFromPath(graphicsContext, border.rect(), roundedPath, style->borderBottomWidth(), thickness, BSBottom, style, bottomColor, bottomStyle); graphicsContext->restore(); } else { bool ignoreLeft = (bottomColor == leftColor && bottomTransparent == leftTransparent && bottomStyle >= OUTSET @@ -1133,11 +1087,11 @@ void RenderBoxModelObject::paintBorder(GraphicsContext* graphicsContext, int tx, int y = ty; int y2 = ty + h; - if (renderRadii && borderWillArcInnerEdge(bottomLeft, topLeft, style->borderBottomWidth(), style->borderTopWidth(), style->borderLeftWidth())) { + if (renderRadii && borderWillArcInnerEdge(border.radii().bottomLeft(), border.radii().topLeft(), style->borderBottomWidth(), style->borderTopWidth(), style->borderLeftWidth())) { graphicsContext->save(); - clipBorderSidePolygon(graphicsContext, borderRect, topLeft, topRight, bottomLeft, bottomRight, BSLeft, upperLeftBorderStylesMatch, lowerLeftBorderStylesMatch, style, includeLogicalLeftEdge, includeLogicalRightEdge); + clipBorderSidePolygon(graphicsContext, border, BSLeft, upperLeftBorderStylesMatch, lowerLeftBorderStylesMatch, style, includeLogicalLeftEdge, includeLogicalRightEdge); float thickness = max(max(style->borderLeftWidth(), style->borderTopWidth()), style->borderBottomWidth()); - drawBoxSideFromPath(graphicsContext, borderRect, roundedPath, style->borderLeftWidth(), thickness, BSLeft, style, leftColor, leftStyle); + drawBoxSideFromPath(graphicsContext, border.rect(), roundedPath, style->borderLeftWidth(), thickness, BSLeft, style, leftColor, leftStyle); graphicsContext->restore(); } else { bool ignoreTop = (topColor == leftColor && topTransparent == leftTransparent && leftStyle >= OUTSET @@ -1152,11 +1106,11 @@ void RenderBoxModelObject::paintBorder(GraphicsContext* graphicsContext, int tx, } if (renderRight) { - if (renderRadii && borderWillArcInnerEdge(bottomRight, topRight, style->borderBottomWidth(), style->borderTopWidth(), style->borderRightWidth())) { + if (renderRadii && borderWillArcInnerEdge(border.radii().bottomRight(), border.radii().topRight(), style->borderBottomWidth(), style->borderTopWidth(), style->borderRightWidth())) { graphicsContext->save(); - clipBorderSidePolygon(graphicsContext, borderRect, topLeft, topRight, bottomLeft, bottomRight, BSRight, upperRightBorderStylesMatch, lowerRightBorderStylesMatch, style, includeLogicalLeftEdge, includeLogicalRightEdge); + clipBorderSidePolygon(graphicsContext, border, BSRight, upperRightBorderStylesMatch, lowerRightBorderStylesMatch, style, includeLogicalLeftEdge, includeLogicalRightEdge); float thickness = max(max(style->borderRightWidth(), style->borderTopWidth()), style->borderBottomWidth()); - drawBoxSideFromPath(graphicsContext, borderRect, roundedPath, style->borderRightWidth(), thickness, BSRight, style, rightColor, rightStyle); + drawBoxSideFromPath(graphicsContext, border.rect(), roundedPath, style->borderRightWidth(), thickness, BSRight, style, rightColor, rightStyle); graphicsContext->restore(); } else { bool ignoreTop = ((topColor == rightColor) && (topTransparent == rightTransparent) @@ -1209,65 +1163,43 @@ void RenderBoxModelObject::paintBorder(GraphicsContext* graphicsContext, int tx, bool renderRight = rightStyle > BHIDDEN && !rightTransparent && (!horizontal || includeLogicalRightEdge); bool renderBottom = bottomStyle > BHIDDEN && !bottomTransparent && (horizontal || includeLogicalRightEdge); - bool renderRadii = false; - IntSize topLeft, topRight, bottomLeft, bottomRight; + RoundedIntRect border(tx, ty, w, h); if (style->hasBorderRadius()) { - IntRect borderRect = IntRect(tx, ty, w, h); - - IntSize topLeftRadius, topRightRadius, bottomLeftRadius, bottomRightRadius; - style->getBorderRadiiForRect(borderRect, topLeftRadius, topRightRadius, bottomLeftRadius, bottomRightRadius); - - if (includeLogicalLeftEdge) { - topLeft = topLeftRadius; - if (horizontal) - bottomLeft = bottomLeftRadius; - else - topRight = topRightRadius; - } - - if (includeLogicalRightEdge) { - if (horizontal) - topRight = topRightRadius; - else - bottomLeft = bottomLeftRadius; - bottomRight = bottomRightRadius; - } - - renderRadii = !topLeft.isZero() || !topRight.isZero() || !bottomLeft.isZero() || !bottomRight.isZero(); - - if (renderRadii) { - // Clip to the rounded rectangle. + border.includeLogicalEdges(style->getRoundedBorderFor(border.rect()).radii(), + horizontal, includeLogicalLeftEdge, includeLogicalRightEdge); + if (border.isRounded()) { graphicsContext->save(); - graphicsContext->addRoundedRectClip(borderRect, topLeft, topRight, bottomLeft, bottomRight); + graphicsContext->addRoundedRectClip(border); } } int firstAngleStart, secondAngleStart, firstAngleSpan, secondAngleSpan; float thickness; + bool renderRadii = border.isRounded(); bool upperLeftBorderStylesMatch = renderLeft && (topStyle == leftStyle) && (topColor == leftColor); bool upperRightBorderStylesMatch = renderRight && (topStyle == rightStyle) && (topColor == rightColor) && (topStyle != OUTSET) && (topStyle != RIDGE) && (topStyle != INSET) && (topStyle != GROOVE); bool lowerLeftBorderStylesMatch = renderLeft && (bottomStyle == leftStyle) && (bottomColor == leftColor) && (bottomStyle != OUTSET) && (bottomStyle != RIDGE) && (bottomStyle != INSET) && (bottomStyle != GROOVE); bool lowerRightBorderStylesMatch = renderRight && (bottomStyle == rightStyle) && (bottomColor == rightColor); if (renderTop) { - bool ignore_left = (renderRadii && topLeft.width() > 0) || - (topColor == leftColor && topTransparent == leftTransparent && topStyle >= OUTSET && - (leftStyle == DOTTED || leftStyle == DASHED || leftStyle == SOLID || leftStyle == OUTSET)); - - bool ignore_right = (renderRadii && topRight.width() > 0) || - (topColor == rightColor && topTransparent == rightTransparent && topStyle >= OUTSET && - (rightStyle == DOTTED || rightStyle == DASHED || rightStyle == SOLID || rightStyle == INSET)); + bool ignoreLeft = (renderRadii && border.radii().topLeft().width() > 0) + || (topColor == leftColor && topTransparent == leftTransparent && topStyle >= OUTSET + && (leftStyle == DOTTED || leftStyle == DASHED || leftStyle == SOLID || leftStyle == OUTSET)); + + bool ignoreRight = (renderRadii && border.radii().topRight().width() > 0) + || (topColor == rightColor && topTransparent == rightTransparent && topStyle >= OUTSET + && (rightStyle == DOTTED || rightStyle == DASHED || rightStyle == SOLID || rightStyle == INSET)); int x = tx; int x2 = tx + w; if (renderRadii) { - x += topLeft.width(); - x2 -= topRight.width(); + x += border.radii().topLeft().width(); + x2 -= border.radii().topRight().width(); } drawLineForBoxSide(graphicsContext, x, ty, x2, ty + style->borderTopWidth(), BSTop, topColor, topStyle, - ignore_left ? 0 : style->borderLeftWidth(), ignore_right ? 0 : style->borderRightWidth()); + ignoreLeft ? 0 : style->borderLeftWidth(), ignoreRight ? 0 : style->borderRightWidth()); if (renderRadii) { int leftY = ty; @@ -1277,15 +1209,15 @@ void RenderBoxModelObject::paintBorder(GraphicsContext* graphicsContext, int tx, // with the arc-drawing function. thickness = style->borderTopWidth() * 2; - if (topLeft.width()) { + if (border.radii().topLeft().width()) { int leftX = tx; // The inner clip clips inside the arc. This is especially important for 1px borders. - bool applyLeftInnerClip = (style->borderLeftWidth() < topLeft.width()) - && (style->borderTopWidth() < topLeft.height()) + bool applyLeftInnerClip = (style->borderLeftWidth() < border.radii().topLeft().width()) + && (style->borderTopWidth() < border.radii().topLeft().height()) && (topStyle != DOUBLE || style->borderTopWidth() > 6); if (applyLeftInnerClip) { graphicsContext->save(); - graphicsContext->addInnerRoundedRectClip(IntRect(leftX, leftY, topLeft.width() * 2, topLeft.height() * 2), + graphicsContext->addInnerRoundedRectClip(IntRect(leftX, leftY, border.radii().topLeft().width() * 2, border.radii().topLeft().height() * 2), style->borderTopWidth()); } @@ -1293,20 +1225,20 @@ void RenderBoxModelObject::paintBorder(GraphicsContext* graphicsContext, int tx, firstAngleSpan = upperLeftBorderStylesMatch ? 90 : 45; // Draw upper left arc - drawArcForBoxSide(graphicsContext, leftX, leftY, thickness, topLeft, firstAngleStart, firstAngleSpan, + drawArcForBoxSide(graphicsContext, leftX, leftY, thickness, border.radii().topLeft(), firstAngleStart, firstAngleSpan, BSTop, topColor, topStyle, true); if (applyLeftInnerClip) graphicsContext->restore(); } - if (topRight.width()) { - int rightX = tx + w - topRight.width() * 2; - bool applyRightInnerClip = (style->borderRightWidth() < topRight.width()) - && (style->borderTopWidth() < topRight.height()) + if (border.radii().topRight().width()) { + int rightX = tx + w - border.radii().topRight().width() * 2; + bool applyRightInnerClip = (style->borderRightWidth() < border.radii().topRight().width()) + && (style->borderTopWidth() < border.radii().topRight().height()) && (topStyle != DOUBLE || style->borderTopWidth() > 6); if (applyRightInnerClip) { graphicsContext->save(); - graphicsContext->addInnerRoundedRectClip(IntRect(rightX, leftY, topRight.width() * 2, topRight.height() * 2), + graphicsContext->addInnerRoundedRectClip(IntRect(rightX, leftY, border.radii().topRight().width() * 2, border.radii().topRight().height() * 2), style->borderTopWidth()); } @@ -1319,7 +1251,7 @@ void RenderBoxModelObject::paintBorder(GraphicsContext* graphicsContext, int tx, } // Draw upper right arc - drawArcForBoxSide(graphicsContext, rightX, leftY, thickness, topRight, secondAngleStart, secondAngleSpan, + drawArcForBoxSide(graphicsContext, rightX, leftY, thickness, border.radii().topRight(), secondAngleStart, secondAngleSpan, BSTop, topColor, topStyle, false); if (applyRightInnerClip) graphicsContext->restore(); @@ -1328,36 +1260,36 @@ void RenderBoxModelObject::paintBorder(GraphicsContext* graphicsContext, int tx, } if (renderBottom) { - bool ignore_left = (renderRadii && bottomLeft.width() > 0) || - (bottomColor == leftColor && bottomTransparent == leftTransparent && bottomStyle >= OUTSET && - (leftStyle == DOTTED || leftStyle == DASHED || leftStyle == SOLID || leftStyle == OUTSET)); + bool ignoreLeft = (renderRadii && border.radii().bottomLeft().width() > 0) + || (bottomColor == leftColor && bottomTransparent == leftTransparent && bottomStyle >= OUTSET + && (leftStyle == DOTTED || leftStyle == DASHED || leftStyle == SOLID || leftStyle == OUTSET)); - bool ignore_right = (renderRadii && bottomRight.width() > 0) || - (bottomColor == rightColor && bottomTransparent == rightTransparent && bottomStyle >= OUTSET && - (rightStyle == DOTTED || rightStyle == DASHED || rightStyle == SOLID || rightStyle == INSET)); + bool ignoreRight = (renderRadii && border.radii().bottomRight().width() > 0) + || (bottomColor == rightColor && bottomTransparent == rightTransparent && bottomStyle >= OUTSET + && (rightStyle == DOTTED || rightStyle == DASHED || rightStyle == SOLID || rightStyle == INSET)); int x = tx; int x2 = tx + w; if (renderRadii) { - x += bottomLeft.width(); - x2 -= bottomRight.width(); + x += border.radii().bottomLeft().width(); + x2 -= border.radii().bottomRight().width(); } drawLineForBoxSide(graphicsContext, x, ty + h - style->borderBottomWidth(), x2, ty + h, BSBottom, bottomColor, bottomStyle, - ignore_left ? 0 : style->borderLeftWidth(), ignore_right ? 0 : style->borderRightWidth()); + ignoreLeft ? 0 : style->borderLeftWidth(), ignoreRight ? 0 : style->borderRightWidth()); if (renderRadii) { thickness = style->borderBottomWidth() * 2; - if (bottomLeft.width()) { + if (border.radii().bottomLeft().width()) { int leftX = tx; - int leftY = ty + h - bottomLeft.height() * 2; - bool applyLeftInnerClip = (style->borderLeftWidth() < bottomLeft.width()) - && (style->borderBottomWidth() < bottomLeft.height()) + int leftY = ty + h - border.radii().bottomLeft().height() * 2; + bool applyLeftInnerClip = (style->borderLeftWidth() < border.radii().bottomLeft().width()) + && (style->borderBottomWidth() < border.radii().bottomLeft().height()) && (bottomStyle != DOUBLE || style->borderBottomWidth() > 6); if (applyLeftInnerClip) { graphicsContext->save(); - graphicsContext->addInnerRoundedRectClip(IntRect(leftX, leftY, bottomLeft.width() * 2, bottomLeft.height() * 2), + graphicsContext->addInnerRoundedRectClip(IntRect(leftX, leftY, border.radii().bottomLeft().width() * 2, border.radii().bottomLeft().height() * 2), style->borderBottomWidth()); } @@ -1370,21 +1302,21 @@ void RenderBoxModelObject::paintBorder(GraphicsContext* graphicsContext, int tx, } // Draw lower left arc - drawArcForBoxSide(graphicsContext, leftX, leftY, thickness, bottomLeft, firstAngleStart, firstAngleSpan, + drawArcForBoxSide(graphicsContext, leftX, leftY, thickness, border.radii().bottomLeft(), firstAngleStart, firstAngleSpan, BSBottom, bottomColor, bottomStyle, true); if (applyLeftInnerClip) graphicsContext->restore(); } - if (bottomRight.width()) { - int rightY = ty + h - bottomRight.height() * 2; - int rightX = tx + w - bottomRight.width() * 2; - bool applyRightInnerClip = (style->borderRightWidth() < bottomRight.width()) - && (style->borderBottomWidth() < bottomRight.height()) + if (border.radii().bottomRight().width()) { + int rightY = ty + h - border.radii().bottomRight().height() * 2; + int rightX = tx + w - border.radii().bottomRight().width() * 2; + bool applyRightInnerClip = (style->borderRightWidth() < border.radii().bottomRight().width()) + && (style->borderBottomWidth() < border.radii().bottomRight().height()) && (bottomStyle != DOUBLE || style->borderBottomWidth() > 6); if (applyRightInnerClip) { graphicsContext->save(); - graphicsContext->addInnerRoundedRectClip(IntRect(rightX, rightY, bottomRight.width() * 2, bottomRight.height() * 2), + graphicsContext->addInnerRoundedRectClip(IntRect(rightX, rightY, border.radii().bottomRight().width() * 2, border.radii().bottomRight().height() * 2), style->borderBottomWidth()); } @@ -1392,7 +1324,7 @@ void RenderBoxModelObject::paintBorder(GraphicsContext* graphicsContext, int tx, secondAngleSpan = lowerRightBorderStylesMatch ? 90 : 45; // Draw lower right arc - drawArcForBoxSide(graphicsContext, rightX, rightY, thickness, bottomRight, secondAngleStart, secondAngleSpan, + drawArcForBoxSide(graphicsContext, rightX, rightY, thickness, border.radii().bottomRight(), secondAngleStart, secondAngleSpan, BSBottom, bottomColor, bottomStyle, false); if (applyRightInnerClip) graphicsContext->restore(); @@ -1401,36 +1333,36 @@ void RenderBoxModelObject::paintBorder(GraphicsContext* graphicsContext, int tx, } if (renderLeft) { - bool ignore_top = (renderRadii && topLeft.height() > 0) || - (topColor == leftColor && topTransparent == leftTransparent && leftStyle >= OUTSET && - (topStyle == DOTTED || topStyle == DASHED || topStyle == SOLID || topStyle == OUTSET)); + bool ignoreTop = (renderRadii && border.radii().topLeft().height() > 0) + || (topColor == leftColor && topTransparent == leftTransparent && leftStyle >= OUTSET + && (topStyle == DOTTED || topStyle == DASHED || topStyle == SOLID || topStyle == OUTSET)); - bool ignore_bottom = (renderRadii && bottomLeft.height() > 0) || - (bottomColor == leftColor && bottomTransparent == leftTransparent && leftStyle >= OUTSET && - (bottomStyle == DOTTED || bottomStyle == DASHED || bottomStyle == SOLID || bottomStyle == INSET)); + bool ignoreBottom = (renderRadii && border.radii().bottomLeft().height() > 0) + || (bottomColor == leftColor && bottomTransparent == leftTransparent && leftStyle >= OUTSET + && (bottomStyle == DOTTED || bottomStyle == DASHED || bottomStyle == SOLID || bottomStyle == INSET)); int y = ty; int y2 = ty + h; if (renderRadii) { - y += topLeft.height(); - y2 -= bottomLeft.height(); + y += border.radii().topLeft().height(); + y2 -= border.radii().bottomLeft().height(); } drawLineForBoxSide(graphicsContext, tx, y, tx + style->borderLeftWidth(), y2, BSLeft, leftColor, leftStyle, - ignore_top ? 0 : style->borderTopWidth(), ignore_bottom ? 0 : style->borderBottomWidth()); + ignoreTop ? 0 : style->borderTopWidth(), ignoreBottom ? 0 : style->borderBottomWidth()); if (renderRadii && (!upperLeftBorderStylesMatch || !lowerLeftBorderStylesMatch)) { int topX = tx; thickness = style->borderLeftWidth() * 2; - if (!upperLeftBorderStylesMatch && topLeft.width()) { + if (!upperLeftBorderStylesMatch && border.radii().topLeft().width()) { int topY = ty; - bool applyTopInnerClip = (style->borderLeftWidth() < topLeft.width()) - && (style->borderTopWidth() < topLeft.height()) + bool applyTopInnerClip = (style->borderLeftWidth() < border.radii().topLeft().width()) + && (style->borderTopWidth() < border.radii().topLeft().height()) && (leftStyle != DOUBLE || style->borderLeftWidth() > 6); if (applyTopInnerClip) { graphicsContext->save(); - graphicsContext->addInnerRoundedRectClip(IntRect(topX, topY, topLeft.width() * 2, topLeft.height() * 2), + graphicsContext->addInnerRoundedRectClip(IntRect(topX, topY, border.radii().topLeft().width() * 2, border.radii().topLeft().height() * 2), style->borderLeftWidth()); } @@ -1438,20 +1370,20 @@ void RenderBoxModelObject::paintBorder(GraphicsContext* graphicsContext, int tx, firstAngleSpan = 45; // Draw top left arc - drawArcForBoxSide(graphicsContext, topX, topY, thickness, topLeft, firstAngleStart, firstAngleSpan, + drawArcForBoxSide(graphicsContext, topX, topY, thickness, border.radii().topLeft(), firstAngleStart, firstAngleSpan, BSLeft, leftColor, leftStyle, true); if (applyTopInnerClip) graphicsContext->restore(); } - if (!lowerLeftBorderStylesMatch && bottomLeft.width()) { - int bottomY = ty + h - bottomLeft.height() * 2; - bool applyBottomInnerClip = (style->borderLeftWidth() < bottomLeft.width()) - && (style->borderBottomWidth() < bottomLeft.height()) + if (!lowerLeftBorderStylesMatch && border.radii().bottomLeft().width()) { + int bottomY = ty + h - border.radii().bottomLeft().height() * 2; + bool applyBottomInnerClip = (style->borderLeftWidth() < border.radii().bottomLeft().width()) + && (style->borderBottomWidth() < border.radii().bottomLeft().height()) && (leftStyle != DOUBLE || style->borderLeftWidth() > 6); if (applyBottomInnerClip) { graphicsContext->save(); - graphicsContext->addInnerRoundedRectClip(IntRect(topX, bottomY, bottomLeft.width() * 2, bottomLeft.height() * 2), + graphicsContext->addInnerRoundedRectClip(IntRect(topX, bottomY, border.radii().bottomLeft().width() * 2, border.radii().bottomLeft().height() * 2), style->borderLeftWidth()); } @@ -1459,7 +1391,7 @@ void RenderBoxModelObject::paintBorder(GraphicsContext* graphicsContext, int tx, secondAngleSpan = 45; // Draw bottom left arc - drawArcForBoxSide(graphicsContext, topX, bottomY, thickness, bottomLeft, secondAngleStart, secondAngleSpan, + drawArcForBoxSide(graphicsContext, topX, bottomY, thickness, border.radii().bottomLeft(), secondAngleStart, secondAngleSpan, BSLeft, leftColor, leftStyle, false); if (applyBottomInnerClip) graphicsContext->restore(); @@ -1468,38 +1400,38 @@ void RenderBoxModelObject::paintBorder(GraphicsContext* graphicsContext, int tx, } if (renderRight) { - bool ignore_top = (renderRadii && topRight.height() > 0) || - ((topColor == rightColor) && (topTransparent == rightTransparent) && - (rightStyle >= DOTTED || rightStyle == INSET) && - (topStyle == DOTTED || topStyle == DASHED || topStyle == SOLID || topStyle == OUTSET)); + bool ignoreTop = (renderRadii && border.radii().topRight().height() > 0) + || ((topColor == rightColor) && (topTransparent == rightTransparent) + && (rightStyle >= DOTTED || rightStyle == INSET) + && (topStyle == DOTTED || topStyle == DASHED || topStyle == SOLID || topStyle == OUTSET)); - bool ignore_bottom = (renderRadii && bottomRight.height() > 0) || - ((bottomColor == rightColor) && (bottomTransparent == rightTransparent) && - (rightStyle >= DOTTED || rightStyle == INSET) && - (bottomStyle == DOTTED || bottomStyle == DASHED || bottomStyle == SOLID || bottomStyle == INSET)); + bool ignoreBottom = (renderRadii && border.radii().bottomRight().height() > 0) + || ((bottomColor == rightColor) && (bottomTransparent == rightTransparent) + && (rightStyle >= DOTTED || rightStyle == INSET) + && (bottomStyle == DOTTED || bottomStyle == DASHED || bottomStyle == SOLID || bottomStyle == INSET)); int y = ty; int y2 = ty + h; if (renderRadii) { - y += topRight.height(); - y2 -= bottomRight.height(); + y += border.radii().topRight().height(); + y2 -= border.radii().bottomRight().height(); } drawLineForBoxSide(graphicsContext, tx + w - style->borderRightWidth(), y, tx + w, y2, BSRight, rightColor, rightStyle, - ignore_top ? 0 : style->borderTopWidth(), ignore_bottom ? 0 : style->borderBottomWidth()); + ignoreTop ? 0 : style->borderTopWidth(), ignoreBottom ? 0 : style->borderBottomWidth()); if (renderRadii && (!upperRightBorderStylesMatch || !lowerRightBorderStylesMatch)) { thickness = style->borderRightWidth() * 2; - if (!upperRightBorderStylesMatch && topRight.width()) { - int topX = tx + w - topRight.width() * 2; + if (!upperRightBorderStylesMatch && border.radii().topRight().width()) { + int topX = tx + w - border.radii().topRight().width() * 2; int topY = ty; - bool applyTopInnerClip = (style->borderRightWidth() < topRight.width()) - && (style->borderTopWidth() < topRight.height()) + bool applyTopInnerClip = (style->borderRightWidth() < border.radii().topRight().width()) + && (style->borderTopWidth() < border.radii().topRight().height()) && (rightStyle != DOUBLE || style->borderRightWidth() > 6); if (applyTopInnerClip) { graphicsContext->save(); - graphicsContext->addInnerRoundedRectClip(IntRect(topX, topY, topRight.width() * 2, topRight.height() * 2), + graphicsContext->addInnerRoundedRectClip(IntRect(topX, topY, border.radii().topRight().width() * 2, border.radii().topRight().height() * 2), style->borderRightWidth()); } @@ -1507,21 +1439,21 @@ void RenderBoxModelObject::paintBorder(GraphicsContext* graphicsContext, int tx, firstAngleSpan = 45; // Draw top right arc - drawArcForBoxSide(graphicsContext, topX, topY, thickness, topRight, firstAngleStart, firstAngleSpan, + drawArcForBoxSide(graphicsContext, topX, topY, thickness, border.radii().topRight(), firstAngleStart, firstAngleSpan, BSRight, rightColor, rightStyle, true); if (applyTopInnerClip) graphicsContext->restore(); } - if (!lowerRightBorderStylesMatch && bottomRight.width()) { - int bottomX = tx + w - bottomRight.width() * 2; - int bottomY = ty + h - bottomRight.height() * 2; - bool applyBottomInnerClip = (style->borderRightWidth() < bottomRight.width()) - && (style->borderBottomWidth() < bottomRight.height()) + if (!lowerRightBorderStylesMatch && border.radii().bottomRight().width()) { + int bottomX = tx + w - border.radii().bottomRight().width() * 2; + int bottomY = ty + h - border.radii().bottomRight().height() * 2; + bool applyBottomInnerClip = (style->borderRightWidth() < border.radii().bottomRight().width()) + && (style->borderBottomWidth() < border.radii().bottomRight().height()) && (rightStyle != DOUBLE || style->borderRightWidth() > 6); if (applyBottomInnerClip) { graphicsContext->save(); - graphicsContext->addInnerRoundedRectClip(IntRect(bottomX, bottomY, bottomRight.width() * 2, bottomRight.height() * 2), + graphicsContext->addInnerRoundedRectClip(IntRect(bottomX, bottomY, border.radii().bottomRight().width() * 2, border.radii().bottomRight().height() * 2), style->borderRightWidth()); } @@ -1529,7 +1461,7 @@ void RenderBoxModelObject::paintBorder(GraphicsContext* graphicsContext, int tx, secondAngleSpan = 45; // Draw bottom right arc - drawArcForBoxSide(graphicsContext, bottomX, bottomY, thickness, bottomRight, secondAngleStart, secondAngleSpan, + drawArcForBoxSide(graphicsContext, bottomX, bottomY, thickness, border.radii().bottomRight(), secondAngleStart, secondAngleSpan, BSRight, rightColor, rightStyle, false); if (applyBottomInnerClip) graphicsContext->restore(); @@ -1542,15 +1474,15 @@ void RenderBoxModelObject::paintBorder(GraphicsContext* graphicsContext, int tx, } #endif -void RenderBoxModelObject::clipBorderSidePolygon(GraphicsContext* graphicsContext, const IntRect& box, const IntSize& topLeft, const IntSize& topRight, const IntSize& bottomLeft, const IntSize& bottomRight, +void RenderBoxModelObject::clipBorderSidePolygon(GraphicsContext* graphicsContext, const RoundedIntRect& border, const BoxSide side, bool firstEdgeMatches, bool secondEdgeMatches, const RenderStyle* style, bool includeLogicalLeftEdge, bool includeLogicalRightEdge) { FloatPoint quad[4]; - int tx = box.x(); - int ty = box.y(); - int w = box.width(); - int h = box.height(); + int tx = border.rect().x(); + int ty = border.rect().y(); + int w = border.rect().width(); + int h = border.rect().height(); bool horizontal = style->isHorizontalWritingMode(); int leftWidth = (!horizontal || includeLogicalLeftEdge) ? style->borderLeftWidth() : 0; @@ -1563,26 +1495,26 @@ void RenderBoxModelObject::clipBorderSidePolygon(GraphicsContext* graphicsContex switch (side) { case BSTop: quad[0] = FloatPoint(tx, ty); - quad[1] = FloatPoint(tx + max(topLeft.width(), leftWidth), ty + max(topLeft.height(), topWidth)); - quad[2] = FloatPoint(tx + w - max(topRight.width(), rightWidth), ty + max(topRight.height(), topWidth)); + quad[1] = FloatPoint(tx + max(border.radii().topLeft().width(), leftWidth), ty + max(border.radii().topLeft().height(), topWidth)); + quad[2] = FloatPoint(tx + w - max(border.radii().topRight().width(), rightWidth), ty + max(border.radii().topRight().height(), topWidth)); quad[3] = FloatPoint(tx + w, ty); break; case BSLeft: quad[0] = FloatPoint(tx, ty); - quad[1] = FloatPoint(tx + max(topLeft.width(), leftWidth), ty + max(topLeft.height(), topWidth)); - quad[2] = FloatPoint(tx + max(bottomLeft.width(), leftWidth), ty + h - max(bottomLeft.height(), bottomWidth)); + quad[1] = FloatPoint(tx + max(border.radii().topLeft().width(), leftWidth), ty + max(border.radii().topLeft().height(), topWidth)); + quad[2] = FloatPoint(tx + max(border.radii().bottomLeft().width(), leftWidth), ty + h - max(border.radii().bottomLeft().height(), bottomWidth)); quad[3] = FloatPoint(tx, ty + h); break; case BSBottom: quad[0] = FloatPoint(tx, ty + h); - quad[1] = FloatPoint(tx + max(bottomLeft.width(), leftWidth), ty + h - max(bottomLeft.height(), bottomWidth)); - quad[2] = FloatPoint(tx + w - max(bottomRight.width(), rightWidth), ty + h - max(bottomRight.height(), bottomWidth)); + quad[1] = FloatPoint(tx + max(border.radii().bottomLeft().width(), leftWidth), ty + h - max(border.radii().bottomLeft().height(), bottomWidth)); + quad[2] = FloatPoint(tx + w - max(border.radii().bottomRight().width(), rightWidth), ty + h - max(border.radii().bottomRight().height(), bottomWidth)); quad[3] = FloatPoint(tx + w, ty + h); break; case BSRight: quad[0] = FloatPoint(tx + w, ty); - quad[1] = FloatPoint(tx + w - max(topRight.width(), rightWidth), ty + max(topRight.height(), topWidth)); - quad[2] = FloatPoint(tx + w - max(bottomRight.width(), rightWidth), ty + h - max(bottomRight.height(), bottomWidth)); + quad[1] = FloatPoint(tx + w - max(border.radii().topRight().width(), rightWidth), ty + max(border.radii().topRight().height(), topWidth)); + quad[2] = FloatPoint(tx + w - max(border.radii().bottomRight().width(), rightWidth), ty + h - max(border.radii().bottomRight().height(), bottomWidth)); quad[3] = FloatPoint(tx + w, ty + h); break; default: @@ -1613,18 +1545,6 @@ void RenderBoxModelObject::clipBorderSidePolygon(GraphicsContext* graphicsContex graphicsContext->clipConvexPolygon(4, secondQuad, !secondEdgeMatches); } -static inline void uniformlyExpandBorderRadii(int delta, IntSize& topLeft, IntSize& topRight, IntSize& bottomLeft, IntSize& bottomRight) -{ - topLeft.expand(delta, delta); - topLeft.clampNegativeToZero(); - topRight.expand(delta, delta); - topRight.clampNegativeToZero(); - bottomLeft.expand(delta, delta); - bottomLeft.clampNegativeToZero(); - bottomRight.expand(delta, delta); - bottomRight.clampNegativeToZero(); -} - void RenderBoxModelObject::paintBoxShadow(GraphicsContext* context, int tx, int ty, int w, int h, const RenderStyle* s, ShadowStyle shadowStyle, bool includeLogicalLeftEdge, bool includeLogicalRightEdge) { // FIXME: Deal with border-image. Would be great to use border-image as a mask. @@ -1632,61 +1552,19 @@ void RenderBoxModelObject::paintBoxShadow(GraphicsContext* context, int tx, int if (context->paintingDisabled()) return; - IntRect rect(tx, ty, w, h); - IntSize topLeft; - IntSize topRight; - IntSize bottomLeft; - IntSize bottomRight; - + RoundedIntRect border(tx, ty, w, h); bool hasBorderRadius = s->hasBorderRadius(); bool isHorizontal = s->isHorizontalWritingMode(); if (hasBorderRadius && (includeLogicalLeftEdge || includeLogicalRightEdge)) { - IntSize topLeftRadius, topRightRadius, bottomLeftRadius, bottomRightRadius; - s->getBorderRadiiForRect(rect, topLeftRadius, topRightRadius, bottomLeftRadius, bottomRightRadius); - - if (includeLogicalLeftEdge) { - if (shadowStyle == Inset) { - topLeftRadius.expand(-borderLeft(), -borderTop()); - topLeftRadius.clampNegativeToZero(); - if (isHorizontal) { - bottomLeftRadius.expand(-borderLeft(), -borderBottom()); - bottomLeftRadius.clampNegativeToZero(); - } else { - topRightRadius.expand(-borderRight(), -borderTop()); - topRightRadius.clampNegativeToZero(); - } - } - topLeft = topLeftRadius; - if (isHorizontal) - bottomLeft = bottomLeftRadius; - else - topRight = topRightRadius; - } - if (includeLogicalRightEdge) { - if (shadowStyle == Inset) { - if (isHorizontal) { - topRightRadius.expand(-borderRight(), -borderTop()); - topRightRadius.clampNegativeToZero(); - } else { - bottomLeftRadius.expand(-borderLeft(), -borderBottom()); - bottomLeftRadius.clampNegativeToZero(); - } - bottomRightRadius.expand(-borderRight(), -borderBottom()); - bottomRightRadius.clampNegativeToZero(); - } - if (isHorizontal) - topRight = topRightRadius; - else - bottomLeft = bottomLeftRadius; - bottomRight = bottomRightRadius; - } - } - - if (shadowStyle == Inset) { - rect.move(includeLogicalLeftEdge || !isHorizontal ? borderLeft() : 0, includeLogicalLeftEdge || isHorizontal ? borderTop() : 0); - rect.setWidth(rect.width() - ((includeLogicalLeftEdge || !isHorizontal) ? borderLeft() : 0) - ((includeLogicalRightEdge || !isHorizontal) ? borderRight() : 0)); - rect.setHeight(rect.height() - ((includeLogicalLeftEdge || isHorizontal) ? borderTop() : 0) - ((includeLogicalRightEdge || isHorizontal) ? borderBottom() : 0)); + RoundedIntRect::Radii radii = ((shadowStyle == Inset) ? s->getRoundedInnerBorderWithBorderWidths(border.rect(), borderTop(), borderBottom(), borderLeft(), borderRight()) : s->getRoundedBorderFor(border.rect())).radii(); + border.includeLogicalEdges(radii, isHorizontal, includeLogicalLeftEdge, includeLogicalRightEdge); } + + if (shadowStyle == Inset) + border.setRect(IntRect(border.rect().x() + (includeLogicalLeftEdge || !isHorizontal ? borderLeft() : 0), + border.rect().y() + (includeLogicalLeftEdge || isHorizontal ? borderTop() : 0), + border.rect().width() - ((includeLogicalLeftEdge || !isHorizontal) ? borderLeft() : 0) - ((includeLogicalRightEdge || !isHorizontal) ? borderRight() : 0), + border.rect().height() - ((includeLogicalLeftEdge || isHorizontal) ? borderTop() : 0) - ((includeLogicalRightEdge || isHorizontal) ? borderBottom() : 0))); bool hasOpaqueBackground = s->visitedDependentColor(CSSPropertyBackgroundColor).isValid() && s->visitedDependentColor(CSSPropertyBackgroundColor).alpha() == 255; for (const ShadowData* shadow = s->boxShadow(); shadow; shadow = shadow->next()) { @@ -1699,12 +1577,12 @@ void RenderBoxModelObject::paintBoxShadow(GraphicsContext* context, int tx, int const Color& shadowColor = shadow->color(); if (shadow->style() == Normal) { - IntRect fillRect(rect); + RoundedIntRect fillRect = border; fillRect.inflate(shadowSpread); if (fillRect.isEmpty()) continue; - IntRect shadowRect(rect); + IntRect shadowRect(border.rect()); shadowRect.inflate(shadowBlur + shadowSpread); shadowRect.move(shadowOffset); @@ -1719,32 +1597,23 @@ void RenderBoxModelObject::paintBoxShadow(GraphicsContext* context, int tx, int context->setShadow(shadowOffset, shadowBlur, shadowColor, s->colorSpace()); if (hasBorderRadius) { - IntRect rectToClipOut = rect; - IntSize topLeftToClipOut = topLeft; - IntSize topRightToClipOut = topRight; - IntSize bottomLeftToClipOut = bottomLeft; - IntSize bottomRightToClipOut = bottomRight; - - IntSize topLeftToFill = topLeft; - IntSize topRightToFill = topRight; - IntSize bottomLeftToFill = bottomLeft; - IntSize bottomRightToFill = bottomRight; - if (shadowSpread < 0) - uniformlyExpandBorderRadii(shadowSpread, topLeftToFill, topRightToFill, bottomLeftToFill, bottomRightToFill); + RoundedIntRect rectToClipOut = border; // If the box is opaque, it is unnecessary to clip it out. However, doing so saves time // when painting the shadow. On the other hand, it introduces subpixel gaps along the // corners. Those are avoided by insetting the clipping path by one pixel. if (hasOpaqueBackground) { - rectToClipOut.inflate(-1); - uniformlyExpandBorderRadii(-1, topLeftToClipOut, topRightToClipOut, bottomLeftToClipOut, bottomRightToClipOut); + rectToClipOut.inflateWithRadii(-1); } if (!rectToClipOut.isEmpty()) - context->clipOutRoundedRect(rectToClipOut, topLeftToClipOut, topRightToClipOut, bottomLeftToClipOut, bottomRightToClipOut); - context->fillRoundedRect(fillRect, topLeftToFill, topRightToFill, bottomLeftToFill, bottomRightToFill, Color::black, s->colorSpace()); + context->clipOutRoundedRect(rectToClipOut); + + if (shadowSpread < 0) + fillRect.expandRadii(shadowSpread); + context->fillRoundedRect(fillRect, Color::black, s->colorSpace()); } else { - IntRect rectToClipOut = rect; + IntRect rectToClipOut = border.rect(); // If the box is opaque, it is unnecessary to clip it out. However, doing so saves time // when painting the shadow. On the other hand, it introduces subpixel gaps along the @@ -1759,20 +1628,20 @@ void RenderBoxModelObject::paintBoxShadow(GraphicsContext* context, int tx, int if (!rectToClipOut.isEmpty()) context->clipOut(rectToClipOut); - context->fillRect(fillRect, Color::black, s->colorSpace()); + context->fillRect(fillRect.rect(), Color::black, s->colorSpace()); } context->restore(); } else { // Inset shadow. - IntRect holeRect(rect); + IntRect holeRect(border.rect()); holeRect.inflate(-shadowSpread); if (holeRect.isEmpty()) { if (hasBorderRadius) - context->fillRoundedRect(rect, topLeft, topRight, bottomLeft, bottomRight, shadowColor, s->colorSpace()); + context->fillRoundedRect(border, shadowColor, s->colorSpace()); else - context->fillRect(rect, shadowColor, s->colorSpace()); + context->fillRect(border.rect(), shadowColor, s->colorSpace()); continue; } @@ -1794,7 +1663,7 @@ void RenderBoxModelObject::paintBoxShadow(GraphicsContext* context, int tx, int Color fillColor(shadowColor.red(), shadowColor.green(), shadowColor.blue(), 255); - IntRect outerRect(rect); + IntRect outerRect(border.rect()); outerRect.inflateX(w - 2 * shadowSpread); outerRect.inflateY(h - 2 * shadowSpread); @@ -1802,11 +1671,11 @@ void RenderBoxModelObject::paintBoxShadow(GraphicsContext* context, int tx, int Path path; if (hasBorderRadius) { - path.addRoundedRect(rect, topLeft, topRight, bottomLeft, bottomRight); + path.addRoundedRect(border.rect(), border.radii().topLeft(), border.radii().topRight(), border.radii().bottomLeft(), border.radii().bottomRight()); context->clip(path); path.clear(); } else - context->clip(rect); + context->clip(border.rect()); IntSize extraOffset(2 * w + max(0, shadowOffset.width()) + shadowBlur - 2 * shadowSpread + 1, 0); context->translate(extraOffset.width(), extraOffset.height()); @@ -1816,8 +1685,8 @@ void RenderBoxModelObject::paintBoxShadow(GraphicsContext* context, int tx, int if (hasBorderRadius) { if (shadowSpread > 0) - uniformlyExpandBorderRadii(-shadowSpread, topLeft, topRight, bottomLeft, bottomRight); - path.addRoundedRect(holeRect, topLeft, topRight, bottomLeft, bottomRight); + border.shrinkRadii(shadowSpread); + path.addRoundedRect(holeRect, border.radii().topLeft(), border.radii().topRight(), border.radii().bottomLeft(), border.radii().bottomRight()); } else path.addRect(holeRect); diff --git a/Source/WebCore/rendering/RenderBoxModelObject.h b/Source/WebCore/rendering/RenderBoxModelObject.h index 8f9f465..f6bcb94 100644 --- a/Source/WebCore/rendering/RenderBoxModelObject.h +++ b/Source/WebCore/rendering/RenderBoxModelObject.h @@ -134,8 +134,8 @@ private: IntSize calculateFillTileSize(const FillLayer*, IntSize scaledSize) const; - void clipBorderSidePolygon(GraphicsContext*, const IntRect&, const IntSize& topLeft, const IntSize& topRight, const IntSize& bottomLeft, - const IntSize& bottomRight, const BoxSide side, bool firstEdgeMatches, bool secondEdgeMatches, const RenderStyle* style, + void clipBorderSidePolygon(GraphicsContext*, const RoundedIntRect& border, + const BoxSide, bool firstEdgeMatches, bool secondEdgeMatches, const RenderStyle*, bool includeLogicalLeftEdge, bool includeLogicalRightEdge); friend class RenderView; diff --git a/Source/WebCore/rendering/RenderDataGrid.h b/Source/WebCore/rendering/RenderDataGrid.h index 1492d26..852010c 100644 --- a/Source/WebCore/rendering/RenderDataGrid.h +++ b/Source/WebCore/rendering/RenderDataGrid.h @@ -30,14 +30,14 @@ #include "HTMLDataGridElement.h" #include "RenderBlock.h" -#include "ScrollbarClient.h" +#include "ScrollableArea.h" #include "StyleImage.h" #include <wtf/RefPtr.h> #include <wtf/Vector.h> namespace WebCore { -class RenderDataGrid : public RenderBlock, private ScrollbarClient { +class RenderDataGrid : public RenderBlock, private ScrollableArea { public: RenderDataGrid(Element*); ~RenderDataGrid(); @@ -66,7 +66,7 @@ private: HTMLDataGridElement* gridElement() const { return static_cast<HTMLDataGridElement*>(node()); } - // ScrollbarClient interface. + // ScrollableArea interface. virtual int scrollSize(ScrollbarOrientation orientation) const; virtual void setScrollOffsetFromAnimation(const IntPoint&); virtual void valueChanged(Scrollbar*); diff --git a/Source/WebCore/rendering/RenderEmbeddedObject.cpp b/Source/WebCore/rendering/RenderEmbeddedObject.cpp index ac72fe1..5486d51 100644 --- a/Source/WebCore/rendering/RenderEmbeddedObject.cpp +++ b/Source/WebCore/rendering/RenderEmbeddedObject.cpp @@ -49,6 +49,7 @@ #include "RenderWidgetProtector.h" #include "Settings.h" #include "Text.h" +#include "TextRun.h" #if ENABLE(PLUGIN_PROXY_FOR_VIDEO) #include "HTMLVideoElement.h" diff --git a/Source/WebCore/rendering/RenderFileUploadControl.cpp b/Source/WebCore/rendering/RenderFileUploadControl.cpp index 3e4d216..aec55a8 100644 --- a/Source/WebCore/rendering/RenderFileUploadControl.cpp +++ b/Source/WebCore/rendering/RenderFileUploadControl.cpp @@ -37,6 +37,7 @@ #include "RenderText.h" #include "RenderTheme.h" #include "RenderView.h" +#include "TextRun.h" #include <math.h> using namespace std; diff --git a/Source/WebCore/rendering/RenderFlexibleBox.cpp b/Source/WebCore/rendering/RenderFlexibleBox.cpp index 5d96adb..5af5733 100644 --- a/Source/WebCore/rendering/RenderFlexibleBox.cpp +++ b/Source/WebCore/rendering/RenderFlexibleBox.cpp @@ -28,6 +28,7 @@ #include "CharacterNames.h" #include "RenderLayer.h" #include "RenderView.h" +#include "TextRun.h" #include <wtf/StdLibExtras.h> #ifdef ANDROID_LAYOUT diff --git a/Source/WebCore/rendering/RenderFrameSet.h b/Source/WebCore/rendering/RenderFrameSet.h index cdc7b5a..4d14410 100644 --- a/Source/WebCore/rendering/RenderFrameSet.h +++ b/Source/WebCore/rendering/RenderFrameSet.h @@ -77,7 +77,8 @@ public: private: static const int noSplit = -1; - class GridAxis : public Noncopyable { + class GridAxis { + WTF_MAKE_NONCOPYABLE(GridAxis); public: GridAxis(); void resize(int); diff --git a/Source/WebCore/rendering/RenderImage.cpp b/Source/WebCore/rendering/RenderImage.cpp index 7f4c41e..839328e 100644 --- a/Source/WebCore/rendering/RenderImage.cpp +++ b/Source/WebCore/rendering/RenderImage.cpp @@ -41,6 +41,7 @@ #include "RenderTheme.h" #include "RenderView.h" #include "SelectionController.h" +#include "TextRun.h" #include <wtf/CurrentTime.h> #include <wtf/UnusedParam.h> diff --git a/Source/WebCore/rendering/RenderImageResource.h b/Source/WebCore/rendering/RenderImageResource.h index 2346712..a20c55a 100644 --- a/Source/WebCore/rendering/RenderImageResource.h +++ b/Source/WebCore/rendering/RenderImageResource.h @@ -29,13 +29,13 @@ #include "CachedImage.h" #include "CachedResourceHandle.h" #include "StyleImage.h" -#include <wtf/Noncopyable.h> namespace WebCore { class RenderObject; -class RenderImageResource : public Noncopyable { +class RenderImageResource { + WTF_MAKE_NONCOPYABLE(RenderImageResource); WTF_MAKE_FAST_ALLOCATED; public: virtual ~RenderImageResource(); diff --git a/Source/WebCore/rendering/RenderLayer.cpp b/Source/WebCore/rendering/RenderLayer.cpp index 3613d95..29a6fc9 100644 --- a/Source/WebCore/rendering/RenderLayer.cpp +++ b/Source/WebCore/rendering/RenderLayer.cpp @@ -1322,23 +1322,36 @@ void RenderLayer::scrollByRecursively(int xDelta, int yDelta) } } -void RenderLayer::scrollToOffset(int x, int y, bool updateScrollbars, bool repaint) +void RenderLayer::scrollToOffset(int x, int y) +{ + ScrollableArea::scrollToOffsetWithoutAnimation(IntPoint(x, y)); +} + +void RenderLayer::scrollTo(int x, int y) { RenderBox* box = renderBox(); if (!box) return; if (box->style()->overflowX() != OMARQUEE) { - if (x < 0) x = 0; - if (y < 0) y = 0; + if (x < 0) + x = 0; + if (y < 0) + y = 0; // Call the scrollWidth/Height functions so that the dimensions will be computed if they need // to be (for overflow:hidden blocks). int maxX = scrollWidth() - box->clientWidth(); + if (maxX < 0) + maxX = 0; int maxY = scrollHeight() - box->clientHeight(); - - if (x > maxX) x = maxX; - if (y > maxY) y = maxY; + if (maxY < 0) + maxY = 0; + + if (x > maxX) + x = maxX; + if (y > maxY) + y = maxY; } // FIXME: Eventually, we will want to perform a blit. For now never @@ -1402,16 +1415,9 @@ void RenderLayer::scrollToOffset(int x, int y, bool updateScrollbars, bool repai } // Just schedule a full repaint of our object. - if (view && repaint) + if (view) renderer()->repaintUsingContainer(repaintContainer, rectForRepaint); - if (updateScrollbars) { - if (m_hBar) - m_hBar->setValue(scrollXOffset(), Scrollbar::NotFromScrollAnimator); - if (m_vBar) - m_vBar->setValue(m_scrollY, Scrollbar::NotFromScrollAnimator); - } - // Schedule the scroll DOM event. renderer()->node()->document()->eventQueue()->enqueueScrollEvent(renderer()->node(), EventQueue::ScrollEventElementTarget); } @@ -1665,36 +1671,18 @@ int RenderLayer::scrollSize(ScrollbarOrientation orientation) const return scrollbar ? (scrollbar->totalSize() - scrollbar->visibleSize()) : 0; } -void RenderLayer::setScrollOffsetFromAnimation(const IntPoint& offset) +void RenderLayer::setScrollOffset(const IntPoint& offset) { - if (m_hBar) - m_hBar->setValue(offset.x(), Scrollbar::FromScrollAnimator); - if (m_vBar) - m_vBar->setValue(offset.y(), Scrollbar::FromScrollAnimator); + scrollTo(offset.x(), offset.y()); } -void RenderLayer::valueChanged(Scrollbar*) +int RenderLayer::scrollPosition(Scrollbar* scrollbar) const { - // Update scroll position from scrollbars. - - bool needUpdate = false; - int newX = scrollXOffset(); - int newY = m_scrollY; - - if (m_hBar) { - newX = m_hBar->value(); - if (newX != scrollXOffset()) - needUpdate = true; - } - - if (m_vBar) { - newY = m_vBar->value(); - if (newY != m_scrollY) - needUpdate = true; - } - - if (needUpdate) - scrollToOffset(newX, newY, false); + if (scrollbar->orientation() == HorizontalScrollbar) + return scrollXOffset(); + if (scrollbar->orientation() == VerticalScrollbar) + return m_scrollY; + return 0; } bool RenderLayer::isActive() const @@ -1703,7 +1691,6 @@ bool RenderLayer::isActive() const return page && page->focusController()->isActive(); } - static IntRect cornerRect(const RenderLayer* layer, const IntRect& bounds) { int horizontalThickness; @@ -1849,7 +1836,7 @@ void RenderLayer::destroyScrollbar(ScrollbarOrientation orientation) static_cast<RenderScrollbar*>(scrollbar.get())->clearOwningRenderer(); scrollbar->removeFromParent(); - scrollbar->setClient(0); + scrollbar->disconnectFromScrollableArea(); scrollbar = 0; } } @@ -1902,14 +1889,14 @@ void RenderLayer::setHasVerticalScrollbar(bool hasScrollbar) int RenderLayer::verticalScrollbarWidth() const { - if (!m_vBar) + if (!m_vBar || ScrollbarTheme::nativeTheme()->usesOverlayScrollbars()) return 0; return m_vBar->width(); } int RenderLayer::horizontalScrollbarHeight() const { - if (!m_hBar) + if (!m_hBar || ScrollbarTheme::nativeTheme()->usesOverlayScrollbars()) return 0; return m_hBar->height(); } @@ -2076,8 +2063,7 @@ void RenderLayer::updateOverflowStatus(bool horizontalOverflow, bool verticalOve } } -void -RenderLayer::updateScrollInfoAfterLayout() +void RenderLayer::updateScrollInfoAfterLayout() { RenderBox* box = renderBox(); if (!box) @@ -2169,28 +2155,16 @@ RenderLayer::updateScrollInfoAfterLayout() int pageStep = max(max<int>(clientWidth * Scrollbar::minFractionToStepWhenPaging(), clientWidth - Scrollbar::maxOverlapBetweenPages()), 1); m_hBar->setSteps(Scrollbar::pixelsPerLineStep(), pageStep); m_hBar->setProportion(clientWidth, m_scrollWidth); - // Explicitly set the horizontal scroll value. This ensures that when a - // right-to-left scrollable area's width (or content width) changes, the - // top right corner of the content doesn't shift with respect to the top - // right corner of the area. Conceptually, right-to-left areas have - // their origin at the top-right, but RenderLayer is top-left oriented, - // so this is needed to keep everything working. - m_hBar->setValue(scrollXOffset(), Scrollbar::NotFromScrollAnimator); } if (m_vBar) { int clientHeight = box->clientHeight(); int pageStep = max(max<int>(clientHeight * Scrollbar::minFractionToStepWhenPaging(), clientHeight - Scrollbar::maxOverlapBetweenPages()), 1); m_vBar->setSteps(Scrollbar::pixelsPerLineStep(), pageStep); m_vBar->setProportion(clientHeight, m_scrollHeight); - // Explicitly set the vertical scroll value. This ensures that when a - // right-to-left vertical writing-mode scrollable area's height (or content height) changes, the - // bottom right corner of the content doesn't shift with respect to the bottom - // right corner of the area. Conceptually, right-to-left vertical writing-mode areas have - // their origin at the bottom-right, but RenderLayer is top-left oriented, - // so this is needed to keep everything working. - m_vBar->setValue(scrollYOffset(), Scrollbar::NotFromScrollAnimator); } + scrollToOffset(scrollXOffset(), scrollYOffset()); + if (renderer()->node() && renderer()->document()->hasListenerType(Document::OVERFLOWCHANGED_LISTENER)) updateOverflowStatus(horizontalOverflow, verticalOverflow); @@ -2359,15 +2333,7 @@ bool RenderLayer::hitTestOverflowControls(HitTestResult& result, const IntPoint& bool RenderLayer::scroll(ScrollDirection direction, ScrollGranularity granularity, float multiplier) { - bool didHorizontalScroll = false; - bool didVerticalScroll = false; - - if (m_hBar) - didHorizontalScroll = m_hBar->scroll(direction, granularity, multiplier); - if (m_vBar) - didVerticalScroll = m_vBar->scroll(direction, granularity, multiplier); - - return (didHorizontalScroll || didVerticalScroll); + return ScrollableArea::scroll(direction, granularity, multiplier); } void RenderLayer::paint(GraphicsContext* p, const IntRect& damageRect, PaintBehavior paintBehavior, RenderObject *paintingRoot) diff --git a/Source/WebCore/rendering/RenderLayer.h b/Source/WebCore/rendering/RenderLayer.h index 8245c2f..57cb4de 100644 --- a/Source/WebCore/rendering/RenderLayer.h +++ b/Source/WebCore/rendering/RenderLayer.h @@ -47,7 +47,7 @@ #include "PaintInfo.h" #include "RenderBox.h" #include "ScrollBehavior.h" -#include "ScrollbarClient.h" +#include "ScrollableArea.h" #include <wtf/OwnPtr.h> namespace WebCore { @@ -176,7 +176,7 @@ private: bool m_fixed : 1; }; -class RenderLayer : public ScrollbarClient { +class RenderLayer : public ScrollableArea { public: friend class RenderReplica; @@ -266,7 +266,7 @@ public: int scrollXOffset() const { return m_scrollX + m_scrollOrigin.x(); } int scrollYOffset() const { return m_scrollY + m_scrollOrigin.y(); } - void scrollToOffset(int x, int y, bool updateScrollbars = true, bool repaint = true); + void scrollToOffset(int x, int y); void scrollToXOffset(int x) { scrollToOffset(x, m_scrollY + m_scrollOrigin.y()); } void scrollToYOffset(int y) { scrollToOffset(m_scrollX + m_scrollOrigin.x(), y); } void scrollRectToVisible(const IntRect&, bool scrollToAnchor = false, const ScrollAlignment& alignX = ScrollAlignment::alignCenterIfNeeded, const ScrollAlignment& alignY = ScrollAlignment::alignCenterIfNeeded); @@ -560,10 +560,10 @@ private: bool shouldBeNormalFlowOnly() const; - // ScrollBarClient interface + // ScrollableArea interface virtual int scrollSize(ScrollbarOrientation orientation) const; - virtual void setScrollOffsetFromAnimation(const IntPoint&); - virtual void valueChanged(Scrollbar*); + virtual void setScrollOffset(const IntPoint&); + virtual int scrollPosition(Scrollbar*) const; virtual void invalidateScrollbarRect(Scrollbar*, const IntRect&); virtual bool isActive() const; virtual bool scrollbarCornerPresent() const; @@ -571,7 +571,10 @@ private: virtual IntRect convertFromContainingViewToScrollbar(const Scrollbar*, const IntRect&) const; virtual IntPoint convertFromScrollbarToContainingView(const Scrollbar*, const IntPoint&) const; virtual IntPoint convertFromContainingViewToScrollbar(const Scrollbar*, const IntPoint&) const; - + + // NOTE: This should only be called by the overriden setScrollOffset from ScrollableArea. + void scrollTo(int x, int y); + IntSize scrollbarOffset(const Scrollbar*) const; void updateOverflowStatus(bool horizontalOverflow, bool verticalOverflow); diff --git a/Source/WebCore/rendering/RenderLayerBacking.h b/Source/WebCore/rendering/RenderLayerBacking.h index 5c6ed12..726b777 100644 --- a/Source/WebCore/rendering/RenderLayerBacking.h +++ b/Source/WebCore/rendering/RenderLayerBacking.h @@ -53,7 +53,8 @@ enum CompositingLayerType { // // There is one RenderLayerBacking for each RenderLayer that is composited. -class RenderLayerBacking : public GraphicsLayerClient, public Noncopyable { +class RenderLayerBacking : public GraphicsLayerClient { + WTF_MAKE_NONCOPYABLE(RenderLayerBacking); WTF_MAKE_FAST_ALLOCATED; public: RenderLayerBacking(RenderLayer*); ~RenderLayerBacking(); diff --git a/Source/WebCore/rendering/RenderLayerCompositor.cpp b/Source/WebCore/rendering/RenderLayerCompositor.cpp index 15bb8ec..9a5dda7 100644 --- a/Source/WebCore/rendering/RenderLayerCompositor.cpp +++ b/Source/WebCore/rendering/RenderLayerCompositor.cpp @@ -108,6 +108,7 @@ RenderLayerCompositor::RenderLayerCompositor(RenderView* renderView) , m_compositingDependsOnGeometry(false) , m_compositing(false) , m_compositingLayersNeedRebuild(false) + , m_flushingLayers(false) , m_rootLayerAttachment(RootLayerUnattached) #if PROFILE_LAYER_REBUILD , m_rootLayerUpdateCount(0) @@ -188,12 +189,32 @@ void RenderLayerCompositor::scheduleLayerFlush() void RenderLayerCompositor::flushPendingLayerChanges() { + ASSERT(!m_flushingLayers); + m_flushingLayers = true; + // FIXME: FrameView::syncCompositingStateRecursive() calls this for each // frame, so when compositing layers are connected between frames, we'll // end up syncing subframe's layers multiple times. // https://bugs.webkit.org/show_bug.cgi?id=52489 if (GraphicsLayer* rootLayer = rootPlatformLayer()) rootLayer->syncCompositingState(); + + ASSERT(m_flushingLayers); + m_flushingLayers = false; +} + +RenderLayerCompositor* RenderLayerCompositor::enclosingCompositorFlushingLayers() const +{ + if (!m_renderView->frameView()) + return 0; + + for (Frame* frame = m_renderView->frameView()->frame(); frame; frame = frame->tree()->parent()) { + RenderLayerCompositor* compositor = frame->contentRenderer() ? frame->contentRenderer()->compositor() : 0; + if (compositor->isFlushingLayers()) + return compositor; + } + + return 0; } void RenderLayerCompositor::scheduleCompositingLayerUpdate() diff --git a/Source/WebCore/rendering/RenderLayerCompositor.h b/Source/WebCore/rendering/RenderLayerCompositor.h index 24e182c..1cf9ea9 100644 --- a/Source/WebCore/rendering/RenderLayerCompositor.h +++ b/Source/WebCore/rendering/RenderLayerCompositor.h @@ -88,6 +88,11 @@ public: // at specific times. void scheduleLayerFlush(); void flushPendingLayerChanges(); + bool isFlushingLayers() const { return m_flushingLayers; } + + // flushPendingLayerChanges() flushes the entire GraphicsLayer tree, which can cross frame boundaries. + // This call returns the rootmost compositor that is being flushed (including self). + RenderLayerCompositor* enclosingCompositorFlushingLayers() const; // Rebuild the tree of compositing layers void updateCompositingLayers(CompositingUpdateType = CompositingUpdateAfterLayoutOrStyleChange, RenderLayer* updateRoot = 0); @@ -271,6 +276,7 @@ private: bool m_compositing; bool m_compositingLayersNeedRebuild; + bool m_flushingLayers; RootLayerAttachment m_rootLayerAttachment; diff --git a/Source/WebCore/rendering/RenderListBox.cpp b/Source/WebCore/rendering/RenderListBox.cpp index e6ce340..90f13da 100644 --- a/Source/WebCore/rendering/RenderListBox.cpp +++ b/Source/WebCore/rendering/RenderListBox.cpp @@ -43,6 +43,7 @@ #include "GraphicsContext.h" #include "HTMLNames.h" #include "HitTestResult.h" +#include "NodeRenderStyle.h" #include "OptionGroupElement.h" #include "OptionElement.h" #include "Page.h" @@ -51,9 +52,10 @@ #include "RenderTheme.h" #include "RenderView.h" #include "Scrollbar.h" +#include "ScrollbarTheme.h" #include "SelectElement.h" #include "SelectionController.h" -#include "NodeRenderStyle.h" +#include "TextRun.h" #include <math.h> using namespace std; @@ -493,9 +495,7 @@ bool RenderListBox::scrollToRevealElementAtListIndex(int index) else newOffset = index - numVisibleItems() + 1; - m_indexOffset = newOffset; - if (m_vBar) - m_vBar->setValue(m_indexOffset, Scrollbar::NotFromScrollAnimator); + ScrollableArea::scrollToYOffsetWithoutAnimation(newOffset); return true; } @@ -507,12 +507,12 @@ bool RenderListBox::listIndexIsVisible(int index) bool RenderListBox::scroll(ScrollDirection direction, ScrollGranularity granularity, float multiplier, Node**) { - return m_vBar && m_vBar->scroll(direction, granularity, multiplier); + return ScrollableArea::scroll(direction, granularity, multiplier); } bool RenderListBox::logicalScroll(ScrollLogicalDirection direction, ScrollGranularity granularity, float multiplier, Node**) { - return m_vBar && m_vBar->scroll(logicalToPhysical(direction, style()->isHorizontalWritingMode(), style()->isFlippedBlocksWritingMode()), granularity, multiplier); + return ScrollableArea::scroll(logicalToPhysical(direction, style()->isHorizontalWritingMode(), style()->isFlippedBlocksWritingMode()), granularity, multiplier); } void RenderListBox::valueChanged(unsigned listIndex) @@ -528,20 +528,24 @@ int RenderListBox::scrollSize(ScrollbarOrientation orientation) const return ((orientation == VerticalScrollbar) && m_vBar) ? (m_vBar->totalSize() - m_vBar->visibleSize()) : 0; } -void RenderListBox::setScrollOffsetFromAnimation(const IntPoint& offset) +int RenderListBox::scrollPosition(Scrollbar*) const { - if (m_vBar) - m_vBar->setValue(offset.y(), Scrollbar::FromScrollAnimator); + return m_indexOffset; } -void RenderListBox::valueChanged(Scrollbar*) +void RenderListBox::setScrollOffset(const IntPoint& offset) { - int newOffset = m_vBar->value(); - if (newOffset != m_indexOffset) { - m_indexOffset = newOffset; - repaint(); - node()->document()->eventQueue()->enqueueScrollEvent(node(), EventQueue::ScrollEventElementTarget); - } + scrollTo(offset.y()); +} + +void RenderListBox::scrollTo(int newOffset) +{ + if (newOffset == m_indexOffset) + return; + + m_indexOffset = newOffset; + repaint(); + node()->document()->eventQueue()->enqueueScrollEvent(node(), EventQueue::ScrollEventElementTarget); } int RenderListBox::itemHeight() const @@ -551,7 +555,7 @@ int RenderListBox::itemHeight() const int RenderListBox::verticalScrollbarWidth() const { - return m_vBar ? m_vBar->width() : 0; + return m_vBar && !ScrollbarTheme::nativeTheme()->usesOverlayScrollbars() ? m_vBar->width() : 0; } // FIXME: We ignore padding in the vertical direction as far as these values are concerned, since that's @@ -587,9 +591,8 @@ void RenderListBox::setScrollTop(int newTop) int index = newTop / itemHeight(); if (index < 0 || index >= numItems() || index == m_indexOffset) return; - m_indexOffset = index; - if (m_vBar) - m_vBar->setValue(index, Scrollbar::NotFromScrollAnimator); + + ScrollableArea::scrollToYOffsetWithoutAnimation(index); } bool RenderListBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& result, int x, int y, int tx, int ty, HitTestAction hitTestAction) @@ -711,7 +714,7 @@ void RenderListBox::destroyScrollbar() return; m_vBar->removeFromParent(); - m_vBar->setClient(0); + m_vBar->disconnectFromScrollableArea(); m_vBar = 0; } diff --git a/Source/WebCore/rendering/RenderListBox.h b/Source/WebCore/rendering/RenderListBox.h index 243fcbe..1ba2b94 100644 --- a/Source/WebCore/rendering/RenderListBox.h +++ b/Source/WebCore/rendering/RenderListBox.h @@ -32,11 +32,11 @@ #define RenderListBox_h #include "RenderBlock.h" -#include "ScrollbarClient.h" +#include "ScrollableArea.h" namespace WebCore { -class RenderListBox : public RenderBlock, private ScrollbarClient { +class RenderListBox : public RenderBlock, private ScrollableArea { public: RenderListBox(Element*); virtual ~RenderListBox(); @@ -94,10 +94,10 @@ private: virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, int x, int y, int tx, int ty, HitTestAction); - // ScrollbarClient interface. + // ScrollableArea interface. virtual int scrollSize(ScrollbarOrientation orientation) const; - virtual void setScrollOffsetFromAnimation(const IntPoint&); - virtual void valueChanged(Scrollbar*); + virtual int scrollPosition(Scrollbar*) const; + virtual void setScrollOffset(const IntPoint&); virtual void invalidateScrollbarRect(Scrollbar*, const IntRect&); virtual bool isActive() const; virtual bool scrollbarCornerPresent() const { return false; } // We don't support resize on list boxes yet. If we did this would have to change. @@ -105,6 +105,10 @@ private: virtual IntRect convertFromContainingViewToScrollbar(const Scrollbar*, const IntRect&) const; virtual IntPoint convertFromScrollbarToContainingView(const Scrollbar*, const IntPoint&) const; virtual IntPoint convertFromContainingViewToScrollbar(const Scrollbar*, const IntPoint&) const; + virtual Scrollbar* verticalScrollbar() const { return m_vBar.get(); } + + // NOTE: This should only be called by the overriden setScrollOffset from ScrollableArea. + void scrollTo(int newOffset); void setHasVerticalScrollbar(bool hasScrollbar); PassRefPtr<Scrollbar> createScrollbar(); diff --git a/Source/WebCore/rendering/RenderListMarker.cpp b/Source/WebCore/rendering/RenderListMarker.cpp index 71b1eae..cd41c75 100644 --- a/Source/WebCore/rendering/RenderListMarker.cpp +++ b/Source/WebCore/rendering/RenderListMarker.cpp @@ -32,6 +32,7 @@ #include "RenderLayer.h" #include "RenderListItem.h" #include "RenderView.h" +#include "TextRun.h" using namespace std; using namespace WTF; diff --git a/Source/WebCore/rendering/RenderMarquee.cpp b/Source/WebCore/rendering/RenderMarquee.cpp index 1c08831..9b58118 100644 --- a/Source/WebCore/rendering/RenderMarquee.cpp +++ b/Source/WebCore/rendering/RenderMarquee.cpp @@ -171,9 +171,9 @@ void RenderMarquee::start() if (!m_suspended && !m_stopped) { if (isHorizontal()) - m_layer->scrollToOffset(m_start, 0, false, false); + m_layer->scrollToOffset(m_start, 0); else - m_layer->scrollToOffset(0, m_start, false, false); + m_layer->scrollToOffset(0, m_start); } else { m_suspended = false; diff --git a/Source/WebCore/rendering/RenderMarquee.h b/Source/WebCore/rendering/RenderMarquee.h index 79998ed..98fddb9 100644 --- a/Source/WebCore/rendering/RenderMarquee.h +++ b/Source/WebCore/rendering/RenderMarquee.h @@ -53,7 +53,8 @@ namespace WebCore { class RenderLayer; // This class handles the auto-scrolling of layers with overflow: marquee. -class RenderMarquee : public Noncopyable { +class RenderMarquee { + WTF_MAKE_NONCOPYABLE(RenderMarquee); WTF_MAKE_FAST_ALLOCATED; public: explicit RenderMarquee(RenderLayer*); virtual ~RenderMarquee(); diff --git a/Source/WebCore/rendering/RenderMenuList.cpp b/Source/WebCore/rendering/RenderMenuList.cpp index 61f1084..e55b5ca 100644 --- a/Source/WebCore/rendering/RenderMenuList.cpp +++ b/Source/WebCore/rendering/RenderMenuList.cpp @@ -39,6 +39,7 @@ #include "RenderScrollbar.h" #include "RenderTheme.h" #include "SelectElement.h" +#include "TextRun.h" #include <math.h> using namespace std; @@ -455,14 +456,14 @@ HostWindow* RenderMenuList::hostWindow() const return document()->view()->hostWindow(); } -PassRefPtr<Scrollbar> RenderMenuList::createScrollbar(ScrollbarClient* client, ScrollbarOrientation orientation, ScrollbarControlSize controlSize) +PassRefPtr<Scrollbar> RenderMenuList::createScrollbar(ScrollableArea* scrollableArea, ScrollbarOrientation orientation, ScrollbarControlSize controlSize) { RefPtr<Scrollbar> widget; bool hasCustomScrollbarStyle = style()->hasPseudoStyle(SCROLLBAR); if (hasCustomScrollbarStyle) - widget = RenderScrollbar::createCustomScrollbar(client, orientation, this); + widget = RenderScrollbar::createCustomScrollbar(scrollableArea, orientation, this); else - widget = Scrollbar::createNativeScrollbar(client, orientation, controlSize); + widget = Scrollbar::createNativeScrollbar(scrollableArea, orientation, controlSize); return widget.release(); } diff --git a/Source/WebCore/rendering/RenderMenuList.h b/Source/WebCore/rendering/RenderMenuList.h index 2c99b1e..b84b799 100644 --- a/Source/WebCore/rendering/RenderMenuList.h +++ b/Source/WebCore/rendering/RenderMenuList.h @@ -107,7 +107,7 @@ private: virtual void selectionCleared() {} virtual FontSelector* fontSelector() const; virtual HostWindow* hostWindow() const; - virtual PassRefPtr<Scrollbar> createScrollbar(ScrollbarClient*, ScrollbarOrientation, ScrollbarControlSize); + virtual PassRefPtr<Scrollbar> createScrollbar(ScrollableArea*, ScrollbarOrientation, ScrollbarControlSize); #if ENABLE(NO_LISTBOX_RENDERING) virtual void listBoxSelectItem(int listIndex, bool allowMultiplySelections, bool shift, bool fireOnChangeNow = true); diff --git a/Source/WebCore/rendering/RenderObject.cpp b/Source/WebCore/rendering/RenderObject.cpp index 670f818..9a1233e 100644 --- a/Source/WebCore/rendering/RenderObject.cpp +++ b/Source/WebCore/rendering/RenderObject.cpp @@ -982,36 +982,24 @@ void RenderObject::drawBoxSideFromPath(GraphicsContext* graphicsContext, IntRect innerBorderLeftWidth += 1; // Get the inner border rects for both the outer border line and the inner border line - IntRect outerBorderInnerRect = borderInnerRect(borderRect, outerBorderTopWidth, outerBorderBottomWidth, - outerBorderLeftWidth, outerBorderRightWidth); - IntRect innerBorderInnerRect = borderInnerRect(borderRect, innerBorderTopWidth, innerBorderBottomWidth, - innerBorderLeftWidth, innerBorderRightWidth); - - // Get the inner radii for the outer border line - IntSize outerBorderTopLeftInnerRadius, outerBorderTopRightInnerRadius, outerBorderBottomLeftInnerRadius, - outerBorderBottomRightInnerRadius; - style->getInnerBorderRadiiForRectWithBorderWidths(outerBorderInnerRect, outerBorderTopWidth, outerBorderBottomWidth, - outerBorderLeftWidth, outerBorderRightWidth, outerBorderTopLeftInnerRadius, outerBorderTopRightInnerRadius, - outerBorderBottomLeftInnerRadius, outerBorderBottomRightInnerRadius); - - // Get the inner radii for the inner border line - IntSize innerBorderTopLeftInnerRadius, innerBorderTopRightInnerRadius, innerBorderBottomLeftInnerRadius, - innerBorderBottomRightInnerRadius; - style->getInnerBorderRadiiForRectWithBorderWidths(innerBorderInnerRect, innerBorderTopWidth, innerBorderBottomWidth, - innerBorderLeftWidth, innerBorderRightWidth, innerBorderTopLeftInnerRadius, innerBorderTopRightInnerRadius, - innerBorderBottomLeftInnerRadius, innerBorderBottomRightInnerRadius); // Draw inner border line graphicsContext->save(); - graphicsContext->addRoundedRectClip(innerBorderInnerRect, innerBorderTopLeftInnerRadius, - innerBorderTopRightInnerRadius, innerBorderBottomLeftInnerRadius, innerBorderBottomRightInnerRadius); + IntRect innerBorderInnerRect = borderInnerRect(borderRect, innerBorderTopWidth, innerBorderBottomWidth, + innerBorderLeftWidth, innerBorderRightWidth); + RoundedIntRect innerClip = style->getRoundedInnerBorderWithBorderWidths(innerBorderInnerRect, innerBorderTopWidth, innerBorderBottomWidth, + innerBorderLeftWidth, innerBorderRightWidth); + graphicsContext->addRoundedRectClip(innerClip); drawBoxSideFromPath(graphicsContext, borderRect, borderPath, thickness, drawThickness, s, style, c, SOLID); graphicsContext->restore(); // Draw outer border line graphicsContext->save(); - graphicsContext->clipOutRoundedRect(outerBorderInnerRect, outerBorderTopLeftInnerRadius, - outerBorderTopRightInnerRadius, outerBorderBottomLeftInnerRadius, outerBorderBottomRightInnerRadius); + IntRect outerBorderInnerRect = borderInnerRect(borderRect, outerBorderTopWidth, outerBorderBottomWidth, + outerBorderLeftWidth, outerBorderRightWidth); + RoundedIntRect outerClip = style->getRoundedInnerBorderWithBorderWidths(outerBorderInnerRect, outerBorderTopWidth, outerBorderBottomWidth, + outerBorderLeftWidth, outerBorderRightWidth); + graphicsContext->clipOutRoundedRect(outerClip); drawBoxSideFromPath(graphicsContext, borderRect, borderPath, thickness, drawThickness, s, style, c, SOLID); graphicsContext->restore(); @@ -1033,18 +1021,14 @@ void RenderObject::drawBoxSideFromPath(GraphicsContext* graphicsContext, IntRect IntRect halfBorderRect = borderInnerRect(borderRect, style->borderLeftWidth() / 2, style->borderBottomWidth() / 2, style->borderLeftWidth() / 2, style->borderRightWidth() / 2); - IntSize topLeftHalfRadius, topRightHalfRadius, bottomLeftHalfRadius, bottomRightHalfRadius; - style->getInnerBorderRadiiForRectWithBorderWidths(halfBorderRect, style->borderLeftWidth() / 2, - style->borderBottomWidth() / 2, style->borderLeftWidth() / 2, style->borderRightWidth() / 2, - topLeftHalfRadius, topRightHalfRadius, bottomLeftHalfRadius, bottomRightHalfRadius); - // Paint full border drawBoxSideFromPath(graphicsContext, borderRect, borderPath, thickness, drawThickness, s, style, c, s1); // Paint inner only graphicsContext->save(); - graphicsContext->addRoundedRectClip(halfBorderRect, topLeftHalfRadius, topRightHalfRadius, - bottomLeftHalfRadius, bottomRightHalfRadius); + RoundedIntRect clipRect = style->getRoundedInnerBorderWithBorderWidths(halfBorderRect, style->borderLeftWidth() / 2, style->borderBottomWidth() / 2, + style->borderLeftWidth() / 2, style->borderRightWidth() / 2); + graphicsContext->addRoundedRectClip(clipRect); drawBoxSideFromPath(graphicsContext, borderRect, borderPath, thickness, drawThickness, s, style, c, s2); graphicsContext->restore(); diff --git a/Source/WebCore/rendering/RenderObject.h b/Source/WebCore/rendering/RenderObject.h index cf08a0d..f2e7f13 100644 --- a/Source/WebCore/rendering/RenderObject.h +++ b/Source/WebCore/rendering/RenderObject.h @@ -26,7 +26,6 @@ #ifndef RenderObject_h #define RenderObject_h -#include "AffineTransform.h" #include "CachedResourceClient.h" #include "Document.h" #include "Element.h" @@ -44,6 +43,7 @@ namespace WebCore { +class AffineTransform; class AnimationController; class HitTestResult; class InlineBox; diff --git a/Source/WebCore/rendering/RenderOverflow.h b/Source/WebCore/rendering/RenderOverflow.h index 7dc2bcb..33e8cff 100644 --- a/Source/WebCore/rendering/RenderOverflow.h +++ b/Source/WebCore/rendering/RenderOverflow.h @@ -37,7 +37,8 @@ namespace WebCore // Examples of visual overflow are shadows, text stroke (and eventually outline and border-image). // This object is allocated only when some of these fields have non-default values in the owning box. -class RenderOverflow : public Noncopyable { +class RenderOverflow { + WTF_MAKE_NONCOPYABLE(RenderOverflow); WTF_MAKE_FAST_ALLOCATED; public: RenderOverflow(const IntRect& layoutRect, const IntRect& visualRect) : m_topLayoutOverflow(layoutRect.y()) diff --git a/Source/WebCore/rendering/RenderReplaced.cpp b/Source/WebCore/rendering/RenderReplaced.cpp index 974a8d0..0d72f95 100644 --- a/Source/WebCore/rendering/RenderReplaced.cpp +++ b/Source/WebCore/rendering/RenderReplaced.cpp @@ -135,11 +135,7 @@ void RenderReplaced::paint(PaintInfo& paintInfo, int tx, int ty) else { // Push a clip if we have a border radius, since we want to round the foreground content that gets painted. paintInfo.context->save(); - - IntSize topLeft, topRight, bottomLeft, bottomRight; - style()->getBorderRadiiForRect(borderRect, topLeft, topRight, bottomLeft, bottomRight); - - paintInfo.context->addRoundedRectClip(borderRect, topLeft, topRight, bottomLeft, bottomRight); + paintInfo.context->addRoundedRectClip(style()->getRoundedBorderFor(borderRect)); } } diff --git a/Source/WebCore/rendering/RenderScrollbar.cpp b/Source/WebCore/rendering/RenderScrollbar.cpp index 44a0126..4091d51 100644 --- a/Source/WebCore/rendering/RenderScrollbar.cpp +++ b/Source/WebCore/rendering/RenderScrollbar.cpp @@ -34,13 +34,13 @@ namespace WebCore { -PassRefPtr<Scrollbar> RenderScrollbar::createCustomScrollbar(ScrollbarClient* client, ScrollbarOrientation orientation, RenderBox* renderer, Frame* owningFrame) +PassRefPtr<Scrollbar> RenderScrollbar::createCustomScrollbar(ScrollableArea* scrollableArea, ScrollbarOrientation orientation, RenderBox* renderer, Frame* owningFrame) { - return adoptRef(new RenderScrollbar(client, orientation, renderer, owningFrame)); + return adoptRef(new RenderScrollbar(scrollableArea, orientation, renderer, owningFrame)); } -RenderScrollbar::RenderScrollbar(ScrollbarClient* client, ScrollbarOrientation orientation, RenderBox* renderer, Frame* owningFrame) - : Scrollbar(client, orientation, RegularScrollbar, RenderScrollbarTheme::renderScrollbarTheme()) +RenderScrollbar::RenderScrollbar(ScrollableArea* scrollableArea, ScrollbarOrientation orientation, RenderBox* renderer, Frame* owningFrame) + : Scrollbar(scrollableArea, orientation, RegularScrollbar, RenderScrollbarTheme::renderScrollbarTheme()) , m_owner(renderer) , m_owningFrame(owningFrame) { diff --git a/Source/WebCore/rendering/RenderScrollbar.h b/Source/WebCore/rendering/RenderScrollbar.h index de70624..8f4de4f 100644 --- a/Source/WebCore/rendering/RenderScrollbar.h +++ b/Source/WebCore/rendering/RenderScrollbar.h @@ -39,11 +39,11 @@ class RenderStyle; class RenderScrollbar : public Scrollbar { protected: - RenderScrollbar(ScrollbarClient*, ScrollbarOrientation, RenderBox*, Frame*); + RenderScrollbar(ScrollableArea*, ScrollbarOrientation, RenderBox*, Frame*); public: friend class Scrollbar; - static PassRefPtr<Scrollbar> createCustomScrollbar(ScrollbarClient*, ScrollbarOrientation, RenderBox*, Frame* owningFrame = 0); + static PassRefPtr<Scrollbar> createCustomScrollbar(ScrollableArea*, ScrollbarOrientation, RenderBox*, Frame* owningFrame = 0); virtual ~RenderScrollbar(); static ScrollbarPart partForStyleResolve(); diff --git a/Source/WebCore/rendering/RenderSelectionInfo.h b/Source/WebCore/rendering/RenderSelectionInfo.h index a09fc1a..45ca813 100644 --- a/Source/WebCore/rendering/RenderSelectionInfo.h +++ b/Source/WebCore/rendering/RenderSelectionInfo.h @@ -30,7 +30,8 @@ namespace WebCore { -class RenderSelectionInfoBase : public Noncopyable { +class RenderSelectionInfoBase { + WTF_MAKE_NONCOPYABLE(RenderSelectionInfoBase); WTF_MAKE_FAST_ALLOCATED; public: RenderSelectionInfoBase() : m_object(0) diff --git a/Source/WebCore/rendering/RenderSlider.cpp b/Source/WebCore/rendering/RenderSlider.cpp index b0dc0d9..49da396 100644 --- a/Source/WebCore/rendering/RenderSlider.cpp +++ b/Source/WebCore/rendering/RenderSlider.cpp @@ -181,116 +181,6 @@ SliderThumbElement* RenderSlider::sliderThumbElement() const return toSliderThumbElement(static_cast<Element*>(node())->shadowRoot()); } -bool RenderSlider::mouseEventIsInThumb(MouseEvent* evt) -{ - SliderThumbElement* thumbElement = sliderThumbElement(); - if (!thumbElement || !thumbElement->renderer()) - return false; - -#if ENABLE(VIDEO) - if (style()->appearance() == MediaSliderPart || style()->appearance() == MediaVolumeSliderPart) { - MediaControlInputElement* sliderThumb = static_cast<MediaControlInputElement*>(thumbElement->renderer()->node()); - return sliderThumb->hitTest(evt->absoluteLocation()); - } -#endif - - FloatPoint localPoint = thumbElement->renderBox()->absoluteToLocal(evt->absoluteLocation(), false, true); - IntRect thumbBounds = thumbElement->renderBox()->borderBoxRect(); - return thumbBounds.contains(roundedIntPoint(localPoint)); -} - -FloatPoint RenderSlider::mouseEventOffsetToThumb(MouseEvent* evt) -{ - SliderThumbElement* thumbElement = sliderThumbElement(); - ASSERT(thumbElement && thumbElement->renderer()); - FloatPoint localPoint = thumbElement->renderBox()->absoluteToLocal(evt->absoluteLocation(), false, true); - IntRect thumbBounds = thumbElement->renderBox()->borderBoxRect(); - FloatPoint offset; - offset.setX(thumbBounds.x() + thumbBounds.width() / 2 - localPoint.x()); - offset.setY(thumbBounds.y() + thumbBounds.height() / 2 - localPoint.y()); - return offset; -} - -void RenderSlider::setValueForPosition(int position) -{ - SliderThumbElement* thumbElement = sliderThumbElement(); - if (!thumbElement || !thumbElement->renderer()) - return; - - HTMLInputElement* element = static_cast<HTMLInputElement*>(node()); - - // Calculate the new value based on the position, and send it to the element. - StepRange range(element); - double fraction = static_cast<double>(position) / trackSize(); - if (style()->appearance() == SliderVerticalPart || style()->appearance() == MediaVolumeSliderPart) - fraction = 1 - fraction; - double value = range.clampValue(range.valueFromProportion(fraction)); - element->setValueFromRenderer(serializeForNumberType(value)); - - // Also update the position if appropriate. - if (position != currentPosition()) { - setNeedsLayout(true); - - // FIXME: It seems like this could send extra change events if the same value is set - // multiple times with no layout in between. - element->dispatchFormControlChangeEvent(); - } -} - -int RenderSlider::positionForOffset(const IntPoint& p) -{ - SliderThumbElement* thumbElement = sliderThumbElement(); - if (!thumbElement || !thumbElement->renderer()) - return 0; - - int position; - if (style()->appearance() == SliderVerticalPart || style()->appearance() == MediaVolumeSliderPart) - position = p.y() - thumbElement->renderBox()->height() / 2; - else - position = p.x() - thumbElement->renderBox()->width() / 2; - - return max(0, min(position, trackSize())); -} - -int RenderSlider::currentPosition() -{ - SliderThumbElement* thumbElement = sliderThumbElement(); - ASSERT(thumbElement && thumbElement->renderer()); - - if (style()->appearance() == SliderVerticalPart || style()->appearance() == MediaVolumeSliderPart) - return toRenderBox(thumbElement->renderer())->y() - contentBoxRect().y(); - return toRenderBox(thumbElement->renderer())->x() - contentBoxRect().x(); -} - -int RenderSlider::trackSize() -{ - SliderThumbElement* thumbElement = sliderThumbElement(); - ASSERT(thumbElement && thumbElement->renderer()); - - if (style()->appearance() == SliderVerticalPart || style()->appearance() == MediaVolumeSliderPart) - return contentHeight() - thumbElement->renderBox()->height(); - return contentWidth() - thumbElement->renderBox()->width(); -} - -void RenderSlider::forwardEvent(Event* event) -{ - SliderThumbElement* thumbElement = sliderThumbElement(); - if (!thumbElement) - return; - - if (event->isMouseEvent()) { - MouseEvent* mouseEvent = static_cast<MouseEvent*>(event); - if (event->type() == eventNames().mousedownEvent && mouseEvent->button() == LeftButton) { - if (!mouseEventIsInThumb(mouseEvent)) { - IntPoint eventOffset = roundedIntPoint(absoluteToLocal(mouseEvent->absoluteLocation(), false, true)); - setValueForPosition(positionForOffset(eventOffset)); - } - } - } - - thumbElement->defaultEventHandler(event); -} - bool RenderSlider::inDragMode() const { SliderThumbElement* thumbElement = sliderThumbElement(); diff --git a/Source/WebCore/rendering/RenderSlider.h b/Source/WebCore/rendering/RenderSlider.h index 5fb5921..0162b71 100644 --- a/Source/WebCore/rendering/RenderSlider.h +++ b/Source/WebCore/rendering/RenderSlider.h @@ -34,7 +34,6 @@ namespace WebCore { RenderSlider(HTMLInputElement*); virtual ~RenderSlider(); - void forwardEvent(Event*); bool inDragMode() const; IntRect thumbRect(); @@ -49,20 +48,8 @@ namespace WebCore { // FIXME: Eventually, the logic of manipulating slider thumb should move to // SliderThumbElement and accessing sliderThumbElement should not be necessary in this class. SliderThumbElement* sliderThumbElement() const; - bool mouseEventIsInThumb(MouseEvent*); - FloatPoint mouseEventOffsetToThumb(MouseEvent*); - - void setValueForPosition(int position); - void setPositionFromValue(); - int positionForOffset(const IntPoint&); - - int currentPosition(); virtual bool requiresForcedStyleRecalcPropagation() const { return true; } - - int trackSize(); - - friend class SliderThumbElement; }; inline RenderSlider* toRenderSlider(RenderObject* object) diff --git a/Source/WebCore/rendering/RenderTableSection.cpp b/Source/WebCore/rendering/RenderTableSection.cpp index 7aaad62..265d2ef 100644 --- a/Source/WebCore/rendering/RenderTableSection.cpp +++ b/Source/WebCore/rendering/RenderTableSection.cpp @@ -1192,6 +1192,13 @@ void RenderTableSection::recalcCells() setNeedsLayout(true); } +void RenderTableSection::setNeedsCellRecalc() +{ + m_needsCellRecalc = true; + if (RenderTable* t = table()) + t->setNeedsSectionRecalc(); +} + void RenderTableSection::clearGrid() { int rows = m_gridRows; diff --git a/Source/WebCore/rendering/RenderTableSection.h b/Source/WebCore/rendering/RenderTableSection.h index fac6a84..cc969e8 100644 --- a/Source/WebCore/rendering/RenderTableSection.h +++ b/Source/WebCore/rendering/RenderTableSection.h @@ -114,11 +114,7 @@ public: } bool needsCellRecalc() const { return m_needsCellRecalc; } - void setNeedsCellRecalc() - { - m_needsCellRecalc = true; - table()->setNeedsSectionRecalc(); - } + void setNeedsCellRecalc(); int getBaseline(int row) { return m_grid[row].baseline; } diff --git a/Source/WebCore/rendering/RenderText.cpp b/Source/WebCore/rendering/RenderText.cpp index 78c5684..86b32d5 100644 --- a/Source/WebCore/rendering/RenderText.cpp +++ b/Source/WebCore/rendering/RenderText.cpp @@ -40,6 +40,7 @@ #include "Text.h" #include "TextBreakIterator.h" #include "TextResourceDecoder.h" +#include "TextRun.h" #include "VisiblePosition.h" #include "break_lines.h" #include <wtf/AlwaysInline.h> diff --git a/Source/WebCore/rendering/RenderTextControl.cpp b/Source/WebCore/rendering/RenderTextControl.cpp index 40aa4c2..cac8113 100644 --- a/Source/WebCore/rendering/RenderTextControl.cpp +++ b/Source/WebCore/rendering/RenderTextControl.cpp @@ -41,6 +41,7 @@ #include "Text.h" #include "TextControlInnerElements.h" #include "TextIterator.h" +#include "TextRun.h" using namespace std; diff --git a/Source/WebCore/rendering/RenderTextControlSingleLine.cpp b/Source/WebCore/rendering/RenderTextControlSingleLine.cpp index b54c45b..95f209a 100644 --- a/Source/WebCore/rendering/RenderTextControlSingleLine.cpp +++ b/Source/WebCore/rendering/RenderTextControlSingleLine.cpp @@ -1083,14 +1083,14 @@ bool RenderTextControlSingleLine::logicalScroll(ScrollLogicalDirection direction return RenderBlock::logicalScroll(direction, granularity, multiplier, stopNode); } -PassRefPtr<Scrollbar> RenderTextControlSingleLine::createScrollbar(ScrollbarClient* client, ScrollbarOrientation orientation, ScrollbarControlSize controlSize) +PassRefPtr<Scrollbar> RenderTextControlSingleLine::createScrollbar(ScrollableArea* scrollableArea, ScrollbarOrientation orientation, ScrollbarControlSize controlSize) { RefPtr<Scrollbar> widget; bool hasCustomScrollbarStyle = style()->hasPseudoStyle(SCROLLBAR); if (hasCustomScrollbarStyle) - widget = RenderScrollbar::createCustomScrollbar(client, orientation, this); + widget = RenderScrollbar::createCustomScrollbar(scrollableArea, orientation, this); else - widget = Scrollbar::createNativeScrollbar(client, orientation, controlSize); + widget = Scrollbar::createNativeScrollbar(scrollableArea, orientation, controlSize); return widget.release(); } diff --git a/Source/WebCore/rendering/RenderTextControlSingleLine.h b/Source/WebCore/rendering/RenderTextControlSingleLine.h index 16ce1e4..6b99f59 100644 --- a/Source/WebCore/rendering/RenderTextControlSingleLine.h +++ b/Source/WebCore/rendering/RenderTextControlSingleLine.h @@ -140,7 +140,7 @@ private: virtual void setTextFromItem(unsigned listIndex); virtual FontSelector* fontSelector() const; virtual HostWindow* hostWindow() const; - virtual PassRefPtr<Scrollbar> createScrollbar(ScrollbarClient*, ScrollbarOrientation, ScrollbarControlSize); + virtual PassRefPtr<Scrollbar> createScrollbar(ScrollableArea*, ScrollbarOrientation, ScrollbarControlSize); InputElement* inputElement() const; diff --git a/Source/WebCore/rendering/RenderThemeChromiumLinux.cpp b/Source/WebCore/rendering/RenderThemeChromiumLinux.cpp index 90736c7..3a2874d 100644 --- a/Source/WebCore/rendering/RenderThemeChromiumLinux.cpp +++ b/Source/WebCore/rendering/RenderThemeChromiumLinux.cpp @@ -28,8 +28,10 @@ #include "CSSValueKeywords.h" #include "Color.h" #include "PaintInfo.h" -#include "PlatformThemeChromiumGtk.h" +#include "PlatformBridge.h" #include "RenderObject.h" +#include "RenderProgress.h" +#include "RenderSlider.h" #include "ScrollbarTheme.h" #include "UserAgentStyleSheets.h" @@ -46,6 +48,21 @@ unsigned RenderThemeChromiumLinux::m_inactiveSelectionForegroundColor = double RenderThemeChromiumLinux::m_caretBlinkInterval; +static const unsigned defaultButtonBackgroundColor = 0xffdddddd; + +static PlatformBridge::ThemePaintState getWebThemeState(const RenderTheme* theme, const RenderObject* o) +{ + if (!theme->isEnabled(o)) + return PlatformBridge::StateDisabled; + if (theme->isPressed(o)) + return PlatformBridge::StatePressed; + if (theme->isHovered(o)) + return PlatformBridge::StateHover; + + return PlatformBridge::StateNormal; +} + + PassRefPtr<RenderTheme> RenderThemeChromiumLinux::create() { return adoptRef(new RenderThemeChromiumLinux()); @@ -128,15 +145,14 @@ Color RenderThemeChromiumLinux::platformInactiveSelectionForegroundColor() const void RenderThemeChromiumLinux::adjustSliderThumbSize(RenderObject* o) const { - // These sizes match the sizes in Chromium Win. - const int sliderThumbAlongAxis = 11; - const int sliderThumbAcrossAxis = 21; + IntSize size = PlatformBridge::getThemePartSize(PlatformBridge::PartSliderThumb); + if (o->style()->appearance() == SliderThumbHorizontalPart) { - o->style()->setWidth(Length(sliderThumbAlongAxis, Fixed)); - o->style()->setHeight(Length(sliderThumbAcrossAxis, Fixed)); + o->style()->setWidth(Length(size.width(), Fixed)); + o->style()->setHeight(Length(size.height(), Fixed)); } else if (o->style()->appearance() == SliderThumbVerticalPart) { - o->style()->setWidth(Length(sliderThumbAcrossAxis, Fixed)); - o->style()->setHeight(Length(sliderThumbAlongAxis, Fixed)); + o->style()->setWidth(Length(size.height(), Fixed)); + o->style()->setHeight(Length(size.width(), Fixed)); } else RenderThemeChromiumSkia::adjustSliderThumbSize(o); } @@ -168,29 +184,154 @@ void RenderThemeChromiumLinux::setSelectionColors( m_inactiveSelectionForegroundColor = inactiveForegroundColor; } +bool RenderThemeChromiumLinux::paintCheckbox(RenderObject* o, const PaintInfo& i, const IntRect& rect) +{ + PlatformBridge::ThemePaintExtraParams extraParams; + extraParams.button.checked = isChecked(o); + extraParams.button.indeterminate = isIndeterminate(o); + + PlatformBridge::paintThemePart(i.context, PlatformBridge::PartCheckbox, getWebThemeState(this, o), rect, &extraParams); + return false; +} + +void RenderThemeChromiumLinux::setCheckboxSize(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; + + IntSize size = PlatformBridge::getThemePartSize(PlatformBridge::PartCheckbox); + setSizeIfAuto(style, size); +} + +bool RenderThemeChromiumLinux::paintRadio(RenderObject* o, const PaintInfo& i, const IntRect& rect) +{ + PlatformBridge::ThemePaintExtraParams extraParams; + extraParams.button.checked = isChecked(o); + + PlatformBridge::paintThemePart(i.context, PlatformBridge::PartRadio, getWebThemeState(this, o), rect, &extraParams); + return false; +} + +void RenderThemeChromiumLinux::setRadioSize(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; + + IntSize size = PlatformBridge::getThemePartSize(PlatformBridge::PartRadio); + setSizeIfAuto(style, size); +} + +bool RenderThemeChromiumLinux::paintButton(RenderObject* o, const PaintInfo& i, const IntRect& rect) +{ + PlatformBridge::ThemePaintExtraParams extraParams; + extraParams.button.isDefault = isDefault(o); + extraParams.button.backgroundColor = defaultButtonBackgroundColor; + if (o->hasBackground()) + extraParams.button.backgroundColor = o->style()->visitedDependentColor(CSSPropertyBackgroundColor).rgb(); + + PlatformBridge::paintThemePart(i.context, PlatformBridge::PartButton, getWebThemeState(this, o), rect, &extraParams); + return false; +} + +bool RenderThemeChromiumLinux::paintTextField(RenderObject* o, const PaintInfo& i, const IntRect& rect) +{ + // WebThemeEngine does not handle border rounded corner and background image + // so return true to draw CSS border and background. + if (o->style()->hasBorderRadius() || o->style()->hasBackgroundImage()) + return true; + + ControlPart part = o->style()->appearance(); + + PlatformBridge::ThemePaintExtraParams extraParams; + extraParams.textField.isTextArea = part == TextAreaPart; + extraParams.textField.isListbox = part == ListboxPart; + + // Fallback to white if the specified color object is invalid. + Color backgroundColor(Color::white); + if (o->style()->visitedDependentColor(CSSPropertyBackgroundColor).isValid()) + backgroundColor = o->style()->visitedDependentColor(CSSPropertyBackgroundColor); + extraParams.textField.backgroundColor = backgroundColor.rgb(); + + PlatformBridge::paintThemePart(i.context, PlatformBridge::PartTextField, getWebThemeState(this, o), rect, &extraParams); + return false; +} + +bool RenderThemeChromiumLinux::paintMenuList(RenderObject* o, const PaintInfo& i, const IntRect& rect) +{ + const int right = rect.x() + rect.width(); + const int middle = rect.y() + rect.height() / 2; + + PlatformBridge::ThemePaintExtraParams extraParams; + extraParams.menuList.arrowX = (o->style()->direction() == RTL) ? rect.x() + 7 : right - 13; + extraParams.menuList.arrowY = middle; + extraParams.menuList.backgroundColor = SkColorSetRGB(0xdd, 0xdd, 0xdd); + if (o->hasBackground()) + extraParams.menuList.backgroundColor = o->style()->visitedDependentColor(CSSPropertyBackgroundColor).rgb(); + + PlatformBridge::paintThemePart(i.context, PlatformBridge::PartMenuList, getWebThemeState(this, o), rect, &extraParams); + return false; +} + +bool RenderThemeChromiumLinux::paintSliderTrack(RenderObject* o, const PaintInfo& i, const IntRect& rect) +{ + PlatformBridge::ThemePaintExtraParams extraParams; + extraParams.slider.vertical = o->style()->appearance() == SliderVerticalPart; + + PlatformBridge::paintThemePart(i.context, PlatformBridge::PartSliderTrack, getWebThemeState(this, o), rect, &extraParams); + return false; +} + +bool RenderThemeChromiumLinux::paintSliderThumb(RenderObject* o, const PaintInfo& i, const IntRect& rect) +{ + PlatformBridge::ThemePaintExtraParams extraParams; + extraParams.slider.vertical = o->style()->appearance() == SliderThumbVerticalPart; + extraParams.slider.inDrag = toRenderSlider(o->parent())->inDragMode(); + + PlatformBridge::paintThemePart(i.context, PlatformBridge::PartSliderThumb, getWebThemeState(this, o), rect, &extraParams); + return false; +} + void RenderThemeChromiumLinux::adjustInnerSpinButtonStyle(CSSStyleSelector*, RenderStyle* style, Element*) const { - int width = ScrollbarTheme::nativeTheme()->scrollbarThickness(); - style->setWidth(Length(width, Fixed)); - style->setMinWidth(Length(width, Fixed)); + IntSize size = PlatformBridge::getThemePartSize(PlatformBridge::PartInnerSpinButton); + + style->setWidth(Length(size.width(), Fixed)); + style->setMinWidth(Length(size.width(), Fixed)); } -bool RenderThemeChromiumLinux::paintInnerSpinButton(RenderObject* object, const PaintInfo& info, const IntRect& rect) +bool RenderThemeChromiumLinux::paintInnerSpinButton(RenderObject* o, const PaintInfo& i, const IntRect& rect) { - ControlStates northStates = controlStatesForRenderer(object); - ControlStates southStates = northStates; - if (northStates & SpinUpState) - southStates &= ~(HoverState | PressedState); - else - northStates &= ~(HoverState | PressedState); + PlatformBridge::ThemePaintExtraParams extraParams; + extraParams.innerSpin.spinUp = (controlStatesForRenderer(o) & SpinUpState); + extraParams.innerSpin.readOnly = isReadOnlyControl(o); - IntRect half = rect; - half.setHeight(rect.height() / 2); - PlatformThemeChromiumGtk::paintArrowButton(info.context, half, PlatformThemeChromiumGtk::North, northStates); + PlatformBridge::paintThemePart(i.context, PlatformBridge::PartInnerSpinButton, getWebThemeState(this, o), rect, &extraParams); + return false; +} + +#if ENABLE(PROGRESS_TAG) + +bool RenderThemeChromiumLinux::paintProgressBar(RenderObject* o, const PaintInfo& i, const IntRect& rect) +{ + if (!o->isProgress()) + return true; - half.setY(rect.y() + rect.height() / 2); - PlatformThemeChromiumGtk::paintArrowButton(info.context, half, PlatformThemeChromiumGtk::South, southStates); + RenderProgress* renderProgress = toRenderProgress(o); + IntRect valueRect = progressValueRectFor(renderProgress, rect); + + PlatformBridge::ThemePaintExtraParams extraParams; + extraParams.progressBar.determinate = renderProgress->isDeterminate(); + extraParams.progressBar.valueRectX = valueRect.x(); + extraParams.progressBar.valueRectY = valueRect.y(); + extraParams.progressBar.valueRectWidth = valueRect.width(); + extraParams.progressBar.valueRectHeight = valueRect.height(); + + PlatformBridge::paintThemePart(i.context, PlatformBridge::PartProgressBar, getWebThemeState(this, o), rect, &extraParams); return false; } +#endif + } // namespace WebCore diff --git a/Source/WebCore/rendering/RenderThemeChromiumLinux.h b/Source/WebCore/rendering/RenderThemeChromiumLinux.h index 9eeca97..8f3eb98 100644 --- a/Source/WebCore/rendering/RenderThemeChromiumLinux.h +++ b/Source/WebCore/rendering/RenderThemeChromiumLinux.h @@ -59,9 +59,25 @@ namespace WebCore { static void setCaretBlinkInterval(double interval); virtual double caretBlinkIntervalInternal() const; + virtual bool paintCheckbox(RenderObject*, const PaintInfo&, const IntRect&); + virtual void setCheckboxSize(RenderStyle*) const; + + virtual bool paintRadio(RenderObject*, const PaintInfo&, const IntRect&); + virtual void setRadioSize(RenderStyle*) const; + + virtual bool paintButton(RenderObject*, const PaintInfo&, const IntRect&); + virtual bool paintTextField(RenderObject*, const PaintInfo&, const IntRect&); + virtual bool paintMenuList(RenderObject*, const PaintInfo&, const IntRect&); + virtual bool paintSliderTrack(RenderObject*, const PaintInfo&, const IntRect&); + virtual bool paintSliderThumb(RenderObject*, const PaintInfo&, const IntRect&); + virtual void adjustInnerSpinButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const; virtual bool paintInnerSpinButton(RenderObject*, const PaintInfo&, const IntRect&); +#if ENABLE(PROGRESS_TAG) + virtual bool paintProgressBar(RenderObject*, const PaintInfo&, const IntRect&); +#endif + static void setSelectionColors(unsigned activeBackgroundColor, unsigned activeForegroundColor, unsigned inactiveBackgroundColor, diff --git a/Source/WebCore/rendering/RenderThemeChromiumMac.mm b/Source/WebCore/rendering/RenderThemeChromiumMac.mm index 02eb134..10285ac 100644 --- a/Source/WebCore/rendering/RenderThemeChromiumMac.mm +++ b/Source/WebCore/rendering/RenderThemeChromiumMac.mm @@ -20,8 +20,8 @@ #import "config.h" #import "RenderThemeChromiumMac.h" -#import "ChromiumBridge.h" #import "PaintInfo.h" +#import "PlatformBridge.h" #import "RenderMediaControlsChromium.h" #import "UserAgentStyleSheets.h" #import <Carbon/Carbon.h> @@ -71,7 +71,7 @@ PassRefPtr<RenderTheme> RenderThemeChromiumMac::create() bool RenderThemeChromiumMac::usesTestModeFocusRingColor() const { - return ChromiumBridge::layoutTestMode(); + return PlatformBridge::layoutTestMode(); } NSView* RenderThemeChromiumMac::documentViewFor(RenderObject*) const diff --git a/Source/WebCore/rendering/RenderThemeChromiumSkia.cpp b/Source/WebCore/rendering/RenderThemeChromiumSkia.cpp index bb60c1f..9691876 100644 --- a/Source/WebCore/rendering/RenderThemeChromiumSkia.cpp +++ b/Source/WebCore/rendering/RenderThemeChromiumSkia.cpp @@ -24,7 +24,6 @@ #include "config.h" #include "RenderThemeChromiumSkia.h" -#include "ChromiumBridge.h" #include "CSSValueKeywords.h" #include "CurrentTime.h" #include "GraphicsContext.h" @@ -33,6 +32,7 @@ #include "Image.h" #include "MediaControlElements.h" #include "PaintInfo.h" +#include "PlatformBridge.h" #include "PlatformContextSkia.h" #include "RenderBox.h" #include "RenderMediaControlsChromium.h" @@ -68,38 +68,6 @@ static const float minSearchFieldResultsDecorationSize = 9; static const float maxSearchFieldResultsDecorationSize = 30; static const float defaultSearchFieldResultsButtonWidth = 18; -static void setSizeIfAuto(RenderStyle* style, const IntSize& size) -{ - if (style->width().isIntrinsicOrAuto()) - style->setWidth(Length(size.width(), Fixed)); - if (style->height().isAuto()) - style->setHeight(Length(size.height(), Fixed)); -} - -static void drawVertLine(SkCanvas* canvas, int x, int y1, int y2, const SkPaint& paint) -{ - SkIRect skrect; - skrect.set(x, y1, x + 1, y2 + 1); - canvas->drawIRect(skrect, paint); -} - -static void drawHorizLine(SkCanvas* canvas, int x1, int x2, int y, const SkPaint& paint) -{ - SkIRect skrect; - skrect.set(x1, y, x2 + 1, y + 1); - canvas->drawIRect(skrect, paint); -} - -static void drawBox(SkCanvas* canvas, const IntRect& rect, const SkPaint& paint) -{ - const int right = rect.x() + rect.width() - 1; - const int bottom = rect.y() + rect.height() - 1; - drawHorizLine(canvas, rect.x(), right, rect.y(), paint); - drawVertLine(canvas, right, rect.y(), bottom, paint); - drawHorizLine(canvas, rect.x(), right, bottom, paint); - drawVertLine(canvas, rect.x(), rect.y(), bottom, paint); -} - // We aim to match IE here. // -IE uses a font based on the encoding as the default font for form controls. // -Gecko uses MS Shell Dlg (actually calls GetStockObject(DEFAULT_GUI_FONT), @@ -185,7 +153,7 @@ double RenderThemeChromiumSkia::caretBlinkInterval() const { // Disable the blinking caret in layout test mode, as it introduces // a race condition for the pixel tests. http://b/1198440 - if (ChromiumBridge::layoutTestMode()) + if (PlatformBridge::layoutTestMode()) return 0; return caretBlinkIntervalInternal(); @@ -237,28 +205,6 @@ IntRect center(const IntRect& original, int width, int height) return IntRect(x, y, width, height); } -bool RenderThemeChromiumSkia::paintCheckbox(RenderObject* o, const PaintInfo& i, const IntRect& rect) -{ - static Image* const checkedImage = Image::loadPlatformResource("linuxCheckboxOn").releaseRef(); - static Image* const uncheckedImage = Image::loadPlatformResource("linuxCheckboxOff").releaseRef(); - static Image* const indeterminateImage = Image::loadPlatformResource("linuxCheckboxIndeterminate").releaseRef(); - static Image* const disabledCheckedImage = Image::loadPlatformResource("linuxCheckboxDisabledOn").releaseRef(); - static Image* const disabledUncheckedImage = Image::loadPlatformResource("linuxCheckboxDisabledOff").releaseRef(); - static Image* const disabledIndeterminateImage = Image::loadPlatformResource("linuxCheckboxDisabledIndeterminate").releaseRef(); - - Image* image; - - if (isIndeterminate(o)) - image = isEnabled(o) ? indeterminateImage : disabledIndeterminateImage; - else if (isChecked(o)) - image = isEnabled(o) ? checkedImage : disabledCheckedImage; - else - image = isEnabled(o) ? uncheckedImage : disabledUncheckedImage; - - i.context->drawImage(image, o->style()->colorSpace(), center(rect, widgetStandardHeight, widgetStandardWidth)); - return false; -} - void RenderThemeChromiumSkia::setCheckboxSize(RenderStyle* style) const { // If the width and height are both specified, then we have nothing to do. @@ -270,108 +216,16 @@ void RenderThemeChromiumSkia::setCheckboxSize(RenderStyle* style) const // querying the theme gives you a larger size that accounts for the higher // DPI. Until our entire engine honors a DPI setting other than 96, we // can't rely on the theme's metrics. - const IntSize size(widgetStandardHeight, widgetStandardWidth); + const IntSize size(widgetStandardWidth, widgetStandardHeight); setSizeIfAuto(style, size); } -bool RenderThemeChromiumSkia::paintRadio(RenderObject* o, const PaintInfo& i, const IntRect& rect) -{ - static Image* const checkedImage = Image::loadPlatformResource("linuxRadioOn").releaseRef(); - static Image* const uncheckedImage = Image::loadPlatformResource("linuxRadioOff").releaseRef(); - static Image* const disabledCheckedImage = Image::loadPlatformResource("linuxRadioDisabledOn").releaseRef(); - static Image* const disabledUncheckedImage = Image::loadPlatformResource("linuxRadioDisabledOff").releaseRef(); - - Image* image; - if (this->isEnabled(o)) - image = this->isChecked(o) ? checkedImage : uncheckedImage; - else - image = this->isChecked(o) ? disabledCheckedImage : disabledUncheckedImage; - - i.context->drawImage(image, o->style()->colorSpace(), center(rect, widgetStandardHeight, widgetStandardWidth)); - return false; -} - void RenderThemeChromiumSkia::setRadioSize(RenderStyle* style) const { // Use same sizing for radio box as checkbox. setCheckboxSize(style); } -static SkColor brightenColor(double h, double s, double l, float brightenAmount) -{ - l += brightenAmount; - if (l > 1.0) - l = 1.0; - if (l < 0.0) - l = 0.0; - - return makeRGBAFromHSLA(h, s, l, 1.0); -} - -static void paintButtonLike(RenderTheme* theme, RenderObject* o, const PaintInfo& i, const IntRect& rect) -{ - SkCanvas* const canvas = i.context->platformContext()->canvas(); - SkPaint paint; - SkRect skrect; - const int right = rect.x() + rect.width(); - const int bottom = rect.y() + rect.height(); - SkColor baseColor = SkColorSetARGB(0xff, 0xdd, 0xdd, 0xdd); - if (o->hasBackground()) - baseColor = o->style()->visitedDependentColor(CSSPropertyBackgroundColor).rgb(); - double h, s, l; - Color(baseColor).getHSL(h, s, l); - // Our standard gradient is from 0xdd to 0xf8. This is the amount of - // increased luminance between those values. - SkColor lightColor(brightenColor(h, s, l, 0.105)); - - // If the button is too small, fallback to drawing a single, solid color - if (rect.width() < 5 || rect.height() < 5) { - paint.setColor(baseColor); - skrect.set(rect.x(), rect.y(), right, bottom); - canvas->drawRect(skrect, paint); - return; - } - - const int borderAlpha = theme->isHovered(o) ? 0x80 : 0x55; - paint.setARGB(borderAlpha, 0, 0, 0); - canvas->drawLine(rect.x() + 1, rect.y(), right - 1, rect.y(), paint); - canvas->drawLine(right - 1, rect.y() + 1, right - 1, bottom - 1, paint); - canvas->drawLine(rect.x() + 1, bottom - 1, right - 1, bottom - 1, paint); - canvas->drawLine(rect.x(), rect.y() + 1, rect.x(), bottom - 1, paint); - - paint.setColor(SK_ColorBLACK); - SkPoint p[2]; - const int lightEnd = theme->isPressed(o) ? 1 : 0; - const int darkEnd = !lightEnd; - p[lightEnd].set(SkIntToScalar(rect.x()), SkIntToScalar(rect.y())); - p[darkEnd].set(SkIntToScalar(rect.x()), SkIntToScalar(bottom - 1)); - SkColor colors[2]; - colors[0] = lightColor; - colors[1] = baseColor; - - SkShader* shader = SkGradientShader::CreateLinear( - p, colors, NULL, 2, SkShader::kClamp_TileMode, NULL); - paint.setStyle(SkPaint::kFill_Style); - paint.setShader(shader); - shader->unref(); - - skrect.set(rect.x() + 1, rect.y() + 1, right - 1, bottom - 1); - canvas->drawRect(skrect, paint); - - paint.setShader(NULL); - paint.setColor(brightenColor(h, s, l, -0.0588)); - canvas->drawPoint(rect.x() + 1, rect.y() + 1, paint); - canvas->drawPoint(right - 2, rect.y() + 1, paint); - canvas->drawPoint(rect.x() + 1, bottom - 2, paint); - canvas->drawPoint(right - 2, bottom - 2, paint); -} - -bool RenderThemeChromiumSkia::paintButton(RenderObject* o, const PaintInfo& i, const IntRect& rect) -{ - paintButtonLike(this, o, i, rect); - return false; -} - void RenderThemeChromiumSkia::adjustButtonStyle(CSSStyleSelector*, RenderStyle* style, Element*) const { if (style->appearance() == PushButtonPart) { @@ -380,12 +234,6 @@ void RenderThemeChromiumSkia::adjustButtonStyle(CSSStyleSelector*, RenderStyle* } } - -bool RenderThemeChromiumSkia::paintTextField(RenderObject* o, const PaintInfo& i, const IntRect& rect) -{ - return true; -} - bool RenderThemeChromiumSkia::paintTextArea(RenderObject* o, const PaintInfo& i, const IntRect& r) { return paintTextField(o, i, r); @@ -622,30 +470,6 @@ void RenderThemeChromiumSkia::adjustMenuListStyle(CSSStyleSelector* selector, Re style->setLineHeight(RenderStyle::initialLineHeight()); } -bool RenderThemeChromiumSkia::paintMenuList(RenderObject* o, const PaintInfo& i, const IntRect& rect) -{ - SkCanvas* const canvas = i.context->platformContext()->canvas(); - const int right = rect.x() + rect.width(); - const int middle = rect.y() + rect.height() / 2; - - paintButtonLike(this, o, i, rect); - - SkPaint paint; - paint.setColor(SK_ColorBLACK); - paint.setAntiAlias(true); - paint.setStyle(SkPaint::kFill_Style); - - int arrowXPosition = (o->style()->direction() == RTL) ? rect.x() + 7 : right - 13; - SkPath path; - path.moveTo(arrowXPosition, middle - 3); - path.rLineTo(6, 0); - path.rLineTo(-3, 6); - path.close(); - canvas->drawPath(path, paint); - - return false; -} - void RenderThemeChromiumSkia::adjustMenuListButtonStyle(CSSStyleSelector* selector, RenderStyle* style, Element* e) const { adjustMenuListStyle(selector, style, e); @@ -657,69 +481,6 @@ bool RenderThemeChromiumSkia::paintMenuListButton(RenderObject* o, const PaintIn return paintMenuList(o, i, rect); } -bool RenderThemeChromiumSkia::paintSliderTrack(RenderObject*, const PaintInfo& i, const IntRect& rect) -{ - // Just paint a grey box for now (matches the color of a scrollbar background. - SkCanvas* const canvas = i.context->platformContext()->canvas(); - int verticalCenter = rect.y() + rect.height() / 2; - int top = std::max(rect.y(), verticalCenter - 2); - int bottom = std::min(rect.y() + rect.height(), verticalCenter + 2); - - SkPaint paint; - const SkColor grey = SkColorSetARGB(0xff, 0xe3, 0xdd, 0xd8); - paint.setColor(grey); - - SkRect skrect; - skrect.set(rect.x(), top, rect.x() + rect.width(), bottom); - canvas->drawRect(skrect, paint); - - return false; -} - -bool RenderThemeChromiumSkia::paintSliderThumb(RenderObject* o, const PaintInfo& i, const IntRect& rect) -{ - // Make a thumb similar to the scrollbar thumb. - const bool hovered = isHovered(o) || toRenderSlider(o->parent())->inDragMode(); - const int midx = rect.x() + rect.width() / 2; - const int midy = rect.y() + rect.height() / 2; - const bool vertical = (o->style()->appearance() == SliderThumbVerticalPart); - SkCanvas* const canvas = i.context->platformContext()->canvas(); - - const SkColor thumbLightGrey = SkColorSetARGB(0xff, 0xf4, 0xf2, 0xef); - const SkColor thumbDarkGrey = SkColorSetARGB(0xff, 0xea, 0xe5, 0xe0); - SkPaint paint; - paint.setColor(hovered ? SK_ColorWHITE : thumbLightGrey); - - SkIRect skrect; - if (vertical) - skrect.set(rect.x(), rect.y(), midx + 1, rect.bottom()); - else - skrect.set(rect.x(), rect.y(), rect.right(), midy + 1); - - canvas->drawIRect(skrect, paint); - - paint.setColor(hovered ? thumbLightGrey : thumbDarkGrey); - - if (vertical) - skrect.set(midx + 1, rect.y(), rect.right(), rect.bottom()); - else - skrect.set(rect.x(), midy + 1, rect.right(), rect.bottom()); - - canvas->drawIRect(skrect, paint); - - const SkColor borderDarkGrey = SkColorSetARGB(0xff, 0x9d, 0x96, 0x8e); - paint.setColor(borderDarkGrey); - drawBox(canvas, rect, paint); - - if (rect.height() > 10 && rect.width() > 10) { - drawHorizLine(canvas, midx - 2, midx + 2, midy, paint); - drawHorizLine(canvas, midx - 2, midx + 2, midy - 3, paint); - drawHorizLine(canvas, midx - 2, midx + 2, midy + 3, paint); - } - - return false; -} - int RenderThemeChromiumSkia::popupInternalPaddingLeft(RenderStyle* style) const { return menuListInternalPadding(style, LeftPadding); @@ -758,6 +519,15 @@ double RenderThemeChromiumSkia::caretBlinkIntervalInternal() const return RenderTheme::caretBlinkInterval(); } +// static +void RenderThemeChromiumSkia::setSizeIfAuto(RenderStyle* style, const IntSize& size) +{ + if (style->width().isIntrinsicOrAuto()) + style->setWidth(Length(size.width(), Fixed)); + if (style->height().isAuto()) + style->setHeight(Length(size.height(), Fixed)); +} + int RenderThemeChromiumSkia::menuListInternalPadding(RenderStyle* style, int paddingType) const { // This internal padding is in addition to the user-supplied padding. @@ -801,7 +571,7 @@ IntRect RenderThemeChromiumSkia::indeterminateProgressValueRectFor(RenderProgres int movableWidth = rect.width() - valueWidth; if (movableWidth <= 0) return IntRect(); - + double progress = renderProgress->animationProgress(); if (progress < 0.5) return IntRect(rect.x() + progress * 2 * movableWidth, rect.y(), valueWidth, rect.height()); @@ -818,67 +588,6 @@ double RenderThemeChromiumSkia::animationDurationForProgressBar(RenderProgress* return progressAnimationInterval * progressAnimationFrmaes * 2; // "2" for back and forth } -bool RenderThemeChromiumSkia::paintProgressBar(RenderObject* renderObject, const PaintInfo& paintInfo, const IntRect& rect) -{ - static Image* barImage = Image::loadPlatformResource("linuxProgressBar").releaseRef(); - static Image* valueImage = Image::loadPlatformResource("linuxProgressValue").releaseRef(); - static Image* leftBorderImage = Image::loadPlatformResource("linuxProgressBorderLeft").releaseRef(); - static Image* rightBorderImage = Image::loadPlatformResource("linuxProgressBorderRight").releaseRef(); - ASSERT(barImage->height() == valueImage->height()); - - if (!renderObject->isProgress()) - return true; - - paintInfo.context->platformContext()->setImageResamplingHint(barImage->size(), rect.size()); - - RenderProgress* renderProgress = toRenderProgress(renderObject); - double tileScale = static_cast<double>(rect.height()) / barImage->height(); - IntSize barTileSize(static_cast<int>(barImage->width() * tileScale), rect.height()); - ColorSpace colorSpace = renderObject->style()->colorSpace(); - - paintInfo.context->drawTiledImage(barImage, colorSpace, rect, IntPoint(0, 0), barTileSize); - - IntRect valueRect = progressValueRectFor(renderProgress, rect); - if (valueRect.width()) { - - IntSize valueTileSize(std::max(1, static_cast<int>(valueImage->width() * tileScale)), valueRect.height()); - - int leftOffset = valueRect.x() - rect.x(); - int roundedLeftOffset= (leftOffset / valueTileSize.width()) * valueTileSize.width(); - int dstLeftValueWidth = roundedLeftOffset - leftOffset + (leftOffset % valueImage->width()) ? valueTileSize.width() : 0; - - IntRect dstLeftValueRect(valueRect.x(), valueRect.y(), dstLeftValueWidth, valueRect.height()); - int srcLeftValueWidth = dstLeftValueWidth / tileScale; - IntRect srcLeftValueRect(valueImage->width() - srcLeftValueWidth, 0, srcLeftValueWidth, valueImage->height()); - paintInfo.context->drawImage(valueImage, colorSpace, dstLeftValueRect, srcLeftValueRect); - - int rightOffset = valueRect.right() - rect.x(); - int roundedRightOffset = (rightOffset / valueTileSize.width()) * valueTileSize.width(); - int dstRightValueWidth = rightOffset - roundedRightOffset; - IntRect dstRightValueRect(rect.x() + roundedRightOffset, valueRect.y(), dstRightValueWidth, valueTileSize.height()); - int srcRightValueWidth = dstRightValueWidth / tileScale; - IntRect srcRightValueRect(0, 0, srcRightValueWidth, valueImage->height()); - paintInfo.context->drawImage(valueImage, colorSpace, dstRightValueRect, srcRightValueRect); - - IntRect alignedValueRect(dstLeftValueRect.right(), dstLeftValueRect.y(), - dstRightValueRect.x() - dstLeftValueRect.right(), dstLeftValueRect.height()); - paintInfo.context->drawTiledImage(valueImage, colorSpace, alignedValueRect, IntPoint(0, 0), valueTileSize); - } - - int dstLeftBorderWidth = leftBorderImage->width() * tileScale; - IntRect dstLeftBorderRect(rect.x(), rect.y(), dstLeftBorderWidth, rect.height()); - paintInfo.context->drawImage(leftBorderImage, colorSpace, dstLeftBorderRect, leftBorderImage->rect()); - - int dstRightBorderWidth = rightBorderImage->width() * tileScale; - IntRect dstRightBorderRect(rect.right() - dstRightBorderWidth, rect.y(), dstRightBorderWidth, rect.height()); - paintInfo.context->drawImage(rightBorderImage, colorSpace, dstRightBorderRect, rightBorderImage->rect()); - - paintInfo.context->platformContext()->clearImageResamplingHint(); - - return false; -} - - IntRect RenderThemeChromiumSkia::progressValueRectFor(RenderProgress* renderProgress, const IntRect& rect) const { return renderProgress->isDeterminate() ? determinateProgressValueRectFor(renderProgress, rect) : indeterminateProgressValueRectFor(renderProgress, rect); diff --git a/Source/WebCore/rendering/RenderThemeChromiumSkia.h b/Source/WebCore/rendering/RenderThemeChromiumSkia.h index a11046d..bf0af34 100644 --- a/Source/WebCore/rendering/RenderThemeChromiumSkia.h +++ b/Source/WebCore/rendering/RenderThemeChromiumSkia.h @@ -34,7 +34,7 @@ namespace WebCore { class RenderProgress; - class RenderThemeChromiumSkia : public RenderTheme { +class RenderThemeChromiumSkia : public RenderTheme { public: RenderThemeChromiumSkia(); virtual ~RenderThemeChromiumSkia(); @@ -66,17 +66,12 @@ class RenderProgress; virtual int minimumMenuListSize(RenderStyle*) const; - virtual bool paintCheckbox(RenderObject*, const PaintInfo&, const IntRect&); virtual void setCheckboxSize(RenderStyle*) const; - virtual bool paintRadio(RenderObject*, const PaintInfo&, const IntRect&); virtual void setRadioSize(RenderStyle*) const; - virtual bool paintButton(RenderObject*, const PaintInfo&, const IntRect&); virtual void adjustButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const; - virtual bool paintTextField(RenderObject*, const PaintInfo&, const IntRect&); - virtual bool paintTextArea(RenderObject*, const PaintInfo&, const IntRect&); virtual void adjustSearchFieldStyle(CSSStyleSelector*, RenderStyle*, Element*) const; @@ -112,17 +107,12 @@ class RenderProgress; // codepath. We never go down both. And in both cases, they render the // entire menulist. virtual void adjustMenuListStyle(CSSStyleSelector*, RenderStyle*, Element*) const; - virtual bool paintMenuList(RenderObject*, const PaintInfo&, const IntRect&); virtual void adjustMenuListButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const; virtual bool paintMenuListButton(RenderObject*, const PaintInfo&, const IntRect&); - virtual bool paintSliderTrack(RenderObject*, const PaintInfo&, const IntRect&); - virtual bool paintSliderThumb(RenderObject*, const PaintInfo&, const IntRect&); - #if ENABLE(PROGRESS_TAG) virtual double animationRepeatIntervalForProgressBar(RenderProgress*) const; virtual double animationDurationForProgressBar(RenderProgress*) const; - virtual bool paintProgressBar(RenderObject*, const PaintInfo&, const IntRect&); #endif // These methods define the padding for the MenuList's inner block. @@ -153,6 +143,8 @@ class RenderProgress; virtual double caretBlinkIntervalInternal() const; + static void setSizeIfAuto(RenderStyle*, const IntSize&); + #if ENABLE(PROGRESS_TAG) IntRect determinateProgressValueRectFor(RenderProgress*, const IntRect&) const; IntRect indeterminateProgressValueRectFor(RenderProgress*, const IntRect&) const; diff --git a/Source/WebCore/rendering/RenderThemeChromiumWin.cpp b/Source/WebCore/rendering/RenderThemeChromiumWin.cpp index 5b41ea2..bba0520 100644 --- a/Source/WebCore/rendering/RenderThemeChromiumWin.cpp +++ b/Source/WebCore/rendering/RenderThemeChromiumWin.cpp @@ -30,7 +30,6 @@ #include <vssym32.h> #include "CSSValueKeywords.h" -#include "ChromiumBridge.h" #include "CurrentTime.h" #include "FontSelector.h" #include "FontUtilsChromiumWin.h" @@ -39,6 +38,7 @@ #include "HTMLNames.h" #include "MediaControlElements.h" #include "PaintInfo.h" +#include "PlatformBridge.h" #include "RenderBox.h" #include "RenderProgress.h" #include "RenderSlider.h" @@ -238,7 +238,7 @@ bool RenderThemeChromiumWin::supportsFocusRing(const RenderStyle* style) const Color RenderThemeChromiumWin::platformActiveSelectionBackgroundColor() const { - if (ChromiumBridge::layoutTestMode()) + if (PlatformBridge::layoutTestMode()) return Color(0x00, 0x00, 0xff); // Royal blue. COLORREF color = GetSysColor(COLOR_HIGHLIGHT); return Color(GetRValue(color), GetGValue(color), GetBValue(color), 0xff); @@ -246,7 +246,7 @@ Color RenderThemeChromiumWin::platformActiveSelectionBackgroundColor() const Color RenderThemeChromiumWin::platformInactiveSelectionBackgroundColor() const { - if (ChromiumBridge::layoutTestMode()) + if (PlatformBridge::layoutTestMode()) return Color(0x99, 0x99, 0x99); // Medium gray. COLORREF color = GetSysColor(COLOR_GRAYTEXT); return Color(GetRValue(color), GetGValue(color), GetBValue(color), 0xff); @@ -254,7 +254,7 @@ Color RenderThemeChromiumWin::platformInactiveSelectionBackgroundColor() const Color RenderThemeChromiumWin::platformActiveSelectionForegroundColor() const { - if (ChromiumBridge::layoutTestMode()) + if (PlatformBridge::layoutTestMode()) return Color(0xff, 0xff, 0xcc); // Pale yellow. COLORREF color = GetSysColor(COLOR_HIGHLIGHTTEXT); return Color(GetRValue(color), GetGValue(color), GetBValue(color), 0xff); @@ -375,7 +375,7 @@ static int cssValueIdToSysColorIndex(int cssValueId) Color RenderThemeChromiumWin::systemColor(int cssValueId) const { int sysColorIndex = cssValueIdToSysColorIndex(cssValueId); - if (ChromiumBridge::layoutTestMode() || (sysColorIndex == -1)) + if (PlatformBridge::layoutTestMode() || (sysColorIndex == -1)) return RenderTheme::systemColor(cssValueId); COLORREF color = GetSysColor(sysColorIndex); @@ -411,7 +411,7 @@ bool RenderThemeChromiumWin::paintButton(RenderObject* o, const PaintInfo& i, co const ThemeData& themeData = getThemeData(o); ThemePainter painter(i.context, r); - ChromiumBridge::paintButton(painter.context(), + PlatformBridge::paintButton(painter.context(), themeData.m_part, themeData.m_state, themeData.m_classicState, @@ -429,7 +429,7 @@ bool RenderThemeChromiumWin::paintSliderTrack(RenderObject* o, const PaintInfo& const ThemeData& themeData = getThemeData(o); ThemePainter painter(i.context, r); - ChromiumBridge::paintTrackbar(painter.context(), + PlatformBridge::paintTrackbar(painter.context(), themeData.m_part, themeData.m_state, themeData.m_classicState, @@ -444,7 +444,7 @@ bool RenderThemeChromiumWin::paintSliderThumb(RenderObject* o, const PaintInfo& static int menuListButtonWidth() { - static int width = ChromiumBridge::layoutTestMode() ? kStandardMenuListButtonWidth : GetSystemMetrics(SM_CXVSCROLL); + static int width = PlatformBridge::layoutTestMode() ? kStandardMenuListButtonWidth : GetSystemMetrics(SM_CXVSCROLL); return width; } @@ -492,7 +492,7 @@ bool RenderThemeChromiumWin::paintMenuList(RenderObject* o, const PaintInfo& i, // Get the correct theme data for a textfield and paint the menu. ThemePainter painter(i.context, rect); - ChromiumBridge::paintMenuList(painter.context(), + PlatformBridge::paintMenuList(painter.context(), CP_DROPDOWNBUTTON, determineState(o), determineClassicState(o), @@ -657,7 +657,7 @@ bool RenderThemeChromiumWin::paintTextFieldInternal(RenderObject* o, bool drawEdges) { // Fallback to white if the specified color object is invalid. - // (Note ChromiumBridge::paintTextField duplicates this check). + // (Note PlatformBridge::paintTextField duplicates this check). Color backgroundColor(Color::white); if (o->style()->visitedDependentColor(CSSPropertyBackgroundColor).isValid()) backgroundColor = o->style()->visitedDependentColor(CSSPropertyBackgroundColor); @@ -676,14 +676,12 @@ bool RenderThemeChromiumWin::paintTextFieldInternal(RenderObject* o, // background (themed or filled) appropriately. // FIXME: make sure we do the right thing if css background-clip is set. i.context->save(); - IntSize topLeft, topRight, bottomLeft, bottomRight; - o->style()->getBorderRadiiForRect(r, topLeft, topRight, bottomLeft, bottomRight); - i.context->addRoundedRectClip(r, topLeft, topRight, bottomLeft, bottomRight); + i.context->addRoundedRectClip(o->style()->getRoundedBorderFor(r)); } { const ThemeData& themeData = getThemeData(o); ThemePainter painter(i.context, r); - ChromiumBridge::paintTextField(painter.context(), + PlatformBridge::paintTextField(painter.context(), themeData.m_part, themeData.m_state, themeData.m_classicState, @@ -712,7 +710,7 @@ bool RenderThemeChromiumWin::paintInnerSpinButton(RenderObject* object, const Pa half.setHeight(rect.height() / 2); const ThemeData& upThemeData = getThemeData(object, SpinButtonUp); ThemePainter upPainter(info.context, half); - ChromiumBridge::paintSpinButton(upPainter.context(), + PlatformBridge::paintSpinButton(upPainter.context(), upThemeData.m_part, upThemeData.m_state, upThemeData.m_classicState, @@ -721,7 +719,7 @@ bool RenderThemeChromiumWin::paintInnerSpinButton(RenderObject* object, const Pa half.setY(rect.y() + rect.height() / 2); const ThemeData& downThemeData = getThemeData(object, SpinButtonDown); ThemePainter downPainter(info.context, half); - ChromiumBridge::paintSpinButton(downPainter.context(), + PlatformBridge::paintSpinButton(downPainter.context(), downThemeData.m_part, downThemeData.m_state, downThemeData.m_classicState, @@ -762,7 +760,7 @@ bool RenderThemeChromiumWin::paintProgressBar(RenderObject* o, const PaintInfo& IntRect valueRect = renderProgress->isDeterminate() ? determinateProgressValueRectFor(renderProgress, r) : IntRect(0, 0, 0, 0); double animatedSeconds = renderProgress->animationStartTime() ? WTF::currentTime() - renderProgress->animationStartTime() : 0; ThemePainter painter(i.context, r); - ChromiumBridge::paintProgressBar(painter.context(), r, valueRect, renderProgress->isDeterminate(), animatedSeconds); + PlatformBridge::paintProgressBar(painter.context(), r, valueRect, renderProgress->isDeterminate(), animatedSeconds); return false; } diff --git a/Source/WebCore/rendering/RenderThemeMac.mm b/Source/WebCore/rendering/RenderThemeMac.mm index 0764093..605e958 100644 --- a/Source/WebCore/rendering/RenderThemeMac.mm +++ b/Source/WebCore/rendering/RenderThemeMac.mm @@ -1033,14 +1033,8 @@ void RenderThemeMac::paintMenuListButtonGradients(RenderObject* o, const PaintIn paintInfo.context->save(); - IntSize topLeftRadius; - IntSize topRightRadius; - IntSize bottomLeftRadius; - IntSize bottomRightRadius; - - o->style()->getBorderRadiiForRect(r, topLeftRadius, topRightRadius, bottomLeftRadius, bottomRightRadius); - - int radius = topLeftRadius.width(); + RoundedIntRect border = o->style()->getRoundedBorderFor(r); + int radius = border.radii().topLeft().width(); CGColorSpaceRef cspace = deviceRGBColorSpaceRef(); @@ -1063,27 +1057,27 @@ void RenderThemeMac::paintMenuListButtonGradients(RenderObject* o, const PaintIn RetainPtr<CGShadingRef> rightShading(AdoptCF, CGShadingCreateAxial(cspace, CGPointMake(r.right(), r.y()), CGPointMake(r.right() - radius, r.y()), mainFunction.get(), false, false)); paintInfo.context->save(); CGContextClipToRect(context, r); - paintInfo.context->addRoundedRectClip(r, topLeftRadius, topRightRadius, bottomLeftRadius, bottomRightRadius); + paintInfo.context->addRoundedRectClip(border); CGContextDrawShading(context, mainShading.get()); paintInfo.context->restore(); paintInfo.context->save(); CGContextClipToRect(context, topGradient); - paintInfo.context->addRoundedRectClip(enclosingIntRect(topGradient), topLeftRadius, topRightRadius, IntSize(), IntSize()); + paintInfo.context->addRoundedRectClip(RoundedIntRect(enclosingIntRect(topGradient), border.radii().topLeft(), border.radii().topRight(), IntSize(), IntSize())); CGContextDrawShading(context, topShading.get()); paintInfo.context->restore(); if (!bottomGradient.isEmpty()) { paintInfo.context->save(); CGContextClipToRect(context, bottomGradient); - paintInfo.context->addRoundedRectClip(enclosingIntRect(bottomGradient), IntSize(), IntSize(), bottomLeftRadius, bottomRightRadius); + paintInfo.context->addRoundedRectClip(RoundedIntRect(enclosingIntRect(bottomGradient), IntSize(), IntSize(), border.radii().bottomLeft(), border.radii().bottomRight())); CGContextDrawShading(context, bottomShading.get()); paintInfo.context->restore(); } paintInfo.context->save(); CGContextClipToRect(context, r); - paintInfo.context->addRoundedRectClip(r, topLeftRadius, topRightRadius, bottomLeftRadius, bottomRightRadius); + paintInfo.context->addRoundedRectClip(border); CGContextDrawShading(context, leftShading.get()); CGContextDrawShading(context, rightShading.get()); paintInfo.context->restore(); @@ -1304,9 +1298,7 @@ bool RenderThemeMac::paintSliderTrack(RenderObject* o, const PaintInfo& paintInf mainShading.adoptCF(CGShadingCreateAxial(cspace, CGPointMake(bounds.x(), bounds.y()), CGPointMake(bounds.x(), bounds.bottom()), mainFunction.get(), false, false)); IntSize radius(trackRadius, trackRadius); - paintInfo.context->addRoundedRectClip(bounds, - radius, radius, - radius, radius); + paintInfo.context->addRoundedRectClip(RoundedIntRect(bounds, radius, radius, radius, radius)); CGContextDrawShading(context, mainShading.get()); paintInfo.context->restore(); diff --git a/Source/WebCore/rendering/RenderThemeSafari.cpp b/Source/WebCore/rendering/RenderThemeSafari.cpp index 3c1dedc..47f627e 100644 --- a/Source/WebCore/rendering/RenderThemeSafari.cpp +++ b/Source/WebCore/rendering/RenderThemeSafari.cpp @@ -752,14 +752,8 @@ void RenderThemeSafari::paintMenuListButtonGradients(RenderObject* o, const Pain paintInfo.context->save(); - IntSize topLeftRadius; - IntSize topRightRadius; - IntSize bottomLeftRadius; - IntSize bottomRightRadius; - - o->style()->getBorderRadiiForRect(r, topLeftRadius, topRightRadius, bottomLeftRadius, bottomRightRadius); - - int radius = topLeftRadius.width(); + RoundedIntRect bound = o->style()->getRoundedBorderFor(r); + int radius = bound.radii().topLeft().width(); CGColorSpaceRef cspace = deviceRGBColorSpaceRef(); @@ -781,28 +775,28 @@ void RenderThemeSafari::paintMenuListButtonGradients(RenderObject* o, const Pain RetainPtr<CGShadingRef> rightShading(AdoptCF, CGShadingCreateAxial(cspace, CGPointMake(r.right(), r.y()), CGPointMake(r.right() - radius, r.y()), mainFunction.get(), false, false)); paintInfo.context->save(); - CGContextClipToRect(context, r); - paintInfo.context->addRoundedRectClip(r, topLeftRadius, topRightRadius, bottomLeftRadius, bottomRightRadius); + CGContextClipToRect(context, bound.rect()); + paintInfo.context->addRoundedRectClip(bound); CGContextDrawShading(context, mainShading.get()); paintInfo.context->restore(); paintInfo.context->save(); CGContextClipToRect(context, topGradient); - paintInfo.context->addRoundedRectClip(enclosingIntRect(topGradient), topLeftRadius, topRightRadius, IntSize(), IntSize()); + paintInfo.context->addRoundedRectClip(RoundedIntRect(enclosingIntRect(topGradient), bound.radii().topLeft(), bound.radii().topRight(), IntSize(), IntSize())); CGContextDrawShading(context, topShading.get()); paintInfo.context->restore(); if (!bottomGradient.isEmpty()) { paintInfo.context->save(); CGContextClipToRect(context, bottomGradient); - paintInfo.context->addRoundedRectClip(enclosingIntRect(bottomGradient), IntSize(), IntSize(), bottomLeftRadius, bottomRightRadius); + paintInfo.context->addRoundedRectClip(RoundedIntRect(enclosingIntRect(bottomGradient), IntSize(), IntSize(), bound.radii().bottomLeft(), bound.radii().bottomRight())); CGContextDrawShading(context, bottomShading.get()); paintInfo.context->restore(); } paintInfo.context->save(); - CGContextClipToRect(context, r); - paintInfo.context->addRoundedRectClip(r, topLeftRadius, topRightRadius, bottomLeftRadius, bottomRightRadius); + CGContextClipToRect(context, bound.rect()); + paintInfo.context->addRoundedRectClip(bound); CGContextDrawShading(context, leftShading.get()); CGContextDrawShading(context, rightShading.get()); paintInfo.context->restore(); @@ -958,34 +952,35 @@ const int trackRadius = 2; bool RenderThemeSafari::paintSliderTrack(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r) { - IntRect bounds = r; - - if (o->style()->appearance() == SliderHorizontalPart) { - bounds.setHeight(trackWidth); - bounds.setY(r.y() + r.height() / 2 - trackWidth / 2); - } else if (o->style()->appearance() == SliderVerticalPart) { - bounds.setWidth(trackWidth); - bounds.setX(r.x() + r.width() / 2 - trackWidth / 2); - } + IntSize radius(trackRadius, trackRadius); + RoundedIntRect bounds(r, radius, radius, radius, radius); + + if (o->style()->appearance() == SliderHorizontalPart) + bounds.setRect(IntRect(r.x(), + r.y() + r.height() / 2 - trackWidth / 2, + r.width(), + trackWidth)); + else if (o->style()->appearance() == SliderVerticalPart) + bounds.setRect(IntRect(r.x() + r.width() / 2 - trackWidth / 2, + r.y(), + trackWidth, + r.height())); CGContextRef context = paintInfo.context->platformContext(); CGColorSpaceRef cspace = deviceRGBColorSpaceRef(); paintInfo.context->save(); - CGContextClipToRect(context, bounds); + CGContextClipToRect(context, bounds.rect()); struct CGFunctionCallbacks mainCallbacks = { 0, TrackGradientInterpolate, NULL }; RetainPtr<CGFunctionRef> mainFunction(AdoptCF, CGFunctionCreate(NULL, 1, NULL, 4, NULL, &mainCallbacks)); RetainPtr<CGShadingRef> mainShading; if (o->style()->appearance() == SliderVerticalPart) - mainShading.adoptCF(CGShadingCreateAxial(cspace, CGPointMake(bounds.x(), bounds.bottom()), CGPointMake(bounds.right(), bounds.bottom()), mainFunction.get(), false, false)); + mainShading.adoptCF(CGShadingCreateAxial(cspace, CGPointMake(bounds.rect().x(), bounds.rect().bottom()), CGPointMake(bounds.rect().right(), bounds.rect().bottom()), mainFunction.get(), false, false)); else - mainShading.adoptCF(CGShadingCreateAxial(cspace, CGPointMake(bounds.x(), bounds.y()), CGPointMake(bounds.x(), bounds.bottom()), mainFunction.get(), false, false)); + mainShading.adoptCF(CGShadingCreateAxial(cspace, CGPointMake(bounds.rect().x(), bounds.rect().y()), CGPointMake(bounds.rect().x(), bounds.rect().bottom()), mainFunction.get(), false, false)); - IntSize radius(trackRadius, trackRadius); - paintInfo.context->addRoundedRectClip(bounds, - radius, radius, - radius, radius); + paintInfo.context->addRoundedRectClip(bounds); CGContextDrawShading(context, mainShading.get()); paintInfo.context->restore(); diff --git a/Source/WebCore/rendering/RenderThemeWinCE.cpp b/Source/WebCore/rendering/RenderThemeWinCE.cpp index 2c55f31..d4bff96 100644 --- a/Source/WebCore/rendering/RenderThemeWinCE.cpp +++ b/Source/WebCore/rendering/RenderThemeWinCE.cpp @@ -378,7 +378,7 @@ bool RenderThemeWinCE::paintSearchFieldCancelButton(RenderObject* o, const Paint int y = r.y() + (r.height() - cancelSize.height()) / 2 + 1; IntRect cancelBounds(IntPoint(x, y), cancelSize); paintInfo.context->save(); - paintInfo.context->addRoundedRectClip(cancelBounds, cancelRadius, cancelRadius, cancelRadius, cancelRadius); + paintInfo.context->addRoundedRectClip(RoundedIntRect(cancelBounds, cancelRadius, cancelRadius, cancelRadius, cancelRadius)); paintInfo.context->fillRect(cancelBounds, buttonColor, ColorSpaceDeviceRGB); // Draw the 'x' diff --git a/Source/WebCore/rendering/RenderView.h b/Source/WebCore/rendering/RenderView.h index 2915998..14b94ec 100644 --- a/Source/WebCore/rendering/RenderView.h +++ b/Source/WebCore/rendering/RenderView.h @@ -267,7 +267,8 @@ void toRenderView(const RenderView*); // Stack-based class to assist with LayoutState push/pop -class LayoutStateMaintainer : public Noncopyable { +class LayoutStateMaintainer { + WTF_MAKE_NONCOPYABLE(LayoutStateMaintainer); public: // ctor to push now LayoutStateMaintainer(RenderView* view, RenderBox* root, IntSize offset, bool disableState = false, int pageHeight = 0, bool pageHeightChanged = false, ColumnInfo* colInfo = 0) diff --git a/Source/WebCore/rendering/RenderWidget.cpp b/Source/WebCore/rendering/RenderWidget.cpp index 22283a0..d4b8ba6 100644 --- a/Source/WebCore/rendering/RenderWidget.cpp +++ b/Source/WebCore/rendering/RenderWidget.cpp @@ -275,11 +275,7 @@ void RenderWidget::paint(PaintInfo& paintInfo, int tx, int ty) // Push a clip if we have a border radius, since we want to round the foreground content that gets painted. paintInfo.context->save(); - - IntSize topLeft, topRight, bottomLeft, bottomRight; - style()->getBorderRadiiForRect(borderRect, topLeft, topRight, bottomLeft, bottomRight); - - paintInfo.context->addRoundedRectClip(borderRect, topLeft, topRight, bottomLeft, bottomRight); + paintInfo.context->addRoundedRectClip(style()->getRoundedBorderFor(borderRect)); } if (m_widget) { diff --git a/Source/WebCore/rendering/RenderWidgetProtector.h b/Source/WebCore/rendering/RenderWidgetProtector.h index 788304c..8bf6ac9 100644 --- a/Source/WebCore/rendering/RenderWidgetProtector.h +++ b/Source/WebCore/rendering/RenderWidgetProtector.h @@ -30,7 +30,8 @@ namespace WebCore { -class RenderWidgetProtector : private Noncopyable { +class RenderWidgetProtector { + WTF_MAKE_NONCOPYABLE(RenderWidgetProtector); public: RenderWidgetProtector(RenderWidget* object) : m_object(object) diff --git a/Source/WebCore/rendering/RootInlineBox.cpp b/Source/WebCore/rendering/RootInlineBox.cpp index 65130e7..e9e2029 100644 --- a/Source/WebCore/rendering/RootInlineBox.cpp +++ b/Source/WebCore/rendering/RootInlineBox.cpp @@ -266,6 +266,8 @@ int RootInlineBox::alignBoxesInBlockDirection(int heightOfBlock, GlyphOverflowAn heightOfBlock += annotationsAdjustment; } + maxHeight = max(0, maxHeight); + // Detect integer overflow. if (heightOfBlock > numeric_limits<int>::max() - maxHeight) return numeric_limits<int>::max(); diff --git a/Source/WebCore/rendering/ShadowElement.h b/Source/WebCore/rendering/ShadowElement.h index 2c1a69e..8bcb34e 100644 --- a/Source/WebCore/rendering/ShadowElement.h +++ b/Source/WebCore/rendering/ShadowElement.h @@ -39,16 +39,12 @@ class ShadowElement : public BaseElement { protected: ShadowElement(const QualifiedName& name, HTMLElement* shadowParent) : BaseElement(name, shadowParent->document()) - , m_shadowParent(shadowParent) { BaseElement::setShadowHost(shadowParent); } public: virtual void detach(); - -private: - RefPtr<HTMLElement> m_shadowParent; }; template<class BaseElement> diff --git a/Source/WebCore/rendering/TableLayout.h b/Source/WebCore/rendering/TableLayout.h index e0fa8ee..c5f61f6 100644 --- a/Source/WebCore/rendering/TableLayout.h +++ b/Source/WebCore/rendering/TableLayout.h @@ -21,13 +21,15 @@ #ifndef TableLayout_h #define TableLayout_h +#include <wtf/FastAllocBase.h> #include <wtf/Noncopyable.h> namespace WebCore { class RenderTable; -class TableLayout : public Noncopyable { +class TableLayout { + WTF_MAKE_NONCOPYABLE(TableLayout); WTF_MAKE_FAST_ALLOCATED; public: TableLayout(RenderTable* table) : m_table(table) diff --git a/Source/WebCore/rendering/TextControlInnerElements.cpp b/Source/WebCore/rendering/TextControlInnerElements.cpp index 5b8712d..7b1b36f 100644 --- a/Source/WebCore/rendering/TextControlInnerElements.cpp +++ b/Source/WebCore/rendering/TextControlInnerElements.cpp @@ -119,7 +119,8 @@ void TextControlInnerElement::detach() { HTMLDivElement::detach(); // FIXME: Remove once shadow DOM uses Element::setShadowRoot(). - setShadowHost(0); + if (shadowHost()) + setShadowHost(0); } // ---------------------------- @@ -243,7 +244,7 @@ void SearchFieldCancelButtonElement::defaultEventHandler(Event* event) input->setValue(""); if (!oldValue.isEmpty()) { toRenderTextControl(input->renderer())->setChangedSinceLastChangeEvent(true); - input->dispatchEvent(Event::create(eventNames().inputEvent, true, false)); + input->dispatchFormControlInputEvent(); } input->onSearch(); event->setDefaultHandled(); @@ -433,9 +434,13 @@ void InputFieldSpeechButtonElement::defaultEventHandler(Event* event) if (event->type() == eventNames().clickEvent) { switch (m_state) { - case Idle: - if (speechInput()->startRecognition(m_listenerId, input->renderer()->absoluteBoundingBoxRect(), input->computeInheritedLanguage(), input->getAttribute(webkitgrammarAttr))) - setState(Recording); + case Idle: { + AtomicString language = input->computeInheritedLanguage(); + String grammar = input->getAttribute(webkitgrammarAttr); + IntRect rect = input->renderer()->absoluteBoundingBoxRect(); + if (speechInput()->startRecognition(m_listenerId, rect, language, grammar, document()->securityOrigin())) + setState(Recording); + } break; case Recording: speechInput()->stopRecording(m_listenerId); diff --git a/Source/WebCore/rendering/TransformState.h b/Source/WebCore/rendering/TransformState.h index 0b4ca46..36fc6ec 100644 --- a/Source/WebCore/rendering/TransformState.h +++ b/Source/WebCore/rendering/TransformState.h @@ -31,14 +31,14 @@ #include "FloatQuad.h" #include "IntSize.h" #include "TransformationMatrix.h" -#include <wtf/Noncopyable.h> #include <wtf/PassRefPtr.h> #include <wtf/OwnPtr.h> #include <wtf/RefCounted.h> namespace WebCore { -class TransformState : public Noncopyable { +class TransformState { + WTF_MAKE_NONCOPYABLE(TransformState); public: enum TransformDirection { ApplyTransformDirection, UnapplyInverseTransformDirection }; enum TransformAccumulation { FlattenTransform, AccumulateTransform }; diff --git a/Source/WebCore/rendering/VerticalPositionCache.h b/Source/WebCore/rendering/VerticalPositionCache.h index 4deaef5..b25b2f6 100644 --- a/Source/WebCore/rendering/VerticalPositionCache.h +++ b/Source/WebCore/rendering/VerticalPositionCache.h @@ -38,7 +38,8 @@ const int PositionTop = -0x7fffffff; const int PositionBottom = 0x7fffffff; const int PositionUndefined = 0x80000000; -class VerticalPositionCache : public Noncopyable { +class VerticalPositionCache { + WTF_MAKE_NONCOPYABLE(VerticalPositionCache); public: VerticalPositionCache() { } diff --git a/Source/WebCore/rendering/mathml/RenderMathMLFraction.cpp b/Source/WebCore/rendering/mathml/RenderMathMLFraction.cpp index 7117618..9d80fbe 100644 --- a/Source/WebCore/rendering/mathml/RenderMathMLFraction.cpp +++ b/Source/WebCore/rendering/mathml/RenderMathMLFraction.cpp @@ -39,12 +39,12 @@ namespace WebCore { using namespace MathMLNames; -static const double gHorizontalPad = 0.2; -static const double gLineThin = 0.33; -static const double gLineMedium = 1.; -static const double gLineThick = 3.; -static const double gFractionBarWidth = 0.05; -static const double gDenominatorPad = 0.1; +static const float gHorizontalPad = 0.2f; +static const float gLineThin = 0.33f; +static const float gLineMedium = 1.f; +static const float gLineThick = 3.f; +static const float gFractionBarWidth = 0.05f; +static const float gDenominatorPad = 0.1f; RenderMathMLFraction::RenderMathMLFraction(Element* fraction) : RenderMathMLBlock(fraction) @@ -125,7 +125,7 @@ void RenderMathMLFraction::layout() // Adjust the fraction line thickness for the zoom if (lastChild() && lastChild()->isRenderBlock()) - m_lineThickness *= ceil(gFractionBarWidth * style()->fontSize()); + m_lineThickness *= ceilf(gFractionBarWidth * style()->fontSize()); RenderBlock::layout(); @@ -158,7 +158,7 @@ void RenderMathMLFraction::paint(PaintInfo& info, int tx, int ty) info.context->save(); - info.context->setStrokeThickness(static_cast<float>(m_lineThickness)); + info.context->setStrokeThickness(m_lineThickness); info.context->setStrokeStyle(SolidStroke); info.context->setStrokeColor(style()->visitedDependentColor(CSSPropertyColor), ColorSpaceSRGB); diff --git a/Source/WebCore/rendering/mathml/RenderMathMLFraction.h b/Source/WebCore/rendering/mathml/RenderMathMLFraction.h index 2a03f81..c96d56d 100644 --- a/Source/WebCore/rendering/mathml/RenderMathMLFraction.h +++ b/Source/WebCore/rendering/mathml/RenderMathMLFraction.h @@ -43,7 +43,7 @@ public: protected: virtual void layout(); private: - double m_lineThickness; + float m_lineThickness; }; } diff --git a/Source/WebCore/rendering/style/BorderData.h b/Source/WebCore/rendering/style/BorderData.h index 03635d9..0e50edb 100644 --- a/Source/WebCore/rendering/style/BorderData.h +++ b/Source/WebCore/rendering/style/BorderData.h @@ -26,6 +26,7 @@ #define BorderData_h #include "BorderValue.h" +#include "IntRect.h" #include "LengthSize.h" #include "NinePieceImage.h" @@ -109,7 +110,7 @@ public: const LengthSize& topRight() const { return m_topRight; } const LengthSize& bottomLeft() const { return m_bottomLeft; } const LengthSize& bottomRight() const { return m_bottomRight; } - + private: BorderValue m_left; BorderValue m_right; diff --git a/Source/WebCore/rendering/style/ContentData.h b/Source/WebCore/rendering/style/ContentData.h index 4f964a2..15f6912 100644 --- a/Source/WebCore/rendering/style/ContentData.h +++ b/Source/WebCore/rendering/style/ContentData.h @@ -33,7 +33,8 @@ namespace WebCore { class StyleImage; -struct ContentData : Noncopyable { +struct ContentData { + WTF_MAKE_NONCOPYABLE(ContentData); WTF_MAKE_FAST_ALLOCATED; public: ContentData() : m_type(CONTENT_NONE) diff --git a/Source/WebCore/rendering/style/CounterContent.h b/Source/WebCore/rendering/style/CounterContent.h index 52757ad..814039e 100644 --- a/Source/WebCore/rendering/style/CounterContent.h +++ b/Source/WebCore/rendering/style/CounterContent.h @@ -30,7 +30,8 @@ namespace WebCore { -class CounterContent : public FastAllocBase { +class CounterContent { + WTF_MAKE_FAST_ALLOCATED; public: CounterContent(const AtomicString& identifier, EListStyleType style, const AtomicString& separator) : m_identifier(identifier) diff --git a/Source/WebCore/rendering/style/FillLayer.h b/Source/WebCore/rendering/style/FillLayer.h index 49fb294..847e8df 100644 --- a/Source/WebCore/rendering/style/FillLayer.h +++ b/Source/WebCore/rendering/style/FillLayer.h @@ -59,7 +59,8 @@ struct FillSize { LengthSize size; }; -class FillLayer : public FastAllocBase { +class FillLayer { + WTF_MAKE_FAST_ALLOCATED; public: FillLayer(EFillLayerType); ~FillLayer(); diff --git a/Source/WebCore/rendering/style/RenderStyle.cpp b/Source/WebCore/rendering/style/RenderStyle.cpp index 4665e52..2836fb9 100644 --- a/Source/WebCore/rendering/style/RenderStyle.cpp +++ b/Source/WebCore/rendering/style/RenderStyle.cpp @@ -744,7 +744,19 @@ void RenderStyle::setBoxShadow(ShadowData* shadowData, bool add) rareData->m_boxShadow.set(shadowData); } -static void constrainCornerRadiiForRect(const IntRect& r, IntSize& topLeft, IntSize& topRight, IntSize& bottomLeft, IntSize& bottomRight) +static RoundedIntRect::Radii calcRadiiFor(const BorderData& border, int width, int height) +{ + return RoundedIntRect::Radii(IntSize(border.topLeft().width().calcValue(width), + border.topLeft().height().calcValue(height)), + IntSize(border.topRight().width().calcValue(width), + border.topRight().height().calcValue(height)), + IntSize(border.bottomLeft().width().calcValue(width), + border.bottomLeft().height().calcValue(height)), + IntSize(border.bottomRight().width().calcValue(width), + border.bottomRight().height().calcValue(height))); +} + +static float calcConstraintScaleFor(const IntRect& rect, const RoundedIntRect::Radii& radii) { // Constrain corner radii using CSS3 rules: // http://www.w3.org/TR/css3-background/#the-border-radius @@ -753,75 +765,43 @@ static void constrainCornerRadiiForRect(const IntRect& r, IntSize& topLeft, IntS unsigned radiiSum; // top - radiiSum = static_cast<unsigned>(topLeft.width()) + static_cast<unsigned>(topRight.width()); // Casts to avoid integer overflow. - if (radiiSum > static_cast<unsigned>(r.width())) - factor = min(static_cast<float>(r.width()) / radiiSum, factor); + radiiSum = static_cast<unsigned>(radii.topLeft().width()) + static_cast<unsigned>(radii.topRight().width()); // Casts to avoid integer overflow. + if (radiiSum > static_cast<unsigned>(rect.width())) + factor = std::min(static_cast<float>(rect.width()) / radiiSum, factor); // bottom - radiiSum = static_cast<unsigned>(bottomLeft.width()) + static_cast<unsigned>(bottomRight.width()); - if (radiiSum > static_cast<unsigned>(r.width())) - factor = min(static_cast<float>(r.width()) / radiiSum, factor); + radiiSum = static_cast<unsigned>(radii.bottomLeft().width()) + static_cast<unsigned>(radii.bottomRight().width()); + if (radiiSum > static_cast<unsigned>(rect.width())) + factor = std::min(static_cast<float>(rect.width()) / radiiSum, factor); // left - radiiSum = static_cast<unsigned>(topLeft.height()) + static_cast<unsigned>(bottomLeft.height()); - if (radiiSum > static_cast<unsigned>(r.height())) - factor = min(static_cast<float>(r.height()) / radiiSum, factor); + radiiSum = static_cast<unsigned>(radii.topLeft().height()) + static_cast<unsigned>(radii.bottomLeft().height()); + if (radiiSum > static_cast<unsigned>(rect.height())) + factor = std::min(static_cast<float>(rect.height()) / radiiSum, factor); // right - radiiSum = static_cast<unsigned>(topRight.height()) + static_cast<unsigned>(bottomRight.height()); - if (radiiSum > static_cast<unsigned>(r.height())) - factor = min(static_cast<float>(r.height()) / radiiSum, factor); + radiiSum = static_cast<unsigned>(radii.topRight().height()) + static_cast<unsigned>(radii.bottomRight().height()); + if (radiiSum > static_cast<unsigned>(rect.height())) + factor = std::min(static_cast<float>(rect.height()) / radiiSum, factor); - // Scale all radii by f if necessary. - if (factor < 1) { - // If either radius on a corner becomes zero, reset both radii on that corner. - topLeft.scale(factor); - if (!topLeft.width() || !topLeft.height()) - topLeft = IntSize(); - topRight.scale(factor); - if (!topRight.width() || !topRight.height()) - topRight = IntSize(); - bottomLeft.scale(factor); - if (!bottomLeft.width() || !bottomLeft.height()) - bottomLeft = IntSize(); - bottomRight.scale(factor); - if (!bottomRight.width() || !bottomRight.height()) - bottomRight = IntSize(); - } + ASSERT(factor <= 1); + return factor; } -void RenderStyle::getBorderRadiiForRect(const IntRect& r, IntSize& topLeft, IntSize& topRight, IntSize& bottomLeft, IntSize& bottomRight) const +RoundedIntRect RenderStyle::getRoundedBorderFor(const IntRect& rect) const { - topLeft = IntSize(surround->border.topLeft().width().calcValue(r.width()), surround->border.topLeft().height().calcValue(r.height())); - topRight = IntSize(surround->border.topRight().width().calcValue(r.width()), surround->border.topRight().height().calcValue(r.height())); - - bottomLeft = IntSize(surround->border.bottomLeft().width().calcValue(r.width()), surround->border.bottomLeft().height().calcValue(r.height())); - bottomRight = IntSize(surround->border.bottomRight().width().calcValue(r.width()), surround->border.bottomRight().height().calcValue(r.height())); - - constrainCornerRadiiForRect(r, topLeft, topRight, bottomLeft, bottomRight); + RoundedIntRect::Radii radii = calcRadiiFor(surround->border, rect.width(), rect.height()); + radii.scale(calcConstraintScaleFor(rect, radii)); + return RoundedIntRect(rect, radii); } -void RenderStyle::getInnerBorderRadiiForRectWithBorderWidths(const IntRect& innerRect, unsigned short topWidth, unsigned short bottomWidth, unsigned short leftWidth, unsigned short rightWidth, IntSize& innerTopLeft, IntSize& innerTopRight, IntSize& innerBottomLeft, IntSize& innerBottomRight) const +RoundedIntRect RenderStyle::getRoundedInnerBorderWithBorderWidths(const IntRect& innerRect, unsigned short topWidth, + unsigned short bottomWidth, unsigned short leftWidth, unsigned short rightWidth) const { - innerTopLeft = IntSize(surround->border.topLeft().width().calcValue(innerRect.width()), surround->border.topLeft().height().calcValue(innerRect.height())); - innerTopRight = IntSize(surround->border.topRight().width().calcValue(innerRect.width()), surround->border.topRight().height().calcValue(innerRect.height())); - innerBottomLeft = IntSize(surround->border.bottomLeft().width().calcValue(innerRect.width()), surround->border.bottomLeft().height().calcValue(innerRect.height())); - innerBottomRight = IntSize(surround->border.bottomRight().width().calcValue(innerRect.width()), surround->border.bottomRight().height().calcValue(innerRect.height())); - - - innerTopLeft.setWidth(max(0, innerTopLeft.width() - leftWidth)); - innerTopLeft.setHeight(max(0, innerTopLeft.height() - topWidth)); - - innerTopRight.setWidth(max(0, innerTopRight.width() - rightWidth)); - innerTopRight.setHeight(max(0, innerTopRight.height() - topWidth)); - - innerBottomLeft.setWidth(max(0, innerBottomLeft.width() - leftWidth)); - innerBottomLeft.setHeight(max(0, innerBottomLeft.height() - bottomWidth)); - - innerBottomRight.setWidth(max(0, innerBottomRight.width() - rightWidth)); - innerBottomRight.setHeight(max(0, innerBottomRight.height() - bottomWidth)); - - constrainCornerRadiiForRect(innerRect, innerTopLeft, innerTopRight, innerBottomLeft, innerBottomRight); + RoundedIntRect::Radii radii = calcRadiiFor(surround->border, innerRect.width(), innerRect.height()); + radii.shrink(topWidth, bottomWidth, leftWidth, rightWidth); + radii.scale(calcConstraintScaleFor(innerRect, radii)); + return RoundedIntRect(innerRect, radii); } const CounterDirectiveMap* RenderStyle::counterDirectives() const diff --git a/Source/WebCore/rendering/style/RenderStyle.h b/Source/WebCore/rendering/style/RenderStyle.h index 14329bc..9d5239b 100644 --- a/Source/WebCore/rendering/style/RenderStyle.h +++ b/Source/WebCore/rendering/style/RenderStyle.h @@ -43,6 +43,8 @@ #include "NinePieceImage.h" #include "OutlineValue.h" #include "RenderStyleConstants.h" +#include "RoundedIntRect.h" +#include "ShadowData.h" #include "StyleBackgroundData.h" #include "StyleBoxData.h" #include "StyleFlexibleBoxData.h" @@ -862,13 +864,10 @@ public: { setBorderRadius(LengthSize(Length(s.width(), Fixed), Length(s.height(), Fixed))); } - - void getBorderRadiiForRect(const IntRect&, IntSize& topLeft, IntSize& topRight, IntSize& bottomLeft, IntSize& bottomRight) const; - void getInnerBorderRadiiForRectWithBorderWidths(const IntRect&, unsigned short topWidth, - unsigned short bottomWidth, unsigned short leftWidth, unsigned short rightWidth, - IntSize& innerTopLeft, IntSize& innerTopRight, IntSize& innerBottomLeft, - IntSize& innerBottomRight) const; + RoundedIntRect getRoundedBorderFor(const IntRect&) const; + RoundedIntRect getRoundedInnerBorderWithBorderWidths(const IntRect&, unsigned short topWidth, + unsigned short bottomWidth, unsigned short leftWidth, unsigned short rightWidth) const; void setBorderLeftWidth(unsigned short v) { SET_VAR(surround, border.m_left.m_width, v) } void setBorderLeftStyle(EBorderStyle v) { SET_VAR(surround, border.m_left.m_style, v) } @@ -1212,11 +1211,11 @@ public: bool childrenAffectedByBackwardPositionalRules() const { return m_childrenAffectedByBackwardPositionalRules; } void setChildrenAffectedByBackwardPositionalRules() { m_childrenAffectedByBackwardPositionalRules = true; } bool firstChildState() const { return m_firstChildState; } - void setFirstChildState() { m_firstChildState = true; } + void setFirstChildState() { m_unique = true; m_firstChildState = true; } bool lastChildState() const { return m_lastChildState; } - void setLastChildState() { m_lastChildState = true; } + void setLastChildState() { m_unique = true; m_lastChildState = true; } unsigned childIndex() const { return m_childIndex; } - void setChildIndex(unsigned index) { m_childIndex = index; } + void setChildIndex(unsigned index) { m_unique = true; m_childIndex = index; } const Color visitedDependentColor(int colorProperty) const; diff --git a/Source/WebCore/rendering/style/ShadowData.h b/Source/WebCore/rendering/style/ShadowData.h index fb5926d..0be3fc1 100644 --- a/Source/WebCore/rendering/style/ShadowData.h +++ b/Source/WebCore/rendering/style/ShadowData.h @@ -26,7 +26,6 @@ #define ShadowData_h #include "Color.h" -#include <wtf/FastAllocBase.h> namespace WebCore { @@ -37,7 +36,8 @@ enum ShadowStyle { Normal, Inset }; // This struct holds information about shadows for the text-shadow and box-shadow properties. -class ShadowData : public FastAllocBase { +class ShadowData { + WTF_MAKE_FAST_ALLOCATED; public: ShadowData() : m_x(0) diff --git a/Source/WebCore/rendering/svg/RenderSVGResourceClipper.h b/Source/WebCore/rendering/svg/RenderSVGResourceClipper.h index 7f862a7..99861d8 100644 --- a/Source/WebCore/rendering/svg/RenderSVGResourceClipper.h +++ b/Source/WebCore/rendering/svg/RenderSVGResourceClipper.h @@ -35,7 +35,9 @@ namespace WebCore { -struct ClipperData : FastAllocBase { +struct ClipperData { + WTF_MAKE_FAST_ALLOCATED; +public: OwnPtr<ImageBuffer> clipMaskImage; }; diff --git a/Source/WebCore/rendering/svg/RenderSVGResourceContainer.cpp b/Source/WebCore/rendering/svg/RenderSVGResourceContainer.cpp index 2a8a47f..0215e8e 100644 --- a/Source/WebCore/rendering/svg/RenderSVGResourceContainer.cpp +++ b/Source/WebCore/rendering/svg/RenderSVGResourceContainer.cpp @@ -182,8 +182,8 @@ AffineTransform RenderSVGResourceContainer::transformOnNonScalingStroke(RenderOb return resourceTransform; SVGStyledTransformableElement* element = static_cast<SVGStyledTransformableElement*>(object->node()); - AffineTransform transform = resourceTransform; - transform.multiply(element->getScreenCTM(SVGLocatable::DisallowStyleUpdate)); + AffineTransform transform = element->getScreenCTM(SVGLocatable::DisallowStyleUpdate); + transform *= resourceTransform; return transform; } diff --git a/Source/WebCore/rendering/svg/RenderSVGResourceGradient.cpp b/Source/WebCore/rendering/svg/RenderSVGResourceGradient.cpp index 5ad5d84..9f2bb8d 100644 --- a/Source/WebCore/rendering/svg/RenderSVGResourceGradient.cpp +++ b/Source/WebCore/rendering/svg/RenderSVGResourceGradient.cpp @@ -133,7 +133,7 @@ static inline AffineTransform clipToTextMask(GraphicsContext* context, matrix.translate(maskBoundingBox.x(), maskBoundingBox.y()); matrix.scaleNonUniform(maskBoundingBox.width(), maskBoundingBox.height()); } - matrix.multLeft(gradientTransform); + matrix *= gradientTransform; return matrix; } #endif @@ -190,7 +190,7 @@ bool RenderSVGResourceGradient::applyResource(RenderObject* object, RenderStyle* AffineTransform gradientTransform; calculateGradientTransform(gradientTransform); - gradientData->userspaceTransform.multLeft(gradientTransform); + gradientData->userspaceTransform *= gradientTransform; gradientData->gradient->setGradientSpaceTransform(gradientData->userspaceTransform); } diff --git a/Source/WebCore/rendering/svg/RenderSVGResourcePattern.cpp b/Source/WebCore/rendering/svg/RenderSVGResourcePattern.cpp index 330a21a..1b14ce4 100644 --- a/Source/WebCore/rendering/svg/RenderSVGResourcePattern.cpp +++ b/Source/WebCore/rendering/svg/RenderSVGResourcePattern.cpp @@ -139,7 +139,7 @@ bool RenderSVGResourcePattern::applyResource(RenderObject* object, RenderStyle* AffineTransform patternTransform = m_attributes.patternTransform(); if (!patternTransform.isIdentity()) - patternData->transform.multiply(patternTransform); + patternData->transform = patternTransform * patternData->transform; patternData->pattern->setPatternSpaceTransform(patternData->transform); } @@ -228,7 +228,7 @@ bool RenderSVGResourcePattern::buildTileImageTransform(RenderObject* renderer, if (patternBoundaries.width() <= 0 || patternBoundaries.height() <= 0) return false; - AffineTransform viewBoxCTM = patternElement->viewBoxToViewTransform(patternElement->viewBox(), patternElement->preserveAspectRatio(), patternBoundaries.width(), patternBoundaries.height()); + AffineTransform viewBoxCTM = patternElement->viewBoxToViewTransform(attributes.viewBox(), attributes.preserveAspectRatio(), patternBoundaries.width(), patternBoundaries.height()); // Apply viewBox/objectBoundingBox transformations. if (!viewBoxCTM.isIdentity()) diff --git a/Source/WebCore/rendering/svg/RenderSVGRoot.cpp b/Source/WebCore/rendering/svg/RenderSVGRoot.cpp index aa87b09..3a8dce9 100644 --- a/Source/WebCore/rendering/svg/RenderSVGRoot.cpp +++ b/Source/WebCore/rendering/svg/RenderSVGRoot.cpp @@ -246,7 +246,7 @@ AffineTransform RenderSVGRoot::localToBorderBoxTransform() const float scale = svg->currentScale(); FloatPoint translate = svg->currentTranslate(); AffineTransform ctm(scale, 0, 0, scale, borderAndPadding.width() + translate.x(), borderAndPadding.height() + translate.y()); - return svg->viewBoxToViewTransform(width() / scale, height() / scale) * ctm; + return ctm * svg->viewBoxToViewTransform(width() / scale, height() / scale); } IntSize RenderSVGRoot::parentOriginToBorderBox() const diff --git a/Source/WebCore/rendering/svg/SVGImageBufferTools.cpp b/Source/WebCore/rendering/svg/SVGImageBufferTools.cpp index f0657af..6726694 100644 --- a/Source/WebCore/rendering/svg/SVGImageBufferTools.cpp +++ b/Source/WebCore/rendering/svg/SVGImageBufferTools.cpp @@ -43,7 +43,7 @@ void SVGImageBufferTools::calculateTransformationToOutermostSVGCoordinateSystem( absoluteTransform = currentContentTransformation(); while (current) { - absoluteTransform.multiply(current->localToParentTransform()); + absoluteTransform = current->localToParentTransform() * absoluteTransform; if (current->isSVGRoot()) break; current = current->parent(); @@ -83,7 +83,7 @@ void SVGImageBufferTools::renderSubtreeToImageBuffer(ImageBuffer* image, RenderO AffineTransform& contentTransformation = currentContentTransformation(); AffineTransform savedContentTransformation = contentTransformation; - contentTransformation.multiply(subtreeContentTransformation); + contentTransformation = subtreeContentTransformation * contentTransformation; item->layoutIfNeeded(); item->paint(info, 0, 0); diff --git a/Source/WebCore/rendering/svg/SVGImageBufferTools.h b/Source/WebCore/rendering/svg/SVGImageBufferTools.h index cfb15b2..11577c0 100644 --- a/Source/WebCore/rendering/svg/SVGImageBufferTools.h +++ b/Source/WebCore/rendering/svg/SVGImageBufferTools.h @@ -32,7 +32,8 @@ class FloatSize; class GraphicsContext; class RenderObject; -class SVGImageBufferTools : public Noncopyable { +class SVGImageBufferTools { + WTF_MAKE_NONCOPYABLE(SVGImageBufferTools); public: static bool createImageBuffer(const FloatRect& absoluteTargetRect, const FloatRect& clampedAbsoluteTargetRect, OwnPtr<ImageBuffer>&, ColorSpace); static void renderSubtreeToImageBuffer(ImageBuffer*, RenderObject*, const AffineTransform&); diff --git a/Source/WebCore/rendering/svg/SVGInlineTextBox.cpp b/Source/WebCore/rendering/svg/SVGInlineTextBox.cpp index f370310..2879f20 100644 --- a/Source/WebCore/rendering/svg/SVGInlineTextBox.cpp +++ b/Source/WebCore/rendering/svg/SVGInlineTextBox.cpp @@ -31,6 +31,7 @@ #include "RenderSVGResource.h" #include "RenderSVGResourceSolidColor.h" #include "SVGRootInlineBox.h" +#include "TextRun.h" using namespace std; diff --git a/Source/WebCore/rendering/svg/SVGMarkerLayoutInfo.h b/Source/WebCore/rendering/svg/SVGMarkerLayoutInfo.h index 0eb3689..32317b9 100644 --- a/Source/WebCore/rendering/svg/SVGMarkerLayoutInfo.h +++ b/Source/WebCore/rendering/svg/SVGMarkerLayoutInfo.h @@ -21,6 +21,7 @@ #define SVGMarkerLayoutInfo_h #if ENABLE(SVG) +#include "AffineTransform.h" #include "RenderObject.h" #include "SVGMarkerData.h" #include <wtf/Noncopyable.h> @@ -42,7 +43,8 @@ struct MarkerLayout { AffineTransform matrix; }; -class SVGMarkerLayoutInfo : public Noncopyable { +class SVGMarkerLayoutInfo { + WTF_MAKE_NONCOPYABLE(SVGMarkerLayoutInfo); public: SVGMarkerLayoutInfo(); ~SVGMarkerLayoutInfo(); diff --git a/Source/WebCore/rendering/svg/SVGResources.h b/Source/WebCore/rendering/svg/SVGResources.h index dd328b8..48cca23 100644 --- a/Source/WebCore/rendering/svg/SVGResources.h +++ b/Source/WebCore/rendering/svg/SVGResources.h @@ -38,7 +38,8 @@ class RenderSVGResourceMasker; class SVGRenderStyle; // Holds a set of resources associated with a RenderObject -class SVGResources : public Noncopyable { +class SVGResources { + WTF_MAKE_NONCOPYABLE(SVGResources); WTF_MAKE_FAST_ALLOCATED; public: SVGResources(); diff --git a/Source/WebCore/rendering/svg/SVGResourcesCache.h b/Source/WebCore/rendering/svg/SVGResourcesCache.h index 30eaeca..bc73f4d 100644 --- a/Source/WebCore/rendering/svg/SVGResourcesCache.h +++ b/Source/WebCore/rendering/svg/SVGResourcesCache.h @@ -31,7 +31,8 @@ class RenderStyle; class RenderSVGResourceContainer; class SVGResources; -class SVGResourcesCache : public Noncopyable { +class SVGResourcesCache { + WTF_MAKE_NONCOPYABLE(SVGResourcesCache); WTF_MAKE_FAST_ALLOCATED; public: SVGResourcesCache(); ~SVGResourcesCache(); diff --git a/Source/WebCore/rendering/svg/SVGResourcesCycleSolver.h b/Source/WebCore/rendering/svg/SVGResourcesCycleSolver.h index 0653304..099f91c 100644 --- a/Source/WebCore/rendering/svg/SVGResourcesCycleSolver.h +++ b/Source/WebCore/rendering/svg/SVGResourcesCycleSolver.h @@ -29,7 +29,8 @@ class RenderObject; class RenderSVGResourceContainer; class SVGResources; -class SVGResourcesCycleSolver : public Noncopyable { +class SVGResourcesCycleSolver { + WTF_MAKE_NONCOPYABLE(SVGResourcesCycleSolver); public: SVGResourcesCycleSolver(RenderObject*, SVGResources*); ~SVGResourcesCycleSolver(); diff --git a/Source/WebCore/rendering/svg/SVGTextChunkBuilder.h b/Source/WebCore/rendering/svg/SVGTextChunkBuilder.h index 36342e7..321f391 100644 --- a/Source/WebCore/rendering/svg/SVGTextChunkBuilder.h +++ b/Source/WebCore/rendering/svg/SVGTextChunkBuilder.h @@ -35,7 +35,8 @@ struct SVGTextFragment; // Phase two performed the actual per-character layout, computing the final positions for each character, stored in the SVGInlineTextBox objects (SVGTextFragment). // Phase three performs all modifications that have to be applied to each individual text chunk (text-anchor & textLength). -class SVGTextChunkBuilder : public Noncopyable { +class SVGTextChunkBuilder { + WTF_MAKE_NONCOPYABLE(SVGTextChunkBuilder); public: SVGTextChunkBuilder(); diff --git a/Source/WebCore/rendering/svg/SVGTextLayoutAttributesBuilder.h b/Source/WebCore/rendering/svg/SVGTextLayoutAttributesBuilder.h index f29ac64..c68185b 100644 --- a/Source/WebCore/rendering/svg/SVGTextLayoutAttributesBuilder.h +++ b/Source/WebCore/rendering/svg/SVGTextLayoutAttributesBuilder.h @@ -38,7 +38,8 @@ class RenderSVGText; // to create the InlineBox tree based on text chunk boundaries & BiDi information. // The second layout phase is carried out by SVGTextLayoutEngine. -class SVGTextLayoutAttributesBuilder : public Noncopyable { +class SVGTextLayoutAttributesBuilder { + WTF_MAKE_NONCOPYABLE(SVGTextLayoutAttributesBuilder); public: SVGTextLayoutAttributesBuilder(); void buildLayoutAttributesForTextSubtree(RenderSVGText*); diff --git a/Source/WebCore/rendering/svg/SVGTextLayoutEngine.cpp b/Source/WebCore/rendering/svg/SVGTextLayoutEngine.cpp index 7eefad6..3b28d2b 100644 --- a/Source/WebCore/rendering/svg/SVGTextLayoutEngine.cpp +++ b/Source/WebCore/rendering/svg/SVGTextLayoutEngine.cpp @@ -321,7 +321,7 @@ void SVGTextLayoutEngine::finalizeTransformMatrices(Vector<SVGInlineTextBox*>& b if (transform.isIdentity()) transform = textBoxTransformation; else - transform.multiply(textBoxTransformation); + transform = textBoxTransformation * transform; } } diff --git a/Source/WebCore/rendering/svg/SVGTextLayoutEngine.h b/Source/WebCore/rendering/svg/SVGTextLayoutEngine.h index ad058d8..631e4cd 100644 --- a/Source/WebCore/rendering/svg/SVGTextLayoutEngine.h +++ b/Source/WebCore/rendering/svg/SVGTextLayoutEngine.h @@ -44,7 +44,8 @@ class SVGRenderStyle; // RenderSVGInlineText renderers to compute the final positions for each character // which are stored in the SVGInlineTextBox objects. -class SVGTextLayoutEngine : public Noncopyable { +class SVGTextLayoutEngine { + WTF_MAKE_NONCOPYABLE(SVGTextLayoutEngine); public: SVGTextLayoutEngine(); SVGTextChunkBuilder& chunkLayoutBuilder() { return m_chunkLayoutBuilder; } diff --git a/Source/WebCore/rendering/svg/SVGTextLayoutEngineBaseline.h b/Source/WebCore/rendering/svg/SVGTextLayoutEngineBaseline.h index d753b39..6794bf3 100644 --- a/Source/WebCore/rendering/svg/SVGTextLayoutEngineBaseline.h +++ b/Source/WebCore/rendering/svg/SVGTextLayoutEngineBaseline.h @@ -33,7 +33,8 @@ class SVGRenderStyle; class SVGTextMetrics; // Helper class used by SVGTextLayoutEngine to handle 'alignment-baseline' / 'dominant-baseline' and 'baseline-shift'. -class SVGTextLayoutEngineBaseline : public Noncopyable { +class SVGTextLayoutEngineBaseline { + WTF_MAKE_NONCOPYABLE(SVGTextLayoutEngineBaseline); public: SVGTextLayoutEngineBaseline(const Font&); diff --git a/Source/WebCore/rendering/svg/SVGTextLayoutEngineSpacing.h b/Source/WebCore/rendering/svg/SVGTextLayoutEngineSpacing.h index 0a6d736..71d4707 100644 --- a/Source/WebCore/rendering/svg/SVGTextLayoutEngineSpacing.h +++ b/Source/WebCore/rendering/svg/SVGTextLayoutEngineSpacing.h @@ -30,7 +30,8 @@ class SVGRenderStyle; class SVGElement; // Helper class used by SVGTextLayoutEngine to handle 'kerning' / 'letter-spacing' and 'word-spacing'. -class SVGTextLayoutEngineSpacing : public Noncopyable { +class SVGTextLayoutEngineSpacing { + WTF_MAKE_NONCOPYABLE(SVGTextLayoutEngineSpacing); public: SVGTextLayoutEngineSpacing(const Font&); diff --git a/Source/WebCore/rendering/svg/SVGTextMetrics.cpp b/Source/WebCore/rendering/svg/SVGTextMetrics.cpp index 58d0ad9..ec8c2c6 100644 --- a/Source/WebCore/rendering/svg/SVGTextMetrics.cpp +++ b/Source/WebCore/rendering/svg/SVGTextMetrics.cpp @@ -23,6 +23,7 @@ #include "SVGTextMetrics.h" #include "RenderSVGInlineText.h" +#include "TextRun.h" namespace WebCore { diff --git a/Source/WebCore/storage/DatabaseTask.h b/Source/WebCore/storage/DatabaseTask.h index b61e465..e1df591 100644 --- a/Source/WebCore/storage/DatabaseTask.h +++ b/Source/WebCore/storage/DatabaseTask.h @@ -43,7 +43,8 @@ namespace WebCore { // Can be used to wait until DatabaseTask is completed. // Has to be passed into DatabaseTask::create to be associated with the task. -class DatabaseTaskSynchronizer : public Noncopyable { +class DatabaseTaskSynchronizer { + WTF_MAKE_NONCOPYABLE(DatabaseTaskSynchronizer); public: DatabaseTaskSynchronizer(); @@ -67,7 +68,8 @@ private: #endif }; -class DatabaseTask : public Noncopyable { +class DatabaseTask { + WTF_MAKE_NONCOPYABLE(DatabaseTask); WTF_MAKE_FAST_ALLOCATED; public: virtual ~DatabaseTask(); diff --git a/Source/WebCore/storage/DatabaseTracker.h b/Source/WebCore/storage/DatabaseTracker.h index 7145e6b..a1a5bdf 100644 --- a/Source/WebCore/storage/DatabaseTracker.h +++ b/Source/WebCore/storage/DatabaseTracker.h @@ -56,7 +56,8 @@ class DatabaseTrackerClient; struct SecurityOriginTraits; #endif // !PLATFORM(CHROMIUM) -class DatabaseTracker : public Noncopyable { +class DatabaseTracker { + WTF_MAKE_NONCOPYABLE(DatabaseTracker); WTF_MAKE_FAST_ALLOCATED; public: static void initializeTracker(const String& databasePath); static DatabaseTracker& tracker(); diff --git a/Source/WebCore/storage/IDBDatabase.cpp b/Source/WebCore/storage/IDBDatabase.cpp index 7a9141a..33f004b 100644 --- a/Source/WebCore/storage/IDBDatabase.cpp +++ b/Source/WebCore/storage/IDBDatabase.cpp @@ -73,12 +73,6 @@ PassRefPtr<IDBObjectStore> IDBDatabase::createObjectStore(const String& name, co options.getKeyBool("autoIncrement", autoIncrement); // FIXME: Look up evictable and pass that on as well. - if (autoIncrement) { - // FIXME: Implement support for auto increment. - ec = IDBDatabaseException::UNKNOWN_ERR; - return 0; - } - RefPtr<IDBObjectStoreBackendInterface> objectStore = m_backend->createObjectStore(name, keyPath, autoIncrement, m_setVersionTransaction.get(), ec); if (!objectStore) { ASSERT(ec); diff --git a/Source/WebCore/storage/IDBObjectStoreBackendImpl.cpp b/Source/WebCore/storage/IDBObjectStoreBackendImpl.cpp index 396f544..6b162ef 100644 --- a/Source/WebCore/storage/IDBObjectStoreBackendImpl.cpp +++ b/Source/WebCore/storage/IDBObjectStoreBackendImpl.cpp @@ -59,6 +59,7 @@ IDBObjectStoreBackendImpl::IDBObjectStoreBackendImpl(IDBSQLiteDatabase* database , m_name(name) , m_keyPath(keyPath) , m_autoIncrement(autoIncrement) + , m_autoIncrementNumber(-1) { loadIndexes(); } @@ -69,6 +70,7 @@ IDBObjectStoreBackendImpl::IDBObjectStoreBackendImpl(IDBSQLiteDatabase* database , m_name(name) , m_keyPath(keyPath) , m_autoIncrement(autoIncrement) + , m_autoIncrementNumber(-1) { } @@ -108,12 +110,12 @@ void IDBObjectStoreBackendImpl::getInternal(ScriptExecutionContext*, PassRefPtr< bindWhereClause(query, objectStore->id(), key.get()); if (query.step() != SQLResultRow) { - callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::NOT_FOUND_ERR, "Key does not exist in the object store.")); + callbacks->onSuccess(SerializedScriptValue::undefinedValue()); return; } ASSERT((key->type() == IDBKey::StringType) != query.isColumnNull(0)); - // FIXME: Implement date. + ASSERT((key->type() == IDBKey::DateType) != query.isColumnNull(1)); ASSERT((key->type() == IDBKey::NumberType) != query.isColumnNull(2)); callbacks->onSuccess(SerializedScriptValue::createFromWire(query.getColumnText(3))); @@ -200,22 +202,36 @@ void IDBObjectStoreBackendImpl::putInternal(ScriptExecutionContext*, PassRefPtr< RefPtr<SerializedScriptValue> value = prpValue; RefPtr<IDBKey> key = prpKey; - // FIXME: Support auto-increment. + if (!objectStore->m_keyPath.isNull() && key) { + callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::DATA_ERR, "A key was supplied for an objectStore that has a keyPath.")); + return; + } + + if (objectStore->autoIncrement() && key) { + callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::DATA_ERR, "A key was supplied for an objectStore that is using auto increment.")); + return; + } + + if (objectStore->autoIncrement()) { + key = objectStore->genAutoIncrementKey(); - if (!objectStore->m_keyPath.isNull()) { - if (key) { - callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::UNKNOWN_ERR, "A key was supplied for an objectStore that has a keyPath.")); + if (!objectStore->m_keyPath.isNull()) { + // FIXME: Inject the generated key into the object. + callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::UNKNOWN_ERR, "Adding data to object stores with auto increment and in-line keys not yet supported.")); return; } + } else if (!objectStore->m_keyPath.isNull()) { key = fetchKeyFromKeyPath(value.get(), objectStore->m_keyPath); + if (!key) { - callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::UNKNOWN_ERR, "The key could not be fetched from the keyPath.")); + callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::DATA_ERR, "The key could not be fetched from the keyPath.")); return; } } else if (!key) { callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::DATA_ERR, "No key supplied.")); return; } + if (key->type() == IDBKey::NullType) { callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::DATA_ERR, "NULL key is not allowed.")); return; @@ -511,6 +527,27 @@ void IDBObjectStoreBackendImpl::addIndexToMap(ScriptExecutionContext*, PassRefPt objectStore->m_indexes.set(indexPtr->name(), indexPtr); } +PassRefPtr<IDBKey> IDBObjectStoreBackendImpl::genAutoIncrementKey() +{ + if (m_autoIncrementNumber > 0) + return IDBKey::createNumber(m_autoIncrementNumber++); + + String sql = "SELECT max(keyNumber) + 1 FROM ObjectStoreData WHERE objectStoreId = ? AND keyString IS NULL AND keyDate IS NULL"; + + SQLiteStatement query(sqliteDatabase(), sql); + bool ok = query.prepare() == SQLResultOk; + ASSERT_UNUSED(ok, ok); + + query.bindInt64(1, id()); + + if (query.step() != SQLResultRow || query.isColumnNull(0)) + m_autoIncrementNumber = 1; + else + m_autoIncrementNumber = static_cast<int>(query.getColumnDouble(0)); + + return IDBKey::createNumber(m_autoIncrementNumber++); +} + } // namespace WebCore diff --git a/Source/WebCore/storage/IDBObjectStoreBackendImpl.h b/Source/WebCore/storage/IDBObjectStoreBackendImpl.h index 2ab42f2..9fb1b7c 100644 --- a/Source/WebCore/storage/IDBObjectStoreBackendImpl.h +++ b/Source/WebCore/storage/IDBObjectStoreBackendImpl.h @@ -82,6 +82,7 @@ private: void loadIndexes(); SQLiteDatabase& sqliteDatabase() const; + PassRefPtr<IDBKey> genAutoIncrementKey(); static void getInternal(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl>, PassRefPtr<IDBKey> key, PassRefPtr<IDBCallbacks>); static void putInternal(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl>, PassRefPtr<SerializedScriptValue> value, PassRefPtr<IDBKey> key, bool addOnly, PassRefPtr<IDBCallbacks>, PassRefPtr<IDBTransactionBackendInterface>); @@ -103,6 +104,7 @@ private: typedef HashMap<String, RefPtr<IDBIndexBackendImpl> > IndexMap; IndexMap m_indexes; + int m_autoIncrementNumber; }; } // namespace WebCore diff --git a/Source/WebCore/storage/IDBPendingTransactionMonitor.h b/Source/WebCore/storage/IDBPendingTransactionMonitor.h index 783a731..5bc6acd 100644 --- a/Source/WebCore/storage/IDBPendingTransactionMonitor.h +++ b/Source/WebCore/storage/IDBPendingTransactionMonitor.h @@ -44,7 +44,8 @@ class IDBTransactionBackendInterface; // FIXME: move the vector of transactions to TLS. Keeping it static // will not work once we add support for workers. Another possible // solution is to keep the vector in the ScriptExecutionContext. -class IDBPendingTransactionMonitor : public Noncopyable { +class IDBPendingTransactionMonitor { + WTF_MAKE_NONCOPYABLE(IDBPendingTransactionMonitor); public: static void addPendingTransaction(IDBTransactionBackendInterface*); static void removePendingTransaction(IDBTransactionBackendInterface*); diff --git a/Source/WebCore/storage/LocalStorageTask.h b/Source/WebCore/storage/LocalStorageTask.h index a2e35ea..27a8eb5 100644 --- a/Source/WebCore/storage/LocalStorageTask.h +++ b/Source/WebCore/storage/LocalStorageTask.h @@ -37,7 +37,8 @@ namespace WebCore { class LocalStorageThread; // FIXME: Rename this class to StorageTask - class LocalStorageTask : public Noncopyable { + class LocalStorageTask { + WTF_MAKE_NONCOPYABLE(LocalStorageTask); WTF_MAKE_FAST_ALLOCATED; public: enum Type { AreaImport, AreaSync, DeleteEmptyDatabase, TerminateThread }; diff --git a/Source/WebCore/storage/LocalStorageThread.h b/Source/WebCore/storage/LocalStorageThread.h index 6f05911..a2c78c6 100644 --- a/Source/WebCore/storage/LocalStorageThread.h +++ b/Source/WebCore/storage/LocalStorageThread.h @@ -40,7 +40,8 @@ namespace WebCore { class LocalStorageTask; // FIXME: Rename this class to StorageThread - class LocalStorageThread : public Noncopyable { + class LocalStorageThread { + WTF_MAKE_NONCOPYABLE(LocalStorageThread); WTF_MAKE_FAST_ALLOCATED; public: static PassOwnPtr<LocalStorageThread> create(); ~LocalStorageThread(); diff --git a/Source/WebCore/storage/OriginQuotaManager.h b/Source/WebCore/storage/OriginQuotaManager.h index ec9620c..82d7c74 100644 --- a/Source/WebCore/storage/OriginQuotaManager.h +++ b/Source/WebCore/storage/OriginQuotaManager.h @@ -41,7 +41,8 @@ namespace WebCore { class AbstractDatabase; class OriginUsageRecord; -class OriginQuotaManager : public Noncopyable { +class OriginQuotaManager { + WTF_MAKE_NONCOPYABLE(OriginQuotaManager); WTF_MAKE_FAST_ALLOCATED; public: OriginQuotaManager(); diff --git a/Source/WebCore/storage/OriginUsageRecord.h b/Source/WebCore/storage/OriginUsageRecord.h index a830e68..7557eaa 100644 --- a/Source/WebCore/storage/OriginUsageRecord.h +++ b/Source/WebCore/storage/OriginUsageRecord.h @@ -39,7 +39,8 @@ namespace WebCore { // Objects of this class can be used from multiple threads with external synchronization. // String arguments are also supposed to be deeply copied by the caller when necessary. -class OriginUsageRecord : public Noncopyable { +class OriginUsageRecord { + WTF_MAKE_NONCOPYABLE(OriginUsageRecord); WTF_MAKE_FAST_ALLOCATED; public: OriginUsageRecord(); diff --git a/Source/WebCore/storage/SQLTransactionClient.h b/Source/WebCore/storage/SQLTransactionClient.h index fed0657..3c5ec2d 100644 --- a/Source/WebCore/storage/SQLTransactionClient.h +++ b/Source/WebCore/storage/SQLTransactionClient.h @@ -33,6 +33,7 @@ #if ENABLE(DATABASE) +#include <wtf/FastAllocBase.h> #include <wtf/Noncopyable.h> namespace WebCore { @@ -41,8 +42,10 @@ class AbstractDatabase; // A client to the SQLTransaction class. Allows SQLTransaction to notify interested // parties that certain things have happened in a transaction. -class SQLTransactionClient : public Noncopyable { +class SQLTransactionClient { + WTF_MAKE_NONCOPYABLE(SQLTransactionClient); WTF_MAKE_FAST_ALLOCATED; public: + SQLTransactionClient() { } void didCommitWriteTransaction(AbstractDatabase*); void didExecuteStatement(AbstractDatabase*); bool didExceedQuota(AbstractDatabase*); diff --git a/Source/WebCore/storage/SQLTransactionCoordinator.h b/Source/WebCore/storage/SQLTransactionCoordinator.h index 94360c0..fd76782 100644 --- a/Source/WebCore/storage/SQLTransactionCoordinator.h +++ b/Source/WebCore/storage/SQLTransactionCoordinator.h @@ -43,8 +43,10 @@ namespace WebCore { class SQLTransaction; - class SQLTransactionCoordinator : public Noncopyable { + class SQLTransactionCoordinator { + WTF_MAKE_NONCOPYABLE(SQLTransactionCoordinator); WTF_MAKE_FAST_ALLOCATED; public: + SQLTransactionCoordinator() { } void acquireLock(SQLTransaction*); void releaseLock(SQLTransaction*); void shutdown(); diff --git a/Source/WebCore/storage/chromium/IDBFactoryBackendInterface.cpp b/Source/WebCore/storage/chromium/IDBFactoryBackendInterface.cpp index c0fb444..92e9a7b 100644 --- a/Source/WebCore/storage/chromium/IDBFactoryBackendInterface.cpp +++ b/Source/WebCore/storage/chromium/IDBFactoryBackendInterface.cpp @@ -28,7 +28,7 @@ #include "config.h" #include "IDBFactoryBackendInterface.h" -#include "ChromiumBridge.h" +#include "PlatformBridge.h" #if ENABLE(INDEXED_DATABASE) @@ -36,12 +36,12 @@ namespace WebCore { PassRefPtr<IDBFactoryBackendInterface> IDBFactoryBackendInterface::create() { - return ChromiumBridge::idbFactory(); + return PlatformBridge::idbFactory(); } IDBFactoryBackendInterface::~IDBFactoryBackendInterface() { - ChromiumBridge::idbShutdown(); + PlatformBridge::idbShutdown(); } } // namespace WebCore diff --git a/Source/WebCore/storage/chromium/IDBKeyPathBackendImpl.cpp b/Source/WebCore/storage/chromium/IDBKeyPathBackendImpl.cpp index 0f10875..38b2983 100644 --- a/Source/WebCore/storage/chromium/IDBKeyPathBackendImpl.cpp +++ b/Source/WebCore/storage/chromium/IDBKeyPathBackendImpl.cpp @@ -28,13 +28,13 @@ #if ENABLE(INDEXED_DATABASE) -#include "ChromiumBridge.h" +#include "PlatformBridge.h" namespace WebCore { void IDBKeyPathBackendImpl::createIDBKeysFromSerializedValuesAndKeyPath(const Vector<RefPtr<SerializedScriptValue>, 0>& values, const String& keyPath, Vector<RefPtr<IDBKey>, 0>& keys) { - ChromiumBridge::createIDBKeysFromSerializedValuesAndKeyPath(values, keyPath, keys); + PlatformBridge::createIDBKeysFromSerializedValuesAndKeyPath(values, keyPath, keys); } } // namespace WebCore diff --git a/Source/WebCore/svg/PatternAttributes.h b/Source/WebCore/svg/PatternAttributes.h index 613ab94..28a29c4 100644 --- a/Source/WebCore/svg/PatternAttributes.h +++ b/Source/WebCore/svg/PatternAttributes.h @@ -22,6 +22,7 @@ #if ENABLE(SVG) #include "SVGLength.h" +#include "SVGPreserveAspectRatio.h" namespace WebCore { @@ -33,6 +34,8 @@ struct PatternAttributes { , m_y() , m_width() , m_height() + , m_viewBox() + , m_preserveAspectRatio() , m_boundingBoxMode(true) , m_boundingBoxModeContent(false) , m_patternContentElement(0) @@ -40,6 +43,8 @@ struct PatternAttributes { , m_ySet(false) , m_widthSet(false) , m_heightSet(false) + , m_viewBoxSet(false) + , m_preserveAspectRatioSet(false) , m_boundingBoxModeSet(false) , m_boundingBoxModeContentSet(false) , m_patternTransformSet(false) @@ -51,6 +56,8 @@ struct PatternAttributes { SVGLength y() const { return m_y; } SVGLength width() const { return m_width; } SVGLength height() const { return m_height; } + FloatRect viewBox() const { return m_viewBox; } + SVGPreserveAspectRatio preserveAspectRatio() const { return m_preserveAspectRatio; } bool boundingBoxMode() const { return m_boundingBoxMode; } bool boundingBoxModeContent() const { return m_boundingBoxModeContent; } AffineTransform patternTransform() const { return m_patternTransform; } @@ -79,6 +86,18 @@ struct PatternAttributes { m_height = value; m_heightSet = true; } + + void setViewBox(const FloatRect& value) + { + m_viewBox = value; + m_viewBoxSet = true; + } + + void setPreserveAspectRatio(const SVGPreserveAspectRatio& value) + { + m_preserveAspectRatio = value; + m_preserveAspectRatioSet = true; + } void setBoundingBoxMode(bool value) { @@ -108,6 +127,8 @@ struct PatternAttributes { bool hasY() const { return m_ySet; } bool hasWidth() const { return m_widthSet; } bool hasHeight() const { return m_heightSet; } + bool hasViewBox() const { return m_viewBoxSet; } + bool hasPreserveAspectRatio() const { return m_preserveAspectRatioSet; } bool hasBoundingBoxMode() const { return m_boundingBoxModeSet; } bool hasBoundingBoxModeContent() const { return m_boundingBoxModeContentSet; } bool hasPatternTransform() const { return m_patternTransformSet; } @@ -119,6 +140,8 @@ private: SVGLength m_y; SVGLength m_width; SVGLength m_height; + FloatRect m_viewBox; + SVGPreserveAspectRatio m_preserveAspectRatio; bool m_boundingBoxMode; bool m_boundingBoxModeContent; AffineTransform m_patternTransform; @@ -129,6 +152,8 @@ private: bool m_ySet : 1; bool m_widthSet : 1; bool m_heightSet : 1; + bool m_viewBoxSet : 1; + bool m_preserveAspectRatioSet : 1; bool m_boundingBoxModeSet : 1; bool m_boundingBoxModeContentSet : 1; bool m_patternTransformSet : 1; diff --git a/Source/WebCore/svg/SVGDocumentExtensions.h b/Source/WebCore/svg/SVGDocumentExtensions.h index a0cf2bb..0ed62a9 100644 --- a/Source/WebCore/svg/SVGDocumentExtensions.h +++ b/Source/WebCore/svg/SVGDocumentExtensions.h @@ -38,7 +38,8 @@ class SVGStyledElement; class SVGSMILElement; class SVGSVGElement; -class SVGDocumentExtensions : public Noncopyable { +class SVGDocumentExtensions { + WTF_MAKE_NONCOPYABLE(SVGDocumentExtensions); WTF_MAKE_FAST_ALLOCATED; public: typedef HashSet<RefPtr<SVGStyledElement> > SVGPendingElements; SVGDocumentExtensions(Document*); @@ -68,9 +69,6 @@ private: HashMap<AtomicString, SVGPendingElements*> m_pendingResources; OwnPtr<SVGResourcesCache> m_resourcesCache; - SVGDocumentExtensions(const SVGDocumentExtensions&); - SVGDocumentExtensions& operator=(const SVGDocumentExtensions&); - public: // This HashMap contains a list of pending resources. Pending resources, are such // which are referenced by any object in the SVG document, but do NOT exist yet. diff --git a/Source/WebCore/svg/SVGElementRareData.h b/Source/WebCore/svg/SVGElementRareData.h index 4276c4a..3318dee 100644 --- a/Source/WebCore/svg/SVGElementRareData.h +++ b/Source/WebCore/svg/SVGElementRareData.h @@ -31,7 +31,8 @@ class SVGCursorElement; class SVGElement; class SVGElementInstance; -class SVGElementRareData : public Noncopyable { +class SVGElementRareData { + WTF_MAKE_NONCOPYABLE(SVGElementRareData); WTF_MAKE_FAST_ALLOCATED; public: SVGElementRareData() : m_cursorElement(0) diff --git a/Source/WebCore/svg/SVGFEImageElement.cpp b/Source/WebCore/svg/SVGFEImageElement.cpp index 04ea14c..0fd4763 100644 --- a/Source/WebCore/svg/SVGFEImageElement.cpp +++ b/Source/WebCore/svg/SVGFEImageElement.cpp @@ -29,6 +29,7 @@ #include "CachedResourceLoader.h" #include "ColorSpace.h" #include "Document.h" +#include "Image.h" #include "RenderObject.h" #include "RenderSVGResource.h" #include "SVGImageBufferTools.h" diff --git a/Source/WebCore/svg/SVGFont.cpp b/Source/WebCore/svg/SVGFont.cpp index dd99ac5..e5164c0 100644 --- a/Source/WebCore/svg/SVGFont.cpp +++ b/Source/WebCore/svg/SVGFont.cpp @@ -36,6 +36,7 @@ #include "SVGMissingGlyphElement.h" #include "SVGNames.h" #include "SimpleFontData.h" +#include "TextRun.h" #include "XMLNames.h" using namespace WTF::Unicode; diff --git a/Source/WebCore/svg/SVGFontData.h b/Source/WebCore/svg/SVGFontData.h index e897a59..f202d26 100644 --- a/Source/WebCore/svg/SVGFontData.h +++ b/Source/WebCore/svg/SVGFontData.h @@ -25,7 +25,8 @@ namespace WebCore { -class SVGFontData : public Noncopyable { +class SVGFontData { + WTF_MAKE_NONCOPYABLE(SVGFontData); WTF_MAKE_FAST_ALLOCATED; public: SVGFontData(SVGFontFaceElement*); virtual ~SVGFontData() { } diff --git a/Source/WebCore/svg/SVGLocatable.cpp b/Source/WebCore/svg/SVGLocatable.cpp index 43961d9..2a7c9be 100644 --- a/Source/WebCore/svg/SVGLocatable.cpp +++ b/Source/WebCore/svg/SVGLocatable.cpp @@ -91,7 +91,8 @@ AffineTransform SVGLocatable::computeCTM(const SVGElement* element, CTMScope mod while (current && current->isSVGElement()) { SVGElement* currentElement = static_cast<SVGElement*>(current); if (currentElement->isStyled()) - ctm = static_cast<SVGStyledElement*>(currentElement)->localCoordinateSpaceTransform(mode).multLeft(ctm); + // note that this modifies the AffineTransform returned by localCoordinateSpaceTransform(mode) too. + ctm = static_cast<SVGStyledElement*>(currentElement)->localCoordinateSpaceTransform(mode).multiply(ctm); // For getCTM() computation, stop at the nearest viewport element if (currentElement == stopAtElement) @@ -113,7 +114,7 @@ AffineTransform SVGLocatable::getTransformToElement(SVGElement* target, Exceptio ec = SVGException::SVG_MATRIX_NOT_INVERTABLE; return ctm; } - ctm *= targetCTM.inverse(); + ctm = targetCTM.inverse() * ctm; } return ctm; diff --git a/Source/WebCore/svg/SVGMatrix.h b/Source/WebCore/svg/SVGMatrix.h index 807b703..077eb03 100644 --- a/Source/WebCore/svg/SVGMatrix.h +++ b/Source/WebCore/svg/SVGMatrix.h @@ -96,11 +96,10 @@ public: return static_cast<SVGMatrix>(copy); } - // SVGMatrix::multiply needs to call SVGMatrix::multLeft. SVGMatrix multiply(const SVGMatrix& other) { AffineTransform copy = *this; - copy.multLeft(static_cast<const AffineTransform&>(other)); + copy *= static_cast<const AffineTransform&>(other); return static_cast<SVGMatrix>(copy); } diff --git a/Source/WebCore/svg/SVGPathBlender.h b/Source/WebCore/svg/SVGPathBlender.h index c0ae7f3..8e43b94 100644 --- a/Source/WebCore/svg/SVGPathBlender.h +++ b/Source/WebCore/svg/SVGPathBlender.h @@ -23,11 +23,11 @@ #if ENABLE(SVG) #include "SVGPathConsumer.h" #include "SVGPathSource.h" -#include <wtf/Noncopyable.h> namespace WebCore { -class SVGPathBlender : public Noncopyable { +class SVGPathBlender { + WTF_MAKE_NONCOPYABLE(SVGPathBlender); WTF_MAKE_FAST_ALLOCATED; public: SVGPathBlender(); diff --git a/Source/WebCore/svg/SVGPathByteStream.h b/Source/WebCore/svg/SVGPathByteStream.h index b8882b6..a444ac0 100644 --- a/Source/WebCore/svg/SVGPathByteStream.h +++ b/Source/WebCore/svg/SVGPathByteStream.h @@ -43,7 +43,8 @@ typedef union { unsigned char bytes[sizeof(unsigned short)]; } UnsignedShortByte; -class SVGPathByteStream : public Noncopyable { +class SVGPathByteStream { + WTF_MAKE_NONCOPYABLE(SVGPathByteStream); WTF_MAKE_FAST_ALLOCATED; public: static PassOwnPtr<SVGPathByteStream> create() { diff --git a/Source/WebCore/svg/SVGPathConsumer.h b/Source/WebCore/svg/SVGPathConsumer.h index b7c5e73..af3f79b 100644 --- a/Source/WebCore/svg/SVGPathConsumer.h +++ b/Source/WebCore/svg/SVGPathConsumer.h @@ -26,6 +26,7 @@ #if ENABLE(SVG) #include "FloatPoint.h" +#include <wtf/FastAllocBase.h> #include <wtf/Noncopyable.h> namespace WebCore { @@ -40,8 +41,10 @@ enum PathParsingMode { UnalteredParsing }; -class SVGPathConsumer : public Noncopyable { +class SVGPathConsumer { + WTF_MAKE_NONCOPYABLE(SVGPathConsumer); WTF_MAKE_FAST_ALLOCATED; public: + SVGPathConsumer() { } virtual void incrementPathSegmentCount() = 0; virtual bool continueConsuming() = 0; virtual void cleanup() = 0; diff --git a/Source/WebCore/svg/SVGPathParser.h b/Source/WebCore/svg/SVGPathParser.h index 7679a95..096131c 100644 --- a/Source/WebCore/svg/SVGPathParser.h +++ b/Source/WebCore/svg/SVGPathParser.h @@ -29,12 +29,12 @@ #include "SVGPathConsumer.h" #include "SVGPathSeg.h" #include "SVGPathSource.h" -#include <wtf/Noncopyable.h> #include <wtf/PassOwnPtr.h> namespace WebCore { -class SVGPathParser : public Noncopyable { +class SVGPathParser { + WTF_MAKE_NONCOPYABLE(SVGPathParser); WTF_MAKE_FAST_ALLOCATED; public: SVGPathParser(); diff --git a/Source/WebCore/svg/SVGPathSource.h b/Source/WebCore/svg/SVGPathSource.h index d1a6149..77bf9fa 100644 --- a/Source/WebCore/svg/SVGPathSource.h +++ b/Source/WebCore/svg/SVGPathSource.h @@ -25,8 +25,10 @@ namespace WebCore { -class SVGPathSource : public Noncopyable { +class SVGPathSource { + WTF_MAKE_NONCOPYABLE(SVGPathSource); WTF_MAKE_FAST_ALLOCATED; public: + SVGPathSource() { } virtual ~SVGPathSource() { } virtual bool hasMoreData() const = 0; diff --git a/Source/WebCore/svg/SVGPatternElement.cpp b/Source/WebCore/svg/SVGPatternElement.cpp index 29723e7..60dfeaf 100644 --- a/Source/WebCore/svg/SVGPatternElement.cpp +++ b/Source/WebCore/svg/SVGPatternElement.cpp @@ -228,6 +228,12 @@ void SVGPatternElement::collectPatternAttributes(PatternAttributes& attributes) if (!attributes.hasHeight() && current->hasAttribute(SVGNames::heightAttr)) attributes.setHeight(current->height()); + if (!attributes.hasViewBox() && current->hasAttribute(SVGNames::viewBoxAttr)) + attributes.setViewBox(current->viewBox()); + + if (!attributes.hasPreserveAspectRatio() && current->hasAttribute(SVGNames::preserveAspectRatioAttr)) + attributes.setPreserveAspectRatio(current->preserveAspectRatio()); + if (!attributes.hasBoundingBoxMode() && current->hasAttribute(SVGNames::patternUnitsAttr)) attributes.setBoundingBoxMode(current->patternUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX); diff --git a/Source/WebCore/svg/SVGSVGElement.cpp b/Source/WebCore/svg/SVGSVGElement.cpp index 7e04f5d..483e45f 100644 --- a/Source/WebCore/svg/SVGSVGElement.cpp +++ b/Source/WebCore/svg/SVGSVGElement.cpp @@ -502,7 +502,7 @@ AffineTransform SVGSVGElement::localCoordinateSpaceTransform(SVGLocatable::CTMSc } } - return transform.multLeft(viewBoxTransform); + return transform.multiply(viewBoxTransform); } RenderObject* SVGSVGElement::createRenderer(RenderArena* arena, RenderStyle*) @@ -587,12 +587,11 @@ AffineTransform SVGSVGElement::viewBoxToViewTransform(float viewWidth, float vie viewBoxRect = viewBox(); AffineTransform ctm = SVGFitToViewBox::viewBoxToViewTransform(viewBoxRect, preserveAspectRatio(), viewWidth, viewHeight); + if (useCurrentView() && currentView()) { AffineTransform transform; - if (!currentView()->transform().concatenate(transform)) - return ctm; - - return transform * ctm; + if (currentView()->transform().concatenate(transform)) + ctm *= transform; } return ctm; diff --git a/Source/WebCore/svg/SVGStyledTransformableElement.cpp b/Source/WebCore/svg/SVGStyledTransformableElement.cpp index 2334943..15528e0 100644 --- a/Source/WebCore/svg/SVGStyledTransformableElement.cpp +++ b/Source/WebCore/svg/SVGStyledTransformableElement.cpp @@ -56,7 +56,9 @@ AffineTransform SVGStyledTransformableElement::animatedLocalTransform() const { AffineTransform matrix; transform().concatenate(matrix); - return m_supplementalTransform ? *m_supplementalTransform * matrix : matrix; + if (m_supplementalTransform) + matrix *= *m_supplementalTransform; + return matrix; } AffineTransform* SVGStyledTransformableElement::supplementalTransform() diff --git a/Source/WebCore/svg/SVGTextElement.cpp b/Source/WebCore/svg/SVGTextElement.cpp index 7229824..b6094c9 100644 --- a/Source/WebCore/svg/SVGTextElement.cpp +++ b/Source/WebCore/svg/SVGTextElement.cpp @@ -89,7 +89,9 @@ AffineTransform SVGTextElement::animatedLocalTransform() const { AffineTransform matrix; transform().concatenate(matrix); - return m_supplementalTransform ? *m_supplementalTransform * matrix : matrix; + if (m_supplementalTransform) + matrix *= *m_supplementalTransform; + return matrix; } AffineTransform* SVGTextElement::supplementalTransform() diff --git a/Source/WebCore/svg/SVGTransformList.cpp b/Source/WebCore/svg/SVGTransformList.cpp index 52bfc85..1800b1e 100644 --- a/Source/WebCore/svg/SVGTransformList.cpp +++ b/Source/WebCore/svg/SVGTransformList.cpp @@ -56,7 +56,7 @@ bool SVGTransformList::concatenate(AffineTransform& result) const return false; for (unsigned i = 0; i < size; ++i) - result = at(i).matrix() * result; + result *= at(i).matrix(); return true; } diff --git a/Source/WebCore/svg/SVGUseElement.cpp b/Source/WebCore/svg/SVGUseElement.cpp index 589a560..9f43f82 100644 --- a/Source/WebCore/svg/SVGUseElement.cpp +++ b/Source/WebCore/svg/SVGUseElement.cpp @@ -330,7 +330,7 @@ void SVGUseElement::updateContainerOffsets() void SVGUseElement::recalcStyle(StyleChange change) { // Eventually mark shadow root element needing style recalc - if (needsStyleRecalc() && m_targetElementInstance && !m_updatesBlocked) { + if ((change >= Inherit || needsStyleRecalc() || childNeedsStyleRecalc()) && m_targetElementInstance && !m_updatesBlocked) { if (SVGElement* shadowRoot = m_targetElementInstance->shadowTreeElement()) shadowRoot->setNeedsStyleRecalc(); } diff --git a/Source/WebCore/svg/SVGViewSpec.h b/Source/WebCore/svg/SVGViewSpec.h index 686cec3..cd10ca4 100644 --- a/Source/WebCore/svg/SVGViewSpec.h +++ b/Source/WebCore/svg/SVGViewSpec.h @@ -32,8 +32,8 @@ namespace WebCore { class SVGElement; class SVGViewSpec : public SVGFitToViewBox, - public SVGZoomAndPan, - public Noncopyable { + public SVGZoomAndPan { + WTF_MAKE_NONCOPYABLE(SVGViewSpec); public: SVGViewSpec(SVGElement*); diff --git a/Source/WebCore/svg/graphics/SVGImage.cpp b/Source/WebCore/svg/graphics/SVGImage.cpp index 97f86be..fc2fd08 100644 --- a/Source/WebCore/svg/graphics/SVGImage.cpp +++ b/Source/WebCore/svg/graphics/SVGImage.cpp @@ -55,7 +55,8 @@ namespace WebCore { -class SVGImageChromeClient : public EmptyChromeClient, public Noncopyable { +class SVGImageChromeClient : public EmptyChromeClient { + WTF_MAKE_NONCOPYABLE(SVGImageChromeClient); WTF_MAKE_FAST_ALLOCATED; public: SVGImageChromeClient(SVGImage* image) : m_image(image) diff --git a/Source/WebCore/thirdparty/glu/README.webkit b/Source/WebCore/thirdparty/glu/README.webkit index 3fcac84..57c4772 100644 --- a/Source/WebCore/thirdparty/glu/README.webkit +++ b/Source/WebCore/thirdparty/glu/README.webkit @@ -31,3 +31,12 @@ The following changes were made in order to incorporate this code: of the unused Normalize function. - In priorityq-heap.c, an #include of <limits.h> was added. + + - In sweep.c, IsWindingInside() was given a return value to silence a + warning-as-error in release builds. + + - In sweep.c, DoneEdgeDict()'s fixedEdges was wrapped in #indef NDEBUG, to + silence a warning-as-error in release builds. + + - In priorityq.c, render.c, and others: the construct "if(1)...else" was + replaced with "do{...}while(1)" to silence a warning-as-error in Mac builds. diff --git a/Source/WebCore/thirdparty/glu/gluos.h b/Source/WebCore/thirdparty/glu/gluos.h index 600dc0b..6380cb2 100644 --- a/Source/WebCore/thirdparty/glu/gluos.h +++ b/Source/WebCore/thirdparty/glu/gluos.h @@ -42,4 +42,7 @@ typedef unsigned int GLenum; typedef float GLfloat; typedef void GLvoid; +#undef MIN +#undef MAX + #endif // GLUOS_H_ diff --git a/Source/WebCore/thirdparty/glu/libtess/geom.c b/Source/WebCore/thirdparty/glu/libtess/geom.c index 2db2699..ce578dd 100644 --- a/Source/WebCore/thirdparty/glu/libtess/geom.c +++ b/Source/WebCore/thirdparty/glu/libtess/geom.c @@ -205,7 +205,7 @@ printf("*********************%d\n",RandomInterpolate); #endif -#define Swap(a,b) if (1) { GLUvertex *t = a; a = b; b = t; } else +#define Swap(a,b) do { GLUvertex *t = a; a = b; b = t; } while(0) void __gl_edgeIntersect( GLUvertex *o1, GLUvertex *d1, GLUvertex *o2, GLUvertex *d2, diff --git a/Source/WebCore/thirdparty/glu/libtess/priorityq.c b/Source/WebCore/thirdparty/glu/libtess/priorityq.c index 4b0bea1..6614db0 100644 --- a/Source/WebCore/thirdparty/glu/libtess/priorityq.c +++ b/Source/WebCore/thirdparty/glu/libtess/priorityq.c @@ -92,7 +92,7 @@ void pqDeletePriorityQ( PriorityQ *pq ) #define LT(x,y) (! LEQ(y,x)) #define GT(x,y) (! LEQ(x,y)) -#define Swap(a,b) if(1){PQkey *tmp = *a; *a = *b; *b = tmp;}else +#define Swap(a,b) do{PQkey *tmp = *a; *a = *b; *b = tmp;}while(0) /* really __gl_pqSortInit */ int pqInit( PriorityQ *pq ) diff --git a/Source/WebCore/thirdparty/glu/libtess/render.c b/Source/WebCore/thirdparty/glu/libtess/render.c index 0e944a2..79386e8 100644 --- a/Source/WebCore/thirdparty/glu/libtess/render.c +++ b/Source/WebCore/thirdparty/glu/libtess/render.c @@ -150,11 +150,11 @@ static void RenderMaximumFaceGroup( GLUtesselator *tess, GLUface *fOrig ) #define AddToTrail(f,t) ((f)->trail = (t), (t) = (f), (f)->marked = TRUE) -#define FreeTrail(t) if( 1 ) { \ +#define FreeTrail(t) do { \ while( (t) != NULL ) { \ (t)->marked = FALSE; t = (t)->trail; \ } \ - } else /* absorb trailing semicolon */ + } while(0) /* absorb trailing semicolon */ diff --git a/Source/WebCore/thirdparty/glu/libtess/sweep.c b/Source/WebCore/thirdparty/glu/libtess/sweep.c index e85757c..233b2da 100644 --- a/Source/WebCore/thirdparty/glu/libtess/sweep.c +++ b/Source/WebCore/thirdparty/glu/libtess/sweep.c @@ -253,6 +253,7 @@ static GLboolean IsWindingInside( GLUtesselator *tess, int n ) /*LINTED*/ assert( FALSE ); /*NOTREACHED*/ + return 0; } @@ -1173,7 +1174,9 @@ static void InitEdgeDict( GLUtesselator *tess ) static void DoneEdgeDict( GLUtesselator *tess ) { ActiveRegion *reg; +#ifndef NDEBUG int fixedEdges = 0; +#endif /* __GL_DICTLISTKEY */ /* __GL_DICTLISTMIN */ while( (reg = (ActiveRegion *)dictKey( dictMin( tess->dict ))) != NULL ) { diff --git a/Source/WebCore/webaudio/RealtimeAnalyser.h b/Source/WebCore/webaudio/RealtimeAnalyser.h index 686c17c..c6ec2c0 100644 --- a/Source/WebCore/webaudio/RealtimeAnalyser.h +++ b/Source/WebCore/webaudio/RealtimeAnalyser.h @@ -26,7 +26,7 @@ #define RealtimeAnalyser_h #include "AudioArray.h" -#include <wtf/NonCopyable.h> +#include <wtf/Noncopyable.h> #include <wtf/OwnPtr.h> namespace WebCore { @@ -39,7 +39,8 @@ class Float32Array; class Uint8Array; #endif -class RealtimeAnalyser : public Noncopyable { +class RealtimeAnalyser { + WTF_MAKE_NONCOPYABLE(RealtimeAnalyser); public: RealtimeAnalyser(); virtual ~RealtimeAnalyser(); diff --git a/Source/WebCore/websockets/ThreadableWebSocketChannel.h b/Source/WebCore/websockets/ThreadableWebSocketChannel.h index 05b3767..956e0fe 100644 --- a/Source/WebCore/websockets/ThreadableWebSocketChannel.h +++ b/Source/WebCore/websockets/ThreadableWebSocketChannel.h @@ -43,8 +43,10 @@ class KURL; class ScriptExecutionContext; class WebSocketChannelClient; -class ThreadableWebSocketChannel : public Noncopyable { +class ThreadableWebSocketChannel { + WTF_MAKE_NONCOPYABLE(ThreadableWebSocketChannel); public: + ThreadableWebSocketChannel() { } static PassRefPtr<ThreadableWebSocketChannel> create(ScriptExecutionContext*, WebSocketChannelClient*, const KURL&, const String& protocol); virtual void connect() = 0; diff --git a/Source/WebCore/websockets/WebSocket.cpp b/Source/WebCore/websockets/WebSocket.cpp index 358a742..e15d079 100644 --- a/Source/WebCore/websockets/WebSocket.cpp +++ b/Source/WebCore/websockets/WebSocket.cpp @@ -41,6 +41,7 @@ #include "EventNames.h" #include "Logging.h" #include "MessageEvent.h" +#include "ScriptCallStack.h" #include "ScriptExecutionContext.h" #include "ThreadableWebSocketChannel.h" #include "WebSocketChannel.h" @@ -116,32 +117,32 @@ void WebSocket::connect(const KURL& url, const String& protocol, ExceptionCode& m_protocol = protocol; if (!m_url.isValid()) { - scriptExecutionContext()->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, "Invalid url for WebSocket " + url.string(), 0, scriptExecutionContext()->securityOrigin()->toString()); + scriptExecutionContext()->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, "Invalid url for WebSocket " + url.string(), 0, scriptExecutionContext()->securityOrigin()->toString(), 0); m_state = CLOSED; ec = SYNTAX_ERR; return; } if (!m_url.protocolIs("ws") && !m_url.protocolIs("wss")) { - scriptExecutionContext()->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, "Wrong url scheme for WebSocket " + url.string(), 0, scriptExecutionContext()->securityOrigin()->toString()); + scriptExecutionContext()->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, "Wrong url scheme for WebSocket " + url.string(), 0, scriptExecutionContext()->securityOrigin()->toString(), 0); m_state = CLOSED; ec = SYNTAX_ERR; return; } if (m_url.hasFragmentIdentifier()) { - scriptExecutionContext()->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, "URL has fragment component " + url.string(), 0, scriptExecutionContext()->securityOrigin()->toString()); + scriptExecutionContext()->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, "URL has fragment component " + url.string(), 0, scriptExecutionContext()->securityOrigin()->toString(), 0); m_state = CLOSED; ec = SYNTAX_ERR; return; } if (!isValidProtocolString(m_protocol)) { - scriptExecutionContext()->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, "Wrong protocol for WebSocket '" + encodeProtocolString(m_protocol) + "'", 0, scriptExecutionContext()->securityOrigin()->toString()); + scriptExecutionContext()->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, "Wrong protocol for WebSocket '" + encodeProtocolString(m_protocol) + "'", 0, scriptExecutionContext()->securityOrigin()->toString(), 0); m_state = CLOSED; ec = SYNTAX_ERR; return; } if (!portAllowed(url)) { - scriptExecutionContext()->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, makeString("WebSocket port ", String::number(url.port()), " blocked"), 0, scriptExecutionContext()->securityOrigin()->toString()); + scriptExecutionContext()->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, makeString("WebSocket port ", String::number(url.port()), " blocked"), 0, scriptExecutionContext()->securityOrigin()->toString(), 0); m_state = CLOSED; ec = SECURITY_ERR; return; diff --git a/Source/WebCore/websockets/WebSocketChannel.cpp b/Source/WebCore/websockets/WebSocketChannel.cpp index 09fcd6b..c4cb2e2 100644 --- a/Source/WebCore/websockets/WebSocketChannel.cpp +++ b/Source/WebCore/websockets/WebSocketChannel.cpp @@ -41,6 +41,7 @@ #include "Page.h" #include "PlatformString.h" #include "ProgressTracker.h" +#include "ScriptCallStack.h" #include "ScriptExecutionContext.h" #include "SocketStreamError.h" #include "SocketStreamHandle.h" @@ -155,7 +156,7 @@ void WebSocketChannel::didOpen(SocketStreamHandle* handle) InspectorInstrumentation::willSendWebSocketHandshakeRequest(m_context, m_identifier, m_handshake.clientHandshakeRequest()); CString handshakeMessage = m_handshake.clientHandshakeMessage(); if (!handle->send(handshakeMessage.data(), handshakeMessage.length())) { - m_context->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, "Error sending handshake message.", 0, m_handshake.clientOrigin()); + m_context->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, "Error sending handshake message.", 0, m_handshake.clientOrigin(), 0); handle->close(); } } @@ -218,7 +219,7 @@ void WebSocketChannel::didFail(SocketStreamHandle* handle, const SocketStreamErr message = makeString("WebSocket network error: error code ", String::number(error.errorCode())); else message = makeString("WebSocket network error: ", error.localizedDescription()); - m_context->addMessage(OtherMessageSource, NetworkErrorMessageType, ErrorMessageLevel, message, 0, error.failingURL()); + m_context->addMessage(OtherMessageSource, NetworkErrorMessageType, ErrorMessageLevel, message, 0, error.failingURL(), 0); } m_shouldDiscardReceivedData = true; handle->close(); @@ -249,7 +250,7 @@ bool WebSocketChannel::appendToBuffer(const char* data, size_t len) m_bufferSize = newBufferSize; return true; } - m_context->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, makeString("WebSocket frame (at ", String::number(static_cast<unsigned long>(newBufferSize)), " bytes) is too long."), 0, m_handshake.clientOrigin()); + m_context->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, makeString("WebSocket frame (at ", String::number(static_cast<unsigned long>(newBufferSize)), " bytes) is too long."), 0, m_handshake.clientOrigin(), 0); return false; } diff --git a/Source/WebCore/websockets/WebSocketChannel.h b/Source/WebCore/websockets/WebSocketChannel.h index 9c52377..a39cd0e 100644 --- a/Source/WebCore/websockets/WebSocketChannel.h +++ b/Source/WebCore/websockets/WebSocketChannel.h @@ -49,6 +49,7 @@ namespace WebCore { class WebSocketChannelClient; class WebSocketChannel : public RefCounted<WebSocketChannel>, public SocketStreamHandleClient, public ThreadableWebSocketChannel { + WTF_MAKE_FAST_ALLOCATED; public: static PassRefPtr<WebSocketChannel> create(ScriptExecutionContext* context, WebSocketChannelClient* client, const KURL& url, const String& protocol) { return adoptRef(new WebSocketChannel(context, client, url, protocol)); } virtual ~WebSocketChannel(); diff --git a/Source/WebCore/websockets/WebSocketHandshake.cpp b/Source/WebCore/websockets/WebSocketHandshake.cpp index 9506ad4..f653415 100644 --- a/Source/WebCore/websockets/WebSocketHandshake.cpp +++ b/Source/WebCore/websockets/WebSocketHandshake.cpp @@ -42,6 +42,7 @@ #include "HTTPHeaderMap.h" #include "KURL.h" #include "Logging.h" +#include "ScriptCallStack.h" #include "ScriptExecutionContext.h" #include "SecurityOrigin.h" @@ -320,7 +321,7 @@ int WebSocketHandshake::readServerHandshake(const char* header, size_t len) m_response.setStatusText(statusText); if (statusCode != 101) { m_mode = Failed; - m_context->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, makeString("Unexpected response code: ", String::number(statusCode)), 0, clientOrigin()); + m_context->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, makeString("Unexpected response code: ", String::number(statusCode)), 0, clientOrigin(), 0); return len; } m_mode = Normal; @@ -450,7 +451,7 @@ int WebSocketHandshake::readStatusLine(const char* header, size_t headerLength, // The caller isn't prepared to deal with null bytes in status // line. WebSockets specification doesn't prohibit this, but HTTP // does, so we'll just treat this as an error. - m_context->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, "Status line contains embedded null", 0, clientOrigin()); + m_context->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, "Status line contains embedded null", 0, clientOrigin(), 0); return p + 1 - header; } else if (*p == '\n') break; @@ -460,19 +461,19 @@ int WebSocketHandshake::readStatusLine(const char* header, size_t headerLength, const char* end = p + 1; if (end - header > maximumLength) { - m_context->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, "Status line is too long", 0, clientOrigin()); + m_context->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, "Status line is too long", 0, clientOrigin(), 0); return maximumLength; } int lineLength = end - header; if (!space1 || !space2) { - m_context->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, "No response code found: " + trimConsoleMessage(header, lineLength - 1), 0, clientOrigin()); + m_context->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, "No response code found: " + trimConsoleMessage(header, lineLength - 1), 0, clientOrigin(), 0); return lineLength; } // The line must end with "\r\n". if (*(end - 2) != '\r') { - m_context->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, "Status line does not end with CRLF", 0, clientOrigin()); + m_context->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, "Status line does not end with CRLF", 0, clientOrigin(), 0); return lineLength; } @@ -481,7 +482,7 @@ int WebSocketHandshake::readStatusLine(const char* header, size_t headerLength, return lineLength; for (int i = 0; i < 3; ++i) if (statusCodeString[i] < '0' || statusCodeString[i] > '9') { - m_context->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, "Invalid status code: " + statusCodeString, 0, clientOrigin()); + m_context->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, "Invalid status code: " + statusCodeString, 0, clientOrigin(), 0); return lineLength; } @@ -509,13 +510,13 @@ const char* WebSocketHandshake::readHTTPHeaders(const char* start, const char* e if (name.isEmpty()) { if (p + 1 < end && *(p + 1) == '\n') return p + 2; - m_context->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, "CR doesn't follow LF at " + trimConsoleMessage(p, end - p), 0, clientOrigin()); + m_context->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, "CR doesn't follow LF at " + trimConsoleMessage(p, end - p), 0, clientOrigin(), 0); return 0; } - m_context->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, "Unexpected CR in name at " + trimConsoleMessage(name.data(), name.size()), 0, clientOrigin()); + m_context->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, "Unexpected CR in name at " + trimConsoleMessage(name.data(), name.size()), 0, clientOrigin(), 0); return 0; case '\n': - m_context->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, "Unexpected LF in name at " + trimConsoleMessage(name.data(), name.size()), 0, clientOrigin()); + m_context->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, "Unexpected LF in name at " + trimConsoleMessage(name.data(), name.size()), 0, clientOrigin(), 0); return 0; case ':': break; @@ -536,7 +537,7 @@ const char* WebSocketHandshake::readHTTPHeaders(const char* start, const char* e case '\r': break; case '\n': - m_context->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, "Unexpected LF in value at " + trimConsoleMessage(value.data(), value.size()), 0, clientOrigin()); + m_context->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, "Unexpected LF in value at " + trimConsoleMessage(value.data(), value.size()), 0, clientOrigin(), 0); return 0; default: value.append(*p); @@ -547,17 +548,17 @@ const char* WebSocketHandshake::readHTTPHeaders(const char* start, const char* e } } if (p >= end || *p != '\n') { - m_context->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, "CR doesn't follow LF after value at " + trimConsoleMessage(p, end - p), 0, clientOrigin()); + m_context->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, "CR doesn't follow LF after value at " + trimConsoleMessage(p, end - p), 0, clientOrigin(), 0); return 0; } AtomicString nameStr(String::fromUTF8(name.data(), name.size())); String valueStr = String::fromUTF8(value.data(), value.size()); if (nameStr.isNull()) { - m_context->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, "invalid UTF-8 sequence in header name", 0, clientOrigin()); + m_context->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, "invalid UTF-8 sequence in header name", 0, clientOrigin(), 0); return 0; } if (valueStr.isNull()) { - m_context->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, "invalid UTF-8 sequence in header value", 0, clientOrigin()); + m_context->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, "invalid UTF-8 sequence in header value", 0, clientOrigin(), 0); return 0; } LOG(Network, "name=%s value=%s", nameStr.string().utf8().data(), valueStr.utf8().data()); @@ -581,24 +582,24 @@ void WebSocketHandshake::processHeaders() bool WebSocketHandshake::checkResponseHeaders() { if (m_wsOrigin.isNull()) { - m_context->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, "Error during WebSocket handshake: 'sec-websocket-origin' header is missing", 0, clientOrigin()); + m_context->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, "Error during WebSocket handshake: 'sec-websocket-origin' header is missing", 0, clientOrigin(), 0); return false; } if (m_wsLocation.isNull()) { - m_context->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, "Error during WebSocket handshake: 'sec-websocket-location' header is missing", 0, clientOrigin()); + m_context->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, "Error during WebSocket handshake: 'sec-websocket-location' header is missing", 0, clientOrigin(), 0); return false; } if (clientOrigin() != m_wsOrigin) { - m_context->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, "Error during WebSocket handshake: origin mismatch: " + clientOrigin() + " != " + m_wsOrigin, 0, clientOrigin()); + m_context->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, "Error during WebSocket handshake: origin mismatch: " + clientOrigin() + " != " + m_wsOrigin, 0, clientOrigin(), 0); return false; } if (clientLocation() != m_wsLocation) { - m_context->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, "Error during WebSocket handshake: location mismatch: " + clientLocation() + " != " + m_wsLocation, 0, clientOrigin()); + m_context->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, "Error during WebSocket handshake: location mismatch: " + clientLocation() + " != " + m_wsLocation, 0, clientOrigin(), 0); return false; } if (!m_clientProtocol.isEmpty() && m_clientProtocol != m_wsProtocol) { - m_context->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, "Error during WebSocket handshake: protocol mismatch: " + m_clientProtocol + " != " + m_wsProtocol, 0, clientOrigin()); + m_context->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, "Error during WebSocket handshake: protocol mismatch: " + m_clientProtocol + " != " + m_wsProtocol, 0, clientOrigin(), 0); return false; } return true; diff --git a/Source/WebCore/websockets/WebSocketHandshake.h b/Source/WebCore/websockets/WebSocketHandshake.h index a5b4260..371d852 100644 --- a/Source/WebCore/websockets/WebSocketHandshake.h +++ b/Source/WebCore/websockets/WebSocketHandshake.h @@ -37,13 +37,13 @@ #include "PlatformString.h" #include "WebSocketHandshakeRequest.h" #include "WebSocketHandshakeResponse.h" -#include <wtf/Noncopyable.h> namespace WebCore { class ScriptExecutionContext; - class WebSocketHandshake : public Noncopyable { + class WebSocketHandshake { + WTF_MAKE_NONCOPYABLE(WebSocketHandshake); public: enum Mode { Incomplete, Normal, Failed, Connected diff --git a/Source/WebCore/websockets/WorkerThreadableWebSocketChannel.h b/Source/WebCore/websockets/WorkerThreadableWebSocketChannel.h index 366e4fa..9f0b01a 100644 --- a/Source/WebCore/websockets/WorkerThreadableWebSocketChannel.h +++ b/Source/WebCore/websockets/WorkerThreadableWebSocketChannel.h @@ -52,6 +52,7 @@ class WorkerLoaderProxy; class WorkerRunLoop; class WorkerThreadableWebSocketChannel : public RefCounted<WorkerThreadableWebSocketChannel>, public ThreadableWebSocketChannel { + WTF_MAKE_FAST_ALLOCATED; public: static PassRefPtr<ThreadableWebSocketChannel> create(WorkerContext* workerContext, WebSocketChannelClient* client, const String& taskMode, const KURL& url, const String& protocol) { @@ -77,7 +78,8 @@ protected: private: // Generated by the bridge. The Peer and its bridge should have identical // lifetimes. - class Peer : public WebSocketChannelClient, public Noncopyable { + class Peer : public WebSocketChannelClient { + WTF_MAKE_NONCOPYABLE(Peer); WTF_MAKE_FAST_ALLOCATED; public: static Peer* create(RefPtr<ThreadableWebSocketChannelClientWrapper> clientWrapper, WorkerLoaderProxy& loaderProxy, ScriptExecutionContext* context, const String& taskMode, const KURL& url, const String& protocol) { diff --git a/Source/WebCore/workers/DefaultSharedWorkerRepository.cpp b/Source/WebCore/workers/DefaultSharedWorkerRepository.cpp index 3a14b62..c20cd30 100644 --- a/Source/WebCore/workers/DefaultSharedWorkerRepository.cpp +++ b/Source/WebCore/workers/DefaultSharedWorkerRepository.cpp @@ -42,6 +42,7 @@ #include "MessagePort.h" #include "NotImplemented.h" #include "PlatformString.h" +#include "ScriptCallStack.h" #include "SecurityOrigin.h" #include "SecurityOriginHash.h" #include "SharedWorker.h" @@ -155,7 +156,7 @@ void SharedWorkerProxy::postTaskForModeToWorkerContext(PassOwnPtr<ScriptExecutio static void postExceptionTask(ScriptExecutionContext* context, const String& errorMessage, int lineNumber, const String& sourceURL) { - context->reportException(errorMessage, lineNumber, sourceURL); + context->reportException(errorMessage, lineNumber, sourceURL, 0); } void SharedWorkerProxy::postExceptionToWorkerObject(const String& errorMessage, int lineNumber, const String& sourceURL) @@ -167,7 +168,7 @@ void SharedWorkerProxy::postExceptionToWorkerObject(const String& errorMessage, static void postConsoleMessageTask(ScriptExecutionContext* document, MessageSource source, MessageType type, MessageLevel level, const String& message, unsigned lineNumber, const String& sourceURL) { - document->addMessage(source, type, level, message, lineNumber, sourceURL); + document->addMessage(source, type, level, message, lineNumber, sourceURL, 0); } void SharedWorkerProxy::postConsoleMessageToWorkerObject(MessageSource source, MessageType type, MessageLevel level, const String& message, int lineNumber, const String& sourceURL) diff --git a/Source/WebCore/workers/DefaultSharedWorkerRepository.h b/Source/WebCore/workers/DefaultSharedWorkerRepository.h index 21e14a1..435b613 100644 --- a/Source/WebCore/workers/DefaultSharedWorkerRepository.h +++ b/Source/WebCore/workers/DefaultSharedWorkerRepository.h @@ -53,7 +53,8 @@ namespace WebCore { class SharedWorkerProxy; // Platform-specific implementation of the SharedWorkerRepository static interface. - class DefaultSharedWorkerRepository : public Noncopyable { + class DefaultSharedWorkerRepository { + WTF_MAKE_NONCOPYABLE(DefaultSharedWorkerRepository); WTF_MAKE_FAST_ALLOCATED; public: // Invoked once the worker script has been loaded to fire up the worker thread. void workerScriptLoaded(SharedWorkerProxy&, const String& userAgent, const String& workerScript, PassOwnPtr<MessagePortChannel>); diff --git a/Source/WebCore/workers/WorkerContext.cpp b/Source/WebCore/workers/WorkerContext.cpp index d5d1ccc..36c4215 100644 --- a/Source/WebCore/workers/WorkerContext.cpp +++ b/Source/WebCore/workers/WorkerContext.cpp @@ -47,6 +47,7 @@ #include "KURL.h" #include "MessagePort.h" #include "NotImplemented.h" +#include "ScriptCallStack.h" #include "ScriptSourceCode.h" #include "ScriptValue.h" #include "SecurityOrigin.h" @@ -103,7 +104,6 @@ WorkerContext::WorkerContext(const KURL& url, const String& userAgent, WorkerThr , m_script(new WorkerScriptController(this)) , m_thread(thread) , m_closing(false) - , m_reportingException(false) { setSecurityOrigin(SecurityOrigin::create(url)); } @@ -257,23 +257,17 @@ void WorkerContext::importScripts(const Vector<String>& urls, ExceptionCode& ec) } } -void WorkerContext::reportException(const String& errorMessage, int lineNumber, const String& sourceURL) +EventTarget* WorkerContext::errorEventTarget() { - bool errorHandled = false; - if (!m_reportingException) { - if (onerror()) { - m_reportingException = true; - RefPtr<ErrorEvent> errorEvent(ErrorEvent::create(errorMessage, sourceURL, lineNumber)); - onerror()->handleEvent(this, errorEvent.get()); - errorHandled = errorEvent->defaultPrevented(); - m_reportingException = false; - } - } - if (!errorHandled) - thread()->workerReportingProxy().postExceptionToWorkerObject(errorMessage, lineNumber, sourceURL); + return this; +} + +void WorkerContext::logExceptionToConsole(const String& errorMessage, int lineNumber, const String& sourceURL, PassRefPtr<ScriptCallStack>) +{ + thread()->workerReportingProxy().postExceptionToWorkerObject(errorMessage, lineNumber, sourceURL); } -void WorkerContext::addMessage(MessageSource source, MessageType type, MessageLevel level, const String& message, unsigned lineNumber, const String& sourceURL) +void WorkerContext::addMessage(MessageSource source, MessageType type, MessageLevel level, const String& message, unsigned lineNumber, const String& sourceURL, PassRefPtr<ScriptCallStack>) { thread()->workerReportingProxy().postConsoleMessageToWorkerObject(source, type, level, message, lineNumber, sourceURL); } diff --git a/Source/WebCore/workers/WorkerContext.h b/Source/WebCore/workers/WorkerContext.h index a0dbaae..2e802f2 100644 --- a/Source/WebCore/workers/WorkerContext.h +++ b/Source/WebCore/workers/WorkerContext.h @@ -101,8 +101,7 @@ namespace WebCore { void clearInterval(int timeoutId); // ScriptExecutionContext - virtual void reportException(const String& errorMessage, int lineNumber, const String& sourceURL); - virtual void addMessage(MessageSource, MessageType, MessageLevel, const String& message, unsigned lineNumber, const String& sourceURL); + virtual void addMessage(MessageSource, MessageType, MessageLevel, const String& message, unsigned lineNumber, const String& sourceURL, PassRefPtr<ScriptCallStack>); #if ENABLE(NOTIFICATIONS) NotificationCenter* webkitNotifications() const; @@ -145,7 +144,8 @@ namespace WebCore { bool isClosing() { return m_closing; } // An observer interface to be notified when the worker thread is getting stopped. - class Observer : public Noncopyable { + class Observer { + WTF_MAKE_NONCOPYABLE(Observer); public: Observer(WorkerContext*); virtual ~Observer(); @@ -174,6 +174,9 @@ namespace WebCore { virtual const KURL& virtualURL() const; virtual KURL virtualCompleteURL(const String&) const; + virtual EventTarget* errorEventTarget(); + virtual void logExceptionToConsole(const String& errorMessage, int lineNumber, const String& sourceURL, PassRefPtr<ScriptCallStack>); + KURL m_url; String m_userAgent; @@ -190,7 +193,6 @@ namespace WebCore { mutable RefPtr<DOMURL> m_domURL; #endif bool m_closing; - bool m_reportingException; EventTargetData m_eventTargetData; HashSet<Observer*> m_workerObservers; diff --git a/Source/WebCore/workers/WorkerMessagingProxy.cpp b/Source/WebCore/workers/WorkerMessagingProxy.cpp index e89ccb4..eca8e2e 100644 --- a/Source/WebCore/workers/WorkerMessagingProxy.cpp +++ b/Source/WebCore/workers/WorkerMessagingProxy.cpp @@ -39,6 +39,7 @@ #include "ErrorEvent.h" #include "ExceptionCode.h" #include "MessageEvent.h" +#include "ScriptCallStack.h" #include "ScriptExecutionContext.h" #include "Worker.h" @@ -130,7 +131,7 @@ private: bool errorHandled = !workerObject->dispatchEvent(ErrorEvent::create(m_errorMessage, m_sourceURL, m_lineNumber)); if (!errorHandled) - context->reportException(m_errorMessage, m_lineNumber, m_sourceURL); + context->reportException(m_errorMessage, m_lineNumber, m_sourceURL, 0); } String m_errorMessage; @@ -282,7 +283,7 @@ static void postConsoleMessageTask(ScriptExecutionContext* context, WorkerMessag { if (messagingProxy->askedToTerminate()) return; - context->addMessage(source, type, level, message, lineNumber, sourceURL); + context->addMessage(source, type, level, message, lineNumber, sourceURL, 0); } void WorkerMessagingProxy::postConsoleMessageToWorkerObject(MessageSource source, MessageType type, MessageLevel level, const String& message, int lineNumber, const String& sourceURL) diff --git a/Source/WebCore/workers/WorkerMessagingProxy.h b/Source/WebCore/workers/WorkerMessagingProxy.h index 33937ce..ab6113a 100644 --- a/Source/WebCore/workers/WorkerMessagingProxy.h +++ b/Source/WebCore/workers/WorkerMessagingProxy.h @@ -46,7 +46,8 @@ namespace WebCore { class ScriptExecutionContext; class Worker; - class WorkerMessagingProxy : public WorkerContextProxy, public WorkerObjectProxy, public WorkerLoaderProxy, public Noncopyable { + class WorkerMessagingProxy : public WorkerContextProxy, public WorkerObjectProxy, public WorkerLoaderProxy { + WTF_MAKE_NONCOPYABLE(WorkerMessagingProxy); WTF_MAKE_FAST_ALLOCATED; public: WorkerMessagingProxy(Worker*); diff --git a/Source/WebCore/workers/WorkerRunLoop.cpp b/Source/WebCore/workers/WorkerRunLoop.cpp index 83f243f..7b3149c 100644 --- a/Source/WebCore/workers/WorkerRunLoop.cpp +++ b/Source/WebCore/workers/WorkerRunLoop.cpp @@ -104,7 +104,8 @@ String WorkerRunLoop::defaultMode() return String(); } -class RunLoopSetup : public Noncopyable { +class RunLoopSetup { + WTF_MAKE_NONCOPYABLE(RunLoopSetup); public: RunLoopSetup(WorkerRunLoop& runLoop) : m_runLoop(runLoop) diff --git a/Source/WebCore/workers/WorkerRunLoop.h b/Source/WebCore/workers/WorkerRunLoop.h index 9d4edfd..3feb4e8 100644 --- a/Source/WebCore/workers/WorkerRunLoop.h +++ b/Source/WebCore/workers/WorkerRunLoop.h @@ -65,7 +65,8 @@ namespace WebCore { static String defaultMode(); - class Task : public Noncopyable { + class Task { + WTF_MAKE_NONCOPYABLE(Task); WTF_MAKE_FAST_ALLOCATED; public: static PassOwnPtr<Task> create(PassOwnPtr<ScriptExecutionContext::Task> task, const String& mode); ~Task() { } diff --git a/Source/WebCore/workers/WorkerThread.cpp b/Source/WebCore/workers/WorkerThread.cpp index f61120e..e1f1a66 100644 --- a/Source/WebCore/workers/WorkerThread.cpp +++ b/Source/WebCore/workers/WorkerThread.cpp @@ -61,7 +61,8 @@ unsigned WorkerThread::workerThreadCount() return m_threadCount; } -struct WorkerThreadStartupData : Noncopyable { +struct WorkerThreadStartupData { + WTF_MAKE_NONCOPYABLE(WorkerThreadStartupData); WTF_MAKE_FAST_ALLOCATED; public: static PassOwnPtr<WorkerThreadStartupData> create(const KURL& scriptURL, const String& userAgent, const String& sourceCode) { diff --git a/Source/WebCore/xml/XMLHttpRequest.cpp b/Source/WebCore/xml/XMLHttpRequest.cpp index ee9e20f..c05ab29 100644 --- a/Source/WebCore/xml/XMLHttpRequest.cpp +++ b/Source/WebCore/xml/XMLHttpRequest.cpp @@ -38,6 +38,7 @@ #include "InspectorInstrumentation.h" #include "ResourceError.h" #include "ResourceRequest.h" +#include "ScriptCallStack.h" #include "SecurityOrigin.h" #include "Settings.h" #include "SharedBuffer.h" @@ -64,7 +65,9 @@ namespace WebCore { static WTF::RefCountedLeakCounter xmlHttpRequestCounter("XMLHttpRequest"); #endif -struct XMLHttpRequestStaticData : Noncopyable { +struct XMLHttpRequestStaticData { + WTF_MAKE_NONCOPYABLE(XMLHttpRequestStaticData); WTF_MAKE_FAST_ALLOCATED; +public: XMLHttpRequestStaticData(); String m_proxyHeaderPrefix; String m_secHeaderPrefix; @@ -806,7 +809,7 @@ static void reportUnsafeUsage(ScriptExecutionContext* context, const String& mes return; // FIXME: It's not good to report the bad usage without indicating what source line it came from. // We should pass additional parameters so we can tell the console where the mistake occurred. - context->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, message, 1, String()); + context->addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, message, 1, String(), 0); } void XMLHttpRequest::setRequestHeader(const AtomicString& name, const String& value, ExceptionCode& ec) diff --git a/Source/WebCore/xml/XMLHttpRequest.h b/Source/WebCore/xml/XMLHttpRequest.h index bc6815d..b15d358 100644 --- a/Source/WebCore/xml/XMLHttpRequest.h +++ b/Source/WebCore/xml/XMLHttpRequest.h @@ -44,6 +44,7 @@ class TextResourceDecoder; class ThreadableLoader; class XMLHttpRequest : public RefCounted<XMLHttpRequest>, public EventTarget, private ThreadableLoaderClient, public ActiveDOMObject { + WTF_MAKE_FAST_ALLOCATED; public: static PassRefPtr<XMLHttpRequest> create(ScriptExecutionContext* context) { return adoptRef(new XMLHttpRequest(context)); } ~XMLHttpRequest(); diff --git a/Source/WebCore/xml/XPathExpressionNode.h b/Source/WebCore/xml/XPathExpressionNode.h index c04d45b..4b5baa8 100644 --- a/Source/WebCore/xml/XPathExpressionNode.h +++ b/Source/WebCore/xml/XPathExpressionNode.h @@ -39,7 +39,9 @@ namespace WebCore { namespace XPath { - struct EvaluationContext : FastAllocBase { + struct EvaluationContext { + WTF_MAKE_FAST_ALLOCATED; + public: RefPtr<Node> node; unsigned long size; unsigned long position; @@ -53,7 +55,8 @@ namespace WebCore { virtual ~ParseNode() { } }; - class Expression : public ParseNode, public Noncopyable { + class Expression : public ParseNode { + WTF_MAKE_NONCOPYABLE(Expression); WTF_MAKE_FAST_ALLOCATED; public: static EvaluationContext& evaluationContext(); diff --git a/Source/WebCore/xml/XPathNodeSet.h b/Source/WebCore/xml/XPathNodeSet.h index d5c47be..619d91c 100644 --- a/Source/WebCore/xml/XPathNodeSet.h +++ b/Source/WebCore/xml/XPathNodeSet.h @@ -37,7 +37,8 @@ namespace WebCore { namespace XPath { - class NodeSet : public FastAllocBase { + class NodeSet { + WTF_MAKE_FAST_ALLOCATED; public: NodeSet() : m_isSorted(true), m_subtreesAreDisjoint(false) { } diff --git a/Source/WebCore/xml/XPathParser.h b/Source/WebCore/xml/XPathParser.h index 0ee447a..f49b44b 100644 --- a/Source/WebCore/xml/XPathParser.h +++ b/Source/WebCore/xml/XPathParser.h @@ -58,7 +58,8 @@ namespace WebCore { Token(int t, EqTestOp::Opcode v): type(t), eqop(v) {} }; - class Parser : public Noncopyable { + class Parser { + WTF_MAKE_NONCOPYABLE(Parser); public: Parser(); ~Parser(); diff --git a/Source/WebCore/xml/XPathPredicate.h b/Source/WebCore/xml/XPathPredicate.h index 5f2482a..3600154 100644 --- a/Source/WebCore/xml/XPathPredicate.h +++ b/Source/WebCore/xml/XPathPredicate.h @@ -105,7 +105,8 @@ namespace WebCore { virtual Value::Type resultType() const { return Value::NodeSetValue; } }; - class Predicate : public Noncopyable { + class Predicate { + WTF_MAKE_NONCOPYABLE(Predicate); WTF_MAKE_FAST_ALLOCATED; public: Predicate(Expression*); ~Predicate(); diff --git a/Source/WebCore/xml/XPathStep.h b/Source/WebCore/xml/XPathStep.h index ec022b3..b031baf 100644 --- a/Source/WebCore/xml/XPathStep.h +++ b/Source/WebCore/xml/XPathStep.h @@ -39,7 +39,8 @@ namespace WebCore { class Predicate; - class Step : public ParseNode, public Noncopyable { + class Step : public ParseNode { + WTF_MAKE_NONCOPYABLE(Step); WTF_MAKE_FAST_ALLOCATED; public: enum Axis { AncestorAxis, AncestorOrSelfAxis, AttributeAxis, @@ -49,7 +50,8 @@ namespace WebCore { SelfAxis }; - class NodeTest : public FastAllocBase { + class NodeTest { + WTF_MAKE_FAST_ALLOCATED; public: enum Kind { TextNodeTest, CommentNodeTest, ProcessingInstructionNodeTest, AnyNodeTest, NameTest diff --git a/Source/WebCore/xml/XSLImportRule.h b/Source/WebCore/xml/XSLImportRule.h index 63c271e..3c5939d 100644 --- a/Source/WebCore/xml/XSLImportRule.h +++ b/Source/WebCore/xml/XSLImportRule.h @@ -35,6 +35,7 @@ namespace WebCore { class CachedXSLStyleSheet; class XSLImportRule : public StyleBase, private CachedResourceClient { + WTF_MAKE_FAST_ALLOCATED; public: static PassRefPtr<XSLImportRule> create(XSLStyleSheet* parentSheet, const String& href) { |