diff options
Diffstat (limited to 'Source/WebCore')
489 files changed, 10619 insertions, 5014 deletions
diff --git a/Source/WebCore/CMakeLists.txt b/Source/WebCore/CMakeLists.txt index e0737d8fd..603ce2196 100644 --- a/Source/WebCore/CMakeLists.txt +++ b/Source/WebCore/CMakeLists.txt @@ -5,6 +5,7 @@ SET(WebCore_INCLUDE_DIRECTORIES "${WEBCORE_DIR}/Modules/indexeddb" "${WEBCORE_DIR}/Modules/intents" "${WEBCORE_DIR}/Modules/notifications" + "${WEBCORE_DIR}/Modules/protocolhandler" "${WEBCORE_DIR}/Modules/quota" "${WEBCORE_DIR}/Modules/webaudio" "${WEBCORE_DIR}/Modules/webdatabase" @@ -127,6 +128,8 @@ SET(WebCore_IDL_FILES Modules/geolocation/PositionError.idl Modules/geolocation/PositionErrorCallback.idl + Modules/protocolhandler/NavigatorRegisterProtocolHandler.idl + Modules/webaudio/AudioBuffer.idl Modules/webaudio/AudioBufferCallback.idl Modules/webaudio/AudioBufferSourceNode.idl @@ -393,7 +396,6 @@ SET(WebCore_IDL_FILES page/Location.idl page/MemoryInfo.idl page/Navigator.idl - page/NavigatorRegisterProtocolHandler.idl page/Performance.idl page/PerformanceEntry.idl page/PerformanceEntryList.idl @@ -435,6 +437,8 @@ SET(WebCore_SOURCES Modules/geolocation/GeolocationController.cpp Modules/geolocation/NavigatorGeolocation.cpp + Modules/protocolhandler/NavigatorRegisterProtocolHandler.cpp + accessibility/AXObjectCache.cpp accessibility/AccessibilityARIAGrid.cpp accessibility/AccessibilityARIAGridCell.cpp @@ -606,6 +610,8 @@ SET(WebCore_SOURCES dom/ExceptionCodePlaceholder.cpp dom/GenericEventQueue.cpp dom/IconURL.cpp + dom/IdTargetObserver.cpp + dom/IdTargetObserverRegistry.cpp dom/KeyboardEvent.cpp dom/MessageChannel.cpp dom/MessageEvent.cpp @@ -670,6 +676,7 @@ SET(WebCore_SOURCES dom/ViewportArguments.cpp dom/WebKitAnimationEvent.cpp dom/WebKitNamedFlow.cpp + dom/WebKitNamedFlowCollection.cpp dom/WebKitTransitionEvent.cpp dom/WheelEvent.cpp dom/WindowEventContext.cpp @@ -1082,7 +1089,6 @@ SET(WebCore_SOURCES page/MouseEventWithHitTestResults.cpp page/Navigator.cpp page/NavigatorBase.cpp - page/NavigatorRegisterProtocolHandler.cpp page/OriginAccessEntry.cpp page/Page.cpp page/PageGroup.cpp @@ -1242,6 +1248,7 @@ SET(WebCore_SOURCES platform/graphics/filters/SourceGraphic.cpp platform/graphics/filters/arm/NEONHelpers.h + platform/graphics/filters/arm/FEBlendNEON.h platform/graphics/filters/arm/FECompositeArithmeticNEON.h platform/graphics/filters/arm/FEGaussianBlurNEON.h platform/graphics/filters/arm/FELightingNEON.cpp @@ -1297,7 +1304,6 @@ SET(WebCore_SOURCES platform/sql/SQLiteStatement.cpp platform/sql/SQLiteTransaction.cpp - platform/text/Base64.cpp platform/text/BidiContext.cpp platform/text/DateTimeFormat.cpp platform/text/Hyphenation.cpp diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog index 96dd7aad2..3bf650a22 100644 --- a/Source/WebCore/ChangeLog +++ b/Source/WebCore/ChangeLog @@ -1,3 +1,4478 @@ +2012-07-14 Eric Carlson <eric.carlson@apple.com> + + Enable AVCF hardware video decoding + https://bugs.webkit.org/show_bug.cgi?id=90015 + <rdar://problem/10770317> + + Reviewed by Anders Carlsson. + + * html/HTMLMediaElement.cpp: + (WebCore): + (WebCore::HTMLMediaElement::mediaPlayerGraphicsDeviceAdapter): New, return the client's graphics + device adapter. + * html/HTMLMediaElement.h: + + * page/ChromeClient.h: + (WebCore::ChromeClient::graphicsDeviceAdapter): New. + + * platform/graphics/MediaPlayer.cpp: + (WebCore::MediaPlayer::graphicsDeviceAdapter): New, ask the media element for the graphics + device adapter. + * platform/graphics/MediaPlayer.h: + + * platform/graphics/avfoundation/cf/AVFoundationCFSoftLinking.h: Soft-link AVCFPlayerSetDirect3DDevice + and AVCFPlayerEnableHardwareAcceleratedVideoDecoderKey. + + * platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp: + (WebCore::MediaPlayerPrivateAVFoundationCF::createAVAssetForURL): Pass the current d3d9 + device interface to the AVFWrapper. + (WebCore::AVFWrapper::createAssetForURL): If the d3d9 device implements IDirect3DDevice9Ex, + tell the AVAsset to enable hardware video decoding. + (WebCore::AVFWrapper::createPlayer): Pass the d3d9 device to the player if it implements IDirect3DDevice9Ex. + + * platform/graphics/ca/win/CACFLayerTreeHost.h: + (WebCore::CACFLayerTreeHost::graphicsDeviceAdapter): New, default implementation. + + * platform/graphics/ca/win/LegacyCACFLayerTreeHost.h: + (WebCore::LegacyCACFLayerTreeHost::graphicsDeviceAdapter): New, default implementation. + * platform/graphics/ca/win/WKCACFViewLayerTreeHost.cpp: + (WebCore::WKCACFViewLayerTreeHost::graphicsDeviceAdapter): New. + * platform/graphics/ca/win/WKCACFViewLayerTreeHost.h: + + * platform/win/SoftLinking.h: Define SOFT_LINK_DLL_IMPORT_OPTIONAL, SOFT_LINK_LOADED_LIBRARY, + and SOFT_LINK_VARIABLE_DLL_IMPORT_OPTIONAL. + +2012-07-14 Ryosuke Niwa <rniwa@webkit.org> + + Fix Chromium Mac build failure after r122670. + + * platform/graphics/mac/ComplexTextController.cpp: + +2012-07-14 Mark Rowe <mrowe@apple.com> + + Fix the Snow Leopard build. + + * platform/LocalizedStrings.cpp: + (WebCore::contextMenuItemTagLookUpInDictionary): Fix a typo in the condition so that Snow Leopard + continues to take the expected path. + +2012-07-14 Ryosuke Niwa <rniwa@webkit.org> + + Accessing the last item in children should be a constant time operation + https://bugs.webkit.org/show_bug.cgi?id=91320 + + Reviewed by Ojan Vafai. + + Traverse nodes from the last item when the target offset we're looking for is closer to the last item + than to the cached item. e.g. if the cached item was at offset 0 in the collection and length was 100, + we should not be looking for the item at offset 95 from the cached item. + + Note that this trick can be only used in HTML collection that supports itemBefore and when the length + cache is available. + + Also broke shouldSearchFromFirstItem into smaller logical pieces to clarify the intents. + + Test: perf/htmlcollection-last-item.html + + * html/HTMLCollection.cpp: + (WebCore): + (WebCore::HTMLCollection::isLastItemCloserThanLastOrCachedItem): + (WebCore::HTMLCollection::isFirstItemCloserThanCachedItem): + (WebCore::HTMLCollection::item): + * html/HTMLCollection.h: + (HTMLCollection): + +2012-07-14 Mark Rowe <mrowe@apple.com> + + Fix the Windows build. + + * platform/network/cf/DNSCFNet.cpp: Fix the condition to take Windows in to account. + +2012-07-14 Mark Rowe <mrowe@apple.com> + + Make it explicit which code paths iOS should use when doing checks based on OS X versions. + + Rubber-stamped by David Kilzer. + + * WebCore.exp.in: + * accessibility/AccessibilityList.h: + * accessibility/AccessibilityTable.h: + * accessibility/mac/AXObjectCacheMac.mm: + * editing/mac/EditorMac.mm: + * loader/MainResourceLoader.cpp: + * loader/MainResourceLoader.h: + * page/AlternativeTextClient.h: + * page/mac/SettingsMac.mm: + * platform/LocalizedStrings.cpp: + * platform/MemoryPressureHandler.cpp: + * platform/audio/mac/AudioBusMac.mm: + * platform/graphics/Gradient.h: + * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: + * platform/graphics/ca/GraphicsLayerCA.cpp: + * platform/graphics/ca/PlatformCALayer.h: + * platform/graphics/ca/mac/PlatformCALayerMac.mm: + * platform/graphics/ca/mac/TileCache.mm: + * platform/graphics/cg/GraphicsContextCG.cpp: + * platform/graphics/cg/ImageBufferCG.cpp: + * platform/graphics/cg/ImageBufferDataCG.h: + * platform/graphics/cg/ImageCG.cpp: + * platform/graphics/cg/ImageSourceCG.cpp: + * platform/graphics/cocoa/FontPlatformDataCocoa.mm: + * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: + * platform/graphics/mac/ComplexTextController.cpp: + * platform/graphics/mac/ComplexTextControllerCoreText.mm: + * platform/graphics/mac/FontCacheMac.mm: + * platform/graphics/mac/FontCustomPlatformData.cpp: + * platform/graphics/mac/FontMac.mm: + * platform/graphics/mac/GraphicsContextMac.mm: + * platform/graphics/mac/SimpleFontDataMac.mm: + * platform/graphics/mac/WebLayer.h: + * platform/graphics/mac/WebLayer.mm: + * platform/graphics/opengl/GraphicsContext3DOpenGL.cpp: + * platform/mac/DisplaySleepDisabler.cpp: + * platform/mac/DisplaySleepDisabler.h: + * platform/mac/HTMLConverter.h: + * platform/mac/HTMLConverter.mm: + * platform/mac/MemoryPressureHandlerMac.mm: + * platform/mac/SharedTimerMac.mm: + * platform/mac/SuddenTermination.mm: + * platform/mac/WebFontCache.mm: + * platform/network/Credential.h: + * platform/network/ResourceHandle.h: + * platform/network/cf/DNSCFNet.cpp: + * platform/network/cf/ProxyServerCFNet.cpp: + * platform/network/cf/ResourceRequest.h: + * platform/network/cf/SocketStreamHandleCFNet.cpp: + * platform/network/mac/AuthenticationMac.mm: + * platform/network/mac/CookieStorageMac.mm: + * platform/network/mac/ResourceHandleMac.mm: + * platform/network/mac/ResourceRequestMac.mm: + * platform/network/mac/WebCoreURLResponse.mm: + * platform/text/TextChecking.h: + * platform/text/cf/HyphenationCF.cpp: + * platform/text/mac/HyphenationMac.mm: + * rendering/RenderLayerBacking.cpp: + * rendering/RenderLayerCompositor.cpp: + +2012-07-14 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r122614. + http://trac.webkit.org/changeset/122614 + https://bugs.webkit.org/show_bug.cgi?id=91317 + + Broke performance tests (Requested by rniwa on #webkit). + + * bindings/v8/V8Binding.cpp: + (WebCore::StringCache::v8ExternalStringSlow): + +2012-07-05 Robert Hogan <robert@webkit.org> + + CSS 2.1 failure: vertical-align-boxes-001 fails + https://bugs.webkit.org/show_bug.cgi?id=90626 + + Reviewed by Eric Seidel. + + Tests: css2.1/20110323/vertical-align-boxes-001.htm + + A percentage value vertical-align is always a percentage of the actual line-height rather than + the margin box per http://www.w3.org/TR/CSS21/visudet.html#propdef-vertical-align: 'Percentages: + refer to the 'line-height' of the element itself'. Confusingly, RenderBox::lineheight() is a + shorthand into the dimensions of the margin box for replaced elements in the other vertical-align + cases, i.e. where it's the margin box that's relevant rather than the 'line-height'. So rather than patch RenderBox's + lineHeight() to somehow consider the percentage cases, just give percentage vertical-align the full computedLineHeight() + rather than lineHeight()'s margin box. + + * rendering/RootInlineBox.cpp: + (WebCore::RootInlineBox::verticalPositionForBox): + +2012-07-13 Ryosuke Niwa <rniwa@webkit.org> + + Iterating backwards over HTMLCollection is O(n^2) + https://bugs.webkit.org/show_bug.cgi?id=91306 + + Reviewed by Anders Carlsson. + + Fixed the bug by introducing itemBefore that iterates nodes backwards to complement itemAfter. + Unfortunately, some HTML collections such as HTMLFormCollection and HTMLTableRowsCollection have + its own itemAfter function and writing an equivalent itemBefore is somewhat tricky. For now, + added a new boolean flag indicating whether a given HTML collection supports itemBefore or not, + and left those HTML collections that override itemAfter alone. + + This also paves our way to share more code between DynamicNodeList and HTMLCollection. + + Test: perf/htmlcollection-backwards-iteration.html + + * dom/DynamicNodeList.h: + (WebCore::DynamicNodeListCacheBase::DynamicNodeListCacheBase): Takes ItemBeforeSupportType. + (WebCore::DynamicNodeListCacheBase::supportsItemBefore): Added. + (DynamicNodeListCacheBase): + (WebCore::DynamicNodeListCacheBase::setItemCache): Replaced a FIXME by an assertion now that + we can. + * html/HTMLAllCollection.cpp: + (WebCore::HTMLAllCollection::HTMLAllCollection): Supports itemBefore since it doesn't override + itemAfter. + * html/HTMLCollection.cpp: + (WebCore::HTMLCollection::HTMLCollection): + (WebCore::HTMLCollection::create): + (WebCore::isAcceptableElement): Made it a static local function instead of a static member. + (WebCore::nextNode): Templatized. + (WebCore::itemBeforeOrAfter): Extracted from itemAfter and templatized. + (WebCore::HTMLCollection::itemBefore): Added. + (WebCore::HTMLCollection::itemAfter): + (WebCore::HTMLCollection::shouldSearchFromFirstItem): Added. Determines whether we should reset + the item cache to the first item. We obviously do if the cache is invalid. If the target offset + is after the cached offset, then we shouldn't go back regardless of availability of itemBefore. + Otherwise, we go back to the first item iff itemBefore is not available or the distance from + the cached offset to the target offset is greater than the target offset itself. + (WebCore::HTMLCollection::length): + (WebCore::HTMLCollection::item): Use the term "offset" to match the terminology elsewhere. + (WebCore::HTMLCollection::itemBeforeOrAfterCachedItem): Ditto. Also added the logic to iterate + nodes backwards using itemBefore. Once we're in this branch, we should always find a matching + item since the target offset was less than the cached offset, and offsets are non-negative. + If we had ever reached the end of the loop without finding an item, it indicates that the cache + has been invalid and we have some serious bug elsewhere. + * html/HTMLCollection.h: + (WebCore::HTMLCollectionCacheBase::HTMLCollectionCacheBase): + (HTMLCollection): + * html/HTMLOptionsCollection.cpp: + (WebCore::HTMLOptionsCollection::HTMLOptionsCollection): Supports itemBefore since it doesn't + override itemAfter. + * html/HTMLFormCollection.cpp: + (WebCore::HTMLFormCollection::HTMLFormCollection): Doesn't support itemBefore as it overrides + itemAfter. + * html/HTMLNameCollection.cpp: + (WebCore::HTMLNameCollection::HTMLNameCollection): Ditto. + * html/HTMLPropertiesCollection.cpp: + (WebCore::HTMLPropertiesCollection::HTMLPropertiesCollection): + * html/HTMLTableRowsCollection.cpp: + (WebCore::HTMLTableRowsCollection::HTMLTableRowsCollection): + +2012-07-13 Eric Penner <epenner@google.com> + + [chromium] Add 'self-managed' option to CCPrioritizedTexture to enable render-surface and canvas use cases. + https://bugs.webkit.org/show_bug.cgi?id=91177 + + Reviewed by Adrienne Walker. + + This makes the render-surface memory use case generic as 'self-managed' textures, + as this use case is popping up in other places (eg. canvases). It's exactly the + same idea except we can have as many place-holders as we want at arbitrary + priorities. + + This already tested by the render surface unit tests which now also use the + generic placeholder. + + * platform/graphics/chromium/cc/CCLayerTreeHost.cpp: + (WebCore::CCLayerTreeHost::CCLayerTreeHost): + (WebCore::CCLayerTreeHost::initializeLayerRenderer): + (WebCore::CCLayerTreeHost::updateLayers): + (WebCore::CCLayerTreeHost::setPrioritiesForSurfaces): + (WebCore): + (WebCore::CCLayerTreeHost::setPrioritiesForLayers): + (WebCore::CCLayerTreeHost::prioritizeTextures): + (WebCore::CCLayerTreeHost::calculateMemoryForRenderSurfaces): + (WebCore::CCLayerTreeHost::paintLayerContents): + * platform/graphics/chromium/cc/CCLayerTreeHost.h: + (CCLayerTreeHost): + * platform/graphics/chromium/cc/CCPrioritizedTexture.cpp: + (WebCore::CCPrioritizedTexture::CCPrioritizedTexture): + (WebCore::CCPrioritizedTexture::setToSelfManagedMemoryPlaceholder): + * platform/graphics/chromium/cc/CCPrioritizedTexture.h: + (CCPrioritizedTexture): + (WebCore::CCPrioritizedTexture::setIsSelfManaged): + (WebCore::CCPrioritizedTexture::isSelfManaged): + * platform/graphics/chromium/cc/CCPrioritizedTextureManager.cpp: + (WebCore::CCPrioritizedTextureManager::prioritizeTextures): + (WebCore::CCPrioritizedTextureManager::acquireBackingTextureIfNeeded): + (WebCore::CCPrioritizedTextureManager::destroyBacking): + * platform/graphics/chromium/cc/CCPrioritizedTextureManager.h: + (CCPrioritizedTextureManager): + (WebCore::CCPrioritizedTextureManager::memoryForSelfManagedTextures): + +2012-07-13 Kent Tamura <tkent@chromium.org> + + Internals: Clean up the mock PagePopupDriver correctly. + https://bugs.webkit.org/show_bug.cgi?id=91250 + + Unreviewed, a trivial testing code fix. + + * testing/InternalSettings.cpp: + (WebCore::InternalSettings::Backup::restoreTo): + (WebCore::InternalSettings::reset): + Resetting PaePopupDriver here instead of Backup::restoreTo. + Also, close the mock popup before resetting PagePopupDriver by clearing m_pagePopupDriver. + * testing/MockPagePopupDriver.cpp: + (WebCore::MockPagePopupDriver::~MockPagePopupDriver): + Close the popup. + +2012-07-13 Tony Payne <tpayne@chromium.org> + + Remove Widget from screenColorProfile + https://bugs.webkit.org/show_bug.cgi?id=91300 + + Reviewed by Adam Barth. + + Chromium, the only platform implementing screenColorProfile, does not + need the Widget, so removing for simplicity. + + Covered by existing tests. + + * platform/PlatformScreen.h: + (WebCore): Updated comment to remove reference to type param that no + longer exists and removed Widget param. + * platform/blackberry/PlatformScreenBlackBerry.cpp: + (WebCore::screenColorProfile): Removed widget param. + * platform/chromium/PlatformScreenChromium.cpp: + (WebCore::screenColorProfile): Removed widget param. + * platform/efl/PlatformScreenEfl.cpp: + (WebCore::screenColorProfile): Removed widget param. + * platform/gtk/PlatformScreenGtk.cpp: + (WebCore::screenColorProfile): Removed widget param. + * platform/image-decoders/ImageDecoder.h: + (WebCore::ImageDecoder::qcmsOutputDeviceProfile): removed param to + match screenColorProfile()'s new spec. + * platform/mac/PlatformScreenMac.mm: + (WebCore::screenColorProfile): Removed widget param. + * platform/qt/PlatformScreenQt.cpp: + (WebCore::screenColorProfile): Removed widget param. + * platform/win/PlatformScreenWin.cpp: + (WebCore::screenColorProfile): Removed widget param. + +2012-07-13 Brian Anderson <brianderson@chromium.org> + + [chromium] Add flushes to CCTextureUpdater::update + https://bugs.webkit.org/show_bug.cgi?id=89035 + + Reviewed by Adrienne Walker. + + Automatic flushes are being removed from the command buffer, so + this moves the flushes into the CCTextureUpdater itself. + + CCTextureUpdaterTest added to verify texture upload/flushing patterns. + + * platform/graphics/chromium/cc/CCGraphicsContext.h: + (WebCore::CCGraphicsContext::flush): + (CCGraphicsContext): + * platform/graphics/chromium/cc/CCTextureUpdater.cpp: + (WebCore): + (WebCore::CCTextureUpdater::update): Manual flushes added here. + +2012-07-13 Kiran Muppala <cmuppala@apple.com> + + REGRESSION: RenderInline boundingBox ignores relative position offset + https://bugs.webkit.org/show_bug.cgi?id=91168 + + Reviewed by Simon Fraser. + + RenderGeometryMap, used for caching the transform to the view, + expects the first mapping pushed, to be that of the view itself. + RenderInline was instead pushing it's own offset first. Besides + the offset of the view itself was not being pushed. + + Relaxed the RenderGeometryMap restriction that the first pushed + step should be of the view. It is sufficient that the view's mapping + is pushed in the first call to pushMappingsToAncestor. Modified + RenderInline to push the offset of the view also to the geometry map. + + Test: fast/inline/inline-relative-offset-boundingbox.html + + * rendering/RenderGeometryMap.cpp: + (WebCore::RenderGeometryMap::pushMappingsToAncestor): Add assertion to + check if mapping to view was pushed in first invocation. + (WebCore::RenderGeometryMap::pushView): Correct assertion that checks + if the view's mapping is the first one to be applied. + (WebCore::RenderGeometryMap::stepInserted): Use isRenderView to check if + a mapping step belongs to a view instead of using mapping size. + (WebCore::RenderGeometryMap::stepRemoved): Ditto. + * rendering/RenderInline.cpp: + (WebCore::(anonymous namespace)::AbsoluteQuadsGeneratorContext::AbsoluteQuadsGeneratorContext): + Push mappings all the way up to and including the view. + +2012-07-13 Xianzhu Wang <wangxianzhu@chromium.org> + + Move WebCore/platform/text/Base64 to WTF/wtf/text + https://bugs.webkit.org/show_bug.cgi?id=91162 + + Reviewed by Adam Barth. + + No new tests. Files moving only. + + * CMakeLists.txt: + * GNUmakefile.list.am: + * Modules/websockets/WebSocketHandshake.cpp: + (WebCore::generateSecWebSocketKey): + (WebCore::WebSocketHandshake::getExpectedWebSocketAccept): + * Target.pri: + * WebCore.gypi: + * WebCore.order: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * fileapi/FileReaderLoader.cpp: + (WebCore::FileReaderLoader::convertToDataURL): + * inspector/DOMPatchSupport.cpp: + (WebCore::DOMPatchSupport::createDigest): + * inspector/InspectorFileSystemAgent.cpp: + (WebCore): + * inspector/InspectorPageAgent.cpp: + (WebCore::InspectorPageAgent::cachedResourceContent): + (WebCore::InspectorPageAgent::sharedBufferContent): + * loader/archive/mhtml/MHTMLArchive.cpp: + (WebCore::MHTMLArchive::generateMHTMLData): + * loader/archive/mhtml/MHTMLParser.cpp: + (WebCore::MHTMLParser::parseNextPart): + * page/DOMWindow.cpp: + (WebCore::DOMWindow::btoa): + (WebCore::DOMWindow::atob): + * page/Page.cpp: + (WebCore::Page::userStyleSheetLocationChanged): + * platform/graphics/cairo/ImageBufferCairo.cpp: + (WebCore::ImageBuffer::toDataURL): + * platform/graphics/cg/ImageBufferCG.cpp: + (WebCore::CGImageToDataURL): + * platform/graphics/gtk/ImageBufferGtk.cpp: + (WebCore::ImageBuffer::toDataURL): + * platform/graphics/skia/FontCustomPlatformData.cpp: + (WebCore::createUniqueFontName): + * platform/graphics/skia/ImageBufferSkia.cpp: + (WebCore::ImageBuffer::toDataURL): + (WebCore::ImageDataToDataURL): + * platform/graphics/win/FontCustomPlatformData.cpp: + (WebCore::createUniqueFontName): + * platform/graphics/wince/FontCustomPlatformData.cpp: + (WebCore::createUniqueFontName): + * platform/graphics/wince/ImageBufferWinCE.cpp: + * platform/graphics/wx/ImageBufferWx.cpp: + * platform/network/DataURL.cpp: + (WebCore::handleDataURL): + * platform/network/cf/ResourceHandleCFNet.cpp: + (WebCore::applyBasicAuthorizationHeader): + * platform/network/mac/ResourceHandleMac.mm: + (WebCore::applyBasicAuthorizationHeader): + * platform/network/soup/ResourceHandleSoup.cpp: + * platform/win/SSLKeyGeneratorWin.cpp: + (WebCore::WebCore::signedPublicKeyAndChallengeString): + +2012-07-13 Xianzhu Wang <wangxianzhu@chromium.org> + + [Chromium] Sometimes bottom of text is truncated when page has a fractional scale + https://bugs.webkit.org/show_bug.cgi?id=88684 + + Reviewed by Tony Chang. + + When the page has a fractional scale, the ascent and descent part of the fonts might be fractional. + If the descent part is rounded down, the bottom of the text might be truncated when displayed + when subpixel text positioning is enabled. + To avoid that, borrow one unit from the ascent when possible. + + Test: fast/text/descent-clip-in-scaled-page.html + + * platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.cpp: + (WebCore::FontPlatformData::setupPaint): Moved NoPreference handling into querySystemForRenderStyle so that fontRenderStyle() can have actual styles without NoPreference. + (WebCore::FontPlatformData::querySystemForRenderStyle): Added NoPreference handling (moved from setupPaint) + * platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.h: + (FontPlatformData): + (WebCore::FontPlatformData::fontRenderStyle): Added to let SimpleFontDataSkia access the font render styles. + * platform/graphics/skia/SimpleFontDataSkia.cpp: + (WebCore::SimpleFontData::platformInit): + +2012-07-13 Ryosuke Niwa <rniwa@webkit.org> + + Remove an assertion after r122637. + + * dom/DynamicNodeList.h: + (WebCore::DynamicNodeListCacheBase::shouldInvalidateTypeOnAttributeChange): + +2012-07-13 Pierre Rossi <pierre.rossi@gmail.com> + + [Qt] Improve the mobile theme slightly + https://bugs.webkit.org/show_bug.cgi?id=90806 + + Reviewed by Kenneth Rohde Christiansen. + + Improve drawing of the mobile theme's controls' background. + + Ensure the focus ring never appears with the mobile theme, since it + looks bad in combination with the highlights. + + No new tests. The painting code from the mobile theme is still + not covered specifically (it will when we revive pixel tests). + + * platform/qt/RenderThemeQtMobile.cpp: + (WebCore): + (WebCore::addPointToOctants): Added. This is simply a helper to avoid + doing too much duplicate work in drawControlBackground. + (WebCore::drawControlBackground): Rely on the octant logic added above + and take the opportunity to increase the granularity. + (WebCore::borderPen): + (WebCore::StylePainterMobile::findLineEdit): + (WebCore::RenderThemeQtMobile::adjustTextFieldStyle): + * platform/qt/RenderThemeQtMobile.h: + (RenderThemeQtMobile): + (WebCore::RenderThemeQtMobile::supportsFocusRing): + +2012-07-13 Julien Chaffraix <jchaffraix@webkit.org> + + Remove an always-failing table-wrapping check in RenderObject::addChild + https://bugs.webkit.org/show_bug.cgi?id=91286 + + Reviewed by Eric Seidel. + + Due to the structure of the code, this test is always failing (newChild->isTableCell() + is true to get in the branch). + + The changeset adding the code didn't add testing so I poundered adding the mentioned test, + which is passing. However the test would need to be blindly changed to be included in our + test harness. I would also expect this code to be exercised by other table tests anyway. + + * rendering/RenderObject.cpp: + (WebCore::RenderObject::addChild): + Removed never-reached branch. While at it, removed a 'what' comment in the same file. + +2012-07-13 Emil A Eklund <eae@chromium.org> + + Use LayoutBoxExtent for image outsets + https://bugs.webkit.org/show_bug.cgi?id=91166 + + Reviewed by Tony Chang. + + Change RenderStyle and calling code to use LayoutBoxExtent for image + outsets and remove text direction and writing mode versions of the + outline getters from RenderStyle as LayoutBoxExtent provides the same + functionality. + + No new tests, no change in functionality. + + * platform/graphics/FractionalLayoutBoxExtent.h: + * platform/graphics/FractionalLayoutBoxExtent.cpp: + (WebCore::FractionalLayoutBoxExtent::logicalTop): + (WebCore::FractionalLayoutBoxExtent::logicalBottom): + Add logicalTop and logicalBottom methods to go with the existing + logicalLeft and logicalRight ones. + + * platform/graphics/FractionalLayoutRect.h: + (WebCore::FractionalLayoutRect::expand): + Add FractionalLayoutBoxExtent version of expand method. + + * rendering/InlineFlowBox.cpp: + (WebCore::InlineFlowBox::addBorderOutsetVisualOverflow): + Change implementation to use the new FractionalLayoutBoxExtent version of + borderImageOutsets and the logicalTop/Bottom/Left/Right methods. + + (WebCore::clipRectForNinePieceImageStrip): + Change implementation to use the new FractionalLayoutBoxExtent version of + borderImageOutsets. + + * rendering/RenderBox.cpp: + (WebCore::RenderBox::maskClipRect): + Change implementation to use the new FractionalLayoutBoxExtent version of + borderImageOutsets and the new FractionalLayoutRect::expand method. + + (WebCore::RenderBox::addVisualEffectOverflow): + Change implementation to use the new FractionalLayoutBoxExtent version of + borderImageOutsets. + + * rendering/RenderBoxModelObject.cpp: + (WebCore::RenderBoxModelObject::paintNinePieceImage): + Change implementation to use the new FractionalLayoutBoxExtent version of + borderImageOutsets and the new FractionalLayoutRect::expand method. + + * rendering/style/RenderStyle.h: + * rendering/style/RenderStyle.cpp: + (WebCore::RenderStyle::imageOutsets): + Change getImageOutsets to return a FractionalLayoutBoxExtent object and + rename to imageOutsets to match the webkit naming convention for getters. + + Remove getBorderImageHorizontalOutsets, getBorderImageVerticalOutsets, + getBorderImageInlineDirectionOutsets, getImageHorizontalOutsets, + getImageVerticalOutsets and getBorderImageBlockDirectionOutsets methods + as the same functionality is provided by FractionalLayoutBoxExtent. + +2012-07-13 David Hyatt <hyatt@apple.com> + + https://bugs.webkit.org/show_bug.cgi?id=91278 + Improve block margin estimation function to account for not having a layout and for quirks mode + + Reviewed by Simon Fraser. + + * rendering/RenderBlock.cpp: + (WebCore::RenderBlock::marginBeforeEstimateForChild): + Revise marginBeforeEstimateForChild so that it computes block margins for the grandchild before + recurring. This includes the quirks margin information as well. This ensures that the margins are + up-to-date when checked, even before the object has had its first layout. + + * rendering/RenderBlock.h: + (WebCore::RenderBlock::setMarginStartForChild): + (WebCore::RenderBlock::setMarginEndForChild): + (WebCore::RenderBlock::setMarginBeforeForChild): + (WebCore::RenderBlock::setMarginAfterForChild): + * rendering/RenderBox.cpp: + (WebCore::RenderBox::computeBlockDirectionMargins): + * rendering/RenderBox.h: + (RenderBox): + Add consts in order to compile. + +2012-07-13 Ryosuke Niwa <rniwa@webkit.org> + + NodeLists should not invalidate on irreleavnt attribute changes + https://bugs.webkit.org/show_bug.cgi?id=91277 + + Reviewed by Ojan Vafai. + + Explicitely check the invalidation type and the changed attribute in NodeListNodeData::invalidateCaches + and ElementRareData::clearHTMLCollectionCaches to only invalidate node lists affected by the change. + + Also merged invalidateNodeListsCacheAfterAttributeChanged and invalidateNodeListsCacheAfterChildrenChanged + as invalidateNodeListCachesInAncestors since they're almost identical after r122498. + + In addition, moved shouldInvalidateNodeListForType from Document.cpp to DynamicNodeList.h and renamed it to + shouldInvalidateTypeOnAttributeChange since it needs to called in Node.cpp and ElementRareData.h. + + * dom/Attr.cpp: + (WebCore::Attr::setValue): + (WebCore::Attr::childrenChanged): + * dom/ContainerNode.cpp: + (WebCore::ContainerNode::childrenChanged): + * dom/Document.cpp: + (WebCore::Document::registerNodeListCache): Calls isRootedAtDocument() instead of directly comparing + the value of NodeListRootType in order to prepare for the bug 80269. + (WebCore::Document::unregisterNodeListCache): Ditto. + (WebCore): shouldInvalidateNodeListForType is moved to DynamicNodeList.h + (WebCore::Document::shouldInvalidateNodeListCaches): + * dom/DynamicNodeList.h: + (DynamicNodeListCacheBase): + (WebCore::DynamicNodeListCacheBase::shouldInvalidateTypeOnAttributeChange): Moved from Document.cpp. + * dom/Element.cpp: + (WebCore::Element::attributeChanged): + * dom/ElementRareData.h: + (WebCore::ElementRareData::clearHTMLCollectionCaches): Takes const QualifiedName* to compare against + the invalidation type of HTML collections via shouldInvalidateTypeOnAttributeChange. + * dom/Node.cpp: + (WebCore::Node::invalidateNodeListCachesInAncestors): Merged invalidateNodeListCachesInAncestors and + invalidateNodeListsCacheAfterChildrenChanged. Also pass attrName to clearHTMLCollectionCaches. + (WebCore::NodeListsNodeData::invalidateCaches): Compares attrName against the invalidation type of + node lists via shouldInvalidateTypeOnAttributeChange. + (WebCore): + * dom/Node.h: + (Node): + * dom/NodeRareData.h: + (WebCore::NodeRareData::ensureNodeLists): Merged NodeRareData::createNodeLists. + (WebCore::NodeRareData::clearChildNodeListCache): Moved from Node.cpp. + (NodeRareData): + * html/HTMLCollection.h: + (HTMLCollectionCacheBase): + +2012-07-13 Arpita Bahuguna <arpitabahuguna@gmail.com> + + Refactor RenderTable to use the section's iteration functions. + https://bugs.webkit.org/show_bug.cgi?id=89751 + + Reviewed by Julien Chaffraix. + + Removing anti-pattern wherever possible from RenderTable code. Also, modifying + RenderTable sections' iterations to use helper functions. + + No new tests required for this change since no change in behavior is expected. + + * rendering/RenderTable.cpp: + (WebCore::RenderTable::addOverflowFromChildren): + (WebCore::RenderTable::setCellLogicalWidths): + (WebCore::RenderTable::outerBorderStart): + (WebCore::RenderTable::outerBorderEnd): + Removed anti-patterns involving iterations over RenderObjects. + + (WebCore::RenderTable::outerBorderAfter): + Modified RenderTable sections' iteration to use helper functions. + +2012-07-13 Enrica Casucci <enrica@apple.com> + + Threadsafety issues in WebScriptObject + https://bugs.webkit.org/show_bug.cgi?id=90849 + + Reviewed by Geoff Garen. + + Updated fix for this bug. The JSC API lock needs to be acquired also in JSObject. + + * bindings/objc/WebScriptObject.mm: + (-[WebScriptObject JSObject]): + +2012-07-13 Raymond Toy <rtoy@google.com> + + DelayNode doesn't work if delayTime.value == delayTime.maxValue + https://bugs.webkit.org/show_bug.cgi?id=90357 + + Reviewed by Kenneth Russell. + + Increase delay buffer size slightly so that the read and write + pointers don't become equal when the delay and the max delay are + the same. + + Tests: webaudio/delaynode-max-default-delay.html + webaudio/delaynode-max-nondefault-delay.html + + * Modules/webaudio/DelayDSPKernel.cpp: + (WebCore): Moved SmoothingTimeConstant to WebCore namespace. + (WebCore::DelayDSPKernel::DelayDSPKernel): Add some additional checks to prevent crashes; use bufferLengthForDelay to compute buffer length. + (WebCore::DelayDSPKernel::bufferLengthForDelay): New function to compute buffer length. + * Modules/webaudio/DelayDSPKernel.h: + (DelayDSPKernel): Declare bufferLengthForDelay. + +2012-07-13 Benjamin Poulain <bpoulain@apple.com> + + Always aggressively preload on iOS + https://bugs.webkit.org/show_bug.cgi?id=91276 + + Reviewed by Simon Fraser. + + * loader/cache/CachedResourceLoader.cpp: + (WebCore::CachedResourceLoader::preload): + +2012-07-13 Vineet Chaudhary <rgf748@motorola.com> + + Restructure V8Utilities::extractTransferables() with help of toV8Sequence() + https://bugs.webkit.org/show_bug.cgi?id=91208 + + Reviewed by Kentaro Hara. + + We can remove the specialised check for MessagePort from V8Utilities::extractTransferables() + using toV8Sequence() as it validates the passed object for sequence type per WebIDL spec. + + No new test as just refactoring. + Existing tests under fast/dom/Window/window-* fast/dom/events/* + covers tests. + + * bindings/v8/V8Utilities.cpp: + (WebCore::extractTransferables): + +2012-07-13 Vincent Scheib <scheib@chromium.org> + + Pointer Lock handles disconnected DOM elements + https://bugs.webkit.org/show_bug.cgi?id=77029 + + Reviewed by Adrienne Walker. + + Pointer Lock Controller now checks when elements or documents are + removed, and unlocks if the target element is being removed. + + Tests: pointer-lock/locked-element-iframe-removed-from-dom.html + pointer-lock/locked-element-removed-from-dom.html + + * dom/Document.cpp: + (WebCore::Document::detach): + * dom/Element.cpp: + (WebCore::Element::removedFrom): + (WebCore::Element::webkitRequestPointerLock): + * page/PointerLockController.cpp: + (WebCore::PointerLockController::requestPointerLock): + (WebCore::PointerLockController::elementRemoved): + (WebCore): + (WebCore::PointerLockController::documentDetached): + (WebCore::PointerLockController::didLosePointerLock): + (WebCore::PointerLockController::enqueueEvent): + * page/PointerLockController.h: + (WebCore): + (PointerLockController): + +2012-07-13 Ryosuke Niwa <rniwa@webkit.org> + + HTMLCollection should use DynamicNodeList's invalidation model + https://bugs.webkit.org/show_bug.cgi?id=90326 + + Reviewed by Anders Carlsson. + + Make HTMLCollection invalidated upon attribute and children changes instead of invalidating it on demand + by comparing DOM tree versions. Node that HTMLCollections owned by Document are invalidated with other + document-rooted node lists in m_listsInvalidatedAtDocument for simplicity although this mechanism is + normally used for node lists owned by a non-Document node that contains nodes outside of its subtree. + ItemProperties and FormControls are more "traditional" users of the mechanism. + + Also, merged DynamicNodeList::invalidateCache and HTMLCollection::invalidateCache. + + * dom/Document.cpp: + (WebCore::Document::registerNodeListCache): Renamed. No longer takes NodeListInvalidationType or + NodeListRootType since they can be obtained from the cache base. Increment the node list counter for + InvalidateOnIdNameAttrChange when a HTMLCollection is passed in since all HTMLCollections need to be + invalidated on id or name content attribute changes due to named getters. + (WebCore::Document::unregisterNodeListCache): Ditto. + (WebCore::shouldInvalidateNodeListForType): + (WebCore::Document::shouldInvalidateNodeListCaches): + (WebCore::Document::clearNodeListCaches): + * dom/Document.h: + (WebCore): Added InvalidateOnIdNameAttrChange, InvalidateOnHRefAttrChange, and InvalidateOnAnyAttrChange. + (Document): + * dom/DynamicNodeList.cpp: + (WebCore::DynamicNodeListCacheBase::invalidateCache): Added. Invalidates caches of both DynamicNodeList + and HTMLCollection. We can't afford to use virtual function calls here because this function is called on + all node lists and HTML collections owned by ancestors of an element under which a node is added, removed, + or its attributes are changed. + (WebCore): + * dom/DynamicNodeList.h: + (WebCore::DynamicNodeListCacheBase::DynamicNodeListCacheBase): Initializes member variables directly + instead of calling clearCache now that DynamicNodeListCacheBase::invalidateCache has become polymorphic. + (DynamicNodeListCacheBase): Increased the number of bits for m_invalidationType since we now have 9 + invalidation types. + (WebCore::DynamicSubtreeNodeList::~DynamicSubtreeNodeList): + (WebCore::DynamicSubtreeNodeList::DynamicSubtreeNodeList): + * dom/ElementRareData.h: + (ElementRareData): + (WebCore::ElementRareData::clearHTMLCollectionCaches): Added. + (WebCore::ElementRareData::adoptTreeScope): Added; similar to NodeRareData::adoptTreeScope. + * dom/Node.cpp: + (WebCore::Node::invalidateNodeListsCacheAfterAttributeChanged): Clears HTML collection caches as well as + node list caches. + (WebCore::Node::invalidateNodeListsCacheAfterChildrenChanged): Ditto. + * dom/NodeRareData.h: + (WebCore::NodeListsNodeData::adoptTreeScope): + * dom/TreeScopeAdopter.cpp: + (WebCore::TreeScopeAdopter::moveTreeToNewScope): Calls ElementRareData's adoptTreeScope as well as + NodeRareData's. + * html/HTMLAllCollection.cpp: + (WebCore::HTMLAllCollection::namedItemWithIndex): + * html/HTMLCollection.cpp: + (WebCore::rootTypeFromCollectionType): Added. As mentioned above, treat all Document-owned HTML collection + as if rooted at document for convenience. + (WebCore::invalidationTypeExcludingIdAndNameAttributes): Added. Since all HTML collection requires + invalidation on id and name content attribute changes, which is taken care by the special logic in + Document::registerNodeListCache, exclude those two attributes from consideration. + (WebCore::HTMLCollection::HTMLCollection): Calls Document::registerNodeListCache. + (WebCore::HTMLCollection::~HTMLCollection): Calls Document::unregisterNodeListCache. + (WebCore::HTMLCollection::length): + (WebCore::HTMLCollection::item): + (WebCore::HTMLCollection::namedItem): + (WebCore::HTMLCollection::updateNameCache): + * html/HTMLCollection.h: + (WebCore::HTMLCollectionCacheBase::HTMLCollectionCacheBase): + (HTMLCollectionCacheBase): Removed m_cacheTreeVersion and clearCache since they're no longer used. + (HTMLCollection): + * html/HTMLFormCollection.cpp: + (WebCore::HTMLFormCollection::namedItem): + (WebCore::HTMLFormCollection::updateNameCache): + * html/HTMLOptionsCollection.h: + (HTMLOptionsCollection): + * html/HTMLPropertiesCollection.cpp: + (WebCore::HTMLPropertiesCollection::updateNameCache): + * html/HTMLPropertiesCollection.h: + (WebCore::HTMLPropertiesCollection::invalidateCache): + +2012-07-13 Shawn Singh <shawnsingh@chromium.org> + + [chromium] Remove incorrect debug assertion in LayerRendererChromium.cpp + https://bugs.webkit.org/show_bug.cgi?id=91260 + + Reviewed by Adrienne Walker. + + ASSERT(!clipped) was being triggered after skinny almost-degenerate + quads went through anti-aliasing inflation, and then were being + transformed back from device space to local space. It turns out + this assertion is too aggressive, and we don't yet have an obvious + need to change the behavior on the clipped==true case. + + No new tests needed, this patch fixes only comments and debug code. + + * platform/graphics/chromium/LayerRendererChromium.cpp: + (WebCore::LayerRendererChromium::drawRenderPassQuad): + fixed a comment. + + (WebCore::LayerRendererChromium::drawTileQuad): + fixed a similar comment, removed unnecessary assertion. + +2012-07-13 Philip Rogers <pdr@google.com> + + Remove assert in localCoordinateSpaceTransform() + https://bugs.webkit.org/show_bug.cgi?id=91189 + + Reviewed by Nikolas Zimmermann. + + The assert in localCoordinateSpaceTransform was added to catch subclasses forgetting + to override the method but it is better to simply return the identity matrix. + + This scenario can occur when we break the SVG content model, such as asking for + the CTM of a <g> element inside a <tspan>. This is undefined in the spec because + tspan is not a subclass of SVGLocatable but both Firefox and Opera + implement this by returning the identity matrix. + + Test: svg/custom/invalid-ctm.svg + + * svg/SVGStyledElement.cpp: + (WebCore::SVGStyledElement::localCoordinateSpaceTransform): + +2012-07-13 Kentaro Hara <haraken@chromium.org> + + [V8] String wrappers should be marked Independent + https://bugs.webkit.org/show_bug.cgi?id=91251 + + Reviewed by Adam Barth. + + Currently V8 String wrappers are not marked Independent. + By marking them Independent, they can be reclaimed by the scavenger GC. + + I tried to find some cases where this change reduces memory usage, + but couldn't due to sensitive behavior of GC. + + No tests. No change in behavior. + + * bindings/v8/V8Binding.cpp: + (WebCore::StringCache::v8ExternalStringSlow): + +2012-07-13 Peter Beverloo <peter@chromium.org> + + [Chromium] Make the v8 i18n API dependency conditional for Android, disable strict aliasing + https://bugs.webkit.org/show_bug.cgi?id=91240 + + Reviewed by Adam Barth. + + Disable the v8 internationalization API for Chromium Android, as it's + disabled and not always available in checkouts. Furthermore, disable + strict aliasing for the webkit_remaining target, similar to what + x11-based builds are doing (see the webcore_prerequisites target). + + * WebCore.gyp/WebCore.gyp: + +2012-07-13 Kentaro Hara <haraken@chromium.org> + + [CallWith=XXX] arguments should be placed at the head of method arguments + https://bugs.webkit.org/show_bug.cgi?id=91217 + + Reviewed by Adam Barth. + + The EFL build with the ENABLE_FILE_SYSTEM flag caused a build error, + because CodeGeneratorJS.pm assumes webkitEntries(ScriptExecutionContext*, HTMLInputElement*) + but the actual signature is webkitEntries(HTMLInputElement*, ScriptExecutionContext*) (bug 91185). + + Per https://trac.webkit.org/wiki/WebKitIDL#CallWith, [CallWith=XXX] arguments should be placed + at the head of the arguments. (i.e. the behavior of CodeGeneratorJS.pm is correct.) + + Thus the correct fix is (1) to change the signature of webkitEntries() and webkitGetAsEntry() + so that ScriptExecutionContext* comes first and (2) to modify CodeGeneratorV8.pm to support the order. + + Test: bindings/scripts/test/TestObj.idl + + * Modules/filesystem/DataTransferItemFileSystem.h: Placed ScriptExecutionContext* at the head of arguments. + (DataTransferItemFileSystem): + * Modules/filesystem/HTMLInputElementFileSystem.cpp: Ditto. + (WebCore::HTMLInputElementFileSystem::webkitEntries): + * Modules/filesystem/HTMLInputElementFileSystem.h: Ditto. + (HTMLInputElementFileSystem): + * Modules/filesystem/chromium/DataTransferItemFileSystemChromium.cpp: Ditto. + (WebCore::DataTransferItemFileSystem::webkitGetAsEntry): + + * bindings/scripts/CodeGeneratorV8.pm: Modified to support the correct order. + (GenerateNormalAttrGetter): + (GenerateNormalAttrSetter): + (GenerateFunctionCallString): + + * bindings/scripts/test/V8/V8TestInterface.cpp: Updated run-bindings-tests results. + (WebCore::TestInterfaceV8Internal::supplementalMethod2Callback): + +2012-07-13 Mary Wu <mary.wu@torchmobile.com.cn> + + [BlackBerry] Some small changes in network code + https://bugs.webkit.org/show_bug.cgi?id=90974 + + Reviewed by Rob Buis. + + 1. Set status in NetworkJob/SocketStreamHandleBlackBerry so that + its wrapped stream can also query the stream result. + 2. pass download attribute to NetworkRequest. + + RIM PR# 171555 + Reviewed internally by Lyon Chen and Joe Mason. + + * platform/network/blackberry/NetworkJob.cpp: + (WebCore::NetworkJob::handleNotifyClose): + * platform/network/blackberry/NetworkJob.h: + (WebCore::NetworkJob::status): + * platform/network/blackberry/ResourceRequestBlackBerry.cpp: + (WebCore::platformTargetTypeForRequest): + * platform/network/blackberry/SocketStreamHandle.h: + (WebCore::SocketStreamHandle::status): + (SocketStreamHandle): + * platform/network/blackberry/SocketStreamHandleBlackBerry.cpp: + (WebCore::SocketStreamHandle::notifyStatusReceived): + (WebCore::SocketStreamHandle::notifyClose): + +2012-07-13 Vsevolod Vlasov <vsevik@chromium.org> + + Web Inspector: Remove uiSourceCode from Resource. + https://bugs.webkit.org/show_bug.cgi?id=91201 + + Reviewed by Pavel Feldman. + + Removed Resource._uiSourceCode field as it is not used anymore. + + * inspector/front-end/Resource.js: + (WebInspector.Resource.prototype.isHidden): + * inspector/front-end/UISourceCode.js: + (WebInspector.UISourceCode): + +2012-07-13 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r122450 and r122580. + http://trac.webkit.org/changeset/122450 + http://trac.webkit.org/changeset/122580 + https://bugs.webkit.org/show_bug.cgi?id=91263 + + Caused multiple regressions on ClusterFuzz (Requested by + inferno-sec on #webkit). + + * bindings/js/ScriptWrappable.h: + (WebCore::ScriptWrappable::reportMemoryUsage): + * bindings/v8/DOMDataStore.cpp: + (WebCore::DOMDataStore::reportMemoryUsage): + * bindings/v8/IntrusiveDOMWrapperMap.h: + (WebCore::ChunkedTable::reportMemoryUsage): + * bindings/v8/ScriptWrappable.h: + (WebCore::ScriptWrappable::reportMemoryUsage): + * bindings/v8/V8Binding.cpp: + (WebCore::V8BindingPerIsolateData::reportMemoryUsage): + (WebCore::StringCache::reportMemoryUsage): + * bindings/v8/V8DOMMap.h: + * css/PropertySetCSSStyleDeclaration.cpp: + (WebCore::InlineCSSStyleDeclaration::ensureMutablePropertySet): + * css/StylePropertySet.cpp: + * css/StylePropertySet.h: + (WebCore::StylePropertySet::reportMemoryUsage): + * dom/CharacterData.cpp: + (WebCore::CharacterData::reportMemoryUsage): + * dom/ContainerNode.h: + (WebCore::ContainerNode::reportMemoryUsage): + * dom/Document.cpp: + (WebCore::Document::reportMemoryUsage): + * dom/Element.cpp: + (WebCore::Element::detachAttribute): + (WebCore::Element::removeAttribute): + (WebCore::Element::attributes): + (WebCore::Element::setAttributeInternal): + (WebCore::Element::parserSetAttributes): + (WebCore::Element::hasEquivalentAttributes): + (WebCore::Element::createAttributeData): + (WebCore): + (WebCore::Element::setAttributeNode): + (WebCore::Element::removeAttributeNode): + (WebCore::Element::getAttributeNode): + (WebCore::Element::getAttributeNodeNS): + (WebCore::Element::hasAttribute): + (WebCore::Element::hasAttributeNS): + (WebCore::Element::normalizeAttributes): + (WebCore::Element::cloneAttributesFromElement): + * dom/Element.h: + (WebCore::Element::attributeData): + (Element): + (WebCore::Element::reportMemoryUsage): + (WebCore::Element::ensureAttributeData): + (WebCore::Element::updatedAttributeData): + (WebCore::Element::ensureUpdatedAttributeData): + * dom/ElementAttributeData.cpp: + (WebCore::ElementAttributeData::attrIfExists): + (WebCore::ElementAttributeData::ensureAttr): + (WebCore::ElementAttributeData::setAttr): + (WebCore::ElementAttributeData::removeAttr): + (WebCore::ElementAttributeData::setClass): + (WebCore): + (WebCore::ElementAttributeData::ensureInlineStyle): + (WebCore::ElementAttributeData::ensureMutableInlineStyle): + (WebCore::ElementAttributeData::destroyInlineStyle): + (WebCore::ElementAttributeData::addAttribute): + (WebCore::ElementAttributeData::removeAttribute): + (WebCore::ElementAttributeData::isEquivalent): + (WebCore::ElementAttributeData::detachAttrObjectsFromElement): + (WebCore::ElementAttributeData::getAttributeItemIndexSlowCase): + (WebCore::ElementAttributeData::cloneDataFrom): + (WebCore::ElementAttributeData::clearAttributes): + (WebCore::ElementAttributeData::replaceAttribute): + (WebCore::ElementAttributeData::getAttributeNode): + * dom/ElementAttributeData.h: + (WebCore::ElementAttributeData::create): + (ElementAttributeData): + (WebCore::ElementAttributeData::setIdForStyleResolution): + (WebCore::ElementAttributeData::setAttributeStyle): + (WebCore::ElementAttributeData::length): + (WebCore::ElementAttributeData::isEmpty): + (WebCore::ElementAttributeData::attributeItem): + (WebCore::ElementAttributeData::getAttributeItem): + (WebCore::ElementAttributeData::reportMemoryUsage): + (WebCore::ElementAttributeData::ElementAttributeData): + (WebCore::ElementAttributeData::attributeVector): + (WebCore::ElementAttributeData::clonedAttributeVector): + (WebCore::ElementAttributeData::removeAttribute): + (WebCore::ElementAttributeData::getAttributeItemIndex): + * dom/MemoryInstrumentation.h: + (MemoryInstrumentation): + (MemoryObjectInfo): + (WebCore::MemoryObjectInfo::reportInstrumentedPointer): + (WebCore::MemoryObjectInfo::reportPointer): + (WebCore::MemoryObjectInfo::reportInstrumentedObject): + (WebCore::MemoryObjectInfo::reportObject): + (WebCore::MemoryObjectInfo::reportObjectInfo): + (WebCore::MemoryObjectInfo::reportHashMap): + (WebCore::MemoryObjectInfo::reportHashSet): + (WebCore::MemoryObjectInfo::reportListHashSet): + (WebCore::MemoryObjectInfo::reportVector): + (WebCore::MemoryObjectInfo::reportString): + (WebCore::MemoryObjectInfo::objectType): + (WebCore::MemoryObjectInfo::objectSize): + (WebCore::MemoryObjectInfo::memoryInstrumentation): + * dom/Node.cpp: + (WebCore::Node::reportMemoryUsage): + * dom/QualifiedName.h: + (WebCore::QualifiedName::QualifiedNameImpl::reportMemoryUsage): + (WebCore::QualifiedName::reportMemoryUsage): + * dom/StyledElement.cpp: + (WebCore::StyledElement::style): + (WebCore::StyledElement::classAttributeChanged): + (WebCore::StyledElement::setInlineStyleProperty): + (WebCore::StyledElement::removeInlineStyleProperty): + (WebCore::StyledElement::addSubresourceAttributeURLs): + * dom/StyledElement.h: + (WebCore::StyledElement::ensureInlineStyle): + * html/parser/HTMLConstructionSite.cpp: + (WebCore::HTMLConstructionSite::createHTMLElementFromSavedElement): + * platform/TreeShared.h: + (WebCore::TreeShared::reportMemoryUsage): + * xml/parser/XMLDocumentParserQt.cpp: + (WebCore::XMLDocumentParser::XMLDocumentParser): + +2012-07-13 Huang Dongsung <luxtella@company100.net> + + Remove down-casting to BitmapImage in GraphicsContext::drawImage. + https://bugs.webkit.org/show_bug.cgi?id=90755 + + Reviewed by Simon Fraser. + + Add a BitmapImage draw method which takes RespectImageOrientationEnum enum as + the last argument for CG. Then we can remove the conditional down-casting in + GraphicsContext::drawImage. + + This change is needed for parallel image decoders. Because parallel image + decoders use a Bitmap image wrapper class which extends Image (not Bitmap), the + down-casting above causes the loss of RespectImageOrientationEnum which must be + passed to BitmapImage. + + No new tests, no behavior change. + + * platform/graphics/BitmapImage.cpp: + * platform/graphics/BitmapImage.h: + * platform/graphics/GraphicsContext.cpp: + (WebCore::GraphicsContext::drawImage): + * platform/graphics/Image.cpp: + (WebCore::Image::draw): + (WebCore): + * platform/graphics/Image.h: + (Image): + +2012-07-13 Lauro Neto <lauro.neto@openbossa.org> + + Fix QtWebKit build with OpenGLES after GC3D/E3D refactor + https://bugs.webkit.org/show_bug.cgi?id=91156 + + Reviewed by Noam Rosenthal. + + Adds several build fixes. + + * platform/graphics/GraphicsContext3D.h: + Use E3DOpenGLES instead of previously removed E3DQt. + + * platform/graphics/OpenGLESShims.h: + Enable defines for Qt. + + * platform/graphics/opengl/Extensions3DOpenGLES.cpp: + (WebCore::Extensions3DOpenGLES::blitFramebuffer): + (WebCore): + (WebCore::Extensions3DOpenGLES::renderbufferStorageMultisample): + (WebCore::Extensions3DOpenGLES::copyTextureCHROMIUM): + Added pure virtual stubs. + + (WebCore::Extensions3DOpenGLES::supportsExtension): + Remove PROC suffix. See bug #91130. + + * platform/graphics/opengl/Extensions3DOpenGLES.h: + (Extensions3DOpenGLES): + Added pure virtual stubs. + + * platform/graphics/opengl/GraphicsContext3DOpenGLES.cpp: + (WebCore::GraphicsContext3D::reshapeFBOs): + Readded missing function after removed in r122250. + + (WebCore): + Use PLATFORM(BLACKBERRY) guard around port-specific include. + + * platform/graphics/qt/GraphicsContext3DQt.cpp: + Added USE(OPENGL_ES_2) guard instead of always loading the OpenGL extensions. + + +2012-07-13 Keishi Hattori <keishi@webkit.org> + + Form of FormAssociatedElement is not updated when id target changes. + https://bugs.webkit.org/show_bug.cgi?id=91042 + + Reviewed by Kent Tamura. + + Test: fast/forms/update-form-attribute-element.html + + This patch introduces the IdTargetObserver and IdTargetObserverRegistry class. + They can be used to be notified when the element that an id is pointing to (the id target) + changes. + + * CMakeLists.txt: Added IdTargetObserverRegistry.{h,cpp} and IdTargetObserver.{h,cpp} + * GNUmakefile.list.am: Ditto. + * Target.pri: Ditto. + * WebCore.gypi: Ditto. + * WebCore.vcproj/WebCore.vcproj: Ditto. + * WebCore.xcodeproj/project.pbxproj: Ditto. + * dom/DOMAllInOne.cpp: + * dom/IdTargetObserver.cpp: Added. When you want notified of changes to an id target, you should create a new class that inherits this. + (WebCore): + (WebCore::IdTargetObserver::IdTargetObserver): + (WebCore::IdTargetObserver::~IdTargetObserver): + * dom/IdTargetObserver.h: Added. + (WebCore): + (IdTargetObserver): + * dom/IdTargetObserverRegistry.cpp: Added. + (WebCore): + (WebCore::IdTargetObserverRegistry::create): + (WebCore::IdTargetObserverRegistry::addObserver): Register an IdTargetObserver to observe an id target. + (WebCore::IdTargetObserverRegistry::removeObserver): Unregisters an IdTargetObserver from observing. + (WebCore::IdTargetObserverRegistry::notifyObserversInternal): + * dom/IdTargetObserverRegistry.h: Added. + (WebCore): + (IdTargetObserverRegistry): + (WebCore::IdTargetObserverRegistry::IdTargetObserverRegistry): + (WebCore::IdTargetObserverRegistry::notifyObservers): Calls idTargetChanged on all observers for an id. Inlining first part of function for performance. + * dom/TreeScope.cpp: + (WebCore::TreeScope::TreeScope): + (WebCore::TreeScope::addElementById): Calls IdTargetObserverRegistry::notifyObservers because the id target might have changed. + (WebCore::TreeScope::removeElementById): Ditto. + * dom/TreeScope.h: + (WebCore): + (WebCore::TreeScope::idTargetObserverRegistry): + (TreeScope): + * html/FormAssociatedElement.cpp: Observer for id targets defined by the form attribute. + (WebCore::FormAssociatedElement::didMoveToNewDocument): + (WebCore::FormAssociatedElement::insertedInto): + (WebCore::FormAssociatedElement::removedFrom): + (WebCore::FormAssociatedElement::formAttributeChanged): + (WebCore::FormAssociatedElement::resetFormAttributeTargetObserver): Creates and sets up a new FormAttributeTargetObserver. + (WebCore): + (WebCore::FormAssociatedElement::formAttributeTargetChanged): + (WebCore::FormAttributeTargetObserver::create): + (WebCore::FormAttributeTargetObserver::FormAttributeTargetObserver): + (WebCore::FormAttributeTargetObserver::idTargetChanged): + * html/FormAssociatedElement.h: + (FormAssociatedElement): + * html/FormController.cpp: + * html/FormController.h: + (FormController): + * html/HTMLFormElement.cpp: + (WebCore::HTMLFormElement::removedFrom): + (WebCore::HTMLFormElement::formElementIndexWithFormAttribute): Modified to take a range. It + scans the range and returns the index to insert the element in m_associatedElement. + (WebCore::HTMLFormElement::formElementIndex): Modified to only scan the elements in + m_associatedElement that precede and follow the form element. + * html/HTMLFormElement.h: + (HTMLFormElement): + +2012-07-13 Gabor Rapcsanyi <rgabor@webkit.org> + + Optimizing blend filter to ARM-NEON with intrinsics + https://bugs.webkit.org/show_bug.cgi?id=90949 + + Reviewed by Zoltan Herczeg. + + The feBlend SVG filter modes can be greatly fasten up with ARM-NEON since + we are able to calculate with 2 pixels (8 channels) at the same time. + The code is written with NEON intrinsics and it doesn't affect the + general - it has the same behaviour as the original algorithm. + With this NEON optimization the calculation is ~4.5 times faster for each mode. + + Existing tests cover this issue. + + * CMakeLists.txt: + * GNUmakefile.list.am: + * Target.pri: + * WebCore.gypi: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * platform/graphics/filters/FEBlend.cpp: + (WebCore::FEBlend::platformApplyGeneric): + (WebCore): + (WebCore::FEBlend::platformApplySoftware): + * platform/graphics/filters/FEBlend.h: + (FEBlend): + * platform/graphics/filters/arm/FEBlendNEON.h: Added. + (WebCore): + (FEBlendUtilitiesNEON): + (WebCore::FEBlendUtilitiesNEON::div255): integer divison with 255 + (WebCore::FEBlendUtilitiesNEON::normal): calculate normal mode blending for two pixels + (WebCore::FEBlendUtilitiesNEON::multiply): calculate multiply mode blending for two pixels + (WebCore::FEBlendUtilitiesNEON::screen): calculate screen mode blending for two pixels + (WebCore::FEBlendUtilitiesNEON::darken): calculate darken mode blending for two pixels + (WebCore::FEBlendUtilitiesNEON::lighten): calculate lighten mode blending for two pixels + (WebCore::FEBlend::platformApplyNEON): + +2012-07-13 Ilya Tikhonovsky <loislo@chromium.org> + + Web Inspector: native memory instrumentation: extract instrumentation methods into MemoryClassInfo + https://bugs.webkit.org/show_bug.cgi?id=91227 + + Reviewed by Pavel Feldman. + + void Node::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const + { + MemoryClassInfo<Node> info(memoryObjectInfo, this, MemoryInstrumentation::DOM); + info.visitBaseClass<ScriptWrappable>(this); + + info.addMember(m_notInstrumentedPointer); // automatically detects poniter/reference + info.addInstrumentedMember(m_next); + info.addHashSet<MemoryInstrumentation::NonClass>(m_aHash); // NonClass value_type (report only size of internal template structures) + info.addHashSet<MemoryInstrumentation::NotInstrumentedClass>(m_aHashSet); // not instrumented value_type (use sizeof) + info.addHashSet<MemoryInstrumentation::InstrumentedClass>(m_aHashSet); // instrumented value_type (call visit) + } + + The change is covered by existing tests for native memory snapshot. + + * bindings/v8/DOMDataStore.cpp: + (WebCore::DOMDataStore::reportMemoryUsage): + * bindings/v8/IntrusiveDOMWrapperMap.h: + (WebCore::ChunkedTable::reportMemoryUsage): + * bindings/v8/ScriptWrappable.h: + (WebCore::ScriptWrappable::reportMemoryUsage): + * bindings/v8/V8Binding.cpp: + (WebCore::V8BindingPerIsolateData::reportMemoryUsage): + (WebCore::StringCache::reportMemoryUsage): + * bindings/v8/V8DOMMap.h: + * css/StylePropertySet.h: + (WebCore::StylePropertySet::reportMemoryUsage): + * dom/CharacterData.cpp: + (WebCore::CharacterData::reportMemoryUsage): + * dom/ContainerNode.h: + (WebCore::ContainerNode::reportMemoryUsage): + * dom/Document.cpp: + (WebCore::Document::reportMemoryUsage): + * dom/Element.h: + (WebCore::Element::reportMemoryUsage): + * dom/ElementAttributeData.h: + (WebCore::ElementAttributeData::reportMemoryUsage): + * dom/MemoryInstrumentation.h: + (MemoryInstrumentation): + (WebCore::MemoryObjectInfo::objectType): + (WebCore::MemoryObjectInfo::objectSize): + (WebCore::MemoryObjectInfo::memoryInstrumentation): + (MemoryObjectInfo): + (WebCore::MemoryObjectInfo::reportObjectInfo): + (WebCore): + (MemoryClassInfo): + (WebCore::MemoryClassInfo::MemoryClassInfo): + (WebCore::MemoryClassInfo::visitBaseClass): + (WebCore::MemoryClassInfo::reportInstrumentedPointer): + (WebCore::MemoryClassInfo::reportInstrumentedObject): + (WebCore::MemoryClassInfo::reportPointer): + (WebCore::MemoryClassInfo::reportObject): + (WebCore::MemoryClassInfo::reportHashMap): + (WebCore::MemoryClassInfo::reportHashSet): + (WebCore::MemoryClassInfo::reportListHashSet): + (WebCore::MemoryClassInfo::reportVector): + (WebCore::MemoryClassInfo::reportString): + * dom/Node.cpp: + (WebCore::Node::reportMemoryUsage): + * dom/QualifiedName.h: + (WebCore::QualifiedName::QualifiedNameImpl::reportMemoryUsage): + (WebCore::QualifiedName::reportMemoryUsage): + * platform/TreeShared.h: + (WebCore::TreeShared::reportMemoryUsage): + +2012-07-13 Pavel Feldman <pfeldman@chromium.org> + + Web Inspector: align scope filters + https://bugs.webkit.org/show_bug.cgi?id=91213 + + Reviewed by Vsevolod Vlasov. + + * inspector/front-end/elementsPanel.css: + (.crumbs): + * inspector/front-end/inspector.css: + (.status-bar > div): + (.scope-bar): + (.scope-bar li): + (.scope-bar li.all): + * inspector/front-end/networkLogView.css: + +2012-07-13 Peter Rybin <peter.rybin@gmail.com> + + Web Inspector: too many hardcoded strings in InspectorBackendDispatcher. + https://bugs.webkit.org/show_bug.cgi?id=89198 + + Reviewed by Yury Semikhatsky. + + Instead of generating error message string on every call (mostly for nothing), + error message is generated deeper inside the handler and only command name + is passed every time. + + * inspector/CodeGeneratorInspector.py: + (Generator.process_command): + +2012-07-13 Joshua Netterfield <jnetterfield@rim.com> + + [BlackBerry] Update about:* pages + https://bugs.webkit.org/show_bug.cgi?id=91121 + + Reviewed by Yong Li. + + Update the about:config pages, and improve the aesthetics of the about:build, about:version, about:credits, about:memory, about:config, and similar pages. + + No new tests, because there is no new funtionality. + + * platform/network/blackberry/NetworkJob.cpp: Update the aesthetics of about:* pages + +2012-07-13 Olivier Blin <olivier.blin@softathome.com> + + Fix checking for optional DeviceOrientationEvent.absolute in JSC bindings + https://bugs.webkit.org/show_bug.cgi?id=91225 + + Reviewed by Steve Block. + + This issue comes from r105036 + + * bindings/js/JSDeviceOrientationEventCustom.cpp: + (WebCore::JSDeviceOrientationEvent::initDeviceOrientationEvent): + +2012-07-13 Andrei Bucur <abucur@adobe.com> + [CSS Regions] Fix build for bug 89000 + https://bugs.webkit.org/show_bug.cgi?id=91215 + + Reviewed by Kentaro Hara. + + Remove the unused variable m_state that was a leftover from a previous version of the patch. + + Tests: No new tests, build fix. + + * dom/WebKitNamedFlow.cpp: + (WebCore::WebKitNamedFlow::WebKitNamedFlow): + * dom/WebKitNamedFlow.h: + (WebKitNamedFlow): + +2012-07-13 Kenichi Ishibashi <bashi@chromium.org> + + [Chromium] Fix bugs in HarfBuzzShaper + https://bugs.webkit.org/show_bug.cgi?id=90951 + + Reviewed by Tony Chang. + + The current implementation has following problems: + - Cannot render RTL text if the TextRun is divided into more than two + HarfBuzzRun. + - Script handling in TextRun partitioning is incorrect. + - Inaccurate calculation of selection rect. + - Wrong rendering position when the first glyph of the TextRun have + non-zero offsets in terms of HarfBuzz. + + To fix these problems I rewrote HarfBuzzShaper class. Here is the summary: + - Divide the whole range of TextRun first, then shape them in visual + order. + - Divide TextRun in the same way of old-harfbuzz's + hb_utf16_script_run_next(). + - Prefer float than int when calculating selection. + - Adjust the drawing point after shaping. + + Added tests covers the fix except for the last problem. The last problem will be covered + by fast/text/international/complex-joining-using-gpos.html after chromium linux port switches + to use HarfBuzzShaper. + + Tests: fast/text/shaping/shaping-script-order.html + fast/text/shaping/shaping-selection-rect.html + + * platform/graphics/harfbuzz/FontHarfBuzz.cpp: + (WebCore::Font::drawComplexText): Adjusts point after shaping. + * platform/graphics/harfbuzz/ng/HarfBuzzShaper.cpp: + (WebCore::HarfBuzzShaper::HarfBuzzRun::HarfBuzzRun): + (WebCore): + (WebCore::HarfBuzzShaper::HarfBuzzRun::applyShapeResult): Added. + (WebCore::HarfBuzzShaper::HarfBuzzRun::setGlyphAndAdvance): Offsets are no longer needed. + (WebCore::HarfBuzzShaper::HarfBuzzRun::xPositionForOffset): Calculates character offset based on advance. + (WebCore::normalizeCharacters): Added. + (WebCore::HarfBuzzShaper::HarfBuzzShaper): + (WebCore::HarfBuzzShaper::~HarfBuzzShaper): + (WebCore::HarfBuzzShaper::shape): Divides TextRun first, then shapes them. + (WebCore::HarfBuzzShaper::adjustStartPoint): Added. + (WebCore::HarfBuzzShaper::collectHarfBuzzRuns): Added. + (WebCore::HarfBuzzShaper::shapeHarfBuzzRuns): Added. + (WebCore::HarfBuzzShaper::setGlyphPositionsForHarfBuzzRun): Followed other changes. + (WebCore::HarfBuzzShaper::selectionRect): Use float for calculating selection. + * platform/graphics/harfbuzz/ng/HarfBuzzShaper.h: + (HarfBuzzShaper): Holds the start index of character. Removed unnecessary variables. + (WebCore::HarfBuzzShaper::HarfBuzzRun::create): Ditto. + (HarfBuzzRun): + (WebCore::HarfBuzzShaper::HarfBuzzRun::fontData): Added. + (WebCore::HarfBuzzShaper::HarfBuzzRun::startIndex): Ditto. + (WebCore::HarfBuzzShaper::HarfBuzzRun::glyphs): Ditto. + (WebCore::HarfBuzzShaper::HarfBuzzRun::advances): Ditto. + +2012-07-13 Kentaro Hara <haraken@chromium.org> + + Unreviewed, rolling out r122545. + http://trac.webkit.org/changeset/122545 + https://bugs.webkit.org/show_bug.cgi?id=91185 + + We found that this was a wrong fix + + * bindings/scripts/CodeGeneratorJS.pm: + (GenerateImplementation): + +2012-07-13 Kentaro Hara <haraken@chromium.org> + + Unreviewed, rolling out r122553. + http://trac.webkit.org/changeset/122553 + https://bugs.webkit.org/show_bug.cgi?id=91198 + + We found that this was a wrong fix + + * bindings/scripts/CodeGeneratorJS.pm: + (GenerateImplementation): + +2012-07-13 Kent Tamura <tkent@chromium.org> + + Change the timing of form state restore + https://bugs.webkit.org/show_bug.cgi?id=89962 + + Reviewed by Hajime Morita. + + For a preparation to fix a form identification problem (Bug 91209), + restore controls states when the parsing of their owner forms is + completed. For controls without owners, their states are restored when + their parsing is completed as ever. + + No new tests. This doesn't change observable behavior. + + * html/FormController.cpp: + (WebCore::ownerFormForState): + Added. This code was used in formKey(), and restoreControlState*() use it. + (WebCore::FormKeyGenerator::formKey): Use ownerFormForState(). No behavior change. + (WebCore::FormController::restoreControlStateFor): + Moved some code from HTMLFormControlElementWithState::finishParsingChildren(). + The difference is we don't resotre state if this control is owned by a form. + (WebCore::FormController::restoreControlStateIn): + Restore states of associated controls. This is called from + finishParsingChildren() for <form>. + * html/FormController.h: + (FormController): + - Declare restoreControlStateFor() and restoreControlStateIn(). + - Make takeStateForFormElement() private. + + * html/FormAssociatedElement.cpp: + (WebCore::FormAssociatedElement::isFormControlElementWithState): + Added. The default implementation returns false. + * html/FormAssociatedElement.h: + (FormAssociatedElement): + Added isFormControlElementWithState() for FormController::restoreControlStateIn(). + * html/HTMLFormControlElementWithState.cpp: + (WebCore::HTMLFormControlElementWithState::finishParsingChildren): + Some code was moved to FormController:restoreControlStateFor(). + (WebCore::HTMLFormControlElementWithState::isFormControlElementWithState): + Added. Returns true. + * html/HTMLFormControlElementWithState.h: + (HTMLFormControlElementWithState): Declare isFormControlElementWithState(). + * html/HTMLFormElement.cpp: + (WebCore::HTMLFormElement::finishParsingChildren): + Added. Calls FormController::restoreControlStateIn(). + * html/HTMLFormElement.h: + (HTMLFormElement): Declare finishParsingChildren(). + +2012-07-13 Kent Tamura <tkent@chromium.org> + + Make calendar pickers testable + https://bugs.webkit.org/show_bug.cgi?id=84827 + + Reviewed by Hajime Morita. + + WebCore: + - Add PagePopupDriver, an interface to open/close a PagePopup. + - Add setPagePopupDriver() to ChromeClient in order to inject a + PagePopupDriver for testing. + + Internals: + Add MockPagePopupDriver, which creates a MockPagePopup, which creates a + normal <iframe> in the top-level document, and load the popup content on + it. MockPagePopupDriver is enabled by + internals.settings.setEnableMockPagePopup(true). + + Test: fast/forms/date/calendar-picker-appearance.html + + * WebCore.gypi: Add new files. + * WebCore.xcodeproj/project.pbxproj: Add files to make this buildable. + * page/ChromeClient.h: + (ChromeClient): Add function for PagePopupDriver. + * loader/EmptyClients.h: Add empty implementations for PagePopupDriver functions. + * page/PagePopupDriver.h: Added. + (PagePopupDriver): + (WebCore::PagePopupDriver::~PagePopupDriver): + + * testing/InternalSettings.cpp: + (WebCore::InternalSettings::Backup::restoreTo): Reset the mock PagePopupDriver. + (WebCore::InternalSettings::setEnableMockPagePopup): + Register MockPagePopupDriver to ChromeClient. + * testing/InternalSettings.h: + (InternalSettings): Declare setEnableMockPagePopup(). + * testing/InternalSettings.idl: ditto. + * testing/MockPagePopupDriver.cpp: Added. + (MockPagePopup): Pseudo PagePopup implementation with the standard <iframe>. + (WebCore::MockPagePopupDriver::MockPagePopupDriver): Added. + (WebCore::MockPagePopupDriver::create): Added. + (WebCore::MockPagePopupDriver::~MockPagePopupDriver): Added. + (WebCore::MockPagePopupDriver::openPagePopup): + Added. An override of PagePopupDriver function. This creates a MockPagePopup. + (WebCore::MockPagePopupDriver::closePagePopup): + Added. An override of PagePopupDriver function. This deletes the MockPagePopup. + * testing/MockPagePopupDriver.h: + (MockPagePopupDriver): Added. + + * testing/v8/WebCoreTestSupport.cpp: + (WebCoreTestSupport::injectPagePopupController): + Added. Production code uses per-Page context feature framework. However + MockPagePopup uses the same page as the host page. So we can't use the + framework and need to inject window.pagePopupController manually. + * testing/v8/WebCoreTestSupport.h: + (WebCoreTestSupport): Add injectPagePopupController(). + +2012-07-12 Pavel Feldman <pfeldman@chromium.org> + + Web Inspector: mute the native looks of the selects in the console. + https://bugs.webkit.org/show_bug.cgi?id=91120 + + Reviewed by Vsevolod Vlasov. + + This is necessary for Mac now that we don't use border images for select. + + * inspector/front-end/ConsoleView.js: + (WebInspector.ConsoleView.prototype.get statusBarItems): + (WebInspector.ConsoleView.prototype.addContext): + (WebInspector.ConsoleView.prototype.removeContext): + (WebInspector.ConsoleView.prototype._updateIsolatedWorldSelector): + (WebInspector.ConsoleView.prototype._appendIsolatedContextOption): + (WebInspector.ConsoleView.prototype._currentEvaluationContext): + (WebInspector.ConsoleView.prototype._currentIsolatedContextId): + * inspector/front-end/StatusBarButton.js: + (WebInspector.StatusBarComboBox): + (WebInspector.StatusBarComboBox.prototype.addOption): + (WebInspector.StatusBarComboBox.prototype.removeOption): + (WebInspector.StatusBarComboBox.prototype.removeOptions): + (WebInspector.StatusBarComboBox.prototype.selectedOption): + * inspector/front-end/inspector.css: + (.status-bar-select-container): + (select.status-bar-item): + (.console-context): + +2012-07-13 Andrei Bucur <abucur@adobe.com> + + [CSS Regions] Fix the lifecycle for the flow objects and their renderers + https://bugs.webkit.org/show_bug.cgi?id=89000 + + Reviewed by Eric Seidel. + + This patch adds the concept of a NamedFlowCollection, owned by the document, that keeps track of + all the named flows that exist in the Document. This collection contains a ListHashSet of weak references to + all the existing NamedFlows in the document. This is not a managed set because the CREATED flows are referenced from the renderer and + the NULL flows are only cached, they should be destructible. + Two named flows are considered to be equal if they have the same name. + I've changed the NamedFlow state to depend on the existence of its renderer. A flow thread that has a renderer will also have a NamedFlow object. + A flow thread without a renderer can have a NamedFlow object, but only in the NULL state. It's possible for a NamedFlow object to jump from the + NULL state to the CREATED state if it was not destroyed (e.g. it was referenced from JS). Keeping track of the NULL state flows that have listeners will be important + so when they go back to the CREATED state, the listeners would still be there. + + Link to spec: http://www.w3.org/TR/2012/WD-css3-regions-20120503/ + + Tests: The old tests have been modified to take into account the new behavior + + * CMakeLists.txt: + * GNUmakefile.list.am: + * Target.pri: + * WebCore.gypi: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * dom/DOMAllInOne.cpp: + * dom/Document.cpp: + (WebCore::Document::~Document): + (WebCore): + (WebCore::Document::webkitGetFlowByName): + (WebCore::Document::namedFlows): + * dom/Document.h: + (WebCore): + (Document): + * dom/WebKitNamedFlow.cpp: + (WebCore::WebKitNamedFlow::WebKitNamedFlow): + (WebCore::WebKitNamedFlow::~WebKitNamedFlow): + (WebCore::WebKitNamedFlow::create): + (WebCore): + (WebCore::WebKitNamedFlow::name): + (WebCore::WebKitNamedFlow::overset): + (WebCore::nodeInFlowThread): + (WebCore::WebKitNamedFlow::getRegionsByContentNode): + (WebCore::WebKitNamedFlow::getContent): + (WebCore::WebKitNamedFlow::setRenderer): + * dom/WebKitNamedFlow.h: + (WebCore): + (WebKitNamedFlow): + (WebCore::WebKitNamedFlow::getFlowState): + (WebCore::WebKitNamedFlow::switchFlowState): + * dom/WebKitNamedFlowCollection.cpp: Added. + (WebCore): + (WebCore::WebKitNamedFlowCollection::WebKitNamedFlowCollection): + (WebCore::WebKitNamedFlowCollection::length): An O(1) operation + (WebCore::WebKitNamedFlowCollection::item): An O(N) operation + (WebCore::WebKitNamedFlowCollection::flowByName): An O(1) operation + (WebCore::WebKitNamedFlowCollection::ensureNamedFlowInCreatedState): An O(1) operation + (WebCore::WebKitNamedFlowCollection::moveNamedFlowToNullState): An O(1) operation + (WebCore::WebKitNamedFlowCollection::discardNamedFlow): An O(1) operation + (WebCore::WebKitNamedFlowCollection::documentDestroyed): + (WebCore::WebKitNamedFlowCollection::NamedFlowHashFunctions::hash): + (WebCore::WebKitNamedFlowCollection::NamedFlowHashFunctions::equal): + (WebKitNamedFlowCollection::NamedFlowHashFunctions): + (WebCore::WebKitNamedFlowCollection::NamedFlowHashTranslator::hash): + (WebCore::WebKitNamedFlowCollection::NamedFlowHashTranslator::equal): + * dom/WebKitNamedFlowCollection.h: Copied from Source/WebCore/dom/WebKitNamedFlow.h. + (WebCore): + (WebKitNamedFlowCollection): + (WebCore::WebKitNamedFlowCollection::create): + (WebCore::WebKitNamedFlowCollection::document): + * rendering/FlowThreadController.cpp: + (WebCore::FlowThreadController::ensureRenderFlowThreadWithName): + (WebCore::FlowThreadController::removeFlowThread): + (WebCore): + * rendering/FlowThreadController.h: + (FlowThreadController): + * rendering/RenderNamedFlowThread.cpp: + (WebCore::RenderNamedFlowThread::RenderNamedFlowThread): + (WebCore): + (WebCore::RenderNamedFlowThread::~RenderNamedFlowThread): + (WebCore::RenderNamedFlowThread::removeRegionFromThread): + (WebCore::RenderNamedFlowThread::unregisterNamedFlowContentNode): + (WebCore::RenderNamedFlowThread::flowThreadName): + (WebCore::RenderNamedFlowThread::willBeDestroyed): + * rendering/RenderNamedFlowThread.h: + (RenderNamedFlowThread): + (WebCore::RenderNamedFlowThread::contentNodes): + (WebCore::RenderNamedFlowThread::canBeDestroyed): + +2012-07-13 Vineet Chaudhary <rgf748@motorola.com> + + [V8Bindings] Implement generalised method to validates that the passed object is a sequence type. + https://bugs.webkit.org/show_bug.cgi?id=91056 + + Reviewed by Kentaro Hara. + + Currently the V8 implementation validates that the passed object is a sequence type only + for MessagePort in V8Utilities::extractTransferables(). + There should be generalised method for other types too. + Spec URL: http://www.w3.org/TR/2012/WD-WebIDL-20120207/#es-sequence + + No new test, Just refactoring. There should be no behavioral changes. + + * bindings/v8/V8Binding.h: + (WebCore::toV8Sequence): Added implementation of toV8Sequence(). + +2012-07-13 Zeno Albisser <zeno@webkit.org> + + [Qt][WK2] Implement GraphicsSurface for Linux/GLX. + https://bugs.webkit.org/show_bug.cgi?id=90881 + + Add a GLX based GraphicsSurface implementation for Linux. + Native X windows are being used for exchanging textures + with the UIProcess. + + Reviewed by Noam Rosenthal. + + * Target.pri: + * WebCore.pri: + * platform/graphics/surfaces/GraphicsSurface.cpp: + (WebCore::GraphicsSurface::create): + Move creating GraphicsSurface instance into + platformCreate/platformImport functions to allow + platform specific creation based on the provided flags. + (WebCore::GraphicsSurface::GraphicsSurface): + (WebCore::GraphicsSurface::~GraphicsSurface): + Call platformDestroy when destroying a GraphicsSurface. + (WebCore): + * platform/graphics/surfaces/GraphicsSurface.h: + Make platformCreate/platformImport functions static + to be able to call these from the static create function. + Add Destructor prototype and add GraphicsSurfacePrivate member. + (WebCore): + (GraphicsSurface): + * platform/graphics/surfaces/mac/GraphicsSurfaceMac.cpp: + (WebCore): + (WebCore::GraphicsSurface::platformCreate): + (WebCore::GraphicsSurface::platformImport): + Insert creation of GraphicsSurface instance. + This allows having a platform specific creation mechanism + for GLX. + * platform/graphics/surfaces/qt/GraphicsSurfaceGLX.cpp: Added. + (WebCore): + (OffScreenRootWindow): + (WebCore::OffScreenRootWindow::OffScreenRootWindow): + (WebCore::OffScreenRootWindow::get): + (WebCore::OffScreenRootWindow::~OffScreenRootWindow): + Add an OffScreenRootWindow singelton that is being used + as a parent for all native offscreen windows. + (GraphicsSurfacePrivate): + This class is used to manage all the X related resources + such as opening a display or creating XPixmaps etc. + (WebCore::GraphicsSurfacePrivate::GraphicsSurfacePrivate): + Open a connection to the X server and create a + QOpenGLContext that can be used to resolve GL functions. + (WebCore::GraphicsSurfacePrivate::~GraphicsSurfacePrivate): + Properly cleanup and release all the X resources again. + (WebCore::GraphicsSurfacePrivate::createSurface): + Create a surface that is placed off screen and can be + used as a rendering target by the WebProcess. + (WebCore::GraphicsSurfacePrivate::createPixmap): + Create a GLXPixmap from the XWindow that was previously + redirected by the WebProcess. This GLXPixmap can then be + bound to a texture and being painted on screen by the + UIProcess. + (WebCore::GraphicsSurfacePrivate::makeCurrent): + (WebCore::GraphicsSurfacePrivate::swapBuffers): + (WebCore::GraphicsSurfacePrivate::display): + (WebCore::GraphicsSurfacePrivate::glxPixmap): + (WebCore::GraphicsSurfacePrivate::size): + (WebCore::GraphicsSurfacePrivate::glContext): + (WebCore::resolveGLMethods): + Initialize all the function pointers for the GL functions used. + (WebCore::GraphicsSurface::platformExport): + (WebCore::GraphicsSurface::platformGetTextureID): + Bind the GLXPixmap to a texture. + (WebCore::GraphicsSurface::platformCopyToGLTexture): + Not beeing implemented for GLX. + (WebCore::GraphicsSurface::platformCopyFromFramebuffer): + Blit origin fbo onto the GraphicsSurface's backing. + (WebCore::GraphicsSurface::platformCreate): + (WebCore::GraphicsSurface::platformImport): + (WebCore::GraphicsSurface::platformLock): + (WebCore::GraphicsSurface::platformUnlock): + (WebCore::GraphicsSurface::platformDestroy): + +2012-07-13 Dongwoo Im <dw.im@samsung.com> + + CodeGeneratorJS.pm : SetterExpression should use 'push' rather than 'unshift' + https://bugs.webkit.org/show_bug.cgi?id=91198 + + Reviewed by Kentaro Hara. + + 'SetterExpression' should use 'push' to make arguments, rather than 'unshift'. + + No new tests. Covered by existing tests. + + * bindings/scripts/CodeGeneratorJS.pm: + (GenerateImplementation): + +2012-07-13 Yoshifumi Inoue <yosin@chromium.org> + + REGRESSION(r119948): [Forms] Spin button Up/Down actions make value to zero for input type "number" when step mismatched + https://bugs.webkit.org/show_bug.cgi?id=91197 + + Reviewed by Kent Tamura. + + This patch fixes implementation of Decimal::ceiling() and floor(). + They return wrong value for small fractional numbers. + + The bug is occurred when: + - Step-able input type, e.g. number, date, datetime, and so on. + - Current value is step mismatched + - Current value is smaller than step + - Step up/down by spin button + because spin button up/down actions are implemented in InputType::setpUpFromRenderer + which calls Decimal::ceiling() and floor() for step mismatched case. + + Tests: fast/forms/number/number-stepup-stepdown-from-renderer.html: Added test cases + WebKit/chromium/tests/DecimalTest.cpp: Added test cases + + * platform/Decimal.cpp: + (WebCore::Decimal::ceiling): Changed to return 1 for positive small fractional number. + (WebCore::Decimal::floor): Changed to return -1 for negative small fractional number. + +2012-07-13 Dominic Mazzoni <dmazzoni@google.com> + + Should be possible to focus elements within canvas fallback content + https://bugs.webkit.org/show_bug.cgi?id=87898 + + Reviewed by Chris Fleizach. + + Patches isFocusable in dom/Node.cpp and html/HTMLFormControlElement.cpp + to make elements focusable if they're a descendent of a canvas element + if they would otherwise have been focusable but just didn't have + a renderer. Adds a bit to ElementRareData to efficiently keep track + of elements in a canvas subtree. + + Test: fast/canvas/fallback-content.html + + * dom/Element.cpp: + (WebCore::Element::attach): + (WebCore::Element::detach): + (WebCore::Element::setIsInCanvasSubtree): + (WebCore): + (WebCore::Element::isInCanvasSubtree): + * dom/Element.h: + (Element): + * dom/ElementRareData.h: + (ElementRareData): + (WebCore::ElementRareData::ElementRareData): + * dom/Node.cpp: + (WebCore::Node::isFocusable): + * html/HTMLCanvasElement.cpp: + (WebCore::HTMLCanvasElement::attach): + (WebCore): + * html/HTMLCanvasElement.h: + (HTMLCanvasElement): + * html/HTMLFormControlElement.cpp: + (WebCore::HTMLFormControlElement::isFocusable): + +2012-07-12 Carlos Garcia Campos <cgarcia@igalia.com> + + [GTK] Add API to get HTTPS status to WebKit2 GTK+ + https://bugs.webkit.org/show_bug.cgi?id=91100 + + Reviewed by Martin Robinson. + + * platform/network/soup/ResourceResponse.h: + (WebCore::ResourceResponse::soupMessageCertificate): Return the + certificate. + (WebCore::ResourceResponse::setSoupMessageCertificate): Set a + certificate. + (WebCore::ResourceResponse::soupMessageTLSErrors): Return the TLS + errors. + (WebCore::ResourceResponse::setSoupMessageTLSErrors): Set TLS + errors. + * platform/network/soup/ResourceResponseSoup.cpp: + (WebCore::ResourceResponse::toSoupMessage): Set the certificate + and TLS errors to the newly created SoupMessage. + (WebCore::ResourceResponse::updateFromSoupMessage): Get the + certificate and TLS errors from the SoupMessage. + +2012-07-13 Ryosuke Niwa <rniwa@webkit.org> + + RadioNodeList is not updated upon input type change + https://bugs.webkit.org/show_bug.cgi?id=91178 + + Reviewed by Alexey Proskuryakov. + + Invalidate the radio node lists when type content attribute changes since it excludes + image type input elements. + + Test: fast/forms/radionodelist-image-type.html + + * dom/Document.cpp: + (WebCore::shouldInvalidateNodeListForType): + * dom/Document.h: Renamed InvalidateOnIdNameForAttrChange to InvalidateOnFormAttrChange + since listing all attribute name isn't useful at this point. + * html/RadioNodeList.cpp: + (WebCore::RadioNodeList::RadioNodeList): + +2012-07-12 Dongwoo Im <dw.im@samsung.com> + + CodeGeneratorJS.pm need to handle the attribute which has "CallWith=ScriptExecutionContext" option. + https://bugs.webkit.org/show_bug.cgi?id=91185 + + Reviewed by Kentaro Hara. + + When an attribute has "CallWith=ScriptExecutionContext" option, 'ScriptExecutionContext*' parameter should be the last parameter. + + No new tests. Covered by existing tests. + + * bindings/scripts/CodeGeneratorJS.pm: + (GenerateImplementation): + +2012-07-12 Yoshifumi Inoue <yosin@chromium.org> + + REGRESSION(r117738): [Forms] stepMismatch for input type "time" with large step value always return false. + https://bugs.webkit.org/show_bug.cgi?id=91062 + + Reviewed by Kent Tamura. + + This patch changes value of StepRange::acceptableError to zero for + integer restricted step value. + + No new tests, existing test covers (fast/forms/time/ValidityState-stepMismatch-time.html) this change although they are listed in TestExpectation file. + + * html/StepRange.cpp: + (WebCore::StepRange::acceptableError): Changed to return 0 if step value is restricted to be an integer. + +2012-07-12 Dan Bernstein <mitz@apple.com> + + Pass an option flag to CFStringGetHyphenationLocationBeforeIndex() that tells it to not + terminate the search at the last word boundary before the given index. + + Reviewed by Adele Peterson. + + No test, because the current version of Core Foundation ignores the options parameter. + + * platform/text/cf/HyphenationCF.cpp: + (WebCore::lastHyphenLocation): Changed the options parameter from 0 to 1. + +2012-07-12 Eric Seidel <eric@webkit.org> + + Incorrect behaviour calling Range setStart or setEnd with boundary in different document + https://bugs.webkit.org/show_bug.cgi?id=42517 + + Reviewed by Ojan Vafai. + + Added a new static inline "checkForDifferentRootContainer" to share some code + and made setStart/setEnd do the right thing in the x-document case. I removed + the bogus checks in set*After/set*Before functions, and since they just call + through to setStart/setEnd, they also now do the right thing. + + Test: fast/dom/Range/set-wrong-document-err.html + + * dom/Range.cpp: + (WebCore::checkForDifferentRootContainer): + (WebCore): + (WebCore::Range::setStart): + (WebCore::Range::setEnd): + (WebCore::Range::setStartAfter): + (WebCore::Range::setEndBefore): + (WebCore::Range::setEndAfter): + (WebCore::Range::setStartBefore): + +2012-07-12 Erik Arvidsson <arv@chromium.org> + + [V8] Simplify CodeGeneratorV8 since V8OnProto is only true for DOMWindow + https://bugs.webkit.org/show_bug.cgi?id=91165 + + Reviewed by Nate Chapin. + + The old code was dead code since V8OnProto only ever gets set to 1 for DOMWindow. + + No new tests. No change in functionality. + + * bindings/scripts/CodeGeneratorV8.pm: + (GenerateNormalAttrSetter): + +2012-07-12 Ryosuke Niwa <rniwa@webkit.org> + + Build fix. Initialize unused const member variables to make compilers happy. + + * dom/DynamicNodeList.h: + (WebCore::DynamicNodeListCacheBase::DynamicNodeListCacheBase): + +2012-07-12 Konrad Piascik <kpiascik@rim.com> + + Web Inspector: Geolocation override + https://bugs.webkit.org/show_bug.cgi?id=89365 + + Reviewed by Pavel Feldman. + + Reverted original patch. + Change has not been reviewed by the right people. It declares + public protocol methods and is wrong in several ways. + + * Modules/geolocation/GeolocationController.cpp: + (WebCore::GeolocationController::GeolocationController): + (WebCore::GeolocationController::positionChanged): + * Modules/geolocation/GeolocationController.h: + (GeolocationController): + * inspector/Inspector.json: + * inspector/InspectorInstrumentation.cpp: + (WebCore): + * inspector/InspectorInstrumentation.h: + (WebCore): + (InspectorInstrumentation): + * inspector/InspectorPageAgent.cpp: + (WebCore::InspectorPageAgent::InspectorPageAgent): + * inspector/InspectorPageAgent.h: + * inspector/front-end/Settings.js: + * inspector/front-end/SettingsScreen.js: + (WebInspector.UserAgentSettingsTab): + (WebInspector.UserAgentSettingsTab.prototype._createDeviceMetricsElement): + * inspector/front-end/UserAgentSupport.js: + +2012-07-12 Ryosuke Niwa <rniwa@webkit.org> + + Move m_type and m_hasNameCache from HTMLCollectionCacheBase to DynamicNodeListCacheBase for better bit packing + https://bugs.webkit.org/show_bug.cgi?id=91164 + + Reviewed by Anders Carlsson. + + Moved m_type and m_hasNameCache from HTMLCollection and renamed them to m_collectionType and m_isNameCacheValid. + + Also renamed shouldIncludeChildren to shouldOnlyIncludeDirectChildren and negated the return value since + all HTMLCollection include children in the collection and the function was meant to tell us whether the collection + should include descendents that are not direct children of base(). + + In addition, renamed nextNodeOrSibling to nextNode since "or sibling" doesn't seem to add any semantic clarity. + + * dom/DynamicNodeList.h: + (WebCore::DynamicNodeListCacheBase::DynamicNodeListCacheBase): + (DynamicNodeListCacheBase): + (WebCore::DynamicNodeListCacheBase::type): + (WebCore::DynamicNodeListCacheBase::hasNameCache): + (WebCore::DynamicNodeListCacheBase::setHasNameCache): + (WebCore::DynamicNodeListCacheBase::clearCache): + * html/HTMLCollection.cpp: + (WebCore::shouldOnlyIncludeDirectChildren): + (WebCore::HTMLCollection::HTMLCollection): + (WebCore::HTMLCollection::isAcceptableElement): + (WebCore::nextNode): + (WebCore::HTMLCollection::itemAfter): + * html/HTMLCollection.h: + (WebCore::HTMLCollectionCacheBase::HTMLCollectionCacheBase): + (HTMLCollectionCacheBase): + (WebCore::HTMLCollectionCacheBase::clearCache): + +2012-07-12 Shinya Kawanaka <shinyak@chromium.org> + + Needs callback before AuthorShadowRoot is added. + https://bugs.webkit.org/show_bug.cgi?id=91167 + + Reviewed by Hajime Morita. + + This is a preliminary patch for adding multiple Shadow DOM support for media elements and form elements. + They assume that UserAgentShadowRoot is the oldest, however currently a page author may try to add + AuthorShadowRoot before adding UserAgentShadowRoot. + + This patch adds a callback before AuthorShadowRoot is being added, and allow us to add UserAgentShadowRoot + for those elements. See also Bug 77936, Bug 77937, Bug 90532. + + * dom/Element.h: + (WebCore::Element::willAddAuthorShadowRoot): + * dom/ElementShadow.cpp: + (WebCore::ElementShadow::addShadowRoot): + * dom/ElementShadow.h: + (ElementShadow): + * dom/ShadowRoot.cpp: + (WebCore::ShadowRoot::create): + +2012-07-12 Dana Jansens <danakj@chromium.org> + + [chromium] Remove the RenderPass pointer from RenderPassDrawQuad + https://bugs.webkit.org/show_bug.cgi?id=91023 + + Reviewed by Adrienne Walker. + + Removes the RenderPass pointer and keeps only an integer id in the + quad to refer back to the RenderPass the quad reads from. + + Covered by existing tests. + + * platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp: + (WebCore::CCLayerTreeHostImpl::calculateRenderPasses): + (WebCore::findRenderPassById): + (WebCore): + (WebCore::removeRenderPassesRecursive): + (WebCore::CCLayerTreeHostImpl::CullRenderPassesWithCachedTextures::shouldRemoveRenderPass): + (WebCore::CCLayerTreeHostImpl::CullRenderPassesWithNoQuads::shouldRemoveRenderPass): + (WebCore::CCLayerTreeHostImpl::removeRenderPasses): + (WebCore::CCLayerTreeHostImpl::prepareToDraw): + * platform/graphics/chromium/cc/CCLayerTreeHostImpl.h: + (FrameData): + (CullRenderPassesWithCachedTextures): + (CullRenderPassesWithNoQuads): + (CCLayerTreeHostImpl): + * platform/graphics/chromium/cc/CCRenderPass.cpp: + (WebCore::CCRenderPass::appendQuadsForRenderSurfaceLayer): + * platform/graphics/chromium/cc/CCRenderPass.h: + (WebCore): + * platform/graphics/chromium/cc/CCRenderPassDrawQuad.cpp: + (WebCore::CCRenderPassDrawQuad::create): + (WebCore::CCRenderPassDrawQuad::CCRenderPassDrawQuad): + * platform/graphics/chromium/cc/CCRenderPassDrawQuad.h: + (CCRenderPassDrawQuad): + * platform/graphics/chromium/cc/CCRenderSurface.cpp: + (WebCore::CCRenderSurface::appendQuads): + * platform/graphics/chromium/cc/CCRenderSurface.h: + (CCRenderSurface): + +2012-07-12 Elliott Sprehn <esprehn@gmail.com> + + Unneeded tree walking when adding or removing children due to RenderCounter / RenderQuote logic + https://bugs.webkit.org/show_bug.cgi?id=89900 + + Reviewed by Eric Seidel and Abhishek Arya. + + Previously we would walk the all children a renderer whenever adding + or removing a child renderer from its RenderObjectChildList to look for + RenderQuote and RenderCounter instances to update. This patch introduces + a counter in RenderView for the number of RenderQuote and RenderCounter + instances in that document so we can avoid these traversals. + + No tests needed since this is just a short circuiting of logic and the existing + tests should cover it. + + * rendering/RenderCounter.cpp: + (WebCore::RenderCounter::RenderCounter): Increment instance counter. + (WebCore::RenderCounter::willBeDestroyed): Decrement instance counter. + (WebCore): + (WebCore::RenderCounter::rendererRemovedFromTree): Short circuit when counter is zero. + (WebCore::RenderCounter::rendererSubtreeAttached): Short circuit when counter is zero. + * rendering/RenderCounter.h: + (RenderCounter): + * rendering/RenderObjectChildList.cpp: + (WebCore::RenderObjectChildList::removeChildNode): Short circuit calling into Counter and Quote code when the document is being destroyed. + * rendering/RenderQuote.cpp: + (WebCore::RenderQuote::RenderQuote): + (WebCore::RenderQuote::willBeDestroyed): + (WebCore): + (WebCore::RenderQuote::rendererSubtreeAttached): Increment instance counter. + (WebCore::RenderQuote::rendererRemovedFromTree): Decrement instance counter. + * rendering/RenderQuote.h: + (RenderQuote): + * rendering/RenderView.cpp: + (WebCore::RenderView::RenderView): + * rendering/RenderView.h: Methods for managing the RenderQuote and RenderCounter counts. + (RenderView): + (WebCore::RenderView::addRenderQuote): + (WebCore::RenderView::removeRenderQuote): + (WebCore::RenderView::hasRenderQuotes): + (WebCore::RenderView::addRenderCounter): + (WebCore::RenderView::removeRenderCounter): + (WebCore::RenderView::hasRenderCounters): + +2012-07-12 Ryosuke Niwa <rniwa@webkit.org> + + Merge HTMLCollectionWithArrayStorage into HTMLCollection + https://bugs.webkit.org/show_bug.cgi?id=91144 + + Reviewed by Anders Carlsson. + + Merged HTMLCollectionWithArrayStorage::item into HTMLCollection::item and got rid of + HTMLCollectionWithArrayStorage. Also de-virtualized HTMLCollection::item and HTMLCollection::length + and merged itemInArrayAfter and itemAfter. + + In addition, improved the algorithm in HTMLCollection::length to take advantage of item cache. + Instead of always computing the length from the beginning, we start the search from the cached item + so that if we're near end of the collection, we avoid significant portion of the node traversal. + + Furthermore, made HTMLCollection always call setItemCache with a non-null item and HTMLCollection::item + set the length cache when it reaches the end of the collection to avoid redundant length calculations. + + * dom/DynamicNodeList.h: + (WebCore::DynamicNodeListCacheBase::setItemCache): Add a FIXME. + * html/HTMLCollection.cpp: + (WebCore::HTMLCollection::itemAfter): Regular HTMLCollection doesn't have uses elements array so + assert that offsetInArray is always 0. + (WebCore): Removed calcLength. + (WebCore::HTMLCollection::length): Rewritten. The algorithm is as follows: + When there is no item cache, we look for the first item by calling item(0). If item(0) returns null, + then it must have set the length cache so bail out. If the previous step didn't bail out, then + the item cache is valid and not null (see above), so count the number of remaining items in collection + starting at the cached item's offset + 1. + (WebCore::HTMLCollection::item): Avoid calling setItemCache with null. When the first item is null, + set the length cache instead. + (WebCore::HTMLCollection::itemAfterCachedItem): Extracted from HTMLCollectionWithArrayStorage::item. + (WebCore::HTMLCollection::namedItem): Pass in arrayOffset to itemAfter. Note this variable is never + used since only HTMLFormCollection and HTMLPropertiesCollection use array offsets but they override + this function. + (WebCore::HTMLCollection::updateNameCache): Ditto. + * html/HTMLCollection.h: + (HTMLCollection): + (WebCore): + * html/HTMLFormCollection.cpp: Removed calcLength(). Even though this function didn't iterate over + the collection directly, HTMLFormElement::length and HTMLFieldSetElement::length did so we're not + regressing any performance here. + (WebCore::HTMLFormCollection::HTMLFormCollection): + (WebCore::HTMLFormCollection::itemAfter): + * html/HTMLFormCollection.h: + (HTMLFormCollection): + * html/HTMLNameCollection.cpp: + (WebCore::HTMLNameCollection::itemAfter): + * html/HTMLNameCollection.h: + (HTMLNameCollection): + * html/HTMLPropertiesCollection.cpp: Removed calcLength(). + (WebCore::HTMLPropertiesCollection::HTMLPropertiesCollection): + (WebCore::HTMLPropertiesCollection::itemAfter): + (WebCore): + * html/HTMLPropertiesCollection.h: + (HTMLPropertiesCollection): + * html/HTMLTableRowsCollection.cpp: + (WebCore::HTMLTableRowsCollection::itemAfter): + * html/HTMLTableRowsCollection.h: + (HTMLTableRowsCollection): + +2012-07-12 Pravin D <pravind.2k4@gmail.com> + + Row size/position is wrongly calculated when table having overlapping rowspan cell and colspan cell + https://bugs.webkit.org/show_bug.cgi?id=16811 + + Reviewed by Julien Chaffraix. + + The height of a row is calculated by taking the max height of the cells contained in it. When a row contains + a rowSpan cell and if this row is not the last row of the cell, then its height is max height of other non + rowSpan cells. If the row is the last row of the rowSpan cell, then using the contraint laid by CSS2.1 spec + "For a rowSpan cell, the sum of the row heights involved must be great enough to encompass the cell spanning the rows", + the last remaining height of the rowSpan(cell height minus heights of other involved rows) is taken into consideration + while calculating the height of this row. + Currently when calculating the height of the row we are only using the height of the primary cell at position (row, col). + However when a row has colSpan cell and rowSpan, they might overlap. In such a sitution as only the primary cells height + is considered, the height of the row will be calculated worngly if the other overlapping cell has greater height. + Thus all the overlapping cell at position (row, col) must be considered while calculating the height of a row. + + Test: fast/table/last-cell-of-rowspan-overlapping-colspan-cell.html + + * rendering/RenderTableSection.cpp: + (WebCore::RenderTableSection::calcRowLogicalHeight): + Fixed function to use all the overlapping cells at position(row, col) to calculate the height/position of rows. + +2012-07-12 Joshua Bell <jsbell@chromium.org> + + IndexedDB: Enable IDBFactory.deleteDatabase() and webkitGetDatabaseNames() in Workers + https://bugs.webkit.org/show_bug.cgi?id=90310 + + Reviewed by Tony Chang. + + Simplify Document vs. Worker logic for IDBFactory::open() and hook up the + other two IDBFactory methods for use by workers as well. + + Test: storage/indexeddb/factory-basics-workers.html + + * Modules/indexeddb/IDBFactory.cpp: + (isContextValid): Helper function consolidating checks that context is usable. + (getIndexedDBDatabasePath): Helper function for accessing group settings. + (WebCore::IDBFactory::getDatabaseNames): Simplify - just pass context through to back end. + (WebCore::IDBFactory::open): Ditto. + (WebCore::IDBFactory::deleteDatabase): Ditto. + (WebCore::IDBFactory::cmp): Whitespace. + * Modules/indexeddb/IDBFactoryBackendImpl.cpp: Obsolete openFromWorker() removed. + (WebCore::IDBFactoryBackendImpl::getDatabaseNames): Signature updated. + (WebCore::IDBFactoryBackendImpl::deleteDatabase): Signature updated. + (WebCore::IDBFactoryBackendImpl::open): Signature updated. + * Modules/indexeddb/IDBFactoryBackendImpl.h: + (IDBFactoryBackendImpl): + * Modules/indexeddb/IDBFactoryBackendInterface.h: Interface methods now take both SecurityOrigin + and ScriptExecutionContext, but not Frame. In the proxy, SecurityOrigin is redundant (can be + accessed from context) but on the real back end the context is null (as Frame was previously). + (IDBFactoryBackendInterface): + * inspector/InspectorIndexedDBAgent.cpp: + (WebCore): + (WebCore::InspectorIndexedDBAgent::requestDatabaseNamesForFrame): + (WebCore::InspectorIndexedDBAgent::requestDatabase): + (WebCore::InspectorIndexedDBAgent::requestData): + +2012-07-12 Dana Jansens <danakj@chromium.org> + + [chromium] The root layer should not try create a second RenderSurface for itself + https://bugs.webkit.org/show_bug.cgi?id=91124 + + Reviewed by Adrienne Walker. + + Tests: CCLayerTreeHostImplTest.rootLayerDoesntCreateExtraSurface + + * platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp: + (WebCore::subtreeShouldRenderToSeparateSurface): + +2012-07-12 Adam Barth <abarth@webkit.org> + + Regression (r122359) Layout Test html5lib/runner.html is failing + https://bugs.webkit.org/show_bug.cgi?id=91047 + + Reviewed by Tony Chang. + + This ASSERT is bogus because doctypes can be removed from the DOM and + then re-added. + + Test: fast/viewport/viewport-legacy-xhtmlmp-remove-and-add.html + + * dom/Document.cpp: + (WebCore::Document::setDocType): + +2012-07-12 Ojan Vafai <ojan@chromium.org> + + Implied minimum size of flex items is min-content + https://bugs.webkit.org/show_bug.cgi?id=87546 + + Reviewed by Tony Chang. + + http://dev.w3.org/csswg/css3-flexbox/#min-size-auto + In the main axis direction, min-size of auto means min-content. + + Test: css3/flexbox/flex-item-min-size.html + + * rendering/RenderBox.cpp: + (WebCore::RenderBox::computeLogicalWidthInRegionUsing): + (WebCore::RenderBox::computeContentLogicalHeightUsing): + (WebCore::RenderBox::computeReplacedLogicalWidthUsing): + (WebCore::RenderBox::computeReplacedLogicalHeightUsing): + (WebCore::RenderBox::computePositionedLogicalWidthUsing): + (WebCore::RenderBox::computePositionedLogicalHeightUsing): + It turned out that these FIXMEs are all unnecessary with the changes to RenderFlexibleBox. + + * rendering/RenderFlexibleBox.cpp: + (WebCore::RenderFlexibleBox::computeMainAxisPreferredSizes): + (WebCore::RenderFlexibleBox::adjustChildSizeForMinAndMax): + +2012-07-12 Eric Penner <epenner@google.com> + + [chromium] Use CCTexture/TextureAllocator and remove TextureManager + https://bugs.webkit.org/show_bug.cgi?id=91001 + + Reviewed by Adrienne Walker. + + Use CCTexture to clean up CCPrioritizedTexture::Backing. + Add TextureAllocator.h and remove remainder of TextureManager.h/cpp. + Minor move/refactoring of link/unlink in CCPrioritizedTexture. + Remove double initialization of the default memory limit. + + Covered by existing tests (refactoring). + + * WebCore.gypi: + * platform/graphics/chromium/BitmapCanvasLayerTextureUpdater.cpp: + * platform/graphics/chromium/BitmapCanvasLayerTextureUpdater.h: + (WebCore): + * platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.cpp: + * platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.h: + (WebCore): + * platform/graphics/chromium/ImageLayerChromium.cpp: + * platform/graphics/chromium/LayerRendererChromium.cpp: + (WebCore::LayerRendererChromium::initialize): + * platform/graphics/chromium/ManagedTexture.cpp: Removed. + * platform/graphics/chromium/ManagedTexture.h: Removed. + * platform/graphics/chromium/RenderSurfaceChromium.h: + (WebCore): + * platform/graphics/chromium/TextureAllocator.h: Copied from Source/WebCore/platform/graphics/chromium/cc/CCPriorityCalculator.h. + (WebCore): + (TextureAllocator): + (WebCore::TextureAllocator::~TextureAllocator): + * platform/graphics/chromium/TextureManager.cpp: Removed. + * platform/graphics/chromium/TextureManager.h: Removed. + * platform/graphics/chromium/TiledLayerChromium.cpp: + * platform/graphics/chromium/TrackingTextureAllocator.cpp: + (WebCore::TrackingTextureAllocator::createTexture): + (WebCore::TrackingTextureAllocator::deleteTexture): + * platform/graphics/chromium/TrackingTextureAllocator.h: + * platform/graphics/chromium/cc/CCHeadsUpDisplay.cpp: + * platform/graphics/chromium/cc/CCLayerTreeHost.cpp: + (WebCore::CCLayerTreeHost::prioritizeTextures): + * platform/graphics/chromium/cc/CCLayerTreeHost.h: + (WebCore): + * platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp: + (WebCore::CCLayerTreeHostImpl::CCLayerTreeHostImpl): + * platform/graphics/chromium/cc/CCPrioritizedTexture.cpp: + (WebCore::CCPrioritizedTexture::CCPrioritizedTexture): + (WebCore::CCPrioritizedTexture::setDimensions): + (WebCore::CCPrioritizedTexture::textureId): + (WebCore::CCPrioritizedTexture::bindTexture): + (WebCore::CCPrioritizedTexture::framebufferTexture2D): + (WebCore::CCPrioritizedTexture::link): + (WebCore): + (WebCore::CCPrioritizedTexture::unlink): + * platform/graphics/chromium/cc/CCPrioritizedTexture.h: + (WebCore): + (WebCore::CCPrioritizedTexture::bytes): + (CCPrioritizedTexture): + (WebCore::CCPrioritizedTexture::haveBackingTexture): + (WebCore::CCPrioritizedTexture::Backing::Backing): + (WebCore::CCPrioritizedTexture::Backing::~Backing): + (WebCore::CCPrioritizedTexture::Backing::owner): + (Backing): + (WebCore::CCPrioritizedTexture::backing): + * platform/graphics/chromium/cc/CCPrioritizedTextureManager.cpp: + (WebCore::CCPrioritizedTextureManager::prioritizeTextures): + (WebCore::CCPrioritizedTextureManager::requestLate): + (WebCore::CCPrioritizedTextureManager::acquireBackingTextureIfNeeded): + (WebCore::CCPrioritizedTextureManager::reduceMemory): + (WebCore::CCPrioritizedTextureManager::clearAllMemory): + (WebCore::CCPrioritizedTextureManager::registerTexture): + (WebCore::CCPrioritizedTextureManager::returnBackingTexture): + (WebCore::CCPrioritizedTextureManager::createBacking): + (WebCore::CCPrioritizedTextureManager::destroyBacking): + (WebCore::CCPrioritizedTextureManager::assertInvariants): + * platform/graphics/chromium/cc/CCPrioritizedTextureManager.h: + (CCPrioritizedTextureManager): + (WebCore::CCPrioritizedTextureManager::defaultMemoryAllocationLimit): + (WebCore::CCPrioritizedTextureManager::compareBackings): + * platform/graphics/chromium/cc/CCPriorityCalculator.h: + * platform/graphics/chromium/cc/CCScopedTexture.cpp: + * platform/graphics/chromium/cc/CCScopedTexture.h: + * platform/graphics/chromium/cc/CCTexture.h: + (WebCore::CCTexture::CCTexture): + * platform/graphics/chromium/cc/CCTiledLayerImpl.cpp: + (WebCore): + * platform/graphics/chromium/cc/CCVideoLayerImpl.cpp: + +2012-07-12 Ryosuke Niwa <rniwa@webkit.org> + + Let XCode have its own way. + + * WebCore.xcodeproj/project.pbxproj: + +2012-07-12 Julien Chaffraix <jchaffraix@webkit.org> + + ASSERT(genChild->isListMarker() || genChild->style()->styleType() == FIRST_LETTER) triggered on flex-box content + https://bugs.webkit.org/show_bug.cgi?id=91003 + + Reviewed by Abhishek Arya. + + Tests: fast/flexbox/assert-generated-deprecated-flexbox.html + fast/flexbox/assert-generated-new-flexbox.html + + The issue was that findBeforeAfterParent didn't return the right parent for the flex-box case. This would + make us update the wrong children (and not propagate the style updates properly). + + * rendering/RenderObjectChildList.cpp: + (WebCore::findBeforeAfterParent): + Added a check for flex boxes (both deprecated and new). + +2012-07-12 Pravin D <pravind.2k4@gmail.com> + + Percentage width replaced element in zero percent/fixed width container block incorrectly rendered. + https://bugs.webkit.org/show_bug.cgi?id=9493 + + Reviewed by Andy Estes. + + When the width of the container is zero percent/fixed value then the width of the replaced element must also be zero. + + Test: fast/css/percent-width-img-inside-zero-percent-and-fixed-container.html + + * rendering/RenderBox.cpp: + (WebCore::RenderBox::computeReplacedLogicalWidthUsing): + When the containing block's available width is zero there can be two cases. + The containing block is floated/positioned in which case the width of the replaced child element must be its instrinsic width. + On the other hand if the width of the container is specified to be either zero percent or fixed value then the width of the + replaced elment must be zero. + +2012-07-11 Ryosuke Niwa <rniwa@webkit.org> + + invalidateNodeListsCacheAfterAttributeChanged should dynamically figure out which attribute needs invalidation + https://bugs.webkit.org/show_bug.cgi?id=91046 + + Reviewed by Anders Carlsson. + + Added an array of counters (m_nodeListCounts) for each set of attributes (NodeListInvalidationType) node lists care about + to Document, and made DynamicSubtreeNodeList's constructor and destructor increment and decrement these counters via + registerDynamicSubtreeNodeList and unregisterDynamicSubtreeNodeList respectively. shouldInvalidateDynamicSubtreeNodeList, + which is called by invalidateNodeListsCacheAfterAttributeChanged, then use these counters to determine whether a given + attribute change should result in node list invalidations. + + Also removed m_numNodeListCaches from TreeScope because this counter has now become redundant with m_nodeListCounts. + + * dom/ChildNodeList.cpp: + (WebCore::ChildNodeList::ChildNodeList): Do not invalidate on attribute changes. + * dom/ClassNodeList.cpp: + (WebCore::ClassNodeList::ClassNodeList): Invalidate on class attribute changes. + * dom/Document.cpp: + (WebCore::Document::Document): Initialize m_nodeListCounts. + (WebCore::Document::~Document): Add assertions to make sure m_listsInvalidatedAtDocument, m_nodeListCounts, and + m_collections are all empty. + (WebCore::Document::registerDynamicSubtreeNodeList): This function is now called for all DynamicSubtreeNodeLists supposed + to just ones rooted at the document in order to increment the counter for each invalidation type. + (WebCore::Document::unregisterDynamicSubtreeNodeList): Ditto. + (WebCore::shouldInvalidateDynamicSubtreeNodeListForType): Checks the attribute name against NodeListInvalidationType. + (WebCore::Document::shouldInvalidateDynamicSubtreeNodeList): Returns true if the given attribute name matches the invalidation + type of the existing DynamicSubtreeNodeLists in the document. If the attribute name is not given (used when children change), + then it checks for the existence of any DynamicSubtreeNodeLists. Conceptually, this function can be written as a list of + "if" statements that checks values in m_nodeListCounts and the attribute name. We use "for" loop and switch statement instead + to share logic and detect future addition of values to NodeListInvalidationType. + * dom/Document.h: + (Document): Moved RootType and InvalidationType from DynamicNodeListCacheBase and renamed them to NodeListRootType and + NodeListInvalidationType respectively in order to reduce the possibility of future name collisions. Also the invalidation type + now contains 6 values instead of 2. + * dom/DynamicNodeList.cpp: + (WebCore): + * dom/DynamicNodeList.h: + (WebCore::DynamicNodeListCacheBase::DynamicNodeListCacheBase): + (WebCore::DynamicNodeListCacheBase::shouldInvalidateOnAttributeChange): + (WebCore::DynamicNodeListCacheBase::rootType): Added. + (WebCore::DynamicNodeListCacheBase::invalidationType): Added. + (DynamicNodeListCacheBase): Uses 3 bits to store invalidation type now that the number of values have increased from 2 to 6. + (WebCore::DynamicNodeList::DynamicNodeList): + (WebCore::DynamicSubtreeNodeList::~DynamicSubtreeNodeList): Call unregisterDynamicSubtreeNodeList. + (WebCore::DynamicSubtreeNodeList::DynamicSubtreeNodeList): Call registerDynamicSubtreeNodeList. + * dom/MicroDataItemList.cpp: + (WebCore::MicroDataItemList::MicroDataItemList): Invalidate on itemscope, itemprop, and itemtype content attribute changes. + * dom/NameNodeList.cpp: + (WebCore::NameNodeList::NameNodeList): Invalidate on name attribute changes. + * dom/Node.cpp: + (WebCore::Node::clearRareData): + (WebCore::Node::invalidateNodeListsCacheAfterAttributeChanged): Replaced the hard coded check list of attributes, by a call + to shouldInvalidateDynamicSubtreeNodeList. + (WebCore::Node::invalidateNodeListsCacheAfterChildrenChanged): Calls shouldInvalidateDynamicSubtreeNodeList. + (WebCore::Node::getElementsByTagName): + (WebCore::Node::getElementsByTagNameNS): + (WebCore::Node::getElementsByName): + (WebCore::Node::getElementsByClassName): + (WebCore::Node::radioNodeList): + (WebCore::NodeRareData::createNodeLists): + * dom/NodeRareData.h: + (WebCore::NodeListsNodeData::adoptTreeScope): Unregister and register node lists in m_tagNodeListCacheNS since all node lists + need to be accounted in m_nodeListCounts. + (WebCore::NodeRareData::ensureNodeLists): + (NodeRareData): + * dom/TagNodeList.cpp: + (WebCore::TagNodeList::TagNodeList): Do not invalidate on any attribute changes. + * dom/TreeScope.cpp: + (WebCore::TreeScope::TreeScope): No longer initializes m_numNodeListCaches since it has been removed. + * dom/TreeScope.h: + (TreeScope): Removed m_numNodeListCaches. + * dom/TreeScopeAdopter.cpp: + (WebCore::TreeScopeAdopter::moveTreeToNewScope): + * html/HTMLCollection.h: + (WebCore::HTMLCollectionCacheBase::HTMLCollectionCacheBase): Just pass in DoNotInvalidateOnAttributeChanges for now since + it's never used in HTMLCollections. + * html/LabelableElement.cpp: + (WebCore::LabelableElement::labels): + * html/LabelsNodeList.cpp: + (WebCore::LabelsNodeList::LabelsNodeList): Invalidate on for content attribute changes. + (WebCore::LabelsNodeList::~LabelsNodeList): + * html/RadioNodeList.cpp: + (WebCore::RadioNodeList::RadioNodeList): Invalidate on id, name, and for content attribute changes. + (WebCore::RadioNodeList::~RadioNodeList): + +2012-07-12 Gavin Barraclough <barraclough@apple.com> + + Threadsafety issues in WebScriptObject + https://bugs.webkit.org/show_bug.cgi?id=90849 + + Reviewed by Filip Pizlo & Oliver Hunt. + + Updated fix for this bug. Taking the JSC API lock from WebScriptObject::release + may not be safe; better to just guard the JSWrapperCache with its own spinlock. + + * bindings/objc/WebScriptObject.mm: + (WebCore::getJSWrapper): + - Added spinlock; also retain/autorelease the returned wrapper - it is unsafe + to wait for the caller to do so, due to a race condition vs release removing + the wrapper from the map. + (WebCore::addJSWrapper): + - Take the spinlock guarding the cache. + (WebCore::removeJSWrapper): + - Take the spinlock guarding the cache. + (WebCore::removeJSWrapperIfRetainCountOne): + - Take the spinlock guarding the cache, remove the wrapper if retainCount is one. + (WebCore::createJSWrapper): + - Remove the API lock; this method no longer needs to retain/autorelease (this is + done by getJSWrapper). + (-[WebScriptObject _setImp:originRootObject:rootObject:]): + - Remove the API lock. + (-[WebScriptObject release]): + - Remove the API lock, retainCount check moved into removeJSWrapperIfRetainCountOne. + +2012-07-11 David Hyatt <hyatt@apple.com> + + https://bugs.webkit.org/show_bug.cgi?id=91000 + REGRESSION (r122244): Overflow elements don't shrink as much as they should. + + Reviewed by Simon Fraser. + + This is a fix for a a regression from https://bugs.webkit.org/show_bug.cgi?id=90646. + + I incorrectly analyzed the issue with Robert Hogan's negative margin patch and fooled myself into putting back + in an incorrect minimum width check from long ago. + + What should have happened in the test case I patched is that the overflow element should shrink to 0. The issue + with improving the logical top estimate in the previous patch is it made the clear delta become 0. This in turn + exposed a bug in our clearing algorithm with Robert's changes where you could need a relayout even if you didn't + actually move. This issue only occurs because the floats list is getting changed mid-layout because of negative margins. + + The patch changes getClearDelta to call setChildNeedsLayout(true) on children whose widths change even when their + positions do not. In effect this dynamic addition of new floats after you have done a layout on the child already means + that you can need to lay out again despite not actually having to move. + + To handle this, the code that does the relayout is now called if the child needs a relayout. This is done even if + the logical top estimate matches the final position. + + No new tests required, since the test in fast/block/float is now correctly covering the issue. + + * rendering/RenderBlock.cpp: + (WebCore::RenderBlock::layoutBlockChild): + (WebCore::RenderBlock::getClearDelta): + * rendering/RenderBox.cpp: + (WebCore::RenderBox::shrinkLogicalWidthToAvoidFloats): + +2012-07-12 James Weatherall <wez@chromium.org> + + storage tests are flaky (crashing) on windows + https://bugs.webkit.org/show_bug.cgi?id=90469 + + Reviewed by Kentaro Hara. + + Add a missing check that the underlying V8 object reference in a V8 NPObject is valid, and zero the NPObject's rootObject member when disposing it, to ensure that it won't be mistakenly touched after that point. + + This patch is intended to resolve flakiness in the storage tests including: + storage/indexeddb/mozilla/indexes.html + storage/indexeddb/mozilla/key-requirements-inline-and-passed.html + storage/websql/multiple-databases-garbage-collection.html + + * bindings/v8/NPV8Object.cpp: + (WebCore::disposeUnderlyingV8Object): + Zero the NPObject's underlying rootObject. + (_NPN_EvaluateHelper): + Add check that the underlying V8 object reference is valid. + +2012-07-12 No'am Rosenthal <noam.rosenthal@nokia.com> + + Move TextureMapperAnimation and texmap/LayerTransform to platform/graphics + https://bugs.webkit.org/show_bug.cgi?id=91111 + + Reviewed by Kenneth Rohde Christiansen. + + TextureMapperAnimation and LayerTransform are not specific to TextureMapper, and we want + to use them for other purposes as well. Moving them to platform/graphics would make that + more explicit. + + No new tests, moving files around. + + * GNUmakefile.list.am: + * Target.pri: + * WebCore.gypi: + * platform/graphics/GraphicsLayerAnimation.cpp: Renamed from Source/WebCore/platform/graphics/texmap/TextureMapperAnimation.cpp. + * platform/graphics/GraphicsLayerAnimation.h: Renamed from Source/WebCore/platform/graphics/texmap/TextureMapperAnimation.h. + * platform/graphics/GraphicsLayerTransform.cpp: Renamed from Source/WebCore/platform/graphics/texmap/LayerTransform.cpp. + * platform/graphics/GraphicsLayerTransform.h: Renamed from Source/WebCore/platform/graphics/texmap/LayerTransform.h. + * platform/graphics/texmap/GraphicsLayerTextureMapper.cpp: + (WebCore::GraphicsLayerTextureMapper::addAnimation): + * platform/graphics/texmap/GraphicsLayerTextureMapper.h: + (GraphicsLayerTextureMapper): + * platform/graphics/texmap/TextureMapperLayer.h: + (TextureMapperLayer): + (WebCore::TextureMapperLayer::setAnimatedTransform): + (WebCore::TextureMapperLayer::setAnimatedOpacity): + +2012-07-12 Vsevolod Vlasov <vsevik@chromium.org> + + Web Inspector: Simplify UISourceCode code after moving revisions support inside it. + https://bugs.webkit.org/show_bug.cgi?id=91118 + + Reviewed by Pavel Feldman. + + * inspector/front-end/UISourceCode.js: + (WebInspector.UISourceCode.prototype._setContent): + (WebInspector.UISourceCode.prototype.revertToOriginal): + (WebInspector.UISourceCode.prototype.revertAndClearHistory): + (WebInspector.UISourceCode.prototype.contentChanged): + (WebInspector.UISourceCode.prototype.commitWorkingCopy): + (WebInspector.Revision.prototype.revertToThis): + +2012-07-12 Allan Sandfeld Jensen <allan.jensen@nokia.com> + + Unreviewed. Build fix for r122462. + + * platform/qt/MemoryUsageSupportQt.cpp: + +2012-07-12 Vsevolod Vlasov <vsevik@chromium.org> + + Web Inspector: Remove resources panel edited resources search support. + https://bugs.webkit.org/show_bug.cgi?id=91101 + + Reviewed by Pavel Feldman. + + * inspector/front-end/ResourcesPanel.js: + (WebInspector.ResourcesPanel.prototype.performSearch.callback): + (WebInspector.ResourcesPanel.prototype.performSearch): + +2012-07-12 Vsevolod Vlasov <vsevik@chromium.org> + + Unreviewed r122460 inspector closure compilation fix follow up. + + * inspector/front-end/RevisionHistoryView.js: + (WebInspector.RevisionHistoryView): + +2012-07-12 Ilya Tikhonovsky <loislo@chromium.org> + + Web Inspector: fix native memory instrumentation code for the bindings instrumentation. + https://bugs.webkit.org/show_bug.cgi?id=91096 + + The instrumented class has to have instrumentation method which reports class size and type and + the member objects and pointers. + + Sample: + void Node::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const + { + memoryObjectInfo->reportObjectInfo(this, MemoryInstrumentation::DOM); // report object size and type. + TreeShared<Node, ContainerNode>::reportMemoryUsage(memoryObjectInfo); // call base class instrumentation. + ScriptWrappable::reportMemoryUsage(memoryObjectInfo); // call base class instrumentation. + memoryObjectInfo->reportPointer(m_document, MemoryInstrumentation::DOM); // report uninstrumented pointer. + memoryObjectInfo->reportInstrumentedPointer(m_next); // report instrumented pointer. + memoryObjectInfo->reportInstrumentedObject(m_anObject); // report instrumented object. + } + + Reviewed by Pavel Feldman. + + Existing tests for native memory instrumentation. + + * bindings/v8/DOMDataStore.cpp: + (WebCore::DOMDataStore::reportMemoryUsage): + * bindings/v8/DOMDataStore.h: + (WebCore): + (DOMDataStore): + * bindings/v8/IntrusiveDOMWrapperMap.h: + (WebCore::ChunkedTable::reportMemoryUsage): + * bindings/v8/ScriptProfiler.cpp: + (WebCore::ScriptProfiler::collectBindingMemoryInfo): + * bindings/v8/V8Binding.cpp: + (WebCore::V8BindingPerIsolateData::reportMemoryUsage): + (WebCore::StringCache::reportMemoryUsage): + * bindings/v8/V8Binding.h: + (WebCore): + (StringCache): + (V8BindingPerIsolateData): + * bindings/v8/V8DOMMap.h: + (WebCore): + (AbstractWeakReferenceMap): + * inspector/InspectorMemoryAgent.cpp: + (WebCore): + +2012-07-12 Pavel Feldman <pfeldman@chromium.org> + + Web Inspector: beautify find bar looks, simplify search update routines. + https://bugs.webkit.org/show_bug.cgi?id=91087 + + Reviewed by Vsevolod Vlasov. + + This change updates the looks to the one on the screenshots and simplifies match count update routines. + + * inspector/front-end/SearchController.js: + (WebInspector.SearchController.onMatchesMouseDown): + (WebInspector.SearchController): + (WebInspector.SearchController.prototype.activePanelChanged.performPanelSearch): + (WebInspector.SearchController.prototype.activePanelChanged): + (WebInspector.SearchController.prototype._updateSearchNavigationButtonState): + (WebInspector.SearchController.prototype._updateSearchMatchesCountAndCurrentMatchIndex): + (WebInspector.SearchController.prototype._onKeyDown): + (WebInspector.SearchController.prototype._onInput): + (WebInspector.SearchController.prototype._onNextButtonSearch): + (WebInspector.SearchController.prototype._onPrevButtonSearch): + (WebInspector.SearchController.prototype._performSearch): + * inspector/front-end/inspector.css: + (#search): + (#search:focus): + (.toolbar-search-navigation-controls): + (.toolbar-search-navigation): + (.toolbar-search-navigation.enabled:hover): + (.toolbar-search-navigation.enabled, .toolbar-search-navigation.enabled:active): + (.toolbar-search): + (.toolbar-search-control): + (.search-results-matches): + (.inspector-footer): + +2012-07-12 Joshua Bell <jsbell@chromium.org> + + IndexedDB: ASSERT hit calling open from callback in Worker + https://bugs.webkit.org/show_bug.cgi?id=90832 + + Reviewed by Kentaro Hara. + + GroupSettings are used to provide the backing store path in some + ports. Accessing those settings from a Worker was added, but the + access referenced thread startup data that is cleared before the + run loop, so an IDBFactory.open() call executed asynchronously + would dereference a null pointer. Plumb the settings startup + data into the context itself, like all of the other properties. + + Test: storage/indexeddb/open-twice-workers.html + + * Modules/indexeddb/IDBFactory.cpp: + (WebCore::IDBFactory::open): + * workers/DedicatedWorkerContext.cpp: + (WebCore::DedicatedWorkerContext::DedicatedWorkerContext): + * workers/DedicatedWorkerContext.h: + (WebCore::DedicatedWorkerContext::create): + (DedicatedWorkerContext): + * workers/DedicatedWorkerThread.cpp: + (WebCore::DedicatedWorkerThread::createWorkerContext): + * workers/DedicatedWorkerThread.h: + (DedicatedWorkerThread): + * workers/SharedWorkerContext.cpp: + (WebCore::SharedWorkerContext::SharedWorkerContext): + * workers/SharedWorkerContext.h: + (WebCore::SharedWorkerContext::create): + (SharedWorkerContext): + * workers/SharedWorkerThread.cpp: + (WebCore::SharedWorkerThread::createWorkerContext): + * workers/SharedWorkerThread.h: + (SharedWorkerThread): + * workers/WorkerContext.cpp: + (WebCore::WorkerContext::WorkerContext): + * workers/WorkerContext.h: + (WebCore::WorkerContext::groupSettings): + (WorkerContext): + * workers/WorkerThread.cpp: + (WebCore::WorkerThread::workerThread): + * workers/WorkerThread.h: + (WorkerThread): + +2012-07-12 Allan Sandfeld Jensen <allan.jensen@nokia.com> + + [Qt] Implement MemoryUsageSupport + https://bugs.webkit.org/show_bug.cgi?id=91094 + + Reviewed by Adam Barth. + + Implements Qt versions of the memory-usage functions using the information we have available + from the various memory systems used in WebKit. + + Also gets rid of a redundant indirection in V8GCController. + + * Target.pri: + * bindings/v8/V8GCController.cpp: + (WebCore::V8GCController::gcEpilogue): + (WebCore::V8GCController::checkMemoryUsage): + * platform/qt/MemoryUsageSupportQt.cpp: Added. + (WebCore::mallocMemoryUsage): + (WebCore::memoryUsageKB): + (WebCore::actualMemoryUsageKB): + (WebCore::MemoryUsageSupport::memoryUsageMB): + (WebCore::MemoryUsageSupport::actualMemoryUsageMB): + (WebCore::MemoryUsageSupport::lowMemoryUsageMB): + (WebCore::MemoryUsageSupport::highMemoryUsageMB): + (WebCore::MemoryUsageSupport::highUsageDeltaMB): + (WebCore::MemoryUsageSupport::processMemorySizesInBytes): + * platform/qt/PlatformSupport.h: + (PlatformSupport): + +2012-07-12 Vsevolod Vlasov <vsevik@chromium.org> + + Web Inspector: Revision history view should be updated when uiSourceCodes are removed or replaced. + https://bugs.webkit.org/show_bug.cgi?id=91095 + + Reviewed by Pavel Feldman. + + RevisionHistoryView is now reset in WorkspaceReset event handler. + UISourceCodes are now removed from RevisionHistoryView when uiSourceCode is removed or replace. + + * inspector/front-end/RevisionHistoryView.js: + (WebInspector.RevisionHistoryView): + (WebInspector.RevisionHistoryView.prototype._clearHistory): + (WebInspector.RevisionHistoryView.prototype._uiSourceCodeRemoved): + (WebInspector.RevisionHistoryView.prototype._uiSourceCodeReplaced): + * inspector/front-end/ScriptsPanel.js: + (WebInspector.ScriptsPanel.prototype._reset): + +2012-07-12 Dongwoo Im <dw.im@samsung.com> + + InspectorFileSystemAgent.cpp have to include File.h explicitly + https://bugs.webkit.org/show_bug.cgi?id=91078 + + Reviewed by Vsevolod Vlasov. + + Make sure the InspectorFileSystemAgent.cpp include the File.h by including explicitly. + + No new tests. Covered by existing tests. + + * inspector/InspectorFileSystemAgent.cpp: Include File.h + +2012-07-12 Vsevolod Vlasov <vsevik@chromium.org> + + Web Inspector: [Regression] Stale revisions should be removed on navigation. + https://bugs.webkit.org/show_bug.cgi?id=91080 + + Reviewed by Pavel Feldman. + + Moved all the code responsible for script mapping resetting to Workspace. + Stale revisions are removed in Workspace._reset now. + + * inspector/front-end/ScriptSnippetModel.js: + (WebInspector.ScriptSnippetModel): + * inspector/front-end/StylesPanel.js: + (WebInspector.StylesUISourceCodeProvider): + (WebInspector.StylesUISourceCodeProvider.prototype._populate): + (WebInspector.StylesUISourceCodeProvider.prototype.reset): + * inspector/front-end/UISourceCode.js: + (WebInspector.UISourceCode.prototype._restoreRevisionHistory): + * inspector/front-end/Workspace.js: + (WebInspector.Workspace): + (WebInspector.Workspace.prototype._reset): + +2012-07-12 Andreas Kling <kling@webkit.org> + + Make ElementAttributeData a variable-sized object to reduce memory use. + <http://webkit.org/b/88240> + + Reviewed by Antti "Obi-Wan" Koivisto. + + Take advantage of the fact that we know at ElementAttributeData construction time how many attributes + it needs to accomodate and allocate exactly as much space as needed instead of using a Vector. + For elements that never have their attribute list mutated (the vast majority), this saves a lot of + memory and removes the indirection to Vector<Attribute>'s heap-allocated storage. + + Introduced a mutability flag to ElementAttributeData and sprinkled assertions all over to make sure + that nothing tries to mutate an element with a raw attribute array. + + When an Element's attribute(s) are mutated, we reconstruct the ElementAttributeData, this time using + a Vector as backing instead. This is triggered when calling Element::mutableAttributeData(). + + This reduces memory consumption by 3.2MB when viewing the full HTML5 spec at <http://whatwg.org/c/>. + That is a ~35% reduction in DOM attribute memory use. + + Furthermore, that page ends up promoting 27% of the elements to mutable attribute storage due to dynamic + adding of "class" attributes. For more static pages, savings are even greater. + + Also did away with ElementAttributeData::removeAttribute(name) and do separate index lookup where + needed. Not a big deal but avoids double lookup of attributes when removing them. + + * css/PropertySetCSSStyleDeclaration.cpp: + (WebCore::InlineCSSStyleDeclaration::ensureMutablePropertySet): + + Call ensureInlineStyle() on the element so we know we have a StylePropertySet to work with. + May cause the creation (and replacement) of a new underlying StylePropertySet on the Element's + attribute data. + + * css/StylePropertySet.cpp: + (WebCore::StylePropertySet::adoptCSSOMWrapperFrom): + + Added. Allows switching the underlying StylePropertySet object while retaining CSSOM wrapper + identity (web facing behavior.) + + * dom/Element.cpp: + (WebCore::Element::detachAttribute): + (WebCore::Element::removeAttribute): + (WebCore::Element::attributes): + (WebCore::Element::setAttributeInternal): + (WebCore::Element::parserSetAttributes): + (WebCore::Element::hasEquivalentAttributes): + (WebCore::Element::setAttributeNode): + (WebCore::Element::removeAttributeNode): + (WebCore::Element::getAttributeNode): + (WebCore::Element::getAttributeNodeNS): + (WebCore::Element::hasAttribute): + (WebCore::Element::hasAttributeNS): + (WebCore::Element::normalizeAttributes): + (WebCore::Element::cloneAttributesFromElement): + (WebCore::Element::createMutableAttributeData): + * dom/Element.h: + (WebCore::Element::attributeData): + (Element): + (WebCore::Element::updatedAttributeData): + (WebCore::Element::ensureAttributeData): + (WebCore::Element::ensureUpdatedAttributeData): + (WebCore::Element::mutableAttributeData): + (WebCore): + * dom/ElementAttributeData.cpp: + (WebCore::ElementAttributeData::createImmutable): + (WebCore): + (WebCore::ElementAttributeData::ElementAttributeData): + (WebCore::ElementAttributeData::~ElementAttributeData): + (WebCore::ElementAttributeData::attrIfExists): + (WebCore::ElementAttributeData::ensureAttr): + (WebCore::ElementAttributeData::setAttr): + (WebCore::ElementAttributeData::removeAttr): + (WebCore::ElementAttributeData::ensureInlineStyle): + (WebCore::ElementAttributeData::ensureMutableInlineStyle): + (WebCore::ElementAttributeData::destroyInlineStyle): + (WebCore::ElementAttributeData::addAttribute): + (WebCore::ElementAttributeData::removeAttribute): + (WebCore::ElementAttributeData::isEquivalent): + (WebCore::ElementAttributeData::detachAttrObjectsFromElement): + (WebCore::ElementAttributeData::getAttributeItemIndexSlowCase): + (WebCore::ElementAttributeData::cloneDataFrom): + (WebCore::ElementAttributeData::clearAttributes): + (WebCore::ElementAttributeData::replaceAttribute): + (WebCore::ElementAttributeData::getAttributeNode): + * dom/ElementAttributeData.h: + (WebCore::ElementAttributeData::create): + (ElementAttributeData): + (WebCore::ElementAttributeData::setClass): + (WebCore::ElementAttributeData::setIdForStyleResolution): + (WebCore::ElementAttributeData::inlineStyle): + (WebCore::ElementAttributeData::setAttributeStyle): + (WebCore::ElementAttributeData::reportMemoryUsage): + (WebCore::ElementAttributeData::isMutable): + (WebCore::ElementAttributeData::makeMutable): + (WebCore::ElementAttributeData::length): + (WebCore): + (WebCore::ElementAttributeData::isEmpty): + (WebCore::ElementAttributeData::array): + (WebCore::ElementAttributeData::removeAttribute): + (WebCore::ElementAttributeData::getAttributeItem): + (WebCore::ElementAttributeData::getAttributeItemIndex): + (WebCore::ElementAttributeData::attributeItem): + * dom/StyledElement.cpp: + (WebCore::StyledElement::style): + (WebCore::StyledElement::classAttributeChanged): + (WebCore::StyledElement::setInlineStyleProperty): + (WebCore::StyledElement::removeInlineStyleProperty): + (WebCore::StyledElement::addSubresourceAttributeURLs): + * dom/StyledElement.h: + (WebCore::StyledElement::ensureInlineStyle): + * html/parser/HTMLConstructionSite.cpp: + (WebCore::HTMLConstructionSite::createHTMLElementFromSavedElement): + * xml/parser/XMLDocumentParserQt.cpp: + (WebCore::XMLDocumentParser::XMLDocumentParser): + +2012-07-12 Florin Malita <fmalita@chromium.org> + + Incorrect handling of chained pending resources in SVGUseElement + https://bugs.webkit.org/show_bug.cgi?id=89686 + + Reviewed by Nikolas Zimmermann. + + Currently SVGUseElement builds the shadow tree when the target first + becomes available. This is normally OK, but if the target itself (or + one of its children) is a <use> element with pending resources, then + the shadow expansion only captures the current state of the tree and + never gets updated when the pending resource becomes available. + + In order to support arbitrary <use>-on-<use> constructs, this patch + tracks nested <use> dependencies and rebuilds the dependent trees + whenever the target gets updated. + + + Tests: svg/custom/use-nested-expected.svg + svg/custom/use-nested.svg + + * svg/SVGElement.cpp: + (WebCore::SVGElement::removedFrom): removedFrom needs to be called up the inheritance chain + before invoking removeAllElementReferencesForTarget. Otherwise we could end up finding the + element being removed as a valid target in SVGUseElement::buildInstanceTree because its + InDocument flag is not cleared yet. + * svg/SVGUseElement.cpp: + (WebCore::SVGUseElement::~SVGUseElement): + (WebCore::SVGUseElement::clearResourceReferences): + (WebCore::SVGUseElement::buildPendingResource): + (WebCore::SVGUseElement::buildShadowAndInstanceTree): + (WebCore::SVGUseElement::buildInstanceTree): + * svg/SVGUseElement.h: + (SVGUseElement): + Track <use> -> <use> dependencies using SVGDocumentExtensions' + m_elementDependencies framework and ensure dependent trees are rebuilt + when the target itself gets rebuilt. + +2012-07-12 MORITA Hajime <morrita@google.com> + + Typo: ParentTranversalDetails should be ParentTraversalDetails + https://bugs.webkit.org/show_bug.cgi?id=91059 + + Reviewed by Andreas Kling. + + Did a bare rename from ParentTranversalDetails to ParentTraversalDetails + + No new tests, just a rename. + + * dom/ComposedShadowTreeWalker.cpp: + (WebCore::ComposedShadowTreeWalker::ParentTraversalDetails::didTraverseInsertionPoint): + (WebCore::ComposedShadowTreeWalker::ParentTraversalDetails::didTraverseShadowRoot): + (WebCore::ComposedShadowTreeWalker::ParentTraversalDetails::didFindNode): + (WebCore::ComposedShadowTreeWalker::findParent): + (WebCore::ComposedShadowTreeWalker::traverseNodeEscapingFallbackContents): + (WebCore::ComposedShadowTreeWalker::traverseParent): + (WebCore::ComposedShadowTreeWalker::traverseParentInCurrentTree): + (WebCore::ComposedShadowTreeWalker::traverseParentBackToYoungerShadowRootOrHost): + * dom/ComposedShadowTreeWalker.h: + (WebCore::ComposedShadowTreeWalker::ParentTraversalDetails::ParentTraversalDetails): + (ComposedShadowTreeWalker): + * dom/NodeRenderingContext.h: + (NodeRenderingContext): + +2012-07-11 Antti Koivisto <antti@apple.com> + + Failure to dispatch didFinishLoadForFrame if font load fails synchronously + https://bugs.webkit.org/show_bug.cgi?id=91018 + + Reviewed by Enrica Casucci. + + New font loads may be triggered by layout after the document load is complete but before we have dispatched + didFinishLoading for the frame. If the load fails synchronously we might fail to ever invoke + FrameLoader::checkLoadComplete and so fail to dispatch didFinishLoading. + + Make sure this doesn't happen by calling FrameLoader::checkLoadComplete explicitly after triggering font loads. + + * css/CSSFontSelector.cpp: + (WebCore::CSSFontSelector::beginLoadTimerFired): + +2012-07-12 Gyuyoung Kim <gyuyoung.kim@samsung.com> + + Register protocol handler files should be in Modules/protocolhandler + https://bugs.webkit.org/show_bug.cgi?id=90766 + + Reviewed by Hajime Morita. + + The register protocol handler files are now self-contained. This patch is moved to the Modules. + + No new tests. Covered by existing tests. + + * CMakeLists.txt: + * GNUmakefile.am: + * GNUmakefile.list.am: + * Modules/protocolhandler/NavigatorRegisterProtocolHandler.cpp: Renamed from Source/WebCore/page/NavigatorRegisterProtocolHandler.cpp. + (WebCore): + (WebCore::initProtocolHandlerWhitelist): + (WebCore::verifyCustomHandlerURL): + (WebCore::isProtocolWhitelisted): + (WebCore::verifyProtocolHandlerScheme): + (WebCore::NavigatorRegisterProtocolHandler::NavigatorRegisterProtocolHandler): + (WebCore::NavigatorRegisterProtocolHandler::~NavigatorRegisterProtocolHandler): + (WebCore::NavigatorRegisterProtocolHandler::registerProtocolHandler): + (WebCore::customHandlersStateString): + (WebCore::NavigatorRegisterProtocolHandler::isProtocolHandlerRegistered): + (WebCore::NavigatorRegisterProtocolHandler::unregisterProtocolHandler): + * Modules/protocolhandler/NavigatorRegisterProtocolHandler.h: Renamed from Source/WebCore/page/NavigatorRegisterProtocolHandler.h. + (WebCore): + (NavigatorRegisterProtocolHandler): + * Modules/protocolhandler/NavigatorRegisterProtocolHandler.idl: Renamed from Source/WebCore/page/NavigatorRegisterProtocolHandler.idl. + * Target.pri: + * WebCore.gyp/WebCore.gyp: + * WebCore.gypi: + * WebCore.pri: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.vcproj/WebCoreCommon.vsprops: + * WebCore.vcproj/copyForwardingHeaders.cmd: + * WebCore.xcodeproj/project.pbxproj: + +2012-07-12 Jonathan Dong <jonathan.dong@torchmobile.com.cn> + + [BlackBerry] Cannot use digest proxy auth and NTLM auth at the same time + https://bugs.webkit.org/show_bug.cgi?id=91054 + + Reviewed by George Staikos. + + Added an interface function syncProxyCredential() in class + PageClientBlackBerry, which is responsible to notify WebPageClient + to synchronize proxy credential to the chrome process. + + Internally reviewed by Jason Liu <jason.liu@torchmobile.com.cn> + + No new tests since there's no functional change. + + * platform/blackberry/PageClientBlackBerry.h: + * platform/network/blackberry/NetworkJob.cpp: + (WebCore::NetworkJob::storeCredentials): Remember the accepted proxy + credential and notify webpage client to synchronize it. + +2012-07-12 Xingnan Wang <xingnan.wang@intel.com> + + [IndexedDB] upperOpen set to true in lowerBound()/lowerOpen set to true in upperBound() + https://bugs.webkit.org/show_bug.cgi?id=90867 + + Reviewed by Tony Chang. + + In the latest W3C spec upperOpen/lowerOpen are set to true in lowerBound()/upperBound(), which + we should keep aligned with. + + No new tests - updated storage/indexeddb/keyrange.html to match new behavior. + + * Modules/indexeddb/IDBKeyRange.cpp: + (WebCore::IDBKeyRange::lowerBound): + (WebCore::IDBKeyRange::upperBound): + +2012-07-12 MORITA Hajime <morrita@google.com> + + [Shadow DOM] <video> with <shadow> crashes + https://bugs.webkit.org/show_bug.cgi?id=91055 + + Reviewed by Kent Tamura. + + This is similar to Bug 90480, where an undesired renderer is created by + locating an insertion point on the shadow boundary. + + This change adds a guard for such case by cheking whether the + source node of each to-be-created renderer comes from the UA shadow + tree, which is allowed to have a renderer. + + Test: fast/dom/shadow/insertion-point-video-crash.html + + * html/HTMLMediaElement.cpp: + (WebCore::HTMLMediaElement::childShouldCreateRenderer): Added a check. + (WebCore::HTMLMediaElement::mediaControls): Added const. + (WebCore::HTMLMediaElement::hasMediaControls): Added const. + * html/HTMLMediaElement.h: + (HTMLMediaElement): + +2012-07-12 Yoshifumi Inoue <yosin@chromium.org> + + REGRESSION(r122184): LocaleMac::currentLocale should use current locale rather than newly create locale object. + https://bugs.webkit.org/show_bug.cgi?id=91057 + + Reviewed by Kent Tamura. + + This patch changes NSLocale object of LocaleMac::m_locale variable to + current NSLocale object rather than newly created NSLocale object from + locale identifier. + + No new tests. We don't have way to change system preferences from + test scripts and restoring them. To test this patch, we need to do so. + + * platform/text/mac/LocaleMac.h: + (LocaleMac): Added a constructor which takes NSLocale object. + * platform/text/mac/LocaleMac.mm: + (WebCore::LocaleMac::LocaleMac): Added a constructor which takes NSLocale object. + (WebCore::LocaleMac::currentLocale): Changed to construct LocaleMac object from NSLocale object rather than locale identifier. + +2012-07-11 Carlos Garcia Campos <cgarcia@igalia.com> + + [GTK] Add webkit_cookie_manager_set_persistent_storage() to WebKit2 GTK+ API + https://bugs.webkit.org/show_bug.cgi?id=83016 + + Reviewed by Martin Robinson. + + * platform/network/soup/CookieStorageSoup.cpp: + (WebCore::soupCookiesChanged): Do not notify about changes in + other cookie jars than the current one. + +2012-07-12 Philip Rogers <pdr@google.com> + + Refactor RenderSVGShape bounding box code + https://bugs.webkit.org/show_bug.cgi?id=90655 + + Reviewed by Nikolas Zimmermann. + + RenderSVGShape::objectBoundingBox worked differently than RenderSVGShape::strokeBoundingBox by + not caching the object bounding box and instead computing it on each call. For consistency and + performance objectBoundingBox has been refactored to return a cached value. + + createShape has been renamed updateShapeFromElement for understandability. updateShapeFromElement + now updates the internal state of the shape (bounding boxes, etc) from the associated element. + RenderSVGShape::inflateWithStrokeAndMarkerBounds has been merged into + RenderSVGShape::calculateStrokeBoundingBox which is called from updateShapeFromElement. + + After this change all bounding box computation is now handled in updateShapeFromElement. Because + subclasses override updateShapeFromElement it will be easy for them to have custom bounding box + code there (as will happen for RenderSVGPath in a followup patch). + + strokeBoundingBox and objectBoundingBox are now able to return their cached values immediately + in RenderSVGRect and RenderSVGEllipse instead of checking their fallback state on each call. + + Additionally, to save space RenderSVGEllipse and RenderSVGRect now use the m_fillBoundingBox and + m_strokeBoundingBox of RenderSVGShape instead of having their own. + + This patch also removes setStrokeAndMarkerBoundingBox that was previously dead code. + + No new tests, just a refactoring. + + * rendering/svg/RenderSVGEllipse.cpp: + (WebCore::RenderSVGEllipse::updateShapeFromElement): + (WebCore): + (WebCore::RenderSVGEllipse::fillShape): + (WebCore::RenderSVGEllipse::strokeShape): + (WebCore::RenderSVGEllipse::shapeDependentStrokeContains): + * rendering/svg/RenderSVGEllipse.h: + (RenderSVGEllipse): + (WebCore::RenderSVGEllipse::isEmpty): + * rendering/svg/RenderSVGRect.cpp: + (WebCore::RenderSVGRect::updateShapeFromElement): + (WebCore): + (WebCore::RenderSVGRect::fillShape): + (WebCore::RenderSVGRect::strokeShape): + (WebCore::RenderSVGRect::shapeDependentStrokeContains): + (WebCore::RenderSVGRect::shapeDependentFillContains): + * rendering/svg/RenderSVGRect.h: + (RenderSVGRect): + (WebCore::RenderSVGRect::isEmpty): + * rendering/svg/RenderSVGShape.cpp: + (WebCore::RenderSVGShape::updateShapeFromElement): + (WebCore): + (WebCore::RenderSVGShape::layout): + (WebCore::RenderSVGShape::calculateObjectBoundingBox): + (WebCore::RenderSVGShape::calculateStrokeBoundingBox): + (WebCore::RenderSVGShape::updateRepaintBoundingBox): + * rendering/svg/RenderSVGShape.h: + (RenderSVGShape): + (WebCore::RenderSVGShape::objectBoundingBox): + (WebCore::RenderSVGShape::strokeBoundingBox): + +2012-07-12 Kent Tamura <tkent@chromium.org> + + Do not save the form state signature if nothing is saved + https://bugs.webkit.org/show_bug.cgi?id=91050 + + Reviewed by Hajime Morita. + + This change will reduce the size of HistoyItem. + + Test: fast/forms/state-restore-empty-state.html + + * html/FormController.cpp: + (WebCore::FormController::formElementsState): + If stateVector has only the signature string, clear it. + +2012-07-11 Mark Rowe <mrowe@apple.com> + + <http://webkit.org/b/91051> Fix the Qt Mac build after r122400. + + Qt on Mac builds with a deployment target of OS X 10.5. However, it was not been setting + BUILDING_ON_LEOPARD / TARGETING_LEOPARD and thus was falling down code paths in DisplaySleepDisabler.cpp + that were specific to Snow Leopard and newer. After the removal of BUILDING_ON_LEOPARD + and TARGETING_LEOPARD it ended up falling down the correct Leopard-compatible code path, + which revealed that the code made assumptions about which headers had already been included. + + * platform/mac/DisplaySleepDisabler.cpp: Include CoreServices/CoreServices.h to pull in + a declaration of UpdateSystemActivity when targeting Leopard. + +2012-07-11 Matt Falkenhagen <falken@chromium.org> + + Add dialog element feature toggle to InternalSettings + https://bugs.webkit.org/show_bug.cgi?id=90934 + + Reviewed by Hajime Morita. + + This enables layout tests to be written for dialog although the feature is disabled by default. + + Tests: fast/dom/HTMLDialogElement/dialog-disabled.html + fast/dom/HTMLDialogElement/dialog-enabled.html + + * WebCore.exp.in: Added newly exported symbol. + * testing/InternalSettings.cpp: + (WebCore::InternalSettings::Backup::Backup): Backup dialog feature flag. + (WebCore::InternalSettings::Backup::restoreTo): Restore dialog feature flag. + (WebCore::InternalSettings::setDialogElementEnabled): Added. + (WebCore): + * testing/InternalSettings.h: Added support for dialog. + (Backup): + (InternalSettings): + * testing/InternalSettings.idl: Added support for dialog. + +2012-07-11 Kent Tamura <tkent@chromium.org> + + Accessing width or height of a detached image input element causes crash + https://bugs.webkit.org/show_bug.cgi?id=90885 + + Reviewed by Kentaro Hara. + + Test: fast/forms/image/width-and-height-of-detached-input.html + + * html/ImageInputType.cpp: + (WebCore::ImageInputType::height): Add null check for m_imageLoader. + (WebCore::ImageInputType::width): ditto. + +2012-07-11 Kent Tamura <tkent@chromium.org> + + Do not save state of stateless form controls + https://bugs.webkit.org/show_bug.cgi?id=90964 + + Reviewed by Hajime Morita. + + By Bug 89409, we started to store unmodified form control + state. However we don't need to make such state for the following + types. + - password + - submit + - reset + - button + - keygen + + Test: fast/forms/state-restore-skip-stateless.html + + * html/BaseButtonInputType.cpp: + (WebCore::BaseButtonInputType::shouldSaveAndRestoreFormControlState): + Added. Disable saving state for submit, reset, and button types. + * html/BaseButtonInputType.h: + (BaseButtonInputType): Add shouldSaveAndRestoreFormControlState. + * html/HTMLFormControlElementWithState.h: + (HTMLFormControlElementWithState): Make shouldSaveAndRestoreFormControlState virtual. + * html/HTMLInputElement.cpp: + (WebCore::HTMLInputElement::shouldSaveAndRestoreFormControlState): + Added. Checks InputType::shouldSaveAndRestoreFormControlState first. + * html/HTMLInputElement.h: + (HTMLInputElement): Override shouldSaveAndRestoreFormControlState. + * html/HTMLKeygenElement.cpp: + (WebCore::HTMLKeygenElement::shouldSaveAndRestoreFormControlState) + Added. Disable saving state for <keygen>.: + * html/HTMLKeygenElement.h: Override shouldSaveAndRestoreFormControlState. + * html/InputType.cpp: + (WebCore::InputType::shouldSaveAndRestoreFormControlState): + Added. Enable saving state for all types by default. + * html/InputType.h: + (InputType): Add shouldSaveAndRestoreFormControlState. + * html/PasswordInputType.cpp: + (WebCore::PasswordInputType::shouldSaveAndRestoreFormControlState): + Added. Disabled saving state. + (WebCore::PasswordInputType::saveFormControlState): + Because shouldSaveAndRestoreFormControlState() returns false, + saveFormControlState should be never called. + * html/PasswordInputType.h: + (PasswordInputType): Override shouldSaveAndRestoreFormControlState. + +2012-07-11 No'am Rosenthal <noam.rosenthal@nokia.com> + + Compilation error with GLES2 when using gl2ext.h from ANGLE. + https://bugs.webkit.org/show_bug.cgi?id=91030 + + Reviewed by Kenneth Russell. + + gl2ext.h defines PFNGLRENDERBUFFERSTORAGEMULTISAMPLEIMG and not + PFNGLRENDERBUFFERSTORAGEMULTISAMPLEIMGPROC. This is a bug in the original Khronos header, + but we should work around it until fixed headers are integrated. + + + * platform/graphics/opengl/Extensions3DOpenGLES.h: + (Extensions3DOpenGLES): + Removed the "PROC" suffix to work around the header bug. + +2012-07-11 Mark Rowe <mrowe@apple.com> + + Attempt to fix the Chromium Mac build after r122400. + + * platform/text/cf/HyphenationCF.cpp: Ensure that Chromium only compiles the body of this file if + building for a new enough version of OS X. + +2012-07-11 Kent Tamura <tkent@chromium.org> + + [Mac] Sort project.pbxproj + + * WebCore.xcodeproj/project.pbxproj: Apply Tools/Scripts/sort-Xcode-project-file + +2012-07-11 Dan Bernstein <mitz@apple.com> + + When a table row height grows because of pagination, not all cells’ heights are adjusted + https://bugs.webkit.org/show_bug.cgi?id=91043 + + Reviewed by Sam Weinig. + + The fix for in bug <http://webkit.org/b/83595> in <http://trac.webkit.org/r113738> made table + rows grow as necessary to fit cells that grow as a result of pagination. But it had two bad + side effects: earlier cells on the row would not grow by the same amount, and later cells on + the row would factor the existing growth into their intrinsic padding. + + Test: fast/multicol/table-row-height-increase.html + + * rendering/RenderTableSection.cpp: + (WebCore::RenderTableSection::layoutRows): Now when a cell becomes taller than the row height, + the additional height needed is recorded, and the cell is shrunk back to row height. Then + after finishing the row, all cells occurring on the row (including cells spanning it but not + starting on it) are grown by the same amount. + +2012-07-11 Mark Rowe <mrowe@apple.com> + + <http://webkit.org/b/91024> Build against the latest SDK when targeting older OS X versions. + + Reviewed by Dan Bernstein. + + The deployment target is already set to the version that we're targeting, and it's that setting + which determines which functionality from the SDK is available to us. + + * Configurations/Base.xcconfig: + +2012-07-11 Mark Rowe <mrowe@apple.com> + + Switch a few cases that care about the SDK over to checking __MAC_OS_X_VERSION_MAX_ALLOWED so that things build. + + Part of <http://webkit.org/b/91015> Remove BUILDING_ON / TARGETING macros in favor of system availability macros + + Reviewed by Filip Pizlo. + + * platform/graphics/cg/GraphicsContextCG.cpp: The SDK we're building against determines whether the constant is available. + * platform/mac/EmptyProtocolDefinitions.h: The SDK we're building against determines whether the protocols are declared. + * platform/mac/NSScrollerImpDetails.h: The SDK we're building against determines whether the constants and method are + available. + * platform/mac/SharedTimerMac.mm: The SDK we're building against determines whether the function has already been declared. + +2012-07-11 Mark Rowe <mrowe@apple.com> + + <http://webkit.org/b/91015> Remove BUILDING_ON / TARGETING macros in favor of system availability macros + + This removal was handled by a script that translates the relevant macros in to the equivalent checks + using the system availability macros. + + Reviewed by Filip Pizlo. + + * WebCore.exp.in: + * accessibility/AccessibilityList.h: + * accessibility/AccessibilityTable.h: + * accessibility/mac/AXObjectCacheMac.mm: + * editing/mac/EditorMac.mm: + * loader/MainResourceLoader.cpp: + * loader/MainResourceLoader.h: + * page/AlternativeTextClient.h: + * page/ContextMenuController.cpp: + * page/mac/SettingsMac.mm: + * platform/LocalizedStrings.cpp: + * platform/MemoryPressureHandler.cpp: + * platform/audio/mac/AudioBusMac.mm: + * platform/graphics/Gradient.h: + * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: + * platform/graphics/ca/GraphicsLayerCA.cpp: + * platform/graphics/ca/PlatformCALayer.h: + * platform/graphics/ca/mac/PlatformCALayerMac.mm: + * platform/graphics/ca/mac/TileCache.mm: + * platform/graphics/cg/GraphicsContextCG.cpp: + * platform/graphics/cg/ImageBufferCG.cpp: + * platform/graphics/cg/ImageBufferDataCG.cpp: + * platform/graphics/cg/ImageBufferDataCG.h: + * platform/graphics/cg/ImageCG.cpp: + * platform/graphics/cg/ImageSourceCG.cpp: + * platform/graphics/cg/PathCG.cpp: + * platform/graphics/cocoa/FontPlatformDataCocoa.mm: + * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: + * platform/graphics/mac/ComplexTextController.cpp: + * platform/graphics/mac/ComplexTextControllerCoreText.mm: + * platform/graphics/mac/FontCacheMac.mm: + * platform/graphics/mac/FontCustomPlatformData.cpp: + * platform/graphics/mac/FontMac.mm: + * platform/graphics/mac/GraphicsContextMac.mm: + * platform/graphics/mac/MediaPlayerPrivateQTKit.mm: + * platform/graphics/mac/SimpleFontDataMac.mm: + * platform/graphics/mac/WebLayer.h: + * platform/graphics/mac/WebLayer.mm: + * platform/graphics/opengl/GraphicsContext3DOpenGL.cpp: + * platform/mac/CursorMac.mm: + * platform/mac/DisplaySleepDisabler.cpp: + * platform/mac/DisplaySleepDisabler.h: + * platform/mac/EmptyProtocolDefinitions.h: + * platform/mac/HTMLConverter.h: + * platform/mac/HTMLConverter.mm: + * platform/mac/MemoryPressureHandlerMac.mm: + * platform/mac/NSScrollerImpDetails.h: + * platform/mac/PlatformEventFactoryMac.mm: + * platform/mac/PopupMenuMac.mm: + * platform/mac/ScrollAnimatorMac.mm: + * platform/mac/ScrollElasticityController.mm: + * platform/mac/SharedTimerMac.mm: + * platform/mac/SuddenTermination.mm: + * platform/mac/WebCoreFullScreenWindow.mm: + * platform/mac/WebCoreNSCellExtras.h: + * platform/mac/WebCoreSystemInterface.h: + * platform/mac/WebCoreSystemInterface.mm: + * platform/mac/WebFontCache.mm: + * platform/mac/WebVideoFullscreenController.mm: + * platform/mac/WebVideoFullscreenHUDWindowController.mm: + * platform/network/Credential.h: + * platform/network/ResourceHandle.h: + * platform/network/cf/DNSCFNet.cpp: + * platform/network/cf/ProxyServerCFNet.cpp: + * platform/network/cf/ResourceRequest.h: + * platform/network/cf/ResourceRequestCFNet.cpp: + * platform/network/cf/SocketStreamHandleCFNet.cpp: + * platform/network/mac/AuthenticationMac.mm: + * platform/network/mac/CookieStorageMac.mm: + * platform/network/mac/ResourceHandleMac.mm: + * platform/network/mac/ResourceRequestMac.mm: + * platform/network/mac/WebCoreURLResponse.mm: + * platform/text/TextChecking.h: + * platform/text/cf/HyphenationCF.cpp: + * platform/text/mac/HyphenationMac.mm: + * rendering/RenderLayerBacking.cpp: + * rendering/RenderLayerCompositor.cpp: + * rendering/RenderThemeMac.mm: + +2012-07-11 Robert Kroeger <rjkroege@chromium.org> + + Suppress horizontal conversion of PlatformWheelEvents when hasPreciseScrollingDeltas is true + https://bugs.webkit.org/show_bug.cgi?id=89580 + + WebKit GTK and Chromium Linux force vertical wheel events to + scroll horizontally when over horizontal scroll bars. This is + undesirable for touchpad scrolling with + hasPreciseScrollingDeltas() == true. Modified shouldTurnVerticalTicksIntoHorizontal + to not perform this conversion for PlatformWheelEvents with preciseScrollingDeltas. + + Reviewed by Adam Barth. + + Tests: fast/events/touch/gesture/touch-gesture-scroll-sideways.html + + * page/EventHandler.cpp: + (WebCore::EventHandler::shouldTurnVerticalTicksIntoHorizontal): + (WebCore::EventHandler::handleWheelEvent): + * page/EventHandler.h: + (EventHandler): + * page/chromium/EventHandlerChromium.cpp: + (WebCore::EventHandler::shouldTurnVerticalTicksIntoHorizontal): + * page/gtk/EventHandlerGtk.cpp: + (WebCore::EventHandler::shouldTurnVerticalTicksIntoHorizontal): + +2012-07-11 Hayato Ito <hayato@chromium.org> + + Unreviewed gardening. + Build fix for r122373. + + * platform/chromium/support/WebCompositorSharedQuadState.cpp: + (WebKit::WebCompositorSharedQuadState::WebCompositorSharedQuadState): + +2012-07-11 Shinya Kawanaka <shinyak@chromium.org> + + SVGUseElement should not use Element::ensureShadowRoot(). + https://bugs.webkit.org/show_bug.cgi?id=90938 + + Reviewed by Hajime Morita. + + We would like to remove Element::ensureShadowRoot() because we would like to stabilize the lifecycle of Shadow DOM. + This patch rewrites SVGUseElement::create() not to use Element::ensureShadowRoot(). Since our convention to create + a shadow subtree is to create a method createShadowSubtree(), I obeyed it. + + No new tests. Simple refactoring. + + * svg/SVGUseElement.cpp: + (WebCore::SVGUseElement::create): + (WebCore::SVGUseElement::createShadowSubtree): + (WebCore): + * svg/SVGUseElement.h: + (SVGUseElement): + +2012-07-11 Alexandre Elias <aelias@google.com> + + [chromium] Move compositor quads to Platform/chromium/public + https://bugs.webkit.org/show_bug.cgi?id=90582 + + Reviewed by Adrienne Walker. + + This moves CCSharedQuadState, CCDrawQuad, and all but two CC*DrawQuad + classes to the WebKit namespace, as a first step to pushing them + across the process boundary for the ubercompositor. + + - The intent is to serialize the class hierarchy using the same + mechanism as WebInputEvent. In order to do this, there are three + requirements: pure POD data, a method returning size, and a packing + pragma. + + - Private data members are fine with this kind of serializer, and a + default constructor is not needed. Because of that, we can maintain + the same encapsulation and convenient APIs (behind + WEBKIT_IMPLEMENTATION) as the original classes. To ease the + transition, the original WebCore headers still exist and typedef to + the new classes. + + - However, SharedQuadState will be serialized using the normal + IPC_STRUCT_TRAITS macro, so I made its members public. A custom + serializer (on quad lists) will maintain the pointers from quads to + SharedQuadStates. + + - I converted the Material casting mechanism to materialCast() methods + living in the derived classes. That way, the WebCompositorQuad header + doesn't need to know about all its derived classes. + + - Quad classes not yet transitioned can still be used in + non-ubercompositor mode. CCRenderPassDrawQuad and CCYUVVideoDrawQuad + are currently non-POD and I left them in their original files. + + This approach is the best I've found so far, since it preserves all + WebCore-facing APIs and avoids unnecessary code duplication (new quad + types or members can be added by modifying only one place). There + also should not be an unreasonable amount of custom serializer code + required. + + No new tests. (No-op refactoring.) + + * WebCore.gypi: + * platform/chromium/support/WebCompositorQuad.cpp: Added. + (WebKit): + (WebKit::WebCompositorQuad::WebCompositorQuad): + (WebKit::WebCompositorQuad::opaqueRect): + (WebKit::WebCompositorQuad::setQuadVisibleRect): + (WebKit::WebCompositorQuad::size): + * platform/chromium/support/WebCompositorSharedQuadState.cpp: Renamed from Source/WebCore/platform/graphics/chromium/cc/CCSharedQuadState.cpp. + (WebKit): + (WebKit::WebCompositorSharedQuadState::WebCompositorSharedQuadState): + (WebKit::WebCompositorSharedQuadState::create): + (WebKit::WebCompositorSharedQuadState::isLayerAxisAlignedIntRect): + * platform/chromium/support/WebCompositorSolidColorQuad.cpp: Renamed from Source/WebCore/platform/graphics/chromium/cc/CCSolidColorDrawQuad.cpp. + (WebKit): + (WebKit::WebCompositorSolidColorQuad::create): + (WebKit::WebCompositorSolidColorQuad::WebCompositorSolidColorQuad): + (WebKit::WebCompositorSolidColorQuad::materialCast): + * platform/chromium/support/WebCompositorTextureQuad.cpp: Renamed from Source/WebCore/platform/graphics/chromium/cc/CCTextureDrawQuad.cpp. + (WebKit): + (WebKit::WebCompositorTextureQuad::create): + (WebKit::WebCompositorTextureQuad::WebCompositorTextureQuad): + (WebKit::WebCompositorTextureQuad::setNeedsBlending): + (WebKit::WebCompositorTextureQuad::materialCast): + * platform/graphics/chromium/LayerRendererChromium.cpp: + (WebCore::LayerRendererChromium::drawQuad): + * platform/graphics/chromium/LayerRendererChromium.h: + * platform/graphics/chromium/cc/CCCheckerboardDrawQuad.cpp: + (WebCore::CCCheckerboardDrawQuad::create): + (WebCore::CCCheckerboardDrawQuad::CCCheckerboardDrawQuad): + (WebCore::CCCheckerboardDrawQuad::materialCast): + (WebCore): + * platform/graphics/chromium/cc/CCCheckerboardDrawQuad.h: + (CCCheckerboardDrawQuad): + * platform/graphics/chromium/cc/CCDebugBorderDrawQuad.cpp: + (WebCore::CCDebugBorderDrawQuad::create): + (WebCore::CCDebugBorderDrawQuad::CCDebugBorderDrawQuad): + (WebCore::CCDebugBorderDrawQuad::materialCast): + (WebCore): + * platform/graphics/chromium/cc/CCDebugBorderDrawQuad.h: + (CCDebugBorderDrawQuad): + * platform/graphics/chromium/cc/CCDrawQuad.cpp: Removed. + * platform/graphics/chromium/cc/CCDrawQuad.h: + (WebCore): + * platform/graphics/chromium/cc/CCIOSurfaceDrawQuad.cpp: + (WebCore::CCIOSurfaceDrawQuad::create): + (WebCore::CCIOSurfaceDrawQuad::CCIOSurfaceDrawQuad): + (WebCore::CCIOSurfaceDrawQuad::materialCast): + (WebCore): + * platform/graphics/chromium/cc/CCIOSurfaceDrawQuad.h: + (CCIOSurfaceDrawQuad): + * platform/graphics/chromium/cc/CCLayerImpl.h: + (WebCore): + * platform/graphics/chromium/cc/CCRenderPass.h: + (WebCore): + * platform/graphics/chromium/cc/CCRenderPassDrawQuad.cpp: + (WebCore::CCRenderPassDrawQuad::create): + (WebCore::CCRenderPassDrawQuad::CCRenderPassDrawQuad): + (WebCore::CCRenderPassDrawQuad::materialCast): + (WebCore): + * platform/graphics/chromium/cc/CCRenderPassDrawQuad.h: + (CCRenderPassDrawQuad): + * platform/graphics/chromium/cc/CCRenderSurface.h: + (WebCore): + * platform/graphics/chromium/cc/CCSharedQuadState.h: + (WebCore): + * platform/graphics/chromium/cc/CCSolidColorDrawQuad.h: + (WebCore): + * platform/graphics/chromium/cc/CCStreamVideoDrawQuad.cpp: + (WebCore::CCStreamVideoDrawQuad::create): + (WebCore::CCStreamVideoDrawQuad::CCStreamVideoDrawQuad): + (WebCore::CCStreamVideoDrawQuad::materialCast): + (WebCore): + * platform/graphics/chromium/cc/CCStreamVideoDrawQuad.h: + (CCStreamVideoDrawQuad): + * platform/graphics/chromium/cc/CCTextureDrawQuad.h: + (WebCore): + * platform/graphics/chromium/cc/CCTileDrawQuad.cpp: + (WebCore::CCTileDrawQuad::create): + (WebCore::CCTileDrawQuad::CCTileDrawQuad): + (WebCore::CCTileDrawQuad::materialCast): + (WebCore): + * platform/graphics/chromium/cc/CCTileDrawQuad.h: + (CCTileDrawQuad): + * platform/graphics/chromium/cc/CCYUVVideoDrawQuad.cpp: + (WebCore::CCYUVVideoDrawQuad::create): + (WebCore::CCYUVVideoDrawQuad::CCYUVVideoDrawQuad): + (WebCore::CCYUVVideoDrawQuad::materialCast): + (WebCore): + * platform/graphics/chromium/cc/CCYUVVideoDrawQuad.h: + (CCYUVVideoDrawQuad): + +2012-07-11 Robert Kroeger <rjkroege@chromium.org> + + [chromium] [regression] Don't use ScrollByPrecisePixels on Chromium Mac. + https://bugs.webkit.org/show_bug.cgi?id=91020 + + Reviewed by Adam Barth. + + A change in https://bugs.webkit.org/show_bug.cgi?id=87535 to + improve the operation of smooth scrolling incorrectly caused + Chromium Mac to use the wrong scroll granularity on + hasPreciseScrollingDeltas() == true wheelevent scrolls. + Exclude the change on the Chromium Mac platform. + + * platform/ScrollAnimator.cpp: + (WebCore::ScrollAnimator::handleWheelEvent): Adjusted #ifdef to exclude Chromium + Mac from ScrollByPrecisePixels change. + +2012-07-11 Jia Pu <jpu@apple.com> + + On Mac, autocorrection sometimes fails to take place in Safari. + https://bugs.webkit.org/show_bug.cgi?id=89982 + + Reviewed by Ryosuke Niwa. + + We should check the value of shouldCheckForCorrection, not shouldShowCorrectionPanel, to determine if we should + early return in markAndReplaceFor(). Also, since we don't want autocorrection to happen when we only change selection, + not the content, so we shouldn't set TextCheckingTypeCorrection flag in markMisspellingsAndBadGrammar() as this function + is triggered only by selection change. + + * editing/Editor.cpp: + (WebCore::Editor::markAndReplaceFor): + (WebCore::Editor::markMisspellingsAndBadGrammar): + +2012-07-11 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r122361. + http://trac.webkit.org/changeset/122361 + https://bugs.webkit.org/show_bug.cgi?id=91027 + + Broke Windows build and fast/forms/state-restore-broken- + state.html (Requested by rniwa on #webkit). + + * testing/Internals.idl: + +2012-07-10 Simon Fraser <simon.fraser@apple.com> + + Assertion ASSERTION FAILED: enclosingIntRect(rendererMappedResult) == enclosingIntRect(FloatQuad(result).boundingBox()) when compositing in paginated mode + https://bugs.webkit.org/show_bug.cgi?id=90919 + + Reviewed by Antti Koivisto. + + r121124 added a fast path for geometry mapping that goes via layers + when possible. However, this broke paginated pages, which put + the root (RenderView) layer into column mode, because it failed + to check for columns on the ancestor layer. + + Rather than make a risky change to convertToLayerCoords(), add a local + function canMapViaLayer(), which is like RenderLayer::canUseConvertToLayerCoords(), + but doesn't check for compositing (compositing itself is not a reason + to avoid convertToLayerCoords). Call canMapViaLayer() with the ancestorLayer + to check whether the ancestor has columns, which fixes the bug. + + Test: compositing/columns/geometry-map-paginated-assert.html + + * rendering/RenderGeometryMap.cpp: + (WebCore::canMapViaLayer): + (WebCore::RenderGeometryMap::pushMappingsToAncestor): + +2012-07-11 Dana Jansens <danakj@chromium.org> + + [chromium] Rename layerRect to contentRect for rects that live in content space + https://bugs.webkit.org/show_bug.cgi?id=90843 + + Reviewed by Adrienne Walker. + + Dropped the layerTransform() from CCSharedQuadState, as nothing should be + using it to draw with. RenderPasses need a weird drawTransform right now + which was stored in layerTransform, so moved this to the RenderPass quad. + + No new tests. No change in behaviour. + + * platform/graphics/chromium/CanvasLayerTextureUpdater.cpp: + (WebCore::CanvasLayerTextureUpdater::paintContents): + * platform/graphics/chromium/ContentLayerChromium.cpp: + (WebCore::ContentLayerChromium::update): + (WebCore::ContentLayerChromium::needMoreUpdates): + * platform/graphics/chromium/ImageLayerChromium.cpp: + (WebCore::ImageLayerChromium::update): + * platform/graphics/chromium/LayerChromium.cpp: + (WebCore::LayerChromium::visibleContentOpaqueRegion): + * platform/graphics/chromium/LayerChromium.h: + (WebCore::LayerChromium::visibleContentRect): + (WebCore::LayerChromium::setVisibleContentRect): + (LayerChromium): + * platform/graphics/chromium/LayerRendererChromium.cpp: + (WebCore::LayerRendererChromium::drawRenderPassQuad): + (WebCore::LayerRendererChromium::drawTileQuad): + (WebCore::LayerRendererChromium::drawYUVVideoQuad): + (WebCore::LayerRendererChromium::drawStreamVideoQuad): + (WebCore::LayerRendererChromium::drawIOSurfaceQuad): + * platform/graphics/chromium/TiledLayerChromium.cpp: + (WebCore::TiledLayerChromium::updateBounds): + (WebCore::TiledLayerChromium::setNeedsDisplayRect): + (WebCore::TiledLayerChromium::invalidateContentRect): + (WebCore::TiledLayerChromium::updateTiles): + (WebCore::TiledLayerChromium::setTexturePriorities): + (WebCore::TiledLayerChromium::setTexturePrioritiesInRect): + (WebCore::TiledLayerChromium::visibleContentOpaqueRegion): + (WebCore::TiledLayerChromium::updateContentRect): + (WebCore::TiledLayerChromium::needsIdlePaint): + (WebCore::TiledLayerChromium::idlePaintRect): + * platform/graphics/chromium/TiledLayerChromium.h: + (TiledLayerChromium): + * platform/graphics/chromium/cc/CCDrawQuad.h: + (WebCore::CCDrawQuad::visibleContentRect): + * platform/graphics/chromium/cc/CCLayerImpl.cpp: + (WebCore::CCLayerImpl::createSharedQuadState): + (WebCore::CCLayerImpl::appendDebugBorderQuad): + (WebCore::CCLayerImpl::visibleContentOpaqueRegion): + * platform/graphics/chromium/cc/CCLayerImpl.h: + (WebCore::CCLayerImpl::visibleContentRect): + (WebCore::CCLayerImpl::setVisibleContentRect): + (CCLayerImpl): + * platform/graphics/chromium/cc/CCLayerTilingData.cpp: + (WebCore::CCLayerTilingData::contentRectToTileIndices): + (WebCore::CCLayerTilingData::opaqueRegionInContentRect): + (WebCore::CCLayerTilingData::setBounds): + * platform/graphics/chromium/cc/CCLayerTilingData.h: + (CCLayerTilingData): + * platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp: + (WebCore::calculateVisibleContentRect): + (WebCore::layerShouldBeSkipped): + (WebCore): + (WebCore::calculateVisibleAndScissorRectsInternal): + * platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp: + (WebCore::CCLayerTreeHostImpl::calculateRenderPasses): + * platform/graphics/chromium/cc/CCOcclusionTracker.cpp: + (WebCore::addOcclusionBehindLayer): + * platform/graphics/chromium/cc/CCRenderPassDrawQuad.cpp: + (WebCore::CCRenderPassDrawQuad::create): + (WebCore::CCRenderPassDrawQuad::CCRenderPassDrawQuad): + * platform/graphics/chromium/cc/CCRenderPassDrawQuad.h: + (CCRenderPassDrawQuad): + (WebCore::CCRenderPassDrawQuad::drawTransform): + * platform/graphics/chromium/cc/CCRenderSurface.cpp: + (WebCore::CCRenderSurface::createSharedQuadState): + (WebCore::CCRenderSurface::createReplicaSharedQuadState): + (WebCore::CCRenderSurface::appendQuads): + * platform/graphics/chromium/cc/CCSharedQuadState.cpp: + (WebCore::CCSharedQuadState::create): + (WebCore::CCSharedQuadState::CCSharedQuadState): + (WebCore::CCSharedQuadState::isLayerAxisAlignedIntRect): + * platform/graphics/chromium/cc/CCSharedQuadState.h: + (CCSharedQuadState): + (WebCore::CCSharedQuadState::visibleContentRect): + * platform/graphics/chromium/cc/CCTiledLayerImpl.cpp: + (WebCore::CCTiledLayerImpl::appendQuads): + (WebCore::CCTiledLayerImpl::visibleContentOpaqueRegion): + +2012-07-11 Chris Fleizach <cfleizach@apple.com> + + ARIA spinbutton role incorrectly mapped to ProgressIndicatorRole + https://bugs.webkit.org/show_bug.cgi?id=77298 + + Reviewed by Anders Carlsson. + + * accessibility/AccessibilityObject.cpp: + (WebCore::createARIARoleMap): + +2012-07-11 Huang Dongsung <luxtella@company100.net> + + BitmapImage::frameIsCompleteAtIndex() must return false if ImageDecoder is not initialized. + https://bugs.webkit.org/show_bug.cgi?id=90757 + + Reviewed by Simon Fraser. + + The current code fortunately has worked so far because only + BitmapImage::startAnimation calls frameIsCompleteAtIndex, and startAnimation + cannot call frameIsCompleteAtIndex if ImageDecoder is not yet initialized. + startAnimation returns at the first line becase shouldAnimate() always return + false in this case. + + if (m_frameTimer || !shouldAnimate() || frameCount() <= 1) + return; + + This change is needed because parallel image decoders call + BitmapImage::frameIsCompleteAtIndex in other places too. + + No new tests, manually tested whether the caller exists or not that + calls BitmapImage::frameIsCompleteAtIndex() before ImageDecoder is + initialized. + + * platform/graphics/BitmapImage.cpp: + (WebCore::BitmapImage::frameIsCompleteAtIndex): + +2012-07-11 Kevin Ollivier <kevino@theolliviers.com> + + [wx] Unreviewed build fix. Update code to use the new constant name. + + * platform/wx/PasteboardWx.cpp: + (WebCore::Pasteboard::documentFragment): + +2012-07-11 Kevin Ollivier <kevino@theolliviers.com> + + [wx] Unreviewed build fix. Ignore array and sequence types for attributes as well + as functions since the CPP bindings do not yet support them. + + * bindings/scripts/CodeGeneratorCPP.pm: + (SkipAttribute): + +2012-07-11 Kevin Ollivier <kevino@theolliviers.com> + + [wx] Unreviewed build fix. Use DOMStringList instead of DOMString[] for in / out type. + + * testing/Internals.idl: + +2012-07-11 Dana Jansens <danakj@chromium.org> + + [chromium] Minimum size used for occlusion tracking should be a setting on CCLayerTreeHost + https://bugs.webkit.org/show_bug.cgi?id=90993 + + Reviewed by Adrienne Walker. + + Move the default minimum size used for occlusion tracking from the + CCOcclusionTracker class into CCLayerTreeSettings. This value is then + used on both threads as the lower limit for any occlusion to be + remembered. + + This allows us to use (0, 0) as the minimum size for tests, allowing all + occlusion to be tracked. + + * platform/graphics/chromium/cc/CCLayerTreeHost.cpp: + (WebCore::CCLayerTreeHost::paintLayerContents): + * platform/graphics/chromium/cc/CCLayerTreeHost.h: + (WebCore::CCLayerTreeSettings::CCLayerTreeSettings): + (CCLayerTreeSettings): + * platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp: + (WebCore::CCLayerTreeHostImpl::calculateRenderPasses): + * platform/graphics/chromium/cc/CCOcclusionTracker.h: + +2012-07-11 Anders Carlsson <andersca@apple.com> + + Add -Wtautological-compare and -Wsign-compare warning flags + https://bugs.webkit.org/show_bug.cgi?id=90994 + + Reviewed by Mark Rowe. + + * Configurations/Base.xcconfig: + +2012-07-11 Dean Jackson <dino@apple.com> + + TileCache layers have wrong border debug color + https://bugs.webkit.org/show_bug.cgi?id=90922 + + Reviewed by Simon Fraser. + + Commit r122152 updated the layer hierarchy when a tile + cache is being used by the view. As part of that, GraphicsLayerClient::shouldUseTileCache() + was changed to return false in some situations (the idea was that it + should only be called from the createGraphicsLayer method). However + there were two other call points: one that sets the debug colors on + borders, the other was a call that keeps the document background in sync. + + Add a new method usingTileCache() that returns the current state. Also fix + a FIXME where the debug code always called into the client rather than + caching the value on the GraphicsLayer. + + Test: compositing/document-background-color.html + + * platform/graphics/GraphicsLayer.cpp: + (WebCore::GraphicsLayer::GraphicsLayer): + (WebCore::GraphicsLayer::updateDebugIndicators): check the local variable when + setting the debug colors. + * platform/graphics/GraphicsLayer.h: + (GraphicsLayer): new bool member variable m_usingTileCache. + * platform/graphics/GraphicsLayerClient.h: + (WebCore::GraphicsLayerClient::usingTileCache): new virtual method to query if + this client is actually using the tile cache. + * platform/graphics/ca/GraphicsLayerCA.cpp: + (WebCore::GraphicsLayerCA::GraphicsLayerCA): set the member variable m_usingTileCache + if the GraphicsLayerClient says we are. + * rendering/RenderLayerBacking.h: + (WebCore::RenderLayerBacking::usingTileCache): + * rendering/RenderLayerCompositor.cpp: + (WebCore::RenderLayerCompositor::documentBackgroundColorDidChange): call usingTileCache() + rather than shouldUseTileCache(), because the latter's value might not always reflect + the existence of a cache. + +2012-07-11 Ryosuke Niwa <rniwa@webkit.org> + + Clang build fix after r122345. + Also let XCode do its own thing. + + * WebCore.xcodeproj/project.pbxproj: + * html/HTMLCollection.cpp: + (WebCore::HTMLCollectionWithArrayStorage::item): + * html/HTMLCollection.h: + (HTMLCollectionWithArrayStorage): + * html/HTMLFormCollection.cpp: + (WebCore::HTMLFormCollection::itemInArrayAfter): + * html/HTMLFormCollection.h: + (HTMLFormCollection): + * html/HTMLPropertiesCollection.cpp: + (WebCore::HTMLPropertiesCollection::itemInArrayAfter): + * html/HTMLPropertiesCollection.h: + (HTMLPropertiesCollection): + +2012-07-11 Arnaud Renevier <a.renevier@sisa.samsung.com> + + [Gtk] allow building with css-filters + https://bugs.webkit.org/show_bug.cgi?id=90908 + + Reviewed by Eric Seidel. + + Add support for css-filters in Source/WebCore/GNUmakefile.am + configure.ac + + No functional change, so no new tests. + + * GNUmakefile.am: + +2012-07-10 Ryosuke Niwa <rniwa@webkit.org> + + HTMLFormCollection::item and HTMLPropertiesCollection::item should share code + https://bugs.webkit.org/show_bug.cgi?id=90932 + + Reviewed by Anders Carlsson. + + Merged HTMLFormCollection::item and HTMLPropertiesCollection::item as HTMLCollectionWithArrayStorage::item, + which can be merged into HTMLCollection::item in a follow up patch. + + Also moved the call to invalidateCacheIfNeeded into HTMLCollection::updateNameCache() as done in + HTMLPropertiesCollection. + + In addition, moved the early bail out for when the base element doesn't have itemscope attribute from individual + functions to updateRefElements so that HTMLCollectionWithArrayStorage::item doesn't need to have this check. + + * html/HTMLCollection.cpp: + (WebCore::HTMLCollectionWithArrayStorage::item): Added. It's based on HTMLPropertiesCollection::item but it only + has the single loop (as supposed to nested loops) as HTMLFormCollection doesn't have multiple items per element + in the array unlike HTMLPropertiesCollection. In addition, offsetInArray (was i in HTMLPropertiesCollection::item) is + incremented in each itemAfter due to this semantic difference in each itemAfter. + (WebCore::HTMLCollection::updateNameCache): + (WebCore::HTMLCollection::hasNamedItem): + (WebCore::HTMLCollection::namedItems): + * html/HTMLCollection.h: + (HTMLCollectionWithArrayStorage): + (WebCore::HTMLCollectionWithArrayStorage::HTMLCollectionWithArrayStorage): + * html/HTMLFormCollection.cpp: + (WebCore::HTMLFormCollection::HTMLFormCollection): + (WebCore::HTMLFormCollection::calcLength): Merged numberOfFormControlElements since it was only called here. + (WebCore::HTMLFormCollection::itemAfter): Added. HTMLFormCollection has exactly one item per element in the array + so we increment the offset in each iteration. Note that when we're continuing a search, we need to increment + the offset in order to avoid returning the same item. + (WebCore::HTMLFormCollection::updateNameCache): + * html/HTMLFormCollection.h: + (HTMLFormCollection): + * html/HTMLPropertiesCollection.cpp: + (WebCore::HTMLPropertiesCollection::HTMLPropertiesCollection): + (WebCore::HTMLPropertiesCollection::updateRefElements): Set m_hasItemRefElements true upfront since we never fail to + update ref elements. Bail out as soon as we cleared the m_itemRefElements when the base element doesn't have itemscope + content attribute. + (WebCore::HTMLPropertiesCollection::itemAfter): Added. We reset previousItem to null because the existing itemAfter + requires previousItem be null when we're moving to a new entry in m_itemRefElements. + (WebCore::HTMLPropertiesCollection::calcLength): + (WebCore::HTMLPropertiesCollection::cacheFirstItem): + (WebCore::HTMLPropertiesCollection::updateNameCache): Merged findProperties since this was the only caller. + (WebCore::HTMLPropertiesCollection::names): + (WebCore::HTMLPropertiesCollection::namedItem): + (WebCore::HTMLPropertiesCollection::hasNamedItem): + * html/HTMLPropertiesCollection.h: + (HTMLPropertiesCollection): Made updateRefElements public as it's called in HTMLCollectionWithArrayStorage::item. + +2012-07-11 Sami Kyostila <skyostil@chromium.org> + + RenderView layer is marked as fixed position container in the scrolling tree if page scale != 1 + https://bugs.webkit.org/show_bug.cgi?id=89216 + + Reviewed by Simon Fraser. + + Render layers with CSS transforms should become containers for any fixed + positioned descendants. However, because this check is done with + RenderLayer::hasTransform(), we also end up marking the RenderLayer for the + RenderView as fixed position container if a non-identity page scale factor is + used. This is because page scale is applied as a transform for that layer. + + This breaks fixed position layers, because they become fixed relative to the + RenderView layer instead of outer scroll clip layer. + + The fix is to avoid marking any root layers as fixed position containers. + + No new test because the scrolling tree isn't currently testable. + + * rendering/RenderLayerBacking.cpp: + (WebCore::RenderLayerBacking::updateGraphicsLayerGeometry): + +2012-07-11 Julien Chaffraix <jchaffraix@webkit.org> + + REGRESSION (r116203): overflow sections don't have scrollbars + https://bugs.webkit.org/show_bug.cgi?id=90052 + + Reviewed by Simon Fraser. + + This issue stems from RenderLayers with overlay scrollbars not being considered + self-painting. + + After r120395 (follow-up of r116203), we ignore subtrees that have no self-painting layer for + painting. Normal scrollbars are painted by their renderer so they were properly painted. However + overlay scrollbars need to be painted by their RenderLayer as a separate phase (see bug 57057) so + they were not painted anymore. The fix is simple: make RenderLayer with overlay scrollbars + self-painting as they should have been in the first place. + + Unfortunately no tests as I don't think we have a good way of testing overlay + scrollbars. Tested manually though on the super simple test case from the bug. + + * rendering/RenderLayer.cpp: + (WebCore::RenderLayer::shouldBeSelfPaintingLayer): + Overlay scrollbars make the layer self-painting. + + (WebCore::RenderLayer::updateScrollbarsAfterLayout): + Added a call to updateSelfPaintingLayer. + + (WebCore::RenderLayer::styleChanged): + Moved the call to updateSelfPaintingLayer after recomputing the scrollbars to ensure proper behavior. + Added a comment underlining the reason. + + (WebCore::RenderLayer::updateSelfPaintingLayer): + Renamed as it is now called during layout too. + + * rendering/RenderLayer.h: + (RenderLayer): Updated after updateSelfPaintingLayer rename. + +2012-07-11 Allan Sandfeld Jensen <allan.jensen@nokia.com> + + NodesFromRect doesn't work on SVG root elements. + https://bugs.webkit.org/show_bug.cgi?id=89990 + + Reviewed by Antonio Gomes. + + Adds support for rect-based hit-testing on the SVG root element. + This means that while rect-based hit-testing is still not supported + within SVG elements, that at least it works on SVG root elements as + it would on any other replaced element. + + Test: fast/dom/nodesFromRect-svg.html + + * rendering/svg/RenderSVGRoot.cpp: + (WebCore::RenderSVGRoot::nodeAtPoint): + +2012-07-11 Joshua Netterfield <jnetterfield@rim.com> + + [Qt] REGRESSION(r122250): It broke USE(3D_GRAPHICS)=1 and ENABLE(WEBGL)=0 builds + https://bugs.webkit.org/show_bug.cgi?id=90943 + + Reviewed by Csaba Osztrogonác. + + Uses proper guarding in Extensions3DOpenGLCommon and Extensions3DOpenGLES as per https://bugs.webkit.org/show_bug.cgi?id=90506. + + No new tests, becasue there is no new functionality. + + * platform/graphics/opengl/Extensions3DOpenGLCommon.cpp: Use proper guarding. + * platform/graphics/opengl/Extensions3DOpenGLES.cpp: Use proper guarding. + +2012-07-10 Pavel Feldman <pfeldman@chromium.org> + + Web Inspector: migrate from background images to CSS for statusbar rendering. + https://bugs.webkit.org/show_bug.cgi?id=90902 + + Reviewed by Vsevolod Vlasov. + + This change removes statusbar* images and uses gradients and borders to re-create original inspector look. + + * WebCore.gypi: + * inspector/front-end/Images/statusbarBackground.png: Removed. + * inspector/front-end/Images/statusbarBottomBackground.png: Removed. + * inspector/front-end/Images/statusbarButtons.png: Removed. + * inspector/front-end/Images/statusbarMenuButton.png: Removed. + * inspector/front-end/Images/statusbarMenuButtonSelected.png: Removed. + * inspector/front-end/StatusBarButton.js: + * inspector/front-end/WebKit.qrc: + * inspector/front-end/inspector.css: + (body.drawer-visible #main-status-bar): + (body.drawer-visible #main-status-bar::after): + (.status-bar-background): + (.status-bar > div): + (.glyph): + (button.status-bar-item): + (.status-bar button.status-bar-item:active): + (select.status-bar-item): + (select.status-bar-item, select.status-bar-item:hover): + (body.detached .alternate-status-bar-buttons-bar): + (.alternate-status-bar-buttons-bar): + (.alternate-status-bar-buttons-bar .status-bar-item): + (.alternate-status-bar-buttons-bar .status-bar-item.emulate-active): + (#drawer): + (body.drawer-visible #drawer-contents): + (#drawer-status-bar): + * inspector/front-end/inspector.html: + * inspector/front-end/scriptsPanel.css: + (button.status-bar-item.scripts-navigator-show-hide-button): + (button.status-bar-item.scripts-navigator-show-hide-button:active): + (button.status-bar-item.scripts-debugger-show-hide-button): + (button.status-bar-item.scripts-debugger-show-hide-button:active): + +2012-07-11 Jason Liu <jason.liu@torchmobile.com.cn> + + [BlackBerry] crash in CookieDatabaseBackingStore. + https://bugs.webkit.org/show_bug.cgi?id=90270 + + Reviewed by George Staikos. + + There is one case for this crash. + 1. A browser crashes and locks cookies' database for a while. + 2. Open a new browser when the old one doesn't finish crashing. + 3. The new one writes the cookies' database and receives a SQLITE_BUSY error + in CookieDatabaseBackingStore's invokeOpen. So this database isn't opened. + 4. invokeGetCookiesWithLimit returns 0. + 5. Crash happens when using a null pointer. + + Add function setBusyTimeout(1000) and a guard for cookies' pointer. + setBusyTimeout will call sqlite3_busy_timeout. + + When the SQLite database is accessed for reading it is locked for writing + until the reading access is finished. Another process cannot access the database + while it is locked. The timeout time sets a limit while this process tries to access + the locked database. If the database is unlocked within the timeout time it can be + accessed, otherwise an access fails. + + No new tests. This crash is hard to reproduce, and it happens only on our platform. + + * platform/blackberry/CookieDatabaseBackingStore/CookieDatabaseBackingStore.cpp: + (WebCore::CookieDatabaseBackingStore::getCookiesFromDatabase): + +2012-07-11 Vsevolod Vlasov <vsevik@chromium.org> + + Web Inspector: Move revisions support to UISourceCode. + https://bugs.webkit.org/show_bug.cgi?id=90888 + + Reviewed by Pavel Feldman. + + Moved revisions support to UISourceCode. + Revision management code is moved unchanged where possible and should be refactored later. + + * inspector/front-end/CSSStyleModel.js: + (WebInspector.CSSStyleModelResourceBinding.prototype._innerStyleSheetChanged): revision is now added to uiSourceCode, not resource. + * inspector/front-end/ExtensionServer.js: + (WebInspector.ExtensionServer.prototype._notifyUISourceCodeContentCommitted): + Extension server is now listening for Workspace.UISourceCodeContentCommitted event instead of ResourceTreeModel.ResourceContentCommitted. + * inspector/front-end/Resource.js: + * inspector/front-end/ResourceTreeModel.js: ResourceTreeModel.ResourceContentCommitted renamed to Workspace.UISourceCodeContentCommitted. + * inspector/front-end/ResourceView.js: + (WebInspector.ResourceSourceFrame): ResourceSourceFrame is not update when revisions are added anymore as resource conenten is considered immutable now + * inspector/front-end/RevisionHistoryView.js: + (WebInspector.RevisionHistoryView.populateRevisions): + (WebInspector.RevisionHistoryView): + (WebInspector.RevisionHistoryView.showHistory): + (WebInspector.RevisionHistoryView.prototype._createUISourceCodeItem): + (WebInspector.RevisionHistoryView.prototype._revisionAdded.get if): + (WebInspector.RevisionHistoryView.prototype._revisionAdded): + (WebInspector.RevisionHistoryView.prototype._revealUISourceCode.get if): + (WebInspector.RevisionHistoryView.prototype._revealUISourceCode): + (WebInspector.RevisionHistoryView.prototype._reset): + * inspector/front-end/ScriptSnippetModel.js: Snippets are not loaded before ResourceTreeModel.mainFrame is available anymore. + (WebInspector.ScriptSnippetModel): + (WebInspector.ScriptSnippetModel.prototype._setScriptSnippetContent): + * inspector/front-end/UISourceCode.js: + (WebInspector.UISourceCode): + (WebInspector.UISourceCode.prototype.requestOriginalContent): + (WebInspector.UISourceCode.prototype._setContent): + (WebInspector.UISourceCode.prototype.addRevision): + (WebInspector.UISourceCode.prototype._restoreRevisionHistory): + (WebInspector.UISourceCode.prototype._clearRevisionHistory): + (WebInspector.UISourceCode.prototype.revertToOriginal): + (WebInspector.UISourceCode.prototype.revertAndClearHistory): + (WebInspector.UISourceCode.prototype.revertAndClearHistory.clearHistory): + (WebInspector.UISourceCode.prototype.commitWorkingCopy): + (WebInspector.UISourceCode.prototype.canonicalMimeType): + (WebInspector.Revision): + (WebInspector.Revision._revisionHistoryRegistry): + (WebInspector.Revision._ensureStaleRevisionsFileteredOut.persist): + (WebInspector.Revision._ensureStaleRevisionsFileteredOut): + (WebInspector.Revision.prototype.get uiSourceCode): + (WebInspector.Revision.prototype.get timestamp): + (WebInspector.Revision.prototype.get content): + (WebInspector.Revision.prototype.revertToThis): + (WebInspector.Revision.prototype.contentURL): + (WebInspector.Revision.prototype.contentType): + (WebInspector.Revision.prototype.requestContent): + (WebInspector.Revision.prototype.searchInContent): + (WebInspector.Revision.prototype._persist): + * inspector/front-end/UserAgentSupport.js: Drive-by closure compilation fix. + * inspector/front-end/Workspace.js: + * inspector/front-end/inspector.js: ScriptSnippetModel is now created after ResourceTreeModel. + +2012-07-11 MORITA Hajime <morrita@google.com> + + WebCoreSupport needs objects each of which follows major WebCore objects + https://bugs.webkit.org/show_bug.cgi?id=88499 + + Reviewed by Alexey Proskuryakov. + + This change + + - Makes Internals rough lifetime to follow Document. + Note that Internals can survive longer than Document in same case. + Internals::m_document is cleared when the document destruction is notified. + - Makes InternalSettings rough lifetime to follow the Page. + This is done by making InternalSettings a supplement of the page. + Now InternalSettings object is created per Page instead of per Frame. + + Per-test setting clearance is done by newly introduced InternalSettings::Backup, + which recovers the modified settings and refreshes it for each time a test starts. + + * WebCore.exp.in: + * testing/InternalSettings.cpp: + (WebCore::InternalSettings::Backup::Backup): + (WebCore): + (WebCore::InternalSettings::Backup::restoreTo): + (WebCore::InternalSettings::from): + (WebCore::InternalSettings::~InternalSettings): + (WebCore::InternalSettings::InternalSettings): + (WebCore::InternalSettings::reset): + (WebCore::InternalSettings::settings): + (WebCore::InternalSettings::setFixedElementsLayoutRelativeToFrame): + (WebCore::InternalSettings::setFixedPositionCreatesStackingContext): + (WebCore::InternalSettings::allowRoundingHacks): + (WebCore::InternalSettings::userPreferredLanguages): + (WebCore::InternalSettings::setUserPreferredLanguages): + (WebCore::InternalSettings::setShouldDisplayTrackKind): + (WebCore::InternalSettings::shouldDisplayTrackKind): + (WebCore::InternalSettings::setPagination): + * testing/InternalSettings.h: + (Backup): + (InternalSettings): + (WebCore::InternalSettings::page): + * testing/InternalSettings.idl: + * testing/Internals.cpp: + (WebCore::Internals::Internals): + (WebCore): + (WebCore::Internals::contextDocument): + (WebCore::Internals::frame): + (WebCore::Internals::settings): + (WebCore::Internals::setPagination): Replaced as an alias. + (WebCore::Internals::userPreferredLanguages): Replaced as an alias. + (WebCore::Internals::setUserPreferredLanguages): Replaced as an alias. + (WebCore::Internals::setShouldDisplayTrackKind): Replaced as an alias. + (WebCore::Internals::shouldDisplayTrackKind): Replaced as an alias. + (WebCore::Internals::emitInspectorDidBeginFrame): + (WebCore::Internals::emitInspectorDidCancelFrame): + (WebCore::Internals::allowRoundingHacks): Replaced as an alias. + * testing/Internals.h: + (WebCore): + (Internals): + * testing/js/WebCoreTestSupport.cpp: + (WebCoreTestSupport::injectInternalsObject): + (WebCoreTestSupport::resetInternalsObject): + * testing/v8/WebCoreTestSupport.cpp: + (WebCoreTestSupport::injectInternalsObject): + (WebCoreTestSupport::resetInternalsObject): + 2012-07-11 Yoshifumi Inoue <yosin@chromium.org> [Mac] Expose time format related functions diff --git a/Source/WebCore/Configurations/Base.xcconfig b/Source/WebCore/Configurations/Base.xcconfig index 5fd5eb748..b82dde170 100644 --- a/Source/WebCore/Configurations/Base.xcconfig +++ b/Source/WebCore/Configurations/Base.xcconfig @@ -24,7 +24,7 @@ #include "CompilerVersion.xcconfig" COMPILER_SPECIFIC_WARNING_CFLAGS = $(COMPILER_SPECIFIC_WARNING_CFLAGS_$(TARGET_GCC_VERSION)); -COMPILER_SPECIFIC_WARNING_CFLAGS_LLVM_COMPILER = -Wglobal-constructors -Wexit-time-destructors; +COMPILER_SPECIFIC_WARNING_CFLAGS_LLVM_COMPILER = -Wexit-time-destructors -Wglobal-constructors -Wtautological-compare; CLANG_WARN_CXX0X_EXTENSIONS = NO; DEBUG_INFORMATION_FORMAT = dwarf-with-dsym; @@ -51,6 +51,7 @@ GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = NO; GCC_WARN_ABOUT_MISSING_NEWLINE = YES; GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES; +GCC_WARN_SIGN_COMPARE = YES; LINKER_DISPLAYS_MANGLED_NAMES = YES; PREBINDING = NO; VALID_ARCHS = $(VALID_ARCHS_$(REAL_PLATFORM_NAME)); @@ -124,15 +125,12 @@ GCC_GENERATE_DEBUGGING_SYMBOLS_macosx_1070 = YES; GCC_GENERATE_DEBUGGING_SYMBOLS_macosx_1080 = YES; GCC_GENERATE_DEBUGGING_SYMBOLS_macosx_1090 = YES; -// If the target Mac OS X version does not match the current Mac OS X version then we'll want to build using the target version's SDK. -SDKROOT = $(SDKROOT_$(MAC_OS_X_VERSION_MAJOR)_$(TARGET_MAC_OS_X_VERSION_MAJOR)); -SDKROOT_1060_1050 = macosx10.5; -SDKROOT_1070_1050 = macosx10.5; -SDKROOT_1080_1050 = macosx10.5; -SDKROOT_1090_1050 = macosx10.5; -SDKROOT_1070_1060 = macosx10.6; -SDKROOT_1080_1060 = macosx10.6; -SDKROOT_1090_1060 = macosx10.6; -SDKROOT_1080_1070 = macosx10.7; -SDKROOT_1090_1070 = macosx10.7; -SDKROOT_1090_1080 = macosx10.8; +TARGETING_SAME_OS_X_VERSION = $(TARGETING_SAME_OS_X_VERSION_$(MAC_OS_X_VERSION_MAJOR)_$(TARGET_MAC_OS_X_VERSION_MAJOR)); +TARGETING_SAME_OS_X_VERSION_1060_1060 = YES; +TARGETING_SAME_OS_X_VERSION_1070_1070 = YES; +TARGETING_SAME_OS_X_VERSION_1080_1080 = YES; +TARGETING_SAME_OS_X_VERSION_1090_1090 = YES; + +// Don't build against an SDK unless we're targeting an older OS version. +SDKROOT = $(SDKROOT_TARGETING_SAME_OS_X_VERSION_$(TARGETING_SAME_OS_X_VERSION)); +SDKROOT_TARGETING_SAME_OS_X_VERSION_ = macosx; diff --git a/Source/WebCore/English.lproj/localizedStrings.js b/Source/WebCore/English.lproj/localizedStrings.js index 158c88c90..6ab4bc3da 100644 --- a/Source/WebCore/English.lproj/localizedStrings.js +++ b/Source/WebCore/English.lproj/localizedStrings.js @@ -719,4 +719,4 @@ localizedStrings["CPU Time"] = "CPU Time"; localizedStrings["Encoded Data Length"] = "Encoded Data Length"; localizedStrings["%d Bytes"] = "%d Bytes"; localizedStrings["Time End"] = "Time End"; -localizedStrings["Search:"] = "Search:"; +localizedStrings["Find"] = "Find"; diff --git a/Source/WebCore/GNUmakefile.am b/Source/WebCore/GNUmakefile.am index b825f0b7a..18465f9f1 100644 --- a/Source/WebCore/GNUmakefile.am +++ b/Source/WebCore/GNUmakefile.am @@ -17,6 +17,7 @@ webcore_cppflags += \ -I$(srcdir)/Source/WebCore/Modules/indexeddb \ -I$(srcdir)/Source/WebCore/Modules/mediastream \ -I$(srcdir)/Source/WebCore/Modules/notifications \ + -I$(srcdir)/Source/WebCore/Modules/protocolhandler \ -I$(srcdir)/Source/WebCore/Modules/webaudio \ -I$(srcdir)/Source/WebCore/Modules/webdatabase \ -I$(srcdir)/Source/WebCore/Modules/websockets \ @@ -487,6 +488,15 @@ webcore_cppflags += -DENABLE_CSS_REGIONS=1 endif # END ENABLE_CSS_REGIONS # ---- +# Filters +# ---- +if ENABLE_CSS_FILTERS +FEATURE_DEFINES += ENABLE_CSS_FILTERS=1 +webcore_cppflags += -DENABLE_CSS_FILTERS=1 + +endif # END ENABLE_CSS_FILTERS + +# ---- # Exclusions # ---- if ENABLE_CSS_EXCLUSIONS diff --git a/Source/WebCore/GNUmakefile.list.am b/Source/WebCore/GNUmakefile.list.am index 3781727aa..c79f8db82 100644 --- a/Source/WebCore/GNUmakefile.list.am +++ b/Source/WebCore/GNUmakefile.list.am @@ -713,6 +713,7 @@ dom_binding_idls += \ $(WebCore)/Modules/notifications/Notification.idl \ $(WebCore)/Modules/notifications/NotificationCenter.idl \ $(WebCore)/Modules/notifications/NotificationPermissionCallback.idl \ + $(WebCore)/Modules/protocolhandler/NavigatorRegisterProtocolHandler.idl \ $(WebCore)/Modules/webaudio/AudioContext.idl \ $(WebCore)/Modules/webaudio/AudioPannerNode.idl \ $(WebCore)/Modules/webaudio/DynamicsCompressorNode.idl \ @@ -1206,6 +1207,8 @@ webcore_modules_sources += \ Source/WebCore/Modules/notifications/NotificationPermissionCallback.h \ Source/WebCore/Modules/notifications/WorkerContextNotifications.cpp \ Source/WebCore/Modules/notifications/WorkerContextNotifications.h \ + Source/WebCore/Modules/protocolhandler/NavigatorRegisterProtocolHandler.cpp \ + Source/WebCore/Modules/protocolhandler/NavigatorRegisterProtocolHandler.h \ Source/WebCore/Modules/webdatabase/AbstractDatabase.cpp \ Source/WebCore/Modules/webdatabase/AbstractDatabase.h \ Source/WebCore/Modules/webdatabase/ChangeVersionWrapper.cpp \ @@ -1939,6 +1942,10 @@ webcore_sources += \ Source/WebCore/dom/GenericEventQueue.h \ Source/WebCore/dom/IconURL.cpp \ Source/WebCore/dom/IconURL.h \ + Source/WebCore/dom/IdTargetObserver.cpp \ + Source/WebCore/dom/IdTargetObserver.h \ + Source/WebCore/dom/IdTargetObserverRegistry.cpp \ + Source/WebCore/dom/IdTargetObserverRegistry.h \ Source/WebCore/dom/HashChangeEvent.h \ Source/WebCore/dom/KeyboardEvent.cpp \ Source/WebCore/dom/KeyboardEvent.h \ @@ -2074,6 +2081,8 @@ webcore_sources += \ Source/WebCore/dom/WebKitAnimationEvent.h \ Source/WebCore/dom/WebKitNamedFlow.cpp \ Source/WebCore/dom/WebKitNamedFlow.h \ + Source/WebCore/dom/WebKitNamedFlowCollection.cpp \ + Source/WebCore/dom/WebKitNamedFlowCollection.h \ Source/WebCore/dom/WebKitTransitionEvent.cpp \ Source/WebCore/dom/WebKitTransitionEvent.h \ Source/WebCore/dom/WheelEvent.cpp \ @@ -3045,8 +3054,6 @@ webcore_sources += \ Source/WebCore/page/Navigator.h \ Source/WebCore/page/NavigatorBase.cpp \ Source/WebCore/page/NavigatorBase.h \ - Source/WebCore/page/NavigatorRegisterProtocolHandler.cpp \ - Source/WebCore/page/NavigatorRegisterProtocolHandler.h \ Source/WebCore/page/OriginAccessEntry.cpp \ Source/WebCore/page/OriginAccessEntry.h \ Source/WebCore/page/Page.cpp \ @@ -3285,6 +3292,7 @@ webcore_sources += \ Source/WebCore/platform/graphics/filters/SpotLightSource.cpp \ Source/WebCore/platform/graphics/filters/SpotLightSource.h \ Source/WebCore/platform/graphics/filters/arm/NEONHelpers.h \ + Source/WebCore/platform/graphics/filters/arm/FEBlendNEON.h \ Source/WebCore/platform/graphics/filters/arm/FECompositeArithmeticNEON.h \ Source/WebCore/platform/graphics/filters/arm/FEGaussianBlurNEON.h \ Source/WebCore/platform/graphics/filters/arm/FELightingNEON.cpp \ @@ -3680,8 +3688,6 @@ webcore_sources += \ Source/WebCore/platform/SuddenTermination.h \ Source/WebCore/platform/Supplementable.h \ Source/WebCore/platform/SystemTime.h \ - Source/WebCore/platform/text/Base64.cpp \ - Source/WebCore/platform/text/Base64.h \ Source/WebCore/platform/text/BidiContext.cpp \ Source/WebCore/platform/text/BidiContext.h \ Source/WebCore/platform/text/BidiResolver.h \ @@ -6121,10 +6127,10 @@ webcore_sources += \ Source/WebCore/platform/graphics/texmap/TextureMapperShaderManager.h \ Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.cpp \ Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.h \ - Source/WebCore/platform/graphics/texmap/LayerTransform.cpp \ - Source/WebCore/platform/graphics/texmap/LayerTransform.h \ - Source/WebCore/platform/graphics/texmap/TextureMapperAnimation.cpp \ - Source/WebCore/platform/graphics/texmap/TextureMapperAnimation.h \ + Source/WebCore/platform/graphics/GraphicsLayerTransform.cpp \ + Source/WebCore/platform/graphics/GraphicsLayerTransform.h \ + Source/WebCore/platform/graphics/GraphicsLayerAnimation.cpp \ + Source/WebCore/platform/graphics/GraphicsLayerAnimation.h \ Source/WebCore/platform/graphics/texmap/TextureMapperBackingStore.cpp \ Source/WebCore/platform/graphics/texmap/TextureMapperBackingStore.h \ Source/WebCore/platform/graphics/texmap/TextureMapper.cpp \ @@ -6144,10 +6150,10 @@ webcore_sources += \ Source/WebCore/platform/graphics/texmap/TextureMapperShaderManager.h \ Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.cpp \ Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.h \ - Source/WebCore/platform/graphics/texmap/LayerTransform.cpp \ - Source/WebCore/platform/graphics/texmap/LayerTransform.h \ - Source/WebCore/platform/graphics/texmap/TextureMapperAnimation.cpp \ - Source/WebCore/platform/graphics/texmap/TextureMapperAnimation.h \ + Source/WebCore/platform/graphics/GraphicsLayerTransform.cpp \ + Source/WebCore/platform/graphics/GraphicsLayerTransform.h \ + Source/WebCore/platform/graphics/GraphicsLayerAnimation.cpp \ + Source/WebCore/platform/graphics/GraphicsLayerAnimation.h \ Source/WebCore/platform/graphics/texmap/TextureMapperBackingStore.cpp \ Source/WebCore/platform/graphics/texmap/TextureMapperBackingStore.h \ Source/WebCore/platform/graphics/texmap/TextureMapper.cpp \ diff --git a/Source/WebCore/Modules/filesystem/DataTransferItemFileSystem.h b/Source/WebCore/Modules/filesystem/DataTransferItemFileSystem.h index a79361caa..91e8c0583 100644 --- a/Source/WebCore/Modules/filesystem/DataTransferItemFileSystem.h +++ b/Source/WebCore/Modules/filesystem/DataTransferItemFileSystem.h @@ -43,7 +43,7 @@ class ScriptExecutionContext; class DataTransferItemFileSystem { public: - static PassRefPtr<Entry> webkitGetAsEntry(DataTransferItem*, ScriptExecutionContext*); + static PassRefPtr<Entry> webkitGetAsEntry(ScriptExecutionContext*, DataTransferItem*); private: DataTransferItemFileSystem(); diff --git a/Source/WebCore/Modules/filesystem/HTMLInputElementFileSystem.cpp b/Source/WebCore/Modules/filesystem/HTMLInputElementFileSystem.cpp index bbdfb71c2..c0ed985df 100644 --- a/Source/WebCore/Modules/filesystem/HTMLInputElementFileSystem.cpp +++ b/Source/WebCore/Modules/filesystem/HTMLInputElementFileSystem.cpp @@ -46,7 +46,7 @@ namespace WebCore { // static -PassRefPtr<EntryArray> HTMLInputElementFileSystem::webkitEntries(HTMLInputElement* input, ScriptExecutionContext* scriptExecutionContext) +PassRefPtr<EntryArray> HTMLInputElementFileSystem::webkitEntries(ScriptExecutionContext* scriptExecutionContext, HTMLInputElement* input) { RefPtr<EntryArray> array = EntryArray::create(); diff --git a/Source/WebCore/Modules/filesystem/HTMLInputElementFileSystem.h b/Source/WebCore/Modules/filesystem/HTMLInputElementFileSystem.h index 01a8bdb3b..ae8bf8912 100644 --- a/Source/WebCore/Modules/filesystem/HTMLInputElementFileSystem.h +++ b/Source/WebCore/Modules/filesystem/HTMLInputElementFileSystem.h @@ -41,7 +41,7 @@ class ScriptExecutionContext; class HTMLInputElementFileSystem { public: - static PassRefPtr<EntryArray> webkitEntries(HTMLInputElement*, ScriptExecutionContext*); + static PassRefPtr<EntryArray> webkitEntries(ScriptExecutionContext*, HTMLInputElement*); private: HTMLInputElementFileSystem(); diff --git a/Source/WebCore/Modules/filesystem/chromium/DataTransferItemFileSystemChromium.cpp b/Source/WebCore/Modules/filesystem/chromium/DataTransferItemFileSystemChromium.cpp index bd223a61a..7c32fef2e 100644 --- a/Source/WebCore/Modules/filesystem/chromium/DataTransferItemFileSystemChromium.cpp +++ b/Source/WebCore/Modules/filesystem/chromium/DataTransferItemFileSystemChromium.cpp @@ -51,7 +51,7 @@ namespace WebCore { // static -PassRefPtr<Entry> DataTransferItemFileSystem::webkitGetAsEntry(DataTransferItem* item, ScriptExecutionContext* scriptExecutionContext) +PassRefPtr<Entry> DataTransferItemFileSystem::webkitGetAsEntry(ScriptExecutionContext* scriptExecutionContext, DataTransferItem* item) { DataTransferItemPolicyWrapper* itemPolicyWrapper = static_cast<DataTransferItemPolicyWrapper*>(item); diff --git a/Source/WebCore/Modules/geolocation/GeolocationController.cpp b/Source/WebCore/Modules/geolocation/GeolocationController.cpp index 6ff08d646..e1ace93a5 100644 --- a/Source/WebCore/Modules/geolocation/GeolocationController.cpp +++ b/Source/WebCore/Modules/geolocation/GeolocationController.cpp @@ -30,13 +30,11 @@ #include "GeolocationClient.h" #include "GeolocationPosition.h" -#include "InspectorInstrumentation.h" namespace WebCore { -GeolocationController::GeolocationController(Page* page, GeolocationClient* client) +GeolocationController::GeolocationController(Page*, GeolocationClient* client) : m_client(client) - , m_page(page) { } @@ -100,9 +98,6 @@ void GeolocationController::cancelPermissionRequest(Geolocation* geolocation) void GeolocationController::positionChanged(GeolocationPosition* position) { - position = InspectorInstrumentation::checkGeolocationPositionOrError(m_page, position); - if (!position) - return; m_lastPosition = position; Vector<RefPtr<Geolocation> > observersVector; copyToVector(m_observers, observersVector); diff --git a/Source/WebCore/Modules/geolocation/GeolocationController.h b/Source/WebCore/Modules/geolocation/GeolocationController.h index bc61b9e4d..fc3b513b3 100644 --- a/Source/WebCore/Modules/geolocation/GeolocationController.h +++ b/Source/WebCore/Modules/geolocation/GeolocationController.h @@ -68,7 +68,6 @@ private: GeolocationController(Page*, GeolocationClient*); GeolocationClient* m_client; - Page* m_page; RefPtr<GeolocationPosition> m_lastPosition; typedef HashSet<RefPtr<Geolocation> > ObserversSet; diff --git a/Source/WebCore/Modules/indexeddb/IDBFactory.cpp b/Source/WebCore/Modules/indexeddb/IDBFactory.cpp index 8be9d1d24..7e10cb1a5 100644 --- a/Source/WebCore/Modules/indexeddb/IDBFactory.cpp +++ b/Source/WebCore/Modules/indexeddb/IDBFactory.cpp @@ -63,70 +63,73 @@ IDBFactory::~IDBFactory() { } -PassRefPtr<IDBRequest> IDBFactory::getDatabaseNames(ScriptExecutionContext* context) +namespace { +static bool isContextValid(ScriptExecutionContext* context) { - if (!context->isDocument()) { - // FIXME: make this work with workers. - return 0; + ASSERT(context->isDocument() || context->isWorkerContext()); + if (context->isDocument()) { + Document* document = static_cast<Document*>(context); + return document->frame() && document->page(); } +#if !ENABLE(WORKERS) + if (context->isWorkerContext()) + return false; +#endif + return true; +} - Document* document = static_cast<Document*>(context); - if (!document->frame() || !document->page()) +static String getIndexedDBDatabasePath(ScriptExecutionContext* context) +{ + ASSERT(isContextValid(context)); + if (context->isDocument()) { + Document* document = static_cast<Document*>(context); + return document->page()->group().groupSettings()->indexedDBDatabasePath(); + } +#if ENABLE(WORKERS) + WorkerContext* workerContext = static_cast<WorkerContext*>(context); + const GroupSettings* groupSettings = workerContext->groupSettings(); + if (groupSettings) + return groupSettings->indexedDBDatabasePath(); +#endif + return String(); +} +} + +PassRefPtr<IDBRequest> IDBFactory::getDatabaseNames(ScriptExecutionContext* context) +{ + if (!isContextValid(context)) return 0; - RefPtr<IDBRequest> request = IDBRequest::create(document, IDBAny::create(this), 0); - GroupSettings* groupSettings = document->page()->group().groupSettings(); - m_backend->getDatabaseNames(request, document->securityOrigin(), document->frame(), groupSettings->indexedDBDatabasePath()); + RefPtr<IDBRequest> request = IDBRequest::create(context, IDBAny::create(this), 0); + m_backend->getDatabaseNames(request, context->securityOrigin(), context, getIndexedDBDatabasePath(context)); return request; } PassRefPtr<IDBRequest> IDBFactory::open(ScriptExecutionContext* context, const String& name, ExceptionCode& ec) { - ASSERT(context->isDocument() || context->isWorkerContext()); - if (name.isNull()) { ec = IDBDatabaseException::IDB_TYPE_ERR; return 0; } - if (context->isDocument()) { - Document* document = static_cast<Document*>(context); - if (!document->frame() || !document->page()) - return 0; - Frame* frame = document->frame(); - RefPtr<IDBRequest> request = IDBRequest::create(context, IDBAny::create(this), 0); - m_backend->open(name, request.get(), context->securityOrigin(), frame, document->page()->group().groupSettings()->indexedDBDatabasePath()); - return request; - } -#if ENABLE(WORKERS) + if (!isContextValid(context)) + return 0; + RefPtr<IDBRequest> request = IDBRequest::create(context, IDBAny::create(this), 0); - WorkerContext* workerContext = static_cast<WorkerContext*>(context); - GroupSettings* groupSettings = workerContext->thread()->groupSettings(); - m_backend->openFromWorker(name, request.get(), context->securityOrigin(), workerContext, groupSettings ? groupSettings->indexedDBDatabasePath() : String()); + m_backend->open(name, request, context->securityOrigin(), context, getIndexedDBDatabasePath(context)); return request; -#else - return 0; -#endif } PassRefPtr<IDBVersionChangeRequest> IDBFactory::deleteDatabase(ScriptExecutionContext* context, const String& name, ExceptionCode& ec) { - if (!context->isDocument()) { - // FIXME: make this work with workers. - return 0; - } - - Document* document = static_cast<Document*>(context); - if (!document->frame() || !document->page()) - return 0; - if (name.isNull()) { ec = IDBDatabaseException::IDB_TYPE_ERR; return 0; } + if (!isContextValid(context)) + return 0; - RefPtr<IDBVersionChangeRequest> request = IDBVersionChangeRequest::create(document, IDBAny::createNull(), ""); - GroupSettings* groupSettings = document->page()->group().groupSettings(); - m_backend->deleteDatabase(name, request, document->securityOrigin(), document->frame(), groupSettings->indexedDBDatabasePath()); + RefPtr<IDBVersionChangeRequest> request = IDBVersionChangeRequest::create(context, IDBAny::createNull(), ""); + m_backend->deleteDatabase(name, request, context->securityOrigin(), context, getIndexedDBDatabasePath(context)); return request; } @@ -138,8 +141,8 @@ short IDBFactory::cmp(PassRefPtr<IDBKey> first, PassRefPtr<IDBKey> second, Excep if (!first->isValid() || !second->isValid()) { ec = IDBDatabaseException::DATA_ERR; return 0; - } - + } + return static_cast<short>(first->compare(second.get())); } diff --git a/Source/WebCore/Modules/indexeddb/IDBFactoryBackendImpl.cpp b/Source/WebCore/Modules/indexeddb/IDBFactoryBackendImpl.cpp index 447ba7751..3cce0c375 100644 --- a/Source/WebCore/Modules/indexeddb/IDBFactoryBackendImpl.cpp +++ b/Source/WebCore/Modules/indexeddb/IDBFactoryBackendImpl.cpp @@ -35,7 +35,6 @@ #include "IDBDatabaseException.h" #include "IDBLevelDBBackingStore.h" #include "IDBTransactionCoordinator.h" -#include "SecurityOrigin.h" #include <wtf/Threading.h> #include <wtf/UnusedParam.h> @@ -81,7 +80,7 @@ void IDBFactoryBackendImpl::removeIDBBackingStore(const String& fileIdentifier) m_backingStoreMap.remove(fileIdentifier); } -void IDBFactoryBackendImpl::getDatabaseNames(PassRefPtr<IDBCallbacks> callbacks, PassRefPtr<SecurityOrigin> securityOrigin, Frame*, const String& dataDirectory) +void IDBFactoryBackendImpl::getDatabaseNames(PassRefPtr<IDBCallbacks> callbacks, PassRefPtr<SecurityOrigin> securityOrigin, ScriptExecutionContext*, const String& dataDirectory) { RefPtr<IDBBackingStore> backingStore = openBackingStore(securityOrigin, dataDirectory); if (!backingStore) { @@ -99,17 +98,7 @@ void IDBFactoryBackendImpl::getDatabaseNames(PassRefPtr<IDBCallbacks> callbacks, callbacks->onSuccess(databaseNames.release()); } -void IDBFactoryBackendImpl::open(const String& name, IDBCallbacks* callbacks, PassRefPtr<SecurityOrigin> securityOrigin, Frame*, const String& dataDirectory) -{ - openInternal(name, callbacks, securityOrigin, dataDirectory); -} - -void IDBFactoryBackendImpl::openFromWorker(const String& name, IDBCallbacks* callbacks, PassRefPtr<SecurityOrigin> securityOrigin, WorkerContext*, const String& dataDirectory) -{ - openInternal(name, callbacks, securityOrigin, dataDirectory); -} - -void IDBFactoryBackendImpl::deleteDatabase(const String& name, PassRefPtr<IDBCallbacks> callbacks, PassRefPtr<SecurityOrigin> securityOrigin, Frame*, const String& dataDirectory) +void IDBFactoryBackendImpl::deleteDatabase(const String& name, PassRefPtr<IDBCallbacks> callbacks, PassRefPtr<SecurityOrigin> securityOrigin, ScriptExecutionContext*, const String& dataDirectory) { const String uniqueIdentifier = computeUniqueIdentifier(name, securityOrigin.get()); @@ -160,7 +149,7 @@ PassRefPtr<IDBBackingStore> IDBFactoryBackendImpl::openBackingStore(PassRefPtr<S return 0; } -void IDBFactoryBackendImpl::openInternal(const String& name, IDBCallbacks* callbacks, PassRefPtr<SecurityOrigin> prpSecurityOrigin, const String& dataDirectory) +void IDBFactoryBackendImpl::open(const String& name, PassRefPtr<IDBCallbacks> callbacks, PassRefPtr<SecurityOrigin> prpSecurityOrigin, ScriptExecutionContext*, const String& dataDirectory) { RefPtr<SecurityOrigin> securityOrigin = prpSecurityOrigin; const String uniqueIdentifier = computeUniqueIdentifier(name, securityOrigin.get()); diff --git a/Source/WebCore/Modules/indexeddb/IDBFactoryBackendImpl.h b/Source/WebCore/Modules/indexeddb/IDBFactoryBackendImpl.h index 20564a885..ca1d05282 100644 --- a/Source/WebCore/Modules/indexeddb/IDBFactoryBackendImpl.h +++ b/Source/WebCore/Modules/indexeddb/IDBFactoryBackendImpl.h @@ -29,6 +29,7 @@ #define IDBFactoryBackendImpl_h #include "IDBFactoryBackendInterface.h" +#include "SecurityOrigin.h" #include <wtf/HashMap.h> #include <wtf/text/StringHash.h> @@ -55,19 +56,15 @@ public: void addIDBBackingStore(const String& fileIdentifier, IDBBackingStore*); virtual void removeIDBBackingStore(const String& fileIdentifier); - virtual void getDatabaseNames(PassRefPtr<IDBCallbacks>, PassRefPtr<SecurityOrigin>, Frame*, const String& dataDir); - - virtual void open(const String& name, IDBCallbacks*, PassRefPtr<SecurityOrigin>, Frame*, const String& dataDir); - virtual void openFromWorker(const String& name, IDBCallbacks*, PassRefPtr<SecurityOrigin>, WorkerContext*, const String& dataDir); - virtual void deleteDatabase(const String& name, PassRefPtr<IDBCallbacks>, PassRefPtr<SecurityOrigin>, Frame*, const String& dataDir); + virtual void getDatabaseNames(PassRefPtr<IDBCallbacks>, PassRefPtr<SecurityOrigin>, ScriptExecutionContext*, const String& dataDir); + virtual void open(const String& name, PassRefPtr<IDBCallbacks>, PassRefPtr<SecurityOrigin>, ScriptExecutionContext*, const String& dataDir); + virtual void deleteDatabase(const String& name, PassRefPtr<IDBCallbacks>, PassRefPtr<SecurityOrigin>, ScriptExecutionContext*, const String& dataDir); protected: IDBFactoryBackendImpl(); virtual PassRefPtr<IDBBackingStore> openBackingStore(PassRefPtr<SecurityOrigin>, const String& dataDir); private: - void openInternal(const String& name, IDBCallbacks*, PassRefPtr<SecurityOrigin>, const String& dataDir); - typedef HashMap<String, RefPtr<IDBDatabaseBackendImpl> > IDBDatabaseBackendMap; IDBDatabaseBackendMap m_databaseBackendMap; diff --git a/Source/WebCore/Modules/indexeddb/IDBFactoryBackendInterface.h b/Source/WebCore/Modules/indexeddb/IDBFactoryBackendInterface.h index 19a1c9784..44f5c786e 100644 --- a/Source/WebCore/Modules/indexeddb/IDBFactoryBackendInterface.h +++ b/Source/WebCore/Modules/indexeddb/IDBFactoryBackendInterface.h @@ -53,11 +53,9 @@ public: static PassRefPtr<IDBFactoryBackendInterface> create(); virtual ~IDBFactoryBackendInterface() { } - virtual void getDatabaseNames(PassRefPtr<IDBCallbacks>, PassRefPtr<SecurityOrigin>, Frame*, const String& dataDir) = 0; - - virtual void open(const String& name, IDBCallbacks*, PassRefPtr<SecurityOrigin>, Frame*, const String& dataDir) = 0; - virtual void openFromWorker(const String& name, IDBCallbacks*, PassRefPtr<SecurityOrigin>, WorkerContext*, const String& dataDir) = 0; - virtual void deleteDatabase(const String& name, PassRefPtr<IDBCallbacks>, PassRefPtr<SecurityOrigin>, Frame*, const String& dataDir) = 0; + virtual void getDatabaseNames(PassRefPtr<IDBCallbacks>, PassRefPtr<SecurityOrigin>, ScriptExecutionContext*, const String& dataDir) = 0; + virtual void open(const String& name, PassRefPtr<IDBCallbacks>, PassRefPtr<SecurityOrigin>, ScriptExecutionContext*, const String& dataDir) = 0; + virtual void deleteDatabase(const String& name, PassRefPtr<IDBCallbacks>, PassRefPtr<SecurityOrigin>, ScriptExecutionContext*, const String& dataDir) = 0; }; } // namespace WebCore diff --git a/Source/WebCore/Modules/indexeddb/IDBKeyRange.cpp b/Source/WebCore/Modules/indexeddb/IDBKeyRange.cpp index 341e2cf72..92e845426 100644 --- a/Source/WebCore/Modules/indexeddb/IDBKeyRange.cpp +++ b/Source/WebCore/Modules/indexeddb/IDBKeyRange.cpp @@ -59,7 +59,7 @@ PassRefPtr<IDBKeyRange> IDBKeyRange::lowerBound(PassRefPtr<IDBKey> bound, bool o return 0; } - return IDBKeyRange::create(bound, 0, open ? LowerBoundOpen : LowerBoundClosed, UpperBoundClosed); + return IDBKeyRange::create(bound, 0, open ? LowerBoundOpen : LowerBoundClosed, UpperBoundOpen); } PassRefPtr<IDBKeyRange> IDBKeyRange::upperBound(PassRefPtr<IDBKey> bound, bool open, ExceptionCode& ec) @@ -69,7 +69,7 @@ PassRefPtr<IDBKeyRange> IDBKeyRange::upperBound(PassRefPtr<IDBKey> bound, bool o return 0; } - return IDBKeyRange::create(0, bound, LowerBoundClosed, open ? UpperBoundOpen : UpperBoundClosed); + return IDBKeyRange::create(0, bound, LowerBoundOpen, open ? UpperBoundOpen : UpperBoundClosed); } PassRefPtr<IDBKeyRange> IDBKeyRange::bound(PassRefPtr<IDBKey> lower, PassRefPtr<IDBKey> upper, bool lowerOpen, bool upperOpen, ExceptionCode& ec) diff --git a/Source/WebCore/page/NavigatorRegisterProtocolHandler.cpp b/Source/WebCore/Modules/protocolhandler/NavigatorRegisterProtocolHandler.cpp index 0d5eb89c9..0d5eb89c9 100644 --- a/Source/WebCore/page/NavigatorRegisterProtocolHandler.cpp +++ b/Source/WebCore/Modules/protocolhandler/NavigatorRegisterProtocolHandler.cpp diff --git a/Source/WebCore/page/NavigatorRegisterProtocolHandler.h b/Source/WebCore/Modules/protocolhandler/NavigatorRegisterProtocolHandler.h index 2193e01f4..2193e01f4 100644 --- a/Source/WebCore/page/NavigatorRegisterProtocolHandler.h +++ b/Source/WebCore/Modules/protocolhandler/NavigatorRegisterProtocolHandler.h diff --git a/Source/WebCore/page/NavigatorRegisterProtocolHandler.idl b/Source/WebCore/Modules/protocolhandler/NavigatorRegisterProtocolHandler.idl index 1bd57f2fe..1bd57f2fe 100644 --- a/Source/WebCore/page/NavigatorRegisterProtocolHandler.idl +++ b/Source/WebCore/Modules/protocolhandler/NavigatorRegisterProtocolHandler.idl diff --git a/Source/WebCore/Modules/webaudio/DelayDSPKernel.cpp b/Source/WebCore/Modules/webaudio/DelayDSPKernel.cpp index 2bd5759ea..1f35e55a2 100644 --- a/Source/WebCore/Modules/webaudio/DelayDSPKernel.cpp +++ b/Source/WebCore/Modules/webaudio/DelayDSPKernel.cpp @@ -33,21 +33,25 @@ using namespace std; -const float SmoothingTimeConstant = 0.020f; // 20ms - namespace WebCore { +const float SmoothingTimeConstant = 0.020f; // 20ms + DelayDSPKernel::DelayDSPKernel(DelayProcessor* processor) : AudioDSPKernel(processor) , m_writeIndex(0) , m_firstTime(true) { ASSERT(processor && processor->sampleRate() > 0); - if (!processor) + if (!(processor && processor->sampleRate() > 0)) return; m_maxDelayTime = processor->maxDelayTime(); - m_buffer.allocate(static_cast<size_t>(processor->sampleRate() * m_maxDelayTime)); + ASSERT(m_maxDelayTime >= 0); + if (m_maxDelayTime < 0) + return; + + m_buffer.allocate(bufferLengthForDelay(m_maxDelayTime, processor->sampleRate())); m_buffer.zero(); m_smoothingRate = AudioUtilities::discreteTimeConstantForSampleRate(SmoothingTimeConstant, processor->sampleRate()); @@ -63,7 +67,7 @@ DelayDSPKernel::DelayDSPKernel(double maxDelayTime, float sampleRate) if (maxDelayTime <= 0.0) return; - size_t bufferLength = static_cast<size_t>(sampleRate * maxDelayTime); + size_t bufferLength = bufferLengthForDelay(maxDelayTime, sampleRate); ASSERT(bufferLength); if (!bufferLength) return; @@ -74,6 +78,13 @@ DelayDSPKernel::DelayDSPKernel(double maxDelayTime, float sampleRate) m_smoothingRate = AudioUtilities::discreteTimeConstantForSampleRate(SmoothingTimeConstant, sampleRate); } +size_t DelayDSPKernel::bufferLengthForDelay(double maxDelayTime, double sampleRate) const +{ + // Compute the length of the buffer needed to handle a max delay of |maxDelayTime|. One is + // added to handle the case where the actual delay equals the maximum delay. + return 1 + AudioUtilities::timeToSampleFrame(maxDelayTime, sampleRate); +} + void DelayDSPKernel::process(const float* source, float* destination, size_t framesToProcess) { size_t bufferLength = m_buffer.size(); diff --git a/Source/WebCore/Modules/webaudio/DelayDSPKernel.h b/Source/WebCore/Modules/webaudio/DelayDSPKernel.h index 1d556ea4e..62421eab5 100644 --- a/Source/WebCore/Modules/webaudio/DelayDSPKernel.h +++ b/Source/WebCore/Modules/webaudio/DelayDSPKernel.h @@ -58,6 +58,7 @@ private: double m_desiredDelayFrames; DelayProcessor* delayProcessor() { return static_cast<DelayProcessor*>(processor()); } + size_t bufferLengthForDelay(double delayTime, double sampleRate) const; }; } // namespace WebCore diff --git a/Source/WebCore/Modules/websockets/WebSocketHandshake.cpp b/Source/WebCore/Modules/websockets/WebSocketHandshake.cpp index f7c836965..caddb9b58 100644 --- a/Source/WebCore/Modules/websockets/WebSocketHandshake.cpp +++ b/Source/WebCore/Modules/websockets/WebSocketHandshake.cpp @@ -36,7 +36,6 @@ #include "WebSocketHandshake.h" #include "WebSocket.h" -#include "Base64.h" #include "Cookie.h" #include "CookieJar.h" #include "Document.h" @@ -53,6 +52,7 @@ #include <wtf/StdLibExtras.h> #include <wtf/StringExtras.h> #include <wtf/Vector.h> +#include <wtf/text/Base64.h> #include <wtf/text/CString.h> #include <wtf/text/StringBuilder.h> #include <wtf/text/WTFString.h> diff --git a/Source/WebCore/Target.pri b/Source/WebCore/Target.pri index b91497553..5dac2b05d 100644 --- a/Source/WebCore/Target.pri +++ b/Source/WebCore/Target.pri @@ -432,6 +432,7 @@ SOURCES += \ Modules/notifications/NotificationCenter.cpp \ Modules/notifications/NotificationController.cpp \ Modules/notifications/WorkerContextNotifications.cpp \ + Modules/protocolhandler/NavigatorRegisterProtocolHandler.cpp \ css/CSSAspectRatioValue.cpp \ css/CSSBorderImageSliceValue.cpp \ css/CSSBorderImage.cpp \ @@ -572,6 +573,8 @@ SOURCES += \ dom/ExceptionCodePlaceholder.cpp \ dom/GenericEventQueue.cpp \ dom/IconURL.cpp \ + dom/IdTargetObserver.cpp \ + dom/IdTargetObserverRegistry.cpp \ dom/KeyboardEvent.cpp \ dom/MessageChannel.cpp \ dom/MessageEvent.cpp \ @@ -637,6 +640,7 @@ SOURCES += \ dom/ViewportArguments.cpp \ dom/WebKitAnimationEvent.cpp \ dom/WebKitNamedFlow.cpp \ + dom/WebKitNamedFlowCollection.cpp \ dom/WebKitTransitionEvent.cpp \ dom/WheelEvent.cpp \ dom/WindowEventContext.cpp \ @@ -1041,7 +1045,6 @@ SOURCES += \ page/MouseEventWithHitTestResults.cpp \ page/Navigator.cpp \ page/NavigatorBase.cpp \ - page/NavigatorRegisterProtocolHandler.cpp \ page/OriginAccessEntry.cpp \ page/Page.cpp \ page/PageGroup.cpp \ @@ -1075,7 +1078,6 @@ SOURCES += \ platform/animation/Animation.cpp \ platform/animation/AnimationList.cpp \ platform/Arena.cpp \ - platform/text/Base64.cpp \ platform/text/BidiContext.cpp \ platform/text/DateTimeFormat.cpp \ platform/text/Hyphenation.cpp \ @@ -1119,6 +1121,8 @@ SOURCES += \ platform/graphics/Gradient.cpp \ platform/graphics/GraphicsContext.cpp \ platform/graphics/GraphicsLayer.cpp \ + platform/graphics/GraphicsLayerAnimation.cpp \ + platform/graphics/GraphicsLayerTransform.cpp \ platform/graphics/GraphicsTypes.cpp \ platform/graphics/Image.cpp \ platform/graphics/ImageBuffer.cpp \ @@ -1167,7 +1171,7 @@ SOURCES += \ platform/LinkHash.cpp \ platform/Logging.cpp \ platform/MemoryPressureHandler.cpp \ - platform/MemoryUsageSupport.cpp \ + platform/qt/MemoryUsageSupportQt.cpp \ platform/MIMETypeRegistry.cpp \ platform/mock/DeviceMotionClientMock.cpp \ platform/mock/DeviceOrientationClientMock.cpp \ @@ -1757,6 +1761,8 @@ HEADERS += \ dom/ExceptionBase.h \ dom/ExceptionCode.h \ dom/FragmentScriptingPermission.h \ + dom/IdTargetObserver.h \ + dom/IdTargetObserverRegistry.h \ dom/KeyboardEvent.h \ dom/MemoryInstrumentation.h \ dom/MessageChannel.h \ @@ -1818,6 +1824,7 @@ HEADERS += \ dom/ViewportArguments.h \ dom/WebKitAnimationEvent.h \ dom/WebKitNamedFlow.h \ + dom/WebKitNamedFlowCollection.h \ dom/WebKitTransitionEvent.h \ dom/WheelEvent.h \ editing/AlternativeTextController.h \ @@ -2274,6 +2281,7 @@ HEADERS += \ platform/graphics/filters/SourceAlpha.h \ platform/graphics/filters/SourceGraphic.h \ platform/graphics/filters/arm/NEONHelpers.h \ + platform/graphics/filters/arm/FEBlendNEON.h \ platform/graphics/filters/arm/FECompositeArithmeticNEON.h \ platform/graphics/filters/arm/FEGaussianBlurNEON.h \ platform/graphics/filters/arm/FELightingNEON.h \ @@ -2294,7 +2302,9 @@ HEADERS += \ platform/graphics/Gradient.h \ platform/graphics/GraphicsContext.h \ platform/graphics/GraphicsLayer.h \ + platform/graphics/GraphicsLayerAnimation.h \ platform/graphics/GraphicsLayerClient.h \ + platform/graphics/GraphicsLayerTransform.h \ platform/graphics/GraphicsTypes.h \ platform/graphics/GraphicsTypes3D.h \ platform/graphics/Image.h \ @@ -2318,9 +2328,7 @@ HEADERS += \ platform/graphics/SimpleFontData.h \ platform/graphics/surfaces/GraphicsSurface.h \ platform/graphics/texmap/GraphicsLayerTextureMapper.h \ - platform/graphics/texmap/LayerTransform.h \ platform/graphics/texmap/TextureMapper.h \ - platform/graphics/texmap/TextureMapperAnimation.h \ platform/graphics/texmap/TextureMapperBackingStore.h \ platform/graphics/texmap/TextureMapperImageBuffer.h \ platform/graphics/texmap/TextureMapperLayer.h \ @@ -2425,7 +2433,6 @@ HEADERS += \ platform/sql/SQLiteStatement.h \ platform/sql/SQLiteTransaction.h \ platform/sql/SQLValue.h \ - platform/text/Base64.h \ platform/text/BidiContext.h \ platform/text/DateTimeFormat.h \ platform/text/DecodeEscapeSequences.h \ @@ -2936,9 +2943,7 @@ SOURCES += \ platform/graphics/qt/PatternQt.cpp \ platform/graphics/qt/StillImageQt.cpp \ platform/graphics/texmap/GraphicsLayerTextureMapper.cpp \ - platform/graphics/texmap/LayerTransform.cpp \ platform/graphics/texmap/TextureMapper.cpp \ - platform/graphics/texmap/TextureMapperAnimation.cpp \ platform/graphics/texmap/TextureMapperBackingStore.cpp \ platform/graphics/texmap/TextureMapperImageBuffer.cpp \ platform/graphics/texmap/TextureMapperLayer.cpp \ @@ -4179,6 +4184,9 @@ contains(DEFINES, WTF_USE_GRAPHICS_SURFACE=1) { SOURCES += platform/graphics/surfaces/mac/GraphicsSurfaceMac.cpp INCLUDEPATH += /System/Library/Frameworks/CoreFoundation.framework/Headers } + contains(DEFINES, HAVE_XCOMPOSITE=1) { + SOURCES += platform/graphics/surfaces/qt/GraphicsSurfaceGLX.cpp + } } # Make sure the derived sources are built diff --git a/Source/WebCore/WebCore.exp.in b/Source/WebCore/WebCore.exp.in index 2fa7d5cf7..1b2618e7f 100644 --- a/Source/WebCore/WebCore.exp.in +++ b/Source/WebCore/WebCore.exp.in @@ -611,6 +611,9 @@ __ZN7WebCore25computeViewportAttributesENS_17ViewportArgumentsEiiifNS_7IntSizeE __ZN7WebCore26UserTypingGestureIndicator27processingUserTypingGestureEv __ZN7WebCore26UserTypingGestureIndicator28focusedElementAtGestureStartEv __ZN7WebCore26stopObservingCookieChangesEv +__ZN7WebCore26ContextDestructionObserverD2Ev +__ZN7WebCore26ContextDestructionObserverC2EPNS_22ScriptExecutionContextE +__ZN7WebCore26ContextDestructionObserver16contextDestroyedEv __ZN7WebCore27AuthenticationChallengeBaseC2Ev __ZN7WebCore27CSSComputedStyleDeclarationC1EN3WTF10PassRefPtrINS_4NodeEEEbRKNS1_6StringE __ZN7WebCore27DeviceOrientationClientMock14setOrientationEN3WTF10PassRefPtrINS_21DeviceOrientationDataEEE @@ -1986,23 +1989,23 @@ __ZN7WebCore7IntSizeC1ERK7_NSSize __ZNK7WebCore7IntSizecv7_NSSizeEv #endif -#if defined(BUILDING_ON_SNOW_LEOPARD) && !PLATFORM(IOS) +#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1060 _wkGetNSEventMomentumPhase #endif -#if !defined(BUILDING_ON_SNOW_LEOPARD) || PLATFORM(IOS) +#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 _wkCALayerEnumerateRectsBeingDrawnWithBlock _wkCFURLRequestAllowAllPostCaching _wkCGPathAddRoundedRect _wkCreateCTTypesetterWithUniCharProviderAndOptions #endif -#if (!defined(BUILDING_ON_SNOW_LEOPARD) || PLATFORM(IOS)) && !PLATFORM(IOS_SIMULATOR) +#if (PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070) && !PLATFORM(IOS_SIMULATOR) _wkIOSurfaceContextCreate _wkIOSurfaceContextCreateImage #endif -#if !defined(BUILDING_ON_SNOW_LEOPARD) && !PLATFORM(IOS) +#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 _wkAVAssetResolvedURL _wkCopyDefaultSearchProviderDisplayName _wkCreateVMPressureDispatchOnMainQueue @@ -2011,7 +2014,7 @@ _wkExecutableWasLinkedOnOrBeforeSnowLeopard _wkRecommendedScrollerStyle #endif -#if !defined(BUILDING_ON_SNOW_LEOPARD) && !defined(BUILDING_ON_LION) && !PLATFORM(IOS) +#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 _wkExecutableWasLinkedOnOrBeforeLion _wkFilterAddData _wkFilterCreateInstance @@ -2070,7 +2073,7 @@ __ZN7WebCore14ResourceHandle46setPrivateBrowsingStorageSessionIdentifierBaseERKN __ZN7WebCore14ResourceHandle21currentStorageSessionEv __ZN7WebCore14ResourceHandle29privateBrowsingStorageSessionEv __ZN7WebCore26currentCFHTTPCookieStorageEv -#if defined(BUILDING_ON_SNOW_LEOPARD) +#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1060 __ZN7WebCore14ResourceHandle24setDefaultStorageSessionEP21__CFURLStorageSession #else __ZN7WebCore14ResourceHandle24setDefaultStorageSessionEPK21__CFURLStorageSession @@ -2376,6 +2379,10 @@ __ZN7WebCore9FrameView25serviceScriptedAnimationsEy __ZN7WebCore22RuntimeEnabledFeatures18isShadowDOMEnabledE #endif +#if ENABLE(DIALOG_ELEMENT) +__ZN7WebCore22RuntimeEnabledFeatures22isDialogElementEnabledE +#endif + #if ENABLE(SVG) __ZN7WebCore14SVGSMILElement13isSMILElementEPNS_4NodeE __ZN7WebCore8Document13svgExtensionsEv @@ -2540,7 +2547,7 @@ __ZNK7WebCore4KURL7isValidEv __ZNK7WebCore4KURL22protocolIsInHTTPFamilyEv #endif -#if PLATFORM(MAC) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) && !defined(BUILDING_ON_LION) +#if PLATFORM(MAC) && !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 __ZN7WebCore27AlternativeTextUIController15addAlternativesERKN3WTF9RetainPtrI18NSTextAlternativesEE __ZN7WebCore27AlternativeTextUIController22alternativesForContextEy __ZN7WebCore27AlternativeTextUIController5clearEv diff --git a/Source/WebCore/WebCore.gyp/WebCore.gyp b/Source/WebCore/WebCore.gyp/WebCore.gyp index a53117419..c274e2f03 100644 --- a/Source/WebCore/WebCore.gyp/WebCore.gyp +++ b/Source/WebCore/WebCore.gyp/WebCore.gyp @@ -62,6 +62,7 @@ '../Modules/indexeddb', '../Modules/mediastream', '../Modules/notifications', + '../Modules/protocolhandler', '../Modules/quota', '../Modules/speech', '../Modules/webaudio', @@ -1055,6 +1056,7 @@ '--include', '../Modules/intents', '--include', '../Modules/mediastream', '--include', '../Modules/notifications', + '--include', '../Modules/protocolhandler', '--include', '../Modules/webaudio', '--include', '../Modules/webdatabase', '--include', '../css', @@ -1890,7 +1892,6 @@ ], 'dependencies': [ 'webcore_prerequisites', - '<(chromium_src_dir)/third_party/v8-i18n/build/all.gyp:v8-i18n', ], # This is needed for mac because of webkit_system_interface. It'd be nice # if this hard dependency could be split off the rest. @@ -2025,6 +2026,20 @@ ['exclude', 'Gtk\\.cpp$'], ], }], + ['OS=="android"', { + 'cflags': [ + # WebCore does not work with strict aliasing enabled. + # https://bugs.webkit.org/show_bug.cgi?id=25864 + '-fno-strict-aliasing', + ], + }, { # OS!="android" + 'dependencies': [ + # Android doesn't have this third party repository, so can't + # include it. It's not used by Android in any case. + '<(chromium_src_dir)/third_party/v8-i18n/build/all.gyp:v8-i18n', + ], + 'sources/': [['exclude', 'Android\\.cpp$']] + }], ['OS!="mac"', { 'sources/': [['exclude', 'Mac\\.(cpp|mm?)$']] }], diff --git a/Source/WebCore/WebCore.gypi b/Source/WebCore/WebCore.gypi index 9b68d3ef3..f3f77ea43 100644 --- a/Source/WebCore/WebCore.gypi +++ b/Source/WebCore/WebCore.gypi @@ -243,6 +243,7 @@ 'page/PageGroup.h', 'page/PagePopup.h', 'page/PagePopupClient.h', + 'page/PagePopupDriver.h', 'page/PageSerializer.h', 'page/PageVisibilityState.h', 'page/PrintContext.h', @@ -490,7 +491,6 @@ 'platform/sql/SQLValue.h', 'platform/sql/SQLiteDatabase.h', 'platform/sql/SQLiteTransaction.h', - 'platform/text/Base64.h', 'platform/text/BidiRunList.h', 'platform/text/BidiContext.h', 'platform/text/BidiResolver.h', @@ -847,6 +847,7 @@ 'Modules/notifications/NotificationCenter.idl', 'Modules/notifications/NotificationPermissionCallback.idl', 'Modules/notifications/WorkerContextNotifications.idl', + 'Modules/protocolhandler/NavigatorRegisterProtocolHandler.idl', 'Modules/quota/DOMWindowQuota.idl', 'Modules/quota/StorageInfo.idl', 'Modules/quota/StorageInfoErrorCallback.idl', @@ -1165,7 +1166,6 @@ 'page/Location.idl', 'page/MemoryInfo.idl', 'page/Navigator.idl', - 'page/NavigatorRegisterProtocolHandler.idl', 'page/PagePopupController.idl', 'page/Performance.idl', 'page/PerformanceEntry.idl', @@ -1581,6 +1581,8 @@ 'Modules/notifications/NotificationPermissionCallback.h', 'Modules/notifications/WorkerContextNotifications.cpp', 'Modules/notifications/WorkerContextNotifications.h', + 'Modules/protocolhandler/NavigatorRegisterProtocolHandler.cpp', + 'Modules/protocolhandler/NavigatorRegisterProtocolHandler.h', 'Modules/quota/DOMWindowQuota.cpp', 'Modules/quota/DOMWindowQuota.h', 'Modules/quota/StorageInfo.cpp', @@ -3060,8 +3062,6 @@ 'page/Navigator.h', 'page/NavigatorBase.cpp', 'page/NavigatorBase.h', - 'page/NavigatorRegisterProtocolHandler.cpp', - 'page/NavigatorRegisterProtocolHandler.h', 'page/OriginAccessEntry.cpp', 'page/OriginAccessEntry.h', 'page/Page.cpp', @@ -3492,6 +3492,10 @@ 'platform/graphics/GraphicsContext.cpp', 'platform/graphics/GraphicsContext3D.cpp', 'platform/graphics/GraphicsLayer.cpp', + 'platform/graphics/GraphicsLayerAnimation.cpp', + 'platform/graphics/GraphicsLayerAnimation.h', + 'platform/graphics/GraphicsLayerTransform.cpp', + 'platform/graphics/GraphicsLayerTransform.h', 'platform/graphics/GraphicsTypes.cpp', 'platform/graphics/Image.cpp', 'platform/graphics/ImageBuffer.cpp', @@ -3709,6 +3713,7 @@ 'platform/graphics/filters/SpotLightSource.cpp', 'platform/graphics/filters/SpotLightSource.h', 'platform/graphics/filters/arm/NEONHelpers.h', + 'platform/graphics/filters/arm/FEBlendNEON.h', 'platform/graphics/filters/arm/FECompositeArithmeticNEON.h', 'platform/graphics/filters/arm/FEGaussianBlurNEON.h', 'platform/graphics/filters/arm/FELightingNEON.cpp', @@ -3906,12 +3911,8 @@ 'platform/graphics/skia/TransformationMatrixSkia.cpp', 'platform/graphics/texmap/GraphicsLayerTextureMapper.cpp', 'platform/graphics/texmap/GraphicsLayerTextureMapper.h', - 'platform/graphics/texmap/LayerTransform.cpp', - 'platform/graphics/texmap/LayerTransform.h', 'platform/graphics/texmap/TextureMapper.cpp', 'platform/graphics/texmap/TextureMapper.h', - 'platform/graphics/texmap/TextureMapperAnimation.cpp', - 'platform/graphics/texmap/TextureMapperAnimation.h', 'platform/graphics/texmap/TextureMapperBackingStore.cpp', 'platform/graphics/texmap/TextureMapperBackingStore.h', 'platform/graphics/texmap/TextureMapperGL.cpp', @@ -4382,7 +4383,6 @@ 'platform/sql/chromium/SQLiteFileSystemChromiumPosix.cpp', 'platform/sql/chromium/SQLiteFileSystemChromiumWin.cpp', 'platform/text/AtomicStringKeyedMRUCache.h', - 'platform/text/Base64.cpp', 'platform/text/BidiContext.cpp', 'platform/text/DateTimeFormat.cpp', 'platform/text/Hyphenation.cpp', @@ -5179,6 +5179,10 @@ 'dom/IgnoreDestructiveWriteCountIncrementer.h', 'dom/IconURL.cpp', 'dom/IconURL.h', + 'dom/IdTargetObserver.cpp', + 'dom/IdTargetObserver.h', + 'dom/IdTargetObserverRegistry.cpp', + 'dom/IdTargetObserverRegistry.h', 'dom/KeyboardEvent.cpp', 'dom/MemoryInstrumentation.h', 'dom/MessageChannel.cpp', @@ -5298,6 +5302,8 @@ 'dom/WebKitAnimationEvent.h', 'dom/WebKitNamedFlow.cpp', 'dom/WebKitNamedFlow.h', + 'dom/WebKitNamedFlowCollection.cpp', + 'dom/WebKitNamedFlowCollection.h', 'dom/WebKitTransitionEvent.cpp', 'dom/WebKitTransitionEvent.h', 'dom/WheelEvent.cpp', @@ -6187,6 +6193,8 @@ 'testing/Internals.h', 'testing/InternalSettings.cpp', 'testing/InternalSettings.h', + 'testing/MockPagePopupDriver.cpp', + 'testing/MockPagePopupDriver.h', ], 'webcore_resource_files': [ 'English.lproj/Localizable.strings', @@ -6541,12 +6549,7 @@ 'inspector/front-end/Images/spinnerInactiveSelected.gif', 'inspector/front-end/Images/splitviewDimple.png', 'inspector/front-end/Images/splitviewDividerBackground.png', - 'inspector/front-end/Images/statusbarBackground.png', - 'inspector/front-end/Images/statusbarBottomBackground.png', 'inspector/front-end/Images/statusbarButtonGlyphs.png', - 'inspector/front-end/Images/statusbarButtons.png', - 'inspector/front-end/Images/statusbarMenuButton.png', - 'inspector/front-end/Images/statusbarMenuButtonSelected.png', 'inspector/front-end/Images/statusbarResizerHorizontal.png', 'inspector/front-end/Images/statusbarResizerVertical.png', 'inspector/front-end/Images/successGreenDot.png', @@ -8196,6 +8199,15 @@ 'platform/chromium/support/GraphicsContext3DPrivate.cpp', 'platform/chromium/support/GraphicsContext3DPrivate.h', 'platform/chromium/support/WebAudioBus.cpp', + 'platform/chromium/support/WebCompositorCheckerboardQuad.cpp', + 'platform/chromium/support/WebCompositorDebugBorderQuad.cpp', + 'platform/chromium/support/WebCompositorIOSurfaceQuad.cpp', + 'platform/chromium/support/WebCompositorQuad.cpp', + 'platform/chromium/support/WebCompositorSharedQuadState.cpp', + 'platform/chromium/support/WebCompositorSolidColorQuad.cpp', + 'platform/chromium/support/WebCompositorStreamVideoQuad.cpp', + 'platform/chromium/support/WebCompositorTextureQuad.cpp', + 'platform/chromium/support/WebCompositorTileQuad.cpp', 'platform/chromium/support/WebData.cpp', 'platform/chromium/support/WebHTTPBody.cpp', 'platform/chromium/support/WebHTTPLoadInfo.cpp', @@ -8245,8 +8257,6 @@ 'platform/graphics/chromium/LayerTextureSubImage.cpp', 'platform/graphics/chromium/LayerTextureSubImage.h', 'platform/graphics/chromium/LayerTextureUpdater.h', - 'platform/graphics/chromium/ManagedTexture.cpp', - 'platform/graphics/chromium/ManagedTexture.h', 'platform/graphics/chromium/PlatformCanvas.cpp', 'platform/graphics/chromium/PlatformCanvas.h', 'platform/graphics/chromium/PlatformColor.h', @@ -8268,8 +8278,7 @@ 'platform/graphics/chromium/TextureCopier.h', 'platform/graphics/chromium/TextureLayerChromium.cpp', 'platform/graphics/chromium/TextureLayerChromium.h', - 'platform/graphics/chromium/TextureManager.cpp', - 'platform/graphics/chromium/TextureManager.h', + 'platform/graphics/chromium/TextureAllocator.h', 'platform/graphics/chromium/TextureUploader.h', 'platform/graphics/chromium/ThrottledTextureUploader.cpp', 'platform/graphics/chromium/ThrottledTextureUploader.h', @@ -8288,17 +8297,14 @@ 'platform/graphics/chromium/cc/CCAnimationCurve.cpp', 'platform/graphics/chromium/cc/CCAnimationCurve.h', 'platform/graphics/chromium/cc/CCAnimationEvents.h', - 'platform/graphics/chromium/cc/CCCheckerboardDrawQuad.cpp', 'platform/graphics/chromium/cc/CCCheckerboardDrawQuad.h', 'platform/graphics/chromium/cc/CCDamageTracker.cpp', 'platform/graphics/chromium/cc/CCDamageTracker.h', - 'platform/graphics/chromium/cc/CCDebugBorderDrawQuad.cpp', 'platform/graphics/chromium/cc/CCDebugBorderDrawQuad.h', 'platform/graphics/chromium/cc/CCDebugRectHistory.cpp', 'platform/graphics/chromium/cc/CCDebugRectHistory.h', 'platform/graphics/chromium/cc/CCDelayBasedTimeSource.cpp', 'platform/graphics/chromium/cc/CCDelayBasedTimeSource.h', - 'platform/graphics/chromium/cc/CCDrawQuad.cpp', 'platform/graphics/chromium/cc/CCDrawQuad.h', 'platform/graphics/chromium/cc/CCFontAtlas.cpp', 'platform/graphics/chromium/cc/CCFontAtlas.h', @@ -8309,7 +8315,6 @@ 'platform/graphics/chromium/cc/CCGestureCurve.h', 'platform/graphics/chromium/cc/CCHeadsUpDisplay.cpp', 'platform/graphics/chromium/cc/CCHeadsUpDisplay.h', - 'platform/graphics/chromium/cc/CCIOSurfaceDrawQuad.cpp', 'platform/graphics/chromium/cc/CCIOSurfaceDrawQuad.h', 'platform/graphics/chromium/cc/CCIOSurfaceLayerImpl.cpp', 'platform/graphics/chromium/cc/CCIOSurfaceLayerImpl.h', @@ -8373,19 +8378,15 @@ 'platform/graphics/chromium/cc/CCScrollbarLayerImpl.h', 'platform/graphics/chromium/cc/CCSettings.cpp', 'platform/graphics/chromium/cc/CCSettings.h', - 'platform/graphics/chromium/cc/CCSharedQuadState.cpp', 'platform/graphics/chromium/cc/CCSharedQuadState.h', 'platform/graphics/chromium/cc/CCSingleThreadProxy.cpp', 'platform/graphics/chromium/cc/CCSingleThreadProxy.h', - 'platform/graphics/chromium/cc/CCSolidColorDrawQuad.cpp', 'platform/graphics/chromium/cc/CCSolidColorDrawQuad.h', 'platform/graphics/chromium/cc/CCSolidColorLayerImpl.cpp', 'platform/graphics/chromium/cc/CCSolidColorLayerImpl.h', - 'platform/graphics/chromium/cc/CCStreamVideoDrawQuad.cpp', 'platform/graphics/chromium/cc/CCStreamVideoDrawQuad.h', 'platform/graphics/chromium/cc/CCTexture.cpp', 'platform/graphics/chromium/cc/CCTexture.h', - 'platform/graphics/chromium/cc/CCTextureDrawQuad.cpp', 'platform/graphics/chromium/cc/CCTextureDrawQuad.h', 'platform/graphics/chromium/cc/CCTextureLayerImpl.cpp', 'platform/graphics/chromium/cc/CCTextureLayerImpl.h', @@ -8395,7 +8396,6 @@ 'platform/graphics/chromium/cc/CCThreadProxy.cpp', 'platform/graphics/chromium/cc/CCThreadProxy.h', 'platform/graphics/chromium/cc/CCThreadTask.h', - 'platform/graphics/chromium/cc/CCTileDrawQuad.cpp', 'platform/graphics/chromium/cc/CCTileDrawQuad.h', 'platform/graphics/chromium/cc/CCTiledLayerImpl.cpp', 'platform/graphics/chromium/cc/CCTiledLayerImpl.h', diff --git a/Source/WebCore/WebCore.order b/Source/WebCore/WebCore.order index 3b2b3f651..e1abbec66 100644 --- a/Source/WebCore/WebCore.order +++ b/Source/WebCore/WebCore.order @@ -16000,7 +16000,6 @@ __ZN7WebCore20endOfEditableContentERKNS_15VisiblePositionE __ZNK7WebCore21BackForwardController9backCountEv __ZN7WebCore19BackForwardListImpl13backListCountEv __ZNK7WebCore21BackForwardController12forwardCountEv -__ZN7WebCore12base64DecodeERKN3WTF6StringERNS0_6VectorIcLm0EEENS_18Base64DecodePolicyE __ZN3WTF9HashTableINS_6StringESt4pairIS1_PNS_6VectorINS_6RefPtrIN7WebCore11CSSFontFaceEEELm0EEEENS_18PairFirstExtractorISA_EENS_15CaseFoldingHashENS_14PairHashTraitsINS_10HashTraitsIS1_EENSF_IS9_EEEESG_E16lookupForWritingIS1_NS_22IdentityHashTranslatorIS1_SA_SD_EEEES2_IPSA_bERKT_ __ZN3WTF9HashTableINS_6StringESt4pairIS1_PNS_6VectorINS_6RefPtrIN7WebCore11CSSFontFaceEEELm0EEEENS_18PairFirstExtractorISA_EENS_15CaseFoldingHashENS_14PairHashTraitsINS_10HashTraitsIS1_EENSF_IS9_EEEESG_E3addIS1_S9_NS_17HashMapTranslatorISA_SI_SD_EEEES2_INS_17HashTableIteratorIS1_SA_SC_SD_SI_SG_EEbERKT_RKT0_ __ZN3WTF9HashTableINS_6StringESt4pairIS1_PNS_6VectorINS_6RefPtrIN7WebCore11CSSFontFaceEEELm0EEEENS_18PairFirstExtractorISA_EENS_15CaseFoldingHashENS_14PairHashTraitsINS_10HashTraitsIS1_EENSF_IS9_EEEESG_E6lookupIS1_NS_22IdentityHashTranslatorIS1_SA_SD_EEEEPSA_RKT_ diff --git a/Source/WebCore/WebCore.pri b/Source/WebCore/WebCore.pri index 0d60155cf..b399bc292 100644 --- a/Source/WebCore/WebCore.pri +++ b/Source/WebCore/WebCore.pri @@ -8,7 +8,7 @@ SOURCE_DIR = $${ROOT_WEBKIT_DIR}/Source/WebCore QT *= network sql -haveQt(5): QT *= gui-private +haveQt(5): QT *= core-private gui-private WEBCORE_GENERATED_SOURCES_DIR = $${ROOT_BUILD_DIR}/Source/WebCore/$${GENERATED_SOURCES_DESTDIR} @@ -18,6 +18,7 @@ INCLUDEPATH += \ $$SOURCE_DIR/Modules/geolocation \ $$SOURCE_DIR/Modules/indexeddb \ $$SOURCE_DIR/Modules/notifications \ + $$SOURCE_DIR/Modules/protocolhandler \ $$SOURCE_DIR/Modules/quota \ $$SOURCE_DIR/Modules/webaudio \ $$SOURCE_DIR/Modules/webdatabase \ @@ -203,6 +204,7 @@ contains(DEFINES, ENABLE_VIDEO=1) { contains(DEFINES, WTF_USE_3D_GRAPHICS=1) { contains(QT_CONFIG, opengles2): LIBS += -lEGL mac: LIBS += -framework IOSurface -framework CoreFoundation + linux-*:contains(DEFINES, HAVE_XCOMPOSITE=1): LIBS += -lXcomposite # Only WebKit1 needs the opengl module, so it's optional for Qt5. haveQt(4)|contains(QT_CONFIG, opengl): QT *= opengl } diff --git a/Source/WebCore/WebCore.vcproj/WebCore.vcproj b/Source/WebCore/WebCore.vcproj/WebCore.vcproj index 9062c8b23..53b224c3b 100755 --- a/Source/WebCore/WebCore.vcproj/WebCore.vcproj +++ b/Source/WebCore/WebCore.vcproj/WebCore.vcproj @@ -24927,6 +24927,18 @@ </File> </Filter> <Filter + Name="protocolhandler" + > + <File + RelativePath="..\Modules\protocolhandler\NavigatorRegisterProtocolHandler.cpp" + > + </File> + <File + RelativePath="..\Modules\protocolhandler\NavigatorRegisterProtocolHandler.h" + > + </File> + </Filter> + <Filter Name="quota" > <File @@ -26835,14 +26847,6 @@ > </File> <File - RelativePath="..\page\NavigatorRegisterProtocolHandler.cpp" - > - </File> - <File - RelativePath="..\page\NavigatorRegisterProtocolHandler.h" - > - </File> - <File RelativePath="..\page\OriginAccessEntry.cpp" > </File> @@ -31545,6 +31549,10 @@ > </File> <File + RelativePath="..\platform\graphics\filters\arm\FEBlendNEON.h" + > + </File> + <File RelativePath="..\platform\graphics\filters\FEColorMatrix.cpp" > </File> @@ -33214,18 +33222,6 @@ Name="text" > <File - RelativePath="..\platform\text\AtomicStringImpl.h" - > - </File> - <File - RelativePath="..\platform\text\Base64.cpp" - > - </File> - <File - RelativePath="..\platform\text\Base64.h" - > - </File> - <File RelativePath="..\platform\text\BidiContext.cpp" > </File> @@ -51195,6 +51191,118 @@ > </File> <File + RelativePath="..\dom\IdTargetObserver.cpp" + > + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Cairo_CFLite|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release_Cairo_CFLite|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_All|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Production|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\dom\IdTargetObserver.h" + > + </File> + <File + RelativePath="..\dom\IdTargetObserverRegistry.cpp" + > + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Cairo_CFLite|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release_Cairo_CFLite|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_All|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Production|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\dom\IdTargetObserverRegistry.h" + > + </File> + <File RelativePath="..\dom\IgnoreDestructiveWriteCountIncrementer.h" > </File> @@ -54506,6 +54614,62 @@ RelativePath="..\dom\WebKitNamedFlow.h" > </File> + <File + RelativePath="..\dom\WebKitNamedFlowCollection.cpp" + > + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Cairo_CFLite|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release_Cairo_CFLite|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_All|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Production|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\dom\WebKitNamedFlowCollection.h" + > + </File> <File RelativePath="..\dom\WebKitTransitionEvent.cpp" > diff --git a/Source/WebCore/WebCore.vcproj/WebCoreCommon.vsprops b/Source/WebCore/WebCore.vcproj/WebCoreCommon.vsprops index 0641d65a0..12e87676c 100644 --- a/Source/WebCore/WebCore.vcproj/WebCoreCommon.vsprops +++ b/Source/WebCore/WebCore.vcproj/WebCoreCommon.vsprops @@ -7,7 +7,7 @@ > <Tool Name="VCCLCompilerTool" - AdditionalIncludeDirectories=""$(ProjectDir)..";"$(ProjectDir)..\Modules\filesystem";"$(ProjectDir)..\Modules\geolocation";"$(ProjectDir)..\Modules\indexeddb";"$(ProjectDir)..\Modules\quota";"$(ProjectDir)..\Modules\notifications";"$(ProjectDir)..\Modules\webdatabase";"$(ProjectDir)..\Modules\websockets";"$(ProjectDir)..\accessibility";"$(ProjectDir)..\accessibility\win";"$(ProjectDir)..\bridge";"$(ProjectDir)..\bridge\c";"$(ProjectDir)..\bridge\jsc";"$(ProjectDir)..\css";"$(ProjectDir)..\editing";"$(ProjectDir)..\fileapi";"$(ProjectDir)..\rendering";"$(ProjectDir)..\rendering\mathml";"$(ProjectDir)..\rendering\style";"$(ProjectDir)..\rendering\svg";"$(ProjectDir)..\bindings";"$(ProjectDir)..\bindings\generic";"$(ProjectDir)..\bindings\js";"$(ProjectDir)..\bindings\js\specialization";"$(ProjectDir)..\dom";"$(ProjectDir)..\dom\default";"$(ProjectDir)..\history";"$(ProjectDir)..\html";"$(ProjectDir)..\html\canvas";"$(ProjectDir)..\html\parser";"$(ProjectDir)..\html\shadow";"$(ProjectDir)..\inspector";"$(ProjectDir)..\loader";"$(ProjectDir)..\loader\appcache";"$(ProjectDir)..\loader\archive";"$(ProjectDir)..\loader\archive\cf";"$(ProjectDir)..\loader\cache";"$(ProjectDir)..\loader\icon";"$(ProjectDir)..\mathml";"$(ProjectDir)..\page";"$(ProjectDir)..\page\animation";"$(ProjectDir)..\page\scrolling";"$(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\ca";"$(ProjectDir)..\platform\graphics\filters";"$(ProjectDir)..\platform\graphics\filters\arm";"$(ProjectDir)..\platform\graphics\opentype";"$(ProjectDir)..\platform\graphics\transforms";"$(ProjectDir)..\platform\text";"$(ProjectDir)..\platform\text\transcoder";"$(ProjectDir)..\platform\graphics\win";"$(ProjectDir)..\xml";"$(ProjectDir)..\xml\parser";"$(ConfigurationBuildDir)\obj\WebCore\DerivedSources";"$(ProjectDir)..\plugins";"$(ProjectDir)..\plugins\win";"$(ProjectDir)..\svg\animation";"$(ProjectDir)..\svg\graphics";"$(ProjectDir)..\svg\properties";"$(ProjectDir)..\svg\graphics\filters";"$(ProjectDir)..\svg";"$(ProjectDir)..\testing";"$(ProjectDir)..\wml";"$(ProjectDir)..\storage";"$(ProjectDir)..\websockets";"$(ProjectDir)..\workers";"$(ConfigurationBuildDir)\include";"$(ConfigurationBuildDir)\include\private";"$(ConfigurationBuildDir)\include\JavaScriptCore";"$(ConfigurationBuildDir)\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"" + AdditionalIncludeDirectories=""$(ProjectDir)..";"$(ProjectDir)..\Modules\filesystem";"$(ProjectDir)..\Modules\geolocation";"$(ProjectDir)..\Modules\indexeddb";"$(ProjectDir)..\Modules\protocolhandler";"$(ProjectDir)..\Modules\quota";"$(ProjectDir)..\Modules\notifications";"$(ProjectDir)..\Modules\webdatabase";"$(ProjectDir)..\Modules\websockets";"$(ProjectDir)..\accessibility";"$(ProjectDir)..\accessibility\win";"$(ProjectDir)..\bridge";"$(ProjectDir)..\bridge\c";"$(ProjectDir)..\bridge\jsc";"$(ProjectDir)..\css";"$(ProjectDir)..\editing";"$(ProjectDir)..\fileapi";"$(ProjectDir)..\rendering";"$(ProjectDir)..\rendering\mathml";"$(ProjectDir)..\rendering\style";"$(ProjectDir)..\rendering\svg";"$(ProjectDir)..\bindings";"$(ProjectDir)..\bindings\generic";"$(ProjectDir)..\bindings\js";"$(ProjectDir)..\bindings\js\specialization";"$(ProjectDir)..\dom";"$(ProjectDir)..\dom\default";"$(ProjectDir)..\history";"$(ProjectDir)..\html";"$(ProjectDir)..\html\canvas";"$(ProjectDir)..\html\parser";"$(ProjectDir)..\html\shadow";"$(ProjectDir)..\inspector";"$(ProjectDir)..\loader";"$(ProjectDir)..\loader\appcache";"$(ProjectDir)..\loader\archive";"$(ProjectDir)..\loader\archive\cf";"$(ProjectDir)..\loader\cache";"$(ProjectDir)..\loader\icon";"$(ProjectDir)..\mathml";"$(ProjectDir)..\page";"$(ProjectDir)..\page\animation";"$(ProjectDir)..\page\scrolling";"$(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\ca";"$(ProjectDir)..\platform\graphics\filters";"$(ProjectDir)..\platform\graphics\filters\arm";"$(ProjectDir)..\platform\graphics\opentype";"$(ProjectDir)..\platform\graphics\transforms";"$(ProjectDir)..\platform\text";"$(ProjectDir)..\platform\text\transcoder";"$(ProjectDir)..\platform\graphics\win";"$(ProjectDir)..\xml";"$(ProjectDir)..\xml\parser";"$(ConfigurationBuildDir)\obj\WebCore\DerivedSources";"$(ProjectDir)..\plugins";"$(ProjectDir)..\plugins\win";"$(ProjectDir)..\svg\animation";"$(ProjectDir)..\svg\graphics";"$(ProjectDir)..\svg\properties";"$(ProjectDir)..\svg\graphics\filters";"$(ProjectDir)..\svg";"$(ProjectDir)..\testing";"$(ProjectDir)..\wml";"$(ProjectDir)..\storage";"$(ProjectDir)..\websockets";"$(ProjectDir)..\workers";"$(ConfigurationBuildDir)\include";"$(ConfigurationBuildDir)\include\private";"$(ConfigurationBuildDir)\include\JavaScriptCore";"$(ConfigurationBuildDir)\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/Source/WebCore/WebCore.vcproj/copyForwardingHeaders.cmd b/Source/WebCore/WebCore.vcproj/copyForwardingHeaders.cmd index 83f1f0317..0917cd791 100755 --- a/Source/WebCore/WebCore.vcproj/copyForwardingHeaders.cmd +++ b/Source/WebCore/WebCore.vcproj/copyForwardingHeaders.cmd @@ -21,8 +21,9 @@ xcopy /y /d "%ProjectDir%..\config.h" "%CONFIGURATIONBUILDDIR%\include\WebCore" xcopy /y /d "%CONFIGURATIONBUILDDIR%\obj\WebCore\DerivedSources\*.h" "%CONFIGURATIONBUILDDIR%\include\WebCore" xcopy /y /d "%ProjectDir%..\Modules\filesystem\*.h" "%CONFIGURATIONBUILDDIR%\include\WebCore" xcopy /y /d "%ProjectDir%..\Modules\geolocation\*.h" "%CONFIGURATIONBUILDDIR%\include\WebCore" -xcopy /y /d "%ProjectDir%..\Modules\quota\*.h" "%CONFIGURATIONBUILDDIR%\include\WebCore" xcopy /y /d "%ProjectDir%..\Modules\notifications\*.h" "%CONFIGURATIONBUILDDIR%\include\WebCore" +xcopy /y /d "%ProjectDir%..\Modules\protocolhandler\*.h" "%CONFIGURATIONBUILDDIR%\include\WebCore" +xcopy /y /d "%ProjectDir%..\Modules\quota\*.h" "%CONFIGURATIONBUILDDIR%\include\WebCore" xcopy /y /d "%ProjectDir%..\Modules\webdatabase\*.h" "%CONFIGURATIONBUILDDIR%\include\WebCore" xcopy /y /d "%ProjectDir%..\Modules\websockets\*.h" "%CONFIGURATIONBUILDDIR%\include\WebCore" xcopy /y /d "%ProjectDir%..\accessibility\*.h" "%CONFIGURATIONBUILDDIR%\include\WebCore" diff --git a/Source/WebCore/WebCore.xcodeproj/project.pbxproj b/Source/WebCore/WebCore.xcodeproj/project.pbxproj index c126c95af..da4730919 100644 --- a/Source/WebCore/WebCore.xcodeproj/project.pbxproj +++ b/Source/WebCore/WebCore.xcodeproj/project.pbxproj @@ -281,6 +281,8 @@ 0FF50271102BA96A0066F39A /* StyleMedia.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0FF5026E102BA9660066F39A /* StyleMedia.cpp */; }; 0FF50272102BA96A0066F39A /* StyleMedia.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FF5026F102BA96A0066F39A /* StyleMedia.h */; }; 10FB084B14E15C7E00A3DB98 /* PublicURLManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 10FB084A14E15C7E00A3DB98 /* PublicURLManager.h */; }; + 12F35EB6158745A40035CB63 /* WebKitNamedFlowCollection.h in Headers */ = {isa = PBXBuildFile; fileRef = 12F35EB4158745A40035CB63 /* WebKitNamedFlowCollection.h */; }; + 12F35EB7158745A40035CB63 /* WebKitNamedFlowCollection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 12F35EB5158745A40035CB63 /* WebKitNamedFlowCollection.cpp */; }; 1402645E0AFDC19B005919E2 /* LoggingMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1402645D0AFDC19B005919E2 /* LoggingMac.mm */; }; 1403B99709EB13AF00797C7F /* DOMWindow.h in Headers */ = {isa = PBXBuildFile; fileRef = 1403B99509EB13AF00797C7F /* DOMWindow.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1403B99809EB13AF00797C7F /* DOMWindow.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1403B99609EB13AF00797C7F /* DOMWindow.cpp */; }; @@ -1868,7 +1870,6 @@ 75793ED50D0CE85B007FC0AC /* DOMMessageEventInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 75793ED20D0CE85B007FC0AC /* DOMMessageEventInternal.h */; }; 758978EC127090D60076D5A9 /* SpeechInputResult.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 758978EA127090D60076D5A9 /* SpeechInputResult.cpp */; }; 762F1ED7159D960A007408F2 /* HTMLDialogElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 762F1ED6159D960A007408F2 /* HTMLDialogElement.h */; }; - 762F1ED9159D961A007408F2 /* HTMLDialogElement.idl in Resources */ = {isa = PBXBuildFile; fileRef = 762F1ED8159D961A007408F2 /* HTMLDialogElement.idl */; }; 762F1EDB159D968A007408F2 /* HTMLDialogElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 762F1EDA159D968A007408F2 /* HTMLDialogElement.cpp */; }; 7633A72613D8B33A008501B6 /* LocaleToScriptMapping.h in Headers */ = {isa = PBXBuildFile; fileRef = 7633A72413D8B33A008501B6 /* LocaleToScriptMapping.h */; }; 7633A72713D8B33A008501B6 /* LocaleToScriptMappingDefault.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7633A72513D8B33A008501B6 /* LocaleToScriptMappingDefault.cpp */; }; @@ -3643,8 +3644,6 @@ 97DCE20210807C750057D394 /* HistoryController.h in Headers */ = {isa = PBXBuildFile; fileRef = 97DCE20010807C750057D394 /* HistoryController.h */; settings = {ATTRIBUTES = (Private, ); }; }; 97E4028F13A696ED00913D67 /* IconController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 97E4028D13A696ED00913D67 /* IconController.cpp */; }; 97E4029013A696ED00913D67 /* IconController.h in Headers */ = {isa = PBXBuildFile; fileRef = 97E4028E13A696ED00913D67 /* IconController.h */; settings = {ATTRIBUTES = (Private, ); }; }; - 97E4A12614F4C5D400870E43 /* NavigatorRegisterProtocolHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = 9730BE1514EF286B00DF06B9 /* NavigatorRegisterProtocolHandler.h */; }; - 97E4A12714F4C5D700870E43 /* NavigatorRegisterProtocolHandler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9730BE1414EF286B00DF06B9 /* NavigatorRegisterProtocolHandler.cpp */; }; 97EF7DFE107E55B700D7C49C /* ScriptControllerBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 97EF7DFD107E55B700D7C49C /* ScriptControllerBase.cpp */; }; 97F8E665151D4A4B00D2D181 /* WorkerContextNotifications.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 97F8E661151D4A3F00D2D181 /* WorkerContextNotifications.cpp */; }; 97F8E666151D4A4E00D2D181 /* WorkerContextNotifications.h in Headers */ = {isa = PBXBuildFile; fileRef = 97F8E662151D4A3F00D2D181 /* WorkerContextNotifications.h */; }; @@ -4873,8 +4872,6 @@ B2B1F7170D00CAA8004AEA64 /* PointerEventsHitRules.h in Headers */ = {isa = PBXBuildFile; fileRef = B2B1F7150D00CAA8004AEA64 /* PointerEventsHitRules.h */; }; B2B2645C0D00A77E000ACC1D /* StringCF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B2B2645A0D00A77E000ACC1D /* StringCF.cpp */; }; B2B2645D0D00A77E000ACC1D /* StringImplCF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B2B2645B0D00A77E000ACC1D /* StringImplCF.cpp */; }; - B2C3DA210D006C1D00EF6F26 /* Base64.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B2C3D9F00D006C1D00EF6F26 /* Base64.cpp */; }; - B2C3DA220D006C1D00EF6F26 /* Base64.h in Headers */ = {isa = PBXBuildFile; fileRef = B2C3D9F10D006C1D00EF6F26 /* Base64.h */; settings = {ATTRIBUTES = (Private, ); }; }; B2C3DA230D006C1D00EF6F26 /* BidiContext.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B2C3D9F20D006C1D00EF6F26 /* BidiContext.cpp */; }; B2C3DA240D006C1D00EF6F26 /* BidiContext.h in Headers */ = {isa = PBXBuildFile; fileRef = B2C3D9F30D006C1D00EF6F26 /* BidiContext.h */; settings = {ATTRIBUTES = (Private, ); }; }; B2C3DA250D006C1D00EF6F26 /* BidiResolver.h in Headers */ = {isa = PBXBuildFile; fileRef = B2C3D9F40D006C1D00EF6F26 /* BidiResolver.h */; settings = {ATTRIBUTES = (Private, ); }; }; @@ -5727,6 +5724,10 @@ C33EE5C414FB49610002095A /* BaseClickableWithKeyInputType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C33EE5C214FB49610002095A /* BaseClickableWithKeyInputType.cpp */; }; C33EE5C514FB49610002095A /* BaseClickableWithKeyInputType.h in Headers */ = {isa = PBXBuildFile; fileRef = C33EE5C314FB49610002095A /* BaseClickableWithKeyInputType.h */; }; C37CDEBD149EF2030042090D /* ColorChooserClient.h in Headers */ = {isa = PBXBuildFile; fileRef = C37CDEBC149EF2030042090D /* ColorChooserClient.h */; settings = {ATTRIBUTES = (Private, ); }; }; + C3CF17A415B0063F00276D39 /* IdTargetObserver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C3CF17A015B0063F00276D39 /* IdTargetObserver.cpp */; }; + C3CF17A515B0063F00276D39 /* IdTargetObserver.h in Headers */ = {isa = PBXBuildFile; fileRef = C3CF17A115B0063F00276D39 /* IdTargetObserver.h */; settings = {ATTRIBUTES = (Private, ); }; }; + C3CF17A615B0063F00276D39 /* IdTargetObserverRegistry.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C3CF17A215B0063F00276D39 /* IdTargetObserverRegistry.cpp */; }; + C3CF17A715B0063F00276D39 /* IdTargetObserverRegistry.h in Headers */ = {isa = PBXBuildFile; fileRef = C3CF17A315B0063F00276D39 /* IdTargetObserverRegistry.h */; settings = {ATTRIBUTES = (Private, ); }; }; C50B561612119D23008B46E0 /* GroupSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C50B561412119D23008B46E0 /* GroupSettings.cpp */; }; C50B561712119D23008B46E0 /* GroupSettings.h in Headers */ = {isa = PBXBuildFile; fileRef = C50B561512119D23008B46E0 /* GroupSettings.h */; settings = {ATTRIBUTES = (Private, ); }; }; C50D0E820FF4272900AC2644 /* StorageNamespace.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C50D0E800FF4272900AC2644 /* StorageNamespace.cpp */; }; @@ -6167,6 +6168,11 @@ F4EAF4AF10C742B1009100D3 /* OpenTypeSanitizer.h in Headers */ = {isa = PBXBuildFile; fileRef = F4EAF4AD10C742B1009100D3 /* OpenTypeSanitizer.h */; }; F50664F7157F52DC00AC226F /* FormController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F50664F5157F52DC00AC226F /* FormController.cpp */; }; F50664F8157F52DC00AC226F /* FormController.h in Headers */ = {isa = PBXBuildFile; fileRef = F50664F6157F52DC00AC226F /* FormController.h */; }; + F50824691548D89A00A119AB /* PagePopup.h in Headers */ = {isa = PBXBuildFile; fileRef = F50824681548D89A00A119AB /* PagePopup.h */; }; + F508246B1548D8E100A119AB /* PagePopupClient.h in Headers */ = {isa = PBXBuildFile; fileRef = F508246A1548D8E100A119AB /* PagePopupClient.h */; }; + F508246E1548D96200A119AB /* MockPagePopupDriver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F508246C1548D96200A119AB /* MockPagePopupDriver.cpp */; }; + F508246F1548D96200A119AB /* MockPagePopupDriver.h in Headers */ = {isa = PBXBuildFile; fileRef = F508246D1548D96200A119AB /* MockPagePopupDriver.h */; }; + F5122C901547FA1B0028A93B /* PagePopupDriver.h in Headers */ = {isa = PBXBuildFile; fileRef = F5122C8F1547FA1B0028A93B /* PagePopupDriver.h */; }; F5142C69123F12B000F5BD4C /* LocalizedNumber.h in Headers */ = {isa = PBXBuildFile; fileRef = F5142C68123F12B000F5BD4C /* LocalizedNumber.h */; }; F52AD5E41534245F0059FBE6 /* EmptyClients.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F52AD5E31534245F0059FBE6 /* EmptyClients.cpp */; }; F55B3DAD1251F12D003EF269 /* BaseTextInputType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F55B3D791251F12D003EF269 /* BaseTextInputType.cpp */; }; @@ -7236,6 +7242,8 @@ 0FF5026F102BA96A0066F39A /* StyleMedia.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StyleMedia.h; sourceTree = "<group>"; }; 0FF50270102BA96A0066F39A /* StyleMedia.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = StyleMedia.idl; sourceTree = "<group>"; }; 10FB084A14E15C7E00A3DB98 /* PublicURLManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PublicURLManager.h; sourceTree = "<group>"; }; + 12F35EB4158745A40035CB63 /* WebKitNamedFlowCollection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebKitNamedFlowCollection.h; sourceTree = "<group>"; }; + 12F35EB5158745A40035CB63 /* WebKitNamedFlowCollection.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebKitNamedFlowCollection.cpp; sourceTree = "<group>"; }; 1402645D0AFDC19B005919E2 /* LoggingMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = LoggingMac.mm; sourceTree = "<group>"; }; 1403B90C09EB124500797C7F /* DOMWindow.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = DOMWindow.idl; sourceTree = "<group>"; }; 1403B99509EB13AF00797C7F /* DOMWindow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMWindow.h; sourceTree = "<group>"; }; @@ -8991,8 +8999,8 @@ 762F1EDA159D968A007408F2 /* HTMLDialogElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLDialogElement.cpp; sourceTree = "<group>"; }; 7633A72413D8B33A008501B6 /* LocaleToScriptMapping.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LocaleToScriptMapping.h; sourceTree = "<group>"; }; 7633A72513D8B33A008501B6 /* LocaleToScriptMappingDefault.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LocaleToScriptMappingDefault.cpp; sourceTree = "<group>"; }; - 76808B4D159DADFA002B5233 /* JSHTMLDialogElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JSHTMLDialogElement.cpp; path = JSHTMLDialogElement.cpp; sourceTree = "<group>"; }; - 76808B4E159DADFA002B5233 /* JSHTMLDialogElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSHTMLDialogElement.h; path = JSHTMLDialogElement.h; sourceTree = "<group>"; }; + 76808B4D159DADFA002B5233 /* JSHTMLDialogElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLDialogElement.cpp; sourceTree = "<group>"; }; + 76808B4E159DADFA002B5233 /* JSHTMLDialogElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSHTMLDialogElement.h; sourceTree = "<group>"; }; 7694563A1214D97C0007CBAE /* JSDOMTokenList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDOMTokenList.cpp; sourceTree = "<group>"; }; 7694563B1214D97C0007CBAE /* JSDOMTokenList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSDOMTokenList.h; sourceTree = "<group>"; }; 769456591214DB630007CBAE /* DOMDOMTokenList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMDOMTokenList.h; sourceTree = "<group>"; }; @@ -10326,6 +10334,7 @@ 938192040F87E1EC00D5352A /* BinaryPropertyList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BinaryPropertyList.h; sourceTree = "<group>"; }; 9382AAB10D8C386100F357A6 /* NodeWithIndex.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NodeWithIndex.h; sourceTree = "<group>"; }; 9382DF5710A8D5C900925652 /* ColorSpace.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ColorSpace.h; sourceTree = "<group>"; }; + 938C496815AD67E300FCB2E1 /* FEBlendNEON.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FEBlendNEON.h; sourceTree = "<group>"; }; 938E65F009F09840008A48EC /* JSHTMLElementWrapperFactory.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSHTMLElementWrapperFactory.h; sourceTree = "<group>"; }; 938E65F609F0985D008A48EC /* JSHTMLElementWrapperFactory.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLElementWrapperFactory.cpp; sourceTree = "<group>"; }; 938E662509F09956008A48EC /* HTMLCanvasElement.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = HTMLCanvasElement.idl; sourceTree = "<group>"; }; @@ -10542,9 +10551,6 @@ 97205ABA1239292700B17380 /* PluginDocument.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PluginDocument.h; sourceTree = "<group>"; }; 9728C3111268E4390041E89B /* MarkupAccumulator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MarkupAccumulator.cpp; sourceTree = "<group>"; }; 9728C3121268E4390041E89B /* MarkupAccumulator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MarkupAccumulator.h; sourceTree = "<group>"; }; - 9730BE1414EF286B00DF06B9 /* NavigatorRegisterProtocolHandler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NavigatorRegisterProtocolHandler.cpp; sourceTree = "<group>"; }; - 9730BE1514EF286B00DF06B9 /* NavigatorRegisterProtocolHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NavigatorRegisterProtocolHandler.h; sourceTree = "<group>"; }; - 9730BE1614EF286B00DF06B9 /* NavigatorRegisterProtocolHandler.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = NavigatorRegisterProtocolHandler.idl; sourceTree = "<group>"; }; 9738899E116EA9DC00ADF313 /* DocumentWriter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DocumentWriter.cpp; sourceTree = "<group>"; }; 9738899F116EA9DC00ADF313 /* DocumentWriter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DocumentWriter.h; sourceTree = "<group>"; }; 973DC63D145A9409002842C2 /* ExceptionCodeDescription.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ExceptionCodeDescription.cpp; sourceTree = "<group>"; }; @@ -12058,8 +12064,6 @@ B2B1F7150D00CAA8004AEA64 /* PointerEventsHitRules.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = PointerEventsHitRules.h; sourceTree = "<group>"; }; B2B2645A0D00A77E000ACC1D /* StringCF.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = StringCF.cpp; sourceTree = "<group>"; }; B2B2645B0D00A77E000ACC1D /* StringImplCF.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = StringImplCF.cpp; sourceTree = "<group>"; }; - B2C3D9F00D006C1D00EF6F26 /* Base64.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Base64.cpp; sourceTree = "<group>"; }; - B2C3D9F10D006C1D00EF6F26 /* Base64.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Base64.h; sourceTree = "<group>"; }; B2C3D9F20D006C1D00EF6F26 /* BidiContext.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = BidiContext.cpp; sourceTree = "<group>"; }; B2C3D9F30D006C1D00EF6F26 /* BidiContext.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = BidiContext.h; sourceTree = "<group>"; }; B2C3D9F40D006C1D00EF6F26 /* BidiResolver.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = BidiResolver.h; sourceTree = "<group>"; }; @@ -12949,6 +12953,10 @@ C33EE5C214FB49610002095A /* BaseClickableWithKeyInputType.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BaseClickableWithKeyInputType.cpp; sourceTree = "<group>"; }; C33EE5C314FB49610002095A /* BaseClickableWithKeyInputType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BaseClickableWithKeyInputType.h; sourceTree = "<group>"; }; C37CDEBC149EF2030042090D /* ColorChooserClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ColorChooserClient.h; sourceTree = "<group>"; }; + C3CF17A015B0063F00276D39 /* IdTargetObserver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IdTargetObserver.cpp; sourceTree = "<group>"; }; + C3CF17A115B0063F00276D39 /* IdTargetObserver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IdTargetObserver.h; sourceTree = "<group>"; }; + C3CF17A215B0063F00276D39 /* IdTargetObserverRegistry.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IdTargetObserverRegistry.cpp; sourceTree = "<group>"; }; + C3CF17A315B0063F00276D39 /* IdTargetObserverRegistry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IdTargetObserverRegistry.h; sourceTree = "<group>"; }; C50B561412119D23008B46E0 /* GroupSettings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GroupSettings.cpp; sourceTree = "<group>"; }; C50B561512119D23008B46E0 /* GroupSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GroupSettings.h; sourceTree = "<group>"; }; C50D0E800FF4272900AC2644 /* StorageNamespace.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StorageNamespace.cpp; sourceTree = "<group>"; }; @@ -13451,6 +13459,11 @@ F4EAF4AD10C742B1009100D3 /* OpenTypeSanitizer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OpenTypeSanitizer.h; path = opentype/OpenTypeSanitizer.h; sourceTree = "<group>"; }; F50664F5157F52DC00AC226F /* FormController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FormController.cpp; sourceTree = "<group>"; }; F50664F6157F52DC00AC226F /* FormController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FormController.h; sourceTree = "<group>"; }; + F50824681548D89A00A119AB /* PagePopup.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PagePopup.h; sourceTree = "<group>"; }; + F508246A1548D8E100A119AB /* PagePopupClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PagePopupClient.h; sourceTree = "<group>"; }; + F508246C1548D96200A119AB /* MockPagePopupDriver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = MockPagePopupDriver.cpp; path = testing/MockPagePopupDriver.cpp; sourceTree = SOURCE_ROOT; }; + F508246D1548D96200A119AB /* MockPagePopupDriver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MockPagePopupDriver.h; path = testing/MockPagePopupDriver.h; sourceTree = SOURCE_ROOT; }; + F5122C8F1547FA1B0028A93B /* PagePopupDriver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PagePopupDriver.h; sourceTree = "<group>"; }; F5142C68123F12B000F5BD4C /* LocalizedNumber.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LocalizedNumber.h; sourceTree = "<group>"; }; F523D23B02DE4396018635CA /* HTMLDocument.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLDocument.cpp; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; F523D23C02DE4396018635CA /* HTMLDocument.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = HTMLDocument.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; @@ -15117,11 +15130,12 @@ 49ECEB5C1499790D00CDD3A4 /* arm */ = { isa = PBXGroup; children = ( + 938C496815AD67E300FCB2E1 /* FEBlendNEON.h */, 49ECEB5E1499790D00CDD3A4 /* FECompositeArithmeticNEON.h */, 49ECEB601499790D00CDD3A4 /* FEGaussianBlurNEON.h */, - 930062D7159B45B600ACD48A /* NEONHelpers.h */, 49ECEB611499790D00CDD3A4 /* FELightingNEON.cpp */, 49ECEB621499790D00CDD3A4 /* FELightingNEON.h */, + 930062D7159B45B600ACD48A /* NEONHelpers.h */, ); name = arm; path = filters/arm; @@ -15629,6 +15643,8 @@ 9FFE3E7811B59C5D0037874E /* MemoryInfo.cpp */, 9FFE3E7911B59C5D0037874E /* MemoryInfo.h */, 9FFE3E7C11B59C6E0037874E /* MemoryInfo.idl */, + F508246C1548D96200A119AB /* MockPagePopupDriver.cpp */, + F508246D1548D96200A119AB /* MockPagePopupDriver.h */, 93EB355E09E37FD600F43799 /* MouseEventWithHitTestResults.cpp */, 935C476209AC4CE600A6AAB4 /* MouseEventWithHitTestResults.h */, A9C6E5A30D746458006442E9 /* Navigator.cpp */, @@ -15636,9 +15652,6 @@ A9C6E65D0D746694006442E9 /* Navigator.idl */, E12719C90EEEC21300F61213 /* NavigatorBase.cpp */, E12719C60EEEC16800F61213 /* NavigatorBase.h */, - 9730BE1414EF286B00DF06B9 /* NavigatorRegisterProtocolHandler.cpp */, - 9730BE1514EF286B00DF06B9 /* NavigatorRegisterProtocolHandler.h */, - 9730BE1614EF286B00DF06B9 /* NavigatorRegisterProtocolHandler.idl */, 00146288103CD1DE000B20DB /* OriginAccessEntry.cpp */, 00146289103CD1DE000B20DB /* OriginAccessEntry.h */, 65FEA86809833ADE00BED4AB /* Page.cpp */, @@ -15647,6 +15660,9 @@ 9302B0BE0D79F82C00C7EE83 /* PageGroup.h */, 7A674BD90F9EBF4E006CF099 /* PageGroupLoadDeferrer.cpp */, 7A674BDA0F9EBF4E006CF099 /* PageGroupLoadDeferrer.h */, + F50824681548D89A00A119AB /* PagePopup.h */, + F508246A1548D8E100A119AB /* PagePopupClient.h */, + F5122C8F1547FA1B0028A93B /* PagePopupDriver.h */, 371E65CD13661EED00BEEDB0 /* PageSerializer.cpp */, 371E65CB13661EDC00BEEDB0 /* PageSerializer.h */, FFD5B977135CC97800D5E92A /* PageVisibilityState.cpp */, @@ -17218,8 +17234,8 @@ D359D787129CA2710006E5D2 /* HTMLDetailsElement.h */, D359D788129CA2710006E5D2 /* HTMLDetailsElement.idl */, 762F1EDA159D968A007408F2 /* HTMLDialogElement.cpp */, - 762F1ED8159D961A007408F2 /* HTMLDialogElement.idl */, 762F1ED6159D960A007408F2 /* HTMLDialogElement.h */, + 762F1ED8159D961A007408F2 /* HTMLDialogElement.idl */, A8EA79ED0A1916DF00A8EF5F /* HTMLDirectoryElement.cpp */, A8EA79EE0A1916DF00A8EF5F /* HTMLDirectoryElement.h */, 1A85B1D90A1B23A400D8C87C /* HTMLDirectoryElement.idl */, @@ -17511,9 +17527,9 @@ 971145FE14EF006E00674FD9 /* Modules */ = { isa = PBXGroup; children = ( - 333F703D0FB49C16008E12A6 /* notifications */, 971145FF14EF007900674FD9 /* geolocation */, 9712A55315004E3C0048AF10 /* indexeddb */, + 333F703D0FB49C16008E12A6 /* notifications */, 89F60B08157F68350075E157 /* quota */, 97BC69D51505F054001B74AC /* webdatabase */, 97AABCF714FA09B5007457AE /* websockets */, @@ -17956,9 +17972,11 @@ A75E8B7F0E1DE2B0007F2481 /* filters */ = { isa = PBXGroup; children = ( + 49ECEB5C1499790D00CDD3A4 /* arm */, + 50D4060F147D49DE00D30BB5 /* CustomFilterCompiledProgram.cpp */, + 50D40610147D49DE00D30BB5 /* CustomFilterCompiledProgram.h */, 50987C24157D676D00BDA835 /* CustomFilterGlobalContext.cpp */, 50987C25157D676D00BDA835 /* CustomFilterGlobalContext.h */, - 49ECEB5C1499790D00CDD3A4 /* arm */, 50D405F7147D31F300D30BB5 /* CustomFilterMesh.cpp */, 50D405F8147D31F300D30BB5 /* CustomFilterMesh.h */, 50CC089914C6E99C0017AB51 /* CustomFilterNumberParameter.h */, @@ -17968,8 +17986,6 @@ 503D0CA714B5B08700F32F57 /* CustomFilterProgram.cpp */, 503D0CA814B5B08700F32F57 /* CustomFilterProgram.h */, 503D0CA914B5B08700F32F57 /* CustomFilterProgramClient.h */, - 50D4060F147D49DE00D30BB5 /* CustomFilterCompiledProgram.cpp */, - 50D40610147D49DE00D30BB5 /* CustomFilterCompiledProgram.h */, A1E1154313015C3D0054AC8C /* DistantLightSource.cpp */, 84730D5A1248F0B300D3A9C9 /* DistantLightSource.h */, A75E8B800E1DE2D6007F2481 /* FEBlend.cpp */, @@ -19582,7 +19598,6 @@ B2A015910AF6CD53006BCE0E /* graphics */ = { isa = PBXGroup; children = ( - 0562F9601573F88F0031CA16 /* PlatformLayer.h */, 076F0D0812B8192700C26AA4 /* avfoundation */, 499B3EC0128CCC1800E726C2 /* ca */, B27535290B053814002CE64F /* cg */, @@ -19696,6 +19711,7 @@ A88DD4860B4629A300C02990 /* PathTraversalState.h */, A8FA6E5C0E4CFDED00D5CF49 /* Pattern.cpp */, A8FA6E5B0E4CFDED00D5CF49 /* Pattern.h */, + 0562F9601573F88F0031CA16 /* PlatformLayer.h */, BCAB417F13E356E800D8AAF3 /* Region.cpp */, BCAB418013E356E800D8AAF3 /* Region.h */, A73F95FC12C97BFE0031AAF9 /* RoundedRect.cpp */, @@ -19744,8 +19760,6 @@ B2C3D9F90D006C1D00EF6F26 /* mac */, B734B17F119B98DB006587BD /* transcoder */, 37C61F0012095C87007A3C67 /* AtomicStringKeyedMRUCache.h */, - B2C3D9F00D006C1D00EF6F26 /* Base64.cpp */, - B2C3D9F10D006C1D00EF6F26 /* Base64.h */, B2C3D9F20D006C1D00EF6F26 /* BidiContext.cpp */, B2C3D9F30D006C1D00EF6F26 /* BidiContext.h */, B2C3D9F40D006C1D00EF6F26 /* BidiResolver.h */, @@ -20091,8 +20105,8 @@ A9C6E6460D7465CA006442E9 /* JSDOMMimeTypeArrayCustom.cpp */, A9C6E64A0D7465E7006442E9 /* JSDOMPluginArrayCustom.cpp */, A9C6E64B0D7465E7006442E9 /* JSDOMPluginCustom.cpp */, - BC64649B11D8238C006455B0 /* JSDOMStringMapCustom.cpp */, 9A1B6F96158869C80011A8C4 /* JSDOMStringListCustom.cpp */, + BC64649B11D8238C006455B0 /* JSDOMStringMapCustom.cpp */, 14E0BC55136148A8002AD12E /* JSDOMTokenListCustom.cpp */, BCD9C25E0C17AA67005C90A2 /* JSDOMWindowCustom.cpp */, 652FBBBB0DE27CB60001D386 /* JSDOMWindowCustom.h */, @@ -20800,12 +20814,12 @@ ED501DC90B249F3900AE18D9 /* mac */ = { isa = PBXGroup; children = ( - CE7B2DB01586ABAD0098B3FA /* AlternativeTextUIController.mm */, CE7B2DAF1586ABAD0098B3FA /* AlternativeTextUIController.h */, + CE7B2DB01586ABAD0098B3FA /* AlternativeTextUIController.mm */, ED501DC50B249F2900AE18D9 /* EditorMac.mm */, 4A8C96EA0BE69032004EEFF0 /* FrameSelectionMac.mm */, - CE7B2DB21586ABAD0098B3FA /* TextAlternativeWithRange.mm */, CE7B2DB11586ABAD0098B3FA /* TextAlternativeWithRange.h */, + CE7B2DB21586ABAD0098B3FA /* TextAlternativeWithRange.mm */, ); name = mac; sourceTree = "<group>"; @@ -20924,6 +20938,8 @@ 858C39100AA8FF0000B187A4 /* CSSStyleSheet.idl */, BC80C9850CD294EE00A0B7B3 /* CSSTimingFunctionValue.cpp */, BC80C9860CD294EE00A0B7B3 /* CSSTimingFunctionValue.h */, + A882DA1F1593846A000115ED /* CSSToStyleMap.cpp */, + A882DA221593848D000115ED /* CSSToStyleMap.h */, 371F53E80D2704F900ECE0D5 /* CSSUnicodeRangeValue.cpp */, 371F53E70D2704F900ECE0D5 /* CSSUnicodeRangeValue.h */, A80E6CCE0A1989CA007FB8C5 /* CSSUnknownRule.h */, @@ -21033,15 +21049,13 @@ 8AA61CFD144D595B00F37350 /* WebKitCSSRegionRule.cpp */, 8AA61CFE144D595B00F37350 /* WebKitCSSRegionRule.h */, 8AD0A55614C87425000D83C5 /* WebKitCSSRegionRule.idl */, - 0562F9441573ECEB0031CA16 /* WebKitCSSSVGDocumentValue.cpp */, - 0562F9451573ECEB0031CA16 /* WebKitCSSSVGDocumentValue.h */, 5038BC0614711CDB0095E0D1 /* WebKitCSSShaderValue.cpp */, 50B42157146976960087E604 /* WebKitCSSShaderValue.h */, + 0562F9441573ECEB0031CA16 /* WebKitCSSSVGDocumentValue.cpp */, + 0562F9451573ECEB0031CA16 /* WebKitCSSSVGDocumentValue.h */, BC9ADD7F0CC4092200098C4C /* WebKitCSSTransformValue.cpp */, BC9ADD220CC4032600098C4C /* WebKitCSSTransformValue.h */, 31611E540E1C4D4A00F6A579 /* WebKitCSSTransformValue.idl */, - A882DA1F1593846A000115ED /* CSSToStyleMap.cpp */, - A882DA221593848D000115ED /* CSSToStyleMap.h */, ); path = css; sourceTree = "<group>"; @@ -21136,10 +21150,10 @@ A871DEC90A1530C700B12A68 /* RenderFrameSet.h */, CDEA7C831276230400B846DD /* RenderFullScreen.cpp */, CDEA7C821276230400B846DD /* RenderFullScreen.h */, - BC128B00137C8D4600CAC845 /* RenderGrid.cpp */, - BC128A72137C867C00CAC845 /* RenderGrid.h */, 0F3F0E57157030C3006DA57F /* RenderGeometryMap.cpp */, 0F3F0E58157030C3006DA57F /* RenderGeometryMap.h */, + BC128B00137C8D4600CAC845 /* RenderGrid.cpp */, + BC128A72137C867C00CAC845 /* RenderGrid.h */, BCEA482A097D93020094C9E4 /* RenderHTMLCanvas.cpp */, BCEA482B097D93020094C9E4 /* RenderHTMLCanvas.h */, 0FD308D3117D168400A791F7 /* RenderIFrame.cpp */, @@ -21456,6 +21470,10 @@ 8482B7441198C32E00BFB005 /* HashChangeEvent.idl */, 45099C401370A7800058D513 /* IconURL.cpp */, 45BAC2AF1360BBAB005DA258 /* IconURL.h */, + C3CF17A015B0063F00276D39 /* IdTargetObserver.cpp */, + C3CF17A115B0063F00276D39 /* IdTargetObserver.h */, + C3CF17A215B0063F00276D39 /* IdTargetObserverRegistry.cpp */, + C3CF17A315B0063F00276D39 /* IdTargetObserverRegistry.h */, 8AB4BC76126FDB7100DEB727 /* IgnoreDestructiveWriteCountIncrementer.h */, 85031B2D0A44EFC700F992E0 /* KeyboardEvent.cpp */, 85031B2E0A44EFC700F992E0 /* KeyboardEvent.h */, @@ -21487,13 +21505,13 @@ 85031B330A44EFC700F992E0 /* MutationEvent.cpp */, 85031B340A44EFC700F992E0 /* MutationEvent.h */, 93EEC1F309C2877700C515D1 /* MutationEvent.idl */, + C6F0900514327B6100685849 /* MutationObserver.cpp */, + C6F0900614327B6100685849 /* MutationObserver.h */, + C6F0900714327B6100685849 /* MutationObserver.idl */, D6E528A1149A926D00EFE1F3 /* MutationObserverInterestGroup.cpp */, D6E528A2149A926D00EFE1F3 /* MutationObserverInterestGroup.h */, D6E276AD14637455001D280A /* MutationObserverRegistration.cpp */, D6E276AE14637455001D280A /* MutationObserverRegistration.h */, - C6F0900514327B6100685849 /* MutationObserver.cpp */, - C6F0900614327B6100685849 /* MutationObserver.h */, - C6F0900714327B6100685849 /* MutationObserver.idl */, C6F08FB91430FE8F00685849 /* MutationRecord.cpp */, C6F08FBA1430FE8F00685849 /* MutationRecord.h */, C6F08FBB1430FE8F00685849 /* MutationRecord.idl */, @@ -21639,6 +21657,8 @@ 93EEC1F709C2877700C515D1 /* WheelEvent.idl */, 4123E568127B3041000FEEA7 /* WindowEventContext.cpp */, 4123E567127B3041000FEEA7 /* WindowEventContext.h */, + 12F35EB4158745A40035CB63 /* WebKitNamedFlowCollection.h */, + 12F35EB5158745A40035CB63 /* WebKitNamedFlowCollection.cpp */, ); path = dom; sourceTree = "<group>"; @@ -21665,10 +21685,10 @@ FBC220DD1237FBEB00BCF788 /* opengl */ = { isa = PBXGroup; children = ( - 44DAB5AF15A623580097C1E4 /* Extensions3DOpenGLCommon.cpp */, - 44DAB5B015A623580097C1E4 /* Extensions3DOpenGLCommon.h */, 6E67D2A41280E8A4008758F7 /* Extensions3DOpenGL.cpp */, 6E67D2A51280E8A4008758F7 /* Extensions3DOpenGL.h */, + 44DAB5AF15A623580097C1E4 /* Extensions3DOpenGLCommon.cpp */, + 44DAB5B015A623580097C1E4 /* Extensions3DOpenGLCommon.h */, FBC220DE1237FBEB00BCF788 /* GraphicsContext3DOpenGL.cpp */, 96ABA42214BCB80E00D56204 /* GraphicsContext3DOpenGLCommon.cpp */, ); @@ -21989,6 +22009,7 @@ 84D0C4061115F1EA0018AA34 /* AffineTransform.h in Headers */, CEDA12D7152CA1CB00D9E08D /* AlternativeTextClient.h in Headers */, CE08C3D2152B599A0021B8C2 /* AlternativeTextController.h in Headers */, + CE7B2DB31586ABAD0098B3FA /* AlternativeTextUIController.h in Headers */, 490707E71219C04300D90E51 /* ANGLEWebKitBridge.h in Headers */, 49E912AB0EFAC906009D0CAF /* Animation.h in Headers */, 316FE1120E6E1DA700BF6088 /* AnimationBase.h in Headers */, @@ -22067,7 +22088,6 @@ 51741D0F0B07259A00ED442C /* BackForwardList.h in Headers */, BCA8CA6011E4E6D100812FB7 /* BackForwardListImpl.h in Headers */, BC124EE80C2641CD009E2349 /* BarInfo.h in Headers */, - B2C3DA220D006C1D00EF6F26 /* Base64.h in Headers */, 379E61CA126CA5C400B63E8D /* BaseButtonInputType.h in Headers */, 379E61CC126CA5C400B63E8D /* BaseCheckableInputType.h in Headers */, C33EE5C514FB49610002095A /* BaseClickableWithKeyInputType.h in Headers */, @@ -22266,6 +22286,7 @@ A80E6D0C0A1989CA007FB8C5 /* CSSStyleRule.h in Headers */, A8EA80070A19516E00A8EF5F /* CSSStyleSheet.h in Headers */, BC80C9880CD294EE00A0B7B3 /* CSSTimingFunctionValue.h in Headers */, + A882DA231593848D000115ED /* CSSToStyleMap.h in Headers */, 371F53E90D2704F900ECE0D5 /* CSSUnicodeRangeValue.h in Headers */, DD7CDF250A23CF9800069928 /* CSSUnknownRule.h in Headers */, A80E6CEE0A1989CA007FB8C5 /* CSSValue.h in Headers */, @@ -22278,13 +22299,14 @@ BC2272A20E82E87C00E7F975 /* CursorData.h in Headers */, BC2272AD0E82E8F300E7F975 /* CursorList.h in Headers */, 62CD325A1157E57C0063B0A7 /* CustomEvent.h in Headers */, + 50D40612147D49DE00D30BB5 /* CustomFilterCompiledProgram.h in Headers */, + 50987C27157D676D00BDA835 /* CustomFilterGlobalContext.h in Headers */, 50D405FA147D31F300D30BB5 /* CustomFilterMesh.h in Headers */, 50CC089A14C6E99C0017AB51 /* CustomFilterNumberParameter.h in Headers */, 50ACE2CB14B5D79300446666 /* CustomFilterOperation.h in Headers */, 509CC9FB14C069ED00BBECBD /* CustomFilterParameter.h in Headers */, 503D0CAB14B5B08700F32F57 /* CustomFilterProgram.h in Headers */, 503D0CAC14B5B08700F32F57 /* CustomFilterProgramClient.h in Headers */, - 50D40612147D49DE00D30BB5 /* CustomFilterCompiledProgram.h in Headers */, A8CB413E0E8633FD0032C4F0 /* DashArray.h in Headers */, A80E6D0B0A1989CA007FB8C5 /* DashboardRegion.h in Headers */, 97BC6A211505F081001B74AC /* Database.h in Headers */, @@ -22303,8 +22325,8 @@ 81AC599A131636E60009A7E0 /* DataTransferItemList.h in Headers */, 2E97CCEB12939CB800C5C8FF /* DataView.h in Headers */, A5732B0B136A161D005C8D7C /* DateComponents.h in Headers */, - 453EB637159C570400001BB7 /* DateTimeFormat.h in Headers */, F55B3DB61251F12D003EF269 /* DateInputType.h in Headers */, + 453EB637159C570400001BB7 /* DateTimeFormat.h in Headers */, F55B3DB81251F12D003EF269 /* DateTimeInputType.h in Headers */, F55B3DBA1251F12D003EF269 /* DateTimeLocalInputType.h in Headers */, 45FEA5D0156DDE8C00654101 /* Decimal.h in Headers */, @@ -23049,6 +23071,7 @@ 9767CE0C145ABC13005E64DB /* ExceptionInterfaces.h in Headers */, 6E67D2A91280E8BD008758F7 /* Extensions3D.h in Headers */, 6E67D2A71280E8A4008758F7 /* Extensions3DOpenGL.h in Headers */, + 44DAB5B215A623580097C1E4 /* Extensions3DOpenGLCommon.h in Headers */, 7728694F14F8882500F484DC /* EXTTextureFilterAnisotropic.h in Headers */, A75E8B890E1DE2D6007F2481 /* FEBlend.h in Headers */, A75E8B8B0E1DE2D6007F2481 /* FEColorMatrix.h in Headers */, @@ -23237,6 +23260,7 @@ E1A31663134BCAE8007C9A4F /* HTMLConverter.h in Headers */, F5C041DB0FFCA7CE00839D4A /* HTMLDataListElement.h in Headers */, D359D78A129CA2710006E5D2 /* HTMLDetailsElement.h in Headers */, + 762F1ED7159D960A007408F2 /* HTMLDialogElement.h in Headers */, A8EA79FA0A1916DF00A8EF5F /* HTMLDirectoryElement.h in Headers */, A8EA7CB70A192B9C00A8EF5F /* HTMLDivElement.h in Headers */, A8EA79F70A1916DF00A8EF5F /* HTMLDListElement.h in Headers */, @@ -23640,6 +23664,7 @@ 4A1E719114E101E400626F9D /* JSHTMLContentElement.h in Headers */, F5C041E70FFCA96D00839D4A /* JSHTMLDataListElement.h in Headers */, D359D8BF129CA55C0006E5D2 /* JSHTMLDetailsElement.h in Headers */, + 76808B50159DADFA002B5233 /* JSHTMLDialogElement.h in Headers */, 1A85B1E70A1B240500D8C87C /* JSHTMLDirectoryElement.h in Headers */, 1A85B2B70A1B2AC700D8C87C /* JSHTMLDivElement.h in Headers */, 1A85B1E90A1B240500D8C87C /* JSHTMLDListElement.h in Headers */, @@ -24107,6 +24132,7 @@ D3AA10F4123A98AA0092152B /* MediaQueryMatcher.h in Headers */, BCB16C180979C3BD00467741 /* MemoryCache.h in Headers */, 9FFE3E7B11B59C5D0037874E /* MemoryInfo.h in Headers */, + 4F32BB1B14FA85E800F6C1A3 /* MemoryInstrumentation.h in Headers */, 6571DCC81385E6A400702DD0 /* MemoryPressureHandler.h in Headers */, D630E2AC149BF344005B2F95 /* MemoryUsageSupport.h in Headers */, 93309DFA099E64920056E581 /* MergeIdenticalElementsCommand.h in Headers */, @@ -24122,6 +24148,7 @@ 9B375EDB14478A0100F3CAE5 /* MicroDataItemList.h in Headers */, 37DDCD9513844FD50008B793 /* MIMEHeader.h in Headers */, BC772C4F0C4EB3040083285F /* MIMETypeRegistry.h in Headers */, + F508246F1548D96200A119AB /* MockPagePopupDriver.h in Headers */, C6D74AD509AA282E000B0A52 /* ModifySelectionListLevel.h in Headers */, F55B3DC61251F12D003EF269 /* MonthInputType.h in Headers */, 85031B460A44EFC700F992E0 /* MouseEvent.h in Headers */, @@ -24143,7 +24170,6 @@ A9C6E5A60D746458006442E9 /* Navigator.h in Headers */, E12719C70EEEC16800F61213 /* NavigatorBase.h in Headers */, 9711460414EF009A00674FD9 /* NavigatorGeolocation.h in Headers */, - 97E4A12614F4C5D400870E43 /* NavigatorRegisterProtocolHandler.h in Headers */, 8A309C9F123950BE00CB9204 /* NestingLevelIncrementer.h in Headers */, 656D37430ADBA5DE00A4554D /* NetscapePlugInStreamLoader.h in Headers */, 628D214C12131ED10055DCFC /* NetworkingContext.h in Headers */, @@ -24205,6 +24231,9 @@ 9302B0BF0D79F82C00C7EE83 /* PageGroup.h in Headers */, 9712A60515004EDA0048AF10 /* PageGroupIndexedDatabase.h in Headers */, 7A674BDC0F9EBF4E006CF099 /* PageGroupLoadDeferrer.h in Headers */, + F50824691548D89A00A119AB /* PagePopup.h in Headers */, + F508246B1548D8E100A119AB /* PagePopupClient.h in Headers */, + F5122C901547FA1B0028A93B /* PagePopupDriver.h in Headers */, F3820895147D35F90010BC06 /* PageRuntimeAgent.h in Headers */, F34742E51343633C00531BC2 /* PageScriptDebugServer.h in Headers */, 371E65CC13661EDC00BEEDB0 /* PageSerializer.h in Headers */, @@ -24294,7 +24323,6 @@ 7E33CD01127F340D00BE8F17 /* PurgePriority.h in Headers */, 550A0BCA085F6039007353D6 /* QualifiedName.h in Headers */, 379E371713736A6600B9E919 /* QuotedPrintable.h in Headers */, - BC128A73137C867C00CAC845 /* RenderGrid.h in Headers */, 5A574F29131DB96D00471B88 /* QuotesData.h in Headers */, B22279720D00BF220071B782 /* RadialGradientAttributes.h in Headers */, F55B3DCC1251F12D003EF269 /* RadioInputType.h in Headers */, @@ -24340,6 +24368,7 @@ A871DED10A1530C700B12A68 /* RenderFrameSet.h in Headers */, CDEA7C841276230400B846DD /* RenderFullScreen.h in Headers */, 0F3F0E5A157030C3006DA57F /* RenderGeometryMap.h in Headers */, + BC128A73137C867C00CAC845 /* RenderGrid.h in Headers */, BCEA486A097D93020094C9E4 /* RenderHTMLCanvas.h in Headers */, 0FD308D6117D168500A791F7 /* RenderIFrame.h in Headers */, BCEA4876097D93020094C9E4 /* RenderImage.h in Headers */, @@ -24930,6 +24959,7 @@ F55B3DD61251F12D003EF269 /* TelephoneInputType.h in Headers */, 6550B6A6099DF0270090D781 /* Text.h in Headers */, 93309E17099E64920056E581 /* TextAffinity.h in Headers */, + CE7B2DB51586ABAD0098B3FA /* TextAlternativeWithRange.h in Headers */, B2C3DA340D006C1D00EF6F26 /* TextBoundaries.h in Headers */, B2C3DA360D006C1D00EF6F26 /* TextBreakIterator.h in Headers */, B2C3DA380D006C1D00EF6F26 /* TextBreakIteratorInternalICU.h in Headers */, @@ -25023,6 +25053,7 @@ BC8BF151105813BF00A40A07 /* UserStyleSheet.h in Headers */, BC8BF15A1058141800A40A07 /* UserStyleSheetTypes.h in Headers */, BCDF317C11F8D683003C5BF8 /* UserTypingGestureIndicator.h in Headers */, + 1FAFBF1915A5FA7400083A20 /* UTIUtilities.h in Headers */, 2E3BBF081162DA1100B9409A /* UUID.h in Headers */, F5A154281279534D00D0B0C0 /* ValidationMessage.h in Headers */, 15C7708D100D3C6B005BA267 /* ValidityState.h in Headers */, @@ -25087,10 +25118,11 @@ 31288E750E3005D6003619AE /* WebKitCSSKeyframesRule.h in Headers */, 498391590F1E776900C23782 /* WebKitCSSMatrix.h in Headers */, 8AA61D00144D595B00F37350 /* WebKitCSSRegionRule.h in Headers */, - 0562F9471573ECEB0031CA16 /* WebKitCSSSVGDocumentValue.h in Headers */, 29CD61DE146D02890068E82A /* WebKitCSSShaderValue.h in Headers */, + 0562F9471573ECEB0031CA16 /* WebKitCSSSVGDocumentValue.h in Headers */, BC9ADD230CC4032600098C4C /* WebKitCSSTransformValue.h in Headers */, 89878566122CA064003AABDA /* WebKitFlags.h in Headers */, + 12F35EB6158745A40035CB63 /* WebKitNamedFlowCollection.h in Headers */, 494BD7950F55C8EE00747828 /* WebKitPoint.h in Headers */, 31C0FF250E4CEB6E007D6FE5 /* WebKitTransitionEvent.h in Headers */, 0FCF332F0F2B9A25004B6795 /* WebLayer.h in Headers */, @@ -25194,15 +25226,8 @@ E1BE512E0CF6C512002EA959 /* XSLTUnicodeSort.h in Headers */, 977E2E0F12F0FC9C00C13379 /* XSSAuditor.h in Headers */, FD537353137B651800008DCE /* ZeroPole.h in Headers */, - CE7B2DB31586ABAD0098B3FA /* AlternativeTextUIController.h in Headers */, - CE7B2DB51586ABAD0098B3FA /* TextAlternativeWithRange.h in Headers */, - 50987C27157D676D00BDA835 /* CustomFilterGlobalContext.h in Headers */, - 4F32BB1B14FA85E800F6C1A3 /* MemoryInstrumentation.h in Headers */, - A882DA231593848D000115ED /* CSSToStyleMap.h in Headers */, - 762F1ED7159D960A007408F2 /* HTMLDialogElement.h in Headers */, - 76808B50159DADFA002B5233 /* JSHTMLDialogElement.h in Headers */, - 1FAFBF1915A5FA7400083A20 /* UTIUtilities.h in Headers */, - 44DAB5B215A623580097C1E4 /* Extensions3DOpenGLCommon.h in Headers */, + C3CF17A515B0063F00276D39 /* IdTargetObserver.h in Headers */, + C3CF17A715B0063F00276D39 /* IdTargetObserverRegistry.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -25574,6 +25599,7 @@ E1C4DE6E0EA75C650023CCD6 /* ActiveDOMObject.cpp in Sources */, 84D0C4041115F1D40018AA34 /* AffineTransform.cpp in Sources */, CE08C3D1152B599A0021B8C2 /* AlternativeTextController.cpp in Sources */, + CE7B2DB41586ABAD0098B3FA /* AlternativeTextUIController.mm in Sources */, 490707E61219C04300D90E51 /* ANGLEWebKitBridge.cpp in Sources */, 49E912AA0EFAC906009D0CAF /* Animation.cpp in Sources */, 316FE1110E6E1DA700BF6088 /* AnimationBase.cpp in Sources */, @@ -25633,7 +25659,6 @@ BCA8C81F11E3D36900812FB7 /* BackForwardController.cpp in Sources */, BCA8CA5F11E4E6D100812FB7 /* BackForwardListImpl.cpp in Sources */, BC124EE70C2641CD009E2349 /* BarInfo.cpp in Sources */, - B2C3DA210D006C1D00EF6F26 /* Base64.cpp in Sources */, 379E61C9126CA5C300B63E8D /* BaseButtonInputType.cpp in Sources */, 379E61CB126CA5C400B63E8D /* BaseCheckableInputType.cpp in Sources */, C33EE5C414FB49610002095A /* BaseClickableWithKeyInputType.cpp in Sources */, @@ -25798,6 +25823,7 @@ A80E6CEF0A1989CA007FB8C5 /* CSSStyleRule.cpp in Sources */, A8EA80080A19516E00A8EF5F /* CSSStyleSheet.cpp in Sources */, BC80C9870CD294EE00A0B7B3 /* CSSTimingFunctionValue.cpp in Sources */, + A882DA201593846A000115ED /* CSSToStyleMap.cpp in Sources */, 371F53EA0D2704F900ECE0D5 /* CSSUnicodeRangeValue.cpp in Sources */, AD03AAFA1468455300A39B5B /* CSSValue.cpp in Sources */, 1ABA76CB11D20E57004C201C /* CSSValueKeywords.cpp in Sources */, @@ -25808,10 +25834,11 @@ 265541521489B233000DFC5D /* CursorIOS.cpp in Sources */, 93F19A2608245E59001E9ABC /* CursorMac.mm in Sources */, 62CD32591157E57C0063B0A7 /* CustomEvent.cpp in Sources */, + 50D40611147D49DE00D30BB5 /* CustomFilterCompiledProgram.cpp in Sources */, + 50987C26157D676D00BDA835 /* CustomFilterGlobalContext.cpp in Sources */, 50D405F9147D31F300D30BB5 /* CustomFilterMesh.cpp in Sources */, 50CC0A3914C6F5B10017AB51 /* CustomFilterOperation.cpp in Sources */, 503D0CAA14B5B08700F32F57 /* CustomFilterProgram.cpp in Sources */, - 50D40611147D49DE00D30BB5 /* CustomFilterCompiledProgram.cpp in Sources */, 97BC6A201505F081001B74AC /* Database.cpp in Sources */, 97BC6A231505F081001B74AC /* DatabaseAuthorizer.cpp in Sources */, 97BC6A271505F081001B74AC /* DatabaseContext.cpp in Sources */, @@ -26247,6 +26274,7 @@ A7CACDB113CE875C00BBBE3F /* ExceptionCodePlaceholder.cpp in Sources */, 148AFDA60AF58360008CC700 /* ExceptionHandlers.mm in Sources */, 6E67D2A61280E8A4008758F7 /* Extensions3DOpenGL.cpp in Sources */, + 44DAB5B115A623580097C1E4 /* Extensions3DOpenGLCommon.cpp in Sources */, 7728694E14F8882500F484DC /* EXTTextureFilterAnisotropic.cpp in Sources */, A75E8B880E1DE2D6007F2481 /* FEBlend.cpp in Sources */, A75E8B8A0E1DE2D6007F2481 /* FEColorMatrix.cpp in Sources */, @@ -26405,6 +26433,7 @@ 5D4F51DF132725480016F541 /* HTMLConverter.mm in Sources */, F5C041DA0FFCA7CE00839D4A /* HTMLDataListElement.cpp in Sources */, D359D789129CA2710006E5D2 /* HTMLDetailsElement.cpp in Sources */, + 762F1EDB159D968A007408F2 /* HTMLDialogElement.cpp in Sources */, A8EA79F90A1916DF00A8EF5F /* HTMLDirectoryElement.cpp in Sources */, A8EA7CB10A192B9C00A8EF5F /* HTMLDivElement.cpp in Sources */, A8EA79F50A1916DF00A8EF5F /* HTMLDListElement.cpp in Sources */, @@ -26756,6 +26785,7 @@ BC5A86B50C3367E800EEA649 /* JSDOMSelection.cpp in Sources */, 4ACBC0CA12713D0A0094F9B2 /* JSDOMSettableTokenList.cpp in Sources */, C5137CF211A58378004ADB99 /* JSDOMStringList.cpp in Sources */, + 9A1B6F97158869C80011A8C4 /* JSDOMStringListCustom.cpp in Sources */, BC64649711D82349006455B0 /* JSDOMStringMap.cpp in Sources */, BC64649C11D8238C006455B0 /* JSDOMStringMapCustom.cpp in Sources */, 7694563C1214D97C0007CBAE /* JSDOMTokenList.cpp in Sources */, @@ -26835,6 +26865,7 @@ 4A1E719014E101E400626F9D /* JSHTMLContentElement.cpp in Sources */, F5C041E60FFCA96D00839D4A /* JSHTMLDataListElement.cpp in Sources */, D359D8BE129CA55C0006E5D2 /* JSHTMLDetailsElement.cpp in Sources */, + 76808B4F159DADFA002B5233 /* JSHTMLDialogElement.cpp in Sources */, 1A85B1E60A1B240500D8C87C /* JSHTMLDirectoryElement.cpp in Sources */, 1A85B2B60A1B2AC700D8C87C /* JSHTMLDivElement.cpp in Sources */, 1A85B1E80A1B240500D8C87C /* JSHTMLDListElement.cpp in Sources */, @@ -27386,6 +27417,7 @@ 37DDCD9413844FD50008B793 /* MIMEHeader.cpp in Sources */, BC772C4E0C4EB3040083285F /* MIMETypeRegistry.cpp in Sources */, BC772C5E0C4EB3440083285F /* MIMETypeRegistryMac.mm in Sources */, + F508246E1548D96200A119AB /* MockPagePopupDriver.cpp in Sources */, C6D74AE409AA290A000B0A52 /* ModifySelectionListLevel.cpp in Sources */, F55B3DC51251F12D003EF269 /* MonthInputType.cpp in Sources */, 85031B450A44EFC700F992E0 /* MouseEvent.cpp in Sources */, @@ -27406,7 +27438,6 @@ A9C6E5A50D746458006442E9 /* Navigator.cpp in Sources */, E12719CA0EEEC21300F61213 /* NavigatorBase.cpp in Sources */, 9711460314EF009A00674FD9 /* NavigatorGeolocation.cpp in Sources */, - 97E4A12714F4C5D700870E43 /* NavigatorRegisterProtocolHandler.cpp in Sources */, 5D874F130D161D3200796C3B /* NetscapePlugInStreamLoader.cpp in Sources */, 59C27F05138D28C10079B7E2 /* NetworkResourcesData.cpp in Sources */, 1A7FA61B0DDA3BBE0028F8A5 /* NetworkStateNotifier.cpp in Sources */, @@ -27513,7 +27544,6 @@ E4D687770ED7AE3D006EA978 /* PurgeableBufferMac.cpp in Sources */, 550A0BC9085F6039007353D6 /* QualifiedName.cpp in Sources */, 379E371613736A6600B9E919 /* QuotedPrintable.cpp in Sources */, - BC128B01137C8D4600CAC845 /* RenderGrid.cpp in Sources */, 5A574F28131DB96D00471B88 /* QuotesData.cpp in Sources */, F55B3DCB1251F12D003EF269 /* RadioInputType.cpp in Sources */, B658FFA51522EFAA00DD5595 /* RadioNodeList.cpp in Sources */, @@ -27552,6 +27582,7 @@ A871DED20A1530C700B12A68 /* RenderFrameSet.cpp in Sources */, CDEA7C851276230400B846DD /* RenderFullScreen.cpp in Sources */, 0F3F0E59157030C3006DA57F /* RenderGeometryMap.cpp in Sources */, + BC128B01137C8D4600CAC845 /* RenderGrid.cpp in Sources */, BCEA4869097D93020094C9E4 /* RenderHTMLCanvas.cpp in Sources */, 0FD308D5117D168500A791F7 /* RenderIFrame.cpp in Sources */, BCEA4875097D93020094C9E4 /* RenderImage.cpp in Sources */, @@ -28028,6 +28059,7 @@ BCE3BEC20D222B1D007E06E4 /* TagNodeList.cpp in Sources */, F55B3DD51251F12D003EF269 /* TelephoneInputType.cpp in Sources */, 6550B6A5099DF0270090D781 /* Text.cpp in Sources */, + CE7B2DB61586ABAD0098B3FA /* TextAlternativeWithRange.mm in Sources */, 372C00C4129611F1005C9575 /* TextBoundaries.cpp in Sources */, B2AFFC970D00A5DF0030074D /* TextBoundaries.mm in Sources */, B2C3DA370D006C1D00EF6F26 /* TextBreakIteratorICU.cpp in Sources */, @@ -28100,6 +28132,7 @@ BCACF3BC1072921A00C0C8A3 /* UserContentURLPattern.cpp in Sources */, 2542F4DA1166C25A00E89A86 /* UserGestureIndicator.cpp in Sources */, BCDF317B11F8D683003C5BF8 /* UserTypingGestureIndicator.cpp in Sources */, + 1FAFBF1815A5FA6E00083A20 /* UTIUtilities.mm in Sources */, 2E3BBF071162DA1100B9409A /* UUID.cpp in Sources */, F5A154271279534D00D0B0C0 /* ValidationMessage.cpp in Sources */, 15C7708E100D3C6B005BA267 /* ValidityState.cpp in Sources */, @@ -28161,6 +28194,7 @@ BC9ADD800CC4092200098C4C /* WebKitCSSTransformValue.cpp in Sources */, 1A1414B513A0F0500019996C /* WebKitFontFamilyNames.cpp in Sources */, D7613A501474F13F00DB8606 /* WebKitNamedFlow.cpp in Sources */, + 12F35EB7158745A40035CB63 /* WebKitNamedFlowCollection.cpp in Sources */, 31C0FF240E4CEB6E007D6FE5 /* WebKitTransitionEvent.cpp in Sources */, 0FCF332E0F2B9A25004B6795 /* WebLayer.mm in Sources */, E1A3162E134BC32D007C9A4F /* WebNSAttributedStringExtras.mm in Sources */, @@ -28252,15 +28286,8 @@ E1BE512D0CF6C512002EA959 /* XSLTUnicodeSort.cpp in Sources */, 977E2E0E12F0FC9C00C13379 /* XSSAuditor.cpp in Sources */, FD537352137B651800008DCE /* ZeroPole.cpp in Sources */, - 9A1B6F97158869C80011A8C4 /* JSDOMStringListCustom.cpp in Sources */, - CE7B2DB41586ABAD0098B3FA /* AlternativeTextUIController.mm in Sources */, - CE7B2DB61586ABAD0098B3FA /* TextAlternativeWithRange.mm in Sources */, - 50987C26157D676D00BDA835 /* CustomFilterGlobalContext.cpp in Sources */, - A882DA201593846A000115ED /* CSSToStyleMap.cpp in Sources */, - 762F1EDB159D968A007408F2 /* HTMLDialogElement.cpp in Sources */, - 76808B4F159DADFA002B5233 /* JSHTMLDialogElement.cpp in Sources */, - 1FAFBF1815A5FA6E00083A20 /* UTIUtilities.mm in Sources */, - 44DAB5B115A623580097C1E4 /* Extensions3DOpenGLCommon.cpp in Sources */, + C3CF17A415B0063F00276D39 /* IdTargetObserver.cpp in Sources */, + C3CF17A615B0063F00276D39 /* IdTargetObserverRegistry.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/Source/WebCore/accessibility/AccessibilityList.h b/Source/WebCore/accessibility/AccessibilityList.h index de5e96df3..3cfde0bdf 100644 --- a/Source/WebCore/accessibility/AccessibilityList.h +++ b/Source/WebCore/accessibility/AccessibilityList.h @@ -29,7 +29,7 @@ #ifndef AccessibilityList_h #define AccessibilityList_h -#if PLATFORM(MAC) && defined(BUILDING_ON_LEOPARD) +#if PLATFORM(MAC) && !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1050 #define ACCESSIBILITY_LISTS 0 #else #define ACCESSIBILITY_LISTS 1 diff --git a/Source/WebCore/accessibility/AccessibilityObject.cpp b/Source/WebCore/accessibility/AccessibilityObject.cpp index 245bda5bf..793b54a60 100644 --- a/Source/WebCore/accessibility/AccessibilityObject.cpp +++ b/Source/WebCore/accessibility/AccessibilityObject.cpp @@ -1399,7 +1399,7 @@ static ARIARoleMap* createARIARoleMap() { "search", LandmarkSearchRole }, { "separator", SplitterRole }, { "slider", SliderRole }, - { "spinbutton", ProgressIndicatorRole }, + { "spinbutton", SpinButtonRole }, { "status", ApplicationStatusRole }, { "tab", TabRole }, { "tablist", TabListRole }, diff --git a/Source/WebCore/accessibility/AccessibilityTable.h b/Source/WebCore/accessibility/AccessibilityTable.h index 21814f2db..7fd7cc611 100644 --- a/Source/WebCore/accessibility/AccessibilityTable.h +++ b/Source/WebCore/accessibility/AccessibilityTable.h @@ -32,7 +32,7 @@ #include "AccessibilityRenderObject.h" #include <wtf/Forward.h> -#if PLATFORM(MAC) && defined(BUILDING_ON_LEOPARD) +#if PLATFORM(MAC) && !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1050 #define ACCESSIBILITY_TABLES 0 #else #define ACCESSIBILITY_TABLES 1 diff --git a/Source/WebCore/accessibility/mac/AXObjectCacheMac.mm b/Source/WebCore/accessibility/mac/AXObjectCacheMac.mm index acbc25f70..3608d21b6 100644 --- a/Source/WebCore/accessibility/mac/AXObjectCacheMac.mm +++ b/Source/WebCore/accessibility/mac/AXObjectCacheMac.mm @@ -71,7 +71,7 @@ void AXObjectCache::postPlatformNotification(AccessibilityObject* obj, AXNotific macNotification = NSAccessibilityFocusedUIElementChangedNotification; break; case AXAutocorrectionOccured: -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 macNotification = @"AXAutocorrectionOccurred"; break; #else @@ -107,7 +107,7 @@ void AXObjectCache::postPlatformNotification(AccessibilityObject* obj, AXNotific case AXRowCountChanged: macNotification = NSAccessibilityRowCountChangedNotification; break; -#ifndef BUILDING_ON_LEOPARD +#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 case AXRowExpanded: macNotification = NSAccessibilityRowExpandedNotification; break; diff --git a/Source/WebCore/bindings/js/JSDeviceOrientationEventCustom.cpp b/Source/WebCore/bindings/js/JSDeviceOrientationEventCustom.cpp index 5a0ff7d73..25976e411 100644 --- a/Source/WebCore/bindings/js/JSDeviceOrientationEventCustom.cpp +++ b/Source/WebCore/bindings/js/JSDeviceOrientationEventCustom.cpp @@ -81,7 +81,7 @@ JSValue JSDeviceOrientationEvent::initDeviceOrientationEvent(ExecState* exec) double beta = exec->argument(4).toNumber(exec); bool gammaProvided = !exec->argument(5).isUndefinedOrNull(); double gamma = exec->argument(5).toNumber(exec); - bool absoluteProvided = !exec->argument(5).isUndefinedOrNull(); + bool absoluteProvided = !exec->argument(6).isUndefinedOrNull(); bool absolute = exec->argument(6).toBoolean(); RefPtr<DeviceOrientationData> orientation = DeviceOrientationData::create(alphaProvided, alpha, betaProvided, beta, gammaProvided, gamma, absoluteProvided, absolute); DeviceOrientationEvent* imp = static_cast<DeviceOrientationEvent*>(impl()); diff --git a/Source/WebCore/bindings/objc/WebScriptObject.mm b/Source/WebCore/bindings/objc/WebScriptObject.mm index cf55e7415..1a51b81a2 100644 --- a/Source/WebCore/bindings/objc/WebScriptObject.mm +++ b/Source/WebCore/bindings/objc/WebScriptObject.mm @@ -50,6 +50,7 @@ #import <runtime/JSLock.h> #import <runtime/Completion.h> #import <runtime/Completion.h> +#import <wtf/TCSpinLock.h> #import <wtf/Threading.h> @@ -60,16 +61,24 @@ using namespace WebCore; namespace WebCore { static NSMapTable* JSWrapperCache; +static SpinLock spinLock = SPINLOCK_INITIALIZER; NSObject* getJSWrapper(JSObject* impl) { + ASSERT(isMainThread()); + SpinLockHolder holder(&spinLock); + if (!JSWrapperCache) return nil; - return static_cast<NSObject*>(NSMapGet(JSWrapperCache, impl)); + NSObject* wrapper = static_cast<NSObject*>(NSMapGet(JSWrapperCache, impl)); + return wrapper ? [[wrapper retain] autorelease] : nil; } void addJSWrapper(NSObject* wrapper, JSObject* impl) { + ASSERT(isMainThread()); + SpinLockHolder holder(&spinLock); + if (!JSWrapperCache) JSWrapperCache = createWrapperCache(); NSMapInsert(JSWrapperCache, impl, wrapper); @@ -77,18 +86,27 @@ void addJSWrapper(NSObject* wrapper, JSObject* impl) void removeJSWrapper(JSObject* impl) { + SpinLockHolder holder(&spinLock); + if (!JSWrapperCache) return; NSMapRemove(JSWrapperCache, impl); } -id createJSWrapper(JSC::JSObject* object, PassRefPtr<JSC::Bindings::RootObject> origin, PassRefPtr<JSC::Bindings::RootObject> root) +static void removeJSWrapperIfRetainCountOne(NSObject* wrapper, JSObject* impl) { - // NSMap is not thread safe, hold the JSC API lock; also synchronize this vs. release. - JSC::JSLockHolder holder(JSDOMWindowBase::commonJSGlobalData()); + SpinLockHolder holder(&spinLock); + if (!JSWrapperCache) + return; + if ([wrapper retainCount] == 1) + NSMapRemove(JSWrapperCache, impl); +} + +id createJSWrapper(JSC::JSObject* object, PassRefPtr<JSC::Bindings::RootObject> origin, PassRefPtr<JSC::Bindings::RootObject> root) +{ if (id wrapper = getJSWrapper(object)) - return [[wrapper retain] autorelease]; + return wrapper; return [[[WebScriptObject alloc] _initWithJSObject:object originRootObject:origin rootObject:root] autorelease]; } @@ -148,9 +166,6 @@ static void _didExecute(WebScriptObject *obj) _private->rootObject = rootObject.leakRef(); _private->originRootObject = originRootObject.leakRef(); - // NSMap is not thread safe, hold the JSC API lock. - JSC::JSLockHolder holder(JSDOMWindowBase::commonJSGlobalData()); - WebCore::addJSWrapper(self, imp); if (_private->rootObject) @@ -231,15 +246,9 @@ static void _didExecute(WebScriptObject *obj) - (oneway void)release { - { - // NSMap is not thread safe, hold the JSC API lock; also synchronize this vs. getJSWrapper. - JSC::JSLockHolder holder(JSDOMWindowBase::commonJSGlobalData()); - - // If we're releasing the last reference to this object, remove if from the map, - // this will prevent this object from being returned by getJSWrapper. - if (_private->imp && [self retainCount] == 1) - WebCore::removeJSWrapper(_private->imp); - } + // If we're releasing the last reference to this object, remove if from the map. + if (_private->imp) + WebCore::removeJSWrapperIfRetainCountOne(self, _private->imp); [super release]; } @@ -521,6 +530,9 @@ static void getListFromNSArray(ExecState *exec, NSArray *array, RootObject* root - (JSObjectRef)JSObject { + ExecState* exec = [self _rootObject]->globalObject()->globalExec(); + + JSLockHolder lock(exec); if (![self _isSafeScript]) return NULL; diff --git a/Source/WebCore/bindings/scripts/CodeGeneratorCPP.pm b/Source/WebCore/bindings/scripts/CodeGeneratorCPP.pm index 5ed40ff0e..ed90de825 100644 --- a/Source/WebCore/bindings/scripts/CodeGeneratorCPP.pm +++ b/Source/WebCore/bindings/scripts/CodeGeneratorCPP.pm @@ -223,6 +223,14 @@ sub SkipAttribute return 1 if $attribute->signature->type =~ /Constructor$/; + if ($codeGenerator->GetArrayType($attribute->signature->type)) { + return 1; + } + + if ($codeGenerator->GetSequenceType($attribute->signature->type)) { + return 1; + } + $codeGenerator->AssertNotSequenceType($attribute->signature->type); # FIXME: This is typically used to add script execution state arguments to the method. diff --git a/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm b/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm index 3b0115bdf..147c3d986 100644 --- a/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm +++ b/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm @@ -922,9 +922,6 @@ END if ($getterStringUsesImp) { my ($functionName, @arguments) = $codeGenerator->GetterExpression(\%implIncludes, $interfaceName, $attribute); - - push(@arguments, GenerateCallWith($attribute->signature->extendedAttributes->{"CallWith"}, \@implContentDecls, " ", 0, 0)); - push(@arguments, "ec") if $useExceptions; if ($attribute->signature->extendedAttributes->{"ImplementedBy"}) { my $implementedBy = $attribute->signature->extendedAttributes->{"ImplementedBy"}; @@ -934,6 +931,7 @@ END } else { $functionName = "imp->${functionName}"; } + unshift(@arguments, GenerateCallWith($attribute->signature->extendedAttributes->{"CallWith"}, \@implContentDecls, " ", 0, 0)); $getterString = "${functionName}(" . join(", ", @arguments) . ")"; } else { $getterString = "impInstance"; @@ -1134,20 +1132,8 @@ END push(@implContentDecls, " $svgWrappedNativeType* imp = &impInstance;\n"); } } elsif ($attrExt->{"V8OnProto"}) { - if ($interfaceName eq "DOMWindow") { push(@implContentDecls, <<END); - v8::Handle<v8::Object> holder = info.Holder(); -END - } else { - # perform lookup first - push(@implContentDecls, <<END); - v8::Handle<v8::Object> holder = V8DOMWrapper::lookupDOMWrapper(V8${interfaceName}::GetTemplate(), info.This()); - if (holder.IsEmpty()) - return; -END - } - push(@implContentDecls, <<END); - ${implClassName}* imp = V8${implClassName}::toNative(holder); + ${implClassName}* imp = V8${implClassName}::toNative(info.Holder()); END } else { my $attrType = GetTypeFromSignature($attribute->signature); @@ -1227,9 +1213,6 @@ END push(@implContentDecls, ");\n"); } else { my ($functionName, @arguments) = $codeGenerator->SetterExpression(\%implIncludes, $interfaceName, $attribute); - - push(@arguments, GenerateCallWith($attribute->signature->extendedAttributes->{"CallWith"}, \@implContentDecls, " ", 1, 0)); - push(@arguments, $result); push(@arguments, "ec") if $useExceptions; if ($attribute->signature->extendedAttributes->{"ImplementedBy"}) { @@ -1240,6 +1223,7 @@ END } else { $functionName = "imp->${functionName}"; } + unshift(@arguments, GenerateCallWith($attribute->signature->extendedAttributes->{"CallWith"}, \@implContentDecls, " ", 1, 0)); push(@implContentDecls, " ${functionName}(" . join(", ", @arguments) . ");\n"); } } @@ -3386,7 +3370,7 @@ sub GenerateFunctionCallString() my @callWithOutput = (); my @callWithArgs = GenerateCallWith($callWith, \@callWithOutput, $indent, 0, 1, $function); $result .= join("", @callWithOutput); - push(@arguments, @callWithArgs); + unshift(@arguments, @callWithArgs); $index += @callWithArgs; $numberOfParameters += @callWithArgs; diff --git a/Source/WebCore/bindings/scripts/test/V8/V8TestInterface.cpp b/Source/WebCore/bindings/scripts/test/V8/V8TestInterface.cpp index ecc15b173..b828d54bc 100644 --- a/Source/WebCore/bindings/scripts/test/V8/V8TestInterface.cpp +++ b/Source/WebCore/bindings/scripts/test/V8/V8TestInterface.cpp @@ -134,7 +134,7 @@ static v8::Handle<v8::Value> supplementalMethod2Callback(const v8::Arguments& ar ScriptExecutionContext* scriptContext = getScriptExecutionContext(); if (!scriptContext) return v8::Undefined(); - RefPtr<TestObj> result = TestSupplemental::supplementalMethod2(imp, scriptContext, strArg, objArg, ec); + RefPtr<TestObj> result = TestSupplemental::supplementalMethod2(scriptContext, imp, strArg, objArg, ec); if (UNLIKELY(ec)) goto fail; return toV8(result.release(), args.GetIsolate()); diff --git a/Source/WebCore/bindings/v8/DOMDataStore.cpp b/Source/WebCore/bindings/v8/DOMDataStore.cpp index dbca39540..95efd5059 100644 --- a/Source/WebCore/bindings/v8/DOMDataStore.cpp +++ b/Source/WebCore/bindings/v8/DOMDataStore.cpp @@ -119,13 +119,13 @@ void* DOMDataStore::getDOMWrapperMap(DOMWrapperMapType type) return 0; } -void DOMDataStore::reportMemoryUsage(MemoryInstrumentation* instrumentation) +void DOMDataStore::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const { - instrumentation->reportPointer(this, MemoryInstrumentation::Binding); - domNodeMap().reportMemoryUsage(instrumentation); - activeDomNodeMap().reportMemoryUsage(instrumentation); - domObjectMap().reportMemoryUsage(instrumentation); - activeDomObjectMap().reportMemoryUsage(instrumentation); + memoryObjectInfo->reportObjectInfo(this, MemoryInstrumentation::Binding); + memoryObjectInfo->reportInstrumentedPointer(m_domNodeMap); + memoryObjectInfo->reportInstrumentedPointer(m_activeDomNodeMap); + memoryObjectInfo->reportInstrumentedPointer(m_domObjectMap); + memoryObjectInfo->reportInstrumentedPointer(m_activeDomObjectMap); } // Called when the object is near death (not reachable from JS roots). diff --git a/Source/WebCore/bindings/v8/DOMDataStore.h b/Source/WebCore/bindings/v8/DOMDataStore.h index b5bdfc392..3e6d43d72 100644 --- a/Source/WebCore/bindings/v8/DOMDataStore.h +++ b/Source/WebCore/bindings/v8/DOMDataStore.h @@ -47,7 +47,7 @@ namespace WebCore { class DOMData; class DOMDataStore; - class MemoryInstrumentation; + class MemoryObjectInfo; typedef WTF::Vector<DOMDataStore*> DOMDataList; @@ -87,7 +87,7 @@ namespace WebCore { static void weakActiveDOMObjectCallback(v8::Persistent<v8::Value> v8Object, void* domObject); static void weakNodeCallback(v8::Persistent<v8::Value> v8Object, void* domObject); - void reportMemoryUsage(MemoryInstrumentation*); + void reportMemoryUsage(MemoryObjectInfo*) const; protected: static void weakDOMObjectCallback(v8::Persistent<v8::Value> v8Object, void* domObject); diff --git a/Source/WebCore/bindings/v8/IntrusiveDOMWrapperMap.h b/Source/WebCore/bindings/v8/IntrusiveDOMWrapperMap.h index 5d61668c1..52308bdc4 100644 --- a/Source/WebCore/bindings/v8/IntrusiveDOMWrapperMap.h +++ b/Source/WebCore/bindings/v8/IntrusiveDOMWrapperMap.h @@ -102,10 +102,11 @@ class ChunkedTable { visitEntries(store, chunk->m_entries, chunk->m_entries + CHUNK_SIZE, visitor); } - void reportMemoryUsage(MemoryInstrumentation* instrumentation) + void reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const { + memoryObjectInfo->reportObjectInfo(this, MemoryInstrumentation::Binding); for (Chunk* chunk = m_chunks; chunk; chunk = chunk->m_previous) - instrumentation->reportPointer(chunk, MemoryInstrumentation::Binding); + memoryObjectInfo->reportPointer(chunk, MemoryInstrumentation::Binding); } private: @@ -183,10 +184,10 @@ public: m_table.clear(); } - virtual void reportMemoryUsage(MemoryInstrumentation* instrumentation) OVERRIDE + virtual void reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const OVERRIDE { - instrumentation->reportPointer(this, MemoryInstrumentation::Binding); - m_table.reportMemoryUsage(instrumentation); + memoryObjectInfo->reportObjectInfo(this, MemoryInstrumentation::Binding); + memoryObjectInfo->reportInstrumentedObject(m_table); } private: diff --git a/Source/WebCore/bindings/v8/NPV8Object.cpp b/Source/WebCore/bindings/v8/NPV8Object.cpp index d4d6cfc9c..6a76bfff5 100644 --- a/Source/WebCore/bindings/v8/NPV8Object.cpp +++ b/Source/WebCore/bindings/v8/NPV8Object.cpp @@ -186,6 +186,7 @@ void disposeUnderlyingV8Object(NPObject* npObject) #endif v8NpObject->v8Object.Dispose(); v8NpObject->v8Object.Clear(); + v8NpObject->rootObject = 0; } } // namespace WebCore @@ -320,6 +321,9 @@ bool _NPN_EvaluateHelper(NPP npp, bool popupsAllowed, NPObject* npObject, NPStri if (npObject->_class != npScriptObjectClass) return false; + V8NPObject* v8NpObject = reinterpret_cast<V8NPObject*>(npObject); + if (v8NpObject->v8Object.IsEmpty()) + return false; v8::HandleScope handleScope; v8::Handle<v8::Context> context = toV8Context(npp, npObject); diff --git a/Source/WebCore/bindings/v8/ScriptProfiler.cpp b/Source/WebCore/bindings/v8/ScriptProfiler.cpp index 8d6c5029e..07f039e7c 100644 --- a/Source/WebCore/bindings/v8/ScriptProfiler.cpp +++ b/Source/WebCore/bindings/v8/ScriptProfiler.cpp @@ -223,9 +223,7 @@ void ScriptProfiler::visitExternalArrays(ExternalArrayVisitor* visitor) void ScriptProfiler::collectBindingMemoryInfo(MemoryInstrumentation* instrumentation) { V8BindingPerIsolateData* data = V8BindingPerIsolateData::current(); - if (!data) - return; - data->reportMemoryUsage(instrumentation); + instrumentation->reportInstrumentedPointer(data); } size_t ScriptProfiler::profilerSnapshotsSize() diff --git a/Source/WebCore/bindings/v8/V8Binding.cpp b/Source/WebCore/bindings/v8/V8Binding.cpp index c29bcf833..8198ad0d6 100644 --- a/Source/WebCore/bindings/v8/V8Binding.cpp +++ b/Source/WebCore/bindings/v8/V8Binding.cpp @@ -90,15 +90,16 @@ void V8BindingPerIsolateData::dispose(v8::Isolate* isolate) isolate->SetData(0); } -void V8BindingPerIsolateData::reportMemoryUsage(MemoryInstrumentation* instrumentation) +void V8BindingPerIsolateData::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const { - instrumentation->reportPointer(this, MemoryInstrumentation::Binding); - instrumentation->reportHashMap(m_rawTemplates, MemoryInstrumentation::Binding); - instrumentation->reportHashMap(m_templates, MemoryInstrumentation::Binding); - m_stringCache.reportMemoryUsage(instrumentation); + memoryObjectInfo->reportObjectInfo(this, MemoryInstrumentation::Binding); + memoryObjectInfo->reportHashMap(m_rawTemplates); + memoryObjectInfo->reportHashMap(m_templates); + memoryObjectInfo->reportInstrumentedObject(m_stringCache); + memoryObjectInfo->reportVector(m_domDataList); for (size_t i = 0; i < m_domDataList.size(); i++) - m_domDataList[i]->reportMemoryUsage(instrumentation); + memoryObjectInfo->reportInstrumentedPointer(m_domDataList[i]); } // WebCoreStringResource is a helper class for v8ExternalString. It is used @@ -587,9 +588,10 @@ v8::Persistent<v8::FunctionTemplate> getToStringTemplate() return toStringTemplate; } -void StringCache::reportMemoryUsage(MemoryInstrumentation* instrumentation) +void StringCache::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const { - instrumentation->reportHashMap(m_stringCache, MemoryInstrumentation::Binding); + memoryObjectInfo->reportObjectInfo(this, MemoryInstrumentation::Binding); + memoryObjectInfo->reportHashMap(m_stringCache); } PassRefPtr<DOMStringList> v8ValueToWebCoreDOMStringList(v8::Handle<v8::Value> value) diff --git a/Source/WebCore/bindings/v8/V8Binding.h b/Source/WebCore/bindings/v8/V8Binding.h index cb420002f..c63bf21b8 100644 --- a/Source/WebCore/bindings/v8/V8Binding.h +++ b/Source/WebCore/bindings/v8/V8Binding.h @@ -34,6 +34,7 @@ #include "BindingSecurity.h" #include "DOMDataStore.h" #include "PlatformString.h" +#include "V8BindingMacros.h" #include "V8DOMWrapper.h" #include "V8GCController.h" #include "V8HiddenPropertyName.h" @@ -49,7 +50,7 @@ namespace WebCore { class EventListener; class EventTarget; class ExternalStringVisitor; - class MemoryInstrumentation; + class MemoryObjectInfo; // FIXME: Remove V8Binding. class V8Binding { @@ -79,7 +80,7 @@ namespace WebCore { void remove(StringImpl*); - void reportMemoryUsage(MemoryInstrumentation*); + void reportMemoryUsage(MemoryObjectInfo*) const; private: v8::Local<v8::String> v8ExternalStringSlow(StringImpl*, v8::Isolate*); @@ -217,7 +218,7 @@ namespace WebCore { GCEventData& gcEventData() { return m_gcEventData; } - void reportMemoryUsage(MemoryInstrumentation*); + void reportMemoryUsage(MemoryObjectInfo*) const; private: explicit V8BindingPerIsolateData(v8::Isolate*); @@ -439,6 +440,31 @@ namespace WebCore { return result; } + // Validates that the passed object is a sequence type per WebIDL spec + // http://www.w3.org/TR/2012/WD-WebIDL-20120207/#es-sequence + inline v8::Handle<v8::Value> toV8Sequence(v8::Handle<v8::Value> value, uint32_t& length) + { + if (!value->IsObject()) { + V8Proxy::throwTypeError(); + return v8::Local<v8::Value>(); + } + + v8::Local<v8::Value> v8Value(v8::Local<v8::Value>::New(value)); + v8::Local<v8::Object> object = v8::Local<v8::Object>::Cast(v8Value); + + EXCEPTION_BLOCK(v8::Local<v8::Value>, lengthValue, object->Get(v8::String::New("length"))); + + if (lengthValue->IsUndefined() || lengthValue->IsNull()) { + V8Proxy::throwTypeError(); + return v8::Local<v8::Value>(); + } + + EXCEPTION_BLOCK(uint32_t, sequenceLength, lengthValue->Int32Value()); + length = sequenceLength; + + return v8Value; + } + // Enables caching v8 wrappers created for WTF::StringImpl. Currently this cache requires // all the calls (both to convert WTF::String to v8::String and to GC the handle) // to be performed on the main thread. diff --git a/Source/WebCore/bindings/v8/V8DOMMap.h b/Source/WebCore/bindings/v8/V8DOMMap.h index 4ee6c318d..2b70c582b 100644 --- a/Source/WebCore/bindings/v8/V8DOMMap.h +++ b/Source/WebCore/bindings/v8/V8DOMMap.h @@ -39,7 +39,7 @@ namespace WebCore { class DOMDataStore; class Node; - class MemoryInstrumentation; + class MemoryObjectInfo; template <class KeyType, class ValueType> class AbstractWeakReferenceMap { public: @@ -64,7 +64,7 @@ namespace WebCore { v8::WeakReferenceCallback weakReferenceCallback() { return m_weakReferenceCallback; } - virtual void reportMemoryUsage(MemoryInstrumentation*) = 0; + virtual void reportMemoryUsage(MemoryObjectInfo*) const = 0; private: v8::WeakReferenceCallback m_weakReferenceCallback; @@ -134,9 +134,10 @@ namespace WebCore { visitor->endMap(); } - virtual void reportMemoryUsage(MemoryInstrumentation* instrumentation) OVERRIDE + virtual void reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const OVERRIDE { - instrumentation->reportHashMap(m_map, MemoryInstrumentation::Binding); + memoryObjectInfo->reportObjectInfo(this, MemoryInstrumentation::Binding); + memoryObjectInfo->reportHashMap(m_map); } protected: diff --git a/Source/WebCore/bindings/v8/V8GCController.cpp b/Source/WebCore/bindings/v8/V8GCController.cpp index 991e88b5c..5943dc3b5 100644 --- a/Source/WebCore/bindings/v8/V8GCController.cpp +++ b/Source/WebCore/bindings/v8/V8GCController.cpp @@ -475,23 +475,6 @@ int V8GCController::workingSetEstimateMB = 0; namespace { -int getMemoryUsageInMB() -{ -#if PLATFORM(CHROMIUM) - return MemoryUsageSupport::memoryUsageMB(); -#else - return 0; -#endif -} - -int getActualMemoryUsageInMB() -{ -#if PLATFORM(CHROMIUM) - return MemoryUsageSupport::actualMemoryUsageMB(); -#else - return 0; -#endif -} } // anonymous namespace @@ -506,7 +489,7 @@ void V8GCController::gcEpilogue() GCEpilogueVisitor<Node, SpecialCaseEpilogueNodeHandler, &DOMDataStore::weakNodeCallback> epilogueNodeVisitor; visitActiveDOMNodes(&epilogueNodeVisitor); - workingSetEstimateMB = getActualMemoryUsageInMB(); + workingSetEstimateMB = MemoryUsageSupport::actualMemoryUsageMB(); #ifndef NDEBUG // Check all survivals are weak. @@ -530,7 +513,7 @@ void V8GCController::checkMemoryUsage() const int lowMemoryUsageMB = MemoryUsageSupport::lowMemoryUsageMB(); const int highMemoryUsageMB = MemoryUsageSupport::highMemoryUsageMB(); const int highUsageDeltaMB = MemoryUsageSupport::highUsageDeltaMB(); - int memoryUsageMB = getMemoryUsageInMB(); + int memoryUsageMB = MemoryUsageSupport::memoryUsageMB(); if ((memoryUsageMB > lowMemoryUsageMB && memoryUsageMB > 2 * workingSetEstimateMB) || (memoryUsageMB > highMemoryUsageMB && memoryUsageMB > workingSetEstimateMB + highUsageDeltaMB)) v8::V8::LowMemoryNotification(); #endif diff --git a/Source/WebCore/bindings/v8/V8Utilities.cpp b/Source/WebCore/bindings/v8/V8Utilities.cpp index 7d9334d0e..57d130a7c 100644 --- a/Source/WebCore/bindings/v8/V8Utilities.cpp +++ b/Source/WebCore/bindings/v8/V8Utilities.cpp @@ -92,26 +92,17 @@ bool extractTransferables(v8::Local<v8::Value> value, MessagePortArray& ports, A return true; } - if (!value->IsObject()) { - V8Proxy::throwTypeError("TransferArray argument must be an object"); - return false; - } uint32_t length = 0; - v8::Local<v8::Object> transferrables = v8::Local<v8::Object>::Cast(value); - if (value->IsArray()) { v8::Local<v8::Array> array = v8::Local<v8::Array>::Cast(value); length = array->Length(); } else { - // Sequence-type object - get the length attribute - v8::Local<v8::Value> sequenceLength = transferrables->Get(v8::String::New("length")); - if (!sequenceLength->IsNumber()) { - V8Proxy::throwTypeError("TransferArray argument has no length attribute"); + if (toV8Sequence(value, length).IsEmpty()) return false; - } - length = sequenceLength->Uint32Value(); } + v8::Local<v8::Object> transferrables = v8::Local<v8::Object>::Cast(value); + // Validate the passed array of transferrables. for (unsigned int i = 0; i < length; ++i) { v8::Local<v8::Value> transferrable = transferrables->Get(i); @@ -126,7 +117,7 @@ bool extractTransferables(v8::Local<v8::Value> value, MessagePortArray& ports, A else if (V8ArrayBuffer::HasInstance(transferrable)) arrayBuffers.append(V8ArrayBuffer::toNative(v8::Handle<v8::Object>::Cast(transferrable))); else { - V8Proxy::throwTypeError("TransferArray argument must contain only Transferables"); + V8Proxy::throwTypeError(); return false; } } diff --git a/Source/WebCore/css/CSSFontSelector.cpp b/Source/WebCore/css/CSSFontSelector.cpp index cb3262e52..0a9a3a078 100644 --- a/Source/WebCore/css/CSSFontSelector.cpp +++ b/Source/WebCore/css/CSSFontSelector.cpp @@ -586,6 +586,10 @@ void CSSFontSelector::beginLoadTimerFired(Timer<WebCore::CSSFontSelector>*) } // Ensure that if the request count reaches zero, the frame loader will know about it. cachedResourceLoader->loadDone(); + // New font loads may be triggered by layout after the document load is complete but before we have dispatched + // didFinishLoading for the frame. Make sure the delegate is always dispatched by checking explicitly. + if (m_document && m_document->frame()) + m_document->frame()->loader()->checkLoadComplete(); } } diff --git a/Source/WebCore/dom/Attr.cpp b/Source/WebCore/dom/Attr.cpp index de9e4ff43..95c3fe052 100644 --- a/Source/WebCore/dom/Attr.cpp +++ b/Source/WebCore/dom/Attr.cpp @@ -119,7 +119,7 @@ void Attr::setValue(const AtomicString& value) createTextChild(); m_ignoreChildrenChanged--; - invalidateNodeListsCacheAfterAttributeChanged(m_name, m_element); + invalidateNodeListCachesInAncestors(&m_name, m_element); } void Attr::setValue(const AtomicString& value, ExceptionCode&) @@ -162,7 +162,7 @@ void Attr::childrenChanged(bool, Node*, Node*, int) if (m_ignoreChildrenChanged > 0) return; - invalidateNodeListsCacheAfterAttributeChanged(qualifiedName(), m_element); + invalidateNodeListCachesInAncestors(&qualifiedName(), m_element); // FIXME: We should include entity references in the value diff --git a/Source/WebCore/dom/ChildNodeList.cpp b/Source/WebCore/dom/ChildNodeList.cpp index 4b50bc88e..86fab6f30 100644 --- a/Source/WebCore/dom/ChildNodeList.cpp +++ b/Source/WebCore/dom/ChildNodeList.cpp @@ -28,7 +28,7 @@ namespace WebCore { ChildNodeList::ChildNodeList(PassRefPtr<Node> node) - : DynamicNodeList(node, RootedAtNode, DoNotInvalidateOnAttributeChange) + : DynamicNodeList(node, NodeListIsRootedAtNode, DoNotInvalidateOnAttributeChanges) { } diff --git a/Source/WebCore/dom/ClassNodeList.cpp b/Source/WebCore/dom/ClassNodeList.cpp index 36a89e4e6..14db32478 100644 --- a/Source/WebCore/dom/ClassNodeList.cpp +++ b/Source/WebCore/dom/ClassNodeList.cpp @@ -37,7 +37,7 @@ namespace WebCore { ClassNodeList::ClassNodeList(PassRefPtr<Node> rootNode, const String& classNames) - : DynamicSubtreeNodeList(rootNode) + : DynamicSubtreeNodeList(rootNode, InvalidateOnClassAttrChange) , m_classNames(classNames, document()->inQuirksMode()) , m_originalClassNames(classNames) { diff --git a/Source/WebCore/dom/ComposedShadowTreeWalker.cpp b/Source/WebCore/dom/ComposedShadowTreeWalker.cpp index 1d8feed18..2faf8593c 100644 --- a/Source/WebCore/dom/ComposedShadowTreeWalker.cpp +++ b/Source/WebCore/dom/ComposedShadowTreeWalker.cpp @@ -51,18 +51,18 @@ static inline ElementShadow* shadowOfParent(const Node* node) return 0; } -inline void ComposedShadowTreeWalker::ParentTranversalDetails::didTraverseInsertionPoint(InsertionPoint* insertionPoint) +inline void ComposedShadowTreeWalker::ParentTraversalDetails::didTraverseInsertionPoint(InsertionPoint* insertionPoint) { if (!m_insertionPoint) m_insertionPoint = insertionPoint; } -inline void ComposedShadowTreeWalker::ParentTranversalDetails::didTraverseShadowRoot(const ShadowRoot* root) +inline void ComposedShadowTreeWalker::ParentTraversalDetails::didTraverseShadowRoot(const ShadowRoot* root) { m_resetStyleInheritance = m_resetStyleInheritance || root->resetStyleInheritance(); } -inline void ComposedShadowTreeWalker::ParentTranversalDetails::didFindNode(ContainerNode* node) +inline void ComposedShadowTreeWalker::ParentTraversalDetails::didFindNode(ContainerNode* node) { if (!m_outOfComposition) m_node = node; @@ -75,7 +75,7 @@ ComposedShadowTreeWalker ComposedShadowTreeWalker::fromFirstChild(const Node* no return walker; } -void ComposedShadowTreeWalker::findParent(const Node* node, ParentTranversalDetails* details) +void ComposedShadowTreeWalker::findParent(const Node* node, ParentTraversalDetails* details) { ComposedShadowTreeWalker walker(node, CrossUpperBoundary, CanStartFromShadowBoundary); ContainerNode* found = toContainerNode(walker.traverseParent(walker.get(), details)); @@ -203,7 +203,7 @@ inline Node* ComposedShadowTreeWalker::escapeFallbackContentElement(const Node* return 0; } -inline Node* ComposedShadowTreeWalker::traverseNodeEscapingFallbackContents(const Node* node, ParentTranversalDetails* details) const +inline Node* ComposedShadowTreeWalker::traverseNodeEscapingFallbackContents(const Node* node, ParentTraversalDetails* details) const { ASSERT(node); if (!isInsertionPoint(node)) @@ -222,7 +222,7 @@ void ComposedShadowTreeWalker::parent() // FIXME: Use an iterative algorithm so that it can be inlined. // https://bugs.webkit.org/show_bug.cgi?id=90415 -Node* ComposedShadowTreeWalker::traverseParent(const Node* node, ParentTranversalDetails* details) const +Node* ComposedShadowTreeWalker::traverseParent(const Node* node, ParentTraversalDetails* details) const { if (!canCrossUpperBoundary() && node->isShadowRoot()) { ASSERT(toShadowRoot(node)->isYoungest()); @@ -243,14 +243,14 @@ Node* ComposedShadowTreeWalker::traverseParent(const Node* node, ParentTranversa return traverseParentInCurrentTree(node, details); } -inline Node* ComposedShadowTreeWalker::traverseParentInCurrentTree(const Node* node, ParentTranversalDetails* details) const +inline Node* ComposedShadowTreeWalker::traverseParentInCurrentTree(const Node* node, ParentTraversalDetails* details) const { if (Node* parent = node->parentNode()) return parent->isShadowRoot() ? traverseParentBackToYoungerShadowRootOrHost(toShadowRoot(parent), details) : traverseNodeEscapingFallbackContents(parent, details); return 0; } -Node* ComposedShadowTreeWalker::traverseParentBackToYoungerShadowRootOrHost(const ShadowRoot* shadowRoot, ParentTranversalDetails* details) const +Node* ComposedShadowTreeWalker::traverseParentBackToYoungerShadowRootOrHost(const ShadowRoot* shadowRoot, ParentTraversalDetails* details) const { ASSERT(shadowRoot); if (shadowRoot->isYoungest()) { diff --git a/Source/WebCore/dom/ComposedShadowTreeWalker.h b/Source/WebCore/dom/ComposedShadowTreeWalker.h index 0af34cd42..3c7e00ba4 100644 --- a/Source/WebCore/dom/ComposedShadowTreeWalker.h +++ b/Source/WebCore/dom/ComposedShadowTreeWalker.h @@ -49,9 +49,9 @@ public: CannotStartFromShadowBoundary }; - class ParentTranversalDetails { + class ParentTraversalDetails { public: - ParentTranversalDetails() + ParentTraversalDetails() : m_node(0) , m_insertionPoint(0) , m_resetStyleInheritance(false) @@ -80,7 +80,7 @@ public: // For a common use case such as: // for (ComposedShadowTreeWalker walker = ComposedShadowTreeWalker::fromFirstChild(node); walker.get(); walker.nextSibling()) static ComposedShadowTreeWalker fromFirstChild(const Node*, Policy = CrossUpperBoundary); - static void findParent(const Node*, ParentTranversalDetails*); + static void findParent(const Node*, ParentTraversalDetails*); Node* get() const { return const_cast<Node*>(m_node); } @@ -96,7 +96,7 @@ public: void previous(); private: - ComposedShadowTreeWalker(const Node*, ParentTranversalDetails*); + ComposedShadowTreeWalker(const Node*, ParentTraversalDetails*); enum TraversalDirection { TraversalDirectionForward, @@ -131,7 +131,7 @@ private: Node* traverseFirstChild(const Node*) const; Node* traverseLastChild(const Node*) const; Node* traverseChild(const Node*, TraversalDirection) const; - Node* traverseParent(const Node*, ParentTranversalDetails* = 0) const; + Node* traverseParent(const Node*, ParentTraversalDetails* = 0) const; static Node* traverseNextSibling(const Node*); static Node* traversePreviousSibling(const Node*); @@ -142,9 +142,9 @@ private: static Node* traverseSiblingOrBackToYoungerShadowRoot(const Node*, TraversalDirection); static Node* escapeFallbackContentElement(const Node*, TraversalDirection); - Node* traverseNodeEscapingFallbackContents(const Node*, ParentTranversalDetails* = 0) const; - Node* traverseParentInCurrentTree(const Node*, ParentTranversalDetails* = 0) const; - Node* traverseParentBackToYoungerShadowRootOrHost(const ShadowRoot*, ParentTranversalDetails* = 0) const; + Node* traverseNodeEscapingFallbackContents(const Node*, ParentTraversalDetails* = 0) const; + Node* traverseParentInCurrentTree(const Node*, ParentTraversalDetails* = 0) const; + Node* traverseParentBackToYoungerShadowRootOrHost(const ShadowRoot*, ParentTraversalDetails* = 0) const; const Node* m_node; Policy m_policy; diff --git a/Source/WebCore/dom/ContainerNode.cpp b/Source/WebCore/dom/ContainerNode.cpp index c23a0b9e9..fd53a2fad 100644 --- a/Source/WebCore/dom/ContainerNode.cpp +++ b/Source/WebCore/dom/ContainerNode.cpp @@ -680,7 +680,7 @@ void ContainerNode::childrenChanged(bool changedByParser, Node*, Node*, int chil document()->incDOMTreeVersion(); if (!changedByParser && childCountDelta) document()->updateRangesAfterChildrenChanged(this); - invalidateNodeListsCacheAfterChildrenChanged(); + invalidateNodeListCachesInAncestors(); } void ContainerNode::cloneChildNodes(ContainerNode *clone) diff --git a/Source/WebCore/dom/DOMAllInOne.cpp b/Source/WebCore/dom/DOMAllInOne.cpp index 592d72992..be7bd07c1 100644 --- a/Source/WebCore/dom/DOMAllInOne.cpp +++ b/Source/WebCore/dom/DOMAllInOne.cpp @@ -84,6 +84,8 @@ #include "ExceptionBase.cpp" #include "ExceptionCodePlaceholder.cpp" #include "IconURL.cpp" +#include "IdTargetObserver.cpp" +#include "IdTargetObserverRegistry.cpp" #include "KeyboardEvent.cpp" #include "MessageChannel.cpp" #include "MessageEvent.cpp" @@ -144,6 +146,7 @@ #include "ViewportArguments.cpp" #include "WebKitAnimationEvent.cpp" #include "WebKitNamedFlow.cpp" +#include "WebKitNamedFlowCollection.cpp" #include "WebKitTransitionEvent.cpp" #include "WheelEvent.cpp" #include "WindowEventContext.cpp" diff --git a/Source/WebCore/dom/Document.cpp b/Source/WebCore/dom/Document.cpp index bc5eabbda..64167fcec 100644 --- a/Source/WebCore/dom/Document.cpp +++ b/Source/WebCore/dom/Document.cpp @@ -157,6 +157,7 @@ #include "UndoManager.h" #include "UserContentURLPattern.h" #include "WebKitNamedFlow.h" +#include "WebKitNamedFlowCollection.h" #include "XMLDocumentParser.h" #include "XMLHttpRequest.h" #include "XMLNSNames.h" @@ -564,7 +565,10 @@ Document::Document(Frame* frame, const KURL& url, bool isXHTML, bool isHTML) static int docID = 0; m_docID = docID++; - + + for (unsigned i = 0; i < WTF_ARRAY_LENGTH(m_nodeListCounts); i++) + m_nodeListCounts[i] = 0; + for (unsigned i = 0; i < WTF_ARRAY_LENGTH(m_collections); i++) m_collections[i] = 0; @@ -615,6 +619,9 @@ Document::~Document() if (m_styleSheets) m_styleSheets->documentDestroyed(); + if (m_namedFlows) + m_namedFlows->documentDestroyed(); + if (m_elemSheet) m_elemSheet->clearOwnerNode(); if (m_pageUserSheet) @@ -648,6 +655,14 @@ Document::~Document() if (hasRareData()) clearRareData(); + ASSERT(!m_listsInvalidatedAtDocument.size()); + + for (unsigned i = 0; i < WTF_ARRAY_LENGTH(m_nodeListCounts); i++) + ASSERT(!m_nodeListCounts[i]); + + for (unsigned i = 0; i < WTF_ARRAY_LENGTH(m_collections); i++) + ASSERT(!m_collections[i]); + m_document = 0; InspectorCounters::decrementCounter(InspectorCounters::DocumentCounter); @@ -804,7 +819,6 @@ void Document::setDocType(PassRefPtr<DocumentType> docType) if (m_docType) { this->adoptIfNeeded(m_docType.get()); #if ENABLE(LEGACY_VIEWPORT_ADAPTION) - ASSERT(m_viewportArguments.type == ViewportArguments::Implicit); if (m_docType->publicId().startsWith("-//wapforum//dtd xhtml mobile 1.", /* caseSensitive */ false)) processViewport("width=device-width, height=device-height", ViewportArguments::XHTMLMobileProfile); #endif @@ -1116,44 +1130,26 @@ bool Document::cssGridLayoutEnabled() const #if ENABLE(CSS_REGIONS) -static bool validFlowName(const String& flowName) -{ - if (equalIgnoringCase(flowName, "auto") - || equalIgnoringCase(flowName, "default") - || equalIgnoringCase(flowName, "inherit") - || equalIgnoringCase(flowName, "initial") - || equalIgnoringCase(flowName, "none")) - return false; - return true; -} - PassRefPtr<WebKitNamedFlow> Document::webkitGetFlowByName(const String& flowName) { - return webkitGetFlowByName(flowName, CheckFlowNameForInvalidValues); -} - -PassRefPtr<WebKitNamedFlow> Document::webkitGetFlowByName(const String& flowName, FlowNameCheck flowNameCheck) -{ if (!cssRegionsEnabled() || !renderer()) return 0; - if (flowNameCheck == CheckFlowNameForInvalidValues) { - if (flowName.isEmpty() || !validFlowName(flowName)) - return 0; - - // Make a slower check for invalid flow name. - CSSParser parser(document()); - if (!parser.parseFlowThread(flowName)) - return 0; - } + // It's possible to have pending styles not applied that affect the existing flows. + updateStyleIfNeeded(); - if (RenderView* view = renderer()->view()) - return view->flowThreadController()->ensureRenderFlowThreadWithName(flowName)->ensureNamedFlow(); - return 0; + return namedFlows()->flowByName(flowName); } - #endif +WebKitNamedFlowCollection* Document::namedFlows() +{ + if (!m_namedFlows) + m_namedFlows = WebKitNamedFlowCollection::create(this); + + return m_namedFlows.get(); +} + PassRefPtr<Element> Document::createElementNS(const String& namespaceURI, const String& qualifiedName, ExceptionCode& ec) { String prefix, localName; @@ -2084,6 +2080,11 @@ void Document::detach() ASSERT(attached()); ASSERT(!m_inPageCache); +#if ENABLE(POINTER_LOCK) + if (page()) + page()->pointerLockController()->documentDetached(this); +#endif + if (this == topDocument()) clearAXObjectCache(); @@ -3865,20 +3866,48 @@ void Document::setCSSTarget(Element* n) n->setNeedsStyleRecalc(); } -void Document::registerDynamicSubtreeNodeList(DynamicSubtreeNodeList* list) +void Document::registerNodeListCache(DynamicNodeListCacheBase* list) { - m_listsInvalidatedAtDocument.add(list); + if (list->type() != InvalidCollectionType) + m_nodeListCounts[InvalidateOnIdNameAttrChange]++; + m_nodeListCounts[list->invalidationType()]++; + if (list->isRootedAtDocument()) + m_listsInvalidatedAtDocument.add(list); } -void Document::unregisterDynamicSubtreeNodeList(DynamicSubtreeNodeList* list) +void Document::unregisterNodeListCache(DynamicNodeListCacheBase* list) { - m_listsInvalidatedAtDocument.remove(list); + if (list->type() != InvalidCollectionType) + m_nodeListCounts[InvalidateOnIdNameAttrChange]--; + m_nodeListCounts[list->invalidationType()]--; + if (list->isRootedAtDocument()) { + ASSERT(m_listsInvalidatedAtDocument.contains(list)); + m_listsInvalidatedAtDocument.remove(list); + } +} + +bool Document::shouldInvalidateNodeListCaches(const QualifiedName* attrName) const +{ + if (attrName) { + for (int type = DoNotInvalidateOnAttributeChanges + 1; type < numNodeListInvalidationTypes; type++) { + if (m_nodeListCounts[type] && DynamicNodeListCacheBase::shouldInvalidateTypeOnAttributeChange(static_cast<NodeListInvalidationType>(type), *attrName)) + return true; + } + return false; + } + + for (int type = 0; type < numNodeListInvalidationTypes; type++) { + if (m_nodeListCounts[type]) + return true; + } + + return false; } void Document::clearNodeListCaches() { - HashSet<DynamicSubtreeNodeList*>::iterator end = m_listsInvalidatedAtDocument.end(); - for (HashSet<DynamicSubtreeNodeList*>::iterator it = m_listsInvalidatedAtDocument.begin(); it != end; ++it) + HashSet<DynamicNodeListCacheBase*>::iterator end = m_listsInvalidatedAtDocument.end(); + for (HashSet<DynamicNodeListCacheBase*>::iterator it = m_listsInvalidatedAtDocument.begin(); it != end; ++it) (*it)->invalidateCache(); } @@ -5965,7 +5994,7 @@ PassRefPtr<NodeList> Document::getItems(const String& typeNames) // In this case we need to create an unique string identifier to map such request in the cache. String localTypeNames = typeNames.isNull() ? MicroDataItemList::undefinedItemType() : typeNames; - return ensureRareData()->ensureNodeLists(this)->addCacheWithName<MicroDataItemList>(this, DynamicNodeList::MicroDataItemListType, localTypeNames); + return ensureRareData()->ensureNodeLists()->addCacheWithName<MicroDataItemList>(this, DynamicNodeList::MicroDataItemListType, localTypeNames); } #endif diff --git a/Source/WebCore/dom/Document.h b/Source/WebCore/dom/Document.h index 87dfa32c2..2f4db13ce 100644 --- a/Source/WebCore/dom/Document.h +++ b/Source/WebCore/dom/Document.h @@ -79,6 +79,7 @@ class DocumentMarkerController; class DocumentParser; class DocumentType; class DocumentWeakReference; +class DynamicNodeListCacheBase; class EditingText; class Element; class EntityReference; @@ -137,6 +138,7 @@ class TextResourceDecoder; class TreeWalker; class UndoManager; class WebKitNamedFlow; +class WebKitNamedFlowCollection; class XMLHttpRequest; class XPathEvaluator; class XPathExpression; @@ -186,6 +188,19 @@ enum PageshowEventPersistence { enum StyleResolverUpdateFlag { RecalcStyleImmediately, DeferRecalcStyle, RecalcStyleIfNeeded }; +enum NodeListInvalidationType { + DoNotInvalidateOnAttributeChanges = 0, + InvalidateOnClassAttrChange, + InvalidateOnIdNameAttrChange, + InvalidateOnNameAttrChange, + InvalidateOnForAttrChange, + InvalidateForFormControls, + InvalidateOnHRefAttrChange, + InvalidateOnItemAttrChange, + InvalidateOnAnyAttrChange, +}; +const int numNodeListInvalidationTypes = InvalidateOnAnyAttrChange + 1; + class Document : public ContainerNode, public TreeScope, public ScriptExecutionContext { public: static PassRefPtr<Document> create(Frame* frame, const KURL& url) @@ -332,14 +347,11 @@ public: bool cssRegionsEnabled() const; #if ENABLE(CSS_REGIONS) - enum FlowNameCheck { - CheckFlowNameForInvalidValues, - DoNotCheckFlowNameForInvalidValues - }; PassRefPtr<WebKitNamedFlow> webkitGetFlowByName(const String&); - PassRefPtr<WebKitNamedFlow> webkitGetFlowByName(const String&, FlowNameCheck); #endif + WebKitNamedFlowCollection* namedFlows(); + bool regionBasedColumnsEnabled() const; bool cssGridLayoutEnabled() const; @@ -723,8 +735,9 @@ public: bool isPendingStyleRecalc() const; void styleRecalcTimerFired(Timer<Document>*); - void registerDynamicSubtreeNodeList(DynamicSubtreeNodeList*); - void unregisterDynamicSubtreeNodeList(DynamicSubtreeNodeList*); + void registerNodeListCache(DynamicNodeListCacheBase*); + void unregisterNodeListCache(DynamicNodeListCacheBase*); + bool shouldInvalidateNodeListCaches(const QualifiedName* attrName = 0) const; void clearNodeListCaches(); void attachNodeIterator(NodeIterator*); @@ -1408,7 +1421,8 @@ private: InheritedBool m_designMode; - HashSet<DynamicSubtreeNodeList*> m_listsInvalidatedAtDocument; + HashSet<DynamicNodeListCacheBase*> m_listsInvalidatedAtDocument; + unsigned m_nodeListCounts[numNodeListInvalidationTypes]; HTMLCollection* m_collections[NumUnnamedDocumentCachedTypes]; typedef HashMap<AtomicString, HTMLNameCollection*> NamedCollectionMap; @@ -1516,6 +1530,8 @@ private: bool m_visualUpdatesAllowed; Timer<Document> m_visualUpdatesSuppressionTimer; + RefPtr<WebKitNamedFlowCollection> m_namedFlows; + #ifndef NDEBUG bool m_didDispatchViewportPropertiesChanged; #endif diff --git a/Source/WebCore/dom/DynamicNodeList.cpp b/Source/WebCore/dom/DynamicNodeList.cpp index b97125c6b..25a4504e3 100644 --- a/Source/WebCore/dom/DynamicNodeList.cpp +++ b/Source/WebCore/dom/DynamicNodeList.cpp @@ -25,11 +25,30 @@ #include "Document.h" #include "Element.h" +#include "HTMLCollection.h" +#include "HTMLPropertiesCollection.h" namespace WebCore { -DynamicSubtreeNodeList::~DynamicSubtreeNodeList() +void DynamicNodeListCacheBase::invalidateCache() const { + m_cachedItem = 0; + m_isLengthCacheValid = false; + m_isItemCacheValid = false; + m_isNameCacheValid = false; + if (type() == InvalidCollectionType) + return; + + const HTMLCollectionCacheBase* cacheBase = static_cast<const HTMLCollectionCacheBase*>(this); + cacheBase->m_idCache.clear(); + cacheBase->m_nameCache.clear(); + cacheBase->m_cachedElementsArrayOffset = 0; + +#if ENABLE(MICRODATA) + // FIXME: There should be more generic mechanism to clear caches in subclasses. + if (type() == ItemProperties) + static_cast<const HTMLPropertiesCollection*>(this)->invalidateCache(); +#endif } unsigned DynamicSubtreeNodeList::length() const diff --git a/Source/WebCore/dom/DynamicNodeList.h b/Source/WebCore/dom/DynamicNodeList.h index 83b2ed3eb..a3c12c2d9 100644 --- a/Source/WebCore/dom/DynamicNodeList.h +++ b/Source/WebCore/dom/DynamicNodeList.h @@ -24,7 +24,9 @@ #ifndef DynamicNodeList_h #define DynamicNodeList_h +#include "CollectionType.h" #include "Document.h" +#include "HTMLNames.h" #include "NodeList.h" #include <wtf/Forward.h> #include <wtf/RefPtr.h> @@ -34,30 +36,45 @@ namespace WebCore { class Element; class Node; +enum NodeListRootType { + NodeListIsRootedAtNode, + NodeListIsRootedAtDocument, +}; + class DynamicNodeListCacheBase { public: - enum RootType { - RootedAtNode, - RootedAtDocument, + enum ItemBeforeSupportType { + DoNotSupportItemBefore, + SupportItemBefore, }; - enum InvalidationType { - AlwaysInvalidate, - DoNotInvalidateOnAttributeChange, - }; - - DynamicNodeListCacheBase(RootType rootType, InvalidationType invalidationType) - : m_rootedAtDocument(rootType == RootedAtDocument) - , m_shouldInvalidateOnAttributeChange(invalidationType == AlwaysInvalidate) + DynamicNodeListCacheBase(NodeListRootType rootType, NodeListInvalidationType invalidationType, + CollectionType collectionType = InvalidCollectionType, ItemBeforeSupportType itemBeforeSupportType = DoNotSupportItemBefore) + : m_cachedItem(0) + , m_isLengthCacheValid(false) + , m_isItemCacheValid(false) + , m_rootedAtDocument(rootType == NodeListIsRootedAtDocument) + , m_invalidationType(invalidationType) + , m_isNameCacheValid(false) + , m_collectionType(collectionType) + , m_supportsItemBefore(itemBeforeSupportType == SupportItemBefore) { - clearCache(); + ASSERT(m_invalidationType == static_cast<unsigned>(invalidationType)); + ASSERT(m_collectionType == static_cast<unsigned>(collectionType)); } public: ALWAYS_INLINE bool isRootedAtDocument() const { return m_rootedAtDocument; } - ALWAYS_INLINE bool shouldInvalidateOnAttributeChange() const { return m_shouldInvalidateOnAttributeChange; } + ALWAYS_INLINE NodeListInvalidationType invalidationType() const { return static_cast<NodeListInvalidationType>(m_invalidationType); } + ALWAYS_INLINE CollectionType type() const { return static_cast<CollectionType>(m_collectionType); } + + void invalidateCache() const; + + static bool shouldInvalidateTypeOnAttributeChange(NodeListInvalidationType, const QualifiedName&); protected: + bool supportsItemBefore() const { return m_supportsItemBefore; } + ALWAYS_INLINE bool isItemCacheValid() const { return m_isItemCacheValid; } ALWAYS_INLINE Node* cachedItem() const { return m_cachedItem; } ALWAYS_INLINE unsigned cachedItemOffset() const { return m_cachedItemOffset; } @@ -71,17 +88,14 @@ protected: } ALWAYS_INLINE void setItemCache(Node* item, unsigned offset) const { + ASSERT(item); m_cachedItem = item; m_cachedItemOffset = offset; m_isItemCacheValid = true; } - void clearCache() const - { - m_cachedItem = 0; - m_isLengthCacheValid = false; - m_isItemCacheValid = false; - } + bool hasNameCache() const { return m_isNameCacheValid; } + void setHasNameCache() const { m_isNameCacheValid = true; } private: mutable Node* m_cachedItem; @@ -89,12 +103,42 @@ private: mutable unsigned m_cachedItemOffset; mutable unsigned m_isLengthCacheValid : 1; mutable unsigned m_isItemCacheValid : 1; - - // From DynamicNodeList const unsigned m_rootedAtDocument : 1; - const unsigned m_shouldInvalidateOnAttributeChange : 1; + const unsigned m_invalidationType : 4; + + // From HTMLCollection + mutable unsigned m_isNameCacheValid : 1; + const unsigned m_collectionType : 5; + const unsigned m_supportsItemBefore : 1; }; +ALWAYS_INLINE bool DynamicNodeListCacheBase::shouldInvalidateTypeOnAttributeChange(NodeListInvalidationType type, const QualifiedName& attrName) +{ + switch (type) { + case InvalidateOnClassAttrChange: + return attrName == HTMLNames::classAttr; + case InvalidateOnNameAttrChange: + return attrName == HTMLNames::nameAttr; + case InvalidateOnIdNameAttrChange: + return attrName == HTMLNames::idAttr || attrName == HTMLNames::nameAttr; + case InvalidateOnForAttrChange: + return attrName == HTMLNames::forAttr; + case InvalidateForFormControls: + return attrName == HTMLNames::nameAttr || attrName == HTMLNames::idAttr || attrName == HTMLNames::forAttr || attrName == HTMLNames::typeAttr; + case InvalidateOnHRefAttrChange: + return attrName == HTMLNames::hrefAttr; + case InvalidateOnItemAttrChange: +#if ENABLE(MICRODATA) + return attrName == HTMLNames::itemscopeAttr || attrName == HTMLNames::itempropAttr || attrName == HTMLNames::itemtypeAttr; +#endif // Intentionally fall through + case DoNotInvalidateOnAttributeChanges: + return false; + case InvalidateOnAnyAttrChange: + return true; + } + return false; +} + class DynamicNodeList : public NodeList, public DynamicNodeListCacheBase { public: enum NodeListType { @@ -106,7 +150,7 @@ public: LabelsNodeListType, MicroDataItemListType, }; - DynamicNodeList(PassRefPtr<Node> ownerNode, RootType rootType, InvalidationType invalidationType) + DynamicNodeList(PassRefPtr<Node> ownerNode, NodeListRootType rootType, NodeListInvalidationType invalidationType) : DynamicNodeListCacheBase(rootType, invalidationType) , m_ownerNode(ownerNode) { } @@ -119,7 +163,6 @@ public: // Other methods (not part of DOM) Node* ownerNode() const { return m_ownerNode.get(); } - void invalidateCache() { clearCache(); } protected: Node* rootNode() const @@ -138,14 +181,19 @@ private: class DynamicSubtreeNodeList : public DynamicNodeList { public: - virtual ~DynamicSubtreeNodeList(); + virtual ~DynamicSubtreeNodeList() + { + document()->unregisterNodeListCache(this); + } virtual unsigned length() const OVERRIDE; virtual Node* item(unsigned index) const OVERRIDE; protected: - DynamicSubtreeNodeList(PassRefPtr<Node> node, RootType rootType = RootedAtNode, InvalidationType invalidationType = AlwaysInvalidate) + DynamicSubtreeNodeList(PassRefPtr<Node> node, NodeListInvalidationType invalidationType, NodeListRootType rootType = NodeListIsRootedAtNode) : DynamicNodeList(node, rootType, invalidationType) - { } + { + document()->registerNodeListCache(this); + } private: Node* itemForwardsFromCurrent(Node* start, unsigned offset, int remainingOffset) const; diff --git a/Source/WebCore/dom/Element.cpp b/Source/WebCore/dom/Element.cpp index 2287f40b1..eb1733b5d 100644 --- a/Source/WebCore/dom/Element.cpp +++ b/Source/WebCore/dom/Element.cpp @@ -705,7 +705,7 @@ void Element::attributeChanged(const Attribute& attribute) setNeedsStyleRecalc(); } - invalidateNodeListsCacheAfterAttributeChanged(attribute.name(), this); + invalidateNodeListCachesInAncestors(&attribute.name(), this); if (!AXObjectCache::accessibilityEnabled()) return; @@ -913,6 +913,10 @@ void Element::removedFrom(ContainerNode* insertionPoint) if (containsFullScreenElement()) setContainsFullScreenElementOnAncestorsCrossingFrameBoundaries(false); #endif +#if ENABLE(POINTER_LOCK) + if (document()->page()) + document()->page()->pointerLockController()->elementRemoved(this); +#endif setSavedLayerScrollOffset(IntSize()); @@ -937,6 +941,9 @@ void Element::attach() createRendererIfNeeded(); StyleResolverParentPusher parentPusher(this); + if (parentElement() && parentElement()->isInCanvasSubtree()) + setIsInCanvasSubtree(true); + // When a shadow root exists, it does the work of attaching the children. if (ElementShadow* shadow = this->shadow()) { parentPusher.push(); @@ -975,8 +982,10 @@ void Element::detach() RenderWidget::suspendWidgetHierarchyUpdates(); unregisterNamedFlowContentNode(); cancelFocusAppearanceUpdate(); - if (hasRareData()) + if (hasRareData()) { + setIsInCanvasSubtree(false); elementRareData()->resetComputedStyle(); + } if (ElementShadow* shadow = this->shadow()) { detachChildrenIfNeeded(); @@ -1671,6 +1680,17 @@ bool Element::styleAffectedByEmpty() const return hasRareData() && elementRareData()->m_styleAffectedByEmpty; } +void Element::setIsInCanvasSubtree(bool isInCanvasSubtree) +{ + ElementRareData* data = ensureElementRareData(); + data->m_isInCanvasSubtree = isInCanvasSubtree; +} + +bool Element::isInCanvasSubtree() const +{ + return hasRareData() && elementRareData()->m_isInCanvasSubtree; +} + AtomicString Element::computeInheritedLanguage() const { const Node* n = this; @@ -1874,7 +1894,8 @@ void Element::setContainsFullScreenElementOnAncestorsCrossingFrameBoundaries(boo #if ENABLE(POINTER_LOCK) void Element::webkitRequestPointerLock() { - document()->frame()->page()->pointerLockController()->requestPointerLock(this, 0, 0); + if (document()->page()) + document()->page()->pointerLockController()->requestPointerLock(this, 0, 0); } #endif diff --git a/Source/WebCore/dom/Element.h b/Source/WebCore/dom/Element.h index 1d576a81a..0c338d6cb 100644 --- a/Source/WebCore/dom/Element.h +++ b/Source/WebCore/dom/Element.h @@ -268,6 +268,7 @@ public: ElementShadow* shadow() const; ElementShadow* ensureShadow(); + virtual void willAddAuthorShadowRoot() { } // FIXME: Remove Element::ensureShadowRoot // https://bugs.webkit.org/show_bug.cgi?id=77608 @@ -281,6 +282,9 @@ public: void setStyleAffectedByEmpty(); bool styleAffectedByEmpty() const; + void setIsInCanvasSubtree(bool); + bool isInCanvasSubtree() const; + AtomicString computeInheritedLanguage() const; virtual void accessKeyAction(bool /*sendToAnyEvent*/) { } diff --git a/Source/WebCore/dom/ElementRareData.h b/Source/WebCore/dom/ElementRareData.h index 3723d1a08..07394ebd1 100644 --- a/Source/WebCore/dom/ElementRareData.h +++ b/Source/WebCore/dom/ElementRareData.h @@ -26,6 +26,7 @@ #include "DatasetDOMStringMap.h" #include "Element.h" #include "ElementShadow.h" +#include "HTMLCollection.h" #include "NamedNodeMap.h" #include "NodeRareData.h" #include <wtf/OwnPtr.h> @@ -57,6 +58,7 @@ public: return (*m_cachedCollections)[type - FirstNodeCollectionType]; } + void removeCachedHTMLCollection(HTMLCollection* collection, CollectionType type) { ASSERT(m_cachedCollections); @@ -64,6 +66,38 @@ public: (*m_cachedCollections)[type - FirstNodeCollectionType] = 0; } + void clearHTMLCollectionCaches(const QualifiedName* attrName) + { + if (!m_cachedCollections) + return; + + bool shouldIgnoreType = !attrName || *attrName == HTMLNames::idAttr || *attrName == HTMLNames::nameAttr; + + for (unsigned i = 0; i < (*m_cachedCollections).size(); i++) { + if (HTMLCollection* collection = (*m_cachedCollections)[i]) { + if (shouldIgnoreType || DynamicNodeListCacheBase::shouldInvalidateTypeOnAttributeChange(collection->invalidationType(), *attrName)) + collection->invalidateCache(); + } + } + } + + void adoptTreeScope(Document* oldDocument, Document* newDocument) + { + if (!m_cachedCollections) + return; + + for (unsigned i = 0; i < (*m_cachedCollections).size(); i++) { + HTMLCollection* collection = (*m_cachedCollections)[i]; + if (!collection) + continue; + collection->invalidateCache(); + if (oldDocument != newDocument) { + oldDocument->unregisterNodeListCache(collection); + newDocument->registerNodeListCache(collection); + } + } + } + typedef FixedArray<HTMLCollection*, NumNodeCollectionTypes> CachedHTMLCollectionArray; OwnPtr<CachedHTMLCollectionArray> m_cachedCollections; @@ -76,7 +110,8 @@ public: OwnPtr<ElementShadow> m_shadow; OwnPtr<NamedNodeMap> m_attributeMap; - bool m_styleAffectedByEmpty; + bool m_styleAffectedByEmpty : 1; + bool m_isInCanvasSubtree : 1; IntSize m_savedLayerScrollOffset; @@ -94,6 +129,7 @@ inline ElementRareData::ElementRareData() : NodeRareData() , m_minimumSizeForResizing(defaultMinimumSizeForResizing()) , m_styleAffectedByEmpty(false) + , m_isInCanvasSubtree(false) #if ENABLE(FULLSCREEN_API) , m_containsFullScreenElement(false) #endif diff --git a/Source/WebCore/dom/ElementShadow.cpp b/Source/WebCore/dom/ElementShadow.cpp index 1f650f772..68a9b0189 100644 --- a/Source/WebCore/dom/ElementShadow.cpp +++ b/Source/WebCore/dom/ElementShadow.cpp @@ -65,7 +65,7 @@ static bool validateShadowRoot(Document* document, ShadowRoot* shadowRoot, Excep return true; } -void ElementShadow::addShadowRoot(Element* shadowHost, PassRefPtr<ShadowRoot> shadowRoot, ExceptionCode& ec) +void ElementShadow::addShadowRoot(Element* shadowHost, PassRefPtr<ShadowRoot> shadowRoot, ShadowRoot::ShadowRootType type, ExceptionCode& ec) { ASSERT(shadowHost); ASSERT(shadowRoot); @@ -73,6 +73,9 @@ void ElementShadow::addShadowRoot(Element* shadowHost, PassRefPtr<ShadowRoot> sh if (!validateShadowRoot(shadowHost->document(), shadowRoot.get(), ec)) return; + if (type == ShadowRoot::AuthorShadowRoot) + shadowHost->willAddAuthorShadowRoot(); + shadowRoot->setHost(shadowHost); shadowRoot->setParentTreeScope(shadowHost->treeScope()); m_shadowRoots.push(shadowRoot.get()); diff --git a/Source/WebCore/dom/ElementShadow.h b/Source/WebCore/dom/ElementShadow.h index 13de1c021..6f650112a 100644 --- a/Source/WebCore/dom/ElementShadow.h +++ b/Source/WebCore/dom/ElementShadow.h @@ -53,7 +53,7 @@ public: ShadowRoot* oldestShadowRoot() const; void removeAllShadowRoots(); - void addShadowRoot(Element* shadowHost, PassRefPtr<ShadowRoot>, ExceptionCode&); + void addShadowRoot(Element* shadowHost, PassRefPtr<ShadowRoot>, ShadowRoot::ShadowRootType, ExceptionCode&); void attach(); void detach(); diff --git a/Source/WebCore/dom/IdTargetObserver.cpp b/Source/WebCore/dom/IdTargetObserver.cpp new file mode 100644 index 000000000..afadd38f9 --- /dev/null +++ b/Source/WebCore/dom/IdTargetObserver.cpp @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2012 Google Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "IdTargetObserver.h" + +#include "IdTargetObserverRegistry.h" + +namespace WebCore { + +IdTargetObserver::IdTargetObserver(IdTargetObserverRegistry& registry, const AtomicString& id) + : m_registry(®istry) + , m_id(id) +{ + m_registry->addObserver(m_id, this); +} + +IdTargetObserver::~IdTargetObserver() +{ + if (m_registry) + m_registry->removeObserver(m_id, this); +} + +} // namespace WebCore diff --git a/Source/WebCore/dom/IdTargetObserver.h b/Source/WebCore/dom/IdTargetObserver.h new file mode 100644 index 000000000..f9007c478 --- /dev/null +++ b/Source/WebCore/dom/IdTargetObserver.h @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2012 Google Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef IdTargetObserver_h +#define IdTargetObserver_h + +#include <wtf/text/AtomicString.h> + +namespace WebCore { + +class IdTargetObserverRegistry; + +class IdTargetObserver { +public: + virtual ~IdTargetObserver(); + virtual void idTargetChanged() = 0; + +protected: + IdTargetObserver(IdTargetObserverRegistry&, const AtomicString& id); + +private: + IdTargetObserverRegistry* m_registry; + AtomicString m_id; +}; + +} // namespace WebCore + +#endif // IdTargetObserver_h diff --git a/Source/WebCore/dom/IdTargetObserverRegistry.cpp b/Source/WebCore/dom/IdTargetObserverRegistry.cpp new file mode 100644 index 000000000..5fc26acfe --- /dev/null +++ b/Source/WebCore/dom/IdTargetObserverRegistry.cpp @@ -0,0 +1,85 @@ +/* + * Copyright (C) 2012 Google Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "IdTargetObserverRegistry.h" + +#include "IdTargetObserver.h" + +namespace WebCore { + +PassOwnPtr<IdTargetObserverRegistry> IdTargetObserverRegistry::create() +{ + return adoptPtr(new IdTargetObserverRegistry()); +} + +void IdTargetObserverRegistry::addObserver(const AtomicString& id, IdTargetObserver* observer) +{ + if (id.isEmpty()) + return; + + IdToObserverSetMap::AddResult result = m_registry.add(id.impl(), nullptr); + if (result.isNewEntry) + result.iterator->second = adoptPtr(new ObserverSet()); + + result.iterator->second->add(observer); +} + +void IdTargetObserverRegistry::removeObserver(const AtomicString& id, IdTargetObserver* observer) +{ + if (id.isEmpty() || m_registry.isEmpty()) + return; + + IdToObserverSetMap::iterator iter = m_registry.find(id.impl()); + + ObserverSet* set = iter->second.get(); + set->remove(observer); + if (set->isEmpty() && set != m_notifyingObserversInSet) + m_registry.remove(iter); +} + +void IdTargetObserverRegistry::notifyObserversInternal(const AtomicString& id) +{ + ASSERT(!id.isEmpty()); + ASSERT(!m_registry.isEmpty()); + + m_notifyingObserversInSet = m_registry.get(id.impl()); + if (!m_notifyingObserversInSet) + return; + + Vector<IdTargetObserver*> copy; + copyToVector(*m_notifyingObserversInSet, copy); + for (Vector<IdTargetObserver*>::const_iterator it = copy.begin(); it != copy.end(); ++it) { + if (m_notifyingObserversInSet->contains(*it)) + (*it)->idTargetChanged(); + } + + if (m_notifyingObserversInSet->isEmpty()) + m_registry.remove(id.impl()); + + m_notifyingObserversInSet = 0; +} + +} // namespace WebCore diff --git a/Source/WebCore/dom/IdTargetObserverRegistry.h b/Source/WebCore/dom/IdTargetObserverRegistry.h new file mode 100644 index 000000000..aba755210 --- /dev/null +++ b/Source/WebCore/dom/IdTargetObserverRegistry.h @@ -0,0 +1,68 @@ +/* + * Copyright (C) 2012 Google Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef IdTargetObserverRegistry_h +#define IdTargetObserverRegistry_h + +#include <wtf/Forward.h> +#include <wtf/HashMap.h> +#include <wtf/HashSet.h> +#include <wtf/PassOwnPtr.h> +#include <wtf/text/AtomicString.h> + +namespace WebCore { + +class IdTargetObserver; + +class IdTargetObserverRegistry { + friend class IdTargetObserver; + +public: + static PassOwnPtr<IdTargetObserverRegistry> create(); + void notifyObservers(const AtomicString& id); + +private: + IdTargetObserverRegistry() : m_notifyingObserversInSet(0) { } + void addObserver(const AtomicString& id, IdTargetObserver*); + void removeObserver(const AtomicString& id, IdTargetObserver*); + void notifyObserversInternal(const AtomicString& id); + + typedef HashSet<IdTargetObserver*> ObserverSet; + typedef HashMap<AtomicStringImpl*, OwnPtr<ObserverSet> > IdToObserverSetMap; + IdToObserverSetMap m_registry; + ObserverSet* m_notifyingObserversInSet; +}; + +inline void IdTargetObserverRegistry::notifyObservers(const AtomicString& id) +{ + ASSERT(!m_notifyingObserversInSet); + if (id.isEmpty() || m_registry.isEmpty()) + return; + IdTargetObserverRegistry::notifyObserversInternal(id); +} + +} // namespace WebCore + +#endif // IdTargetObserverRegistry_h diff --git a/Source/WebCore/dom/MicroDataItemList.cpp b/Source/WebCore/dom/MicroDataItemList.cpp index 21c170a40..7b4863537 100644 --- a/Source/WebCore/dom/MicroDataItemList.cpp +++ b/Source/WebCore/dom/MicroDataItemList.cpp @@ -45,7 +45,7 @@ const String& MicroDataItemList::undefinedItemType() } MicroDataItemList::MicroDataItemList(PassRefPtr<Node> rootNode, const String& typeNames) - : DynamicSubtreeNodeList(rootNode) + : DynamicSubtreeNodeList(rootNode, InvalidateOnItemAttrChange) , m_typeNames(typeNames, document()->inQuirksMode()) , m_originalTypeNames(typeNames) { diff --git a/Source/WebCore/dom/NameNodeList.cpp b/Source/WebCore/dom/NameNodeList.cpp index 4ebbed1bc..34d5a534c 100644 --- a/Source/WebCore/dom/NameNodeList.cpp +++ b/Source/WebCore/dom/NameNodeList.cpp @@ -33,7 +33,7 @@ namespace WebCore { using namespace HTMLNames; NameNodeList::NameNodeList(PassRefPtr<Node> rootNode, const AtomicString& name) - : DynamicSubtreeNodeList(rootNode) + : DynamicSubtreeNodeList(rootNode, InvalidateOnNameAttrChange) , m_name(name) { } diff --git a/Source/WebCore/dom/Node.cpp b/Source/WebCore/dom/Node.cpp index 0950cd933..7d2aa6f09 100644 --- a/Source/WebCore/dom/Node.cpp +++ b/Source/WebCore/dom/Node.cpp @@ -47,6 +47,7 @@ #include "DocumentType.h" #include "DynamicNodeList.h" #include "Element.h" +#include "ElementRareData.h" #include "ElementShadow.h" #include "Event.h" #include "EventContext.h" @@ -489,8 +490,6 @@ OwnPtr<NodeRareData> Node::createRareData() void Node::clearRareData() { ASSERT(hasRareData()); - if (treeScope() && rareData()->nodeLists()) - treeScope()->removeNodeListCache(); #if ENABLE(MUTATION_OBSERVERS) ASSERT(!transientMutationObserverRegistry() || transientMutationObserverRegistry()->isEmpty()); @@ -920,7 +919,17 @@ bool Node::isFocusable() const // If the node is in a display:none tree it might say it needs style recalc but // the whole document is actually up to date. ASSERT(!document()->childNeedsStyleRecalc()); - + + // Elements in canvas fallback content are not rendered, but they are allowed to be + // focusable as long as their canvas is displayed and visible. + if (isElementNode() && toElement(this)->isInCanvasSubtree()) { + const Element* e = toElement(this); + while (e && !e->hasLocalName(canvasTag)) + e = e->parentElement(); + ASSERT(e); + return e->renderer() && e->renderer()->style()->visibility() == VISIBLE; + } + // FIXME: Even if we are not visible, we might have a child that is visible. // Hyatt wants to fix that some day with a "has visible content" flag or the like. if (!renderer() || renderer()->style()->visibility() != VISIBLE) @@ -953,70 +962,28 @@ unsigned Node::nodeIndex() const return count; } -void Node::invalidateNodeListsCacheAfterAttributeChanged(const QualifiedName& attrName, Element* attributeOwnerElement) +void Node::invalidateNodeListCachesInAncestors(const QualifiedName* attrName, Element* attributeOwnerElement) { - if (hasRareData() && isAttributeNode()) { - NodeRareData* data = rareData(); - ASSERT(!data->nodeLists()); - data->clearChildNodeListCache(); - } + if (hasRareData() && (!attrName || isAttributeNode())) + rareData()->clearChildNodeListCache(); // Modifications to attributes that are not associated with an Element can't invalidate NodeList caches. - if (!attributeOwnerElement) + if (attrName && !attributeOwnerElement) return; - // FIXME: Move the list of attributes each NodeList type cares about to be a static on the - // appropriate NodeList class. Then use those lists here and in invalidateCachesThatDependOnAttributes - // to only invalidate the cache types that depend on the attribute that changed. - // FIXME: Keep track of when we have no caches of a given type so that we can avoid the for-loop - // below even if a related attribute changed (e.g. if we have no RadioNodeLists, we don't need - // to invalidate any caches when id attributes change.) - if (attrName != classAttr -#if ENABLE(MICRODATA) - && attrName != itemscopeAttr - && attrName != itempropAttr - && attrName != itemtypeAttr -#endif - && attrName != nameAttr - && attrName != forAttr - && (attrName != idAttr || !attributeOwnerElement->isFormControlElement())) + if (!document()->shouldInvalidateNodeListCaches()) return; document()->clearNodeListCaches(); - if (!treeScope()->hasNodeListCaches()) - return; - for (Node* node = this; node; node = node->parentNode()) { - ASSERT(this == node || !node->isAttributeNode()); if (!node->hasRareData()) continue; NodeRareData* data = node->rareData(); - if (!data->nodeLists()) - continue; - - data->nodeLists()->invalidateCaches(&attrName); - } -} - -void Node::invalidateNodeListsCacheAfterChildrenChanged() -{ - if (hasRareData()) - rareData()->clearChildNodeListCache(); - - document()->clearNodeListCaches(); - - if (!treeScope()->hasNodeListCaches()) - return; - - for (Node* node = this; node; node = node->parentNode()) { - if (!node->hasRareData()) - continue; - NodeRareData* data = node->rareData(); - if (!data->nodeLists()) - continue; - - data->nodeLists()->invalidateCaches(); + if (data->nodeLists()) + data->nodeLists()->invalidateCaches(attrName); + if (node->isElementNode()) + static_cast<ElementRareData*>(data)->clearHTMLCollectionCaches(attrName); } } @@ -1563,8 +1530,8 @@ PassRefPtr<NodeList> Node::getElementsByTagName(const AtomicString& localName) return 0; if (document()->isHTMLDocument()) - return ensureRareData()->ensureNodeLists(this)->addCacheWithAtomicName<HTMLTagNodeList>(this, DynamicNodeList::TagNodeListType, localName); - return ensureRareData()->ensureNodeLists(this)->addCacheWithAtomicName<TagNodeList>(this, DynamicNodeList::TagNodeListType, localName); + return ensureRareData()->ensureNodeLists()->addCacheWithAtomicName<HTMLTagNodeList>(this, DynamicNodeList::TagNodeListType, localName); + return ensureRareData()->ensureNodeLists()->addCacheWithAtomicName<TagNodeList>(this, DynamicNodeList::TagNodeListType, localName); } PassRefPtr<NodeList> Node::getElementsByTagNameNS(const AtomicString& namespaceURI, const AtomicString& localName) @@ -1575,23 +1542,23 @@ PassRefPtr<NodeList> Node::getElementsByTagNameNS(const AtomicString& namespaceU if (namespaceURI == starAtom) return getElementsByTagName(localName); - return ensureRareData()->ensureNodeLists(this)->addCacheWithQualifiedName(this, namespaceURI.isEmpty() ? nullAtom : namespaceURI, localName); + return ensureRareData()->ensureNodeLists()->addCacheWithQualifiedName(this, namespaceURI.isEmpty() ? nullAtom : namespaceURI, localName); } PassRefPtr<NodeList> Node::getElementsByName(const String& elementName) { - return ensureRareData()->ensureNodeLists(this)->addCacheWithAtomicName<NameNodeList>(this, DynamicNodeList::NameNodeListType, elementName); + return ensureRareData()->ensureNodeLists()->addCacheWithAtomicName<NameNodeList>(this, DynamicNodeList::NameNodeListType, elementName); } PassRefPtr<NodeList> Node::getElementsByClassName(const String& classNames) { - return ensureRareData()->ensureNodeLists(this)->addCacheWithName<ClassNodeList>(this, DynamicNodeList::ClassNodeListType, classNames); + return ensureRareData()->ensureNodeLists()->addCacheWithName<ClassNodeList>(this, DynamicNodeList::ClassNodeListType, classNames); } PassRefPtr<RadioNodeList> Node::radioNodeList(const AtomicString& name) { ASSERT(hasTagName(formTag) || hasTagName(fieldsetTag)); - return ensureRareData()->ensureNodeLists(this)->addCacheWithAtomicName<RadioNodeList>(this, DynamicNodeList::RadioNodeListType, name); + return ensureRareData()->ensureNodeLists()->addCacheWithAtomicName<RadioNodeList>(this, DynamicNodeList::RadioNodeListType, name); } PassRefPtr<Element> Node::querySelector(const AtomicString& selectors, ExceptionCode& ec) @@ -2257,14 +2224,16 @@ void NodeListsNodeData::invalidateCaches(const QualifiedName* attrName) { NodeListAtomicNameCacheMap::const_iterator atomicNameCacheEnd = m_atomicNameCaches.end(); for (NodeListAtomicNameCacheMap::const_iterator it = m_atomicNameCaches.begin(); it != atomicNameCacheEnd; ++it) { - if (!attrName || it->second->shouldInvalidateOnAttributeChange()) - it->second->invalidateCache(); + DynamicNodeList* list = it->second; + if (!attrName || DynamicNodeListCacheBase::shouldInvalidateTypeOnAttributeChange(list->invalidationType(), *attrName)) + list->invalidateCache(); } NodeListNameCacheMap::const_iterator nameCacheEnd = m_nameCaches.end(); for (NodeListNameCacheMap::const_iterator it = m_nameCaches.begin(); it != nameCacheEnd; ++it) { - if (!attrName || it->second->shouldInvalidateOnAttributeChange()) - it->second->invalidateCache(); + DynamicNodeList* list = it->second; + if (!attrName || DynamicNodeListCacheBase::shouldInvalidateTypeOnAttributeChange(list->invalidationType(), *attrName)) + list->invalidateCache(); } if (!attrName) @@ -2780,20 +2749,6 @@ void Node::setItemType(const String& value) #endif -void NodeRareData::createNodeLists(Node* node) -{ - ASSERT(node); - setNodeLists(NodeListsNodeData::create()); - if (TreeScope* treeScope = node->treeScope()) - treeScope->addNodeListCache(); -} - -void NodeRareData::clearChildNodeListCache() -{ - if (m_childNodeList) - m_childNodeList->invalidateCache(); -} - // It's important not to inline removedLastRef, because we don't want to inline the code to // delete a Node at each deref call site. void Node::removedLastRef() diff --git a/Source/WebCore/dom/Node.h b/Source/WebCore/dom/Node.h index 93a66d9ec..c9a28f49d 100644 --- a/Source/WebCore/dom/Node.h +++ b/Source/WebCore/dom/Node.h @@ -558,8 +558,7 @@ public: void showTreeForThisAcrossFrame() const; #endif - void invalidateNodeListsCacheAfterAttributeChanged(const QualifiedName&, Element* attributeOwnerElement); - void invalidateNodeListsCacheAfterChildrenChanged(); + void invalidateNodeListCachesInAncestors(const QualifiedName* attrName = 0, Element* attributeOwnerElement = 0); NodeListsNodeData* nodeLists(); void removeCachedChildNodeList(); diff --git a/Source/WebCore/dom/NodeRareData.h b/Source/WebCore/dom/NodeRareData.h index 5c03d8b38..0bdc3e8ac 100644 --- a/Source/WebCore/dom/NodeRareData.h +++ b/Source/WebCore/dom/NodeRareData.h @@ -129,7 +129,7 @@ public: return m_atomicNameCaches.isEmpty() && m_nameCaches.isEmpty() && m_tagNodeListCacheNS.isEmpty(); } - void adoptTreeScope(TreeScope* oldTreeScope, TreeScope* newTreeScope, Document* oldDocument, Document* newDocument) + void adoptTreeScope(Document* oldDocument, Document* newDocument) { invalidateCaches(); @@ -138,8 +138,8 @@ public: for (NodeListAtomicNameCacheMap::const_iterator it = m_atomicNameCaches.begin(); it != atomicNameCacheEnd; ++it) { DynamicSubtreeNodeList* list = it->second; if (list->isRootedAtDocument()) { - oldDocument->unregisterDynamicSubtreeNodeList(list); - newDocument->registerDynamicSubtreeNodeList(list); + oldDocument->unregisterNodeListCache(list); + newDocument->registerNodeListCache(list); } } @@ -147,15 +147,19 @@ public: for (NodeListNameCacheMap::const_iterator it = m_nameCaches.begin(); it != nameCacheEnd; ++it) { DynamicSubtreeNodeList* list = it->second; if (list->isRootedAtDocument()) { - oldDocument->unregisterDynamicSubtreeNodeList(list); - newDocument->registerDynamicSubtreeNodeList(list); + oldDocument->unregisterNodeListCache(list); + newDocument->registerNodeListCache(list); } } - } - if (oldTreeScope) - oldTreeScope->removeNodeListCache(); - newTreeScope->addNodeListCache(); + TagNodeListCacheNS::const_iterator tagEnd = m_tagNodeListCacheNS.end(); + for (TagNodeListCacheNS::const_iterator it = m_tagNodeListCacheNS.begin(); it != tagEnd; ++it) { + DynamicSubtreeNodeList* list = it->second; + ASSERT(!list->isRootedAtDocument()); + oldDocument->unregisterNodeListCache(list); + newDocument->registerNodeListCache(list); + } + } } private: @@ -215,13 +219,17 @@ public: void clearNodeLists() { m_nodeLists.clear(); } void setNodeLists(PassOwnPtr<NodeListsNodeData> lists) { m_nodeLists = lists; } NodeListsNodeData* nodeLists() const { return m_nodeLists.get(); } - NodeListsNodeData* ensureNodeLists(Node* node) + NodeListsNodeData* ensureNodeLists() { if (!m_nodeLists) - createNodeLists(node); + setNodeLists(NodeListsNodeData::create()); return m_nodeLists.get(); } - void clearChildNodeListCache(); + void clearChildNodeListCache() + { + if (m_childNodeList) + m_childNodeList->invalidateCache(); + } ChildNodeList* childNodeList() const { return m_childNodeList; } void setChildNodeList(ChildNodeList* list) { m_childNodeList = list; } @@ -340,7 +348,6 @@ protected: void setNeedsFocusAppearanceUpdateSoonAfterAttach(bool needs) { m_needsFocusAppearanceUpdateSoonAfterAttach = needs; } private: - void createNodeLists(Node*); TreeScope* m_treeScope; OwnPtr<NodeListsNodeData> m_nodeLists; diff --git a/Source/WebCore/dom/NodeRenderingContext.h b/Source/WebCore/dom/NodeRenderingContext.h index 36171dd1e..8aa07f955 100644 --- a/Source/WebCore/dom/NodeRenderingContext.h +++ b/Source/WebCore/dom/NodeRenderingContext.h @@ -70,7 +70,7 @@ public: private: Node* m_node; - ComposedShadowTreeWalker::ParentTranversalDetails m_parentDetails; + ComposedShadowTreeWalker::ParentTraversalDetails m_parentDetails; RefPtr<RenderStyle> m_style; RenderNamedFlowThread* m_parentFlowRenderer; AtomicString m_flowThread; diff --git a/Source/WebCore/dom/Range.cpp b/Source/WebCore/dom/Range.cpp index f7f2f4f6c..d736ce53d 100644 --- a/Source/WebCore/dom/Range.cpp +++ b/Source/WebCore/dom/Range.cpp @@ -196,6 +196,18 @@ bool Range::collapsed(ExceptionCode& ec) const return m_start == m_end; } +static inline bool checkForDifferentRootContainer(const RangeBoundaryPoint& start, const RangeBoundaryPoint& end) +{ + Node* endRootContainer = end.container(); + while (endRootContainer->parentNode()) + endRootContainer = endRootContainer->parentNode(); + Node* startRootContainer = start.container(); + while (startRootContainer->parentNode()) + startRootContainer = startRootContainer->parentNode(); + + return startRootContainer != endRootContainer || (Range::compareBoundaryPoints(start, end, ASSERT_NO_EXCEPTION) > 0); +} + void Range::setStart(PassRefPtr<Node> refNode, int offset, ExceptionCode& ec) { if (!m_start.container()) { @@ -208,9 +220,10 @@ void Range::setStart(PassRefPtr<Node> refNode, int offset, ExceptionCode& ec) return; } + bool didMoveDocument = false; if (refNode->document() != m_ownerDocument) { - ec = WRONG_DOCUMENT_ERR; - return; + setDocument(refNode->document()); + didMoveDocument = true; } ec = 0; @@ -220,20 +233,8 @@ void Range::setStart(PassRefPtr<Node> refNode, int offset, ExceptionCode& ec) m_start.set(refNode, offset, childNode); - // check if different root container - Node* endRootContainer = m_end.container(); - while (endRootContainer->parentNode()) - endRootContainer = endRootContainer->parentNode(); - Node* startRootContainer = m_start.container(); - while (startRootContainer->parentNode()) - startRootContainer = startRootContainer->parentNode(); - if (startRootContainer != endRootContainer) + if (didMoveDocument || checkForDifferentRootContainer(m_start, m_end)) collapse(true, ec); - // check if new start after end - else if (compareBoundaryPoints(m_start, m_end, ec) > 0) { - ASSERT(!ec); - collapse(true, ec); - } } void Range::setEnd(PassRefPtr<Node> refNode, int offset, ExceptionCode& ec) @@ -248,9 +249,10 @@ void Range::setEnd(PassRefPtr<Node> refNode, int offset, ExceptionCode& ec) return; } + bool didMoveDocument = false; if (refNode->document() != m_ownerDocument) { - ec = WRONG_DOCUMENT_ERR; - return; + setDocument(refNode->document()); + didMoveDocument = true; } ec = 0; @@ -260,20 +262,8 @@ void Range::setEnd(PassRefPtr<Node> refNode, int offset, ExceptionCode& ec) m_end.set(refNode, offset, childNode); - // check if different root container - Node* endRootContainer = m_end.container(); - while (endRootContainer->parentNode()) - endRootContainer = endRootContainer->parentNode(); - Node* startRootContainer = m_start.container(); - while (startRootContainer->parentNode()) - startRootContainer = startRootContainer->parentNode(); - if (startRootContainer != endRootContainer) + if (didMoveDocument || checkForDifferentRootContainer(m_start, m_end)) collapse(false, ec); - // check if new end before start - if (compareBoundaryPoints(m_start, m_end, ec) > 0) { - ASSERT(!ec); - collapse(false, ec); - } } void Range::setStart(const Position& start, ExceptionCode& ec) @@ -1253,11 +1243,6 @@ void Range::setStartAfter(Node* refNode, ExceptionCode& ec) return; } - if (refNode->document() != m_ownerDocument) { - ec = WRONG_DOCUMENT_ERR; - return; - } - ec = 0; checkNodeBA(refNode, ec); if (ec) @@ -1278,11 +1263,6 @@ void Range::setEndBefore(Node* refNode, ExceptionCode& ec) return; } - if (refNode->document() != m_ownerDocument) { - ec = WRONG_DOCUMENT_ERR; - return; - } - ec = 0; checkNodeBA(refNode, ec); if (ec) @@ -1303,18 +1283,12 @@ void Range::setEndAfter(Node* refNode, ExceptionCode& ec) return; } - if (refNode->document() != m_ownerDocument) { - ec = WRONG_DOCUMENT_ERR; - return; - } - ec = 0; checkNodeBA(refNode, ec); if (ec) return; setEnd(refNode->parentNode(), refNode->nodeIndex() + 1, ec); - } void Range::selectNode(Node* refNode, ExceptionCode& ec) @@ -1529,11 +1503,6 @@ void Range::setStartBefore(Node* refNode, ExceptionCode& ec) return; } - if (refNode->document() != m_ownerDocument) { - ec = WRONG_DOCUMENT_ERR; - return; - } - ec = 0; checkNodeBA(refNode, ec); if (ec) diff --git a/Source/WebCore/dom/ShadowRoot.cpp b/Source/WebCore/dom/ShadowRoot.cpp index 6c2e5c7d1..7b5d95331 100644 --- a/Source/WebCore/dom/ShadowRoot.cpp +++ b/Source/WebCore/dom/ShadowRoot.cpp @@ -122,7 +122,7 @@ PassRefPtr<ShadowRoot> ShadowRoot::create(Element* element, ShadowRootType type, #endif ec = 0; - element->ensureShadow()->addShadowRoot(element, shadowRoot, ec); + element->ensureShadow()->addShadowRoot(element, shadowRoot, type, ec); if (ec) return 0; ASSERT(element == shadowRoot->host()); diff --git a/Source/WebCore/dom/TagNodeList.cpp b/Source/WebCore/dom/TagNodeList.cpp index 60e7b40e7..295a8d9b2 100644 --- a/Source/WebCore/dom/TagNodeList.cpp +++ b/Source/WebCore/dom/TagNodeList.cpp @@ -31,7 +31,7 @@ namespace WebCore { TagNodeList::TagNodeList(PassRefPtr<Node> rootNode, const AtomicString& namespaceURI, const AtomicString& localName) - : DynamicSubtreeNodeList(rootNode, RootedAtNode, DoNotInvalidateOnAttributeChange) + : DynamicSubtreeNodeList(rootNode, DoNotInvalidateOnAttributeChanges) , m_namespaceURI(namespaceURI) , m_localName(localName) { diff --git a/Source/WebCore/dom/TreeScope.cpp b/Source/WebCore/dom/TreeScope.cpp index 5642fcf8d..e88b13ab8 100644 --- a/Source/WebCore/dom/TreeScope.cpp +++ b/Source/WebCore/dom/TreeScope.cpp @@ -39,6 +39,7 @@ #include "HTMLFrameOwnerElement.h" #include "HTMLMapElement.h" #include "HTMLNames.h" +#include "IdTargetObserverRegistry.h" #include "InsertionPoint.h" #include "Page.h" #include "ShadowRoot.h" @@ -54,7 +55,7 @@ using namespace HTMLNames; TreeScope::TreeScope(ContainerNode* rootNode) : m_rootNode(rootNode) , m_parentTreeScope(0) - , m_numNodeListCaches(0) + , m_idTargetObserverRegistry(IdTargetObserverRegistry::create()) { ASSERT(rootNode); } @@ -93,11 +94,13 @@ Element* TreeScope::getElementById(const AtomicString& elementId) const void TreeScope::addElementById(const AtomicString& elementId, Element* element) { m_elementsById.add(elementId.impl(), element); + m_idTargetObserverRegistry->notifyObservers(elementId); } void TreeScope::removeElementById(const AtomicString& elementId, Element* element) { m_elementsById.remove(elementId.impl(), element); + m_idTargetObserverRegistry->notifyObservers(elementId); } Node* TreeScope::ancestorInThisScope(Node* node) const diff --git a/Source/WebCore/dom/TreeScope.h b/Source/WebCore/dom/TreeScope.h index 5ecc0392f..841bbb6c1 100644 --- a/Source/WebCore/dom/TreeScope.h +++ b/Source/WebCore/dom/TreeScope.h @@ -36,6 +36,7 @@ class ContainerNode; class DOMSelection; class Element; class HTMLMapElement; +class IdTargetObserverRegistry; class Node; // A class which inherits both Node and TreeScope must call clearRareData() in its destructor @@ -61,10 +62,6 @@ public: void removeImageMap(HTMLMapElement*); HTMLMapElement* getImageMap(const String& url) const; - void addNodeListCache() { ++m_numNodeListCaches; } - void removeNodeListCache() { ASSERT(m_numNodeListCaches > 0); --m_numNodeListCaches; } - bool hasNodeListCaches() const { return m_numNodeListCaches; } - DOMSelection* getSelection() const; // Find first anchor with the given name. @@ -82,6 +79,8 @@ public: ContainerNode* rootNode() const { return m_rootNode; } + IdTargetObserverRegistry& idTargetObserverRegistry() const { return *m_idTargetObserverRegistry.get(); } + protected: TreeScope(ContainerNode*); virtual ~TreeScope(); @@ -95,7 +94,7 @@ private: DocumentOrderedMap m_elementsById; DocumentOrderedMap m_imageMapsByName; - unsigned m_numNodeListCaches; + OwnPtr<IdTargetObserverRegistry> m_idTargetObserverRegistry; mutable RefPtr<DOMSelection> m_selection; }; diff --git a/Source/WebCore/dom/TreeScopeAdopter.cpp b/Source/WebCore/dom/TreeScopeAdopter.cpp index 88e1a6fd5..3601e0859 100644 --- a/Source/WebCore/dom/TreeScopeAdopter.cpp +++ b/Source/WebCore/dom/TreeScopeAdopter.cpp @@ -26,8 +26,10 @@ #include "TreeScopeAdopter.h" #include "Document.h" +#include "ElementRareData.h" #include "ElementShadow.h" #include "NodeRareData.h" +#include "RenderStyle.h" #include "ShadowRoot.h" namespace WebCore { @@ -47,9 +49,12 @@ void TreeScopeAdopter::moveTreeToNewScope(Node* root) const oldDocument->incDOMTreeVersion(); for (Node* node = root; node; node = node->traverseNextNode(root)) { - NodeRareData* rareData = node->setTreeScope(newDocument == m_newScope ? 0 : m_newScope); - if (rareData && rareData->nodeLists()) - rareData->nodeLists()->adoptTreeScope(m_oldScope, m_newScope, oldDocument, newDocument); + if (NodeRareData* rareData = node->setTreeScope(newDocument == m_newScope ? 0 : m_newScope)) { + if (rareData->nodeLists()) + rareData->nodeLists()->adoptTreeScope(oldDocument, newDocument); + if (node->isElementNode()) + static_cast<ElementRareData*>(rareData)->adoptTreeScope(oldDocument, newDocument); + } if (willMoveToNewDocument) moveNodeToNewDocument(node, oldDocument, newDocument); diff --git a/Source/WebCore/dom/WebKitNamedFlow.cpp b/Source/WebCore/dom/WebKitNamedFlow.cpp index 0ffb703fd..7a07fba17 100644 --- a/Source/WebCore/dom/WebKitNamedFlow.cpp +++ b/Source/WebCore/dom/WebKitNamedFlow.cpp @@ -33,32 +33,55 @@ #include "RenderNamedFlowThread.h" #include "RenderRegion.h" #include "StaticNodeList.h" +#include "WebKitNamedFlowCollection.h" namespace WebCore { -WebKitNamedFlow::WebKitNamedFlow(RenderNamedFlowThread* parentFlowThread) -: m_parentFlowThread(parentFlowThread) +WebKitNamedFlow::WebKitNamedFlow(PassRefPtr<WebKitNamedFlowCollection> manager, const AtomicString& flowThreadName) + : m_flowThreadName(flowThreadName) + , m_flowManager(manager) + , m_parentFlowThread(0) { } WebKitNamedFlow::~WebKitNamedFlow() { + // The named flow is not "strong" referenced from anywhere at this time so it shouldn't be reused if the named flow is recreated. + m_flowManager->discardNamedFlow(this); } -String WebKitNamedFlow::name() const +PassRefPtr<WebKitNamedFlow> WebKitNamedFlow::create(PassRefPtr<WebKitNamedFlowCollection> manager, const AtomicString& flowThreadName) { - return m_parentFlowThread->flowThreadName(); + return adoptRef(new WebKitNamedFlow(manager, flowThreadName)); +} + +const AtomicString& WebKitNamedFlow::name() const +{ + return m_flowThreadName; } bool WebKitNamedFlow::overset() const { - m_parentFlowThread->document()->updateLayoutIgnorePendingStylesheets(); - return m_parentFlowThread->overset(); + if (m_flowManager->document()) + m_flowManager->document()->updateLayoutIgnorePendingStylesheets(); + + // The renderer may be destroyed or created after the style update. + // Because this is called from JS, where the wrapper keeps a reference to the NamedFlow, no guard is necessary. + return m_parentFlowThread ? m_parentFlowThread->overset() : true; +} + +static inline bool nodeInFlowThread(Node* contentNode, RenderNamedFlowThread* flowThread) +{ + return contentNode->renderer() && contentNode->renderer()->inRenderFlowThread() && flowThread == contentNode->renderer()->enclosingRenderFlowThread(); } int WebKitNamedFlow::firstEmptyRegionIndex() const { - m_parentFlowThread->document()->updateLayoutIgnorePendingStylesheets(); + if (m_flowManager->document()) + m_flowManager->document()->updateLayoutIgnorePendingStylesheets(); + + if (!m_parentFlowThread) + return -1; const RenderRegionList& regionList = m_parentFlowThread->renderRegionList(); if (regionList.isEmpty()) @@ -74,15 +97,20 @@ int WebKitNamedFlow::firstEmptyRegionIndex() const PassRefPtr<NodeList> WebKitNamedFlow::getRegionsByContent(Node* contentNode) { + Vector<RefPtr<Node> > regionNodes; + if (!contentNode) - return 0; + return StaticNodeList::adopt(regionNodes); - m_parentFlowThread->document()->updateLayoutIgnorePendingStylesheets(); + if (m_flowManager->document()) + m_flowManager->document()->updateLayoutIgnorePendingStylesheets(); - Vector<RefPtr<Node> > regionNodes; - if (contentNode->renderer() - && contentNode->renderer()->inRenderFlowThread() - && m_parentFlowThread == contentNode->renderer()->enclosingRenderFlowThread()) { + // The renderer may be destroyed or created after the style update. + // Because this is called from JS, where the wrapper keeps a reference to the NamedFlow, no guard is necessary. + if (!m_parentFlowThread) + return StaticNodeList::adopt(regionNodes); + + if (nodeInFlowThread(contentNode, m_parentFlowThread)) { const RenderRegionList& regionList = m_parentFlowThread->renderRegionList(); for (RenderRegionList::const_iterator iter = regionList.begin(); iter != regionList.end(); ++iter) { const RenderRegion* renderRegion = *iter; @@ -92,16 +120,25 @@ PassRefPtr<NodeList> WebKitNamedFlow::getRegionsByContent(Node* contentNode) regionNodes.append(renderRegion->node()); } } + return StaticNodeList::adopt(regionNodes); } PassRefPtr<NodeList> WebKitNamedFlow::getContent() { - m_parentFlowThread->document()->updateLayoutIgnorePendingStylesheets(); - Vector<RefPtr<Node> > contentNodes; - for (NamedFlowContentNodes::const_iterator it = m_parentFlowThread->contentNodes().begin(); it != m_parentFlowThread->contentNodes().end(); ++it) { - Node* node = const_cast<Node*>(*it); + + if (m_flowManager->document()) + m_flowManager->document()->updateLayoutIgnorePendingStylesheets(); + + // The renderer may be destroyed or created after the style update. + // Because this is called from JS, where the wrapper keeps a reference to the NamedFlow, no guard is necessary. + if (!m_parentFlowThread) + return StaticNodeList::adopt(contentNodes); + + const NamedFlowContentNodes& contentNodesList = m_parentFlowThread->contentNodes(); + for (NamedFlowContentNodes::const_iterator it = contentNodesList.begin(); it != contentNodesList.end(); ++it) { + Node* node = *it; ASSERT(node->computedStyle()->flowThread() == m_parentFlowThread->flowThreadName()); contentNodes.append(node); } @@ -109,5 +146,14 @@ PassRefPtr<NodeList> WebKitNamedFlow::getContent() return StaticNodeList::adopt(contentNodes); } +void WebKitNamedFlow::setRenderer(RenderNamedFlowThread* parentFlowThread) +{ + // The named flow can either go from a no_renderer->renderer or renderer->no_renderer state; anything else could indicate a bug. + ASSERT((!m_parentFlowThread && parentFlowThread) || (m_parentFlowThread && !parentFlowThread)); + + // If parentFlowThread is 0, the flow thread will move in the "NULL" state" + m_parentFlowThread = parentFlowThread; +} + } // namespace WebCore diff --git a/Source/WebCore/dom/WebKitNamedFlow.h b/Source/WebCore/dom/WebKitNamedFlow.h index f0c6a124c..5a39e8d9c 100644 --- a/Source/WebCore/dom/WebKitNamedFlow.h +++ b/Source/WebCore/dom/WebKitNamedFlow.h @@ -39,25 +39,36 @@ namespace WebCore { class NodeList; class RenderNamedFlowThread; +class WebKitNamedFlowCollection; class WebKitNamedFlow : public RefCounted<WebKitNamedFlow> { public: - static PassRefPtr<WebKitNamedFlow> create(RenderNamedFlowThread* parentFlowThread) - { - return adoptRef(new WebKitNamedFlow(parentFlowThread)); - } + static PassRefPtr<WebKitNamedFlow> create(PassRefPtr<WebKitNamedFlowCollection> manager, const AtomicString& flowThreadName); ~WebKitNamedFlow(); - String name() const; + const AtomicString& name() const; bool overset() const; int firstEmptyRegionIndex() const; PassRefPtr<NodeList> getRegionsByContent(Node*); PassRefPtr<NodeList> getContent(); + void setRenderer(RenderNamedFlowThread* parentFlowThread); + + enum FlowState { + FlowStateCreated, + FlowStateNull + }; + + FlowState flowState() const { return m_parentFlowThread ? FlowStateCreated : FlowStateNull; } + private: - WebKitNamedFlow(RenderNamedFlowThread*); + WebKitNamedFlow(PassRefPtr<WebKitNamedFlowCollection>, const AtomicString&); + + // The name of the flow thread as specified in CSS. + AtomicString m_flowThreadName; + RefPtr<WebKitNamedFlowCollection> m_flowManager; RenderNamedFlowThread* m_parentFlowThread; }; diff --git a/Source/WebCore/dom/WebKitNamedFlowCollection.cpp b/Source/WebCore/dom/WebKitNamedFlowCollection.cpp new file mode 100644 index 000000000..b0cff11b5 --- /dev/null +++ b/Source/WebCore/dom/WebKitNamedFlowCollection.cpp @@ -0,0 +1,102 @@ +/* + * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above + * copyright notice, this list of conditions and the following + * disclaimer. + * 2. Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF + * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include "config.h" +#include "WebKitNamedFlowCollection.h" + +#include "Document.h" +#include "WebKitNamedFlow.h" + +#include <wtf/text/StringHash.h> +#include <wtf/text/WTFString.h> + +namespace WebCore { + +WebKitNamedFlowCollection::WebKitNamedFlowCollection(Document* doc) + : m_document(doc) +{ +} + +WebKitNamedFlow* WebKitNamedFlowCollection::flowByName(const String& flowName) +{ + NamedFlowSet::iterator it = m_namedFlows.find<String, NamedFlowHashTranslator>(flowName); + if (it == m_namedFlows.end() || (*it)->flowState() == WebKitNamedFlow::FlowStateNull) + return 0; + + return *it; +} + +PassRefPtr<WebKitNamedFlow> WebKitNamedFlowCollection::ensureFlowWithName(const String& flowName) +{ + NamedFlowSet::iterator it = m_namedFlows.find<String, NamedFlowHashTranslator>(flowName); + if (it != m_namedFlows.end()) { + WebKitNamedFlow* namedFlow = *it; + ASSERT(namedFlow->flowState() == WebKitNamedFlow::FlowStateNull); + + return namedFlow; + } + + RefPtr<WebKitNamedFlow> newFlow = WebKitNamedFlow::create(this, flowName); + m_namedFlows.add(newFlow.get()); + + return newFlow.release(); +} + +void WebKitNamedFlowCollection::discardNamedFlow(WebKitNamedFlow* namedFlow) +{ + // The document is not valid anymore so the collection will be destroyed anyway. + if (!m_document) + return; + + ASSERT(namedFlow->flowState() == WebKitNamedFlow::FlowStateNull); + ASSERT(m_namedFlows.contains(namedFlow)); + + m_namedFlows.remove(namedFlow); +} + +void WebKitNamedFlowCollection::documentDestroyed() +{ + m_document = 0; +} + +// The HashFunctions object used by the HashSet to compare between NamedFlows. +// It is safe to set safeToCompareToEmptyOrDeleted because the HashSet will never contain null pointers or deleted values. +struct WebKitNamedFlowCollection::NamedFlowHashFunctions { + static unsigned hash(WebKitNamedFlow* key) { return DefaultHash<String>::Hash::hash(key->name()); } + static bool equal(WebKitNamedFlow* a, WebKitNamedFlow* b) { return a->name() == b->name(); } + static const bool safeToCompareToEmptyOrDeleted = true; +}; + +// The HashTranslator is used to lookup a NamedFlow in the set using a name. +struct WebKitNamedFlowCollection::NamedFlowHashTranslator { + static unsigned hash(const String& key) { return DefaultHash<String>::Hash::hash(key); } + static bool equal(WebKitNamedFlow* a, const String& b) { return a->name() == b; } +}; + +} // namespace WebCore diff --git a/Source/WebCore/dom/WebKitNamedFlowCollection.h b/Source/WebCore/dom/WebKitNamedFlowCollection.h new file mode 100644 index 000000000..130c6c8fb --- /dev/null +++ b/Source/WebCore/dom/WebKitNamedFlowCollection.h @@ -0,0 +1,71 @@ +/* + * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above + * copyright notice, this list of conditions and the following + * disclaimer. + * 2. Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF + * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef WebKitNamedFlowCollection_h +#define WebKitNamedFlowCollection_h + +#include <wtf/Forward.h> +#include <wtf/ListHashSet.h> +#include <wtf/PassRefPtr.h> +#include <wtf/RefCounted.h> + +namespace WebCore { + +class Document; +class WebKitNamedFlow; + +class WebKitNamedFlowCollection : public RefCounted<WebKitNamedFlowCollection> { +public: + static PassRefPtr<WebKitNamedFlowCollection> create(Document* doc) { return adoptRef(new WebKitNamedFlowCollection(doc)); } + + WebKitNamedFlow* flowByName(const String&); + PassRefPtr<WebKitNamedFlow> ensureFlowWithName(const String&); + + void discardNamedFlow(WebKitNamedFlow*); + + void documentDestroyed(); + + Document* document() const { return m_document; } + +private: + WebKitNamedFlowCollection(Document*); + + Document* m_document; + + struct NamedFlowHashFunctions; + struct NamedFlowHashTranslator; + + typedef ListHashSet<WebKitNamedFlow*, 1, NamedFlowHashFunctions> NamedFlowSet; + + NamedFlowSet m_namedFlows; +}; + +} // namespace WebCore + +#endif // WebKitNamedFlowCollection_h diff --git a/Source/WebCore/editing/Editor.cpp b/Source/WebCore/editing/Editor.cpp index c3043b504..9f33299c2 100644 --- a/Source/WebCore/editing/Editor.cpp +++ b/Source/WebCore/editing/Editor.cpp @@ -2085,7 +2085,7 @@ void Editor::markAndReplaceFor(PassRefPtr<SpellCheckRequest> request, const Vect if (result->type == TextCheckingTypeLink && selectionOffset > resultLocation + resultLength + 1) continue; - if (!(shouldPerformReplacement || shouldShowCorrectionPanel || shouldMarkLink) || !doReplacement) + if (!(shouldPerformReplacement || shouldCheckForCorrection || shouldMarkLink) || !doReplacement) continue; String replacedString = plainText(rangeToReplace.get()); @@ -2188,7 +2188,9 @@ void Editor::markMisspellingsAndBadGrammar(const VisibleSelection& spellingSelec if (unifiedTextCheckerEnabled()) { if (!isContinuousSpellCheckingEnabled()) return; - TextCheckingTypeMask textCheckingOptions = TextCheckingTypeSpelling | TextCheckingTypeCorrection; + + // markMisspellingsAndBadGrammar() is triggered by selection change, in which case we check spelling and grammar, but don't autocorrect misspellings. + TextCheckingTypeMask textCheckingOptions = TextCheckingTypeSpelling; if (markGrammar && isGrammarCheckingEnabled()) textCheckingOptions |= TextCheckingTypeGrammar; markAllMisspellingsAndBadGrammarInRanges(textCheckingOptions, spellingSelection.toNormalizedRange().get(), grammarSelection.toNormalizedRange().get()); diff --git a/Source/WebCore/editing/mac/EditorMac.mm b/Source/WebCore/editing/mac/EditorMac.mm index c42c623bf..4b8cd442b 100644 --- a/Source/WebCore/editing/mac/EditorMac.mm +++ b/Source/WebCore/editing/mac/EditorMac.mm @@ -81,7 +81,7 @@ void Editor::pasteWithPasteboard(Pasteboard* pasteboard, bool allowPlainText) bool choosePlainText; m_frame->editor()->client()->setInsertionPasteboard(NSGeneralPboard); -#if !defined(BUILDING_ON_SNOW_LEOPARD) +#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 RefPtr<DocumentFragment> fragment = pasteboard->documentFragment(m_frame, range, allowPlainText, choosePlainText); if (fragment && shouldInsertFragment(fragment, range, EditorInsertActionPasted)) pasteAsFragment(fragment, canSmartReplaceWithPasteboard(pasteboard), false); diff --git a/Source/WebCore/fileapi/FileReaderLoader.cpp b/Source/WebCore/fileapi/FileReaderLoader.cpp index 46f04c44d..f24cdc82f 100644 --- a/Source/WebCore/fileapi/FileReaderLoader.cpp +++ b/Source/WebCore/fileapi/FileReaderLoader.cpp @@ -34,7 +34,6 @@ #include "FileReaderLoader.h" -#include "Base64.h" #include "Blob.h" #include "BlobURL.h" #include "FileReaderLoaderClient.h" @@ -48,6 +47,7 @@ #include <wtf/PassRefPtr.h> #include <wtf/RefPtr.h> #include <wtf/Vector.h> +#include <wtf/text/Base64.h> #include <wtf/text/StringBuilder.h> using namespace std; diff --git a/Source/WebCore/html/BaseButtonInputType.cpp b/Source/WebCore/html/BaseButtonInputType.cpp index f7115019e..5fde8d799 100644 --- a/Source/WebCore/html/BaseButtonInputType.cpp +++ b/Source/WebCore/html/BaseButtonInputType.cpp @@ -41,6 +41,11 @@ namespace WebCore { using namespace HTMLNames; +bool BaseButtonInputType::shouldSaveAndRestoreFormControlState() const +{ + return false; +} + bool BaseButtonInputType::appendFormData(FormDataList&, bool) const { // Buttons except overridden types are never successful. diff --git a/Source/WebCore/html/BaseButtonInputType.h b/Source/WebCore/html/BaseButtonInputType.h index cbd852fc9..4dfbb043f 100644 --- a/Source/WebCore/html/BaseButtonInputType.h +++ b/Source/WebCore/html/BaseButtonInputType.h @@ -41,6 +41,7 @@ protected: BaseButtonInputType(HTMLInputElement* element) : BaseClickableWithKeyInputType(element) { } private: + virtual bool shouldSaveAndRestoreFormControlState() const OVERRIDE; virtual bool appendFormData(FormDataList&, bool) const OVERRIDE; virtual RenderObject* createRenderer(RenderArena*, RenderStyle*) const OVERRIDE; virtual bool storesValueSeparateFromAttribute() OVERRIDE; diff --git a/Source/WebCore/html/CollectionType.h b/Source/WebCore/html/CollectionType.h index f308afd15..9cd70cea0 100644 --- a/Source/WebCore/html/CollectionType.h +++ b/Source/WebCore/html/CollectionType.h @@ -60,7 +60,8 @@ enum CollectionType { ItemProperties, // Microdata item properties in the document #endif - FormControls + FormControls, + InvalidCollectionType }; static const CollectionType FirstUnnamedDocumentCachedType = DocImages; diff --git a/Source/WebCore/html/FormAssociatedElement.cpp b/Source/WebCore/html/FormAssociatedElement.cpp index 21791f096..f05177c1a 100644 --- a/Source/WebCore/html/FormAssociatedElement.cpp +++ b/Source/WebCore/html/FormAssociatedElement.cpp @@ -30,12 +30,24 @@ #include "HTMLFormElement.h" #include "HTMLNames.h" #include "HTMLObjectElement.h" +#include "IdTargetObserver.h" #include "ValidityState.h" namespace WebCore { using namespace HTMLNames; +class FormAttributeTargetObserver : IdTargetObserver { +public: + static PassOwnPtr<FormAttributeTargetObserver> create(const AtomicString& id, FormAssociatedElement*); + virtual void idTargetChanged() OVERRIDE; + +private: + FormAttributeTargetObserver(const AtomicString& id, FormAssociatedElement*); + + FormAssociatedElement* m_element; +}; + FormAssociatedElement::FormAssociatedElement() : m_form(0) { @@ -58,7 +70,7 @@ void FormAssociatedElement::didMoveToNewDocument(Document* oldDocument) { HTMLElement* element = toHTMLElement(this); if (oldDocument && element->fastHasAttribute(formAttr)) - oldDocument->formController()->unregisterFormElementWithFormAttribute(this); + resetFormAttributeTargetObserver(); } void FormAssociatedElement::insertedInto(ContainerNode* insertionPoint) @@ -69,14 +81,14 @@ void FormAssociatedElement::insertedInto(ContainerNode* insertionPoint) HTMLElement* element = toHTMLElement(this); if (element->fastHasAttribute(formAttr)) - element->document()->formController()->registerFormElementWithFormAttribute(this); + resetFormAttributeTargetObserver(); } void FormAssociatedElement::removedFrom(ContainerNode* insertionPoint) { HTMLElement* element = toHTMLElement(this); if (insertionPoint->inDocument() && element->fastHasAttribute(formAttr)) - element->document()->formController()->unregisterFormElementWithFormAttribute(this); + m_formAttributeTargetObserver = nullptr; // If the form and element are both in the same tree, preserve the connection to the form. // Otherwise, null out our form and remove ourselves from the form's list of elements. if (m_form && element->highestAncestor() != m_form->highestAncestor()) @@ -153,9 +165,11 @@ void FormAssociatedElement::formAttributeChanged() if (!element->fastHasAttribute(formAttr)) { // The form attribute removed. We need to reset form owner here. setForm(element->findFormAncestor()); - element->document()->formController()->unregisterFormElementWithFormAttribute(this); - } else + m_formAttributeTargetObserver = nullptr; + } else { resetFormOwner(); + resetFormAttributeTargetObserver(); + } } bool FormAssociatedElement::customError() const @@ -221,12 +235,27 @@ void FormAssociatedElement::setCustomValidity(const String& error) m_customValidationMessage = error; } +void FormAssociatedElement::resetFormAttributeTargetObserver() +{ + m_formAttributeTargetObserver = FormAttributeTargetObserver::create(toHTMLElement(this)->fastGetAttribute(formAttr), this); +} + +void FormAssociatedElement::formAttributeTargetChanged() +{ + resetFormOwner(); +} + const AtomicString& FormAssociatedElement::name() const { const AtomicString& name = toHTMLElement(this)->getNameAttribute(); return name.isNull() ? emptyAtom : name; } +bool FormAssociatedElement::isFormControlElementWithState() const +{ + return false; +} + const HTMLElement* toHTMLElement(const FormAssociatedElement* associatedElement) { if (associatedElement->isFormControlElement()) @@ -242,4 +271,20 @@ HTMLElement* toHTMLElement(FormAssociatedElement* associatedElement) return const_cast<HTMLElement*>(toHTMLElement(static_cast<const FormAssociatedElement*>(associatedElement))); } +PassOwnPtr<FormAttributeTargetObserver> FormAttributeTargetObserver::create(const AtomicString& id, FormAssociatedElement* element) +{ + return adoptPtr(new FormAttributeTargetObserver(id, element)); +} + +FormAttributeTargetObserver::FormAttributeTargetObserver(const AtomicString& id, FormAssociatedElement* element) + : IdTargetObserver(toHTMLElement(element)->treeScope()->idTargetObserverRegistry(), id) + , m_element(element) +{ +} + +void FormAttributeTargetObserver::idTargetChanged() +{ + m_element->formAttributeTargetChanged(); +} + } // namespace Webcore diff --git a/Source/WebCore/html/FormAssociatedElement.h b/Source/WebCore/html/FormAssociatedElement.h index 5a47ea076..b135df1fa 100644 --- a/Source/WebCore/html/FormAssociatedElement.h +++ b/Source/WebCore/html/FormAssociatedElement.h @@ -28,6 +28,7 @@ namespace WebCore { +class FormAttributeTargetObserver; class FormDataList; class HTMLFormElement; class ValidationMessage; @@ -46,6 +47,7 @@ public: ValidityState* validity(); virtual bool isFormControlElement() const = 0; + virtual bool isFormControlElementWithState() const; virtual bool isEnumeratable() const = 0; // Returns the 'name' attribute value. If this element has no name @@ -79,6 +81,8 @@ public: bool valid() const; virtual void setCustomValidity(const String&); + void formAttributeTargetChanged(); + protected: FormAssociatedElement(); @@ -101,6 +105,9 @@ private: virtual void refFormAssociatedElement() = 0; virtual void derefFormAssociatedElement() = 0; + void resetFormAttributeTargetObserver(); + + OwnPtr<FormAttributeTargetObserver> m_formAttributeTargetObserver; HTMLFormElement* m_form; OwnPtr<ValidityState> m_validityState; String m_customValidationMessage; diff --git a/Source/WebCore/html/FormController.cpp b/Source/WebCore/html/FormController.cpp index b7c38e2a8..c30845be5 100644 --- a/Source/WebCore/html/FormController.cpp +++ b/Source/WebCore/html/FormController.cpp @@ -29,6 +29,14 @@ namespace WebCore { using namespace HTMLNames; +static inline HTMLFormElement* ownerFormForState(const HTMLFormControlElementWithState& control) +{ + // Assume controls with form attribute have no owners because we restore + // state during parsing and form owners of such controls might be + // indeterminate. + return control.fastHasAttribute(formAttr) ? 0 : control.form(); +} + // ---------------------------------------------------------------------------- // Serilized form of FormControlState: @@ -103,10 +111,7 @@ static inline AtomicString createKey(HTMLFormElement* form, unsigned index) AtomicString FormKeyGenerator::formKey(const HTMLFormControlElementWithState& control) { - // Assume contorl with form attribute have no owners because we restores - // state during parsing and form owners of such controls might be - // indeterminate. - HTMLFormElement* form = control.fastHasAttribute(formAttr) ? 0 : control.form(); + HTMLFormElement* form = ownerFormForState(control); if (!form) { DEFINE_STATIC_LOCAL(AtomicString, formKeyForNoOwner, ("No owner")); return formKeyForNoOwner; @@ -172,6 +177,9 @@ Vector<String> FormController::formElementsState() const stateVector.append(keyGenerator->formKey(*elementWithState).string()); elementWithState->saveFormControlState().serializeTo(stateVector); } + bool hasOnlySignature = stateVector.size() == 1; + if (hasOnlySignature) + stateVector.clear(); return stateVector; } @@ -237,23 +245,35 @@ void FormController::willDeleteForm(HTMLFormElement* form) m_formKeyGenerator->willDeleteForm(form); } -void FormController::registerFormElementWithFormAttribute(FormAssociatedElement* element) -{ - ASSERT(toHTMLElement(element)->fastHasAttribute(formAttr)); - m_formElementsWithFormAttribute.add(element); -} - -void FormController::unregisterFormElementWithFormAttribute(FormAssociatedElement* element) +void FormController::restoreControlStateFor(HTMLFormControlElementWithState& control) { - m_formElementsWithFormAttribute.remove(element); + // We don't save state of a control with shouldSaveAndRestoreFormControlState() + // == false. But we need to skip restoring process too because a control in + // another form might have the same pair of name and type and saved its state. + if (!control.shouldSaveAndRestoreFormControlState()) + return; + if (ownerFormForState(control)) + return; + FormControlState state = takeStateForFormElement(control); + if (state.valueSize() > 0) + control.restoreFormControlState(state); } -void FormController::resetFormElementsOwner() +void FormController::restoreControlStateIn(HTMLFormElement& form) { - typedef FormAssociatedElementListHashSet::iterator Iterator; - Iterator end = m_formElementsWithFormAttribute.end(); - for (Iterator it = m_formElementsWithFormAttribute.begin(); it != end; ++it) - (*it)->resetFormOwner(); + const Vector<FormAssociatedElement*>& elements = form.associatedElements(); + for (size_t i = 0; i < elements.size(); ++i) { + if (!elements[i]->isFormControlElementWithState()) + continue; + HTMLFormControlElementWithState* control = static_cast<HTMLFormControlElementWithState*>(elements[i]); + if (!control->shouldSaveAndRestoreFormControlState()) + continue; + if (ownerFormForState(*control) != &form) + continue; + FormControlState state = takeStateForFormElement(*control); + if (state.valueSize() > 0) + control->restoreFormControlState(state); + } } FormElementKey::FormElementKey(AtomicStringImpl* name, AtomicStringImpl* type, AtomicStringImpl* formKey) diff --git a/Source/WebCore/html/FormController.h b/Source/WebCore/html/FormController.h index e15c1dc24..4528483ed 100644 --- a/Source/WebCore/html/FormController.h +++ b/Source/WebCore/html/FormController.h @@ -129,22 +129,18 @@ public: Vector<String> formElementsState() const; // This should be callled only by Document::setStateForNewFormElements(). void setStateForNewFormElements(const Vector<String>&); - FormControlState takeStateForFormElement(const HTMLFormControlElementWithState&); void willDeleteForm(HTMLFormElement*); - - void registerFormElementWithFormAttribute(FormAssociatedElement*); - void unregisterFormElementWithFormAttribute(FormAssociatedElement*); - void resetFormElementsOwner(); + void restoreControlStateFor(HTMLFormControlElementWithState&); + void restoreControlStateIn(HTMLFormElement&); private: FormController(); + FormControlState takeStateForFormElement(const HTMLFormControlElementWithState&); CheckedRadioButtons m_checkedRadioButtons; typedef ListHashSet<HTMLFormControlElementWithState*, 64> FormElementListHashSet; FormElementListHashSet m_formElementsWithState; - typedef ListHashSet<RefPtr<FormAssociatedElement>, 32> FormAssociatedElementListHashSet; - FormAssociatedElementListHashSet m_formElementsWithFormAttribute; typedef HashMap<FormElementKey, Deque<FormControlState>, FormElementKeyHash, FormElementKeyHashTraits> FormElementStateMap; FormElementStateMap m_stateForNewFormElements; diff --git a/Source/WebCore/html/HTMLAllCollection.cpp b/Source/WebCore/html/HTMLAllCollection.cpp index c68b00608..e769b2641 100644 --- a/Source/WebCore/html/HTMLAllCollection.cpp +++ b/Source/WebCore/html/HTMLAllCollection.cpp @@ -36,7 +36,7 @@ PassRefPtr<HTMLAllCollection> HTMLAllCollection::create(Document* document) } HTMLAllCollection::HTMLAllCollection(Document* document) - : HTMLCollection(document, DocAll) + : HTMLCollection(document, DocAll, SupportItemBefore) { } @@ -46,7 +46,6 @@ HTMLAllCollection::~HTMLAllCollection() Node* HTMLAllCollection::namedItemWithIndex(const AtomicString& name, unsigned index) const { - invalidateCacheIfNeeded(); updateNameCache(); if (Vector<Element*>* cache = idCache(name)) { diff --git a/Source/WebCore/html/HTMLCanvasElement.cpp b/Source/WebCore/html/HTMLCanvasElement.cpp index 073afa218..e1b9f48a1 100644 --- a/Source/WebCore/html/HTMLCanvasElement.cpp +++ b/Source/WebCore/html/HTMLCanvasElement.cpp @@ -135,6 +135,12 @@ RenderObject* HTMLCanvasElement::createRenderer(RenderArena* arena, RenderStyle* return HTMLElement::createRenderer(arena, style); } +void HTMLCanvasElement::attach() +{ + setIsInCanvasSubtree(true); + HTMLElement::attach(); +} + void HTMLCanvasElement::addObserver(CanvasObserver* observer) { m_observers.add(observer); diff --git a/Source/WebCore/html/HTMLCanvasElement.h b/Source/WebCore/html/HTMLCanvasElement.h index b83162083..2dde80fd4 100644 --- a/Source/WebCore/html/HTMLCanvasElement.h +++ b/Source/WebCore/html/HTMLCanvasElement.h @@ -142,6 +142,7 @@ private: virtual void parseAttribute(const Attribute&) OVERRIDE; virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); + virtual void attach(); void reset(); diff --git a/Source/WebCore/html/HTMLCollection.cpp b/Source/WebCore/html/HTMLCollection.cpp index 1f1c9c569..ef5f270a7 100644 --- a/Source/WebCore/html/HTMLCollection.cpp +++ b/Source/WebCore/html/HTMLCollection.cpp @@ -40,7 +40,7 @@ namespace WebCore { using namespace HTMLNames; -static bool shouldIncludeChildren(CollectionType type) +static bool shouldOnlyIncludeDirectChildren(CollectionType type) { switch (type) { case DocAll: @@ -63,27 +63,106 @@ static bool shouldIncludeChildren(CollectionType type) case ItemProperties: #endif case FormControls: - return true; + return false; case NodeChildren: case TRCells: case TSectionRows: case TableTBodies: - return false; + return true; + case InvalidCollectionType: + break; } ASSERT_NOT_REACHED(); return false; } -HTMLCollection::HTMLCollection(Node* base, CollectionType type) - : HTMLCollectionCacheBase(type, shouldIncludeChildren(type)) +static NodeListRootType rootTypeFromCollectionType(CollectionType type) +{ + switch (type) { + case DocImages: + case DocApplets: + case DocEmbeds: + case DocObjects: + case DocForms: + case DocLinks: + case DocAnchors: + case DocScripts: + case DocAll: + case WindowNamedItems: + case DocumentNamedItems: +#if ENABLE(MICRODATA) + case ItemProperties: +#endif + case FormControls: + return NodeListIsRootedAtDocument; + case NodeChildren: + case TableTBodies: + case TSectionRows: + case TableRows: + case TRCells: + case SelectOptions: + case SelectedOptions: + case DataListOptions: + case MapAreas: + case InvalidCollectionType: + return NodeListIsRootedAtNode; + } + ASSERT_NOT_REACHED(); + return NodeListIsRootedAtNode; +} + +static NodeListInvalidationType invalidationTypeExcludingIdAndNameAttributes(CollectionType type) +{ + switch (type) { + case DocImages: + case DocEmbeds: + case DocObjects: + case DocForms: + case DocAnchors: // Depends on name attribute. + case DocScripts: + case DocAll: + case WindowNamedItems: // Depends on id and name attributes. + case DocumentNamedItems: // Ditto. + case NodeChildren: + case TableTBodies: + case TSectionRows: + case TableRows: + case TRCells: + case SelectOptions: + case MapAreas: + return DoNotInvalidateOnAttributeChanges; + case DocApplets: + case SelectedOptions: + case DataListOptions: + // FIXME: We can do better some day. + return InvalidateOnAnyAttrChange; + case DocLinks: + return InvalidateOnHRefAttrChange; +#if ENABLE(MICRODATA) + case ItemProperties: + return InvalidateOnItemAttrChange; +#endif + case FormControls: + return InvalidateForFormControls; + case InvalidCollectionType: + break; + } + ASSERT_NOT_REACHED(); + return DoNotInvalidateOnAttributeChanges; +} + + +HTMLCollection::HTMLCollection(Node* base, CollectionType type, ItemBeforeSupportType itemBeforeSupportType) + : HTMLCollectionCacheBase(rootTypeFromCollectionType(type), invalidationTypeExcludingIdAndNameAttributes(type), type, itemBeforeSupportType) , m_base(base) { ASSERT(m_base); + m_base->document()->registerNodeListCache(this); } PassRefPtr<HTMLCollection> HTMLCollection::create(Node* base, CollectionType type) { - return adoptRef(new HTMLCollection(base, type)); + return adoptRef(new HTMLCollection(base, type, SupportItemBefore)); } HTMLCollection::~HTMLCollection() @@ -96,34 +175,16 @@ HTMLCollection::~HTMLCollection() toElement(base())->removeCachedHTMLCollection(this, type()); } else // HTMLNameCollection removes cache by itself. ASSERT(type() == WindowNamedItems || type() == DocumentNamedItems); -} - -void HTMLCollection::invalidateCacheIfNeeded() const -{ - uint64_t docversion = static_cast<HTMLDocument*>(m_base->document())->domTreeVersion(); - - if (cacheTreeVersion() == docversion) - return; - invalidateCache(); + m_base->document()->unregisterNodeListCache(this); } -void HTMLCollection::invalidateCache() const +static inline bool isAcceptableElement(CollectionType type, Element* element) { -#if ENABLE(MICRODATA) - // FIXME: There should be more generic mechanism to clear caches in subclasses. - if (type() == ItemProperties) - static_cast<const HTMLPropertiesCollection*>(this)->clearCache(); -#endif - clearCache(static_cast<HTMLDocument*>(m_base->document())->domTreeVersion()); -} - -inline bool HTMLCollection::isAcceptableElement(Element* element) const -{ - if (!element->isHTMLElement() && !(type() == DocAll || type() == NodeChildren)) + if (!element->isHTMLElement() && !(type == DocAll || type == NodeChildren)) return false; - switch (type()) { + switch (type) { case DocImages: return element->hasLocalName(imgTag); case DocScripts: @@ -170,70 +231,159 @@ inline bool HTMLCollection::isAcceptableElement(Element* element) const case DocumentNamedItems: case TableRows: case WindowNamedItems: + case InvalidCollectionType: ASSERT_NOT_REACHED(); } return false; } -static Node* nextNodeOrSibling(Node* base, Node* node, bool includeChildren) +template<bool forward> +static Node* nextNode(Node* base, Node* previous, bool onlyIncludeDirectChildren) { - return includeChildren ? node->traverseNextNode(base) : node->traverseNextSibling(base); + if (forward) + return onlyIncludeDirectChildren ? previous->nextSibling() : previous->traverseNextNode(base); + else + return onlyIncludeDirectChildren ? previous->previousSibling() : previous->traversePreviousNode(base); } -Element* HTMLCollection::itemAfter(Node* previous) const +template<bool forward> +static Element* itemBeforeOrAfter(CollectionType type, Node* base, unsigned& offsetInArray, Node* previous) { - Node* current; - if (!previous) - current = m_base->firstChild(); - else - current = nextNodeOrSibling(base(), previous, includeChildren()); - - for (; current; current = nextNodeOrSibling(base(), current, includeChildren())) { - if (!current->isElementNode()) - continue; - Element* element = static_cast<Element*>(current); - if (isAcceptableElement(element)) - return element; + ASSERT_UNUSED(offsetInArray, !offsetInArray); + bool onlyIncludeDirectChildren = shouldOnlyIncludeDirectChildren(type); + Node* rootNode = base; + Node* current = previous ? nextNode<forward>(rootNode, previous, onlyIncludeDirectChildren) : (forward ? base->firstChild() : base->lastChild()); + + for (; current; current = nextNode<forward>(rootNode, current, onlyIncludeDirectChildren)) { + if (current->isElementNode() && isAcceptableElement(type, toElement(current))) + return toElement(current); } return 0; } -unsigned HTMLCollection::calcLength() const +Element* HTMLCollection::itemBefore(unsigned& offsetInArray, Element* previous) const { - unsigned len = 0; - for (Element* current = itemAfter(0); current; current = itemAfter(current)) - ++len; - return len; + return itemBeforeOrAfter<false>(type(), base(), offsetInArray, previous); +} + +Element* HTMLCollection::itemAfter(unsigned& offsetInArray, Element* previous) const +{ + return itemBeforeOrAfter<true>(type(), base(), offsetInArray, previous); +} + +bool ALWAYS_INLINE HTMLCollection::isLastItemCloserThanLastOrCachedItem(unsigned offset) const +{ + ASSERT(isLengthCacheValid()); + unsigned distanceFromLastItem = cachedLength() - offset; + if (!isItemCacheValid()) + return distanceFromLastItem < offset; + + return cachedItemOffset() < offset && distanceFromLastItem < offset - cachedItemOffset(); +} + +bool ALWAYS_INLINE HTMLCollection::isFirstItemCloserThanCachedItem(unsigned offset) const +{ + ASSERT(isItemCacheValid()); + if (cachedItemOffset() < offset) + return false; + + unsigned distanceFromCachedItem = cachedItemOffset() - offset; + return offset < distanceFromCachedItem; } -// since the collections are to be "live", we have to do the -// calculation every time if anything has changed unsigned HTMLCollection::length() const { - invalidateCacheIfNeeded(); - if (!isLengthCacheValid()) - setLengthCache(calcLength()); - return cachedLength(); + if (isLengthCacheValid()) + return cachedLength(); + + if (!isItemCacheValid() && !item(0)) { + ASSERT(isLengthCacheValid()); + return 0; + } + + ASSERT(isItemCacheValid()); + ASSERT(cachedItem()); + unsigned offset = cachedItemOffset(); + do { + offset++; + } while (itemBeforeOrAfterCachedItem(offset)); + + setLengthCache(offset); + return offset; } -Node* HTMLCollection::item(unsigned index) const +Node* HTMLCollection::item(unsigned offset) const { - invalidateCacheIfNeeded(); - if (isItemCacheValid() && cachedItemOffset() == index) + if (isItemCacheValid() && cachedItemOffset() == offset) return cachedItem(); - if (isLengthCacheValid() && cachedLength() <= index) + + if (isLengthCacheValid() && cachedLength() <= offset) return 0; - if (!isItemCacheValid() || cachedItemOffset() > index) { - setItemCache(itemAfter(0), 0); - if (!cachedItem()) + +#if ENABLE(MICRODATA) + if (type() == ItemProperties) + static_cast<const HTMLPropertiesCollection*>(this)->updateRefElements(); +#endif + + if (isLengthCacheValid() && supportsItemBefore() && isLastItemCloserThanLastOrCachedItem(offset)) { + // FIXME: Need to figure out the last offset in array for HTMLFormCollection and HTMLPropertiesCollection + unsigned unusedOffsetInArray = 0; + Node* lastItem = itemBefore(unusedOffsetInArray, 0); + ASSERT(!unusedOffsetInArray); + ASSERT(lastItem); + setItemCache(lastItem, cachedLength() - 1, 0); + } else if (!isItemCacheValid() || isFirstItemCloserThanCachedItem(offset) || (!supportsItemBefore() && offset < cachedItemOffset())) { + unsigned offsetInArray = 0; + Node* firstItem = itemAfter(offsetInArray, 0); + if (!firstItem) { + setLengthCache(0); return 0; + } + setItemCache(firstItem, 0, offsetInArray); + ASSERT(!cachedItemOffset()); } - Node* e = cachedItem(); - for (unsigned pos = cachedItemOffset(); e && pos < index; pos++) - e = itemAfter(e); - setItemCache(e, index); - return cachedItem(); + + if (cachedItemOffset() == offset) + return cachedItem(); + + return itemBeforeOrAfterCachedItem(offset); +} + +Element* HTMLCollection::itemBeforeOrAfterCachedItem(unsigned offset) const +{ + unsigned currentOffset = cachedItemOffset(); + ASSERT(cachedItem()->isElementNode()); + Element* currentItem = toElement(cachedItem()); + ASSERT(currentOffset != offset); + + unsigned offsetInArray = cachedElementsArrayOffset(); + + if (offset < cachedItemOffset()) { + ASSERT(supportsItemBefore()); + while ((currentItem = itemBefore(offsetInArray, currentItem))) { + ASSERT(currentOffset); + currentOffset--; + if (currentOffset == offset) { + setItemCache(currentItem, currentOffset, offsetInArray); + return currentItem; + } + } + ASSERT_NOT_REACHED(); + return 0; + } + + while ((currentItem = itemAfter(offsetInArray, currentItem))) { + currentOffset++; + if (currentOffset == offset) { + setItemCache(currentItem, currentOffset, offsetInArray); + return currentItem; + } + } + + setLengthCache(currentOffset); + + return 0; } static inline bool nameShouldBeVisibleInDocumentAll(HTMLElement* element) @@ -271,21 +421,21 @@ Node* HTMLCollection::namedItem(const AtomicString& name) const // attribute. If a match is not found, the method then searches for an // object with a matching name attribute, but only on those elements // that are allowed a name attribute. - invalidateCacheIfNeeded(); + unsigned arrayOffset = 0; unsigned i = 0; - for (Element* e = itemAfter(0); e; e = itemAfter(e)) { + for (Element* e = itemAfter(arrayOffset, 0); e; e = itemAfter(arrayOffset, e)) { if (checkForNameMatch(e, /* checkName */ false, name)) { - setItemCache(e, i); + setItemCache(e, i, arrayOffset); return e; } i++; } i = 0; - for (Element* e = itemAfter(0); e; e = itemAfter(e)) { + for (Element* e = itemAfter(arrayOffset, 0); e; e = itemAfter(arrayOffset, e)) { if (checkForNameMatch(e, /* checkName */ true, name)) { - setItemCache(e, i); + setItemCache(e, i, arrayOffset); return e; } i++; @@ -299,7 +449,8 @@ void HTMLCollection::updateNameCache() const if (hasNameCache()) return; - for (Element* element = itemAfter(0); element; element = itemAfter(element)) { + unsigned arrayOffset = 0; + for (Element* element = itemAfter(arrayOffset, 0); element; element = itemAfter(arrayOffset, element)) { if (!element->isHTMLElement()) continue; HTMLElement* e = toHTMLElement(element); @@ -319,7 +470,6 @@ bool HTMLCollection::hasNamedItem(const AtomicString& name) const if (name.isEmpty()) return false; - invalidateCacheIfNeeded(); updateNameCache(); if (Vector<Element*>* cache = idCache(name)) { @@ -341,7 +491,6 @@ void HTMLCollection::namedItems(const AtomicString& name, Vector<RefPtr<Node> >& if (name.isEmpty()) return; - invalidateCacheIfNeeded(); updateNameCache(); Vector<Element*>* idResults = idCache(name); diff --git a/Source/WebCore/html/HTMLCollection.h b/Source/WebCore/html/HTMLCollection.h index bb7c7459c..6343e8edf 100644 --- a/Source/WebCore/html/HTMLCollection.h +++ b/Source/WebCore/html/HTMLCollection.h @@ -39,31 +39,13 @@ class NodeList; class HTMLCollectionCacheBase : public DynamicNodeListCacheBase { public: - HTMLCollectionCacheBase(CollectionType type, bool includeChildren) - : DynamicNodeListCacheBase(RootedAtNode, AlwaysInvalidate) // These two flags are never used + HTMLCollectionCacheBase(NodeListRootType rootType, NodeListInvalidationType invalidationType, CollectionType collectionType, ItemBeforeSupportType itemBeforeSupportType) + : DynamicNodeListCacheBase(rootType, invalidationType, collectionType, itemBeforeSupportType) , m_cachedElementsArrayOffset(0) - , m_cacheTreeVersion(0) - , m_hasNameCache(false) - , m_type(type) - , m_includeChildren(includeChildren) { - ASSERT(static_cast<CollectionType>(m_type) == type); } - CollectionType type() const { return static_cast<CollectionType>(m_type); } - protected: - void clearCache(uint64_t currentDomTreeVersion) const - { - DynamicNodeListCacheBase::clearCache(); - m_idCache.clear(); - m_nameCache.clear(); - m_cachedElementsArrayOffset = 0; - m_cacheTreeVersion = currentDomTreeVersion; - m_hasNameCache = false; - } - - using DynamicNodeListCacheBase::setItemCache; void setItemCache(Node* item, unsigned offset, unsigned elementsArrayOffset) const { setItemCache(item, offset); @@ -71,34 +53,23 @@ protected: } unsigned cachedElementsArrayOffset() const { return m_cachedElementsArrayOffset; } - bool includeChildren() const { return m_includeChildren; } - uint64_t cacheTreeVersion() const { return m_cacheTreeVersion; } - typedef HashMap<AtomicStringImpl*, OwnPtr<Vector<Element*> > > NodeCacheMap; Vector<Element*>* idCache(const AtomicString& name) const { return m_idCache.get(name.impl()); } Vector<Element*>* nameCache(const AtomicString& name) const { return m_nameCache.get(name.impl()); } void appendIdCache(const AtomicString& name, Element* element) const { append(m_idCache, name, element); } void appendNameCache(const AtomicString& name, Element* element) const { append(m_nameCache, name, element); } - bool hasNameCache() const { return m_hasNameCache; } - void setHasNameCache() const { m_hasNameCache = true; } - static void append(NodeCacheMap&, const AtomicString&, Element*); private: using DynamicNodeListCacheBase::isRootedAtDocument; - using DynamicNodeListCacheBase::shouldInvalidateOnAttributeChange; - using DynamicNodeListCacheBase::clearCache; + using DynamicNodeListCacheBase::setItemCache; mutable NodeCacheMap m_idCache; mutable NodeCacheMap m_nameCache; mutable unsigned m_cachedElementsArrayOffset; - mutable uint64_t m_cacheTreeVersion; - // FIXME: Move these bit flags to DynamicNodeListCacheBase to pack them better. - mutable unsigned m_hasNameCache : 1; - const unsigned m_type : 5; // CollectionType - const unsigned m_includeChildren : 1; + friend void DynamicNodeListCacheBase::invalidateCache() const; }; class HTMLCollection : public RefCounted<HTMLCollection>, public HTMLCollectionCacheBase { @@ -108,7 +79,7 @@ public: // DOM API unsigned length() const; - virtual Node* item(unsigned index) const; + Node* item(unsigned index) const; virtual Node* namedItem(const AtomicString& name) const; PassRefPtr<NodeList> tags(const String&); @@ -117,7 +88,6 @@ public: void namedItems(const AtomicString& name, Vector<RefPtr<Node> >&) const; bool isEmpty() const { - invalidateCacheIfNeeded(); if (isLengthCacheValid()) return !cachedLength(); if (isItemCacheValid()) @@ -126,7 +96,6 @@ public: } bool hasExactlyOneItem() const { - invalidateCacheIfNeeded(); if (isLengthCacheValid()) return cachedLength() == 1; if (isItemCacheValid()) @@ -136,21 +105,19 @@ public: Node* base() const { return m_base.get(); } - void invalidateCache() const; - void invalidateCacheIfNeeded() const; - protected: - HTMLCollection(Node* base, CollectionType); + HTMLCollection(Node* base, CollectionType, ItemBeforeSupportType); virtual void updateNameCache() const; - virtual Element* itemAfter(Node*) const; + virtual Element* itemAfter(unsigned& offsetInArray, Element*) const; private: bool checkForNameMatch(Element*, bool checkName, const AtomicString& name) const; - virtual unsigned calcLength() const; - - bool isAcceptableElement(Element*) const; + Element* itemBefore(unsigned& offsetInArray, Element*) const; + bool isLastItemCloserThanLastOrCachedItem(unsigned offset) const; + bool isFirstItemCloserThanCachedItem(unsigned offset) const; + Element* itemBeforeOrAfterCachedItem(unsigned offset) const; RefPtr<Node> m_base; }; diff --git a/Source/WebCore/html/HTMLFormCollection.cpp b/Source/WebCore/html/HTMLFormCollection.cpp index 3f95f8408..b845f0c6f 100644 --- a/Source/WebCore/html/HTMLFormCollection.cpp +++ b/Source/WebCore/html/HTMLFormCollection.cpp @@ -37,7 +37,7 @@ using namespace HTMLNames; // calculation every time if anything has changed. HTMLFormCollection::HTMLFormCollection(Element* base) - : HTMLCollection(base, FormControls) + : HTMLCollection(base, FormControls, DoNotSupportItemBefore) { ASSERT(base->hasTagName(formTag) || base->hasTagName(fieldsetTag)); } @@ -67,48 +67,17 @@ const Vector<HTMLImageElement*>& HTMLFormCollection::formImageElements() const return static_cast<HTMLFormElement*>(base())->imageElements(); } -unsigned HTMLFormCollection::numberOfFormControlElements() const +Element* HTMLFormCollection::itemAfter(unsigned& offset, Element* previousItem) const { - ASSERT(base()); - ASSERT(base()->hasTagName(formTag) || base()->hasTagName(fieldsetTag)); - if (base()->hasTagName(formTag)) - return static_cast<HTMLFormElement*>(base())->length(); - return static_cast<HTMLFieldSetElement*>(base())->length(); -} - -unsigned HTMLFormCollection::calcLength() const -{ - return numberOfFormControlElements(); -} - -Node* HTMLFormCollection::item(unsigned index) const -{ - invalidateCacheIfNeeded(); - - if (isItemCacheValid() && cachedItemOffset() == index) - return cachedItem(); - - if (isLengthCacheValid() && cachedLength() <= index) - return 0; - - if (!isItemCacheValid() || cachedItemOffset() > index) - setItemCache(0, 0, 0); - const Vector<FormAssociatedElement*>& elementsArray = formControlElements(); - unsigned currentIndex = cachedItemOffset(); - - for (unsigned i = cachedElementsArrayOffset(); i < elementsArray.size(); i++) { - if (elementsArray[i]->isEnumeratable()) { - HTMLElement* element = toHTMLElement(elementsArray[i]); - if (index == currentIndex) { - setItemCache(element, index, i); - return element; - } - - currentIndex++; - } + if (previousItem) + offset++; + while (offset < elementsArray.size()) { + FormAssociatedElement* element = elementsArray[offset]; + if (element->isEnumeratable()) + return toHTMLElement(element); + offset++; } - return 0; } @@ -142,7 +111,6 @@ Node* HTMLFormCollection::namedItem(const AtomicString& name) const // attribute. If a match is not found, the method then searches for an // object with a matching name attribute, but only on those elements // that are allowed a name attribute. - invalidateCacheIfNeeded(); const Vector<HTMLImageElement*>* imagesElements = base()->hasTagName(fieldsetTag) ? 0 : &formImageElements(); if (HTMLElement* item = firstNamedItem(formControlElements(), imagesElements, idAttr, name)) return item; diff --git a/Source/WebCore/html/HTMLFormCollection.h b/Source/WebCore/html/HTMLFormCollection.h index 753a0d06e..82cbfed15 100644 --- a/Source/WebCore/html/HTMLFormCollection.h +++ b/Source/WebCore/html/HTMLFormCollection.h @@ -40,18 +40,16 @@ public: virtual ~HTMLFormCollection(); - virtual Node* item(unsigned index) const; virtual Node* namedItem(const AtomicString& name) const; private: HTMLFormCollection(Element*); virtual void updateNameCache() const; - virtual unsigned calcLength() const; const Vector<FormAssociatedElement*>& formControlElements() const; const Vector<HTMLImageElement*>& formImageElements() const; - unsigned numberOfFormControlElements() const; + virtual Element* itemAfter(unsigned& offsetInArray, Element*) const OVERRIDE; }; } //namespace diff --git a/Source/WebCore/html/HTMLFormControlElement.cpp b/Source/WebCore/html/HTMLFormControlElement.cpp index 901783beb..913c4ddb0 100644 --- a/Source/WebCore/html/HTMLFormControlElement.cpp +++ b/Source/WebCore/html/HTMLFormControlElement.cpp @@ -312,7 +312,9 @@ bool HTMLFormControlElement::supportsFocus() const bool HTMLFormControlElement::isFocusable() const { - if (!renderer() || !renderer()->isBox() || toRenderBox(renderer())->size().isEmpty()) + // If there's a renderer, make sure the size isn't empty, but if there's no renderer, + // it might still be focusable if it's in a canvas subtree (handled in Node::isFocusable). + if (renderer() && (!renderer()->isBox() || toRenderBox(renderer())->size().isEmpty())) return false; // HTMLElement::isFocusable handles visibility and calls suportsFocus which // will cover the disabled case. diff --git a/Source/WebCore/html/HTMLFormControlElementWithState.cpp b/Source/WebCore/html/HTMLFormControlElementWithState.cpp index 22940e0d6..f96d264c0 100644 --- a/Source/WebCore/html/HTMLFormControlElementWithState.cpp +++ b/Source/WebCore/html/HTMLFormControlElementWithState.cpp @@ -70,16 +70,12 @@ FormControlState HTMLFormControlElementWithState::saveFormControlState() const void HTMLFormControlElementWithState::finishParsingChildren() { HTMLFormControlElement::finishParsingChildren(); + document()->formController()->restoreControlStateFor(*this); +} - // We don't save state of a control with shouldSaveAndRestoreFormControlState()=false. - // But we need to skip restoring process too because a control in another - // form might have the same pair of name and type and saved its state. - if (!shouldSaveAndRestoreFormControlState()) - return; - - FormControlState state = document()->formController()->takeStateForFormElement(*this); - if (state.valueSize() > 0) - restoreFormControlState(state); +bool HTMLFormControlElementWithState::isFormControlElementWithState() const +{ + return true; } } // namespace Webcore diff --git a/Source/WebCore/html/HTMLFormControlElementWithState.h b/Source/WebCore/html/HTMLFormControlElementWithState.h index f14d856a8..5e7bb1acd 100644 --- a/Source/WebCore/html/HTMLFormControlElementWithState.h +++ b/Source/WebCore/html/HTMLFormControlElementWithState.h @@ -36,7 +36,7 @@ public: virtual bool canContainRangeEndPoint() const { return false; } - bool shouldSaveAndRestoreFormControlState() const; + virtual bool shouldSaveAndRestoreFormControlState() const; virtual FormControlState saveFormControlState() const; // The specified FormControlState must have at least one string value. virtual void restoreFormControlState(const FormControlState&) { } @@ -47,6 +47,7 @@ protected: virtual bool shouldAutocomplete() const; virtual void finishParsingChildren(); virtual void didMoveToNewDocument(Document* oldDocument) OVERRIDE; + virtual bool isFormControlElementWithState() const OVERRIDE; }; } // namespace diff --git a/Source/WebCore/html/HTMLFormElement.cpp b/Source/WebCore/html/HTMLFormElement.cpp index 3c8bb073c..9b2a5915c 100644 --- a/Source/WebCore/html/HTMLFormElement.cpp +++ b/Source/WebCore/html/HTMLFormElement.cpp @@ -141,14 +141,6 @@ Node::InsertionNotificationRequest HTMLFormElement::insertedInto(ContainerNode* return InsertionDone; } -void HTMLFormElement::didNotifyDescendantInsertions(ContainerNode* insertionPoint) -{ - ASSERT(insertionPoint->inDocument()); - HTMLElement::didNotifyDescendantInsertions(insertionPoint); - if (hasID()) - document()->formController()->resetFormElementsOwner(); -} - static inline Node* findRoot(Node* n) { Node* root = n; @@ -164,8 +156,6 @@ void HTMLFormElement::removedFrom(ContainerNode* insertionPoint) for (unsigned i = 0; i < associatedElements.size(); ++i) associatedElements[i]->formRemovedFromTree(root); HTMLElement::removedFrom(insertionPoint); - if (insertionPoint->inDocument() && hasID()) - document()->formController()->resetFormElementsOwner(); } void HTMLFormElement::handleLocalEvents(Event* event) @@ -436,33 +426,33 @@ template<class T, size_t n> static void removeFromVector(Vector<T*, n> & vec, T* } } -unsigned HTMLFormElement::formElementIndexWithFormAttribute(Element* element) +unsigned HTMLFormElement::formElementIndexWithFormAttribute(Element* element, unsigned rangeStart, unsigned rangeEnd) { - // Compares the position of the form element and the inserted element. - // Updates the indeces in order to the relation of the position: - unsigned short position = compareDocumentPosition(element); - if (position & (DOCUMENT_POSITION_CONTAINS | DOCUMENT_POSITION_CONTAINED_BY)) - ++m_associatedElementsAfterIndex; - else if (position & DOCUMENT_POSITION_PRECEDING) { - ++m_associatedElementsBeforeIndex; - ++m_associatedElementsAfterIndex; - } - if (m_associatedElements.isEmpty()) return 0; + ASSERT(rangeStart <= rangeEnd); + + if (rangeStart == rangeEnd) + return rangeStart; + + unsigned left = rangeStart; + unsigned right = rangeEnd - 1; + unsigned short position; + // Does binary search on m_associatedElements in order to find the index // to be inserted. - unsigned left = 0, right = m_associatedElements.size() - 1; while (left != right) { unsigned middle = left + ((right - left) / 2); + ASSERT(middle < m_associatedElementsBeforeIndex || middle >= m_associatedElementsAfterIndex); position = element->compareDocumentPosition(toHTMLElement(m_associatedElements[middle])); if (position & DOCUMENT_POSITION_FOLLOWING) right = middle; else left = middle + 1; } - + + ASSERT(left < m_associatedElementsBeforeIndex || left >= m_associatedElementsAfterIndex); position = element->compareDocumentPosition(toHTMLElement(m_associatedElements[left])); if (position & DOCUMENT_POSITION_FOLLOWING) return left; @@ -474,8 +464,16 @@ unsigned HTMLFormElement::formElementIndex(FormAssociatedElement* associatedElem HTMLElement* element = toHTMLElement(associatedElement); // Treats separately the case where this element has the form attribute // for performance consideration. - if (element->fastHasAttribute(formAttr)) - return formElementIndexWithFormAttribute(element); + if (element->fastHasAttribute(formAttr)) { + unsigned short position = compareDocumentPosition(element); + if (position & DOCUMENT_POSITION_PRECEDING) { + ++m_associatedElementsBeforeIndex; + ++m_associatedElementsAfterIndex; + return HTMLFormElement::formElementIndexWithFormAttribute(element, 0, m_associatedElementsBeforeIndex - 1); + } + if (position & DOCUMENT_POSITION_FOLLOWING && !(position & DOCUMENT_POSITION_CONTAINED_BY)) + return HTMLFormElement::formElementIndexWithFormAttribute(element, m_associatedElementsAfterIndex, m_associatedElements.size()); + } // Check for the special case where this element is the very last thing in // the form's tree of children; we don't want to walk the entire tree in that @@ -685,4 +683,10 @@ bool HTMLFormElement::shouldAutocomplete() const return !equalIgnoringCase(fastGetAttribute(autocompleteAttr), "off"); } +void HTMLFormElement::finishParsingChildren() +{ + HTMLElement::finishParsingChildren(); + document()->formController()->restoreControlStateIn(*this); +} + } // namespace diff --git a/Source/WebCore/html/HTMLFormElement.h b/Source/WebCore/html/HTMLFormElement.h index ee9ccf39b..9d4739423 100644 --- a/Source/WebCore/html/HTMLFormElement.h +++ b/Source/WebCore/html/HTMLFormElement.h @@ -119,8 +119,8 @@ private: virtual bool rendererIsNeeded(const NodeRenderingContext&); virtual InsertionNotificationRequest insertedInto(ContainerNode*) OVERRIDE; - virtual void didNotifyDescendantInsertions(ContainerNode*) OVERRIDE; virtual void removedFrom(ContainerNode*) OVERRIDE; + virtual void finishParsingChildren() OVERRIDE; virtual void handleLocalEvents(Event*); @@ -135,7 +135,7 @@ private: void submit(Event*, bool activateSubmitButton, bool processingUserGesture, FormSubmissionTrigger); - unsigned formElementIndexWithFormAttribute(Element*); + unsigned formElementIndexWithFormAttribute(Element*, unsigned rangeStart, unsigned rangeEnd); unsigned formElementIndex(FormAssociatedElement*); // Returns true if the submission should proceed. diff --git a/Source/WebCore/html/HTMLInputElement.cpp b/Source/WebCore/html/HTMLInputElement.cpp index a12ba7849..77ea42567 100644 --- a/Source/WebCore/html/HTMLInputElement.cpp +++ b/Source/WebCore/html/HTMLInputElement.cpp @@ -526,6 +526,13 @@ const AtomicString& HTMLInputElement::formControlType() const return m_inputType->formControlType(); } +bool HTMLInputElement::shouldSaveAndRestoreFormControlState() const +{ + if (!m_inputType->shouldSaveAndRestoreFormControlState()) + return false; + return HTMLTextFormControlElement::shouldSaveAndRestoreFormControlState(); +} + FormControlState HTMLInputElement::saveFormControlState() const { return m_inputType->saveFormControlState(); diff --git a/Source/WebCore/html/HTMLInputElement.h b/Source/WebCore/html/HTMLInputElement.h index e10825cd6..20f0b42d1 100644 --- a/Source/WebCore/html/HTMLInputElement.h +++ b/Source/WebCore/html/HTMLInputElement.h @@ -296,6 +296,7 @@ private: virtual const AtomicString& formControlType() const; + virtual bool shouldSaveAndRestoreFormControlState() const OVERRIDE; virtual FormControlState saveFormControlState() const OVERRIDE; virtual void restoreFormControlState(const FormControlState&) OVERRIDE; diff --git a/Source/WebCore/html/HTMLKeygenElement.cpp b/Source/WebCore/html/HTMLKeygenElement.cpp index 499ceb341..a1b032e06 100644 --- a/Source/WebCore/html/HTMLKeygenElement.cpp +++ b/Source/WebCore/html/HTMLKeygenElement.cpp @@ -129,6 +129,11 @@ void HTMLKeygenElement::reset() static_cast<HTMLFormControlElement*>(shadowSelect())->reset(); } +bool HTMLKeygenElement::shouldSaveAndRestoreFormControlState() const +{ + return false; +} + HTMLSelectElement* HTMLKeygenElement::shadowSelect() const { ShadowRoot* root = this->shadow()->oldestShadowRoot(); diff --git a/Source/WebCore/html/HTMLKeygenElement.h b/Source/WebCore/html/HTMLKeygenElement.h index a28d26993..78b0c691c 100644 --- a/Source/WebCore/html/HTMLKeygenElement.h +++ b/Source/WebCore/html/HTMLKeygenElement.h @@ -51,6 +51,7 @@ private: virtual bool supportLabels() const OVERRIDE { return true; } virtual void reset(); + virtual bool shouldSaveAndRestoreFormControlState() const OVERRIDE; HTMLSelectElement* shadowSelect() const; }; diff --git a/Source/WebCore/html/HTMLMediaElement.cpp b/Source/WebCore/html/HTMLMediaElement.cpp index fddc42893..31d46df3f 100644 --- a/Source/WebCore/html/HTMLMediaElement.cpp +++ b/Source/WebCore/html/HTMLMediaElement.cpp @@ -488,7 +488,11 @@ RenderObject* HTMLMediaElement::createRenderer(RenderArena* arena, RenderStyle*) bool HTMLMediaElement::childShouldCreateRenderer(const NodeRenderingContext& childContext) const { - return childContext.isOnUpperEncapsulationBoundary() && HTMLElement::childShouldCreateRenderer(childContext); + if (!hasMediaControls()) + return false; + // Only allows nodes from the controls shadow subtree. + return (mediaControls()->treeScope() == childContext.node()->treeScope() + && childContext.isOnUpperEncapsulationBoundary() && HTMLElement::childShouldCreateRenderer(childContext)); } Node::InsertionNotificationRequest HTMLMediaElement::insertedInto(ContainerNode* insertionPoint) @@ -3481,6 +3485,16 @@ void HTMLMediaElement::mediaPlayerRenderingModeChanged(MediaPlayer*) } #endif +#if PLATFORM(WIN) && USE(AVFOUNDATION) +GraphicsDeviceAdapter* HTMLMediaElement::mediaPlayerGraphicsDeviceAdapter(const MediaPlayer*) const +{ + if (!document() || !document()->page()) + return 0; + + return document()->page()->chrome()->client()->graphicsDeviceAdapter(); +} +#endif + void HTMLMediaElement::mediaPlayerEngineUpdated(MediaPlayer*) { LOG(Media, "HTMLMediaElement::mediaPlayerEngineUpdated"); @@ -4142,12 +4156,12 @@ void HTMLMediaElement::privateBrowsingStateDidChange() m_player->setPrivateBrowsingMode(privateMode); } -MediaControls* HTMLMediaElement::mediaControls() +MediaControls* HTMLMediaElement::mediaControls() const { return toMediaControls(shadow()->oldestShadowRoot()->firstChild()); } -bool HTMLMediaElement::hasMediaControls() +bool HTMLMediaElement::hasMediaControls() const { ElementShadow* elementShadow = shadow(); if (!elementShadow) diff --git a/Source/WebCore/html/HTMLMediaElement.h b/Source/WebCore/html/HTMLMediaElement.h index 4015a2f86..9f8150a9b 100644 --- a/Source/WebCore/html/HTMLMediaElement.h +++ b/Source/WebCore/html/HTMLMediaElement.h @@ -291,7 +291,7 @@ public: bool closedCaptionsVisible() const; void setClosedCaptionsVisible(bool); - MediaControls* mediaControls(); + MediaControls* mediaControls() const; void sourceWasRemoved(HTMLSourceElement*); void sourceWasAdded(HTMLSourceElement*); @@ -432,6 +432,10 @@ private: virtual bool mediaPlayerNeedsSiteSpecificHacks() const OVERRIDE; virtual String mediaPlayerDocumentHost() const OVERRIDE; +#if PLATFORM(WIN) && USE(AVFOUNDATION) + virtual GraphicsDeviceAdapter* mediaPlayerGraphicsDeviceAdapter(const MediaPlayer*) const OVERRIDE; +#endif + void loadTimerFired(Timer<HTMLMediaElement>*); void progressEventTimerFired(Timer<HTMLMediaElement>*); void playbackProgressTimerFired(Timer<HTMLMediaElement>*); @@ -508,7 +512,7 @@ private: void invalidateCachedTime(); void refreshCachedTime() const; - bool hasMediaControls(); + bool hasMediaControls() const; bool createMediaControls(); void configureMediaControls(); diff --git a/Source/WebCore/html/HTMLNameCollection.cpp b/Source/WebCore/html/HTMLNameCollection.cpp index e253e3055..246235d07 100644 --- a/Source/WebCore/html/HTMLNameCollection.cpp +++ b/Source/WebCore/html/HTMLNameCollection.cpp @@ -33,7 +33,7 @@ namespace WebCore { using namespace HTMLNames; HTMLNameCollection::HTMLNameCollection(Document* document, CollectionType type, const AtomicString& name) - : HTMLCollection(document, type) + : HTMLCollection(document, type, DoNotSupportItemBefore) , m_name(name) { } @@ -49,8 +49,9 @@ HTMLNameCollection::~HTMLNameCollection() static_cast<Document*>(base())->removeDocumentNamedItemCache(this, m_name); } -Element* HTMLNameCollection::itemAfter(Node* previous) const +Element* HTMLNameCollection::itemAfter(unsigned& offsetInArray, Element* previous) const { + ASSERT_UNUSED(offsetInArray, !offsetInArray); ASSERT(previous != base()); Node* current; diff --git a/Source/WebCore/html/HTMLNameCollection.h b/Source/WebCore/html/HTMLNameCollection.h index 08f829a91..dd9d45d9d 100644 --- a/Source/WebCore/html/HTMLNameCollection.h +++ b/Source/WebCore/html/HTMLNameCollection.h @@ -43,7 +43,7 @@ public: private: HTMLNameCollection(Document*, CollectionType, const AtomicString& name); - virtual Element* itemAfter(Node*) const OVERRIDE; + virtual Element* itemAfter(unsigned& offsetInArray, Element*) const OVERRIDE; AtomicString m_name; }; diff --git a/Source/WebCore/html/HTMLOptionsCollection.cpp b/Source/WebCore/html/HTMLOptionsCollection.cpp index 7000f2891..960fc8995 100644 --- a/Source/WebCore/html/HTMLOptionsCollection.cpp +++ b/Source/WebCore/html/HTMLOptionsCollection.cpp @@ -28,7 +28,7 @@ namespace WebCore { HTMLOptionsCollection::HTMLOptionsCollection(Element* select) - : HTMLCollection(select, SelectOptions) + : HTMLCollection(select, SelectOptions, SupportItemBefore) { ASSERT(select->hasTagName(HTMLNames::selectTag)); } diff --git a/Source/WebCore/html/HTMLOptionsCollection.h b/Source/WebCore/html/HTMLOptionsCollection.h index bd6fe7d07..3cd8e7fcb 100644 --- a/Source/WebCore/html/HTMLOptionsCollection.h +++ b/Source/WebCore/html/HTMLOptionsCollection.h @@ -46,8 +46,6 @@ public: void setLength(unsigned, ExceptionCode&); - using HTMLCollection::invalidateCacheIfNeeded; - private: HTMLOptionsCollection(Element*); }; diff --git a/Source/WebCore/html/HTMLPropertiesCollection.cpp b/Source/WebCore/html/HTMLPropertiesCollection.cpp index 87394c230..c17e7c696 100644 --- a/Source/WebCore/html/HTMLPropertiesCollection.cpp +++ b/Source/WebCore/html/HTMLPropertiesCollection.cpp @@ -51,7 +51,7 @@ PassRefPtr<HTMLPropertiesCollection> HTMLPropertiesCollection::create(Node* item } HTMLPropertiesCollection::HTMLPropertiesCollection(Node* itemNode) - : HTMLCollection(itemNode, ItemProperties) + : HTMLCollection(itemNode, ItemProperties, DoNotSupportItemBefore) , m_hasPropertyNameCache(false) , m_hasItemRefElements(false) { @@ -69,10 +69,13 @@ void HTMLPropertiesCollection::updateRefElements() const HTMLElement* baseElement = toHTMLElement(base()); m_itemRefElements.clear(); + m_hasItemRefElements = true; + + if (!baseElement->fastHasAttribute(itemscopeAttr)) + return; if (!baseElement->fastHasAttribute(itemrefAttr)) { m_itemRefElements.append(baseElement); - m_hasItemRefElements = true; return; } @@ -97,7 +100,6 @@ void HTMLPropertiesCollection::updateRefElements() const m_itemRefElements.append(element); } } - m_hasItemRefElements = true; } static Node* nextNodeWithProperty(Node* base, Node* node) @@ -110,7 +112,18 @@ static Node* nextNodeWithProperty(Node* base, Node* node) ? node->traverseNextNode(base) : node->traverseNextSibling(base); } -Element* HTMLPropertiesCollection::itemAfter(Element* base, Node* previous) const +Element* HTMLPropertiesCollection::itemAfter(unsigned& offsetInArray, Element* previousItem) const +{ + while (offsetInArray < m_itemRefElements.size()) { + if (Element* next = itemAfter(m_itemRefElements[offsetInArray], previousItem)) + return next; + offsetInArray++; + previousItem = 0; + } + return 0; +} + +HTMLElement* HTMLPropertiesCollection::itemAfter(HTMLElement* base, Element* previous) const { Node* current; current = previous ? nextNodeWithProperty(base, previous) : base; @@ -127,116 +140,38 @@ Element* HTMLPropertiesCollection::itemAfter(Element* base, Node* previous) cons return 0; } -unsigned HTMLPropertiesCollection::calcLength() const -{ - if (!toHTMLElement(base())->fastHasAttribute(itemscopeAttr)) - return 0; - - unsigned length = 0; - updateRefElements(); - - for (unsigned i = 0; i < m_itemRefElements.size(); ++i) { - for (Element* element = itemAfter(m_itemRefElements[i], 0); element; element = itemAfter(m_itemRefElements[i], element)) - ++length; - } - - return length; -} - -void HTMLPropertiesCollection::cacheFirstItem() const -{ - for (unsigned i = 0; i < m_itemRefElements.size(); ++i) { - if (Element* element = itemAfter(m_itemRefElements[i], 0)) - return setItemCache(element, 0, i); - } - setItemCache(0, 0, 0); -} - -Node* HTMLPropertiesCollection::item(unsigned index) const -{ - if (!toHTMLElement(base())->fastHasAttribute(itemscopeAttr)) - return 0; - - invalidateCacheIfNeeded(); - if (isItemCacheValid() && cachedItemOffset() == index) - return cachedItem(); - - if (isLengthCacheValid() && cachedLength() <= index) - return 0; - - updateRefElements(); - if (!isItemCacheValid() || cachedItemOffset() > index) { - cacheFirstItem(); - ASSERT(isItemCacheValid()); - if (!cachedItem() || cachedItemOffset() == index) - return cachedItem(); - } - - unsigned currentPosition = cachedItemOffset(); - Node* element = cachedItem(); - ASSERT(currentPosition != index); - - for (unsigned i = cachedElementsArrayOffset(); i < m_itemRefElements.size(); ++i) { - while (currentPosition < index) { - element = itemAfter(m_itemRefElements[i], element); - if (!element) - break; - currentPosition++; - - if (currentPosition == index) { - setItemCache(element, currentPosition, i); - return cachedItem(); - } - } - } - - setLengthCache(currentPosition); - - return 0; -} - -void HTMLPropertiesCollection::findProperties(Element* base) const -{ - for (Element* element = itemAfter(base, 0); element; element = itemAfter(base, element)) { - DOMSettableTokenList* itemProperty = element->itemProp(); - for (unsigned i = 0; i < itemProperty->length(); ++i) - updatePropertyCache(element, itemProperty->item(i)); - } -} - void HTMLPropertiesCollection::updateNameCache() const { - invalidateCacheIfNeeded(); if (m_hasPropertyNameCache) return; updateRefElements(); - for (unsigned i = 0; i < m_itemRefElements.size(); ++i) - findProperties(m_itemRefElements[i]); + for (unsigned i = 0; i < m_itemRefElements.size(); ++i) { + HTMLElement* refElement = m_itemRefElements[i]; + for (HTMLElement* element = itemAfter(refElement, 0); element; element = itemAfter(refElement, element)) { + DOMSettableTokenList* itemProperty = element->itemProp(); + for (unsigned propertyIndex = 0; propertyIndex < itemProperty->length(); ++propertyIndex) + updatePropertyCache(element, itemProperty->item(propertyIndex)); + } + } m_hasPropertyNameCache = true; } PassRefPtr<DOMStringList> HTMLPropertiesCollection::names() const { - if (!toHTMLElement(base())->fastHasAttribute(itemscopeAttr)) - return DOMStringList::create(); - updateNameCache(); - + if (!m_propertyNames) + m_propertyNames = DOMStringList::create(); return m_propertyNames; } PassRefPtr<NodeList> HTMLPropertiesCollection::namedItem(const String& name) const { - if (!toHTMLElement(base())->fastHasAttribute(itemscopeAttr)) - return 0; - - Vector<RefPtr<Node> > namedItems; - updateNameCache(); + Vector<RefPtr<Node> > namedItems; Vector<Element*>* propertyResults = m_propertyCache.get(AtomicString(name).impl()); for (unsigned i = 0; propertyResults && i < propertyResults->size(); ++i) namedItems.append(propertyResults->at(i)); @@ -247,9 +182,6 @@ PassRefPtr<NodeList> HTMLPropertiesCollection::namedItem(const String& name) con bool HTMLPropertiesCollection::hasNamedItem(const AtomicString& name) const { - if (!toHTMLElement(base())->fastHasAttribute(itemscopeAttr)) - return false; - updateNameCache(); if (Vector<Element*>* propertyCache = m_propertyCache.get(name.impl())) { diff --git a/Source/WebCore/html/HTMLPropertiesCollection.h b/Source/WebCore/html/HTMLPropertiesCollection.h index 7826df409..dba91cac1 100644 --- a/Source/WebCore/html/HTMLPropertiesCollection.h +++ b/Source/WebCore/html/HTMLPropertiesCollection.h @@ -45,14 +45,13 @@ public: static PassRefPtr<HTMLPropertiesCollection> create(Node*); virtual ~HTMLPropertiesCollection(); - virtual Node* item(unsigned) const OVERRIDE; + void updateRefElements() const; PassRefPtr<DOMStringList> names() const; - virtual PassRefPtr<NodeList> namedItem(const String&) const OVERRIDE; virtual bool hasNamedItem(const AtomicString&) const OVERRIDE; - void clearCache() const + void invalidateCache() const { m_itemRefElements.clear(); m_propertyNames.clear(); @@ -64,16 +63,12 @@ public: private: HTMLPropertiesCollection(Node*); - virtual unsigned calcLength() const OVERRIDE; - void findProperties(Element* base) const; - Node* findRefElements(Node* previous) const; - void cacheFirstItem() const; - Element* itemAfter(Element* base, Node* previous) const; + virtual Element* itemAfter(unsigned& offsetInArray, Element*) const OVERRIDE; + HTMLElement* itemAfter(HTMLElement* base, Element* previous) const; void updateNameCache() const; - void updateRefElements() const; void updatePropertyCache(Element* element, const AtomicString& propertyName) const { @@ -88,7 +83,7 @@ private: append(m_propertyCache, propertyName, element); } - mutable Vector<Element*> m_itemRefElements; + mutable Vector<HTMLElement*> m_itemRefElements; mutable RefPtr<DOMStringList> m_propertyNames; mutable NodeCacheMap m_propertyCache; diff --git a/Source/WebCore/html/HTMLTableRowsCollection.cpp b/Source/WebCore/html/HTMLTableRowsCollection.cpp index 534db17e6..206864ec2 100644 --- a/Source/WebCore/html/HTMLTableRowsCollection.cpp +++ b/Source/WebCore/html/HTMLTableRowsCollection.cpp @@ -152,7 +152,7 @@ HTMLTableRowElement* HTMLTableRowsCollection::lastRow(HTMLTableElement* table) // table to get at the collection cache. Order of argument evaluation is undefined and can // differ between compilers. HTMLTableRowsCollection::HTMLTableRowsCollection(Element* table) - : HTMLCollection(table, TableRows) + : HTMLCollection(table, TableRows, DoNotSupportItemBefore) { ASSERT(table->hasTagName(tableTag)); } @@ -162,8 +162,9 @@ PassRefPtr<HTMLTableRowsCollection> HTMLTableRowsCollection::create(Element* tab return adoptRef(new HTMLTableRowsCollection(table)); } -Element* HTMLTableRowsCollection::itemAfter(Node* previous) const +Element* HTMLTableRowsCollection::itemAfter(unsigned& offsetInArray, Element* previous) const { + ASSERT_UNUSED(offsetInArray, !offsetInArray); ASSERT(!previous || (previous->isHTMLElement() && toHTMLElement(previous)->hasLocalName(trTag))); return rowAfter(static_cast<HTMLTableElement*>(base()), static_cast<HTMLTableRowElement*>(previous)); } diff --git a/Source/WebCore/html/HTMLTableRowsCollection.h b/Source/WebCore/html/HTMLTableRowsCollection.h index 02bb9f749..817b14373 100644 --- a/Source/WebCore/html/HTMLTableRowsCollection.h +++ b/Source/WebCore/html/HTMLTableRowsCollection.h @@ -46,7 +46,7 @@ public: private: HTMLTableRowsCollection(Element*); - virtual Element* itemAfter(Node*) const OVERRIDE; + virtual Element* itemAfter(unsigned& offsetInArray, Element*) const OVERRIDE; }; } // namespace diff --git a/Source/WebCore/html/ImageInputType.cpp b/Source/WebCore/html/ImageInputType.cpp index 456f22c75..af4cc9068 100644 --- a/Source/WebCore/html/ImageInputType.cpp +++ b/Source/WebCore/html/ImageInputType.cpp @@ -190,7 +190,7 @@ unsigned ImageInputType::height() const return height; // If the image is available, use its height. - if (m_imageLoader->image()) + if (m_imageLoader && m_imageLoader->image()) return m_imageLoader->image()->imageSizeForRenderer(element->renderer(), 1).height(); } @@ -211,7 +211,7 @@ unsigned ImageInputType::width() const return width; // If the image is available, use its width. - if (m_imageLoader->image()) + if (m_imageLoader && m_imageLoader->image()) return m_imageLoader->image()->imageSizeForRenderer(element->renderer(), 1).width(); } diff --git a/Source/WebCore/html/InputType.cpp b/Source/WebCore/html/InputType.cpp index 99e5422ef..4c4586523 100644 --- a/Source/WebCore/html/InputType.cpp +++ b/Source/WebCore/html/InputType.cpp @@ -169,6 +169,11 @@ bool InputType::isRangeControl() const return false; } +bool InputType::shouldSaveAndRestoreFormControlState() const +{ + return true; +} + FormControlState InputType::saveFormControlState() const { String currentValue = element()->value(); diff --git a/Source/WebCore/html/InputType.h b/Source/WebCore/html/InputType.h index fa41ff857..6c6659a7c 100644 --- a/Source/WebCore/html/InputType.h +++ b/Source/WebCore/html/InputType.h @@ -128,6 +128,7 @@ public: // Form value functions + virtual bool shouldSaveAndRestoreFormControlState() const; virtual FormControlState saveFormControlState() const; virtual void restoreFormControlState(const FormControlState&); virtual bool isFormDataAppendable() const; diff --git a/Source/WebCore/html/LabelableElement.cpp b/Source/WebCore/html/LabelableElement.cpp index 6a2632e2f..af4533d8c 100644 --- a/Source/WebCore/html/LabelableElement.cpp +++ b/Source/WebCore/html/LabelableElement.cpp @@ -47,7 +47,7 @@ PassRefPtr<NodeList> LabelableElement::labels() if (!document()) return 0; - return ensureRareData()->ensureNodeLists(this)->addCacheWithAtomicName<LabelsNodeList>(this, DynamicNodeList::LabelsNodeListType, starAtom); + return ensureRareData()->ensureNodeLists()->addCacheWithAtomicName<LabelsNodeList>(this, DynamicNodeList::LabelsNodeListType, starAtom); } } // namespace Webcore diff --git a/Source/WebCore/html/LabelsNodeList.cpp b/Source/WebCore/html/LabelsNodeList.cpp index 89f0baf7c..d3a4ba162 100644 --- a/Source/WebCore/html/LabelsNodeList.cpp +++ b/Source/WebCore/html/LabelsNodeList.cpp @@ -34,15 +34,13 @@ namespace WebCore { using namespace HTMLNames; LabelsNodeList::LabelsNodeList(Node* forNode) - : DynamicSubtreeNodeList(forNode, RootedAtDocument) + : DynamicSubtreeNodeList(forNode, InvalidateOnForAttrChange, NodeListIsRootedAtDocument) { - document()->registerDynamicSubtreeNodeList(this); } LabelsNodeList::~LabelsNodeList() { ownerNode()->nodeLists()->removeCacheWithAtomicName(this, DynamicNodeList::LabelsNodeListType, starAtom); - document()->unregisterDynamicSubtreeNodeList(this); } bool LabelsNodeList::nodeMatches(Element* testNode) const diff --git a/Source/WebCore/html/PasswordInputType.cpp b/Source/WebCore/html/PasswordInputType.cpp index 10c2d9f9e..a64c8e516 100644 --- a/Source/WebCore/html/PasswordInputType.cpp +++ b/Source/WebCore/html/PasswordInputType.cpp @@ -49,9 +49,15 @@ const AtomicString& PasswordInputType::formControlType() const return InputTypeNames::password(); } +bool PasswordInputType::shouldSaveAndRestoreFormControlState() const +{ + return false; +} + FormControlState PasswordInputType::saveFormControlState() const { // Should never save/restore password fields. + ASSERT_NOT_REACHED(); return FormControlState(); } diff --git a/Source/WebCore/html/PasswordInputType.h b/Source/WebCore/html/PasswordInputType.h index 83012cf9c..fb9101c02 100644 --- a/Source/WebCore/html/PasswordInputType.h +++ b/Source/WebCore/html/PasswordInputType.h @@ -42,6 +42,7 @@ public: private: PasswordInputType(HTMLInputElement* element) : BaseTextInputType(element) { } virtual const AtomicString& formControlType() const OVERRIDE; + virtual bool shouldSaveAndRestoreFormControlState() const OVERRIDE; virtual FormControlState saveFormControlState() const OVERRIDE; virtual void restoreFormControlState(const FormControlState&) OVERRIDE; virtual bool shouldUseInputMethod() const OVERRIDE; diff --git a/Source/WebCore/html/RadioNodeList.cpp b/Source/WebCore/html/RadioNodeList.cpp index 15efb5155..bd3cc87b5 100644 --- a/Source/WebCore/html/RadioNodeList.cpp +++ b/Source/WebCore/html/RadioNodeList.cpp @@ -38,16 +38,14 @@ namespace WebCore { using namespace HTMLNames; RadioNodeList::RadioNodeList(Node* rootNode, const AtomicString& name) - : DynamicSubtreeNodeList(rootNode, rootNode->hasTagName(formTag) ? RootedAtDocument : RootedAtNode) + : DynamicSubtreeNodeList(rootNode, InvalidateForFormControls, rootNode->hasTagName(formTag) ? NodeListIsRootedAtDocument : NodeListIsRootedAtNode) , m_name(name) { - document()->registerDynamicSubtreeNodeList(this); } RadioNodeList::~RadioNodeList() { ownerNode()->nodeLists()->removeCacheWithAtomicName(this, DynamicNodeList::RadioNodeListType, m_name); - document()->unregisterDynamicSubtreeNodeList(this); } static inline HTMLInputElement* toRadioButtonInputElement(Node* node) diff --git a/Source/WebCore/html/StepRange.cpp b/Source/WebCore/html/StepRange.cpp index c7c88fcf9..4d0042f24 100644 --- a/Source/WebCore/html/StepRange.cpp +++ b/Source/WebCore/html/StepRange.cpp @@ -69,7 +69,7 @@ Decimal StepRange::acceptableError() const { // FIXME: We should use DBL_MANT_DIG instead of FLT_MANT_DIG regarding to HTML5 specification. DEFINE_STATIC_LOCAL(const Decimal, twoPowerOfFloatMantissaBits, (Decimal::Positive, 0, UINT64_C(1) << FLT_MANT_DIG)); - return m_step / twoPowerOfFloatMantissaBits; + return m_stepDescription.stepValueShouldBe == StepValueShouldBeReal ? m_step / twoPowerOfFloatMantissaBits : Decimal(0); } Decimal StepRange::alignValueForStep(const Decimal& currentValue, const Decimal& newValue) const diff --git a/Source/WebCore/inspector/CodeGeneratorInspector.py b/Source/WebCore/inspector/CodeGeneratorInspector.py index 05d3f80c7..b3a5f4151 100755 --- a/Source/WebCore/inspector/CodeGeneratorInspector.py +++ b/Source/WebCore/inspector/CodeGeneratorInspector.py @@ -1791,7 +1791,7 @@ $methodInCode ${responseCook} } - sendResponse(callId, result, String::format("Some arguments of method '%s' can't be processed", "$domainName.$methodName"), protocolErrors, error); + sendResponse(callId, result, commandNames[$commandNameIndex], protocolErrors, error); } """) @@ -1886,6 +1886,8 @@ $virtualSetters enum MethodNames { $methodNamesEnumContent + + kMethodNamesEnumSize }; static const char* commandNames[]; @@ -1949,7 +1951,7 @@ $fieldDeclarations static PassRefPtr<InspectorObject> getObject(InspectorObject* object, const String& name, bool* valueFound, InspectorArray* protocolErrors); static PassRefPtr<InspectorArray> getArray(InspectorObject* object, const String& name, bool* valueFound, InspectorArray* protocolErrors); - void sendResponse(long callId, PassRefPtr<InspectorObject> result, const String& errorMessage, PassRefPtr<InspectorArray> protocolErrors, ErrorString invocationError); + void sendResponse(long callId, PassRefPtr<InspectorObject> result, const char* commandName, PassRefPtr<InspectorArray> protocolErrors, ErrorString invocationError); }; @@ -1973,7 +1975,7 @@ void InspectorBackendDispatcherImpl::dispatch(const String& message) static CallHandler handlers[] = { $messageHandlers }; - size_t length = sizeof(commandNames) / sizeof(commandNames[0]); + size_t length = WTF_ARRAY_LENGTH(commandNames); for (size_t i = 0; i < length; ++i) dispatchMap.add(commandNames[i], handlers[i]); } @@ -2022,9 +2024,10 @@ $messageHandlers ((*this).*it->second)(callId, messageObject.get()); } -void InspectorBackendDispatcherImpl::sendResponse(long callId, PassRefPtr<InspectorObject> result, const String& errorMessage, PassRefPtr<InspectorArray> protocolErrors, ErrorString invocationError) +void InspectorBackendDispatcherImpl::sendResponse(long callId, PassRefPtr<InspectorObject> result, const char* commandName, PassRefPtr<InspectorArray> protocolErrors, ErrorString invocationError) { if (protocolErrors->length()) { + String errorMessage = String::format("Some arguments of method '%s' can't be processed", commandName); reportProtocolError(&callId, InvalidParams, errorMessage, protocolErrors); return; } @@ -2165,6 +2168,7 @@ bool InspectorBackendDispatcher::getCommandName(const String& message, String* r return true; } +COMPILE_ASSERT(static_cast<int>(InspectorBackendDispatcher::kMethodNamesEnumSize) == WTF_ARRAY_LENGTH(InspectorBackendDispatcher::commandNames), command_name_array_problem); } // namespace WebCore @@ -2684,7 +2688,9 @@ class Generator: def process_command(json_command, domain_name, agent_field_name, agent_interface_name): json_command_name = json_command["name"] - Generator.method_name_enum_list.append(" k%s_%sCmd," % (domain_name, json_command["name"])) + cmd_enum_name = "k%s_%sCmd" % (domain_name, json_command["name"]) + + Generator.method_name_enum_list.append(" %s," % cmd_enum_name) Generator.method_handler_list.append(" &InspectorBackendDispatcherImpl::%s_%s," % (domain_name, json_command_name)) Generator.backend_method_declaration_list.append(" void %s_%s(long callId, InspectorObject* requestMessageObject);" % (domain_name, json_command_name)) @@ -2813,7 +2819,8 @@ class Generator: methodOutCode=method_out_code, agentCallParams=join(agent_call_param_list, ""), requestMessageObject=request_message_param, - responseCook=response_cook_text)) + responseCook=response_cook_text, + commandNameIndex=cmd_enum_name)) Generator.backend_method_name_declaration_list.append(" \"%s.%s\"," % (domain_name, json_command_name)) Generator.backend_js_domain_initializer_list.append("InspectorBackend.registerCommand(\"%s.%s\", [%s], %s);\n" % (domain_name, json_command_name, js_parameters_text, js_reply_list)) diff --git a/Source/WebCore/inspector/DOMPatchSupport.cpp b/Source/WebCore/inspector/DOMPatchSupport.cpp index 2f22151b2..775c464ec 100644 --- a/Source/WebCore/inspector/DOMPatchSupport.cpp +++ b/Source/WebCore/inspector/DOMPatchSupport.cpp @@ -35,7 +35,6 @@ #include "DOMPatchSupport.h" #include "Attribute.h" -#include "Base64.h" #include "ContextFeatures.h" #include "DOMEditor.h" #include "Document.h" @@ -52,6 +51,7 @@ #include <wtf/HashTraits.h> #include <wtf/RefPtr.h> #include <wtf/SHA1.h> +#include <wtf/text/Base64.h> #include <wtf/text/CString.h> using namespace std; diff --git a/Source/WebCore/inspector/Inspector.json b/Source/WebCore/inspector/Inspector.json index 83f83194e..d178d9d2d 100644 --- a/Source/WebCore/inspector/Inspector.json +++ b/Source/WebCore/inspector/Inspector.json @@ -364,20 +364,6 @@ "parameters": [ { "name": "value", "type": "boolean", "description": "Whether script execution should be disabled in the page." } ] - }, - { - "name": "setGeolocationData", - "description": "overrides the GeolocationPosition or GeolocationError in the GeolocationController.", - "parameters": [ - { "name": "longitude", "type": "number", "optional": true, "description": "Mock longitude"}, - { "name": "latitude", "type": "number", "optional": true, "description": "Mock latitude"}, - { "name": "accuracy", "type": "number", "optional": true, "description": "Mock accuracy"}, - { "name": "errorType", "type": "string", "optional": true, "enum": ["PermissionDenied", "PositionUnavailable"], "description": "Error type"} - ] - }, - { - "name": "clearGeolocationData", - "description": "clears the overriden GeolocationPosition and GeolocationError." } ], "events": [ diff --git a/Source/WebCore/inspector/InspectorFileSystemAgent.cpp b/Source/WebCore/inspector/InspectorFileSystemAgent.cpp index f97abbf96..1b7df9580 100644 --- a/Source/WebCore/inspector/InspectorFileSystemAgent.cpp +++ b/Source/WebCore/inspector/InspectorFileSystemAgent.cpp @@ -34,7 +34,6 @@ #include "InspectorFileSystemAgent.h" -#include "Base64.h" #include "DOMFileSystem.h" #include "DOMImplementation.h" #include "DirectoryEntry.h" @@ -44,6 +43,7 @@ #include "EntryArray.h" #include "EntryCallback.h" #include "ErrorCallback.h" +#include "File.h" #include "FileCallback.h" #include "FileEntry.h" #include "FileError.h" @@ -63,6 +63,7 @@ #include "SecurityOrigin.h" #include "TextEncoding.h" #include "TextResourceDecoder.h" +#include <wtf/text/Base64.h> using WebCore::TypeBuilder::Array; diff --git a/Source/WebCore/inspector/InspectorIndexedDBAgent.cpp b/Source/WebCore/inspector/InspectorIndexedDBAgent.cpp index 6107eb982..0fdaca6e2 100644 --- a/Source/WebCore/inspector/InspectorIndexedDBAgent.cpp +++ b/Source/WebCore/inspector/InspectorIndexedDBAgent.cpp @@ -186,7 +186,7 @@ private: class ExecutableWithDatabase : public RefCounted<ExecutableWithDatabase> { public: virtual ~ExecutableWithDatabase() { }; - void start(IDBFactoryBackendInterface*, SecurityOrigin*, Frame*, const String& databaseName); + void start(IDBFactoryBackendInterface*, SecurityOrigin*, ScriptExecutionContext*, const String& databaseName); virtual void execute(PassRefPtr<IDBDatabaseBackendInterface>) = 0; }; @@ -233,10 +233,10 @@ private: RefPtr<ExecutableWithDatabase> m_executableWithDatabase; }; -void ExecutableWithDatabase::start(IDBFactoryBackendInterface* idbFactory, SecurityOrigin* securityOrigin, Frame* frame, const String& databaseName) +void ExecutableWithDatabase::start(IDBFactoryBackendInterface* idbFactory, SecurityOrigin* securityOrigin, ScriptExecutionContext* context, const String& databaseName) { RefPtr<OpenDatabaseCallback> callback = OpenDatabaseCallback::create(this); - idbFactory->open(databaseName, callback.get(), securityOrigin, frame, String()); + idbFactory->open(databaseName, callback.get(), securityOrigin, context, String()); } static PassRefPtr<IDBTransactionBackendInterface> transactionForDatabase(IDBDatabaseBackendInterface* idbDatabase, const String& objectStoreName) @@ -732,7 +732,7 @@ void InspectorIndexedDBAgent::requestDatabaseNamesForFrame(ErrorString* errorStr RefPtr<GetDatabaseNamesCallback> callback = GetDatabaseNamesCallback::create(m_frontendProvider.get(), requestId, document->securityOrigin()->toString()); GroupSettings* groupSettings = document->page()->group().groupSettings(); - idbFactory->getDatabaseNames(callback.get(), document->securityOrigin(), document->frame(), groupSettings->indexedDBDatabasePath()); + idbFactory->getDatabaseNames(callback.get(), document->securityOrigin(), document, groupSettings->indexedDBDatabasePath()); } void InspectorIndexedDBAgent::requestDatabase(ErrorString* errorString, int requestId, const String& frameId, const String& databaseName) @@ -745,7 +745,7 @@ void InspectorIndexedDBAgent::requestDatabase(ErrorString* errorString, int requ return; RefPtr<DatabaseLoaderCallback> databaseLoaderCallback = DatabaseLoaderCallback::create(m_frontendProvider.get(), requestId); - databaseLoaderCallback->start(idbFactory, document->securityOrigin(), document->frame(), databaseName); + databaseLoaderCallback->start(idbFactory, document->securityOrigin(), document, databaseName); } void InspectorIndexedDBAgent::requestData(ErrorString* errorString, int requestId, const String& frameId, const String& databaseName, const String& objectStoreName, const String& indexName, int skipCount, int pageSize, const RefPtr<InspectorObject>* keyRange) @@ -769,7 +769,7 @@ void InspectorIndexedDBAgent::requestData(ErrorString* errorString, int requestI } RefPtr<DataLoaderCallback> dataLoaderCallback = DataLoaderCallback::create(m_frontendProvider, requestId, injectedScript, objectStoreName, indexName, idbKeyRange, skipCount, pageSize); - dataLoaderCallback->start(idbFactory, document->securityOrigin(), document->frame(), databaseName); + dataLoaderCallback->start(idbFactory, document->securityOrigin(), document, databaseName); } } // namespace WebCore diff --git a/Source/WebCore/inspector/InspectorInstrumentation.cpp b/Source/WebCore/inspector/InspectorInstrumentation.cpp index dadd599c6..325a4c48f 100644 --- a/Source/WebCore/inspector/InspectorInstrumentation.cpp +++ b/Source/WebCore/inspector/InspectorInstrumentation.cpp @@ -1186,19 +1186,6 @@ InstrumentingAgents* InspectorInstrumentation::instrumentingAgentsForNonDocument } #endif -#if ENABLE(GEOLOCATION) -GeolocationPosition* InspectorInstrumentation::checkGeolocationPositionOrErrorImpl(InstrumentingAgents* instrumentingAgents, GeolocationPosition* position) -{ - if (InspectorPageAgent* pageAgent = instrumentingAgents->inspectorPageAgent()) { - if (pageAgent->sendGeolocationError()) - return 0; - if (pageAgent->geolocationPosition()) - position = pageAgent->geolocationPosition(); - } - return position; -} -#endif - } // namespace WebCore #endif // !ENABLE(INSPECTOR) diff --git a/Source/WebCore/inspector/InspectorInstrumentation.h b/Source/WebCore/inspector/InspectorInstrumentation.h index 16fd159b1..4350e9ccd 100644 --- a/Source/WebCore/inspector/InspectorInstrumentation.h +++ b/Source/WebCore/inspector/InspectorInstrumentation.h @@ -56,7 +56,6 @@ class Database; class Element; class EventContext; class DocumentLoader; -class GeolocationPosition; class GraphicsContext; class HitTestResult; class InspectorCSSAgent; @@ -261,10 +260,6 @@ public: static bool collectingHTMLParseErrors(Page*) { return false; } #endif -#if ENABLE(GEOLOCATION) - static GeolocationPosition* checkGeolocationPositionOrError(Page*, GeolocationPosition*); -#endif - private: #if ENABLE(INSPECTOR) static WTF::ThreadSpecific<InspectorTimelineAgent*>& threadSpecificTimelineAgentForOrphanEvents(); @@ -426,10 +421,6 @@ private: static void cancelPauseOnNativeEvent(InstrumentingAgents*); static InspectorTimelineAgent* retrieveTimelineAgent(const InspectorInstrumentationCookie&); -#if ENABLE(GEOLOCATION) - static GeolocationPosition* checkGeolocationPositionOrErrorImpl(InstrumentingAgents*, GeolocationPosition*); -#endif - static int s_frontendCounter; #endif }; @@ -1395,19 +1386,6 @@ inline void InspectorInstrumentation::didFireAnimationFrame(const InspectorInstr #endif } - -#if ENABLE(GEOLOCATION) -inline GeolocationPosition* InspectorInstrumentation::checkGeolocationPositionOrError(Page* page, GeolocationPosition* position) -{ -#if ENABLE(INSPECTOR) - FAST_RETURN_IF_NO_FRONTENDS(position); - if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(page)) - return checkGeolocationPositionOrErrorImpl(instrumentingAgents, position); -#endif - return position; -} -#endif - #if ENABLE(INSPECTOR) inline bool InspectorInstrumentation::collectingHTMLParseErrors(Page* page) { diff --git a/Source/WebCore/inspector/InspectorMemoryAgent.cpp b/Source/WebCore/inspector/InspectorMemoryAgent.cpp index ff01ffbf9..5b3e3662d 100644 --- a/Source/WebCore/inspector/InspectorMemoryAgent.cpp +++ b/Source/WebCore/inspector/InspectorMemoryAgent.cpp @@ -548,6 +548,7 @@ public: void visitBindings() { ScriptProfiler::collectBindingMemoryInfo(&m_domMemoryUsage); + m_domMemoryUsage.processDeferredInstrumentedPointers(); } PassRefPtr<InspectorMemoryBlock> dumpStatistics(InspectorDataCounter* inspectorData) diff --git a/Source/WebCore/inspector/InspectorPageAgent.cpp b/Source/WebCore/inspector/InspectorPageAgent.cpp index aed08419d..ef34537f0 100644 --- a/Source/WebCore/inspector/InspectorPageAgent.cpp +++ b/Source/WebCore/inspector/InspectorPageAgent.cpp @@ -34,7 +34,6 @@ #include "InspectorPageAgent.h" -#include "Base64.h" #include "CachedCSSStyleSheet.h" #include "CachedFont.h" #include "CachedImage.h" @@ -51,9 +50,6 @@ #include "DocumentLoader.h" #include "Frame.h" #include "FrameView.h" -#include "GeolocationController.h" -#include "GeolocationError.h" -#include "GeolocationPosition.h" #include "HTMLFrameOwnerElement.h" #include "HTMLNames.h" #include "IdentifiersFactory.h" @@ -79,6 +75,7 @@ #include <wtf/CurrentTime.h> #include <wtf/ListHashSet.h> #include <wtf/Vector.h> +#include <wtf/text/Base64.h> using namespace std; @@ -321,8 +318,6 @@ InspectorPageAgent::InspectorPageAgent(InstrumentingAgents* instrumentingAgents, , m_lastScriptIdentifier(0) , m_lastPaintContext(0) , m_didLoadEventFire(false) - , m_geolocationError() - , m_geolocationPosition() { } @@ -972,52 +967,6 @@ void InspectorPageAgent::updateViewMetrics(int width, int height, double fontSca InspectorInstrumentation::mediaQueryResultChanged(document); } -void InspectorPageAgent::setGeolocationData(ErrorString*, const double* longitude, const double* latitude, const double* accuracy, const String* errorType) -{ -#if ENABLE (GEOLOCATION) - GeolocationController* controller = GeolocationController::from(m_page); - if (!controller) - return; - - clearGeolocationData(0); - - if (*errorType == "PermissionDenied") - m_geolocationError = GeolocationError::create(GeolocationError::PermissionDenied, *errorType).leakRef(); - else if (*errorType == "PositionUnavailable") - m_geolocationError = GeolocationError::create(GeolocationError::PositionUnavailable, *errorType).leakRef(); - - if (m_geolocationError.get()) { - controller->errorOccurred(m_geolocationError.get()); - return; - } - - m_geolocationPosition = GeolocationPosition::create(currentTimeMS(), *longitude, *latitude, *accuracy).leakRef(); - controller->positionChanged(m_geolocationPosition.get()); -#endif -} - -void InspectorPageAgent::clearGeolocationData(ErrorString*) -{ -#if ENABLE(GEOLOCATION) - m_geolocationError.clear(); - m_geolocationPosition.clear(); -#endif -} - -bool InspectorPageAgent::sendGeolocationError() -{ -#if ENABLE(GEOLOCATION) - if (m_geolocationError.get()) { - GeolocationController* controller = GeolocationController::from(m_page); - if (controller) { - controller->errorOccurred(m_geolocationError.get()); - return true; - } - } -#endif - return false; -} - } // namespace WebCore #endif // ENABLE(INSPECTOR) diff --git a/Source/WebCore/inspector/InspectorPageAgent.h b/Source/WebCore/inspector/InspectorPageAgent.h index c2f84f43d..964bc85fc 100644 --- a/Source/WebCore/inspector/InspectorPageAgent.h +++ b/Source/WebCore/inspector/InspectorPageAgent.h @@ -34,8 +34,6 @@ #if ENABLE(INSPECTOR) #include "Frame.h" -#include "GeolocationError.h" -#include "GeolocationPosition.h" #include "InspectorBaseAgent.h" #include "InspectorFrontend.h" #include "PlatformString.h" @@ -110,12 +108,6 @@ public: virtual void setShowPaintRects(ErrorString*, bool show); virtual void getScriptExecutionStatus(ErrorString*, PageCommandHandler::Result::Enum*); virtual void setScriptExecutionDisabled(ErrorString*, bool); - virtual void setGeolocationData(ErrorString*, const double*, const double*, const double*, const String*); - virtual void clearGeolocationData(ErrorString*); - - // Geolocation override helpers. - bool sendGeolocationError(); - GeolocationPosition* geolocationPosition() const {return m_geolocationPosition.get();} // InspectorInstrumentation API void didClearWindowObjectInWorld(Frame*, DOMWrapperWorld*); @@ -164,8 +156,6 @@ private: GraphicsContext* m_lastPaintContext; LayoutRect m_lastPaintRect; bool m_didLoadEventFire; - RefPtr<GeolocationError> m_geolocationError; - RefPtr<GeolocationPosition> m_geolocationPosition; }; diff --git a/Source/WebCore/inspector/front-end/CSSStyleModel.js b/Source/WebCore/inspector/front-end/CSSStyleModel.js index 1bccada70..aaf792a12 100644 --- a/Source/WebCore/inspector/front-end/CSSStyleModel.js +++ b/Source/WebCore/inspector/front-end/CSSStyleModel.js @@ -1079,12 +1079,13 @@ WebInspector.CSSStyleModelResourceBinding.prototype = { return; var styleSheetURL = header.origin === "inspector" ? this._viaInspectorResourceURL(header.sourceURL) : header.sourceURL; - var resource = frame.resourceForURL(styleSheetURL); - if (!resource) + + var uiSourceCode = WebInspector.workspace.uiSourceCodeForURL(styleSheetURL); + if (!uiSourceCode) return; - if (resource.type === WebInspector.resourceTypes.Stylesheet) - resource.addRevision(content); + if (uiSourceCode.contentType() === WebInspector.resourceTypes.Stylesheet) + uiSourceCode.addRevision(content); } if (!this._styleSheetIdToHeader[styleSheetId]) { diff --git a/Source/WebCore/inspector/front-end/ConsolePanel.js b/Source/WebCore/inspector/front-end/ConsolePanel.js index 62157d26b..fc3b85317 100644 --- a/Source/WebCore/inspector/front-end/ConsolePanel.js +++ b/Source/WebCore/inspector/front-end/ConsolePanel.js @@ -127,6 +127,7 @@ WebInspector.ConsolePanel.prototype = { { this._clearCurrentSearchResultHighlight(); this._currentSearchResultIndex = index; + WebInspector.searchController.updateCurrentMatchIndex(this._currentSearchResultIndex, this); this._searchResults[index].highlightSearchResults(this._searchRegex); }, diff --git a/Source/WebCore/inspector/front-end/ConsoleView.js b/Source/WebCore/inspector/front-end/ConsoleView.js index 4dfed1a83..02e69bb10 100644 --- a/Source/WebCore/inspector/front-end/ConsoleView.js +++ b/Source/WebCore/inspector/front-end/ConsoleView.js @@ -44,18 +44,12 @@ WebInspector.ConsoleView = function(hideContextSelector) this._clearConsoleButton = new WebInspector.StatusBarButton(WebInspector.UIString("Clear console log."), "clear-status-bar-item"); this._clearConsoleButton.addEventListener("click", this._requestClearMessages, this); - this._contextSelectElement = document.createElement("select"); - this._contextSelectElement.id = "console-context"; - this._contextSelectElement.className = "status-bar-item"; - this._contextSelectElement.addEventListener("change", this._updateIsolatedWorldSelector.bind(this), false); - - this._isolatedWorldSelectElement = document.createElement("select"); - this._isolatedWorldSelectElement.id = "console-context"; - this._isolatedWorldSelectElement.className = "status-bar-item"; + this._contextSelector = new WebInspector.StatusBarComboBox(this._updateIsolatedWorldSelector.bind(this), "console-context"); + this._isolatedWorldSelector = new WebInspector.StatusBarComboBox(null, "console-context"); if (hideContextSelector) { - this._contextSelectElement.addStyleClass("hidden"); - this._isolatedWorldSelectElement.addStyleClass("hidden"); + this._contextSelector.element.addStyleClass("hidden"); + this._isolatedWorldSelector.element.addStyleClass("hidden"); } this.messagesElement = document.createElement("div"); @@ -77,7 +71,6 @@ WebInspector.ConsoleView = function(hideContextSelector) this.currentGroup = this.topGroup; this._filterBarElement = document.createElement("div"); - this._filterBarElement.id = "console-filter"; this._filterBarElement.className = "scope-bar status-bar-item"; function createDividerElement() { @@ -134,7 +127,7 @@ WebInspector.ConsoleView.Events = { WebInspector.ConsoleView.prototype = { get statusBarItems() { - return [this._clearConsoleButton.element, this._contextSelectElement, this._isolatedWorldSelectElement, this._filterBarElement]; + return [this._clearConsoleButton.element, this._contextSelector.element, this._isolatedWorldSelector.element, this._filterBarElement]; }, addContext: function(context) @@ -144,7 +137,7 @@ WebInspector.ConsoleView.prototype = { option.title = context.url; option._context = context; context._consoleOption = option; - this._contextSelectElement.appendChild(option); + this._contextSelector.addOption(option); context.addEventListener(WebInspector.FrameEvaluationContext.EventTypes.Updated, this._contextUpdated, this); context.addEventListener(WebInspector.FrameEvaluationContext.EventTypes.AddedExecutionContext, this._addedExecutionContext, this); this._updateIsolatedWorldSelector(); @@ -152,7 +145,7 @@ WebInspector.ConsoleView.prototype = { removeContext: function(context) { - this._contextSelectElement.removeChild(context._consoleOption); + this._contextSelector.removeOption(context._consoleOption); this._updateIsolatedWorldSelector(); }, @@ -160,17 +153,17 @@ WebInspector.ConsoleView.prototype = { { var context = this._currentEvaluationContext(); if (!context) { - this._isolatedWorldSelectElement.addStyleClass("hidden"); + this._isolatedWorldSelector.element.addStyleClass("hidden"); return; } var isolatedContexts = context.isolatedContexts(); if (!isolatedContexts.length) { - this._isolatedWorldSelectElement.addStyleClass("hidden"); + this._isolatedWorldSelector.element.addStyleClass("hidden"); return; } - this._isolatedWorldSelectElement.removeStyleClass("hidden"); - this._isolatedWorldSelectElement.removeChildren(); + this._isolatedWorldSelector.element.removeStyleClass("hidden"); + this._isolatedWorldSelector.removeOptions(); this._appendIsolatedContextOption(context.mainWorldContext()); for (var i = 0; i < isolatedContexts.length; i++) this._appendIsolatedContextOption(isolatedContexts[i]); @@ -184,7 +177,7 @@ WebInspector.ConsoleView.prototype = { option.text = isolatedContext.name; option.title = isolatedContext.id; option._executionContextId = isolatedContext.id; - this._isolatedWorldSelectElement.appendChild(option); + this._isolatedWorldSelector.addOption(option); }, _contextUpdated: function(event) @@ -215,18 +208,20 @@ WebInspector.ConsoleView.prototype = { _currentEvaluationContext: function() { - if (this._contextSelectElement.selectedIndex === -1) + var option = this._contextSelector.selectedOption(); + if (!option) return undefined; - return this._contextSelectElement[this._contextSelectElement.selectedIndex]._context; + return option._context; }, _currentIsolatedContextId: function() { - if (this._isolatedWorldSelectElement.hasStyleClass("hidden")) + if (this._isolatedWorldSelector.element.hasStyleClass("hidden")) return undefined; - if (this._isolatedWorldSelectElement.selectedIndex === -1) + var option = this._isolatedWorldSelector.selectedOption(); + if (!option) return undefined; - return this._isolatedWorldSelectElement[this._isolatedWorldSelectElement.selectedIndex]._executionContextId; + return option._executionContextId; }, _updateFilter: function(e) diff --git a/Source/WebCore/inspector/front-end/ExtensionServer.js b/Source/WebCore/inspector/front-end/ExtensionServer.js index b835fb9d3..ce0157f9f 100644 --- a/Source/WebCore/inspector/front-end/ExtensionServer.js +++ b/Source/WebCore/inspector/front-end/ExtensionServer.js @@ -582,9 +582,9 @@ WebInspector.ExtensionServer.prototype = { this._notifyElementsSelectionChanged); } this._registerAutosubscriptionHandler(WebInspector.extensionAPI.Events.ResourceContentCommitted, - WebInspector.resourceTreeModel, - WebInspector.ResourceTreeModel.EventTypes.ResourceContentCommitted, - this._notifyResourceContentCommitted); + WebInspector.workspace, + WebInspector.Workspace.Events.UISourceCodeContentCommitted, + this._notifyUISourceCodeContentCommitted); function onTimelineSubscriptionStarted() { @@ -618,11 +618,11 @@ WebInspector.ExtensionServer.prototype = { this._postNotification(WebInspector.extensionAPI.Events.ResourceAdded, this._makeResource(uiSourceCode)); }, - _notifyResourceContentCommitted: function(event) + _notifyUISourceCodeContentCommitted: function(event) { - var resource = /** @type {WebInspector.Resource} */ event.data.resource; - var contentProvider = resource.uiSourceCode() || resource; - this._postNotification(WebInspector.extensionAPI.Events.ResourceContentCommitted, this._makeResource(contentProvider), event.data.content); + var uiSourceCode = /** @type {WebInspector.UISourceCode} */ event.data.uiSourceCode; + var content = /** @type {string} */ event.data.content; + this._postNotification(WebInspector.extensionAPI.Events.ResourceContentCommitted, this._makeResource(uiSourceCode), content); }, _notifyRequestFinished: function(event) diff --git a/Source/WebCore/inspector/front-end/Images/statusbarBackground.png b/Source/WebCore/inspector/front-end/Images/statusbarBackground.png Binary files differdeleted file mode 100644 index b466a49cd..000000000 --- a/Source/WebCore/inspector/front-end/Images/statusbarBackground.png +++ /dev/null diff --git a/Source/WebCore/inspector/front-end/Images/statusbarBottomBackground.png b/Source/WebCore/inspector/front-end/Images/statusbarBottomBackground.png Binary files differdeleted file mode 100644 index fb5c9e483..000000000 --- a/Source/WebCore/inspector/front-end/Images/statusbarBottomBackground.png +++ /dev/null diff --git a/Source/WebCore/inspector/front-end/Images/statusbarButtons.png b/Source/WebCore/inspector/front-end/Images/statusbarButtons.png Binary files differdeleted file mode 100644 index 163d7b5f4..000000000 --- a/Source/WebCore/inspector/front-end/Images/statusbarButtons.png +++ /dev/null diff --git a/Source/WebCore/inspector/front-end/Images/statusbarMenuButton.png b/Source/WebCore/inspector/front-end/Images/statusbarMenuButton.png Binary files differdeleted file mode 100644 index 8904217b0..000000000 --- a/Source/WebCore/inspector/front-end/Images/statusbarMenuButton.png +++ /dev/null diff --git a/Source/WebCore/inspector/front-end/Images/statusbarMenuButtonSelected.png b/Source/WebCore/inspector/front-end/Images/statusbarMenuButtonSelected.png Binary files differdeleted file mode 100644 index 74fe953fa..000000000 --- a/Source/WebCore/inspector/front-end/Images/statusbarMenuButtonSelected.png +++ /dev/null diff --git a/Source/WebCore/inspector/front-end/NetworkPanel.js b/Source/WebCore/inspector/front-end/NetworkPanel.js index 67364ad3a..4d2c9ea3c 100644 --- a/Source/WebCore/inspector/front-end/NetworkPanel.js +++ b/Source/WebCore/inspector/front-end/NetworkPanel.js @@ -322,7 +322,6 @@ WebInspector.NetworkLogView.prototype = { { var filterBarElement = document.createElement("div"); filterBarElement.className = "scope-bar status-bar-item"; - filterBarElement.id = "network-filter"; /** * @param {string} typeName diff --git a/Source/WebCore/inspector/front-end/ProfilesPanel.js b/Source/WebCore/inspector/front-end/ProfilesPanel.js index 18131c1c4..476a2d152 100644 --- a/Source/WebCore/inspector/front-end/ProfilesPanel.js +++ b/Source/WebCore/inspector/front-end/ProfilesPanel.js @@ -752,6 +752,7 @@ WebInspector.ProfilesPanel.prototype = { function updateMatchesCount() { WebInspector.searchController.updateSearchMatchesCount(this._totalSearchMatches, this); + WebInspector.searchController.updateCurrentMatchIndex(this._currentSearchResultIndex, this); matchesCountUpdateTimeout = null; } @@ -833,6 +834,8 @@ WebInspector.ProfilesPanel.prototype = { showFirstResult = true; } + WebInspector.searchController.updateCurrentMatchIndex(this._currentSearchResultIndex, this); + if (currentView !== this.visibleView) { this.showView(currentView); WebInspector.searchController.focusSearchField(); @@ -866,6 +869,8 @@ WebInspector.ProfilesPanel.prototype = { showLastResult = true; } + WebInspector.searchController.updateCurrentMatchIndex(this._currentSearchResultIndex, this); + if (currentView !== this.visibleView) { this.showView(currentView); WebInspector.searchController.focusSearchField(); diff --git a/Source/WebCore/inspector/front-end/Resource.js b/Source/WebCore/inspector/front-end/Resource.js index 9a5f91468..8329a0b7a 100644 --- a/Source/WebCore/inspector/front-end/Resource.js +++ b/Source/WebCore/inspector/front-end/Resource.js @@ -48,7 +48,6 @@ WebInspector.Resource = function(request, url, documentURL, frameId, loaderId, t this._loaderId = loaderId; this._type = type || WebInspector.resourceTypes.Other; this._mimeType = mimeType; - this.history = []; this._isHidden = isHidden; /** @type {?string} */ this._content; @@ -56,12 +55,9 @@ WebInspector.Resource = function(request, url, documentURL, frameId, loaderId, t this._pendingContentCallbacks = []; if (this._request && !this._request.finished) this._request.addEventListener(WebInspector.NetworkRequest.Events.FinishedLoading, this._requestFinished, this); - - this._restoreRevisionHistory(); } WebInspector.Resource.Events = { - RevisionAdded: "revision-added", MessageAdded: "message-added", MessagesCleared: "messages-cleared", } @@ -215,65 +211,6 @@ WebInspector.Resource.prototype = { }, /** - * @param {string} newContent - * @param {function(String)=} callback - */ - _setContent: function(newContent, callback) - { - var uiSourceCode = this._uiSourceCode; - if (!this._uiSourceCode || !this._uiSourceCode.isEditable()) - return; - this._uiSourceCode.setWorkingCopy(newContent); - this._uiSourceCode.commitWorkingCopy(callback); - }, - - /** - * @param {string} content - * @param {Date=} timestamp - * @param {boolean=} restoringHistory - */ - addRevision: function(content, timestamp, restoringHistory) - { - if (this.history.length) { - var lastRevision = this.history[this.history.length - 1]; - if (lastRevision._content === content) - return; - } - var revision = new WebInspector.Revision(this, content, timestamp || new Date()); - this.history.push(revision); - - this.dispatchEventToListeners(WebInspector.Resource.Events.RevisionAdded, revision); - if (!restoringHistory) - revision._persist(); - WebInspector.resourceTreeModel.dispatchEventToListeners(WebInspector.ResourceTreeModel.EventTypes.ResourceContentCommitted, { resource: this, content: content }); - }, - - _restoreRevisionHistory: function() - { - if (!window.localStorage) - return; - - WebInspector.Revision._ensureStaleRevisionsFileteredOut(); - var registry = WebInspector.Revision._revisionHistoryRegistry(); - var historyItems = registry[this.url]; - for (var i = 0; historyItems && i < historyItems.length; ++i) - this.addRevision(window.localStorage[historyItems[i].key], new Date(historyItems[i].timestamp), true); - }, - - _clearRevisionHistory: function() - { - if (!window.localStorage) - return; - - var registry = WebInspector.Revision._revisionHistoryRegistry(); - var historyItems = registry[this.url]; - for (var i = 0; historyItems && i < historyItems.length; ++i) - delete window.localStorage[historyItems[i].key]; - delete registry[this.url]; - window.localStorage["revision-history"] = JSON.stringify(registry); - }, - - /** * @return {?string} */ contentURL: function() @@ -391,222 +328,14 @@ WebInspector.Resource.prototype = { PageAgent.getResourceContent(this.frameId, this.url, callback.bind(this)); }, - revertToOriginal: function() - { - function revert(content) - { - this._setContent(content, function() {}); - } - this.requestContent(revert.bind(this)); - }, - - revertAndClearHistory: function(callback) - { - function revert(content) - { - this._setContent(content, clearHistory.bind(this)); - } - - function clearHistory() - { - this._clearRevisionHistory(); - this.history = []; - callback(); - } - - this.requestContent(revert.bind(this)); - }, - /** * @return {boolean} */ isHidden: function() { - return !!this._isHidden; - }, - - /** - * @return {WebInspector.UISourceCode} - */ - uiSourceCode: function() - { - return this._uiSourceCode; - }, - - /** - * @param {WebInspector.UISourceCode} uiSourceCode - */ - setUISourceCode: function(uiSourceCode) - { - this._uiSourceCode = uiSourceCode; + return !!this._isHidden; } } WebInspector.Resource.prototype.__proto__ = WebInspector.Object.prototype; -/** - * @constructor - * @implements {WebInspector.ContentProvider} - * @param {WebInspector.Resource} resource - * @param {?string|undefined} content - * @param {Date} timestamp - */ -WebInspector.Revision = function(resource, content, timestamp) -{ - this._resource = resource; - this._content = content; - this._timestamp = timestamp; -} - -WebInspector.Revision._revisionHistoryRegistry = function() -{ - if (!WebInspector.Revision._revisionHistoryRegistryObject) { - if (window.localStorage) { - var revisionHistory = window.localStorage["revision-history"]; - try { - WebInspector.Revision._revisionHistoryRegistryObject = revisionHistory ? JSON.parse(revisionHistory) : {}; - } catch (e) { - WebInspector.Revision._revisionHistoryRegistryObject = {}; - } - } else - WebInspector.Revision._revisionHistoryRegistryObject = {}; - } - return WebInspector.Revision._revisionHistoryRegistryObject; -} - -WebInspector.Revision._ensureStaleRevisionsFileteredOut = function() -{ - if (!window.localStorage) - return; - - if (WebInspector.Revision._staleRevisionsFilteredOut) - return; - WebInspector.Revision._staleRevisionsFilteredOut = true; - - var registry = WebInspector.Revision._revisionHistoryRegistry(); - var filteredRegistry = {}; - for (var url in registry) { - var historyItems = registry[url]; - var filteredHistoryItems = []; - for (var i = 0; historyItems && i < historyItems.length; ++i) { - var historyItem = historyItems[i]; - if (historyItem.loaderId === WebInspector.resourceTreeModel.mainFrame.loaderId) { - filteredHistoryItems.push(historyItem); - filteredRegistry[url] = filteredHistoryItems; - } else - delete window.localStorage[historyItem.key]; - } - } - WebInspector.Revision._revisionHistoryRegistryObject = filteredRegistry; - - function persist() - { - window.localStorage["revision-history"] = JSON.stringify(filteredRegistry); - } - - // Schedule async storage. - setTimeout(persist, 0); -} - -WebInspector.Revision.prototype = { - /** - * @return {WebInspector.Resource} - */ - get resource() - { - return this._resource; - }, - - /** - * @return {Date} - */ - get timestamp() - { - return this._timestamp; - }, - - /** - * @return {?string} - */ - get content() - { - return this._content || null; - }, - - revertToThis: function() - { - function revert(content) - { - if (this._resource._content !== content) - this._resource._setContent(content, function() {}); - } - this.requestContent(revert.bind(this)); - }, - - /** - * @return {?string} - */ - contentURL: function() - { - return this._resource.url; - }, - - /** - * @return {WebInspector.ResourceType} - */ - contentType: function() - { - return this._resource.contentType(); - }, - - /** - * @param {function(?string, boolean, string)} callback - */ - requestContent: function(callback) - { - callback(this._content || "", false, this.resource.mimeType); - }, - - /** - * @param {string} query - * @param {boolean} caseSensitive - * @param {boolean} isRegex - * @param {function(Array.<WebInspector.ContentProvider.SearchMatch>)} callback - */ - searchInContent: function(query, caseSensitive, isRegex, callback) - { - callback([]); - }, - - _persist: function() - { - if (!window.localStorage) - return; - - var url = this.contentURL(); - if (url.startsWith("inspector://")) - return; - - var loaderId = WebInspector.resourceTreeModel.mainFrame.loaderId; - var timestamp = this.timestamp.getTime(); - var key = "revision-history|" + url + "|" + loaderId + "|" + timestamp; - - var registry = WebInspector.Revision._revisionHistoryRegistry(); - - var historyItems = registry[url]; - if (!historyItems) { - historyItems = []; - registry[url] = historyItems; - } - historyItems.push({url: url, loaderId: loaderId, timestamp: timestamp, key: key}); - - function persist() - { - window.localStorage[key] = this._content; - window.localStorage["revision-history"] = JSON.stringify(registry); - } - - // Schedule async storage. - setTimeout(persist.bind(this), 0); - } -} diff --git a/Source/WebCore/inspector/front-end/ResourceTreeModel.js b/Source/WebCore/inspector/front-end/ResourceTreeModel.js index 96515861f..e0dfbabb1 100644 --- a/Source/WebCore/inspector/front-end/ResourceTreeModel.js +++ b/Source/WebCore/inspector/front-end/ResourceTreeModel.js @@ -60,7 +60,6 @@ WebInspector.ResourceTreeModel.EventTypes = { FrameDetached: "FrameDetached", MainFrameNavigated: "MainFrameNavigated", ResourceAdded: "ResourceAdded", - ResourceContentCommitted: "resource-content-committed", WillLoadCachedResources: "WillLoadCachedResources", CachedResourcesLoaded: "CachedResourcesLoaded", DOMContentLoaded: "DOMContentLoaded", diff --git a/Source/WebCore/inspector/front-end/ResourceView.js b/Source/WebCore/inspector/front-end/ResourceView.js index 1acef7f2e..ce50b4b6c 100644 --- a/Source/WebCore/inspector/front-end/ResourceView.js +++ b/Source/WebCore/inspector/front-end/ResourceView.js @@ -84,7 +84,6 @@ WebInspector.ResourceSourceFrame = function(resource) { this._resource = resource; WebInspector.SourceFrame.call(this, resource); - this._resource.addEventListener(WebInspector.Resource.Events.RevisionAdded, this._contentChanged, this); } WebInspector.ResourceSourceFrame.prototype = { @@ -93,11 +92,6 @@ WebInspector.ResourceSourceFrame.prototype = { return this._resource; }, - _contentChanged: function(event) - { - this.setContent(this._resource.content, false, this._resource.canonicalMimeType()); - }, - populateTextAreaContextMenu: function(contextMenu, lineNumber) { contextMenu.appendApplicableItems(this._resource); diff --git a/Source/WebCore/inspector/front-end/ResourcesPanel.js b/Source/WebCore/inspector/front-end/ResourcesPanel.js index ee5fc5033..7e928cf40 100644 --- a/Source/WebCore/inspector/front-end/ResourcesPanel.js +++ b/Source/WebCore/inspector/front-end/ResourcesPanel.js @@ -641,16 +641,6 @@ WebInspector.ResourcesPanel.prototype = { var regex = WebInspector.SourceFrame.createSearchRegex(query); var totalMatchesCount = 0; - function searchInEditedResource(treeElement) - { - var resource = treeElement.representedObject; - if (resource.history.length == 0) - return; - var matchesCount = countRegexMatches(regex, resource.content) - treeElement.searchMatchesFound(matchesCount); - totalMatchesCount += matchesCount; - } - function callback(error, result) { if (!error) { @@ -667,8 +657,6 @@ WebInspector.ResourcesPanel.prototype = { if (!resource) continue; - if (resource.history.length > 0) - continue; // Skip edited resources. this._findTreeElementForResource(resource).searchMatchesFound(searchResult.matchesCount); totalMatchesCount += searchResult.matchesCount; } @@ -681,7 +669,6 @@ WebInspector.ResourcesPanel.prototype = { this.jumpToNextSearchResult(); } - this._forAllResourceTreeElements(searchInEditedResource.bind(this)); PageAgent.searchInResources(regex.source, !regex.ignoreCase, true, callback.bind(this)); }, diff --git a/Source/WebCore/inspector/front-end/RevisionHistoryView.js b/Source/WebCore/inspector/front-end/RevisionHistoryView.js index fad2cb143..5e8890374 100644 --- a/Source/WebCore/inspector/front-end/RevisionHistoryView.js +++ b/Source/WebCore/inspector/front-end/RevisionHistoryView.js @@ -39,19 +39,25 @@ WebInspector.RevisionHistoryView = function() this.element.addStyleClass("revision-history-drawer"); this.element.addStyleClass("fill"); this.element.addStyleClass("outline-disclosure"); - this._resourceItems = new Map(); + this._uiSourceCodeItems = new Map(); var olElement = this.element.createChild("ol"); this._treeOutline = new TreeOutline(olElement); - function populateRevisions(resource) + /** + * @param {WebInspector.UISourceCode} uiSourceCode + */ + function populateRevisions(uiSourceCode) { - if (resource.history.length) - this._createResourceItem(resource); + if (uiSourceCode.history.length) + this._createUISourceCodeItem(uiSourceCode); } - WebInspector.resourceTreeModel.forAllResources(populateRevisions.bind(this)); - WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.ResourceContentCommitted, this._revisionAdded, this); + WebInspector.workspace.uiSourceCodes().forEach(populateRevisions.bind(this)); + WebInspector.workspace.addEventListener(WebInspector.Workspace.Events.UISourceCodeContentCommitted, this._revisionAdded, this); + WebInspector.workspace.addEventListener(WebInspector.UISourceCodeProvider.Events.UISourceCodeReplaced, this._uiSourceCodeReplaced, this); + WebInspector.workspace.addEventListener(WebInspector.UISourceCodeProvider.Events.UISourceCodeRemoved, this._uiSourceCodeRemoved, this); + WebInspector.workspace.addEventListener(WebInspector.Workspace.Events.WorkspaceReset, this._reset, this); this._statusElement = document.createElement("span"); this._statusElement.textContent = WebInspector.UIString("Local modifications"); @@ -67,105 +73,118 @@ WebInspector.RevisionHistoryView.showHistory = function(uiSourceCode) WebInspector.RevisionHistoryView._view = new WebInspector.RevisionHistoryView(); var view = WebInspector.RevisionHistoryView._view; WebInspector.showViewInDrawer(view._statusElement, view); - view._revealResource(uiSourceCode.resource()); -} - -WebInspector.RevisionHistoryView.reset = function() -{ - if (WebInspector.RevisionHistoryView._view) - WebInspector.RevisionHistoryView._view._reset(); + view._revealUISourceCode(uiSourceCode); } WebInspector.RevisionHistoryView.prototype = { /** - * @param {WebInspector.Resource} resource + * @param {WebInspector.UISourceCode} uiSourceCode */ - _createResourceItem: function(resource) + _createUISourceCodeItem: function(uiSourceCode) { - var resourceItem = new TreeElement(resource.displayName, null, true); - resourceItem.selectable = false; + var uiSourceCodeItem = new TreeElement(uiSourceCode.parsedURL.displayName, null, true); + uiSourceCodeItem.selectable = false; // Insert in sorted order for (var i = 0; i < this._treeOutline.children.length; ++i) { - if (this._treeOutline.children[i].title.localeCompare(resource.displayName) > 0) { - this._treeOutline.insertChild(resourceItem, i); + if (this._treeOutline.children[i].title.localeCompare(uiSourceCode.parsedURL.displayName) > 0) { + this._treeOutline.insertChild(uiSourceCodeItem, i); break; } } if (i === this._treeOutline.children.length) - this._treeOutline.appendChild(resourceItem); + this._treeOutline.appendChild(uiSourceCodeItem); - this._resourceItems.put(resource, resourceItem); + this._uiSourceCodeItems.put(uiSourceCode, uiSourceCodeItem); - var revisionCount = resource.history.length; + var revisionCount = uiSourceCode.history.length; for (var i = revisionCount - 1; i >= 0; --i) { - var revision = resource.history[i]; - var historyItem = new WebInspector.RevisionHistoryTreeElement(revision, resource.history[i - 1], i !== revisionCount - 1); - resourceItem.appendChild(historyItem); + var revision = uiSourceCode.history[i]; + var historyItem = new WebInspector.RevisionHistoryTreeElement(revision, uiSourceCode.history[i - 1], i !== revisionCount - 1); + uiSourceCodeItem.appendChild(historyItem); } var linkItem = new TreeElement("", null, false); linkItem.selectable = false; - resourceItem.appendChild(linkItem); + uiSourceCodeItem.appendChild(linkItem); var revertToOriginal = linkItem.listItemElement.createChild("span", "revision-history-link revision-history-link-row"); revertToOriginal.textContent = WebInspector.UIString("apply original content"); - revertToOriginal.addEventListener("click", resource.revertToOriginal.bind(resource)); + revertToOriginal.addEventListener("click", uiSourceCode.revertToOriginal.bind(uiSourceCode)); - var clearHistoryElement = resourceItem.listItemElement.createChild("span", "revision-history-link"); + var clearHistoryElement = uiSourceCodeItem.listItemElement.createChild("span", "revision-history-link"); clearHistoryElement.textContent = WebInspector.UIString("revert"); - clearHistoryElement.addEventListener("click", this._clearHistory.bind(this, resource)); - return resourceItem; + clearHistoryElement.addEventListener("click", this._clearHistory.bind(this, uiSourceCode)); + return uiSourceCodeItem; }, /** - * @param {WebInspector.Resource} resource + * @param {WebInspector.UISourceCode} uiSourceCode */ - _clearHistory: function(resource) + _clearHistory: function(uiSourceCode) { - resource.revertAndClearHistory(historyCleared.bind(this)); - - function historyCleared() - { - var resourceItem = this._resourceItems.get(resource); - this._treeOutline.removeChild(resourceItem); - this._resourceItems.remove(resource); - } - + uiSourceCode.revertAndClearHistory(this._removeUISourceCode.bind(this)); }, _revisionAdded: function(event) { - var resource = /** @type {WebInspector.Resource} */ event.data.resource; - var resourceItem = this._resourceItems.get(resource); - if (!resourceItem) { - resourceItem = this._createResourceItem(resource); + var uiSourceCode = /** @type {WebInspector.UISourceCode} */ event.data.uiSourceCode; + var uiSourceCodeItem = this._uiSourceCodeItems.get(uiSourceCode); + if (!uiSourceCodeItem) { + uiSourceCodeItem = this._createUISourceCodeItem(uiSourceCode); return; } - var historyLength = resource.history.length; - var historyItem = new WebInspector.RevisionHistoryTreeElement(resource.history[historyLength - 1], resource.history[historyLength - 2], false); - if (resourceItem.children.length) - resourceItem.children[0].allowRevert(); - resourceItem.insertChild(historyItem, 0); + var historyLength = uiSourceCode.history.length; + var historyItem = new WebInspector.RevisionHistoryTreeElement(uiSourceCode.history[historyLength - 1], uiSourceCode.history[historyLength - 2], false); + if (uiSourceCodeItem.children.length) + uiSourceCodeItem.children[0].allowRevert(); + uiSourceCodeItem.insertChild(historyItem, 0); }, /** - * @param {WebInspector.Resource} resource + * @param {WebInspector.UISourceCode} uiSourceCode */ - _revealResource: function(resource) + _revealUISourceCode: function(uiSourceCode) { - var resourceItem = this._resourceItems.get(resource); - if (resourceItem) { - resourceItem.reveal(); - resourceItem.expand(); + var uiSourceCodeItem = this._uiSourceCodeItems.get(uiSourceCode); + if (uiSourceCodeItem) { + uiSourceCodeItem.reveal(); + uiSourceCodeItem.expand(); } }, + _uiSourceCodeRemoved: function(event) + { + var uiSourceCode = /** @type {WebInspector.UISourceCode} */ event.data; + this._removeUISourceCode(uiSourceCode); + }, + + /** + * @param {WebInspector.Event} event + */ + _uiSourceCodeReplaced: function(event) + { + var oldUISourceCode = /** @type {WebInspector.UISourceCode} */ event.data.oldUISourceCode; + var uiSourceCode = /** @type {WebInspector.UISourceCode} */ event.data.uiSourceCode; + this._removeUISourceCode(oldUISourceCode); + this._revealUISourceCode(uiSourceCode); + }, + + /** + * @param {WebInspector.UISourceCode} uiSourceCode + */ + _removeUISourceCode: function(uiSourceCode) + { + var uiSourceCodeItem = this._uiSourceCodeItems.get(uiSourceCode); + this._treeOutline.removeChild(uiSourceCodeItem); + this._uiSourceCodeItems.remove(uiSourceCode); + }, + _reset: function() { this._treeOutline.removeChildren(); - this._resourceItems.clear(); + this._uiSourceCodeItems.clear(); } } @@ -212,7 +231,7 @@ WebInspector.RevisionHistoryTreeElement.prototype = { if (this._baseRevision) this._baseRevision.requestContent(step1.bind(this)); else - this._revision.resource.requestContent(step1.bind(this)); + this._revision.uiSourceCode.requestOriginalContent(step1.bind(this)); function step1(baseContent) { diff --git a/Source/WebCore/inspector/front-end/ScriptSnippetModel.js b/Source/WebCore/inspector/front-end/ScriptSnippetModel.js index 9d712d0c7..eec340acd 100644 --- a/Source/WebCore/inspector/front-end/ScriptSnippetModel.js +++ b/Source/WebCore/inspector/front-end/ScriptSnippetModel.js @@ -41,8 +41,6 @@ WebInspector.ScriptSnippetModel = function() this._snippetStorage = new WebInspector.SnippetStorage("script", "Script snippet #"); this._lastSnippetEvaluationIndexSetting = WebInspector.settings.createSetting("lastSnippetEvaluationIndex", 0); this._snippetScriptMapping = new WebInspector.SnippetScriptMapping(this); - - this._loadSnippets(); } WebInspector.ScriptSnippetModel.snippetSourceURLPrefix = "snippets:///"; @@ -128,7 +126,6 @@ WebInspector.ScriptSnippetModel.prototype = { { var snippet = this._snippetStorage.snippetForId(snippetJavaScriptSource.snippetId); snippet.content = newContent; - snippetJavaScriptSource.contentChanged(newContent, "text/javascript"); }, /** diff --git a/Source/WebCore/inspector/front-end/ScriptsPanel.js b/Source/WebCore/inspector/front-end/ScriptsPanel.js index d31fa2dfe..a7519247f 100644 --- a/Source/WebCore/inspector/front-end/ScriptsPanel.js +++ b/Source/WebCore/inspector/front-end/ScriptsPanel.js @@ -366,7 +366,6 @@ WebInspector.ScriptsPanel.prototype = { this.sidebarPanes.watchExpressions.reset(); if (!preserveItems && this.sidebarPanes.workers) this.sidebarPanes.workers.reset(); - WebInspector.RevisionHistoryView.reset(); var uiSourceCodes = this._workspace.uiSourceCodes(); for (var i = 0; i < uiSourceCodes.length; ++i) diff --git a/Source/WebCore/inspector/front-end/SearchController.js b/Source/WebCore/inspector/front-end/SearchController.js index 1565f4d25..5bfad4cdf 100644 --- a/Source/WebCore/inspector/front-end/SearchController.js +++ b/Source/WebCore/inspector/front-end/SearchController.js @@ -35,27 +35,31 @@ WebInspector.SearchController = function() { this._element = document.createElement("div"); - this._element.textContent = "Search:"; + this._element.className = "toolbar-search"; - this._searchInputElement = this._element.createChild("input"); + var labelElement = this._element.createChild("span"); + labelElement.textContent = WebInspector.UIString("Find"); + + this._searchControlElement = this._element.createChild("div", "toolbar-search-control"); + + this._searchInputElement = this._searchControlElement.createChild("input"); this._searchInputElement.id = "search"; - this._searchInputElement.type = "search"; - this._searchInputElement.incremental = true; - this._searchInputElement.results = 0; - this._searchNavigationNextElement = this._element.createChild("div", "toolbar-search-navigation toolbar-search-navigation-next hidden"); - this._searchNavigationNextElement.addEventListener("mousedown", this._onNextButtonSearch.bind(this), false); - this._searchNavigationNextElement.title = WebInspector.UIString("Search Next"); + this._matchesElement = this._searchControlElement.createChild("label", "search-results-matches"); + this._matchesElement.setAttribute("for", "search"); - this._searchNavigationPrevElement = this._element.createChild("div", "toolbar-search-navigation toolbar-search-navigation-prev hidden"); - this._searchNavigationPrevElement.addEventListener("mousedown", this._onPrevButtonSearch.bind(this), false); + var searchNavigationElement = this._searchControlElement.createChild("div", "toolbar-search-navigation-controls"); + this._searchNavigationPrevElement = searchNavigationElement.createChild("div", "toolbar-search-navigation toolbar-search-navigation-prev"); + this._searchNavigationPrevElement.addEventListener("click", this._onPrevButtonSearch.bind(this), false); this._searchNavigationPrevElement.title = WebInspector.UIString("Search Previous"); - this._matchesElement = this._element.createChild("span", "search-results-matches"); + this._searchNavigationNextElement = searchNavigationElement.createChild("div", "toolbar-search-navigation toolbar-search-navigation-next"); + this._searchNavigationNextElement.addEventListener("click", this._onNextButtonSearch.bind(this), false); + this._searchNavigationNextElement.title = WebInspector.UIString("Search Next"); - this._searchInputElement.addEventListener("search", this._onSearch.bind(this), false); // when the search is emptied this._searchInputElement.addEventListener("mousedown", this._onSearchFieldManualFocus.bind(this), false); // when the search field is manually selected this._searchInputElement.addEventListener("keydown", this._onKeyDown.bind(this), true); + this._searchInputElement.addEventListener("input", this._onInput.bind(this), false); var closeButtonElement = this._element.createChild("span", "drawer-header-close-button"); closeButtonElement.textContent = WebInspector.UIString("\u00D7"); @@ -71,7 +75,7 @@ WebInspector.SearchController.prototype = { panel.currentSearchMatches = matches; if (panel === WebInspector.inspectorView.currentPanel()) - this._updateSearchMatchesCountAndCurrentMatchIndex(WebInspector.inspectorView.currentPanel().currentQuery && matches); + this._updateSearchMatchesCountAndCurrentMatchIndex(WebInspector.inspectorView.currentPanel().currentQuery ? matches : 0, -1); }, updateCurrentMatchIndex: function(currentMatchIndex, panel) @@ -80,15 +84,6 @@ WebInspector.SearchController.prototype = { this._updateSearchMatchesCountAndCurrentMatchIndex(panel.currentSearchMatches, currentMatchIndex); }, - updateSearchLabel: function() - { - var panelName = WebInspector.inspectorView.currentPanel() && WebInspector.inspectorView.currentPanel().toolbarItemLabel; - if (!panelName) - return; - var newLabel = WebInspector.UIString("Search %s", panelName); - this._searchInputElement.setAttribute("placeholder", newLabel); - }, - cancelSearch: function() { this._searchInputElement.value = ""; @@ -150,8 +145,6 @@ WebInspector.SearchController.prototype = { activePanelChanged: function() { - this.updateSearchLabel(); - if (!this._currentQuery) return; @@ -159,7 +152,7 @@ WebInspector.SearchController.prototype = { if (panel.performSearch) { function performPanelSearch() { - this._updateSearchMatchesCountAndCurrentMatchIndex(); + this._updateSearchMatchesCountAndCurrentMatchIndex(0, -1); panel.currentQuery = this._currentQuery; panel.performSearch(this._currentQuery); @@ -169,57 +162,30 @@ WebInspector.SearchController.prototype = { setTimeout(performPanelSearch.bind(this), 0); } else { // Update to show Not found for panels that can't be searched. - this._updateSearchMatchesCountAndCurrentMatchIndex(); + this._updateSearchMatchesCountAndCurrentMatchIndex(0, -1); } }, _updateSearchNavigationButtonState: function(enabled) { if (enabled) { - this._searchNavigationPrevElement.removeStyleClass("hidden"); - this._searchNavigationNextElement.removeStyleClass("hidden"); + this._searchNavigationPrevElement.addStyleClass("enabled"); + this._searchNavigationNextElement.addStyleClass("enabled"); } else { - this._searchNavigationPrevElement.addStyleClass("hidden"); - this._searchNavigationNextElement.addStyleClass("hidden"); + this._searchNavigationPrevElement.removeStyleClass("enabled"); + this._searchNavigationNextElement.removeStyleClass("enabled"); } }, /** - * @param {?number=} matches - * @param {number=} currentMatchIndex + * @param {number} matches + * @param {number} currentMatchIndex */ _updateSearchMatchesCountAndCurrentMatchIndex: function(matches, currentMatchIndex) { - if (matches == null) { - this._matchesElement.addStyleClass("hidden"); - // Make Search Nav key non-accessible when there is no active search. - this._updateSearchNavigationButtonState(false); - return; - } - - if (matches) { - if (matches === 1) { - if (currentMatchIndex === 0) - var matchesString = WebInspector.UIString("1 of 1 match"); - else - var matchesString = WebInspector.UIString("1 match"); - } else { - if (typeof currentMatchIndex === "number") - var matchesString = WebInspector.UIString("%d of %d matches", currentMatchIndex + 1, matches); - else - var matchesString = WebInspector.UIString("%d matches", matches); - // Make search nav key accessible when there are more than 1 search results found. - this._updateSearchNavigationButtonState(true); - } - } else { - var matchesString = WebInspector.UIString("Not Found"); - // Make search nav key non-accessible when there is no match found. - this._updateSearchNavigationButtonState(false); - } - - this._matchesElement.removeStyleClass("hidden"); - this._matchesElement.textContent = matchesString; - WebInspector.toolbar.resize(); + if (matches === 0 || currentMatchIndex >= 0) + this._matchesElement.textContent = WebInspector.UIString("%d of %d", currentMatchIndex + 1, matches); + this._updateSearchNavigationButtonState(matches > 0); }, focusSearchField: function() @@ -246,64 +212,36 @@ WebInspector.SearchController.prototype = { return false; } - if (!isEnterKey(event)) - return false; - - // Select all of the text so the user can easily type an entirely new query. - event.target.select(); - - // Only call performSearch if the Enter key was pressed. Otherwise the search - // performance is poor because of searching on every key. The search field has - // the incremental attribute set, so we still get incremental searches. - this._onSearch(event); - - // Call preventDefault since this was the Enter key. This prevents a "search" event - // from firing for key down. This stops performSearch from being called twice in a row. - event.preventDefault(); + if (isEnterKey(event)) + this._performSearch(event.target.value, true, event.shiftKey); }, - _onSearch: function(event) + _onInput: function(event) { - var forceSearch = event.keyIdentifier === "Enter"; - this._performSearch(event.target.value, forceSearch, event.shiftKey, false); + this._performSearch(event.target.value, false, false); }, _onNextButtonSearch: function(event) { // Simulate next search on search-navigation-button click. - this._performSearch(this._searchInputElement.value, true, false, false); + this._performSearch(this._searchInputElement.value, true, false); + this._searchInputElement.focus(); }, _onPrevButtonSearch: function(event) { // Simulate previous search on search-navigation-button click. - this._performSearch(this._searchInputElement.value, true, true, false); + this._performSearch(this._searchInputElement.value, true, true); + this._searchInputElement.focus(); }, /** * @param {boolean=} forceSearch * @param {boolean=} isBackwardSearch - * @param {boolean=} repeatSearch */ - _performSearch: function(query, forceSearch, isBackwardSearch, repeatSearch) + _performSearch: function(query, forceSearch, isBackwardSearch) { - var isShortSearch = (query.length < 3); - - // Clear a leftover short search flag due to a non-conflicting forced search. - if (isShortSearch && this._shortSearchWasForcedByKeyEvent && this._currentQuery !== query) - delete this._shortSearchWasForcedByKeyEvent; - - // Indicate this was a forced search on a short query. - if (isShortSearch && forceSearch) - this._shortSearchWasForcedByKeyEvent = true; - - if (!query || !query.length || (!forceSearch && isShortSearch)) { - // Prevent clobbering a short search forced by the user. - if (this._shortSearchWasForcedByKeyEvent) { - delete this._shortSearchWasForcedByKeyEvent; - return; - } - + if (!query || !query.length) { delete this._currentQuery; for (var panelName in WebInspector.panels) { @@ -313,14 +251,12 @@ WebInspector.SearchController.prototype = { if (hadCurrentQuery && panel.searchCanceled) panel.searchCanceled(); } - - this._updateSearchMatchesCountAndCurrentMatchIndex(); - + this._updateSearchMatchesCountAndCurrentMatchIndex(0, -1); return; } var currentPanel = WebInspector.inspectorView.currentPanel(); - if (!repeatSearch && query === currentPanel.currentQuery && currentPanel.currentQuery === this._currentQuery) { + if (query === currentPanel.currentQuery && currentPanel.currentQuery === this._currentQuery) { // When this is the same query and a forced search, jump to the next // search result for a good user experience. if (forceSearch) { @@ -332,12 +268,15 @@ WebInspector.SearchController.prototype = { return; } - this._currentQuery = query; + if (!forceSearch && query.length < 3 && !this._currentQuery) + return; - this._updateSearchMatchesCountAndCurrentMatchIndex(); + this._currentQuery = query; - if (!currentPanel.performSearch) + if (!currentPanel.performSearch) { + this._updateSearchMatchesCountAndCurrentMatchIndex(0, -1); return; + } currentPanel.currentQuery = query; currentPanel.performSearch(query); diff --git a/Source/WebCore/inspector/front-end/Settings.js b/Source/WebCore/inspector/front-end/Settings.js index 19c143a48..a37829daf 100644 --- a/Source/WebCore/inspector/front-end/Settings.js +++ b/Source/WebCore/inspector/front-end/Settings.js @@ -99,8 +99,6 @@ WebInspector.Settings = function() this.zoomLevel = this.createSetting("zoomLevel", 0); this.savedURLs = this.createSetting("savedURLs", {}); this.javaScriptDisabled = this.createSetting("javaScriptDisabled", false); - this.geolocationOverride = this.createSetting("geolocationOverride", ""); - this.geolocationError = this.createSetting("geolocationError", "None"); // If there are too many breakpoints in a storage, it is likely due to a recent bug that caused // periodical breakpoints duplication leading to inspector slowness. diff --git a/Source/WebCore/inspector/front-end/SettingsScreen.js b/Source/WebCore/inspector/front-end/SettingsScreen.js index f63922705..6876e86cb 100644 --- a/Source/WebCore/inspector/front-end/SettingsScreen.js +++ b/Source/WebCore/inspector/front-end/SettingsScreen.js @@ -349,7 +349,6 @@ WebInspector.UserAgentSettingsTab = function() p.appendChild(this._createUserAgentControl()); if (Capabilities.canOverrideDeviceMetrics) p.appendChild(this._createDeviceMetricsControl()); - p.appendChild(this._createGeolocationOverrideControl()); p.appendChild(this._createCheckboxSetting(WebInspector.UIString("Emulate touch events"), WebInspector.settings.emulateTouchEvents)); } @@ -650,115 +649,6 @@ WebInspector.UserAgentSettingsTab.prototype = { cellElement.appendChild(this._createCheckboxSetting(WebInspector.UIString("Fit in window"), WebInspector.settings.deviceFitWindow, true, this._fitWindowCheckboxElement)); return fieldsetElement; - }, - - _createGeolocationOverrideControl: function() - { - const geolocationSetting = WebInspector.settings.geolocationOverride.get(); - var geolocation = WebInspector.UserAgentSupport.GeolocationPosition.parseSetting(geolocationSetting); - - const p = document.createElement("p"); - const labelElement = p.createChild("label"); - const checkboxElement = labelElement.createChild("input"); - checkboxElement.id = "geolocation-override-checkbox"; - checkboxElement.type = "checkbox"; - checkboxElement.checked = !geolocation || (geolocation._latitude && geolocation._longitude); - checkboxElement.addEventListener("click", this._onGeolocationOverrideCheckboxClicked.bind(this), false); - this._geolocationOverrideCheckboxElement = checkboxElement; - labelElement.appendChild(document.createTextNode(WebInspector.UIString("Override Geolocation"))); - - const geolocationSectionElement = this._createGeolocationOverrideElement(geolocation); - p.appendChild(geolocationSectionElement); - - const geolocationErrorElement = this._createRadioSetting(WebInspector.UIString("Geolocation Error"), [ - [ "None", WebInspector.UIString("None") ], - [ "PermissionDenied", WebInspector.UIString("PermissionDenied") ], - [ "PositionUnavailable", WebInspector.UIString("PositionUnavailable") ] ], WebInspector.settings.geolocationError); - p.appendChild(geolocationErrorElement); - this._geolocationErrorElement = geolocationErrorElement; - this._geolocationSectionElement = geolocationSectionElement; - - this._setGeolocationPosition(geolocation, false, true); - - return p; - }, - - _onGeolocationOverrideCheckboxClicked: function() - { - if (this._geolocationOverrideCheckboxElement.checked) { - this._geolocationSectionElement.removeStyleClass("hidden"); - this._geolocationErrorElement.removeStyleClass("hidden"); - var geolocation = WebInspector.UserAgentSupport.GeolocationPosition.parseUserInput(this._latitudeElement.value, this._longitudeElement.value); - if (geolocation) - this._setGeolocationPosition(geolocation, false, false); - if (!this._latitudeElement.value) - this._latitudeElement.focus(); - } else { - this._geolocationSectionElement.addStyleClass("hidden"); - this._geolocationErrorElement.addStyleClass("hidden"); - PageAgent.clearGeolocationData(); - } - }, - - _applyGeolocationUserInput: function() - { - this._setGeolocationPosition(WebInspector.UserAgentSupport.GeolocationPosition.parseUserInput(this._latitudeElement.value.trim(), this._longitudeElement.value.trim()), true, false); - }, - - /** - * @param {?WebInspector.UserAgentSupport.GeolocationPosition} geolocation - * @param {boolean} userInputModified - * @param {boolean} updateCheckbox - */ - _setGeolocationPosition: function(geolocation, userInputModified, updateCheckbox) - { - if (!geolocation) - return; - - if (!userInputModified) { - this._latitudeElement.value = geolocation._latitude; - this._longitudeElement.value = geolocation._longitude; - } - - var value = geolocation.toSetting(); - WebInspector.settings.geolocationOverride.set(value); - - if (this._geolocationOverrideCheckboxElement && updateCheckbox) { - this._geolocationOverrideCheckboxElement.checked = !!geolocation.toSetting(); - this._onGeolocationOverrideCheckboxClicked(); - } - }, - - /** - * @param {WebInspector.UserAgentSupport.GeolocationPosition} geolocation - */ - _createGeolocationOverrideElement: function(geolocation) - { - var fieldsetElement = document.createElement("fieldset"); - fieldsetElement.id = "geolocation-override-section"; - - function createInput(parentElement, id, defaultText) - { - var element = parentElement.createChild("input"); - element.id = id; - element.maxLength = 12; - element.style.width = "80px"; - element.value = defaultText; - element.addEventListener("blur", this._applyGeolocationUserInput.bind(this), false); - return element; - } - - var tableElement = fieldsetElement.createChild("table"); - - var rowElement = tableElement.createChild("tr"); - var cellElement = rowElement.createChild("td"); - cellElement.appendChild(document.createTextNode(WebInspector.UIString("Geolocation Position:"))); - cellElement = rowElement.createChild("td"); - this._latitudeElement = createInput.call(this, cellElement, "geolocation-override-latitude", String(geolocation._latitude)); - cellElement.appendChild(document.createTextNode(" , ")); - this._longitudeElement = createInput.call(this, cellElement, "geolocation-override-longitude", String(geolocation._longitude)); - - return fieldsetElement; } } diff --git a/Source/WebCore/inspector/front-end/SourceFrame.js b/Source/WebCore/inspector/front-end/SourceFrame.js index ab2c85628..580012450 100644 --- a/Source/WebCore/inspector/front-end/SourceFrame.js +++ b/Source/WebCore/inspector/front-end/SourceFrame.js @@ -333,7 +333,7 @@ WebInspector.SourceFrame.prototype = { this._searchResults = this._collectRegexMatches(regex); var selection = this._textEditor.lastSelection(); for (var i = 0; selection && i < this._searchResults.length; ++i) { - if (this._searchResults[i].compareTo(selection) > 0) { + if (this._searchResults[i].compareTo(selection) >= 0) { this._currentSearchResultIndex = i - 1; break; } diff --git a/Source/WebCore/inspector/front-end/StatusBarButton.js b/Source/WebCore/inspector/front-end/StatusBarButton.js index 78f0405f4..f3554fad2 100644 --- a/Source/WebCore/inspector/front-end/StatusBarButton.js +++ b/Source/WebCore/inspector/front-end/StatusBarButton.js @@ -198,7 +198,7 @@ WebInspector.StatusBarButton.prototype = { var optionsBarElement = optionsGlassPane.element.createChild("div", "alternate-status-bar-buttons-bar"); const buttonHeight = 24; optionsBarElement.style.height = (buttonHeight * buttons.length) + "px"; - optionsBarElement.style.left = this.element.offsetLeft + "px"; + optionsBarElement.style.left = (this.element.offsetLeft + 1) + "px"; var boundMouseOver = mouseOver.bind(this); var boundMouseOut = mouseOut.bind(this); @@ -241,3 +241,53 @@ WebInspector.StatusBarButton.prototype = { } WebInspector.StatusBarButton.prototype.__proto__ = WebInspector.Object.prototype; + +/** + * @constructor + * @param {?function(Event)} changeHandler + * @param {string=} className + */ +WebInspector.StatusBarComboBox = function(changeHandler, className) +{ + this.element = document.createElement("span"); + this.element.className = "status-bar-select-container"; + + this._selectElement = this.element.createChild("select", "status-bar-item"); + if (changeHandler) + this._selectElement.addEventListener("change", changeHandler, false); + if (className) + this._selectElement.addStyleClass(className); +} + +WebInspector.StatusBarComboBox.prototype = { + /** + * @param {Element} option + */ + addOption: function(option) + { + this._selectElement.appendChild(option); + }, + + /** + * @param {Element} option + */ + removeOption: function(option) + { + this._selectElement.removeChild(option); + }, + + removeOptions: function() + { + this._selectElement.removeChildren(); + }, + + /** + * @return {?Element} + */ + selectedOption: function() + { + if (this._selectElement.selectedIndex >= 0) + return this._selectElement[this._selectElement.selectedIndex]; + return null; + } +} diff --git a/Source/WebCore/inspector/front-end/StylesPanel.js b/Source/WebCore/inspector/front-end/StylesPanel.js index 87b09b435..0c00b1534 100644 --- a/Source/WebCore/inspector/front-end/StylesPanel.js +++ b/Source/WebCore/inspector/front-end/StylesPanel.js @@ -33,10 +33,11 @@ */ WebInspector.StylesUISourceCodeProvider = function() { - WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.CachedResourcesLoaded, this._initialize, this); - WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.WillLoadCachedResources, this.reset, this); - + /** + * @type {Array.<WebInspector.UISourceCode>} + */ this._uiSourceCodes = []; + WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.ResourceAdded, this._resourceAdded, this); } WebInspector.StylesUISourceCodeProvider.prototype = { @@ -48,11 +49,8 @@ WebInspector.StylesUISourceCodeProvider.prototype = { return this._uiSourceCodes; }, - _initialize: function() + _populate: function() { - if (this._initialized) - return; - function populateFrame(frame) { for (var i = 0; i < frame.childFrames.length; ++i) @@ -62,10 +60,8 @@ WebInspector.StylesUISourceCodeProvider.prototype = { for (var i = 0; i < resources.length; ++i) this._resourceAdded({data:resources[i]}); } - populateFrame.call(this, WebInspector.resourceTreeModel.mainFrame); - WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.ResourceAdded, this._resourceAdded, this); - this._initialized = true; + populateFrame.call(this, WebInspector.resourceTreeModel.mainFrame); }, _resourceAdded: function(event) @@ -81,6 +77,7 @@ WebInspector.StylesUISourceCodeProvider.prototype = { reset: function() { this._uiSourceCodes = []; + this._populate(); } } diff --git a/Source/WebCore/inspector/front-end/UISourceCode.js b/Source/WebCore/inspector/front-end/UISourceCode.js index 49e5e310b..ce2411654 100644 --- a/Source/WebCore/inspector/front-end/UISourceCode.js +++ b/Source/WebCore/inspector/front-end/UISourceCode.js @@ -42,8 +42,6 @@ WebInspector.UISourceCode = function(url, resource, contentProvider, sourceMappi { this._url = url; this._resource = resource; - if (resource) - resource.setUISourceCode(this); this._parsedURL = new WebInspector.ParsedURL(url); this._contentProvider = contentProvider; this._sourceMapping = sourceMapping; @@ -58,8 +56,11 @@ WebInspector.UISourceCode = function(url, resource, contentProvider, sourceMappi */ this._consoleMessages = []; - if (this.resource()) - this.resource().addEventListener(WebInspector.Resource.Events.RevisionAdded, this._revisionAdded, this); + /** + * @type {Array.<WebInspector.Revision>} + */ + this.history = []; + this._restoreRevisionHistory(); } WebInspector.UISourceCode.Events = { @@ -136,21 +137,102 @@ WebInspector.UISourceCode.prototype = { this._contentProvider.requestContent(this.fireContentAvailable.bind(this)); }, - _revisionAdded: function(event) + /** + * @param {function(?string,boolean,string)} callback + */ + requestOriginalContent: function(callback) { - var revision = /** @type {WebInspector.Revision} */ event.data; - this.contentChanged(revision.content || "", this._resource.canonicalMimeType()); + this._contentProvider.requestContent(callback); }, /** * @param {string} newContent - * @param {string} mimeType */ - contentChanged: function(newContent, mimeType) + _setContent: function(newContent) + { + this.setWorkingCopy(newContent); + this.commitWorkingCopy(function() {}); + }, + + /** + * @param {string} content + * @param {Date=} timestamp + * @param {boolean=} restoringHistory + */ + addRevision: function(content, timestamp, restoringHistory) + { + if (this.history.length) { + var lastRevision = this.history[this.history.length - 1]; + if (lastRevision._content === content) + return; + } + var revision = new WebInspector.Revision(this, content, timestamp || new Date()); + this.history.push(revision); + + this.contentChanged(revision.content || "", this.canonicalMimeType()); + if (!restoringHistory) + revision._persist(); + WebInspector.workspace.dispatchEventToListeners(WebInspector.Workspace.Events.UISourceCodeContentCommitted, { uiSourceCode: this, content: content }); + }, + + _restoreRevisionHistory: function() { - if (this._committingWorkingCopy) + if (!window.localStorage) return; + var registry = WebInspector.Revision._revisionHistoryRegistry(); + var historyItems = registry[this.url]; + for (var i = 0; historyItems && i < historyItems.length; ++i) + this.addRevision(window.localStorage[historyItems[i].key], new Date(historyItems[i].timestamp), true); + }, + + _clearRevisionHistory: function() + { + if (!window.localStorage) + return; + + var registry = WebInspector.Revision._revisionHistoryRegistry(); + var historyItems = registry[this.url]; + for (var i = 0; historyItems && i < historyItems.length; ++i) + delete window.localStorage[historyItems[i].key]; + delete registry[this.url]; + window.localStorage["revision-history"] = JSON.stringify(registry); + }, + + revertToOriginal: function() + { + /** + * @param {?string} content + * @param {boolean} contentEncoded + * @param {string} mimeType + */ + function callback(content, contentEncoded, mimeType) + { + this._setContent(); + } + + this.requestOriginalContent(callback.bind(this)); + }, + + revertAndClearHistory: function(callback) + { + function revert(content) + { + this._setContent(content); + this._clearRevisionHistory(); + this.history = []; + callback(); + } + + this.requestOriginalContent(revert.bind(this)); + }, + + /** + * @param {string} newContent + * @param {string} mimeType + */ + contentChanged: function(newContent, mimeType) + { this._content = newContent; this._mimeType = mimeType; this._contentLoaded = true; @@ -206,13 +288,8 @@ WebInspector.UISourceCode.prototype = { } var newContent = this._workingCopy; - this._committingWorkingCopy = true; this.workingCopyCommitted(callback); - if (this.resource()) - this.resource().addRevision(newContent); - delete this._committingWorkingCopy; - this.contentChanged(newContent, this._mimeType); - + this.addRevision(newContent); }, /** @@ -240,6 +317,14 @@ WebInspector.UISourceCode.prototype = { }, /** + * @return {string} + */ + canonicalMimeType: function() + { + return this.contentType().canonicalMimeType() || this._mimeType; + }, + + /** * @return {?string} */ content: function() @@ -433,3 +518,166 @@ WebInspector.UILocation.prototype = { WebInspector.RawLocation = function() { } + +/** + * @constructor + * @implements {WebInspector.ContentProvider} + * @param {WebInspector.UISourceCode} uiSourceCode + * @param {?string|undefined} content + * @param {Date} timestamp + */ +WebInspector.Revision = function(uiSourceCode, content, timestamp) +{ + this._uiSourceCode = uiSourceCode; + this._content = content; + this._timestamp = timestamp; +} + +WebInspector.Revision._revisionHistoryRegistry = function() +{ + if (!WebInspector.Revision._revisionHistoryRegistryObject) { + if (window.localStorage) { + var revisionHistory = window.localStorage["revision-history"]; + try { + WebInspector.Revision._revisionHistoryRegistryObject = revisionHistory ? JSON.parse(revisionHistory) : {}; + } catch (e) { + WebInspector.Revision._revisionHistoryRegistryObject = {}; + } + } else + WebInspector.Revision._revisionHistoryRegistryObject = {}; + } + return WebInspector.Revision._revisionHistoryRegistryObject; +} + +WebInspector.Revision.filterOutStaleRevisions = function() +{ + if (!window.localStorage) + return; + + var registry = WebInspector.Revision._revisionHistoryRegistry(); + var filteredRegistry = {}; + for (var url in registry) { + var historyItems = registry[url]; + var filteredHistoryItems = []; + for (var i = 0; historyItems && i < historyItems.length; ++i) { + var historyItem = historyItems[i]; + if (historyItem.loaderId === WebInspector.resourceTreeModel.mainFrame.loaderId) { + filteredHistoryItems.push(historyItem); + filteredRegistry[url] = filteredHistoryItems; + } else + delete window.localStorage[historyItem.key]; + } + } + WebInspector.Revision._revisionHistoryRegistryObject = filteredRegistry; + + function persist() + { + window.localStorage["revision-history"] = JSON.stringify(filteredRegistry); + } + + // Schedule async storage. + setTimeout(persist, 0); +} + +WebInspector.Revision.prototype = { + /** + * @return {WebInspector.UISourceCode} + */ + get uiSourceCode() + { + return this._uiSourceCode; + }, + + /** + * @return {Date} + */ + get timestamp() + { + return this._timestamp; + }, + + /** + * @return {?string} + */ + get content() + { + return this._content || null; + }, + + revertToThis: function() + { + function revert(content) + { + if (this._uiSourceCode._content !== content) + this._uiSourceCode._setContent(content); + } + this.requestContent(revert.bind(this)); + }, + + /** + * @return {?string} + */ + contentURL: function() + { + return this._uiSourceCode.url; + }, + + /** + * @return {WebInspector.ResourceType} + */ + contentType: function() + { + return this._uiSourceCode.contentType(); + }, + + /** + * @param {function(?string, boolean, string)} callback + */ + requestContent: function(callback) + { + callback(this._content || "", false, this.uiSourceCode.canonicalMimeType()); + }, + + /** + * @param {string} query + * @param {boolean} caseSensitive + * @param {boolean} isRegex + * @param {function(Array.<WebInspector.ContentProvider.SearchMatch>)} callback + */ + searchInContent: function(query, caseSensitive, isRegex, callback) + { + callback([]); + }, + + _persist: function() + { + if (!window.localStorage) + return; + + var url = this.contentURL(); + if (url.startsWith("inspector://")) + return; + + var loaderId = WebInspector.resourceTreeModel.mainFrame.loaderId; + var timestamp = this.timestamp.getTime(); + var key = "revision-history|" + url + "|" + loaderId + "|" + timestamp; + + var registry = WebInspector.Revision._revisionHistoryRegistry(); + + var historyItems = registry[url]; + if (!historyItems) { + historyItems = []; + registry[url] = historyItems; + } + historyItems.push({url: url, loaderId: loaderId, timestamp: timestamp, key: key}); + + function persist() + { + window.localStorage[key] = this._content; + window.localStorage["revision-history"] = JSON.stringify(registry); + } + + // Schedule async storage. + setTimeout(persist.bind(this), 0); + } +} diff --git a/Source/WebCore/inspector/front-end/UIUtils.js b/Source/WebCore/inspector/front-end/UIUtils.js index 5ebfc9e5e..c23ca652e 100644 --- a/Source/WebCore/inspector/front-end/UIUtils.js +++ b/Source/WebCore/inspector/front-end/UIUtils.js @@ -78,7 +78,7 @@ WebInspector.elementDragEnd = function(event) WebInspector.GlassPane = function() { this.element = document.createElement("div"); - this.element.style.cssText = "position:absolute;top:0;bottom:0;left:0;right:0;background-color:transparent;z-index:1"; + this.element.style.cssText = "position:absolute;top:0;bottom:0;left:0;right:0;background-color:transparent;z-index:1000;"; this.element.id = "glass-pane-for-drag"; document.body.appendChild(this.element); } diff --git a/Source/WebCore/inspector/front-end/UserAgentSupport.js b/Source/WebCore/inspector/front-end/UserAgentSupport.js index e6082ef51..976b507bd 100644 --- a/Source/WebCore/inspector/front-end/UserAgentSupport.js +++ b/Source/WebCore/inspector/front-end/UserAgentSupport.js @@ -37,8 +37,6 @@ WebInspector.UserAgentSupport = function() this._deviceMetricsChanged(); WebInspector.settings.deviceMetrics.addChangeListener(this._deviceMetricsChanged, this); WebInspector.settings.deviceFitWindow.addChangeListener(this._deviceMetricsChanged, this); - WebInspector.settings.geolocationOverride.addChangeListener(this._geolocationPositionChanged, this); - WebInspector.settings.geolocationError.addChangeListener(this._onGeolocationErrorChanged, this); } /** @@ -165,83 +163,11 @@ WebInspector.UserAgentSupport.DeviceMetrics.prototype = { } } -WebInspector.UserAgentSupport.GeolocationPosition = function (latitude, longitude) -{ - this._latitude = latitude; - this._longitude = longitude; -} - -WebInspector.UserAgentSupport.GeolocationPosition.prototype = { - /** - * @return {string} - */ - toSetting: function() - { - return (this._latitude || this._latitude == 0) && (this._longitude || this._longitude == 0) ? this._latitude + "@" + this._longitude : ""; - } -} - -/** - * @return {WebInspector.UserAgentSupport.GeolocationPosition} - */ -WebInspector.UserAgentSupport.GeolocationPosition.parseSetting = function(value) -{ - if (value) { - var splitPosition = value.split("@"); - if (splitPosition.length === 2) - return new WebInspector.UserAgentSupport.GeolocationPosition(parseFloat(splitPosition[0]), parseFloat(splitPosition[1])); - } - return new WebInspector.UserAgentSupport.GeolocationPosition(0, 0); -} - -/** - * @return {?WebInspector.UserAgentSupport.GeolocationPosition} - */ -WebInspector.UserAgentSupport.GeolocationPosition.parseUserInput = function(latitudeString, longitudeString) -{ - function isUserInputValid(value) - { - if (!value) - return true; - return /^[-]?[0-9]*[.]?[0-9]*$/.test(value); - } - - if (!latitudeString ^ !latitudeString) - return null; - - var isLatitudeValid = isUserInputValid(latitudeString); - var isLongitudeValid = isUserInputValid(longitudeString); - - if (!isLatitudeValid && !isLongitudeValid) - return null; - - var latitude = isLatitudeValid ? parseFloat(latitudeString) : -1; - var longitude = isLongitudeValid ? parseFloat(longitudeString) : -1; - - return new WebInspector.UserAgentSupport.GeolocationPosition(latitude, longitude); -} - WebInspector.UserAgentSupport.prototype = { _deviceMetricsChanged: function() { var metrics = WebInspector.UserAgentSupport.DeviceMetrics.parseSetting(WebInspector.settings.deviceMetrics.get()); if (metrics.isValid()) PageAgent.setDeviceMetricsOverride(metrics.width, metrics.height, metrics.fontScaleFactor, WebInspector.settings.deviceFitWindow.get()); - }, - - _geolocationPositionChanged: function(errorType) - { - var geolocation = WebInspector.UserAgentSupport.GeolocationPosition.parseSetting(WebInspector.settings.geolocationOverride.get()); - PageAgent.setGeolocationData(geolocation._latitude, geolocation._longitude, 150, typeof errorType === 'string'? errorType : WebInspector.settings.geolocationError.get()); - }, - - /** - * @param {WebInspector.Event} event - */ - _onGeolocationErrorChanged: function(event) - { - this._geolocationPositionChanged(event.data); - console.log(event); } } - diff --git a/Source/WebCore/inspector/front-end/WebKit.qrc b/Source/WebCore/inspector/front-end/WebKit.qrc index 6ec8fe6c9..b4fc85fd5 100644 --- a/Source/WebCore/inspector/front-end/WebKit.qrc +++ b/Source/WebCore/inspector/front-end/WebKit.qrc @@ -308,12 +308,7 @@ <file>Images/spinnerInactiveSelected.gif</file> <file>Images/splitviewDimple.png</file> <file>Images/splitviewDividerBackground.png</file> - <file>Images/statusbarBackground.png</file> - <file>Images/statusbarBottomBackground.png</file> - <file>Images/statusbarButtons.png</file> <file>Images/statusbarButtonGlyphs.png</file> - <file>Images/statusbarMenuButton.png</file> - <file>Images/statusbarMenuButtonSelected.png</file> <file>Images/statusbarResizerHorizontal.png</file> <file>Images/statusbarResizerVertical.png</file> <file>Images/successGreenDot.png</file> diff --git a/Source/WebCore/inspector/front-end/Workspace.js b/Source/WebCore/inspector/front-end/Workspace.js index 3dbded6c8..32182d595 100644 --- a/Source/WebCore/inspector/front-end/Workspace.js +++ b/Source/WebCore/inspector/front-end/Workspace.js @@ -130,9 +130,11 @@ WebInspector.Workspace = function() new WebInspector.PresentationConsoleMessageHelper(this); WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.MainFrameNavigated, this._reset, this); + WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.CachedResourcesLoaded, this._reset, this); } WebInspector.Workspace.Events = { + UISourceCodeContentCommitted: "uiSourceCodeContentCommitted", WorkspaceReset: "WorkspaceReset" } @@ -151,6 +153,7 @@ WebInspector.Workspace.prototype = { for (var i = 0; i < uiSourceCodeProviders.length; ++i) { uiSourceCodeProviders[i].reset(); } + WebInspector.Revision.filterOutStaleRevisions(); this.dispatchEventToListeners(WebInspector.Workspace.Events.WorkspaceReset, null); } } diff --git a/Source/WebCore/inspector/front-end/elementsPanel.css b/Source/WebCore/inspector/front-end/elementsPanel.css index 8c9bc3c58..687a1b8b1 100644 --- a/Source/WebCore/inspector/front-end/elementsPanel.css +++ b/Source/WebCore/inspector/front-end/elementsPanel.css @@ -66,6 +66,7 @@ text-shadow: rgba(255, 255, 255, 0.75) 0 1px 0; color: rgb(20, 20, 20); margin-left: -1px; + margin-top: -1px; padding-right: 12px; } diff --git a/Source/WebCore/inspector/front-end/inspector.css b/Source/WebCore/inspector/front-end/inspector.css index d8341b7e1..8da534c08 100644 --- a/Source/WebCore/inspector/front-end/inspector.css +++ b/Source/WebCore/inspector/front-end/inspector.css @@ -264,26 +264,62 @@ body.detached.platform-mac-snowleopard #toolbar-dropdown { } #search { - width: 205px; - margin-left: 4px; - margin-right: 4px; - font-size: 11px; + -webkit-appearance: none; + border: 0; + padding: 0 2px; + margin: 0; + width: 165px; +} + +#search:focus { + outline: none; +} + +.toolbar-search-navigation-controls { + position: absolute; + top: 0; + right: 0; + height: 18px; + background-image: -webkit-linear-gradient(rgb(228, 228, 228), rgb(204, 204, 204) 75%, rgb(206, 206, 206)); } .toolbar-search-navigation { - width: 16px; - height: 16px; - position: relative; - top: 4px; - margin: 0px 1px; - background-repeat: no-repeat; display: inline-block; - background-position: 2px 5px; - border: 1px solid transparent; + width: 18px; + height: 18px; + background-repeat: no-repeat; + background-position: 4px 7px; + border-left: 1px solid rgb(170, 170, 170); + opacity: 0.3; +} + +.toolbar-search-navigation.enabled:hover { + border-left: 1px solid rgb(190, 190, 190); + opacity: 0.9; +} + +.toolbar-search-navigation.enabled, .toolbar-search-navigation.enabled:active { + border-left: 1px solid rgb(170, 170, 170); + opacity: 0.7; } -.toolbar-search-navigation:hover { - border: 1px solid rgba(120, 120, 120, 0.6); +#search:focus { + outline: none; +} + +.toolbar-search { + line-height: 19px; +} + +.toolbar-search-control { + display: inline-block; + position: relative; + background-color: white; + border: 1px solid rgb(202, 202, 202); + margin: 1px 2px; + height: 20px; + border-radius: 2px; + padding-right: 36px; } .toolbar-search-navigation.toolbar-search-navigation-prev { @@ -294,18 +330,18 @@ body.detached.platform-mac-snowleopard #toolbar-dropdown { background-image: url(Images/searchNext.png); } -.toolbar-search-navigation-hidden { - background: none; -} - body.compact #search { font-size: 11px; } .search-results-matches { + display: inline-block; + min-width: 70px; + min-height: 10px; + text-align: right; font-size: 11px; - text-shadow: rgba(255, 255, 255, 0.5) 0 1px 0; - padding-left: 4px; + padding: 0 4px; + color: rgb(165, 165, 165); } .toolbar-item.elements .toolbar-icon { @@ -443,12 +479,17 @@ body.compact #main { body.drawer-visible #main-status-bar { height: 24px; - background-image: url(Images/statusbarResizerVertical.png), url(Images/statusbarBackground.png); - background-repeat: no-repeat, repeat-x; - background-position: right center, center; + border-bottom: 1px solid rgb(202, 202, 202); cursor: ns-resize; } +body.drawer-visible #main-status-bar::after { + position: absolute; + right: 0; + top: 5px; + content: url(Images/statusbarResizerVertical.png); +} + body.drawer-visible #main-status-bar * { cursor: default; } @@ -458,18 +499,18 @@ body.drawer-visible #main-panels { } .status-bar { - background-color: rgb(235, 235, 235); - background-image: url(Images/statusbarBackground.png); - background-repeat: repeat-x; white-space: nowrap; height: 23px; overflow: hidden; z-index: 12; + background-image: -webkit-linear-gradient(rgb(253,253,253), rgb(230,230,230) 75%, rgb(230,230,230)); + border-top: 1px solid rgb(202, 202, 202); } .status-bar > div { display: inline-block; vertical-align: top; + overflow: visible; } .status-bar-item { @@ -490,7 +531,7 @@ body.drawer-visible #main-panels { .glyph { position: absolute; - top: 0; + top: -1px; left: 0; right: 0; bottom: 0; @@ -520,12 +561,15 @@ body.drawer-visible #main-panels { button.status-bar-item { position: relative; width: 32px; - background-image: url(Images/statusbarButtons.png); - background-position: 0 0; + border-left: 1px solid rgb(202, 202, 202); + border-right: 1px solid rgb(202, 202, 202); } -button.status-bar-item:active, button.status-bar-item.emulate-active { - background-position: 32px 0 !important; +.status-bar select.status-bar-item:active, +.status-bar button.status-bar-item:active { + background-color: rgb(163,163,163); + border-left: 1px solid rgb(120, 120, 120); + border-right: 1px solid rgb(120, 120, 120); } button.status-bar-item .glyph.shadow { @@ -546,21 +590,33 @@ button.status-bar-item.extension { background-color: auto; } +.status-bar-select-container { + display: inline-block; + background-image: url(Images/disclosureTriangleSmallDown.png); + background-repeat: no-repeat; + background-position-x: right; + background-position-y: 6px; + padding-right: 10px; + border-right: 5px solid transparent; +} + select.status-bar-item { min-width: 48px; - border-width: 0 17px 0 2px; - padding: 0 2px 0 6px; font-weight: bold; color: rgb(48, 48, 48); text-shadow: rgba(255, 255, 255, 0.75) 0 1px 0; - -webkit-border-image: url(Images/statusbarMenuButton.png) 0 17 0 2; - -webkit-border-radius: 0; -webkit-appearance: none; + border: 0; + border-radius: 0; + padding: 0 15px 0 5px; + margin-right: -15px; + position: relative; + top: -1px; } -select.status-bar-item:active { - color: black; - -webkit-border-image: url(Images/statusbarMenuButtonSelected.png) 0 17 0 2; +select.status-bar-item, select.status-bar-item:hover { + border-left: 1px solid rgb(202, 202, 202); + border-right: 1px solid rgb(202, 202, 202); } .status-bar-item > .glyph { @@ -586,16 +642,28 @@ button.settings-status-bar-item { right: 0; } +body.detached .alternate-status-bar-buttons-bar { + margin-left: 1px; +} + .alternate-status-bar-buttons-bar { position: absolute; width: 31px; bottom: -3px; - margin-left: 1px; background: white; } .alternate-status-bar-buttons-bar .status-bar-item { + height: 24px; margin-top: -1px; + border: 1px solid rgb(202, 202, 202); + border-bottom: 1px solid transparent; +} + +.alternate-status-bar-buttons-bar .status-bar-item.emulate-active { + background-color: rgb(163,163,163); + border: 1px solid rgb(120, 120, 120); + border-bottom: 1px solid transparent; } .settings-status-bar-item .glyph { @@ -660,7 +728,6 @@ body.port-qt #dock-status-bar-item { right: 0; height: 200px; background-color: white; - background-image: url(Images/statusbarBottomBackground.png); background-repeat: repeat-x; background-position: bottom; } @@ -668,7 +735,7 @@ body.port-qt #dock-status-bar-item { body.drawer-visible #drawer-contents { position: absolute; top: 0; - bottom: 23px; + bottom: 24px; left: 0; right: 0; } @@ -682,7 +749,6 @@ body.drawer-visible #drawer { bottom: 0; left: 0; right: 0; - background: none; } body.platform-mac .monospace, body.platform-mac .source-code { @@ -1763,20 +1829,16 @@ button.edit-source-status-bar-item.toggled-on .glyph { margin-top: 23px; } -#console-filter { - margin-top: 1px; -} - .scope-bar { - height: 23px; - padding: 2px 10px 0; + line-height: 19px; + padding-right: 10px; overflow: hidden; } .scope-bar li { display: inline-block; - margin: 1px 2px 0 0; - padding: 1px 7px 3px; + margin: 0 2px; + padding: 2px 6px; font-size: 11px; line-height: 12px; font-weight: bold; @@ -1788,7 +1850,6 @@ button.edit-source-status-bar-item.toggled-on .glyph { } .scope-bar-divider { - margin: 1px 9px 0 8px; background-color: rgba(0, 0, 0, 0.4); height: 16px; width: 1px; @@ -1801,6 +1862,10 @@ button.edit-source-status-bar-item.toggled-on .glyph { text-shadow: rgba(0, 0, 0, 0.4) 0 1px 0; } +.scope-bar li.all { + margin: 0 8px; +} + .scope-bar li:hover { background: rgba(0, 0, 0, 0.2); } @@ -2761,7 +2826,7 @@ body.platform-mac #drawer-status-bar .search-status-bar-progress { border-width: 0 0 11px 0; } -#console-context { +.console-context { max-width: 200px; } @@ -2771,10 +2836,5 @@ body.platform-mac #drawer-status-bar .search-status-bar-progress { left: 0; right: 0; font-size: 11px; - padding-left: 7px; - padding-bottom: 7px; -} - -.inspector-footer > div { - vertical-align: middle; + padding-left: 5px; } diff --git a/Source/WebCore/inspector/front-end/inspector.js b/Source/WebCore/inspector/front-end/inspector.js index 59be1f3dd..1e6a01294 100644 --- a/Source/WebCore/inspector/front-end/inspector.js +++ b/Source/WebCore/inspector/front-end/inspector.js @@ -452,7 +452,6 @@ WebInspector._doLoadedDoneWithCapabilities = function() this.console.addEventListener(WebInspector.ConsoleModel.Events.RepeatCountUpdated, this._updateErrorAndWarningCounts, this); this.debuggerModel = new WebInspector.DebuggerModel(); - this.scriptSnippetModel = new WebInspector.ScriptSnippetModel(); this.breakpointManager = new WebInspector.BreakpointManager(WebInspector.settings.breakpoints, this.debuggerModel); WebInspector.CSSCompletions.requestCSSNameCompletions(); @@ -466,6 +465,8 @@ WebInspector._doLoadedDoneWithCapabilities = function() this.domAgent = new WebInspector.DOMAgent(); this.javaScriptContextManager = new WebInspector.JavaScriptContextManager(this.resourceTreeModel, this.consoleView); + this.scriptSnippetModel = new WebInspector.ScriptSnippetModel(); + InspectorBackend.registerInspectorDispatcher(this); this.cssModel = new WebInspector.CSSStyleModel(); diff --git a/Source/WebCore/inspector/front-end/networkLogView.css b/Source/WebCore/inspector/front-end/networkLogView.css index 822ec2662..f454194e1 100644 --- a/Source/WebCore/inspector/front-end/networkLogView.css +++ b/Source/WebCore/inspector/front-end/networkLogView.css @@ -465,9 +465,6 @@ } /* Filters */ -#network-filter { - margin-top: 1px; -} .network-log-grid.data-grid table.data tr.revealed.network-item { display: none; diff --git a/Source/WebCore/inspector/front-end/scriptsPanel.css b/Source/WebCore/inspector/front-end/scriptsPanel.css index 3d7fb058a..12df13dd5 100644 --- a/Source/WebCore/inspector/front-end/scriptsPanel.css +++ b/Source/WebCore/inspector/front-end/scriptsPanel.css @@ -51,10 +51,7 @@ position: relative; margin-top: -1px; height: 24px; -} - -#scripts-debug-toolbar img { - padding-top: 2px; + border-bottom: 1px solid rgb(202, 202, 202); } #scripts-debug-sidebar-contents { @@ -171,7 +168,13 @@ button.status-bar-item.scripts-navigator-show-hide-button { background-image: none; height: 16px; width: 16px; - margin: 3px 2px 2px 2px; + margin: 4px 2px 2px 2px; + border: none; +} + +button.status-bar-item.scripts-navigator-show-hide-button:active { + top: 1px; + left: 1px; } button.status-bar-item.scripts-navigator-show-hide-button.toggled-overlay @@ -251,7 +254,13 @@ button.status-bar-item.scripts-debugger-show-hide-button { background-image: none; height: 16px; width: 16px; - margin: 3px 2px 2px 2px; + margin: 4px 2px 2px 2px; + border: none; +} + +button.status-bar-item.scripts-debugger-show-hide-button:active { + top: 1px; + right: 15px; } .status-bar-item.scripts-debugger-show-hide-button > .glyph { diff --git a/Source/WebCore/loader/EmptyClients.h b/Source/WebCore/loader/EmptyClients.h index 979a4acd8..a96f26e5f 100644 --- a/Source/WebCore/loader/EmptyClients.h +++ b/Source/WebCore/loader/EmptyClients.h @@ -124,6 +124,8 @@ public: #if ENABLE(PAGE_POPUP) virtual PagePopup* openPagePopup(PagePopupClient*, const IntRect&) OVERRIDE { return 0; } virtual void closePagePopup(PagePopup*) OVERRIDE { } + virtual void setPagePopupDriver(PagePopupDriver*) OVERRIDE { } + virtual void resetPagePopupDriver() OVERRIDE { } #endif #if ENABLE(REGISTER_PROTOCOL_HANDLER) diff --git a/Source/WebCore/loader/MainResourceLoader.cpp b/Source/WebCore/loader/MainResourceLoader.cpp index 8b2204d24..6093652d0 100644 --- a/Source/WebCore/loader/MainResourceLoader.cpp +++ b/Source/WebCore/loader/MainResourceLoader.cpp @@ -57,7 +57,7 @@ #include "PluginDatabase.h" #endif -#if PLATFORM(MAC) && !defined(BUILDING_ON_SNOW_LEOPARD) && !defined(BUILDING_ON_LION) && !PLATFORM(IOS) +#if PLATFORM(MAC) && !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 #include "WebCoreSystemInterface.h" #endif @@ -76,7 +76,7 @@ MainResourceLoader::MainResourceLoader(Frame* frame) , m_loadingMultipartContent(false) , m_waitingForContentPolicy(false) , m_timeOfLastDataReceived(0.0) -#if PLATFORM(MAC) && !defined(BUILDING_ON_SNOW_LEOPARD) && !defined(BUILDING_ON_LION) && !PLATFORM(IOS) +#if PLATFORM(MAC) && !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 , m_filter(0) #endif { @@ -84,7 +84,7 @@ MainResourceLoader::MainResourceLoader(Frame* frame) MainResourceLoader::~MainResourceLoader() { -#if PLATFORM(MAC) && !defined(BUILDING_ON_SNOW_LEOPARD) && !defined(BUILDING_ON_LION) && !PLATFORM(IOS) +#if PLATFORM(MAC) && !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 ASSERT(!m_filter); #endif } @@ -134,7 +134,7 @@ void MainResourceLoader::didCancel(const ResourceError& error) // like calling DOMWindow::print(), during which a half-canceled load could try to finish. documentLoader()->mainReceivedError(error); -#if PLATFORM(MAC) && !defined(BUILDING_ON_SNOW_LEOPARD) && !defined(BUILDING_ON_LION) && !PLATFORM(IOS) +#if PLATFORM(MAC) && !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 if (m_filter) { wkFilterRelease(m_filter); m_filter = 0; @@ -413,7 +413,7 @@ void MainResourceLoader::didReceiveResponse(const ResourceResponse& r) } #endif -#if PLATFORM(MAC) && !defined(BUILDING_ON_SNOW_LEOPARD) && !defined(BUILDING_ON_LION) && !PLATFORM(IOS) +#if PLATFORM(MAC) && !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 if (r.url().protocolIs("https") && wkFilterIsManagedSession()) m_filter = wkFilterCreateInstance(r.nsURLResponse()); #endif @@ -443,7 +443,7 @@ void MainResourceLoader::didReceiveData(const char* data, int length, long long ASSERT(!defersLoading()); #endif -#if PLATFORM(MAC) && !defined(BUILDING_ON_SNOW_LEOPARD) && !defined(BUILDING_ON_LION) && !PLATFORM(IOS) +#if PLATFORM(MAC) && !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 if (m_filter) { ASSERT(!wkFilterWasBlocked(m_filter)); const char* blockedData = wkFilterAddData(m_filter, data, &length); @@ -469,7 +469,7 @@ void MainResourceLoader::didReceiveData(const char* data, int length, long long ResourceLoader::didReceiveData(data, length, encodedDataLength, allAtOnce); -#if PLATFORM(MAC) && !defined(BUILDING_ON_SNOW_LEOPARD) && !defined(BUILDING_ON_LION) && !PLATFORM(IOS) +#if PLATFORM(MAC) && !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 if (WebFilterEvaluator *filter = m_filter) { // If we got here, it means we know if we were blocked or not. If we were blocked, we're // done loading the page altogether. Either way, we don't need the filter anymore. @@ -496,7 +496,7 @@ void MainResourceLoader::didFinishLoading(double finishTime) RefPtr<MainResourceLoader> protect(this); RefPtr<DocumentLoader> dl = documentLoader(); -#if PLATFORM(MAC) && !defined(BUILDING_ON_SNOW_LEOPARD) && !defined(BUILDING_ON_LION) && !PLATFORM(IOS) +#if PLATFORM(MAC) && !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 if (m_filter) { int length; const char* data = wkFilterDataComplete(m_filter, &length); @@ -521,7 +521,7 @@ void MainResourceLoader::didFinishLoading(double finishTime) void MainResourceLoader::didFail(const ResourceError& error) { -#if PLATFORM(MAC) && !defined(BUILDING_ON_SNOW_LEOPARD) && !defined(BUILDING_ON_LION) && !PLATFORM(IOS) +#if PLATFORM(MAC) && !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 if (m_filter) { wkFilterRelease(m_filter); m_filter = 0; diff --git a/Source/WebCore/loader/MainResourceLoader.h b/Source/WebCore/loader/MainResourceLoader.h index f005ddc3a..c3b822249 100644 --- a/Source/WebCore/loader/MainResourceLoader.h +++ b/Source/WebCore/loader/MainResourceLoader.h @@ -34,7 +34,7 @@ #include "SubstituteData.h" #include <wtf/Forward.h> -#if PLATFORM(MAC) && !defined(BUILDING_ON_SNOW_LEOPARD) && !defined(BUILDING_ON_LION) && !PLATFORM(IOS) +#if PLATFORM(MAC) && !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 OBJC_CLASS WebFilterEvaluator; #endif @@ -112,7 +112,7 @@ namespace WebCore { bool m_waitingForContentPolicy; double m_timeOfLastDataReceived; -#if PLATFORM(MAC) && !defined(BUILDING_ON_SNOW_LEOPARD) && !defined(BUILDING_ON_LION) && !PLATFORM(IOS) +#if PLATFORM(MAC) && !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 WebFilterEvaluator *m_filter; #endif }; diff --git a/Source/WebCore/loader/archive/mhtml/MHTMLArchive.cpp b/Source/WebCore/loader/archive/mhtml/MHTMLArchive.cpp index cb9c7e570..cffbef9b3 100644 --- a/Source/WebCore/loader/archive/mhtml/MHTMLArchive.cpp +++ b/Source/WebCore/loader/archive/mhtml/MHTMLArchive.cpp @@ -33,7 +33,6 @@ #if ENABLE(MHTML) #include "MHTMLArchive.h" -#include "Base64.h" #include "Document.h" #include "Frame.h" #include "MHTMLParser.h" @@ -47,6 +46,7 @@ #include <wtf/CryptographicallyRandomNumber.h> #include <wtf/DateMath.h> #include <wtf/StdLibExtras.h> +#include <wtf/text/Base64.h> #include <wtf/text/StringBuilder.h> #if HAVE(SYS_TIME_H) diff --git a/Source/WebCore/loader/archive/mhtml/MHTMLParser.cpp b/Source/WebCore/loader/archive/mhtml/MHTMLParser.cpp index dbb0c8335..fa1a2268d 100644 --- a/Source/WebCore/loader/archive/mhtml/MHTMLParser.cpp +++ b/Source/WebCore/loader/archive/mhtml/MHTMLParser.cpp @@ -33,13 +33,13 @@ #if ENABLE(MHTML) #include "MHTMLParser.h" -#include "Base64.h" #include "MHTMLArchive.h" #include "MIMEHeader.h" #include "MIMETypeRegistry.h" #include "QuotedPrintable.h" #include <wtf/HashMap.h> #include <wtf/NotFound.h> +#include <wtf/text/Base64.h> namespace WebCore { diff --git a/Source/WebCore/loader/cache/CachedResourceLoader.cpp b/Source/WebCore/loader/cache/CachedResourceLoader.cpp index 90060476c..e1987c3fe 100644 --- a/Source/WebCore/loader/cache/CachedResourceLoader.cpp +++ b/Source/WebCore/loader/cache/CachedResourceLoader.cpp @@ -728,14 +728,20 @@ void CachedResourceLoader::preload(CachedResource::Type type, ResourceRequest& r // FIXME: Rip this out when we are sure it is no longer necessary (even for mobile). UNUSED_PARAM(referencedFromBody); - bool hasRendering = m_document->body() && m_document->body()->renderer(); - bool canBlockParser = type == CachedResource::Script || type == CachedResource::CSSStyleSheet; - if (!hasRendering && !canBlockParser) { - // Don't preload subresources that can't block the parser before we have something to draw. - // This helps prevent preloads from delaying first display when bandwidth is limited. - PendingPreload pendingPreload = { type, request, charset }; - m_pendingPreloads.append(pendingPreload); - return; + bool delaySubresourceLoad = true; +#if PLATFORM(IOS) + delaySubresourceLoad = false; +#endif + if (delaySubresourceLoad) { + bool hasRendering = m_document->body() && m_document->body()->renderer(); + bool canBlockParser = type == CachedResource::Script || type == CachedResource::CSSStyleSheet; + if (!hasRendering && !canBlockParser) { + // Don't preload subresources that can't block the parser before we have something to draw. + // This helps prevent preloads from delaying first display when bandwidth is limited. + PendingPreload pendingPreload = { type, request, charset }; + m_pendingPreloads.append(pendingPreload); + return; + } } requestPreload(type, request, charset); } diff --git a/Source/WebCore/page/AlternativeTextClient.h b/Source/WebCore/page/AlternativeTextClient.h index 67245e64d..a81358994 100644 --- a/Source/WebCore/page/AlternativeTextClient.h +++ b/Source/WebCore/page/AlternativeTextClient.h @@ -31,10 +31,10 @@ #include <wtf/Vector.h> #include <wtf/text/WTFString.h> -#if PLATFORM(MAC) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) && !defined(BUILDING_ON_LION) +#if PLATFORM(MAC) && (PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080) // Some platforms provide UI for suggesting alternative dictation text. #define WTF_USE_DICTATION_ALTERNATIVES 1 -#endif // PLATFORM(MAC) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) && !defined(BUILDING_ON_LION) +#endif // PLATFORM(MAC) && (PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080) namespace WebCore { diff --git a/Source/WebCore/page/ChromeClient.h b/Source/WebCore/page/ChromeClient.h index 91c04bf9e..9e7b59696 100644 --- a/Source/WebCore/page/ChromeClient.h +++ b/Source/WebCore/page/ChromeClient.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006, 2007, 2008, 2009 Apple, Inc. All rights reserved. + * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple, Inc. All rights reserved. * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). * Copyright (C) 2012 Samsung Electronics. All rights reserved. * @@ -63,6 +63,7 @@ namespace WebCore { class Page; class PagePopup; class PagePopupClient; + class PagePopupDriver; class PopupMenuClient; class SecurityOrigin; class GraphicsContext3D; @@ -81,6 +82,10 @@ namespace WebCore { class ColorChooserClient; #endif +#if PLATFORM(WIN) && USE(AVFOUNDATION) + struct GraphicsDeviceAdapter; +#endif + class ChromeClient { public: virtual void chromeDestroyed() = 0; @@ -276,6 +281,10 @@ namespace WebCore { virtual CompositingTriggerFlags allowedCompositingTriggers() const { return static_cast<CompositingTriggerFlags>(AllTriggers); } #endif +#if PLATFORM(WIN) && USE(AVFOUNDATION) + virtual GraphicsDeviceAdapter* graphicsDeviceAdapter() const { return 0; } +#endif + virtual bool supportsFullscreenForNode(const Node*) { return false; } virtual void enterFullscreenForNode(Node*) { } virtual void exitFullscreenForNode(Node*) { } @@ -320,6 +329,9 @@ namespace WebCore { // The return value can be 0. virtual PagePopup* openPagePopup(PagePopupClient*, const IntRect& originBoundsInRootView) = 0; virtual void closePagePopup(PagePopup*) = 0; + // For testing. + virtual void setPagePopupDriver(PagePopupDriver*) = 0; + virtual void resetPagePopupDriver() = 0; #endif // This function is called whenever a text field <input> is // created. The implementation should return true if it wants diff --git a/Source/WebCore/page/ContextMenuController.cpp b/Source/WebCore/page/ContextMenuController.cpp index 6e188fdf1..3a8a8dd8a 100644 --- a/Source/WebCore/page/ContextMenuController.cpp +++ b/Source/WebCore/page/ContextMenuController.cpp @@ -703,7 +703,7 @@ static bool selectionContainsPossibleWord(Frame* frame) } #if PLATFORM(MAC) -#if defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED == 1060 #define INCLUDE_SPOTLIGHT_CONTEXT_MENU_ITEM 1 #else #define INCLUDE_SPOTLIGHT_CONTEXT_MENU_ITEM 0 @@ -934,7 +934,7 @@ void ContextMenuController::populate() appendItem(IgnoreGrammarItem, m_contextMenu.get()); appendItem(*separatorItem(), m_contextMenu.get()); haveContextMenuItemsForMisspellingOrGrammer = true; -#if PLATFORM(MAC) && !defined(BUILDING_ON_LEOPARD) +#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 } else { // If the string was autocorrected, generate a contextual menu item allowing it to be changed back. String replacedString = m_hitTestResult.replacedString(); diff --git a/Source/WebCore/page/DOMWindow.cpp b/Source/WebCore/page/DOMWindow.cpp index 895b96258..2e198373e 100644 --- a/Source/WebCore/page/DOMWindow.cpp +++ b/Source/WebCore/page/DOMWindow.cpp @@ -30,7 +30,6 @@ #include "AbstractDatabase.h" #include "BackForwardController.h" #include "BarInfo.h" -#include "Base64.h" #include "BeforeUnloadEvent.h" #include "CSSComputedStyleDeclaration.h" #include "CSSRuleList.h" @@ -99,6 +98,7 @@ #include <wtf/CurrentTime.h> #include <wtf/MainThread.h> #include <wtf/MathExtras.h> +#include <wtf/text/Base64.h> #include <wtf/text/WTFString.h> #if ENABLE(REQUEST_ANIMATION_FRAME) @@ -1070,7 +1070,7 @@ String DOMWindow::atob(const String& encodedString, ExceptionCode& ec) } Vector<char> out; - if (!base64Decode(encodedString, out, FailOnInvalidCharacter)) { + if (!base64Decode(encodedString, out, Base64FailOnInvalidCharacter)) { ec = INVALID_CHARACTER_ERR; return String(); } diff --git a/Source/WebCore/page/EventHandler.cpp b/Source/WebCore/page/EventHandler.cpp index a0c9afc43..8eea3fa65 100644 --- a/Source/WebCore/page/EventHandler.cpp +++ b/Source/WebCore/page/EventHandler.cpp @@ -2290,7 +2290,7 @@ bool EventHandler::dispatchMouseEvent(const AtomicString& eventType, Node* targe } #if !PLATFORM(GTK) && !(PLATFORM(CHROMIUM) && (OS(UNIX) && !OS(DARWIN))) -bool EventHandler::shouldTurnVerticalTicksIntoHorizontal(const HitTestResult&) const +bool EventHandler::shouldTurnVerticalTicksIntoHorizontal(const HitTestResult&, const PlatformWheelEvent&) const { return false; } @@ -2345,7 +2345,7 @@ bool EventHandler::handleWheelEvent(const PlatformWheelEvent& e) // Instead, the handlers should know convert vertical scrolls // appropriately. PlatformWheelEvent event = e; - if (m_baseEventType == PlatformEvent::NoType && shouldTurnVerticalTicksIntoHorizontal(result)) + if (m_baseEventType == PlatformEvent::NoType && shouldTurnVerticalTicksIntoHorizontal(result, e)) event = event.copyTurningVerticalTicksIntoHorizontalTicks(); if (node) { diff --git a/Source/WebCore/page/EventHandler.h b/Source/WebCore/page/EventHandler.h index c72dc0943..32c95b456 100644 --- a/Source/WebCore/page/EventHandler.h +++ b/Source/WebCore/page/EventHandler.h @@ -266,7 +266,7 @@ private: void autoscrollTimerFired(Timer<EventHandler>*); bool logicalScrollOverflow(ScrollLogicalDirection, ScrollGranularity, Node* startingNode = 0); - bool shouldTurnVerticalTicksIntoHorizontal(const HitTestResult&) const; + bool shouldTurnVerticalTicksIntoHorizontal(const HitTestResult&, const PlatformWheelEvent&) const; bool mouseDownMayStartSelect() const { return m_mouseDownMayStartSelect; } static bool isKeyboardOptionTab(KeyboardEvent*); diff --git a/Source/WebCore/page/Page.cpp b/Source/WebCore/page/Page.cpp index d30900f60..c45e532f1 100644 --- a/Source/WebCore/page/Page.cpp +++ b/Source/WebCore/page/Page.cpp @@ -23,7 +23,6 @@ #include "AlternativeTextClient.h" #include "BackForwardController.h" #include "BackForwardList.h" -#include "Base64.h" #include "Chrome.h" #include "ChromeClient.h" #include "ContextMenuClient.h" @@ -77,6 +76,7 @@ #include <wtf/HashMap.h> #include <wtf/RefCountedLeakCounter.h> #include <wtf/StdLibExtras.h> +#include <wtf/text/Base64.h> #include <wtf/text/StringHash.h> namespace WebCore { @@ -790,7 +790,7 @@ void Page::userStyleSheetLocationChanged() m_didLoadUserStyleSheet = true; Vector<char> styleSheetAsUTF8; - if (base64Decode(decodeURLEscapeSequences(url.string().substring(35)), styleSheetAsUTF8, IgnoreWhitespace)) + if (base64Decode(decodeURLEscapeSequences(url.string().substring(35)), styleSheetAsUTF8, Base64IgnoreWhitespace)) m_userStyleSheet = String::fromUTF8(styleSheetAsUTF8.data(), styleSheetAsUTF8.size()); } diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCCheckerboardDrawQuad.cpp b/Source/WebCore/page/PagePopupDriver.h index aae033514..695d622c8 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCCheckerboardDrawQuad.cpp +++ b/Source/WebCore/page/PagePopupDriver.h @@ -23,20 +23,21 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "config.h" - -#include "cc/CCCheckerboardDrawQuad.h" +#ifndef PagePopupDriver_h +#define PagePopupDriver_h namespace WebCore { -PassOwnPtr<CCCheckerboardDrawQuad> CCCheckerboardDrawQuad::create(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect) -{ - return adoptPtr(new CCCheckerboardDrawQuad(sharedQuadState, quadRect)); -} +class IntRect; +class PagePopup; +class PagePopupClient; -CCCheckerboardDrawQuad::CCCheckerboardDrawQuad(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect) - : CCDrawQuad(sharedQuadState, CCDrawQuad::Checkerboard, quadRect) -{ -} +class PagePopupDriver { +public: + virtual PagePopup* openPagePopup(PagePopupClient*, const IntRect& originBoundsInRootView) = 0; + virtual void closePagePopup(PagePopup*) = 0; + virtual ~PagePopupDriver() { } +}; } +#endif diff --git a/Source/WebCore/page/PointerLockController.cpp b/Source/WebCore/page/PointerLockController.cpp index c250cb7be..abbfc80f4 100644 --- a/Source/WebCore/page/PointerLockController.cpp +++ b/Source/WebCore/page/PointerLockController.cpp @@ -48,15 +48,12 @@ PassOwnPtr<PointerLockController> PointerLockController::create(Page* page) void PointerLockController::requestPointerLock(Element* target, PassRefPtr<VoidCallback> successCallback, PassRefPtr<VoidCallback> failureCallback) { - if (!target) - return; - - if (!target->inDocument()) { + if (!target || !target->inDocument() || m_documentOfRemovedElementWhileWaitingForUnlock) { enqueueEvent(eventNames().webkitpointerlockerrorEvent, target); return; } - if (isLocked()) { + if (m_element) { // FIXME: Keep enqueueEvent usage. (https://bugs.webkit.org/show_bug.cgi?id=84402) enqueueEvent(eventNames().webkitpointerlockchangeEvent, target); if (m_element->document() != target->document()) @@ -91,6 +88,25 @@ void PointerLockController::requestPointerUnlock() return m_page->chrome()->client()->requestPointerUnlock(); } +void PointerLockController::elementRemoved(Element* element) +{ + if (m_element == element) { + m_documentOfRemovedElementWhileWaitingForUnlock = m_element->document(); + // Set element null immediately to block any future interaction with it + // including mouse events received before the unlock completes. + m_element = 0; + requestPointerUnlock(); + } +} + +void PointerLockController::documentDetached(Document* document) +{ + if (m_element && m_element->document() == document) { + m_element = 0; + requestPointerUnlock(); + } +} + bool PointerLockController::isLocked() { return m_page->chrome()->client()->isPointerLocked(); @@ -136,11 +152,12 @@ void PointerLockController::didLosePointerLock(bool sendChangeEvent) { // FIXME: Keep enqueueEvent usage. (https://bugs.webkit.org/show_bug.cgi?id=84402) if (sendChangeEvent) - enqueueEvent(eventNames().webkitpointerlockchangeEvent, m_element.get()); + enqueueEvent(eventNames().webkitpointerlockchangeEvent, m_element ? m_element->document() : m_documentOfRemovedElementWhileWaitingForUnlock.get()); // FIXME: Remove callback usage. (https://bugs.webkit.org/show_bug.cgi?id=84402) RefPtr<Element> elementToNotify(m_element); m_element = 0; + m_documentOfRemovedElementWhileWaitingForUnlock = 0; m_successCallback = 0; m_failureCallback = 0; if (elementToNotify && elementToNotify->document()->frame()) @@ -161,9 +178,14 @@ void PointerLockController::dispatchLockedMouseEvent(const PlatformMouseEvent& e void PointerLockController::enqueueEvent(const AtomicString& type, Element* element) { - if (!element) - return; - element->document()->enqueueDocumentEvent(Event::create(type, true, false)); + if (element) + enqueueEvent(type, element->document()); +} + +void PointerLockController::enqueueEvent(const AtomicString& type, Document* document) +{ + if (document) + document->enqueueDocumentEvent(Event::create(type, true, false)); } } // namespace WebCore diff --git a/Source/WebCore/page/PointerLockController.h b/Source/WebCore/page/PointerLockController.h index 55cf6eea1..991754e45 100644 --- a/Source/WebCore/page/PointerLockController.h +++ b/Source/WebCore/page/PointerLockController.h @@ -33,6 +33,7 @@ namespace WebCore { class Element; +class Document; class Page; class PlatformMouseEvent; class VoidCallback; @@ -45,7 +46,9 @@ public: void requestPointerLock(Element* target, PassRefPtr<VoidCallback> successCallback, PassRefPtr<VoidCallback> failureCallback); void requestPointerUnlock(); - bool isLocked(); + void elementRemoved(Element*); + void documentDetached(Document*); + bool isLocked(); // FIXME: Rename to isClientLocked and move to private when removing old API. (https://bugs.webkit.org/show_bug.cgi?id=84402) Element* element() const; void didAcquirePointerLock(); @@ -56,8 +59,10 @@ public: private: explicit PointerLockController(Page*); void enqueueEvent(const AtomicString& type, Element*); + void enqueueEvent(const AtomicString& type, Document*); Page* m_page; RefPtr<Element> m_element; + RefPtr<Document> m_documentOfRemovedElementWhileWaitingForUnlock; // FIXME: Remove callback usage. (https://bugs.webkit.org/show_bug.cgi?id=84402) RefPtr<VoidCallback> m_successCallback; diff --git a/Source/WebCore/page/chromium/EventHandlerChromium.cpp b/Source/WebCore/page/chromium/EventHandlerChromium.cpp index 97c1cbe73..05080f629 100644 --- a/Source/WebCore/page/chromium/EventHandlerChromium.cpp +++ b/Source/WebCore/page/chromium/EventHandlerChromium.cpp @@ -158,9 +158,9 @@ unsigned EventHandler::accessKeyModifiers() // GTK+ must scroll horizontally if the mouse pointer is on top of the // horizontal scrollbar while scrolling with the wheel. // This code comes from gtk/EventHandlerGtk.cpp. -bool EventHandler::shouldTurnVerticalTicksIntoHorizontal(const HitTestResult& result) const +bool EventHandler::shouldTurnVerticalTicksIntoHorizontal(const HitTestResult& result, const PlatformWheelEvent& event) const { - return result.scrollbar() && result.scrollbar()->orientation() == HorizontalScrollbar; + return !event.hasPreciseScrollingDeltas() && result.scrollbar() && result.scrollbar()->orientation() == HorizontalScrollbar; } #endif diff --git a/Source/WebCore/page/gtk/EventHandlerGtk.cpp b/Source/WebCore/page/gtk/EventHandlerGtk.cpp index 4386a4de3..7e83eb610 100644 --- a/Source/WebCore/page/gtk/EventHandlerGtk.cpp +++ b/Source/WebCore/page/gtk/EventHandlerGtk.cpp @@ -126,7 +126,7 @@ unsigned EventHandler::accessKeyModifiers() // horizontal scrollbar while scrolling with the wheel; we need to // add the deltas and ticks here so that this behavior is consistent // for styled scrollbars. -bool EventHandler::shouldTurnVerticalTicksIntoHorizontal(const HitTestResult& result) const +bool EventHandler::shouldTurnVerticalTicksIntoHorizontal(const HitTestResult& result, const PlatformWheelEvent&) const { return result.scrollbar() && result.scrollbar()->orientation() == HorizontalScrollbar; } diff --git a/Source/WebCore/page/mac/SettingsMac.mm b/Source/WebCore/page/mac/SettingsMac.mm index 23b792583..04bf49984 100644 --- a/Source/WebCore/page/mac/SettingsMac.mm +++ b/Source/WebCore/page/mac/SettingsMac.mm @@ -69,7 +69,7 @@ void Settings::initializeDefaultFontFamilies() setStandardFontFamily("Apple SD Gothic Neo", USCRIPT_HANGUL); setSerifFontFamily("Apple SD Gothic Neo", USCRIPT_HANGUL); #endif -#if !defined(BUILDING_ON_SNOW_LEOPARD) && !defined(BUILDING_ON_LION) +#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 setFixedFontFamily("Apple SD Gothic Neo", USCRIPT_HANGUL); setSansSerifFontFamily("Apple SD Gothic Neo", USCRIPT_HANGUL); #else diff --git a/Source/WebCore/platform/Decimal.cpp b/Source/WebCore/platform/Decimal.cpp index 263cbeebf..3bb6570b5 100644 --- a/Source/WebCore/platform/Decimal.cpp +++ b/Source/WebCore/platform/Decimal.cpp @@ -628,7 +628,7 @@ Decimal Decimal::ceiling() const const int numberOfDigits = countDigits(result); const int numberOfDropDigits = -exponent(); if (numberOfDigits < numberOfDropDigits) - return zero(Positive); + return isPositive() ? Decimal(1) : zero(Positive); result = scaleDown(result, numberOfDropDigits - 1); if (sign() == Positive && result % 10 > 0) @@ -670,7 +670,7 @@ Decimal Decimal::floor() const const int numberOfDigits = countDigits(result); const int numberOfDropDigits = -exponent(); if (numberOfDigits < numberOfDropDigits) - return zero(Positive); + return isPositive() ? zero(Positive) : Decimal(-1); result = scaleDown(result, numberOfDropDigits - 1); if (isNegative() && result % 10 > 0) diff --git a/Source/WebCore/platform/LocalizedStrings.cpp b/Source/WebCore/platform/LocalizedStrings.cpp index 9c4bdf3f9..e79b518e9 100644 --- a/Source/WebCore/platform/LocalizedStrings.cpp +++ b/Source/WebCore/platform/LocalizedStrings.cpp @@ -72,7 +72,7 @@ static String formatLocalizedString(String format, ...) #endif } -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if !PLATFORM(MAC) || PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 static String truncatedStringForLookupMenuItem(const String& original) { if (original.isEmpty()) @@ -244,7 +244,7 @@ String contextMenuItemTagSearchInSpotlight() String contextMenuItemTagSearchWeb() { -#if PLATFORM(MAC) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if PLATFORM(MAC) && (PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070) RetainPtr<CFStringRef> searchProviderName(AdoptCF, wkCopyDefaultSearchProviderDisplayName()); return formatLocalizedString(WEB_UI_STRING("Search with %@", "Search with search provider context menu item with provider name inserted"), searchProviderName.get()); #else @@ -254,7 +254,7 @@ String contextMenuItemTagSearchWeb() String contextMenuItemTagLookUpInDictionary(const String& selectedString) { -#if defined(BUILDING_ON_LEOPARD) || defined(BUILDING_ON_SNOW_LEOPARD) +#if PLATFORM(MAC) && !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED <= 1060 UNUSED_PARAM(selectedString); return WEB_UI_STRING("Look Up in Dictionary", "Look Up in Dictionary context menu item"); #else @@ -755,7 +755,7 @@ String htmlSelectMultipleItems(size_t count) String imageTitle(const String& filename, const IntSize& size) { #if USE(CF) -#if !defined(BUILDING_ON_LEOPARD) +#if !PLATFORM(MAC) || PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 RetainPtr<CFStringRef> filenameCFString(AdoptCF, filename.createCFString()); RetainPtr<CFLocaleRef> locale(AdoptCF, CFLocaleCopyCurrent()); RetainPtr<CFNumberFormatterRef> formatter(AdoptCF, CFNumberFormatterCreate(0, locale.get(), kCFNumberFormatterDecimalStyle)); diff --git a/Source/WebCore/platform/MemoryPressureHandler.cpp b/Source/WebCore/platform/MemoryPressureHandler.cpp index 15e680862..614ec36d6 100644 --- a/Source/WebCore/platform/MemoryPressureHandler.cpp +++ b/Source/WebCore/platform/MemoryPressureHandler.cpp @@ -42,7 +42,7 @@ MemoryPressureHandler::MemoryPressureHandler() { } -#if !PLATFORM(MAC) || defined(BUILDING_ON_SNOW_LEOPARD) || PLATFORM(IOS) +#if !PLATFORM(MAC) || PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED == 1060 void MemoryPressureHandler::install() { } void MemoryPressureHandler::uninstall() { } diff --git a/Source/WebCore/platform/PlatformScreen.h b/Source/WebCore/platform/PlatformScreen.h index df989a10b..1111f9d6a 100644 --- a/Source/WebCore/platform/PlatformScreen.h +++ b/Source/WebCore/platform/PlatformScreen.h @@ -52,8 +52,7 @@ namespace WebCore { FloatRect screenRect(Widget*); FloatRect screenAvailableRect(Widget*); - // type can be "monitor" or the name of a profile such as "sRGB" or "Adobe RGB". - void screenColorProfile(Widget*, ColorProfile&); + void screenColorProfile(ColorProfile&); #if PLATFORM(MAC) NSScreen *screenForWindow(NSWindow *); diff --git a/Source/WebCore/platform/ScrollAnimator.cpp b/Source/WebCore/platform/ScrollAnimator.cpp index 15c46a116..74fd3616e 100644 --- a/Source/WebCore/platform/ScrollAnimator.cpp +++ b/Source/WebCore/platform/ScrollAnimator.cpp @@ -91,7 +91,7 @@ bool ScrollAnimator::handleWheelEvent(const PlatformWheelEvent& e) bool handled = false; -#if PLATFORM(CHROMIUM) +#if PLATFORM(CHROMIUM) && !OS(DARWIN) ScrollGranularity granularity = e.hasPreciseScrollingDeltas() ? ScrollByPrecisePixel : ScrollByPixel; #else ScrollGranularity granularity = ScrollByPixel; diff --git a/Source/WebCore/platform/audio/mac/AudioBusMac.mm b/Source/WebCore/platform/audio/mac/AudioBusMac.mm index b47f953e2..45fb41755 100644 --- a/Source/WebCore/platform/audio/mac/AudioBusMac.mm +++ b/Source/WebCore/platform/audio/mac/AudioBusMac.mm @@ -49,7 +49,7 @@ PassOwnPtr<AudioBus> AudioBus::loadPlatformResource(const char* name, float samp NSBundle *bundle = [NSBundle bundleForClass:[WebCoreAudioBundleClass class]]; NSURL *audioFileURL = [bundle URLForResource:[NSString stringWithUTF8String:name] withExtension:@"wav" subdirectory:@"audio"]; -#if defined(BUILDING_ON_SNOW_LEOPARD) +#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1060 NSDataReadingOptions options = NSDataReadingMapped; #else NSDataReadingOptions options = NSDataReadingMappedIfSafe; diff --git a/Source/WebCore/platform/blackberry/CookieDatabaseBackingStore/CookieDatabaseBackingStore.cpp b/Source/WebCore/platform/blackberry/CookieDatabaseBackingStore/CookieDatabaseBackingStore.cpp index a76c04184..770843585 100644 --- a/Source/WebCore/platform/blackberry/CookieDatabaseBackingStore/CookieDatabaseBackingStore.cpp +++ b/Source/WebCore/platform/blackberry/CookieDatabaseBackingStore/CookieDatabaseBackingStore.cpp @@ -218,6 +218,8 @@ void CookieDatabaseBackingStore::invokeOpen(const String& cookieJar) // This table schema is compliant with Mozilla's. createTableQuery += " (" + databaseFields + ", " + primaryKeyFields+");"; + m_db.setBusyTimeout(1000); + if (!m_db.executeCommand(createTableQuery)) { LOG_ERROR("Could not create the table to store the cookies into. No cookie will be stored!"); LOG_ERROR("SQLite Error Message: %s", m_db.lastErrorMsg()); @@ -346,7 +348,8 @@ void CookieDatabaseBackingStore::getCookiesFromDatabase(Vector<ParsedCookie*>& s TypedReplyBuffer< Vector<ParsedCookie*>* > replyBuffer(0); dispatchMessage(createMethodCallMessageWithReturn(&CookieDatabaseBackingStore::invokeGetCookiesWithLimit, &replyBuffer, this, limit)); Vector<ParsedCookie*>* cookies = replyBuffer.pointer(); - stackOfCookies.swap(*cookies); + if (cookies) + stackOfCookies.swap(*cookies); delete cookies; } diff --git a/Source/WebCore/platform/blackberry/PageClientBlackBerry.h b/Source/WebCore/platform/blackberry/PageClientBlackBerry.h index 8a1f8870f..752bdb693 100644 --- a/Source/WebCore/platform/blackberry/PageClientBlackBerry.h +++ b/Source/WebCore/platform/blackberry/PageClientBlackBerry.h @@ -72,6 +72,7 @@ public: virtual bool isVisible() const = 0; virtual bool authenticationChallenge(const WebCore::KURL&, const WebCore::ProtectionSpace&, WebCore::Credential&) = 0; virtual SaveCredentialType notifyShouldSaveCredential(bool) = 0; + virtual void syncProxyCredential(const WebCore::Credential&) = 0; }; #endif // PageClientBlackBerry_h diff --git a/Source/WebCore/platform/blackberry/PlatformScreenBlackBerry.cpp b/Source/WebCore/platform/blackberry/PlatformScreenBlackBerry.cpp index 592539cd4..1d8703156 100644 --- a/Source/WebCore/platform/blackberry/PlatformScreenBlackBerry.cpp +++ b/Source/WebCore/platform/blackberry/PlatformScreenBlackBerry.cpp @@ -64,7 +64,7 @@ FloatRect screenRect(Widget* widget) return FloatRect(FloatPoint(), FloatSize(IntSize(BlackBerry::Platform::Graphics::Screen::primaryScreen()->size()))); } -void screenColorProfile(Widget*, ColorProfile&) +void screenColorProfile(ColorProfile&) { notImplemented(); } diff --git a/Source/WebCore/platform/chromium/PlatformScreenChromium.cpp b/Source/WebCore/platform/chromium/PlatformScreenChromium.cpp index 46f33dafd..54d58da13 100644 --- a/Source/WebCore/platform/chromium/PlatformScreenChromium.cpp +++ b/Source/WebCore/platform/chromium/PlatformScreenChromium.cpp @@ -73,9 +73,8 @@ FloatRect screenAvailableRect(Widget* widget) return PlatformSupport::screenAvailableRect(widget); } -void screenColorProfile(Widget*, ColorProfile& toProfile) +void screenColorProfile(ColorProfile& toProfile) { - // FIXME: Add support for multiple monitors. WebKit::WebVector<char> profile; WebKit::Platform::current()->screenColorProfile(&profile); toProfile.append(profile.data(), profile.size()); diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCIOSurfaceDrawQuad.cpp b/Source/WebCore/platform/chromium/support/WebCompositorCheckerboardQuad.cpp index 2fdb4efcb..970db2b84 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCIOSurfaceDrawQuad.cpp +++ b/Source/WebCore/platform/chromium/support/WebCompositorCheckerboardQuad.cpp @@ -25,20 +25,27 @@ #include "config.h" -#include "cc/CCIOSurfaceDrawQuad.h" +#include <public/WebCompositorCheckerboardQuad.h> -namespace WebCore { +using namespace WebCore; -PassOwnPtr<CCIOSurfaceDrawQuad> CCIOSurfaceDrawQuad::create(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect, const IntSize& ioSurfaceSize, unsigned ioSurfaceTextureId) +namespace WebKit { + +PassOwnPtr<WebCompositorCheckerboardQuad> WebCompositorCheckerboardQuad::create(const WebCompositorSharedQuadState* sharedQuadState, const IntRect& quadRect) { - return adoptPtr(new CCIOSurfaceDrawQuad(sharedQuadState, quadRect, ioSurfaceSize, ioSurfaceTextureId)); + return adoptPtr(new WebCompositorCheckerboardQuad(sharedQuadState, quadRect)); } -CCIOSurfaceDrawQuad::CCIOSurfaceDrawQuad(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect, const IntSize& ioSurfaceSize, unsigned ioSurfaceTextureId) - : CCDrawQuad(sharedQuadState, CCDrawQuad::IOSurfaceContent, quadRect) - , m_ioSurfaceSize(ioSurfaceSize) - , m_ioSurfaceTextureId(ioSurfaceTextureId) +WebCompositorCheckerboardQuad::WebCompositorCheckerboardQuad(const WebCompositorSharedQuadState* sharedQuadState, const IntRect& quadRect) + : WebCompositorQuad(sharedQuadState, WebCompositorQuad::Checkerboard, quadRect) { } +const WebCompositorCheckerboardQuad* WebCompositorCheckerboardQuad::materialCast(const WebCompositorQuad* quad) +{ + ASSERT(quad->material() == WebCompositorQuad::Checkerboard); + return static_cast<const WebCompositorCheckerboardQuad*>(quad); +} + + } diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCDebugBorderDrawQuad.cpp b/Source/WebCore/platform/chromium/support/WebCompositorDebugBorderQuad.cpp index 1527c47c5..179f6c14f 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCDebugBorderDrawQuad.cpp +++ b/Source/WebCore/platform/chromium/support/WebCompositorDebugBorderQuad.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011 Google Inc. All rights reserved. + * Copyright (C) 2012 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -25,17 +25,19 @@ #include "config.h" -#include "cc/CCDebugBorderDrawQuad.h" +#include <public/WebCompositorDebugBorderQuad.h> -namespace WebCore { +using namespace WebCore; -PassOwnPtr<CCDebugBorderDrawQuad> CCDebugBorderDrawQuad::create(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect, SkColor color, int width) +namespace WebKit { + +PassOwnPtr<WebCompositorDebugBorderQuad> WebCompositorDebugBorderQuad::create(const WebCompositorSharedQuadState* sharedQuadState, const IntRect& quadRect, SkColor color, int width) { - return adoptPtr(new CCDebugBorderDrawQuad(sharedQuadState, quadRect, color, width)); + return adoptPtr(new WebCompositorDebugBorderQuad(sharedQuadState, quadRect, color, width)); } -CCDebugBorderDrawQuad::CCDebugBorderDrawQuad(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect, SkColor color, int width) - : CCDrawQuad(sharedQuadState, CCDrawQuad::DebugBorder, quadRect) +WebCompositorDebugBorderQuad::WebCompositorDebugBorderQuad(const WebCompositorSharedQuadState* sharedQuadState, const IntRect& quadRect, SkColor color, int width) + : WebCompositorQuad(sharedQuadState, WebCompositorQuad::DebugBorder, quadRect) , m_color(color) , m_width(width) { @@ -44,4 +46,10 @@ CCDebugBorderDrawQuad::CCDebugBorderDrawQuad(const CCSharedQuadState* sharedQuad m_needsBlending = true; } +const WebCompositorDebugBorderQuad* WebCompositorDebugBorderQuad::materialCast(const WebCompositorQuad* quad) +{ + ASSERT(quad->material() == WebCompositorQuad::DebugBorder); + return static_cast<const WebCompositorDebugBorderQuad*>(quad); +} + } diff --git a/Source/WebCore/platform/chromium/support/WebCompositorIOSurfaceQuad.cpp b/Source/WebCore/platform/chromium/support/WebCompositorIOSurfaceQuad.cpp new file mode 100644 index 000000000..63a29314d --- /dev/null +++ b/Source/WebCore/platform/chromium/support/WebCompositorIOSurfaceQuad.cpp @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2012 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" + +#include <public/WebCompositorIOSurfaceQuad.h> + +using namespace WebCore; + +namespace WebKit { + +PassOwnPtr<WebCompositorIOSurfaceQuad> WebCompositorIOSurfaceQuad::create(const WebCompositorSharedQuadState* sharedQuadState, const IntRect& quadRect, const IntSize& ioSurfaceSize, unsigned ioSurfaceTextureId) +{ + return adoptPtr(new WebCompositorIOSurfaceQuad(sharedQuadState, quadRect, ioSurfaceSize, ioSurfaceTextureId)); +} + +WebCompositorIOSurfaceQuad::WebCompositorIOSurfaceQuad(const WebCompositorSharedQuadState* sharedQuadState, const IntRect& quadRect, const IntSize& ioSurfaceSize, unsigned ioSurfaceTextureId) + : WebCompositorQuad(sharedQuadState, WebCompositorQuad::IOSurfaceContent, quadRect) + , m_ioSurfaceSize(ioSurfaceSize) + , m_ioSurfaceTextureId(ioSurfaceTextureId) +{ +} + +const WebCompositorIOSurfaceQuad* WebCompositorIOSurfaceQuad::materialCast(const WebCompositorQuad* quad) +{ + ASSERT(quad->material() == WebCompositorQuad::IOSurfaceContent); + return static_cast<const WebCompositorIOSurfaceQuad*>(quad); +} + +} diff --git a/Source/WebCore/platform/chromium/support/WebCompositorQuad.cpp b/Source/WebCore/platform/chromium/support/WebCompositorQuad.cpp new file mode 100644 index 000000000..7a02ca0ea --- /dev/null +++ b/Source/WebCore/platform/chromium/support/WebCompositorQuad.cpp @@ -0,0 +1,97 @@ +/* + * Copyright (C) 2012 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include <public/WebCompositorQuad.h> + +#include "IntRect.h" +#include <public/WebCompositorCheckerboardQuad.h> +#include <public/WebCompositorDebugBorderQuad.h> +#include <public/WebCompositorIOSurfaceQuad.h> +#include <public/WebCompositorSolidColorQuad.h> +#include <public/WebCompositorStreamVideoQuad.h> +#include <public/WebCompositorTextureQuad.h> +#include <public/WebCompositorTileQuad.h> + +using namespace WebCore; + +namespace WebKit { + +WebCompositorQuad::WebCompositorQuad(const WebCompositorSharedQuadState* sharedQuadState, Material material, const IntRect& quadRect) + : m_sharedQuadState(sharedQuadState) + , m_material(material) + , m_quadRect(quadRect) + , m_quadVisibleRect(quadRect) + , m_quadOpaque(true) + , m_needsBlending(false) +{ + ASSERT(m_sharedQuadState); + ASSERT(m_material != Invalid); +} + +IntRect WebCompositorQuad::opaqueRect() const +{ + if (opacity() != 1) + return IntRect(); + if (m_sharedQuadState->opaque && m_quadOpaque) + return m_quadRect; + return m_opaqueRect; +} + +void WebCompositorQuad::setQuadVisibleRect(const IntRect& quadVisibleRect) +{ + IntRect intersection = quadVisibleRect; + intersection.intersect(m_quadRect); + m_quadVisibleRect = intersection; +} + +unsigned WebCompositorQuad::size() const +{ + switch (material()) { + case Checkerboard: + return sizeof(WebCompositorCheckerboardQuad); + case DebugBorder: + return sizeof(WebCompositorDebugBorderQuad); + case IOSurfaceContent: + return sizeof(WebCompositorIOSurfaceQuad); + case TextureContent: + return sizeof(WebCompositorTextureQuad); + case SolidColor: + return sizeof(WebCompositorSolidColorQuad); + case TiledContent: + return sizeof(WebCompositorTileQuad); + case StreamVideoContent: + return sizeof(WebCompositorStreamVideoQuad); + case Invalid: + case RenderPass: + case YUVVideoContent: + break; + } + + CRASH(); + return sizeof(WebCompositorQuad); +} + +} diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCSharedQuadState.cpp b/Source/WebCore/platform/chromium/support/WebCompositorSharedQuadState.cpp index 5e0681ff5..313564c00 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCSharedQuadState.cpp +++ b/Source/WebCore/platform/chromium/support/WebCompositorSharedQuadState.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011 Google Inc. All rights reserved. + * Copyright (C) 2012 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -25,35 +25,42 @@ #include "config.h" -#include "cc/CCSharedQuadState.h" +#include <public/WebCompositorSharedQuadState.h> +#include "FloatQuad.h" #include "cc/CCMathUtil.h" -using WebKit::WebTransformationMatrix; +using WebCore::FloatQuad; +using WebCore::IntRect; -namespace WebCore { +namespace WebKit { -PassOwnPtr<CCSharedQuadState> CCSharedQuadState::create(const WebTransformationMatrix& quadTransform, const WebTransformationMatrix& layerTransform, const IntRect& layerRect, const IntRect& scissorRect, float opacity, bool opaque) +WebCompositorSharedQuadState::WebCompositorSharedQuadState() + : opacity(0) + , opaque(false) { - return adoptPtr(new CCSharedQuadState(quadTransform, layerTransform, layerRect, scissorRect, opacity, opaque)); } -CCSharedQuadState::CCSharedQuadState(const WebTransformationMatrix& quadTransform, const WebTransformationMatrix& layerTransform, const IntRect& layerRect, const IntRect& scissorRect, float opacity, bool opaque) - : m_quadTransform(quadTransform) - , m_layerTransform(layerTransform) - , m_layerRect(layerRect) - , m_scissorRect(scissorRect) - , m_opacity(opacity) - , m_opaque(opaque) +PassOwnPtr<WebCompositorSharedQuadState> WebCompositorSharedQuadState::create(const WebTransformationMatrix& quadTransform, const IntRect& visibleContentRect, const IntRect& scissorRect, float opacity, bool opaque) { + return adoptPtr(new WebCompositorSharedQuadState(quadTransform, visibleContentRect, scissorRect, opacity, opaque)); } -bool CCSharedQuadState::isLayerAxisAlignedIntRect() const +WebCompositorSharedQuadState::WebCompositorSharedQuadState(const WebTransformationMatrix& quadTransform, const IntRect& visibleContentRect, const IntRect& scissorRect, float opacity, bool opaque) + : quadTransform(quadTransform) + , visibleContentRect(visibleContentRect) + , scissorRect(scissorRect) + , opacity(opacity) + , opaque(opaque) +{ +} + +bool WebCompositorSharedQuadState::isLayerAxisAlignedIntRect() const { // Note: this doesn't consider window or projection matrices. // Assume that they're orthonormal and have integer scales and translations. bool clipped = false; - FloatQuad quad = CCMathUtil::mapQuad(quadTransform(), FloatQuad(layerRect()), clipped); + FloatQuad quad = WebCore::CCMathUtil::mapQuad(quadTransform, FloatQuad(IntRect(visibleContentRect)), clipped); return !clipped && quad.isRectilinear() && quad.boundingBox().isExpressibleAsIntRect(); } diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCSolidColorDrawQuad.cpp b/Source/WebCore/platform/chromium/support/WebCompositorSolidColorQuad.cpp index 8668369b6..782458c72 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCSolidColorDrawQuad.cpp +++ b/Source/WebCore/platform/chromium/support/WebCompositorSolidColorQuad.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011 Google Inc. All rights reserved. + * Copyright (C) 2012 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -25,17 +25,19 @@ #include "config.h" -#include "cc/CCSolidColorDrawQuad.h" +#include <public/WebCompositorSolidColorQuad.h> -namespace WebCore { +using namespace WebCore; -PassOwnPtr<CCSolidColorDrawQuad> CCSolidColorDrawQuad::create(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect, SkColor color) +namespace WebKit { + +PassOwnPtr<WebCompositorSolidColorQuad> WebCompositorSolidColorQuad::create(const WebKit::WebCompositorSharedQuadState* sharedQuadState, const IntRect& quadRect, SkColor color) { - return adoptPtr(new CCSolidColorDrawQuad(sharedQuadState, quadRect, color)); + return adoptPtr(new WebCompositorSolidColorQuad(sharedQuadState, quadRect, color)); } -CCSolidColorDrawQuad::CCSolidColorDrawQuad(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect, SkColor color) - : CCDrawQuad(sharedQuadState, CCDrawQuad::SolidColor, quadRect) +WebCompositorSolidColorQuad::WebCompositorSolidColorQuad(const WebKit::WebCompositorSharedQuadState* sharedQuadState, const IntRect& quadRect, SkColor color) + : WebCompositorQuad(sharedQuadState, WebCompositorQuad::SolidColor, quadRect) , m_color(color) { if (SkColorGetA(m_color) < 255) @@ -44,4 +46,10 @@ CCSolidColorDrawQuad::CCSolidColorDrawQuad(const CCSharedQuadState* sharedQuadSt m_opaqueRect = quadRect; } +const WebCompositorSolidColorQuad* WebCompositorSolidColorQuad::materialCast(const WebCompositorQuad* quad) +{ + ASSERT(quad->material() == WebCompositorQuad::SolidColor); + return static_cast<const WebCompositorSolidColorQuad*>(quad); +} + } diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCTextureDrawQuad.cpp b/Source/WebCore/platform/chromium/support/WebCompositorStreamVideoQuad.cpp index bdbca95fb..ae257aaf7 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCTextureDrawQuad.cpp +++ b/Source/WebCore/platform/chromium/support/WebCompositorStreamVideoQuad.cpp @@ -25,27 +25,28 @@ #include "config.h" -#include "cc/CCTextureDrawQuad.h" +#include <public/WebCompositorStreamVideoQuad.h> -namespace WebCore { +using namespace WebCore; -PassOwnPtr<CCTextureDrawQuad> CCTextureDrawQuad::create(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect, unsigned textureId, bool premultipliedAlpha, const FloatRect& uvRect, bool flipped) +namespace WebKit { + +PassOwnPtr<WebCompositorStreamVideoQuad> WebCompositorStreamVideoQuad::create(const WebCompositorSharedQuadState* sharedQuadState, const IntRect& quadRect, unsigned textureId, const WebTransformationMatrix& matrix) { - return adoptPtr(new CCTextureDrawQuad(sharedQuadState, quadRect, textureId, premultipliedAlpha, uvRect, flipped)); + return adoptPtr(new WebCompositorStreamVideoQuad(sharedQuadState, quadRect, textureId, matrix)); } -CCTextureDrawQuad::CCTextureDrawQuad(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect, unsigned textureId, bool premultipliedAlpha, const FloatRect& uvRect, bool flipped) - : CCDrawQuad(sharedQuadState, CCDrawQuad::TextureContent, quadRect) +WebCompositorStreamVideoQuad::WebCompositorStreamVideoQuad(const WebCompositorSharedQuadState* sharedQuadState, const IntRect& quadRect, unsigned textureId, const WebTransformationMatrix& matrix) + : WebCompositorQuad(sharedQuadState, WebCompositorQuad::StreamVideoContent, quadRect) , m_textureId(textureId) - , m_premultipliedAlpha(premultipliedAlpha) - , m_uvRect(uvRect) - , m_flipped(flipped) + , m_matrix(matrix) { } -void CCTextureDrawQuad::setNeedsBlending() +const WebCompositorStreamVideoQuad* WebCompositorStreamVideoQuad::materialCast(const WebCompositorQuad* quad) { - m_needsBlending = true; + ASSERT(quad->material() == WebCompositorQuad::StreamVideoContent); + return static_cast<const WebCompositorStreamVideoQuad*>(quad); } } diff --git a/Source/WebCore/platform/chromium/support/WebCompositorTextureQuad.cpp b/Source/WebCore/platform/chromium/support/WebCompositorTextureQuad.cpp new file mode 100644 index 000000000..e5f45fdc4 --- /dev/null +++ b/Source/WebCore/platform/chromium/support/WebCompositorTextureQuad.cpp @@ -0,0 +1,59 @@ +/* + * Copyright (C) 2012 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" + +#include <public/WebCompositorTextureQuad.h> + +using namespace WebCore; + +namespace WebKit { + +PassOwnPtr<WebCompositorTextureQuad> WebCompositorTextureQuad::create(const WebKit::WebCompositorSharedQuadState* sharedQuadState, const IntRect& quadRect, unsigned textureId, bool premultipliedAlpha, const FloatRect& uvRect, bool flipped) +{ + return adoptPtr(new WebCompositorTextureQuad(sharedQuadState, quadRect, textureId, premultipliedAlpha, uvRect, flipped)); +} + +WebCompositorTextureQuad::WebCompositorTextureQuad(const WebKit::WebCompositorSharedQuadState* sharedQuadState, const IntRect& quadRect, unsigned textureId, bool premultipliedAlpha, const FloatRect& uvRect, bool flipped) + : WebCompositorQuad(sharedQuadState, WebCompositorQuad::TextureContent, quadRect) + , m_textureId(textureId) + , m_premultipliedAlpha(premultipliedAlpha) + , m_uvRect(uvRect) + , m_flipped(flipped) +{ +} + +void WebCompositorTextureQuad::setNeedsBlending() +{ + m_needsBlending = true; +} + +const WebCompositorTextureQuad* WebCompositorTextureQuad::materialCast(const WebKit::WebCompositorQuad* quad) +{ + ASSERT(quad->material() == WebCompositorQuad::TextureContent); + return static_cast<const WebCompositorTextureQuad*>(quad); +} + +} diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCTileDrawQuad.cpp b/Source/WebCore/platform/chromium/support/WebCompositorTileQuad.cpp index b35b6f69f..27aa77508 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCTileDrawQuad.cpp +++ b/Source/WebCore/platform/chromium/support/WebCompositorTileQuad.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011 Google Inc. All rights reserved. + * Copyright (C) 2012 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -25,17 +25,19 @@ #include "config.h" -#include "cc/CCTileDrawQuad.h" +#include <public/WebCompositorTileQuad.h> -namespace WebCore { +using namespace WebCore; -PassOwnPtr<CCTileDrawQuad> CCTileDrawQuad::create(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect, const IntRect& opaqueRect, Platform3DObject textureId, const IntPoint& textureOffset, const IntSize& textureSize, GC3Dint textureFilter, bool swizzleContents, bool leftEdgeAA, bool topEdgeAA, bool rightEdgeAA, bool bottomEdgeAA) +namespace WebKit { + +PassOwnPtr<WebCompositorTileQuad> WebCompositorTileQuad::create(const WebCompositorSharedQuadState* sharedQuadState, const IntRect& quadRect, const IntRect& opaqueRect, Platform3DObject textureId, const IntPoint& textureOffset, const IntSize& textureSize, GC3Dint textureFilter, bool swizzleContents, bool leftEdgeAA, bool topEdgeAA, bool rightEdgeAA, bool bottomEdgeAA) { - return adoptPtr(new CCTileDrawQuad(sharedQuadState, quadRect, opaqueRect, textureId, textureOffset, textureSize, textureFilter, swizzleContents, leftEdgeAA, topEdgeAA, rightEdgeAA, bottomEdgeAA)); + return adoptPtr(new WebCompositorTileQuad(sharedQuadState, quadRect, opaqueRect, textureId, textureOffset, textureSize, textureFilter, swizzleContents, leftEdgeAA, topEdgeAA, rightEdgeAA, bottomEdgeAA)); } -CCTileDrawQuad::CCTileDrawQuad(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect, const IntRect& opaqueRect, Platform3DObject textureId, const IntPoint& textureOffset, const IntSize& textureSize, GC3Dint textureFilter, bool swizzleContents, bool leftEdgeAA, bool topEdgeAA, bool rightEdgeAA, bool bottomEdgeAA) - : CCDrawQuad(sharedQuadState, CCDrawQuad::TiledContent, quadRect) +WebCompositorTileQuad::WebCompositorTileQuad(const WebCompositorSharedQuadState* sharedQuadState, const IntRect& quadRect, const IntRect& opaqueRect, Platform3DObject textureId, const IntPoint& textureOffset, const IntSize& textureSize, GC3Dint textureFilter, bool swizzleContents, bool leftEdgeAA, bool topEdgeAA, bool rightEdgeAA, bool bottomEdgeAA) + : WebCompositorQuad(sharedQuadState, WebCompositorQuad::TiledContent, quadRect) , m_textureId(textureId) , m_textureOffset(textureOffset) , m_textureSize(textureSize) @@ -51,4 +53,10 @@ CCTileDrawQuad::CCTileDrawQuad(const CCSharedQuadState* sharedQuadState, const I m_opaqueRect = opaqueRect; } +const WebCompositorTileQuad* WebCompositorTileQuad::materialCast(const WebCompositorQuad* quad) +{ + ASSERT(quad->material() == WebCompositorQuad::TiledContent); + return static_cast<const WebCompositorTileQuad*>(quad); +} + } diff --git a/Source/WebCore/platform/efl/PlatformScreenEfl.cpp b/Source/WebCore/platform/efl/PlatformScreenEfl.cpp index 5332c2fbf..394da63f6 100644 --- a/Source/WebCore/platform/efl/PlatformScreenEfl.cpp +++ b/Source/WebCore/platform/efl/PlatformScreenEfl.cpp @@ -100,7 +100,7 @@ FloatRect screenAvailableRect(Widget* widget) return screenRect(widget); } -void screenColorProfile(Widget*, ColorProfile&) +void screenColorProfile(ColorProfile&) { notImplemented(); } diff --git a/Source/WebCore/platform/graphics/BitmapImage.cpp b/Source/WebCore/platform/graphics/BitmapImage.cpp index 04528591a..45460f8d3 100644 --- a/Source/WebCore/platform/graphics/BitmapImage.cpp +++ b/Source/WebCore/platform/graphics/BitmapImage.cpp @@ -304,7 +304,7 @@ NativeImagePtr BitmapImage::frameAtIndex(size_t index) bool BitmapImage::frameIsCompleteAtIndex(size_t index) { if (!ensureFrameIsCached(index)) - return true; // Why would an invalid index return true here? + return false; return m_frames[index].m_isComplete; } @@ -563,11 +563,4 @@ Color BitmapImage::solidColor() const return m_solidColor; } -#if !USE(CG) -void BitmapImage::draw(GraphicsContext* ctx, const FloatRect& dstRect, const FloatRect& srcRect, ColorSpace styleColorSpace, CompositeOperator op, RespectImageOrientationEnum) -{ - draw(ctx, dstRect, srcRect, styleColorSpace, op); -} -#endif - } diff --git a/Source/WebCore/platform/graphics/BitmapImage.h b/Source/WebCore/platform/graphics/BitmapImage.h index 21885cdd4..f5bfeb145 100644 --- a/Source/WebCore/platform/graphics/BitmapImage.h +++ b/Source/WebCore/platform/graphics/BitmapImage.h @@ -199,7 +199,9 @@ protected: virtual void drawFrameMatchingSourceSize(GraphicsContext*, const FloatRect& dstRect, const IntSize& srcSize, ColorSpace styleColorSpace, CompositeOperator); #endif virtual void draw(GraphicsContext*, const FloatRect& dstRect, const FloatRect& srcRect, ColorSpace styleColorSpace, CompositeOperator); - void draw(GraphicsContext*, const FloatRect& dstRect, const FloatRect& srcRect, ColorSpace styleColorSpace, CompositeOperator, RespectImageOrientationEnum); +#if USE(CG) + virtual void draw(GraphicsContext*, const FloatRect& dstRect, const FloatRect& srcRect, ColorSpace styleColorSpace, CompositeOperator, RespectImageOrientationEnum); +#endif #if (OS(WINCE) && !PLATFORM(QT)) virtual void drawPattern(GraphicsContext*, const FloatRect& srcRect, const AffineTransform& patternTransform, diff --git a/Source/WebCore/platform/graphics/FractionalLayoutBoxExtent.cpp b/Source/WebCore/platform/graphics/FractionalLayoutBoxExtent.cpp index 1fd52a919..e4e545a1b 100644 --- a/Source/WebCore/platform/graphics/FractionalLayoutBoxExtent.cpp +++ b/Source/WebCore/platform/graphics/FractionalLayoutBoxExtent.cpp @@ -35,6 +35,16 @@ namespace WebCore { +FractionalLayoutUnit FractionalLayoutBoxExtent::logicalTop(const RenderStyle* style) const +{ + return style->isHorizontalWritingMode() ? m_top : m_left; +} + +FractionalLayoutUnit FractionalLayoutBoxExtent::logicalBottom(const RenderStyle* style) const +{ + return style->isHorizontalWritingMode() ? m_bottom : m_right; +} + FractionalLayoutUnit FractionalLayoutBoxExtent::logicalLeft(const RenderStyle* style) const { return style->isHorizontalWritingMode() ? m_left : m_top; diff --git a/Source/WebCore/platform/graphics/FractionalLayoutBoxExtent.h b/Source/WebCore/platform/graphics/FractionalLayoutBoxExtent.h index af9630880..921c84b90 100644 --- a/Source/WebCore/platform/graphics/FractionalLayoutBoxExtent.h +++ b/Source/WebCore/platform/graphics/FractionalLayoutBoxExtent.h @@ -53,6 +53,8 @@ public: inline void setBottom(FractionalLayoutUnit value) { m_bottom = value; } inline void setLeft(FractionalLayoutUnit value) { m_left = value; } + FractionalLayoutUnit logicalTop(const RenderStyle*) const; + FractionalLayoutUnit logicalBottom(const RenderStyle*) const; FractionalLayoutUnit logicalLeft(const RenderStyle*) const; FractionalLayoutUnit logicalRight(const RenderStyle*) const; diff --git a/Source/WebCore/platform/graphics/FractionalLayoutRect.h b/Source/WebCore/platform/graphics/FractionalLayoutRect.h index d91be931a..a06d17508 100644 --- a/Source/WebCore/platform/graphics/FractionalLayoutRect.h +++ b/Source/WebCore/platform/graphics/FractionalLayoutRect.h @@ -31,6 +31,7 @@ #ifndef FractionalLayoutRect_h #define FractionalLayoutRect_h +#include "FractionalLayoutBoxExtent.h" #include "FractionalLayoutPoint.h" #include "IntRect.h" #include <wtf/Vector.h> @@ -99,6 +100,11 @@ public: void move(FractionalLayoutUnit dx, FractionalLayoutUnit dy) { m_location.move(dx, dy); } void expand(const FractionalLayoutSize& size) { m_size += size; } + void expand(const FractionalLayoutBoxExtent& box) + { + m_location.move(-box.left(), -box.top()); + m_size.expand(box.left() + box.right(), box.top() + box.bottom()); + } void expand(FractionalLayoutUnit dw, FractionalLayoutUnit dh) { m_size.expand(dw, dh); } void contract(const FractionalLayoutSize& size) { m_size -= size; } void contract(FractionalLayoutUnit dw, FractionalLayoutUnit dh) { m_size.expand(-dw, -dh); } diff --git a/Source/WebCore/platform/graphics/Gradient.h b/Source/WebCore/platform/graphics/Gradient.h index 5e36ff3c3..6ae483ac8 100644 --- a/Source/WebCore/platform/graphics/Gradient.h +++ b/Source/WebCore/platform/graphics/Gradient.h @@ -39,7 +39,7 @@ typedef struct CGContext* CGContextRef; -#define USE_CG_SHADING defined(BUILDING_ON_LEOPARD) +#define USE_CG_SHADING (PLATFORM(MAC) && !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1050) #if USE_CG_SHADING typedef struct CGShading* CGShadingRef; diff --git a/Source/WebCore/platform/graphics/GraphicsContext.cpp b/Source/WebCore/platform/graphics/GraphicsContext.cpp index bf1f8c056..6664b8644 100644 --- a/Source/WebCore/platform/graphics/GraphicsContext.cpp +++ b/Source/WebCore/platform/graphics/GraphicsContext.cpp @@ -490,10 +490,7 @@ void GraphicsContext::drawImage(Image* image, ColorSpace styleColorSpace, const #endif } - if (image->isBitmapImage()) - static_cast<BitmapImage*>(image)->draw(this, FloatRect(dest.location(), FloatSize(tw, th)), FloatRect(src.location(), FloatSize(tsw, tsh)), styleColorSpace, op, shouldRespectImageOrientation); - else - image->draw(this, FloatRect(dest.location(), FloatSize(tw, th)), FloatRect(src.location(), FloatSize(tsw, tsh)), styleColorSpace, op); + image->draw(this, FloatRect(dest.location(), FloatSize(tw, th)), FloatRect(src.location(), FloatSize(tsw, tsh)), styleColorSpace, op, shouldRespectImageOrientation); if (useLowQualityScale) setImageInterpolationQuality(previousInterpolationQuality); diff --git a/Source/WebCore/platform/graphics/GraphicsContext3D.h b/Source/WebCore/platform/graphics/GraphicsContext3D.h index 51eef09c5..1e6184293 100644 --- a/Source/WebCore/platform/graphics/GraphicsContext3D.h +++ b/Source/WebCore/platform/graphics/GraphicsContext3D.h @@ -956,10 +956,7 @@ public: ANGLEWebKitBridge m_compiler; #endif -#if PLATFORM(QT) && defined(QT_OPENGL_ES_2) - friend class Extensions3DQt; - OwnPtr<Extensions3DQt> m_extensions; -#elif PLATFORM(BLACKBERRY) +#if PLATFORM(BLACKBERRY) || (PLATFORM(QT) && defined(QT_OPENGL_ES_2)) friend class Extensions3DOpenGLES; OwnPtr<Extensions3DOpenGLES> m_extensions; #elif !PLATFORM(CHROMIUM) diff --git a/Source/WebCore/platform/graphics/GraphicsLayer.cpp b/Source/WebCore/platform/graphics/GraphicsLayer.cpp index 9a52fb67b..dda637311 100644 --- a/Source/WebCore/platform/graphics/GraphicsLayer.cpp +++ b/Source/WebCore/platform/graphics/GraphicsLayer.cpp @@ -79,6 +79,7 @@ GraphicsLayer::GraphicsLayer(GraphicsLayerClient* client) , m_acceleratesDrawing(false) , m_maintainsPixelAlignment(false) , m_appliesPageScale(false) + , m_usingTileCache(false) , m_paintingPhase(GraphicsLayerPaintAll) , m_contentsOrientation(CompositingCoordinatesTopDown) , m_parent(0) @@ -340,9 +341,7 @@ void GraphicsLayer::updateDebugIndicators() { if (GraphicsLayer::showDebugBorders()) { if (drawsContent()) { - // FIXME: It's weird to ask the client if this layer is a tile cache layer. - // Maybe we should just cache that information inside GraphicsLayer? - if (m_client->shouldUseTileCache(this)) // tile cache layer: dark blue + if (m_usingTileCache) // tile cache layer: dark blue setDebugBorder(Color(0, 0, 128, 128), 0.5); else if (m_usingTiledLayer) setDebugBorder(Color(255, 128, 0, 128), 2); // tiled layer: orange diff --git a/Source/WebCore/platform/graphics/GraphicsLayer.h b/Source/WebCore/platform/graphics/GraphicsLayer.h index 7939717fa..ccd61fb9e 100644 --- a/Source/WebCore/platform/graphics/GraphicsLayer.h +++ b/Source/WebCore/platform/graphics/GraphicsLayer.h @@ -466,6 +466,7 @@ protected: bool m_acceleratesDrawing : 1; bool m_maintainsPixelAlignment : 1; bool m_appliesPageScale : 1; // Set for the layer which has the page scale applied to it. + bool m_usingTileCache : 1; GraphicsLayerPaintingPhase m_paintingPhase; CompositingCoordinatesOrientation m_contentsOrientation; // affects orientation of layer contents diff --git a/Source/WebCore/platform/graphics/texmap/TextureMapperAnimation.cpp b/Source/WebCore/platform/graphics/GraphicsLayerAnimation.cpp index aa022a24e..ef8232c5d 100644 --- a/Source/WebCore/platform/graphics/texmap/TextureMapperAnimation.cpp +++ b/Source/WebCore/platform/graphics/GraphicsLayerAnimation.cpp @@ -18,12 +18,11 @@ */ #include "config.h" -#include "TextureMapperAnimation.h" +#include "GraphicsLayerAnimation.h" #include "UnitBezier.h" #include <wtf/CurrentTime.h> -#if USE(TEXTURE_MAPPER) namespace WebCore { @@ -145,7 +144,7 @@ static TransformationMatrix applyTransformAnimation(const TransformOperations* f } -TextureMapperAnimation::TextureMapperAnimation(const KeyframeValueList& keyframes, const IntSize& boxSize, const Animation* animation, double timeOffset, bool listsMatch) +GraphicsLayerAnimation::GraphicsLayerAnimation(const KeyframeValueList& keyframes, const IntSize& boxSize, const Animation* animation, double timeOffset, bool listsMatch) : m_keyframes(keyframes) , m_boxSize(boxSize) , m_animation(Animation::create(animation)) @@ -156,21 +155,21 @@ TextureMapperAnimation::TextureMapperAnimation(const KeyframeValueList& keyframe { } -void TextureMapperAnimation::applyInternal(TextureMapperAnimationClient* client, const AnimationValue* from, const AnimationValue* to, float progress) +void GraphicsLayerAnimation::applyInternal(Client* client, const AnimationValue* from, const AnimationValue* to, float progress) { switch (m_keyframes.property()) { case AnimatedPropertyOpacity: - client->setOpacity(applyOpacityAnimation((static_cast<const FloatAnimationValue*>(from)->value()), (static_cast<const FloatAnimationValue*>(to)->value()), progress)); + client->setAnimatedOpacity(applyOpacityAnimation((static_cast<const FloatAnimationValue*>(from)->value()), (static_cast<const FloatAnimationValue*>(to)->value()), progress)); return; case AnimatedPropertyWebkitTransform: - client->setTransform(applyTransformAnimation(static_cast<const TransformAnimationValue*>(from)->value(), static_cast<const TransformAnimationValue*>(to)->value(), progress, m_boxSize, m_listsMatch)); + client->setAnimatedTransform(applyTransformAnimation(static_cast<const TransformAnimationValue*>(from)->value(), static_cast<const TransformAnimationValue*>(to)->value(), progress, m_boxSize, m_listsMatch)); return; default: ASSERT_NOT_REACHED(); } } -bool TextureMapperAnimation::isActive() const +bool GraphicsLayerAnimation::isActive() const { if (state() != StoppedState) return true; @@ -178,11 +177,11 @@ bool TextureMapperAnimation::isActive() const return m_animation->fillsForwards(); } -bool TextureMapperAnimations::hasActiveAnimationsOfType(AnimatedPropertyID type) const +bool GraphicsLayerAnimations::hasActiveAnimationsOfType(AnimatedPropertyID type) const { - HashMap<String, Vector<TextureMapperAnimation> >::const_iterator end = m_animations.end(); - for (HashMap<String, Vector<TextureMapperAnimation> >::const_iterator it = m_animations.begin(); it != end; ++it) { - const Vector<TextureMapperAnimation>& animations = it->second; + HashMap<String, Vector<GraphicsLayerAnimation> >::const_iterator end = m_animations.end(); + for (HashMap<String, Vector<GraphicsLayerAnimation> >::const_iterator it = m_animations.begin(); it != end; ++it) { + const Vector<GraphicsLayerAnimation>& animations = it->second; for (size_t i = 0; i < animations.size(); ++i) { if (animations[i].isActive() && animations[i].property() == type) return true; @@ -191,13 +190,13 @@ bool TextureMapperAnimations::hasActiveAnimationsOfType(AnimatedPropertyID type) return false; } -bool TextureMapperAnimations::hasRunningAnimations() const +bool GraphicsLayerAnimations::hasRunningAnimations() const { - HashMap<String, Vector<TextureMapperAnimation> >::const_iterator end = m_animations.end(); - for (HashMap<String, Vector<TextureMapperAnimation> >::const_iterator it = m_animations.begin(); it != end; ++it) { - const Vector<TextureMapperAnimation>& animations = it->second; + HashMap<String, Vector<GraphicsLayerAnimation> >::const_iterator end = m_animations.end(); + for (HashMap<String, Vector<GraphicsLayerAnimation> >::const_iterator it = m_animations.begin(); it != end; ++it) { + const Vector<GraphicsLayerAnimation>& animations = it->second; for (size_t i = 0; i < animations.size(); ++i) { - if (animations[i].state() == TextureMapperAnimation::PlayingState) + if (animations[i].state() == GraphicsLayerAnimation::PlayingState) return true; } } @@ -205,7 +204,7 @@ bool TextureMapperAnimations::hasRunningAnimations() const return false; } -void TextureMapperAnimation::apply(TextureMapperAnimationClient* client) +void GraphicsLayerAnimation::apply(Client* client) { if (state() == StoppedState) return; @@ -244,29 +243,29 @@ void TextureMapperAnimation::apply(TextureMapperAnimationClient* client) } } -void TextureMapperAnimation::pause(double offset) +void GraphicsLayerAnimation::pause(double offset) { // FIXME: should apply offset here. setState(PausedState); m_pauseTime = WTF::currentTime() - offset; } -void TextureMapperAnimations::add(const String& name, const TextureMapperAnimation& animation) +void GraphicsLayerAnimations::add(const String& name, const GraphicsLayerAnimation& animation) { - HashMap<String, Vector<TextureMapperAnimation> >::iterator it = m_animations.find(name); + HashMap<String, Vector<GraphicsLayerAnimation> >::iterator it = m_animations.find(name); if (it != m_animations.end()) { it->second.append(animation); return; } - Vector<TextureMapperAnimation> animations; + Vector<GraphicsLayerAnimation> animations; animations.append(animation); m_animations.add(name, animations); } -void TextureMapperAnimations::pause(const String& name, double offset) +void GraphicsLayerAnimations::pause(const String& name, double offset) { - HashMap<String, Vector<TextureMapperAnimation> >::iterator it = m_animations.find(name); + HashMap<String, Vector<GraphicsLayerAnimation> >::iterator it = m_animations.find(name); if (it == m_animations.end()) return; @@ -274,14 +273,13 @@ void TextureMapperAnimations::pause(const String& name, double offset) it->second[i].pause(offset); } -void TextureMapperAnimations::apply(TextureMapperAnimationClient* client) +void GraphicsLayerAnimations::apply(GraphicsLayerAnimation::Client* client) { - HashMap<String, Vector<TextureMapperAnimation> >::iterator end = m_animations.end(); - for (HashMap<String, Vector<TextureMapperAnimation> >::iterator it = m_animations.begin(); it != end; ++it) { + HashMap<String, Vector<GraphicsLayerAnimation> >::iterator end = m_animations.end(); + for (HashMap<String, Vector<GraphicsLayerAnimation> >::iterator it = m_animations.begin(); it != end; ++it) { for (size_t i = 0; i < it->second.size(); ++i) it->second[i].apply(client); } } } -#endif diff --git a/Source/WebCore/platform/graphics/texmap/TextureMapperAnimation.h b/Source/WebCore/platform/graphics/GraphicsLayerAnimation.h index d0e90b518..2fbc05a12 100644 --- a/Source/WebCore/platform/graphics/texmap/TextureMapperAnimation.h +++ b/Source/WebCore/platform/graphics/GraphicsLayerAnimation.h @@ -17,32 +17,30 @@ Boston, MA 02110-1301, USA. */ -#ifndef TextureMapperAnimation_h -#define TextureMapperAnimation_h +#ifndef GraphicsLayerAnimation_h +#define GraphicsLayerAnimation_h #include "GraphicsLayer.h" #include "TransformationMatrix.h" #include <wtf/HashMap.h> #include <wtf/text/StringHash.h> -#if USE(TEXTURE_MAPPER) namespace WebCore { -class TextureMapperAnimationClient { -public: - virtual void setTransform(const TransformationMatrix&) = 0; - virtual void setOpacity(float) = 0; -}; - -class TextureMapperAnimation { +class GraphicsLayerAnimation { public: enum AnimationState { PlayingState, PausedState, StoppedState }; + class Client { + public: + virtual void setAnimatedTransform(const TransformationMatrix&) = 0; + virtual void setAnimatedOpacity(float) = 0; + }; - TextureMapperAnimation() + GraphicsLayerAnimation() : m_keyframes(AnimatedPropertyInvalid) { } - TextureMapperAnimation(const KeyframeValueList&, const IntSize&, const Animation*, double, bool); - void apply(TextureMapperAnimationClient*); + GraphicsLayerAnimation(const KeyframeValueList&, const IntSize&, const Animation*, double, bool); + void apply(Client*); void pause(double); AnimationState state() const { return m_state; } void setState(AnimationState s) { m_state = s; } @@ -50,7 +48,7 @@ public: bool isActive() const; private: - void applyInternal(TextureMapperAnimationClient*, const AnimationValue* from, const AnimationValue* to, float progress); + void applyInternal(Client*, const AnimationValue* from, const AnimationValue* to, float progress); KeyframeValueList m_keyframes; IntSize m_boxSize; RefPtr<Animation> m_animation; @@ -62,24 +60,22 @@ private: AnimationState m_state; }; -class TextureMapperAnimations { +class GraphicsLayerAnimations { public: - TextureMapperAnimations() { } + GraphicsLayerAnimations() { } - void add(const String&, const TextureMapperAnimation&); + void add(const String&, const GraphicsLayerAnimation&); void remove(const String& name) { m_animations.remove(name); } void pause(const String&, double); - void apply(TextureMapperAnimationClient*); + void apply(GraphicsLayerAnimation::Client*); bool isEmpty() const { return m_animations.isEmpty(); } bool hasRunningAnimations() const; bool hasActiveAnimationsOfType(AnimatedPropertyID type) const; private: - HashMap<String, Vector<TextureMapperAnimation> > m_animations; + HashMap<String, Vector<GraphicsLayerAnimation> > m_animations; }; } -#endif // USE(TEXTURE_MAPPER) - -#endif // TextureMapperAnimation_h +#endif // GraphicsLayerAnimation_h diff --git a/Source/WebCore/platform/graphics/GraphicsLayerClient.h b/Source/WebCore/platform/graphics/GraphicsLayerClient.h index 36a7f4365..7049e4226 100644 --- a/Source/WebCore/platform/graphics/GraphicsLayerClient.h +++ b/Source/WebCore/platform/graphics/GraphicsLayerClient.h @@ -56,6 +56,7 @@ public: virtual ~GraphicsLayerClient() {} virtual bool shouldUseTileCache(const GraphicsLayer*) const { return false; } + virtual bool usingTileCache(const GraphicsLayer*) const { return false; } // Callback for when hardware-accelerated animation started. virtual void notifyAnimationStarted(const GraphicsLayer*, double time) = 0; diff --git a/Source/WebCore/platform/graphics/texmap/LayerTransform.cpp b/Source/WebCore/platform/graphics/GraphicsLayerTransform.cpp index 1c3c02e57..77cac87d6 100644 --- a/Source/WebCore/platform/graphics/texmap/LayerTransform.cpp +++ b/Source/WebCore/platform/graphics/GraphicsLayerTransform.cpp @@ -18,60 +18,60 @@ */ #include "config.h" -#include "LayerTransform.h" +#include "GraphicsLayerTransform.h" namespace WebCore { -LayerTransform::LayerTransform() -: m_flattening(false) -, m_dirty(false) // false by default since all default values would be combined as the identity matrix -, m_childrenDirty(false) +GraphicsLayerTransform::GraphicsLayerTransform() + : m_flattening(false) + , m_dirty(false) // false by default since all default values would be combined as the identity matrix + , m_childrenDirty(false) { } -void LayerTransform::setPosition(const FloatPoint& position) +void GraphicsLayerTransform::setPosition(const FloatPoint& position) { m_position = position; m_dirty = true; } -void LayerTransform::setSize(const FloatSize& size) +void GraphicsLayerTransform::setSize(const FloatSize& size) { m_size = size; m_dirty = true; } -void LayerTransform::setAnchorPoint(const FloatPoint3D& anchorPoint) +void GraphicsLayerTransform::setAnchorPoint(const FloatPoint3D& anchorPoint) { m_anchorPoint = anchorPoint; m_dirty = true; } -void LayerTransform::setFlattening(bool flattening) +void GraphicsLayerTransform::setFlattening(bool flattening) { m_flattening = flattening; m_dirty = true; } -void LayerTransform::setLocalTransform(const TransformationMatrix& transform) +void GraphicsLayerTransform::setLocalTransform(const TransformationMatrix& transform) { m_local = transform; m_dirty = true; } -void LayerTransform::setChildrenTransform(const TransformationMatrix& transform) +void GraphicsLayerTransform::setChildrenTransform(const TransformationMatrix& transform) { m_children = transform; m_dirty = true; } -TransformationMatrix LayerTransform::combined() +TransformationMatrix GraphicsLayerTransform::combined() { ASSERT(!m_dirty); return m_combined; } -TransformationMatrix LayerTransform::combinedForChildren() +TransformationMatrix GraphicsLayerTransform::combinedForChildren() { ASSERT(!m_dirty); if (m_childrenDirty) @@ -79,7 +79,7 @@ TransformationMatrix LayerTransform::combinedForChildren() return m_combinedForChildren; } -void LayerTransform::combineTransforms(const TransformationMatrix& parentTransform) +void GraphicsLayerTransform::combineTransforms(const TransformationMatrix& parentTransform) { float originX = m_anchorPoint.x() * m_size.width(); float originY = m_anchorPoint.y() * m_size.height(); @@ -96,7 +96,7 @@ void LayerTransform::combineTransforms(const TransformationMatrix& parentTransfo m_childrenDirty = true; } -void LayerTransform::combineTransformsForChildren() +void GraphicsLayerTransform::combineTransformsForChildren() { ASSERT(!m_dirty); ASSERT(m_childrenDirty); diff --git a/Source/WebCore/platform/graphics/texmap/LayerTransform.h b/Source/WebCore/platform/graphics/GraphicsLayerTransform.h index b73818501..5da25b4d8 100644 --- a/Source/WebCore/platform/graphics/texmap/LayerTransform.h +++ b/Source/WebCore/platform/graphics/GraphicsLayerTransform.h @@ -17,8 +17,8 @@ Boston, MA 02110-1301, USA. */ -#ifndef LayerTransform_h -#define LayerTransform_h +#ifndef GraphicsLayerTransform_h +#define GraphicsLayerTransform_h #include "FloatPoint.h" #include "FloatPoint3D.h" @@ -27,9 +27,9 @@ namespace WebCore { -class LayerTransform { +class GraphicsLayerTransform { public: - LayerTransform(); + GraphicsLayerTransform(); void setPosition(const FloatPoint&); void setSize(const FloatSize&); void setAnchorPoint(const FloatPoint3D&); @@ -59,4 +59,4 @@ private: } -#endif // LayerTransform_h +#endif // GraphicsLayerTransform_h diff --git a/Source/WebCore/platform/graphics/Image.cpp b/Source/WebCore/platform/graphics/Image.cpp index 0ace7ac20..2b19f1349 100644 --- a/Source/WebCore/platform/graphics/Image.cpp +++ b/Source/WebCore/platform/graphics/Image.cpp @@ -89,6 +89,11 @@ void Image::fillWithSolidColor(GraphicsContext* ctxt, const FloatRect& dstRect, ctxt->setCompositeOperation(previousOperator); } +void Image::draw(GraphicsContext* ctx, const FloatRect& dstRect, const FloatRect& srcRect, ColorSpace styleColorSpace, CompositeOperator op, RespectImageOrientationEnum) +{ + draw(ctx, dstRect, srcRect, styleColorSpace, op); +} + void Image::drawTiled(GraphicsContext* ctxt, const FloatRect& destRect, const FloatPoint& srcPoint, const FloatSize& scaledTileSize, ColorSpace styleColorSpace, CompositeOperator op) { if (mayFillWithSolidColor()) { diff --git a/Source/WebCore/platform/graphics/Image.h b/Source/WebCore/platform/graphics/Image.h index 3ff48236a..a6b949047 100644 --- a/Source/WebCore/platform/graphics/Image.h +++ b/Source/WebCore/platform/graphics/Image.h @@ -181,6 +181,7 @@ protected: virtual void drawFrameMatchingSourceSize(GraphicsContext*, const FloatRect& dstRect, const IntSize& srcSize, ColorSpace styleColorSpace, CompositeOperator) { } #endif virtual void draw(GraphicsContext*, const FloatRect& dstRect, const FloatRect& srcRect, ColorSpace styleColorSpace, CompositeOperator) = 0; + virtual void draw(GraphicsContext*, const FloatRect& dstRect, const FloatRect& srcRect, ColorSpace styleColorSpace, CompositeOperator, RespectImageOrientationEnum); void drawTiled(GraphicsContext*, const FloatRect& dstRect, const FloatPoint& srcPoint, const FloatSize& tileSize, ColorSpace styleColorSpace, CompositeOperator); void drawTiled(GraphicsContext*, const FloatRect& dstRect, const FloatRect& srcRect, const FloatSize& tileScaleFactor, TileRule hRule, TileRule vRule, ColorSpace styleColorSpace, CompositeOperator); diff --git a/Source/WebCore/platform/graphics/MediaPlayer.cpp b/Source/WebCore/platform/graphics/MediaPlayer.cpp index 73aacd496..ec622437e 100644 --- a/Source/WebCore/platform/graphics/MediaPlayer.cpp +++ b/Source/WebCore/platform/graphics/MediaPlayer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. + * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -208,7 +208,7 @@ static Vector<MediaPlayerFactory*>& installedMediaEngines() enginesQueried = true; #if USE(AVFOUNDATION) - if (Settings::isAVFoundationEnabled()) { + if (1 /* @@Settings::isAVFoundationEnabled() @@ */) { #if PLATFORM(MAC) MediaPlayerPrivateAVFoundationObjC::registerMediaEngine(addMediaEngine); #elif PLATFORM(WIN) @@ -1068,6 +1068,16 @@ String MediaPlayer::userAgent() const return m_mediaPlayerClient->mediaPlayerUserAgent(); } +#if PLATFORM(WIN) && USE(AVFOUNDATION) +GraphicsDeviceAdapter* MediaPlayer::graphicsDeviceAdapter() const +{ + if (!m_mediaPlayerClient) + return 0; + + return m_mediaPlayerClient->mediaPlayerGraphicsDeviceAdapter(this); +} +#endif + } #endif diff --git a/Source/WebCore/platform/graphics/MediaPlayer.h b/Source/WebCore/platform/graphics/MediaPlayer.h index 8eb728596..3b382d83a 100644 --- a/Source/WebCore/platform/graphics/MediaPlayer.h +++ b/Source/WebCore/platform/graphics/MediaPlayer.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. + * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -99,6 +99,10 @@ class MediaPlayer; struct MediaPlayerFactory; class TimeRanges; +#if PLATFORM(WIN) && USE(AVFOUNDATION) +struct GraphicsDeviceAdapter; +#endif + class MediaPlayerClient { public: enum CORSMode { Unspecified, Anonymous, UseCredentials }; @@ -165,6 +169,10 @@ public: virtual void mediaPlayerRenderingModeChanged(MediaPlayer*) { } #endif +#if PLATFORM(WIN) && USE(AVFOUNDATION) + virtual GraphicsDeviceAdapter* mediaPlayerGraphicsDeviceAdapter(const MediaPlayer*) const { return 0; } +#endif + #if ENABLE(MEDIA_SOURCE) virtual void mediaPlayerSourceOpened() { } virtual String mediaPlayerSourceURL() const { return "x-media-source-unsupported:"; } @@ -356,6 +364,10 @@ public: void acceleratedRenderingStateChanged(); #endif +#if PLATFORM(WIN) && USE(AVFOUNDATION) + GraphicsDeviceAdapter* graphicsDeviceAdapter() const; +#endif + bool hasSingleSecurityOrigin() const; bool didPassCORSAccessCheck() const; diff --git a/Source/WebCore/platform/graphics/OpenGLESShims.h b/Source/WebCore/platform/graphics/OpenGLESShims.h index 052af5e45..4e0951201 100644 --- a/Source/WebCore/platform/graphics/OpenGLESShims.h +++ b/Source/WebCore/platform/graphics/OpenGLESShims.h @@ -26,7 +26,7 @@ #ifndef OpenGLESShims_h #define OpenGLESShims_h -#if PLATFORM(BLACKBERRY) +#if PLATFORM(BLACKBERRY) || PLATFORM(QT) #define glBindFramebufferEXT glBindFramebuffer #define glFramebufferTexture2DEXT glFramebufferTexture2D #define glBindRenderbufferEXT glBindRenderbuffer diff --git a/Source/WebCore/platform/graphics/avfoundation/cf/AVFoundationCFSoftLinking.h b/Source/WebCore/platform/graphics/avfoundation/cf/AVFoundationCFSoftLinking.h index 04098002d..95b9403bf 100644 --- a/Source/WebCore/platform/graphics/avfoundation/cf/AVFoundationCFSoftLinking.h +++ b/Source/WebCore/platform/graphics/avfoundation/cf/AVFoundationCFSoftLinking.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011 Apple Inc. All rights reserved. + * Copyright (C) 2011, 2012 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -177,6 +177,8 @@ SOFT_LINK_DLL_IMPORT(AVFoundationCF, AVCFURLAssetCopyAudiovisualMIMETypes, CFArr SOFT_LINK_DLL_IMPORT(AVFoundationCF, AVCFURLAssetCreateWithURLAndOptions, AVCFURLAssetRef, __cdecl, (CFAllocatorRef allocator, CFURLRef URL, CFDictionaryRef options, dispatch_queue_t notificationQueue), (allocator, URL, options, notificationQueue)) #define AVCFURLAssetCreateWithURLAndOptions softLink_AVCFURLAssetCreateWithURLAndOptions +SOFT_LINK_DLL_IMPORT_OPTIONAL(AVFoundationCF, AVCFPlayerSetDirect3DDevice, void, __cdecl, (AVCFPlayerRef player, IDirect3DDevice9* d3dDevice)) + // Variables SOFT_LINK_VARIABLE_DLL_IMPORT(AVFoundationCF, AVCFAssetImageGeneratorApertureModeCleanAperture, const CFStringRef); @@ -244,3 +246,6 @@ SOFT_LINK_VARIABLE_DLL_IMPORT(AVFoundationCF, AVCFPlayerItemTracksChangedNotific SOFT_LINK_VARIABLE_DLL_IMPORT(AVFoundationCF, AVCFPlayerRateChangedNotification, const CFStringRef); #define AVCFPlayerRateChangedNotification get_AVCFPlayerRateChangedNotification() + +SOFT_LINK_VARIABLE_DLL_IMPORT_OPTIONAL(AVFoundationCF, AVCFPlayerEnableHardwareAcceleratedVideoDecoderKey, const CFStringRef); +#define AVCFPlayerEnableHardwareAcceleratedVideoDecoderKey get_AVCFPlayerEnableHardwareAcceleratedVideoDecoderKey() diff --git a/Source/WebCore/platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp b/Source/WebCore/platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp index a9f39a40d..81d862981 100644 --- a/Source/WebCore/platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp +++ b/Source/WebCore/platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011 Apple Inc. All rights reserved. + * Copyright (C) 2011, 2012 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -32,6 +32,7 @@ #include "MediaPlayerPrivateAVFoundationCF.h" #include "ApplicationCacheResource.h" +#include "COMPtr.h" #include "FloatConversion.h" #include "FrameView.h" #include "GraphicsContext.h" @@ -44,9 +45,9 @@ #include <AVFoundationCF/AVCFPlayerLayer.h> #include <AVFoundationCF/AVFoundationCF.h> #include <CoreMedia/CoreMedia.h> - #include <delayimp.h> #include <dispatch/dispatch.h> +#include <WebKitQuartzCoreAdditions/WKCACFTypes.h> #include <wtf/HashMap.h> #include <wtf/Threading.h> #include <wtf/UnusedParam.h> @@ -87,7 +88,7 @@ public: void createAssetForURL(const String& url); void setAsset(AVCFURLAssetRef); - void createPlayer(); + void createPlayer(IDirect3DDevice9*); void createPlayerItem(); void checkPlayability(); @@ -137,6 +138,7 @@ private: RefPtr<PlatformCALayer> m_videoLayerWrapper; OwnPtr<LayerClient> m_layerClient; + COMPtr<IDirect3DDevice9Ex> m_d3dDevice; }; uintptr_t AVFWrapper::s_nextAVFWrapperObjectID; @@ -339,7 +341,7 @@ void MediaPlayerPrivateAVFoundationCF::createAVPlayer() ASSERT(m_avfWrapper); setDelayCallbacks(true); - m_avfWrapper->createPlayer(); + m_avfWrapper->createPlayer(reinterpret_cast<IDirect3DDevice9*>(player()->graphicsDeviceAdapter())); setDelayCallbacks(false); } @@ -355,8 +357,9 @@ void MediaPlayerPrivateAVFoundationCF::createAVPlayerItem() void MediaPlayerPrivateAVFoundationCF::createAVAssetForURL(const String& url) { ASSERT(!m_avfWrapper); - + setDelayCallbacks(true); + m_avfWrapper = new AVFWrapper(this); m_avfWrapper->createAssetForURL(url); setDelayCallbacks(false); @@ -955,20 +958,36 @@ void AVFWrapper::disconnectAndDeleteAVFWrapper(void* context) void AVFWrapper::createAssetForURL(const String& url) { ASSERT(!avAsset()); - + RetainPtr<CFURLRef> urlRef(AdoptCF, KURL(ParsedURLString, url).createCFURL()); + AVCFURLAssetRef assetRef = AVCFURLAssetCreateWithURLAndOptions(kCFAllocatorDefault, urlRef.get(), 0, m_notificationQueue); m_avAsset.adoptCF(assetRef); } -void AVFWrapper::createPlayer() +void AVFWrapper::createPlayer(IDirect3DDevice9* d3dDevice) { ASSERT(!avPlayer() && avPlayerItem()); + RetainPtr<CFMutableDictionaryRef> optionsRef(AdoptCF, CFDictionaryCreateMutable(kCFAllocatorDefault, 1, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks)); + + if (d3dDevice) { + // QI for an IDirect3DDevice9Ex interface, it is required to do HW video decoding. + COMPtr<IDirect3DDevice9Ex> d3dEx(Query, d3dDevice); + m_d3dDevice = d3dEx; + } else + m_d3dDevice = 0; + + if (m_d3dDevice && AVCFPlayerEnableHardwareAcceleratedVideoDecoderKey) + CFDictionarySetValue(optionsRef.get(), AVCFPlayerEnableHardwareAcceleratedVideoDecoderKey, kCFBooleanTrue); + // FIXME: We need a way to create a AVPlayer without an AVPlayerItem, see <rdar://problem/9877730>. - AVCFPlayerRef playerRef = AVCFPlayerCreateWithPlayerItemAndOptions(kCFAllocatorDefault, avPlayerItem(), 0, m_notificationQueue); + AVCFPlayerRef playerRef = AVCFPlayerCreateWithPlayerItemAndOptions(kCFAllocatorDefault, avPlayerItem(), optionsRef.get(), m_notificationQueue); m_avPlayer.adoptCF(playerRef); + if (m_d3dDevice && AVCFPlayerSetDirect3DDevicePtr()) + AVCFPlayerSetDirect3DDevicePtr()(playerRef, m_d3dDevice.get()); + CFNotificationCenterRef center = CFNotificationCenterGetLocalCenter(); ASSERT(center); diff --git a/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm b/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm index a26141daf..59a72f789 100644 --- a/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm +++ b/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm @@ -258,7 +258,7 @@ void MediaPlayerPrivateAVFoundationObjC::createAVAssetForURL(const String& url) [options.get() setObject:[NSNumber numberWithInt:AVAssetReferenceRestrictionForbidRemoteReferenceToLocal | AVAssetReferenceRestrictionForbidLocalReferenceToRemote] forKey:AVURLAssetReferenceRestrictionsKey]; -#if !defined(BUILDING_ON_SNOW_LEOPARD) && !defined(BUILDING_ON_LION) +#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 RetainPtr<NSMutableDictionary> headerFields(AdoptNS, [[NSMutableDictionary alloc] init]); String referrer = player()->referrer(); diff --git a/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp b/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp index 55d479b8a..e3a565d18 100644 --- a/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp +++ b/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp @@ -247,7 +247,7 @@ static bool animationHasStepsTimingFunction(const KeyframeValueList& valueList, static inline bool supportsAcceleratedFilterAnimations() { // <rdar://problem/10907251> - WebKit2 doesn't support CA animations of CI filters on Lion and below -#if !defined(BUILDING_ON_SNOW_LEOPARD) && !defined(BUILDING_ON_LION) +#if PLATFORM(MAC) && (PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080) return true; #else return false; @@ -268,8 +268,10 @@ GraphicsLayerCA::GraphicsLayerCA(GraphicsLayerClient* client) , m_uncommittedChanges(0) { PlatformCALayer::LayerType layerType = PlatformCALayer::LayerTypeWebLayer; - if (client && client->shouldUseTileCache(this)) + if (client && client->shouldUseTileCache(this)) { layerType = PlatformCALayer::LayerTypeTileCacheLayer; + m_usingTileCache = true; + } m_layer = PlatformCALayer::create(layerType, this); @@ -1881,7 +1883,7 @@ bool GraphicsLayerCA::createTransformAnimationsFromKeyframes(const KeyframeValue int numAnimations = isMatrixAnimation ? 1 : operations->size(); bool reverseAnimationList = true; -#if !defined(BUILDING_ON_SNOW_LEOPARD) && !PLATFORM(WIN) +#if !PLATFORM(IOS) && !PLATFORM(WIN) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 // Old versions of Core Animation apply animations in reverse order (<rdar://problem/7095638>) so we need to flip the list. // to be non-additive. For binary compatibility, the current version of Core Animation preserves this behavior for applications linked // on or before Snow Leopard. @@ -2390,7 +2392,7 @@ void GraphicsLayerCA::setDebugBorder(const Color& color, float borderWidth) FloatSize GraphicsLayerCA::constrainedSize() const { FloatSize constrainedSize = m_size; -#if defined(BUILDING_ON_SNOW_LEOPARD) +#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1060 float tileColumns = ceilf(m_size.width() / kTiledLayerTileSize); float tileRows = ceilf(m_size.height() / kTiledLayerTileSize); double numTiles = tileColumns * tileRows; diff --git a/Source/WebCore/platform/graphics/ca/PlatformCALayer.h b/Source/WebCore/platform/graphics/ca/PlatformCALayer.h index 002b7a07a..1ed94115c 100644 --- a/Source/WebCore/platform/graphics/ca/PlatformCALayer.h +++ b/Source/WebCore/platform/graphics/ca/PlatformCALayer.h @@ -213,7 +213,7 @@ public: void printTree() const; #endif -#if PLATFORM(MAC) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if PLATFORM(MAC) && (PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070) void synchronouslyDisplayTilesInRect(const FloatRect&); #endif diff --git a/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm b/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm index 3a7ac781f..f28967c51 100644 --- a/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm +++ b/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm @@ -93,7 +93,7 @@ static double mediaTimeToCurrentTime(CFTimeInterval t) @end -#if !defined(BUILDING_ON_SNOW_LEOPARD) +#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 @interface CATiledLayer(GraphicsLayerCAPrivate) - (void)displayInRect:(CGRect)r levelOfDetail:(int)lod options:(NSDictionary *)dict; - (BOOL)canDrawConcurrently; @@ -103,7 +103,7 @@ static double mediaTimeToCurrentTime(CFTimeInterval t) @interface CALayer(Private) - (void)setContentsChanged; -#if !defined(BUILDING_ON_SNOW_LEOPARD) +#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 - (void)setAcceleratesDrawing:(BOOL)flag; - (BOOL)acceleratesDrawing; #endif @@ -554,7 +554,7 @@ void PlatformCALayer::setMasksToBounds(bool value) bool PlatformCALayer::acceleratesDrawing() const { -#if !defined(BUILDING_ON_SNOW_LEOPARD) +#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 return [m_layer.get() acceleratesDrawing]; #else return false; @@ -563,7 +563,7 @@ bool PlatformCALayer::acceleratesDrawing() const void PlatformCALayer::setAcceleratesDrawing(bool acceleratesDrawing) { -#if !defined(BUILDING_ON_SNOW_LEOPARD) +#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 BEGIN_BLOCK_OBJC_EXCEPTIONS [m_layer.get() setAcceleratesDrawing:acceleratesDrawing]; END_BLOCK_OBJC_EXCEPTIONS @@ -910,7 +910,7 @@ void PlatformCALayer::setTimeOffset(CFTimeInterval value) float PlatformCALayer::contentsScale() const { -#if !defined(BUILDING_ON_SNOW_LEOPARD) +#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 return [m_layer.get() contentsScale]; #else return 1; @@ -919,7 +919,7 @@ float PlatformCALayer::contentsScale() const void PlatformCALayer::setContentsScale(float value) { -#if !defined(BUILDING_ON_SNOW_LEOPARD) +#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 BEGIN_BLOCK_OBJC_EXCEPTIONS [m_layer.get() setContentsScale:value]; END_BLOCK_OBJC_EXCEPTIONS @@ -937,7 +937,7 @@ TiledBacking* PlatformCALayer::tiledBacking() return [tileCacheLayer tiledBacking]; } -#if !defined(BUILDING_ON_SNOW_LEOPARD) +#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 void PlatformCALayer::synchronouslyDisplayTilesInRect(const FloatRect& rect) { if (m_layerType != LayerTypeWebTiledLayer) diff --git a/Source/WebCore/platform/graphics/ca/mac/TileCache.mm b/Source/WebCore/platform/graphics/ca/mac/TileCache.mm index 59d8b1f9b..f79c63b29 100644 --- a/Source/WebCore/platform/graphics/ca/mac/TileCache.mm +++ b/Source/WebCore/platform/graphics/ca/mac/TileCache.mm @@ -36,7 +36,7 @@ using namespace std; -#if !defined(BUILDING_ON_SNOW_LEOPARD) +#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 @interface CALayer (WebCALayerDetails) - (void)setAcceleratesDrawing:(BOOL)flag; @end @@ -157,7 +157,7 @@ void TileCache::setScale(CGFloat scale) if (m_scale == scale && m_deviceScaleFactor == deviceScaleFactor) return; -#if !defined(BUILDING_ON_SNOW_LEOPARD) +#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 Vector<FloatRect> dirtyRects; m_deviceScaleFactor = deviceScaleFactor; @@ -182,7 +182,7 @@ void TileCache::setScale(CGFloat scale) void TileCache::setAcceleratesDrawing(bool acceleratesDrawing) { -#if !defined(BUILDING_ON_SNOW_LEOPARD) +#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 if (m_acceleratesDrawing == acceleratesDrawing) return; @@ -401,7 +401,7 @@ RetainPtr<WebTileLayer> TileCache::createTileLayer(const IntRect& tileRect) [layer.get() setName:@"Tile"]; #endif -#if !defined(BUILDING_ON_SNOW_LEOPARD) +#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 [layer.get() setContentsScale:m_deviceScaleFactor]; [layer.get() setAcceleratesDrawing:m_acceleratesDrawing]; #endif diff --git a/Source/WebCore/platform/graphics/ca/win/CACFLayerTreeHost.h b/Source/WebCore/platform/graphics/ca/win/CACFLayerTreeHost.h index 2b82377d8..6628b92be 100644 --- a/Source/WebCore/platform/graphics/ca/win/CACFLayerTreeHost.h +++ b/Source/WebCore/platform/graphics/ca/win/CACFLayerTreeHost.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009 Apple Inc. All rights reserved. + * Copyright (C) 2009, 2010, 2011, 2012 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -46,6 +46,10 @@ struct WKCACFContext; typedef struct CGImage* CGImageRef; +#if USE(AVFOUNDATION) +struct GraphicsDeviceAdapter; +#endif + namespace WebCore { class CACFLayerTreeHostClient; @@ -66,6 +70,9 @@ public: virtual void resize() = 0; void flushPendingGraphicsLayerChangesSoon(); virtual void setShouldInvertColors(bool); +#if USE(AVFOUNDATION) + virtual GraphicsDeviceAdapter* graphicsDeviceAdapter() const { return 0; } +#endif // AbstractCACFLayerTreeHost virtual void flushPendingLayerChangesNow(); diff --git a/Source/WebCore/platform/graphics/ca/win/LegacyCACFLayerTreeHost.h b/Source/WebCore/platform/graphics/ca/win/LegacyCACFLayerTreeHost.h index bfa530b92..5662fed5c 100644 --- a/Source/WebCore/platform/graphics/ca/win/LegacyCACFLayerTreeHost.h +++ b/Source/WebCore/platform/graphics/ca/win/LegacyCACFLayerTreeHost.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011 Apple Inc. All rights reserved. + * Copyright (C) 2011, 2012 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -64,6 +64,10 @@ private: virtual void paint(); virtual void render(const Vector<CGRect>& dirtyRects = Vector<CGRect>()); +#if USE(AVFOUNDATION) + virtual GraphicsDeviceAdapter* graphicsDeviceAdapter() const OVERRIDE { return 0; } +#endif + Timer<LegacyCACFLayerTreeHost> m_renderTimer; COMPtr<IDirect3DDevice9> m_d3dDevice; WKCACFContext* m_context; diff --git a/Source/WebCore/platform/graphics/ca/win/WKCACFViewLayerTreeHost.cpp b/Source/WebCore/platform/graphics/ca/win/WKCACFViewLayerTreeHost.cpp index 2b47a3e1d..d945c3e2e 100644 --- a/Source/WebCore/platform/graphics/ca/win/WKCACFViewLayerTreeHost.cpp +++ b/Source/WebCore/platform/graphics/ca/win/WKCACFViewLayerTreeHost.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011 Apple Inc. All rights reserved. + * Copyright (C) 2011, 2012 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -61,6 +61,7 @@ SOFT_LINK(WebKitQuartzCoreAdditions, WKCACFViewSetContextDidChangeCallback, void SOFT_LINK(WebKitQuartzCoreAdditions, WKCACFViewGetLastCommitTime, CFTimeInterval, __cdecl, (WKCACFViewRef view), (view)) SOFT_LINK(WebKitQuartzCoreAdditions, WKCACFViewSetContextUserData, void, __cdecl, (WKCACFViewRef view, void* userData), (view, userData)) SOFT_LINK_OPTIONAL(WebKitQuartzCoreAdditions, WKCACFViewSetShouldInvertColors, void, _cdecl, (WKCACFViewRef view, bool shouldInvertColors)) +SOFT_LINK_OPTIONAL(WebKitQuartzCoreAdditions, WKCACFViewGetD3DDevice9, IDirect3DDevice9*, _cdecl, (WKCACFViewRef view)) PassRefPtr<WKCACFViewLayerTreeHost> WKCACFViewLayerTreeHost::create() { @@ -175,6 +176,16 @@ void WKCACFViewLayerTreeHost::setShouldInvertColors(bool shouldInvertColors) WKCACFViewSetShouldInvertColorsPtr()(m_view.get(), shouldInvertColors); } +#if USE(AVFOUNDATION) +GraphicsDeviceAdapter* WKCACFViewLayerTreeHost::graphicsDeviceAdapter() const +{ + if (!WKCACFViewGetD3DDevice9Ptr()) + return 0; + + return reinterpret_cast<GraphicsDeviceAdapter*>(WKCACFViewGetD3DDevice9Ptr()(m_view.get())); +} +#endif + } // namespace WebCore #endif // USE(ACCELERATED_COMPOSITING) diff --git a/Source/WebCore/platform/graphics/ca/win/WKCACFViewLayerTreeHost.h b/Source/WebCore/platform/graphics/ca/win/WKCACFViewLayerTreeHost.h index 2660e43d1..567157125 100644 --- a/Source/WebCore/platform/graphics/ca/win/WKCACFViewLayerTreeHost.h +++ b/Source/WebCore/platform/graphics/ca/win/WKCACFViewLayerTreeHost.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011 Apple Inc. All rights reserved. + * Copyright (C) 2011, 2012 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -54,6 +54,9 @@ private: virtual void render(const Vector<CGRect>& dirtyRects = Vector<CGRect>()); virtual CFTimeInterval lastCommitTime() const; virtual void setShouldInvertColors(bool); +#if USE(AVFOUNDATION) + virtual GraphicsDeviceAdapter* graphicsDeviceAdapter() const OVERRIDE; +#endif RetainPtr<WKCACFViewRef> m_view; bool m_viewNeedsUpdate; diff --git a/Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp b/Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp index 5e5f56853..3b4c9ccf3 100644 --- a/Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp +++ b/Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp @@ -29,7 +29,6 @@ #include "config.h" #include "ImageBuffer.h" -#include "Base64.h" #include "BitmapImage.h" #include "CairoUtilities.h" #include "Color.h" @@ -43,6 +42,7 @@ #include "RefPtrCairo.h" #include <cairo.h> #include <wtf/Vector.h> +#include <wtf/text/Base64.h> using namespace std; diff --git a/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp b/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp index 748946820..2657d5412 100644 --- a/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp +++ b/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp @@ -54,12 +54,12 @@ #if PLATFORM(MAC) || (PLATFORM(CHROMIUM) && OS(DARWIN)) -#ifndef BUILDING_ON_LEOPARD +#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MAX_ALLOWED >= 1060 // Building on 10.6 or later: kCGInterpolationMedium is defined in the CGInterpolationQuality enum. #define HAVE_CG_INTERPOLATION_MEDIUM 1 #endif -#ifndef TARGETING_LEOPARD +#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 // Targeting 10.6 or later: use kCGInterpolationMedium. #define WTF_USE_CG_INTERPOLATION_MEDIUM 1 #endif @@ -1181,7 +1181,7 @@ void GraphicsContext::setPlatformShadow(const FloatSize& offset, float blur, con blurRadius = min(blurRadius, narrowPrecisionToCGFloat(1000.0)); -#if defined(BUILDING_ON_SNOW_LEOPARD) || defined(BUILDING_ON_LION) +#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED <= 1070 if (!isAcceleratedContext()) { // Work around <rdar://problem/5539388> by ensuring that the offsets will get truncated // to the desired integer. Also see: <rdar://problem/10056277> @@ -1598,7 +1598,7 @@ InterpolationQuality GraphicsContext::imageInterpolationQuality() const void GraphicsContext::setAllowsFontSmoothing(bool allowsFontSmoothing) { UNUSED_PARAM(allowsFontSmoothing); -#if !defined(BUILDING_ON_LEOPARD) +#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 CGContextRef context = platformContext(); CGContextSetAllowsFontSmoothing(context, allowsFontSmoothing); #endif diff --git a/Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp b/Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp index 81982a188..21e9db4c2 100644 --- a/Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp +++ b/Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp @@ -28,7 +28,6 @@ #include "config.h" #include "ImageBuffer.h" -#include "Base64.h" #include "BitmapImage.h" #include "GraphicsContext.h" #include "GraphicsContextCG.h" @@ -42,6 +41,7 @@ #include <wtf/OwnArrayPtr.h> #include <wtf/RetainPtr.h> #include <wtf/UnusedParam.h> +#include <wtf/text/Base64.h> #include <wtf/text/WTFString.h> #if PLATFORM(MAC) || PLATFORM(CHROMIUM) @@ -52,7 +52,7 @@ #include <IOSurface/IOSurface.h> #endif -#if defined(BUILDING_ON_LION) +#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1070 #include <wtf/CurrentTime.h> #endif @@ -183,7 +183,7 @@ ImageBuffer::ImageBuffer(const IntSize& size, float resolutionScale, ColorSpace m_context->scale(FloatSize(1, -1)); m_context->translate(0, -size.height()); m_context->setIsAcceleratedContext(accelerateRendering); -#if defined(BUILDING_ON_LION) +#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1070 m_data.m_lastFlushTime = currentTimeMS(); #endif success = true; @@ -195,7 +195,7 @@ ImageBuffer::~ImageBuffer() GraphicsContext* ImageBuffer::context() const { -#if defined(BUILDING_ON_LION) +#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1070 // Force a flush if last flush was more than 20ms ago if (m_context->isAcceleratedContext()) { double elapsedTime = currentTimeMS() - m_data.m_lastFlushTime; @@ -250,7 +250,7 @@ NativeImagePtr ImageBuffer::copyNativeImage(BackingStoreCopy copyBehavior) const #if USE(IOSURFACE_CANVAS_BACKING_STORE) else { image = wkIOSurfaceContextCreateImage(context()->platformContext()); -#if defined(BUILDING_ON_LION) +#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1070 m_data.m_lastFlushTime = currentTimeMS(); #endif } @@ -310,7 +310,7 @@ PassRefPtr<Uint8ClampedArray> ImageBuffer::getUnmultipliedImageData(const IntRec { if (m_context->isAcceleratedContext()) { CGContextFlush(context()->platformContext()); -#if defined(BUILDING_ON_LION) +#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1070 m_data.m_lastFlushTime = currentTimeMS(); #endif } @@ -321,7 +321,7 @@ PassRefPtr<Uint8ClampedArray> ImageBuffer::getPremultipliedImageData(const IntRe { if (m_context->isAcceleratedContext()) { CGContextFlush(context()->platformContext()); -#if defined(BUILDING_ON_LION) +#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1070 m_data.m_lastFlushTime = currentTimeMS(); #endif } diff --git a/Source/WebCore/platform/graphics/cg/ImageBufferDataCG.cpp b/Source/WebCore/platform/graphics/cg/ImageBufferDataCG.cpp index 5e3ae78a8..649d9b766 100644 --- a/Source/WebCore/platform/graphics/cg/ImageBufferDataCG.cpp +++ b/Source/WebCore/platform/graphics/cg/ImageBufferDataCG.cpp @@ -62,7 +62,7 @@ ImageBufferData::ImageBufferData(const IntSize&) #if USE(ACCELERATE) -#ifndef TARGETING_SNOW_LEOPARD +#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 1070 static bool haveVImageRoundingErrorFix() { return true; } #else // The vImage unpremultiply routine had a rounding bug before 10.6.7 <rdar://problem/8631548> @@ -72,7 +72,7 @@ static bool haveVImageRoundingErrorFix() static bool result = (Gestalt(gestaltSystemVersion, &version) == noErr && version > 0x1066); return result; } -#endif // TARGETING_SNOW_LEOPARD +#endif // __MAC_OS_X_VERSION_MAX_ALLOWED >= 1070 #if USE(IOSURFACE_CANVAS_BACKING_STORE) static void convertScanline(void* data, size_t tileNumber, bool premultiply) diff --git a/Source/WebCore/platform/graphics/cg/ImageBufferDataCG.h b/Source/WebCore/platform/graphics/cg/ImageBufferDataCG.h index 6233c6c2c..8e61edff9 100644 --- a/Source/WebCore/platform/graphics/cg/ImageBufferDataCG.h +++ b/Source/WebCore/platform/graphics/cg/ImageBufferDataCG.h @@ -30,7 +30,7 @@ #include <wtf/RetainPtr.h> #include <wtf/Uint8ClampedArray.h> -#if (PLATFORM(MAC) && USE(CA) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)) +#if (PLATFORM(MAC) && USE(CA) && (PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070)) #define WTF_USE_IOSURFACE_CANVAS_BACKING_STORE 1 #endif @@ -54,7 +54,7 @@ public: Checked<unsigned, RecordOverflow> m_bytesPerRow; CGColorSpaceRef m_colorSpace; RetainPtr<IOSurfaceRef> m_surface; -#if defined(BUILDING_ON_LION) +#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1070 mutable double m_lastFlushTime; #endif diff --git a/Source/WebCore/platform/graphics/cg/ImageCG.cpp b/Source/WebCore/platform/graphics/cg/ImageCG.cpp index fed911aeb..2c0cca22b 100644 --- a/Source/WebCore/platform/graphics/cg/ImageCG.cpp +++ b/Source/WebCore/platform/graphics/cg/ImageCG.cpp @@ -269,7 +269,7 @@ void Image::drawPattern(GraphicsContext* ctxt, const FloatRect& tileRect, const // FIXME: We cannot use CGContextDrawTiledImage with scaled tiles on Leopard, because it suffers from rounding errors. Snow Leopard is ok. float scaledTileWidth = tileRect.width() * narrowPrecisionToFloat(patternTransform.a()); float w = CGImageGetWidth(tileImage); -#ifdef BUILDING_ON_LEOPARD +#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1050 if (w == size().width() && h == size().height() && scaledTileWidth == tileRect.width() && scaledTileHeight == tileRect.height()) #else if (w == size().width() && h == size().height()) diff --git a/Source/WebCore/platform/graphics/cg/ImageSourceCG.cpp b/Source/WebCore/platform/graphics/cg/ImageSourceCG.cpp index 43353650c..7cf02968e 100644 --- a/Source/WebCore/platform/graphics/cg/ImageSourceCG.cpp +++ b/Source/WebCore/platform/graphics/cg/ImageSourceCG.cpp @@ -85,7 +85,7 @@ ImageSource::~ImageSource() void ImageSource::clear(bool destroyAllFrames, size_t, SharedBuffer* data, bool allDataReceived) { -#if !defined(BUILDING_ON_LEOPARD) +#if !PLATFORM(MAC) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 // Recent versions of ImageIO discard previously decoded image frames if the client // application no longer holds references to them, so there's no need to throw away // the decoder unless we're explicitly asked to destroy all of the frames. @@ -116,7 +116,7 @@ static CFDictionaryRef imageSourceOptions(ImageSource::ShouldSkipMetadata skipMe if (!options) { const unsigned numOptions = 3; -#if defined(BUILDING_ON_LION) || defined(BUILDING_ON_SNOW_LEOPARD) +#if PLATFORM(MAC) && !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED <= 1070 // Lion and Snow Leopard only return Orientation when kCGImageSourceSkipMetaData is false, // and incorrectly return cached metadata if an image is queried once with kCGImageSourceSkipMetaData true // and then subsequently with kCGImageSourceSkipMetaData false. diff --git a/Source/WebCore/platform/graphics/cg/PathCG.cpp b/Source/WebCore/platform/graphics/cg/PathCG.cpp index 6cc937836..e7dee39d3 100644 --- a/Source/WebCore/platform/graphics/cg/PathCG.cpp +++ b/Source/WebCore/platform/graphics/cg/PathCG.cpp @@ -175,7 +175,7 @@ FloatRect Path::boundingRect() const // does not, but only exists on 10.6 and above. CGRect bound = CGRectZero; -#if !defined(BUILDING_ON_LEOPARD) +#if !PLATFORM(MAC) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 bound = CGPathGetPathBoundingBox(m_path); #else bound = CGPathGetBoundingBox(m_path); @@ -236,7 +236,7 @@ void Path::addArcTo(const FloatPoint& p1, const FloatPoint& p2, float radius) void Path::platformAddPathForRoundedRect(const FloatRect& rect, const FloatSize& topLeftRadius, const FloatSize& topRightRadius, const FloatSize& bottomLeftRadius, const FloatSize& bottomRightRadius) { -#if PLATFORM(MAC) && (!defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)) +#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 bool equalWidths = (topLeftRadius.width() == topRightRadius.width() && topRightRadius.width() == bottomLeftRadius.width() && bottomLeftRadius.width() == bottomRightRadius.width()); bool equalHeights = (topLeftRadius.height() == bottomLeftRadius.height() && bottomLeftRadius.height() == topRightRadius.height() && topRightRadius.height() == bottomRightRadius.height()); diff --git a/Source/WebCore/platform/graphics/chromium/BitmapCanvasLayerTextureUpdater.cpp b/Source/WebCore/platform/graphics/chromium/BitmapCanvasLayerTextureUpdater.cpp index f869c58a2..d75cf054d 100644 --- a/Source/WebCore/platform/graphics/chromium/BitmapCanvasLayerTextureUpdater.cpp +++ b/Source/WebCore/platform/graphics/chromium/BitmapCanvasLayerTextureUpdater.cpp @@ -33,6 +33,7 @@ #include "LayerPainterChromium.h" #include "PlatformColor.h" #include "PlatformContextSkia.h" +#include "TextureAllocator.h" #include "cc/CCGraphicsContext.h" #include "skia/ext/platform_canvas.h" diff --git a/Source/WebCore/platform/graphics/chromium/BitmapCanvasLayerTextureUpdater.h b/Source/WebCore/platform/graphics/chromium/BitmapCanvasLayerTextureUpdater.h index d97968c03..276e2b391 100644 --- a/Source/WebCore/platform/graphics/chromium/BitmapCanvasLayerTextureUpdater.h +++ b/Source/WebCore/platform/graphics/chromium/BitmapCanvasLayerTextureUpdater.h @@ -38,6 +38,7 @@ namespace WebCore { class LayerPainterChromium; class CCGraphicsContext; +class TextureAllocator; // This class rasterizes the contentRect into a skia bitmap canvas. It then updates // textures by copying from the canvas into the texture, using MapSubImage if diff --git a/Source/WebCore/platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.cpp b/Source/WebCore/platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.cpp index 23cffea94..86fb2c8c3 100644 --- a/Source/WebCore/platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.cpp +++ b/Source/WebCore/platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.cpp @@ -34,6 +34,7 @@ #include "PlatformColor.h" #include "SkCanvas.h" #include "SkDevice.h" +#include "TextureAllocator.h" #include "cc/CCGraphicsContext.h" namespace WebCore { diff --git a/Source/WebCore/platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.h b/Source/WebCore/platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.h index 787b39937..9f1388827 100644 --- a/Source/WebCore/platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.h +++ b/Source/WebCore/platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.h @@ -34,6 +34,8 @@ namespace WebCore { +class TextureAllocator; + // This class records the contentRect into an SkPicture, then software rasterizes // the SkPicture into bitmaps for each tile. This implements CCSettings::perTilePainting. class BitmapSkPictureCanvasLayerTextureUpdater : public SkPictureCanvasLayerTextureUpdater { diff --git a/Source/WebCore/platform/graphics/chromium/CanvasLayerTextureUpdater.cpp b/Source/WebCore/platform/graphics/chromium/CanvasLayerTextureUpdater.cpp index be8484b75..782780a40 100644 --- a/Source/WebCore/platform/graphics/chromium/CanvasLayerTextureUpdater.cpp +++ b/Source/WebCore/platform/graphics/chromium/CanvasLayerTextureUpdater.cpp @@ -75,8 +75,9 @@ void CanvasLayerTextureUpdater::paintContents(SkCanvas* canvas, const IntRect& c m_painter->paint(canvas, layerRect, opaqueLayerRect); canvas->restore(); - opaqueLayerRect.scale(contentsWidthScale, contentsHeightScale); - resultingOpaqueRect = enclosedIntRect(opaqueLayerRect); + FloatRect opaqueContentRect = opaqueLayerRect; + opaqueContentRect.scale(contentsWidthScale, contentsHeightScale); + resultingOpaqueRect = enclosedIntRect(opaqueContentRect); m_contentRect = contentRect; } diff --git a/Source/WebCore/platform/graphics/chromium/ContentLayerChromium.cpp b/Source/WebCore/platform/graphics/chromium/ContentLayerChromium.cpp index 078d377d0..9f40f7fe1 100644 --- a/Source/WebCore/platform/graphics/chromium/ContentLayerChromium.cpp +++ b/Source/WebCore/platform/graphics/chromium/ContentLayerChromium.cpp @@ -97,14 +97,14 @@ void ContentLayerChromium::update(CCTextureUpdater& updater, const CCOcclusionTr { createTextureUpdaterIfNeeded(); - IntRect layerRect; + IntRect contentRect; - // Always call updateLayerRect() but with an empty layer rectangle when + // Always call updateContentRect() but with an empty layer rectangle when // layer doesn't draw contents. if (drawsContent()) - layerRect = visibleLayerRect(); + contentRect = visibleContentRect(); - updateLayerRect(updater, layerRect, occlusion); + updateContentRect(updater, contentRect, occlusion); m_needsDisplay = false; } @@ -112,7 +112,7 @@ bool ContentLayerChromium::needMoreUpdates() { if (!drawsContent()) return false; - return needsIdlePaint(visibleLayerRect()); + return needsIdlePaint(visibleContentRect()); } void ContentLayerChromium::createTextureUpdaterIfNeeded() diff --git a/Source/WebCore/platform/graphics/chromium/ImageLayerChromium.cpp b/Source/WebCore/platform/graphics/chromium/ImageLayerChromium.cpp index 14164133d..696563acf 100644 --- a/Source/WebCore/platform/graphics/chromium/ImageLayerChromium.cpp +++ b/Source/WebCore/platform/graphics/chromium/ImageLayerChromium.cpp @@ -36,7 +36,6 @@ #include "LayerTextureSubImage.h" #include "LayerTextureUpdater.h" -#include "ManagedTexture.h" #include "PlatformColor.h" #include "cc/CCLayerTreeHost.h" @@ -155,11 +154,11 @@ void ImageLayerChromium::update(CCTextureUpdater& updater, const CCOcclusionTrac if (m_needsDisplay) { m_textureUpdater->setBitmap(m_bitmap); updateTileSizeAndTilingOption(); - invalidateRect(IntRect(IntPoint(), contentBounds())); + invalidateContentRect(IntRect(IntPoint(), contentBounds())); m_needsDisplay = false; } - updateLayerRect(updater, visibleLayerRect(), occlusion); + updateContentRect(updater, visibleContentRect(), occlusion); } void ImageLayerChromium::createTextureUpdaterIfNeeded() diff --git a/Source/WebCore/platform/graphics/chromium/LayerChromium.cpp b/Source/WebCore/platform/graphics/chromium/LayerChromium.cpp index 38b856e63..4ae8db39c 100644 --- a/Source/WebCore/platform/graphics/chromium/LayerChromium.cpp +++ b/Source/WebCore/platform/graphics/chromium/LayerChromium.cpp @@ -732,7 +732,7 @@ void LayerChromium::notifyAnimationFinished(double wallClockTime) Region LayerChromium::visibleContentOpaqueRegion() const { if (opaque()) - return visibleLayerRect(); + return visibleContentRect(); return Region(); } diff --git a/Source/WebCore/platform/graphics/chromium/LayerChromium.h b/Source/WebCore/platform/graphics/chromium/LayerChromium.h index e3ceb94d0..40668f556 100644 --- a/Source/WebCore/platform/graphics/chromium/LayerChromium.h +++ b/Source/WebCore/platform/graphics/chromium/LayerChromium.h @@ -154,8 +154,8 @@ public: void setTransform(const WebKit::WebTransformationMatrix&); bool transformIsAnimating() const; - const IntRect& visibleLayerRect() const { return m_visibleLayerRect; } - void setVisibleLayerRect(const IntRect& visibleLayerRect) { m_visibleLayerRect = visibleLayerRect; } + const IntRect& visibleContentRect() const { return m_visibleContentRect; } + void setVisibleContentRect(const IntRect& visibleContentRect) { m_visibleContentRect = visibleContentRect; } const IntRect& scissorRect() const { return m_scissorRect; } void setScissorRect(const IntRect& scissorRect) { m_scissorRect = scissorRect; } @@ -344,7 +344,7 @@ private: IntSize m_bounds; // Uses layer's content space. - IntRect m_visibleLayerRect; + IntRect m_visibleContentRect; // During drawing, identifies the region outside of which nothing should be drawn. // Currently this is set to layer's clipRect if usesLayerClipping is true, otherwise diff --git a/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp b/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp index 55b5929a3..a72674140 100644 --- a/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp +++ b/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp @@ -43,28 +43,18 @@ #include "SharedGraphicsContext3D.h" #include "SkBitmap.h" #include "SkColor.h" -#include "TextureManager.h" #include "ThrottledTextureUploader.h" #include "TraceEvent.h" #include "TrackingTextureAllocator.h" -#include "cc/CCCheckerboardDrawQuad.h" -#include "cc/CCDebugBorderDrawQuad.h" -#include "cc/CCIOSurfaceDrawQuad.h" #include "cc/CCLayerQuad.h" #include "cc/CCMathUtil.h" #include "cc/CCProxy.h" #include "cc/CCRenderPass.h" -#include "cc/CCRenderPassDrawQuad.h" #include "cc/CCRenderSurfaceFilters.h" #include "cc/CCScopedTexture.h" #include "cc/CCSettings.h" #include "cc/CCSingleThreadProxy.h" -#include "cc/CCSolidColorDrawQuad.h" -#include "cc/CCStreamVideoDrawQuad.h" -#include "cc/CCTextureDrawQuad.h" -#include "cc/CCTileDrawQuad.h" #include "cc/CCVideoLayerImpl.h" -#include "cc/CCYUVVideoDrawQuad.h" #include <public/WebGraphicsContext3D.h> #include <public/WebVideoFrame.h> #include <wtf/CurrentTime.h> @@ -218,8 +208,6 @@ bool LayerRendererChromium::initialize() m_capabilities.usingGpuMemoryManager = extensions.contains("GL_CHROMIUM_gpu_memory_manager"); if (m_capabilities.usingGpuMemoryManager) m_context->setMemoryAllocationChangedCallbackCHROMIUM(this); - else - m_client->setMemoryAllocationLimitBytes(TextureManager::highLimitBytes(viewportSize())); m_capabilities.usingDiscardFramebuffer = extensions.contains("GL_CHROMIUM_discard_framebuffer"); @@ -327,7 +315,7 @@ void LayerRendererChromium::decideRenderPassAllocationsForFrame(const CCRenderPa { HashMap<int, const CCRenderPass*> passesInFrame; for (size_t i = 0; i < renderPassesInDrawOrder.size(); ++i) - passesInFrame.set(renderPassesInDrawOrder[i]->id(), renderPassesInDrawOrder[i].get()); + passesInFrame.set(renderPassesInDrawOrder[i]->id(), renderPassesInDrawOrder[i]); Vector<int> passesToDelete; HashMap<int, OwnPtr<CCScopedTexture> >::const_iterator passIterator; @@ -414,7 +402,7 @@ void LayerRendererChromium::drawRenderPass(const CCRenderPass* renderPass, const drawQuad(it->get()); } -void LayerRendererChromium::drawQuad(const CCDrawQuad* quad) +void LayerRendererChromium::drawQuad(const WebKit::WebCompositorQuad* quad) { IntRect scissorRect = quad->scissorRect(); @@ -430,35 +418,35 @@ void LayerRendererChromium::drawQuad(const CCDrawQuad* quad) GLC(m_context, m_context->disable(GraphicsContext3D::BLEND)); switch (quad->material()) { - case CCDrawQuad::Invalid: + case WebKit::WebCompositorQuad::Invalid: ASSERT_NOT_REACHED(); break; - case CCDrawQuad::Checkerboard: - drawCheckerboardQuad(quad->toCheckerboardDrawQuad()); + case WebKit::WebCompositorQuad::Checkerboard: + drawCheckerboardQuad(CCCheckerboardDrawQuad::materialCast(quad)); break; - case CCDrawQuad::DebugBorder: - drawDebugBorderQuad(quad->toDebugBorderDrawQuad()); + case WebKit::WebCompositorQuad::DebugBorder: + drawDebugBorderQuad(CCDebugBorderDrawQuad::materialCast(quad)); break; - case CCDrawQuad::IOSurfaceContent: - drawIOSurfaceQuad(quad->toIOSurfaceDrawQuad()); + case WebKit::WebCompositorQuad::IOSurfaceContent: + drawIOSurfaceQuad(CCIOSurfaceDrawQuad::materialCast(quad)); break; - case CCDrawQuad::RenderPass: - drawRenderPassQuad(quad->toRenderPassDrawQuad()); + case WebKit::WebCompositorQuad::RenderPass: + drawRenderPassQuad(CCRenderPassDrawQuad::materialCast(quad)); break; - case CCDrawQuad::SolidColor: - drawSolidColorQuad(quad->toSolidColorDrawQuad()); + case WebKit::WebCompositorQuad::SolidColor: + drawSolidColorQuad(WebKit::WebCompositorSolidColorQuad::materialCast(quad)); break; - case CCDrawQuad::StreamVideoContent: - drawStreamVideoQuad(quad->toStreamVideoDrawQuad()); + case WebKit::WebCompositorQuad::StreamVideoContent: + drawStreamVideoQuad(CCStreamVideoDrawQuad::materialCast(quad)); break; - case CCDrawQuad::TextureContent: - drawTextureQuad(quad->toTextureDrawQuad()); + case WebKit::WebCompositorQuad::TextureContent: + drawTextureQuad(WebKit::WebCompositorTextureQuad::materialCast(quad)); break; - case CCDrawQuad::TiledContent: - drawTileQuad(quad->toTileDrawQuad()); + case WebKit::WebCompositorQuad::TiledContent: + drawTileQuad(CCTileDrawQuad::materialCast(quad)); break; - case CCDrawQuad::YUVVideoContent: - drawYUVVideoQuad(quad->toYUVVideoDrawQuad()); + case WebKit::WebCompositorQuad::YUVVideoContent: + drawYUVVideoQuad(CCYUVVideoDrawQuad::materialCast(quad)); break; } } @@ -610,7 +598,7 @@ void LayerRendererChromium::drawRenderPassQuad(const CCRenderPassDrawQuad* quad) if (!contentsTexture || !contentsTexture->id()) return; - WebTransformationMatrix renderTransform = quad->layerTransform(); + WebTransformationMatrix renderTransform = quad->drawTransform(); // Apply a scaling factor to size the quad from 1x1 to its intended size. renderTransform.scale3d(quad->quadRect().width(), quad->quadRect().height(), 1); WebTransformationMatrix contentsDeviceTransform = WebTransformationMatrix(windowMatrix() * projectionMatrix() * renderTransform).to2dTransform(); @@ -633,7 +621,7 @@ void LayerRendererChromium::drawRenderPassQuad(const CCRenderPassDrawQuad* quad) // Draw the background texture if there is one. if (backgroundTexture) { ASSERT(backgroundTexture->size() == quad->quadRect().size()); - copyTextureToFramebuffer(backgroundTexture->id(), quad->quadRect().size(), quad->layerTransform()); + copyTextureToFramebuffer(backgroundTexture->id(), quad->quadRect().size(), quad->drawTransform()); } bool clipped = false; @@ -711,11 +699,11 @@ void LayerRendererChromium::drawRenderPassQuad(const CCRenderPassDrawQuad* quad) GLC(context(), context()->uniform3fv(shaderEdgeLocation, 8, edge)); } - // Map device space quad to surface space. contentsDeviceTransform has no perspective since it was generated with to2dTransform() so we don't need to project. + // Map device space quad to surface space. contentsDeviceTransform has no 3d component since it was generated with to2dTransform() so we don't need to project. FloatQuad surfaceQuad = CCMathUtil::mapQuad(contentsDeviceTransform.inverse(), deviceLayerEdges.floatQuad(), clipped); ASSERT(!clipped); - drawTexturedQuad(quad->layerTransform(), quad->quadRect().width(), quad->quadRect().height(), quad->opacity(), surfaceQuad, + drawTexturedQuad(quad->drawTransform(), quad->quadRect().width(), quad->quadRect().height(), quad->opacity(), surfaceQuad, shaderMatrixLocation, shaderAlphaLocation, shaderQuadLocation); } @@ -807,7 +795,7 @@ void LayerRendererChromium::drawTileQuad(const CCTileDrawQuad* quad) return; bool clipped = false; - FloatQuad deviceLayerQuad = CCMathUtil::mapQuad(deviceTransform, FloatQuad(quad->layerRect()), clipped); + FloatQuad deviceLayerQuad = CCMathUtil::mapQuad(deviceTransform, FloatQuad(quad->visibleContentRect()), clipped); ASSERT(!clipped); TileProgramUniforms uniforms; @@ -891,10 +879,12 @@ void LayerRendererChromium::drawTileQuad(const CCTileDrawQuad* quad) // Create device space quad. CCLayerQuad deviceQuad(leftEdge, topEdge, rightEdge, bottomEdge); - // Map quad to layer space. + // Map device space quad to local space. contentsDeviceTransform has no 3d component since it was generated with to2dTransform() so we don't need to project. WebTransformationMatrix inverseDeviceTransform = deviceTransform.inverse(); localQuad = CCMathUtil::mapQuad(inverseDeviceTransform, deviceQuad.floatQuad(), clipped); - ASSERT(!clipped); + + // We should not ASSERT(!clipped) here, because anti-aliasing inflation may cause deviceQuad to become + // clipped. To our knowledge this scenario does not need to be handled differently than the unclipped case. } else { // Move fragment shader transform to vertex shader. We can do this while // still producing correct results as fragmentTexTransformLocation @@ -968,11 +958,12 @@ void LayerRendererChromium::drawYUVVideoQuad(const CCYUVVideoDrawQuad* quad) }; GLC(context(), context()->uniform3fv(program->fragmentShader().yuvAdjLocation(), 1, yuvAdjust)); - const IntSize& bounds = quad->quadRect().size(); - drawTexturedQuad(quad->layerTransform(), bounds.width(), bounds.height(), quad->opacity(), FloatQuad(), - program->vertexShader().matrixLocation(), - program->fragmentShader().alphaLocation(), - -1); + WebTransformationMatrix quadTransform = quad->quadTransform(); + IntRect quadRect = quad->quadRect(); + quadTransform.translate(quadRect.x() + quadRect.width() / 2.0, quadRect.y() + quadRect.height() / 2.0); + + drawTexturedQuad(quadTransform, quadRect.width(), quadRect.height(), quad->opacity(), FloatQuad(), + program->vertexShader().matrixLocation(), program->fragmentShader().alphaLocation(), -1); // Reset active texture back to texture 0. GLC(context(), context()->activeTexture(GraphicsContext3D::TEXTURE0)); @@ -995,11 +986,12 @@ void LayerRendererChromium::drawStreamVideoQuad(const CCStreamVideoDrawQuad* qua GLC(context(), context()->uniform1i(program->fragmentShader().samplerLocation(), 0)); - const IntSize& bounds = quad->quadRect().size(); - drawTexturedQuad(quad->layerTransform(), bounds.width(), bounds.height(), quad->opacity(), sharedGeometryQuad(), - program->vertexShader().matrixLocation(), - program->fragmentShader().alphaLocation(), - -1); + WebTransformationMatrix quadTransform = quad->quadTransform(); + IntRect quadRect = quad->quadRect(); + quadTransform.translate(quadRect.x() + quadRect.width() / 2.0, quadRect.y() + quadRect.height() / 2.0); + + drawTexturedQuad(quadTransform, quadRect.width(), quadRect.height(), quad->opacity(), sharedGeometryQuad(), + program->vertexShader().matrixLocation(), program->fragmentShader().alphaLocation(), -1); } struct TextureProgramBinding { @@ -1092,9 +1084,11 @@ void LayerRendererChromium::drawIOSurfaceQuad(const CCIOSurfaceDrawQuad* quad) GLC(context(), context()->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_WRAP_S, GraphicsContext3D::CLAMP_TO_EDGE)); GLC(context(), context()->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_WRAP_T, GraphicsContext3D::CLAMP_TO_EDGE)); - const IntSize& bounds = quad->quadRect().size(); + WebTransformationMatrix quadTransform = quad->quadTransform(); + IntRect quadRect = quad->quadRect(); + quadTransform.translate(quadRect.x() + quadRect.width() / 2.0, quadRect.y() + quadRect.height() / 2.0); - drawTexturedQuad(quad->layerTransform(), bounds.width(), bounds.height(), quad->opacity(), sharedGeometryQuad(), binding.matrixLocation, binding.alphaLocation, -1); + drawTexturedQuad(quadTransform, quadRect.width(), quadRect.height(), quad->opacity(), sharedGeometryQuad(), binding.matrixLocation, binding.alphaLocation, -1); GLC(context(), context()->bindTexture(Extensions3D::TEXTURE_RECTANGLE_ARB, 0)); } diff --git a/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.h b/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.h index 6afe66806..415520d7f 100644 --- a/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.h +++ b/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.h @@ -37,7 +37,16 @@ #include "Extensions3DChromium.h" #include "TextureCopier.h" #include "TrackingTextureAllocator.h" +#include "cc/CCCheckerboardDrawQuad.h" +#include "cc/CCDebugBorderDrawQuad.h" +#include "cc/CCIOSurfaceDrawQuad.h" +#include "cc/CCRenderPassDrawQuad.h" #include "cc/CCRenderer.h" +#include "cc/CCSolidColorDrawQuad.h" +#include "cc/CCStreamVideoDrawQuad.h" +#include "cc/CCTextureDrawQuad.h" +#include "cc/CCTileDrawQuad.h" +#include "cc/CCYUVVideoDrawQuad.h" #include <wtf/PassOwnPtr.h> namespace WebKit { @@ -46,17 +55,7 @@ class WebGraphicsContext3D; namespace WebCore { -class CCCheckerboardDrawQuad; -class CCDebugBorderDrawQuad; -class CCDrawQuad; -class CCIOSurfaceDrawQuad; -class CCRenderPassDrawQuad; class CCScopedTexture; -class CCSolidColorDrawQuad; -class CCStreamVideoDrawQuad; -class CCTextureDrawQuad; -class CCTileDrawQuad; -class CCYUVVideoDrawQuad; class GeometryBinding; class ScopedEnsureFramebufferAllocation; diff --git a/Source/WebCore/platform/graphics/chromium/ManagedTexture.cpp b/Source/WebCore/platform/graphics/chromium/ManagedTexture.cpp deleted file mode 100644 index 4dabf1beb..000000000 --- a/Source/WebCore/platform/graphics/chromium/ManagedTexture.cpp +++ /dev/null @@ -1,151 +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 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" - -#if USE(ACCELERATED_COMPOSITING) - -#include "ManagedTexture.h" - -#include "GraphicsContext3D.h" -#include "cc/CCGraphicsContext.h" -#include <public/WebGraphicsContext3D.h> - -using WebKit::WebGraphicsContext3D; - -namespace WebCore { - -ManagedTexture::ManagedTexture(TextureManager* manager) - : m_textureManager(manager) - , m_token(0) - , m_format(0) - , m_textureId(0) -{ - m_textureManager->registerTexture(this); -} - -ManagedTexture::ManagedTexture(TextureManager* manager, TextureToken token, IntSize size, unsigned format, unsigned textureId) - : m_textureManager(manager) - , m_token(token) - , m_size(size) - , m_format(format) - , m_textureId(textureId) -{ - m_textureManager->registerTexture(this); -} - -ManagedTexture::~ManagedTexture() -{ - if (!m_textureManager) - return; - m_textureManager->unregisterTexture(this); - if (m_token) - m_textureManager->releaseToken(m_token); -} - -void ManagedTexture::setTextureManager(TextureManager* manager) -{ - if (manager == m_textureManager) - return; - - if (m_textureManager) - m_textureManager->unregisterTexture(this); - m_textureManager = manager; - clear(); - if (m_textureManager) - m_textureManager->registerTexture(this); -} - -bool ManagedTexture::isValid(const IntSize& size, unsigned format) -{ - return m_token && size == m_size && format == m_format && m_textureManager && m_textureManager->hasTexture(m_token); -} - -bool ManagedTexture::reserve(const IntSize& size, unsigned format) -{ - if (!m_textureManager) - return false; - - if (!m_token) - m_token = m_textureManager->getToken(); - - bool reserved = true; - if (size == m_size && format == m_format && m_textureManager->hasTexture(m_token)) - m_textureManager->protectTexture(m_token); - else { - m_textureId = 0; - reserved = m_textureManager->requestTexture(m_token, size, format); - if (reserved) { - m_size = size; - m_format = format; - } - } - - return reserved; -} - -void ManagedTexture::unreserve() -{ - if (!m_token || !m_textureManager) - return; - - m_textureManager->unprotectTexture(m_token); -} - -void ManagedTexture::allocate(TextureAllocator* allocator) -{ - ASSERT(m_textureManager->hasTexture(m_token)); - if (!m_textureId) - m_textureId = m_textureManager->allocateTexture(allocator, m_token); -} - -void ManagedTexture::bindTexture(CCGraphicsContext* context, TextureAllocator* allocator) -{ - allocate(allocator); - WebGraphicsContext3D* context3d = context->context3D(); - if (!context3d) { - // FIXME: Implement this path for software compositing. - return; - } - context3d->bindTexture(GraphicsContext3D::TEXTURE_2D, m_textureId); -} - -PassOwnPtr<ManagedTexture> ManagedTexture::steal() -{ - OwnPtr<ManagedTexture> texture = adoptPtr(new ManagedTexture(m_textureManager, m_token, m_size, m_format, m_textureId)); - clear(); - return texture.release(); -} - -void ManagedTexture::clear() -{ - m_token = 0; - m_size = IntSize(); - m_format = 0; - m_textureId = 0; -} - -} - -#endif // USE(ACCELERATED_COMPOSITING) diff --git a/Source/WebCore/platform/graphics/chromium/ManagedTexture.h b/Source/WebCore/platform/graphics/chromium/ManagedTexture.h deleted file mode 100644 index 6e67ebf68..000000000 --- a/Source/WebCore/platform/graphics/chromium/ManagedTexture.h +++ /dev/null @@ -1,86 +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 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 ManagedTexture_h -#define ManagedTexture_h - -#include "IntSize.h" -#include "TextureManager.h" - -#include <wtf/FastAllocBase.h> -#include <wtf/Noncopyable.h> -#include <wtf/PassOwnPtr.h> -#include <wtf/RefPtr.h> - -namespace WebCore { - -class CCGraphicsContext; - -class ManagedTexture { - WTF_MAKE_NONCOPYABLE(ManagedTexture); -public: - static PassOwnPtr<ManagedTexture> create(TextureManager* manager) - { - return adoptPtr(new ManagedTexture(manager)); - } - ~ManagedTexture(); - - void setTextureManager(TextureManager*); - void clearManager() { m_textureManager = 0; } - - bool isValid(const IntSize&, unsigned format); - bool reserve(const IntSize&, unsigned format); - void unreserve(); - bool isReserved() - { - return m_textureManager && m_textureManager->isProtected(m_token); - } - - void allocate(TextureAllocator*); - void bindTexture(CCGraphicsContext*, TextureAllocator*); - - IntSize size() const { return m_size; } - unsigned format() const { return m_format; } - unsigned textureId() const { return m_textureId; } - - // Steal token and textureId by instantiates a new texture using existing - // member variables. - PassOwnPtr<ManagedTexture> steal(); - -private: - explicit ManagedTexture(TextureManager*); - ManagedTexture(TextureManager*, TextureToken, IntSize, unsigned format, unsigned textureId); - - void clear(); - - TextureManager* m_textureManager; - TextureToken m_token; - IntSize m_size; - unsigned m_format; - unsigned m_textureId; -}; - -} - -#endif // ManagedTexture_h diff --git a/Source/WebCore/platform/graphics/chromium/RenderSurfaceChromium.h b/Source/WebCore/platform/graphics/chromium/RenderSurfaceChromium.h index 0e7d4e38c..2b608f4e7 100644 --- a/Source/WebCore/platform/graphics/chromium/RenderSurfaceChromium.h +++ b/Source/WebCore/platform/graphics/chromium/RenderSurfaceChromium.h @@ -40,7 +40,6 @@ namespace WebCore { class FilterOperations; class LayerChromium; class LayerRendererChromium; -class ManagedTexture; class RenderSurfaceChromium { WTF_MAKE_NONCOPYABLE(RenderSurfaceChromium); diff --git a/Source/WebCore/platform/graphics/chromium/TextureAllocator.h b/Source/WebCore/platform/graphics/chromium/TextureAllocator.h new file mode 100644 index 000000000..58de11522 --- /dev/null +++ b/Source/WebCore/platform/graphics/chromium/TextureAllocator.h @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2012, Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + +#ifndef TextureAllocator_h +#define TextureAllocator_h + +#include "GraphicsContext3D.h" +#include "IntRect.h" +#include "IntSize.h" + +namespace WebCore { + +class TextureAllocator { +public: + virtual unsigned createTexture(const IntSize&, GC3Denum format) = 0; + virtual void deleteTexture(unsigned texture, const IntSize&, GC3Denum) = 0; + virtual void deleteAllTextures() = 0; + +protected: + virtual ~TextureAllocator() { } +}; + +} + +#endif + + diff --git a/Source/WebCore/platform/graphics/chromium/TextureManager.cpp b/Source/WebCore/platform/graphics/chromium/TextureManager.cpp deleted file mode 100644 index 485c72228..000000000 --- a/Source/WebCore/platform/graphics/chromium/TextureManager.cpp +++ /dev/null @@ -1,325 +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 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" - -#if USE(ACCELERATED_COMPOSITING) - -#include "TextureManager.h" - -#include "ManagedTexture.h" -#include "TraceEvent.h" - -using namespace std; - -namespace WebCore { - - -namespace { -size_t memoryLimitBytes(size_t viewportMultiplier, const IntSize& viewportSize, size_t minMegabytes, size_t maxMegabytes) -{ - if (!viewportMultiplier) - return maxMegabytes * 1024 * 1024; - if (viewportSize.isEmpty()) - return minMegabytes * 1024 * 1024; - return max(minMegabytes * 1024 * 1024, min(maxMegabytes * 1024 * 1024, viewportMultiplier * TextureManager::memoryUseBytes(viewportSize, GraphicsContext3D::RGBA))); -} -} - -size_t TextureManager::highLimitBytes(const IntSize& viewportSize) -{ - size_t viewportMultiplier, minMegabytes, maxMegabytes; -#if OS(ANDROID) - viewportMultiplier = 16; - minMegabytes = 32; - maxMegabytes = 64; -#else - viewportMultiplier = 0; - minMegabytes = 0; - maxMegabytes = 128; -#endif - return memoryLimitBytes(viewportMultiplier, viewportSize, minMegabytes, maxMegabytes); -} - -size_t TextureManager::reclaimLimitBytes(const IntSize& viewportSize) -{ - size_t viewportMultiplier, minMegabytes, maxMegabytes; -#if OS(ANDROID) - viewportMultiplier = 8; - minMegabytes = 16; - maxMegabytes = 32; -#else - viewportMultiplier = 0; - minMegabytes = 0; - maxMegabytes = 64; -#endif - return memoryLimitBytes(viewportMultiplier, viewportSize, minMegabytes, maxMegabytes); -} - -size_t TextureManager::memoryUseBytes(const IntSize& size, GC3Denum textureFormat) -{ - // FIXME: This assumes all textures are 1 byte/component. - const GC3Denum type = GraphicsContext3D::UNSIGNED_BYTE; - unsigned int componentsPerPixel = 4; - unsigned int bytesPerComponent = 1; - if (!GraphicsContext3D::computeFormatAndTypeParameters(textureFormat, type, &componentsPerPixel, &bytesPerComponent)) - ASSERT_NOT_REACHED(); - - return size.width() * size.height() * componentsPerPixel * bytesPerComponent; -} - - -TextureManager::TextureManager(size_t maxMemoryLimitBytes, size_t preferredMemoryLimitBytes, int maxTextureSize) - : m_maxMemoryLimitBytes(maxMemoryLimitBytes) - , m_preferredMemoryLimitBytes(preferredMemoryLimitBytes) - , m_memoryUseBytes(0) - , m_maxTextureSize(maxTextureSize) - , m_nextToken(1) -{ -} - -TextureManager::~TextureManager() -{ - for (HashSet<ManagedTexture*>::iterator it = m_registeredTextures.begin(); it != m_registeredTextures.end(); ++it) - (*it)->clearManager(); -} - -void TextureManager::setMemoryAllocationLimitBytes(size_t memoryLimitBytes) -{ - setMaxMemoryLimitBytes(memoryLimitBytes); -#if defined(OS_ANDROID) - // On android, we are setting the preferred memory limit to half of our - // maximum allocation, because we would like to stay significantly below - // the absolute memory limit whenever we can. Specifically, by limitting - // prepainting only to the halfway memory mark. - setPreferredMemoryLimitBytes(memoryLimitBytes / 2); -#else - setPreferredMemoryLimitBytes(memoryLimitBytes); -#endif -} - -void TextureManager::setMaxMemoryLimitBytes(size_t memoryLimitBytes) -{ - reduceMemoryToLimit(memoryLimitBytes); - ASSERT(currentMemoryUseBytes() <= memoryLimitBytes); - m_maxMemoryLimitBytes = memoryLimitBytes; -} - -void TextureManager::setPreferredMemoryLimitBytes(size_t memoryLimitBytes) -{ - m_preferredMemoryLimitBytes = memoryLimitBytes; -} - -void TextureManager::registerTexture(ManagedTexture* texture) -{ - ASSERT(texture); - ASSERT(!m_registeredTextures.contains(texture)); - - m_registeredTextures.add(texture); -} - -void TextureManager::unregisterTexture(ManagedTexture* texture) -{ - ASSERT(texture); - ASSERT(m_registeredTextures.contains(texture)); - - m_registeredTextures.remove(texture); -} - -TextureToken TextureManager::getToken() -{ - return m_nextToken++; -} - -void TextureManager::releaseToken(TextureToken token) -{ - TextureMap::iterator it = m_textures.find(token); - if (it != m_textures.end()) - removeTexture(token, it->second); -} - -bool TextureManager::hasTexture(TextureToken token) -{ - return m_textures.contains(token); -} - -bool TextureManager::isProtected(TextureToken token) -{ - return token && hasTexture(token) && m_textures.get(token).isProtected; -} - -void TextureManager::protectTexture(TextureToken token) -{ - ASSERT(hasTexture(token)); - TextureInfo info = m_textures.take(token); - info.isProtected = true; - m_textures.add(token, info); - // If someone protects a texture, put it at the end of the LRU list. - m_textureLRUSet.remove(token); - m_textureLRUSet.add(token); -} - -void TextureManager::unprotectTexture(TextureToken token) -{ - TextureMap::iterator it = m_textures.find(token); - if (it != m_textures.end()) - it->second.isProtected = false; -} - -void TextureManager::unprotectAllTextures() -{ - for (TextureMap::iterator it = m_textures.begin(); it != m_textures.end(); ++it) - it->second.isProtected = false; -} - -void TextureManager::evictTexture(TextureToken token, TextureInfo info) -{ - TRACE_EVENT0("cc", "TextureManager::evictTexture"); - removeTexture(token, info); -} - -void TextureManager::reduceMemoryToLimit(size_t limit) -{ - while (m_memoryUseBytes > limit) { - ASSERT(!m_textureLRUSet.isEmpty()); - bool foundCandidate = false; - for (ListHashSet<TextureToken>::iterator lruIt = m_textureLRUSet.begin(); lruIt != m_textureLRUSet.end(); ++lruIt) { - TextureToken token = *lruIt; - TextureInfo info = m_textures.get(token); - if (info.isProtected) - continue; - evictTexture(token, info); - foundCandidate = true; - break; - } - if (!foundCandidate) - return; - } -} - -void TextureManager::addTexture(TextureToken token, TextureInfo info) -{ - ASSERT(!m_textureLRUSet.contains(token)); - ASSERT(!m_textures.contains(token)); - m_memoryUseBytes += memoryUseBytes(info.size, info.format); - m_textures.set(token, info); - m_textureLRUSet.add(token); -} - -void TextureManager::deleteEvictedTextures(TextureAllocator* allocator) -{ - if (allocator) { - for (size_t i = 0; i < m_evictedTextures.size(); ++i) { - if (m_evictedTextures[i].textureId) { -#ifndef NDEBUG - ASSERT(m_evictedTextures[i].allocator == allocator); -#endif - allocator->deleteTexture(m_evictedTextures[i].textureId, m_evictedTextures[i].size, m_evictedTextures[i].format); - } - } - } - m_evictedTextures.clear(); -} - -void TextureManager::evictAndRemoveAllDeletedTextures() -{ - unprotectAllTextures(); - reduceMemoryToLimit(0); - m_evictedTextures.clear(); -} - -void TextureManager::evictAndDeleteAllTextures(TextureAllocator* allocator) -{ - unprotectAllTextures(); - reduceMemoryToLimit(0); - deleteEvictedTextures(allocator); -} - -void TextureManager::removeTexture(TextureToken token, TextureInfo info) -{ - ASSERT(m_textureLRUSet.contains(token)); - ASSERT(m_textures.contains(token)); - m_memoryUseBytes -= memoryUseBytes(info.size, info.format); - m_textures.remove(token); - ASSERT(m_textureLRUSet.contains(token)); - m_textureLRUSet.remove(token); - EvictionEntry entry; - entry.textureId = info.textureId; - entry.size = info.size; - entry.format = info.format; -#ifndef NDEBUG - entry.allocator = info.allocator; -#endif - m_evictedTextures.append(entry); -} - -unsigned TextureManager::allocateTexture(TextureAllocator* allocator, TextureToken token) -{ - TextureMap::iterator it = m_textures.find(token); - ASSERT(it != m_textures.end()); - TextureInfo* info = &it.get()->second; - ASSERT(info->isProtected); - - unsigned textureId = allocator->createTexture(info->size, info->format); - info->textureId = textureId; -#ifndef NDEBUG - info->allocator = allocator; -#endif - return textureId; -} - -bool TextureManager::requestTexture(TextureToken token, IntSize size, unsigned format) -{ - if (size.width() > m_maxTextureSize || size.height() > m_maxTextureSize) - return false; - - TextureMap::iterator it = m_textures.find(token); - if (it != m_textures.end()) { - ASSERT(it->second.size != size || it->second.format != format); - removeTexture(token, it->second); - } - - size_t memoryRequiredBytes = memoryUseBytes(size, format); - if (memoryRequiredBytes > m_maxMemoryLimitBytes) - return false; - - reduceMemoryToLimit(m_maxMemoryLimitBytes - memoryRequiredBytes); - if (m_memoryUseBytes + memoryRequiredBytes > m_maxMemoryLimitBytes) - return false; - - TextureInfo info; - info.size = size; - info.format = format; - info.textureId = 0; - info.isProtected = true; -#ifndef NDEBUG - info.allocator = 0; -#endif - addTexture(token, info); - return true; -} - -} - -#endif // USE(ACCELERATED_COMPOSITING) diff --git a/Source/WebCore/platform/graphics/chromium/TextureManager.h b/Source/WebCore/platform/graphics/chromium/TextureManager.h deleted file mode 100644 index 47a189bcc..000000000 --- a/Source/WebCore/platform/graphics/chromium/TextureManager.h +++ /dev/null @@ -1,140 +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 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 TextureManager_h -#define TextureManager_h - -#include "GraphicsContext3D.h" -#include "IntRect.h" -#include "IntSize.h" -#include <wtf/FastAllocBase.h> -#include <wtf/HashMap.h> -#include <wtf/HashSet.h> -#include <wtf/ListHashSet.h> -#include <wtf/Vector.h> - -namespace WebCore { - -class ManagedTexture; -typedef int TextureToken; - -class TextureAllocator { -public: - virtual unsigned createTexture(const IntSize&, GC3Denum format) = 0; - virtual void deleteTexture(unsigned texture, const IntSize&, GC3Denum) = 0; - virtual void deleteAllTextures() = 0; - -protected: - virtual ~TextureAllocator() { } -}; - -class TextureManager { - WTF_MAKE_NONCOPYABLE(TextureManager); -public: - static PassOwnPtr<TextureManager> create(size_t maxMemoryLimitBytes, size_t preferredMemoryLimitBytes, int maxTextureSize) - { - return adoptPtr(new TextureManager(maxMemoryLimitBytes, preferredMemoryLimitBytes, maxTextureSize)); - } - ~TextureManager(); - - // Absolute maximum limit for texture allocations for this instance. - static size_t highLimitBytes(const IntSize& viewportSize); - // Preferred texture size limit given the viewport size. - static size_t reclaimLimitBytes(const IntSize& viewportSize); - - static size_t memoryUseBytes(const IntSize&, GC3Denum format); - - void setMemoryAllocationLimitBytes(size_t); - void setMaxMemoryLimitBytes(size_t); - size_t maxMemoryLimitBytes() { return m_maxMemoryLimitBytes; } - void setPreferredMemoryLimitBytes(size_t); - size_t preferredMemoryLimitBytes() { return m_preferredMemoryLimitBytes; } - - void registerTexture(ManagedTexture*); - void unregisterTexture(ManagedTexture*); - - TextureToken getToken(); - void releaseToken(TextureToken); - bool hasTexture(TextureToken); - - bool requestTexture(TextureToken, IntSize, GC3Denum textureFormat); - - void protectTexture(TextureToken); - void unprotectTexture(TextureToken); - void unprotectAllTextures(); - bool isProtected(TextureToken); - - unsigned allocateTexture(TextureAllocator*, TextureToken); - void deleteEvictedTextures(TextureAllocator*); - - void evictAndRemoveAllDeletedTextures(); - void evictAndDeleteAllTextures(TextureAllocator*); - - void reduceMemoryToLimit(size_t); - size_t currentMemoryUseBytes() const { return m_memoryUseBytes; } - -private: - TextureManager(size_t maxMemoryLimitBytes, size_t preferredMemoryLimitBytes, int maxTextureSize); - - struct TextureInfo { - IntSize size; - GC3Denum format; - unsigned textureId; - bool isProtected; -#ifndef NDEBUG - TextureAllocator* allocator; -#endif - }; - - void addTexture(TextureToken, TextureInfo); - void removeTexture(TextureToken, TextureInfo); - void evictTexture(TextureToken, TextureInfo); - - HashSet<ManagedTexture*> m_registeredTextures; - - typedef HashMap<TextureToken, TextureInfo> TextureMap; - TextureMap m_textures; - ListHashSet<TextureToken> m_textureLRUSet; - - size_t m_maxMemoryLimitBytes; - size_t m_preferredMemoryLimitBytes; - size_t m_memoryUseBytes; - int m_maxTextureSize; - TextureToken m_nextToken; - - struct EvictionEntry { - unsigned textureId; - IntSize size; - GC3Denum format; -#ifndef NDEBUG - TextureAllocator* allocator; -#endif - }; - - Vector<EvictionEntry> m_evictedTextures; -}; - -} - -#endif diff --git a/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.cpp b/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.cpp index 5c4bc05ce..d085c9dd1 100644 --- a/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.cpp +++ b/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.cpp @@ -30,7 +30,6 @@ #include "TiledLayerChromium.h" #include "GraphicsContext3D.h" -#include "ManagedTexture.h" #include "Region.h" #include "TextStream.h" @@ -156,7 +155,7 @@ void TiledLayerChromium::updateBounds() newRegion.subtract(oldRegion); Vector<IntRect> rects = newRegion.rects(); for (size_t i = 0; i < rects.size(); ++i) - invalidateRect(rects[i]); + invalidateContentRect(rects[i]); } void TiledLayerChromium::setTileSize(const IntSize& size) @@ -288,7 +287,7 @@ void TiledLayerChromium::setNeedsDisplayRect(const FloatRect& dirtyRect) FloatRect scaledDirtyRect(dirtyRect); scaledDirtyRect.scale(contentsWidthScale, contentsHeightScale); IntRect dirty = enclosingIntRect(scaledDirtyRect); - invalidateRect(dirty); + invalidateContentRect(dirty); LayerChromium::setNeedsDisplayRect(dirtyRect); } @@ -306,10 +305,10 @@ void TiledLayerChromium::setIsNonCompositedContent(bool isNonCompositedContent) setBorderTexelOption(borderTexelOption); } -void TiledLayerChromium::invalidateRect(const IntRect& layerRect) +void TiledLayerChromium::invalidateContentRect(const IntRect& contentRect) { updateBounds(); - if (m_tiler->isEmpty() || layerRect.isEmpty() || m_skipsDraw) + if (m_tiler->isEmpty() || contentRect.isEmpty() || m_skipsDraw) return; for (CCLayerTilingData::TileMap::const_iterator iter = m_tiler->tiles().begin(); iter != m_tiler->tiles().end(); ++iter) { @@ -319,7 +318,7 @@ void TiledLayerChromium::invalidateRect(const IntRect& layerRect) if (!tile) continue; IntRect bound = m_tiler->tileRect(tile); - bound.intersect(layerRect); + bound.intersect(contentRect); tile->dirtyRect.unite(bound); } } @@ -356,7 +355,7 @@ void TiledLayerChromium::updateTiles(bool idle, int left, int top, int right, in // Create tiles as needed, expanding a dirty rect to contain all // the dirty regions currently being drawn. All dirty tiles that are to be painted // get their updateRect set to dirtyRect and dirtyRect cleared. This way if - // invalidateRect is invoked during updateLayerRect we don't lose the request. + // invalidateContentRect is invoked during updateContentRect we don't lose the request. IntRect paintRect; for (int j = top; j <= bottom; ++j) { for (int i = left; i <= right; ++i) { @@ -377,7 +376,7 @@ void TiledLayerChromium::updateTiles(bool idle, int left, int top, int right, in // When not idle painting, if the visible region of the tile is occluded, don't reserve a texture or update the tile. // If any part of the tile is visible, then we need to update it so the tile is pushed to the impl thread. if (!idle && occlusion) { - IntRect visibleTileRect = intersection(m_tiler->tileBounds(i, j), visibleLayerRect()); + IntRect visibleTileRect = intersection(m_tiler->tileBounds(i, j), visibleContentRect()); if (occlusion->occluded(this, visibleTileRect)) { ASSERT(!tile->updated); continue; @@ -517,21 +516,21 @@ void TiledLayerChromium::updateTiles(bool idle, int left, int top, int right, in void TiledLayerChromium::setTexturePriorities(const CCPriorityCalculator& priorityCalc) { - setTexturePrioritiesInRect(priorityCalc, visibleLayerRect()); + setTexturePrioritiesInRect(priorityCalc, visibleContentRect()); } -void TiledLayerChromium::setTexturePrioritiesInRect(const CCPriorityCalculator& priorityCalc, const IntRect& visibleRect) +void TiledLayerChromium::setTexturePrioritiesInRect(const CCPriorityCalculator& priorityCalc, const IntRect& visibleContentRect) { updateBounds(); resetUpdateState(); - IntRect prepaintRect = idlePaintRect(visibleRect); + IntRect prepaintRect = idlePaintRect(visibleContentRect); bool drawsToRootSurface = !targetRenderSurface()->targetRenderSurface(); // Minimally create the tiles in the desired pre-paint rect. if (!prepaintRect.isEmpty()) { int left, top, right, bottom; - m_tiler->layerRectToTileIndices(prepaintRect, left, top, right, bottom); + m_tiler->contentRectToTileIndices(prepaintRect, left, top, right, bottom); for (int j = top; j <= bottom; ++j) for (int i = left; i <= right; ++i) if (!tileAt(i, j)) @@ -542,9 +541,9 @@ void TiledLayerChromium::setTexturePrioritiesInRect(const CCPriorityCalculator& // These textures must stay alive while the updated textures are incrementally // uploaded, swapped atomically via pushProperties, and finally deleted // after the commit is complete, after which they can be recycled. - if (!visibleRect.isEmpty()) { + if (!visibleContentRect.isEmpty()) { int left, top, right, bottom; - m_tiler->layerRectToTileIndices(visibleRect, left, top, right, bottom); + m_tiler->contentRectToTileIndices(visibleContentRect, left, top, right, bottom); for (int j = top; j <= bottom; ++j) { for (int i = left; i <= right; ++i) { UpdatableTile* tile = tileAt(i, j); @@ -581,10 +580,10 @@ void TiledLayerChromium::setTexturePrioritiesInRect(const CCPriorityCalculator& // can be removed soon with better priorities, but for now paint these layers after // 512 pixels of pre-painting. Later we can just pass an animating flag etc. to the // calculator and it can take care of this special case if we still need it. - if (visibleRect.isEmpty() && !prepaintRect.isEmpty()) + if (visibleContentRect.isEmpty() && !prepaintRect.isEmpty()) tile->managedTexture()->setRequestPriority(priorityCalc.priorityFromDistance(512, drawsToRootSurface)); - else if (!visibleRect.isEmpty()) - tile->managedTexture()->setRequestPriority(priorityCalc.priorityFromDistance(visibleRect, tileRect, drawsToRootSurface)); + else if (!visibleContentRect.isEmpty()) + tile->managedTexture()->setRequestPriority(priorityCalc.priorityFromDistance(visibleContentRect, tileRect, drawsToRootSurface)); } } @@ -593,8 +592,8 @@ Region TiledLayerChromium::visibleContentOpaqueRegion() const if (m_skipsDraw) return Region(); if (opaque()) - return visibleLayerRect(); - return m_tiler->opaqueRegionInLayerRect(visibleLayerRect()); + return visibleContentRect(); + return m_tiler->opaqueRegionInContentRect(visibleContentRect()); } void TiledLayerChromium::resetUpdateState() @@ -611,7 +610,7 @@ void TiledLayerChromium::resetUpdateState() } } -void TiledLayerChromium::updateLayerRect(CCTextureUpdater& updater, const IntRect& contentRect, const CCOcclusionTracker* occlusion) +void TiledLayerChromium::updateContentRect(CCTextureUpdater& updater, const IntRect& contentRect, const CCOcclusionTracker* occlusion) { m_skipsDraw = false; m_skipsIdlePaint = false; @@ -625,7 +624,7 @@ void TiledLayerChromium::updateLayerRect(CCTextureUpdater& updater, const IntRec // Visible painting. Only paint visible tiles if the visible rect isn't empty. if (!contentRect.isEmpty()) { int left, top, right, bottom; - m_tiler->layerRectToTileIndices(contentRect, left, top, right, bottom); + m_tiler->contentRectToTileIndices(contentRect, left, top, right, bottom); updateTiles(false, left, top, right, bottom, updater, occlusion); } @@ -639,7 +638,7 @@ void TiledLayerChromium::updateLayerRect(CCTextureUpdater& updater, const IntRec return; int prepaintLeft, prepaintTop, prepaintRight, prepaintBottom; - m_tiler->layerRectToTileIndices(idlePaintContentRect, prepaintLeft, prepaintTop, prepaintRight, prepaintBottom); + m_tiler->contentRectToTileIndices(idlePaintContentRect, prepaintLeft, prepaintTop, prepaintRight, prepaintBottom); // If the layer is not visible, we have nothing to expand from, so instead we prepaint the outer-most set of tiles. if (contentRect.isEmpty()) { @@ -657,7 +656,7 @@ void TiledLayerChromium::updateLayerRect(CCTextureUpdater& updater, const IntRec } int left, top, right, bottom; - m_tiler->layerRectToTileIndices(contentRect, left, top, right, bottom); + m_tiler->contentRectToTileIndices(contentRect, left, top, right, bottom); // Otherwise, prepaint anything that was occluded but inside the layer's visible region. updateTiles(true, left, top, right, bottom, updater, 0); @@ -693,7 +692,7 @@ void TiledLayerChromium::updateLayerRect(CCTextureUpdater& updater, const IntRec } } -bool TiledLayerChromium::needsIdlePaint(const IntRect& contentRect) +bool TiledLayerChromium::needsIdlePaint(const IntRect& visibleContentRect) { if (m_skipsIdlePaint) return false; @@ -701,17 +700,17 @@ bool TiledLayerChromium::needsIdlePaint(const IntRect& contentRect) if (m_tiler->hasEmptyBounds()) return false; - IntRect idlePaintContentRect = idlePaintRect(contentRect); + IntRect idlePaintContentRect = idlePaintRect(visibleContentRect); if (idlePaintContentRect.isEmpty()) return false; int left, top, right, bottom; - m_tiler->layerRectToTileIndices(idlePaintContentRect, left, top, right, bottom); + m_tiler->contentRectToTileIndices(idlePaintContentRect, left, top, right, bottom); for (int j = top; j <= bottom; ++j) { for (int i = left; i <= right; ++i) { - // If the layerRect is empty, then we are painting the outer-most set of tiles only. - if (contentRect.isEmpty() && i != left && i != right && j != top && j != bottom) + // If the visibleContentRect is empty, then we are painting the outer-most set of tiles only. + if (visibleContentRect.isEmpty() && i != left && i != right && j != top && j != bottom) continue; UpdatableTile* tile = tileAt(i, j); ASSERT(tile); // Did setTexturePriorities get skipped? @@ -728,14 +727,14 @@ bool TiledLayerChromium::needsIdlePaint(const IntRect& contentRect) return false; } -IntRect TiledLayerChromium::idlePaintRect(const IntRect& visibleRect) +IntRect TiledLayerChromium::idlePaintRect(const IntRect& visibleContentRect) { IntRect contentRect(IntPoint::zero(), contentBounds()); // For layers that are animating transforms but not visible at all, we don't know what part // of them is going to become visible. For small layers we return the entire layer, for larger // ones we avoid prepainting the layer at all. - if (visibleRect.isEmpty()) { + if (visibleContentRect.isEmpty()) { bool isSmallLayer = m_tiler->numTilesX() <= 9 && m_tiler->numTilesY() <= 9 && m_tiler->numTilesX() * m_tiler->numTilesY() <= 9; if ((drawTransformIsAnimating() || screenSpaceTransformIsAnimating()) && isSmallLayer) return contentRect; @@ -744,7 +743,7 @@ IntRect TiledLayerChromium::idlePaintRect(const IntRect& visibleRect) // FIXME: This can be made a lot larger now! We should increase // this slowly while insuring it doesn't cause any perf issues. - IntRect prepaintRect = visibleRect; + IntRect prepaintRect = visibleContentRect; prepaintRect.inflateX(m_tiler->tileSize().width()); prepaintRect.inflateY(m_tiler->tileSize().height() * 2); prepaintRect.intersect(contentRect); diff --git a/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.h b/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.h index d2ed45c04..c80c422f9 100644 --- a/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.h +++ b/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.h @@ -77,18 +77,18 @@ protected: virtual void createTextureUpdaterIfNeeded() = 0; // Set invalidations to be potentially repainted during update(). - void invalidateRect(const IntRect& layerRect); + void invalidateContentRect(const IntRect& contentRect); // Reset state on tiles that will be used for updating the layer. void resetUpdateState(); - // Prepare data needed to update textures that intersect with layerRect. - void updateLayerRect(CCTextureUpdater&, const IntRect& layerRect, const CCOcclusionTracker*); + // Prepare data needed to update textures that intersect with contentRect. + void updateContentRect(CCTextureUpdater&, const IntRect& contentRect, const CCOcclusionTracker*); // After preparing an update, returns true if more painting is needed. - bool needsIdlePaint(const IntRect& layerRect); + bool needsIdlePaint(const IntRect& visibleContentRect); - IntRect idlePaintRect(const IntRect& visibleLayerRect); + IntRect idlePaintRect(const IntRect& visibleContentRect); bool skipsDraw() const { return m_skipsDraw; } @@ -104,7 +104,7 @@ private: bool tileOnlyNeedsPartialUpdate(UpdatableTile*); bool tileNeedsBufferedUpdate(UpdatableTile*); - void setTexturePrioritiesInRect(const CCPriorityCalculator&, const IntRect& visibleLayerRect); + void setTexturePrioritiesInRect(const CCPriorityCalculator&, const IntRect& visibleContentRect); void updateTiles(bool idle, int left, int top, int right, int bottom, CCTextureUpdater&, const CCOcclusionTracker*); diff --git a/Source/WebCore/platform/graphics/chromium/TrackingTextureAllocator.cpp b/Source/WebCore/platform/graphics/chromium/TrackingTextureAllocator.cpp index c589a3c6e..7ae29f912 100644 --- a/Source/WebCore/platform/graphics/chromium/TrackingTextureAllocator.cpp +++ b/Source/WebCore/platform/graphics/chromium/TrackingTextureAllocator.cpp @@ -75,7 +75,7 @@ unsigned TrackingTextureAllocator::createTexture(const IntSize& size, GC3Denum f if (size.width() > m_maxTextureSize || size.height() > m_maxTextureSize) return 0; - m_currentMemoryUseBytes += TextureManager::memoryUseBytes(size, format); + m_currentMemoryUseBytes += CCTexture::memorySizeBytes(size, format); unsigned textureId = 0; GLC(m_context, textureId = m_context->createTexture()); @@ -100,7 +100,7 @@ unsigned TrackingTextureAllocator::createTexture(const IntSize& size, GC3Denum f void TrackingTextureAllocator::deleteTexture(unsigned textureId, const IntSize& size, GC3Denum format) { - m_currentMemoryUseBytes -= TextureManager::memoryUseBytes(size, format); + m_currentMemoryUseBytes -= CCTexture::memorySizeBytes(size, format); GLC(m_context, m_context->deleteTexture(textureId)); GLC(m_context, m_context->deleteTexture(textureId)); ASSERT(m_allocatedTextureIds.contains(textureId)); diff --git a/Source/WebCore/platform/graphics/chromium/TrackingTextureAllocator.h b/Source/WebCore/platform/graphics/chromium/TrackingTextureAllocator.h index 78ef40d1b..38f7ca043 100644 --- a/Source/WebCore/platform/graphics/chromium/TrackingTextureAllocator.h +++ b/Source/WebCore/platform/graphics/chromium/TrackingTextureAllocator.h @@ -25,7 +25,7 @@ #ifndef TrackingTextureAllocator_h #define TrackingTextureAllocator_h -#include "TextureManager.h" +#include "TextureAllocator.h" #include <wtf/HashSet.h> #include <wtf/PassRefPtr.h> diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCCheckerboardDrawQuad.h b/Source/WebCore/platform/graphics/chromium/cc/CCCheckerboardDrawQuad.h index 27f8c56bd..35104dcf5 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCCheckerboardDrawQuad.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCCheckerboardDrawQuad.h @@ -26,20 +26,10 @@ #ifndef CCCheckerboardDrawQuad_h #define CCCheckerboardDrawQuad_h -#include "cc/CCDrawQuad.h" -#include <wtf/PassOwnPtr.h> +#include <public/WebCompositorCheckerboardQuad.h> namespace WebCore { - -class CCCheckerboardDrawQuad : public CCDrawQuad { - WTF_MAKE_NONCOPYABLE(CCCheckerboardDrawQuad); -public: - static PassOwnPtr<CCCheckerboardDrawQuad> create(const CCSharedQuadState*, const IntRect&); - -private: - CCCheckerboardDrawQuad(const CCSharedQuadState*, const IntRect&); -}; - +typedef WebKit::WebCompositorCheckerboardQuad CCCheckerboardDrawQuad; } #endif diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCDebugBorderDrawQuad.h b/Source/WebCore/platform/graphics/chromium/cc/CCDebugBorderDrawQuad.h index ea1cf8476..a72c27417 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCDebugBorderDrawQuad.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCDebugBorderDrawQuad.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011 Google Inc. All rights reserved. + * Copyright (C) 2012 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -26,27 +26,10 @@ #ifndef CCDebugBorderDrawQuad_h #define CCDebugBorderDrawQuad_h -#include "SkColor.h" -#include "cc/CCDrawQuad.h" -#include <wtf/PassOwnPtr.h> +#include <public/WebCompositorDebugBorderQuad.h> namespace WebCore { - -class CCDebugBorderDrawQuad : public CCDrawQuad { - WTF_MAKE_NONCOPYABLE(CCDebugBorderDrawQuad); -public: - static PassOwnPtr<CCDebugBorderDrawQuad> create(const CCSharedQuadState*, const IntRect&, SkColor, int width); - - SkColor color() const { return m_color; }; - int width() const { return m_width; } - -private: - CCDebugBorderDrawQuad(const CCSharedQuadState*, const IntRect&, SkColor, int width); - - SkColor m_color; - int m_width; -}; - +typedef WebKit::WebCompositorDebugBorderQuad CCDebugBorderDrawQuad; } #endif diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCDrawQuad.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCDrawQuad.cpp deleted file mode 100644 index 601f5621d..000000000 --- a/Source/WebCore/platform/graphics/chromium/cc/CCDrawQuad.cpp +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Copyright (C) 2011 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" - -#include "cc/CCDrawQuad.h" - -#include "cc/CCCheckerboardDrawQuad.h" -#include "cc/CCDebugBorderDrawQuad.h" -#include "cc/CCIOSurfaceDrawQuad.h" -#include "cc/CCRenderPassDrawQuad.h" -#include "cc/CCSolidColorDrawQuad.h" -#include "cc/CCStreamVideoDrawQuad.h" -#include "cc/CCTextureDrawQuad.h" -#include "cc/CCTileDrawQuad.h" -#include "cc/CCYUVVideoDrawQuad.h" - -namespace WebCore { - -CCDrawQuad::CCDrawQuad(const CCSharedQuadState* sharedQuadState, Material material, const IntRect& quadRect) - : m_sharedQuadState(sharedQuadState) - , m_material(material) - , m_quadRect(quadRect) - , m_quadVisibleRect(quadRect) - , m_quadOpaque(true) - , m_needsBlending(false) -{ - ASSERT(m_sharedQuadState); - ASSERT(m_material != Invalid); -} - -IntRect CCDrawQuad::opaqueRect() const -{ - if (opacity() != 1) - return IntRect(); - if (m_sharedQuadState->isOpaque() && m_quadOpaque) - return m_quadRect; - return m_opaqueRect; -} - -void CCDrawQuad::setQuadVisibleRect(const IntRect& quadVisibleRect) -{ - m_quadVisibleRect = quadVisibleRect; - m_quadVisibleRect.intersect(m_quadRect); -} - -const CCCheckerboardDrawQuad* CCDrawQuad::toCheckerboardDrawQuad() const -{ - ASSERT(m_material == Checkerboard); - return static_cast<const CCCheckerboardDrawQuad*>(this); -} - -const CCDebugBorderDrawQuad* CCDrawQuad::toDebugBorderDrawQuad() const -{ - ASSERT(m_material == DebugBorder); - return static_cast<const CCDebugBorderDrawQuad*>(this); -} - -const CCIOSurfaceDrawQuad* CCDrawQuad::toIOSurfaceDrawQuad() const -{ - ASSERT(m_material == IOSurfaceContent); - return static_cast<const CCIOSurfaceDrawQuad*>(this); -} - -const CCRenderPassDrawQuad* CCDrawQuad::toRenderPassDrawQuad() const -{ - ASSERT(m_material == RenderPass); - return static_cast<const CCRenderPassDrawQuad*>(this); -} - -const CCSolidColorDrawQuad* CCDrawQuad::toSolidColorDrawQuad() const -{ - ASSERT(m_material == SolidColor); - return static_cast<const CCSolidColorDrawQuad*>(this); -} - -const CCStreamVideoDrawQuad* CCDrawQuad::toStreamVideoDrawQuad() const -{ - ASSERT(m_material == StreamVideoContent); - return static_cast<const CCStreamVideoDrawQuad*>(this); -} - -const CCTextureDrawQuad* CCDrawQuad::toTextureDrawQuad() const -{ - ASSERT(m_material == TextureContent); - return static_cast<const CCTextureDrawQuad*>(this); -} -const CCTileDrawQuad* CCDrawQuad::toTileDrawQuad() const -{ - ASSERT(m_material == TiledContent); - return static_cast<const CCTileDrawQuad*>(this); -} - -const CCYUVVideoDrawQuad* CCDrawQuad::toYUVVideoDrawQuad() const -{ - ASSERT(m_material == YUVVideoContent); - return static_cast<const CCYUVVideoDrawQuad*>(this); -} - - -} diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCDrawQuad.h b/Source/WebCore/platform/graphics/chromium/cc/CCDrawQuad.h index 756b68036..5f536a85a 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCDrawQuad.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCDrawQuad.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011 Google Inc. All rights reserved. + * Copyright (C) 2012 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -26,91 +26,10 @@ #ifndef CCDrawQuad_h #define CCDrawQuad_h -#include "cc/CCSharedQuadState.h" +#include <public/WebCompositorQuad.h> namespace WebCore { - -class CCCheckerboardDrawQuad; -class CCDebugBorderDrawQuad; -class CCIOSurfaceDrawQuad; -class CCRenderPassDrawQuad; -class CCSolidColorDrawQuad; -class CCStreamVideoDrawQuad; -class CCTextureDrawQuad; -class CCTileDrawQuad; -class CCYUVVideoDrawQuad; - -// CCDrawQuad is a bag of data used for drawing a quad. Because different -// materials need different bits of per-quad data to render, classes that derive -// from CCDrawQuad store additional data in their derived instance. The Material -// enum is used to "safely" upcast to the derived class. -class CCDrawQuad { - WTF_MAKE_NONCOPYABLE(CCDrawQuad); -public: - const IntRect& quadRect() const { return m_quadRect; } - const WebKit::WebTransformationMatrix& quadTransform() const { return m_sharedQuadState->quadTransform(); } - const WebKit::WebTransformationMatrix& layerTransform() const { return m_sharedQuadState->layerTransform(); } - const IntRect& layerRect() const { return m_sharedQuadState->layerRect(); } - const IntRect& scissorRect() const { return m_sharedQuadState->scissorRect(); } - float opacity() const { return m_sharedQuadState->opacity(); } - // For the purposes of blending, what part of the contents of this quad are opaque? - IntRect opaqueRect() const; - bool needsBlending() const { return m_needsBlending || !opaqueRect().contains(m_quadVisibleRect); } - bool isLayerAxisAlignedIntRect() const { return m_sharedQuadState->isLayerAxisAlignedIntRect(); } - - // Allows changing the rect that gets drawn to make it smaller. Parameter passed - // in will be clipped to quadRect(). - void setQuadVisibleRect(const IntRect&); - const IntRect& quadVisibleRect() const { return m_quadVisibleRect; } - - enum Material { - Invalid, - Checkerboard, - DebugBorder, - IOSurfaceContent, - RenderPass, - TextureContent, - SolidColor, - TiledContent, - YUVVideoContent, - StreamVideoContent, - }; - - Material material() const { return m_material; } - bool isDebugQuad() const { return m_material == DebugBorder; } - - const CCCheckerboardDrawQuad* toCheckerboardDrawQuad() const; - const CCDebugBorderDrawQuad* toDebugBorderDrawQuad() const; - const CCIOSurfaceDrawQuad* toIOSurfaceDrawQuad() const; - const CCRenderPassDrawQuad* toRenderPassDrawQuad() const; - const CCSolidColorDrawQuad* toSolidColorDrawQuad() const; - const CCStreamVideoDrawQuad* toStreamVideoDrawQuad() const; - const CCTextureDrawQuad* toTextureDrawQuad() const; - const CCTileDrawQuad* toTileDrawQuad() const; - const CCYUVVideoDrawQuad* toYUVVideoDrawQuad() const; - - const CCSharedQuadState* sharedQuadState() const { return m_sharedQuadState; } - -protected: - CCDrawQuad(const CCSharedQuadState*, Material, const IntRect&); - - const CCSharedQuadState* m_sharedQuadState; - - Material m_material; - IntRect m_quadRect; - IntRect m_quadVisibleRect; - - // By default, the shared quad state determines whether or not this quad is - // opaque or needs blending. Derived classes can override with these - // variables. - bool m_quadOpaque; - bool m_needsBlending; - - // Be default, this rect is empty. It is used when the shared quad state and above - // variables determine that the quad is not fully opaque but may be partially opaque. - IntRect m_opaqueRect; -}; - +typedef WebKit::WebCompositorQuad CCDrawQuad; } #endif diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCGraphicsContext.h b/Source/WebCore/platform/graphics/chromium/cc/CCGraphicsContext.h index 405885ffb..be8c8a557 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCGraphicsContext.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCGraphicsContext.h @@ -48,6 +48,12 @@ public: WebKit::WebGraphicsContext3D* context3D() { return m_context3D.get(); } + void flush() + { + if (m_context3D) + m_context3D->flush(); + } + private: CCGraphicsContext() { } explicit CCGraphicsContext(PassOwnPtr<WebKit::WebGraphicsContext3D> context3D) diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCHeadsUpDisplay.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCHeadsUpDisplay.cpp index 731f770c0..be19983ef 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCHeadsUpDisplay.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCHeadsUpDisplay.cpp @@ -31,7 +31,6 @@ #include "GraphicsContext3D.h" #include "LayerRendererChromium.h" #include "PlatformCanvas.h" -#include "TextureManager.h" #include "cc/CCDebugRectHistory.h" #include "cc/CCFrameRateCounter.h" #include "cc/CCLayerTreeHostImpl.h" diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCIOSurfaceDrawQuad.h b/Source/WebCore/platform/graphics/chromium/cc/CCIOSurfaceDrawQuad.h index 27f863ee6..77d326cbd 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCIOSurfaceDrawQuad.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCIOSurfaceDrawQuad.h @@ -26,26 +26,10 @@ #ifndef CCIOSurfaceDrawQuad_h #define CCIOSurfaceDrawQuad_h -#include "cc/CCDrawQuad.h" -#include <wtf/PassOwnPtr.h> +#include <public/WebCompositorIOSurfaceQuad.h> namespace WebCore { - -class CCIOSurfaceDrawQuad : public CCDrawQuad { - WTF_MAKE_NONCOPYABLE(CCIOSurfaceDrawQuad); -public: - static PassOwnPtr<CCIOSurfaceDrawQuad> create(const CCSharedQuadState*, const IntRect&, const IntSize& ioSurfaceSize, unsigned ioSurfaceTextureId); - - const IntSize& ioSurfaceSize() const { return m_ioSurfaceSize; } - unsigned ioSurfaceTextureId() const { return m_ioSurfaceTextureId; } - -private: - CCIOSurfaceDrawQuad(const CCSharedQuadState*, const IntRect&, const IntSize& ioSurfaceSize, unsigned ioSurfaceTextureId); - - IntSize m_ioSurfaceSize; - unsigned m_ioSurfaceTextureId; -}; - +typedef WebKit::WebCompositorIOSurfaceQuad CCIOSurfaceDrawQuad; } #endif diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.cpp index 44772156d..9a88376c2 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.cpp @@ -147,7 +147,7 @@ bool CCLayerImpl::descendantDrawsContent() PassOwnPtr<CCSharedQuadState> CCLayerImpl::createSharedQuadState() const { - return CCSharedQuadState::create(quadTransform(), drawTransform(), visibleLayerRect(), m_scissorRect, drawOpacity(), opaque()); + return CCSharedQuadState::create(quadTransform(), m_visibleContentRect, m_scissorRect, m_drawOpacity, m_opaque); } void CCLayerImpl::willDraw(CCRenderer*, CCGraphicsContext*) @@ -172,8 +172,8 @@ void CCLayerImpl::appendDebugBorderQuad(CCQuadCuller& quadList, const CCSharedQu if (!hasDebugBorders()) return; - IntRect layerRect(IntPoint(), contentBounds()); - quadList.append(CCDebugBorderDrawQuad::create(sharedQuadState, layerRect, debugBorderColor(), debugBorderWidth())); + IntRect contentRect(IntPoint(), contentBounds()); + quadList.append(CCDebugBorderDrawQuad::create(sharedQuadState, contentRect, debugBorderColor(), debugBorderWidth())); } unsigned CCLayerImpl::contentsTextureId() const @@ -613,7 +613,7 @@ void CCLayerImpl::setDoubleSided(bool doubleSided) Region CCLayerImpl::visibleContentOpaqueRegion() const { if (opaque()) - return visibleLayerRect(); + return visibleContentRect(); return Region(); } diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.h b/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.h index 00a351b22..2b9a49bd3 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.h @@ -34,6 +34,7 @@ #include "cc/CCInputHandler.h" #include "cc/CCLayerAnimationController.h" #include "cc/CCRenderSurface.h" +#include "cc/CCSharedQuadState.h" #include <public/WebFilterOperations.h> #include <public/WebTransformationMatrix.h> #include <wtf/OwnPtr.h> @@ -48,7 +49,6 @@ class CCLayerSorter; class CCLayerTreeHostImpl; class CCQuadCuller; class CCRenderer; -class CCSharedQuadState; class LayerChromium; class CCLayerImpl : public CCLayerAnimationControllerClient { @@ -227,8 +227,8 @@ public: CCInputHandlerClient::ScrollStatus tryScroll(const IntPoint& viewportPoint, CCInputHandlerClient::ScrollInputType) const; - const IntRect& visibleLayerRect() const { return m_visibleLayerRect; } - void setVisibleLayerRect(const IntRect& visibleLayerRect) { m_visibleLayerRect = visibleLayerRect; } + const IntRect& visibleContentRect() const { return m_visibleContentRect; } + void setVisibleContentRect(const IntRect& visibleContentRect) { m_visibleContentRect = visibleContentRect; } bool doubleSided() const { return m_doubleSided; } void setDoubleSided(bool); @@ -332,7 +332,7 @@ private: bool m_layerSurfacePropertyChanged; // Uses layer's content space. - IntRect m_visibleLayerRect; + IntRect m_visibleContentRect; bool m_masksToBounds; bool m_opaque; float m_opacity; diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTilingData.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTilingData.cpp index 823a316a3..49d23366c 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTilingData.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTilingData.cpp @@ -99,12 +99,12 @@ void CCLayerTilingData::reset() m_tiles.clear(); } -void CCLayerTilingData::layerRectToTileIndices(const IntRect& layerRect, int& left, int& top, int& right, int& bottom) const +void CCLayerTilingData::contentRectToTileIndices(const IntRect& contentRect, int& left, int& top, int& right, int& bottom) const { - left = m_tilingData.tileXIndexFromSrcCoord(layerRect.x()); - top = m_tilingData.tileYIndexFromSrcCoord(layerRect.y()); - right = m_tilingData.tileXIndexFromSrcCoord(layerRect.maxX() - 1); - bottom = m_tilingData.tileYIndexFromSrcCoord(layerRect.maxY() - 1); + left = m_tilingData.tileXIndexFromSrcCoord(contentRect.x()); + top = m_tilingData.tileYIndexFromSrcCoord(contentRect.y()); + right = m_tilingData.tileXIndexFromSrcCoord(contentRect.maxX() - 1); + bottom = m_tilingData.tileYIndexFromSrcCoord(contentRect.maxY() - 1); } IntRect CCLayerTilingData::tileRect(const Tile* tile) const @@ -114,21 +114,21 @@ IntRect CCLayerTilingData::tileRect(const Tile* tile) const return tileRect; } -Region CCLayerTilingData::opaqueRegionInLayerRect(const IntRect& layerRect) const +Region CCLayerTilingData::opaqueRegionInContentRect(const IntRect& contentRect) const { - if (layerRect.isEmpty()) + if (contentRect.isEmpty()) return Region(); Region opaqueRegion; int left, top, right, bottom; - layerRectToTileIndices(layerRect, left, top, right, bottom); + contentRectToTileIndices(contentRect, left, top, right, bottom); for (int j = top; j <= bottom; ++j) { for (int i = left; i <= right; ++i) { Tile* tile = tileAt(i, j); if (!tile) continue; - IntRect tileOpaqueRect = intersection(layerRect, tile->opaqueRect()); + IntRect tileOpaqueRect = intersection(contentRect, tile->opaqueRect()); opaqueRegion.unite(tileOpaqueRect); } } @@ -141,7 +141,7 @@ void CCLayerTilingData::setBounds(const IntSize& size) // Any tiles completely outside our new bounds are invalid and should be dropped. int left, top, right, bottom; - layerRectToTileIndices(IntRect(IntPoint(), size), left, top, right, bottom); + contentRectToTileIndices(IntRect(IntPoint(), size), left, top, right, bottom); Vector<TileMapKey> invalidTileKeys; for (TileMap::const_iterator it = m_tiles.begin(); it != m_tiles.end(); ++it) { if (it->first.first > right || it->first.second > bottom) diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTilingData.h b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTilingData.h index 081fe844e..25ff179ca 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTilingData.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTilingData.h @@ -98,10 +98,10 @@ public: void setBounds(const IntSize&); IntSize bounds() const; - void layerRectToTileIndices(const IntRect&, int &left, int &top, int &right, int &bottom) const; + void contentRectToTileIndices(const IntRect&, int &left, int &top, int &right, int &bottom) const; IntRect tileRect(const Tile*) const; - Region opaqueRegionInLayerRect(const IntRect&) const; + Region opaqueRegionInContentRect(const IntRect&) const; void reset(); diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp index 414b20526..da2cb32a0 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp @@ -27,7 +27,6 @@ #include "cc/CCLayerTreeHost.h" #include "LayerChromium.h" -#include "ManagedTexture.h" #include "Region.h" #include "TraceEvent.h" #include "TreeSynchronizer.h" @@ -153,6 +152,7 @@ void CCLayerTreeHost::initializeLayerRenderer() m_settings.maxPartialTextureUpdates = min(m_settings.maxPartialTextureUpdates, m_proxy->maxPartialTextureUpdates()); m_contentsTextureManager = CCPrioritizedTextureManager::create(0, m_proxy->layerRendererCapabilities().maxTextureSize); + m_surfaceMemoryPlaceholder = m_contentsTextureManager->createTexture(IntSize(), GraphicsContext3D::RGBA); m_layerRendererInitialized = true; @@ -490,8 +490,6 @@ void CCLayerTreeHost::updateLayers(LayerChromium* rootLayer, CCTextureUpdater& u // Reset partial texture update requests. m_partialTextureUpdateRequests = 0; - prioritizeTextures(updateList); - bool needMoreUpdates = paintLayerContents(updateList, updater); if (m_triggerIdleUpdates && needMoreUpdates) setNeedsCommit(); @@ -500,13 +498,20 @@ void CCLayerTreeHost::updateLayers(LayerChromium* rootLayer, CCTextureUpdater& u updateList[i]->clearRenderSurface(); } -void CCLayerTreeHost::prioritizeTextures(const LayerList& updateList) +void CCLayerTreeHost::setPrioritiesForSurfaces(size_t surfaceMemoryBytes) +{ + // Surfaces have a place holder for their memory since they are managed + // independantly but should still be tracked and reduce other memory usage. + m_surfaceMemoryPlaceholder->setTextureManager(m_contentsTextureManager.get()); + m_surfaceMemoryPlaceholder->setRequestPriority(CCPriorityCalculator::renderSurfacePriority()); + m_surfaceMemoryPlaceholder->setToSelfManagedMemoryPlaceholder(surfaceMemoryBytes); +} + +void CCLayerTreeHost::setPrioritiesForLayers(const LayerList& updateList) { // Use BackToFront since it's cheap and this isn't order-dependent. typedef CCLayerIterator<LayerChromium, Vector<RefPtr<LayerChromium> >, RenderSurfaceChromium, CCLayerIteratorActions::BackToFront> CCLayerIteratorType; - m_contentsTextureManager->clearPriorities(); - CCPriorityCalculator calculator; CCLayerIteratorType end = CCLayerIteratorType::end(&updateList); for (CCLayerIteratorType it = CCLayerIteratorType::begin(&updateList); it != end; ++it) { @@ -519,7 +524,25 @@ void CCLayerTreeHost::prioritizeTextures(const LayerList& updateList) it->replicaLayer()->maskLayer()->setTexturePriorities(calculator); } } +} + +void CCLayerTreeHost::prioritizeTextures(const LayerList& renderSurfaceLayerList, CCOverdrawMetrics& metrics) +{ + m_contentsTextureManager->clearPriorities(); + + size_t memoryForRenderSurfacesMetric = calculateMemoryForRenderSurfaces(renderSurfaceLayerList); + + setPrioritiesForLayers(renderSurfaceLayerList); + setPrioritiesForSurfaces(memoryForRenderSurfacesMetric); + metrics.didUseContentsTextureMemoryBytes(m_contentsTextureManager->memoryAboveCutoffBytes()); + metrics.didUseRenderSurfaceTextureMemoryBytes(memoryForRenderSurfacesMetric); + + m_contentsTextureManager->prioritizeTextures(); +} + +size_t CCLayerTreeHost::calculateMemoryForRenderSurfaces(const LayerList& updateList) +{ size_t readbackBytes = 0; size_t maxBackgroundTextureBytes = 0; size_t contentsTextureBytes = 0; @@ -529,7 +552,7 @@ void CCLayerTreeHost::prioritizeTextures(const LayerList& updateList) LayerChromium* renderSurfaceLayer = updateList[i].get(); RenderSurfaceChromium* renderSurface = renderSurfaceLayer->renderSurface(); - size_t bytes = TextureManager::memoryUseBytes(renderSurface->contentRect().size(), GraphicsContext3D::RGBA); + size_t bytes = CCTexture::memorySizeBytes(renderSurface->contentRect().size(), GraphicsContext3D::RGBA); contentsTextureBytes += bytes; if (renderSurface->backgroundFilters().isEmpty()) @@ -538,11 +561,9 @@ void CCLayerTreeHost::prioritizeTextures(const LayerList& updateList) if (bytes > maxBackgroundTextureBytes) maxBackgroundTextureBytes = bytes; if (!readbackBytes) - readbackBytes = TextureManager::memoryUseBytes(m_deviceViewportSize, GraphicsContext3D::RGBA); + readbackBytes = CCTexture::memorySizeBytes(m_deviceViewportSize, GraphicsContext3D::RGBA); } - size_t renderSurfacesBytes = readbackBytes + maxBackgroundTextureBytes + contentsTextureBytes; - - m_contentsTextureManager->prioritizeTextures(renderSurfacesBytes); + return readbackBytes + maxBackgroundTextureBytes + contentsTextureBytes; } bool CCLayerTreeHost::paintMasksForRenderSurface(LayerChromium* renderSurfaceLayer, CCTextureUpdater& updater) @@ -574,7 +595,9 @@ bool CCLayerTreeHost::paintLayerContents(const LayerList& renderSurfaceLayerList bool needMoreUpdates = false; bool recordMetricsForFrame = true; // FIXME: In the future, disable this when about:tracing is off. CCOcclusionTracker occlusionTracker(IntRect(IntPoint(), deviceViewportSize()), recordMetricsForFrame); - occlusionTracker.setMinimumTrackingSize(CCOcclusionTracker::preferredMinimumTrackingSize()); + occlusionTracker.setMinimumTrackingSize(m_settings.minimumOcclusionTrackingSize); + + prioritizeTextures(renderSurfaceLayerList, occlusionTracker.overdrawMetrics()); CCLayerIteratorType end = CCLayerIteratorType::end(&renderSurfaceLayerList); for (CCLayerIteratorType it = CCLayerIteratorType::begin(&renderSurfaceLayerList); it != end; ++it) { @@ -592,8 +615,6 @@ bool CCLayerTreeHost::paintLayerContents(const LayerList& renderSurfaceLayerList occlusionTracker.leaveLayer(it); } - occlusionTracker.overdrawMetrics().didUseContentsTextureMemoryBytes(m_contentsTextureManager->memoryAboveCutoffBytes()); - occlusionTracker.overdrawMetrics().didUseRenderSurfaceTextureMemoryBytes(m_contentsTextureManager->memoryForRenderSurfacesBytes()); occlusionTracker.overdrawMetrics().recordMetrics(this); return needMoreUpdates; diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h index c2143eae5..bd65650f4 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h @@ -51,7 +51,6 @@ class CCLayerChromium; class CCLayerTreeHostImpl; class CCLayerTreeHostImplClient; class CCTextureUpdater; -class ManagedTexture; class Region; class TextureAllocator; class CCPrioritizedTextureManager; @@ -96,6 +95,7 @@ struct CCLayerTreeSettings { , maxPartialTextureUpdates(std::numeric_limits<size_t>::max()) , defaultTileSize(IntSize(256, 256)) , maxUntiledLayerSize(IntSize(512, 512)) + , minimumOcclusionTrackingSize(IntSize(160, 160)) { } bool acceleratePainting; @@ -112,6 +112,7 @@ struct CCLayerTreeSettings { size_t maxPartialTextureUpdates; IntSize defaultTileSize; IntSize maxUntiledLayerSize; + IntSize minimumOcclusionTrackingSize; }; // Provides information on an Impl's rendering capabilities back to the CCLayerTreeHost @@ -284,7 +285,10 @@ private: void updateLayers(LayerChromium*, CCTextureUpdater&); - void prioritizeTextures(const LayerList& updateList); + void prioritizeTextures(const LayerList&, CCOverdrawMetrics&); + void setPrioritiesForSurfaces(size_t surfaceMemoryBytes); + void setPrioritiesForLayers(const LayerList&); + size_t calculateMemoryForRenderSurfaces(const LayerList& updateList); void animateLayers(double monotonicTime); bool animateLayersRecursive(LayerChromium* current, double monotonicTime); @@ -308,6 +312,7 @@ private: RefPtr<LayerChromium> m_rootLayer; OwnPtr<CCPrioritizedTextureManager> m_contentsTextureManager; + OwnPtr<CCPrioritizedTexture> m_surfaceMemoryPlaceholder; CCLayerTreeSettings m_settings; diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp index 51ae04802..1c677555a 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp @@ -153,7 +153,7 @@ static bool isSurfaceBackFaceVisible(LayerType* layer, const WebTransformationMa } template<typename LayerType> -static IntRect calculateVisibleLayerRect(LayerType* layer) +static IntRect calculateVisibleContentRect(LayerType* layer) { ASSERT(layer->targetRenderSurface()); @@ -176,8 +176,8 @@ static IntRect calculateVisibleLayerRect(LayerType* layer) bounds.height() / static_cast<double>(contentBounds.height())); transform.translate(-contentBounds.width() / 2.0, -contentBounds.height() / 2.0); - IntRect visibleLayerRect = CCLayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerBoundRect, transform); - return visibleLayerRect; + IntRect visibleContentRect = CCLayerTreeHostCommon::calculateVisibleRect(targetSurfaceRect, layerBoundRect, transform); + return visibleContentRect; } static bool isScaleOrTranslation(const WebTransformationMatrix& m) @@ -219,7 +219,7 @@ static bool layerShouldBeSkipped(LayerType* layer) // // Some additional conditions need to be computed at a later point after the recursion is finished. // - the intersection of render surface content and layer clipRect is empty - // - the visibleLayerRect is empty + // - the visibleContentRect is empty // // Note, if the layer should not have been drawn due to being fully transparent, // we would have skipped the entire subtree and never made it into this function, @@ -261,6 +261,11 @@ static inline bool subtreeShouldBeSkipped(LayerChromium* layer) template<typename LayerType> static bool subtreeShouldRenderToSeparateSurface(LayerType* layer, bool axisAlignedWithRespectToParent) { + // The root layer has a special render surface that is set up externally, so + // it shouldn't be treated as a surface in this code. + if (!layer->parent()) + return false; + // Cache this value, because otherwise it walks the entire subtree several times. bool descendantDrawsContent = layer->descendantDrawsContent(); @@ -833,7 +838,7 @@ static bool calculateDrawTransformsInternal(LayerType* layer, LayerType* rootLay } // FIXME: Instead of using the following function to set visibility rects on a second -// tree pass, revise calculateVisibleLayerRect() so that this can be done in a single +// tree pass, revise calculateVisibleContentRect() so that this can be done in a single // pass inside calculateDrawTransformsInternal<>(). template<typename LayerType, typename LayerList, typename RenderSurfaceType> static void calculateVisibleAndScissorRectsInternal(const LayerList& renderSurfaceLayerList, const FloatRect& rootScissorRect) @@ -846,13 +851,13 @@ static void calculateVisibleAndScissorRectsInternal(const LayerList& renderSurfa if (it.representsTargetRenderSurface()) { LayerType* maskLayer = it->maskLayer(); if (maskLayer) - maskLayer->setVisibleLayerRect(IntRect(IntPoint(), it->contentBounds())); + maskLayer->setVisibleContentRect(IntRect(IntPoint(), it->contentBounds())); LayerType* replicaMaskLayer = it->replicaLayer() ? it->replicaLayer()->maskLayer() : 0; if (replicaMaskLayer) - replicaMaskLayer->setVisibleLayerRect(IntRect(IntPoint(), it->contentBounds())); + replicaMaskLayer->setVisibleContentRect(IntRect(IntPoint(), it->contentBounds())); } else if (it.representsItself()) { - IntRect visibleLayerRect = calculateVisibleLayerRect(*it); - it->setVisibleLayerRect(visibleLayerRect); + IntRect visibleContentRect = calculateVisibleContentRect(*it); + it->setVisibleContentRect(visibleContentRect); IntRect scissorRect = calculateLayerScissorRect<LayerType, RenderSurfaceType>(*it, rootScissorRect); it->setScissorRect(scissorRect); diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp index 26a09e70f..ada3c8e3b 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp @@ -42,6 +42,7 @@ #include "cc/CCLayerTreeHostCommon.h" #include "cc/CCOverdrawMetrics.h" #include "cc/CCPageScaleAnimation.h" +#include "cc/CCPrioritizedTextureManager.h" #include "cc/CCRenderPassDrawQuad.h" #include "cc/CCSettings.h" #include "cc/CCSingleThreadProxy.h" @@ -122,7 +123,7 @@ CCLayerTreeHostImpl::CCLayerTreeHostImpl(const CCLayerTreeSettings& settings, CC , m_deviceScaleFactor(1) , m_visible(true) , m_contentsTexturesWerePurgedSinceLastCommit(false) - , m_memoryAllocationLimitBytes(TextureManager::highLimitBytes(viewportSize())) + , m_memoryAllocationLimitBytes(CCPrioritizedTextureManager::defaultMemoryAllocationLimit()) , m_headsUpDisplay(CCHeadsUpDisplay::create()) , m_pageScale(1) , m_pageScaleDelta(1) @@ -295,17 +296,16 @@ bool CCLayerTreeHostImpl::calculateRenderPasses(FrameData& frame) CCLayerImpl* renderSurfaceLayer = (*frame.renderSurfaceLayerList)[surfaceIndex]; CCRenderSurface* renderSurface = renderSurfaceLayer->renderSurface(); - // FIXME: Make this unique across all CCLayerTreeHostImpls. - int globalRenderPassId = renderSurfaceLayer->id(); - - OwnPtr<CCRenderPass> pass = CCRenderPass::create(renderSurface, globalRenderPassId); + int renderPassId = renderSurfaceLayer->id(); + OwnPtr<CCRenderPass> pass = CCRenderPass::create(renderSurface, renderPassId); surfacePassMap.add(renderSurface, pass.get()); - frame.renderPasses.append(pass.release()); + frame.renderPasses.append(pass.get()); + frame.renderPassesById.add(renderPassId, pass.release()); } bool recordMetricsForFrame = true; // FIXME: In the future, disable this when about:tracing is off. CCOcclusionTrackerImpl occlusionTracker(enclosingIntRect(m_rootScissorRect), recordMetricsForFrame); - occlusionTracker.setMinimumTrackingSize(CCOcclusionTrackerImpl::preferredMinimumTrackingSize()); + occlusionTracker.setMinimumTrackingSize(m_settings.minimumOcclusionTrackingSize); if (settings().showOccludingRects) occlusionTracker.setOccludingScreenSpaceRectsContainer(&frame.occludingScreenSpaceRects); @@ -329,7 +329,7 @@ bool CCLayerTreeHostImpl::calculateRenderPasses(FrameData& frame) if (it.representsContributingRenderSurface() && !it->renderSurface()->scissorRect().isEmpty()) { CCRenderPass* contributingRenderPass = surfacePassMap.get(it->renderSurface()); pass->appendQuadsForRenderSurfaceLayer(*it, contributingRenderPass, &occlusionTracker); - } else if (it.representsItself() && !occlusionTracker.occluded(*it, it->visibleLayerRect()) && !it->visibleLayerRect().isEmpty() && !it->scissorRect().isEmpty()) { + } else if (it.representsItself() && !occlusionTracker.occluded(*it, it->visibleContentRect()) && !it->visibleContentRect().isEmpty() && !it->scissorRect().isEmpty()) { it->willDraw(m_layerRenderer.get(), context()); frame.willDrawLayers.append(*it); @@ -406,19 +406,26 @@ IntSize CCLayerTreeHostImpl::contentSize() const return m_rootScrollLayerImpl->children()[0]->contentBounds(); } -// static -void CCLayerTreeHostImpl::removeRenderPassesRecursive(CCRenderPassList& passes, size_t bottomPass, const CCRenderPass* firstToRemove, CCRenderPassList& skippedPasses) +static inline CCRenderPass* findRenderPassById(int renderPassId, const CCLayerTreeHostImpl::FrameData& frame) +{ + CCRenderPassIdHashMap::const_iterator it = frame.renderPassesById.find(renderPassId); + ASSERT(it != frame.renderPassesById.end()); + return it->second.get(); +} + +static void removeRenderPassesRecursive(int removeRenderPassId, CCLayerTreeHostImpl::FrameData& frame) { - size_t removeIndex = passes.find(firstToRemove); + CCRenderPass* removeRenderPass = findRenderPassById(removeRenderPassId, frame); + size_t removeIndex = frame.renderPasses.find(removeRenderPass); // The pass was already removed by another quad - probably the original, and we are the replica. if (removeIndex == notFound) return; - OwnPtr<CCRenderPass> removedPass = passes[removeIndex].release(); - passes.remove(removeIndex); + const CCRenderPass* removedPass = frame.renderPasses[removeIndex]; + frame.renderPasses.remove(removeIndex); - // Now follow up for all RenderPass quads and remove their render passes recursively. + // Now follow up for all RenderPass quads and remove their RenderPasses recursively. const CCQuadList& quadList = removedPass->quadList(); CCQuadList::constBackToFrontIterator quadListIterator = quadList.backToFrontBegin(); for (; quadListIterator != quadList.backToFrontEnd(); ++quadListIterator) { @@ -426,36 +433,32 @@ void CCLayerTreeHostImpl::removeRenderPassesRecursive(CCRenderPassList& passes, if (currentQuad->material() != CCDrawQuad::RenderPass) continue; - CCRenderPassDrawQuad* renderPassQuad = static_cast<CCRenderPassDrawQuad*>(currentQuad); - const CCRenderPass* nextRenderPass = renderPassQuad->renderPass(); - - // Our search is now limited up to the pass that we just removed. - // Substitute removeIndex for bottomPass now. - removeRenderPassesRecursive(passes, removeIndex, nextRenderPass, skippedPasses); + int nextRemoveRenderPassId = CCRenderPassDrawQuad::materialCast(currentQuad)->renderPassId(); + removeRenderPassesRecursive(nextRemoveRenderPassId, frame); } - skippedPasses.append(removedPass.release()); } -bool CCLayerTreeHostImpl::CullRenderPassesWithCachedTextures::shouldRemoveRenderPass(const CCRenderPassList&, const CCRenderPassDrawQuad& quad) const +bool CCLayerTreeHostImpl::CullRenderPassesWithCachedTextures::shouldRemoveRenderPass(const CCRenderPassDrawQuad& quad, const FrameData&) const { return quad.contentsChangedSinceLastFrame().isEmpty() && m_renderer.haveCachedResourcesForRenderPassId(quad.renderPassId()); } -bool CCLayerTreeHostImpl::CullRenderPassesWithNoQuads::shouldRemoveRenderPass(const CCRenderPassList& passList, const CCRenderPassDrawQuad& quad) const +bool CCLayerTreeHostImpl::CullRenderPassesWithNoQuads::shouldRemoveRenderPass(const CCRenderPassDrawQuad& quad, const FrameData& frame) const { - size_t passIndex = passList.find(quad.renderPass()); + const CCRenderPass* renderPass = findRenderPassById(quad.renderPassId(), frame); + size_t passIndex = frame.renderPasses.find(renderPass); ASSERT(passIndex != notFound); // If any quad or RenderPass draws into this RenderPass, then keep it. - const CCQuadList& quadList = passList[passIndex]->quadList(); + const CCQuadList& quadList = frame.renderPasses[passIndex]->quadList(); for (CCQuadList::constBackToFrontIterator quadListIterator = quadList.backToFrontBegin(); quadListIterator != quadList.backToFrontEnd(); ++quadListIterator) { CCDrawQuad* currentQuad = quadListIterator->get(); if (currentQuad->material() != CCDrawQuad::RenderPass) return false; - const CCRenderPassDrawQuad* quadInPass = static_cast<CCRenderPassDrawQuad*>(currentQuad); - if (passList.contains(quadInPass->renderPass())) + const CCRenderPass* contributingPass = findRenderPassById(CCRenderPassDrawQuad::materialCast(currentQuad)->renderPassId(), frame); + if (frame.renderPasses.contains(contributingPass)) return false; } return true; @@ -470,7 +473,7 @@ template<typename RenderPassCuller> void CCLayerTreeHostImpl::removeRenderPasses(RenderPassCuller culler, FrameData& frame) { for (size_t it = culler.renderPassListBegin(frame.renderPasses); it != culler.renderPassListEnd(frame.renderPasses); it = culler.renderPassListNext(it)) { - CCRenderPass* currentPass = frame.renderPasses[it].get(); + const CCRenderPass* currentPass = frame.renderPasses[it]; const CCQuadList& quadList = currentPass->quadList(); CCQuadList::constBackToFrontIterator quadListIterator = quadList.backToFrontBegin(); @@ -481,7 +484,7 @@ void CCLayerTreeHostImpl::removeRenderPasses(RenderPassCuller culler, FrameData& continue; CCRenderPassDrawQuad* renderPassQuad = static_cast<CCRenderPassDrawQuad*>(currentQuad); - if (!culler.shouldRemoveRenderPass(frame.renderPasses, *renderPassQuad)) + if (!culler.shouldRemoveRenderPass(*renderPassQuad, frame)) continue; // We are changing the vector in the middle of iteration. Because we @@ -490,7 +493,7 @@ void CCLayerTreeHostImpl::removeRenderPasses(RenderPassCuller culler, FrameData& // change. So, capture the iterator position from the end of the // list, and restore it after the change. int positionFromEnd = frame.renderPasses.size() - it; - removeRenderPassesRecursive(frame.renderPasses, it, renderPassQuad->renderPass(), frame.skippedPasses); + removeRenderPassesRecursive(renderPassQuad->renderPassId(), frame); it = frame.renderPasses.size() - positionFromEnd; ASSERT(it >= 0); } @@ -504,6 +507,7 @@ bool CCLayerTreeHostImpl::prepareToDraw(FrameData& frame) frame.renderSurfaceLayerList = &m_renderSurfaceLayerList; frame.renderPasses.clear(); + frame.renderPassesById.clear(); frame.renderSurfaceLayerList->clear(); frame.willDrawLayers.clear(); @@ -542,13 +546,13 @@ void CCLayerTreeHostImpl::drawLayers(const FrameData& frame) // RenderWidget. // The root RenderPass is the last one to be drawn. - CCRenderPass* rootRenderPass = frame.renderPasses.last().get(); + const CCRenderPass* rootRenderPass = frame.renderPasses.last(); m_fpsCounter->markBeginningOfFrame(currentTime()); m_layerRenderer->beginDrawingFrame(rootRenderPass); for (size_t i = 0; i < frame.renderPasses.size(); ++i) { - CCRenderPass* renderPass = frame.renderPasses[i].get(); + const CCRenderPass* renderPass = frame.renderPasses[i]; FloatRect rootScissorRectInCurrentSurface = renderPass->targetSurface()->computeRootScissorRectInCurrentSurface(m_rootScissorRect); m_layerRenderer->drawRenderPass(renderPass, rootScissorRectInCurrentSurface); diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.h b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.h index 49f2fc62b..753aa384a 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.h @@ -85,7 +85,7 @@ public: struct FrameData { Vector<IntRect> occludingScreenSpaceRects; CCRenderPassList renderPasses; - CCRenderPassList skippedPasses; + CCRenderPassIdHashMap renderPassesById; CCLayerList* renderSurfaceLayerList; CCLayerList willDrawLayers; }; @@ -180,7 +180,7 @@ public: class CullRenderPassesWithCachedTextures { public: - bool shouldRemoveRenderPass(const CCRenderPassList&, const CCRenderPassDrawQuad&) const; + bool shouldRemoveRenderPass(const CCRenderPassDrawQuad&, const FrameData&) const; // Iterates from the root first, in order to remove the surfaces closest // to the root with cached textures, and all surfaces that draw into @@ -196,7 +196,7 @@ public: class CullRenderPassesWithNoQuads { public: - bool shouldRemoveRenderPass(const CCRenderPassList&, const CCRenderPassDrawQuad&) const; + bool shouldRemoveRenderPass(const CCRenderPassDrawQuad&, const FrameData&) const; // Iterates in draw order, so that when a surface is removed, and its // target becomes empty, then its target can be removed also. @@ -244,8 +244,6 @@ private: void setBackgroundTickingEnabled(bool); IntSize contentSize() const; - static void removeRenderPassesRecursive(CCRenderPassList& passes, size_t bottomPass, const CCRenderPass* firstToRemove, CCRenderPassList& skippedPasses); - void sendDidLoseContextRecursive(CCLayerImpl*); void clearRenderSurfaces(); bool ensureRenderSurfaceLayerList(); diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCOcclusionTracker.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCOcclusionTracker.cpp index b49ff9083..6124ddc9c 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCOcclusionTracker.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCOcclusionTracker.cpp @@ -310,10 +310,10 @@ static inline WebTransformationMatrix contentToTargetSurfaceTransform(const Laye template<typename LayerType> static inline void addOcclusionBehindLayer(Region& region, const LayerType* layer, const WebTransformationMatrix& transform, const Region& opaqueContents, const IntRect& scissorRect, const IntSize& minimumTrackingSize, Vector<IntRect>* occludingScreenSpaceRects) { - ASSERT(layer->visibleLayerRect().contains(opaqueContents.bounds())); + ASSERT(layer->visibleContentRect().contains(opaqueContents.bounds())); bool clipped; - FloatQuad visibleTransformedQuad = CCMathUtil::mapQuad(transform, FloatQuad(layer->visibleLayerRect()), clipped); + FloatQuad visibleTransformedQuad = CCMathUtil::mapQuad(transform, FloatQuad(layer->visibleContentRect()), clipped); // FIXME: Find a rect interior to each transformed quad. if (clipped || !visibleTransformedQuad.isRectilinear()) return; diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCOcclusionTracker.h b/Source/WebCore/platform/graphics/chromium/cc/CCOcclusionTracker.h index 027fab71d..0ca966d96 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCOcclusionTracker.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCOcclusionTracker.h @@ -70,8 +70,6 @@ public: void setMinimumTrackingSize(const IntSize& size) { m_minimumTrackingSize = size; } - static IntSize preferredMinimumTrackingSize() { return IntSize(160, 160); } - // The following is used for visualization purposes. void setOccludingScreenSpaceRectsContainer(Vector<IntRect>* rects) { m_occludingScreenSpaceRects = rects; } diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCPrioritizedTexture.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCPrioritizedTexture.cpp index d8cc17485..1df771386 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCPrioritizedTexture.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCPrioritizedTexture.cpp @@ -29,6 +29,7 @@ #include "CCPrioritizedTextureManager.h" #include "CCPriorityCalculator.h" #include "LayerRendererChromium.h" +#include "TextureAllocator.h" #include <algorithm> using namespace std; @@ -38,16 +39,17 @@ namespace WebCore { CCPrioritizedTexture::CCPrioritizedTexture(CCPrioritizedTextureManager* manager, IntSize size, GC3Denum format) : m_size(size) , m_format(format) - , m_memorySizeBytes(0) + , m_bytes(0) , m_priority(CCPriorityCalculator::lowestPriority()) , m_isAbovePriorityCutoff(false) - , m_currentBacking(0) + , m_isSelfManaged(false) + , m_backing(0) , m_manager(0) { // m_manager is set in registerTexture() so validity can be checked. ASSERT(format || size.isEmpty()); if (format) - m_memorySizeBytes = TextureManager::memoryUseBytes(size, format); + m_bytes = CCTexture::memorySizeBytes(size, format); if (manager) manager->registerTexture(this); } @@ -74,8 +76,8 @@ void CCPrioritizedTexture::setDimensions(IntSize size, GC3Denum format) m_isAbovePriorityCutoff = false; m_format = format; m_size = size; - m_memorySizeBytes = TextureManager::memoryUseBytes(size, format); - ASSERT(m_manager || !m_currentBacking); + m_bytes = CCTexture::memorySizeBytes(size, format); + ASSERT(m_manager || !m_backing); if (m_manager) m_manager->returnBackingTexture(this); } @@ -97,8 +99,8 @@ void CCPrioritizedTexture::acquireBackingTexture(TextureAllocator* allocator) unsigned CCPrioritizedTexture::textureId() { - if (m_currentBacking) - return m_currentBacking->textureId(); + if (m_backing) + return m_backing->id(); return 0; } @@ -107,7 +109,7 @@ void CCPrioritizedTexture::bindTexture(CCGraphicsContext* context, TextureAlloca ASSERT(m_isAbovePriorityCutoff); if (m_isAbovePriorityCutoff) acquireBackingTexture(allocator); - ASSERT(m_currentBacking); + ASSERT(m_backing); WebKit::WebGraphicsContext3D* context3d = context->context3D(); if (!context3d) { // FIXME: Implement this path for software compositing. @@ -121,7 +123,7 @@ void CCPrioritizedTexture::framebufferTexture2D(CCGraphicsContext* context, Text ASSERT(m_isAbovePriorityCutoff); if (m_isAbovePriorityCutoff) acquireBackingTexture(allocator); - ASSERT(m_currentBacking); + ASSERT(m_backing); WebKit::WebGraphicsContext3D* context3d = context->context3D(); if (!context3d) { // FIXME: Implement this path for software compositing. @@ -130,11 +132,30 @@ void CCPrioritizedTexture::framebufferTexture2D(CCGraphicsContext* context, Text context3d->framebufferTexture2D(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::COLOR_ATTACHMENT0, GraphicsContext3D::TEXTURE_2D, textureId(), 0); } -void CCPrioritizedTexture::setCurrentBacking(CCPrioritizedTexture::Backing* backing) +void CCPrioritizedTexture::link(Backing* backing) { - if (m_currentBacking == backing) - return; - m_currentBacking = backing; + ASSERT(backing); + ASSERT(!backing->m_owner); + ASSERT(!m_backing); + + m_backing = backing; + m_backing->m_owner = this; +} + +void CCPrioritizedTexture::unlink() +{ + ASSERT(m_backing); + ASSERT(m_backing->m_owner == this); + + m_backing->m_owner = 0; + m_backing = 0; +} + +void CCPrioritizedTexture::setToSelfManagedMemoryPlaceholder(size_t bytes) +{ + setDimensions(IntSize(), GraphicsContext3D::RGBA); + setIsSelfManaged(true); + m_bytes = bytes; } } // namespace WebCore diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCPrioritizedTexture.h b/Source/WebCore/platform/graphics/chromium/cc/CCPrioritizedTexture.h index 9ea2fb1e4..46073c5f3 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCPrioritizedTexture.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCPrioritizedTexture.h @@ -26,16 +26,17 @@ #define CCPrioritizedTexture_h #include "CCPriorityCalculator.h" +#include "CCTexture.h" #include "GraphicsContext3D.h" #include "IntRect.h" #include "IntSize.h" -#include "TextureManager.h" namespace WebCore { class CCPrioritizedTextureManager; class CCPriorityCalculator; class CCGraphicsContext; +class TextureAllocator; class CCPrioritizedTexture { WTF_MAKE_NONCOPYABLE(CCPrioritizedTexture); @@ -57,7 +58,7 @@ public: void setDimensions(IntSize, GC3Denum format); GC3Denum format() const { return m_format; } IntSize size() const { return m_size; } - size_t memorySizeBytes() const { return m_memorySizeBytes; } + size_t bytes() const { return m_bytes; } // Set priority for the requested texture. void setRequestPriority(int priority) { m_priority = priority; } @@ -68,12 +69,12 @@ public: bool canAcquireBackingTexture() const { return m_isAbovePriorityCutoff; } // This returns whether we still have a backing texture. This can continue - // to be true even after canAquireBackingTexture() becomes false. In this + // to be true even after canAcquireBackingTexture() becomes false. In this // case the texture can be used but shouldn't be updated since it will get // taken away "soon". - bool haveBackingTexture() const { return !!currentBacking(); } + bool haveBackingTexture() const { return !!backing(); } - // If canAquireBackingTexture() is true acquireBackingTexture() will acquire + // If canAcquireBackingTexture() is true acquireBackingTexture() will acquire // a backing texture for use. Call this whenever the texture is actually needed. void acquireBackingTexture(TextureAllocator*); @@ -81,48 +82,39 @@ public: // (all textures are visible) but we can still squeeze into the limit // by not painting occluded textures. In this case the manager // refuses all visible textures and requestLate() will enable - // canAquireBackingTexture() on a call-order basis. We might want to + // canAcquireBackingTexture() on a call-order basis. We might want to // just remove this in the future (carefully) and just make sure we don't // regress OOMs situations. bool requestLate(); - // These functions will aquire the texture if possible. If neither haveBackingTexture() - // nor canAquireBackingTexture() is true, an ID of zero will be used/returned. + // These functions will acquire the texture if possible. If neither haveBackingTexture() + // nor canAcquireBackingTexture() is true, an ID of zero will be used/returned. void bindTexture(CCGraphicsContext*, TextureAllocator*); void framebufferTexture2D(CCGraphicsContext*, TextureAllocator*); unsigned textureId(); + // Self-managed textures are accounted for when prioritizing other textures, + // but they are not allocated/recycled/deleted, so this needs to be done + // externally. canAcquireBackingTexture() indicates if the texture would have + // been allowed given its priority. + void setIsSelfManaged(bool isSelfManaged) { m_isSelfManaged = isSelfManaged; } + bool isSelfManaged() { return m_isSelfManaged; } + void setToSelfManagedMemoryPlaceholder(size_t bytes); + private: friend class CCPrioritizedTextureManager; - class Backing { + class Backing : public CCTexture { WTF_MAKE_NONCOPYABLE(Backing); public: - IntSize size() const { return m_size; } - GC3Denum format() const { return m_format; } - size_t memorySizeBytes() const { return m_memorySizeBytes; } - unsigned textureId() const { return m_textureId; } - CCPrioritizedTexture* currentTexture() const { return m_currentTexture; } - void setCurrentTexture(CCPrioritizedTexture* current) { m_currentTexture = current; } + Backing(unsigned id, IntSize size, GC3Denum format) + : CCTexture(id, size, format), m_owner(0) { } + ~Backing() { ASSERT(!m_owner); } + CCPrioritizedTexture* owner() { return m_owner; } private: - friend class CCPrioritizedTextureManager; - - Backing(IntSize size, GC3Denum format, unsigned textureId) - : m_size(size) - , m_format(format) - , m_memorySizeBytes(TextureManager::memoryUseBytes(size, format)) - , m_textureId(textureId) - , m_priority(CCPriorityCalculator::lowestPriority()) - , m_currentTexture(0) { } - ~Backing() { ASSERT(!m_currentTexture); } - - IntSize m_size; - GC3Denum m_format; - size_t m_memorySizeBytes; - unsigned m_textureId; - int m_priority; - CCPrioritizedTexture* m_currentTexture; + friend class CCPrioritizedTexture; + CCPrioritizedTexture* m_owner; }; CCPrioritizedTexture(CCPrioritizedTextureManager*, IntSize, GC3Denum format); @@ -131,17 +123,19 @@ private: void setAbovePriorityCutoff(bool isAbovePriorityCutoff) { m_isAbovePriorityCutoff = isAbovePriorityCutoff; } void setManagerInternal(CCPrioritizedTextureManager* manager) { m_manager = manager; } - Backing* currentBacking() const { return m_currentBacking; } - void setCurrentBacking(Backing*); + Backing* backing() const { return m_backing; } + void link(Backing*); + void unlink(); IntSize m_size; GC3Denum m_format; - size_t m_memorySizeBytes; + size_t m_bytes; size_t m_priority; bool m_isAbovePriorityCutoff; + bool m_isSelfManaged; - Backing* m_currentBacking; + Backing* m_backing; CCPrioritizedTextureManager* m_manager; }; diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCPrioritizedTextureManager.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCPrioritizedTextureManager.cpp index 5af53df04..d19e5aa19 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCPrioritizedTextureManager.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCPrioritizedTextureManager.cpp @@ -55,7 +55,7 @@ CCPrioritizedTextureManager::~CCPrioritizedTextureManager() destroyBacking(*m_backings.begin(), 0); } -void CCPrioritizedTextureManager::prioritizeTextures(size_t renderSurfacesMemoryBytes) +void CCPrioritizedTextureManager::prioritizeTextures() { TRACE_EVENT0("cc", "CCPrioritizedTextureManager::prioritizeTextures"); @@ -79,31 +79,29 @@ void CCPrioritizedTextureManager::prioritizeTextures(size_t renderSurfacesMemory m_memoryAvailableBytes = m_maxMemoryLimitBytes; m_priorityCutoff = CCPriorityCalculator::lowestPriority(); - bool reservedRenderSurfaces = false; size_t memoryBytes = 0; for (TextureVector::iterator it = sortedTextures.begin(); it != sortedTextures.end(); ++it) { if ((*it)->requestPriority() == CCPriorityCalculator::lowestPriority()) break; - // FIXME: We can make placeholder objects similar to textures to represent the render surface memory request. - if (!reservedRenderSurfaces && CCPriorityCalculator::priorityIsLower((*it)->requestPriority(), CCPriorityCalculator::renderSurfacePriority())) { - size_t newMemoryBytes = memoryBytes + renderSurfacesMemoryBytes; + if ((*it)->isSelfManaged()) { + // Account for self-managed memory immediately by reducing the memory + // available (since it never gets acquired). + size_t newMemoryBytes = memoryBytes + (*it)->bytes(); if (newMemoryBytes > m_memoryAvailableBytes) { m_priorityCutoff = (*it)->requestPriority(); m_memoryAvailableBytes = memoryBytes; break; } - m_memoryAvailableBytes -= renderSurfacesMemoryBytes; - reservedRenderSurfaces = true; - } - - size_t newMemoryBytes = memoryBytes + (*it)->memorySizeBytes(); - if (newMemoryBytes > m_memoryAvailableBytes) { - m_priorityCutoff = (*it)->requestPriority(); - break; + m_memoryAvailableBytes -= (*it)->bytes(); + } else { + size_t newMemoryBytes = memoryBytes + (*it)->bytes(); + if (newMemoryBytes > m_memoryAvailableBytes) { + m_priorityCutoff = (*it)->requestPriority(); + break; + } + memoryBytes = newMemoryBytes; } - - memoryBytes = newMemoryBytes; } // Only allow textures if they are higher than the cutoff. All textures @@ -113,8 +111,8 @@ void CCPrioritizedTextureManager::prioritizeTextures(size_t renderSurfacesMemory for (TextureVector::iterator it = sortedTextures.begin(); it != sortedTextures.end(); ++it) { bool isAbovePriorityCutoff = CCPriorityCalculator::priorityIsHigher((*it)->requestPriority(), m_priorityCutoff); (*it)->setAbovePriorityCutoff(isAbovePriorityCutoff); - if (isAbovePriorityCutoff) - m_memoryAboveCutoffBytes += (*it)->memorySizeBytes(); + if (isAbovePriorityCutoff && !(*it)->isSelfManaged()) + m_memoryAboveCutoffBytes += (*it)->bytes(); } ASSERT(m_memoryAboveCutoffBytes <= m_memoryAvailableBytes); @@ -157,23 +155,24 @@ bool CCPrioritizedTextureManager::requestLate(CCPrioritizedTexture* texture) if (CCPriorityCalculator::priorityIsLower(texture->requestPriority(), m_priorityCutoff)) return false; - size_t newMemoryBytes = m_memoryAboveCutoffBytes + texture->memorySizeBytes(); + size_t newMemoryBytes = m_memoryAboveCutoffBytes + texture->bytes(); if (newMemoryBytes > m_memoryAvailableBytes) return false; m_memoryAboveCutoffBytes = newMemoryBytes; texture->setAbovePriorityCutoff(true); - if (texture->currentBacking()) { - m_backings.remove(texture->currentBacking()); - m_backings.add(texture->currentBacking()); + if (texture->backing()) { + m_backings.remove(texture->backing()); + m_backings.add(texture->backing()); } return true; } void CCPrioritizedTextureManager::acquireBackingTextureIfNeeded(CCPrioritizedTexture* texture, TextureAllocator* allocator) { + ASSERT(!texture->isSelfManaged()); ASSERT(texture->isAbovePriorityCutoff()); - if (texture->currentBacking() || !texture->isAbovePriorityCutoff()) + if (texture->backing() || !texture->isAbovePriorityCutoff()) return; // Find a backing below, by either recycling or allocating. @@ -181,7 +180,7 @@ void CCPrioritizedTextureManager::acquireBackingTextureIfNeeded(CCPrioritizedTex // First try to recycle for (BackingSet::iterator it = m_backings.begin(); it != m_backings.end(); ++it) { - if ((*it)->currentTexture() && (*it)->currentTexture()->isAbovePriorityCutoff()) + if ((*it)->owner() && (*it)->owner()->isAbovePriorityCutoff()) break; if ((*it)->size() == texture->size() && (*it)->format() == texture->format()) { backing = (*it); @@ -191,14 +190,14 @@ void CCPrioritizedTextureManager::acquireBackingTextureIfNeeded(CCPrioritizedTex // Otherwise reduce memory and just allocate a new backing texures. if (!backing) { - reduceMemory(m_memoryAvailableBytes - texture->memorySizeBytes(), allocator); + reduceMemory(m_memoryAvailableBytes - texture->bytes(), allocator); backing = createBacking(texture->size(), texture->format(), allocator); } // Move the used backing texture to the end of the eviction list. - if (backing->currentTexture()) - unlink(backing->currentTexture(), backing); - link(texture, backing); + if (backing->owner()) + backing->owner()->unlink(); + texture->link(backing); m_backings.remove(backing); m_backings.add(backing); } @@ -211,7 +210,7 @@ void CCPrioritizedTextureManager::reduceMemory(size_t limitBytes, TextureAllocat // or until all backings remaining are above the cutoff. while (memoryUseBytes() > limitBytes && m_backings.size() > 0) { BackingSet::iterator it = m_backings.begin(); - if ((*it)->currentTexture() && (*it)->currentTexture()->isAbovePriorityCutoff()) + if ((*it)->owner() && (*it)->owner()->isAbovePriorityCutoff()) break; destroyBacking((*it), allocator); } @@ -229,9 +228,9 @@ void CCPrioritizedTextureManager::reduceMemory(TextureAllocator* allocator) // backing textures (any more than 10%). size_t wastedMemory = 0; for (BackingSet::iterator it = m_backings.begin(); it != m_backings.end(); ++it) { - if ((*it)->currentTexture()) + if ((*it)->owner()) break; - wastedMemory += (*it)->memorySizeBytes(); + wastedMemory += (*it)->bytes(); } size_t tenPercentOfMemory = m_memoryAvailableBytes / 10; if (wastedMemory <= tenPercentOfMemory) @@ -244,8 +243,8 @@ void CCPrioritizedTextureManager::clearAllMemory(TextureAllocator* allocator) // Unlink and destroy all backing textures. while (m_backings.size() > 0) { BackingSet::iterator it = m_backings.begin(); - if ((*it)->currentTexture()) - unlink((*it)->currentTexture(), (*it)); + if ((*it)->owner()) + (*it)->owner()->unlink(); destroyBacking((*it), allocator); } } @@ -258,32 +257,11 @@ void CCPrioritizedTextureManager::allBackingTexturesWereDeleted() clearAllMemory(0); } -void CCPrioritizedTextureManager::unlink(CCPrioritizedTexture* texture, CCPrioritizedTexture::Backing* backing) -{ - ASSERT(texture && backing); - ASSERT(texture->currentBacking() == backing); - ASSERT(backing->currentTexture() == texture); - - texture->setCurrentBacking(0); - backing->setCurrentTexture(0); -} - -void CCPrioritizedTextureManager::link(CCPrioritizedTexture* texture, CCPrioritizedTexture::Backing* backing) -{ - ASSERT(texture && backing); - ASSERT(!texture->currentBacking()); - ASSERT(!backing->currentTexture()); - - texture->setCurrentBacking(backing); - backing->setCurrentTexture(texture); -} - - void CCPrioritizedTextureManager::registerTexture(CCPrioritizedTexture* texture) { ASSERT(texture); ASSERT(!texture->textureManager()); - ASSERT(!texture->currentBacking()); + ASSERT(!texture->backing()); ASSERT(m_textures.find(texture) == m_textures.end()); texture->setManagerInternal(this); @@ -305,11 +283,11 @@ void CCPrioritizedTextureManager::unregisterTexture(CCPrioritizedTexture* textur void CCPrioritizedTextureManager::returnBackingTexture(CCPrioritizedTexture* texture) { - if (texture->currentBacking()) { + if (texture->backing()) { // Move the backing texture to the front for eviction/recycling and unlink it. - m_backings.remove(texture->currentBacking()); - m_backings.insertBefore(m_backings.begin(), texture->currentBacking()); - unlink(texture, texture->currentBacking()); + m_backings.remove(texture->backing()); + m_backings.insertBefore(m_backings.begin(), texture->backing()); + texture->unlink(); } } @@ -317,9 +295,8 @@ CCPrioritizedTexture::Backing* CCPrioritizedTextureManager::createBacking(IntSiz { ASSERT(allocator); - unsigned textureId = allocator->createTexture(size, format); - CCPrioritizedTexture::Backing* backing = new CCPrioritizedTexture::Backing(size, format, textureId); - m_memoryUseBytes += backing->memorySizeBytes(); + CCPrioritizedTexture::Backing* backing = new CCPrioritizedTexture::Backing(allocator->createTexture(size, format), size, format); + m_memoryUseBytes += backing->bytes(); // Put backing texture at the front for eviction, since it isn't in use yet. m_backings.insertBefore(m_backings.begin(), backing); return backing; @@ -328,14 +305,15 @@ CCPrioritizedTexture::Backing* CCPrioritizedTextureManager::createBacking(IntSiz void CCPrioritizedTextureManager::destroyBacking(CCPrioritizedTexture::Backing* backing, TextureAllocator* allocator) { ASSERT(backing); - ASSERT(!backing->currentTexture() || !backing->currentTexture()->isAbovePriorityCutoff()); + ASSERT(!backing->owner() || !backing->owner()->isAbovePriorityCutoff()); + ASSERT(!backing->owner() || !backing->owner()->isSelfManaged()); ASSERT(m_backings.find(backing) != m_backings.end()); if (allocator) - allocator->deleteTexture(backing->textureId(), backing->size(), backing->format()); - if (backing->currentTexture()) - unlink(backing->currentTexture(), backing); - m_memoryUseBytes -= backing->memorySizeBytes(); + allocator->deleteTexture(backing->id(), backing->size(), backing->format()); + if (backing->owner()) + backing->owner()->unlink(); + m_memoryUseBytes -= backing->bytes(); m_backings.remove(backing); delete backing; @@ -351,15 +329,15 @@ void CCPrioritizedTextureManager::assertInvariants() // Backings/textures must be doubly-linked and only to other backings/textures in this manager. for (BackingSet::iterator it = m_backings.begin(); it != m_backings.end(); ++it) { - if ((*it)->currentTexture()) { - ASSERT(m_textures.find((*it)->currentTexture()) != m_textures.end()); - ASSERT((*it)->currentTexture()->currentBacking() == (*it)); + if ((*it)->owner()) { + ASSERT(m_textures.find((*it)->owner()) != m_textures.end()); + ASSERT((*it)->owner()->backing() == (*it)); } } for (TextureSet::iterator it = m_textures.begin(); it != m_textures.end(); ++it) { - if ((*it)->currentBacking()) { - ASSERT(m_backings.find((*it)->currentBacking()) != m_backings.end()); - ASSERT((*it)->currentBacking()->currentTexture() == (*it)); + if ((*it)->backing()) { + ASSERT(m_backings.find((*it)->backing()) != m_backings.end()); + ASSERT((*it)->backing()->owner() == (*it)); } } @@ -368,10 +346,10 @@ void CCPrioritizedTextureManager::assertInvariants() // reduceMemory will not find all textures available for eviction/recycling). bool reachedProtected = false; for (BackingSet::iterator it = m_backings.begin(); it != m_backings.end(); ++it) { - if ((*it)->currentTexture() && (*it)->currentTexture()->isAbovePriorityCutoff()) + if ((*it)->owner() && (*it)->owner()->isAbovePriorityCutoff()) reachedProtected = true; if (reachedProtected) - ASSERT((*it)->currentTexture() && (*it)->currentTexture()->isAbovePriorityCutoff()); + ASSERT((*it)->owner() && (*it)->owner()->isAbovePriorityCutoff()); } } #endif diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCPrioritizedTextureManager.h b/Source/WebCore/platform/graphics/chromium/cc/CCPrioritizedTextureManager.h index 3c70b2b2a..019c45cf4 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCPrioritizedTextureManager.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCPrioritizedTextureManager.h @@ -27,10 +27,10 @@ #include "CCPrioritizedTexture.h" #include "CCPriorityCalculator.h" +#include "CCTexture.h" #include "GraphicsContext3D.h" #include "IntRect.h" #include "IntSize.h" -#include "TextureManager.h" namespace WebCore { @@ -50,18 +50,25 @@ public: } ~CCPrioritizedTextureManager(); + // FIXME (http://crbug.com/137094): This 64MB default is a straggler from the + // old texture manager and is just to give us a default memory allocation before + // we get a callback from the GPU memory manager. We should probaby either: + // - wait for the callback before rendering anything instead + // - push this into the GPU memory manager somehow. + static size_t defaultMemoryAllocationLimit() { return 64 * 1024 * 1024; } + // memoryUseBytes() describes the number of bytes used by existing allocated textures. // memoryAboveCutoffBytes() describes the number of bytes that would be used if all // textures that are above the cutoff were allocated. // memoryUseBytes() <= memoryAboveCutoffBytes() should always be true. size_t memoryUseBytes() const { return m_memoryUseBytes; } size_t memoryAboveCutoffBytes() const { return m_memoryAboveCutoffBytes; } - size_t memoryForRenderSurfacesBytes() const { return m_maxMemoryLimitBytes - m_memoryAvailableBytes; } + size_t memoryForSelfManagedTextures() const { return m_maxMemoryLimitBytes - m_memoryAvailableBytes; } void setMaxMemoryLimitBytes(size_t bytes) { m_maxMemoryLimitBytes = bytes; } size_t maxMemoryLimitBytes() const { return m_maxMemoryLimitBytes; } - void prioritizeTextures(size_t renderSurfacesMemoryBytes); + void prioritizeTextures(); void clearPriorities(); bool requestLate(CCPrioritizedTexture*); @@ -91,8 +98,8 @@ private: // Compare backings. Lowest priority first. static inline bool compareBackings(CCPrioritizedTexture::Backing* a, CCPrioritizedTexture::Backing* b) { - int priorityA = a->currentTexture() ? a->currentTexture()->requestPriority() : CCPriorityCalculator::lowestPriority(); - int priorityB = b->currentTexture() ? b->currentTexture()->requestPriority() : CCPriorityCalculator::lowestPriority(); + int priorityA = a->owner() ? a->owner()->requestPriority() : CCPriorityCalculator::lowestPriority(); + int priorityB = b->owner() ? b->owner()->requestPriority() : CCPriorityCalculator::lowestPriority(); if (priorityA == priorityB) return a < b; return CCPriorityCalculator::priorityIsLower(priorityA, priorityB); @@ -102,9 +109,6 @@ private: void reduceMemory(size_t limit, TextureAllocator*); - void link(CCPrioritizedTexture*, CCPrioritizedTexture::Backing*); - void unlink(CCPrioritizedTexture*, CCPrioritizedTexture::Backing*); - CCPrioritizedTexture::Backing* createBacking(IntSize, GC3Denum format, TextureAllocator*); void destroyBacking(CCPrioritizedTexture::Backing*, TextureAllocator*); diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCPriorityCalculator.h b/Source/WebCore/platform/graphics/chromium/cc/CCPriorityCalculator.h index 68a225be0..a90a07390 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCPriorityCalculator.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCPriorityCalculator.h @@ -28,7 +28,6 @@ #include "GraphicsContext3D.h" #include "IntRect.h" #include "IntSize.h" -#include "TextureManager.h" namespace WebCore { diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCRenderPass.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCRenderPass.cpp index 90a6ee60a..b11100af3 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCRenderPass.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCRenderPass.cpp @@ -72,7 +72,7 @@ void CCRenderPass::appendQuadsForRenderSurfaceLayer(CCLayerImpl* layer, const CC OwnPtr<CCSharedQuadState> sharedQuadState = surface->createSharedQuadState(); bool isReplica = false; - surface->appendQuads(quadCuller, sharedQuadState.get(), isReplica, contributingRenderPass); + surface->appendQuads(quadCuller, sharedQuadState.get(), isReplica, contributingRenderPass->id()); m_sharedQuadStateList.append(sharedQuadState.release()); if (!surface->hasReplica()) @@ -81,7 +81,7 @@ void CCRenderPass::appendQuadsForRenderSurfaceLayer(CCLayerImpl* layer, const CC // Add replica after the surface so that it appears below the surface. OwnPtr<CCSharedQuadState> replicaSharedQuadState = surface->createReplicaSharedQuadState(); isReplica = true; - surface->appendQuads(quadCuller, replicaSharedQuadState.get(), isReplica, contributingRenderPass); + surface->appendQuads(quadCuller, replicaSharedQuadState.get(), isReplica, contributingRenderPass->id()); m_sharedQuadStateList.append(replicaSharedQuadState.release()); } diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCRenderPass.h b/Source/WebCore/platform/graphics/chromium/cc/CCRenderPass.h index 47ae2f747..010a7674b 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCRenderPass.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCRenderPass.h @@ -27,16 +27,17 @@ #define CCRenderPass_h #include "SkColor.h" +#include "cc/CCDrawQuad.h" #include "cc/CCOcclusionTracker.h" +#include "cc/CCSharedQuadState.h" +#include <wtf/HashMap.h> #include <wtf/PassOwnPtr.h> #include <wtf/Vector.h> namespace WebCore { -class CCDrawQuad; class CCLayerImpl; class CCRenderSurface; -class CCSharedQuadState; // A list of CCDrawQuad objects, sorted internally in front-to-back order. class CCQuadList : public Vector<OwnPtr<CCDrawQuad> > { @@ -81,7 +82,8 @@ protected: bool m_hasTransparentBackground; }; -typedef Vector<OwnPtr<CCRenderPass> > CCRenderPassList; +typedef Vector<CCRenderPass*> CCRenderPassList; +typedef HashMap<int, OwnPtr<CCRenderPass> > CCRenderPassIdHashMap; } diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCRenderPassDrawQuad.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCRenderPassDrawQuad.cpp index 75bd761d1..59abfbbcc 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCRenderPassDrawQuad.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCRenderPassDrawQuad.cpp @@ -27,26 +27,32 @@ #include "cc/CCRenderPassDrawQuad.h" -#include "cc/CCRenderPass.h" +using WebKit::WebCompositorQuad; namespace WebCore { -PassOwnPtr<CCRenderPassDrawQuad> CCRenderPassDrawQuad::create(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect, const CCRenderPass* renderPass, bool isReplica, const WebKit::WebFilterOperations& filters, const WebKit::WebFilterOperations& backgroundFilters, unsigned maskTextureId, const IntRect& contentsChangedSinceLastFrame) +PassOwnPtr<CCRenderPassDrawQuad> CCRenderPassDrawQuad::create(const WebKit::WebCompositorSharedQuadState* sharedQuadState, const IntRect& quadRect, int renderPassId, bool isReplica, const WebKit::WebTransformationMatrix& drawTransform, const WebKit::WebFilterOperations& filters, const WebKit::WebFilterOperations& backgroundFilters, unsigned maskTextureId, const IntRect& contentsChangedSinceLastFrame) { - return adoptPtr(new CCRenderPassDrawQuad(sharedQuadState, quadRect, renderPass, isReplica, filters, backgroundFilters, maskTextureId, contentsChangedSinceLastFrame)); + return adoptPtr(new CCRenderPassDrawQuad(sharedQuadState, quadRect, renderPassId, isReplica, drawTransform, filters, backgroundFilters, maskTextureId, contentsChangedSinceLastFrame)); } -CCRenderPassDrawQuad::CCRenderPassDrawQuad(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect, const CCRenderPass* renderPass, bool isReplica, const WebKit::WebFilterOperations& filters, const WebKit::WebFilterOperations& backgroundFilters, unsigned maskTextureId, const IntRect& contentsChangedSinceLastFrame) - : CCDrawQuad(sharedQuadState, CCDrawQuad::RenderPass, quadRect) - , m_renderPass(renderPass) - , m_renderPassId(renderPass->id()) +CCRenderPassDrawQuad::CCRenderPassDrawQuad(const WebKit::WebCompositorSharedQuadState* sharedQuadState, const IntRect& quadRect, int renderPassId, bool isReplica, const WebKit::WebTransformationMatrix& drawTransform, const WebKit::WebFilterOperations& filters, const WebKit::WebFilterOperations& backgroundFilters, unsigned maskTextureId, const IntRect& contentsChangedSinceLastFrame) + : WebCompositorQuad(sharedQuadState, WebCompositorQuad::RenderPass, quadRect) + , m_renderPassId(renderPassId) , m_isReplica(isReplica) + , m_drawTransform(drawTransform) , m_filters(filters) , m_backgroundFilters(backgroundFilters) , m_maskTextureId(maskTextureId) , m_contentsChangedSinceLastFrame(contentsChangedSinceLastFrame) { - ASSERT(m_renderPass); + ASSERT(m_renderPassId > 0); +} + +const CCRenderPassDrawQuad* CCRenderPassDrawQuad::materialCast(const WebKit::WebCompositorQuad* quad) +{ + ASSERT(quad->material() == WebCompositorQuad::RenderPass); + return static_cast<const CCRenderPassDrawQuad*>(quad); } } diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCRenderPassDrawQuad.h b/Source/WebCore/platform/graphics/chromium/cc/CCRenderPassDrawQuad.h index b63a76446..a12f204ca 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCRenderPassDrawQuad.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCRenderPassDrawQuad.h @@ -26,34 +26,38 @@ #ifndef CCRenderPassDrawQuad_h #define CCRenderPassDrawQuad_h -#include "cc/CCDrawQuad.h" +#include <public/WebCompositorQuad.h> #include <public/WebFilterOperations.h> +#include <public/WebTransformationMatrix.h> #include <wtf/PassOwnPtr.h> namespace WebCore { class CCRenderPass; -class CCRenderPassDrawQuad : public CCDrawQuad { +class CCRenderPassDrawQuad : public WebKit::WebCompositorQuad { WTF_MAKE_NONCOPYABLE(CCRenderPassDrawQuad); public: - static PassOwnPtr<CCRenderPassDrawQuad> create(const CCSharedQuadState*, const IntRect&, const CCRenderPass*, bool isReplica, const WebKit::WebFilterOperations& filters, const WebKit::WebFilterOperations& backgroundFilters, unsigned maskTextureId, const IntRect& contentsChangedSinceLastFrame); + static PassOwnPtr<CCRenderPassDrawQuad> create(const WebKit::WebCompositorSharedQuadState*, const IntRect&, int renderPassId, bool isReplica, const WebKit::WebTransformationMatrix&, const WebKit::WebFilterOperations& filters, const WebKit::WebFilterOperations& backgroundFilters, unsigned maskTextureId, const IntRect& contentsChangedSinceLastFrame); - const CCRenderPass* renderPass() const { return m_renderPass; } int renderPassId() const { return m_renderPassId; } bool isReplica() const { return m_isReplica; } unsigned maskTextureId() const { return m_maskTextureId; } const IntRect& contentsChangedSinceLastFrame() const { return m_contentsChangedSinceLastFrame; } + // FIXME: This should be removed and we should draw the RenderPass with the quadTransform. + const WebKit::WebTransformationMatrix& drawTransform() const { return m_drawTransform; } + const WebKit::WebFilterOperations& filters() const { return m_filters; } const WebKit::WebFilterOperations& backgroundFilters() const { return m_backgroundFilters; } + static const CCRenderPassDrawQuad* materialCast(const WebKit::WebCompositorQuad*); private: - CCRenderPassDrawQuad(const CCSharedQuadState*, const IntRect&, const CCRenderPass*, bool isReplica, const WebKit::WebFilterOperations& filters, const WebKit::WebFilterOperations& backgroundFilters, unsigned maskTextureId, const IntRect& contentsChangedSinceLastFrame); + CCRenderPassDrawQuad(const WebKit::WebCompositorSharedQuadState*, const IntRect&, int renderPassId, bool isReplica, const WebKit::WebTransformationMatrix&, const WebKit::WebFilterOperations& filters, const WebKit::WebFilterOperations& backgroundFilters, unsigned maskTextureId, const IntRect& contentsChangedSinceLastFrame); - const CCRenderPass* m_renderPass; int m_renderPassId; bool m_isReplica; + WebKit::WebTransformationMatrix m_drawTransform; WebKit::WebFilterOperations m_filters; WebKit::WebFilterOperations m_backgroundFilters; unsigned m_maskTextureId; diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurface.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurface.cpp index d3a85d2da..8bd46bf00 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurface.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurface.cpp @@ -188,13 +188,13 @@ bool CCRenderSurface::surfacePropertyChangedOnlyFromDescendant() const PassOwnPtr<CCSharedQuadState> CCRenderSurface::createSharedQuadState() const { bool isOpaque = false; - return CCSharedQuadState::create(originTransform(), drawTransform(), contentRect(), m_scissorRect, drawOpacity(), isOpaque); + return CCSharedQuadState::create(m_originTransform, m_contentRect, m_scissorRect, m_drawOpacity, isOpaque); } PassOwnPtr<CCSharedQuadState> CCRenderSurface::createReplicaSharedQuadState() const { bool isOpaque = false; - return CCSharedQuadState::create(replicaOriginTransform(), replicaDrawTransform(), contentRect(), m_scissorRect, drawOpacity(), isOpaque); + return CCSharedQuadState::create(m_replicaOriginTransform, m_contentRect, m_scissorRect, m_drawOpacity, isOpaque); } FloatRect CCRenderSurface::computeRootScissorRectInCurrentSurface(const FloatRect& rootScissorRect) const @@ -203,7 +203,7 @@ FloatRect CCRenderSurface::computeRootScissorRectInCurrentSurface(const FloatRec return CCMathUtil::projectClippedRect(inverseScreenSpaceTransform, rootScissorRect); } -void CCRenderSurface::appendQuads(CCQuadCuller& quadList, CCSharedQuadState* sharedQuadState, bool forReplica, const CCRenderPass* renderPass) +void CCRenderSurface::appendQuads(CCQuadCuller& quadList, CCSharedQuadState* sharedQuadState, bool forReplica, int renderPassId) { ASSERT(!forReplica || hasReplica()); @@ -232,9 +232,10 @@ void CCRenderSurface::appendQuads(CCQuadCuller& quadList, CCSharedQuadState* sha } int maskTextureId = maskLayer ? maskLayer->contentsTextureId() : 0; + WebTransformationMatrix drawTransform = forReplica ? m_replicaDrawTransform : m_drawTransform; IntRect contentsChangedSinceLastFrame = contentsChanged() ? m_contentRect : IntRect(); - quadList.appendSurface(CCRenderPassDrawQuad::create(sharedQuadState, contentRect(), renderPass, forReplica, filters(), backgroundFilters(), maskTextureId, contentsChangedSinceLastFrame)); + quadList.appendSurface(CCRenderPassDrawQuad::create(sharedQuadState, contentRect(), renderPassId, forReplica, drawTransform, filters(), backgroundFilters(), maskTextureId, contentsChangedSinceLastFrame)); } } diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurface.h b/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurface.h index 894ea5aea..5410befed 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurface.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCRenderSurface.h @@ -31,6 +31,7 @@ #include "FloatRect.h" #include "IntRect.h" +#include "cc/CCSharedQuadState.h" #include <public/WebFilterOperations.h> #include <public/WebTransformationMatrix.h> #include <wtf/Noncopyable.h> @@ -41,7 +42,6 @@ namespace WebCore { class CCDamageTracker; class CCQuadCuller; class CCRenderPass; -class CCSharedQuadState; class CCLayerImpl; class LayerRendererChromium; class TextStream; @@ -130,7 +130,7 @@ public: PassOwnPtr<CCSharedQuadState> createSharedQuadState() const; PassOwnPtr<CCSharedQuadState> createReplicaSharedQuadState() const; - void appendQuads(CCQuadCuller&, CCSharedQuadState*, bool forReplica, const CCRenderPass*); + void appendQuads(CCQuadCuller&, CCSharedQuadState*, bool forReplica, int renderPassId); FloatRect computeRootScissorRectInCurrentSurface(const FloatRect& rootScissorRect) const; diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCScopedTexture.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCScopedTexture.cpp index 80f831541..b9f75d184 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCScopedTexture.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCScopedTexture.cpp @@ -24,10 +24,9 @@ */ #include "config.h" - #include "cc/CCScopedTexture.h" -#include "TextureManager.h" // For TextureAllocator +#include "TextureAllocator.h" namespace WebCore { diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCScopedTexture.h b/Source/WebCore/platform/graphics/chromium/cc/CCScopedTexture.h index 5a3c4e964..9f7241f51 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCScopedTexture.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCScopedTexture.h @@ -26,6 +26,7 @@ #ifndef CCScopedTexture_h #define CCScopedTexture_h +#include "TextureAllocator.h" #include "cc/CCTexture.h" #if !ASSERT_DISABLED @@ -34,7 +35,6 @@ namespace WebCore { -class TextureAllocator; class CCScopedTexture : protected CCTexture { WTF_MAKE_NONCOPYABLE(CCScopedTexture); diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCSharedQuadState.h b/Source/WebCore/platform/graphics/chromium/cc/CCSharedQuadState.h index 4540a06f8..79036ddd4 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCSharedQuadState.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCSharedQuadState.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011 Google Inc. All rights reserved. + * Copyright (C) 2012 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -26,40 +26,10 @@ #ifndef CCSharedQuadState_h #define CCSharedQuadState_h -#include "FloatQuad.h" -#include "IntRect.h" -#include <public/WebTransformationMatrix.h> -#include <wtf/PassOwnPtr.h> +#include <public/WebCompositorSharedQuadState.h> namespace WebCore { - -class CCSharedQuadState { - WTF_MAKE_NONCOPYABLE(CCSharedQuadState); -public: - static PassOwnPtr<CCSharedQuadState> create(const WebKit::WebTransformationMatrix& quadTransform, const WebKit::WebTransformationMatrix& layerTransform, const IntRect& layerRect, const IntRect& scissorRect, float opacity, bool opaque); - - // The transform that quads in a CCDrawQuad should be transformed with. - const WebKit::WebTransformationMatrix& quadTransform() const { return m_quadTransform; } - // The transform that layerRect() should be transformed with. - const WebKit::WebTransformationMatrix& layerTransform() const { return m_layerTransform; } - const IntRect& layerRect() const { return m_layerRect; } - const IntRect& scissorRect() const { return m_scissorRect; } - - float opacity() const { return m_opacity; } - bool isOpaque() const { return m_opaque; } - bool isLayerAxisAlignedIntRect() const; - -private: - CCSharedQuadState(const WebKit::WebTransformationMatrix& quadTransform, const WebKit::WebTransformationMatrix& layerTransform, const IntRect& layerRect, const IntRect& scissorRect, float opacity, bool opaque); - - WebKit::WebTransformationMatrix m_quadTransform; - WebKit::WebTransformationMatrix m_layerTransform; - IntRect m_layerRect; - IntRect m_scissorRect; - float m_opacity; - bool m_opaque; -}; - +typedef WebKit::WebCompositorSharedQuadState CCSharedQuadState; } #endif diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCSolidColorDrawQuad.h b/Source/WebCore/platform/graphics/chromium/cc/CCSolidColorDrawQuad.h index 83ea34066..b6c0ee025 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCSolidColorDrawQuad.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCSolidColorDrawQuad.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011 Google Inc. All rights reserved. + * Copyright (C) 2012 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -26,25 +26,10 @@ #ifndef CCSolidColorDrawQuad_h #define CCSolidColorDrawQuad_h -#include "SkColor.h" -#include "cc/CCDrawQuad.h" -#include <wtf/PassOwnPtr.h> +#include <public/WebCompositorSolidColorQuad.h> namespace WebCore { - -class CCSolidColorDrawQuad : public CCDrawQuad { - WTF_MAKE_NONCOPYABLE(CCSolidColorDrawQuad); -public: - static PassOwnPtr<CCSolidColorDrawQuad> create(const CCSharedQuadState*, const IntRect&, SkColor); - - SkColor color() const { return m_color; }; - -private: - CCSolidColorDrawQuad(const CCSharedQuadState*, const IntRect&, SkColor); - - SkColor m_color; -}; - +typedef WebKit::WebCompositorSolidColorQuad CCSolidColorDrawQuad; } #endif diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCStreamVideoDrawQuad.h b/Source/WebCore/platform/graphics/chromium/cc/CCStreamVideoDrawQuad.h index 3037348d3..a1890611a 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCStreamVideoDrawQuad.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCStreamVideoDrawQuad.h @@ -26,27 +26,10 @@ #ifndef CCStreamVideoDrawQuad_h #define CCStreamVideoDrawQuad_h -#include "cc/CCDrawQuad.h" -#include <public/WebTransformationMatrix.h> -#include <wtf/PassOwnPtr.h> +#include <public/WebCompositorStreamVideoQuad.h> namespace WebCore { - -class CCStreamVideoDrawQuad : public CCDrawQuad { - WTF_MAKE_NONCOPYABLE(CCStreamVideoDrawQuad); -public: - static PassOwnPtr<CCStreamVideoDrawQuad> create(const CCSharedQuadState*, const IntRect&, unsigned textureId, const WebKit::WebTransformationMatrix&); - - unsigned textureId() const { return m_textureId; } - const WebKit::WebTransformationMatrix& matrix() const { return m_matrix; } - -private: - CCStreamVideoDrawQuad(const CCSharedQuadState*, const IntRect&, unsigned textureId, const WebKit::WebTransformationMatrix&); - - unsigned m_textureId; - WebKit::WebTransformationMatrix m_matrix; -}; - +typedef WebKit::WebCompositorStreamVideoQuad CCStreamVideoDrawQuad; } #endif diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCTexture.h b/Source/WebCore/platform/graphics/chromium/cc/CCTexture.h index a29610469..0d5d9f768 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCTexture.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCTexture.h @@ -35,6 +35,10 @@ namespace WebCore { class CCTexture { public: CCTexture() : m_id(0) { } + CCTexture(unsigned id, IntSize size, GC3Denum format) + : m_id(id) + , m_size(size) + , m_format(format) { } unsigned id() const { return m_id; } const IntSize& size() const { return m_size; } diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCTextureDrawQuad.h b/Source/WebCore/platform/graphics/chromium/cc/CCTextureDrawQuad.h index a4baefa13..28c3d9132 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCTextureDrawQuad.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCTextureDrawQuad.h @@ -26,32 +26,10 @@ #ifndef CCTextureDrawQuad_h #define CCTextureDrawQuad_h -#include "cc/CCDrawQuad.h" -#include <wtf/PassOwnPtr.h> +#include <public/WebCompositorTextureQuad.h> namespace WebCore { - -class CCTextureDrawQuad : public CCDrawQuad { - WTF_MAKE_NONCOPYABLE(CCTextureDrawQuad); -public: - static PassOwnPtr<CCTextureDrawQuad> create(const CCSharedQuadState*, const IntRect&, unsigned textureId, bool premultipliedAlpha, const FloatRect& uvRect, bool flipped); - - unsigned textureId() const { return m_textureId; } - bool premultipliedAlpha() const { return m_premultipliedAlpha; } - FloatRect uvRect() const { return m_uvRect; } - bool flipped() const { return m_flipped; } - - void setNeedsBlending(); - -private: - CCTextureDrawQuad(const CCSharedQuadState*, const IntRect&, unsigned texture_id, bool premultipliedAlpha, const FloatRect& uvRect, bool flipped); - - unsigned m_textureId; - bool m_premultipliedAlpha; - FloatRect m_uvRect; - bool m_flipped; -}; - +typedef WebKit::WebCompositorTextureQuad CCTextureDrawQuad; } #endif diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCTextureUpdater.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCTextureUpdater.cpp index 3190d82ff..bc1ed75af 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCTextureUpdater.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCTextureUpdater.cpp @@ -39,6 +39,8 @@ using namespace std; namespace WebCore { +static const int kUploadFlushPeriod = 4; + CCTextureUpdater::CCTextureUpdater() : m_entryIndex(0) { @@ -93,12 +95,20 @@ void CCTextureUpdater::update(CCGraphicsContext* context, TextureAllocator* allo uploader->beginUploads(); + int fullUploadCount = 0; size_t maxIndex = min(m_entryIndex + count, m_fullEntries.size()); for (index = m_entryIndex; index < maxIndex; ++index) { UpdateEntry& entry = m_fullEntries[index]; uploader->uploadTexture(context, entry.texture, allocator, entry.sourceRect, entry.destRect); + fullUploadCount++; + if (!(fullUploadCount % kUploadFlushPeriod)) + context->flush(); } + // Make sure there are no dangling uploads without a flush. + if (fullUploadCount % kUploadFlushPeriod) + context->flush(); + bool moreUploads = maxIndex < m_fullEntries.size(); ASSERT(m_partialEntries.size() <= count); @@ -116,8 +126,16 @@ void CCTextureUpdater::update(CCGraphicsContext* context, TextureAllocator* allo for (index = 0; index < m_partialEntries.size(); ++index) { UpdateEntry& entry = m_partialEntries[index]; uploader->uploadTexture(context, entry.texture, allocator, entry.sourceRect, entry.destRect); + if (!((index+1) % kUploadFlushPeriod)) + context->flush(); } + // Make sure there are no dangling partial uploads without a flush. + // Note: We don't need to use (index+1) in this case because index was + // incremented at the end of the for loop. + if (index % kUploadFlushPeriod) + context->flush(); + uploader->endUploads(); } diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCTileDrawQuad.h b/Source/WebCore/platform/graphics/chromium/cc/CCTileDrawQuad.h index 33501a806..d530f4a48 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCTileDrawQuad.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCTileDrawQuad.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011 Google Inc. All rights reserved. + * Copyright (C) 2012 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -26,44 +26,10 @@ #ifndef CCTileDrawQuad_h #define CCTileDrawQuad_h -#include "GraphicsTypes3D.h" -#include "cc/CCDrawQuad.h" -#include <wtf/PassOwnPtr.h> +#include <public/WebCompositorTileQuad.h> namespace WebCore { - -class CCTileDrawQuad : public CCDrawQuad { - WTF_MAKE_NONCOPYABLE(CCTileDrawQuad); -public: - static PassOwnPtr<CCTileDrawQuad> create(const CCSharedQuadState*, const IntRect& quadRect, const IntRect& opaqueRect, Platform3DObject textureId, const IntPoint& textureOffset, const IntSize& textureSize, GC3Dint textureFilter, bool swizzleContents, bool leftEdgeAA, bool topEdgeAA, bool rightEdgeAA, bool bottomEdgeAA); - - Platform3DObject textureId() const { return m_textureId; } - IntPoint textureOffset() const { return m_textureOffset; } - IntSize textureSize() const { return m_textureSize; } - GC3Dint textureFilter() const { return m_textureFilter; } - bool swizzleContents() const { return m_swizzleContents; } - - bool leftEdgeAA() const { return m_leftEdgeAA; } - bool topEdgeAA() const { return m_topEdgeAA; } - bool rightEdgeAA() const { return m_rightEdgeAA; } - bool bottomEdgeAA() const { return m_bottomEdgeAA; } - - bool isAntialiased() const { return leftEdgeAA() || topEdgeAA() || rightEdgeAA() || bottomEdgeAA(); } - -private: - CCTileDrawQuad(const CCSharedQuadState*, const IntRect& quadRect, const IntRect& opaqueRect, Platform3DObject textureId, const IntPoint& textureOffset, const IntSize& textureSize, GC3Dint textureFilter, bool swizzleContents, bool leftEdgeAA, bool topEdgeAA, bool rightEdgeAA, bool bottomEdgeAA); - - Platform3DObject m_textureId; - IntPoint m_textureOffset; - IntSize m_textureSize; - GC3Dint m_textureFilter; - bool m_swizzleContents; - bool m_leftEdgeAA; - bool m_topEdgeAA; - bool m_rightEdgeAA; - bool m_bottomEdgeAA; -}; - +typedef WebKit::WebCompositorTileQuad CCTileDrawQuad; } #endif diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCTiledLayerImpl.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCTiledLayerImpl.cpp index 564e3696b..1b2108912 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCTiledLayerImpl.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCTiledLayerImpl.cpp @@ -54,8 +54,6 @@ static const int debugTileBorderMissingTileColorRed = 255; static const int debugTileBorderMissingTileColorGreen = 0; static const int debugTileBorderMissingTileColorBlue = 0; -class ManagedTexture; - class DrawableTile : public CCLayerTilingData::Tile { WTF_MAKE_NONCOPYABLE(DrawableTile); public: @@ -142,13 +140,13 @@ WebTransformationMatrix CCTiledLayerImpl::quadTransform() const void CCTiledLayerImpl::appendQuads(CCQuadCuller& quadList, const CCSharedQuadState* sharedQuadState, bool& hadMissingTiles) { - const IntRect& layerRect = visibleLayerRect(); + const IntRect& contentRect = visibleContentRect(); - if (!m_tiler || m_tiler->hasEmptyBounds() || layerRect.isEmpty()) + if (!m_tiler || m_tiler->hasEmptyBounds() || contentRect.isEmpty()) return; int left, top, right, bottom; - m_tiler->layerRectToTileIndices(layerRect, left, top, right, bottom); + m_tiler->contentRectToTileIndices(contentRect, left, top, right, bottom); if (hasDebugBorders()) { for (int j = top; j <= bottom; ++j) { @@ -174,7 +172,7 @@ void CCTiledLayerImpl::appendQuads(CCQuadCuller& quadList, const CCSharedQuadSta DrawableTile* tile = tileAt(i, j); IntRect tileRect = m_tiler->tileBounds(i, j); IntRect displayRect = tileRect; - tileRect.intersect(layerRect); + tileRect.intersect(contentRect); // Skip empty tiles. if (tileRect.isEmpty()) @@ -189,7 +187,7 @@ void CCTiledLayerImpl::appendQuads(CCQuadCuller& quadList, const CCSharedQuadSta } IntRect tileOpaqueRect = tile->opaqueRect(); - tileOpaqueRect.intersect(layerRect); + tileOpaqueRect.intersect(contentRect); // Keep track of how the top left has moved, so the texture can be // offset the same amount. @@ -235,8 +233,8 @@ Region CCTiledLayerImpl::visibleContentOpaqueRegion() const if (m_skipsDraw) return Region(); if (opaque()) - return visibleLayerRect(); - return m_tiler->opaqueRegionInLayerRect(visibleLayerRect()); + return visibleContentRect(); + return m_tiler->opaqueRegionInContentRect(visibleContentRect()); } void CCTiledLayerImpl::didLoseContext() diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.cpp index 3e1f58135..cc349c8e5 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.cpp @@ -35,7 +35,7 @@ #include "LayerTextureSubImage.h" #include "NotImplemented.h" #include "TextStream.h" -#include "TextureManager.h" // For TextureAllocator +#include "TextureAllocator.h" #include "cc/CCGraphicsContext.h" #include "cc/CCLayerTreeHostImpl.h" #include "cc/CCProxy.h" diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.h b/Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.h index b2e088fcf..cd5db09bc 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011 Google Inc. All rights reserved. + * Copyright (C) 2012 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCYUVVideoDrawQuad.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCYUVVideoDrawQuad.cpp index a2d62ba44..43f2e2f6f 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCYUVVideoDrawQuad.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCYUVVideoDrawQuad.cpp @@ -27,19 +27,27 @@ #include "cc/CCYUVVideoDrawQuad.h" +using WebKit::WebCompositorQuad; + namespace WebCore { -PassOwnPtr<CCYUVVideoDrawQuad> CCYUVVideoDrawQuad::create(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect, const CCVideoLayerImpl::FramePlane& yPlane, const CCVideoLayerImpl::FramePlane& uPlane, const CCVideoLayerImpl::FramePlane& vPlane) +PassOwnPtr<CCYUVVideoDrawQuad> CCYUVVideoDrawQuad::create(const WebKit::WebCompositorSharedQuadState* sharedQuadState, const IntRect& quadRect, const CCVideoLayerImpl::FramePlane& yPlane, const CCVideoLayerImpl::FramePlane& uPlane, const CCVideoLayerImpl::FramePlane& vPlane) { return adoptPtr(new CCYUVVideoDrawQuad(sharedQuadState, quadRect, yPlane, uPlane, vPlane)); } -CCYUVVideoDrawQuad::CCYUVVideoDrawQuad(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect, const CCVideoLayerImpl::FramePlane& yPlane, const CCVideoLayerImpl::FramePlane& uPlane, const CCVideoLayerImpl::FramePlane& vPlane) - : CCDrawQuad(sharedQuadState, CCDrawQuad::YUVVideoContent, quadRect) +CCYUVVideoDrawQuad::CCYUVVideoDrawQuad(const WebKit::WebCompositorSharedQuadState* sharedQuadState, const IntRect& quadRect, const CCVideoLayerImpl::FramePlane& yPlane, const CCVideoLayerImpl::FramePlane& uPlane, const CCVideoLayerImpl::FramePlane& vPlane) + : WebCompositorQuad(sharedQuadState, WebCompositorQuad::YUVVideoContent, quadRect) , m_yPlane(yPlane) , m_uPlane(uPlane) , m_vPlane(vPlane) { } +const CCYUVVideoDrawQuad* CCYUVVideoDrawQuad::materialCast(const WebKit::WebCompositorQuad* quad) +{ + ASSERT(quad->material() == WebCompositorQuad::YUVVideoContent); + return static_cast<const CCYUVVideoDrawQuad*>(quad); +} + } diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCYUVVideoDrawQuad.h b/Source/WebCore/platform/graphics/chromium/cc/CCYUVVideoDrawQuad.h index 0cd758c5b..6684ad897 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCYUVVideoDrawQuad.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCYUVVideoDrawQuad.h @@ -26,23 +26,24 @@ #ifndef CCYUVVideoDrawQuad_h #define CCYUVVideoDrawQuad_h -#include "cc/CCDrawQuad.h" #include "cc/CCVideoLayerImpl.h" +#include <public/WebCompositorQuad.h> #include <wtf/PassOwnPtr.h> namespace WebCore { -class CCYUVVideoDrawQuad : public CCDrawQuad { +class CCYUVVideoDrawQuad : public WebKit::WebCompositorQuad { WTF_MAKE_NONCOPYABLE(CCYUVVideoDrawQuad); public: - static PassOwnPtr<CCYUVVideoDrawQuad> create(const CCSharedQuadState*, const IntRect&, const CCVideoLayerImpl::FramePlane& yPlane, const CCVideoLayerImpl::FramePlane& uPlane, const CCVideoLayerImpl::FramePlane& vPlane); + static PassOwnPtr<CCYUVVideoDrawQuad> create(const WebKit::WebCompositorSharedQuadState*, const IntRect&, const CCVideoLayerImpl::FramePlane& yPlane, const CCVideoLayerImpl::FramePlane& uPlane, const CCVideoLayerImpl::FramePlane& vPlane); const CCVideoLayerImpl::FramePlane& yPlane() const { return m_yPlane; } const CCVideoLayerImpl::FramePlane& uPlane() const { return m_uPlane; } const CCVideoLayerImpl::FramePlane& vPlane() const { return m_vPlane; } + static const CCYUVVideoDrawQuad* materialCast(const WebKit::WebCompositorQuad*); private: - CCYUVVideoDrawQuad(const CCSharedQuadState*, const IntRect&, const CCVideoLayerImpl::FramePlane& yPlane, const CCVideoLayerImpl::FramePlane& uPlane, const CCVideoLayerImpl::FramePlane& vPlane); + CCYUVVideoDrawQuad(const WebKit::WebCompositorSharedQuadState*, const IntRect&, const CCVideoLayerImpl::FramePlane& yPlane, const CCVideoLayerImpl::FramePlane& uPlane, const CCVideoLayerImpl::FramePlane& vPlane); CCVideoLayerImpl::FramePlane m_yPlane; CCVideoLayerImpl::FramePlane m_uPlane; diff --git a/Source/WebCore/platform/graphics/cocoa/FontPlatformDataCocoa.mm b/Source/WebCore/platform/graphics/cocoa/FontPlatformDataCocoa.mm index f30b181f6..fbfe6379f 100644 --- a/Source/WebCore/platform/graphics/cocoa/FontPlatformDataCocoa.mm +++ b/Source/WebCore/platform/graphics/cocoa/FontPlatformDataCocoa.mm @@ -59,13 +59,13 @@ FontPlatformData::FontPlatformData(NSFont *nsFont, float size, bool isPrinterFon CGFontRef cgFont = 0; loadFont(nsFont, size, m_font, cgFont); -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 // FIXME: Chromium: The following code isn't correct for the Chromium port since the sandbox might // have blocked font loading, in which case we'll only have the real loaded font file after the call to loadFont(). { CTFontSymbolicTraits traits = CTFontGetSymbolicTraits(toCTFontRef(m_font)); m_isColorBitmapFont = traits & kCTFontColorGlyphsTrait; -#if !defined(BUILDING_ON_SNOW_LEOPARD) && !defined(BUILDING_ON_LION) && !PLATFORM(IOS) +#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 m_isCompositeFontReference = traits & kCTFontCompositeTrait; #endif } @@ -150,11 +150,11 @@ void FontPlatformData::setFont(NSFont *font) #endif m_cgFont.adoptCF(cgFont); -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 { CTFontSymbolicTraits traits = CTFontGetSymbolicTraits(toCTFontRef(m_font)); m_isColorBitmapFont = traits & kCTFontColorGlyphsTrait; -#if !defined(BUILDING_ON_SNOW_LEOPARD) && !defined(BUILDING_ON_LION) +#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 m_isCompositeFontReference = traits & kCTFontCompositeTrait; #endif } @@ -251,7 +251,7 @@ static bool canSetCascadeListForCustomFont() } return systemVersion >= 0x1060; -#elif !defined(BUILDING_ON_LEOPARD) +#elif PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 return true; #else return false; diff --git a/Source/WebCore/platform/graphics/filters/FEBlend.cpp b/Source/WebCore/platform/graphics/filters/FEBlend.cpp index aa733d90f..363a75b7f 100644 --- a/Source/WebCore/platform/graphics/filters/FEBlend.cpp +++ b/Source/WebCore/platform/graphics/filters/FEBlend.cpp @@ -24,6 +24,7 @@ #if ENABLE(FILTERS) #include "FEBlend.h" +#include "FEBlendNEON.h" #include "Filter.h" #include "FloatPoint.h" @@ -86,26 +87,12 @@ static inline unsigned char lighten(unsigned char colorA, unsigned char colorB, return ((std::max((255 - alphaA) * colorB + colorA * 255, (255 - alphaB) * colorA + colorB * 255)) / 255); } -void FEBlend::platformApplySoftware() +void FEBlend::platformApplyGeneric(PassRefPtr<Uint8ClampedArray> pixelArrayA, PassRefPtr<Uint8ClampedArray> pixelArrayB, + Uint8ClampedArray* dstPixelArray, unsigned pixelArrayLength) { - FilterEffect* in = inputEffect(0); - FilterEffect* in2 = inputEffect(1); - - ASSERT(m_mode > FEBLEND_MODE_UNKNOWN); - ASSERT(m_mode <= FEBLEND_MODE_LIGHTEN); + RefPtr<Uint8ClampedArray> srcPixelArrayA = pixelArrayA; + RefPtr<Uint8ClampedArray> srcPixelArrayB = pixelArrayB; - Uint8ClampedArray* dstPixelArray = createPremultipliedImageResult(); - if (!dstPixelArray) - return; - - IntRect effectADrawingRect = requestedRegionOfInputImageData(in->absolutePaintRect()); - RefPtr<Uint8ClampedArray> srcPixelArrayA = in->asPremultipliedImage(effectADrawingRect); - - IntRect effectBDrawingRect = requestedRegionOfInputImageData(in2->absolutePaintRect()); - RefPtr<Uint8ClampedArray> srcPixelArrayB = in2->asPremultipliedImage(effectBDrawingRect); - - unsigned pixelArrayLength = srcPixelArrayA->length(); - ASSERT(pixelArrayLength == srcPixelArrayB->length()); for (unsigned pixelOffset = 0; pixelOffset < pixelArrayLength; pixelOffset += 4) { unsigned char alphaA = srcPixelArrayA->item(pixelOffset + 3); unsigned char alphaB = srcPixelArrayB->item(pixelOffset + 3); @@ -143,6 +130,45 @@ void FEBlend::platformApplySoftware() } } +void FEBlend::platformApplySoftware() +{ + FilterEffect* in = inputEffect(0); + FilterEffect* in2 = inputEffect(1); + + ASSERT(m_mode > FEBLEND_MODE_UNKNOWN); + ASSERT(m_mode <= FEBLEND_MODE_LIGHTEN); + + Uint8ClampedArray* dstPixelArray = createPremultipliedImageResult(); + if (!dstPixelArray) + return; + + IntRect effectADrawingRect = requestedRegionOfInputImageData(in->absolutePaintRect()); + RefPtr<Uint8ClampedArray> srcPixelArrayA = in->asPremultipliedImage(effectADrawingRect); + + IntRect effectBDrawingRect = requestedRegionOfInputImageData(in2->absolutePaintRect()); + RefPtr<Uint8ClampedArray> srcPixelArrayB = in2->asPremultipliedImage(effectBDrawingRect); + + unsigned pixelArrayLength = srcPixelArrayA->length(); + ASSERT(pixelArrayLength == srcPixelArrayB->length()); + +#if HAVE(ARM_NEON_INTRINSICS) + if (pixelArrayLength >= 8) + platformApplyNEON(srcPixelArrayA->data(), srcPixelArrayB->data(), dstPixelArray->data(), pixelArrayLength); + else { // If there is just one pixel we expand it to two. + ASSERT(pixelArrayLength > 0); + uint32_t sourceA[2] = {0, 0}; + uint32_t sourceBAndDest[2] = {0, 0}; + + sourceA[0] = reinterpret_cast<uint32_t*>(srcPixelArrayA->data())[0]; + sourceBAndDest[0] = reinterpret_cast<uint32_t*>(srcPixelArrayB->data())[0]; + platformApplyNEON(reinterpret_cast<uint8_t*>(sourceA), reinterpret_cast<uint8_t*>(sourceBAndDest), reinterpret_cast<uint8_t*>(sourceBAndDest), 8); + reinterpret_cast<uint32_t*>(dstPixelArray->data())[0] = sourceBAndDest[0]; + } +#else + platformApplyGeneric(srcPixelArrayA, srcPixelArrayB, dstPixelArray, pixelArrayLength); +#endif +} + void FEBlend::dump() { } diff --git a/Source/WebCore/platform/graphics/filters/FEBlend.h b/Source/WebCore/platform/graphics/filters/FEBlend.h index 68cd1d37a..cc72e4aca 100644 --- a/Source/WebCore/platform/graphics/filters/FEBlend.h +++ b/Source/WebCore/platform/graphics/filters/FEBlend.h @@ -45,6 +45,11 @@ public: BlendModeType blendMode() const; bool setBlendMode(BlendModeType); + void platformApplyGeneric(PassRefPtr<Uint8ClampedArray> pixelArrayA, PassRefPtr<Uint8ClampedArray> pixelArrayB, + Uint8ClampedArray* dstPixelArray, unsigned pixelArrayLength); + void platformApplyNEON(unsigned char* srcPixelArrayA, unsigned char* srcPixelArrayB, unsigned char* dstPixelArray, + unsigned colorArrayLength); + virtual void platformApplySoftware(); virtual void dump(); diff --git a/Source/WebCore/platform/graphics/filters/arm/FEBlendNEON.h b/Source/WebCore/platform/graphics/filters/arm/FEBlendNEON.h new file mode 100644 index 000000000..97418f2c1 --- /dev/null +++ b/Source/WebCore/platform/graphics/filters/arm/FEBlendNEON.h @@ -0,0 +1,175 @@ +/* + * Copyright (C) 2012 University of Szeged + * Copyright (C) 2012 Gabor Rapcsanyi + * + * 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 UNIVERSITY OF SZEGED ``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 UNIVERSITY OF SZEGED 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 FEBlendNEON_h +#define FEBlendNEON_h + +#include <wtf/Platform.h> + +#if ENABLE(FILTERS) && HAVE(ARM_NEON_INTRINSICS) + +#include "FEBlend.h" +#include <arm_neon.h> + +namespace WebCore { + +class FEBlendUtilitiesNEON { +public: + static inline uint16x8_t div255(uint16x8_t num, uint16x8_t sixteenConst255, uint16x8_t sixteenConstOne) + { + uint16x8_t quotient = vshrq_n_u16(num, 8); + uint16x8_t remainder = vaddq_u16(vsubq_u16(num, vmulq_u16(sixteenConst255, quotient)), sixteenConstOne); + return vaddq_u16(quotient, vshrq_n_u16(remainder, 8)); + } + + static inline uint16x8_t normal(uint16x8_t pixelA, uint16x8_t pixelB, uint16x8_t alphaA, uint16x8_t, + uint16x8_t sixteenConst255, uint16x8_t sixteenConstOne) + { + uint16x8_t tmp1 = vsubq_u16(sixteenConst255, alphaA); + uint16x8_t tmp2 = vmulq_u16(tmp1, pixelB); + uint16x8_t tmp3 = div255(tmp2, sixteenConst255, sixteenConstOne); + return vaddq_u16(tmp3, pixelA); + } + + static inline uint16x8_t multiply(uint16x8_t pixelA, uint16x8_t pixelB, uint16x8_t alphaA, uint16x8_t alphaB, + uint16x8_t sixteenConst255, uint16x8_t sixteenConstOne) + { + uint16x8_t tmp1 = vsubq_u16(sixteenConst255, alphaA); + uint16x8_t tmp2 = vmulq_u16(tmp1, pixelB); + uint16x8_t tmp3 = vaddq_u16(vsubq_u16(sixteenConst255, alphaB), pixelB); + uint16x8_t tmp4 = vmulq_u16(tmp3, pixelA); + uint16x8_t tmp5 = vaddq_u16(tmp2, tmp4); + return div255(tmp5, sixteenConst255, sixteenConstOne); + } + + static inline uint16x8_t screen(uint16x8_t pixelA, uint16x8_t pixelB, uint16x8_t, uint16x8_t, + uint16x8_t sixteenConst255, uint16x8_t sixteenConstOne) + { + uint16x8_t tmp1 = vaddq_u16(pixelA, pixelB); + uint16x8_t tmp2 = vmulq_u16(pixelA, pixelB); + uint16x8_t tmp3 = div255(tmp2, sixteenConst255, sixteenConstOne); + return vsubq_u16(tmp1, tmp3); + } + + static inline uint16x8_t darken(uint16x8_t pixelA, uint16x8_t pixelB, uint16x8_t alphaA, uint16x8_t alphaB, + uint16x8_t sixteenConst255, uint16x8_t sixteenConstOne) + { + uint16x8_t tmp1 = vsubq_u16(sixteenConst255, alphaA); + uint16x8_t tmp2 = vmulq_u16(tmp1, pixelB); + uint16x8_t tmp3 = div255(tmp2, sixteenConst255, sixteenConstOne); + uint16x8_t tmp4 = vaddq_u16(tmp3, pixelA); + + uint16x8_t tmp5 = vsubq_u16(sixteenConst255, alphaB); + uint16x8_t tmp6 = vmulq_u16(tmp5, pixelA); + uint16x8_t tmp7 = div255(tmp6, sixteenConst255, sixteenConstOne); + uint16x8_t tmp8 = vaddq_u16(tmp7, pixelB); + + return vminq_u16(tmp4, tmp8); + } + + static inline uint16x8_t lighten(uint16x8_t pixelA, uint16x8_t pixelB, uint16x8_t alphaA, uint16x8_t alphaB, + uint16x8_t sixteenConst255, uint16x8_t sixteenConstOne) + { + uint16x8_t tmp1 = vsubq_u16(sixteenConst255, alphaA); + uint16x8_t tmp2 = vmulq_u16(tmp1, pixelB); + uint16x8_t tmp3 = div255(tmp2, sixteenConst255, sixteenConstOne); + uint16x8_t tmp4 = vaddq_u16(tmp3, pixelA); + + uint16x8_t tmp5 = vsubq_u16(sixteenConst255, alphaB); + uint16x8_t tmp6 = vmulq_u16(tmp5, pixelA); + uint16x8_t tmp7 = div255(tmp6, sixteenConst255, sixteenConstOne); + uint16x8_t tmp8 = vaddq_u16(tmp7, pixelB); + + return vmaxq_u16(tmp4, tmp8); + } +}; + +void FEBlend::platformApplyNEON(unsigned char* srcPixelArrayA, unsigned char* srcPixelArrayB, unsigned char* dstPixelArray, + unsigned colorArrayLength) +{ + uint8_t* sourcePixelA = reinterpret_cast<uint8_t*>(srcPixelArrayA); + uint8_t* sourcePixelB = reinterpret_cast<uint8_t*>(srcPixelArrayB); + uint8_t* destinationPixel = reinterpret_cast<uint8_t*>(dstPixelArray); + + uint16x8_t sixteenConst255 = vdupq_n_u16(255); + uint16x8_t sixteenConstOne = vdupq_n_u16(1); + + unsigned colorOffset = 0; + while (colorOffset < colorArrayLength) { + unsigned char alphaA1 = srcPixelArrayA[colorOffset + 3]; + unsigned char alphaB1 = srcPixelArrayB[colorOffset + 3]; + unsigned char alphaA2 = srcPixelArrayA[colorOffset + 7]; + unsigned char alphaB2 = srcPixelArrayB[colorOffset + 7]; + + uint16x8_t doubblePixelA = vmovl_u8(vld1_u8(sourcePixelA + colorOffset)); + uint16x8_t doubblePixelB = vmovl_u8(vld1_u8(sourcePixelB + colorOffset)); + uint16x8_t alphaA = vcombine_u16(vdup_n_u16(alphaA1), vdup_n_u16(alphaA2)); + uint16x8_t alphaB = vcombine_u16(vdup_n_u16(alphaB1), vdup_n_u16(alphaB2)); + + uint16x8_t result; + switch (m_mode) { + case FEBLEND_MODE_NORMAL: + result = FEBlendUtilitiesNEON::normal(doubblePixelA, doubblePixelB, alphaA, alphaB, sixteenConst255, sixteenConstOne); + break; + case FEBLEND_MODE_MULTIPLY: + result = FEBlendUtilitiesNEON::multiply(doubblePixelA, doubblePixelB, alphaA, alphaB, sixteenConst255, sixteenConstOne); + break; + case FEBLEND_MODE_SCREEN: + result = FEBlendUtilitiesNEON::screen(doubblePixelA, doubblePixelB, alphaA, alphaB, sixteenConst255, sixteenConstOne); + break; + case FEBLEND_MODE_DARKEN: + result = FEBlendUtilitiesNEON::darken(doubblePixelA, doubblePixelB, alphaA, alphaB, sixteenConst255, sixteenConstOne); + break; + case FEBLEND_MODE_LIGHTEN: + result = FEBlendUtilitiesNEON::lighten(doubblePixelA, doubblePixelB, alphaA, alphaB, sixteenConst255, sixteenConstOne); + break; + case FEBLEND_MODE_UNKNOWN: + default: + result = vdupq_n_u16(0); + break; + } + + vst1_u8(destinationPixel + colorOffset, vmovn_u16(result)); + + unsigned char alphaR1 = 255 - ((255 - alphaA1) * (255 - alphaB1)) / 255; + unsigned char alphaR2 = 255 - ((255 - alphaA2) * (255 - alphaB2)) / 255; + + dstPixelArray[colorOffset + 3] = alphaR1; + dstPixelArray[colorOffset + 7] = alphaR2; + + colorOffset += 8; + if (colorOffset > colorArrayLength) { + ASSERT(colorOffset - 4 == colorArrayLength); + colorOffset = colorArrayLength - 8; + } + } +} + +} // namespace WebCore + +#endif // ENABLE(FILTERS) && HAVE(ARM_NEON_INTRINSICS) + +#endif // FEBlendNEON_h diff --git a/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp b/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp index f2b86b27e..fba8252da 100644 --- a/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp +++ b/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp @@ -1624,7 +1624,7 @@ bool MediaPlayerPrivateGStreamer::hasSingleSecurityOrigin() const bool MediaPlayerPrivateGStreamer::supportsFullscreen() const { -#if defined(BUILDING_ON_LEOPARD) +#if PLATFORM(MAC) && !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1050 // See <rdar://problem/7389945> return false; #else diff --git a/Source/WebCore/platform/graphics/gtk/ImageBufferGtk.cpp b/Source/WebCore/platform/graphics/gtk/ImageBufferGtk.cpp index ea3430aa5..46ff53b4f 100644 --- a/Source/WebCore/platform/graphics/gtk/ImageBufferGtk.cpp +++ b/Source/WebCore/platform/graphics/gtk/ImageBufferGtk.cpp @@ -19,13 +19,13 @@ #include "config.h" #include "ImageBuffer.h" -#include "Base64.h" #include "GdkCairoUtilities.h" #include <wtf/gobject/GOwnPtr.h> #include "GRefPtrGtk.h" #include "MIMETypeRegistry.h" #include <cairo.h> #include <gtk/gtk.h> +#include <wtf/text/Base64.h> #include <wtf/text/CString.h> #include <wtf/text/WTFString.h> diff --git a/Source/WebCore/platform/graphics/harfbuzz/FontHarfBuzz.cpp b/Source/WebCore/platform/graphics/harfbuzz/FontHarfBuzz.cpp index cc8efeb43..19a0b9a6d 100644 --- a/Source/WebCore/platform/graphics/harfbuzz/FontHarfBuzz.cpp +++ b/Source/WebCore/platform/graphics/harfbuzz/FontHarfBuzz.cpp @@ -187,7 +187,8 @@ void Font::drawComplexText(GraphicsContext* gc, const TextRun& run, HarfBuzzShaper shaper(this, run); if (!shaper.shape(&glyphBuffer)) return; - drawGlyphBuffer(gc, run, glyphBuffer, point); + FloatPoint adjustedPoint = shaper.adjustStartPoint(point); + drawGlyphBuffer(gc, run, glyphBuffer, adjustedPoint); #else SkCanvas* canvas = gc->platformContext()->canvas(); ComplexTextController controller(this, run, point.x(), point.y()); diff --git a/Source/WebCore/platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.cpp b/Source/WebCore/platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.cpp index 695531cc1..48b162474 100644 --- a/Source/WebCore/platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.cpp +++ b/Source/WebCore/platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.cpp @@ -175,31 +175,19 @@ String FontPlatformData::description() const void FontPlatformData::setupPaint(SkPaint* paint) const { - const float ts = m_textSize >= 0 ? m_textSize : 12; + paint->setAntiAlias(m_style.useAntiAlias); + paint->setHinting(static_cast<SkPaint::Hinting>(m_style.hintStyle)); + paint->setEmbeddedBitmapText(m_style.useBitmaps); + paint->setAutohinted(m_style.useAutoHint); + paint->setSubpixelText(m_style.useSubpixelPositioning); + if (m_style.useAntiAlias) + paint->setLCDRenderText(m_style.useSubpixelRendering); - paint->setAntiAlias(m_style.useAntiAlias == FontRenderStyle::NoPreference ? useSkiaAntiAlias : m_style.useAntiAlias); - switch (m_style.useHinting) { - case FontRenderStyle::NoPreference: - paint->setHinting(skiaHinting); - break; - case 0: - paint->setHinting(SkPaint::kNo_Hinting); - break; - default: - paint->setHinting(static_cast<SkPaint::Hinting>(m_style.hintStyle)); - break; - } - - paint->setEmbeddedBitmapText(m_style.useBitmaps == FontRenderStyle::NoPreference ? useSkiaBitmaps : m_style.useBitmaps); + const float ts = m_textSize >= 0 ? m_textSize : 12; paint->setTextSize(SkFloatToScalar(ts)); paint->setTypeface(m_typeface); paint->setFakeBoldText(m_fakeBold); paint->setTextSkewX(m_fakeItalic ? -SK_Scalar1 / 4 : 0); - paint->setAutohinted(m_style.useAutoHint == FontRenderStyle::NoPreference ? useSkiaAutoHint : m_style.useAutoHint); - paint->setSubpixelText(m_style.useSubpixelPositioning == FontRenderStyle::NoPreference ? useSkiaSubpixelPositioning : m_style.useSubpixelPositioning); - - if (m_style.useAntiAlias == 1 || (m_style.useAntiAlias == FontRenderStyle::NoPreference && useSkiaAntiAlias)) - paint->setLCDRenderText(m_style.useSubpixelRendering == FontRenderStyle::NoPreference ? useSkiaSubpixelRendering : m_style.useSubpixelRendering); } SkFontID FontPlatformData::uniqueID() const @@ -272,6 +260,26 @@ HarfbuzzFace* FontPlatformData::harfbuzzFace() const void FontPlatformData::querySystemForRenderStyle() { PlatformSupport::getRenderStyleForStrike(m_family.data(), (((int)m_textSize) << 2) | (m_typeface->style() & 3), &m_style); + + // Fix FontRenderStyle::NoPreference to actual styles. + if (m_style.useAntiAlias == FontRenderStyle::NoPreference) + m_style.useAntiAlias = useSkiaAntiAlias; + + if (!m_style.useHinting) + m_style.hintStyle = SkPaint::kNo_Hinting; + else if (m_style.useHinting == FontRenderStyle::NoPreference) + m_style.hintStyle = skiaHinting; + + if (m_style.useBitmaps == FontRenderStyle::NoPreference) + m_style.useBitmaps = useSkiaBitmaps; + if (m_style.useAutoHint == FontRenderStyle::NoPreference) + m_style.useAutoHint = useSkiaAutoHint; + if (m_style.useSubpixelPositioning == FontRenderStyle::NoPreference) + m_style.useSubpixelPositioning = useSkiaSubpixelPositioning; + if (m_style.useAntiAlias == FontRenderStyle::NoPreference) + m_style.useAntiAlias = useSkiaAntiAlias; + if (m_style.useSubpixelRendering == FontRenderStyle::NoPreference) + m_style.useSubpixelRendering = useSkiaSubpixelRendering; } } // namespace WebCore diff --git a/Source/WebCore/platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.h b/Source/WebCore/platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.h index b4423f400..6f4eca331 100644 --- a/Source/WebCore/platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.h +++ b/Source/WebCore/platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.h @@ -139,6 +139,9 @@ public: HarfbuzzFace* harfbuzzFace() const; #endif + // The returned styles are all actual styles without FontRenderStyle::NoPreference. + const FontRenderStyle& fontRenderStyle() const { return m_style; } + // ------------------------------------------------------------------------- // Global font preferences... diff --git a/Source/WebCore/platform/graphics/harfbuzz/ng/HarfBuzzShaper.cpp b/Source/WebCore/platform/graphics/harfbuzz/ng/HarfBuzzShaper.cpp index 3eed897ba..68d196df1 100644 --- a/Source/WebCore/platform/graphics/harfbuzz/ng/HarfBuzzShaper.cpp +++ b/Source/WebCore/platform/graphics/harfbuzz/ng/HarfBuzzShaper.cpp @@ -32,6 +32,7 @@ #include "HarfBuzzShaper.h" #include "Font.h" +#include "HarfBuzzFace.h" #include "SurrogatePairAwareTextIterator.h" #include "TextRun.h" #include "hb-icu.h" @@ -43,19 +44,47 @@ namespace WebCore { +template<typename T> +class HarfBuzzScopedPtr { +public: + typedef void (*DestroyFunction)(T*); + + HarfBuzzScopedPtr(T* ptr, DestroyFunction destroy) + : m_ptr(ptr) + , m_destroy(destroy) + { + ASSERT(m_destroy); + } + ~HarfBuzzScopedPtr() + { + if (m_ptr) + (*m_destroy)(m_ptr); + } + + T* get() { return m_ptr; } +private: + T* m_ptr; + DestroyFunction m_destroy; +}; + static inline float harfbuzzPositionToFloat(hb_position_t value) { return static_cast<float>(value) / (1 << 16); } -HarfBuzzShaper::HarfBuzzRun::HarfBuzzRun(unsigned numCharacters, TextDirection direction, hb_buffer_t* harfbuzzBuffer) - : m_numCharacters(numCharacters) +HarfBuzzShaper::HarfBuzzRun::HarfBuzzRun(const SimpleFontData* fontData, unsigned startIndex, unsigned numCharacters, TextDirection direction) + : m_fontData(fontData) + , m_startIndex(startIndex) + , m_numCharacters(numCharacters) , m_direction(direction) { +} + +void HarfBuzzShaper::HarfBuzzRun::applyShapeResult(hb_buffer_t* harfbuzzBuffer) +{ m_numGlyphs = hb_buffer_get_length(harfbuzzBuffer); m_glyphs.resize(m_numGlyphs); m_advances.resize(m_numGlyphs); - m_offsets.resize(m_numGlyphs); m_glyphToCharacterIndex.resize(m_numGlyphs); m_logClusters.resize(m_numCharacters); @@ -82,10 +111,9 @@ HarfBuzzShaper::HarfBuzzRun::HarfBuzzRun(unsigned numCharacters, TextDirection d } } -void HarfBuzzShaper::HarfBuzzRun::setGlyphAndPositions(unsigned index, uint16_t glyphId, float x, float y, float advance) +void HarfBuzzShaper::HarfBuzzRun::setGlyphAndAdvance(unsigned index, uint16_t glyphId, float advance) { m_glyphs[index] = glyphId; - m_offsets[index].set(x, y); m_advances[index] = advance; } @@ -106,31 +134,49 @@ int HarfBuzzShaper::HarfBuzzRun::characterIndexForXPosition(int targetX) return rtl() ? 0 : m_numCharacters; } -int HarfBuzzShaper::HarfBuzzRun::xPositionForOffset(unsigned offset) +float HarfBuzzShaper::HarfBuzzRun::xPositionForOffset(unsigned offset) { ASSERT(offset < m_numCharacters); unsigned glyphIndex = m_logClusters[offset]; - ASSERT(glyphIndex < m_numGlyphs); - float position = m_offsets[glyphIndex].x(); + ASSERT(glyphIndex <= m_numGlyphs); + float position = 0; + for (unsigned i = 0; i < glyphIndex; ++i) + position += m_advances[i]; if (rtl()) position += m_advances[glyphIndex]; - return roundf(position); + return position; +} + +static void normalizeCharacters(const UChar* source, UChar* destination, int length) +{ + int position = 0; + bool error = false; + while (position < length) { + UChar32 character; + int nextPosition = position; + U16_NEXT(source, nextPosition, length, character); + if (Font::treatAsSpace(character)) + character = ' '; + else if (Font::treatAsZeroWidthSpaceInComplexScript(character)) + character = zeroWidthSpace; + U16_APPEND(destination, position, length, character, error); + ASSERT_UNUSED(error, !error); + position = nextPosition; + } } HarfBuzzShaper::HarfBuzzShaper(const Font* font, const TextRun& run) : HarfBuzzShaperBase(font, run) - , m_startIndexOfCurrentRun(0) - , m_numCharactersOfCurrentRun(0) - , m_harfbuzzBuffer(0) { - setNormalizedBuffer(); + m_normalizedBuffer = adoptArrayPtr(new UChar[m_run.length() + 1]); + m_normalizedBufferLength = m_run.length(); + normalizeCharacters(m_run.characters(), m_normalizedBuffer.get(), m_normalizedBufferLength); + setPadding(m_run.expansion()); setFontFeatures(); } HarfBuzzShaper::~HarfBuzzShaper() { - if (m_harfbuzzBuffer) - hb_buffer_destroy(m_harfbuzzBuffer); } void HarfBuzzShaper::setFontFeatures() @@ -152,101 +198,101 @@ void HarfBuzzShaper::setFontFeatures() bool HarfBuzzShaper::shape(GlyphBuffer* glyphBuffer) { - m_totalWidth = 0; - while (setupHarfBuzzRun()) { - if (!shapeHarfBuzzRun()) - return false; - setGlyphPositionsForHarfBuzzRun(glyphBuffer); - } - - if (!m_harfbuzzRuns.size()) + if (!collectHarfBuzzRuns()) return false; + m_totalWidth = 0; + if (!shapeHarfBuzzRuns(glyphBuffer)) + return false; + m_totalWidth = roundf(m_totalWidth); return true; } -bool HarfBuzzShaper::setupHarfBuzzRun() +FloatPoint HarfBuzzShaper::adjustStartPoint(const FloatPoint& point) { - m_startIndexOfCurrentRun += m_numCharactersOfCurrentRun; + return point + m_startOffset; +} - // Iterate through the text to take the largest range that stays within - // a single font. - int endOfRunIndex = m_normalizedBufferLength - m_startIndexOfCurrentRun; - SurrogatePairAwareTextIterator iterator(m_normalizedBuffer.get() + m_startIndexOfCurrentRun, 0, endOfRunIndex, endOfRunIndex); +bool HarfBuzzShaper::collectHarfBuzzRuns() +{ + SurrogatePairAwareTextIterator iterator(m_normalizedBuffer.get(), 0, m_normalizedBufferLength, m_normalizedBufferLength); UChar32 character; unsigned clusterLength = 0; + unsigned startIndexOfCurrentRun = 0; if (!iterator.consume(character, clusterLength)) return false; - m_currentFontData = m_font->glyphDataForCharacter(character, false).fontData; + const SimpleFontData* nextFontData = m_font->glyphDataForCharacter(character, false).fontData; UErrorCode errorCode = U_ZERO_ERROR; - UScriptCode currentScript = uscript_getScript(character, &errorCode); + UScriptCode nextScript = uscript_getScript(character, &errorCode); if (U_FAILURE(errorCode)) return false; - if (currentScript == USCRIPT_INHERITED) - currentScript = USCRIPT_COMMON; - for (iterator.advance(clusterLength); iterator.consume(character, clusterLength); iterator.advance(clusterLength)) { - const SimpleFontData* nextFontData = m_font->glyphDataForCharacter(character, false).fontData; - if (nextFontData != m_currentFontData) - break; - UScriptCode nextScript = uscript_getScript(character, &errorCode); - if (U_FAILURE(errorCode)) - return false; - if (currentScript == nextScript || nextScript == USCRIPT_INHERITED || nextScript == USCRIPT_COMMON) - continue; - if (currentScript == USCRIPT_COMMON) - currentScript = nextScript; - else - break; - } - m_numCharactersOfCurrentRun = iterator.currentCharacter(); - - if (!m_harfbuzzBuffer) { - m_harfbuzzBuffer = hb_buffer_create(); - hb_buffer_set_unicode_funcs(m_harfbuzzBuffer, hb_icu_get_unicode_funcs()); - } else - hb_buffer_reset(m_harfbuzzBuffer); - hb_buffer_set_script(m_harfbuzzBuffer, hb_icu_script_to_script(currentScript)); - - // WebKit always sets direction to LTR during width calculation. - // We only set direction when direction is explicitly set to RTL so that - // preventng wrong width calculation. - if (m_run.rtl()) - hb_buffer_set_direction(m_harfbuzzBuffer, HB_DIRECTION_RTL); - - // Determine whether this run needs to be converted to small caps. - // nextScriptRun() will always send us a run of the same case, because a - // case change while in small-caps mode always results in different - // FontData, so we only need to check the first character's case. - if (m_font->isSmallCaps() && u_islower(m_normalizedBuffer[m_startIndexOfCurrentRun])) { - String upperText = String(m_normalizedBuffer.get() + m_startIndexOfCurrentRun, m_numCharactersOfCurrentRun); - upperText.makeUpper(); - m_currentFontData = m_font->glyphDataForCharacter(upperText[0], false, SmallCapsVariant).fontData; - hb_buffer_add_utf16(m_harfbuzzBuffer, upperText.characters(), m_numCharactersOfCurrentRun, 0, m_numCharactersOfCurrentRun); - } else - hb_buffer_add_utf16(m_harfbuzzBuffer, m_normalizedBuffer.get() + m_startIndexOfCurrentRun, m_numCharactersOfCurrentRun, 0, m_numCharactersOfCurrentRun); - return true; + do { + const SimpleFontData* currentFontData = nextFontData; + UScriptCode currentScript = nextScript; + + for (iterator.advance(clusterLength); iterator.consume(character, clusterLength); iterator.advance(clusterLength)) { + nextFontData = m_font->glyphDataForCharacter(character, false).fontData; + if (nextFontData != currentFontData) + break; + nextScript = uscript_getScript(character, &errorCode); + if (U_FAILURE(errorCode)) + return false; + if ((currentScript != nextScript) && (currentScript != USCRIPT_INHERITED)) + break; + } + unsigned numCharactersOfCurrentRun = iterator.currentCharacter() - startIndexOfCurrentRun; + m_harfbuzzRuns.append(HarfBuzzRun::create(currentFontData, startIndexOfCurrentRun, numCharactersOfCurrentRun, m_run.direction())); + currentFontData = nextFontData; + startIndexOfCurrentRun = iterator.currentCharacter(); + } while (iterator.consume(character, clusterLength)); + + return !m_harfbuzzRuns.isEmpty(); } -bool HarfBuzzShaper::shapeHarfBuzzRun() +bool HarfBuzzShaper::shapeHarfBuzzRuns(GlyphBuffer* glyphBuffer) { - FontPlatformData* platformData = const_cast<FontPlatformData*>(&m_currentFontData->platformData()); - HarfBuzzFace* face = platformData->harfbuzzFace(); - if (!face) - return false; - hb_font_t* harfbuzzFont = face->createFont(); - hb_shape(harfbuzzFont, m_harfbuzzBuffer, m_features.size() > 0 ? m_features.data() : 0, m_features.size()); - hb_font_destroy(harfbuzzFont); - m_harfbuzzRuns.append(HarfBuzzRun::create(m_numCharactersOfCurrentRun, m_run.direction(), m_harfbuzzBuffer)); + HarfBuzzScopedPtr<hb_buffer_t> harfbuzzBuffer(hb_buffer_create(), hb_buffer_destroy); + hb_buffer_set_unicode_funcs(harfbuzzBuffer.get(), hb_icu_get_unicode_funcs()); + if (m_run.directionalOverride()) + hb_buffer_set_direction(harfbuzzBuffer.get(), m_run.rtl() ? HB_DIRECTION_RTL : HB_DIRECTION_LTR); + + for (unsigned i = 0; i < m_harfbuzzRuns.size(); ++i) { + unsigned runIndex = m_run.rtl() ? m_harfbuzzRuns.size() - i - 1 : i; + HarfBuzzRun* currentRun = m_harfbuzzRuns[runIndex].get(); + const SimpleFontData* currentFontData = currentRun->fontData(); + + if (m_font->isSmallCaps() && u_islower(m_normalizedBuffer[currentRun->startIndex()])) { + String upperText = String(m_normalizedBuffer.get() + currentRun->startIndex(), currentRun->numCharacters()); + upperText.makeUpper(); + currentFontData = m_font->glyphDataForCharacter(upperText[0], false, SmallCapsVariant).fontData; + hb_buffer_add_utf16(harfbuzzBuffer.get(), upperText.characters(), currentRun->numCharacters(), 0, currentRun->numCharacters()); + } else + hb_buffer_add_utf16(harfbuzzBuffer.get(), m_normalizedBuffer.get() + currentRun->startIndex(), currentRun->numCharacters(), 0, currentRun->numCharacters()); + + FontPlatformData* platformData = const_cast<FontPlatformData*>(¤tFontData->platformData()); + HarfBuzzFace* face = platformData->harfbuzzFace(); + if (!face) + return false; + HarfBuzzScopedPtr<hb_font_t> harfbuzzFont(face->createFont(), hb_font_destroy); + hb_shape(harfbuzzFont.get(), harfbuzzBuffer.get(), m_features.isEmpty() ? 0 : m_features.data(), m_features.size()); + + currentRun->applyShapeResult(harfbuzzBuffer.get()); + setGlyphPositionsForHarfBuzzRun(currentRun, i, harfbuzzBuffer.get(), glyphBuffer); + + hb_buffer_reset(harfbuzzBuffer.get()); + if (m_run.directionalOverride()) + hb_buffer_set_direction(harfbuzzBuffer.get(), m_run.rtl() ? HB_DIRECTION_RTL : HB_DIRECTION_LTR); + } return true; } -void HarfBuzzShaper::setGlyphPositionsForHarfBuzzRun(GlyphBuffer* glyphBuffer) +void HarfBuzzShaper::setGlyphPositionsForHarfBuzzRun(HarfBuzzRun* currentRun, unsigned runIndexInVisualOrder, hb_buffer_t* harfbuzzBuffer, GlyphBuffer* glyphBuffer) { - hb_glyph_info_t* glyphInfos = hb_buffer_get_glyph_infos(m_harfbuzzBuffer, 0); - hb_glyph_position_t* glyphPositions = hb_buffer_get_glyph_positions(m_harfbuzzBuffer, 0); - HarfBuzzRun* currentRun = m_harfbuzzRuns.last().get(); + const SimpleFontData* currentFontData = currentRun->fontData(); + hb_glyph_info_t* glyphInfos = hb_buffer_get_glyph_infos(harfbuzzBuffer, 0); + hb_glyph_position_t* glyphPositions = hb_buffer_get_glyph_positions(harfbuzzBuffer, 0); unsigned numGlyphs = currentRun->numGlyphs(); float totalAdvance = 0; @@ -262,26 +308,29 @@ void HarfBuzzShaper::setGlyphPositionsForHarfBuzzRun(GlyphBuffer* glyphBuffer) nextOffsetX = runEnd ? 0 : harfbuzzPositionToFloat(glyphPositions[i + 1].x_offset); nextOffsetY = runEnd ? 0 : -harfbuzzPositionToFloat(glyphPositions[i + 1].y_offset); - unsigned currentCharacterIndex = m_startIndexOfCurrentRun + glyphInfos[i].cluster; + unsigned currentCharacterIndex = currentRun->startIndex() + glyphInfos[i].cluster; bool isClusterEnd = runEnd || glyphInfos[i].cluster != glyphInfos[i + 1].cluster; float spacing = isClusterEnd ? m_letterSpacing : 0; if (isClusterEnd && isWordEnd(currentCharacterIndex)) spacing += determineWordBreakSpacing(); - if (m_currentFontData->isZeroWidthSpaceGlyph(glyph)) { - currentRun->setGlyphAndPositions(i, glyph, 0, 0, 0); + if (currentFontData->isZeroWidthSpaceGlyph(glyph)) { + currentRun->setGlyphAndAdvance(i, glyph, 0); if (glyphBuffer) - glyphBuffer->add(glyph, m_currentFontData, createGlyphBufferAdvance(0, 0)); + glyphBuffer->add(glyph, currentFontData, createGlyphBufferAdvance(0, 0)); continue; } advance += spacing; - currentRun->setGlyphAndPositions(i, glyph, totalAdvance + offsetX, offsetY, advance); + + currentRun->setGlyphAndAdvance(i, glyph, advance); if (glyphBuffer) { + if (!i && !runIndexInVisualOrder) + m_startOffset.set(offsetX, offsetY); float glyphAdvanceX = advance + nextOffsetX - offsetX; float glyphAdvanceY = nextOffsetY - offsetY; - glyphBuffer->add(glyph, m_currentFontData, createGlyphBufferAdvance(glyphAdvanceX, glyphAdvanceY)); + glyphBuffer->add(glyph, currentFontData, createGlyphBufferAdvance(glyphAdvanceX, glyphAdvanceY)); } totalAdvance += advance; @@ -324,37 +373,46 @@ int HarfBuzzShaper::offsetForPosition(float targetX) FloatRect HarfBuzzShaper::selectionRect(const FloatPoint& point, int height, int from, int to) { - int fromX = -1, toX = -1; - int currentX = 0; - // Iterate through the script runs in logical order, searching for the run covering the positions of interest. + float currentX = 0; + float fromX; + float toX; + bool foundFromX = false; + bool foundToX = false; + + if (m_run.rtl()) + currentX = m_totalWidth; for (unsigned i = 0; i < m_harfbuzzRuns.size(); ++i) { + if (m_run.rtl()) + currentX -= m_harfbuzzRuns[i]->width(); int numCharacters = m_harfbuzzRuns[i]->numCharacters(); - if (fromX == -1 && from >= 0 && from < numCharacters) + if (!foundFromX && from >= 0 && from < numCharacters) { fromX = m_harfbuzzRuns[i]->xPositionForOffset(from) + currentX; - else + foundFromX = true; + } else from -= numCharacters; - if (toX == -1 && to >= 0 && to < numCharacters) + if (!foundToX && to >= 0 && to < numCharacters) { toX = m_harfbuzzRuns[i]->xPositionForOffset(to) + currentX; - else + foundToX = true; + } else to -= numCharacters; - if (fromX != -1 && toX != -1) + if (foundFromX && foundToX) break; - currentX += m_harfbuzzRuns[i]->width(); + if (!m_run.rtl()) + currentX += m_harfbuzzRuns[i]->width(); } // The position in question might be just after the text. - if (fromX == -1) + if (!foundFromX) fromX = 0; - if (toX == -1) + if (!foundToX) toX = m_run.rtl() ? 0 : m_totalWidth; - ASSERT(fromX != -1 && toX != -1); - + // Using floorf() and roundf() as the same as mac port. if (fromX < toX) - return FloatRect(point.x() + fromX, point.y(), toX - fromX, height); - return FloatRect(point.x() + toX, point.y(), fromX - toX, height); + return FloatRect(floorf(point.x() + fromX), point.y(), roundf(toX - fromX), height); + return FloatRect(floorf(point.x() + toX), point.y(), roundf(fromX - toX), height); } } // namespace WebCore diff --git a/Source/WebCore/platform/graphics/harfbuzz/ng/HarfBuzzShaper.h b/Source/WebCore/platform/graphics/harfbuzz/ng/HarfBuzzShaper.h index 7beff5d72..eb3935db1 100644 --- a/Source/WebCore/platform/graphics/harfbuzz/ng/HarfBuzzShaper.h +++ b/Source/WebCore/platform/graphics/harfbuzz/ng/HarfBuzzShaper.h @@ -52,6 +52,7 @@ public: virtual ~HarfBuzzShaper(); bool shape(GlyphBuffer* = 0); + FloatPoint adjustStartPoint(const FloatPoint&); float totalWidth() { return m_totalWidth; } int offsetForPosition(float targetX); FloatRect selectionRect(const FloatPoint&, int height, int from, int to); @@ -59,31 +60,37 @@ public: private: class HarfBuzzRun { public: - static PassOwnPtr<HarfBuzzRun> create(unsigned numCharacters, TextDirection direction, hb_buffer_t* buffer) + static PassOwnPtr<HarfBuzzRun> create(const SimpleFontData* fontData, unsigned startIndex, unsigned numCharacters, TextDirection direction) { - return adoptPtr(new HarfBuzzRun(numCharacters, direction, buffer)); + return adoptPtr(new HarfBuzzRun(fontData, startIndex, numCharacters, direction)); } - void setGlyphAndPositions(unsigned index, uint16_t glyphId, float x, float y, float); + void applyShapeResult(hb_buffer_t*); + void setGlyphAndAdvance(unsigned index, uint16_t glyphId, float advance); void setWidth(float width) { m_width = width; } int characterIndexForXPosition(int targetX); - int xPositionForOffset(unsigned offset); + float xPositionForOffset(unsigned offset); + const SimpleFontData* fontData() { return m_fontData; } + unsigned startIndex() const { return m_startIndex; } unsigned numCharacters() const { return m_numCharacters; } unsigned numGlyphs() const { return m_numGlyphs; } + uint16_t* glyphs() { return &m_glyphs[0]; } + float* advances() { return &m_advances[0]; } float width() { return m_width; } private: - HarfBuzzRun(unsigned numCharacters, TextDirection, hb_buffer_t*); + HarfBuzzRun(const SimpleFontData*, unsigned startIndex, unsigned numCharacters, TextDirection); bool rtl() { return m_direction == RTL; } + const SimpleFontData* m_fontData; + unsigned m_startIndex; size_t m_numCharacters; unsigned m_numGlyphs; TextDirection m_direction; Vector<uint16_t, 256> m_glyphs; Vector<float, 256> m_advances; - Vector<FloatPoint, 256> m_offsets; Vector<uint16_t, 256> m_logClusters; Vector<uint16_t, 256> m_glyphToCharacterIndex; float m_width; @@ -91,19 +98,17 @@ private: void setFontFeatures(); - bool setupHarfBuzzRun(); - bool shapeHarfBuzzRun(); - void setGlyphPositionsForHarfBuzzRun(GlyphBuffer*); + bool collectHarfBuzzRuns(); + bool shapeHarfBuzzRuns(GlyphBuffer*); + void setGlyphPositionsForHarfBuzzRun(HarfBuzzRun*, unsigned runIndexInVisualOrder, hb_buffer_t*, GlyphBuffer*); GlyphBufferAdvance createGlyphBufferAdvance(float, float); Vector<hb_feature_t, 4> m_features; - unsigned m_startIndexOfCurrentRun; - unsigned m_numCharactersOfCurrentRun; - const SimpleFontData* m_currentFontData; - hb_buffer_t* m_harfbuzzBuffer; Vector<OwnPtr<HarfBuzzRun>, 16> m_harfbuzzRuns; + FloatPoint m_startOffset; + float m_totalWidth; }; diff --git a/Source/WebCore/platform/graphics/mac/ComplexTextController.cpp b/Source/WebCore/platform/graphics/mac/ComplexTextController.cpp index a9324d37f..f09cb1303 100644 --- a/Source/WebCore/platform/graphics/mac/ComplexTextController.cpp +++ b/Source/WebCore/platform/graphics/mac/ComplexTextController.cpp @@ -33,7 +33,7 @@ #include <wtf/StdLibExtras.h> #include <wtf/unicode/CharacterNames.h> -#if defined(BUILDING_ON_LEOPARD) +#if (PLATFORM(MAC) || PLATFORM(CHROMIUM)) && !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1050 // Undefined when compiling agains the 10.5 SDK. #define kCTVersionNumber10_6 0x00030000 #endif diff --git a/Source/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.mm b/Source/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.mm index e5304533e..83173db61 100644 --- a/Source/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.mm +++ b/Source/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.mm @@ -39,7 +39,7 @@ #include <CoreText/CoreText.h> #endif -#if defined(BUILDING_ON_LEOPARD) +#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1050 // The following symbols are SPI in 10.5. extern "C" { void CTRunGetAdvances(CTRunRef run, CFRange range, CGSize buffer[]); @@ -218,7 +218,7 @@ void ComplexTextController::collectComplexTextRunsForCharactersCoreText(const UC static CFDictionaryRef ltrTypesetterOptions = CFDictionaryCreate(kCFAllocatorDefault, optionKeys, ltrOptionValues, WTF_ARRAY_LENGTH(optionKeys), &kCFCopyStringDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks); static CFDictionaryRef rtlTypesetterOptions = CFDictionaryCreate(kCFAllocatorDefault, optionKeys, rtlOptionValues, WTF_ARRAY_LENGTH(optionKeys), &kCFCopyStringDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks); -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 ProviderInfo info = { cp, length, stringAttributes.get() }; RetainPtr<CTTypesetterRef> typesetter(AdoptCF, wkCreateCTTypesetterWithUniCharProviderAndOptions(&provideStringAndAttributes, 0, &info, m_run.ltr() ? ltrTypesetterOptions : rtlTypesetterOptions)); #else diff --git a/Source/WebCore/platform/graphics/mac/FontCacheMac.mm b/Source/WebCore/platform/graphics/mac/FontCacheMac.mm index 91dd426fe..6b2e05474 100644 --- a/Source/WebCore/platform/graphics/mac/FontCacheMac.mm +++ b/Source/WebCore/platform/graphics/mac/FontCacheMac.mm @@ -52,7 +52,7 @@ static void invalidateFontCache(void*) fontCache()->invalidate(); } -#if !defined(BUILDING_ON_LEOPARD) +#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 static void fontCacheRegisteredFontsChangedNotificationCallback(CFNotificationCenterRef, void* observer, CFStringRef name, const void *, CFDictionaryRef) { ASSERT_UNUSED(observer, observer == fontCache()); @@ -69,7 +69,7 @@ static void fontCacheATSNotificationCallback(ATSFontNotificationInfoRef, void*) void FontCache::platformInit() { wkSetUpFontCache(); -#if !defined(BUILDING_ON_LEOPARD) +#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 CFNotificationCenterAddObserver(CFNotificationCenterGetLocalCenter(), this, fontCacheRegisteredFontsChangedNotificationCallback, kCTFontManagerRegisteredFontsChangedNotification, 0, CFNotificationSuspensionBehaviorDeliverImmediately); #else // kCTFontManagerRegisteredFontsChangedNotification does not exist on Leopard and earlier. diff --git a/Source/WebCore/platform/graphics/mac/FontCustomPlatformData.cpp b/Source/WebCore/platform/graphics/mac/FontCustomPlatformData.cpp index cfddf363f..d3d872153 100644 --- a/Source/WebCore/platform/graphics/mac/FontCustomPlatformData.cpp +++ b/Source/WebCore/platform/graphics/mac/FontCustomPlatformData.cpp @@ -78,7 +78,7 @@ private: FontCustomPlatformData::~FontCustomPlatformData() { -#ifdef BUILDING_ON_LEOPARD +#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1050 if (m_atsContainer) ATSFontDeactivate(m_atsContainer, NULL, kATSOptionFlagsDefault); #endif @@ -119,7 +119,7 @@ FontCustomPlatformData* createFontCustomPlatformData(SharedBuffer* buffer) RetainPtr<CGFontRef> cgFontRef; -#ifndef BUILDING_ON_LEOPARD +#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 RetainPtr<CFDataRef> bufferData(AdoptCF, buffer->createCFData()); RetainPtr<CGDataProviderRef> dataProvider(AdoptCF, CGDataProviderCreateWithCFData(bufferData.get())); @@ -157,7 +157,7 @@ FontCustomPlatformData* createFontCustomPlatformData(SharedBuffer* buffer) ATSFontDeactivate(containerRef, NULL, kATSOptionFlagsDefault); return 0; } -#endif // !defined(BUILDING_ON_LEOPARD) +#endif // PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 FontCustomPlatformData* fontCustomPlatformData = new FontCustomPlatformData(containerRef, cgFontRef.leakRef()); #if USE(SKIA_ON_MAC_CHROMIUM) diff --git a/Source/WebCore/platform/graphics/mac/FontMac.mm b/Source/WebCore/platform/graphics/mac/FontMac.mm index 4afb5fbdb..608123cbd 100644 --- a/Source/WebCore/platform/graphics/mac/FontMac.mm +++ b/Source/WebCore/platform/graphics/mac/FontMac.mm @@ -71,7 +71,7 @@ static bool hasBrokenCTFontGetVerticalTranslationsForGlyphs() isCached = true; } return result; -#elif defined(BUILDING_ON_SNOW_LEOPARD) +#elif !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1060 return true; #else return false; @@ -119,7 +119,7 @@ static void showGlyphsWithAdvances(const FloatPoint& point, const SimpleFontData } else CGContextShowGlyphsWithAdvances(context, glyphs, advances, count); } -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 else { if (!count) return; diff --git a/Source/WebCore/platform/graphics/mac/GraphicsContextMac.mm b/Source/WebCore/platform/graphics/mac/GraphicsContextMac.mm index e08591df4..e3d4f3346 100644 --- a/Source/WebCore/platform/graphics/mac/GraphicsContextMac.mm +++ b/Source/WebCore/platform/graphics/mac/GraphicsContextMac.mm @@ -129,7 +129,7 @@ void GraphicsContext::drawLineForDocumentMarker(const FloatPoint& point, float w patternColor = grammarPatternColor.get(); break; } -#if PLATFORM(MAC) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if PLATFORM(MAC) && (PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070) // To support correction panel. case DocumentMarkerAutocorrectionReplacementLineStyle: case DocumentMarkerDictationAlternativesLineStyle: diff --git a/Source/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.mm b/Source/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.mm index cd161a3f2..2e849af61 100644 --- a/Source/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.mm +++ b/Source/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.mm @@ -267,7 +267,7 @@ void MediaPlayerPrivateQTKit::createQTMovie(const String& url) NSMutableDictionary *movieAttributes = commonMovieAttributes(); [movieAttributes setValue:cocoaURL forKey:QTMovieURLAttribute]; -#if !defined(BUILDING_ON_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 CFDictionaryRef proxySettings = CFNetworkCopySystemProxySettings(); CFArrayRef proxiesForURL = CFNetworkCopyProxiesForURL((CFURLRef)cocoaURL, proxySettings); BOOL willUseProxy = YES; @@ -392,7 +392,7 @@ void MediaPlayerPrivateQTKit::createQTMovie(NSURL *url, NSDictionary *movieAttri selector:@selector(didEnd:) name:QTMovieDidEndNotification object:m_qtMovie.get()]; -#if defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED == 1060 [[NSNotificationCenter defaultCenter] addObserver:m_objcObserver.get() selector:@selector(layerHostChanged:) name:@"WebKitLayerHostChanged" @@ -876,7 +876,7 @@ bool MediaPlayerPrivateQTKit::hasAudio() const bool MediaPlayerPrivateQTKit::supportsFullscreen() const { -#ifndef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 return true; #else // See <rdar://problem/7389945> @@ -903,7 +903,7 @@ void MediaPlayerPrivateQTKit::setClosedCaptionsVisible(bool closedCaptionsVisibl if (metaDataAvailable()) { wkQTMovieSetShowClosedCaptions(m_qtMovie.get(), closedCaptionsVisible); -#if USE(ACCELERATED_COMPOSITING) && !defined(BUILDING_ON_LEOPARD) +#if USE(ACCELERATED_COMPOSITING) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 if (closedCaptionsVisible && m_qtVideoLayer) { // Captions will be rendered upside down unless we flag the movie as flipped (again). See <rdar://7408440>. [m_qtVideoLayer.get() setGeometryFlipped:YES]; @@ -1001,7 +1001,7 @@ void MediaPlayerPrivateQTKit::cacheMovieScale() NSSize initialSize = NSZeroSize; NSSize naturalSize = [[m_qtMovie.get() attributeForKey:QTMovieNaturalSizeAttribute] sizeValue]; -#ifndef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 // QTMovieCurrentSizeAttribute is not allowed with instances of QTMovie that have been // opened with QTMovieOpenForPlaybackAttribute, so ask for the display transform attribute instead. NSAffineTransform *displayTransform = [m_qtMovie.get() attributeForKey:@"QTMoviePreferredTransformAttribute"]; @@ -1236,7 +1236,7 @@ void MediaPlayerPrivateQTKit::didEnd() } #if USE(ACCELERATED_COMPOSITING) && !(PLATFORM(QT) && USE(QTKIT)) -#if defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED == 1060 static bool layerIsDescendentOf(PlatformLayer* child, PlatformLayer* descendent) { if (!child || !descendent) @@ -1253,7 +1253,7 @@ static bool layerIsDescendentOf(PlatformLayer* child, PlatformLayer* descendent) void MediaPlayerPrivateQTKit::layerHostChanged(PlatformLayer* rootLayer) { -#if defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED == 1060 if (!rootLayer) return; diff --git a/Source/WebCore/platform/graphics/mac/SimpleFontDataMac.mm b/Source/WebCore/platform/graphics/mac/SimpleFontDataMac.mm index d5d55606d..487591a74 100644 --- a/Source/WebCore/platform/graphics/mac/SimpleFontDataMac.mm +++ b/Source/WebCore/platform/graphics/mac/SimpleFontDataMac.mm @@ -82,7 +82,7 @@ static NSString *webFallbackFontFamily(void) } #if !ERROR_DISABLED -#if defined(__LP64__) || (!defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)) +#if defined(__LP64__) || PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 static NSString* pathFromFont(NSFont*) { // FMGetATSFontRefFromFont is not available. As pathFromFont is only used for debugging purposes, @@ -233,7 +233,7 @@ void SimpleFontData::platformInit() NSString *familyName = [m_platformData.font() familyName]; if ([familyName isEqualToString:@"Times"] || [familyName isEqualToString:@"Helvetica"] || [familyName isEqualToString:@"Courier"]) ascent += floorf(((ascent + descent) * 0.15f) + 0.5f); -#if defined(BUILDING_ON_LEOPARD) +#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1050 else if ([familyName isEqualToString:@"Geeza Pro"]) { // Geeza Pro has glyphs that draw slightly above the ascent or far below the descent. Adjust // those vertical metrics to better match reality, so that diacritics at the bottom of one line diff --git a/Source/WebCore/platform/graphics/mac/WebLayer.h b/Source/WebCore/platform/graphics/mac/WebLayer.h index bb0f444bc..1266bb749 100644 --- a/Source/WebCore/platform/graphics/mac/WebLayer.h +++ b/Source/WebCore/platform/graphics/mac/WebLayer.h @@ -36,7 +36,7 @@ namespace WebCore { class PlatformCALayerClient; } -#if defined(BUILDING_ON_LEOPARD) +#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1050 @interface CALayer(WebLayerInternal) - (CGAffineTransform)contentsTransform; - (void)setContentsTransform:(CGAffineTransform)t; diff --git a/Source/WebCore/platform/graphics/mac/WebLayer.mm b/Source/WebCore/platform/graphics/mac/WebLayer.mm index 97e9f2882..d783e494a 100644 --- a/Source/WebCore/platform/graphics/mac/WebLayer.mm +++ b/Source/WebCore/platform/graphics/mac/WebLayer.mm @@ -84,7 +84,7 @@ void drawLayerContents(CGContextRef context, CALayer *layer, WebCore::PlatformCA AffineTransform transform = CGContextGetCTM(context); ThemeMac::setFocusRingClipRect(transform.mapRect(clipBounds)); -#if !defined(BUILDING_ON_SNOW_LEOPARD) +#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 __block GraphicsContext* ctx = &graphicsContext; wkCALayerEnumerateRectsBeingDrawnWithBlock(layer, context, ^(CGRect rect){ diff --git a/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGLCommon.cpp b/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGLCommon.cpp index 57723560c..5a628810d 100644 --- a/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGLCommon.cpp +++ b/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGLCommon.cpp @@ -26,7 +26,7 @@ #include "config.h" -#if ENABLE(WEBGL) +#if USE(3D_GRAPHICS) #include "Extensions3DOpenGLCommon.h" #include "ANGLEWebKitBridge.h" @@ -145,4 +145,4 @@ void Extensions3DOpenGLCommon::initializeAvailableExtensions() } // namespace WebCore -#endif // ENABLE(WEBGL) +#endif // USE(3D_GRAPHICS) diff --git a/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGLES.cpp b/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGLES.cpp index e21f559ad..fed5492c6 100644 --- a/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGLES.cpp +++ b/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGLES.cpp @@ -25,10 +25,11 @@ */ #include "config.h" -#if ENABLE(WEBGL) +#if USE(3D_GRAPHICS) #include "Extensions3DOpenGLES.h" #include "GraphicsContext3D.h" +#include "NotImplemented.h" #include <EGL/egl.h> #include <wtf/Vector.h> @@ -68,6 +69,21 @@ void Extensions3DOpenGLES::renderbufferStorageMultisampleIMG(unsigned long targe m_context->synthesizeGLError(GL_INVALID_OPERATION); } +void Extensions3DOpenGLES::blitFramebuffer(long srcX0, long srcY0, long srcX1, long srcY1, long dstX0, long dstY0, long dstX1, long dstY1, unsigned long mask, unsigned long filter) +{ + notImplemented(); +} + +void Extensions3DOpenGLES::renderbufferStorageMultisample(unsigned long target, unsigned long samples, unsigned long internalformat, unsigned long width, unsigned long height) +{ + notImplemented(); +} + +void Extensions3DOpenGLES::copyTextureCHROMIUM(GC3Denum, Platform3DObject, Platform3DObject, GC3Dint, GC3Denum) +{ + notImplemented(); +} + Platform3DObject Extensions3DOpenGLES::createVertexArrayOES() { m_context->makeContextCurrent(); @@ -129,8 +145,8 @@ bool Extensions3DOpenGLES::supportsExtension(const String& name) m_glIsVertexArrayOES = reinterpret_cast<PFNGLISVERTEXARRAYOESPROC>(eglGetProcAddress("glIsVertexArrayOES")); m_supportsOESvertexArrayObject = true; } else if (name == "GL_IMG_multisampled_render_to_texture" && !m_supportsIMGMultisampledRenderToTexture) { - m_glFramebufferTexture2DMultisampleIMG = reinterpret_cast<PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEIMGPROC>(eglGetProcAddress("glFramebufferTexture2DMultisampleIMG")); - m_glRenderbufferStorageMultisampleIMG = reinterpret_cast<PFNGLRENDERBUFFERSTORAGEMULTISAMPLEIMGPROC>(eglGetProcAddress("glRenderbufferStorageMultisampleIMG")); + m_glFramebufferTexture2DMultisampleIMG = reinterpret_cast<PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEIMG>(eglGetProcAddress("glFramebufferTexture2DMultisampleIMG")); + m_glRenderbufferStorageMultisampleIMG = reinterpret_cast<PFNGLRENDERBUFFERSTORAGEMULTISAMPLEIMG>(eglGetProcAddress("glRenderbufferStorageMultisampleIMG")); m_supportsIMGMultisampledRenderToTexture = true; } return true; @@ -146,4 +162,4 @@ String Extensions3DOpenGLES::getExtensions() } // namespace WebCore -#endif // ENABLE(WEBGL) +#endif // USE(3D_GRAPHICS) diff --git a/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGLES.h b/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGLES.h index 3c460f9e2..c3cc59571 100644 --- a/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGLES.h +++ b/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGLES.h @@ -41,6 +41,11 @@ public: virtual void framebufferTexture2DMultisampleIMG(unsigned long target, unsigned long attachment, unsigned long textarget, unsigned int texture, int level, unsigned long samples); virtual void renderbufferStorageMultisampleIMG(unsigned long target, unsigned long samples, unsigned long internalformat, unsigned long width, unsigned long height); + // Extension3D methods + virtual void blitFramebuffer(long srcX0, long srcY0, long srcX1, long srcY1, long dstX0, long dstY0, long dstX1, long dstY1, unsigned long mask, unsigned long filter); + virtual void renderbufferStorageMultisample(unsigned long target, unsigned long samples, unsigned long internalformat, unsigned long width, unsigned long height); + virtual void copyTextureCHROMIUM(GC3Denum, Platform3DObject, Platform3DObject, GC3Dint, GC3Denum); + virtual Platform3DObject createVertexArrayOES(); virtual void deleteVertexArrayOES(Platform3DObject); virtual GC3Dboolean isVertexArrayOES(Platform3DObject); @@ -57,8 +62,8 @@ protected: bool m_supportsOESvertexArrayObject; bool m_supportsIMGMultisampledRenderToTexture; - PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEIMGPROC m_glFramebufferTexture2DMultisampleIMG; - PFNGLRENDERBUFFERSTORAGEMULTISAMPLEIMGPROC m_glRenderbufferStorageMultisampleIMG; + PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEIMG m_glFramebufferTexture2DMultisampleIMG; + PFNGLRENDERBUFFERSTORAGEMULTISAMPLEIMG m_glRenderbufferStorageMultisampleIMG; PFNGLBINDVERTEXARRAYOESPROC m_glBindVertexArrayOES; PFNGLDELETEVERTEXARRAYSOESPROC m_glDeleteVertexArraysOES; PFNGLGENVERTEXARRAYSOESPROC m_glGenVertexArraysOES; diff --git a/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGL.cpp b/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGL.cpp index 6753444f8..fd450141c 100644 --- a/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGL.cpp +++ b/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGL.cpp @@ -284,7 +284,7 @@ void GraphicsContext3D::clearDepth(GC3Dclampf depth) bool GraphicsContext3D::systemAllowsMultisamplingOnATICards() const { #if PLATFORM(MAC) -#if !defined(BUILDING_ON_SNOW_LEOPARD) && !defined(BUILDING_ON_LION) +#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 return true; #else ASSERT(isMainThread()); diff --git a/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLES.cpp b/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLES.cpp index e4ac6876e..26281909b 100644 --- a/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLES.cpp +++ b/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLES.cpp @@ -34,7 +34,9 @@ #include "Extensions3DOpenGLES.h" #include "IntRect.h" #include "IntSize.h" +#if PLATFORM(BLACKBERRY) #include "LayerWebKitThread.h" +#endif #include "NotImplemented.h" #include "OpenGLESShims.h" @@ -113,6 +115,75 @@ void GraphicsContext3D::readPixelsAndConvertToBGRAIfNecessary(int x, int y, int } } +bool GraphicsContext3D::reshapeFBOs(const IntSize& size) +{ + const int width = size.width(); + const int height = size.height(); + GLuint colorFormat = 0, pixelDataType = 0; + if (m_attrs.alpha) { + m_internalColorFormat = GL_RGBA; + colorFormat = GL_RGBA; + pixelDataType = GL_UNSIGNED_BYTE; + } else { + m_internalColorFormat = GL_RGB; + colorFormat = GL_RGB; + pixelDataType = GL_UNSIGNED_SHORT_5_6_5; + } + + // We don't allow the logic where stencil is required and depth is not. + // See GraphicsContext3D::validateAttributes. + bool supportPackedDepthStencilBuffer = (m_attrs.stencil || m_attrs.depth) && getExtensions()->supports("GL_OES_packed_depth_stencil"); + + // Resize regular FBO. + bool mustRestoreFBO = false; + if (m_boundFBO != m_fbo) { + mustRestoreFBO = true; + ::glBindFramebufferEXT(GraphicsContext3D::FRAMEBUFFER, m_fbo); + } + + ::glBindTexture(GL_TEXTURE_2D, m_texture); + ::glTexImage2D(GL_TEXTURE_2D, 0, m_internalColorFormat, width, height, 0, colorFormat, pixelDataType, 0); + ::glFramebufferTexture2DEXT(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::COLOR_ATTACHMENT0, GL_TEXTURE_2D, m_texture, 0); + + ::glBindTexture(GL_TEXTURE_2D, m_compositorTexture); + ::glTexImage2D(GL_TEXTURE_2D, 0, m_internalColorFormat, width, height, 0, colorFormat, GL_UNSIGNED_BYTE, 0); + ::glBindTexture(GL_TEXTURE_2D, 0); + + // We don't support antialiasing yet. See GraphicsContext3D::validateAttributes. + ASSERT(!m_attrs.antialias); + + if (m_attrs.stencil || m_attrs.depth) { + // Use a 24 bit depth buffer where we know we have it. + if (supportPackedDepthStencilBuffer) { + ::glBindTexture(GL_TEXTURE_2D, m_depthStencilBuffer); + ::glTexImage2D(GL_TEXTURE_2D, 0, GraphicsContext3D::DEPTH_STENCIL, width, height, 0, GraphicsContext3D::DEPTH_STENCIL, GraphicsContext3D::UNSIGNED_INT_24_8, 0); + if (m_attrs.stencil) + ::glFramebufferTexture2D(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_TEXTURE_2D, m_depthStencilBuffer, 0); + if (m_attrs.depth) + ::glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, m_depthStencilBuffer, 0); + ::glBindTexture(GL_TEXTURE_2D, 0); + } else { + if (m_attrs.stencil) { + ::glBindRenderbufferEXT(GraphicsContext3D::RENDERBUFFER, m_stencilBuffer); + ::glRenderbufferStorageEXT(GraphicsContext3D::RENDERBUFFER, GL_STENCIL_INDEX8, width, height); + ::glFramebufferRenderbufferEXT(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::STENCIL_ATTACHMENT, GraphicsContext3D::RENDERBUFFER, m_stencilBuffer); + } + if (m_attrs.depth) { + ::glBindRenderbufferEXT(GraphicsContext3D::RENDERBUFFER, m_depthBuffer); + ::glRenderbufferStorageEXT(GraphicsContext3D::RENDERBUFFER, GL_DEPTH_COMPONENT16, width, height); + ::glFramebufferRenderbufferEXT(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::DEPTH_ATTACHMENT, GraphicsContext3D::RENDERBUFFER, m_depthBuffer); + } + ::glBindRenderbufferEXT(GraphicsContext3D::RENDERBUFFER, 0); + } + } + if (glCheckFramebufferStatusEXT(GraphicsContext3D::FRAMEBUFFER) != GraphicsContext3D::FRAMEBUFFER_COMPLETE) { + // FIXME: cleanup + notImplemented(); + } + + return mustRestoreFBO; +} + void GraphicsContext3D::resolveMultisamplingIfNecessary(const IntRect& rect) { // FIXME: We don't support antialiasing yet. diff --git a/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp b/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp index c7191e35b..84729d992 100644 --- a/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp +++ b/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp @@ -19,7 +19,11 @@ #include "config.h" #include "GraphicsContext3D.h" +#if USE(OPENGL_ES_2) +#include "Extensions3DOpenGLES.h" +#else #include "Extensions3DOpenGL.h" +#endif #include "GraphicsContext.h" #include "GraphicsSurface.h" #include "HostWindow.h" diff --git a/Source/WebCore/platform/graphics/skia/FontCustomPlatformData.cpp b/Source/WebCore/platform/graphics/skia/FontCustomPlatformData.cpp index 1ce1efc08..e7e8fc909 100644 --- a/Source/WebCore/platform/graphics/skia/FontCustomPlatformData.cpp +++ b/Source/WebCore/platform/graphics/skia/FontCustomPlatformData.cpp @@ -34,7 +34,6 @@ #include "FontCustomPlatformData.h" #if OS(WINDOWS) -#include "Base64.h" #include "OpenTypeUtilities.h" #include "PlatformSupport.h" #elif OS(UNIX) @@ -48,6 +47,7 @@ #if OS(WINDOWS) #include <objbase.h> +#include <wtf/text/Base64.h> #elif OS(UNIX) #include <cstring> #endif diff --git a/Source/WebCore/platform/graphics/skia/ImageBufferSkia.cpp b/Source/WebCore/platform/graphics/skia/ImageBufferSkia.cpp index ac3d929bc..b5490c656 100644 --- a/Source/WebCore/platform/graphics/skia/ImageBufferSkia.cpp +++ b/Source/WebCore/platform/graphics/skia/ImageBufferSkia.cpp @@ -33,7 +33,6 @@ #include "config.h" #include "ImageBuffer.h" -#include "Base64.h" #include "BitmapImage.h" #include "BitmapImageSingleFrameSkia.h" #include "Extensions3D.h" @@ -56,6 +55,7 @@ #include "Canvas2DLayerBridge.h" #endif +#include <wtf/text/Base64.h> #include <wtf/text/WTFString.h> using namespace std; diff --git a/Source/WebCore/platform/graphics/skia/SimpleFontDataSkia.cpp b/Source/WebCore/platform/graphics/skia/SimpleFontDataSkia.cpp index b4d20b03a..54486c3aa 100644 --- a/Source/WebCore/platform/graphics/skia/SimpleFontDataSkia.cpp +++ b/Source/WebCore/platform/graphics/skia/SimpleFontDataSkia.cpp @@ -86,7 +86,7 @@ void SimpleFontData::platformInit() float descent; // Beware those who step here: This code is designed to match Win32 font - // metrics *exactly*. + // metrics *exactly* (except the adjustment of ascent/descent on Linux/Android). if (isVDMXValid) { ascent = vdmxAscent; descent = -vdmxDescent; @@ -94,6 +94,16 @@ void SimpleFontData::platformInit() SkScalar height = -metrics.fAscent + metrics.fDescent + metrics.fLeading; ascent = SkScalarRound(-metrics.fAscent); descent = SkScalarRound(height) - ascent; +#if OS(LINUX) || OS(ANDROID) + // When subpixel positioning is enabled, if the descent is rounded down, the descent part + // of the glyph may be truncated when displayed in a 'overflow: hidden' container. + // To avoid that, borrow 1 unit from the ascent when possible. + // FIXME: This can be removed if sub-pixel ascent/descent is supported. + if (platformData().fontRenderStyle().useSubpixelPositioning && descent < SkScalarToFloat(metrics.fDescent) && ascent >= 1) { + ++descent; + --ascent; + } +#endif } m_fontMetrics.setAscent(ascent); diff --git a/Source/WebCore/platform/graphics/surfaces/GraphicsSurface.cpp b/Source/WebCore/platform/graphics/surfaces/GraphicsSurface.cpp index 018a89c9b..2b8cd6591 100644 --- a/Source/WebCore/platform/graphics/surfaces/GraphicsSurface.cpp +++ b/Source/WebCore/platform/graphics/surfaces/GraphicsSurface.cpp @@ -27,18 +27,12 @@ namespace WebCore { PassRefPtr<GraphicsSurface> GraphicsSurface::create(const IntSize& size, Flags flags, uint32_t token) { - RefPtr<GraphicsSurface> surface = adoptRef(new GraphicsSurface(size, flags)); - if (!surface->platformImport(token)) - return PassRefPtr<GraphicsSurface>(); - return surface; + return platformImport(size, flags, token); } PassRefPtr<GraphicsSurface> GraphicsSurface::create(const IntSize& size, GraphicsSurface::Flags flags) { - RefPtr<GraphicsSurface> surface = adoptRef(new GraphicsSurface(size, flags)); - if (!surface->platformCreate(size, flags)) - return PassRefPtr<GraphicsSurface>(); - return surface; + return platformCreate(size, flags); } uint32_t GraphicsSurface::exportToken() @@ -70,13 +64,19 @@ void GraphicsSurface::copyFromFramebuffer(uint32_t fbo, const IntRect& sourceRec } GraphicsSurface::GraphicsSurface(const IntSize& size, Flags flags) - : m_size(size) - , m_flags(flags) + : m_flags(flags) + , m_size(size) , m_platformSurface(0) , m_texture(0) , m_fbo(0) + , m_private(0) { } +GraphicsSurface::~GraphicsSurface() +{ + platformDestroy(); +} + } #endif diff --git a/Source/WebCore/platform/graphics/surfaces/GraphicsSurface.h b/Source/WebCore/platform/graphics/surfaces/GraphicsSurface.h index ff71fcd8c..7aeed792c 100644 --- a/Source/WebCore/platform/graphics/surfaces/GraphicsSurface.h +++ b/Source/WebCore/platform/graphics/surfaces/GraphicsSurface.h @@ -32,10 +32,14 @@ #if OS(DARWIN) typedef struct __IOSurface* IOSurfaceRef; typedef IOSurfaceRef PlatformGraphicsSurface; +#else +typedef uint32_t PlatformGraphicsSurface; #endif namespace WebCore { +struct GraphicsSurfacePrivate; + class GraphicsSurface : public RefCounted<GraphicsSurface> { public: enum Flag { @@ -69,10 +73,11 @@ public: uint32_t getTextureID(); PassOwnPtr<GraphicsContext> beginPaint(const IntRect&, LockOptions); PassRefPtr<Image> createReadOnlyImage(const IntRect&); + ~GraphicsSurface(); protected: - bool platformCreate(const IntSize&, Flags); - bool platformImport(uint32_t); + static PassRefPtr<GraphicsSurface> platformCreate(const IntSize&, Flags); + static PassRefPtr<GraphicsSurface> platformImport(const IntSize&, Flags, uint32_t); uint32_t platformExport(); void platformDestroy(); @@ -100,6 +105,7 @@ private: PlatformGraphicsSurface m_platformSurface; uint32_t m_texture; uint32_t m_fbo; + GraphicsSurfacePrivate* m_private; }; } diff --git a/Source/WebCore/platform/graphics/surfaces/mac/GraphicsSurfaceMac.cpp b/Source/WebCore/platform/graphics/surfaces/mac/GraphicsSurfaceMac.cpp index 84312def2..7131b8276 100644 --- a/Source/WebCore/platform/graphics/surfaces/mac/GraphicsSurfaceMac.cpp +++ b/Source/WebCore/platform/graphics/surfaces/mac/GraphicsSurfaceMac.cpp @@ -30,6 +30,8 @@ namespace WebCore { +struct GraphicsSurfacePrivate { }; + uint32_t GraphicsSurface::platformExport() { return IOSurfaceGetID(m_platformSurface); @@ -118,7 +120,7 @@ void GraphicsSurface::platformCopyFromFramebuffer(uint32_t originFbo, const IntR glFlush(); } -bool GraphicsSurface::platformCreate(const IntSize& size, Flags flags) +PassRefPtr<GraphicsSurface> GraphicsSurface::platformCreate(const IntSize& size, Flags flags) { unsigned pixelFormat = 'BGRA'; unsigned bytesPerElement = 4; @@ -154,14 +156,20 @@ bool GraphicsSurface::platformCreate(const IntSize& size, Flags flags) for (unsigned i = 0; i < 7; i++) CFRelease(values[i]); - m_platformSurface = IOSurfaceCreate(dict); - return !!m_platformSurface; + RefPtr<GraphicsSurface> surface = adoptRef(new GraphicsSurface(size, flags)); + surface->m_platformSurface = IOSurfaceCreate(dict); + if (!surface->m_platformSurface) + return PassRefPtr<GraphicsSurface>(); + return surface; } -bool GraphicsSurface::platformImport(uint32_t token) +PassRefPtr<GraphicsSurface> GraphicsSurface::platformImport(const IntSize& size, Flags flags, uint32_t token) { - m_platformSurface = IOSurfaceLookup(token); - return !!m_platformSurface; + RefPtr<GraphicsSurface> surface = adoptRef(new GraphicsSurface(size, flags)); + surface->m_platformSurface = IOSurfaceLookup(token); + if (!surface->m_platformSurface) + return PassRefPtr<GraphicsSurface>(); + return surface; } static int ioSurfaceLockOptions(int lockOptions) diff --git a/Source/WebCore/platform/graphics/surfaces/qt/GraphicsSurfaceGLX.cpp b/Source/WebCore/platform/graphics/surfaces/qt/GraphicsSurfaceGLX.cpp new file mode 100644 index 000000000..afc3a84f2 --- /dev/null +++ b/Source/WebCore/platform/graphics/surfaces/qt/GraphicsSurfaceGLX.cpp @@ -0,0 +1,330 @@ +/* + Copyright (C) 2012 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. + */ + +#include "config.h" +#include "GraphicsSurface.h" + +#if USE(GRAPHICS_SURFACE) + +// Qt headers must be included before glx headers. +#include <QCoreApplication> +#include <QOpenGLContext> +#include <QVector> +#include <QWindow> +#include <qpa/qplatformwindow.h> +#include <GL/glext.h> +#include <GL/glx.h> +#include <X11/extensions/Xcomposite.h> +#include <X11/extensions/Xrender.h> + +namespace WebCore { + +static long X11OverrideRedirect = 1L << 9; + +static PFNGLXBINDTEXIMAGEEXTPROC pGlXBindTexImageEXT = 0; +static PFNGLXRELEASETEXIMAGEEXTPROC pGlXReleaseTexImageEXT = 0; +static PFNGLBINDFRAMEBUFFERPROC pGlBindFramebuffer = 0; +static PFNGLBLITFRAMEBUFFERPROC pGlBlitFramebuffer = 0; + +class OffScreenRootWindow { +public: + OffScreenRootWindow() + { + ++refCount; + } + + QWindow* get(Display* dpy) + { + if (!window) { + window = new QWindow; + window->setGeometry(QRect(-1, -1, 1, 1)); + window->create(); + XSetWindowAttributes attributes; + attributes.override_redirect = true; + XChangeWindowAttributes(dpy, window->handle()->winId(), X11OverrideRedirect, &attributes); + window->show(); + } + return window; + } + + ~OffScreenRootWindow() + { + if (!--refCount) { + delete window; + window = 0; + } + } + +private: + static int refCount; + static QWindow* window; +}; + +int OffScreenRootWindow::refCount = 0; +QWindow* OffScreenRootWindow::window = 0; + +static const int glxSpec[] = { + // The specification is a set key value pairs stored in a simple array. + GLX_LEVEL, 0, + GLX_DRAWABLE_TYPE, GLX_PIXMAP_BIT | GLX_WINDOW_BIT, + GLX_BIND_TO_TEXTURE_TARGETS_EXT, GLX_TEXTURE_2D_BIT_EXT, + GLX_BIND_TO_TEXTURE_RGB_EXT, TRUE, + 0 +}; + +static const int glxAttributes[] = { + GLX_TEXTURE_FORMAT_EXT, + GLX_TEXTURE_FORMAT_RGB_EXT, + GLX_TEXTURE_TARGET_EXT, + GLX_TEXTURE_2D_EXT, + 0 +}; + +struct GraphicsSurfacePrivate { + GraphicsSurfacePrivate() + : m_display(0) + , m_xPixmap(0) + , m_glxPixmap(0) + , m_glContext(adoptPtr(new QOpenGLContext)) + , m_textureIsYInverted(false) + , m_hasAlpha(false) + { + m_display = XOpenDisplay(0); + m_glContext->create(); + } + + ~GraphicsSurfacePrivate() + { + if (m_glxPixmap) + glXDestroyPixmap(m_display, m_glxPixmap); + m_glxPixmap = 0; + + if (m_xPixmap) + XFreePixmap(m_display, m_xPixmap); + m_xPixmap = 0; + + if (m_display) + XCloseDisplay(m_display); + m_display = 0; + } + + uint32_t createSurface(const IntSize& size) + { + m_surface = adoptPtr(new QWindow(m_offScreenWindow.get(m_display))); + m_surface->setSurfaceType(QSurface::OpenGLSurface); + m_surface->setGeometry(0, 0, size.width(), size.height()); + m_surface->create(); + XCompositeRedirectWindow(m_display, m_surface->handle()->winId(), CompositeRedirectManual); + + // Make sure the XRender Extension is available. + int eventBasep, errorBasep; + if (!XRenderQueryExtension(m_display, &eventBasep, &errorBasep)) + return 0; + + m_surface->show(); + + return m_surface->handle()->winId(); + } + + void createPixmap(uint32_t winId) + { + XWindowAttributes attr; + XGetWindowAttributes(m_display, winId, &attr); + + XRenderPictFormat* format = XRenderFindVisualFormat(m_display, attr.visual); + m_hasAlpha = (format->type == PictTypeDirect && format->direct.alphaMask); + m_size = IntSize(attr.width, attr.height); + + int numberOfConfigs; + GLXFBConfig* configs = glXChooseFBConfig(m_display, XDefaultScreen(m_display), glxSpec, &numberOfConfigs); + + m_xPixmap = XCompositeNameWindowPixmap(m_display, winId); + m_glxPixmap = glXCreatePixmap(m_display, *configs, m_xPixmap, glxAttributes); + + uint inverted = 0; + glXQueryDrawable(m_display, m_glxPixmap, GLX_Y_INVERTED_EXT, &inverted); + m_textureIsYInverted = !!inverted; + + XFree(configs); + } + + void makeCurrent() + { + QOpenGLContext* glContext = QOpenGLContext::currentContext(); + if (m_surface && glContext) + glContext->makeCurrent(m_surface.get()); + } + + void swapBuffers() + { + if (!m_surface->isVisible()) + return; + + // Creating and exposing the surface is asynchronous. Therefore we have to wait here + // before swapping the buffers. This should only be the case for the very first frame. + while (!m_surface->isExposed()) + QCoreApplication::processEvents(); + + QOpenGLContext* glContext = QOpenGLContext::currentContext(); + if (m_surface && glContext) + glContext->swapBuffers(m_surface.get()); + } + + + Display* display() const { return m_display; } + + GLXPixmap glxPixmap() const { return m_glxPixmap; } + + IntSize size() const { return m_size; } + + QOpenGLContext* glContext() { return m_glContext.get(); } + +private: + OffScreenRootWindow m_offScreenWindow; + IntSize m_size; + Display* m_display; + Pixmap m_xPixmap; + GLXPixmap m_glxPixmap; + OwnPtr<QWindow> m_surface; + OwnPtr<QOpenGLContext> m_glContext; + bool m_textureIsYInverted; + bool m_hasAlpha; +}; + +static bool resolveGLMethods(GraphicsSurfacePrivate* p) +{ + static bool resolved = false; + if (resolved) + return true; + + QOpenGLContext* glContext = p->glContext(); + pGlXBindTexImageEXT = reinterpret_cast<PFNGLXBINDTEXIMAGEEXTPROC>(glContext->getProcAddress("glXBindTexImageEXT")); + pGlXReleaseTexImageEXT = reinterpret_cast<PFNGLXRELEASETEXIMAGEEXTPROC>(glContext->getProcAddress("glXReleaseTexImageEXT")); + pGlBindFramebuffer = reinterpret_cast<PFNGLBINDFRAMEBUFFERPROC>(glContext->getProcAddress("glBindFramebuffer")); + pGlBlitFramebuffer = reinterpret_cast<PFNGLBLITFRAMEBUFFERPROC>(glContext->getProcAddress("glBlitFramebuffer")); + + resolved = pGlBlitFramebuffer && pGlBindFramebuffer && pGlXBindTexImageEXT && pGlXReleaseTexImageEXT; + + return resolved; +} + +uint32_t GraphicsSurface::platformExport() +{ + return m_platformSurface; +} + +uint32_t GraphicsSurface::platformGetTextureID() +{ + if (!m_texture) + glGenTextures(1, &m_texture); + + glBindTexture(GL_TEXTURE_2D, m_texture); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + pGlXBindTexImageEXT(m_private->display(), m_private->glxPixmap(), GLX_FRONT_EXT, 0); + + return m_texture; +} + +void GraphicsSurface::platformCopyToGLTexture(uint32_t target, uint32_t id, const IntRect& targetRect, const IntPoint& offset) +{ + // This is not supported by GLX/Xcomposite. +} + +void GraphicsSurface::platformCopyFromFramebuffer(uint32_t originFbo, const IntRect& sourceRect) +{ + m_private->makeCurrent(); + int width = m_size.width(); + int height = m_size.height(); + + glPushAttrib(GL_ALL_ATTRIB_BITS); + GLint oldFBO; + glGetIntegerv(GL_FRAMEBUFFER_BINDING, &oldFBO); + pGlBindFramebuffer(GL_READ_FRAMEBUFFER, originFbo); + pGlBindFramebuffer(GL_DRAW_FRAMEBUFFER, m_private->glContext()->defaultFramebufferObject()); + pGlBlitFramebuffer(0, 0, width, height, 0, 0, width, height, GL_COLOR_BUFFER_BIT, GL_LINEAR); + pGlBindFramebuffer(GL_FRAMEBUFFER, oldFBO); + glPopAttrib(); + + m_private->swapBuffers(); +} + +PassRefPtr<GraphicsSurface> GraphicsSurface::platformCreate(const IntSize& size, Flags flags) +{ + // X11 does not support CopyToTexture, so we do not create a GraphicsSurface if this is requested. + if (flags & SupportsCopyToTexture) + return PassRefPtr<GraphicsSurface>(); + + RefPtr<GraphicsSurface> surface = adoptRef(new GraphicsSurface(size, flags)); + + surface->m_private = new GraphicsSurfacePrivate(); + if (!resolveGLMethods(surface->m_private)) + return PassRefPtr<GraphicsSurface>(); + + surface->m_platformSurface = surface->m_private->createSurface(size); + + return surface; +} + +PassRefPtr<GraphicsSurface> GraphicsSurface::platformImport(const IntSize& size, Flags flags, uint32_t token) +{ + // X11 does not support CopyToTexture, so we do not create a GraphicsSurface if this is requested. + if (flags & SupportsCopyToTexture) + return PassRefPtr<GraphicsSurface>(); + + RefPtr<GraphicsSurface> surface = adoptRef(new GraphicsSurface(size, flags)); + + surface->m_private = new GraphicsSurfacePrivate(); + if (!resolveGLMethods(surface->m_private)) + return PassRefPtr<GraphicsSurface>(); + + surface->m_platformSurface = token; + + surface->m_private->createPixmap(surface->m_platformSurface); + surface->m_size = surface->m_private->size(); + + return surface; +} + +char* GraphicsSurface::platformLock(const IntRect& rect, int* outputStride, LockOptions lockOptions) +{ + // GraphicsSurface is currently only being used for WebGL, which does not require this locking mechanism. + return 0; +} + +void GraphicsSurface::platformUnlock() +{ + // GraphicsSurface is currently only being used for WebGL, which does not require this locking mechanism. +} + +void GraphicsSurface::platformDestroy() +{ + if (m_texture) { + pGlXReleaseTexImageEXT(m_private->display(), m_private->glxPixmap(), GLX_FRONT_EXT); + glDeleteTextures(1, &m_texture); + } + + delete m_private; + m_private = 0; +} + +} +#endif diff --git a/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.cpp b/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.cpp index 4ca56c6c1..2802933a9 100644 --- a/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.cpp +++ b/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.cpp @@ -368,7 +368,7 @@ bool GraphicsLayerTextureMapper::addAnimation(const KeyframeValueList& valueList if (valueList.property() == AnimatedPropertyWebkitTransform) listsMatch = validateTransformOperations(valueList, hasBigRotation) >= 0; - m_animations.add(keyframesName, TextureMapperAnimation(valueList, boxSize, anim, timeOffset, listsMatch)); + m_animations.add(keyframesName, GraphicsLayerAnimation(valueList, boxSize, anim, timeOffset, listsMatch)); notifyChange(TextureMapperLayer::AnimationChange); m_animationStartedTimer.startOneShot(0); return true; diff --git a/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.h b/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.h index 403e5492b..c5cbbac04 100644 --- a/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.h +++ b/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.h @@ -106,7 +106,7 @@ private: bool m_fixedToViewport; TextureMapperPlatformLayer* m_contentsLayer; FloatRect m_needsDisplayRect; - TextureMapperAnimations m_animations; + GraphicsLayerAnimations m_animations; void animationStartedTimerFired(Timer<GraphicsLayerTextureMapper>*); Timer<GraphicsLayerTextureMapper> m_animationStartedTimer; }; diff --git a/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h b/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h index de2d67f73..45042ca8d 100644 --- a/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h +++ b/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h @@ -24,11 +24,11 @@ #include "FloatRect.h" #include "GraphicsContext.h" #include "GraphicsLayer.h" +#include "GraphicsLayerAnimation.h" +#include "GraphicsLayerTransform.h" #include "Image.h" #include "IntPointHash.h" -#include "LayerTransform.h" #include "TextureMapper.h" -#include "TextureMapperAnimation.h" #include "TextureMapperBackingStore.h" #include "Timer.h" #include "TransformOperations.h" @@ -56,7 +56,7 @@ public: { } }; -class TextureMapperLayer : public TextureMapperAnimationClient { +class TextureMapperLayer : public GraphicsLayerAnimation::Client { public: // This set of flags help us defer which properties of the layer have been @@ -157,6 +157,10 @@ private: void drawRepaintCounter(GraphicsContext*, GraphicsLayer*); + // GraphicsLayerAnimation::Client + void setAnimatedTransform(const TransformationMatrix& matrix) { setTransform(matrix); } + void setAnimatedOpacity(float opacity) { setOpacity(opacity); } + void syncAnimations(); bool isVisible() const; enum ContentsLayerCount { @@ -168,7 +172,7 @@ private: ContentsLayerCount countPotentialLayersWithContents() const; bool shouldPaintToIntermediateSurface() const; - LayerTransform m_transform; + GraphicsLayerTransform m_transform; inline FloatRect layerRect() const { @@ -230,7 +234,7 @@ private: State m_state; TextureMapper* m_textureMapper; - TextureMapperAnimations m_animations; + GraphicsLayerAnimations m_animations; IntPoint m_scrollPositionDelta; bool m_fixedToViewport; Color m_debugBorderColor; diff --git a/Source/WebCore/platform/graphics/win/FontCustomPlatformData.cpp b/Source/WebCore/platform/graphics/win/FontCustomPlatformData.cpp index 8348acb39..b9d90fef9 100644 --- a/Source/WebCore/platform/graphics/win/FontCustomPlatformData.cpp +++ b/Source/WebCore/platform/graphics/win/FontCustomPlatformData.cpp @@ -21,7 +21,6 @@ #include "config.h" #include "FontCustomPlatformData.h" -#include "Base64.h" #include "FontPlatformData.h" #include "OpenTypeUtilities.h" #include "SharedBuffer.h" @@ -30,6 +29,7 @@ #include <ApplicationServices/ApplicationServices.h> #include <WebKitSystemInterface/WebKitSystemInterface.h> #include <wtf/RetainPtr.h> +#include <wtf/text/Base64.h> // From t2embapi.h, which is missing from the Microsoft Platform SDK. typedef unsigned long(WINAPIV *READEMBEDPROC) (void*, void*, unsigned long); diff --git a/Source/WebCore/platform/graphics/wince/FontCustomPlatformData.cpp b/Source/WebCore/platform/graphics/wince/FontCustomPlatformData.cpp index 07a875624..844f8ec04 100644 --- a/Source/WebCore/platform/graphics/wince/FontCustomPlatformData.cpp +++ b/Source/WebCore/platform/graphics/wince/FontCustomPlatformData.cpp @@ -22,11 +22,11 @@ #include "config.h" #include "FontCustomPlatformData.h" -#include "Base64.h" #include "CachedFont.h" #include "FontPlatformData.h" #include "SharedBuffer.h" #include <wtf/RandomNumber.h> +#include <wtf/text/Base64.h> namespace WebCore { diff --git a/Source/WebCore/platform/graphics/wince/ImageBufferWinCE.cpp b/Source/WebCore/platform/graphics/wince/ImageBufferWinCE.cpp index 9c4225a3e..572070553 100644 --- a/Source/WebCore/platform/graphics/wince/ImageBufferWinCE.cpp +++ b/Source/WebCore/platform/graphics/wince/ImageBufferWinCE.cpp @@ -21,7 +21,6 @@ #include "config.h" #include "ImageBuffer.h" -#include "Base64.h" #include "GraphicsContext.h" #include "Image.h" #include "ImageData.h" diff --git a/Source/WebCore/platform/graphics/wx/ImageBufferWx.cpp b/Source/WebCore/platform/graphics/wx/ImageBufferWx.cpp index 0cdbc7b3b..57874832e 100644 --- a/Source/WebCore/platform/graphics/wx/ImageBufferWx.cpp +++ b/Source/WebCore/platform/graphics/wx/ImageBufferWx.cpp @@ -27,7 +27,6 @@ #include "config.h" #include "ImageBuffer.h" -#include "Base64.h" #include "BitmapImage.h" #include "GraphicsContext.h" #include "Image.h" diff --git a/Source/WebCore/platform/gtk/PlatformScreenGtk.cpp b/Source/WebCore/platform/gtk/PlatformScreenGtk.cpp index 5762a8fc7..712540356 100644 --- a/Source/WebCore/platform/gtk/PlatformScreenGtk.cpp +++ b/Source/WebCore/platform/gtk/PlatformScreenGtk.cpp @@ -137,7 +137,7 @@ FloatRect screenAvailableRect(Widget* widget) } -void screenColorProfile(Widget*, ColorProfile&) +void screenColorProfile(ColorProfile&) { notImplemented(); } diff --git a/Source/WebCore/platform/image-decoders/ImageDecoder.h b/Source/WebCore/platform/image-decoders/ImageDecoder.h index 760ac93f8..911878e1d 100644 --- a/Source/WebCore/platform/image-decoders/ImageDecoder.h +++ b/Source/WebCore/platform/image-decoders/ImageDecoder.h @@ -315,7 +315,7 @@ namespace WebCore { #else // FIXME: add support for multiple monitors. ColorProfile profile; - screenColorProfile(0, profile); + screenColorProfile(profile); if (!profile.isEmpty()) outputDeviceProfile = qcms_profile_from_memory(profile.data(), profile.size()); #endif diff --git a/Source/WebCore/platform/mac/CursorMac.mm b/Source/WebCore/platform/mac/CursorMac.mm index d2085339b..ac24b88c4 100644 --- a/Source/WebCore/platform/mac/CursorMac.mm +++ b/Source/WebCore/platform/mac/CursorMac.mm @@ -85,7 +85,7 @@ void Cursor::ensurePlatformCursor() const break; case Cursor::Hand: -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 m_platformCursor = [NSCursor pointingHandCursor]; #else // The pointingHandCursor from NSCursor does not have a shadow on @@ -99,7 +99,7 @@ void Cursor::ensurePlatformCursor() const break; case Cursor::Wait: -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 m_platformCursor = wkCursor("BusyButClickable"); #else m_platformCursor = createNamedCursor("waitCursor", 7, 7); @@ -107,7 +107,7 @@ void Cursor::ensurePlatformCursor() const break; case Cursor::Help: -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 m_platformCursor = wkCursor("Help"); if (m_platformCursor) break; @@ -117,7 +117,7 @@ void Cursor::ensurePlatformCursor() const case Cursor::Move: case Cursor::MiddlePanning: -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 m_platformCursor = wkCursor("Move"); #else m_platformCursor = createNamedCursor("moveCursor", 7, 7); @@ -126,7 +126,7 @@ void Cursor::ensurePlatformCursor() const case Cursor::EastResize: case Cursor::EastPanning: -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 m_platformCursor = wkCursor("ResizeEast"); #else m_platformCursor = createNamedCursor("eastResizeCursor", 14, 7); @@ -135,7 +135,7 @@ void Cursor::ensurePlatformCursor() const case Cursor::NorthResize: case Cursor::NorthPanning: -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 m_platformCursor = wkCursor("ResizeNorth"); #else m_platformCursor = createNamedCursor("northResizeCursor", 7, 1); @@ -144,7 +144,7 @@ void Cursor::ensurePlatformCursor() const case Cursor::NorthEastResize: case Cursor::NorthEastPanning: -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 m_platformCursor = wkCursor("ResizeNortheast"); #else m_platformCursor = createNamedCursor("northEastResizeCursor", 14, 1); @@ -153,7 +153,7 @@ void Cursor::ensurePlatformCursor() const case Cursor::NorthWestResize: case Cursor::NorthWestPanning: -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 m_platformCursor = wkCursor("ResizeNorthwest"); #else m_platformCursor = createNamedCursor("northWestResizeCursor", 0, 0); @@ -162,7 +162,7 @@ void Cursor::ensurePlatformCursor() const case Cursor::SouthResize: case Cursor::SouthPanning: -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 m_platformCursor = wkCursor("ResizeSouth"); #else m_platformCursor = createNamedCursor("southResizeCursor", 7, 14); @@ -171,7 +171,7 @@ void Cursor::ensurePlatformCursor() const case Cursor::SouthEastResize: case Cursor::SouthEastPanning: -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 m_platformCursor = wkCursor("ResizeSoutheast"); #else m_platformCursor = createNamedCursor("southEastResizeCursor", 14, 14); @@ -180,7 +180,7 @@ void Cursor::ensurePlatformCursor() const case Cursor::SouthWestResize: case Cursor::SouthWestPanning: -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 m_platformCursor = wkCursor("ResizeSouthwest"); #else m_platformCursor = createNamedCursor("southWestResizeCursor", 1, 14); @@ -188,7 +188,7 @@ void Cursor::ensurePlatformCursor() const break; case Cursor::WestResize: -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 m_platformCursor = wkCursor("ResizeWest"); #else m_platformCursor = createNamedCursor("westResizeCursor", 1, 7); @@ -196,7 +196,7 @@ void Cursor::ensurePlatformCursor() const break; case Cursor::NorthSouthResize: -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 m_platformCursor = wkCursor("ResizeNorthSouth"); #else m_platformCursor = createNamedCursor("northSouthResizeCursor", 7, 7); @@ -205,7 +205,7 @@ void Cursor::ensurePlatformCursor() const case Cursor::EastWestResize: case Cursor::WestPanning: -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 m_platformCursor = wkCursor("ResizeEastWest"); #else m_platformCursor = createNamedCursor("eastWestResizeCursor", 7, 7); @@ -213,7 +213,7 @@ void Cursor::ensurePlatformCursor() const break; case Cursor::NorthEastSouthWestResize: -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 m_platformCursor = wkCursor("ResizeNortheastSouthwest"); #else m_platformCursor = createNamedCursor("northEastSouthWestResizeCursor", 7, 7); @@ -221,7 +221,7 @@ void Cursor::ensurePlatformCursor() const break; case Cursor::NorthWestSouthEastResize: -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 m_platformCursor = wkCursor("ResizeNorthwestSoutheast"); #else m_platformCursor = createNamedCursor("northWestSouthEastResizeCursor", 7, 7); @@ -237,7 +237,7 @@ void Cursor::ensurePlatformCursor() const break; case Cursor::VerticalText: -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 m_platformCursor = [NSCursor IBeamCursorForVerticalLayout]; #else m_platformCursor = createNamedCursor("verticalTextCursor", 7, 7); @@ -245,7 +245,7 @@ void Cursor::ensurePlatformCursor() const break; case Cursor::Cell: -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 m_platformCursor = wkCursor("Cell"); if (m_platformCursor) break; @@ -254,7 +254,7 @@ void Cursor::ensurePlatformCursor() const break; case Cursor::ContextMenu: -#if !defined(BUILDING_ON_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 m_platformCursor = [NSCursor contextualMenuCursor]; #else m_platformCursor = createNamedCursor("contextMenuCursor", 3, 2); @@ -262,7 +262,7 @@ void Cursor::ensurePlatformCursor() const break; case Cursor::Alias: -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 m_platformCursor = wkCursor("MakeAlias"); #else m_platformCursor = createNamedCursor("aliasCursor", 11, 3); @@ -270,7 +270,7 @@ void Cursor::ensurePlatformCursor() const break; case Cursor::Progress: -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 m_platformCursor = wkCursor("BusyButClickable"); #else m_platformCursor = createNamedCursor("progressCursor", 3, 2); @@ -278,7 +278,7 @@ void Cursor::ensurePlatformCursor() const break; case Cursor::NoDrop: -#if !defined(BUILDING_ON_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 m_platformCursor = [NSCursor operationNotAllowedCursor]; #else m_platformCursor = createNamedCursor("noDropCursor", 3, 1); @@ -286,7 +286,7 @@ void Cursor::ensurePlatformCursor() const break; case Cursor::Copy: -#if !defined(BUILDING_ON_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 m_platformCursor = [NSCursor dragCopyCursor]; #else m_platformCursor = createNamedCursor("copyCursor", 3, 2); @@ -298,7 +298,7 @@ void Cursor::ensurePlatformCursor() const break; case Cursor::NotAllowed: -#if !defined(BUILDING_ON_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 m_platformCursor = [NSCursor operationNotAllowedCursor]; #else m_platformCursor = createNamedCursor("notAllowedCursor", 11, 11); @@ -306,7 +306,7 @@ void Cursor::ensurePlatformCursor() const break; case Cursor::ZoomIn: -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 m_platformCursor = wkCursor("ZoomIn"); if (m_platformCursor) break; @@ -315,7 +315,7 @@ void Cursor::ensurePlatformCursor() const break; case Cursor::ZoomOut: -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 m_platformCursor = wkCursor("ZoomOut"); if (m_platformCursor) break; diff --git a/Source/WebCore/platform/mac/DisplaySleepDisabler.cpp b/Source/WebCore/platform/mac/DisplaySleepDisabler.cpp index 10730871b..ae0cf5763 100644 --- a/Source/WebCore/platform/mac/DisplaySleepDisabler.cpp +++ b/Source/WebCore/platform/mac/DisplaySleepDisabler.cpp @@ -29,8 +29,9 @@ #include <IOKit/pwr_mgt/IOPMLib.h> #include <wtf/RetainPtr.h> -#ifdef BUILDING_ON_LEOPARD +#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1050 #include <wtf/UnusedParam.h> +#include <CoreServices/CoreServices.h> #endif namespace WebCore { @@ -39,11 +40,11 @@ static const double systemActivityInterval = 1; DisplaySleepDisabler::DisplaySleepDisabler(const char* reason) : m_disableDisplaySleepAssertion(0) -#ifdef BUILDING_ON_LEOPARD +#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1050 , m_systemActivityTimer(this, &DisplaySleepDisabler::systemActivityTimerFired) #endif { -#ifndef BUILDING_ON_LEOPARD +#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 RetainPtr<CFStringRef> reasonCF(AdoptCF, CFStringCreateWithCString(kCFAllocatorDefault, reason, kCFStringEncodingUTF8)); IOPMAssertionCreateWithName(kIOPMAssertionTypeNoDisplaySleep, kIOPMAssertionLevelOn, reasonCF.get(), &m_disableDisplaySleepAssertion); #else @@ -57,8 +58,8 @@ DisplaySleepDisabler::~DisplaySleepDisabler() { IOPMAssertionRelease(m_disableDisplaySleepAssertion); } - -#ifdef BUILDING_ON_LEOPARD + +#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1050 void DisplaySleepDisabler::systemActivityTimerFired(Timer<DisplaySleepDisabler>*) { UpdateSystemActivity(OverallAct); diff --git a/Source/WebCore/platform/mac/DisplaySleepDisabler.h b/Source/WebCore/platform/mac/DisplaySleepDisabler.h index 2e466dc16..a2d44a1e7 100644 --- a/Source/WebCore/platform/mac/DisplaySleepDisabler.h +++ b/Source/WebCore/platform/mac/DisplaySleepDisabler.h @@ -29,7 +29,7 @@ #include <wtf/Noncopyable.h> #include <wtf/PassOwnPtr.h> -#ifdef BUILDING_ON_LEOPARD +#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1050 #include "Timer.h" #endif @@ -44,12 +44,12 @@ public: private: DisplaySleepDisabler(const char* reason); -#ifdef BUILDING_ON_LEOPARD +#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1050 void systemActivityTimerFired(Timer<DisplaySleepDisabler>*); #endif uint32_t m_disableDisplaySleepAssertion; -#ifdef BUILDING_ON_LEOPARD +#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1050 Timer<DisplaySleepDisabler> m_systemActivityTimer; #endif }; diff --git a/Source/WebCore/platform/mac/EmptyProtocolDefinitions.h b/Source/WebCore/platform/mac/EmptyProtocolDefinitions.h index c11b05fb5..65a35d19b 100644 --- a/Source/WebCore/platform/mac/EmptyProtocolDefinitions.h +++ b/Source/WebCore/platform/mac/EmptyProtocolDefinitions.h @@ -29,7 +29,7 @@ @protocol NAME <NSObject> \ @end -#ifdef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MAX_ALLOWED == 1050 EMPTY_PROTOCOL(NSTableViewDataSource) EMPTY_PROTOCOL(NSTableViewDelegate) @@ -38,7 +38,7 @@ EMPTY_PROTOCOL(NSAnimationDelegate) #endif -#if defined(BUILDING_ON_LEOPARD) || defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MAX_ALLOWED <= 1060 EMPTY_PROTOCOL(NSURLConnectionDelegate) EMPTY_PROTOCOL(NSURLDownloadDelegate) diff --git a/Source/WebCore/platform/mac/HTMLConverter.h b/Source/WebCore/platform/mac/HTMLConverter.h index ea1b85db5..26bf317c3 100644 --- a/Source/WebCore/platform/mac/HTMLConverter.h +++ b/Source/WebCore/platform/mac/HTMLConverter.h @@ -79,7 +79,7 @@ namespace WebCore { } _flags; } -#if !defined(BUILDING_ON_LEOPARD) +#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 - (id)init; - (id)initWithDOMRange:(DOMRange *)domRange; diff --git a/Source/WebCore/platform/mac/HTMLConverter.mm b/Source/WebCore/platform/mac/HTMLConverter.mm index 22db81c38..67be0059c 100644 --- a/Source/WebCore/platform/mac/HTMLConverter.mm +++ b/Source/WebCore/platform/mac/HTMLConverter.mm @@ -50,7 +50,7 @@ using namespace HTMLNames; static NSFileWrapper *fileWrapperForURL(DocumentLoader *, NSURL *); static NSFileWrapper *fileWrapperForElement(Element*); -#ifndef BUILDING_ON_LEOPARD +#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 // Additional control Unicode characters const unichar WebNextLineCharacter = 0x0085; @@ -100,7 +100,7 @@ static NSFont *WebDefaultFont() @implementation WebHTMLConverter -#ifndef BUILDING_ON_LEOPARD +#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 static NSFont *_fontForNameAndSize(NSString *fontName, CGFloat size, NSMutableDictionary *cache) { @@ -1657,7 +1657,7 @@ static NSInteger _colCompare(id block1, id block2, void *) return (0 == _errorCode) ? [[_attrStr retain] autorelease] : nil; } -#endif // !defined(BUILDING_ON_LEOPARD) +#endif // PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 // This function uses TextIterator, which makes offsets in its result compatible with HTML editing. + (NSAttributedString *)editingAttributedStringFromRange:(Range*)range diff --git a/Source/WebCore/platform/mac/MemoryPressureHandlerMac.mm b/Source/WebCore/platform/mac/MemoryPressureHandlerMac.mm index 8d1d10f67..2791feb5d 100644 --- a/Source/WebCore/platform/mac/MemoryPressureHandlerMac.mm +++ b/Source/WebCore/platform/mac/MemoryPressureHandlerMac.mm @@ -33,7 +33,7 @@ #import <wtf/CurrentTime.h> #import <wtf/FastMalloc.h> -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) && !PLATFORM(IOS) +#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 #import "WebCoreSystemInterface.h" #import <notify.h> #endif @@ -42,7 +42,7 @@ using std::max; namespace WebCore { -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 #if !PLATFORM(IOS) static dispatch_source_t _cache_event_source = 0; diff --git a/Source/WebCore/platform/mac/NSScrollerImpDetails.h b/Source/WebCore/platform/mac/NSScrollerImpDetails.h index 0c956c6eb..5e2e1ae01 100644 --- a/Source/WebCore/platform/mac/NSScrollerImpDetails.h +++ b/Source/WebCore/platform/mac/NSScrollerImpDetails.h @@ -29,7 +29,7 @@ #include "config.h" // Public APIs not available on versions of Mac on which we build -#if (defined(BUILDING_ON_LEOPARD) || defined(BUILDING_ON_SNOW_LEOPARD)) +#if __MAC_OS_X_VERSION_MAX_ALLOWED <= 1060 enum { NSScrollerStyleLegacy = 0, NSScrollerStyleOverlay = 1 @@ -44,7 +44,7 @@ enum { typedef NSInteger NSScrollerKnobStyle; #endif -#if (defined(BUILDING_ON_LEOPARD) || defined(BUILDING_ON_SNOW_LEOPARD)) +#if __MAC_OS_X_VERSION_MAX_ALLOWED <= 1060 @interface NSScroller(NSObject) + (NSScrollerStyle)preferredScrollerStyle; @end diff --git a/Source/WebCore/platform/mac/PlatformEventFactoryMac.mm b/Source/WebCore/platform/mac/PlatformEventFactoryMac.mm index f0ebf5cae..2ec524c20 100644 --- a/Source/WebCore/platform/mac/PlatformEventFactoryMac.mm +++ b/Source/WebCore/platform/mac/PlatformEventFactoryMac.mm @@ -156,7 +156,7 @@ static PlatformWheelEventPhase momentumPhaseForEvent(NSEvent *event) { uint32_t phase = PlatformWheelEventPhaseNone; -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 if ([event momentumPhase] & NSEventPhaseBegan) phase |= PlatformWheelEventPhaseBegan; if ([event momentumPhase] & NSEventPhaseStationary) @@ -189,7 +189,7 @@ static PlatformWheelEventPhase momentumPhaseForEvent(NSEvent *event) static PlatformWheelEventPhase phaseForEvent(NSEvent *event) { -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 uint32_t phase = PlatformWheelEventPhaseNone; if ([event phase] & NSEventPhaseBegan) phase |= PlatformWheelEventPhaseBegan; @@ -201,7 +201,7 @@ static PlatformWheelEventPhase phaseForEvent(NSEvent *event) phase |= PlatformWheelEventPhaseEnded; if ([event phase] & NSEventPhaseCancelled) phase |= PlatformWheelEventPhaseCancelled; -#if !defined(BUILDING_ON_LION) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 if ([event momentumPhase] & NSEventPhaseMayBegin) phase |= PlatformWheelEventPhaseMayBegin; #endif diff --git a/Source/WebCore/platform/mac/PlatformScreenMac.mm b/Source/WebCore/platform/mac/PlatformScreenMac.mm index 203418b87..71cc4a149 100644 --- a/Source/WebCore/platform/mac/PlatformScreenMac.mm +++ b/Source/WebCore/platform/mac/PlatformScreenMac.mm @@ -76,7 +76,7 @@ FloatRect screenAvailableRect(Widget* widget) return toUserSpace([screenForWindow(window) visibleFrame], window); } -void screenColorProfile(Widget*, ColorProfile&) +void screenColorProfile(ColorProfile&) { notImplemented(); } diff --git a/Source/WebCore/platform/mac/PopupMenuMac.mm b/Source/WebCore/platform/mac/PopupMenuMac.mm index 855784470..c0f19745c 100644 --- a/Source/WebCore/platform/mac/PopupMenuMac.mm +++ b/Source/WebCore/platform/mac/PopupMenuMac.mm @@ -75,10 +75,10 @@ void PopupMenuMac::populate() if (!client()->shouldPopOver()) [m_popup.get() addItemWithTitle:@""]; -#ifndef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 TextDirection menuTextDirection = client()->menuStyle().textDirection(); [m_popup.get() setUserInterfaceLayoutDirection:menuTextDirection == LTR ? NSUserInterfaceLayoutDirectionLeftToRight : NSUserInterfaceLayoutDirectionRightToLeft]; -#endif // !defined(BUILDING_ON_LEOPARD) +#endif // __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 ASSERT(client()); int size = client()->listSize(); @@ -98,7 +98,7 @@ void PopupMenuMac::populate() [attributes setObject:font forKey:NSFontAttributeName]; } -#ifndef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 RetainPtr<NSMutableParagraphStyle> paragraphStyle(AdoptNS, [[NSParagraphStyle defaultParagraphStyle] mutableCopy]); [paragraphStyle.get() setAlignment:menuTextDirection == LTR ? NSLeftTextAlignment : NSRightTextAlignment]; NSWritingDirection writingDirection = style.textDirection() == LTR ? NSWritingDirectionLeftToRight : NSWritingDirectionRightToLeft; @@ -109,7 +109,7 @@ void PopupMenuMac::populate() [attributes setObject:writingDirectionArray.get() forKey:NSWritingDirectionAttributeName]; } [attributes setObject:paragraphStyle.get() forKey:NSParagraphStyleAttributeName]; -#endif // !defined(BUILDING_ON_LEOPARD) +#endif // __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 // FIXME: Add support for styling the foreground and background colors. // FIXME: Find a way to customize text color when an item is highlighted. diff --git a/Source/WebCore/platform/mac/ScrollAnimatorMac.mm b/Source/WebCore/platform/mac/ScrollAnimatorMac.mm index 9688c0aaf..600dee583 100644 --- a/Source/WebCore/platform/mac/ScrollAnimatorMac.mm +++ b/Source/WebCore/platform/mac/ScrollAnimatorMac.mm @@ -635,7 +635,7 @@ ScrollAnimatorMac::~ScrollAnimatorMac() static bool scrollAnimationEnabledForSystem() { -#if defined(BUILDING_ON_SNOW_LEOPARD) || defined(BUILDING_ON_LION) || PLATFORM(CHROMIUM) +#if __MAC_OS_X_VERSION_MIN_REQUIRED <= 1070 || PLATFORM(CHROMIUM) return [[NSUserDefaults standardUserDefaults] boolForKey:@"AppleScrollAnimationEnabled"]; #else return [[NSUserDefaults standardUserDefaults] boolForKey:@"NSScrollAnimationEnabled"]; diff --git a/Source/WebCore/platform/mac/ScrollElasticityController.mm b/Source/WebCore/platform/mac/ScrollElasticityController.mm index 7a753846b..f2845134e 100644 --- a/Source/WebCore/platform/mac/ScrollElasticityController.mm +++ b/Source/WebCore/platform/mac/ScrollElasticityController.mm @@ -33,7 +33,7 @@ #if ENABLE(RUBBER_BANDING) -#ifdef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED == 1050 @interface NSProcessInfo (ScrollAnimatorMacExt) - (NSTimeInterval)systemUptime; @end @@ -71,8 +71,7 @@ static const float scrollVelocityZeroingTimeout = 0.10f; static const float rubberbandDirectionLockStretchRatio = 1; static const float rubberbandMinimumRequiredDeltaBeforeStretch = 10; -#if defined(BUILDING_ON_LEOPARD) || defined(BULDING_ON_SNOW_LEOPARD) || \ - defined(BUILDING_ON_LION) || PLATFORM(CHROMIUM) +#if __MAC_OS_X_VERSION_MIN_REQUIRED <= 1070 || PLATFORM(CHROMIUM) static const float rubberbandStiffness = 20; static const float rubberbandAmplitude = 0.31f; static const float rubberbandPeriod = 1.6f; diff --git a/Source/WebCore/platform/mac/SharedTimerMac.mm b/Source/WebCore/platform/mac/SharedTimerMac.mm index d7c501dc0..3d01a33c7 100644 --- a/Source/WebCore/platform/mac/SharedTimerMac.mm +++ b/Source/WebCore/platform/mac/SharedTimerMac.mm @@ -36,7 +36,7 @@ #include <stdio.h> // On Snow Leopard and newer we'll ask IOKit to deliver notifications on a queue. -#ifdef BUILDING_ON_LEOPARD +#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1050 #define IOKIT_WITHOUT_LIBDISPATCH 1 #endif @@ -46,7 +46,7 @@ static CFRunLoopTimerRef sharedTimer; static void (*sharedTimerFiredFunction)(); static void timerFired(CFRunLoopTimerRef, void*); -#if !defined(IOKIT_WITHOUT_LIBDISPATCH) && defined(BUILDING_ON_SNOW_LEOPARD) +#if !defined(IOKIT_WITHOUT_LIBDISPATCH) && !PLATFORM(IOS) && __MAC_OS_X_VERSION_MAX_ALLOWED == 1060 extern "C" void IONotificationPortSetDispatchQueue(IONotificationPortRef notify, dispatch_queue_t queue); #endif diff --git a/Source/WebCore/platform/mac/SuddenTermination.mm b/Source/WebCore/platform/mac/SuddenTermination.mm index f62411652..406b3bb23 100644 --- a/Source/WebCore/platform/mac/SuddenTermination.mm +++ b/Source/WebCore/platform/mac/SuddenTermination.mm @@ -26,7 +26,7 @@ #import "config.h" #import "SuddenTermination.h" -#ifndef BUILDING_ON_LEOPARD +#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 namespace WebCore { diff --git a/Source/WebCore/platform/mac/WebCoreFullScreenWindow.mm b/Source/WebCore/platform/mac/WebCoreFullScreenWindow.mm index f62d14a03..cc6ea34d1 100644 --- a/Source/WebCore/platform/mac/WebCoreFullScreenWindow.mm +++ b/Source/WebCore/platform/mac/WebCoreFullScreenWindow.mm @@ -42,7 +42,7 @@ [self setAcceptsMouseMovedEvents:YES]; [self setReleasedWhenClosed:NO]; [self setHasShadow:NO]; -#ifndef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 [self setMovable:NO]; #else [self setMovableByWindowBackground:NO]; diff --git a/Source/WebCore/platform/mac/WebCoreNSCellExtras.h b/Source/WebCore/platform/mac/WebCoreNSCellExtras.h index 26be462e1..7894d3de8 100644 --- a/Source/WebCore/platform/mac/WebCoreNSCellExtras.h +++ b/Source/WebCore/platform/mac/WebCoreNSCellExtras.h @@ -25,7 +25,7 @@ #import <AppKit/AppKit.h> -#define BUTTON_CELL_DRAW_WITH_FRAME_DRAWS_FOCUS_RING (defined(BUILDING_ON_SNOW_LEOPARD) || defined(BUILDING_ON_LION) || PLATFORM(CHROMIUM)) +#define BUTTON_CELL_DRAW_WITH_FRAME_DRAWS_FOCUS_RING (__MAC_OS_X_VERSION_MIN_REQUIRED <= 1070 || PLATFORM(CHROMIUM)) #if !BUTTON_CELL_DRAW_WITH_FRAME_DRAWS_FOCUS_RING diff --git a/Source/WebCore/platform/mac/WebCoreSystemInterface.h b/Source/WebCore/platform/mac/WebCoreSystemInterface.h index 908dd95a9..ea7c215ca 100644 --- a/Source/WebCore/platform/mac/WebCoreSystemInterface.h +++ b/Source/WebCore/platform/mac/WebCoreSystemInterface.h @@ -58,7 +58,7 @@ typedef UInt32 FMFont; typedef FMFont ATSUFontID; typedef UInt16 ATSGlyphRef; -#if PLATFORM(MAC) && USE(CA) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if PLATFORM(MAC) && USE(CA) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 typedef struct __IOSurface *IOSurfaceRef; #endif @@ -109,7 +109,7 @@ extern "C" { // In alphabetical order. extern void (*wkAdvanceDefaultButtonPulseAnimation)(NSButtonCell *); -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 extern void (*wkCALayerEnumerateRectsBeingDrawnWithBlock)(CALayer *, CGContextRef, void (^block)(CGRect rect)); #endif @@ -215,7 +215,7 @@ extern bool (*wkGetVerticalGlyphsForCharacters)(CTFontRef, const UniChar[], CGGl extern BOOL (*wkUseSharedMediaUI)(); -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 extern void* wkGetHyphenationLocationBeforeIndex; #else extern CFIndex (*wkGetHyphenationLocationBeforeIndex)(CFStringRef string, CFIndex index); @@ -232,7 +232,7 @@ extern int (*wkGetNSEventMomentumPhase)(NSEvent *); extern CTLineRef (*wkCreateCTLineWithUniCharProvider)(const UniChar* (*provide)(CFIndex stringIndex, CFIndex* charCount, CFDictionaryRef* attributes, void*), void (*dispose)(const UniChar* chars, void*), void*); -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 extern CTTypesetterRef (*wkCreateCTTypesetterWithUniCharProviderAndOptions)(const UniChar* (*provide)(CFIndex stringIndex, CFIndex* charCount, CFDictionaryRef* attributes, void*), void (*dispose)(const UniChar* chars, void*), void*, CFDictionaryRef options); @@ -264,7 +264,7 @@ extern CFTypeRef (*wkCreateAXTextMarker)(const void *bytes, size_t len); extern BOOL (*wkGetBytesFromAXTextMarker)(CFTypeRef textMarker, void *bytes, size_t length); extern AXUIElementRef (*wkCreateAXUIElementRef)(id element); -#if defined(BUILDING_ON_SNOW_LEOPARD) || defined(BUILDING_ON_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED <= 1060 typedef struct __CFURLStorageSession* CFURLStorageSessionRef; #else typedef const struct __CFURLStorageSession* CFURLStorageSessionRef; @@ -296,27 +296,27 @@ extern void (*wkSetRequestStorageSession)(CFURLStorageSessionRef, CFMutableURLRe #endif extern void (*wkSetMetadataURL)(NSString *urlString, NSString *referrer, NSString *path); -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 #import <dispatch/dispatch.h> extern dispatch_source_t (*wkCreateVMPressureDispatchOnMainQueue)(void); #endif -#if !defined(BUILDING_ON_SNOW_LEOPARD) && !defined(BUILDING_ON_LION) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 extern NSString *(*wkGetMacOSXVersionString)(void); extern bool (*wkExecutableWasLinkedOnOrBeforeLion)(void); #endif -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 extern void (*wkCGPathAddRoundedRect)(CGMutablePathRef path, const CGAffineTransform* matrix, CGRect rect, CGFloat cornerWidth, CGFloat cornerHeight); #endif -#if !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 extern void (*wkCFURLRequestAllowAllPostCaching)(CFURLRequestRef); #endif -#if !defined(BUILDING_ON_SNOW_LEOPARD) && !defined(BUILDING_ON_LION) && !PLATFORM(IOS) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 && !PLATFORM(IOS) extern BOOL (*wkFilterIsManagedSession)(void); extern WebFilterEvaluator *(*wkFilterCreateInstance)(NSURLResponse *); extern void (*wkFilterRelease)(WebFilterEvaluator *); diff --git a/Source/WebCore/platform/mac/WebCoreSystemInterface.mm b/Source/WebCore/platform/mac/WebCoreSystemInterface.mm index c087a5d87..6a6cc4b1d 100644 --- a/Source/WebCore/platform/mac/WebCoreSystemInterface.mm +++ b/Source/WebCore/platform/mac/WebCoreSystemInterface.mm @@ -28,7 +28,7 @@ #import <Foundation/Foundation.h> void (*wkAdvanceDefaultButtonPulseAnimation)(NSButtonCell *); -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 void (*wkCALayerEnumerateRectsBeingDrawnWithBlock)(CALayer *, CGContextRef context, void (^block)(CGRect rect)); #endif BOOL (*wkCGContextGetShouldSmoothFonts)(CGContextRef); @@ -125,7 +125,7 @@ void (*wkSetRequestStorageSession)(CFURLStorageSessionRef, CFMutableURLRequestRe void (*wkGetGlyphsForCharacters)(CGFontRef, const UniChar[], CGGlyph[], size_t); bool (*wkGetVerticalGlyphsForCharacters)(CTFontRef, const UniChar[], CGGlyph[], size_t); -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 void* wkGetHyphenationLocationBeforeIndex; #else CFIndex (*wkGetHyphenationLocationBeforeIndex)(CFStringRef string, CFIndex index); @@ -133,7 +133,7 @@ int (*wkGetNSEventMomentumPhase)(NSEvent *); #endif CTLineRef (*wkCreateCTLineWithUniCharProvider)(const UniChar* (*provide)(CFIndex stringIndex, CFIndex* charCount, CFDictionaryRef* attributes, void*), void (*dispose)(const UniChar* chars, void*), void*); -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 CTTypesetterRef (*wkCreateCTTypesetterWithUniCharProviderAndOptions)(const UniChar* (*provide)(CFIndex stringIndex, CFIndex* charCount, CFDictionaryRef* attributes, void*), void (*dispose)(const UniChar* chars, void*), void*, CFDictionaryRef options); CGContextRef (*wkIOSurfaceContextCreate)(IOSurfaceRef surface, unsigned width, unsigned height, CGColorSpaceRef colorSpace); @@ -178,24 +178,24 @@ CFStringRef (*wkCopyCFURLResponseSuggestedFilename)(CFURLResponseRef); void (*wkSetCFURLResponseMIMEType)(CFURLResponseRef, CFStringRef mimeType); void (*wkSetMetadataURL)(NSString *urlString, NSString *referrer, NSString *path); -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 dispatch_source_t (*wkCreateVMPressureDispatchOnMainQueue)(void); #endif -#if !defined(BUILDING_ON_SNOW_LEOPARD) && !defined(BUILDING_ON_LION) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 NSString *(*wkGetMacOSXVersionString)(void); bool (*wkExecutableWasLinkedOnOrBeforeLion)(void); #endif -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 void (*wkCGPathAddRoundedRect)(CGMutablePathRef path, const CGAffineTransform* matrix, CGRect rect, CGFloat cornerWidth, CGFloat cornerHeight); #endif -#if !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 void (*wkCFURLRequestAllowAllPostCaching)(CFURLRequestRef); #endif -#if !defined(BUILDING_ON_SNOW_LEOPARD) && !defined(BUILDING_ON_LION) && !PLATFORM(IOS) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 && !PLATFORM(IOS) BOOL (*wkFilterIsManagedSession)(void); WebFilterEvaluator *(*wkFilterCreateInstance)(NSURLResponse *); void (*wkFilterRelease)(WebFilterEvaluator *); diff --git a/Source/WebCore/platform/mac/WebFontCache.mm b/Source/WebCore/platform/mac/WebFontCache.mm index be666cf5f..c9692b287 100644 --- a/Source/WebCore/platform/mac/WebFontCache.mm +++ b/Source/WebCore/platform/mac/WebFontCache.mm @@ -104,7 +104,7 @@ static BOOL betterChoice(NSFontTraitMask desiredTraits, int desiredWeight, // Workaround for <rdar://problem/5781372>. static inline void fixUpWeight(NSInteger& weight, NSString *fontName) { -#ifndef BUILDING_ON_LEOPARD +#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 UNUSED_PARAM(weight); UNUSED_PARAM(fontName); #else diff --git a/Source/WebCore/platform/mac/WebVideoFullscreenController.mm b/Source/WebCore/platform/mac/WebVideoFullscreenController.mm index 47c5391c6..ce35fb1d8 100644 --- a/Source/WebCore/platform/mac/WebVideoFullscreenController.mm +++ b/Source/WebCore/platform/mac/WebVideoFullscreenController.mm @@ -53,7 +53,7 @@ SOFT_LINK_POINTER(QTKit, QTMovieRateDidChangeNotification, NSString *) #define QTMovieRateDidChangeNotification getQTMovieRateDidChangeNotification() @interface WebVideoFullscreenWindow : NSWindow -#ifndef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 <NSAnimationDelegate> #endif { @@ -339,7 +339,7 @@ static NSWindow *createBackgroundFullscreenWindow(NSRect frame, int level) - (void)updateMenuAndDockForFullscreen { // NSApplicationPresentationOptions is available on > 10.6 only: -#ifndef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 NSApplicationPresentationOptions options = NSApplicationPresentationDefault; NSScreen* fullscreenScreen = [[self window] screen]; diff --git a/Source/WebCore/platform/mac/WebVideoFullscreenHUDWindowController.mm b/Source/WebCore/platform/mac/WebVideoFullscreenHUDWindowController.mm index 631828acc..90f691d7c 100644 --- a/Source/WebCore/platform/mac/WebVideoFullscreenHUDWindowController.mm +++ b/Source/WebCore/platform/mac/WebVideoFullscreenHUDWindowController.mm @@ -44,10 +44,10 @@ static inline CGFloat webkit_CGFloor(CGFloat value) return floor(value); } -#define HAVE_MEDIA_CONTROL (!defined(BUILDING_ON_LEOPARD)) +#define HAVE_MEDIA_CONTROL (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1060) @interface WebVideoFullscreenHUDWindowController (Private) -#if !defined(BUILDING_ON_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 <NSWindowDelegate> #endif diff --git a/Source/WebCore/platform/network/Credential.h b/Source/WebCore/platform/network/Credential.h index aae4d52eb..d43ae8fb8 100644 --- a/Source/WebCore/platform/network/Credential.h +++ b/Source/WebCore/platform/network/Credential.h @@ -27,7 +27,7 @@ #include "PlatformString.h" -#define CERTIFICATE_CREDENTIALS_SUPPORTED ((PLATFORM(MAC) || PLATFORM(IOS)) && !defined(BUILDING_ON_LEOPARD)) +#define CERTIFICATE_CREDENTIALS_SUPPORTED (PLATFORM(MAC) && (PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060)) #if CERTIFICATE_CREDENTIALS_SUPPORTED #include <Security/SecBase.h> diff --git a/Source/WebCore/platform/network/DataURL.cpp b/Source/WebCore/platform/network/DataURL.cpp index 25a443e83..aae525c25 100644 --- a/Source/WebCore/platform/network/DataURL.cpp +++ b/Source/WebCore/platform/network/DataURL.cpp @@ -27,13 +27,13 @@ #include "config.h" #include "DataURL.h" -#include "Base64.h" #include "HTTPParsers.h" #include "ResourceHandle.h" #include "ResourceHandleClient.h" #include "ResourceRequest.h" #include "ResourceResponse.h" #include "TextEncoding.h" +#include <wtf/text/Base64.h> #include <wtf/text/CString.h> namespace WebCore { @@ -75,7 +75,7 @@ void handleDataURL(ResourceHandle* handle) handle->client()->didReceiveResponse(handle, response); Vector<char> out; - if (base64Decode(data, out, IgnoreWhitespace) && out.size() > 0) { + if (base64Decode(data, out, Base64IgnoreWhitespace) && out.size() > 0) { response.setExpectedContentLength(out.size()); handle->client()->didReceiveData(handle, out.data(), out.size(), 0); } diff --git a/Source/WebCore/platform/network/ResourceHandle.h b/Source/WebCore/platform/network/ResourceHandle.h index ddca0d22f..840097006 100644 --- a/Source/WebCore/platform/network/ResourceHandle.h +++ b/Source/WebCore/platform/network/ResourceHandle.h @@ -67,7 +67,7 @@ typedef int CFHTTPCookieStorageAcceptPolicy; typedef struct OpaqueCFHTTPCookieStorage* CFHTTPCookieStorageRef; #endif -#if USE(CFURLSTORAGESESSIONS) && (defined(BUILDING_ON_SNOW_LEOPARD) || defined(BUILDING_ON_LEOPARD)) +#if USE(CFURLSTORAGESESSIONS) && PLATFORM(MAC) && !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED <= 1060 typedef struct __CFURLStorageSession* CFURLStorageSessionRef; #elif USE(CFURLSTORAGESESSIONS) typedef const struct __CFURLStorageSession* CFURLStorageSessionRef; diff --git a/Source/WebCore/platform/network/blackberry/NetworkJob.cpp b/Source/WebCore/platform/network/blackberry/NetworkJob.cpp index c64fdc8aa..a48324763 100644 --- a/Source/WebCore/platform/network/blackberry/NetworkJob.cpp +++ b/Source/WebCore/platform/network/blackberry/NetworkJob.cpp @@ -20,6 +20,7 @@ #include "NetworkJob.h" #include "AboutData.h" +#include "AboutTemplate.html.cpp" #include "Chrome.h" #include "ChromeClient.h" #include "CookieManager.h" @@ -480,7 +481,8 @@ void NetworkJob::handleNotifyClose(int status) sendResponseIfNeeded(); if (isClientAvailable()) { - + if (isError(status)) + m_extendedStatusCode = status; RecursionGuard guard(m_callingClient); if (shouldNotifyClientFailed()) { String domain = m_extendedStatusCode < 0 ? ResourceError::platformErrorDomain : ResourceError::httpErrorDomain; @@ -800,6 +802,12 @@ void NetworkJob::storeCredentials() CredentialStorage::set(challenge.proposedCredential(), challenge.protectionSpace(), m_response.url()); challenge.setStored(true); + + if (challenge.protectionSpace().serverType() == ProtectionSpaceProxyHTTP) { + BlackBerry::Platform::Client::get()->setProxyCredential(challenge.proposedCredential().user().utf8().data(), + challenge.proposedCredential().password().utf8().data()); + m_frame->page()->chrome()->client()->platformPageClient()->syncProxyCredential(challenge.proposedCredential()); + } } void NetworkJob::purgeCredentials() @@ -837,7 +845,8 @@ void NetworkJob::handleAbout() if (equalIgnoringCase(aboutWhat, "blank")) { handled = true; } else if (equalIgnoringCase(aboutWhat, "credits")) { - result.append(String("<html><head><title>Open Source Credits</title> <style> .about {padding:14px;} </style> <meta name=\"viewport\" content=\"width=device-width, user-scalable=no\"></head><body>")); + result.append(writeHeader("Credits")); + result.append(String("<style> .about {padding:14px;} </style>")); result.append(String(BlackBerry::Platform::WEBKITCREDITS)); result.append(String("</body></html>")); handled = true; @@ -877,16 +886,18 @@ void NetworkJob::handleAbout() result.append(String("</body></html>")); handled = true; } else if (equalIgnoringCase(aboutWhat, "version")) { - result.append(String("<html><meta name=\"viewport\" content=\"width=device-width, user-scalable=no\"></head><body>")); + result.append(writeHeader("Version")); + result.append(String("<div class='box'><div class='box-title'>Build Time</div><br>")); result.append(String(BlackBerry::Platform::BUILDTIME)); - result.append(String("</body></html>")); + result.append(String("</div><br><div style='font-size:10px;text-align:center;'>Also see the <A href='about:build'>build information</A>.</body></html>")); handled = true; } else if (BlackBerry::Platform::debugSetting() > 0 && equalIgnoringCase(aboutWhat, "config")) { result = configPage(); handled = true; } else if (BlackBerry::Platform::debugSetting() > 0 && equalIgnoringCase(aboutWhat, "build")) { - result.append(String("<html><head><title>BlackBerry Browser Build Information</title></head><body><table>")); - result.append(String("<tr><td>Build Computer: </td><td>")); + result.append(writeHeader("Build")); + result.append(String("<div class='box'><div class='box-title'>Basic</div><table>")); + result.append(String("<tr><td>Built On: </td><td>")); result.append(String(BlackBerry::Platform::BUILDCOMPUTER)); result.append(String("</td></tr>")); result.append(String("<tr><td>Build User: </td><td>")); @@ -894,11 +905,11 @@ void NetworkJob::handleAbout() result.append(String("</td></tr>")); result.append(String("<tr><td>Build Time: </td><td>")); result.append(String(BlackBerry::Platform::BUILDTIME)); - result.append(String("</td></tr><tr><td></td><td></td></tr>")); + result.append(String("</table></div><br>")); result.append(String(BlackBerry::Platform::BUILDINFO_WEBKIT)); result.append(String(BlackBerry::Platform::BUILDINFO_PLATFORM)); result.append(String(BlackBerry::Platform::BUILDINFO_LIBWEBVIEW)); - result.append(String("</table></body></html>")); + result.append(String("</body></html>")); handled = true; } else if (equalIgnoringCase(aboutWhat, "memory")) { result = memoryPage(); diff --git a/Source/WebCore/platform/network/blackberry/NetworkJob.h b/Source/WebCore/platform/network/blackberry/NetworkJob.h index a9a7b881b..acc07dcbf 100644 --- a/Source/WebCore/platform/network/blackberry/NetworkJob.h +++ b/Source/WebCore/platform/network/blackberry/NetworkJob.h @@ -80,6 +80,7 @@ public: void handleNotifyDataSent(unsigned long long bytesSent, unsigned long long totalBytesToBeSent); virtual void notifyClose(int status); void handleNotifyClose(int status); + virtual int status() const { return m_extendedStatusCode; } private: bool isClientAvailable() const { return !m_cancelled && m_handle && m_handle->client(); } diff --git a/Source/WebCore/platform/network/blackberry/ResourceRequestBlackBerry.cpp b/Source/WebCore/platform/network/blackberry/ResourceRequestBlackBerry.cpp index 5cffde039..3c439d91f 100644 --- a/Source/WebCore/platform/network/blackberry/ResourceRequestBlackBerry.cpp +++ b/Source/WebCore/platform/network/blackberry/ResourceRequestBlackBerry.cpp @@ -55,6 +55,8 @@ static inline NetworkRequest::TargetType platformTargetTypeForRequest(const Reso { if (request.isXMLHTTPRequest()) return NetworkRequest::TargetIsXMLHTTPRequest; + if (request.forceDownload()) + return NetworkRequest::TargetIsDownload; switch (request.targetType()) { case ResourceRequest::TargetIsMainFrame: diff --git a/Source/WebCore/platform/network/blackberry/SocketStreamHandle.h b/Source/WebCore/platform/network/blackberry/SocketStreamHandle.h index 73b118fef..fce05f1c4 100644 --- a/Source/WebCore/platform/network/blackberry/SocketStreamHandle.h +++ b/Source/WebCore/platform/network/blackberry/SocketStreamHandle.h @@ -57,6 +57,7 @@ public: virtual void notifyDataReceived(BlackBerry::Platform::NetworkBuffer*); virtual void notifyReadyToSendData(); virtual void notifyClose(int status); + virtual int status() const { return m_status; } protected: virtual int platformSend(const char* data, int length); @@ -66,6 +67,7 @@ private: SocketStreamHandle(const String& groupName, const KURL&, SocketStreamHandleClient*); OwnPtr<BlackBerry::Platform::FilterStream> m_socketStream; + int m_status; }; } // namespace WebCore diff --git a/Source/WebCore/platform/network/blackberry/SocketStreamHandleBlackBerry.cpp b/Source/WebCore/platform/network/blackberry/SocketStreamHandleBlackBerry.cpp index 0fd0e6961..90ed528a7 100644 --- a/Source/WebCore/platform/network/blackberry/SocketStreamHandleBlackBerry.cpp +++ b/Source/WebCore/platform/network/blackberry/SocketStreamHandleBlackBerry.cpp @@ -105,7 +105,7 @@ void SocketStreamHandle::notifyStatusReceived(int status, const char* message) // The client can close the handle, potentially removing the last reference. RefPtr<SocketStreamHandle> protect(this); - + m_status = status; if (FilterStream::StatusSuccess != status) m_client->didFailSocketStream(this, SocketStreamError(status)); else { @@ -135,6 +135,9 @@ void SocketStreamHandle::notifyClose(int status) // The client can close the handle, potentially removing the last reference. RefPtr<SocketStreamHandle> protect(this); + if (status < 0 || (400 <= status && status < 600)) + m_status = status; + if (FilterStream::StatusSuccess != status) m_client->didFailSocketStream(this, SocketStreamError(status)); diff --git a/Source/WebCore/platform/network/cf/DNSCFNet.cpp b/Source/WebCore/platform/network/cf/DNSCFNet.cpp index 28c95df97..3f901a541 100644 --- a/Source/WebCore/platform/network/cf/DNSCFNet.cpp +++ b/Source/WebCore/platform/network/cf/DNSCFNet.cpp @@ -42,7 +42,7 @@ #include <CFNetwork/CFNetwork.h> #endif -#if defined(BUILDING_ON_LEOPARD) +#if PLATFORM(MAC) && !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1050 #include <SystemConfiguration/SystemConfiguration.h> #endif @@ -56,7 +56,7 @@ bool DNSResolveQueue::platformProxyIsEnabledInSystemPreferences() // as it doesn't necessarily look up the actual external IP. Also, if DNS returns a fake internal address, // local caches may keep it even after re-connecting to another network. -#if !defined(BUILDING_ON_LEOPARD) +#if !PLATFORM(MAC) || PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 RetainPtr<CFDictionaryRef> proxySettings(AdoptCF, CFNetworkCopySystemProxySettings()); #else RetainPtr<CFDictionaryRef> proxySettings(AdoptCF, SCDynamicStoreCopyProxies(0)); diff --git a/Source/WebCore/platform/network/cf/ProxyServerCFNet.cpp b/Source/WebCore/platform/network/cf/ProxyServerCFNet.cpp index 6b0c8b0c5..74db9ee6b 100644 --- a/Source/WebCore/platform/network/cf/ProxyServerCFNet.cpp +++ b/Source/WebCore/platform/network/cf/ProxyServerCFNet.cpp @@ -37,7 +37,7 @@ namespace WebCore { -#ifndef BUILDING_ON_LEOPARD +#if !PLATFORM(MAC) || PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 static void processProxyServers(Vector<ProxyServer>& proxyServers, CFArrayRef proxies, CFURLRef url); diff --git a/Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp b/Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp index 677eee6c1..f6d1f3821 100644 --- a/Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp +++ b/Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp @@ -29,7 +29,6 @@ #include "AuthenticationCF.h" #include "AuthenticationChallenge.h" -#include "Base64.h" #include "CookieStorageCFNet.h" #include "CredentialStorage.h" #include "CachedResourceLoader.h" @@ -48,6 +47,7 @@ #include <sys/types.h> #include <wtf/HashMap.h> #include <wtf/Threading.h> +#include <wtf/text/Base64.h> #include <wtf/text/CString.h> #if PLATFORM(MAC) diff --git a/Source/WebCore/platform/network/cf/ResourceRequest.h b/Source/WebCore/platform/network/cf/ResourceRequest.h index 72522d9ed..64be955f6 100644 --- a/Source/WebCore/platform/network/cf/ResourceRequest.h +++ b/Source/WebCore/platform/network/cf/ResourceRequest.h @@ -36,7 +36,7 @@ typedef const struct _CFURLRequest* CFURLRequestRef; OBJC_CLASS NSURLRequest; -#if USE(CFURLSTORAGESESSIONS) && (defined(BUILDING_ON_SNOW_LEOPARD) || defined(BUILDING_ON_LEOPARD)) +#if USE(CFURLSTORAGESESSIONS) && PLATFORM(MAC) && !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED <= 1060 typedef struct __CFURLStorageSession* CFURLStorageSessionRef; #elif USE(CFURLSTORAGESESSIONS) typedef const struct __CFURLStorageSession* CFURLStorageSessionRef; diff --git a/Source/WebCore/platform/network/cf/ResourceRequestCFNet.cpp b/Source/WebCore/platform/network/cf/ResourceRequestCFNet.cpp index 7ce9b6039..520d68578 100644 --- a/Source/WebCore/platform/network/cf/ResourceRequestCFNet.cpp +++ b/Source/WebCore/platform/network/cf/ResourceRequestCFNet.cpp @@ -265,7 +265,7 @@ void ResourceRequest::setHTTPPipeliningEnabled(bool flag) s_httpPipeliningEnabled = flag; } -#if USE(CFNETWORK) || PLATFORM(MAC) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if USE(CFNETWORK) || PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 static inline bool readBooleanPreference(CFStringRef key) { Boolean keyExistsAndHasValidFormat; @@ -281,7 +281,7 @@ unsigned initializeMaximumHTTPConnectionCountPerHost() // Always set the connection count per host, even when pipelining. unsigned maximumHTTPConnectionCountPerHost = wkInitializeMaximumHTTPConnectionCountPerHost(preferredConnectionCount); -#if USE(CFNETWORK) || PLATFORM(MAC) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if USE(CFNETWORK) || PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 static const unsigned unlimitedConnectionCount = 10000; if (!ResourceRequest::httpPipeliningEnabled() && readBooleanPreference(CFSTR("WebKitEnableHTTPPipelining"))) diff --git a/Source/WebCore/platform/network/cf/SocketStreamHandleCFNet.cpp b/Source/WebCore/platform/network/cf/SocketStreamHandleCFNet.cpp index 9033340d8..d86c76bc6 100644 --- a/Source/WebCore/platform/network/cf/SocketStreamHandleCFNet.cpp +++ b/Source/WebCore/platform/network/cf/SocketStreamHandleCFNet.cpp @@ -41,7 +41,7 @@ #include <wtf/MainThread.h> #include <wtf/text/WTFString.h> -#ifdef BUILDING_ON_LEOPARD +#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1050 #include <SystemConfiguration/SystemConfiguration.h> #endif @@ -176,7 +176,7 @@ void SocketStreamHandle::removePACRunLoopSource() void SocketStreamHandle::chooseProxy() { -#ifndef BUILDING_ON_LEOPARD +#if !PLATFORM(MAC) || PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 RetainPtr<CFDictionaryRef> proxyDictionary(AdoptCF, CFNetworkCopySystemProxySettings()); #else // We don't need proxy information often, so there is no need to set up a permanent dynamic store session. diff --git a/Source/WebCore/platform/network/mac/AuthenticationMac.mm b/Source/WebCore/platform/network/mac/AuthenticationMac.mm index 82c660a6e..050268931 100644 --- a/Source/WebCore/platform/network/mac/AuthenticationMac.mm +++ b/Source/WebCore/platform/network/mac/AuthenticationMac.mm @@ -165,7 +165,7 @@ NSURLCredential *mac(const Credential& coreCredential) #else -#ifdef BUILDING_ON_LEOPARD +#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1050 // There is no constant in headers, but NTLM is supported. NSString * const NSURLAuthenticationMethodNTLM = @"NSURLAuthenticationMethodNTLM"; #endif diff --git a/Source/WebCore/platform/network/mac/CookieStorageMac.mm b/Source/WebCore/platform/network/mac/CookieStorageMac.mm index 25b4d44f2..1de6888a2 100644 --- a/Source/WebCore/platform/network/mac/CookieStorageMac.mm +++ b/Source/WebCore/platform/network/mac/CookieStorageMac.mm @@ -79,7 +79,7 @@ namespace WebCore { void setCookieStoragePrivateBrowsingEnabled(bool enabled) { -#if defined(BUILDING_ON_SNOW_LEOPARD) && USE(CFURLSTORAGESESSIONS) +#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1060 && USE(CFURLSTORAGESESSIONS) // Don't call wkSetCookieStoragePrivateBrowsingEnabled() when cookie storage is set up via sessions. // That would make NSURLConnect use global private browsing cookie storage regardless of request session. // The global private cookie storage has different semantics - it makes new cookies non-persistent, diff --git a/Source/WebCore/platform/network/mac/ResourceHandleMac.mm b/Source/WebCore/platform/network/mac/ResourceHandleMac.mm index 4ac33ccdc..7e226e259 100644 --- a/Source/WebCore/platform/network/mac/ResourceHandleMac.mm +++ b/Source/WebCore/platform/network/mac/ResourceHandleMac.mm @@ -30,7 +30,6 @@ #import "AuthenticationChallenge.h" #import "AuthenticationMac.h" -#import "Base64.h" #import "BlobRegistry.h" #import "BlockExceptions.h" #import "CookieStorage.h" @@ -52,8 +51,9 @@ #import "SubresourceLoader.h" #import "WebCoreSystemInterface.h" #import "WebCoreURLResponse.h" -#import <wtf/text/CString.h> #import <wtf/UnusedParam.h> +#import <wtf/text/Base64.h> +#import <wtf/text/CString.h> using namespace WebCore; @@ -214,7 +214,7 @@ void ResourceHandle::createNSURLConnection(id delegate, bool shouldUseCredential nsRequest = mutableRequest; } -#if !defined(BUILDING_ON_LEOPARD) +#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 ASSERT([NSURLConnection instancesRespondToSelector:@selector(_initWithRequest:delegate:usesCache:maxContentLength:startImmediately:connectionProperties:)]); static bool supportsSettingConnectionProperties = true; #else @@ -512,7 +512,7 @@ void ResourceHandle::didReceiveAuthenticationChallenge(const AuthenticationChall // we make sure that is actually present ASSERT(challenge.nsURLAuthenticationChallenge()); -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOWLEOPARD) +#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 // Proxy authentication is handled by CFNetwork internally. We can get here if the user cancels // CFNetwork authentication dialog, and we shouldn't ask the client to display another one in that case. if (challenge.protectionSpace().isProxy()) { diff --git a/Source/WebCore/platform/network/mac/ResourceRequestMac.mm b/Source/WebCore/platform/network/mac/ResourceRequestMac.mm index 262fdb446..96c497d50 100644 --- a/Source/WebCore/platform/network/mac/ResourceRequestMac.mm +++ b/Source/WebCore/platform/network/mac/ResourceRequestMac.mm @@ -82,7 +82,7 @@ void ResourceRequest::doUpdateResourceRequest() m_httpMethod = method; m_allowCookies = [m_nsRequest.get() HTTPShouldHandleCookies]; -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 if (ResourceRequest::httpPipeliningEnabled()) m_priority = toResourceLoadPriority(wkGetHTTPPipeliningPriority([m_nsRequest.get() _CFURLRequest])); #endif @@ -129,13 +129,13 @@ void ResourceRequest::doUpdatePlatformRequest() nsRequest = [[NSMutableURLRequest alloc] initWithURL:url()]; -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 if (ResourceRequest::httpPipeliningEnabled()) wkSetHTTPPipeliningPriority([nsRequest _CFURLRequest], toHTTPPipeliningPriority(m_priority)); #endif [nsRequest setCachePolicy:(NSURLRequestCachePolicy)cachePolicy()]; -#if !defined(BUILDING_ON_SNOW_LEOPARD) +#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 wkCFURLRequestAllowAllPostCaching([nsRequest _CFURLRequest]); #endif diff --git a/Source/WebCore/platform/network/mac/WebCoreURLResponse.mm b/Source/WebCore/platform/network/mac/WebCoreURLResponse.mm index be2e2767f..6aa76f6dd 100644 --- a/Source/WebCore/platform/network/mac/WebCoreURLResponse.mm +++ b/Source/WebCore/platform/network/mac/WebCoreURLResponse.mm @@ -497,7 +497,7 @@ void adjustMIMETypeIfNecessary(CFURLResponseRef cfResponse) } } -#ifdef BUILDING_ON_LEOPARD +#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1050 // Workaround for <rdar://problem/5539824> if (CFStringCompare(result.get(), CFSTR("text/xml"), 0) == kCFCompareEqualTo) result = CFSTR("application/xml"); diff --git a/Source/WebCore/platform/network/soup/CookieStorageSoup.cpp b/Source/WebCore/platform/network/soup/CookieStorageSoup.cpp index 2d7174799..f309e5d84 100644 --- a/Source/WebCore/platform/network/soup/CookieStorageSoup.cpp +++ b/Source/WebCore/platform/network/soup/CookieStorageSoup.cpp @@ -37,8 +37,10 @@ void setCookieStoragePrivateBrowsingEnabled(bool enabled) } #if USE(PLATFORM_STRATEGIES) -static void soupCookiesChanged(SoupCookieJar*, SoupCookie*, SoupCookie*, gpointer) +static void soupCookiesChanged(SoupCookieJar* jar, SoupCookie*, SoupCookie*, gpointer) { + if (jar != soupCookieJar()) + return; platformStrategies()->cookiesStrategy()->notifyCookiesChanged(); } #endif diff --git a/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp b/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp index 60e4e1532..35d41abfb 100644 --- a/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp +++ b/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp @@ -27,7 +27,6 @@ #include "config.h" #include "ResourceHandle.h" -#include "Base64.h" #include "CachedResourceLoader.h" #include "ChromeClient.h" #include "CookieJarSoup.h" diff --git a/Source/WebCore/platform/network/soup/ResourceResponse.h b/Source/WebCore/platform/network/soup/ResourceResponse.h index 8624c0591..b8084cff4 100644 --- a/Source/WebCore/platform/network/soup/ResourceResponse.h +++ b/Source/WebCore/platform/network/soup/ResourceResponse.h @@ -29,6 +29,7 @@ #include "ResourceResponseBase.h" #include <libsoup/soup.h> +#include <wtf/gobject/GRefPtr.h> namespace WebCore { @@ -37,18 +38,21 @@ public: ResourceResponse() : ResourceResponseBase() , m_soupFlags(static_cast<SoupMessageFlags>(0)) + , m_tlsErrors(static_cast<GTlsCertificateFlags>(0)) { } ResourceResponse(const KURL& url, const String& mimeType, long long expectedLength, const String& textEncodingName, const String& filename) : ResourceResponseBase(url, mimeType, expectedLength, textEncodingName, filename) , m_soupFlags(static_cast<SoupMessageFlags>(0)) + , m_tlsErrors(static_cast<GTlsCertificateFlags>(0)) { } ResourceResponse(SoupMessage* soupMessage) : ResourceResponseBase() , m_soupFlags(static_cast<SoupMessageFlags>(0)) + , m_tlsErrors(static_cast<GTlsCertificateFlags>(0)) { updateFromSoupMessage(soupMessage); } @@ -62,11 +66,19 @@ public: const String& sniffedContentType() const { return m_sniffedContentType; } void setSniffedContentType(const String& value) { m_sniffedContentType = value; } + GTlsCertificate* soupMessageCertificate() const { return m_certificate.get(); } + void setSoupMessageCertificate(GTlsCertificate* certificate) { m_certificate = certificate; } + + GTlsCertificateFlags soupMessageTLSErrors() const { return m_tlsErrors; } + void setSoupMessageTLSErrors(GTlsCertificateFlags tlsErrors) { m_tlsErrors = tlsErrors; } + private: friend class ResourceResponseBase; SoupMessageFlags m_soupFlags; String m_sniffedContentType; + GRefPtr<GTlsCertificate> m_certificate; + GTlsCertificateFlags m_tlsErrors; void doUpdateResourceResponse() { } diff --git a/Source/WebCore/platform/network/soup/ResourceResponseSoup.cpp b/Source/WebCore/platform/network/soup/ResourceResponseSoup.cpp index 155048b2b..ddaa893b6 100644 --- a/Source/WebCore/platform/network/soup/ResourceResponseSoup.cpp +++ b/Source/WebCore/platform/network/soup/ResourceResponseSoup.cpp @@ -51,6 +51,8 @@ SoupMessage* ResourceResponse::toSoupMessage() const soup_message_set_flags(soupMessage, m_soupFlags); + g_object_set(G_OBJECT(soupMessage), "tls-certificate", m_certificate.get(), "tls-errors", m_tlsErrors, NULL); + // Body data is not in the message. return soupMessage; } @@ -84,6 +86,10 @@ void ResourceResponse::updateFromSoupMessage(SoupMessage* soupMessage) setExpectedContentLength(soup_message_headers_get_content_length(soupMessage->response_headers)); setHTTPStatusText(soupMessage->reason_phrase); setSuggestedFilename(filenameFromHTTPContentDisposition(httpHeaderField("Content-Disposition"))); + + GTlsCertificate* certificate = 0; + soup_message_get_https_status(soupMessage, &certificate, &m_tlsErrors); + m_certificate = certificate; } } diff --git a/Source/WebCore/platform/qt/MemoryUsageSupportQt.cpp b/Source/WebCore/platform/qt/MemoryUsageSupportQt.cpp new file mode 100644 index 000000000..40eafb214 --- /dev/null +++ b/Source/WebCore/platform/qt/MemoryUsageSupportQt.cpp @@ -0,0 +1,114 @@ +/* + * Copyright (C) 2012 Google Inc. All rights reserved. + * (C) 2012 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 + * version 2.1 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 "MemoryUsageSupport.h" + +#include "JSDOMWindow.h" +#include <runtime/MemoryStatistics.h> +#include <wtf/FastMalloc.h> + +#if OS(LINUX) +#include <malloc.h> +#endif + +namespace WebCore { + +#if OS(LINUX) +static size_t mallocMemoryUsage(bool inuse) +{ + // Return how much memory (in bytes) has been allocated on the system heap. + struct mallinfo minfo = ::mallinfo(); + + // If we want the internal memory usage, we subtract the memory used by + // free blocks. That is memory allocated from the system by malloc but + // which malloc considers free. + return minfo.arena - (inuse ? minfo.fordblks : 0); +} +#else +static size_t mallocMemoryUsage(bool) +{ + // FIXME: Implement for other supported OS's. + return 0; +} +#endif + +// This is how much system-memory we use. +static int memoryUsageKB() +{ + size_t mallocUsage = mallocMemoryUsage(false); + WTF::FastMallocStatistics fmStats = WTF::fastMallocStatistics(); + + // Extract memory statistics from JavaScriptCore: + JSC::GlobalMemoryStatistics jscStats = JSC::globalMemoryStatistics(); + size_t jscHeapUsage = JSDOMWindow::commonJSGlobalData()->heap.capacity(); + return (mallocUsage + fmStats.committedVMBytes + jscStats.stackBytes + jscStats.JITBytes + jscHeapUsage) >> 10; +} + +// This is how much memory we use internally, not including memory only reserved from the system. +static int actualMemoryUsageKB() +{ + size_t mallocUsage = mallocMemoryUsage(true); + WTF::FastMallocStatistics fmStats = WTF::fastMallocStatistics(); + + // Extract memory statistics from JavaScriptCore: + JSC::GlobalMemoryStatistics jscStats = JSC::globalMemoryStatistics(); + size_t jscHeapUsage = JSDOMWindow::commonJSGlobalData()->heap.size(); + return (mallocUsage + fmStats.committedVMBytes - fmStats.freeListBytes + jscStats.stackBytes + jscStats.JITBytes + jscHeapUsage) >> 10; +} + +int MemoryUsageSupport::memoryUsageMB() +{ + return memoryUsageKB() >> 10; +} + +int MemoryUsageSupport::actualMemoryUsageMB() +{ + return actualMemoryUsageKB() >> 10; +} + +// FIXME: These values should be determined based on hardware or set by the application. + +static const unsigned normalMemoryWatermark = 128; // Chromium default: 256 +static const unsigned highMemoryWatermark = 256; // Chromium default: 1024 +static const unsigned highMemoryDelta = 64; // Chromium default: 128 + +int MemoryUsageSupport::lowMemoryUsageMB() +{ + return normalMemoryWatermark; +} + +int MemoryUsageSupport::highMemoryUsageMB() +{ + return highMemoryWatermark; +} + +int MemoryUsageSupport::highUsageDeltaMB() +{ + return highMemoryDelta; +} + +bool MemoryUsageSupport::processMemorySizesInBytes(size_t*, size_t*) +{ + // FIXME: Not implemented. + return false; +} + +} // namespace WebCore diff --git a/Source/WebCore/platform/qt/PlatformScreenQt.cpp b/Source/WebCore/platform/qt/PlatformScreenQt.cpp index cf381ee68..f30472a0b 100644 --- a/Source/WebCore/platform/qt/PlatformScreenQt.cpp +++ b/Source/WebCore/platform/qt/PlatformScreenQt.cpp @@ -143,7 +143,7 @@ FloatRect screenAvailableRect(Widget* widget) return FloatRect(r.x(), r.y(), r.width(), r.height()); } -void screenColorProfile(Widget*, ColorProfile&) +void screenColorProfile(ColorProfile&) { notImplemented(); } diff --git a/Source/WebCore/platform/qt/PlatformSupport.h b/Source/WebCore/platform/qt/PlatformSupport.h index 0e188db8f..d0bf1549a 100644 --- a/Source/WebCore/platform/qt/PlatformSupport.h +++ b/Source/WebCore/platform/qt/PlatformSupport.h @@ -92,14 +92,6 @@ public: // Plugin static NPObject* pluginScriptableObject(Widget*); - // If memory usage is below this threshold, do not bother forcing GC. - static int lowMemoryUsageMB() { return 256; } - - // If memory usage is above this threshold, force GC more aggressively. - static int highMemoryUsageMB() { return 1024; } - - // Delta of memory usage growth (vs. last actualMemoryUsageMB()) to force GC when memory usage is high. - static int highUsageDeltaMB() { return 128; } }; } diff --git a/Source/WebCore/platform/qt/RenderThemeQtMobile.cpp b/Source/WebCore/platform/qt/RenderThemeQtMobile.cpp index 170d39b59..3d1f94245 100644 --- a/Source/WebCore/platform/qt/RenderThemeQtMobile.cpp +++ b/Source/WebCore/platform/qt/RenderThemeQtMobile.cpp @@ -66,7 +66,7 @@ static const float buttonPaddingRight = 18; static const float buttonPaddingTop = 2; static const float buttonPaddingBottom = 3; static const float menuListPadding = 9; -static const float textFieldPadding = 5; +static const float textFieldPadding = 10; static const float radiusFactor = 0.36; static const float progressBarChunkPercentage = 0.2; #if ENABLE(PROGRESS_TAG) @@ -108,6 +108,44 @@ uint qHash(const KeyIdentifier& id) return hash; } +/* + * The octants' indices are identified below, for each point (x,y) + * in the first octant, we can populate the 7 others with the corresponding + * point. + * + * index | xpos | ypos + * xd --------------------------- + * 4 |<--->| 3 0 | xd + x | y + * __________________ 1 | xd + y | x + * / \ 2 | xd + y | -x + * 5 | .(c) | 2 3 | xd + x | -y + * 6 | | 1 4 | -xd - x | -y + * \__________________/ 5 | -xd - y | -x + * 6 | -xd - y | x + * 7 0 7 | -xd - x | y + * + **/ + +static void addPointToOctants(QVector<QPainterPath>& octants, const QPointF& center, qreal x, qreal y , int xDelta = 0) +{ + ASSERT(octants.count() == 8); + + for (short i = 0; i < 8; ++i) { + QPainterPath& octant = octants[i]; + QPointF pos(center); + // The Gray code corresponding to the octant's index helps doing the math in a more generic way. + const short gray = (i >> 1) ^ i; + const qreal xOffset = xDelta + ((gray & 1) ? y : x); + pos.ry() += ((gray & 2)? -1 : 1) * ((gray & 1) ? x : y); + pos.rx() += (i < 4) ? xOffset : -xOffset; + + if (octant.elementCount()) + octant.lineTo(pos); + else // The path is empty. Initialize the start point. + octant.moveTo(pos); + } +} + static void drawControlBackground(QPainter* painter, const QPen& pen, const QRect& rect, const QBrush& brush) { QPen oldPen = painter->pen(); @@ -116,28 +154,32 @@ static void drawControlBackground(QPainter* painter, const QPen& pen, const QRec painter->setPen(pen); painter->setBrush(brush); - const int line = 1; - const QRect paddedRect = rect.adjusted(line, line, -line, -line); + static const qreal line = 1.5; + const QRectF paddedRect = rect.adjusted(line, line, -line, -line); - const int n = 3; + static const int n = 3; const qreal invPow = 1 / double(n); ASSERT(paddedRect.width() >= paddedRect.height()); const int radius = paddedRect.height() / 2; const int xDelta = paddedRect.width() / 2 - radius; - const QPoint center = paddedRect.topLeft() + QPoint(xDelta + radius, radius); - qreal x, y; - QPainterPath path; - path.moveTo(-xDelta, -radius); - for (y = -radius ; y <= radius; ++y) { - x = -xDelta - radius * pow(1 - pow(qAbs(y) / radius , n), invPow); - path.lineTo(x, y); + const QPointF center = paddedRect.center(); + qreal x = 0; + qreal y; + QVector<QPainterPath> octants(8); + // Stay within reasonable distance from edge values, which can cause artifacts at certain zoom levels. + static const float epsilon = 0.02; + for (y = radius - epsilon; y - epsilon > x; y -= 0.5) { + x = radius * pow(1 - pow(qAbs(y) / radius , n), invPow); + addPointToOctants(octants, center, x, y, xDelta); } - for (y = radius ; y >= -radius; --y) { - x = xDelta + radius * pow(1 - pow(qAbs(y) / radius , n), invPow); - path.lineTo(x, y); + + QPainterPath path = octants.first(); + for (int i = 1; i < 8; ++i) { + // Due to the orientation of the arcs, we need to reverse the paths with odd indices. + QPainterPath subPath = (i % 2) ? octants.at(i).toReversed() : octants.at(i); + path.connectPath(subPath); } path.closeSubpath(); - path.translate(center); painter->drawPath(path); painter->setPen(oldPen); @@ -152,7 +194,7 @@ static inline QRect shrinkRectToSquare(const QRect& rect) static inline QPen borderPen(QPainter* painter = 0) { - return QPen(darkColor, 0.4 * painterScale(painter), Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin); + return QPen(darkColor, qMin(1.0, 0.4 * painterScale(painter))); } QSharedPointer<StylePainter> RenderThemeQtMobile::getStylePainter(const PaintInfo& pi) @@ -383,14 +425,14 @@ QPixmap StylePainterMobile::findLineEdit(const QSize & size, bool focused) const if (!findCachedControl(id, &result)) { const int focusFrame = painterScale(painter); - result = QPixmap(size + QSize(2 * focusFrame, 2 * focusFrame)); + result = QPixmap(size); result.fill(Qt::transparent); const QRect rect = result.rect().adjusted(focusFrame, focusFrame, -focusFrame, -focusFrame); QPainter cachePainter(&result); drawControlBackground(&cachePainter, borderPen(painter), rect, Qt::white); if (focused) { - QPen focusPen(highlightColor, focusFrame, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin); + QPen focusPen(highlightColor, 1.2 * painterScale(painter), Qt::SolidLine); drawControlBackground(&cachePainter, focusPen, rect, Qt::NoBrush); } insertIntoCache(id, result); @@ -697,6 +739,10 @@ void RenderThemeQtMobile::adjustTextFieldStyle(StyleResolver*, RenderStyle* styl // padding. Just worth keeping in mind! style->setBackgroundColor(Color::transparent); style->resetBorder(); + style->setBorderTopWidth(frameWidth); + style->setBorderRightWidth(frameWidth); + style->setBorderBottomWidth(frameWidth); + style->setBorderLeftWidth(frameWidth); style->resetPadding(); computeSizeBasedOnStyle(style); style->setPaddingLeft(Length(textFieldPadding, Fixed)); diff --git a/Source/WebCore/platform/qt/RenderThemeQtMobile.h b/Source/WebCore/platform/qt/RenderThemeQtMobile.h index bc2036c79..2d1e53dad 100644 --- a/Source/WebCore/platform/qt/RenderThemeQtMobile.h +++ b/Source/WebCore/platform/qt/RenderThemeQtMobile.h @@ -53,8 +53,10 @@ public: virtual bool delegatesMenuListRendering() const { return true; } - // drawFocusRing() will return early if the color is invalid. - virtual Color platformFocusRingColor() const { return Color(); } + // We don't want the focus ring to be drawn by the graphics context so we + // always claim to support it in the theme. + // FIXME: This could be a usability problem in the case of contenteditable divs. + virtual bool supportsFocusRing(const RenderStyle*) const { return true; } protected: diff --git a/Source/WebCore/platform/text/Base64.cpp b/Source/WebCore/platform/text/Base64.cpp deleted file mode 100644 index bf706f68b..000000000 --- a/Source/WebCore/platform/text/Base64.cpp +++ /dev/null @@ -1,212 +0,0 @@ -/* - Copyright (C) 2000-2001 Dawit Alemayehu <adawit@kde.org> - Copyright (C) 2006 Alexey Proskuryakov <ap@webkit.org> - Copyright (C) 2007, 2008 Apple Inc. All rights reserved. - Copyright (C) 2010 Patrick Gansterer <paroga@paroga.com> - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License (LGPL) - version 2 as published by the Free Software Foundation. - - This program 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 General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - - This code is based on the java implementation in HTTPClient - package by Ronald Tschalär Copyright (C) 1996-1999. -*/ - -#include "config.h" -#include "Base64.h" - -#include <limits.h> -#include <wtf/StringExtras.h> -#include <wtf/text/WTFString.h> - -namespace WebCore { - -static const char base64EncMap[64] = { - 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, - 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50, - 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, - 0x59, 0x5A, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, - 0x67, 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, - 0x6F, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, - 0x77, 0x78, 0x79, 0x7A, 0x30, 0x31, 0x32, 0x33, - 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x2B, 0x2F -}; - -static const char base64DecMap[128] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x00, 0x3F, - 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x3B, - 0x3C, 0x3D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, - 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, - 0x0F, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, - 0x17, 0x18, 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x20, - 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, - 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F, 0x30, - 0x31, 0x32, 0x33, 0x00, 0x00, 0x00, 0x00, 0x00 -}; - -String base64Encode(const char* data, unsigned length, bool insertLFs) -{ - Vector<char> result; - base64Encode(data, length, result, insertLFs); - return String(result.data(), result.size()); -} - -void base64Encode(const char* data, unsigned len, Vector<char>& out, bool insertLFs) -{ - out.clear(); - if (!len) - return; - - // If the input string is pathologically large, just return nothing. - // Note: Keep this in sync with the "outLength" computation below. - // Rather than being perfectly precise, this is a bit conservative. - const unsigned maxInputBufferSize = UINT_MAX / 77 * 76 / 4 * 3 - 2; - if (len > maxInputBufferSize) - return; - - unsigned sidx = 0; - unsigned didx = 0; - - unsigned outLength = ((len + 2) / 3) * 4; - - // Deal with the 76 character per line limit specified in RFC 2045. - insertLFs = (insertLFs && outLength > 76); - if (insertLFs) - outLength += ((outLength - 1) / 76); - - int count = 0; - out.grow(outLength); - - // 3-byte to 4-byte conversion + 0-63 to ascii printable conversion - if (len > 1) { - while (sidx < len - 2) { - if (insertLFs) { - if (count && !(count % 76)) - out[didx++] = '\n'; - count += 4; - } - out[didx++] = base64EncMap[(data[sidx] >> 2) & 077]; - out[didx++] = base64EncMap[((data[sidx + 1] >> 4) & 017) | ((data[sidx] << 4) & 077)]; - out[didx++] = base64EncMap[((data[sidx + 2] >> 6) & 003) | ((data[sidx + 1] << 2) & 077)]; - out[didx++] = base64EncMap[data[sidx + 2] & 077]; - sidx += 3; - } - } - - if (sidx < len) { - if (insertLFs && (count > 0) && !(count % 76)) - out[didx++] = '\n'; - - out[didx++] = base64EncMap[(data[sidx] >> 2) & 077]; - if (sidx < len - 1) { - out[didx++] = base64EncMap[((data[sidx + 1] >> 4) & 017) | ((data[sidx] << 4) & 077)]; - out[didx++] = base64EncMap[(data[sidx + 1] << 2) & 077]; - } else - out[didx++] = base64EncMap[(data[sidx] << 4) & 077]; - } - - // Add padding - while (didx < out.size()) { - out[didx] = '='; - didx++; - } -} - -bool base64Decode(const Vector<char>& in, Vector<char>& out, Base64DecodePolicy policy) -{ - out.clear(); - - // If the input string is pathologically large, just return nothing. - if (in.size() > UINT_MAX) - return false; - - return base64Decode(in.data(), in.size(), out, policy); -} - -template<typename T> -static inline bool base64DecodeInternal(const T* data, unsigned len, Vector<char>& out, Base64DecodePolicy policy) -{ - out.clear(); - if (!len) - return true; - - out.grow(len); - - bool sawEqualsSign = false; - unsigned outLength = 0; - for (unsigned idx = 0; idx < len; idx++) { - unsigned ch = data[idx]; - if (ch == '=') - sawEqualsSign = true; - else if (('0' <= ch && ch <= '9') || ('A' <= ch && ch <= 'Z') || ('a' <= ch && ch <= 'z') || ch == '+' || ch == '/') { - if (sawEqualsSign) - return false; - out[outLength] = base64DecMap[ch]; - outLength++; - } else if (policy == FailOnInvalidCharacter || (policy == IgnoreWhitespace && !isSpaceOrNewline(ch))) - return false; - } - - if (!outLength) - return !sawEqualsSign; - - // Valid data is (n * 4 + [0,2,3]) characters long. - if ((outLength % 4) == 1) - return false; - - // 4-byte to 3-byte conversion - outLength -= (outLength + 3) / 4; - if (!outLength) - return false; - - unsigned sidx = 0; - unsigned didx = 0; - if (outLength > 1) { - while (didx < outLength - 2) { - out[didx] = (((out[sidx] << 2) & 255) | ((out[sidx + 1] >> 4) & 003)); - out[didx + 1] = (((out[sidx + 1] << 4) & 255) | ((out[sidx + 2] >> 2) & 017)); - out[didx + 2] = (((out[sidx + 2] << 6) & 255) | (out[sidx + 3] & 077)); - sidx += 4; - didx += 3; - } - } - - if (didx < outLength) - out[didx] = (((out[sidx] << 2) & 255) | ((out[sidx + 1] >> 4) & 003)); - - if (++didx < outLength) - out[didx] = (((out[sidx + 1] << 4) & 255) | ((out[sidx + 2] >> 2) & 017)); - - if (outLength < out.size()) - out.shrink(outLength); - - return true; -} - -bool base64Decode(const char* data, unsigned len, Vector<char>& out, Base64DecodePolicy policy) -{ - return base64DecodeInternal<char>(data, len, out, policy); -} - -bool base64Decode(const String& in, Vector<char>& out, Base64DecodePolicy policy) -{ - return base64DecodeInternal<UChar>(in.characters(), in.length(), out, policy); -} - -} // namespace WebCore diff --git a/Source/WebCore/platform/text/Base64.h b/Source/WebCore/platform/text/Base64.h deleted file mode 100644 index 70855de04..000000000 --- a/Source/WebCore/platform/text/Base64.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (C) 2006 Alexey Proskuryakov <ap@webkit.org> - * Copyright (C) 2010 Patrick Gansterer <paroga@paroga.com> - * - * 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 Base64_h -#define Base64_h - -#include <wtf/Vector.h> -#include <wtf/text/CString.h> -#include <wtf/text/WTFString.h> - -namespace WebCore { - -enum Base64DecodePolicy { FailOnInvalidCharacter, IgnoreWhitespace, IgnoreInvalidCharacters }; - -void base64Encode(const char*, unsigned, Vector<char>&, bool insertLFs = false); -void base64Encode(const Vector<char>&, Vector<char>&, bool insertLFs = false); -void base64Encode(const CString&, Vector<char>&, bool insertLFs = false); -String base64Encode(const char*, unsigned, bool insertLFs = false); -String base64Encode(const Vector<char>&, bool insertLFs = false); -String base64Encode(const CString&, bool insertLFs = false); - -bool base64Decode(const String&, Vector<char>&, Base64DecodePolicy = FailOnInvalidCharacter); -bool base64Decode(const Vector<char>&, Vector<char>&, Base64DecodePolicy = FailOnInvalidCharacter); -bool base64Decode(const char*, unsigned, Vector<char>&, Base64DecodePolicy = FailOnInvalidCharacter); - -inline void base64Encode(const Vector<char>& in, Vector<char>& out, bool insertLFs) -{ - base64Encode(in.data(), in.size(), out, insertLFs); -} - -inline void base64Encode(const CString& in, Vector<char>& out, bool insertLFs) -{ - base64Encode(in.data(), in.length(), out, insertLFs); -} - -inline String base64Encode(const Vector<char>& in, bool insertLFs) -{ - return base64Encode(in.data(), in.size(), insertLFs); -} - -inline String base64Encode(const CString& in, bool insertLFs) -{ - return base64Encode(in.data(), in.length(), insertLFs); -} - -} // namespace WebCore - -#endif // Base64_h diff --git a/Source/WebCore/platform/text/TextChecking.h b/Source/WebCore/platform/text/TextChecking.h index 0742cb32d..53364397f 100644 --- a/Source/WebCore/platform/text/TextChecking.h +++ b/Source/WebCore/platform/text/TextChecking.h @@ -39,18 +39,18 @@ namespace WebCore { #define WTF_USE_GRAMMAR_CHECKING 1 -#if PLATFORM(MAC) && !defined(BUILDING_ON_LEOPARD) +#if PLATFORM(MAC) && (PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060) #define WTF_USE_UNIFIED_TEXT_CHECKING 1 #define WTF_USE_AUTOMATIC_TEXT_REPLACEMENT 1 #endif -#if PLATFORM(MAC) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if PLATFORM(MAC) && (PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070) // Some platforms provide UI for suggesting autocorrection. #define WTF_USE_AUTOCORRECTION_PANEL 1 // Some platforms use spelling and autocorrection markers to provide visual cue. // On such platform, if word with marker is edited, we need to remove the marker. #define WTF_USE_MARKER_REMOVAL_UPON_EDITING 1 -#endif // #if PLATFORM(MAC) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#endif // #if PLATFORM(MAC) && (PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070) enum TextCheckingType { TextCheckingTypeSpelling = 1 << 1, diff --git a/Source/WebCore/platform/text/cf/HyphenationCF.cpp b/Source/WebCore/platform/text/cf/HyphenationCF.cpp index f170b8afa..4e3fced44 100644 --- a/Source/WebCore/platform/text/cf/HyphenationCF.cpp +++ b/Source/WebCore/platform/text/cf/HyphenationCF.cpp @@ -26,7 +26,7 @@ #include "config.h" #include "Hyphenation.h" -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if (!PLATFORM(MAC) && !PLATFORM(CHROMIUM)) || PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 #include "AtomicStringKeyedMRUCache.h" #include "TextBreakIteratorInternalICU.h" @@ -70,10 +70,11 @@ size_t lastHyphenLocation(const UChar* characters, size_t length, size_t beforeI RetainPtr<CFLocaleRef> locale = cfLocaleCache().get(localeIdentifier); ASSERT(locale); - CFIndex result = CFStringGetHyphenationLocationBeforeIndex(string.get(), beforeIndex, CFRangeMake(0, length), 0, locale.get(), 0); + CFOptionFlags searchAcrossWordBoundaries = 1; + CFIndex result = CFStringGetHyphenationLocationBeforeIndex(string.get(), beforeIndex, CFRangeMake(0, length), searchAcrossWordBoundaries, locale.get(), 0); return result == kCFNotFound ? 0 : result; } } // namespace WebCore -#endif // !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#endif // (!PLATFORM(MAC) && !PLATFORM(CHROMIUM)) || PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 diff --git a/Source/WebCore/platform/text/mac/HyphenationMac.mm b/Source/WebCore/platform/text/mac/HyphenationMac.mm index 4c8676892..40b77c815 100644 --- a/Source/WebCore/platform/text/mac/HyphenationMac.mm +++ b/Source/WebCore/platform/text/mac/HyphenationMac.mm @@ -26,7 +26,7 @@ #import "config.h" #import "Hyphenation.h" -#if defined(BUILDING_ON_LEOPARD) || defined(BUILDING_ON_SNOW_LEOPARD) +#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED <= 1060 #import "AtomicStringKeyedMRUCache.h" #import "TextBreakIteratorInternalICU.h" @@ -67,4 +67,4 @@ size_t lastHyphenLocation(const UChar* characters, size_t length, size_t beforeI } // namespace WebCore -#endif // defined(BUILDING_ON_LEOPARD) || defined(BUILDING_ON_SNOW_LEOPARD) +#endif // !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED <= 1060 diff --git a/Source/WebCore/platform/text/mac/LocaleMac.h b/Source/WebCore/platform/text/mac/LocaleMac.h index 6f1365f79..074fe3e12 100644 --- a/Source/WebCore/platform/text/mac/LocaleMac.h +++ b/Source/WebCore/platform/text/mac/LocaleMac.h @@ -65,6 +65,7 @@ public: #endif private: + explicit LocaleMac(NSLocale*); explicit LocaleMac(const String&); NSDateFormatter *createShortDateFormatter(); diff --git a/Source/WebCore/platform/text/mac/LocaleMac.mm b/Source/WebCore/platform/text/mac/LocaleMac.mm index 219e95c84..35b64de6a 100644 --- a/Source/WebCore/platform/text/mac/LocaleMac.mm +++ b/Source/WebCore/platform/text/mac/LocaleMac.mm @@ -55,6 +55,11 @@ static NSDateFormatter* createDateTimeFormatter(NSLocale* locale, NSDateFormatte return formatter; } +LocaleMac::LocaleMac(NSLocale* locale) + : m_locale(locale) +{ +} + LocaleMac::LocaleMac(const String& localeIdentifier) : m_locale([[NSLocale alloc] initWithLocaleIdentifier:localeIdentifier]) { @@ -71,7 +76,7 @@ PassOwnPtr<LocaleMac> LocaleMac::create(const String& localeIdentifier) LocaleMac* LocaleMac::currentLocale() { - static LocaleMac* currentLocale = LocaleMac::create([[NSLocale currentLocale] localeIdentifier]).leakPtr(); + static LocaleMac* currentLocale = new LocaleMac([NSLocale currentLocale]); return currentLocale; } diff --git a/Source/WebCore/platform/win/PlatformScreenWin.cpp b/Source/WebCore/platform/win/PlatformScreenWin.cpp index 21bf23c63..5ea24b414 100644 --- a/Source/WebCore/platform/win/PlatformScreenWin.cpp +++ b/Source/WebCore/platform/win/PlatformScreenWin.cpp @@ -118,7 +118,7 @@ FloatRect screenAvailableRect(Widget* widget) return monitorInfo.rcWork; } -void screenColorProfile(Widget*, ColorProfile&) +void screenColorProfile(ColorProfile&) { notImplemented(); } diff --git a/Source/WebCore/platform/win/SSLKeyGeneratorWin.cpp b/Source/WebCore/platform/win/SSLKeyGeneratorWin.cpp index b10961b79..da68de780 100644 --- a/Source/WebCore/platform/win/SSLKeyGeneratorWin.cpp +++ b/Source/WebCore/platform/win/SSLKeyGeneratorWin.cpp @@ -20,7 +20,7 @@ #include "config.h" #include "SSLKeyGenerator.h" -#include "Base64.h" +#include <wtf/text/Base64.h> #include <wtf/text/CString.h> #include <windows.h> diff --git a/Source/WebCore/platform/win/SoftLinking.h b/Source/WebCore/platform/win/SoftLinking.h index 4124d5fc5..cd5c2c1bf 100644 --- a/Source/WebCore/platform/win/SoftLinking.h +++ b/Source/WebCore/platform/win/SoftLinking.h @@ -79,6 +79,23 @@ return ptr; \ }\ +#define SOFT_LINK_LOADED_LIBRARY(library, functionName, resultType, callingConvention, parameterDeclarations) \ + typedef resultType (callingConvention *functionName##PtrType) parameterDeclarations; \ + static functionName##PtrType functionName##Ptr() \ + { \ + static functionName##PtrType ptr; \ + static bool initialized; \ + \ + if (initialized) \ + return ptr; \ + initialized = true; \ + \ + static HINSTANCE libraryInstance = ::GetModuleHandle(L#library); \ + \ + ptr = reinterpret_cast<functionName##PtrType>(SOFT_LINK_GETPROCADDRESS(libraryInstance, #functionName)); \ + return ptr; \ + }\ + /* In order to soft link against functions decorated with __declspec(dllimport), we prepend "softLink_" to the function names. If you use SOFT_LINK_DLL_IMPORT(), you will also need to #define the function name to account for this, e.g.: @@ -102,6 +119,36 @@ return softLink##functionName parameterNames; \ } +#define SOFT_LINK_DLL_IMPORT_OPTIONAL(library, functionName, resultType, callingConvention, parameterDeclarations) \ + typedef resultType (callingConvention *functionName##PtrType) parameterDeclarations; \ + static functionName##PtrType functionName##Ptr() \ + { \ + static functionName##PtrType ptr; \ + static bool initialized; \ + \ + if (initialized) \ + return ptr; \ + initialized = true; \ + \ + ptr = reinterpret_cast<resultType(callingConvention*)parameterDeclarations>(SOFT_LINK_GETPROCADDRESS(library##Library(), #functionName)); \ + return ptr; \ + }\ + +#define SOFT_LINK_DLL_IMPORT_OPTIONAL(library, functionName, resultType, callingConvention, parameterDeclarations) \ + typedef resultType (callingConvention *functionName##PtrType) parameterDeclarations; \ + static functionName##PtrType functionName##Ptr() \ + { \ + static functionName##PtrType ptr; \ + static bool initialized; \ + \ + if (initialized) \ + return ptr; \ + initialized = true; \ + \ + ptr = reinterpret_cast<resultType(callingConvention*)parameterDeclarations>(SOFT_LINK_GETPROCADDRESS(library##Library(), #functionName)); \ + return ptr; \ + }\ + /* Variables exported by a DLL need to be accessed through a function. If you use SOFT_LINK_VARIABLE_DLL_IMPORT(), you will also need to #define the variable name to account for this, e.g.: @@ -117,4 +164,16 @@ return *ptr; \ }\ +/* + Note that this will only work for variable types for which a return value of 0 can signal an error. + */ +#define SOFT_LINK_VARIABLE_DLL_IMPORT_OPTIONAL(library, variableName, variableType) \ + static variableType get_##variableName() \ + { \ + static variableType* ptr = reinterpret_cast<variableType*>(SOFT_LINK_GETPROCADDRESS(library##Library(), #variableName)); \ + if (!ptr) \ + return 0; \ + return *ptr; \ + }\ + #endif // SoftLinking_h diff --git a/Source/WebCore/platform/wx/PasteboardWx.cpp b/Source/WebCore/platform/wx/PasteboardWx.cpp index 752fdaccf..48183fa6f 100644 --- a/Source/WebCore/platform/wx/PasteboardWx.cpp +++ b/Source/WebCore/platform/wx/PasteboardWx.cpp @@ -99,7 +99,7 @@ PassRefPtr<DocumentFragment> Pasteboard::documentFragment(Frame* frame, PassRefP wxHTMLDataObject data; wxTheClipboard->GetData(data); chosePlainText = false; - fragment = createFragmentFromMarkup(frame->document(), data.GetHTML(), "", FragmentScriptingNotAllowed); + fragment = createFragmentFromMarkup(frame->document(), data.GetHTML(), "", DisallowScriptingContent); } else #endif { diff --git a/Source/WebCore/rendering/FlowThreadController.cpp b/Source/WebCore/rendering/FlowThreadController.cpp index cf2207ffe..dc9432c76 100644 --- a/Source/WebCore/rendering/FlowThreadController.cpp +++ b/Source/WebCore/rendering/FlowThreadController.cpp @@ -33,6 +33,8 @@ #include "RenderFlowThread.h" #include "RenderNamedFlowThread.h" +#include "WebKitNamedFlow.h" +#include "WebKitNamedFlowCollection.h" #include <wtf/text/AtomicString.h> namespace WebCore { @@ -65,7 +67,12 @@ RenderNamedFlowThread* FlowThreadController::ensureRenderFlowThreadWithName(cons } } - RenderNamedFlowThread* flowRenderer = new (m_view->renderArena()) RenderNamedFlowThread(m_view->document(), name); + WebKitNamedFlowCollection* namedFlows = m_view->document()->namedFlows(); + + // Sanity check for the absence of a named flow in the "CREATED" state with the same name. + ASSERT(!namedFlows->flowByName(name)); + + RenderNamedFlowThread* flowRenderer = new (m_view->renderArena()) RenderNamedFlowThread(m_view->document(), namedFlows->ensureFlowWithName(name)); flowRenderer->setStyle(RenderFlowThread::createFlowThreadStyle(m_view->style())); m_renderNamedFlowThreadList->add(flowRenderer); @@ -122,4 +129,10 @@ void FlowThreadController::unregisterNamedFlowContentNode(Node* contentNode) m_mapNamedFlowContentNodes.remove(contentNode); } +void FlowThreadController::removeFlowThread(RenderNamedFlowThread* flowThread) +{ + m_renderNamedFlowThreadList->remove(flowThread); + setIsRenderNamedFlowThreadOrderDirty(true); +} + } // namespace WebCore diff --git a/Source/WebCore/rendering/FlowThreadController.h b/Source/WebCore/rendering/FlowThreadController.h index 0c317692f..d48c87972 100644 --- a/Source/WebCore/rendering/FlowThreadController.h +++ b/Source/WebCore/rendering/FlowThreadController.h @@ -64,6 +64,8 @@ public: void registerNamedFlowContentNode(Node*, RenderNamedFlowThread*); void unregisterNamedFlowContentNode(Node*); + + void removeFlowThread(RenderNamedFlowThread*); protected: FlowThreadController(RenderView*); diff --git a/Source/WebCore/rendering/InlineFlowBox.cpp b/Source/WebCore/rendering/InlineFlowBox.cpp index dc45001af..a96f61225 100644 --- a/Source/WebCore/rendering/InlineFlowBox.cpp +++ b/Source/WebCore/rendering/InlineFlowBox.cpp @@ -788,10 +788,13 @@ inline void InlineFlowBox::addBorderOutsetVisualOverflow(LayoutRect& logicalVisu RenderStyle* style = renderer()->style(isFirstLineStyle()); if (!style->hasBorderImageOutsets()) return; - - LayoutUnit borderOutsetLogicalTop; - LayoutUnit borderOutsetLogicalBottom; - style->getBorderImageBlockDirectionOutsets(borderOutsetLogicalTop, borderOutsetLogicalBottom); + + FractionalLayoutBoxExtent borderOutsets = style->borderImageOutsets(); + + LayoutUnit borderOutsetLogicalTop = borderOutsets.logicalTop(style); + LayoutUnit borderOutsetLogicalBottom = borderOutsets.logicalBottom(style); + LayoutUnit borderOutsetLogicalLeft = borderOutsets.logicalLeft(style); + LayoutUnit borderOutsetLogicalRight = borderOutsets.logicalRight(style); // Similar to how glyph overflow works, if our lines are flipped, then it's actually the opposite border that applies, since // the line is "upside down" in terms of block coordinates. vertical-rl and horizontal-bt are the flipped line modes. @@ -800,10 +803,6 @@ inline void InlineFlowBox::addBorderOutsetVisualOverflow(LayoutRect& logicalVisu LayoutUnit logicalTopVisualOverflow = min(pixelSnappedLogicalTop() - outsetLogicalTop, logicalVisualOverflow.y()); LayoutUnit logicalBottomVisualOverflow = max(pixelSnappedLogicalBottom() + outsetLogicalBottom, logicalVisualOverflow.maxY()); - - LayoutUnit borderOutsetLogicalLeft; - LayoutUnit borderOutsetLogicalRight; - style->getBorderImageInlineDirectionOutsets(borderOutsetLogicalLeft, borderOutsetLogicalRight); LayoutUnit outsetLogicalLeft = includeLogicalLeftEdge() ? borderOutsetLogicalLeft : ZERO_LAYOUT_UNIT; LayoutUnit outsetLogicalRight = includeLogicalRightEdge() ? borderOutsetLogicalRight : ZERO_LAYOUT_UNIT; @@ -1187,29 +1186,25 @@ static LayoutRect clipRectForNinePieceImageStrip(InlineFlowBox* box, const NineP { LayoutRect clipRect(paintRect); RenderStyle* style = box->renderer()->style(); - LayoutUnit topOutset; - LayoutUnit rightOutset; - LayoutUnit bottomOutset; - LayoutUnit leftOutset; - style->getImageOutsets(image, topOutset, rightOutset, bottomOutset, leftOutset); + LayoutBoxExtent outsets = style->imageOutsets(image); if (box->isHorizontal()) { - clipRect.setY(paintRect.y() - topOutset); - clipRect.setHeight(paintRect.height() + topOutset + bottomOutset); + clipRect.setY(paintRect.y() - outsets.top()); + clipRect.setHeight(paintRect.height() + outsets.top() + outsets.bottom()); if (box->includeLogicalLeftEdge()) { - clipRect.setX(paintRect.x() - leftOutset); - clipRect.setWidth(paintRect.width() + leftOutset); + clipRect.setX(paintRect.x() - outsets.left()); + clipRect.setWidth(paintRect.width() + outsets.left()); } if (box->includeLogicalRightEdge()) - clipRect.setWidth(clipRect.width() + rightOutset); + clipRect.setWidth(clipRect.width() + outsets.right()); } else { - clipRect.setX(paintRect.x() - leftOutset); - clipRect.setWidth(paintRect.width() + leftOutset + rightOutset); + clipRect.setX(paintRect.x() - outsets.left()); + clipRect.setWidth(paintRect.width() + outsets.left() + outsets.right()); if (box->includeLogicalLeftEdge()) { - clipRect.setY(paintRect.y() - topOutset); - clipRect.setHeight(paintRect.height() + topOutset); + clipRect.setY(paintRect.y() - outsets.top()); + clipRect.setHeight(paintRect.height() + outsets.top()); } if (box->includeLogicalRightEdge()) - clipRect.setHeight(clipRect.height() + bottomOutset); + clipRect.setHeight(clipRect.height() + outsets.bottom()); } return clipRect; } diff --git a/Source/WebCore/rendering/RenderBlock.cpp b/Source/WebCore/rendering/RenderBlock.cpp index 030b18711..94cd749c1 100755 --- a/Source/WebCore/rendering/RenderBlock.cpp +++ b/Source/WebCore/rendering/RenderBlock.cpp @@ -2091,8 +2091,11 @@ LayoutUnit RenderBlock::clearFloatsIfNeeded(RenderBox* child, MarginInfo& margin void RenderBlock::marginBeforeEstimateForChild(RenderBox* child, LayoutUnit& positiveMarginBefore, LayoutUnit& negativeMarginBefore) const { - // FIXME: We could get even more quirks mode cases right if we dealt with quirk containers. // FIXME: We should deal with the margin-collapse-* style extensions that prevent collapsing and that discard margins. + // Give up if in quirks mode and we're a body/table cell and the top margin of the child box is quirky. + if (document()->inQuirksMode() && child->isMarginBeforeQuirk() && (isTableCell() || isBody())) + return; + LayoutUnit beforeChildMargin = marginBeforeForChild(child); positiveMarginBefore = max(positiveMarginBefore, beforeChildMargin); negativeMarginBefore = max(negativeMarginBefore, -beforeChildMargin); @@ -2118,6 +2121,13 @@ void RenderBlock::marginBeforeEstimateForChild(RenderBox* child, LayoutUnit& pos if (!grandchildBox || grandchildBox->style()->clear() != CNONE) return; + // Make sure to update the block margins now for the grandchild box so that we're looking at current values. + if (grandchildBox->needsLayout()) { + grandchildBox->computeBlockDirectionMargins(this); + grandchildBox->setMarginBeforeQuirk(grandchildBox->style()->marginBefore().quirk()); + grandchildBox->setMarginAfterQuirk(grandchildBox->style()->marginAfter().quirk()); + } + // Collapse the margin of the grandchild box with our own to produce an estimate. childBlock->marginBeforeEstimateForChild(grandchildBox, positiveMarginBefore, negativeMarginBefore); } @@ -2427,7 +2437,9 @@ void RenderBlock::layoutBlockChild(RenderBox* child, MarginInfo& marginInfo, Lay setLogicalTopForChild(child, logicalTopAfterClear, ApplyLayoutDelta); // Now we have a final top position. See if it really does end up being different from our estimate. - if (logicalTopAfterClear != logicalTopEstimate) { + // clearFloatsIfNeeded can also mark the child as needing a layout even though we didn't move. This happens + // when collapseMargins dynamically adds overhanging floats because of a child with negative margins. + if (logicalTopAfterClear != logicalTopEstimate || child->needsLayout()) { if (child->shrinkToAvoidFloats()) { // The child's width depends on the line width. // When the child shifts to clear an item, its width can @@ -4583,6 +4595,10 @@ LayoutUnit RenderBlock::getClearDelta(RenderBox* child, LayoutUnit logicalTop) if (availableLogicalWidthAtNewLogicalTopOffset == availableLogicalWidthForContent(newLogicalTop)) return newLogicalTop - logicalTop; + RenderRegion* region = regionAtBlockOffset(logicalTopForChild(child)); + LayoutRect borderBox = child->borderBoxRectInRegion(region, offsetFromLogicalTopOfFirstPage() + logicalTopForChild(child), DoNotCacheRenderBoxRegionInfo); + LayoutUnit childLogicalWidthAtOldLogicalTopOffset = isHorizontalWritingMode() ? borderBox.width() : borderBox.height(); + // FIXME: None of this is right for perpendicular writing-mode children. LayoutUnit childOldLogicalWidth = child->logicalWidth(); LayoutUnit childOldMarginLeft = child->marginLeft(); @@ -4591,8 +4607,8 @@ LayoutUnit RenderBlock::getClearDelta(RenderBox* child, LayoutUnit logicalTop) child->setLogicalTop(newLogicalTop); child->computeLogicalWidth(); - RenderRegion* region = regionAtBlockOffset(logicalTopForChild(child)); - LayoutRect borderBox = child->borderBoxRectInRegion(region, offsetFromLogicalTopOfFirstPage() + logicalTopForChild(child), DoNotCacheRenderBoxRegionInfo); + region = regionAtBlockOffset(logicalTopForChild(child)); + borderBox = child->borderBoxRectInRegion(region, offsetFromLogicalTopOfFirstPage() + logicalTopForChild(child), DoNotCacheRenderBoxRegionInfo); LayoutUnit childLogicalWidthAtNewLogicalTopOffset = isHorizontalWritingMode() ? borderBox.width() : borderBox.height(); child->setLogicalTop(childOldLogicalTop); @@ -4600,8 +4616,14 @@ LayoutUnit RenderBlock::getClearDelta(RenderBox* child, LayoutUnit logicalTop) child->setMarginLeft(childOldMarginLeft); child->setMarginRight(childOldMarginRight); - if (childLogicalWidthAtNewLogicalTopOffset <= availableLogicalWidthAtNewLogicalTopOffset) + if (childLogicalWidthAtNewLogicalTopOffset <= availableLogicalWidthAtNewLogicalTopOffset) { + // Even though we may not be moving, if the logical width did shrink because of the presence of new floats, then + // we need to force a relayout as though we shifted. This happens because of the dynamic addition of overhanging floats + // from previous siblings when negative margins exist on a child (see the addOverhangingFloats call at the end of collapseMargins). + if (childLogicalWidthAtOldLogicalTopOffset != childLogicalWidthAtNewLogicalTopOffset) + child->setChildNeedsLayout(true, MarkOnlyThis); return newLogicalTop - logicalTop; + } newLogicalTop = nextFloatLogicalBottomBelow(newLogicalTop); ASSERT(newLogicalTop >= logicalTop); diff --git a/Source/WebCore/rendering/RenderBlock.h b/Source/WebCore/rendering/RenderBlock.h index 123617104..71416a103 100644 --- a/Source/WebCore/rendering/RenderBlock.h +++ b/Source/WebCore/rendering/RenderBlock.h @@ -295,10 +295,10 @@ public: LayoutUnit marginAfterForChild(const RenderBoxModelObject* child) const { return child->marginAfter(style()); } LayoutUnit marginStartForChild(const RenderBoxModelObject* child) const { return child->marginStart(style()); } LayoutUnit marginEndForChild(const RenderBoxModelObject* child) const { return child->marginEnd(style()); } - void setMarginStartForChild(RenderBox* child, LayoutUnit value) { child->setMarginStart(value, style()); } - void setMarginEndForChild(RenderBox* child, LayoutUnit value) { child->setMarginEnd(value, style()); } - void setMarginBeforeForChild(RenderBox* child, LayoutUnit value) { child->setMarginBefore(value, style()); } - void setMarginAfterForChild(RenderBox* child, LayoutUnit value) { child->setMarginAfter(value, style()); } + void setMarginStartForChild(RenderBox* child, LayoutUnit value) const { child->setMarginStart(value, style()); } + void setMarginEndForChild(RenderBox* child, LayoutUnit value) const { child->setMarginEnd(value, style()); } + void setMarginBeforeForChild(RenderBox* child, LayoutUnit value) const { child->setMarginBefore(value, style()); } + void setMarginAfterForChild(RenderBox* child, LayoutUnit value) const { child->setMarginAfter(value, style()); } LayoutUnit collapsedMarginBeforeForChild(const RenderBox* child) const; LayoutUnit collapsedMarginAfterForChild(const RenderBox* child) const; diff --git a/Source/WebCore/rendering/RenderBox.cpp b/Source/WebCore/rendering/RenderBox.cpp index b64be4e8d..2f2ab2421 100644 --- a/Source/WebCore/rendering/RenderBox.cpp +++ b/Source/WebCore/rendering/RenderBox.cpp @@ -934,17 +934,7 @@ LayoutRect RenderBox::maskClipRect() LayoutRect borderImageRect = borderBoxRect(); // Apply outsets to the border box. - LayoutUnit topOutset; - LayoutUnit rightOutset; - LayoutUnit bottomOutset; - LayoutUnit leftOutset; - style()->getMaskBoxImageOutsets(topOutset, rightOutset, bottomOutset, leftOutset); - - borderImageRect.setX(borderImageRect.x() - leftOutset); - borderImageRect.setY(borderImageRect.y() - topOutset); - borderImageRect.setWidth(borderImageRect.width() + leftOutset + rightOutset); - borderImageRect.setHeight(borderImageRect.height() + topOutset + bottomOutset); - + borderImageRect.expand(style()->maskBoxImageOutsets()); return borderImageRect; } @@ -1178,7 +1168,6 @@ LayoutUnit RenderBox::shrinkLogicalWidthToAvoidFloats(LayoutUnit childMarginStar } LayoutUnit result = cb->availableLogicalWidthForLine(logicalTopPosition, false, containingBlockRegion, adjustedPageOffsetForContainingBlock) - childMarginStart - childMarginEnd; - result = max(result, minPreferredLogicalWidth()); // Don't shrink below our minimum preferred logical width. // We need to see if margins on either the start side or the end side can contain the floats in question. If they can, // then just using the line width is inaccurate. In the case where a float completely fits, we don't need to use the line @@ -1741,7 +1730,6 @@ LayoutUnit RenderBox::computeLogicalWidthInRegionUsing(SizeType widthType, Layou ASSERT(!logicalWidth.isUndefined()); - // FIXME: minWidth:auto on a flex-item needs to go down the intrinsicOrAuto path below. if (widthType == MinSize && logicalWidth.isAuto()) return computeBorderBoxLogicalWidth(0); @@ -2077,10 +2065,8 @@ LayoutUnit RenderBox::computeLogicalHeightUsing(SizeType heightType, const Lengt LayoutUnit RenderBox::computeContentLogicalHeightUsing(SizeType heightType, const Length& height) { - // FIXME: For flexboxes, minHeight:auto should be min-content. if (height.isAuto()) return heightType == MinSize ? 0 : -1; - if (height.isFixed()) return height.value(); if (height.isPercent()) @@ -2189,7 +2175,6 @@ LayoutUnit RenderBox::computeReplacedLogicalWidthRespectingMinMaxWidth(LayoutUni LayoutUnit RenderBox::computeReplacedLogicalWidthUsing(SizeType sizeType, Length logicalWidth) const { - // FIXME: For flexboxes, minWidth:auto should be min-content. if (sizeType == MinSize && logicalWidth.isAuto()) return computeContentBoxLogicalWidth(0); @@ -2206,7 +2191,10 @@ LayoutUnit RenderBox::computeReplacedLogicalWidthUsing(SizeType sizeType, Length // containing block's block-flow. // https://bugs.webkit.org/show_bug.cgi?id=46496 const LayoutUnit cw = isOutOfFlowPositioned() ? containingBlockLogicalWidthForPositioned(toRenderBoxModelObject(container())) : containingBlockLogicalWidthForContent(); - if (cw > 0) + Length containerLogicalWidth = containingBlock()->style()->logicalWidth(); + // FIXME: Handle cases when containing block width is calculated or viewport percent. + // https://bugs.webkit.org/show_bug.cgi?id=91071 + if (cw > 0 || (!cw && (containerLogicalWidth.isFixed() || containerLogicalWidth.isPercent()))) return computeContentBoxLogicalWidth(minimumValueForLength(logicalWidth, cw)); } // fall through @@ -2229,7 +2217,6 @@ LayoutUnit RenderBox::computeReplacedLogicalHeightRespectingMinMaxHeight(LayoutU LayoutUnit RenderBox::computeReplacedLogicalHeightUsing(SizeType sizeType, Length logicalHeight) const { - // FIXME: For flexboxes, minWidth:auto should be min-content. if (sizeType == MinSize && logicalHeight.isAuto()) return computeContentBoxLogicalHeight(0); @@ -2337,7 +2324,7 @@ LayoutUnit RenderBox::availableLogicalHeightUsing(const Length& h) const return containingBlock()->availableLogicalHeight(); } -void RenderBox::computeBlockDirectionMargins(RenderBlock* containingBlock) +void RenderBox::computeBlockDirectionMargins(const RenderBlock* containingBlock) { if (isTableCell()) { // FIXME: Not right if we allow cells to have different directionality than the table. If we do allow this, though, @@ -2667,7 +2654,6 @@ void RenderBox::computePositionedLogicalWidthUsing(SizeType widthSizeType, Lengt Length logicalLeft, Length logicalRight, Length marginLogicalLeft, Length marginLogicalRight, LayoutUnit& logicalWidthValue, LayoutUnit& marginLogicalLeftValue, LayoutUnit& marginLogicalRightValue, LayoutUnit& logicalLeftPos) { - // FIXME: What should flex items do here since min-width:auto == min-width:min-content instead of min-width:auto == min-width:0. if (widthSizeType == MinSize && logicalWidth.isAuto()) logicalWidth = Length(0, Fixed); @@ -3001,7 +2987,6 @@ void RenderBox::computePositionedLogicalHeightUsing(SizeType heightSizeType, Len Length logicalTop, Length logicalBottom, Length marginBefore, Length marginAfter, LayoutUnit& logicalHeightValue, LayoutUnit& marginBeforeValue, LayoutUnit& marginAfterValue, LayoutUnit& logicalTopPos) { - // FIXME: What should flex items do here since min-height:auto == min-height:min-content instead of min-height:auto == min-height:0. if (heightSizeType == MinSize && logicalHeightLength.isAuto()) logicalHeightLength = Length(0, Fixed); @@ -3013,7 +2998,6 @@ void RenderBox::computePositionedLogicalHeightUsing(SizeType heightSizeType, Len LayoutUnit logicalTopValue = 0; - // FIXME: For non-flexboxes + min-height, this needs to treat non-flexboxes as 0. bool logicalHeightIsAuto = logicalHeightLength.isAuto(); bool logicalTopIsAuto = logicalTop.isAuto(); bool logicalBottomIsAuto = logicalBottom.isAuto(); @@ -3591,18 +3575,14 @@ void RenderBox::addVisualEffectOverflow() // Now compute border-image-outset overflow. if (style()->hasBorderImageOutsets()) { - LayoutUnit borderOutsetLeft; - LayoutUnit borderOutsetRight; - LayoutUnit borderOutsetTop; - LayoutUnit borderOutsetBottom; - style()->getBorderImageOutsets(borderOutsetTop, borderOutsetRight, borderOutsetBottom, borderOutsetLeft); + LayoutBoxExtent borderOutsets = style()->borderImageOutsets(); // In flipped blocks writing modes, the physical sides are inverted. For example in vertical-rl, the right // border is at the lower x coordinate value. - overflowMinX = min(overflowMinX, borderBox.x() - ((!isFlipped || isHorizontal) ? borderOutsetLeft : borderOutsetRight)); - overflowMaxX = max(overflowMaxX, borderBox.maxX() + ((!isFlipped || isHorizontal) ? borderOutsetRight : borderOutsetLeft)); - overflowMinY = min(overflowMinY, borderBox.y() - ((!isFlipped || !isHorizontal) ? borderOutsetTop : borderOutsetBottom)); - overflowMaxY = max(overflowMaxY, borderBox.maxY() + ((!isFlipped || !isHorizontal) ? borderOutsetBottom : borderOutsetTop)); + overflowMinX = min(overflowMinX, borderBox.x() - ((!isFlipped || isHorizontal) ? borderOutsets.left() : borderOutsets.right())); + overflowMaxX = max(overflowMaxX, borderBox.maxX() + ((!isFlipped || isHorizontal) ? borderOutsets.right() : borderOutsets.left())); + overflowMinY = min(overflowMinY, borderBox.y() - ((!isFlipped || !isHorizontal) ? borderOutsets.top() : borderOutsets.bottom())); + overflowMaxY = max(overflowMaxY, borderBox.maxY() + ((!isFlipped || !isHorizontal) ? borderOutsets.bottom() : borderOutsets.top())); } // Add in the final overflow with shadows and outsets combined. diff --git a/Source/WebCore/rendering/RenderBox.h b/Source/WebCore/rendering/RenderBox.h index 031458266..064ed9191 100644 --- a/Source/WebCore/rendering/RenderBox.h +++ b/Source/WebCore/rendering/RenderBox.h @@ -290,7 +290,7 @@ public: void computeInlineDirectionMargins(RenderBlock* containingBlock, LayoutUnit containerWidth, LayoutUnit childWidth); // Used to resolve margins in the containing block's block-flow direction. - void computeBlockDirectionMargins(RenderBlock* containingBlock); + void computeBlockDirectionMargins(const RenderBlock* containingBlock); enum RenderBoxRegionInfoFlags { CacheRenderBoxRegionInfo, DoNotCacheRenderBoxRegionInfo }; LayoutRect borderBoxRectInRegion(RenderRegion*, LayoutUnit offsetFromLogicalTopOfFirstPage = 0, RenderBoxRegionInfoFlags = CacheRenderBoxRegionInfo) const; diff --git a/Source/WebCore/rendering/RenderBoxModelObject.cpp b/Source/WebCore/rendering/RenderBoxModelObject.cpp index a35a206e2..8f9b9a622 100644 --- a/Source/WebCore/rendering/RenderBoxModelObject.cpp +++ b/Source/WebCore/rendering/RenderBoxModelObject.cpp @@ -1234,17 +1234,9 @@ bool RenderBoxModelObject::paintNinePieceImage(GraphicsContext* graphicsContext, // FIXME: border-image is broken with full page zooming when tiling has to happen, since the tiling function // doesn't have any understanding of the zoom that is in effect on the tile. - LayoutUnit topOutset; - LayoutUnit rightOutset; - LayoutUnit bottomOutset; - LayoutUnit leftOutset; - style->getImageOutsets(ninePieceImage, topOutset, rightOutset, bottomOutset, leftOutset); - - LayoutUnit topWithOutset = rect.y() - topOutset; - LayoutUnit bottomWithOutset = rect.maxY() + bottomOutset; - LayoutUnit leftWithOutset = rect.x() - leftOutset; - LayoutUnit rightWithOutset = rect.maxX() + rightOutset; - IntRect borderImageRect = pixelSnappedIntRect(leftWithOutset, topWithOutset, rightWithOutset - leftWithOutset, bottomWithOutset - topWithOutset); + LayoutRect rectWithOutsets = rect; + rectWithOutsets.expand(style->imageOutsets(ninePieceImage)); + IntRect borderImageRect = pixelSnappedIntRect(rectWithOutsets); IntSize imageSize = calculateImageIntrinsicDimensions(styleImage, borderImageRect.size(), DoNotScaleByEffectiveZoom); diff --git a/Source/WebCore/rendering/RenderCounter.cpp b/Source/WebCore/rendering/RenderCounter.cpp index 29c0f1ccb..de45d895e 100644 --- a/Source/WebCore/rendering/RenderCounter.cpp +++ b/Source/WebCore/rendering/RenderCounter.cpp @@ -474,6 +474,7 @@ RenderCounter::RenderCounter(Document* node, const CounterContent& counter) , m_counterNode(0) , m_nextForSameCounter(0) { + view()->addRenderCounter(); } RenderCounter::~RenderCounter() @@ -484,6 +485,13 @@ RenderCounter::~RenderCounter() } } +void RenderCounter::willBeDestroyed() +{ + if (view()) + view()->removeRenderCounter(); + RenderText::willBeDestroyed(); +} + const char* RenderCounter::renderName() const { return "RenderCounter"; @@ -596,14 +604,17 @@ void RenderCounter::destroyCounterNode(RenderObject* owner, const AtomicString& // map associated with a renderer, so there is no risk in leaking the map. } -void RenderCounter::rendererRemovedFromTree(RenderObject* removedRenderer) +void RenderCounter::rendererRemovedFromTree(RenderObject* renderer) { - RenderObject* currentRenderer = removedRenderer->lastLeafChild(); + ASSERT(renderer->view()); + if (!renderer->view()->hasRenderCounters()) + return; + RenderObject* currentRenderer = renderer->lastLeafChild(); if (!currentRenderer) - currentRenderer = removedRenderer; + currentRenderer = renderer; while (true) { destroyCounterNodes(currentRenderer); - if (currentRenderer == removedRenderer) + if (currentRenderer == renderer) break; currentRenderer = currentRenderer->previousInPreOrder(); } @@ -647,6 +658,9 @@ static void updateCounters(RenderObject* renderer) void RenderCounter::rendererSubtreeAttached(RenderObject* renderer) { + ASSERT(renderer->view()); + if (!renderer->view()->hasRenderCounters()) + return; Node* node = renderer->node(); if (node) node = node->parentNode(); diff --git a/Source/WebCore/rendering/RenderCounter.h b/Source/WebCore/rendering/RenderCounter.h index b4449dd86..6ba936f86 100644 --- a/Source/WebCore/rendering/RenderCounter.h +++ b/Source/WebCore/rendering/RenderCounter.h @@ -40,6 +40,9 @@ public: static void rendererRemovedFromTree(RenderObject*); static void rendererStyleChanged(RenderObject*, const RenderStyle* oldStyle, const RenderStyle* newStyle); +protected: + virtual void willBeDestroyed(); + private: virtual const char* renderName() const; virtual bool isCounter() const; diff --git a/Source/WebCore/rendering/RenderFlexibleBox.cpp b/Source/WebCore/rendering/RenderFlexibleBox.cpp index 1bc3aefaf..e7c0563d6 100644 --- a/Source/WebCore/rendering/RenderFlexibleBox.cpp +++ b/Source/WebCore/rendering/RenderFlexibleBox.cpp @@ -751,7 +751,8 @@ void RenderFlexibleBox::computeMainAxisPreferredSizes(bool relayoutChildren, Ord child->clearOverrideSize(); // Only need to layout here if we will need to get the logicalHeight of the child in computeNextFlexLine. - if (hasOrthogonalFlow(child) && flexBasisForChild(child).isAuto()) { + Length childMainAxisMin = isHorizontalFlow() ? child->style()->minWidth() : child->style()->minHeight(); + if (hasOrthogonalFlow(child) && (flexBasisForChild(child).isAuto() || childMainAxisMin.isAuto())) { if (!relayoutChildren) child->setChildNeedsLayout(true); child->layoutIfNeeded(); @@ -792,9 +793,17 @@ LayoutUnit RenderFlexibleBox::adjustChildSizeForMinAndMax(RenderBox* child, Layo // https://bugs.webkit.org/show_bug.cgi?id=81809 if (max.isSpecified() && childSize > valueForLength(max, flexboxAvailableContentExtent, renderView)) childSize = valueForLength(max, flexboxAvailableContentExtent, renderView); - // FIXME: Treat auto min values as min-content. + if (min.isSpecified() && childSize < valueForLength(min, flexboxAvailableContentExtent, renderView)) - childSize = valueForLength(min, flexboxAvailableContentExtent, renderView); + return valueForLength(min, flexboxAvailableContentExtent, renderView); + + // FIXME: Support min/max sizes of fit-content, max-content and fill-available. + if (min.isAuto()) { + LayoutUnit minContent = hasOrthogonalFlow(child) ? child->logicalHeight() : child->minPreferredLogicalWidth(); + minContent -= mainAxisBorderAndPaddingExtentForChild(child); + return std::max(childSize, minContent); + } + return childSize; } diff --git a/Source/WebCore/rendering/RenderGeometryMap.cpp b/Source/WebCore/rendering/RenderGeometryMap.cpp index e6993dbef..0a6c9e04f 100644 --- a/Source/WebCore/rendering/RenderGeometryMap.cpp +++ b/Source/WebCore/rendering/RenderGeometryMap.cpp @@ -136,6 +136,25 @@ void RenderGeometryMap::pushMappingsToAncestor(const RenderObject* renderer, con do { renderer = renderer->pushMappingToContainer(ancestorRenderer, *this); } while (renderer && renderer != ancestorRenderer); + + ASSERT(m_mapping.isEmpty() || m_mapping[0].m_renderer->isRenderView()); +} + +static bool canMapViaLayer(const RenderLayer* layer) +{ + RenderStyle* style = layer->renderer()->style(); + if (style->position() == FixedPosition || style->isFlippedBlocksWritingMode()) + return false; + + if (layer->renderer()->hasColumns() || layer->renderer()->hasTransform()) + return false; + +#if ENABLE(SVG) + if (layer->renderer()->isSVGRoot()) + return false; +#endif + + return true; } void RenderGeometryMap::pushMappingsToAncestor(const RenderLayer* layer, const RenderLayer* ancestorLayer) @@ -143,9 +162,9 @@ void RenderGeometryMap::pushMappingsToAncestor(const RenderLayer* layer, const R const RenderObject* renderer = layer->renderer(); // The simple case can be handled fast in the layer tree. - bool canConvertInLayerTree = ancestorLayer && renderer->style()->position() != FixedPosition && !renderer->style()->isFlippedBlocksWritingMode(); + bool canConvertInLayerTree = ancestorLayer ? canMapViaLayer(ancestorLayer) : false; for (const RenderLayer* current = layer; current != ancestorLayer && canConvertInLayerTree; current = current->parent()) - canConvertInLayerTree = current->canUseConvertToLayerCoords(); + canConvertInLayerTree = canMapViaLayer(current); if (canConvertInLayerTree) { TemporaryChange<size_t> positionChange(m_insertionPosition, m_mapping.size()); @@ -188,7 +207,7 @@ void RenderGeometryMap::push(const RenderObject* renderer, const TransformationM void RenderGeometryMap::pushView(const RenderView* view, const LayoutSize& scrollOffset, const TransformationMatrix* t) { ASSERT(m_insertionPosition != notFound); - ASSERT(!m_mapping.size()); // The view should always be the first thing pushed. + ASSERT(!m_insertionPosition); // The view should always be the first step. m_mapping.insert(m_insertionPosition, RenderGeometryMapStep(view, false, false, false, t)); @@ -218,8 +237,8 @@ void RenderGeometryMap::popMappingsToAncestor(const RenderLayer* ancestorLayer) void RenderGeometryMap::stepInserted(const RenderGeometryMapStep& step) { - // Offset on the first step is the RenderView's offset, which is only applied when we have fixed-position.s - if (m_mapping.size() > 1) + // RenderView's offset, is only applied when we have fixed-positions. + if (!step.m_renderer->isRenderView()) m_accumulatedOffset += step.m_offset; if (step.m_isNonUniform) @@ -234,8 +253,8 @@ void RenderGeometryMap::stepInserted(const RenderGeometryMapStep& step) void RenderGeometryMap::stepRemoved(const RenderGeometryMapStep& step) { - // Offset on the first step is the RenderView's offset, which is only applied when we have fixed-position.s - if (m_mapping.size() > 1) + // RenderView's offset, is only applied when we have fixed-positions. + if (!step.m_renderer->isRenderView()) m_accumulatedOffset -= step.m_offset; if (step.m_isNonUniform) { diff --git a/Source/WebCore/rendering/RenderInline.cpp b/Source/WebCore/rendering/RenderInline.cpp index 3032480c6..c4e142392 100644 --- a/Source/WebCore/rendering/RenderInline.cpp +++ b/Source/WebCore/rendering/RenderInline.cpp @@ -652,12 +652,7 @@ public: , m_wasFixed(wasFixed) , m_geometryMap() { - RenderObject* root = renderer->parent(); - while (root && root->parent()) - root = root->parent(); - - if (root) - m_geometryMap.pushMappingsToAncestor(renderer, toRenderBoxModelObject(root)); + m_geometryMap.pushMappingsToAncestor(renderer, 0); } void operator()(const FloatRect& rect) diff --git a/Source/WebCore/rendering/RenderLayer.cpp b/Source/WebCore/rendering/RenderLayer.cpp index 12794cb46..31be2e8a3 100644 --- a/Source/WebCore/rendering/RenderLayer.cpp +++ b/Source/WebCore/rendering/RenderLayer.cpp @@ -2534,6 +2534,8 @@ void RenderLayer::updateScrollbarsAfterLayout() if (box->hasAutoVerticalScrollbar()) setHasVerticalScrollbar(hasVerticalOverflow); + updateSelfPaintingLayer(); + #if ENABLE(DASHBOARD_SUPPORT) // Force an update since we know the scrollbars have changed things. if (renderer()->document()->hasDashboardRegions()) @@ -4740,6 +4742,7 @@ bool RenderLayer::shouldBeNormalFlowOnly() const bool RenderLayer::shouldBeSelfPaintingLayer() const { return !isNormalFlowOnly() + || hasOverlayScrollbars() || renderer()->hasReflection() || renderer()->hasMask() || renderer()->isTableRow() @@ -4750,7 +4753,7 @@ bool RenderLayer::shouldBeSelfPaintingLayer() const || renderer()->isRenderIFrame(); } -void RenderLayer::updateSelfPaintingLayerAfterStyleChange(const RenderStyle*) +void RenderLayer::updateSelfPaintingLayer() { bool isSelfPaintingLayer = shouldBeSelfPaintingLayer(); if (m_isSelfPaintingLayer == isSelfPaintingLayer) @@ -4845,9 +4848,11 @@ void RenderLayer::styleChanged(StyleDifference, const RenderStyle* oldStyle) m_marquee = 0; } - updateSelfPaintingLayerAfterStyleChange(oldStyle); updateStackingContextsAfterStyleChange(oldStyle); updateScrollbarsAfterStyleChange(oldStyle); + // Overlay scrollbars can make this layer self-painting so we need + // to recompute the bit once scrollbars have been updated. + updateSelfPaintingLayer(); if (!hasReflection() && m_reflection) removeReflection(); diff --git a/Source/WebCore/rendering/RenderLayer.h b/Source/WebCore/rendering/RenderLayer.h index 1c32a4f89..b9dc5d7c7 100644 --- a/Source/WebCore/rendering/RenderLayer.h +++ b/Source/WebCore/rendering/RenderLayer.h @@ -679,7 +679,7 @@ private: bool shouldRepaintAfterLayout() const; - void updateSelfPaintingLayerAfterStyleChange(const RenderStyle* oldStyle); + void updateSelfPaintingLayer(); void updateStackingContextsAfterStyleChange(const RenderStyle* oldStyle); void updateScrollbarsAfterStyleChange(const RenderStyle* oldStyle); diff --git a/Source/WebCore/rendering/RenderLayerBacking.cpp b/Source/WebCore/rendering/RenderLayerBacking.cpp index ee0a442f7..9886fb319 100644 --- a/Source/WebCore/rendering/RenderLayerBacking.cpp +++ b/Source/WebCore/rendering/RenderLayerBacking.cpp @@ -471,7 +471,10 @@ void RenderLayerBacking::updateGraphicsLayerGeometry() scrollingCoordinator->setLayerIsFixedToContainerLayer(m_ancestorClippingLayer.get(), false); scrollingCoordinator->setLayerIsFixedToContainerLayer(m_graphicsLayer.get(), false); } - bool isContainer = m_owningLayer->hasTransform(); + // Page scale is applied as a transform on the root render view layer. Because the scroll + // layer is further up in the hierarchy, we need to avoid marking the root render view + // layer as a container. + bool isContainer = m_owningLayer->hasTransform() && !m_owningLayer->isRootLayer(); scrollingCoordinator->setLayerIsContainerForFixedPositionLayers(childForSuperlayers(), isContainer); } } @@ -1010,7 +1013,7 @@ bool RenderLayerBacking::containsPaintedContent() const if (renderer()->isVideo() && toRenderVideo(renderer())->shouldDisplayVideo()) return hasBoxDecorationsOrBackground(renderer()); #endif -#if PLATFORM(MAC) && USE(CA) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if PLATFORM(MAC) && USE(CA) && (PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070) #elif ENABLE(WEBGL) || ENABLE(ACCELERATED_2D_CANVAS) if (isAcceleratedCanvas(renderer())) return hasBoxDecorationsOrBackground(renderer()); diff --git a/Source/WebCore/rendering/RenderLayerBacking.h b/Source/WebCore/rendering/RenderLayerBacking.h index 622c38c85..0f42d3fb9 100644 --- a/Source/WebCore/rendering/RenderLayerBacking.h +++ b/Source/WebCore/rendering/RenderLayerBacking.h @@ -130,6 +130,7 @@ public: // GraphicsLayerClient interface virtual bool shouldUseTileCache(const GraphicsLayer*) const; + virtual bool usingTileCache(const GraphicsLayer*) const { return m_usingTiledCacheLayer; } virtual void notifyAnimationStarted(const GraphicsLayer*, double startTime); virtual void notifySyncRequired(const GraphicsLayer*); diff --git a/Source/WebCore/rendering/RenderLayerCompositor.cpp b/Source/WebCore/rendering/RenderLayerCompositor.cpp index 73f05fd7a..47450191a 100644 --- a/Source/WebCore/rendering/RenderLayerCompositor.cpp +++ b/Source/WebCore/rendering/RenderLayerCompositor.cpp @@ -1753,10 +1753,10 @@ bool RenderLayerCompositor::requiresCompositingForAnimation(RenderObject* render if (AnimationController* animController = renderer->animation()) { return (animController->isRunningAnimationOnRenderer(renderer, CSSPropertyOpacity) && inCompositingMode()) #if ENABLE(CSS_FILTERS) -#if !defined(BUILDING_ON_SNOW_LEOPARD) && !defined(BUILDING_ON_LION) +#if !PLATFORM(MAC) || (!PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080) // <rdar://problem/10907251> - WebKit2 doesn't support CA animations of CI filters on Lion and below || animController->isRunningAnimationOnRenderer(renderer, CSSPropertyWebkitFilter) -#endif // !SNOW_LEOPARD && !LION +#endif // !PLATFORM(MAC) || (!PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080) #endif // CSS_FILTERS || animController->isRunningAnimationOnRenderer(renderer, CSSPropertyWebkitTransform); } @@ -1910,7 +1910,7 @@ void RenderLayerCompositor::documentBackgroundColorDidChange() return; GraphicsLayer* graphicsLayer = backing->graphicsLayer(); - if (!graphicsLayer->client()->shouldUseTileCache(graphicsLayer)) + if (!graphicsLayer->client()->usingTileCache(graphicsLayer)) return; Color backgroundColor = m_renderView->frameView()->documentBackgroundColor(); diff --git a/Source/WebCore/rendering/RenderNamedFlowThread.cpp b/Source/WebCore/rendering/RenderNamedFlowThread.cpp index 088b87248..227af7df5 100644 --- a/Source/WebCore/rendering/RenderNamedFlowThread.cpp +++ b/Source/WebCore/rendering/RenderNamedFlowThread.cpp @@ -33,10 +33,16 @@ namespace WebCore { -RenderNamedFlowThread::RenderNamedFlowThread(Node* node, const AtomicString& name) +RenderNamedFlowThread::RenderNamedFlowThread(Node* node, PassRefPtr<WebKitNamedFlow> namedFlow) : RenderFlowThread(node) - , m_flowThreadName(name) + , m_namedFlow(namedFlow) { + m_namedFlow->setRenderer(this); +} + +RenderNamedFlowThread::~RenderNamedFlowThread() +{ + m_namedFlow->setRenderer(0); } const char* RenderNamedFlowThread::renderName() const @@ -44,7 +50,6 @@ const char* RenderNamedFlowThread::renderName() const return "RenderNamedFlowThread"; } - RenderObject* RenderNamedFlowThread::nextRendererForNode(Node* node) const { FlowThreadChildList::const_iterator it = m_flowThreadChildList.begin(); @@ -182,10 +187,14 @@ void RenderNamedFlowThread::removeRegionFromThread(RenderRegion* renderRegion) removeDependencyOnFlowThread(renderRegion->parentNamedFlowThread()); } + if (canBeDestroyed()) { + destroy(); + return; + } + invalidateRegions(); } - void RenderNamedFlowThread::checkInvalidRegions() { for (RenderRegionList::iterator iter = m_regionList.begin(); iter != m_regionList.end(); ++iter) { @@ -245,14 +254,6 @@ void RenderNamedFlowThread::pushDependencies(RenderNamedFlowThreadList& list) } } -WebKitNamedFlow* RenderNamedFlowThread::ensureNamedFlow() -{ - if (!m_namedFlow) - m_namedFlow = WebKitNamedFlow::create(this); - - return m_namedFlow.get(); -} - // The content nodes list contains those nodes with -webkit-flow-into: flow. // An element with display:none should also be listed among those nodes. // The list of nodes is ordered. @@ -283,6 +284,21 @@ void RenderNamedFlowThread::unregisterNamedFlowContentNode(Node* contentNode) contentNode->clearInNamedFlow(); m_contentNodes.remove(contentNode); + if (canBeDestroyed()) + destroy(); +} + +const AtomicString& RenderNamedFlowThread::flowThreadName() const +{ + return m_namedFlow->name(); +} + +void RenderNamedFlowThread::willBeDestroyed() +{ + if (!documentBeingDestroyed()) + view()->flowThreadController()->removeFlowThread(this); + + RenderFlowThread::willBeDestroyed(); } } diff --git a/Source/WebCore/rendering/RenderNamedFlowThread.h b/Source/WebCore/rendering/RenderNamedFlowThread.h index d0c8ca014..5e0d96249 100644 --- a/Source/WebCore/rendering/RenderNamedFlowThread.h +++ b/Source/WebCore/rendering/RenderNamedFlowThread.h @@ -44,9 +44,10 @@ typedef ListHashSet<Node*> NamedFlowContentNodes; class RenderNamedFlowThread : public RenderFlowThread { public: - RenderNamedFlowThread(Node*, const AtomicString&); + RenderNamedFlowThread(Node*, PassRefPtr<WebKitNamedFlow>); + virtual ~RenderNamedFlowThread(); - AtomicString flowThreadName() const { return m_flowThreadName; } + const AtomicString& flowThreadName() const; RenderObject* nextRendererForNode(Node*) const; RenderObject* previousRendererForNode(Node*) const; @@ -63,12 +64,14 @@ public: virtual void addRegionToThread(RenderRegion*) OVERRIDE; virtual void removeRegionFromThread(RenderRegion*) OVERRIDE; - WebKitNamedFlow* ensureNamedFlow(); void registerNamedFlowContentNode(Node*); void unregisterNamedFlowContentNode(Node*); const NamedFlowContentNodes& contentNodes() const { return m_contentNodes; } bool hasContentNode(Node* contentNode) const { ASSERT(contentNode); return m_contentNodes.contains(contentNode); } +protected: + virtual void willBeDestroyed() OVERRIDE; + private: virtual const char* renderName() const OVERRIDE; virtual bool isRenderNamedFlowThread() const OVERRIDE { return true; } @@ -77,11 +80,9 @@ private: void addDependencyOnFlowThread(RenderNamedFlowThread*); void removeDependencyOnFlowThread(RenderNamedFlowThread*); void checkInvalidRegions(); + bool canBeDestroyed() const { return m_regionList.isEmpty() && m_contentNodes.isEmpty(); } private: - // The name of the flow thread as specified in CSS. - AtomicString m_flowThreadName; - // Observer flow threads have invalid regions that depend on the state of this thread // to re-validate their regions. Keeping a set of observer threads make it easy // to notify them when a region was removed from this flow. diff --git a/Source/WebCore/rendering/RenderObject.cpp b/Source/WebCore/rendering/RenderObject.cpp index deb66079c..04f27e652 100755 --- a/Source/WebCore/rendering/RenderObject.cpp +++ b/Source/WebCore/rendering/RenderObject.cpp @@ -282,15 +282,8 @@ void RenderObject::addChild(RenderObject* newChild, RenderObject* beforeChild) needsTable = !isTable(); else if (newChild->isTableRow()) needsTable = !isTableSection(); - else if (newChild->isTableCell()) { + else if (newChild->isTableCell()) needsTable = !isTableRow(); - // I'm not 100% sure this is the best way to fix this, but without this - // change we recurse infinitely when trying to render the CSS2 test page: - // http://www.bath.ac.uk/%7Epy8ieh/internet/eviltests/htmlbodyheadrendering2.html. - // See Radar 2925291. - if (needsTable && isTableCell() && !children->firstChild() && !newChild->isTableCell()) - needsTable = false; - } if (needsTable) { RenderTable* table; @@ -302,10 +295,8 @@ void RenderObject::addChild(RenderObject* newChild, RenderObject* beforeChild) addChild(table, beforeChild); } table->addChild(newChild); - } else { - // Just add it... + } else children->insertChildNode(this, newChild, beforeChild); - } if (newChild->isText() && newChild->style()->textTransform() == CAPITALIZE) toRenderText(newChild)->transformText(); diff --git a/Source/WebCore/rendering/RenderObjectChildList.cpp b/Source/WebCore/rendering/RenderObjectChildList.cpp index 422504e6b..aa1ab8fdc 100644 --- a/Source/WebCore/rendering/RenderObjectChildList.cpp +++ b/Source/WebCore/rendering/RenderObjectChildList.cpp @@ -154,8 +154,12 @@ RenderObject* RenderObjectChildList::removeChildNode(RenderObject* owner, Render oldChild->setNextSibling(0); oldChild->setParent(0); - RenderCounter::rendererRemovedFromTree(oldChild); - RenderQuote::rendererRemovedFromTree(oldChild); + // rendererRemovedFromTree walks the whole subtree. We can improve performance + // by skipping this step when destroying the entire tree. + if (!owner->documentBeingDestroyed()) { + RenderCounter::rendererRemovedFromTree(oldChild); + RenderQuote::rendererRemovedFromTree(oldChild); + } if (AXObjectCache::accessibilityEnabled()) owner->document()->axObjectCache()->childrenChanged(owner); @@ -289,8 +293,9 @@ void RenderObjectChildList::insertChildNode(RenderObject* owner, RenderObject* c static RenderObject* findBeforeAfterParent(RenderObject* object) { - // Only table parts need to search for the :before or :after parent - if (!(object->isTable() || object->isTableSection() || object->isTableRow())) + // Only table parts and flex-boxes need to search for the :before or :after parent + // FIXME: We could likely get away without this check and always look for the right parent. + if (!(object->isTable() || object->isTableSection() || object->isTableRow() || object->isFlexibleBoxIncludingDeprecated())) return object; // If there is a :first-letter style applied on the :before or :after content, diff --git a/Source/WebCore/rendering/RenderQuote.cpp b/Source/WebCore/rendering/RenderQuote.cpp index c4dd0c9d8..79da0d20d 100644 --- a/Source/WebCore/rendering/RenderQuote.cpp +++ b/Source/WebCore/rendering/RenderQuote.cpp @@ -57,12 +57,20 @@ RenderQuote::RenderQuote(Document* node, QuoteType quote) , m_next(0) , m_previous(0) { + view()->addRenderQuote(); } RenderQuote::~RenderQuote() { } +void RenderQuote::willBeDestroyed() +{ + if (view()) + view()->removeRenderQuote(); + RenderText::willBeDestroyed(); +} + const char* RenderQuote::renderName() const { return "RenderQuote"; @@ -278,7 +286,8 @@ void RenderQuote::computePreferredLogicalWidths(float lead) void RenderQuote::rendererSubtreeAttached(RenderObject* renderer) { - if (renderer->documentBeingDestroyed()) + ASSERT(renderer->view()); + if (!renderer->view()->hasRenderQuotes()) return; for (RenderObject* descendant = renderer; descendant; descendant = descendant->nextInPreOrder(renderer)) if (descendant->isQuote()) { @@ -287,17 +296,18 @@ void RenderQuote::rendererSubtreeAttached(RenderObject* renderer) } } -void RenderQuote::rendererRemovedFromTree(RenderObject* subtreeRoot) +void RenderQuote::rendererRemovedFromTree(RenderObject* renderer) { - if (subtreeRoot->documentBeingDestroyed()) + ASSERT(renderer->view()); + if (!renderer->view()->hasRenderQuotes()) return; - for (RenderObject* descendant = subtreeRoot; descendant; descendant = descendant->nextInPreOrder(subtreeRoot)) + for (RenderObject* descendant = renderer; descendant; descendant = descendant->nextInPreOrder(renderer)) if (descendant->isQuote()) { RenderQuote* removedQuote = toRenderQuote(descendant); RenderQuote* lastQuoteBefore = removedQuote->m_previous; removedQuote->m_previous = 0; int depth = removedQuote->m_depth; - for (descendant = descendant->nextInPreOrder(subtreeRoot); descendant; descendant = descendant->nextInPreOrder(subtreeRoot)) + for (descendant = descendant->nextInPreOrder(renderer); descendant; descendant = descendant->nextInPreOrder(renderer)) if (descendant->isQuote()) removedQuote = toRenderQuote(descendant); RenderQuote* quoteAfter = removedQuote->m_next; diff --git a/Source/WebCore/rendering/RenderQuote.h b/Source/WebCore/rendering/RenderQuote.h index d9e54375f..10e22d1c7 100644 --- a/Source/WebCore/rendering/RenderQuote.h +++ b/Source/WebCore/rendering/RenderQuote.h @@ -35,6 +35,7 @@ public: static void rendererRemovedFromTree(RenderObject*); protected: virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle); + virtual void willBeDestroyed(); private: virtual const char* renderName() const; virtual bool isQuote() const { return true; }; diff --git a/Source/WebCore/rendering/RenderTable.cpp b/Source/WebCore/rendering/RenderTable.cpp index 64337bd5e..7730828a4 100644 --- a/Source/WebCore/rendering/RenderTable.cpp +++ b/Source/WebCore/rendering/RenderTable.cpp @@ -521,20 +521,14 @@ void RenderTable::addOverflowFromChildren() addOverflowFromChild(m_captions[i]); // Add overflow from our sections. - for (RenderObject* child = firstChild(); child; child = child->nextSibling()) { - if (child->isTableSection()) { - RenderTableSection* section = toRenderTableSection(child); - addOverflowFromChild(section); - } - } + for (RenderTableSection* section = topSection(); section; section = sectionBelow(section)) + addOverflowFromChild(section); } void RenderTable::setCellLogicalWidths() { - for (RenderObject* child = firstChild(); child; child = child->nextSibling()) { - if (child->isTableSection()) - toRenderTableSection(child)->setCellLogicalWidths(); - } + for (RenderTableSection* section = topSection(); section; section = sectionBelow(section)) + section->setCellLogicalWidths(); } void RenderTable::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset) @@ -1000,18 +994,11 @@ int RenderTable::outerBorderAfter() const if (!collapseBorders()) return 0; int borderWidth = 0; - RenderTableSection* bottomSection; - if (m_foot) - bottomSection = m_foot; - else { - RenderObject* child; - for (child = lastChild(); child && !child->isTableSection(); child = child->previousSibling()) { } - bottomSection = child ? toRenderTableSection(child) : 0; - } - if (bottomSection) { - borderWidth = bottomSection->outerBorderAfter(); + + if (RenderTableSection* section = bottomSection()) { + borderWidth = section->outerBorderAfter(); if (borderWidth < 0) - return 0; // Overridden by hidden + return 0; // Overridden by hidden } const BorderValue& tb = style()->borderAfter(); if (tb.style() == BHIDDEN) @@ -1035,10 +1022,8 @@ int RenderTable::outerBorderStart() const borderWidth = (tb.width() + (style()->isLeftToRightDirection() ? 0 : 1)) / 2; bool allHidden = true; - for (RenderObject* child = firstChild(); child; child = child->nextSibling()) { - if (!child->isTableSection()) - continue; - int sw = toRenderTableSection(child)->outerBorderStart(); + for (RenderTableSection* section = topSection(); section; section = sectionBelow(section)) { + int sw = section->outerBorderStart(); if (sw < 0) continue; allHidden = false; @@ -1064,10 +1049,8 @@ int RenderTable::outerBorderEnd() const borderWidth = (tb.width() + (style()->isLeftToRightDirection() ? 1 : 0)) / 2; bool allHidden = true; - for (RenderObject* child = firstChild(); child; child = child->nextSibling()) { - if (!child->isTableSection()) - continue; - int sw = toRenderTableSection(child)->outerBorderEnd(); + for (RenderTableSection* section = topSection(); section; section = sectionBelow(section)) { + int sw = section->outerBorderEnd(); if (sw < 0) continue; allHidden = false; diff --git a/Source/WebCore/rendering/RenderTableSection.cpp b/Source/WebCore/rendering/RenderTableSection.cpp index 09a63b91f..70161c779 100644 --- a/Source/WebCore/rendering/RenderTableSection.cpp +++ b/Source/WebCore/rendering/RenderTableSection.cpp @@ -340,41 +340,42 @@ int RenderTableSection::calcRowLogicalHeight() for (unsigned c = 0; c < totalCols; c++) { CellStruct& current = cellAt(r, c); - cell = current.primaryCell(); - - if (!cell || current.inColSpan) - continue; + for (unsigned i = 0; i < current.cells.size(); i++) { + cell = current.cells[i]; + if (current.inColSpan && cell->rowSpan() == 1) + continue; - // FIXME: We are always adding the height of a rowspan to the last rows which doesn't match - // other browsers. See webkit.org/b/52185 for example. - if ((cell->rowIndex() + cell->rowSpan() - 1) != r) - continue; + // FIXME: We are always adding the height of a rowspan to the last rows which doesn't match + // other browsers. See webkit.org/b/52185 for example. + if ((cell->rowIndex() + cell->rowSpan() - 1) != r) + continue; - // For row spanning cells, |r| is the last row in the span. - unsigned cellStartRow = cell->rowIndex(); + // For row spanning cells, |r| is the last row in the span. + unsigned cellStartRow = cell->rowIndex(); - if (cell->hasOverrideHeight()) { - if (!statePusher.didPush()) { - // Technically, we should also push state for the row, but since - // rows don't push a coordinate transform, that's not necessary. - statePusher.push(this, locationOffset()); + if (cell->hasOverrideHeight()) { + if (!statePusher.didPush()) { + // Technically, we should also push state for the row, but since + // rows don't push a coordinate transform, that's not necessary. + statePusher.push(this, locationOffset()); + } + cell->clearIntrinsicPadding(); + cell->clearOverrideSize(); + cell->setChildNeedsLayout(true, MarkOnlyThis); + cell->layoutIfNeeded(); } - cell->clearIntrinsicPadding(); - cell->clearOverrideSize(); - cell->setChildNeedsLayout(true, MarkOnlyThis); - cell->layoutIfNeeded(); - } - int cellLogicalHeight = cell->logicalHeightForRowSizing(); - m_rowPos[r + 1] = max(m_rowPos[r + 1], m_rowPos[cellStartRow] + cellLogicalHeight); + int cellLogicalHeight = cell->logicalHeightForRowSizing(); + m_rowPos[r + 1] = max(m_rowPos[r + 1], m_rowPos[cellStartRow] + cellLogicalHeight); - // find out the baseline - EVerticalAlign va = cell->style()->verticalAlign(); - if (va == BASELINE || va == TEXT_BOTTOM || va == TEXT_TOP || va == SUPER || va == SUB || va == LENGTH) { - LayoutUnit baselinePosition = cell->cellBaselinePosition(); - if (baselinePosition > cell->borderBefore() + cell->paddingBefore()) { - m_grid[cellStartRow].baseline = max(m_grid[cellStartRow].baseline, baselinePosition - cell->intrinsicPaddingBefore()); - baselineDescent = max(baselineDescent, m_rowPos[cellStartRow] + cellLogicalHeight - (baselinePosition - cell->intrinsicPaddingBefore())); + // find out the baseline + EVerticalAlign va = cell->style()->verticalAlign(); + if (va == BASELINE || va == TEXT_BOTTOM || va == TEXT_TOP || va == SUPER || va == SUB || va == LENGTH) { + LayoutUnit baselinePosition = cell->cellBaselinePosition(); + if (baselinePosition > cell->borderBefore() + cell->paddingBefore()) { + m_grid[cellStartRow].baseline = max(m_grid[cellStartRow].baseline, baselinePosition - cell->intrinsicPaddingBefore()); + baselineDescent = max(baselineDescent, m_rowPos[cellStartRow] + cellLogicalHeight - (baselinePosition - cell->intrinsicPaddingBefore())); + } } } } @@ -547,6 +548,8 @@ void RenderTableSection::layoutRows() rowRenderer->updateLayerTransform(); } + int rowHeightIncreaseForPagination = 0; + for (unsigned c = 0; c < nEffCols; c++) { CellStruct& cs = cellAt(r, c); RenderTableCell* cell = cs.primaryCell(); @@ -671,13 +674,9 @@ void RenderTableSection::layoutRows() // FIXME: Pagination might have made us change size. For now just shrink or grow the cell to fit without doing a relayout. // We'll also do a basic increase of the row height to accommodate the cell if it's bigger, but this isn't quite right // either. It's at least stable though and won't result in an infinite # of relayouts that may never stabilize. - if (cell->logicalHeight() > rHeight) { - unsigned delta = cell->logicalHeight() - rHeight; - for (unsigned rowIndex = rindx + cell->rowSpan(); rowIndex <= totalRows; rowIndex++) - m_rowPos[rowIndex] += delta; - rHeight = cell->logicalHeight(); - } else - cell->setLogicalHeight(rHeight); + if (cell->logicalHeight() > rHeight) + rowHeightIncreaseForPagination = max<int>(rowHeightIncreaseForPagination, cell->logicalHeight() - rHeight); + cell->setLogicalHeight(rHeight); } LayoutSize childOffset(cell->location() - oldCellRect.location()); @@ -691,6 +690,15 @@ void RenderTableSection::layoutRows() cell->repaintDuringLayoutIfMoved(oldCellRect); } } + if (rowHeightIncreaseForPagination) { + for (unsigned rowIndex = r + 1; rowIndex <= totalRows; rowIndex++) + m_rowPos[rowIndex] += rowHeightIncreaseForPagination; + for (unsigned c = 0; c < nEffCols; ++c) { + Vector<RenderTableCell*, 1>& cells = cellAt(r, c).cells; + for (size_t i = 0; i < cells.size(); ++i) + cells[i]->setLogicalHeight(cells[i]->logicalHeight() + rowHeightIncreaseForPagination); + } + } } #ifndef NDEBUG diff --git a/Source/WebCore/rendering/RenderThemeMac.mm b/Source/WebCore/rendering/RenderThemeMac.mm index e09437db2..6ed4abdef 100644 --- a/Source/WebCore/rendering/RenderThemeMac.mm +++ b/Source/WebCore/rendering/RenderThemeMac.mm @@ -735,7 +735,7 @@ bool RenderThemeMac::paintTextField(RenderObject* o, const PaintInfo& paintInfo, { LocalCurrentGraphicsContext localContext(paintInfo.context); -#if defined(BUILDING_ON_LION) || defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED <= 1070 bool useNSTextFieldCell = o->style()->hasAppearance() && o->style()->visitedDependentColor(CSSPropertyBackgroundColor) == Color::white && !o->style()->hasBackgroundImage(); @@ -2111,7 +2111,7 @@ IntPoint RenderThemeMac::volumeSliderOffsetFromMuteButton(RenderBox* muteButtonB bool RenderThemeMac::shouldShowPlaceholderWhenFocused() const { -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 return true; #else return false; @@ -2183,7 +2183,7 @@ NSTextFieldCell* RenderThemeMac::textField() const [m_textField.get() setBezeled:YES]; [m_textField.get() setEditable:YES]; [m_textField.get() setFocusRingType:NSFocusRingTypeExterior]; -#if defined(BUILDING_ON_LION) || defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED <= 1070 [m_textField.get() setDrawsBackground:YES]; [m_textField.get() setBackgroundColor:[NSColor whiteColor]]; #else diff --git a/Source/WebCore/rendering/RenderView.cpp b/Source/WebCore/rendering/RenderView.cpp index d497a33ab..a895bc99e 100644 --- a/Source/WebCore/rendering/RenderView.cpp +++ b/Source/WebCore/rendering/RenderView.cpp @@ -62,6 +62,8 @@ RenderView::RenderView(Node* node, FrameView* view) , m_pageLogicalHeightChanged(false) , m_layoutState(0) , m_layoutStateDisableCount(0) + , m_renderQuoteCount(0) + , m_renderCounterCount(0) { // Clear our anonymous bit, set because RenderObject assumes // any renderer with document as the node is anonymous. diff --git a/Source/WebCore/rendering/RenderView.h b/Source/WebCore/rendering/RenderView.h index 8e5bc3c5a..a768f79d6 100644 --- a/Source/WebCore/rendering/RenderView.h +++ b/Source/WebCore/rendering/RenderView.h @@ -192,6 +192,17 @@ public: void setFixedPositionedObjectsNeedLayout(); + // FIXME: This is a work around because the current implementation of counters and quotes + // requires walking the entire tree repeatedly and most pages don't actually use either + // feature so we shouldn't take the performance hit when not needed. Long term we should + // rewrite the counter and quotes code. + void addRenderQuote() { m_renderQuoteCount++; } + void removeRenderQuote() { ASSERT(m_renderQuoteCount > 0); m_renderQuoteCount--; } + bool hasRenderQuotes() { return m_renderQuoteCount; } + void addRenderCounter() { m_renderCounterCount++; } + void removeRenderCounter() { ASSERT(m_renderCounterCount > 0); m_renderCounterCount--; } + bool hasRenderCounters() { return m_renderCounterCount; } + protected: virtual void mapLocalToContainer(RenderBoxModelObject* repaintContainer, bool useTransforms, bool fixed, TransformState&, ApplyContainerFlipOrNot = ApplyContainerFlip, bool* wasFixed = 0) const; virtual const RenderObject* pushMappingToContainer(const RenderBoxModelObject* ancestorToStopAt, RenderGeometryMap&) const; @@ -287,6 +298,9 @@ private: #endif OwnPtr<FlowThreadController> m_flowThreadController; RefPtr<IntervalArena> m_intervalArena; + + unsigned m_renderQuoteCount; + unsigned m_renderCounterCount; }; inline RenderView* toRenderView(RenderObject* object) diff --git a/Source/WebCore/rendering/RootInlineBox.cpp b/Source/WebCore/rendering/RootInlineBox.cpp index e410be009..675b0718a 100644 --- a/Source/WebCore/rendering/RootInlineBox.cpp +++ b/Source/WebCore/rendering/RootInlineBox.cpp @@ -883,8 +883,15 @@ LayoutUnit RootInlineBox::verticalPositionForBox(InlineBox* box, VerticalPositio verticalPosition -= (renderer->lineHeight(firstLine, lineDirection) - renderer->baselinePosition(baselineType(), firstLine, lineDirection)); } else if (verticalAlign == BASELINE_MIDDLE) verticalPosition += -renderer->lineHeight(firstLine, lineDirection) / 2 + renderer->baselinePosition(baselineType(), firstLine, lineDirection); - else if (verticalAlign == LENGTH) - verticalPosition -= valueForLength(renderer->style()->verticalAlignLength(), renderer->lineHeight(firstLine, lineDirection), renderer->view()); + else if (verticalAlign == LENGTH) { + LayoutUnit lineHeight; + //Per http://www.w3.org/TR/CSS21/visudet.html#propdef-vertical-align: 'Percentages: refer to the 'line-height' of the element itself'. + if (renderer->style()->verticalAlignLength().isPercent()) + lineHeight = renderer->style()->computedLineHeight(); + else + lineHeight = renderer->lineHeight(firstLine, lineDirection); + verticalPosition -= valueForLength(renderer->style()->verticalAlignLength(), lineHeight, renderer->view()); + } } // Store the cached value. diff --git a/Source/WebCore/rendering/style/RenderStyle.cpp b/Source/WebCore/rendering/style/RenderStyle.cpp index 3ca95d4d0..8e5a90e8c 100644 --- a/Source/WebCore/rendering/style/RenderStyle.cpp +++ b/Source/WebCore/rendering/style/RenderStyle.cpp @@ -1478,24 +1478,12 @@ Color RenderStyle::initialTapHighlightColor() } #endif -void RenderStyle::getImageOutsets(const NinePieceImage& image, LayoutUnit& top, LayoutUnit& right, LayoutUnit& bottom, LayoutUnit& left) const +LayoutBoxExtent RenderStyle::imageOutsets(const NinePieceImage& image) const { - top = NinePieceImage::computeOutset(image.outset().top(), borderTopWidth()); - right = NinePieceImage::computeOutset(image.outset().right(), borderRightWidth()); - bottom = NinePieceImage::computeOutset(image.outset().bottom(), borderBottomWidth()); - left = NinePieceImage::computeOutset(image.outset().left(), borderLeftWidth()); -} - -void RenderStyle::getImageHorizontalOutsets(const NinePieceImage& image, LayoutUnit& left, LayoutUnit& right) const -{ - right = NinePieceImage::computeOutset(image.outset().right(), borderRightWidth()); - left = NinePieceImage::computeOutset(image.outset().left(), borderLeftWidth()); -} - -void RenderStyle::getImageVerticalOutsets(const NinePieceImage& image, LayoutUnit& top, LayoutUnit& bottom) const -{ - top = NinePieceImage::computeOutset(image.outset().top(), borderTopWidth()); - bottom = NinePieceImage::computeOutset(image.outset().bottom(), borderBottomWidth()); + return LayoutBoxExtent(NinePieceImage::computeOutset(image.outset().top(), borderTopWidth()), + NinePieceImage::computeOutset(image.outset().right(), borderRightWidth()), + NinePieceImage::computeOutset(image.outset().bottom(), borderBottomWidth()), + NinePieceImage::computeOutset(image.outset().left(), borderLeftWidth())); } } // namespace WebCore diff --git a/Source/WebCore/rendering/style/RenderStyle.h b/Source/WebCore/rendering/style/RenderStyle.h index cf4f7ba98..a984ff6c0 100644 --- a/Source/WebCore/rendering/style/RenderStyle.h +++ b/Source/WebCore/rendering/style/RenderStyle.h @@ -440,35 +440,19 @@ public: return hasBackgroundImage(); } - void getImageOutsets(const NinePieceImage&, LayoutUnit& top, LayoutUnit& right, LayoutUnit& bottom, LayoutUnit& left) const; + LayoutBoxExtent imageOutsets(const NinePieceImage&) const; bool hasBorderImageOutsets() const { return borderImage().hasImage() && borderImage().outset().nonZero(); } - void getBorderImageOutsets(LayoutUnit& top, LayoutUnit& right, LayoutUnit& bottom, LayoutUnit& left) const + LayoutBoxExtent borderImageOutsets() const { - return getImageOutsets(borderImage(), top, right, bottom, left); + return imageOutsets(borderImage()); } - void getBorderImageHorizontalOutsets(LayoutUnit& left, LayoutUnit& right) const - { - return getImageHorizontalOutsets(borderImage(), left, right); - } - void getBorderImageVerticalOutsets(LayoutUnit& top, LayoutUnit& bottom) const - { - return getImageVerticalOutsets(borderImage(), top, bottom); - } - void getBorderImageInlineDirectionOutsets(LayoutUnit& logicalLeft, LayoutUnit& logicalRight) const - { - return getImageInlineDirectionOutsets(borderImage(), logicalLeft, logicalRight); - } - void getBorderImageBlockDirectionOutsets(LayoutUnit& logicalTop, LayoutUnit& logicalBottom) const - { - return getImageBlockDirectionOutsets(borderImage(), logicalTop, logicalBottom); - } - - void getMaskBoxImageOutsets(LayoutUnit& top, LayoutUnit& right, LayoutUnit& bottom, LayoutUnit& left) const + + LayoutBoxExtent maskBoxImageOutsets() const { - return getImageOutsets(maskBoxImage(), top, right, bottom, left); + return imageOutsets(maskBoxImage()); } #if ENABLE(CSS_FILTERS) @@ -1754,18 +1738,6 @@ private: return isHorizontalWritingMode() ? getShadowVerticalExtent(shadow, logicalTop, logicalBottom) : getShadowHorizontalExtent(shadow, logicalTop, logicalBottom); } - // Helpers for obtaining border image outsets for overflow. - void getImageHorizontalOutsets(const NinePieceImage&, LayoutUnit& left, LayoutUnit& right) const; - void getImageVerticalOutsets(const NinePieceImage&, LayoutUnit& top, LayoutUnit& bottom) const; - void getImageInlineDirectionOutsets(const NinePieceImage& image, LayoutUnit& logicalLeft, LayoutUnit& logicalRight) const - { - return isHorizontalWritingMode() ? getImageHorizontalOutsets(image, logicalLeft, logicalRight) : getImageVerticalOutsets(image, logicalLeft, logicalRight); - } - void getImageBlockDirectionOutsets(const NinePieceImage& image, LayoutUnit& logicalTop, LayoutUnit& logicalBottom) const - { - return isHorizontalWritingMode() ? getImageVerticalOutsets(image, logicalTop, logicalBottom) : getImageHorizontalOutsets(image, logicalTop, logicalBottom); - } - // Color accessors are all private to make sure callers use visitedDependentColor instead to access them. Color invalidColor() const { static Color invalid; return invalid; } Color borderLeftColor() const { return surround->border.left().color(); } diff --git a/Source/WebCore/rendering/svg/RenderSVGEllipse.cpp b/Source/WebCore/rendering/svg/RenderSVGEllipse.cpp index b14f8acce..b4a76531e 100644 --- a/Source/WebCore/rendering/svg/RenderSVGEllipse.cpp +++ b/Source/WebCore/rendering/svg/RenderSVGEllipse.cpp @@ -46,18 +46,18 @@ RenderSVGEllipse::~RenderSVGEllipse() { } -void RenderSVGEllipse::createShape() +void RenderSVGEllipse::updateShapeFromElement() { // Before creating a new object we need to clear the cached bounding box // to avoid using garbage. - m_boundingBox = FloatRect(); - m_outerStrokeRect = FloatRect(); + m_fillBoundingBox = FloatRect(); + m_strokeBoundingBox = FloatRect(); m_center = FloatPoint(); m_radii = FloatSize(); // Fallback to RenderSVGShape if shape has a non-scaling stroke. if (hasNonScalingStroke()) { - RenderSVGShape::createShape(); + RenderSVGShape::updateShapeFromElement(); m_usePathFallback = true; return; } else @@ -69,10 +69,10 @@ void RenderSVGEllipse::createShape() if (m_radii.width() <= 0 || m_radii.height() <= 0) return; - m_boundingBox = FloatRect(m_center.x() - m_radii.width(), m_center.y() - m_radii.height(), 2 * m_radii.width(), 2 * m_radii.height()); - m_outerStrokeRect = m_boundingBox; + m_fillBoundingBox = FloatRect(m_center.x() - m_radii.width(), m_center.y() - m_radii.height(), 2 * m_radii.width(), 2 * m_radii.height()); + m_strokeBoundingBox = m_fillBoundingBox; if (style()->svgStyle()->hasStroke()) - m_outerStrokeRect.inflate(strokeWidth() / 2); + m_strokeBoundingBox.inflate(strokeWidth() / 2); } void RenderSVGEllipse::calculateRadiiAndCenter() @@ -97,27 +97,13 @@ void RenderSVGEllipse::calculateRadiiAndCenter() m_center = FloatPoint(ellipse->cx().value(lengthContext), ellipse->cy().value(lengthContext)); } -FloatRect RenderSVGEllipse::objectBoundingBox() const -{ - if (m_usePathFallback) - return RenderSVGShape::objectBoundingBox(); - return m_boundingBox; -} - -FloatRect RenderSVGEllipse::strokeBoundingBox() const -{ - if (m_usePathFallback) - return RenderSVGShape::strokeBoundingBox(); - return m_outerStrokeRect; -} - void RenderSVGEllipse::fillShape(GraphicsContext* context) const { if (m_usePathFallback) { RenderSVGShape::fillShape(context); return; } - context->fillEllipse(m_boundingBox); + context->fillEllipse(m_fillBoundingBox); } void RenderSVGEllipse::strokeShape(GraphicsContext* context) const @@ -128,7 +114,7 @@ void RenderSVGEllipse::strokeShape(GraphicsContext* context) const RenderSVGShape::strokeShape(context); return; } - context->strokeEllipse(m_boundingBox); + context->strokeEllipse(m_fillBoundingBox); } bool RenderSVGEllipse::shapeDependentStrokeContains(const FloatPoint& point) @@ -137,7 +123,7 @@ bool RenderSVGEllipse::shapeDependentStrokeContains(const FloatPoint& point) // to fall back to RenderSVGShape::shapeDependentStrokeContains in these cases. if (m_usePathFallback || !hasSmoothStroke()) { if (!hasPath()) - RenderSVGShape::createShape(); + RenderSVGShape::updateShapeFromElement(); return RenderSVGShape::shapeDependentStrokeContains(point); } diff --git a/Source/WebCore/rendering/svg/RenderSVGEllipse.h b/Source/WebCore/rendering/svg/RenderSVGEllipse.h index 9e88dee13..f5129df90 100644 --- a/Source/WebCore/rendering/svg/RenderSVGEllipse.h +++ b/Source/WebCore/rendering/svg/RenderSVGEllipse.h @@ -41,19 +41,15 @@ public: private: virtual const char* renderName() const { return "RenderSVGEllipse"; } - virtual void createShape(); - virtual bool isEmpty() const { return m_usePathFallback ? RenderSVGShape::isEmpty() : m_boundingBox.isEmpty(); }; + virtual void updateShapeFromElement(); + virtual bool isEmpty() const { return m_usePathFallback ? RenderSVGShape::isEmpty() : m_fillBoundingBox.isEmpty(); }; virtual void fillShape(GraphicsContext*) const; virtual void strokeShape(GraphicsContext*) const; - virtual FloatRect objectBoundingBox() const; - virtual FloatRect strokeBoundingBox() const; virtual bool shapeDependentStrokeContains(const FloatPoint&); virtual bool shapeDependentFillContains(const FloatPoint&, const WindRule) const; void calculateRadiiAndCenter(); private: - FloatRect m_boundingBox; - FloatRect m_outerStrokeRect; FloatPoint m_center; FloatSize m_radii; bool m_usePathFallback; diff --git a/Source/WebCore/rendering/svg/RenderSVGRect.cpp b/Source/WebCore/rendering/svg/RenderSVGRect.cpp index 120c132cf..c7f9c5b7b 100755 --- a/Source/WebCore/rendering/svg/RenderSVGRect.cpp +++ b/Source/WebCore/rendering/svg/RenderSVGRect.cpp @@ -46,11 +46,11 @@ RenderSVGRect::~RenderSVGRect() { } -void RenderSVGRect::createShape() +void RenderSVGRect::updateShapeFromElement() { // Before creating a new object we need to clear the cached bounding box // to avoid using garbage. - m_boundingBox = FloatRect(); + m_fillBoundingBox = FloatRect(); m_innerStrokeRect = FloatRect(); m_outerStrokeRect = FloatRect(); SVGRectElement* rect = static_cast<SVGRectElement*>(node()); @@ -58,7 +58,7 @@ void RenderSVGRect::createShape() // Fallback to RenderSVGShape if rect has rounded corners or a non-scaling stroke. if (rect->hasAttribute(SVGNames::rxAttr) || rect->hasAttribute(SVGNames::ryAttr) || hasNonScalingStroke()) { - RenderSVGShape::createShape(); + RenderSVGShape::updateShapeFromElement(); m_usePathFallback = true; return; } else @@ -69,12 +69,12 @@ void RenderSVGRect::createShape() if (boundingBoxSize.isEmpty()) return; - m_boundingBox = FloatRect(FloatPoint(rect->x().value(lengthContext), rect->y().value(lengthContext)), boundingBoxSize); + m_fillBoundingBox = FloatRect(FloatPoint(rect->x().value(lengthContext), rect->y().value(lengthContext)), boundingBoxSize); // To decide if the stroke contains a point we create two rects which represent the inner and // the outer stroke borders. A stroke contains the point, if the point is between them. - m_innerStrokeRect = m_boundingBox; - m_outerStrokeRect = m_boundingBox; + m_innerStrokeRect = m_fillBoundingBox; + m_outerStrokeRect = m_fillBoundingBox; if (style()->svgStyle()->hasStroke()) { float strokeWidth = this->strokeWidth(); @@ -82,29 +82,15 @@ void RenderSVGRect::createShape() m_outerStrokeRect.inflate(strokeWidth / 2); } - m_strokeBoundingRect = m_outerStrokeRect; + m_strokeBoundingBox = m_outerStrokeRect; #if USE(CG) // CoreGraphics can inflate the stroke by 1px when drawing a rectangle with antialiasing disabled at non-integer coordinates, we need to compensate. if (style()->svgStyle()->shapeRendering() == SR_CRISPEDGES) - m_strokeBoundingRect.inflate(1); + m_strokeBoundingBox.inflate(1); #endif } -FloatRect RenderSVGRect::objectBoundingBox() const -{ - if (m_usePathFallback) - return RenderSVGShape::objectBoundingBox(); - return m_boundingBox; -} - -FloatRect RenderSVGRect::strokeBoundingBox() const -{ - if (m_usePathFallback) - return RenderSVGShape::strokeBoundingBox(); - return m_strokeBoundingRect; -} - void RenderSVGRect::fillShape(GraphicsContext* context) const { if (m_usePathFallback) { @@ -120,12 +106,12 @@ void RenderSVGRect::fillShape(GraphicsContext* context) const if (context->hasShadow()) { GraphicsContextStateSaver stateSaver(*context); context->clearShadow(); - context->fillRect(m_boundingBox); + context->fillRect(m_fillBoundingBox); return; } #endif - context->fillRect(m_boundingBox); + context->fillRect(m_fillBoundingBox); } void RenderSVGRect::strokeShape(GraphicsContext* context) const @@ -138,7 +124,7 @@ void RenderSVGRect::strokeShape(GraphicsContext* context) const return; } - context->strokeRect(m_boundingBox, strokeWidth()); + context->strokeRect(m_fillBoundingBox, strokeWidth()); } bool RenderSVGRect::shapeDependentStrokeContains(const FloatPoint& point) @@ -147,7 +133,7 @@ bool RenderSVGRect::shapeDependentStrokeContains(const FloatPoint& point) // to fall back to RenderSVGShape::shapeDependentStrokeContains in these cases. if (m_usePathFallback || !hasSmoothStroke()) { if (!hasPath()) - RenderSVGShape::createShape(); + RenderSVGShape::updateShapeFromElement(); return RenderSVGShape::shapeDependentStrokeContains(point); } @@ -158,7 +144,7 @@ bool RenderSVGRect::shapeDependentFillContains(const FloatPoint& point, const Wi { if (m_usePathFallback) return RenderSVGShape::shapeDependentFillContains(point, fillRule); - return m_boundingBox.contains(point.x(), point.y()); + return m_fillBoundingBox.contains(point.x(), point.y()); } } diff --git a/Source/WebCore/rendering/svg/RenderSVGRect.h b/Source/WebCore/rendering/svg/RenderSVGRect.h index 36837f792..63055790c 100644 --- a/Source/WebCore/rendering/svg/RenderSVGRect.h +++ b/Source/WebCore/rendering/svg/RenderSVGRect.h @@ -42,20 +42,16 @@ public: private: virtual const char* renderName() const { return "RenderSVGRect"; } - virtual void createShape(); - virtual bool isEmpty() const { return m_usePathFallback ? RenderSVGShape::isEmpty() : m_boundingBox.isEmpty(); }; + virtual void updateShapeFromElement(); + virtual bool isEmpty() const { return m_usePathFallback ? RenderSVGShape::isEmpty() : m_fillBoundingBox.isEmpty(); }; virtual void fillShape(GraphicsContext*) const; virtual void strokeShape(GraphicsContext*) const; - virtual FloatRect objectBoundingBox() const; - virtual FloatRect strokeBoundingBox() const; virtual bool shapeDependentStrokeContains(const FloatPoint&); virtual bool shapeDependentFillContains(const FloatPoint&, const WindRule) const; private: - FloatRect m_boundingBox; FloatRect m_innerStrokeRect; FloatRect m_outerStrokeRect; - FloatRect m_strokeBoundingRect; bool m_usePathFallback; }; diff --git a/Source/WebCore/rendering/svg/RenderSVGRoot.cpp b/Source/WebCore/rendering/svg/RenderSVGRoot.cpp index c09457e61..707da886e 100644 --- a/Source/WebCore/rendering/svg/RenderSVGRoot.cpp +++ b/Source/WebCore/rendering/svg/RenderSVGRoot.cpp @@ -418,32 +418,35 @@ void RenderSVGRoot::updateCachedBoundaries() bool RenderSVGRoot::nodeAtPoint(const HitTestRequest& request, HitTestResult& result, const HitTestPoint& pointInContainer, const LayoutPoint& accumulatedOffset, HitTestAction hitTestAction) { LayoutPoint pointInParent = pointInContainer.point() - toLayoutSize(accumulatedOffset); - LayoutPoint pointInBorderBox(pointInParent.x() - x(), pointInParent.y() - y()); + LayoutPoint pointInBorderBox = pointInParent - toLayoutSize(location()); - // Note: For now, we're ignoring hits to border and padding for <svg> - if (!contentBoxRect().contains(pointInBorderBox)) - return false; - - FloatPoint localPoint = localToParentTransform().inverse().mapPoint(FloatPoint(pointInParent)); + // Only test SVG content if the point is in our content box. + // FIXME: This should be an intersection when rect-based hit tests are supported by nodeAtFloatPoint. + if (contentBoxRect().contains(pointInBorderBox)) { + FloatPoint localPoint = localToParentTransform().inverse().mapPoint(FloatPoint(pointInParent)); - for (RenderObject* child = lastChild(); child; child = child->previousSibling()) { - if (child->nodeAtFloatPoint(request, result, localPoint, hitTestAction)) { - // FIXME: CSS/HTML assumes the local point is relative to the border box, right? - updateHitTestResult(result, pointInBorderBox); + for (RenderObject* child = lastChild(); child; child = child->previousSibling()) { // FIXME: nodeAtFloatPoint() doesn't handle rect-based hit tests yet. - result.addNodeToRectBasedTestResult(child->node(), pointInContainer); - return true; + if (child->nodeAtFloatPoint(request, result, localPoint, hitTestAction)) { + updateHitTestResult(result, pointInBorderBox); + if (!result.addNodeToRectBasedTestResult(child->node(), pointInContainer)) + return true; + } } } // If we didn't early exit above, we've just hit the container <svg> element. Unlike SVG 1.1, 2nd Edition allows container elements to be hit. - if (hitTestAction == HitTestBlockBackground && style()->pointerEvents() != PE_NONE) { + if (hitTestAction == HitTestBlockBackground && visibleToHitTesting()) { // Only return true here, if the last hit testing phase 'BlockBackground' is executed. If we'd return true in the 'Foreground' phase, // hit testing would stop immediately. For SVG only trees this doesn't matter. Though when we have a <foreignObject> subtree we need // to be able to detect hits on the background of a <div> element. If we'd return true here in the 'Foreground' phase, we are not able // to detect these hits anymore. - updateHitTestResult(result, roundedLayoutPoint(localPoint)); - return true; + LayoutRect boundsRect(accumulatedOffset + location(), size()); + if (pointInContainer.intersects(boundsRect)) { + updateHitTestResult(result, pointInBorderBox); + if (!result.addNodeToRectBasedTestResult(node(), pointInContainer, boundsRect)) + return true; + } } return false; diff --git a/Source/WebCore/rendering/svg/RenderSVGShape.cpp b/Source/WebCore/rendering/svg/RenderSVGShape.cpp index 92d7c28fc..282c50a0b 100755 --- a/Source/WebCore/rendering/svg/RenderSVGShape.cpp +++ b/Source/WebCore/rendering/svg/RenderSVGShape.cpp @@ -64,9 +64,9 @@ RenderSVGShape::~RenderSVGShape() { } -void RenderSVGShape::createShape() +void RenderSVGShape::updateShapeFromElement() { - ASSERT(!m_path); + m_path.clear(); m_path = adoptPtr(new Path); ASSERT(RenderSVGShape::isEmpty()); @@ -74,6 +74,9 @@ void RenderSVGShape::createShape() updatePathFromGraphicsElement(element, path()); processZeroLengthSubpaths(); processMarkerPositions(); + + m_fillBoundingBox = calculateObjectBoundingBox(); + m_strokeBoundingBox = calculateStrokeBoundingBox(); } bool RenderSVGShape::isEmpty() const @@ -86,11 +89,6 @@ void RenderSVGShape::fillShape(GraphicsContext* context) const context->fillPath(path()); } -FloatRect RenderSVGShape::objectBoundingBox() const -{ - return path().fastBoundingRect(); -} - void RenderSVGShape::strokeShape(GraphicsContext* context) const { if (style()->svgStyle()->hasVisibleStroke()) @@ -162,11 +160,11 @@ void RenderSVGShape::layout() bool updateCachedBoundariesInParents = false; - bool needsShapeUpdate = m_needsShapeUpdate; - if (needsShapeUpdate || m_needsBoundariesUpdate) { - m_path.clear(); - createShape(); + if (m_needsShapeUpdate || m_needsBoundariesUpdate) { + updateShapeFromElement(); m_needsShapeUpdate = false; + updateRepaintBoundingBox(); + m_needsBoundariesUpdate = false; updateCachedBoundariesInParents = true; } @@ -180,13 +178,6 @@ void RenderSVGShape::layout() if (everHadLayout() && selfNeedsLayout()) SVGResourcesCache::clientLayoutChanged(this); - // At this point LayoutRepainter already grabbed the old bounds, - // recalculate them now so repaintAfterLayout() uses the new bounds. - if (needsShapeUpdate || m_needsBoundariesUpdate) { - updateCachedBoundaries(); - m_needsBoundariesUpdate = false; - } - // If our bounds changed, notify the parents. if (updateCachedBoundariesInParents) RenderSVGModelObject::setNeedsBoundariesUpdate(); @@ -439,29 +430,44 @@ FloatRect RenderSVGShape::markerRect(float strokeWidth) const return boundaries; } -void RenderSVGShape::updateCachedBoundaries() +FloatRect RenderSVGShape::calculateObjectBoundingBox() const { - if (isEmpty()) { - m_fillBoundingBox = FloatRect(); - m_strokeAndMarkerBoundingBox = FloatRect(); - m_repaintBoundingBox = FloatRect(); - return; + return path().fastBoundingRect(); +} + +FloatRect RenderSVGShape::calculateStrokeBoundingBox() const +{ + ASSERT(m_path); + FloatRect strokeBoundingBox = m_fillBoundingBox; + + const SVGRenderStyle* svgStyle = style()->svgStyle(); + if (svgStyle->hasStroke()) { + BoundingRectStrokeStyleApplier strokeStyle(this, style()); + if (hasNonScalingStroke()) { + AffineTransform nonScalingTransform = nonScalingStrokeTransform(); + if (nonScalingTransform.isInvertible()) { + Path* usePath = nonScalingStrokePath(m_path.get(), nonScalingTransform); + FloatRect strokeBoundingRect = usePath->strokeBoundingRect(&strokeStyle); + strokeBoundingRect = nonScalingTransform.inverse().mapRect(strokeBoundingRect); + strokeBoundingBox.unite(strokeBoundingRect); + } + } else + strokeBoundingBox.unite(path().strokeBoundingRect(&strokeStyle)); + + // FIXME: zero-length subpaths do not respect vector-effect = non-scaling-stroke. + float strokeWidth = this->strokeWidth(); + for (size_t i = 0; i < m_zeroLengthLinecapLocations.size(); ++i) + strokeBoundingBox.unite(zeroLengthSubpathRect(m_zeroLengthLinecapLocations[i], strokeWidth)); } - // Cache _unclipped_ fill bounding box, used for calculations in resources - m_fillBoundingBox = objectBoundingBox(); + if (!m_markerPositions.isEmpty()) + strokeBoundingBox.unite(markerRect(strokeWidth())); - // Add zero-length sub-path linecaps to the fill box - // FIXME: zero-length subpaths do not respect vector-effect = non-scaling-stroke. - float strokeWidth = this->strokeWidth(); - for (size_t i = 0; i < m_zeroLengthLinecapLocations.size(); ++i) - m_fillBoundingBox.unite(zeroLengthSubpathRect(m_zeroLengthLinecapLocations[i], strokeWidth)); - - // Cache _unclipped_ stroke bounding box, used for calculations in resources (includes marker boundaries) - m_strokeAndMarkerBoundingBox = m_fillBoundingBox; - if (hasPath()) - inflateWithStrokeAndMarkerBounds(); - // Cache smallest possible repaint rectangle + return strokeBoundingBox; +} + +void RenderSVGShape::updateRepaintBoundingBox() +{ m_repaintBoundingBox = strokeBoundingBox(); SVGRenderSupport::intersectRepaintRectWithResources(this, m_repaintBoundingBox); } @@ -482,28 +488,6 @@ bool RenderSVGShape::hasSmoothStroke() const && svgStyle->capStyle() == svgStyle->initialCapStyle(); } -void RenderSVGShape::inflateWithStrokeAndMarkerBounds() -{ - const SVGRenderStyle* svgStyle = style()->svgStyle(); - if (svgStyle->hasStroke()) { - BoundingRectStrokeStyleApplier strokeStyle(this, style()); - - // SVG1.2 Tiny only defines non scaling stroke for the stroke but not markers. - if (hasNonScalingStroke()) { - AffineTransform nonScalingTransform = nonScalingStrokeTransform(); - if (nonScalingTransform.isInvertible()) { - Path* usePath = nonScalingStrokePath(m_path.get(), nonScalingTransform); - FloatRect strokeBoundingRect = usePath->strokeBoundingRect(&strokeStyle); - strokeBoundingRect = nonScalingTransform.inverse().mapRect(strokeBoundingRect); - m_strokeAndMarkerBoundingBox.unite(strokeBoundingRect); - } - } else - m_strokeAndMarkerBoundingBox.unite(path().strokeBoundingRect(&strokeStyle)); - } - if (!m_markerPositions.isEmpty()) - m_strokeAndMarkerBoundingBox.unite(markerRect(strokeWidth())); -} - void RenderSVGShape::drawMarkers(PaintInfo& paintInfo) { ASSERT(!m_markerPositions.isEmpty()); diff --git a/Source/WebCore/rendering/svg/RenderSVGShape.h b/Source/WebCore/rendering/svg/RenderSVGShape.h index f6c22db68..81c6b370c 100644 --- a/Source/WebCore/rendering/svg/RenderSVGShape.h +++ b/Source/WebCore/rendering/svg/RenderSVGShape.h @@ -83,11 +83,8 @@ public: } protected: - virtual void createShape(); + virtual void updateShapeFromElement(); virtual bool isEmpty() const; - virtual FloatRect objectBoundingBox() const; - virtual FloatRect strokeBoundingBox() const { return m_strokeAndMarkerBoundingBox; } - void setStrokeAndMarkerBoundingBox(FloatRect rect) { m_strokeAndMarkerBoundingBox = rect; } virtual bool shapeDependentStrokeContains(const FloatPoint&); virtual bool shapeDependentFillContains(const FloatPoint&, const WindRule) const; float strokeWidth() const; @@ -95,6 +92,9 @@ protected: bool hasNonScalingStroke() const { return style()->svgStyle()->vectorEffect() == VE_NON_SCALING_STROKE; } bool hasSmoothStroke() const; + FloatRect m_fillBoundingBox; + FloatRect m_strokeBoundingBox; + private: // Hit-detection separated for the fill and the stroke bool fillContains(const FloatPoint&, bool requiresFill = true, const WindRule fillRule = RULE_NONZERO); @@ -113,7 +113,12 @@ private: virtual bool nodeAtFloatPoint(const HitTestRequest&, HitTestResult&, const FloatPoint& pointInParent, HitTestAction); - void updateCachedBoundaries(); + virtual FloatRect objectBoundingBox() const { return m_fillBoundingBox; } + virtual FloatRect strokeBoundingBox() const { return m_strokeBoundingBox; } + + FloatRect calculateObjectBoundingBox() const; + FloatRect calculateStrokeBoundingBox() const; + void updateRepaintBoundingBox(); AffineTransform nonScalingStrokeTransform() const; bool setupNonScalingStrokeContext(AffineTransform&, GraphicsContextStateSaver&); @@ -132,12 +137,9 @@ private: void strokePath(RenderStyle*, GraphicsContext*, Path*, RenderSVGResource*, const Color&, int); void fillAndStrokePath(GraphicsContext*); - void inflateWithStrokeAndMarkerBounds(); void drawMarkers(PaintInfo&); private: - FloatRect m_fillBoundingBox; - FloatRect m_strokeAndMarkerBoundingBox; FloatRect m_repaintBoundingBox; AffineTransform m_localTransform; OwnPtr<Path> m_path; diff --git a/Source/WebCore/svg/SVGElement.cpp b/Source/WebCore/svg/SVGElement.cpp index c1ffe858d..c80b257da 100644 --- a/Source/WebCore/svg/SVGElement.cpp +++ b/Source/WebCore/svg/SVGElement.cpp @@ -173,12 +173,14 @@ void SVGElement::setXmlbase(const String& value, ExceptionCode&) void SVGElement::removedFrom(ContainerNode* rootParent) { - if (rootParent->inDocument()) { + bool wasInDocument = rootParent->inDocument(); + + StyledElement::removedFrom(rootParent); + + if (wasInDocument) { document()->accessSVGExtensions()->removeAllAnimationElementsFromTarget(this); document()->accessSVGExtensions()->removeAllElementReferencesForTarget(this); } - - StyledElement::removedFrom(rootParent); } SVGSVGElement* SVGElement::ownerSVGElement() const diff --git a/Source/WebCore/svg/SVGStyledElement.cpp b/Source/WebCore/svg/SVGStyledElement.cpp index 7f1e7edbd..0818384ab 100644 --- a/Source/WebCore/svg/SVGStyledElement.cpp +++ b/Source/WebCore/svg/SVGStyledElement.cpp @@ -451,7 +451,6 @@ void SVGStyledElement::clearHasPendingResourcesIfPossible() AffineTransform SVGStyledElement::localCoordinateSpaceTransform(SVGLocatable::CTMScope) const { // To be overriden by SVGStyledLocatableElement/SVGStyledTransformableElement (or as special case SVGTextElement and SVGPatternElement) - ASSERT_NOT_REACHED(); return AffineTransform(); } diff --git a/Source/WebCore/svg/SVGUseElement.cpp b/Source/WebCore/svg/SVGUseElement.cpp index 76684c95f..562c0834b 100755 --- a/Source/WebCore/svg/SVGUseElement.cpp +++ b/Source/WebCore/svg/SVGUseElement.cpp @@ -99,7 +99,7 @@ PassRefPtr<SVGUseElement> SVGUseElement::create(const QualifiedName& tagName, Do { // Always build a #shadow-root for SVGUseElement. RefPtr<SVGUseElement> use = adoptRef(new SVGUseElement(tagName, document, wasInsertedByParser)); - use->ensureShadowRoot(); + use->createShadowSubtree(); return use.release(); } @@ -107,6 +107,14 @@ SVGUseElement::~SVGUseElement() { if (m_cachedDocument) m_cachedDocument->removeClient(this); + + clearResourceReferences(); +} + +void SVGUseElement::createShadowSubtree() +{ + ASSERT(!shadow()); + ShadowRoot::create(this, ShadowRoot::UserAgentShadowRoot); } SVGElementInstance* SVGUseElement::instanceRoot() @@ -401,6 +409,9 @@ void SVGUseElement::clearResourceReferences() } m_needsShadowTreeRecreation = false; + + ASSERT(document()); + document()->accessSVGExtensions()->removeAllTargetReferencesForElement(this); } void SVGUseElement::buildPendingResource() @@ -408,12 +419,12 @@ void SVGUseElement::buildPendingResource() if (!referencedDocument()) return; clearResourceReferences(); - if (!inDocument()) + if (!inDocument() || isInShadowTree()) return; String id; Element* target = SVGURIReference::targetElementFromIRIString(href(), document(), &id, externalDocument()); - if (!target) { + if (!target || !target->inDocument()) { // If we can't find the target of an external element, just give up. // We can't observe if the target somewhen enters the external document, nor should we do it. if (externalDocument()) @@ -459,7 +470,7 @@ void SVGUseElement::buildShadowAndInstanceTree(SVGElement* target) // Eventually enter recursion to build SVGElementInstance objects for the sub-tree children bool foundProblem = false; - buildInstanceTree(target, m_targetElementInstance.get(), foundProblem); + buildInstanceTree(target, m_targetElementInstance.get(), foundProblem, false); if (instanceTreeIsLoading(m_targetElementInstance.get())) return; @@ -513,6 +524,10 @@ void SVGUseElement::buildShadowAndInstanceTree(SVGElement* target) // Update relative length information. updateRelativeLengthsInformation(); + // Rebuild all dependent use elements. + ASSERT(document()); + document()->accessSVGExtensions()->removeAllElementReferencesForTarget(this); + // Eventually dump instance tree #ifdef DUMP_INSTANCE_TREE String text; @@ -580,7 +595,7 @@ RenderObject* SVGUseElement::rendererClipChild() const return 0; } -void SVGUseElement::buildInstanceTree(SVGElement* target, SVGElementInstance* targetInstance, bool& foundProblem) +void SVGUseElement::buildInstanceTree(SVGElement* target, SVGElementInstance* targetInstance, bool& foundProblem, bool foundUse) { ASSERT(target); ASSERT(targetInstance); @@ -593,6 +608,14 @@ void SVGUseElement::buildInstanceTree(SVGElement* target, SVGElementInstance* ta foundProblem = hasCycleUseReferencing(static_cast<SVGUseElement*>(target), targetInstance, newTarget); if (foundProblem) return; + + // We only need to track fist degree <use> dependencies. Indirect references are handled + // as the invalidation bubbles up the dependency chain. + if (!foundUse) { + ASSERT(document()); + document()->accessSVGExtensions()->addElementReferencingTarget(this, target); + foundUse = true; + } } else if (isDisallowedElement(target)) { foundProblem = true; return; @@ -620,7 +643,7 @@ void SVGUseElement::buildInstanceTree(SVGElement* target, SVGElementInstance* ta targetInstance->appendChild(instance.release()); // Enter recursion, appending new instance tree nodes to the "instance" object. - buildInstanceTree(element, instancePtr, foundProblem); + buildInstanceTree(element, instancePtr, foundProblem, foundUse); if (foundProblem) return; } @@ -631,7 +654,7 @@ void SVGUseElement::buildInstanceTree(SVGElement* target, SVGElementInstance* ta RefPtr<SVGElementInstance> newInstance = SVGElementInstance::create(this, static_cast<SVGUseElement*>(target), newTarget); SVGElementInstance* newInstancePtr = newInstance.get(); targetInstance->appendChild(newInstance.release()); - buildInstanceTree(newTarget, newInstancePtr, foundProblem); + buildInstanceTree(newTarget, newInstancePtr, foundProblem, foundUse); } bool SVGUseElement::hasCycleUseReferencing(SVGUseElement* use, SVGElementInstance* targetInstance, SVGElement*& newTarget) diff --git a/Source/WebCore/svg/SVGUseElement.h b/Source/WebCore/svg/SVGUseElement.h index 971ade6f4..8eb6469f4 100755 --- a/Source/WebCore/svg/SVGUseElement.h +++ b/Source/WebCore/svg/SVGUseElement.h @@ -56,6 +56,8 @@ public: private: SVGUseElement(const QualifiedName&, Document*, bool wasInsertedByParser); + void createShadowSubtree(); + virtual bool isValid() const { return SVGTests::isValid(); } virtual bool supportsFocus() const { return true; } @@ -82,7 +84,7 @@ private: virtual bool selfHasRelativeLengths() const; // Instance tree handling - void buildInstanceTree(SVGElement* target, SVGElementInstance* targetInstance, bool& foundCycle); + void buildInstanceTree(SVGElement* target, SVGElementInstance* targetInstance, bool& foundCycle, bool foundUse); bool hasCycleUseReferencing(SVGUseElement*, SVGElementInstance* targetInstance, SVGElement*& newTarget); // Shadow tree handling diff --git a/Source/WebCore/testing/InternalSettings.cpp b/Source/WebCore/testing/InternalSettings.cpp index 83d375374..6d04cc6ea 100644 --- a/Source/WebCore/testing/InternalSettings.cpp +++ b/Source/WebCore/testing/InternalSettings.cpp @@ -27,6 +27,8 @@ #include "InternalSettings.h" #include "CachedResourceLoader.h" +#include "Chrome.h" +#include "ChromeClient.h" #include "Document.h" #include "ExceptionCode.h" #include "Frame.h" @@ -34,9 +36,11 @@ #include "InspectorController.h" #include "Language.h" #include "LocaleToScriptMapping.h" +#include "MockPagePopupDriver.h" #include "Page.h" #include "RuntimeEnabledFeatures.h" #include "Settings.h" +#include "TextRun.h" #if ENABLE(INPUT_TYPE_COLOR) #include "ColorChooser.h" @@ -54,18 +58,6 @@ return; \ } -#define InternalSettingsGuardForFrame() \ - if (!frame()) { \ - ec = INVALID_ACCESS_ERR; \ - return; \ - } - -#define InternalSettingsGuardForFrameView() \ - if (!frame() || !frame()->view()) { \ - ec = INVALID_ACCESS_ERR; \ - return; \ - } - #define InternalSettingsGuardForPageReturn(returnValue) \ if (!page()) { \ ec = INVALID_ACCESS_ERR; \ @@ -80,41 +72,34 @@ namespace WebCore { - -PassRefPtr<InternalSettings> InternalSettings::create(Frame* frame) -{ - return adoptRef(new InternalSettings(frame)); -} - -InternalSettings::~InternalSettings() -{ -} - -InternalSettings::InternalSettings(Frame* frame) - : FrameDestructionObserver(frame) - , m_originalPasswordEchoDurationInSeconds(settings()->passwordEchoDurationInSeconds()) - , m_originalPasswordEchoEnabled(settings()->passwordEchoEnabled()) +InternalSettings::Backup::Backup(Page* page, Settings* settings) + : m_originalPasswordEchoDurationInSeconds(settings->passwordEchoDurationInSeconds()) + , m_originalPasswordEchoEnabled(settings->passwordEchoEnabled()) , m_originalCSSExclusionsEnabled(RuntimeEnabledFeatures::cssExclusionsEnabled()) #if ENABLE(SHADOW_DOM) , m_originalShadowDOMEnabled(RuntimeEnabledFeatures::shadowDOMEnabled()) #endif - , m_originalEditingBehavior(settings()->editingBehaviorType()) - , m_originalFixedPositionCreatesStackingContext(settings()->fixedPositionCreatesStackingContext()) - , m_originalSyncXHRInDocumentsEnabled(settings()->syncXHRInDocumentsEnabled()) + , m_originalEditingBehavior(settings->editingBehaviorType()) + , m_originalFixedPositionCreatesStackingContext(settings->fixedPositionCreatesStackingContext()) + , m_originalSyncXHRInDocumentsEnabled(settings->syncXHRInDocumentsEnabled()) #if ENABLE(INSPECTOR) && ENABLE(JAVASCRIPT_DEBUGGER) - , m_originalJavaScriptProfilingEnabled(page() && page()->inspectorController() && page()->inspectorController()->profilerEnabled()) + , m_originalJavaScriptProfilingEnabled(page->inspectorController() && page->inspectorController()->profilerEnabled()) #endif - , m_originalWindowFocusRestricted(settings()->windowFocusRestricted()) - , m_originalDeviceSupportsTouch(settings()->deviceSupportsTouch()) - , m_originalDeviceSupportsMouse(settings()->deviceSupportsMouse()) + , m_originalWindowFocusRestricted(settings->windowFocusRestricted()) + , m_originalDeviceSupportsTouch(settings->deviceSupportsTouch()) + , m_originalDeviceSupportsMouse(settings->deviceSupportsMouse()) #if ENABLE(TEXT_AUTOSIZING) - , m_originalTextAutosizingEnabled(settings()->textAutosizingEnabled()) - , m_originalTextAutosizingWindowSizeOverride(settings()->textAutosizingWindowSizeOverride()) + , m_originalTextAutosizingEnabled(settings->textAutosizingEnabled()) + , m_originalTextAutosizingWindowSizeOverride(settings->textAutosizingWindowSizeOverride()) +#endif +#if ENABLE(DIALOG_ELEMENT) + , m_originalDialogElementEnabled(RuntimeEnabledFeatures::dialogElementEnabled()) #endif { } -void InternalSettings::restoreTo(Settings* settings) + +void InternalSettings::Backup::restoreTo(Page* page, Settings* settings) { settings->setPasswordEchoDurationInSeconds(m_originalPasswordEchoDurationInSeconds); settings->setPasswordEchoEnabled(m_originalPasswordEchoEnabled); @@ -126,8 +111,8 @@ void InternalSettings::restoreTo(Settings* settings) settings->setFixedPositionCreatesStackingContext(m_originalFixedPositionCreatesStackingContext); settings->setSyncXHRInDocumentsEnabled(m_originalSyncXHRInDocumentsEnabled); #if ENABLE(INSPECTOR) && ENABLE(JAVASCRIPT_DEBUGGER) - if (page() && page()->inspectorController()) - page()->inspectorController()->setProfilerEnabled(m_originalJavaScriptProfilingEnabled); + if (page->inspectorController()) + page->inspectorController()->setProfilerEnabled(m_originalJavaScriptProfilingEnabled); #endif settings->setWindowFocusRestricted(m_originalWindowFocusRestricted); settings->setDeviceSupportsTouch(m_originalDeviceSupportsTouch); @@ -136,23 +121,50 @@ void InternalSettings::restoreTo(Settings* settings) settings->setTextAutosizingEnabled(m_originalTextAutosizingEnabled); settings->setTextAutosizingWindowSizeOverride(m_originalTextAutosizingWindowSizeOverride); #endif +#if ENABLE(DIALOG_ELEMENT) + RuntimeEnabledFeatures::setDialogElementEnabled(m_originalDialogElementEnabled); +#endif } -Settings* InternalSettings::settings() const +InternalSettings* InternalSettings::from(Page* page) +{ + DEFINE_STATIC_LOCAL(AtomicString, name, ("InternalSettings")); + if (!SuperType::from(page, name)) + SuperType::provideTo(page, name, adoptRef(new InternalSettings(page))); + return static_cast<InternalSettings*>(SuperType::from(page, name)); +} + +InternalSettings::~InternalSettings() { - if (!frame() || !frame()->page()) - return 0; - return frame()->page()->settings(); } -Document* InternalSettings::document() const +InternalSettings::InternalSettings(Page* page) + : m_page(page) + , m_backup(page, page->settings()) { - return frame() ? frame()->document() : 0; } -Page* InternalSettings::page() const +void InternalSettings::reset() { - return document() ? document()->page() : 0; + TextRun::setAllowsRoundingHacks(false); + setUserPreferredLanguages(Vector<String>()); + page()->setPagination(Page::Pagination()); + page()->setPageScaleFactor(1, IntPoint(0, 0)); +#if ENABLE(PAGE_POPUP) + m_pagePopupDriver.clear(); + if (page()->chrome()) + page()->chrome()->client()->resetPagePopupDriver(); +#endif + + m_backup.restoreTo(page(), settings()); + m_backup = Backup(page(), settings()); +} + +Settings* InternalSettings::settings() const +{ + if (!page()) + return 0; + return page()->settings(); } void InternalSettings::setInspectorResourcesDataSizeLimits(int maximumResourcesContentSize, int maximumSingleResourceContentSize, ExceptionCode& ec) @@ -220,7 +232,7 @@ void InternalSettings::setPasswordEchoDurationInSeconds(double durationInSeconds void InternalSettings::setFixedElementsLayoutRelativeToFrame(bool enabled, ExceptionCode& ec) { - InternalSettingsGuardForFrameView(); + InternalSettingsGuardForSettings(); settings()->setFixedElementsLayoutRelativeToFrame(enabled); } @@ -412,7 +424,7 @@ void InternalSettings::setEditingBehavior(const String& editingBehavior, Excepti void InternalSettings::setFixedPositionCreatesStackingContext(bool creates, ExceptionCode& ec) { - InternalSettingsGuardForFrameView(); + InternalSettingsGuardForSettings(); settings()->setFixedPositionCreatesStackingContext(creates); } @@ -444,4 +456,131 @@ void InternalSettings::setWindowFocusRestricted(bool restricted, ExceptionCode& settings()->setWindowFocusRestricted(restricted); } +void InternalSettings::setDialogElementEnabled(bool enabled, ExceptionCode& ec) +{ + UNUSED_PARAM(ec); +#if ENABLE(DIALOG_ELEMENT) + RuntimeEnabledFeatures::setDialogElementEnabled(enabled); +#else + UNUSED_PARAM(enabled); +#endif +} + +void InternalSettings::allowRoundingHacks() const +{ + TextRun::setAllowsRoundingHacks(true); +} + +Vector<String> InternalSettings::userPreferredLanguages() const +{ + return WebCore::userPreferredLanguages(); +} + +void InternalSettings::setUserPreferredLanguages(const Vector<String>& languages) +{ + WebCore::overrideUserPreferredLanguages(languages); +} + +void InternalSettings::setShouldDisplayTrackKind(const String& kind, bool enabled, ExceptionCode& ec) +{ + InternalSettingsGuardForSettings(); + +#if ENABLE(VIDEO_TRACK) + if (equalIgnoringCase(kind, "Subtitles")) + settings()->setShouldDisplaySubtitles(enabled); + else if (equalIgnoringCase(kind, "Captions")) + settings()->setShouldDisplayCaptions(enabled); + else if (equalIgnoringCase(kind, "TextDescriptions")) + settings()->setShouldDisplayTextDescriptions(enabled); + else + ec = SYNTAX_ERR; +#else + UNUSED_PARAM(kind); + UNUSED_PARAM(enabled); +#endif +} + +bool InternalSettings::shouldDisplayTrackKind(const String& kind, ExceptionCode& ec) +{ + InternalSettingsGuardForSettingsReturn(false); + +#if ENABLE(VIDEO_TRACK) + if (equalIgnoringCase(kind, "Subtitles")) + return settings()->shouldDisplaySubtitles(); + if (equalIgnoringCase(kind, "Captions")) + return settings()->shouldDisplayCaptions(); + if (equalIgnoringCase(kind, "TextDescriptions")) + return settings()->shouldDisplayTextDescriptions(); + + ec = SYNTAX_ERR; + return false; +#else + UNUSED_PARAM(kind); + return false; +#endif +} + +void InternalSettings::setPagination(const String& mode, int gap, ExceptionCode& ec) +{ + if (!page()) { + ec = INVALID_ACCESS_ERR; + return; + } + + Page::Pagination pagination; + if (mode == "Unpaginated") + pagination.mode = Page::Pagination::Unpaginated; + else if (mode == "LeftToRightPaginated") + pagination.mode = Page::Pagination::LeftToRightPaginated; + else if (mode == "RightToLeftPaginated") + pagination.mode = Page::Pagination::RightToLeftPaginated; + else if (mode == "TopToBottomPaginated") + pagination.mode = Page::Pagination::TopToBottomPaginated; + else if (mode == "BottomToTopPaginated") + pagination.mode = Page::Pagination::BottomToTopPaginated; + else { + ec = SYNTAX_ERR; + return; + } + + pagination.gap = gap; + page()->setPagination(pagination); +} + +void InternalSettings::setEnableMockPagePopup(bool enabled, ExceptionCode& ec) +{ +#if ENABLE(PAGE_POPUP) + InternalSettingsGuardForPage(); + if (!page()->chrome()) + return; + if (!enabled) { + page()->chrome()->client()->resetPagePopupDriver(); + return; + } + if (!m_pagePopupDriver) + m_pagePopupDriver = MockPagePopupDriver::create(page()->mainFrame()); + page()->chrome()->client()->setPagePopupDriver(m_pagePopupDriver.get()); +#else + UNUSED_PARAM(enabled); + UNUSED_PARAM(ec); +#endif +} + +String InternalSettings::configurationForViewport(float devicePixelRatio, int deviceWidth, int deviceHeight, int availableWidth, int availableHeight, ExceptionCode& ec) +{ + if (!page()) { + ec = INVALID_ACCESS_ERR; + return String(); + } + + const int defaultLayoutWidthForNonMobilePages = 980; + + ViewportArguments arguments = page()->viewportArguments(); + ViewportAttributes attributes = computeViewportAttributes(arguments, defaultLayoutWidthForNonMobilePages, deviceWidth, deviceHeight, devicePixelRatio, IntSize(availableWidth, availableHeight)); + restrictMinimumScaleFactorToViewportSize(attributes, IntSize(availableWidth, availableHeight)); + restrictScaleFactorToInitialScaleIfNotUserScalable(attributes); + + return "viewport size " + String::number(attributes.layoutSize.width()) + "x" + String::number(attributes.layoutSize.height()) + " scale " + String::number(attributes.initialScale) + " with limits [" + String::number(attributes.minimumScale) + ", " + String::number(attributes.maximumScale) + "] and userScalable " + (attributes.userScalable ? "true" : "false"); +} + } diff --git a/Source/WebCore/testing/InternalSettings.h b/Source/WebCore/testing/InternalSettings.h index 7c3a330e7..1596836da 100644 --- a/Source/WebCore/testing/InternalSettings.h +++ b/Source/WebCore/testing/InternalSettings.h @@ -27,7 +27,7 @@ #define InternalSettings_h #include "EditingBehaviorTypes.h" -#include "FrameDestructionObserver.h" +#include "RefCountedSupplement.h" #include <wtf/PassRefPtr.h> #include <wtf/RefCounted.h> #include <wtf/text/WTFString.h> @@ -42,16 +42,48 @@ typedef int ExceptionCode; class Frame; class Document; +class MockPagePopupDriver; class Page; class Settings; -class InternalSettings : public RefCounted<InternalSettings>, - public FrameDestructionObserver { +class InternalSettings : public RefCountedSupplement<Page, InternalSettings> { public: - static PassRefPtr<InternalSettings> create(Frame*); + class Backup { + public: + Backup(Page*, Settings*); + void restoreTo(Page*, Settings*); + + double m_originalPasswordEchoDurationInSeconds; + bool m_originalPasswordEchoEnabled; + bool m_originalCSSExclusionsEnabled; +#if ENABLE(SHADOW_DOM) + bool m_originalShadowDOMEnabled; +#endif + EditingBehaviorType m_originalEditingBehavior; + bool m_originalFixedPositionCreatesStackingContext; + bool m_originalSyncXHRInDocumentsEnabled; +#if ENABLE(INSPECTOR) && ENABLE(JAVASCRIPT_DEBUGGER) + bool m_originalJavaScriptProfilingEnabled; +#endif + bool m_originalWindowFocusRestricted; + bool m_originalDeviceSupportsTouch; + bool m_originalDeviceSupportsMouse; +#if ENABLE(TEXT_AUTOSIZING) + bool m_originalTextAutosizingEnabled; + IntSize m_originalTextAutosizingWindowSizeOverride; +#endif +#if ENABLE(DIALOG_ELEMENT) + bool m_originalDialogElementEnabled; +#endif + }; + + typedef RefCountedSupplement<Page, InternalSettings> SuperType; + static InternalSettings* from(Page*); virtual ~InternalSettings(); + void reset(); + void setInspectorResourcesDataSizeLimits(int maximumResourcesContentSize, int maximumSingleResourceContentSize, ExceptionCode&); void setForceCompositingMode(bool enabled, ExceptionCode&); void setEnableCompositingForFixedPosition(bool enabled, ExceptionCode&); @@ -88,36 +120,27 @@ public: void setFixedPositionCreatesStackingContext(bool, ExceptionCode&); void setSyncXHRInDocumentsEnabled(bool, ExceptionCode&); void setWindowFocusRestricted(bool, ExceptionCode&); - - void restoreTo(Settings*); - + void setDialogElementEnabled(bool, ExceptionCode&); void setJavaScriptProfilingEnabled(bool enabled, ExceptionCode&); - + Vector<String> userPreferredLanguages() const; + void setUserPreferredLanguages(const Vector<String>&); + void setPagination(const String& mode, int gap, ExceptionCode&); + void allowRoundingHacks() const; + void setShouldDisplayTrackKind(const String& kind, bool enabled, ExceptionCode&); + bool shouldDisplayTrackKind(const String& kind, ExceptionCode&); + void setEnableMockPagePopup(bool, ExceptionCode&); + String configurationForViewport(float devicePixelRatio, int deviceWidth, int deviceHeight, int availableWidth, int availableHeight, ExceptionCode&); private: - InternalSettings(Frame*); + explicit InternalSettings(Page*); + virtual void hostDestroyed() OVERRIDE { m_page = 0; } Settings* settings() const; - Document* document() const; - Page* page() const; + Page* page() const { return m_page; } - double m_originalPasswordEchoDurationInSeconds; - bool m_originalPasswordEchoEnabled; - bool m_originalCSSExclusionsEnabled; -#if ENABLE(SHADOW_DOM) - bool m_originalShadowDOMEnabled; -#endif - EditingBehaviorType m_originalEditingBehavior; - bool m_originalFixedPositionCreatesStackingContext; - bool m_originalSyncXHRInDocumentsEnabled; -#if ENABLE(INSPECTOR) && ENABLE(JAVASCRIPT_DEBUGGER) - bool m_originalJavaScriptProfilingEnabled; -#endif - bool m_originalWindowFocusRestricted; - bool m_originalDeviceSupportsTouch; - bool m_originalDeviceSupportsMouse; -#if ENABLE(TEXT_AUTOSIZING) - bool m_originalTextAutosizingEnabled; - IntSize m_originalTextAutosizingWindowSizeOverride; + Page* m_page; + Backup m_backup; +#if ENABLE(PAGE_POPUP) + OwnPtr<MockPagePopupDriver> m_pagePopupDriver; #endif }; diff --git a/Source/WebCore/testing/InternalSettings.idl b/Source/WebCore/testing/InternalSettings.idl index 57e0f18be..0e4647283 100644 --- a/Source/WebCore/testing/InternalSettings.idl +++ b/Source/WebCore/testing/InternalSettings.idl @@ -64,6 +64,17 @@ module window { void setSyncXHRInDocumentsEnabled(in boolean enabled) raises(DOMException); void setJavaScriptProfilingEnabled(in boolean creates) raises(DOMException); void setWindowFocusRestricted(in boolean restricted) raises(DOMException); + void setDialogElementEnabled(in boolean enabled) raises(DOMException); + + void setPagination(in DOMString mode, in long gap) raises(DOMException); + sequence<String> userPreferredLanguages(); + void setUserPreferredLanguages(in sequence<String> languages); + void allowRoundingHacks(); + void setEnableMockPagePopup(in boolean enabled) raises(DOMException); +#if defined(ENABLE_VIDEO_TRACK) && ENABLE_VIDEO_TRACK + void setShouldDisplayTrackKind(in DOMString kind, in boolean enabled) raises (DOMException); + boolean shouldDisplayTrackKind(in DOMString trackKind) raises (DOMException); +#endif }; } diff --git a/Source/WebCore/testing/Internals.cpp b/Source/WebCore/testing/Internals.cpp index c97a19deb..188175937 100644 --- a/Source/WebCore/testing/Internals.cpp +++ b/Source/WebCore/testing/Internals.cpp @@ -63,7 +63,6 @@ #include "ShadowRoot.h" #include "SpellChecker.h" #include "TextIterator.h" -#include "TextRun.h" #include "TreeScope.h" #include "ViewportArguments.h" @@ -147,9 +146,31 @@ Internals::~Internals() } Internals::Internals(Document* document) - : FrameDestructionObserver(0) + : ContextDestructionObserver(document) { - reset(document); +} + +Document* Internals::contextDocument() const +{ + return static_cast<Document*>(scriptExecutionContext()); +} + +Frame* Internals::frame() const +{ + if (!contextDocument()) + return 0; + return contextDocument()->frame(); +} + +InternalSettings* Internals::settings() const +{ + Document* document = contextDocument(); + if (!document) + return 0; + Page* page = document->page(); + if (!page) + return 0; + return InternalSettings::from(page); } String Internals::address(Node* node) @@ -607,76 +628,14 @@ void Internals::setScrollViewPosition(Document* document, long x, long y, Except frameView->setConstrainsScrollingToContentEdge(constrainsScrollingToContentEdgeOldValue); } -void Internals::setPagination(Document* document, const String& mode, int gap, ExceptionCode& ec) +void Internals::setPagination(Document*, const String& mode, int gap, ExceptionCode& ec) { - if (!document || !document->page()) { - ec = INVALID_ACCESS_ERR; - return; - } - - Page::Pagination pagination; - if (mode == "Unpaginated") - pagination.mode = Page::Pagination::Unpaginated; - else if (mode == "LeftToRightPaginated") - pagination.mode = Page::Pagination::LeftToRightPaginated; - else if (mode == "RightToLeftPaginated") - pagination.mode = Page::Pagination::RightToLeftPaginated; - else if (mode == "TopToBottomPaginated") - pagination.mode = Page::Pagination::TopToBottomPaginated; - else if (mode == "BottomToTopPaginated") - pagination.mode = Page::Pagination::BottomToTopPaginated; - else { - ec = SYNTAX_ERR; - return; - } - - pagination.gap = gap; - - document->page()->setPagination(pagination); + settings()->setPagination(mode, gap, ec); } -String Internals::configurationForViewport(Document* document, float devicePixelRatio, int deviceWidth, int deviceHeight, int availableWidth, int availableHeight, ExceptionCode& ec) +String Internals::configurationForViewport(Document*, float devicePixelRatio, int deviceWidth, int deviceHeight, int availableWidth, int availableHeight, ExceptionCode& ec) { - if (!document || !document->page()) { - ec = INVALID_ACCESS_ERR; - return String(); - } - - const int defaultLayoutWidthForNonMobilePages = 980; - - ViewportArguments arguments = document->page()->viewportArguments(); - ViewportAttributes attributes = computeViewportAttributes(arguments, defaultLayoutWidthForNonMobilePages, deviceWidth, deviceHeight, devicePixelRatio, IntSize(availableWidth, availableHeight)); - restrictMinimumScaleFactorToViewportSize(attributes, IntSize(availableWidth, availableHeight)); - restrictScaleFactorToInitialScaleIfNotUserScalable(attributes); - - return "viewport size " + String::number(attributes.layoutSize.width()) + "x" + String::number(attributes.layoutSize.height()) + " scale " + String::number(attributes.initialScale) + " with limits [" + String::number(attributes.minimumScale) + ", " + String::number(attributes.maximumScale) + "] and userScalable " + (attributes.userScalable ? "true" : "false"); -} - -void Internals::reset(Document* document) -{ - if (!document || !document->settings()) - return; - - observeFrame(document->frame()); - - if (m_settings) - m_settings->restoreTo(document->page()->settings()); - m_settings = InternalSettings::create(document->frame()); - if (Page* page = document->page()) { - page->setPagination(Page::Pagination()); - - if (document->frame() == page->mainFrame()) - setUserPreferredLanguages(Vector<String>()); - - page->setPageScaleFactor(1, IntPoint(0, 0)); - } - - resetDefaultsToConsistentValues(); -} - -void Internals::resetDefaultsToConsistentValues() -{ - TextRun::setAllowsRoundingHacks(false); + return settings()->configurationForViewport(devicePixelRatio, deviceWidth, deviceHeight, availableWidth, availableHeight, ec); } bool Internals::wasLastChangeUserEdit(Element* textField, ExceptionCode& ec) @@ -907,61 +866,22 @@ int Internals::lastSpellCheckProcessedSequence(Document* document, ExceptionCode Vector<String> Internals::userPreferredLanguages() const { - return WebCore::userPreferredLanguages(); + return settings()->userPreferredLanguages(); } void Internals::setUserPreferredLanguages(const Vector<String>& languages) { - WebCore::overrideUserPreferredLanguages(languages); + settings()->setUserPreferredLanguages(languages); } -void Internals::setShouldDisplayTrackKind(Document* document, const String& kind, bool enabled, ExceptionCode& ec) +void Internals::setShouldDisplayTrackKind(Document*, const String& kind, bool enabled, ExceptionCode& ec) { - if (!document || !document->frame() || !document->frame()->settings()) { - ec = INVALID_ACCESS_ERR; - return; - } - -#if ENABLE(VIDEO_TRACK) - Settings* settings = document->frame()->settings(); - - if (equalIgnoringCase(kind, "Subtitles")) - settings->setShouldDisplaySubtitles(enabled); - else if (equalIgnoringCase(kind, "Captions")) - settings->setShouldDisplayCaptions(enabled); - else if (equalIgnoringCase(kind, "TextDescriptions")) - settings->setShouldDisplayTextDescriptions(enabled); - else - ec = SYNTAX_ERR; -#else - UNUSED_PARAM(kind); - UNUSED_PARAM(enabled); -#endif + settings()->setShouldDisplayTrackKind(kind, enabled, ec); } -bool Internals::shouldDisplayTrackKind(Document* document, const String& kind, ExceptionCode& ec) +bool Internals::shouldDisplayTrackKind(Document*, const String& kind, ExceptionCode& ec) { - if (!document || !document->frame() || !document->frame()->settings()) { - ec = INVALID_ACCESS_ERR; - return false; - } - -#if ENABLE(VIDEO_TRACK) - Settings* settings = document->frame()->settings(); - - if (equalIgnoringCase(kind, "Subtitles")) - return settings->shouldDisplaySubtitles(); - if (equalIgnoringCase(kind, "Captions")) - return settings->shouldDisplayCaptions(); - if (equalIgnoringCase(kind, "TextDescriptions")) - return settings->shouldDisplayTextDescriptions(); - - ec = SYNTAX_ERR; - return false; -#else - UNUSED_PARAM(kind); - return false; -#endif + return settings()->shouldDisplayTrackKind(kind, ec); } unsigned Internals::wheelEventHandlerCount(Document* document, ExceptionCode& ec) @@ -997,12 +917,12 @@ PassRefPtr<NodeList> Internals::nodesFromRect(Document* document, int x, int y, void Internals::emitInspectorDidBeginFrame() { - InspectorInstrumentation::didBeginFrame(frame()->page()); + InspectorInstrumentation::didBeginFrame(contextDocument()->frame()->page()); } void Internals::emitInspectorDidCancelFrame() { - InspectorInstrumentation::didCancelFrame(frame()->page()); + InspectorInstrumentation::didCancelFrame(contextDocument()->frame()->page()); } void Internals::setBatteryStatus(Document* document, const String& eventType, bool charging, double chargingTime, double dischargingTime, double level, ExceptionCode& ec) @@ -1145,7 +1065,7 @@ void Internals::resumeAnimations(Document* document, ExceptionCode& ec) const void Internals::allowRoundingHacks() const { - TextRun::setAllowsRoundingHacks(true); + settings()->allowRoundingHacks(); } String Internals::counterValue(Element* element) diff --git a/Source/WebCore/testing/Internals.h b/Source/WebCore/testing/Internals.h index 792ad6761..3a36ce2c1 100644 --- a/Source/WebCore/testing/Internals.h +++ b/Source/WebCore/testing/Internals.h @@ -26,7 +26,7 @@ #ifndef Internals_h #define Internals_h -#include "FrameDestructionObserver.h" +#include "ContextDestructionObserver.h" #include "NodeList.h" #include "PlatformString.h" #include <wtf/PassRefPtr.h> @@ -41,22 +41,22 @@ class DOMStringList; class Document; class DocumentMarker; class Element; +class Frame; class InternalSettings; class Node; class Range; +class ScriptExecutionContext; class ShadowRoot; class WebKitPoint; typedef int ExceptionCode; -class Internals : public RefCounted<Internals>, - public FrameDestructionObserver { +class Internals : public RefCounted<Internals> + , public ContextDestructionObserver { public: static PassRefPtr<Internals> create(Document*); virtual ~Internals(); - void reset(Document*); - String elementRenderTreeAsText(Element*, ExceptionCode&); String address(Node*); @@ -115,7 +115,6 @@ public: String markerDescriptionForNode(Node*, const String& markerType, unsigned index, ExceptionCode&); void setScrollViewPosition(Document*, long x, long y, ExceptionCode&); - void setPagination(Document*, const String& mode, int gap, ExceptionCode&); String configurationForViewport(Document*, float devicePixelRatio, int deviceWidth, int deviceHeight, int availableWidth, int availableHeight, ExceptionCode&); @@ -167,7 +166,7 @@ public: static const char* internalsId; - InternalSettings* settings() const { return m_settings.get(); } + InternalSettings* settings() const; void setBatteryStatus(Document*, const String& eventType, bool charging, double chargingTime, double dischargingTime, double level, ExceptionCode&); @@ -198,10 +197,10 @@ public: private: explicit Internals(Document*); - DocumentMarker* markerAt(Node*, const String& markerType, unsigned index, ExceptionCode&); - void resetDefaultsToConsistentValues(); + Document* contextDocument() const; + Frame* frame() const; - RefPtr<InternalSettings> m_settings; + DocumentMarker* markerAt(Node*, const String& markerType, unsigned index, ExceptionCode&); }; } // namespace WebCore diff --git a/Source/WebCore/testing/MockPagePopupDriver.cpp b/Source/WebCore/testing/MockPagePopupDriver.cpp new file mode 100644 index 000000000..2b196a426 --- /dev/null +++ b/Source/WebCore/testing/MockPagePopupDriver.cpp @@ -0,0 +1,125 @@ +/* + * Copyright (C) 2012 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "MockPagePopupDriver.h" + +#if ENABLE(PAGE_POPUP) +#include "CSSPropertyNames.h" +#include "CSSValueKeywords.h" +#include "DocumentLoader.h" +#include "DocumentWriter.h" +#include "Frame.h" +#include "HTMLIFrameElement.h" +#include "PagePopup.h" +#include "PagePopupClient.h" +#include "PagePopupController.h" +#include "WebCoreTestSupport.h" + +namespace WebCore { + +class MockPagePopup : public PagePopup { +public: + static PassOwnPtr<MockPagePopup> create(PagePopupClient*, const IntRect& originBoundsInRootView, Frame*); + virtual ~MockPagePopup(); + +private: + MockPagePopup(PagePopupClient*, const IntRect& originBoundsInRootView, Frame*); + + PagePopupClient* m_popupClient; + RefPtr<HTMLIFrameElement> m_iframe; + RefPtr<PagePopupController> m_controller; +}; + +inline MockPagePopup::MockPagePopup(PagePopupClient* client, const IntRect& originBoundsInRootView, Frame* mainFrame) + : m_popupClient(client) + , m_controller(PagePopupController::create(client)) +{ + Document* document = mainFrame->document(); + m_iframe = HTMLIFrameElement::create(HTMLNames::iframeTag, document); + m_iframe->setIdAttribute("mock-page-popup"); + m_iframe->setInlineStyleProperty(CSSPropertyBorderWidth, 0.0, CSSPrimitiveValue::CSS_PX); + m_iframe->setInlineStyleProperty(CSSPropertyPosition, CSSValueAbsolute); + m_iframe->setInlineStyleProperty(CSSPropertyLeft, originBoundsInRootView.x(), CSSPrimitiveValue::CSS_PX, true); + m_iframe->setInlineStyleProperty(CSSPropertyTop, originBoundsInRootView.maxY(), CSSPrimitiveValue::CSS_PX, true); + if (document->body()) + document->body()->appendChild(m_iframe.get()); + Frame* contentFrame = m_iframe->contentFrame(); + DocumentWriter* writer = contentFrame->loader()->activeDocumentLoader()->writer(); + writer->setMIMEType("text/html"); + writer->setEncoding("UTF-8", false); + writer->begin(); + m_popupClient->writeDocument(*writer); + writer->end(); + + WebCoreTestSupport::injectPagePopupController(contentFrame, m_controller.get()); +} + +PassOwnPtr<MockPagePopup> MockPagePopup::create(PagePopupClient* client, const IntRect& originBoundsInRootView, Frame* mainFrame) +{ + return adoptPtr(new MockPagePopup(client, originBoundsInRootView, mainFrame)); +} + +MockPagePopup::~MockPagePopup() +{ + if (m_iframe && m_iframe->parentNode()) + m_iframe->parentNode()->removeChild(m_iframe.get()); + m_popupClient->didClosePopup(); +} + +inline MockPagePopupDriver::MockPagePopupDriver(Frame* mainFrame) + : m_mainFrame(mainFrame) +{ +} + +PassOwnPtr<MockPagePopupDriver> MockPagePopupDriver::create(Frame* mainFrame) +{ + return adoptPtr(new MockPagePopupDriver(mainFrame)); +} + +MockPagePopupDriver::~MockPagePopupDriver() +{ + closePagePopup(m_mockPagePopup.get()); +} + +PagePopup* MockPagePopupDriver::openPagePopup(PagePopupClient* client, const IntRect& originBoundsInRootView) +{ + if (m_mockPagePopup) + closePagePopup(m_mockPagePopup.get()); + if (!client || !m_mainFrame) + return 0; + m_mockPagePopup = MockPagePopup::create(client, originBoundsInRootView, m_mainFrame); + return m_mockPagePopup.get(); +} + +void MockPagePopupDriver::closePagePopup(PagePopup* popup) +{ + if (!popup || popup != m_mockPagePopup.get()) + return; + m_mockPagePopup.clear(); +} + +} +#endif diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCStreamVideoDrawQuad.cpp b/Source/WebCore/testing/MockPagePopupDriver.h index 6a1ba2992..fdbb47f78 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCStreamVideoDrawQuad.cpp +++ b/Source/WebCore/testing/MockPagePopupDriver.h @@ -23,22 +23,37 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "config.h" +#ifndef MockPagePopupDriver_h +#define MockPagePopupDriver_h -#include "cc/CCStreamVideoDrawQuad.h" +#include "PagePopupClient.h" +#include "PagePopupDriver.h" +#include <wtf/RefPtr.h> +#if ENABLE(PAGE_POPUP) namespace WebCore { -PassOwnPtr<CCStreamVideoDrawQuad> CCStreamVideoDrawQuad::create(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect, unsigned textureId, const WebKit::WebTransformationMatrix& matrix) -{ - return adoptPtr(new CCStreamVideoDrawQuad(sharedQuadState, quadRect, textureId, matrix)); -} +class Frame; +class IntRect; +class MockPagePopup; +class PagePopup; -CCStreamVideoDrawQuad::CCStreamVideoDrawQuad(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect, unsigned textureId, const WebKit::WebTransformationMatrix& matrix) - : CCDrawQuad(sharedQuadState, CCDrawQuad::StreamVideoContent, quadRect) - , m_textureId(textureId) - , m_matrix(matrix) -{ -} +class MockPagePopupDriver : public PagePopupDriver { +public: + static PassOwnPtr<MockPagePopupDriver> create(Frame* mainFrame); + virtual ~MockPagePopupDriver(); + +private: + MockPagePopupDriver(Frame* mainFrame); + + // PagePopupDriver functions: + virtual PagePopup* openPagePopup(PagePopupClient*, const IntRect& originBoundsInRootView) OVERRIDE; + virtual void closePagePopup(PagePopup*) OVERRIDE; + + OwnPtr<MockPagePopup> m_mockPagePopup; + Frame* m_mainFrame; +}; } +#endif +#endif diff --git a/Source/WebCore/testing/js/WebCoreTestSupport.cpp b/Source/WebCore/testing/js/WebCoreTestSupport.cpp index cfb938749..138b429f0 100644 --- a/Source/WebCore/testing/js/WebCoreTestSupport.cpp +++ b/Source/WebCore/testing/js/WebCoreTestSupport.cpp @@ -26,6 +26,8 @@ #include "config.h" #include "WebCoreTestSupport.h" +#include "Frame.h" +#include "InternalSettings.h" #include "Internals.h" #include "JSDocument.h" #include "JSInternals.h" @@ -43,8 +45,8 @@ void injectInternalsObject(JSContextRef context) JSLockHolder lock(exec); JSDOMGlobalObject* globalObject = jsCast<JSDOMGlobalObject*>(exec->lexicalGlobalObject()); ScriptExecutionContext* scriptContext = globalObject->scriptExecutionContext(); - Document* document = scriptContext->isDocument() ? static_cast<Document*>(scriptContext) : 0; - globalObject->putDirect(exec->globalData(), Identifier(exec, Internals::internalsId), toJS(exec, globalObject, Internals::create(document))); + if (scriptContext->isDocument()) + globalObject->putDirect(exec->globalData(), Identifier(exec, Internals::internalsId), toJS(exec, globalObject, Internals::create(static_cast<Document*>(scriptContext)))); } void resetInternalsObject(JSContextRef context) @@ -52,14 +54,9 @@ void resetInternalsObject(JSContextRef context) ExecState* exec = toJS(context); JSLockHolder lock(exec); JSDOMGlobalObject* globalObject = jsCast<JSDOMGlobalObject*>(exec->lexicalGlobalObject()); - JSValue internalsJS = globalObject->getDirect(exec->globalData(), Identifier(exec, Internals::internalsId)); - if (internalsJS.isNull() || internalsJS.isEmpty()) - return; - if (Internals* internals = toInternals(internalsJS)) { - ScriptExecutionContext* scriptContext = globalObject->scriptExecutionContext(); - if (scriptContext->isDocument()) - internals->reset(static_cast<Document*>(scriptContext)); - } + ScriptExecutionContext* scriptContext = globalObject->scriptExecutionContext(); + ASSERT(scriptContext->isDocument()); + InternalSettings::from(static_cast<Document*>(scriptContext)->frame()->page())->reset(); } } diff --git a/Source/WebCore/testing/v8/WebCoreTestSupport.cpp b/Source/WebCore/testing/v8/WebCoreTestSupport.cpp index 28c3729f3..2bdb7a959 100644 --- a/Source/WebCore/testing/v8/WebCoreTestSupport.cpp +++ b/Source/WebCore/testing/v8/WebCoreTestSupport.cpp @@ -27,9 +27,11 @@ #include "WebCoreTestSupport.h" #include "Document.h" +#include "InternalSettings.h" #include "Internals.h" #include "ScriptExecutionContext.h" #include "V8Internals.h" +#include "V8PagePopupController.h" #include <v8.h> @@ -43,8 +45,8 @@ void injectInternalsObject(v8::Local<v8::Context> context) v8::HandleScope scope; ScriptExecutionContext* scriptContext = getScriptExecutionContext(); - Document* document = scriptContext->isDocument() ? static_cast<Document*>(scriptContext) : 0; - context->Global()->Set(v8::String::New(Internals::internalsId), toV8(Internals::create(document))); + if (scriptContext->isDocument()) + context->Global()->Set(v8::String::New(Internals::internalsId), toV8(Internals::create(static_cast<Document*>(scriptContext)))); } void resetInternalsObject(v8::Local<v8::Context> context) @@ -56,13 +58,19 @@ void resetInternalsObject(v8::Local<v8::Context> context) v8::Context::Scope contextScope(context); v8::HandleScope scope; - v8::Handle<v8::Object> object = v8::Handle<v8::Object>::Cast(context->Global()->Get(v8::String::New(Internals::internalsId))); - Internals* internals = object->IsUndefined() ? 0 : V8Internals::toNative(object); - if (internals) { - ScriptExecutionContext* scriptContext = getScriptExecutionContext(); - if (scriptContext->isDocument()) - internals->reset(static_cast<Document*>(scriptContext)); - } + ScriptExecutionContext* scriptContext = getScriptExecutionContext(); + ASSERT(scriptContext->isDocument()); + InternalSettings::from(static_cast<Document*>(scriptContext)->frame()->page())->reset(); +} + +#if ENABLE(PAGE_POPUP) +void injectPagePopupController(Frame* frame, PagePopupController* controller) +{ + ASSERT(frame); + ASSERT(controller); + v8::HandleScope scope; + V8Proxy::mainWorldContext(frame)->Global()->Set(v8::String::New("pagePopupController"), toV8(controller)); } +#endif } diff --git a/Source/WebCore/testing/v8/WebCoreTestSupport.h b/Source/WebCore/testing/v8/WebCoreTestSupport.h index fa49c606b..258eea329 100644 --- a/Source/WebCore/testing/v8/WebCoreTestSupport.h +++ b/Source/WebCore/testing/v8/WebCoreTestSupport.h @@ -31,11 +31,20 @@ class Context; template <class T> class Local; } +namespace WebCore { +class Frame; +class PagePopupController; +} + namespace WebCoreTestSupport { void injectInternalsObject(v8::Local<v8::Context>); void resetInternalsObject(v8::Local<v8::Context>); +#if ENABLE(PAGE_POPUP) +void injectPagePopupController(WebCore::Frame*, WebCore::PagePopupController*); +#endif + } // namespace WebCore #endif diff --git a/Source/WebCore/workers/DedicatedWorkerContext.cpp b/Source/WebCore/workers/DedicatedWorkerContext.cpp index 202e29907..f2b2a65f2 100644 --- a/Source/WebCore/workers/DedicatedWorkerContext.cpp +++ b/Source/WebCore/workers/DedicatedWorkerContext.cpp @@ -41,8 +41,8 @@ namespace WebCore { -DedicatedWorkerContext::DedicatedWorkerContext(const KURL& url, const String& userAgent, DedicatedWorkerThread* thread, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType contentSecurityPolicyType) - : WorkerContext(url, userAgent, thread, contentSecurityPolicy, contentSecurityPolicyType) +DedicatedWorkerContext::DedicatedWorkerContext(const KURL& url, const String& userAgent, PassOwnPtr<GroupSettings> settings, DedicatedWorkerThread* thread, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType contentSecurityPolicyType) + : WorkerContext(url, userAgent, settings, thread, contentSecurityPolicy, contentSecurityPolicyType) { } diff --git a/Source/WebCore/workers/DedicatedWorkerContext.h b/Source/WebCore/workers/DedicatedWorkerContext.h index be5befc03..4f7c2c36f 100644 --- a/Source/WebCore/workers/DedicatedWorkerContext.h +++ b/Source/WebCore/workers/DedicatedWorkerContext.h @@ -44,9 +44,9 @@ namespace WebCore { class DedicatedWorkerContext : public WorkerContext { public: typedef WorkerContext Base; - static PassRefPtr<DedicatedWorkerContext> create(const KURL& url, const String& userAgent, DedicatedWorkerThread* thread, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType contentSecurityPolicyType) + static PassRefPtr<DedicatedWorkerContext> create(const KURL& url, const String& userAgent, PassOwnPtr<GroupSettings> settings, DedicatedWorkerThread* thread, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType contentSecurityPolicyType) { - return adoptRef(new DedicatedWorkerContext(url, userAgent, thread, contentSecurityPolicy, contentSecurityPolicyType)); + return adoptRef(new DedicatedWorkerContext(url, userAgent, settings, thread, contentSecurityPolicy, contentSecurityPolicyType)); } virtual bool isDedicatedWorkerContext() const { return true; } @@ -66,7 +66,7 @@ namespace WebCore { DedicatedWorkerThread* thread(); private: - DedicatedWorkerContext(const KURL&, const String& userAgent, DedicatedWorkerThread*, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType); + DedicatedWorkerContext(const KURL&, const String& userAgent, PassOwnPtr<GroupSettings>, DedicatedWorkerThread*, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType); }; } // namespace WebCore diff --git a/Source/WebCore/workers/DedicatedWorkerThread.cpp b/Source/WebCore/workers/DedicatedWorkerThread.cpp index 678ce830f..81a4edf2b 100644 --- a/Source/WebCore/workers/DedicatedWorkerThread.cpp +++ b/Source/WebCore/workers/DedicatedWorkerThread.cpp @@ -54,9 +54,9 @@ DedicatedWorkerThread::~DedicatedWorkerThread() { } -PassRefPtr<WorkerContext> DedicatedWorkerThread::createWorkerContext(const KURL& url, const String& userAgent, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType contentSecurityPolicyType) +PassRefPtr<WorkerContext> DedicatedWorkerThread::createWorkerContext(const KURL& url, const String& userAgent, PassOwnPtr<GroupSettings> settings, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType contentSecurityPolicyType) { - return DedicatedWorkerContext::create(url, userAgent, this, contentSecurityPolicy, contentSecurityPolicyType); + return DedicatedWorkerContext::create(url, userAgent, settings, this, contentSecurityPolicy, contentSecurityPolicyType); } void DedicatedWorkerThread::runEventLoop() diff --git a/Source/WebCore/workers/DedicatedWorkerThread.h b/Source/WebCore/workers/DedicatedWorkerThread.h index 91e4c82dd..5aa13d0d1 100644 --- a/Source/WebCore/workers/DedicatedWorkerThread.h +++ b/Source/WebCore/workers/DedicatedWorkerThread.h @@ -46,7 +46,7 @@ namespace WebCore { ~DedicatedWorkerThread(); protected: - virtual PassRefPtr<WorkerContext> createWorkerContext(const KURL&, const String& userAgent, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType); + virtual PassRefPtr<WorkerContext> createWorkerContext(const KURL&, const String& userAgent, PassOwnPtr<GroupSettings>, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType); virtual void runEventLoop(); private: diff --git a/Source/WebCore/workers/SharedWorkerContext.cpp b/Source/WebCore/workers/SharedWorkerContext.cpp index 942baf640..64fce221b 100644 --- a/Source/WebCore/workers/SharedWorkerContext.cpp +++ b/Source/WebCore/workers/SharedWorkerContext.cpp @@ -50,8 +50,8 @@ PassRefPtr<MessageEvent> createConnectEvent(PassRefPtr<MessagePort> port) return event.release(); } -SharedWorkerContext::SharedWorkerContext(const String& name, const KURL& url, const String& userAgent, SharedWorkerThread* thread, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType contentSecurityPolicyType) - : WorkerContext(url, userAgent, thread, contentSecurityPolicy, contentSecurityPolicyType) +SharedWorkerContext::SharedWorkerContext(const String& name, const KURL& url, const String& userAgent, PassOwnPtr<GroupSettings> settings, SharedWorkerThread* thread, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType contentSecurityPolicyType) + : WorkerContext(url, userAgent, settings, thread, contentSecurityPolicy, contentSecurityPolicyType) , m_name(name) { } diff --git a/Source/WebCore/workers/SharedWorkerContext.h b/Source/WebCore/workers/SharedWorkerContext.h index 5e8e59bf6..0ae0c39cc 100644 --- a/Source/WebCore/workers/SharedWorkerContext.h +++ b/Source/WebCore/workers/SharedWorkerContext.h @@ -44,9 +44,9 @@ namespace WebCore { class SharedWorkerContext : public WorkerContext { public: typedef WorkerContext Base; - static PassRefPtr<SharedWorkerContext> create(const String& name, const KURL& url, const String& userAgent, SharedWorkerThread* thread, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType contentSecurityPolicyType) + static PassRefPtr<SharedWorkerContext> create(const String& name, const KURL& url, const String& userAgent, PassOwnPtr<GroupSettings> settings, SharedWorkerThread* thread, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType contentSecurityPolicyType) { - return adoptRef(new SharedWorkerContext(name, url, userAgent, thread, contentSecurityPolicy, contentSecurityPolicyType)); + return adoptRef(new SharedWorkerContext(name, url, userAgent, settings, thread, contentSecurityPolicy, contentSecurityPolicyType)); } virtual ~SharedWorkerContext(); @@ -61,7 +61,7 @@ namespace WebCore { SharedWorkerThread* thread(); private: - SharedWorkerContext(const String& name, const KURL&, const String&, SharedWorkerThread*, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType); + SharedWorkerContext(const String& name, const KURL&, const String& userAgent, PassOwnPtr<GroupSettings>, SharedWorkerThread*, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType); virtual void logExceptionToConsole(const String& errorMessage, const String& sourceURL, int lineNumber, PassRefPtr<ScriptCallStack>); diff --git a/Source/WebCore/workers/SharedWorkerThread.cpp b/Source/WebCore/workers/SharedWorkerThread.cpp index 50a89c8e7..d39b3351d 100644 --- a/Source/WebCore/workers/SharedWorkerThread.cpp +++ b/Source/WebCore/workers/SharedWorkerThread.cpp @@ -53,9 +53,9 @@ SharedWorkerThread::~SharedWorkerThread() { } -PassRefPtr<WorkerContext> SharedWorkerThread::createWorkerContext(const KURL& url, const String& userAgent, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType contentSecurityPolicyType) +PassRefPtr<WorkerContext> SharedWorkerThread::createWorkerContext(const KURL& url, const String& userAgent, PassOwnPtr<GroupSettings> settings, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType contentSecurityPolicyType) { - return SharedWorkerContext::create(m_name, url, userAgent, this, contentSecurityPolicy, contentSecurityPolicyType); + return SharedWorkerContext::create(m_name, url, userAgent, settings, this, contentSecurityPolicy, contentSecurityPolicyType); } } // namespace WebCore diff --git a/Source/WebCore/workers/SharedWorkerThread.h b/Source/WebCore/workers/SharedWorkerThread.h index 3b35ed133..c343824eb 100644 --- a/Source/WebCore/workers/SharedWorkerThread.h +++ b/Source/WebCore/workers/SharedWorkerThread.h @@ -43,7 +43,7 @@ namespace WebCore { ~SharedWorkerThread(); protected: - virtual PassRefPtr<WorkerContext> createWorkerContext(const KURL&, const String&, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType); + virtual PassRefPtr<WorkerContext> createWorkerContext(const KURL&, const String& userAgent, PassOwnPtr<GroupSettings>, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType); private: SharedWorkerThread(const String& name, const KURL&, const String& userAgent, const GroupSettings*, const String& sourceCode, WorkerLoaderProxy&, WorkerReportingProxy&, WorkerThreadStartMode, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType); diff --git a/Source/WebCore/workers/WorkerContext.cpp b/Source/WebCore/workers/WorkerContext.cpp index b10c1470e..45e5ebedd 100644 --- a/Source/WebCore/workers/WorkerContext.cpp +++ b/Source/WebCore/workers/WorkerContext.cpp @@ -85,9 +85,10 @@ public: virtual bool isCleanupTask() const { return true; } }; -WorkerContext::WorkerContext(const KURL& url, const String& userAgent, WorkerThread* thread, const String& policy, ContentSecurityPolicy::HeaderType contentSecurityPolicyType) +WorkerContext::WorkerContext(const KURL& url, const String& userAgent, PassOwnPtr<GroupSettings> settings, WorkerThread* thread, const String& policy, ContentSecurityPolicy::HeaderType contentSecurityPolicyType) : m_url(url) , m_userAgent(userAgent) + , m_groupSettings(settings) , m_script(adoptPtr(new WorkerScriptController(this))) , m_thread(thread) #if ENABLE(INSPECTOR) diff --git a/Source/WebCore/workers/WorkerContext.h b/Source/WebCore/workers/WorkerContext.h index 0b2f6a1d4..a63ecd80f 100644 --- a/Source/WebCore/workers/WorkerContext.h +++ b/Source/WebCore/workers/WorkerContext.h @@ -33,6 +33,7 @@ #include "EventListener.h" #include "EventNames.h" #include "EventTarget.h" +#include "GroupSettings.h" #include "ScriptExecutionContext.h" #include "WorkerEventQueue.h" #include "WorkerScriptController.h" @@ -68,6 +69,7 @@ namespace WebCore { const KURL& url() const { return m_url; } KURL completeURL(const String&) const; + const GroupSettings* groupSettings() { return m_groupSettings.get(); } virtual String userAgent(const KURL&) const; virtual void disableEval(); @@ -137,7 +139,7 @@ namespace WebCore { void notifyObserversOfStop(); protected: - WorkerContext(const KURL&, const String&, WorkerThread*, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType); + WorkerContext(const KURL&, const String& userAgent, PassOwnPtr<GroupSettings>, WorkerThread*, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType); virtual void logExceptionToConsole(const String& errorMessage, const String& sourceURL, int lineNumber, PassRefPtr<ScriptCallStack>); void addMessageToWorkerConsole(MessageSource, MessageType, MessageLevel, const String& message, const String& sourceURL, unsigned lineNumber, PassRefPtr<ScriptCallStack>); @@ -160,6 +162,7 @@ namespace WebCore { KURL m_url; String m_userAgent; + OwnPtr<GroupSettings> m_groupSettings; mutable RefPtr<WorkerLocation> m_location; mutable RefPtr<WorkerNavigator> m_navigator; diff --git a/Source/WebCore/workers/WorkerThread.cpp b/Source/WebCore/workers/WorkerThread.cpp index 9bde800eb..bd0355c41 100644 --- a/Source/WebCore/workers/WorkerThread.cpp +++ b/Source/WebCore/workers/WorkerThread.cpp @@ -146,7 +146,7 @@ void WorkerThread::workerThread() { { MutexLocker lock(m_threadCreationMutex); - m_workerContext = createWorkerContext(m_startupData->m_scriptURL, m_startupData->m_userAgent, m_startupData->m_contentSecurityPolicy, m_startupData->m_contentSecurityPolicyType); + m_workerContext = createWorkerContext(m_startupData->m_scriptURL, m_startupData->m_userAgent, m_startupData->m_groupSettings.release(), m_startupData->m_contentSecurityPolicy, m_startupData->m_contentSecurityPolicyType); if (m_runLoop.terminated()) { // The worker was terminated before the thread had a chance to run. Since the context didn't exist yet, @@ -193,11 +193,6 @@ void WorkerThread::runEventLoop() m_runLoop.run(m_workerContext.get()); } -GroupSettings* WorkerThread::groupSettings() -{ - return m_startupData->m_groupSettings.get(); -} - class WorkerThreadShutdownFinishTask : public ScriptExecutionContext::Task { public: static PassOwnPtr<WorkerThreadShutdownFinishTask> create() diff --git a/Source/WebCore/workers/WorkerThread.h b/Source/WebCore/workers/WorkerThread.h index 5b1751312..670e3cd1c 100644 --- a/Source/WebCore/workers/WorkerThread.h +++ b/Source/WebCore/workers/WorkerThread.h @@ -62,7 +62,6 @@ namespace WebCore { // Number of active worker threads. static unsigned workerThreadCount(); - GroupSettings* groupSettings(); #if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) NotificationClient* getNotificationClient() { return m_notificationClient; } @@ -73,7 +72,7 @@ namespace WebCore { WorkerThread(const KURL&, const String& userAgent, const GroupSettings*, const String& sourceCode, WorkerLoaderProxy&, WorkerReportingProxy&, WorkerThreadStartMode, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType); // Factory method for creating a new worker context for the thread. - virtual PassRefPtr<WorkerContext> createWorkerContext(const KURL&, const String& userAgent, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType) = 0; + virtual PassRefPtr<WorkerContext> createWorkerContext(const KURL&, const String& userAgent, PassOwnPtr<GroupSettings>, const String& contentSecurityPolicy, ContentSecurityPolicy::HeaderType) = 0; // Executes the event loop for the worker thread. Derived classes can override to perform actions before/after entering the event loop. virtual void runEventLoop(); |