diff options
Diffstat (limited to 'WebCore/page')
26 files changed, 379 insertions, 239 deletions
diff --git a/WebCore/page/ChromeClient.h b/WebCore/page/ChromeClient.h index eb2372d..224c8dc 100644 --- a/WebCore/page/ChromeClient.h +++ b/WebCore/page/ChromeClient.h @@ -68,10 +68,6 @@ namespace WebCore { class GraphicsLayer; #endif -#if USE(GLES2_RENDERING) - class GLES2Context; -#endif - #if ENABLE(NOTIFICATIONS) class NotificationPresenter; #endif @@ -234,16 +230,16 @@ namespace WebCore { virtual bool allowsAcceleratedCompositing() const { return true; } #endif -#if USE(GLES2_RENDERING) - // Request a GL ES 2 context to use for compositing this page's content. - virtual PassOwnPtr<GLES2Context> getOnscreenGLES2Context() = 0; - virtual PassOwnPtr<GLES2Context> getOffscreenGLES2Context() = 0; -#endif - virtual bool supportsFullscreenForNode(const Node*) { return false; } virtual void enterFullscreenForNode(Node*) { } virtual void exitFullscreenForNode(Node*) { } +#if ENABLE(FULLSCREEN_API) + virtual bool supportsFullScreenForElement(const Element*) { return false; } + virtual void enterFullScreenForElement(Element*) { } + virtual void exitFullScreenForElement(Element*) { } +#endif + #if ENABLE(TILED_BACKING_STORE) virtual IntRect visibleRectForTiledBackingStore() const { return IntRect(); } #endif diff --git a/WebCore/page/DOMSelection.cpp b/WebCore/page/DOMSelection.cpp index 106dd13..6c25103 100644 --- a/WebCore/page/DOMSelection.cpp +++ b/WebCore/page/DOMSelection.cpp @@ -214,21 +214,33 @@ void DOMSelection::collapse(Node* node, int offset, ExceptionCode& ec) m_frame->selection()->moveTo(VisiblePosition(node, offset, DOWNSTREAM)); } -void DOMSelection::collapseToEnd() +void DOMSelection::collapseToEnd(ExceptionCode& ec) { if (!m_frame) return; const VisibleSelection& selection = m_frame->selection()->selection(); + + if (selection.isNone()) { + ec = INVALID_STATE_ERR; + return; + } + m_frame->selection()->moveTo(VisiblePosition(selection.end(), DOWNSTREAM)); } -void DOMSelection::collapseToStart() +void DOMSelection::collapseToStart(ExceptionCode& ec) { if (!m_frame) return; const VisibleSelection& selection = m_frame->selection()->selection(); + + if (selection.isNone()) { + ec = INVALID_STATE_ERR; + return; + } + m_frame->selection()->moveTo(VisiblePosition(selection.start(), DOWNSTREAM)); } diff --git a/WebCore/page/DOMSelection.h b/WebCore/page/DOMSelection.h index b0421c7..b5fd197 100644 --- a/WebCore/page/DOMSelection.h +++ b/WebCore/page/DOMSelection.h @@ -74,8 +74,8 @@ namespace WebCore { bool isCollapsed() const; int rangeCount() const; void collapse(Node*, int offset, ExceptionCode&); - void collapseToEnd(); - void collapseToStart(); + void collapseToEnd(ExceptionCode&); + void collapseToStart(ExceptionCode&); void extend(Node*, int offset, ExceptionCode&); PassRefPtr<Range> getRangeAt(int, ExceptionCode&); void removeAllRanges(); diff --git a/WebCore/page/DOMSelection.idl b/WebCore/page/DOMSelection.idl index 4d0c942..ee82823 100644 --- a/WebCore/page/DOMSelection.idl +++ b/WebCore/page/DOMSelection.idl @@ -42,8 +42,10 @@ module window { void collapse(in Node node, in long index) raises(DOMException); - void collapseToEnd(); - void collapseToStart(); + void collapseToEnd() + raises(DOMException); + void collapseToStart() + raises(DOMException); void deleteFromDocument(); boolean containsNode(in Node node, in boolean allowPartial); diff --git a/WebCore/page/DOMWindow.cpp b/WebCore/page/DOMWindow.cpp index 86708de..a3d8090 100644 --- a/WebCore/page/DOMWindow.cpp +++ b/WebCore/page/DOMWindow.cpp @@ -63,6 +63,7 @@ #include "IDBKeyRange.h" #include "InspectorController.h" #include "InspectorTimelineAgent.h" +#include "KURL.h" #include "Location.h" #include "StyleMedia.h" #include "MessageEvent.h" @@ -87,6 +88,15 @@ #include <wtf/MathExtras.h> #include <wtf/text/CString.h> +#if ENABLE(FILE_SYSTEM) +#include "AsyncFileSystem.h" +#include "DOMFileSystem.h" +#include "ErrorCallback.h" +#include "FileError.h" +#include "FileSystemCallback.h" +#include "LocalFileSystem.h" +#endif + using std::min; using std::max; @@ -379,7 +389,8 @@ bool DOMWindow::canShowModalDialogNow(const Frame* frame) } DOMWindow::DOMWindow(Frame* frame) - : m_frame(frame) + : m_printDeferred(false), + m_frame(frame) { } @@ -719,6 +730,35 @@ IDBKeyRange* DOMWindow::iDBKeyRange() const } #endif +#if ENABLE(FILE_SYSTEM) +void DOMWindow::requestFileSystem(int type, long long size, PassRefPtr<FileSystemCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback) +{ + Document* document = this->document(); + if (!document) + return; + + if (!m_localFileSystem) { + // FIXME: See if access is allowed. + + Page* page = document->page(); + if (!page) { + DOMFileSystem::scheduleCallback(document, errorCallback, FileError::create(INVALID_STATE_ERR)); + return; + } + + // FIXME: Get the quota settings as well. + String path = page->settings()->fileSystemRootPath(); + m_localFileSystem = LocalFileSystem::create(path); + } + + m_localFileSystem->requestFileSystem(document, static_cast<AsyncFileSystem::Type>(type), size, successCallback, errorCallback); +} + +COMPILE_ASSERT(int(DOMWindow::TEMPORARY) == int(AsyncFileSystem::Temporary), enum_mismatch); +COMPILE_ASSERT(int(DOMWindow::PERSISTENT) == int(AsyncFileSystem::Persistent), enum_mismatch); + +#endif + void DOMWindow::postMessage(PassRefPtr<SerializedScriptValue> message, MessagePort* port, const String& targetOrigin, DOMWindow* source, ExceptionCode& ec) { MessagePortArray ports; @@ -861,6 +901,11 @@ void DOMWindow::print() if (!page) return; + if (m_frame->loader()->isLoading()) { + m_printDeferred = true; + return; + } + m_printDeferred = false; page->chrome()->print(m_frame); } @@ -1581,4 +1626,16 @@ EventTargetData* DOMWindow::ensureEventTargetData() return &m_eventTargetData; } +#if ENABLE(BLOB) +String DOMWindow::createBlobURL(Blob* blob) +{ + return scriptExecutionContext()->createPublicBlobURL(blob).string(); +} + +void DOMWindow::revokeBlobURL(const String& blobURLString) +{ + scriptExecutionContext()->revokePublicBlobURL(KURL(ParsedURLString, blobURLString)); +} +#endif + } // namespace WebCore diff --git a/WebCore/page/DOMWindow.h b/WebCore/page/DOMWindow.h index 8d57dcc..894aa08 100644 --- a/WebCore/page/DOMWindow.h +++ b/WebCore/page/DOMWindow.h @@ -40,6 +40,7 @@ namespace WebCore { class BarInfo; class BeforeUnloadEvent; + class Blob; class CSSRuleList; class CSSStyleDeclaration; class Console; @@ -48,14 +49,17 @@ namespace WebCore { class DatabaseCallback; class Document; class Element; + class ErrorCallback; class Event; class EventListener; + class FileSystemCallback; class FloatRect; class Frame; class History; class IDBFactory; class IDBKeyRange; class InspectorTimelineAgent; + class LocalFileSystem; class Location; class StyleMedia; class Navigator; @@ -90,6 +94,7 @@ namespace WebCore { virtual DOMWindow* toDOMWindow() { return this; } virtual ScriptExecutionContext* scriptExecutionContext() const; + bool printDeferred() const { return m_printDeferred; } Frame* frame() const { return m_frame; } void disconnectFrame(); @@ -236,6 +241,15 @@ namespace WebCore { IDBKeyRange* iDBKeyRange() const; #endif +#if ENABLE(FILE_SYSTEM) + // They are placed here and in all capital letters to enforce compile-time enum checking. + enum FileSystemType { + TEMPORARY, + PERSISTENT, + }; + void requestFileSystem(int type, long long size, PassRefPtr<FileSystemCallback>, PassRefPtr<ErrorCallback>); +#endif + void postMessage(PassRefPtr<SerializedScriptValue> message, const MessagePortArray*, const String& targetOrigin, DOMWindow* source, ExceptionCode&); // FIXME: remove this when we update the ObjC bindings (bug #28774). void postMessage(PassRefPtr<SerializedScriptValue> message, MessagePort*, const String& targetOrigin, DOMWindow* source, ExceptionCode&); @@ -381,6 +395,10 @@ namespace WebCore { #if ENABLE(OFFLINE_WEB_APPLICATIONS) DOMApplicationCache* optionalApplicationCache() const { return m_applicationCache.get(); } #endif +#if ENABLE(BLOB) + String createBlobURL(Blob*); + void revokeBlobURL(const String&); +#endif using RefCounted<DOMWindow>::ref; using RefCounted<DOMWindow>::deref; @@ -397,6 +415,7 @@ namespace WebCore { RefPtr<SecurityOrigin> m_securityOrigin; KURL m_url; + bool m_printDeferred; Frame* m_frame; mutable RefPtr<Screen> m_screen; mutable RefPtr<DOMSelection> m_selection; @@ -428,6 +447,9 @@ namespace WebCore { mutable RefPtr<IDBFactory> m_idbFactory; mutable RefPtr<IDBKeyRange> m_idbKeyRange; #endif +#if ENABLE(FILE_SYSTEM) + RefPtr<LocalFileSystem> m_localFileSystem; +#endif EventTargetData m_eventTargetData; diff --git a/WebCore/page/DOMWindow.idl b/WebCore/page/DOMWindow.idl index cabe68a..35b847c 100644 --- a/WebCore/page/DOMWindow.idl +++ b/WebCore/page/DOMWindow.idl @@ -176,6 +176,11 @@ module window { readonly attribute [EnabledAtRuntime] IDBFactory indexedDB; readonly attribute [EnabledAtRuntime] IDBKeyRange IDBKeyRange; #endif +#if defined(ENABLE_FILE_SYSTEM) && ENABLE_FILE_SYSTEM + const unsigned short TEMPORARY = 0; + const unsigned short PERSISTENT = 1; + [EnabledAtRuntime] void requestFileSystem(in unsigned short type, in long long size, in [Callback, Optional] FileSystemCallback successCallback, in [Callback, Optional] ErrorCallback errorCallback); +#endif #if defined(ENABLE_ORIENTATION_EVENTS) && ENABLE_ORIENTATION_EVENTS // This is the interface orientation in degrees. Some examples are: @@ -465,9 +470,7 @@ module window { attribute [Conditional=3D_CANVAS,EnabledAtRuntime] WebGLRenderingContextConstructor WebGLRenderingContext; attribute TextMetricsConstructor TextMetrics; -#if !defined(V8_BINDING) || !V8_BINDING attribute DOMStringMapConstructor DOMStringMap; -#endif attribute [JSCCustomGetter,Conditional=3D_CANVAS,EnabledAtRuntime] ArrayBufferConstructor ArrayBuffer; // Usable with new operator attribute [JSCCustomGetter,Conditional=3D_CANVAS,EnabledAtRuntime] Int8ArrayConstructor Int8Array; // Usable with new operator @@ -744,6 +747,11 @@ module window { attribute [Conditional=BLOB] BlobBuilderConstructor BlobBuilder; +#if defined(ENABLE_BLOB) && ENABLE_BLOB + DOMString createBlobURL(in Blob blob); + void revokeBlobURL(in DOMString blobURL); +#endif + #endif // defined(LANGUAGE_JAVASCRIPT) #if defined(V8_BINDING) && V8_BINDING diff --git a/WebCore/page/EditorClient.h b/WebCore/page/EditorClient.h index 93e27ff..4a192d7 100644 --- a/WebCore/page/EditorClient.h +++ b/WebCore/page/EditorClient.h @@ -28,6 +28,7 @@ #define EditorClient_h #include "EditorInsertAction.h" +#include "FloatRect.h" #include "PlatformString.h" #include "TextAffinity.h" #include <wtf/Forward.h> @@ -51,6 +52,7 @@ namespace WebCore { class CSSStyleDeclaration; class EditCommand; +class Editor; class Element; class Frame; class HTMLElement; @@ -177,6 +179,12 @@ public: #if PLATFORM(MAC) && !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) virtual void checkTextOfParagraph(const UChar* text, int length, uint64_t checkingTypes, Vector<TextCheckingResult>& results) = 0; #endif + +#if PLATFORM(MAC) && !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) + virtual void showCorrectionPanel(const FloatRect& boundingBoxOfReplacedString, const String& replacedString, const String& replacmentString, Editor*) = 0; + virtual void dismissCorrectionPanel(bool correctionAccepted) = 0; +#endif + virtual void updateSpellingUIWithGrammarString(const String&, const GrammarDetail& detail) = 0; virtual void updateSpellingUIWithMisspelledWord(const String&) = 0; virtual void showSpellingUI(bool show) = 0; diff --git a/WebCore/page/EventHandler.cpp b/WebCore/page/EventHandler.cpp index 6263a4b..72cbe23 100644 --- a/WebCore/page/EventHandler.cpp +++ b/WebCore/page/EventHandler.cpp @@ -69,6 +69,7 @@ #include "Scrollbar.h" #include "SelectionController.h" #include "Settings.h" +#include "StyleCachedImage.h" #include "TextEvent.h" #include "TextIterator.h" #include "UserGestureIndicator.h" @@ -1083,10 +1084,13 @@ Cursor EventHandler::selectCursor(const MouseEventWithHitTestResults& event, Scr if (style && style->cursors()) { const CursorList* cursors = style->cursors(); for (unsigned i = 0; i < cursors->size(); ++i) { - const CachedImage* cimage = (*cursors)[i].image(); - IntPoint hotSpot = (*cursors)[i].hotSpot(); + const CachedImage* cimage = 0; + StyleImage* image = (*cursors)[i].image(); + if (image->isCachedImage()) + cimage = static_cast<StyleCachedImage*>(image)->cachedImage(); if (!cimage) continue; + IntPoint hotSpot = (*cursors)[i].hotSpot(); // Limit the size of cursors so that they cannot be used to cover UI elements in chrome. IntSize size = cimage->image()->size(); if (size.width() > 128 || size.height() > 128) diff --git a/WebCore/page/FocusController.cpp b/WebCore/page/FocusController.cpp index 2c2c447..a87d6a6 100644 --- a/WebCore/page/FocusController.cpp +++ b/WebCore/page/FocusController.cpp @@ -623,8 +623,11 @@ bool FocusController::setFocusedNode(Node* node, PassRefPtr<Frame> newFocusedFra // Setting the focused node can result in losing our last reft to node when JS event handlers fire. RefPtr<Node> protect = node; - if (newDocument) - newDocument->setFocusedNode(node); + if (newDocument) { + bool successfullyFocused = newDocument->setFocusedNode(node); + if (!successfullyFocused) + return false; + } if (newDocument->focusedNode() == node) m_page->editorClient()->setInputMethodState(node->shouldUseInputMethod()); @@ -641,7 +644,7 @@ void FocusController::setActive(bool active) if (FrameView* view = m_page->mainFrame()->view()) { if (!view->platformWidget()) { - view->layoutIfNeededRecursive(); + view->updateLayoutAndStyleIfNeededRecursive(); view->updateControlTints(); } } diff --git a/WebCore/page/Frame.cpp b/WebCore/page/Frame.cpp index c23368a..09cb8c3 100644 --- a/WebCore/page/Frame.cpp +++ b/WebCore/page/Frame.cpp @@ -150,7 +150,6 @@ inline Frame::Frame(Page* page, HTMLFrameOwnerElement* ownerElement, FrameLoader #endif , m_highlightTextMatches(false) , m_inViewSourceMode(false) - , m_needsReapplyStyles(false) , m_isDisconnected(false) , m_excludeFromTextSearch(false) { @@ -627,47 +626,13 @@ void Frame::setPrinting(bool printing, const FloatSize& pageSize, float maximumS m_doc->setPrinting(printing); view()->adjustMediaTypeForPrinting(printing); - m_doc->updateStyleSelector(); + m_doc->styleSelectorChanged(RecalcStyleImmediately); view()->forceLayoutForPagination(pageSize, maximumShrinkRatio, shouldAdjustViewSize); for (Frame* child = tree()->firstChild(); child; child = child->tree()->nextSibling()) child->setPrinting(printing, pageSize, maximumShrinkRatio, shouldAdjustViewSize); } -void Frame::setNeedsReapplyStyles() -{ - // When the frame is not showing web content, it doesn't make sense to apply styles. - // If we tried, we'd end up doing things with the document, but the document, if one - // exists, is not currently shown and should be in the page cache. - if (!m_loader.client()->hasHTMLView()) - return; - - if (m_needsReapplyStyles) - return; - - m_needsReapplyStyles = true; - - // FrameView's "layout" timer includes reapplyStyles, so despite its - // name, it's what we want to call here. - if (view()) - view()->scheduleRelayout(); -} - -void Frame::reapplyStyles() -{ - m_needsReapplyStyles = false; - - // FIXME: This call doesn't really make sense in a function called reapplyStyles. - // We should probably eventually move it into its own function. - m_doc->docLoader()->setAutoLoadImages(m_page && m_page->settings()->loadsImagesAutomatically()); - - // FIXME: It's not entirely clear why the following is needed. - // The document automatically does this as required when you set the style sheet. - // But we had problems when this code was removed. Details are in - // <http://bugs.webkit.org/show_bug.cgi?id=8079>. - m_doc->updateStyleSelector(); -} - void Frame::injectUserScripts(UserScriptInjectionTime injectionTime) { if (!m_page) @@ -774,24 +739,6 @@ void Frame::computeAndSetTypingStyle(CSSStyleDeclaration *style, EditAction edit m_typingStyle = mutableStyle.release(); } -String Frame::selectionStartStylePropertyValue(int stylePropertyID) const -{ - Node *nodeToRemove; - RefPtr<CSSStyleDeclaration> selectionStyle = selectionComputedStyle(nodeToRemove); - if (!selectionStyle) - return String(); - - String value = selectionStyle->getPropertyValue(stylePropertyID); - - if (nodeToRemove) { - ExceptionCode ec = 0; - nodeToRemove->remove(ec); - ASSERT(!ec); - } - - return value; -} - PassRefPtr<CSSComputedStyleDeclaration> Frame::selectionComputedStyle(Node*& nodeToRemove) const { nodeToRemove = 0; @@ -1262,7 +1209,7 @@ bool Frame::findString(const String& target, bool forward, bool caseFlag, bool w return true; } -unsigned Frame::markAllMatchesForText(const String& target, bool caseFlag, unsigned limit) +unsigned Frame::countMatchesForText(const String& target, bool caseFlag, unsigned limit, bool markMatches) { if (target.isEmpty()) return 0; @@ -1285,7 +1232,8 @@ unsigned Frame::markAllMatchesForText(const String& target, bool caseFlag, unsig // Only treat the result as a match if it is visible if (editor()->insideVisibleArea(resultRange.get())) { ++matchCount; - document()->markers()->addMarker(resultRange.get(), DocumentMarker::TextMatch); + if (markMatches) + document()->markers()->addMarker(resultRange.get(), DocumentMarker::TextMatch); } // Stop looking if we hit the specified limit. A limit of 0 means no limit. @@ -1303,16 +1251,16 @@ unsigned Frame::markAllMatchesForText(const String& target, bool caseFlag, unsig searchRange->setEnd(shadowTreeRoot, shadowTreeRoot->childNodeCount(), exception); } while (true); - // Do a "fake" paint in order to execute the code that computes the rendered rect for - // each text match. - Document* doc = document(); - if (m_view && contentRenderer()) { - doc->updateLayout(); // Ensure layout is up to date. - IntRect visibleRect = m_view->visibleContentRect(); - if (!visibleRect.isEmpty()) { - GraphicsContext context((PlatformGraphicsContext*)0); - context.setPaintingDisabled(true); - m_view->paintContents(&context, visibleRect); + if (markMatches) { + // Do a "fake" paint in order to execute the code that computes the rendered rect for each text match. + if (m_view && contentRenderer()) { + document()->updateLayout(); // Ensure layout is up to date. + IntRect visibleRect = m_view->visibleContentRect(); + if (!visibleRect.isEmpty()) { + GraphicsContext context((PlatformGraphicsContext*)0); + context.setPaintingDisabled(true); + m_view->paintContents(&context, visibleRect); + } } } @@ -1470,8 +1418,10 @@ void Frame::respondToChangedSelection(const VisibleSelection& oldSelection, bool // This only erases markers that are in the first unit (word or sentence) of the selection. // Perhaps peculiar, but it matches AppKit. - if (RefPtr<Range> wordRange = newAdjacentWords.toNormalizedRange()) + if (RefPtr<Range> wordRange = newAdjacentWords.toNormalizedRange()) { document()->markers()->removeMarkers(wordRange.get(), DocumentMarker::Spelling); + document()->markers()->removeMarkers(wordRange.get(), DocumentMarker::Replacement); + } if (RefPtr<Range> sentenceRange = newSelectedSentence.toNormalizedRange()) document()->markers()->removeMarkers(sentenceRange.get(), DocumentMarker::Grammar); } @@ -1572,7 +1522,7 @@ void Frame::tiledBackingStorePaintBegin() { if (!m_view) return; - m_view->layoutIfNeededRecursive(); + m_view->updateLayoutAndStyleIfNeededRecursive(); m_view->flushDeferredRepaints(); } diff --git a/WebCore/page/Frame.h b/WebCore/page/Frame.h index 36803f8..eb3cdba 100644 --- a/WebCore/page/Frame.h +++ b/WebCore/page/Frame.h @@ -164,10 +164,6 @@ namespace WebCore { void clearTimers(); static void clearTimers(FrameView*, Document*); - void setNeedsReapplyStyles(); - bool needsReapplyStyles() const; - void reapplyStyles(); - String documentTypeString() const; // This method -- and the corresponding list of former DOM windows -- @@ -197,7 +193,6 @@ namespace WebCore { void setMark(const VisibleSelection&); void computeAndSetTypingStyle(CSSStyleDeclaration* , EditAction = EditActionUnspecified); - String selectionStartStylePropertyValue(int stylePropertyID) const; void applyEditingStyleToBodyElement() const; void applyEditingStyleToElement(Element*) const; @@ -208,7 +203,7 @@ namespace WebCore { RenderStyle* styleForSelectionStart(Node*& nodeToRemove) const; - unsigned markAllMatchesForText(const String&, bool caseFlag, unsigned limit); + unsigned countMatchesForText(const String&, bool caseFlag, unsigned limit, bool markMatches); bool markedTextMatchesAreHighlighted() const; void setMarkedTextMatchesAreHighlighted(bool flag); @@ -329,7 +324,6 @@ namespace WebCore { bool m_highlightTextMatches; bool m_inViewSourceMode; - bool m_needsReapplyStyles; bool m_isDisconnected; bool m_excludeFromTextSearch; @@ -398,11 +392,6 @@ namespace WebCore { m_mark = s; } - inline bool Frame::needsReapplyStyles() const - { - return m_needsReapplyStyles; - } - inline CSSMutableStyleDeclaration* Frame::typingStyle() const { return m_typingStyle.get(); diff --git a/WebCore/page/FrameView.cpp b/WebCore/page/FrameView.cpp index f8a9418..ac9341f 100644 --- a/WebCore/page/FrameView.cpp +++ b/WebCore/page/FrameView.cpp @@ -137,6 +137,8 @@ FrameView::FrameView(Frame* frame) , m_fixedObjectCount(0) , m_layoutTimer(this, &FrameView::layoutTimerFired) , m_layoutRoot(0) + , m_hasPendingPostLayoutTasks(false) + , m_inSynchronousPostLayout(false) , m_postLayoutTasksTimer(this, &FrameView::postLayoutTimerFired) , m_isTransparent(false) , m_baseBackgroundColor(Color::white) @@ -173,7 +175,7 @@ PassRefPtr<FrameView> FrameView::create(Frame* frame, const IntSize& initialSize FrameView::~FrameView() { - if (m_postLayoutTasksTimer.isActive()) { + if (m_hasPendingPostLayoutTasks) { m_postLayoutTasksTimer.stop(); m_scheduledEvents.clear(); m_enqueueEvents = 0; @@ -213,6 +215,8 @@ void FrameView::reset() m_doFullRepaint = true; m_layoutSchedulingEnabled = true; m_inLayout = false; + m_inSynchronousPostLayout = false; + m_hasPendingPostLayoutTasks = false; m_layoutCount = 0; m_nestedLayoutCount = 0; m_postLayoutTasksTimer.stop(); @@ -528,8 +532,11 @@ bool FrameView::hasCompositedContent() const void FrameView::enterCompositingMode() { #if USE(ACCELERATED_COMPOSITING) - if (RenderView* view = m_frame->contentRenderer()) + if (RenderView* view = m_frame->contentRenderer()) { view->compositor()->enableCompositingMode(); + if (!needsLayout()) + view->compositor()->scheduleCompositingLayerUpdate(); + } #endif } @@ -647,24 +654,23 @@ void FrameView::layout(bool allowSubtree) m_layoutSchedulingEnabled = false; - if (!m_nestedLayoutCount && m_postLayoutTasksTimer.isActive()) { + if (!m_nestedLayoutCount && !m_inSynchronousPostLayout && m_hasPendingPostLayoutTasks) { // This is a new top-level layout. If there are any remaining tasks from the previous // layout, finish them now. + m_inSynchronousPostLayout = true; m_postLayoutTasksTimer.stop(); performPostLayoutTasks(); + m_inSynchronousPostLayout = false; } // Viewport-dependent media queries may cause us to need completely different style information. // Check that here. if (document->styleSelector()->affectedByViewportChange()) - document->updateStyleSelector(); + document->styleSelectorChanged(RecalcStyleImmediately); // Always ensure our style info is up-to-date. This can happen in situations where // the layout beats any sort of style recalc update that needs to occur. - if (m_frame->needsReapplyStyles()) - m_frame->reapplyStyles(); - else if (document->childNeedsStyleRecalc()) - document->recalcStyle(); + document->updateStyleIfNeeded(); bool subtree = m_layoutRoot; @@ -841,17 +847,25 @@ void FrameView::layout(bool allowSubtree) updateOverflowStatus(layoutWidth() < contentsWidth(), layoutHeight() < contentsHeight()); - if (!m_postLayoutTasksTimer.isActive()) { - // Calls resumeScheduledEvents() - performPostLayoutTasks(); + if (!m_hasPendingPostLayoutTasks) { + if (!m_inSynchronousPostLayout) { + m_inSynchronousPostLayout = true; + // Calls resumeScheduledEvents() + performPostLayoutTasks(); + m_inSynchronousPostLayout = false; + } - if (!m_postLayoutTasksTimer.isActive() && needsLayout()) { - // Post-layout widget updates or an event handler made us need layout again. - // Lay out again, but this time defer widget updates and event dispatch until after - // we return. + if (!m_hasPendingPostLayoutTasks && (needsLayout() || m_inSynchronousPostLayout)) { + // If we need layout or are already in a synchronous call to postLayoutTasks(), + // defer widget updates and event dispatch until after we return. postLayoutTasks() + // can make us need to update again, and we can get stuck in a nasty cycle unless + // we call it through the timer here. + m_hasPendingPostLayoutTasks = true; m_postLayoutTasksTimer.startOneShot(0); - pauseScheduledEvents(); - layout(); + if (needsLayout()) { + pauseScheduledEvents(); + layout(); + } } } else { resumeScheduledEvents(); @@ -1468,12 +1482,9 @@ bool FrameView::needsLayout() const if (!m_frame) return false; RenderView* root = m_frame->contentRenderer(); - Document* document = m_frame->document(); return layoutPending() || (root && root->needsLayout()) || m_layoutRoot - || (document && document->childNeedsStyleRecalc()) // can occur when using WebKit ObjC interface - || m_frame->needsReapplyStyles() || (m_deferSetNeedsLayouts && m_setNeedsLayoutWasDeferred); } @@ -1490,6 +1501,8 @@ void FrameView::setNeedsLayout() void FrameView::unscheduleRelayout() { + m_postLayoutTasksTimer.stop(); + if (!m_layoutTimer.isActive()) return; @@ -1633,6 +1646,8 @@ bool FrameView::updateWidgets() void FrameView::performPostLayoutTasks() { + m_hasPendingPostLayoutTasks = false; + if (m_firstLayoutCallbackPending) { m_firstLayoutCallbackPending = false; m_frame->loader()->didFirstLayout(); @@ -1965,7 +1980,7 @@ void FrameView::paintContents(GraphicsContext* p, const IntRect& rect) RenderView* contentRenderer = frame()->contentRenderer(); if (!contentRenderer) { - LOG_ERROR("called Frame::paint with nil renderer"); + LOG_ERROR("called FrameView::paint with nil renderer"); return; } @@ -2036,7 +2051,7 @@ void FrameView::setNodeToDraw(Node* node) m_nodeToDraw = node; } -void FrameView::layoutIfNeededRecursive() +void FrameView::updateLayoutAndStyleIfNeededRecursive() { // We have to crawl our entire tree looking for any FrameViews that need // layout and make sure they are up to date. @@ -2047,6 +2062,8 @@ void FrameView::layoutIfNeededRecursive() // region but then become included later by the second frame adding rects to the dirty region // when it lays out. + m_frame->document()->updateStyleIfNeeded(); + if (needsLayout()) layout(); @@ -2055,10 +2072,10 @@ void FrameView::layoutIfNeededRecursive() for (HashSet<RefPtr<Widget> >::const_iterator current = viewChildren->begin(); current != end; ++current) { Widget* widget = (*current).get(); if (widget->isFrameView()) - static_cast<FrameView*>(widget)->layoutIfNeededRecursive(); + static_cast<FrameView*>(widget)->updateLayoutAndStyleIfNeededRecursive(); } - // layoutIfNeededRecursive is called when we need to make sure layout is up-to-date before + // updateLayoutAndStyleIfNeededRecursive is called when we need to make sure style and layout are up-to-date before // painting, so we need to flush out any deferred repaints too. flushDeferredRepaints(); } diff --git a/WebCore/page/FrameView.h b/WebCore/page/FrameView.h index 47dff43..463020a 100644 --- a/WebCore/page/FrameView.h +++ b/WebCore/page/FrameView.h @@ -193,7 +193,7 @@ public: static double currentPaintTimeStamp() { return sCurrentPaintTimeStamp; } // returns 0 if not painting - void layoutIfNeededRecursive(); + void updateLayoutAndStyleIfNeededRecursive(); void flushDeferredRepaints(); void setIsVisuallyNonEmpty() { m_isVisuallyNonEmpty = true; } @@ -319,6 +319,8 @@ private: bool m_layoutSchedulingEnabled; bool m_inLayout; + bool m_hasPendingPostLayoutTasks; + bool m_inSynchronousPostLayout; int m_layoutCount; unsigned m_nestedLayoutCount; Timer<FrameView> m_postLayoutTasksTimer; diff --git a/WebCore/page/Page.cpp b/WebCore/page/Page.cpp index b8abb54..b9eea6a 100644 --- a/WebCore/page/Page.cpp +++ b/WebCore/page/Page.cpp @@ -277,7 +277,7 @@ void Page::setViewMode(ViewMode viewMode) m_mainFrame->view()->forceLayout(); if (m_mainFrame->document()) - m_mainFrame->document()->updateStyleSelector(); + m_mainFrame->document()->styleSelectorChanged(RecalcStyleImmediately); } void Page::setMainFrame(PassRefPtr<Frame> mainFrame) @@ -424,14 +424,14 @@ void Page::initGroup() m_group = m_singlePageGroup.get(); } -void Page::setNeedsReapplyStyles() +void Page::scheduleForcedStyleRecalcForAllPages() { if (!allPages) return; HashSet<Page*>::iterator end = allPages->end(); for (HashSet<Page*>::iterator it = allPages->begin(); it != end; ++it) for (Frame* frame = (*it)->mainFrame(); frame; frame = frame->tree()->traverseNext()) - frame->setNeedsReapplyStyles(); + frame->document()->scheduleForcedStyleRecalc(); } void Page::refreshPlugins(bool reload) @@ -544,7 +544,7 @@ unsigned int Page::markAllMatchesForText(const String& target, TextCaseSensitivi Frame* frame = mainFrame(); do { frame->setMarkedTextMatchesAreHighlighted(shouldHighlight); - matches += frame->markAllMatchesForText(target, caseSensitivity == TextCaseSensitive, (limit == 0) ? 0 : (limit - matches)); + matches += frame->countMatchesForText(target, caseSensitivity == TextCaseSensitive, (limit == 0) ? 0 : (limit - matches), true); frame = incrementFrame(frame, true, false); } while (frame); @@ -657,7 +657,7 @@ void Page::userStyleSheetLocationChanged() for (Frame* frame = mainFrame(); frame; frame = frame->tree()->traverseNext()) { if (frame->document()) - frame->document()->clearPageUserSheet(); + frame->document()->updatePageUserSheet(); } } diff --git a/WebCore/page/Page.h b/WebCore/page/Page.h index d9e9255..8f01faa 100644 --- a/WebCore/page/Page.h +++ b/WebCore/page/Page.h @@ -91,7 +91,7 @@ namespace WebCore { class Page : public Noncopyable { public: - static void setNeedsReapplyStyles(); + static void scheduleForcedStyleRecalcForAllPages(); // It is up to the platform to ensure that non-null clients are provided where required. struct PageClients { diff --git a/WebCore/page/PageGroup.cpp b/WebCore/page/PageGroup.cpp index aecd550..4c9403b 100644 --- a/WebCore/page/PageGroup.cpp +++ b/WebCore/page/PageGroup.cpp @@ -363,7 +363,7 @@ void PageGroup::resetUserStyleCacheInAllFrames() HashSet<Page*>::const_iterator end = m_pages.end(); for (HashSet<Page*>::const_iterator it = m_pages.begin(); it != end; ++it) { for (Frame* frame = (*it)->mainFrame(); frame; frame = frame->tree()->traverseNext()) - frame->document()->clearPageGroupUserSheets(); + frame->document()->updatePageGroupUserSheets(); } #endif } diff --git a/WebCore/page/SecurityOrigin.cpp b/WebCore/page/SecurityOrigin.cpp index 5b51501..6edf32a 100644 --- a/WebCore/page/SecurityOrigin.cpp +++ b/WebCore/page/SecurityOrigin.cpp @@ -236,7 +236,13 @@ bool SecurityOrigin::canRequest(const KURL& url) const return false; RefPtr<SecurityOrigin> targetOrigin = SecurityOrigin::create(url); - if (targetOrigin->isUnique()) + + bool doUniqueOriginCheck = true; +#if ENABLE(BLOB) + // For blob scheme, we want to ignore this check. + doUniqueOriginCheck = !url.protocolIs("blob"); +#endif + if (doUniqueOriginCheck && targetOrigin->isUnique()) return false; // We call isSameSchemeHostPort here instead of canAccess because we want diff --git a/WebCore/page/Settings.cpp b/WebCore/page/Settings.cpp index a7ca533..47e764c 100644 --- a/WebCore/page/Settings.cpp +++ b/WebCore/page/Settings.cpp @@ -28,6 +28,7 @@ #include "BackForwardList.h" #include "Database.h" +#include "DocLoader.h" #include "Frame.h" #include "FrameTree.h" #include "FrameView.h" @@ -41,10 +42,16 @@ using namespace std; namespace WebCore { -static void setNeedsReapplyStylesInAllFrames(Page* page) +static void setNeedsRecalcStyleInAllFrames(Page* page) { for (Frame* frame = page->mainFrame(); frame; frame = frame->tree()->traverseNext()) - frame->setNeedsReapplyStyles(); + frame->document()->styleSelectorChanged(DeferRecalcStyle); +} + +static void setLoadsImagesAutomaticallyInAllFrames(Page* page) +{ + for (Frame* frame = page->mainFrame(); frame; frame = frame->tree()->traverseNext()) + frame->document()->docLoader()->setAutoLoadImages(page->settings()->loadsImagesAutomatically()); } #if USE(SAFARI_THEME) @@ -121,7 +128,7 @@ Settings::Settings(Page* page) , m_inApplicationChromeMode(false) , m_offlineWebApplicationCacheEnabled(false) , m_shouldPaintCustomScrollbars(false) - , m_enforceCSSMIMETypeInStrictMode(true) + , m_enforceCSSMIMETypeInNoQuirksMode(true) , m_usesEncodingDetector(false) , m_allowScriptsToCloseWindows(false) , m_editingBehaviorType( @@ -146,6 +153,9 @@ Settings::Settings(Page* page) , m_tiledBackingStoreEnabled(false) , m_paginateDuringLayoutEnabled(false) , m_dnsPrefetchingEnabled(true) +#if ENABLE(FULLSCREEN_API) + , m_fullScreenAPIEnabled(false) +#endif , m_memoryInfoEnabled(false) , m_interactiveFormValidation(false) #ifdef ANDROID_PLUGINS @@ -167,7 +177,7 @@ void Settings::setStandardFontFamily(const AtomicString& standardFontFamily) return; m_standardFontFamily = standardFontFamily; - setNeedsReapplyStylesInAllFrames(m_page); + setNeedsRecalcStyleInAllFrames(m_page); } void Settings::setFixedFontFamily(const AtomicString& fixedFontFamily) @@ -176,7 +186,7 @@ void Settings::setFixedFontFamily(const AtomicString& fixedFontFamily) return; m_fixedFontFamily = fixedFontFamily; - setNeedsReapplyStylesInAllFrames(m_page); + setNeedsRecalcStyleInAllFrames(m_page); } void Settings::setSerifFontFamily(const AtomicString& serifFontFamily) @@ -185,7 +195,7 @@ void Settings::setSerifFontFamily(const AtomicString& serifFontFamily) return; m_serifFontFamily = serifFontFamily; - setNeedsReapplyStylesInAllFrames(m_page); + setNeedsRecalcStyleInAllFrames(m_page); } void Settings::setSansSerifFontFamily(const AtomicString& sansSerifFontFamily) @@ -194,7 +204,7 @@ void Settings::setSansSerifFontFamily(const AtomicString& sansSerifFontFamily) return; m_sansSerifFontFamily = sansSerifFontFamily; - setNeedsReapplyStylesInAllFrames(m_page); + setNeedsRecalcStyleInAllFrames(m_page); } void Settings::setCursiveFontFamily(const AtomicString& cursiveFontFamily) @@ -203,7 +213,7 @@ void Settings::setCursiveFontFamily(const AtomicString& cursiveFontFamily) return; m_cursiveFontFamily = cursiveFontFamily; - setNeedsReapplyStylesInAllFrames(m_page); + setNeedsRecalcStyleInAllFrames(m_page); } void Settings::setFantasyFontFamily(const AtomicString& fantasyFontFamily) @@ -212,7 +222,7 @@ void Settings::setFantasyFontFamily(const AtomicString& fantasyFontFamily) return; m_fantasyFontFamily = fantasyFontFamily; - setNeedsReapplyStylesInAllFrames(m_page); + setNeedsRecalcStyleInAllFrames(m_page); } void Settings::setMinimumFontSize(int minimumFontSize) @@ -221,7 +231,7 @@ void Settings::setMinimumFontSize(int minimumFontSize) return; m_minimumFontSize = minimumFontSize; - setNeedsReapplyStylesInAllFrames(m_page); + setNeedsRecalcStyleInAllFrames(m_page); } void Settings::setMinimumLogicalFontSize(int minimumLogicalFontSize) @@ -230,7 +240,7 @@ void Settings::setMinimumLogicalFontSize(int minimumLogicalFontSize) return; m_minimumLogicalFontSize = minimumLogicalFontSize; - setNeedsReapplyStylesInAllFrames(m_page); + setNeedsRecalcStyleInAllFrames(m_page); } void Settings::setDefaultFontSize(int defaultFontSize) @@ -239,7 +249,7 @@ void Settings::setDefaultFontSize(int defaultFontSize) return; m_defaultFontSize = defaultFontSize; - setNeedsReapplyStylesInAllFrames(m_page); + setNeedsRecalcStyleInAllFrames(m_page); } void Settings::setDefaultFixedFontSize(int defaultFontSize) @@ -248,7 +258,7 @@ void Settings::setDefaultFixedFontSize(int defaultFontSize) return; m_defaultFixedFontSize = defaultFontSize; - setNeedsReapplyStylesInAllFrames(m_page); + setNeedsRecalcStyleInAllFrames(m_page); } #ifdef ANDROID_BLOCK_NETWORK_IMAGE @@ -261,6 +271,7 @@ void Settings::setBlockNetworkImage(bool blockNetworkImage) void Settings::setLoadsImagesAutomatically(bool loadsImagesAutomatically) { m_loadsImagesAutomatically = loadsImagesAutomatically; + setLoadsImagesAutomaticallyInAllFrames(m_page); } void Settings::setJavaScriptEnabled(bool isJavaScriptEnabled) @@ -365,7 +376,7 @@ void Settings::setTextAreasAreResizable(bool textAreasAreResizable) return; m_textAreasAreResizable = textAreasAreResizable; - setNeedsReapplyStylesInAllFrames(m_page); + setNeedsRecalcStyleInAllFrames(m_page); } void Settings::setEditableLinkBehavior(EditableLinkBehavior editableLinkBehavior) @@ -638,7 +649,7 @@ void Settings::setAuthorAndUserStylesEnabled(bool authorAndUserStylesEnabled) return; m_authorAndUserStylesEnabled = authorAndUserStylesEnabled; - setNeedsReapplyStylesInAllFrames(m_page); + setNeedsRecalcStyleInAllFrames(m_page); } void Settings::setFontRenderingMode(FontRenderingMode mode) @@ -646,7 +657,7 @@ void Settings::setFontRenderingMode(FontRenderingMode mode) if (fontRenderingMode() == mode) return; m_fontRenderingMode = mode; - setNeedsReapplyStylesInAllFrames(m_page); + setNeedsRecalcStyleInAllFrames(m_page); } FontRenderingMode Settings::fontRenderingMode() const @@ -679,6 +690,11 @@ void Settings::setLocalStorageDatabasePath(const String& path) m_localStorageDatabasePath = path; } +void Settings::setFileSystemRootPath(const String& path) +{ + m_fileSystemRootPath = path; +} + void Settings::setApplicationChromeMode(bool mode) { m_inApplicationChromeMode = mode; @@ -700,12 +716,12 @@ void Settings::setZoomMode(ZoomMode mode) return; m_zoomMode = mode; - setNeedsReapplyStylesInAllFrames(m_page); + setNeedsRecalcStyleInAllFrames(m_page); } -void Settings::setEnforceCSSMIMETypeInStrictMode(bool enforceCSSMIMETypeInStrictMode) +void Settings::setEnforceCSSMIMETypeInNoQuirksMode(bool enforceCSSMIMETypeInNoQuirksMode) { - m_enforceCSSMIMETypeInStrictMode = enforceCSSMIMETypeInStrictMode; + m_enforceCSSMIMETypeInNoQuirksMode = enforceCSSMIMETypeInNoQuirksMode; } #if USE(SAFARI_THEME) @@ -751,7 +767,7 @@ void Settings::setAcceleratedCompositingEnabled(bool enabled) return; m_acceleratedCompositingEnabled = enabled; - setNeedsReapplyStylesInAllFrames(m_page); + setNeedsRecalcStyleInAllFrames(m_page); } void Settings::setShowDebugBorders(bool enabled) @@ -760,7 +776,7 @@ void Settings::setShowDebugBorders(bool enabled) return; m_showDebugBorders = enabled; - setNeedsReapplyStylesInAllFrames(m_page); + setNeedsRecalcStyleInAllFrames(m_page); } void Settings::setShowRepaintCounter(bool enabled) @@ -769,7 +785,7 @@ void Settings::setShowRepaintCounter(bool enabled) return; m_showRepaintCounter = enabled; - setNeedsReapplyStylesInAllFrames(m_page); + setNeedsRecalcStyleInAllFrames(m_page); } void Settings::setExperimentalNotificationsEnabled(bool enabled) diff --git a/WebCore/page/Settings.h b/WebCore/page/Settings.h index 0048598..b95c62d 100644 --- a/WebCore/page/Settings.h +++ b/WebCore/page/Settings.h @@ -307,7 +307,10 @@ namespace WebCore { void setLocalStorageDatabasePath(const String&); const String& localStorageDatabasePath() const { return m_localStorageDatabasePath; } - + + void setFileSystemRootPath(const String&); + const String& fileSystemRootPath() const { return m_fileSystemRootPath; } + void setApplicationChromeMode(bool); bool inApplicationChromeMode() const { return m_inApplicationChromeMode; } @@ -320,8 +323,8 @@ namespace WebCore { void setZoomMode(ZoomMode); ZoomMode zoomMode() const { return m_zoomMode; } - void setEnforceCSSMIMETypeInStrictMode(bool); - bool enforceCSSMIMETypeInStrictMode() { return m_enforceCSSMIMETypeInStrictMode; } + void setEnforceCSSMIMETypeInNoQuirksMode(bool); + bool enforceCSSMIMETypeInNoQuirksMode() { return m_enforceCSSMIMETypeInNoQuirksMode; } void setMaximumDecodedImageSize(size_t size) { m_maximumDecodedImageSize = size; } size_t maximumDecodedImageSize() const { return m_maximumDecodedImageSize; } @@ -379,6 +382,11 @@ namespace WebCore { void setPaginateDuringLayoutEnabled(bool flag) { m_paginateDuringLayoutEnabled = flag; } bool paginateDuringLayoutEnabled() const { return m_paginateDuringLayoutEnabled; } +#if ENABLE(FULLSCREEN_API) + void setFullScreenEnabled(bool flag) { m_fullScreenAPIEnabled = flag; } + bool fullScreenEnabled() const { return m_fullScreenAPIEnabled; } +#endif + void setMemoryInfoEnabled(bool flag) { m_memoryInfoEnabled = flag; } bool memoryInfoEnabled() const { return m_memoryInfoEnabled; } @@ -391,10 +399,11 @@ namespace WebCore { private: Page* m_page; - + String m_defaultTextEncodingName; String m_ftpDirectoryTemplatePath; String m_localStorageDatabasePath; + String m_fileSystemRootPath; KURL m_userStyleSheetLocation; AtomicString m_standardFontFamily; AtomicString m_fixedFontFamily; @@ -492,7 +501,7 @@ namespace WebCore { bool m_inApplicationChromeMode : 1; bool m_offlineWebApplicationCacheEnabled : 1; bool m_shouldPaintCustomScrollbars : 1; - bool m_enforceCSSMIMETypeInStrictMode : 1; + bool m_enforceCSSMIMETypeInNoQuirksMode : 1; bool m_usesEncodingDetector : 1; bool m_allowScriptsToCloseWindows : 1; unsigned m_editingBehaviorType : 1; @@ -508,12 +517,19 @@ namespace WebCore { bool m_tiledBackingStoreEnabled : 1; bool m_paginateDuringLayoutEnabled : 1; bool m_dnsPrefetchingEnabled : 1; +#if ENABLE(FULLSCREEN_API) + bool m_fullScreenAPIEnabled : 1; +#endif bool m_memoryInfoEnabled: 1; bool m_interactiveFormValidation: 1; +<<<<<<< HEAD #ifdef ANDROID_PLUGINS bool m_pluginsOnDemand : 1; #endif +======= + +>>>>>>> webkit.org at r66666 #if USE(SAFARI_THEME) static bool gShouldPaintNativeControls; #endif diff --git a/WebCore/page/XSSAuditor.cpp b/WebCore/page/XSSAuditor.cpp index fb0e1c0..0e6cc65 100644 --- a/WebCore/page/XSSAuditor.cpp +++ b/WebCore/page/XSSAuditor.cpp @@ -277,19 +277,18 @@ String XSSAuditor::decodeHTMLEntities(const String& string, bool leaveUndecodabl if (leaveUndecodableEntitiesUntouched) sourceShadow = source; bool notEnoughCharacters = false; - unsigned entity = consumeHTMLEntity(source, notEnoughCharacters); + Vector<UChar, 16> decodedEntity; + bool success = consumeHTMLEntity(source, decodedEntity, notEnoughCharacters); // We ignore notEnoughCharacters because we might as well use this loop // to copy the remaining characters into |result|. - - if (entity > 0xFFFF) { - result.append(U16_LEAD(entity)); - result.append(U16_TRAIL(entity)); - } else if (entity && (!leaveUndecodableEntitiesUntouched || entity != 0xFFFD)){ - result.append(entity); - } else { + if (!success || (!leaveUndecodableEntitiesUntouched && decodedEntity.size() == 1 && decodedEntity[0] == 0xFFFD)) { result.append('&'); if (leaveUndecodableEntitiesUntouched) source = sourceShadow; + } else { + Vector<UChar>::const_iterator iter = decodedEntity.begin(); + for (; iter != decodedEntity.end(); ++iter) + result.append(*iter); } } diff --git a/WebCore/page/animation/AnimationBase.cpp b/WebCore/page/animation/AnimationBase.cpp index 4f304e2..d4926ea 100644 --- a/WebCore/page/animation/AnimationBase.cpp +++ b/WebCore/page/animation/AnimationBase.cpp @@ -644,10 +644,10 @@ void AnimationBase::ensurePropertyMap() gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyWebkitTransformOriginX, &RenderStyle::transformOriginX, &RenderStyle::setTransformOriginX)); gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyWebkitTransformOriginY, &RenderStyle::transformOriginY, &RenderStyle::setTransformOriginY)); gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyWebkitTransformOriginZ, &RenderStyle::transformOriginZ, &RenderStyle::setTransformOriginZ)); - gPropertyWrappers->append(new PropertyWrapper<const IntSize&>(CSSPropertyBorderTopLeftRadius, &RenderStyle::borderTopLeftRadius, &RenderStyle::setBorderTopLeftRadius)); - gPropertyWrappers->append(new PropertyWrapper<const IntSize&>(CSSPropertyBorderTopRightRadius, &RenderStyle::borderTopRightRadius, &RenderStyle::setBorderTopRightRadius)); - gPropertyWrappers->append(new PropertyWrapper<const IntSize&>(CSSPropertyBorderBottomLeftRadius, &RenderStyle::borderBottomLeftRadius, &RenderStyle::setBorderBottomLeftRadius)); - gPropertyWrappers->append(new PropertyWrapper<const IntSize&>(CSSPropertyBorderBottomRightRadius, &RenderStyle::borderBottomRightRadius, &RenderStyle::setBorderBottomRightRadius)); + gPropertyWrappers->append(new PropertyWrapper<const LengthSize&>(CSSPropertyBorderTopLeftRadius, &RenderStyle::borderTopLeftRadius, &RenderStyle::setBorderTopLeftRadius)); + gPropertyWrappers->append(new PropertyWrapper<const LengthSize&>(CSSPropertyBorderTopRightRadius, &RenderStyle::borderTopRightRadius, &RenderStyle::setBorderTopRightRadius)); + gPropertyWrappers->append(new PropertyWrapper<const LengthSize&>(CSSPropertyBorderBottomLeftRadius, &RenderStyle::borderBottomLeftRadius, &RenderStyle::setBorderBottomLeftRadius)); + gPropertyWrappers->append(new PropertyWrapper<const LengthSize&>(CSSPropertyBorderBottomRightRadius, &RenderStyle::borderBottomRightRadius, &RenderStyle::setBorderBottomRightRadius)); gPropertyWrappers->append(new PropertyWrapper<EVisibility>(CSSPropertyVisibility, &RenderStyle::visibility, &RenderStyle::setVisibility)); gPropertyWrappers->append(new PropertyWrapper<float>(CSSPropertyZoom, &RenderStyle::zoom, &RenderStyle::setZoom)); @@ -1114,7 +1114,7 @@ void AnimationBase::updateStateMachine(AnimStateInput input, double param) } else { bool started = startAnimation(beginAnimationUpdateTime() - m_startTime); m_compAnim->animationController()->addToStartTimeResponseWaitList(this, started); - m_isAccelerated = !started; + m_isAccelerated = started; } } break; @@ -1242,7 +1242,7 @@ double AnimationBase::progress(double scale, double offset, const TimingFunction int integralTime = static_cast<int>(fractionalTime); fractionalTime -= integralTime; - if (m_animation->direction() && (integralTime & 1)) + if ((m_animation->direction() == Animation::AnimationDirectionAlternate) && (integralTime & 1)) fractionalTime = 1 - fractionalTime; if (scale != 1 || offset) diff --git a/WebCore/page/animation/KeyframeAnimation.cpp b/WebCore/page/animation/KeyframeAnimation.cpp index 2f2cfc0..01ec2f1 100644 --- a/WebCore/page/animation/KeyframeAnimation.cpp +++ b/WebCore/page/animation/KeyframeAnimation.cpp @@ -62,41 +62,67 @@ KeyframeAnimation::~KeyframeAnimation() endAnimation(); } -void KeyframeAnimation::getKeyframeAnimationInterval(const RenderStyle*& fromStyle, const RenderStyle*& toStyle, double& prog) const +void KeyframeAnimation::fetchIntervalEndpointsForProperty(int property, const RenderStyle*& fromStyle, const RenderStyle*& toStyle, double& prog) const { // Find the first key double elapsedTime = getElapsedTime(); - double t = m_animation->duration() ? (elapsedTime / m_animation->duration()) : 1; + double fractionalTime = m_animation->duration() ? (elapsedTime / m_animation->duration()) : 1; - ASSERT(t >= 0); - if (t < 0) - t = 0; + ASSERT(fractionalTime >= 0); + if (fractionalTime < 0) + fractionalTime = 0; - int i = static_cast<int>(t); - t -= i; - if (m_animation->direction() && (i & 1)) - t = 1 - t; + // FIXME: share this code with AnimationBase::progress(). + int iteration = static_cast<int>(fractionalTime); + fractionalTime -= iteration; + + bool reversing = (m_animation->direction() == Animation::AnimationDirectionAlternate) && (iteration & 1); + if (reversing) + fractionalTime = 1 - fractionalTime; - double scale = 1; - double offset = 0; - Vector<KeyframeValue>::const_iterator endKeyframes = m_keyframes.endKeyframes(); - for (Vector<KeyframeValue>::const_iterator it = m_keyframes.beginKeyframes(); it != endKeyframes; ++it) { - if (t < it->key()) { - // The first key should always be 0, so we should never succeed on the first key - if (!fromStyle) - break; - scale = 1.0 / (it->key() - offset); - toStyle = it->style(); + size_t numKeyframes = m_keyframes.size(); + if (!numKeyframes) + return; + + ASSERT(!m_keyframes[0].key()); + ASSERT(m_keyframes[m_keyframes.size() - 1].key() == 1); + + int prevIndex = -1; + int nextIndex = -1; + + // FIXME: with a lot of keys, this linear search will be slow. We could binary search. + for (size_t i = 0; i < numKeyframes; ++i) { + const KeyframeValue& currKeyFrame = m_keyframes[i]; + + if (!currKeyFrame.containsProperty(property)) + continue; + + if (fractionalTime < currKeyFrame.key()) { + nextIndex = i; break; } - - offset = it->key(); - fromStyle = it->style(); + + prevIndex = i; } - if (!fromStyle || !toStyle) - return; + double scale = 1; + double offset = 0; + + if (prevIndex == -1) + prevIndex = 0; + + if (nextIndex == -1) + nextIndex = m_keyframes.size() - 1; + + const KeyframeValue& prevKeyframe = m_keyframes[prevIndex]; + const KeyframeValue& nextKeyframe = m_keyframes[nextIndex]; + + fromStyle = prevKeyframe.style(); + toStyle = nextKeyframe.style(); + + offset = prevKeyframe.key(); + scale = 1.0 / (nextKeyframe.key() - prevKeyframe.key()); const TimingFunction* timingFunction = 0; if (fromStyle->animations() && fromStyle->animations()->size() > 0) { @@ -131,18 +157,9 @@ void KeyframeAnimation::animate(CompositeAnimation*, RenderObject*, const Render // through to the style blend so that we get the fromStyle. if (waitingToStart() && m_animation->delay() > 0 && !m_animation->fillsBackwards()) return; - - // FIXME: we need to be more efficient about determining which keyframes we are animating between. - // We should cache the last pair or something. - // Get the from/to styles and progress between - const RenderStyle* fromStyle = 0; - const RenderStyle* toStyle = 0; - double progress; - getKeyframeAnimationInterval(fromStyle, toStyle, progress); - - // If either style is 0 we have an invalid case, just stop the animation. - if (!fromStyle || !toStyle) { + // If we have no keyframes, don't animate. + if (!m_keyframes.size()) { updateStateMachine(AnimationStateInputEndAnimation, -1); return; } @@ -152,9 +169,19 @@ void KeyframeAnimation::animate(CompositeAnimation*, RenderObject*, const Render if (!animatedStyle) animatedStyle = RenderStyle::clone(targetStyle); + // FIXME: we need to be more efficient about determining which keyframes we are animating between. + // We should cache the last pair or something. HashSet<int>::const_iterator endProperties = m_keyframes.endProperties(); for (HashSet<int>::const_iterator it = m_keyframes.beginProperties(); it != endProperties; ++it) { - bool needsAnim = blendProperties(this, *it, animatedStyle.get(), fromStyle, toStyle, progress); + int property = *it; + + // Get the from/to styles and progress between + const RenderStyle* fromStyle = 0; + const RenderStyle* toStyle = 0; + double progress; + fetchIntervalEndpointsForProperty(property, fromStyle, toStyle, progress); + + bool needsAnim = blendProperties(this, property, animatedStyle.get(), fromStyle, toStyle, progress); if (needsAnim) setAnimating(); else { @@ -175,26 +202,29 @@ void KeyframeAnimation::getAnimatedStyle(RefPtr<RenderStyle>& animatedStyle) if (waitingToStart() && m_animation->delay() > 0 && !m_animation->fillsBackwards()) return; - // Get the from/to styles and progress between - const RenderStyle* fromStyle = 0; - const RenderStyle* toStyle = 0; - double progress; - getKeyframeAnimationInterval(fromStyle, toStyle, progress); - - // If either style is 0 we have an invalid case - if (!fromStyle || !toStyle) + if (!m_keyframes.size()) return; if (!animatedStyle) animatedStyle = RenderStyle::clone(m_object->style()); HashSet<int>::const_iterator endProperties = m_keyframes.endProperties(); - for (HashSet<int>::const_iterator it = m_keyframes.beginProperties(); it != endProperties; ++it) - blendProperties(this, *it, animatedStyle.get(), fromStyle, toStyle, progress); + for (HashSet<int>::const_iterator it = m_keyframes.beginProperties(); it != endProperties; ++it) { + int property = *it; + + // Get the from/to styles and progress between + const RenderStyle* fromStyle = 0; + const RenderStyle* toStyle = 0; + double progress; + fetchIntervalEndpointsForProperty(property, fromStyle, toStyle, progress); + + blendProperties(this, property, animatedStyle.get(), fromStyle, toStyle, progress); + } } bool KeyframeAnimation::hasAnimationForProperty(int property) const { + // FIXME: why not just m_keyframes.containsProperty()? HashSet<int>::const_iterator end = m_keyframes.endProperties(); for (HashSet<int>::const_iterator it = m_keyframes.beginProperties(); it != end; ++it) { if (*it == property) @@ -346,27 +376,27 @@ void KeyframeAnimation::validateTransformFunctionList() if (m_keyframes.size() < 2 || !m_keyframes.containsProperty(CSSPropertyWebkitTransform)) return; - Vector<KeyframeValue>::const_iterator end = m_keyframes.endKeyframes(); - // Empty transforms match anything, so find the first non-empty entry as the reference - size_t firstIndex = 0; - Vector<KeyframeValue>::const_iterator firstIt = end; - - for (Vector<KeyframeValue>::const_iterator it = m_keyframes.beginKeyframes(); it != end; ++it, ++firstIndex) { - if (it->style()->transform().operations().size() > 0) { - firstIt = it; + size_t numKeyframes = m_keyframes.size(); + size_t firstNonEmptyTransformKeyframeIndex = numKeyframes; + + for (size_t i = 0; i < numKeyframes; ++i) { + const KeyframeValue& currentKeyframe = m_keyframes[i]; + if (currentKeyframe.style()->transform().operations().size()) { + firstNonEmptyTransformKeyframeIndex = i; break; } } - if (firstIt == end) + if (firstNonEmptyTransformKeyframeIndex == numKeyframes) return; - const TransformOperations* firstVal = &firstIt->style()->transform(); + const TransformOperations* firstVal = &m_keyframes[firstNonEmptyTransformKeyframeIndex].style()->transform(); // See if the keyframes are valid - for (Vector<KeyframeValue>::const_iterator it = firstIt+1; it != end; ++it) { - const TransformOperations* val = &it->style()->transform(); + for (size_t i = firstNonEmptyTransformKeyframeIndex + 1; i < numKeyframes; ++i) { + const KeyframeValue& currentKeyframe = m_keyframes[i]; + const TransformOperations* val = ¤tKeyframe.style()->transform(); // A null transform matches anything if (val->operations().isEmpty()) diff --git a/WebCore/page/animation/KeyframeAnimation.h b/WebCore/page/animation/KeyframeAnimation.h index fab0ae8..a187f35 100644 --- a/WebCore/page/animation/KeyframeAnimation.h +++ b/WebCore/page/animation/KeyframeAnimation.h @@ -82,8 +82,8 @@ private: KeyframeAnimation(const Animation* animation, RenderObject*, int index, CompositeAnimation*, RenderStyle* unanimatedStyle); virtual ~KeyframeAnimation(); - // Get the styles surrounding the current animation time and the progress between them - void getKeyframeAnimationInterval(const RenderStyle*& fromStyle, const RenderStyle*& toStyle, double& progress) const; + // Get the styles for the given property surrounding the current animation time and the progress between them. + void fetchIntervalEndpointsForProperty(int property, const RenderStyle*& fromStyle, const RenderStyle*& toStyle, double& progress) const; // The keyframes that we are blending. KeyframeList m_keyframes; diff --git a/WebCore/page/chromium/ChromeClientChromium.h b/WebCore/page/chromium/ChromeClientChromium.h index e897c15..7765472 100644 --- a/WebCore/page/chromium/ChromeClientChromium.h +++ b/WebCore/page/chromium/ChromeClientChromium.h @@ -55,6 +55,9 @@ public: // Notifies embedder that the state of an accessibility object has changed. virtual void didChangeAccessibilityObjectState(AccessibilityObject*) = 0; + + // Notified embedder that the children of an accessibility object has changed. + virtual void didChangeAccessibilityObjectChildren(AccessibilityObject*) = 0; }; } // namespace WebCore diff --git a/WebCore/page/efl/EventHandlerEfl.cpp b/WebCore/page/efl/EventHandlerEfl.cpp index df5c276..acf4343 100644 --- a/WebCore/page/efl/EventHandlerEfl.cpp +++ b/WebCore/page/efl/EventHandlerEfl.cpp @@ -110,7 +110,7 @@ bool EventHandler::passWheelEventToWidget(PlatformWheelEvent& event, Widget* wid PassRefPtr<Clipboard> EventHandler::createDraggingClipboard() const { - return new ClipboardEfl(ClipboardWritable, true); + return ClipboardEfl::create(ClipboardWritable, true); } bool EventHandler::passMousePressEventToSubframe(MouseEventWithHitTestResults& mev, Frame* subframe) |