diff options
Diffstat (limited to 'src/3rdparty/webkit/WebCore/page/Frame.h')
-rw-r--r-- | src/3rdparty/webkit/WebCore/page/Frame.h | 456 |
1 files changed, 228 insertions, 228 deletions
diff --git a/src/3rdparty/webkit/WebCore/page/Frame.h b/src/3rdparty/webkit/WebCore/page/Frame.h index 0a44a6d15..652269a18 100644 --- a/src/3rdparty/webkit/WebCore/page/Frame.h +++ b/src/3rdparty/webkit/WebCore/page/Frame.h @@ -37,8 +37,8 @@ #include "FrameLoader.h" #include "FrameTree.h" #include "Range.h" -#include "ScrollBehavior.h" #include "ScriptController.h" +#include "ScrollBehavior.h" #include "SelectionController.h" #include "TextGranularity.h" @@ -62,315 +62,315 @@ typedef struct HBITMAP__* HBITMAP; namespace WebCore { -class CSSMutableStyleDeclaration; -class Editor; -class EventHandler; -class FrameLoader; -class FrameLoaderClient; -class FrameTree; -class FrameView; -class HTMLFrameOwnerElement; -class HTMLTableCellElement; -class RegularExpression; -class RenderPart; -class ScriptController; -class SelectionController; -class Settings; -class VisibleSelection; -class Widget; + class CSSMutableStyleDeclaration; + class Editor; + class EventHandler; + class FrameLoader; + class FrameLoaderClient; + class FrameTree; + class FrameView; + class HTMLFrameOwnerElement; + class HTMLTableCellElement; + class RegularExpression; + class RenderPart; + class ScriptController; + class SelectionController; + class Settings; + class VisibleSelection; + class Widget; #if FRAME_LOADS_USER_STYLESHEET class UserStyleSheetLoader; #endif -template <typename T> class Timer; + template <typename T> class Timer; -class Frame : public RefCounted<Frame> { -public: - static PassRefPtr<Frame> create(Page* page, HTMLFrameOwnerElement* ownerElement, FrameLoaderClient* client) - { - return adoptRef(new Frame(page, ownerElement, client)); - } - void setView(PassRefPtr<FrameView>); - ~Frame(); - - void init(); + class Frame : public RefCounted<Frame> { + public: + static PassRefPtr<Frame> create(Page* page, HTMLFrameOwnerElement* ownerElement, FrameLoaderClient* client) + { + return adoptRef(new Frame(page, ownerElement, client)); + } + void setView(PassRefPtr<FrameView>); + ~Frame(); - Page* page() const; - HTMLFrameOwnerElement* ownerElement() const; + void init(); - void pageDestroyed(); - void disconnectOwnerElement(); + Page* page() const; + HTMLFrameOwnerElement* ownerElement() const; - Document* document() const; - FrameView* view() const; + void pageDestroyed(); + void disconnectOwnerElement(); - void setDOMWindow(DOMWindow*); - DOMWindow* domWindow() const; - void clearFormerDOMWindow(DOMWindow*); + Document* document() const; + FrameView* view() const; - Editor* editor() const; - EventHandler* eventHandler() const; - FrameLoader* loader() const; - SelectionController* selection() const; - FrameTree* tree() const; - AnimationController* animation() const; - ScriptController* script(); + void setDOMWindow(DOMWindow*); + DOMWindow* domWindow() const; + void clearFormerDOMWindow(DOMWindow*); - RenderView* contentRenderer() const; // root renderer for the document contained in this frame - RenderPart* ownerRenderer() const; // renderer for the element that contains this frame - - bool isDisconnected() const; - void setIsDisconnected(bool); - bool excludeFromTextSearch() const; - void setExcludeFromTextSearch(bool); + Editor* editor() const; + EventHandler* eventHandler() const; + FrameLoader* loader() const; + SelectionController* selection() const; + FrameTree* tree() const; + AnimationController* animation() const; + ScriptController* script(); - void createView(const IntSize&, const Color&, bool, const IntSize &, bool, - ScrollbarMode = ScrollbarAuto, ScrollbarMode = ScrollbarAuto); + RenderView* contentRenderer() const; // root renderer for the document contained in this frame + RenderPart* ownerRenderer() const; // renderer for the element that contains this frame + bool isDisconnected() const; + void setIsDisconnected(bool); + bool excludeFromTextSearch() const; + void setExcludeFromTextSearch(bool); -private: - Frame(Page*, HTMLFrameOwnerElement*, FrameLoaderClient*); - -// === undecided, would like to consider moving to another class + void createView(const IntSize&, const Color&, bool, const IntSize &, bool, + ScrollbarMode = ScrollbarAuto, ScrollbarMode = ScrollbarAuto); -public: - static Frame* frameForWidget(const Widget*); - Settings* settings() const; // can be NULL + private: + Frame(Page*, HTMLFrameOwnerElement*, FrameLoaderClient*); -#if FRAME_LOADS_USER_STYLESHEET - void setUserStyleSheetLocation(const KURL&); - void setUserStyleSheet(const String& styleSheetData); -#endif + // === undecided, would like to consider moving to another class - void setPrinting(bool printing, float minPageWidth, float maxPageWidth, bool adjustViewSize); + public: + static Frame* frameForWidget(const Widget*); - bool inViewSourceMode() const; - void setInViewSourceMode(bool = true); + Settings* settings() const; // can be NULL - void keepAlive(); // Used to keep the frame alive when running a script that might destroy it. -#ifndef NDEBUG - static void cancelAllKeepAlive(); -#endif + #if FRAME_LOADS_USER_STYLESHEET + void setUserStyleSheetLocation(const KURL&); + void setUserStyleSheet(const String& styleSheetData); + #endif - void setDocument(PassRefPtr<Document>); + void setPrinting(bool printing, float minPageWidth, float maxPageWidth, bool adjustViewSize); - void clearTimers(); - static void clearTimers(FrameView*, Document*); + bool inViewSourceMode() const; + void setInViewSourceMode(bool = true); - void setNeedsReapplyStyles(); - bool needsReapplyStyles() const; - void reapplyStyles(); + void keepAlive(); // Used to keep the frame alive when running a script that might destroy it. + #ifndef NDEBUG + static void cancelAllKeepAlive(); + #endif - String documentTypeString() const; + void setDocument(PassRefPtr<Document>); - // This method -- and the corresponding list of former DOM windows -- - // should move onto ScriptController - void clearDOMWindow(); + void clearTimers(); + static void clearTimers(FrameView*, Document*); - String displayStringModifiedByEncoding(const String& str) const - { - return document() ? document()->displayStringModifiedByEncoding(str) : str; - } + void setNeedsReapplyStyles(); + bool needsReapplyStyles() const; + void reapplyStyles(); -private: - void lifeSupportTimerFired(Timer<Frame>*); + String documentTypeString() const; -// === to be moved into FrameView + // This method -- and the corresponding list of former DOM windows -- + // should move onto ScriptController + void clearDOMWindow(); -public: - void setZoomFactor(float scale, bool isTextOnly); - float zoomFactor() const; - bool isZoomFactorTextOnly() const; - bool shouldApplyTextZoom() const; - bool shouldApplyPageZoom() const; - float pageZoomFactor() const { return shouldApplyPageZoom() ? zoomFactor() : 1.0f; } - float textZoomFactor() const { return shouldApplyTextZoom() ? zoomFactor() : 1.0f; } + String displayStringModifiedByEncoding(const String& str) const + { + return document() ? document()->displayStringModifiedByEncoding(str) : str; + } -// === to be moved into Chrome + private: + void lifeSupportTimerFired(Timer<Frame>*); -public: - void focusWindow(); - void unfocusWindow(); - bool shouldClose(RegisteredEventListenerVector* alternateEventListeners = 0); - void scheduleClose(); + // === to be moved into FrameView - void setJSStatusBarText(const String&); - void setJSDefaultStatusBarText(const String&); - String jsStatusBarText() const; - String jsDefaultStatusBarText() const; + public: + void setZoomFactor(float scale, bool isTextOnly); + float zoomFactor() const; + bool isZoomFactorTextOnly() const; + bool shouldApplyTextZoom() const; + bool shouldApplyPageZoom() const; + float pageZoomFactor() const { return shouldApplyPageZoom() ? zoomFactor() : 1.0f; } + float textZoomFactor() const { return shouldApplyTextZoom() ? zoomFactor() : 1.0f; } -// === to be moved into Editor + // === to be moved into Chrome -public: - String selectedText() const; - bool findString(const String&, bool forward, bool caseFlag, bool wrapFlag, bool startInSelection); + public: + void focusWindow(); + void unfocusWindow(); + bool shouldClose(RegisteredEventListenerVector* alternateEventListeners = 0); + void scheduleClose(); - const VisibleSelection& mark() const; // Mark, to be used as emacs uses it. - void setMark(const VisibleSelection&); + void setJSStatusBarText(const String&); + void setJSDefaultStatusBarText(const String&); + String jsStatusBarText() const; + String jsDefaultStatusBarText() const; - void computeAndSetTypingStyle(CSSStyleDeclaration* , EditAction = EditActionUnspecified); - String selectionStartStylePropertyValue(int stylePropertyID) const; - void applyEditingStyleToBodyElement() const; - void removeEditingStyleFromBodyElement() const; - void applyEditingStyleToElement(Element*) const; - void removeEditingStyleFromElement(Element*) const; + // === to be moved into Editor - IntRect firstRectForRange(Range*) const; - - void respondToChangedSelection(const VisibleSelection& oldSelection, bool closeTyping); - bool shouldChangeSelection(const VisibleSelection& oldSelection, const VisibleSelection& newSelection, EAffinity, bool stillSelecting) const; + public: + String selectedText() const; + bool findString(const String&, bool forward, bool caseFlag, bool wrapFlag, bool startInSelection); - RenderStyle* styleForSelectionStart(Node*& nodeToRemove) const; + const VisibleSelection& mark() const; // Mark, to be used as emacs uses it. + void setMark(const VisibleSelection&); - unsigned markAllMatchesForText(const String&, bool caseFlag, unsigned limit); - bool markedTextMatchesAreHighlighted() const; - void setMarkedTextMatchesAreHighlighted(bool flag); + void computeAndSetTypingStyle(CSSStyleDeclaration* , EditAction = EditActionUnspecified); + String selectionStartStylePropertyValue(int stylePropertyID) const; + void applyEditingStyleToBodyElement() const; + void removeEditingStyleFromBodyElement() const; + void applyEditingStyleToElement(Element*) const; + void removeEditingStyleFromElement(Element*) const; - PassRefPtr<CSSComputedStyleDeclaration> selectionComputedStyle(Node*& nodeToRemove) const; + IntRect firstRectForRange(Range*) const; - void textFieldDidBeginEditing(Element*); - void textFieldDidEndEditing(Element*); - void textDidChangeInTextField(Element*); - bool doTextFieldCommandFromEvent(Element*, KeyboardEvent*); - void textWillBeDeletedInTextField(Element* input); - void textDidChangeInTextArea(Element*); + void respondToChangedSelection(const VisibleSelection& oldSelection, bool closeTyping); + bool shouldChangeSelection(const VisibleSelection& oldSelection, const VisibleSelection& newSelection, EAffinity, bool stillSelecting) const; - DragImageRef dragImageForSelection(); - -// === to be moved into SelectionController + RenderStyle* styleForSelectionStart(Node*& nodeToRemove) const; -public: - TextGranularity selectionGranularity() const; - void setSelectionGranularity(TextGranularity); + unsigned markAllMatchesForText(const String&, bool caseFlag, unsigned limit); + bool markedTextMatchesAreHighlighted() const; + void setMarkedTextMatchesAreHighlighted(bool flag); - bool shouldChangeSelection(const VisibleSelection&) const; - bool shouldDeleteSelection(const VisibleSelection&) const; - void clearCaretRectIfNeeded(); - void setFocusedNodeIfNeeded(); - void selectionLayoutChanged(); - void notifyRendererOfSelectionChange(bool userTriggered); + PassRefPtr<CSSComputedStyleDeclaration> selectionComputedStyle(Node*& nodeToRemove) const; - void invalidateSelection(); + void textFieldDidBeginEditing(Element*); + void textFieldDidEndEditing(Element*); + void textDidChangeInTextField(Element*); + bool doTextFieldCommandFromEvent(Element*, KeyboardEvent*); + void textWillBeDeletedInTextField(Element* input); + void textDidChangeInTextArea(Element*); - void setCaretVisible(bool = true); - void paintCaret(GraphicsContext*, int tx, int ty, const IntRect& clipRect) const; - void paintDragCaret(GraphicsContext*, int tx, int ty, const IntRect& clipRect) const; + DragImageRef dragImageForSelection(); - bool isContentEditable() const; // if true, everything in frame is editable + // === to be moved into SelectionController - void updateSecureKeyboardEntryIfActive(); + public: + TextGranularity selectionGranularity() const; + void setSelectionGranularity(TextGranularity); - CSSMutableStyleDeclaration* typingStyle() const; - void setTypingStyle(CSSMutableStyleDeclaration*); - void clearTypingStyle(); + bool shouldChangeSelection(const VisibleSelection&) const; + bool shouldDeleteSelection(const VisibleSelection&) const; + void clearCaretRectIfNeeded(); + void setFocusedNodeIfNeeded(); + void selectionLayoutChanged(); + void notifyRendererOfSelectionChange(bool userTriggered); - FloatRect selectionBounds(bool clipToVisibleContent = true) const; - void selectionTextRects(Vector<FloatRect>&, bool clipToVisibleContent = true) const; + void invalidateSelection(); - HTMLFormElement* currentForm() const; + void setCaretVisible(bool = true); + void paintCaret(GraphicsContext*, int tx, int ty, const IntRect& clipRect) const; + void paintDragCaret(GraphicsContext*, int tx, int ty, const IntRect& clipRect) const; - void revealSelection(const ScrollAlignment& = ScrollAlignment::alignCenterIfNeeded, bool revealExtent = false); - void setSelectionFromNone(); + bool isContentEditable() const; // if true, everything in frame is editable - void setUseSecureKeyboardEntry(bool); + void updateSecureKeyboardEntryIfActive(); -private: - void caretBlinkTimerFired(Timer<Frame>*); + CSSMutableStyleDeclaration* typingStyle() const; + void setTypingStyle(CSSMutableStyleDeclaration*); + void clearTypingStyle(); -public: - SelectionController* dragCaretController() const; + FloatRect selectionBounds(bool clipToVisibleContent = true) const; + void selectionTextRects(Vector<FloatRect>&, bool clipToVisibleContent = true) const; - String searchForLabelsAboveCell(RegularExpression*, HTMLTableCellElement*); - String searchForLabelsBeforeElement(const Vector<String>& labels, Element*); - String matchLabelsAgainstElement(const Vector<String>& labels, Element*); - - VisiblePosition visiblePositionForPoint(const IntPoint& framePoint); - Document* documentAtPoint(const IntPoint& windowPoint); + HTMLFormElement* currentForm() const; -#if PLATFORM(MAC) + void revealSelection(const ScrollAlignment& = ScrollAlignment::alignCenterIfNeeded, bool revealExtent = false); + void setSelectionFromNone(); -// === undecided, would like to consider moving to another class + void setUseSecureKeyboardEntry(bool); -public: - NSString* searchForNSLabelsAboveCell(RegularExpression*, HTMLTableCellElement*); - NSString* searchForLabelsBeforeElement(NSArray* labels, Element*); - NSString* matchLabelsAgainstElement(NSArray* labels, Element*); + private: + void caretBlinkTimerFired(Timer<Frame>*); -#if ENABLE(DASHBOARD_SUPPORT) - NSMutableDictionary* dashboardRegionsDictionary(); -#endif + public: + SelectionController* dragCaretController() const; - NSImage* selectionImage(bool forceBlackText = false) const; - NSImage* snapshotDragImage(Node*, NSRect* imageRect, NSRect* elementRect) const; - NSImage* nodeImage(Node*) const; + String searchForLabelsAboveCell(RegularExpression*, HTMLTableCellElement*); + String searchForLabelsBeforeElement(const Vector<String>& labels, Element*); + String matchLabelsAgainstElement(const Vector<String>& labels, Element*); -private: - NSImage* imageFromRect(NSRect) const; + VisiblePosition visiblePositionForPoint(const IntPoint& framePoint); + Document* documentAtPoint(const IntPoint& windowPoint); -// === to be moved into Editor + #if PLATFORM(MAC) -public: - NSDictionary* fontAttributesForSelectionStart() const; - NSWritingDirection baseWritingDirectionForSelectionStart() const; + // === undecided, would like to consider moving to another class -#endif + public: + NSString* searchForNSLabelsAboveCell(RegularExpression*, HTMLTableCellElement*); + NSString* searchForLabelsBeforeElement(NSArray* labels, Element*); + NSString* matchLabelsAgainstElement(NSArray* labels, Element*); -#if PLATFORM(WIN) + #if ENABLE(DASHBOARD_SUPPORT) + NSMutableDictionary* dashboardRegionsDictionary(); + #endif -public: - // FIXME - We should have a single version of nodeImage instead of using platform types. - HBITMAP nodeImage(Node*) const; + NSImage* selectionImage(bool forceBlackText = false) const; + NSImage* snapshotDragImage(Node*, NSRect* imageRect, NSRect* elementRect) const; + NSImage* nodeImage(Node*) const; -#endif + private: + NSImage* imageFromRect(NSRect) const; -private: - Page* m_page; - mutable FrameTree m_treeNode; - mutable FrameLoader m_loader; + // === to be moved into Editor - mutable RefPtr<DOMWindow> m_domWindow; - HashSet<DOMWindow*> m_liveFormerWindows; + public: + NSDictionary* fontAttributesForSelectionStart() const; + NSWritingDirection baseWritingDirectionForSelectionStart() const; - HTMLFrameOwnerElement* m_ownerElement; - RefPtr<FrameView> m_view; - RefPtr<Document> m_doc; + #endif - ScriptController m_script; + #if PLATFORM(WIN) - String m_kjsStatusBarText; - String m_kjsDefaultStatusBarText; + public: + // FIXME - We should have a single version of nodeImage instead of using platform types. + HBITMAP nodeImage(Node*) const; - float m_zoomFactor; + #endif - TextGranularity m_selectionGranularity; + private: + Page* m_page; + mutable FrameTree m_treeNode; + mutable FrameLoader m_loader; - mutable SelectionController m_selectionController; - mutable VisibleSelection m_mark; - Timer<Frame> m_caretBlinkTimer; - mutable Editor m_editor; - mutable EventHandler m_eventHandler; - mutable AnimationController m_animationController; + mutable RefPtr<DOMWindow> m_domWindow; + HashSet<DOMWindow*> m_liveFormerWindows; - RefPtr<CSSMutableStyleDeclaration> m_typingStyle; + HTMLFrameOwnerElement* m_ownerElement; + RefPtr<FrameView> m_view; + RefPtr<Document> m_doc; - Timer<Frame> m_lifeSupportTimer; + ScriptController m_script; - bool m_caretVisible; - bool m_caretPaint; - - bool m_highlightTextMatches; - bool m_inViewSourceMode; - bool m_needsReapplyStyles; - bool m_isDisconnected; - bool m_excludeFromTextSearch; + String m_kjsStatusBarText; + String m_kjsDefaultStatusBarText; -#if FRAME_LOADS_USER_STYLESHEET - UserStyleSheetLoader* m_userStyleSheetLoader; -#endif + float m_zoomFactor; + + TextGranularity m_selectionGranularity; + + mutable SelectionController m_selectionController; + mutable VisibleSelection m_mark; + Timer<Frame> m_caretBlinkTimer; + mutable Editor m_editor; + mutable EventHandler m_eventHandler; + mutable AnimationController m_animationController; + + RefPtr<CSSMutableStyleDeclaration> m_typingStyle; + + Timer<Frame> m_lifeSupportTimer; + + bool m_caretVisible; + bool m_caretPaint; + + bool m_highlightTextMatches; + bool m_inViewSourceMode; + bool m_needsReapplyStyles; + bool m_isDisconnected; + bool m_excludeFromTextSearch; + + #if FRAME_LOADS_USER_STYLESHEET + UserStyleSheetLoader* m_userStyleSheetLoader; + #endif -}; + }; } // namespace WebCore |