diff options
Diffstat (limited to 'WebCore/page')
33 files changed, 350 insertions, 456 deletions
diff --git a/WebCore/page/DOMWindow.cpp b/WebCore/page/DOMWindow.cpp index 6498042..a369a32 100644 --- a/WebCore/page/DOMWindow.cpp +++ b/WebCore/page/DOMWindow.cpp @@ -56,6 +56,7 @@ #include "FrameView.h" #include "HTMLFrameOwnerElement.h" #include "History.h" +#include "IDBKeyRange.h" #include "IndexedDatabase.h" #include "IndexedDatabaseRequest.h" #include "InspectorController.h" @@ -483,6 +484,7 @@ void DOMWindow::clear() #endif #if ENABLE(INDEXED_DATABASE) + m_idb_key_range = 0; m_indexedDatabaseRequest = 0; #endif } @@ -705,6 +707,14 @@ IndexedDatabaseRequest* DOMWindow::indexedDB() const m_indexedDatabaseRequest = IndexedDatabaseRequest::create(page->group().indexedDatabase()); return m_indexedDatabaseRequest.get(); } + +IDBKeyRange* DOMWindow::iDBKeyRange() const +{ + if (!m_idb_key_range) + m_idb_key_range = IDBKeyRange::create(0, 0, 0); + + return m_idb_key_range.get(); +} #endif void DOMWindow::postMessage(PassRefPtr<SerializedScriptValue> message, MessagePort* port, const String& targetOrigin, DOMWindow* source, ExceptionCode& ec) diff --git a/WebCore/page/DOMWindow.h b/WebCore/page/DOMWindow.h index 69d7428..7a13651 100644 --- a/WebCore/page/DOMWindow.h +++ b/WebCore/page/DOMWindow.h @@ -53,6 +53,7 @@ namespace WebCore { class FloatRect; class Frame; class History; + class IDBKeyRange; class IndexedDatabaseRequest; class InspectorTimelineAgent; class Location; @@ -231,6 +232,7 @@ namespace WebCore { void pageDestroyed(); #if ENABLE(INDEXED_DATABASE) + IDBKeyRange* iDBKeyRange() const; IndexedDatabaseRequest* indexedDB() const; #endif @@ -422,6 +424,7 @@ namespace WebCore { mutable RefPtr<NotificationCenter> m_notifications; #endif #if ENABLE(INDEXED_DATABASE) + mutable RefPtr<IDBKeyRange> m_idb_key_range; mutable RefPtr<IndexedDatabaseRequest> m_indexedDatabaseRequest; #endif diff --git a/WebCore/page/DOMWindow.idl b/WebCore/page/DOMWindow.idl index f6b9feb..74e7504 100644 --- a/WebCore/page/DOMWindow.idl +++ b/WebCore/page/DOMWindow.idl @@ -174,6 +174,7 @@ module window { #endif #if defined(ENABLE_INDEXED_DATABASE) && ENABLE_INDEXED_DATABASE readonly attribute [EnabledAtRuntime] IndexedDatabaseRequest indexedDB; + readonly attribute [EnabledAtRuntime] IDBKeyRange IDBKeyRange; #endif #if defined(ENABLE_ORIENTATION_EVENTS) && ENABLE_ORIENTATION_EVENTS @@ -741,9 +742,7 @@ module window { #endif #endif -#if defined(ENABLE_DATABASE) - attribute SQLExceptionConstructor SQLException; -#endif + attribute [Conditional=DATABASE] SQLExceptionConstructor SQLException; attribute [Conditional=TOUCH_EVENTS] TouchEventConstructor TouchEvent; diff --git a/WebCore/page/DragController.cpp b/WebCore/page/DragController.cpp index 716772b..d93a256 100644 --- a/WebCore/page/DragController.cpp +++ b/WebCore/page/DragController.cpp @@ -170,7 +170,7 @@ void DragController::dragExited(DragData* dragData) if (RefPtr<FrameView> v = mainFrame->view()) { ClipboardAccessPolicy policy = (!m_documentUnderMouse || m_documentUnderMouse->securityOrigin()->isLocal()) ? ClipboardReadable : ClipboardTypesReadable; - RefPtr<Clipboard> clipboard = dragData->createClipboard(policy); + RefPtr<Clipboard> clipboard = Clipboard::create(policy, dragData, mainFrame); clipboard->setSourceOperation(dragData->draggingSourceOperationMask()); mainFrame->eventHandler()->cancelDragAndDrop(createMouseEvent(dragData), clipboard.get()); clipboard->setAccessPolicy(ClipboardNumb); // invalidate clipboard here for security @@ -193,7 +193,7 @@ bool DragController::performDrag(DragData* dragData) RefPtr<Frame> mainFrame = m_page->mainFrame(); if (mainFrame->view()) { // Sending an event can result in the destruction of the view and part. - RefPtr<Clipboard> clipboard = dragData->createClipboard(ClipboardReadable); + RefPtr<Clipboard> clipboard = Clipboard::create(ClipboardReadable, dragData, mainFrame.get()); clipboard->setSourceOperation(dragData->draggingSourceOperationMask()); mainFrame->eventHandler()->performDragAndDrop(createMouseEvent(dragData), clipboard.get()); clipboard->setAccessPolicy(ClipboardNumb); // invalidate clipboard here for security @@ -524,7 +524,7 @@ bool DragController::tryDHTMLDrag(DragData* dragData, DragOperation& operation) return false; ClipboardAccessPolicy policy = m_documentUnderMouse->securityOrigin()->isLocal() ? ClipboardReadable : ClipboardTypesReadable; - RefPtr<Clipboard> clipboard = dragData->createClipboard(policy); + RefPtr<Clipboard> clipboard = Clipboard::create(policy, dragData, mainFrame.get()); DragOperation srcOpMask = dragData->draggingSourceOperationMask(); clipboard->setSourceOperation(srcOpMask); diff --git a/WebCore/page/EventHandler.cpp b/WebCore/page/EventHandler.cpp index e2fab6e..466ddf5 100644 --- a/WebCore/page/EventHandler.cpp +++ b/WebCore/page/EventHandler.cpp @@ -72,6 +72,7 @@ #include "TextEvent.h" #include "TextIterator.h" #include "UserGestureIndicator.h" +#include "UserTypingGestureIndicator.h" #include "WheelEvent.h" #include "htmlediting.h" // for comparePositions() #include <wtf/CurrentTime.h> @@ -869,11 +870,15 @@ void EventHandler::allowDHTMLDrag(bool& flagDHTML, bool& flagUA) const } #endif // ENABLE(DRAG_SUPPORT) +<<<<<<< HEAD #ifdef ANDROID_HITTEST_WITHSIZE HitTestResult EventHandler::hitTestResultAtPoint(const IntPoint& point, bool allowShadowContent, bool ignoreClipping, HitTestScrollbars testScrollbars, int hitType, const IntSize& pointPadding) #else HitTestResult EventHandler::hitTestResultAtPoint(const IntPoint& point, bool allowShadowContent, bool ignoreClipping, HitTestScrollbars testScrollbars, int hitType) #endif +======= +HitTestResult EventHandler::hitTestResultAtPoint(const IntPoint& point, bool allowShadowContent, bool ignoreClipping, HitTestScrollbars testScrollbars, HitTestRequest::HitTestRequestType hitType) +>>>>>>> webkit.org at r64264 { #ifdef ANDROID_HITTEST_WITHSIZE HitTestResult result(point, pointPadding); @@ -1464,7 +1469,7 @@ bool EventHandler::handleMouseMoveEvent(const PlatformMouseEvent& mouseEvent, Hi // if we are allowed to select. // This means that :hover and :active freeze in the state they were in when the mouse // was pressed, rather than updating for nodes the mouse moves over as you hold the mouse down. - int hitType = HitTestRequest::MouseMove; + HitTestRequest::HitTestRequestType hitType = HitTestRequest::MouseMove; if (m_mousePressed && m_mouseDownMayStartSelect) hitType |= HitTestRequest::ReadOnly; if (m_mousePressed) @@ -2305,6 +2310,7 @@ bool EventHandler::keyEvent(const PlatformKeyboardEvent& initialKeyEvent) return false; UserGestureIndicator gestureIndicator(DefinitelyProcessingUserGesture); + UserTypingGestureIndicator typingGestureIndicator(m_frame); if (FrameView* view = m_frame->view()) view->resetDeferredRepaintDelay(); @@ -2886,7 +2892,7 @@ bool EventHandler::handleTouchEvent(const PlatformTouchEvent& event) const PlatformTouchPoint& point = points[i]; IntPoint pagePoint = documentPointForWindowPoint(m_frame, point.pos()); - int hitType = HitTestRequest::Active | HitTestRequest::ReadOnly; + HitTestRequest::HitTestRequestType hitType = HitTestRequest::Active | HitTestRequest::ReadOnly; // The HitTestRequest types used for mouse events map quite adequately // to touch events. Note that in addition to meaning that the hit test // should affect the active state of the current node if necessary, diff --git a/WebCore/page/EventHandler.h b/WebCore/page/EventHandler.h index 5348502..16dadc6 100644 --- a/WebCore/page/EventHandler.h +++ b/WebCore/page/EventHandler.h @@ -106,11 +106,15 @@ public: void dispatchFakeMouseMoveEventSoonInQuad(const FloatQuad&); +<<<<<<< HEAD #ifdef ANDROID_HITTEST_WITHSIZE HitTestResult hitTestResultAtPoint(const IntPoint&, bool allowShadowContent, bool ignoreClipping = false, HitTestScrollbars scrollbars = DontHitTestScrollbars, int hitType = HitTestRequest::ReadOnly | HitTestRequest::Active, const IntSize& pointPadding = IntSize()); #else HitTestResult hitTestResultAtPoint(const IntPoint&, bool allowShadowContent, bool ignoreClipping = false, HitTestScrollbars scrollbars = DontHitTestScrollbars, int hitType = HitTestRequest::ReadOnly | HitTestRequest::Active); #endif +======= + HitTestResult hitTestResultAtPoint(const IntPoint&, bool allowShadowContent, bool ignoreClipping = false, HitTestScrollbars scrollbars = DontHitTestScrollbars, HitTestRequest::HitTestRequestType hitType = HitTestRequest::ReadOnly | HitTestRequest::Active); +>>>>>>> webkit.org at r64264 bool mousePressed() const { return m_mousePressed; } void setMousePressed(bool pressed) { m_mousePressed = pressed; } diff --git a/WebCore/page/Frame.cpp b/WebCore/page/Frame.cpp index a8d0f15..77bf071 100644 --- a/WebCore/page/Frame.cpp +++ b/WebCore/page/Frame.cpp @@ -77,6 +77,7 @@ #include "TextIterator.h" #include "TextResourceDecoder.h" #include "UserContentURLPattern.h" +#include "UserTypingGestureIndicator.h" #include "XMLNSNames.h" #include "XMLNames.h" #include "htmlediting.h" diff --git a/WebCore/page/FrameView.cpp b/WebCore/page/FrameView.cpp index 31f9910..d460da3 100644 --- a/WebCore/page/FrameView.cpp +++ b/WebCore/page/FrameView.cpp @@ -337,6 +337,22 @@ void FrameView::invalidateRect(const IntRect& rect) renderer->repaintRectangle(repaintRect); } +void FrameView::setFrameRect(const IntRect& newRect) +{ + IntRect oldRect = frameRect(); + if (newRect == oldRect) + return; + + ScrollView::setFrameRect(newRect); + +#if USE(ACCELERATED_COMPOSITING) + if (RenderView* root = m_frame->contentRenderer()) { + if (root->usesCompositing()) + root->compositor()->frameViewDidChangeSize(); + } +#endif +} + void FrameView::setMarginWidth(int w) { // make it update the rendering area when set @@ -534,10 +550,10 @@ bool FrameView::syncCompositingStateRecursive() if (!contentRenderer) return true; // We don't want to keep trying to update layers if we have no renderer. - if (m_layoutTimer.isActive()) { - // Don't sync layers if there's a layout pending. + // If we sync compositing layers when a layout is pending, we may cause painting of compositing + // layer content to occur before layout has happened, which will cause paintContents() to bail. + if (needsLayout()) return false; - } if (GraphicsLayer* rootLayer = contentRenderer->compositor()->rootPlatformLayer()) rootLayer->syncCompositingState(); @@ -1131,8 +1147,20 @@ void FrameView::setScrollPosition(const IntPoint& scrollPoint) void FrameView::scrollPositionChangedViaPlatformWidget() { + scrollPositionChanged(); +} + +void FrameView::scrollPositionChanged() +{ frame()->eventHandler()->sendScrollEvent(); repaintFixedElementsAfterScrolling(); + +#if USE(ACCELERATED_COMPOSITING) + if (RenderView* root = m_frame->contentRenderer()) { + if (root->usesCompositing()) + root->compositor()->frameViewDidScroll(scrollPosition()); + } +#endif } void FrameView::repaintFixedElementsAfterScrolling() @@ -1148,13 +1176,6 @@ void FrameView::repaintFixedElementsAfterScrolling() #endif } } - -#if USE(ACCELERATED_COMPOSITING) - if (RenderView* root = m_frame->contentRenderer()) { - if (root->usesCompositing()) - root->compositor()->updateContentLayerScrollPosition(scrollPosition()); - } -#endif } HostWindow* FrameView::hostWindow() const @@ -1745,7 +1766,7 @@ void FrameView::valueChanged(Scrollbar* bar) IntSize offset = scrollOffset(); ScrollView::valueChanged(bar); if (offset != scrollOffset()) - frame()->eventHandler()->sendScrollEvent(); + scrollPositionChanged(); frame()->loader()->client()->didChangeScrollOffset(); } diff --git a/WebCore/page/FrameView.h b/WebCore/page/FrameView.h index 868a15f..718b793 100644 --- a/WebCore/page/FrameView.h +++ b/WebCore/page/FrameView.h @@ -63,6 +63,7 @@ public: virtual HostWindow* hostWindow() const; virtual void invalidateRect(const IntRect&); + virtual void setFrameRect(const IntRect&); Frame* frame() const { return m_frame.get(); } void clearFrame(); @@ -279,6 +280,7 @@ private: bool updateWidgets(); void scrollToAnchor(); + void scrollPositionChanged(); #if ENABLE(INSPECTOR) InspectorTimelineAgent* inspectorTimelineAgent() const; diff --git a/WebCore/page/Geolocation.cpp b/WebCore/page/Geolocation.cpp index abdb8bf..523c21d 100644 --- a/WebCore/page/Geolocation.cpp +++ b/WebCore/page/Geolocation.cpp @@ -421,6 +421,8 @@ void Geolocation::setIsAllowed(bool allowed) if (isAllowed()) { // Permission request was made during the startUpdating process m_startRequestPermissionNotifier->startTimerIfNeeded(); + // The notifier is always ref'ed by m_oneShots or m_watchers. + GeoNotifier* notifier = m_startRequestPermissionNotifier.get(); m_startRequestPermissionNotifier = 0; #if ENABLE(CLIENT_BASED_GEOLOCATION) if (!m_frame) @@ -428,7 +430,7 @@ void Geolocation::setIsAllowed(bool allowed) Page* page = m_frame->page(); if (!page) return; - page->geolocationController()->addObserver(this); + page->geolocationController()->addObserver(this, notifier->m_options->enableHighAccuracy()); #else // TODO: Handle startUpdate() for non-client based implementations using pre-emptive policy #endif @@ -648,8 +650,7 @@ bool Geolocation::startUpdating(GeoNotifier* notifier) if (!page) return false; - // FIXME: Pass options to client. - page->geolocationController()->addObserver(this); + page->geolocationController()->addObserver(this, notifier->m_options->enableHighAccuracy()); return true; #else #if PLATFORM(ANDROID) diff --git a/WebCore/page/GeolocationController.cpp b/WebCore/page/GeolocationController.cpp index 40f01ba..08932a9 100644 --- a/WebCore/page/GeolocationController.cpp +++ b/WebCore/page/GeolocationController.cpp @@ -45,17 +45,21 @@ GeolocationController::~GeolocationController() m_client->geolocationDestroyed(); } -void GeolocationController::addObserver(Geolocation* observer) +void GeolocationController::addObserver(Geolocation* observer, bool enableHighAccuracy) { // This may be called multiple times with the same observer, though removeObserver() // is called only once with each. - if (m_observers.contains(observer)) - return; - bool wasEmpty = m_observers.isEmpty(); m_observers.add(observer); - if (wasEmpty && m_client) - m_client->startUpdating(); + if (enableHighAccuracy) + m_highAccuracyObservers.add(observer); + + if (m_client) { + if (enableHighAccuracy) + m_client->setEnableHighAccuracy(true); + if (wasEmpty) + m_client->startUpdating(); + } } void GeolocationController::removeObserver(Geolocation* observer) @@ -64,8 +68,14 @@ void GeolocationController::removeObserver(Geolocation* observer) return; m_observers.remove(observer); - if (m_observers.isEmpty() && m_client) - m_client->stopUpdating(); + m_highAccuracyObservers.remove(observer); + + if (m_client) { + if (m_observers.isEmpty()) + m_client->stopUpdating(); + else if (m_highAccuracyObservers.isEmpty()) + m_client->setEnableHighAccuracy(false); + } } void GeolocationController::positionChanged(GeolocationPosition* position) diff --git a/WebCore/page/GeolocationController.h b/WebCore/page/GeolocationController.h index bb36101..57f6e32 100644 --- a/WebCore/page/GeolocationController.h +++ b/WebCore/page/GeolocationController.h @@ -45,7 +45,7 @@ public: GeolocationController(Page*, GeolocationControllerClient*); ~GeolocationController(); - void addObserver(Geolocation*); + void addObserver(Geolocation*, bool enableHighAccuracy); void removeObserver(Geolocation*); void positionChanged(GeolocationPosition*); @@ -58,7 +58,10 @@ private: GeolocationControllerClient* m_client; RefPtr<GeolocationPosition> m_lastPosition; - HashSet<RefPtr<Geolocation> > m_observers; + typedef HashSet<RefPtr<Geolocation> > ObserversSet; + // All observers; both those requesting high accuracy and those not. + ObserversSet m_observers; + ObserversSet m_highAccuracyObservers; }; } // namespace WebCore diff --git a/WebCore/page/GeolocationControllerClient.h b/WebCore/page/GeolocationControllerClient.h index cc0e1e4..4648cf8 100644 --- a/WebCore/page/GeolocationControllerClient.h +++ b/WebCore/page/GeolocationControllerClient.h @@ -36,6 +36,11 @@ public: virtual void startUpdating() = 0; virtual void stopUpdating() = 0; + // FIXME: The V2 Geolocation specification proposes that this property is + // renamed. See http://www.w3.org/2008/geolocation/track/issues/6 + // We should update WebKit to reflect this if and when the V2 specification + // is published. + virtual void setEnableHighAccuracy(bool) = 0; virtual GeolocationPosition* lastPosition() = 0; protected: diff --git a/WebCore/page/History.cpp b/WebCore/page/History.cpp index 78e8ea6..337f5b2 100644 --- a/WebCore/page/History.cpp +++ b/WebCore/page/History.cpp @@ -86,14 +86,7 @@ KURL History::urlForState(const String& urlString) if (urlString.isEmpty()) return baseURL; - KURL absoluteURL(baseURL, urlString); - if (!absoluteURL.isValid()) - return KURL(); - - if (absoluteURL.string().left(absoluteURL.pathStart()) != baseURL.string().left(baseURL.pathStart())) - return KURL(); - - return absoluteURL; + return KURL(baseURL, urlString); } void History::stateObjectAdded(PassRefPtr<SerializedScriptValue> data, const String& title, const String& urlString, StateObjectType stateObjectType, ExceptionCode& ec) @@ -102,7 +95,8 @@ void History::stateObjectAdded(PassRefPtr<SerializedScriptValue> data, const Str return; KURL fullURL = urlForState(urlString); - if (!fullURL.isValid()) { + RefPtr<SecurityOrigin> origin = SecurityOrigin::create(fullURL); + if (!fullURL.isValid() || !m_frame->document()->securityOrigin()->isSameSchemeHostPort(origin.get())) { ec = SECURITY_ERR; return; } diff --git a/WebCore/page/Page.cpp b/WebCore/page/Page.cpp index 8e471fc..c997645 100644 --- a/WebCore/page/Page.cpp +++ b/WebCore/page/Page.cpp @@ -62,6 +62,7 @@ #include "SelectionController.h" #include "Settings.h" #include "SharedBuffer.h" +#include "SpeechInput.h" #include "SpeechInputClient.h" #include "StringHash.h" #include "TextResourceDecoder.h" @@ -127,6 +128,7 @@ static void networkStateChanged() frames[i]->document()->dispatchWindowEvent(Event::create(eventName, false, false)); } +<<<<<<< HEAD #if PLATFORM(ANDROID) && ENABLE(APPLICATION_INSTALLED) static void onPackageResultAvailable() { @@ -140,31 +142,35 @@ static void onPackageResultAvailable() Page::Page(ChromeClient* chromeClient, ContextMenuClient* contextMenuClient, EditorClient* editorClient, DragClient* dragClient, InspectorClient* inspectorClient, PluginHalterClient* pluginHalterClient, GeolocationControllerClient* geolocationControllerClient, DeviceOrientationClient* deviceOrientationClient, BackForwardControllerClient* backForwardControllerClient) : m_chrome(new Chrome(this, chromeClient)) +======= +Page::Page(const PageClients& pageClients) + : m_chrome(new Chrome(this, pageClients.chromeClient)) +>>>>>>> webkit.org at r64264 , m_dragCaretController(new SelectionController(0, true)) #if ENABLE(DRAG_SUPPORT) - , m_dragController(new DragController(this, dragClient)) + , m_dragController(new DragController(this, pageClients.dragClient)) #endif , m_focusController(new FocusController(this)) #if ENABLE(CONTEXT_MENUS) - , m_contextMenuController(new ContextMenuController(this, contextMenuClient)) + , m_contextMenuController(new ContextMenuController(this, pageClients.contextMenuClient)) #endif #if ENABLE(INSPECTOR) - , m_inspectorController(new InspectorController(this, inspectorClient)) + , m_inspectorController(new InspectorController(this, pageClients.inspectorClient)) #endif #if ENABLE(CLIENT_BASED_GEOLOCATION) - , m_geolocationController(new GeolocationController(this, geolocationControllerClient)) + , m_geolocationController(new GeolocationController(this, pageClients.geolocationControllerClient)) #endif #if ENABLE(DEVICE_ORIENTATION) - , m_deviceOrientationController(RuntimeEnabledFeatures::deviceOrientationEnabled() ? new DeviceOrientationController(this, deviceOrientationClient) : 0) + , m_deviceOrientationController(RuntimeEnabledFeatures::deviceOrientationEnabled() ? new DeviceOrientationController(this, pageClients.deviceOrientationClient) : 0) #endif #if ENABLE(INPUT_SPEECH) - , m_speechInputClient(0) + , m_speechInputClient(pageClients.speechInputClient) #endif , m_settings(new Settings(this)) , m_progress(new ProgressTracker) - , m_backForwardController(new BackForwardController(this, backForwardControllerClient)) + , m_backForwardController(new BackForwardController(this, pageClients.backForwardControllerClient)) , m_theme(RenderTheme::themeForPage(this)) - , m_editorClient(editorClient) + , m_editorClient(pageClients.editorClient) , m_frameCount(0) , m_openedByDOM(false) , m_tabKeyCyclesThroughElements(true) @@ -182,22 +188,6 @@ Page::Page(ChromeClient* chromeClient, ContextMenuClient* contextMenuClient, Edi , m_customHTMLTokenizerChunkSize(-1) , m_canStartMedia(true) { -#if !ENABLE(CONTEXT_MENUS) - UNUSED_PARAM(contextMenuClient); -#endif -#if !ENABLE(DRAG_SUPPORT) - UNUSED_PARAM(dragClient); -#endif -#if !ENABLE(INSPECTOR) - UNUSED_PARAM(inspectorClient); -#endif -#if !ENABLE(CLIENT_BASED_GEOLOCATION) - UNUSED_PARAM(geolocationControllerClient); -#endif -#if !ENABLE(CLIENT_DEVICE_ORIENTATION) - UNUSED_PARAM(deviceOrientationClient); -#endif - if (!allPages) { allPages = new HashSet<Page*>; @@ -210,8 +200,8 @@ Page::Page(ChromeClient* chromeClient, ContextMenuClient* contextMenuClient, Edi ASSERT(!allPages->contains(this)); allPages->add(this); - if (pluginHalterClient) { - m_pluginHalter.set(new PluginHalter(pluginHalterClient)); + if (pageClients.pluginHalterClient) { + m_pluginHalter.set(new PluginHalter(pageClients.pluginHalterClient)); m_pluginHalter->setPluginAllowedRunTime(m_settings->pluginAllowedRunTime()); } @@ -809,6 +799,16 @@ InspectorTimelineAgent* Page::inspectorTimelineAgent() const } #endif +#if ENABLE(INPUT_SPEECH) +SpeechInput* Page::speechInput() +{ + ASSERT(m_speechInputClient); + if (!m_speechInput.get()) + m_speechInput.set(new SpeechInput(m_speechInputClient)); + return m_speechInput.get(); +} +#endif + void Page::privateBrowsingStateChanged() { bool privateBrowsingEnabled = m_settings->privateBrowsingEnabled(); diff --git a/WebCore/page/Page.h b/WebCore/page/Page.h index 8599a83..aab95f3 100644 --- a/WebCore/page/Page.h +++ b/WebCore/page/Page.h @@ -70,6 +70,7 @@ namespace WebCore { class VisibleSelection; class SelectionController; class Settings; + class SpeechInput; class SpeechInputClient; #if ENABLE(DOM_STORAGE) @@ -90,7 +91,34 @@ namespace WebCore { public: static void setNeedsReapplyStyles(); - Page(ChromeClient*, ContextMenuClient*, EditorClient*, DragClient*, InspectorClient*, PluginHalterClient*, GeolocationControllerClient*, DeviceOrientationClient*, BackForwardControllerClient*); + // It is up to the platform to ensure that non-null clients are provided where required. + struct PageClients { + PageClients() + : chromeClient(0) + , contextMenuClient(0) + , editorClient(0) + , dragClient(0) + , inspectorClient(0) + , pluginHalterClient(0) + , geolocationControllerClient(0) + , deviceOrientationClient(0) + , backForwardControllerClient(0) + , speechInputClient(0) + { } + + ChromeClient* chromeClient; + ContextMenuClient* contextMenuClient; + EditorClient* editorClient; + DragClient* dragClient; + InspectorClient* inspectorClient; + PluginHalterClient* pluginHalterClient; + GeolocationControllerClient* geolocationControllerClient; + DeviceOrientationClient* deviceOrientationClient; + BackForwardControllerClient* backForwardControllerClient; + SpeechInputClient* speechInputClient; + }; + + Page(const PageClients&); ~Page(); RenderTheme* theme() const { return m_theme.get(); }; @@ -154,8 +182,7 @@ namespace WebCore { DeviceOrientationController* deviceOrientationController() const { return m_deviceOrientationController.get(); } #endif #if ENABLE(INPUT_SPEECH) - void setSpeechInputClient(SpeechInputClient* client) { m_speechInputClient = client; } - SpeechInputClient* speechInputClient() const { return m_speechInputClient; } + SpeechInput* speechInput(); #endif Settings* settings() const { return m_settings.get(); } ProgressTracker* progress() const { return m_progress.get(); } @@ -276,6 +303,7 @@ namespace WebCore { #endif #if ENABLE(INPUT_SPEECH) SpeechInputClient* m_speechInputClient; + OwnPtr<SpeechInput> m_speechInput; #endif OwnPtr<Settings> m_settings; OwnPtr<ProgressTracker> m_progress; diff --git a/WebCore/page/PrintContext.cpp b/WebCore/page/PrintContext.cpp index 2bbc63a..74af4b1 100644 --- a/WebCore/page/PrintContext.cpp +++ b/WebCore/page/PrintContext.cpp @@ -203,6 +203,8 @@ int PrintContext::pageNumberForElement(Element* element, const FloatSize& pageSi String PrintContext::pageProperty(Frame* frame, const char* propertyName, int pageNumber) { Document* document = frame->document(); + PrintContext printContext(frame); + printContext.begin(800); // Any width is OK here. document->updateLayout(); RefPtr<RenderStyle> style = document->styleForPage(pageNumber); @@ -218,6 +220,8 @@ String PrintContext::pageProperty(Frame* frame, const char* propertyName, int pa return String::format("%d", style->fontDescription().computedPixelSize()); if (!strcmp(propertyName, "font-family")) return String::format("%s", style->fontDescription().family().family().string().utf8().data()); + if (!strcmp(propertyName, "size")) + return String::format("%d %d", style->pageSize().width().rawValue(), style->pageSize().height().rawValue()); return String::format("pageProperty() unimplemented for: %s", propertyName); } diff --git a/WebCore/page/SecurityOrigin.cpp b/WebCore/page/SecurityOrigin.cpp index aab8866..87b3ed2 100644 --- a/WebCore/page/SecurityOrigin.cpp +++ b/WebCore/page/SecurityOrigin.cpp @@ -32,6 +32,7 @@ #include "Document.h" #include "KURL.h" #include "OriginAccessEntry.h" +#include "SchemeRegistry.h" #include <wtf/StdLibExtras.h> namespace WebCore { @@ -47,48 +48,6 @@ static OriginAccessMap& originAccessMap() return originAccessMap; } -static URLSchemesMap& localSchemes() -{ - DEFINE_STATIC_LOCAL(URLSchemesMap, localSchemes, ()); - - if (localSchemes.isEmpty()) { - localSchemes.add("file"); -#if PLATFORM(MAC) - localSchemes.add("applewebdata"); -#endif -#if PLATFORM(QT) - localSchemes.add("qrc"); -#endif - } - - return localSchemes; -} - -static URLSchemesMap& secureSchemes() -{ - DEFINE_STATIC_LOCAL(URLSchemesMap, secureSchemes, ()); - - if (secureSchemes.isEmpty()) { - secureSchemes.add("https"); - secureSchemes.add("about"); - secureSchemes.add("data"); - } - - return secureSchemes; -} - -static URLSchemesMap& schemesWithUniqueOrigins() -{ - DEFINE_STATIC_LOCAL(URLSchemesMap, schemesWithUniqueOrigins, ()); - - // This is a willful violation of HTML5. - // See https://bugs.webkit.org/show_bug.cgi?id=11885 - if (schemesWithUniqueOrigins.isEmpty()) - schemesWithUniqueOrigins.add("data"); - - return schemesWithUniqueOrigins; -} - static bool schemeRequiresAuthority(const String& scheme) { DEFINE_STATIC_LOCAL(URLSchemesMap, schemes, ()); @@ -108,7 +67,7 @@ SecurityOrigin::SecurityOrigin(const KURL& url, SandboxFlags sandboxFlags) , m_protocol(url.protocol().isNull() ? "" : url.protocol().lower()) , m_host(url.host().isNull() ? "" : url.host().lower()) , m_port(url.port()) - , m_isUnique(isSandboxed(SandboxOrigin) || shouldTreatURLSchemeAsNoAccess(m_protocol)) + , m_isUnique(isSandboxed(SandboxOrigin) || SchemeRegistry::shouldTreatURLSchemeAsNoAccess(m_protocol)) , m_universalAccess(false) , m_domainWasSetInDOM(false) , m_enforceFilePathSeparation(false) @@ -315,7 +274,7 @@ bool SecurityOrigin::isAccessWhiteListed(const SecurityOrigin* targetOrigin) con bool SecurityOrigin::canLoad(const KURL& url, const String& referrer, Document* document) { - if (!shouldTreatURLAsLocal(url.string())) + if (!SchemeRegistry::shouldTreatURLAsLocal(url.string())) return true; // If we were provided a document, we first check if the access has been white listed. @@ -329,7 +288,7 @@ bool SecurityOrigin::canLoad(const KURL& url, const String& referrer, Document* return documentOrigin->canLoadLocalResources(); } if (!referrer.isEmpty()) - return shouldTreatURLAsLocal(referrer); + return SchemeRegistry::shouldTreatURLAsLocal(referrer); return false; } @@ -357,7 +316,7 @@ void SecurityOrigin::enforceFilePathSeparation() bool SecurityOrigin::isLocal() const { - return shouldTreatURLSchemeAsLocal(m_protocol); + return SchemeRegistry::shouldTreatURLSchemeAsLocal(m_protocol); } bool SecurityOrigin::isSecureTransitionTo(const KURL& url) const @@ -557,85 +516,6 @@ bool SecurityOrigin::isSameSchemeHostPort(const SecurityOrigin* other) const return true; } -void SecurityOrigin::registerURLSchemeAsLocal(const String& scheme) -{ - localSchemes().add(scheme); -} - -void SecurityOrigin::removeURLSchemeRegisteredAsLocal(const String& scheme) -{ - if (scheme == "file") - return; -#if PLATFORM(MAC) - if (scheme == "applewebdata") - return; -#endif - localSchemes().remove(scheme); -} - -const URLSchemesMap& SecurityOrigin::localURLSchemes() -{ - return localSchemes(); -} - -bool SecurityOrigin::shouldTreatURLAsLocal(const String& url) -{ - // This avoids an allocation of another String and the HashSet contains() - // call for the file: and http: schemes. - if (url.length() >= 5) { - const UChar* s = url.characters(); - if (s[0] == 'h' && s[1] == 't' && s[2] == 't' && s[3] == 'p' && s[4] == ':') - return false; - if (s[0] == 'f' && s[1] == 'i' && s[2] == 'l' && s[3] == 'e' && s[4] == ':') - return true; - } - - int loc = url.find(':'); - if (loc == -1) - return false; - - String scheme = url.left(loc); - return localSchemes().contains(scheme); -} - -bool SecurityOrigin::shouldTreatURLSchemeAsLocal(const String& scheme) -{ - // This avoids an allocation of another String and the HashSet contains() - // call for the file: and http: schemes. - if (scheme.length() == 4) { - const UChar* s = scheme.characters(); - if (s[0] == 'h' && s[1] == 't' && s[2] == 't' && s[3] == 'p') - return false; - if (s[0] == 'f' && s[1] == 'i' && s[2] == 'l' && s[3] == 'e') - return true; - } - - if (scheme.isEmpty()) - return false; - - return localSchemes().contains(scheme); -} - -void SecurityOrigin::registerURLSchemeAsNoAccess(const String& scheme) -{ - schemesWithUniqueOrigins().add(scheme); -} - -bool SecurityOrigin::shouldTreatURLSchemeAsNoAccess(const String& scheme) -{ - return schemesWithUniqueOrigins().contains(scheme); -} - -void SecurityOrigin::registerURLSchemeAsSecure(const String& scheme) -{ - secureSchemes().add(scheme); -} - -bool SecurityOrigin::shouldTreatURLSchemeAsSecure(const String& scheme) -{ - return secureSchemes().contains(scheme); -} - bool SecurityOrigin::shouldHideReferrer(const KURL& url, const String& referrer) { bool referrerIsSecureURL = protocolIs(referrer, "https"); diff --git a/WebCore/page/SecurityOrigin.h b/WebCore/page/SecurityOrigin.h index 2254096..fa5b1e4 100644 --- a/WebCore/page/SecurityOrigin.h +++ b/WebCore/page/SecurityOrigin.h @@ -40,8 +40,6 @@ namespace WebCore { -typedef HashSet<String, CaseFoldingHash> URLSchemesMap; - class Document; class KURL; @@ -174,18 +172,6 @@ public: // (and whether it was set) but considering the host. It is used for postMessage. bool isSameSchemeHostPort(const SecurityOrigin*) const; - static void registerURLSchemeAsLocal(const String&); - static void removeURLSchemeRegisteredAsLocal(const String&); - static const URLSchemesMap& localURLSchemes(); - static bool shouldTreatURLAsLocal(const String&); - static bool shouldTreatURLSchemeAsLocal(const String&); - - // Secure schemes do not trigger mixed content warnings. For example, - // https and data are secure schemes because they cannot be corrupted by - // active network attackers. - static void registerURLSchemeAsSecure(const String&); - static bool shouldTreatURLSchemeAsSecure(const String&); - static bool shouldHideReferrer(const KURL&, const String& referrer); enum LocalLoadPolicy { @@ -197,9 +183,6 @@ public: static bool restrictAccessToLocal(); static bool allowSubstituteDataAccessToLocal(); - static void registerURLSchemeAsNoAccess(const String&); - static bool shouldTreatURLSchemeAsNoAccess(const String&); - static void addOriginAccessWhitelistEntry(const SecurityOrigin& sourceOrigin, const String& destinationProtocol, const String& destinationDomains, bool allowDestinationSubdomains); static void removeOriginAccessWhitelistEntry(const SecurityOrigin& sourceOrigin, const String& destinationProtocol, const String& destinationDomains, bool allowDestinationSubdomains); static void resetOriginAccessWhitelists(); diff --git a/WebCore/page/Settings.cpp b/WebCore/page/Settings.cpp index 95c4d21..88bf484 100644 --- a/WebCore/page/Settings.cpp +++ b/WebCore/page/Settings.cpp @@ -142,6 +142,7 @@ Settings::Settings(Page* page) , m_showRepaintCounter(false) , m_experimentalNotificationsEnabled(false) , m_webGLEnabled(false) + , m_acceleratedCanvas2dEnabled(false) , m_loadDeferringEnabled(true) , m_tiledBackingStoreEnabled(false) , m_html5ParserEnabled(true) @@ -149,9 +150,13 @@ Settings::Settings(Page* page) , m_paginateDuringLayoutEnabled(false) , m_dnsPrefetchingEnabled(true) , m_memoryInfoEnabled(false) +<<<<<<< HEAD #ifdef ANDROID_PLUGINS , m_pluginsOnDemand(false) #endif +======= + , m_interactiveFormValidation(false) +>>>>>>> webkit.org at r64264 { // A Frame may not have been created yet, so we initialize the AtomicString // hash before trying to use it. @@ -800,6 +805,11 @@ void Settings::setWebGLEnabled(bool enabled) m_webGLEnabled = enabled; } +void Settings::setAccelerated2dCanvasEnabled(bool enabled) +{ + m_acceleratedCanvas2dEnabled = enabled; +} + void Settings::setLoadDeferringEnabled(bool enabled) { m_loadDeferringEnabled = enabled; diff --git a/WebCore/page/Settings.h b/WebCore/page/Settings.h index 8d02d7c..bae035f 100644 --- a/WebCore/page/Settings.h +++ b/WebCore/page/Settings.h @@ -357,6 +357,9 @@ namespace WebCore { void setWebGLEnabled(bool); bool webGLEnabled() const { return m_webGLEnabled; } + void setAccelerated2dCanvasEnabled(bool); + bool accelerated2dCanvasEnabled() const { return m_acceleratedCanvas2dEnabled; } + void setLoadDeferringEnabled(bool); bool loadDeferringEnabled() const { return m_loadDeferringEnabled; } @@ -379,6 +382,13 @@ namespace WebCore { void setMemoryInfoEnabled(bool flag) { m_memoryInfoEnabled = flag; } bool memoryInfoEnabled() const { return m_memoryInfoEnabled; } + // This setting will be removed when an HTML5 compatibility issue is + // resolved and WebKit implementation of interactive validation is + // completed. See http://webkit.org/b/40520, http://webkit.org/b/40747, + // and http://webkit.org/b/40908 + void setInteractiveFormValidationEnabled(bool flag) { m_interactiveFormValidation = flag; } + bool interactiveFormValidationEnabled() const { return m_interactiveFormValidation; } + private: Page* m_page; @@ -493,6 +503,7 @@ namespace WebCore { bool m_showRepaintCounter : 1; bool m_experimentalNotificationsEnabled : 1; bool m_webGLEnabled : 1; + bool m_acceleratedCanvas2dEnabled : 1; bool m_loadDeferringEnabled : 1; bool m_tiledBackingStoreEnabled : 1; bool m_html5ParserEnabled: 1; @@ -500,9 +511,13 @@ namespace WebCore { bool m_paginateDuringLayoutEnabled : 1; bool m_dnsPrefetchingEnabled : 1; bool m_memoryInfoEnabled: 1; +<<<<<<< HEAD #ifdef ANDROID_PLUGINS bool m_pluginsOnDemand : 1; #endif +======= + bool m_interactiveFormValidation: 1; +>>>>>>> webkit.org at r64264 #if USE(SAFARI_THEME) static bool gShouldPaintNativeControls; diff --git a/WebCore/page/SpeechInput.cpp b/WebCore/page/SpeechInput.cpp index 92df70e..4f37988 100644 --- a/WebCore/page/SpeechInput.cpp +++ b/WebCore/page/SpeechInput.cpp @@ -39,27 +39,48 @@ namespace WebCore { -SpeechInput::SpeechInput(SpeechInputClient* client, SpeechInputListener* listener) +SpeechInput::SpeechInput(SpeechInputClient* client) : m_client(client) - , m_listener(listener) + , m_listener(0) { } -void SpeechInput::recordingComplete() +void SpeechInput::didCompleteRecording() { - m_listener->recordingComplete(); + ASSERT(m_listener); + m_listener->didCompleteRecording(); +} + +void SpeechInput::didCompleteRecognition() +{ + ASSERT(m_listener); + m_listener->didCompleteRecognition(); + m_listener = 0; } void SpeechInput::setRecognitionResult(const String& result) { + ASSERT(m_listener); m_listener->setRecognitionResult(result); } -bool SpeechInput::startRecognition() +bool SpeechInput::startRecognition(SpeechInputListener* listener) +{ + // Cancel any ongoing recognition first. + if (m_listener) { + m_listener->didCompleteRecognition(); + m_listener = 0; + m_client->cancelRecognition(); + } + + m_listener = listener; + return m_client->startRecognition(this); +} + +void SpeechInput::stopRecording() { - if (m_client) - return m_client->startRecognition(this); - return false; + ASSERT(m_listener); + m_client->stopRecording(); } } // namespace WebCore diff --git a/WebCore/page/SpeechInput.h b/WebCore/page/SpeechInput.h index 201be99..2ce0eea 100644 --- a/WebCore/page/SpeechInput.h +++ b/WebCore/page/SpeechInput.h @@ -33,7 +33,7 @@ #if ENABLE(INPUT_SPEECH) -#include "SpeechInputClientListener.h" +#include "SpeechInputListener.h" #include <wtf/Noncopyable.h> namespace WebCore { @@ -45,21 +45,20 @@ class String; // This class connects the input elements requiring speech input with the platform specific // speech recognition engine. It provides methods for the input elements to activate speech // recognition and methods for the speech recognition engine to return back the results. -class SpeechInput : public Noncopyable, public SpeechInputClientListener { +class SpeechInput : public Noncopyable, public SpeechInputListener { public: - SpeechInput(SpeechInputClient*, SpeechInputListener*); + SpeechInput(SpeechInputClient*); virtual ~SpeechInput() { } // Methods invoked by the input elements. - virtual bool startRecognition(); + bool startRecognition(SpeechInputListener* listener); + void stopRecording(); - // SpeechInputClient::Listener methods. - virtual void recordingComplete(); + // SpeechInputListener methods. + virtual void didCompleteRecording(); + virtual void didCompleteRecognition(); virtual void setRecognitionResult(const String&); -protected: - SpeechInputClient* client() const { return m_client; } - private: SpeechInputClient* m_client; SpeechInputListener* m_listener; diff --git a/WebCore/page/SpeechInputClient.h b/WebCore/page/SpeechInputClient.h index be68f46..f6c61cf 100644 --- a/WebCore/page/SpeechInputClient.h +++ b/WebCore/page/SpeechInputClient.h @@ -35,12 +35,20 @@ namespace WebCore { -class SpeechInputClientListener; +class SpeechInputListener; // Provides an interface for SpeechInput to call into the embedder. class SpeechInputClient { public: - virtual bool startRecognition(SpeechInputClientListener* listener) = 0; + virtual bool startRecognition(SpeechInputListener* listener) = 0; + + // Stops audio recording and performs recognition with the audio recorded until now + // (does not discard audio). + virtual void stopRecording() = 0; + + // Cancels an ongoing recognition and discards any audio recorded so far. No partial + // recognition results are returned to the listener. + virtual void cancelRecognition() = 0; protected: virtual ~SpeechInputClient() { } diff --git a/WebCore/page/SpeechInputClientListener.h b/WebCore/page/SpeechInputClientListener.h deleted file mode 100644 index a9a897e..0000000 --- a/WebCore/page/SpeechInputClientListener.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (C) 2010 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef SpeechInputClientListener_h -#define SpeechInputClientListener_h - -#if ENABLE(INPUT_SPEECH) - -namespace WebCore { - -class String; - -// Provides an interface for the embedder to call into WebCore. -class SpeechInputClientListener { -public: - virtual void recordingComplete() = 0; - virtual void setRecognitionResult(const String& result) = 0; - -protected: - virtual ~SpeechInputClientListener() { } -}; - -} // namespace WebCore - -#endif // ENABLE(INPUT_SPEECH) - -#endif // SpeechInputClientListener_h diff --git a/WebCore/page/SpeechInputListener.h b/WebCore/page/SpeechInputListener.h index d087d36..1b21a11 100644 --- a/WebCore/page/SpeechInputListener.h +++ b/WebCore/page/SpeechInputListener.h @@ -40,7 +40,19 @@ class String; // Interface to be implemented by the element which invokes SpeechInput. class SpeechInputListener { public: - virtual void recordingComplete() = 0; + // Informs that audio recording has completed and recognition is underway. + virtual void didCompleteRecording() = 0; + + // Informs that speech recognition has completed. This gets invoked irrespective of whether + // recognition was succesful or not, whether setRecognitionResult() was invoked or not. The + // handler typically frees up any temporary resources allocated and waits for the next speech + // recognition request. + virtual void didCompleteRecognition() = 0; + + // Gives results from speech recognition, either partial or the final results. + // This method can potentially get called multiple times if there are partial results + // available as the user keeps speaking. If the speech could not be recognized properly + // or if there was any other errors in the process, this method may never be called. virtual void setRecognitionResult(const String& result) = 0; protected: diff --git a/WebCore/page/Timing.cpp b/WebCore/page/Timing.cpp index 527390a..f65322b 100644 --- a/WebCore/page/Timing.cpp +++ b/WebCore/page/Timing.cpp @@ -33,6 +33,7 @@ #if ENABLE(WEB_TIMING) +#include "DocumentLoadTiming.h" #include "DocumentLoader.h" #include "Frame.h" #include "ResourceLoadTiming.h" @@ -159,31 +160,49 @@ unsigned long long Timing::domainLookupEnd() const unsigned long long Timing::connectStart() const { - ResourceLoadTiming* timing = resourceLoadTiming(); + DocumentLoader* loader = documentLoader(); + if (!loader) + return 0; + + ResourceLoadTiming* timing = loader->response().resourceLoadTiming(); if (!timing) return 0; - // This will be -1 when a new connection is not established. + // connectStart will be -1 when a network request is not made. // Rather than exposing a special value that indicates no new connection, we "backfill" with domainLookupEnd. int connectStart = timing->connectStart; - if (connectStart < 0) + if (connectStart < 0 || loader->response().connectionReused()) return domainLookupEnd(); + // ResourceLoadTiming's connect phase includes DNS and SSL, however Web Timing's + // connect phase should not. So if there is DNS time, trim it from the start. + if (timing->dnsEnd >= 0 && timing->dnsEnd > connectStart) + connectStart = timing->dnsEnd; + return resourceLoadTimeRelativeToAbsolute(connectStart); } unsigned long long Timing::connectEnd() const { - ResourceLoadTiming* timing = resourceLoadTiming(); + DocumentLoader* loader = documentLoader(); + if (!loader) + return 0; + + ResourceLoadTiming* timing = loader->response().resourceLoadTiming(); if (!timing) return 0; - // This will be -1 when a new connection is not established. + // connectEnd will be -1 when a network request is not made. // Rather than exposing a special value that indicates no new connection, we "backfill" with connectStart. int connectEnd = timing->connectEnd; - if (connectEnd < 0) + if (connectEnd < 0 || loader->response().connectionReused()) return connectStart(); + // ResourceLoadTiming's connect phase includes DNS and SSL, however Web Timing's + // connect phase should not. So if there is SSL time, trim it from the end. + if (timing->sslStart >= 0 && timing->sslStart < connectEnd) + connectEnd = timing->sslStart; + return resourceLoadTimeRelativeToAbsolute(connectEnd); } @@ -290,7 +309,7 @@ unsigned long long Timing::resourceLoadTimeRelativeToAbsolute(int relativeSecond // // Since ResourceLoadTimings came from the network platform layer, we must // check them for skew because they may be from another thread/process. - double baseTime = getPossiblySkewedTimeInKnownRange(resourceTiming->requestTime, documentTiming->fetchStart, documentTiming->responseEnd); + double baseTime = getPossiblySkewedTimeInKnownRange(resourceTiming->requestTime, documentTiming->fetchStart, documentTiming->responseEnd - (resourceTiming->receiveHeadersEnd / 1000.0)); return toIntegerMilliseconds(baseTime) + relativeSeconds; } diff --git a/WebCore/page/animation/AnimationBase.cpp b/WebCore/page/animation/AnimationBase.cpp index 83fd039..4f304e2 100644 --- a/WebCore/page/animation/AnimationBase.cpp +++ b/WebCore/page/animation/AnimationBase.cpp @@ -964,28 +964,33 @@ void AnimationBase::updateStateMachine(AnimStateInput input, double param) case AnimationStateStartWaitStyleAvailable: ASSERT(input == AnimationStateInputStyleAvailable || input == AnimationStateInputPlayStatePaused); - // Start timer has fired, tell the animation to start and wait for it to respond with start time - m_animState = AnimationStateStartWaitResponse; + if (input == AnimationStateInputStyleAvailable) { + // Start timer has fired, tell the animation to start and wait for it to respond with start time + m_animState = AnimationStateStartWaitResponse; - overrideAnimations(); + overrideAnimations(); + + // Start the animation + if (overridden()) { + // We won't try to start accelerated animations if we are overridden and + // just move on to the next state. + m_animState = AnimationStateStartWaitResponse; + m_isAccelerated = false; + updateStateMachine(AnimationStateInputStartTimeSet, beginAnimationUpdateTime()); + } else { + double timeOffset = 0; + // If the value for 'animation-delay' is negative then the animation appears to have started in the past. + if (m_animation->delay() < 0) + timeOffset = -m_animation->delay(); + bool started = startAnimation(timeOffset); - // Start the animation - if (overridden()) { - // We won't try to start accelerated animations if we are overridden and - // just move on to the next state. - m_animState = AnimationStateStartWaitResponse; - m_isAccelerated = false; - updateStateMachine(AnimationStateInputStartTimeSet, beginAnimationUpdateTime()); - } - else { - double timeOffset = 0; - // If the value for 'animation-delay' is negative then the animation appears to have started in the past. - if (m_animation->delay() < 0) - timeOffset = -m_animation->delay(); - bool started = startAnimation(timeOffset); - - m_compAnim->animationController()->addToStartTimeResponseWaitList(this, started); - m_isAccelerated = started; + m_compAnim->animationController()->addToStartTimeResponseWaitList(this, started); + m_isAccelerated = started; + } + } else { + // We're waiting for the style to be available and we got a pause. Pause and wait + m_pauseTime = beginAnimationUpdateTime(); + m_animState = AnimationStatePausedWaitStyleAvailable; } break; case AnimationStateStartWaitResponse: @@ -1075,17 +1080,51 @@ void AnimationBase::updateStateMachine(AnimStateInput input, double param) updateStateMachine(AnimationStateInputStartAnimation, 0); break; case AnimationStatePausedWaitResponse: + case AnimationStatePausedWaitStyleAvailable: case AnimationStatePausedRun: // We treat these two cases the same. The only difference is that, when we are in // AnimationStatePausedWaitResponse, we don't yet have a valid startTime, so we send 0 to startAnimation. // When the AnimationStateInputStartTimeSet comes in and we were in AnimationStatePausedRun, we will notice // that we have already set the startTime and will ignore it. - ASSERT(input == AnimationStateInputPlayStateRunning || input == AnimationStateInputStartTimeSet); + ASSERT(input == AnimationStateInputPlayStateRunning || input == AnimationStateInputStartTimeSet || input == AnimationStateInputStyleAvailable); ASSERT(paused()); - // If we are paused, but we get the callback that notifies us that an accelerated animation started, - // then we ignore the start time and just move into the paused-run state. - if (m_animState == AnimationStatePausedWaitResponse && input == AnimationStateInputStartTimeSet) { + if (input == AnimationStateInputPlayStateRunning) { + // Update the times + if (m_animState == AnimationStatePausedRun) + m_startTime += beginAnimationUpdateTime() - m_pauseTime; + else + m_startTime = 0; + m_pauseTime = -1; + + if (m_animState == AnimationStatePausedWaitStyleAvailable) + m_animState = AnimationStateStartWaitStyleAvailable; + else { + // We were either running or waiting for a begin time response from the animation. + // Either way we need to restart the animation (possibly with an offset if we + // had already been running) and wait for it to start. + m_animState = AnimationStateStartWaitResponse; + + // Start the animation + if (overridden()) { + // We won't try to start accelerated animations if we are overridden and + // just move on to the next state. + updateStateMachine(AnimationStateInputStartTimeSet, beginAnimationUpdateTime()); + m_isAccelerated = true; + } else { + bool started = startAnimation(beginAnimationUpdateTime() - m_startTime); + m_compAnim->animationController()->addToStartTimeResponseWaitList(this, started); + m_isAccelerated = !started; + } + } + break; + } + + if (input == AnimationStateInputStartTimeSet) { + ASSERT(m_animState == AnimationStatePausedWaitResponse); + + // We are paused but we got the callback that notifies us that an accelerated animation started. + // We ignore the start time and just move into the paused-run state. m_animState = AnimationStatePausedRun; ASSERT(m_startTime == 0); m_startTime = param; @@ -1093,27 +1132,11 @@ void AnimationBase::updateStateMachine(AnimStateInput input, double param) break; } - // Update the times - if (m_animState == AnimationStatePausedRun) - m_startTime += beginAnimationUpdateTime() - m_pauseTime; - else - m_startTime = 0; - m_pauseTime = -1; - - // We were waiting for a begin time response from the animation, go back and wait again - m_animState = AnimationStateStartWaitResponse; - - // Start the animation - if (overridden()) { - // We won't try to start accelerated animations if we are overridden and - // just move on to the next state. - updateStateMachine(AnimationStateInputStartTimeSet, beginAnimationUpdateTime()); - m_isAccelerated = false; - } else { - bool started = startAnimation(beginAnimationUpdateTime() - m_startTime); - m_compAnim->animationController()->addToStartTimeResponseWaitList(this, started); - m_isAccelerated = started; - } + ASSERT(m_animState == AnimationStatePausedWaitStyleAvailable); + // We are paused but we got the callback that notifies us that style has been updated. + // We move to the AnimationStatePausedWaitResponse state + m_animState = AnimationStatePausedWaitResponse; + overrideAnimations(); break; case AnimationStateFillingForwards: case AnimationStateDone: diff --git a/WebCore/page/animation/AnimationBase.h b/WebCore/page/animation/AnimationBase.h index 9bdca3a..33a0b1d 100644 --- a/WebCore/page/animation/AnimationBase.h +++ b/WebCore/page/animation/AnimationBase.h @@ -69,6 +69,7 @@ public: AnimationStateLooping, // response received, animation running, loop timer running, waiting for fire AnimationStateEnding, // received, animation running, end timer running, waiting for fire AnimationStatePausedWaitTimer, // in pause mode when animation started + AnimationStatePausedWaitStyleAvailable, // in pause mode when waiting for style setup AnimationStatePausedWaitResponse, // animation paused when in STARTING state AnimationStatePausedRun, // animation paused when in LOOPING or ENDING state AnimationStateDone, // end timer fired, animation finished and removed diff --git a/WebCore/page/chromium/EventHandlerChromium.cpp b/WebCore/page/chromium/EventHandlerChromium.cpp index ff161af..719163f 100644 --- a/WebCore/page/chromium/EventHandlerChromium.cpp +++ b/WebCore/page/chromium/EventHandlerChromium.cpp @@ -129,7 +129,7 @@ bool EventHandler::eventActivatedView(const PlatformMouseEvent& event) const PassRefPtr<Clipboard> EventHandler::createDraggingClipboard() const { RefPtr<ChromiumDataObject> dataObject = ChromiumDataObject::create(); - return ClipboardChromium::create(true, dataObject.get(), ClipboardWritable); + return ClipboardChromium::create(true, dataObject.get(), ClipboardWritable, m_frame); } void EventHandler::focusDocumentView() diff --git a/WebCore/page/gtk/EventHandlerGtk.cpp b/WebCore/page/gtk/EventHandlerGtk.cpp index 0ff67d2..429aea6 100644 --- a/WebCore/page/gtk/EventHandlerGtk.cpp +++ b/WebCore/page/gtk/EventHandlerGtk.cpp @@ -96,7 +96,7 @@ bool EventHandler::passWheelEventToWidget(PlatformWheelEvent& event, Widget* wid PassRefPtr<Clipboard> EventHandler::createDraggingClipboard() const { - return ClipboardGtk::create(ClipboardWritable, DataObjectGtk::create(), true); + return ClipboardGtk::create(ClipboardWritable, DataObjectGtk::create(), true, m_frame); } bool EventHandler::passMousePressEventToSubframe(MouseEventWithHitTestResults& mev, Frame* subframe) diff --git a/WebCore/page/mac/WebCoreViewFactory.h b/WebCore/page/mac/WebCoreViewFactory.h index 2ca0d17..9191abe 100644 --- a/WebCore/page/mac/WebCoreViewFactory.h +++ b/WebCore/page/mac/WebCoreViewFactory.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003, 2005, 2009 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2003, 2005, 2009, 2010 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -28,83 +28,8 @@ @protocol WebCoreViewFactory -- (NSString *)inputElementAltText; -- (NSString *)resetButtonDefaultLabel; -- (NSString *)searchableIndexIntroduction; -- (NSString *)submitButtonDefaultLabel; -- (NSString *)fileButtonChooseFileLabel; -- (NSString *)fileButtonNoFileSelectedLabel; -- (NSString *)copyImageUnknownFileLabel; - -#if ENABLE(CONTEXT_MENUS) -// Context menu item titles -- (NSString *)contextMenuItemTagOpenLinkInNewWindow; -- (NSString *)contextMenuItemTagDownloadLinkToDisk; -- (NSString *)contextMenuItemTagCopyLinkToClipboard; -- (NSString *)contextMenuItemTagOpenImageInNewWindow; -- (NSString *)contextMenuItemTagDownloadImageToDisk; -- (NSString *)contextMenuItemTagCopyImageToClipboard; -- (NSString *)contextMenuItemTagOpenFrameInNewWindow; -- (NSString *)contextMenuItemTagCopy; -- (NSString *)contextMenuItemTagGoBack; -- (NSString *)contextMenuItemTagGoForward; -- (NSString *)contextMenuItemTagStop; -- (NSString *)contextMenuItemTagReload; -- (NSString *)contextMenuItemTagCut; -- (NSString *)contextMenuItemTagPaste; -- (NSString *)contextMenuItemTagNoGuessesFound; -- (NSString *)contextMenuItemTagIgnoreSpelling; -- (NSString *)contextMenuItemTagLearnSpelling; -- (NSString *)contextMenuItemTagSearchInSpotlight; -- (NSString *)contextMenuItemTagSearchWeb; -- (NSString *)contextMenuItemTagLookUpInDictionary; -- (NSString *)contextMenuItemTagOpenLink; -- (NSString *)contextMenuItemTagIgnoreGrammar; -- (NSString *)contextMenuItemTagSpellingMenu; -- (NSString *)contextMenuItemTagShowSpellingPanel:(bool)show; -- (NSString *)contextMenuItemTagCheckSpelling; -- (NSString *)contextMenuItemTagCheckSpellingWhileTyping; -- (NSString *)contextMenuItemTagCheckGrammarWithSpelling; -- (NSString *)contextMenuItemTagFontMenu; -- (NSString *)contextMenuItemTagShowFonts; -- (NSString *)contextMenuItemTagBold; -- (NSString *)contextMenuItemTagItalic; -- (NSString *)contextMenuItemTagUnderline; -- (NSString *)contextMenuItemTagOutline; -- (NSString *)contextMenuItemTagStyles; -- (NSString *)contextMenuItemTagShowColors; -- (NSString *)contextMenuItemTagSpeechMenu; -- (NSString *)contextMenuItemTagStartSpeaking; -- (NSString *)contextMenuItemTagStopSpeaking; -- (NSString *)contextMenuItemTagWritingDirectionMenu; -- (NSString *)contextMenuItemTagTextDirectionMenu; -- (NSString *)contextMenuItemTagDefaultDirection; -- (NSString *)contextMenuItemTagLeftToRight; -- (NSString *)contextMenuItemTagRightToLeft; -- (NSString *)contextMenuItemTagCorrectSpellingAutomatically; -- (NSString *)contextMenuItemTagSubstitutionsMenu; -- (NSString *)contextMenuItemTagShowSubstitutions:(bool)show; -- (NSString *)contextMenuItemTagSmartCopyPaste; -- (NSString *)contextMenuItemTagSmartQuotes; -- (NSString *)contextMenuItemTagSmartDashes; -- (NSString *)contextMenuItemTagSmartLinks; -- (NSString *)contextMenuItemTagTextReplacement; -- (NSString *)contextMenuItemTagTransformationsMenu; -- (NSString *)contextMenuItemTagMakeUpperCase; -- (NSString *)contextMenuItemTagMakeLowerCase; -- (NSString *)contextMenuItemTagCapitalize; -- (NSString *)contextMenuItemTagChangeBack:(NSString *)replacedString; -- (NSString *)contextMenuItemTagInspectElement; -#endif // ENABLE(CONTEXT_MENUS) - -- (NSString *)searchMenuNoRecentSearchesText; -- (NSString *)searchMenuRecentSearchesText; -- (NSString *)searchMenuClearRecentSearchesText; - - (NSString *)defaultLanguageCode; -- (NSString *)imageTitleForFilename:(NSString *)filename width:(int)width height:(int)height; - - (BOOL)objectIsTextMarker:(id)object; - (BOOL)objectIsTextMarkerRange:(id)object; @@ -121,45 +46,6 @@ - (AXUIElementRef)AXUIElementForElement:(id)element; - (void)unregisterUniqueIdForUIElement:(id)element; -- (NSString *)AXWebAreaText; -- (NSString *)AXLinkText; -- (NSString *)AXListMarkerText; -- (NSString *)AXImageMapText; -- (NSString *)AXHeadingText; -- (NSString *)AXDefinitionListTermText; -- (NSString *)AXDefinitionListDefinitionText; -- (NSString *)AXARIAContentGroupText:(NSString *)ariaType; - -- (NSString *)AXButtonActionVerb; -- (NSString *)AXRadioButtonActionVerb; -- (NSString *)AXTextFieldActionVerb; -- (NSString *)AXCheckedCheckBoxActionVerb; -- (NSString *)AXUncheckedCheckBoxActionVerb; -- (NSString *)AXLinkActionVerb; -- (NSString *)AXMenuListPopupActionVerb; -- (NSString *)AXMenuListActionVerb; - -- (NSString *)missingPluginText; -- (NSString *)crashedPluginText; - -- (NSString *)multipleFileUploadTextForNumberOfFiles:(unsigned)numberOfFiles; -// FTP Directory Related -- (NSString *)unknownFileSizeText; - -- (NSString *)mediaElementLoadingStateText; -- (NSString *)mediaElementLiveBroadcastStateText; -- (NSString*)localizedMediaControlElementString:(NSString*)name; -- (NSString*)localizedMediaControlElementHelpText:(NSString*)name; -- (NSString*)localizedMediaTimeDescription:(float)time; - -- (NSString *)validationMessageValueMissingText; -- (NSString *)validationMessageTypeMismatchText; -- (NSString *)validationMessagePatternMismatchText; -- (NSString *)validationMessageTooLongText; -- (NSString *)validationMessageRangeUnderflowText; -- (NSString *)validationMessageRangeOverflowText; -- (NSString *)validationMessageStepMismatchText; - @end @interface WebCoreViewFactory : NSObject diff --git a/WebCore/page/win/EventHandlerWin.cpp b/WebCore/page/win/EventHandlerWin.cpp index e1d5be9..ee4b360 100644 --- a/WebCore/page/win/EventHandlerWin.cpp +++ b/WebCore/page/win/EventHandlerWin.cpp @@ -98,7 +98,7 @@ PassRefPtr<Clipboard> EventHandler::createDraggingClipboard() const #else COMPtr<WCDataObject> dataObject; WCDataObject::createInstance(&dataObject); - return ClipboardWin::create(true, dataObject.get(), ClipboardWritable); + return ClipboardWin::create(true, dataObject.get(), ClipboardWritable, m_frame); #endif } |