diff options
Diffstat (limited to 'WebCore')
381 files changed, 13096 insertions, 2687 deletions
diff --git a/WebCore/Android.derived.jscbindings.mk b/WebCore/Android.derived.jscbindings.mk index e1cd523..7dfb90e 100644 --- a/WebCore/Android.derived.jscbindings.mk +++ b/WebCore/Android.derived.jscbindings.mk @@ -392,12 +392,12 @@ GEN := \ $(intermediates)/storage/JSIDBDatabaseRequest.h \ $(intermediates)/storage/JSIDBErrorEvent.h \ $(intermediates)/storage/JSIDBEvent.h \ - $(intermediates)/storage/JSIDBIndexRequest.h \ + $(intermediates)/storage/JSIDBFactory.h \ + $(intermediates)/storage/JSIDBIndex.h \ $(intermediates)/storage/JSIDBKey.h \ $(intermediates)/storage/JSIDBKeyRange.h \ $(intermediates)/storage/JSIDBRequest.h \ - $(intermediates)/storage/JSIDBSuccessEvent.h \ - $(intermediates)/storage/JSIndexedDatabaseRequest.h + $(intermediates)/storage/JSIDBSuccessEvent.h $(GEN): PRIVATE_PATH := $(LOCAL_PATH) $(GEN): PRIVATE_CUSTOM_TOOL = perl -I$(PRIVATE_PATH)/bindings/scripts $(PRIVATE_PATH)/bindings/scripts/generate-bindings.pl --defines "$(FEATURE_DEFINES) LANGUAGE_JAVASCRIPT" --generator JS --include dom --include html --include storage --outputdir $(dir $@) $< diff --git a/WebCore/Android.derived.v8bindings.mk b/WebCore/Android.derived.v8bindings.mk index 06865c1..5f576ea 100644 --- a/WebCore/Android.derived.v8bindings.mk +++ b/WebCore/Android.derived.v8bindings.mk @@ -386,12 +386,12 @@ GEN := \ $(intermediates)/bindings/V8IDBDatabaseRequest.h \ $(intermediates)/bindings/V8IDBErrorEvent.h \ $(intermediates)/bindings/V8IDBEvent.h \ - $(intermediates)/bindings/V8IDBIndexRequest.h \ + $(intermediates)/bindings/V8IDBFactory.h \ + $(intermediates)/bindings/V8IDBIndex.h \ $(intermediates)/bindings/V8IDBKey.h \ $(intermediates)/bindings/V8IDBKeyRange.h \ $(intermediates)/bindings/V8IDBRequest.h \ - $(intermediates)/bindings/V8IDBSuccessEvent.h \ - $(intermediates)/bindings/V8IndexedDatabaseRequest.h + $(intermediates)/bindings/V8IDBSuccessEvent.h $(GEN): PRIVATE_PATH := $(LOCAL_PATH) $(GEN): PRIVATE_CUSTOM_TOOL = SOURCE_ROOT=$(PRIVATE_PATH) perl -I$(PRIVATE_PATH)/bindings/scripts $(PRIVATE_PATH)/bindings/scripts/generate-bindings.pl --defines "$(FEATURE_DEFINES) LANGUAGE_JAVASCRIPT" --generator V8 --include dom --include html --include storage --outputdir $(dir $@) $< diff --git a/WebCore/Android.mk b/WebCore/Android.mk index 82b444a..bc7cc1e 100644 --- a/WebCore/Android.mk +++ b/WebCore/Android.mk @@ -565,7 +565,9 @@ LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \ platform/image-decoders/gif/GIFImageDecoder.cpp \ platform/image-decoders/gif/GIFImageReader.cpp \ \ + platform/mock/DeviceOrientationClientMock.cpp \ platform/mock/GeolocationServiceMock.cpp \ + platform/mock/SpeechInputClientMock.cpp \ \ platform/network/AuthenticationChallengeBase.cpp \ platform/network/Credential.cpp \ @@ -813,17 +815,23 @@ LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \ storage/IDBDatabaseRequest.cpp \ storage/IDBErrorEvent.cpp \ storage/IDBEvent.cpp \ - storage/IDBIndexImpl.cpp \ - storage/IDBIndexRequest.cpp \ + storage/IDBIndex.cpp \ + storage/IDBIndexBackendImpl.cpp \ storage/IDBKey.cpp \ storage/IDBKeyRange.cpp \ storage/IDBObjectStoreImpl.cpp \ storage/IDBObjectStoreRequest.cpp \ storage/IDBRequest.cpp \ storage/IDBSuccessEvent.cpp \ +<<<<<<< HEAD storage/IndexedDatabase.cpp \ storage/IndexedDatabaseImpl.cpp \ storage/IndexedDatabaseRequest.cpp \ +======= + storage/IDBFactory.cpp \ + storage/IDBFactoryBackendInterface.cpp \ + storage/IDBFactoryBackendImpl.cpp \ +>>>>>>> webkit.org at r64523 storage/LocalStorageTask.cpp \ storage/LocalStorageThread.cpp \ storage/OriginQuotaManager.cpp \ diff --git a/WebCore/CMakeLists.txt b/WebCore/CMakeLists.txt index a0f5123..e0a64af 100644 --- a/WebCore/CMakeLists.txt +++ b/WebCore/CMakeLists.txt @@ -49,6 +49,7 @@ SET(WebCore_INCLUDE_DIRECTORIES "${WEBCORE_DIR}/svg/graphics" "${WEBCORE_DIR}/svg/graphics/filters" "${WEBCORE_DIR}/websockets" + "${WEBCORE_DIR}/wml" "${WEBCORE_DIR}/workers" "${WEBCORE_DIR}/xml" "${JAVASCRIPTCORE_DIR}" @@ -337,13 +338,13 @@ SET(WebCore_IDL_FILES storage/IDBDatabaseRequest.idl storage/IDBErrorEvent.idl storage/IDBEvent.idl - storage/IDBIndexRequest.idl + storage/IDBFactory.idl + storage/IDBIndex.idl storage/IDBKey.idl storage/IDBKeyRange.idl storage/IDBObjectStoreRequest.idl storage/IDBRequest.idl storage/IDBSuccessEvent.idl - storage/IndexedDatabaseRequest.idl storage/SQLError.idl storage/SQLException.idl storage/SQLResultSet.idl @@ -1274,6 +1275,7 @@ SET(WebCore_SOURCES platform/image-decoders/jpeg/JPEGImageDecoder.cpp platform/image-decoders/png/PNGImageDecoder.cpp + platform/mock/DeviceOrientationClientMock.cpp platform/mock/GeolocationServiceMock.cpp platform/network/AuthenticationChallengeBase.cpp @@ -1436,15 +1438,17 @@ SET(WebCore_SOURCES storage/IDBDatabaseRequest.cpp storage/IDBErrorEvent.cpp storage/IDBEvent.cpp + storage/IDBIndex.cpp + storage/IDBIndexBackendImpl.cpp storage/IDBKey.cpp storage/IDBKeyRange.cpp storage/IDBRequest.cpp storage/IDBObjectStoreImpl.cpp storage/IDBObjectStoreRequest.cpp storage/IDBSuccessEvent.cpp - storage/IndexedDatabase.cpp - storage/IndexedDatabaseImpl.cpp - storage/IndexedDatabaseRequest.cpp + storage/IDBFactory.cpp + storage/IDBFactoryBackendInterface.cpp + storage/IDBFactoryBackendImpl.cpp storage/LocalStorageTask.cpp storage/LocalStorageThread.cpp storage/OriginQuotaManager.cpp @@ -1736,6 +1740,49 @@ IF (ENABLE_SVG) ) ENDIF() +IF (ENABLE_WML) + LIST(APPEND WebCore_SOURCES + ${DERIVED_SOURCES_DIR}/WMLElementFactory.cpp + ${DERIVED_SOURCES_DIR}/WMLNames.cpp + wml/WMLAElement.cpp + wml/WMLAccessElement.cpp + wml/WMLAnchorElement.cpp + wml/WMLBRElement.cpp + wml/WMLCardElement.cpp + wml/WMLDoElement.cpp + wml/WMLDocument.cpp + wml/WMLElement.cpp + wml/WMLErrorHandling.cpp + wml/WMLEventHandlingElement.cpp + wml/WMLFieldSetElement.cpp + wml/WMLFormControlElement.cpp + wml/WMLGoElement.cpp + wml/WMLImageElement.cpp + wml/WMLImageLoader.cpp + wml/WMLInputElement.cpp + wml/WMLInsertedLegendElement.cpp + wml/WMLIntrinsicEvent.cpp + wml/WMLIntrinsicEventHandler.cpp + wml/WMLMetaElement.cpp + wml/WMLNoopElement.cpp + wml/WMLOnEventElement.cpp + wml/WMLPElement.cpp + wml/WMLOptGroupElement.cpp + wml/WMLOptionElement.cpp + wml/WMLPageState.cpp + wml/WMLPostfieldElement.cpp + wml/WMLPrevElement.cpp + wml/WMLRefreshElement.cpp + wml/WMLSelectElement.cpp + wml/WMLSetvarElement.cpp + wml/WMLTableElement.cpp + wml/WMLTaskElement.cpp + wml/WMLTemplateElement.cpp + wml/WMLTimerElement.cpp + wml/WMLVariables.cpp + ) +ENDIF() + SET(IDL_INCLUDES "") FOREACH (_include ${WebCore_IDL_INCLUDES}) LIST(APPEND IDL_INCLUDES --include=${WEBCORE_DIR}/${_include}) @@ -1780,6 +1827,7 @@ ADD_SOURCE_DERIVED_DEPENDENCIES(${WEBCORE_DIR}/css/CSSStyleSelector.cpp UserAgen GENERATE_DOM_NAMES_FACTORY(HTML ${WEBCORE_DIR}/html/HTMLTagNames.in ${WEBCORE_DIR}/html/HTMLAttributeNames.in "${HTML_FEATURES}") GENERATE_DOM_NAMES_FACTORY(MathML ${WEBCORE_DIR}/mathml/mathtags.in ${WEBCORE_DIR}/mathml/mathattrs.in "${MATHML_FEATURES}") GENERATE_DOM_NAMES_FACTORY(SVG ${WEBCORE_DIR}/svg/svgtags.in ${WEBCORE_DIR}/svg/svgattrs.in "${SVG_FEATURES}") +GENERATE_DOM_NAMES_FACTORY(WML ${WEBCORE_DIR}/wml/WMLTagNames.in ${WEBCORE_DIR}/wml/WMLAttributeNames.in "${WML_FEATURES}") GENERATE_DOM_NAMES_ONLY(XLink ${WEBCORE_DIR}/svg/xlinkattrs.in) GENERATE_DOM_NAMES_ONLY(XMLNS ${WEBCORE_DIR}/xml/xmlnsattrs.in) GENERATE_DOM_NAMES_ONLY(XML ${WEBCORE_DIR}/xml/xmlattrs.in) @@ -1833,5 +1881,6 @@ ADD_TARGET_PROPERTIES(${WebCore_LIBRARY_NAME} LINK_FLAGS ${WebCore_LINK_FLAGS}) IF (SHARED_CORE) + SET_TARGET_PROPERTIES(${WebCore_LIBRARY_NAME} PROPERTIES VERSION ${PROJECT_VERSION} SOVERSION ${PROJECT_VERSION_MAJOR}) INSTALL(TARGETS ${WebCore_LIBRARY_NAME} DESTINATION lib) ENDIF () diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog index 999b591..aac8d9f 100644 --- a/WebCore/ChangeLog +++ b/WebCore/ChangeLog @@ -1,3 +1,4040 @@ +2010-08-02 Brady Eidson <beidson@apple.com> + + Reviewed by Anders Carlsson. + + Add VisitedLinkStrategy for each platform to implement + https://bugs.webkit.org/show_bug.cgi?id=43393 + + No new tests. (No change in behavior) + + * WebCore.exp.in: + * WebCore.xcodeproj/project.pbxproj: + + * css/CSSStyleSelector.cpp: + (WebCore::CSSStyleSelector::SelectorChecker::determineLinkStateSlowCase): Use VisitedLinkStrategy if it's enabled. + + * loader/HistoryController.cpp: + (WebCore::addVisitedLink): Choose VisitedLinkStrategy if it's enabled, else fallback to PageGroup. + (WebCore::HistoryController::updateForStandardLoad): Use addVisitedLink helper. + (WebCore::HistoryController::updateForRedirectWithLockedBackForwardList): Ditto. + (WebCore::HistoryController::updateForClientRedirect): Ditto. + (WebCore::HistoryController::updateForSameDocumentNavigation): Ditto. + + * platform/PlatformStrategies.h: + (WebCore::PlatformStrategies::visitedLinkStrategy): + (WebCore::PlatformStrategies::PlatformStrategies): + +2010-08-02 Chris Fleizach <cfleizach@apple.com> + + Unreviewed, rolling out r64471. + http://trac.webkit.org/changeset/64471 + https://bugs.webkit.org/show_bug.cgi?id=43005 + + Rolling out https://bugs.webkit.org/show_bug.cgi?id=43005 + until further discussion + + * Android.derived.v8bindings.mk: + * Android.jscbindings.mk: + * DerivedSources.cpp: + * DerivedSources.make: + * GNUmakefile.am: + * WebCore.gypi: + * WebCore.pri: + * WebCore.pro: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * accessibility/AXObjectCache.h: + (WebCore::AXObjectCache::): + * accessibility/Accessibility.cpp: Removed. + * accessibility/Accessibility.h: Removed. + * accessibility/Accessibility.idl: Removed. + * accessibility/AccessibilityObject.h: + * accessibility/ScreenReader.cpp: Removed. + * accessibility/ScreenReader.h: Removed. + * accessibility/ScreenReader.idl: Removed. + * accessibility/mac/AXObjectCacheMac.mm: + (WebCore::AXObjectCache::postPlatformNotification): + * accessibility/mac/AccessibilityObjectMac.mm: + * page/Navigator.cpp: + (WebCore::Navigator::disconnectFrame): + (WebCore::Navigator::mimeTypes): + * page/Navigator.h: + * page/Navigator.idl: + +2010-08-02 Ryosuke Niwa <rniwa@webkit.org> + + Reviewed by Eric Seidel. + + Range::create should not be calling deprecatedEditingOffset and node on start and end + https://bugs.webkit.org/show_bug.cgi?id=43385 + + Replaced node() and deprecatedEditingOffset() by containerNode() and computeOffsetInContainerNode(). + + No new tests added since this does not change the behavior. + + * dom/Range.cpp: + (WebCore::Range::create): + +2010-08-02 Chris Fleizach <cfleizach@apple.com> + + Unreviewed, rolling out r64472. + http://trac.webkit.org/changeset/64472 + https://bugs.webkit.org/show_bug.cgi?id=43005 + + Rolling out https://bugs.webkit.org/show_bug.cgi?id=43005 + until further discussion + + * WebCore.vcproj/WebCore.vcproj: + +2010-08-02 Chris Fleizach <cfleizach@apple.com> + + Unreviewed, rolling out r64476. + http://trac.webkit.org/changeset/64476 + + Rolling out https://bugs.webkit.org/show_bug.cgi?id=43005 + until further discussion + + * WebCore.vcproj/WebCore.vcproj: + +2010-07-27 Luiz Agostini <luiz.agostini@openbossa.org> + + Reviewed by Darin Fisher. + + PopupMenu refactoring in preparation to WebKit2 + https://bugs.webkit.org/show_bug.cgi?id=42592 + + Classes PopupMenu and SearchPopupMenu have been made pure virtual. + + * platform/PopupMenu.h: + (WebCore::PopupMenu::~PopupMenu): + * platform/SearchPopupMenu.h: + (WebCore::SearchPopupMenu::~SearchPopupMenu): + + Classes RenderMenuList and RenderTexyControlSingleLine have been changed to use + the new pure virtual PopupMenu and SearchPopupMenu. + + * rendering/RenderMenuList.cpp: + (WebCore::RenderMenuList::adjustInnerStyle): + (WebCore::RenderMenuList::showPopup): + * rendering/RenderMenuList.h: + * rendering/RenderTextControlSingleLine.cpp: + (WebCore::RenderTextControlSingleLine::~RenderTextControlSingleLine): + (WebCore::RenderTextControlSingleLine::addSearchResult): + (WebCore::RenderTextControlSingleLine::showPopup): + (WebCore::RenderTextControlSingleLine::hidePopup): + (WebCore::RenderTextControlSingleLine::updateFromElement): + (WebCore::RenderTextControlSingleLine::valueChanged): + * rendering/RenderTextControlSingleLine.h: + + Chrome and ChromeClient were made responsible for providing instances of classes + PopupMenu and SearchPopupMenu to its users. + + * loader/EmptyClients.h: + (WebCore::EmptyPopupMenu::show): + (WebCore::EmptyPopupMenu::hide): + (WebCore::EmptyPopupMenu::updateFromElement): + (WebCore::EmptyPopupMenu::disconnectClient): + (WebCore::EmptySearchPopupMenu::popupMenu): + (WebCore::EmptySearchPopupMenu::saveRecentSearches): + (WebCore::EmptySearchPopupMenu::loadRecentSearches): + (WebCore::EmptySearchPopupMenu::enabled): + (WebCore::EmptyChromeClient::selectItemWritingDirectionIsNatural): + (WebCore::EmptyChromeClient::createPopupMenu): + (WebCore::EmptyChromeClient::createSearchPopupMenu): + * page/Chrome.cpp: + (WebCore::Chrome::selectItemWritingDirectionIsNatural): + (WebCore::Chrome::createPopupMenu): + (WebCore::Chrome::createSearchPopupMenu): + * page/Chrome.h: + * page/ChromeClient.h: + + Original contents of files PopupMenu.h and SearchPopupMenu.h have been splited + in several files, two for each platform (PopupMenuXXX.h and SearchPopupMenuXXX.h). + Each of new the files contain the concrete classes that inherit form PopupMenu or + SearchPopupMenu and are specific for the corresponding platform. + + brew: + + * platform/brew/PopupMenuBrew.cpp: + (WebCore::PopupMenuBrew::PopupMenuBrew): + (WebCore::PopupMenuBrew::~PopupMenuBrew): + (WebCore::PopupMenuBrew::disconnectClient): + (WebCore::PopupMenuBrew::show): + (WebCore::PopupMenuBrew::hide): + (WebCore::PopupMenuBrew::updateFromElement): + * platform/brew/PopupMenuBrew.h: Added. + (WebCore::PopupMenuBrew::client): + * platform/brew/SearchPopupMenuBrew.cpp: + (WebCore::SearchPopupMenuBrew::saveRecentSearches): + (WebCore::SearchPopupMenuBrew::loadRecentSearches): + (WebCore::SearchPopupMenuBrew::SearchPopupMenuBrew): + (WebCore::SearchPopupMenuBrew::enabled): + (WebCore::SearchPopupMenuBrew::popupMenu): + * platform/brew/SearchPopupMenuBrew.h: Added. + + chromium: + + * WebCore.gypi: + * platform/chromium/PopupMenuChromium.cpp: + (WebCore::PopupMenuChromium::PopupMenuChromium): + (WebCore::PopupMenuChromium::~PopupMenuChromium): + (WebCore::PopupMenuChromium::show): + (WebCore::PopupMenuChromium::hide): + (WebCore::PopupMenuChromium::updateFromElement): + (WebCore::PopupMenuChromium::disconnectClient): + * platform/chromium/PopupMenuChromium.h: + (WebCore::PopupMenuChromium::client): + * platform/chromium/SearchPopupMenuChromium.cpp: + (WebCore::SearchPopupMenuChromium::SearchPopupMenuChromium): + (WebCore::SearchPopupMenuChromium::popupMenu): + (WebCore::SearchPopupMenuChromium::enabled): + (WebCore::SearchPopupMenuChromium::saveRecentSearches): + (WebCore::SearchPopupMenuChromium::loadRecentSearches): + * platform/chromium/SearchPopupMenuChromium.h: Added. + + efl: + + * platform/efl/PopupMenuEfl.cpp: + (WebCore::PopupMenuEfl::PopupMenuEfl): + (WebCore::PopupMenuEfl::~PopupMenuEfl): + (WebCore::PopupMenuEfl::show): + (WebCore::PopupMenuEfl::hide): + (WebCore::PopupMenuEfl::updateFromElement): + (WebCore::PopupMenuEfl::disconnectClient): + * platform/efl/PopupMenuEfl.h: Added. + (WebCore::PopupMenuEfl::client): + * platform/efl/SearchPopupMenuEfl.cpp: + (WebCore::SearchPopupMenuEfl::SearchPopupMenuEfl): + (WebCore::SearchPopupMenuEfl::popupMenu): + (WebCore::SearchPopupMenuEfl::saveRecentSearches): + (WebCore::SearchPopupMenuEfl::loadRecentSearches): + (WebCore::SearchPopupMenuEfl::enabled): + * platform/efl/SearchPopupMenuEfl.h: Added. + + gtk: + + * GNUmakefile.am: + * platform/gtk/PopupMenuGtk.cpp: + (WebCore::PopupMenuGtk::PopupMenuGtk): + (WebCore::PopupMenuGtk::~PopupMenuGtk): + (WebCore::PopupMenuGtk::show): + (WebCore::PopupMenuGtk::hide): + (WebCore::PopupMenuGtk::updateFromElement): + (WebCore::PopupMenuGtk::disconnectClient): + (WebCore::PopupMenuGtk::menuItemActivated): + (WebCore::PopupMenuGtk::menuUnmapped): + (WebCore::PopupMenuGtk::menuPositionFunction): + (WebCore::PopupMenuGtk::menuRemoveItem): + * platform/gtk/PopupMenuGtk.h: Added. + (WebCore::PopupMenuGtk::client): + * platform/gtk/SearchPopupMenuGtk.cpp: + (WebCore::SearchPopupMenuGtk::SearchPopupMenuGtk): + (WebCore::SearchPopupMenuGtk::popupMenu): + (WebCore::SearchPopupMenuGtk::saveRecentSearches): + (WebCore::SearchPopupMenuGtk::loadRecentSearches): + (WebCore::SearchPopupMenuGtk::enabled): + * platform/gtk/SearchPopupMenuGtk.h: Added. + + haiku: + + * platform/haiku/PopupMenuHaiku.cpp: + (WebCore::HaikuPopup::HaikuPopup): + (WebCore::HaikuPopup::~HaikuPopup): + (WebCore::PopupMenuHaiku::PopupMenuHaiku): + (WebCore::PopupMenuHaiku::~PopupMenuHaiku): + (WebCore::PopupMenuHaiku::disconnectClient): + (WebCore::PopupMenuHaiku::show): + (WebCore::PopupMenuHaiku::hide): + (WebCore::PopupMenuHaiku::updateFromElement): + * platform/haiku/PopupMenuHaiku.h: Added. + (WebCore::PopupMenuHaiku::disconnectClient): + (WebCore::PopupMenuHaiku::client): + * platform/haiku/SearchPopupMenuHaiku.cpp: + (WebCore::SearchPopupMenuHaiku::SearchPopupMenuHaiku): + (WebCore::SearchPopupMenuHaiku::saveRecentSearches): + (WebCore::SearchPopupMenuHaiku::loadRecentSearches): + (WebCore::SearchPopupMenuHaiku::enabled): + (WebCore::SearchPopupMenuHaiku::popupMenu): + * platform/haiku/SearchPopupMenuHaiku.h: Added. + + mac: + + * WebCore.exp.in: + * WebCore.xcodeproj/project.pbxproj: + * platform/mac/PopupMenuMac.h: Added. + (WebCore::PopupMenuMac::disconnectClient): + (WebCore::PopupMenuMac::client): + * platform/mac/PopupMenuMac.mm: + (WebCore::PopupMenuMac::PopupMenuMac): + (WebCore::PopupMenuMac::~PopupMenuMac): + (WebCore::PopupMenuMac::clear): + (WebCore::PopupMenuMac::populate): + (WebCore::PopupMenuMac::show): + (WebCore::PopupMenuMac::hide): + (WebCore::PopupMenuMac::updateFromElement): + (WebCore::PopupMenuMac::itemWritingDirectionIsNatural): + * platform/mac/SearchPopupMenuMac.h: Added. + * platform/mac/SearchPopupMenuMac.mm: + (WebCore::SearchPopupMenuMac::SearchPopupMenuMac): + (WebCore::SearchPopupMenuMac::popupMenu): + (WebCore::SearchPopupMenuMac::enabled): + (WebCore::SearchPopupMenuMac::saveRecentSearches): + (WebCore::SearchPopupMenuMac::loadRecentSearches): + + qt: + + * WebCore.pro: + * platform/qt/PopupMenuQt.cpp: + (WebCore::PopupMenuQt::PopupMenuQt): + (WebCore::PopupMenuQt::~PopupMenuQt): + (WebCore::PopupMenuQt::disconnectClient): + (WebCore::PopupMenuQt::show): + (WebCore::PopupMenuQt::hide): + (WebCore::PopupMenuQt::updateFromElement): + * platform/qt/PopupMenuQt.h: Added. + * platform/qt/QtAbstractWebPopup.h: + * platform/qt/SearchPopupMenuQt.cpp: + (WebCore::SearchPopupMenuQt::SearchPopupMenuQt): + (WebCore::SearchPopupMenuQt::popupMenu): + (WebCore::SearchPopupMenuQt::saveRecentSearches): + (WebCore::SearchPopupMenuQt::loadRecentSearches): + (WebCore::SearchPopupMenuQt::enabled): + * platform/qt/SearchPopupMenuQt.h: Added. + + win: + + * WebCore.vcproj/WebCore.vcproj: + * platform/win/PopupMenuWin.cpp: + (WebCore::PopupMenuWin::PopupMenuWin): + (WebCore::PopupMenuWin::~PopupMenuWin): + (WebCore::PopupMenuWin::disconnectClient): + (WebCore::PopupMenuWin::popupClassName): + (WebCore::PopupMenuWin::show): + (WebCore::PopupMenuWin::hide): + (WebCore::PopupMenuWin::calculatePositionAndSize): + (WebCore::PopupMenuWin::setFocusedIndex): + (WebCore::PopupMenuWin::visibleItems): + (WebCore::PopupMenuWin::listIndexAtPoint): + (WebCore::PopupMenuWin::focusedIndex): + (WebCore::PopupMenuWin::focusFirst): + (WebCore::PopupMenuWin::focusLast): + (WebCore::PopupMenuWin::down): + (WebCore::PopupMenuWin::up): + (WebCore::PopupMenuWin::invalidateItem): + (WebCore::PopupMenuWin::clientRect): + (WebCore::PopupMenuWin::incrementWheelDelta): + (WebCore::PopupMenuWin::reduceWheelDelta): + (WebCore::PopupMenuWin::scrollToRevealSelection): + (WebCore::PopupMenuWin::updateFromElement): + (WebCore::PopupMenuWin::paint): + (WebCore::PopupMenuWin::valueChanged): + (WebCore::PopupMenuWin::invalidateScrollbarRect): + (WebCore::PopupMenuWin::registerClass): + (WebCore::PopupMenuWin::PopupMenuWndProc): + (WebCore::PopupMenuWin::wndProc): + * platform/win/PopupMenuWin.h: Added. + (WebCore::PopupMenuWin::client): + (WebCore::PopupMenuWin::scrollbar): + (WebCore::PopupMenuWin::itemHeight): + (WebCore::PopupMenuWin::windowRect): + (WebCore::PopupMenuWin::popupHandle): + (WebCore::PopupMenuWin::setWasClicked): + (WebCore::PopupMenuWin::wasClicked): + (WebCore::PopupMenuWin::setScrollOffset): + (WebCore::PopupMenuWin::scrollOffset): + (WebCore::PopupMenuWin::wheelDelta): + (WebCore::PopupMenuWin::scrollbarCapturingMouse): + (WebCore::PopupMenuWin::setScrollbarCapturingMouse): + * platform/win/SearchPopupMenuWin.cpp: + (WebCore::SearchPopupMenuWin::SearchPopupMenuWin): + (WebCore::SearchPopupMenuWin::popupMenu): + (WebCore::SearchPopupMenuWin::enabled): + (WebCore::SearchPopupMenuWin::saveRecentSearches): + (WebCore::SearchPopupMenuWin::loadRecentSearches): + * platform/win/SearchPopupMenuWin.h: Added. + + wx: + + * platform/wx/PopupMenuWx.cpp: + (WebCore::PopupMenuWx::PopupMenuWx): + (WebCore::PopupMenuWx::~PopupMenuWx): + (WebCore::PopupMenuWx::disconnectClient): + (WebCore::PopupMenuWx::show): + (WebCore::PopupMenuWx::OnMenuItemSelected): + (WebCore::PopupMenuWx::hide): + (WebCore::PopupMenuWx::updateFromElement): + * platform/wx/PopupMenuWx.h: Added. + (WebCore::PopupMenuWx::client): + * platform/wx/SearchPopupMenuWx.cpp: + (WebCore::SearchPopupMenuWx::SearchPopupMenuWx): + (WebCore::SearchPopupMenuWx::saveRecentSearches): + (WebCore::SearchPopupMenuWx::loadRecentSearches): + (WebCore::SearchPopupMenuWx::enabled): + (WebCore::SearchPopupMenuWx::popupMenu): + * platform/wx/SearchPopupMenuWx.h: Added. + + + +2010-08-02 Martin Robinson <mrobinson@igalia.com> + + Reviewed by Xan Lopez. + + [GTK] Use GdkPixbuf for ImageBuffer::toDataURL + https://bugs.webkit.org/show_bug.cgi?id=43088 + + Implement ImageBuffer::toDataURL with GdkPixbuf instead of Cairo. This + allows the method to support a larger variety of image types. + + * GNUmakefile.am: Add new files to the source list. + * platform/MIMETypeRegistry.cpp: + (WebCore::initializeSupportedImageMIMETypesForEncoding): + Add the list of image types supported by GTK. + * platform/graphics/cairo/ImageBufferCairo.cpp: + * platform/graphics/gtk/CairoUtilities.cpp: Added. + (getCairoSurfacePixel): Move this method from ImageGtk.cpp. + (getGdkPixbufPixel): Move this method from ImageGtk.cpp. + (cairoImageSurfaceToGdkPixbuf): Move this method from ImageGtk.cpp. + * platform/graphics/gtk/CairoUtilities.h: Added. + * platform/graphics/gtk/ImageBufferGtk.cpp: Added. + (WebCore::ImageBuffer::toDataURL): Use GdkPixbuf to do the conversion to a data url. + * platform/graphics/gtk/ImageGtk.cpp: + (WebCore::BitmapImage::getGdkPixbuf): Use the new helper method in CairoUtilities.h. + +2010-08-02 Xan Lopez <xlopez@igalia.com> + + Reviewed by Gustavo Noronha. + + [GTK] Add support for the Audio element in the DOM bindings + https://bugs.webkit.org/show_bug.cgi?id=43313 + + The IDL definition of some HTMLMediaElement methods does not match + the C++ implementation API, take this fact into account when + generating the bindings. + + * bindings/gobject/WebKitHTMLElementWrapperFactory.cpp: + (WebKit::createAudioWrapper): + (WebKit::createHTMLElementWrapper): + * bindings/scripts/CodeGeneratorGObject.pm: + +2010-08-02 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Fix plug-in test failures and remove tests from the Skipped list + https://bugs.webkit.org/show_bug.cgi?id=43389 + + * WebCore.exp.in: + Export FrameLoader::cancelledError. + +2010-08-02 Brady Eidson <beidson@apple.com> + + Reviewed by Anders Carlsson. + + Basic WK2 visited link coloring + https://bugs.webkit.org/show_bug.cgi?id=43377 + + No new tests. (No change in behavior) + + * WebCore.exp.in: + + * page/PageGroup.cpp: + (WebCore::PageGroup::addVisitedLinkHash): + * page/PageGroup.h: + +2010-08-02 Martin Robinson <mrobinson@igalia.com> + + Reviewed by Xan Lopez. + + [GTK] Style cleanup for CairoPath.h + https://bugs.webkit.org/show_bug.cgi?id=43133 + + Turn CairoPath into a class, as it has a constructor and destructor. + Change raw member access to use the new accessor. + + No new tests as functionality has not changed. + + * platform/graphics/cairo/CairoPath.h: Cleanup and indentation fix. + (WebCore::CairoPath::CairoPath): + (WebCore::CairoPath::~CairoPath): + (WebCore::CairoPath::context): + * platform/graphics/cairo/GraphicsContextCairo.cpp: + (WebCore::GraphicsContext::addPath): Convert raw member access to accessor access. + (WebCore::GraphicsContext::clip): Ditto. + * platform/graphics/cairo/PathCairo.cpp: + (WebCore::Path::Path): Ditto. + (WebCore::Path::operator=): Ditto. + (WebCore::Path::clear): Ditto. + (WebCore::Path::isEmpty): Ditto. + (WebCore::Path::currentPoint): Ditto. + (WebCore::Path::translate): Ditto. + (WebCore::Path::moveTo): Ditto. + (WebCore::Path::addLineTo): Ditto. + (WebCore::Path::addRect): Ditto. + (WebCore::Path::addQuadCurveTo): Ditto. + (WebCore::Path::addBezierCurveTo): Ditto. + (WebCore::Path::addArc): Ditto. + (WebCore::Path::addArcTo): Ditto. + (WebCore::Path::addEllipse): Ditto. + (WebCore::Path::closeSubpath): Ditto. + (WebCore::Path::boundingRect): Ditto. + (WebCore::Path::strokeBoundingRect): Ditto. + (WebCore::Path::contains): Ditto. + (WebCore::Path::strokeContains): Ditto. + (WebCore::Path::apply): Ditto. + (WebCore::Path::transform): Ditto. + (WebCore::Path::debugString): Ditto. + +2010-07-20 Ojan Vafai <ojan@chromium.org> + + Reviewed by Eric Seidel. + + focusing the body of a contentEditable iframe resets the selection + https://bugs.webkit.org/show_bug.cgi?id=42645 + + The selection shouldn't be reset to the beginning of the rootEditableElement + if it is already inside the rootEditableElement. + + Test: editing/selection/focus-contenteditable-iframe.html + + * dom/Element.cpp: + (WebCore::Element::updateFocusAppearance): + +2010-07-20 Ojan Vafai <ojan@chromium.org> + + Reviewed by Eric Seidel. + + focusing an unfocused contentEditable element should place the cursor at the beginning + https://bugs.webkit.org/show_bug.cgi?id=42646 + + r14666 made this change for the body and html elements, but not for all contentEditable + elements. Doing this for all contentEditable elements matches all other browsers. + + * dom/Element.cpp: + (WebCore::Element::updateFocusAppearance): + +2010-08-02 Ryosuke Niwa <rniwa@webkit.org> + + Reviewed by Kent Tamura. + + Group functions used in createMarkup (range version) into a class so they are easier to understand + https://bugs.webkit.org/show_bug.cgi?id=43227 + + Added MarkupAccumulatorWrapper to group getStartMarkup, getEndMarkup, joinMarkups, and addStyleMarkup. + MarkupAccumulatorWrapper is intended to be merged with MarkupAccumulator in the future. + + No new tests added since this is a clean up. + + * editing/markup.cpp: + (WebCore::MarkupAccumulatorWrapper::MarkupAccumulatorWrapper): Added. + (WebCore::MarkupAccumulatorWrapper::insertString): Added. + (WebCore::MarkupAccumulatorWrapper::insertOpenTag): Added. + (WebCore::MarkupAccumulatorWrapper::insertEndTag): Added. + (WebCore::MarkupAccumulatorWrapper::wrapWithNode): Added. + (WebCore::MarkupAccumulatorWrapper::wrapWithStyleNode): Added. + (WebCore::MarkupAccumulatorWrapper::takeResults): Added. + (WebCore::createMarkup): Uses MarkupAccumulatorWrapper. + +2010-08-02 Brian Weinstein <bweinstein@apple.com> + + Add a missing </File> tag to WebCore.vcproj. + + * WebCore.vcproj/WebCore.vcproj: + +2010-08-02 Mario Sanchez Prada <msanchez@igalia.com> + + Reviewed by Chris Fleizach. + + [GTK] Implement support for get_character_extents and get_range_extents + https://bugs.webkit.org/show_bug.cgi?id=25677 + + Implement get_range_extents() and modify get_character_extents() + to properly work after "The Great Flattening" occurred in the ATK + objects hierarchy, some months ago. + + In the case of the GTK port, not just the text controls should be + considered when it comes to these functions but also those + composite objects that would also allow to work with text ranges, + such as headings and links. To take care of this, a new function + AccessibilityObject::allowsTextRanges() was defined with a default + implementation in the header file and an specific one for GTK in + AccessibilityObjectAtk.cpp. + + Based on a previous patch by Joanmarie Diggs. + + * accessibility/AccessibilityObject.cpp: + (WebCore::AccessibilityObject::visiblePositionRangeForRange): + * accessibility/AccessibilityObject.h: + (WebCore::AccessibilityObject::allowsTextRanges): New + * accessibility/AccessibilityRenderObject.cpp: + (WebCore::AccessibilityRenderObject::visiblePositionForIndex): + (WebCore::AccessibilityRenderObject::doAXBoundsForRange): + * accessibility/gtk/AccessibilityObjectAtk.cpp: + (WebCore::AccessibilityObject::allowsTextRanges): New + * accessibility/gtk/AccessibilityObjectWrapperAtk.cpp: + (textExtents): + (webkit_accessible_text_get_character_extents): + (webkit_accessible_text_get_range_extents): + (atk_text_interface_init): + +2010-08-02 Chris Fleizach <cfleizach@apple.com> + + AX: Support methods for web apps to interact with the native accessibility APIs + https://bugs.webkit.org/show_bug.cgi?id=43005 + + Fix for windows build. No review. + + * WebCore.vcproj/WebCore.vcproj: + +2010-08-02 Chris Fleizach <cfleizach@apple.com> + + Reviewed by David Kilzer. + + AX: Support methods for web apps to interact with the native accessibility APIs + https://bugs.webkit.org/show_bug.cgi?id=43005 + + Adds a new "accessibility" object that hangs off of "window.navigator". + This accessibility object will allow web apps to interact with native accessibility APIs + to provide a richer experience (for screen reader users primarily). + + Test: platform/mac/accessibility/js-accessibility.html + + * Android.derived.v8bindings.mk: + * Android.jscbindings.mk: + * DerivedSources.cpp: + * DerivedSources.make: + * GNUmakefile.am: + * WebCore.gypi: + * WebCore.pri: + * WebCore.pro: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * accessibility/AXObjectCache.h: + (WebCore::AXObjectCache::): + * accessibility/Accessibility.cpp: Added. + (WebCore::Accessibility::Accessibility): + (WebCore::Accessibility::~Accessibility): + (WebCore::Accessibility::disconnectFrame): + (WebCore::Accessibility::screenChanged): + (WebCore::Accessibility::elementsChanged): + (WebCore::Accessibility::screenReader): + * accessibility/Accessibility.h: Added. + (WebCore::Accessibility::create): + * accessibility/Accessibility.idl: Added. + * accessibility/AccessibilityObject.h: + (WebCore::AccessibilityObject::isScreenReaderRunning): + (WebCore::AccessibilityObject::screenReaderFocusedElement): + (WebCore::AccessibilityObject::screenReaderVersion): + * accessibility/ScreenReader.cpp: Added. + (WebCore::ScreenReader::ScreenReader): + (WebCore::ScreenReader::~ScreenReader): + (WebCore::ScreenReader::disconnectFrame): + (WebCore::ScreenReader::active): + (WebCore::ScreenReader::activeElement): + (WebCore::ScreenReader::version): + * accessibility/ScreenReader.h: Added. + (WebCore::ScreenReader::create): + * accessibility/ScreenReader.idl: Added. + * accessibility/mac/AXObjectCacheMac.mm: + (WebCore::AXObjectCache::postPlatformNotification): + * accessibility/mac/AccessibilityObjectMac.mm: + (WebCore::AccessibilityObject::isScreenReaderRunning): + (WebCore::AccessibilityObject::screenReaderFocusedElement): + (WebCore::AccessibilityObject::screenReaderVersion): + * page/Navigator.cpp: + (WebCore::Navigator::disconnectFrame): + (WebCore::Navigator::accessibility): + * page/Navigator.h: + * page/Navigator.idl: + +2010-08-02 Martin Robinson <mrobinson@igalia.com> + + Reviewed by Xan Lopez. + + [Gtk] DOM listeners get wrong keycodes for some keys + https://bugs.webkit.org/show_bug.cgi?id=35170 + + Emit the proper DOM keyCode for the print screen, keypad insert, + and keypad delete keys. + + * platform/gtk/KeyEventGtk.cpp: + (WebCore::windowsKeyCodeForKeyEvent): Fix mapping between GDK key codes + and Windows key codes. + +2010-08-02 Dirk Schulze <krit@webkit.org> + + Unreviewed sort of XCode project file. + + * WebCore.xcodeproj/project.pbxproj: + +2010-08-02 Kristian Monsen <kristianm@google.com> + + Reviewed by Steve Block. + + Compile fix for Android, adding guards around filter specific code. + https://bugs.webkit.org/show_bug.cgi?id=43338 + This CL introduced the code: + http://trac.webkit.org/changeset/64196 + + Compile fix only, no new tests. + + * rendering/SVGResourcesCycleSolver.cpp: + (WebCore::SVGResourcesCycleSolver::breakCycle): + +2010-08-02 Kristian Monsen <kristianm@google.com> + + Reviewed by Steve Block. + + Compile fix for Android, guard inspector code with ENABLE(INSPECTOR). + https://bugs.webkit.org/show_bug.cgi?id=43345 + Code introduced in this CL: + http://trac.webkit.org/changeset/63891 + + No new tests, just a compile fix. + + * bindings/v8/ScriptValue.cpp: + +2010-08-02 Jeremy Orlow <jorlow@chromium.org> + + Speculative revert of 64425 due to Chromium instability + https://bugs.webkit.org/show_bug.cgi?id=43347 + + * GNUmakefile.am: + * WebCore.exp.in: + * WebCore.gypi: + * WebCore.pro: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * loader/EmptyClients.h: + * page/Chrome.cpp: + * page/Chrome.h: + * page/ChromeClient.h: + * platform/PopupMenu.h: + (WebCore::PopupMenu::create): + (WebCore::PopupMenu::disconnectClient): + (WebCore::PopupMenu::client): + (WebCore::PopupMenu::scrollbar): + (WebCore::PopupMenu::itemHeight): + (WebCore::PopupMenu::windowRect): + (WebCore::PopupMenu::popupHandle): + (WebCore::PopupMenu::setWasClicked): + (WebCore::PopupMenu::wasClicked): + (WebCore::PopupMenu::setScrollOffset): + (WebCore::PopupMenu::scrollOffset): + (WebCore::PopupMenu::wheelDelta): + (WebCore::PopupMenu::scrollbarCapturingMouse): + (WebCore::PopupMenu::setScrollbarCapturingMouse): + (WebCore::PopupMenu::isActive): + (WebCore::PopupMenu::scrollbarCornerPresent): + * platform/SearchPopupMenu.h: + (WebCore::SearchPopupMenu::create): + * platform/brew/PopupMenuBrew.cpp: + (WebCore::PopupMenu::PopupMenu): + (WebCore::PopupMenu::~PopupMenu): + (WebCore::PopupMenu::show): + (WebCore::PopupMenu::hide): + (WebCore::PopupMenu::updateFromElement): + (WebCore::PopupMenu::itemWritingDirectionIsNatural): + * platform/brew/PopupMenuBrew.h: Removed. + * platform/brew/SearchPopupMenuBrew.cpp: + (WebCore::SearchPopupMenu::saveRecentSearches): + (WebCore::SearchPopupMenu::loadRecentSearches): + (WebCore::SearchPopupMenu::SearchPopupMenu): + (WebCore::SearchPopupMenu::enabled): + * platform/brew/SearchPopupMenuBrew.h: Removed. + * platform/chromium/PopupMenuChromium.cpp: + (WebCore::PopupMenu::PopupMenu): + (WebCore::PopupMenu::~PopupMenu): + (WebCore::PopupMenu::show): + (WebCore::PopupMenu::hide): + (WebCore::PopupMenu::updateFromElement): + (WebCore::PopupMenu::itemWritingDirectionIsNatural): + * platform/chromium/PopupMenuChromium.h: + * platform/chromium/SearchPopupMenuChromium.cpp: + (WebCore::SearchPopupMenu::SearchPopupMenu): + (WebCore::SearchPopupMenu::enabled): + (WebCore::SearchPopupMenu::saveRecentSearches): + (WebCore::SearchPopupMenu::loadRecentSearches): + * platform/chromium/SearchPopupMenuChromium.h: Removed. + * platform/efl/PopupMenuEfl.cpp: + (WebCore::PopupMenu::PopupMenu): + (WebCore::PopupMenu::~PopupMenu): + (WebCore::PopupMenu::show): + (WebCore::PopupMenu::hide): + (WebCore::PopupMenu::updateFromElement): + (WebCore::PopupMenu::itemWritingDirectionIsNatural): + * platform/efl/PopupMenuEfl.h: Removed. + * platform/efl/SearchPopupMenuEfl.cpp: + (WebCore::SearchPopupMenu::SearchPopupMenu): + (WebCore::SearchPopupMenu::saveRecentSearches): + (WebCore::SearchPopupMenu::loadRecentSearches): + (WebCore::SearchPopupMenu::enabled): + * platform/efl/SearchPopupMenuEfl.h: Removed. + * platform/gtk/PopupMenuGtk.cpp: + (WebCore::PopupMenu::PopupMenu): + (WebCore::PopupMenu::~PopupMenu): + (WebCore::PopupMenu::show): + (WebCore::PopupMenu::hide): + (WebCore::PopupMenu::updateFromElement): + (WebCore::PopupMenu::itemWritingDirectionIsNatural): + (WebCore::PopupMenu::menuItemActivated): + (WebCore::PopupMenu::menuUnmapped): + (WebCore::PopupMenu::menuPositionFunction): + (WebCore::PopupMenu::menuRemoveItem): + * platform/gtk/PopupMenuGtk.h: Removed. + * platform/gtk/SearchPopupMenuGtk.cpp: + (WebCore::SearchPopupMenu::SearchPopupMenu): + (WebCore::SearchPopupMenu::saveRecentSearches): + (WebCore::SearchPopupMenu::loadRecentSearches): + (WebCore::SearchPopupMenu::enabled): + * platform/gtk/SearchPopupMenuGtk.h: Removed. + * platform/haiku/PopupMenuHaiku.cpp: + (WebCore::PopupMenuHaiku::PopupMenuHaiku): + (WebCore::PopupMenuHaiku::~PopupMenuHaiku): + (WebCore::PopupMenu::PopupMenu): + (WebCore::PopupMenu::~PopupMenu): + (WebCore::PopupMenu::show): + (WebCore::PopupMenu::hide): + (WebCore::PopupMenu::updateFromElement): + (WebCore::PopupMenu::itemWritingDirectionIsNatural): + * platform/haiku/PopupMenuHaiku.h: Removed. + * platform/haiku/SearchPopupMenuHaiku.cpp: + (WebCore::SearchPopupMenu::SearchPopupMenu): + (WebCore::SearchPopupMenu::saveRecentSearches): + (WebCore::SearchPopupMenu::loadRecentSearches): + (WebCore::SearchPopupMenu::enabled): + * platform/haiku/SearchPopupMenuHaiku.h: Removed. + * platform/mac/PopupMenuMac.h: Removed. + * platform/mac/PopupMenuMac.mm: + (WebCore::PopupMenu::PopupMenu): + (WebCore::PopupMenu::~PopupMenu): + (WebCore::PopupMenu::clear): + (WebCore::PopupMenu::populate): + (WebCore::PopupMenu::show): + (WebCore::PopupMenu::hide): + (WebCore::PopupMenu::updateFromElement): + (WebCore::PopupMenu::itemWritingDirectionIsNatural): + * platform/mac/SearchPopupMenuMac.h: Removed. + * platform/mac/SearchPopupMenuMac.mm: + (WebCore::SearchPopupMenu::SearchPopupMenu): + (WebCore::SearchPopupMenu::enabled): + (WebCore::SearchPopupMenu::saveRecentSearches): + (WebCore::SearchPopupMenu::loadRecentSearches): + * platform/qt/PopupMenuQt.cpp: + (WebCore::PopupMenu::PopupMenu): + (WebCore::PopupMenu::~PopupMenu): + (WebCore::PopupMenu::show): + (WebCore::PopupMenu::hide): + (WebCore::PopupMenu::updateFromElement): + (WebCore::PopupMenu::itemWritingDirectionIsNatural): + * platform/qt/PopupMenuQt.h: Removed. + * platform/qt/QtAbstractWebPopup.h: + * platform/qt/SearchPopupMenuQt.cpp: + (WebCore::SearchPopupMenu::SearchPopupMenu): + (WebCore::SearchPopupMenu::saveRecentSearches): + (WebCore::SearchPopupMenu::loadRecentSearches): + (WebCore::SearchPopupMenu::enabled): + * platform/qt/SearchPopupMenuQt.h: Removed. + * platform/win/PopupMenuWin.cpp: + (WebCore::PopupMenu::PopupMenu): + (WebCore::PopupMenu::~PopupMenu): + (WebCore::PopupMenu::popupClassName): + (WebCore::PopupMenu::show): + (WebCore::PopupMenu::hide): + (WebCore::PopupMenu::calculatePositionAndSize): + (WebCore::PopupMenu::setFocusedIndex): + (WebCore::PopupMenu::visibleItems): + (WebCore::PopupMenu::listIndexAtPoint): + (WebCore::PopupMenu::focusedIndex): + (WebCore::PopupMenu::focusFirst): + (WebCore::PopupMenu::focusLast): + (WebCore::PopupMenu::down): + (WebCore::PopupMenu::up): + (WebCore::PopupMenu::invalidateItem): + (WebCore::PopupMenu::clientRect): + (WebCore::PopupMenu::incrementWheelDelta): + (WebCore::PopupMenu::reduceWheelDelta): + (WebCore::PopupMenu::scrollToRevealSelection): + (WebCore::PopupMenu::updateFromElement): + (WebCore::PopupMenu::itemWritingDirectionIsNatural): + (WebCore::PopupMenu::paint): + (WebCore::PopupMenu::valueChanged): + (WebCore::PopupMenu::invalidateScrollbarRect): + (WebCore::PopupMenu::registerClass): + (WebCore::PopupMenu::PopupMenuWndProc): + (WebCore::PopupMenu::wndProc): + * platform/win/PopupMenuWin.h: Removed. + * platform/win/SearchPopupMenuWin.cpp: + (WebCore::SearchPopupMenu::SearchPopupMenu): + (WebCore::SearchPopupMenu::enabled): + (WebCore::SearchPopupMenu::saveRecentSearches): + (WebCore::SearchPopupMenu::loadRecentSearches): + * platform/win/SearchPopupMenuWin.h: Removed. + * platform/wx/PopupMenuWx.cpp: + (WebCore::PopupMenu::PopupMenu): + (WebCore::PopupMenu::~PopupMenu): + (WebCore::PopupMenu::show): + (WebCore::PopupMenu::OnMenuItemSelected): + (WebCore::PopupMenu::hide): + (WebCore::PopupMenu::updateFromElement): + (WebCore::PopupMenu::itemWritingDirectionIsNatural): + * platform/wx/PopupMenuWx.h: Removed. + * platform/wx/SearchPopupMenuWx.cpp: + (WebCore::SearchPopupMenu::SearchPopupMenu): + (WebCore::SearchPopupMenu::saveRecentSearches): + (WebCore::SearchPopupMenu::loadRecentSearches): + (WebCore::SearchPopupMenu::enabled): + * platform/wx/SearchPopupMenuWx.h: Removed. + * rendering/RenderMenuList.cpp: + (WebCore::RenderMenuList::adjustInnerStyle): + (WebCore::RenderMenuList::showPopup): + * rendering/RenderMenuList.h: + * rendering/RenderTextControlSingleLine.cpp: + (WebCore::RenderTextControlSingleLine::~RenderTextControlSingleLine): + (WebCore::RenderTextControlSingleLine::addSearchResult): + (WebCore::RenderTextControlSingleLine::showPopup): + (WebCore::RenderTextControlSingleLine::hidePopup): + (WebCore::RenderTextControlSingleLine::updateFromElement): + (WebCore::RenderTextControlSingleLine::valueChanged): + * rendering/RenderTextControlSingleLine.h: + +2010-08-02 Markus Goetz <Markus.Goetz@nokia.com> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Do not link to SharedBufferCF.cpp + The Qt port does not need this file. + We plan to implement the platformData() + for SharedBuffer at some point soon. + https://bugs.webkit.org/show_bug.cgi?id=43242 + + * WebCore.pro: + * platform/SharedBuffer.cpp: + +2010-08-02 Balazs Kelemen <kb@inf.u-szeged.hu> + + Reviewed by Simon Hausmann. + + [Qt] Generate forwarding headers for WebKit2 + + https://bugs.webkit.org/show_bug.cgi?id=43336 + + * WebCore.pri: Removed header copying logic. + * WebCore.pro: Add include paths for WebKit2. + +2010-08-02 Andrey Kosyakov <caseq@chromium.org> + + Reviewed by Pavel Feldman. + + Web Inspector: adding experimental support for WebInspector extensions API. + https://bugs.webkit.org/show_bug.cgi?id=40425 + + Tests: inspector/extensions-api.html + inspector/extensions.html + + * WebCore.gypi: + * WebCore.vcproj/WebCore.vcproj: + * inspector/InspectorController.cpp: + (WebCore::InspectorController::inspectedWindowScriptObjectCleared): + (WebCore::InspectorController::didCommitLoad): + * inspector/InspectorFrontendHost.cpp: + (WebCore::InspectorFrontendHost::setExtensionAPI): + * inspector/InspectorFrontendHost.h: + * inspector/InspectorFrontendHost.idl: + * inspector/front-end/ElementsPanel.js: + (WebInspector.ElementsPanel.this.treeOutline.focusedNodeChanged): + (WebInspector.ElementsPanel): + * inspector/front-end/ExtensionAPI.js: Added. An API implementation that gets injected into the extension context. + (injectedExtensionAPI): + (injectedExtensionAPI.EventSinkImpl.prototype.addListener): + (injectedExtensionAPI.EventSinkImpl.prototype.removeListener): + (injectedExtensionAPI.EventSinkImpl.prototype._fire): + (injectedExtensionAPI.EventSink): + (injectedExtensionAPI.InspectorExtensionAPI): + (injectedExtensionAPI.InspectorExtensionAPI.prototype.log): + (injectedExtensionAPI.Resources.prototype.getAll): + (injectedExtensionAPI.Resources.prototype.get return): + (injectedExtensionAPI.Resources.prototype): + (injectedExtensionAPI.Panels): + (injectedExtensionAPI.Panels.prototype.create.callbackWrapper): + (injectedExtensionAPI.Panels.prototype.create): + (injectedExtensionAPI.PanelImpl): + (injectedExtensionAPI.PanelImpl.prototype.createSidebarPane.callbackWrapper): + (injectedExtensionAPI.PanelImpl.prototype.createSidebarPane): + (injectedExtensionAPI.ExtensionPanel): + (injectedExtensionAPI.ExtensionSidebarPaneImpl): + (injectedExtensionAPI.ExtensionSidebarPaneImpl.prototype.setHeight): + (injectedExtensionAPI.ExtensionSidebarPaneImpl.prototype.setExpanded): + (injectedExtensionAPI.InspectedWindow): + (injectedExtensionAPI.InspectedWindow.prototype.reload): + (injectedExtensionAPI.InspectedWindow.prototype.evaluate): + (injectedExtensionAPI.ExtensionServerClient.prototype.sendRequest): + (injectedExtensionAPI.ExtensionServerClient.prototype.registerHandler): + (injectedExtensionAPI.ExtensionServerClient.prototype.nextObjectId): + (injectedExtensionAPI.ExtensionServerClient.prototype._registerCallback): + (injectedExtensionAPI.ExtensionServerClient.prototype._onCallback): + (injectedExtensionAPI.ExtensionServerClient.prototype._onMessage): + (injectedExtensionAPI.expandURL): + (injectedExtensionAPI.): + * inspector/front-end/ExtensionPanel.js: Added. A class that provides WebInspector's Panel interface to the inspector, hosts extension panel within an IFrame and proxies Panel callbacks to the extension. + (WebInspector.ExtensionPanel): + (WebInspector.ExtensionPanel.prototype.get defaultFocusedElement): + (WebInspector.ExtensionPanel.prototype.updateMainViewWidth): + (WebInspector.ExtensionPanel.prototype.searchCanceled): + (WebInspector.ExtensionPanel.prototype.performSearch): + (WebInspector.ExtensionPanel.prototype.jumpToNextSearchResult): + (WebInspector.ExtensionPanel.prototype.jumpToPreviousSearchResult): + (WebInspector.ExtensionPanel.prototype._addStyleRule): + * inspector/front-end/ExtensionRegistryStub.js: Added. A stub for ExtensionRegistry class that is meant to provide a list of extensions. Actual implementations may be browser-specfic. + (.WebInspector.InspectorExtensionRegistryStub): + (.WebInspector.InspectorExtensionRegistryStub.prototype.getExtensionsAsync): + * inspector/front-end/ExtensionServer.js: Added. Communicates with ExtensionAPI via DOM messaging and proxies requests to WebInspector classes. + (WebInspector.ExtensionServer): + (WebInspector.ExtensionServer.prototype.notifyPanelShown): + (WebInspector.ExtensionServer.prototype.notifyObjectSelected): + (WebInspector.ExtensionServer.prototype.notifyResourceFinished): + (WebInspector.ExtensionServer.prototype.notifySearchAction): + (WebInspector.ExtensionServer.prototype.notifyInspectedPageLoaded): + (WebInspector.ExtensionServer.prototype.notifyInspectedURLChanged): + (WebInspector.ExtensionServer.prototype.notifyInspectorReset): + (WebInspector.ExtensionServer.prototype._convertResource): + (WebInspector.ExtensionServer.prototype._postNotification): + (WebInspector.ExtensionServer.prototype._onSubscribe): + (WebInspector.ExtensionServer.prototype._onUnsubscribe): + (WebInspector.ExtensionServer.prototype._onCreatePanel): + (WebInspector.ExtensionServer.prototype._onCreateSidebar): + (WebInspector.ExtensionServer.prototype._createClientIframe): + (WebInspector.ExtensionServer.prototype._onSetSidebarHeight): + (WebInspector.ExtensionServer.prototype._onSetSidebarExpansion): + (WebInspector.ExtensionServer.prototype._onLog): + (WebInspector.ExtensionServer.prototype._onEvaluateOnInspectedPage): + (WebInspector.ExtensionServer.prototype._onRevealAndSelect): + (WebInspector.ExtensionServer.prototype._onRevealAndSelectResource): + (WebInspector.ExtensionServer.prototype._dispatchCallback): + (WebInspector.ExtensionServer.prototype._onGetResources): + (WebInspector.ExtensionServer.prototype.initExtensions): + (WebInspector.ExtensionServer.prototype._addExtensions): + (WebInspector.ExtensionServer.prototype._onWindowMessage): + (WebInspector.ExtensionServer.prototype._onmessage): + (WebInspector.ExtensionServer.prototype._registerHandler): + (WebInspector.ExtensionStatus): + (WebInspector.addExtensions): + * inspector/front-end/InjectedScript.js: + (injectedScriptConstructor): + * inspector/front-end/InjectedScriptAccess.js: + * inspector/front-end/InspectorFrontendHostStub.js: + (.WebInspector.InspectorFrontendHostStub.prototype.setExtensionAPI): + (.WebInspector.InspectorFrontendHostStub.prototype.canAttachWindow): + * inspector/front-end/WebKit.qrc: + * inspector/front-end/inspector.html: + * inspector/front-end/inspector.js: + (WebInspector.loaded): + (WebInspector.updateResource): + (WebInspector.reset): + (WebInspector.inspectedURLChanged): + (WebInspector.didCommitLoad): + +2010-08-02 Ilya Tikhonovsky <loislo@chromium.org> + + Reviewed by Yury Semikhatsky. + + WebInspector: Inspector is not working when it is loaded as html page. + https://bugs.webkit.org/show_bug.cgi?id=43334 + + * inspector/front-end/InspectorFrontendHostStub.js: + (.WebInspector.InspectorFrontendHostStub.prototype.canAttachWindow): + (.WebInspector.InspectorFrontendHostStub.prototype.sendMessageToBackend): + +2010-08-01 Nikolas Zimmermann <nzimmermann@rim.com> + + Reviewed by Dirk Schulze. + + SVG gradients do not update when scripted via xlink + https://bugs.webkit.org/show_bug.cgi?id=42953 + + Unify cycle detection logic for chainable (through xlink:href) and ordinary resources. + All operate on the render tree now, instead of falling back to the DOM tree for xlink:href queries. + + When linking resources, register as regular client, so the regular update mechanisms work as expected. + <linearGradient id="foo"><stop../> </linearGradient> + <linearGradient id="bar" xlink:href="#foo"/> + <rect fill="url(#bar)"/> + + Without that the rect won't receive invalidation notifications, as foo <-> bar had no connection. + Fixes the last outstanding class of invalidations. Also speeds up the cycle detetion, when using chained resources, + as no SVG DOM queries have to be executed anymore. + + Test: svg/custom/js-update-stop-linked-gradient.svg + + * rendering/RenderSVGResourceContainer.cpp: + (WebCore::RenderSVGResourceContainer::markAllClientsForInvalidation): + (WebCore::linkedResourceForContainer): + * rendering/SVGResources.cpp: + (WebCore::SVGResources::SVGResources): + (WebCore::chainableResourceTags): + (WebCore::targetReferenceFromResource): + (WebCore::registerPendingResource): + (WebCore::SVGResources::buildCachedResources): + (WebCore::SVGResources::invalidateClient): + (WebCore::SVGResources::resourceDestroyed): + (WebCore::SVGResources::buildSetOfResources): + (WebCore::SVGResources::setLinkedResource): + (WebCore::SVGResources::resetLinkedResource): + (WebCore::SVGResources::dump): + * rendering/SVGResources.h: + (WebCore::SVGResources::linkedResource): + * rendering/SVGResourcesCycleSolver.cpp: + (WebCore::SVGResourcesCycleSolver::resolveCycles): + (WebCore::SVGResourcesCycleSolver::breakCycle): + * rendering/SVGResourcesCycleSolver.h: + * svg/SVGFilterElement.cpp: + (WebCore::SVGFilterElement::SVGFilterElement): + * svg/SVGFilterElement.h: + * svg/SVGGradientElement.cpp: + (WebCore::SVGGradientElement::SVGGradientElement): + * svg/SVGGradientElement.h: + * svg/SVGLinearGradientElement.cpp: + (WebCore::SVGLinearGradientElement::collectGradientProperties): + * svg/SVGPatternElement.cpp: + (WebCore::SVGPatternElement::SVGPatternElement): + (WebCore::SVGPatternElement::collectPatternProperties): + * svg/SVGPatternElement.h: + * svg/SVGRadialGradientElement.cpp: + (WebCore::SVGRadialGradientElement::collectGradientProperties): + +2010-07-31 Dan Bernstein <mitz@apple.com> + + Try to fix the Windows build when zlib is not available. + + * platform/graphics/WOFFFileFormat.cpp: + +2010-07-31 Dan Bernstein <mitz@apple.com> + + Try to fix the Windows build when zlib is not available. + + * platform/graphics/WOFFFileFormat.cpp: + +2010-07-31 Dan Bernstein <mitz@apple.com> + + Try to fix the Windows build when zlib is not available. + + * platform/graphics/WOFFFileFormat.cpp: + +2010-07-31 Dan Bernstein <mitz@apple.com> + + Fix typo in attempted build fix. + + * platform/graphics/WOFFFileFormat.cpp: + +2010-07-31 Dan Bernstein <mitz@apple.com> + + Try to fix the Windows build when zlib is not available. + + * platform/graphics/WOFFFileFormat.cpp: + +2010-07-31 Dan Bernstein <mitz@apple.com> + + Reviewed by Darin Adler. + + <rdar://problem/8234766> Add WOFF support for @font-face + https://bugs.webkit.org/show_bug.cgi?id=31302 + + * WebCore.vcproj/WebCore.vcproj: Added WOFFFileFormat.{cpp,h}. + * WebCore.vcproj/WebCoreCommon.vsprops: Added $(WebKitLibraries)\include\zlib to the header search path. + * WebCore.xcodeproj/project.pbxproj: Added WOFFFileFormat.{cpp,h} and linking against libz. + * css/CSSFontFaceSrcValue.cpp: + (WebCore::CSSFontFaceSrcValue::isSupportedFormat): Replaced hard-coded list of supported formats with + call to FontCustomPlatformData::supportsFormat(). + * platform/graphics/WOFFFileFormat.cpp: Added. + (WebCore::isWOFF): Checks if the buffer has the WOFF signature. + (WebCore::convertWOFFToSfnt): Extracts the sfnt payload of a WOFF package. + * platform/graphics/WOFFFileFormat.h: Added. + * platform/graphics/cairo/FontCustomPlatformData.cpp: + (WebCore::FontCustomPlatformData::supportsFormat): Added. Returns true for truetype and opentype. + * platform/graphics/cairo/FontCustomPlatformData.h: + * platform/graphics/chromium/FontCustomPlatformData.cpp: + (WebCore::FontCustomPlatformData::supportsFormat): Added. Returns true for truetype and opentype, + and also for woff if the OpenType sanitizer is enabled. + * platform/graphics/chromium/FontCustomPlatformData.h: + * platform/graphics/gtk/FontCustomPlatformDataPango.cpp: + (WebCore::FontCustomPlatformData::supportsFormat): Added. Returns false. + * platform/graphics/haiku/FontCustomPlatformData.cpp: + (WebCore::FontCustomPlatformData::supportsFormat): Ditto. + * platform/graphics/haiku/FontCustomPlatformData.h: + * platform/graphics/mac/FontCustomPlatformData.cpp: + (WebCore::freeSfntData): + (WebCore::createFontCustomPlatformData): If the OpenType font sanitizer is not enabled, use convertWOFFToSfnt(). + (WebCore::FontCustomPlatformData::supportsFormat): Added. Returns true for truetype, opentype and woff. + * platform/graphics/mac/FontCustomPlatformData.h: + * platform/graphics/qt/FontCustomPlatformData.h: + * platform/graphics/qt/FontCustomPlatformDataQt.cpp: + (WebCore::FontCustomPlatformData::supportsFormat): Added. Returns true for truetype and opentype. + * platform/graphics/win/FontCustomPlatformData.cpp: + (WebCore::createFontCustomPlatformData): If the OpenType font sanitizer is not enabled, use convertWOFFToSfnt(). + (WebCore::FontCustomPlatformData::supportsFormat): Added. Returns true for truetype, opentype and woff. + * platform/graphics/win/FontCustomPlatformData.h: + * platform/graphics/win/FontCustomPlatformDataCairo.cpp: + (WebCore::FontCustomPlatformData::supportsFormat): Added. Returns true for truetype and opentype. + * platform/graphics/win/FontCustomPlatformDataCairo.h: + * platform/graphics/wince/FontCustomPlatformData.cpp: + (WebCore::FontCustomPlatformData::supportsFormat): Ditto. + * platform/graphics/wince/FontCustomPlatformData.h: + +2010-07-31 Ryosuke Niwa <rniwa@webkit.org> + + Reviewed by Ojan Vafai. + + SplitElementCommand shouldn't be duplicating id attribute + https://bugs.webkit.org/show_bug.cgi?id=27156 + + Modified SplitElementCommand to delete the id attribute from the second element when splitting an element. + Since this causes WebKit not to merge split elements, added shouldSplitElement to ApplyStyleCommand which + determines the necessity of splitting the element. + + To share code between shouldSplitElement and removeInlineStyleFromElement (extracted from applyInlineStyle) + dontRemove was added as the 3rd argument to removeHTMLFontStyle, removeHTMLBidiEmbeddingStyle, and removeCSSStyle. + + Test: editing/style/split-element-id-duplication.html + + * editing/ApplyStyleCommand.cpp: + (WebCore::ApplyStyleCommand::applyBlockStyle): Added 3rd argument for removeCSSStyle. + (WebCore::ApplyStyleCommand::applyInlineStyle): Calls shouldSplitElement. + (WebCore::ApplyStyleCommand::removeInlineStyleFromElement): Extracted from removeInlineStyle. + (WebCore::ApplyStyleCommand::shouldRemoveInlineStyleFromElement): Inline helper for removeInlineStyleFromElement. + (WebCore::ApplyStyleCommand::removeHTMLFontStyle): Added dontRemove. + (WebCore::ApplyStyleCommand::removeHTMLBidiEmbeddingStyle): Added dontRemove. + (WebCore::ApplyStyleCommand::removeCSSStyle): Added dontRemove. + (WebCore::ApplyStyleCommand::removeInlineStyle): Calls removeInlineStyleFromElement. + (WebCore::ApplyStyleCommand::splitTextElementAtStart): Removed the call to splitTextAtStart. + Branching is now done in applyInlineStyle. + (WebCore::ApplyStyleCommand::splitTextElementAtEnd): Ditto for splitTextAtEnd. + (WebCore::ApplyStyleCommand::shouldSplitElement): Added. + * editing/ApplyStyleCommand.h: + * editing/SplitElementCommand.cpp: + (WebCore::SplitElementCommand::executeApply): Deletes the id attribute from the second element. + (WebCore::SplitElementCommand::doUnapply): Recovers the id attribute of the second element. + +2010-07-31 Luiz Agostini <luiz.agostini@openbossa.org> + + Build fix: Windows. + + * platform/win/PopupMenuWin.h: + +2010-07-31 Luiz Agostini <luiz.agostini@openbossa.org> + + Windows build fix. + + * platform/win/PopupMenuWin.cpp: + (WebCore::PopupMenuWin::PopupMenuWndProc): + +2010-07-27 Luiz Agostini <luiz.agostini@openbossa.org> + + Reviewed by Darin Fisher. + + PopupMenu refactoring in preparation to WebKit2 + https://bugs.webkit.org/show_bug.cgi?id=42592 + + Classes PopupMenu and SearchPopupMenu have been made pure virtual. + + * platform/PopupMenu.h: + (WebCore::PopupMenu::~PopupMenu): + * platform/SearchPopupMenu.h: + (WebCore::SearchPopupMenu::~SearchPopupMenu): + + Classes RenderMenuList and RenderTexyControlSingleLine have been changed to use + the new pure virtual PopupMenu and SearchPopupMenu. + + * rendering/RenderMenuList.cpp: + (WebCore::RenderMenuList::adjustInnerStyle): + (WebCore::RenderMenuList::showPopup): + * rendering/RenderMenuList.h: + * rendering/RenderTextControlSingleLine.cpp: + (WebCore::RenderTextControlSingleLine::~RenderTextControlSingleLine): + (WebCore::RenderTextControlSingleLine::addSearchResult): + (WebCore::RenderTextControlSingleLine::showPopup): + (WebCore::RenderTextControlSingleLine::hidePopup): + (WebCore::RenderTextControlSingleLine::updateFromElement): + (WebCore::RenderTextControlSingleLine::valueChanged): + * rendering/RenderTextControlSingleLine.h: + + Chrome and ChromeClient were made responsible for providing instances of classes + PopupMenu and SearchPopupMenu to its users. + + * loader/EmptyClients.h: + (WebCore::EmptyPopupMenu::show): + (WebCore::EmptyPopupMenu::hide): + (WebCore::EmptyPopupMenu::updateFromElement): + (WebCore::EmptyPopupMenu::disconnectClient): + (WebCore::EmptySearchPopupMenu::popupMenu): + (WebCore::EmptySearchPopupMenu::saveRecentSearches): + (WebCore::EmptySearchPopupMenu::loadRecentSearches): + (WebCore::EmptySearchPopupMenu::enabled): + (WebCore::EmptyChromeClient::selectItemWritingDirectionIsNatural): + (WebCore::EmptyChromeClient::createPopupMenu): + (WebCore::EmptyChromeClient::createSearchPopupMenu): + * page/Chrome.cpp: + (WebCore::Chrome::selectItemWritingDirectionIsNatural): + (WebCore::Chrome::createPopupMenu): + (WebCore::Chrome::createSearchPopupMenu): + * page/Chrome.h: + * page/ChromeClient.h: + + Original contents of files PopupMenu.h and SearchPopupMenu.h have been splited + in several files, two for each platform (PopupMenuXXX.h and SearchPopupMenuXXX.h). + Each of new the files contain the concrete classes that inherit form PopupMenu or + SearchPopupMenu and are specific for the corresponding platform. + + brew: + + * platform/brew/PopupMenuBrew.cpp: + (WebCore::PopupMenuBrew::PopupMenuBrew): + (WebCore::PopupMenuBrew::~PopupMenuBrew): + (WebCore::PopupMenuBrew::disconnectClient): + (WebCore::PopupMenuBrew::show): + (WebCore::PopupMenuBrew::hide): + (WebCore::PopupMenuBrew::updateFromElement): + * platform/brew/PopupMenuBrew.h: Added. + (WebCore::PopupMenuBrew::client): + * platform/brew/SearchPopupMenuBrew.cpp: + (WebCore::SearchPopupMenuBrew::saveRecentSearches): + (WebCore::SearchPopupMenuBrew::loadRecentSearches): + (WebCore::SearchPopupMenuBrew::SearchPopupMenuBrew): + (WebCore::SearchPopupMenuBrew::enabled): + (WebCore::SearchPopupMenuBrew::popupMenu): + * platform/brew/SearchPopupMenuBrew.h: Added. + + chromium: + + * WebCore.gypi: + * platform/chromium/PopupMenuChromium.cpp: + (WebCore::PopupMenuChromium::PopupMenuChromium): + (WebCore::PopupMenuChromium::~PopupMenuChromium): + (WebCore::PopupMenuChromium::show): + (WebCore::PopupMenuChromium::hide): + (WebCore::PopupMenuChromium::updateFromElement): + (WebCore::PopupMenuChromium::disconnectClient): + * platform/chromium/PopupMenuChromium.h: + (WebCore::PopupMenuChromium::client): + * platform/chromium/SearchPopupMenuChromium.cpp: + (WebCore::SearchPopupMenuChromium::SearchPopupMenuChromium): + (WebCore::SearchPopupMenuChromium::popupMenu): + (WebCore::SearchPopupMenuChromium::enabled): + (WebCore::SearchPopupMenuChromium::saveRecentSearches): + (WebCore::SearchPopupMenuChromium::loadRecentSearches): + * platform/chromium/SearchPopupMenuChromium.h: Added. + + efl: + + * platform/efl/PopupMenuEfl.cpp: + (WebCore::PopupMenuEfl::PopupMenuEfl): + (WebCore::PopupMenuEfl::~PopupMenuEfl): + (WebCore::PopupMenuEfl::show): + (WebCore::PopupMenuEfl::hide): + (WebCore::PopupMenuEfl::updateFromElement): + (WebCore::PopupMenuEfl::disconnectClient): + * platform/efl/PopupMenuEfl.h: Added. + (WebCore::PopupMenuEfl::client): + * platform/efl/SearchPopupMenuEfl.cpp: + (WebCore::SearchPopupMenuEfl::SearchPopupMenuEfl): + (WebCore::SearchPopupMenuEfl::popupMenu): + (WebCore::SearchPopupMenuEfl::saveRecentSearches): + (WebCore::SearchPopupMenuEfl::loadRecentSearches): + (WebCore::SearchPopupMenuEfl::enabled): + * platform/efl/SearchPopupMenuEfl.h: Added. + + gtk: + + * GNUmakefile.am: + * platform/gtk/PopupMenuGtk.cpp: + (WebCore::PopupMenuGtk::PopupMenuGtk): + (WebCore::PopupMenuGtk::~PopupMenuGtk): + (WebCore::PopupMenuGtk::show): + (WebCore::PopupMenuGtk::hide): + (WebCore::PopupMenuGtk::updateFromElement): + (WebCore::PopupMenuGtk::disconnectClient): + (WebCore::PopupMenuGtk::menuItemActivated): + (WebCore::PopupMenuGtk::menuUnmapped): + (WebCore::PopupMenuGtk::menuPositionFunction): + (WebCore::PopupMenuGtk::menuRemoveItem): + * platform/gtk/PopupMenuGtk.h: Added. + (WebCore::PopupMenuGtk::client): + * platform/gtk/SearchPopupMenuGtk.cpp: + (WebCore::SearchPopupMenuGtk::SearchPopupMenuGtk): + (WebCore::SearchPopupMenuGtk::popupMenu): + (WebCore::SearchPopupMenuGtk::saveRecentSearches): + (WebCore::SearchPopupMenuGtk::loadRecentSearches): + (WebCore::SearchPopupMenuGtk::enabled): + * platform/gtk/SearchPopupMenuGtk.h: Added. + + haiku: + + * platform/haiku/PopupMenuHaiku.cpp: + (WebCore::HaikuPopup::HaikuPopup): + (WebCore::HaikuPopup::~HaikuPopup): + (WebCore::PopupMenuHaiku::PopupMenuHaiku): + (WebCore::PopupMenuHaiku::~PopupMenuHaiku): + (WebCore::PopupMenuHaiku::disconnectClient): + (WebCore::PopupMenuHaiku::show): + (WebCore::PopupMenuHaiku::hide): + (WebCore::PopupMenuHaiku::updateFromElement): + * platform/haiku/PopupMenuHaiku.h: Added. + (WebCore::PopupMenuHaiku::disconnectClient): + (WebCore::PopupMenuHaiku::client): + * platform/haiku/SearchPopupMenuHaiku.cpp: + (WebCore::SearchPopupMenuHaiku::SearchPopupMenuHaiku): + (WebCore::SearchPopupMenuHaiku::saveRecentSearches): + (WebCore::SearchPopupMenuHaiku::loadRecentSearches): + (WebCore::SearchPopupMenuHaiku::enabled): + (WebCore::SearchPopupMenuHaiku::popupMenu): + * platform/haiku/SearchPopupMenuHaiku.h: Added. + + mac: + + * WebCore.exp.in: + * WebCore.xcodeproj/project.pbxproj: + * platform/mac/PopupMenuMac.h: Added. + (WebCore::PopupMenuMac::disconnectClient): + (WebCore::PopupMenuMac::client): + * platform/mac/PopupMenuMac.mm: + (WebCore::PopupMenuMac::PopupMenuMac): + (WebCore::PopupMenuMac::~PopupMenuMac): + (WebCore::PopupMenuMac::clear): + (WebCore::PopupMenuMac::populate): + (WebCore::PopupMenuMac::show): + (WebCore::PopupMenuMac::hide): + (WebCore::PopupMenuMac::updateFromElement): + (WebCore::PopupMenuMac::itemWritingDirectionIsNatural): + * platform/mac/SearchPopupMenuMac.h: Added. + * platform/mac/SearchPopupMenuMac.mm: + (WebCore::SearchPopupMenuMac::SearchPopupMenuMac): + (WebCore::SearchPopupMenuMac::popupMenu): + (WebCore::SearchPopupMenuMac::enabled): + (WebCore::SearchPopupMenuMac::saveRecentSearches): + (WebCore::SearchPopupMenuMac::loadRecentSearches): + + qt: + + * WebCore.pro: + * platform/qt/PopupMenuQt.cpp: + (WebCore::PopupMenuQt::PopupMenuQt): + (WebCore::PopupMenuQt::~PopupMenuQt): + (WebCore::PopupMenuQt::disconnectClient): + (WebCore::PopupMenuQt::show): + (WebCore::PopupMenuQt::hide): + (WebCore::PopupMenuQt::updateFromElement): + * platform/qt/PopupMenuQt.h: Added. + * platform/qt/QtAbstractWebPopup.h: + * platform/qt/SearchPopupMenuQt.cpp: + (WebCore::SearchPopupMenuQt::SearchPopupMenuQt): + (WebCore::SearchPopupMenuQt::popupMenu): + (WebCore::SearchPopupMenuQt::saveRecentSearches): + (WebCore::SearchPopupMenuQt::loadRecentSearches): + (WebCore::SearchPopupMenuQt::enabled): + * platform/qt/SearchPopupMenuQt.h: Added. + + win: + + * WebCore.vcproj/WebCore.vcproj: + * platform/win/PopupMenuWin.cpp: + (WebCore::PopupMenuWin::PopupMenuWin): + (WebCore::PopupMenuWin::~PopupMenuWin): + (WebCore::PopupMenuWin::disconnectClient): + (WebCore::PopupMenuWin::popupClassName): + (WebCore::PopupMenuWin::show): + (WebCore::PopupMenuWin::hide): + (WebCore::PopupMenuWin::calculatePositionAndSize): + (WebCore::PopupMenuWin::setFocusedIndex): + (WebCore::PopupMenuWin::visibleItems): + (WebCore::PopupMenuWin::listIndexAtPoint): + (WebCore::PopupMenuWin::focusedIndex): + (WebCore::PopupMenuWin::focusFirst): + (WebCore::PopupMenuWin::focusLast): + (WebCore::PopupMenuWin::down): + (WebCore::PopupMenuWin::up): + (WebCore::PopupMenuWin::invalidateItem): + (WebCore::PopupMenuWin::clientRect): + (WebCore::PopupMenuWin::incrementWheelDelta): + (WebCore::PopupMenuWin::reduceWheelDelta): + (WebCore::PopupMenuWin::scrollToRevealSelection): + (WebCore::PopupMenuWin::updateFromElement): + (WebCore::PopupMenuWin::paint): + (WebCore::PopupMenuWin::valueChanged): + (WebCore::PopupMenuWin::invalidateScrollbarRect): + (WebCore::PopupMenuWin::registerClass): + (WebCore::PopupMenuWin::PopupMenuWndProc): + (WebCore::PopupMenuWin::wndProc): + * platform/win/PopupMenuWin.h: Added. + (WebCore::PopupMenuWin::client): + (WebCore::PopupMenuWin::scrollbar): + (WebCore::PopupMenuWin::itemHeight): + (WebCore::PopupMenuWin::windowRect): + (WebCore::PopupMenuWin::popupHandle): + (WebCore::PopupMenuWin::setWasClicked): + (WebCore::PopupMenuWin::wasClicked): + (WebCore::PopupMenuWin::setScrollOffset): + (WebCore::PopupMenuWin::scrollOffset): + (WebCore::PopupMenuWin::wheelDelta): + (WebCore::PopupMenuWin::scrollbarCapturingMouse): + (WebCore::PopupMenuWin::setScrollbarCapturingMouse): + * platform/win/SearchPopupMenuWin.cpp: + (WebCore::SearchPopupMenuWin::SearchPopupMenuWin): + (WebCore::SearchPopupMenuWin::popupMenu): + (WebCore::SearchPopupMenuWin::enabled): + (WebCore::SearchPopupMenuWin::saveRecentSearches): + (WebCore::SearchPopupMenuWin::loadRecentSearches): + * platform/win/SearchPopupMenuWin.h: Added. + + wx: + + * platform/wx/PopupMenuWx.cpp: + (WebCore::PopupMenuWx::PopupMenuWx): + (WebCore::PopupMenuWx::~PopupMenuWx): + (WebCore::PopupMenuWx::disconnectClient): + (WebCore::PopupMenuWx::show): + (WebCore::PopupMenuWx::OnMenuItemSelected): + (WebCore::PopupMenuWx::hide): + (WebCore::PopupMenuWx::updateFromElement): + * platform/wx/PopupMenuWx.h: Added. + (WebCore::PopupMenuWx::client): + * platform/wx/SearchPopupMenuWx.cpp: + (WebCore::SearchPopupMenuWx::SearchPopupMenuWx): + (WebCore::SearchPopupMenuWx::saveRecentSearches): + (WebCore::SearchPopupMenuWx::loadRecentSearches): + (WebCore::SearchPopupMenuWx::enabled): + (WebCore::SearchPopupMenuWx::popupMenu): + * platform/wx/SearchPopupMenuWx.h: Added. + + + +2010-07-31 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r64422. + http://trac.webkit.org/changeset/64422 + https://bugs.webkit.org/show_bug.cgi?id=43304 + + Build fixes are needed for Snow Leopard and Windows. + (Requested by lca on #webkit). + + * GNUmakefile.am: + * WebCore.exp.in: + * WebCore.gypi: + * WebCore.pro: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * loader/EmptyClients.h: + * page/Chrome.cpp: + * page/Chrome.h: + * page/ChromeClient.h: + * platform/PopupMenu.h: + (WebCore::PopupMenu::create): + (WebCore::PopupMenu::disconnectClient): + (WebCore::PopupMenu::client): + (WebCore::PopupMenu::scrollbar): + (WebCore::PopupMenu::itemHeight): + (WebCore::PopupMenu::windowRect): + (WebCore::PopupMenu::popupHandle): + (WebCore::PopupMenu::setWasClicked): + (WebCore::PopupMenu::wasClicked): + (WebCore::PopupMenu::setScrollOffset): + (WebCore::PopupMenu::scrollOffset): + (WebCore::PopupMenu::wheelDelta): + (WebCore::PopupMenu::scrollbarCapturingMouse): + (WebCore::PopupMenu::setScrollbarCapturingMouse): + (WebCore::PopupMenu::isActive): + (WebCore::PopupMenu::scrollbarCornerPresent): + * platform/SearchPopupMenu.h: + (WebCore::SearchPopupMenu::create): + * platform/brew/PopupMenuBrew.cpp: + (WebCore::PopupMenu::PopupMenu): + (WebCore::PopupMenu::~PopupMenu): + (WebCore::PopupMenu::show): + (WebCore::PopupMenu::hide): + (WebCore::PopupMenu::updateFromElement): + (WebCore::PopupMenu::itemWritingDirectionIsNatural): + * platform/brew/PopupMenuBrew.h: Removed. + * platform/brew/SearchPopupMenuBrew.cpp: + (WebCore::SearchPopupMenu::saveRecentSearches): + (WebCore::SearchPopupMenu::loadRecentSearches): + (WebCore::SearchPopupMenu::SearchPopupMenu): + (WebCore::SearchPopupMenu::enabled): + * platform/brew/SearchPopupMenuBrew.h: Removed. + * platform/chromium/PopupMenuChromium.cpp: + (WebCore::PopupMenu::PopupMenu): + (WebCore::PopupMenu::~PopupMenu): + (WebCore::PopupMenu::show): + (WebCore::PopupMenu::hide): + (WebCore::PopupMenu::updateFromElement): + (WebCore::PopupMenu::itemWritingDirectionIsNatural): + * platform/chromium/PopupMenuChromium.h: + * platform/chromium/SearchPopupMenuChromium.cpp: + (WebCore::SearchPopupMenu::SearchPopupMenu): + (WebCore::SearchPopupMenu::enabled): + (WebCore::SearchPopupMenu::saveRecentSearches): + (WebCore::SearchPopupMenu::loadRecentSearches): + * platform/chromium/SearchPopupMenuChromium.h: Removed. + * platform/efl/PopupMenuEfl.cpp: + (WebCore::PopupMenu::PopupMenu): + (WebCore::PopupMenu::~PopupMenu): + (WebCore::PopupMenu::show): + (WebCore::PopupMenu::hide): + (WebCore::PopupMenu::updateFromElement): + (WebCore::PopupMenu::itemWritingDirectionIsNatural): + * platform/efl/PopupMenuEfl.h: Removed. + * platform/efl/SearchPopupMenuEfl.cpp: + (WebCore::SearchPopupMenu::SearchPopupMenu): + (WebCore::SearchPopupMenu::saveRecentSearches): + (WebCore::SearchPopupMenu::loadRecentSearches): + (WebCore::SearchPopupMenu::enabled): + * platform/efl/SearchPopupMenuEfl.h: Removed. + * platform/gtk/PopupMenuGtk.cpp: + (WebCore::PopupMenu::PopupMenu): + (WebCore::PopupMenu::~PopupMenu): + (WebCore::PopupMenu::show): + (WebCore::PopupMenu::hide): + (WebCore::PopupMenu::updateFromElement): + (WebCore::PopupMenu::itemWritingDirectionIsNatural): + (WebCore::PopupMenu::menuItemActivated): + (WebCore::PopupMenu::menuUnmapped): + (WebCore::PopupMenu::menuPositionFunction): + (WebCore::PopupMenu::menuRemoveItem): + * platform/gtk/PopupMenuGtk.h: Removed. + * platform/gtk/SearchPopupMenuGtk.cpp: + (WebCore::SearchPopupMenu::SearchPopupMenu): + (WebCore::SearchPopupMenu::saveRecentSearches): + (WebCore::SearchPopupMenu::loadRecentSearches): + (WebCore::SearchPopupMenu::enabled): + * platform/gtk/SearchPopupMenuGtk.h: Removed. + * platform/haiku/PopupMenuHaiku.cpp: + (WebCore::PopupMenuHaiku::PopupMenuHaiku): + (WebCore::PopupMenuHaiku::~PopupMenuHaiku): + (WebCore::PopupMenu::PopupMenu): + (WebCore::PopupMenu::~PopupMenu): + (WebCore::PopupMenu::show): + (WebCore::PopupMenu::hide): + (WebCore::PopupMenu::updateFromElement): + (WebCore::PopupMenu::itemWritingDirectionIsNatural): + * platform/haiku/PopupMenuHaiku.h: Removed. + * platform/haiku/SearchPopupMenuHaiku.cpp: + (WebCore::SearchPopupMenu::SearchPopupMenu): + (WebCore::SearchPopupMenu::saveRecentSearches): + (WebCore::SearchPopupMenu::loadRecentSearches): + (WebCore::SearchPopupMenu::enabled): + * platform/haiku/SearchPopupMenuHaiku.h: Removed. + * platform/mac/PopupMenuMac.h: Removed. + * platform/mac/PopupMenuMac.mm: + (WebCore::PopupMenu::PopupMenu): + (WebCore::PopupMenu::~PopupMenu): + (WebCore::PopupMenu::clear): + (WebCore::PopupMenu::populate): + (WebCore::PopupMenu::show): + (WebCore::PopupMenu::hide): + (WebCore::PopupMenu::updateFromElement): + (WebCore::PopupMenu::itemWritingDirectionIsNatural): + * platform/mac/SearchPopupMenuMac.h: Removed. + * platform/mac/SearchPopupMenuMac.mm: + (WebCore::SearchPopupMenu::SearchPopupMenu): + (WebCore::SearchPopupMenu::enabled): + (WebCore::SearchPopupMenu::saveRecentSearches): + (WebCore::SearchPopupMenu::loadRecentSearches): + * platform/qt/PopupMenuQt.cpp: + (WebCore::PopupMenu::PopupMenu): + (WebCore::PopupMenu::~PopupMenu): + (WebCore::PopupMenu::show): + (WebCore::PopupMenu::hide): + (WebCore::PopupMenu::updateFromElement): + (WebCore::PopupMenu::itemWritingDirectionIsNatural): + * platform/qt/PopupMenuQt.h: Removed. + * platform/qt/QtAbstractWebPopup.h: + * platform/qt/SearchPopupMenuQt.cpp: + (WebCore::SearchPopupMenu::SearchPopupMenu): + (WebCore::SearchPopupMenu::saveRecentSearches): + (WebCore::SearchPopupMenu::loadRecentSearches): + (WebCore::SearchPopupMenu::enabled): + * platform/qt/SearchPopupMenuQt.h: Removed. + * platform/win/PopupMenuWin.cpp: + (WebCore::PopupMenu::PopupMenu): + (WebCore::PopupMenu::~PopupMenu): + (WebCore::PopupMenu::popupClassName): + (WebCore::PopupMenu::show): + (WebCore::PopupMenu::hide): + (WebCore::PopupMenu::calculatePositionAndSize): + (WebCore::PopupMenu::setFocusedIndex): + (WebCore::PopupMenu::visibleItems): + (WebCore::PopupMenu::listIndexAtPoint): + (WebCore::PopupMenu::focusedIndex): + (WebCore::PopupMenu::focusFirst): + (WebCore::PopupMenu::focusLast): + (WebCore::PopupMenu::down): + (WebCore::PopupMenu::up): + (WebCore::PopupMenu::invalidateItem): + (WebCore::PopupMenu::clientRect): + (WebCore::PopupMenu::incrementWheelDelta): + (WebCore::PopupMenu::reduceWheelDelta): + (WebCore::PopupMenu::scrollToRevealSelection): + (WebCore::PopupMenu::updateFromElement): + (WebCore::PopupMenu::itemWritingDirectionIsNatural): + (WebCore::PopupMenu::paint): + (WebCore::PopupMenu::valueChanged): + (WebCore::PopupMenu::invalidateScrollbarRect): + (WebCore::PopupMenu::registerClass): + (WebCore::PopupMenu::PopupMenuWndProc): + (WebCore::PopupMenu::wndProc): + * platform/win/PopupMenuWin.h: Removed. + * platform/win/SearchPopupMenuWin.cpp: + (WebCore::SearchPopupMenu::SearchPopupMenu): + (WebCore::SearchPopupMenu::enabled): + (WebCore::SearchPopupMenu::saveRecentSearches): + (WebCore::SearchPopupMenu::loadRecentSearches): + * platform/win/SearchPopupMenuWin.h: Removed. + * platform/wx/PopupMenuWx.cpp: + (WebCore::PopupMenu::PopupMenu): + (WebCore::PopupMenu::~PopupMenu): + (WebCore::PopupMenu::show): + (WebCore::PopupMenu::OnMenuItemSelected): + (WebCore::PopupMenu::hide): + (WebCore::PopupMenu::updateFromElement): + (WebCore::PopupMenu::itemWritingDirectionIsNatural): + * platform/wx/PopupMenuWx.h: Removed. + * platform/wx/SearchPopupMenuWx.cpp: + (WebCore::SearchPopupMenu::SearchPopupMenu): + (WebCore::SearchPopupMenu::saveRecentSearches): + (WebCore::SearchPopupMenu::loadRecentSearches): + (WebCore::SearchPopupMenu::enabled): + * platform/wx/SearchPopupMenuWx.h: Removed. + * rendering/RenderMenuList.cpp: + (WebCore::RenderMenuList::adjustInnerStyle): + (WebCore::RenderMenuList::showPopup): + * rendering/RenderMenuList.h: + * rendering/RenderTextControlSingleLine.cpp: + (WebCore::RenderTextControlSingleLine::~RenderTextControlSingleLine): + (WebCore::RenderTextControlSingleLine::addSearchResult): + (WebCore::RenderTextControlSingleLine::showPopup): + (WebCore::RenderTextControlSingleLine::hidePopup): + (WebCore::RenderTextControlSingleLine::updateFromElement): + (WebCore::RenderTextControlSingleLine::valueChanged): + * rendering/RenderTextControlSingleLine.h: + +2010-07-27 Luiz Agostini <luiz.agostini@openbossa.org> + + Reviewed by Darin Fisher. + + PopupMenu refactoring in preparation to WebKit2 + https://bugs.webkit.org/show_bug.cgi?id=42592 + + Classes PopupMenu and SearchPopupMenu have been made pure virtual. + + * platform/PopupMenu.h: + (WebCore::PopupMenu::~PopupMenu): + * platform/SearchPopupMenu.h: + (WebCore::SearchPopupMenu::~SearchPopupMenu): + + Classes RenderMenuList and RenderTexyControlSingleLine have been changed to use + the new pure virtual PopupMenu and SearchPopupMenu. + + * rendering/RenderMenuList.cpp: + (WebCore::RenderMenuList::adjustInnerStyle): + (WebCore::RenderMenuList::showPopup): + * rendering/RenderMenuList.h: + * rendering/RenderTextControlSingleLine.cpp: + (WebCore::RenderTextControlSingleLine::~RenderTextControlSingleLine): + (WebCore::RenderTextControlSingleLine::addSearchResult): + (WebCore::RenderTextControlSingleLine::showPopup): + (WebCore::RenderTextControlSingleLine::hidePopup): + (WebCore::RenderTextControlSingleLine::updateFromElement): + (WebCore::RenderTextControlSingleLine::valueChanged): + * rendering/RenderTextControlSingleLine.h: + + Chrome and ChromeClient were made responsible for providing instances of classes + PopupMenu and SearchPopupMenu to its users. + + * loader/EmptyClients.h: + (WebCore::EmptyPopupMenu::show): + (WebCore::EmptyPopupMenu::hide): + (WebCore::EmptyPopupMenu::updateFromElement): + (WebCore::EmptyPopupMenu::disconnectClient): + (WebCore::EmptySearchPopupMenu::popupMenu): + (WebCore::EmptySearchPopupMenu::saveRecentSearches): + (WebCore::EmptySearchPopupMenu::loadRecentSearches): + (WebCore::EmptySearchPopupMenu::enabled): + (WebCore::EmptyChromeClient::selectItemWritingDirectionIsNatural): + (WebCore::EmptyChromeClient::createPopupMenu): + (WebCore::EmptyChromeClient::createSearchPopupMenu): + * page/Chrome.cpp: + (WebCore::Chrome::selectItemWritingDirectionIsNatural): + (WebCore::Chrome::createPopupMenu): + (WebCore::Chrome::createSearchPopupMenu): + * page/Chrome.h: + * page/ChromeClient.h: + + Original contents of files PopupMenu.h and SearchPopupMenu.h have been splited + in several files, two for each platform (PopupMenuXXX.h and SearchPopupMenuXXX.h). + Each of new the files contain the concrete classes that inherit form PopupMenu or + SearchPopupMenu and are specific for the corresponding platform. + + brew: + + * platform/brew/PopupMenuBrew.cpp: + (WebCore::PopupMenuBrew::PopupMenuBrew): + (WebCore::PopupMenuBrew::~PopupMenuBrew): + (WebCore::PopupMenuBrew::disconnectClient): + (WebCore::PopupMenuBrew::show): + (WebCore::PopupMenuBrew::hide): + (WebCore::PopupMenuBrew::updateFromElement): + * platform/brew/PopupMenuBrew.h: Added. + (WebCore::PopupMenuBrew::client): + * platform/brew/SearchPopupMenuBrew.cpp: + (WebCore::SearchPopupMenuBrew::saveRecentSearches): + (WebCore::SearchPopupMenuBrew::loadRecentSearches): + (WebCore::SearchPopupMenuBrew::SearchPopupMenuBrew): + (WebCore::SearchPopupMenuBrew::enabled): + (WebCore::SearchPopupMenuBrew::popupMenu): + * platform/brew/SearchPopupMenuBrew.h: Added. + + chromium: + + * WebCore.gypi: + * platform/chromium/PopupMenuChromium.cpp: + (WebCore::PopupMenuChromium::PopupMenuChromium): + (WebCore::PopupMenuChromium::~PopupMenuChromium): + (WebCore::PopupMenuChromium::show): + (WebCore::PopupMenuChromium::hide): + (WebCore::PopupMenuChromium::updateFromElement): + (WebCore::PopupMenuChromium::disconnectClient): + * platform/chromium/PopupMenuChromium.h: + (WebCore::PopupMenuChromium::client): + * platform/chromium/SearchPopupMenuChromium.cpp: + (WebCore::SearchPopupMenuChromium::SearchPopupMenuChromium): + (WebCore::SearchPopupMenuChromium::popupMenu): + (WebCore::SearchPopupMenuChromium::enabled): + (WebCore::SearchPopupMenuChromium::saveRecentSearches): + (WebCore::SearchPopupMenuChromium::loadRecentSearches): + * platform/chromium/SearchPopupMenuChromium.h: Added. + + efl: + + * platform/efl/PopupMenuEfl.cpp: + (WebCore::PopupMenuEfl::PopupMenuEfl): + (WebCore::PopupMenuEfl::~PopupMenuEfl): + (WebCore::PopupMenuEfl::show): + (WebCore::PopupMenuEfl::hide): + (WebCore::PopupMenuEfl::updateFromElement): + (WebCore::PopupMenuEfl::disconnectClient): + * platform/efl/PopupMenuEfl.h: Added. + (WebCore::PopupMenuEfl::client): + * platform/efl/SearchPopupMenuEfl.cpp: + (WebCore::SearchPopupMenuEfl::SearchPopupMenuEfl): + (WebCore::SearchPopupMenuEfl::popupMenu): + (WebCore::SearchPopupMenuEfl::saveRecentSearches): + (WebCore::SearchPopupMenuEfl::loadRecentSearches): + (WebCore::SearchPopupMenuEfl::enabled): + * platform/efl/SearchPopupMenuEfl.h: Added. + + gtk: + + * GNUmakefile.am: + * platform/gtk/PopupMenuGtk.cpp: + (WebCore::PopupMenuGtk::PopupMenuGtk): + (WebCore::PopupMenuGtk::~PopupMenuGtk): + (WebCore::PopupMenuGtk::show): + (WebCore::PopupMenuGtk::hide): + (WebCore::PopupMenuGtk::updateFromElement): + (WebCore::PopupMenuGtk::disconnectClient): + (WebCore::PopupMenuGtk::menuItemActivated): + (WebCore::PopupMenuGtk::menuUnmapped): + (WebCore::PopupMenuGtk::menuPositionFunction): + (WebCore::PopupMenuGtk::menuRemoveItem): + * platform/gtk/PopupMenuGtk.h: Added. + (WebCore::PopupMenuGtk::client): + * platform/gtk/SearchPopupMenuGtk.cpp: + (WebCore::SearchPopupMenuGtk::SearchPopupMenuGtk): + (WebCore::SearchPopupMenuGtk::popupMenu): + (WebCore::SearchPopupMenuGtk::saveRecentSearches): + (WebCore::SearchPopupMenuGtk::loadRecentSearches): + (WebCore::SearchPopupMenuGtk::enabled): + * platform/gtk/SearchPopupMenuGtk.h: Added. + + haiku: + + * platform/haiku/PopupMenuHaiku.cpp: + (WebCore::HaikuPopup::HaikuPopup): + (WebCore::HaikuPopup::~HaikuPopup): + (WebCore::PopupMenuHaiku::PopupMenuHaiku): + (WebCore::PopupMenuHaiku::~PopupMenuHaiku): + (WebCore::PopupMenuHaiku::disconnectClient): + (WebCore::PopupMenuHaiku::show): + (WebCore::PopupMenuHaiku::hide): + (WebCore::PopupMenuHaiku::updateFromElement): + * platform/haiku/PopupMenuHaiku.h: Added. + (WebCore::PopupMenuHaiku::disconnectClient): + (WebCore::PopupMenuHaiku::client): + * platform/haiku/SearchPopupMenuHaiku.cpp: + (WebCore::SearchPopupMenuHaiku::SearchPopupMenuHaiku): + (WebCore::SearchPopupMenuHaiku::saveRecentSearches): + (WebCore::SearchPopupMenuHaiku::loadRecentSearches): + (WebCore::SearchPopupMenuHaiku::enabled): + (WebCore::SearchPopupMenuHaiku::popupMenu): + * platform/haiku/SearchPopupMenuHaiku.h: Added. + + mac: + + * WebCore.exp.in: + * WebCore.xcodeproj/project.pbxproj: + * platform/mac/PopupMenuMac.h: Added. + (WebCore::PopupMenuMac::disconnectClient): + (WebCore::PopupMenuMac::client): + * platform/mac/PopupMenuMac.mm: + (WebCore::PopupMenuMac::PopupMenuMac): + (WebCore::PopupMenuMac::~PopupMenuMac): + (WebCore::PopupMenuMac::clear): + (WebCore::PopupMenuMac::populate): + (WebCore::PopupMenuMac::show): + (WebCore::PopupMenuMac::hide): + (WebCore::PopupMenuMac::updateFromElement): + (WebCore::PopupMenuMac::itemWritingDirectionIsNatural): + * platform/mac/SearchPopupMenuMac.h: Added. + * platform/mac/SearchPopupMenuMac.mm: + (WebCore::SearchPopupMenuMac::SearchPopupMenuMac): + (WebCore::SearchPopupMenuMac::popupMenu): + (WebCore::SearchPopupMenuMac::enabled): + (WebCore::SearchPopupMenuMac::saveRecentSearches): + (WebCore::SearchPopupMenuMac::loadRecentSearches): + + qt: + + * WebCore.pro: + * platform/qt/PopupMenuQt.cpp: + (WebCore::PopupMenuQt::PopupMenuQt): + (WebCore::PopupMenuQt::~PopupMenuQt): + (WebCore::PopupMenuQt::disconnectClient): + (WebCore::PopupMenuQt::show): + (WebCore::PopupMenuQt::hide): + (WebCore::PopupMenuQt::updateFromElement): + * platform/qt/PopupMenuQt.h: Added. + * platform/qt/QtAbstractWebPopup.h: + * platform/qt/SearchPopupMenuQt.cpp: + (WebCore::SearchPopupMenuQt::SearchPopupMenuQt): + (WebCore::SearchPopupMenuQt::popupMenu): + (WebCore::SearchPopupMenuQt::saveRecentSearches): + (WebCore::SearchPopupMenuQt::loadRecentSearches): + (WebCore::SearchPopupMenuQt::enabled): + * platform/qt/SearchPopupMenuQt.h: Added. + + win: + + * WebCore.vcproj/WebCore.vcproj: + * platform/win/PopupMenuWin.cpp: + (WebCore::PopupMenuWin::PopupMenuWin): + (WebCore::PopupMenuWin::~PopupMenuWin): + (WebCore::PopupMenuWin::disconnectClient): + (WebCore::PopupMenuWin::popupClassName): + (WebCore::PopupMenuWin::show): + (WebCore::PopupMenuWin::hide): + (WebCore::PopupMenuWin::calculatePositionAndSize): + (WebCore::PopupMenuWin::setFocusedIndex): + (WebCore::PopupMenuWin::visibleItems): + (WebCore::PopupMenuWin::listIndexAtPoint): + (WebCore::PopupMenuWin::focusedIndex): + (WebCore::PopupMenuWin::focusFirst): + (WebCore::PopupMenuWin::focusLast): + (WebCore::PopupMenuWin::down): + (WebCore::PopupMenuWin::up): + (WebCore::PopupMenuWin::invalidateItem): + (WebCore::PopupMenuWin::clientRect): + (WebCore::PopupMenuWin::incrementWheelDelta): + (WebCore::PopupMenuWin::reduceWheelDelta): + (WebCore::PopupMenuWin::scrollToRevealSelection): + (WebCore::PopupMenuWin::updateFromElement): + (WebCore::PopupMenuWin::paint): + (WebCore::PopupMenuWin::valueChanged): + (WebCore::PopupMenuWin::invalidateScrollbarRect): + (WebCore::PopupMenuWin::registerClass): + (WebCore::PopupMenuWin::PopupMenuWndProc): + (WebCore::PopupMenuWin::wndProc): + * platform/win/PopupMenuWin.h: Added. + (WebCore::PopupMenuWin::client): + (WebCore::PopupMenuWin::scrollbar): + (WebCore::PopupMenuWin::itemHeight): + (WebCore::PopupMenuWin::windowRect): + (WebCore::PopupMenuWin::popupHandle): + (WebCore::PopupMenuWin::setWasClicked): + (WebCore::PopupMenuWin::wasClicked): + (WebCore::PopupMenuWin::setScrollOffset): + (WebCore::PopupMenuWin::scrollOffset): + (WebCore::PopupMenuWin::wheelDelta): + (WebCore::PopupMenuWin::scrollbarCapturingMouse): + (WebCore::PopupMenuWin::setScrollbarCapturingMouse): + * platform/win/SearchPopupMenuWin.cpp: + (WebCore::SearchPopupMenuWin::SearchPopupMenuWin): + (WebCore::SearchPopupMenuWin::popupMenu): + (WebCore::SearchPopupMenuWin::enabled): + (WebCore::SearchPopupMenuWin::saveRecentSearches): + (WebCore::SearchPopupMenuWin::loadRecentSearches): + * platform/win/SearchPopupMenuWin.h: Added. + + wx: + + * platform/wx/PopupMenuWx.cpp: + (WebCore::PopupMenuWx::PopupMenuWx): + (WebCore::PopupMenuWx::~PopupMenuWx): + (WebCore::PopupMenuWx::disconnectClient): + (WebCore::PopupMenuWx::show): + (WebCore::PopupMenuWx::OnMenuItemSelected): + (WebCore::PopupMenuWx::hide): + (WebCore::PopupMenuWx::updateFromElement): + * platform/wx/PopupMenuWx.h: Added. + (WebCore::PopupMenuWx::client): + * platform/wx/SearchPopupMenuWx.cpp: + (WebCore::SearchPopupMenuWx::SearchPopupMenuWx): + (WebCore::SearchPopupMenuWx::saveRecentSearches): + (WebCore::SearchPopupMenuWx::loadRecentSearches): + (WebCore::SearchPopupMenuWx::enabled): + (WebCore::SearchPopupMenuWx::popupMenu): + * platform/wx/SearchPopupMenuWx.h: Added. + + + +2010-07-31 David Kilzer <ddkilzer@apple.com> + + <http://webkit.org/b/43300> Simplify variables in *.xcconfig files after adding iOS support + + Reviewed by Darin Adler. + + * Configurations/WebCore.xcconfig: Extracted + PRODUCTION_FRAMEWORKS_DIR variable. + +2010-07-31 Nikolas Zimmermann <nzimmermann@rim.com> + + Reviewed by Dirk Schulze. + + HTMLStyleElement/SVGStyleElement need to share more code + https://bugs.webkit.org/show_bug.cgi?id=43293 + + Simplify HTMLStyleElement/SVGStyleElement. They look identically now, as all code is shared in StyleElement. + Doesn't affect any tests. + + * dom/StyleElement.cpp: + (WebCore::StyleElement::StyleElement): Take createdByParser & Document arguments, to share the line number extraction logic. Store it in m_lineNumber. + (WebCore::StyleElement::insertedIntoDocument): Moved addStyleSheetCandidateNode here, to share code between HTML/SVGStyleElement. + (WebCore::StyleElement::removedFromDocument): Same for removeStyleSheetCandidateNode. + (WebCore::StyleElement::childrenChanged): Introduced new helper function. + (WebCore::StyleElement::finishParsingChildren): Ditto. + (WebCore::StyleElement::process): Use stored m_lineNumber, avoids a parameter. + (WebCore::StyleElement::createSheet): No need to call the virtual setLoading() function, just store m_loading in StyleElement, and set it from here. + (WebCore::StyleElement::isLoading): Introduced new helper function. + (WebCore::StyleElement::sheetLoaded): Ditto. + * dom/StyleElement.h: + * html/HTMLStyleElement.cpp: + (WebCore::HTMLStyleElement::HTMLStyleElement): Pass Document & createdByParser arguments to StyleElement. + (WebCore::HTMLStyleElement::finishParsingChildren): Delegate work to StyleElement. + (WebCore::HTMLStyleElement::insertedIntoDocument): Ditto. + (WebCore::HTMLStyleElement::removedFromDocument): Ditto. + (WebCore::HTMLStyleElement::childrenChanged): Ditto. + * html/HTMLStyleElement.h: + (WebCore::HTMLStyleElement::isLoading): Ditto. + (WebCore::HTMLStyleElement::sheetLoaded): Ditto. + * svg/SVGStyleElement.cpp: + (WebCore::SVGStyleElement::SVGStyleElement): Pass Document & createdByParser arguments to StyleElement. + (WebCore::SVGStyleElement::finishParsingChildren): Delegate work to StyleElement. + (WebCore::SVGStyleElement::insertedIntoDocument): Ditto. + (WebCore::SVGStyleElement::removedFromDocument): Ditto. + (WebCore::SVGStyleElement::childrenChanged): Ditto. + * svg/SVGStyleElement.h: + (WebCore::SVGStyleElement::isLoading): Ditto. + (WebCore::SVGStyleElement::sheetLoaded): Ditto. + +2010-07-31 Kinuko Yasuda <kinuko@chromium.org> + + Unreviewed. Attempt to fix release build failure. + + Having 'fail:' label without goto statement generates a compiler + warning that causes a build failure in release build. + + * bindings/scripts/CodeGeneratorV8.pm: + +2010-07-31 Kinuko Yasuda <kinuko@chromium.org> + + Reviewed by Nikolas Zimmermann. + + Fix 'bool' in bindings/scripts/test/TestObj. + + * bindings/scripts/test/CPP/WebDOMTestObj.cpp: + (WebDOMTestObj::CREATE): + (WebDOMTestObj::setCREATE): + * bindings/scripts/test/CPP/WebDOMTestObj.h: + * bindings/scripts/test/GObject/WebKitDOMTestObj.cpp: + (webkit_dom_test_obj_get_create): + (webkit_dom_test_obj_set_create): + (webkit_dom_test_obj_set_property): + (webkit_dom_test_obj_get_property): + (webkit_dom_test_obj_class_init): + * bindings/scripts/test/GObject/WebKitDOMTestObj.h: + * bindings/scripts/test/JS/JSTestObj.cpp: + (WebCore::jsTestObjCreate): + (WebCore::setJSTestObjCreate): + * bindings/scripts/test/ObjC/DOMTestObj.h: + * bindings/scripts/test/ObjC/DOMTestObj.mm: + (-[DOMTestObj CREATE]): + (-[DOMTestObj setCREATE:]): + * bindings/scripts/test/TestObj.idl: + * bindings/scripts/test/V8/V8TestObj.cpp: + (WebCore::TestObjInternal::CREATEAttrGetter): + (WebCore::TestObjInternal::CREATEAttrSetter): + +2010-07-30 Kinuko Yasuda <kinuko@chromium.org> + + Reviewed by Dumitru Daniliuc. + + Add idl and mock implementation for HTML5 FileSystem API + https://bugs.webkit.org/show_bug.cgi?id=43134 + + Add idl for: FileSystem (as DOMFileSystem), Entry, Flags, Metadata, + FileSystemCallback, EntryCallback and ErrorCallback. + http://dev.w3.org/2009/dap/file-system/file-dir-sys.html + + They are added only for Mac and chromium. + + Tests will be added when we expose the entry point and add implementation. + + * DerivedSources.make: + * WebCore.gypi: + * WebCore.xcodeproj/project.pbxproj: + + * storage/DOMFileSystem.cpp: Added. + * storage/DOMFileSystem.h: Added. + * storage/DOMFileSystem.idl: Added. + * storage/Entry.cpp: Added. + * storage/Entry.h: Added. + * storage/Entry.idl: Added. + * storage/EntryCallback.h: Added. + * storage/EntryCallback.idl: Added. + * storage/ErrorCallback.h: Added. + * storage/ErrorCallback.idl: Added. + * storage/FileSystemCallback.h: Added. + * storage/FileSystemCallback.idl: Added. + * storage/Flags.h: Added. + * storage/Flags.idl: Added. + * storage/Metadata.h: Added. + * storage/Metadata.idl: Added. + * storage/MetadataCallback.h: Added. + * storage/MetadataCallback.idl: Added. + + * bindings/scripts/CodeGenerator.pm: Added special case handlings for generating setter/getter names for CREATE/EXCLUSIVE attributes in Flags.idl. + + * bindings/scripts/test/TestObj.idl: Updated. + * bindings/scripts/test/CPP/WebDOMTestObj.cpp: Updated. + * bindings/scripts/test/CPP/WebDOMTestObj.cpp: Updated. + * bindings/scripts/test/CPP/WebDOMTestObj.h: Updated. + * bindings/scripts/test/GObject/WebKitDOMTestObj.cpp: Updated. + * bindings/scripts/test/GObject/WebKitDOMTestObj.h: Updated. + * bindings/scripts/test/JS/JSTestObj.cpp: Updated. + * bindings/scripts/test/JS/JSTestObj.h: Updated. + * bindings/scripts/test/ObjC/DOMTestObj.h: Updated. + * bindings/scripts/test/ObjC/DOMTestObj.mm: Updated. + +2010-07-30 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r64408. + http://trac.webkit.org/changeset/64408 + https://bugs.webkit.org/show_bug.cgi?id=43292 + + Causing failed tests on Chromium canaries due to wrong history + item counts (Requested by atwilson on #webkit). + + * loader/RedirectScheduler.cpp: + (WebCore::RedirectScheduler::scheduleRedirect): + (WebCore::RedirectScheduler::mustLockBackForwardList): + (WebCore::RedirectScheduler::scheduleLocationChange): + (WebCore::RedirectScheduler::scheduleFormSubmission): + * loader/RedirectScheduler.h: + +2010-07-30 Dan Bernstein <mitz@apple.com> + + Reviewed by Darin Adler. + + <rdar://problem/8257783> Short documents may print a second blank page + https://bugs.webkit.org/show_bug.cgi?id=43271 + + Test: printing/stretch-to-view-height.html + + * WebCore.exp.in: Export Frame::forceLayoutForPagination(), replacing forceLayoutWithPageWidthRange(). + * page/Frame.cpp: + (WebCore::Frame::setPrinting): Now takes a page width and height and a maximum shrink factor and passes + them down to forceLayoutForPagination(). + * page/Frame.h: + (WebCore::Frame::): + * page/FrameView.cpp: + (WebCore::FrameView::reset): Initialize m_pageHeight. + (WebCore::FrameView::forceLayoutForPagination): Renamed forceLayoutWithPageWidthRange() to this and + changed it to take a page width and height and a maximum shrink factor. Sets m_pageHeight, which is + queried by RenderBox::calcHeight() during layout. If the given pageHeight is 0, m_pageHeight is set + to the visible height, retaining the behavior before this change. + * page/FrameView.h: + (WebCore::FrameView::pageHeight): Added this accessor. + * page/PrintContext.cpp: + (WebCore::PrintContext::begin): Added a height parameter, used when calling setPrinting(). + (WebCore::PrintContext::end): Updated for setPrinting() changes. + (WebCore::PrintContext::pageNumberForElement): Account for shrink-to-fit. + (WebCore::PrintContext::pageProperty): Pass 0 for the height, retaining current behavior. + (WebCore::PrintContext::numberOfPages): Account for shrink-to-fit. + (WebCore::PrintContext::spoolAllPagesWithBoundaries): Pass the page width to begin(). + * page/PrintContext.h: + * rendering/RenderBox.cpp: + (WebCore::RenderBox::calcHeight): When printing, use FrameView::pageHeight() as the basis for + viewport-relative heights. + +2010-07-30 Mihai Parparita <mihaip@chromium.org> + + Reviewed by Darin Fisher. + + Session history should skip over JS redirects + https://bugs.webkit.org/show_bug.cgi?id=42861 + + Lock the back/forward list for location changes that happen before the + onload event fires that are not the result of user gestures. + + Test: fast/history/gesture-before-onload.html and updated expectations + for http/tests/history tests that used to fail. + + * loader/RedirectScheduler.cpp: + (WebCore::RedirectScheduler::scheduleRedirect): + (WebCore::RedirectScheduler::mustLockBackForwardList): + (WebCore::RedirectScheduler::scheduleLocationChange): + (WebCore::RedirectScheduler::scheduleFormSubmission): + * loader/RedirectScheduler.h: + +2010-07-30 Matthew Delaney <mdelaney@apple.com> + + Reviewed by Darin Adler. + + ctx.clearRect improperly clears shadow + https://bugs.webkit.org/show_bug.cgi?id=43213 + + Tests: canvas/philip/tests/2d.clearRect+fillRect.alpha0.5.html + canvas/philip/tests/2d.clearRect+fillRect.alpha0.html + canvas/philip/tests/2d.clearRect+fillRect.basic.html + + * html/canvas/CanvasRenderingContext2D.cpp: + (WebCore::CanvasRenderingContext2D::setAllAttributesToDefault): + Added a new method to wipe out all context attributes to their defaults. + (WebCore::CanvasRenderingContext2D::clearRect): + Updated clearRect to ignore shadow, alpha, and global composite attributes + when clearing the input rect to match the canvas spec. + * html/canvas/CanvasRenderingContext2D.h: + +2010-07-30 Kinuko Yasuda <kinuko@chromium.org> + + Reviewed by Jian Li. + + Decouple FileThread from FileStream to support generic file-related async tasks + https://bugs.webkit.org/show_bug.cgi?id=43135 + + No new tests as this doesn't change any functionality. + + * html/FileThread.cpp: + (WebCore::FileThread::stop): + (WebCore::SameInstancePredicate::SameFilePredicate): + (WebCore::SameInstancePredicate::operator()): + (WebCore::FileThread::unscheduleTasksInternal): + * html/FileThread.h: + (WebCore::FileThread::create): + (WebCore::FileThread::Task::instance): + (WebCore::FileThread::Task::Task): + * html/FileThreadTask.h: Changed all templates to take any type as a callee instance. + (WebCore::createFileThreadTask): + +2010-07-30 Darin Fisher <darin@chromium.org> + + Reviewed by Darin Adler. + + Eliminate BackForwardList::pushStateItem + https://bugs.webkit.org/show_bug.cgi?id=43282 + + The layout test was previously disabled because of the assertion being + hit in BackForwardList::pushStateItem. That assertion revealed the need + for this patch. + + Test: fast/loader/stateobjects/pushstate-in-iframe.html + + * history/BackForwardList.h: + * history/BackForwardListChromium.cpp: + * history/BackForwardListImpl.cpp: + * history/BackForwardListImpl.h: + + * loader/HistoryController.cpp: Move the logic, of adding a null state + object to the HistoryItem that was previously the current HistoryItem, to + HistoryController::pushState from BackForwardList::pushStateItem. The + BackForwardList was the wrong place for that logic since it lacked convenient + access to the target HistoryItem. It is just given the top-most HistoryItem + corresponding to the new navigation. + + (WebCore::HistoryController::updateBackForwardListClippedAtTarget): + (WebCore::HistoryController::pushState): + +2010-07-30 Luiz Agostini <luiz.agostini@openbossa.org> + + Reviewed by Simon Fraser. + + Enabling view modes to all platforms + https://bugs.webkit.org/show_bug.cgi?id=37505 + + View mode media feature implementation as specified in http://www.w3.org/TR/view-mode. + + The view mode media feature layout tests are stil skipped for all platforms except Qt + because of the lack of support of LayoutTestController in those platforms. + + Test: fast/media/view-mode-media-feature.html + + * css/MediaFeatureNames.h: + * css/MediaQueryEvaluator.cpp: + (WebCore::view_modeMediaFeatureEval): + * page/ChromeClient.h: + * page/Page.cpp: + (WebCore::Page::Page): + (WebCore::createViewModesSet): + (WebCore::Page::setViewMode): + * page/Page.h: + (WebCore::Page::viewMode): + +2010-07-30 Joseph Pecoraro <joepeck@webkit.org> + + Reviewed by David Kilzer. + + Limit ApplicationCache Total and Per-Origin Storage Capacity (Quotas) + https://bugs.webkit.org/show_bug.cgi?id=40627 + + Part 4 - Client Notification when the Quota is Reached + + Notify the WebKit client when the per-origin quota is reached + via a delegate method reachedApplicationCacheOriginQuota. + + Call the delegate method when the quota is reached. + + * loader/appcache/ApplicationCacheGroup.cpp: + (WebCore::ApplicationCacheGroup::ApplicationCacheGroup): + (WebCore::ApplicationCacheGroup::didFinishLoading): + (WebCore::ApplicationCacheGroup::didReachOriginQuota): + (WebCore::ApplicationCacheGroup::cacheUpdateFailedDueToOriginQuota): + (WebCore::ApplicationCacheGroup::checkIfLoadIsComplete): + (WebCore::ApplicationCacheGroup::scheduleReachedOriginQuotaCallback): + * loader/appcache/ApplicationCacheGroup.h: + + Some minor refactoring to access more quota information + without repeating code. Such as origin usage, and creating + an origin record. + + * loader/appcache/ApplicationCacheStorage.cpp: + (WebCore::ApplicationCacheStorage::usageForOrigin): + (WebCore::ApplicationCacheStorage::storeUpdatedQuotaForOrigin): + (WebCore::ApplicationCacheStorage::store): + (WebCore::ApplicationCacheStorage::ensureOriginRecord): + * loader/appcache/ApplicationCacheStorage.h: + + Boilerplate. Exports and definition of the delegate method. + + * WebCore.OfflineWebApplications.exp: + * loader/EmptyClients.h: + (WebCore::EmptyChromeClient::reachedApplicationCacheOriginQuota): + * page/ChromeClient.h: + +2010-07-30 Joseph Pecoraro <joepeck@webkit.org> + + Reviewed by David Kilzer. + + Limit ApplicationCache Total and Per-Origin Storage Capacity (Quotas) + https://bugs.webkit.org/show_bug.cgi?id=40627 + + Part 3 - Refactor storeNewestCache to allow Failure Reason Output + + Storing can result in an error in a number of reasons. Previously + the reasons were global and binary and could be determined by + checking ApplicationCacheStorage state. Now, with per-origin quotas + a per-origin quota can cause a failure that is not in global state. + Current failure reasons are: + + OriginQuotaReached = per-origin quota reached, no storage is allowed. + TotalQuotaReached = database quota reached, no storage is allowed. + DiskOrOperationFailure = SQL error such as failed prepare or query. Not expected to happen. + + This part provides an implementation of storeNewestCache for those + that care about the failure reason, and not just if it succeeded + or not. This moves the final origin quota check into the transaction. + + * loader/appcache/ApplicationCache.h: style fix for forwarding headers. + * loader/appcache/ApplicationCacheGroup.cpp: + (WebCore::ApplicationCacheGroup::checkIfLoadIsComplete): move origin quota check into storeNewestCache's SQL transaction. + * loader/appcache/ApplicationCacheStorage.cpp: + (WebCore::ApplicationCacheStorage::storeNewestCache): old implementation calls the new implementation ignoring failure reason. + (WebCore::ApplicationCacheStorage::storeNewestCache): new implementation provides a failure reason in case of failure. + * loader/appcache/ApplicationCacheStorage.h: + (WebCore::ApplicationCacheStorage::): added FailureReason enum and storeNewestCache allowing it. + +2010-07-30 Joseph Pecoraro <joepeck@webkit.org> + + Reviewed by David Kilzer. + + Limit ApplicationCache Total and Per-Origin Storage Capacity (Quotas) + https://bugs.webkit.org/show_bug.cgi?id=40627 + + Part 2 - Update Schema and enforce Per-Origin Quotas + + Added an "Origins" table to the application cache databases. + This, like the Database's Origins table, is a list of origin + and quota pairs. Origins records are added as soon as they are + needed, and deleted only when the ApplicationCacheStorage is + emptied. This means Origins records persist even after all + caches for that origin may be deleted. The "CacheGroups" table + now has a foreign key column "origin" which relates to the + "Origins" table. + + To enforce the quotas, remaining quota space is checked at + the start of update as an estimate and at the end before + inserting. Currently, reaching the quota limit will simply + cause an update error. A later part will provide a + notification to the client to allow an action, and refactor + the final quota limit check into a transaction. + + Respect the quota during the update process. And cause + the update process to fail when the quota is reached. + + * loader/appcache/ApplicationCacheGroup.cpp: added loading counter, counts bytes as they load + (WebCore::ApplicationCacheGroup::ApplicationCacheGroup): + (WebCore::ApplicationCacheGroup::didReceiveData): + (WebCore::ApplicationCacheGroup::didFinishLoading): + (WebCore::ApplicationCacheGroup::checkIfLoadIsComplete): + * loader/appcache/ApplicationCacheGroup.h: added security origin, based on the manifest URL + (WebCore::ApplicationCacheGroup::origin): accessor + + Updates the schema of the database tables as described + above. Handle other SQL operations such as checking the + remaining space and inserting and deleting Origins records. + + * loader/appcache/ApplicationCacheStorage.cpp: + (WebCore::ApplicationCacheStorage::quotaForOrigin): query for the quota of an origin, may return the default origin quota if it didn't exist. + (WebCore::ApplicationCacheStorage::remainingSizeForOriginExcludingCache): calculate the remaining size in a quota for an origin, possibly excluding a cache. + (WebCore::ApplicationCacheStorage::storeUpdatedQuotaForOrigin): persistent update. + (WebCore::ApplicationCacheStorage::openDatabase): updated schema for CachesGroups, added new table Origins. + (WebCore::ApplicationCacheStorage::empty): wipe Origins table as well. + (WebCore::ApplicationCacheStorage::unknownQuota): constant to mean unknown quota + +2010-07-30 Joseph Pecoraro <joepeck@webkit.org> + + Reviewed by David Kilzer. + + Limit ApplicationCache Total and Per-Origin Storage Capacity (Quotas) + https://bugs.webkit.org/show_bug.cgi?id=40627 + + Part 1 - Add Total and Per-Origin Quota Preferences. + + Allow the application cache total size to be a preference, and + add a new preference for the default per-origin quota. + + Handle the per-origin quota in the global cacheStorage() object. + The per-origin quota will be used in a later part, this just + handles interaction with it from a client. + + * loader/appcache/ApplicationCacheStorage.cpp: + (WebCore::ApplicationCacheStorage::setDefaultOriginQuota): setter + (WebCore::ApplicationCacheStorage::ApplicationCacheStorage): default to "noQuota" on construction + * loader/appcache/ApplicationCacheStorage.h: + (WebCore::ApplicationCacheStorage::noQuota): constant to mean unlimited storage + (WebCore::ApplicationCacheStorage::defaultOriginQuota): accessor + + Move around some exports around for Offline Web Applications. + + * WebCore.exp.in: Added OFFLINE_WEB_APPLICATIONS exports. + +2010-07-30 Andy Estes <aestes@apple.com> + + Reviewed by David Kilzer. + + Add Xcode support for compiling WebKit against iOS SDKs. + https://bugs.webkit.org/show_bug.cgi?id=42796 + + * Configurations/Base.xcconfig: + * Configurations/DebugRelease.xcconfig: + * Configurations/FeatureDefines.xcconfig: + * Configurations/Version.xcconfig: + * Configurations/WebCore.xcconfig: + +2010-07-30 James Robinson <jamesr@chromium.org> + + Compile fix: fix a typo in forward declaration, add EmptyClients impl. + + * loader/EmptyClients.h: + (WebCore::EmptyChromeClient::getOnscreenGLES2Context): + (WebCore::EmptyChromeClient::getOffscreenGLES2Context): + * page/ChromeClient.h: + +2010-07-30 James Robinson <jamesr@chromium.org> + + Reviewed by Darin Fisher. + + Move GLES2 context manipulation to ChromeClient.h and put it behind the right #if guard + https://bugs.webkit.org/show_bug.cgi?id=43281 + + These calls were initially put in ChromeClientChromium, but they aren't chromium specific. + In theory any port that could create the proper OpenGL ES 2 contexts could implement + these functions. Also moves the calls to be behind the correct #if guard. + + * page/ChromeClient.h: + * page/chromium/ChromeClientChromium.h: + +2010-07-30 Dumitru Daniliuc <dumi@chromium.org> + + Reviewed by David Levin. + + Interrupt all DB operations when the worker is terminating. + https://bugs.webkit.org/show_bug.cgi?id=42843 + + Tests: fast/workers/storage/interrupt-database-sync.html + fast/workers/storage/interrupt-database.html + + * bindings/js/JSCustomVoidCallback.cpp: + (WebCore::JSCustomVoidCallback::~JSCustomVoidCallback): If the + destructor is called on the context thread, delete m_data directly + instead of posting a task to do that. We need to do that to make + sure that all JS objects are destroyed before + WorkerThreadShutdownFinishTask (in WorkerThread.cpp) calls + WorkerContext::clearScript(). + + * bindings/scripts/CodeGeneratorJS.pm: Same change as above, for + all auto-generated callbacks. + + * bindings/scripts/test/JS/JSTestCallback.cpp: + (WebCore::JSTestCallback::~JSTestCallback): Updated the + expectations for run-bindings-tests. + + * platform/sql/SQLiteDatabase.cpp: Added the ability to interrupt + all DB operations in progress, unless the database was closed or + is being closed. Unlike sqlite3_interrupt(), + SQLiteDatabase::interrupt() is sticky: once it's called, trying to + run any statement on that database will fail with a + SQLITE_INTERRUPT error code. + (WebCore::SQLiteDatabase::SQLiteDatabase): + (WebCore::SQLiteDatabase::close): + (WebCore::SQLiteDatabase::interrupt): + (WebCore::SQLiteDatabase::isInterrupted): + + * platform/sql/SQLiteDatabase.h: Added a mutex that can used by + SQLiteStatement to check if the database was interrupted. + (WebCore::SQLiteDatabase::databaseMutex): + + * platform/sql/SQLiteStatement.cpp: Changed prepare() and step() + to check if the database was interrupted, before trying to prepare + or run the statement. The other methods don't need to hold on to + the DB lock while running, because they're fast, so we don't need + to interrupt them. + (WebCore::SQLiteStatement::prepare): + (WebCore::SQLiteStatement::step): + + * storage/AbstractDatabase.cpp: Made SQLiteDatabase::interrupt() + and isInterrupted() visible to WebSQLDatabases classes. + (WebCore::AbstractDatabase::interrupt): + (WebCore::AbstractDatabase::isInterrupted): + * storage/AbstractDatabase.h: + + * storage/DatabaseTracker.cpp: Added a method to interrupt all + databases in a given context. + (WebCore::DatabaseTracker::interruptAllDatabasesForContext): + * storage/DatabaseTracker.h: + + * storage/SQLStatement.cpp: Changed the exception/error reported + when a statement is interrupted. + (WebCore::SQLStatement::execute): + * storage/SQLStatementSync.cpp: + (WebCore::SQLStatementSync::execute): + + * storage/SQLTransaction.cpp: Changed the code to release the + callback objects as soon as they're not needed. + (WebCore::SQLTransaction::checkAndHandleClosedOrInterruptedDatabase): + Changed this method to not schedule the next transaction step when + the database is interrupted. + (WebCore::SQLTransaction::performNextStep): + (WebCore::SQLTransaction::performPendingCallback): + (WebCore::SQLTransaction::deliverTransactionCallback): + (WebCore::SQLTransaction::postflightAndCommit): + (WebCore::SQLTransaction::deliverTransactionErrorCallback): + (WebCore::SQLTransaction::cleanupAfterTransactionErrorCallback): + * storage/SQLTransaction.h: + + * storage/chromium/DatabaseTrackerChromium.cpp: Added a method to + interrupt all databases in a given context. + (WebCore::DatabaseTracker::interruptAllDatabasesForContext): + + * workers/WorkerThread.cpp: + (WebCore::WorkerThread::stop): Added a call to + DatabaseTracker::interruptAllDatabasesForContext(). + +2010-07-30 Simon Fraser <simon.fraser@apple.com> + + Reviewed by Darin Adler. + + connect-compositing-iframe2.html test sometimes shows blank iframe content + https://bugs.webkit.org/show_bug.cgi?id=42046 + + Hooking up compositing iframes requires setNeedsStyleRecalc(SyntheticStyleChange) to + always result in a call to RenderLayer::styleChanged(). However, the semantics of + setNeedsStyleRecalc() was that each call would overwrite the existing styleChangeType, + allowing a "lesser" style change to override a "greater" one. In the test content, + SyntheticStyleChange was being replaced by FullStyleChange when the classname changed. + This resulted in RenderLayer::styleChanged() not being called. + + Fix by changing the behavior of setNeedsStyleRecalc() to only touch the style change + type if a "lesser" change is being replaced with a "greater" one. This required adding + a new clearNeedsStyleRecalc() method to reset the style change type to NoStyleChange. + + In addition, in Node::setNeedsStyleRecalc(), only propagate the childNeedsStyleRecalc + up the parent change if the node was not already needing recalc. In order to fix issues + with attaching, this required new call to clearNeedsStyleRecalc() at the end of attach(). + + * manual-tests/compositing/missing-iframe-contents.html: Added. + * manual-tests/compositing/resources/composited-subframe.html: Copied from LayoutTests/compositing/iframes/resources/composited-subframe.html. + + * dom/Document.cpp: + (WebCore::Document::recalcStyle): Call clearNeedsStyleRecalc(). + * dom/Element.cpp: + (WebCore::Element::recalcStyle): Call clearNeedsStyleRecalc(). + + * dom/Node.h: + (WebCore::Node::clearNeedsStyleRecalc): New method. + * dom/Node.cpp: + (WebCore::Node::setNeedsStyleRecalc): Only call setStyleChange() if the change type + is greater than the current change type. + (WebCore::Node::attach): After attaching, we can call clearNeedsStyleRecalc(). + + * dom/Text.cpp: + (WebCore::Text::recalcStyle): Call clearNeedsStyleRecalc(). + * html/HTMLFrameSetElement.cpp: + (WebCore::HTMLFrameSetElement::recalcStyle): Call clearNeedsStyleRecalc(). + +2010-07-30 W. James MacLean <wjmaclean@google.com> + + Reviewed by Nikolas Zimmermann. + + SVG - numeric overflow for very large elements + https://bugs.webkit.org/show_bug.cgi?id=25645 + + Two of the expected test outputs were incorrect now that parsing of large values + is handled correctly. + - Revised FloatRect to remove bad float-to-int conversions in enclosingIntRect() + - Revised _parseNumber to do right-to-left float-based parsing of input value + + Test: svg/custom/massive-coordinates.svg + + * platform/graphics/FloatRect.cpp: + (WebCore::safeFloatToInt): + (WebCore::enclosingIntRect): + * svg/SVGParserUtilities.cpp: + (WebCore::_parseNumber): + +2010-07-30 James Robinson <jamesr@chromium.org> + + Reviewed by Darin Fisher. + + [chromium] Make the GLES2 texture map generic and teach ImageSkia and ImageBufferSkia about GLES2 + https://bugs.webkit.org/show_bug.cgi?id=43218 + + This makes the GLES2Canvas' TextureHashMap key on void* instead of NativeImagePtr + to make it easier to use with other backends. It also teaches ImageSkia how + to draw to a GLES2Canvas instead of a skia buffer. + + No change in functionality (yet), no new tests. + + * platform/graphics/chromium/GLES2Canvas.cpp: + (WebCore::GLES2Canvas::GLES2Canvas): + (WebCore::GLES2Canvas::createTexture): + (WebCore::GLES2Canvas::getTexture): + * platform/graphics/chromium/GLES2Canvas.h: + * platform/graphics/skia/ImageBufferSkia.cpp: + (WebCore::ImageBuffer::getUnmultipliedImageData): + (WebCore::ImageBuffer::getPremultipliedImageData): + * platform/graphics/skia/ImageSkia.cpp: + (WebCore::drawBitmapGLES2): + (WebCore::BitmapImage::draw): + (WebCore::BitmapImageSingleFrameSkia::draw): + +2010-07-30 Yong Li <yoli@rim.com> + + Reviewed by Darin Adler. + + Implement SVGScriptElement::shouldExecuteAsJavaScript() otherwise + SVGScriptElement cannot run when XHTMLMP is enabled. + https://bugs.webkit.org/show_bug.cgi?id=43267 + + No test needed, because it fails all SVG <script> tests when XHTMLMP is on. + + * svg/SVGScriptElement.cpp: + (WebCore::SVGScriptElement::shouldExecuteAsJavaScript): + * svg/SVGScriptElement.h: + +2010-07-30 Chris Fleizach <cfleizach@apple.com> + + Reviewed by Darin Adler. + + Style errors in Navigator.h + https://bugs.webkit.org/show_bug.cgi?id=43262 + + Fixing style changes. No new tests. + + * page/Navigator.h: + (WebCore::Navigator::create): + (WebCore::Navigator::frame): + (WebCore::Navigator::optionalGeolocation): + +2010-07-27 Darin Fisher <darin@chromium.org> + + Reviewed by Brady Eidson. + + History.pushState() + navigation operates on top frame when called from + nested context + https://bugs.webkit.org/show_bug.cgi?id=43080 + + Test: fast/loader/stateobjects/pushstate-in-iframe.html + + * loader/HistoryController.cpp: + (WebCore::HistoryController::pushState): createTreeItem should be + called on the top-most HistoryController so that we properly clone + the HistoryItem tree starting at the root node. + +2010-07-30 fsamuel@chromium.org <fsamuel@chromium.org> + + Reviewed by Dimitri Glazkov. + + Expand SVG Attribute Macros + https://bugs.webkit.org/show_bug.cgi?id=43254 + + Expanded SVG Attribute Macros to reduce debugging headache. + + No change in behavior, so no new tests. + + * rendering/style/SVGRenderStyle.h: Expanded and removed references to SVG_RS_DEFINE_ATTRIBUTE* macros. + * rendering/style/SVGRenderStyleDefs.h: Removed definitons for expanded macros. + +2010-07-30 Kinuko Yasuda <kinuko@chromium.org> + + Reviewed by Dumitru Daniliuc. + + Add callback arguments support to binding code generator scripts + https://bugs.webkit.org/show_bug.cgi?id=43130 + + Tests: bindings/scripts/test/TestObj.idl + + * bindings/scripts/CodeGeneratorJS.pm: + * bindings/scripts/CodeGeneratorV8.pm: + + * bindings/scripts/test/JS/JSTestObj.cpp: + (WebCore::jsTestObjPrototypeFunctionMethodWithCallbackArg): + (WebCore::jsTestObjPrototypeFunctionMethodWithNonCallbackArgAndCallbackArg): + (WebCore::jsTestObjPrototypeFunctionMethodWithCallbackAndOptionalArg): + * bindings/scripts/test/JS/JSTestObj.h: + * bindings/scripts/test/TestObj.idl: + * bindings/scripts/test/V8/V8TestObj.cpp: + (WebCore::TestObjInternal::methodWithCallbackArgCallback): + (WebCore::TestObjInternal::methodWithNonCallbackArgAndCallbackArgCallback): + (WebCore::TestObjInternal::methodWithCallbackAndOptionalArgCallback): + (WebCore::ConfigureV8TestObjTemplate): + +2010-07-30 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Implement NPN_InvokeDefault + https://bugs.webkit.org/show_bug.cgi?id=43266 + + * bindings/js/JSPluginElementFunctions.cpp: + (WebCore::isPluginElement): + Add convenience function. + + (WebCore::pluginInstance): + Call isPluginElement. + + (WebCore::pluginScriptObjectFromPluginViewBase): + Given an JSHTMLElement, ask the PluginViewBase for the scriptable object. + + (WebCore::pluginScriptObject): + Call isPluginElement. Call pluginScriptObjectFromPluginViewBase. + + (WebCore::callPlugin): + Get the script object, assemble the arguments and call "call" directly. + + (WebCore::runtimeObjectGetCallData): + Try to get the script object from the PluginViewBase first. + + * plugins/PluginViewBase.h: + (WebCore::PluginViewBase::scriptObject): + Remove ExecState parameter. + +2010-07-30 Adam Roben <aroben@apple.com> + + Roll our r64361 and r64363 + + We can't make these changes until QuartzCore.lib is included in + WebKitSupportLibrary. + +2010-07-30 Adam Roben <aroben@apple.com> + + Remove uses of CACFContextRef and CARender* from WebCore + + These types are now wrapped in a WKCACFContext type exported by + WebKitSystemInterface. + + Fixes <http://webkit.org/b/43244>. + + Reviewed by Sam Weinig. + + * platform/graphics/win/WKCACFContextFlusher.cpp: + (WebCore::WKCACFContextFlusher::addContext): + (WebCore::WKCACFContextFlusher::removeContext): + (WebCore::WKCACFContextFlusher::flushAllContexts): + * platform/graphics/win/WKCACFContextFlusher.h: + Changed to use WKCACFContext. We don't retain/release the context when + putting it into/taking it out of the set. WKCACFContext is not a + ref-counted type, so we can't retain/release it, but the + retain/release was also unnecessary as WKCACFLayerRenderer calls + removeContext before the context is destroyed. + + * platform/graphics/win/WKCACFLayer.cpp: + (WebCore::WKCACFLayer::becomeRootLayerForContext): + * platform/graphics/win/WKCACFLayer.h: + Changed to use WKCACFContext. + + * platform/graphics/win/WKCACFLayerRenderer.cpp: + (WebCore::WKCACFLayerRenderer::didFlushContext): + (WebCore::WKCACFLayerRenderer::WKCACFLayerRenderer): + (WebCore::WKCACFLayerRenderer::~WKCACFLayerRenderer): + (WebCore::WKCACFLayerRenderer::layerTreeDidChange): + (WebCore::WKCACFLayerRenderer::createRenderer): + (WebCore::WKCACFLayerRenderer::destroyRenderer): + (WebCore::WKCACFLayerRenderer::render): Also replaced uses of + CGSRegion with WebKitSystemInterface functions/types. + (WebCore::WKCACFLayerRenderer::resetDevice): + * platform/graphics/win/WKCACFLayerRenderer.h: + Replaced our CACFContextRef, CARenderContext, and CARenderOGLContext + with a single WKCACFContext, which wraps all three. We hold a bare + pointer to it and destroy it in our destructor. + +2010-07-30 Adam Roben <aroben@apple.com> + + Remove knowledge of WKCACFContextFlusher from WKCACFLayer + + Fixes <http://webkit.org/b/43248> WKCACFLayer shouldn't know about + WKCACFContextFlusher + + Reviewed by Sam Weinig. + + * platform/graphics/win/WKCACFLayer.cpp: + (WebCore::WKCACFLayer::setNeedsCommit): Don't bother calling to + WKCACFContextFlusher. Our root layer will do this for us. + + * platform/graphics/win/WKCACFLayerRenderer.cpp: + (WebCore::WKCACFRootLayer::setNeedsRender): Changed to call the new + layerTreeDidChange function. + (WebCore::WKCACFLayerRenderer::layerTreeDidChange): Added. Tells + WKCACFContextFlusher that the context has changed, and schedules a + render. + + * platform/graphics/win/WKCACFLayerRenderer.h: Added + layerTreeDidChange. + +2010-07-29 Jeremy Orlow <jorlow@chromium.org> + + Reviewed by Steve Block. + + Rename all the IDBIndex classses to match the latest conventions + https://bugs.webkit.org/show_bug.cgi?id=43190 + + No functionality has changed. + + IDBIndexRequest -> IDBIndex in the spec. So that's the first change. + IDBIndex was the name of our interface class though, so we need to rename + it to get it out of the way. While we're at it, we might as well clean + up the naming in general to make things more clear. In the future, we're + going to need another layer (yes, yuck) which will be shared by the async + and sync classes which will do caching and other optimizations. That will + then connect to the backend. We also added "Interface" to make it more + clear that's what the file/class is. + + Existing layout tests are enough since nothing should change as far as JavaScript can see. + + * Android.derived.jscbindings.mk: + * Android.derived.v8bindings.mk: + * Android.mk: + * CMakeLists.txt: + * DerivedSources.cpp: + * DerivedSources.make: + * GNUmakefile.am: + * WebCore.gypi: + * WebCore.pri: + * WebCore.pro: + * WebCore.xcodeproj/project.pbxproj: + * bindings/js/JSIDBAnyCustom.cpp: + (WebCore::toJS): + * bindings/v8/custom/V8IDBAnyCustom.cpp: + (WebCore::toV8): + * storage/IDBAny.cpp: + (WebCore::IDBAny::idbIndex): + (WebCore::IDBAny::set): + * storage/IDBAny.h: + (WebCore::IDBAny::): + * storage/IDBCallbacks.h: + * storage/IDBIndex.cpp: Added. + (WebCore::IDBIndex::IDBIndex): + (WebCore::IDBIndex::~IDBIndex): + * storage/IDBIndex.h: + (WebCore::IDBIndex::create): + (WebCore::IDBIndex::name): + (WebCore::IDBIndex::keyPath): + (WebCore::IDBIndex::unique): + * storage/IDBIndex.idl: Added. + * storage/IDBIndexBackendImpl.cpp: Added. + (WebCore::IDBIndexBackendImpl::IDBIndexBackendImpl): + (WebCore::IDBIndexBackendImpl::~IDBIndexBackendImpl): + * storage/IDBIndexBackendImpl.h: Added. + (WebCore::IDBIndexBackendImpl::create): + (WebCore::IDBIndexBackendImpl::name): + (WebCore::IDBIndexBackendImpl::keyPath): + (WebCore::IDBIndexBackendImpl::unique): + * storage/IDBIndexBackendInterface.h: Added. + (WebCore::IDBIndexBackendInterface::~IDBIndexBackendInterface): + * storage/IDBIndexImpl.cpp: Removed. + * storage/IDBIndexImpl.h: Removed. + * storage/IDBIndexRequest.cpp: Removed. + * storage/IDBIndexRequest.h: Removed. + * storage/IDBIndexRequest.idl: Removed. + * storage/IDBObjectStore.h: + * storage/IDBObjectStoreImpl.cpp: + (WebCore::IDBObjectStoreImpl::createIndex): + (WebCore::IDBObjectStoreImpl::index): + * storage/IDBObjectStoreImpl.h: + * storage/IDBObjectStoreRequest.cpp: + (WebCore::IDBObjectStoreRequest::index): + * storage/IDBObjectStoreRequest.h: + * storage/IDBObjectStoreRequest.idl: + * storage/IDBRequest.cpp: + (WebCore::IDBRequest::onSuccess): + * storage/IDBRequest.h: + +2010-07-30 Rafael Antognolli <antognolli@profusion.mobi> + + Reviewed by Antonio Gomes. + + [EFL] Add library version and soname to EFL generated libraries and binary. + https://bugs.webkit.org/show_bug.cgi?id=43212 + + Add version and soname to libwebcore.so in case of linking as shared + library. + + No new feature, so no new tests. + + * CMakeLists.txt: + +2010-07-30 Steve Block <steveblock@google.com> + + Reviewed by Steve Block. + + Add LayoutTestController methods to test DeviceOrientation + https://bugs.webkit.org/show_bug.cgi?id=39589 + + This patch does not hook up the new LayoutTestController method to WebKit + for any platform. This will be done in later patches. + https://bugs.webkit.org/show_bug.cgi?id=43181 tracks this for Mac. + + Test: fast/dom/DeviceOrientation/basic-operation.html + + * Android.mk: + * CMakeLists.txt: + * GNUmakefile.am: + * WebCore.exp.in: + * WebCore.gypi: + * WebCore.pro: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * dom/DeviceOrientationClient.h: + (WebCore::DeviceOrientationClient::~DeviceOrientationClient): + * dom/DeviceOrientationController.cpp: + (WebCore::DeviceOrientationController::DeviceOrientationController): + * dom/DeviceOrientationEvent.cpp: + * platform/mock/DeviceOrientationClientMock.cpp: Added. + (WebCore::DeviceOrientationClientMock::DeviceOrientationClientMock): + (WebCore::DeviceOrientationClientMock::setController): + (WebCore::DeviceOrientationClientMock::startUpdating): + (WebCore::DeviceOrientationClientMock::stopUpdating): + (WebCore::DeviceOrientationClientMock::setOrientation): + (WebCore::DeviceOrientationClientMock::timerFired): + * platform/mock/DeviceOrientationClientMock.h: Added. + (WebCore::DeviceOrientationClientMock::lastOrientation): + +2010-07-30 Satish Sampath <satish@chromium.org> + + Reviewed by Jeremy Orlow. + + Add a mock in WebCore for testing speech input + https://bugs.webkit.org/show_bug.cgi?id=42603 + + Layout tests will be added in a subsequent patch using this mock. + + * Android.mk: + * GNUmakefile.am: + * WebCore.gypi: + * WebCore.pro: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * platform/mock/SpeechInputClientMock.cpp: Added. + (WebCore::SpeechInputClientMock::SpeechInputClientMock): + (WebCore::SpeechInputClientMock::startRecognition): + (WebCore::SpeechInputClientMock::stopRecording): + (WebCore::SpeechInputClientMock::cancelRecognition): + (WebCore::SpeechInputClientMock::setRecognitionResult): + (WebCore::SpeechInputClientMock::timerFired): + * platform/mock/SpeechInputClientMock.h: Added. + +2010-07-30 Nikolas Zimmermann <nzimmermann@rim.com> + + Reviewed by Dirk Schulze. + + Optimize SVGResources memory usage + https://bugs.webkit.org/show_bug.cgi?id=43236 + + Instead of storing pointers to all possible resources that could be applied to an element, group them in three categories: + clipper/filter/masker, marker-start/marker-mid/marker-end, and fill/stroke. + + Only build the cached resources data for elements where the properties can be applied to. Maintain a static list of tagnames + for each of the three categories, to avoid doing unncessary work. + + Doesn't affect any tests. + + * rendering/SVGResources.cpp: + (WebCore::SVGResources::SVGResources): + (WebCore::clipperFilterMaskerTags): + (WebCore::markerTags): + (WebCore::fillAndStrokeTags): + (WebCore::SVGResources::buildCachedResources): + (WebCore::SVGResources::invalidateClient): + (WebCore::SVGResources::resourceDestroyed): + (WebCore::SVGResources::buildSetOfResources): + (WebCore::SVGResources::setClipper): + (WebCore::SVGResources::resetClipper): + (WebCore::SVGResources::setFilter): + (WebCore::SVGResources::resetFilter): + (WebCore::SVGResources::setMarkerStart): + (WebCore::SVGResources::resetMarkerStart): + (WebCore::SVGResources::setMarkerMid): + (WebCore::SVGResources::resetMarkerMid): + (WebCore::SVGResources::setMarkerEnd): + (WebCore::SVGResources::resetMarkerEnd): + (WebCore::SVGResources::setMasker): + (WebCore::SVGResources::resetMasker): + (WebCore::SVGResources::setFill): + (WebCore::SVGResources::resetFill): + (WebCore::SVGResources::setStroke): + (WebCore::SVGResources::resetStroke): + (WebCore::SVGResources::dump): + * rendering/SVGResources.h: + (WebCore::SVGResources::clipper): + (WebCore::SVGResources::filter): + (WebCore::SVGResources::markerStart): + (WebCore::SVGResources::markerMid): + (WebCore::SVGResources::markerEnd): + (WebCore::SVGResources::masker): + (WebCore::SVGResources::fill): + (WebCore::SVGResources::stroke): + (WebCore::SVGResources::ClipperFilterMaskerData::ClipperFilterMaskerData): + (WebCore::SVGResources::ClipperFilterMaskerData::create): + (WebCore::SVGResources::MarkerData::MarkerData): + (WebCore::SVGResources::MarkerData::create): + (WebCore::SVGResources::FillStrokeData::FillStrokeData): + (WebCore::SVGResources::FillStrokeData::create): + +2010-07-26 Andrei Popescu <andreip@google.com> + + Reviewed by Jeremy Orlow. + + [IndexedDB] IndexedDatabase should be called IDBFactory. + https://bugs.webkit.org/show_bug.cgi?id=42967 + + Rename IndexedDatabase to IDBFactory to match the specification. + + Also implement the following new naming convention: + IDBFoo IDL interfaces are implemented using IDBFoo C++ classes. + IDBFoo objects have pointers to IDBFooBackendInterface objects. + IDBFooBackendInterface is implemented by IDBFooBackendImpl and + IDBFooBackendProxy (for Chromium). + + No new tests needed, just renaming. + + * Android.derived.jscbindings.mk: + * Android.derived.v8bindings.mk: + * Android.mk: + * CMakeLists.txt: + * DerivedSources.cpp: + * DerivedSources.make: + * GNUmakefile.am: + * WebCore.gyp/WebCore.gyp: + * WebCore.gypi: + * WebCore.pri: + * WebCore.pro: + * WebCore.xcodeproj/project.pbxproj: + * bindings/js/JSIDBAnyCustom.cpp: + (WebCore::toJS): + * bindings/v8/custom/V8IDBAnyCustom.cpp: + (WebCore::toV8): + * page/DOMWindow.cpp: + (WebCore::DOMWindow::clear): + (WebCore::DOMWindow::indexedDB): + * page/DOMWindow.h: + * page/DOMWindow.idl: + * page/PageGroup.cpp: + (WebCore::PageGroup::idbFactory): + * page/PageGroup.h: + * platform/chromium/ChromiumBridge.h: + * storage/IDBAny.cpp: + (WebCore::IDBAny::idbFactory): + (WebCore::IDBAny::set): + * storage/IDBAny.h: + (WebCore::IDBAny::): + * storage/IDBDatabaseRequest.cpp: + * storage/IDBFactory.cpp: Added. + (WebCore::IDBFactory::IDBFactory): + (WebCore::IDBFactory::~IDBFactory): + (WebCore::IDBFactory::open): + * storage/IDBFactory.h: Added. + (WebCore::IDBFactory::create): + * storage/IDBFactory.idl: Added. + * storage/IDBFactoryBackendInterface.cpp: Added. + (WebCore::IDBFactoryBackendInterface::create): + * storage/IDBFactoryBackendInterface.h: Added. + (WebCore::IDBFactoryBackendInterface::~IDBFactoryBackendInterface): + * storage/IDBFactoryBackendImpl.cpp: Added. + (WebCore::IDBFactoryBackendImpl::create): + (WebCore::IDBFactoryBackendImpl::IDBFactoryBackendImpl): + (WebCore::IDBFactoryBackendImpl::~IDBFactoryBackendImpl): + (WebCore::IDBFactoryBackendImpl::open): + * storage/IDBFactoryBackendImpl.h: Added. + * storage/IDBKeyRange.cpp: + (WebCore::IDBKeyRange::only): + (WebCore::IDBKeyRange::leftBound): + (WebCore::IDBKeyRange::rightBound): + (WebCore::IDBKeyRange::bound): + * storage/IDBKeyRange.h: + * storage/IDBKeyRange.idl: + * storage/IndexedDatabase.cpp: Removed. + * storage/IndexedDatabase.h: Removed. + * storage/IndexedDatabaseImpl.cpp: Removed. + * storage/IndexedDatabaseImpl.h: Removed. + * storage/IndexedDatabaseRequest.cpp: Removed. + * storage/IndexedDatabaseRequest.h: Removed. + * storage/IndexedDatabaseRequest.idl: Removed. + * storage/chromium/IDBFactoryBackendInterface.cpp: Added. + (WebCore::IDBFactoryBackendInterface::create): + * storage/chromium/IndexedDatabase.cpp: Removed. + +2010-07-29 Alexander Pavlov <apavlov@chromium.org> + + Reviewed by Pavel Feldman. + + Web Inspector: Crash on refresh with a comment selected in the Elements panel + https://bugs.webkit.org/show_bug.cgi?id=43183 + + * inspector/InspectorDOMAgent.cpp: + (WebCore::InspectorDOMAgent::nodeForPath): + * inspector/front-end/ElementsPanel.js: + (WebInspector.ElementsPanel.prototype.reset): + +2010-07-30 Renata Hodovan <reni@inf.u-szeged.hu> + + Reviewed by Nikolas Zimmermann. + + feTurbulence is not implemented. + https://bugs.webkit.org/show_bug.cgi?id=5864 + + This code is based on the previous implementation of + Dirk Schulze, extended with some modification and optimization. + + LayoutTests: Updating expected values for turbulence filter. + svg/W3C-SVG-1.1/filters-turb-01-f.svg + + * svg/SVGFETurbulenceElement.cpp: + (WebCore::SVGFETurbulenceElement::build): + * svg/graphics/filters/SVGFETurbulence.cpp: + (WebCore::FETurbulence::FETurbulence): + (WebCore::FETurbulence::create): + (WebCore::FETurbulence::PaintingData::PaintingData): + (WebCore::FETurbulence::PaintingData::random): + (WebCore::smoothCurve): + (WebCore::linearInterpolation): + (WebCore::FETurbulence::initPaint): + (WebCore::checkNoise): + (WebCore::FETurbulence::noise2D): + (WebCore::Noise::if): + (WebCore::FETurbulence::calculateTurbulenceValueForPoint): + (WebCore::FETurbulence::apply): + * svg/graphics/filters/SVGFETurbulence.h: + (WebCore::): + +2010-07-29 Martin Robinson <mrobinson@igalia.com> + + Reviewed by Dirk Schulze. + + Cairo: Need to implement GraphicsContext::clipConvexPolygon() + https://bugs.webkit.org/show_bug.cgi?id=41308 + + Implement clipConvexPolygon for Cairo ports and enable new path based + borders for that port as well. + + * platform/graphics/cairo/GraphicsContextCairo.cpp: + (WebCore::addConvexPolygonToContext): Add this helper method. + (WebCore::GraphicsContext::drawConvexPolygon): Use the new addConvexPolygonToContext helper. + (WebCore::GraphicsContext::clipConvexPolygon): Implement this method. + * rendering/RenderObject.h: Enable path based borders for Cairo. + +2010-07-29 Ryosuke Niwa <rniwa@webkit.org> + + Reviewed by Darin Adler. + + InsertOrderedList does not switch the list type properly when it has an inner list. + https://bugs.webkit.org/show_bug.cgi?id=43166 + + The bug was caused by forcedCreateList was not set to true when the start and the end + of the selection lies in the same list. Added selectionHasListOfType to fix this problem. + + WebKit used not to convert the outer lists even when the list is fully selected. + Corrected this behavior by converting the entire list at once when the list is fully selected. + To decide whether or not a list is fully selected, added currentSelection argument to doApplyForSingleParagraph. + + Tests: editing/execCommand/switch-list-type-with-inner-list.html + editing/execCommand/switch-list-type-with-orphaned-li.html + + * editing/InsertListCommand.cpp: + (WebCore::InsertListCommand::mergeWithNeighboringLists): Extracted the code to merge lists. + (WebCore::InsertListCommand::selectionHasListOfType): attachment.cgi + (WebCore::InsertListCommand::doApply): Calls selectionHasListOfType. + (WebCore::InsertListCommand::doApplyForSingleParagraph): See above. + (WebCore::InsertListCommand::listifyParagraph): Calls mergeWithNeighboringLists. + * editing/InsertListCommand.h: + * editing/htmlediting.cpp: + (WebCore::canMergeLists): Ensures lists being merged are instances of HTMLElement. + (WebCore::isNodeVisiblyContainedWithin): Works properly when one end is inside the range. + +2010-07-29 Martin Robinson <mrobinson@igalia.com> + + Reviewed by Dirk Schulze. + + [Cairo] Bring behavior of paths on the Cairo GraphicsContext into line with the CoreGraphics port + https://bugs.webkit.org/show_bug.cgi?id=41732 + + Do not apply paths added to the Cairo GraphicsContext, until they are used. + This prevents drawing routines such as fillRect from interacting with any + path which callers are constructing on the GraphicsContext. + + This behavior is necessary to close bug https://bugs.webkit.org/show_bug.cgi?id=41308 + so tests for that issue will test this fix. + + * platform/graphics/cairo/GraphicsContextCairo.cpp: + (WebCore::appendPathToCairoContext): Added. A helper method which adds a path + to a native Cairo context. + (WebCore::setPathOnCairoContext): Added. Like appendPathToCairoContext, but clears the + existing path first. + (WebCore::appendWebCorePathToCairoContext): Added. Like appendPathToCairoContext, but + operates on a WebCore path. + (WebCore::fillCurrentCairoPath): Added. Helper which fills the current cairo context path. + (WebCore::strokeCurrentCairoPath): Added. Helper which strokes the current cairo context path. + (WebCore::GraphicsContext::drawEllipse): Only clear the Cairo path if cairo_stroke + was not called, because cairo_stroke implicitly clears the path. + (WebCore::GraphicsContext::drawConvexPolygon): Ditto. + (WebCore::GraphicsContext::fillPath): Copy the path from m_pendingPath to the context + and clear m_pendingPath, instead of relying on the pre-existing context path. Do the + actual fill via the new helper. + (WebCore::GraphicsContext::strokePath): Ditto. + (WebCore::GraphicsContext::drawPath): Ditto. + (WebCore::GraphicsContext::fillRect): Use the new fillCurrentCairoPath helper. + (WebCore::GraphicsContext::drawFocusRing): Use the new appendWebCorePathToCairoContext helper instead + of addPath (which will blow away any path callers are building). + (WebCore::GraphicsContext::addInnerRoundedRectClip): Use the new appendWebCorePathToCairoContext helper instead + of addPath (which will blow away any path callers are building). + (WebCore::GraphicsContext::strokeRect): Use the new strokeCurrentCairoPath helper. + (WebCore::GraphicsContext::beginPath): Clear out m_pendingPath here instead of the main native context. + (WebCore::GraphicsContext::addPath): Add the path to m_pendingPath instead of the main native context. + Also ensure that the transformation matrix of the m_pendingPath is equal to that of the main + cairo context. + (WebCore::GraphicsContext::clipOut): Use the appendWebCorePathToCairoContext helper here. + (WebCore::GraphicsContext::fillRoundedRect): Ditto and remove an unnecessary beginPath call. + * platform/graphics/cairo/GraphicsContextPlatformPrivateCairo.h: Add a new m_pendingPath member. + +2010-07-29 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r64313. + http://trac.webkit.org/changeset/64313 + https://bugs.webkit.org/show_bug.cgi?id=43233 + + Some Chromium bots are not happy with it for some unknown + reason. (Requested by dumi on #webkit). + + * bindings/js/JSCustomVoidCallback.cpp: + (WebCore::JSCustomVoidCallback::~JSCustomVoidCallback): + * bindings/scripts/CodeGeneratorJS.pm: + * bindings/scripts/test/JS/JSTestCallback.cpp: + (WebCore::JSTestCallback::~JSTestCallback): + * platform/sql/SQLiteDatabase.cpp: + (WebCore::SQLiteDatabase::SQLiteDatabase): + (WebCore::SQLiteDatabase::close): + (WebCore::SQLiteDatabase::lock): + (WebCore::SQLiteDatabase::unlock): + * platform/sql/SQLiteDatabase.h: + * platform/sql/SQLiteStatement.cpp: + (WebCore::SQLiteStatement::prepare): + (WebCore::SQLiteStatement::step): + * storage/AbstractDatabase.cpp: + * storage/AbstractDatabase.h: + * storage/DatabaseTracker.cpp: + * storage/DatabaseTracker.h: + * storage/SQLStatement.cpp: + (WebCore::SQLStatement::execute): + * storage/SQLStatementSync.cpp: + (WebCore::SQLStatementSync::execute): + * storage/SQLTransaction.cpp: + (WebCore::SQLTransaction::checkAndHandleClosedDatabase): + (WebCore::SQLTransaction::performNextStep): + (WebCore::SQLTransaction::performPendingCallback): + (WebCore::SQLTransaction::deliverTransactionCallback): + (WebCore::SQLTransaction::postflightAndCommit): + (WebCore::SQLTransaction::deliverTransactionErrorCallback): + (WebCore::SQLTransaction::cleanupAfterTransactionErrorCallback): + * storage/SQLTransaction.h: + * storage/chromium/DatabaseTrackerChromium.cpp: + * workers/WorkerThread.cpp: + (WebCore::WorkerThread::stop): + +2010-07-29 Martin Robinson <mrobinson@igalia.com> + + Unreviewed, rolling out r64318. + http://trac.webkit.org/changeset/64318 + https://bugs.webkit.org/show_bug.cgi?id=41732 + + This change broke many tests. + + * platform/graphics/cairo/GraphicsContextCairo.cpp: + (WebCore::GraphicsContext::drawEllipse): + (WebCore::GraphicsContext::drawConvexPolygon): + (WebCore::GraphicsContext::fillPath): + (WebCore::GraphicsContext::strokePath): + (WebCore::GraphicsContext::drawPath): + (WebCore::GraphicsContext::drawFocusRing): + (WebCore::GraphicsContext::addInnerRoundedRectClip): + (WebCore::GraphicsContext::beginPath): + (WebCore::GraphicsContext::addPath): + (WebCore::GraphicsContext::clipOut): + (WebCore::GraphicsContext::fillRoundedRect): + * platform/graphics/cairo/GraphicsContextPlatformPrivateCairo.h: + +2010-07-29 Martin Robinson <mrobinson@igalia.com> + + Reviewed by Dirk Schulze. + + [Cairo] Bring behavior of paths on the Cairo GraphicsContext into line with the CoreGraphics port + https://bugs.webkit.org/show_bug.cgi?id=41732 + + Do not apply paths added to the Cairo GraphicsContext, until they are used. + This prevents drawing routines such as fillRect from interacting with any + path which callers are constructing on the GraphicsContext. + + This behavior is necessary to close bug https://bugs.webkit.org/show_bug.cgi?id=41308 + so tests for that issue will test this fix. + + * platform/graphics/cairo/GraphicsContextCairo.cpp: + (WebCore::appendPathToCairoContext): Added. A helper method which adds a path + to a native Cairo context. + (WebCore::setPathOnCairoContext): Added. Like appendPathToCairoContext, but clears the + existing path first. + (WebCore::appendWebCorePathToCairoContext): Added. Like appendPathToCairoContext, but + operates on a WebCore path. + (WebCore::GraphicsContext::drawEllipse): Only clear the Cairo path if cairo_stroke + was not called, because cairo_stroke implicitly clears the path. + (WebCore::GraphicsContext::drawConvexPolygon): Ditto. + (WebCore::GraphicsContext::fillPath): Copy the path from m_pendingPath to the context + and clear m_pendingPath, instead of relying on the pre-existing context path. + (WebCore::GraphicsContext::strokePath): Ditto. + (WebCore::GraphicsContext::drawPath): Ditto. + (WebCore::GraphicsContext::drawFocusRing): Use the new appendWebCorePathToCairoContext helper instead + of addPath (which will blow away any path callers are building). + (WebCore::GraphicsContext::addInnerRoundedRectClip): Use the new appendWebCorePathToCairoContext helper instead + of addPath (which will blow away any path callers are building). + (WebCore::GraphicsContext::beginPath): Clear out m_pendingPath here instead of the main native context. + (WebCore::GraphicsContext::addPath): Add the path to m_pendingPath instead of the main native context. + Also ensure that the transformation matrix of the m_pendingPath is equal to that of the main + cairo context. + (WebCore::GraphicsContext::clipOut): Use the appendWebCorePathToCairoContext helper here. + (WebCore::GraphicsContext::fillRoundedRect): Ditto and remove an unnecessary beginPath call. + * platform/graphics/cairo/GraphicsContextPlatformPrivateCairo.h: Add a new m_pendingPath member. + +2010-07-29 Martin Robinson <mrobinson@igalia.com> + + Reviewed by Dirk Schulze. + + [Cairo] Remove setStrokeStyle workaround for InlineTextBoxes + https://bugs.webkit.org/show_bug.cgi?id=43136 + + Remove workaround added in https://bugs.webkit.org/show_bug.cgi?id=15659 + to fix stroke style for InlineTextBox underlines. + + No new tests as this should not change functionality. + + * platform/graphics/cairo/GraphicsContextCairo.cpp: + (WebCore::GraphicsContext::drawLineForText): Remove old workaround. + +2010-07-28 Dumitru Daniliuc <dumi@chromium.org> + + Reviewed by David Levin. + + Interrupt all DB operations when the worker is terminating. + https://bugs.webkit.org/show_bug.cgi?id=42843 + + Tests: fast/workers/storage/interrupt-database-sync.html + fast/workers/storage/interrupt-database.html + + * bindings/js/JSCustomVoidCallback.cpp: + (WebCore::JSCustomVoidCallback::~JSCustomVoidCallback): If the + destructor is called on the context thread, delete m_data directly + instead of posting a task to do that. We need to do that to make + sure that all JS objects are destroyed before + WorkerThreadShutdownFinishTask (in WorkerThread.cpp) calls + WorkerContext::clearScript(). + + * bindings/scripts/CodeGeneratorJS.pm: Same change as above, for + all auto-generated callbacks. + + * bindings/scripts/test/JS/JSTestCallback.cpp: + (WebCore::JSTestCallback::~JSTestCallback): Updated the + expectations for run-bindings-tests. + + * platform/sql/SQLiteDatabase.cpp: Added the ability to interrupt + all DB operations in progress, unless the database was closed or + is being closed. Unlike sqlite3_interrupt(), + SQLiteDatabase::interrupt() is sticky: once it's called, trying to + run any statement on that database will fail with a + SQLITE_INTERRUPT error code. + (WebCore::SQLiteDatabase::SQLiteDatabase): + (WebCore::SQLiteDatabase::close): + (WebCore::SQLiteDatabase::interrupt): + (WebCore::SQLiteDatabase::isInterrupted): + + * platform/sql/SQLiteDatabase.h: Added a mutex that can used by + SQLiteStatement to check if the database was interrupted. + (WebCore::SQLiteDatabase::databaseMutex): + + * platform/sql/SQLiteStatement.cpp: Changed prepare() and step() + to check if the database was interrupted, before trying to prepare + or run the statement. The other methods don't need to hold on to + the DB lock while running, because they're fast, so we don't need + to interrupt them. + (WebCore::SQLiteStatement::prepare): + (WebCore::SQLiteStatement::step): + + * storage/AbstractDatabase.cpp: Made SQLiteDatabase::interrupt() + and isInterrupted() visible to WebSQLDatabases classes. + (WebCore::AbstractDatabase::interrupt): + (WebCore::AbstractDatabase::isInterrupted): + * storage/AbstractDatabase.h: + + * storage/DatabaseTracker.cpp: Added a method to interrupt all + databases in a given context. + (WebCore::DatabaseTracker::interruptAllDatabasesForContext): + * storage/DatabaseTracker.h: + + * storage/SQLStatement.cpp: Changed the exception/error reported + when a statement is interrupted. + (WebCore::SQLStatement::execute): + * storage/SQLStatementSync.cpp: + (WebCore::SQLStatementSync::execute): + + * storage/SQLTransaction.cpp: Changed the code to release the + callback objects as soon as they're not needed. + (WebCore::SQLTransaction::checkAndHandleClosedOrInterruptedDatabase): + Changed this method to not schedule the next transaction step when + the database is interrupted. + (WebCore::SQLTransaction::performNextStep): + (WebCore::SQLTransaction::performPendingCallback): + (WebCore::SQLTransaction::deliverTransactionCallback): + (WebCore::SQLTransaction::postflightAndCommit): + (WebCore::SQLTransaction::deliverTransactionErrorCallback): + (WebCore::SQLTransaction::cleanupAfterTransactionErrorCallback): + * storage/SQLTransaction.h: + + * storage/chromium/DatabaseTrackerChromium.cpp: Added a method to + interrupt all databases in a given context. + (WebCore::DatabaseTracker::interruptAllDatabasesForContext): + + * workers/WorkerThread.cpp: + (WebCore::WorkerThread::stop): Added a call to + DatabaseTracker::interruptAllDatabasesForContext(). + +2010-07-29 Bernhard Bauer <bauerb@chromium.org> + + Reviewed by Darin Fisher. + + Check if plugins are allowed before creating a Java applet. + https://bugs.webkit.org/show_bug.cgi?id=43196 + + * loader/SubframeLoader.cpp: + (WebCore::SubframeLoader::createJavaAppletWidget): + +2010-07-29 James Robinson <jamesr@chromium.org> + + Reviewed by Simon Fraser. + + Ask a canvas' rendering context if it is accelerated instead tying it directly to webgl + https://bugs.webkit.org/show_bug.cgi?id=43206 + + This unifies the logic for whether a canvas is accelerated or not into one place + and makes it easier to expand the logic in the future to, for example, cover some + 2d canvases. + + Just a refactoring, no change in behavior so no new tests. + + * html/canvas/CanvasRenderingContext.h: + (WebCore::CanvasRenderingContext::isAccelerated): + * html/canvas/WebGLRenderingContext.h: + (WebCore::WebGLRenderingContext::isAccelerated): + * rendering/RenderHTMLCanvas.cpp: + (WebCore::RenderHTMLCanvas::requiresLayer): + * rendering/RenderLayerCompositor.cpp: + (WebCore::RenderLayerCompositor::requiresCompositingForCanvas): + +2010-07-29 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Implement NPN_Status + https://bugs.webkit.org/show_bug.cgi?id=43205 + + * WebCore.exp.in: + Export Chrome::setStatusText. + +2010-07-29 Victor Wang <victorw@chromium.org> + + Unreviewed, rolling out r64270. + http://trac.webkit.org/changeset/64270 + https://bugs.webkit.org/show_bug.cgi?id=39589 + + The patch breaks chromium webkit unittest + + * WebCore.exp.in: + * WebCore.xcodeproj/project.pbxproj: + * dom/DeviceOrientationClient.h: + (WebCore::DeviceOrientationClient::~DeviceOrientationClient): + * dom/DeviceOrientationController.cpp: + (WebCore::DeviceOrientationController::DeviceOrientationController): + * dom/DeviceOrientationEvent.cpp: + * platform/mock/DeviceOrientationClientMock.cpp: Removed. + * platform/mock/DeviceOrientationClientMock.h: Removed. + +2010-07-29 Simon Fraser <simon.fraser@apple.com> + + Reviewed by Darin Adler. + + Resizer control does not paint in otherwise empty compositing layer + https://bugs.webkit.org/show_bug.cgi?id=42306 + + Ensure that we create backing store for an empty element with resize: both, + in order to render the resizer control. + + Test: compositing/overflow/resize-painting.html + + * rendering/RenderLayerBacking.h: + * rendering/RenderLayerBacking.cpp: + (WebCore::RenderLayerBacking::isSimpleContainerCompositingLayer): Check for hasOverflowControls() + earlier, before any child checks. + (WebCore::RenderLayerBacking::hasNonCompositingDescendants): Renamed from hasNonCompositingContent() + to clarify its purpose. + +2010-07-29 Adam Roben <aroben@apple.com> + + Remove WKCACFLayer::Lanczos + + This member is also unused. + + Rubber-stamped in advance by John Sullivan. + + * platform/graphics/win/WKCACFLayer.cpp: + (WebCore::toCACFFilterType): + (WebCore::fromCACFFilterType): + * platform/graphics/win/WKCACFLayer.h: + (WebCore::WKCACFLayer::): + +2010-07-29 Adam Roben <aroben@apple.com> + + Remove some unused WKCACFLayer members + + Fixes <http://webkit.org/b/43200> WKCACFLayer has some unused members + + Reviewed by John Sullivan. + + * platform/graphics/win/WKCACFLayer.h: Removed [set]ClearsContext, + [set]Filters, and [set]SortsSublayers. + +2010-07-28 Justin Schuh <jschuh@chromium.org> + + Reviewed by Nate Chapin. + + Clear PluginData's page pointer on Page destruction + https://bugs.webkit.org/show_bug.cgi?id=43147 + + Test: plugins/access-after-page-destroyed.html + + * page/Page.cpp: + (WebCore::Page::~Page): + +2010-07-29 Simon Fraser <simon.fraser@apple.com> + + Reviewed by Darin Adler. + + SHOULD NEVER BE REACHED assertion when switching tabs with composited content + https://bugs.webkit.org/show_bug.cgi?id=43167 + + When the root layer becomes unattached (e.g. when switching tabs), don't return + 'false' from paintingGoesToWindow() because that will cause a -setNeedsDispay, which + both allocates wasteful backing store, and causes an assertion when we try to + paint the layer. + + Test: manual-tests/compositing/assert-on-tab-switch.html: Added. + + * rendering/RenderLayerBacking.cpp: + (WebCore::RenderLayerBacking::paintingGoesToWindow): + +2010-07-29 Simon Fraser <simon.fraser@apple.com> + + Reviewed by Pavel Feldman. + + Crash when computing pseudo-style of a vanished scrollbar in inspector + https://bugs.webkit.org/show_bug.cgi?id=42561 + + When a styled overflow:scroll scrollbar gets destroyed, we need to clear out the m_owner pointer, + otherwise the event handling code (which keeps the Scrollbar alive) later causes the scrollbar + to try to use m_owner to get pseudo style. + + Test: scrollbars/overflow-custom-scrollbar-crash.html + + * rendering/RenderLayer.cpp: + (WebCore::RenderLayer::destroyScrollbar): If this is a custom scrollbar, clear the owning renderer. + * rendering/RenderScrollbar.cpp: + (WebCore::RenderScrollbar::getScrollbarPseudoStyle): Bail if m_owner is 0. + * rendering/RenderScrollbar.h: + (WebCore::RenderScrollbar::clearOwningRenderer): New method. + +2010-07-29 Nikolas Zimmermann <nzimmermann@rim.com> + + Not reviewed. Fix release builds, by removing unused variables, that only served for ASSERTs that are no longer needed. + + * rendering/SVGRenderSupport.cpp: + (WebCore::SVGRenderSupport::prepareToRenderSVGContent): + (WebCore::SVGRenderSupport::pointInClippingArea): + +2010-07-29 Nikolas Zimmermann <nzimmermann@rim.com> + + Not reviewed. Fix build warning about unreachable code, seen on the windows slave. + + * rendering/RenderSVGContainer.cpp: + (WebCore::RenderSVGContainer::selfWillPaint): + * rendering/RenderSVGRoot.cpp: + (WebCore::RenderSVGRoot::selfWillPaint): + +2010-07-29 Nikolas Zimmermann <nzimmermann@rim.com> + + Reviewed by Dirk Schulze. + + WebKit shouldn't ignore resource cycles, but break them as Opera does + https://bugs.webkit.org/show_bug.cgi?id=43031 + + mask images are not updated when render objects' bounds change + https://bugs.webkit.org/show_bug.cgi?id=15124 + + SVG Gradients do not resize correctly + https://bugs.webkit.org/show_bug.cgi?id=41902 + + svg/dynamic-updates: SVGMarkerElement markerHeight/Width tests are broken + https://bugs.webkit.org/show_bug.cgi?id=42616 + + svg/dynamic-updates: SVGMaskElement tests are all broken + https://bugs.webkit.org/show_bug.cgi?id=42617 + + Don't ignore resources containing cyclic references, but break them, as discussed on SVG WG mailing lists - to be compatible with Opera which already does that. + + We used to lookup RenderSVGResourceContainers objects, by extracting the URI reference from the SVGRenderStyle, then utilizing getElementById() to lookup the + node, and access its renderer. Opera ignores such references, if they point to resources that contain cyclic references. Ignoring them would mean we have + to mutate the render style to empty the resource strings. That obviously doesn't work, as it would break expectations (getComputedStyle, etc.). + + Introduce a SVGResources class that stores pointers to all resources, that can be applied to a RenderObject (clipper/filter/markers/masker). + Add a SVGResourcesCache class, which is basically a HashMap<RenderObject*, SVGResources*>. Whenever a RenderObject receives style, we extract the URI references + from the SVGRenderStyle, look up the RenderSVGResourceContainer* objects, and store them in a SVGResources* class. Then we execute a cycle detection logic, + which detects cyclic references and breaks them. Breaking them means just nulling the pointer to the resource in the SVGResources object. Those SVGResources + objects are cached, and used throughout the render tree to access resources. This way it's guaranteed that all cyclic references are resolved until layout/paint + phase begins. + + Add destroy/styleDidChange/updateFromElement methods to all SVG renderers, in order to keep track of resource/client changes in the SVGResourcesCache. + As side-effect the SVGResourcesCache now knows which RenderObject references which resource, and thus can handle client registration for a RenderSVGResourceContainer. + The RenderSVGResourceContainer now holds a HashSet of RenderObjects, that's always up2date, and not related to the fact wheter a resources has already been used + for painting. The old logic missed to register clients for a resource, when the resource was in an invalid state. Fixing that fixes the svg/dynamic-updates/SVGMaskElement* tests. + + Rewrite all svg/custom/recursive-(filter|gradient|mask|pattern).svg tests to contain a reference image how it should be renderered. All 1:1 compatible with Opera now. + + * rendering/RenderForeignObject.cpp: + (WebCore::RenderForeignObject::layout): Grab selfNeedsLayout() before calling RenderBlock::layout(), otherwhise it's always false. + * rendering/RenderPath.cpp: Don't look up resources manually, use SVGResourcesCache. + (WebCore::RenderPath::fillContains): Remove constness, to avoid the need to pass around const RenderObjects* to the SVGResourcesCache. + (WebCore::RenderPath::strokeContains): Ditto. + (WebCore::RenderPath::layout): s/RenderSVGResource::invalidateAllResourcesOfRenderer/SVGResourcesCache::clientLayoutChanged/. + (WebCore::RenderPath::calculateMarkerBoundsIfNeeded): Remove special client handling for markers, it's all unified now. + (WebCore::RenderPath::styleWillChange): Only call setNeedsBoundariesUpdate when handling StyleDifferenceRepaint/Layout. + * rendering/RenderPath.h: + * rendering/RenderSVGBlock.cpp: + (WebCore::RenderSVGBlock::destroy): Forward to SVGResourcesCache::clientDestroyed. + (WebCore::RenderSVGBlock::styleDidChange): Forward to SVGResourcesCache::clientStyleChanged. + (WebCore::RenderSVGBlock::updateFromElement): Forward to SVGResourcesCache::clientUpdatedFromElement. + * rendering/RenderSVGBlock.h: + * rendering/RenderSVGContainer.cpp: + (WebCore::RenderSVGContainer::layout): s/RenderSVGResource::invalidateAllResourcesOfRenderer/SVGResourcesCache::clientLayoutChanged/. + (WebCore::RenderSVGContainer::selfWillPaint): Don't look up resources manually, use SVGResourcesCache. + * rendering/RenderSVGContainer.h: + * rendering/RenderSVGGradientStop.cpp: + (WebCore::RenderSVGGradientStop::styleDidChange): Rewrite, as invalidateResourceClients() is gone. + * rendering/RenderSVGHiddenContainer.h: Make layout() protected, as RenderSVGResourceContainer overrides it. + * rendering/RenderSVGImage.cpp: + (WebCore::RenderSVGImage::layout): s/RenderSVGResource::invalidateAllResourcesOfRenderer/SVGResourcesCache::clientLayoutChanged/. + (WebCore::RenderSVGImage::destroy): Forward to SVGResourcesCache::clientDestroyed. + (WebCore::RenderSVGImage::styleDidChange): Forward to SVGResourcesCache::clientStyleChanged. + (WebCore::RenderSVGImage::updateFromElement): Forward to SVGResourcesCache::clientUpdatedFromElement. + (WebCore::RenderSVGImage::imageChanged): Don't look up resources manually, use SVGResourcesCache. + * rendering/RenderSVGImage.h: + * rendering/RenderSVGInline.cpp: + (WebCore::RenderSVGInline::destroy): Forward to SVGResourcesCache::clientDestroyed. + (WebCore::RenderSVGInline::styleDidChange): Forward to SVGResourcesCache::clientStyleChanged. + (WebCore::RenderSVGInline::updateFromElement): Forward to SVGResourcesCache::clientUpdatedFromElement. + * rendering/RenderSVGInline.h: + * rendering/RenderSVGModelObject.cpp: + (WebCore::RenderSVGModelObject::destroy): Forward to SVGResourcesCache::clientDestroyed. + (WebCore::RenderSVGModelObject::styleDidChange): Forward to SVGResourcesCache::clientStyleChanged. + (WebCore::RenderSVGModelObject::updateFromElement): Forward to SVGResourcesCache::clientUpdatedFromElement. + * rendering/RenderSVGModelObject.h: + * rendering/RenderSVGResource.cpp: + (WebCore::RenderSVGResource::fillPaintingResource): Remove const from RenderObject parameter. + (WebCore::RenderSVGResource::strokePaintingResource): Ditto. + (WebCore::RenderSVGResource::markForLayoutAndParentResourceInvalidation): Early exit if we found the first parent resource. + * rendering/RenderSVGResource.h: + * rendering/RenderSVGResourceClipper.cpp: + (WebCore::RenderSVGResourceClipper::~RenderSVGResourceClipper): Early exit if m_clipper is empty. + (WebCore::RenderSVGResourceClipper::invalidateClients): Use new helper functions to invalidate clients, shared between all resources in RenderSVGResourceContainer. + (WebCore::RenderSVGResourceClipper::invalidateClient): Ditto. + (WebCore::RenderSVGResourceClipper::applyResource): Remove containsCyclicReference() check, SVGResourcesCycleSolver breaks cyclic references, resources do not need to take care anymore. + (WebCore::RenderSVGResourceClipper::createClipData): Don't look up resources manually, use SVGResourcesCache. + (WebCore::RenderSVGResourceClipper::hitTestClipContent): Remove containsCyclicReference() check, SVGResourcesCycleSolver breaks cyclic references, resources do not need to take care anymore. + * rendering/RenderSVGResourceClipper.h: + * rendering/RenderSVGResourceContainer.cpp: + (WebCore::svgExtensionsFromNode): + (WebCore::RenderSVGResourceContainer::RenderSVGResourceContainer): Stop registering resource from the constructor, delegate to styleDidChange. + (WebCore::RenderSVGResourceContainer::~RenderSVGResourceContainer): Only deregister resource if it was ever registered. + (WebCore::RenderSVGResourceContainer::layout): invalidateClients() here, to avoid the need for invalidateResourceClients() in the SVG DOM. Just call setNeedsLayout() from the SVG DOM. + (WebCore::RenderSVGResourceContainer::destroy): Forward to SVGResourcesCache::resourceDestroyed. + (WebCore::RenderSVGResourceContainer::styleDidChange): Register resource not in the constructor but when it first receives style. + (WebCore::RenderSVGResourceContainer::idChanged): Don't duplicate code, use existing methods from SVGResourcesCache. + (WebCore::RenderSVGResourceContainer::markAllClientsForInvalidation): Add new helper function, to share code between all resources. + (WebCore::RenderSVGResourceContainer::markClientForInvalidation): Ditto. + (WebCore::RenderSVGResourceContainer::addClient): SVGResourcesCache now manages the list of clients. It calls addClient() for each RenderObject that uses this resource. + (WebCore::RenderSVGResourceContainer::removeClient): SVGResourcesCache now manages the list of clients. + (WebCore::RenderSVGResourceContainer::registerResource): New helper function sharing code between idChanged / styleDidChange. + (WebCore::RenderSVGResourceContainer::transformOnNonScalingStroke): Add FIXME that the function is misplaced. + * rendering/RenderSVGResourceContainer.h: Move most functions to the new RenderSVGResourceContainer.cpp file. + * rendering/RenderSVGResourceFilter.cpp: + (WebCore::RenderSVGResourceFilter::~RenderSVGResourceFilter): Early exit if m_filter is empty. + (WebCore::RenderSVGResourceFilter::invalidateClients): Use new helper functions to invalidate clients, shared between all resources in RenderSVGResourceContainer. + (WebCore::RenderSVGResourceFilter::invalidateClient): Ditto. + * rendering/RenderSVGResourceGradient.cpp: + (WebCore::RenderSVGResourceGradient::~RenderSVGResourceGradient): Early exit if m_gradient is empty. + (WebCore::RenderSVGResourceGradient::invalidateClients): Use new helper functions to invalidate clients, shared between all resources in RenderSVGResourceContainer. + (WebCore::RenderSVGResourceGradient::invalidateClient): Ditto. + * rendering/RenderSVGResourceMarker.cpp: + (WebCore::RenderSVGResourceMarker::~RenderSVGResourceMarker): Now a no-op, markers are unified within the new client handling concept, no more special code needed. + (WebCore::RenderSVGResourceMarker::layout): As RenderSVGResourceMarker skips the RenderSVGResourceContainer::layout() method, we also need to call invalidateClients() here. + (WebCore::RenderSVGResourceMarker::invalidateClients): Use new helper functions to invalidate clients, shared between all resources in RenderSVGResourceContainer. + (WebCore::RenderSVGResourceMarker::invalidateClient): Ditto. + (WebCore::RenderSVGResourceMarker::draw): Remove marker specific logic to catch circular references. + * rendering/RenderSVGResourceMarker.h: + * rendering/RenderSVGResourceMasker.cpp: + (WebCore::RenderSVGResourceMasker::~RenderSVGResourceMasker): Early exit if m_masker is empty. + (WebCore::RenderSVGResourceMasker::invalidateClients): Use new helper functions to invalidate clients, shared between all resources in RenderSVGResourceContainer. + (WebCore::RenderSVGResourceMasker::invalidateClient): Ditto. + (WebCore::RenderSVGResourceMasker::applyResource): Remove containsCyclicReference() check, SVGResourcesCycleSolver breaks cyclic references, resources do not need to take care anymore. + * rendering/RenderSVGResourceMasker.h: + * rendering/RenderSVGResourcePattern.cpp: + (WebCore::RenderSVGResourcePattern::~RenderSVGResourcePattern): Early exit if m_pattern is empty. + (WebCore::RenderSVGResourcePattern::invalidateClients): Use new helper functions to invalidate clients, shared between all resources in RenderSVGResourceContainer. + (WebCore::RenderSVGResourcePattern::invalidateClient): Ditto. + (WebCore::RenderSVGResourcePattern::createTileImage): Remove containsCyclicReference() check, SVGResourcesCycleSolver breaks cyclic references, resources do not need to take care anymore. + * rendering/RenderSVGResourcePattern.h: + * rendering/RenderSVGRoot.cpp: + (WebCore::RenderSVGRoot::selfWillPaint): Don't look up resources manually, use SVGResourcesCache. + (WebCore::RenderSVGRoot::destroy): Forward to SVGResourcesCache::clientDestroyed. + (WebCore::RenderSVGRoot::styleDidChange): Forward to SVGResourcesCache::clientStyleChanged. + (WebCore::RenderSVGRoot::updateFromElement): Forward to SVGResourcesCache::clientUpdatedFromElement. + * rendering/RenderSVGRoot.h: + * rendering/RenderSVGText.cpp: + (WebCore::RenderSVGText::layout): s/RenderSVGResource::invalidateAllResourcesOfRenderer/SVGResourcesCache::clientLayoutChanged/. + * rendering/RenderSVGText.h: + * rendering/SVGInlineTextBox.cpp: + (WebCore::SVGInlineTextBox::acquirePaintingResource): Add RenderObject* parameter, don't assume the style comes from the InlineTextBox parent renderer. + (WebCore::SVGInlineTextBox::prepareGraphicsContextForTextPainting): Pass the parent()->renderer() to acquirePaintingResource. + (WebCore::SVGInlineTextBox::paintDecoration): Pass the decoration renderer to acquirePaintingResource. + (WebCore::SVGInlineTextBox::paintDecorationWithStyle): Ditto. + (WebCore::SVGInlineTextBox::paintText): When a selection pseudo style is used to paint the selection, swap styles in the SVGResourcesCache, to take the right resources when painting. + * rendering/SVGInlineTextBox.h: + * rendering/SVGRenderSupport.cpp: + (WebCore::SVGRenderSupport::prepareToRenderSVGContent): Don't look up resources manually, use SVGResourcesCache. + (WebCore::SVGRenderSupport::finishRenderSVGContent): Ditto. + (WebCore::SVGRenderSupport::intersectRepaintRectWithResources): Ditto. + (WebCore::SVGRenderSupport::pointInClippingArea): Remove const from RenderObject parameter. + * rendering/SVGRenderSupport.h: + * rendering/SVGRenderTreeAsText.cpp: + (WebCore::writeStyle): Add two const_cast now that fill/strokePaintingResource take RenderObject* parameters. This was the less intrusive approach, otherwhise more const_casts would be needed. + (WebCore::writeResources): Add FIXME that we should dump the resources present in the SVGResourcesCache instead of manually looking them up from the SVGRenderStyle, to avoid dumping cycles. + * rendering/SVGResourcesCache.cpp: + (WebCore::SVGResourcesCache::clientStyleChanged): Use markForLayoutAndParentResourceInvalidation() instead of duplicating code. + * rendering/SVGResourcesCycleSolver.cpp: + (WebCore::setFollowLinkForChainableResource): Implemented stub method. + * rendering/style/SVGRenderStyle.cpp: + (WebCore::SVGRenderStyle::diff): Return StyleDifferenceLayout, not Repaint for stroke paint changes, otherwhise the cached boundaries are not correctly updated. + * svg/SVGClipPathElement.cpp: + (WebCore::SVGClipPathElement::svgAttributeChanged): Don't use invalidateResourceClients(), it's not needed anymore, only call setNeedsLayout() on the renderer. + (WebCore::SVGClipPathElement::childrenChanged): Ditto. + * svg/SVGClipPathElement.h: + (WebCore::SVGClipPathElement::needsPendingResourceHandling): Return false, buildPendingResource() logic not needed anymore for resources, handled by RenderSVGResourceContainer. + * svg/SVGElement.cpp: + (WebCore::SVGElement::insertedIntoDocument): Only execute buildPendingResource() logic, if needsPendingResourceHandling() returns true. Cleaned up code a bit, to deploy early returns. + * svg/SVGElement.h: + (WebCore::SVGElement::needsPendingResourceHandling): Return true (default). Only needed by SVGTextPathElement/SVGUseElement, and should be removed in future. + * svg/SVGFilterElement.cpp: + (WebCore::SVGFilterElement::SVGFilterElement): Initialize m_followLink=true. + (WebCore::SVGFilterElement::setFilterRes): Don't use invalidateResourceClients(), it's not needed anymore, only call setNeedsLayout() on the renderer. + (WebCore::SVGFilterElement::svgAttributeChanged): Ditto. + (WebCore::SVGFilterElement::childrenChanged): Ditto. + * svg/SVGFilterElement.h: + (WebCore::SVGFilterElement::needsPendingResourceHandling): Return false, buildPendingResource() logic not needed anymore for resources, handled by RenderSVGResourceContainer. + (WebCore::SVGFilterElement::setFollowLink): Used by SVGResourcesCycleSolver, to stop following xlink:href links, if that leads to cyclic references. + * svg/SVGFilterPrimitiveStandardAttributes.cpp: + (WebCore::SVGFilterPrimitiveStandardAttributes::childrenChanged): Don't use invalidateResourceClients(), it's a no-op as effects don't have a renderer -> use invalidateFilter(). + * svg/SVGFilterPrimitiveStandardAttributes.h: + (WebCore::SVGFilterPrimitiveStandardAttributes::invalidateFilter): Don't use invalidateResourceClients(), it's not needed anymore, only call setNeedsLayout() on the renderer. + * svg/SVGGradientElement.cpp: + (WebCore::SVGGradientElement::SVGGradientElement): Initialize m_followLink=true. + (WebCore::SVGGradientElement::svgAttributeChanged): Don't use invalidateResourceClients(), it's not needed anymore, only call setNeedsLayout() on the renderer. + (WebCore::SVGGradientElement::childrenChanged): Ditto. + * svg/SVGGradientElement.h: + (WebCore::SVGGradientElement::needsPendingResourceHandling): Return false, buildPendingResource() logic not needed anymore for resources, handled by RenderSVGResourceContainer. + (WebCore::SVGGradientElement::setFollowLink): Used by SVGResourcesCycleSolver, to stop following xlink:href links, if that leads to cyclic references. + * svg/SVGLinearGradientElement.cpp: + (WebCore::SVGLinearGradientElement::svgAttributeChanged): Don't use invalidateResourceClients(), it's not needed anymore, only call setNeedsLayout() on the renderer. + (WebCore::SVGLinearGradientElement::collectGradientProperties): Only follow xlink:href links if m_followLinks == true. + * svg/SVGMarkerElement.cpp: + (WebCore::SVGMarkerElement::svgAttributeChanged): Don't use invalidateResourceClients(), it's not needed anymore, only call setNeedsLayout() on the renderer. + (WebCore::SVGMarkerElement::childrenChanged): Ditto. + (WebCore::SVGMarkerElement::setOrientToAuto): Ditto. + (WebCore::SVGMarkerElement::setOrientToAngle): Ditto. + * svg/SVGMarkerElement.h: + (WebCore::SVGMarkerElement::needsPendingResourceHandling): Return false, buildPendingResource() logic not needed anymore for resources, handled by RenderSVGResourceContainer. + * svg/SVGMaskElement.cpp: + (WebCore::SVGMaskElement::svgAttributeChanged): Don't use invalidateResourceClients(), it's not needed anymore, only call setNeedsLayout() on the renderer. + (WebCore::SVGMaskElement::childrenChanged): Ditto. + * svg/SVGMaskElement.h: + (WebCore::SVGMaskElement::needsPendingResourceHandling): Return false, buildPendingResource() logic not needed anymore for resources, handled by RenderSVGResourceContainer. + * svg/SVGPatternElement.cpp: + (WebCore::SVGPatternElement::SVGPatternElement): Initialize m_followLink=true. + (WebCore::SVGPatternElement::svgAttributeChanged): Don't use invalidateResourceClients(), it's not needed anymore, only call setNeedsLayout() on the renderer. + (WebCore::SVGPatternElement::childrenChanged): Ditto. + (WebCore::SVGPatternElement::collectPatternProperties): Only follow xlink:href links if m_followLinks == true. + * svg/SVGPatternElement.h: + (WebCore::SVGPatternElement::needsPendingResourceHandling): Return false, buildPendingResource() logic not needed anymore for resources, handled by RenderSVGResourceContainer. + (WebCore::SVGPatternElement::setFollowLink): Used by SVGResourcesCycleSolver, to stop following xlink:href links, if that leads to cyclic references. + * svg/SVGRadialGradientElement.cpp: + (WebCore::SVGRadialGradientElement::svgAttributeChanged): Don't use invalidateResourceClients(), it's not needed anymore, only call setNeedsLayout() on the renderer. + (WebCore::SVGRadialGradientElement::collectGradientProperties): Only follow xlink:href links if m_followLinks == true. + * svg/SVGStyledElement.cpp: + (WebCore::SVGStyledElement::attach): Call updateFromElement upon attach(), needed by all resource renderers. Defaults to a no-op in RenderObject.h + * svg/SVGStyledElement.h: Remove invalidateResourceClients(), it's not needed anymore. + +2010-07-29 Gyuyoung Kim <gyuyoung.kim@samsung.com> + + Reviewed by Kenneth Rohde Christiansen. + + [EFL] Support to enable WML in WebKit EFL + https://bugs.webkit.org/show_bug.cgi?id=43178 + + WebKit EFL cannot enable WML. WML files are added to CMakeLists.txt + to enable WML in WebKit EFL. + + * CMakeLists.txt: Support to enable WML. + +2010-07-21 Grace Kloba <klobag@gmail.com> , Antonio Gomes <tonikitoo@webkit.org> + + Reviewed by David Hyatt. + + Enhance the hit testing to take a rectangle instead of a point + https://bugs.webkit.org/show_bug.cgi?id=40197 + + The primary goal of this change is to provide mechanisms for more precise tap + actions by the users on mobile devices. + + Patch extends the hit testing system to work considering a rectangular area + as input instead of a point, when applicable. For that, the HitTestResult class + was modified to take a padding (IntSize). The padding specifies a fuzzy range for + accepting input events in pixels coordinates for both vertical and horizontal + orientations. In other words, it tells how much to expand the search rect + around a supposed touch point. + + If it is non-positive padding (e.g. (-1, -1), (5, -1), (0, 0)), hit testing will behavior + as the current point based hit testing: methods are no-op'ed to not regress it performance-wise + since it is the common behavior. When positive padding is provided, the HitTestResult class will + keep record of all nodes that intersect the built up test area. The logic will continue searching + when it finds a candidate until the hit test area is fully enclosed by the boundaries of a candidate. + The result will be a list of nodes in the z-order they are hit-tested. Caller will decide how + to process them. + + In order to expose the functionality, the patch: + + - Adds a nodesFromRect method to the Document class, exposing the funcionality + to the DOM. Method returns a NodeList with all nodes that intersect the given + hit-tested area. + - Extends hitTestResultAtPoint method of the EventHandler with an extra 'padding' + parameter, defaulting to IntSize(-1, -1). The rect-based hit test is performed when a + non-negative padding is passed in. + + Test: fast/dom/nodesFromRect-basic.html + + * WebCore.base.exp: + * dom/Document.cpp: + (WebCore::Document::nodesFromRect): This method exposes the rect based funcionality to + the DOM. It works similarly to elementFromPoint, however receiving a rectangular area + as input instead of a point, and returning a z-index ordered list of nodes (not elements) + whose area intersect the hit test rect. + * dom/Document.h: Ditto. + * dom/Document.idl: Ditto. + * page/EventHandler.cpp: + (WebCore::EventHandler::hitTestResultAtPoint): The funcionality is also exposed through this + method. Patch adds a additional IntSize parameter to work as the padding area, building up + the hit test rect. + * page/EventHandler.h: Ditto. + * rendering/HitTestResult.cpp: + (WebCore::HitTestResult::HitTestResult): Rect based hit test constructor. Receives a + padding IntSize as parameter. It can be (0,0). + (WebCore::HitTestResult::operator=): Modified to assign the m_rectBasedTestResult as well. + (WebCore::HitTestResult::append): Merge to HitTestResult objects in a way that the + list node's of both objects get amended. + (WebCore::HitTestResult::addNodeToRectBasedTestResult): Adds a given Node to the list of + hit nodes. + * rendering/HitTestResult.h: + (WebCore::HitTestResult::padding): Returns the padding as an IntSize. + (WebCore::HitTestResult::isRectBasedTest): Returns if the HitTestResult is rect based or not. + (WebCore::HitTestResult::.rectBasedTestResult): Returns the list nodes hit. + (WebCore::HitTestResult::rectFromPoint): Returns the hit test rect given the hit test point + and padding. + * rendering/RenderLayer.cpp: + (WebCore::RenderLayer::hitTestLayer): + (WebCore::RenderLayer::hitTestList): + (WebCore::RenderLayer::hitTestChildLayerColumns): + * rendering/EllipsisBox.cpp: + (WebCore::EllipsisBox::nodeAtPoint): Method is modified to support rect based hit test extension. + Now it not just checks if the boundary of the node being hit-tested contains a hit test point, but + instead it checks if the boundary of the node intersects a hit test rect. It is implemented so + that the common case (point based hit test) works as previously. + * rendering/InlineFlowBox.cpp: + (WebCore::InlineFlowBox::nodeAtPoint): Ditto. + * rendering/InlineTextBox.cpp: + (WebCore::InlineTextBox::nodeAtPoint): Ditto. + * rendering/RenderBlock.cpp: + (WebCore::RenderBlock::nodeAtPoint): Ditto. + (WebCore::RenderBlock::hitTestColumns): Ditto. + * rendering/RenderBox.cpp: + (WebCore::RenderBox::nodeAtPoint): Ditto. + * rendering/RenderImage.cpp: + (WebCore::RenderImage::nodeAtPoint): Ditto. + * rendering/RenderLineBoxList.cpp: + (WebCore::RenderLineBoxList::hitTest): + * rendering/RenderSVGRoot.cpp: + (WebCore::RenderSVGRoot::nodeAtPoint): Ditto. + * rendering/RenderTable.cpp: + (WebCore::RenderTable::nodeAtPoint): Ditto. + * rendering/RenderTableSection.cpp: + (WebCore::RenderTableSection::nodeAtPoint): Ditto. + * rendering/RenderWidget.cpp: + (WebCore::RenderWidget::nodeAtPoint): Ditto. + +2010-07-29 Steve Block <steveblock@google.com> + + Reviewed by Jeremy Orlow. + + Add LayoutTestController methods to test DeviceOrientation + https://bugs.webkit.org/show_bug.cgi?id=39589 + + This patch does not hook up the new LayoutTestController method to WebKit + for any platform. This will be done in later patches. + https://bugs.webkit.org/show_bug.cgi?id=43181 tracks this for Mac. + + Test: fast/dom/DeviceOrientation/basic-operation.html + + * WebCore/WebCore.exp.in: + * WebCore.xcodeproj/project.pbxproj: + * dom/DeviceOrientationClient.h: + (WebCore::DeviceOrientationClient::~DeviceOrientationClient): + * dom/DeviceOrientationController.cpp: + (WebCore::DeviceOrientationController::DeviceOrientationController): + * dom/DeviceOrientationEvent.cpp: + * platform/mock/DeviceOrientationClientMock.cpp: Added. + (WebCore::DeviceOrientationClientMock::DeviceOrientationClientMock): + (WebCore::DeviceOrientationClientMock::setController): + (WebCore::DeviceOrientationClientMock::startUpdating): + (WebCore::DeviceOrientationClientMock::stopUpdating): + (WebCore::DeviceOrientationClientMock::setOrientation): + (WebCore::DeviceOrientationClientMock::timerFired): + * platform/mock/DeviceOrientationClientMock.h: Added. + (WebCore::DeviceOrientationClientMock::lastOrientation): + +2010-07-29 Satish Sampath <satish@chromium.org> + + Reviewed by Steve Block. + + Runtime feature switch for speech input. + https://bugs.webkit.org/show_bug.cgi?id=43146 + + Add a runtime feature switch that decides whether speech input attributes are available or not. + Defaults to true. + + * bindings/generic/RuntimeEnabledFeatures.cpp: + * bindings/generic/RuntimeEnabledFeatures.h: + (WebCore::RuntimeEnabledFeatures::setSpeechInputEnabled): + (WebCore::RuntimeEnabledFeatures::speechInputEnabled): + (WebCore::RuntimeEnabledFeatures::speechEnabled): + * html/HTMLInputElement.idl: + +2010-07-27 Alexander Pavlov <apavlov@chromium.org> + + Reviewed by Pavel Feldman. + + Inspector should display CDATA section data + https://bugs.webkit.org/show_bug.cgi?id=16259 + + * inspector/InspectorDOMAgent.cpp: + (WebCore::InspectorDOMAgent::buildObjectForNode): + * inspector/front-end/ElementsTreeOutline.js: + (): + +2010-07-28 Kavita Kanetkar <kkanetkar@chromium.org> + + Reviewed by Pavel Feldman. + + Web Inspector: Enable UI for chromium's appcache inspection. + https://bugs.webkit.org/show_bug.cgi?id=43098 + + * inspector/front-end/Settings.js: Removed appCacheEnabled. + * inspector/front-end/StoragePanel.js: Removed appCacheEnabled condition. + (WebInspector.StoragePanel): + (WebInspector.StoragePanel.prototype.reset): + (WebInspector.StoragePanel.prototype.addApplicationCache): + 2010-07-28 Bryan Gislason <bgislason@rim.com> Reviewed by Nate Chapin. diff --git a/WebCore/Configurations/Base.xcconfig b/WebCore/Configurations/Base.xcconfig index aa68bdb..be19c22 100644 --- a/WebCore/Configurations/Base.xcconfig +++ b/WebCore/Configurations/Base.xcconfig @@ -1,4 +1,4 @@ -// Copyright (C) 2009 Apple Inc. All rights reserved. +// Copyright (C) 2009, 2010 Apple Inc. All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions @@ -28,11 +28,15 @@ GCC_DYNAMIC_NO_PIC = NO; GCC_ENABLE_CPP_EXCEPTIONS = NO; GCC_ENABLE_CPP_RTTI = NO; GCC_ENABLE_OBJC_EXCEPTIONS = YES; -GCC_ENABLE_OBJC_GC = supported; +GCC_ENABLE_OBJC_GC = $(GCC_ENABLE_OBJC_GC_$(REAL_PLATFORM_NAME)); +GCC_ENABLE_OBJC_GC_iphoneos = NO; +GCC_ENABLE_OBJC_GC_iphonesimulator = NO; +GCC_ENABLE_OBJC_GC_macosx = supported; GCC_ENABLE_SYMBOL_SEPARATION = NO; GCC_FAST_OBJC_DISPATCH = YES; GCC_GENERATE_DEBUGGING_SYMBOLS = YES; -GCC_MODEL_TUNING = G5; +GCC_MODEL_TUNING = $(GCC_MODEL_TUNING_$(REAL_PLATFORM_NAME)); +GCC_MODEL_TUNING_macosx = G5; GCC_OBJC_CALL_CXX_CDTORS = YES; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_THREADSAFE_STATICS = NO; @@ -43,19 +47,27 @@ GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES; LINKER_DISPLAYS_MANGLED_NAMES = YES; PREBINDING = NO; -VALID_ARCHS = i386 ppc x86_64 ppc64; -WARNING_CFLAGS = $(WARNING_CFLAGS_$(CURRENT_ARCH)); -WARNING_CFLAGS_BASE = -Wall -Wextra -Wcast-align -Wcast-qual -Wchar-subscripts -Wextra-tokens -Wformat=2 -Winit-self -Wmissing-format-attribute -Wmissing-noreturn -Wpacked -Wpointer-arith -Wredundant-decls -Wundef -Wwrite-strings; -WARNING_CFLAGS_ = $(WARNING_CFLAGS_BASE) -Wshorten-64-to-32; -WARNING_CFLAGS_i386 = $(WARNING_CFLAGS_BASE) -Wshorten-64-to-32; -WARNING_CFLAGS_ppc = $(WARNING_CFLAGS_BASE) -Wshorten-64-to-32; +VALID_ARCHS = $(VALID_ARCHS_$(REAL_PLATFORM_NAME)); +VALID_ARCHS_iphoneos = $(ARCHS_STANDARD_32_BIT); +VALID_ARCHS_iphonesimulator = $(ARCHS_STANDARD_32_BIT); +VALID_ARCHS_macosx = i386 ppc x86_64 ppc64; +WARNING_CFLAGS_BASE = -Wall -Wextra -Wcast-qual -Wchar-subscripts -Wextra-tokens -Wformat=2 -Winit-self -Wmissing-format-attribute -Wmissing-noreturn -Wpacked -Wpointer-arith -Wredundant-decls -Wundef -Wwrite-strings; +WARNING_CFLAGS = $(WARNING_CFLAGS_$(REAL_PLATFORM_NAME)); +WARNING_CFLAGS_iphoneos = $(WARNING_CFLAGS_BASE) -Wshorten-64-to-32; +WARNING_CFLAGS_iphonesimulator = $(WARNING_CFLAGS_BASE) -Wcast-align -Wshorten-64-to-32; +WARNING_CFLAGS_macosx = $(WARNING_CFLAGS_macosx_$(CURRENT_ARCH)); +WARNING_CFLAGS_macosx_ = $(WARNING_CFLAGS_BASE) -Wcast-align -Wshorten-64-to-32; +WARNING_CFLAGS_macosx_i386 = $(WARNING_CFLAGS_BASE) -Wcast-align -Wshorten-64-to-32; +WARNING_CFLAGS_macosx_ppc = $(WARNING_CFLAGS_BASE) -Wcast-align -Wshorten-64-to-32; // FIXME: WebCore 64-bit builds should build with -Wshorten-64-to-32 -WARNING_CFLAGS_ppc64 = $(WARNING_CFLAGS_BASE); -WARNING_CFLAGS_x86_64 = $(WARNING_CFLAGS_BASE); +WARNING_CFLAGS_macosx_ppc64 = $(WARNING_CFLAGS_BASE) -Wcast-align; +WARNING_CFLAGS_macosx_x86_64 = $(WARNING_CFLAGS_BASE) -Wcast-align; REAL_PLATFORM_NAME = $(REAL_PLATFORM_NAME_$(PLATFORM_NAME)); REAL_PLATFORM_NAME_ = $(REAL_PLATFORM_NAME_macosx); +REAL_PLATFORM_NAME_iphoneos = iphoneos; +REAL_PLATFORM_NAME_iphonesimulator = iphonesimulator; REAL_PLATFORM_NAME_macosx = macosx; TARGET_MAC_OS_X_VERSION_MAJOR = $(MAC_OS_X_VERSION_MAJOR); @@ -82,27 +94,31 @@ DEAD_CODE_STRIPPING = $(DEAD_CODE_STRIPPING_$(CURRENT_VARIANT)); SECTORDER_FLAGS = -sectorder __TEXT __text WebCore.order; WEBCORE_SQLITE3_HEADER_SEARCH_PATHS = $(NEXT_ROOT)/usr/local/include/WebCoreSQLite3; -SQLITE3_HEADER_SEARCH_PATHS = $(SQLITE3_HEADER_SEARCH_PATHS_$(TARGET_MAC_OS_X_VERSION_MAJOR)); -SQLITE3_HEADER_SEARCH_PATHS_ = $(SQLITE3_HEADER_SEARCH_PATHS_1040); -SQLITE3_HEADER_SEARCH_PATHS_1040 = $(WEBCORE_SQLITE3_HEADER_SEARCH_PATHS); -SQLITE3_HEADER_SEARCH_PATHS_1050 = $(WEBCORE_SQLITE3_HEADER_SEARCH_PATHS); -SQLITE3_HEADER_SEARCH_PATHS_1060 = ; -SQLITE3_HEADER_SEARCH_PATHS_1070 = ; +SQLITE3_HEADER_SEARCH_PATHS = $(SQLITE3_HEADER_SEARCH_PATHS_$(REAL_PLATFORM_NAME)); +SQLITE3_HEADER_SEARCH_PATHS_macosx = $(SQLITE3_HEADER_SEARCH_PATHS_macosx_$(TARGET_MAC_OS_X_VERSION_MAJOR)); +SQLITE3_HEADER_SEARCH_PATHS_macosx_ = $(SQLITE3_HEADER_SEARCH_PATHS_macosx_1040); +SQLITE3_HEADER_SEARCH_PATHS_macosx_1040 = $(WEBCORE_SQLITE3_HEADER_SEARCH_PATHS); +SQLITE3_HEADER_SEARCH_PATHS_macosx_1050 = $(WEBCORE_SQLITE3_HEADER_SEARCH_PATHS); +SQLITE3_HEADER_SEARCH_PATHS_macosx_1060 = ; +SQLITE3_HEADER_SEARCH_PATHS_macosx_1070 = ; // Use GCC 4.2 with Xcode 3.1, which includes GCC 4.2 but defaults to GCC 4.0. // Note that Xcode versions as new as 3.1.2 use XCODE_VERSION_ACTUAL for the minor version // number. Newer versions of Xcode use XCODE_VERSION_MINOR for the minor version, and // XCODE_VERSION_ACTUAL for the full version number. -TARGET_GCC_VERSION = $(TARGET_GCC_VERSION_$(TARGET_MAC_OS_X_VERSION_MAJOR)); -TARGET_GCC_VERSION_ = $(TARGET_GCC_VERSION_1040); -TARGET_GCC_VERSION_1040 = GCC_40; -TARGET_GCC_VERSION_1050 = $(TARGET_GCC_VERSION_1050_$(XCODE_VERSION_MINOR)); -TARGET_GCC_VERSION_1050_ = $(TARGET_GCC_VERSION_1050_$(XCODE_VERSION_ACTUAL)); -TARGET_GCC_VERSION_1050_0310 = GCC_42; -TARGET_GCC_VERSION_1050_0320 = GCC_42; -TARGET_GCC_VERSION_1060 = GCC_42; -TARGET_GCC_VERSION_1070 = LLVM_GCC_42; +TARGET_GCC_VERSION = $(TARGET_GCC_VERSION_$(REAL_PLATFORM_NAME)); +TARGET_GCC_VERSION_iphoneos = LLVM_GCC_42; +TARGET_GCC_VERSION_iphonesimulator = GCC_42; +TARGET_GCC_VERSION_macosx = $(TARGET_GCC_VERSION_macosx_$(TARGET_MAC_OS_X_VERSION_MAJOR)); +TARGET_GCC_VERSION_macosx_ = $(TARGET_GCC_VERSION_macosx_1040); +TARGET_GCC_VERSION_macosx_1040 = GCC_40; +TARGET_GCC_VERSION_macosx_1050 = $(TARGET_GCC_VERSION_macosx_1050_$(XCODE_VERSION_MINOR)); +TARGET_GCC_VERSION_macosx_1050_ = $(TARGET_GCC_VERSION_macosx_1050_$(XCODE_VERSION_ACTUAL)); +TARGET_GCC_VERSION_macosx_1050_0310 = GCC_42; +TARGET_GCC_VERSION_macosx_1050_0320 = GCC_42; +TARGET_GCC_VERSION_macosx_1060 = GCC_42; +TARGET_GCC_VERSION_macosx_1070 = LLVM_GCC_42; GCC_VERSION = $(GCC_VERSION_$(TARGET_GCC_VERSION)); GCC_VERSION_GCC_40 = 4.0; diff --git a/WebCore/Configurations/DebugRelease.xcconfig b/WebCore/Configurations/DebugRelease.xcconfig index 449358e..a291536 100644 --- a/WebCore/Configurations/DebugRelease.xcconfig +++ b/WebCore/Configurations/DebugRelease.xcconfig @@ -1,4 +1,4 @@ -// Copyright (C) 2009 Apple Inc. All rights reserved. +// Copyright (C) 2009, 2010 Apple Inc. All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions @@ -23,21 +23,27 @@ #include "Base.xcconfig" -ARCHS = $(ARCHS_$(TARGET_MAC_OS_X_VERSION_MAJOR)); -ARCHS_ = $(ARCHS_1040); -ARCHS_1040 = $(NATIVE_ARCH); -ARCHS_1050 = $(NATIVE_ARCH); -ARCHS_1060 = $(ARCHS_STANDARD_32_64_BIT); -ARCHS_1070 = $(ARCHS_STANDARD_32_64_BIT); +ARCHS = $(ARCHS_$(REAL_PLATFORM_NAME)); +ARCHS_iphoneos = $(ARCHS_STANDARD_32_BIT); +ARCHS_iphonesimulator = $(ARCHS_STANDARD_32_BIT); +ARCHS_macosx = $(ARCHS_macosx_$(TARGET_MAC_OS_X_VERSION_MAJOR)); +ARCHS_macosx_ = $(ARCHS_macosx_1040); +ARCHS_macosx_1040 = $(NATIVE_ARCH); +ARCHS_macosx_1050 = $(NATIVE_ARCH); +ARCHS_macosx_1060 = $(ARCHS_STANDARD_32_64_BIT); +ARCHS_macosx_1070 = $(ARCHS_STANDARD_32_64_BIT); ONLY_ACTIVE_ARCH = YES; -MACOSX_DEPLOYMENT_TARGET = $(MACOSX_DEPLOYMENT_TARGET_$(TARGET_MAC_OS_X_VERSION_MAJOR)); -MACOSX_DEPLOYMENT_TARGET_ = 10.4; -MACOSX_DEPLOYMENT_TARGET_1040 = 10.4; -MACOSX_DEPLOYMENT_TARGET_1050 = 10.5; -MACOSX_DEPLOYMENT_TARGET_1060 = 10.6; -MACOSX_DEPLOYMENT_TARGET_1070 = 10.7; +MACOSX_DEPLOYMENT_TARGET = $(MACOSX_DEPLOYMENT_TARGET_$(REAL_PLATFORM_NAME)); +MACOSX_DEPLOYMENT_TARGET_iphoneos = 10.5; +MACOSX_DEPLOYMENT_TARGET_iphonesimulator = 10.5; +MACOSX_DEPLOYMENT_TARGET_macosx = $(MACOSX_DEPLOYMENT_TARGET_macosx_$(TARGET_MAC_OS_X_VERSION_MAJOR)); +MACOSX_DEPLOYMENT_TARGET_macosx_ = 10.4; +MACOSX_DEPLOYMENT_TARGET_macosx_1040 = 10.4; +MACOSX_DEPLOYMENT_TARGET_macosx_1050 = 10.5; +MACOSX_DEPLOYMENT_TARGET_macosx_1060 = 10.6; +MACOSX_DEPLOYMENT_TARGET_macosx_1070 = 10.7; GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = YES; diff --git a/WebCore/Configurations/FeatureDefines.xcconfig b/WebCore/Configurations/FeatureDefines.xcconfig index 8e33a91..9810cf7 100644 --- a/WebCore/Configurations/FeatureDefines.xcconfig +++ b/WebCore/Configurations/FeatureDefines.xcconfig @@ -1,4 +1,4 @@ -// Copyright (C) 2009 Apple Inc. All rights reserved. +// Copyright (C) 2009, 2010 Apple Inc. All rights reserved. // Copyright (C) 2009 Google Inc. All rights reserved. // // Redistribution and use in source and binary forms, with or without @@ -33,31 +33,52 @@ ENABLE_LINK_PREFETCH = ; -ENABLE_3D_CANVAS = $(ENABLE_3D_CANVAS_$(TARGET_MAC_OS_X_VERSION_MAJOR)); -ENABLE_3D_CANVAS_1060 = ENABLE_3D_CANVAS; -ENABLE_3D_CANVAS_1070 = ENABLE_3D_CANVAS; +ENABLE_3D_CANVAS = $(ENABLE_3D_CANVAS_$(REAL_PLATFORM_NAME)); +ENABLE_3D_CANVAS_macosx = $(ENABLE_3D_CANVAS_macosx_$(TARGET_MAC_OS_X_VERSION_MAJOR)); +ENABLE_3D_CANVAS_macosx_1060 = ENABLE_3D_CANVAS; +ENABLE_3D_CANVAS_macosx_1070 = ENABLE_3D_CANVAS; -ENABLE_3D_RENDERING = $(ENABLE_3D_RENDERING_$(TARGET_MAC_OS_X_VERSION_MAJOR)); -ENABLE_3D_RENDERING_1050 = ENABLE_3D_RENDERING; -ENABLE_3D_RENDERING_1060 = ENABLE_3D_RENDERING; -ENABLE_3D_RENDERING_1070 = ENABLE_3D_RENDERING; +ENABLE_3D_RENDERING = $(ENABLE_3D_RENDERING_$(REAL_PLATFORM_NAME)); +ENABLE_3D_RENDERING_iphoneos = ENABLE_3D_RENDERING; +ENABLE_3D_RENDERING_iphonesimulator = $(ENABLE_3D_RENDERING_iphoneos); +ENABLE_3D_RENDERING_macosx = $(ENABLE_3D_RENDERING_macosx_$(TARGET_MAC_OS_X_VERSION_MAJOR)); +ENABLE_3D_RENDERING_macosx_1050 = ENABLE_3D_RENDERING; +ENABLE_3D_RENDERING_macosx_1060 = ENABLE_3D_RENDERING; +ENABLE_3D_RENDERING_macosx_1070 = ENABLE_3D_RENDERING; + +ENABLE_BLOB_SLICE = $(ENABLE_BLOB_SLICE_$(REAL_PLATFORM_NAME)); +ENABLE_BLOB_SLICE_macosx = ENABLE_BLOB_SLICE; + +ENABLE_CHANNEL_MESSAGING = $(ENABLE_CHANNEL_MESSAGING_$(REAL_PLATFORM_NAME)); +ENABLE_CHANNEL_MESSAGING_macosx = ENABLE_CHANNEL_MESSAGING; + +ENABLE_CLIENT_BASED_GEOLOCATION = $(ENABLE_CLIENT_BASED_GEOLOCATION_$(REAL_PLATFORM_NAME)); +ENABLE_CLIENT_BASED_GEOLOCATION_macosx = ENABLE_CLIENT_BASED_GEOLOCATION; -ENABLE_BLOB_SLICE = ENABLE_BLOB_SLICE; -ENABLE_CHANNEL_MESSAGING = ENABLE_CHANNEL_MESSAGING; -ENABLE_CLIENT_BASED_GEOLOCATION = ENABLE_CLIENT_BASED_GEOLOCATION; ENABLE_DATABASE = ENABLE_DATABASE; ENABLE_DATAGRID = ; -ENABLE_DATALIST = ENABLE_DATALIST; + +ENABLE_DATALIST = $(ENABLE_DATALIST_$(REAL_PLATFORM_NAME)); +ENABLE_DATALIST_macosx = ENABLE_DATALIST; + ENABLE_DEVICE_ORIENTATION = ; ENABLE_DIRECTORY_UPLOAD = ; ENABLE_DOM_STORAGE = ENABLE_DOM_STORAGE; ENABLE_EVENTSOURCE = ENABLE_EVENTSOURCE; -ENABLE_FILTERS = ENABLE_FILTERS; -ENABLE_FILE_READER = ENABLE_FILE_READER; + +ENABLE_FILTERS = $(ENABLE_FILTERS_$(REAL_PLATFORM_NAME)); +ENABLE_FILTERS_macosx = ENABLE_FILTERS; + +ENABLE_FILE_READER = $(ENABLE_FILE_READER_$(REAL_PLATFORM_NAME)); +ENABLE_FILE_READER_macosx = ENABLE_FILE_READER; + ENABLE_FILE_WRITER = ; ENABLE_FILE_SYSTEM = ; ENABLE_GEOLOCATION = ENABLE_GEOLOCATION; -ENABLE_ICONDATABASE = ENABLE_ICONDATABASE; + +ENABLE_ICONDATABASE = $(ENABLE_ICONDATABASE_$(REAL_PLATFORM_NAME)); +ENABLE_ICONDATABASE_macosx = ENABLE_ICONDATABASE; + ENABLE_IMAGE_RESIZER = ; ENABLE_INDEXED_DATABASE = ; ENABLE_INPUT_SPEECH = ; @@ -67,21 +88,37 @@ ENABLE_METER_TAG = ENABLE_METER_TAG; ENABLE_NOTIFICATIONS = ; ENABLE_OFFLINE_WEB_APPLICATIONS = ENABLE_OFFLINE_WEB_APPLICATIONS; ENABLE_PROGRESS_TAG = ENABLE_PROGRESS_TAG; -ENABLE_RUBY = ENABLE_RUBY; -ENABLE_SANDBOX = ENABLE_SANDBOX; -ENABLE_SHARED_WORKERS = ENABLE_SHARED_WORKERS; + +ENABLE_RUBY = $(ENABLE_RUBY_$(REAL_PLATFORM_NAME)); +ENABLE_RUBY_macosx = ENABLE_RUBY; + +ENABLE_SANDBOX = $(ENABLE_SANDBOX_$(REAL_PLATFORM_NAME)); +ENABLE_SANDBOX_macosx = ENABLE_SANDBOX; + +ENABLE_SHARED_WORKERS = $(ENABLE_SHARED_WORKERS_$(REAL_PLATFORM_NAME)); +ENABLE_SHARED_WORKERS_macosx = ENABLE_SHARED_WORKERS; + ENABLE_SVG = ENABLE_SVG; ENABLE_SVG_ANIMATION = ENABLE_SVG_ANIMATION; ENABLE_SVG_AS_IMAGE = ENABLE_SVG_AS_IMAGE; -ENABLE_SVG_DOM_OBJC_BINDINGS = ENABLE_SVG_DOM_OBJC_BINDINGS; + +ENABLE_SVG_DOM_OBJC_BINDINGS = $(ENABLE_SVG_DOM_OBJC_BINDINGS_$(REAL_PLATFORM_NAME)); +ENABLE_SVG_DOM_OBJC_BINDINGS_macosx = ENABLE_SVG_DOM_OBJC_BINDINGS; + ENABLE_SVG_FONTS = ENABLE_SVG_FONTS; ENABLE_SVG_FOREIGN_OBJECT = ENABLE_SVG_FOREIGN_OBJECT; ENABLE_SVG_USE = ENABLE_SVG_USE; ENABLE_VIDEO = ENABLE_VIDEO; -ENABLE_WEB_SOCKETS = ENABLE_WEB_SOCKETS; + +ENABLE_WEB_SOCKETS = $(ENABLE_WEB_SOCKETS_$(REAL_PLATFORM_NAME)); +ENABLE_WEB_SOCKETS_macosx = ENABLE_WEB_SOCKETS; + ENABLE_WEB_TIMING = ; ENABLE_WML = ; -ENABLE_WORKERS = ENABLE_WORKERS; + +ENABLE_WORKERS = $(ENABLE_WORKERS_$(REAL_PLATFORM_NAME)); +ENABLE_WORKERS_macosx = ENABLE_WORKERS; + ENABLE_XHTMLMP = ; ENABLE_XPATH = ENABLE_XPATH; ENABLE_XSLT = ENABLE_XSLT; diff --git a/WebCore/Configurations/Version.xcconfig b/WebCore/Configurations/Version.xcconfig index c1b6b32..9ac1583 100644 --- a/WebCore/Configurations/Version.xcconfig +++ b/WebCore/Configurations/Version.xcconfig @@ -1,4 +1,4 @@ -// Copyright (C) 2009 Apple Inc. All rights reserved. +// Copyright (C) 2009, 2010 Apple Inc. All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions @@ -22,7 +22,7 @@ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. MAJOR_VERSION = 534; -MINOR_VERSION = 4; +MINOR_VERSION = 5; TINY_VERSION = 0; FULL_VERSION = $(MAJOR_VERSION).$(MINOR_VERSION); @@ -31,12 +31,15 @@ BUNDLE_VERSION = $(BUNDLE_VERSION_$(CONFIGURATION)); SHORT_VERSION_STRING = $(SHORT_VERSION_STRING_$(CONFIGURATION)) // The system version prefix is based on the current system version. -SYSTEM_VERSION_PREFIX = $(SYSTEM_VERSION_PREFIX_$(TARGET_MAC_OS_X_VERSION_MAJOR)); -SYSTEM_VERSION_PREFIX_ = 4; // Some Tiger versions of Xcode don't set MAC_OS_X_VERSION_MAJOR. -SYSTEM_VERSION_PREFIX_1040 = 4; -SYSTEM_VERSION_PREFIX_1050 = 5; -SYSTEM_VERSION_PREFIX_1060 = 6; -SYSTEM_VERSION_PREFIX_1070 = 7; +SYSTEM_VERSION_PREFIX = $(SYSTEM_VERSION_PREFIX_$(REAL_PLATFORM_NAME)); +SYSTEM_VERSION_PREFIX_iphoneos = 6; // iOS is most like SnowLeopard currently. +SYSTEM_VERSION_PREFIX_iphonesimulator = $(SYSTEM_VERSION_PREFIX_iphoneos); +SYSTEM_VERSION_PREFIX_macosx = $(SYSTEM_VERSION_PREFIX_macosx_$(TARGET_MAC_OS_X_VERSION_MAJOR)); +SYSTEM_VERSION_PREFIX_macosx_ = 4; // Some Tiger versions of Xcode don't set MAC_OS_X_VERSION_MAJOR. +SYSTEM_VERSION_PREFIX_macosx_1040 = 4; +SYSTEM_VERSION_PREFIX_macosx_1050 = 5; +SYSTEM_VERSION_PREFIX_macosx_1060 = 6; +SYSTEM_VERSION_PREFIX_macosx_1070 = 7; // The production build always uses the full version with a system version prefix. BUNDLE_VERSION_Production = $(SYSTEM_VERSION_PREFIX)$(FULL_VERSION); diff --git a/WebCore/Configurations/WebCore.xcconfig b/WebCore/Configurations/WebCore.xcconfig index a918146..73e3519 100644 --- a/WebCore/Configurations/WebCore.xcconfig +++ b/WebCore/Configurations/WebCore.xcconfig @@ -1,4 +1,4 @@ -// Copyright (C) 2009 Apple Inc. All rights reserved. +// Copyright (C) 2009, 2010 Apple Inc. All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions @@ -26,39 +26,65 @@ EXPORTED_SYMBOLS_FILE = $(EXPORTED_SYMBOLS_FILE_$(CURRENT_ARCH)); EXPORTED_SYMBOLS_FILE_ = $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/WebCore.exp; +EXPORTED_SYMBOLS_FILE_armv5 = $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/WebCore.LP64.exp; +EXPORTED_SYMBOLS_FILE_armv6 = $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/WebCore.LP64.exp; +EXPORTED_SYMBOLS_FILE_armv7 = $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/WebCore.LP64.exp; EXPORTED_SYMBOLS_FILE_i386 = $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/WebCore.exp; EXPORTED_SYMBOLS_FILE_ppc = $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/WebCore.exp; EXPORTED_SYMBOLS_FILE_ppc64 = $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/WebCore.LP64.exp; EXPORTED_SYMBOLS_FILE_x86_64 = $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/WebCore.LP64.exp; GCC_PREFIX_HEADER = WebCorePrefix.h; GCC_PREPROCESSOR_DEFINITIONS = $(DEBUG_DEFINES) $(FEATURE_DEFINES) WEBKIT_VERSION_MIN_REQUIRED=WEBKIT_VERSION_LATEST $(GCC_PREPROCESSOR_DEFINITIONS); -FRAMEWORK_SEARCH_PATHS = $(SYSTEM_LIBRARY_DIR)/Frameworks/Carbon.framework/Frameworks $(SYSTEM_LIBRARY_DIR)/Frameworks/ApplicationServices.framework/Frameworks $(FRAMEWORK_SEARCH_PATHS); +FRAMEWORK_SEARCH_PATHS = $(FRAMEWORK_SEARCH_PATHS_$(REAL_PLATFORM_NAME)); +FRAMEWORK_SEARCH_PATHS_iphoneos = $(FRAMEWORK_SEARCH_PATHS_iphoneos_$(CONFIGURATION)); +FRAMEWORK_SEARCH_PATHS_iphoneos_Debug = $(BUILT_PRODUCTS_DIR) $(PRODUCTION_FRAMEWORKS_DIR); +FRAMEWORK_SEARCH_PATHS_iphoneos_Release = $(FRAMEWORK_SEARCH_PATHS_iphoneos_Debug); +FRAMEWORK_SEARCH_PATHS_iphoneos_Production = $(PRODUCTION_FRAMEWORKS_DIR); +FRAMEWORK_SEARCH_PATHS_iphonesimulator = $(FRAMEWORK_SEARCH_PATHS_iphoneos_$(CONFIGURATION)); +FRAMEWORK_SEARCH_PATHS_macosx = $(SYSTEM_LIBRARY_DIR)/Frameworks/Carbon.framework/Frameworks $(SYSTEM_LIBRARY_DIR)/Frameworks/ApplicationServices.framework/Frameworks $(FRAMEWORK_SEARCH_PATHS); + HEADER_SEARCH_PATHS = ForwardingHeaders icu /usr/include/libxslt /usr/include/libxml2 $(SQLITE3_HEADER_SEARCH_PATHS) "${BUILT_PRODUCTS_DIR}/DerivedSources/WebCore" $(HEADER_SEARCH_PATHS); INFOPLIST_FILE = Info.plist; -INSTALL_PATH = $(SYSTEM_LIBRARY_DIR)/Frameworks/WebKit.framework/Versions/A/Frameworks; +INSTALL_PATH = $(INSTALL_PATH_$(REAL_PLATFORM_NAME)); +INSTALL_PATH_macosx = $(SYSTEM_LIBRARY_DIR)/Frameworks/WebKit.framework/Versions/A/Frameworks; INSTALLHDRS_COPY_PHASE = YES; INSTALLHDRS_SCRIPT_PHASE = YES; PRODUCT_NAME = WebCore; +OTHER_LDFLAGS_BASE = -l$(SQLITE3_LIBRARY) -lobjc; +OTHER_LDFLAGS = $(OTHER_LDFLAGS_$(REAL_PLATFORM_NAME)); +OTHER_LDFLAGS_iphoneos = $(OTHER_LDFLAGS_BASE) -framework CFNetwork -framework CoreFoundation -framework CoreGraphics -framework CoreText -framework Foundation -framework GraphicsServices -framework ImageIO -framework QuartzCore; +OTHER_LDFLAGS_iphonesimulator = $(OTHER_LDFLAGS_iphoneos); +OTHER_LDFLAGS_macosx = $(OTHER_LDFLAGS_BASE) -sub_library libobjc -umbrella WebKit $(WEBKIT2_LDFLAGS); -OTHER_LDFLAGS = -l$(SQLITE3_LIBRARY) -lobjc -sub_library libobjc -umbrella WebKit $(WEBKIT2_LDFLAGS); +PRODUCTION_FRAMEWORKS_DIR = $(PRODUCTION_FRAMEWORKS_DIR_$(REAL_PLATFORM_NAME)); +PRODUCTION_FRAMEWORKS_DIR_iphoneos = $(SDKROOT)$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks; +PRODUCTION_FRAMEWORKS_DIR_iphonesimulator = $(PRODUCTION_FRAMEWORKS_DIR_iphoneos); +PRODUCTION_FRAMEWORKS_DIR_macosx = $(NEXT_ROOT)$(SYSTEM_LIBRARY_DIR)/Frameworks; WEBKIT2_LDFLAGS = $(WEBKIT2_LDFLAGS_$(TARGET_MAC_OS_X_VERSION_MAJOR)); WEBKIT2_LDFLAGS_1060 = -allowable_client WebKit2; WEBKIT2_LDFLAGS_1070 = $(WEBKIT2_LDFLAGS_1060); -JAVASCRIPTCORE_PRIVATE_HEADERS_DIR = $(JAVASCRIPTCORE_PRIVATE_HEADERS_DIR_$(REAL_PLATFORM_NAME)_$(CONFIGURATION)); -JAVASCRIPTCORE_PRIVATE_HEADERS_DIR_macosx_Release = $(JAVASCRIPTCORE_PRIVATE_HEADERS_engineering); -JAVASCRIPTCORE_PRIVATE_HEADERS_DIR_macosx_Debug = $(JAVASCRIPTCORE_PRIVATE_HEADERS_engineering); -JAVASCRIPTCORE_PRIVATE_HEADERS_DIR_macosx_Production = $(NEXT_ROOT)$(SYSTEM_LIBRARY_DIR)/Frameworks/JavaScriptCore.framework/PrivateHeaders; +JAVASCRIPTCORE_PRIVATE_HEADERS_DIR = $(JAVASCRIPTCORE_PRIVATE_HEADERS_DIR_$(CONFIGURATION)); +JAVASCRIPTCORE_PRIVATE_HEADERS_DIR_Release = $(JAVASCRIPTCORE_PRIVATE_HEADERS_engineering); +JAVASCRIPTCORE_PRIVATE_HEADERS_DIR_Debug = $(JAVASCRIPTCORE_PRIVATE_HEADERS_engineering); +JAVASCRIPTCORE_PRIVATE_HEADERS_DIR_Production = $(PRODUCTION_FRAMEWORKS_DIR)/JavaScriptCore.framework/PrivateHeaders; JAVASCRIPTCORE_PRIVATE_HEADERS_engineering = $(BUILT_PRODUCTS_DIR)/JavaScriptCore.framework/PrivateHeaders; -EXCLUDED_SOURCE_FILE_NAMES = $(EXCLUDED_SOURCE_FILE_NAMES_$(ENABLE_SVG_DOM_OBJC_BINDINGS)) -EXCLUDED_SOURCE_FILE_NAMES_ = DOMSVG*.* DOMHTMLFrameElementPrivate.h DOMHTMLIFrameElementPrivate.h; -EXCLUDED_SOURCE_FILE_NAMES_ENABLE_SVG_DOM_OBJC_BINDINGS = ; +EXCLUDED_SOURCE_FILE_NAMES_SVG_DOM_OBJC_BINDINGS = $(EXCLUDED_SOURCE_FILE_NAMES_SVG_DOM_OBJC_BINDINGS_$(ENABLE_SVG_DOM_OBJC_BINDINGS)); +EXCLUDED_SOURCE_FILE_NAMES_SVG_DOM_OBJC_BINDINGS_ = DOMSVG*.* DOMHTMLFrameElementPrivate.h DOMHTMLIFrameElementPrivate.h; +EXCLUDED_SOURCE_FILE_NAMES_SVG_DOM_OBJC_BINDINGS_ENABLE_SVG_DOM_OBJC_BINDINGS = ; + +EXCLUDED_SOURCE_FILE_NAMES = $(EXCLUDED_SOURCE_FILE_NAMES_$(REAL_PLATFORM_NAME)) $(EXCLUDED_SOURCE_FILE_NAMES_SVG_DOM_OBJC_BINDINGS); +EXCLUDED_SOURCE_FILE_NAMES_iphoneos = *.tiff *Cursor.png localizedStrings.js; +EXCLUDED_SOURCE_FILE_NAMES_iphonesimulator = $(EXCLUDED_SOURCE_FILE_NAMES_iphoneos); -SQLITE3_LIBRARY = $(SQLITE3_LIBRARY_$(TARGET_MAC_OS_X_VERSION_MAJOR)); -SQLITE3_LIBRARY_ = WebCoreSQLite3; -SQLITE3_LIBRARY_1040 = WebCoreSQLite3; -SQLITE3_LIBRARY_1050 = WebCoreSQLite3; -SQLITE3_LIBRARY_1060 = sqlite3; -SQLITE3_LIBRARY_1070 = sqlite3; +SQLITE3_LIBRARY = $(SQLITE3_LIBRARY_$(REAL_PLATFORM_NAME)); +SQLITE3_LIBRARY_iphoneos = sqlite3; +SQLITE3_LIBRARY_iphonesimulator = sqlite3; +SQLITE3_LIBRARY_macosx = $(SQLITE3_LIBRARY_macosx_$(TARGET_MAC_OS_X_VERSION_MAJOR)); +SQLITE3_LIBRARY_macosx_ = $(SQLITE3_LIBRARY_macosx_1040); +SQLITE3_LIBRARY_macosx_1040 = WebCoreSQLite3; +SQLITE3_LIBRARY_macosx_1050 = WebCoreSQLite3; +SQLITE3_LIBRARY_macosx_1060 = sqlite3; +SQLITE3_LIBRARY_macosx_1070 = sqlite3; diff --git a/WebCore/DerivedSources.cpp b/WebCore/DerivedSources.cpp index ea6e47e..3e5fb60 100644 --- a/WebCore/DerivedSources.cpp +++ b/WebCore/DerivedSources.cpp @@ -181,14 +181,14 @@ #include "JSIDBDatabaseRequest.cpp" #include "JSIDBErrorEvent.cpp" #include "JSIDBEvent.cpp" -#include "JSIDBIndexRequest.cpp" +#include "JSIDBFactory.cpp" +#include "JSIDBIndex.cpp" #include "JSIDBKey.cpp" #include "JSIDBKeyRange.cpp" #include "JSIDBObjectStoreRequest.cpp" #include "JSIDBRequest.cpp" #include "JSIDBSuccessEvent.cpp" #include "JSImageData.cpp" -#include "JSIndexedDatabaseRequest.cpp" #include "JSInjectedScriptHost.cpp" #include "JSInspectorFrontendHost.cpp" #include "JSJavaScriptCallFrame.cpp" diff --git a/WebCore/DerivedSources.make b/WebCore/DerivedSources.make index 3b0f38d..3f2f0f4 100644 --- a/WebCore/DerivedSources.make +++ b/WebCore/DerivedSources.make @@ -111,6 +111,7 @@ DOM_CLASSES = \ DedicatedWorkerContext \ DOMApplicationCache \ DOMCoreException \ + DOMFileSystem \ DOMFormData \ DOMImplementation \ DOMMimeType \ @@ -133,6 +134,9 @@ DOM_CLASSES = \ ElementTimeControl \ Entity \ EntityReference \ + Entry \ + EntryCallback \ + ErrorCallback \ ErrorEvent \ Event \ EventException \ @@ -143,6 +147,8 @@ DOM_CLASSES = \ FileError \ FileList \ FileReader \ + FileSystemCallback \ + Flags \ Geolocation \ Geoposition \ HTMLAllCollection \ @@ -224,14 +230,14 @@ DOM_CLASSES = \ IDBDatabaseRequest \ IDBErrorEvent \ IDBEvent \ - IDBIndexRequest \ + IDBFactory \ + IDBIndex \ IDBKey \ IDBKeyRange \ IDBObjectStoreRequest \ IDBRequest \ IDBSuccessEvent \ ImageData \ - IndexedDatabaseRequest \ InjectedScriptHost \ InspectorFrontendHost \ KeyboardEvent \ @@ -242,6 +248,8 @@ DOM_CLASSES = \ MessageChannel \ MessageEvent \ MessagePort \ + Metadata \ + MetadataCallback \ MouseEvent \ MutationEvent \ NamedNodeMap \ diff --git a/WebCore/GNUmakefile.am b/WebCore/GNUmakefile.am index 8389ed6..885bd6c 100644 --- a/WebCore/GNUmakefile.am +++ b/WebCore/GNUmakefile.am @@ -1897,8 +1897,12 @@ webcore_sources += \ WebCore/platform/Logging.h \ WebCore/platform/MIMETypeRegistry.cpp \ WebCore/platform/MIMETypeRegistry.h \ + WebCore/platform/mock/DeviceOrientationClientMock.cpp \ + WebCore/platform/mock/DeviceOrientationClientMock.h \ WebCore/platform/mock/GeolocationServiceMock.cpp \ WebCore/platform/mock/GeolocationServiceMock.h \ + WebCore/platform/mock/SpeechInputClientMock.cpp \ + WebCore/platform/mock/SpeechInputClientMock.h \ WebCore/platform/NotImplemented.h \ WebCore/platform/Pasteboard.h \ WebCore/platform/PlatformKeyboardEvent.h \ @@ -2420,8 +2424,11 @@ webcoregtk_sources += \ WebCore/platform/graphics/cairo/PatternCairo.cpp \ WebCore/platform/graphics/cairo/TransformationMatrixCairo.cpp \ WebCore/platform/graphics/gtk/ColorGtk.cpp \ + WebCore/platform/graphics/gtk/CairoUtilities.cpp \ + WebCore/platform/graphics/gtk/CairoUtilities.h \ WebCore/platform/graphics/gtk/FontGtk.cpp \ WebCore/platform/graphics/gtk/IconGtk.cpp \ + WebCore/platform/graphics/gtk/ImageBufferGtk.cpp \ WebCore/platform/graphics/gtk/ImageGtk.cpp \ WebCore/platform/graphics/gtk/IntPointGtk.cpp \ WebCore/platform/graphics/gtk/IntRectGtk.cpp \ @@ -2461,6 +2468,7 @@ webcoregtk_sources += \ WebCore/platform/gtk/PasteboardHelper.h \ WebCore/platform/gtk/PlatformScreenGtk.cpp \ WebCore/platform/gtk/PopupMenuGtk.cpp \ + WebCore/platform/gtk/PopupMenuGtk.h \ WebCore/platform/gtk/RenderThemeGtk.cpp \ WebCore/platform/gtk/RenderThemeGtk.h \ WebCore/platform/gtk/ScrollbarGtk.cpp \ @@ -2469,6 +2477,7 @@ webcoregtk_sources += \ WebCore/platform/gtk/ScrollbarThemeGtk.h \ WebCore/platform/gtk/ScrollViewGtk.cpp \ WebCore/platform/gtk/SearchPopupMenuGtk.cpp \ + WebCore/platform/gtk/SearchPopupMenuGtk.h \ WebCore/platform/gtk/SharedBufferGtk.cpp \ WebCore/platform/gtk/SharedTimerGtk.cpp \ WebCore/platform/gtk/SoundGtk.cpp \ @@ -2832,8 +2841,10 @@ webcore_built_sources += \ DerivedSources/WebCore/JSIDBErrorEvent.h \ DerivedSources/WebCore/JSIDBEvent.cpp \ DerivedSources/WebCore/JSIDBEvent.h \ - DerivedSources/WebCore/JSIDBIndexRequest.cpp \ - DerivedSources/WebCore/JSIDBIndexRequest.h \ + DerivedSources/WebCore/JSIDBFactory.cpp \ + DerivedSources/WebCore/JSIDBFactory.h \ + DerivedSources/WebCore/JSIDBIndex.cpp \ + DerivedSources/WebCore/JSIDBIndex.h \ DerivedSources/WebCore/JSIDBKeyRange.cpp \ DerivedSources/WebCore/JSIDBKeyRange.h \ DerivedSources/WebCore/JSIDBObjectStoreRequest.cpp \ @@ -2841,9 +2852,7 @@ webcore_built_sources += \ DerivedSources/WebCore/JSIDBRequest.cpp \ DerivedSources/WebCore/JSIDBRequest.h \ DerivedSources/WebCore/JSIDBSuccessEvent.cpp \ - DerivedSources/WebCore/JSIDBSuccessEvent.h \ - DerivedSources/WebCore/JSIndexedDatabaseRequest.cpp \ - DerivedSources/WebCore/JSIndexedDatabaseRequest.h + DerivedSources/WebCore/JSIDBSuccessEvent.h webcore_sources += \ WebCore/storage/IDBAny.cpp \ @@ -2860,11 +2869,11 @@ webcore_sources += \ WebCore/storage/IDBErrorEvent.h \ WebCore/storage/IDBEvent.cpp \ WebCore/storage/IDBEvent.h \ + WebCore/storage/IDBIndex.cpp \ WebCore/storage/IDBIndex.h \ - WebCore/storage/IDBIndexImpl.cpp \ - WebCore/storage/IDBIndexImpl.h \ - WebCore/storage/IDBIndexRequest.cpp \ - WebCore/storage/IDBIndexRequest.h \ + WebCore/storage/IDBIndexBackendInterface.h \ + WebCore/storage/IDBIndexBackendImpl.cpp \ + WebCore/storage/IDBIndexBackendImpl.h \ WebCore/storage/IDBKeyRange.cpp \ WebCore/storage/IDBKeyRange.h \ WebCore/storage/IDBObjectStore.h \ @@ -2876,12 +2885,12 @@ webcore_sources += \ WebCore/storage/IDBRequest.h \ WebCore/storage/IDBSuccessEvent.cpp \ WebCore/storage/IDBSuccessEvent.h \ - WebCore/storage/IndexedDatabase.cpp \ - WebCore/storage/IndexedDatabase.h \ - WebCore/storage/IndexedDatabaseImpl.cpp \ - WebCore/storage/IndexedDatabaseImpl.h \ - WebCore/storage/IndexedDatabaseRequest.cpp \ - WebCore/storage/IndexedDatabaseRequest.h + WebCore/storage/IDBFactory.cpp \ + WebCore/storage/IDBFactory.h \ + WebCore/storage/IDBFactoryBackendInterface.cpp \ + WebCore/storage/IDBFactoryBackendInterface.h \ + WebCore/storage/IDBFactoryBackendImpl.cpp \ + WebCore/storage/IDBFactoryBackendImpl.h endif # END ENABLE_INDEXED_DATABASE # ---- diff --git a/WebCore/WebCore.exp.in b/WebCore/WebCore.exp.in index c1079d5..c07a5b8 100644 --- a/WebCore/WebCore.exp.in +++ b/WebCore/WebCore.exp.in @@ -217,7 +217,7 @@ __ZN7WebCore12EventHandler15sendScrollEventEv __ZN7WebCore12EventHandler16handleWheelEventERNS_18PlatformWheelEventE __ZN7WebCore12EventHandler17scrollRecursivelyENS_15ScrollDirectionENS_17ScrollGranularityEPNS_4NodeE __ZN7WebCore12EventHandler20handleTextInputEventERKNS_6StringEPNS_5EventEbb -__ZN7WebCore12EventHandler20hitTestResultAtPointERKNS_8IntPointEbbNS_17HitTestScrollbarsEj +__ZN7WebCore12EventHandler20hitTestResultAtPointERKNS_8IntPointEbbNS_17HitTestScrollbarsEjRKNS_7IntSizeE __ZN7WebCore12EventHandler21handleMousePressEventERKNS_18PlatformMouseEventE __ZN7WebCore12EventHandler23handleMouseReleaseEventERKNS_18PlatformMouseEventE __ZN7WebCore12EventHandler27capsLockStateMayHaveChangedEv @@ -250,6 +250,7 @@ __ZN7WebCore12IconDatabase27checkIntegrityBeforeOpeningEv __ZN7WebCore12IconDatabase4openERKNS_6StringE __ZN7WebCore12IconDatabase5closeEv __ZN7WebCore12IconDatabase9setClientEPNS_18IconDatabaseClientE +__ZN7WebCore12PopupMenuMacC1EPNS_15PopupMenuClientE __ZN7WebCore12PrintContext12pagePropertyEPNS_5FrameEPKci __ZN7WebCore12PrintContext13numberOfPagesEPNS_5FrameERKNS_9FloatSizeE __ZN7WebCore12PrintContext16isPageBoxVisibleEPNS_5FrameEi @@ -361,6 +362,7 @@ __ZN7WebCore15StringTruncator5widthERKNS_6StringERKNS_4FontEb __ZN7WebCore15VisiblePositionC1EPNS_4NodeEiNS_9EAffinityE __ZN7WebCore15VisiblePositionC1ERKNS_8PositionENS_9EAffinityE __ZN7WebCore15reportExceptionEPN3JSC9ExecStateENS0_7JSValueE +__ZN7WebCore15visitedLinkHashEPKtj __ZN7WebCore16AbstractDatabase14setIsAvailableEb __ZN7WebCore16FontFallbackList15releaseFontDataEv __ZN7WebCore16FontPlatformDataC1EP6NSFontbb @@ -402,6 +404,7 @@ __ZN7WebCore16isEndOfParagraphERKNS_15VisiblePositionE __ZN7WebCore16jsStringSlowCaseEPN3JSC9ExecStateERNS0_9WeakGCMapIPNS_10StringImplEPNS0_8JSStringEEES5_ __ZN7WebCore17CredentialStorage3getERKNS_15ProtectionSpaceE __ZN7WebCore17DOMImplementation14isTextMIMETypeERKNS_6StringE +__ZN7WebCore17DeviceOrientation6createEbdbdbd __ZN7WebCore17GlyphPageTreeNode18treeGlyphPageCountEv __ZN7WebCore17HTMLPlugInElement11getNPObjectEv __ZN7WebCore17HistoryController26saveDocumentAndScrollStateEv @@ -410,6 +413,7 @@ __ZN7WebCore17openTemporaryFileEPKcRi __ZN7WebCore18deprecatedParseURLERKNS_6StringE __ZN7WebCore18isStartOfParagraphERKNS_15VisiblePositionE __ZN7WebCore18pluginScriptObjectEPN3JSC9ExecStateEPNS_13JSHTMLElementE +__ZN7WebCore18SearchPopupMenuMacC1EPNS_15PopupMenuClientE __ZN7WebCore19AnimationController16resumeAnimationsEPNS_8DocumentE __ZN7WebCore19AnimationController17suspendAnimationsEPNS_8DocumentE __ZN7WebCore19AnimationController20pauseAnimationAtTimeEPNS_12RenderObjectERKNS_6StringEd @@ -458,11 +462,6 @@ __ZN7WebCore22contextMenuItemTagBoldEv __ZN7WebCore22counterValueForElementEPNS_7ElementE __ZN7WebCore22createFragmentFromTextEPNS_5RangeERKNS_6StringE __ZN7WebCore22externalRepresentationEPNS_5FrameEj -__ZN7WebCore23ApplicationCacheStorage14setMaximumSizeEx -__ZN7WebCore23ApplicationCacheStorage16storeCopyOfCacheERKNS_6StringEPNS_20ApplicationCacheHostE -__ZN7WebCore23ApplicationCacheStorage17setCacheDirectoryERKNS_6StringE -__ZN7WebCore23ApplicationCacheStorage18vacuumDatabaseFileEv -__ZN7WebCore23ApplicationCacheStorage5emptyEv __ZN7WebCore23ReplaceSelectionCommandC1EPNS_8DocumentEN3WTF10PassRefPtrINS_16DocumentFragmentEEEbbbbbNS_10EditActionE __ZN7WebCore23createFragmentFromNodesEPNS_8DocumentERKN3WTF6VectorIPNS_4NodeELm0EEE __ZN7WebCore24BinaryPropertyListWriter17writePropertyListEv @@ -490,6 +489,8 @@ __ZN7WebCore26contextMenuItemTagFontMenuEv __ZN7WebCore26contextMenuItemTagOpenLinkEv __ZN7WebCore26usesTestModeFocusRingColorEv __ZN7WebCore27CSSComputedStyleDeclarationC1EN3WTF10PassRefPtrINS_4NodeEEEbRKNS_6StringE +__ZN7WebCore27DeviceOrientationClientMock14setOrientationEN3WTF10PassRefPtrINS_17DeviceOrientationEEE +__ZN7WebCore27DeviceOrientationClientMockC1Ev __ZN7WebCore27applicationIsAdobeInstallerEv __ZN7WebCore27contextMenuItemTagShowFontsEv __ZN7WebCore27contextMenuItemTagUnderlineEv @@ -596,6 +597,7 @@ __ZN7WebCore5Range6setEndEN3WTF10PassRefPtrINS_4NodeEEEiRi __ZN7WebCore5Range8setStartEN3WTF10PassRefPtrINS_4NodeEEEiRi __ZN7WebCore5RangeD1Ev __ZN7WebCore5cacheEv +__ZN7WebCore6Chrome16setStatusbarTextEPNS_5FrameERKNS_6StringE __ZN7WebCore6Cursor8fromTypeENS0_4TypeE __ZN7WebCore6CursorD1Ev __ZN7WebCore6CursoraSERKS0_ @@ -770,7 +772,7 @@ __ZN7WebCore9FrameView21flushDeferredRepaintsEv __ZN7WebCore9FrameView22setBaseBackgroundColorENS_5ColorE __ZN7WebCore9FrameView23layoutIfNeededRecursiveEv __ZN7WebCore9FrameView23updateCanHaveScrollbarsEv -__ZN7WebCore9FrameView29forceLayoutWithPageWidthRangeEffb +__ZN7WebCore9FrameView24forceLayoutForPaginationERKNS_9FloatSizeEfNS_5Frame19AdjustViewSizeOrNotE __ZN7WebCore9FrameView29setShouldUpdateWhileOffscreenEb __ZN7WebCore9FrameView29syncCompositingStateRecursiveEv __ZN7WebCore9FrameView38scrollPositionChangedViaPlatformWidgetEv @@ -813,8 +815,10 @@ __ZN7WebCore9HTMLNames9scriptTagE __ZN7WebCore9JSElement6s_infoE __ZN7WebCore9PageCache11setCapacityEi __ZN7WebCore9PageCache27releaseAutoreleasedPagesNowEv +__ZN7WebCore9PageGroup13isLinkVisitedEy __ZN7WebCore9PageGroup14addVisitedLinkEPKtm __ZN7WebCore9PageGroup17closeLocalStorageEv +__ZN7WebCore9PageGroup18addVisitedLinkHashEy __ZN7WebCore9PageGroup20addUserScriptToWorldEPNS_15DOMWrapperWorldERKNS_6StringERKNS_4KURLEN3WTF10PassOwnPtrINS9_6VectorIS3_Lm0EEEEESD_NS_23UserScriptInjectionTimeENS_25UserContentInjectedFramesE __ZN7WebCore9PageGroup20removeAllUserContentEv __ZN7WebCore9PageGroup21removeAllVisitedLinksEv @@ -848,6 +852,7 @@ __ZNK7WebCore10ScrollView16contentsToWindowERKNS_7IntRectE __ZNK7WebCore10ScrollView18visibleContentRectEb __ZNK7WebCore11CachedImage5imageEv __ZNK7WebCore11FrameLoader10isCompleteEv +__ZNK7WebCore11FrameLoader14cancelledErrorERKNS_15ResourceRequestE __ZNK7WebCore11FrameLoader14frameHasLoadedEv __ZNK7WebCore11FrameLoader16outgoingReferrerEv __ZNK7WebCore11FrameLoader20activeDocumentLoaderEv @@ -1464,3 +1469,17 @@ __ZN7WebCore16HTMLMediaElement19setMediaPlayerProxyEP19WebMediaPlayerProxy __ZN7WebCore9HTMLNames8audioTagE __ZN7WebCore9HTMLNames8videoTagE #endif + +#if ENABLE(OFFLINE_WEB_APPLICATIONS) +__ZN7WebCore23ApplicationCacheStorage14quotaForOriginEPKNS_14SecurityOriginERx +__ZN7WebCore23ApplicationCacheStorage14setMaximumSizeEx +__ZN7WebCore23ApplicationCacheStorage14usageForOriginEPKNS_14SecurityOriginERx +__ZN7WebCore23ApplicationCacheStorage16storeCopyOfCacheERKNS_6StringEPNS_20ApplicationCacheHostE +__ZN7WebCore23ApplicationCacheStorage17setCacheDirectoryERKNS_6StringE +__ZN7WebCore23ApplicationCacheStorage18vacuumDatabaseFileEv +__ZN7WebCore23ApplicationCacheStorage21setDefaultOriginQuotaEx +__ZN7WebCore23ApplicationCacheStorage26storeUpdatedQuotaForOriginEPKNS_14SecurityOriginEx +__ZN7WebCore23ApplicationCacheStorage36remainingSizeForOriginExcludingCacheEPKNS_14SecurityOriginEPNS_16ApplicationCacheERx +__ZN7WebCore23ApplicationCacheStorage5emptyEv +__ZNK7WebCore23ApplicationCacheStorage11maximumSizeEv +#endif diff --git a/WebCore/WebCore.gyp/WebCore.gyp b/WebCore/WebCore.gyp/WebCore.gyp index abd49e7..5ecb48a 100644 --- a/WebCore/WebCore.gyp/WebCore.gyp +++ b/WebCore/WebCore.gyp/WebCore.gyp @@ -841,8 +841,8 @@ # Don't build StorageEventDispatcher. We have our own implementation. '../storage/StorageEventDispatcher.cpp', - # Don't build IndexedDatabase. We have our own implementation. - '../storage/IndexedDatabase.cpp', + # Don't build IDBFactoryBackendInterface. We have our own implementation. + '../storage/IDBFactoryBackendInterface.cpp', # Use history/BackForwardListChromium.cpp instead. '../history/BackForwardListImpl.cpp', diff --git a/WebCore/WebCore.gypi b/WebCore/WebCore.gypi index 698e302..20482bb 100644 --- a/WebCore/WebCore.gypi +++ b/WebCore/WebCore.gypi @@ -230,19 +230,27 @@ 'storage/Database.idl', 'storage/DatabaseCallback.idl', 'storage/DatabaseSync.idl', + 'storage/DOMFileSystem.idl', + 'storage/Entry.idl', + 'storage/EntryCallback.idl', + 'storage/ErrorCallback.idl', + 'storage/FileSystemCallback.idl', + 'storage/Flags.idl', 'storage/IDBAny.idl', 'storage/IDBDatabaseError.idl', 'storage/IDBDatabaseException.idl', 'storage/IDBDatabaseRequest.idl', 'storage/IDBErrorEvent.idl', 'storage/IDBEvent.idl', - 'storage/IDBIndexRequest.idl', + 'storage/IDBFactory.idl', + 'storage/IDBIndex.idl', 'storage/IDBKey.idl', 'storage/IDBKeyRange.idl', 'storage/IDBObjectStoreRequest.idl', 'storage/IDBRequest.idl', 'storage/IDBSuccessEvent.idl', - 'storage/IndexedDatabaseRequest.idl', + 'storage/Metadata.idl', + 'storage/MetadataCallback.idl', 'storage/SQLError.idl', 'storage/SQLException.idl', 'storage/SQLResultSet.idl', @@ -2122,6 +2130,7 @@ 'platform/chromium/ScrollbarThemeChromiumMac.mm', 'platform/chromium/ScrollbarThemeChromiumWin.cpp', 'platform/chromium/SearchPopupMenuChromium.cpp', + 'platform/chromium/SearchPopupMenuChromium.h', 'platform/chromium/SharedTimerChromium.cpp', 'platform/chromium/SoundChromiumPosix.cpp', 'platform/chromium/SoundChromiumWin.cpp', @@ -2614,6 +2623,7 @@ 'platform/mac/PasteboardMac.mm', 'platform/mac/PlatformMouseEventMac.mm', 'platform/mac/PlatformScreenMac.mm', + 'platform/mac/PopupMenuMac.h', 'platform/mac/PopupMenuMac.mm', 'platform/mac/PurgeableBufferMac.cpp', 'platform/mac/SSLKeyGeneratorMac.mm', @@ -2621,6 +2631,7 @@ 'platform/mac/ScrollViewMac.mm', 'platform/mac/ScrollbarThemeMac.h', 'platform/mac/ScrollbarThemeMac.mm', + 'platform/mac/SearchPopupMenuMac.h', 'platform/mac/SearchPopupMenuMac.mm', 'platform/mac/SharedBufferMac.mm', 'platform/mac/SharedTimerMac.mm', @@ -2771,6 +2782,7 @@ 'platform/qt/PlatformMouseEventQt.cpp', 'platform/qt/PlatformScreenQt.cpp', 'platform/qt/PopupMenuQt.cpp', + 'platform/qt/PopupMenuQt.h', 'platform/qt/QWebPopup.cpp', 'platform/qt/QWebPopup.h', 'platform/qt/RenderThemeQt.cpp', @@ -2781,6 +2793,7 @@ 'platform/qt/ScrollbarThemeQt.cpp', 'platform/qt/ScrollbarThemeQt.h', 'platform/qt/SearchPopupMenuQt.cpp', + 'platform/qt/SearchPopupMenuQt.h', 'platform/qt/SharedBufferQt.cpp', 'platform/qt/SharedTimerQt.cpp', 'platform/qt/SoundQt.cpp', @@ -3012,8 +3025,12 @@ 'platform/Logging.h', 'platform/MIMETypeRegistry.cpp', 'platform/MIMETypeRegistry.h', + 'platform/mock/DeviceOrientationClientMock.cpp', + 'platform/mock/DeviceOrientationClientMock.h', 'platform/mock/GeolocationServiceMock.cpp', 'platform/mock/GeolocationServiceMock.h', + 'platform/mock/SpeechInputClientMock.cpp', + 'platform/mock/SpeechInputClientMock.h', 'platform/NotImplemented.h', 'platform/Pasteboard.h', 'platform/PlatformKeyboardEvent.h', @@ -3448,7 +3465,7 @@ 'storage/ChangeVersionWrapper.cpp', 'storage/ChangeVersionWrapper.h', 'storage/chromium/DatabaseObserver.h', - 'storage/chromium/IndexedDatabase.cpp', + 'storage/chromium/IDBFactoryBackendInterface.cpp', 'storage/chromium/DatabaseTrackerChromium.cpp', 'storage/chromium/QuotaTracker.cpp', 'storage/chromium/QuotaTracker.h', @@ -3468,6 +3485,13 @@ 'storage/DatabaseTracker.cpp', 'storage/DatabaseTracker.h', 'storage/DatabaseTrackerClient.h', + 'storage/DOMFileSystem.cpp', + 'storage/DOMFileSystem.h', + 'storage/Entry.cpp', + 'storage/Entry.h', + 'storage/EntryCallback.h', + 'storage/FileSystemCallback.h', + 'storage/Flags.h', 'storage/IDBAny.cpp', 'storage/IDBAny.h', 'storage/IDBCallbacks.h', @@ -3482,11 +3506,17 @@ 'storage/IDBEvent.h', 'storage/IDBErrorEvent.cpp', 'storage/IDBErrorEvent.h', + 'storage/IDBFactory.cpp', + 'storage/IDBFactory.h', + 'storage/IDBFactoryBackendInterface.cpp', + 'storage/IDBFactoryBackendInterface.h', + 'storage/IDBFactoryBackendImpl.cpp', + 'storage/IDBFactoryBackendImpl.h', + 'storage/IDBIndex.cpp', 'storage/IDBIndex.h', - 'storage/IDBIndexImpl.cpp', - 'storage/IDBIndexImpl.h', - 'storage/IDBIndexRequest.cpp', - 'storage/IDBIndexRequest.h', + 'storage/IDBIndexBackendInterface.h', + 'storage/IDBIndexBackendImpl.cpp', + 'storage/IDBIndexBackendImpl.h', 'storage/IDBKey.cpp', 'storage/IDBKey.h', 'storage/IDBKeyRange.cpp', @@ -3501,16 +3531,12 @@ 'storage/IDBRequest.h', 'storage/IDBSuccessEvent.cpp', 'storage/IDBSuccessEvent.h', - 'storage/IndexedDatabase.cpp', - 'storage/IndexedDatabase.h', - 'storage/IndexedDatabaseImpl.cpp', - 'storage/IndexedDatabaseImpl.h', - 'storage/IndexedDatabaseRequest.cpp', - 'storage/IndexedDatabaseRequest.h', 'storage/LocalStorageTask.cpp', 'storage/LocalStorageTask.h', 'storage/LocalStorageThread.cpp', 'storage/LocalStorageThread.h', + 'storage/Metadata.h', + 'storage/MetadataCallback.h', 'storage/OriginQuotaManager.cpp', 'storage/OriginQuotaManager.h', 'storage/OriginUsageRecord.cpp', @@ -4029,6 +4055,10 @@ 'inspector/front-end/ElementsPanel.js', 'inspector/front-end/ElementsTreeOutline.js', 'inspector/front-end/EventListenersSidebarPane.js', + 'inspector/front-end/ExtensionAPI.js', + 'inspector/front-end/ExtensionPanel.js', + 'inspector/front-end/ExtensionRegistryStub.js', + 'inspector/front-end/ExtensionServer.js', 'inspector/front-end/FontView.js', 'inspector/front-end/HAREntry.js', 'inspector/front-end/HelpScreen.js', diff --git a/WebCore/WebCore.pri b/WebCore/WebCore.pri index ef87a45..ff65cae 100644 --- a/WebCore/WebCore.pri +++ b/WebCore/WebCore.pri @@ -488,13 +488,13 @@ IDL_BINDINGS += \ storage/IDBDatabaseRequest.idl \ storage/IDBErrorEvent.idl \ storage/IDBEvent.idl \ - storage/IDBIndexRequest.idl \ + storage/IDBIndex.idl \ storage/IDBKey.idl \ storage/IDBKeyRange.idl \ storage/IDBObjectStoreRequest.idl \ storage/IDBRequest.idl \ storage/IDBSuccessEvent.idl \ - storage/IndexedDatabaseRequest.idl \ + storage/IDBFactory.idl \ storage/Storage.idl \ storage/StorageEvent.idl \ storage/SQLError.idl \ @@ -667,93 +667,6 @@ IDL_BINDINGS += \ INSPECTOR_INTERFACES = inspector/Inspector.idl -WEBCORE_HEADERS_FOR_WEBKIT2 += \ - bindings/js/DOMWrapperWorld.h \ - platform/FileChooser.h \ - platform/network/qt/ResourceError.h \ - platform/network/qt/ResourceRequest.h \ - platform/network/qt/ResourceResponse.h \ - dom/KeyboardEvent.h \ - editing/EditCommand.h \ - history/BackForwardList.h \ - history/BackForwardControllerClient.h \ - history/HistoryItem.h \ - html/HTMLFormElement.h \ - html/HTMLFrameOwnerElement.h \ - inspector/InspectorClient.h \ - loader/appcache/ApplicationCacheStorage.h \ - loader/DocumentLoader.h \ - loader/FormState.h \ - loader/FrameLoader.h \ - loader/FrameLoaderClient.h \ - loader/FrameLoaderTypes.h \ - loader/PolicyChecker.h \ - loader/ProgressTracker.h \ - page/animation/AnimationController.h \ - page/Chrome.h \ - page/ChromeClient.h \ - page/ContextMenuClient.h \ - page/DragClient.h \ - page/EditorClient.h \ - page/EventHandler.h \ - page/FocusController.h \ - page/Frame.h \ - page/FrameLoadRequest.h \ - page/FrameView.h \ - page/Page.h \ - page/Settings.h \ - page/WindowFeatures.h \ - platform/Cursor.h \ - platform/PlatformKeyboardEvent.h \ - platform/PlatformMouseEvent.h \ - platform/PlatformWheelEvent.h \ - platform/Widget.h \ - platform/KURL.h \ - platform/graphics/Color.h \ - platform/graphics/ColorSpace.h \ - platform/graphics/GraphicsTypes.h \ - platform/graphics/Image.h \ - platform/graphics/ImageSource.h \ - platform/graphics/FloatRect.h \ - platform/graphics/GraphicsContext.h \ - platform/graphics/GraphicsLayerClient.h \ - platform/graphics/IntPoint.h \ - platform/graphics/IntRect.h \ - platform/graphics/IntSize.h \ - platform/graphics/Tile.h \ - platform/graphics/TiledBackingStore.h \ - platform/graphics/TiledBackingStoreClient.h \ - platform/sql/SQLiteDatabase.h \ - platform/text/PlatformString.h \ - platform/text/StringImpl.h \ - platform/MIMETypeRegistry.h \ - rendering/RenderTreeAsText.h \ - plugins/PluginData.h \ - -JSC_HEADERS_FOR_WEBKIT2 += \ - ../JavaScriptCore/runtime/JSObject.h \ - -WEBKIT2_API_HEADERS += \ - ../WebKit2/UIProcess/API/C/WKAPICast.h \ - ../WebKit2/UIProcess/API/C/WKBase.h \ - ../WebKit2/UIProcess/API/C/WKContext.h \ - ../WebKit2/UIProcess/API/C/WKContextPrivate.h \ - ../WebKit2/UIProcess/API/C/WKFrame.h \ - ../WebKit2/UIProcess/API/C/WKFramePolicyListener.h \ - ../WebKit2/UIProcess/API/C/WKNavigationData.h \ - ../WebKit2/UIProcess/API/C/WKPage.h \ - ../WebKit2/UIProcess/API/C/WKPageNamespace.h \ - ../WebKit2/UIProcess/API/C/WKPagePrivate.h \ - ../WebKit2/UIProcess/API/C/WKPreferences.h \ - ../WebKit2/UIProcess/API/C/WKString.h \ - ../WebKit2/UIProcess/API/C/WKURL.h \ - ../WebKit2/UIProcess/API/C/WebKit2.h \ - ../WebKit2/UIProcess/API/cpp/WKRetainPtr.h \ - ../WebKit2/UIProcess/API/qt/qgraphicswkview.h \ - ../WebKit2/UIProcess/API/qt/qwkpage.h \ - ../WebKit2/WebProcess/InjectedBundle/API/c/WKBundleBase.h \ - ../WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h \ - mathmlnames.output = $${WC_GENERATED_SOURCES_DIR}/MathMLNames.cpp mathmlnames.input = MATHML_NAMES mathmlnames.wkScript = $$PWD/dom/make_names.pl @@ -917,31 +830,3 @@ webkitversion.commands = perl $$webkitversion.wkScript --config $$PWD/../WebKit/ webkitversion.clean = ${QMAKE_VAR_WC_GENERATED_SOURCES_DIR}/WebKitVersion.h webkitversion.wkAddOutputToSources = false addExtraCompiler(webkitversion) - -webkit2 { - -# GENERATOR 12: Copy WebCore headers for WebKit2 -webcoreheaders.output = ../include/WebCore/${QMAKE_FILE_BASE}.h -webcoreheaders.input = WEBCORE_HEADERS_FOR_WEBKIT2 -webcoreheaders.commands = $$QMAKE_COPY ${QMAKE_FILE_NAME} ${QMAKE_FILE_OUT} -webcoreheaders.clean = ${QMAKE_FILE_OUT} -webcoreheaders.wkAddOutputToSources = false -addExtraCompiler(webcoreheaders) - -# GENERATOR 12-B: Copy JavaScriptCore headers for WebKit2 -jscheaders.output = ../include/JavaScriptCore/${QMAKE_FILE_BASE}.h -jscheaders.input = JSC_HEADERS_FOR_WEBKIT2 -jscheaders.commands = $$QMAKE_COPY ${QMAKE_FILE_NAME} ${QMAKE_FILE_OUT} -jscheaders.clean = ${QMAKE_FILE_OUT} -jscheaders.wkAddOutputToSources = false -addExtraCompiler(jscheaders) - -# GENERATOR 13: Copy WebKit2 headers -webkit2headers.output = ../include/WebKit2/${QMAKE_FILE_BASE}.h -webkit2headers.input = WEBKIT2_API_HEADERS -webkit2headers.commands = $$QMAKE_COPY ${QMAKE_FILE_NAME} ${QMAKE_FILE_OUT} -webkit2headers.clean = ${QMAKE_FILE_OUT} -webkit2headers.wkAddOutputToSources = false -addExtraCompiler(webkit2headers) - -} diff --git a/WebCore/WebCore.pro b/WebCore/WebCore.pro index b7f152e..03af4df 100644 --- a/WebCore/WebCore.pro +++ b/WebCore/WebCore.pro @@ -912,7 +912,9 @@ SOURCES += \ platform/LinkHash.cpp \ platform/Logging.cpp \ platform/MIMETypeRegistry.cpp \ + platform/mock/DeviceOrientationClientMock.cpp \ platform/mock/GeolocationServiceMock.cpp \ + platform/mock/SpeechInputClientMock.cpp \ platform/network/AuthenticationChallengeBase.cpp \ platform/network/Credential.cpp \ platform/network/FormData.cpp \ @@ -1630,7 +1632,9 @@ HEADERS += \ platform/FileChooser.h \ platform/GeolocationService.h \ platform/image-decoders/ImageDecoder.h \ + platform/mock/DeviceOrientationClientMock.h \ platform/mock/GeolocationServiceMock.h \ + platform/mock/SpeechInputClientMock.h \ platform/graphics/BitmapImage.h \ platform/graphics/Color.h \ platform/graphics/filters/FEBlend.h \ @@ -1705,6 +1709,7 @@ HEADERS += \ platform/network/ResourceResponseBase.h \ platform/PlatformTouchEvent.h \ platform/PlatformTouchPoint.h \ + platform/PopupMenu.h \ platform/qt/ClipboardQt.h \ platform/qt/QWebPageClient.h \ platform/qt/QtAbstractWebPopup.h \ @@ -1714,6 +1719,7 @@ HEADERS += \ platform/Scrollbar.h \ platform/ScrollbarThemeComposite.h \ platform/ScrollView.h \ + platform/SearchPopupMenu.h \ platform/SharedBuffer.h \ platform/sql/SQLiteDatabase.h \ platform/sql/SQLiteFileSystem.h \ @@ -2268,8 +2274,7 @@ maemo5 { mac { SOURCES += \ platform/text/cf/StringCF.cpp \ - platform/text/cf/StringImplCF.cpp \ - platform/cf/SharedBufferCF.cpp + platform/text/cf/StringImplCF.cpp LIBS_PRIVATE += -framework Carbon -framework AppKit } @@ -2425,19 +2430,19 @@ contains(DEFINES, ENABLE_INDEXED_DATABASE=1) { storage/IDBDatabaseRequest.h \ storage/IDBErrorEvent.h \ storage/IDBEvent.h \ + storage/IDBFactory.h \ + storage/IDBFactoryBackendInterface.h \ + storage/IDBFactoryBackendImpl.h \ storage/IDBIndex.h \ - storage/IDBIndexImpl.h \ - storage/IDBIndexRequest.h \ + storage/IDBIndexBackendInterface.h \ + storage/IDBIndexBackendImpl.h \ storage/IDBKey.h \ storage/IDBKeyRange.h \ storage/IDBObjectStore.h \ storage/IDBObjectStoreImpl.h \ storage/IDBObjectStoreRequest.h \ storage/IDBRequest.h \ - storage/IDBSuccessEvent.h \ - storage/IndexedDatabase.h \ - storage/IndexedDatabaseImpl.h \ - storage/IndexedDatabaseRequest.h + storage/IDBSuccessEvent.h SOURCES += \ bindings/js/IDBBindingUtilities.cpp \ @@ -2448,17 +2453,17 @@ contains(DEFINES, ENABLE_INDEXED_DATABASE=1) { storage/IDBDatabaseRequest.cpp \ storage/IDBErrorEvent.cpp \ storage/IDBEvent.cpp \ - storage/IDBIndexImpl.cpp \ - storage/IDBIndexRequest.cpp \ + storage/IDBFactory.cpp \ + storage/IDBFactoryBackendInterface.cpp \ + storage/IDBFactoryBackendImpl.cpp \ + storage/IDBIndex.cpp \ + storage/IDBIndexBackendImpl.cpp \ storage/IDBKey.cpp \ storage/IDBKeyRange.cpp \ storage/IDBObjectStoreImpl.cpp \ storage/IDBObjectStoreRequest.cpp \ storage/IDBRequest.cpp \ - storage/IDBSuccessEvent.cpp \ - storage/IndexedDatabase.cpp \ - storage/IndexedDatabaseImpl.cpp \ - storage/IndexedDatabaseRequest.cpp + storage/IDBSuccessEvent.cpp } contains(DEFINES, ENABLE_DOM_STORAGE=1) { @@ -3293,6 +3298,8 @@ HEADERS += \ ../WebKit2/WebProcess/WebCoreSupport/WebErrors.h \ ../WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.h \ ../WebKit2/WebProcess/WebCoreSupport/WebInspectorClient.h \ + ../WebKit2/WebProcess/WebCoreSupport/WebPopupMenu.h \ + ../WebKit2/WebProcess/WebCoreSupport/WebSearchPopupMenu.h \ ../WebKit2/WebProcess/WebPage/ChunkedUpdateDrawingArea.h \ ../WebKit2/WebProcess/WebPage/DrawingArea.h \ ../WebKit2/WebProcess/WebPage/WebFrame.h \ @@ -3365,6 +3372,8 @@ SOURCES += \ ../WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp \ ../WebKit2/WebProcess/WebCoreSupport/WebInspectorClient.cpp \ ../WebKit2/WebProcess/WebCoreSupport/WebBackForwardControllerClient.cpp \ + ../WebKit2/WebProcess/WebCoreSupport/WebPopupMenu.cpp \ + ../WebKit2/WebProcess/WebCoreSupport/WebSearchPopupMenu.cpp \ ../WebKit2/WebProcess/WebCoreSupport/qt/WebErrorsQt.cpp \ ../WebKit2/WebProcess/WebPage/ChunkedUpdateDrawingArea.cpp \ ../WebKit2/WebProcess/WebPage/DrawingArea.cpp \ @@ -3376,6 +3385,11 @@ SOURCES += \ ../WebKit2/WebProcess/WebProcess.cpp \ ../WebKit2/WebProcess/qt/WebProcessMainQt.cpp +INCLUDEPATH = \ + $$OUTPUT_DIR/WebCore/generated \ + $$INCLUDEPATH \ + $$OUPUT_DIR/include + } symbian { diff --git a/WebCore/WebCore.vcproj/WebCore.vcproj b/WebCore/WebCore.vcproj/WebCore.vcproj index de4b3c4..7e80fb2 100644 --- a/WebCore/WebCore.vcproj/WebCore.vcproj +++ b/WebCore/WebCore.vcproj/WebCore.vcproj @@ -23740,6 +23740,10 @@ >
</File>
<File
+ RelativePath="..\platform\win\PopupMenuWin.h"
+ >
+ </File>
+ <File
RelativePath="..\platform\win\ScrollbarThemeSafari.cpp"
>
</File>
@@ -23760,6 +23764,10 @@ >
</File>
<File
+ RelativePath="..\platform\win\SearchPopupMenuWin.h"
+ >
+ </File>
+ <File
RelativePath="..\platform\win\SharedBufferWin.cpp"
>
</File>
@@ -24372,6 +24380,14 @@ >
</File>
<File
+ RelativePath="..\platform\graphics\WOFFFileFormat.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\platform\graphics\WOFFFileFormat.h"
+ >
+ </File>
+ <File
RelativePath="..\platform\graphics\UnitBezier.h"
>
</File>
@@ -28192,6 +28208,14 @@ Name="mock"
>
<File
+ RelativePath="..\platform\mock\DeviceOrientationClientMock.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\platform\mock\DeviceOrientationClientMock.h"
+ >
+ </File>
+ <File
RelativePath="..\platform\mock\GeolocationServiceMock.cpp"
>
</File>
@@ -28199,6 +28223,14 @@ RelativePath="..\platform\mock\GeolocationServiceMock.h"
>
</File>
+ <File
+ RelativePath="..\platform\mock\SpeechInputClientMock.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\platform\mock\SpeechInputClientMock.h"
+ >
+ </File>
</Filter>
</Filter>
<Filter
@@ -44768,7 +44800,7 @@ >
</File>
<File
- RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSIDBIndexRequest.cpp"
+ RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSIDBIndex.cpp"
>
<FileConfiguration
Name="Debug|Win32"
@@ -44820,7 +44852,7 @@ </FileConfiguration>
</File>
<File
- RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSIDBIndexRequest.h"
+ RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSIDBIndex.h"
>
</File>
<File
@@ -45316,7 +45348,7 @@ </FileConfiguration>
</File>
<File
- RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSIndexedDatabaserequest.cpp"
+ RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSIDBFactory.cpp"
>
<FileConfiguration
Name="Debug|Win32"
@@ -45368,7 +45400,7 @@ </FileConfiguration>
</File>
<File
- RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSIndexedDatabaseRequest.h"
+ RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSIDBFactory.h"
>
</File>
<File
@@ -50157,23 +50189,23 @@ >
</File>
<File
- RelativePath="..\storage\IDBIndex.h"
+ RelativePath="..\storage\IDBIndex.cpp"
>
</File>
<File
- RelativePath="..\storage\IDBIndexImpl.cpp"
+ RelativePath="..\storage\IDBIndex.h"
>
</File>
<File
- RelativePath="..\storage\IDBIndexImpl.h"
+ RelativePath="..\storage\IDBIndexBackendInterface.h"
>
</File>
<File
- RelativePath="..\storage\IDBIndexRequest.cpp"
+ RelativePath="..\storage\IDBIndexBackendImpl.cpp"
>
</File>
<File
- RelativePath="..\storage\IDBIndexRequest.h"
+ RelativePath="..\storage\IDBIndexBackendImpl.h"
>
</File>
<File
@@ -50228,28 +50260,28 @@ RelativePath="..\storage\IDBSuccessEvent.h"
>
</File>
+ <File
+ RelativePath="..\storage\IDBFactory.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\storage\IDBFactory.h"
+ >
+ </File>
<File
- RelativePath="..\storage\IndexedDatabase.cpp"
+ RelativePath="..\storage\IDBFactoryBackendInterface.cpp"
>
</File>
<File
- RelativePath="..\storage\IndexedDatabase.h"
+ RelativePath="..\storage\IDBFactoryBackendInterface.h"
>
</File>
<File
- RelativePath="..\storage\IndexedDatabaseImpl.cpp"
+ RelativePath="..\storage\IDBFactoryBackendImpl.cpp"
>
</File>
<File
- RelativePath="..\storage\IndexedDatabaseImpl.h"
- >
- </File>
- <File
- RelativePath="..\storage\IndexedDatabaseRequest.cpp"
- >
- </File>
- <File
- RelativePath="..\storage\IndexedDatabaseRequest.h"
+ RelativePath="..\storage\IDBFactoryBackendImpl.h"
>
</File>
<File
@@ -50900,6 +50932,22 @@ >
</File>
<File
+ RelativePath="..\inspector\front-end\ExtensionAPI.js"
+ >
+ </File>
+ <File
+ RelativePath="..\inspector\front-end\ExtensionPanel.js"
+ >
+ </File>
+ <File
+ RelativePath="..\inspector\front-end\ExtensionRegistryStub.js"
+ >
+ </File>
+ <File
+ RelativePath="..\inspector\front-end\ExtensionServer.js"
+ >
+ </File>
+ <File
RelativePath="..\inspector\front-end\FontView.js"
>
</File>
diff --git a/WebCore/WebCore.vcproj/WebCoreCommon.vsprops b/WebCore/WebCore.vcproj/WebCoreCommon.vsprops index 537e129..25fa58e 100644 --- a/WebCore/WebCore.vcproj/WebCoreCommon.vsprops +++ b/WebCore/WebCore.vcproj/WebCoreCommon.vsprops @@ -7,7 +7,7 @@ >
<Tool
Name="VCCLCompilerTool"
- AdditionalIncludeDirectories=""$(ProjectDir)..";"$(ProjectDir)..\accessibility";"$(ProjectDir)..\accessibility\win";"$(ProjectDir)..\bridge";"$(ProjectDir)..\bridge\c";"$(ProjectDir)..\bridge\jsc";"$(ProjectDir)..\css";"$(ProjectDir)..\editing";"$(ProjectDir)..\rendering";"$(ProjectDir)..\rendering\style";"$(ProjectDir)..\bindings";"$(ProjectDir)..\bindings\generic";"$(ProjectDir)..\bindings\js";"$(ProjectDir)..\dom";"$(ProjectDir)..\dom\default";"$(ProjectDir)..\history";"$(ProjectDir)..\html";"$(ProjectDir)..\html\canvas";"$(ProjectDir)..\inspector";"$(ProjectDir)..\loader";"$(ProjectDir)..\loader\appcache";"$(ProjectDir)..\loader\archive";"$(ProjectDir)..\loader\archive\cf";"$(ProjectDir)..\loader\icon";"$(ProjectDir)..\notifications";"$(ProjectDir)..\page";"$(ProjectDir)..\page\animation";"$(ProjectDir)..\page\win";"$(ProjectDir)..\platform";"$(ProjectDir)..\platform\animation";"$(ProjectDir)..\platform\mock";"$(ProjectDir)..\platform\sql";"$(ProjectDir)..\platform\win";"$(ProjectDir)..\platform\network";"$(ProjectDir)..\platform\network\win";"$(ProjectDir)..\platform\cf";"$(ProjectDir)..\platform\graphics";"$(ProjectDir)..\platform\graphics\filters";"$(ProjectDir)..\platform\graphics\opentype";"$(ProjectDir)..\platform\graphics\transforms";"$(ProjectDir)..\platform\text";"$(ProjectDir)..\platform\text\transcoder";"$(ProjectDir)..\platform\graphics\win";"$(ProjectDir)..\xml";"$(WebKitOutputDir)\obj\WebCore\DerivedSources";"$(ProjectDir)..\plugins";"$(ProjectDir)..\plugins\win";"$(ProjectDir)..\svg\animation";"$(ProjectDir)..\svg\graphics";"$(ProjectDir)..\svg\graphics\filters";"$(ProjectDir)..\svg";"$(ProjectDir)..\wml";"$(ProjectDir)..\storage";"$(ProjectDir)..\websockets";"$(ProjectDir)..\workers";"$(WebKitOutputDir)\include";"$(WebKitOutputDir)\include\private";"$(WebKitOutputDir)\include\JavaScriptCore";"$(WebKitOutputDir)\include\private\JavaScriptCore";"$(ProjectDir)..\ForwardingHeaders";"$(WebKitLibrariesDir)\include";"$(WebKitLibrariesDir)\include\private";"$(WebKitLibrariesDir)\include\private\JavaScriptCore";"$(WebKitLibrariesDir)\include\pthreads";"$(WebKitLibrariesDir)\include\sqlite";"$(WebKitLibrariesDir)\include\JavaScriptCore""
+ AdditionalIncludeDirectories=""$(ProjectDir)..";"$(ProjectDir)..\accessibility";"$(ProjectDir)..\accessibility\win";"$(ProjectDir)..\bridge";"$(ProjectDir)..\bridge\c";"$(ProjectDir)..\bridge\jsc";"$(ProjectDir)..\css";"$(ProjectDir)..\editing";"$(ProjectDir)..\rendering";"$(ProjectDir)..\rendering\style";"$(ProjectDir)..\bindings";"$(ProjectDir)..\bindings\generic";"$(ProjectDir)..\bindings\js";"$(ProjectDir)..\dom";"$(ProjectDir)..\dom\default";"$(ProjectDir)..\history";"$(ProjectDir)..\html";"$(ProjectDir)..\html\canvas";"$(ProjectDir)..\inspector";"$(ProjectDir)..\loader";"$(ProjectDir)..\loader\appcache";"$(ProjectDir)..\loader\archive";"$(ProjectDir)..\loader\archive\cf";"$(ProjectDir)..\loader\icon";"$(ProjectDir)..\notifications";"$(ProjectDir)..\page";"$(ProjectDir)..\page\animation";"$(ProjectDir)..\page\win";"$(ProjectDir)..\platform";"$(ProjectDir)..\platform\animation";"$(ProjectDir)..\platform\mock";"$(ProjectDir)..\platform\sql";"$(ProjectDir)..\platform\win";"$(ProjectDir)..\platform\network";"$(ProjectDir)..\platform\network\win";"$(ProjectDir)..\platform\cf";"$(ProjectDir)..\platform\graphics";"$(ProjectDir)..\platform\graphics\filters";"$(ProjectDir)..\platform\graphics\opentype";"$(ProjectDir)..\platform\graphics\transforms";"$(ProjectDir)..\platform\text";"$(ProjectDir)..\platform\text\transcoder";"$(ProjectDir)..\platform\graphics\win";"$(ProjectDir)..\xml";"$(WebKitOutputDir)\obj\WebCore\DerivedSources";"$(ProjectDir)..\plugins";"$(ProjectDir)..\plugins\win";"$(ProjectDir)..\svg\animation";"$(ProjectDir)..\svg\graphics";"$(ProjectDir)..\svg\graphics\filters";"$(ProjectDir)..\svg";"$(ProjectDir)..\wml";"$(ProjectDir)..\storage";"$(ProjectDir)..\websockets";"$(ProjectDir)..\workers";"$(WebKitOutputDir)\include";"$(WebKitOutputDir)\include\private";"$(WebKitOutputDir)\include\JavaScriptCore";"$(WebKitOutputDir)\include\private\JavaScriptCore";"$(ProjectDir)..\ForwardingHeaders";"$(WebKitLibrariesDir)\include";"$(WebKitLibrariesDir)\include\private";"$(WebKitLibrariesDir)\include\private\JavaScriptCore";"$(WebKitLibrariesDir)\include\pthreads";"$(WebKitLibrariesDir)\include\sqlite";"$(WebKitLibrariesDir)\include\JavaScriptCore";"$(WebKitLibrariesDir)\include\zlib""
PreprocessorDefinitions="__WIN32__;DISABLE_3D_RENDERING;WEBCORE_CONTEXT_MENUS"
UsePrecompiledHeader="2"
PrecompiledHeaderThrough="WebCorePrefix.h"
diff --git a/WebCore/WebCore.xcodeproj/project.pbxproj b/WebCore/WebCore.xcodeproj/project.pbxproj index 7af6387..853d1ca 100644 --- a/WebCore/WebCore.xcodeproj/project.pbxproj +++ b/WebCore/WebCore.xcodeproj/project.pbxproj @@ -42,7 +42,7 @@ 065AD4F50B0C2EDA005A2B1D /* ContextMenuClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 065AD4F20B0C2EDA005A2B1D /* ContextMenuClient.h */; settings = {ATTRIBUTES = (Private, ); }; }; 065AD4F60B0C2EDA005A2B1D /* ContextMenuController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 065AD4F30B0C2EDA005A2B1D /* ContextMenuController.cpp */; }; 065AD4F70B0C2EDA005A2B1D /* ContextMenuController.h in Headers */ = {isa = PBXBuildFile; fileRef = 065AD4F40B0C2EDA005A2B1D /* ContextMenuController.h */; settings = {ATTRIBUTES = (Private, ); }; }; - 0668E18B0ADD9624004128E0 /* PopupMenu.h in Headers */ = {isa = PBXBuildFile; fileRef = 0668E1890ADD9624004128E0 /* PopupMenu.h */; }; + 0668E18B0ADD9624004128E0 /* PopupMenu.h in Headers */ = {isa = PBXBuildFile; fileRef = 0668E1890ADD9624004128E0 /* PopupMenu.h */; settings = {ATTRIBUTES = (Private, ); }; }; 0668E1900ADD9640004128E0 /* PopupMenuMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0668E18E0ADD9640004128E0 /* PopupMenuMac.mm */; }; 066C772B0AB603B700238CC4 /* FileChooser.h in Headers */ = {isa = PBXBuildFile; fileRef = 066C772A0AB603B700238CC4 /* FileChooser.h */; settings = {ATTRIBUTES = (Private, ); }; }; 066C772D0AB603D200238CC4 /* FileChooserMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 066C772C0AB603D200238CC4 /* FileChooserMac.mm */; }; @@ -783,6 +783,9 @@ 3784C34B0E11AA34007D8D48 /* FontTraitsMask.h in Headers */ = {isa = PBXBuildFile; fileRef = 3784C34A0E11AA34007D8D48 /* FontTraitsMask.h */; settings = {ATTRIBUTES = (Private, ); }; }; 37919C230B7D188600A56998 /* PositionIterator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 37919C210B7D188600A56998 /* PositionIterator.cpp */; }; 37919C240B7D188600A56998 /* PositionIterator.h in Headers */ = {isa = PBXBuildFile; fileRef = 37919C220B7D188600A56998 /* PositionIterator.h */; settings = {ATTRIBUTES = (); }; }; + 379919961200DDF400EA041C /* WOFFFileFormat.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 379919941200DDF400EA041C /* WOFFFileFormat.cpp */; }; + 379919971200DDF400EA041C /* WOFFFileFormat.h in Headers */ = {isa = PBXBuildFile; fileRef = 379919951200DDF400EA041C /* WOFFFileFormat.h */; }; + 379919B21200DE5000EA041C /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 379919B11200DE5000EA041C /* libz.dylib */; }; 37ACCE420DA2980F0089E602 /* FontRenderingMode.h in Headers */ = {isa = PBXBuildFile; fileRef = 37ACCE410DA2980F0089E602 /* FontRenderingMode.h */; settings = {ATTRIBUTES = (Private, ); }; }; 37ACCF690DA414E70089E602 /* FontDescription.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 37ACCE620DA2AA960089E602 /* FontDescription.cpp */; }; 37C2360B1097EDED00EF9F72 /* FontComplexTextMac.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 37C2360A1097EDED00EF9F72 /* FontComplexTextMac.cpp */; }; @@ -1108,6 +1111,7 @@ 514C767D0CE923A1007EF3CD /* ResourceRequestBase.h in Headers */ = {isa = PBXBuildFile; fileRef = 514C76680CE923A1007EF3CD /* ResourceRequestBase.h */; settings = {ATTRIBUTES = (Private, ); }; }; 514C767E0CE923A1007EF3CD /* ResourceResponseBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 514C76690CE923A1007EF3CD /* ResourceResponseBase.cpp */; }; 514C767F0CE923A1007EF3CD /* ResourceResponseBase.h in Headers */ = {isa = PBXBuildFile; fileRef = 514C766A0CE923A1007EF3CD /* ResourceResponseBase.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 515788C11207852C00A37C4A /* VisitedLinkStrategy.h in Headers */ = {isa = PBXBuildFile; fileRef = 515788C01207852C00A37C4A /* VisitedLinkStrategy.h */; settings = {ATTRIBUTES = (Private, ); }; }; 515B03990CD1642A00B7EA9C /* SQLStatement.h in Headers */ = {isa = PBXBuildFile; fileRef = 515B03970CD1642A00B7EA9C /* SQLStatement.h */; settings = {ATTRIBUTES = (Private, ); }; }; 515B039A0CD1642A00B7EA9C /* SQLStatement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 515B03980CD1642A00B7EA9C /* SQLStatement.cpp */; }; 5160300B0CC4251200C8AC25 /* FileSystemPOSIX.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5160300A0CC4251200C8AC25 /* FileSystemPOSIX.cpp */; }; @@ -1190,10 +1194,12 @@ 54C50F7B0E801DF3009832A0 /* XMLDocumentParserLibxml2.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 54C50F7A0E801DF3009832A0 /* XMLDocumentParserLibxml2.cpp */; }; 550A0BC9085F6039007353D6 /* QualifiedName.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 550A0BC7085F6039007353D6 /* QualifiedName.cpp */; }; 550A0BCA085F6039007353D6 /* QualifiedName.h in Headers */ = {isa = PBXBuildFile; fileRef = 550A0BC8085F6039007353D6 /* QualifiedName.h */; settings = {ATTRIBUTES = (Private, ); }; }; - 590E1B4911E4EF4B0069F784 /* DeviceOrientation.h in Headers */ = {isa = PBXBuildFile; fileRef = 590E1B4811E4EF4B0069F784 /* DeviceOrientation.h */; }; + 590E1B4911E4EF4B0069F784 /* DeviceOrientation.h in Headers */ = {isa = PBXBuildFile; fileRef = 590E1B4811E4EF4B0069F784 /* DeviceOrientation.h */; settings = {ATTRIBUTES = (Private, ); }; }; 590E1B4B11E4EF700069F784 /* JSDeviceOrientationEventCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 590E1B4A11E4EF700069F784 /* JSDeviceOrientationEventCustom.cpp */; }; 5913953B110758450083EC55 /* JNIBridge.h in Headers */ = {isa = PBXBuildFile; fileRef = 5913953A110758450083EC55 /* JNIBridge.h */; }; 5913953D1107584E0083EC55 /* JNIBridge.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5913953C1107584E0083EC55 /* JNIBridge.cpp */; }; + 59309A1111F4AE5800250603 /* DeviceOrientationClientMock.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 59309A1011F4AE5800250603 /* DeviceOrientationClientMock.cpp */; }; + 59309A1311F4AE6A00250603 /* DeviceOrientationClientMock.h in Headers */ = {isa = PBXBuildFile; fileRef = 59309A1211F4AE6A00250603 /* DeviceOrientationClientMock.h */; settings = {ATTRIBUTES = (Private, ); }; }; 596229781133EFD700DC4CBB /* GeolocationPositionCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 596229771133EFD700DC4CBB /* GeolocationPositionCache.cpp */; }; 5962297A1133EFE200DC4CBB /* GeolocationPositionCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 596229791133EFE200DC4CBB /* GeolocationPositionCache.h */; settings = {ATTRIBUTES = (Private, ); }; }; 599E759011055A1F00D904FA /* Bridge.h in Headers */ = {isa = PBXBuildFile; fileRef = 599E758F11055A1F00D904FA /* Bridge.h */; settings = {ATTRIBUTES = (Private, ); }; }; @@ -1203,7 +1209,7 @@ 59A86008119DAFA100DEF1EF /* JSDeviceOrientationEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 59A86007119DAFA100DEF1EF /* JSDeviceOrientationEvent.h */; }; 59A8F1D411A69508001AC34A /* DeviceOrientationController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 59A8F1D311A69508001AC34A /* DeviceOrientationController.cpp */; }; 59A8F1D611A69513001AC34A /* DeviceOrientationController.h in Headers */ = {isa = PBXBuildFile; fileRef = 59A8F1D511A69513001AC34A /* DeviceOrientationController.h */; }; - 59A8F1D811A69520001AC34A /* DeviceOrientationClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 59A8F1D711A69520001AC34A /* DeviceOrientationClient.h */; }; + 59A8F1D811A69520001AC34A /* DeviceOrientationClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 59A8F1D711A69520001AC34A /* DeviceOrientationClient.h */; settings = {ATTRIBUTES = (Private, ); }; }; 59A9E7B01104758800DFB4C1 /* JavaInstanceJSC.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 59A9E7AF1104758800DFB4C1 /* JavaInstanceJSC.cpp */; }; 59A9E7B21104759400DFB4C1 /* JavaInstanceJSC.h in Headers */ = {isa = PBXBuildFile; fileRef = 59A9E7B11104759400DFB4C1 /* JavaInstanceJSC.h */; }; 59B597731108656B007159E8 /* BridgeJSC.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 59B597721108656B007159E8 /* BridgeJSC.cpp */; }; @@ -1349,6 +1355,8 @@ 750D029311D0E7F300BD1B27 /* RenderInputSpeech.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 750D029111D0E7F300BD1B27 /* RenderInputSpeech.cpp */; }; 750D029411D0E7F300BD1B27 /* RenderInputSpeech.h in Headers */ = {isa = PBXBuildFile; fileRef = 750D029211D0E7F300BD1B27 /* RenderInputSpeech.h */; }; 750D02C111D0EE7D00BD1B27 /* inputSpeech.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 750D02C011D0EE7D00BD1B27 /* inputSpeech.tiff */; }; + 7535BC9412020CFF0037EC45 /* SpeechInputClientMock.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7535BC9212020CFF0037EC45 /* SpeechInputClientMock.cpp */; }; + 7535BC9512020CFF0037EC45 /* SpeechInputClientMock.h in Headers */ = {isa = PBXBuildFile; fileRef = 7535BC9312020CFF0037EC45 /* SpeechInputClientMock.h */; }; 754133A8102E00E800075D00 /* InspectorTimelineAgent.h in Headers */ = {isa = PBXBuildFile; fileRef = 754133A7102E00E800075D00 /* InspectorTimelineAgent.h */; }; 754133AA102E00F400075D00 /* InspectorTimelineAgent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 754133A9102E00F400075D00 /* InspectorTimelineAgent.cpp */; }; 7553CFE8108F473F00EA281E /* TimelineRecordFactory.h in Headers */ = {isa = PBXBuildFile; fileRef = 7553CFE6108F473F00EA281E /* TimelineRecordFactory.h */; }; @@ -3589,12 +3597,12 @@ AB4CB4EB0B8BDA3D009F40B0 /* JSHTMLSelectElementCustom.h in Headers */ = {isa = PBXBuildFile; fileRef = AB4CB4EA0B8BDA3D009F40B0 /* JSHTMLSelectElementCustom.h */; }; AB67D1A8097F3AE300F9392E /* RenderTextControl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AB67D1A6097F3AE300F9392E /* RenderTextControl.cpp */; }; AB67D1A9097F3AE300F9392E /* RenderTextControl.h in Headers */ = {isa = PBXBuildFile; fileRef = AB67D1A7097F3AE300F9392E /* RenderTextControl.h */; }; - AB7170890B3118080017123E /* SearchPopupMenu.h in Headers */ = {isa = PBXBuildFile; fileRef = AB7170880B3118080017123E /* SearchPopupMenu.h */; }; + AB7170890B3118080017123E /* SearchPopupMenu.h in Headers */ = {isa = PBXBuildFile; fileRef = AB7170880B3118080017123E /* SearchPopupMenu.h */; settings = {ATTRIBUTES = (Private, ); }; }; AB7170A00B31193B0017123E /* SearchPopupMenuMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = AB71709F0B31193B0017123E /* SearchPopupMenuMac.mm */; }; ABAF22080C03B1C700B0BCF0 /* ChromeMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = ABAF22070C03B1C700B0BCF0 /* ChromeMac.mm */; }; ABB5419E0ACDDFE4002820EB /* RenderListBox.cpp in Sources */ = {isa = PBXBuildFile; fileRef = ABB5419C0ACDDFE4002820EB /* RenderListBox.cpp */; }; ABB5419F0ACDDFE4002820EB /* RenderListBox.h in Headers */ = {isa = PBXBuildFile; fileRef = ABB5419D0ACDDFE4002820EB /* RenderListBox.h */; }; - ABC128770B33AA6D00C693D5 /* PopupMenuClient.h in Headers */ = {isa = PBXBuildFile; fileRef = ABC128760B33AA6D00C693D5 /* PopupMenuClient.h */; }; + ABC128770B33AA6D00C693D5 /* PopupMenuClient.h in Headers */ = {isa = PBXBuildFile; fileRef = ABC128760B33AA6D00C693D5 /* PopupMenuClient.h */; settings = {ATTRIBUTES = (Private, ); }; }; ABDDFE790A5C6E7000A3E11D /* RenderMenuList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = ABDDFE730A5C6E6F00A3E11D /* RenderMenuList.cpp */; }; ABDDFE7A0A5C6E7000A3E11D /* RenderMenuList.h in Headers */ = {isa = PBXBuildFile; fileRef = ABDDFE740A5C6E7000A3E11D /* RenderMenuList.h */; }; ABFE7E120D32FAF60066F4D2 /* MediaControlElements.cpp in Sources */ = {isa = PBXBuildFile; fileRef = ABFE7E100D32FAF50066F4D2 /* MediaControlElements.cpp */; }; @@ -4913,6 +4921,13 @@ C55610F111A704EB00B82D27 /* DOMStringList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C55610F011A704EB00B82D27 /* DOMStringList.cpp */; }; C55E38BF10040D5D00A56BDB /* StorageNamespaceImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = C55E38BB10040D5D00A56BDB /* StorageNamespaceImpl.h */; }; C55E38C010040D5D00A56BDB /* StorageNamespaceImpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C55E38BC10040D5D00A56BDB /* StorageNamespaceImpl.cpp */; }; + C572EE0A1201C736007D8F82 /* IDBIndex.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C572EE041201C736007D8F82 /* IDBIndex.cpp */; }; + C572EE0B1201C736007D8F82 /* IDBIndex.h in Headers */ = {isa = PBXBuildFile; fileRef = C572EE051201C736007D8F82 /* IDBIndex.h */; }; + C572EE0D1201C736007D8F82 /* IDBIndexBackendImpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C572EE071201C736007D8F82 /* IDBIndexBackendImpl.cpp */; }; + C572EE0E1201C736007D8F82 /* IDBIndexBackendImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = C572EE081201C736007D8F82 /* IDBIndexBackendImpl.h */; }; + C572EE0F1201C736007D8F82 /* IDBIndexBackendInterface.h in Headers */ = {isa = PBXBuildFile; fileRef = C572EE091201C736007D8F82 /* IDBIndexBackendInterface.h */; }; + C572EE1E1201C9BC007D8F82 /* JSIDBIndex.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C572EE1C1201C9BC007D8F82 /* JSIDBIndex.cpp */; }; + C572EE1F1201C9BC007D8F82 /* JSIDBIndex.h in Headers */ = {isa = PBXBuildFile; fileRef = C572EE1D1201C9BC007D8F82 /* JSIDBIndex.h */; }; C585A65E11D4FAB2004C3E4B /* JSIDBAnyCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C585A65C11D4FAB2004C3E4B /* JSIDBAnyCustom.cpp */; }; C585A65F11D4FAB2004C3E4B /* JSIDBKeyCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C585A65D11D4FAB2004C3E4B /* JSIDBKeyCustom.cpp */; }; C585A66211D4FAC5004C3E4B /* IDBBindingUtilities.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C585A66011D4FAC5004C3E4B /* IDBBindingUtilities.cpp */; }; @@ -4929,8 +4944,6 @@ C585A68511D4FB08004C3E4B /* JSIDBErrorEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = C585A66D11D4FB07004C3E4B /* JSIDBErrorEvent.h */; }; C585A68611D4FB08004C3E4B /* JSIDBEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C585A66E11D4FB07004C3E4B /* JSIDBEvent.cpp */; }; C585A68711D4FB08004C3E4B /* JSIDBEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = C585A66F11D4FB07004C3E4B /* JSIDBEvent.h */; }; - C585A68811D4FB08004C3E4B /* JSIDBIndexRequest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C585A67011D4FB07004C3E4B /* JSIDBIndexRequest.cpp */; }; - C585A68911D4FB08004C3E4B /* JSIDBIndexRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = C585A67111D4FB07004C3E4B /* JSIDBIndexRequest.h */; }; C585A68A11D4FB08004C3E4B /* JSIDBKey.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C585A67211D4FB07004C3E4B /* JSIDBKey.cpp */; }; C585A68B11D4FB08004C3E4B /* JSIDBKey.h in Headers */ = {isa = PBXBuildFile; fileRef = C585A67311D4FB07004C3E4B /* JSIDBKey.h */; }; C585A68C11D4FB08004C3E4B /* JSIDBKeyRange.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C585A67411D4FB07004C3E4B /* JSIDBKeyRange.cpp */; }; @@ -4941,8 +4954,8 @@ C585A69111D4FB08004C3E4B /* JSIDBRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = C585A67911D4FB07004C3E4B /* JSIDBRequest.h */; }; C585A69211D4FB08004C3E4B /* JSIDBSuccessEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C585A67A11D4FB07004C3E4B /* JSIDBSuccessEvent.cpp */; }; C585A69311D4FB08004C3E4B /* JSIDBSuccessEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = C585A67B11D4FB07004C3E4B /* JSIDBSuccessEvent.h */; }; - C585A69611D4FB13004C3E4B /* JSIndexedDatabaseRequest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C585A69411D4FB13004C3E4B /* JSIndexedDatabaseRequest.cpp */; }; - C585A69711D4FB13004C3E4B /* JSIndexedDatabaseRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = C585A69511D4FB13004C3E4B /* JSIndexedDatabaseRequest.h */; }; + C585A69611D4FB13004C3E4B /* JSIDBFactory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C585A69411D4FB13004C3E4B /* JSIDBFactory.cpp */; }; + C585A69711D4FB13004C3E4B /* JSIDBFactory.h in Headers */ = {isa = PBXBuildFile; fileRef = C585A69511D4FB13004C3E4B /* JSIDBFactory.h */; }; C585A6CC11D4FB3D004C3E4B /* IDBAny.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C585A69811D4FB3D004C3E4B /* IDBAny.cpp */; }; C585A6CD11D4FB3D004C3E4B /* IDBAny.h in Headers */ = {isa = PBXBuildFile; fileRef = C585A69911D4FB3D004C3E4B /* IDBAny.h */; }; C585A6CF11D4FB3D004C3E4B /* IDBCallbacks.h in Headers */ = {isa = PBXBuildFile; fileRef = C585A69B11D4FB3D004C3E4B /* IDBCallbacks.h */; }; @@ -4957,11 +4970,6 @@ C585A6DB11D4FB3D004C3E4B /* IDBErrorEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = C585A6A711D4FB3D004C3E4B /* IDBErrorEvent.h */; }; C585A6DD11D4FB3D004C3E4B /* IDBEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C585A6A911D4FB3D004C3E4B /* IDBEvent.cpp */; }; C585A6DE11D4FB3D004C3E4B /* IDBEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = C585A6AA11D4FB3D004C3E4B /* IDBEvent.h */; }; - C585A6E011D4FB3D004C3E4B /* IDBIndex.h in Headers */ = {isa = PBXBuildFile; fileRef = C585A6AC11D4FB3D004C3E4B /* IDBIndex.h */; }; - C585A6E111D4FB3D004C3E4B /* IDBIndexImpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C585A6AD11D4FB3D004C3E4B /* IDBIndexImpl.cpp */; }; - C585A6E211D4FB3D004C3E4B /* IDBIndexImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = C585A6AE11D4FB3D004C3E4B /* IDBIndexImpl.h */; }; - C585A6E311D4FB3D004C3E4B /* IDBIndexRequest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C585A6AF11D4FB3D004C3E4B /* IDBIndexRequest.cpp */; }; - C585A6E411D4FB3D004C3E4B /* IDBIndexRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = C585A6B011D4FB3D004C3E4B /* IDBIndexRequest.h */; }; C585A6E611D4FB3D004C3E4B /* IDBKey.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C585A6B211D4FB3D004C3E4B /* IDBKey.cpp */; }; C585A6E711D4FB3D004C3E4B /* IDBKey.h in Headers */ = {isa = PBXBuildFile; fileRef = C585A6B311D4FB3D004C3E4B /* IDBKey.h */; }; C585A6E911D4FB3D004C3E4B /* IDBKeyRange.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C585A6B511D4FB3D004C3E4B /* IDBKeyRange.cpp */; }; @@ -4976,12 +4984,12 @@ C585A6F411D4FB3D004C3E4B /* IDBRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = C585A6C011D4FB3D004C3E4B /* IDBRequest.h */; }; C585A6F611D4FB3D004C3E4B /* IDBSuccessEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C585A6C211D4FB3D004C3E4B /* IDBSuccessEvent.cpp */; }; C585A6F711D4FB3D004C3E4B /* IDBSuccessEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = C585A6C311D4FB3D004C3E4B /* IDBSuccessEvent.h */; }; - C585A6F911D4FB3D004C3E4B /* IndexedDatabase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C585A6C511D4FB3D004C3E4B /* IndexedDatabase.cpp */; }; - C585A6FA11D4FB3D004C3E4B /* IndexedDatabase.h in Headers */ = {isa = PBXBuildFile; fileRef = C585A6C611D4FB3D004C3E4B /* IndexedDatabase.h */; }; - C585A6FB11D4FB3D004C3E4B /* IndexedDatabaseImpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C585A6C711D4FB3D004C3E4B /* IndexedDatabaseImpl.cpp */; }; - C585A6FC11D4FB3D004C3E4B /* IndexedDatabaseImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = C585A6C811D4FB3D004C3E4B /* IndexedDatabaseImpl.h */; }; - C585A6FD11D4FB3D004C3E4B /* IndexedDatabaseRequest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C585A6C911D4FB3D004C3E4B /* IndexedDatabaseRequest.cpp */; }; - C585A6FE11D4FB3D004C3E4B /* IndexedDatabaseRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = C585A6CA11D4FB3D004C3E4B /* IndexedDatabaseRequest.h */; }; + C585A6F911D4FB3D004C3E4B /* IDBFactoryBackendInterface.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C585A6C511D4FB3D004C3E4B /* IDBFactoryBackendInterface.cpp */; }; + C585A6FA11D4FB3D004C3E4B /* IDBFactoryBackendInterface.h in Headers */ = {isa = PBXBuildFile; fileRef = C585A6C611D4FB3D004C3E4B /* IDBFactoryBackendInterface.h */; }; + C585A6FB11D4FB3D004C3E4B /* IDBFactoryBackendImpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C585A6C711D4FB3D004C3E4B /* IDBFactoryBackendImpl.cpp */; }; + C585A6FC11D4FB3D004C3E4B /* IDBFactoryBackendImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = C585A6C811D4FB3D004C3E4B /* IDBFactoryBackendImpl.h */; }; + C585A6FD11D4FB3D004C3E4B /* IDBFactory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C585A6C911D4FB3D004C3E4B /* IDBFactory.cpp */; }; + C585A6FE11D4FB3D004C3E4B /* IDBFactory.h in Headers */ = {isa = PBXBuildFile; fileRef = C585A6CA11D4FB3D004C3E4B /* IDBFactory.h */; }; C5D4AA7A116BAFB60069CA93 /* GlyphMetricsMap.h in Headers */ = {isa = PBXBuildFile; fileRef = C5D4AA78116BAFB60069CA93 /* GlyphMetricsMap.h */; settings = {ATTRIBUTES = (Private, ); }; }; C5E9B67710697E1300C7BB1A /* StorageEventDispatcher.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C5E9B67610697E1300C7BB1A /* StorageEventDispatcher.cpp */; }; C5EBDD84105EDDEC0056816F /* StorageEventDispatcher.h in Headers */ = {isa = PBXBuildFile; fileRef = C5EBDD81105EDDEC0056816F /* StorageEventDispatcher.h */; }; @@ -5015,6 +5023,8 @@ D23CA55D0AB0EAAE005108A5 /* JSRangeException.h in Headers */ = {isa = PBXBuildFile; fileRef = D23CA55C0AB0EAAE005108A5 /* JSRangeException.h */; }; D23CA55F0AB0EAB6005108A5 /* JSRangeException.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D23CA55E0AB0EAB6005108A5 /* JSRangeException.cpp */; }; D23CA56C0AB0EB8D005108A5 /* RangeException.h in Headers */ = {isa = PBXBuildFile; fileRef = D23CA56B0AB0EB8D005108A5 /* RangeException.h */; }; + D39D006D11F8E308006041F2 /* PopupMenuMac.h in Headers */ = {isa = PBXBuildFile; fileRef = D39D006C11F8E308006041F2 /* PopupMenuMac.h */; settings = {ATTRIBUTES = (Private, ); }; }; + D39D009D11F907E6006041F2 /* SearchPopupMenuMac.h in Headers */ = {isa = PBXBuildFile; fileRef = D39D009C11F907E6006041F2 /* SearchPopupMenuMac.h */; settings = {ATTRIBUTES = (Private, ); }; }; D8B6152F1032495100C8554A /* Cookie.h in Headers */ = {isa = PBXBuildFile; fileRef = D8B6152E1032495100C8554A /* Cookie.h */; settings = {ATTRIBUTES = (Private, ); }; }; DB23C2CB0A508D29002489EB /* IndentOutdentCommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DB23C2C90A508D29002489EB /* IndentOutdentCommand.cpp */; }; DB23C2CC0A508D29002489EB /* IndentOutdentCommand.h in Headers */ = {isa = PBXBuildFile; fileRef = DB23C2CA0A508D29002489EB /* IndentOutdentCommand.h */; }; @@ -6491,6 +6501,9 @@ 3784C34A0E11AA34007D8D48 /* FontTraitsMask.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FontTraitsMask.h; sourceTree = "<group>"; }; 37919C210B7D188600A56998 /* PositionIterator.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = PositionIterator.cpp; sourceTree = "<group>"; }; 37919C220B7D188600A56998 /* PositionIterator.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = PositionIterator.h; sourceTree = "<group>"; }; + 379919941200DDF400EA041C /* WOFFFileFormat.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WOFFFileFormat.cpp; sourceTree = "<group>"; }; + 379919951200DDF400EA041C /* WOFFFileFormat.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WOFFFileFormat.h; sourceTree = "<group>"; }; + 379919B11200DE5000EA041C /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = /usr/lib/libz.dylib; sourceTree = "<absolute>"; }; 37ACCE410DA2980F0089E602 /* FontRenderingMode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FontRenderingMode.h; sourceTree = "<group>"; }; 37ACCE620DA2AA960089E602 /* FontDescription.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FontDescription.cpp; sourceTree = "<group>"; }; 37C2360A1097EDED00EF9F72 /* FontComplexTextMac.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FontComplexTextMac.cpp; sourceTree = "<group>"; }; @@ -6864,6 +6877,7 @@ 514C766A0CE923A1007EF3CD /* ResourceResponseBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ResourceResponseBase.h; sourceTree = "<group>"; }; 5150C2A10702629000AF642C /* WebDashboardRegion.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebDashboardRegion.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; 5150C2A50702629800AF642C /* WebDashboardRegion.m */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.objc; path = WebDashboardRegion.m; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; + 515788C01207852C00A37C4A /* VisitedLinkStrategy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VisitedLinkStrategy.h; sourceTree = "<group>"; }; 515B03970CD1642A00B7EA9C /* SQLStatement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SQLStatement.h; sourceTree = "<group>"; }; 515B03980CD1642A00B7EA9C /* SQLStatement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SQLStatement.cpp; sourceTree = "<group>"; }; 5160300A0CC4251200C8AC25 /* FileSystemPOSIX.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileSystemPOSIX.cpp; sourceTree = "<group>"; }; @@ -6964,6 +6978,8 @@ 590E1B4A11E4EF700069F784 /* JSDeviceOrientationEventCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDeviceOrientationEventCustom.cpp; sourceTree = "<group>"; }; 5913953A110758450083EC55 /* JNIBridge.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JNIBridge.h; sourceTree = "<group>"; }; 5913953C1107584E0083EC55 /* JNIBridge.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JNIBridge.cpp; sourceTree = "<group>"; }; + 59309A1011F4AE5800250603 /* DeviceOrientationClientMock.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DeviceOrientationClientMock.cpp; path = mock/DeviceOrientationClientMock.cpp; sourceTree = "<group>"; }; + 59309A1211F4AE6A00250603 /* DeviceOrientationClientMock.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DeviceOrientationClientMock.h; path = mock/DeviceOrientationClientMock.h; sourceTree = "<group>"; }; 596229771133EFD700DC4CBB /* GeolocationPositionCache.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GeolocationPositionCache.cpp; sourceTree = "<group>"; }; 596229791133EFE200DC4CBB /* GeolocationPositionCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GeolocationPositionCache.h; sourceTree = "<group>"; }; 599E758F11055A1F00D904FA /* Bridge.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Bridge.h; path = bridge/Bridge.h; sourceTree = "<group>"; }; @@ -7128,6 +7144,8 @@ 750D029111D0E7F300BD1B27 /* RenderInputSpeech.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderInputSpeech.cpp; sourceTree = "<group>"; }; 750D029211D0E7F300BD1B27 /* RenderInputSpeech.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderInputSpeech.h; sourceTree = "<group>"; }; 750D02C011D0EE7D00BD1B27 /* inputSpeech.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = inputSpeech.tiff; sourceTree = "<group>"; }; + 7535BC9212020CFF0037EC45 /* SpeechInputClientMock.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SpeechInputClientMock.cpp; path = mock/SpeechInputClientMock.cpp; sourceTree = "<group>"; }; + 7535BC9312020CFF0037EC45 /* SpeechInputClientMock.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SpeechInputClientMock.h; path = mock/SpeechInputClientMock.h; sourceTree = "<group>"; }; 754133A7102E00E800075D00 /* InspectorTimelineAgent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorTimelineAgent.h; sourceTree = "<group>"; }; 754133A9102E00F400075D00 /* InspectorTimelineAgent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorTimelineAgent.cpp; sourceTree = "<group>"; }; 7553CFE6108F473F00EA281E /* TimelineRecordFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TimelineRecordFactory.h; sourceTree = "<group>"; }; @@ -8056,6 +8074,36 @@ 895253DA116C4EF500CABF00 /* FileStreamProxy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileStreamProxy.cpp; sourceTree = "<group>"; }; 895253DB116C4EF500CABF00 /* FileStreamProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileStreamProxy.h; sourceTree = "<group>"; }; 895253DE116C4F0600CABF00 /* FileThreadTask.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileThreadTask.h; sourceTree = "<group>"; }; + 897A2D1911FF58A50082740C /* DOMFileSystem.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DOMFileSystem.cpp; sourceTree = "<group>"; }; + 897A2D1A11FF58A50082740C /* DOMFileSystem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMFileSystem.h; sourceTree = "<group>"; }; + 897A2D1B11FF58A50082740C /* DOMFileSystem.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = DOMFileSystem.idl; sourceTree = "<group>"; }; + 897A2D1C11FF58A50082740C /* Entry.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Entry.cpp; sourceTree = "<group>"; }; + 897A2D1D11FF58A50082740C /* Entry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Entry.h; sourceTree = "<group>"; }; + 897A2D1E11FF58A50082740C /* EntryCallback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EntryCallback.h; sourceTree = "<group>"; }; + 897A2D1F11FF58A50082740C /* EntryCallback.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = EntryCallback.idl; sourceTree = "<group>"; }; + 897A2D2011FF58A50082740C /* ErrorCallback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ErrorCallback.h; sourceTree = "<group>"; }; + 897A2D2111FF58A50082740C /* FileSystemCallback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileSystemCallback.h; sourceTree = "<group>"; }; + 897A2D3B11FF63860082740C /* Entry.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Entry.idl; sourceTree = "<group>"; }; + 897A2D4911FF6C900082740C /* JSEntry.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSEntry.cpp; sourceTree = "<group>"; }; + 897A2D4A11FF6C900082740C /* JSEntry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSEntry.h; sourceTree = "<group>"; }; + 897A2D4B11FF6C900082740C /* JSEntryCallback.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSEntryCallback.cpp; sourceTree = "<group>"; }; + 897A2D4C11FF6C900082740C /* JSEntryCallback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSEntryCallback.h; sourceTree = "<group>"; }; + 897A2D4D11FF6C900082740C /* JSErrorCallback.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSErrorCallback.cpp; sourceTree = "<group>"; }; + 897A2D4E11FF6C900082740C /* JSErrorCallback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSErrorCallback.h; sourceTree = "<group>"; }; + 897A2D5511FF6CA40082740C /* JSFileSystemCallback.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSFileSystemCallback.cpp; sourceTree = "<group>"; }; + 897A2D5611FF6CA40082740C /* JSFileSystemCallback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSFileSystemCallback.h; sourceTree = "<group>"; }; + 897A2D5D120000FF0082740C /* ErrorCallback.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ErrorCallback.idl; sourceTree = "<group>"; }; + 897A2D5F120001220082740C /* FileSystemCallback.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = FileSystemCallback.idl; sourceTree = "<group>"; }; + 897A2D60120001220082740C /* Flags.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Flags.h; sourceTree = "<group>"; }; + 897A2D61120001220082740C /* Flags.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Flags.idl; sourceTree = "<group>"; }; + 897A2D73120001440082740C /* Metadata.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Metadata.h; sourceTree = "<group>"; }; + 897A2D74120001440082740C /* Metadata.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Metadata.idl; sourceTree = "<group>"; }; + 897A2D75120001440082740C /* MetadataCallback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MetadataCallback.h; sourceTree = "<group>"; }; + 897A2D76120001440082740C /* MetadataCallback.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = MetadataCallback.idl; sourceTree = "<group>"; }; + 897A2D8D1200035F0082740C /* JSDOMFileSystem.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDOMFileSystem.cpp; sourceTree = "<group>"; }; + 897A2D8E1200035F0082740C /* JSDOMFileSystem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSDOMFileSystem.h; sourceTree = "<group>"; }; + 897A2D91120003760082740C /* JSFlags.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSFlags.cpp; sourceTree = "<group>"; }; + 897A2D92120003760082740C /* JSFlags.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSFlags.h; sourceTree = "<group>"; }; 8988E10C11A3508B00DB732E /* BlobItem.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BlobItem.cpp; sourceTree = "<group>"; }; 8988E10D11A3508B00DB732E /* BlobItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BlobItem.h; sourceTree = "<group>"; }; 89B5EA9F11E8003D00F2367E /* LineEnding.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LineEnding.cpp; sourceTree = "<group>"; }; @@ -10574,6 +10622,14 @@ C55610F011A704EB00B82D27 /* DOMStringList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DOMStringList.cpp; sourceTree = "<group>"; }; C55E38BB10040D5D00A56BDB /* StorageNamespaceImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StorageNamespaceImpl.h; sourceTree = "<group>"; }; C55E38BC10040D5D00A56BDB /* StorageNamespaceImpl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StorageNamespaceImpl.cpp; sourceTree = "<group>"; }; + C572EE041201C736007D8F82 /* IDBIndex.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IDBIndex.cpp; sourceTree = "<group>"; }; + C572EE051201C736007D8F82 /* IDBIndex.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDBIndex.h; sourceTree = "<group>"; }; + C572EE061201C736007D8F82 /* IDBIndex.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = IDBIndex.idl; sourceTree = "<group>"; }; + C572EE071201C736007D8F82 /* IDBIndexBackendImpl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IDBIndexBackendImpl.cpp; sourceTree = "<group>"; }; + C572EE081201C736007D8F82 /* IDBIndexBackendImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDBIndexBackendImpl.h; sourceTree = "<group>"; }; + C572EE091201C736007D8F82 /* IDBIndexBackendInterface.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDBIndexBackendInterface.h; sourceTree = "<group>"; }; + C572EE1C1201C9BC007D8F82 /* JSIDBIndex.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSIDBIndex.cpp; sourceTree = "<group>"; }; + C572EE1D1201C9BC007D8F82 /* JSIDBIndex.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSIDBIndex.h; sourceTree = "<group>"; }; C585A65C11D4FAB2004C3E4B /* JSIDBAnyCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSIDBAnyCustom.cpp; sourceTree = "<group>"; }; C585A65D11D4FAB2004C3E4B /* JSIDBKeyCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSIDBKeyCustom.cpp; sourceTree = "<group>"; }; C585A66011D4FAC5004C3E4B /* IDBBindingUtilities.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IDBBindingUtilities.cpp; sourceTree = "<group>"; }; @@ -10590,8 +10646,6 @@ C585A66D11D4FB07004C3E4B /* JSIDBErrorEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSIDBErrorEvent.h; sourceTree = "<group>"; }; C585A66E11D4FB07004C3E4B /* JSIDBEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSIDBEvent.cpp; sourceTree = "<group>"; }; C585A66F11D4FB07004C3E4B /* JSIDBEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSIDBEvent.h; sourceTree = "<group>"; }; - C585A67011D4FB07004C3E4B /* JSIDBIndexRequest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSIDBIndexRequest.cpp; sourceTree = "<group>"; }; - C585A67111D4FB07004C3E4B /* JSIDBIndexRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSIDBIndexRequest.h; sourceTree = "<group>"; }; C585A67211D4FB07004C3E4B /* JSIDBKey.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSIDBKey.cpp; sourceTree = "<group>"; }; C585A67311D4FB07004C3E4B /* JSIDBKey.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSIDBKey.h; sourceTree = "<group>"; }; C585A67411D4FB07004C3E4B /* JSIDBKeyRange.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSIDBKeyRange.cpp; sourceTree = "<group>"; }; @@ -10602,8 +10656,8 @@ C585A67911D4FB07004C3E4B /* JSIDBRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSIDBRequest.h; sourceTree = "<group>"; }; C585A67A11D4FB07004C3E4B /* JSIDBSuccessEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSIDBSuccessEvent.cpp; sourceTree = "<group>"; }; C585A67B11D4FB07004C3E4B /* JSIDBSuccessEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSIDBSuccessEvent.h; sourceTree = "<group>"; }; - C585A69411D4FB13004C3E4B /* JSIndexedDatabaseRequest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSIndexedDatabaseRequest.cpp; sourceTree = "<group>"; }; - C585A69511D4FB13004C3E4B /* JSIndexedDatabaseRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSIndexedDatabaseRequest.h; sourceTree = "<group>"; }; + C585A69411D4FB13004C3E4B /* JSIDBFactory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSIDBFactory.cpp; sourceTree = "<group>"; }; + C585A69511D4FB13004C3E4B /* JSIDBFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSIDBFactory.h; sourceTree = "<group>"; }; C585A69811D4FB3D004C3E4B /* IDBAny.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IDBAny.cpp; sourceTree = "<group>"; }; C585A69911D4FB3D004C3E4B /* IDBAny.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDBAny.h; sourceTree = "<group>"; }; C585A69A11D4FB3D004C3E4B /* IDBAny.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = IDBAny.idl; sourceTree = "<group>"; }; @@ -10624,12 +10678,6 @@ C585A6A911D4FB3D004C3E4B /* IDBEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IDBEvent.cpp; sourceTree = "<group>"; }; C585A6AA11D4FB3D004C3E4B /* IDBEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDBEvent.h; sourceTree = "<group>"; }; C585A6AB11D4FB3D004C3E4B /* IDBEvent.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = IDBEvent.idl; sourceTree = "<group>"; }; - C585A6AC11D4FB3D004C3E4B /* IDBIndex.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDBIndex.h; sourceTree = "<group>"; }; - C585A6AD11D4FB3D004C3E4B /* IDBIndexImpl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IDBIndexImpl.cpp; sourceTree = "<group>"; }; - C585A6AE11D4FB3D004C3E4B /* IDBIndexImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDBIndexImpl.h; sourceTree = "<group>"; }; - C585A6AF11D4FB3D004C3E4B /* IDBIndexRequest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IDBIndexRequest.cpp; sourceTree = "<group>"; }; - C585A6B011D4FB3D004C3E4B /* IDBIndexRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDBIndexRequest.h; sourceTree = "<group>"; }; - C585A6B111D4FB3D004C3E4B /* IDBIndexRequest.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = IDBIndexRequest.idl; sourceTree = "<group>"; }; C585A6B211D4FB3D004C3E4B /* IDBKey.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IDBKey.cpp; sourceTree = "<group>"; }; C585A6B311D4FB3D004C3E4B /* IDBKey.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDBKey.h; sourceTree = "<group>"; }; C585A6B411D4FB3D004C3E4B /* IDBKey.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = IDBKey.idl; sourceTree = "<group>"; }; @@ -10649,13 +10697,13 @@ C585A6C211D4FB3D004C3E4B /* IDBSuccessEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IDBSuccessEvent.cpp; sourceTree = "<group>"; }; C585A6C311D4FB3D004C3E4B /* IDBSuccessEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDBSuccessEvent.h; sourceTree = "<group>"; }; C585A6C411D4FB3D004C3E4B /* IDBSuccessEvent.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = IDBSuccessEvent.idl; sourceTree = "<group>"; }; - C585A6C511D4FB3D004C3E4B /* IndexedDatabase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IndexedDatabase.cpp; sourceTree = "<group>"; }; - C585A6C611D4FB3D004C3E4B /* IndexedDatabase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IndexedDatabase.h; sourceTree = "<group>"; }; - C585A6C711D4FB3D004C3E4B /* IndexedDatabaseImpl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IndexedDatabaseImpl.cpp; sourceTree = "<group>"; }; - C585A6C811D4FB3D004C3E4B /* IndexedDatabaseImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IndexedDatabaseImpl.h; sourceTree = "<group>"; }; - C585A6C911D4FB3D004C3E4B /* IndexedDatabaseRequest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IndexedDatabaseRequest.cpp; sourceTree = "<group>"; }; - C585A6CA11D4FB3D004C3E4B /* IndexedDatabaseRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IndexedDatabaseRequest.h; sourceTree = "<group>"; }; - C585A6CB11D4FB3D004C3E4B /* IndexedDatabaseRequest.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = IndexedDatabaseRequest.idl; sourceTree = "<group>"; }; + C585A6C511D4FB3D004C3E4B /* IDBFactoryBackendInterface.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IDBFactoryBackendInterface.cpp; sourceTree = "<group>"; }; + C585A6C611D4FB3D004C3E4B /* IDBFactoryBackendInterface.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDBFactoryBackendInterface.h; sourceTree = "<group>"; }; + C585A6C711D4FB3D004C3E4B /* IDBFactoryBackendImpl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IDBFactoryBackendImpl.cpp; sourceTree = "<group>"; }; + C585A6C811D4FB3D004C3E4B /* IDBFactoryBackendImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDBFactoryBackendImpl.h; sourceTree = "<group>"; }; + C585A6C911D4FB3D004C3E4B /* IDBFactory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IDBFactory.cpp; sourceTree = "<group>"; }; + C585A6CA11D4FB3D004C3E4B /* IDBFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDBFactory.h; sourceTree = "<group>"; }; + C585A6CB11D4FB3D004C3E4B /* IDBFactory.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = IDBFactory.idl; sourceTree = "<group>"; }; C5D4AA78116BAFB60069CA93 /* GlyphMetricsMap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GlyphMetricsMap.h; sourceTree = "<group>"; }; C5E9B67610697E1300C7BB1A /* StorageEventDispatcher.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StorageEventDispatcher.cpp; sourceTree = "<group>"; }; C5EBDD81105EDDEC0056816F /* StorageEventDispatcher.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StorageEventDispatcher.h; sourceTree = "<group>"; }; @@ -10690,6 +10738,8 @@ D23CA55C0AB0EAAE005108A5 /* JSRangeException.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSRangeException.h; sourceTree = "<group>"; }; D23CA55E0AB0EAB6005108A5 /* JSRangeException.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSRangeException.cpp; sourceTree = "<group>"; }; D23CA56B0AB0EB8D005108A5 /* RangeException.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = RangeException.h; sourceTree = "<group>"; }; + D39D006C11F8E308006041F2 /* PopupMenuMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PopupMenuMac.h; sourceTree = "<group>"; }; + D39D009C11F907E6006041F2 /* SearchPopupMenuMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SearchPopupMenuMac.h; sourceTree = "<group>"; }; D8B6152E1032495100C8554A /* Cookie.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Cookie.h; sourceTree = "<group>"; }; DB23C2C90A508D29002489EB /* IndentOutdentCommand.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = IndentOutdentCommand.cpp; sourceTree = "<group>"; }; DB23C2CA0A508D29002489EB /* IndentOutdentCommand.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = IndentOutdentCommand.h; sourceTree = "<group>"; }; @@ -10996,6 +11046,7 @@ 93F19B1708245E59001E9ABC /* libicucore.dylib in Frameworks */, 1CFAE3230A6D6A3F0032593D /* libobjc.dylib in Frameworks */, DD763BB20992C2C900740B8E /* libxml2.dylib in Frameworks */, + 379919B21200DE5000EA041C /* libz.dylib in Frameworks */, 49C7BA791042EFAE0009D447 /* OpenGL.framework in Frameworks */, A88AD52F09524B92001DD196 /* QuartzCore.framework in Frameworks */, 1A7FA7CC0DDA4B770028F8A5 /* SystemConfiguration.framework in Frameworks */, @@ -11065,6 +11116,7 @@ 93F1D31A0558CC5C00821BC0 /* libicucore.dylib */, 1CFAE3220A6D6A3F0032593D /* libobjc.dylib */, DD763BB10992C2C900740B8E /* libxml2.dylib */, + 379919B11200DE5000EA041C /* libz.dylib */, 49C7BA781042EFAE0009D447 /* OpenGL.framework */, A85D7A2F0879EBA9006A9172 /* QuartzCore.framework */, 1A7FA7CB0DDA4B770028F8A5 /* SystemConfiguration.framework */, @@ -11315,6 +11367,20 @@ 1AD51A130CB59CD300953D11 /* DatabaseTracker.cpp */, 1AD51A120CB59CD300953D11 /* DatabaseTracker.h */, 51FAFE330CECBF2D00BB3F24 /* DatabaseTrackerClient.h */, + 897A2D1911FF58A50082740C /* DOMFileSystem.cpp */, + 897A2D1A11FF58A50082740C /* DOMFileSystem.h */, + 897A2D1B11FF58A50082740C /* DOMFileSystem.idl */, + 897A2D1C11FF58A50082740C /* Entry.cpp */, + 897A2D1D11FF58A50082740C /* Entry.h */, + 897A2D3B11FF63860082740C /* Entry.idl */, + 897A2D1E11FF58A50082740C /* EntryCallback.h */, + 897A2D1F11FF58A50082740C /* EntryCallback.idl */, + 897A2D2011FF58A50082740C /* ErrorCallback.h */, + 897A2D5D120000FF0082740C /* ErrorCallback.idl */, + 897A2D2111FF58A50082740C /* FileSystemCallback.h */, + 897A2D5F120001220082740C /* FileSystemCallback.idl */, + 897A2D60120001220082740C /* Flags.h */, + 897A2D61120001220082740C /* Flags.idl */, C585A69811D4FB3D004C3E4B /* IDBAny.cpp */, C585A69911D4FB3D004C3E4B /* IDBAny.h */, C585A69A11D4FB3D004C3E4B /* IDBAny.idl */, @@ -11335,12 +11401,19 @@ C585A6A911D4FB3D004C3E4B /* IDBEvent.cpp */, C585A6AA11D4FB3D004C3E4B /* IDBEvent.h */, C585A6AB11D4FB3D004C3E4B /* IDBEvent.idl */, - C585A6AC11D4FB3D004C3E4B /* IDBIndex.h */, - C585A6AD11D4FB3D004C3E4B /* IDBIndexImpl.cpp */, - C585A6AE11D4FB3D004C3E4B /* IDBIndexImpl.h */, - C585A6AF11D4FB3D004C3E4B /* IDBIndexRequest.cpp */, - C585A6B011D4FB3D004C3E4B /* IDBIndexRequest.h */, - C585A6B111D4FB3D004C3E4B /* IDBIndexRequest.idl */, + C585A6C911D4FB3D004C3E4B /* IDBFactory.cpp */, + C585A6CA11D4FB3D004C3E4B /* IDBFactory.h */, + C585A6CB11D4FB3D004C3E4B /* IDBFactory.idl */, + C585A6C711D4FB3D004C3E4B /* IDBFactoryBackendImpl.cpp */, + C585A6C811D4FB3D004C3E4B /* IDBFactoryBackendImpl.h */, + C585A6C511D4FB3D004C3E4B /* IDBFactoryBackendInterface.cpp */, + C585A6C611D4FB3D004C3E4B /* IDBFactoryBackendInterface.h */, + C572EE041201C736007D8F82 /* IDBIndex.cpp */, + C572EE051201C736007D8F82 /* IDBIndex.h */, + C572EE061201C736007D8F82 /* IDBIndex.idl */, + C572EE071201C736007D8F82 /* IDBIndexBackendImpl.cpp */, + C572EE081201C736007D8F82 /* IDBIndexBackendImpl.h */, + C572EE091201C736007D8F82 /* IDBIndexBackendInterface.h */, C585A6B211D4FB3D004C3E4B /* IDBKey.cpp */, C585A6B311D4FB3D004C3E4B /* IDBKey.h */, C585A6B411D4FB3D004C3E4B /* IDBKey.idl */, @@ -11360,17 +11433,14 @@ C585A6C211D4FB3D004C3E4B /* IDBSuccessEvent.cpp */, C585A6C311D4FB3D004C3E4B /* IDBSuccessEvent.h */, C585A6C411D4FB3D004C3E4B /* IDBSuccessEvent.idl */, - C585A6C511D4FB3D004C3E4B /* IndexedDatabase.cpp */, - C585A6C611D4FB3D004C3E4B /* IndexedDatabase.h */, - C585A6C711D4FB3D004C3E4B /* IndexedDatabaseImpl.cpp */, - C585A6C811D4FB3D004C3E4B /* IndexedDatabaseImpl.h */, - C585A6C911D4FB3D004C3E4B /* IndexedDatabaseRequest.cpp */, - C585A6CA11D4FB3D004C3E4B /* IndexedDatabaseRequest.h */, - C585A6CB11D4FB3D004C3E4B /* IndexedDatabaseRequest.idl */, 511F23130DC160DA004F0032 /* LocalStorageTask.cpp */, 511F23140DC160DA004F0032 /* LocalStorageTask.h */, 511F23150DC160DA004F0032 /* LocalStorageThread.cpp */, 511F23160DC160DA004F0032 /* LocalStorageThread.h */, + 897A2D73120001440082740C /* Metadata.h */, + 897A2D74120001440082740C /* Metadata.idl */, + 897A2D75120001440082740C /* MetadataCallback.h */, + 897A2D76120001440082740C /* MetadataCallback.idl */, 51A926780D53F0570063ECC2 /* OriginQuotaManager.cpp */, 51A926790D53F0570063ECC2 /* OriginQuotaManager.h */, 51A9267A0D53F0570063ECC2 /* OriginUsageRecord.cpp */, @@ -12044,6 +12114,10 @@ 59C77F101054591C00506104 /* mock */ = { isa = PBXGroup; children = ( + 59309A1011F4AE5800250603 /* DeviceOrientationClientMock.cpp */, + 59309A1211F4AE6A00250603 /* DeviceOrientationClientMock.h */, + 7535BC9212020CFF0037EC45 /* SpeechInputClientMock.cpp */, + 7535BC9312020CFF0037EC45 /* SpeechInputClientMock.h */, ); name = mock; sourceTree = "<group>"; @@ -12236,10 +12310,12 @@ 4B2709810AF2E5E00065127F /* PasteboardMac.mm */, 935C476F09AC4D7300A6AAB4 /* PlatformMouseEventMac.mm */, BC94D1070C274F88006BC617 /* PlatformScreenMac.mm */, + D39D006C11F8E308006041F2 /* PopupMenuMac.h */, 0668E18E0ADD9640004128E0 /* PopupMenuMac.mm */, E4D687760ED7AE3D006EA978 /* PurgeableBufferMac.cpp */, 447D69010FA626810015CCB1 /* RuntimeApplicationChecks.h */, 447D69020FA626810015CCB1 /* RuntimeApplicationChecks.mm */, + D39D009C11F907E6006041F2 /* SearchPopupMenuMac.h */, 1CE24F960D7CAF0E007E04C2 /* SchedulePairMac.mm */, BCAA90C20A7EBA60008B1229 /* Scrollbar.cpp */, BC8B853C0E7C7F1100AB6984 /* ScrollbarThemeMac.h */, @@ -14757,6 +14833,18 @@ B59DD697119029E5007E9684 /* JSDatabaseCallback.h */, B58CEB6811913607002A6790 /* JSDatabaseSync.cpp */, B58CEB6711913607002A6790 /* JSDatabaseSync.h */, + 897A2D8D1200035F0082740C /* JSDOMFileSystem.cpp */, + 897A2D8E1200035F0082740C /* JSDOMFileSystem.h */, + 897A2D4911FF6C900082740C /* JSEntry.cpp */, + 897A2D4A11FF6C900082740C /* JSEntry.h */, + 897A2D4B11FF6C900082740C /* JSEntryCallback.cpp */, + 897A2D4C11FF6C900082740C /* JSEntryCallback.h */, + 897A2D4D11FF6C900082740C /* JSErrorCallback.cpp */, + 897A2D4E11FF6C900082740C /* JSErrorCallback.h */, + 897A2D5511FF6CA40082740C /* JSFileSystemCallback.cpp */, + 897A2D5611FF6CA40082740C /* JSFileSystemCallback.h */, + 897A2D91120003760082740C /* JSFlags.cpp */, + 897A2D92120003760082740C /* JSFlags.h */, C585A66411D4FB07004C3E4B /* JSIDBAny.cpp */, C585A66511D4FB07004C3E4B /* JSIDBAny.h */, C585A66611D4FB07004C3E4B /* JSIDBDatabaseError.cpp */, @@ -14769,8 +14857,10 @@ C585A66D11D4FB07004C3E4B /* JSIDBErrorEvent.h */, C585A66E11D4FB07004C3E4B /* JSIDBEvent.cpp */, C585A66F11D4FB07004C3E4B /* JSIDBEvent.h */, - C585A67011D4FB07004C3E4B /* JSIDBIndexRequest.cpp */, - C585A67111D4FB07004C3E4B /* JSIDBIndexRequest.h */, + C585A69411D4FB13004C3E4B /* JSIDBFactory.cpp */, + C585A69511D4FB13004C3E4B /* JSIDBFactory.h */, + C572EE1C1201C9BC007D8F82 /* JSIDBIndex.cpp */, + C572EE1D1201C9BC007D8F82 /* JSIDBIndex.h */, C585A67211D4FB07004C3E4B /* JSIDBKey.cpp */, C585A67311D4FB07004C3E4B /* JSIDBKey.h */, C585A67411D4FB07004C3E4B /* JSIDBKeyRange.cpp */, @@ -14781,8 +14871,6 @@ C585A67911D4FB07004C3E4B /* JSIDBRequest.h */, C585A67A11D4FB07004C3E4B /* JSIDBSuccessEvent.cpp */, C585A67B11D4FB07004C3E4B /* JSIDBSuccessEvent.h */, - C585A69411D4FB13004C3E4B /* JSIndexedDatabaseRequest.cpp */, - C585A69511D4FB13004C3E4B /* JSIndexedDatabaseRequest.h */, 514C76350CE9225E007EF3CD /* JSSQLError.cpp */, BC8243250D0CE8A200460C8F /* JSSQLError.h */, B525A96411CA2340003A23A8 /* JSSQLException.cpp */, @@ -15517,6 +15605,8 @@ E4AFCFA40DAF29A300F5F55C /* UnitBezier.h */, 939B02EC0EA2DBC400C54570 /* WidthIterator.cpp */, 939B02ED0EA2DBC400C54570 /* WidthIterator.h */, + 379919941200DDF400EA041C /* WOFFFileFormat.cpp */, + 379919951200DDF400EA041C /* WOFFFileFormat.h */, ); path = graphics; sourceTree = "<group>"; @@ -16291,6 +16381,7 @@ 1419D2C40CEA6F6100FF507A /* TreeShared.h */, 2E3BBF051162DA1100B9409A /* UUID.cpp */, 2E3BBF061162DA1100B9409A /* UUID.h */, + 515788C01207852C00A37C4A /* VisitedLinkStrategy.h */, 9380F47109A11AB4001FDB34 /* Widget.cpp */, 9380F47209A11AB4001FDB34 /* Widget.h */, E1E1BEFF115FF6FB006F52CA /* WindowsKeyboardCodes.h */, @@ -17471,6 +17562,7 @@ 93F1996D08245E59001E9ABC /* DeprecatedPtrListImpl.h in Headers */, 590E1B4911E4EF4B0069F784 /* DeviceOrientation.h in Headers */, 59A8F1D811A69520001AC34A /* DeviceOrientationClient.h in Headers */, + 59309A1311F4AE6A00250603 /* DeviceOrientationClientMock.h in Headers */, 59A8F1D611A69513001AC34A /* DeviceOrientationController.h in Headers */, 59A85EA4119D68EC00DEF1EF /* DeviceOrientationEvent.h in Headers */, B2F34FE60E82F81400F627CD /* DNS.h in Headers */, @@ -18488,9 +18580,12 @@ C585A6D811D4FB3D004C3E4B /* IDBDatabaseRequest.h in Headers */, C585A6DB11D4FB3D004C3E4B /* IDBErrorEvent.h in Headers */, C585A6DE11D4FB3D004C3E4B /* IDBEvent.h in Headers */, - C585A6E011D4FB3D004C3E4B /* IDBIndex.h in Headers */, - C585A6E211D4FB3D004C3E4B /* IDBIndexImpl.h in Headers */, - C585A6E411D4FB3D004C3E4B /* IDBIndexRequest.h in Headers */, + C585A6FE11D4FB3D004C3E4B /* IDBFactory.h in Headers */, + C585A6FC11D4FB3D004C3E4B /* IDBFactoryBackendImpl.h in Headers */, + C585A6FA11D4FB3D004C3E4B /* IDBFactoryBackendInterface.h in Headers */, + C572EE0B1201C736007D8F82 /* IDBIndex.h in Headers */, + C572EE0E1201C736007D8F82 /* IDBIndexBackendImpl.h in Headers */, + C572EE0F1201C736007D8F82 /* IDBIndexBackendInterface.h in Headers */, C585A6E711D4FB3D004C3E4B /* IDBKey.h in Headers */, C585A6EA11D4FB3D004C3E4B /* IDBKeyRange.h in Headers */, C585A6EC11D4FB3D004C3E4B /* IDBKeyTree.h in Headers */, @@ -18514,9 +18609,6 @@ 4B3480940EEF50D400AC1B41 /* ImageSourceCG.h in Headers */, 316FE1180E6E1DA700BF6088 /* ImplicitAnimation.h in Headers */, DB23C2CC0A508D29002489EB /* IndentOutdentCommand.h in Headers */, - C585A6FA11D4FB3D004C3E4B /* IndexedDatabase.h in Headers */, - C585A6FC11D4FB3D004C3E4B /* IndexedDatabaseImpl.h in Headers */, - C585A6FE11D4FB3D004C3E4B /* IndexedDatabaseRequest.h in Headers */, F3644B001119805900E0D537 /* InjectedScript.h in Headers */, 7A0E76FA10BF08ED00A0276E /* InjectedScriptHost.h in Headers */, A8CFF5E50A155A05000A4234 /* InlineBox.h in Headers */, @@ -18741,7 +18833,8 @@ C585A68311D4FB08004C3E4B /* JSIDBDatabaseRequest.h in Headers */, C585A68511D4FB08004C3E4B /* JSIDBErrorEvent.h in Headers */, C585A68711D4FB08004C3E4B /* JSIDBEvent.h in Headers */, - C585A68911D4FB08004C3E4B /* JSIDBIndexRequest.h in Headers */, + C585A69711D4FB13004C3E4B /* JSIDBFactory.h in Headers */, + C572EE1F1201C9BC007D8F82 /* JSIDBIndex.h in Headers */, C585A68B11D4FB08004C3E4B /* JSIDBKey.h in Headers */, C585A68D11D4FB08004C3E4B /* JSIDBKeyRange.h in Headers */, C585A68F11D4FB08004C3E4B /* JSIDBObjectStoreRequest.h in Headers */, @@ -18749,7 +18842,6 @@ C585A69311D4FB08004C3E4B /* JSIDBSuccessEvent.h in Headers */, BC6C49F40D7DBA0500FFA558 /* JSImageConstructor.h in Headers */, A77979290D6B9E64003851B9 /* JSImageData.h in Headers */, - C585A69711D4FB13004C3E4B /* JSIndexedDatabaseRequest.h in Headers */, 7A0E76DB10BF059800A0276E /* JSInjectedScriptHost.h in Headers */, 7A0E771F10C00DB100A0276E /* JSInspectorFrontendHost.h in Headers */, 49EECF07105070C400099FAB /* JSInt16Array.h in Headers */, @@ -19392,6 +19484,7 @@ 626CDE0F1140424C001E5A68 /* SpatialNavigation.h in Headers */, 7578F90C11DDF26900D933C5 /* SpeechInput.h in Headers */, 7578F90D11DDF26900D933C5 /* SpeechInputClient.h in Headers */, + 7535BC9512020CFF0037EC45 /* SpeechInputClientMock.h in Headers */, 7578F92011E4E32800D933C5 /* SpeechInputListener.h in Headers */, 93309E12099E64920056E581 /* SplitElementCommand.h in Headers */, 93309E14099E64920056E581 /* SplitTextNodeCommand.h in Headers */, @@ -19611,6 +19704,9 @@ BC22747B0E8366E200E7F975 /* SVGRenderStyleDefs.h in Headers */, A8F4FB940C169E7B002AFED5 /* SVGRenderSupport.h in Headers */, B2EBDC9D0AF77E3400AE4A68 /* SVGRenderTreeAsText.h in Headers */, + 084D0E3D11F5816100081E1A /* SVGResources.h in Headers */, + 084D0E3F11F5816100081E1A /* SVGResourcesCache.h in Headers */, + 085B05C311FAE16C004D65F6 /* SVGResourcesCycleSolver.h in Headers */, 853CA9E90AEEC608002372DC /* SVGRootInlineBox.h in Headers */, B2227AA30D00BF220071B782 /* SVGScriptElement.h in Headers */, B2227AA60D00BF220071B782 /* SVGSetElement.h in Headers */, @@ -19816,6 +19912,7 @@ 080FAE1B0EEEBDA800AACDE9 /* WMLTemplateElement.h in Headers */, 081D81320EE0E74D00D73689 /* WMLTimerElement.h in Headers */, 084DBAA20ED39D360038C226 /* WMLVariables.h in Headers */, + 379919971200DDF400EA041C /* WOFFFileFormat.h in Headers */, 2E4346460F546A8200B0F1BA /* Worker.h in Headers */, 2E4346490F546A8200B0F1BA /* WorkerContext.h in Headers */, 2E43464B0F546A8200B0F1BA /* WorkerContextProxy.h in Headers */, @@ -19868,9 +19965,9 @@ E1BE512E0CF6C512002EA959 /* XSLTUnicodeSort.h in Headers */, 97DD4D870FDF4D6E00ECF9A4 /* XSSAuditor.h in Headers */, CE172E011136E8CE0062A533 /* ZoomMode.h in Headers */, - 084D0E3D11F5816100081E1A /* SVGResources.h in Headers */, - 084D0E3F11F5816100081E1A /* SVGResourcesCache.h in Headers */, - 085B05C311FAE16C004D65F6 /* SVGResourcesCycleSolver.h in Headers */, + 515788C11207852C00A37C4A /* VisitedLinkStrategy.h in Headers */, + D39D006D11F8E308006041F2 /* PopupMenuMac.h in Headers */, + D39D009D11F907E6006041F2 /* SearchPopupMenuMac.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -20378,6 +20475,7 @@ 93309DE0099E64920056E581 /* DeleteSelectionCommand.cpp in Sources */, 93F19A3C08245E59001E9ABC /* DeprecatedPtrListImpl.cpp in Sources */, 59D1C10411EB5DCF00B638C8 /* DeviceOrientation.cpp in Sources */, + 59309A1111F4AE5800250603 /* DeviceOrientationClientMock.cpp in Sources */, 59A8F1D411A69508001AC34A /* DeviceOrientationController.cpp in Sources */, 59A85EA2119D68D900DEF1EF /* DeviceOrientationEvent.cpp in Sources */, B2F34FE90E82F82700F627CD /* DNSCFNet.cpp in Sources */, @@ -20911,8 +21009,11 @@ C585A6D711D4FB3D004C3E4B /* IDBDatabaseRequest.cpp in Sources */, C585A6DA11D4FB3D004C3E4B /* IDBErrorEvent.cpp in Sources */, C585A6DD11D4FB3D004C3E4B /* IDBEvent.cpp in Sources */, - C585A6E111D4FB3D004C3E4B /* IDBIndexImpl.cpp in Sources */, - C585A6E311D4FB3D004C3E4B /* IDBIndexRequest.cpp in Sources */, + C585A6FD11D4FB3D004C3E4B /* IDBFactory.cpp in Sources */, + C585A6FB11D4FB3D004C3E4B /* IDBFactoryBackendImpl.cpp in Sources */, + C585A6F911D4FB3D004C3E4B /* IDBFactoryBackendInterface.cpp in Sources */, + C572EE0A1201C736007D8F82 /* IDBIndex.cpp in Sources */, + C572EE0D1201C736007D8F82 /* IDBIndexBackendImpl.cpp in Sources */, C585A6E611D4FB3D004C3E4B /* IDBKey.cpp in Sources */, C585A6E911D4FB3D004C3E4B /* IDBKeyRange.cpp in Sources */, C585A6EE11D4FB3D004C3E4B /* IDBObjectStoreImpl.cpp in Sources */, @@ -20932,9 +21033,6 @@ 4B3480930EEF50D400AC1B41 /* ImageSourceCGMac.mm in Sources */, 316FE1170E6E1DA700BF6088 /* ImplicitAnimation.cpp in Sources */, DB23C2CB0A508D29002489EB /* IndentOutdentCommand.cpp in Sources */, - C585A6F911D4FB3D004C3E4B /* IndexedDatabase.cpp in Sources */, - C585A6FB11D4FB3D004C3E4B /* IndexedDatabaseImpl.cpp in Sources */, - C585A6FD11D4FB3D004C3E4B /* IndexedDatabaseRequest.cpp in Sources */, F3644AFF1119805900E0D537 /* InjectedScript.cpp in Sources */, 7A0E76F910BF08ED00A0276E /* InjectedScriptHost.cpp in Sources */, A8CFF5E60A155A05000A4234 /* InlineBox.cpp in Sources */, @@ -21204,7 +21302,8 @@ C585A68211D4FB08004C3E4B /* JSIDBDatabaseRequest.cpp in Sources */, C585A68411D4FB08004C3E4B /* JSIDBErrorEvent.cpp in Sources */, C585A68611D4FB08004C3E4B /* JSIDBEvent.cpp in Sources */, - C585A68811D4FB08004C3E4B /* JSIDBIndexRequest.cpp in Sources */, + C585A69611D4FB13004C3E4B /* JSIDBFactory.cpp in Sources */, + C572EE1E1201C9BC007D8F82 /* JSIDBIndex.cpp in Sources */, C585A68A11D4FB08004C3E4B /* JSIDBKey.cpp in Sources */, C585A65F11D4FAB2004C3E4B /* JSIDBKeyCustom.cpp in Sources */, C585A68C11D4FB08004C3E4B /* JSIDBKeyRange.cpp in Sources */, @@ -21214,7 +21313,6 @@ BC6C49F30D7DBA0500FFA558 /* JSImageConstructor.cpp in Sources */, A77979280D6B9E64003851B9 /* JSImageData.cpp in Sources */, A7D0318E0E93540300E24ACD /* JSImageDataCustom.cpp in Sources */, - C585A69611D4FB13004C3E4B /* JSIndexedDatabaseRequest.cpp in Sources */, 7A0E76DA10BF059800A0276E /* JSInjectedScriptHost.cpp in Sources */, 7A0E76D510BF050700A0276E /* JSInjectedScriptHostCustom.cpp in Sources */, 7A0E771E10C00DB100A0276E /* JSInspectorFrontendHost.cpp in Sources */, @@ -21724,6 +21822,7 @@ A8F5C0B90F9285AC0098E06B /* RenderSVGModelObject.cpp in Sources */, 08563BD0117865F50012B578 /* RenderSVGResource.cpp in Sources */, 84BDA16B11358D2A00DBF64C /* RenderSVGResourceClipper.cpp in Sources */, + 086A400611F6D6B7002CEC53 /* RenderSVGResourceContainer.cpp in Sources */, 841FDC261178C9BE00F8AC9B /* RenderSVGResourceFilter.cpp in Sources */, 08C34AF51179C057002D7456 /* RenderSVGResourceGradient.cpp in Sources */, 08C34AF71179C057002D7456 /* RenderSVGResourceLinearGradient.cpp in Sources */, @@ -21853,6 +21952,7 @@ D01A27AD10C9BFD800026A42 /* SpaceSplitString.cpp in Sources */, 626CDE0E1140424C001E5A68 /* SpatialNavigation.cpp in Sources */, 7578F90B11DDF26900D933C5 /* SpeechInput.cpp in Sources */, + 7535BC9412020CFF0037EC45 /* SpeechInputClientMock.cpp in Sources */, 93309E11099E64920056E581 /* SplitElementCommand.cpp in Sources */, 93309E13099E64920056E581 /* SplitTextNodeCommand.cpp in Sources */, 93309E15099E64920056E581 /* SplitTextNodeContainingElementCommand.cpp in Sources */, @@ -22048,6 +22148,9 @@ BC22747A0E8366E200E7F975 /* SVGRenderStyleDefs.cpp in Sources */, A8F4FB960C169E85002AFED5 /* SVGRenderSupport.cpp in Sources */, B2EBDC9C0AF77E3400AE4A68 /* SVGRenderTreeAsText.cpp in Sources */, + 084D0E3C11F5816100081E1A /* SVGResources.cpp in Sources */, + 084D0E3E11F5816100081E1A /* SVGResourcesCache.cpp in Sources */, + 085B05C211FAE16C004D65F6 /* SVGResourcesCycleSolver.cpp in Sources */, 853CA9E80AEEC608002372DC /* SVGRootInlineBox.cpp in Sources */, B2227AA20D00BF220071B782 /* SVGScriptElement.cpp in Sources */, B2227AA50D00BF220071B782 /* SVGSetElement.cpp in Sources */, @@ -22221,6 +22324,7 @@ 080FAE1A0EEEBDA800AACDE9 /* WMLTemplateElement.cpp in Sources */, 081D81310EE0E74D00D73689 /* WMLTimerElement.cpp in Sources */, 084DBAA10ED39D360038C226 /* WMLVariables.cpp in Sources */, + 379919961200DDF400EA041C /* WOFFFileFormat.cpp in Sources */, 2E4346450F546A8200B0F1BA /* Worker.cpp in Sources */, 2E4346480F546A8200B0F1BA /* WorkerContext.cpp in Sources */, 2E43464C0F546A8200B0F1BA /* WorkerLocation.cpp in Sources */, @@ -22266,10 +22370,6 @@ 93F19B0508245E59001E9ABC /* XSLTProcessorLibxslt.cpp in Sources */, E1BE512D0CF6C512002EA959 /* XSLTUnicodeSort.cpp in Sources */, 97DD4D860FDF4D6E00ECF9A4 /* XSSAuditor.cpp in Sources */, - 084D0E3C11F5816100081E1A /* SVGResources.cpp in Sources */, - 084D0E3E11F5816100081E1A /* SVGResourcesCache.cpp in Sources */, - 086A400611F6D6B7002CEC53 /* RenderSVGResourceContainer.cpp in Sources */, - 085B05C211FAE16C004D65F6 /* SVGResourcesCycleSolver.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/WebCore/accessibility/AccessibilityObject.cpp b/WebCore/accessibility/AccessibilityObject.cpp index a0959e6..b0ae86b 100644 --- a/WebCore/accessibility/AccessibilityObject.cpp +++ b/WebCore/accessibility/AccessibilityObject.cpp @@ -373,7 +373,24 @@ VisiblePositionRange AccessibilityObject::styleRangeForPosition(const VisiblePos // NOTE: Consider providing this utility method as AX API VisiblePositionRange AccessibilityObject::visiblePositionRangeForRange(const PlainTextRange& range) const { - if (range.start + range.length > text().length()) + unsigned textLength = text().length(); +#if PLATFORM(GTK) + // Gtk ATs need this for all text objects; not just text controls. + if (!textLength) { + Node* node = this->node(); + if (node) { + RenderText* renderText = toRenderText(node->renderer()); + if (renderText) + textLength = renderText->textLength(); + + // Get the text length from the elements under the + // accessibility object if not a RenderText object. + if (!textLength && allowsTextRanges()) + textLength = textUnderElement().length(); + } + } +#endif + if (range.start + range.length > textLength) return VisiblePositionRange(); VisiblePosition startPosition = visiblePositionForIndex(range.start); diff --git a/WebCore/accessibility/AccessibilityObject.h b/WebCore/accessibility/AccessibilityObject.h index b8b0875..c517855 100644 --- a/WebCore/accessibility/AccessibilityObject.h +++ b/WebCore/accessibility/AccessibilityObject.h @@ -571,6 +571,12 @@ protected: virtual void clearChildren(); virtual bool isDetached() const { return true; } +#if PLATFORM(GTK) + bool allowsTextRanges() const; +#else + bool allowsTextRanges() const { return isTextControl(); } +#endif + #if PLATFORM(MAC) RetainPtr<AccessibilityObjectWrapper> m_wrapper; #elif PLATFORM(WIN) && !OS(WINCE) diff --git a/WebCore/accessibility/AccessibilityRenderObject.cpp b/WebCore/accessibility/AccessibilityRenderObject.cpp index 5144950..a5e1cc3 100644 --- a/WebCore/accessibility/AccessibilityRenderObject.cpp +++ b/WebCore/accessibility/AccessibilityRenderObject.cpp @@ -2393,8 +2393,8 @@ VisiblePosition AccessibilityRenderObject::visiblePositionForIndex(int index) co if (isNativeTextControl()) return toRenderTextControl(m_renderer)->visiblePositionForIndex(index); - - if (!isTextControl() && !m_renderer->isText()) + + if (!allowsTextRanges() && !m_renderer->isText()) return VisiblePosition(); Node* node = m_renderer->node(); @@ -2653,7 +2653,7 @@ String AccessibilityRenderObject::doAXStringForRange(const PlainTextRange& range // on the display screen, in pixels. IntRect AccessibilityRenderObject::doAXBoundsForRange(const PlainTextRange& range) const { - if (isTextControl()) + if (allowsTextRanges()) return boundsForVisiblePositionRange(visiblePositionRangeForRange(range)); return IntRect(); } diff --git a/WebCore/accessibility/gtk/AccessibilityObjectAtk.cpp b/WebCore/accessibility/gtk/AccessibilityObjectAtk.cpp index e32340a..d00574b 100644 --- a/WebCore/accessibility/gtk/AccessibilityObjectAtk.cpp +++ b/WebCore/accessibility/gtk/AccessibilityObjectAtk.cpp @@ -93,6 +93,11 @@ void AccessibilityObject::setWrapper(AccessibilityObjectWrapper* wrapper) g_object_ref(m_wrapper); } +bool AccessibilityObject::allowsTextRanges() const +{ + return isTextControl() || isWebArea() || isGroup() || isLink() || isHeading(); +} + } // namespace WebCore #endif // HAVE(ACCESSIBILITY) diff --git a/WebCore/accessibility/gtk/AccessibilityObjectWrapperAtk.cpp b/WebCore/accessibility/gtk/AccessibilityObjectWrapperAtk.cpp index 3d7e712..716188a 100644 --- a/WebCore/accessibility/gtk/AccessibilityObjectWrapperAtk.cpp +++ b/WebCore/accessibility/gtk/AccessibilityObjectWrapperAtk.cpp @@ -1259,29 +1259,48 @@ static AtkAttributeSet* webkit_accessible_text_get_default_attributes(AtkText* t return getAttributeSetForAccessibilityObject(coreObject); } -static void webkit_accessible_text_get_character_extents(AtkText* text, gint offset, gint* x, gint* y, gint* width, gint* height, AtkCoordType coords) +static IntRect textExtents(AtkText* text, gint startOffset, gint length, AtkCoordType coords) { - IntRect extents = core(text)->doAXBoundsForRange(PlainTextRange(offset, 1)); - // FIXME: Use the AtkCoordType - // Requires WebCore::ScrollView::contentsToScreen() to be implemented + gchar* textContent = webkit_accessible_text_get_text(text, startOffset, -1); + gint textLength = g_utf8_strlen(textContent, -1); + + // The first case (endOffset of -1) should work, but seems broken for all Gtk+ apps. + gint rangeLength = length; + if (rangeLength < 0 || rangeLength > textLength) + rangeLength = textLength; + AccessibilityObject* coreObject = core(text); -#if 0 + IntRect extents = coreObject->doAXBoundsForRange(PlainTextRange(startOffset, rangeLength)); switch(coords) { case ATK_XY_SCREEN: - extents = core(text)->document()->view()->contentsToScreen(extents); + extents = coreObject->document()->view()->contentsToScreen(extents); break; case ATK_XY_WINDOW: // No-op break; } -#endif + return extents; +} + +static void webkit_accessible_text_get_character_extents(AtkText* text, gint offset, gint* x, gint* y, gint* width, gint* height, AtkCoordType coords) +{ + IntRect extents = textExtents(text, offset, 1, coords); *x = extents.x(); *y = extents.y(); *width = extents.width(); *height = extents.height(); } +static void webkit_accessible_text_get_range_extents(AtkText* text, gint startOffset, gint endOffset, AtkCoordType coords, AtkTextRectangle* rect) +{ + IntRect extents = textExtents(text, startOffset, endOffset - startOffset + 1, coords); + rect->x = extents.x(); + rect->y = extents.y(); + rect->width = extents.width(); + rect->height = extents.height(); +} + static gint webkit_accessible_text_get_character_count(AtkText* text) { AccessibilityObject* coreObject = core(text); @@ -1391,6 +1410,7 @@ static void atk_text_interface_init(AtkTextIface* iface) iface->get_run_attributes = webkit_accessible_text_get_run_attributes; iface->get_default_attributes = webkit_accessible_text_get_default_attributes; iface->get_character_extents = webkit_accessible_text_get_character_extents; + iface->get_range_extents = webkit_accessible_text_get_range_extents; iface->get_character_count = webkit_accessible_text_get_character_count; iface->get_offset_at_point = webkit_accessible_text_get_offset_at_point; iface->get_n_selections = webkit_accessible_text_get_n_selections; diff --git a/WebCore/bindings/generic/RuntimeEnabledFeatures.cpp b/WebCore/bindings/generic/RuntimeEnabledFeatures.cpp index 153f995..eb027c3 100644 --- a/WebCore/bindings/generic/RuntimeEnabledFeatures.cpp +++ b/WebCore/bindings/generic/RuntimeEnabledFeatures.cpp @@ -48,6 +48,7 @@ bool RuntimeEnabledFeatures::isWebGLEnabled = false; bool RuntimeEnabledFeatures::isPushStateEnabled = false; bool RuntimeEnabledFeatures::isTouchEnabled = true; bool RuntimeEnabledFeatures::isDeviceOrientationEnabled = true; +bool RuntimeEnabledFeatures::isSpeechInputEnabled = true; #if ENABLE(VIDEO) diff --git a/WebCore/bindings/generic/RuntimeEnabledFeatures.h b/WebCore/bindings/generic/RuntimeEnabledFeatures.h index b059d6e..c9eb21f 100644 --- a/WebCore/bindings/generic/RuntimeEnabledFeatures.h +++ b/WebCore/bindings/generic/RuntimeEnabledFeatures.h @@ -119,6 +119,10 @@ public: static bool deviceOrientationEventEnabled() { return isDeviceOrientationEnabled; } static bool ondeviceorientationEnabled() { return isDeviceOrientationEnabled; } + static void setSpeechInputEnabled(bool isEnabled) { isSpeechInputEnabled = isEnabled; } + static bool speechInputEnabled() { return isSpeechInputEnabled; } + static bool speechEnabled() { return isSpeechInputEnabled; } + private: // Never instantiate. RuntimeEnabledFeatures() { } @@ -133,6 +137,7 @@ private: static bool isPushStateEnabled; static bool isTouchEnabled; static bool isDeviceOrientationEnabled; + static bool isSpeechInputEnabled; }; } // namespace WebCore diff --git a/WebCore/bindings/gobject/WebKitHTMLElementWrapperFactory.cpp b/WebCore/bindings/gobject/WebKitHTMLElementWrapperFactory.cpp index 1513b66..44928eb 100644 --- a/WebCore/bindings/gobject/WebKitHTMLElementWrapperFactory.cpp +++ b/WebCore/bindings/gobject/WebKitHTMLElementWrapperFactory.cpp @@ -37,6 +37,7 @@ #include "HTMLAnchorElement.h" #include "HTMLAppletElement.h" #include "HTMLAreaElement.h" +#include "HTMLAudioElement.h" #include "HTMLBRElement.h" #include "HTMLBaseElement.h" #include "HTMLBaseFontElement.h" @@ -95,6 +96,7 @@ #include "webkit/WebKitDOMHTMLAnchorElementPrivate.h" #include "webkit/WebKitDOMHTMLAppletElementPrivate.h" #include "webkit/WebKitDOMHTMLAreaElementPrivate.h" +#include "webkit/WebKitDOMHTMLAudioElementPrivate.h" #include "webkit/WebKitDOMHTMLBRElementPrivate.h" #include "webkit/WebKitDOMHTMLBaseElementPrivate.h" #include "webkit/WebKitDOMHTMLBaseFontElementPrivate.h" @@ -175,6 +177,11 @@ static gpointer createAreaWrapper(PassRefPtr<HTMLElement> element) return wrapHTMLAreaElement(static_cast<HTMLAreaElement*>(element.get())); } +static gpointer createAudioWrapper(PassRefPtr<HTMLElement> element) +{ + return wrapHTMLAudioElement(static_cast<HTMLAudioElement*>(element.get())); +} + static gpointer createBaseWrapper(PassRefPtr<HTMLElement> element) { return wrapHTMLBaseElement(static_cast<HTMLBaseElement*>(element.get())); @@ -446,6 +453,7 @@ gpointer createHTMLElementWrapper(PassRefPtr<WebCore::HTMLElement> element) if (map.isEmpty()) { map.set(aTag.localName().impl(), createAnchorWrapper); map.set(appletTag.localName().impl(), createAppletWrapper); + map.set(audioTag.localName().impl(), createAudioWrapper); map.set(areaTag.localName().impl(), createAreaWrapper); map.set(baseTag.localName().impl(), createBaseWrapper); map.set(basefontTag.localName().impl(), createBaseFontWrapper); diff --git a/WebCore/bindings/js/JSCustomVoidCallback.cpp b/WebCore/bindings/js/JSCustomVoidCallback.cpp index d5c4ac3..96b5412 100644 --- a/WebCore/bindings/js/JSCustomVoidCallback.cpp +++ b/WebCore/bindings/js/JSCustomVoidCallback.cpp @@ -48,7 +48,10 @@ JSCustomVoidCallback::JSCustomVoidCallback(JSObject* callback, JSDOMGlobalObject JSCustomVoidCallback::~JSCustomVoidCallback() { - m_scriptExecutionContext->postTask(DeleteCallbackDataTask::create(m_data)); + if (m_scriptExecutionContext->isContextThread()) + delete m_data; + else + m_scriptExecutionContext->postTask(DeleteCallbackDataTask::create(m_data)); #ifndef NDEBUG m_data = 0; #endif diff --git a/WebCore/bindings/js/JSIDBAnyCustom.cpp b/WebCore/bindings/js/JSIDBAnyCustom.cpp index b7c845e..92f725a 100644 --- a/WebCore/bindings/js/JSIDBAnyCustom.cpp +++ b/WebCore/bindings/js/JSIDBAnyCustom.cpp @@ -33,15 +33,15 @@ #include "IDBAny.h" #include "IDBDatabaseRequest.h" -#include "IDBIndexRequest.h" +#include "IDBFactory.h" +#include "IDBIndex.h" #include "IDBKey.h" #include "IDBObjectStoreRequest.h" -#include "IndexedDatabaseRequest.h" #include "JSIDBDatabaseRequest.h" -#include "JSIDBIndexRequest.h" +#include "JSIDBFactory.h" +#include "JSIDBIndex.h" #include "JSIDBKey.h" #include "JSIDBObjectStoreRequest.h" -#include "JSIndexedDatabaseRequest.h" #include "SerializedScriptValue.h" using namespace JSC; @@ -60,14 +60,14 @@ JSValue toJS(ExecState* exec, JSDOMGlobalObject* globalObject, IDBAny* idbAny) return jsNull(); case IDBAny::IDBDatabaseRequestType: return toJS(exec, globalObject, idbAny->idbDatabaseRequest()); - case IDBAny::IDBIndexRequestType: - return toJS(exec, globalObject, idbAny->idbIndexRequest()); + case IDBAny::IDBIndexType: + return toJS(exec, globalObject, idbAny->idbIndex()); case IDBAny::IDBKeyType: return toJS(exec, globalObject, idbAny->idbKey()); case IDBAny::IDBObjectStoreRequestType: return toJS(exec, globalObject, idbAny->idbObjectStoreRequest()); - case IDBAny::IndexedDatabaseRequestType: - return toJS(exec, globalObject, idbAny->indexedDatabaseRequest()); + case IDBAny::IDBFactoryType: + return toJS(exec, globalObject, idbAny->idbFactory()); case IDBAny::SerializedScriptValueType: return idbAny->serializedScriptValue()->deserialize(exec, globalObject); } diff --git a/WebCore/bindings/js/JSPluginElementFunctions.cpp b/WebCore/bindings/js/JSPluginElementFunctions.cpp index cf43e91..893b967 100644 --- a/WebCore/bindings/js/JSPluginElementFunctions.cpp +++ b/WebCore/bindings/js/JSPluginElementFunctions.cpp @@ -35,12 +35,18 @@ using namespace HTMLNames; // Runtime object support code for JSHTMLAppletElement, JSHTMLEmbedElement and JSHTMLObjectElement. +static inline bool isPluginElement(Node* node) +{ + return node->hasTagName(objectTag) || node->hasTagName(embedTag) || node->hasTagName(appletTag); +} + Instance* pluginInstance(Node* node) { if (!node) return 0; - if (!(node->hasTagName(objectTag) || node->hasTagName(embedTag) || node->hasTagName(appletTag))) + if (!isPluginElement(node)) return 0; + HTMLPlugInElement* plugInElement = static_cast<HTMLPlugInElement*>(node); // The plugin element holds an owning reference, so we don't have to. Instance* instance = plugInElement->getInstance().get(); @@ -49,22 +55,40 @@ Instance* pluginInstance(Node* node) return instance; } +static JSObject* pluginScriptObjectFromPluginViewBase(HTMLPlugInElement* pluginElement, JSGlobalObject* globalObject) +{ + Widget* pluginWidget = pluginElement->pluginWidget(); + if (!pluginWidget) + return 0; + + if (!pluginWidget->isPluginViewBase()) + return 0; + + PluginViewBase* pluginViewBase = static_cast<PluginViewBase*>(pluginWidget); + return pluginViewBase->scriptObject(globalObject); +} + +static JSObject* pluginScriptObjectFromPluginViewBase(JSHTMLElement* jsHTMLElement) +{ + HTMLElement* element = jsHTMLElement->impl(); + if (!isPluginElement(element)) + return 0; + + HTMLPlugInElement* pluginElement = static_cast<HTMLPlugInElement*>(element); + return pluginScriptObjectFromPluginViewBase(pluginElement, jsHTMLElement->globalObject()); +} + JSObject* pluginScriptObject(ExecState* exec, JSHTMLElement* jsHTMLElement) { HTMLElement* element = jsHTMLElement->impl(); - if (!(element->hasTagName(objectTag) || element->hasTagName(embedTag) || element->hasTagName(appletTag))) + if (!isPluginElement(element)) return 0; HTMLPlugInElement* pluginElement = static_cast<HTMLPlugInElement*>(element); // First, see if we can ask the plug-in view for its script object. - if (Widget* pluginWidget = pluginElement->pluginWidget()) { - if (pluginWidget->isPluginViewBase()) { - PluginViewBase* pluginViewBase = static_cast<PluginViewBase*>(pluginWidget); - if (JSObject* scriptObject = pluginViewBase->scriptObject(exec, jsHTMLElement->globalObject())) - return scriptObject; - } - } + if (JSObject* scriptObject = pluginScriptObjectFromPluginViewBase(pluginElement, jsHTMLElement->globalObject())) + return scriptObject; // Otherwise, fall back to getting the object from the instance. @@ -127,15 +151,39 @@ bool runtimeObjectCustomPut(ExecState* exec, const Identifier& propertyName, JSV static EncodedJSValue JSC_HOST_CALL callPlugin(ExecState* exec) { - Instance* instance = pluginInstance(static_cast<JSHTMLElement*>(exec->callee())->impl()); - instance->begin(); - JSValue result = instance->invokeDefaultMethod(exec); - instance->end(); + JSHTMLElement* element = static_cast<JSHTMLElement*>(exec->callee()); + + // Get the plug-in script object. + JSObject* scriptObject = pluginScriptObject(exec, element); + ASSERT(scriptObject); + + size_t argumentCount = exec->argumentCount(); + MarkedArgumentBuffer argumentList; + for (size_t i = 0; i < argumentCount; i++) + argumentList.append(exec->argument(i)); + + CallData callData; + CallType callType = getCallData(scriptObject, callData); + ASSERT(callType == CallTypeHost); + + // Call the object. + JSValue result = call(exec, scriptObject, callType, callData, exec->hostThisValue(), argumentList); return JSValue::encode(result); } CallType runtimeObjectGetCallData(JSHTMLElement* element, CallData& callData) { + // First, ask the plug-in view base for its runtime object. + if (JSObject* scriptObject = pluginScriptObjectFromPluginViewBase(element)) { + CallData scriptObjectCallData; + + if (scriptObject->getCallData(scriptObjectCallData) == CallTypeNone) + return CallTypeNone; + + callData.native.function = callPlugin; + return CallTypeHost; + } + Instance* instance = pluginInstance(element->impl()); if (!instance || !instance->supportsInvokeDefaultMethod()) return CallTypeNone; diff --git a/WebCore/bindings/scripts/CodeGenerator.pm b/WebCore/bindings/scripts/CodeGenerator.pm index 363fdc5..adc47d0 100644 --- a/WebCore/bindings/scripts/CodeGenerator.pm +++ b/WebCore/bindings/scripts/CodeGenerator.pm @@ -343,6 +343,11 @@ sub WK_ucfirst my ($object, $param) = @_; my $ret = ucfirst($param); $ret =~ s/Xml/XML/ if $ret =~ /^Xml[^a-z]/; + + # For HTML5 FileSystem API Flags attributes. + $ret =~ s/^CREATE/Create/ if $ret =~ /^CREATE$/; + $ret =~ s/^EXCLUSIVE/Exclusive/ if $ret =~ /^EXCLUSIVE$/; + return $ret; } @@ -357,6 +362,11 @@ sub WK_lcfirst $ret =~ s/jS/js/ if $ret =~ /^jS/; $ret =~ s/xML/xml/ if $ret =~ /^xML/; $ret =~ s/xSLT/xslt/ if $ret =~ /^xSLT/; + + # For HTML5 FileSystem API Flags attributes. + $ret =~ s/^cREATE/isCreate/ if $ret =~ /^cREATE$/; + $ret =~ s/^eXCLUSIVE/isExclusive/ if $ret =~ /^eXCLUSIVE$/; + return $ret; } diff --git a/WebCore/bindings/scripts/CodeGeneratorGObject.pm b/WebCore/bindings/scripts/CodeGeneratorGObject.pm index ae4ac39..bc5aace 100644 --- a/WebCore/bindings/scripts/CodeGeneratorGObject.pm +++ b/WebCore/bindings/scripts/CodeGeneratorGObject.pm @@ -822,6 +822,15 @@ sub GenerateFunction { } } + # Not quite sure what to do with this yet, but we need to take into + # account the difference in parameters between the IDL file and the + # actual implementation. + if ($function->signature->extendedAttributes->{"NeedsUserGestureCheck"}) { + $functionSig .= ", gboolean isUserGesture"; + $callImplParams .= ", " if $callImplParams; + $callImplParams .= "false"; + } + if ($returnType ne "void" && $returnValueIsGDOMType && $functionSigType ne "DOMObject") { if ($functionSigType ne "EventTarget") { $implIncludes{"webkit/WebKitDOM${functionSigType}Private.h"} = 1; diff --git a/WebCore/bindings/scripts/CodeGeneratorJS.pm b/WebCore/bindings/scripts/CodeGeneratorJS.pm index 05f532c..247430f 100644 --- a/WebCore/bindings/scripts/CodeGeneratorJS.pm +++ b/WebCore/bindings/scripts/CodeGeneratorJS.pm @@ -219,6 +219,14 @@ sub GetVisibleClassName return $className; } +sub GetCallbackClassName +{ + my $className = shift; + + return "JSCustomVoidCallback" if $className eq "VoidCallback"; + return "JS$className"; +} + sub AvoidInclusionOfType { my $type = shift; @@ -1913,7 +1921,7 @@ sub GenerateImplementation } my $name = $parameter->name; - + if ($parameter->type eq "XPathNSResolver") { push(@implContent, " RefPtr<XPathNSResolver> customResolver;\n"); push(@implContent, " XPathNSResolver* resolver = toXPathNSResolver(exec->argument($argsIndex));\n"); @@ -1923,6 +1931,15 @@ sub GenerateImplementation push(@implContent, " return JSValue::encode(jsUndefined());\n"); push(@implContent, " resolver = customResolver.get();\n"); push(@implContent, " }\n"); + } elsif ($parameter->extendedAttributes->{"Callback"}) { + my $callbackClassName = GetCallbackClassName($parameter->type); + $implIncludes{"$callbackClassName.h"} = 1; + $implIncludes{"ExceptionCode.h"} = 1; + push(@implContent, " if (exec->argumentCount() <= $argsIndex || !exec->argument($argsIndex).isObject()) {\n"); + push(@implContent, " setDOMException(exec, TYPE_MISMATCH_ERR);\n"); + push(@implContent, " return jsUndefined();\n"); + push(@implContent, " }\n"); + push(@implContent, " RefPtr<" . $parameter->type . "> $name = " . $callbackClassName . "::create(asObject(exec->argument($argsIndex)), castedThis->globalObject());\n"); } else { push(@implContent, " " . GetNativeTypeFromSignature($parameter) . " $name = " . JSValueToNative($parameter, "exec->argument($argsIndex)") . ";\n"); @@ -2151,7 +2168,10 @@ sub GenerateCallbackImplementation # Destructor push(@implContent, "${className}::~${className}()\n"); push(@implContent, "{\n"); - push(@implContent, " m_scriptExecutionContext->postTask(DeleteCallbackDataTask::create(m_data));\n"); + push(@implContent, " if (m_scriptExecutionContext->isContextThread())\n"); + push(@implContent, " delete m_data;\n"); + push(@implContent, " else\n"); + push(@implContent, " m_scriptExecutionContext->postTask(DeleteCallbackDataTask::create(m_data));\n"); push(@implContent, "#ifndef NDEBUG\n"); push(@implContent, " m_data = 0;\n"); push(@implContent, "#endif\n"); diff --git a/WebCore/bindings/scripts/CodeGeneratorV8.pm b/WebCore/bindings/scripts/CodeGeneratorV8.pm index c963e04..c852f7b 100644 --- a/WebCore/bindings/scripts/CodeGeneratorV8.pm +++ b/WebCore/bindings/scripts/CodeGeneratorV8.pm @@ -1139,7 +1139,7 @@ END my $raisesExceptions = @{$function->raisesExceptions}; if (!$raisesExceptions) { foreach my $parameter (@{$function->parameters}) { - if (TypeCanFailConversion($parameter) or $parameter->extendedAttributes->{"IsIndex"}) { + if ((!$parameter->extendedAttributes->{"Callback"} and TypeCanFailConversion($parameter)) or $parameter->extendedAttributes->{"IsIndex"}) { $raisesExceptions = 1; } } @@ -1183,6 +1183,21 @@ END push(@implContentDecls, " }\n"); } + if ($parameter->extendedAttributes->{"Callback"}) { + my $className = GetCallbackClassName($parameter->type); + $implIncludes{"$className.h"} = 1; + $implIncludes{"ExceptionCode.h"} = 1; + push(@implContentDecls, " if (args.Length() <= $paramIndex || !args[$paramIndex]->IsObject())\n"); + push(@implContentDecls, " return throwError(TYPE_MISMATCH_ERR);\n"); + if ($parameter->type eq "VoidCallback") { + push(@implContentDecls, " RefPtr<" . $parameter->type . "> $parameterName = " . $className . "::create(args[$paramIndex], getScriptExecutionContext());\n"); + } else { + push(@implContentDecls, " RefPtr<" . $parameter->type . "> $parameterName = " . $className . "::create(args[$paramIndex]);\n"); + } + $paramIndex++; + next; + } + if ($parameter->type eq "SerializedScriptValue") { $implIncludes{"SerializedScriptValue.h"} = 1; push(@implContentDecls, " bool ${parameterName}DidThrow = false;\n"); @@ -3235,6 +3250,14 @@ sub GetVisibleInterfaceName return $interfaceName; } +sub GetCallbackClassName +{ + my $interfaceName = shift; + + return "V8CustomVoidCallback" if $interfaceName eq "VoidCallback"; + return "V8$interfaceName"; +} + sub DebugPrint { my $output = shift; diff --git a/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.cpp b/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.cpp index 179b301..b8c551e 100644 --- a/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.cpp +++ b/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.cpp @@ -176,6 +176,38 @@ void WebDOMTestObj::setTestObjAttr(const WebDOMTestObj& newTestObjAttr) impl()->setTestObjAttr(toWebCore(newTestObjAttr)); } +WebDOMTestObj WebDOMTestObj::XMLObjAttr() const +{ + if (!impl()) + return WebDOMTestObj(); + + return toWebKit(WTF::getPtr(impl()->xmlObjAttr())); +} + +void WebDOMTestObj::setXMLObjAttr(const WebDOMTestObj& newXMLObjAttr) +{ + if (!impl()) + return; + + impl()->setXMLObjAttr(toWebCore(newXMLObjAttr)); +} + +bool WebDOMTestObj::CREATE() const +{ + if (!impl()) + return false; + + return impl()->isCreate(); +} + +void WebDOMTestObj::setCREATE(bool newCREATE) +{ + if (!impl()) + return; + + impl()->setCreate(newCREATE); +} + WebDOMString WebDOMTestObj::reflectedStringAttr() const { if (!impl()) diff --git a/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.h b/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.h index 09c77db..c3b65ca 100644 --- a/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.h +++ b/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.h @@ -69,6 +69,10 @@ public: void setStringAttr(const WebDOMString&); WebDOMTestObj testObjAttr() const; void setTestObjAttr(const WebDOMTestObj&); + WebDOMTestObj XMLObjAttr() const; + void setXMLObjAttr(const WebDOMTestObj&); + bool CREATE() const; + void setCREATE(bool); WebDOMString reflectedStringAttr() const; void setReflectedStringAttr(const WebDOMString&); int reflectedIntegralAttr() const; diff --git a/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp b/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp index b4b6787..6a8399e 100644 --- a/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp +++ b/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp @@ -475,6 +475,48 @@ webkit_dom_test_obj_set_test_obj_attr(WebKitDOMTestObj* self, WebKitDOMTestObj* item->setTestObjAttr(converted_value); } +WebKitDOMTestObj* +webkit_dom_test_obj_get_xml_obj_attr(WebKitDOMTestObj* self) +{ + WebCore::JSMainThreadNullState state; + g_return_val_if_fail(self, 0); + WebCore::TestObj * item = WebKit::core(self); + PassRefPtr<WebCore::TestObj> g_res = WTF::getPtr(item->xmlObjAttr()); + WebKitDOMTestObj* res = static_cast<WebKitDOMTestObj* >(WebKit::kit(g_res.get())); + return res; +} + +void +webkit_dom_test_obj_set_xml_obj_attr(WebKitDOMTestObj* self, WebKitDOMTestObj* value) +{ + WebCore::JSMainThreadNullState state; + g_return_if_fail(self); + WebCore::TestObj * item = WebKit::core(self); + g_return_if_fail(value); + WebCore::TestObj * converted_value = WebKit::core(value); + g_return_if_fail(converted_value); + item->setXMLObjAttr(converted_value); +} + +gboolean +webkit_dom_test_obj_get_create(WebKitDOMTestObj* self) +{ + WebCore::JSMainThreadNullState state; + g_return_val_if_fail(self, 0); + WebCore::TestObj * item = WebKit::core(self); + gboolean res = item->isCreate(); + return res; +} + +void +webkit_dom_test_obj_set_create(WebKitDOMTestObj* self, gboolean value) +{ + WebCore::JSMainThreadNullState state; + g_return_if_fail(self); + WebCore::TestObj * item = WebKit::core(self); + item->setCreate(value); +} + gchar* webkit_dom_test_obj_get_reflected_string_attr(WebKitDOMTestObj* self) { @@ -932,6 +974,8 @@ enum { PROP_UNSIGNED_LONG_LONG_ATTR, PROP_STRING_ATTR, PROP_TEST_OBJ_ATTR, + PROP_XML_OBJ_ATTR, + PROP_CREATE, PROP_REFLECTED_STRING_ATTR, PROP_REFLECTED_INTEGRAL_ATTR, PROP_REFLECTED_BOOLEAN_ATTR, @@ -1000,6 +1044,11 @@ static void webkit_dom_test_obj_set_property(GObject* object, guint prop_id, con coreSelf->setStringAttr(WebCore::String::fromUTF8(g_value_get_string(value))); break; } + case PROP_CREATE: + { + coreSelf->setCreate((g_value_get_boolean(value))); + break; + } case PROP_REFLECTED_STRING_ATTR: { coreSelf->setAttribute(WebCore::HTMLNames::reflectedstringattrAttr, WebCore::String::fromUTF8(g_value_get_string(value))); @@ -1155,6 +1204,17 @@ static void webkit_dom_test_obj_get_property(GObject* object, guint prop_id, GVa g_value_set_object(value, WebKit::kit(ptr.get())); break; } + case PROP_XML_OBJ_ATTR: + { + RefPtr<WebCore::TestObj> ptr = coreSelf->xmlObjAttr(); + g_value_set_object(value, WebKit::kit(ptr.get())); + break; + } + case PROP_CREATE: + { + g_value_set_boolean(value, coreSelf->isCreate()); + break; + } case PROP_REFLECTED_STRING_ATTR: { g_value_take_string(value, convertToUTF8String(coreSelf->getAttribute(WebCore::HTMLNames::reflectedstringattrAttr))); @@ -1355,6 +1415,20 @@ G_MAXUINT64, /* min */ WEBKIT_TYPE_DOM_TEST_OBJ, /* gobject type */ WEBKIT_PARAM_READWRITE)); g_object_class_install_property(gobjectClass, + PROP_XML_OBJ_ATTR, + g_param_spec_object("xml-obj-attr", /* name */ + "test_obj_xml-obj-attr", /* short description */ + "read-write WebKitDOMTestObj* TestObj.xml-obj-attr", /* longer - could do with some extra doc stuff here */ + WEBKIT_TYPE_DOM_TEST_OBJ, /* gobject type */ + WEBKIT_PARAM_READWRITE)); + g_object_class_install_property(gobjectClass, + PROP_CREATE, + g_param_spec_boolean("create", /* name */ + "test_obj_create", /* short description */ + "read-write gboolean TestObj.create", /* longer - could do with some extra doc stuff here */ + FALSE, /* default */ + WEBKIT_PARAM_READWRITE)); + g_object_class_install_property(gobjectClass, PROP_REFLECTED_STRING_ATTR, g_param_spec_string("reflected-string-attr", /* name */ "test_obj_reflected-string-attr", /* short description */ diff --git a/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h b/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h index baf278c..c9a1821 100644 --- a/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h +++ b/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h @@ -163,6 +163,18 @@ webkit_dom_test_obj_get_test_obj_attr(WebKitDOMTestObj* self); WEBKIT_API void webkit_dom_test_obj_set_test_obj_attr(WebKitDOMTestObj* self, WebKitDOMTestObj* value); +WEBKIT_API WebKitDOMTestObj* +webkit_dom_test_obj_get_xml_obj_attr(WebKitDOMTestObj* self); + +WEBKIT_API void +webkit_dom_test_obj_set_xml_obj_attr(WebKitDOMTestObj* self, WebKitDOMTestObj* value); + +WEBKIT_API gboolean +webkit_dom_test_obj_get_create(WebKitDOMTestObj* self); + +WEBKIT_API void +webkit_dom_test_obj_set_create(WebKitDOMTestObj* self, gboolean value); + WEBKIT_API gchar* webkit_dom_test_obj_get_reflected_string_attr(WebKitDOMTestObj* self); diff --git a/WebCore/bindings/scripts/test/JS/JSTestCallback.cpp b/WebCore/bindings/scripts/test/JS/JSTestCallback.cpp index 043a6ed..6f6b568 100644 --- a/WebCore/bindings/scripts/test/JS/JSTestCallback.cpp +++ b/WebCore/bindings/scripts/test/JS/JSTestCallback.cpp @@ -43,7 +43,10 @@ JSTestCallback::JSTestCallback(JSObject* callback, JSDOMGlobalObject* globalObje JSTestCallback::~JSTestCallback() { - m_scriptExecutionContext->postTask(DeleteCallbackDataTask::create(m_data)); + if (m_scriptExecutionContext->isContextThread()) + delete m_data; + else + m_scriptExecutionContext->postTask(DeleteCallbackDataTask::create(m_data)); #ifndef NDEBUG m_data = 0; #endif diff --git a/WebCore/bindings/scripts/test/JS/JSTestObj.cpp b/WebCore/bindings/scripts/test/JS/JSTestObj.cpp index 5aa54da..9c11bde 100644 --- a/WebCore/bindings/scripts/test/JS/JSTestObj.cpp +++ b/WebCore/bindings/scripts/test/JS/JSTestObj.cpp @@ -21,10 +21,12 @@ #include "config.h" #include "JSTestObj.h" +#include "ExceptionCode.h" #include "HTMLNames.h" #include "IDBBindingUtilities.h" #include "IDBKey.h" #include "JSEventListener.h" +#include "JSTestCallback.h" #include "JSTestObj.h" #include "JSlog.h" #include "KURL.h" @@ -49,7 +51,7 @@ ASSERT_CLASS_FITS_IN_CELL(JSTestObj); #define THUNK_GENERATOR(generator) #endif -static const HashTableValue JSTestObjTableValues[32] = +static const HashTableValue JSTestObjTableValues[34] = { { "readOnlyIntAttr", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjReadOnlyIntAttr), (intptr_t)0 THUNK_GENERATOR(0) }, { "readOnlyStringAttr", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjReadOnlyStringAttr), (intptr_t)0 THUNK_GENERATOR(0) }, @@ -59,6 +61,8 @@ static const HashTableValue JSTestObjTableValues[32] = { "unsignedLongLongAttr", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjUnsignedLongLongAttr), (intptr_t)setJSTestObjUnsignedLongLongAttr THUNK_GENERATOR(0) }, { "stringAttr", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjStringAttr), (intptr_t)setJSTestObjStringAttr THUNK_GENERATOR(0) }, { "testObjAttr", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjTestObjAttr), (intptr_t)setJSTestObjTestObjAttr THUNK_GENERATOR(0) }, + { "XMLObjAttr", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjXMLObjAttr), (intptr_t)setJSTestObjXMLObjAttr THUNK_GENERATOR(0) }, + { "CREATE", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjCreate), (intptr_t)setJSTestObjCreate THUNK_GENERATOR(0) }, { "reflectedStringAttr", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjReflectedStringAttr), (intptr_t)setJSTestObjReflectedStringAttr THUNK_GENERATOR(0) }, { "reflectedIntegralAttr", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjReflectedIntegralAttr), (intptr_t)setJSTestObjReflectedIntegralAttr THUNK_GENERATOR(0) }, { "reflectedBooleanAttr", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjReflectedBooleanAttr), (intptr_t)setJSTestObjReflectedBooleanAttr THUNK_GENERATOR(0) }, @@ -92,7 +96,7 @@ static const HashTableValue JSTestObjTableValues[32] = }; #undef THUNK_GENERATOR -static JSC_CONST_HASHTABLE HashTable JSTestObjTable = { 68, 63, JSTestObjTableValues, 0 }; +static JSC_CONST_HASHTABLE HashTable JSTestObjTable = { 132, 127, JSTestObjTableValues, 0 }; /* Hash table for constructor */ #if ENABLE(JIT) #define THUNK_GENERATOR(generator) , generator @@ -172,7 +176,7 @@ bool JSTestObjConstructor::getOwnPropertyDescriptor(ExecState* exec, const Ident #define THUNK_GENERATOR(generator) #endif -static const HashTableValue JSTestObjPrototypeTableValues[42] = +static const HashTableValue JSTestObjPrototypeTableValues[45] = { { "CONST_VALUE_0", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjCONST_VALUE_0), (intptr_t)0 THUNK_GENERATOR(0) }, { "CONST_VALUE_1", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjCONST_VALUE_1), (intptr_t)0 THUNK_GENERATOR(0) }, @@ -214,12 +218,15 @@ static const HashTableValue JSTestObjPrototypeTableValues[42] = { "methodWithOptionalArg", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithOptionalArg), (intptr_t)1 THUNK_GENERATOR(0) }, { "methodWithNonOptionalArgAndOptionalArg", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndOptionalArg), (intptr_t)2 THUNK_GENERATOR(0) }, { "methodWithNonOptionalArgAndTwoOptionalArgs", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndTwoOptionalArgs), (intptr_t)3 THUNK_GENERATOR(0) }, + { "methodWithCallbackArg", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithCallbackArg), (intptr_t)1 THUNK_GENERATOR(0) }, + { "methodWithNonCallbackArgAndCallbackArg", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithNonCallbackArgAndCallbackArg), (intptr_t)2 THUNK_GENERATOR(0) }, + { "methodWithCallbackAndOptionalArg", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithCallbackAndOptionalArg), (intptr_t)1 THUNK_GENERATOR(0) }, { "overloadedMethod", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionOverloadedMethod), (intptr_t)2 THUNK_GENERATOR(0) }, { 0, 0, 0, 0 THUNK_GENERATOR(0) } }; #undef THUNK_GENERATOR -static JSC_CONST_HASHTABLE HashTable JSTestObjPrototypeTable = { 134, 127, JSTestObjPrototypeTableValues, 0 }; +static JSC_CONST_HASHTABLE HashTable JSTestObjPrototypeTable = { 135, 127, JSTestObjPrototypeTableValues, 0 }; const ClassInfo JSTestObjPrototype::s_info = { "TestObjPrototype", 0, &JSTestObjPrototypeTable, 0 }; JSObject* JSTestObjPrototype::self(ExecState* exec, JSGlobalObject* globalObject) @@ -337,6 +344,24 @@ JSValue jsTestObjTestObjAttr(ExecState* exec, JSValue slotBase, const Identifier return result; } +JSValue jsTestObjXMLObjAttr(ExecState* exec, JSValue slotBase, const Identifier&) +{ + JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(slotBase)); + UNUSED_PARAM(exec); + TestObj* imp = static_cast<TestObj*>(castedThis->impl()); + JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->xmlObjAttr())); + return result; +} + +JSValue jsTestObjCreate(ExecState* exec, JSValue slotBase, const Identifier&) +{ + JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(slotBase)); + UNUSED_PARAM(exec); + TestObj* imp = static_cast<TestObj*>(castedThis->impl()); + JSValue result = jsBoolean(imp->isCreate()); + return result; +} + JSValue jsTestObjReflectedStringAttr(ExecState* exec, JSValue slotBase, const Identifier&) { JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(slotBase)); @@ -585,6 +610,20 @@ void setJSTestObjTestObjAttr(ExecState* exec, JSObject* thisObject, JSValue valu imp->setTestObjAttr(toTestObj(value)); } +void setJSTestObjXMLObjAttr(ExecState* exec, JSObject* thisObject, JSValue value) +{ + JSTestObj* castedThis = static_cast<JSTestObj*>(thisObject); + TestObj* imp = static_cast<TestObj*>(castedThis->impl()); + imp->setXMLObjAttr(toTestObj(value)); +} + +void setJSTestObjCreate(ExecState* exec, JSObject* thisObject, JSValue value) +{ + JSTestObj* castedThis = static_cast<JSTestObj*>(thisObject); + TestObj* imp = static_cast<TestObj*>(castedThis->impl()); + imp->setCreate(value.toBoolean(exec)); +} + void setJSTestObjReflectedStringAttr(ExecState* exec, JSObject* thisObject, JSValue value) { JSTestObj* castedThis = static_cast<JSTestObj*>(thisObject); @@ -1189,6 +1228,65 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNonOptionalArgA return JSValue::encode(jsUndefined()); } +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithCallbackArg(ExecState* exec) +{ + JSValue thisValue = exec->hostThisValue(); + if (!thisValue.inherits(&JSTestObj::s_info)) + return throwVMTypeError(exec); + JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); + TestObj* imp = static_cast<TestObj*>(castedThis->impl()); + if (exec->argumentCount() <= 0 || !exec->argument(0).isObject()) { + setDOMException(exec, TYPE_MISMATCH_ERR); + return jsUndefined(); + } + RefPtr<TestCallback> callback = JSTestCallback::create(asObject(exec->argument(0)), castedThis->globalObject()); + + imp->methodWithCallbackArg(callback); + return JSValue::encode(jsUndefined()); +} + +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNonCallbackArgAndCallbackArg(ExecState* exec) +{ + JSValue thisValue = exec->hostThisValue(); + if (!thisValue.inherits(&JSTestObj::s_info)) + return throwVMTypeError(exec); + JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); + TestObj* imp = static_cast<TestObj*>(castedThis->impl()); + int nonCallback = exec->argument(0).toInt32(exec); + if (exec->argumentCount() <= 1 || !exec->argument(1).isObject()) { + setDOMException(exec, TYPE_MISMATCH_ERR); + return jsUndefined(); + } + RefPtr<TestCallback> callback = JSTestCallback::create(asObject(exec->argument(1)), castedThis->globalObject()); + + imp->methodWithNonCallbackArgAndCallbackArg(nonCallback, callback); + return JSValue::encode(jsUndefined()); +} + +EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithCallbackAndOptionalArg(ExecState* exec) +{ + JSValue thisValue = exec->hostThisValue(); + if (!thisValue.inherits(&JSTestObj::s_info)) + return throwVMTypeError(exec); + JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); + TestObj* imp = static_cast<TestObj*>(castedThis->impl()); + + int argsCount = exec->argumentCount(); + if (argsCount < 1) { + imp->methodWithCallbackAndOptionalArg(); + return JSValue::encode(jsUndefined()); + } + + if (exec->argumentCount() <= 0 || !exec->argument(0).isObject()) { + setDOMException(exec, TYPE_MISMATCH_ERR); + return jsUndefined(); + } + RefPtr<TestCallback> callback = JSTestCallback::create(asObject(exec->argument(0)), castedThis->globalObject()); + + imp->methodWithCallbackAndOptionalArg(callback); + return JSValue::encode(jsUndefined()); +} + static EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod1(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); diff --git a/WebCore/bindings/scripts/test/JS/JSTestObj.h b/WebCore/bindings/scripts/test/JS/JSTestObj.h index 0648526..993df8c 100644 --- a/WebCore/bindings/scripts/test/JS/JSTestObj.h +++ b/WebCore/bindings/scripts/test/JS/JSTestObj.h @@ -115,6 +115,9 @@ JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithScriptExecutionC JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalArg(JSC::ExecState*); JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndOptionalArg(JSC::ExecState*); JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndTwoOptionalArgs(JSC::ExecState*); +JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithCallbackArg(JSC::ExecState*); +JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNonCallbackArgAndCallbackArg(JSC::ExecState*); +JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithCallbackAndOptionalArg(JSC::ExecState*); JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod(JSC::ExecState*); // Attributes @@ -131,6 +134,10 @@ JSC::JSValue jsTestObjStringAttr(JSC::ExecState*, JSC::JSValue, const JSC::Ident void setJSTestObjStringAttr(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); JSC::JSValue jsTestObjTestObjAttr(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); void setJSTestObjTestObjAttr(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); +JSC::JSValue jsTestObjXMLObjAttr(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); +void setJSTestObjXMLObjAttr(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); +JSC::JSValue jsTestObjCreate(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); +void setJSTestObjCreate(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); JSC::JSValue jsTestObjReflectedStringAttr(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); void setJSTestObjReflectedStringAttr(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); JSC::JSValue jsTestObjReflectedIntegralAttr(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); diff --git a/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h b/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h index a96b499..4a0f065 100644 --- a/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h +++ b/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h @@ -62,6 +62,10 @@ enum { - (void)setStringAttr:(NSString *)newStringAttr; - (DOMTestObj *)testObjAttr; - (void)setTestObjAttr:(DOMTestObj *)newTestObjAttr; +- (DOMTestObj *)XMLObjAttr; +- (void)setXMLObjAttr:(DOMTestObj *)newXMLObjAttr; +- (BOOL)CREATE; +- (void)setCREATE:(BOOL)newCREATE; - (NSString *)reflectedStringAttr; - (void)setReflectedStringAttr:(NSString *)newReflectedStringAttr; - (int)reflectedIntegralAttr; diff --git a/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm b/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm index 99c3cc6..71d3508 100644 --- a/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm +++ b/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm @@ -154,6 +154,32 @@ IMPL->setTestObjAttr(core(newTestObjAttr)); } +- (DOMTestObj *)XMLObjAttr +{ + WebCore::JSMainThreadNullState state; + return kit(WTF::getPtr(IMPL->xmlObjAttr())); +} + +- (void)setXMLObjAttr:(DOMTestObj *)newXMLObjAttr +{ + WebCore::JSMainThreadNullState state; + ASSERT(newXMLObjAttr); + + IMPL->setXMLObjAttr(core(newXMLObjAttr)); +} + +- (BOOL)CREATE +{ + WebCore::JSMainThreadNullState state; + return IMPL->isCreate(); +} + +- (void)setCREATE:(BOOL)newCREATE +{ + WebCore::JSMainThreadNullState state; + IMPL->setCreate(newCREATE); +} + - (NSString *)reflectedStringAttr { WebCore::JSMainThreadNullState state; diff --git a/WebCore/bindings/scripts/test/TestObj.idl b/WebCore/bindings/scripts/test/TestObj.idl index a5daa24..a2bc89d 100644 --- a/WebCore/bindings/scripts/test/TestObj.idl +++ b/WebCore/bindings/scripts/test/TestObj.idl @@ -41,6 +41,11 @@ module test { attribute DOMString stringAttr; attribute TestObj testObjAttr; + JS, V8 + // WK_ucfirst, WK_lcfirst exceptional cases. + attribute TestObj XMLObjAttr; + attribute boolean CREATE; + // Reflected DOM attributes attribute [Reflect] DOMString reflectedStringAttr; attribute [Reflect] long reflectedIntegralAttr; @@ -109,6 +114,13 @@ module test { void methodWithNonOptionalArgAndOptionalArg(in long nonOpt, in [Optional] long opt); void methodWithNonOptionalArgAndTwoOptionalArgs(in long nonOpt, in [Optional] long opt1, in long opt2); +#if defined(TESTING_V8) || defined(TESTING_JS) + // 'Callback' extended attribute + void methodWithCallbackArg(in [Callback] TestCallback callback); + void methodWithNonCallbackArgAndCallbackArg(in long nonCallback, in [Callback] TestCallback callback); + void methodWithCallbackAndOptionalArg(in [Callback, Optional] TestCallback callback); +#endif + // 'ConvertScriptString' extended attribute readonly attribute [ConvertScriptString] DOMString scriptStringAttr; diff --git a/WebCore/bindings/scripts/test/V8/V8TestObj.cpp b/WebCore/bindings/scripts/test/V8/V8TestObj.cpp index 09d99f8..5584eaf 100644 --- a/WebCore/bindings/scripts/test/V8/V8TestObj.cpp +++ b/WebCore/bindings/scripts/test/V8/V8TestObj.cpp @@ -33,6 +33,7 @@ #include "V8DOMWrapper.h" #include "V8IsolatedContext.h" #include "V8Proxy.h" +#include "V8TestCallback.h" #include "V8log.h" #include <wtf/GetPtr.h> #include <wtf/RefCounted.h> @@ -154,6 +155,38 @@ static void testObjAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Valu return; } +static v8::Handle<v8::Value> XMLObjAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) +{ + INC_STATS("DOM.TestObj.XMLObjAttr._get"); + TestObj* imp = V8TestObj::toNative(info.Holder()); + return toV8(imp->xmlObjAttr()); +} + +static void XMLObjAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info) +{ + INC_STATS("DOM.TestObj.XMLObjAttr._set"); + TestObj* imp = V8TestObj::toNative(info.Holder()); + TestObj* v = V8TestObj::HasInstance(value) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(value)) : 0; + imp->setXMLObjAttr(WTF::getPtr(v)); + return; +} + +static v8::Handle<v8::Value> CREATEAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) +{ + INC_STATS("DOM.TestObj.CREATE._get"); + TestObj* imp = V8TestObj::toNative(info.Holder()); + return v8Boolean(imp->isCreate()); +} + +static void CREATEAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info) +{ + INC_STATS("DOM.TestObj.CREATE._set"); + TestObj* imp = V8TestObj::toNative(info.Holder()); + bool v = value->BooleanValue(); + imp->setCreate(v); + return; +} + static v8::Handle<v8::Value> reflectedStringAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) { INC_STATS("DOM.TestObj.reflectedStringAttr._get"); @@ -862,6 +895,44 @@ static v8::Handle<v8::Value> methodWithNonOptionalArgAndTwoOptionalArgsCallback( return v8::Handle<v8::Value>(); } +static v8::Handle<v8::Value> methodWithCallbackArgCallback(const v8::Arguments& args) +{ + INC_STATS("DOM.TestObj.methodWithCallbackArg"); + TestObj* imp = V8TestObj::toNative(args.Holder()); + if (args.Length() <= 0 || !args[0]->IsObject()) + return throwError(TYPE_MISMATCH_ERR); + RefPtr<TestCallback> callback = V8TestCallback::create(args[0]); + imp->methodWithCallbackArg(callback); + return v8::Handle<v8::Value>(); +} + +static v8::Handle<v8::Value> methodWithNonCallbackArgAndCallbackArgCallback(const v8::Arguments& args) +{ + INC_STATS("DOM.TestObj.methodWithNonCallbackArgAndCallbackArg"); + TestObj* imp = V8TestObj::toNative(args.Holder()); + int nonCallback = toInt32(args[0]); + if (args.Length() <= 1 || !args[1]->IsObject()) + return throwError(TYPE_MISMATCH_ERR); + RefPtr<TestCallback> callback = V8TestCallback::create(args[1]); + imp->methodWithNonCallbackArgAndCallbackArg(nonCallback, callback); + return v8::Handle<v8::Value>(); +} + +static v8::Handle<v8::Value> methodWithCallbackAndOptionalArgCallback(const v8::Arguments& args) +{ + INC_STATS("DOM.TestObj.methodWithCallbackAndOptionalArg"); + TestObj* imp = V8TestObj::toNative(args.Holder()); + if (args.Length() <= 0) { + imp->methodWithCallbackAndOptionalArg(); + return v8::Handle<v8::Value>(); + } + if (args.Length() <= 0 || !args[0]->IsObject()) + return throwError(TYPE_MISMATCH_ERR); + RefPtr<TestCallback> callback = V8TestCallback::create(args[0]); + imp->methodWithCallbackAndOptionalArg(callback); + return v8::Handle<v8::Value>(); +} + static v8::Handle<v8::Value> overloadedMethod1Callback(const v8::Arguments& args) { INC_STATS("DOM.TestObj.overloadedMethod1"); @@ -938,6 +1009,10 @@ static const BatchedAttribute TestObjAttrs[] = { {"stringAttr", TestObjInternal::stringAttrAttrGetter, TestObjInternal::stringAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, // Attribute 'testObjAttr' (Type: 'attribute' ExtAttr: '') {"testObjAttr", TestObjInternal::testObjAttrAttrGetter, TestObjInternal::testObjAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, + // Attribute 'XMLObjAttr' (Type: 'attribute' ExtAttr: '') + {"XMLObjAttr", TestObjInternal::XMLObjAttrAttrGetter, TestObjInternal::XMLObjAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, + // Attribute 'CREATE' (Type: 'attribute' ExtAttr: '') + {"CREATE", TestObjInternal::CREATEAttrGetter, TestObjInternal::CREATEAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, // Attribute 'reflectedStringAttr' (Type: 'attribute' ExtAttr: 'Reflect') {"reflectedStringAttr", TestObjInternal::reflectedStringAttrAttrGetter, TestObjInternal::reflectedStringAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, // Attribute 'reflectedIntegralAttr' (Type: 'attribute' ExtAttr: 'Reflect') @@ -1013,6 +1088,7 @@ static const BatchedCallback TestObjCallbacks[] = { {"methodWithOptionalArg", TestObjInternal::methodWithOptionalArgCallback}, {"methodWithNonOptionalArgAndOptionalArg", TestObjInternal::methodWithNonOptionalArgAndOptionalArgCallback}, {"methodWithNonOptionalArgAndTwoOptionalArgs", TestObjInternal::methodWithNonOptionalArgAndTwoOptionalArgsCallback}, + {"methodWithCallbackAndOptionalArg", TestObjInternal::methodWithCallbackAndOptionalArgCallback}, {"overloadedMethod", TestObjInternal::overloadedMethodCallback}, }; static const BatchedConstant TestObjConsts[] = { @@ -1085,6 +1161,18 @@ static v8::Persistent<v8::FunctionTemplate> ConfigureV8TestObjTemplate(v8::Persi v8::Handle<v8::FunctionTemplate> customArgsAndExceptionArgv[customArgsAndExceptionArgc] = { V8log::GetRawTemplate() }; v8::Handle<v8::Signature> customArgsAndExceptionSignature = v8::Signature::New(desc, customArgsAndExceptionArgc, customArgsAndExceptionArgv); proto->Set(v8::String::New("customArgsAndException"), v8::FunctionTemplate::New(TestObjInternal::customArgsAndExceptionCallback, v8::Handle<v8::Value>(), customArgsAndExceptionSignature)); + + // Custom Signature 'methodWithCallbackArg' + const int methodWithCallbackArgArgc = 1; + v8::Handle<v8::FunctionTemplate> methodWithCallbackArgArgv[methodWithCallbackArgArgc] = { V8TestCallback::GetRawTemplate() }; + v8::Handle<v8::Signature> methodWithCallbackArgSignature = v8::Signature::New(desc, methodWithCallbackArgArgc, methodWithCallbackArgArgv); + proto->Set(v8::String::New("methodWithCallbackArg"), v8::FunctionTemplate::New(TestObjInternal::methodWithCallbackArgCallback, v8::Handle<v8::Value>(), methodWithCallbackArgSignature)); + + // Custom Signature 'methodWithNonCallbackArgAndCallbackArg' + const int methodWithNonCallbackArgAndCallbackArgArgc = 2; + v8::Handle<v8::FunctionTemplate> methodWithNonCallbackArgAndCallbackArgArgv[methodWithNonCallbackArgAndCallbackArgArgc] = { v8::Handle<v8::FunctionTemplate>(), V8TestCallback::GetRawTemplate() }; + v8::Handle<v8::Signature> methodWithNonCallbackArgAndCallbackArgSignature = v8::Signature::New(desc, methodWithNonCallbackArgAndCallbackArgArgc, methodWithNonCallbackArgAndCallbackArgArgv); + proto->Set(v8::String::New("methodWithNonCallbackArgAndCallbackArg"), v8::FunctionTemplate::New(TestObjInternal::methodWithNonCallbackArgAndCallbackArgCallback, v8::Handle<v8::Value>(), methodWithNonCallbackArgAndCallbackArgSignature)); batchConfigureConstants(desc, proto, TestObjConsts, sizeof(TestObjConsts) / sizeof(*TestObjConsts)); // Custom toString template diff --git a/WebCore/bindings/v8/custom/V8IDBAnyCustom.cpp b/WebCore/bindings/v8/custom/V8IDBAnyCustom.cpp index def1120..2ec3dcd 100644 --- a/WebCore/bindings/v8/custom/V8IDBAnyCustom.cpp +++ b/WebCore/bindings/v8/custom/V8IDBAnyCustom.cpp @@ -33,10 +33,10 @@ #include "SerializedScriptValue.h" #include "V8IDBDatabaseRequest.h" -#include "V8IDBIndexRequest.h" +#include "V8IDBFactory.h" +#include "V8IDBIndex.h" #include "V8IDBKey.h" #include "V8IDBObjectStoreRequest.h" -#include "V8IndexedDatabaseRequest.h" namespace WebCore { @@ -52,14 +52,14 @@ v8::Handle<v8::Value> toV8(IDBAny* impl) return v8::Null(); case IDBAny::IDBDatabaseRequestType: return toV8(impl->idbDatabaseRequest()); - case IDBAny::IDBIndexRequestType: - return toV8(impl->idbIndexRequest()); + case IDBAny::IDBIndexType: + return toV8(impl->idbIndex()); case IDBAny::IDBKeyType: return toV8(impl->idbKey()); case IDBAny::IDBObjectStoreRequestType: return toV8(impl->idbObjectStoreRequest()); - case IDBAny::IndexedDatabaseRequestType: - return toV8(impl->indexedDatabaseRequest()); + case IDBAny::IDBFactoryType: + return toV8(impl->idbFactory()); case IDBAny::SerializedScriptValueType: return impl->serializedScriptValue()->deserialize(); } diff --git a/WebCore/config.h b/WebCore/config.h index 5d5c6c1..d9a5899 100644 --- a/WebCore/config.h +++ b/WebCore/config.h @@ -325,3 +325,4 @@ typedef float CGFloat; #if PLATFORM(WIN) && PLATFORM(CG) #define WTF_USE_SAFARI_THEME 1 #endif + diff --git a/WebCore/css/CSSFontFaceSrcValue.cpp b/WebCore/css/CSSFontFaceSrcValue.cpp index 21eea04..5b204d7 100644 --- a/WebCore/css/CSSFontFaceSrcValue.cpp +++ b/WebCore/css/CSSFontFaceSrcValue.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007 Apple Inc. All rights reserved. + * Copyright (C) 2007, 2010 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -26,6 +26,7 @@ #include "config.h" #include "CSSFontFaceSrcValue.h" #include "CSSStyleSheet.h" +#include "FontCustomPlatformData.h" #include "Node.h" namespace WebCore { @@ -48,10 +49,7 @@ bool CSSFontFaceSrcValue::isSupportedFormat() const return true; } - return equalIgnoringCase(m_format, "truetype") || equalIgnoringCase(m_format, "opentype") -#if ENABLE(OPENTYPE_SANITIZER) - || equalIgnoringCase(m_format, "woff") -#endif + return FontCustomPlatformData::supportsFormat(m_format) #if ENABLE(SVG_FONTS) || isSVGFontFaceSrc() #endif diff --git a/WebCore/css/CSSStyleSelector.cpp b/WebCore/css/CSSStyleSelector.cpp index 89d4f3e..6f64235 100644 --- a/WebCore/css/CSSStyleSelector.cpp +++ b/WebCore/css/CSSStyleSelector.cpp @@ -97,6 +97,11 @@ #include <wtf/StdLibExtras.h> #include <wtf/Vector.h> +#if USE(PLATFORM_STRATEGIES) +#include "PlatformStrategies.h" +#include "VisitedLinkStrategy.h" +#endif + #if ENABLE(DASHBOARD_SUPPORT) #include "DashboardRegion.h" #endif @@ -929,7 +934,12 @@ EInsideLink CSSStyleSelector::SelectorChecker::determineLinkStateSlowCase(Elemen return InsideUnvisitedLink; m_linksCheckedForVisitedState.add(hash); + +#if USE(PLATFORM_STRATEGIES) + return platformStrategies()->visitedLinkStrategy()->isLinkVisited(page, hash) ? InsideVisitedLink : InsideUnvisitedLink; +#else return page->group().isLinkVisited(hash) ? InsideVisitedLink : InsideUnvisitedLink; +#endif } bool CSSStyleSelector::SelectorChecker::checkSelector(CSSSelector* sel, Element* element) const diff --git a/WebCore/css/MediaFeatureNames.h b/WebCore/css/MediaFeatureNames.h index 8aaedb2..b8f2720 100644 --- a/WebCore/css/MediaFeatureNames.h +++ b/WebCore/css/MediaFeatureNames.h @@ -25,13 +25,6 @@ namespace WebCore { namespace MediaFeatureNames { -#if ENABLE(WIDGETS_10_SUPPORT) -#define CSS_MEDIAQUERY_NAMES_FOR_WIDGETS_10_MEDIAFEATURE(macro) \ - macro(view_mode, "-webkit-view-mode") -#else -#define CSS_MEDIAQUERY_NAMES_FOR_WIDGETS_10_MEDIAFEATURE(macro) -#endif - #define CSS_MEDIAQUERY_NAMES_FOR_EACH_MEDIAFEATURE(macro) \ macro(color, "color") \ macro(grid, "grid") \ @@ -66,7 +59,7 @@ namespace WebCore { macro(transform_3d, "-webkit-transform-3d") \ macro(transition, "-webkit-transition") \ macro(animation, "-webkit-animation") \ - CSS_MEDIAQUERY_NAMES_FOR_WIDGETS_10_MEDIAFEATURE(macro) + macro(view_mode, "-webkit-view-mode") // end of macro diff --git a/WebCore/css/MediaQueryEvaluator.cpp b/WebCore/css/MediaQueryEvaluator.cpp index 9d5822f..0b5507e 100644 --- a/WebCore/css/MediaQueryEvaluator.cpp +++ b/WebCore/css/MediaQueryEvaluator.cpp @@ -498,28 +498,13 @@ static bool transform_3dMediaFeatureEval(CSSValue* value, RenderStyle*, Frame* f return returnValueIfNoParameter; } -#if ENABLE(WIDGETS_10_SUPPORT) static bool view_modeMediaFeatureEval(CSSValue* value, RenderStyle*, Frame* frame, MediaFeaturePrefix op) { - if (value) { - String mode = static_cast<CSSPrimitiveValue*>(value)->getStringValue(); - if (ChromeClient* client = frame->page()->chrome()->client()) { - if (mode == "windowed" && client->isWindowed()) - return true; - if (mode == "floating" && client->isFloating()) - return true; - if (mode == "fullscreen" && client->isFullscreen()) - return true; - if (mode == "maximized" && client->isMaximized()) - return true; - if (mode == "minimized" && client->isMinimized()) - return true; - return false; - } - } - return true; + UNUSED_PARAM(op); + if (!value) + return true; + return Page::stringToViewMode(static_cast<CSSPrimitiveValue*>(value)->getStringValue()) == frame->page()->viewMode(); } -#endif static void createFunctionMap() { diff --git a/WebCore/dom/DeviceOrientationClient.h b/WebCore/dom/DeviceOrientationClient.h index 427412f..c969c95 100644 --- a/WebCore/dom/DeviceOrientationClient.h +++ b/WebCore/dom/DeviceOrientationClient.h @@ -29,15 +29,16 @@ namespace WebCore { class DeviceOrientation; +class DeviceOrientationController; class DeviceOrientationClient { public: + virtual ~DeviceOrientationClient() {} + + virtual void setController(DeviceOrientationController*) = 0; virtual void startUpdating() = 0; virtual void stopUpdating() = 0; virtual DeviceOrientation* lastOrientation() const = 0; - -protected: - virtual ~DeviceOrientationClient() {} }; } // namespace WebCore diff --git a/WebCore/dom/DeviceOrientationController.cpp b/WebCore/dom/DeviceOrientationController.cpp index a6a33f5..111577f 100644 --- a/WebCore/dom/DeviceOrientationController.cpp +++ b/WebCore/dom/DeviceOrientationController.cpp @@ -26,8 +26,6 @@ #include "config.h" #include "DeviceOrientationController.h" -#if ENABLE(DEVICE_ORIENTATION) - #include "DeviceOrientation.h" #include "DeviceOrientationClient.h" #include "DeviceOrientationEvent.h" @@ -39,6 +37,8 @@ DeviceOrientationController::DeviceOrientationController(Page* page, DeviceOrien , m_client(client) , m_timer(this, &DeviceOrientationController::timerFired) { + ASSERT(m_client); + m_client->setController(this); } void DeviceOrientationController::timerFired(Timer<DeviceOrientationController>* timer) @@ -105,5 +105,3 @@ void DeviceOrientationController::didChangeDeviceOrientation(DeviceOrientation* } } // namespace WebCore - -#endif // ENABLE(DEVICE_ORIENTATION) diff --git a/WebCore/dom/DeviceOrientationEvent.cpp b/WebCore/dom/DeviceOrientationEvent.cpp index 992b6ce..932cb75 100644 --- a/WebCore/dom/DeviceOrientationEvent.cpp +++ b/WebCore/dom/DeviceOrientationEvent.cpp @@ -28,8 +28,6 @@ #include "DeviceOrientation.h" -#if ENABLE(DEVICE_ORIENTATION) - namespace WebCore { DeviceOrientationEvent::~DeviceOrientationEvent() @@ -57,5 +55,3 @@ void DeviceOrientationEvent::initDeviceOrientationEvent(const AtomicString& type } } // namespace WebCore - -#endif // ENABLE(DEVICE_ORIENTATION) diff --git a/WebCore/dom/Document.cpp b/WebCore/dom/Document.cpp index f1571cd..8447f22 100644 --- a/WebCore/dom/Document.cpp +++ b/WebCore/dom/Document.cpp @@ -119,6 +119,7 @@ #include "SegmentedString.h" #include "SelectionController.h" #include "Settings.h" +#include "StaticHashSetNodeList.h" #include "StringBuffer.h" #include "StyleSheetList.h" #include "TextEvent.h" @@ -1034,6 +1035,63 @@ KURL Document::baseURI() const return m_baseURL; } +// FIXME: We need to discuss the DOM API here at some point. Ideas: +// * making it receive a rect as parameter, i.e. nodesFromRect(x, y, w, h); +// * making it receive the expading size of each direction separately, +// i.e. nodesFromRect(x, y, topSize, rightSize, bottomSize, leftSize); +PassRefPtr<NodeList> Document::nodesFromRect(int centerX, int centerY, unsigned hPadding, unsigned vPadding, bool ignoreClipping) const +{ + // FIXME: Share code between this, elementFromPoint and caretRangeFromPoint. + if (!renderer()) + return 0; + Frame* frame = this->frame(); + if (!frame) + return 0; + FrameView* frameView = frame->view(); + if (!frameView) + return 0; + + float zoomFactor = frameView->pageZoomFactor(); + IntPoint point = roundedIntPoint(FloatPoint(centerX * zoomFactor + view()->scrollX(), centerY * zoomFactor + view()->scrollY())); + IntSize padding(hPadding, vPadding); + + int type = HitTestRequest::ReadOnly | HitTestRequest::Active; + + // When ignoreClipping is false, this method returns null for coordinates outside of the viewport. + if (ignoreClipping) + type |= HitTestRequest::IgnoreClipping; + else if (!frameView->visibleContentRect().intersects(IntRect(point, padding))) + return 0; + + HitTestRequest request(type); + + // Passing a zero padding will trigger a rect hit test, however for the purposes of nodesFromRect, + // we special handle this case in order to return a valid NodeList. + if (padding.isZero()) { + HitTestResult result(point); + return handleZeroPadding(request, result); + } + + HitTestResult result(point, padding); + renderView()->layer()->hitTest(request, result); + + return StaticHashSetNodeList::adopt(result.rectBasedTestResult()); +} + +PassRefPtr<NodeList> Document::handleZeroPadding(const HitTestRequest& request, HitTestResult& result) const +{ + renderView()->layer()->hitTest(request, result); + + Node* node = result.innerNode(); + if (!node) + return 0; + + node = node->shadowAncestorNode(); + ListHashSet<RefPtr<Node> > list; + list.add(node); + return StaticHashSetNodeList::adopt(list); +} + Element* Document::elementFromPoint(int x, int y) const { // FIXME: Share code between this and caretRangeFromPoint. @@ -1431,7 +1489,7 @@ void Document::recalcStyle(StyleChange change) #endif bail_out: - setNeedsStyleRecalc(NoStyleChange); + clearNeedsStyleRecalc(); clearChildNeedsStyleRecalc(); unscheduleStyleRecalc(); diff --git a/WebCore/dom/Document.h b/WebCore/dom/Document.h index 5bc3fa3..36379ee 100644 --- a/WebCore/dom/Document.h +++ b/WebCore/dom/Document.h @@ -87,6 +87,7 @@ namespace WebCore { class HTMLMapElement; class HistoryItem; class HitTestRequest; + class HitTestResult; class InspectorTimelineAgent; class IntPoint; class DOMWrapperWorld; @@ -302,6 +303,18 @@ public: bool hasElementWithId(AtomicStringImpl* id) const; bool containsMultipleElementsWithId(const AtomicString& elementId) { return m_duplicateIds.contains(elementId.impl()); } + /** + * Retrieve all nodes that intersect a rect in the window's document, until it is fully enclosed by + * the boundaries of node. + * + * @param centerX x reference for the rectangle in CSS pixels + * @param centerY y reference for the rectangle in CSS pixels + * @param hPadding How much to expand the rectangle horizontally + * @param vPadding How much to expand the rectangle vertically + * @param ignoreClipping whether or not to ignore the root scroll frame when retrieving the element. + * If false, this method returns null for coordinates outside of the viewport. + */ + PassRefPtr<NodeList> nodesFromRect(int centerX, int centerY, unsigned hPadding, unsigned vPadding, bool ignoreClipping) const; Element* elementFromPoint(int x, int y) const; PassRefPtr<Range> caretRangeFromPoint(int x, int y); @@ -1059,6 +1072,8 @@ private: void enqueuePopstateEvent(PassRefPtr<SerializedScriptValue> stateObject); void pendingEventTimerFired(Timer<Document>*); + PassRefPtr<NodeList> handleZeroPadding(const HitTestRequest&, HitTestResult&) const; + OwnPtr<CSSStyleSelector> m_styleSelector; bool m_didCalculateStyleSelector; diff --git a/WebCore/dom/Document.idl b/WebCore/dom/Document.idl index 9599d76..3ae551e 100644 --- a/WebCore/dom/Document.idl +++ b/WebCore/dom/Document.idl @@ -186,6 +186,11 @@ module core { readonly attribute [ConvertNullStringTo=Undefined] DOMString defaultCharset; readonly attribute [ConvertNullStringTo=Undefined] DOMString readyState; + + NodeList nodesFromRect(in long x, in long y, + in unsigned long hPadding, + in unsigned long vPadding, + in boolean ignoreClipping); Element elementFromPoint(in long x, in long y); Range caretRangeFromPoint(in long x, in long y); diff --git a/WebCore/dom/Element.cpp b/WebCore/dom/Element.cpp index a1ff56d..2fa75ce 100644 --- a/WebCore/dom/Element.cpp +++ b/WebCore/dom/Element.cpp @@ -905,7 +905,7 @@ void Element::recalcStyle(StyleChange change) detach(); attach(); // FIXME: The style gets computed twice by calling attach. We could do better if we passed the style along. // attach recalulates the style for all children. No need to do it twice. - setNeedsStyleRecalc(NoStyleChange); + clearNeedsStyleRecalc(); clearChildNeedsStyleRecalc(); return; } @@ -971,7 +971,7 @@ void Element::recalcStyle(StyleChange change) forceCheckOfNextElementSibling = childRulesChanged && hasDirectAdjacentRules; } - setNeedsStyleRecalc(NoStyleChange); + clearNeedsStyleRecalc(); clearChildNeedsStyleRecalc(); } @@ -1330,9 +1330,13 @@ void Element::updateFocusAppearance(bool /*restorePreviousSelection*/) Frame* frame = document()->frame(); if (!frame) return; + + // When focusing an editable element in an iframe, don't reset the selection if it already contains a selection. + if (this == frame->selection()->rootEditableElement()) + return; // FIXME: We should restore the previous selection if there is one. - VisibleSelection newSelection = hasTagName(htmlTag) || hasTagName(bodyTag) ? VisibleSelection(Position(this, 0), DOWNSTREAM) : VisibleSelection::selectionFromContentsOfNode(this); + VisibleSelection newSelection = VisibleSelection(Position(this, 0), DOWNSTREAM); if (frame->shouldChangeSelection(newSelection)) { frame->selection()->setSelection(newSelection); diff --git a/WebCore/dom/Node.cpp b/WebCore/dom/Node.cpp index 2032612..6e1bd13 100644 --- a/WebCore/dom/Node.cpp +++ b/WebCore/dom/Node.cpp @@ -731,15 +731,18 @@ inline void Node::setStyleChange(StyleChangeType changeType) void Node::setNeedsStyleRecalc(StyleChangeType changeType) { - if ((changeType != NoStyleChange) && !attached()) // changed compared to what? + ASSERT(changeType != NoStyleChange); + if (!attached()) // changed compared to what? return; - if (!(changeType == InlineStyleChange && (styleChangeType() == FullStyleChange || styleChangeType() == SyntheticStyleChange))) + StyleChangeType existingChangeType = styleChangeType(); + if (changeType > existingChangeType) setStyleChange(changeType); - if (styleChangeType() != NoStyleChange) { + if (existingChangeType == NoStyleChange) { for (Node* p = parentNode(); p && !p->childNeedsStyleRecalc(); p = p->parentNode()) p->setChildNeedsStyleRecalc(); + if (document()->childNeedsStyleRecalc()) document()->scheduleStyleRecalc(); } @@ -1261,6 +1264,7 @@ void Node::attach() } setAttached(); + clearNeedsStyleRecalc(); } void Node::willRemove() diff --git a/WebCore/dom/Node.h b/WebCore/dom/Node.h index a839c0e..8a76084 100644 --- a/WebCore/dom/Node.h +++ b/WebCore/dom/Node.h @@ -309,7 +309,10 @@ public: void setInActiveChain() { setFlag(InActiveChainFlag); } void clearInActiveChain() { clearFlag(InActiveChainFlag); } + void setNeedsStyleRecalc(StyleChangeType changeType = FullStyleChange); + void clearNeedsStyleRecalc() { m_nodeFlags &= ~StyleChangeMask; } + void setIsLink(bool f) { setFlag(f, IsLinkFlag); } void setIsLink() { setFlag(IsLinkFlag); } void clearIsLink() { clearFlag(IsLinkFlag); } diff --git a/WebCore/dom/Range.cpp b/WebCore/dom/Range.cpp index a5abdd4..33a21bb 100644 --- a/WebCore/dom/Range.cpp +++ b/WebCore/dom/Range.cpp @@ -94,8 +94,7 @@ PassRefPtr<Range> Range::create(PassRefPtr<Document> ownerDocument, PassRefPtr<N PassRefPtr<Range> Range::create(PassRefPtr<Document> ownerDocument, const Position& start, const Position& end) { - // FIXME: we shouldn't be using deprecatedEditingOffset here - return adoptRef(new Range(ownerDocument, start.node(), start.deprecatedEditingOffset(), end.node(), end.deprecatedEditingOffset())); + return adoptRef(new Range(ownerDocument, start.containerNode(), start.computeOffsetInContainerNode(), end.containerNode(), end.computeOffsetInContainerNode())); } Range::~Range() diff --git a/WebCore/dom/StyleElement.cpp b/WebCore/dom/StyleElement.cpp index 580f318..4c0e56f 100644 --- a/WebCore/dom/StyleElement.cpp +++ b/WebCore/dom/StyleElement.cpp @@ -26,11 +26,17 @@ #include "Element.h" #include "MediaList.h" #include "MediaQueryEvaluator.h" +#include "ScriptableDocumentParser.h" namespace WebCore { -StyleElement::StyleElement() +StyleElement::StyleElement(Document* document, bool createdByParser) + : m_createdByParser(createdByParser) + , m_loading(false) + , m_startLineNumber(0) { + if (createdByParser && document && document->scriptableDocumentParser()) + m_startLineNumber = document->scriptableDocumentParser()->lineNumber(); } StyleSheet* StyleElement::sheet(Element* e) @@ -40,13 +46,23 @@ StyleSheet* StyleElement::sheet(Element* e) return m_sheet.get(); } -void StyleElement::insertedIntoDocument(Document*, Element* element) +void StyleElement::insertedIntoDocument(Document* document, Element* element) { - process(element, 0); + ASSERT(document); + ASSERT(element); + document->addStyleSheetCandidateNode(element, m_createdByParser); + if (m_createdByParser) + return; + + process(element); } -void StyleElement::removedFromDocument(Document* document) +void StyleElement::removedFromDocument(Document* document, Element* element) { + ASSERT(document); + ASSERT(element); + document->removeStyleSheetCandidateNode(element); + // If we're in document teardown, then we don't need to do any notification of our sheet's removal. if (!document->renderer()) return; @@ -56,7 +72,24 @@ void StyleElement::removedFromDocument(Document* document) document->updateStyleSelector(); } -void StyleElement::process(Element* e, int startLineNumber) +void StyleElement::childrenChanged(Element* element) +{ + ASSERT(element); + if (m_createdByParser) + return; + + process(element); +} + +void StyleElement::finishParsingChildren(Element* element) +{ + ASSERT(element); + process(element); + sheet(element); + m_createdByParser = false; +} + +void StyleElement::process(Element* e) { if (!e || !e->inDocument()) return; @@ -82,14 +115,15 @@ void StyleElement::process(Element* e, int startLineNumber) } ASSERT(p == text + resultLength); - createSheet(e, startLineNumber, sheetText); + createSheet(e, m_startLineNumber, sheetText); } void StyleElement::createSheet(Element* e, int startLineNumber, const String& text) { + ASSERT(e); Document* document = e->document(); if (m_sheet) { - if (static_cast<CSSStyleSheet*>(m_sheet.get())->isLoading()) + if (m_sheet->isLoading()) document->removePendingSheet(); m_sheet = 0; } @@ -102,12 +136,12 @@ void StyleElement::createSheet(Element* e, int startLineNumber, const String& te MediaQueryEvaluator printEval("print", true); if (screenEval.eval(mediaList.get()) || printEval.eval(mediaList.get())) { document->addPendingSheet(); - setLoading(true); + m_loading = true; m_sheet = CSSStyleSheet::create(e, String(), KURL(), document->inputEncoding()); m_sheet->parseStringAtLine(text, !document->inCompatMode(), startLineNumber); m_sheet->setMedia(mediaList.get()); m_sheet->setTitle(e->title()); - setLoading(false); + m_loading = false; } } @@ -115,4 +149,21 @@ void StyleElement::createSheet(Element* e, int startLineNumber, const String& te m_sheet->checkLoaded(); } +bool StyleElement::isLoading() const +{ + if (m_loading) + return true; + return m_sheet ? m_sheet->isLoading() : false; +} + +bool StyleElement::sheetLoaded(Document* document) +{ + ASSERT(document); + if (isLoading()) + return false; + + document->removePendingSheet(); + return true; +} + } diff --git a/WebCore/dom/StyleElement.h b/WebCore/dom/StyleElement.h index 4ec10c4..00e45ed 100644 --- a/WebCore/dom/StyleElement.h +++ b/WebCore/dom/StyleElement.h @@ -17,6 +17,7 @@ * Boston, MA 02110-1301, USA. * */ + #ifndef StyleElement_h #define StyleElement_h @@ -29,27 +30,34 @@ class Element; class StyleElement { public: - StyleElement(); + StyleElement(Document*, bool createdByParser); virtual ~StyleElement() {} protected: - StyleSheet* sheet(Element*); - - virtual void setLoading(bool) {} - virtual const AtomicString& type() const = 0; virtual const AtomicString& media() const = 0; - void insertedIntoDocument(Document*, Element*); - void removedFromDocument(Document*); - void process(Element*, int startLineNumber); + StyleSheet* sheet(Element*); - void createSheet(Element* e, int startLineNumber, const String& text = String()); + bool isLoading() const; + bool sheetLoaded(Document*); + + void insertedIntoDocument(Document*, Element*); + void removedFromDocument(Document*, Element*); + void childrenChanged(Element*); + void finishParsingChildren(Element*); -protected: RefPtr<CSSStyleSheet> m_sheet; + +private: + void createSheet(Element*, int startLineNumber, const String& text = String()); + void process(Element*); + + bool m_createdByParser; + bool m_loading; + int m_startLineNumber; }; -} //namespace +} #endif diff --git a/WebCore/dom/Text.cpp b/WebCore/dom/Text.cpp index 1589b11..928b975 100644 --- a/WebCore/dom/Text.cpp +++ b/WebCore/dom/Text.cpp @@ -284,7 +284,7 @@ void Text::recalcStyle(StyleChange change) attach(); } } - setNeedsStyleRecalc(NoStyleChange); + clearNeedsStyleRecalc(); } bool Text::childTypeAllowed(NodeType) diff --git a/WebCore/editing/ApplyStyleCommand.cpp b/WebCore/editing/ApplyStyleCommand.cpp index 8847714..d865468 100644 --- a/WebCore/editing/ApplyStyleCommand.cpp +++ b/WebCore/editing/ApplyStyleCommand.cpp @@ -910,7 +910,10 @@ void ApplyStyleCommand::applyInlineStyle(CSSMutableStyleDeclaration *style) // split the start node and containing element if the selection starts inside of it bool splitStart = isValidCaretPositionInTextNode(start); if (splitStart) { - splitTextElementAtStart(start, end); + if (shouldSplitTextElement(start.node()->parentElement(), style)) + splitTextElementAtStart(start, end); + else + splitTextAtStart(start, end); start = startPosition(); end = endPosition(); startDummySpanAncestor = dummySpanAncestorForNode(start.node()); @@ -919,7 +922,10 @@ void ApplyStyleCommand::applyInlineStyle(CSSMutableStyleDeclaration *style) // split the end node and containing element if the selection ends inside of it bool splitEnd = isValidCaretPositionInTextNode(end); if (splitEnd) { - splitTextElementAtEnd(start, end); + if (shouldSplitTextElement(end.node()->parentElement(), style)) + splitTextElementAtEnd(start, end); + else + splitTextAtEnd(start, end); start = startPosition(); end = endPosition(); endDummySpanAncestor = dummySpanAncestorForNode(end.node()); @@ -1176,6 +1182,40 @@ bool ApplyStyleCommand::implicitlyStyledElementShouldBeRemovedWhenApplyingStyle( return false; } +bool ApplyStyleCommand::removeInlineStyleFromElement(CSSMutableStyleDeclaration* style, HTMLElement* element, InlineStyleRemovalMode mode) +{ + ASSERT(style); + ASSERT(element); + + bool removed = false; + + if (m_styledInlineElement && element->hasTagName(m_styledInlineElement->tagQName())) { + removed = true; + if (mode == RemoveAttributesAndElements) + removeNodePreservingChildren(element); + } + + if (implicitlyStyledElementShouldBeRemovedWhenApplyingStyle(element, style)) { + removed = true; + if (mode == RemoveAttributesAndElements) + replaceWithSpanOrRemoveIfWithoutAttributes(element); + } + + if (!element->inDocument()) + return removed; + + // If the node was converted to a span, the span may still contain relevant + // styles which must be removed (e.g. <b style='font-weight: bold'>) + if (removeHTMLFontStyle(style, element, mode)) + removed = true; + if (removeHTMLBidiEmbeddingStyle(style, element, mode)) + removed = true; + if (removeCSSStyle(style, element, mode)) + removed = true; + + return removed; +} + void ApplyStyleCommand::replaceWithSpanOrRemoveIfWithoutAttributes(HTMLElement*& elem) { bool removeNode = false; @@ -1200,65 +1240,84 @@ void ApplyStyleCommand::replaceWithSpanOrRemoveIfWithoutAttributes(HTMLElement*& } } -void ApplyStyleCommand::removeHTMLFontStyle(CSSMutableStyleDeclaration *style, HTMLElement *elem) +bool ApplyStyleCommand::removeHTMLFontStyle(CSSMutableStyleDeclaration* style, HTMLElement* elem, InlineStyleRemovalMode mode) { ASSERT(style); ASSERT(elem); if (!elem->hasLocalName(fontTag)) - return; - + return false; + + bool removed = false; CSSMutableStyleDeclaration::const_iterator end = style->end(); for (CSSMutableStyleDeclaration::const_iterator it = style->begin(); it != end; ++it) { + const QualifiedName* attrToRemove = 0; switch ((*it).id()) { - case CSSPropertyColor: - removeNodeAttribute(elem, colorAttr); - break; - case CSSPropertyFontFamily: - removeNodeAttribute(elem, faceAttr); - break; - case CSSPropertyFontSize: - removeNodeAttribute(elem, sizeAttr); - break; + case CSSPropertyColor: + attrToRemove = &colorAttr; + break; + case CSSPropertyFontFamily: + attrToRemove = &faceAttr; + break; + case CSSPropertyFontSize: + attrToRemove = &sizeAttr; + break; + } + + if (attrToRemove) { + removed = true; + if (mode == RemoveAttributesAndElements) + removeNodeAttribute(elem, *attrToRemove); } } - if (isEmptyFontTag(elem)) + if (isEmptyFontTag(elem) && mode == RemoveAttributesAndElements) removeNodePreservingChildren(elem); + + return removed; } -void ApplyStyleCommand::removeHTMLBidiEmbeddingStyle(CSSMutableStyleDeclaration *style, HTMLElement *elem) +bool ApplyStyleCommand::removeHTMLBidiEmbeddingStyle(CSSMutableStyleDeclaration* style, HTMLElement* elem, InlineStyleRemovalMode mode) { ASSERT(style); ASSERT(elem); if (!elem->hasAttribute(dirAttr)) - return; + return false; if (!style->getPropertyCSSValue(CSSPropertyUnicodeBidi) && !style->getPropertyCSSValue(CSSPropertyDirection)) - return; + return false; + + if (mode == RemoveNone) + return true; removeNodeAttribute(elem, dirAttr); // FIXME: should this be isSpanWithoutAttributesOrUnstyleStyleSpan? Need a test. if (isUnstyledStyleSpan(elem)) removeNodePreservingChildren(elem); + + return true; } -void ApplyStyleCommand::removeCSSStyle(CSSMutableStyleDeclaration* style, HTMLElement* elem) +bool ApplyStyleCommand::removeCSSStyle(CSSMutableStyleDeclaration* style, HTMLElement* elem, InlineStyleRemovalMode mode) { ASSERT(style); ASSERT(elem); CSSMutableStyleDeclaration* decl = elem->inlineStyleDecl(); if (!decl) - return; + return false; + bool removed = false; CSSMutableStyleDeclaration::const_iterator end = style->end(); for (CSSMutableStyleDeclaration::const_iterator it = style->begin(); it != end; ++it) { CSSPropertyID propertyID = static_cast<CSSPropertyID>((*it).id()); RefPtr<CSSValue> value = decl->getPropertyCSSValue(propertyID); if (value && (propertyID != CSSPropertyWhiteSpace || !isTabSpanNode(elem))) { + removed = true; + if (mode == RemoveNone) + return true; removeCSSProperty(decl, propertyID); if (propertyID == CSSPropertyUnicodeBidi && !decl->getPropertyValue(CSSPropertyDirection).isEmpty()) removeCSSProperty(decl, CSSPropertyDirection); @@ -1271,6 +1330,8 @@ void ApplyStyleCommand::removeCSSStyle(CSSMutableStyleDeclaration* style, HTMLEl if (isSpanWithoutAttributesOrUnstyleStyleSpan(elem)) removeNodePreservingChildren(elem); + + return removed; } static bool hasTextDecorationProperty(Node *node) @@ -1472,19 +1533,7 @@ void ApplyStyleCommand::removeInlineStyle(PassRefPtr<CSSMutableStyleDeclaration> HTMLElement* elem = static_cast<HTMLElement*>(node); Node* prev = elem->traversePreviousNodePostOrder(); Node* next = elem->traverseNextNode(); - if (m_styledInlineElement && elem->hasTagName(m_styledInlineElement->tagQName())) - removeNodePreservingChildren(elem); - - if (implicitlyStyledElementShouldBeRemovedWhenApplyingStyle(elem, style.get())) - replaceWithSpanOrRemoveIfWithoutAttributes(elem); - - // If the node was converted to a span, the span may still contain relevant - // styles which must be removed (e.g. <b style='font-weight: bold'>) - if (elem->inDocument()) { - removeHTMLFontStyle(style.get(), elem); - removeHTMLBidiEmbeddingStyle(style.get(), elem); - removeCSSStyle(style.get(), elem); - } + removeInlineStyleFromElement(style.get(), elem); if (!elem->inDocument()) { if (s.node() == elem) { // Since elem must have been fully selected, and it is at the start @@ -1554,10 +1603,6 @@ void ApplyStyleCommand::splitTextAtEnd(const Position& start, const Position& en void ApplyStyleCommand::splitTextElementAtStart(const Position& start, const Position& end) { - Node* parent = start.node()->parentNode(); - if (!parent || !parent->parentElement() || !parent->parentElement()->isContentEditable()) - return splitTextAtStart(start, end); - int endOffsetAdjustment = start.node() == end.node() ? start.deprecatedEditingOffset() : 0; Text* text = static_cast<Text*>(start.node()); splitTextNodeContainingElement(text, start.deprecatedEditingOffset()); @@ -1566,10 +1611,6 @@ void ApplyStyleCommand::splitTextElementAtStart(const Position& start, const Pos void ApplyStyleCommand::splitTextElementAtEnd(const Position& start, const Position& end) { - Node* parent = end.node()->parentNode(); - if (!parent || !parent->parentElement() || !parent->parentElement()->isContentEditable()) - return splitTextAtEnd(start, end); - Text* text = static_cast<Text*>(end.node()); splitTextNodeContainingElement(text, end.deprecatedEditingOffset()); @@ -1580,6 +1621,14 @@ void ApplyStyleCommand::splitTextElementAtEnd(const Position& start, const Posit updateStartEnd(Position(startNode, start.deprecatedEditingOffset()), Position(prevNode->parent(), prevNode->nodeIndex() + 1)); } +bool ApplyStyleCommand::shouldSplitTextElement(Element* element, CSSMutableStyleDeclaration* style) +{ + if (!element || !element->isHTMLElement() || !element->parentElement() || !element->parentElement()->isContentEditable()) + return false; + + return shouldRemoveInlineStyleFromElement(style, static_cast<HTMLElement*>(element)); +} + bool ApplyStyleCommand::isValidCaretPositionInTextNode(const Position& position) { Node* node = position.node(); diff --git a/WebCore/editing/ApplyStyleCommand.h b/WebCore/editing/ApplyStyleCommand.h index 199b9db..0aa8110 100644 --- a/WebCore/editing/ApplyStyleCommand.h +++ b/WebCore/editing/ApplyStyleCommand.h @@ -42,6 +42,7 @@ enum ShouldIncludeTypingStyle { class ApplyStyleCommand : public CompositeEditCommand { public: enum EPropertyLevel { PropertyDefault, ForceBlockProperties }; + enum InlineStyleRemovalMode { RemoveAttributesAndElements, RemoveNone }; static PassRefPtr<ApplyStyleCommand> create(Document* document, CSSStyleDeclaration* style, EditAction action = EditActionChangeAttributes, EPropertyLevel level = PropertyDefault) { @@ -71,10 +72,12 @@ private: // style-removal helpers bool shouldRemoveTextDecorationTag(CSSStyleDeclaration* styleToApply, int textDecorationAddedByTag) const; bool implicitlyStyledElementShouldBeRemovedWhenApplyingStyle(HTMLElement*, CSSMutableStyleDeclaration*); + bool removeInlineStyleFromElement(CSSMutableStyleDeclaration*, HTMLElement*, InlineStyleRemovalMode = RemoveAttributesAndElements); + inline bool shouldRemoveInlineStyleFromElement(CSSMutableStyleDeclaration* style, HTMLElement* element) {return removeInlineStyleFromElement(style, element, RemoveNone);} void replaceWithSpanOrRemoveIfWithoutAttributes(HTMLElement*&); - void removeHTMLFontStyle(CSSMutableStyleDeclaration*, HTMLElement*); - void removeHTMLBidiEmbeddingStyle(CSSMutableStyleDeclaration*, HTMLElement*); - void removeCSSStyle(CSSMutableStyleDeclaration*, HTMLElement*); + bool removeHTMLFontStyle(CSSMutableStyleDeclaration*, HTMLElement*, InlineStyleRemovalMode = RemoveAttributesAndElements); + bool removeHTMLBidiEmbeddingStyle(CSSMutableStyleDeclaration*, HTMLElement*, InlineStyleRemovalMode = RemoveAttributesAndElements); + bool removeCSSStyle(CSSMutableStyleDeclaration*, HTMLElement*, InlineStyleRemovalMode = RemoveAttributesAndElements); void removeInlineStyle(PassRefPtr<CSSMutableStyleDeclaration>, const Position& start, const Position& end); bool nodeFullySelected(Node*, const Position& start, const Position& end) const; bool nodeFullyUnselected(Node*, const Position& start, const Position& end) const; @@ -95,6 +98,7 @@ private: void splitTextAtEnd(const Position& start, const Position& end); void splitTextElementAtStart(const Position& start, const Position& end); void splitTextElementAtEnd(const Position& start, const Position& end); + bool shouldSplitTextElement(Element* elem, CSSMutableStyleDeclaration*); bool isValidCaretPositionInTextNode(const Position& position); bool mergeStartWithPreviousIfIdentical(const Position& start, const Position& end); bool mergeEndWithNextIfIdentical(const Position& start, const Position& end); diff --git a/WebCore/editing/InsertListCommand.cpp b/WebCore/editing/InsertListCommand.cpp index 8f9c0de..59a8bce 100644 --- a/WebCore/editing/InsertListCommand.cpp +++ b/WebCore/editing/InsertListCommand.cpp @@ -54,6 +54,42 @@ HTMLElement* InsertListCommand::fixOrphanedListChild(Node* node) return listElement.get(); } +PassRefPtr<HTMLElement> InsertListCommand::mergeWithNeighboringLists(PassRefPtr<HTMLElement> passedList) +{ + RefPtr<HTMLElement> list = passedList; + Element* previousList = list->previousElementSibling(); + if (canMergeLists(previousList, list.get())) + mergeIdenticalElements(previousList, list); + + if (!list || !list->nextElementSibling() || !list->nextElementSibling()->isHTMLElement()) + return list.release(); + + RefPtr<HTMLElement> nextList = static_cast<HTMLElement*>(list->nextElementSibling()); + if (canMergeLists(list.get(), nextList.get())) { + mergeIdenticalElements(list, nextList); + return nextList.release(); + } + return list.release(); +} + +bool InsertListCommand::selectionHasListOfType(const VisibleSelection& selection, const QualifiedName& listTag) +{ + VisiblePosition start = selection.visibleStart(); + + if (!enclosingList(start.deepEquivalent().node())) + return false; + + VisiblePosition end = selection.visibleEnd(); + while (start.isNotNull() && start != end) { + Element* listNode = enclosingList(start.deepEquivalent().node()); + if (!listNode || !listNode->hasTagName(listTag)) + return false; + start = startOfNextParagraph(start); + } + + return true; +} + InsertListCommand::InsertListCommand(Document* document, Type type) : CompositeEditCommand(document), m_type(type) { @@ -80,6 +116,7 @@ void InsertListCommand::doApply() if (visibleEnd != visibleStart && isStartOfParagraph(visibleEnd)) setEndingSelection(VisibleSelection(visibleStart, visibleEnd.previous(true))); + const QualifiedName& listTag = (m_type == OrderedList) ? olTag : ulTag; if (endingSelection().isRange()) { VisibleSelection selection = selectionForParagraphIteration(endingSelection()); ASSERT(selection.isRange()); @@ -88,10 +125,9 @@ void InsertListCommand::doApply() VisiblePosition startOfLastParagraph = startOfParagraph(endOfSelection); if (startOfParagraph(startOfSelection) != startOfLastParagraph) { - Node* startList = enclosingList(startOfSelection.deepEquivalent().node()); - Node* endList = enclosingList(endOfSelection.deepEquivalent().node()); - bool forceCreateList = !startList || startList != endList; + bool forceCreateList = !selectionHasListOfType(selection, listTag); + RefPtr<Range> currentSelection = endingSelection().firstRange(); VisiblePosition startOfCurrentParagraph = startOfSelection; while (startOfCurrentParagraph != startOfLastParagraph) { // doApply() may operate on and remove the last paragraph of the selection from the document @@ -102,7 +138,7 @@ void InsertListCommand::doApply() if (!startOfLastParagraph.deepEquivalent().node()->inDocument()) return; setEndingSelection(startOfCurrentParagraph); - doApplyForSingleParagraph(forceCreateList); + doApplyForSingleParagraph(forceCreateList, listTag, currentSelection.get()); // Fetch the start of the selection after moving the first paragraph, // because moving the paragraph will invalidate the original start. @@ -114,7 +150,7 @@ void InsertListCommand::doApply() startOfCurrentParagraph = startOfNextParagraph(endingSelection().visibleStart()); } setEndingSelection(endOfSelection); - doApplyForSingleParagraph(forceCreateList); + doApplyForSingleParagraph(forceCreateList, listTag, currentSelection.get()); // Fetch the end of the selection, for the reason mentioned above. endOfSelection = endingSelection().visibleEnd(); setEndingSelection(VisibleSelection(startOfSelection, endOfSelection)); @@ -122,28 +158,44 @@ void InsertListCommand::doApply() } } - doApplyForSingleParagraph(false); + doApplyForSingleParagraph(false, listTag, endingSelection().firstRange().get()); } -void InsertListCommand::doApplyForSingleParagraph(bool forceCreateList) +void InsertListCommand::doApplyForSingleParagraph(bool forceCreateList, const QualifiedName& listTag, Range* currentSelection) { // FIXME: This will produce unexpected results for a selection that starts just before a // table and ends inside the first cell, selectionForParagraphIteration should probably // be renamed and deployed inside setEndingSelection(). Node* selectionNode = endingSelection().start().node(); - const QualifiedName listTag = (m_type == OrderedList) ? olTag : ulTag; Node* listChildNode = enclosingListChild(selectionNode); bool switchListType = false; if (listChildNode) { // Remove the list chlild. - HTMLElement* listNode = enclosingList(listChildNode); - if (!listNode) + RefPtr<HTMLElement> listNode = enclosingList(listChildNode); + if (!listNode) { listNode = fixOrphanedListChild(listChildNode); + listNode = mergeWithNeighboringLists(listNode); + } if (!listNode->hasTagName(listTag)) // listChildNode will be removed from the list and a list of type m_type will be created. switchListType = true; - unlistifyParagraph(endingSelection().visibleStart(), listNode, listChildNode); + // If the list is of the desired type, and we are not removing the list, then exit early. + if (!switchListType && forceCreateList) + return; + + // If the entire list is selected, then convert the whole list. + if (switchListType && isNodeVisiblyContainedWithin(listNode.get(), currentSelection)) { + RefPtr<HTMLElement> newList = createHTMLElement(document(), listTag); + insertNodeBefore(newList, listNode); + Node* outerBlock = listChildNode->isBlockFlow() ? listChildNode : listNode.get(); + moveParagraphWithClones(firstPositionInNode(listNode.get()), lastPositionInNode(listNode.get()), newList.get(), outerBlock); + newList = mergeWithNeighboringLists(newList); + setEndingSelection(VisiblePosition(firstPositionInNode(newList.get()))); + return; + } + + unlistifyParagraph(endingSelection().visibleStart(), listNode.get(), listChildNode); } if (!listChildNode || switchListType || forceCreateList) @@ -285,20 +337,10 @@ PassRefPtr<HTMLElement> InsertListCommand::listifyParagraph(const VisiblePositio moveParagraph(start, end, VisiblePosition(Position(placeholder.get(), 0)), true); - // FIXME: listifyParagraph should not depend on a member variable. - // Since fixOrphanedListChild is the only other method that updates m_listElement, - // we should fix unlistifyParagraph to support orphaned list child to get rid of this assignment. - if (!listElement && m_listElement) - listElement = m_listElement; - - if (listElement) { - previousList = listElement->previousElementSibling(); - nextList = listElement->nextElementSibling(); - if (canMergeLists(previousList, listElement.get())) - mergeIdenticalElements(previousList, listElement.get()); - if (canMergeLists(listElement.get(), nextList)) - mergeIdenticalElements(listElement.get(), nextList); - } else if (canMergeLists(nextList, previousList)) + if (listElement) + return mergeWithNeighboringLists(listElement); + + if (canMergeLists(previousList, nextList)) mergeIdenticalElements(previousList, nextList); return listElement; diff --git a/WebCore/editing/InsertListCommand.h b/WebCore/editing/InsertListCommand.h index 7fbf936..b81ae74 100644 --- a/WebCore/editing/InsertListCommand.h +++ b/WebCore/editing/InsertListCommand.h @@ -52,8 +52,9 @@ private: virtual EditAction editingAction() const { return EditActionInsertList; } HTMLElement* fixOrphanedListChild(Node*); - bool modifyRange(); - void doApplyForSingleParagraph(bool forceCreateList); + bool selectionHasListOfType(const VisibleSelection& selection, const QualifiedName&); + PassRefPtr<HTMLElement> mergeWithNeighboringLists(PassRefPtr<HTMLElement>); + void doApplyForSingleParagraph(bool forceCreateList, const QualifiedName&, Range* currentSelection); void unlistifyParagraph(const VisiblePosition& originalStart, HTMLElement* listNode, Node* listChildNode); PassRefPtr<HTMLElement> listifyParagraph(const VisiblePosition& originalStart, const QualifiedName& listTag); RefPtr<HTMLElement> m_listElement; diff --git a/WebCore/editing/SplitElementCommand.cpp b/WebCore/editing/SplitElementCommand.cpp index 2998c6a..5047205 100644 --- a/WebCore/editing/SplitElementCommand.cpp +++ b/WebCore/editing/SplitElementCommand.cpp @@ -27,6 +27,7 @@ #include "SplitElementCommand.h" #include "Element.h" +#include "HTMLNames.h" #include <wtf/Assertions.h> namespace WebCore { @@ -58,7 +59,11 @@ void SplitElementCommand::executeApply() parent->insertBefore(m_element1.get(), m_element2.get(), ec); if (ec) return; - + + // Delete id attribute from the second element because the same id cannot be used for more than one element + m_element2->removeAttribute(HTMLNames::idAttr, ec); + ASSERT(!ec); + size_t size = children.size(); for (size_t i = 0; i < size; ++i) m_element1->appendChild(children[i], ec); @@ -88,6 +93,10 @@ void SplitElementCommand::doUnapply() for (size_t i = 0; i < size; ++i) m_element2->insertBefore(children[i].get(), refChild.get(), ec); + // Recover the id attribute of the original element. + if (m_element1->hasAttribute(HTMLNames::idAttr)) + m_element2->setAttribute(HTMLNames::idAttr, m_element1->getAttribute(HTMLNames::idAttr)); + m_element1->remove(ec); } diff --git a/WebCore/editing/htmlediting.cpp b/WebCore/editing/htmlediting.cpp index 9f73167..53b5d7e 100644 --- a/WebCore/editing/htmlediting.cpp +++ b/WebCore/editing/htmlediting.cpp @@ -829,7 +829,7 @@ HTMLElement* outermostEnclosingList(Node* node, Node* rootList) bool canMergeLists(Element* firstList, Element* secondList) { - if (!firstList || !secondList) + if (!firstList || !secondList || !firstList->isHTMLElement() || !secondList->isHTMLElement()) return false; return firstList->hasTagName(secondList->tagQName())// make sure the list types match (ol vs. ul) @@ -1133,9 +1133,15 @@ bool isNodeVisiblyContainedWithin(Node* node, const Range* selectedRange) if (selectedRange->compareNode(node, ec) == Range::NODE_INSIDE) return true; - // If the node starts and ends at where selectedRange starts and ends, the node is contained within - return visiblePositionBeforeNode(node) == selectedRange->startPosition() - && visiblePositionAfterNode(node) == selectedRange->endPosition(); + bool startIsVisuallySame = visiblePositionBeforeNode(node) == selectedRange->startPosition(); + if (startIsVisuallySame && comparePositions(Position(node->parentNode(), node->nodeIndex()+1), selectedRange->endPosition()) < 0) + return true; + + bool endIsVisuallySame = visiblePositionAfterNode(node) == selectedRange->endPosition(); + if (endIsVisuallySame && comparePositions(selectedRange->startPosition(), Position(node->parentNode(), node->nodeIndex())) < 0) + return true; + + return startIsVisuallySame && endIsVisuallySame; } bool isRenderedAsNonInlineTableImageOrHR(const Node* node) diff --git a/WebCore/editing/markup.cpp b/WebCore/editing/markup.cpp index dcb53d6..22e700a 100644 --- a/WebCore/editing/markup.cpp +++ b/WebCore/editing/markup.cpp @@ -555,13 +555,6 @@ static void appendStartMarkup(Vector<UChar>& result, const Node* node, const Ran } } -static String getStartMarkup(const Node* node, const Range* range, EAnnotateForInterchange annotate, EAbsoluteURLs absoluteURLs, bool convertBlocksToInlines = false, HashMap<AtomicStringImpl*, AtomicStringImpl*>* namespaces = 0, RangeFullySelectsNode rangeFullySelectsNode = DoesFullySelectNode) -{ - Vector<UChar> result; - appendStartMarkup(result, node, range, annotate, absoluteURLs, convertBlocksToInlines, namespaces, rangeFullySelectsNode); - return String::adopt(result); -} - static inline bool doesHTMLForbidEndTag(const Node *node) { if (node->isHTMLElement()) { @@ -598,13 +591,6 @@ static void appendEndMarkup(Vector<UChar>& result, const Node* node) result.append('>'); } -static String getEndMarkup(const Node *node) -{ - Vector<UChar> result; - appendEndMarkup(result, node); - return String::adopt(result); -} - class MarkupAccumulator { public: MarkupAccumulator(Node* nodeToSkip, Vector<Node*>* nodes) @@ -722,30 +708,6 @@ static bool isElementPresentational(const Node* node) return !propertyMissingOrEqualToNone(style.get(), CSSPropertyTextDecoration); } -static String joinMarkups(const Vector<String>& preMarkups, const Vector<String>& postMarkups) -{ - size_t length = 0; - - size_t preCount = preMarkups.size(); - for (size_t i = 0; i < preCount; ++i) - length += preMarkups[i].length(); - - size_t postCount = postMarkups.size(); - for (size_t i = 0; i < postCount; ++i) - length += postMarkups[i].length(); - - Vector<UChar> result; - result.reserveInitialCapacity(length); - - for (size_t i = preCount; i > 0; --i) - append(result, preMarkups[i - 1]); - - for (size_t i = 0; i < postCount; ++i) - append(result, postMarkups[i]); - - return String::adopt(result); -} - static bool isSpecialAncestorBlock(Node* node) { if (!node || !isBlock(node)) @@ -773,24 +735,88 @@ static bool shouldIncludeWrapperForFullySelectedRoot(Node* fullySelectedRoot, CS style->getPropertyCSSValue(CSSPropertyBackgroundColor); } -static void addStyleMarkup(Vector<String>& preMarkups, Vector<String>& postMarkups, CSSStyleDeclaration* style, Document* document, bool isBlock = false) -{ - // All text-decoration-related elements should have been treated as special ancestors - // If we ever hit this ASSERT, we should export StyleChange in ApplyStyleCommand and use it here - ASSERT(propertyMissingOrEqualToNone(style, CSSPropertyTextDecoration) && propertyMissingOrEqualToNone(style, CSSPropertyWebkitTextDecorationsInEffect)); - DEFINE_STATIC_LOCAL(const String, divStyle, ("<div style=\"")); - DEFINE_STATIC_LOCAL(const String, divClose, ("</div>")); - DEFINE_STATIC_LOCAL(const String, styleSpanOpen, ("<span class=\"" AppleStyleSpanClass "\" style=\"")); - DEFINE_STATIC_LOCAL(const String, styleSpanClose, ("</span>")); - Vector<UChar> openTag; - append(openTag, isBlock ? divStyle : styleSpanOpen); - appendAttributeValue(openTag, style->cssText(), document->isHTMLDocument()); - openTag.append('\"'); - openTag.append('>'); - preMarkups.append(String::adopt(openTag)); - - postMarkups.append(isBlock ? divClose : styleSpanClose); -} +class MarkupAccumulatorWrapper { +public: + MarkupAccumulatorWrapper() + { + } + + void insertString(const String& s) + { + postMarkups.append(s); + } + + void insertOpenTag(const Node* node, const Range* range, EAnnotateForInterchange annotate, EAbsoluteURLs absoluteURLs, bool convertBlocksToInlines = false, RangeFullySelectsNode rangeFullySelectsNode = DoesFullySelectNode) + { + Vector<UChar> result; + appendStartMarkup(result, node, range, annotate, absoluteURLs, convertBlocksToInlines, 0, rangeFullySelectsNode); + postMarkups.append(String::adopt(result)); + } + + void insertEndTag(const Node* node) + { + Vector<UChar> result; + appendEndMarkup(result, node); + postMarkups.append(String::adopt(result)); + } + + void wrapWithNode(const Node* node, const Range* range, EAnnotateForInterchange annotate, EAbsoluteURLs absoluteURLs, bool convertBlocksToInlines = false, RangeFullySelectsNode rangeFullySelectsNode = DoesFullySelectNode) + { + Vector<UChar> result; + appendStartMarkup(result, node, range, annotate, absoluteURLs, convertBlocksToInlines, 0, rangeFullySelectsNode); + preMarkups.append(String::adopt(result)); + insertEndTag(node); + } + + void wrapWithStyleNode(CSSStyleDeclaration* style, Document* document, bool isBlock = false) + { + // All text-decoration-related elements should have been treated as special ancestors + // If we ever hit this ASSERT, we should export StyleChange in ApplyStyleCommand and use it here + ASSERT(propertyMissingOrEqualToNone(style, CSSPropertyTextDecoration) && propertyMissingOrEqualToNone(style, CSSPropertyWebkitTextDecorationsInEffect)); + DEFINE_STATIC_LOCAL(const String, divStyle, ("<div style=\"")); + DEFINE_STATIC_LOCAL(const String, divClose, ("</div>")); + DEFINE_STATIC_LOCAL(const String, styleSpanOpen, ("<span class=\"" AppleStyleSpanClass "\" style=\"")); + DEFINE_STATIC_LOCAL(const String, styleSpanClose, ("</span>")); + Vector<UChar> openTag; + WebCore::append(openTag, isBlock ? divStyle : styleSpanOpen); + appendAttributeValue(openTag, style->cssText(), document->isHTMLDocument()); + openTag.append('\"'); + openTag.append('>'); + preMarkups.append(String::adopt(openTag)); + postMarkups.append(isBlock ? divClose : styleSpanClose); + } + + // FIXME: This is a very inefficient way of accumulating the markup. + // We're converting results of appendStartMarkup and appendEndMarkup from Vector<UChar> to String + // and then back to Vector<UChar> and again to String here. + String takeResults() + { + size_t length = 0; + + size_t preCount = preMarkups.size(); + for (size_t i = 0; i < preCount; ++i) + length += preMarkups[i].length(); + + size_t postCount = postMarkups.size(); + for (size_t i = 0; i < postCount; ++i) + length += postMarkups[i].length(); + + Vector<UChar> result; + result.reserveInitialCapacity(length); + + for (size_t i = preCount; i > 0; --i) + WebCore::append(result, preMarkups[i - 1]); + + for (size_t i = 0; i < postCount; ++i) + WebCore::append(result, postMarkups[i]); + + return String::adopt(result); + } + +private: + Vector<String> preMarkups; + Vector<String> postMarkups; +}; // FIXME: Shouldn't we omit style info when annotate == DoNotAnnotateForInterchange? // FIXME: At least, annotation and style info should probably not be included in range.markupString() @@ -828,8 +854,7 @@ String createMarkup(const Range* range, Vector<Node*>* nodes, EAnnotateForInterc document->updateLayoutIgnorePendingStylesheets(); - Vector<String> markups; - Vector<String> preMarkups; + MarkupAccumulatorWrapper accumulator; Node* pastEnd = updatedRange->pastLastNode(); Node* lastClosed = 0; Vector<Node*> ancestorsToClose; @@ -844,7 +869,7 @@ String createMarkup(const Range* range, Vector<Node*>* nodes, EAnnotateForInterc return interchangeNewlineString; } - markups.append(interchangeNewlineString); + accumulator.insertString(interchangeNewlineString); startNode = visibleStart.next().deepEquivalent().node(); if (pastEnd && Range::compareBoundaryPoints(startNode, 0, pastEnd, 0) >= 0) { @@ -883,7 +908,8 @@ String createMarkup(const Range* range, Vector<Node*>* nodes, EAnnotateForInterc // Add the node to the markup. if (addMarkupForNode) { - markups.append(getStartMarkup(n, updatedRange.get(), annotate, absoluteURLs)); + + accumulator.insertOpenTag(n, updatedRange.get(), annotate, absoluteURLs); if (nodes) nodes->append(n); } @@ -891,7 +917,7 @@ String createMarkup(const Range* range, Vector<Node*>* nodes, EAnnotateForInterc if (n->firstChild() == 0 || skipDescendants) { // Node has no children, or we are skipping it's descendants, add its close tag now. if (addMarkupForNode) { - markups.append(getEndMarkup(n)); + accumulator.insertEndTag(n); lastClosed = n; } @@ -904,7 +930,7 @@ String createMarkup(const Range* range, Vector<Node*>* nodes, EAnnotateForInterc if (next != pastEnd && next->isDescendantOf(ancestor)) break; // Not at the end of the range, close ancestors up to sibling of next node. - markups.append(getEndMarkup(ancestor)); + accumulator.insertEndTag(ancestor); lastClosed = ancestor; ancestorsToClose.removeLast(); } while (!ancestorsToClose.isEmpty()); @@ -920,8 +946,7 @@ String createMarkup(const Range* range, Vector<Node*>* nodes, EAnnotateForInterc continue; // or b) ancestors that we never encountered during a pre-order traversal starting at startNode: ASSERT(startNode->isDescendantOf(parent)); - preMarkups.append(getStartMarkup(parent, updatedRange.get(), annotate, absoluteURLs)); - markups.append(getEndMarkup(parent)); + accumulator.wrapWithNode(parent, updatedRange.get(), annotate, absoluteURLs); if (nodes) nodes->append(parent); lastClosed = parent; @@ -1001,13 +1026,12 @@ String createMarkup(const Range* range, Vector<Node*>* nodes, EAnnotateForInterc fullySelectedRootStyle->setProperty(CSSPropertyTextDecoration, CSSValueNone); if (!propertyMissingOrEqualToNone(fullySelectedRootStyle.get(), CSSPropertyWebkitTextDecorationsInEffect)) fullySelectedRootStyle->setProperty(CSSPropertyWebkitTextDecorationsInEffect, CSSValueNone); - addStyleMarkup(preMarkups, markups, fullySelectedRootStyle.get(), document, true); + accumulator.wrapWithStyleNode(fullySelectedRootStyle.get(), document, true); } } else { // Since this node and all the other ancestors are not in the selection we want to set RangeFullySelectsNode to DoesNotFullySelectNode // so that styles that affect the exterior of the node are not included. - preMarkups.append(getStartMarkup(ancestor, updatedRange.get(), annotate, absoluteURLs, convertBlocksToInlines, 0, DoesNotFullySelectNode)); - markups.append(getEndMarkup(ancestor)); + accumulator.wrapWithNode(ancestor, updatedRange.get(), annotate, absoluteURLs, convertBlocksToInlines, DoesNotFullySelectNode); } if (nodes) nodes->append(ancestor); @@ -1039,7 +1063,7 @@ String createMarkup(const Range* range, Vector<Node*>* nodes, EAnnotateForInterc style->removeBlockProperties(); if (style->length() > 0) - addStyleMarkup(preMarkups, markups, style.get(), document); + accumulator.wrapWithStyleNode(style.get(), document); } if (lastClosed && lastClosed != document->documentElement()) { @@ -1049,17 +1073,17 @@ String createMarkup(const Range* range, Vector<Node*>* nodes, EAnnotateForInterc RefPtr<CSSMutableStyleDeclaration> defaultStyle = ApplyStyleCommand::editingStyleAtPosition(Position(document->documentElement(), 0)); if (defaultStyle->length() > 0) - addStyleMarkup(preMarkups, markups, defaultStyle.get(), document); + accumulator.wrapWithStyleNode(defaultStyle.get(), document); } // FIXME: The interchange newline should be placed in the block that it's in, not after all of the content, unconditionally. if (annotate && needInterchangeNewlineAfter(visibleEnd.previous())) - markups.append(interchangeNewlineString); - + accumulator.insertString(interchangeNewlineString); + if (deleteButton) deleteButton->enable(); - return joinMarkups(preMarkups, markups); + return accumulator.takeResults(); } PassRefPtr<DocumentFragment> createFragmentFromMarkup(Document* document, const String& markup, const String& baseURL, FragmentScriptingPermission scriptingPermission) diff --git a/WebCore/history/BackForwardList.h b/WebCore/history/BackForwardList.h index 0813054..861b43b 100644 --- a/WebCore/history/BackForwardList.h +++ b/WebCore/history/BackForwardList.h @@ -94,8 +94,6 @@ public: virtual void removeItem(HistoryItem*) = 0; virtual HistoryItemVector& entries() = 0; - virtual void pushStateItem(PassRefPtr<HistoryItem>) = 0; - #if ENABLE(WML) virtual void clearWMLPageHistory() = 0; #endif diff --git a/WebCore/history/BackForwardListChromium.cpp b/WebCore/history/BackForwardListChromium.cpp index ec0f117..dc1efc9 100644 --- a/WebCore/history/BackForwardListChromium.cpp +++ b/WebCore/history/BackForwardListChromium.cpp @@ -121,16 +121,6 @@ HistoryItem* BackForwardListImpl::itemAtIndex(int index) return m_client->itemAtIndex(index); } -void BackForwardListImpl::pushStateItem(PassRefPtr<HistoryItem> newItem) -{ - RefPtr<HistoryItem> current = m_client->currentItem(); - - addItem(newItem); - - if (!current->stateObject()) - current->setStateObject(SerializedScriptValue::create()); -} - HistoryItemVector& BackForwardListImpl::entries() { static HistoryItemVector noEntries; diff --git a/WebCore/history/BackForwardListImpl.cpp b/WebCore/history/BackForwardListImpl.cpp index 9da3cad..cdb888c 100644 --- a/WebCore/history/BackForwardListImpl.cpp +++ b/WebCore/history/BackForwardListImpl.cpp @@ -242,20 +242,6 @@ HistoryItemVector& BackForwardListImpl::entries() return m_entries; } -void BackForwardListImpl::pushStateItem(PassRefPtr<HistoryItem> newItem) -{ - ASSERT(newItem); - ASSERT(newItem->stateObject()); - - RefPtr<HistoryItem> current = currentItem(); - ASSERT(current); - - addItem(newItem); - - if (!current->stateObject()) - current->setStateObject(SerializedScriptValue::create()); -} - void BackForwardListImpl::close() { int size = m_entries.size(); diff --git a/WebCore/history/BackForwardListImpl.h b/WebCore/history/BackForwardListImpl.h index 86e1227..ab92710 100644 --- a/WebCore/history/BackForwardListImpl.h +++ b/WebCore/history/BackForwardListImpl.h @@ -80,8 +80,6 @@ public: void removeItem(HistoryItem*); HistoryItemVector& entries(); - void pushStateItem(PassRefPtr<HistoryItem>); - #if ENABLE(WML) void clearWMLPageHistory(); #endif diff --git a/WebCore/html/FileThread.cpp b/WebCore/html/FileThread.cpp index 02b1718..3a3413c 100644 --- a/WebCore/html/FileThread.cpp +++ b/WebCore/html/FileThread.cpp @@ -61,7 +61,7 @@ bool FileThread::start() void FileThread::stop() { - return m_queue.kill(); + m_queue.kill(); } void FileThread::postTask(PassOwnPtr<Task> task) @@ -69,17 +69,17 @@ void FileThread::postTask(PassOwnPtr<Task> task) m_queue.append(task); } -class SameFilePredicate { +class SameInstancePredicate { public: - SameFilePredicate(const FileStream* stream) : m_stream(stream) { } - bool operator()(FileThread::Task* task) const { return task->stream() == m_stream; } + SameInstancePredicate(const void* instance) : m_instance(instance) { } + bool operator()(FileThread::Task* task) const { return task->instance() == m_instance; } private: - const FileStream* m_stream; + const void* m_instance; }; -void FileThread::unscheduleTasks(const FileStream* stream) +void FileThread::unscheduleTasks(const void* instance) { - SameFilePredicate predicate(stream); + SameInstancePredicate predicate(instance); m_queue.removeIf(predicate); } diff --git a/WebCore/html/FileThread.h b/WebCore/html/FileThread.h index d27273a..2eba98e 100644 --- a/WebCore/html/FileThread.h +++ b/WebCore/html/FileThread.h @@ -44,7 +44,11 @@ class FileStream; class FileThread : public ThreadSafeShared<FileThread> { public: - static PassRefPtr<FileThread> create() { return adoptRef(new FileThread()); } + static PassRefPtr<FileThread> create() + { + return adoptRef(new FileThread()); + } + ~FileThread(); bool start(); @@ -54,14 +58,15 @@ public: public: virtual ~Task() { } virtual void performTask() = 0; - FileStream* stream() const { return m_stream; } + void* instance() const { return m_instance; } protected: - Task(FileStream* stream) : m_stream(stream) { } - FileStream* m_stream; + Task(void* instance) : m_instance(instance) { } + void* m_instance; }; void postTask(PassOwnPtr<Task> task); - void unscheduleTasks(const FileStream*); + + void unscheduleTasks(const void* instance); private: FileThread(); diff --git a/WebCore/html/FileThreadTask.h b/WebCore/html/FileThreadTask.h index de11798..09b647f 100644 --- a/WebCore/html/FileThreadTask.h +++ b/WebCore/html/FileThreadTask.h @@ -32,73 +32,55 @@ #define FileThreadTask_h #include "CrossThreadCopier.h" +#include "CrossThreadTask.h" #include "FileThread.h" -#include <memory> #include <wtf/PassOwnPtr.h> #include <wtf/PassRefPtr.h> -#include <wtf/TypeTraits.h> namespace WebCore { -// Traits for the Task. -template<typename T> struct FileThreadTaskTraits { - typedef const T& ParamType; -}; - -template<typename T> struct FileThreadTaskTraits<T*> { - typedef T* ParamType; -}; - -template<typename T> struct FileThreadTaskTraits<PassRefPtr<T> > { - typedef PassRefPtr<T> ParamType; -}; - -template<typename T> struct FileThreadTaskTraits<PassOwnPtr<T> > { - typedef PassOwnPtr<T> ParamType; -}; - -template<typename R> +template<typename R, typename T> class FileThreadTask0 : public FileThread::Task { public: - typedef R (FileStream::*Method)(); - typedef FileThreadTask0<R> FileThreadTask; + typedef R (T::*Method)(); + typedef FileThreadTask0<R, T> FileThreadTaskImpl; - static PassOwnPtr<FileThreadTask> create(FileStream* stream, Method method) + static PassOwnPtr<FileThreadTaskImpl> create(T* instance, Method method) { - return new FileThreadTask(stream, method); + return new FileThreadTaskImpl(instance, method); } private: - FileThreadTask0(FileStream* stream, Method method) - : FileThread::Task(stream) + FileThreadTask0(T* instance, Method method) + : FileThread::Task(instance) , m_method(method) { } virtual void performTask() { - (*stream().*m_method)(); + (*static_cast<T*>(instance()).*m_method)(); } private: Method m_method; }; -template<typename R, typename P1, typename MP1> +template<typename R, typename T, typename P1, typename MP1> class FileThreadTask1 : public FileThread::Task { public: - typedef R (FileStream::*Method)(MP1); - typedef FileThreadTask1<R, P1, MP1> FileThreadTask; - typedef typename FileThreadTaskTraits<P1>::ParamType Param1; + typedef R (T::*Method)(MP1); + typedef FileThreadTask1<R, T, P1, MP1> FileThreadTaskImpl; + typedef typename CrossThreadTaskTraits<P1>::ParamType Param1; - static PassOwnPtr<FileThreadTask> create(FileStream* stream, Method method, Param1 parameter1) + static PassOwnPtr<FileThreadTaskImpl> create(T* instance, Method method, Param1 parameter1) { - return new FileThreadTask(stream, method, parameter1); + return new FileThreadTaskImpl(instance, method, parameter1); } private: - FileThreadTask1(FileStream* stream, Method method, Param1 parameter1) - : FileThread::Task(stream) + FileThreadTask1(T* instance, Method method, Param1 parameter1) + : FileThread::Task(instance) , m_method(method) , m_parameter1(parameter1) { @@ -106,7 +88,7 @@ private: virtual void performTask() { - (*stream().*m_method)(m_parameter1); + (*static_cast<T*>(instance()).*m_method)(m_parameter1); } private: @@ -114,22 +96,22 @@ private: P1 m_parameter1; }; -template<typename R, typename P1, typename MP1, typename P2, typename MP2> +template<typename R, typename T, typename P1, typename MP1, typename P2, typename MP2> class FileThreadTask2 : public FileThread::Task { public: - typedef R (FileStream::*Method)(MP1, MP2); - typedef FileThreadTask2<R, P1, MP1, P2, MP2> FileThreadTask; - typedef typename FileThreadTaskTraits<P1>::ParamType Param1; - typedef typename FileThreadTaskTraits<P2>::ParamType Param2; + typedef R (T::*Method)(MP1, MP2); + typedef FileThreadTask2<R, T, P1, MP1, P2, MP2> FileThreadTaskImpl; + typedef typename CrossThreadTaskTraits<P1>::ParamType Param1; + typedef typename CrossThreadTaskTraits<P2>::ParamType Param2; - static PassOwnPtr<FileThreadTask> create(FileStream* stream, Method method, Param1 parameter1, Param2 parameter2) + static PassOwnPtr<FileThreadTaskImpl> create(T* instance, Method method, Param1 parameter1, Param2 parameter2) { - return new FileThreadTask(stream, method, parameter1, parameter2); + return new FileThreadTaskImpl(instance, method, parameter1, parameter2); } private: - FileThreadTask2(FileStream* stream, Method method, Param1 parameter1, Param2 parameter2) - : FileThread::Task(stream) + FileThreadTask2(T* instance, Method method, Param1 parameter1, Param2 parameter2) + : FileThread::Task(instance) , m_method(method) , m_parameter1(parameter1) , m_parameter2(parameter2) @@ -138,7 +120,7 @@ private: virtual void performTask() { - (*stream().*m_method)(m_parameter1, m_parameter2); + (*static_cast<T*>(instance()).*m_method)(m_parameter1, m_parameter2); } private: @@ -147,23 +129,23 @@ private: P2 m_parameter2; }; -template<typename R, typename P1, typename MP1, typename P2, typename MP2, typename P3, typename MP3> +template<typename R, typename T, typename P1, typename MP1, typename P2, typename MP2, typename P3, typename MP3> class FileThreadTask3 : public FileThread::Task { public: - typedef R (FileStream::*Method)(MP1, MP2, MP3); - typedef FileThreadTask3<R, P1, MP1, P2, MP2, P3, MP3> FileThreadTask; - typedef typename FileThreadTaskTraits<P1>::ParamType Param1; - typedef typename FileThreadTaskTraits<P2>::ParamType Param2; - typedef typename FileThreadTaskTraits<P3>::ParamType Param3; + typedef void (T::*Method)(MP1, MP2, MP3); + typedef FileThreadTask3<R, T, P1, MP1, P2, MP2, P3, MP3> FileThreadTaskImpl; + typedef typename CrossThreadTaskTraits<P1>::ParamType Param1; + typedef typename CrossThreadTaskTraits<P2>::ParamType Param2; + typedef typename CrossThreadTaskTraits<P3>::ParamType Param3; - static PassOwnPtr<FileThreadTask> create(FileStream* stream, Method method, Param1 parameter1, Param2 parameter2, Param3 parameter3) + static PassOwnPtr<FileThreadTaskImpl> create(T* instance, Method method, Param1 parameter1, Param2 parameter2, Param3 parameter3) { - return new FileThreadTask(stream, method, parameter1, parameter2, parameter3); + return new FileThreadTaskImpl(instance, method, parameter1, parameter2, parameter3); } private: - FileThreadTask3(FileStream* stream, Method method, Param1 parameter1, Param2 parameter2, Param3 parameter3) - : FileThread::Task(stream) + FileThreadTask3(T* instance, Method method, Param1 parameter1, Param2 parameter2, Param3 parameter3) + : FileThread::Task(instance) , m_method(method) , m_parameter1(parameter1) , m_parameter2(parameter2) @@ -173,7 +155,7 @@ private: virtual void performTask() { - (*stream().*m_method)(m_parameter1, m_parameter2, m_parameter3); + (*static_cast<T*>(instance()).*m_method)(m_parameter1, m_parameter2, m_parameter3); } private: @@ -183,56 +165,56 @@ private: P3 m_parameter3; }; -template<typename R> +template<typename R, typename T> PassOwnPtr<FileThread::Task> createFileThreadTask( - FileStream* const callee, - R (FileStream::*method)()); + T* const callee, + R (T::*method)()); -template<typename R> +template<typename R, typename T> PassOwnPtr<FileThread::Task> createFileThreadTask( - FileStream* const callee, - R (FileStream::*method)()) + T* const callee, + R (T::*method)()) { - return FileThreadTask0<R>::create( + return FileThreadTask0<R, T>::create( callee, method); } -template<typename R, typename P1, typename MP1> +template<typename R, typename T, typename P1, typename MP1> PassOwnPtr<FileThread::Task> createFileThreadTask( - FileStream* const callee, - R (FileStream::*method)(MP1), + T* const callee, + R (T::*method)(MP1), const P1& parameter1) { - return FileThreadTask1<R, typename CrossThreadCopier<P1>::Type, MP1>::create( + return FileThreadTask1<R, T, typename CrossThreadCopier<P1>::Type, MP1>::create( callee, method, CrossThreadCopier<P1>::copy(parameter1)); } -template<typename R, typename P1, typename MP1, typename P2, typename MP2> +template<typename R, typename T, typename P1, typename MP1, typename P2, typename MP2> PassOwnPtr<FileThread::Task> createFileThreadTask( - FileStream* const callee, - R (FileStream::*method)(MP1, MP2), + T* const callee, + R (T::*method)(MP1, MP2), const P1& parameter1, const P2& parameter2) { - return FileThreadTask2<R, typename CrossThreadCopier<P1>::Type, MP1, typename CrossThreadCopier<P2>::Type, MP2>::create( + return FileThreadTask2<R, T, typename CrossThreadCopier<P1>::Type, MP1, typename CrossThreadCopier<P2>::Type, MP2>::create( callee, method, CrossThreadCopier<P1>::copy(parameter1), CrossThreadCopier<P2>::copy(parameter2)); } -template<typename R, typename P1, typename MP1, typename P2, typename MP2, typename P3, typename MP3> +template<typename R, typename T, typename P1, typename MP1, typename P2, typename MP2, typename P3, typename MP3> PassOwnPtr<FileThread::Task> createFileThreadTask( - FileStream* const callee, - R (FileStream::*method)(MP1, MP2, MP3), + T* const callee, + R (T::*method)(MP1, MP2, MP3), const P1& parameter1, const P2& parameter2, const P3& parameter3) { - return FileThreadTask3<R, typename CrossThreadCopier<P1>::Type, MP1, typename CrossThreadCopier<P2>::Type, MP2, typename CrossThreadCopier<P3>::Type, MP3>::create( + return FileThreadTask3<R, T, typename CrossThreadCopier<P1>::Type, MP1, typename CrossThreadCopier<P2>::Type, MP2, typename CrossThreadCopier<P3>::Type, MP3>::create( callee, method, CrossThreadCopier<P1>::copy(parameter1), diff --git a/WebCore/html/HTMLFrameSetElement.cpp b/WebCore/html/HTMLFrameSetElement.cpp index 1b38a1d..d0f84ef 100644 --- a/WebCore/html/HTMLFrameSetElement.cpp +++ b/WebCore/html/HTMLFrameSetElement.cpp @@ -208,10 +208,14 @@ void HTMLFrameSetElement::recalcStyle(StyleChange ch) { if (needsStyleRecalc() && renderer()) { renderer()->setNeedsLayout(true); +<<<<<<< HEAD #ifdef ANDROID_FLATTEN_FRAMESET static_cast<RenderFrameSet*>(renderer())->setGridNeedsLayout(); #endif setNeedsStyleRecalc(NoStyleChange); +======= + clearNeedsStyleRecalc(); +>>>>>>> webkit.org at r64523 } HTMLElement::recalcStyle(ch); } diff --git a/WebCore/html/HTMLInputElement.idl b/WebCore/html/HTMLInputElement.idl index c66e775..c726caa 100644 --- a/WebCore/html/HTMLInputElement.idl +++ b/WebCore/html/HTMLInputElement.idl @@ -100,7 +100,7 @@ module html { readonly attribute NodeList labels; #if defined(ENABLE_INPUT_SPEECH) && ENABLE_INPUT_SPEECH - attribute [Reflect] boolean speech; + attribute [Reflect, EnabledAtRuntime] boolean speech; #endif }; diff --git a/WebCore/html/HTMLStyleElement.cpp b/WebCore/html/HTMLStyleElement.cpp index 4fa08ad..1066c75 100644 --- a/WebCore/html/HTMLStyleElement.cpp +++ b/WebCore/html/HTMLStyleElement.cpp @@ -36,13 +36,9 @@ using namespace HTMLNames; inline HTMLStyleElement::HTMLStyleElement(const QualifiedName& tagName, Document* document, bool createdByParser) : HTMLElement(tagName, document) - , m_loading(false) - , m_createdByParser(createdByParser) - , m_startLineNumber(0) + , StyleElement(document, createdByParser) { ASSERT(hasTagName(styleTag)); - if (createdByParser && document && document->scriptableDocumentParser()) - m_startLineNumber = document->scriptableDocumentParser()->lineNumber(); } PassRefPtr<HTMLStyleElement> HTMLStyleElement::create(const QualifiedName& tagName, Document* document, bool createdByParser) @@ -62,32 +58,25 @@ void HTMLStyleElement::parseMappedAttribute(Attribute* attr) void HTMLStyleElement::finishParsingChildren() { - StyleElement::process(this, m_startLineNumber); - StyleElement::sheet(this); - m_createdByParser = false; + StyleElement::finishParsingChildren(this); HTMLElement::finishParsingChildren(); } void HTMLStyleElement::insertedIntoDocument() { HTMLElement::insertedIntoDocument(); - - document()->addStyleSheetCandidateNode(this, m_createdByParser); - if (!m_createdByParser) - StyleElement::insertedIntoDocument(document(), this); + StyleElement::insertedIntoDocument(document(), this); } void HTMLStyleElement::removedFromDocument() { HTMLElement::removedFromDocument(); - document()->removeStyleSheetCandidateNode(this); - StyleElement::removedFromDocument(document()); + StyleElement::removedFromDocument(document(), this); } void HTMLStyleElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta) { - if (!changedByParser) - StyleElement::process(this, 0); + StyleElement::childrenChanged(this); HTMLElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta); } @@ -96,24 +85,6 @@ StyleSheet* HTMLStyleElement::sheet() return StyleElement::sheet(this); } -bool HTMLStyleElement::isLoading() const -{ - if (m_loading) - return true; - if (!m_sheet) - return false; - return static_cast<CSSStyleSheet *>(m_sheet.get())->isLoading(); -} - -bool HTMLStyleElement::sheetLoaded() -{ - if (!isLoading()) { - document()->removePendingSheet(); - return true; - } - return false; -} - const AtomicString& HTMLStyleElement::media() const { return getAttribute(mediaAttr); diff --git a/WebCore/html/HTMLStyleElement.h b/WebCore/html/HTMLStyleElement.h index 10f5b10..07b5bd9 100644 --- a/WebCore/html/HTMLStyleElement.h +++ b/WebCore/html/HTMLStyleElement.h @@ -53,19 +53,13 @@ private: virtual void finishParsingChildren(); - virtual bool isLoading() const; - virtual bool sheetLoaded(); - - virtual void setLoading(bool loading) { m_loading = loading; } + virtual bool isLoading() const { return StyleElement::isLoading(); } + virtual bool sheetLoaded() { return StyleElement::sheetLoaded(document()); } virtual void addSubresourceAttributeURLs(ListHashSet<KURL>&) const; virtual const AtomicString& media() const; virtual const AtomicString& type() const; - - bool m_loading; - bool m_createdByParser; - int m_startLineNumber; }; } //namespace diff --git a/WebCore/html/canvas/CanvasRenderingContext.h b/WebCore/html/canvas/CanvasRenderingContext.h index f752377..2ee1693 100644 --- a/WebCore/html/canvas/CanvasRenderingContext.h +++ b/WebCore/html/canvas/CanvasRenderingContext.h @@ -46,6 +46,7 @@ namespace WebCore { virtual bool is2d() const { return false; } virtual bool is3d() const { return false; } + virtual bool isAccelerated() const { return false; } private: HTMLCanvasElement* m_canvas; diff --git a/WebCore/html/canvas/CanvasRenderingContext2D.cpp b/WebCore/html/canvas/CanvasRenderingContext2D.cpp index 6c3d372..3b05348 100644 --- a/WebCore/html/canvas/CanvasRenderingContext2D.cpp +++ b/WebCore/html/canvas/CanvasRenderingContext2D.cpp @@ -164,6 +164,23 @@ void CanvasRenderingContext2D::restore() c->restore(); } +void CanvasRenderingContext2D::setAllAttributesToDefault() +{ + state().m_globalAlpha = 1; + state().m_shadowOffset = FloatSize(); + state().m_shadowBlur = 0; + state().m_shadowColor = Color::transparent; + state().m_globalComposite = CompositeSourceOver; + + GraphicsContext* context = drawingContext(); + if (!context) + return; + + context->setShadow(FloatSize(), 0, Color::transparent, DeviceColorSpace); + context->setAlpha(1); + context->setCompositeOperation(CompositeSourceOver); +} + CanvasStyle* CanvasRenderingContext2D::strokeStyle() const { return state().m_strokeStyle.get(); @@ -790,14 +807,18 @@ void CanvasRenderingContext2D::clearRect(float x, float y, float width, float he { if (!validateRectForCanvas(x, y, width, height)) return; - GraphicsContext* c = drawingContext(); - if (!c) + GraphicsContext* context = drawingContext(); + if (!context) return; if (!state().m_invertibleCTM) return; FloatRect rect(x, y, width, height); + + save(); + setAllAttributesToDefault(); willDraw(rect); - c->clearRect(rect); + context->clearRect(rect); + restore(); } void CanvasRenderingContext2D::fillRect(float x, float y, float width, float height) diff --git a/WebCore/html/canvas/CanvasRenderingContext2D.h b/WebCore/html/canvas/CanvasRenderingContext2D.h index fb5f27a..22ed7fc 100644 --- a/WebCore/html/canvas/CanvasRenderingContext2D.h +++ b/WebCore/html/canvas/CanvasRenderingContext2D.h @@ -104,6 +104,7 @@ public: void save(); void restore(); + void setAllAttributesToDefault(); void scale(float sx, float sy); void rotate(float angleInRadians); diff --git a/WebCore/html/canvas/WebGLRenderingContext.h b/WebCore/html/canvas/WebGLRenderingContext.h index fa9ffdb..017570b 100644 --- a/WebCore/html/canvas/WebGLRenderingContext.h +++ b/WebCore/html/canvas/WebGLRenderingContext.h @@ -58,6 +58,7 @@ class WebKitCSSMatrix; virtual ~WebGLRenderingContext(); virtual bool is3d() const { return true; } + virtual bool isAccelerated() const { return true; } // Helper to return the size in bytes of OpenGL data types // like GL_FLOAT, GL_INT, etc. diff --git a/WebCore/inspector/InspectorController.cpp b/WebCore/inspector/InspectorController.cpp index e29c7ae..369b40b 100644 --- a/WebCore/inspector/InspectorController.cpp +++ b/WebCore/inspector/InspectorController.cpp @@ -458,9 +458,18 @@ void InspectorController::inspectedWindowScriptObjectCleared(Frame* frame) if (m_inspectorFrontendClient && frame == m_inspectedPage->mainFrame()) m_inspectorFrontendClient->windowObjectCleared(); - if (!enabled() || !m_frontend || frame != m_inspectedPage->mainFrame()) + if (!enabled()) return; - m_injectedScriptHost->discardInjectedScripts(); + + if (m_frontend && frame != m_inspectedPage->mainFrame()) + m_injectedScriptHost->discardInjectedScripts(); + if (m_scriptsToEvaluateOnLoad.size()) { + ScriptState* scriptState = mainWorldScriptState(frame); + for (Vector<String>::iterator it = m_scriptsToEvaluateOnLoad.begin(); + it != m_scriptsToEvaluateOnLoad.end(); ++it) { + m_injectedScriptHost->injectScript(*it, scriptState); + } + } } void InspectorController::setSearchingForNode(bool enabled) @@ -802,14 +811,6 @@ void InspectorController::didCommitLoad(DocumentLoader* loader) for (Frame* frame = loader->frame(); frame; frame = frame->tree()->traverseNext(loader->frame())) if (ResourcesMap* resourceMap = m_frameResources.get(frame)) pruneResources(resourceMap, loader); - - if (m_scriptsToEvaluateOnLoad.size()) { - ScriptState* scriptState = mainWorldScriptState(loader->frame()); - for (Vector<String>::iterator it = m_scriptsToEvaluateOnLoad.begin(); - it != m_scriptsToEvaluateOnLoad.end(); ++it) { - m_injectedScriptHost->injectScript(*it, scriptState); - } - } } void InspectorController::frameDetachedFromParent(Frame* frame) diff --git a/WebCore/inspector/InspectorDOMAgent.cpp b/WebCore/inspector/InspectorDOMAgent.cpp index 3a14830..075944a 100644 --- a/WebCore/inspector/InspectorDOMAgent.cpp +++ b/WebCore/inspector/InspectorDOMAgent.cpp @@ -774,6 +774,7 @@ PassRefPtr<InspectorObject> InspectorDOMAgent::buildObjectForNode(Node* node, in switch (node->nodeType()) { case Node::TEXT_NODE: case Node::COMMENT_NODE: + case Node::CDATA_SECTION_NODE: nodeValue = node->nodeValue(); break; case Node::ATTRIBUTE_NODE: @@ -1559,6 +1560,8 @@ Node* InspectorDOMAgent::nodeForPath(const String& path) Vector<String> pathTokens; path.split(",", false, pathTokens); + if (!pathTokens.size()) + return 0; for (size_t i = 0; i < pathTokens.size() - 1; i += 2) { bool success = true; unsigned childNumber = pathTokens[i].toUInt(&success); diff --git a/WebCore/inspector/InspectorFrontendHost.cpp b/WebCore/inspector/InspectorFrontendHost.cpp index 6957dd1..0dacde6 100644 --- a/WebCore/inspector/InspectorFrontendHost.cpp +++ b/WebCore/inspector/InspectorFrontendHost.cpp @@ -192,6 +192,14 @@ void InspectorFrontendHost::moveWindowBy(float x, float y) const m_client->moveWindowBy(x, y); } +void InspectorFrontendHost::setExtensionAPI(const String& script) +{ + InspectorController* inspector = m_frontendPage->inspectorController(); + + inspector->removeAllScriptsToEvaluateOnLoad(); + inspector->addScriptToEvaluateOnLoad(script); +} + String InspectorFrontendHost::localizedStringsURL() { return m_client->localizedStringsURL(); diff --git a/WebCore/inspector/InspectorFrontendHost.h b/WebCore/inspector/InspectorFrontendHost.h index 7fb4a1e..4b343fd 100644 --- a/WebCore/inspector/InspectorFrontendHost.h +++ b/WebCore/inspector/InspectorFrontendHost.h @@ -67,6 +67,7 @@ public: void setAttachedWindowHeight(unsigned height); void moveWindowBy(float x, float y) const; + void setExtensionAPI(const String& script); String localizedStringsURL(); String hiddenPanels(); diff --git a/WebCore/inspector/InspectorFrontendHost.idl b/WebCore/inspector/InspectorFrontendHost.idl index d1b3604..0c7cf8b 100644 --- a/WebCore/inspector/InspectorFrontendHost.idl +++ b/WebCore/inspector/InspectorFrontendHost.idl @@ -41,6 +41,7 @@ module core { void requestDetachWindow(); void setAttachedWindowHeight(in unsigned long height); void moveWindowBy(in float x, in float y); + void setExtensionAPI(in DOMString script); DOMString localizedStringsURL(); DOMString hiddenPanels(); diff --git a/WebCore/inspector/front-end/ElementsPanel.js b/WebCore/inspector/front-end/ElementsPanel.js index ec9559f..09a84f7 100644 --- a/WebCore/inspector/front-end/ElementsPanel.js +++ b/WebCore/inspector/front-end/ElementsPanel.js @@ -56,8 +56,10 @@ WebInspector.ElementsPanel = function() this.panel.updateProperties(); this.panel.updateEventListeners(); - if (this._focusedDOMNode) + if (this._focusedDOMNode) { InspectorBackend.addInspectedNode(this._focusedDOMNode.id); + WebInspector.extensionServer.notifyObjectSelected(this.name, "DOMNode"); + } }; this.contentElement.appendChild(this.treeOutline.element); @@ -161,7 +163,7 @@ WebInspector.ElementsPanel.prototype = { if (this.focusedDOMNode) { this._selectedPathOnReset = []; var node = this.focusedDOMNode; - while ("index" in node) { + while ("index" in node && node.nodeName && node.nodeName.length) { this._selectedPathOnReset.push(node.nodeName); this._selectedPathOnReset.push(node.index); node = node.parentNode; diff --git a/WebCore/inspector/front-end/ElementsTreeOutline.js b/WebCore/inspector/front-end/ElementsTreeOutline.js index 7247ba0..3cd22ae 100644 --- a/WebCore/inspector/front-end/ElementsTreeOutline.js +++ b/WebCore/inspector/front-end/ElementsTreeOutline.js @@ -1320,6 +1320,10 @@ WebInspector.ElementsTreeElement.prototype = { info.title += " [" + node.internalSubset + "]"; info.title += "></span>"; break; + + case Node.CDATA_SECTION_NODE: + info.title = "<span class=\"webkit-html-text-node\"><![CDATA[" + node.nodeValue.escapeHTML() + "]]></span>"; + break; default: info.title = this.treeOutline.nodeNameToCorrectCase(node.nodeName).collapseWhitespace().escapeHTML(); } diff --git a/WebCore/inspector/front-end/ExtensionAPI.js b/WebCore/inspector/front-end/ExtensionAPI.js new file mode 100644 index 0000000..476a463 --- /dev/null +++ b/WebCore/inspector/front-end/ExtensionAPI.js @@ -0,0 +1,322 @@ +/* + * 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. + */ + +var injectedExtensionAPI = function(InjectedScriptHost, inspectedWindow, injectedScriptId) +{ + +// Here and below, all constructors are private to API implementation. +// For a public type Foo, if internal fields are present, these are on +// a private FooImpl type, an instance of FooImpl is used in a closure +// by Foo consutrctor to re-bind publicly exported members to an instance +// of Foo. + +function EventSinkImpl(type) +{ + this._type = type; + this._listeners = []; +} + +EventSinkImpl.prototype = { + addListener: function(callback) + { + if (this._listeners.length === 0) + extensionServer.sendRequest({ command: "subscribe", type: this._type }); + this._listeners.push(callback); + extensionServer.registerHandler("notify-" + this._type, bind(this._fire, this)); + }, + + removeListener: function(callback) + { + var listeners = this._listeners; + + for (var i = 0; i < listeners.length; ++i) { + if (listeners[i] === callback) { + listeners.splice(i, 1); + break; + } + } + if (this._listeners.length === 0) + extensionServer.sendRequest({ command: "unsubscribe", type: this._type }); + }, + + _fire: function(request) + { + var listeners = this._listeners.slice(); + for (var i = 0; i < listeners.length; ++i) + listeners[i].apply(null, request.arguments); + } +} + +function EventSink(type) +{ + var impl = new EventSinkImpl(type); + this.addListener = bind(impl.addListener, impl); + this.removeListener = bind(impl.removeListener, impl); +} + +function InspectorExtensionAPI() +{ + this.inspectedWindow = new InspectedWindow(); + this.panels = new Panels(); + this.resources = new Resources(); + this.onReset = new EventSink("reset"); +} + +InspectorExtensionAPI.prototype = { + log: function(message) + { + extensionServer.sendRequest({ command: "log", message: message }); + } +} + +function Resources() +{ + this.onFinished = new EventSink("resource-finished"); +} + +Resources.prototype = { + getAll: function(callback) + { + return extensionServer.sendRequest({ command: "getResources" }, callback); + }, + + get: function(id, callback) + { + return extensionServer.sendRequest({ command: "getResources", id: id }, callback); + } +} + +var wellKnownPanelNames = [ + "elements", + "scripts" +]; + +function Panels() +{ + var panels = []; + function panelGetter(name) + { + return panels[name]; + } + + for (var i = 0; i < wellKnownPanelNames.length; ++i) { + var name = wellKnownPanelNames[i]; + panels[name] = new Panel(name); + this.__defineGetter__(name, bind(panelGetter, null, name)); + } +} + +Panels.prototype = { + create: function(label, pageURL, iconURL, callback) + { + var id = "extension-panel-" + extensionServer.nextObjectId(); + function callbackWrapper(result) + { + if (result.isError) + callback(result); + else { + panel = new ExtensionPanel(id); + callback(panel); + } + } + var request = { + command: "createPanel", + id: id, + label: label, + url: expandURL(pageURL), + icon: expandURL(iconURL) + }; + extensionServer.sendRequest(request, callback && bind(callbackWrapper, this)); + } +} + +function PanelImpl(id) +{ + this._id = id; + this.onSelectionChanged = new EventSink("panel-objectSelected-" + id); +} + +PanelImpl.prototype = { + createSidebarPane: function(title, url, callback) + { + var id = "extension-sidebar-" + extensionServer.nextObjectId(); + function callbackWrapper(result) + { + if (result.isError) + callback(result); + else + callback(new ExtensionSidebarPane(id)); + } + extensionServer.sendRequest({ command: "createSidebarPane", panel: this._id, id: id, title: title, url: expandURL(url) }, callback && callbackWrapper); + } +} + +function Panel(id) +{ + var impl = new PanelImpl(id); + this.createSidebarPane = bind(impl.createSidebarPane, impl); +} + +function ExtensionPanel(id) +{ + Panel.call(this, id); + this.onSearch = new EventSink("panel-search-" + id); +} + +ExtensionPanel.prototype = { +} + +ExtensionPanel.prototype.__proto__ = Panel.prototype; + +function ExtensionSidebarPaneImpl(id) +{ + this._id = id; +} + +ExtensionSidebarPaneImpl.prototype = { + setHeight: function(height) + { + extensionServer.sendRequest({ command: "setSidebarHeight", id: this._id, height: height }); + }, + + setExpanded: function(expanded) + { + extensionServer.sendRequest({ command: "setSidebarExpanded", id: this._id, expanded: expanded }); + } +} + +function ExtensionSidebarPane(id) +{ + var impl = new ExtensionSidebarPaneImpl(id); + this.setHeight = bind(impl.setHeight, impl); + this.setExpanded = bind(impl.setExpanded, impl); +} + +function InspectedWindow() +{ + this.onLoaded = new EventSink("inspectedPageLoaded"); + this.onNavigated = new EventSink("inspectedURLChanged"); + this.onDOMContentLoaded = new EventSink("DOMContentLoaded"); +} + +InspectedWindow.prototype = { + reload: function() + { + return extensionServer.sendRequest({ command: "reload" }); + }, + + evaluate: function(expression, callback) + { + return extensionServer.sendRequest({ command: "evaluateOnInspectedPage", expression: expression }, callback); + } +} + +function ExtensionServerClient() +{ + this._callbacks = {}; + this._handlers = {}; + this._lastRequestId = 0; + this._lastObjectId = 0; + + this.registerHandler("callback", bind(this._onCallback, this)); + + var channel = new MessageChannel(); + this._port = channel.port1; + this._port.addEventListener("message", bind(this._onMessage, this), false); + this._port.start(); + + top.postMessage("registerExtension", [ channel.port2 ], "*"); +} + +ExtensionServerClient.prototype = { + sendRequest: function(message, callback) + { + if (typeof callback === "function") + message.requestId = this._registerCallback(callback); + return this._port.postMessage(message); + }, + + registerHandler: function(command, handler) + { + this._handlers[command] = handler; + }, + + nextObjectId: function() + { + return injectedScriptId + "_" + ++this._lastObjectId; + }, + + _registerCallback: function(callback) + { + var id = ++this._lastRequestId; + this._callbacks[id] = callback; + return id; + }, + + _onCallback: function(request) + { + if (request.requestId in this._callbacks) { + this._callbacks[request.requestId](request.result); + delete this._callbacks[request.requestId]; + } + }, + + _onMessage: function(event) + { + var request = event.data; + var handler = this._handlers[request.command]; + if (handler) + handler.call(this, request); + } +} + +function expandURL(url) +{ + if (!url) + return url; + if (/^[^/]+:/.exec(url)) // See if url has schema. + return url; + var baseURL = location.protocol + "//" + location.hostname + location.port; + if (/^\//.exec(url)) + return baseURL + url; + return baseURL + location.pathname.replace(/\/[^/]*$/,"/") + url; +} + +function bind(func, thisObject) +{ + var args = Array.prototype.slice.call(arguments, 2); + return function() { return func.apply(thisObject, args.concat(Array.prototype.slice.call(arguments, 0))); }; +} + +var extensionServer = new ExtensionServerClient(); + +webInspector = new InspectorExtensionAPI(); + +} diff --git a/WebCore/inspector/front-end/ExtensionPanel.js b/WebCore/inspector/front-end/ExtensionPanel.js new file mode 100644 index 0000000..ba5fa8e --- /dev/null +++ b/WebCore/inspector/front-end/ExtensionPanel.js @@ -0,0 +1,82 @@ +/* + * 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. + */ + +WebInspector.ExtensionPanel = function(id, label, iconURL, options) +{ + this.toolbarItemLabel = label; + this._addStyleRule(".toolbar-item." + id + " .toolbar-icon", "background-image: url(" + iconURL + ");"); + WebInspector.Panel.call(this, id); +} + +WebInspector.ExtensionPanel.prototype = { + get defaultFocusedElement() + { + return this.sidebarTreeElement || this.element; + }, + + updateMainViewWidth: function(width) + { + this.bodyElement.style.left = width + "px"; + this.resize(); + }, + + searchCanceled: function(startingNewSearch) + { + WebInspector.extensionServer.notifySearchAction(this._id, "cancelSearch"); + WebInspector.Panel.prototype.searchCanceled.apply(this, arguments); + }, + + performSearch: function(query) + { + WebInspector.extensionServer.notifySearchAction(this._id, "performSearch", query); + WebInspector.Panel.prototype.performSearch.apply(this, arguments); + }, + + jumpToNextSearchResult: function() + { + WebInspector.extensionServer.notifySearchAction(this._id, "nextSearchResult"); + WebInspector.Panel.prototype.jumpToNextSearchResult.call(this); + }, + + jumpToPreviousSearchResult: function() + { + WebInspector.extensionServer.notifySearchAction(this._id, "previousSearchResult"); + WebInspector.Panel.prototype.jumpToPreviousSearchResult.call(this); + }, + + _addStyleRule: function(selector, body) + { + var style = document.createElement("style"); + style.textContent = selector + " { " + body + " }"; + document.head.appendChild(style); + } +} + +WebInspector.ExtensionPanel.prototype.__proto__ = WebInspector.Panel.prototype; diff --git a/WebCore/inspector/front-end/ExtensionRegistryStub.js b/WebCore/inspector/front-end/ExtensionRegistryStub.js new file mode 100644 index 0000000..a9c96ef --- /dev/null +++ b/WebCore/inspector/front-end/ExtensionRegistryStub.js @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +if (!window.InspectorExtensionRegistry) { + +WebInspector.InspectorExtensionRegistryStub = function() +{ +} + +WebInspector.InspectorExtensionRegistryStub.prototype = { + getExtensionsAsync: function() + { + } +}; + +InspectorExtensionRegistry = new WebInspector.InspectorExtensionRegistryStub(); + +} diff --git a/WebCore/inspector/front-end/ExtensionServer.js b/WebCore/inspector/front-end/ExtensionServer.js new file mode 100644 index 0000000..2d2eab1 --- /dev/null +++ b/WebCore/inspector/front-end/ExtensionServer.js @@ -0,0 +1,319 @@ +/* + * 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. + */ + +WebInspector.ExtensionServer = function() +{ + this._clientObjects = {}; + this._handlers = {}; + this._subscribers = {}; + this._status = new WebInspector.ExtensionStatus(); + + this._registerHandler("subscribe", this._onSubscribe.bind(this)); + this._registerHandler("unsubscribe", this._onUnsubscribe.bind(this)); + this._registerHandler("getResources", this._onGetResources.bind(this)); + this._registerHandler("createPanel", this._onCreatePanel.bind(this)); + this._registerHandler("createSidebarPane", this._onCreateSidebar.bind(this)); + this._registerHandler("log", this._onLog.bind(this)); + this._registerHandler("evaluateOnInspectedPage", this._onEvaluateOnInspectedPage.bind(this)); + this._registerHandler("setSidebarHeight", this._onSetSidebarHeight.bind(this)); + this._registerHandler("setSidebarExpanded", this._onSetSidebarExpansion.bind(this)); + + window.addEventListener("message", this._onWindowMessage.bind(this), false); +} + +WebInspector.ExtensionServer.prototype = { + notifyPanelShown: function(panelName) + { + this._postNotification("panel-shown-" + panelName); + }, + + notifyObjectSelected: function(panelId, objectType, objectId) + { + this._postNotification("panel-objectSelected-" + panelId, objectType, objectId); + }, + + notifyResourceFinished: function(resource) + { + this._postNotification("resource-finished", this._convertResource(resource)); + }, + + notifySearchAction: function(panelId, action, searchString) + { + this._postNotification("panel-search-" + panelId, action, searchString); + }, + + notifyInspectedPageLoaded: function() + { + this._postNotification("inspectedPageLoaded"); + }, + + notifyInspectedURLChanged: function() + { + this._postNotification("inspectedURLChanged"); + }, + + notifyInspectorReset: function() + { + this._postNotification("reset"); + }, + + _convertResource: function(resource) + { + return { + id: resource.identifier, + type: resource.type, + har: (new WebInspector.HAREntry(resource)).build(), + }; + }, + + _postNotification: function(type, details) + { + var subscribers = this._subscribers[type]; + if (!subscribers) + return; + var message = { + command: "notify-" + type, + arguments: Array.prototype.slice.call(arguments, 1) + }; + for (var i = 0; i < subscribers.length; ++i) + subscribers[i].postMessage(message); + }, + + _onSubscribe: function(message, port) + { + var subscribers = this._subscribers[message.type]; + if (subscribers) + subscribers.push(port); + else + this._subscribers[message.type] = [ port ]; + }, + + _onUnsubscribe: function(message, port) + { + var subscribers = this._subscribers[message.type]; + if (!subscribers) + return; + subscribers.remove(port); + if (!subscribers.length) + delete this._subscribers[message.type]; + }, + + _onCreatePanel: function(message, port) + { + var id = message.id; + // The ids are generated on the client API side and must be unique, so the check below + // shouldn't be hit unless someone is bypassing the API. + if (id in this._clientObjects || id in WebInspector.panels) + return this._status.E_EXISTS(id); + var panel = new WebInspector.ExtensionPanel(id, message.label, message.icon); + this._clientObjects[id] = panel; + + var toolbarElement = document.getElementById("toolbar"); + var lastToolbarItem = WebInspector.panelOrder[WebInspector.panelOrder.length - 1].toolbarItem; + WebInspector.addPanelToolbarIcon(toolbarElement, panel, lastToolbarItem); + WebInspector.panels[id] = panel; + this._createClientIframe(panel.element, message.url); + return this._status.OK(); + }, + + _onCreateSidebar: function(message, port) + { + var panel = WebInspector.panels[message.panel]; + if (!panel) + return this._status.E_NOTFOUND(message.panel); + if (!panel.sidebarElement || !panel.sidebarPanes) + return this._status.E_NOTSUPPORTED(); + var id = message.id; + var sidebar = new WebInspector.SidebarPane(message.title); + this._clientObjects[id] = sidebar; + panel.sidebarPanes[id] = sidebar; + panel.sidebarElement.appendChild(sidebar.element); + this._createClientIframe(sidebar.bodyElement, message.url); + return this._status.OK(); + }, + + _createClientIframe: function(parent, url, requestId, port) + { + var iframe = document.createElement("iframe"); + iframe.src = url; + iframe.style.width = "100%"; + parent.appendChild(iframe); + }, + + _onSetSidebarHeight: function(message) + { + var sidebar = this._clientObjects[message.id]; + if (!sidebar) + return this._status.E_NOTFOUND(message.id); + sidebar.bodyElement.firstChild.style.height = message.height; + }, + + _onSetSidebarExpansion: function(message) + { + var sidebar = this._clientObjects[message.id]; + if (!sidebar) + return this._status.E_NOTFOUND(message.id); + if (message.expanded) + sidebar.expand(); + else + sidebar.collapse(); + }, + + _onLog: function(message) + { + WebInspector.log(message.message); + }, + + _onEvaluateOnInspectedPage: function(message, port) + { + InjectedScriptAccess.getDefault().evaluateAndStringify(message.expression, this._dispatchCallback.bind(this, message.requestId, port)); + }, + + _onRevealAndSelect: function(message) + { + if (message.panelId === "resources" && type === "resource") + return this._onRevealAndSelectResource(message); + else + return this._status.E_NOTSUPPORTED(message.panelId, message.type); + }, + + _onRevealAndSelectResource: function(message) + { + var id = message.id; + var resource = null; + + resource = typeof id === "number" ? WebInspector.resources[id] : WebInspector.resourceForURL(id); + if (!resource) + return this._status.E_NOTFOUND(typeof id + ": " + id); + WebInspector.panels.resources.showResource(resource, message.line); + WebInspector.showResourcesPanel(); + }, + + _dispatchCallback: function(requestId, port, result) + { + port.postMessage({ command: "callback", requestId: requestId, result: result }); + }, + + _onGetResources: function(request) + { + function resourceWrapper(id) + { + return WebInspector.extensionServer._convertResource(WebInspector.resources[id]); + } + + var response; + if (request.id) + response = WebInspector.resources[request.id] ? resourceWrapper(request.id) : this._status.E_NOTFOUND(request.id); + else + response = Object.properties(WebInspector.resources).map(resourceWrapper); + return response; + }, + + initExtensions: function() + { + InspectorExtensionRegistry.getExtensionsAsync(); + }, + + _addExtensions: function(extensions) + { + InspectorFrontendHost.setExtensionAPI("(" + injectedExtensionAPI.toString() + ")"); // See ExtensionAPI.js for details. + for (var i = 0; i < extensions.length; ++i) { + var extension = extensions[i]; + try { + if (!extension.startPage) + return; + var iframe = document.createElement("iframe"); + iframe.src = extension.startPage; + iframe.style.display = "none"; + document.body.appendChild(iframe); + } catch (e) { + console.error("Failed to initialize extension " + extension.startPage + ":" + e); + } + } + }, + + _onWindowMessage: function(event) + { + if (event.data !== "registerExtension") + return; + var port = event.ports[0]; + port.addEventListener("message", this._onmessage.bind(this), false); + port.start(); + }, + + _onmessage: function(event) + { + var request = event.data; + var result; + + if (request.command in this._handlers) + result = this._handlers[request.command](request, event.target); + else + result = this._status.E_NOTSUPPORTED(request.command); + + if (result && request.requestId) + this._dispatchCallback(request.requestId, event.target, result); + }, + + _registerHandler: function(command, callback) + { + this._handlers[command] = callback; + } +} + +WebInspector.ExtensionServer._statuses = +{ + OK: "", + E_NOTFOUND: "Object not found (%s)", + E_NOTSUPPORTED: "Object does not support requested operation (%s)", + E_EXISTS: "Object already exists (%s)" +} + +WebInspector.ExtensionStatus = function() +{ + function makeStatus(code) + { + var description = WebInspector.ExtensionServer._statuses[code] || code; + var details = Array.prototype.slice.call(arguments, 1); + var status = { code: code, description: description, details: details }; + if (code !== "OK") { + status.isError = true; + console.log("Extension server error: " + String.vsprintf(description, details)); + } + return status; + } + for (status in WebInspector.ExtensionServer._statuses) + this[status] = makeStatus.bind(null, status); +} + +WebInspector.addExtensions = function(extensions) +{ + WebInspector.extensionServer._addExtensions(extensions); +} diff --git a/WebCore/inspector/front-end/InjectedScript.js b/WebCore/inspector/front-end/InjectedScript.js index ce187d2..3a114c0 100644 --- a/WebCore/inspector/front-end/InjectedScript.js +++ b/WebCore/inspector/front-end/InjectedScript.js @@ -238,6 +238,19 @@ InjectedScript.getCompletions = function(expression, includeInspectorCommandLine return props; } +InjectedScript.evaluateAndStringify = function(expression) +{ + var result = {}; + try { + var value = InjectedScript._evaluateOn(inspectedWindow.eval, inspectedWindow, expression, false); + result.value = JSON.stringify(value); + } catch (e) { + result.value = e.toString(); + result.isException = true; + } + return result; +} + InjectedScript.evaluate = function(expression, objectGroup) { return InjectedScript._evaluateAndWrap(inspectedWindow.eval, inspectedWindow, expression, objectGroup); diff --git a/WebCore/inspector/front-end/InjectedScriptAccess.js b/WebCore/inspector/front-end/InjectedScriptAccess.js index 5950421..59aa70c 100644 --- a/WebCore/inspector/front-end/InjectedScriptAccess.js +++ b/WebCore/inspector/front-end/InjectedScriptAccess.js @@ -75,14 +75,15 @@ InjectedScriptAccess._installHandler = function(methodName, async) // - Make sure last parameter of all the InjectedSriptAccess.* calls is a callback function. // We keep these sorted. InjectedScriptAccess._installHandler("evaluate"); +InjectedScriptAccess._installHandler("evaluateAndStringify"); InjectedScriptAccess._installHandler("evaluateInCallFrame"); +InjectedScriptAccess._installHandler("evaluateOnSelf"); InjectedScriptAccess._installHandler("getCompletions"); InjectedScriptAccess._installHandler("getProperties"); InjectedScriptAccess._installHandler("getPrototypes"); InjectedScriptAccess._installHandler("openInInspectedWindow"); InjectedScriptAccess._installHandler("pushNodeToFrontend"); InjectedScriptAccess._installHandler("setPropertyValue"); -InjectedScriptAccess._installHandler("evaluateOnSelf"); // Some methods can't run synchronously even on the injected script side (such as DB transactions). // Mark them as asynchronous here. diff --git a/WebCore/inspector/front-end/InspectorFrontendHostStub.js b/WebCore/inspector/front-end/InspectorFrontendHostStub.js index 39bbe02..c4e6bf4 100644 --- a/WebCore/inspector/front-end/InspectorFrontendHostStub.js +++ b/WebCore/inspector/front-end/InspectorFrontendHostStub.js @@ -84,6 +84,10 @@ WebInspector.InspectorFrontendHostStub.prototype = { { }, + setExtensionAPI: function(script) + { + }, + loaded: function() { }, @@ -109,6 +113,10 @@ WebInspector.InspectorFrontendHostStub.prototype = { canAttachWindow: function() { return false; + }, + + sendMessageToBackend: function(message) + { } } diff --git a/WebCore/inspector/front-end/Settings.js b/WebCore/inspector/front-end/Settings.js index 22db491..e54acc7 100644 --- a/WebCore/inspector/front-end/Settings.js +++ b/WebCore/inspector/front-end/Settings.js @@ -43,7 +43,6 @@ var Preferences = { debuggerAlwaysEnabled: false, profilerAlwaysEnabled: false, auditsPanelEnabled: true, - appCacheEnabled: true } WebInspector.populateApplicationSettings = function(settingsString) diff --git a/WebCore/inspector/front-end/StoragePanel.js b/WebCore/inspector/front-end/StoragePanel.js index 03a099f..68563de 100644 --- a/WebCore/inspector/front-end/StoragePanel.js +++ b/WebCore/inspector/front-end/StoragePanel.js @@ -49,12 +49,11 @@ WebInspector.StoragePanel = function(database) this.sidebarTree.appendChild(this.cookieListTreeElement); this.cookieListTreeElement.expand(); - if (Preferences.appCacheEnabled) { - this.applicationCacheListTreeElement = new WebInspector.SidebarSectionTreeElement(WebInspector.UIString("APPLICATION CACHE"), {}, true); - this.sidebarTree.appendChild(this.applicationCacheListTreeElement); - this.applicationCacheListTreeElement.expand(); - } - + + this.applicationCacheListTreeElement = new WebInspector.SidebarSectionTreeElement(WebInspector.UIString("APPLICATION CACHE"), {}, true); + this.sidebarTree.appendChild(this.applicationCacheListTreeElement); + this.applicationCacheListTreeElement.expand(); + this.storageViews = document.createElement("div"); this.storageViews.id = "storage-views"; this.element.appendChild(this.storageViews); @@ -111,8 +110,7 @@ WebInspector.StoragePanel.prototype = { this.sessionStorageListTreeElement.removeChildren(); this.cookieListTreeElement.removeChildren(); - if (Preferences.appCacheEnabled) - this.applicationCacheListTreeElement.removeChildren(); + this.applicationCacheListTreeElement.removeChildren(); this.storageViews.removeChildren(); @@ -150,8 +148,6 @@ WebInspector.StoragePanel.prototype = { addApplicationCache: function(domain) { - if (!Preferences.appCacheEnabled) - return; var applicationCacheTreeElement = new WebInspector.ApplicationCacheSidebarTreeElement(domain); this.applicationCacheListTreeElement.appendChild(applicationCacheTreeElement); }, diff --git a/WebCore/inspector/front-end/WebKit.qrc b/WebCore/inspector/front-end/WebKit.qrc index 42ad915..a54936c 100644 --- a/WebCore/inspector/front-end/WebKit.qrc +++ b/WebCore/inspector/front-end/WebKit.qrc @@ -34,6 +34,10 @@ <file>ElementsPanel.js</file> <file>ElementsTreeOutline.js</file> <file>EventListenersSidebarPane.js</file> + <file>ExtensionAPI.js</file> + <file>ExtensionPanel.js</file> + <file>ExtensionRegistryStub.js</file> + <file>ExtensionServer.js</file> <file>FontView.js</file> <file>HAREntry.js</file> <file>HelpScreen.js</file> diff --git a/WebCore/inspector/front-end/inspector.html b/WebCore/inspector/front-end/inspector.html index c829195..48e95bb 100644 --- a/WebCore/inspector/front-end/inspector.html +++ b/WebCore/inspector/front-end/inspector.html @@ -39,6 +39,7 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. <script type="text/javascript" src="inspector.js"></script> <script type="text/javascript" src="InspectorBackendStub.js"></script> <script type="text/javascript" src="InspectorFrontendHostStub.js"></script> + <script type="text/javascript" src="ExtensionRegistryStub.js"></script> <script type="text/javascript" src="Object.js"></script> <script type="text/javascript" src="Settings.js"></script> <script type="text/javascript" src="CSSStyleModel.js"></script> @@ -96,6 +97,9 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. <script type="text/javascript" src="StoragePanel.js"></script> <script type="text/javascript" src="ProfilesPanel.js"></script> <script type="text/javascript" src="ConsolePanel.js"></script> + <script type="text/javascript" src="ExtensionAPI.js"></script> + <script type="text/javascript" src="ExtensionServer.js"></script> + <script type="text/javascript" src="ExtensionPanel.js"></script> <script type="text/javascript" src="AuditsPanel.js"></script> <script type="text/javascript" src="AuditResultView.js"></script> <script type="text/javascript" src="AuditLauncherView.js"></script> diff --git a/WebCore/inspector/front-end/inspector.js b/WebCore/inspector/front-end/inspector.js index 0adf057..4bb30c7 100644 --- a/WebCore/inspector/front-end/inspector.js +++ b/WebCore/inspector/front-end/inspector.js @@ -526,6 +526,9 @@ WebInspector.loaded = function() document.getElementById("close-button-left").addEventListener("click", this.close, true); document.getElementById("close-button-right").addEventListener("click", this.close, true); + this.extensionServer = new WebInspector.ExtensionServer(); + this.extensionServer.initExtensions(); + InspectorFrontendHost.loaded(); } @@ -1202,6 +1205,7 @@ WebInspector.updateResource = function(identifier, payload) resource.finished = payload.finished; if (this.panels.audits) this.panels.audits.resourceFinished(resource); + this.extensionServer.notifyResourceFinished(resource); } if (payload.didTimingChange) { @@ -1426,6 +1430,7 @@ WebInspector.reset = function() delete this.mainResource; this.console.clearMessages(); + this.extensionServer.notifyInspectorReset(); } WebInspector.resetProfilesPanel = function() @@ -1442,6 +1447,7 @@ WebInspector.bringToFront = function() WebInspector.inspectedURLChanged = function(url) { InspectorFrontendHost.inspectedURLChanged(url); + this.extensionServer.notifyInspectedURLChanged(); } WebInspector.resourceURLChanged = function(resource, oldURL) @@ -1454,6 +1460,7 @@ WebInspector.didCommitLoad = function() { // Cleanup elements panel early on inspected page refresh. WebInspector.setDocument(null); + this.extensionServer.notifyInspectedPageLoaded(); } WebInspector.updateConsoleMessageExpiredCount = function(count) diff --git a/WebCore/loader/EmptyClients.h b/WebCore/loader/EmptyClients.h index aab30fc..8043b21 100644 --- a/WebCore/loader/EmptyClients.h +++ b/WebCore/loader/EmptyClients.h @@ -1,6 +1,7 @@ /* * Copyright (C) 2006 Eric Seidel (eric@webkit.org) * Copyright (C) 2008, 2009, 2010 Apple Inc. All rights reserved. + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -28,8 +29,8 @@ #define EmptyClients_h #include "ChromeClient.h" -#include "ContextMenuClient.h" #include "Console.h" +#include "ContextMenuClient.h" #include "DocumentLoader.h" #include "DragClient.h" #include "EditCommand.h" @@ -39,7 +40,13 @@ #include "FrameLoaderClient.h" #include "InspectorClient.h" #include "PluginHalterClient.h" +#include "PopupMenu.h" #include "ResourceError.h" +#include "SearchPopupMenu.h" + +#if USE(GLES2_RENDERING) +#include "GLES2Context.h" +#endif /* This file holds empty Client stubs for use by WebCore. @@ -56,6 +63,25 @@ namespace WebCore { +class EmptyPopupMenu : public PopupMenu { +public: + virtual void show(const IntRect&, FrameView*, int) {} + virtual void hide() {} + virtual void updateFromElement() {} + virtual void disconnectClient() {} +}; + +class EmptySearchPopupMenu : public SearchPopupMenu { +public: + virtual PopupMenu* popupMenu() { return m_popup.get(); } + virtual void saveRecentSearches(const AtomicString&, const Vector<String>&) {} + virtual void loadRecentSearches(const AtomicString&, Vector<String>&) {} + virtual bool enabled() { return false; } + +private: + RefPtr<EmptyPopupMenu> m_popup; +}; + class EmptyChromeClient : public ChromeClient { public: virtual ~EmptyChromeClient() { } @@ -112,6 +138,10 @@ public: virtual bool runJavaScriptPrompt(Frame*, const String&, const String&, String&) { return false; } virtual bool shouldInterruptJavaScript() { return false; } + virtual bool selectItemWritingDirectionIsNatural() { return false; } + virtual PassRefPtr<PopupMenu> createPopupMenu(PopupMenuClient*) const { return adoptRef(new EmptyPopupMenu()); } + virtual PassRefPtr<SearchPopupMenu> createSearchPopupMenu(PopupMenuClient*) const { return adoptRef(new EmptySearchPopupMenu()); } + virtual void setStatusbarText(const String&) { } virtual bool tabsToLinks() const { return false; } @@ -141,6 +171,7 @@ public: #if ENABLE(OFFLINE_WEB_APPLICATIONS) virtual void reachedMaxAppCacheSize(int64_t) { } + virtual void reachedApplicationCacheOriginQuota(SecurityOrigin*) { } #endif #if ENABLE(NOTIFICATIONS) @@ -170,6 +201,11 @@ public: virtual void scheduleCompositingLayerSync() {}; #endif +#if USE(GLES2_RENDERING) + virtual PassOwnPtr<GLES2Context> getOnscreenGLES2Context() { return 0; } + virtual PassOwnPtr<GLES2Context> getOffscreenGLES2Context() { return 0; } +#endif + #if PLATFORM(WIN) virtual void setLastSetCursorToCurrentCursor() { } #endif diff --git a/WebCore/loader/HistoryController.cpp b/WebCore/loader/HistoryController.cpp index 5ccdf72..144faa5 100644 --- a/WebCore/loader/HistoryController.cpp +++ b/WebCore/loader/HistoryController.cpp @@ -48,8 +48,22 @@ #include "Settings.h" #include <wtf/text/CString.h> +#if USE(PLATFORM_STRATEGIES) +#include "PlatformStrategies.h" +#include "VisitedLinkStrategy.h" +#endif + namespace WebCore { +static inline void addVisitedLink(Page* page, const KURL& url) +{ +#if USE(PLATFORM_STRATEGIES) + platformStrategies()->visitedLinkStrategy()->addVisitedLink(page, visitedLinkHash(url.string().characters(), url.string().length())); +#else + page->group().addVisitedLink(url); +#endif +} + HistoryController::HistoryController(Frame* frame) : m_frame(frame) { @@ -290,7 +304,7 @@ void HistoryController::updateForStandardLoad(HistoryUpdateType updateType) if (!historyURL.isEmpty() && !needPrivacy) { if (Page* page = m_frame->page()) - page->group().addVisitedLink(historyURL); + addVisitedLink(page, historyURL); if (!frameLoader->documentLoader()->didCreateGlobalHistoryEntry() && frameLoader->documentLoader()->unreachableURL().isEmpty() && !frameLoader->url().isEmpty()) frameLoader->client()->updateGlobalHistoryRedirectLinks(); @@ -334,7 +348,7 @@ void HistoryController::updateForRedirectWithLockedBackForwardList() if (!historyURL.isEmpty() && !needPrivacy) { if (Page* page = m_frame->page()) - page->group().addVisitedLink(historyURL); + addVisitedLink(page, historyURL); if (!m_frame->loader()->documentLoader()->didCreateGlobalHistoryEntry() && m_frame->loader()->documentLoader()->unreachableURL().isEmpty() && !m_frame->loader()->url().isEmpty()) m_frame->loader()->client()->updateGlobalHistoryRedirectLinks(); @@ -361,7 +375,7 @@ void HistoryController::updateForClientRedirect() if (!historyURL.isEmpty() && !needPrivacy) { if (Page* page = m_frame->page()) - page->group().addVisitedLink(historyURL); + addVisitedLink(page, historyURL); } } @@ -399,7 +413,7 @@ void HistoryController::updateForSameDocumentNavigation() if (!page) return; - page->group().addVisitedLink(m_frame->loader()->url()); + addVisitedLink(page, m_frame->loader()->url()); } void HistoryController::updateForFrameLoadCompleted() @@ -619,9 +633,9 @@ void HistoryController::updateBackForwardListClippedAtTarget(bool doClip) frameLoader->checkDidPerformFirstNavigation(); - RefPtr<HistoryItem> item = frameLoader->history()->createItemTree(m_frame, doClip); - LOG(BackForward, "WebCoreBackForward - Adding backforward item %p for frame %s", item.get(), m_frame->loader()->documentLoader()->url().string().ascii().data()); - page->backForwardList()->addItem(item); + RefPtr<HistoryItem> topItem = frameLoader->history()->createItemTree(m_frame, doClip); + LOG(BackForward, "WebCoreBackForward - Adding backforward item %p for frame %s", topItem.get(), m_frame->loader()->documentLoader()->url().string().ascii().data()); + page->backForwardList()->addItem(topItem.release()); } void HistoryController::pushState(PassRefPtr<SerializedScriptValue> stateObject, const String& title, const String& urlString) @@ -633,15 +647,21 @@ void HistoryController::pushState(PassRefPtr<SerializedScriptValue> stateObject, ASSERT(page); // Get a HistoryItem tree for the current frame tree. - RefPtr<HistoryItem> item = createItemTree(m_frame, false); - ASSERT(item->isTargetItem()); + RefPtr<HistoryItem> topItem = page->mainFrame()->loader()->history()->createItemTree(m_frame, false); - // Override data in the target item to reflect the pushState() arguments. - item->setTitle(title); - item->setStateObject(stateObject); - item->setURLString(urlString); + // Override data in the current item (created by createItemTree) to reflect + // the pushState() arguments. + m_currentItem->setTitle(title); + m_currentItem->setStateObject(stateObject); + m_currentItem->setURLString(urlString); + + // Create a null state object for the previous HistoryItem so that we will + // generate a popstate event when navigating back to it. + // FIXME: http://webkit.org/b/41372 implies that we shouldn't need this. + if (!m_previousItem->stateObject()) + m_previousItem->setStateObject(SerializedScriptValue::create()); - page->backForwardList()->pushStateItem(item.release()); + page->backForwardList()->addItem(topItem.release()); } void HistoryController::replaceState(PassRefPtr<SerializedScriptValue> stateObject, const String& title, const String& urlString) diff --git a/WebCore/loader/SubframeLoader.cpp b/WebCore/loader/SubframeLoader.cpp index 2821a50..e7dafa1 100644 --- a/WebCore/loader/SubframeLoader.cpp +++ b/WebCore/loader/SubframeLoader.cpp @@ -226,7 +226,9 @@ PassRefPtr<Widget> SubframeLoader::createJavaAppletWidget(const IntSize& size, H baseURLString = m_frame->document()->baseURL().string(); KURL baseURL = completeURL(baseURLString); - RefPtr<Widget> widget = m_frame->loader()->client()->createJavaAppletWidget(size, element, baseURL, paramNames, paramValues); + RefPtr<Widget> widget; + if (allowPlugins(AboutToInstantiatePlugin)) + widget = m_frame->loader()->client()->createJavaAppletWidget(size, element, baseURL, paramNames, paramValues); if (!widget) return 0; diff --git a/WebCore/loader/appcache/ApplicationCache.h b/WebCore/loader/appcache/ApplicationCache.h index 08e2dd3..d6e15ed 100644 --- a/WebCore/loader/appcache/ApplicationCache.h +++ b/WebCore/loader/appcache/ApplicationCache.h @@ -41,7 +41,6 @@ class ApplicationCacheGroup; class ApplicationCacheResource; class DocumentLoader; class KURL; - class ResourceRequest; typedef Vector<std::pair<KURL, KURL> > FallbackURLVector; diff --git a/WebCore/loader/appcache/ApplicationCacheGroup.cpp b/WebCore/loader/appcache/ApplicationCacheGroup.cpp index 9b05e0d..395d9ad 100644 --- a/WebCore/loader/appcache/ApplicationCacheGroup.cpp +++ b/WebCore/loader/appcache/ApplicationCacheGroup.cpp @@ -42,6 +42,7 @@ #include "MainResourceLoader.h" #include "ManifestParser.h" #include "Page.h" +#include "SecurityOrigin.h" #include "Settings.h" #include <wtf/HashMap.h> @@ -57,6 +58,7 @@ namespace WebCore { ApplicationCacheGroup::ApplicationCacheGroup(const KURL& manifestURL, bool isCopy) : m_manifestURL(manifestURL) + , m_origin(SecurityOrigin::create(manifestURL)) , m_updateStatus(Idle) , m_downloadingPendingMasterResourceLoadersCount(0) , m_progressTotal(0) @@ -67,6 +69,9 @@ ApplicationCacheGroup::ApplicationCacheGroup(const KURL& manifestURL, bool isCop , m_completionType(None) , m_isCopy(isCopy) , m_calledReachedMaxAppCacheSize(false) + , m_loadedSize(0) + , m_availableSpaceInQuota(ApplicationCacheStorage::unknownQuota()) + , m_originQuotaReached(false) { } @@ -592,6 +597,8 @@ void ApplicationCacheGroup::didReceiveData(ResourceHandle* handle, const char* d ASSERT(m_currentResource); m_currentResource->data()->append(data, length); + + m_loadedSize += length; } void ApplicationCacheGroup::didFinishLoading(ResourceHandle* handle) @@ -605,7 +612,23 @@ void ApplicationCacheGroup::didFinishLoading(ResourceHandle* handle) didFinishLoadingManifest(); return; } - + + // After finishing the loading of any resource, we check if it will + // fit in our last known quota limit. + if (m_availableSpaceInQuota == ApplicationCacheStorage::unknownQuota()) { + // Failed to determine what is left in the quota. Fallback to allowing anything. + if (!cacheStorage().remainingSizeForOriginExcludingCache(m_origin.get(), m_newestCache.get(), m_availableSpaceInQuota)) + m_availableSpaceInQuota = ApplicationCacheStorage::noQuota(); + } + + // Check each resource, as it loads, to see if it would fit in our + // idea of the available quota space. + if (m_availableSpaceInQuota < m_loadedSize) { + m_currentResource = 0; + cacheUpdateFailedDueToOriginQuota(); + return; + } + ASSERT(m_currentHandle == handle); ASSERT(m_pendingEntries.contains(handle->firstRequest().url())); @@ -770,6 +793,13 @@ void ApplicationCacheGroup::didReachMaxAppCacheSize() checkIfLoadIsComplete(); } +void ApplicationCacheGroup::didReachOriginQuota(PassRefPtr<Frame> frame) +{ + // Inform the client the origin quota has been reached, + // they may decide to increase the quota. + frame->page()->chrome()->client()->reachedApplicationCacheOriginQuota(m_origin.get()); +} + void ApplicationCacheGroup::cacheUpdateFailed() { stopLoading(); @@ -779,6 +809,16 @@ void ApplicationCacheGroup::cacheUpdateFailed() m_completionType = Failure; deliverDelayedMainResources(); } + +void ApplicationCacheGroup::cacheUpdateFailedDueToOriginQuota() +{ + if (!m_originQuotaReached) { + m_originQuotaReached = true; + scheduleReachedOriginQuotaCallback(); + } + + cacheUpdateFailed(); +} void ApplicationCacheGroup::manifestNotFound() { @@ -858,10 +898,10 @@ void ApplicationCacheGroup::checkIfLoadIsComplete() ASSERT(cacheStorage().isMaximumSizeReached() && m_calledReachedMaxAppCacheSize); } + ApplicationCacheStorage::FailureReason failureReason; RefPtr<ApplicationCache> oldNewestCache = (m_newestCache == m_cacheBeingUpdated) ? 0 : m_newestCache; - setNewestCache(m_cacheBeingUpdated.release()); - if (cacheStorage().storeNewestCache(this)) { + if (cacheStorage().storeNewestCache(this, oldNewestCache.get(), failureReason)) { // New cache stored, now remove the old cache. if (oldNewestCache) cacheStorage().remove(oldNewestCache.get()); @@ -872,8 +912,18 @@ void ApplicationCacheGroup::checkIfLoadIsComplete() // Fire the success event. postListenerTask(isUpgradeAttempt ? ApplicationCacheHost::UPDATEREADY_EVENT : ApplicationCacheHost::CACHED_EVENT, m_associatedDocumentLoaders); + // It is clear that the origin quota was not reached, so clear the flag if it was set. + m_originQuotaReached = false; } else { - if (cacheStorage().isMaximumSizeReached() && !m_calledReachedMaxAppCacheSize) { + if (failureReason == ApplicationCacheStorage::OriginQuotaReached) { + // We ran out of space for this origin. Roll back to previous state. + if (oldNewestCache) + setNewestCache(oldNewestCache.release()); + cacheUpdateFailedDueToOriginQuota(); + return; + } + + if (failureReason == ApplicationCacheStorage::TotalQuotaReached && !m_calledReachedMaxAppCacheSize) { // We ran out of space. All the changes in the cache storage have // been rolled back. We roll back to the previous state in here, // as well, call the chrome client asynchronously and retry to @@ -887,30 +937,30 @@ void ApplicationCacheGroup::checkIfLoadIsComplete() } scheduleReachedMaxAppCacheSizeCallback(); return; + } + + // Run the "cache failure steps" + // Fire the error events to all pending master entries, as well any other cache hosts + // currently associated with a cache in this group. + postListenerTask(ApplicationCacheHost::ERROR_EVENT, m_associatedDocumentLoaders); + // Disassociate the pending master entries from the failed new cache. Note that + // all other loaders in the m_associatedDocumentLoaders are still associated with + // some other cache in this group. They are not associated with the failed new cache. + + // Need to copy loaders, because the cache group may be destroyed at the end of iteration. + Vector<DocumentLoader*> loaders; + copyToVector(m_pendingMasterResourceLoaders, loaders); + size_t count = loaders.size(); + for (size_t i = 0; i != count; ++i) + disassociateDocumentLoader(loaders[i]); // This can delete this group. + + // Reinstate the oldNewestCache, if there was one. + if (oldNewestCache) { + // This will discard the failed new cache. + setNewestCache(oldNewestCache.release()); } else { - // Run the "cache failure steps" - // Fire the error events to all pending master entries, as well any other cache hosts - // currently associated with a cache in this group. - postListenerTask(ApplicationCacheHost::ERROR_EVENT, m_associatedDocumentLoaders); - // Disassociate the pending master entries from the failed new cache. Note that - // all other loaders in the m_associatedDocumentLoaders are still associated with - // some other cache in this group. They are not associated with the failed new cache. - - // Need to copy loaders, because the cache group may be destroyed at the end of iteration. - Vector<DocumentLoader*> loaders; - copyToVector(m_pendingMasterResourceLoaders, loaders); - size_t count = loaders.size(); - for (size_t i = 0; i != count; ++i) - disassociateDocumentLoader(loaders[i]); // This can delete this group. - - // Reinstate the oldNewestCache, if there was one. - if (oldNewestCache) { - // This will discard the failed new cache. - setNewestCache(oldNewestCache.release()); - } else { - // We must have been deleted by the last call to disassociateDocumentLoader(). - return; - } + // We must have been deleted by the last call to disassociateDocumentLoader(). + return; } } break; @@ -922,6 +972,8 @@ void ApplicationCacheGroup::checkIfLoadIsComplete() m_completionType = None; setUpdateStatus(Idle); m_frame = 0; + m_loadedSize = 0; + m_availableSpaceInQuota = ApplicationCacheStorage::unknownQuota(); m_calledReachedMaxAppCacheSize = false; } @@ -1027,6 +1079,25 @@ private: ApplicationCacheGroup* m_cacheGroup; }; +class OriginQuotaReachedCallbackTimer: public TimerBase { +public: + OriginQuotaReachedCallbackTimer(ApplicationCacheGroup* cacheGroup, Frame* frame) + : m_cacheGroup(cacheGroup) + , m_frame(frame) + { + } + +private: + virtual void fired() + { + m_cacheGroup->didReachOriginQuota(m_frame.release()); + delete this; + } + + ApplicationCacheGroup* m_cacheGroup; + RefPtr<Frame> m_frame; +}; + void ApplicationCacheGroup::scheduleReachedMaxAppCacheSizeCallback() { ASSERT(isMainThread()); @@ -1035,6 +1106,15 @@ void ApplicationCacheGroup::scheduleReachedMaxAppCacheSizeCallback() // The timer will delete itself once it fires. } +void ApplicationCacheGroup::scheduleReachedOriginQuotaCallback() +{ + ASSERT(isMainThread()); + RefPtr<Frame> frameProtector = m_frame; + OriginQuotaReachedCallbackTimer* timer = new OriginQuotaReachedCallbackTimer(this, frameProtector.get()); + timer->startOneShot(0); + // The timer will delete itself once it fires. +} + class CallCacheListenerTask : public ScriptExecutionContext::Task { public: static PassOwnPtr<CallCacheListenerTask> create(PassRefPtr<DocumentLoader> loader, ApplicationCacheHost::EventID eventID, int progressTotal, int progressDone) diff --git a/WebCore/loader/appcache/ApplicationCacheGroup.h b/WebCore/loader/appcache/ApplicationCacheGroup.h index 9b8a6ab..b5cdf7b 100644 --- a/WebCore/loader/appcache/ApplicationCacheGroup.h +++ b/WebCore/loader/appcache/ApplicationCacheGroup.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008, 2009 Apple Inc. All Rights Reserved. + * Copyright (C) 2008, 2009, 2010 Apple Inc. All Rights Reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -28,10 +28,6 @@ #if ENABLE(OFFLINE_WEB_APPLICATIONS) -#include <wtf/Noncopyable.h> -#include <wtf/HashMap.h> -#include <wtf/HashSet.h> - #include "DOMApplicationCache.h" #include "KURL.h" #include "PlatformString.h" @@ -39,6 +35,10 @@ #include "ResourceHandleClient.h" #include "SharedBuffer.h" +#include <wtf/Noncopyable.h> +#include <wtf/HashMap.h> +#include <wtf/HashSet.h> + namespace WebCore { class ApplicationCache; @@ -46,6 +46,7 @@ class ApplicationCacheResource; class Document; class DocumentLoader; class Frame; +class SecurityOrigin; enum ApplicationCacheUpdateOption { ApplicationCacheUpdateWithBrowsingContext, @@ -66,6 +67,7 @@ public: static void selectCacheWithoutManifestURL(Frame*); const KURL& manifestURL() const { return m_manifestURL; } + const SecurityOrigin* origin() const { return m_origin.get(); } UpdateStatus updateStatus() const { return m_updateStatus; } void setUpdateStatus(UpdateStatus status); @@ -98,6 +100,7 @@ private: static void postListenerTask(ApplicationCacheHost::EventID, int progressTotal, int progressDone, DocumentLoader*); void scheduleReachedMaxAppCacheSizeCallback(); + void scheduleReachedOriginQuotaCallback(); PassRefPtr<ResourceHandle> createResourceHandle(const KURL&, ApplicationCacheResource* newestCachedResource); @@ -117,11 +120,13 @@ private: void didReceiveManifestData(const char*, int); void didFinishLoadingManifest(); void didReachMaxAppCacheSize(); + void didReachOriginQuota(PassRefPtr<Frame> frame); void startLoadingEntry(); void deliverDelayedMainResources(); void checkIfLoadIsComplete(); void cacheUpdateFailed(); + void cacheUpdateFailedDueToOriginQuota(); void manifestNotFound(); void addEntry(const String&, unsigned type); @@ -131,6 +136,7 @@ private: void stopLoading(); KURL m_manifestURL; + RefPtr<SecurityOrigin> m_origin; UpdateStatus m_updateStatus; // This is the newest complete cache in the group. @@ -194,7 +200,12 @@ private: RefPtr<ApplicationCacheResource> m_manifestResource; RefPtr<ResourceHandle> m_manifestHandle; + int64_t m_loadedSize; + int64_t m_availableSpaceInQuota; + bool m_originQuotaReached; + friend class ChromeClientCallbackTimer; + friend class OriginQuotaReachedCallbackTimer; }; } // namespace WebCore diff --git a/WebCore/loader/appcache/ApplicationCacheStorage.cpp b/WebCore/loader/appcache/ApplicationCacheStorage.cpp index 9a11307..ec83911 100644 --- a/WebCore/loader/appcache/ApplicationCacheStorage.cpp +++ b/WebCore/loader/appcache/ApplicationCacheStorage.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008, 2009 Apple Inc. All Rights Reserved. + * Copyright (C) 2008, 2009, 2010 Apple Inc. All Rights Reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -29,13 +29,14 @@ #if ENABLE(OFFLINE_WEB_APPLICATIONS) #include "ApplicationCache.h" -#include "ApplicationCacheHost.h" #include "ApplicationCacheGroup.h" +#include "ApplicationCacheHost.h" #include "ApplicationCacheResource.h" #include "FileSystem.h" #include "KURL.h" #include "SQLiteStatement.h" #include "SQLiteTransaction.h" +#include "SecurityOrigin.h" #include <wtf/text/CString.h> #include <wtf/StdLibExtras.h> #include <wtf/StringExtras.h> @@ -414,6 +415,126 @@ int64_t ApplicationCacheStorage::spaceNeeded(int64_t cacheToSave) return spaceNeeded; } +void ApplicationCacheStorage::setDefaultOriginQuota(int64_t quota) +{ + m_defaultOriginQuota = quota; +} + +bool ApplicationCacheStorage::quotaForOrigin(const SecurityOrigin* origin, int64_t& quota) +{ + // If an Origin record doesn't exist, then the COUNT will be 0 and quota will be 0. + // Using the count to determine if a record existed or not is a safe way to determine + // if a quota of 0 is real, from the record, or from null. + SQLiteStatement statement(m_database, "SELECT COUNT(quota), quota FROM Origins WHERE origin=?"); + if (statement.prepare() != SQLResultOk) + return false; + + statement.bindText(1, origin->databaseIdentifier()); + int result = statement.step(); + + // Return the quota, or if it was null the default. + if (result == SQLResultRow) { + bool wasNoRecord = statement.getColumnInt64(0) == 0; + quota = wasNoRecord ? m_defaultOriginQuota : statement.getColumnInt64(1); + return true; + } + + LOG_ERROR("Could not get the quota of an origin, error \"%s\"", m_database.lastErrorMsg()); + return false; +} + +bool ApplicationCacheStorage::usageForOrigin(const SecurityOrigin* origin, int64_t& usage) +{ + // If an Origins record doesn't exist, then the SUM will be null, + // which will become 0, as expected, when converting to a number. + SQLiteStatement statement(m_database, "SELECT SUM(Caches.size)" + " FROM CacheGroups" + " INNER JOIN Origins ON CacheGroups.origin = Origins.origin" + " INNER JOIN Caches ON CacheGroups.id = Caches.cacheGroup" + " WHERE Origins.origin=?"); + if (statement.prepare() != SQLResultOk) + return false; + + statement.bindText(1, origin->databaseIdentifier()); + int result = statement.step(); + + if (result == SQLResultRow) { + usage = statement.getColumnInt64(0); + return true; + } + + LOG_ERROR("Could not get the quota of an origin, error \"%s\"", m_database.lastErrorMsg()); + return false; +} + +bool ApplicationCacheStorage::remainingSizeForOriginExcludingCache(const SecurityOrigin* origin, ApplicationCache* cache, int64_t& remainingSize) +{ + openDatabase(false); + if (!m_database.isOpen()) + return false; + + // Remaining size = total origin quota - size of all caches with origin excluding the provided cache. + // Keep track of the number of caches so we can tell if the result was a calculation or not. + const char* query; + int64_t excludingCacheIdentifier = cache ? cache->storageID() : 0; + if (excludingCacheIdentifier != 0) { + query = "SELECT COUNT(Caches.size), Origins.quota - SUM(Caches.size)" + " FROM CacheGroups" + " INNER JOIN Origins ON CacheGroups.origin = Origins.origin" + " INNER JOIN Caches ON CacheGroups.id = Caches.cacheGroup" + " WHERE Origins.origin=?" + " AND Caches.id!=?"; + } else { + query = "SELECT COUNT(Caches.size), Origins.quota - SUM(Caches.size)" + " FROM CacheGroups" + " INNER JOIN Origins ON CacheGroups.origin = Origins.origin" + " INNER JOIN Caches ON CacheGroups.id = Caches.cacheGroup" + " WHERE Origins.origin=?"; + } + + SQLiteStatement statement(m_database, query); + if (statement.prepare() != SQLResultOk) + return false; + + statement.bindText(1, origin->databaseIdentifier()); + if (excludingCacheIdentifier != 0) + statement.bindInt64(2, excludingCacheIdentifier); + int result = statement.step(); + + // If the count was 0 that then we have to query the origin table directly + // for its quota. Otherwise we can use the calculated value. + if (result == SQLResultRow) { + int64_t numberOfCaches = statement.getColumnInt64(0); + if (numberOfCaches == 0) + quotaForOrigin(origin, remainingSize); + else + remainingSize = statement.getColumnInt64(1); + return true; + } + + LOG_ERROR("Could not get the remaining size of an origin's quota, error \"%s\"", m_database.lastErrorMsg()); + return false; +} + +bool ApplicationCacheStorage::storeUpdatedQuotaForOrigin(const SecurityOrigin* origin, int64_t quota) +{ + openDatabase(false); + if (!m_database.isOpen()) + return false; + + if (!ensureOriginRecord(origin)) + return false; + + SQLiteStatement updateStatement(m_database, "UPDATE Origins SET quota=? WHERE origin=?"); + if (updateStatement.prepare() != SQLResultOk) + return false; + + updateStatement.bindInt64(1, quota); + updateStatement.bindText(2, origin->databaseIdentifier()); + + return executeStatement(updateStatement); +} + bool ApplicationCacheStorage::executeSQLCommand(const String& sql) { ASSERT(m_database.isOpen()); @@ -426,7 +547,10 @@ bool ApplicationCacheStorage::executeSQLCommand(const String& sql) return result; } -static const int schemaVersion = 5; +// Update the schemaVersion when the schema of any the Application Cache +// SQLite tables changes. This allows the database to be rebuilt when +// a new, incompatible change has been introduced to the database schema. +static const int schemaVersion = 6; void ApplicationCacheStorage::verifySchemaVersion() { @@ -475,7 +599,7 @@ void ApplicationCacheStorage::openDatabase(bool createIfDoesNotExist) // Create tables executeSQLCommand("CREATE TABLE IF NOT EXISTS CacheGroups (id INTEGER PRIMARY KEY AUTOINCREMENT, " - "manifestHostHash INTEGER NOT NULL ON CONFLICT FAIL, manifestURL TEXT UNIQUE ON CONFLICT FAIL, newestCache INTEGER)"); + "manifestHostHash INTEGER NOT NULL ON CONFLICT FAIL, manifestURL TEXT UNIQUE ON CONFLICT FAIL, newestCache INTEGER, origin TEXT)"); executeSQLCommand("CREATE TABLE IF NOT EXISTS Caches (id INTEGER PRIMARY KEY AUTOINCREMENT, cacheGroup INTEGER, size INTEGER)"); executeSQLCommand("CREATE TABLE IF NOT EXISTS CacheWhitelistURLs (url TEXT NOT NULL ON CONFLICT FAIL, cache INTEGER NOT NULL ON CONFLICT FAIL)"); executeSQLCommand("CREATE TABLE IF NOT EXISTS CacheAllowsAllNetworkRequests (wildcard INTEGER NOT NULL ON CONFLICT FAIL, cache INTEGER NOT NULL ON CONFLICT FAIL)"); @@ -485,6 +609,7 @@ void ApplicationCacheStorage::openDatabase(bool createIfDoesNotExist) executeSQLCommand("CREATE TABLE IF NOT EXISTS CacheResources (id INTEGER PRIMARY KEY AUTOINCREMENT, url TEXT NOT NULL ON CONFLICT FAIL, " "statusCode INTEGER NOT NULL, responseURL TEXT NOT NULL, mimeType TEXT, textEncodingName TEXT, headers TEXT, data INTEGER NOT NULL ON CONFLICT FAIL)"); executeSQLCommand("CREATE TABLE IF NOT EXISTS CacheResourceData (id INTEGER PRIMARY KEY AUTOINCREMENT, data BLOB)"); + executeSQLCommand("CREATE TABLE IF NOT EXISTS Origins (origin TEXT UNIQUE ON CONFLICT IGNORE, quota INTEGER NOT NULL ON CONFLICT FAIL)"); // When a cache is deleted, all its entries and its whitelist should be deleted. executeSQLCommand("CREATE TRIGGER IF NOT EXISTS CacheDeleted AFTER DELETE ON Caches" @@ -523,16 +648,20 @@ bool ApplicationCacheStorage::store(ApplicationCacheGroup* group, GroupStorageID ASSERT(group->storageID() == 0); ASSERT(journal); - SQLiteStatement statement(m_database, "INSERT INTO CacheGroups (manifestHostHash, manifestURL) VALUES (?, ?)"); + SQLiteStatement statement(m_database, "INSERT INTO CacheGroups (manifestHostHash, manifestURL, origin) VALUES (?, ?, ?)"); if (statement.prepare() != SQLResultOk) return false; statement.bindInt64(1, urlHostHash(group->manifestURL())); statement.bindText(2, group->manifestURL()); + statement.bindText(3, group->origin()->databaseIdentifier()); if (!executeStatement(statement)) return false; + if (!ensureOriginRecord(group->origin())) + return false; + group->setStorageID(static_cast<unsigned>(m_database.lastInsertRowID())); journal->add(group, 0); return true; @@ -745,7 +874,21 @@ bool ApplicationCacheStorage::store(ApplicationCacheResource* resource, Applicat return true; } -bool ApplicationCacheStorage::storeNewestCache(ApplicationCacheGroup* group) +bool ApplicationCacheStorage::ensureOriginRecord(const SecurityOrigin* origin) +{ + SQLiteStatement insertOriginStatement(m_database, "INSERT INTO Origins (origin, quota) VALUES (?, ?)"); + if (insertOriginStatement.prepare() != SQLResultOk) + return false; + + insertOriginStatement.bindText(1, origin->databaseIdentifier()); + insertOriginStatement.bindInt64(2, m_defaultOriginQuota); + if (!executeStatement(insertOriginStatement)) + return false; + + return true; +} + +bool ApplicationCacheStorage::storeNewestCache(ApplicationCacheGroup* group, ApplicationCache* oldCache, FailureReason& failureReason) { openDatabase(true); @@ -759,11 +902,21 @@ bool ApplicationCacheStorage::storeNewestCache(ApplicationCacheGroup* group) storeCacheTransaction.begin(); + // Check if this would reach the per-origin quota. + int64_t remainingSpaceInOrigin; + if (remainingSizeForOriginExcludingCache(group->origin(), oldCache, remainingSpaceInOrigin)) { + if (remainingSpaceInOrigin < group->newestCache()->estimatedSizeInStorage()) { + failureReason = OriginQuotaReached; + return false; + } + } + GroupStorageIDJournal groupStorageIDJournal; if (!group->storageID()) { // Store the group if (!store(group, &groupStorageIDJournal)) { checkForMaxSizeReached(); + failureReason = isMaximumSizeReached() ? TotalQuotaReached : DiskOrOperationFailure; return false; } } @@ -780,20 +933,25 @@ bool ApplicationCacheStorage::storeNewestCache(ApplicationCacheGroup* group) // Store the newest cache if (!store(group->newestCache(), &resourceStorageIDJournal)) { checkForMaxSizeReached(); + failureReason = isMaximumSizeReached() ? TotalQuotaReached : DiskOrOperationFailure; return false; } // Update the newest cache in the group. SQLiteStatement statement(m_database, "UPDATE CacheGroups SET newestCache=? WHERE id=?"); - if (statement.prepare() != SQLResultOk) + if (statement.prepare() != SQLResultOk) { + failureReason = DiskOrOperationFailure; return false; + } statement.bindInt64(1, group->newestCache()->storageID()); statement.bindInt64(2, group->storageID()); - if (!executeStatement(statement)) + if (!executeStatement(statement)) { + failureReason = DiskOrOperationFailure; return false; + } groupStorageIDJournal.commit(); resourceStorageIDJournal.commit(); @@ -801,6 +959,13 @@ bool ApplicationCacheStorage::storeNewestCache(ApplicationCacheGroup* group) return true; } +bool ApplicationCacheStorage::storeNewestCache(ApplicationCacheGroup* group) +{ + // Ignore the reason for failing, just attempt the store. + FailureReason ignoredFailureReason; + return storeNewestCache(group, 0, ignoredFailureReason); +} + static inline void parseHeader(const UChar* header, size_t headerLength, ResourceResponse& response) { int pos = find(header, headerLength, ':'); @@ -964,9 +1129,10 @@ void ApplicationCacheStorage::empty() if (!m_database.isOpen()) return; - // Clear cache groups, caches and cache resources. + // Clear cache groups, caches, cache resources, and origins. executeSQLCommand("DELETE FROM CacheGroups"); executeSQLCommand("DELETE FROM Caches"); + executeSQLCommand("DELETE FROM Origins"); // Clear the storage IDs for the caches in memory. // The caches will still work, but cached resources will not be saved to disk @@ -1120,8 +1286,9 @@ void ApplicationCacheStorage::checkForMaxSizeReached() } ApplicationCacheStorage::ApplicationCacheStorage() - : m_maximumSize(INT_MAX) + : m_maximumSize(ApplicationCacheStorage::noQuota()) , m_isMaximumSizeReached(false) + , m_defaultOriginQuota(ApplicationCacheStorage::noQuota()) { } diff --git a/WebCore/loader/appcache/ApplicationCacheStorage.h b/WebCore/loader/appcache/ApplicationCacheStorage.h index aaa5c9c..c990fa7 100644 --- a/WebCore/loader/appcache/ApplicationCacheStorage.h +++ b/WebCore/loader/appcache/ApplicationCacheStorage.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008 Apple Inc. All Rights Reserved. + * Copyright (C) 2008, 2010 Apple Inc. All Rights Reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -37,15 +37,22 @@ namespace WebCore { class ApplicationCache; -class ApplicationCacheHost; class ApplicationCacheGroup; +class ApplicationCacheHost; class ApplicationCacheResource; class KURL; template <class T> class StorageIDJournal; +class SecurityOrigin; class ApplicationCacheStorage : public Noncopyable { public: + enum FailureReason { + OriginQuotaReached, + TotalQuotaReached, + DiskOrOperationFailure + }; + void setCacheDirectory(const String&); const String& cacheDirectory() const; @@ -54,6 +61,13 @@ public: bool isMaximumSizeReached() const; int64_t spaceNeeded(int64_t cacheToSave); + int64_t defaultOriginQuota() const { return m_defaultOriginQuota; } + void setDefaultOriginQuota(int64_t quota); + bool usageForOrigin(const SecurityOrigin*, int64_t& usage); + bool quotaForOrigin(const SecurityOrigin*, int64_t& quota); + bool remainingSizeForOriginExcludingCache(const SecurityOrigin*, ApplicationCache*, int64_t& remainingSize); + bool storeUpdatedQuotaForOrigin(const SecurityOrigin*, int64_t quota); + ApplicationCacheGroup* cacheGroupForURL(const KURL&); // Cache to load a main resource from. ApplicationCacheGroup* fallbackCacheGroupForURL(const KURL&); // Cache that has a fallback entry to load a main resource from if normal loading fails. @@ -61,6 +75,7 @@ public: void cacheGroupDestroyed(ApplicationCacheGroup*); void cacheGroupMadeObsolete(ApplicationCacheGroup*); + bool storeNewestCache(ApplicationCacheGroup*, ApplicationCache* oldCache, FailureReason& failureReason); bool storeNewestCache(ApplicationCacheGroup*); // Updates the cache group, but doesn't remove old cache. bool store(ApplicationCacheResource*, ApplicationCache*); bool storeUpdatedType(ApplicationCacheResource*, ApplicationCache*); @@ -76,6 +91,9 @@ public: bool cacheGroupSize(const String& manifestURL, int64_t* size); bool deleteCacheGroup(const String& manifestURL); void vacuumDatabaseFile(); + + static int64_t unknownQuota() { return -1; } + static int64_t noQuota() { return std::numeric_limits<int64_t>::max(); } private: ApplicationCacheStorage(); PassRefPtr<ApplicationCache> loadCache(unsigned storageID); @@ -88,6 +106,8 @@ private: bool store(ApplicationCache*, ResourceStorageIDJournal*); bool store(ApplicationCacheResource*, unsigned cacheStorageID); + bool ensureOriginRecord(const SecurityOrigin*); + void loadManifestHostHashes(); void verifySchemaVersion(); @@ -105,6 +125,8 @@ private: int64_t m_maximumSize; bool m_isMaximumSizeReached; + int64_t m_defaultOriginQuota; + SQLiteDatabase m_database; // In order to quickly determine if a given resource exists in an application cache, diff --git a/WebCore/manual-tests/compositing/assert-on-tab-switch.html b/WebCore/manual-tests/compositing/assert-on-tab-switch.html new file mode 100644 index 0000000..5b82c49 --- /dev/null +++ b/WebCore/manual-tests/compositing/assert-on-tab-switch.html @@ -0,0 +1,20 @@ +<!DOCTYPE html> + +<html> +<head> + <style type="text/css" media="screen"> + .box { + width: 100px; + height: 100px; + background-color: blue; + -webkit-transform: translateZ(0); + } + + </style> +</head> +<body> + <div class="box"></div> + <p><a href="https://bugs.webkit.org/show_bug.cgi?id=43167">https://bugs.webkit.org/show_bug.cgi?id=43167</a><br> + You should not hit an assertion if you load this file in a tab, then switch back and forth between other tabs.</p> +</body> +</html> diff --git a/WebCore/manual-tests/compositing/missing-iframe-contents.html b/WebCore/manual-tests/compositing/missing-iframe-contents.html new file mode 100644 index 0000000..d769e43 --- /dev/null +++ b/WebCore/manual-tests/compositing/missing-iframe-contents.html @@ -0,0 +1,33 @@ +<!DOCTYPE html> + +<html> +<head> + <style type="text/css" media="screen"> + iframe { + border: 10px solid black; + padding: 5px; + margin: 20px; + height: 150px; + width: 300px; + -webkit-box-shadow: 0 0 20px black; + -webkit-transform: translateZ(0); + } + + </style> + <script type="text/javascript" charset="utf-8"> + function doTest() + { + document.getElementById('iframe').className = 'dummy'; + } + + window.addEventListener('load', doTest, false); + </script> +</head> +<body> + + <iframe id="iframe" src="resources/composited-subframe.html"></iframe> + + <p><a href="https://bugs.webkit.org/show_bug.cgi?id=42046">https://bugs.webkit.org/show_bug.cgi?id=42046</a><br> + You should see a blue rectangle inside the iframe when the page loads.</p> +</body> +</html> diff --git a/WebCore/manual-tests/compositing/resources/composited-subframe.html b/WebCore/manual-tests/compositing/resources/composited-subframe.html new file mode 100644 index 0000000..4a4f53e --- /dev/null +++ b/WebCore/manual-tests/compositing/resources/composited-subframe.html @@ -0,0 +1,28 @@ +<!DOCTYPE html> + +<html> +<head> + <style type="text/css" media="screen"> + body { background-color:silver } + + .box { + height: 200px; + width: 200px; + margin: 10px; + padding: 5px; + background-color: blue; + -webkit-transform: translateZ(0); + overflow:hidden; + } + .box:hover { + -webkit-transform: none; + } + </style> +</head> +<body> + + <div id="iframe-content" class="box"> + </div> + +</body> +</html> diff --git a/WebCore/page/Chrome.cpp b/WebCore/page/Chrome.cpp index 0c66925..bff0100 100644 --- a/WebCore/page/Chrome.cpp +++ b/WebCore/page/Chrome.cpp @@ -1,6 +1,6 @@ /* * Copyright (C) 2006, 2007, 2009 Apple Inc. All rights reserved. - * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) + * Copyright (C) 2008, 2010 Nokia Corporation and/or its subsidiary(-ies) * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -482,5 +482,19 @@ bool ChromeClient::paintCustomScrollCorner(GraphicsContext*, const FloatRect&) return false; } +bool Chrome::selectItemWritingDirectionIsNatural() +{ + return m_client->selectItemWritingDirectionIsNatural(); +} + +PassRefPtr<PopupMenu> Chrome::createPopupMenu(PopupMenuClient* client) const +{ + return m_client->createPopupMenu(client); +} + +PassRefPtr<SearchPopupMenu> Chrome::createSearchPopupMenu(PopupMenuClient* client) const +{ + return m_client->createSearchPopupMenu(client); +} } // namespace WebCore diff --git a/WebCore/page/Chrome.h b/WebCore/page/Chrome.h index 537468a..30edf28 100644 --- a/WebCore/page/Chrome.h +++ b/WebCore/page/Chrome.h @@ -1,5 +1,6 @@ /* * Copyright (C) 2006, 2007, 2008, 2009 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 * modify it under the terms of the GNU Library General Public @@ -24,6 +25,8 @@ #include "FileChooser.h" #include "FocusDirection.h" #include "HostWindow.h" +#include "PopupMenu.h" +#include "SearchPopupMenu.h" #include <wtf/Forward.h> #include <wtf/RefPtr.h> @@ -44,6 +47,7 @@ namespace WebCore { class IntRect; class Node; class Page; + class PopupMenuClient; class String; #if ENABLE(NOTIFICATIONS) class NotificationPresenter; @@ -144,6 +148,10 @@ namespace WebCore { NotificationPresenter* notificationPresenter() const; #endif + bool selectItemWritingDirectionIsNatural(); + PassRefPtr<PopupMenu> createPopupMenu(PopupMenuClient*) const; + PassRefPtr<SearchPopupMenu> createSearchPopupMenu(PopupMenuClient*) const; + private: Page* m_page; ChromeClient* m_client; diff --git a/WebCore/page/ChromeClient.h b/WebCore/page/ChromeClient.h index 1b2d1cc..f90e01e 100644 --- a/WebCore/page/ChromeClient.h +++ b/WebCore/page/ChromeClient.h @@ -1,5 +1,6 @@ /* * Copyright (C) 2006, 2007, 2008, 2009 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 * modify it under the terms of the GNU Library General Public @@ -26,7 +27,10 @@ #include "GraphicsContext.h" #include "HTMLParserQuirks.h" #include "HostWindow.h" +#include "PopupMenu.h" +#include "PopupMenuClient.h" #include "ScrollTypes.h" +#include "SearchPopupMenu.h" #include <wtf/Forward.h> #include <wtf/PassOwnPtr.h> #include <wtf/Vector.h> @@ -53,6 +57,8 @@ namespace WebCore { class IntRect; class Node; class Page; + class SecurityOrigin; + class PopupMenuClient; class String; class Widget; @@ -64,6 +70,10 @@ namespace WebCore { class GraphicsLayer; #endif +#if USE(GLES2_RENDERING) + class GLES2Context; +#endif + #if ENABLE(NOTIFICATIONS) class NotificationPresenter; #endif @@ -163,6 +173,13 @@ namespace WebCore { // The chrome client would need to take some action such as evicting some // old caches. virtual void reachedMaxAppCacheSize(int64_t spaceNeeded) = 0; + + // Callback invoked when the application cache origin quota is reached. This + // means that the resources attempting to be cached via the manifest are + // more than allowed on this origin. This callback allows the chrome client + // to take action, such as prompting the user to ask to increase the quota + // for this origin. + virtual void reachedApplicationCacheOriginQuota(SecurityOrigin* origin) = 0; #endif #if ENABLE(DASHBOARD_SUPPORT) @@ -219,6 +236,12 @@ namespace WebCore { virtual bool allowsAcceleratedCompositing() const { return true; } #endif +#if USE(GLES2_RENDERING) + // Request a GL ES 2 context to use for compositing this page's content. + virtual PassOwnPtr<GLES2Context> getOnscreenGLES2Context() = 0; + virtual PassOwnPtr<GLES2Context> getOffscreenGLES2Context() = 0; +#endif + virtual bool supportsFullscreenForNode(const Node*) { return false; } virtual void enterFullscreenForNode(Node*) { } virtual void exitFullscreenForNode(Node*) { } @@ -244,13 +267,9 @@ namespace WebCore { virtual void needTouchEvents(bool) = 0; #endif -#if ENABLE(WIDGETS_10_SUPPORT) - virtual bool isWindowed() { return false; } - virtual bool isFloating() { return false; } - virtual bool isFullscreen() { return false; } - virtual bool isMaximized() { return false; } - virtual bool isMinimized() { return false; } -#endif + virtual bool selectItemWritingDirectionIsNatural() = 0; + virtual PassRefPtr<PopupMenu> createPopupMenu(PopupMenuClient*) const = 0; + virtual PassRefPtr<SearchPopupMenu> createSearchPopupMenu(PopupMenuClient*) const = 0; #if ENABLE(ANDROID_INSTALLABLE_WEB_APPS) virtual void webAppCanBeInstalled() = 0; diff --git a/WebCore/page/DOMWindow.cpp b/WebCore/page/DOMWindow.cpp index a369a32..526e824 100644 --- a/WebCore/page/DOMWindow.cpp +++ b/WebCore/page/DOMWindow.cpp @@ -38,6 +38,7 @@ #include "DocumentLoader.h" #include "DOMApplicationCache.h" #include "DOMSelection.h" +#include "DOMStringList.h" #include "DOMTimer.h" #include "Database.h" #include "DatabaseCallback.h" @@ -56,9 +57,9 @@ #include "FrameView.h" #include "HTMLFrameOwnerElement.h" #include "History.h" +#include "IDBFactory.h" +#include "IDBFactoryBackendInterface.h" #include "IDBKeyRange.h" -#include "IndexedDatabase.h" -#include "IndexedDatabaseRequest.h" #include "InspectorController.h" #include "InspectorTimelineAgent.h" #include "Location.h" @@ -484,8 +485,8 @@ void DOMWindow::clear() #endif #if ENABLE(INDEXED_DATABASE) - m_idb_key_range = 0; - m_indexedDatabaseRequest = 0; + m_idbFactory = 0; + m_idbKeyRange = 0; #endif } @@ -687,10 +688,10 @@ void DOMWindow::pageDestroyed() } #if ENABLE(INDEXED_DATABASE) -IndexedDatabaseRequest* DOMWindow::indexedDB() const +IDBFactory* DOMWindow::indexedDB() const { - if (m_indexedDatabaseRequest) - return m_indexedDatabaseRequest.get(); + if (m_idbFactory) + return m_idbFactory.get(); Document* document = this->document(); if (!document) @@ -704,16 +705,16 @@ IndexedDatabaseRequest* DOMWindow::indexedDB() const // FIXME: See if indexedDatabase access is allowed. - m_indexedDatabaseRequest = IndexedDatabaseRequest::create(page->group().indexedDatabase()); - return m_indexedDatabaseRequest.get(); + m_idbFactory = IDBFactory::create(page->group().idbFactory()); + return m_idbFactory.get(); } IDBKeyRange* DOMWindow::iDBKeyRange() const { - if (!m_idb_key_range) - m_idb_key_range = IDBKeyRange::create(0, 0, 0); + if (!m_idbKeyRange) + m_idbKeyRange = IDBKeyRange::create(0, 0, 0); - return m_idb_key_range.get(); + return m_idbKeyRange.get(); } #endif diff --git a/WebCore/page/DOMWindow.h b/WebCore/page/DOMWindow.h index 7a13651..51d407c 100644 --- a/WebCore/page/DOMWindow.h +++ b/WebCore/page/DOMWindow.h @@ -53,8 +53,8 @@ namespace WebCore { class FloatRect; class Frame; class History; + class IDBFactory; class IDBKeyRange; - class IndexedDatabaseRequest; class InspectorTimelineAgent; class Location; class StyleMedia; @@ -232,8 +232,8 @@ namespace WebCore { void pageDestroyed(); #if ENABLE(INDEXED_DATABASE) + IDBFactory* indexedDB() const; IDBKeyRange* iDBKeyRange() const; - IndexedDatabaseRequest* indexedDB() const; #endif void postMessage(PassRefPtr<SerializedScriptValue> message, const MessagePortArray*, const String& targetOrigin, DOMWindow* source, ExceptionCode&); @@ -424,8 +424,8 @@ namespace WebCore { mutable RefPtr<NotificationCenter> m_notifications; #endif #if ENABLE(INDEXED_DATABASE) - mutable RefPtr<IDBKeyRange> m_idb_key_range; - mutable RefPtr<IndexedDatabaseRequest> m_indexedDatabaseRequest; + mutable RefPtr<IDBFactory> m_idbFactory; + mutable RefPtr<IDBKeyRange> m_idbKeyRange; #endif EventTargetData m_eventTargetData; diff --git a/WebCore/page/DOMWindow.idl b/WebCore/page/DOMWindow.idl index 74e7504..c024460 100644 --- a/WebCore/page/DOMWindow.idl +++ b/WebCore/page/DOMWindow.idl @@ -173,7 +173,7 @@ module window { readonly attribute [EnabledAtRuntime] NotificationCenter webkitNotifications; #endif #if defined(ENABLE_INDEXED_DATABASE) && ENABLE_INDEXED_DATABASE - readonly attribute [EnabledAtRuntime] IndexedDatabaseRequest indexedDB; + readonly attribute [EnabledAtRuntime] IDBFactory indexedDB; readonly attribute [EnabledAtRuntime] IDBKeyRange IDBKeyRange; #endif diff --git a/WebCore/page/EventHandler.cpp b/WebCore/page/EventHandler.cpp index 9816814..8f213c6 100644 --- a/WebCore/page/EventHandler.cpp +++ b/WebCore/page/EventHandler.cpp @@ -870,6 +870,7 @@ void EventHandler::allowDHTMLDrag(bool& flagDHTML, bool& flagUA) const } #endif // ENABLE(DRAG_SUPPORT) +<<<<<<< HEAD #ifdef ANDROID_HITTEST_WITHSIZE HitTestResult EventHandler::hitTestResultAtPoint(const IntPoint& point, bool allowShadowContent, bool ignoreClipping, HitTestScrollbars testScrollbars, HitTestRequest::HitTestRequestType hitType, const IntSize& pointPadding) #else @@ -881,6 +882,11 @@ HitTestResult EventHandler::hitTestResultAtPoint(const IntPoint& point, bool all #else HitTestResult result(point); #endif +======= +HitTestResult EventHandler::hitTestResultAtPoint(const IntPoint& point, bool allowShadowContent, bool ignoreClipping, HitTestScrollbars testScrollbars, HitTestRequest::HitTestRequestType hitType, const IntSize& padding) +{ + HitTestResult result(point, padding); +>>>>>>> webkit.org at r64523 if (!m_frame->contentRenderer()) return result; if (ignoreClipping) @@ -901,11 +907,15 @@ HitTestResult EventHandler::hitTestResultAtPoint(const IntPoint& point, bool all FrameView* view = static_cast<FrameView*>(widget); IntPoint widgetPoint(result.localPoint().x() + view->scrollX() - renderWidget->borderLeft() - renderWidget->paddingLeft(), result.localPoint().y() + view->scrollY() - renderWidget->borderTop() - renderWidget->paddingTop()); +<<<<<<< HEAD #ifdef ANDROID_HITTEST_WITHSIZE HitTestResult widgetHitTestResult(widgetPoint, pointPadding); #else HitTestResult widgetHitTestResult(widgetPoint); #endif +======= + HitTestResult widgetHitTestResult(widgetPoint, padding); +>>>>>>> webkit.org at r64523 frame->contentRenderer()->layer()->hitTest(HitTestRequest(hitType), widgetHitTestResult); result = widgetHitTestResult; @@ -927,7 +937,7 @@ HitTestResult EventHandler::hitTestResultAtPoint(const IntPoint& point, bool all if (resultView && mainView) { IntPoint windowPoint = resultView->contentsToWindow(result.point()); IntPoint mainFramePoint = mainView->windowToContents(windowPoint); - result = mainFrame->eventHandler()->hitTestResultAtPoint(mainFramePoint, allowShadowContent, ignoreClipping); + result = mainFrame->eventHandler()->hitTestResultAtPoint(mainFramePoint, allowShadowContent, ignoreClipping, testScrollbars, hitType, padding); } } } diff --git a/WebCore/page/EventHandler.h b/WebCore/page/EventHandler.h index 6a5ef4c..34b7e28 100644 --- a/WebCore/page/EventHandler.h +++ b/WebCore/page/EventHandler.h @@ -106,11 +106,18 @@ public: void dispatchFakeMouseMoveEventSoonInQuad(const FloatQuad&); +<<<<<<< HEAD #ifdef ANDROID_HITTEST_WITHSIZE HitTestResult hitTestResultAtPoint(const IntPoint&, bool allowShadowContent, bool ignoreClipping = false, HitTestScrollbars scrollbars = DontHitTestScrollbars, HitTestRequest::HitTestRequestType hitType = HitTestRequest::ReadOnly | HitTestRequest::Active, const IntSize& pointPadding = IntSize()); #else HitTestResult hitTestResultAtPoint(const IntPoint&, bool allowShadowContent, bool ignoreClipping = false, HitTestScrollbars scrollbars = DontHitTestScrollbars, HitTestRequest::HitTestRequestType hitType = HitTestRequest::ReadOnly | HitTestRequest::Active); #endif +======= + HitTestResult hitTestResultAtPoint(const IntPoint&, bool allowShadowContent, bool ignoreClipping = false, + HitTestScrollbars scrollbars = DontHitTestScrollbars, + HitTestRequest::HitTestRequestType hitType = HitTestRequest::ReadOnly | HitTestRequest::Active, + const IntSize& padding = IntSize()); +>>>>>>> webkit.org at r64523 bool mousePressed() const { return m_mousePressed; } void setMousePressed(bool pressed) { m_mousePressed = pressed; } diff --git a/WebCore/page/Frame.cpp b/WebCore/page/Frame.cpp index 77bf071..c0b11d3 100644 --- a/WebCore/page/Frame.cpp +++ b/WebCore/page/Frame.cpp @@ -621,16 +621,16 @@ void Frame::paintDragCaret(GraphicsContext* p, int tx, int ty, const IntRect& cl #endif } -void Frame::setPrinting(bool printing, float minPageWidth, float maxPageWidth, bool adjustViewSize) +void Frame::setPrinting(bool printing, const FloatSize& pageSize, float maximumShrinkRatio, AdjustViewSizeOrNot shouldAdjustViewSize) { m_doc->setPrinting(printing); view()->adjustMediaTypeForPrinting(printing); m_doc->updateStyleSelector(); - view()->forceLayoutWithPageWidthRange(minPageWidth, maxPageWidth, adjustViewSize); + view()->forceLayoutForPagination(pageSize, maximumShrinkRatio, shouldAdjustViewSize); for (Frame* child = tree()->firstChild(); child; child = child->tree()->nextSibling()) - child->setPrinting(printing, minPageWidth, maxPageWidth, adjustViewSize); + child->setPrinting(printing, pageSize, maximumShrinkRatio, shouldAdjustViewSize); } void Frame::setNeedsReapplyStyles() diff --git a/WebCore/page/Frame.h b/WebCore/page/Frame.h index c2d364f..4e522c4 100644 --- a/WebCore/page/Frame.h +++ b/WebCore/page/Frame.h @@ -140,7 +140,8 @@ namespace WebCore { Settings* settings() const; // can be NULL - void setPrinting(bool printing, float minPageWidth, float maxPageWidth, bool adjustViewSize); + enum AdjustViewSizeOrNot { DoNotAdjustViewSize, AdjustViewSize }; + void setPrinting(bool printing, const FloatSize& pageSize, float maximumShrinkRatio, AdjustViewSizeOrNot); bool inViewSourceMode() const; void setInViewSourceMode(bool = true); diff --git a/WebCore/page/FrameView.cpp b/WebCore/page/FrameView.cpp index d460da3..cb18ed1 100644 --- a/WebCore/page/FrameView.cpp +++ b/WebCore/page/FrameView.cpp @@ -221,6 +221,7 @@ void FrameView::reset() m_wasScrolledByUser = false; m_lastLayoutSize = IntSize(); m_lastZoomFactor = 1.0f; + m_pageHeight = 0; m_deferringRepaints = 0; m_repaintCount = 0; m_repaintRects.clear(); @@ -2080,33 +2081,36 @@ void FrameView::forceLayout(bool allowSubtree) //unscheduleRelayout(); } -void FrameView::forceLayoutWithPageWidthRange(float minPageWidth, float maxPageWidth, bool _adjustViewSize) +void FrameView::forceLayoutForPagination(const FloatSize& pageSize, float maximumShrinkFactor, Frame::AdjustViewSizeOrNot shouldAdjustViewSize) { // Dumping externalRepresentation(m_frame->renderer()).ascii() is a good trick to see // the state of things before and after the layout RenderView *root = toRenderView(m_frame->document()->renderer()); if (root) { - // This magic is basically copied from khtmlview::print - int pageW = (int)ceilf(minPageWidth); + int pageW = ceilf(pageSize.width()); + m_pageHeight = pageSize.height() ? pageSize.height() : visibleHeight(); root->setWidth(pageW); root->setNeedsLayoutAndPrefWidthsRecalc(); forceLayout(); - // If we don't fit in the minimum page width, we'll lay out again. If we don't fit in the - // maximum page width, we will lay out to the maximum page width and clip extra content. + // If we don't fit in the given page width, we'll lay out again. If we don't fit in the + // page width when shrunk, we will lay out at maximum shrink and clip extra content. // FIXME: We are assuming a shrink-to-fit printing implementation. A cropping // implementation should not do this! int rightmostPos = root->rightmostPosition(); - if (rightmostPos > minPageWidth) { - pageW = std::min(rightmostPos, (int)ceilf(maxPageWidth)); + if (rightmostPos > pageSize.width()) { + pageW = std::min<int>(rightmostPos, ceilf(pageSize.width() * maximumShrinkFactor)); + if (pageSize.height()) + m_pageHeight = pageW / pageSize.width() * pageSize.height(); root->setWidth(pageW); root->setNeedsLayoutAndPrefWidthsRecalc(); forceLayout(); } } - if (_adjustViewSize) + if (shouldAdjustViewSize) adjustViewSize(); + m_pageHeight = 0; } void FrameView::adjustPageHeight(float *newBottom, float oldTop, float oldBottom, float /*bottomLimit*/) diff --git a/WebCore/page/FrameView.h b/WebCore/page/FrameView.h index 718b793..9765c6f 100644 --- a/WebCore/page/FrameView.h +++ b/WebCore/page/FrameView.h @@ -199,7 +199,8 @@ public: void setIsVisuallyNonEmpty() { m_isVisuallyNonEmpty = true; } void forceLayout(bool allowSubtree = false); - void forceLayoutWithPageWidthRange(float minPageWidth, float maxPageWidth, bool adjustViewSize); + void forceLayoutForPagination(const FloatSize& pageSize, float maximumShrinkFactor, Frame::AdjustViewSizeOrNot); + int pageHeight() const { return m_pageHeight; } void adjustPageHeight(float* newBottom, float oldTop, float oldBottom, float bottomLimit); @@ -332,6 +333,8 @@ private: String m_mediaType; String m_mediaTypeWhenNotPrinting; + int m_pageHeight; + unsigned m_enqueueEvents; Vector<ScheduledEvent*> m_scheduledEvents; diff --git a/WebCore/page/Navigator.h b/WebCore/page/Navigator.h index b40bed4..a435f74 100644 --- a/WebCore/page/Navigator.h +++ b/WebCore/page/Navigator.h @@ -28,6 +28,7 @@ namespace WebCore { +<<<<<<< HEAD class DOMMimeTypeArray; class DOMPluginArray; class Frame; @@ -59,6 +60,35 @@ namespace WebCore { Geolocation* geolocation() const; // This is used for GC marking. Geolocation* optionalGeolocation() const { return m_geolocation.get(); } +======= +class DOMMimeTypeArray; +class DOMPluginArray; +class Frame; +class Geolocation; +class PluginData; +class String; + +class Navigator : public NavigatorBase, public RefCounted<Navigator> { +public: + static PassRefPtr<Navigator> create(Frame* frame) { return adoptRef(new Navigator(frame)); } + virtual ~Navigator(); + + void disconnectFrame(); + Frame* frame() const { return m_frame; } + + String appVersion() const; + String language() const; + DOMPluginArray* plugins() const; + DOMMimeTypeArray* mimeTypes() const; + bool cookieEnabled() const; + bool javaEnabled() const; + + virtual String userAgent() const; + + Geolocation* geolocation() const; + // This is used for GC marking. + Geolocation* optionalGeolocation() const { return m_geolocation.get(); } +>>>>>>> webkit.org at r64523 #if PLATFORM(ANDROID) Connection* connection() const; @@ -70,10 +100,11 @@ namespace WebCore { #endif #if ENABLE(DOM_STORAGE) - // Relinquishes the storage lock, if one exists. - void getStorageUpdates(); + // Relinquishes the storage lock, if one exists. + void getStorageUpdates(); #endif +<<<<<<< HEAD private: Navigator(Frame*); Frame* m_frame; @@ -89,6 +120,15 @@ namespace WebCore { String m_applicationNameQuery; #endif }; +======= +private: + Navigator(Frame*); + Frame* m_frame; + mutable RefPtr<DOMPluginArray> m_plugins; + mutable RefPtr<DOMMimeTypeArray> m_mimeTypes; + mutable RefPtr<Geolocation> m_geolocation; +}; +>>>>>>> webkit.org at r64523 } diff --git a/WebCore/page/Page.cpp b/WebCore/page/Page.cpp index 6db0e73..49a14c2 100644 --- a/WebCore/page/Page.cpp +++ b/WebCore/page/Page.cpp @@ -182,6 +182,7 @@ Page::Page(const PageClients& pageClients) , m_customHTMLTokenizerTimeDelay(-1) , m_customHTMLTokenizerChunkSize(-1) , m_canStartMedia(true) + , m_viewMode(ViewModeWindowed) { if (!allPages) { allPages = new HashSet<Page*>; @@ -219,6 +220,9 @@ Page::~Page() frame->pageDestroyed(); m_editorClient->pageDestroyed(); + if (m_pluginData) + m_pluginData->disconnectPage(); + #if ENABLE(INSPECTOR) m_inspectorController->inspectedPageDestroyed(); #endif @@ -235,6 +239,45 @@ Page::~Page() #endif } +struct ViewModeInfo { + const char* name; + Page::ViewMode type; +}; +static const int viewModeMapSize = 5; +static ViewModeInfo viewModeMap[viewModeMapSize] = { + {"windowed", Page::ViewModeWindowed}, + {"floating", Page::ViewModeFloating}, + {"fullscreen", Page::ViewModeFullscreen}, + {"maximized", Page::ViewModeMaximized}, + {"minimized", Page::ViewModeMinimized} +}; + +Page::ViewMode Page::stringToViewMode(const String& text) +{ + for (int i = 0; i < viewModeMapSize; ++i) { + if (text == viewModeMap[i].name) + return viewModeMap[i].type; + } + return Page::ViewModeInvalid; +} + +void Page::setViewMode(ViewMode viewMode) +{ + if (viewMode == m_viewMode || viewMode == ViewModeInvalid) + return; + + m_viewMode = viewMode; + + if (!m_mainFrame) + return; + + if (m_mainFrame->view()) + m_mainFrame->view()->forceLayout(); + + if (m_mainFrame->document()) + m_mainFrame->document()->updateStyleSelector(); +} + void Page::setMainFrame(PassRefPtr<Frame> mainFrame) { ASSERT(!m_mainFrame); // Should only be called during initialization diff --git a/WebCore/page/Page.h b/WebCore/page/Page.h index aab95f3..62af0a7 100644 --- a/WebCore/page/Page.h +++ b/WebCore/page/Page.h @@ -186,6 +186,20 @@ namespace WebCore { #endif Settings* settings() const { return m_settings.get(); } ProgressTracker* progress() const { return m_progress.get(); } + + + enum ViewMode { + ViewModeInvalid, + ViewModeWindowed, + ViewModeFloating, + ViewModeFullscreen, + ViewModeMaximized, + ViewModeMinimized + }; + static ViewMode stringToViewMode(const String&); + + ViewMode viewMode() const { return m_viewMode; } + void setViewMode(ViewMode); void setTabKeyCyclesThroughElements(bool b) { m_tabKeyCyclesThroughElements = b; } bool tabKeyCyclesThroughElements() const { return m_tabKeyCyclesThroughElements; } @@ -361,6 +375,8 @@ namespace WebCore { #if ENABLE(NOTIFICATIONS) NotificationPresenter* m_notificationPresenter; #endif + + ViewMode m_viewMode; }; } // namespace WebCore diff --git a/WebCore/page/PageGroup.cpp b/WebCore/page/PageGroup.cpp index e0502c5..15d4d8d 100644 --- a/WebCore/page/PageGroup.cpp +++ b/WebCore/page/PageGroup.cpp @@ -30,7 +30,7 @@ #include "ChromeClient.h" #include "Document.h" #include "Frame.h" -#include "IndexedDatabase.h" +#include "IDBFactoryBackendInterface.h" #include "Page.h" #include "Settings.h" #include "StorageNamespace.h" @@ -136,6 +136,11 @@ bool PageGroup::isLinkVisited(LinkHash visitedLinkHash) #endif } +void PageGroup::addVisitedLinkHash(LinkHash hash) +{ + addVisitedLink(hash); +} + inline void PageGroup::addVisitedLink(LinkHash hash) { ASSERT(shouldTrackVisitedLinks); @@ -203,13 +208,13 @@ StorageNamespace* PageGroup::localStorage() #endif #if ENABLE(INDEXED_DATABASE) -IndexedDatabase* PageGroup::indexedDatabase() +IDBFactoryBackendInterface* PageGroup::idbFactory() { // Do not add page setting based access control here since this object is shared by all pages in // the group and having per-page controls is misleading. - if (!m_indexedDatabase) - m_indexedDatabase = IndexedDatabase::create(); - return m_indexedDatabase.get(); + if (!m_factoryBackend) + m_factoryBackend = IDBFactoryBackendInterface::create(); + return m_factoryBackend.get(); } #endif diff --git a/WebCore/page/PageGroup.h b/WebCore/page/PageGroup.h index 77aa281..08b03d7 100644 --- a/WebCore/page/PageGroup.h +++ b/WebCore/page/PageGroup.h @@ -36,7 +36,7 @@ namespace WebCore { class KURL; - class IndexedDatabase; + class IDBFactoryBackendInterface; class Page; class StorageNamespace; @@ -58,6 +58,7 @@ namespace WebCore { void addVisitedLink(const KURL&); void addVisitedLink(const UChar*, size_t); + void addVisitedLinkHash(LinkHash); void removeVisitedLinks(); static void setShouldTrackVisitedLinks(bool); @@ -71,7 +72,7 @@ namespace WebCore { bool hasLocalStorage() { return m_localStorage; } #endif #if ENABLE(INDEXED_DATABASE) - IndexedDatabase* indexedDatabase(); + IDBFactoryBackendInterface* idbFactory(); #endif void addUserScriptToWorld(DOMWrapperWorld*, const String& source, const KURL&, @@ -108,7 +109,7 @@ namespace WebCore { RefPtr<StorageNamespace> m_localStorage; #endif #if ENABLE(INDEXED_DATABASE) - RefPtr<IndexedDatabase> m_indexedDatabase; + RefPtr<IDBFactoryBackendInterface> m_factoryBackend; #endif OwnPtr<UserScriptMap> m_userScripts; diff --git a/WebCore/page/PrintContext.cpp b/WebCore/page/PrintContext.cpp index 74af4b1..7b0179d 100644 --- a/WebCore/page/PrintContext.cpp +++ b/WebCore/page/PrintContext.cpp @@ -117,7 +117,7 @@ void PrintContext::computePageRectsWithPageSizeInternal(const FloatSize& pageSiz } while (printedPagesHeight < docHeight); } -void PrintContext::begin(float width) +void PrintContext::begin(float width, float height) { ASSERT(!m_isPrinting); m_isPrinting = true; @@ -136,11 +136,11 @@ void PrintContext::begin(float width) const float PrintingMaximumShrinkFactor = 2.0f; float minLayoutWidth = width * PrintingMinimumShrinkFactor; - float maxLayoutWidth = width * PrintingMaximumShrinkFactor; + float minLayoutHeight = height * PrintingMinimumShrinkFactor; // FIXME: This will modify the rendering of the on-screen frame. // Could lead to flicker during printing. - m_frame->setPrinting(true, minLayoutWidth, maxLayoutWidth, true); + m_frame->setPrinting(true, FloatSize(minLayoutWidth, minLayoutHeight), PrintingMaximumShrinkFactor / PrintingMinimumShrinkFactor, Frame::AdjustViewSize); } void PrintContext::spoolPage(GraphicsContext& ctx, int pageNumber, float width) @@ -160,7 +160,7 @@ void PrintContext::end() { ASSERT(m_isPrinting); m_isPrinting = false; - m_frame->setPrinting(false, 0, 0, true); + m_frame->setPrinting(false, FloatSize(), 0, Frame::AdjustViewSize); } static RenderBoxModelObject* enclosingBoxModelObject(RenderObject* object) @@ -186,8 +186,10 @@ int PrintContext::pageNumberForElement(Element* element, const FloatSize& pageSi Frame* frame = element->document()->frame(); FloatRect pageRect(FloatPoint(0, 0), pageSizeInPixels); PrintContext printContext(frame); - printContext.begin(pageRect.width()); - printContext.computePageRectsWithPageSize(pageSizeInPixels, false); + printContext.begin(pageRect.width(), pageRect.height()); + FloatSize scaledPageSize = pageSizeInPixels; + scaledPageSize.scale(frame->view()->contentsSize().width() / pageRect.width()); + printContext.computePageRectsWithPageSize(scaledPageSize, false); int top = box->offsetTop(); int left = box->offsetLeft(); @@ -244,8 +246,11 @@ int PrintContext::numberOfPages(Frame* frame, const FloatSize& pageSizeInPixels) FloatRect pageRect(FloatPoint(0, 0), pageSizeInPixels); PrintContext printContext(frame); - printContext.begin(pageRect.width()); - printContext.computePageRectsWithPageSize(pageSizeInPixels, false); + printContext.begin(pageRect.width(), pageRect.height()); + // Account for shrink-to-fit. + FloatSize scaledPageSize = pageSizeInPixels; + scaledPageSize.scale(frame->view()->contentsSize().width() / pageRect.width()); + printContext.computePageRectsWithPageSize(scaledPageSize, false); return printContext.pageCount(); } @@ -257,7 +262,7 @@ void PrintContext::spoolAllPagesWithBoundaries(Frame* frame, GraphicsContext& gr frame->document()->updateLayout(); PrintContext printContext(frame); - printContext.begin(pageSizeInPixels.width()); + printContext.begin(pageSizeInPixels.width(), pageSizeInPixels.height()); float pageHeight; printContext.computePageRects(FloatRect(FloatPoint(0, 0), pageSizeInPixels), 0, 0, 1, pageHeight); diff --git a/WebCore/page/PrintContext.h b/WebCore/page/PrintContext.h index 8492718..ed1cfa4 100644 --- a/WebCore/page/PrintContext.h +++ b/WebCore/page/PrintContext.h @@ -46,7 +46,7 @@ public: void computePageRectsWithPageSize(const FloatSize& pageSizeInPixels, bool allowHorizontalMultiPages); // TODO: eliminate width param - void begin(float width); + void begin(float width, float height = 0); // TODO: eliminate width param void spoolPage(GraphicsContext& ctx, int pageNumber, float width); diff --git a/WebCore/page/chromium/ChromeClientChromium.h b/WebCore/page/chromium/ChromeClientChromium.h index 46985b1..e897c15 100644 --- a/WebCore/page/chromium/ChromeClientChromium.h +++ b/WebCore/page/chromium/ChromeClientChromium.h @@ -39,10 +39,6 @@ class AccessibilityObject; class IntRect; class PopupContainer; -#if USE(ACCELERATED_COMPOSITING) -class GLES2Context; -#endif - // Contains Chromium-specific extensions to the ChromeClient. Only put // things here that don't make sense for other ports. class ChromeClientChromium : public ChromeClient { @@ -59,12 +55,6 @@ public: // Notifies embedder that the state of an accessibility object has changed. virtual void didChangeAccessibilityObjectState(AccessibilityObject*) = 0; - -#if USE(ACCELERATED_COMPOSITING) - // Request a GL ES 2 context to use for compositing this page's content. - virtual PassOwnPtr<GLES2Context> getOnscreenGLES2Context() = 0; - virtual PassOwnPtr<GLES2Context> getOffscreenGLES2Context() = 0; -#endif }; } // namespace WebCore diff --git a/WebCore/platform/MIMETypeRegistry.cpp b/WebCore/platform/MIMETypeRegistry.cpp index e6eb209..e9e5dd3 100644 --- a/WebCore/platform/MIMETypeRegistry.cpp +++ b/WebCore/platform/MIMETypeRegistry.cpp @@ -180,6 +180,12 @@ static void initializeSupportedImageMIMETypesForEncoding() } supportedImageMIMETypesForEncoding->remove("application/octet-stream"); +#elif PLATFORM(GTK) + supportedImageMIMETypesForEncoding->add("image/png"); + supportedImageMIMETypesForEncoding->add("image/jpeg"); + supportedImageMIMETypesForEncoding->add("image/tiff"); + supportedImageMIMETypesForEncoding->add("image/bmp"); + supportedImageMIMETypesForEncoding->add("image/ico"); #elif PLATFORM(CAIRO) supportedImageMIMETypesForEncoding->add("image/png"); #endif diff --git a/WebCore/platform/PlatformStrategies.h b/WebCore/platform/PlatformStrategies.h index f585202..c02ce00 100644 --- a/WebCore/platform/PlatformStrategies.h +++ b/WebCore/platform/PlatformStrategies.h @@ -32,6 +32,7 @@ namespace WebCore { class PluginStrategy; class LocalizationStrategy; +class VisitedLinkStrategy; class PlatformStrategies { public: @@ -49,10 +50,18 @@ public: return m_localizationStrategy; } + VisitedLinkStrategy* visitedLinkStrategy() + { + if (!m_visitedLinkStrategy) + m_visitedLinkStrategy = createVisitedLinkStrategy(); + return m_visitedLinkStrategy; + } + protected: PlatformStrategies() - : m_pluginStrategy(0), - m_localizationStrategy(0) + : m_pluginStrategy(0) + , m_localizationStrategy(0) + , m_visitedLinkStrategy(0) { } @@ -63,9 +72,11 @@ protected: private: virtual PluginStrategy* createPluginStrategy() = 0; virtual LocalizationStrategy* createLocalizationStrategy() = 0; + virtual VisitedLinkStrategy* createVisitedLinkStrategy() = 0; PluginStrategy* m_pluginStrategy; LocalizationStrategy* m_localizationStrategy; + VisitedLinkStrategy* m_visitedLinkStrategy; }; PlatformStrategies* platformStrategies(); diff --git a/WebCore/platform/PopupMenu.h b/WebCore/platform/PopupMenu.h index d9d2740..8ebba03 100644 --- a/WebCore/platform/PopupMenu.h +++ b/WebCore/platform/PopupMenu.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006, 2008 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 * modify it under the terms of the GNU Library General Public @@ -21,180 +21,22 @@ #ifndef PopupMenu_h #define PopupMenu_h -#include "IntRect.h" -#include "PopupMenuClient.h" -#include <wtf/PassRefPtr.h> #include <wtf/RefCounted.h> -#if PLATFORM(MAC) -#include <wtf/RetainPtr.h> -#ifdef __OBJC__ -@class NSPopUpButtonCell; -#else -class NSPopUpButtonCell; -#endif -#elif PLATFORM(WIN) -#include "Scrollbar.h" -#include "ScrollbarClient.h" -#include <wtf/RefPtr.h> -typedef struct HWND__* HWND; -typedef struct HDC__* HDC; -typedef struct HBITMAP__* HBITMAP; -#elif PLATFORM(QT) -namespace WebCore { -class QtAbstractWebPopup; -} -#elif PLATFORM(GTK) -typedef struct _GtkMenu GtkMenu; -typedef struct _GtkMenuItem GtkMenuItem; -typedef struct _GtkWidget GtkWidget; -#include "GRefPtrGtk.h" -#include <wtf/HashMap.h> -#include <glib.h> -#elif PLATFORM(WX) -#ifdef __WXMSW__ -#include <wx/msw/winundef.h> -#endif -class wxMenu; -#include <wx/defs.h> -#include <wx/event.h> -#elif PLATFORM(CHROMIUM) -#include "PopupMenuPrivate.h" -#elif PLATFORM(HAIKU) -namespace WebCore { -class PopupMenuHaiku; -} -#endif - namespace WebCore { class FrameView; -class Scrollbar; +class IntRect; -class PopupMenu : public RefCounted<PopupMenu> -#if PLATFORM(WIN) - , private ScrollbarClient -#endif -#if PLATFORM(WX) - , public wxEvtHandler -#endif -{ +class PopupMenu : public RefCounted<PopupMenu> { public: - static PassRefPtr<PopupMenu> create(PopupMenuClient* client) { return adoptRef(new PopupMenu(client)); } - ~PopupMenu(); - - void disconnectClient() { m_popupClient = 0; } - - void show(const IntRect&, FrameView*, int index); - void hide(); - - void updateFromElement(); - - PopupMenuClient* client() const { return m_popupClient; } - - static bool itemWritingDirectionIsNatural(); - -#if PLATFORM(WIN) - Scrollbar* scrollbar() const { return m_scrollbar.get(); } - - static LPCTSTR popupClassName(); - - bool up(unsigned lines = 1); - bool down(unsigned lines = 1); - - int itemHeight() const { return m_itemHeight; } - const IntRect& windowRect() const { return m_windowRect; } - IntRect clientRect() const; - - int visibleItems() const; - - int listIndexAtPoint(const IntPoint&) const; - - bool setFocusedIndex(int index, bool hotTracking = false); - int focusedIndex() const; - void focusFirst(); - void focusLast(); - - void paint(const IntRect& damageRect, HDC = 0); - - HWND popupHandle() const { return m_popup; } - - 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(); - - void incrementWheelDelta(int delta); - void reduceWheelDelta(int delta); - int wheelDelta() const { return m_wheelDelta; } - - bool scrollbarCapturingMouse() const { return m_scrollbarCapturingMouse; } - void setScrollbarCapturingMouse(bool b) { m_scrollbarCapturingMouse = b; } -#endif - -protected: - PopupMenu(PopupMenuClient*); - -private: - PopupMenuClient* m_popupClient; - -#if PLATFORM(MAC) - void clear(); - void populate(); - - RetainPtr<NSPopUpButtonCell> m_popup; -#elif PLATFORM(QT) - QtAbstractWebPopup* m_popup; -#elif PLATFORM(WIN) - // ScrollBarClient - virtual void valueChanged(Scrollbar*); - virtual void invalidateScrollbarRect(Scrollbar*, const IntRect&); - virtual bool isActive() const { return true; } - virtual bool scrollbarCornerPresent() const { return false; } - - void calculatePositionAndSize(const IntRect&, FrameView*); - void invalidateItem(int index); - - static LRESULT CALLBACK PopupMenuWndProc(HWND, UINT, WPARAM, LPARAM); - LRESULT wndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); - static void registerClass(); - - RefPtr<Scrollbar> m_scrollbar; - HWND m_popup; - HDC m_DC; - HBITMAP m_bmp; - bool m_wasClicked; - IntRect m_windowRect; - int m_itemHeight; - int m_scrollOffset; - int m_wheelDelta; - int m_focusedIndex; - bool m_scrollbarCapturingMouse; - bool m_showPopup; -#elif PLATFORM(GTK) - IntPoint m_menuPosition; - GRefPtr<GtkMenu> m_popup; - HashMap<GtkWidget*, int> m_indexMap; - static void menuItemActivated(GtkMenuItem* item, PopupMenu*); - static void menuUnmapped(GtkWidget*, PopupMenu*); - static void menuPositionFunction(GtkMenu*, gint*, gint*, gboolean*, PopupMenu*); - static void menuRemoveItem(GtkWidget*, PopupMenu*); -#elif PLATFORM(EFL) || PLATFORM(BREWMP) - FrameView* m_view; -#elif PLATFORM(WX) - wxMenu* m_menu; - void OnMenuItemSelected(wxCommandEvent&); -#elif PLATFORM(CHROMIUM) - PopupMenuPrivate p; -#elif PLATFORM(HAIKU) - PopupMenuHaiku* m_menu; -#endif - + virtual ~PopupMenu() {} + virtual void show(const IntRect&, FrameView*, int index) = 0; + virtual void hide() = 0; + virtual void updateFromElement() = 0; + virtual void disconnectClient() = 0; }; } -#endif +#endif // PopupMenu_h diff --git a/WebCore/platform/SearchPopupMenu.h b/WebCore/platform/SearchPopupMenu.h index 4285cdf..d1ecd0f 100644 --- a/WebCore/platform/SearchPopupMenu.h +++ b/WebCore/platform/SearchPopupMenu.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006, 2008 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 * modify it under the terms of the GNU Library General Public @@ -23,24 +23,21 @@ #include "PopupMenu.h" #include <wtf/Vector.h> +#include <wtf/text/WTFString.h> namespace WebCore { class AtomicString; -class SearchPopupMenu : public PopupMenu { +class SearchPopupMenu : public RefCounted<SearchPopupMenu> { public: - static PassRefPtr<SearchPopupMenu> create(PopupMenuClient* client) { return adoptRef(new SearchPopupMenu(client)); } - - void saveRecentSearches(const AtomicString& name, const Vector<String>& searchItems); - void loadRecentSearches(const AtomicString& name, Vector<String>& searchItems); - - bool enabled(); - -private: - SearchPopupMenu(PopupMenuClient*); + virtual ~SearchPopupMenu() {} + virtual PopupMenu* popupMenu() = 0; + virtual void saveRecentSearches(const AtomicString& name, const Vector<String>& searchItems) = 0; + virtual void loadRecentSearches(const AtomicString& name, Vector<String>& searchItems) = 0; + virtual bool enabled() = 0; }; } -#endif +#endif // SearchPopupMenu_h diff --git a/WebCore/platform/SharedBuffer.cpp b/WebCore/platform/SharedBuffer.cpp index 6cf1131..35a7b7c 100644 --- a/WebCore/platform/SharedBuffer.cpp +++ b/WebCore/platform/SharedBuffer.cpp @@ -239,7 +239,7 @@ unsigned SharedBuffer::getSomeData(const char*& someData, unsigned position) con return segment == segments - 1 ? segmentedSize - position : segmentSize - positionInSegment; } -#if !PLATFORM(CF) +#if !PLATFORM(CF) || PLATFORM(QT) inline void SharedBuffer::clearPlatformData() { diff --git a/WebCore/platform/brew/PopupMenuBrew.cpp b/WebCore/platform/brew/PopupMenuBrew.cpp index eb03c66..18b2b45 100644 --- a/WebCore/platform/brew/PopupMenuBrew.cpp +++ b/WebCore/platform/brew/PopupMenuBrew.cpp @@ -4,6 +4,7 @@ * Copyright (C) 2009-2010 ProFUSION embedded systems * Copyright (C) 2009-2010 Samsung Electronics * Copyright (C) 2010 Company 100, Inc. + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -23,7 +24,7 @@ */ #include "config.h" -#include "PopupMenu.h" +#include "PopupMenuBrew.h" #include "Chrome.h" #include "ChromeClientBrew.h" @@ -32,20 +33,25 @@ namespace WebCore { -PopupMenu::PopupMenu(PopupMenuClient* menuList) +PopupMenuBrew::PopupMenuBrew(PopupMenuClient* menuList) : m_popupClient(menuList) , m_view(0) { } -PopupMenu::~PopupMenu() +PopupMenuBrew::~PopupMenuBrew() { // Tell client to destroy data related to this popup since this object is // going away. hide(); } -void PopupMenu::show(const IntRect& rect, FrameView* view, int index) +void PopupMenuBrew::disconnectClient() +{ + m_popupClient = 0; +} + +void PopupMenuBrew::show(const IntRect& rect, FrameView* view, int index) { ASSERT(m_popupClient); ChromeClientBrew* chromeClient = static_cast<ChromeClientBrew*>(view->frame()->page()->chrome()->client()); @@ -55,7 +61,7 @@ void PopupMenu::show(const IntRect& rect, FrameView* view, int index) chromeClient->createSelectPopup(m_popupClient, index, rect); } -void PopupMenu::hide() +void PopupMenuBrew::hide() { ASSERT(m_view); ChromeClientBrew* chromeClient = static_cast<ChromeClientBrew*>(m_view->frame()->page()->chrome()->client()); @@ -64,14 +70,18 @@ void PopupMenu::hide() chromeClient->destroySelectPopup(); } -void PopupMenu::updateFromElement() +void PopupMenuBrew::updateFromElement() { client()->setTextFromItem(client()->selectedIndex()); } -bool PopupMenu::itemWritingDirectionIsNatural() -{ - return true; -} +// This code must be moved to the concrete brew ChromeClient that is not in repository. +// I kept this code commented out here to prevent loosing the information of what +// must be the return value for brew. + +// bool PopupMenuBrew::itemWritingDirectionIsNatural() +// { +// return true; +// } } // namespace WebCore diff --git a/WebCore/platform/brew/PopupMenuBrew.h b/WebCore/platform/brew/PopupMenuBrew.h new file mode 100644 index 0000000..0c171df --- /dev/null +++ b/WebCore/platform/brew/PopupMenuBrew.h @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#ifndef PopupMenuBrew_h +#define PopupMenuBrew_h + +#include "IntRect.h" +#include "PopupMenu.h" +#include "PopupMenuClient.h" +#include <wtf/PassRefPtr.h> +#include <wtf/RefCounted.h> + +namespace WebCore { + +class FrameView; +class Scrollbar; + +class PopupMenuBrew : public PopupMenu { +public: + PopupMenuBrew(PopupMenuClient*); + ~PopupMenuBrew(); + + virtual void show(const IntRect&, FrameView*, int index); + virtual void hide(); + virtual void updateFromElement(); + virtual void disconnectClient(); + +private: + PopupMenuClient* client() const { return m_popupClient; } + + PopupMenuClient* m_popupClient; + FrameView* m_view; +}; + +} + +#endif // PopupMenuBrew_h diff --git a/WebCore/platform/brew/SearchPopupMenuBrew.cpp b/WebCore/platform/brew/SearchPopupMenuBrew.cpp index 780c7e5..81ca624 100644 --- a/WebCore/platform/brew/SearchPopupMenuBrew.cpp +++ b/WebCore/platform/brew/SearchPopupMenuBrew.cpp @@ -1,5 +1,6 @@ /* * Copyright (C) 2010 Company 100, Inc. All rights reserved. + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -24,29 +25,34 @@ */ #include "config.h" -#include "SearchPopupMenu.h" +#include "SearchPopupMenuBrew.h" namespace WebCore { // Save the past searches stored in 'searchItems' to a database associated with 'name' -void SearchPopupMenu::saveRecentSearches(const AtomicString& name, const Vector<String>& searchItems) +void SearchPopupMenuBrew::saveRecentSearches(const AtomicString& name, const Vector<String>& searchItems) { } // Load past searches associated with 'name' from the database to 'searchItems' -void SearchPopupMenu::loadRecentSearches(const AtomicString& name, Vector<String>& searchItems) +void SearchPopupMenuBrew::loadRecentSearches(const AtomicString& name, Vector<String>& searchItems) { } // Create a search popup menu - not sure what else we have to do here -SearchPopupMenu::SearchPopupMenu(PopupMenuClient* client) - : PopupMenu(client) +SearchPopupMenuBrew::SearchPopupMenuBrew(PopupMenuClient* client) + : m_popup(adoptRef(new PopupMenuBrew(client))) { } -bool SearchPopupMenu::enabled() +bool SearchPopupMenuBrew::enabled() { return false; } +PopupMenu* SearchPopupMenuBrew::popupMenu() +{ + return m_popup.get(); +} + } // namespace WebCore diff --git a/WebCore/platform/brew/SearchPopupMenuBrew.h b/WebCore/platform/brew/SearchPopupMenuBrew.h new file mode 100644 index 0000000..4ce7005 --- /dev/null +++ b/WebCore/platform/brew/SearchPopupMenuBrew.h @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ + +#ifndef SearchPopupMenuBrew_h +#define SearchPopupMenuBrew_h + +#include "PopupMenuBrew.h" +#include "SearchPopupMenu.h" + +namespace WebCore { + +class SearchPopupMenuBrew : public SearchPopupMenu { +public: + SearchPopupMenuBrew(PopupMenuClient*); + + virtual PopupMenu* popupMenu(); + virtual void saveRecentSearches(const AtomicString& name, const Vector<String>& searchItems); + virtual void loadRecentSearches(const AtomicString& name, Vector<String>& searchItems); + virtual bool enabled(); + +private: + RefPtr<PopupMenuBrew> m_popup; +}; + +} + +#endif // SearchPopupMenuBrew_h diff --git a/WebCore/platform/chromium/ChromiumBridge.h b/WebCore/platform/chromium/ChromiumBridge.h index 711c728..acfefe1 100644 --- a/WebCore/platform/chromium/ChromiumBridge.h +++ b/WebCore/platform/chromium/ChromiumBridge.h @@ -70,7 +70,7 @@ namespace WebCore { class GeolocationServiceChromium; class GraphicsContext; class Image; - class IndexedDatabase; + class IDBFactoryBackendInterface; class IntRect; class KURL; class String; @@ -166,7 +166,7 @@ namespace WebCore { static long long databaseGetFileSize(const String& vfsFileName); // IndexedDB ---------------------------------------------------------- - static PassRefPtr<IndexedDatabase> indexedDatabase(); + static PassRefPtr<IDBFactoryBackendInterface> idbFactory(); // JavaScript --------------------------------------------------------- static void notifyJSOutOfMemory(Frame*); diff --git a/WebCore/platform/chromium/PopupMenuChromium.cpp b/WebCore/platform/chromium/PopupMenuChromium.cpp index d07ba2e..9c73a9c 100644 --- a/WebCore/platform/chromium/PopupMenuChromium.cpp +++ b/WebCore/platform/chromium/PopupMenuChromium.cpp @@ -1,5 +1,6 @@ /* * Copyright (c) 2008, 2009, Google Inc. All rights reserved. + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -48,7 +49,6 @@ #include "PlatformMouseEvent.h" #include "PlatformScreen.h" #include "PlatformWheelEvent.h" -#include "PopupMenu.h" #include "RenderTheme.h" #include "ScrollbarTheme.h" #include "StringTruncator.h" @@ -1340,20 +1340,20 @@ bool PopupListBox::isPointInBounds(const IntPoint& point) } /////////////////////////////////////////////////////////////////////////////// -// PopupMenu implementation +// PopupMenuChromium implementation // // Note: you cannot add methods to this class, since it is defined above the // portability layer. To access methods and properties on the // popup widgets, use |popupWindow| above. -PopupMenu::PopupMenu(PopupMenuClient* client) +PopupMenuChromium::PopupMenuChromium(PopupMenuClient* client) : m_popupClient(client) { } -PopupMenu::~PopupMenu() +PopupMenuChromium::~PopupMenuChromium() { - // When the PopupMenu is destroyed, the client could already have been + // When the PopupMenuChromium is destroyed, the client could already have been // deleted. if (p.popup) p.popup->listBox()->disconnectClient(); @@ -1364,7 +1364,7 @@ PopupMenu::~PopupMenu() // to display, handle the input tracking and menu item selection for the popup. // Windows and Linux Chromium let our WebKit port handle the display, while // another process manages the popup window and input handling. -void PopupMenu::show(const IntRect& r, FrameView* v, int index) +void PopupMenuChromium::show(const IntRect& r, FrameView* v, int index) { if (!p.popup) p.popup = PopupContainer::create(client(), PopupContainer::Select, dropDownSettings); @@ -1375,20 +1375,21 @@ void PopupMenu::show(const IntRect& r, FrameView* v, int index) #endif } -void PopupMenu::hide() +void PopupMenuChromium::hide() { if (p.popup) p.popup->hide(); } -void PopupMenu::updateFromElement() +void PopupMenuChromium::updateFromElement() { p.popup->listBox()->updateFromElement(); } -bool PopupMenu::itemWritingDirectionIsNatural() -{ - return false; + +void PopupMenuChromium::disconnectClient() +{ + m_popupClient = 0; } } // namespace WebCore diff --git a/WebCore/platform/chromium/PopupMenuChromium.h b/WebCore/platform/chromium/PopupMenuChromium.h index a85cf49..0d0e23c 100644 --- a/WebCore/platform/chromium/PopupMenuChromium.h +++ b/WebCore/platform/chromium/PopupMenuChromium.h @@ -36,6 +36,8 @@ #include "FramelessScrollView.h" #include "IntRect.h" +#include "PopupMenu.h" +#include "PopupMenuPrivate.h" namespace WebCore { @@ -201,6 +203,23 @@ private: bool m_popupOpen; }; +class PopupMenuChromium : public PopupMenu { +public: + PopupMenuChromium(PopupMenuClient*); + ~PopupMenuChromium(); + + virtual void show(const IntRect&, FrameView*, int index); + virtual void hide(); + virtual void updateFromElement(); + virtual void disconnectClient(); + +private: + PopupMenuClient* client() const { return m_popupClient; } + + PopupMenuClient* m_popupClient; + PopupMenuPrivate p; +}; + } // namespace WebCore #endif diff --git a/WebCore/platform/chromium/SearchPopupMenuChromium.cpp b/WebCore/platform/chromium/SearchPopupMenuChromium.cpp index 89bfddd..d4d4ff5 100644 --- a/WebCore/platform/chromium/SearchPopupMenuChromium.cpp +++ b/WebCore/platform/chromium/SearchPopupMenuChromium.cpp @@ -1,5 +1,6 @@ /* * Copyright (c) 2008, 2009, Google Inc. All rights reserved. + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -29,29 +30,34 @@ */ #include "config.h" -#include "SearchPopupMenu.h" +#include "SearchPopupMenuChromium.h" #include "AtomicString.h" #include "NotImplemented.h" namespace WebCore { -SearchPopupMenu::SearchPopupMenu(PopupMenuClient* client) - : PopupMenu(client) +SearchPopupMenuChromium::SearchPopupMenuChromium(PopupMenuClient* client) + : m_popup(adoptRef(new PopupMenuChromium(client))) { } -bool SearchPopupMenu::enabled() +PopupMenu* SearchPopupMenuChromium::popupMenu() +{ + return m_popup.get(); +} + +bool SearchPopupMenuChromium::enabled() { return false; } -void SearchPopupMenu::saveRecentSearches(const AtomicString& name, const Vector<String>& searchItems) +void SearchPopupMenuChromium::saveRecentSearches(const AtomicString& name, const Vector<String>& searchItems) { notImplemented(); } -void SearchPopupMenu::loadRecentSearches(const AtomicString& name, Vector<String>& searchItems) +void SearchPopupMenuChromium::loadRecentSearches(const AtomicString& name, Vector<String>& searchItems) { notImplemented(); } diff --git a/WebCore/platform/chromium/SearchPopupMenuChromium.h b/WebCore/platform/chromium/SearchPopupMenuChromium.h new file mode 100644 index 0000000..827ff66 --- /dev/null +++ b/WebCore/platform/chromium/SearchPopupMenuChromium.h @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ + +#ifndef SearchPopupMenuChromium_h +#define SearchPopupMenuChromium_h + +#include "PopupMenuChromium.h" +#include "SearchPopupMenu.h" + +namespace WebCore { + +class SearchPopupMenuChromium : public SearchPopupMenu { +public: + SearchPopupMenuChromium(PopupMenuClient*); + + virtual PopupMenu* popupMenu(); + virtual void saveRecentSearches(const AtomicString& name, const Vector<String>& searchItems); + virtual void loadRecentSearches(const AtomicString& name, Vector<String>& searchItems); + virtual bool enabled(); + +private: + RefPtr<PopupMenuChromium> m_popup; +}; + +} + +#endif // SearchPopupMenuChromium_h diff --git a/WebCore/platform/efl/PopupMenuEfl.cpp b/WebCore/platform/efl/PopupMenuEfl.cpp index 9dc6986..401f24f 100644 --- a/WebCore/platform/efl/PopupMenuEfl.cpp +++ b/WebCore/platform/efl/PopupMenuEfl.cpp @@ -3,6 +3,7 @@ * Copyright (C) 2008 INdT - Instituto Nokia de Tecnologia * Copyright (C) 2009-2010 ProFUSION embedded systems * Copyright (C) 2009-2010 Samsung Electronics + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -22,29 +23,30 @@ */ #include "config.h" -#include "PopupMenu.h" +#include "PopupMenuEfl.h" #include "Chrome.h" #include "ChromeClientEfl.h" #include "FrameView.h" #include "NotImplemented.h" +#include "PopupMenuClient.h" namespace WebCore { -PopupMenu::PopupMenu(PopupMenuClient* client) +PopupMenuEfl::PopupMenuEfl(PopupMenuClient* client) : m_popupClient(client) , m_view(0) { } -PopupMenu::~PopupMenu() +PopupMenuEfl::~PopupMenuEfl() { // Tell client to destroy data related to this popup since this object is // going away. hide(); } -void PopupMenu::show(const IntRect& rect, FrameView* view, int index) +void PopupMenuEfl::show(const IntRect& rect, FrameView* view, int index) { ASSERT(m_popupClient); ChromeClientEfl* chromeClient = static_cast<ChromeClientEfl*>(view->frame()->page()->chrome()->client()); @@ -54,7 +56,7 @@ void PopupMenu::show(const IntRect& rect, FrameView* view, int index) chromeClient->createSelectPopup(m_popupClient, index, rect); } -void PopupMenu::hide() +void PopupMenuEfl::hide() { ASSERT(m_view); ChromeClientEfl* chromeClient = static_cast<ChromeClientEfl*>(m_view->frame()->page()->chrome()->client()); @@ -63,14 +65,14 @@ void PopupMenu::hide() chromeClient->destroySelectPopup(); } -void PopupMenu::updateFromElement() +void PopupMenuEfl::updateFromElement() { client()->setTextFromItem(client()->selectedIndex()); } -bool PopupMenu::itemWritingDirectionIsNatural() +void PopupMenuEfl::disconnectClient() { - return true; + m_popupClient = 0; } } diff --git a/WebCore/platform/efl/PopupMenuEfl.h b/WebCore/platform/efl/PopupMenuEfl.h new file mode 100644 index 0000000..4a2dbfc --- /dev/null +++ b/WebCore/platform/efl/PopupMenuEfl.h @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#ifndef PopupMenuEfl_h +#define PopupMenuEfl_h + +#include "IntRect.h" +#include "PopupMenu.h" +#include <wtf/PassRefPtr.h> +#include <wtf/RefCounted.h> + +namespace WebCore { + +class FrameView; +class Scrollbar; +class PopupMenuClient; + +class PopupMenuEfl : public PopupMenu { +public: + PopupMenuEfl(PopupMenuClient*); + ~PopupMenuEfl(); + + virtual void show(const IntRect&, FrameView*, int index); + virtual void hide(); + virtual void updateFromElement(); + virtual void disconnectClient(); + +private: + PopupMenuClient* client() const { return m_popupClient; } + + PopupMenuClient* m_popupClient; + FrameView* m_view; +}; + +} + +#endif // PopupMenuEfl_h diff --git a/WebCore/platform/efl/SearchPopupMenuEfl.cpp b/WebCore/platform/efl/SearchPopupMenuEfl.cpp index d18174f..20ecb09 100644 --- a/WebCore/platform/efl/SearchPopupMenuEfl.cpp +++ b/WebCore/platform/efl/SearchPopupMenuEfl.cpp @@ -2,6 +2,7 @@ * Copyright (C) 2008 INdT - Instituto Nokia de Tecnologia * Copyright (C) 2009-2010 ProFUSION embedded systems * Copyright (C) 2009-2010 Samsung Electronics + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -19,29 +20,34 @@ */ #include "config.h" -#include "SearchPopupMenu.h" +#include "SearchPopupMenuEfl.h" #include "NotImplemented.h" namespace WebCore { -SearchPopupMenu::SearchPopupMenu(PopupMenuClient* client) - : PopupMenu(client) +SearchPopupMenuEfl::SearchPopupMenuEfl(PopupMenuClient* client) + : m_popup(adoptRef(new PopupMenuEfl(client))) { notImplemented(); } -void SearchPopupMenu::saveRecentSearches(const AtomicString&, const Vector<String>&) +PopupMenu* SearchPopupMenuEfl::popupMenu() +{ + return m_popup.get(); +} + +void SearchPopupMenuEfl::saveRecentSearches(const AtomicString&, const Vector<String>&) { notImplemented(); } -void SearchPopupMenu::loadRecentSearches(const AtomicString&, Vector<String>&) +void SearchPopupMenuEfl::loadRecentSearches(const AtomicString&, Vector<String>&) { notImplemented(); } -bool SearchPopupMenu::enabled() +bool SearchPopupMenuEfl::enabled() { notImplemented(); return true; diff --git a/WebCore/platform/efl/SearchPopupMenuEfl.h b/WebCore/platform/efl/SearchPopupMenuEfl.h new file mode 100644 index 0000000..4ffb62e --- /dev/null +++ b/WebCore/platform/efl/SearchPopupMenuEfl.h @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ + +#ifndef SearchPopupMenuEfl_h +#define SearchPopupMenuEfl_h + +#include "PopupMenuEfl.h" +#include "SearchPopupMenu.h" + +namespace WebCore { + +class SearchPopupMenuEfl : public SearchPopupMenu { +public: + SearchPopupMenuEfl(PopupMenuClient*); + + virtual PopupMenu* popupMenu(); + virtual void saveRecentSearches(const AtomicString& name, const Vector<String>& searchItems); + virtual void loadRecentSearches(const AtomicString& name, Vector<String>& searchItems); + virtual bool enabled(); + +private: + RefPtr<PopupMenuEfl> m_popup; +}; + +} + +#endif // SearchPopupMenuEfl_h diff --git a/WebCore/platform/graphics/FloatRect.cpp b/WebCore/platform/graphics/FloatRect.cpp index 7a54f21..6dfa808 100644 --- a/WebCore/platform/graphics/FloatRect.cpp +++ b/WebCore/platform/graphics/FloatRect.cpp @@ -30,6 +30,7 @@ #include "FloatConversion.h" #include "IntRect.h" #include <algorithm> +#include <limits> #include <math.h> using std::max; @@ -110,13 +111,26 @@ void FloatRect::scale(float sx, float sy) m_size.setHeight(height() * sy); } +static inline int safeFloatToInt(float x) +{ + static const int s_intMax = std::numeric_limits<int>::max(); + static const int s_intMin = std::numeric_limits<int>::min(); + + if (x >= static_cast<float>(s_intMax)) + return s_intMax; + if (x < static_cast<float>(s_intMin)) + return s_intMin; + return static_cast<int>(x); +} + IntRect enclosingIntRect(const FloatRect& rect) { - int l = static_cast<int>(floorf(rect.x())); - int t = static_cast<int>(floorf(rect.y())); - int r = static_cast<int>(ceilf(rect.right())); - int b = static_cast<int>(ceilf(rect.bottom())); - return IntRect(l, t, r - l, b - t); + float left = floorf(rect.x()); + float top = floorf(rect.y()); + float width = ceilf(rect.right()) - left; + float height = ceilf(rect.bottom()) - top; + return IntRect(safeFloatToInt(left), safeFloatToInt(top), + safeFloatToInt(width), safeFloatToInt(height)); } FloatRect mapRect(const FloatRect& r, const FloatRect& srcRect, const FloatRect& destRect) diff --git a/WebCore/platform/graphics/WOFFFileFormat.cpp b/WebCore/platform/graphics/WOFFFileFormat.cpp new file mode 100644 index 0000000..dc73603 --- /dev/null +++ b/WebCore/platform/graphics/WOFFFileFormat.cpp @@ -0,0 +1,258 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "WOFFFileFormat.h" + +#if !ENABLE(OPENTYPE_SANITIZER) + +#include "SharedBuffer.h" + +#if !PLATFORM(WIN) +#include <zlib.h> +#else +#include "SoftLinking.h" + +typedef unsigned char Bytef; +typedef unsigned long uLong; +typedef unsigned long uLongf; +#define Z_OK 0 + +SOFT_LINK_LIBRARY(zlib1); +SOFT_LINK(zlib1, uncompress, int, __cdecl, (Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen), (dest, destLen, source, sourceLen)); + +#if CPU(BIG_ENDIAN) +#define ntohs(x) ((uint16_t)(x)) +#define htons(x) ((uint16_t)(x)) +#define ntohl(x) ((uint32_t)(x)) +#define htonl(x) ((uint32_t)(x)) +#elif CPU(MIDDLE_ENDIAN) +#define ntohs(x) ((unit16_t)(x)) +#define htons(x) ((uint16_t)(x)) +#define ntohl(x) ((uint32_t)((((uint32_t)(x) & 0xffff0000) >> 16) | (((uint32_t)(x) & 0xffff) << 16)) +#define htonl(x) ntohl(x) +#else +#define ntohs(x) ((uint16_t)((((uint16_t)(x) & 0xff00) >> 8) | (((uint16_t)(x) & 0x00ff) << 8))) +#define htons(x) ntohs(x) +#define ntohl(x) ((uint32_t)((((uint32_t)(x) & 0xff000000) >> 24) | (((uint32_t)(x) & 0x00ff0000) >> 8) | \ + (((uint32_t)(x) & 0x0000ff00) << 8) | (((uint32_t)(x) & 0x000000ff) << 24))) +#define htonl(x) ntohl(x) +#endif + +#endif // PLATFORM(WIN) + +namespace WebCore { + +static bool readUInt32(SharedBuffer* buffer, size_t& offset, uint32_t& value) +{ + ASSERT_ARG(offset, offset <= buffer->size()); + if (buffer->size() - offset < sizeof(value)) + return false; + + value = ntohl(*reinterpret_cast<const uint32_t*>(buffer->data() + offset)); + offset += sizeof(value); + + return true; +} + +static bool readUInt16(SharedBuffer* buffer, size_t& offset, uint16_t& value) +{ + ASSERT_ARG(offset, offset <= buffer->size()); + if (buffer->size() - offset < sizeof(value)) + return false; + + value = ntohs(*reinterpret_cast<const uint16_t*>(buffer->data() + offset)); + offset += sizeof(value); + + return true; +} + +static bool writeUInt32(Vector<char>& vector, uint32_t value) +{ + uint32_t bigEndianValue = htonl(value); + return vector.tryAppend(reinterpret_cast<char*>(&bigEndianValue), sizeof(bigEndianValue)); +} + +static bool writeUInt16(Vector<char>& vector, uint16_t value) +{ + uint16_t bigEndianValue = htons(value); + return vector.tryAppend(reinterpret_cast<char*>(&bigEndianValue), sizeof(bigEndianValue)); +} + +static const uint32_t woffSignature = 0x774f4646; /* 'wOFF' */ + +bool isWOFF(SharedBuffer* buffer) +{ + size_t offset = 0; + uint32_t signature; + + return readUInt32(buffer, offset, signature) && signature == woffSignature; +} + +bool convertWOFFToSfnt(SharedBuffer* woff, Vector<char>& sfnt) +{ +#if PLATFORM(WINDOWS) + if (!zlib1Library()) + return false; +#endif + ASSERT_ARG(sfnt, sfnt.isEmpty()); + + size_t offset = 0; + + // Read the WOFF header. + uint32_t signature; + if (!readUInt32(woff, offset, signature) || signature != woffSignature) { + ASSERT_NOT_REACHED(); + return false; + } + + uint32_t flavor; + if (!readUInt32(woff, offset, flavor)) + return false; + + uint32_t length; + if (!readUInt32(woff, offset, length) || length != woff->size()) + return false; + + uint16_t numTables; + if (!readUInt16(woff, offset, numTables)) + return false; + + if (!numTables || numTables > 0x0fff) + return false; + + uint16_t reserved; + if (!readUInt16(woff, offset, reserved) || reserved) + return false; + + uint32_t totalSfntSize; + if (!readUInt32(woff, offset, totalSfntSize)) + return false; + + if (woff->size() - offset < sizeof(uint16_t) + sizeof(uint16_t) + sizeof(uint32_t) + sizeof(uint32_t) + sizeof(uint32_t) + sizeof(uint32_t) + sizeof(uint32_t)) + return false; + + offset += sizeof(uint16_t); // majorVersion + offset += sizeof(uint16_t); // minorVersion + offset += sizeof(uint32_t); // metaOffset + offset += sizeof(uint32_t); // metaLength + offset += sizeof(uint32_t); // metaOrigLength + offset += sizeof(uint32_t); // privOffset + offset += sizeof(uint32_t); // privLength + + // Check if the WOFF can supply as many tables as it claims it has. + if (woff->size() - offset < numTables * 5 * sizeof(uint32_t)) + return false; + + // Write the sfnt offset subtable. + uint16_t entrySelector = 0; + uint16_t searchRange = 1; + while (searchRange < numTables >> 1) { + entrySelector++; + searchRange <<= 1; + } + searchRange <<= 4; + uint16_t rangeShift = (numTables << 4) - searchRange; + + if (!writeUInt32(sfnt, flavor) + || !writeUInt16(sfnt, numTables) + || !writeUInt16(sfnt, searchRange) + || !writeUInt16(sfnt, entrySelector) + || !writeUInt16(sfnt, rangeShift)) + return false; + + if (sfnt.size() > totalSfntSize) + return false; + + if (totalSfntSize - sfnt.size() < numTables * 4 * sizeof(uint32_t)) + return false; + + size_t sfntTableDirectoryCursor = sfnt.size(); + sfnt.grow(sfnt.size() + numTables * 4 * sizeof(uint32_t)); + + // Process tables. + for (uint16_t i = 0; i < numTables; ++i) { + // Read a WOFF table directory entry. + uint32_t tableTag; + if (!readUInt32(woff, offset, tableTag)) + return false; + + uint32_t tableOffset; + if (!readUInt32(woff, offset, tableOffset)) + return false; + + uint32_t tableCompLength; + if (!readUInt32(woff, offset, tableCompLength)) + return false; + + if (tableOffset > woff->size() || tableCompLength > woff->size() - tableOffset) + return false; + + uint32_t tableOrigLength; + if (!readUInt32(woff, offset, tableOrigLength) || tableCompLength > tableOrigLength) + return false; + + if (tableOrigLength > totalSfntSize || sfnt.size() > totalSfntSize - tableOrigLength) + return false; + + uint32_t tableOrigChecksum; + if (!readUInt32(woff, offset, tableOrigChecksum)) + return false; + + // Write an sfnt table directory entry. + uint32_t* sfntTableDirectoryPtr = reinterpret_cast<uint32_t*>(sfnt.data() + sfntTableDirectoryCursor); + *sfntTableDirectoryPtr++ = htonl(tableTag); + *sfntTableDirectoryPtr++ = htonl(tableOrigChecksum); + *sfntTableDirectoryPtr++ = htonl(sfnt.size()); + *sfntTableDirectoryPtr++ = htonl(tableOrigLength); + sfntTableDirectoryCursor += 4 * sizeof(uint32_t); + + if (tableCompLength == tableOrigLength) { + // The table is not compressed. + if (!sfnt.tryAppend(woff->data() + tableOffset, tableCompLength)) + return false; + } else { + uLongf destLen = tableOrigLength; + if (!sfnt.tryReserveCapacity(sfnt.size() + tableOrigLength)) + return false; + Bytef* dest = reinterpret_cast<Bytef*>(sfnt.end()); + sfnt.grow(sfnt.size() + tableOrigLength); + if (uncompress(dest, &destLen, reinterpret_cast<const Bytef*>(woff->data() + tableOffset), tableCompLength) != Z_OK) + return false; + if (destLen != tableOrigLength) + return false; + } + + // Pad to a multiple of 4 bytes. + while (sfnt.size() % 4) + sfnt.append(0); + } + + return sfnt.size() == totalSfntSize; +} + +#endif // !ENABLE(OPENTYPE_SANITIZER) + +} // namespace WebCore diff --git a/WebCore/platform/graphics/WOFFFileFormat.h b/WebCore/platform/graphics/WOFFFileFormat.h new file mode 100644 index 0000000..9351d0e --- /dev/null +++ b/WebCore/platform/graphics/WOFFFileFormat.h @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WOFFFileFormat_h +#define WOFFFileFormat_h + +#if !ENABLE(OPENTYPE_SANITIZER) + +#include <wtf/Vector.h> + +namespace WebCore { + +class SharedBuffer; + +// Returns whether the buffer is a WOFF file. +bool isWOFF(SharedBuffer* buffer); + +// Returns false if the WOFF file woff is invalid or could not be converted to sfnt (for example, +// if conversion ran out of memory). Otherwise returns true and writes the sfnt payload into sfnt. +bool convertWOFFToSfnt(SharedBuffer* woff, Vector<char>& sfnt); + +} // namespace WebCore + +#endif // !ENABLE(OPENTYPE_SANITIZER) + +#endif // WOFFFileFormat_h diff --git a/WebCore/platform/graphics/cairo/CairoPath.h b/WebCore/platform/graphics/cairo/CairoPath.h index b761ce6..da7affb 100644 --- a/WebCore/platform/graphics/cairo/CairoPath.h +++ b/WebCore/platform/graphics/cairo/CairoPath.h @@ -1,5 +1,6 @@ /* Copyright (C) 2007 Alp Toker <alp.toker@collabora.co.uk> + Copyright (C) 2010 Igalia S.L. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public @@ -24,21 +25,25 @@ namespace WebCore { - // This is necessary since cairo_path_fixed_t isn't exposed in Cairo's public API. - struct CairoPath { - cairo_t* m_cr; - - CairoPath() - { - static cairo_surface_t* pathSurface = cairo_image_surface_create(CAIRO_FORMAT_A8, 1, 1); - m_cr = cairo_create(pathSurface); - } - - ~CairoPath() - { - cairo_destroy(m_cr); - } - }; +// This is necessary since cairo_path_fixed_t isn't exposed in Cairo's public API. +class CairoPath { +public: + CairoPath() + { + static cairo_surface_t* pathSurface = cairo_image_surface_create(CAIRO_FORMAT_A8, 1, 1); + m_cr = cairo_create(pathSurface); + } + + ~CairoPath() + { + cairo_destroy(m_cr); + } + + cairo_t* context() { return m_cr; } + +private: + cairo_t* m_cr; +}; } // namespace WebCore diff --git a/WebCore/platform/graphics/cairo/FontCustomPlatformData.cpp b/WebCore/platform/graphics/cairo/FontCustomPlatformData.cpp index bb2e064..6b76c2a 100644 --- a/WebCore/platform/graphics/cairo/FontCustomPlatformData.cpp +++ b/WebCore/platform/graphics/cairo/FontCustomPlatformData.cpp @@ -21,8 +21,8 @@ #include "config.h" #include "FontCustomPlatformData.h" -#include "SharedBuffer.h" #include "FontPlatformData.h" +#include "SharedBuffer.h" namespace WebCore { @@ -70,4 +70,9 @@ FontCustomPlatformData* createFontCustomPlatformData(SharedBuffer* buffer) return new FontCustomPlatformData(fontFace); } +bool FontCustomPlatformData::supportsFormat(const String& format) +{ + return equalIgnoringCase(format, "truetype") || equalIgnoringCase(format, "opentype"); +} + } diff --git a/WebCore/platform/graphics/cairo/FontCustomPlatformData.h b/WebCore/platform/graphics/cairo/FontCustomPlatformData.h index b36cc79..2816427 100644 --- a/WebCore/platform/graphics/cairo/FontCustomPlatformData.h +++ b/WebCore/platform/graphics/cairo/FontCustomPlatformData.h @@ -30,6 +30,7 @@ namespace WebCore { class FontPlatformData; class SharedBuffer; +class String; struct FontCustomPlatformData : Noncopyable { FontCustomPlatformData(cairo_font_face_t* fontFace) @@ -40,6 +41,8 @@ struct FontCustomPlatformData : Noncopyable { FontPlatformData fontPlatformData(int size, bool bold, bool italic, FontRenderingMode = NormalRenderingMode); + static bool supportsFormat(const String&); + cairo_font_face_t* m_fontFace; }; diff --git a/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp b/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp index 96cd4ee..f3fc943 100644 --- a/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp +++ b/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp @@ -4,6 +4,7 @@ * Copyright (C) 2008, 2009 Dirk Schulze <krit@webkit.org> * Copyright (C) 2008 Nuanti Ltd. * Copyright (C) 2009 Brent Fulgham <bfulgham@webkit.org> + * Copyright (C) 2010 Igalia S.L. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -143,6 +144,35 @@ static inline void copyContextProperties(cairo_t* srcCr, cairo_t* dstCr) cairo_set_fill_rule(dstCr, cairo_get_fill_rule(srcCr)); } +static void appendPathToCairoContext(cairo_t* to, cairo_t* from) +{ + cairo_path_t* cairoPath = cairo_copy_path(from); + cairo_append_path(to, cairoPath); + cairo_path_destroy(cairoPath); +} + +// We apply the pending path built via addPath to the Cairo context +// lazily. This prevents interaction between the path and other routines +// such as fillRect. +static void setPathOnCairoContext(cairo_t* to, cairo_t* from) +{ + cairo_new_path(to); + appendPathToCairoContext(to, from); +} + +static void appendWebCorePathToCairoContext(cairo_t* context, const Path& path) +{ + appendPathToCairoContext(context, path.platformPath()->context()); +} + +static void addConvexPolygonToContext(cairo_t* context, size_t numPoints, const FloatPoint* points) +{ + cairo_move_to(context, points[0].x(), points[0].y()); + for (size_t i = 1; i < numPoints; i++) + cairo_line_to(context, points[i].x(), points[i].y()); + cairo_close_path(context); +} + void GraphicsContext::calculateShadowBufferDimensions(IntSize& shadowBufferSize, FloatRect& shadowRect, float& kernelSize, const FloatRect& sourceRect, const FloatSize& shadowSize, float shadowBlur) { #if ENABLE(FILTERS) @@ -201,6 +231,22 @@ static inline void drawPathShadow(GraphicsContext* context, GraphicsContextPriva #endif } +static void fillCurrentCairoPath(GraphicsContext* context, GraphicsContextPrivate* gcp, cairo_t* cairoContext) +{ + cairo_set_fill_rule(cairoContext, context->fillRule() == RULE_EVENODD ? CAIRO_FILL_RULE_EVEN_ODD : CAIRO_FILL_RULE_WINDING); + drawPathShadow(context, gcp, true, false); + + setPlatformFill(context, cairoContext, gcp); + cairo_new_path(cairoContext); +} + +static void strokeCurrentCairoPath(GraphicsContext* context, GraphicsContextPrivate* gcp, cairo_t* cairoContext) +{ + drawPathShadow(context, gcp, false, true); + setPlatformStroke(context, cairoContext, gcp); + cairo_new_path(cairoContext); +} + GraphicsContext::GraphicsContext(PlatformGraphicsContext* cr) : m_common(createGraphicsContextPrivate()) , m_data(new GraphicsContextPlatformPrivate) @@ -380,9 +426,8 @@ void GraphicsContext::drawEllipse(const IntRect& rect) setColor(cr, strokeColor()); cairo_set_line_width(cr, strokeThickness()); cairo_stroke(cr); - } - - cairo_new_path(cr); + } else + cairo_new_path(cr); } void GraphicsContext::strokeArc(const IntRect& rect, int startAngle, int angleSpan) @@ -483,10 +528,7 @@ void GraphicsContext::drawConvexPolygon(size_t npoints, const FloatPoint* points cairo_save(cr); cairo_set_antialias(cr, shouldAntialias ? CAIRO_ANTIALIAS_DEFAULT : CAIRO_ANTIALIAS_NONE); - cairo_move_to(cr, points[0].x(), points[0].y()); - for (size_t i = 1; i < npoints; i++) - cairo_line_to(cr, points[i].x(), points[i].y()); - cairo_close_path(cr); + addConvexPolygonToContext(cr, npoints, points); if (fillColor().alpha()) { setColor(cr, fillColor()); @@ -498,9 +540,9 @@ void GraphicsContext::drawConvexPolygon(size_t npoints, const FloatPoint* points setColor(cr, strokeColor()); cairo_set_line_width(cr, strokeThickness()); cairo_stroke(cr); - } + } else + cairo_new_path(cr); - cairo_new_path(cr); cairo_restore(cr); } @@ -511,8 +553,20 @@ void GraphicsContext::clipConvexPolygon(size_t numPoints, const FloatPoint* poin if (numPoints <= 1) return; - - // FIXME: IMPLEMENT! + + cairo_t* cr = m_data->cr; + + cairo_new_path(cr); + cairo_fill_rule_t savedFillRule = cairo_get_fill_rule(cr); + cairo_antialias_t savedAntialiasRule = cairo_get_antialias(cr); + + cairo_set_antialias(cr, CAIRO_ANTIALIAS_DEFAULT); + cairo_set_fill_rule(cr, CAIRO_FILL_RULE_WINDING); + addConvexPolygonToContext(cr, numPoints, points); + cairo_clip(cr); + + cairo_set_antialias(cr, savedAntialiasRule); + cairo_set_fill_rule(cr, savedFillRule); } void GraphicsContext::fillPath() @@ -522,11 +576,8 @@ void GraphicsContext::fillPath() cairo_t* cr = m_data->cr; - cairo_set_fill_rule(cr, fillRule() == RULE_EVENODD ? CAIRO_FILL_RULE_EVEN_ODD : CAIRO_FILL_RULE_WINDING); - drawPathShadow(this, m_common, true, false); - - setPlatformFill(this, cr, m_common); - cairo_new_path(cr); + setPathOnCairoContext(cr, m_data->m_pendingPath.context()); + fillCurrentCairoPath(this, m_common, cr); } void GraphicsContext::strokePath() @@ -535,11 +586,8 @@ void GraphicsContext::strokePath() return; cairo_t* cr = m_data->cr; - drawPathShadow(this, m_common, false, true); - - setPlatformStroke(this, cr, m_common); - cairo_new_path(cr); - + setPathOnCairoContext(cr, m_data->m_pendingPath.context()); + strokeCurrentCairoPath(this, m_common, cr); } void GraphicsContext::drawPath() @@ -549,6 +597,8 @@ void GraphicsContext::drawPath() cairo_t* cr = m_data->cr; + setPathOnCairoContext(cr, m_data->m_pendingPath.context()); + cairo_set_fill_rule(cr, fillRule() == RULE_EVENODD ? CAIRO_FILL_RULE_EVEN_ODD : CAIRO_FILL_RULE_WINDING); drawPathShadow(this, m_common, true, true); @@ -565,7 +615,7 @@ void GraphicsContext::fillRect(const FloatRect& rect) cairo_t* cr = m_data->cr; cairo_save(cr); cairo_rectangle(cr, rect.x(), rect.y(), rect.width(), rect.height()); - fillPath(); + fillCurrentCairoPath(this, m_common, cr); cairo_restore(cr); } @@ -673,7 +723,7 @@ void GraphicsContext::drawFocusRing(const Vector<IntRect>& rects, int width, int #else int radius = (width - 1) / 2; for (unsigned i = 0; i < rectCount; i++) - addPath(Path::createRoundedRectangle(rects[i], FloatSize(radius, radius))); + appendWebCorePathToCairoContext(cr, Path::createRoundedRectangle(rects[i], FloatSize(radius, radius))); // Force the alpha to 50%. This matches what the Mac does with outline rings. Color ringColor(color.red(), color.green(), color.blue(), 127); @@ -700,14 +750,8 @@ void GraphicsContext::drawLineForText(const IntPoint& origin, int width, bool pr if (paintingDisabled()) return; - // This is a workaround for http://bugs.webkit.org/show_bug.cgi?id=15659 - StrokeStyle savedStrokeStyle = strokeStyle(); - setStrokeStyle(SolidStroke); - IntPoint endPoint = origin + IntSize(width, 0); drawLine(origin, endPoint); - - setStrokeStyle(savedStrokeStyle); } #if !PLATFORM(GTK) @@ -846,6 +890,7 @@ void GraphicsContext::addInnerRoundedRectClip(const IntRect& rect, int thickness if (paintingDisabled()) return; + cairo_t* cr = m_data->cr; clip(rect); Path p; @@ -855,9 +900,8 @@ void GraphicsContext::addInnerRoundedRectClip(const IntRect& rect, int thickness // Add inner ellipse r.inflate(-thickness); p.addEllipse(r); - addPath(p); + appendWebCorePathToCairoContext(cr, p); - cairo_t* cr = m_data->cr; cairo_fill_rule_t savedFillRule = cairo_get_fill_rule(cr); cairo_set_fill_rule(cr, CAIRO_FILL_RULE_EVEN_ODD); cairo_clip(cr); @@ -968,7 +1012,7 @@ void GraphicsContext::strokeRect(const FloatRect& rect, float width) cairo_save(cr); cairo_rectangle(cr, rect.x(), rect.y(), rect.width(), rect.height()); cairo_set_line_width(cr, width); - strokePath(); + strokeCurrentCairoPath(this, m_common, cr); cairo_restore(cr); } @@ -1085,8 +1129,7 @@ void GraphicsContext::beginPath() if (paintingDisabled()) return; - cairo_t* cr = m_data->cr; - cairo_new_path(cr); + cairo_new_path(m_data->m_pendingPath.context()); } void GraphicsContext::addPath(const Path& path) @@ -1094,10 +1137,10 @@ void GraphicsContext::addPath(const Path& path) if (paintingDisabled()) return; - cairo_t* cr = m_data->cr; - cairo_path_t* p = cairo_copy_path(path.platformPath()->m_cr); - cairo_append_path(cr, p); - cairo_path_destroy(p); + cairo_matrix_t currentMatrix; + cairo_get_matrix(m_data->cr, ¤tMatrix); + cairo_set_matrix(m_data->m_pendingPath.context(), ¤tMatrix); + appendWebCorePathToCairoContext(m_data->m_pendingPath.context(), path); } void GraphicsContext::clip(const Path& path) @@ -1106,7 +1149,7 @@ void GraphicsContext::clip(const Path& path) return; cairo_t* cr = m_data->cr; - cairo_path_t* p = cairo_copy_path(path.platformPath()->m_cr); + cairo_path_t* p = cairo_copy_path(path.platformPath()->context()); cairo_append_path(cr, p); cairo_path_destroy(p); cairo_fill_rule_t savedFillRule = cairo_get_fill_rule(cr); @@ -1130,7 +1173,7 @@ void GraphicsContext::clipOut(const Path& path) double x1, y1, x2, y2; cairo_clip_extents(cr, &x1, &y1, &x2, &y2); cairo_rectangle(cr, x1, y1, x2 - x1, y2 - y1); - addPath(path); + appendWebCorePathToCairoContext(cr, path); cairo_fill_rule_t savedFillRule = cairo_get_fill_rule(cr); cairo_set_fill_rule(cr, CAIRO_FILL_RULE_EVEN_ODD); @@ -1189,8 +1232,7 @@ void GraphicsContext::fillRoundedRect(const IntRect& r, const IntSize& topLeft, cairo_t* cr = m_data->cr; cairo_save(cr); - beginPath(); - addPath(Path::createRoundedRectangle(r, topLeft, topRight, bottomLeft, bottomRight)); + appendWebCorePathToCairoContext(cr, Path::createRoundedRectangle(r, topLeft, topRight, bottomLeft, bottomRight)); setColor(cr, color); drawPathShadow(this, m_common, true, false); cairo_fill(cr); diff --git a/WebCore/platform/graphics/cairo/GraphicsContextPlatformPrivateCairo.h b/WebCore/platform/graphics/cairo/GraphicsContextPlatformPrivateCairo.h index 5e38832..97e7e07 100644 --- a/WebCore/platform/graphics/cairo/GraphicsContextPlatformPrivateCairo.h +++ b/WebCore/platform/graphics/cairo/GraphicsContextPlatformPrivateCairo.h @@ -95,6 +95,7 @@ public: cairo_t* cr; Vector<float> layers; + CairoPath m_pendingPath; #if PLATFORM(GTK) GdkEventExpose* expose; diff --git a/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp b/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp index c298e18..1a43e54 100644 --- a/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp +++ b/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp @@ -277,6 +277,7 @@ void ImageBuffer::putPremultipliedImageData(ImageData* source, const IntRect& so putImageData<Premultiplied>(source, sourceRect, destPoint, m_data, m_size); } +#if !PLATFORM(GTK) static cairo_status_t writeFunction(void* closure, const unsigned char* data, unsigned int length) { Vector<char>* in = reinterpret_cast<Vector<char>*>(closure); @@ -303,5 +304,6 @@ String ImageBuffer::toDataURL(const String& mimeType, const double*) const return "data:" + actualMimeType + ";base64," + String(out.data(), out.size()); } +#endif } // namespace WebCore diff --git a/WebCore/platform/graphics/cairo/PathCairo.cpp b/WebCore/platform/graphics/cairo/PathCairo.cpp index d880626..05c6952 100644 --- a/WebCore/platform/graphics/cairo/PathCairo.cpp +++ b/WebCore/platform/graphics/cairo/PathCairo.cpp @@ -51,8 +51,8 @@ Path::~Path() Path::Path(const Path& other) : m_path(new CairoPath()) { - cairo_t* cr = platformPath()->m_cr; - cairo_path_t* p = cairo_copy_path(other.platformPath()->m_cr); + cairo_t* cr = platformPath()->context(); + cairo_path_t* p = cairo_copy_path(other.platformPath()->context()); cairo_append_path(cr, p); cairo_path_destroy(p); } @@ -63,8 +63,8 @@ Path& Path::operator=(const Path& other) return *this; clear(); - cairo_t* cr = platformPath()->m_cr; - cairo_path_t* p = cairo_copy_path(other.platformPath()->m_cr); + cairo_t* cr = platformPath()->context(); + cairo_path_t* p = cairo_copy_path(other.platformPath()->context()); cairo_append_path(cr, p); cairo_path_destroy(p); return *this; @@ -72,13 +72,13 @@ Path& Path::operator=(const Path& other) void Path::clear() { - cairo_t* cr = platformPath()->m_cr; + cairo_t* cr = platformPath()->context(); cairo_new_path(cr); } bool Path::isEmpty() const { - return !cairo_has_current_point(platformPath()->m_cr); + return !cairo_has_current_point(platformPath()->context()); } bool Path::hasCurrentPoint() const @@ -91,31 +91,31 @@ FloatPoint Path::currentPoint() const // FIXME: Is this the correct way? double x; double y; - cairo_get_current_point(platformPath()->m_cr, &x, &y); + cairo_get_current_point(platformPath()->context(), &x, &y); return FloatPoint(x, y); } void Path::translate(const FloatSize& p) { - cairo_t* cr = platformPath()->m_cr; + cairo_t* cr = platformPath()->context(); cairo_translate(cr, -p.width(), -p.height()); } void Path::moveTo(const FloatPoint& p) { - cairo_t* cr = platformPath()->m_cr; + cairo_t* cr = platformPath()->context(); cairo_move_to(cr, p.x(), p.y()); } void Path::addLineTo(const FloatPoint& p) { - cairo_t* cr = platformPath()->m_cr; + cairo_t* cr = platformPath()->context(); cairo_line_to(cr, p.x(), p.y()); } void Path::addRect(const FloatRect& rect) { - cairo_t* cr = platformPath()->m_cr; + cairo_t* cr = platformPath()->context(); cairo_rectangle(cr, rect.x(), rect.y(), rect.width(), rect.height()); } @@ -124,7 +124,7 @@ void Path::addRect(const FloatRect& rect) */ void Path::addQuadCurveTo(const FloatPoint& controlPoint, const FloatPoint& point) { - cairo_t* cr = platformPath()->m_cr; + cairo_t* cr = platformPath()->context(); double x, y; double x1 = controlPoint.x(); double y1 = controlPoint.y(); @@ -139,7 +139,7 @@ void Path::addQuadCurveTo(const FloatPoint& controlPoint, const FloatPoint& poin void Path::addBezierCurveTo(const FloatPoint& controlPoint1, const FloatPoint& controlPoint2, const FloatPoint& controlPoint3) { - cairo_t* cr = platformPath()->m_cr; + cairo_t* cr = platformPath()->context(); cairo_curve_to(cr, controlPoint1.x(), controlPoint1.y(), controlPoint2.x(), controlPoint2.y(), controlPoint3.x(), controlPoint3.y()); @@ -152,7 +152,7 @@ void Path::addArc(const FloatPoint& p, float r, float sa, float ea, bool anticlo if (!isfinite(r) || !isfinite(sa) || !isfinite(ea)) return; - cairo_t* cr = platformPath()->m_cr; + cairo_t* cr = platformPath()->context(); if (anticlockwise) cairo_arc_negative(cr, p.x(), p.y(), r, sa, ea); else @@ -164,7 +164,7 @@ void Path::addArcTo(const FloatPoint& p1, const FloatPoint& p2, float radius) if (isEmpty()) return; - cairo_t* cr = platformPath()->m_cr; + cairo_t* cr = platformPath()->context(); double x0, y0; cairo_get_current_point(cr, &x0, &y0); @@ -237,7 +237,7 @@ void Path::addArcTo(const FloatPoint& p1, const FloatPoint& p2, float radius) void Path::addEllipse(const FloatRect& rect) { - cairo_t* cr = platformPath()->m_cr; + cairo_t* cr = platformPath()->context(); cairo_save(cr); float yRadius = .5 * rect.height(); float xRadius = .5 * rect.width(); @@ -249,13 +249,13 @@ void Path::addEllipse(const FloatRect& rect) void Path::closeSubpath() { - cairo_t* cr = platformPath()->m_cr; + cairo_t* cr = platformPath()->context(); cairo_close_path(cr); } FloatRect Path::boundingRect() const { - cairo_t* cr = platformPath()->m_cr; + cairo_t* cr = platformPath()->context(); double x0, x1, y0, y1; cairo_path_extents(cr, &x0, &y0, &x1, &y1); return FloatRect(x0, y0, x1 - x0, y1 - y0); @@ -263,7 +263,7 @@ FloatRect Path::boundingRect() const FloatRect Path::strokeBoundingRect(StrokeStyleApplier* applier) { - cairo_t* cr = platformPath()->m_cr; + cairo_t* cr = platformPath()->context(); if (applier) { GraphicsContext gc(cr); applier->strokeStyle(&gc); @@ -276,7 +276,7 @@ FloatRect Path::strokeBoundingRect(StrokeStyleApplier* applier) bool Path::contains(const FloatPoint& point, WindRule rule) const { - cairo_t* cr = platformPath()->m_cr; + cairo_t* cr = platformPath()->context(); cairo_fill_rule_t cur = cairo_get_fill_rule(cr); cairo_set_fill_rule(cr, rule == RULE_EVENODD ? CAIRO_FILL_RULE_EVEN_ODD : CAIRO_FILL_RULE_WINDING); bool contains = cairo_in_fill(cr, point.x(), point.y()); @@ -287,7 +287,7 @@ bool Path::contains(const FloatPoint& point, WindRule rule) const bool Path::strokeContains(StrokeStyleApplier* applier, const FloatPoint& point) const { ASSERT(applier); - cairo_t* cr = platformPath()->m_cr; + cairo_t* cr = platformPath()->context(); GraphicsContext gc(cr); applier->strokeStyle(&gc); @@ -296,7 +296,7 @@ bool Path::strokeContains(StrokeStyleApplier* applier, const FloatPoint& point) void Path::apply(void* info, PathApplierFunction function) const { - cairo_t* cr = platformPath()->m_cr; + cairo_t* cr = platformPath()->context(); cairo_path_t* path = cairo_copy_path(cr); cairo_path_data_t* data; PathElement pelement; @@ -334,10 +334,10 @@ void Path::apply(void* info, PathApplierFunction function) const void Path::transform(const AffineTransform& trans) { - cairo_t* m_cr = platformPath()->m_cr; + cairo_t* cr = platformPath()->context(); cairo_matrix_t c_matrix = cairo_matrix_t(trans); cairo_matrix_invert(&c_matrix); - cairo_transform(m_cr, &c_matrix); + cairo_transform(cr, &c_matrix); } String Path::debugString() const @@ -346,7 +346,7 @@ String Path::debugString() const return String(); String pathString; - cairo_path_t* path = cairo_copy_path(platformPath()->m_cr); + cairo_path_t* path = cairo_copy_path(platformPath()->context()); cairo_path_data_t* data; for (int i = 0; i < path->num_data; i += path->data[i].header.length) { diff --git a/WebCore/platform/graphics/chromium/FontCustomPlatformData.cpp b/WebCore/platform/graphics/chromium/FontCustomPlatformData.cpp index 74f1e26..b6d6e65 100644 --- a/WebCore/platform/graphics/chromium/FontCustomPlatformData.cpp +++ b/WebCore/platform/graphics/chromium/FontCustomPlatformData.cpp @@ -201,4 +201,13 @@ FontCustomPlatformData* createFontCustomPlatformData(SharedBuffer* buffer) #endif } +bool FontCustomPlatformData::supportsFormat(const String& format) +{ + return equalIgnoringCase(format, "truetype") || equalIgnoringCase(format, "opentype") +#if ENABLE(OPENTYPE_SANITIZER) + || equalIgnoringCase(format, "woff") +#endif + ; +} + } diff --git a/WebCore/platform/graphics/chromium/FontCustomPlatformData.h b/WebCore/platform/graphics/chromium/FontCustomPlatformData.h index e1fbd48..03e1b8c 100644 --- a/WebCore/platform/graphics/chromium/FontCustomPlatformData.h +++ b/WebCore/platform/graphics/chromium/FontCustomPlatformData.h @@ -46,6 +46,7 @@ namespace WebCore { class FontPlatformData; class SharedBuffer; +class String; struct FontCustomPlatformData : Noncopyable { #if OS(WINDOWS) @@ -64,6 +65,8 @@ struct FontCustomPlatformData : Noncopyable { FontPlatformData fontPlatformData(int size, bool bold, bool italic, FontRenderingMode = NormalRenderingMode); + static bool supportsFormat(const String&); + #if OS(WINDOWS) HANDLE m_fontReference; String m_name; diff --git a/WebCore/platform/graphics/chromium/GLES2Canvas.cpp b/WebCore/platform/graphics/chromium/GLES2Canvas.cpp index ec188c8..9fc8917 100644 --- a/WebCore/platform/graphics/chromium/GLES2Canvas.cpp +++ b/WebCore/platform/graphics/chromium/GLES2Canvas.cpp @@ -99,6 +99,10 @@ GLES2Canvas::GLES2Canvas(GLES2Context* context, const IntSize& size) m_stateStack.append(State()); m_state = &m_stateStack.last(); + + // Force the source over composite mode to be applied. + m_lastCompositeOp = CompositeClear; + applyCompositeOperator(CompositeSourceOver); } GLES2Canvas::~GLES2Canvas() diff --git a/WebCore/platform/graphics/chromium/GLES2Canvas.h b/WebCore/platform/graphics/chromium/GLES2Canvas.h index e3a7a3b..4e500be 100644 --- a/WebCore/platform/graphics/chromium/GLES2Canvas.h +++ b/WebCore/platform/graphics/chromium/GLES2Canvas.h @@ -42,6 +42,7 @@ #include <wtf/HashMap.h> #include <wtf/Noncopyable.h> +#include <wtf/Vector.h> namespace WebCore { diff --git a/WebCore/platform/graphics/gtk/CairoUtilities.cpp b/WebCore/platform/graphics/gtk/CairoUtilities.cpp new file mode 100644 index 0000000..81e00f0 --- /dev/null +++ b/WebCore/platform/graphics/gtk/CairoUtilities.cpp @@ -0,0 +1,94 @@ +/* + * Copyright (C) 2010 Igalia S.L. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "CairoUtilities.h" + +#include <cairo.h> +#include <gtk/gtk.h> + +static inline unsigned char* getCairoSurfacePixel(unsigned char* data, unsigned x, unsigned y, unsigned rowStride) +{ + return data + (y * rowStride) + x * 4; +} + +static inline guchar* getGdkPixbufPixel(guchar* data, unsigned x, unsigned y, unsigned rowStride) +{ + return data + (y * rowStride) + x * 4; +} + +GdkPixbuf* cairoImageSurfaceToGdkPixbuf(cairo_surface_t* surface) +{ + int width = cairo_image_surface_get_width(surface); + int height = cairo_image_surface_get_height(surface); + unsigned char* surfaceData = cairo_image_surface_get_data(surface); + int surfaceRowStride = cairo_image_surface_get_stride(surface); + + GdkPixbuf* dest = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, width, height); + if (!dest) + return 0; + + guchar* pixbufData = gdk_pixbuf_get_pixels(dest); + int pixbufRowStride = gdk_pixbuf_get_rowstride(dest); + + /* From: http://cairographics.org/manual/cairo-image-surface.html#cairo-format-t + * "CAIRO_FORMAT_ARGB32: each pixel is a 32-bit quantity, with alpha in + * the upper 8 bits, then red, then green, then blue. The 32-bit + * quantities are stored native-endian. Pre-multiplied alpha is used. + * (That is, 50% transparent red is 0x80800000, not 0x80ff0000.)" + * + * See http://developer.gimp.org/api/2.0/gdk-pixbuf/gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf + * for information on the structure of GdkPixbufs stored with GDK_COLORSPACE_RGB. + * + * RGB color channels in CAIRO_FORMAT_ARGB32 are stored based on the + * endianness of the machine and are also multiplied by the alpha channel. + * To properly transfer the data from the Cairo surface we must divide each + * of the RGB channels by the alpha channel and then reorder all channels + * if this machine is little-endian. + */ + for (int y = 0; y < height; y++) { + for (int x = 0; x < width; x++) { + unsigned char* source = getCairoSurfacePixel(surfaceData, x, y, surfaceRowStride); + guchar* dest = getGdkPixbufPixel(pixbufData, x, y, pixbufRowStride); + +#if G_BYTE_ORDER == G_LITTLE_ENDIAN + guchar alpha = source[3]; + dest[0] = alpha ? ((source[2] * 255) / alpha) : 0; + dest[1] = alpha ? ((source[1] * 255) / alpha) : 0; + dest[2] = alpha ? ((source[0] * 255) / alpha) : 0; + dest[3] = alpha; +#else + guchar alpha = source[0]; + dest[0] = alpha ? ((source[1] * 255) / alpha) : 0; + dest[1] = alpha ? ((source[2] * 255) / alpha) : 0; + dest[2] = alpha ? ((source[3] * 255) / alpha) : 0; + dest[3] = alpha; +#endif + } + } + + return dest; +} + diff --git a/WebCore/platform/graphics/gtk/CairoUtilities.h b/WebCore/platform/graphics/gtk/CairoUtilities.h new file mode 100644 index 0000000..89eb458 --- /dev/null +++ b/WebCore/platform/graphics/gtk/CairoUtilities.h @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2010 Igalia S.L. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef CairoUtilities_h +#define CairoUtilities_h + +typedef struct _cairo_surface cairo_surface_t; +typedef struct _GdkPixbuf GdkPixbuf; +GdkPixbuf* cairoImageSurfaceToGdkPixbuf(cairo_surface_t* surface); + +#endif // CairoUtilities_h diff --git a/WebCore/platform/graphics/gtk/FontCustomPlatformDataPango.cpp b/WebCore/platform/graphics/gtk/FontCustomPlatformDataPango.cpp index 4f2f2bb..d5f3173 100644 --- a/WebCore/platform/graphics/gtk/FontCustomPlatformDataPango.cpp +++ b/WebCore/platform/graphics/gtk/FontCustomPlatformDataPango.cpp @@ -46,4 +46,9 @@ FontCustomPlatformData* createFontCustomPlatformData(SharedBuffer* buffer) return 0; } +bool FontCustomPlatformData::supportsFormat(const String& /* format */) +{ + return false; +} + } diff --git a/WebCore/platform/graphics/gtk/ImageBufferGtk.cpp b/WebCore/platform/graphics/gtk/ImageBufferGtk.cpp new file mode 100644 index 0000000..d0b0274 --- /dev/null +++ b/WebCore/platform/graphics/gtk/ImageBufferGtk.cpp @@ -0,0 +1,73 @@ +/* + * Copyright (C) 2010 Igalia S.L. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +#include "config.h" +#include "ImageBuffer.h" + +#include "Base64.h" +#include "CairoUtilities.h" +#include "GOwnPtr.h" +#include "GRefPtrGtk.h" +#include "MIMETypeRegistry.h" +#include <cairo.h> +#include <gtk/gtk.h> +#include <wtf/text/CString.h> + +namespace WebCore { + +String ImageBuffer::toDataURL(const String& mimeType, const double* quality) const +{ + ASSERT(MIMETypeRegistry::isSupportedImageMIMETypeForEncoding(mimeType)); + + if (!mimeType.startsWith("image/")) + return "data:,"; + + // List of supported image types comes from the GdkPixbuf documentation. + // http://library.gnome.org/devel/gdk-pixbuf/stable/gdk-pixbuf-file-saving.html#gdk-pixbuf-save-to-bufferv + String type = mimeType.substring(sizeof "image"); + if (type != "jpeg" && type != "png" && type != "tiff" && type != "ico" && type != "bmp") + return "data:,"; + + GRefPtr<GdkPixbuf> pixbuf = cairoImageSurfaceToGdkPixbuf(m_data.m_surface); + if (!pixbuf) + return "data:,"; + + GOwnPtr<gchar> buffer(0); + gsize bufferSize; + GError* error = 0; + gboolean success = FALSE; + if (type == "jpeg" && quality && *quality >= 0.0 && *quality <= 1.0) { + String qualityString = String::format("%f", *quality); + success = gdk_pixbuf_save_to_buffer(pixbuf.get(), &buffer.outPtr(), &bufferSize, + type.utf8().data(), &error, "quality", qualityString.utf8().data(), NULL); + } else { + success = gdk_pixbuf_save_to_buffer(pixbuf.get(), &buffer.outPtr(), &bufferSize, type.utf8().data(), &error, NULL); + } + + if (!success) + return "data:,"; + + Vector<char> out; + base64Encode(reinterpret_cast<const char*>(buffer.get()), bufferSize, out); + out.append('\0'); + + return String::format("data:%s;base64,%s", mimeType.utf8().data(), out.data()); +} + +} diff --git a/WebCore/platform/graphics/gtk/ImageGtk.cpp b/WebCore/platform/graphics/gtk/ImageGtk.cpp index 3de8495..30db6d7 100644 --- a/WebCore/platform/graphics/gtk/ImageGtk.cpp +++ b/WebCore/platform/graphics/gtk/ImageGtk.cpp @@ -26,6 +26,7 @@ #include "config.h" #include "BitmapImage.h" +#include "CairoUtilities.h" #include "GOwnPtr.h" #include "SharedBuffer.h" #include <wtf/text/CString.h> @@ -172,67 +173,9 @@ PassRefPtr<Image> Image::loadPlatformThemeIcon(const char* name, int size) return loadImageFromFile(getThemeIconFileName(name, size)); } -static inline unsigned char* getCairoSurfacePixel(unsigned char* data, unsigned x, unsigned y, unsigned rowStride) -{ - return data + (y * rowStride) + x * 4; -} - -static inline guchar* getGdkPixbufPixel(guchar* data, unsigned x, unsigned y, unsigned rowStride) -{ - return data + (y * rowStride) + x * 4; -} - GdkPixbuf* BitmapImage::getGdkPixbuf() { - int width = cairo_image_surface_get_width(frameAtIndex(currentFrame())); - int height = cairo_image_surface_get_height(frameAtIndex(currentFrame())); - unsigned char* surfaceData = cairo_image_surface_get_data(frameAtIndex(currentFrame())); - int surfaceRowStride = cairo_image_surface_get_stride(frameAtIndex(currentFrame())); - - GdkPixbuf* dest = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, width, height); - if (!dest) - return 0; - - guchar* pixbufData = gdk_pixbuf_get_pixels(dest); - int pixbufRowStride = gdk_pixbuf_get_rowstride(dest); - - /* From: http://cairographics.org/manual/cairo-image-surface.html#cairo-format-t - * "CAIRO_FORMAT_ARGB32: each pixel is a 32-bit quantity, with alpha in - * the upper 8 bits, then red, then green, then blue. The 32-bit - * quantities are stored native-endian. Pre-multiplied alpha is used. - * (That is, 50% transparent red is 0x80800000, not 0x80ff0000.)" - * - * See http://developer.gimp.org/api/2.0/gdk-pixbuf/gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf - * for information on the structure of GdkPixbufs stored with GDK_COLORSPACE_RGB. - * - * RGB color channels in CAIRO_FORMAT_ARGB32 are stored based on the - * endianness of the machine and are also multiplied by the alpha channel. - * To properly transfer the data from the Cairo surface we must divide each - * of the RGB channels by the alpha channel and then reorder all channels - * if this machine is little-endian. - */ - for (int y = 0; y < height; y++) { - for (int x = 0; x < width; x++) { - unsigned char* source = getCairoSurfacePixel(surfaceData, x, y, surfaceRowStride); - guchar* dest = getGdkPixbufPixel(pixbufData, x, y, pixbufRowStride); - -#if G_BYTE_ORDER == G_LITTLE_ENDIAN - guchar alpha = source[3]; - dest[0] = alpha ? ((source[2] * 255) / alpha) : 0; - dest[1] = alpha ? ((source[1] * 255) / alpha) : 0; - dest[2] = alpha ? ((source[0] * 255) / alpha) : 0; - dest[3] = alpha; -#else - guchar alpha = source[0]; - dest[0] = alpha ? ((source[1] * 255) / alpha) : 0; - dest[1] = alpha ? ((source[2] * 255) / alpha) : 0; - dest[2] = alpha ? ((source[3] * 255) / alpha) : 0; - dest[3] = alpha; -#endif - } - } - - return dest; + return cairoImageSurfaceToGdkPixbuf(frameAtIndex(currentFrame())); } } diff --git a/WebCore/platform/graphics/haiku/FontCustomPlatformData.cpp b/WebCore/platform/graphics/haiku/FontCustomPlatformData.cpp index 6008bb1..4b39fdd 100644 --- a/WebCore/platform/graphics/haiku/FontCustomPlatformData.cpp +++ b/WebCore/platform/graphics/haiku/FontCustomPlatformData.cpp @@ -42,4 +42,9 @@ FontCustomPlatformData* createFontCustomPlatformData(SharedBuffer* buffer) return 0; } +bool FontCustomPlatformData::supportsFormat(const String& /* format */) +{ + return false; +} + } diff --git a/WebCore/platform/graphics/haiku/FontCustomPlatformData.h b/WebCore/platform/graphics/haiku/FontCustomPlatformData.h index c5a814e..9db6cc6 100644 --- a/WebCore/platform/graphics/haiku/FontCustomPlatformData.h +++ b/WebCore/platform/graphics/haiku/FontCustomPlatformData.h @@ -28,12 +28,15 @@ namespace WebCore { class FontPlatformData; class SharedBuffer; + class String; struct FontCustomPlatformData : Noncopyable { public: FontCustomPlatformData() { } ~FontCustomPlatformData(); + static bool supportsFormat(const String&); + FontPlatformData fontPlatformData(int size, bool bold, bool italic, FontRenderingMode = NormalRenderingMode); }; diff --git a/WebCore/platform/graphics/mac/FontCustomPlatformData.cpp b/WebCore/platform/graphics/mac/FontCustomPlatformData.cpp index 256b5a4..c591ddc 100644 --- a/WebCore/platform/graphics/mac/FontCustomPlatformData.cpp +++ b/WebCore/platform/graphics/mac/FontCustomPlatformData.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007 Apple Computer, Inc. + * Copyright (C) 2007, 2008, 2010 Apple Inc. All rights reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -21,10 +21,11 @@ #include "config.h" #include "FontCustomPlatformData.h" -#include <ApplicationServices/ApplicationServices.h> -#include "SharedBuffer.h" #include "FontPlatformData.h" #include "OpenTypeSanitizer.h" +#include "SharedBuffer.h" +#include "WOFFFileFormat.h" +#include <ApplicationServices/ApplicationServices.h> namespace WebCore { @@ -50,6 +51,16 @@ FontCustomPlatformData* createFontCustomPlatformData(SharedBuffer* buffer) if (!transcodeBuffer) return 0; // validation failed. buffer = transcodeBuffer.get(); +#else + RefPtr<SharedBuffer> sfntBuffer; + if (isWOFF(buffer)) { + Vector<char> sfnt; + if (!convertWOFFToSfnt(buffer, sfnt)) + return 0; + + sfntBuffer = SharedBuffer::adoptVector(sfnt); + buffer = sfntBuffer.get(); + } #endif ATSFontContainerRef containerRef = 0; @@ -60,7 +71,7 @@ FontCustomPlatformData* createFontCustomPlatformData(SharedBuffer* buffer) #if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) RetainPtr<CFDataRef> bufferData(AdoptCF, buffer->createCFData()); RetainPtr<CGDataProviderRef> dataProvider(AdoptCF, CGDataProviderCreateWithCFData(bufferData.get())); - + cgFontRef.adoptCF(CGFontCreateWithDataProvider(dataProvider.get())); if (!cgFontRef) return 0; @@ -101,4 +112,9 @@ FontCustomPlatformData* createFontCustomPlatformData(SharedBuffer* buffer) return new FontCustomPlatformData(containerRef, fontRef, cgFontRef.releaseRef()); } +bool FontCustomPlatformData::supportsFormat(const String& format) +{ + return equalIgnoringCase(format, "truetype") || equalIgnoringCase(format, "opentype") || equalIgnoringCase(format, "woff"); +} + } diff --git a/WebCore/platform/graphics/mac/FontCustomPlatformData.h b/WebCore/platform/graphics/mac/FontCustomPlatformData.h index 2c1222f..f2cd2cc 100644 --- a/WebCore/platform/graphics/mac/FontCustomPlatformData.h +++ b/WebCore/platform/graphics/mac/FontCustomPlatformData.h @@ -33,6 +33,7 @@ namespace WebCore { class FontPlatformData; class SharedBuffer; +class String; struct FontCustomPlatformData : Noncopyable { FontCustomPlatformData(ATSFontContainerRef container, ATSFontRef atsFont, CGFontRef cgFont) @@ -42,6 +43,8 @@ struct FontCustomPlatformData : Noncopyable { FontPlatformData fontPlatformData(int size, bool bold, bool italic, FontRenderingMode = NormalRenderingMode); + static bool supportsFormat(const String&); + ATSFontContainerRef m_atsContainer; ATSFontRef m_atsFont; CGFontRef m_cgFont; diff --git a/WebCore/platform/graphics/qt/FontCustomPlatformData.h b/WebCore/platform/graphics/qt/FontCustomPlatformData.h index 0f2a6ce..6837059 100644 --- a/WebCore/platform/graphics/qt/FontCustomPlatformData.h +++ b/WebCore/platform/graphics/qt/FontCustomPlatformData.h @@ -27,8 +27,9 @@ namespace WebCore { -class SharedBuffer; class FontPlatformData; +class SharedBuffer; +class String; struct FontCustomPlatformData : Noncopyable { ~FontCustomPlatformData(); @@ -37,6 +38,8 @@ struct FontCustomPlatformData : Noncopyable { int m_handle; FontPlatformData fontPlatformData(int size, bool bold, bool italic, FontRenderingMode = NormalRenderingMode); + + static bool supportsFormat(const String&); }; FontCustomPlatformData* createFontCustomPlatformData(SharedBuffer* buffer); diff --git a/WebCore/platform/graphics/qt/FontCustomPlatformDataQt.cpp b/WebCore/platform/graphics/qt/FontCustomPlatformDataQt.cpp index 6e9d053..dbf0b16 100644 --- a/WebCore/platform/graphics/qt/FontCustomPlatformDataQt.cpp +++ b/WebCore/platform/graphics/qt/FontCustomPlatformDataQt.cpp @@ -61,5 +61,9 @@ FontCustomPlatformData* createFontCustomPlatformData(SharedBuffer* buffer) return data; } +bool FontCustomPlatformData::supportsFormat(const String& format) +{ + return equalIgnoringCase(format, "truetype") || equalIgnoringCase(format, "opentype"); } +} diff --git a/WebCore/platform/graphics/skia/ImageBufferSkia.cpp b/WebCore/platform/graphics/skia/ImageBufferSkia.cpp index 26c44f2..3eb033d 100644 --- a/WebCore/platform/graphics/skia/ImageBufferSkia.cpp +++ b/WebCore/platform/graphics/skia/ImageBufferSkia.cpp @@ -198,11 +198,13 @@ PassRefPtr<ImageData> getImageData(const IntRect& rect, const SkBitmap& bitmap, PassRefPtr<ImageData> ImageBuffer::getUnmultipliedImageData(const IntRect& rect) const { + context()->platformContext()->syncSoftwareCanvas(); return getImageData<Unmultiplied>(rect, *context()->platformContext()->bitmap(), m_size); } PassRefPtr<ImageData> ImageBuffer::getPremultipliedImageData(const IntRect& rect) const { + context()->platformContext()->syncSoftwareCanvas(); return getImageData<Premultiplied>(rect, *context()->platformContext()->bitmap(), m_size); } diff --git a/WebCore/platform/graphics/skia/ImageSkia.cpp b/WebCore/platform/graphics/skia/ImageSkia.cpp index d1d1692..a2485e6 100644 --- a/WebCore/platform/graphics/skia/ImageSkia.cpp +++ b/WebCore/platform/graphics/skia/ImageSkia.cpp @@ -47,6 +47,11 @@ #include "skia/ext/image_operations.h" #include "skia/ext/platform_canvas.h" +#if USE(GLES2_RENDERING) +#include "GLES2Canvas.h" +#include "GLES2Context.h" +#include "SkPixelRef.h" +#endif namespace WebCore { @@ -404,6 +409,24 @@ void Image::drawPattern(GraphicsContext* context, context->platformContext()->paintSkPaint(destRect, paint); } +#if USE(GLES2_RENDERING) +static void drawBitmapGLES2(GraphicsContext* ctxt, NativeImageSkia* bitmap, const FloatRect& srcRect, const FloatRect& dstRect, ColorSpace styleColorSpace, CompositeOperator compositeOp) +{ + ctxt->platformContext()->prepareForHardwareDraw(); + GLES2Canvas* gpuCanvas = ctxt->platformContext()->gpuCanvas(); + gpuCanvas->gles2Context()->makeCurrent(); + GLES2Texture* texture = gpuCanvas->getTexture(bitmap); + if (!texture) { + ASSERT(bitmap->config() == SkBitmap::kARGB_8888_Config); + ASSERT(bitmap->rowBytes() == bitmap->width() * 4); + texture = gpuCanvas->createTexture(bitmap, GLES2Texture::BGRA8, bitmap->width(), bitmap->height()); + ASSERT(bitmap->pixelRef()); + texture->load(bitmap->pixelRef()->pixels()); + } + gpuCanvas->drawTexturedRect(texture, srcRect, dstRect, styleColorSpace, compositeOp); +} +#endif + // ================================================ // BitmapImage Class // ================================================ @@ -429,7 +452,7 @@ void BitmapImage::checkForSolidColor() } void BitmapImage::draw(GraphicsContext* ctxt, const FloatRect& dstRect, - const FloatRect& srcRect, ColorSpace, CompositeOperator compositeOp) + const FloatRect& srcRect, ColorSpace colorSpace, CompositeOperator compositeOp) { if (!m_source.initialized()) return; @@ -439,16 +462,24 @@ void BitmapImage::draw(GraphicsContext* ctxt, const FloatRect& dstRect, // causing flicker and wasting CPU. startAnimation(); - const NativeImageSkia* bm = nativeImageForCurrentFrame(); + NativeImageSkia* bm = nativeImageForCurrentFrame(); if (!bm) return; // It's too early and we don't have an image yet. +#if USE(GLES2_RENDERING) + if (ctxt->platformContext()->useGPU()) { + drawBitmapGLES2(ctxt, bm, srcRect, dstRect, colorSpace, compositeOp); + return; + } +#endif FloatRect normDstRect = normalizeRect(dstRect); FloatRect normSrcRect = normalizeRect(srcRect); if (normSrcRect.isEmpty() || normDstRect.isEmpty()) return; // Nothing to draw. + ctxt->platformContext()->prepareForSoftwareDraw(); + paintSkBitmap(ctxt->platformContext(), *bm, enclosingIntRect(normSrcRect), @@ -470,6 +501,15 @@ void BitmapImageSingleFrameSkia::draw(GraphicsContext* ctxt, if (normSrcRect.isEmpty() || normDstRect.isEmpty()) return; // Nothing to draw. +#if USE(GLES2_RENDERING) + if (ctxt->platformContext()->useGPU()) { + drawBitmapGLES2(ctxt, &m_nativeImage, srcRect, dstRect, styleColorSpace, compositeOp); + return; + } +#endif + + ctxt->platformContext()->prepareForSoftwareDraw(); + paintSkBitmap(ctxt->platformContext(), m_nativeImage, enclosingIntRect(normSrcRect), diff --git a/WebCore/platform/graphics/win/FontCustomPlatformData.cpp b/WebCore/platform/graphics/win/FontCustomPlatformData.cpp index e9f83ab..6e59ad7 100644 --- a/WebCore/platform/graphics/win/FontCustomPlatformData.cpp +++ b/WebCore/platform/graphics/win/FontCustomPlatformData.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007, 2008, 2009 Apple Inc. All rights reserved. + * Copyright (C) 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -26,6 +26,7 @@ #include "OpenTypeUtilities.h" #include "SharedBuffer.h" #include "SoftLinking.h" +#include "WOFFFileFormat.h" #include <ApplicationServices/ApplicationServices.h> #include <WebKitSystemInterface/WebKitSystemInterface.h> #include <wtf/RetainPtr.h> @@ -167,6 +168,16 @@ FontCustomPlatformData* createFontCustomPlatformData(SharedBuffer* buffer) ASSERT_ARG(buffer, buffer); ASSERT(T2embedLibrary()); + RefPtr<SharedBuffer> sfntBuffer; + if (isWOFF(buffer)) { + Vector<char> sfnt; + if (!convertWOFFToSfnt(buffer, sfnt)) + return 0; + + sfntBuffer = SharedBuffer::adoptVector(sfnt); + buffer = sfntBuffer.get(); + } + // Introduce the font to GDI. AddFontMemResourceEx cannot be used, because it will pollute the process's // font namespace (Windows has no API for creating an HFONT from data without exposing the font to the // entire process first). TTLoadEmbeddedFont lets us override the font family name, so using a unique name @@ -200,4 +211,9 @@ FontCustomPlatformData* createFontCustomPlatformData(SharedBuffer* buffer) return new FontCustomPlatformData(fontReference, fontName); } +bool FontCustomPlatformData::supportsFormat(const String& format) +{ + return equalIgnoringCase(format, "truetype") || equalIgnoringCase(format, "opentype") || equalIgnoringCase(format, "woff"); +} + } diff --git a/WebCore/platform/graphics/win/FontCustomPlatformData.h b/WebCore/platform/graphics/win/FontCustomPlatformData.h index f75f12a..46ddbb5 100644 --- a/WebCore/platform/graphics/win/FontCustomPlatformData.h +++ b/WebCore/platform/graphics/win/FontCustomPlatformData.h @@ -31,6 +31,7 @@ namespace WebCore { class FontPlatformData; class SharedBuffer; +class String; struct FontCustomPlatformData : Noncopyable { FontCustomPlatformData(HANDLE fontReference, const String& name) @@ -43,6 +44,8 @@ struct FontCustomPlatformData : Noncopyable { FontPlatformData fontPlatformData(int size, bool bold, bool italic, FontRenderingMode = NormalRenderingMode); + static bool supportsFormat(const String&); + HANDLE m_fontReference; String m_name; }; diff --git a/WebCore/platform/graphics/win/FontCustomPlatformDataCairo.cpp b/WebCore/platform/graphics/win/FontCustomPlatformDataCairo.cpp index e54d85a..35839f5 100644 --- a/WebCore/platform/graphics/win/FontCustomPlatformDataCairo.cpp +++ b/WebCore/platform/graphics/win/FontCustomPlatformDataCairo.cpp @@ -58,4 +58,9 @@ FontCustomPlatformDataCairo* createFontCustomPlatformData(SharedBuffer* buffer) return new FontCustomPlatformDataCairo(fontFace); } +bool FontCustomPlatformData::supportsFormat(const String& format) +{ + return equalIgnoringCase(format, "truetype") || equalIgnoringCase(format, "opentype"); +} + } diff --git a/WebCore/platform/graphics/win/FontCustomPlatformDataCairo.h b/WebCore/platform/graphics/win/FontCustomPlatformDataCairo.h index 87794b5..75fe3d1 100644 --- a/WebCore/platform/graphics/win/FontCustomPlatformDataCairo.h +++ b/WebCore/platform/graphics/win/FontCustomPlatformDataCairo.h @@ -29,6 +29,7 @@ namespace WebCore { class FontPlatformData; class SharedBuffer; +class String; struct FontCustomPlatformDataCairo : Noncopyable { FontCustomPlatformDataCairo(cairo_font_face_t* fontFace) @@ -39,6 +40,8 @@ struct FontCustomPlatformDataCairo : Noncopyable { FontPlatformData fontPlatformData(int size, bool bold, bool italic); + static bool supportsFormat(const String&); + cairo_font_face_t* m_fontFace; }; diff --git a/WebCore/platform/graphics/win/WKCACFLayer.cpp b/WebCore/platform/graphics/win/WKCACFLayer.cpp index d3928f1..b5f3427 100644 --- a/WebCore/platform/graphics/win/WKCACFLayer.cpp +++ b/WebCore/platform/graphics/win/WKCACFLayer.cpp @@ -29,7 +29,6 @@ #include "WKCACFLayer.h" -#include "WKCACFContextFlusher.h" #include "WKCACFLayerRenderer.h" #include <wtf/text/CString.h> @@ -123,7 +122,6 @@ static CFStringRef toCACFFilterType(WKCACFLayer::FilterType type) case WKCACFLayer::Linear: return kCACFFilterLinear; case WKCACFLayer::Nearest: return kCACFFilterNearest; case WKCACFLayer::Trilinear: return kCACFFilterTrilinear; - case WKCACFLayer::Lanczos: return kCACFFilterLanczos; default: return 0; } } @@ -136,9 +134,6 @@ static WKCACFLayer::FilterType fromCACFFilterType(CFStringRef string) if (CFEqual(string, kCACFFilterTrilinear)) return WKCACFLayer::Trilinear; - if (CFEqual(string, kCACFFilterLanczos)) - return WKCACFLayer::Lanczos; - return WKCACFLayer::Linear; } @@ -180,15 +175,6 @@ void WKCACFLayer::setNeedsCommit() { WKCACFLayer* root = rootLayer(); - CACFContextRef context = CACFLayerGetContext(root->layer()); - - // The context might now be set yet. This happens if a property gets set - // before placing the layer in the tree. In this case we don't need to - // worry about remembering the context because we will when the layer is - // added to the tree. - if (context) - WKCACFContextFlusher::shared().addContext(context); - // Call setNeedsRender on the root layer, which will cause a render to // happen in WKCACFLayerRenderer root->setNeedsRender(); diff --git a/WebCore/platform/graphics/win/WKCACFLayer.h b/WebCore/platform/graphics/win/WKCACFLayer.h index 5e8eb05..ed39297 100644 --- a/WebCore/platform/graphics/win/WKCACFLayer.h +++ b/WebCore/platform/graphics/win/WKCACFLayer.h @@ -56,7 +56,7 @@ protected: class WKCACFLayer : public RefCounted<WKCACFLayer> { public: enum LayerType { Layer, TransformLayer }; - enum FilterType { Linear, Nearest, Trilinear, Lanczos }; + enum FilterType { Linear, Nearest, Trilinear }; enum ContentsGravityType { Center, Top, Bottom, Left, Right, TopLeft, TopRight, BottomLeft, BottomRight, Resize, ResizeAspect, ResizeAspectFill }; @@ -162,9 +162,6 @@ public: virtual void setBounds(const CGRect&); CGRect bounds() const { return CACFLayerGetBounds(layer()); } - void setClearsContext(bool clears) { CACFLayerSetClearsContext(layer(), clears); setNeedsCommit(); } - bool clearsContext() const { return CACFLayerGetClearsContext(layer()); } - void setContents(CFTypeRef contents) { CACFLayerSetContents(layer(), contents); setNeedsCommit(); } CFTypeRef contents() const { return CACFLayerGetContents(layer()); } @@ -180,9 +177,6 @@ public: void setEdgeAntialiasingMask(uint32_t mask) { CACFLayerSetEdgeAntialiasingMask(layer(), mask); setNeedsCommit(); } uint32_t edgeAntialiasingMask() const { return CACFLayerGetEdgeAntialiasingMask(layer()); } - void setFilters(CFArrayRef filters) { CACFLayerSetFilters(layer(), filters); setNeedsCommit(); } - CFArrayRef filters() const { return CACFLayerGetFilters(layer()); } - virtual void setFrame(const CGRect&); CGRect frame() const { return CACFLayerGetFrame(layer()); } @@ -226,9 +220,6 @@ public: WKCACFLayer* rootLayer() const; - void setSortsSublayers(bool sorts) { CACFLayerSetSortsSublayers(layer(), sorts); setNeedsCommit(); } - bool sortsSublayers() const { return CACFLayerGetSortsSublayers(layer()); } - void setSublayerTransform(const CATransform3D& transform) { CACFLayerSetSublayerTransform(layer(), transform); setNeedsCommit(); } CATransform3D sublayerTransform() const { return CACFLayerGetSublayerTransform(layer()); } diff --git a/WebCore/platform/graphics/win/WKCACFLayerRenderer.cpp b/WebCore/platform/graphics/win/WKCACFLayerRenderer.cpp index 0ee61f3..2a355c2 100644 --- a/WebCore/platform/graphics/win/WKCACFLayerRenderer.cpp +++ b/WebCore/platform/graphics/win/WKCACFLayerRenderer.cpp @@ -98,7 +98,7 @@ public: return adoptRef(new WKCACFRootLayer(renderer)); } - virtual void setNeedsRender() { m_renderer->renderSoon(); } + virtual void setNeedsRender() { m_renderer->layerTreeDidChange(); } // Overload this to avoid calling setNeedsDisplay on the layer, which would override the contents // we have placed on the root layer. @@ -333,6 +333,12 @@ void WKCACFLayerRenderer::setRootChildLayer(WKCACFLayer* layer) } } +void WKCACFLayerRenderer::layerTreeDidChange() +{ + WKCACFContextFlusher::shared().addContext(m_context.get()); + renderSoon(); +} + void WKCACFLayerRenderer::setNeedsDisplay() { ASSERT(m_rootLayer); diff --git a/WebCore/platform/graphics/win/WKCACFLayerRenderer.h b/WebCore/platform/graphics/win/WKCACFLayerRenderer.h index 1ff955a..2647c5f 100644 --- a/WebCore/platform/graphics/win/WKCACFLayerRenderer.h +++ b/WebCore/platform/graphics/win/WKCACFLayerRenderer.h @@ -70,6 +70,7 @@ public: void setRootContents(CGImageRef); void setRootContentsAndDisplay(CGImageRef); void setRootChildLayer(WKCACFLayer* layer); + void layerTreeDidChange(); void setNeedsDisplay(); void setHostWindow(HWND window) { m_hostWindow = window; } void setBackingStoreDirty(bool dirty) { m_backingStoreDirty = dirty; } diff --git a/WebCore/platform/graphics/wince/FontCustomPlatformData.cpp b/WebCore/platform/graphics/wince/FontCustomPlatformData.cpp index f8a1e26..3605c72 100644 --- a/WebCore/platform/graphics/wince/FontCustomPlatformData.cpp +++ b/WebCore/platform/graphics/wince/FontCustomPlatformData.cpp @@ -83,4 +83,9 @@ FontCustomPlatformData* createFontCustomPlatformData(const SharedBuffer* buffer) return 0; } +bool FontCustomPlatformData::supportsFormat(const String& format) +{ + return equalIgnoringCase(format, "truetype") || equalIgnoringCase(format, "opentype"); +} + } diff --git a/WebCore/platform/graphics/wince/FontCustomPlatformData.h b/WebCore/platform/graphics/wince/FontCustomPlatformData.h index 89d1fdd..5ce0ea6 100644 --- a/WebCore/platform/graphics/wince/FontCustomPlatformData.h +++ b/WebCore/platform/graphics/wince/FontCustomPlatformData.h @@ -45,6 +45,9 @@ namespace WebCore { ~FontCustomPlatformData(); FontPlatformData fontPlatformData(int size, bool bold, bool italic, FontRenderingMode = NormalRenderingMode); + + static bool supportsFormat(const String&); + String m_name; }; diff --git a/WebCore/platform/gtk/KeyEventGtk.cpp b/WebCore/platform/gtk/KeyEventGtk.cpp index 193b7e5..e9756d8 100644 --- a/WebCore/platform/gtk/KeyEventGtk.cpp +++ b/WebCore/platform/gtk/KeyEventGtk.cpp @@ -264,15 +264,14 @@ static int windowsKeyCodeForKeyEvent(unsigned int keycode) case GDK_Select: return VK_SELECT; // (29) SELECT key case GDK_Print: - return VK_PRINT; // (2A) PRINT key + return VK_SNAPSHOT; // (2C) PRINT SCREEN key case GDK_Execute: return VK_EXECUTE;// (2B) EXECUTE key - //dunno on this - //case GDK_PrintScreen: - // return VK_SNAPSHOT; // (2C) PRINT SCREEN key case GDK_Insert: + case GDK_KP_Insert: return VK_INSERT; // (2D) INS key case GDK_Delete: + case GDK_KP_Delete: return VK_DELETE; // (2E) DEL key case GDK_Help: return VK_HELP; // (2F) HELP key diff --git a/WebCore/platform/gtk/PopupMenuGtk.cpp b/WebCore/platform/gtk/PopupMenuGtk.cpp index bf8cfb4..ca067d9 100644 --- a/WebCore/platform/gtk/PopupMenuGtk.cpp +++ b/WebCore/platform/gtk/PopupMenuGtk.cpp @@ -4,6 +4,7 @@ * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. * Copyright (C) 2006 Michael Emmel mike.emmel@gmail.com * Copyright (C) 2008 Collabora Ltd. + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -23,7 +24,7 @@ */ #include "config.h" -#include "PopupMenu.h" +#include "PopupMenuGtk.h" #include "FrameView.h" #include "GtkVersioning.h" @@ -34,12 +35,12 @@ namespace WebCore { -PopupMenu::PopupMenu(PopupMenuClient* client) +PopupMenuGtk::PopupMenuGtk(PopupMenuClient* client) : m_popupClient(client) { } -PopupMenu::~PopupMenu() +PopupMenuGtk::~PopupMenuGtk() { if (m_popup) { g_signal_handlers_disconnect_matched(m_popup.get(), G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, this); @@ -47,7 +48,7 @@ PopupMenu::~PopupMenu() } } -void PopupMenu::show(const IntRect& rect, FrameView* view, int index) +void PopupMenuGtk::show(const IntRect& rect, FrameView* view, int index) { ASSERT(client()); @@ -110,43 +111,43 @@ void PopupMenu::show(const IntRect& rect, FrameView* view, int index) gtk_menu_popup(m_popup.get(), 0, 0, reinterpret_cast<GtkMenuPositionFunc>(menuPositionFunction), this, 0, gtk_get_current_event_time()); } -void PopupMenu::hide() +void PopupMenuGtk::hide() { ASSERT(m_popup); gtk_menu_popdown(m_popup.get()); } -void PopupMenu::updateFromElement() +void PopupMenuGtk::updateFromElement() { client()->setTextFromItem(client()->selectedIndex()); } -bool PopupMenu::itemWritingDirectionIsNatural() +void PopupMenuGtk::disconnectClient() { - return true; + m_popupClient = 0; } -void PopupMenu::menuItemActivated(GtkMenuItem* item, PopupMenu* that) +void PopupMenuGtk::menuItemActivated(GtkMenuItem* item, PopupMenuGtk* that) { ASSERT(that->client()); ASSERT(that->m_indexMap.contains(GTK_WIDGET(item))); that->client()->valueChanged(that->m_indexMap.get(GTK_WIDGET(item))); } -void PopupMenu::menuUnmapped(GtkWidget*, PopupMenu* that) +void PopupMenuGtk::menuUnmapped(GtkWidget*, PopupMenuGtk* that) { ASSERT(that->client()); that->client()->popupDidHide(); } -void PopupMenu::menuPositionFunction(GtkMenu*, gint* x, gint* y, gboolean* pushIn, PopupMenu* that) +void PopupMenuGtk::menuPositionFunction(GtkMenu*, gint* x, gint* y, gboolean* pushIn, PopupMenuGtk* that) { *x = that->m_menuPosition.x(); *y = that->m_menuPosition.y(); *pushIn = true; } -void PopupMenu::menuRemoveItem(GtkWidget* widget, PopupMenu* that) +void PopupMenuGtk::menuRemoveItem(GtkWidget* widget, PopupMenuGtk* that) { ASSERT(that->m_popup); gtk_container_remove(GTK_CONTAINER(that->m_popup.get()), widget); diff --git a/WebCore/platform/gtk/PopupMenuGtk.h b/WebCore/platform/gtk/PopupMenuGtk.h new file mode 100644 index 0000000..fb4e7dd --- /dev/null +++ b/WebCore/platform/gtk/PopupMenuGtk.h @@ -0,0 +1,67 @@ +/* + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#ifndef PopupMenuGtk_h +#define PopupMenuGtk_h + +#include "GRefPtrGtk.h" +#include "IntRect.h" +#include "PopupMenu.h" +#include "PopupMenuClient.h" +#include <glib.h> +#include <wtf/HashMap.h> +#include <wtf/PassRefPtr.h> +#include <wtf/RefCounted.h> + +typedef struct _GtkMenu GtkMenu; +typedef struct _GtkMenuItem GtkMenuItem; +typedef struct _GtkWidget GtkWidget; + +namespace WebCore { + +class FrameView; +class Scrollbar; + +class PopupMenuGtk : public PopupMenu { +public: + PopupMenuGtk(PopupMenuClient*); + ~PopupMenuGtk(); + + virtual void show(const IntRect&, FrameView*, int index); + virtual void hide(); + virtual void updateFromElement(); + virtual void disconnectClient(); + +private: + PopupMenuClient* client() const { return m_popupClient; } + + static void menuItemActivated(GtkMenuItem* item, PopupMenuGtk*); + static void menuUnmapped(GtkWidget*, PopupMenuGtk*); + static void menuPositionFunction(GtkMenu*, gint*, gint*, gboolean*, PopupMenuGtk*); + static void menuRemoveItem(GtkWidget*, PopupMenuGtk*); + + PopupMenuClient* m_popupClient; + IntPoint m_menuPosition; + GRefPtr<GtkMenu> m_popup; + HashMap<GtkWidget*, int> m_indexMap; +}; + +} + +#endif // PopupMenuGtk_h diff --git a/WebCore/platform/gtk/SearchPopupMenuGtk.cpp b/WebCore/platform/gtk/SearchPopupMenuGtk.cpp index fbaa527..2413773 100644 --- a/WebCore/platform/gtk/SearchPopupMenuGtk.cpp +++ b/WebCore/platform/gtk/SearchPopupMenuGtk.cpp @@ -1,4 +1,6 @@ /* + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either @@ -15,29 +17,34 @@ */ #include "config.h" -#include "SearchPopupMenu.h" +#include "SearchPopupMenuGtk.h" #include "NotImplemented.h" namespace WebCore { -SearchPopupMenu::SearchPopupMenu(PopupMenuClient* client) - : PopupMenu(client) +SearchPopupMenuGtk::SearchPopupMenuGtk(PopupMenuClient* client) + : m_popup(adoptRef(new PopupMenuGtk(client))) { notImplemented(); } -void SearchPopupMenu::saveRecentSearches(const AtomicString&, const Vector<String>&) +PopupMenu* SearchPopupMenuGtk::popupMenu() +{ + return m_popup.get(); +} + +void SearchPopupMenuGtk::saveRecentSearches(const AtomicString&, const Vector<String>&) { notImplemented(); } -void SearchPopupMenu::loadRecentSearches(const AtomicString&, Vector<String>&) +void SearchPopupMenuGtk::loadRecentSearches(const AtomicString&, Vector<String>&) { notImplemented(); } -bool SearchPopupMenu::enabled() +bool SearchPopupMenuGtk::enabled() { notImplemented(); return false; diff --git a/WebCore/platform/gtk/SearchPopupMenuGtk.h b/WebCore/platform/gtk/SearchPopupMenuGtk.h new file mode 100644 index 0000000..453c63d --- /dev/null +++ b/WebCore/platform/gtk/SearchPopupMenuGtk.h @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ + +#ifndef SearchPopupMenuGtk_h +#define SearchPopupMenuGtk_h + +#include "PopupMenuGtk.h" +#include "SearchPopupMenu.h" + +namespace WebCore { + +class SearchPopupMenuGtk : public SearchPopupMenu { +public: + SearchPopupMenuGtk(PopupMenuClient*); + + virtual PopupMenu* popupMenu(); + virtual void saveRecentSearches(const AtomicString& name, const Vector<String>& searchItems); + virtual void loadRecentSearches(const AtomicString& name, Vector<String>& searchItems); + virtual bool enabled(); + +private: + RefPtr<PopupMenuGtk> m_popup; +}; + +} + +#endif // SearchPopupMenuGtk_h diff --git a/WebCore/platform/haiku/PopupMenuHaiku.cpp b/WebCore/platform/haiku/PopupMenuHaiku.cpp index 5adbc66..e3edb83 100644 --- a/WebCore/platform/haiku/PopupMenuHaiku.cpp +++ b/WebCore/platform/haiku/PopupMenuHaiku.cpp @@ -2,6 +2,7 @@ * This file is part of the popup menu implementation for <select> elements in WebCore. * * Copyright (C) 2010 Stephan Aßmus <superstippi@gmx.de> + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -21,7 +22,7 @@ */ #include "config.h" -#include "PopupMenu.h" +#include "PopupMenuHaiku.h" #include "FrameView.h" @@ -72,9 +73,9 @@ private: PopupMenuClient* m_popupClient; }; -class PopupMenuHaiku : public BPopUpMenu { +class HaikuPopup : public BPopUpMenu { public: - PopupMenuHaiku(PopupMenuClient* popupClient) + HaikuPopup(PopupMenuClient* popupClient) : BPopUpMenu("WebCore Popup", true, false) , m_popupClient(popupClient) , m_Handler(popupClient) @@ -86,7 +87,7 @@ public: SetAsyncAutoDestruct(false); } - virtual ~PopupMenuHaiku() + virtual ~HaikuPopup() { if (be_app->Lock()) { be_app->RemoveHandler(&m_Handler); @@ -153,39 +154,39 @@ private: PopupMenuHandler m_Handler; }; -PopupMenu::PopupMenu(PopupMenuClient* client) +PopupMenuHaiku::PopupMenuHaiku(PopupMenuClient* client) : m_popupClient(client) - , m_menu(new PopupMenuHaiku(client)) + , m_menu(new HaikuPopup(client)) { // We don't need additional references to the client, since we completely // control any sub-objects we create that need it as well. } -PopupMenu::~PopupMenu() +PopupMenuHaiku::~PopupMenuHaiku() { delete m_menu; } -void PopupMenu::show(const IntRect& rect, FrameView* view, int index) +void PopupMenuHaiku::disconnectClient() +{ + m_popupClient = 0; +} + +void PopupMenuHaiku::show(const IntRect& rect, FrameView* view, int index) { // The menu will update itself from the PopupMenuClient before showing. m_menu->show(rect, view, index); } -void PopupMenu::hide() +void PopupMenuHaiku::hide() { m_menu->hide(); } -void PopupMenu::updateFromElement() +void PopupMenuHaiku::updateFromElement() { client()->setTextFromItem(m_popupClient->selectedIndex()); } -bool PopupMenu::itemWritingDirectionIsNatural() -{ - return false; -} - } // namespace WebCore diff --git a/WebCore/platform/haiku/PopupMenuHaiku.h b/WebCore/platform/haiku/PopupMenuHaiku.h new file mode 100644 index 0000000..9207923 --- /dev/null +++ b/WebCore/platform/haiku/PopupMenuHaiku.h @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ + +#ifndef PopupMenuHaiku_h +#define PopupMenuHaiku_h + +#include "IntRect.h" +#include "PopupMenu.h" +#include "PopupMenuClient.h" +#include <wtf/PassRefPtr.h> +#include <wtf/RefCounted.h> + +namespace WebCore { + +class FrameView; +class HaikuPopup; +class Scrollbar; + +class PopupMenuHaiku : public PopupMenu { +public: + PopupMenuHaiku(PopupMenuClient*); + ~PopupMenuHaiku(); + + virtual void show(const IntRect&, FrameView*, int index); + virtual void hide(); + virtual void updateFromElement(); + virtual void disconnectClient(); + +private: + PopupMenuClient* client() const { return m_popupClient; } + + PopupMenuClient* m_popupClient; + HaikuPopup* m_menu; +}; + +} + +#endif // PopupMenuHaiku_h diff --git a/WebCore/platform/haiku/SearchPopupMenuHaiku.cpp b/WebCore/platform/haiku/SearchPopupMenuHaiku.cpp index fd5d96c..109409a 100644 --- a/WebCore/platform/haiku/SearchPopupMenuHaiku.cpp +++ b/WebCore/platform/haiku/SearchPopupMenuHaiku.cpp @@ -1,5 +1,6 @@ /* * Copyright (C) 2007 Ryan Leavengood <leavengood@gmail.com> + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -18,7 +19,7 @@ */ #include "config.h" -#include "SearchPopupMenu.h" +#include "SearchPopupMenuHaiku.h" #include "AtomicString.h" #include "NotImplemented.h" @@ -26,26 +27,31 @@ namespace WebCore { -SearchPopupMenu::SearchPopupMenu(PopupMenuClient* client) - : PopupMenu(client) +SearchPopupMenuHaiku::SearchPopupMenuHaiku(PopupMenuClient* client) + : m_popup(adoptRef(new PopupMenuHaiku(client))) { } -void SearchPopupMenu::saveRecentSearches(const AtomicString& name, const Vector<String>& searchItems) +void SearchPopupMenuHaiku::saveRecentSearches(const AtomicString& name, const Vector<String>& searchItems) { notImplemented(); } -void SearchPopupMenu::loadRecentSearches(const AtomicString& name, Vector<String>& searchItems) +void SearchPopupMenuHaiku::loadRecentSearches(const AtomicString& name, Vector<String>& searchItems) { notImplemented(); } -bool SearchPopupMenu::enabled() +bool SearchPopupMenuHaiku::enabled() { notImplemented(); return false; } +PopupMenu* SearchPopupMenuHaiku::popupMenu() +{ + return m_popup.get(); +} + } // namespace WebCore diff --git a/WebCore/platform/haiku/SearchPopupMenuHaiku.h b/WebCore/platform/haiku/SearchPopupMenuHaiku.h new file mode 100644 index 0000000..a9e8e8d --- /dev/null +++ b/WebCore/platform/haiku/SearchPopupMenuHaiku.h @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ + +#ifndef SearchPopupMenuHaiku_h +#define SearchPopupMenuHaiku_h + +#include "PopupMenuHaiku.h" +#include "SearchPopupMenu.h" + +namespace WebCore { + +class SearchPopupMenuHaiku : public SearchPopupMenu { +public: + SearchPopupMenuHaiku(PopupMenuClient*); + + virtual PopupMenu* popupMenu(); + virtual void saveRecentSearches(const AtomicString& name, const Vector<String>& searchItems); + virtual void loadRecentSearches(const AtomicString& name, Vector<String>& searchItems); + virtual bool enabled(); + +private: + RefPtr<PopupMenuHaiku> m_popup; +}; + +} + +#endif // SearchPopupMenuHaiku_h diff --git a/WebCore/platform/mac/PopupMenuMac.h b/WebCore/platform/mac/PopupMenuMac.h new file mode 100644 index 0000000..e969fff --- /dev/null +++ b/WebCore/platform/mac/PopupMenuMac.h @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#ifndef PopupMenuMac_h +#define PopupMenuMac_h + +#include "IntRect.h" +#include "PopupMenu.h" +#include <wtf/PassRefPtr.h> +#include <wtf/RefCounted.h> +#include <wtf/RetainPtr.h> + +class NSPopUpButtonCell; + +namespace WebCore { + +class PopupMenuClient; +class FrameView; +class Scrollbar; + +class PopupMenuMac : public PopupMenu { +public: + PopupMenuMac(PopupMenuClient*); + ~PopupMenuMac(); + + virtual void show(const IntRect&, FrameView*, int index); + virtual void hide(); + virtual void updateFromElement(); + virtual void disconnectClient(); + +private: + void clear(); + void populate(); + PopupMenuClient* client() const { return m_popupClient; } + + PopupMenuClient* m_popupClient; + RetainPtr<NSPopUpButtonCell> m_popup; +}; + +} + +#endif // PopupMenuMac_h diff --git a/WebCore/platform/mac/PopupMenuMac.mm b/WebCore/platform/mac/PopupMenuMac.mm index 6c067b9..1bf500b 100644 --- a/WebCore/platform/mac/PopupMenuMac.mm +++ b/WebCore/platform/mac/PopupMenuMac.mm @@ -1,5 +1,6 @@ /* * Copyright (C) 2006, 2008 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 * modify it under the terms of the GNU Library General Public @@ -18,7 +19,7 @@ */ #import "config.h" -#import "PopupMenu.h" +#import "PopupMenuMac.h" #import "AXObjectCache.h" #import "Chrome.h" @@ -31,6 +32,7 @@ #import "HTMLOptionElement.h" #import "HTMLSelectElement.h" #import "Page.h" +#import "PopupMenuClient.h" #import "SimpleFontData.h" #import "WebCoreSystemInterface.h" @@ -38,24 +40,24 @@ namespace WebCore { using namespace HTMLNames; -PopupMenu::PopupMenu(PopupMenuClient* client) +PopupMenuMac::PopupMenuMac(PopupMenuClient* client) : m_popupClient(client) { } -PopupMenu::~PopupMenu() +PopupMenuMac::~PopupMenuMac() { if (m_popup) [m_popup.get() setControlView:nil]; } -void PopupMenu::clear() +void PopupMenuMac::clear() { if (m_popup) [m_popup.get() removeAllItems]; } -void PopupMenu::populate() +void PopupMenuMac::populate() { if (m_popup) clear(); @@ -114,7 +116,7 @@ void PopupMenu::populate() [[m_popup.get() menu] setMenuChangedMessagesEnabled:messagesEnabled]; } -void PopupMenu::show(const IntRect& r, FrameView* v, int index) +void PopupMenuMac::show(const IntRect& r, FrameView* v, int index) { populate(); int numItems = [m_popup.get() numberOfItems]; @@ -162,7 +164,7 @@ void PopupMenu::show(const IntRect& r, FrameView* v, int index) RefPtr<Frame> frame = v->frame(); NSEvent* event = [frame->eventHandler()->currentNSEvent() retain]; - RefPtr<PopupMenu> protector(this); + RefPtr<PopupMenuMac> protector(this); RetainPtr<NSView> dummyView(AdoptNS, [[NSView alloc] initWithFrame:r]); [view addSubview:dummyView.get()]; @@ -194,18 +196,18 @@ void PopupMenu::show(const IntRect& r, FrameView* v, int index) [event release]; } -void PopupMenu::hide() +void PopupMenuMac::hide() { [m_popup.get() dismissPopUp]; } -void PopupMenu::updateFromElement() +void PopupMenuMac::updateFromElement() { } -bool PopupMenu::itemWritingDirectionIsNatural() +void PopupMenuMac::disconnectClient() { - return true; + m_popupClient = 0; } } diff --git a/WebCore/platform/mac/SearchPopupMenuMac.h b/WebCore/platform/mac/SearchPopupMenuMac.h new file mode 100644 index 0000000..828b07f --- /dev/null +++ b/WebCore/platform/mac/SearchPopupMenuMac.h @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ + +#ifndef SearchPopupMenuMac_h +#define SearchPopupMenuMac_h + +#include "PopupMenuMac.h" +#include "SearchPopupMenu.h" + +namespace WebCore { + +class SearchPopupMenuMac : public SearchPopupMenu { +public: + SearchPopupMenuMac(PopupMenuClient*); + + virtual PopupMenu* popupMenu(); + virtual void saveRecentSearches(const AtomicString& name, const Vector<String>& searchItems); + virtual void loadRecentSearches(const AtomicString& name, Vector<String>& searchItems); + virtual bool enabled(); + +private: + RefPtr<PopupMenuMac> m_popup; +}; + +} + +#endif // SearchPopupMenuMac_h diff --git a/WebCore/platform/mac/SearchPopupMenuMac.mm b/WebCore/platform/mac/SearchPopupMenuMac.mm index 262734d..69018ee 100644 --- a/WebCore/platform/mac/SearchPopupMenuMac.mm +++ b/WebCore/platform/mac/SearchPopupMenuMac.mm @@ -1,5 +1,6 @@ /* * Copyright (C) 2006 Apple Computer, Inc. + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -18,14 +19,14 @@ */ #import "config.h" -#import "SearchPopupMenu.h" +#import "SearchPopupMenuMac.h" #import "AtomicString.h" namespace WebCore { -SearchPopupMenu::SearchPopupMenu(PopupMenuClient* client) - : PopupMenu(client) +SearchPopupMenuMac::SearchPopupMenuMac(PopupMenuClient* client) + : m_popup(adoptRef(new PopupMenuMac(client))) { } @@ -34,12 +35,17 @@ static NSString* autosaveKey(const String& name) return [@"com.apple.WebKit.searchField:" stringByAppendingString:name]; } -bool SearchPopupMenu::enabled() +PopupMenu* SearchPopupMenuMac::popupMenu() +{ + return m_popup.get(); +} + +bool SearchPopupMenuMac::enabled() { return true; } -void SearchPopupMenu::saveRecentSearches(const AtomicString& name, const Vector<String>& searchItems) +void SearchPopupMenuMac::saveRecentSearches(const AtomicString& name, const Vector<String>& searchItems) { if (name.isEmpty()) return; @@ -56,7 +62,7 @@ void SearchPopupMenu::saveRecentSearches(const AtomicString& name, const Vector< } } -void SearchPopupMenu::loadRecentSearches(const AtomicString& name, Vector<String>& searchItems) +void SearchPopupMenuMac::loadRecentSearches(const AtomicString& name, Vector<String>& searchItems) { if (name.isEmpty()) return; diff --git a/WebCore/platform/mock/DeviceOrientationClientMock.cpp b/WebCore/platform/mock/DeviceOrientationClientMock.cpp new file mode 100644 index 0000000..c2c9316 --- /dev/null +++ b/WebCore/platform/mock/DeviceOrientationClientMock.cpp @@ -0,0 +1,71 @@ +/* + * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``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 "DeviceOrientationClientMock.h" + +#include "DeviceOrientationController.h" + +namespace WebCore { + +DeviceOrientationClientMock::DeviceOrientationClientMock() + : m_controller(0) + , m_timer(this, &DeviceOrientationClientMock::timerFired) + , m_isUpdating(false) +{ +} + +void DeviceOrientationClientMock::setController(DeviceOrientationController* controller) +{ + m_controller = controller; + ASSERT(m_controller); +} + +void DeviceOrientationClientMock::startUpdating() +{ + m_isUpdating = true; +} + +void DeviceOrientationClientMock::stopUpdating() +{ + m_isUpdating = false; + m_timer.stop(); +} + +void DeviceOrientationClientMock::setOrientation(PassRefPtr<DeviceOrientation> orientation) +{ + m_orientation = orientation; + if (m_isUpdating && !m_timer.isActive()) + m_timer.startOneShot(0); +} + +void DeviceOrientationClientMock::timerFired(Timer<DeviceOrientationClientMock>* timer) +{ + ASSERT_UNUSED(timer, timer == &m_timer); + m_timer.stop(); + m_controller->didChangeDeviceOrientation(m_orientation.get()); +} + +} // namespace WebCore diff --git a/WebCore/platform/mock/DeviceOrientationClientMock.h b/WebCore/platform/mock/DeviceOrientationClientMock.h new file mode 100644 index 0000000..6691130 --- /dev/null +++ b/WebCore/platform/mock/DeviceOrientationClientMock.h @@ -0,0 +1,66 @@ +/* + * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``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 DeviceOrientationClientMock_h +#define DeviceOrientationClientMock_h + +#include "DeviceOrientation.h" +#include "DeviceOrientationClient.h" +#include "Timer.h" + +#include <wtf/PassRefPtr.h> +#include <wtf/RefPtr.h> + +namespace WebCore { + +class DeviceOrientationController; + +// A mock implementation of DeviceOrientationClient used to test the feature in +// DumpRenderTree. Embedders should should configure the Page object to use this +// client when running DumpRenderTree. +class DeviceOrientationClientMock : public DeviceOrientationClient { +public: + DeviceOrientationClientMock(); + + // DeviceOrientationClient + virtual void setController(DeviceOrientationController*); + virtual void startUpdating(); + virtual void stopUpdating(); + virtual DeviceOrientation* lastOrientation() const { return m_orientation.get(); } + + void setOrientation(PassRefPtr<DeviceOrientation>); + +private: + void timerFired(Timer<DeviceOrientationClientMock>*); + + RefPtr<DeviceOrientation> m_orientation; + DeviceOrientationController* m_controller; + Timer<DeviceOrientationClientMock> m_timer; + bool m_isUpdating; +}; + +} // namespace WebCore + +#endif // DeviceOrientationClientMock_h diff --git a/WebCore/platform/mock/SpeechInputClientMock.cpp b/WebCore/platform/mock/SpeechInputClientMock.cpp new file mode 100644 index 0000000..74a3151 --- /dev/null +++ b/WebCore/platform/mock/SpeechInputClientMock.cpp @@ -0,0 +1,95 @@ +/* + * 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 "SpeechInputClientMock.h" + +#if ENABLE(INPUT_SPEECH) + +#include "SpeechInputListener.h" + +namespace WebCore { + +SpeechInputClientMock::SpeechInputClientMock() + : m_recording(false) + , m_timer(this, &SpeechInputClientMock::timerFired) + , m_listener(0) +{ +} + +bool SpeechInputClientMock::startRecognition(SpeechInputListener* listener) +{ + if (m_timer.isActive()) + return false; + m_listener = listener; + m_recording = true; + m_timer.startOneShot(0); + return true; +} + +void SpeechInputClientMock::stopRecording() +{ + if (m_timer.isActive() && m_recording) { + m_timer.stop(); + timerFired(&m_timer); + } +} + +void SpeechInputClientMock::cancelRecognition() +{ + if (m_timer.isActive()) { + m_timer.stop(); + m_recording = false; + m_listener->didCompleteRecognition(); + m_listener = 0; + } +} + +void SpeechInputClientMock::setRecognitionResult(const String& result) +{ + m_recognitionResult = result; +} + +void SpeechInputClientMock::timerFired(WebCore::Timer<SpeechInputClientMock>*) +{ + if (m_recording) { + m_recording = false; + m_listener->didCompleteRecording(); + m_timer.startOneShot(0); + } else { + m_listener->setRecognitionResult(m_recognitionResult); + m_listener->didCompleteRecognition(); + m_listener = 0; + } +} + +} // namespace WebCore + +#endif // ENABLE(INPUT_SPEECH) diff --git a/WebCore/platform/mock/SpeechInputClientMock.h b/WebCore/platform/mock/SpeechInputClientMock.h new file mode 100644 index 0000000..faca444 --- /dev/null +++ b/WebCore/platform/mock/SpeechInputClientMock.h @@ -0,0 +1,69 @@ +/* + * 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 SpeechInputClientMock_h +#define SpeechInputClientMock_h + +#include "PlatformString.h" +#include "SpeechInputClient.h" +#include "Timer.h" + +#if ENABLE(INPUT_SPEECH) + +namespace WebCore { + +class SpeechInputListener; + +// Provides a mock object for the speech input embedder API called by WebCore. +class SpeechInputClientMock : public SpeechInputClient { +public: + SpeechInputClientMock(); + + void setRecognitionResult(const String& result); + + // SpeechInputClient methods. + bool startRecognition(SpeechInputListener*); + void stopRecording(); + void cancelRecognition(); + +private: + void timerFired(Timer<SpeechInputClientMock>*); + + bool m_recording; + Timer<SpeechInputClientMock> m_timer; + SpeechInputListener* m_listener; + String m_recognitionResult; +}; + +} // namespace WebCore + +#endif // ENABLE(INPUT_SPEECH) + +#endif // SpeechInputClientMock_h diff --git a/WebCore/platform/qt/PopupMenuQt.cpp b/WebCore/platform/qt/PopupMenuQt.cpp index 315b891..5590556 100644 --- a/WebCore/platform/qt/PopupMenuQt.cpp +++ b/WebCore/platform/qt/PopupMenuQt.cpp @@ -24,7 +24,7 @@ */ #include "config.h" -#include "PopupMenu.h" +#include "PopupMenuQt.h" #include "Chrome.h" #include "ChromeClientQt.h" @@ -35,18 +35,24 @@ namespace WebCore { -PopupMenu::PopupMenu(PopupMenuClient* client) +PopupMenuQt::PopupMenuQt(PopupMenuClient* client) : m_popupClient(client) , m_popup(0) { } -PopupMenu::~PopupMenu() +PopupMenuQt::~PopupMenuQt() { delete m_popup; } -void PopupMenu::show(const IntRect& rect, FrameView* view, int index) + +void PopupMenuQt::disconnectClient() +{ + m_popupClient = 0; +} + +void PopupMenuQt::show(const IntRect& rect, FrameView* view, int index) { ChromeClientQt* chromeClient = static_cast<ChromeClientQt*>( view->frame()->page()->chrome()->client()); @@ -67,19 +73,14 @@ void PopupMenu::show(const IntRect& rect, FrameView* view, int index) } -void PopupMenu::hide() +void PopupMenuQt::hide() { m_popup->hide(); } -void PopupMenu::updateFromElement() -{ - client()->setTextFromItem(m_popupClient->selectedIndex()); -} - -bool PopupMenu::itemWritingDirectionIsNatural() +void PopupMenuQt::updateFromElement() { - return false; + m_popupClient->setTextFromItem(m_popupClient->selectedIndex()); } } diff --git a/WebCore/platform/qt/PopupMenuQt.h b/WebCore/platform/qt/PopupMenuQt.h new file mode 100644 index 0000000..25a9f76 --- /dev/null +++ b/WebCore/platform/qt/PopupMenuQt.h @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#ifndef PopupMenuQt_h +#define PopupMenuQt_h + +#include "PopupMenu.h" + +namespace WebCore { + +class FrameView; +class QtAbstractWebPopup; +class Scrollbar; +class PopupMenuClient; + +class PopupMenuQt : public PopupMenu { +public: + PopupMenuQt(PopupMenuClient*); + ~PopupMenuQt(); + + virtual void show(const IntRect&, FrameView*, int index); + virtual void hide(); + virtual void updateFromElement(); + virtual void disconnectClient(); + +private: + PopupMenuClient* m_popupClient; + QtAbstractWebPopup* m_popup; +}; + +} + +#endif // PopupMenuQt_h diff --git a/WebCore/platform/qt/QtAbstractWebPopup.h b/WebCore/platform/qt/QtAbstractWebPopup.h index dad4997..5f6f619 100644 --- a/WebCore/platform/qt/QtAbstractWebPopup.h +++ b/WebCore/platform/qt/QtAbstractWebPopup.h @@ -63,7 +63,7 @@ public: QFont font() { return m_popupClient->menuStyle().font().font(); } private: - friend class PopupMenu; + friend class PopupMenuQt; PopupMenuClient* m_popupClient; QWebPageClient* m_pageClient; int m_currentIndex; diff --git a/WebCore/platform/qt/SearchPopupMenuQt.cpp b/WebCore/platform/qt/SearchPopupMenuQt.cpp index 187a5de..a05d08a 100644 --- a/WebCore/platform/qt/SearchPopupMenuQt.cpp +++ b/WebCore/platform/qt/SearchPopupMenuQt.cpp @@ -1,5 +1,6 @@ /* * Copyright C 2006 Zack Rusin <zack@kde.org> + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -18,26 +19,29 @@ */ #include "config.h" -#include "SearchPopupMenu.h" - -#include "AtomicString.h" +#include "SearchPopupMenuQt.h" namespace WebCore { -SearchPopupMenu::SearchPopupMenu(PopupMenuClient* client) - : PopupMenu(client) +SearchPopupMenuQt::SearchPopupMenuQt(PopupMenuClient* client) + : m_popup(adoptRef(new PopupMenuQt(client))) +{ +} + +PopupMenu* SearchPopupMenuQt::popupMenu() { + return m_popup.get(); } -void SearchPopupMenu::saveRecentSearches(const AtomicString&, const Vector<String>&) +void SearchPopupMenuQt::saveRecentSearches(const AtomicString&, const Vector<String>&) { } -void SearchPopupMenu::loadRecentSearches(const AtomicString&, Vector<String>&) +void SearchPopupMenuQt::loadRecentSearches(const AtomicString&, Vector<String>&) { } -bool SearchPopupMenu::enabled() +bool SearchPopupMenuQt::enabled() { return true; } diff --git a/WebCore/platform/qt/SearchPopupMenuQt.h b/WebCore/platform/qt/SearchPopupMenuQt.h new file mode 100644 index 0000000..0fbeafd --- /dev/null +++ b/WebCore/platform/qt/SearchPopupMenuQt.h @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ + +#ifndef SearchPopupMenuQt_h +#define SearchPopupMenuQt_h + +#include "PopupMenuQt.h" +#include "SearchPopupMenu.h" + +namespace WebCore { + +class SearchPopupMenuQt : public SearchPopupMenu { +public: + SearchPopupMenuQt(PopupMenuClient*); + + virtual PopupMenu* popupMenu(); + virtual void saveRecentSearches(const AtomicString& name, const Vector<String>& searchItems); + virtual void loadRecentSearches(const AtomicString& name, Vector<String>& searchItems); + virtual bool enabled(); + +private: + RefPtr<PopupMenuQt> m_popup; +}; + +} + +#endif // SearchPopupMenuQt_h diff --git a/WebCore/platform/sql/SQLiteDatabase.cpp b/WebCore/platform/sql/SQLiteDatabase.cpp index 75fc032..05a2a22 100644 --- a/WebCore/platform/sql/SQLiteDatabase.cpp +++ b/WebCore/platform/sql/SQLiteDatabase.cpp @@ -31,8 +31,8 @@ #include "Logging.h" #include "SQLiteFileSystem.h" #include "SQLiteStatement.h" - #include <sqlite3.h> +#include <wtf/Threading.h> namespace WebCore { @@ -42,7 +42,7 @@ const int SQLResultOk = SQLITE_OK; const int SQLResultRow = SQLITE_ROW; const int SQLResultSchema = SQLITE_SCHEMA; const int SQLResultFull = SQLITE_FULL; - +const int SQLResultInterrupt = SQLITE_INTERRUPT; SQLiteDatabase::SQLiteDatabase() : m_db(0) @@ -50,6 +50,7 @@ SQLiteDatabase::SQLiteDatabase() , m_transactionInProgress(false) , m_sharable(false) , m_openingThread(0) + , m_interrupted(false) { } @@ -85,13 +86,37 @@ void SQLiteDatabase::close() if (m_db) { // FIXME: This is being called on themain thread during JS GC. <rdar://problem/5739818> // ASSERT(currentThread() == m_openingThread); - sqlite3_close(m_db); - m_db = 0; + sqlite3* db = m_db; + { + MutexLocker locker(m_databaseClosingMutex); + m_db = 0; + } + sqlite3_close(db); } m_openingThread = 0; } +void SQLiteDatabase::interrupt() +{ + m_interrupted = true; + while (!m_lockingMutex.tryLock()) { + MutexLocker locker(m_databaseClosingMutex); + if (!m_db) + return; + sqlite3_interrupt(m_db); + yield(); + } + + m_lockingMutex.unlock(); +} + +bool SQLiteDatabase::isInterrupted() +{ + ASSERT(!m_lockingMutex.tryLock()); + return m_interrupted; +} + void SQLiteDatabase::setFullsync(bool fsync) { if (fsync) @@ -397,16 +422,6 @@ void SQLiteDatabase::enableAuthorizer(bool enable) sqlite3_set_authorizer(m_db, NULL, 0); } -void SQLiteDatabase::lock() -{ - m_lockingMutex.lock(); -} - -void SQLiteDatabase::unlock() -{ - m_lockingMutex.unlock(); -} - bool SQLiteDatabase::isAutoCommitOn() const { return sqlite3_get_autocommit(m_db); diff --git a/WebCore/platform/sql/SQLiteDatabase.h b/WebCore/platform/sql/SQLiteDatabase.h index c5924c0..8151380 100644 --- a/WebCore/platform/sql/SQLiteDatabase.h +++ b/WebCore/platform/sql/SQLiteDatabase.h @@ -48,6 +48,7 @@ extern const int SQLResultOk; extern const int SQLResultRow; extern const int SQLResultSchema; extern const int SQLResultFull; +extern const int SQLResultInterrupt; class SQLiteDatabase : public Noncopyable { friend class SQLiteTransaction; @@ -58,6 +59,8 @@ public: bool open(const String& filename, bool forWebSQLDatabase = false); bool isOpen() const { return m_db; } void close(); + void interrupt(); + bool isInterrupted(); bool executeCommand(const String&); bool returnsAtLeastOneResult(const String&); @@ -105,9 +108,7 @@ public: void setAuthorizer(PassRefPtr<DatabaseAuthorizer>); - // (un)locks the database like a mutex - void lock(); - void unlock(); + Mutex& databaseMutex() { return m_lockingMutex; } bool isAutoCommitOn() const; // The SQLite AUTO_VACUUM pragma can be either NONE, FULL, or INCREMENTAL. @@ -149,7 +150,9 @@ private: Mutex m_lockingMutex; ThreadIdentifier m_openingThread; - + + Mutex m_databaseClosingMutex; + bool m_interrupted; }; // class SQLiteDatabase } // namespace WebCore diff --git a/WebCore/platform/sql/SQLiteStatement.cpp b/WebCore/platform/sql/SQLiteStatement.cpp index 78bbfeb..ac467a6 100644 --- a/WebCore/platform/sql/SQLiteStatement.cpp +++ b/WebCore/platform/sql/SQLiteStatement.cpp @@ -61,6 +61,11 @@ SQLiteStatement::~SQLiteStatement() int SQLiteStatement::prepare() { ASSERT(!m_isPrepared); + + MutexLocker databaseLock(m_database.databaseMutex()); + if (m_database.isInterrupted()) + return SQLITE_INTERRUPT; + const void* tail = 0; LOG(SQLDatabase, "SQL - prepare - %s", m_query.ascii().data()); String strippedQuery = m_query.stripWhiteSpace(); @@ -88,6 +93,11 @@ int SQLiteStatement::prepare() int SQLiteStatement::step() { ASSERT(m_isPrepared); + + MutexLocker databaseLock(m_database.databaseMutex()); + if (m_database.isInterrupted()) + return SQLITE_INTERRUPT; + if (!m_statement) return SQLITE_OK; LOG(SQLDatabase, "SQL - step - %s", m_query.ascii().data()); diff --git a/WebCore/platform/win/PopupMenuWin.cpp b/WebCore/platform/win/PopupMenuWin.cpp index 4bc6dc7..aaadc53 100644 --- a/WebCore/platform/win/PopupMenuWin.cpp +++ b/WebCore/platform/win/PopupMenuWin.cpp @@ -1,6 +1,7 @@ /* * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. * Copyright (C) 2007-2009 Torch Mobile Inc. + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -20,7 +21,7 @@ */ #include "config.h" -#include "PopupMenu.h" +#include "PopupMenuWin.h" #include "BitmapInfo.h" #include "Document.h" @@ -86,7 +87,7 @@ static void translatePoint(LPARAM& lParam, HWND from, HWND to) lParam = MAKELPARAM(pt.x, pt.y); } -PopupMenu::PopupMenu(PopupMenuClient* client) +PopupMenuWin::PopupMenuWin(PopupMenuClient* client) : m_popupClient(client) , m_scrollbar(0) , m_popup(0) @@ -102,7 +103,7 @@ PopupMenu::PopupMenu(PopupMenuClient* client) { } -PopupMenu::~PopupMenu() +PopupMenuWin::~PopupMenuWin() { if (m_bmp) ::DeleteObject(m_bmp); @@ -114,12 +115,17 @@ PopupMenu::~PopupMenu() m_scrollbar->setParent(0); } -LPCTSTR PopupMenu::popupClassName() +void PopupMenuWin::disconnectClient() +{ + m_popupClient = 0; +} + +LPCTSTR PopupMenuWin::popupClassName() { return kPopupWindowClassName; } -void PopupMenu::show(const IntRect& r, FrameView* view, int index) +void PopupMenuWin::show(const IntRect& r, FrameView* view, int index) { calculatePositionAndSize(r, view); if (clientRect().isEmpty()) @@ -267,7 +273,7 @@ void PopupMenu::show(const IntRect& r, FrameView* view, int index) hide(); } -void PopupMenu::hide() +void PopupMenuWin::hide() { if (!m_showPopup) return; @@ -283,7 +289,7 @@ void PopupMenu::hide() ::PostMessage(m_popup, WM_NULL, 0, 0); } -void PopupMenu::calculatePositionAndSize(const IntRect& r, FrameView* v) +void PopupMenuWin::calculatePositionAndSize(const IntRect& r, FrameView* v) { // r is in absolute document coordinates, but we want to be in screen coordinates @@ -373,7 +379,7 @@ void PopupMenu::calculatePositionAndSize(const IntRect& r, FrameView* v) return; } -bool PopupMenu::setFocusedIndex(int i, bool hotTracking) +bool PopupMenuWin::setFocusedIndex(int i, bool hotTracking) { if (i < 0 || i >= client()->listSize() || i == focusedIndex()) return false; @@ -395,22 +401,22 @@ bool PopupMenu::setFocusedIndex(int i, bool hotTracking) return true; } -int PopupMenu::visibleItems() const +int PopupMenuWin::visibleItems() const { return clientRect().height() / m_itemHeight; } -int PopupMenu::listIndexAtPoint(const IntPoint& point) const +int PopupMenuWin::listIndexAtPoint(const IntPoint& point) const { return m_scrollOffset + point.y() / m_itemHeight; } -int PopupMenu::focusedIndex() const +int PopupMenuWin::focusedIndex() const { return m_focusedIndex; } -void PopupMenu::focusFirst() +void PopupMenuWin::focusFirst() { if (!client()) return; @@ -424,7 +430,7 @@ void PopupMenu::focusFirst() } } -void PopupMenu::focusLast() +void PopupMenuWin::focusLast() { if (!client()) return; @@ -438,7 +444,7 @@ void PopupMenu::focusLast() } } -bool PopupMenu::down(unsigned lines) +bool PopupMenuWin::down(unsigned lines) { if (!client()) return false; @@ -457,7 +463,7 @@ bool PopupMenu::down(unsigned lines) return setFocusedIndex(lastSelectableIndex); } -bool PopupMenu::up(unsigned lines) +bool PopupMenuWin::up(unsigned lines) { if (!client()) return false; @@ -476,7 +482,7 @@ bool PopupMenu::up(unsigned lines) return setFocusedIndex(lastSelectableIndex); } -void PopupMenu::invalidateItem(int index) +void PopupMenuWin::invalidateItem(int index) { if (!m_popup) return; @@ -491,7 +497,7 @@ void PopupMenu::invalidateItem(int index) ::InvalidateRect(m_popup, &r, TRUE); } -IntRect PopupMenu::clientRect() const +IntRect PopupMenuWin::clientRect() const { IntRect clientRect = m_windowRect; clientRect.inflate(-popupWindowBorderWidth); @@ -499,12 +505,12 @@ IntRect PopupMenu::clientRect() const return clientRect; } -void PopupMenu::incrementWheelDelta(int delta) +void PopupMenuWin::incrementWheelDelta(int delta) { m_wheelDelta += delta; } -void PopupMenu::reduceWheelDelta(int delta) +void PopupMenuWin::reduceWheelDelta(int delta) { ASSERT(delta >= 0); ASSERT(delta <= abs(m_wheelDelta)); @@ -517,7 +523,7 @@ void PopupMenu::reduceWheelDelta(int delta) return; } -bool PopupMenu::scrollToRevealSelection() +bool PopupMenuWin::scrollToRevealSelection() { if (!m_scrollbar) return false; @@ -537,7 +543,7 @@ bool PopupMenu::scrollToRevealSelection() return false; } -void PopupMenu::updateFromElement() +void PopupMenuWin::updateFromElement() { if (!m_popup) return; @@ -549,14 +555,9 @@ void PopupMenu::updateFromElement() ::UpdateWindow(m_popup); } -bool PopupMenu::itemWritingDirectionIsNatural() -{ - return true; -} - const int separatorPadding = 4; const int separatorHeight = 1; -void PopupMenu::paint(const IntRect& damageRect, HDC hdc) +void PopupMenuWin::paint(const IntRect& damageRect, HDC hdc) { if (!m_popup) return; @@ -663,7 +664,7 @@ void PopupMenu::paint(const IntRect& damageRect, HDC hdc) ::ReleaseDC(m_popup, localDC); } -void PopupMenu::valueChanged(Scrollbar* scrollBar) +void PopupMenuWin::valueChanged(Scrollbar* scrollBar) { ASSERT(m_scrollbar); @@ -699,7 +700,7 @@ void PopupMenu::valueChanged(Scrollbar* scrollBar) ::UpdateWindow(m_popup); } -void PopupMenu::invalidateScrollbarRect(Scrollbar* scrollbar, const IntRect& rect) +void PopupMenuWin::invalidateScrollbarRect(Scrollbar* scrollbar, const IntRect& rect) { IntRect scrollRect = rect; scrollRect.move(scrollbar->x(), scrollbar->y()); @@ -707,7 +708,7 @@ void PopupMenu::invalidateScrollbarRect(Scrollbar* scrollbar, const IntRect& rec ::InvalidateRect(m_popup, &r, false); } -void PopupMenu::registerClass() +void PopupMenuWin::registerClass() { static bool haveRegisteredWindowClass = false; @@ -743,7 +744,7 @@ void PopupMenu::registerClass() } -LRESULT CALLBACK PopupMenu::PopupMenuWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) +LRESULT CALLBACK PopupMenuWin::PopupMenuWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { #if OS(WINCE) LONG longPtr = GetWindowLong(hWnd, 0); @@ -751,7 +752,7 @@ LRESULT CALLBACK PopupMenu::PopupMenuWndProc(HWND hWnd, UINT message, WPARAM wPa LONG_PTR longPtr = GetWindowLongPtr(hWnd, 0); #endif - if (PopupMenu* popup = reinterpret_cast<PopupMenu*>(longPtr)) + if (PopupMenuWin* popup = reinterpret_cast<PopupMenuWin*>(longPtr)) return popup->wndProc(hWnd, message, wParam, lParam); if (message == WM_CREATE) { @@ -771,7 +772,7 @@ LRESULT CALLBACK PopupMenu::PopupMenuWndProc(HWND hWnd, UINT message, WPARAM wPa const int smoothScrollAnimationDuration = 5000; -LRESULT PopupMenu::wndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) +LRESULT PopupMenuWin::wndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { LRESULT lResult = 0; diff --git a/WebCore/platform/win/PopupMenuWin.h b/WebCore/platform/win/PopupMenuWin.h new file mode 100644 index 0000000..d4a4255 --- /dev/null +++ b/WebCore/platform/win/PopupMenuWin.h @@ -0,0 +1,123 @@ +/* + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#ifndef PopupMenuWin_h +#define PopupMenuWin_h + +#include "IntRect.h" +#include "PopupMenu.h" +#include "PopupMenuClient.h" +#include "Scrollbar.h" +#include "ScrollbarClient.h" +#include <wtf/PassRefPtr.h> +#include <wtf/RefCounted.h> +#include <wtf/RefPtr.h> + +typedef struct HWND__* HWND; +typedef struct HDC__* HDC; +typedef struct HBITMAP__* HBITMAP; + +namespace WebCore { + +class FrameView; +class Scrollbar; + +class PopupMenuWin : public PopupMenu, private ScrollbarClient { +public: + PopupMenuWin(PopupMenuClient*); + ~PopupMenuWin(); + + virtual void show(const IntRect&, FrameView*, int index); + virtual void hide(); + virtual void updateFromElement(); + virtual void disconnectClient(); + + static LPCTSTR popupClassName(); + +private: + PopupMenuClient* client() const { return m_popupClient; } + + Scrollbar* scrollbar() const { return m_scrollbar.get(); } + + bool up(unsigned lines = 1); + bool down(unsigned lines = 1); + + int itemHeight() const { return m_itemHeight; } + const IntRect& windowRect() const { return m_windowRect; } + IntRect clientRect() const; + + int visibleItems() const; + + int listIndexAtPoint(const IntPoint&) const; + + bool setFocusedIndex(int index, bool hotTracking = false); + int focusedIndex() const; + void focusFirst(); + void focusLast(); + + void paint(const IntRect& damageRect, HDC = 0); + + HWND popupHandle() const { return m_popup; } + + 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(); + + void incrementWheelDelta(int delta); + void reduceWheelDelta(int delta); + int wheelDelta() const { return m_wheelDelta; } + + bool scrollbarCapturingMouse() const { return m_scrollbarCapturingMouse; } + void setScrollbarCapturingMouse(bool b) { m_scrollbarCapturingMouse = b; } + + // ScrollBarClient + virtual void valueChanged(Scrollbar*); + virtual void invalidateScrollbarRect(Scrollbar*, const IntRect&); + virtual bool isActive() const { return true; } + virtual bool scrollbarCornerPresent() const { return false; } + + void calculatePositionAndSize(const IntRect&, FrameView*); + void invalidateItem(int index); + + static LRESULT CALLBACK PopupMenuWndProc(HWND, UINT, WPARAM, LPARAM); + LRESULT wndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); + static void registerClass(); + + PopupMenuClient* m_popupClient; + RefPtr<Scrollbar> m_scrollbar; + HWND m_popup; + HDC m_DC; + HBITMAP m_bmp; + bool m_wasClicked; + IntRect m_windowRect; + int m_itemHeight; + int m_scrollOffset; + int m_wheelDelta; + int m_focusedIndex; + bool m_scrollbarCapturingMouse; + bool m_showPopup; +}; + +} + +#endif // PopupMenuWin_h diff --git a/WebCore/platform/win/SearchPopupMenuWin.cpp b/WebCore/platform/win/SearchPopupMenuWin.cpp index f2709bb..e1bbe68 100644 --- a/WebCore/platform/win/SearchPopupMenuWin.cpp +++ b/WebCore/platform/win/SearchPopupMenuWin.cpp @@ -1,5 +1,6 @@ /* * Copyright (C) 2006, 2007 Apple Inc. + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -18,19 +19,24 @@ */ #include "config.h" -#include "SearchPopupMenu.h" +#include "SearchPopupMenuWin.h" #include "AtomicString.h" #include <wtf/RetainPtr.h> namespace WebCore { -SearchPopupMenu::SearchPopupMenu(PopupMenuClient* client) - : PopupMenu(client) +SearchPopupMenuWin::SearchPopupMenuWin(PopupMenuClient* client) + : m_popup(adoptRef(new PopupMenuWin(client))) { } -bool SearchPopupMenu::enabled() +PopupMenu* SearchPopupMenuWin::popupMenu() +{ + return m_popup.get(); +} + +bool SearchPopupMenuWin::enabled() { return true; } @@ -41,7 +47,7 @@ static RetainPtr<CFStringRef> autosaveKey(const String& name) return RetainPtr<CFStringRef>(AdoptCF, key.createCFString()); } -void SearchPopupMenu::saveRecentSearches(const AtomicString& name, const Vector<String>& searchItems) +void SearchPopupMenuWin::saveRecentSearches(const AtomicString& name, const Vector<String>& searchItems) { if (name.isEmpty()) return; @@ -61,7 +67,7 @@ void SearchPopupMenu::saveRecentSearches(const AtomicString& name, const Vector< CFPreferencesAppSynchronize(kCFPreferencesCurrentApplication); } -void SearchPopupMenu::loadRecentSearches(const AtomicString& name, Vector<String>& searchItems) +void SearchPopupMenuWin::loadRecentSearches(const AtomicString& name, Vector<String>& searchItems) { if (name.isEmpty()) return; diff --git a/WebCore/platform/win/SearchPopupMenuWin.h b/WebCore/platform/win/SearchPopupMenuWin.h new file mode 100644 index 0000000..299a133 --- /dev/null +++ b/WebCore/platform/win/SearchPopupMenuWin.h @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ + +#ifndef SearchPopupMenuWin_h +#define SearchPopupMenuWin_h + +#include "PopupMenuWin.h" +#include "SearchPopupMenu.h" + +namespace WebCore { + +class SearchPopupMenuWin : public SearchPopupMenu { +public: + SearchPopupMenuWin(PopupMenuClient*); + + virtual PopupMenu* popupMenu(); + virtual void saveRecentSearches(const AtomicString& name, const Vector<String>& searchItems); + virtual void loadRecentSearches(const AtomicString& name, Vector<String>& searchItems); + virtual bool enabled(); + +private: + RefPtr<PopupMenuWin> m_popup; +}; + +} + +#endif // SearchPopupMenuWin_h diff --git a/WebCore/platform/wx/PopupMenuWx.cpp b/WebCore/platform/wx/PopupMenuWx.cpp index 9b0deba..e88d1e5 100644 --- a/WebCore/platform/wx/PopupMenuWx.cpp +++ b/WebCore/platform/wx/PopupMenuWx.cpp @@ -2,6 +2,7 @@ * This file is part of the popup menu implementation for <select> elements in WebCore. * * Copyright (C) 2008 Apple Computer, Inc. + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -21,7 +22,7 @@ */ #include "config.h" -#include "PopupMenu.h" +#include "PopupMenuWx.h" #include "Frame.h" #include "FrameView.h" @@ -41,18 +42,23 @@ static int s_menuStartId = wxNewId(); namespace WebCore { -PopupMenu::PopupMenu(PopupMenuClient* client) +PopupMenuWx::PopupMenuWx(PopupMenuClient* client) : m_popupClient(client) , m_menu(NULL) { } -PopupMenu::~PopupMenu() +PopupMenuWx::~PopupMenuWx() { delete m_menu; } -void PopupMenu::show(const IntRect& r, FrameView* v, int index) +void PopupMenuWx::disconnectClient() +{ + m_popupClient = 0; +} + +void PopupMenuWx::show(const IntRect& r, FrameView* v, int index) { // just delete and recreate delete m_menu; @@ -78,13 +84,13 @@ void PopupMenu::show(const IntRect& r, FrameView* v, int index) m_menu->Append(s_menuStartId + i, client()->itemText(i)); } } - nativeWin->Connect(s_menuStartId, s_menuStartId + (size-1), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(PopupMenu::OnMenuItemSelected), NULL, this); + nativeWin->Connect(s_menuStartId, s_menuStartId + (size-1), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(PopupMenuWx::OnMenuItemSelected), 0, this); nativeWin->PopupMenu(m_menu, r.x() - v->scrollX(), r.y() - v->scrollY()); - nativeWin->Disconnect(s_menuStartId, s_menuStartId + (size-1), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(PopupMenu::OnMenuItemSelected), NULL, this); + nativeWin->Disconnect(s_menuStartId, s_menuStartId + (size-1), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(PopupMenuWx::OnMenuItemSelected), 0, this); } } -void PopupMenu::OnMenuItemSelected(wxCommandEvent& event) +void PopupMenuWx::OnMenuItemSelected(wxCommandEvent& event) { if (client()) { client()->valueChanged(event.GetId() - s_menuStartId); @@ -93,20 +99,15 @@ void PopupMenu::OnMenuItemSelected(wxCommandEvent& event) // TODO: Do we need to call Disconnect here? Do we have a ref to the native window still? } -void PopupMenu::hide() +void PopupMenuWx::hide() { // we don't need to do anything here, the native control only exists during the time // show is called } -void PopupMenu::updateFromElement() +void PopupMenuWx::updateFromElement() { client()->setTextFromItem(m_popupClient->selectedIndex()); } -bool PopupMenu::itemWritingDirectionIsNatural() -{ - return false; -} - } diff --git a/WebCore/platform/wx/PopupMenuWx.h b/WebCore/platform/wx/PopupMenuWx.h new file mode 100644 index 0000000..c2573fc --- /dev/null +++ b/WebCore/platform/wx/PopupMenuWx.h @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ + +#ifndef PopupMenuWx_h +#define PopupMenuWx_h + +#include "IntRect.h" +#include "PopupMenu.h" +#include "PopupMenuClient.h" +#include <wtf/PassRefPtr.h> +#include <wtf/RefCounted.h> + +#ifdef __WXMSW__ +#include <wx/msw/winundef.h> +#endif +class wxMenu; +#include <wx/defs.h> +#include <wx/event.h> + +namespace WebCore { + +class FrameView; +class Scrollbar; + +class PopupMenuWx : public PopupMenu, public wxEvtHandler { +public: + PopupMenuWx(PopupMenuClient*); + ~PopupMenuWx(); + + virtual void show(const IntRect&, FrameView*, int index); + virtual void hide(); + virtual void updateFromElement(); + virtual void disconnectClient(); + +private: + void OnMenuItemSelected(wxCommandEvent&); + PopupMenuClient* client() const { return m_popupClient; } + + PopupMenuClient* m_popupClient; + wxMenu* m_menu; +}; + +} + +#endif // PopupMenuWx_h diff --git a/WebCore/platform/wx/SearchPopupMenuWx.cpp b/WebCore/platform/wx/SearchPopupMenuWx.cpp index dbbe339..b724cf1 100644 --- a/WebCore/platform/wx/SearchPopupMenuWx.cpp +++ b/WebCore/platform/wx/SearchPopupMenuWx.cpp @@ -1,5 +1,6 @@ /* * Copyright (C) 2009 Apple Inc. All Rights Reserved. + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -24,32 +25,37 @@ */ #include "config.h" -#include "SearchPopupMenu.h" +#include "SearchPopupMenuWx.h" #include "NotImplemented.h" namespace WebCore { -SearchPopupMenu::SearchPopupMenu(PopupMenuClient* client) - : PopupMenu(client) +SearchPopupMenuWx::SearchPopupMenuWx(PopupMenuClient* client) + : m_popup(adoptRef(new PopupMenuWx(client))) { notImplemented(); } -void SearchPopupMenu::saveRecentSearches(const AtomicString& name, const Vector<String>& searchItems) +void SearchPopupMenuWx::saveRecentSearches(const AtomicString& name, const Vector<String>& searchItems) { notImplemented(); } -void SearchPopupMenu::loadRecentSearches(const AtomicString& name, Vector<String>& searchItems) +void SearchPopupMenuWx::loadRecentSearches(const AtomicString& name, Vector<String>& searchItems) { notImplemented(); } -bool SearchPopupMenu::enabled() +bool SearchPopupMenuWx::enabled() { return true; } +PopupMenu* SearchPopupMenuWx::popupMenu() +{ + return m_popup.get(); +} + } diff --git a/WebCore/platform/wx/SearchPopupMenuWx.h b/WebCore/platform/wx/SearchPopupMenuWx.h new file mode 100644 index 0000000..552a8fe --- /dev/null +++ b/WebCore/platform/wx/SearchPopupMenuWx.h @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ + +#ifndef SearchPopupMenuWx_h +#define SearchPopupMenuWx_h + +#include "PopupMenuWx.h" +#include "SearchPopupMenu.h" + +namespace WebCore { + +class SearchPopupMenuWx : public SearchPopupMenu { +public: + SearchPopupMenuWx(PopupMenuClient*); + + virtual PopupMenu* popupMenu(); + virtual void saveRecentSearches(const AtomicString& name, const Vector<String>& searchItems); + virtual void loadRecentSearches(const AtomicString& name, Vector<String>& searchItems); + virtual bool enabled(); + +private: + RefPtr<PopupMenuWx> m_popup; +}; + +} + +#endif // SearchPopupMenuWx_h diff --git a/WebCore/plugins/PluginViewBase.h b/WebCore/plugins/PluginViewBase.h index 3c43c00..4e5fe1a 100644 --- a/WebCore/plugins/PluginViewBase.h +++ b/WebCore/plugins/PluginViewBase.h @@ -44,7 +44,7 @@ public: virtual PlatformLayer* platformLayer() const { return 0; } #endif - virtual JSC::JSObject* scriptObject(JSC::ExecState*, JSC::JSGlobalObject*) { return 0; } + virtual JSC::JSObject* scriptObject(JSC::JSGlobalObject*) { return 0; } protected: PluginViewBase(PlatformWidget widget) : Widget(widget) { } diff --git a/WebCore/rendering/EllipsisBox.cpp b/WebCore/rendering/EllipsisBox.cpp index 96efbe2..951df9f 100644 --- a/WebCore/rendering/EllipsisBox.cpp +++ b/WebCore/rendering/EllipsisBox.cpp @@ -113,6 +113,7 @@ bool EllipsisBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& resu } } +<<<<<<< HEAD #ifdef ANDROID_HITTEST_WITHSIZE IntRect boundsRect = IntRect(tx, ty, m_width, m_height); if (visibleToHitTesting() && result.intersects(x, y, boundsRect)) { @@ -129,6 +130,13 @@ bool EllipsisBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& resu } #endif return true; +======= + IntRect boundsRect = IntRect(tx, ty, m_width, m_height); + if (visibleToHitTesting() && boundsRect.intersects(result.rectFromPoint(x, y))) { + renderer()->updateHitTestResult(result, IntPoint(x - tx, y - ty)); + if (!result.addNodeToRectBasedTestResult(renderer()->node(), x, y, boundsRect)) + return true; +>>>>>>> webkit.org at r64523 } return false; diff --git a/WebCore/rendering/HitTestResult.cpp b/WebCore/rendering/HitTestResult.cpp index 8a4ef3c..e1dfecb 100644 --- a/WebCore/rendering/HitTestResult.cpp +++ b/WebCore/rendering/HitTestResult.cpp @@ -49,9 +49,11 @@ using namespace HTMLNames; HitTestResult::HitTestResult(const IntPoint& point) : m_point(point) , m_isOverWidget(false) + , m_isRectBased(false) { } +<<<<<<< HEAD #ifdef ANDROID_HITTEST_WITHSIZE HitTestResult::HitTestResult(const IntPoint& point, const IntSize& padding) : m_point(point) @@ -60,6 +62,17 @@ HitTestResult::HitTestResult(const IntPoint& point, const IntSize& padding) { } #endif +======= +HitTestResult::HitTestResult(const IntPoint& centerPoint, const IntSize& padding) + : m_point(centerPoint) + , m_isOverWidget(false) +{ + // If a zero padding is passed in or either width or height is negative, then it + // is not a valid padding and hence not a rect based hit test. + m_isRectBased = !(padding.isZero() || (padding.width() < 0 || padding.height() < 0)); + m_padding = m_isRectBased ? padding : IntSize(); +} +>>>>>>> webkit.org at r64523 HitTestResult::HitTestResult(const HitTestResult& other) : m_innerNode(other.innerNode()) @@ -74,6 +87,12 @@ HitTestResult::HitTestResult(const HitTestResult& other) , m_rawNodeList(other.rawNodeList()) #endif { + // Only copy the padding and ListHashSet in case of rect hit test. + // Copying the later is rather expensive. + if ((m_isRectBased = other.isRectBasedTest())) { + m_padding = other.padding(); + m_rectBasedTestResult = other.rectBasedTestResult(); + } } HitTestResult::~HitTestResult() @@ -89,10 +108,19 @@ HitTestResult& HitTestResult::operator=(const HitTestResult& other) m_innerURLElement = other.URLElement(); m_scrollbar = other.scrollbar(); m_isOverWidget = other.isOverWidget(); +<<<<<<< HEAD #ifdef ANDROID_HITTEST_WITHSIZE m_pointPadding = other.pointPadding(); m_rawNodeList = other.rawNodeList(); #endif +======= + // Only copy the padding and ListHashSet in case of rect hit test. + // Copying the later is rather expensive. + if ((m_isRectBased = other.isRectBasedTest())) { + m_padding = other.padding(); + m_rectBasedTestResult = other.rectBasedTestResult(); + } +>>>>>>> webkit.org at r64523 return *this; } @@ -379,6 +407,7 @@ bool HitTestResult::isContentEditable() const return m_innerNonSharedNode->isContentEditable(); } +<<<<<<< HEAD #ifdef ANDROID_HITTEST_WITHSIZE bool HitTestResult::intersects(int x, int y, const IntRect& other) const @@ -395,6 +424,29 @@ bool HitTestResult::containedBy(int x, int y, const IntRect& other) const void HitTestResult::merge(const HitTestResult& other) { +======= +bool HitTestResult::addNodeToRectBasedTestResult(Node* node, int x, int y, const IntRect& rect) +{ + // If it is not a rect-based hit test, this method has to be no-op. + // Return false, so the hit test stops. + if (!isRectBasedTest()) + return false; + + // If node is null, return true so the hit test can continue. + if (!node) + return true; + + node = node->shadowAncestorNode(); + m_rectBasedTestResult.add(node); + + return !rect.contains(rectFromPoint(x, y)); +} + +void HitTestResult::append(const HitTestResult& other) +{ + ASSERT(isRectBasedTest() && other.isRectBasedTest()); + +>>>>>>> webkit.org at r64523 if (!m_innerNode && other.innerNode()) { m_innerNode = other.innerNode(); m_innerNonSharedNode = other.innerNonSharedNode(); @@ -404,6 +456,7 @@ void HitTestResult::merge(const HitTestResult& other) m_isOverWidget = other.isOverWidget(); } +<<<<<<< HEAD const Vector<RefPtr<Node> >& list = other.rawNodeList(); Vector<RefPtr<Node> >::const_iterator last = list.end(); for (Vector<RefPtr<Node> >::const_iterator it = list.begin(); it != last; ++it) @@ -425,4 +478,12 @@ void HitTestResult::addRawNode(Node* node) #endif // ANDROID_HITTEST_WITHSIZE +======= + const ListHashSet<RefPtr<Node> >& list = other.rectBasedTestResult(); + ListHashSet<RefPtr<Node> >::const_iterator last = list.end(); + for (ListHashSet<RefPtr<Node> >::const_iterator it = list.begin(); it != last; ++it) + m_rectBasedTestResult.add(it->get()); +} + +>>>>>>> webkit.org at r64523 } // namespace WebCore diff --git a/WebCore/rendering/HitTestResult.h b/WebCore/rendering/HitTestResult.h index 0f45900..6d39e8d 100644 --- a/WebCore/rendering/HitTestResult.h +++ b/WebCore/rendering/HitTestResult.h @@ -21,11 +21,17 @@ #define HitTestResult_h #include "IntPoint.h" +#include "IntRect.h" +#include "IntSize.h" #include "TextDirection.h" +<<<<<<< HEAD #ifdef ANDROID_HITTEST_WITHSIZE #include <IntSize.h> #include <wtf/Vector.h> #endif +======= +#include <wtf/ListHashSet.h> +>>>>>>> webkit.org at r64523 #include <wtf/RefPtr.h> namespace WebCore { @@ -42,6 +48,8 @@ class String; class HitTestResult { public: HitTestResult(const IntPoint&); + // Pass a non-negative IntSize value as padding to perform a rect-based hit test. + HitTestResult(const IntPoint& centerPoint, const IntSize& padding); HitTestResult(const HitTestResult&); ~HitTestResult(); HitTestResult& operator=(const HitTestResult&); @@ -80,6 +88,7 @@ public: bool isLiveLink() const; bool isContentEditable() const; +<<<<<<< HEAD #ifdef ANDROID_HITTEST_WITHSIZE HitTestResult(const IntPoint&, const IntSize&); @@ -92,8 +101,23 @@ public: void addRawNode(Node*); const Vector<RefPtr<Node> >& rawNodeList() const { return m_rawNodeList; } #endif +======= + // Rect-based hit test related methods. + bool isRectBasedTest() const { return m_isRectBased; } + IntRect rectFromPoint(int x, int y) const; + IntRect rectFromPoint(const IntPoint&) const; + IntSize padding() const { return m_padding; } + int paddingWidth() const { return m_padding.width() >= 0 ? m_padding.width() : 0; } + int paddingHeight() const { return m_padding.height() >= 0 ? m_padding.height() : 0; } + // Returns true if it is rect-based hit test and needs to continue until the rect is fully + // enclosed by the boundaries of a node. + bool addNodeToRectBasedTestResult(Node*, int x, int y, const IntRect& rect = IntRect()); + const ListHashSet<RefPtr<Node> >& rectBasedTestResult() const { return m_rectBasedTestResult; } + void append(const HitTestResult&); +>>>>>>> webkit.org at r64523 private: + RefPtr<Node> m_innerNode; RefPtr<Node> m_innerNonSharedNode; IntPoint m_point; @@ -102,13 +126,45 @@ private: RefPtr<Element> m_innerURLElement; RefPtr<Scrollbar> m_scrollbar; bool m_isOverWidget; // Returns true if we are over a widget (and not in the border/padding area of a RenderWidget for example). +<<<<<<< HEAD #ifdef ANDROID_HITTEST_WITHSIZE IntSize m_pointPadding; Vector<RefPtr<Node> > m_rawNodeList; #endif +======= + bool m_isRectBased; + IntSize m_padding; + ListHashSet<RefPtr<Node> > m_rectBasedTestResult; +>>>>>>> webkit.org at r64523 }; +inline IntRect HitTestResult::rectFromPoint(int x, int y) const +{ + return rectFromPoint(IntPoint(x, y)); +} + +// Formula: +// x = p.x() - padding.width() +// y = p.y() - padding.height() +// width = 2 * padding.width() + 1 +// height = 2 * m_padding.height() + 1 +inline IntRect HitTestResult::rectFromPoint(const IntPoint& point) const +{ + IntPoint realPoint(point); + IntSize realPadding(m_padding); + + // Real IntPoint for the rect. + realPadding.clampNegativeToZero(); + realPoint -= realPadding; + + // Real IntSize for the rect. + realPadding.scale(2); + realPadding += IntSize(1, 1); + + return IntRect(realPoint, realPadding); +} + String displayString(const String&, const Node*); } // namespace WebCore diff --git a/WebCore/rendering/InlineFlowBox.cpp b/WebCore/rendering/InlineFlowBox.cpp index 8ac8c40..daa48f2 100644 --- a/WebCore/rendering/InlineFlowBox.cpp +++ b/WebCore/rendering/InlineFlowBox.cpp @@ -611,11 +611,15 @@ bool InlineFlowBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& re { IntRect overflowRect(visibleOverflowRect()); overflowRect.move(tx, ty); +<<<<<<< HEAD #ifdef ANDROID_HITTEST_WITHSIZE if (!result.intersects(x, y, overflowRect)) #else if (!overflowRect.contains(x, y)) #endif +======= + if (!overflowRect.intersects(result.rectFromPoint(x, y))) +>>>>>>> webkit.org at r64523 return false; // Check children first. @@ -628,6 +632,7 @@ bool InlineFlowBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& re // Now check ourselves. IntRect rect(tx + m_x, ty + m_y, m_width, height()); +<<<<<<< HEAD #ifdef ANDROID_HITTEST_WITHSIZE if (visibleToHitTesting() && result.intersects(x, y, rect)) { #else @@ -643,6 +648,12 @@ bool InlineFlowBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& re } #endif return true; +======= + if (visibleToHitTesting() && rect.intersects(result.rectFromPoint(x, y))) { + renderer()->updateHitTestResult(result, IntPoint(x - tx, y - ty)); // Don't add in m_x or m_y here, we want coords in the containing block's space. + if (!result.addNodeToRectBasedTestResult(renderer()->node(), x, y, rect)) + return true; +>>>>>>> webkit.org at r64523 } return false; diff --git a/WebCore/rendering/InlineTextBox.cpp b/WebCore/rendering/InlineTextBox.cpp index d6bd70c..b0e2887 100644 --- a/WebCore/rendering/InlineTextBox.cpp +++ b/WebCore/rendering/InlineTextBox.cpp @@ -287,6 +287,7 @@ bool InlineTextBox::nodeAtPoint(const HitTestRequest&, HitTestResult& result, in return false; IntRect rect(tx + m_x, ty + m_y, m_width, height()); +<<<<<<< HEAD #ifdef ANDROID_HITTEST_WITHSIZE if (m_truncation != cFullTruncation && visibleToHitTesting() && result.intersects(x, y, rect)) { #else @@ -302,6 +303,12 @@ bool InlineTextBox::nodeAtPoint(const HitTestRequest&, HitTestResult& result, in } #endif return true; +======= + if (m_truncation != cFullTruncation && visibleToHitTesting() && rect.intersects(result.rectFromPoint(x, y))) { + renderer()->updateHitTestResult(result, IntPoint(x - tx, y - ty)); + if (!result.addNodeToRectBasedTestResult(renderer()->node(), x, y, rect)) + return true; +>>>>>>> webkit.org at r64523 } return false; } diff --git a/WebCore/rendering/RenderBlock.cpp b/WebCore/rendering/RenderBlock.cpp index 1b855d4..3f369c3 100644 --- a/WebCore/rendering/RenderBlock.cpp +++ b/WebCore/rendering/RenderBlock.cpp @@ -3767,16 +3767,21 @@ bool RenderBlock::nodeAtPoint(const HitTestRequest& request, HitTestResult& resu // Check if we need to do anything at all. IntRect overflowBox = visibleOverflowRect(); overflowBox.move(tx, ty); +<<<<<<< HEAD #ifdef ANDROID_HITTEST_WITHSIZE if (!result.intersects(_x, _y, overflowBox)) #else if (!overflowBox.contains(_x, _y)) #endif +======= + if (!overflowBox.intersects(result.rectFromPoint(_x, _y))) +>>>>>>> webkit.org at r64523 return false; } if ((hitTestAction == HitTestBlockBackground || hitTestAction == HitTestChildBlockBackground) && isPointInOverflowControl(result, _x, _y, tx, ty)) { updateHitTestResult(result, IntPoint(_x - tx, _y - ty)); +<<<<<<< HEAD #ifdef ANDROID_HITTEST_WITHSIZE // TODO: isPointInOverflowControl() doesn't handle region test yet. if (result.isRegionTest()) { @@ -3785,16 +3790,26 @@ bool RenderBlock::nodeAtPoint(const HitTestRequest& request, HitTestResult& resu } else #endif return true; +======= + // FIXME: isPointInOverflowControl() doesn't handle rect-based tests yet. + if (!result.addNodeToRectBasedTestResult(node(), _x, _y)) + return true; +>>>>>>> webkit.org at r64523 } // If we have clipping, then we can't have any spillout. bool useOverflowClip = hasOverflowClip() && !hasSelfPaintingLayer(); bool useClip = (hasControlClip() || useOverflowClip); +<<<<<<< HEAD #ifdef ANDROID_HITTEST_WITHSIZE bool checkChildren = !useClip || (hasControlClip() ? result.intersects(_x, _y, controlClipRect(tx, ty)) : result.intersects(_x, _y, overflowClipRect(tx, ty))); #else bool checkChildren = !useClip || (hasControlClip() ? controlClipRect(tx, ty).contains(_x, _y) : overflowClipRect(tx, ty).contains(_x, _y)); #endif +======= + IntRect hitTestArea(result.rectFromPoint(_x, _y)); + bool checkChildren = !useClip || (hasControlClip() ? controlClipRect(tx, ty).intersects(hitTestArea) : overflowClipRect(tx, ty).intersects(hitTestArea)); +>>>>>>> webkit.org at r64523 if (checkChildren) { // Hit test descendants first. int scrolledX = tx; @@ -3842,6 +3857,7 @@ bool RenderBlock::nodeAtPoint(const HitTestRequest& request, HitTestResult& resu // Now hit test our background if (hitTestAction == HitTestBlockBackground || hitTestAction == HitTestChildBlockBackground) { IntRect boundsRect(tx, ty, width(), height()); +<<<<<<< HEAD #ifdef ANDROID_HITTEST_WITHSIZE if (visibleToHitTesting() && result.intersects(_x, _y, boundsRect)) { #else @@ -3857,6 +3873,12 @@ bool RenderBlock::nodeAtPoint(const HitTestRequest& request, HitTestResult& resu } #endif return true; +======= + if (visibleToHitTesting() && boundsRect.intersects(result.rectFromPoint(_x, _y))) { + updateHitTestResult(result, IntPoint(_x - tx, _y - ty)); + if (!result.addNodeToRectBasedTestResult(node(), _x, _y, boundsRect)) + return true; +>>>>>>> webkit.org at r64523 } } @@ -3881,22 +3903,33 @@ bool RenderBlock::hitTestColumns(const HitTestRequest& request, HitTestResult& r currYOffset += colRect.height(); colRect.move(tx, ty); +<<<<<<< HEAD #ifdef ANDROID_HITTEST_WITHSIZE if (result.intersects(x, y, colRect)) { #else if (colRect.contains(x, y)) { #endif +======= + if (colRect.intersects(result.rectFromPoint(x, y))) { +>>>>>>> webkit.org at r64523 // The point is inside this column. // Adjust tx and ty to change where we hit test. int finalX = tx + currXOffset; int finalY = ty + currYOffset; +<<<<<<< HEAD #ifdef ANDROID_HITTEST_WITHSIZE if (result.isRegionTest() && !result.containedBy(x, y, colRect)) hitTestContents(request, result, x, y, finalX, finalY, hitTestAction); else #endif return hitTestContents(request, result, x, y, finalX, finalY, hitTestAction); +======= + if (result.isRectBasedTest() && !colRect.contains(result.rectFromPoint(x, y))) + hitTestContents(request, result, x, y, finalX, finalY, hitTestAction); + else + return hitTestContents(request, result, x, y, finalX, finalY, hitTestAction); +>>>>>>> webkit.org at r64523 } } diff --git a/WebCore/rendering/RenderBox.cpp b/WebCore/rendering/RenderBox.cpp index 2deeffc..b546893 100644 --- a/WebCore/rendering/RenderBox.cpp +++ b/WebCore/rendering/RenderBox.cpp @@ -31,6 +31,7 @@ #include "Document.h" #include "FrameView.h" #include "GraphicsContext.h" +#include "HitTestResult.h" #include "htmlediting.h" #include "HTMLElement.h" #include "HTMLNames.h" @@ -568,6 +569,7 @@ bool RenderBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& result #else // Check our bounds next. For this purpose always assume that we can only be hit in the // foreground phase (which is true for replaced elements like images). +<<<<<<< HEAD if (visibleToHitTesting() && action == HitTestForeground && IntRect(tx, ty, width(), height()).contains(xPos, yPos)) { #endif updateHitTestResult(result, IntPoint(xPos - tx, yPos - ty)); @@ -580,6 +582,13 @@ bool RenderBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& result } #endif return true; +======= + IntRect boundsRect = IntRect(tx, ty, width(), height()); + if (visibleToHitTesting() && action == HitTestForeground && boundsRect.intersects(result.rectFromPoint(xPos, yPos))) { + updateHitTestResult(result, IntPoint(xPos - tx, yPos - ty)); + if (!result.addNodeToRectBasedTestResult(node(), xPos, yPos, boundsRect)) + return true; +>>>>>>> webkit.org at r64523 } return false; @@ -1595,7 +1604,7 @@ void RenderBox::calcHeight() && (isRoot() || (isBody() && document()->documentElement()->renderer()->style()->height().isPercent())); if (stretchesToViewHeight() || printingNeedsBaseHeight) { int margins = collapsedMarginTop() + collapsedMarginBottom(); - int visHeight = document()->printing() ? view()->frameView()->visibleHeight() : view()->viewHeight(); + int visHeight = document()->printing() ? view()->frameView()->pageHeight() : view()->viewHeight(); if (isRoot()) setHeight(max(height(), visHeight - margins)); else { diff --git a/WebCore/rendering/RenderForeignObject.cpp b/WebCore/rendering/RenderForeignObject.cpp index 8b84f97..50c1a42 100644 --- a/WebCore/rendering/RenderForeignObject.cpp +++ b/WebCore/rendering/RenderForeignObject.cpp @@ -117,14 +117,16 @@ void RenderForeignObject::layout() // FIXME: Investigate in location rounding issues - only affects RenderForeignObject & RenderSVGText setLocation(roundedIntPoint(viewportLocation)); + + bool layoutChanged = m_everHadLayout && selfNeedsLayout(); RenderBlock::layout(); + ASSERT(!needsLayout()); - // Invalidate all resources of this client, if we changed something. - if (m_everHadLayout && selfNeedsLayout()) - RenderSVGResource::invalidateAllResourcesOfRenderer(this); + // Invalidate all resources of this client if our layout changed. + if (layoutChanged) + SVGResourcesCache::clientLayoutChanged(this); repainter.repaintAfterLayout(); - setNeedsLayout(false); } bool RenderForeignObject::nodeAtFloatPoint(const HitTestRequest& request, HitTestResult& result, const FloatPoint& pointInParent, HitTestAction hitTestAction) diff --git a/WebCore/rendering/RenderHTMLCanvas.cpp b/WebCore/rendering/RenderHTMLCanvas.cpp index 8c17a0e..c89495b 100644 --- a/WebCore/rendering/RenderHTMLCanvas.cpp +++ b/WebCore/rendering/RenderHTMLCanvas.cpp @@ -26,6 +26,7 @@ #include "config.h" #include "RenderHTMLCanvas.h" +#include "CanvasRenderingContext.h" #include "Document.h" #include "GraphicsContext.h" #include "HTMLCanvasElement.h" @@ -48,12 +49,8 @@ bool RenderHTMLCanvas::requiresLayer() const if (RenderReplaced::requiresLayer()) return true; -#if ENABLE(3D_CANVAS) HTMLCanvasElement* canvas = static_cast<HTMLCanvasElement*>(node()); - return canvas && canvas->is3D(); -#else - return false; -#endif + return canvas && canvas->renderingContext() && canvas->renderingContext()->isAccelerated(); } void RenderHTMLCanvas::paintReplaced(PaintInfo& paintInfo, int tx, int ty) diff --git a/WebCore/rendering/RenderImage.cpp b/WebCore/rendering/RenderImage.cpp index 643fac9..3612ed5 100644 --- a/WebCore/rendering/RenderImage.cpp +++ b/WebCore/rendering/RenderImage.cpp @@ -387,6 +387,7 @@ HTMLMapElement* RenderImage::imageMap() const bool RenderImage::nodeAtPoint(const HitTestRequest& request, HitTestResult& result, int x, int y, int tx, int ty, HitTestAction hitTestAction) { +<<<<<<< HEAD #ifdef ANDROID_HITTEST_WITHSIZE HitTestResult tempResult(result.point(), result.pointPadding()); #else @@ -399,6 +400,12 @@ bool RenderImage::nodeAtPoint(const HitTestRequest& request, HitTestResult& resu #else if (inside && node()) { #endif +======= + HitTestResult tempResult(result.point(), result.padding()); + bool inside = RenderReplaced::nodeAtPoint(request, tempResult, x, y, tx, ty, hitTestAction); + + if (tempResult.innerNode() && node()) { +>>>>>>> webkit.org at r64523 if (HTMLMapElement* map = imageMap()) { IntRect contentBox = contentBoxRect(); float zoom = style()->effectiveZoom(); @@ -409,10 +416,15 @@ bool RenderImage::nodeAtPoint(const HitTestRequest& request, HitTestResult& resu } } +<<<<<<< HEAD #ifdef ANDROID_HITTEST_WITHSIZE if (!inside && result.isRegionTest()) result.merge(tempResult); #endif +======= + if (!inside && result.isRectBasedTest()) + result.append(tempResult); +>>>>>>> webkit.org at r64523 if (inside) result = tempResult; return inside; diff --git a/WebCore/rendering/RenderLayer.cpp b/WebCore/rendering/RenderLayer.cpp index 756a9b3..998ffa7 100644 --- a/WebCore/rendering/RenderLayer.cpp +++ b/WebCore/rendering/RenderLayer.cpp @@ -1800,6 +1800,9 @@ void RenderLayer::destroyScrollbar(ScrollbarOrientation orientation) { RefPtr<Scrollbar>& scrollbar = orientation == HorizontalScrollbar ? m_hBar : m_vBar; if (scrollbar) { + if (scrollbar->isCustomScrollbar()) + static_cast<RenderScrollbar*>(scrollbar.get())->clearOwningRenderer(); + scrollbar->removeFromParent(); scrollbar->setClient(0); scrollbar = 0; @@ -2749,18 +2752,24 @@ RenderLayer* RenderLayer::hitTestLayer(RenderLayer* rootLayer, RenderLayer* cont #if USE(ACCELERATED_COMPOSITING) useTemporaryClipRects = compositor()->inCompositingMode(); #endif - + + IntRect hitTestArea = result.rectFromPoint(hitTestPoint); + // Apply a transform if we have one. if (transform() && !appliedTransform) { // Make sure the parent's clip rects have been calculated. if (parent()) { IntRect clipRect = backgroundClipRect(rootLayer, useTemporaryClipRects); // Go ahead and test the enclosing clip now. +<<<<<<< HEAD #ifdef ANDROID_HITTEST_WITHSIZE if (!result.intersects(hitTestPoint.x(), hitTestPoint.y(), clipRect)) #else if (!clipRect.contains(hitTestPoint)) #endif +======= + if (!clipRect.intersects(hitTestArea)) +>>>>>>> webkit.org at r64523 return 0; } @@ -2873,6 +2882,7 @@ RenderLayer* RenderLayer::hitTestLayer(RenderLayer* rootLayer, RenderLayer* cont } // Next we want to see if the mouse pos is inside the child RenderObjects of the layer. +<<<<<<< HEAD #ifdef ANDROID_HITTEST_WITHSIZE if (result.intersects(hitTestPoint.x(), hitTestPoint.y(), fgRect) && isSelfPaintingLayer()) { #else @@ -2892,15 +2902,31 @@ RenderLayer* RenderLayer::hitTestLayer(RenderLayer* rootLayer, RenderLayer* cont else #endif result = tempResult; +======= + if (fgRect.intersects(hitTestArea) && isSelfPaintingLayer()) { + // Hit test with a temporary HitTestResult, because we only want to commit to 'result' if we know we're frontmost. + HitTestResult tempResult(result.point(), result.padding()); + if (hitTestContents(request, tempResult, layerBounds, hitTestPoint, HitTestDescendants) && + isHitCandidate(this, false, zOffsetForContentsPtr, unflattenedTransformState.get())) { + if (result.isRectBasedTest()) + result.append(tempResult); + else + result = tempResult; +>>>>>>> webkit.org at r64523 if (!depthSortDescendants) return this; // Foreground can depth-sort with descendant layers, so keep this as a candidate. candidateLayer = this; +<<<<<<< HEAD } #ifdef ANDROID_HITTEST_WITHSIZE else if (result.isRegionTest()) result.merge(tempResult); #endif +======= + } else if (result.isRectBasedTest()) + result.append(tempResult); +>>>>>>> webkit.org at r64523 } // Now check our negative z-index children. @@ -2916,6 +2942,7 @@ RenderLayer* RenderLayer::hitTestLayer(RenderLayer* rootLayer, RenderLayer* cont if (candidateLayer) return candidateLayer; +<<<<<<< HEAD #ifdef ANDROID_HITTEST_WITHSIZE if (result.intersects(hitTestPoint.x(), hitTestPoint.y(), bgRect) && isSelfPaintingLayer()) { HitTestResult tempResult(result.point(), result.pointPadding()); @@ -2937,6 +2964,19 @@ RenderLayer* RenderLayer::hitTestLayer(RenderLayer* rootLayer, RenderLayer* cont else if (result.isRegionTest()) result.merge(tempResult); #endif +======= + if (bgRect.intersects(hitTestArea) && isSelfPaintingLayer()) { + HitTestResult tempResult(result.point(), result.padding()); + if (hitTestContents(request, tempResult, layerBounds, hitTestPoint, HitTestSelf) && + isHitCandidate(this, false, zOffsetForContentsPtr, unflattenedTransformState.get())) { + if (result.isRectBasedTest()) + result.append(tempResult); + else + result = tempResult; + return this; + } else if (result.isRectBasedTest()) + result.append(tempResult); +>>>>>>> webkit.org at r64523 } return 0; @@ -2948,8 +2988,9 @@ bool RenderLayer::hitTestContents(const HitTestRequest& request, HitTestResult& layerBounds.x() - renderBoxX(), layerBounds.y() - renderBoxY(), hitTestFilter)) { - // It's wrong to set innerNode, but then claim that you didn't hit anything. - ASSERT(!result.innerNode()); + // It's wrong to set innerNode, but then claim that you didn't hit anything, unless it is + // a rect-based test. + ASSERT(!result.innerNode() || (result.isRectBasedTest() && result.rectBasedTestResult().size())); return false; } @@ -2983,25 +3024,39 @@ RenderLayer* RenderLayer::hitTestList(Vector<RenderLayer*>* list, RenderLayer* r for (int i = list->size() - 1; i >= 0; --i) { RenderLayer* childLayer = list->at(i); RenderLayer* hitLayer = 0; +<<<<<<< HEAD #ifdef ANDROID_HITTEST_WITHSIZE HitTestResult tempResult(result.point(), result.pointPadding()); #else HitTestResult tempResult(result.point()); #endif +======= + HitTestResult tempResult(result.point(), result.padding()); +>>>>>>> webkit.org at r64523 if (childLayer->isPaginated()) hitLayer = hitTestPaginatedChildLayer(childLayer, rootLayer, request, tempResult, hitTestRect, hitTestPoint, transformState, zOffsetForDescendants); else hitLayer = childLayer->hitTestLayer(rootLayer, this, request, tempResult, hitTestRect, hitTestPoint, false, transformState, zOffsetForDescendants); +<<<<<<< HEAD #ifdef ANDROID_HITTEST_WITHSIZE if (result.isRegionTest()) result.merge(tempResult); #endif +======= + + // If it a rect-based test, we can safely append the temporary result since it might had hit + // nodes but not necesserily had hitLayer set. + if (result.isRectBasedTest()) + result.append(tempResult); + +>>>>>>> webkit.org at r64523 if (isHitCandidate(hitLayer, depthSortDescendants, zOffset, unflattenedTransformState)) { #ifdef ANDROID_HITTEST_WITHSIZE if (!result.isRegionTest()) #endif resultLayer = hitLayer; - result = tempResult; + if (!result.isRectBasedTest()) + result = tempResult; if (!depthSortDescendants) break; } @@ -3061,7 +3116,7 @@ RenderLayer* RenderLayer::hitTestChildLayerColumns(RenderLayer* childLayer, Rend IntRect localClipRect(hitTestRect); localClipRect.intersect(colRect); - if (!localClipRect.isEmpty() && localClipRect.contains(hitTestPoint)) { + if (!localClipRect.isEmpty() && localClipRect.intersects(result.rectFromPoint(hitTestPoint))) { RenderLayer* hitLayer = 0; if (!columnIndex) { // Apply a translation transform to change where the layer paints. diff --git a/WebCore/rendering/RenderLayerBacking.cpp b/WebCore/rendering/RenderLayerBacking.cpp index d66dfc2..e1cf2a2 100644 --- a/WebCore/rendering/RenderLayerBacking.cpp +++ b/WebCore/rendering/RenderLayerBacking.cpp @@ -666,6 +666,9 @@ bool RenderLayerBacking::isSimpleContainerCompositingLayer() const if (hasBoxDecorationsOrBackground(renderObject)) return false; + if (m_owningLayer->hasOverflowControls()) + return false; + // If we have got this far and the renderer has no children, then we're ok. if (!renderObject->firstChild()) return true; @@ -694,26 +697,23 @@ bool RenderLayerBacking::isSimpleContainerCompositingLayer() const if (hasBoxDecorationsOrBackgroundImage(style)) return false; - // Ceck to see if all the body's children are compositing layers. - if (hasNonCompositingContent()) + // Check to see if all the body's children are compositing layers. + if (hasNonCompositingDescendants()) return false; return true; } // Check to see if all the renderer's children are compositing layers. - if (hasNonCompositingContent()) + if (hasNonCompositingDescendants()) return false; return true; } // Conservative test for having no rendered children. -bool RenderLayerBacking::hasNonCompositingContent() const +bool RenderLayerBacking::hasNonCompositingDescendants() const { - if (m_owningLayer->hasOverflowControls()) - return true; - // Some HTML can cause whitespace text nodes to have renderers, like: // <div> // <img src=...> @@ -911,7 +911,7 @@ FloatPoint RenderLayerBacking::contentsToGraphicsLayerCoordinates(const Graphics bool RenderLayerBacking::paintingGoesToWindow() const { if (m_owningLayer->isRootLayer()) - return compositor()->rootLayerAttachment() == RenderLayerCompositor::RootLayerAttachedViaChromeClient; + return compositor()->rootLayerAttachment() != RenderLayerCompositor::RootLayerAttachedViaEnclosingIframe; return false; } diff --git a/WebCore/rendering/RenderLayerBacking.h b/WebCore/rendering/RenderLayerBacking.h index 852fc04..808000b 100644 --- a/WebCore/rendering/RenderLayerBacking.h +++ b/WebCore/rendering/RenderLayerBacking.h @@ -173,7 +173,7 @@ private: bool rendererHasBackground() const; const Color rendererBackgroundColor() const; - bool hasNonCompositingContent() const; + bool hasNonCompositingDescendants() const; void paintIntoLayer(RenderLayer* rootLayer, GraphicsContext*, const IntRect& paintDirtyRect, PaintBehavior paintBehavior, GraphicsLayerPaintingPhase, RenderObject* paintingRoot); diff --git a/WebCore/rendering/RenderLayerCompositor.cpp b/WebCore/rendering/RenderLayerCompositor.cpp index 3d16864..b60dec9 100644 --- a/WebCore/rendering/RenderLayerCompositor.cpp +++ b/WebCore/rendering/RenderLayerCompositor.cpp @@ -29,6 +29,7 @@ #include "RenderLayerCompositor.h" #include "AnimationController.h" +#include "CanvasRenderingContext.h" #include "CSSPropertyNames.h" #include "Chrome.h" #include "ChromeClient.h" @@ -1271,14 +1272,10 @@ bool RenderLayerCompositor::requiresCompositingForVideo(RenderObject* renderer) bool RenderLayerCompositor::requiresCompositingForCanvas(RenderObject* renderer) const { -#if ENABLE(3D_CANVAS) if (renderer->isCanvas()) { HTMLCanvasElement* canvas = static_cast<HTMLCanvasElement*>(renderer->node()); - return canvas->is3D(); + return canvas->renderingContext() && canvas->renderingContext()->isAccelerated(); } -#else - UNUSED_PARAM(renderer); -#endif return false; } diff --git a/WebCore/rendering/RenderLineBoxList.cpp b/WebCore/rendering/RenderLineBoxList.cpp index 3e4c882..06aab89 100644 --- a/WebCore/rendering/RenderLineBoxList.cpp +++ b/WebCore/rendering/RenderLineBoxList.cpp @@ -29,6 +29,7 @@ #include "config.h" #include "RenderLineBoxList.h" +#include "HitTestResult.h" #include "InlineTextBox.h" #ifdef ANDROID_HITTEST_WITHSIZE #include "HitTestResult.h" @@ -248,22 +249,32 @@ bool RenderLineBoxList::hitTest(RenderBoxModelObject* renderer, const HitTestReq // contain the point. This is a quick short-circuit that we can take to avoid walking any lines. // FIXME: This check is flawed in the following extremely obscure way: // if some line in the middle has a huge overflow, it might actually extend below the last line. +<<<<<<< HEAD #ifdef ANDROID_HITTEST_WITHSIZE if ((y - result.pointPadding().height() >= ty + lastLineBox()->root()->bottomVisibleOverflow()) || (y + result.pointPadding().height() < ty + firstLineBox()->root()->topVisibleOverflow())) #else if ((y >= ty + lastLineBox()->root()->bottomVisibleOverflow()) || (y < ty + firstLineBox()->root()->topVisibleOverflow())) #endif +======= + if (y - result.paddingHeight() >= ty + lastLineBox()->root()->bottomVisibleOverflow() + || y + result.paddingHeight() < ty + firstLineBox()->root()->topVisibleOverflow()) +>>>>>>> webkit.org at r64523 return false; // See if our root lines contain the point. If so, then we hit test // them further. Note that boxes can easily overlap, so we can't make any assumptions // based off positions of our first line box or our last line box. for (InlineFlowBox* curr = lastLineBox(); curr; curr = curr->prevLineBox()) { +<<<<<<< HEAD #ifdef ANDROID_HITTEST_WITHSIZE if (y + result.pointPadding().height() >= ty + curr->root()->topVisibleOverflow() && y - result.pointPadding().height() < ty + curr->root()->bottomVisibleOverflow()) { #else if (y >= ty + curr->root()->topVisibleOverflow() && y < ty + curr->root()->bottomVisibleOverflow()) { #endif +======= + if (y + result.paddingHeight() >= ty + curr->root()->topVisibleOverflow() + && y - result.paddingHeight() < ty + curr->root()->bottomVisibleOverflow()) { +>>>>>>> webkit.org at r64523 bool inside = curr->nodeAtPoint(request, result, x, y, tx, ty); if (inside) { renderer->updateHitTestResult(result, IntPoint(x - tx, y - ty)); diff --git a/WebCore/rendering/RenderMenuList.cpp b/WebCore/rendering/RenderMenuList.cpp index ff16e7e..b6a97a9 100644 --- a/WebCore/rendering/RenderMenuList.cpp +++ b/WebCore/rendering/RenderMenuList.cpp @@ -26,6 +26,7 @@ #include "RenderMenuList.h" #include "AXObjectCache.h" +#include "Chrome.h" #include "CSSStyleSelector.h" #include "Frame.h" #include "FrameView.h" @@ -88,8 +89,8 @@ void RenderMenuList::adjustInnerStyle() m_innerBlock->style()->setPaddingRight(Length(theme()->popupInternalPaddingRight(style()), Fixed)); m_innerBlock->style()->setPaddingTop(Length(theme()->popupInternalPaddingTop(style()), Fixed)); m_innerBlock->style()->setPaddingBottom(Length(theme()->popupInternalPaddingBottom(style()), Fixed)); - - if (PopupMenu::itemWritingDirectionIsNatural()) { + + if (document()->page()->chrome()->selectItemWritingDirectionIsNatural()) { // Items in the popup will not respect the CSS text-align and direction properties, // so we must adjust our own style to match. m_innerBlock->style()->setTextAlign(LEFT); @@ -278,7 +279,7 @@ void RenderMenuList::showPopup() // inside the showPopup call and it would fail. createInnerBlock(); if (!m_popup) - m_popup = PopupMenu::create(this); + m_popup = document()->page()->chrome()->createPopupMenu(this); SelectElement* select = toSelectElement(static_cast<Element*>(node())); m_popupIsVisible = true; diff --git a/WebCore/rendering/RenderMenuList.h b/WebCore/rendering/RenderMenuList.h index aef8d4f..512fa9b 100644 --- a/WebCore/rendering/RenderMenuList.h +++ b/WebCore/rendering/RenderMenuList.h @@ -24,6 +24,7 @@ #ifndef RenderMenuList_h #define RenderMenuList_h +#include "PopupMenu.h" #include "PopupMenuClient.h" #include "RenderFlexibleBox.h" @@ -35,7 +36,6 @@ namespace WebCore { -class PopupMenu; class RenderText; #if ENABLE(NO_LISTBOX_RENDERING) diff --git a/WebCore/rendering/RenderObject.h b/WebCore/rendering/RenderObject.h index 3f78e45..46169d0 100644 --- a/WebCore/rendering/RenderObject.h +++ b/WebCore/rendering/RenderObject.h @@ -38,7 +38,7 @@ #include "TransformationMatrix.h" #include <wtf/UnusedParam.h> -#if PLATFORM(CG) +#if PLATFORM(CG) || PLATFORM(CAIRO) #define HAVE_PATH_BASED_BORDER_RADIUS_DRAWING 1 #endif diff --git a/WebCore/rendering/RenderPath.cpp b/WebCore/rendering/RenderPath.cpp index dd79397..915be5d 100644 --- a/WebCore/rendering/RenderPath.cpp +++ b/WebCore/rendering/RenderPath.cpp @@ -35,11 +35,12 @@ #include "PointerEventsHitRules.h" #include "RenderSVGContainer.h" #include "RenderSVGResourceMarker.h" -#include "StrokeStyleApplier.h" #include "SVGRenderSupport.h" +#include "SVGResources.h" #include "SVGStyledTransformableElement.h" #include "SVGTransformList.h" #include "SVGURIReference.h" +#include "StrokeStyleApplier.h" #include <wtf/MathExtras.h> namespace WebCore { @@ -72,7 +73,7 @@ RenderPath::RenderPath(SVGStyledTransformableElement* node) { } -bool RenderPath::fillContains(const FloatPoint& point, bool requiresFill, WindRule fillRule) const +bool RenderPath::fillContains(const FloatPoint& point, bool requiresFill, WindRule fillRule) { if (!m_fillBoundingBox.contains(point)) return false; @@ -83,7 +84,7 @@ bool RenderPath::fillContains(const FloatPoint& point, bool requiresFill, WindRu return m_path.contains(point, fillRule); } -bool RenderPath::strokeContains(const FloatPoint& point, bool requiresStroke) const +bool RenderPath::strokeContains(const FloatPoint& point, bool requiresStroke) { if (!m_strokeAndMarkerBoundingBox.contains(point)) return false; @@ -111,9 +112,9 @@ void RenderPath::layout() m_needsTransformUpdate = false; } - // Invalidate all resources of this client, if we changed something. + // Invalidate all resources of this client if our layout changed. if (m_everHadLayout && selfNeedsLayout()) - RenderSVGResource::invalidateAllResourcesOfRenderer(this); + SVGResourcesCache::clientLayoutChanged(this); // At this point LayoutRepainter already grabbed the old bounds, // recalculate them now so repaintAfterLayout() uses the new bounds @@ -234,8 +235,6 @@ bool RenderPath::nodeAtFloatPoint(const HitTestRequest& request, HitTestResult& FloatRect RenderPath::calculateMarkerBoundsIfNeeded() { - Document* doc = document(); - SVGElement* svgElement = static_cast<SVGElement*>(node()); ASSERT(svgElement && svgElement->document()); if (!svgElement->isStyled()) @@ -248,39 +247,24 @@ FloatRect RenderPath::calculateMarkerBoundsIfNeeded() const SVGRenderStyle* svgStyle = style()->svgStyle(); ASSERT(svgStyle->hasMarkers()); - AtomicString startMarkerId(svgStyle->markerStartResource()); - AtomicString midMarkerId(svgStyle->markerMidResource()); - AtomicString endMarkerId(svgStyle->markerEndResource()); - - RenderSVGResourceMarker* startMarker = getRenderSVGResourceById<RenderSVGResourceMarker>(doc, startMarkerId); - RenderSVGResourceMarker* midMarker = getRenderSVGResourceById<RenderSVGResourceMarker>(doc, midMarkerId); - RenderSVGResourceMarker* endMarker = getRenderSVGResourceById<RenderSVGResourceMarker>(doc, endMarkerId); - - if (!startMarker && !startMarkerId.isEmpty()) - svgElement->document()->accessSVGExtensions()->addPendingResource(startMarkerId, styledElement); - else if (startMarker) - startMarker->addClient(this); - - if (!midMarker && !midMarkerId.isEmpty()) - svgElement->document()->accessSVGExtensions()->addPendingResource(midMarkerId, styledElement); - else if (midMarker) - midMarker->addClient(this); - - if (!endMarker && !endMarkerId.isEmpty()) - svgElement->document()->accessSVGExtensions()->addPendingResource(endMarkerId, styledElement); - else if (endMarker) - endMarker->addClient(this); + SVGResources* resources = SVGResourcesCache::cachedResourcesForRenderObject(this); + if (!resources) + return FloatRect(); - if (!startMarker && !midMarker && !endMarker) + RenderSVGResourceMarker* markerStart = resources->markerStart(); + RenderSVGResourceMarker* markerMid = resources->markerMid(); + RenderSVGResourceMarker* markerEnd = resources->markerEnd(); + if (!markerStart && !markerMid && !markerEnd) return FloatRect(); float strokeWidth = SVGRenderStyle::cssPrimitiveToLength(this, svgStyle->strokeWidth(), 1.0f); - return m_markerLayoutInfo.calculateBoundaries(startMarker, midMarker, endMarker, strokeWidth, m_path); + return m_markerLayoutInfo.calculateBoundaries(markerStart, markerMid, markerEnd, strokeWidth, m_path); } void RenderPath::styleWillChange(StyleDifference diff, const RenderStyle* newStyle) { - setNeedsBoundariesUpdate(); + if (diff == StyleDifferenceLayout) + setNeedsBoundariesUpdate(); RenderSVGModelObject::styleWillChange(diff, newStyle); } diff --git a/WebCore/rendering/RenderPath.h b/WebCore/rendering/RenderPath.h index 3748f39..57900ad 100644 --- a/WebCore/rendering/RenderPath.h +++ b/WebCore/rendering/RenderPath.h @@ -47,8 +47,8 @@ public: private: // Hit-detection seperated for the fill and the stroke - bool fillContains(const FloatPoint&, bool requiresFill = true, WindRule fillRule = RULE_NONZERO) const; - bool strokeContains(const FloatPoint&, bool requiresStroke = true) const; + bool fillContains(const FloatPoint&, bool requiresFill = true, WindRule fillRule = RULE_NONZERO); + bool strokeContains(const FloatPoint&, bool requiresStroke = true); virtual FloatRect objectBoundingBox() const { return m_fillBoundingBox; } virtual FloatRect strokeBoundingBox() const { return m_strokeAndMarkerBoundingBox; } diff --git a/WebCore/rendering/RenderSVGBlock.cpp b/WebCore/rendering/RenderSVGBlock.cpp index 2bae158..d6022b5 100644 --- a/WebCore/rendering/RenderSVGBlock.cpp +++ b/WebCore/rendering/RenderSVGBlock.cpp @@ -25,6 +25,7 @@ #if ENABLE(SVG) #include "RenderSVGBlock.h" +#include "RenderSVGResource.h" #include "SVGElement.h" namespace WebCore { @@ -73,6 +74,25 @@ void RenderSVGBlock::absoluteRects(Vector<IntRect>&, int, int) // This code path should never be taken for SVG, as we're assuming useTransforms=true everywhere, absoluteQuads should be used. ASSERT_NOT_REACHED(); } + +void RenderSVGBlock::destroy() +{ + SVGResourcesCache::clientDestroyed(this); + RenderBlock::destroy(); +} + +void RenderSVGBlock::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle) +{ + RenderBlock::styleDidChange(diff, oldStyle); + SVGResourcesCache::clientStyleChanged(this, diff, style()); +} + +void RenderSVGBlock::updateFromElement() +{ + RenderBlock::updateFromElement(); + SVGResourcesCache::clientUpdatedFromElement(this, style()); +} + } #endif diff --git a/WebCore/rendering/RenderSVGBlock.h b/WebCore/rendering/RenderSVGBlock.h index 8dd140b..c4337cc 100644 --- a/WebCore/rendering/RenderSVGBlock.h +++ b/WebCore/rendering/RenderSVGBlock.h @@ -38,6 +38,10 @@ private: virtual void updateBoxModelInfoFromStyle(); virtual void absoluteRects(Vector<IntRect>&, int tx, int ty); + + virtual void destroy(); + virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle); + virtual void updateFromElement(); }; } diff --git a/WebCore/rendering/RenderSVGContainer.cpp b/WebCore/rendering/RenderSVGContainer.cpp index ad63771..bab07a4 100644 --- a/WebCore/rendering/RenderSVGContainer.cpp +++ b/WebCore/rendering/RenderSVGContainer.cpp @@ -31,6 +31,7 @@ #include "RenderSVGResourceFilter.h" #include "RenderView.h" #include "SVGRenderSupport.h" +#include "SVGResources.h" #include "SVGStyledElement.h" namespace WebCore { @@ -58,23 +59,22 @@ void RenderSVGContainer::layout() SVGRenderSupport::layoutChildren(this, selfNeedsLayout()); - // Invalidate all resources of this client, if we changed something. + // Invalidate all resources of this client if our layout changed. if (m_everHadLayout && selfNeedsLayout()) - RenderSVGResource::invalidateAllResourcesOfRenderer(this); + SVGResourcesCache::clientLayoutChanged(this); repainter.repaintAfterLayout(); setNeedsLayout(false); } -bool RenderSVGContainer::selfWillPaint() const +bool RenderSVGContainer::selfWillPaint() { #if ENABLE(FILTERS) - const SVGRenderStyle* svgStyle = style()->svgStyle(); - RenderSVGResourceFilter* filter = getRenderSVGResourceById<RenderSVGResourceFilter>(document(), svgStyle->filterResource()); - if (filter) - return true; -#endif + SVGResources* resources = SVGResourcesCache::cachedResourcesForRenderObject(this); + return resources && resources->filter(); +#else return false; +#endif } void RenderSVGContainer::paint(PaintInfo& paintInfo, int, int) diff --git a/WebCore/rendering/RenderSVGContainer.h b/WebCore/rendering/RenderSVGContainer.h index 53f1a97..0a122cd 100644 --- a/WebCore/rendering/RenderSVGContainer.h +++ b/WebCore/rendering/RenderSVGContainer.h @@ -69,7 +69,7 @@ protected: virtual void applyViewportClip(PaintInfo&) { } virtual bool pointIsInsideViewportClip(const FloatPoint& /*pointInParent*/) { return true; } - bool selfWillPaint() const; + bool selfWillPaint(); private: RenderObjectChildList m_children; diff --git a/WebCore/rendering/RenderSVGGradientStop.cpp b/WebCore/rendering/RenderSVGGradientStop.cpp index 754f31f..3494aa7 100644 --- a/WebCore/rendering/RenderSVGGradientStop.cpp +++ b/WebCore/rendering/RenderSVGGradientStop.cpp @@ -25,8 +25,10 @@ #if ENABLE(SVG) #include "RenderSVGGradientStop.h" +#include "RenderSVGResourceContainer.h" #include "SVGGradientElement.h" #include "SVGNames.h" +#include "SVGResourcesCache.h" #include "SVGStopElement.h" namespace WebCore { @@ -48,8 +50,17 @@ void RenderSVGGradientStop::styleDidChange(StyleDifference diff, const RenderSty // <stop> elements should only be allowed to make renderers under gradient elements // but I can imagine a few cases we might not be catching, so let's not crash if our parent isn't a gradient. - if (SVGGradientElement* gradient = gradientElement()) - gradient->invalidateResourceClients(); + SVGGradientElement* gradient = gradientElement(); + if (!gradient) + return; + + RenderObject* renderer = gradient->renderer(); + if (!renderer) + return; + + ASSERT(renderer->isSVGResourceContainer()); + RenderSVGResourceContainer* container = renderer->toRenderSVGResourceContainer(); + container->invalidateClients(); } void RenderSVGGradientStop::layout() diff --git a/WebCore/rendering/RenderSVGHiddenContainer.h b/WebCore/rendering/RenderSVGHiddenContainer.h index 297a738..e0daac1 100644 --- a/WebCore/rendering/RenderSVGHiddenContainer.h +++ b/WebCore/rendering/RenderSVGHiddenContainer.h @@ -24,7 +24,6 @@ #define RenderSVGHiddenContainer_h #if ENABLE(SVG) - #include "RenderSVGContainer.h" namespace WebCore { @@ -39,11 +38,13 @@ namespace WebCore { virtual const char* renderName() const { return "RenderSVGHiddenContainer"; } + protected: + virtual void layout(); + private: virtual bool isSVGHiddenContainer() const { return true; } virtual bool requiresLayer() const { return false; } - virtual void layout(); virtual void paint(PaintInfo&, int parentX, int parentY); virtual IntRect clippedOverflowRectForRepaint(RenderBoxModelObject* repaintContainer); diff --git a/WebCore/rendering/RenderSVGImage.cpp b/WebCore/rendering/RenderSVGImage.cpp index 44b68b1..5a92e33 100644 --- a/WebCore/rendering/RenderSVGImage.cpp +++ b/WebCore/rendering/RenderSVGImage.cpp @@ -39,6 +39,7 @@ #include "SVGLength.h" #include "SVGPreserveAspectRatio.h" #include "SVGRenderSupport.h" +#include "SVGResources.h" namespace WebCore { @@ -70,9 +71,9 @@ void RenderSVGImage::layout() m_localBounds = FloatRect(image->x().value(image), image->y().value(image), image->width().value(image), image->height().value(image)); m_cachedLocalRepaintRect = FloatRect(); - // Invalidate all resources of this client, if we changed something. + // Invalidate all resources of this client if our layout changed. if (m_everHadLayout && selfNeedsLayout()) - RenderSVGResource::invalidateAllResourcesOfRenderer(this); + SVGResourcesCache::clientLayoutChanged(this); repainter.repaintAfterLayout(); setNeedsLayout(false); @@ -110,10 +111,22 @@ void RenderSVGImage::paint(PaintInfo& paintInfo, int, int) void RenderSVGImage::destroy() { - RenderSVGResource::invalidateAllResourcesOfRenderer(this); + SVGResourcesCache::clientDestroyed(this); RenderImage::destroy(); } +void RenderSVGImage::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle) +{ + RenderImage::styleDidChange(diff, oldStyle); + SVGResourcesCache::clientStyleChanged(this, diff, style()); +} + +void RenderSVGImage::updateFromElement() +{ + RenderImage::updateFromElement(); + SVGResourcesCache::clientUpdatedFromElement(this, style()); +} + bool RenderSVGImage::nodeAtFloatPoint(const HitTestRequest& request, HitTestResult& result, const FloatPoint& pointInParent, HitTestAction hitTestAction) { // We only draw in the forground phase, so we only hit-test then. @@ -160,12 +173,12 @@ FloatRect RenderSVGImage::repaintRectInLocalCoordinates() const void RenderSVGImage::imageChanged(WrappedImagePtr image, const IntRect* rect) { RenderImage::imageChanged(image, rect); -#if ENABLE(FILTERS) + // The image resource defaults to nullImage until the resource arrives. - // This empty image may be cached by SVG filter effects which must be invalidated. - if (RenderSVGResourceFilter* filter = getRenderSVGResourceById<RenderSVGResourceFilter>(document(), style()->svgStyle()->filterResource())) - filter->invalidateClient(this); -#endif + // This empty image may be cached by SVG resources which must be invalidated. + if (SVGResources* resources = SVGResourcesCache::cachedResourcesForRenderObject(this)) + resources->invalidateClient(this); + repaint(); } diff --git a/WebCore/rendering/RenderSVGImage.h b/WebCore/rendering/RenderSVGImage.h index 3baac23..6ee0179 100644 --- a/WebCore/rendering/RenderSVGImage.h +++ b/WebCore/rendering/RenderSVGImage.h @@ -65,6 +65,8 @@ private: virtual void paint(PaintInfo&, int parentX, int parentY); virtual void destroy(); + virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle); + virtual void updateFromElement(); virtual bool requiresLayer() const { return false; } diff --git a/WebCore/rendering/RenderSVGInline.cpp b/WebCore/rendering/RenderSVGInline.cpp index ffc6b62..93e6a06 100644 --- a/WebCore/rendering/RenderSVGInline.cpp +++ b/WebCore/rendering/RenderSVGInline.cpp @@ -26,6 +26,7 @@ #if ENABLE(SVG) #include "RenderSVGInline.h" +#include "RenderSVGResource.h" #include "SVGInlineFlowBox.h" namespace WebCore { @@ -92,6 +93,24 @@ void RenderSVGInline::absoluteQuads(Vector<FloatQuad>& quads) quads.append(localToAbsoluteQuad(FloatRect(textBoundingBox.x() + box->x(), textBoundingBox.y() + box->y(), box->width(), box->height()))); } +void RenderSVGInline::destroy() +{ + SVGResourcesCache::clientDestroyed(this); + RenderInline::destroy(); +} + +void RenderSVGInline::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle) +{ + RenderInline::styleDidChange(diff, oldStyle); + SVGResourcesCache::clientStyleChanged(this, diff, style()); +} + +void RenderSVGInline::updateFromElement() +{ + RenderInline::updateFromElement(); + SVGResourcesCache::clientUpdatedFromElement(this, style()); +} + } diff --git a/WebCore/rendering/RenderSVGInline.h b/WebCore/rendering/RenderSVGInline.h index 6f44162..56d911f 100644 --- a/WebCore/rendering/RenderSVGInline.h +++ b/WebCore/rendering/RenderSVGInline.h @@ -54,6 +54,10 @@ public: private: virtual InlineFlowBox* createInlineFlowBox(); + + virtual void destroy(); + virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle); + virtual void updateFromElement(); }; } diff --git a/WebCore/rendering/RenderSVGModelObject.cpp b/WebCore/rendering/RenderSVGModelObject.cpp index 49404cb..5a19749 100644 --- a/WebCore/rendering/RenderSVGModelObject.cpp +++ b/WebCore/rendering/RenderSVGModelObject.cpp @@ -83,16 +83,20 @@ void RenderSVGModelObject::absoluteQuads(Vector<FloatQuad>& quads) void RenderSVGModelObject::destroy() { - RenderSVGResource::invalidateAllResourcesOfRenderer(this); + SVGResourcesCache::clientDestroyed(this); RenderObject::destroy(); } void RenderSVGModelObject::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle) { RenderObject::styleDidChange(diff, oldStyle); + SVGResourcesCache::clientStyleChanged(this, diff, style()); +} - if (style() && (diff == StyleDifferenceLayout || diff == StyleDifferenceRepaint)) - RenderSVGResource::markForLayoutAndParentResourceInvalidation(this, false); +void RenderSVGModelObject::updateFromElement() +{ + RenderObject::updateFromElement(); + SVGResourcesCache::clientUpdatedFromElement(this, style()); } bool RenderSVGModelObject::nodeAtPoint(const HitTestRequest&, HitTestResult&, int, int, int, int, HitTestAction) diff --git a/WebCore/rendering/RenderSVGModelObject.h b/WebCore/rendering/RenderSVGModelObject.h index 741cd61..35c4dc3 100644 --- a/WebCore/rendering/RenderSVGModelObject.h +++ b/WebCore/rendering/RenderSVGModelObject.h @@ -62,6 +62,7 @@ public: virtual void mapLocalToContainer(RenderBoxModelObject* repaintContainer, bool useTransforms, bool fixed, TransformState&) const; virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle); + virtual void updateFromElement(); private: // This method should never be called, SVG uses a different nodeAtPoint method diff --git a/WebCore/rendering/RenderSVGResource.cpp b/WebCore/rendering/RenderSVGResource.cpp index b4f499e..9c89d3c 100644 --- a/WebCore/rendering/RenderSVGResource.cpp +++ b/WebCore/rendering/RenderSVGResource.cpp @@ -26,28 +26,13 @@ #if ENABLE(SVG) #include "RenderSVGResource.h" -#include "RenderSVGResourceClipper.h" #include "RenderSVGResourceContainer.h" -#include "RenderSVGResourceFilter.h" -#include "RenderSVGResourceMarker.h" -#include "RenderSVGResourceMasker.h" #include "RenderSVGResourceSolidColor.h" +#include "SVGResources.h" #include "SVGURIReference.h" namespace WebCore { -static inline void registerPendingResource(const AtomicString& id, const SVGPaint::SVGPaintType& paintType, const RenderObject* object) -{ - if (paintType != SVGPaint::SVG_PAINTTYPE_URI) - return; - - SVGElement* svgElement = static_cast<SVGElement*>(object->node()); - ASSERT(svgElement); - ASSERT(svgElement->isStyled()); - - object->document()->accessSVGExtensions()->addPendingResource(id, static_cast<SVGStyledElement*>(svgElement)); -} - inline void RenderSVGResource::adjustColorForPseudoRules(const RenderStyle* style, bool useFillPaint, Color& color) { if (style->insideLink() != InsideVisitedLink) @@ -69,7 +54,7 @@ inline void RenderSVGResource::adjustColorForPseudoRules(const RenderStyle* styl } // FIXME: This method and strokePaintingResource() should be refactored, to share even more code -RenderSVGResource* RenderSVGResource::fillPaintingResource(const RenderObject* object, const RenderStyle* style) +RenderSVGResource* RenderSVGResource::fillPaintingResource(RenderObject* object, const RenderStyle* style) { ASSERT(object); ASSERT(style); @@ -84,13 +69,9 @@ RenderSVGResource* RenderSVGResource::fillPaintingResource(const RenderObject* o RenderSVGResource* fillPaintingResource = 0; SVGPaint::SVGPaintType paintType = fillPaint->paintType(); - if (paintType == SVGPaint::SVG_PAINTTYPE_URI - || paintType == SVGPaint::SVG_PAINTTYPE_URI_RGBCOLOR) { - AtomicString id(SVGURIReference::getTarget(fillPaint->uri())); - fillPaintingResource = getRenderSVGResourceContainerById(object->document(), id); - - if (!fillPaintingResource) - registerPendingResource(id, paintType, object); + if (paintType == SVGPaint::SVG_PAINTTYPE_URI || paintType == SVGPaint::SVG_PAINTTYPE_URI_RGBCOLOR) { + if (SVGResources* resources = SVGResourcesCache::cachedResourcesForRenderObject(object)) + fillPaintingResource = resources->fill(); } if (paintType != SVGPaint::SVG_PAINTTYPE_URI && !fillPaintingResource) { @@ -122,7 +103,7 @@ RenderSVGResource* RenderSVGResource::fillPaintingResource(const RenderObject* o return fillPaintingResource; } -RenderSVGResource* RenderSVGResource::strokePaintingResource(const RenderObject* object, const RenderStyle* style) +RenderSVGResource* RenderSVGResource::strokePaintingResource(RenderObject* object, const RenderStyle* style) { ASSERT(object); ASSERT(style); @@ -138,13 +119,9 @@ RenderSVGResource* RenderSVGResource::strokePaintingResource(const RenderObject* FloatRect objectBoundingBox = object->objectBoundingBox(); SVGPaint::SVGPaintType paintType = strokePaint->paintType(); - if (!objectBoundingBox.isEmpty() - && (paintType == SVGPaint::SVG_PAINTTYPE_URI || paintType == SVGPaint::SVG_PAINTTYPE_URI_RGBCOLOR)) { - AtomicString id(SVGURIReference::getTarget(strokePaint->uri())); - strokePaintingResource = getRenderSVGResourceContainerById(object->document(), id); - - if (!strokePaintingResource) - registerPendingResource(id, paintType, object); + if (!objectBoundingBox.isEmpty() && (paintType == SVGPaint::SVG_PAINTTYPE_URI || paintType == SVGPaint::SVG_PAINTTYPE_URI_RGBCOLOR)) { + if (SVGResources* resources = SVGResourcesCache::cachedResourcesForRenderObject(object)) + strokePaintingResource = resources->stroke(); } if (paintType != SVGPaint::SVG_PAINTTYPE_URI && !strokePaintingResource) { @@ -184,72 +161,6 @@ RenderSVGResourceSolidColor* RenderSVGResource::sharedSolidPaintingResource() return s_sharedSolidPaintingResource; } -void RenderSVGResource::markForLayoutAndResourceInvalidation(RenderObject* object, bool needsBoundariesUpdate) -{ - ASSERT(object); - ASSERT(object->node()); - ASSERT(object->node()->isSVGElement()); - - // Eventually mark the renderer needing a boundaries update - if (needsBoundariesUpdate) - object->setNeedsBoundariesUpdate(); - - markForLayoutAndParentResourceInvalidation(object); -} - -static inline void invalidatePaintingResource(SVGPaint* paint, RenderObject* object) -{ - ASSERT(paint); - - SVGPaint::SVGPaintType paintType = paint->paintType(); - if (paintType != SVGPaint::SVG_PAINTTYPE_URI && paintType != SVGPaint::SVG_PAINTTYPE_URI_RGBCOLOR) - return; - - AtomicString id(SVGURIReference::getTarget(paint->uri())); - if (RenderSVGResourceContainer* paintingResource = getRenderSVGResourceContainerById(object->document(), id)) - paintingResource->invalidateClient(object); -} - -void RenderSVGResource::invalidateAllResourcesOfRenderer(RenderObject* object) -{ - ASSERT(object); - ASSERT(object->style()); - - Document* document = object->document(); - ASSERT(document); - - const SVGRenderStyle* svgStyle = object->style()->svgStyle(); - ASSERT(svgStyle); - - // Masker - if (RenderSVGResourceMasker* masker = getRenderSVGResourceById<RenderSVGResourceMasker>(document, svgStyle->maskerResource())) - masker->invalidateClient(object); - - // Clipper - if (RenderSVGResourceClipper* clipper = getRenderSVGResourceById<RenderSVGResourceClipper>(document, svgStyle->clipperResource())) - clipper->invalidateClient(object); - - // Filter -#if ENABLE(FILTERS) - if (RenderSVGResourceFilter* filter = getRenderSVGResourceById<RenderSVGResourceFilter>(document, svgStyle->filterResource())) - filter->invalidateClient(object); -#endif - - // Markers - if (RenderSVGResourceMarker* startMarker = getRenderSVGResourceById<RenderSVGResourceMarker>(document, svgStyle->markerStartResource())) - startMarker->invalidateClient(object); - if (RenderSVGResourceMarker* midMarker = getRenderSVGResourceById<RenderSVGResourceMarker>(document, svgStyle->markerMidResource())) - midMarker->invalidateClient(object); - if (RenderSVGResourceMarker* endMarker = getRenderSVGResourceById<RenderSVGResourceMarker>(document, svgStyle->markerEndResource())) - endMarker->invalidateClient(object); - - // Gradients/Patterns - if (svgStyle->hasFill()) - invalidatePaintingResource(svgStyle->fillPaint(), object); - if (svgStyle->hasStroke()) - invalidatePaintingResource(svgStyle->strokePaint(), object); -} - void RenderSVGResource::markForLayoutAndParentResourceInvalidation(RenderObject* object, bool needsLayout) { ASSERT(object); @@ -259,8 +170,10 @@ void RenderSVGResource::markForLayoutAndParentResourceInvalidation(RenderObject* // Invalidate resources in ancestor chain, if needed. RenderObject* current = object->parent(); while (current) { - if (current->isSVGResourceContainer()) + if (current->isSVGResourceContainer()) { current->toRenderSVGResourceContainer()->invalidateClients(); + break; + } current = current->parent(); } diff --git a/WebCore/rendering/RenderSVGResource.h b/WebCore/rendering/RenderSVGResource.h index b3ea6fb..e2d8216 100644 --- a/WebCore/rendering/RenderSVGResource.h +++ b/WebCore/rendering/RenderSVGResource.h @@ -22,6 +22,7 @@ #define RenderSVGResource_h #if ENABLE(SVG) +#include "RenderStyleConstants.h" #include "SVGDocumentExtensions.h" namespace WebCore { @@ -75,18 +76,14 @@ public: } // Helper utilities used in the render tree to access resources used for painting shapes/text (gradients & patterns only) - static RenderSVGResource* fillPaintingResource(const RenderObject*, const RenderStyle*); - static RenderSVGResource* strokePaintingResource(const RenderObject*, const RenderStyle*); + static RenderSVGResource* fillPaintingResource(RenderObject*, const RenderStyle*); + static RenderSVGResource* strokePaintingResource(RenderObject*, const RenderStyle*); static RenderSVGResourceSolidColor* sharedSolidPaintingResource(); - static void invalidateAllResourcesOfRenderer(RenderObject*); static void markForLayoutAndParentResourceInvalidation(RenderObject*, bool needsLayout = true); private: static void adjustColorForPseudoRules(const RenderStyle*, bool useFillPaint, Color&); - -protected: - void markForLayoutAndResourceInvalidation(RenderObject*, bool needsBoundariesUpdate = true); }; } diff --git a/WebCore/rendering/RenderSVGResourceClipper.cpp b/WebCore/rendering/RenderSVGResourceClipper.cpp index e923f7e..a201d1f 100644 --- a/WebCore/rendering/RenderSVGResourceClipper.cpp +++ b/WebCore/rendering/RenderSVGResourceClipper.cpp @@ -21,6 +21,7 @@ */ #include "config.h" + #if ENABLE(SVG) #include "RenderSVGResourceClipper.h" @@ -32,11 +33,12 @@ #include "ImageBuffer.h" #include "IntRect.h" #include "RenderObject.h" -#include "RenderStyle.h" #include "RenderSVGResource.h" +#include "RenderStyle.h" #include "SVGClipPathElement.h" #include "SVGElement.h" #include "SVGRenderSupport.h" +#include "SVGResources.h" #include "SVGStyledElement.h" #include "SVGStyledTransformableElement.h" #include "SVGUnitTypes.h" @@ -55,6 +57,9 @@ RenderSVGResourceClipper::RenderSVGResourceClipper(SVGClipPathElement* node) RenderSVGResourceClipper::~RenderSVGResourceClipper() { + if (m_clipper.isEmpty()) + return; + deleteAllValues(m_clipper); m_clipper.clear(); } @@ -64,26 +69,26 @@ void RenderSVGResourceClipper::invalidateClients() if (m_invalidationBlocked) return; - HashMap<RenderObject*, ClipperData*>::const_iterator end = m_clipper.end(); - for (HashMap<RenderObject*, ClipperData*>::const_iterator it = m_clipper.begin(); it != end; ++it) - markForLayoutAndResourceInvalidation(it->first); - - deleteAllValues(m_clipper); - m_clipper.clear(); m_clipBoundaries = FloatRect(); + if (!m_clipper.isEmpty()) { + deleteAllValues(m_clipper); + m_clipper.clear(); + } + + markAllClientsForInvalidation(LayoutAndBoundariesInvalidation); } -void RenderSVGResourceClipper::invalidateClient(RenderObject* object) +void RenderSVGResourceClipper::invalidateClient(RenderObject* client) { + ASSERT(client); if (m_invalidationBlocked) return; - ASSERT(object); - if (!m_clipper.contains(object)) - return; + ASSERT(client->selfNeedsLayout()); + if (m_clipper.contains(client)) + delete m_clipper.take(client); - delete m_clipper.take(object); - markForLayoutAndResourceInvalidation(object); + markClientForInvalidation(client, BoundariesInvalidation); } bool RenderSVGResourceClipper::applyResource(RenderObject* object, RenderStyle*, GraphicsContext*& context, unsigned short resourceMode) @@ -96,10 +101,6 @@ bool RenderSVGResourceClipper::applyResource(RenderObject* object, RenderStyle*, UNUSED_PARAM(resourceMode); #endif - // Early exit, if this resource contains a child which references ourselves. - if (containsCyclicReference(node())) - return false; - applyClippingToContext(object, object->objectBoundingBox(), object->repaintRectInLocalCoordinates(), context); return true; } @@ -191,11 +192,13 @@ bool RenderSVGResourceClipper::createClipData(ClipperData* clipperData, const Fl maskContext->translate(-repaintRect.x(), -repaintRect.y()); // clipPath can also be clipped by another clipPath. - if (RenderSVGResourceClipper* clipper = getRenderSVGResourceById<RenderSVGResourceClipper>(this->document(), style()->svgStyle()->clipperResource())) { - if (!clipper->applyClippingToContext(this, objectBoundingBox, repaintRect, maskContext)) { - maskContext->restore(); - return false; - } + if (SVGResources* resources = SVGResourcesCache::cachedResourcesForRenderObject(this)) { + if (RenderSVGResourceClipper* clipper = resources->clipper()) { + if (!clipper->applyClippingToContext(this, objectBoundingBox, repaintRect, maskContext)) { + maskContext->restore(); + return false; + } + } } SVGClipPathElement* clipPath = static_cast<SVGClipPathElement*>(node()); @@ -280,12 +283,6 @@ void RenderSVGResourceClipper::calculateClipContentRepaintRect() bool RenderSVGResourceClipper::hitTestClipContent(const FloatRect& objectBoundingBox, const FloatPoint& nodeAtPoint) { - // FIXME: We should be able to check whether m_clipper.contains(object) - this doesn't work at the moment - // as resourceBoundingBox() has already created ClipperData, even if applyResource() returned false. - // Early exit, if this resource contains a child which references ourselves. - if (containsCyclicReference(node())) - return false; - FloatPoint point = nodeAtPoint; if (!SVGRenderSupport::pointInClippingArea(this, point)) return false; @@ -312,14 +309,6 @@ bool RenderSVGResourceClipper::hitTestClipContent(const FloatRect& objectBoundin return false; } -bool RenderSVGResourceClipper::childElementReferencesResource(const SVGRenderStyle* style, const String& referenceId) const -{ - if (!style->hasClipper()) - return false; - - return style->clipperResource() == referenceId; -} - FloatRect RenderSVGResourceClipper::resourceBoundingBox(RenderObject* object) { // Resource was not layouted yet. Give back the boundingBox of the object. diff --git a/WebCore/rendering/RenderSVGResourceClipper.h b/WebCore/rendering/RenderSVGResourceClipper.h index 7128aa1..3c76bc8 100644 --- a/WebCore/rendering/RenderSVGResourceClipper.h +++ b/WebCore/rendering/RenderSVGResourceClipper.h @@ -68,8 +68,6 @@ private: bool createClipData(ClipperData*, const FloatRect&, const FloatRect&); void calculateClipContentRepaintRect(); - virtual bool childElementReferencesResource(const SVGRenderStyle*, const String&) const; - bool m_invalidationBlocked; FloatRect m_clipBoundaries; HashMap<RenderObject*, ClipperData*> m_clipper; diff --git a/WebCore/rendering/RenderSVGResourceContainer.cpp b/WebCore/rendering/RenderSVGResourceContainer.cpp index 3707797..7e43300 100644 --- a/WebCore/rendering/RenderSVGResourceContainer.cpp +++ b/WebCore/rendering/RenderSVGResourceContainer.cpp @@ -28,102 +28,147 @@ namespace WebCore { +static inline SVGDocumentExtensions* svgExtensionsFromNode(Node* node) +{ + ASSERT(node); + ASSERT(node->document()); + return node->document()->accessSVGExtensions(); +} + RenderSVGResourceContainer::RenderSVGResourceContainer(SVGStyledElement* node) : RenderSVGHiddenContainer(node) - , RenderSVGResource() , m_id(node->hasID() ? node->getIdAttribute() : nullAtom) + , m_registered(false) { - ASSERT(node->document()); - node->document()->accessSVGExtensions()->addResource(m_id, this); } RenderSVGResourceContainer::~RenderSVGResourceContainer() { - ASSERT(node()); - ASSERT(node()->document()); - node()->document()->accessSVGExtensions()->removeResource(m_id); + if (m_registered) + svgExtensionsFromNode(node())->removeResource(m_id); } -void RenderSVGResourceContainer::idChanged() +void RenderSVGResourceContainer::layout() { - ASSERT(node()); - ASSERT(node()->document()); - SVGDocumentExtensions* extensions = node()->document()->accessSVGExtensions(); + // Invalidate all resources if our layout changed. + if (m_everHadLayout && selfNeedsLayout()) + invalidateClients(); - // Remove old id, that is guaranteed to be present in cache - extensions->removeResource(m_id); - m_id = static_cast<Element*>(node())->getIdAttribute(); + RenderSVGHiddenContainer::layout(); +} - // It's possible that an element is referencing us with the new id, and has to be notified that we're existing now - if (extensions->isPendingResource(m_id)) { - OwnPtr<HashSet<SVGStyledElement*> > clients(extensions->removePendingResource(m_id)); - if (clients->isEmpty()) - return; +void RenderSVGResourceContainer::destroy() +{ + SVGResourcesCache::resourceDestroyed(this); + RenderSVGHiddenContainer::destroy(); +} - HashSet<SVGStyledElement*>::const_iterator it = clients->begin(); - const HashSet<SVGStyledElement*>::const_iterator end = clients->end(); +void RenderSVGResourceContainer::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle) +{ + RenderSVGHiddenContainer::styleDidChange(diff, oldStyle); - for (; it != end; ++it) { - if (RenderObject* renderer = (*it)->renderer()) - renderer->setNeedsLayout(true); - } + if (!m_registered) { + m_registered = true; + registerResource(); } - - // Recache us with the new id - extensions->addResource(m_id, this); } -AffineTransform RenderSVGResourceContainer::transformOnNonScalingStroke(RenderObject* object, const AffineTransform& resourceTransform) +void RenderSVGResourceContainer::idChanged() { - if (!object->isRenderPath()) - return resourceTransform; + // Invalidate all our current clients. + invalidateClients(); - SVGStyledTransformableElement* element = static_cast<SVGStyledTransformableElement*>(object->node()); - AffineTransform transform = resourceTransform; - transform.multiply(element->getScreenCTM()); - return transform; + // Remove old id, that is guaranteed to be present in cache. + SVGDocumentExtensions* extensions = svgExtensionsFromNode(node()); + extensions->removeResource(m_id); + m_id = static_cast<Element*>(node())->getIdAttribute(); + + registerResource(); } -bool RenderSVGResourceContainer::containsCyclicReference(const Node* startNode) const +void RenderSVGResourceContainer::markAllClientsForInvalidation(InvalidationMode mode) { - ASSERT(startNode->document()); + if (m_clients.isEmpty()) + return; - for (Node* node = startNode->firstChild(); node; node = node->nextSibling()) { - if (!node->isSVGElement()) - continue; + bool needsLayout = mode == LayoutAndBoundariesInvalidation; - RenderObject* renderer = node->renderer(); - if (!renderer) + HashSet<RenderObject*>::iterator end = m_clients.end(); + for (HashSet<RenderObject*>::iterator it = m_clients.begin(); it != end; ++it) { + RenderObject* client = *it; + if (client->isSVGResourceContainer()) { + client->toRenderSVGResourceContainer()->invalidateClients(); continue; + } - RenderStyle* style = renderer->style(); - if (!style) - continue; + markClientForInvalidation(client, mode); + RenderSVGResource::markForLayoutAndParentResourceInvalidation(client, needsLayout); + } +} - const SVGRenderStyle* svgStyle = style->svgStyle(); - ASSERT(svgStyle); +void RenderSVGResourceContainer::markClientForInvalidation(RenderObject* client, InvalidationMode mode) +{ + ASSERT(client); + ASSERT(!m_clients.isEmpty()); + + switch (mode) { + case LayoutAndBoundariesInvalidation: + case BoundariesInvalidation: + client->setNeedsBoundariesUpdate(); + break; + case RepaintInvalidation: + if (client->view()) + client->repaint(); + break; + } +} - // Let the class inheriting from us decide whether the child element references ourselves. - if (childElementReferencesResource(svgStyle, m_id)) - return true; +void RenderSVGResourceContainer::addClient(RenderObject* client) +{ + ASSERT(client); + m_clients.add(client); +} - // Dive into shadow tree to check for cycles there. - if (node->hasTagName(SVGNames::useTag)) { - ASSERT(renderer->isSVGShadowTreeRootContainer()); - if (Node* shadowRoot = static_cast<RenderSVGShadowTreeRootContainer*>(renderer)->rootElement()) { - if (containsCyclicReference(shadowRoot)) - return true; - } +void RenderSVGResourceContainer::removeClient(RenderObject* client) +{ + ASSERT(client); + m_clients.remove(client); +} - } +void RenderSVGResourceContainer::registerResource() +{ + SVGDocumentExtensions* extensions = svgExtensionsFromNode(node()); + if (!extensions->isPendingResource(m_id)) { + extensions->addResource(m_id, this); + return; + } - if (node->hasChildNodes()) { - if (containsCyclicReference(node)) - return true; - } + OwnPtr<HashSet<SVGStyledElement*> > clients(extensions->removePendingResource(m_id)); + + // Cache us with the new id. + extensions->addResource(m_id, this); + + // Update cached resources of pending clients. + const HashSet<SVGStyledElement*>::const_iterator end = clients->end(); + for (HashSet<SVGStyledElement*>::const_iterator it = clients->begin(); it != end; ++it) { + RenderObject* renderer = (*it)->renderer(); + if (!renderer) + continue; + SVGResourcesCache::clientUpdatedFromElement(renderer, renderer->style()); + renderer->setNeedsLayout(true); } +} + +// FIXME: This does not belong here. +AffineTransform RenderSVGResourceContainer::transformOnNonScalingStroke(RenderObject* object, const AffineTransform& resourceTransform) +{ + if (!object->isRenderPath()) + return resourceTransform; - return false; + SVGStyledTransformableElement* element = static_cast<SVGStyledTransformableElement*>(object->node()); + AffineTransform transform = resourceTransform; + transform.multiply(element->getScreenCTM()); + return transform; } } diff --git a/WebCore/rendering/RenderSVGResourceContainer.h b/WebCore/rendering/RenderSVGResourceContainer.h index d57b1db..4271a5f 100644 --- a/WebCore/rendering/RenderSVGResourceContainer.h +++ b/WebCore/rendering/RenderSVGResourceContainer.h @@ -23,10 +23,7 @@ #if ENABLE(SVG) #include "RenderSVGHiddenContainer.h" - -#include "SVGStyledTransformableElement.h" #include "RenderSVGResource.h" -#include "RenderSVGShadowTreeRootContainer.h" namespace WebCore { @@ -36,27 +33,40 @@ public: RenderSVGResourceContainer(SVGStyledElement*); virtual ~RenderSVGResourceContainer(); - void idChanged(); + virtual void layout(); + virtual void destroy(); + virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle); virtual bool isSVGResourceContainer() const { return true; } virtual bool drawsContents() { return false; } - virtual RenderSVGResourceContainer* toRenderSVGResourceContainer() { return this; } - virtual bool childElementReferencesResource(const SVGRenderStyle*, const String&) const { return false; } static AffineTransform transformOnNonScalingStroke(RenderObject*, const AffineTransform& resourceTransform); - bool containsCyclicReference(const Node* startNode) const; + void idChanged(); + +protected: + enum InvalidationMode { + LayoutAndBoundariesInvalidation, + BoundariesInvalidation, + RepaintInvalidation + }; + + // Used from the invalidateClient/invalidateClients methods from classes, inheriting from us. + void markAllClientsForInvalidation(InvalidationMode); + void markClientForInvalidation(RenderObject*, InvalidationMode); private: friend class SVGResourcesCache; - - // FIXME: No-ops for now, until follow-up patch on bug 43031 lands. - void addClient(RenderObject*) { } - void removeClient(RenderObject*) { } + void addClient(RenderObject*); + void removeClient(RenderObject*); private: + void registerResource(); + AtomicString m_id; + bool m_registered; + HashSet<RenderObject*> m_clients; }; inline RenderSVGResourceContainer* getRenderSVGResourceContainerById(Document* document, const AtomicString& id) diff --git a/WebCore/rendering/RenderSVGResourceFilter.cpp b/WebCore/rendering/RenderSVGResourceFilter.cpp index a6358f0..bc5feaf 100644 --- a/WebCore/rendering/RenderSVGResourceFilter.cpp +++ b/WebCore/rendering/RenderSVGResourceFilter.cpp @@ -60,28 +60,32 @@ RenderSVGResourceFilter::RenderSVGResourceFilter(SVGFilterElement* node) RenderSVGResourceFilter::~RenderSVGResourceFilter() { + if (m_filter.isEmpty()) + return; + deleteAllValues(m_filter); m_filter.clear(); } void RenderSVGResourceFilter::invalidateClients() { - HashMap<RenderObject*, FilterData*>::const_iterator end = m_filter.end(); - for (HashMap<RenderObject*, FilterData*>::const_iterator it = m_filter.begin(); it != end; ++it) - markForLayoutAndResourceInvalidation(it->first); + if (!m_filter.isEmpty()) { + deleteAllValues(m_filter); + m_filter.clear(); + } - deleteAllValues(m_filter); - m_filter.clear(); + markAllClientsForInvalidation(LayoutAndBoundariesInvalidation); } -void RenderSVGResourceFilter::invalidateClient(RenderObject* object) +void RenderSVGResourceFilter::invalidateClient(RenderObject* client) { - ASSERT(object); - if (!m_filter.contains(object)) - return; + ASSERT(client); + ASSERT(client->selfNeedsLayout()); + + if (m_filter.contains(client)) + delete m_filter.take(client); - delete m_filter.take(object); - markForLayoutAndResourceInvalidation(object); + markClientForInvalidation(client, BoundariesInvalidation); } PassRefPtr<SVGFilterBuilder> RenderSVGResourceFilter::buildPrimitives() diff --git a/WebCore/rendering/RenderSVGResourceGradient.cpp b/WebCore/rendering/RenderSVGResourceGradient.cpp index ce51369..73b2ab6 100644 --- a/WebCore/rendering/RenderSVGResourceGradient.cpp +++ b/WebCore/rendering/RenderSVGResourceGradient.cpp @@ -43,28 +43,32 @@ RenderSVGResourceGradient::RenderSVGResourceGradient(SVGGradientElement* node) RenderSVGResourceGradient::~RenderSVGResourceGradient() { + if (m_gradient.isEmpty()) + return; + deleteAllValues(m_gradient); m_gradient.clear(); } void RenderSVGResourceGradient::invalidateClients() { - const HashMap<RenderObject*, GradientData*>::const_iterator end = m_gradient.end(); - for (HashMap<RenderObject*, GradientData*>::const_iterator it = m_gradient.begin(); it != end; ++it) - markForLayoutAndResourceInvalidation(it->first, false); + if (!m_gradient.isEmpty()) { + deleteAllValues(m_gradient); + m_gradient.clear(); + } - deleteAllValues(m_gradient); - m_gradient.clear(); + markAllClientsForInvalidation(RepaintInvalidation); } -void RenderSVGResourceGradient::invalidateClient(RenderObject* object) +void RenderSVGResourceGradient::invalidateClient(RenderObject* client) { - ASSERT(object); - if (!m_gradient.contains(object)) - return; + ASSERT(client); + ASSERT(client->selfNeedsLayout()); + + if (m_gradient.contains(client)) + delete m_gradient.take(client); - delete m_gradient.take(object); - markForLayoutAndResourceInvalidation(object, false); + markClientForInvalidation(client, RepaintInvalidation); } #if PLATFORM(CG) diff --git a/WebCore/rendering/RenderSVGResourceMarker.cpp b/WebCore/rendering/RenderSVGResourceMarker.cpp index 4f0cace..fa00fa3 100644 --- a/WebCore/rendering/RenderSVGResourceMarker.cpp +++ b/WebCore/rendering/RenderSVGResourceMarker.cpp @@ -21,6 +21,7 @@ */ #include "config.h" + #if ENABLE(SVG) #include "RenderSVGResourceMarker.h" @@ -43,39 +44,30 @@ RenderSVGResourceMarker::RenderSVGResourceMarker(SVGMarkerElement* node) RenderSVGResourceMarker::~RenderSVGResourceMarker() { - m_marker.clear(); } void RenderSVGResourceMarker::layout() { + // Invalidate all resources if our layout changed. + if (m_everHadLayout && selfNeedsLayout()) + invalidateClients(); + // RenderSVGHiddenContainer overwrites layout(). We need the // layouting of RenderSVGContainer for calculating local // transformations and repaint. RenderSVGContainer::layout(); } -void RenderSVGResourceMarker::addClient(const RenderObject* object) -{ - m_marker.add(object); -} - void RenderSVGResourceMarker::invalidateClients() { - const HashSet<const RenderObject*>::const_iterator end = m_marker.end(); - for (HashSet<const RenderObject*>::const_iterator it = m_marker.begin(); it != end; ++it) - markForLayoutAndResourceInvalidation(const_cast<RenderObject*>(*it)); - - m_marker.clear(); + markAllClientsForInvalidation(LayoutAndBoundariesInvalidation); } -void RenderSVGResourceMarker::invalidateClient(RenderObject* object) +void RenderSVGResourceMarker::invalidateClient(RenderObject* client) { - ASSERT(object); - if (!m_marker.contains(object)) - return; - - m_marker.remove(object); - markForLayoutAndResourceInvalidation(object); + ASSERT(client); + ASSERT(client->selfNeedsLayout()); + markClientForInvalidation(client, BoundariesInvalidation); } void RenderSVGResourceMarker::applyViewportClip(PaintInfo& paintInfo) @@ -140,20 +132,11 @@ AffineTransform RenderSVGResourceMarker::markerTransformation(const FloatPoint& void RenderSVGResourceMarker::draw(PaintInfo& paintInfo, const AffineTransform& transform) { - DEFINE_STATIC_LOCAL(HashSet<RenderSVGResourceMarker*>, currentlyDrawingMarkers, ()); - - // avoid drawing circular marker references - if (currentlyDrawingMarkers.contains(this)) - return; - - currentlyDrawingMarkers.add(this); PaintInfo info(paintInfo); info.context->save(); info.applyTransform(transform); RenderSVGContainer::paint(info, 0, 0); info.context->restore(); - - currentlyDrawingMarkers.remove(this); } AffineTransform RenderSVGResourceMarker::markerContentTransformation(const AffineTransform& contentTransformation, const FloatPoint& origin, float strokeWidth) const diff --git a/WebCore/rendering/RenderSVGResourceMarker.h b/WebCore/rendering/RenderSVGResourceMarker.h index 75c442e..8509aca 100644 --- a/WebCore/rendering/RenderSVGResourceMarker.h +++ b/WebCore/rendering/RenderSVGResourceMarker.h @@ -41,7 +41,6 @@ public: virtual const char* renderName() const { return "RenderSVGResourceMarker"; } - void addClient(const RenderObject*); virtual void invalidateClients(); virtual void invalidateClient(RenderObject*); @@ -74,9 +73,6 @@ private: AffineTransform viewportTransform() const; - // Save objects using this marker for invalidation. - HashSet<const RenderObject*> m_marker; - mutable AffineTransform m_localToParentTransform; FloatRect m_viewport; }; diff --git a/WebCore/rendering/RenderSVGResourceMasker.cpp b/WebCore/rendering/RenderSVGResourceMasker.cpp index 83a64b5..2c36c96 100644 --- a/WebCore/rendering/RenderSVGResourceMasker.cpp +++ b/WebCore/rendering/RenderSVGResourceMasker.cpp @@ -19,6 +19,7 @@ */ #include "config.h" + #if ENABLE(SVG) #include "RenderSVGResourceMasker.h" @@ -51,37 +52,33 @@ RenderSVGResourceMasker::RenderSVGResourceMasker(SVGMaskElement* node) RenderSVGResourceMasker::~RenderSVGResourceMasker() { + if (m_masker.isEmpty()) + return; + deleteAllValues(m_masker); m_masker.clear(); } void RenderSVGResourceMasker::invalidateClients() { - HashMap<RenderObject*, MaskerData*>::const_iterator end = m_masker.end(); - for (HashMap<RenderObject*, MaskerData*>::const_iterator it = m_masker.begin(); it != end; ++it) - markForLayoutAndResourceInvalidation(it->first); - - deleteAllValues(m_masker); - m_masker.clear(); m_maskBoundaries = FloatRect(); -} - -void RenderSVGResourceMasker::invalidateClient(RenderObject* object) -{ - ASSERT(object); - if (!m_masker.contains(object)) - return; + if (!m_masker.isEmpty()) { + deleteAllValues(m_masker); + m_masker.clear(); + } - delete m_masker.take(object); - markForLayoutAndResourceInvalidation(object); + markAllClientsForInvalidation(LayoutAndBoundariesInvalidation); } -bool RenderSVGResourceMasker::childElementReferencesResource(const SVGRenderStyle* style, const String& referenceId) const +void RenderSVGResourceMasker::invalidateClient(RenderObject* client) { - if (!style->hasMasker()) - return false; + ASSERT(client); + ASSERT(client->selfNeedsLayout()); - return style->maskerResource() == referenceId; + if (m_masker.contains(client)) + delete m_masker.take(client); + + markClientForInvalidation(client, BoundariesInvalidation); } bool RenderSVGResourceMasker::applyResource(RenderObject* object, RenderStyle*, GraphicsContext*& context, unsigned short resourceMode) @@ -102,11 +99,6 @@ bool RenderSVGResourceMasker::applyResource(RenderObject* object, RenderStyle*, SVGMaskElement* maskElement = static_cast<SVGMaskElement*>(node()); if (!maskElement) return false; - - // Early exit, if this resource contains a child which references ourselves. - if (containsCyclicReference(node())) - return false; - createMaskImage(maskerData, maskElement, object); } diff --git a/WebCore/rendering/RenderSVGResourceMasker.h b/WebCore/rendering/RenderSVGResourceMasker.h index 56f657b..f6301cb 100644 --- a/WebCore/rendering/RenderSVGResourceMasker.h +++ b/WebCore/rendering/RenderSVGResourceMasker.h @@ -69,8 +69,6 @@ private: void createMaskImage(MaskerData*, const SVGMaskElement*, RenderObject*); void calculateMaskContentRepaintRect(); - virtual bool childElementReferencesResource(const SVGRenderStyle*, const String&) const; - FloatRect m_maskBoundaries; HashMap<RenderObject*, MaskerData*> m_masker; }; diff --git a/WebCore/rendering/RenderSVGResourcePattern.cpp b/WebCore/rendering/RenderSVGResourcePattern.cpp index a2234c8..902ff02 100644 --- a/WebCore/rendering/RenderSVGResourcePattern.cpp +++ b/WebCore/rendering/RenderSVGResourcePattern.cpp @@ -40,43 +40,32 @@ RenderSVGResourcePattern::RenderSVGResourcePattern(SVGPatternElement* node) RenderSVGResourcePattern::~RenderSVGResourcePattern() { - deleteAllValues(m_pattern); - m_pattern.clear(); -} - -void RenderSVGResourcePattern::invalidateClients() -{ - const HashMap<RenderObject*, PatternData*>::const_iterator end = m_pattern.end(); - for (HashMap<RenderObject*, PatternData*>::const_iterator it = m_pattern.begin(); it != end; ++it) - markForLayoutAndResourceInvalidation(it->first, false); + if (m_pattern.isEmpty()) + return; deleteAllValues(m_pattern); m_pattern.clear(); } -void RenderSVGResourcePattern::invalidateClient(RenderObject* object) +void RenderSVGResourcePattern::invalidateClients() { - ASSERT(object); - if (!m_pattern.contains(object)) - return; + if (!m_pattern.isEmpty()) { + deleteAllValues(m_pattern); + m_pattern.clear(); + } - delete m_pattern.take(object); - markForLayoutAndResourceInvalidation(object, false); + markAllClientsForInvalidation(RepaintInvalidation); } -bool RenderSVGResourcePattern::childElementReferencesResource(const SVGRenderStyle* style, const String& referenceId) const +void RenderSVGResourcePattern::invalidateClient(RenderObject* client) { - if (style->hasFill()) { - if (style->fillPaint()->matchesTargetURI(referenceId)) - return true; - } + ASSERT(client); + ASSERT(client->selfNeedsLayout()); - if (style->hasStroke()) { - if (style->strokePaint()->matchesTargetURI(referenceId)) - return true; - } + if (m_pattern.contains(client)) + delete m_pattern.take(client); - return false; + markClientForInvalidation(client, RepaintInvalidation); } bool RenderSVGResourcePattern::applyResource(RenderObject* object, RenderStyle* style, GraphicsContext*& context, unsigned short resourceMode) @@ -244,10 +233,6 @@ PassOwnPtr<ImageBuffer> RenderSVGResourcePattern::createTileImage(PatternData* p if (!attributes.patternContentElement()) return 0; - // Early exit, if this resource contains a child which references ourselves. - if (containsCyclicReference(attributes.patternContentElement())) - return 0; - FloatRect objectBoundingBox = object->objectBoundingBox(); FloatRect patternBoundaries = calculatePatternBoundaries(attributes, objectBoundingBox, patternElement); AffineTransform patternTransform = attributes.patternTransform(); diff --git a/WebCore/rendering/RenderSVGResourcePattern.h b/WebCore/rendering/RenderSVGResourcePattern.h index ec89777..690b0de 100644 --- a/WebCore/rendering/RenderSVGResourcePattern.h +++ b/WebCore/rendering/RenderSVGResourcePattern.h @@ -67,8 +67,6 @@ private: FloatRect calculatePatternBoundariesIncludingOverflow(PatternAttributes&, const FloatRect& objectBoundingBox, const AffineTransform& viewBoxCTM, const FloatRect& patternBoundaries) const; - virtual bool childElementReferencesResource(const SVGRenderStyle*, const String&) const; - HashMap<RenderObject*, PatternData*> m_pattern; }; diff --git a/WebCore/rendering/RenderSVGRoot.cpp b/WebCore/rendering/RenderSVGRoot.cpp index 1659e40..7ddebf2 100644 --- a/WebCore/rendering/RenderSVGRoot.cpp +++ b/WebCore/rendering/RenderSVGRoot.cpp @@ -26,14 +26,19 @@ #include "RenderSVGRoot.h" #include "GraphicsContext.h" +<<<<<<< HEAD #ifdef ANDROID_HITTEST_WITHSIZE #include "HitTestResult.h" #endif +======= +#include "HitTestResult.h" +>>>>>>> webkit.org at r64523 #include "RenderSVGContainer.h" #include "RenderSVGResource.h" #include "RenderView.h" #include "SVGLength.h" #include "SVGRenderSupport.h" +#include "SVGResources.h" #include "SVGSVGElement.h" #include "SVGStyledElement.h" #include "TransformState.h" @@ -131,15 +136,14 @@ void RenderSVGRoot::layout() setNeedsLayout(false); } -bool RenderSVGRoot::selfWillPaint() const +bool RenderSVGRoot::selfWillPaint() { #if ENABLE(FILTERS) - const SVGRenderStyle* svgStyle = style()->svgStyle(); - RenderSVGResourceFilter* filter = getRenderSVGResourceById<RenderSVGResourceFilter>(document(), svgStyle->filterResource()); - if (filter) - return true; -#endif + SVGResources* resources = SVGResourcesCache::cachedResourcesForRenderObject(this); + return resources && resources->filter(); +#else return false; +#endif } void RenderSVGRoot::paint(PaintInfo& paintInfo, int parentX, int parentY) @@ -194,10 +198,22 @@ void RenderSVGRoot::paint(PaintInfo& paintInfo, int parentX, int parentY) void RenderSVGRoot::destroy() { - RenderSVGResource::invalidateAllResourcesOfRenderer(this); + SVGResourcesCache::clientDestroyed(this); RenderBox::destroy(); } +void RenderSVGRoot::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle) +{ + RenderBox::styleDidChange(diff, oldStyle); + SVGResourcesCache::clientStyleChanged(this, diff, style()); +} + +void RenderSVGRoot::updateFromElement() +{ + RenderBox::updateFromElement(); + SVGResourcesCache::clientUpdatedFromElement(this, style()); +} + void RenderSVGRoot::calcViewport() { SVGSVGElement* svg = static_cast<SVGSVGElement*>(node()); @@ -322,6 +338,7 @@ bool RenderSVGRoot::nodeAtPoint(const HitTestRequest& request, HitTestResult& re if (child->nodeAtFloatPoint(request, result, localPoint, hitTestAction)) { // FIXME: CSS/HTML assumes the local point is relative to the border box, right? updateHitTestResult(result, pointInBorderBox); +<<<<<<< HEAD #ifdef ANDROID_HITTEST_WITHSIZE // TODO: nodeAtFloatPoint() doesn't handle region test yet. if (result.isRegionTest()) { @@ -329,6 +346,10 @@ bool RenderSVGRoot::nodeAtPoint(const HitTestRequest& request, HitTestResult& re result.addRawNode(node()); } else #endif +======= + // FIXME: nodeAtFloatPoint() doesn't handle rect-based hit tests yet. + result.addNodeToRectBasedTestResult(child->node(), _x, _y); +>>>>>>> webkit.org at r64523 return true; } } diff --git a/WebCore/rendering/RenderSVGRoot.h b/WebCore/rendering/RenderSVGRoot.h index 0a08ab5..b90113c 100644 --- a/WebCore/rendering/RenderSVGRoot.h +++ b/WebCore/rendering/RenderSVGRoot.h @@ -58,6 +58,8 @@ private: virtual void paint(PaintInfo&, int parentX, int parentY); virtual void destroy(); + virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle); + virtual void updateFromElement(); virtual const AffineTransform& localToParentTransform() const; @@ -77,7 +79,7 @@ private: void calcViewport(); - bool selfWillPaint() const; + bool selfWillPaint(); IntSize parentOriginToBorderBox() const; IntSize borderOriginToContentBox() const; diff --git a/WebCore/rendering/RenderSVGText.cpp b/WebCore/rendering/RenderSVGText.cpp index 58348db..c4fc353 100644 --- a/WebCore/rendering/RenderSVGText.cpp +++ b/WebCore/rendering/RenderSVGText.cpp @@ -98,9 +98,9 @@ void RenderSVGText::layout() ASSERT(childrenInline()); forceLayoutInlineChildren(); - // Invalidate all resources of this client, if we changed something. + // Invalidate all resources of this client if our layout changed. if (m_everHadLayout && selfNeedsLayout()) - RenderSVGResource::invalidateAllResourcesOfRenderer(this); + SVGResourcesCache::clientLayoutChanged(this); repainter.repaintAfterLayout(); setNeedsLayout(false); @@ -132,12 +132,6 @@ bool RenderSVGText::nodeAtFloatPoint(const HitTestRequest& request, HitTestResul return false; } -void RenderSVGText::destroy() -{ - RenderSVGResource::invalidateAllResourcesOfRenderer(this); - RenderSVGBlock::destroy(); -} - bool RenderSVGText::nodeAtPoint(const HitTestRequest&, HitTestResult&, int, int, int, int, HitTestAction) { ASSERT_NOT_REACHED(); diff --git a/WebCore/rendering/RenderSVGText.h b/WebCore/rendering/RenderSVGText.h index 6e7d03a..be19419 100644 --- a/WebCore/rendering/RenderSVGText.h +++ b/WebCore/rendering/RenderSVGText.h @@ -51,8 +51,6 @@ private: virtual bool requiresLayer() const { return false; } virtual void layout(); - virtual void destroy(); - virtual void absoluteQuads(Vector<FloatQuad>&); virtual IntRect clippedOverflowRectForRepaint(RenderBoxModelObject* repaintContainer); diff --git a/WebCore/rendering/RenderScrollbar.cpp b/WebCore/rendering/RenderScrollbar.cpp index 63fce8d..817dd02 100644 --- a/WebCore/rendering/RenderScrollbar.cpp +++ b/WebCore/rendering/RenderScrollbar.cpp @@ -130,6 +130,9 @@ ScrollbarPart RenderScrollbar::partForStyleResolve() PassRefPtr<RenderStyle> RenderScrollbar::getScrollbarPseudoStyle(ScrollbarPart partType, PseudoId pseudoId) { + if (!m_owner) + return 0; + s_styleResolvePart = partType; s_styleResolveScrollbar = this; RefPtr<RenderStyle> result = m_owner->getUncachedPseudoStyle(pseudoId, m_owner->style()); diff --git a/WebCore/rendering/RenderScrollbar.h b/WebCore/rendering/RenderScrollbar.h index b3c00ef..8cc263a 100644 --- a/WebCore/rendering/RenderScrollbar.h +++ b/WebCore/rendering/RenderScrollbar.h @@ -49,6 +49,7 @@ public: static RenderScrollbar* scrollbarForStyleResolve(); RenderBox* owningRenderer() const { return m_owner; } + void clearOwningRenderer() { m_owner = 0; } void paintPart(GraphicsContext*, ScrollbarPart, const IntRect&); diff --git a/WebCore/rendering/RenderTable.cpp b/WebCore/rendering/RenderTable.cpp index 6359c09..7c54837 100644 --- a/WebCore/rendering/RenderTable.cpp +++ b/WebCore/rendering/RenderTable.cpp @@ -31,9 +31,13 @@ #include "Document.h" #include "FixedTableLayout.h" #include "FrameView.h" +<<<<<<< HEAD #ifdef ANDROID_HITTEST_WITHSIZE #include "HitTestResult.h" #endif +======= +#include "HitTestResult.h" +>>>>>>> webkit.org at r64523 #include "HTMLNames.h" #include "RenderLayer.h" #include "RenderTableCell.h" @@ -1183,11 +1187,15 @@ bool RenderTable::nodeAtPoint(const HitTestRequest& request, HitTestResult& resu ty += y(); // Check kids first. +<<<<<<< HEAD #ifdef ANDROID_HITTEST_WITHSIZE if (!hasOverflowClip() || result.intersects(xPos, yPos, overflowClipRect(tx, ty))) { #else if (!hasOverflowClip() || overflowClipRect(tx, ty).contains(xPos, yPos)) { #endif +======= + if (!hasOverflowClip() || overflowClipRect(tx, ty).intersects(result.rectFromPoint(xPos, yPos))) { +>>>>>>> webkit.org at r64523 for (RenderObject* child = lastChild(); child; child = child->previousSibling()) { if (child->isBox() && !toRenderBox(child)->hasSelfPaintingLayer() && (child->isTableSection() || child == m_caption) && child->nodeAtPoint(request, result, xPos, yPos, tx, ty, action)) { @@ -1198,6 +1206,7 @@ bool RenderTable::nodeAtPoint(const HitTestRequest& request, HitTestResult& resu } // Check our bounds next. +<<<<<<< HEAD #ifdef ANDROID_HITTEST_WITHSIZE IntRect boundsRect = IntRect(tx, ty, width(), height()); if (visibleToHitTesting() && (action == HitTestBlockBackground || action == HitTestChildBlockBackground) && result.intersects(xPos, yPos, boundsRect)) { @@ -1214,6 +1223,13 @@ bool RenderTable::nodeAtPoint(const HitTestRequest& request, HitTestResult& resu } #endif return true; +======= + IntRect boundsRect = IntRect(tx, ty, width(), height()); + if (visibleToHitTesting() && (action == HitTestBlockBackground || action == HitTestChildBlockBackground) && boundsRect.intersects(result.rectFromPoint(xPos, yPos))) { + updateHitTestResult(result, IntPoint(xPos - tx, yPos - ty)); + if (!result.addNodeToRectBasedTestResult(node(), xPos, yPos, boundsRect)) + return true; +>>>>>>> webkit.org at r64523 } return false; diff --git a/WebCore/rendering/RenderTableSection.cpp b/WebCore/rendering/RenderTableSection.cpp index c439a13..e094f36 100644 --- a/WebCore/rendering/RenderTableSection.cpp +++ b/WebCore/rendering/RenderTableSection.cpp @@ -28,9 +28,13 @@ #include "CachedImage.h" #include "Document.h" +<<<<<<< HEAD #ifdef ANDROID_HITTEST_WITHSIZE #include "HitTestResult.h" #endif +======= +#include "HitTestResult.h" +>>>>>>> webkit.org at r64523 #include "HTMLNames.h" #include "RenderTableCell.h" #include "RenderTableCol.h" @@ -1289,11 +1293,15 @@ bool RenderTableSection::nodeAtPoint(const HitTestRequest& request, HitTestResul tx += x(); ty += y(); +<<<<<<< HEAD #ifdef ANDROID_HITTEST_WITHSIZE if (hasOverflowClip() && !result.intersects(xPos, yPos, overflowClipRect(tx, ty))) #else if (hasOverflowClip() && !overflowClipRect(tx, ty).contains(xPos, yPos)) #endif +======= + if (hasOverflowClip() && !overflowClipRect(tx, ty).intersects(result.rectFromPoint(xPos, yPos))) +>>>>>>> webkit.org at r64523 return false; for (RenderObject* child = lastChild(); child; child = child->previousSibling()) { diff --git a/WebCore/rendering/RenderTextControlSingleLine.cpp b/WebCore/rendering/RenderTextControlSingleLine.cpp index 5b57513..4ba2dc7 100644 --- a/WebCore/rendering/RenderTextControlSingleLine.cpp +++ b/WebCore/rendering/RenderTextControlSingleLine.cpp @@ -2,6 +2,7 @@ * Copyright (C) 2006, 2007, 2010 Apple Inc. All rights reserved. * (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/) * Copyright (C) 2010 Google 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 * modify it under the terms of the GNU Library General Public @@ -23,6 +24,7 @@ #include "config.h" #include "RenderTextControlSingleLine.h" +#include "Chrome.h" #include "CSSStyleSelector.h" #include "Event.h" #include "EventNames.h" @@ -38,7 +40,6 @@ #include "RenderLayer.h" #include "RenderScrollbar.h" #include "RenderTheme.h" -#include "SearchPopupMenu.h" #include "SelectionController.h" #include "Settings.h" #include "SimpleFontData.h" @@ -62,7 +63,7 @@ RenderTextControlSingleLine::RenderTextControlSingleLine(Node* node, bool placeh RenderTextControlSingleLine::~RenderTextControlSingleLine() { if (m_searchPopup) { - m_searchPopup->disconnectClient(); + m_searchPopup->popupMenu()->disconnectClient(); m_searchPopup = 0; } @@ -107,7 +108,7 @@ void RenderTextControlSingleLine::addSearchResult() const AtomicString& name = autosaveName(); if (!m_searchPopup) - m_searchPopup = SearchPopupMenu::create(this); + m_searchPopup = document()->page()->chrome()->createSearchPopupMenu(this); m_searchPopup->saveRecentSearches(name, m_recentSearches); } @@ -125,7 +126,7 @@ void RenderTextControlSingleLine::showPopup() return; if (!m_searchPopup) - m_searchPopup = SearchPopupMenu::create(this); + m_searchPopup = document()->page()->chrome()->createSearchPopupMenu(this); if (!m_searchPopup->enabled()) return; @@ -145,14 +146,14 @@ void RenderTextControlSingleLine::showPopup() m_searchPopup->saveRecentSearches(name, m_recentSearches); } - m_searchPopup->show(absoluteBoundingBoxRect(true), document()->view(), -1); + m_searchPopup->popupMenu()->show(absoluteBoundingBoxRect(true), document()->view(), -1); } void RenderTextControlSingleLine::hidePopup() { ASSERT(node()->isHTMLElement()); if (m_searchPopup) - m_searchPopup->hide(); + m_searchPopup->popupMenu()->hide(); } void RenderTextControlSingleLine::subtreeHasChanged() @@ -689,7 +690,7 @@ void RenderTextControlSingleLine::updateFromElement() } if (m_searchPopupIsVisible) - m_searchPopup->updateFromElement(); + m_searchPopup->popupMenu()->updateFromElement(); } void RenderTextControlSingleLine::cacheSelection(int start, int end) @@ -887,7 +888,7 @@ void RenderTextControlSingleLine::valueChanged(unsigned listIndex, bool fireEven const AtomicString& name = autosaveName(); if (!name.isEmpty()) { if (!m_searchPopup) - m_searchPopup = SearchPopupMenu::create(this); + m_searchPopup = document()->page()->chrome()->createSearchPopupMenu(this); m_searchPopup->saveRecentSearches(name, m_recentSearches); } } diff --git a/WebCore/rendering/RenderTextControlSingleLine.h b/WebCore/rendering/RenderTextControlSingleLine.h index 8c7e844..4bc80cf 100644 --- a/WebCore/rendering/RenderTextControlSingleLine.h +++ b/WebCore/rendering/RenderTextControlSingleLine.h @@ -1,6 +1,7 @@ /* * Copyright (C) 2006, 2007, 2009 Apple Inc. All rights reserved. * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/) + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -24,6 +25,7 @@ #include "PopupMenuClient.h" #include "RenderTextControl.h" +#include "SearchPopupMenu.h" #include "Timer.h" namespace WebCore { @@ -32,7 +34,6 @@ class InputElement; class InputFieldSpeechButtonElement; class SearchFieldCancelButtonElement; class SearchFieldResultsButtonElement; -class SearchPopupMenu; class SpinButtonElement; class TextControlInnerElement; diff --git a/WebCore/rendering/RenderWidget.cpp b/WebCore/rendering/RenderWidget.cpp index bebe6c8..3854e6a 100644 --- a/WebCore/rendering/RenderWidget.cpp +++ b/WebCore/rendering/RenderWidget.cpp @@ -396,7 +396,7 @@ bool RenderWidget::nodeAtPoint(const HitTestRequest& request, HitTestResult& res bool inside = RenderReplaced::nodeAtPoint(request, result, x, y, tx, ty, action); // Check to see if we are really over the widget itself (and not just in the border/padding area). - if (inside && !hadResult && result.innerNode() == node()) + if ((inside || result.isRectBasedTest()) && !hadResult && result.innerNode() == node()) result.setIsOverWidget(contentBoxRect().contains(result.localPoint())); #ifdef ANDROID_HITTEST_WITHSIZE else if (result.isRegionTest() && !hadResult && result.innerNode() == node()) { diff --git a/WebCore/rendering/SVGInlineTextBox.cpp b/WebCore/rendering/SVGInlineTextBox.cpp index 8e498ad..a293124 100644 --- a/WebCore/rendering/SVGInlineTextBox.cpp +++ b/WebCore/rendering/SVGInlineTextBox.cpp @@ -295,17 +295,16 @@ void SVGInlineTextBox::paint(PaintInfo& paintInfo, int, int) ASSERT(!m_paintingResource); } -bool SVGInlineTextBox::acquirePaintingResource(GraphicsContext*& context, RenderStyle* style) +bool SVGInlineTextBox::acquirePaintingResource(GraphicsContext*& context, RenderObject* renderer, RenderStyle* style) { + ASSERT(renderer); + ASSERT(style); ASSERT(m_paintingResourceMode != ApplyToDefaultMode); - RenderObject* parentRenderer = parent()->renderer(); - ASSERT(parentRenderer); - if (m_paintingResourceMode & ApplyToFillMode) - m_paintingResource = RenderSVGResource::fillPaintingResource(parentRenderer, style); + m_paintingResource = RenderSVGResource::fillPaintingResource(renderer, style); else if (m_paintingResourceMode & ApplyToStrokeMode) - m_paintingResource = RenderSVGResource::strokePaintingResource(parentRenderer, style); + m_paintingResource = RenderSVGResource::strokePaintingResource(renderer, style); else { // We're either called for stroking or filling. ASSERT_NOT_REACHED(); @@ -314,7 +313,7 @@ bool SVGInlineTextBox::acquirePaintingResource(GraphicsContext*& context, Render if (!m_paintingResource) return false; - m_paintingResource->applyResource(parentRenderer, style, context, m_paintingResourceMode); + m_paintingResource->applyResource(renderer, style, context, m_paintingResourceMode); return true; } @@ -331,7 +330,7 @@ void SVGInlineTextBox::releasePaintingResource(GraphicsContext*& context) bool SVGInlineTextBox::prepareGraphicsContextForTextPainting(GraphicsContext*& context, TextRun& textRun, RenderStyle* style) { - bool acquiredResource = acquirePaintingResource(context, style); + bool acquiredResource = acquirePaintingResource(context, parent()->renderer(), style); #if ENABLE(SVG_FONTS) // SVG Fonts need access to the painting resource used to draw the current text chunk. @@ -508,21 +507,24 @@ void SVGInlineTextBox::paintDecoration(GraphicsContext* context, const FloatPoin if (hasDecorationFill) { m_paintingResourceMode = ApplyToFillMode; - paintDecorationWithStyle(context, textOrigin, decorationStyle, decoration); + paintDecorationWithStyle(context, textOrigin, decorationRenderer, decoration); } if (hasDecorationStroke) { m_paintingResourceMode = ApplyToStrokeMode; - paintDecorationWithStyle(context, textOrigin, decorationStyle, decoration); + paintDecorationWithStyle(context, textOrigin, decorationRenderer, decoration); } } -void SVGInlineTextBox::paintDecorationWithStyle(GraphicsContext* context, const FloatPoint& textOrigin, RenderStyle* decorationStyle, ETextDecoration decoration) +void SVGInlineTextBox::paintDecorationWithStyle(GraphicsContext* context, const FloatPoint& textOrigin, RenderObject* decorationRenderer, ETextDecoration decoration) { ASSERT(!m_paintingResource); ASSERT(m_paintingResourceMode != ApplyToDefaultMode); ASSERT(m_currentChunkPart.isValid()); + RenderStyle* decorationStyle = decorationRenderer->style(); + ASSERT(decorationStyle); + const Font& font = decorationStyle->font(); // The initial y value refers to overline position. @@ -534,7 +536,7 @@ void SVGInlineTextBox::paintDecorationWithStyle(GraphicsContext* context, const context->beginPath(); context->addPath(Path::createRectangle(FloatRect(x, y, m_currentChunkPart.width, thickness))); - if (acquirePaintingResource(context, decorationStyle)) + if (acquirePaintingResource(context, decorationRenderer, decorationStyle)) releasePaintingResource(context); context->restore(); @@ -614,9 +616,15 @@ void SVGInlineTextBox::paintText(GraphicsContext* context, const FloatPoint& tex paintTextWithShadows(context, textOrigin, style, textRun, 0, startPos); // Draw text using selection style from the start to the end position of the selection + if (style != selectionStyle) + SVGResourcesCache::clientStyleChanged(parent()->renderer(), StyleDifferenceRepaint, selectionStyle); + TextRun selectionTextRun(constructTextRun(selectionStyle)); paintTextWithShadows(context, textOrigin, selectionStyle, textRun, startPos, endPos); + if (style != selectionStyle) + SVGResourcesCache::clientStyleChanged(parent()->renderer(), StyleDifferenceRepaint, style); + // Eventually draw text using regular style from the end position of the selection to the end of the current chunk part if (endPos < m_currentChunkPart.length && !paintSelectedTextOnly) paintTextWithShadows(context, textOrigin, style, textRun, endPos, m_currentChunkPart.length); diff --git a/WebCore/rendering/SVGInlineTextBox.h b/WebCore/rendering/SVGInlineTextBox.h index 602fff1..7711db4 100644 --- a/WebCore/rendering/SVGInlineTextBox.h +++ b/WebCore/rendering/SVGInlineTextBox.h @@ -75,7 +75,7 @@ private: TextRun constructTextRun(RenderStyle*) const; AffineTransform buildChunkTransformation(SVGChar& firstCharacter) const; - bool acquirePaintingResource(GraphicsContext*&, RenderStyle*); + bool acquirePaintingResource(GraphicsContext*&, RenderObject*, RenderStyle*); void releasePaintingResource(GraphicsContext*&); bool prepareGraphicsContextForTextPainting(GraphicsContext*&, TextRun&, RenderStyle*); @@ -83,7 +83,7 @@ private: void computeTextMatchMarkerRect(RenderStyle*); void paintDecoration(GraphicsContext*, const FloatPoint& textOrigin, ETextDecoration, bool hasSelection); - void paintDecorationWithStyle(GraphicsContext*, const FloatPoint& textOrigin, RenderStyle*, ETextDecoration); + void paintDecorationWithStyle(GraphicsContext*, const FloatPoint& textOrigin, RenderObject*, ETextDecoration); void paintSelection(GraphicsContext*, const FloatPoint& textOrigin, RenderStyle*); void paintText(GraphicsContext*, const FloatPoint& textOrigin, RenderStyle*, RenderStyle* selectionStyle, bool hasSelection, bool paintSelectedTextOnly); void paintTextWithShadows(GraphicsContext*, const FloatPoint& textOrigin, RenderStyle*, TextRun&, int startPos, int endPos); diff --git a/WebCore/rendering/SVGRenderSupport.cpp b/WebCore/rendering/SVGRenderSupport.cpp index 0d4a42b..34f6659 100644 --- a/WebCore/rendering/SVGRenderSupport.cpp +++ b/WebCore/rendering/SVGRenderSupport.cpp @@ -40,6 +40,7 @@ #include "RenderSVGResourceMarker.h" #include "RenderSVGResourceMasker.h" #include "RenderSVGRoot.h" +#include "SVGResources.h" #include "SVGStyledElement.h" #include "TransformState.h" #include <wtf/UnusedParam.h> @@ -79,10 +80,7 @@ void SVGRenderSupport::mapLocalToContainer(const RenderObject* object, RenderBox bool SVGRenderSupport::prepareToRenderSVGContent(RenderObject* object, PaintInfo& paintInfo) { ASSERT(object); - SVGElement* svgElement = static_cast<SVGElement*>(object->node()); - ASSERT(svgElement && svgElement->document() && svgElement->isStyled()); - SVGStyledElement* styledElement = static_cast<SVGStyledElement*>(svgElement); RenderStyle* style = object->style(); ASSERT(style); @@ -109,33 +107,22 @@ bool SVGRenderSupport::prepareToRenderSVGContent(RenderObject* object, PaintInfo paintInfo.context->beginTransparencyLayer(1); } - Document* document = object->document(); + SVGResources* resources = SVGResourcesCache::cachedResourcesForRenderObject(object); + if (!resources) + return true; - if (svgStyle->hasMasker()) { - AtomicString maskerId(svgStyle->maskerResource()); - if (RenderSVGResourceMasker* masker = getRenderSVGResourceById<RenderSVGResourceMasker>(document, maskerId)) { - if (!masker->applyResource(object, style, paintInfo.context, ApplyToDefaultMode)) - return false; - } else - document->accessSVGExtensions()->addPendingResource(maskerId, styledElement); + if (RenderSVGResourceMasker* masker = resources->masker()) { + if (!masker->applyResource(object, style, paintInfo.context, ApplyToDefaultMode)) + return false; } - if (svgStyle->hasClipper()) { - AtomicString clipperId(svgStyle->clipperResource()); - if (RenderSVGResourceClipper* clipper = getRenderSVGResourceById<RenderSVGResourceClipper>(document, clipperId)) - clipper->applyResource(object, style, paintInfo.context, ApplyToDefaultMode); - else - document->accessSVGExtensions()->addPendingResource(clipperId, styledElement); - } + if (RenderSVGResourceClipper* clipper = resources->clipper()) + clipper->applyResource(object, style, paintInfo.context, ApplyToDefaultMode); #if ENABLE(FILTERS) - if (svgStyle->hasFilter()) { - AtomicString filterId(svgStyle->filterResource()); - if (RenderSVGResourceFilter* filter = getRenderSVGResourceById<RenderSVGResourceFilter>(document, filterId)) { - if (!filter->applyResource(object, style, paintInfo.context, ApplyToDefaultMode)) - return false; - } else - document->accessSVGExtensions()->addPendingResource(filterId, styledElement); + if (RenderSVGResourceFilter* filter = resources->filter()) { + if (!filter->applyResource(object, style, paintInfo.context, ApplyToDefaultMode)) + return false; } #endif @@ -157,9 +144,9 @@ void SVGRenderSupport::finishRenderSVGContent(RenderObject* object, PaintInfo& p ASSERT(svgStyle); #if ENABLE(FILTERS) - if (svgStyle->hasFilter()) { - AtomicString filterId(svgStyle->filterResource()); - if (RenderSVGResourceFilter* filter = getRenderSVGResourceById<RenderSVGResourceFilter>(object->document(), filterId)) { + SVGResources* resources = SVGResourcesCache::cachedResourcesForRenderObject(object); + if (resources) { + if (RenderSVGResourceFilter* filter = resources->filter()) { filter->postApplyResource(object, paintInfo.context, ApplyToDefaultMode); paintInfo.context = savedContext; } @@ -289,49 +276,46 @@ bool SVGRenderSupport::isOverflowHidden(const RenderObject* object) void SVGRenderSupport::intersectRepaintRectWithResources(const RenderObject* object, FloatRect& repaintRect) { ASSERT(object); - ASSERT(object->style()); - const SVGRenderStyle* svgStyle = object->style()->svgStyle(); - if (!svgStyle) - return; - + + RenderStyle* style = object->style(); + ASSERT(style); + + const SVGRenderStyle* svgStyle = style->svgStyle(); + ASSERT(svgStyle); + RenderObject* renderer = const_cast<RenderObject*>(object); -#if ENABLE(FILTERS) - if (svgStyle->hasFilter()) { - if (RenderSVGResourceFilter* filter = getRenderSVGResourceById<RenderSVGResourceFilter>(object->document(), svgStyle->filterResource())) - repaintRect = filter->resourceBoundingBox(renderer); + SVGResources* resources = SVGResourcesCache::cachedResourcesForRenderObject(renderer); + if (!resources) { + svgStyle->inflateForShadow(repaintRect); + return; } + +#if ENABLE(FILTERS) + if (RenderSVGResourceFilter* filter = resources->filter()) + repaintRect = filter->resourceBoundingBox(renderer); #endif - if (svgStyle->hasClipper()) { - if (RenderSVGResourceClipper* clipper = getRenderSVGResourceById<RenderSVGResourceClipper>(object->document(), svgStyle->clipperResource())) - repaintRect.intersect(clipper->resourceBoundingBox(renderer)); - } - - if (svgStyle->hasMasker()) { - if (RenderSVGResourceMasker* masker = getRenderSVGResourceById<RenderSVGResourceMasker>(object->document(), svgStyle->maskerResource())) - repaintRect.intersect(masker->resourceBoundingBox(renderer)); - } - + if (RenderSVGResourceClipper* clipper = resources->clipper()) + repaintRect.intersect(clipper->resourceBoundingBox(renderer)); + + if (RenderSVGResourceMasker* masker = resources->masker()) + repaintRect.intersect(masker->resourceBoundingBox(renderer)); + svgStyle->inflateForShadow(repaintRect); } -bool SVGRenderSupport::pointInClippingArea(const RenderObject* object, const FloatPoint& point) +bool SVGRenderSupport::pointInClippingArea(RenderObject* object, const FloatPoint& point) { ASSERT(object); - ASSERT(object->style()); - - Document* document = object->document(); - ASSERT(document); - - const SVGRenderStyle* svgStyle = object->style()->svgStyle(); - ASSERT(svgStyle); // We just take clippers into account to determine if a point is on the node. The Specification may // change later and we also need to check maskers. - if (svgStyle->hasClipper()) { - if (RenderSVGResourceClipper* clipper = getRenderSVGResourceById<RenderSVGResourceClipper>(document, svgStyle->clipperResource())) - return clipper->hitTestClipContent(object->objectBoundingBox(), point); - } + SVGResources* resources = SVGResourcesCache::cachedResourcesForRenderObject(object); + if (!resources) + return true; + + if (RenderSVGResourceClipper* clipper = resources->clipper()) + return clipper->hitTestClipContent(object->objectBoundingBox(), point); return true; } diff --git a/WebCore/rendering/SVGRenderSupport.h b/WebCore/rendering/SVGRenderSupport.h index 8eb486e6..371ac75 100644 --- a/WebCore/rendering/SVGRenderSupport.h +++ b/WebCore/rendering/SVGRenderSupport.h @@ -56,7 +56,7 @@ public: static void intersectRepaintRectWithResources(const RenderObject*, FloatRect&); // Determines whether the passed point lies in a clipping area - static bool pointInClippingArea(const RenderObject*, const FloatPoint&); + static bool pointInClippingArea(RenderObject*, const FloatPoint&); enum ContainerBoundingBoxMode { ObjectBoundingBox, diff --git a/WebCore/rendering/SVGRenderTreeAsText.cpp b/WebCore/rendering/SVGRenderTreeAsText.cpp index bec78e7..d298544 100644 --- a/WebCore/rendering/SVGRenderTreeAsText.cpp +++ b/WebCore/rendering/SVGRenderTreeAsText.cpp @@ -366,7 +366,7 @@ static void writeStyle(TextStream& ts, const RenderObject& object) if (object.isRenderPath()) { const RenderPath& path = static_cast<const RenderPath&>(object); - if (RenderSVGResource* strokePaintingResource = RenderSVGResource::strokePaintingResource(&path, path.style())) { + if (RenderSVGResource* strokePaintingResource = RenderSVGResource::strokePaintingResource(const_cast<RenderPath*>(&path), path.style())) { TextStreamSeparator s(" "); ts << " [stroke={" << s; writeSVGPaintingResource(ts, strokePaintingResource); @@ -387,7 +387,7 @@ static void writeStyle(TextStream& ts, const RenderObject& object) ts << "}]"; } - if (RenderSVGResource* fillPaintingResource = RenderSVGResource::fillPaintingResource(&path, path.style())) { + if (RenderSVGResource* fillPaintingResource = RenderSVGResource::fillPaintingResource(const_cast<RenderPath*>(&path), path.style())) { TextStreamSeparator s(" "); ts << " [fill={" << s; writeSVGPaintingResource(ts, fillPaintingResource); @@ -734,6 +734,8 @@ void writeResources(TextStream& ts, const RenderObject& object, int indent) const RenderStyle* style = object.style(); const SVGRenderStyle* svgStyle = style->svgStyle(); + // FIXME: We want to use SVGResourcesCache to determine which resources are present, instead of quering the resource <-> id cache. + // For now leave the DRT output as is, but later on we should change this so cycles are properly ignored in the DRT output. RenderObject& renderer = const_cast<RenderObject&>(object); if (!svgStyle->maskerResource().isEmpty()) { if (RenderSVGResourceMasker* masker = getRenderSVGResourceById<RenderSVGResourceMasker>(object.document(), svgStyle->maskerResource())) { diff --git a/WebCore/rendering/SVGResources.cpp b/WebCore/rendering/SVGResources.cpp index de23ce1..fa1677b 100644 --- a/WebCore/rendering/SVGResources.cpp +++ b/WebCore/rendering/SVGResources.cpp @@ -25,24 +25,128 @@ #include "RenderSVGResourceFilter.h" #include "RenderSVGResourceMarker.h" #include "RenderSVGResourceMasker.h" +#include "SVGFilterElement.h" +#include "SVGGradientElement.h" #include "SVGPaint.h" +#include "SVGPatternElement.h" #include "SVGRenderStyle.h" #include "SVGURIReference.h" namespace WebCore { SVGResources::SVGResources() - : m_clipper(0) -#if ENABLE(FILTERS) - , m_filter(0) -#endif - , m_markerStart(0) - , m_markerMid(0) - , m_markerEnd(0) - , m_masker(0) - , m_fill(0) - , m_stroke(0) + : m_clipperFilterMaskerData(0) + , m_markerData(0) + , m_fillStrokeData(0) + , m_linkedResource(0) +{ +} + +static HashSet<AtomicStringImpl*>& clipperFilterMaskerTags() { + DEFINE_STATIC_LOCAL(HashSet<AtomicStringImpl*>, s_tagList, ()); + if (s_tagList.isEmpty()) { + // "container elements": http://www.w3.org/TR/SVG11/intro.html#TermContainerElement + // "graphics elements" : http://www.w3.org/TR/SVG11/intro.html#TermGraphicsElement + s_tagList.add(SVGNames::aTag.localName().impl()); + s_tagList.add(SVGNames::circleTag.localName().impl()); + s_tagList.add(SVGNames::ellipseTag.localName().impl()); + s_tagList.add(SVGNames::glyphTag.localName().impl()); + s_tagList.add(SVGNames::gTag.localName().impl()); + s_tagList.add(SVGNames::imageTag.localName().impl()); + s_tagList.add(SVGNames::lineTag.localName().impl()); + s_tagList.add(SVGNames::markerTag.localName().impl()); + s_tagList.add(SVGNames::maskTag.localName().impl()); + s_tagList.add(SVGNames::missing_glyphTag.localName().impl()); + s_tagList.add(SVGNames::pathTag.localName().impl()); + s_tagList.add(SVGNames::polygonTag.localName().impl()); + s_tagList.add(SVGNames::polylineTag.localName().impl()); + s_tagList.add(SVGNames::rectTag.localName().impl()); + s_tagList.add(SVGNames::svgTag.localName().impl()); + s_tagList.add(SVGNames::textTag.localName().impl()); + s_tagList.add(SVGNames::useTag.localName().impl()); + + // Not listed in the definitions is the clipPath element, the SVG spec says though: + // The "clipPath" element or any of its children can specify property "clip-path". + // So we have to add clipPathTag here, otherwhise clip-path on clipPath will fail. + // (Already mailed SVG WG, waiting for a solution) + s_tagList.add(SVGNames::clipPathTag.localName().impl()); + + // Not listed in the definitions are the text content elements, though filter/clipper/masker on tspan/text/.. is allowed. + // (Already mailed SVG WG, waiting for a solution) + s_tagList.add(SVGNames::altGlyphTag.localName().impl()); + s_tagList.add(SVGNames::textPathTag.localName().impl()); + s_tagList.add(SVGNames::trefTag.localName().impl()); + s_tagList.add(SVGNames::tspanTag.localName().impl()); + + // Elements that we ignore, as it doesn't make any sense. + // defs, pattern, switch (FIXME: Mail SVG WG about these) + // symbol (is converted to a svg element, when referenced by use, we can safely ignore it.) + } + + return s_tagList; +} + +static HashSet<AtomicStringImpl*>& markerTags() +{ + DEFINE_STATIC_LOCAL(HashSet<AtomicStringImpl*>, s_tagList, ()); + if (s_tagList.isEmpty()) { + s_tagList.add(SVGNames::lineTag.localName().impl()); + s_tagList.add(SVGNames::pathTag.localName().impl()); + s_tagList.add(SVGNames::polygonTag.localName().impl()); + s_tagList.add(SVGNames::polylineTag.localName().impl()); + } + + return s_tagList; +} + +static HashSet<AtomicStringImpl*>& fillAndStrokeTags() +{ + DEFINE_STATIC_LOCAL(HashSet<AtomicStringImpl*>, s_tagList, ()); + if (s_tagList.isEmpty()) { + s_tagList.add(SVGNames::altGlyphTag.localName().impl()); + s_tagList.add(SVGNames::circleTag.localName().impl()); + s_tagList.add(SVGNames::ellipseTag.localName().impl()); + s_tagList.add(SVGNames::lineTag.localName().impl()); + s_tagList.add(SVGNames::pathTag.localName().impl()); + s_tagList.add(SVGNames::polygonTag.localName().impl()); + s_tagList.add(SVGNames::polylineTag.localName().impl()); + s_tagList.add(SVGNames::rectTag.localName().impl()); + s_tagList.add(SVGNames::textTag.localName().impl()); + s_tagList.add(SVGNames::textPathTag.localName().impl()); + s_tagList.add(SVGNames::trefTag.localName().impl()); + s_tagList.add(SVGNames::tspanTag.localName().impl()); + } + + return s_tagList; +} + +static HashSet<AtomicStringImpl*>& chainableResourceTags() +{ + DEFINE_STATIC_LOCAL(HashSet<AtomicStringImpl*>, s_tagList, ()); + if (s_tagList.isEmpty()) { + s_tagList.add(SVGNames::linearGradientTag.localName().impl()); + s_tagList.add(SVGNames::filterTag.localName().impl()); + s_tagList.add(SVGNames::patternTag.localName().impl()); + s_tagList.add(SVGNames::radialGradientTag.localName().impl()); + } + + return s_tagList; +} + +static inline String targetReferenceFromResource(SVGElement* element) +{ + String target; + if (element->hasTagName(SVGNames::patternTag)) + target = static_cast<SVGPatternElement*>(element)->href(); + else if (element->hasTagName(SVGNames::linearGradientTag) || element->hasTagName(SVGNames::radialGradientTag)) + target = static_cast<SVGGradientElement*>(element)->href(); + else if (element->hasTagName(SVGNames::filterTag)) + target = static_cast<SVGFilterElement*>(element)->href(); + else + ASSERT_NOT_REACHED(); + + return SVGURIReference::getTarget(target); } static inline RenderSVGResourceContainer* paintingResourceFromSVGPaint(Document* document, SVGPaint* paint, AtomicString& id, bool& hasPendingResource) @@ -61,17 +165,13 @@ static inline RenderSVGResourceContainer* paintingResourceFromSVGPaint(Document* return 0; } -static inline void registerPendingResource(SVGDocumentExtensions* extensions, const AtomicString& id, Node* node) +static inline void registerPendingResource(SVGDocumentExtensions* extensions, const AtomicString& id, SVGElement* element) { - ASSERT(node); - if (!node->isSVGElement()) - return; - - SVGElement* svgElement = static_cast<SVGElement*>(node); - if (!svgElement->isStyled()) + ASSERT(element); + if (!element->isStyled()) return; - extensions->addPendingResource(id, static_cast<SVGStyledElement*>(svgElement)); + extensions->addPendingResource(id, static_cast<SVGStyledElement*>(element)); } bool SVGResources::buildCachedResources(const RenderObject* object, const SVGRenderStyle* style) @@ -81,6 +181,11 @@ bool SVGResources::buildCachedResources(const RenderObject* object, const SVGRen Node* node = object->node(); ASSERT(node); + ASSERT(node->isSVGElement()); + + SVGElement* element = static_cast<SVGElement*>(node); + if (!element) + return false; Document* document = object->document(); ASSERT(document); @@ -88,77 +193,85 @@ bool SVGResources::buildCachedResources(const RenderObject* object, const SVGRen SVGDocumentExtensions* extensions = document->accessSVGExtensions(); ASSERT(extensions); - bool foundResources = false; - if (style->hasClipper()) { - AtomicString id(style->clipperResource()); - m_clipper = getRenderSVGResourceById<RenderSVGResourceClipper>(document, id); - if (m_clipper) - foundResources = true; - else - registerPendingResource(extensions, id, node); - } + AtomicStringImpl* tagNameImpl = element->tagQName().localName().impl(); + if (!tagNameImpl) + return false; - if (style->hasMasker()) { - AtomicString id(style->maskerResource()); - m_masker = getRenderSVGResourceById<RenderSVGResourceMasker>(document, id); - if (m_masker) - foundResources = true; - else - registerPendingResource(extensions, id, node); - } + bool foundResources = false; + if (clipperFilterMaskerTags().contains(tagNameImpl)) { + if (style->hasClipper()) { + AtomicString id(style->clipperResource()); + if (setClipper(getRenderSVGResourceById<RenderSVGResourceClipper>(document, id))) + foundResources = true; + else + registerPendingResource(extensions, id, element); + } #if ENABLE(FILTERS) - if (style->hasFilter()) { - AtomicString id(style->filterResource()); - m_filter = getRenderSVGResourceById<RenderSVGResourceFilter>(document, id); - if (m_filter) - foundResources = true; - else - registerPendingResource(extensions, id, node); - } + if (style->hasFilter()) { + AtomicString id(style->filterResource()); + if (setFilter(getRenderSVGResourceById<RenderSVGResourceFilter>(document, id))) + foundResources = true; + else + registerPendingResource(extensions, id, element); + } #endif - if (style->hasMarkers()) { + if (style->hasMasker()) { + AtomicString id(style->maskerResource()); + if (setMasker(getRenderSVGResourceById<RenderSVGResourceMasker>(document, id))) + foundResources = true; + else + registerPendingResource(extensions, id, element); + } + } + + if (markerTags().contains(tagNameImpl) && style->hasMarkers()) { AtomicString markerStartId(style->markerStartResource()); - m_markerStart = getRenderSVGResourceById<RenderSVGResourceMarker>(document, markerStartId); - if (m_markerStart) + if (setMarkerStart(getRenderSVGResourceById<RenderSVGResourceMarker>(document, markerStartId))) foundResources = true; else - registerPendingResource(extensions, markerStartId, node); + registerPendingResource(extensions, markerStartId, element); AtomicString markerMidId(style->markerMidResource()); - m_markerMid = getRenderSVGResourceById<RenderSVGResourceMarker>(document, markerMidId); - if (m_markerMid) + if (setMarkerMid(getRenderSVGResourceById<RenderSVGResourceMarker>(document, markerMidId))) foundResources = true; else - registerPendingResource(extensions, markerMidId, node); + registerPendingResource(extensions, markerMidId, element); AtomicString markerEndId(style->markerEndResource()); - m_markerEnd = getRenderSVGResourceById<RenderSVGResourceMarker>(document, markerEndId); - if (m_markerEnd) + if (setMarkerEnd(getRenderSVGResourceById<RenderSVGResourceMarker>(document, markerEndId))) foundResources = true; else - registerPendingResource(extensions, markerEndId, node); + registerPendingResource(extensions, markerEndId, element); } - if (style->hasFill()) { - bool hasPendingResource = false; - AtomicString id; - m_fill = paintingResourceFromSVGPaint(document, style->fillPaint(), id, hasPendingResource); - if (m_fill) - foundResources = true; - else if (hasPendingResource) - registerPendingResource(extensions, id, node); + if (fillAndStrokeTags().contains(tagNameImpl)) { + if (style->hasFill()) { + bool hasPendingResource = false; + AtomicString id; + if (setFill(paintingResourceFromSVGPaint(document, style->fillPaint(), id, hasPendingResource))) + foundResources = true; + else if (hasPendingResource) + registerPendingResource(extensions, id, element); + } + + if (style->hasStroke()) { + bool hasPendingResource = false; + AtomicString id; + if (setStroke(paintingResourceFromSVGPaint(document, style->strokePaint(), id, hasPendingResource))) + foundResources = true; + else if (hasPendingResource) + registerPendingResource(extensions, id, element); + } } - if (style->hasStroke()) { - bool hasPendingResource = false; - AtomicString id; - m_stroke = paintingResourceFromSVGPaint(document, style->strokePaint(), id, hasPendingResource); - if (m_stroke) + if (chainableResourceTags().contains(tagNameImpl)) { + AtomicString id(targetReferenceFromResource(element)); + if (setLinkedResource(getRenderSVGResourceContainerById(document, id))) foundResources = true; - else if (hasPendingResource) - registerPendingResource(extensions, id, node); + else + registerPendingResource(extensions, id, element); } return foundResources; @@ -166,81 +279,115 @@ bool SVGResources::buildCachedResources(const RenderObject* object, const SVGRen void SVGResources::invalidateClient(RenderObject* object) const { - // Ordinary resources - if (m_clipper) - m_clipper->invalidateClient(object); + if (!m_clipperFilterMaskerData && !m_markerData && !m_fillStrokeData && !m_linkedResource) + return; + + if (m_linkedResource) { + ASSERT(!m_clipperFilterMaskerData); + ASSERT(!m_markerData); + ASSERT(!m_fillStrokeData); + m_linkedResource->invalidateClient(object); + return; + } + + if (m_clipperFilterMaskerData) { + if (m_clipperFilterMaskerData->clipper) + m_clipperFilterMaskerData->clipper->invalidateClient(object); #if ENABLE(FILTERS) - if (m_filter) - m_filter->invalidateClient(object); + if (m_clipperFilterMaskerData->filter) + m_clipperFilterMaskerData->filter->invalidateClient(object); #endif - if (m_masker) - m_masker->invalidateClient(object); - if (m_markerStart) - m_markerStart->invalidateClient(object); - if (m_markerMid) - m_markerMid->invalidateClient(object); - if (m_markerEnd) - m_markerEnd->invalidateClient(object); - - // Paint servers - if (m_fill) - m_fill->invalidateClient(object); - if (m_stroke) - m_stroke->invalidateClient(object); + if (m_clipperFilterMaskerData->masker) + m_clipperFilterMaskerData->masker->invalidateClient(object); + } + + if (m_markerData) { + if (m_markerData->markerStart) + m_markerData->markerStart->invalidateClient(object); + if (m_markerData->markerMid) + m_markerData->markerMid->invalidateClient(object); + if (m_markerData->markerEnd) + m_markerData->markerEnd->invalidateClient(object); + } + + if (m_fillStrokeData) { + if (m_fillStrokeData->fill) + m_fillStrokeData->fill->invalidateClient(object); + if (m_fillStrokeData->stroke) + m_fillStrokeData->stroke->invalidateClient(object); + } } void SVGResources::resourceDestroyed(RenderSVGResourceContainer* resource) { ASSERT(resource); + if (!m_clipperFilterMaskerData && !m_markerData && !m_fillStrokeData && !m_linkedResource) + return; + + if (m_linkedResource == resource) { + ASSERT(!m_clipperFilterMaskerData); + ASSERT(!m_markerData); + ASSERT(!m_fillStrokeData); + m_linkedResource->invalidateClients(); + m_linkedResource = 0; + return; + } switch (resource->resourceType()) { case MaskerResourceType: - if (m_masker == resource) { - m_masker->invalidateClients(); - m_masker = 0; + if (!m_clipperFilterMaskerData) + break; + if (m_clipperFilterMaskerData->masker == resource) { + m_clipperFilterMaskerData->masker->invalidateClients(); + m_clipperFilterMaskerData->masker = 0; } break; case MarkerResourceType: - if (m_markerStart == resource) { - m_markerStart->invalidateClients(); - m_markerStart = 0; + if (!m_markerData) + break; + if (m_markerData->markerStart == resource) { + m_markerData->markerStart->invalidateClients(); + m_markerData->markerStart = 0; } - - if (m_markerMid == resource) { - m_markerMid->invalidateClients(); - m_markerMid = 0; + if (m_markerData->markerMid == resource) { + m_markerData->markerMid->invalidateClients(); + m_markerData->markerMid = 0; } - - if (m_markerEnd == resource) { - m_markerEnd->invalidateClients(); - m_markerEnd = 0; + if (m_markerData->markerEnd == resource) { + m_markerData->markerEnd->invalidateClients(); + m_markerData->markerEnd = 0; } break; case PatternResourceType: case LinearGradientResourceType: case RadialGradientResourceType: - if (m_fill == resource) { - m_fill->invalidateClients(); - m_fill = 0; + if (!m_fillStrokeData) + break; + if (m_fillStrokeData->fill == resource) { + m_fillStrokeData->fill->invalidateClients(); + m_fillStrokeData->fill = 0; } - - if (m_stroke == resource) { - m_stroke->invalidateClients(); - m_stroke = 0; + if (m_fillStrokeData->stroke == resource) { + m_fillStrokeData->stroke->invalidateClients(); + m_fillStrokeData->stroke = 0; } break; #if ENABLE(FILTERS) case FilterResourceType: - if (m_filter == resource) { - m_filter->invalidateClients(); - m_filter = 0; + if (!m_clipperFilterMaskerData) + break; + if (m_clipperFilterMaskerData->filter == resource) { + m_clipperFilterMaskerData->filter->invalidateClients(); + m_clipperFilterMaskerData->filter = 0; } break; #endif case ClipperResourceType: - if (m_clipper == resource) { - m_clipper->invalidateClients(); - m_clipper = 0; + if (!m_clipperFilterMaskerData) + break; + if (m_clipperFilterMaskerData->clipper == resource) { + m_clipperFilterMaskerData->clipper->invalidateClients(); + m_clipperFilterMaskerData->clipper = 0; } break; case SolidColorResourceType: @@ -250,77 +397,212 @@ void SVGResources::resourceDestroyed(RenderSVGResourceContainer* resource) void SVGResources::buildSetOfResources(HashSet<RenderSVGResourceContainer*>& set) { - // Ordinary resources - if (m_clipper) - set.add(m_clipper); + if (!m_clipperFilterMaskerData && !m_markerData && !m_fillStrokeData && !m_linkedResource) + return; + + if (m_linkedResource) { + ASSERT(!m_clipperFilterMaskerData); + ASSERT(!m_markerData); + ASSERT(!m_fillStrokeData); + set.add(m_linkedResource); + return; + } + + if (m_clipperFilterMaskerData) { + if (m_clipperFilterMaskerData->clipper) + set.add(m_clipperFilterMaskerData->clipper); #if ENABLE(FILTERS) - if (m_filter) - set.add(m_filter); + if (m_clipperFilterMaskerData->filter) + set.add(m_clipperFilterMaskerData->filter); #endif - if (m_markerStart) - set.add(m_markerStart); - if (m_markerMid) - set.add(m_markerMid); - if (m_markerEnd) - set.add(m_markerEnd); - if (m_masker) - set.add(m_masker); - - // Paint servers - if (m_fill) - set.add(m_fill); - if (m_stroke) - set.add(m_stroke); + if (m_clipperFilterMaskerData->masker) + set.add(m_clipperFilterMaskerData->masker); + } + + if (m_markerData) { + if (m_markerData->markerStart) + set.add(m_markerData->markerStart); + if (m_markerData->markerMid) + set.add(m_markerData->markerMid); + if (m_markerData->markerEnd) + set.add(m_markerData->markerEnd); + } + + if (m_fillStrokeData) { + if (m_fillStrokeData->fill) + set.add(m_fillStrokeData->fill); + if (m_fillStrokeData->stroke) + set.add(m_fillStrokeData->stroke); + } +} + +bool SVGResources::setClipper(RenderSVGResourceClipper* clipper) +{ + if (!clipper) + return false; + + if (!m_clipperFilterMaskerData) + m_clipperFilterMaskerData = ClipperFilterMaskerData::create(); + + m_clipperFilterMaskerData->clipper = clipper; + return true; } void SVGResources::resetClipper() { - ASSERT(m_clipper); - m_clipper = 0; + ASSERT(m_clipperFilterMaskerData); + ASSERT(m_clipperFilterMaskerData->clipper); + m_clipperFilterMaskerData->clipper = 0; } #if ENABLE(FILTERS) +bool SVGResources::setFilter(RenderSVGResourceFilter* filter) +{ + if (!filter) + return false; + + if (!m_clipperFilterMaskerData) + m_clipperFilterMaskerData = ClipperFilterMaskerData::create(); + + m_clipperFilterMaskerData->filter = filter; + return true; +} + void SVGResources::resetFilter() { - ASSERT(m_filter); - m_filter = 0; + ASSERT(m_clipperFilterMaskerData); + ASSERT(m_clipperFilterMaskerData->filter); + m_clipperFilterMaskerData->filter = 0; } #endif +bool SVGResources::setMarkerStart(RenderSVGResourceMarker* markerStart) +{ + if (!markerStart) + return false; + + if (!m_markerData) + m_markerData = MarkerData::create(); + + m_markerData->markerStart = markerStart; + return true; +} + void SVGResources::resetMarkerStart() { - ASSERT(m_markerStart); - m_markerStart = 0; + ASSERT(m_markerData); + ASSERT(m_markerData->markerStart); + m_markerData->markerStart = 0; +} + +bool SVGResources::setMarkerMid(RenderSVGResourceMarker* markerMid) +{ + if (!markerMid) + return false; + + if (!m_markerData) + m_markerData = MarkerData::create(); + + m_markerData->markerMid = markerMid; + return true; } void SVGResources::resetMarkerMid() { - ASSERT(m_markerMid); - m_markerMid = 0; + ASSERT(m_markerData); + ASSERT(m_markerData->markerMid); + m_markerData->markerMid = 0; +} + +bool SVGResources::setMarkerEnd(RenderSVGResourceMarker* markerEnd) +{ + if (!markerEnd) + return false; + + if (!m_markerData) + m_markerData = MarkerData::create(); + + m_markerData->markerEnd = markerEnd; + return true; } void SVGResources::resetMarkerEnd() { - ASSERT(m_markerEnd); - m_markerEnd = 0; + ASSERT(m_markerData); + ASSERT(m_markerData->markerEnd); + m_markerData->markerEnd = 0; +} + +bool SVGResources::setMasker(RenderSVGResourceMasker* masker) +{ + if (!masker) + return false; + + if (!m_clipperFilterMaskerData) + m_clipperFilterMaskerData = ClipperFilterMaskerData::create(); + + m_clipperFilterMaskerData->masker = masker; + return true; } void SVGResources::resetMasker() { - ASSERT(m_masker); - m_masker = 0; + ASSERT(m_clipperFilterMaskerData); + ASSERT(m_clipperFilterMaskerData->masker); + m_clipperFilterMaskerData->masker = 0; +} + +bool SVGResources::setFill(RenderSVGResourceContainer* fill) +{ + if (!fill) + return false; + + if (!m_fillStrokeData) + m_fillStrokeData = FillStrokeData::create(); + + m_fillStrokeData->fill = fill; + return true; } void SVGResources::resetFill() { - ASSERT(m_fill); - m_fill = 0; + ASSERT(m_fillStrokeData); + ASSERT(m_fillStrokeData->fill); + m_fillStrokeData->fill = 0; +} + +bool SVGResources::setStroke(RenderSVGResourceContainer* stroke) +{ + if (!stroke) + return false; + + if (!m_fillStrokeData) + m_fillStrokeData = FillStrokeData::create(); + + m_fillStrokeData->stroke = stroke; + return true; } void SVGResources::resetStroke() { - ASSERT(m_stroke); - m_stroke = 0; + ASSERT(m_fillStrokeData); + ASSERT(m_fillStrokeData->stroke); + m_fillStrokeData->stroke = 0; +} + +bool SVGResources::setLinkedResource(RenderSVGResourceContainer* linkedResource) +{ + if (!linkedResource) + return false; + + m_linkedResource = linkedResource; + return true; +} + +void SVGResources::resetLinkedResource() +{ + ASSERT(m_linkedResource); + m_linkedResource = 0; } #ifndef NDEBUG @@ -334,24 +616,35 @@ void SVGResources::dump(const RenderObject* object) object->node()->showTreeForThis(); fprintf(stderr, "\n | List of resources:\n"); - if (m_clipper) - fprintf(stderr, " |-> Clipper : %p (node=%p)\n", m_clipper, m_clipper->node()); + if (m_clipperFilterMaskerData) { + if (RenderSVGResourceClipper* clipper = m_clipperFilterMaskerData->clipper) + fprintf(stderr, " |-> Clipper : %p (node=%p)\n", clipper, clipper->node()); #if ENABLE(FILTERS) - if (m_filter) - fprintf(stderr, " |-> Filter : %p (node=%p)\n", m_filter, m_filter->node()); + if (RenderSVGResourceFilter* filter = m_clipperFilterMaskerData->filter) + fprintf(stderr, " |-> Filter : %p (node=%p)\n", filter, filter->node()); #endif - if (m_markerStart) - fprintf(stderr, " |-> MarkerStart: %p (node=%p)\n", m_markerStart, m_markerStart->node()); - if (m_markerMid) - fprintf(stderr, " |-> MarkerMid : %p (node=%p)\n", m_markerMid, m_markerMid->node()); - if (m_markerEnd) - fprintf(stderr, " |-> MarkerEnd : %p (node=%p)\n", m_markerEnd, m_markerEnd->node()); - if (m_masker) - fprintf(stderr, " |-> Masker : %p (node=%p)\n", m_masker, m_masker->node()); - if (m_fill) - fprintf(stderr, " |-> Fill : %p (node=%p)\n", m_fill, m_fill->node()); - if (m_stroke) - fprintf(stderr, " |-> Stroke : %p (node=%p)\n", m_stroke, m_stroke->node()); + if (RenderSVGResourceMasker* masker = m_clipperFilterMaskerData->masker) + fprintf(stderr, " |-> Masker : %p (node=%p)\n", masker, masker->node()); + } + + if (m_markerData) { + if (RenderSVGResourceMarker* markerStart = m_markerData->markerStart) + fprintf(stderr, " |-> MarkerStart: %p (node=%p)\n", markerStart, markerStart->node()); + if (RenderSVGResourceMarker* markerMid = m_markerData->markerMid) + fprintf(stderr, " |-> MarkerMid : %p (node=%p)\n", markerMid, markerMid->node()); + if (RenderSVGResourceMarker* markerEnd = m_markerData->markerEnd) + fprintf(stderr, " |-> MarkerEnd : %p (node=%p)\n", markerEnd, markerEnd->node()); + } + + if (m_fillStrokeData) { + if (RenderSVGResourceContainer* fill = m_fillStrokeData->fill) + fprintf(stderr, " |-> Fill : %p (node=%p)\n", fill, fill->node()); + if (RenderSVGResourceContainer* stroke = m_fillStrokeData->stroke) + fprintf(stderr, " |-> Stroke : %p (node=%p)\n", stroke, stroke->node()); + } + + if (m_linkedResource) + fprintf(stderr, " |-> xlink:href : %p (node=%p)\n", m_linkedResource, m_linkedResource->node()); } #endif diff --git a/WebCore/rendering/SVGResources.h b/WebCore/rendering/SVGResources.h index 57a4140..a07a990 100644 --- a/WebCore/rendering/SVGResources.h +++ b/WebCore/rendering/SVGResources.h @@ -23,6 +23,8 @@ #if ENABLE(SVG) #include <wtf/HashSet.h> #include <wtf/Noncopyable.h> +#include <wtf/OwnPtr.h> +#include <wtf/PassOwnPtr.h> namespace WebCore { @@ -43,18 +45,21 @@ public: bool buildCachedResources(const RenderObject*, const SVGRenderStyle*); // Ordinary resources - RenderSVGResourceClipper* clipper() const { return m_clipper; } + RenderSVGResourceClipper* clipper() const { return m_clipperFilterMaskerData ? m_clipperFilterMaskerData->clipper : 0; } #if ENABLE(FILTERS) - RenderSVGResourceFilter* filter() const { return m_filter; } + RenderSVGResourceFilter* filter() const { return m_clipperFilterMaskerData ? m_clipperFilterMaskerData->filter : 0; } #endif - RenderSVGResourceMarker* markerStart() const { return m_markerStart; } - RenderSVGResourceMarker* markerMid() const { return m_markerMid; } - RenderSVGResourceMarker* markerEnd() const { return m_markerEnd; } - RenderSVGResourceMasker* masker() const { return m_masker; } + RenderSVGResourceMarker* markerStart() const { return m_markerData ? m_markerData->markerStart : 0; } + RenderSVGResourceMarker* markerMid() const { return m_markerData ? m_markerData->markerMid : 0; } + RenderSVGResourceMarker* markerEnd() const { return m_markerData ? m_markerData->markerEnd : 0; } + RenderSVGResourceMasker* masker() const { return m_clipperFilterMaskerData ? m_clipperFilterMaskerData->masker : 0; } // Paint servers - RenderSVGResourceContainer* fill() const { return m_fill; } - RenderSVGResourceContainer* stroke() const { return m_stroke; } + RenderSVGResourceContainer* fill() const { return m_fillStrokeData ? m_fillStrokeData->fill : 0; } + RenderSVGResourceContainer* stroke() const { return m_fillStrokeData ? m_fillStrokeData->stroke : 0; } + + // Chainable resources - linked through xlink:href + RenderSVGResourceContainer* linkedResource() const { return m_linkedResource; } void buildSetOfResources(HashSet<RenderSVGResourceContainer*>&); @@ -80,21 +85,92 @@ private: void resetMasker(); void resetFill(); void resetStroke(); + void resetLinkedResource(); private: - // Ordinary resources - RenderSVGResourceClipper* m_clipper; + bool setClipper(RenderSVGResourceClipper*); +#if ENABLE(FILTERS) + bool setFilter(RenderSVGResourceFilter*); +#endif + bool setMarkerStart(RenderSVGResourceMarker*); + bool setMarkerMid(RenderSVGResourceMarker*); + bool setMarkerEnd(RenderSVGResourceMarker*); + bool setMasker(RenderSVGResourceMasker*); + bool setFill(RenderSVGResourceContainer*); + bool setStroke(RenderSVGResourceContainer*); + bool setLinkedResource(RenderSVGResourceContainer*); + + // From SVG 1.1 2nd Edition + // clipper: 'container elements' and 'graphics elements' + // filter: 'container elements' and 'graphics elements' + // masker: 'container elements' and 'graphics elements' + // -> a, circle, defs, ellipse, glyph, g, image, line, marker, mask, missing-glyph, path, pattern, polygon, polyline, rect, svg, switch, symbol, text, use + struct ClipperFilterMaskerData { + ClipperFilterMaskerData() + : clipper(0) #if ENABLE(FILTERS) - RenderSVGResourceFilter* m_filter; + , filter(0) #endif - RenderSVGResourceMarker* m_markerStart; - RenderSVGResourceMarker* m_markerMid; - RenderSVGResourceMarker* m_markerEnd; - RenderSVGResourceMasker* m_masker; + , masker(0) + { + } - // Paint servers - RenderSVGResourceContainer* m_fill; - RenderSVGResourceContainer* m_stroke; + static PassOwnPtr<ClipperFilterMaskerData> create() + { + return new ClipperFilterMaskerData; + } + + RenderSVGResourceClipper* clipper; +#if ENABLE(FILTERS) + RenderSVGResourceFilter* filter; +#endif + RenderSVGResourceMasker* masker; + }; + + // From SVG 1.1 2nd Edition + // marker: line, path, polygon, polyline + struct MarkerData { + MarkerData() + : markerStart(0) + , markerMid(0) + , markerEnd(0) + { + } + + static PassOwnPtr<MarkerData> create() + { + return new MarkerData; + } + + RenderSVGResourceMarker* markerStart; + RenderSVGResourceMarker* markerMid; + RenderSVGResourceMarker* markerEnd; + }; + + // From SVG 1.1 2nd Edition + // fill: 'shapes' and 'text content elements' + // stroke: 'shapes' and 'text content elements' + // -> altGlyph, circle, ellipse, line, path, polygon, polyline, rect, text, textPath, tref, tspan + struct FillStrokeData { + FillStrokeData() + : fill(0) + , stroke(0) + { + } + + static PassOwnPtr<FillStrokeData> create() + { + return new FillStrokeData; + } + + RenderSVGResourceContainer* fill; + RenderSVGResourceContainer* stroke; + }; + + OwnPtr<ClipperFilterMaskerData> m_clipperFilterMaskerData; + OwnPtr<MarkerData> m_markerData; + OwnPtr<FillStrokeData> m_fillStrokeData; + RenderSVGResourceContainer* m_linkedResource; }; } diff --git a/WebCore/rendering/SVGResourcesCache.cpp b/WebCore/rendering/SVGResourcesCache.cpp index 46586cc..b922b44 100644 --- a/WebCore/rendering/SVGResourcesCache.cpp +++ b/WebCore/rendering/SVGResourcesCache.cpp @@ -131,17 +131,7 @@ void SVGResourcesCache::clientStyleChanged(RenderObject* renderer, StyleDifferen return; clientUpdatedFromElement(renderer, newStyle); - - // Invalidate resources in ancestor chain, if needed. - RenderObject* parent = renderer->parent(); - while (parent) { - if (parent->isSVGResourceContainer()) { - parent->toRenderSVGResourceContainer()->invalidateClients(); - break; - } - - parent = parent->parent(); - } + RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer, false); } void SVGResourcesCache::clientUpdatedFromElement(RenderObject* renderer, const RenderStyle* newStyle) diff --git a/WebCore/rendering/SVGResourcesCycleSolver.cpp b/WebCore/rendering/SVGResourcesCycleSolver.cpp index e150144..ec2e036 100644 --- a/WebCore/rendering/SVGResourcesCycleSolver.cpp +++ b/WebCore/rendering/SVGResourcesCycleSolver.cpp @@ -94,6 +94,7 @@ bool SVGResourcesCycleSolver::resourceContainsCycles(RenderObject* renderer) con return false; } +<<<<<<< HEAD static inline String targetReferenceFromResource(SVGElement* element, bool& isValid) { String target; @@ -177,6 +178,8 @@ bool SVGResourcesCycleSolver::chainableResourceContainsCycles(RenderSVGResourceC return false; } +======= +>>>>>>> webkit.org at r64523 void SVGResourcesCycleSolver::resolveCycles() { ASSERT(m_allResources.isEmpty()); @@ -221,6 +224,10 @@ void SVGResourcesCycleSolver::resolveCycles() for (HashSet<RenderSVGResourceContainer*>::iterator it = parentResources.begin(); it != end; ++it) m_allResources.add(*it); + // If we're a resource, add ourselves to the HashSet. + if (m_renderer->isSVGResourceContainer()) + m_allResources.add(m_renderer->toRenderSVGResourceContainer()); + ASSERT(!m_allResources.isEmpty()); // The job of this function is to determine wheter any of the 'resources' associated with the given 'renderer' @@ -228,22 +235,6 @@ void SVGResourcesCycleSolver::resolveCycles() end = localResources.end(); for (HashSet<RenderSVGResourceContainer*>::iterator it = localResources.begin(); it != end; ++it) { RenderSVGResourceContainer* resource = *it; - - // Special handling for resources that can be chained using xlink:href - need to detect cycles as well! - switch (resource->resourceType()) { - case PatternResourceType: - case LinearGradientResourceType: - case RadialGradientResourceType: - case FilterResourceType: - if (chainableResourceContainsCycles(resource)) { - breakCycle(resource); - continue; - } - break; - default: - break; - } - if (parentResources.contains(resource) || resourceContainsCycles(resource)) breakCycle(resource); } @@ -259,6 +250,11 @@ void SVGResourcesCycleSolver::resolveCycles() void SVGResourcesCycleSolver::breakCycle(RenderSVGResourceContainer* resourceLeadingToCycle) { ASSERT(resourceLeadingToCycle); + if (resourceLeadingToCycle == m_resources->linkedResource()) { + m_resources->resetLinkedResource(); + return; + } + switch (resourceLeadingToCycle->resourceType()) { case MaskerResourceType: ASSERT(resourceLeadingToCycle == m_resources->masker()); diff --git a/WebCore/rendering/SVGResourcesCycleSolver.h b/WebCore/rendering/SVGResourcesCycleSolver.h index 1f49354..e63ee63 100644 --- a/WebCore/rendering/SVGResourcesCycleSolver.h +++ b/WebCore/rendering/SVGResourcesCycleSolver.h @@ -38,7 +38,6 @@ public: private: bool resourceContainsCycles(RenderObject*) const; - bool chainableResourceContainsCycles(RenderSVGResourceContainer*) const; void breakCycle(RenderSVGResourceContainer*); RenderObject* m_renderer; diff --git a/WebCore/rendering/style/SVGRenderStyle.cpp b/WebCore/rendering/style/SVGRenderStyle.cpp index 93e50cc..2a9003c 100644 --- a/WebCore/rendering/style/SVGRenderStyle.cpp +++ b/WebCore/rendering/style/SVGRenderStyle.cpp @@ -165,13 +165,14 @@ StyleDifference SVGRenderStyle::diff(const SVGRenderStyle* other) const // Some stroke properties, requires relayouts, as the cached stroke boundaries need to be recalculated. if (stroke != other->stroke) { if (stroke->width != other->stroke->width + || stroke->paint != other->stroke->paint || stroke->miterLimit != other->stroke->miterLimit || stroke->dashArray != other->stroke->dashArray || stroke->dashOffset != other->stroke->dashOffset) return StyleDifferenceLayout; - // Only these two cases remain, where we only need a repaint. - ASSERT(stroke->paint != other->stroke->paint || stroke->opacity != other->stroke->opacity); + // Only the stroke-opacity case remains, where we only need a repaint. + ASSERT(stroke->opacity != other->stroke->opacity); return StyleDifferenceRepaint; } diff --git a/WebCore/rendering/style/SVGRenderStyle.h b/WebCore/rendering/style/SVGRenderStyle.h index c87dd2b..c1d72e9 100644 --- a/WebCore/rendering/style/SVGRenderStyle.h +++ b/WebCore/rendering/style/SVGRenderStyle.h @@ -56,59 +56,237 @@ public: bool operator==(const SVGRenderStyle&) const; bool operator!=(const SVGRenderStyle& o) const { return !(*this == o); } - // SVG CSS Properties - SVG_RS_DEFINE_ATTRIBUTE(EAlignmentBaseline, AlignmentBaseline, alignmentBaseline, AB_AUTO) - SVG_RS_DEFINE_ATTRIBUTE(EDominantBaseline, DominantBaseline, dominantBaseline, DB_AUTO) - SVG_RS_DEFINE_ATTRIBUTE(EBaselineShift, BaselineShift, baselineShift, BS_BASELINE) - SVG_RS_DEFINE_ATTRIBUTE(EVectorEffect, VectorEffect, vectorEffect, VE_NONE) - - SVG_RS_DEFINE_ATTRIBUTE_INHERITED(LineCap, CapStyle, capStyle, ButtCap) - SVG_RS_DEFINE_ATTRIBUTE_INHERITED(WindRule, ClipRule, clipRule, RULE_NONZERO) - SVG_RS_DEFINE_ATTRIBUTE_INHERITED(EColorInterpolation, ColorInterpolation, colorInterpolation, CI_SRGB) - SVG_RS_DEFINE_ATTRIBUTE_INHERITED(EColorInterpolation, ColorInterpolationFilters, colorInterpolationFilters, CI_LINEARRGB) - SVG_RS_DEFINE_ATTRIBUTE_INHERITED(EColorRendering, ColorRendering, colorRendering, CR_AUTO) - SVG_RS_DEFINE_ATTRIBUTE_INHERITED(WindRule, FillRule, fillRule, RULE_NONZERO) - SVG_RS_DEFINE_ATTRIBUTE_INHERITED(EImageRendering, ImageRendering, imageRendering, IR_AUTO) - SVG_RS_DEFINE_ATTRIBUTE_INHERITED(LineJoin, JoinStyle, joinStyle, MiterJoin) - SVG_RS_DEFINE_ATTRIBUTE_INHERITED(EShapeRendering, ShapeRendering, shapeRendering, SR_AUTO) - SVG_RS_DEFINE_ATTRIBUTE_INHERITED(ETextAnchor, TextAnchor, textAnchor, TA_START) - SVG_RS_DEFINE_ATTRIBUTE_INHERITED(EWritingMode, WritingMode, writingMode, WM_LRTB) - SVG_RS_DEFINE_ATTRIBUTE_INHERITED(EGlyphOrientation, GlyphOrientationHorizontal, glyphOrientationHorizontal, GO_0DEG) - SVG_RS_DEFINE_ATTRIBUTE_INHERITED(EGlyphOrientation, GlyphOrientationVertical, glyphOrientationVertical, GO_AUTO) - - // SVG CSS Properties (using DataRef's) - SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL(float, fill, opacity, FillOpacity, fillOpacity, 1.0f) - SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL_REFCOUNTED(SVGPaint, fill, paint, FillPaint, fillPaint, SVGPaint::defaultFill()) - - SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL(float, stroke, opacity, StrokeOpacity, strokeOpacity, 1.0f) - SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL_REFCOUNTED(SVGPaint, stroke, paint, StrokePaint, strokePaint, SVGPaint::defaultStroke()) - SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL_REFCOUNTED(CSSValueList, stroke, dashArray, StrokeDashArray, strokeDashArray, 0) - SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL(float, stroke, miterLimit, StrokeMiterLimit, strokeMiterLimit, 4.0f) + // Initial values for all the properties + static EAlignmentBaseline initialAlignmentBaseline() { return AB_AUTO; } + static EDominantBaseline initialDominantBaseline() { return DB_AUTO; } + static EBaselineShift initialBaselineShift() { return BS_BASELINE; } + static EVectorEffect initialVectorEffect() { return VE_NONE; } + static LineCap initialCapStyle() { return ButtCap; } + static WindRule initialClipRule() { return RULE_NONZERO; } + static EColorInterpolation initialColorInterpolation() { return CI_SRGB; } + static EColorInterpolation initialColorInterpolationFilters() { return CI_LINEARRGB; } + static EColorRendering initialColorRendering() { return CR_AUTO; } + static WindRule initialFillRule() { return RULE_NONZERO; } + static EImageRendering initialImageRendering() { return IR_AUTO; } + static LineJoin initialJoinStyle() { return MiterJoin; } + static EShapeRendering initialShapeRendering() { return SR_AUTO; } + static ETextAnchor initialTextAnchor() { return TA_START; } + static EWritingMode initialWritingMode() { return WM_LRTB; } + static EGlyphOrientation initialGlyphOrientationHorizontal() { return GO_0DEG; } + static EGlyphOrientation initialGlyphOrientationVertical() { return GO_AUTO; } + static float initialFillOpacity() { return 1.0f; } + static SVGPaint* initialFillPaint() { return SVGPaint::defaultFill(); } + static float initialStrokeOpacity() { return 1.0f; } + static SVGPaint* initialStrokePaint() { return SVGPaint::defaultStroke(); } + static CSSValueList* initialStrokeDashArray() { return 0; } + static float initialStrokeMiterLimit() { return 4.0f; } + static CSSValue* initialStrokeWidth() { return 0; } + static CSSValue* initialStrokeDashOffset() { return 0; }; + static CSSValue* initialKerning() { return 0; } + static float initialStopOpacity() { return 1.0f; } + static Color initialStopColor() { return Color(0, 0, 0); } + static float initialFloodOpacity() { return 1.0f; } + static Color initialFloodColor() { return Color(0, 0, 0); } + static Color initialLightingColor() { return Color(255, 255, 255); } + static CSSValue* initialBaselineShiftValue() { return 0; } + static ShadowData* initialShadow() { return 0; } + static String initialClipperResource() { return String(); } + static String initialFilterResource() { return String(); } + static String initialMaskerResource() { return String(); } + static String initialMarkerStartResource() { return String(); } + static String initialMarkerMidResource() { return String(); } + static String initialMarkerEndResource() { return String(); } + + // SVG CSS Property setters + void setAlignmentBaseline(EAlignmentBaseline val) { svg_noninherited_flags.f._alignmentBaseline = val; } + void setDominantBaseline(EDominantBaseline val) { svg_noninherited_flags.f._dominantBaseline = val; } + void setBaselineShift(EBaselineShift val) { svg_noninherited_flags.f._baselineShift = val; } + void setVectorEffect(EVectorEffect val) { svg_noninherited_flags.f._vectorEffect = val; } + void setCapStyle(LineCap val) { svg_inherited_flags._capStyle = val; } + void setClipRule(WindRule val) { svg_inherited_flags._clipRule = val; } + void setColorInterpolation(EColorInterpolation val) { svg_inherited_flags._colorInterpolation = val; } + void setColorInterpolationFilters(EColorInterpolation val) { svg_inherited_flags._colorInterpolationFilters = val; } + void setColorRendering(EColorRendering val) { svg_inherited_flags._colorRendering = val; } + void setFillRule(WindRule val) { svg_inherited_flags._fillRule = val; } + void setImageRendering(EImageRendering val) { svg_inherited_flags._imageRendering = val; } + void setJoinStyle(LineJoin val) { svg_inherited_flags._joinStyle = val; } + void setShapeRendering(EShapeRendering val) { svg_inherited_flags._shapeRendering = val; } + void setTextAnchor(ETextAnchor val) { svg_inherited_flags._textAnchor = val; } + void setWritingMode(EWritingMode val) { svg_inherited_flags._writingMode = val; } + void setGlyphOrientationHorizontal(EGlyphOrientation val) { svg_inherited_flags._glyphOrientationHorizontal = val; } + void setGlyphOrientationVertical(EGlyphOrientation val) { svg_inherited_flags._glyphOrientationVertical = val; } - SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL_REFCOUNTED(CSSValue, stroke, width, StrokeWidth, strokeWidth, 0) - SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL_REFCOUNTED(CSSValue, stroke, dashOffset, StrokeDashOffset, strokeDashOffset, 0); + void setFillOpacity(float obj) + { + if (!(fill->opacity == obj)) + fill.access()->opacity = obj; + } + + void setFillPaint(PassRefPtr<SVGPaint> obj) + { + if (!(fill->paint == obj)) + fill.access()->paint = obj; + } + + void setStrokeOpacity(float obj) + { + if (!(stroke->opacity == obj)) + stroke.access()->opacity = obj; + } + + void setStrokePaint(PassRefPtr<SVGPaint> obj) + { + if (!(stroke->paint == obj)) + stroke.access()->paint = obj; + } + + void setStrokeDashArray(PassRefPtr<CSSValueList> obj) + { + if (!(stroke->dashArray == obj)) + stroke.access()->dashArray = obj; + } + + void setStrokeMiterLimit(float obj) + { + if (!(stroke->miterLimit == obj)) + stroke.access()->miterLimit = obj; + } - SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL_REFCOUNTED(CSSValue, text, kerning, Kerning, kerning, 0) + void setStrokeWidth(PassRefPtr<CSSValue> obj) + { + if (!(stroke->width == obj)) + stroke.access()->width = obj; + } - SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL(float, stops, opacity, StopOpacity, stopOpacity, 1.0f) - SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL(Color, stops, color, StopColor, stopColor, Color(0, 0, 0)) + void setStrokeDashOffset(PassRefPtr<CSSValue> obj) + { + if (!(stroke->dashOffset == obj)) + stroke.access()->dashOffset = obj; + } - SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL(float, misc, floodOpacity, FloodOpacity, floodOpacity, 1.0f) - SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL(Color, misc, floodColor, FloodColor, floodColor, Color(0, 0, 0)) - SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL(Color, misc, lightingColor, LightingColor, lightingColor, Color(255, 255, 255)) - SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL_REFCOUNTED(CSSValue, misc, baselineShiftValue, BaselineShiftValue, baselineShiftValue, 0) + void setKerning(PassRefPtr<CSSValue> obj) + { + if (!(text->kerning == obj)) + text.access()->kerning = obj; + } - SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL_OWNPTR(ShadowData, shadowSVG, shadow, Shadow, shadow, 0) + void setStopOpacity(float obj) + { + if (!(stops->opacity == obj)) + stops.access()->opacity = obj; + } - // Non-inherited resources - SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL(String, resources, clipper, ClipperResource, clipperResource, String()) - SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL(String, resources, filter, FilterResource, filterResource, String()) - SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL(String, resources, masker, MaskerResource, maskerResource, String()) + void setStopColor(Color obj) + { + if (!(stops->color == obj)) + stops.access()->color = obj; + } + + void setFloodOpacity(float obj) + { + if (!(misc->floodOpacity == obj)) + misc.access()->floodOpacity = obj; + } + + void setFloodColor(Color obj) + { + if (!(misc->floodColor == obj)) + misc.access()->floodColor = obj; + } + + void setLightingColor(Color obj) + { + if (!(misc->lightingColor == obj)) + misc.access()->lightingColor = obj; + } + + void setBaselineShiftValue(PassRefPtr<CSSValue> obj) + { + if (!(misc->baselineShiftValue == obj)) + misc.access()->baselineShiftValue = obj; + } + + void setShadow(PassOwnPtr<ShadowData> obj) { shadowSVG.access()->shadow = obj; + } + + // Setters for non-inherited resources + void setClipperResource(String obj) + { + if (!(resources->clipper == obj)) + resources.access()->clipper = obj; + } + + void setFilterResource(String obj) + { + if (!(resources->filter == obj)) + resources.access()->filter = obj; + } + + void setMaskerResource(String obj) + { + if (!(resources->masker == obj)) + resources.access()->masker = obj; + } + + // Setters for inherited resources + void setMarkerStartResource(String obj) + { + if (!(inheritedResources->markerStart == obj)) + inheritedResources.access()->markerStart = obj; + } + + void setMarkerMidResource(String obj) + { + if (!(inheritedResources->markerMid == obj)) + inheritedResources.access()->markerMid = obj; + } + + void setMarkerEndResource(String obj) + { + if (!(inheritedResources->markerEnd == obj)) + inheritedResources.access()->markerEnd = obj; + } - // Inherited resources - SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL(String, inheritedResources, markerStart, MarkerStartResource, markerStartResource, String()) - SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL(String, inheritedResources, markerMid, MarkerMidResource, markerMidResource, String()) - SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL(String, inheritedResources, markerEnd, MarkerEndResource, markerEndResource, String()) + // Read accessors for all the properties + EAlignmentBaseline alignmentBaseline() const { return (EAlignmentBaseline) svg_noninherited_flags.f._alignmentBaseline; } + EDominantBaseline dominantBaseline() const { return (EDominantBaseline) svg_noninherited_flags.f._dominantBaseline; } + EBaselineShift baselineShift() const { return (EBaselineShift) svg_noninherited_flags.f._baselineShift; } + EVectorEffect vectorEffect() const { return (EVectorEffect) svg_noninherited_flags.f._vectorEffect; } + LineCap capStyle() const { return (LineCap) svg_inherited_flags._capStyle; } + WindRule clipRule() const { return (WindRule) svg_inherited_flags._clipRule; } + EColorInterpolation colorInterpolation() const { return (EColorInterpolation) svg_inherited_flags._colorInterpolation; } + EColorInterpolation colorInterpolationFilters() const { return (EColorInterpolation) svg_inherited_flags._colorInterpolationFilters; } + EColorRendering colorRendering() const { return (EColorRendering) svg_inherited_flags._colorRendering; } + WindRule fillRule() const { return (WindRule) svg_inherited_flags._fillRule; } + EImageRendering imageRendering() const { return (EImageRendering) svg_inherited_flags._imageRendering; } + LineJoin joinStyle() const { return (LineJoin) svg_inherited_flags._joinStyle; } + EShapeRendering shapeRendering() const { return (EShapeRendering) svg_inherited_flags._shapeRendering; } + ETextAnchor textAnchor() const { return (ETextAnchor) svg_inherited_flags._textAnchor; } + EWritingMode writingMode() const { return (EWritingMode) svg_inherited_flags._writingMode; } + EGlyphOrientation glyphOrientationHorizontal() const { return (EGlyphOrientation) svg_inherited_flags._glyphOrientationHorizontal; } + EGlyphOrientation glyphOrientationVertical() const { return (EGlyphOrientation) svg_inherited_flags._glyphOrientationVertical; } + float fillOpacity() const { return fill->opacity; } + SVGPaint* fillPaint() const { return fill->paint.get(); } + float strokeOpacity() const { return stroke->opacity; } + SVGPaint* strokePaint() const { return stroke->paint.get(); } + CSSValueList* strokeDashArray() const { return stroke->dashArray.get(); } + float strokeMiterLimit() const { return stroke->miterLimit; } + CSSValue* strokeWidth() const { return stroke->width.get(); } + CSSValue* strokeDashOffset() const { return stroke->dashOffset.get(); } + CSSValue* kerning() const { return text->kerning.get(); } + float stopOpacity() const { return stops->opacity; } + Color stopColor() const { return stops->color; } + float floodOpacity() const { return misc->floodOpacity; } + Color floodColor() const { return misc->floodColor; } + Color lightingColor() const { return misc->lightingColor; } + CSSValue* baselineShiftValue() const { return misc->baselineShiftValue.get(); } + ShadowData* shadow() const { return shadowSVG->shadow.get(); } + String clipperResource() const { return resources->clipper; } + String filterResource() const { return resources->filter; } + String maskerResource() const { return resources->masker; } + String markerStartResource() const { return inheritedResources->markerStart; } + String markerMidResource() const { return inheritedResources->markerMid; } + String markerEndResource() const { return inheritedResources->markerEnd; } // convenience bool hasClipper() const { return !clipperResource().isEmpty(); } diff --git a/WebCore/rendering/style/SVGRenderStyleDefs.h b/WebCore/rendering/style/SVGRenderStyleDefs.h index 5173894..adb890c 100644 --- a/WebCore/rendering/style/SVGRenderStyleDefs.h +++ b/WebCore/rendering/style/SVGRenderStyleDefs.h @@ -38,46 +38,6 @@ #include <wtf/RefCounted.h> #include <wtf/RefPtr.h> -// Helper macros for 'SVGRenderStyle' -#define SVG_RS_DEFINE_ATTRIBUTE(Data, Type, Name, Initial) \ - void set##Type(Data val) { svg_noninherited_flags.f._##Name = val; } \ - Data Name() const { return (Data) svg_noninherited_flags.f._##Name; } \ - static Data initial##Type() { return Initial; } - -#define SVG_RS_DEFINE_ATTRIBUTE_INHERITED(Data, Type, Name, Initial) \ - void set##Type(Data val) { svg_inherited_flags._##Name = val; } \ - Data Name() const { return (Data) svg_inherited_flags._##Name; } \ - static Data initial##Type() { return Initial; } - -// "Helper" macros for SVG's RenderStyle properties -// FIXME: These are impossible to work with or debug. -#define SVG_RS_DEFINE_ATTRIBUTE_DATAREF(Data, Group, Variable, Type, Name) \ - Data Name() const { return Group->Variable; } \ - void set##Type(Data obj) { SVG_RS_SET_VARIABLE(Group, Variable, obj) } - -#define SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL(Data, Group, Variable, Type, Name, Initial) \ - SVG_RS_DEFINE_ATTRIBUTE_DATAREF(Data, Group, Variable, Type, Name) \ - static Data initial##Type() { return Initial; } - -#define SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL_REFCOUNTED(Data, Group, Variable, Type, Name, Initial) \ - Data* Name() const { return Group->Variable.get(); } \ - void set##Type(PassRefPtr<Data> obj) { \ - if (!(Group->Variable == obj)) \ - Group.access()->Variable = obj; \ - } \ - static Data* initial##Type() { return Initial; } - -#define SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL_OWNPTR(Data, Group, Variable, Type, Name, Initial) \ - Data* Name() const { return Group->Variable.get(); } \ - void set##Type(PassOwnPtr<Data> obj) { \ - Group.access()->Variable = obj; \ - } \ - static Data* initial##Type() { return Initial; } - -#define SVG_RS_SET_VARIABLE(Group, Variable, Value) \ - if (!(Group->Variable == Value)) \ - Group.access()->Variable = Value; - namespace WebCore { enum EBaselineShift { diff --git a/WebCore/storage/AbstractDatabase.cpp b/WebCore/storage/AbstractDatabase.cpp index bcc5d06..7827ec8 100644 --- a/WebCore/storage/AbstractDatabase.cpp +++ b/WebCore/storage/AbstractDatabase.cpp @@ -474,6 +474,17 @@ void AbstractDatabase::incrementalVacuumIfNeeded() m_sqliteDatabase.runIncrementalVacuumCommand(); } +void AbstractDatabase::interrupt() +{ + m_sqliteDatabase.interrupt(); +} + +bool AbstractDatabase::isInterrupted() +{ + MutexLocker locker(m_sqliteDatabase.databaseMutex()); + return m_sqliteDatabase.isInterrupted(); +} + } // namespace WebCore #endif // ENABLE(DATABASE) diff --git a/WebCore/storage/AbstractDatabase.h b/WebCore/storage/AbstractDatabase.h index e302909..3d8d363 100644 --- a/WebCore/storage/AbstractDatabase.h +++ b/WebCore/storage/AbstractDatabase.h @@ -68,6 +68,8 @@ public: unsigned long long maximumSize() const; void incrementalVacuumIfNeeded(); + void interrupt(); + bool isInterrupted(); // FIXME: move all version-related methods to a DatabaseVersionTracker class bool versionMatchesExpected() const; diff --git a/WebCore/storage/DOMFileSystem.cpp b/WebCore/storage/DOMFileSystem.cpp new file mode 100644 index 0000000..19c75fc --- /dev/null +++ b/WebCore/storage/DOMFileSystem.cpp @@ -0,0 +1,53 @@ +/* + * 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 "DOMFileSystem.h" + +#if ENABLE(FILE_SYSTEM) + +#include "Entry.h" + +namespace WebCore { + +DOMFileSystem::DOMFileSystem(const String& name, const String& rootPath) + : m_rootPath(rootPath) + , m_name(name) +{ +} + +PassRefPtr<Entry> DOMFileSystem::root() +{ + return Entry::create(this, "/"); +} + +} // namespace + +#endif // ENABLE(FILE_SYSTEM) diff --git a/WebCore/storage/DOMFileSystem.h b/WebCore/storage/DOMFileSystem.h new file mode 100644 index 0000000..454205d --- /dev/null +++ b/WebCore/storage/DOMFileSystem.h @@ -0,0 +1,65 @@ +/* + * 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 DOMFileSystem_h +#define DOMFileSystem_h + +#if ENABLE(FILE_SYSTEM) + +#include "PlatformString.h" +#include <wtf/PassRefPtr.h> +#include <wtf/RefCounted.h> + +namespace WebCore { + +class Entry; + +class DOMFileSystem : public RefCounted<DOMFileSystem> { +public: + static PassRefPtr<DOMFileSystem> create(const String& name, const String& rootPath) + { + return adoptRef(new DOMFileSystem(name, rootPath)); + } + + const String& name() const { return m_name; } + PassRefPtr<Entry> root(); + +private: + DOMFileSystem(const String& name, const String& rootPath); + + String m_rootPath; + String m_name; +}; + +} // namespace + +#endif // ENABLE(FILE_SYSTEM) + +#endif // DOMFileSystem_h diff --git a/WebCore/storage/DOMFileSystem.idl b/WebCore/storage/DOMFileSystem.idl new file mode 100644 index 0000000..0241c4a --- /dev/null +++ b/WebCore/storage/DOMFileSystem.idl @@ -0,0 +1,38 @@ +/* + * 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 storage { + interface [ + Conditional=FILE_SYSTEM + ] DOMFileSystem { + readonly attribute DOMString name; + readonly attribute Entry root; + }; +} diff --git a/WebCore/storage/DatabaseTracker.cpp b/WebCore/storage/DatabaseTracker.cpp index de38ec3..0764db0 100644 --- a/WebCore/storage/DatabaseTracker.cpp +++ b/WebCore/storage/DatabaseTracker.cpp @@ -235,6 +235,35 @@ void DatabaseTracker::databaseChanged(AbstractDatabase* database) originQuotaManager().markDatabase(database); } +void DatabaseTracker::interruptAllDatabasesForContext(const ScriptExecutionContext* context) +{ + Vector<RefPtr<AbstractDatabase> > openDatabases; + { + MutexLocker openDatabaseMapLock(m_openDatabaseMapGuard); + + if (!m_openDatabaseMap) + return; + + DatabaseNameMap* nameMap = m_openDatabaseMap->get(context->securityOrigin()); + if (!nameMap) + return; + + DatabaseNameMap::const_iterator dbNameMapEndIt = nameMap->end(); + for (DatabaseNameMap::const_iterator dbNameMapIt = nameMap->begin(); dbNameMapIt != dbNameMapEndIt; ++dbNameMapIt) { + DatabaseSet* databaseSet = dbNameMapIt->second; + DatabaseSet::const_iterator dbSetEndIt = databaseSet->end(); + for (DatabaseSet::const_iterator dbSetIt = databaseSet->begin(); dbSetIt != dbSetEndIt; ++dbSetIt) { + if ((*dbSetIt)->scriptExecutionContext() == context) + openDatabases.append(*dbSetIt); + } + } + } + + Vector<RefPtr<AbstractDatabase> >::const_iterator openDatabasesEndIt = openDatabases.end(); + for (Vector<RefPtr<AbstractDatabase> >::const_iterator openDatabasesIt = openDatabases.begin(); openDatabasesIt != openDatabasesEndIt; ++openDatabasesIt) + (*openDatabasesIt)->interrupt(); +} + String DatabaseTracker::originPath(SecurityOrigin* origin) const { return SQLiteFileSystem::appendDatabaseFileNameToPath(m_databaseDirectoryPath.threadsafeCopy(), origin->databaseIdentifier()); diff --git a/WebCore/storage/DatabaseTracker.h b/WebCore/storage/DatabaseTracker.h index 094ee66..1557f0a 100644 --- a/WebCore/storage/DatabaseTracker.h +++ b/WebCore/storage/DatabaseTracker.h @@ -78,6 +78,8 @@ public: unsigned long long getMaxSizeForDatabase(const AbstractDatabase*); void databaseChanged(AbstractDatabase*); + void interruptAllDatabasesForContext(const ScriptExecutionContext*); + private: DatabaseTracker(const String& databasePath); diff --git a/WebCore/storage/Entry.cpp b/WebCore/storage/Entry.cpp new file mode 100644 index 0000000..b882297 --- /dev/null +++ b/WebCore/storage/Entry.cpp @@ -0,0 +1,88 @@ +/* + * 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 "Entry.h" + +#if ENABLE(FILE_SYSTEM) + +#include "DOMFileSystem.h" +#include "EntryCallback.h" +#include "ErrorCallback.h" +#include "MetadataCallback.h" +#include "VoidCallback.h" + +namespace WebCore { + +Entry::Entry(PassRefPtr<DOMFileSystem> fileSystem, const String& fullPath, bool isDirectory) + : m_fileSystem(fileSystem) + , m_fullPath(fullPath) + , m_isDirectory(isDirectory) +{ + int index = fullPath.reverseFind("/"); + if (index != -1) + m_name = fullPath.substring(index); + else + m_name = fullPath; +} + +void Entry::getMetadata(ScriptExecutionContext*, PassRefPtr<MetadataCallback>, PassRefPtr<ErrorCallback>) +{ + // FIXME: to be implemented. +} + +void Entry::moveTo(ScriptExecutionContext*, PassRefPtr<Entry>, const String&, PassRefPtr<EntryCallback>, PassRefPtr<ErrorCallback>) +{ + // FIXME: to be implemented. +} + +void Entry::copyTo(ScriptExecutionContext*, PassRefPtr<Entry>, const String&, PassRefPtr<EntryCallback>, PassRefPtr<ErrorCallback>) +{ + // FIXME: to be implemented. +} + +void Entry::remove(ScriptExecutionContext*, PassRefPtr<VoidCallback>, PassRefPtr<ErrorCallback>) +{ + // FIXME: to be implemented. +} + +void Entry::getParent(ScriptExecutionContext*, PassRefPtr<EntryCallback>, PassRefPtr<ErrorCallback>) +{ + // FIXME: to be implemented. +} + +String Entry::toURI(const String&) +{ + // FIXME: to be implemented. + return String(); +} + +} // namespace WebCore + +#endif // ENABLE(FILE_SYSTEM) diff --git a/WebCore/storage/Entry.h b/WebCore/storage/Entry.h new file mode 100644 index 0000000..1cabe58 --- /dev/null +++ b/WebCore/storage/Entry.h @@ -0,0 +1,87 @@ +/* + * 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 Entry_h +#define Entry_h + +#if ENABLE(FILE_SYSTEM) + +#include "DOMFileSystem.h" +#include <wtf/PassRefPtr.h> +#include <wtf/RefCounted.h> + +namespace WebCore { + +class EntryCallback; +class ErrorCallback; +class MetadataCallback; +class ScriptExecutionContext; +class VoidCallback; + +class Entry : public RefCounted<Entry> { +public: + static PassRefPtr<Entry> create(PassRefPtr<DOMFileSystem> fileSystem, const String& fullPath, bool isDirectory = false) + { + return adoptRef(new Entry(fileSystem, fullPath, isDirectory)); + } + + virtual ~Entry() { } + + virtual bool isFile() const { return !m_isDirectory; } + virtual bool isDirectory() const { return m_isDirectory; } + + const String& fullPath() const { return m_fullPath; } + const String& name() const { return m_name; } + + DOMFileSystem* filesystem() const { return m_fileSystem.get(); } + + virtual void getMetadata(ScriptExecutionContext*, PassRefPtr<MetadataCallback> successCallback = 0, PassRefPtr<ErrorCallback> errorCallback = 0); + + virtual void moveTo(ScriptExecutionContext*, PassRefPtr<Entry> parent, const String& name = String(), PassRefPtr<EntryCallback> successCallback = 0, PassRefPtr<ErrorCallback> errorCallback = 0); + virtual void copyTo(ScriptExecutionContext*, PassRefPtr<Entry> parent, const String& name = String(), PassRefPtr<EntryCallback> successCallback = 0, PassRefPtr<ErrorCallback> errorCallback = 0); + virtual void remove(ScriptExecutionContext*, PassRefPtr<VoidCallback> successCallback = 0, PassRefPtr<ErrorCallback> errorCallback = 0); + virtual void getParent(ScriptExecutionContext*, PassRefPtr<EntryCallback> successCallback = 0, PassRefPtr<ErrorCallback> errorCallback = 0); + + virtual String toURI(const String& mimeType = String()); + +protected: + Entry(PassRefPtr<DOMFileSystem> fileSystem, const String& fullPath, bool isDirectory); + + RefPtr<DOMFileSystem> m_fileSystem; + String m_fullPath; // virtual path + String m_name; + bool m_isDirectory; +}; + +} // namespace WebCore + +#endif // ENABLE(FILE_SYSTEM) + +#endif // Entry_h diff --git a/WebCore/storage/Entry.idl b/WebCore/storage/Entry.idl new file mode 100644 index 0000000..972751e --- /dev/null +++ b/WebCore/storage/Entry.idl @@ -0,0 +1,47 @@ +/* + * 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 storage { + interface [ + Conditional=FILE_SYSTEM + ] Entry { + readonly attribute boolean isFile; + readonly attribute boolean isDirectory; + readonly attribute DOMString name; + readonly attribute DOMString fullPath; + readonly attribute DOMFileSystem filesystem; + + [CallWith=ScriptExecutionContext] void moveTo(in Entry parent, in [Optional] DOMString name, in [Optional, Callback] EntryCallback successCallback, in [Optional, Callback] ErrorCallback errorCallback); + [CallWith=ScriptExecutionContext] void copyTo(in Entry parent, in [Optional] DOMString name, in [Optional, Callback] EntryCallback successCallback, in [Optional, Callback] ErrorCallback errorCallback); + DOMString toURI(in [Optional] DOMString mimeType); + [CallWith=ScriptExecutionContext] void remove(in [Optional, Callback] VoidCallback successCallback, in [Optional, Callback] ErrorCallback errorCallback); + [CallWith=ScriptExecutionContext] void getParent(in [Optional, Callback] EntryCallback successCallback, in [Optional, Callback] ErrorCallback errorCallback); + }; +} diff --git a/WebCore/storage/EntryCallback.h b/WebCore/storage/EntryCallback.h new file mode 100644 index 0000000..58aa34a --- /dev/null +++ b/WebCore/storage/EntryCallback.h @@ -0,0 +1,53 @@ +/* + * 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 EntryCallback_h +#define EntryCallback_h + +#if ENABLE(FILE_SYSTEM) + +#include <wtf/RefCounted.h> + +namespace WebCore { + +class Entry; +class ScriptExecutionContext; + +class EntryCallback : public RefCounted<EntryCallback> { +public: + virtual ~EntryCallback() { } + virtual bool handleEvent(ScriptExecutionContext*, Entry*) = 0; +}; + +} // namespace + +#endif // ENABLE(FILE_SYSTEM) + +#endif // EntryCallback_h diff --git a/WebCore/storage/EntryCallback.idl b/WebCore/storage/EntryCallback.idl new file mode 100644 index 0000000..bea3fd1 --- /dev/null +++ b/WebCore/storage/EntryCallback.idl @@ -0,0 +1,38 @@ +/* + * 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 storage { + interface [ + Conditional=FILE_SYSTEM, + Callback + ] EntryCallback { + boolean handleEvent(in Entry entry); + }; +} diff --git a/WebCore/storage/ErrorCallback.h b/WebCore/storage/ErrorCallback.h new file mode 100644 index 0000000..8cddbc7 --- /dev/null +++ b/WebCore/storage/ErrorCallback.h @@ -0,0 +1,53 @@ +/* + * 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 ErrorCallback_h +#define ErrorCallback_h + +#if ENABLE(FILE_SYSTEM) + +#include <wtf/RefCounted.h> + +namespace WebCore { + +class FileError; +class ScriptExecutionContext; + +class ErrorCallback : public RefCounted<ErrorCallback> { +public: + virtual ~ErrorCallback() { } + virtual bool handleEvent(ScriptExecutionContext*, FileError*) = 0; +}; + +} // namespace + +#endif // ENABLE(FILE_SYSTEM) + +#endif // ErrorCallback_h diff --git a/WebCore/storage/ErrorCallback.idl b/WebCore/storage/ErrorCallback.idl new file mode 100644 index 0000000..fc7fa85 --- /dev/null +++ b/WebCore/storage/ErrorCallback.idl @@ -0,0 +1,38 @@ +/* + * 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 storage { + interface [ + Conditional=FILE_SYSTEM, + Callback + ] ErrorCallback { + boolean handleEvent(in FileError error); + }; +} diff --git a/WebCore/storage/FileSystemCallback.h b/WebCore/storage/FileSystemCallback.h new file mode 100644 index 0000000..a3bf34d --- /dev/null +++ b/WebCore/storage/FileSystemCallback.h @@ -0,0 +1,53 @@ +/* + * 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 FileSystemCallback_h +#define FileSystemCallback_h + +#if ENABLE(FILE_SYSTEM) + +#include <wtf/RefCounted.h> + +namespace WebCore { + +class DOMFileSystem; +class ScriptExecutionContext; + +class FileSystemCallback : public RefCounted<FileSystemCallback> { +public: + virtual ~FileSystemCallback() { } + virtual bool handleEvent(ScriptExecutionContext*, DOMFileSystem*) = 0; +}; + +} // namespace + +#endif // ENABLE(FILE_SYSTEM) + +#endif // FileSystemCallback_h diff --git a/WebCore/storage/FileSystemCallback.idl b/WebCore/storage/FileSystemCallback.idl new file mode 100644 index 0000000..cf686ff --- /dev/null +++ b/WebCore/storage/FileSystemCallback.idl @@ -0,0 +1,38 @@ +/* + * 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 storage { + interface [ + Conditional=FILE_SYSTEM, + Callback + ] FileSystemCallback { + boolean handleEvent(in DOMFileSystem fileSystem); + }; +} diff --git a/WebCore/storage/Flags.h b/WebCore/storage/Flags.h new file mode 100644 index 0000000..ffe3403 --- /dev/null +++ b/WebCore/storage/Flags.h @@ -0,0 +1,66 @@ +/* + * 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 Flags_h +#define Flags_h + +#if ENABLE(FILE_SYSTEM) + +#include <wtf/RefCounted.h> + +namespace WebCore { + +class Flags : public RefCounted<Flags> { +public: + static PassRefPtr<Flags> create(bool create = false, bool exclusive = false) + { + return adoptRef(new Flags(create, exclusive)); + } + + bool isCreate() const { return m_create; } + void setCreate(bool create) { m_create = create; } + bool isExclusive() const { return m_exclusive; } + void setExclusive(bool exclusive) { m_exclusive = exclusive; } + +private: + Flags(bool create, bool exclusive) + : m_create(create) + , m_exclusive(exclusive) + { + } + bool m_create; + bool m_exclusive; +}; + +} // namespace + +#endif // ENABLE(FILE_SYSTEM) + +#endif // Flags_h diff --git a/WebCore/storage/Flags.idl b/WebCore/storage/Flags.idl new file mode 100644 index 0000000..cfe73d2 --- /dev/null +++ b/WebCore/storage/Flags.idl @@ -0,0 +1,38 @@ +/* + * 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 storage { + interface [ + Conditional=FILE_SYSTEM + ] Flags { + attribute boolean CREATE; + attribute boolean EXCLUSIVE; + }; +} diff --git a/WebCore/storage/IDBAny.cpp b/WebCore/storage/IDBAny.cpp index 9a18980..da0cb22 100644 --- a/WebCore/storage/IDBAny.cpp +++ b/WebCore/storage/IDBAny.cpp @@ -29,9 +29,9 @@ #if ENABLE(INDEXED_DATABASE) #include "IDBDatabaseRequest.h" -#include "IDBIndexRequest.h" +#include "IDBFactory.h" +#include "IDBIndex.h" #include "IDBObjectStoreRequest.h" -#include "IndexedDatabaseRequest.h" #include "SerializedScriptValue.h" namespace WebCore { @@ -56,10 +56,10 @@ PassRefPtr<IDBDatabaseRequest> IDBAny::idbDatabaseRequest() return m_idbDatabaseRequest; } -PassRefPtr<IDBIndexRequest> IDBAny::idbIndexRequest() +PassRefPtr<IDBIndex> IDBAny::idbIndex() { - ASSERT(m_type == IDBIndexRequestType); - return m_idbIndexRequest; + ASSERT(m_type == IDBIndexType); + return m_idbIndex; } PassRefPtr<IDBKey> IDBAny::idbKey() @@ -74,10 +74,10 @@ PassRefPtr<IDBObjectStoreRequest> IDBAny::idbObjectStoreRequest() return m_idbObjectStoreRequest; } -PassRefPtr<IndexedDatabaseRequest> IDBAny::indexedDatabaseRequest() +PassRefPtr<IDBFactory> IDBAny::idbFactory() { - ASSERT(m_type == IndexedDatabaseRequestType); - return m_indexedDatabaseRequest; + ASSERT(m_type == IDBFactoryType); + return m_idbFactory; } PassRefPtr<SerializedScriptValue> IDBAny::serializedScriptValue() @@ -99,11 +99,11 @@ void IDBAny::set(PassRefPtr<IDBDatabaseRequest> value) m_idbDatabaseRequest = value; } -void IDBAny::set(PassRefPtr<IDBIndexRequest> value) +void IDBAny::set(PassRefPtr<IDBIndex> value) { ASSERT(m_type == UndefinedType); m_type = IDBDatabaseRequestType; - m_idbIndexRequest = value; + m_idbIndex = value; } void IDBAny::set(PassRefPtr<IDBKey> value) @@ -120,11 +120,11 @@ void IDBAny::set(PassRefPtr<IDBObjectStoreRequest> value) m_idbObjectStoreRequest = value; } -void IDBAny::set(PassRefPtr<IndexedDatabaseRequest> value) +void IDBAny::set(PassRefPtr<IDBFactory> value) { ASSERT(m_type == UndefinedType); - m_type = IndexedDatabaseRequestType; - m_indexedDatabaseRequest = value; + m_type = IDBFactoryType; + m_idbFactory = value; } void IDBAny::set(PassRefPtr<SerializedScriptValue> value) diff --git a/WebCore/storage/IDBAny.h b/WebCore/storage/IDBAny.h index 77bba7c..a7859a1 100644 --- a/WebCore/storage/IDBAny.h +++ b/WebCore/storage/IDBAny.h @@ -35,10 +35,10 @@ namespace WebCore { class IDBDatabaseRequest; -class IDBIndexRequest; +class IDBIndex; class IDBKey; class IDBObjectStoreRequest; -class IndexedDatabaseRequest; +class IDBFactory; class SerializedScriptValue; class IDBAny : public RefCounted<IDBAny> { @@ -57,29 +57,29 @@ public: UndefinedType = 0, NullType, IDBDatabaseRequestType, - IDBIndexRequestType, + IDBFactoryType, + IDBIndexType, IDBKeyType, IDBObjectStoreRequestType, - IndexedDatabaseRequestType, SerializedScriptValueType }; Type type() const { return m_type; } // Use type() to figure out which one of these you're allowed to call. PassRefPtr<IDBDatabaseRequest> idbDatabaseRequest(); - PassRefPtr<IDBIndexRequest> idbIndexRequest(); + PassRefPtr<IDBFactory> idbFactory(); + PassRefPtr<IDBIndex> idbIndex(); PassRefPtr<IDBKey> idbKey(); PassRefPtr<IDBObjectStoreRequest> idbObjectStoreRequest(); - PassRefPtr<IndexedDatabaseRequest> indexedDatabaseRequest(); PassRefPtr<SerializedScriptValue> serializedScriptValue(); // Set can only be called once. void set(); // For "null". void set(PassRefPtr<IDBDatabaseRequest>); - void set(PassRefPtr<IDBIndexRequest>); + void set(PassRefPtr<IDBFactory>); + void set(PassRefPtr<IDBIndex>); void set(PassRefPtr<IDBKey>); void set(PassRefPtr<IDBObjectStoreRequest>); - void set(PassRefPtr<IndexedDatabaseRequest>); void set(PassRefPtr<SerializedScriptValue>); private: @@ -89,10 +89,10 @@ private: // Only one of the following should ever be in use at any given time. RefPtr<IDBDatabaseRequest> m_idbDatabaseRequest; - RefPtr<IDBIndexRequest> m_idbIndexRequest; + RefPtr<IDBFactory> m_idbFactory; + RefPtr<IDBIndex> m_idbIndex; RefPtr<IDBKey> m_idbKey; RefPtr<IDBObjectStoreRequest> m_idbObjectStoreRequest; - RefPtr<IndexedDatabaseRequest> m_indexedDatabaseRequest; RefPtr<SerializedScriptValue> m_serializedScriptValue; }; diff --git a/WebCore/storage/IDBCallbacks.h b/WebCore/storage/IDBCallbacks.h index 37fdc46..d79cdec 100644 --- a/WebCore/storage/IDBCallbacks.h +++ b/WebCore/storage/IDBCallbacks.h @@ -31,7 +31,7 @@ #include "IDBDatabase.h" #include "IDBDatabaseError.h" -#include "IDBIndex.h" +#include "IDBIndexBackendInterface.h" #include "IDBKey.h" #include "IDBObjectStore.h" #include "SerializedScriptValue.h" @@ -48,7 +48,7 @@ public: virtual void onError(PassRefPtr<IDBDatabaseError>) = 0; virtual void onSuccess() = 0; // For "null". virtual void onSuccess(PassRefPtr<IDBDatabase>) = 0; - virtual void onSuccess(PassRefPtr<IDBIndex>) = 0; + virtual void onSuccess(PassRefPtr<IDBIndexBackendInterface>) = 0; virtual void onSuccess(PassRefPtr<IDBKey>) = 0; virtual void onSuccess(PassRefPtr<IDBObjectStore>) = 0; virtual void onSuccess(PassRefPtr<SerializedScriptValue>) = 0; diff --git a/WebCore/storage/IDBDatabaseRequest.cpp b/WebCore/storage/IDBDatabaseRequest.cpp index fce2671..8a40e9e 100644 --- a/WebCore/storage/IDBDatabaseRequest.cpp +++ b/WebCore/storage/IDBDatabaseRequest.cpp @@ -27,9 +27,9 @@ #include "IDBDatabaseRequest.h" #include "IDBAny.h" +#include "IDBFactoryBackendInterface.h" #include "IDBObjectStoreRequest.h" #include "IDBRequest.h" -#include "IndexedDatabase.h" #include "ScriptExecutionContext.h" #if ENABLE(INDEXED_DATABASE) diff --git a/WebCore/storage/IndexedDatabaseRequest.cpp b/WebCore/storage/IDBFactory.cpp index c1c5515..d3a83a5 100644 --- a/WebCore/storage/IndexedDatabaseRequest.cpp +++ b/WebCore/storage/IDBFactory.cpp @@ -27,32 +27,33 @@ */ #include "config.h" -#include "IndexedDatabaseRequest.h" +#include "IDBFactory.h" +#include "DOMStringList.h" #include "Document.h" #include "ExceptionCode.h" #include "Frame.h" #include "IDBDatabase.h" +#include "IDBFactoryBackendInterface.h" #include "IDBKeyRange.h" #include "IDBRequest.h" -#include "IndexedDatabase.h" #if ENABLE(INDEXED_DATABASE) namespace WebCore { -IndexedDatabaseRequest::IndexedDatabaseRequest(IndexedDatabase* indexedDatabase) - : m_indexedDatabase(indexedDatabase) +IDBFactory::IDBFactory(IDBFactoryBackendInterface* factory) + : m_factoryBackend(factory) { // We pass a reference to this object before it can be adopted. relaxAdoptionRequirement(); } -IndexedDatabaseRequest::~IndexedDatabaseRequest() +IDBFactory::~IDBFactory() { } -PassRefPtr<IDBRequest> IndexedDatabaseRequest::open(ScriptExecutionContext* context, const String& name, const String& description) +PassRefPtr<IDBRequest> IDBFactory::open(ScriptExecutionContext* context, const String& name, const String& description) { if (!context->isDocument()) { // FIXME: make this work with workers. @@ -64,7 +65,7 @@ PassRefPtr<IDBRequest> IndexedDatabaseRequest::open(ScriptExecutionContext* cont return 0; RefPtr<IDBRequest> request = IDBRequest::create(document, IDBAny::create(this)); - m_indexedDatabase->open(name, description, request, document->securityOrigin(), document->frame()); + m_factoryBackend->open(name, description, request, document->securityOrigin(), document->frame()); return request; } diff --git a/WebCore/storage/IndexedDatabaseRequest.h b/WebCore/storage/IDBFactory.h index 57f8a78..61619b9 100644 --- a/WebCore/storage/IndexedDatabaseRequest.h +++ b/WebCore/storage/IDBFactory.h @@ -25,11 +25,12 @@ * (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 IndexedDatabaseRequest_h -#define IndexedDatabaseRequest_h +#ifndef IDBFactory_h +#define IDBFactory_h +#include "DOMStringList.h" #include "ExceptionCode.h" -#include "IndexedDatabase.h" +#include "IDBFactoryBackendInterface.h" #include "PlatformString.h" #include <wtf/PassRefPtr.h> #include <wtf/RefCounted.h> @@ -42,28 +43,28 @@ namespace WebCore { class IDBKey; class IDBKeyRange; class IDBRequest; -class IndexedDatabase; +class IDBFactoryBackendInterface; class ScriptExecutionContext; -class IndexedDatabaseRequest : public RefCounted<IndexedDatabaseRequest> { +class IDBFactory : public RefCounted<IDBFactory> { public: - static PassRefPtr<IndexedDatabaseRequest> create(IndexedDatabase* indexedDatabase) + static PassRefPtr<IDBFactory> create(IDBFactoryBackendInterface* factory) { - return adoptRef(new IndexedDatabaseRequest(indexedDatabase)); + return adoptRef(new IDBFactory(factory)); } - ~IndexedDatabaseRequest(); + ~IDBFactory(); PassRefPtr<IDBRequest> open(ScriptExecutionContext*, const String& name, const String& description); private: - IndexedDatabaseRequest(IndexedDatabase*); + IDBFactory(IDBFactoryBackendInterface*); - RefPtr<IndexedDatabase> m_indexedDatabase; + RefPtr<IDBFactoryBackendInterface> m_factoryBackend; }; } // namespace WebCore #endif -#endif // IndexedDatabaseRequest_h +#endif // IDBFactory_h diff --git a/WebCore/storage/IndexedDatabaseRequest.idl b/WebCore/storage/IDBFactory.idl index e6ee446..cd887f0 100644 --- a/WebCore/storage/IndexedDatabaseRequest.idl +++ b/WebCore/storage/IDBFactory.idl @@ -27,7 +27,7 @@ module storage { interface [ Conditional=INDEXED_DATABASE - ] IndexedDatabaseRequest { + ] IDBFactory { [CallWith=ScriptExecutionContext] IDBRequest open(in DOMString name, in DOMString description); }; diff --git a/WebCore/storage/IndexedDatabaseImpl.cpp b/WebCore/storage/IDBFactoryBackendImpl.cpp index e6af901..e965c3f 100644 --- a/WebCore/storage/IndexedDatabaseImpl.cpp +++ b/WebCore/storage/IDBFactoryBackendImpl.cpp @@ -27,8 +27,9 @@ */ #include "config.h" -#include "IndexedDatabaseImpl.h" +#include "IDBFactoryBackendImpl.h" +#include "DOMStringList.h" #include "IDBDatabaseImpl.h" #include "SecurityOrigin.h" #include <wtf/Threading.h> @@ -38,20 +39,20 @@ namespace WebCore { -PassRefPtr<IndexedDatabaseImpl> IndexedDatabaseImpl::create() +PassRefPtr<IDBFactoryBackendImpl> IDBFactoryBackendImpl::create() { - return adoptRef(new IndexedDatabaseImpl); + return adoptRef(new IDBFactoryBackendImpl); } -IndexedDatabaseImpl::IndexedDatabaseImpl() +IDBFactoryBackendImpl::IDBFactoryBackendImpl() { } -IndexedDatabaseImpl::~IndexedDatabaseImpl() +IDBFactoryBackendImpl::~IDBFactoryBackendImpl() { } -void IndexedDatabaseImpl::open(const String& name, const String& description, PassRefPtr<IDBCallbacks> callbacks, PassRefPtr<SecurityOrigin>, Frame*) +void IDBFactoryBackendImpl::open(const String& name, const String& description, PassRefPtr<IDBCallbacks> callbacks, PassRefPtr<SecurityOrigin>, Frame*) { RefPtr<IDBDatabase> database; IDBDatabaseMap::iterator it = m_databaseMap.find(name); diff --git a/WebCore/storage/IndexedDatabaseImpl.h b/WebCore/storage/IDBFactoryBackendImpl.h index b9520ee..bb28b6d 100644 --- a/WebCore/storage/IndexedDatabaseImpl.h +++ b/WebCore/storage/IDBFactoryBackendImpl.h @@ -25,10 +25,10 @@ * (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 IndexedDatabaseImpl_h -#define IndexedDatabaseImpl_h +#ifndef IDBFactoryBackendImpl_h +#define IDBFactoryBackendImpl_h -#include "IndexedDatabase.h" +#include "IDBFactoryBackendInterface.h" #include "StringHash.h" #include <wtf/HashMap.h> @@ -36,26 +36,28 @@ namespace WebCore { -class IndexedDatabaseImpl : public IndexedDatabase { +class DOMStringList; + +class IDBFactoryBackendImpl : public IDBFactoryBackendInterface { public: - static PassRefPtr<IndexedDatabaseImpl> create(); - virtual ~IndexedDatabaseImpl(); + static PassRefPtr<IDBFactoryBackendImpl> create(); + virtual ~IDBFactoryBackendImpl(); virtual void open(const String& name, const String& description, PassRefPtr<IDBCallbacks>, PassRefPtr<SecurityOrigin>, Frame*); private: - IndexedDatabaseImpl(); + IDBFactoryBackendImpl(); typedef HashMap<String, RefPtr<IDBDatabase> > IDBDatabaseMap; IDBDatabaseMap m_databaseMap; // We only create one instance of this class at a time. - static IndexedDatabaseImpl* indexedDatabaseImpl; + static IDBFactoryBackendImpl* idbFactoryBackendImpl; }; } // namespace WebCore #endif -#endif // IndexedDatabaseImpl_h +#endif // IDBFactoryBackendImpl_h diff --git a/WebCore/storage/IndexedDatabase.cpp b/WebCore/storage/IDBFactoryBackendInterface.cpp index a20974b..f1c0fb7 100644 --- a/WebCore/storage/IndexedDatabase.cpp +++ b/WebCore/storage/IDBFactoryBackendInterface.cpp @@ -26,9 +26,9 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "config.h" -#include "IndexedDatabase.h" +#include "IDBFactoryBackendInterface.h" -#include "IndexedDatabaseImpl.h" +#include "IDBFactoryBackendImpl.h" #if PLATFORM(CHROMIUM) #error "Chromium should not compile this file and instead define its own version of this factory that navigates the multi-process boundry." @@ -38,9 +38,9 @@ namespace WebCore { -PassRefPtr<IndexedDatabase> IndexedDatabase::create() +PassRefPtr<IDBFactoryBackendInterface> IDBFactoryBackendInterface::create() { - return IndexedDatabaseImpl::create(); + return IDBFactoryBackendImpl::create(); } } // namespace WebCore diff --git a/WebCore/storage/IndexedDatabase.h b/WebCore/storage/IDBFactoryBackendInterface.h index e6abf4a..ba18098 100644 --- a/WebCore/storage/IndexedDatabase.h +++ b/WebCore/storage/IDBFactoryBackendInterface.h @@ -25,8 +25,8 @@ * (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 IndexedDatabase_h -#define IndexedDatabase_h +#ifndef IDBFactoryBackendInterface_h +#define IDBFactoryBackendInterface_h #include "ExceptionCode.h" #include "IDBCallbacks.h" @@ -41,14 +41,14 @@ class Frame; class IDBDatabase; class SecurityOrigin; -// This class is shared by IndexedDatabaseRequest (async) and IndexedDatabaseSync (sync). -// This is implemented by IndexedDatabaseImpl and optionally others (in order to proxy +// This class is shared by IDBFactory (async) and IDBFactorySync (sync). +// This is implemented by IDBFactoryBackendImpl and optionally others (in order to proxy // calls across process barriers). All calls to these classes should be non-blocking and // trigger work on a background thread if necessary. -class IndexedDatabase : public ThreadSafeShared<IndexedDatabase> { +class IDBFactoryBackendInterface : public ThreadSafeShared<IDBFactoryBackendInterface> { public: - static PassRefPtr<IndexedDatabase> create(); - virtual ~IndexedDatabase() { } + static PassRefPtr<IDBFactoryBackendInterface> create(); + virtual ~IDBFactoryBackendInterface() { } virtual void open(const String& name, const String& description, PassRefPtr<IDBCallbacks>, PassRefPtr<SecurityOrigin>, Frame*) = 0; }; @@ -57,5 +57,5 @@ public: #endif -#endif // IndexedDatabase_h +#endif // IDBFactoryBackendInterface_h diff --git a/WebCore/storage/IDBIndexRequest.cpp b/WebCore/storage/IDBIndex.cpp index 30aee4b..62c1da8 100644 --- a/WebCore/storage/IDBIndexRequest.cpp +++ b/WebCore/storage/IDBIndex.cpp @@ -24,18 +24,18 @@ */ #include "config.h" -#include "IDBIndexRequest.h" +#include "IDBIndex.h" #if ENABLE(INDEXED_DATABASE) namespace WebCore { -IDBIndexRequest::IDBIndexRequest(PassRefPtr<IDBIndex> idbIndex) - : m_idbIndex(idbIndex) +IDBIndex::IDBIndex(PassRefPtr<IDBIndexBackendInterface> backend) + : m_backend(backend) { } -IDBIndexRequest::~IDBIndexRequest() +IDBIndex::~IDBIndex() { } diff --git a/WebCore/storage/IDBIndex.h b/WebCore/storage/IDBIndex.h index d0e8cab..5e716b7 100644 --- a/WebCore/storage/IDBIndex.h +++ b/WebCore/storage/IDBIndex.h @@ -26,21 +26,31 @@ #ifndef IDBIndex_h #define IDBIndex_h +#include "IDBIndexBackendInterface.h" #include "PlatformString.h" -#include <wtf/PassRefPtr.h> -#include <wtf/Threading.h> +#include <wtf/Forward.h> #if ENABLE(INDEXED_DATABASE) namespace WebCore { -class IDBIndex : public ThreadSafeShared<IDBIndex> { +class IDBIndex : public RefCounted<IDBIndex> { public: - virtual ~IDBIndex() { } + static PassRefPtr<IDBIndex> create(PassRefPtr<IDBIndexBackendInterface> backend) + { + return adoptRef(new IDBIndex(backend)); + } + ~IDBIndex(); - virtual String name() = 0; - virtual String keyPath() = 0; - virtual bool unique() = 0; + // Implement the IDL + String name() const { return m_backend->name(); } + String keyPath() const { return m_backend->keyPath(); } + bool unique() const { return m_backend->unique(); } + +private: + IDBIndex(PassRefPtr<IDBIndexBackendInterface>); + + RefPtr<IDBIndexBackendInterface> m_backend; }; } // namespace WebCore diff --git a/WebCore/storage/IDBIndexRequest.idl b/WebCore/storage/IDBIndex.idl index ad35f52..e796b03 100644 --- a/WebCore/storage/IDBIndexRequest.idl +++ b/WebCore/storage/IDBIndex.idl @@ -27,7 +27,7 @@ module storage { interface [ Conditional=INDEXED_DATABASE - ] IDBIndexRequest { + ] IDBIndex { // FIXME: Complete this file. readonly attribute DOMString name; diff --git a/WebCore/storage/IDBIndexImpl.cpp b/WebCore/storage/IDBIndexBackendImpl.cpp index f78939a..406e37f 100644 --- a/WebCore/storage/IDBIndexImpl.cpp +++ b/WebCore/storage/IDBIndexBackendImpl.cpp @@ -24,20 +24,20 @@ */ #include "config.h" -#include "IDBIndexImpl.h" +#include "IDBIndexBackendImpl.h" #if ENABLE(INDEXED_DATABASE) namespace WebCore { -IDBIndexImpl::IDBIndexImpl(const String& name, const String& keyPath, bool unique) +IDBIndexBackendImpl::IDBIndexBackendImpl(const String& name, const String& keyPath, bool unique) : m_name(name) , m_keyPath(keyPath) , m_unique(unique) { } -IDBIndexImpl::~IDBIndexImpl() +IDBIndexBackendImpl::~IDBIndexBackendImpl() { } diff --git a/WebCore/storage/IDBIndexImpl.h b/WebCore/storage/IDBIndexBackendImpl.h index b0034d5..ca3f01e 100644 --- a/WebCore/storage/IDBIndexImpl.h +++ b/WebCore/storage/IDBIndexBackendImpl.h @@ -23,30 +23,30 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef IDBIndexImpl_h -#define IDBIndexImpl_h +#ifndef IDBIndexBackendImpl_h +#define IDBIndexBackendImpl_h -#include "IDBIndex.h" +#include "IDBIndexBackendInterface.h" #if ENABLE(INDEXED_DATABASE) namespace WebCore { -class IDBIndexImpl : public IDBIndex { +class IDBIndexBackendImpl : public IDBIndexBackendInterface { public: - static PassRefPtr<IDBIndex> create(const String& name, const String& keyPath, bool unique) + static PassRefPtr<IDBIndexBackendImpl> create(const String& name, const String& keyPath, bool unique) { - return adoptRef(new IDBIndexImpl(name, keyPath, unique)); + return adoptRef(new IDBIndexBackendImpl(name, keyPath, unique)); } - virtual ~IDBIndexImpl(); + virtual ~IDBIndexBackendImpl(); - // Implements IDBIndex + // Implements IDBIndexBackendInterface. virtual String name() { return m_name; } virtual String keyPath() { return m_keyPath; } virtual bool unique() { return m_unique; } private: - IDBIndexImpl(const String& name, const String& keyPath, bool unique); + IDBIndexBackendImpl(const String& name, const String& keyPath, bool unique); String m_name; String m_keyPath; @@ -57,4 +57,4 @@ private: #endif -#endif // IDBIndexImpl_h +#endif // IDBIndexBackendImpl_h diff --git a/WebCore/storage/IDBIndexBackendInterface.h b/WebCore/storage/IDBIndexBackendInterface.h new file mode 100644 index 0000000..0d1ea34 --- /dev/null +++ b/WebCore/storage/IDBIndexBackendInterface.h @@ -0,0 +1,49 @@ +/* + * 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 IDBIndexBackendInterface_h +#define IDBIndexBackendInterface_h + +#include "PlatformString.h" +#include <wtf/Forward.h> + +#if ENABLE(INDEXED_DATABASE) + +namespace WebCore { + +class IDBIndexBackendInterface : public ThreadSafeShared<IDBIndexBackendInterface> { +public: + virtual ~IDBIndexBackendInterface() { } + + virtual String name() = 0; + virtual String keyPath() = 0; + virtual bool unique() = 0; +}; + +} // namespace WebCore + +#endif + +#endif // IDBIndexBackendInterface_h diff --git a/WebCore/storage/IDBIndexRequest.h b/WebCore/storage/IDBIndexRequest.h deleted file mode 100644 index ce6fc57..0000000 --- a/WebCore/storage/IDBIndexRequest.h +++ /dev/null @@ -1,62 +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: - * - * 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 IDBIndexRequest_h -#define IDBIndexRequest_h - -#include "IDBIndex.h" -#include "PlatformString.h" -#include <wtf/PassRefPtr.h> -#include <wtf/RefCounted.h> -#include <wtf/RefPtr.h> - -#if ENABLE(INDEXED_DATABASE) - -namespace WebCore { - -class IDBIndexRequest : public RefCounted<IDBIndexRequest> { -public: - static PassRefPtr<IDBIndexRequest> create(PassRefPtr<IDBIndex> idbIndex) - { - return adoptRef(new IDBIndexRequest(idbIndex)); - } - ~IDBIndexRequest(); - - // Implement the IDL - String name() const { return m_idbIndex->name(); } - String keyPath() const { return m_idbIndex->keyPath(); } - bool unique() const { return m_idbIndex->unique(); } - -private: - IDBIndexRequest(PassRefPtr<IDBIndex>); - - RefPtr<IDBIndex> m_idbIndex; -}; - -} // namespace WebCore - -#endif - -#endif // IDBIndexRequest_h diff --git a/WebCore/storage/IDBKeyRange.h b/WebCore/storage/IDBKeyRange.h index 9ce07af..5a426b7 100644 --- a/WebCore/storage/IDBKeyRange.h +++ b/WebCore/storage/IDBKeyRange.h @@ -49,6 +49,7 @@ public: { return adoptRef(new IDBKeyRange(left, right, flags)); } + ~IDBKeyRange() { } @@ -60,6 +61,7 @@ public: static PassRefPtr<IDBKeyRange> leftBound(PassRefPtr<IDBKey> bound, bool open = false); static PassRefPtr<IDBKeyRange> rightBound(PassRefPtr<IDBKey> bound, bool open = false); static PassRefPtr<IDBKeyRange> bound(PassRefPtr<IDBKey> left, PassRefPtr<IDBKey> right, bool openLeft = false, bool openRight = false); + private: IDBKeyRange(PassRefPtr<IDBKey> left, PassRefPtr<IDBKey> right, unsigned short flags); diff --git a/WebCore/storage/IDBObjectStore.h b/WebCore/storage/IDBObjectStore.h index e78e62a..4a53eb4 100644 --- a/WebCore/storage/IDBObjectStore.h +++ b/WebCore/storage/IDBObjectStore.h @@ -35,7 +35,7 @@ namespace WebCore { class DOMStringList; class IDBCallbacks; -class IDBIndex; +class IDBIndexBackendInterface; class IDBKey; class SerializedScriptValue; @@ -52,7 +52,7 @@ public: virtual void remove(PassRefPtr<IDBKey> key, PassRefPtr<IDBCallbacks>) = 0; virtual void createIndex(const String& name, const String& keyPath, bool unique, PassRefPtr<IDBCallbacks>) = 0; - virtual PassRefPtr<IDBIndex> index(const String& name) = 0; + virtual PassRefPtr<IDBIndexBackendInterface> index(const String& name) = 0; virtual void removeIndex(const String& name, PassRefPtr<IDBCallbacks>) = 0; }; diff --git a/WebCore/storage/IDBObjectStoreImpl.cpp b/WebCore/storage/IDBObjectStoreImpl.cpp index d678400..8c6444a 100755 --- a/WebCore/storage/IDBObjectStoreImpl.cpp +++ b/WebCore/storage/IDBObjectStoreImpl.cpp @@ -30,7 +30,7 @@ #include "IDBBindingUtilities.h" #include "IDBCallbacks.h" #include "IDBDatabaseException.h" -#include "IDBIndexImpl.h" +#include "IDBIndexBackendImpl.h" #include "IDBKeyTree.h" #if ENABLE(INDEXED_DATABASE) @@ -108,13 +108,13 @@ void IDBObjectStoreImpl::createIndex(const String& name, const String& keyPath, return; } - RefPtr<IDBIndex> index = IDBIndexImpl::create(name, keyPath, unique); + RefPtr<IDBIndexBackendInterface> index = IDBIndexBackendImpl::create(name, keyPath, unique); ASSERT(index->name() == name); m_indexes.set(name, index); callbacks->onSuccess(index.release()); } -PassRefPtr<IDBIndex> IDBObjectStoreImpl::index(const String& name) +PassRefPtr<IDBIndexBackendInterface> IDBObjectStoreImpl::index(const String& name) { return m_indexes.get(name); } diff --git a/WebCore/storage/IDBObjectStoreImpl.h b/WebCore/storage/IDBObjectStoreImpl.h index c4d2eb8..f2c2e03 100644 --- a/WebCore/storage/IDBObjectStoreImpl.h +++ b/WebCore/storage/IDBObjectStoreImpl.h @@ -53,7 +53,7 @@ public: void remove(PassRefPtr<IDBKey> key, PassRefPtr<IDBCallbacks>); void createIndex(const String& name, const String& keyPath, bool unique, PassRefPtr<IDBCallbacks>); - PassRefPtr<IDBIndex> index(const String& name); + PassRefPtr<IDBIndexBackendInterface> index(const String& name); void removeIndex(const String& name, PassRefPtr<IDBCallbacks>); private: @@ -63,7 +63,7 @@ private: String m_keyPath; bool m_autoIncrement; - typedef HashMap<String, RefPtr<IDBIndex> > IndexMap; + typedef HashMap<String, RefPtr<IDBIndexBackendInterface> > IndexMap; IndexMap m_indexes; typedef IDBKeyTree<SerializedScriptValue> Tree; diff --git a/WebCore/storage/IDBObjectStoreRequest.cpp b/WebCore/storage/IDBObjectStoreRequest.cpp index 3e095c1..0778214 100644 --- a/WebCore/storage/IDBObjectStoreRequest.cpp +++ b/WebCore/storage/IDBObjectStoreRequest.cpp @@ -28,7 +28,7 @@ #include "DOMStringList.h" #include "IDBAny.h" -#include "IDBIndexRequest.h" +#include "IDBIndex.h" #include "IDBKey.h" #include "SerializedScriptValue.h" #include <wtf/UnusedParam.h> @@ -94,11 +94,11 @@ PassRefPtr<IDBRequest> IDBObjectStoreRequest::createIndex(ScriptExecutionContext return request; } -PassRefPtr<IDBIndexRequest> IDBObjectStoreRequest::index(const String& name) +PassRefPtr<IDBIndex> IDBObjectStoreRequest::index(const String& name) { - RefPtr<IDBIndex> index = m_objectStore->index(name); + RefPtr<IDBIndexBackendInterface> index = m_objectStore->index(name); ASSERT(index); // FIXME: If this is null, we should raise a NOT_FOUND_ERR. - return IDBIndexRequest::create(index.release()); + return IDBIndex::create(index.release()); } PassRefPtr<IDBRequest> IDBObjectStoreRequest::removeIndex(ScriptExecutionContext* context, const String& name) diff --git a/WebCore/storage/IDBObjectStoreRequest.h b/WebCore/storage/IDBObjectStoreRequest.h index 86f64d6..bfd01f0 100644 --- a/WebCore/storage/IDBObjectStoreRequest.h +++ b/WebCore/storage/IDBObjectStoreRequest.h @@ -61,7 +61,7 @@ public: PassRefPtr<IDBRequest> remove(ScriptExecutionContext*, PassRefPtr<IDBKey> key); PassRefPtr<IDBRequest> createIndex(ScriptExecutionContext*, const String& name, const String& keyPath, bool unique = false); - PassRefPtr<IDBIndexRequest> index(const String& name); + PassRefPtr<IDBIndex> index(const String& name); PassRefPtr<IDBRequest> removeIndex(ScriptExecutionContext*, const String& name); private: diff --git a/WebCore/storage/IDBObjectStoreRequest.idl b/WebCore/storage/IDBObjectStoreRequest.idl index a816b73..6db6ad8 100644 --- a/WebCore/storage/IDBObjectStoreRequest.idl +++ b/WebCore/storage/IDBObjectStoreRequest.idl @@ -38,7 +38,7 @@ module storage { // FIXME: write openCursor [CallWith=ScriptExecutionContext] IDBRequest createIndex(in DOMString name, in [ConvertNullToNullString] DOMString keyPath, in [Optional] boolean unique); // FIXME: This needs to raise an IDBDatabaseException on errors. - IDBIndexRequest index(in DOMString name); + IDBIndex index(in DOMString name); [CallWith=ScriptExecutionContext] IDBRequest removeIndex(in DOMString name); readonly attribute DOMString name; diff --git a/WebCore/storage/IDBRequest.cpp b/WebCore/storage/IDBRequest.cpp index 78dd15a..b836cc3 100644 --- a/WebCore/storage/IDBRequest.cpp +++ b/WebCore/storage/IDBRequest.cpp @@ -36,7 +36,7 @@ #include "EventListener.h" #include "EventNames.h" #include "IDBDatabaseRequest.h" -#include "IDBIndexRequest.h" +#include "IDBIndex.h" #include "IDBErrorEvent.h" #include "IDBObjectStoreRequest.h" #include "IDBSuccessEvent.h" @@ -79,10 +79,10 @@ void IDBRequest::onSuccess(PassRefPtr<IDBDatabase> idbDatabase) m_result->set(IDBDatabaseRequest::create(idbDatabase)); } -void IDBRequest::onSuccess(PassRefPtr<IDBIndex> idbIndex) +void IDBRequest::onSuccess(PassRefPtr<IDBIndexBackendInterface> backend) { onEventCommon(); - m_result->set(IDBIndexRequest::create(idbIndex)); + m_result->set(IDBIndex::create(backend)); } void IDBRequest::onSuccess(PassRefPtr<IDBKey> idbKey) diff --git a/WebCore/storage/IDBRequest.h b/WebCore/storage/IDBRequest.h index c763d96..39f6a51 100644 --- a/WebCore/storage/IDBRequest.h +++ b/WebCore/storage/IDBRequest.h @@ -65,7 +65,7 @@ public: virtual void onError(PassRefPtr<IDBDatabaseError>); virtual void onSuccess(); // For "null". virtual void onSuccess(PassRefPtr<IDBDatabase>); - virtual void onSuccess(PassRefPtr<IDBIndex>); + virtual void onSuccess(PassRefPtr<IDBIndexBackendInterface>); virtual void onSuccess(PassRefPtr<IDBKey>); virtual void onSuccess(PassRefPtr<IDBObjectStore>); virtual void onSuccess(PassRefPtr<SerializedScriptValue>); diff --git a/WebCore/storage/Metadata.h b/WebCore/storage/Metadata.h new file mode 100644 index 0000000..0b06f90 --- /dev/null +++ b/WebCore/storage/Metadata.h @@ -0,0 +1,61 @@ +/* + * 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 Metadata_h +#define Metadata_h + +#if ENABLE(FILE_SYSTEM) + +#include <wtf/RefCounted.h> + +namespace WebCore { + +class Metadata : public RefCounted<Metadata> { +public: + static PassRefPtr<Metadata> create(double modificationTime) + { + return adoptRef(new Metadata(modificationTime)); + } + double modificationTime() const { return m_modificationTime; } + +private: + Metadata(double modificationTime) + : m_modificationTime(modificationTime) + { + } + + double m_modificationTime; +}; + +} // namespace + +#endif // ENABLE(FILE_SYSTEM) + +#endif // Metadata_h diff --git a/WebCore/storage/Metadata.idl b/WebCore/storage/Metadata.idl new file mode 100644 index 0000000..711fae8 --- /dev/null +++ b/WebCore/storage/Metadata.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 storage { + interface [ + Conditional=FILE_SYSTEM + ] Metadata { + readonly attribute double modificationTime; + }; +} diff --git a/WebCore/storage/MetadataCallback.h b/WebCore/storage/MetadataCallback.h new file mode 100644 index 0000000..96e4c91 --- /dev/null +++ b/WebCore/storage/MetadataCallback.h @@ -0,0 +1,53 @@ +/* + * 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 MetadataCallback_h +#define MetadataCallback_h + +#if ENABLE(FILE_SYSTEM) + +#include <wtf/RefCounted.h> + +namespace WebCore { + +class Metadata; +class ScriptExecutionContext; + +class MetadataCallback : public RefCounted<MetadataCallback> { +public: + virtual ~MetadataCallback() { } + virtual bool handleEvent(ScriptExecutionContext*, Metadata*) = 0; +}; + +} // namespace + +#endif // ENABLE(FILE_SYSTEM) + +#endif // MetadataCallback_h diff --git a/WebCore/storage/MetadataCallback.idl b/WebCore/storage/MetadataCallback.idl new file mode 100644 index 0000000..44ca180 --- /dev/null +++ b/WebCore/storage/MetadataCallback.idl @@ -0,0 +1,38 @@ +/* + * 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 storage { + interface [ + Conditional=FILE_SYSTEM, + Callback + ] MetadataCallback { + boolean handleEvent(in Metadata metadata); + }; +} diff --git a/WebCore/storage/SQLStatement.cpp b/WebCore/storage/SQLStatement.cpp index 2d7d78e..9dd249a 100644 --- a/WebCore/storage/SQLStatement.cpp +++ b/WebCore/storage/SQLStatement.cpp @@ -78,7 +78,7 @@ bool SQLStatement::execute(Database* db) if (result != SQLResultOk) { LOG(StorageAPI, "Unable to verify correctness of statement %s - error %i (%s)", m_statement.ascii().data(), result, database->lastErrorMsg()); - m_error = SQLError::create(SQLError::SYNTAX_ERR, database->lastErrorMsg()); + m_error = SQLError::create(result == SQLResultInterrupt ? SQLError::DATABASE_ERR : SQLError::SYNTAX_ERR, database->lastErrorMsg()); return false; } @@ -86,7 +86,7 @@ bool SQLStatement::execute(Database* db) // If this is the case, they might be trying to do something fishy or malicious if (statement.bindParameterCount() != m_arguments.size()) { LOG(StorageAPI, "Bind parameter count doesn't match number of question marks"); - m_error = SQLError::create(SQLError::SYNTAX_ERR, "number of '?'s in statement string does not match argument count"); + m_error = SQLError::create(db->isInterrupted() ? SQLError::DATABASE_ERR : SQLError::SYNTAX_ERR, "number of '?'s in statement string does not match argument count"); return false; } diff --git a/WebCore/storage/SQLStatementSync.cpp b/WebCore/storage/SQLStatementSync.cpp index 7be3f50..e47919f 100644 --- a/WebCore/storage/SQLStatementSync.cpp +++ b/WebCore/storage/SQLStatementSync.cpp @@ -61,12 +61,12 @@ PassRefPtr<SQLResultSet> SQLStatementSync::execute(DatabaseSync* db, ExceptionCo SQLiteStatement statement(*database, m_statement); int result = statement.prepare(); if (result != SQLResultOk) { - ec = SQLException::SYNTAX_ERR; + ec = (result == SQLResultInterrupt ? SQLException::DATABASE_ERR : SQLException::SYNTAX_ERR); return 0; } if (statement.bindParameterCount() != m_arguments.size()) { - ec = SQLException::SYNTAX_ERR; + ec = (db->isInterrupted()? SQLException::DATABASE_ERR : SQLException::SYNTAX_ERR); return 0; } diff --git a/WebCore/storage/SQLTransaction.cpp b/WebCore/storage/SQLTransaction.cpp index e43d844..454ea63 100644 --- a/WebCore/storage/SQLTransaction.cpp +++ b/WebCore/storage/SQLTransaction.cpp @@ -146,17 +146,22 @@ const char* SQLTransaction::debugStepName(SQLTransaction::TransactionStepMethod } #endif -void SQLTransaction::checkAndHandleClosedDatabase() +void SQLTransaction::checkAndHandleClosedOrInterruptedDatabase() { - if (m_database->opened()) + if (m_database->opened() && !m_database->isInterrupted()) return; // If the database was stopped, don't do anything and cancel queued work - LOG(StorageAPI, "Database was stopped - cancelling work for this transaction"); + LOG(StorageAPI, "Database was stopped or interrupted - cancelling work for this transaction"); MutexLocker locker(m_statementMutex); m_statementQueue.clear(); m_nextStep = 0; + // Release the unneeded callbacks, to break reference cycles. + m_callback = 0; + m_successCallback = 0; + m_errorCallback = 0; + // The next steps should be executed only if we're on the DB thread. if (currentThread() != database()->scriptExecutionContext()->databaseThread()->getThreadID()) return; @@ -183,7 +188,7 @@ bool SQLTransaction::performNextStep() m_nextStep == &SQLTransaction::cleanupAfterSuccessCallback || m_nextStep == &SQLTransaction::cleanupAfterTransactionErrorCallback); - checkAndHandleClosedDatabase(); + checkAndHandleClosedOrInterruptedDatabase(); if (m_nextStep) (this->*m_nextStep)(); @@ -202,7 +207,7 @@ void SQLTransaction::performPendingCallback() m_nextStep == &SQLTransaction::deliverQuotaIncreaseCallback || m_nextStep == &SQLTransaction::deliverSuccessCallback); - checkAndHandleClosedDatabase(); + checkAndHandleClosedOrInterruptedDatabase(); if (m_nextStep) (this->*m_nextStep)(); @@ -292,6 +297,7 @@ void SQLTransaction::deliverTransactionCallback() m_executeSqlAllowed = true; shouldDeliverErrorCallback = !m_callback->handleEvent(m_database->scriptExecutionContext(), this); m_executeSqlAllowed = false; + m_callback = 0; } // Transaction Step 5 - If the transaction callback was null or raised an exception, jump to the error callback @@ -459,6 +465,7 @@ void SQLTransaction::postflightAndCommit() // If the commit failed, the transaction will still be marked as "in progress" if (m_sqliteTransaction->inProgress()) { + m_successCallback = 0; m_transactionError = SQLError::create(SQLError::DATABASE_ERR, "failed to commit the transaction"); handleTransactionError(false); return; @@ -473,7 +480,6 @@ void SQLTransaction::postflightAndCommit() m_database->transactionClient()->didCommitWriteTransaction(database()); // Now release our unneeded callbacks, to break reference cycles. - m_callback = 0; m_errorCallback = 0; // Transaction Step 10 - Deliver success callback, if there is one @@ -546,8 +552,10 @@ void SQLTransaction::deliverTransactionErrorCallback() // Transaction Step 12 - If exists, invoke error callback with the last // error to have occurred in this transaction. - if (m_errorCallback) + if (m_errorCallback) { m_errorCallback->handleEvent(m_database->scriptExecutionContext(), m_transactionError.get()); + m_errorCallback = 0; + } m_nextStep = &SQLTransaction::cleanupAfterTransactionErrorCallback; LOG(StorageAPI, "Scheduling cleanupAfterTransactionErrorCallback for transaction %p\n", this); @@ -579,10 +587,6 @@ void SQLTransaction::cleanupAfterTransactionErrorCallback() ASSERT(!m_database->sqliteDatabase().transactionInProgress()); m_nextStep = 0; - // Now release our callbacks, to break reference cycles. - m_callback = 0; - m_errorCallback = 0; - // Now release the lock on this database m_database->transactionCoordinator()->releaseLock(this); } diff --git a/WebCore/storage/SQLTransaction.h b/WebCore/storage/SQLTransaction.h index 5c62ca2..2eb200b 100644 --- a/WebCore/storage/SQLTransaction.h +++ b/WebCore/storage/SQLTransaction.h @@ -87,7 +87,7 @@ private: void enqueueStatement(PassRefPtr<SQLStatement>); - void checkAndHandleClosedDatabase(); + void checkAndHandleClosedOrInterruptedDatabase(); void acquireLock(); void openTransactionAndPreflight(); diff --git a/WebCore/storage/chromium/DatabaseTrackerChromium.cpp b/WebCore/storage/chromium/DatabaseTrackerChromium.cpp index aad4ed9..361e203 100644 --- a/WebCore/storage/chromium/DatabaseTrackerChromium.cpp +++ b/WebCore/storage/chromium/DatabaseTrackerChromium.cpp @@ -174,6 +174,35 @@ unsigned long long DatabaseTracker::getMaxSizeForDatabase(const AbstractDatabase return databaseSize + spaceAvailable; } +void DatabaseTracker::interruptAllDatabasesForContext(const ScriptExecutionContext* context) +{ + Vector<RefPtr<AbstractDatabase> > openDatabases; + { + MutexLocker openDatabaseMapLock(m_openDatabaseMapGuard); + + if (!m_openDatabaseMap) + return; + + DatabaseNameMap* nameMap = m_openDatabaseMap->get(context->securityOrigin()); + if (!nameMap) + return; + + DatabaseNameMap::const_iterator dbNameMapEndIt = nameMap->end(); + for (DatabaseNameMap::const_iterator dbNameMapIt = nameMap->begin(); dbNameMapIt != dbNameMapEndIt; ++dbNameMapIt) { + DatabaseSet* databaseSet = dbNameMapIt->second; + DatabaseSet::const_iterator dbSetEndIt = databaseSet->end(); + for (DatabaseSet::const_iterator dbSetIt = databaseSet->begin(); dbSetIt != dbSetEndIt; ++dbSetIt) { + if ((*dbSetIt)->scriptExecutionContext() == context) + openDatabases.append(*dbSetIt); + } + } + } + + Vector<RefPtr<AbstractDatabase> >::const_iterator openDatabasesEndIt = openDatabases.end(); + for (Vector<RefPtr<AbstractDatabase> >::const_iterator openDatabasesIt = openDatabases.begin(); openDatabasesIt != openDatabasesEndIt; ++openDatabasesIt) + (*openDatabasesIt)->interrupt(); +} + } #endif // ENABLE(DATABASE) diff --git a/WebCore/storage/chromium/IndexedDatabase.cpp b/WebCore/storage/chromium/IDBFactoryBackendInterface.cpp index 6f53f92..016cab0 100644 --- a/WebCore/storage/chromium/IndexedDatabase.cpp +++ b/WebCore/storage/chromium/IDBFactoryBackendInterface.cpp @@ -26,7 +26,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "config.h" -#include "IndexedDatabase.h" +#include "IDBFactoryBackendInterface.h" #include "ChromiumBridge.h" @@ -34,9 +34,9 @@ namespace WebCore { -PassRefPtr<IndexedDatabase> IndexedDatabase::create() +PassRefPtr<IDBFactoryBackendInterface> IDBFactoryBackendInterface::create() { - return ChromiumBridge::indexedDatabase(); + return ChromiumBridge::idbFactory(); } } // namespace WebCore diff --git a/WebCore/svg/SVGClipPathElement.cpp b/WebCore/svg/SVGClipPathElement.cpp index c3a514e..5c23031 100644 --- a/WebCore/svg/SVGClipPathElement.cpp +++ b/WebCore/svg/SVGClipPathElement.cpp @@ -69,12 +69,16 @@ void SVGClipPathElement::svgAttributeChanged(const QualifiedName& attrName) { SVGStyledTransformableElement::svgAttributeChanged(attrName); + RenderObject* object = renderer(); + if (!object) + return; + if (attrName == SVGNames::clipPathUnitsAttr || SVGTests::isKnownAttribute(attrName) || SVGLangSpace::isKnownAttribute(attrName) || SVGExternalResourcesRequired::isKnownAttribute(attrName) || SVGStyledTransformableElement::isKnownAttribute(attrName)) - invalidateResourceClients(); + object->setNeedsLayout(true); } void SVGClipPathElement::synchronizeProperty(const QualifiedName& attrName) @@ -97,8 +101,11 @@ void SVGClipPathElement::childrenChanged(bool changedByParser, Node* beforeChang { SVGStyledTransformableElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta); - if (!changedByParser) - invalidateResourceClients(); + if (changedByParser) + return; + + if (RenderObject* object = renderer()) + object->setNeedsLayout(true); } RenderObject* SVGClipPathElement::createRenderer(RenderArena* arena, RenderStyle*) diff --git a/WebCore/svg/SVGClipPathElement.h b/WebCore/svg/SVGClipPathElement.h index eb74f72..11b07fb 100644 --- a/WebCore/svg/SVGClipPathElement.h +++ b/WebCore/svg/SVGClipPathElement.h @@ -39,6 +39,7 @@ public: virtual ~SVGClipPathElement(); virtual bool isValid() const { return SVGTests::isValid(); } + virtual bool needsPendingResourceHandling() const { return false; } virtual void parseMappedAttribute(Attribute*); virtual void svgAttributeChanged(const QualifiedName&); diff --git a/WebCore/svg/SVGElement.cpp b/WebCore/svg/SVGElement.cpp index b262e45..0497edf 100644 --- a/WebCore/svg/SVGElement.cpp +++ b/WebCore/svg/SVGElement.cpp @@ -278,20 +278,22 @@ bool SVGElement::childShouldCreateRenderer(Node* child) const void SVGElement::insertedIntoDocument() { StyledElement::insertedIntoDocument(); - SVGDocumentExtensions* extensions = document()->accessSVGExtensions(); - String resourceId = getIdAttribute(); - if (extensions->isPendingResource(resourceId)) { - OwnPtr<HashSet<SVGStyledElement*> > clients(extensions->removePendingResource(resourceId)); - if (clients->isEmpty()) - return; + if (!needsPendingResourceHandling()) + return; - HashSet<SVGStyledElement*>::const_iterator it = clients->begin(); - const HashSet<SVGStyledElement*>::const_iterator end = clients->end(); + SVGDocumentExtensions* extensions = document()->accessSVGExtensions(); + String resourceId = getIdAttribute(); + if (!extensions->isPendingResource(resourceId)) + return; + + OwnPtr<HashSet<SVGStyledElement*> > clients(extensions->removePendingResource(resourceId)); + if (clients->isEmpty()) + return; - for (; it != end; ++it) - (*it)->buildPendingResource(); - } + const HashSet<SVGStyledElement*>::const_iterator end = clients->end(); + for (HashSet<SVGStyledElement*>::const_iterator it = clients->begin(); it != end; ++it) + (*it)->buildPendingResource(); } void SVGElement::attributeChanged(Attribute* attr, bool preserveDecls) diff --git a/WebCore/svg/SVGElement.h b/WebCore/svg/SVGElement.h index 64afe8e..eccf03e 100644 --- a/WebCore/svg/SVGElement.h +++ b/WebCore/svg/SVGElement.h @@ -97,6 +97,8 @@ namespace WebCore { virtual bool isSupported(StringImpl* feature, StringImpl* version) const; virtual ContainerNode* eventParentNode(); + + virtual bool needsPendingResourceHandling() const { return true; } virtual void buildPendingResource() { } void mapInstanceToElement(SVGElementInstance*); diff --git a/WebCore/svg/SVGFETurbulenceElement.cpp b/WebCore/svg/SVGFETurbulenceElement.cpp index e5b5419..e4987c5 100644 --- a/WebCore/svg/SVGFETurbulenceElement.cpp +++ b/WebCore/svg/SVGFETurbulenceElement.cpp @@ -99,6 +99,9 @@ void SVGFETurbulenceElement::synchronizeProperty(const QualifiedName& attrName) PassRefPtr<FilterEffect> SVGFETurbulenceElement::build(SVGFilterBuilder*) { + if (baseFrequencyX() < 0 || baseFrequencyY() < 0) + return 0; + return FETurbulence::create(static_cast<TurbulanceType>(type()), baseFrequencyX(), baseFrequencyY(), numOctaves(), seed(), stitchTiles() == SVG_STITCHTYPE_STITCH); } diff --git a/WebCore/svg/SVGFilterElement.cpp b/WebCore/svg/SVGFilterElement.cpp index 4387e71..0d55bb1 100644 --- a/WebCore/svg/SVGFilterElement.cpp +++ b/WebCore/svg/SVGFilterElement.cpp @@ -66,7 +66,9 @@ void SVGFilterElement::setFilterRes(unsigned long filterResX, unsigned long filt { setFilterResXBaseValue(filterResX); setFilterResYBaseValue(filterResY); - invalidateResourceClients(); + + if (RenderObject* object = renderer()) + object->setNeedsLayout(true); } void SVGFilterElement::parseMappedAttribute(Attribute* attr) @@ -121,6 +123,10 @@ void SVGFilterElement::svgAttributeChanged(const QualifiedName& attrName) updateRelativeLengthsInformation(); } + RenderObject* object = renderer(); + if (!object) + return; + if (invalidateClients || attrName == SVGNames::filterUnitsAttr || attrName == SVGNames::primitiveUnitsAttr @@ -129,7 +135,7 @@ void SVGFilterElement::svgAttributeChanged(const QualifiedName& attrName) || SVGURIReference::isKnownAttribute(attrName) || SVGLangSpace::isKnownAttribute(attrName) || SVGExternalResourcesRequired::isKnownAttribute(attrName)) - invalidateResourceClients(); + object->setNeedsLayout(true); } void SVGFilterElement::synchronizeProperty(const QualifiedName& attrName) @@ -175,8 +181,11 @@ void SVGFilterElement::childrenChanged(bool changedByParser, Node* beforeChange, { SVGStyledElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta); - if (!changedByParser) - invalidateResourceClients(); + if (changedByParser) + return; + + if (RenderObject* object = renderer()) + object->setNeedsLayout(true); } FloatRect SVGFilterElement::filterBoundingBox(const FloatRect& objectBoundingBox) const diff --git a/WebCore/svg/SVGFilterElement.h b/WebCore/svg/SVGFilterElement.h index 7b0192c..cdb2297 100644 --- a/WebCore/svg/SVGFilterElement.h +++ b/WebCore/svg/SVGFilterElement.h @@ -43,6 +43,8 @@ public: SVGFilterElement(const QualifiedName&, Document*); virtual ~SVGFilterElement(); + virtual bool needsPendingResourceHandling() const { return false; } + void setFilterRes(unsigned long filterResX, unsigned long filterResY); FloatRect filterBoundingBox(const FloatRect&) const; diff --git a/WebCore/svg/SVGFilterPrimitiveStandardAttributes.cpp b/WebCore/svg/SVGFilterPrimitiveStandardAttributes.cpp index 8e284e6..042d93b 100644 --- a/WebCore/svg/SVGFilterPrimitiveStandardAttributes.cpp +++ b/WebCore/svg/SVGFilterPrimitiveStandardAttributes.cpp @@ -107,7 +107,7 @@ void SVGFilterPrimitiveStandardAttributes::childrenChanged(bool changedByParser, SVGStyledElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta); if (!changedByParser) - invalidateResourceClients(); + invalidateFilter(); } void SVGFilterPrimitiveStandardAttributes::setStandardAttributes(bool primitiveBoundingBoxMode, FilterEffect* filterEffect) const diff --git a/WebCore/svg/SVGFilterPrimitiveStandardAttributes.h b/WebCore/svg/SVGFilterPrimitiveStandardAttributes.h index 14784a5..19f6f3a 100644 --- a/WebCore/svg/SVGFilterPrimitiveStandardAttributes.h +++ b/WebCore/svg/SVGFilterPrimitiveStandardAttributes.h @@ -55,7 +55,8 @@ protected: { if (!inDocument() || !parentNode()->hasTagName(SVGNames::filterTag)) return; - static_cast<SVGFilterElement*>(parentNode())->invalidateResourceClients(); + if (RenderObject* object = parentNode()->renderer()) + object->setNeedsLayout(true); } private: diff --git a/WebCore/svg/SVGGradientElement.cpp b/WebCore/svg/SVGGradientElement.cpp index b314674..0d06955 100644 --- a/WebCore/svg/SVGGradientElement.cpp +++ b/WebCore/svg/SVGGradientElement.cpp @@ -85,13 +85,17 @@ void SVGGradientElement::svgAttributeChanged(const QualifiedName& attrName) { SVGStyledElement::svgAttributeChanged(attrName); + RenderObject* object = renderer(); + if (!object) + return; + if (attrName == SVGNames::gradientUnitsAttr || attrName == SVGNames::gradientTransformAttr || attrName == SVGNames::spreadMethodAttr || SVGURIReference::isKnownAttribute(attrName) || SVGExternalResourcesRequired::isKnownAttribute(attrName) || SVGStyledElement::isKnownAttribute(attrName)) - invalidateResourceClients(); + object->setNeedsLayout(true); } void SVGGradientElement::synchronizeProperty(const QualifiedName& attrName) @@ -123,8 +127,11 @@ void SVGGradientElement::childrenChanged(bool changedByParser, Node* beforeChang { SVGStyledElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta); - if (!changedByParser) - invalidateResourceClients(); + if (changedByParser) + return; + + if (RenderObject* object = renderer()) + object->setNeedsLayout(true); } Vector<Gradient::ColorStop> SVGGradientElement::buildStops() diff --git a/WebCore/svg/SVGGradientElement.h b/WebCore/svg/SVGGradientElement.h index 2736ab3..11a13e4 100644 --- a/WebCore/svg/SVGGradientElement.h +++ b/WebCore/svg/SVGGradientElement.h @@ -37,6 +37,8 @@ namespace WebCore { SVGGradientElement(const QualifiedName&, Document*); virtual ~SVGGradientElement(); + virtual bool needsPendingResourceHandling() const { return false; } + virtual void parseMappedAttribute(Attribute*); virtual void svgAttributeChanged(const QualifiedName&); virtual void synchronizeProperty(const QualifiedName&); diff --git a/WebCore/svg/SVGLinearGradientElement.cpp b/WebCore/svg/SVGLinearGradientElement.cpp index d95c084..37f380b 100644 --- a/WebCore/svg/SVGLinearGradientElement.cpp +++ b/WebCore/svg/SVGLinearGradientElement.cpp @@ -76,7 +76,12 @@ void SVGLinearGradientElement::svgAttributeChanged(const QualifiedName& attrName || attrName == SVGNames::x2Attr || attrName == SVGNames::y2Attr) { updateRelativeLengthsInformation(); - invalidateResourceClients(); + + RenderObject* object = renderer(); + if (!object) + return; + + object->setNeedsLayout(true); } } @@ -155,8 +160,10 @@ LinearGradientAttributes SVGLinearGradientElement::collectGradientProperties() current = static_cast<SVGGradientElement*>(refNode); // Cycle detection - if (processedGradients.contains(current)) - return LinearGradientAttributes(); + if (processedGradients.contains(current)) { + current = 0; + break; + } isLinear = current->hasTagName(SVGNames::linearGradientTag); } else diff --git a/WebCore/svg/SVGMarkerElement.cpp b/WebCore/svg/SVGMarkerElement.cpp index 01faf21..195e91d 100644 --- a/WebCore/svg/SVGMarkerElement.cpp +++ b/WebCore/svg/SVGMarkerElement.cpp @@ -113,6 +113,10 @@ void SVGMarkerElement::svgAttributeChanged(const QualifiedName& attrName) updateRelativeLengthsInformation(); } + RenderObject* object = renderer(); + if (!object) + return; + if (invalidateClients || attrName == SVGNames::markerUnitsAttr || attrName == SVGNames::orientAttr @@ -120,7 +124,7 @@ void SVGMarkerElement::svgAttributeChanged(const QualifiedName& attrName) || SVGExternalResourcesRequired::isKnownAttribute(attrName) || SVGFitToViewBox::isKnownAttribute(attrName) || SVGStyledElement::isKnownAttribute(attrName)) - invalidateResourceClients(); + object->setNeedsLayout(true); } void SVGMarkerElement::synchronizeProperty(const QualifiedName& attrName) @@ -166,8 +170,11 @@ void SVGMarkerElement::childrenChanged(bool changedByParser, Node* beforeChange, { SVGStyledElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta); - if (!changedByParser) - invalidateResourceClients(); + if (changedByParser) + return; + + if (RenderObject* object = renderer()) + object->setNeedsLayout(true); } void SVGMarkerElement::setOrientToAuto() @@ -175,7 +182,8 @@ void SVGMarkerElement::setOrientToAuto() setOrientTypeBaseValue(SVG_MARKER_ORIENT_AUTO); setOrientAngleBaseValue(SVGAngle()); - invalidateResourceClients(); + if (RenderObject* object = renderer()) + object->setNeedsLayout(true); } void SVGMarkerElement::setOrientToAngle(const SVGAngle& angle) @@ -183,7 +191,8 @@ void SVGMarkerElement::setOrientToAngle(const SVGAngle& angle) setOrientTypeBaseValue(SVG_MARKER_ORIENT_ANGLE); setOrientAngleBaseValue(angle); - invalidateResourceClients(); + if (RenderObject* object = renderer()) + object->setNeedsLayout(true); } RenderObject* SVGMarkerElement::createRenderer(RenderArena* arena, RenderStyle*) diff --git a/WebCore/svg/SVGMarkerElement.h b/WebCore/svg/SVGMarkerElement.h index 689a7e5..7b13d34 100644 --- a/WebCore/svg/SVGMarkerElement.h +++ b/WebCore/svg/SVGMarkerElement.h @@ -56,6 +56,8 @@ public: SVGMarkerElement(const QualifiedName&, Document*); virtual ~SVGMarkerElement(); + virtual bool needsPendingResourceHandling() const { return false; } + AffineTransform viewBoxToViewTransform(float viewWidth, float viewHeight) const; void setOrientToAuto(); diff --git a/WebCore/svg/SVGMaskElement.cpp b/WebCore/svg/SVGMaskElement.cpp index 5013e5c..a87c28e 100644 --- a/WebCore/svg/SVGMaskElement.cpp +++ b/WebCore/svg/SVGMaskElement.cpp @@ -102,6 +102,10 @@ void SVGMaskElement::svgAttributeChanged(const QualifiedName& attrName) updateRelativeLengthsInformation(); } + RenderObject* object = renderer(); + if (!object) + return; + if (invalidateClients || attrName == SVGNames::maskUnitsAttr || attrName == SVGNames::maskContentUnitsAttr @@ -109,7 +113,7 @@ void SVGMaskElement::svgAttributeChanged(const QualifiedName& attrName) || SVGLangSpace::isKnownAttribute(attrName) || SVGExternalResourcesRequired::isKnownAttribute(attrName) || SVGStyledElement::isKnownAttribute(attrName)) - invalidateResourceClients(); + object->setNeedsLayout(true); } void SVGMaskElement::synchronizeProperty(const QualifiedName& attrName) @@ -141,8 +145,11 @@ void SVGMaskElement::childrenChanged(bool changedByParser, Node* beforeChange, N { SVGStyledElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta); - if (!changedByParser) - invalidateResourceClients(); + if (changedByParser) + return; + + if (RenderObject* object = renderer()) + object->setNeedsLayout(true); } FloatRect SVGMaskElement::maskBoundingBox(const FloatRect& objectBoundingBox) const diff --git a/WebCore/svg/SVGMaskElement.h b/WebCore/svg/SVGMaskElement.h index e941667..2df8f31 100644 --- a/WebCore/svg/SVGMaskElement.h +++ b/WebCore/svg/SVGMaskElement.h @@ -40,6 +40,7 @@ namespace WebCore { virtual ~SVGMaskElement(); virtual bool isValid() const { return SVGTests::isValid(); } + virtual bool needsPendingResourceHandling() const { return false; } FloatRect maskBoundingBox(const FloatRect&) const; virtual void parseMappedAttribute(Attribute*); diff --git a/WebCore/svg/SVGParserUtilities.cpp b/WebCore/svg/SVGParserUtilities.cpp index 14e3d58..b5e695b 100644 --- a/WebCore/svg/SVGParserUtilities.cpp +++ b/WebCore/svg/SVGParserUtilities.cpp @@ -40,8 +40,8 @@ namespace WebCore { */ template <typename FloatType> static bool _parseNumber(const UChar*& ptr, const UChar* end, FloatType& number, bool skip) { - int integer, exponent; - FloatType decimal, frac; + int exponent; + FloatType integer, decimal, frac; int sign, expsign; const UChar* start = ptr; @@ -64,9 +64,19 @@ template <typename FloatType> static bool _parseNumber(const UChar*& ptr, const // The first character of a number must be one of [0-9+-.] return false; - // read the integer part + // read the integer part, build right-to-left + const UChar* ptrStartIntPart = ptr; while (ptr < end && *ptr >= '0' && *ptr <= '9') - integer = (integer * 10) + *(ptr++) - '0'; + ++ptr; // Advance to first non-digit. + + if (ptr != ptrStartIntPart) { + const UChar* ptrScanIntPart = ptr - 1; + FloatType multiplier = 1; + while (ptrScanIntPart >= ptrStartIntPart) { + integer += multiplier * static_cast<FloatType>(*(ptrScanIntPart--) - '0'); + multiplier *= 10; + } + } if (ptr < end && *ptr == '.') { // read the decimals ptr++; diff --git a/WebCore/svg/SVGPatternElement.cpp b/WebCore/svg/SVGPatternElement.cpp index e258946..ee42118 100644 --- a/WebCore/svg/SVGPatternElement.cpp +++ b/WebCore/svg/SVGPatternElement.cpp @@ -129,6 +129,10 @@ void SVGPatternElement::svgAttributeChanged(const QualifiedName& attrName) updateRelativeLengthsInformation(); } + RenderObject* object = renderer(); + if (!object) + return; + if (invalidateClients || attrName == SVGNames::patternUnitsAttr || attrName == SVGNames::patternContentUnitsAttr @@ -139,7 +143,7 @@ void SVGPatternElement::svgAttributeChanged(const QualifiedName& attrName) || SVGExternalResourcesRequired::isKnownAttribute(attrName) || SVGFitToViewBox::isKnownAttribute(attrName) || SVGStyledElement::isKnownAttribute(attrName)) - invalidateResourceClients(); + object->setNeedsLayout(true); } void SVGPatternElement::synchronizeProperty(const QualifiedName& attrName) @@ -188,8 +192,11 @@ void SVGPatternElement::childrenChanged(bool changedByParser, Node* beforeChange { SVGStyledElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta); - if (!changedByParser) - invalidateResourceClients(); + if (changedByParser) + return; + + if (RenderObject* object = renderer()) + object->setNeedsLayout(true); } RenderObject* SVGPatternElement::createRenderer(RenderArena* arena, RenderStyle*) @@ -236,8 +243,10 @@ PatternAttributes SVGPatternElement::collectPatternProperties() const current = static_cast<const SVGPatternElement*>(const_cast<const Node*>(refNode)); // Cycle detection - if (processedPatterns.contains(current)) - return PatternAttributes(); + if (processedPatterns.contains(current)) { + current = 0; + break; + } } else current = 0; } diff --git a/WebCore/svg/SVGPatternElement.h b/WebCore/svg/SVGPatternElement.h index 105b8e2..2a8a7fe 100644 --- a/WebCore/svg/SVGPatternElement.h +++ b/WebCore/svg/SVGPatternElement.h @@ -47,6 +47,7 @@ namespace WebCore { virtual ~SVGPatternElement(); virtual bool isValid() const { return SVGTests::isValid(); } + virtual bool needsPendingResourceHandling() const { return false; } virtual void parseMappedAttribute(Attribute*); virtual void svgAttributeChanged(const QualifiedName&); diff --git a/WebCore/svg/SVGRadialGradientElement.cpp b/WebCore/svg/SVGRadialGradientElement.cpp index 2a97b9d..a970817 100644 --- a/WebCore/svg/SVGRadialGradientElement.cpp +++ b/WebCore/svg/SVGRadialGradientElement.cpp @@ -83,7 +83,12 @@ void SVGRadialGradientElement::svgAttributeChanged(const QualifiedName& attrName || attrName == SVGNames::fyAttr || attrName == SVGNames::rAttr) { updateRelativeLengthsInformation(); - invalidateResourceClients(); + + RenderObject* object = renderer(); + if (!object) + return; + + object->setNeedsLayout(true); } } @@ -168,8 +173,10 @@ RadialGradientAttributes SVGRadialGradientElement::collectGradientProperties() current = static_cast<SVGGradientElement*>(refNode); // Cycle detection - if (processedGradients.contains(current)) - return RadialGradientAttributes(); + if (processedGradients.contains(current)) { + current = 0; + break; + } isRadial = current->hasTagName(SVGNames::radialGradientTag); } else diff --git a/WebCore/svg/SVGScriptElement.cpp b/WebCore/svg/SVGScriptElement.cpp index abe77a9..ea4ac1f 100644 --- a/WebCore/svg/SVGScriptElement.cpp +++ b/WebCore/svg/SVGScriptElement.cpp @@ -242,6 +242,11 @@ void SVGScriptElement::dispatchErrorEvent() dispatchEvent(Event::create(eventNames().errorEvent, true, false)); } +bool SVGScriptElement::shouldExecuteAsJavaScript() const +{ + return m_data.shouldExecuteAsJavaScript(); +} + } #endif // ENABLE(SVG) diff --git a/WebCore/svg/SVGScriptElement.h b/WebCore/svg/SVGScriptElement.h index 770dc89..2d9cae8 100644 --- a/WebCore/svg/SVGScriptElement.h +++ b/WebCore/svg/SVGScriptElement.h @@ -56,7 +56,7 @@ namespace WebCore { virtual void addSubresourceAttributeURLs(ListHashSet<KURL>&) const; - virtual bool shouldExecuteAsJavaScript() const { return false; } + virtual bool shouldExecuteAsJavaScript() const; protected: virtual bool haveLoadedRequiredResources(); diff --git a/WebCore/svg/SVGStyleElement.cpp b/WebCore/svg/SVGStyleElement.cpp index 48fbe69..6050e84 100644 --- a/WebCore/svg/SVGStyleElement.cpp +++ b/WebCore/svg/SVGStyleElement.cpp @@ -1,5 +1,5 @@ /* - Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org> + Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org> 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> Copyright (C) 2006 Apple Computer, Inc. Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au> @@ -34,12 +34,10 @@ namespace WebCore { -using namespace SVGNames; - -SVGStyleElement::SVGStyleElement(const QualifiedName& tagName, Document* doc, bool createdByParser) - : SVGElement(tagName, doc) - , SVGLangSpace() - , m_createdByParser(createdByParser) +SVGStyleElement::SVGStyleElement(const QualifiedName& tagName, Document* document, bool createdByParser) + : SVGElement(tagName, document) + , SVGLangSpace() + , StyleElement(document, createdByParser) { } @@ -90,31 +88,26 @@ void SVGStyleElement::parseMappedAttribute(Attribute* attr) void SVGStyleElement::finishParsingChildren() { - StyleElement::sheet(this); - m_createdByParser = false; + StyleElement::finishParsingChildren(this); SVGElement::finishParsingChildren(); } void SVGStyleElement::insertedIntoDocument() { SVGElement::insertedIntoDocument(); - document()->addStyleSheetCandidateNode(this, m_createdByParser); - if (!m_createdByParser) - StyleElement::insertedIntoDocument(document(), this); + StyleElement::insertedIntoDocument(document(), this); } void SVGStyleElement::removedFromDocument() { SVGElement::removedFromDocument(); - if (document()->renderer()) - document()->removeStyleSheetCandidateNode(this); - StyleElement::removedFromDocument(document()); + StyleElement::removedFromDocument(document(), this); } void SVGStyleElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta) { + StyleElement::childrenChanged(this); SVGElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta); - StyleElement::process(this, 0); } StyleSheet* SVGStyleElement::sheet() @@ -122,13 +115,6 @@ StyleSheet* SVGStyleElement::sheet() return StyleElement::sheet(this); } -bool SVGStyleElement::sheetLoaded() -{ - document()->removePendingSheet(); - return true; -} - } -// vim:ts=4:noet #endif // ENABLE(SVG) diff --git a/WebCore/svg/SVGStyleElement.h b/WebCore/svg/SVGStyleElement.h index ae7ed57..fe11f9c 100644 --- a/WebCore/svg/SVGStyleElement.h +++ b/WebCore/svg/SVGStyleElement.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox@kde.org> + Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org> 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> This library is free software; you can redistribute it and/or @@ -20,48 +20,43 @@ #ifndef SVGStyleElement_h #define SVGStyleElement_h -#if ENABLE(SVG) -#include <SVGElement.h> +#if ENABLE(SVG) +#include "SVGElement.h" #include "SVGLangSpace.h" #include "StyleElement.h" namespace WebCore { - class SVGStyleElement : public SVGElement, - public SVGLangSpace, - public StyleElement { - public: - SVGStyleElement(const QualifiedName&, Document*, bool createdByParser); +class SVGStyleElement : public SVGElement + , public SVGLangSpace + , public StyleElement { +public: + SVGStyleElement(const QualifiedName&, Document*, bool createdByParser); - // Derived from: 'Element' - virtual void parseMappedAttribute(Attribute*); - virtual void insertedIntoDocument(); - virtual void removedFromDocument(); - virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0); + virtual void parseMappedAttribute(Attribute*); + virtual void insertedIntoDocument(); + virtual void removedFromDocument(); + virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0); - virtual void finishParsingChildren(); + virtual void finishParsingChildren(); - virtual bool sheetLoaded(); + virtual bool isLoading() const { return StyleElement::isLoading(); } + virtual bool sheetLoaded() { return StyleElement::sheetLoaded(document()); } - virtual const AtomicString& type() const; - void setType(const AtomicString&, ExceptionCode&); + virtual const AtomicString& type() const; + void setType(const AtomicString&, ExceptionCode&); - virtual const AtomicString& media() const; - void setMedia(const AtomicString&, ExceptionCode&); + virtual const AtomicString& media() const; + void setMedia(const AtomicString&, ExceptionCode&); - virtual String title() const; - void setTitle(const AtomicString&, ExceptionCode&); + virtual String title() const; + void setTitle(const AtomicString&, ExceptionCode&); - StyleSheet* sheet(); - - protected: - bool m_createdByParser; - }; + StyleSheet* sheet(); +}; } // namespace WebCore #endif // ENABLE(SVG) #endif // SVGStyleElement_h - -// vim:ts=4:noet diff --git a/WebCore/svg/SVGStyledElement.cpp b/WebCore/svg/SVGStyledElement.cpp index 6c2993c..09447c5 100644 --- a/WebCore/svg/SVGStyledElement.cpp +++ b/WebCore/svg/SVGStyledElement.cpp @@ -258,17 +258,12 @@ void SVGStyledElement::synchronizeProperty(const QualifiedName& attrName) synchronizeClassName(); } -void SVGStyledElement::invalidateResourceClients() +void SVGStyledElement::attach() { - if (document()->parsing()) - return; - - RenderObject* object = renderer(); - if (!object) - return; + SVGElement::attach(); - if (object->isSVGResourceContainer()) - object->toRenderSVGResourceContainer()->invalidateClients(); + if (RenderObject* object = renderer()) + object->updateFromElement(); } void SVGStyledElement::insertedIntoDocument() diff --git a/WebCore/svg/SVGStyledElement.h b/WebCore/svg/SVGStyledElement.h index 4982908..79ee0d5 100644 --- a/WebCore/svg/SVGStyledElement.h +++ b/WebCore/svg/SVGStyledElement.h @@ -57,6 +57,7 @@ namespace WebCore { virtual void svgAttributeChanged(const QualifiedName&); virtual void synchronizeProperty(const QualifiedName&); + virtual void attach(); virtual void insertedIntoDocument(); virtual void removedFromDocument(); virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0); @@ -64,8 +65,6 @@ namespace WebCore { // Centralized place to force a manual style resolution. Hacky but needed for now. PassRefPtr<RenderStyle> resolveStyle(RenderStyle* parentStyle); - void invalidateResourceClients(); - bool instanceUpdatesBlocked() const; void setInstanceUpdatesBlocked(bool); diff --git a/WebCore/svg/graphics/filters/SVGFETurbulence.cpp b/WebCore/svg/graphics/filters/SVGFETurbulence.cpp index db4b0bb..8042a47 100644 --- a/WebCore/svg/graphics/filters/SVGFETurbulence.cpp +++ b/WebCore/svg/graphics/filters/SVGFETurbulence.cpp @@ -2,6 +2,8 @@ Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org> 2004, 2005 Rob Buis <buis@kde.org> 2005 Eric Seidel <eric@webkit.org> + 2009 Dirk Schulze <krit@webkit.org> + 2010 Renata Hodovan <reni@inf.u-szeged.hu> This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public @@ -23,13 +25,31 @@ #if ENABLE(SVG) && ENABLE(FILTERS) #include "SVGFETurbulence.h" -#include "SVGRenderTreeAsText.h" + +#include "CanvasPixelArray.h" #include "Filter.h" +#include "ImageData.h" +#include "SVGRenderTreeAsText.h" + +#include <wtf/MathExtras.h> namespace WebCore { -FETurbulence::FETurbulence(TurbulanceType type, const float& baseFrequencyX, const float& baseFrequencyY, - const int& numOctaves, const float& seed, bool stitchTiles) +/* + Produces results in the range [1, 2**31 - 2]. Algorithm is: + r = (a * r) mod m where a = randAmplitude = 16807 and + m = randMaximum = 2**31 - 1 = 2147483647, r = seed. + See [Park & Miller], CACM vol. 31 no. 10 p. 1195, Oct. 1988 + To test: the algorithm should produce the result 1043618065 + as the 10,000th generated number if the original seed is 1. +*/ +static const int s_perlinNoise = 4096; +static const long s_randMaximum = 2147483647; // 2**31 - 1 +static const int s_randAmplitude = 16807; // 7**5; primitive root of m +static const int s_randQ = 127773; // m / a +static const int s_randR = 2836; // m % a + +FETurbulence::FETurbulence(TurbulanceType type, float baseFrequencyX, float baseFrequencyY, int numOctaves, float seed, bool stitchTiles) : FilterEffect() , m_type(type) , m_baseFrequencyX(baseFrequencyX) @@ -40,8 +60,7 @@ FETurbulence::FETurbulence(TurbulanceType type, const float& baseFrequencyX, con { } -PassRefPtr<FETurbulence> FETurbulence::create(TurbulanceType type, const float& baseFrequencyX, const float& baseFrequencyY, - const int& numOctaves, const float& seed, bool stitchTiles) +PassRefPtr<FETurbulence> FETurbulence::create(TurbulanceType type, float baseFrequencyX, float baseFrequencyY, int numOctaves, float seed, bool stitchTiles) { return adoptRef(new FETurbulence(type, baseFrequencyX, baseFrequencyY, numOctaves, seed, stitchTiles)); } @@ -106,8 +125,226 @@ void FETurbulence::setStitchTiles(bool stitch) m_stitchTiles = stitch; } -void FETurbulence::apply(Filter*) +// The turbulence calculation code is an adapted version of what appears in the SVG 1.1 specification: +// http://www.w3.org/TR/SVG11/filters.html#feTurbulence + +FETurbulence::PaintingData::PaintingData(long paintingSeed, const IntSize& paintingSize) + : seed(paintingSeed) + , width(0) + , height(0) + , wrapX(0) + , wrapY(0) + , channel(0) + , filterSize(paintingSize) +{ +} + +// Compute pseudo random number. +inline long FETurbulence::PaintingData::random() +{ + long result = s_randAmplitude * (seed % s_randQ) - s_randR * (seed / s_randQ); + if (result <= 0) + result += s_randMaximum; + seed = result; + return result; +} + +inline float smoothCurve(float t) +{ + return t * t * (3 - 2 * t); +} + +inline float linearInterpolation(float t, float a, float b) +{ + return a + t * (b - a); +} + +inline void FETurbulence::initPaint(PaintingData& paintingData) { + float normalizationFactor; + + // The seed value clamp to the range [1, s_randMaximum - 1]. + if (paintingData.seed <= 0) + paintingData.seed = -(paintingData.seed % (s_randMaximum - 1)) + 1; + if (paintingData.seed > s_randMaximum - 1) + paintingData.seed = s_randMaximum - 1; + + float* gradient; + for (int channel = 0; channel < 4; ++channel) { + for (int i = 0; i < s_blockSize; ++i) { + paintingData.latticeSelector[i] = i; + gradient = paintingData.gradient[channel][i]; + gradient[0] = static_cast<float>((paintingData.random() % (2 * s_blockSize)) - s_blockSize) / s_blockSize; + gradient[1] = static_cast<float>((paintingData.random() % (2 * s_blockSize)) - s_blockSize) / s_blockSize; + normalizationFactor = sqrtf(gradient[0] * gradient[0] + gradient[1] * gradient[1]); + gradient[0] /= normalizationFactor; + gradient[1] /= normalizationFactor; + } + } + for (int i = s_blockSize - 1; i >= 0; --i) { + int k = paintingData.latticeSelector[i]; + int j = paintingData.random() % s_blockSize; + ASSERT(j >= 0); + ASSERT(j < 2 * s_blockSize + 2); + paintingData.latticeSelector[i] = paintingData.latticeSelector[j]; + paintingData.latticeSelector[j] = k; + } + for (int i = 0; i < s_blockSize + 2; ++i) { + paintingData.latticeSelector[s_blockSize + i] = paintingData.latticeSelector[i]; + for (int channel = 0; channel < 4; ++channel) { + paintingData.gradient[channel][s_blockSize + i][0] = paintingData.gradient[channel][i][0]; + paintingData.gradient[channel][s_blockSize + i][1] = paintingData.gradient[channel][i][1]; + } + } +} + +inline void checkNoise(int& noiseValue, int limitValue, int newValue) +{ + if (noiseValue >= limitValue) + noiseValue -= newValue; + if (noiseValue >= limitValue - 1) + noiseValue -= newValue - 1; +} + +float FETurbulence::noise2D(PaintingData& paintingData, const FloatPoint& noiseVector) +{ + struct Noise { + int noisePositionIntegerValue; + float noisePositionFractionValue; + + Noise(float component) + { + float position = component + s_perlinNoise; + noisePositionIntegerValue = static_cast<int>(position); + noisePositionFractionValue = position - noisePositionIntegerValue; + } + }; + + Noise noiseX(noiseVector.x()); + Noise noiseY(noiseVector.y()); + float* q; + float sx, sy, a, b, u, v; + + // If stitching, adjust lattice points accordingly. + if (m_stitchTiles) { + checkNoise(noiseX.noisePositionIntegerValue, paintingData.wrapX, paintingData.width); + checkNoise(noiseY.noisePositionIntegerValue, paintingData.wrapY, paintingData.height); + } + + noiseX.noisePositionIntegerValue &= s_blockMask; + noiseY.noisePositionIntegerValue &= s_blockMask; + int latticeIndex = paintingData.latticeSelector[noiseX.noisePositionIntegerValue]; + int nextLatticeIndex = paintingData.latticeSelector[(noiseX.noisePositionIntegerValue + 1) & s_blockMask]; + + sx = smoothCurve(noiseX.noisePositionFractionValue); + sy = smoothCurve(noiseY.noisePositionFractionValue); + + // This is taken 1:1 from SVG spec: http://www.w3.org/TR/SVG11/filters.html#feTurbulenceElement. + int temp = paintingData.latticeSelector[latticeIndex + noiseY.noisePositionIntegerValue]; + q = paintingData.gradient[paintingData.channel][temp]; + u = noiseX.noisePositionFractionValue * q[0] + noiseY.noisePositionFractionValue * q[1]; + temp = paintingData.latticeSelector[nextLatticeIndex + noiseY.noisePositionIntegerValue]; + q = paintingData.gradient[paintingData.channel][temp]; + v = (noiseX.noisePositionFractionValue - 1) * q[0] + noiseY.noisePositionFractionValue * q[1]; + a = linearInterpolation(sx, u, v); + temp = paintingData.latticeSelector[latticeIndex + noiseY.noisePositionIntegerValue + 1]; + q = paintingData.gradient[paintingData.channel][temp]; + u = noiseX.noisePositionFractionValue * q[0] + (noiseY.noisePositionFractionValue - 1) * q[1]; + temp = paintingData.latticeSelector[nextLatticeIndex + noiseY.noisePositionIntegerValue + 1]; + q = paintingData.gradient[paintingData.channel][temp]; + v = (noiseX.noisePositionFractionValue - 1) * q[0] + (noiseY.noisePositionFractionValue - 1) * q[1]; + b = linearInterpolation(sx, u, v); + return linearInterpolation(sy, a, b); +} + +unsigned char FETurbulence::calculateTurbulenceValueForPoint(PaintingData& paintingData, const FloatPoint& point) +{ + float tileWidth = paintingData.filterSize.width(); + ASSERT(tileWidth > 0); + float tileHeight = paintingData.filterSize.height(); + ASSERT(tileHeight > 0); + // Adjust the base frequencies if necessary for stitching. + if (m_stitchTiles) { + // When stitching tiled turbulence, the frequencies must be adjusted + // so that the tile borders will be continuous. + if (m_baseFrequencyX) { + float lowFrequency = floorf(tileWidth * m_baseFrequencyX) / tileWidth; + float highFrequency = ceilf(tileWidth * m_baseFrequencyX) / tileWidth; + // BaseFrequency should be non-negative according to the standard. + if (m_baseFrequencyX / lowFrequency < highFrequency / m_baseFrequencyX) + m_baseFrequencyX = lowFrequency; + else + m_baseFrequencyX = highFrequency; + } + if (m_baseFrequencyY) { + float lowFrequency = floorf(tileHeight * m_baseFrequencyY) / tileHeight; + float highFrequency = ceilf(tileHeight * m_baseFrequencyY) / tileHeight; + if (m_baseFrequencyY / lowFrequency < highFrequency / m_baseFrequencyY) + m_baseFrequencyY = lowFrequency; + else + m_baseFrequencyY = highFrequency; + } + // Set up TurbulenceInitial stitch values. + paintingData.width = roundf(tileWidth * m_baseFrequencyX); + paintingData.wrapX = s_perlinNoise + paintingData.width; + paintingData.height = roundf(tileHeight * m_baseFrequencyY); + paintingData.wrapY = s_perlinNoise + paintingData.height; + } + float turbulenceFunctionResult = 0; + FloatPoint noiseVector(point.x() * m_baseFrequencyX, point.y() * m_baseFrequencyY); + float ratio = 1; + for (int octave = 0; octave < m_numOctaves; ++octave) { + if (m_type == FETURBULENCE_TYPE_FRACTALNOISE) + turbulenceFunctionResult += noise2D(paintingData, noiseVector) / ratio; + else + turbulenceFunctionResult += fabsf(noise2D(paintingData, noiseVector)) / ratio; + noiseVector.setX(noiseVector.x() * 2); + noiseVector.setY(noiseVector.y() * 2); + ratio *= 2; + if (m_stitchTiles) { + // Update stitch values. Subtracting s_perlinNoiseoise before the multiplication and + // adding it afterward simplifies to subtracting it once. + paintingData.width *= 2; + paintingData.wrapX = 2 * paintingData.wrapX - s_perlinNoise; + paintingData.height *= 2; + paintingData.wrapY = 2 * paintingData.wrapY - s_perlinNoise; + } + } + + // Clamp result + turbulenceFunctionResult = std::max(std::min(turbulenceFunctionResult, 255.f), 0.f); + if (m_type == FETURBULENCE_TYPE_FRACTALNOISE) + return static_cast<unsigned char>(turbulenceFunctionResult * 127.5f + 127.5f); // It comes form (turbulenceFunctionResult * 255 + 255) / 2 + return static_cast<unsigned char>(turbulenceFunctionResult * 255); +} + +void FETurbulence::apply(Filter* filter) +{ + if (!getEffectContext()) + return; + + IntRect imageRect(IntPoint(), resultImage()->size()); + if (!imageRect.size().width() || !imageRect.size().height()) + return; + + RefPtr<ImageData> imageData = ImageData::create(imageRect.width(), imageRect.height()); + PaintingData paintingData(floorf(fabsf(m_seed)), imageRect.size()); + initPaint(paintingData); + + FloatRect filterRegion = filter->filterRegion(); + FloatPoint point; + point.setY(filterRegion.y()); + int indexOfPixelChannel = 0; + for (int y = 0; y < imageRect.height(); ++y) { + point.setY(point.y() + 1); + point.setX(filterRegion.x()); + for (int x = 0; x < imageRect.width(); ++x) { + point.setX(point.x() + 1); + for (paintingData.channel = 0; paintingData.channel < 4; ++paintingData.channel, ++indexOfPixelChannel) + imageData->data()->set(indexOfPixelChannel, calculateTurbulenceValueForPoint(paintingData, point)); + } + } + resultImage()->putUnmultipliedImageData(imageData.get(), imageRect, IntPoint()); } void FETurbulence::dump() diff --git a/WebCore/svg/graphics/filters/SVGFETurbulence.h b/WebCore/svg/graphics/filters/SVGFETurbulence.h index bed0637..33e185e 100644 --- a/WebCore/svg/graphics/filters/SVGFETurbulence.h +++ b/WebCore/svg/graphics/filters/SVGFETurbulence.h @@ -2,6 +2,8 @@ Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org> 2004, 2005 Rob Buis <buis@kde.org> 2005 Eric Seidel <eric@webkit.org> + 2009 Dirk Schulze <krit@webkit.org> + 2010 Renata Hodovan <reni@inf.u-szeged.hu> This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public @@ -28,51 +30,71 @@ namespace WebCore { - enum TurbulanceType { - FETURBULENCE_TYPE_UNKNOWN = 0, - FETURBULENCE_TYPE_FRACTALNOISE = 1, - FETURBULENCE_TYPE_TURBULENCE = 2 - }; +enum TurbulanceType { + FETURBULENCE_TYPE_UNKNOWN = 0, + FETURBULENCE_TYPE_FRACTALNOISE = 1, + FETURBULENCE_TYPE_TURBULENCE = 2 +}; + +class FETurbulence : public FilterEffect { +public: + static PassRefPtr<FETurbulence> create(TurbulanceType, float, float, int, float, bool); - class FETurbulence : public FilterEffect { - public: - static PassRefPtr<FETurbulence> create(TurbulanceType, const float&, const float&, const int&, const float&, - bool); + TurbulanceType type() const; + void setType(TurbulanceType); - TurbulanceType type() const; - void setType(TurbulanceType); + float baseFrequencyY() const; + void setBaseFrequencyY(float); - float baseFrequencyY() const; - void setBaseFrequencyY(float); + float baseFrequencyX() const; + void setBaseFrequencyX(float); - float baseFrequencyX() const; - void setBaseFrequencyX(float); + float seed() const; + void setSeed(float); - float seed() const; - void setSeed(float); + int numOctaves() const; + void setNumOctaves(bool); - int numOctaves() const; - void setNumOctaves(bool); + bool stitchTiles() const; + void setStitchTiles(bool); - bool stitchTiles() const; - void setStitchTiles(bool); + void apply(Filter*); + void dump(); + TextStream& externalRepresentation(TextStream&, int indent) const; - void apply(Filter*); - void dump(); - TextStream& externalRepresentation(TextStream&, int indent) const; +private: + static const int s_blockSize = 256; + static const int s_blockMask = s_blockSize - 1; - private: - FETurbulence(TurbulanceType, const float&, const float&, const int&, const float&, - bool); + struct PaintingData { + long seed; + int latticeSelector[2 * s_blockSize + 2]; + float gradient[4][2 * s_blockSize + 2][2]; + int width; // How much to subtract to wrap for stitching. + int height; + int wrapX; // Minimum value to wrap. + int wrapY; + int channel; + IntSize filterSize; - TurbulanceType m_type; - float m_baseFrequencyX; - float m_baseFrequencyY; - int m_numOctaves; - float m_seed; - bool m_stitchTiles; + PaintingData(long paintingSeed, const IntSize& paintingSize); + inline long random(); }; + FETurbulence(TurbulanceType, float, float, int, float, bool); + + inline void initPaint(PaintingData&); + float noise2D(PaintingData&, const FloatPoint&); + unsigned char calculateTurbulenceValueForPoint(PaintingData&, const FloatPoint&); + + TurbulanceType m_type; + float m_baseFrequencyX; + float m_baseFrequencyY; + int m_numOctaves; + float m_seed; + bool m_stitchTiles; +}; + } // namespace WebCore #endif // ENABLE(SVG) && ENABLE(FILTERS) diff --git a/WebCore/workers/WorkerThread.cpp b/WebCore/workers/WorkerThread.cpp index 96ca89b..d6a1e05 100644 --- a/WebCore/workers/WorkerThread.cpp +++ b/WebCore/workers/WorkerThread.cpp @@ -30,7 +30,6 @@ #include "WorkerThread.h" -#include "DatabaseTask.h" #include "DedicatedWorkerContext.h" #include "KURL.h" #include "PlatformString.h" @@ -41,6 +40,11 @@ #include <utility> #include <wtf/Noncopyable.h> +#if ENABLE(DATABASE) +#include "DatabaseTask.h" +#include "DatabaseTracker.h" +#endif + namespace WebCore { static Mutex& threadCountMutex() @@ -225,6 +229,10 @@ void WorkerThread::stop() if (m_workerContext) { m_workerContext->script()->forbidExecution(WorkerScriptController::TerminateRunningScript); +#if ENABLE(DATABASE) + DatabaseTracker::tracker().interruptAllDatabasesForContext(m_workerContext.get()); +#endif + // FIXME: Rudely killing the thread won't work when we allow nested workers, because they will try to post notifications of their destruction. // This can likely use the same mechanism as used for databases above. |